推进 INI 面板 shell handoff action plan
This commit is contained in:
@@ -144,6 +144,7 @@
|
||||
getShellSessionHandoffDisplayViewModel: () => shellViewModel.shellSessionHandoffDisplayViewModel,
|
||||
getShellSessionHandoffSnapshot: () => shellViewModel.shellSessionHandoffSnapshot,
|
||||
getShellSessionHandoffRenderState: () => shellViewModel.shellSessionHandoffRenderState,
|
||||
getShellSessionHandoffActionPlan: () => shellViewModel.shellSessionHandoffActionPlan,
|
||||
getLauncherLinks: () => shellViewModel.launcherLinks,
|
||||
getControlPageApiMethods: () => shellViewModel.controlPage.browserApiMethods,
|
||||
};
|
||||
|
||||
@@ -133,6 +133,7 @@ export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntr
|
||||
"getShellSessionHandoffDisplayViewModel",
|
||||
"getShellSessionHandoffSnapshot",
|
||||
"getShellSessionHandoffRenderState",
|
||||
"getShellSessionHandoffActionPlan",
|
||||
"getLauncherLinks",
|
||||
"getControlPageApiMethods",
|
||||
],
|
||||
@@ -588,6 +589,64 @@ export function createIniPanelShellSessionHandoffRenderState(
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellSessionHandoffActionPlan({
|
||||
snapshot = createIniPanelShellSessionHandoffSnapshot(),
|
||||
renderState = createIniPanelShellSessionHandoffRenderState(snapshot),
|
||||
} = {}) {
|
||||
const summary = snapshot?.summary && typeof snapshot.summary === "object" ? snapshot.summary : {};
|
||||
const handoffMethods = summary.handoffMethods && typeof summary.handoffMethods === "object"
|
||||
? summary.handoffMethods
|
||||
: {};
|
||||
const blockingReasons = Array.isArray(summary.blockingReasons)
|
||||
? [...summary.blockingReasons]
|
||||
: [];
|
||||
const displayRows = Array.isArray(renderState?.rows) ? renderState.rows.map(({ id, label, value }) => ({
|
||||
id,
|
||||
label,
|
||||
value,
|
||||
})) : [];
|
||||
const ready = snapshot?.ready === true && renderState?.ready === true && blockingReasons.length === 0;
|
||||
|
||||
return {
|
||||
apiName: "ini-panel-shell-session-handoff-action-plan",
|
||||
planVersion: 1,
|
||||
phase: ready ? "ready" : "blocked",
|
||||
ready,
|
||||
statusLine: renderState?.statusLine ?? "Blocked: No handoff render state",
|
||||
targetPage: summary.targetPage ?? null,
|
||||
requiredMethods: {
|
||||
loadSessionState: handoffMethods.loadSessionState ?? null,
|
||||
readStatus: handoffMethods.readStatus ?? null,
|
||||
},
|
||||
blockingReasons,
|
||||
displayRows,
|
||||
nextSteps: ready
|
||||
? [
|
||||
{
|
||||
id: "open-control-page",
|
||||
label: "Open control page target",
|
||||
targetPage: summary.targetPage ?? null,
|
||||
},
|
||||
{
|
||||
id: "read-readonly-status",
|
||||
label: "Read readonly status",
|
||||
methods: {
|
||||
loadSessionState: handoffMethods.loadSessionState ?? null,
|
||||
readStatus: handoffMethods.readStatus ?? null,
|
||||
},
|
||||
},
|
||||
]
|
||||
: [
|
||||
{
|
||||
id: "resolve-blockers",
|
||||
label: "Resolve handoff blockers",
|
||||
blockingReasons,
|
||||
displayRows,
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries()) {
|
||||
const shellIntegrationManifest = createIniPanelShellIntegrationManifest(entries);
|
||||
const shellIntegrationReadiness = createIniPanelShellIntegrationReadiness(shellIntegrationManifest);
|
||||
@@ -615,6 +674,10 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
const shellSessionHandoffRenderState = createIniPanelShellSessionHandoffRenderState(
|
||||
shellSessionHandoffSnapshot,
|
||||
);
|
||||
const shellSessionHandoffActionPlan = createIniPanelShellSessionHandoffActionPlan({
|
||||
snapshot: shellSessionHandoffSnapshot,
|
||||
renderState: shellSessionHandoffRenderState,
|
||||
});
|
||||
return {
|
||||
pages: entries.map(({ id, href, title }) => ({
|
||||
id,
|
||||
@@ -632,6 +695,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
shellSessionHandoffDisplayViewModel,
|
||||
shellSessionHandoffSnapshot,
|
||||
shellSessionHandoffRenderState,
|
||||
shellSessionHandoffActionPlan,
|
||||
launchApiSchema: createIniPanelLaunchApiSchema(),
|
||||
launchApiManifest: createIniPanelLaunchApiManifest(entries),
|
||||
isSupportedShellIntegrationManifest: isSupportedIniPanelShellIntegrationManifest,
|
||||
@@ -644,6 +708,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
createShellSessionHandoffDisplayViewModel: createIniPanelShellSessionHandoffDisplayViewModel,
|
||||
createShellSessionHandoffSnapshot: createIniPanelShellSessionHandoffSnapshot,
|
||||
createShellSessionHandoffRenderState: createIniPanelShellSessionHandoffRenderState,
|
||||
createShellSessionHandoffActionPlan: createIniPanelShellSessionHandoffActionPlan,
|
||||
controlPage: {
|
||||
browserApiSchema: createControlPageBrowserApiSchema(),
|
||||
browserApiManifest: createControlPageBrowserApiManifest(),
|
||||
|
||||
Reference in New Issue
Block a user