推进 INI 面板 shell handoff package

This commit is contained in:
2026-06-15 10:14:25 +08:00
parent c92021fa82
commit 542b139477
10 changed files with 279 additions and 5 deletions

View File

@@ -135,6 +135,7 @@ export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntr
"getShellSessionHandoffRenderState",
"getShellSessionHandoffActionPlan",
"getShellSessionHandoffChecklist",
"getShellSessionHandoffPackage",
"getLauncherLinks",
"getControlPageApiMethods",
],
@@ -715,6 +716,35 @@ export function createIniPanelShellSessionHandoffChecklist({
};
}
export function createIniPanelShellSessionHandoffPackage({
shellIntegrationManifest = createIniPanelShellIntegrationManifest(),
launchApiManifest = shellIntegrationManifest.launchApiManifest ?? createIniPanelLaunchApiManifest(),
controlPageApiManifest = shellIntegrationManifest.controlPageApiManifest ?? createControlPageBrowserApiManifest(),
snapshot = createIniPanelShellSessionHandoffSnapshot(),
renderState = createIniPanelShellSessionHandoffRenderState(snapshot),
actionPlan = createIniPanelShellSessionHandoffActionPlan({ snapshot, renderState }),
checklist = createIniPanelShellSessionHandoffChecklist({ actionPlan, renderState }),
} = {}) {
return {
apiName: "ini-panel-shell-session-handoff-package",
packageVersion: 1,
phase: checklist.phase,
ready: Boolean(checklist.ready),
statusLine: checklist.statusLine,
manifests: {
shellIntegration: shellIntegrationManifest,
launchApi: launchApiManifest,
controlPageApi: controlPageApiManifest,
launchMethods: Array.isArray(launchApiManifest?.methods) ? [...launchApiManifest.methods] : [],
controlPageMethods: Array.isArray(controlPageApiManifest?.methods) ? [...controlPageApiManifest.methods] : [],
},
snapshot,
renderState,
actionPlan,
checklist,
};
}
export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries()) {
const shellIntegrationManifest = createIniPanelShellIntegrationManifest(entries);
const shellIntegrationReadiness = createIniPanelShellIntegrationReadiness(shellIntegrationManifest);
@@ -750,6 +780,15 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
actionPlan: shellSessionHandoffActionPlan,
renderState: shellSessionHandoffRenderState,
});
const shellSessionHandoffPackage = createIniPanelShellSessionHandoffPackage({
shellIntegrationManifest,
launchApiManifest: shellIntegrationManifest.launchApiManifest,
controlPageApiManifest: shellIntegrationManifest.controlPageApiManifest,
snapshot: shellSessionHandoffSnapshot,
renderState: shellSessionHandoffRenderState,
actionPlan: shellSessionHandoffActionPlan,
checklist: shellSessionHandoffChecklist,
});
return {
pages: entries.map(({ id, href, title }) => ({
id,
@@ -769,6 +808,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
shellSessionHandoffRenderState,
shellSessionHandoffActionPlan,
shellSessionHandoffChecklist,
shellSessionHandoffPackage,
launchApiSchema: createIniPanelLaunchApiSchema(),
launchApiManifest: createIniPanelLaunchApiManifest(entries),
isSupportedShellIntegrationManifest: isSupportedIniPanelShellIntegrationManifest,
@@ -783,6 +823,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
createShellSessionHandoffRenderState: createIniPanelShellSessionHandoffRenderState,
createShellSessionHandoffActionPlan: createIniPanelShellSessionHandoffActionPlan,
createShellSessionHandoffChecklist: createIniPanelShellSessionHandoffChecklist,
createShellSessionHandoffPackage: createIniPanelShellSessionHandoffPackage,
controlPage: {
browserApiSchema: createControlPageBrowserApiSchema(),
browserApiManifest: createControlPageBrowserApiManifest(),