推进 INI 面板 shell integration readiness helper

This commit is contained in:
2026-06-15 07:48:47 +08:00
parent 7b17603601
commit 1f9a8c33b0
9 changed files with 283 additions and 2 deletions

View File

@@ -72,6 +72,7 @@
!launchApi?.getLaunchApiManifest ||
!launchApi?.getShellIntegrationSchema ||
!launchApi?.getShellIntegrationManifest ||
!launchApi?.getShellIntegrationReadiness ||
!launchApi?.getLauncherLinks ||
!launchApi?.getControlPageApiMethods
) {
@@ -111,11 +112,12 @@
);
assertEqual(
launchApiManifest.methods.join(","),
"isSupportedLaunchApiManifest,getLaunchApiSchema,getLaunchApiManifest,getShellIntegrationSchema,getShellIntegrationManifest,getLauncherLinks,getControlPageApiMethods",
"isSupportedLaunchApiManifest,getLaunchApiSchema,getLaunchApiManifest,getShellIntegrationSchema,getShellIntegrationManifest,getShellIntegrationReadiness,getLauncherLinks,getControlPageApiMethods",
"launch API manifest methods",
);
const shellIntegrationSchema = launchApi.getShellIntegrationSchema();
const shellIntegrationManifest = launchApi.getShellIntegrationManifest();
const shellIntegrationReadiness = launchApi.getShellIntegrationReadiness();
assertEqual(
shellIntegrationSchema.manifestVersion,
1,
@@ -141,6 +143,21 @@
"ini-panel-control-page",
"shell integration control-page manifest name",
);
assertEqual(
shellIntegrationReadiness.ready,
true,
"shell integration readiness",
);
assertEqual(
shellIntegrationReadiness.counts.persistenceCapabilities,
3,
"shell integration readiness capability count",
);
assertEqual(
shellIntegrationReadiness.missing.join(","),
"",
"shell integration readiness missing checks",
);
assertEqual(
JSON.stringify(shellIntegrationManifest),
JSON.stringify(createIniPanelShellIntegrationManifest()),

View File

@@ -15,6 +15,7 @@ import {
createIniPanelLauncherLinkViewModel,
createIniPanelShellControlPageContract,
createIniPanelShellIntegrationManifest,
createIniPanelShellIntegrationReadiness,
createIniPanelShellIntegrationSchema,
createIniPanelShellViewModel,
createMachineSessionReadonlyStatus,
@@ -55,6 +56,7 @@ const requiredShellExports = [
"createIniPanelLauncherLinkViewModel",
"createIniPanelShellControlPageContract",
"createIniPanelShellIntegrationManifest",
"createIniPanelShellIntegrationReadiness",
"createIniPanelShellIntegrationSchema",
"createIniPanelShellViewModel",
"getIniPanelEntryByHref",
@@ -122,6 +124,10 @@ assert.deepEqual(
createIniPanelShellViewModel().shellIntegrationManifest,
createIniPanelShellIntegrationManifest(),
);
assert.deepEqual(
createIniPanelShellViewModel().shellIntegrationReadiness,
createIniPanelShellIntegrationReadiness(createIniPanelShellViewModel().shellIntegrationManifest),
);
assert.equal(isSupportedIniPanelShellIntegrationManifest(createIniPanelShellViewModel().shellIntegrationManifest), true);
assert.deepEqual(createIniPanelShellViewModel().launchApiSchema, createIniPanelLaunchApiSchema());
assert.deepEqual(createIniPanelShellViewModel().launchApiManifest, createIniPanelLaunchApiManifest());
@@ -174,6 +180,7 @@ assert.match(shellText, /\bexport function createIniPanelLaunchApiSchema\b/);
assert.match(shellText, /\bexport function createIniPanelLaunchApiManifest\b/);
assert.match(shellText, /\bexport function createIniPanelShellIntegrationSchema\b/);
assert.match(shellText, /\bexport function createIniPanelShellIntegrationManifest\b/);
assert.match(shellText, /\bexport function createIniPanelShellIntegrationReadiness\b/);
assert.match(shellText, /\bexport function isSupportedIniPanelControlPageApiManifest\b/);
assert.match(shellText, /\bexport function isSupportedIniPanelLaunchApiManifest\b/);
assert.match(shellText, /\bexport function isSupportedIniPanelShellIntegrationManifest\b/);
@@ -187,6 +194,7 @@ assert.match(launchText, /\bgetLaunchApiSchema\b/);
assert.match(launchText, /\bgetLaunchApiManifest\b/);
assert.match(launchText, /\bgetShellIntegrationSchema\b/);
assert.match(launchText, /\bgetShellIntegrationManifest\b/);
assert.match(launchText, /\bgetShellIntegrationReadiness\b/);
assert.match(launchText, /\bgetControlPageApiMethods\b/);
assert.match(controlPageText, /\bgetControlPageContract\b/);
assert.match(controlPageText, /\breadControlPageStatus\b/);
@@ -202,6 +210,7 @@ assert.match(docText, /\bcreateControlPageBrowserApiSchema\b/);
assert.match(docText, /\bcreateIniPanelLaunchApiManifest\b/);
assert.match(docText, /\bcreateIniPanelLaunchApiSchema\b/);
assert.match(docText, /\bcreateIniPanelShellIntegrationManifest\b/);
assert.match(docText, /\bcreateIniPanelShellIntegrationReadiness\b/);
assert.match(docText, /\bcreateIniPanelShellIntegrationSchema\b/);
assert.match(docText, /\bisSupportedIniPanelControlPageApiManifest\b/);
assert.match(docText, /\bisSupportedIniPanelLaunchApiManifest\b/);
@@ -211,6 +220,7 @@ assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getLaunchApiSchema\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getLaunchApiManifest\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellIntegrationSchema\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellIntegrationManifest\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellIntegrationReadiness\b/);
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getControlPageApiMethods\b/);
assert.match(docText, /\bOPFS\/session persistence capabilities\b/);
assert.match(docText, /\bmachine files\b/);

View File

@@ -45,6 +45,7 @@ assert.deepEqual(manifest, {
"getLaunchApiManifest",
"getShellIntegrationSchema",
"getShellIntegrationManifest",
"getShellIntegrationReadiness",
"getLauncherLinks",
"getControlPageApiMethods",
],
@@ -144,6 +145,7 @@ assert.match(launchText, /\bgetLaunchApiSchema\b/);
assert.match(launchText, /\bgetLaunchApiManifest\b/);
assert.match(launchText, /\bgetShellIntegrationSchema\b/);
assert.match(launchText, /\bgetShellIntegrationManifest\b/);
assert.match(launchText, /\bgetShellIntegrationReadiness\b/);
assert.match(launchText, /\blinuxCncIniPanelLaunchApi\b/);
console.log("ini_panel_launch_api_manifest_node_smoke=ok");

View File

@@ -11,6 +11,7 @@ import {
createIniPanelLaunchApiSchema,
createIniPanelLauncherLinkViewModel,
createIniPanelShellIntegrationManifest,
createIniPanelShellIntegrationReadiness,
createIniPanelShellIntegrationSchema,
getVisibleIniPanelEntries,
isSupportedIniPanelShellIntegrationManifest,
@@ -24,6 +25,7 @@ const docText = readFileSync(resolve(root, "docs/panel-entry.md"), "utf8");
const schema = createIniPanelShellIntegrationSchema();
const manifest = createIniPanelShellIntegrationManifest();
const readiness = createIniPanelShellIntegrationReadiness(manifest);
assert.deepEqual(schema, {
apiName: "ini-panel-shell-integration",
@@ -65,6 +67,80 @@ const missingControlPageManifest = { ...manifest };
delete missingControlPageManifest.controlPageApiManifest;
assert.equal(isSupportedIniPanelShellIntegrationManifest(missingControlPageManifest), false);
assert.equal(isSupportedIniPanelShellIntegrationManifest(null), false);
assert.deepEqual(readiness, {
phase: "ready",
ready: true,
checks: {
integrationManifestSupported: true,
launchApiManifestSupported: true,
controlPageApiManifestSupported: true,
launchCompatibility: true,
controlPageCompatibility: true,
},
missing: [],
counts: {
pages: 2,
launcherLinks: 2,
launchMethods: 8,
controlPageMethods: 11,
persistenceCapabilities: 3,
},
apiNames: {
integration: "ini-panel-shell-integration",
launch: "ini-panel-launch",
controlPage: "ini-panel-control-page",
},
});
const blockedManifest = {
...createIniPanelShellIntegrationManifest(),
compatibility: {
launchApiManifest: false,
controlPageApiManifest: true,
},
};
assert.deepEqual(createIniPanelShellIntegrationReadiness(blockedManifest), {
phase: "blocked",
ready: false,
checks: {
integrationManifestSupported: true,
launchApiManifestSupported: true,
controlPageApiManifestSupported: true,
launchCompatibility: false,
controlPageCompatibility: true,
},
missing: ["launchCompatibility"],
counts: {
pages: 2,
launcherLinks: 2,
launchMethods: 8,
controlPageMethods: 11,
persistenceCapabilities: 3,
},
apiNames: {
integration: "ini-panel-shell-integration",
launch: "ini-panel-launch",
controlPage: "ini-panel-control-page",
},
});
const malformedReadiness = createIniPanelShellIntegrationReadiness({
apiName: "other",
});
assert.equal(malformedReadiness.phase, "blocked");
assert.equal(malformedReadiness.ready, false);
assert.deepEqual(malformedReadiness.missing, [
"integrationManifestSupported",
"launchApiManifestSupported",
"controlPageApiManifestSupported",
"launchCompatibility",
"controlPageCompatibility",
]);
assert.deepEqual(malformedReadiness.counts, {
pages: 0,
launcherLinks: 0,
launchMethods: 0,
controlPageMethods: 0,
persistenceCapabilities: 0,
});
manifest.pages[0].title = "changed";
manifest.launcherLinks[0].label = "changed";
@@ -117,10 +193,13 @@ assert.deepEqual(customManifest.launchApiManifest.targetPages, [
assert.match(shellText, /\bexport function createIniPanelShellIntegrationSchema\b/);
assert.match(shellText, /\bexport function createIniPanelShellIntegrationManifest\b/);
assert.match(shellText, /\bexport function createIniPanelShellIntegrationReadiness\b/);
assert.match(shellText, /\bexport function isSupportedIniPanelShellIntegrationManifest\b/);
assert.match(launchText, /\bgetShellIntegrationSchema\b/);
assert.match(launchText, /\bgetShellIntegrationManifest\b/);
assert.match(launchText, /\bgetShellIntegrationReadiness\b/);
assert.match(docText, /\bcreateIniPanelShellIntegrationManifest\b/);
assert.match(docText, /\bcreateIniPanelShellIntegrationReadiness\b/);
assert.match(docText, /\bisSupportedIniPanelShellIntegrationManifest\b/);
assert.doesNotMatch(shellText, /\bparseGcode\b|\bcanonicalEvents\b|\btoolTable\b|\bplanner\b/);

View File

@@ -11,6 +11,7 @@ import {
createIniPanelLauncherLinkViewModel,
createIniPanelShellControlPageContract,
createIniPanelShellIntegrationManifest,
createIniPanelShellIntegrationReadiness,
createIniPanelShellIntegrationSchema,
createIniPanelShellViewModel,
createMachineSessionReadonlyStatus,
@@ -61,6 +62,7 @@ assert.equal(typeof createIniPanelLaunchApiManifest, "function");
assert.equal(typeof createIniPanelLaunchApiSchema, "function");
assert.equal(typeof createIniPanelShellControlPageContract, "function");
assert.equal(typeof createIniPanelShellIntegrationManifest, "function");
assert.equal(typeof createIniPanelShellIntegrationReadiness, "function");
assert.equal(typeof createIniPanelShellIntegrationSchema, "function");
assert.equal(typeof loadMachineSessionForControlPageWorkflow, "function");
assert.equal(typeof readMachineSessionReadonlyStatus, "function");
@@ -107,6 +109,10 @@ assert.deepEqual(shellViewModel.pages, [
assert.deepEqual(shellViewModel.launcherLinks, createIniPanelLauncherLinkViewModel());
assert.deepEqual(shellViewModel.shellIntegrationSchema, createIniPanelShellIntegrationSchema());
assert.deepEqual(shellViewModel.shellIntegrationManifest, createIniPanelShellIntegrationManifest());
assert.deepEqual(
shellViewModel.shellIntegrationReadiness,
createIniPanelShellIntegrationReadiness(shellViewModel.shellIntegrationManifest),
);
assert.equal(
isSupportedIniPanelShellIntegrationManifest(shellViewModel.shellIntegrationManifest),
true,
@@ -121,6 +127,8 @@ assert.deepEqual(shellViewModel.shellIntegrationManifest.compatibility, {
launchApiManifest: true,
controlPageApiManifest: true,
});
assert.equal(shellViewModel.shellIntegrationReadiness.ready, true);
assert.deepEqual(shellViewModel.shellIntegrationReadiness.missing, []);
assert.deepEqual(shellViewModel.launchApiSchema, createIniPanelLaunchApiSchema());
assert.deepEqual(shellViewModel.launchApiManifest, createIniPanelLaunchApiManifest());
assert.equal(isSupportedIniPanelLaunchApiManifest(shellViewModel.launchApiManifest), true);
@@ -135,6 +143,7 @@ assert.equal(
);
assert.equal(shellViewModel.controlPage.createController, createMachineSessionControlPageController);
assert.equal(shellViewModel.isSupportedShellIntegrationManifest, isSupportedIniPanelShellIntegrationManifest);
assert.equal(shellViewModel.createShellIntegrationReadiness, createIniPanelShellIntegrationReadiness);
assert.deepEqual(shellViewModel.controlPage.contract, createIniPanelShellControlPageContract());
assert.equal(shellViewModel.controlPage.isSupportedBrowserApiManifest, isSupportedIniPanelControlPageApiManifest);
assert.equal(shellViewModel.controlPage.loadSessionState, loadMachineSessionForControlPageWorkflow);