推进 INI 面板 restore/load session workflow helper

This commit is contained in:
2026-06-14 21:30:19 +08:00
parent ddc9a4e0f3
commit 8e8a319d78
5 changed files with 364 additions and 22 deletions

View File

@@ -8,9 +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.
`runtime/ui/ini-panel/session-workflow.js` contains the reusable UI workflows
for saving, restoring, and restore-loading a machine session snapshot as
host-boundary operations.
The helpers do not implement CNC behavior. G-code execution, canonical events,
tool handling, parameters, kinematics, and planner behavior remain owned by the
@@ -72,6 +72,40 @@ The persistence functions are injected by the caller:
}
```
## `restoreMachineSessionSnapshotWorkflow(input)`
The workflow loads the machine session snapshot, loads the persisted machine
text files so the editor can be restored, and optionally loads the machine
session into the interpreter WASM filesystem.
When `loadSession` is omitted, the returned `fields` contain the OPFS snapshot
paths. When `loadSession` is supplied, the returned `fields` contain the loaded
WASM paths for INI/parameter/tool-table files and the snapshot G-code OPFS
path.
The returned object has this shape:
```js
{
snapshot: { ... },
editorIniText: "[EMC]\n...",
summary: { snapshotLabel: "...", workflow: "save-session-snapshot" },
fields: {
sessionIni: "/work/session-machine.ini",
sessionParameters: "/work/session-linuxcnc.var",
sessionToolTable: "/work/session-tool.tbl",
sessionGcode: "linuxcnc/gcode/ui-session.ngc",
sessionSnapshot: "ui-machine-session/ui-machine-session.json"
},
loadSummary: { iniWasmPath: "/work/session-machine.ini" },
loadedSession: { ... },
logLines: [
"Snapshot: ui-machine-session/ui-machine-session.json",
"Workflow: save-session-snapshot"
]
}
```
The returned object has this shape:
```js
@@ -102,6 +136,8 @@ The returned object has this shape:
OPFS-to-WASM mapping and captured result lines.
- `sessionSnapshotSaveLogLines(summary)` renders the save-workflow snapshot
paths used by the INI panel.
- `sessionSnapshotRestoreLogLines(summary)` renders the restore-workflow
snapshot paths used by the INI panel.
## Boundary Rules