推进 INI 面板 shell integration readiness helper

This commit is contained in:
2026-06-15 07:48:47 +08:00
parent 7b17603601
commit 1f9a8c33b0
9 changed files with 283 additions and 2 deletions

View File

@@ -1668,3 +1668,98 @@ host_wasm_opfs_browser_smokes=ok
(例如 `createIniPanelShellIntegrationReadiness()`),用 integration manifest、launch manifest 和
control-page manifest 生成外部 shell 可直接展示/拦截的 readiness 状态;仍保持只读,不新增控制
按钮,不解析 G-code。
二十一、2026-06-15 继续执行记录INI panel shell integration readiness helper
本轮按“第一原则:加快实质性推进”继续推进 OPFS/session persistence 相关外部 shell 接入能力,
新增只读 shell integration readiness helper让外部 shell 能在挂载 embedded control page 前判断
integration、launch 与 control-page manifest 是否都可消费。
完成内容:
- `wasm-port/runtime/ui/ini-panel/ui-shell.js` 新增
`createIniPanelShellIntegrationReadiness()`
- readiness helper 从 shell integration manifest 派生:
- `phase: "ready" | "blocked"`
- `ready`
- `checks.integrationManifestSupported`
- `checks.launchApiManifestSupported`
- `checks.controlPageApiManifestSupported`
- `checks.launchCompatibility`
- `checks.controlPageCompatibility`
- `missing`
- `counts.pages`
- `counts.launcherLinks`
- `counts.launchMethods`
- `counts.controlPageMethods`
- `counts.persistenceCapabilities`
- `apiNames.integration/launch/controlPage`
- `createIniPanelShellViewModel()` 新增:
- `shellIntegrationReadiness`
- `createShellIntegrationReadiness`
- `createIniPanelLaunchApiManifest().methods` 新增 `getShellIntegrationReadiness`
- `launch.html` 的 `window.linuxCncIniPanelLaunchApi` 新增真实 browser 入口
`getShellIntegrationReadiness()`
- `verify_ini_panel_shell_integration_manifest.mjs` 覆盖:
- ready 正常状态;
- compatibility blocked 状态;
- malformed manifest 的 blocked 状态;
- counts 与 API names
- browser/doc 暴露点;
- `ini_panel_launch_smoke.html` 在真实 launch iframe 中校验:
- `getShellIntegrationReadiness()` 存在;
- readiness `ready === true`
- persistence capability count
- missing checks 为空;
- `verify_ini_panel_launch_api_manifest.mjs`、`verify_ini_panel_ui_shell.mjs`、
`verify_ini_panel_entry_docs.mjs` 与 `docs/panel-entry.md` 同步记录和校验;
- 未新增控制按钮;
- 未解析 G-code
- 未解释 canonical events
- 未访问 OPFS 或启动额外 iframe
- 未改变 OPFS/session persistence、LinuxCNC interpreter、tool、parameter、planner 或
LinuxCNC-owned runtime semantics。
验证已通过:
```bash
git diff --check
wasm-port/tests/ui/node/verify_ini_panel_shell_integration_manifest.sh
wasm-port/tests/ui/node/verify_ini_panel_launch_api_manifest.sh
wasm-port/tests/ui/node/verify_ini_panel_ui_shell.sh
wasm-port/tests/ui/node/verify_ini_panel_entry_docs.sh
wasm-port/tests/ui/node/verify_ui_node_smokes.sh
SKIP_INI_BUILD=1 SKIP_INTERP_BUILD=1 wasm-port/tests/browser/verify_ini_panel_browser.sh
wasm-port/tools/verify_vendor_sync.sh
wasm-port/tools/verify_no_standalone_cnc_semantics.sh
SKIP_INTERP_BUILD=1 wasm-port/tests/wasm/node/verify_interp_wasm.sh
SKIP_INTERP_BUILD=1 wasm-port/tests/wasm/node/verify_sim_configs_inventory_wasm.sh
wasm-port/tests/host/verify_host_smokes.sh
```
关键输出:
```text
ini_panel_shell_integration_manifest_node_smoke=ok
ini_panel_launch_api_manifest_node_smoke=ok
ini_panel_ui_shell_node_smoke=ok
ini_panel_entry_docs_node_smoke=ok
ui_node_smokes=ok
browser_ini_opfs_smoke=ok
browser_ini_control_page_smoke=ok
browser_ini_launch_smoke=ok
vendor sync up to date
standalone CNC semantics guard complete
interp_wasm_node_smoke=ok
sim_configs_wasm_node_inventory_executed=28
sim_configs_wasm_node_inventory_passed=28
sim_configs_wasm_node_inventory_skipped=131
sim_configs_wasm_node_inventory_unexpected_fail=0
host_wasm_opfs_browser_smokes=ok
```
下一步建议:
继续推进 browser/UI workflow。下一批建议把 shell integration readiness 接到 control-page 或 launch
的外部 shell smoke 中,形成“读取 integration manifest -> readiness gate -> 打开 control page ->
读取 readonly status”的端到端只读接入 workflow仍保持只读不新增控制按钮不解析 G-code。

