dsh-deja 0.20.7 → 0.20.8

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 +16 -3
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -280,7 +280,7 @@ function autoDigest(ctx) {
280
280
  if (sid) seen.add(sid);
281
281
  return run(
282
282
  ["hook-context", "--plain"],
283
- JSON.stringify({ session_id: sid, cwd: process.cwd(), source: "startup", deja_once: true }),
283
+ JSON.stringify({ session_id: sid, cwd: sessionCwd(agent), source: "startup", deja_once: true }),
284
284
  );
285
285
  },
286
286
  }),
@@ -291,8 +291,18 @@ function sessionId(agent) {
291
291
  return (agent && (agent.sessionId || (agent.session && agent.session.id))) || "";
292
292
  }
293
293
 
294
+ // The workspace a session belongs to. One web or tui process serves sessions
295
+ // from every workspace and never changes directory, so process.cwd() is only
296
+ // where dsh was launched; the session header carries the directory the session
297
+ // was opened in.
298
+ function sessionCwd(agent) {
299
+ const header = agent && agent.session && agent.session.header;
300
+ return (header && header.cwd) || process.cwd();
301
+ }
302
+
294
303
  function autoRecall(ctx) {
295
304
  let asked = "";
305
+ let askedIn = "";
296
306
  let recalled = "";
297
307
 
298
308
  guarded(() =>
@@ -304,9 +314,12 @@ function autoRecall(ctx) {
304
314
  if (!agent) return "";
305
315
  const prompt = lastHumanText(agent);
306
316
  if (!prompt) return "";
307
- if (prompt !== asked) {
317
+ const cwd = sessionCwd(agent);
318
+ // The same question asked in another workspace is a different question.
319
+ if (prompt !== asked || cwd !== askedIn) {
308
320
  asked = prompt;
309
- recalled = run(["hook-prompt", "--plain"], JSON.stringify({ prompt, cwd: process.cwd() }));
321
+ askedIn = cwd;
322
+ recalled = run(["hook-prompt", "--plain"], JSON.stringify({ prompt, cwd }));
310
323
  }
311
324
  // Silence is the common case: this speaks only when the history answers.
312
325
  return recalled;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-deja",
3
- "version": "0.20.7",
3
+ "version": "0.20.8",
4
4
  "description": "deja-vu memory for DeepSeek Harness: the session history of twenty-four other coding agents, searchable and recalled before each step — a local index, no LLM.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -50,7 +50,7 @@
50
50
  }
51
51
  },
52
52
  "dependencies": {
53
- "@vshulcz/deja-vu": "^0.20.0"
53
+ "@vshulcz/deja-vu": "^0.20.1"
54
54
  },
55
55
  "scripts": {
56
56
  "test": "node --test test/*.test.js"