推进 INI 面板 shell handoff workflow DOM mount helper

This commit is contained in:
2026-06-15 14:28:22 +08:00
parent e1e0c7f6d2
commit 6b6629ce73
9 changed files with 530 additions and 4 deletions

View File

@@ -10,6 +10,10 @@
<p data-external-shell-mount-status>waiting</p>
<dl data-external-shell-mount-rows></dl>
</section>
<section data-external-shell-workflow>
<p data-external-shell-workflow-status>waiting</p>
<dl data-external-shell-workflow-rows></dl>
</section>
<script type="module">
function assertEqual(actual, expected, label) {
if (actual !== expected) {
@@ -94,6 +98,10 @@ TOOL_TABLE = browser-shell-tool.tbl
!launchApi?.getShellSessionHandoffWorkflowSummary ||
!launchApi?.getShellSessionHandoffWorkflowDisplayViewModel ||
!launchApi?.getShellSessionHandoffWorkflowRenderState ||
!launchApi?.getShellSessionHandoffWorkflowDomContract ||
!launchApi?.getShellSessionHandoffWorkflowDomReadiness ||
!launchApi?.renderShellSessionHandoffWorkflowState ||
!launchApi?.mountShellSessionHandoffWorkflow ||
!launchApi?.isSupportedShellSessionHandoffPackage
) {
throw new Error("launch API namespace did not expose shell integration helpers");
@@ -371,6 +379,23 @@ TOOL_TABLE = browser-shell-tool.tbl
const workflowRenderState = launchApi.getShellSessionHandoffWorkflowRenderState(
workflowDisplayResult,
);
const externalWorkflowDomContract = launchApi.getShellSessionHandoffWorkflowDomContract({
rowDatasetPrefix: "externalWorkflow",
selectors: {
mount: "[data-external-shell-workflow]",
status: "[data-external-shell-workflow-status]",
rows: "[data-external-shell-workflow-rows]",
},
});
const externalWorkflowDomReadiness = launchApi.getShellSessionHandoffWorkflowDomReadiness({
contract: externalWorkflowDomContract,
documentRef: document,
});
const workflowDomMountResult = launchApi.mountShellSessionHandoffWorkflow({
renderState: workflowRenderState,
contract: externalWorkflowDomContract,
documentRef: document,
});
assertEqual(readonlyStatusResult.phase, "ready", "shell handoff readonly status result phase");
assertEqual(readonlyStatusResult.ready, true, "shell handoff readonly status result readiness");
assertEqual(
@@ -387,6 +412,19 @@ TOOL_TABLE = browser-shell-tool.tbl
assertEqual(workflowRenderState.phase, "ready", "shell handoff workflow render-state phase");
assertEqual(workflowRenderState.statusLine, "Ready: No blocking reasons", "shell handoff workflow render-state status");
assertEqual(workflowRenderState.dataset.handoffScope, "workflow", "shell handoff workflow render-state scope");
assertEqual(externalWorkflowDomReadiness.ready, true, "shell handoff workflow DOM readiness");
assertEqual(workflowDomMountResult.phase, "ready", "shell handoff workflow DOM mount phase");
assertEqual(workflowDomMountResult.renderResult.rowCount, 5, "shell handoff workflow DOM mount rows");
assertEqual(
document.querySelector("[data-external-shell-workflow]").dataset.handoffScope,
"workflow",
"shell handoff workflow DOM scope",
);
assertEqual(
document.querySelector("[data-external-shell-workflow-status]").textContent,
"Ready: No blocking reasons",
"shell handoff workflow DOM status",
);
assertEqual(
readonlyStatus.workflowStatus.lastAction,
"load-session",

View File

@@ -35,6 +35,10 @@ import {
createIniPanelShellSessionHandoffWorkflowSummary,
createIniPanelShellSessionHandoffWorkflowDisplayViewModel,
createIniPanelShellSessionHandoffWorkflowRenderState,
createIniPanelShellSessionHandoffWorkflowDomContract,
createIniPanelShellSessionHandoffWorkflowDomReadiness,
renderIniPanelShellSessionHandoffWorkflowState,
mountIniPanelShellSessionHandoffWorkflow,
renderIniPanelShellSessionHandoffMountState,
createIniPanelShellSessionHandoffPackageReport,
createIniPanelShellSessionHandoffPackageRenderState,
@@ -109,6 +113,10 @@ const requiredShellExports = [
"createIniPanelShellSessionHandoffWorkflowSummary",
"createIniPanelShellSessionHandoffWorkflowDisplayViewModel",
"createIniPanelShellSessionHandoffWorkflowRenderState",
"createIniPanelShellSessionHandoffWorkflowDomContract",
"createIniPanelShellSessionHandoffWorkflowDomReadiness",
"renderIniPanelShellSessionHandoffWorkflowState",
"mountIniPanelShellSessionHandoffWorkflow",
"renderIniPanelShellSessionHandoffMountState",
"createIniPanelShellSessionHandoffPackageReport",
"createIniPanelShellSessionHandoffPackageRenderState",
@@ -327,6 +335,18 @@ assert.equal(
createIniPanelShellSessionHandoffWorkflowRenderState().phase,
"blocked",
);
assert.equal(
createIniPanelShellSessionHandoffWorkflowDomContract().selectors.mount,
"[data-handoff-workflow]",
);
assert.equal(
createIniPanelShellSessionHandoffWorkflowDomReadiness().phase,
"blocked",
);
assert.equal(
mountIniPanelShellSessionHandoffWorkflow().phase,
"blocked",
);
assert.equal(isSupportedIniPanelShellSessionHandoffPackage(createIniPanelShellViewModel().shellSessionHandoffPackage), true);
assert.equal(isSupportedIniPanelShellIntegrationManifest(createIniPanelShellViewModel().shellIntegrationManifest), true);
assert.deepEqual(createIniPanelShellViewModel().launchApiSchema, createIniPanelLaunchApiSchema());
@@ -492,6 +512,10 @@ assert.match(docText, /\blinuxCncIniPanelLaunchApi\.readShellSessionHandoffStatu
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellSessionHandoffWorkflowSummary\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellSessionHandoffWorkflowDisplayViewModel\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellSessionHandoffWorkflowRenderState\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellSessionHandoffWorkflowDomContract\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellSessionHandoffWorkflowDomReadiness\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.renderShellSessionHandoffWorkflowState\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.mountShellSessionHandoffWorkflow\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/);
@@ -516,6 +540,10 @@ assert.match(shellIntegrationWorkflowSmokeText, /\breadShellSessionHandoffStatus
assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffWorkflowSummary\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffWorkflowDisplayViewModel\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffWorkflowRenderState\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffWorkflowDomContract\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffWorkflowDomReadiness\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\brenderShellSessionHandoffWorkflowState\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bmountShellSessionHandoffWorkflow\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\brenderShellSessionHandoffMountState\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bdata-external-shell-mount\b/);
assert.match(shellIntegrationWorkflowSmokeText, /\bdata-external-mount-value\b/);

View File

@@ -72,6 +72,10 @@ assert.deepEqual(manifest, {
"getShellSessionHandoffWorkflowSummary",
"getShellSessionHandoffWorkflowDisplayViewModel",
"getShellSessionHandoffWorkflowRenderState",
"getShellSessionHandoffWorkflowDomContract",
"getShellSessionHandoffWorkflowDomReadiness",
"renderShellSessionHandoffWorkflowState",
"mountShellSessionHandoffWorkflow",
"isSupportedShellSessionHandoffPackage",
"getLauncherLinks",
"getControlPageApiMethods",
@@ -199,7 +203,14 @@ assert.match(launchText, /\breadShellSessionHandoffStatusFromControlPage\b/);
assert.match(launchText, /\bgetShellSessionHandoffWorkflowSummary\b/);
assert.match(launchText, /\bgetShellSessionHandoffWorkflowDisplayViewModel\b/);
assert.match(launchText, /\bgetShellSessionHandoffWorkflowRenderState\b/);
assert.match(launchText, /\bgetShellSessionHandoffWorkflowDomContract\b/);
assert.match(launchText, /\bgetShellSessionHandoffWorkflowDomReadiness\b/);
assert.match(launchText, /\brenderShellSessionHandoffWorkflowState\b/);
assert.match(launchText, /\bmountShellSessionHandoffWorkflow\b/);
assert.match(launchText, /\bisSupportedShellSessionHandoffPackage\b/);
assert.match(launchText, /\bdata-handoff-workflow\b/);
assert.match(launchText, /\bdata-handoff-workflow-status\b/);
assert.match(launchText, /\bdata-handoff-workflow-rows\b/);
assert.match(launchText, /\bdata-handoff-mount\b/);
assert.match(launchText, /\bdata-handoff-mount-status\b/);
assert.match(launchText, /\bdata-handoff-mount-rows\b/);

View File

@@ -31,6 +31,10 @@ import {
createIniPanelShellSessionHandoffWorkflowSummary,
createIniPanelShellSessionHandoffWorkflowDisplayViewModel,
createIniPanelShellSessionHandoffWorkflowRenderState,
createIniPanelShellSessionHandoffWorkflowDomContract,
createIniPanelShellSessionHandoffWorkflowDomReadiness,
renderIniPanelShellSessionHandoffWorkflowState,
mountIniPanelShellSessionHandoffWorkflow,
createIniPanelShellSessionHandoffPackageReport,
createIniPanelShellSessionHandoffPackageRenderState,
createIniPanelShellSessionHandoffPackageSchema,
@@ -157,7 +161,7 @@ assert.deepEqual(readiness, {
counts: {
pages: 2,
launcherLinks: 2,
launchMethods: 35,
launchMethods: 39,
controlPageMethods: 11,
persistenceCapabilities: 3,
},
@@ -219,7 +223,7 @@ assert.deepEqual(handoffSummary, {
counts: {
pages: 2,
launcherLinks: 2,
launchMethods: 35,
launchMethods: 39,
controlPageMethods: 11,
persistenceCapabilities: 3,
},
@@ -731,6 +735,18 @@ assert.equal(
createIniPanelShellSessionHandoffWorkflowRenderState().phase,
"blocked",
);
assert.equal(
createIniPanelShellSessionHandoffWorkflowDomContract().selectors.mount,
"[data-handoff-workflow]",
);
assert.equal(
createIniPanelShellSessionHandoffWorkflowDomReadiness().phase,
"blocked",
);
assert.equal(
mountIniPanelShellSessionHandoffWorkflow().phase,
"blocked",
);
assert.deepEqual(
createIniPanelShellSessionHandoffPackageMountState({
handoffPackage,
@@ -1142,7 +1158,7 @@ assert.deepEqual(createIniPanelShellIntegrationReadiness(blockedManifest), {
counts: {
pages: 2,
launcherLinks: 2,
launchMethods: 35,
launchMethods: 39,
controlPageMethods: 11,
persistenceCapabilities: 3,
},
@@ -1319,6 +1335,10 @@ assert.match(shellText, /\bexport function readIniPanelShellSessionHandoffStatus
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffWorkflowSummary\b/);
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffWorkflowDisplayViewModel\b/);
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffWorkflowRenderState\b/);
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffWorkflowDomContract\b/);
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffWorkflowDomReadiness\b/);
assert.match(shellText, /\bexport function renderIniPanelShellSessionHandoffWorkflowState\b/);
assert.match(shellText, /\bexport function mountIniPanelShellSessionHandoffWorkflow\b/);
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageReport\b/);
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageRenderState\b/);
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageSchema\b/);
@@ -1352,6 +1372,10 @@ assert.match(docText, /\breadIniPanelShellSessionHandoffStatusFromControlPage\b/
assert.match(docText, /\bcreateIniPanelShellSessionHandoffWorkflowSummary\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffWorkflowDisplayViewModel\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffWorkflowRenderState\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffWorkflowDomContract\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffWorkflowDomReadiness\b/);
assert.match(docText, /\brenderIniPanelShellSessionHandoffWorkflowState\b/);
assert.match(docText, /\bmountIniPanelShellSessionHandoffWorkflow\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageReport\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageRenderState\b/);
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageSchema\b/);

View File

@@ -31,6 +31,10 @@ import {
createIniPanelShellSessionHandoffWorkflowSummary,
createIniPanelShellSessionHandoffWorkflowDisplayViewModel,
createIniPanelShellSessionHandoffWorkflowRenderState,
createIniPanelShellSessionHandoffWorkflowDomContract,
createIniPanelShellSessionHandoffWorkflowDomReadiness,
renderIniPanelShellSessionHandoffWorkflowState,
mountIniPanelShellSessionHandoffWorkflow,
renderIniPanelShellSessionHandoffMountState,
createIniPanelShellSessionHandoffPackageReport,
createIniPanelShellSessionHandoffPackageRenderState,
@@ -110,6 +114,10 @@ assert.equal(typeof readIniPanelShellSessionHandoffStatusFromControlPage, "funct
assert.equal(typeof createIniPanelShellSessionHandoffWorkflowSummary, "function");
assert.equal(typeof createIniPanelShellSessionHandoffWorkflowDisplayViewModel, "function");
assert.equal(typeof createIniPanelShellSessionHandoffWorkflowRenderState, "function");
assert.equal(typeof createIniPanelShellSessionHandoffWorkflowDomContract, "function");
assert.equal(typeof createIniPanelShellSessionHandoffWorkflowDomReadiness, "function");
assert.equal(typeof renderIniPanelShellSessionHandoffWorkflowState, "function");
assert.equal(typeof mountIniPanelShellSessionHandoffWorkflow, "function");
assert.equal(typeof renderIniPanelShellSessionHandoffMountState, "function");
assert.equal(typeof createIniPanelShellSessionHandoffPackageReport, "function");
assert.equal(typeof createIniPanelShellSessionHandoffPackageRenderState, "function");
@@ -732,6 +740,22 @@ assert.equal(
shellViewModel.createShellSessionHandoffWorkflowRenderState,
createIniPanelShellSessionHandoffWorkflowRenderState,
);
assert.equal(
shellViewModel.createShellSessionHandoffWorkflowDomContract,
createIniPanelShellSessionHandoffWorkflowDomContract,
);
assert.equal(
shellViewModel.createShellSessionHandoffWorkflowDomReadiness,
createIniPanelShellSessionHandoffWorkflowDomReadiness,
);
assert.equal(
shellViewModel.renderShellSessionHandoffWorkflowState,
renderIniPanelShellSessionHandoffWorkflowState,
);
assert.equal(
shellViewModel.mountShellSessionHandoffWorkflow,
mountIniPanelShellSessionHandoffWorkflow,
);
assert.equal(shellViewModel.createShellSessionHandoffPackageReport, createIniPanelShellSessionHandoffPackageReport);
assert.equal(shellViewModel.createShellSessionHandoffPackageSchema, createIniPanelShellSessionHandoffPackageSchema);
assert.equal(shellViewModel.isSupportedShellSessionHandoffPackage, isSupportedIniPanelShellSessionHandoffPackage);
@@ -1006,6 +1030,75 @@ const readyWorkflowRenderState = createIniPanelShellSessionHandoffWorkflowRender
);
assert.equal(readyWorkflowRenderState.phase, "ready");
assert.equal(readyWorkflowRenderState.statusLine, "Ready: No blocking reasons");
assert.deepEqual(
createIniPanelShellSessionHandoffWorkflowDomReadiness({
documentRef: mountDocument,
mountNode,
statusNode: mountStatusNode,
rowsNode: mountRowsNode,
}),
{
apiName: "ini-panel-shell-session-handoff-workflow-dom-readiness",
readinessVersion: 1,
phase: "ready",
ready: true,
missing: [],
checks: {
document: true,
mount: true,
status: true,
rows: true,
rowDatasetPrefix: true,
},
contract: createIniPanelShellSessionHandoffWorkflowDomContract(),
},
);
assert.deepEqual(
createIniPanelShellSessionHandoffWorkflowDomReadiness({ documentRef: mountDocument }).missing,
["mount", "status", "rows"],
);
assert.deepEqual(
renderIniPanelShellSessionHandoffWorkflowState(workflowRenderState, {
documentRef: mountDocument,
mountNode,
statusNode: mountStatusNode,
rowsNode: mountRowsNode,
}),
{
rendered: true,
statusLine: "Blocked: mount:blocked",
rowCount: 5,
rowIds: [
"mount-workflow",
"control-page-mount-workflow",
"readonly-status-workflow",
"readonly-status-missing-fields",
"blocking-reasons",
],
dataset: {
handoffPhase: "blocked",
handoffReady: "false",
handoffScope: "workflow",
},
},
);
const workflowDomMountResult = mountIniPanelShellSessionHandoffWorkflow({
renderState: workflowRenderState,
documentRef: mountDocument,
mountNode,
statusNode: mountStatusNode,
rowsNode: mountRowsNode,
});
assert.equal(workflowDomMountResult.apiName, "ini-panel-shell-session-handoff-workflow-dom-mount");
assert.equal(workflowDomMountResult.workflowVersion, 1);
assert.equal(workflowDomMountResult.phase, "blocked");
assert.equal(workflowDomMountResult.ready, false);
assert.equal(workflowDomMountResult.renderResult.rowCount, 5);
assert.equal(workflowDomMountResult.renderResult.dataset.handoffScope, "workflow");
assert.equal(
mountIniPanelShellSessionHandoffWorkflow({ documentRef: mountDocument }).renderResult,
null,
);
assert.deepEqual(
mountIniPanelShellSessionHandoff({ documentRef: mountDocument }).renderResult,
null,