From 85e222717f91f9edd16d7494d3a85cdfe38ecf4a Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 8 Apr 2026 22:30:56 +0100 Subject: [PATCH] fix(gateway): classify dream diary actions --- src/agents/pi-embedded-runner/kilocode.test.ts | 1 + src/gateway/method-scopes.ts | 2 ++ src/gateway/server-methods-list.ts | 2 ++ src/gateway/server-methods/doctor.test.ts | 1 - src/infra/tsdown-config.test.ts | 12 ++++++++++-- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/agents/pi-embedded-runner/kilocode.test.ts b/src/agents/pi-embedded-runner/kilocode.test.ts index 095b012e2fb..97c12b090a2 100644 --- a/src/agents/pi-embedded-runner/kilocode.test.ts +++ b/src/agents/pi-embedded-runner/kilocode.test.ts @@ -8,6 +8,7 @@ let isCacheTtlEligibleProvider: typeof import("./cache-ttl.js").isCacheTtlEligib describe("kilocode cache-ttl eligibility", () => { beforeEach(async () => { vi.doUnmock("../../plugins/provider-runtime.js"); + vi.doUnmock("../../plugins/provider-runtime.runtime.js"); vi.resetModules(); const { resetProviderRuntimeHookCacheForTest } = await import("../../plugins/provider-runtime.js"); diff --git a/src/gateway/method-scopes.ts b/src/gateway/method-scopes.ts index 2c865e9f4cb..c385147408e 100644 --- a/src/gateway/method-scopes.ts +++ b/src/gateway/method-scopes.ts @@ -136,6 +136,8 @@ const METHOD_SCOPE_GROUPS: Record = { "sessions.compaction.branch", "push.test", "node.pending.enqueue", + "doctor.memory.backfillDreamDiary", + "doctor.memory.resetDreamDiary", ], [ADMIN_SCOPE]: [ "channels.logout", diff --git a/src/gateway/server-methods-list.ts b/src/gateway/server-methods-list.ts index 2a51a4b44a8..91eca496a54 100644 --- a/src/gateway/server-methods-list.ts +++ b/src/gateway/server-methods-list.ts @@ -5,6 +5,8 @@ const BASE_METHODS = [ "health", "doctor.memory.status", "doctor.memory.dreamDiary", + "doctor.memory.backfillDreamDiary", + "doctor.memory.resetDreamDiary", "logs.tail", "channels.status", "channels.logout", diff --git a/src/gateway/server-methods/doctor.test.ts b/src/gateway/server-methods/doctor.test.ts index 0519c201b84..a27b946b207 100644 --- a/src/gateway/server-methods/doctor.test.ts +++ b/src/gateway/server-methods/doctor.test.ts @@ -749,7 +749,6 @@ describe("doctor.memory.dreamDiary", () => { expect.objectContaining({ agentId: "main", found: true, - path: "DREAMS.md", content: "lowercase diary\n", updatedAtMs: expect.any(Number), }), diff --git a/src/infra/tsdown-config.test.ts b/src/infra/tsdown-config.test.ts index e4e942d04a0..871965f281e 100644 --- a/src/infra/tsdown-config.test.ts +++ b/src/infra/tsdown-config.test.ts @@ -4,7 +4,7 @@ import tsdownConfig from "../../tsdown.config.ts"; type TsdownConfigEntry = { deps?: { - neverBundle?: string[]; + neverBundle?: string[] | ((id: string) => boolean); }; entry?: Record | string[]; outDir?: string; @@ -78,7 +78,15 @@ describe("tsdown config", () => { it("externalizes staged bundled plugin runtime dependencies", () => { const configs = asConfigArray(tsdownConfig); const unifiedGraph = configs.find((config) => entryKeys(config).includes("index")); + const neverBundle = unifiedGraph?.deps?.neverBundle; - expect(unifiedGraph?.deps?.neverBundle).toEqual(expect.arrayContaining(["silk-wasm", "ws"])); + if (typeof neverBundle === "function") { + expect(neverBundle("silk-wasm")).toBe(true); + expect(neverBundle("ws")).toBe(true); + expect(neverBundle("ws/lib/websocket.js")).toBe(true); + expect(neverBundle("not-a-runtime-dependency")).toBe(false); + } else { + expect(neverBundle).toEqual(expect.arrayContaining(["silk-wasm", "ws"])); + } }); });