推进 INI 面板 shell handoff readonly status workflow helper

This commit is contained in:
2026-06-15 13:48:36 +08:00
parent c3d9b90de1
commit 859d01356b
9 changed files with 228 additions and 4 deletions

View File

@@ -90,6 +90,7 @@ TOOL_TABLE = browser-shell-tool.tbl
!launchApi?.renderShellSessionHandoffMountState ||
!launchApi?.mountShellSessionHandoff ||
!launchApi?.mountShellSessionHandoffFromControlPage ||
!launchApi?.readShellSessionHandoffStatusFromControlPage ||
!launchApi?.isSupportedShellSessionHandoffPackage
) {
throw new Error("launch API namespace did not expose shell integration helpers");
@@ -353,11 +354,26 @@ TOOL_TABLE = browser-shell-tool.tbl
);
const readonlyStatus = controlPageApi[handoffSummary.handoffMethods.readStatus]();
const readonlyStatusResult = launchApi.readShellSessionHandoffStatusFromControlPage({
controlPageApi,
});
assertEqual(readonlyStatusResult.phase, "ready", "shell handoff readonly status result phase");
assertEqual(readonlyStatusResult.ready, true, "shell handoff readonly status result readiness");
assertEqual(
readonlyStatusResult.missingStatusFields.join(","),
"",
"shell handoff readonly status missing fields",
);
assertEqual(
readonlyStatus.workflowStatus.lastAction,
"load-session",
"shell integration readonly workflow last action",
);
assertEqual(
readonlyStatusResult.readonlyStatus.workflowStatus.lastAction,
readonlyStatus.workflowStatus.lastAction,
"shell handoff readonly status result workflow last action",
);
assertEqual(
readonlyStatus.session.parameterFile,
"browser-shell-linuxcnc.var",

View File

@@ -31,6 +31,7 @@ import {
createIniPanelShellSessionHandoffMountDomReadiness,
mountIniPanelShellSessionHandoff,
mountIniPanelShellSessionHandoffFromControlPage,
readIniPanelShellSessionHandoffStatusFromControlPage,
renderIniPanelShellSessionHandoffMountState,
createIniPanelShellSessionHandoffPackageReport,
createIniPanelShellSessionHandoffPackageRenderState,
@@ -101,6 +102,7 @@ const requiredShellExports = [
"createIniPanelShellSessionHandoffMountDomReadiness",
"mountIniPanelShellSessionHandoff",
"mountIniPanelShellSessionHandoffFromControlPage",
"readIniPanelShellSessionHandoffStatusFromControlPage",
"renderIniPanelShellSessionHandoffMountState",
"createIniPanelShellSessionHandoffPackageReport",
"createIniPanelShellSessionHandoffPackageRenderState",
@@ -303,6 +305,10 @@ assert.equal(
mountIniPanelShellSessionHandoffFromControlPage({ documentRef: null }).mountWorkflow.phase,
"blocked",
);
assert.equal(
readIniPanelShellSessionHandoffStatusFromControlPage().phase,
"blocked",
);
assert.equal(isSupportedIniPanelShellSessionHandoffPackage(createIniPanelShellViewModel().shellSessionHandoffPackage), true);
assert.equal(isSupportedIniPanelShellIntegrationManifest(createIniPanelShellViewModel().shellIntegrationManifest), true);
assert.deepEqual(createIniPanelShellViewModel().launchApiSchema, createIniPanelLaunchApiSchema());
@@ -464,6 +470,7 @@ assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellSessionHandoffMountD
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellSessionHandoffMountDomReadiness\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.mountShellSessionHandoff\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.mountShellSessionHandoffFromControlPage\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.readShellSessionHandoffStatusFromControlPage\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getControlPageApiMethods\b/);
assert.match(docText, /\bini_panel_shell_integration_workflow_smoke\.html\b/);
assert.match(browserIniPanelText, /\bini_panel_shell_integration_workflow_smoke\.html\b/);
@@ -484,6 +491,7 @@ assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffMountDo
assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffMountDomReadiness\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bmountShellSessionHandoff\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bmountShellSessionHandoffFromControlPage\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\breadShellSessionHandoffStatusFromControlPage\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\brenderShellSessionHandoffMountState\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bdata-external-shell-mount\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bdata-external-mount-value\b/);

View File

@@ -68,6 +68,7 @@ assert.deepEqual(manifest, {
"renderShellSessionHandoffMountState",
"mountShellSessionHandoff",
"mountShellSessionHandoffFromControlPage",
"readShellSessionHandoffStatusFromControlPage",
"isSupportedShellSessionHandoffPackage",
"getLauncherLinks",
"getControlPageApiMethods",
@@ -191,6 +192,7 @@ assert.match(launchText, /\bgetShellSessionHandoffMountDomReadiness\b/);
assert.match(launchText, /\brenderShellSessionHandoffMountState\b/);
assert.match(launchText, /\bmountShellSessionHandoff\b/);
assert.match(launchText, /\bmountShellSessionHandoffFromControlPage\b/);
assert.match(launchText, /\breadShellSessionHandoffStatusFromControlPage\b/);
assert.match(launchText, /\bisSupportedShellSessionHandoffPackage\b/);
assert.match(launchText, /\bdata-handoff-mount\b/);
assert.match(launchText, /\bdata-handoff-mount-status\b/);

View File

@@ -27,6 +27,7 @@ import {
createIniPanelShellSessionHandoffMountDomReadiness,
mountIniPanelShellSessionHandoff,
mountIniPanelShellSessionHandoffFromControlPage,
readIniPanelShellSessionHandoffStatusFromControlPage,
createIniPanelShellSessionHandoffPackageReport,
createIniPanelShellSessionHandoffPackageRenderState,
createIniPanelShellSessionHandoffPackageSchema,
@@ -153,7 +154,7 @@ assert.deepEqual(readiness, {
counts: {
pages: 2,
launcherLinks: 2,
launchMethods: 31,
launchMethods: 32,
controlPageMethods: 11,
persistenceCapabilities: 3,
},
@@ -215,7 +216,7 @@ assert.deepEqual(handoffSummary, {
counts: {
pages: 2,
launcherLinks: 2,
launchMethods: 31,
launchMethods: 32,
controlPageMethods: 11,
persistenceCapabilities: 3,
},
@@ -711,6 +712,10 @@ assert.equal(
mountIniPanelShellSessionHandoffFromControlPage({ documentRef: null }).sessionLoadState.phase,
"waiting-api",
);
assert.equal(
readIniPanelShellSessionHandoffStatusFromControlPage().readError,
"Missing readControlPageStatus",
);
assert.deepEqual(
createIniPanelShellSessionHandoffPackageMountState({
handoffPackage,
@@ -1122,7 +1127,7 @@ assert.deepEqual(createIniPanelShellIntegrationReadiness(blockedManifest), {
counts: {
pages: 2,
launcherLinks: 2,
launchMethods: 31,
launchMethods: 32,
controlPageMethods: 11,
persistenceCapabilities: 3,
},
@@ -1295,6 +1300,7 @@ assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffMoun
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffMountDomReadiness\b/);
assert.match(shellText, /\bexport function mountIniPanelShellSessionHandoff\b/);
assert.match(shellText, /\bexport function mountIniPanelShellSessionHandoffFromControlPage\b/);
assert.match(shellText, /\bexport function readIniPanelShellSessionHandoffStatusFromControlPage\b/);
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageReport\b/);
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageRenderState\b/);
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageSchema\b/);
@@ -1324,6 +1330,7 @@ assert.match(docText, /\bcreateIniPanelShellSessionHandoffMountDomContract\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffMountDomReadiness\b/);
assert.match(docText, /\bmountIniPanelShellSessionHandoff\b/);
assert.match(docText, /\bmountIniPanelShellSessionHandoffFromControlPage\b/);
assert.match(docText, /\breadIniPanelShellSessionHandoffStatusFromControlPage\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageReport\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageRenderState\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageSchema\b/);

View File

@@ -27,6 +27,7 @@ import {
createIniPanelShellSessionHandoffMountDomReadiness,
mountIniPanelShellSessionHandoff,
mountIniPanelShellSessionHandoffFromControlPage,
readIniPanelShellSessionHandoffStatusFromControlPage,
renderIniPanelShellSessionHandoffMountState,
createIniPanelShellSessionHandoffPackageReport,
createIniPanelShellSessionHandoffPackageRenderState,
@@ -102,6 +103,7 @@ assert.equal(typeof createIniPanelShellSessionHandoffMountDomContract, "function
assert.equal(typeof createIniPanelShellSessionHandoffMountDomReadiness, "function");
assert.equal(typeof mountIniPanelShellSessionHandoff, "function");
assert.equal(typeof mountIniPanelShellSessionHandoffFromControlPage, "function");
assert.equal(typeof readIniPanelShellSessionHandoffStatusFromControlPage, "function");
assert.equal(typeof renderIniPanelShellSessionHandoffMountState, "function");
assert.equal(typeof createIniPanelShellSessionHandoffPackageReport, "function");
assert.equal(typeof createIniPanelShellSessionHandoffPackageRenderState, "function");
@@ -708,6 +710,10 @@ assert.equal(
shellViewModel.mountShellSessionHandoffFromControlPage,
mountIniPanelShellSessionHandoffFromControlPage,
);
assert.equal(
shellViewModel.readShellSessionHandoffStatusFromControlPage,
readIniPanelShellSessionHandoffStatusFromControlPage,
);
assert.equal(shellViewModel.createShellSessionHandoffPackageReport, createIniPanelShellSessionHandoffPackageReport);
assert.equal(shellViewModel.createShellSessionHandoffPackageSchema, createIniPanelShellSessionHandoffPackageSchema);
assert.equal(shellViewModel.isSupportedShellSessionHandoffPackage, isSupportedIniPanelShellSessionHandoffPackage);
@@ -883,6 +889,54 @@ const controlPageApiMountWorkflow = mountIniPanelShellSessionHandoffFromControlP
});
assert.equal(controlPageApiMountWorkflow.phase, "blocked");
assert.equal(controlPageApiMountWorkflow.sessionLoadState.phase, "waiting-session");
const readonlyStatusResult = readIniPanelShellSessionHandoffStatusFromControlPage({
handoffSummary: shellViewModel.shellSessionHandoffSummary,
readonlyStatus: createMachineSessionReadonlyStatus({
stateBundle: { overview: { phase: "loaded" } },
workflowStatus: { lastAction: "load-session", run: { status: "not-run" } },
controlView: { sections: [] },
}),
});
assert.equal(readonlyStatusResult.apiName, "ini-panel-shell-session-handoff-readonly-status-result");
assert.equal(readonlyStatusResult.resultVersion, 1);
assert.equal(readonlyStatusResult.phase, "ready");
assert.equal(readonlyStatusResult.ready, true);
assert.equal(readonlyStatusResult.readStatusMethod, "readControlPageStatus");
assert.deepEqual(readonlyStatusResult.expectedStatusFields, shellViewModel.shellSessionHandoffSummary.readonlyStatusFields);
assert.deepEqual(readonlyStatusResult.missingStatusFields, []);
assert.equal(readonlyStatusResult.readonlyStatus.status.lastAction, "load-session");
assert.equal(readonlyStatusResult.readError, null);
const controlPageApiStatusResult = readIniPanelShellSessionHandoffStatusFromControlPage({
handoffSummary: shellViewModel.shellSessionHandoffSummary,
controlPageApi: {
readControlPageStatus: () => createMachineSessionReadonlyStatus({
stateBundle: { overview: { phase: "api-read" } },
}),
},
});
assert.equal(controlPageApiStatusResult.phase, "ready");
assert.equal(controlPageApiStatusResult.readonlyStatus.overview.phase, "api-read");
const missingStatusResult = readIniPanelShellSessionHandoffStatusFromControlPage({
handoffSummary: shellViewModel.shellSessionHandoffSummary,
readonlyStatus: { status: {} },
});
assert.equal(missingStatusResult.phase, "blocked");
assert.deepEqual(missingStatusResult.missingStatusFields, [
"stateBundle",
"workflowStatus",
"overview",
"controlView",
"report",
"runReadiness",
"run",
"session",
]);
assert.equal(
readIniPanelShellSessionHandoffStatusFromControlPage({
handoffSummary: shellViewModel.shellSessionHandoffSummary,
}).readError,
"Missing readControlPageStatus",
);
assert.deepEqual(
mountIniPanelShellSessionHandoff({ documentRef: mountDocument }).renderResult,
null,