mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-10-13 04:01:35 +00:00
fix(dsh): recognize legacy ReMe guidance on resumed sessions
This commit is contained in:
parent
5887b4a07d
commit
28f53a387e
2 changed files with 28 additions and 1 deletions
|
|
@ -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"
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue