opencode-deja 0.21.0 → 0.21.2

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.
Files changed (2) hide show
  1. package/index.js +27 -0
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -347,6 +347,33 @@ export const DejaPlugin = async ({ client, directory }, options = {}) => {
347
347
  // which the next request carries as the tool result.
348
348
  hooks["tool.execute.after"] = async (input, output) => {
349
349
  try {
350
+ // A file's history, at the read before the edit. opencode has no seam
351
+ // that can inject before a file action — tool.execute.before can only
352
+ // rewrite the arguments — so the line goes out the way the failure line
353
+ // does: appended to the tool's own output, which the next request
354
+ // carries as the tool result. Without this, what deja knows at the
355
+ // point of an action reached every harness except this one.
356
+ //
357
+ // Matched on the argument rather than the tool name: a tool carrying a
358
+ // file path is a file action whatever this version calls it, and a name
359
+ // deja does not recognise is answered with silence.
360
+ const fpath = input?.args?.filePath || input?.args?.path || ""
361
+ if (fpath && input?.tool !== "bash") {
362
+ const ftext = output?.output
363
+ if (!ftext) return
364
+ const fpayload = {
365
+ hook_event_name: "PostToolUse",
366
+ tool_name: input?.tool || "read",
367
+ tool_input: { file_path: fpath },
368
+ session_id: input.sessionID || "",
369
+ cwd,
370
+ }
371
+ const fraw = await ask(["hook-tool"], JSON.stringify(fpayload))
372
+ if (!fraw) return
373
+ const fextra = JSON.parse(fraw)?.hookSpecificOutput?.additionalContext
374
+ if (fextra) output.output = ftext + "\n\n" + fextra
375
+ return
376
+ }
350
377
  if (input?.tool !== "bash") return
351
378
  const text = output?.output
352
379
  if (!text) return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-deja",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "description": "deja-vu memory for opencode: the session history of thirty-three other coding agents, searchable and recalled on every request — a local index, no LLM.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@opencode-ai/plugin": ">=1.0.0",
53
- "@vshulcz/deja-vu": "^0.21.0"
53
+ "@vshulcz/deja-vu": "^0.21.2"
54
54
  },
55
55
  "scripts": {
56
56
  "test": "node --test test/*.test.js"