Per-turn recall currently enters through the `agent/pre-step` waterfall, and
that hook can only return `messages`. The recall block therefore lands in
conversation history as a user message: the model reads its own memory as if a
user had said it. `systemPrompt.context` cannot fix this — it runs before the
turn text is known, so it can only render input-independent text.
The loop's `preStep` is the first seam holding BOTH the assembled prompt and
this turn's claimed messages. `lib/loop.js` subclasses the harness AgentLoop and
wraps that seam on the agent instance: a pure snapshot carrier message is moved
out of `messages` and into `assembly.sections`, so it becomes part of the system
prompt for that turn and never enters history.
Deliberately decoupled from the memory plugin: nothing imports it or matches its
name. Promotion keys off the shape every snapshot-style injector already uses
(`source.sections`, the same shape `dsh-time-context` emits).
Constraints honoured, each of which was a measured failure elsewhere:
- The promoted section carries `interpolate: false`; recalled text is free text
and may contain `{{...}}`, which the strict interpolator rejects.
- The subclass defines no constructor and no static `inject`. The parent already
registers the turnBoundary + inbox projections, calls `setFactory(this)`, and
declares `{{provider}}`/`{{model}}`; re-registering any of them throws at
startup.
- Only the instance's `preStep` is patched, never the prototype, which other
agents share.
Also wires the new peer: `scripts/link-dsh.sh` gains dsh-agent/dsh-agent-loop
(without them the package cannot resolve at test time), package.json declares
dsh-agent-loop as a peer and adds the new test file, and G2b's allowlist admits
dsh-agent-loop as a first-party harness package, with the reason recorded.
npm test: 247 pass, 0 fail.
42 lines
1.1 KiB
JSON
42 lines
1.1 KiB
JSON
{
|
|
"name": "dsh-memory",
|
|
"version": "0.1.0",
|
|
"description": "HologramAgent-style block memory (stablemem) for dsh: sqlite + FTS5 recall, no embedding.",
|
|
"type": "module",
|
|
"main": "lib/index.js",
|
|
"exports": {
|
|
".": "./lib/index.js"
|
|
},
|
|
"files": [
|
|
"lib/*.js",
|
|
"lib/types/*.d.ts"
|
|
],
|
|
"engines": {
|
|
"node": ">=22.5.0"
|
|
},
|
|
"scripts": {
|
|
"test": "node --test test/store.test.js test/plugin.test.js test/loader.test.js test/phase-b-a.test.js test/phase-b-g.test.js test/phase-b-g-static.test.js test/phase-b-h.test.js test/memory-log.test.js test/loop.test.js",
|
|
"check": "node scripts/checkpoints.js"
|
|
},
|
|
"peerDependencies": {
|
|
"@deepseek-ai/cordis": "^4.0.5",
|
|
"@deepseek-ai/dsh-agent-loop": "0.2.1-rc.2",
|
|
"@deepseek-ai/dsh-llm": "0.2.1-rc.2",
|
|
"@deepseek-ai/dsh-system-prompt": "0.2.1-rc.2",
|
|
"@deepseek-ai/dsh-tools": "0.2.1-rc.2"
|
|
},
|
|
"peerDependenciesMeta": {
|
|
"@deepseek-ai/dsh-system-prompt": {
|
|
"optional": true
|
|
},
|
|
"@deepseek-ai/dsh-tools": {
|
|
"optional": true
|
|
},
|
|
"@deepseek-ai/dsh-llm": {
|
|
"optional": true
|
|
}
|
|
},
|
|
"license": "MIT",
|
|
"private": true
|
|
}
|