

























@@ -301,6 +301,18 @@ function createManifestRegistryFixture(): PluginManifestRegistry {
301301providers: [],
302302cliBackends: [],
303303},
304+{
305+id: "lossless-claw",
306+kind: "context-engine",
307+channels: [],
308+// No activation.onStartup — this is the bug scenario (#76576):
309+// external context-engine plugins do not set onStartup but must be
310+// included in gateway startup when selected via plugins.slots.contextEngine.
311+origin: "installed",
312+enabledByDefault: undefined,
313+providers: [],
314+cliBackends: [],
315+},
304316].map(withManifestLoadPaths) as PluginManifestRecord[],
305317diagnostics: [],
306318};
@@ -436,7 +448,13 @@ function createStartupConfig(params: {
436448allowPluginIds?: string[];
437449noConfiguredChannels?: boolean;
438450memorySlot?: string;
451+contextEngine?: string;
439452}) {
453+const slotsConfig = {
454+ ...(params.memorySlot ? { memory: params.memorySlot } : {}),
455+ ...(params.contextEngine ? { contextEngine: params.contextEngine } : {}),
456+};
457+const hasSlots = Object.keys(slotsConfig).length > 0;
440458return {
441459 ...(params.noConfiguredChannels
442460 ? {
@@ -453,7 +471,7 @@ function createStartupConfig(params: {
453471 ? {
454472plugins: {
455473 ...(params.allowPluginIds?.length ? { allow: params.allowPluginIds } : {}),
456- ...(params.memorySlot ? { slots: { memory: params.memorySlot } } : {}),
474+ ...(hasSlots ? { slots: slotsConfig } : {}),
457475entries: Object.fromEntries(
458476params.enabledPluginIds.map((pluginId) => [pluginId, { enabled: true }]),
459477),
@@ -465,12 +483,10 @@ function createStartupConfig(params: {
465483allow: params.allowPluginIds,
466484},
467485}
468- : params.memorySlot
486+ : hasSlots
469487 ? {
470488plugins: {
471-slots: {
472-memory: params.memorySlot,
473-},
489+slots: slotsConfig,
474490},
475491}
476492 : {}),
@@ -1095,6 +1111,44 @@ describe("resolveGatewayStartupPluginIds", () => {
10951111});
10961112});
109711131114+it("includes the selected context-engine slot plugin in startup scope even without activation.onStartup (#76576)", () => {
1115+expectStartupPluginIdsCase({
1116+config: createStartupConfig({
1117+enabledPluginIds: ["lossless-claw"],
1118+contextEngine: "lossless-claw",
1119+}),
1120+expected: ["demo-channel", "browser", "memory-core", "lossless-claw"],
1121+});
1122+});
1123+1124+it("does not include context-engine plugins not selected via the slot", () => {
1125+expectStartupPluginIdsCase({
1126+config: createStartupConfig({
1127+enabledPluginIds: ["lossless-claw"],
1128+}),
1129+expected: ["demo-channel", "browser", "memory-core"],
1130+});
1131+});
1132+1133+it("does not include the context-engine slot plugin when it is the built-in legacy engine", () => {
1134+expectStartupPluginIdsCase({
1135+config: createStartupConfig({
1136+contextEngine: "legacy",
1137+}),
1138+expected: ["demo-channel", "browser", "memory-core"],
1139+});
1140+});
1141+1142+it("normalizes the context-engine slot id before startup filtering", () => {
1143+expectStartupPluginIdsCase({
1144+config: createStartupConfig({
1145+enabledPluginIds: ["lossless-claw"],
1146+contextEngine: "Lossless-Claw",
1147+}),
1148+expected: ["demo-channel", "browser", "memory-core", "lossless-claw"],
1149+});
1150+});
1151+10981152it("includes required agent harness owner plugins when the default runtime is forced", () => {
10991153expectStartupPluginIdsCase({
11001154config: createStartupConfig({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。