推进 INI 面板 session snapshot workflow helper

This commit is contained in:
2026-06-14 21:21:17 +08:00
parent 48a0f61b4a
commit 4e4a9c667f
7 changed files with 356 additions and 71 deletions

View File

@@ -8,6 +8,9 @@ for summarizing machine session snapshot state.
for machine-session load state. These helpers are pure so browser UI panels,
SDK-facing wrappers, and Node smoke tests can share the same data shape without
parsing log text.
`runtime/ui/ini-panel/session-workflow.js` contains the reusable UI workflow for
saving the machine text files, default G-code, and machine session snapshot as
one host-boundary operation.
The helpers do not implement CNC behavior. G-code execution, canonical events,
tool handling, parameters, kinematics, and planner behavior remain owned by the
@@ -53,6 +56,42 @@ The returned summary has this shape:
}
```
## `saveMachineSessionSnapshotWorkflow(input)`
The workflow writes the current INI/tool/parameter text files, writes the
default G-code program, saves the machine session snapshot, and returns the
snapshot summary, field state, and log lines for UI consumers.
The persistence functions are injected by the caller:
```js
{
saveMachineTextFiles,
saveGcodeProgram,
saveMachineSessionSnapshot
}
```
The returned object has this shape:
```js
{
snapshot: { ... },
summary: { snapshotLabel: "...", workflow: "save-session-snapshot" },
fields: {
sessionIni: "linuxcnc/machines/xyzab-tdr/machine.ini",
sessionParameters: "linuxcnc/machines/xyzab-tdr/linuxcnc.var",
sessionToolTable: "linuxcnc/machines/xyzab-tdr/tool.tbl",
sessionGcode: "linuxcnc/gcode/ui-session.ngc",
sessionSnapshot: "ui-machine-session/ui-machine-session.json"
},
logLines: [
"Snapshot: ui-machine-session/ui-machine-session.json",
"Workflow: save-session-snapshot"
]
}
```
## Log Helpers
- `sessionSnapshotSummaryLogLines(summary)` renders snapshot label, workflow,
@@ -61,6 +100,8 @@ The returned summary has this shape:
save/restore log summaries.
- `machineSessionLoadLogLines(summary)` renders the interpreter/session
OPFS-to-WASM mapping and captured result lines.
- `sessionSnapshotSaveLogLines(summary)` renders the save-workflow snapshot
paths used by the INI panel.
## Boundary Rules
@@ -76,6 +117,7 @@ Run the focused Node smoke after changing these helpers:
```bash
wasm-port/tests/ui/node/verify_ini_panel_session_summary.sh
wasm-port/tests/ui/node/verify_ini_panel_session_workflow.sh
```
The aggregate UI Node smoke is: