推进 INI 面板 shell integration workflow plan
This commit is contained in:
@@ -324,8 +324,65 @@ export function createIniPanelShellIntegrationReadiness(
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellIntegrationWorkflowPlan({
|
||||
manifest = createIniPanelShellIntegrationManifest(),
|
||||
readiness = createIniPanelShellIntegrationReadiness(manifest),
|
||||
controlEntryId = "control-view",
|
||||
} = {}) {
|
||||
const targetPage = manifest?.launchApiManifest?.targetPages?.find(
|
||||
(page) => page.entryId === controlEntryId,
|
||||
) ?? null;
|
||||
const requiredLaunchApiMethods = [
|
||||
"getShellIntegrationManifest",
|
||||
"getShellIntegrationReadiness",
|
||||
];
|
||||
const requiredControlPageApiMethods = [
|
||||
"getControlPageApiManifest",
|
||||
"loadControlPageSessionState",
|
||||
"readControlPageStatus",
|
||||
];
|
||||
const launchMethods = Array.isArray(manifest?.launchApiManifest?.methods)
|
||||
? manifest.launchApiManifest.methods
|
||||
: [];
|
||||
const controlPageMethods = Array.isArray(manifest?.controlPageApiManifest?.methods)
|
||||
? manifest.controlPageApiManifest.methods
|
||||
: [];
|
||||
const missingLaunchApiMethods = requiredLaunchApiMethods.filter(
|
||||
(methodName) => !launchMethods.includes(methodName),
|
||||
);
|
||||
const missingControlPageApiMethods = requiredControlPageApiMethods.filter(
|
||||
(methodName) => !controlPageMethods.includes(methodName),
|
||||
);
|
||||
const missing = [
|
||||
...readiness.missing,
|
||||
...(targetPage ? [] : ["controlTargetPage"]),
|
||||
...missingLaunchApiMethods.map((methodName) => `launchApi.${methodName}`),
|
||||
...missingControlPageApiMethods.map((methodName) => `controlPageApi.${methodName}`),
|
||||
];
|
||||
const ready = readiness.ready && missing.length === 0;
|
||||
|
||||
return {
|
||||
phase: ready ? "ready" : "blocked",
|
||||
ready,
|
||||
controlEntryId,
|
||||
targetPage,
|
||||
readiness,
|
||||
requiredLaunchApiMethods,
|
||||
requiredControlPageApiMethods,
|
||||
missingLaunchApiMethods,
|
||||
missingControlPageApiMethods,
|
||||
missing,
|
||||
readonlyStatusHandoff: {
|
||||
loadSessionStateMethod: "loadControlPageSessionState",
|
||||
readStatusMethod: "readControlPageStatus",
|
||||
expectedStatusFields: manifest?.controlPageApiManifest?.readonlyStatusApiManifest?.statusFields ?? [],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries()) {
|
||||
const shellIntegrationManifest = createIniPanelShellIntegrationManifest(entries);
|
||||
const shellIntegrationReadiness = createIniPanelShellIntegrationReadiness(shellIntegrationManifest);
|
||||
return {
|
||||
pages: entries.map(({ id, href, title }) => ({
|
||||
id,
|
||||
@@ -335,11 +392,16 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
launcherLinks: createIniPanelLauncherLinkViewModel(entries),
|
||||
shellIntegrationSchema: createIniPanelShellIntegrationSchema(),
|
||||
shellIntegrationManifest,
|
||||
shellIntegrationReadiness: createIniPanelShellIntegrationReadiness(shellIntegrationManifest),
|
||||
shellIntegrationReadiness,
|
||||
shellIntegrationWorkflowPlan: createIniPanelShellIntegrationWorkflowPlan({
|
||||
manifest: shellIntegrationManifest,
|
||||
readiness: shellIntegrationReadiness,
|
||||
}),
|
||||
launchApiSchema: createIniPanelLaunchApiSchema(),
|
||||
launchApiManifest: createIniPanelLaunchApiManifest(entries),
|
||||
isSupportedShellIntegrationManifest: isSupportedIniPanelShellIntegrationManifest,
|
||||
createShellIntegrationReadiness: createIniPanelShellIntegrationReadiness,
|
||||
createShellIntegrationWorkflowPlan: createIniPanelShellIntegrationWorkflowPlan,
|
||||
controlPage: {
|
||||
browserApiSchema: createControlPageBrowserApiSchema(),
|
||||
browserApiManifest: createControlPageBrowserApiManifest(),
|
||||
|
||||
Reference in New Issue
Block a user