opencode-deja 0.21.1 → 0.21.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/index.js +34 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# opencode-deja
|
|
2
2
|
|
|
3
|
+
English | [中文](https://github.com/vshulcz/deja-vu/blob/main/extensions/opencode/docs/zh.md)
|
|
4
|
+
|
|
3
5
|
opencode remembers its own sessions. This plugin answers the other question:
|
|
4
|
-
what you did in the thirty-
|
|
6
|
+
what you did in the thirty-four other coding agents on this machine — Claude Code,
|
|
5
7
|
Codex, Cursor, Gemini and Zed among them — including the months before you
|
|
6
8
|
installed anything.
|
|
7
9
|
|
|
@@ -45,6 +47,11 @@ And recall nobody has to ask for:
|
|
|
45
47
|
- the project's recent sessions are pushed onto the system prompt once per
|
|
46
48
|
session, with a one-time toast so you know memory arrived;
|
|
47
49
|
- each prompt gets a relevance pass of its own — silent when nothing matches;
|
|
50
|
+
- a spawned agent gets recall in its own instructions, since it never sees the
|
|
51
|
+
system prompt or a user prompt;
|
|
52
|
+
- after a tool call, a failed command gets the command this machine ran next
|
|
53
|
+
after the same error, and a file action gets that file's prior decision,
|
|
54
|
+
folded into the tool's output;
|
|
48
55
|
- before compaction the working transcript is indexed, so the session survives
|
|
49
56
|
the window collapsing.
|
|
50
57
|
|
|
@@ -56,7 +63,7 @@ And recall nobody has to ask for:
|
|
|
56
63
|
}
|
|
57
64
|
```
|
|
58
65
|
|
|
59
|
-
- `autoRecall` (default `true`) — the
|
|
66
|
+
- `autoRecall` (default `true`) — the hooks above. Turn off to keep only
|
|
60
67
|
the tools.
|
|
61
68
|
- `tools` (default `true`) — the six tools. They are skipped on their own when
|
|
62
69
|
`deja install` already wired the MCP server; set this to `false` to drop them
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// opencode-deja — the sessions you already have, inside opencode.
|
|
2
2
|
//
|
|
3
3
|
// opencode remembers its own sessions. This plugin answers the other question:
|
|
4
|
-
// what you did in Claude Code, Codex, Cursor, Gemini and thirty more agents on
|
|
4
|
+
// what you did in Claude Code, Codex, Cursor, Gemini and thirty-one more agents on
|
|
5
5
|
// this machine, including months before deja existed. The index is deja's; this
|
|
6
6
|
// file is the seam: six tools the model can call, plus recall that arrives
|
|
7
7
|
// without being asked for.
|
|
@@ -262,7 +262,12 @@ export const DejaPlugin = async ({ client, directory }, options = {}) => {
|
|
|
262
262
|
}
|
|
263
263
|
const context = digests.get(key)
|
|
264
264
|
if (context) {
|
|
265
|
-
|
|
265
|
+
// Fold into the first system entry, as the generated plugin does.
|
|
266
|
+
// opencode sends each entry as its own system message, and a backend
|
|
267
|
+
// whose template allows one (vLLM or SGLang serving Qwen) rejects the
|
|
268
|
+
// request: "System message must be at the beginning." (#4058)
|
|
269
|
+
if (output.system.length) output.system[0] = context + "\n\n" + output.system[0]
|
|
270
|
+
else output.system.push(context)
|
|
266
271
|
return
|
|
267
272
|
}
|
|
268
273
|
// Nothing recalled: this machine has no history yet, the first index is
|
|
@@ -347,6 +352,33 @@ export const DejaPlugin = async ({ client, directory }, options = {}) => {
|
|
|
347
352
|
// which the next request carries as the tool result.
|
|
348
353
|
hooks["tool.execute.after"] = async (input, output) => {
|
|
349
354
|
try {
|
|
355
|
+
// A file's history, at the read before the edit. opencode has no seam
|
|
356
|
+
// that can inject before a file action — tool.execute.before can only
|
|
357
|
+
// rewrite the arguments — so the line goes out the way the failure line
|
|
358
|
+
// does: appended to the tool's own output, which the next request
|
|
359
|
+
// carries as the tool result. Without this, what deja knows at the
|
|
360
|
+
// point of an action reached every harness except this one.
|
|
361
|
+
//
|
|
362
|
+
// Matched on the argument rather than the tool name: a tool carrying a
|
|
363
|
+
// file path is a file action whatever this version calls it, and a name
|
|
364
|
+
// deja does not recognise is answered with silence.
|
|
365
|
+
const fpath = input?.args?.filePath || input?.args?.path || ""
|
|
366
|
+
if (fpath && input?.tool !== "bash") {
|
|
367
|
+
const ftext = output?.output
|
|
368
|
+
if (!ftext) return
|
|
369
|
+
const fpayload = {
|
|
370
|
+
hook_event_name: "PostToolUse",
|
|
371
|
+
tool_name: input?.tool || "read",
|
|
372
|
+
tool_input: { file_path: fpath },
|
|
373
|
+
session_id: input.sessionID || "",
|
|
374
|
+
cwd,
|
|
375
|
+
}
|
|
376
|
+
const fraw = await ask(["hook-tool"], JSON.stringify(fpayload))
|
|
377
|
+
if (!fraw) return
|
|
378
|
+
const fextra = JSON.parse(fraw)?.hookSpecificOutput?.additionalContext
|
|
379
|
+
if (fextra) output.output = ftext + "\n\n" + fextra
|
|
380
|
+
return
|
|
381
|
+
}
|
|
350
382
|
if (input?.tool !== "bash") return
|
|
351
383
|
const text = output?.output
|
|
352
384
|
if (!text) return
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-deja",
|
|
3
|
-
"version": "0.21.
|
|
4
|
-
"description": "deja-vu memory for opencode: the session history of thirty-
|
|
3
|
+
"version": "0.21.3",
|
|
4
|
+
"description": "deja-vu memory for opencode: the session history of thirty-four other coding agents, searchable and recalled on every request — a local index, no LLM.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"exports": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@opencode-ai/plugin": ">=1.0.0",
|
|
53
|
-
"@vshulcz/deja-vu": "^0.21.
|
|
53
|
+
"@vshulcz/deja-vu": "^0.21.3"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"test": "node --test test/*.test.js"
|