diff --git a/integrations/dsh/src/guidance.ts b/integrations/dsh/src/guidance.ts index e293eaf0..bfbce74f 100644 --- a/integrations/dsh/src/guidance.ts +++ b/integrations/dsh/src/guidance.ts @@ -46,7 +46,8 @@ function isGuidance(value: unknown): boolean { const source = isRecord(value) ? value.source : undefined; return ( isRecord(source) && - source.kind === REME_PLUGIN_SOURCE && + (source.kind === REME_PLUGIN_SOURCE || + (source.kind === "plugin" && source.plugin === REME_PLUGIN_SOURCE)) && source.form === "instructions" ); } diff --git a/integrations/dsh/tests/dsh-index.test.mjs b/integrations/dsh/tests/dsh-index.test.mjs index 114b4c11..7a346710 100644 --- a/integrations/dsh/tests/dsh-index.test.mjs +++ b/integrations/dsh/tests/dsh-index.test.mjs @@ -1,6 +1,32 @@ import assert from "node:assert/strict"; import test from "node:test"; import { apply, Config } from "../dist/index.js"; +import { hasGuidance } from "../dist/guidance.js"; + +test("recognizes guidance already stored by the previous DSH plugin", () => { + const legacy = { + role: "user", + source: { kind: "plugin", plugin: "reme-memory", form: "instructions" }, + }; + assert.equal( + hasGuidance({ events: [{ type: "user/message", data: legacy }] }), + true, + ); + assert.equal(hasGuidance({ events: [] }, [legacy]), true); + assert.equal( + hasGuidance({ + events: [ + { + type: "user/message", + data: { + source: { kind: "plugin", plugin: "other", form: "instructions" }, + }, + }, + ], + }), + false, + ); +}); test("composes root-agent guidance and reme_search on supported DSH releases", async () => { const handlers = new Map();