Implement AXIS parity UI and execution baseline

This commit is contained in:
2026-08-23 07:28:37 +08:00
parent 1325504544
commit 06f96f85e5
463 changed files with 84893 additions and 692 deletions

View File

@@ -0,0 +1,20 @@
import assert from "node:assert/strict";
import { EMPTY_STATE, reduceWorkerState, renderStatePanel } from "./state-panel.mjs";
class Node {
constructor(tag) { this.tagName = tag; this.children = []; this.className = ""; this.textContent = ""; }
append(...nodes) { this.children.push(...nodes); }
replaceChildren(...nodes) { this.children = nodes; }
}
const document = { createElement: (tag) => new Node(tag) };
const state = reduceWorkerState(EMPTY_STATE, { kind: "COMMAND_RESULT", simulation_tick: 4, payload: { status: "verified", motion: { state: { fault: "limit" } }, hal: { status: "ready" }, plc: { state: { last_error: null } }, python: { state: { errors: [1] } }, io_ack: { commands: [{ status: "pending" }] } } });
assert.equal(state.motion.state.fault, "limit");
assert.equal(state.hal.status, "ready");
assert.equal(state.python.state.errors.length, 1);
const panel = renderStatePanel(document, state);
assert.equal(panel.className, "panel state-panel");
assert.ok(panel.children.find((child) => child.className === "dro-readout"));
assert.ok(panel.children.find((child) => child.className === "state-grid")?.children.length >= 10);
const error = reduceWorkerState(state, { kind: "ERROR", payload: { code: "hal_preflight", line: 3, column: 2, text: "loadrt unknown" } });
assert.equal(error.diagnostic.line, 3);
console.log(`authoritative_panels=passed fields=${panel.children[1].children.length} fault=${state.motion.state.fault}`);