diff --git a/text12.txt b/text12.txt index ac11125..72b8e0e 100644 --- a/text12.txt +++ b/text12.txt @@ -2326,3 +2326,84 @@ host_wasm_opfs_browser_smokes=ok `createIniPanelShellSessionHandoffPackageMountState()` 或等价 helper,把 launch-side package render-state、target control page、required readonly methods 与首帧 control-page session readiness 合并为外部 shell 可消费的 mount-state;仍保持只读,不新增控制按钮,不解析 G-code。 + +二十九、2026-06-15 继续执行记录:INI panel shell handoff package mount-state + +本轮按“第一原则:加快实质性推进”继续推进 browser/UI workflow 与 OPFS/session persistence +的交界,新增 shell handoff package mount-state,把 launch-side package render-state、control +page target、required readonly methods 与 control-page session readiness 合并为外部 shell 可消费 +状态。 + +完成内容: + +- `ui-shell.js` 新增 `createIniPanelShellSessionHandoffPackageMountState()`; +- `createIniPanelShellViewModel()` 新增 `shellSessionHandoffPackageMountState`; +- shell view-model 暴露 `createShellSessionHandoffPackageMountState` helper; +- `createIniPanelLaunchApiManifest().methods` 新增 + `getShellSessionHandoffPackageMountState`; +- `launch.html` 的 `window.linuxCncIniPanelLaunchApi.getShellSessionHandoffPackageMountState()` + 新增真实 browser 入口; +- launch API 的 mount-state 入口支持传入真实 `sessionLoadState`,从而让外部 shell 在 control + page iframe ready 后生成 ready mount-state; +- 默认 launch mount-state 表示 `waiting-panel`,不主动打开 control page,不执行 action plan; +- `ini_panel_launch_smoke.html` 校验默认 mount-state 的 package readiness、target、readonly + method 与 waiting session; +- `ini_panel_shell_integration_workflow_smoke.html` 在真实 control page iframe ready 后,把 + `loadControlPageSessionState()` 结果传入 launch API,并校验 ready mount-state; +- `verify_ini_panel_ui_shell.mjs` 覆盖 helper 导出、shell view-model 字段、默认 blocked mount + state 与 ready session mount-state; +- `verify_ini_panel_shell_integration_manifest.mjs` 覆盖 ready/blocked/error mount-state; +- `verify_ini_panel_launch_api_manifest.mjs` 覆盖 launch manifest 与 launch page API 暴露; +- `verify_ini_panel_entry_docs.mjs` 与 `docs/panel-entry.md` 同步记录和校验新 helper; +- 未新增控制按钮; +- 未解析 G-code; +- 未解释 canonical events; +- 未新增 JS CNC 语义; +- 未改变 OPFS/session persistence、LinuxCNC interpreter、tool、parameter、planner 或 + LinuxCNC-owned runtime semantics。 + +验证已通过: + +```bash +git diff --check +wasm-port/tests/ui/node/verify_ini_panel_ui_shell.sh +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_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_ui_shell_node_smoke=ok +ini_panel_shell_integration_manifest_node_smoke=ok +ini_panel_launch_api_manifest_node_smoke=ok +ini_panel_entry_docs_node_smoke=ok +browser_ini_opfs_smoke=ok +browser_ini_control_page_smoke=ok +browser_ini_launch_smoke=ok +browser_ini_shell_integration_workflow_smoke=ok +ui_node_smokes=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 与 SDK/API surface。下一批建议增加 mount-state display 或 +render-state helper,把 mount-state checks 压缩为外部 shell 可直接显示的 rows,并在 shell +integration browser workflow 中校验 waiting/ready mount-state 显示;仍保持只读,不新增控制按钮, +不解析 G-code。 diff --git a/wasm-port/docs/panel-entry.md b/wasm-port/docs/panel-entry.md index fc5fe66..c19ae81 100644 --- a/wasm-port/docs/panel-entry.md +++ b/wasm-port/docs/panel-entry.md @@ -27,6 +27,7 @@ import { createIniPanelShellSessionHandoffDisplayViewModel, createIniPanelShellSessionHandoffPackage, createIniPanelShellSessionHandoffPackageDisplayViewModel, + createIniPanelShellSessionHandoffPackageMountState, createIniPanelShellSessionHandoffPackageReport, createIniPanelShellSessionHandoffPackageRenderState, createIniPanelShellSessionHandoffPackageSchema, @@ -210,6 +211,11 @@ outer shell needs the package display view-model compressed into launch-side DOM state. The launch page renders `[data-handoff-status]` and `[data-handoff-rows]` from the package render-state so the first page shows package-level schema/report status. +Use `createIniPanelShellSessionHandoffPackageMountState()` or +`linuxCncIniPanelLaunchApi.getShellSessionHandoffPackageMountState()` when an +outer shell needs one read-only mount-state that combines package render-state, +the control-page target, required readonly methods, and the current +control-page session readiness snapshot. The browser workflow smoke `tests/browser/ini_panel_shell_integration_workflow_smoke.html` verifies the same external shell handoff: read integration manifest, pass readiness gate, diff --git a/wasm-port/runtime/ui/ini-panel/launch.html b/wasm-port/runtime/ui/ini-panel/launch.html index 3fc3908..9768e9f 100644 --- a/wasm-port/runtime/ui/ini-panel/launch.html +++ b/wasm-port/runtime/ui/ini-panel/launch.html @@ -152,6 +152,15 @@ getShellSessionHandoffPackageReport: () => shellViewModel.shellSessionHandoffPackageReport, getShellSessionHandoffPackageDisplayViewModel: () => shellViewModel.shellSessionHandoffPackageDisplayViewModel, getShellSessionHandoffPackageRenderState: () => shellViewModel.shellSessionHandoffPackageRenderState, + getShellSessionHandoffPackageMountState: (sessionLoadState) => ( + sessionLoadState + ? shellViewModel.createShellSessionHandoffPackageMountState({ + handoffPackage: shellViewModel.shellSessionHandoffPackage, + packageRenderState: shellViewModel.shellSessionHandoffPackageRenderState, + sessionLoadState, + }) + : shellViewModel.shellSessionHandoffPackageMountState + ), isSupportedShellSessionHandoffPackage: shellViewModel.isSupportedShellSessionHandoffPackage, getLauncherLinks: () => shellViewModel.launcherLinks, getControlPageApiMethods: () => shellViewModel.controlPage.browserApiMethods, diff --git a/wasm-port/runtime/ui/ini-panel/ui-shell.js b/wasm-port/runtime/ui/ini-panel/ui-shell.js index 1700cf2..e6b81a9 100644 --- a/wasm-port/runtime/ui/ini-panel/ui-shell.js +++ b/wasm-port/runtime/ui/ini-panel/ui-shell.js @@ -140,6 +140,7 @@ export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntr "getShellSessionHandoffPackageReport", "getShellSessionHandoffPackageDisplayViewModel", "getShellSessionHandoffPackageRenderState", + "getShellSessionHandoffPackageMountState", "isSupportedShellSessionHandoffPackage", "getLauncherLinks", "getControlPageApiMethods", @@ -938,6 +939,85 @@ export function createIniPanelShellSessionHandoffPackageRenderState( }; } +export function createIniPanelShellSessionHandoffPackageMountState({ + handoffPackage = createIniPanelShellSessionHandoffPackage(), + packageRenderState = createIniPanelShellSessionHandoffPackageRenderState(), + sessionLoadState = createControlPageSessionLoadState({ phase: "waiting-panel" }), +} = {}) { + const actionPlan = handoffPackage?.actionPlan && typeof handoffPackage.actionPlan === "object" + ? handoffPackage.actionPlan + : {}; + const requiredMethods = actionPlan.requiredMethods && typeof actionPlan.requiredMethods === "object" + ? actionPlan.requiredMethods + : {}; + const targetPage = actionPlan.targetPage ?? null; + const blockingReasons = [ + ...(Array.isArray(actionPlan.blockingReasons) ? actionPlan.blockingReasons : []), + ...(sessionLoadState?.phase === "error" ? ["controlPageSessionError"] : []), + ]; + const packageReady = handoffPackage?.ready === true && packageRenderState?.ready === true; + const targetReady = Boolean(targetPage?.href); + const methodsReady = Boolean(requiredMethods.loadSessionState && requiredMethods.readStatus); + const sessionReady = sessionLoadState?.phase === "ready"; + const ready = packageReady && targetReady && methodsReady && sessionReady && blockingReasons.length === 0; + + return { + apiName: "ini-panel-shell-session-handoff-package-mount-state", + mountStateVersion: 1, + phase: ready ? "ready" : "blocked", + ready, + packageReady, + targetReady, + methodsReady, + sessionReady, + statusLine: ready + ? "Ready: Control page session mounted" + : `Blocked: ${blockingReasons.length === 0 ? sessionLoadState?.phase ?? "waiting-panel" : blockingReasons.join(", ")}`, + packageRenderState, + targetPage, + requiredMethods: { + loadSessionState: requiredMethods.loadSessionState ?? null, + readStatus: requiredMethods.readStatus ?? null, + }, + sessionLoadState, + blockingReasons, + checks: [ + { + id: "package-render-state", + label: "Package render state", + status: packageReady ? "pass" : "blocked", + value: packageRenderState?.statusLine ?? "missing", + }, + { + id: "target-page", + label: "Control target", + status: targetReady ? "pass" : "blocked", + value: targetPage?.href ?? "missing", + }, + { + id: "required-methods", + label: "Readonly methods", + status: methodsReady ? "pass" : "blocked", + value: methodsReady + ? `${requiredMethods.loadSessionState}, ${requiredMethods.readStatus}` + : "missing", + }, + { + id: "session-load-state", + label: "Session load state", + status: sessionReady ? "pass" : "blocked", + value: sessionLoadState?.phase ?? "missing", + }, + { + id: "blocking-reasons", + label: "Blocking reasons", + status: blockingReasons.length === 0 ? "pass" : "blocked", + value: blockingReasons.length === 0 ? "none" : blockingReasons.join(", "), + }, + ], + }; +} + export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries()) { const shellIntegrationManifest = createIniPanelShellIntegrationManifest(entries); const shellIntegrationReadiness = createIniPanelShellIntegrationReadiness(shellIntegrationManifest); @@ -991,6 +1071,10 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries const shellSessionHandoffPackageRenderState = createIniPanelShellSessionHandoffPackageRenderState( shellSessionHandoffPackageDisplayViewModel, ); + const shellSessionHandoffPackageMountState = createIniPanelShellSessionHandoffPackageMountState({ + handoffPackage: shellSessionHandoffPackage, + packageRenderState: shellSessionHandoffPackageRenderState, + }); return { pages: entries.map(({ id, href, title }) => ({ id, @@ -1015,6 +1099,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries shellSessionHandoffPackageReport, shellSessionHandoffPackageDisplayViewModel, shellSessionHandoffPackageRenderState, + shellSessionHandoffPackageMountState, launchApiSchema: createIniPanelLaunchApiSchema(), launchApiManifest: createIniPanelLaunchApiManifest(entries), isSupportedShellIntegrationManifest: isSupportedIniPanelShellIntegrationManifest, @@ -1034,6 +1119,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries createShellSessionHandoffPackageReport: createIniPanelShellSessionHandoffPackageReport, createShellSessionHandoffPackageDisplayViewModel: createIniPanelShellSessionHandoffPackageDisplayViewModel, createShellSessionHandoffPackageRenderState: createIniPanelShellSessionHandoffPackageRenderState, + createShellSessionHandoffPackageMountState: createIniPanelShellSessionHandoffPackageMountState, isSupportedShellSessionHandoffPackage: isSupportedIniPanelShellSessionHandoffPackage, controlPage: { browserApiSchema: createControlPageBrowserApiSchema(), diff --git a/wasm-port/tests/browser/ini_panel_launch_smoke.html b/wasm-port/tests/browser/ini_panel_launch_smoke.html index 7e0588e..04b9011 100644 --- a/wasm-port/tests/browser/ini_panel_launch_smoke.html +++ b/wasm-port/tests/browser/ini_panel_launch_smoke.html @@ -87,6 +87,7 @@ !launchApi?.getShellSessionHandoffPackageReport || !launchApi?.getShellSessionHandoffPackageDisplayViewModel || !launchApi?.getShellSessionHandoffPackageRenderState || + !launchApi?.getShellSessionHandoffPackageMountState || !launchApi?.isSupportedShellSessionHandoffPackage || !launchApi?.getLauncherLinks || !launchApi?.getControlPageApiMethods @@ -127,7 +128,7 @@ ); assertEqual( launchApiManifest.methods.join(","), - "isSupportedLaunchApiManifest,getLaunchApiSchema,getLaunchApiManifest,getShellIntegrationSchema,getShellIntegrationManifest,getShellIntegrationReadiness,getShellSessionHandoffSummarySchema,getShellSessionHandoffSummary,isSupportedShellSessionHandoffSummary,getShellSessionHandoffCompatibilityReport,getShellSessionHandoffDisplayViewModel,getShellSessionHandoffSnapshot,getShellSessionHandoffRenderState,getShellSessionHandoffActionPlan,getShellSessionHandoffChecklist,getShellSessionHandoffPackageSchema,getShellSessionHandoffPackage,getShellSessionHandoffPackageReport,getShellSessionHandoffPackageDisplayViewModel,getShellSessionHandoffPackageRenderState,isSupportedShellSessionHandoffPackage,getLauncherLinks,getControlPageApiMethods", + "isSupportedLaunchApiManifest,getLaunchApiSchema,getLaunchApiManifest,getShellIntegrationSchema,getShellIntegrationManifest,getShellIntegrationReadiness,getShellSessionHandoffSummarySchema,getShellSessionHandoffSummary,isSupportedShellSessionHandoffSummary,getShellSessionHandoffCompatibilityReport,getShellSessionHandoffDisplayViewModel,getShellSessionHandoffSnapshot,getShellSessionHandoffRenderState,getShellSessionHandoffActionPlan,getShellSessionHandoffChecklist,getShellSessionHandoffPackageSchema,getShellSessionHandoffPackage,getShellSessionHandoffPackageReport,getShellSessionHandoffPackageDisplayViewModel,getShellSessionHandoffPackageRenderState,getShellSessionHandoffPackageMountState,isSupportedShellSessionHandoffPackage,getLauncherLinks,getControlPageApiMethods", "launch API manifest methods", ); const shellIntegrationSchema = launchApi.getShellIntegrationSchema(); @@ -146,6 +147,7 @@ const shellSessionHandoffPackageReport = launchApi.getShellSessionHandoffPackageReport(); const shellSessionHandoffPackageDisplayViewModel = launchApi.getShellSessionHandoffPackageDisplayViewModel(); const shellSessionHandoffPackageRenderState = launchApi.getShellSessionHandoffPackageRenderState(); + const shellSessionHandoffPackageMountState = launchApi.getShellSessionHandoffPackageMountState(); assertEqual( shellIntegrationSchema.manifestVersion, 1, @@ -356,6 +358,31 @@ shellSessionHandoffPackageDisplayViewModel.rows.length, "shell session handoff package render-state rows", ); + assertEqual( + shellSessionHandoffPackageMountState.mountStateVersion, + 1, + "shell session handoff package mount-state version", + ); + assertEqual( + shellSessionHandoffPackageMountState.packageReady, + true, + "shell session handoff package mount-state package readiness", + ); + assertEqual( + shellSessionHandoffPackageMountState.targetPage.href, + "./control-page.html", + "shell session handoff package mount-state target", + ); + assertEqual( + shellSessionHandoffPackageMountState.requiredMethods.readStatus, + "readControlPageStatus", + "shell session handoff package mount-state read method", + ); + assertEqual( + shellSessionHandoffPackageMountState.sessionLoadState.phase, + "waiting-panel", + "shell session handoff package mount-state default session", + ); assertEqual( shellSessionHandoffPackage.ready, true, diff --git a/wasm-port/tests/browser/ini_panel_shell_integration_workflow_smoke.html b/wasm-port/tests/browser/ini_panel_shell_integration_workflow_smoke.html index a4e8531..7cb7667 100644 --- a/wasm-port/tests/browser/ini_panel_shell_integration_workflow_smoke.html +++ b/wasm-port/tests/browser/ini_panel_shell_integration_workflow_smoke.html @@ -78,6 +78,7 @@ TOOL_TABLE = browser-shell-tool.tbl !launchApi?.getShellSessionHandoffPackageReport || !launchApi?.getShellSessionHandoffPackageDisplayViewModel || !launchApi?.getShellSessionHandoffPackageRenderState || + !launchApi?.getShellSessionHandoffPackageMountState || !launchApi?.isSupportedShellSessionHandoffPackage ) { throw new Error("launch API namespace did not expose shell integration helpers"); @@ -98,6 +99,7 @@ TOOL_TABLE = browser-shell-tool.tbl const handoffPackageReport = launchApi.getShellSessionHandoffPackageReport(); const handoffPackageDisplay = launchApi.getShellSessionHandoffPackageDisplayViewModel(); const handoffPackageRenderState = launchApi.getShellSessionHandoffPackageRenderState(); + const handoffPackageMountState = launchApi.getShellSessionHandoffPackageMountState(); assertEqual(handoffSummarySchema.summaryVersion, 1, "shell handoff summary schema version"); assertEqual( launchApi.isSupportedShellSessionHandoffSummary(handoffSummary), @@ -157,6 +159,9 @@ TOOL_TABLE = browser-shell-tool.tbl handoffPackageDisplay.rows.length, "shell handoff package render-state rows", ); + assertEqual(handoffPackageMountState.packageReady, true, "shell handoff package mount-state package readiness"); + assertEqual(handoffPackageMountState.targetPage.href, "./control-page.html", "shell handoff package mount-state target"); + assertEqual(handoffPackageMountState.sessionLoadState.phase, "waiting-panel", "shell handoff package mount-state default session"); assertEqual(handoffPackage.checklist.ready, handoffChecklist.ready, "shell handoff package checklist"); assertEqual( handoffPackage.actionPlan.nextSteps.map(({ id }) => id).join(","), @@ -229,6 +234,11 @@ TOOL_TABLE = browser-shell-tool.tbl "ready", "shell integration control-page session readiness", ); + const readyMountState = launchApi.getShellSessionHandoffPackageMountState( + controlPageApi[handoffSummary.handoffMethods.loadSessionState](), + ); + assertEqual(readyMountState.ready, true, "shell handoff package mount-state readiness"); + assertEqual(readyMountState.sessionLoadState.phase, "ready", "shell handoff package mount-state ready session"); assertEqual( controlPageApi[handoffSummary.handoffMethods.readStatus]().status.lastAction, null, diff --git a/wasm-port/tests/ui/node/verify_ini_panel_entry_docs.mjs b/wasm-port/tests/ui/node/verify_ini_panel_entry_docs.mjs index 6198110..2d19c61 100644 --- a/wasm-port/tests/ui/node/verify_ini_panel_entry_docs.mjs +++ b/wasm-port/tests/ui/node/verify_ini_panel_entry_docs.mjs @@ -24,6 +24,7 @@ import { createIniPanelShellSessionHandoffDisplayViewModel, createIniPanelShellSessionHandoffPackage, createIniPanelShellSessionHandoffPackageDisplayViewModel, + createIniPanelShellSessionHandoffPackageMountState, createIniPanelShellSessionHandoffPackageReport, createIniPanelShellSessionHandoffPackageRenderState, createIniPanelShellSessionHandoffPackageSchema, @@ -86,6 +87,7 @@ const requiredShellExports = [ "createIniPanelShellSessionHandoffDisplayViewModel", "createIniPanelShellSessionHandoffPackage", "createIniPanelShellSessionHandoffPackageDisplayViewModel", + "createIniPanelShellSessionHandoffPackageMountState", "createIniPanelShellSessionHandoffPackageReport", "createIniPanelShellSessionHandoffPackageRenderState", "createIniPanelShellSessionHandoffPackageSchema", @@ -252,6 +254,13 @@ assert.deepEqual( createIniPanelShellViewModel().shellSessionHandoffPackageDisplayViewModel, ), ); +assert.deepEqual( + createIniPanelShellViewModel().shellSessionHandoffPackageMountState, + createIniPanelShellSessionHandoffPackageMountState({ + handoffPackage: createIniPanelShellViewModel().shellSessionHandoffPackage, + packageRenderState: createIniPanelShellViewModel().shellSessionHandoffPackageRenderState, + }), +); assert.equal(isSupportedIniPanelShellSessionHandoffPackage(createIniPanelShellViewModel().shellSessionHandoffPackage), true); assert.equal(isSupportedIniPanelShellIntegrationManifest(createIniPanelShellViewModel().shellIntegrationManifest), true); assert.deepEqual(createIniPanelShellViewModel().launchApiSchema, createIniPanelLaunchApiSchema()); diff --git a/wasm-port/tests/ui/node/verify_ini_panel_launch_api_manifest.mjs b/wasm-port/tests/ui/node/verify_ini_panel_launch_api_manifest.mjs index 3893979..ea025bc 100644 --- a/wasm-port/tests/ui/node/verify_ini_panel_launch_api_manifest.mjs +++ b/wasm-port/tests/ui/node/verify_ini_panel_launch_api_manifest.mjs @@ -60,6 +60,7 @@ assert.deepEqual(manifest, { "getShellSessionHandoffPackageReport", "getShellSessionHandoffPackageDisplayViewModel", "getShellSessionHandoffPackageRenderState", + "getShellSessionHandoffPackageMountState", "isSupportedShellSessionHandoffPackage", "getLauncherLinks", "getControlPageApiMethods", @@ -175,6 +176,7 @@ assert.match(launchText, /\bgetShellSessionHandoffPackage\b/); assert.match(launchText, /\bgetShellSessionHandoffPackageReport\b/); assert.match(launchText, /\bgetShellSessionHandoffPackageDisplayViewModel\b/); assert.match(launchText, /\bgetShellSessionHandoffPackageRenderState\b/); +assert.match(launchText, /\bgetShellSessionHandoffPackageMountState\b/); assert.match(launchText, /\bisSupportedShellSessionHandoffPackage\b/); assert.match(launchText, /\blinuxCncIniPanelLaunchApi\b/); diff --git a/wasm-port/tests/ui/node/verify_ini_panel_shell_integration_manifest.mjs b/wasm-port/tests/ui/node/verify_ini_panel_shell_integration_manifest.mjs index 0e490e7..b14fef2 100644 --- a/wasm-port/tests/ui/node/verify_ini_panel_shell_integration_manifest.mjs +++ b/wasm-port/tests/ui/node/verify_ini_panel_shell_integration_manifest.mjs @@ -20,6 +20,7 @@ import { createIniPanelShellSessionHandoffDisplayViewModel, createIniPanelShellSessionHandoffPackage, createIniPanelShellSessionHandoffPackageDisplayViewModel, + createIniPanelShellSessionHandoffPackageMountState, createIniPanelShellSessionHandoffPackageReport, createIniPanelShellSessionHandoffPackageRenderState, createIniPanelShellSessionHandoffPackageSchema, @@ -27,6 +28,7 @@ import { createIniPanelShellSessionHandoffSnapshot, createIniPanelShellSessionHandoffSummary, createIniPanelShellSessionHandoffSummarySchema, + createControlPageSessionLoadState, getVisibleIniPanelEntries, isSupportedIniPanelShellIntegrationManifest, isSupportedIniPanelShellSessionHandoffPackage, @@ -79,6 +81,10 @@ const handoffPackageDisplayViewModel = createIniPanelShellSessionHandoffPackageD const handoffPackageRenderState = createIniPanelShellSessionHandoffPackageRenderState( handoffPackageDisplayViewModel, ); +const handoffPackageMountState = createIniPanelShellSessionHandoffPackageMountState({ + handoffPackage, + packageRenderState: handoffPackageRenderState, +}); assert.deepEqual(schema, { apiName: "ini-panel-shell-integration", @@ -134,7 +140,7 @@ assert.deepEqual(readiness, { counts: { pages: 2, launcherLinks: 2, - launchMethods: 23, + launchMethods: 24, controlPageMethods: 11, persistenceCapabilities: 3, }, @@ -196,7 +202,7 @@ assert.deepEqual(handoffSummary, { counts: { pages: 2, launcherLinks: 2, - launchMethods: 23, + launchMethods: 24, controlPageMethods: 11, persistenceCapabilities: 3, }, @@ -575,6 +581,100 @@ assert.deepEqual(handoffPackageRenderState, { handoffScope: "package", }, }); +assert.deepEqual(handoffPackageMountState, { + apiName: "ini-panel-shell-session-handoff-package-mount-state", + mountStateVersion: 1, + phase: "blocked", + ready: false, + packageReady: true, + targetReady: true, + methodsReady: true, + sessionReady: false, + statusLine: "Blocked: waiting-panel", + packageRenderState: handoffPackageRenderState, + targetPage: { + entryId: "control-view", + href: "./control-page.html", + }, + requiredMethods: { + loadSessionState: "loadControlPageSessionState", + readStatus: "readControlPageStatus", + }, + sessionLoadState: createControlPageSessionLoadState({ phase: "waiting-panel" }), + blockingReasons: [], + checks: [ + { + id: "package-render-state", + label: "Package render state", + status: "pass", + value: "Ready: No blocking reasons", + }, + { + id: "target-page", + label: "Control target", + status: "pass", + value: "./control-page.html", + }, + { + id: "required-methods", + label: "Readonly methods", + status: "pass", + value: "loadControlPageSessionState, readControlPageStatus", + }, + { + id: "session-load-state", + label: "Session load state", + status: "blocked", + value: "waiting-panel", + }, + { + id: "blocking-reasons", + label: "Blocking reasons", + status: "pass", + value: "none", + }, + ], +}); +assert.deepEqual( + createIniPanelShellSessionHandoffPackageMountState({ + handoffPackage, + packageRenderState: handoffPackageRenderState, + sessionLoadState: createControlPageSessionLoadState({ + phase: "ready", + panelReady: true, + apiReady: true, + controlViewReady: true, + controlView: { status: { runStatus: "not-run" } }, + }), + }).checks.map(({ id, status, value }) => ({ id, status, value })), + [ + { + id: "package-render-state", + status: "pass", + value: "Ready: No blocking reasons", + }, + { + id: "target-page", + status: "pass", + value: "./control-page.html", + }, + { + id: "required-methods", + status: "pass", + value: "loadControlPageSessionState, readControlPageStatus", + }, + { + id: "session-load-state", + status: "pass", + value: "ready", + }, + { + id: "blocking-reasons", + status: "pass", + value: "none", + }, + ], +); assert.equal(isSupportedIniPanelShellSessionHandoffPackage(handoffPackage), true); assert.equal( isSupportedIniPanelShellSessionHandoffPackage({ ...handoffPackage, packageVersion: 2 }), @@ -673,6 +773,16 @@ assert.deepEqual( }, }, ); +assert.deepEqual( + createIniPanelShellSessionHandoffPackageMountState({ + handoffPackage: { ...handoffPackage, ready: false }, + packageRenderState: createIniPanelShellSessionHandoffPackageRenderState(createIniPanelShellSessionHandoffPackageDisplayViewModel( + createIniPanelShellSessionHandoffPackageReport({ ...handoffPackage, packageVersion: 2 }), + )), + sessionLoadState: createControlPageSessionLoadState({ phase: "error", error: "boom" }), + }).blockingReasons, + ["controlPageSessionError"], +); assert.deepEqual( createIniPanelShellSessionHandoffPackageReport(missingManifestField).missingManifestFields, ["controlPageMethods"], @@ -904,7 +1014,7 @@ assert.deepEqual(createIniPanelShellIntegrationReadiness(blockedManifest), { counts: { pages: 2, launcherLinks: 2, - launchMethods: 23, + launchMethods: 24, controlPageMethods: 11, persistenceCapabilities: 3, }, @@ -1070,6 +1180,7 @@ assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffComp assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffDisplayViewModel\b/); assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackage\b/); assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageDisplayViewModel\b/); +assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageMountState\b/); assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageReport\b/); assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageRenderState\b/); assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageSchema\b/); @@ -1092,6 +1203,7 @@ assert.match(docText, /\bcreateIniPanelShellSessionHandoffCompatibilityReport\b/ assert.match(docText, /\bcreateIniPanelShellSessionHandoffDisplayViewModel\b/); assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackage\b/); assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageDisplayViewModel\b/); +assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageMountState\b/); assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageReport\b/); assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageRenderState\b/); assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageSchema\b/); diff --git a/wasm-port/tests/ui/node/verify_ini_panel_ui_shell.mjs b/wasm-port/tests/ui/node/verify_ini_panel_ui_shell.mjs index 91e2935..d5387bb 100644 --- a/wasm-port/tests/ui/node/verify_ini_panel_ui_shell.mjs +++ b/wasm-port/tests/ui/node/verify_ini_panel_ui_shell.mjs @@ -20,6 +20,7 @@ import { createIniPanelShellSessionHandoffDisplayViewModel, createIniPanelShellSessionHandoffPackage, createIniPanelShellSessionHandoffPackageDisplayViewModel, + createIniPanelShellSessionHandoffPackageMountState, createIniPanelShellSessionHandoffPackageReport, createIniPanelShellSessionHandoffPackageRenderState, createIniPanelShellSessionHandoffPackageSchema, @@ -87,6 +88,7 @@ assert.equal(typeof createIniPanelShellSessionHandoffCompatibilityReport, "funct assert.equal(typeof createIniPanelShellSessionHandoffDisplayViewModel, "function"); assert.equal(typeof createIniPanelShellSessionHandoffPackage, "function"); assert.equal(typeof createIniPanelShellSessionHandoffPackageDisplayViewModel, "function"); +assert.equal(typeof createIniPanelShellSessionHandoffPackageMountState, "function"); assert.equal(typeof createIniPanelShellSessionHandoffPackageReport, "function"); assert.equal(typeof createIniPanelShellSessionHandoffPackageRenderState, "function"); assert.equal(typeof createIniPanelShellSessionHandoffPackageSchema, "function"); @@ -222,6 +224,13 @@ assert.deepEqual( shellViewModel.shellSessionHandoffPackageRenderState, createIniPanelShellSessionHandoffPackageRenderState(shellViewModel.shellSessionHandoffPackageDisplayViewModel), ); +assert.deepEqual( + shellViewModel.shellSessionHandoffPackageMountState, + createIniPanelShellSessionHandoffPackageMountState({ + handoffPackage: shellViewModel.shellSessionHandoffPackage, + packageRenderState: shellViewModel.shellSessionHandoffPackageRenderState, + }), +); assert.equal(isSupportedIniPanelShellSessionHandoffPackage(shellViewModel.shellSessionHandoffPackage), true); assert.deepEqual(shellViewModel.shellSessionHandoffDisplayViewModel, { phase: "ready", @@ -464,6 +473,74 @@ assert.deepEqual(shellViewModel.shellSessionHandoffPackageRenderState, { handoffScope: "package", }, }); +assert.deepEqual(shellViewModel.shellSessionHandoffPackageMountState, { + apiName: "ini-panel-shell-session-handoff-package-mount-state", + mountStateVersion: 1, + phase: "blocked", + ready: false, + packageReady: true, + targetReady: true, + methodsReady: true, + sessionReady: false, + statusLine: "Blocked: waiting-panel", + packageRenderState: shellViewModel.shellSessionHandoffPackageRenderState, + targetPage: { + entryId: "control-view", + href: "./control-page.html", + }, + requiredMethods: { + loadSessionState: "loadControlPageSessionState", + readStatus: "readControlPageStatus", + }, + sessionLoadState: createControlPageSessionLoadState({ phase: "waiting-panel" }), + blockingReasons: [], + checks: [ + { + id: "package-render-state", + label: "Package render state", + status: "pass", + value: "Ready: No blocking reasons", + }, + { + id: "target-page", + label: "Control target", + status: "pass", + value: "./control-page.html", + }, + { + id: "required-methods", + label: "Readonly methods", + status: "pass", + value: "loadControlPageSessionState, readControlPageStatus", + }, + { + id: "session-load-state", + label: "Session load state", + status: "blocked", + value: "waiting-panel", + }, + { + id: "blocking-reasons", + label: "Blocking reasons", + status: "pass", + value: "none", + }, + ], +}); +assert.equal( + createIniPanelShellSessionHandoffPackageMountState({ + handoffPackage: shellViewModel.shellSessionHandoffPackage, + packageRenderState: shellViewModel.shellSessionHandoffPackageRenderState, + sessionLoadState: createControlPageSessionLoadState({ + phase: "ready", + panelReady: true, + apiReady: true, + controlViewReady: true, + controlView: { status: { runStatus: "not-run" } }, + }), + }).ready, + true, +); assert.equal( isSupportedIniPanelShellIntegrationManifest(shellViewModel.shellIntegrationManifest), true, @@ -520,6 +597,10 @@ assert.equal( shellViewModel.createShellSessionHandoffPackageRenderState, createIniPanelShellSessionHandoffPackageRenderState, ); +assert.equal( + shellViewModel.createShellSessionHandoffPackageMountState, + createIniPanelShellSessionHandoffPackageMountState, +); assert.equal(shellViewModel.createShellSessionHandoffPackageReport, createIniPanelShellSessionHandoffPackageReport); assert.equal(shellViewModel.createShellSessionHandoffPackageSchema, createIniPanelShellSessionHandoffPackageSchema); assert.equal(shellViewModel.isSupportedShellSessionHandoffPackage, isSupportedIniPanelShellSessionHandoffPackage);