推进 INI 面板 shell handoff checklist

This commit is contained in:
2026-06-15 10:07:44 +08:00
parent 2a7485c14d
commit c92021fa82
10 changed files with 402 additions and 5 deletions

View File

@@ -134,6 +134,7 @@ export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntr
"getShellSessionHandoffSnapshot",
"getShellSessionHandoffRenderState",
"getShellSessionHandoffActionPlan",
"getShellSessionHandoffChecklist",
"getLauncherLinks",
"getControlPageApiMethods",
],
@@ -647,6 +648,73 @@ export function createIniPanelShellSessionHandoffActionPlan({
};
}
export function createIniPanelShellSessionHandoffChecklist({
actionPlan = createIniPanelShellSessionHandoffActionPlan(),
renderState = createIniPanelShellSessionHandoffRenderState(),
} = {}) {
const displayRows = Array.isArray(actionPlan?.displayRows)
? actionPlan.displayRows.map(({ id, label, value }) => ({ id, label, value }))
: [];
const blockingReasons = Array.isArray(actionPlan?.blockingReasons)
? [...actionPlan.blockingReasons]
: [];
const targetPageReady = Boolean(actionPlan?.targetPage?.href);
const loadMethodReady = Boolean(actionPlan?.requiredMethods?.loadSessionState);
const readMethodReady = Boolean(actionPlan?.requiredMethods?.readStatus);
const ready = actionPlan?.ready === true
&& renderState?.ready === true
&& targetPageReady
&& loadMethodReady
&& readMethodReady
&& blockingReasons.length === 0;
const checks = [
{
id: "render-state",
label: "Render state",
status: renderState?.ready ? "pass" : "blocked",
value: renderState?.statusLine ?? "missing",
},
{
id: "target-page",
label: "Control target",
status: targetPageReady ? "pass" : "blocked",
value: actionPlan?.targetPage?.href ?? "missing",
},
{
id: "load-session-method",
label: "Load session method",
status: loadMethodReady ? "pass" : "blocked",
value: actionPlan?.requiredMethods?.loadSessionState ?? "missing",
},
{
id: "read-status-method",
label: "Read status method",
status: readMethodReady ? "pass" : "blocked",
value: actionPlan?.requiredMethods?.readStatus ?? "missing",
},
{
id: "blocking-reasons",
label: "Blocking reasons",
status: blockingReasons.length === 0 ? "pass" : "blocked",
value: blockingReasons.length === 0 ? "none" : blockingReasons.join(", "),
},
];
return {
apiName: "ini-panel-shell-session-handoff-checklist",
checklistVersion: 1,
phase: ready ? "ready" : "blocked",
ready,
statusLine: actionPlan?.statusLine ?? renderState?.statusLine ?? "Blocked: No handoff action plan",
checks,
displayRows,
nextStepIds: Array.isArray(actionPlan?.nextSteps)
? actionPlan.nextSteps.map(({ id }) => id)
: [],
blockingReasons,
};
}
export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries()) {
const shellIntegrationManifest = createIniPanelShellIntegrationManifest(entries);
const shellIntegrationReadiness = createIniPanelShellIntegrationReadiness(shellIntegrationManifest);
@@ -678,6 +746,10 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
snapshot: shellSessionHandoffSnapshot,
renderState: shellSessionHandoffRenderState,
});
const shellSessionHandoffChecklist = createIniPanelShellSessionHandoffChecklist({
actionPlan: shellSessionHandoffActionPlan,
renderState: shellSessionHandoffRenderState,
});
return {
pages: entries.map(({ id, href, title }) => ({
id,
@@ -696,6 +768,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
shellSessionHandoffSnapshot,
shellSessionHandoffRenderState,
shellSessionHandoffActionPlan,
shellSessionHandoffChecklist,
launchApiSchema: createIniPanelLaunchApiSchema(),
launchApiManifest: createIniPanelLaunchApiManifest(entries),
isSupportedShellIntegrationManifest: isSupportedIniPanelShellIntegrationManifest,
@@ -709,6 +782,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
createShellSessionHandoffSnapshot: createIniPanelShellSessionHandoffSnapshot,
createShellSessionHandoffRenderState: createIniPanelShellSessionHandoffRenderState,
createShellSessionHandoffActionPlan: createIniPanelShellSessionHandoffActionPlan,
createShellSessionHandoffChecklist: createIniPanelShellSessionHandoffChecklist,
controlPage: {
browserApiSchema: createControlPageBrowserApiSchema(),
browserApiManifest: createControlPageBrowserApiManifest(),