推进 INI 面板 shell handoff control-page mount workflow helper

This commit is contained in:
2026-06-15 12:23:51 +08:00
parent 298aa5e403
commit c3d9b90de1
9 changed files with 234 additions and 9 deletions

View File

@@ -89,6 +89,7 @@ TOOL_TABLE = browser-shell-tool.tbl
!launchApi?.getShellSessionHandoffMountDomReadiness ||
!launchApi?.renderShellSessionHandoffMountState ||
!launchApi?.mountShellSessionHandoff ||
!launchApi?.mountShellSessionHandoffFromControlPage ||
!launchApi?.isSupportedShellSessionHandoffPackage
) {
throw new Error("launch API namespace did not expose shell integration helpers");
@@ -287,21 +288,24 @@ TOOL_TABLE = browser-shell-tool.tbl
"ready",
"shell integration control-page session readiness",
);
const readyMountState = launchApi.getShellSessionHandoffPackageMountState(
controlPageApi[handoffSummary.handoffMethods.loadSessionState](),
);
const readySessionLoadState = controlPageApi[handoffSummary.handoffMethods.loadSessionState]();
const readyMountState = launchApi.getShellSessionHandoffPackageMountState(readySessionLoadState);
const readyMountDisplay = launchApi.getShellSessionHandoffPackageMountDisplayViewModel(readyMountState);
const readyMountRenderState = launchApi.getShellSessionHandoffPackageMountRenderState(readyMountState);
const readyMountWorkflow = launchApi.mountShellSessionHandoff({
renderState: readyMountRenderState,
const readyControlPageMountWorkflow = launchApi.mountShellSessionHandoffFromControlPage({
sessionLoadState: readySessionLoadState,
contract: externalMountDomContract,
documentRef: document,
});
const readyMountWorkflow = readyControlPageMountWorkflow.mountWorkflow;
const readyMountRenderResult = readyMountWorkflow.renderResult;
assertEqual(readyMountState.ready, true, "shell handoff package mount-state readiness");
assertEqual(readyMountState.sessionLoadState.phase, "ready", "shell handoff package mount-state ready session");
assertEqual(readyMountDisplay.detailText, "No blocking reasons", "shell handoff package ready mount display");
assertEqual(readyMountRenderState.statusLine, "Ready: No blocking reasons", "shell handoff package ready mount render-state");
assertEqual(readyControlPageMountWorkflow.phase, "ready", "external shell control-page mount workflow phase");
assertEqual(readyControlPageMountWorkflow.sessionLoadState.phase, "ready", "external shell control-page mount workflow session");
assertEqual(readyControlPageMountWorkflow.mountState.ready, true, "external shell control-page mount workflow state");
assertEqual(readyMountRenderResult.rendered, true, "external shell ready mount render result");
assertEqual(readyMountWorkflow.phase, "ready", "external shell ready mount workflow phase");
assertEqual(readyMountRenderResult.dataset.handoffReady, "true", "external shell ready mount render dataset");

View File

@@ -30,6 +30,7 @@ import {
createIniPanelShellSessionHandoffMountDomContract,
createIniPanelShellSessionHandoffMountDomReadiness,
mountIniPanelShellSessionHandoff,
mountIniPanelShellSessionHandoffFromControlPage,
renderIniPanelShellSessionHandoffMountState,
createIniPanelShellSessionHandoffPackageReport,
createIniPanelShellSessionHandoffPackageRenderState,
@@ -99,6 +100,7 @@ const requiredShellExports = [
"createIniPanelShellSessionHandoffMountDomContract",
"createIniPanelShellSessionHandoffMountDomReadiness",
"mountIniPanelShellSessionHandoff",
"mountIniPanelShellSessionHandoffFromControlPage",
"renderIniPanelShellSessionHandoffMountState",
"createIniPanelShellSessionHandoffPackageReport",
"createIniPanelShellSessionHandoffPackageRenderState",
@@ -297,6 +299,10 @@ assert.equal(
mountIniPanelShellSessionHandoff({ documentRef: null }).phase,
"blocked",
);
assert.equal(
mountIniPanelShellSessionHandoffFromControlPage({ documentRef: null }).mountWorkflow.phase,
"blocked",
);
assert.equal(isSupportedIniPanelShellSessionHandoffPackage(createIniPanelShellViewModel().shellSessionHandoffPackage), true);
assert.equal(isSupportedIniPanelShellIntegrationManifest(createIniPanelShellViewModel().shellIntegrationManifest), true);
assert.deepEqual(createIniPanelShellViewModel().launchApiSchema, createIniPanelLaunchApiSchema());
@@ -457,6 +463,7 @@ assert.match(docText, /\blinuxCncIniPanelLaunchApi\.renderShellSessionHandoffMou
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellSessionHandoffMountDomContract\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellSessionHandoffMountDomReadiness\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.mountShellSessionHandoff\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.mountShellSessionHandoffFromControlPage\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/);
@@ -476,6 +483,7 @@ assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffPackage
assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffMountDomContract\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffMountDomReadiness\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bmountShellSessionHandoff\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bmountShellSessionHandoffFromControlPage\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\brenderShellSessionHandoffMountState\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bdata-external-shell-mount\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bdata-external-mount-value\b/);

View File

@@ -67,6 +67,7 @@ assert.deepEqual(manifest, {
"getShellSessionHandoffMountDomReadiness",
"renderShellSessionHandoffMountState",
"mountShellSessionHandoff",
"mountShellSessionHandoffFromControlPage",
"isSupportedShellSessionHandoffPackage",
"getLauncherLinks",
"getControlPageApiMethods",
@@ -189,6 +190,7 @@ assert.match(launchText, /\bgetShellSessionHandoffMountDomContract\b/);
assert.match(launchText, /\bgetShellSessionHandoffMountDomReadiness\b/);
assert.match(launchText, /\brenderShellSessionHandoffMountState\b/);
assert.match(launchText, /\bmountShellSessionHandoff\b/);
assert.match(launchText, /\bmountShellSessionHandoffFromControlPage\b/);
assert.match(launchText, /\bisSupportedShellSessionHandoffPackage\b/);
assert.match(launchText, /\bdata-handoff-mount\b/);
assert.match(launchText, /\bdata-handoff-mount-status\b/);

View File

@@ -26,6 +26,7 @@ import {
createIniPanelShellSessionHandoffMountDomContract,
createIniPanelShellSessionHandoffMountDomReadiness,
mountIniPanelShellSessionHandoff,
mountIniPanelShellSessionHandoffFromControlPage,
createIniPanelShellSessionHandoffPackageReport,
createIniPanelShellSessionHandoffPackageRenderState,
createIniPanelShellSessionHandoffPackageSchema,
@@ -152,7 +153,7 @@ assert.deepEqual(readiness, {
counts: {
pages: 2,
launcherLinks: 2,
launchMethods: 30,
launchMethods: 31,
controlPageMethods: 11,
persistenceCapabilities: 3,
},
@@ -214,7 +215,7 @@ assert.deepEqual(handoffSummary, {
counts: {
pages: 2,
launcherLinks: 2,
launchMethods: 30,
launchMethods: 31,
controlPageMethods: 11,
persistenceCapabilities: 3,
},
@@ -706,6 +707,10 @@ assert.equal(
mountIniPanelShellSessionHandoff({ documentRef: null }).statusLine,
"Blocked: document, mount, status, rows",
);
assert.equal(
mountIniPanelShellSessionHandoffFromControlPage({ documentRef: null }).sessionLoadState.phase,
"waiting-api",
);
assert.deepEqual(
createIniPanelShellSessionHandoffPackageMountState({
handoffPackage,
@@ -1117,7 +1122,7 @@ assert.deepEqual(createIniPanelShellIntegrationReadiness(blockedManifest), {
counts: {
pages: 2,
launcherLinks: 2,
launchMethods: 30,
launchMethods: 31,
controlPageMethods: 11,
persistenceCapabilities: 3,
},
@@ -1289,6 +1294,7 @@ assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPack
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffMountDomContract\b/);
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 createIniPanelShellSessionHandoffPackageReport\b/);
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageRenderState\b/);
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageSchema\b/);
@@ -1317,6 +1323,7 @@ assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageMountState\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffMountDomContract\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffMountDomReadiness\b/);
assert.match(docText, /\bmountIniPanelShellSessionHandoff\b/);
assert.match(docText, /\bmountIniPanelShellSessionHandoffFromControlPage\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageReport\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageRenderState\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageSchema\b/);

View File

@@ -26,6 +26,7 @@ import {
createIniPanelShellSessionHandoffMountDomContract,
createIniPanelShellSessionHandoffMountDomReadiness,
mountIniPanelShellSessionHandoff,
mountIniPanelShellSessionHandoffFromControlPage,
renderIniPanelShellSessionHandoffMountState,
createIniPanelShellSessionHandoffPackageReport,
createIniPanelShellSessionHandoffPackageRenderState,
@@ -100,6 +101,7 @@ assert.equal(typeof createIniPanelShellSessionHandoffPackageMountState, "functio
assert.equal(typeof createIniPanelShellSessionHandoffMountDomContract, "function");
assert.equal(typeof createIniPanelShellSessionHandoffMountDomReadiness, "function");
assert.equal(typeof mountIniPanelShellSessionHandoff, "function");
assert.equal(typeof mountIniPanelShellSessionHandoffFromControlPage, "function");
assert.equal(typeof renderIniPanelShellSessionHandoffMountState, "function");
assert.equal(typeof createIniPanelShellSessionHandoffPackageReport, "function");
assert.equal(typeof createIniPanelShellSessionHandoffPackageRenderState, "function");
@@ -702,6 +704,10 @@ assert.equal(
renderIniPanelShellSessionHandoffMountState,
);
assert.equal(shellViewModel.mountShellSessionHandoff, mountIniPanelShellSessionHandoff);
assert.equal(
shellViewModel.mountShellSessionHandoffFromControlPage,
mountIniPanelShellSessionHandoffFromControlPage,
);
assert.equal(shellViewModel.createShellSessionHandoffPackageReport, createIniPanelShellSessionHandoffPackageReport);
assert.equal(shellViewModel.createShellSessionHandoffPackageSchema, createIniPanelShellSessionHandoffPackageSchema);
assert.equal(shellViewModel.isSupportedShellSessionHandoffPackage, isSupportedIniPanelShellSessionHandoffPackage);
@@ -840,6 +846,43 @@ assert.equal(mountWorkflowResult.domReadiness.ready, true);
assert.equal(mountWorkflowResult.renderResult.rendered, true);
assert.equal(mountWorkflowResult.renderResult.rowCount, 5);
assert.equal(mountWorkflowResult.error, null);
const controlPageMountWorkflow = mountIniPanelShellSessionHandoffFromControlPage({
handoffPackage: shellViewModel.shellSessionHandoffPackage,
packageRenderState: shellViewModel.shellSessionHandoffPackageRenderState,
sessionLoadState: createControlPageSessionLoadState({
phase: "ready",
panelReady: true,
apiReady: true,
controlViewReady: true,
controlView: { status: { runStatus: "not-run" } },
}),
documentRef: mountDocument,
mountNode,
statusNode: mountStatusNode,
rowsNode: mountRowsNode,
});
assert.equal(controlPageMountWorkflow.apiName, "ini-panel-shell-session-handoff-control-page-mount-workflow");
assert.equal(controlPageMountWorkflow.workflowVersion, 1);
assert.equal(controlPageMountWorkflow.phase, "ready");
assert.equal(controlPageMountWorkflow.ready, true);
assert.equal(controlPageMountWorkflow.sessionLoadState.phase, "ready");
assert.equal(controlPageMountWorkflow.mountState.ready, true);
assert.equal(controlPageMountWorkflow.mountRenderState.ready, true);
assert.equal(controlPageMountWorkflow.mountWorkflow.renderResult.dataset.handoffReady, "true");
assert.equal(controlPageMountWorkflow.sessionLoadError, null);
const controlPageApiMountWorkflow = mountIniPanelShellSessionHandoffFromControlPage({
handoffPackage: shellViewModel.shellSessionHandoffPackage,
packageRenderState: shellViewModel.shellSessionHandoffPackageRenderState,
controlPageApi: {
loadControlPageSessionState: () => createControlPageSessionLoadState({ phase: "waiting-session" }),
},
documentRef: mountDocument,
mountNode,
statusNode: mountStatusNode,
rowsNode: mountRowsNode,
});
assert.equal(controlPageApiMountWorkflow.phase, "blocked");
assert.equal(controlPageApiMountWorkflow.sessionLoadState.phase, "waiting-session");
assert.deepEqual(
mountIniPanelShellSessionHandoff({ documentRef: mountDocument }).renderResult,
null,