From 28f53a387ebd4e438f0bc07c728f4a6efce24df6 Mon Sep 17 00:00:00 2001 From: "jinli.yl" Date: Wed, 30 Sep 2026 12:49:38 +0800 Subject: [PATCH] fix(dsh): recognize legacy ReMe guidance on resumed sessions --- integrations/dsh/src/guidance.ts | 3 ++- integrations/dsh/tests/dsh-index.test.mjs | 26 +++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) 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();