推进 INI 面板 shell integration manifest

This commit is contained in:
2026-06-15 07:42:22 +08:00
parent b3f131fa5f
commit 7b17603601
11 changed files with 406 additions and 1 deletions

View File

@@ -1569,3 +1569,102 @@ host_wasm_opfs_browser_smokes=ok
可复用的 shell integration manifest例如 `createIniPanelShellIntegrationManifest()`),让外部 可复用的 shell integration manifest例如 `createIniPanelShellIntegrationManifest()`),让外部
shell 一次读取入口页、目标页、launch API、control-page API、OPFS/session persistence 能力与 shell 一次读取入口页、目标页、launch API、control-page API、OPFS/session persistence 能力与
compatibility predicate 状态;仍保持只读,不新增控制按钮,不解析 G-code。 compatibility predicate 状态;仍保持只读,不新增控制按钮,不解析 G-code。
二十、2026-06-15 继续执行记录INI panel shell integration manifest
本轮按“第一原则:加快实质性推进”继续推进 SDK/API surface把 launch API 与 control-page API
组合成可复用的 shell integration manifest让外部 shell 能一次读取入口页、目标页、两类 API
manifest、OPFS/session persistence 能力与 compatibility 状态。
完成内容:
- `wasm-port/runtime/ui/ini-panel/ui-shell.js` 新增:
- `createIniPanelShellIntegrationSchema()`
- `createIniPanelShellIntegrationManifest()`
- `isSupportedIniPanelShellIntegrationManifest()`
- shell integration manifest 固定暴露:
- `pages`
- `launcherLinks`
- `launchApiSchema`
- `launchApiManifest`
- `controlPageApiSchema`
- `controlPageApiManifest`
- `compatibility.launchApiManifest`
- `compatibility.controlPageApiManifest`
- `persistenceCapabilities`
- `createIniPanelShellViewModel()` 新增:
- `shellIntegrationSchema`
- `shellIntegrationManifest`
- `isSupportedShellIntegrationManifest`
- `createIniPanelLaunchApiManifest().methods` 新增:
- `getShellIntegrationSchema`
- `getShellIntegrationManifest`
- `launch.html` 的 `window.linuxCncIniPanelLaunchApi` 新增真实 browser 入口:
- `getShellIntegrationSchema()`
- `getShellIntegrationManifest()`
- 新增 `verify_ini_panel_shell_integration_manifest.mjs/.sh`,覆盖:
- schema 固定字段;
- manifest 完整 shape
- supported、错误 version、错误 apiName、缺少字段和 null 输入;
- 修改返回对象不污染 `INI_PANEL_ENTRIES` 或后续 manifest
- custom entries 的 pages、launcher links 和 launch target pages
- 不引入 JS CNC 语义;
- `verify_ui_node_smokes.sh` 纳入 shell integration manifest focused gate
- `ini_panel_launch_smoke.html` 在真实 launch iframe 中校验:
- `getShellIntegrationSchema()`
- `getShellIntegrationManifest()`
- launch/control-page compatibility 均为 true
- control-page manifest 名称;
- browser manifest 与模块 helper 结果一致;
- `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/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
```
下一步建议:
继续推进 OPFS/session persistence。下一批建议增加只读 shell integration readiness helper
(例如 `createIniPanelShellIntegrationReadiness()`),用 integration manifest、launch manifest 和
control-page manifest 生成外部 shell 可直接展示/拦截的 readiness 状态;仍保持只读,不新增控制
按钮,不解析 G-code。

View File

@@ -17,6 +17,8 @@ import {
createIniPanelLaunchApiSchema, createIniPanelLaunchApiSchema,
createIniPanelLauncherLinkViewModel, createIniPanelLauncherLinkViewModel,
createIniPanelShellControlPageContract, createIniPanelShellControlPageContract,
createIniPanelShellIntegrationManifest,
createIniPanelShellIntegrationSchema,
createIniPanelShellViewModel, createIniPanelShellViewModel,
getIniPanelEntryByHref, getIniPanelEntryByHref,
getVisibleIniPanelEntries, getVisibleIniPanelEntries,
@@ -31,6 +33,7 @@ import {
renderMachineSessionControlView, renderMachineSessionControlView,
isSupportedIniPanelControlPageApiManifest, isSupportedIniPanelControlPageApiManifest,
isSupportedIniPanelLaunchApiManifest, isSupportedIniPanelLaunchApiManifest,
isSupportedIniPanelShellIntegrationManifest,
} from "../runtime/ui/ini-panel/ui-shell.js"; } from "../runtime/ui/ini-panel/ui-shell.js";
``` ```
@@ -107,6 +110,14 @@ fields.
Use `isSupportedIniPanelLaunchApiManifest()` or Use `isSupportedIniPanelLaunchApiManifest()` or
`linuxCncIniPanelLaunchApi.isSupportedLaunchApiManifest()` for a read-only `linuxCncIniPanelLaunchApi.isSupportedLaunchApiManifest()` for a read-only
compatibility predicate before using a launch manifest. compatibility predicate before using a launch manifest.
Use `createIniPanelShellIntegrationSchema()`,
`createIniPanelShellIntegrationManifest()`,
`linuxCncIniPanelLaunchApi.getShellIntegrationSchema()`, or
`linuxCncIniPanelLaunchApi.getShellIntegrationManifest()` when an outer shell
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.
The control-page refresh workflow lives in The control-page refresh workflow lives in
`runtime/ui/ini-panel/control-page-refresh-workflow.js`. Use `runtime/ui/ini-panel/control-page-refresh-workflow.js`. Use

