

























@@ -165,7 +165,7 @@ describe("getCompatibleActivePluginRegistry", () => {
165165).toBeUndefined();
166166});
167167168-it("reuses a scoped gateway-bindable registry for an unscoped default-mode request", () => {
168+it("reuses a scoped gateway-bindable registry for a matching default-mode tool scope", () => {
169169const registry = createEmptyPluginRegistry();
170170registry.plugins.push(
171171{ id: "acpx" } as (typeof registry.plugins)[number],
@@ -190,11 +190,12 @@ describe("getCompatibleActivePluginRegistry", () => {
190190__testing.getCompatibleActivePluginRegistry({
191191config: startupOptions.config,
192192workspaceDir: "/tmp/workspace-a",
193+onlyPluginIds: ["acpx", "telegram"],
193194}),
194195).toBe(registry);
195196});
196197197-it("reuses a scoped gateway-bindable registry for an unscoped snapshot-mode request", () => {
198+it("reuses a scoped gateway-bindable registry for a matching snapshot-mode tool scope", () => {
198199const registry = createEmptyPluginRegistry();
199200registry.plugins.push(
200201{ id: "acpx" } as (typeof registry.plugins)[number],
@@ -219,18 +220,52 @@ describe("getCompatibleActivePluginRegistry", () => {
219220__testing.getCompatibleActivePluginRegistry({
220221config: startupOptions.config,
221222workspaceDir: "/tmp/workspace-a",
223+onlyPluginIds: ["acpx", "telegram"],
222224activate: false,
223225}),
224226).toBe(registry);
225227});
226228227-it("does not reuse a scoped registry when plugin IDs differ", () => {
229+it("does not reuse a scoped registry when the requested tool scope needs another plugin", () => {
228230const registry = createEmptyPluginRegistry();
229-registry.plugins.push({ id: "acpx" } as (typeof registry.plugins)[number]);
231+registry.plugins.push(
232+{ id: "acpx" } as (typeof registry.plugins)[number],
233+{ id: "telegram" } as (typeof registry.plugins)[number],
234+);
230235const startupOptions = {
231236config: {
232237plugins: {
233-allow: ["acpx", "telegram"],
238+allow: ["acpx", "telegram", "tavily"],
239+},
240+},
241+workspaceDir: "/tmp/workspace-a",
242+onlyPluginIds: ["acpx", "telegram"],
243+runtimeOptions: {
244+allowGatewaySubagentBinding: true,
245+},
246+};
247+const { cacheKey } = __testing.resolvePluginLoadCacheContext(startupOptions);
248+setActivePluginRegistry(registry, cacheKey, "gateway-bindable");
249+250+expect(
251+__testing.getCompatibleActivePluginRegistry({
252+config: startupOptions.config,
253+workspaceDir: "/tmp/workspace-a",
254+onlyPluginIds: ["acpx", "telegram", "tavily"],
255+}),
256+).toBeUndefined();
257+});
258+259+it("does not treat an unscoped request as compatible with the scoped startup registry", () => {
260+const registry = createEmptyPluginRegistry();
261+registry.plugins.push(
262+{ id: "acpx" } as (typeof registry.plugins)[number],
263+{ id: "telegram" } as (typeof registry.plugins)[number],
264+);
265+const startupOptions = {
266+config: {
267+plugins: {
268+allow: ["acpx", "telegram", "tavily"],
234269},
235270},
236271workspaceDir: "/tmp/workspace-a",
@@ -309,6 +344,7 @@ describe("getCompatibleActivePluginRegistry", () => {
309344__testing.getCompatibleActivePluginRegistry({
310345config: startupOptions.config,
311346workspaceDir: "/tmp/workspace-a",
347+onlyPluginIds: ["acpx", "telegram"],
312348}),
313349).toBe(registry);
314350});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。