推进 INI 面板 shell handoff snapshot API

This commit is contained in:
2026-06-15 09:42:43 +08:00
parent 01817f6493
commit 5c951ab9bc
11 changed files with 1272 additions and 10 deletions

View File

@@ -73,7 +73,12 @@
!launchApi?.getShellIntegrationSchema ||
!launchApi?.getShellIntegrationManifest ||
!launchApi?.getShellIntegrationReadiness ||
!launchApi?.getShellSessionHandoffSummarySchema ||
!launchApi?.getShellSessionHandoffSummary ||
!launchApi?.isSupportedShellSessionHandoffSummary ||
!launchApi?.getShellSessionHandoffCompatibilityReport ||
!launchApi?.getShellSessionHandoffDisplayViewModel ||
!launchApi?.getShellSessionHandoffSnapshot ||
!launchApi?.getLauncherLinks ||
!launchApi?.getControlPageApiMethods
) {
@@ -113,13 +118,17 @@
);
assertEqual(
launchApiManifest.methods.join(","),
"isSupportedLaunchApiManifest,getLaunchApiSchema,getLaunchApiManifest,getShellIntegrationSchema,getShellIntegrationManifest,getShellIntegrationReadiness,getShellSessionHandoffSummary,getLauncherLinks,getControlPageApiMethods",
"isSupportedLaunchApiManifest,getLaunchApiSchema,getLaunchApiManifest,getShellIntegrationSchema,getShellIntegrationManifest,getShellIntegrationReadiness,getShellSessionHandoffSummarySchema,getShellSessionHandoffSummary,isSupportedShellSessionHandoffSummary,getShellSessionHandoffCompatibilityReport,getShellSessionHandoffDisplayViewModel,getShellSessionHandoffSnapshot,getLauncherLinks,getControlPageApiMethods",
"launch API manifest methods",
);
const shellIntegrationSchema = launchApi.getShellIntegrationSchema();
const shellIntegrationManifest = launchApi.getShellIntegrationManifest();
const shellIntegrationReadiness = launchApi.getShellIntegrationReadiness();
const shellSessionHandoffSummarySchema = launchApi.getShellSessionHandoffSummarySchema();
const shellSessionHandoffSummary = launchApi.getShellSessionHandoffSummary();
const shellSessionHandoffCompatibilityReport = launchApi.getShellSessionHandoffCompatibilityReport();
const shellSessionHandoffDisplayViewModel = launchApi.getShellSessionHandoffDisplayViewModel();
const shellSessionHandoffSnapshot = launchApi.getShellSessionHandoffSnapshot();
assertEqual(
shellIntegrationSchema.manifestVersion,
1,
@@ -165,6 +174,86 @@
true,
"shell session handoff summary readiness",
);
assertEqual(
shellSessionHandoffSummarySchema.summaryVersion,
1,
"shell session handoff summary schema version",
);
assertEqual(
launchApi.isSupportedShellSessionHandoffSummary(shellSessionHandoffSummary),
true,
"shell session handoff summary supported",
);
assertEqual(
launchApi.isSupportedShellSessionHandoffSummary({ ...shellSessionHandoffSummary, summaryVersion: 2 }),
false,
"shell session handoff summary rejects version",
);
assertEqual(
shellSessionHandoffCompatibilityReport.compatible,
true,
"shell session handoff compatibility report",
);
assertEqual(
shellSessionHandoffCompatibilityReport.summarySupported,
true,
"shell session handoff summary support report",
);
assertEqual(
shellSessionHandoffCompatibilityReport.missingFields.join(","),
"",
"shell session handoff compatibility missing fields",
);
assertEqual(
shellSessionHandoffDisplayViewModel.statusText,
"Ready",
"shell session handoff display status",
);
assertEqual(
shellSessionHandoffDisplayViewModel.rows.length,
5,
"shell session handoff display rows",
);
assertEqual(
shellSessionHandoffSnapshot.snapshotVersion,
1,
"shell session handoff snapshot version",
);
assertEqual(
shellSessionHandoffSnapshot.ready,
true,
"shell session handoff snapshot readiness",
);
assertEqual(
JSON.stringify(shellSessionHandoffSnapshot.readiness),
JSON.stringify(shellIntegrationReadiness),
"shell session handoff snapshot readiness object",
);
assertEqual(
JSON.stringify(shellSessionHandoffSnapshot.summary),
JSON.stringify(shellSessionHandoffSummary),
"shell session handoff snapshot summary object",
);
assertEqual(
JSON.stringify(shellSessionHandoffSnapshot.displayViewModel),
JSON.stringify(shellSessionHandoffDisplayViewModel),
"shell session handoff snapshot display object",
);
assertEqual(
launchDoc.querySelector("[data-handoff-status]").textContent,
"Ready: No blocking reasons",
"shell session handoff DOM status",
);
assertEqual(
launchDoc.querySelector('[data-handoff-value="missing-fields"]').textContent,
"none",
"shell session handoff DOM missing fields",
);
assertEqual(
launchDoc.querySelector('[data-handoff-value="blocking-reasons"]').textContent,
"none",
"shell session handoff DOM blocking reasons",
);
assertEqual(
shellSessionHandoffSummary.targetPage.href,
"./control-page.html",

View File

@@ -64,14 +64,36 @@ TOOL_TABLE = browser-shell-tool.tbl
if (
!launchApi?.getShellIntegrationManifest ||
!launchApi?.getShellIntegrationReadiness ||
!launchApi?.getShellSessionHandoffSummary
!launchApi?.getShellSessionHandoffSummarySchema ||
!launchApi?.getShellSessionHandoffSummary ||
!launchApi?.isSupportedShellSessionHandoffSummary ||
!launchApi?.getShellSessionHandoffCompatibilityReport ||
!launchApi?.getShellSessionHandoffDisplayViewModel ||
!launchApi?.getShellSessionHandoffSnapshot
) {
throw new Error("launch API namespace did not expose shell integration helpers");
}
const integrationManifest = launchApi.getShellIntegrationManifest();
const readiness = launchApi.getShellIntegrationReadiness();
const handoffSummarySchema = launchApi.getShellSessionHandoffSummarySchema();
const handoffSummary = launchApi.getShellSessionHandoffSummary();
const compatibilityReport = launchApi.getShellSessionHandoffCompatibilityReport();
const handoffDisplay = launchApi.getShellSessionHandoffDisplayViewModel();
const handoffSnapshot = launchApi.getShellSessionHandoffSnapshot();
assertEqual(handoffSummarySchema.summaryVersion, 1, "shell handoff summary schema version");
assertEqual(
launchApi.isSupportedShellSessionHandoffSummary(handoffSummary),
true,
"shell handoff summary supported",
);
assertEqual(compatibilityReport.compatible, true, "shell handoff compatibility report");
assertEqual(compatibilityReport.summarySupported, true, "shell handoff summary report support");
assertEqual(compatibilityReport.blockingReasons.join(","), "", "shell handoff report blocking reasons");
assertEqual(handoffDisplay.statusText, "Ready", "shell handoff display status");
assertEqual(handoffDisplay.detailText, "No blocking reasons", "shell handoff display detail");
assertEqual(handoffSnapshot.ready, true, "shell handoff snapshot readiness");
assertEqual(handoffSnapshot.displayViewModel.statusText, "Ready", "shell handoff snapshot display status");
assertEqual(readiness.phase, "ready", "shell integration readiness phase");
assertEqual(readiness.ready, true, "shell integration readiness");
assertEqual(readiness.missing.join(","), "", "shell integration readiness missing checks");