View File

@@ -94,6 +94,8 @@
isSupportedLaunchApiManifest: isSupportedIniPanelLaunchApiManifest, isSupportedLaunchApiManifest: isSupportedIniPanelLaunchApiManifest,
getLaunchApiSchema: () => shellViewModel.launchApiSchema, getLaunchApiSchema: () => shellViewModel.launchApiSchema,
getLaunchApiManifest: () => shellViewModel.launchApiManifest, getLaunchApiManifest: () => shellViewModel.launchApiManifest,
getShellIntegrationSchema: () => shellViewModel.shellIntegrationSchema,
getShellIntegrationManifest: () => shellViewModel.shellIntegrationManifest,
getLauncherLinks: () => shellViewModel.launcherLinks, getLauncherLinks: () => shellViewModel.launcherLinks,
getControlPageApiMethods: () => shellViewModel.controlPage.browserApiMethods, getControlPageApiMethods: () => shellViewModel.controlPage.browserApiMethods,
}; };

View File

@@ -123,6 +123,8 @@ export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntr
"isSupportedLaunchApiManifest", "isSupportedLaunchApiManifest",
"getLaunchApiSchema", "getLaunchApiSchema",
"getLaunchApiManifest", "getLaunchApiManifest",
"getShellIntegrationSchema",
"getShellIntegrationManifest",
"getLauncherLinks", "getLauncherLinks",
"getControlPageApiMethods", "getControlPageApiMethods",
], ],
@@ -201,6 +203,68 @@ export function createControlPageBrowserApiManifest() {
}; };
} }
export function createIniPanelShellIntegrationSchema() {
return {
apiName: "ini-panel-shell-integration",
manifestVersion: 1,
fields: [
"apiName",
"manifestVersion",
"pages",
"launcherLinks",
"launchApiSchema",
"launchApiManifest",
"controlPageApiSchema",
"controlPageApiManifest",
"compatibility",
"persistenceCapabilities",
],
};
}
export function isSupportedIniPanelShellIntegrationManifest(
manifest,
schema = createIniPanelShellIntegrationSchema(),
) {
if (!manifest || typeof manifest !== "object") {
return false;
}
if (manifest.apiName !== schema.apiName || manifest.manifestVersion !== schema.manifestVersion) {
return false;
}
return schema.fields.every((fieldName) => Object.hasOwn(manifest, fieldName));
}
export function createIniPanelShellIntegrationManifest(entries = getVisibleIniPanelEntries()) {
const schema = createIniPanelShellIntegrationSchema();
const launchApiSchema = createIniPanelLaunchApiSchema();
const launchApiManifest = createIniPanelLaunchApiManifest(entries);
const controlPageApiSchema = createControlPageBrowserApiSchema();
const controlPageApiManifest = createControlPageBrowserApiManifest();
return {
apiName: schema.apiName,
manifestVersion: schema.manifestVersion,
pages: entries.map(({ id, href, title }) => ({
id,
href,
title,
})),
launcherLinks: createIniPanelLauncherLinkViewModel(entries),
launchApiSchema,
launchApiManifest,
controlPageApiSchema,
controlPageApiManifest,
compatibility: {
launchApiManifest: isSupportedIniPanelLaunchApiManifest(launchApiManifest, launchApiSchema),
controlPageApiManifest: isSupportedIniPanelControlPageApiManifest(
controlPageApiManifest,
controlPageApiSchema,
),
},
persistenceCapabilities: launchApiManifest.persistenceCapabilities,
};
}
export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries()) { export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries()) {
return { return {
pages: entries.map(({ id, href, title }) => ({ pages: entries.map(({ id, href, title }) => ({
@@ -209,8 +273,11 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
title, title,
})), })),
launcherLinks: createIniPanelLauncherLinkViewModel(entries), launcherLinks: createIniPanelLauncherLinkViewModel(entries),
shellIntegrationSchema: createIniPanelShellIntegrationSchema(),
shellIntegrationManifest: createIniPanelShellIntegrationManifest(entries),
launchApiSchema: createIniPanelLaunchApiSchema(), launchApiSchema: createIniPanelLaunchApiSchema(),
launchApiManifest: createIniPanelLaunchApiManifest(entries), launchApiManifest: createIniPanelLaunchApiManifest(entries),
isSupportedShellIntegrationManifest: isSupportedIniPanelShellIntegrationManifest,
controlPage: { controlPage: {
browserApiSchema: createControlPageBrowserApiSchema(), browserApiSchema: createControlPageBrowserApiSchema(),
browserApiManifest: createControlPageBrowserApiManifest(), browserApiManifest: createControlPageBrowserApiManifest(),

View File

@@ -11,6 +11,7 @@
createControlPageBrowserApiMethods, createControlPageBrowserApiMethods,
createIniPanelLaunchApiManifest, createIniPanelLaunchApiManifest,
createIniPanelLauncherLinkViewModel, createIniPanelLauncherLinkViewModel,
createIniPanelShellIntegrationManifest,
createIniPanelShellViewModel, createIniPanelShellViewModel,
getIniPanelEntryByHref, getIniPanelEntryByHref,
getVisibleIniPanelEntries, getVisibleIniPanelEntries,
@@ -69,6 +70,8 @@
!launchApi?.isSupportedLaunchApiManifest || !launchApi?.isSupportedLaunchApiManifest ||
!launchApi?.getLaunchApiSchema || !launchApi?.getLaunchApiSchema ||
!launchApi?.getLaunchApiManifest || !launchApi?.getLaunchApiManifest ||
!launchApi?.getShellIntegrationSchema ||
!launchApi?.getShellIntegrationManifest ||
!launchApi?.getLauncherLinks || !launchApi?.getLauncherLinks ||
!launchApi?.getControlPageApiMethods !launchApi?.getControlPageApiMethods
) { ) {
@@ -108,9 +111,41 @@
); );
assertEqual( assertEqual(
launchApiManifest.methods.join(","), launchApiManifest.methods.join(","),
"isSupportedLaunchApiManifest,getLaunchApiSchema,getLaunchApiManifest,getLauncherLinks,getControlPageApiMethods", "isSupportedLaunchApiManifest,getLaunchApiSchema,getLaunchApiManifest,getShellIntegrationSchema,getShellIntegrationManifest,getLauncherLinks,getControlPageApiMethods",
"launch API manifest methods", "launch API manifest methods",
); );
const shellIntegrationSchema = launchApi.getShellIntegrationSchema();
const shellIntegrationManifest = launchApi.getShellIntegrationManifest();
assertEqual(
shellIntegrationSchema.manifestVersion,
1,
"shell integration schema manifest version",
);
assertEqual(
shellIntegrationManifest.apiName,
"ini-panel-shell-integration",
"shell integration manifest API name",
);
assertEqual(
shellIntegrationManifest.compatibility.launchApiManifest,
true,
"shell integration launch compatibility",
);
assertEqual(
shellIntegrationManifest.compatibility.controlPageApiManifest,
true,
"shell integration control-page compatibility",
);
assertEqual(
shellIntegrationManifest.controlPageApiManifest.apiName,
"ini-panel-control-page",
"shell integration control-page manifest name",
);
assertEqual(
JSON.stringify(shellIntegrationManifest),
JSON.stringify(createIniPanelShellIntegrationManifest()),
"shell integration manifest",
);
assertEqual( assertEqual(
launchApiManifest.visibleEntries.length, launchApiManifest.visibleEntries.length,
2, 2,

View File

@@ -14,6 +14,8 @@ import {
createIniPanelLaunchApiSchema, createIniPanelLaunchApiSchema,
createIniPanelLauncherLinkViewModel, createIniPanelLauncherLinkViewModel,
createIniPanelShellControlPageContract, createIniPanelShellControlPageContract,
createIniPanelShellIntegrationManifest,
createIniPanelShellIntegrationSchema,
createIniPanelShellViewModel, createIniPanelShellViewModel,
createMachineSessionReadonlyStatus, createMachineSessionReadonlyStatus,
createMachineSessionReadonlyStatusApiManifest, createMachineSessionReadonlyStatusApiManifest,
@@ -23,6 +25,7 @@ import {
getVisibleIniPanelEntries, getVisibleIniPanelEntries,
isSupportedIniPanelControlPageApiManifest, isSupportedIniPanelControlPageApiManifest,
isSupportedIniPanelLaunchApiManifest, isSupportedIniPanelLaunchApiManifest,
isSupportedIniPanelShellIntegrationManifest,
} from "../../../runtime/ui/ini-panel/ui-shell.js"; } from "../../../runtime/ui/ini-panel/ui-shell.js";
const __dirname = dirname(fileURLToPath(import.meta.url)); const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -51,11 +54,14 @@ const requiredShellExports = [
"createIniPanelLaunchApiSchema", "createIniPanelLaunchApiSchema",
"createIniPanelLauncherLinkViewModel", "createIniPanelLauncherLinkViewModel",
"createIniPanelShellControlPageContract", "createIniPanelShellControlPageContract",
"createIniPanelShellIntegrationManifest",
"createIniPanelShellIntegrationSchema",
"createIniPanelShellViewModel", "createIniPanelShellViewModel",
"getIniPanelEntryByHref", "getIniPanelEntryByHref",
"getVisibleIniPanelEntries", "getVisibleIniPanelEntries",
"isSupportedIniPanelControlPageApiManifest", "isSupportedIniPanelControlPageApiManifest",
"isSupportedIniPanelLaunchApiManifest", "isSupportedIniPanelLaunchApiManifest",
"isSupportedIniPanelShellIntegrationManifest",
"createMachineSessionControlPageController", "createMachineSessionControlPageController",
"createMachineSessionReadonlyStatus", "createMachineSessionReadonlyStatus",
"createMachineSessionReadonlyStatusApiManifest", "createMachineSessionReadonlyStatusApiManifest",
@@ -108,6 +114,15 @@ assert.deepEqual(
); );
assert.deepEqual(createIniPanelShellViewModel().pages, getVisibleIniPanelEntries()); assert.deepEqual(createIniPanelShellViewModel().pages, getVisibleIniPanelEntries());
assert.deepEqual(createIniPanelShellViewModel().launcherLinks, createIniPanelLauncherLinkViewModel()); assert.deepEqual(createIniPanelShellViewModel().launcherLinks, createIniPanelLauncherLinkViewModel());
assert.deepEqual(
createIniPanelShellViewModel().shellIntegrationSchema,
createIniPanelShellIntegrationSchema(),
);
assert.deepEqual(
createIniPanelShellViewModel().shellIntegrationManifest,
createIniPanelShellIntegrationManifest(),
);
assert.equal(isSupportedIniPanelShellIntegrationManifest(createIniPanelShellViewModel().shellIntegrationManifest), true);
assert.deepEqual(createIniPanelShellViewModel().launchApiSchema, createIniPanelLaunchApiSchema()); assert.deepEqual(createIniPanelShellViewModel().launchApiSchema, createIniPanelLaunchApiSchema());
assert.deepEqual(createIniPanelShellViewModel().launchApiManifest, createIniPanelLaunchApiManifest()); assert.deepEqual(createIniPanelShellViewModel().launchApiManifest, createIniPanelLaunchApiManifest());
assert.equal(isSupportedIniPanelLaunchApiManifest(createIniPanelShellViewModel().launchApiManifest), true); assert.equal(isSupportedIniPanelLaunchApiManifest(createIniPanelShellViewModel().launchApiManifest), true);
@@ -157,8 +172,11 @@ assert.match(shellText, /\bexport function createControlPageBrowserApiManifest\b
assert.match(shellText, /\bexport function createControlPageBrowserApiSchema\b/); assert.match(shellText, /\bexport function createControlPageBrowserApiSchema\b/);
assert.match(shellText, /\bexport function createIniPanelLaunchApiSchema\b/); assert.match(shellText, /\bexport function createIniPanelLaunchApiSchema\b/);
assert.match(shellText, /\bexport function createIniPanelLaunchApiManifest\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 isSupportedIniPanelControlPageApiManifest\b/); assert.match(shellText, /\bexport function isSupportedIniPanelControlPageApiManifest\b/);
assert.match(shellText, /\bexport function isSupportedIniPanelLaunchApiManifest\b/); assert.match(shellText, /\bexport function isSupportedIniPanelLaunchApiManifest\b/);
assert.match(shellText, /\bexport function isSupportedIniPanelShellIntegrationManifest\b/);
assert.match(controlPageText, /\bisSupportedControlPageApiManifest\b/); assert.match(controlPageText, /\bisSupportedControlPageApiManifest\b/);
assert.match(controlPageText, /\bgetControlPageApiSchema\b/); assert.match(controlPageText, /\bgetControlPageApiSchema\b/);
assert.match(controlPageText, /\bgetControlPageApiManifest\b/); assert.match(controlPageText, /\bgetControlPageApiManifest\b/);
@@ -167,6 +185,8 @@ assert.match(launchText, /\blinuxCncIniPanelLaunchApi\b/);
assert.match(launchText, /\bisSupportedLaunchApiManifest\b/); assert.match(launchText, /\bisSupportedLaunchApiManifest\b/);
assert.match(launchText, /\bgetLaunchApiSchema\b/); assert.match(launchText, /\bgetLaunchApiSchema\b/);
assert.match(launchText, /\bgetLaunchApiManifest\b/); assert.match(launchText, /\bgetLaunchApiManifest\b/);
assert.match(launchText, /\bgetShellIntegrationSchema\b/);
assert.match(launchText, /\bgetShellIntegrationManifest\b/);
assert.match(launchText, /\bgetControlPageApiMethods\b/); assert.match(launchText, /\bgetControlPageApiMethods\b/);
assert.match(controlPageText, /\bgetControlPageContract\b/); assert.match(controlPageText, /\bgetControlPageContract\b/);
assert.match(controlPageText, /\breadControlPageStatus\b/); assert.match(controlPageText, /\breadControlPageStatus\b/);
@@ -181,11 +201,16 @@ assert.match(docText, /\bcreateControlPageBrowserApiManifest\b/);
assert.match(docText, /\bcreateControlPageBrowserApiSchema\b/); assert.match(docText, /\bcreateControlPageBrowserApiSchema\b/);
assert.match(docText, /\bcreateIniPanelLaunchApiManifest\b/); assert.match(docText, /\bcreateIniPanelLaunchApiManifest\b/);
assert.match(docText, /\bcreateIniPanelLaunchApiSchema\b/); assert.match(docText, /\bcreateIniPanelLaunchApiSchema\b/);
assert.match(docText, /\bcreateIniPanelShellIntegrationManifest\b/);
assert.match(docText, /\bcreateIniPanelShellIntegrationSchema\b/);
assert.match(docText, /\bisSupportedIniPanelControlPageApiManifest\b/); assert.match(docText, /\bisSupportedIniPanelControlPageApiManifest\b/);
assert.match(docText, /\bisSupportedIniPanelLaunchApiManifest\b/); assert.match(docText, /\bisSupportedIniPanelLaunchApiManifest\b/);
assert.match(docText, /\bisSupportedIniPanelShellIntegrationManifest\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.isSupportedLaunchApiManifest\b/); assert.match(docText, /\blinuxCncIniPanelLaunchApi\.isSupportedLaunchApiManifest\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getLaunchApiSchema\b/); assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getLaunchApiSchema\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getLaunchApiManifest\b/); assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getLaunchApiManifest\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellIntegrationSchema\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellIntegrationManifest\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getControlPageApiMethods\b/); assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getControlPageApiMethods\b/);
assert.match(docText, /\bOPFS\/session persistence capabilities\b/); assert.match(docText, /\bOPFS\/session persistence capabilities\b/);
assert.match(docText, /\bmachine files\b/); assert.match(docText, /\bmachine files\b/);

View File

@@ -8,6 +8,7 @@ import {
createControlPageBrowserApiMethods, createControlPageBrowserApiMethods,
createIniPanelLaunchApiManifest, createIniPanelLaunchApiManifest,
createIniPanelLaunchApiSchema, createIniPanelLaunchApiSchema,
createIniPanelShellIntegrationManifest,
createIniPanelShellViewModel, createIniPanelShellViewModel,
getVisibleIniPanelEntries, getVisibleIniPanelEntries,
isSupportedIniPanelLaunchApiManifest, isSupportedIniPanelLaunchApiManifest,
@@ -42,6 +43,8 @@ assert.deepEqual(manifest, {
"isSupportedLaunchApiManifest", "isSupportedLaunchApiManifest",
"getLaunchApiSchema", "getLaunchApiSchema",
"getLaunchApiManifest", "getLaunchApiManifest",
"getShellIntegrationSchema",
"getShellIntegrationManifest",
"getLauncherLinks", "getLauncherLinks",
"getControlPageApiMethods", "getControlPageApiMethods",
], ],
@@ -89,6 +92,10 @@ assert.deepEqual(manifest, {
assert.deepEqual(createIniPanelShellViewModel().launchApiManifest, manifest); assert.deepEqual(createIniPanelShellViewModel().launchApiManifest, manifest);
assert.deepEqual(createIniPanelShellViewModel().launchApiSchema, schema); assert.deepEqual(createIniPanelShellViewModel().launchApiSchema, schema);
assert.deepEqual(
createIniPanelShellViewModel().shellIntegrationManifest,
createIniPanelShellIntegrationManifest(),
);
assert.equal(createIniPanelShellViewModel().launchApiManifest.manifestVersion, schema.manifestVersion); assert.equal(createIniPanelShellViewModel().launchApiManifest.manifestVersion, schema.manifestVersion);
assert.equal(isSupportedIniPanelLaunchApiManifest(manifest), true); assert.equal(isSupportedIniPanelLaunchApiManifest(manifest), true);
assert.equal(isSupportedIniPanelLaunchApiManifest({ ...manifest, manifestVersion: 2 }), false); assert.equal(isSupportedIniPanelLaunchApiManifest({ ...manifest, manifestVersion: 2 }), false);
@@ -135,6 +142,8 @@ assert.match(shellText, /\bexport function isSupportedIniPanelLaunchApiManifest\
assert.match(launchText, /\bisSupportedLaunchApiManifest\b/); assert.match(launchText, /\bisSupportedLaunchApiManifest\b/);
assert.match(launchText, /\bgetLaunchApiSchema\b/); assert.match(launchText, /\bgetLaunchApiSchema\b/);
assert.match(launchText, /\bgetLaunchApiManifest\b/); assert.match(launchText, /\bgetLaunchApiManifest\b/);
assert.match(launchText, /\bgetShellIntegrationSchema\b/);
assert.match(launchText, /\bgetShellIntegrationManifest\b/);
assert.match(launchText, /\blinuxCncIniPanelLaunchApi\b/); assert.match(launchText, /\blinuxCncIniPanelLaunchApi\b/);
console.log("ini_panel_launch_api_manifest_node_smoke=ok"); console.log("ini_panel_launch_api_manifest_node_smoke=ok");

View File

@@ -0,0 +1,127 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import {
INI_PANEL_ENTRIES,
createControlPageBrowserApiManifest,
createControlPageBrowserApiSchema,
createIniPanelLaunchApiManifest,
createIniPanelLaunchApiSchema,
createIniPanelLauncherLinkViewModel,
createIniPanelShellIntegrationManifest,
createIniPanelShellIntegrationSchema,
getVisibleIniPanelEntries,
isSupportedIniPanelShellIntegrationManifest,
} from "../../../runtime/ui/ini-panel/ui-shell.js";
const __dirname = dirname(fileURLToPath(import.meta.url));
const root = resolve(__dirname, "../../..");
const shellText = readFileSync(resolve(root, "runtime/ui/ini-panel/ui-shell.js"), "utf8");
const launchText = readFileSync(resolve(root, "runtime/ui/ini-panel/launch.html"), "utf8");
const docText = readFileSync(resolve(root, "docs/panel-entry.md"), "utf8");
const schema = createIniPanelShellIntegrationSchema();
const manifest = createIniPanelShellIntegrationManifest();
assert.deepEqual(schema, {
apiName: "ini-panel-shell-integration",
manifestVersion: 1,
fields: [
"apiName",
"manifestVersion",
"pages",
"launcherLinks",
"launchApiSchema",
"launchApiManifest",
"controlPageApiSchema",
"controlPageApiManifest",
"compatibility",
"persistenceCapabilities",
],
});
assert.deepEqual(manifest, {
apiName: "ini-panel-shell-integration",
manifestVersion: 1,
pages: getVisibleIniPanelEntries(),
launcherLinks: createIniPanelLauncherLinkViewModel(),
launchApiSchema: createIniPanelLaunchApiSchema(),
launchApiManifest: createIniPanelLaunchApiManifest(),
controlPageApiSchema: createControlPageBrowserApiSchema(),
controlPageApiManifest: createControlPageBrowserApiManifest(),
compatibility: {
launchApiManifest: true,
controlPageApiManifest: true,
},
persistenceCapabilities: createIniPanelLaunchApiManifest().persistenceCapabilities,
});
assert.equal(isSupportedIniPanelShellIntegrationManifest(manifest), true);
assert.equal(isSupportedIniPanelShellIntegrationManifest({ ...manifest, manifestVersion: 2 }), false);
assert.equal(isSupportedIniPanelShellIntegrationManifest({ ...manifest, apiName: "other" }), false);
const missingControlPageManifest = { ...manifest };
delete missingControlPageManifest.controlPageApiManifest;
assert.equal(isSupportedIniPanelShellIntegrationManifest(missingControlPageManifest), false);
assert.equal(isSupportedIniPanelShellIntegrationManifest(null), false);
manifest.pages[0].title = "changed";
manifest.launcherLinks[0].label = "changed";
manifest.launchApiManifest.visibleEntries[0].title = "changed";
manifest.controlPageApiManifest.methods.push("changedMethod");
manifest.persistenceCapabilities[0].label = "changed";
assert.equal(INI_PANEL_ENTRIES[0].title, "Open edit and run panel");
assert.equal(createIniPanelShellIntegrationManifest().pages[0].title, "Open edit and run panel");
assert.equal(createIniPanelShellIntegrationManifest().launcherLinks[0].label, "Open edit and run panel");
assert.equal(
createIniPanelShellIntegrationManifest().launchApiManifest.visibleEntries[0].title,
"Open edit and run panel",
);
assert.equal(
createIniPanelShellIntegrationManifest().controlPageApiManifest.methods.includes("changedMethod"),
false,
);
assert.equal(
createIniPanelShellIntegrationManifest().persistenceCapabilities[0].label,
"Machine text files",
);
const customManifest = createIniPanelShellIntegrationManifest([
{
id: "custom",
href: "./custom.html",
title: "Custom entry",
},
]);
assert.deepEqual(customManifest.pages, [
{
id: "custom",
href: "./custom.html",
title: "Custom entry",
},
]);
assert.deepEqual(customManifest.launcherLinks, [
{
entryId: "custom",
href: "./custom.html",
label: "Custom entry",
},
]);
assert.deepEqual(customManifest.launchApiManifest.targetPages, [
{
entryId: "custom",
href: "./custom.html",
},
]);
assert.match(shellText, /\bexport function createIniPanelShellIntegrationSchema\b/);
assert.match(shellText, /\bexport function createIniPanelShellIntegrationManifest\b/);
assert.match(shellText, /\bexport function isSupportedIniPanelShellIntegrationManifest\b/);
assert.match(launchText, /\bgetShellIntegrationSchema\b/);
assert.match(launchText, /\bgetShellIntegrationManifest\b/);
assert.match(docText, /\bcreateIniPanelShellIntegrationManifest\b/);
assert.match(docText, /\bisSupportedIniPanelShellIntegrationManifest\b/);
assert.doesNotMatch(shellText, /\bparseGcode\b|\bcanonicalEvents\b|\btoolTable\b|\bplanner\b/);
console.log("ini_panel_shell_integration_manifest_node_smoke=ok");

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)"
node "$ROOT_DIR/tests/ui/node/verify_ini_panel_shell_integration_manifest.mjs"

View File

@@ -10,6 +10,8 @@ import {
createIniPanelLaunchApiSchema, createIniPanelLaunchApiSchema,
createIniPanelLauncherLinkViewModel, createIniPanelLauncherLinkViewModel,
createIniPanelShellControlPageContract, createIniPanelShellControlPageContract,
createIniPanelShellIntegrationManifest,
createIniPanelShellIntegrationSchema,
createIniPanelShellViewModel, createIniPanelShellViewModel,
createMachineSessionReadonlyStatus, createMachineSessionReadonlyStatus,
createMachineSessionReadonlyStatusApiManifest, createMachineSessionReadonlyStatusApiManifest,
@@ -21,6 +23,7 @@ import {
getVisibleIniPanelEntries, getVisibleIniPanelEntries,
isSupportedIniPanelControlPageApiManifest, isSupportedIniPanelControlPageApiManifest,
isSupportedIniPanelLaunchApiManifest, isSupportedIniPanelLaunchApiManifest,
isSupportedIniPanelShellIntegrationManifest,
loadMachineSessionForControlPageWorkflow, loadMachineSessionForControlPageWorkflow,
readMachineSessionReadonlyStatus, readMachineSessionReadonlyStatus,
refreshMachineSessionControlPage, refreshMachineSessionControlPage,
@@ -57,12 +60,15 @@ assert.equal(typeof createControlPageBrowserApiSchema, "function");
assert.equal(typeof createIniPanelLaunchApiManifest, "function"); assert.equal(typeof createIniPanelLaunchApiManifest, "function");
assert.equal(typeof createIniPanelLaunchApiSchema, "function"); assert.equal(typeof createIniPanelLaunchApiSchema, "function");
assert.equal(typeof createIniPanelShellControlPageContract, "function"); assert.equal(typeof createIniPanelShellControlPageContract, "function");
assert.equal(typeof createIniPanelShellIntegrationManifest, "function");
assert.equal(typeof createIniPanelShellIntegrationSchema, "function");
assert.equal(typeof loadMachineSessionForControlPageWorkflow, "function"); assert.equal(typeof loadMachineSessionForControlPageWorkflow, "function");
assert.equal(typeof readMachineSessionReadonlyStatus, "function"); assert.equal(typeof readMachineSessionReadonlyStatus, "function");
assert.equal(typeof refreshMachineSessionControlPage, "function"); assert.equal(typeof refreshMachineSessionControlPage, "function");
assert.equal(typeof renderMachineSessionControlView, "function"); assert.equal(typeof renderMachineSessionControlView, "function");
assert.equal(typeof isSupportedIniPanelControlPageApiManifest, "function"); assert.equal(typeof isSupportedIniPanelControlPageApiManifest, "function");
assert.equal(typeof isSupportedIniPanelLaunchApiManifest, "function"); assert.equal(typeof isSupportedIniPanelLaunchApiManifest, "function");
assert.equal(typeof isSupportedIniPanelShellIntegrationManifest, "function");
const shellManifest = getIniPanelEntryManifest(); const shellManifest = getIniPanelEntryManifest();
shellManifest[0].title = "changed"; shellManifest[0].title = "changed";
@@ -99,6 +105,22 @@ assert.deepEqual(shellViewModel.pages, [
}, },
]); ]);
assert.deepEqual(shellViewModel.launcherLinks, createIniPanelLauncherLinkViewModel()); assert.deepEqual(shellViewModel.launcherLinks, createIniPanelLauncherLinkViewModel());
assert.deepEqual(shellViewModel.shellIntegrationSchema, createIniPanelShellIntegrationSchema());
assert.deepEqual(shellViewModel.shellIntegrationManifest, createIniPanelShellIntegrationManifest());
assert.equal(
isSupportedIniPanelShellIntegrationManifest(shellViewModel.shellIntegrationManifest),
true,
);
assert.equal(
shellViewModel.shellIntegrationManifest.manifestVersion,
createIniPanelShellIntegrationSchema().manifestVersion,
);
assert.deepEqual(shellViewModel.shellIntegrationManifest.pages, shellViewModel.pages);
assert.deepEqual(shellViewModel.shellIntegrationManifest.launcherLinks, shellViewModel.launcherLinks);
assert.deepEqual(shellViewModel.shellIntegrationManifest.compatibility, {
launchApiManifest: true,
controlPageApiManifest: true,
});
assert.deepEqual(shellViewModel.launchApiSchema, createIniPanelLaunchApiSchema()); assert.deepEqual(shellViewModel.launchApiSchema, createIniPanelLaunchApiSchema());
assert.deepEqual(shellViewModel.launchApiManifest, createIniPanelLaunchApiManifest()); assert.deepEqual(shellViewModel.launchApiManifest, createIniPanelLaunchApiManifest());
assert.equal(isSupportedIniPanelLaunchApiManifest(shellViewModel.launchApiManifest), true); assert.equal(isSupportedIniPanelLaunchApiManifest(shellViewModel.launchApiManifest), true);
@@ -112,6 +134,7 @@ assert.equal(
createControlPageBrowserApiSchema().manifestVersion, createControlPageBrowserApiSchema().manifestVersion,
); );
assert.equal(shellViewModel.controlPage.createController, createMachineSessionControlPageController); assert.equal(shellViewModel.controlPage.createController, createMachineSessionControlPageController);
assert.equal(shellViewModel.isSupportedShellIntegrationManifest, isSupportedIniPanelShellIntegrationManifest);
assert.deepEqual(shellViewModel.controlPage.contract, createIniPanelShellControlPageContract()); assert.deepEqual(shellViewModel.controlPage.contract, createIniPanelShellControlPageContract());
assert.equal(shellViewModel.controlPage.isSupportedBrowserApiManifest, isSupportedIniPanelControlPageApiManifest); assert.equal(shellViewModel.controlPage.isSupportedBrowserApiManifest, isSupportedIniPanelControlPageApiManifest);
assert.equal(shellViewModel.controlPage.loadSessionState, loadMachineSessionForControlPageWorkflow); assert.equal(shellViewModel.controlPage.loadSessionState, loadMachineSessionForControlPageWorkflow);

View File

@@ -15,6 +15,7 @@ ROOT_DIR="$(cd "$(dirname "$0")/../../.." && pwd)"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_readonly_status_api.sh" "$ROOT_DIR/tests/ui/node/verify_ini_panel_readonly_status_api.sh"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_entry_manifest.sh" "$ROOT_DIR/tests/ui/node/verify_ini_panel_entry_manifest.sh"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_launch_api_manifest.sh" "$ROOT_DIR/tests/ui/node/verify_ini_panel_launch_api_manifest.sh"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_shell_integration_manifest.sh"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_ui_shell.sh" "$ROOT_DIR/tests/ui/node/verify_ini_panel_ui_shell.sh"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_shell_control_page_contract.sh" "$ROOT_DIR/tests/ui/node/verify_ini_panel_shell_control_page_contract.sh"
"$ROOT_DIR/tests/ui/node/verify_ini_panel_entry_docs.sh" "$ROOT_DIR/tests/ui/node/verify_ini_panel_entry_docs.sh"