View File

@@ -18,6 +18,7 @@ import {
createIniPanelLauncherLinkViewModel,
createIniPanelShellControlPageContract,
createIniPanelShellIntegrationManifest,
createIniPanelShellIntegrationReadiness,
createIniPanelShellIntegrationSchema,
createIniPanelShellViewModel,
getIniPanelEntryByHref,
@@ -118,6 +119,11 @@ needs one versioned read of pages, launcher links, launch API metadata,
control-page API metadata, OPFS/session persistence capabilities, and current
compatibility status. Use `isSupportedIniPanelShellIntegrationManifest()` when
the outer shell needs to check that integration manifest before consuming it.
Use `createIniPanelShellIntegrationReadiness()` or
`linuxCncIniPanelLaunchApi.getShellIntegrationReadiness()` when the outer shell
needs a read-only `ready`/`blocked` status, failed check names, API names, and
counts for pages, methods, and persistence capabilities before mounting any
embedded control page.
The control-page refresh workflow lives in
`runtime/ui/ini-panel/control-page-refresh-workflow.js`. Use

View File

@@ -96,6 +96,7 @@
getLaunchApiManifest: () => shellViewModel.launchApiManifest,
getShellIntegrationSchema: () => shellViewModel.shellIntegrationSchema,
getShellIntegrationManifest: () => shellViewModel.shellIntegrationManifest,
getShellIntegrationReadiness: () => shellViewModel.shellIntegrationReadiness,
getLauncherLinks: () => shellViewModel.launcherLinks,
getControlPageApiMethods: () => shellViewModel.controlPage.browserApiMethods,
};

View File

