fix: preserve gateway-bindable loader compatibility

This commit is contained in:
Peter Steinberger
2026-04-06 15:25:22 +01:00
parent c78defdc2f
commit fa67ab2358
3 changed files with 97 additions and 35 deletions

View File

@@ -18,6 +18,7 @@ import {
} from "./memory-state.js";
import { createEmptyPluginRegistry } from "./registry.js";
import { setActivePluginRegistry } from "./runtime.js";
import type { CreatePluginRuntimeOptions } from "./runtime/index.js";
afterEach(() => {
resetPluginLoaderTestStateForTest();
@@ -39,7 +40,7 @@ describe("getCompatibleActivePluginRegistry", () => {
},
};
const { cacheKey } = __testing.resolvePluginLoadCacheContext(loadOptions);
setActivePluginRegistry(registry, cacheKey);
setActivePluginRegistry(registry, cacheKey, "gateway-bindable");
expect(__testing.getCompatibleActivePluginRegistry(loadOptions)).toBe(registry);
expect(
@@ -59,6 +60,38 @@ describe("getCompatibleActivePluginRegistry", () => {
...loadOptions,
runtimeOptions: undefined,
}),
).toBe(registry);
expect(
__testing.getCompatibleActivePluginRegistry({
...loadOptions,
runtimeOptions: {
subagent: {} as CreatePluginRuntimeOptions["subagent"],
},
}),
).toBeUndefined();
});
it("does not treat a default-mode active registry as compatible with gateway binding", () => {
const registry = createEmptyPluginRegistry();
const loadOptions = {
config: {
plugins: {
allow: ["demo"],
load: { paths: ["/tmp/demo.js"] },
},
},
workspaceDir: "/tmp/workspace-a",
};
const { cacheKey } = __testing.resolvePluginLoadCacheContext(loadOptions);
setActivePluginRegistry(registry, cacheKey, "default");
expect(
__testing.getCompatibleActivePluginRegistry({
...loadOptions,
runtimeOptions: {
allowGatewaySubagentBinding: true,
},
}),
).toBeUndefined();
});