diff --git a/src/gateway/server-methods/commands.test.ts b/src/gateway/server-methods/commands.test.ts index ddca9c4e870..3abe62bdf91 100644 --- a/src/gateway/server-methods/commands.test.ts +++ b/src/gateway/server-methods/commands.test.ts @@ -378,29 +378,30 @@ describe("commands.list handler", () => { const longToken = "x".repeat(COMMAND_NAME_MAX_LENGTH + 50); const aliasBase = "alias".repeat(20); const longDescription = "d".repeat(COMMAND_DESCRIPTION_MAX_LENGTH + 50); + const oversizedArgs = Array.from({ length: COMMAND_ARGS_MAX_ITEMS + 5 }, (_, argIndex) => ({ + name: `${longToken}-${argIndex}`, + description: longDescription, + type: "string" as const, + choices: Array.from({ length: COMMAND_ARG_CHOICES_MAX_ITEMS + 5 }, (_, choiceIndex) => ({ + value: `${longToken}-${choiceIndex}`, + label: `${longToken}-${choiceIndex}`, + })), + })); try { mockChatCommands.length = 0; for (let index = 0; index < COMMAND_LIST_MAX_ITEMS + 25; index += 1) { + const isFirst = index === 0; mockChatCommands.push({ - key: `cmd-${index}`, - description: longDescription, - textAliases: Array.from( - { length: COMMAND_ALIAS_MAX_ITEMS + 5 }, - (_, aliasIndex) => `/${aliasBase}-${index}-${aliasIndex}`, - ), - acceptsArgs: true, - args: Array.from({ length: COMMAND_ARGS_MAX_ITEMS + 5 }, (_, argIndex) => ({ - name: `${longToken}-${argIndex}`, - description: longDescription, - type: "string", - choices: Array.from( - { length: COMMAND_ARG_CHOICES_MAX_ITEMS + 5 }, - (_, choiceIndex) => ({ - value: `${longToken}-${choiceIndex}`, - label: `${longToken}-${choiceIndex}`, - }), - ), - })), + key: isFirst ? longToken : `cmd-${index}`, + description: isFirst ? longDescription : "short", + textAliases: isFirst + ? Array.from( + { length: COMMAND_ALIAS_MAX_ITEMS + 5 }, + (_, aliasIndex) => `/${aliasBase}-${index}-${aliasIndex}`, + ) + : [`/cmd-${index}`], + acceptsArgs: isFirst, + args: isFirst ? oversizedArgs : undefined, scope: "both", category: "tools", }); diff --git a/src/gateway/server-methods/server-methods.test.ts b/src/gateway/server-methods/server-methods.test.ts index 46bd9aad86b..aa3323cee83 100644 --- a/src/gateway/server-methods/server-methods.test.ts +++ b/src/gateway/server-methods/server-methods.test.ts @@ -1005,6 +1005,7 @@ describe("exec approval handlers", () => { respond, context, params: { + timeoutMs: 10, host: "gateway", nodeId: undefined, systemRunPlan: undefined, diff --git a/src/plugin-sdk/facade-runtime.test.ts b/src/plugin-sdk/facade-runtime.test.ts index e85003e4546..613ab6d4ad3 100644 --- a/src/plugin-sdk/facade-runtime.test.ts +++ b/src/plugin-sdk/facade-runtime.test.ts @@ -6,12 +6,13 @@ import { createPluginActivationSource, normalizePluginsConfig } from "../plugins import { clearPluginDiscoveryCache } from "../plugins/discovery.js"; import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js"; import { + evaluateBundledPluginPublicSurfaceAccess, resetFacadeActivationCheckRuntimeStateForTest, resolveBundledPluginPublicSurfaceAccess as resolveActivationCheckBundledPluginPublicSurfaceAccess, + throwForBundledPluginPublicSurfaceAccess, } from "./facade-activation-check.runtime.js"; import { __testing, - canLoadActivatedBundledPluginPublicSurface, listImportedBundledPluginFacadeIds, loadBundledPluginPublicSurfaceModuleSync, resetFacadeRuntimeStateForTest, @@ -185,7 +186,7 @@ describe("plugin-sdk facade runtime", () => { }); it("blocks runtime-api facade loads for bundled plugins that are not activated", () => { - const access = __testing.evaluateBundledPluginPublicSurfaceAccess({ + const access = evaluateBundledPluginPublicSurfaceAccess({ params: { dirName: "discord", artifactBasename: "runtime-api.js", @@ -207,7 +208,7 @@ describe("plugin-sdk facade runtime", () => { expect(access.pluginId).toBe("discord"); expect(access.reason).toBeTruthy(); expect(() => - __testing.throwForBundledPluginPublicSurfaceAccess({ + throwForBundledPluginPublicSurfaceAccess({ access, request: { dirName: "discord", @@ -235,7 +236,7 @@ describe("plugin-sdk facade runtime", () => { }, }, } as const; - const access = __testing.evaluateBundledPluginPublicSurfaceAccess({ + const access = evaluateBundledPluginPublicSurfaceAccess({ params: { dirName: "discord", artifactBasename: "runtime-api.js", @@ -367,24 +368,20 @@ describe("plugin-sdk facade runtime", () => { it("keeps shared runtime-core facades available without plugin activation", () => { setRuntimeConfigSnapshot({}); - expect( - canLoadActivatedBundledPluginPublicSurface({ - dirName: "speech-core", - artifactBasename: "runtime-api.js", - }), - ).toBe(true); - expect( - canLoadActivatedBundledPluginPublicSurface({ - dirName: "image-generation-core", - artifactBasename: "runtime-api.js", - }), - ).toBe(true); - expect( - canLoadActivatedBundledPluginPublicSurface({ - dirName: "media-understanding-core", - artifactBasename: "runtime-api.js", - }), - ).toBe(true); + for (const dirName of ["speech-core", "image-generation-core", "media-understanding-core"]) { + expect( + resolveActivationCheckBundledPluginPublicSurfaceAccess({ + dirName, + artifactBasename: "runtime-api.js", + location: null, + sourceExtensionsRoot: "", + resolutionKey: `runtime-core:${dirName}`, + }), + ).toEqual({ + allowed: true, + pluginId: dirName, + }); + } }); it("prefers the source runtime snapshot for facade activation checks", () => {