feat(sdk,plugins): typage et stabilisation runtime UI/layout publique (#128)
This commit is contained in:
@ -196,9 +196,27 @@ describe("loadPlugins", () => {
|
||||
it("injects the public plugin services facade for plugins declaring tooling", async () => {
|
||||
const bundle = dataUrl(`
|
||||
export function activate(ctx) {
|
||||
globalThis.__activationContextKeys = Object.keys(ctx).sort();
|
||||
globalThis.__hasPrivateGateway = [
|
||||
"project",
|
||||
"git",
|
||||
"terminal",
|
||||
"agents",
|
||||
"system",
|
||||
"workState",
|
||||
"focusedProject",
|
||||
"pluginWorkspace",
|
||||
"pluginTask",
|
||||
"pluginToolchain",
|
||||
"pluginEvents",
|
||||
"pluginConfig",
|
||||
].some((key) => key in ctx);
|
||||
globalThis.__serviceKeys = Object.keys(ctx.services).sort();
|
||||
globalThis.__workspaceServiceKeys = Object.keys(ctx.services.workspace).sort();
|
||||
globalThis.__taskServiceKeys = Object.keys(ctx.services.tasks).sort();
|
||||
globalThis.__toolingServiceKeys = Object.keys(ctx.services.tooling).sort();
|
||||
globalThis.__eventServiceKeys = Object.keys(ctx.services.events).sort();
|
||||
globalThis.__configServiceKeys = Object.keys(ctx.services.config).sort();
|
||||
globalThis.__terminalServiceKeys = Object.keys(ctx.services.terminal).sort();
|
||||
}
|
||||
`);
|
||||
@ -215,23 +233,59 @@ describe("loadPlugins", () => {
|
||||
);
|
||||
|
||||
expect(failures).toEqual([]);
|
||||
expect((globalThis as Record<string, unknown>).__activationContextKeys).toEqual([
|
||||
"commands",
|
||||
"layouts",
|
||||
"logger",
|
||||
"menu",
|
||||
"pluginDisplayName",
|
||||
"pluginId",
|
||||
"services",
|
||||
"subscriptions",
|
||||
"version",
|
||||
]);
|
||||
expect((globalThis as Record<string, unknown>).__hasPrivateGateway).toBe(false);
|
||||
expect((globalThis as Record<string, unknown>).__serviceKeys).toEqual([
|
||||
"config",
|
||||
"events",
|
||||
"tasks",
|
||||
"terminal",
|
||||
"tooling",
|
||||
"workspace",
|
||||
]);
|
||||
expect((globalThis as Record<string, unknown>).__workspaceServiceKeys).toEqual([
|
||||
"getCurrentProject",
|
||||
"getProjectRoot",
|
||||
"listDirectory",
|
||||
"queryStructure",
|
||||
"readBinaryFile",
|
||||
"readProjectContext",
|
||||
"readTextFile",
|
||||
"resolvePath",
|
||||
"stat",
|
||||
"updateProjectContext",
|
||||
"watch",
|
||||
"writeBinaryFile",
|
||||
"writeTextFile",
|
||||
]);
|
||||
expect((globalThis as Record<string, unknown>).__taskServiceKeys).toEqual([
|
||||
"attachOutput",
|
||||
"cancel",
|
||||
"getCommandStatus",
|
||||
"getStatus",
|
||||
"list",
|
||||
"retry",
|
||||
"runCommand",
|
||||
]);
|
||||
expect((globalThis as Record<string, unknown>).__toolingServiceKeys).toEqual([
|
||||
"diagnose",
|
||||
]);
|
||||
expect((globalThis as Record<string, unknown>).__eventServiceKeys).toEqual([
|
||||
"subscribe",
|
||||
]);
|
||||
expect((globalThis as Record<string, unknown>).__configServiceKeys).toEqual([
|
||||
"readDocument",
|
||||
"updateDocument",
|
||||
]);
|
||||
expect((globalThis as Record<string, unknown>).__terminalServiceKeys).toEqual([
|
||||
"close",
|
||||
|
||||
Reference in New Issue
Block a user