推进 INI 面板 shell handoff package render-state

This commit is contained in:
2026-06-15 11:07:09 +08:00
parent bb8ac55905
commit 1d06fd4cd4
10 changed files with 284 additions and 7 deletions

View File

@@ -139,6 +139,7 @@ export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntr
"getShellSessionHandoffPackage",
"getShellSessionHandoffPackageReport",
"getShellSessionHandoffPackageDisplayViewModel",
"getShellSessionHandoffPackageRenderState",
"isSupportedShellSessionHandoffPackage",
"getLauncherLinks",
"getControlPageApiMethods",
@@ -905,6 +906,38 @@ export function createIniPanelShellSessionHandoffPackageDisplayViewModel(
};
}
export function createIniPanelShellSessionHandoffPackageRenderState(
displayViewModel = createIniPanelShellSessionHandoffPackageDisplayViewModel(),
) {
const rows = Array.isArray(displayViewModel?.rows)
? displayViewModel.rows.map(({ id, label, value }) => ({
id,
label,
value: value == null ? "" : String(value),
}))
: [];
const ready = displayViewModel?.phase === "ready" && displayViewModel?.statusText === "Ready";
const statusText = displayViewModel?.statusText ?? (ready ? "Ready" : "Blocked");
const detailText = displayViewModel?.detailText ?? "No blocking reasons";
return {
apiName: "ini-panel-shell-session-handoff-package-render-state",
renderStateVersion: 1,
phase: ready ? "ready" : "blocked",
ready,
title: displayViewModel?.title ?? "Shell handoff package",
statusText,
detailText,
statusLine: `${statusText}: ${detailText}`,
rows,
dataset: {
handoffPhase: ready ? "ready" : "blocked",
handoffReady: ready ? "true" : "false",
handoffScope: "package",
},
};
}
export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries()) {
const shellIntegrationManifest = createIniPanelShellIntegrationManifest(entries);
const shellIntegrationReadiness = createIniPanelShellIntegrationReadiness(shellIntegrationManifest);
@@ -955,6 +988,9 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
const shellSessionHandoffPackageDisplayViewModel = createIniPanelShellSessionHandoffPackageDisplayViewModel(
shellSessionHandoffPackageReport,
);
const shellSessionHandoffPackageRenderState = createIniPanelShellSessionHandoffPackageRenderState(
shellSessionHandoffPackageDisplayViewModel,
);
return {
pages: entries.map(({ id, href, title }) => ({
id,
@@ -978,6 +1014,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
shellSessionHandoffPackageSchema: createIniPanelShellSessionHandoffPackageSchema(),
shellSessionHandoffPackageReport,
shellSessionHandoffPackageDisplayViewModel,
shellSessionHandoffPackageRenderState,
launchApiSchema: createIniPanelLaunchApiSchema(),
launchApiManifest: createIniPanelLaunchApiManifest(entries),
isSupportedShellIntegrationManifest: isSupportedIniPanelShellIntegrationManifest,
@@ -996,6 +1033,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
createShellSessionHandoffPackageSchema: createIniPanelShellSessionHandoffPackageSchema,
createShellSessionHandoffPackageReport: createIniPanelShellSessionHandoffPackageReport,
createShellSessionHandoffPackageDisplayViewModel: createIniPanelShellSessionHandoffPackageDisplayViewModel,
createShellSessionHandoffPackageRenderState: createIniPanelShellSessionHandoffPackageRenderState,
isSupportedShellSessionHandoffPackage: isSupportedIniPanelShellSessionHandoffPackage,
controlPage: {
browserApiSchema: createControlPageBrowserApiSchema(),