opencode-deja 0.23.0 → 0.23.1
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 +1 -1
- package/index.js +12 -4
- package/lib.js +29 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
English | [中文](https://github.com/vshulcz/deja-vu/blob/main/extensions/opencode/docs/zh.md)
|
|
4
4
|
|
|
5
5
|
opencode remembers its own sessions. This plugin answers the other question:
|
|
6
|
-
what you did in the forty-
|
|
6
|
+
what you did in the forty-two other coding agents on this machine — Claude Code,
|
|
7
7
|
Codex, Cursor, Gemini and Zed among them — including the months before you
|
|
8
8
|
installed anything.
|
|
9
9
|
|
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-
|
|
4
|
+
// what you did in Claude Code, Codex, Cursor, Gemini and thirty-nine 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.
|
|
@@ -18,12 +18,13 @@ import { accessSync, constants, existsSync, readFileSync } from "node:fs"
|
|
|
18
18
|
|
|
19
19
|
import {
|
|
20
20
|
argv,
|
|
21
|
-
clampLimit,
|
|
22
21
|
cliPluginPath,
|
|
23
22
|
configPaths,
|
|
24
23
|
contextText,
|
|
25
24
|
contributions,
|
|
26
25
|
mcpWired,
|
|
26
|
+
recallArgv,
|
|
27
|
+
recallSilence,
|
|
27
28
|
TOOL_SPECS,
|
|
28
29
|
userTurns,
|
|
29
30
|
zodTools,
|
|
@@ -218,10 +219,17 @@ export const DejaPlugin = async ({ client, directory }, options = {}) => {
|
|
|
218
219
|
args: {
|
|
219
220
|
query: { type: "string", description: "Specific tokens to match. Several words are ANDed." },
|
|
220
221
|
limit: { type: "number", optional: true, description: "How many sessions to return. Default 5." },
|
|
222
|
+
offset: {
|
|
223
|
+
type: "number",
|
|
224
|
+
optional: true,
|
|
225
|
+
description: "Sessions to skip, from the offset the previous page named. Default 0.",
|
|
226
|
+
},
|
|
221
227
|
},
|
|
222
228
|
async execute(args) {
|
|
223
|
-
|
|
224
|
-
|
|
229
|
+
// The page the MCP recall tool serves, framed and budgeted by deja.
|
|
230
|
+
const call = recallArgv(args)
|
|
231
|
+
const out = await ask(call)
|
|
232
|
+
return answer(out || (installed ? recallSilence(call) : ""))
|
|
225
233
|
},
|
|
226
234
|
},
|
|
227
235
|
deja_session: {
|
package/lib.js
CHANGED
|
@@ -143,6 +143,35 @@ export function argv(cmd, flags, text) {
|
|
|
143
143
|
return arg.startsWith("-") ? [cmd, ...flags, "--", arg] : [cmd, ...flags, arg]
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
// recallArgv is the call behind the deja_recall tool: `deja recall`, the page
|
|
147
|
+
// the MCP recall tool serves, framed and held to its 4 KB budget by deja
|
|
148
|
+
// itself. The tool used to run `search --json`, which carries every hit's
|
|
149
|
+
// matched messages whole and handed a model 661,528 characters for five hits
|
|
150
|
+
// (#5568). The page ends with "call recall again with offset=N"; offset is
|
|
151
|
+
// how the tool asks for that, and it is sent only past the first page, so a
|
|
152
|
+
// deja too old to know --offset still answers the first one.
|
|
153
|
+
export function recallArgv(args) {
|
|
154
|
+
const count = (v, fallback) => {
|
|
155
|
+
const n = Math.trunc(Number(v))
|
|
156
|
+
return v == null || v === "" || !Number.isFinite(n) ? fallback : n
|
|
157
|
+
}
|
|
158
|
+
const limit = clampLimit(count(args && args.limit, 5))
|
|
159
|
+
const offset = Math.min(1e9, Math.max(0, count(args && args.offset, 0)))
|
|
160
|
+
const flags = ["--limit", String(limit)]
|
|
161
|
+
if (offset > 0) flags.push("--offset", String(offset))
|
|
162
|
+
return argv("recall", flags, args && args.query)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// recallSilence is the answer when `deja recall` printed nothing. Past the
|
|
166
|
+
// first page that is a deja older than --offset refusing the flag, not an
|
|
167
|
+
// empty history: recall always prints a line, "No more matches" included.
|
|
168
|
+
export function recallSilence(call) {
|
|
169
|
+
if (call.includes("--offset")) {
|
|
170
|
+
return "This deja cannot page recall. Run deja update, then ask again with the same offset."
|
|
171
|
+
}
|
|
172
|
+
return "Nothing in this machine's history matches that."
|
|
173
|
+
}
|
|
174
|
+
|
|
146
175
|
// clampLimit keeps a model that asks for a hundred sessions from spending the
|
|
147
176
|
// window on a tail nobody reads.
|
|
148
177
|
export function clampLimit(value, fallback = 5) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-deja",
|
|
3
|
-
"version": "0.23.
|
|
4
|
-
"description": "deja-vu memory for opencode: the session history of forty-
|
|
3
|
+
"version": "0.23.1",
|
|
4
|
+
"description": "deja-vu memory for opencode: the session history of forty-two 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": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@opencode-ai/plugin": ">=1.0.0",
|
|
55
|
-
"@vshulcz/deja-vu": "^0.23.
|
|
55
|
+
"@vshulcz/deja-vu": "^0.23.1"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"test": "node --test test/*.test.js"
|