推进 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",