@@ -125,6 +125,7 @@ export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntr
"getLaunchApiManifest",
"getShellIntegrationSchema",
"getShellIntegrationManifest",
"getShellIntegrationReadiness",
"getLauncherLinks",
"getControlPageApiMethods",
],
@@ -265,7 +266,66 @@ export function createIniPanelShellIntegrationManifest(entries = getVisibleIniPa
};
}
export function createIniPanelShellIntegrationReadiness(
manifest = createIniPanelShellIntegrationManifest(),
) {
const integrationManifestSupported = isSupportedIniPanelShellIntegrationManifest(manifest);
const launchApiManifestSupported = integrationManifestSupported
&& isSupportedIniPanelLaunchApiManifest(manifest.launchApiManifest, manifest.launchApiSchema);
const controlPageApiManifestSupported = integrationManifestSupported
&& isSupportedIniPanelControlPageApiManifest(
manifest.controlPageApiManifest,
manifest.controlPageApiSchema,
);
const compatibility = integrationManifestSupported && manifest.compatibility
? {
launchApiManifest: Boolean(manifest.compatibility.launchApiManifest),
controlPageApiManifest: Boolean(manifest.compatibility.controlPageApiManifest),
}
: {
launchApiManifest: false,
controlPageApiManifest: false,
};
const checks = {
integrationManifestSupported,
launchApiManifestSupported,
controlPageApiManifestSupported,
launchCompatibility: compatibility.launchApiManifest,
controlPageCompatibility: compatibility.controlPageApiManifest,
};
const missing = Object.entries(checks)
.filter(([, passed]) => !passed)
.map(([name]) => name);
const ready = missing.length === 0;
return {
phase: ready ? "ready" : "blocked",
ready,
checks,
missing,
counts: {
pages: Array.isArray(manifest?.pages) ? manifest.pages.length : 0,
launcherLinks: Array.isArray(manifest?.launcherLinks) ? manifest.launcherLinks.length : 0,
launchMethods: Array.isArray(manifest?.launchApiManifest?.methods)
? manifest.launchApiManifest.methods.length
: 0,
controlPageMethods: Array.isArray(manifest?.controlPageApiManifest?.methods)
? manifest.controlPageApiManifest.methods.length
: 0,
persistenceCapabilities: Array.isArray(manifest?.persistenceCapabilities)
? manifest.persistenceCapabilities.length
: 0,
},
apiNames: {
integration: manifest?.apiName ?? null,
launch: manifest?.launchApiManifest?.apiName ?? null,
controlPage: manifest?.controlPageApiManifest?.apiName ?? null,
},
};
}
export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries()) {
const shellIntegrationManifest = createIniPanelShellIntegrationManifest(entries);
return {
pages: entries.map(({ id, href, title }) => ({
id,
@@ -274,10 +334,12 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
})),
launcherLinks: createIniPanelLauncherLinkViewModel(entries),
shellIntegrationSchema: createIniPanelShellIntegrationSchema(),
shellIntegrationManifest: createIniPanelShellIntegrationManifest(entries),
shellIntegrationManifest,
shellIntegrationReadiness: createIniPanelShellIntegrationReadiness(shellIntegrationManifest),
launchApiSchema: createIniPanelLaunchApiSchema(),
launchApiManifest: createIniPanelLaunchApiManifest(entries),
isSupportedShellIntegrationManifest: isSupportedIniPanelShellIntegrationManifest,
createShellIntegrationReadiness: createIniPanelShellIntegrationReadiness,
controlPage: {
browserApiSchema: createControlPageBrowserApiSchema(),
browserApiManifest: createControlPageBrowserApiManifest(),

View File

@@ -72,6 +72,7 @@
!launchApi?.getLaunchApiManifest ||
!launchApi?.getShellIntegrationSchema ||
!launchApi?.getShellIntegrationManifest ||
!launchApi?.getShellIntegrationReadiness ||
!launchApi?.getLauncherLinks ||
!launchApi?.getControlPageApiMethods
) {
@@ -111,11 +112,12 @@
);
assertEqual(
launchApiManifest.methods.join(","),
"isSupportedLaunchApiManifest,getLaunchApiSchema,getLaunchApiManifest,getShellIntegrationSchema,getShellIntegrationManifest,getLauncherLinks,getControlPageApiMethods",
"isSupportedLaunchApiManifest,getLaunchApiSchema,getLaunchApiManifest,getShellIntegrationSchema,getShellIntegrationManifest,getShellIntegrationReadiness,getLauncherLinks,getControlPageApiMethods",
"launch API manifest methods",
);
const shellIntegrationSchema = launchApi.getShellIntegrationSchema();
const shellIntegrationManifest = launchApi.getShellIntegrationManifest();
const shellIntegrationReadiness = launchApi.getShellIntegrationReadiness();
assertEqual(
shellIntegrationSchema.manifestVersion,
1,
@@ -141,6 +143,21 @@
"ini-panel-control-page",
"shell integration control-page manifest name",
);
assertEqual(
shellIntegrationReadiness.ready,
true,
"shell integration readiness",
);
assertEqual(
shellIntegrationReadiness.counts.persistenceCapabilities,
3,
"shell integration readiness capability count",
);
assertEqual(
shellIntegrationReadiness.missing.join(","),
"",
"shell integration readiness missing checks",
);
assertEqual(
JSON.stringify(shellIntegrationManifest),
JSON.stringify(createIniPanelShellIntegrationManifest()),

View File

@@ -15,6 +15,7 @@ import {
createIniPanelLauncherLinkViewModel,
createIniPanelShellControlPageContract,
createIniPanelShellIntegrationManifest,
createIniPanelShellIntegrationReadiness,
createIniPanelShellIntegrationSchema,
createIniPanelShellViewModel,
createMachineSessionReadonlyStatus,
@@ -55,6 +56,7 @@ const requiredShellExports = [
"createIniPanelLauncherLinkViewModel",
"createIniPanelShellControlPageContract",
"createIniPanelShellIntegrationManifest",
"createIniPanelShellIntegrationReadiness",
"createIniPanelShellIntegrationSchema",
"createIniPanelShellViewModel",
"getIniPanelEntryByHref",
@@ -122,6 +124,10 @@ assert.deepEqual(
createIniPanelShellViewModel().shellIntegrationManifest,
createIniPanelShellIntegrationManifest(),
);
assert.deepEqual(
createIniPanelShellViewModel().shellIntegrationReadiness,
createIniPanelShellIntegrationReadiness(createIniPanelShellViewModel().shellIntegrationManifest),
);
assert.equal(isSupportedIniPanelShellIntegrationManifest(createIniPanelShellViewModel().shellIntegrationManifest), true);
assert.deepEqual(createIniPanelShellViewModel().launchApiSchema, createIniPanelLaunchApiSchema());
assert.deepEqual(createIniPanelShellViewModel().launchApiManifest, createIniPanelLaunchApiManifest());
@@ -174,6 +180,7 @@ assert.match(shellText, /\bexport function createIniPanelLaunchApiSchema\b/);
assert.match(shellText, /\bexport function createIniPanelLaunchApiManifest\b/);
assert.match(shellText, /\bexport function createIniPanelShellIntegrationSchema\b/);
assert.match(shellText, /\bexport function createIniPanelShellIntegrationManifest\b/);
assert.match(shellText, /\bexport function createIniPanelShellIntegrationReadiness\b/);
assert.match(shellText, /\bexport function isSupportedIniPanelControlPageApiManifest\b/);
assert.match(shellText, /\bexport function isSupportedIniPanelLaunchApiManifest\b/);
assert.match(shellText, /\bexport function isSupportedIniPanelShellIntegrationManifest\b/);
@@ -187,6 +194,7 @@ assert.match(launchText, /\bgetLaunchApiSchema\b/);
assert.match(launchText, /\bgetLaunchApiManifest\b/);
assert.match(launchText, /\bgetShellIntegrationSchema\b/);
assert.match(launchText, /\bgetShellIntegrationManifest\b/);
assert.match(launchText, /\bgetShellIntegrationReadiness\b/);
assert.match(launchText, /\bgetControlPageApiMethods\b/);
assert.match(controlPageText, /\bgetControlPageContract\b/);
assert.match(controlPageText, /\breadControlPageStatus\b/);
@@ -202,6 +210,7 @@ assert.match(docText, /\bcreateControlPageBrowserApiSchema\b/);
assert.match(docText, /\bcreateIniPanelLaunchApiManifest\b/);
assert.match(docText, /\bcreateIniPanelLaunchApiSchema\b/);
assert.match(docText, /\bcreateIniPanelShellIntegrationManifest\b/);
assert.match(docText, /\bcreateIniPanelShellIntegrationReadiness\b/);
assert.match(docText, /\bcreateIniPanelShellIntegrationSchema\b/);
assert.match(docText, /\bisSupportedIniPanelControlPageApiManifest\b/);
assert.match(docText, /\bisSupportedIniPanelLaunchApiManifest\b/);
@@ -211,6 +220,7 @@ assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getLaunchApiSchema\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getLaunchApiManifest\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellIntegrationSchema\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellIntegrationManifest\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellIntegrationReadiness\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getControlPageApiMethods\b/);
assert.match(docText, /\bOPFS\/session persistence capabilities\b/);
assert.match(docText, /\bmachine files\b/);

View File

@@ -45,6 +45,7 @@ assert.deepEqual(manifest, {
"getLaunchApiManifest",
"getShellIntegrationSchema",
"getShellIntegrationManifest",
"getShellIntegrationReadiness",
"getLauncherLinks",
"getControlPageApiMethods",
],
@@ -144,6 +145,7 @@ assert.match(launchText, /\bgetLaunchApiSchema\b/);
assert.match(launchText, /\bgetLaunchApiManifest\b/);
assert.match(launchText, /\bgetShellIntegrationSchema\b/);
assert.match(launchText, /\bgetShellIntegrationManifest\b/);
assert.match(launchText, /\bgetShellIntegrationReadiness\b/);
assert.match(launchText, /\blinuxCncIniPanelLaunchApi\b/);
console.log("ini_panel_launch_api_manifest_node_smoke=ok");

View File

@@ -11,6 +11,7 @@ import {
createIniPanelLaunchApiSchema,
createIniPanelLauncherLinkViewModel,
createIniPanelShellIntegrationManifest,
createIniPanelShellIntegrationReadiness,
createIniPanelShellIntegrationSchema,
getVisibleIniPanelEntries,
isSupportedIniPanelShellIntegrationManifest,
@@ -24,6 +25,7 @@ const docText = readFileSync(resolve(root, "docs/panel-entry.md"), "utf8");
const schema = createIniPanelShellIntegrationSchema();
const manifest = createIniPanelShellIntegrationManifest();
const readiness = createIniPanelShellIntegrationReadiness(manifest);
assert.deepEqual(schema, {
apiName: "ini-panel-shell-integration",
@@ -65,6 +67,80 @@ const missingControlPageManifest = { ...manifest };
delete missingControlPageManifest.controlPageApiManifest;
assert.equal(isSupportedIniPanelShellIntegrationManifest(missingControlPageManifest), false);
assert.equal(isSupportedIniPanelShellIntegrationManifest(null), false);
assert.deepEqual(readiness, {
phase: "ready",
ready: true,
checks: {
integrationManifestSupported: true,
launchApiManifestSupported: true,
controlPageApiManifestSupported: true,
launchCompatibility: true,
controlPageCompatibility: true,
},
missing: [],
counts: {
pages: 2,
launcherLinks: 2,
launchMethods: 8,
controlPageMethods: 11,
persistenceCapabilities: 3,
},
apiNames: {
integration: "ini-panel-shell-integration",
launch: "ini-panel-launch",
controlPage: "ini-panel-control-page",
},
});
const blockedManifest = {
...createIniPanelShellIntegrationManifest(),
compatibility: {
launchApiManifest: false,
controlPageApiManifest: true,
},
};
assert.deepEqual(createIniPanelShellIntegrationReadiness(blockedManifest), {
phase: "blocked",
ready: false,
checks: {
integrationManifestSupported: true,
launchApiManifestSupported: true,
controlPageApiManifestSupported: true,
launchCompatibility: false,
controlPageCompatibility: true,
},
missing: ["launchCompatibility"],
counts: {
pages: 2,
launcherLinks: 2,
launchMethods: 8,
controlPageMethods: 11,
persistenceCapabilities: 3,
},
apiNames: {
integration: "ini-panel-shell-integration",
launch: "ini-panel-launch",
controlPage: "ini-panel-control-page",
},
});
const malformedReadiness = createIniPanelShellIntegrationReadiness({
apiName: "other",
});
assert.equal(malformedReadiness.phase, "blocked");
assert.equal(malformedReadiness.ready, false);
assert.deepEqual(malformedReadiness.missing, [
"integrationManifestSupported",
"launchApiManifestSupported",
"controlPageApiManifestSupported",
"launchCompatibility",
"controlPageCompatibility",
]);
assert.deepEqual(malformedReadiness.counts, {
pages: 0,
launcherLinks: 0,
launchMethods: 0,
controlPageMethods: 0,
persistenceCapabilities: 0,
});
manifest.pages[0].title = "changed";
manifest.launcherLinks[0].label = "changed";
@@ -117,10 +193,13 @@ assert.deepEqual(customManifest.launchApiManifest.targetPages, [
assert.match(shellText, /\bexport function createIniPanelShellIntegrationSchema\b/);
assert.match(shellText, /\bexport function createIniPanelShellIntegrationManifest\b/);
assert.match(shellText, /\bexport function createIniPanelShellIntegrationReadiness\b/);
assert.match(shellText, /\bexport function isSupportedIniPanelShellIntegrationManifest\b/);
assert.match(launchText, /\bgetShellIntegrationSchema\b/);
assert.match(launchText, /\bgetShellIntegrationManifest\b/);
assert.match(launchText, /\bgetShellIntegrationReadiness\b/);
assert.match(docText, /\bcreateIniPanelShellIntegrationManifest\b/);
assert.match(docText, /\bcreateIniPanelShellIntegrationReadiness\b/);
assert.match(docText, /\bisSupportedIniPanelShellIntegrationManifest\b/);
assert.doesNotMatch(shellText, /\bparseGcode\b|\bcanonicalEvents\b|\btoolTable\b|\bplanner\b/);

View File

@@ -11,6 +11,7 @@ import {
createIniPanelLauncherLinkViewModel,
createIniPanelShellControlPageContract,
createIniPanelShellIntegrationManifest,
createIniPanelShellIntegrationReadiness,
createIniPanelShellIntegrationSchema,
createIniPanelShellViewModel,
createMachineSessionReadonlyStatus,
@@ -61,6 +62,7 @@ assert.equal(typeof createIniPanelLaunchApiManifest, "function");
assert.equal(typeof createIniPanelLaunchApiSchema, "function");
assert.equal(typeof createIniPanelShellControlPageContract, "function");
assert.equal(typeof createIniPanelShellIntegrationManifest, "function");
assert.equal(typeof createIniPanelShellIntegrationReadiness, "function");
assert.equal(typeof createIniPanelShellIntegrationSchema, "function");
assert.equal(typeof loadMachineSessionForControlPageWorkflow, "function");
assert.equal(typeof readMachineSessionReadonlyStatus, "function");
@@ -107,6 +109,10 @@ assert.deepEqual(shellViewModel.pages, [
assert.deepEqual(shellViewModel.launcherLinks, createIniPanelLauncherLinkViewModel());
assert.deepEqual(shellViewModel.shellIntegrationSchema, createIniPanelShellIntegrationSchema());
assert.deepEqual(shellViewModel.shellIntegrationManifest, createIniPanelShellIntegrationManifest());
assert.deepEqual(
shellViewModel.shellIntegrationReadiness,
createIniPanelShellIntegrationReadiness(shellViewModel.shellIntegrationManifest),
);
assert.equal(
isSupportedIniPanelShellIntegrationManifest(shellViewModel.shellIntegrationManifest),
true,
@@ -121,6 +127,8 @@ assert.deepEqual(shellViewModel.shellIntegrationManifest.compatibility, {
launchApiManifest: true,
controlPageApiManifest: true,
});
assert.equal(shellViewModel.shellIntegrationReadiness.ready, true);
assert.deepEqual(shellViewModel.shellIntegrationReadiness.missing, []);
assert.deepEqual(shellViewModel.launchApiSchema, createIniPanelLaunchApiSchema());
assert.deepEqual(shellViewModel.launchApiManifest, createIniPanelLaunchApiManifest());
assert.equal(isSupportedIniPanelLaunchApiManifest(shellViewModel.launchApiManifest), true);
@@ -135,6 +143,7 @@ assert.equal(
);
assert.equal(shellViewModel.controlPage.createController, createMachineSessionControlPageController);
assert.equal(shellViewModel.isSupportedShellIntegrationManifest, isSupportedIniPanelShellIntegrationManifest);
assert.equal(shellViewModel.createShellIntegrationReadiness, createIniPanelShellIntegrationReadiness);
assert.deepEqual(shellViewModel.controlPage.contract, createIniPanelShellControlPageContract());
assert.equal(shellViewModel.controlPage.isSupportedBrowserApiManifest, isSupportedIniPanelControlPageApiManifest);
assert.equal(shellViewModel.controlPage.loadSessionState, loadMachineSessionForControlPageWorkflow);