推进 INI 面板 shell handoff package schema
This commit is contained in:
@@ -146,7 +146,9 @@
|
||||
getShellSessionHandoffRenderState: () => shellViewModel.shellSessionHandoffRenderState,
|
||||
getShellSessionHandoffActionPlan: () => shellViewModel.shellSessionHandoffActionPlan,
|
||||
getShellSessionHandoffChecklist: () => shellViewModel.shellSessionHandoffChecklist,
|
||||
getShellSessionHandoffPackageSchema: () => shellViewModel.shellSessionHandoffPackageSchema,
|
||||
getShellSessionHandoffPackage: () => shellViewModel.shellSessionHandoffPackage,
|
||||
isSupportedShellSessionHandoffPackage: shellViewModel.isSupportedShellSessionHandoffPackage,
|
||||
getLauncherLinks: () => shellViewModel.launcherLinks,
|
||||
getControlPageApiMethods: () => shellViewModel.controlPage.browserApiMethods,
|
||||
};
|
||||
|
||||
@@ -135,7 +135,9 @@ export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntr
|
||||
"getShellSessionHandoffRenderState",
|
||||
"getShellSessionHandoffActionPlan",
|
||||
"getShellSessionHandoffChecklist",
|
||||
"getShellSessionHandoffPackageSchema",
|
||||
"getShellSessionHandoffPackage",
|
||||
"isSupportedShellSessionHandoffPackage",
|
||||
"getLauncherLinks",
|
||||
"getControlPageApiMethods",
|
||||
],
|
||||
@@ -745,6 +747,52 @@ export function createIniPanelShellSessionHandoffPackage({
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellSessionHandoffPackageSchema() {
|
||||
return {
|
||||
apiName: "ini-panel-shell-session-handoff-package",
|
||||
packageVersion: 1,
|
||||
fields: [
|
||||
"apiName",
|
||||
"packageVersion",
|
||||
"phase",
|
||||
"ready",
|
||||
"statusLine",
|
||||
"manifests",
|
||||
"snapshot",
|
||||
"renderState",
|
||||
"actionPlan",
|
||||
"checklist",
|
||||
],
|
||||
manifestFields: [
|
||||
"shellIntegration",
|
||||
"launchApi",
|
||||
"controlPageApi",
|
||||
"launchMethods",
|
||||
"controlPageMethods",
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export function isSupportedIniPanelShellSessionHandoffPackage(
|
||||
handoffPackage,
|
||||
schema = createIniPanelShellSessionHandoffPackageSchema(),
|
||||
) {
|
||||
if (!handoffPackage || typeof handoffPackage !== "object") {
|
||||
return false;
|
||||
}
|
||||
if (handoffPackage.apiName !== schema.apiName || handoffPackage.packageVersion !== schema.packageVersion) {
|
||||
return false;
|
||||
}
|
||||
if (!schema.fields.every((fieldName) => Object.hasOwn(handoffPackage, fieldName))) {
|
||||
return false;
|
||||
}
|
||||
const manifests = handoffPackage.manifests;
|
||||
if (!manifests || typeof manifests !== "object") {
|
||||
return false;
|
||||
}
|
||||
return schema.manifestFields.every((fieldName) => Object.hasOwn(manifests, fieldName));
|
||||
}
|
||||
|
||||
export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries()) {
|
||||
const shellIntegrationManifest = createIniPanelShellIntegrationManifest(entries);
|
||||
const shellIntegrationReadiness = createIniPanelShellIntegrationReadiness(shellIntegrationManifest);
|
||||
@@ -809,6 +857,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
shellSessionHandoffActionPlan,
|
||||
shellSessionHandoffChecklist,
|
||||
shellSessionHandoffPackage,
|
||||
shellSessionHandoffPackageSchema: createIniPanelShellSessionHandoffPackageSchema(),
|
||||
launchApiSchema: createIniPanelLaunchApiSchema(),
|
||||
launchApiManifest: createIniPanelLaunchApiManifest(entries),
|
||||
isSupportedShellIntegrationManifest: isSupportedIniPanelShellIntegrationManifest,
|
||||
@@ -824,6 +873,8 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
createShellSessionHandoffActionPlan: createIniPanelShellSessionHandoffActionPlan,
|
||||
createShellSessionHandoffChecklist: createIniPanelShellSessionHandoffChecklist,
|
||||
createShellSessionHandoffPackage: createIniPanelShellSessionHandoffPackage,
|
||||
createShellSessionHandoffPackageSchema: createIniPanelShellSessionHandoffPackageSchema,
|
||||
isSupportedShellSessionHandoffPackage: isSupportedIniPanelShellSessionHandoffPackage,
|
||||
controlPage: {
|
||||
browserApiSchema: createControlPageBrowserApiSchema(),
|
||||
browserApiManifest: createControlPageBrowserApiManifest(),
|
||||
|
||||
Reference in New Issue
Block a user