推进 INI 面板 shell handoff summary browser API

This commit is contained in:
2026-06-15 08:12:33 +08:00
parent b31b9a2f8a
commit 01817f6493
9 changed files with 133 additions and 9 deletions

View File

@@ -73,6 +73,7 @@
!launchApi?.getShellIntegrationSchema ||
!launchApi?.getShellIntegrationManifest ||
!launchApi?.getShellIntegrationReadiness ||
!launchApi?.getShellSessionHandoffSummary ||
!launchApi?.getLauncherLinks ||
!launchApi?.getControlPageApiMethods
) {
@@ -112,12 +113,13 @@
);
assertEqual(
launchApiManifest.methods.join(","),
"isSupportedLaunchApiManifest,getLaunchApiSchema,getLaunchApiManifest,getShellIntegrationSchema,getShellIntegrationManifest,getShellIntegrationReadiness,getLauncherLinks,getControlPageApiMethods",
"isSupportedLaunchApiManifest,getLaunchApiSchema,getLaunchApiManifest,getShellIntegrationSchema,getShellIntegrationManifest,getShellIntegrationReadiness,getShellSessionHandoffSummary,getLauncherLinks,getControlPageApiMethods",
"launch API manifest methods",
);
const shellIntegrationSchema = launchApi.getShellIntegrationSchema();
const shellIntegrationManifest = launchApi.getShellIntegrationManifest();
const shellIntegrationReadiness = launchApi.getShellIntegrationReadiness();
const shellSessionHandoffSummary = launchApi.getShellSessionHandoffSummary();
assertEqual(
shellIntegrationSchema.manifestVersion,
1,
@@ -158,6 +160,26 @@
"",
"shell integration readiness missing checks",
);
assertEqual(
shellSessionHandoffSummary.ready,
true,
"shell session handoff summary readiness",
);
assertEqual(
shellSessionHandoffSummary.targetPage.href,
"./control-page.html",
"shell session handoff summary target",
);
assertEqual(
shellSessionHandoffSummary.readonlyStatusFields.includes("session"),
true,
"shell session handoff summary readonly fields",
);
assertEqual(
shellSessionHandoffSummary.persistenceCapabilities.length,
3,
"shell session handoff summary persistence capabilities",
);
assertEqual(
JSON.stringify(shellIntegrationManifest),
JSON.stringify(createIniPanelShellIntegrationManifest()),

View File

@@ -63,16 +63,24 @@ TOOL_TABLE = browser-shell-tool.tbl
const launchApi = launchDoc.defaultView.linuxCncIniPanelLaunchApi;
if (
!launchApi?.getShellIntegrationManifest ||
!launchApi?.getShellIntegrationReadiness
!launchApi?.getShellIntegrationReadiness ||
!launchApi?.getShellSessionHandoffSummary
) {
throw new Error("launch API namespace did not expose shell integration helpers");
}
const integrationManifest = launchApi.getShellIntegrationManifest();
const readiness = launchApi.getShellIntegrationReadiness();
const handoffSummary = launchApi.getShellSessionHandoffSummary();
assertEqual(readiness.phase, "ready", "shell integration readiness phase");
assertEqual(readiness.ready, true, "shell integration readiness");
assertEqual(readiness.missing.join(","), "", "shell integration readiness missing checks");
assertEqual(handoffSummary.ready, true, "shell handoff summary readiness");
assertEqual(handoffSummary.blockingReasons.join(","), "", "shell handoff summary blocking reasons");
assertEqual(handoffSummary.handoffMethods.loadSessionState, "loadControlPageSessionState", "shell handoff load method");
assertEqual(handoffSummary.handoffMethods.readStatus, "readControlPageStatus", "shell handoff status method");
assertEqual(handoffSummary.readonlyStatusFields.includes("session"), true, "shell handoff readonly session field");
assertEqual(handoffSummary.persistenceCapabilities.length, 3, "shell handoff persistence capabilities");
assertEqual(readiness.apiNames.launch, "ini-panel-launch", "shell integration launch API name");
assertEqual(
readiness.apiNames.controlPage,
@@ -94,6 +102,7 @@ TOOL_TABLE = browser-shell-tool.tbl
(page) => page.entryId === "control-view",
);
assertEqual(controlTarget.href, "./control-page.html", "shell integration control target");
assertEqual(handoffSummary.targetPage.href, controlTarget.href, "shell handoff summary target");
const controlDoc = await loadFrame(`../../runtime/ui/ini-panel/${controlTarget.href.slice(2)}`);
const controlPageApi = controlDoc.defaultView.linuxCncIniPanelControlPageApi;
@@ -120,12 +129,12 @@ TOOL_TABLE = browser-shell-tool.tbl
"embedded INI panel API",
);
assertEqual(
controlPageApi.loadControlPageSessionState().phase,
controlPageApi[handoffSummary.handoffMethods.loadSessionState]().phase,
"ready",
"shell integration control-page session readiness",
);
assertEqual(
controlPageApi.readControlPageStatus().status.lastAction,
controlPageApi[handoffSummary.handoffMethods.readStatus]().status.lastAction,
null,
"shell integration initial readonly status",
);
@@ -147,7 +156,7 @@ TOOL_TABLE = browser-shell-tool.tbl
"shell integration load session",
);
const readonlyStatus = controlPageApi.readControlPageStatus();
const readonlyStatus = controlPageApi[handoffSummary.handoffMethods.readStatus]();
assertEqual(
readonlyStatus.workflowStatus.lastAction,
"load-session",
@@ -163,6 +172,11 @@ TOOL_TABLE = browser-shell-tool.tbl
"browser-shell-tool.tbl",
"shell integration readonly state bundle tool table",
);
assertEqual(
handoffSummary.readonlyStatusFields.every((fieldName) => Object.hasOwn(readonlyStatus, fieldName)),
true,
"shell handoff readonly status fields",
);
assertEqual(
controlDoc.getElementById("control-page-status").textContent,
"load-session | not-run | -",