dsh-deja 0.20.2 → 0.20.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # dsh-deja
2
2
 
3
- English | [中文](README.zh.md)
3
+ English | [中文](docs/zh.md)
4
4
 
5
5
  DeepSeek Harness can already search its own sessions — that is what the built-in
6
6
  `session-query` subsystem does. This plugin answers the other question: what you
@@ -22,9 +22,15 @@ The plugin runs the `deja` binary. It is pulled in as a dependency, so npm
22
22
  installs it with the plugin; a `deja` already on `PATH` is used as-is, and
23
23
  `DEJA_BIN` overrides both.
24
24
 
25
+ If you have the CLI, `deja install --auto` wires dsh too — it adds deja's MCP
26
+ server and a `/deja` command to your profile — and that is the shorter path.
27
+ Having both is fine: this plugin looks for what the installer wrote in
28
+ `$DSH_HOME/plugins/deja/` and contributes only what is missing, so the tools and
29
+ the command are never registered twice.
30
+
25
31
  ## What it adds
26
32
 
27
- Three tools the model can call:
33
+ Six tools the model can call:
28
34
 
29
35
  | Tool | Answers |
30
36
  |---|---|
@@ -1,6 +1,6 @@
1
1
  # dsh-deja
2
2
 
3
- [English](README.md) | 中文
3
+ [English](../README.md) | 中文
4
4
 
5
5
  DeepSeek Harness 自带的 `session-query` 已经可以检索它自己的会话。这个插件回答的是另一个问题:你在这台机器上**其他**智能体里做过什么。
6
6
 
@@ -14,9 +14,12 @@ dsh plugin --profile web add dsh-deja
14
14
 
15
15
  插件调用 `deja` 可执行文件。它作为依赖随插件一起安装;如果 `PATH` 上已有 `deja` 就直接使用,`DEJA_BIN` 可覆盖两者。
16
16
 
17
+ 装了 CLI 的话,`deja install --auto` 也会把 dsh 接好——写入 deja 的 MCP 服务端和 `/deja` 命令——那条路更短。
18
+ 两边都装也没问题:插件会检查 `$DSH_HOME/plugins/deja/` 下安装器写了什么,只补缺的部分,工具和命令不会注册两次。
19
+
17
20
  ## 提供的能力
18
21
 
19
- 三个模型可调用的工具:
22
+ 六个模型可调用的工具:
20
23
 
21
24
  | 工具 | 回答什么 |
22
25
  |---|---|
package/index.js CHANGED
@@ -11,6 +11,8 @@ import { existsSync } from "node:fs";
11
11
  import { homedir } from "node:os";
12
12
  import { join } from "node:path";
13
13
 
14
+ import { contributions } from "./lib.js";
15
+
14
16
  const require = createRequire(import.meta.url);
15
17
 
16
18
  // The tool registry lives in the host. A plugin that throws on a missing peer
@@ -292,11 +294,16 @@ function isHuman(message) {
292
294
  return Boolean(message) && (!message.source || message.source.kind === "user");
293
295
  }
294
296
 
295
- // cliPluginDir is where `deja install dsh` writes plugins of its own. A user
296
- // who ran the installer and then added this package has both in the profile:
297
- // two `/deja` commands and the same recall on the system prompt twice. The
298
- // files on disk win — the installer keeps them current — and this package then
299
- // contributes only what they do not: the model-facing tools.
297
+ // `deja install dsh` writes plugins of its own into DSH_HOME and adds them to
298
+ // the profile, so a user who ran the installer and then added this package has
299
+ // both: two `/deja` commands, the same recall on the system prompt twice, and
300
+ // deja's MCP server answering the same six questions the tools here do. What
301
+ // the installer wrote wins — it is the copy `deja install` keeps current — and
302
+ // this package contributes only the parts that are missing.
303
+ //
304
+ // The two halves are separate on purpose: `deja install dsh` writes command.js
305
+ // and the MCP row, and only `deja install dsh-auto` adds auto.js. A profile can
306
+ // have the command from the installer and still want recall from here.
300
307
  function cliPluginDir() {
301
308
  const home = process.env.DSH_HOME || join(homedir(), ".dsh");
302
309
  return join(home, "plugins", "deja");
@@ -311,13 +318,13 @@ function installedByCLI(file) {
311
318
  }
312
319
 
313
320
  function apply(ctx, config) {
314
- tools(ctx);
315
- // Each half stands down on its own: `deja install dsh` writes command.js,
316
- // and only `deja install dsh-auto` adds auto.js, so a profile can have the
317
- // command from the installer and still want recall from here.
318
- if (!installedByCLI("command.js")) command(ctx);
319
- if (installedByCLI("auto.js")) return;
320
- if (!config || config.autoRecall !== false) autoRecall(ctx);
321
+ const adds = contributions(
322
+ { command: installedByCLI("command.js"), auto: installedByCLI("auto.js") },
323
+ config,
324
+ );
325
+ if (adds.tools) tools(ctx);
326
+ if (adds.command) command(ctx);
327
+ if (adds.recall) autoRecall(ctx);
321
328
  }
322
329
 
323
330
  apply.inject = ["tools", "commands", "systemPrompt"];
package/lib.js ADDED
@@ -0,0 +1,22 @@
1
+ // The plugin's decision, kept out of index.js because a host is free to treat
2
+ // anything a plugin module exports as part of the plugin — opencode does
3
+ // exactly that with its own — and this is a helper, not a second plugin.
4
+
5
+ // contributions says what this package adds, given what `deja install` already
6
+ // wrote into DSH_HOME and what the profile turned off. The rule is the same
7
+ // everywhere: fill the gaps, never repeat the installer.
8
+ //
9
+ // command.js and the mcp-deja profile row are written by the same install, so
10
+ // the command file standing there means the model can already reach deja —
11
+ // registering these tools would list every answer twice. auto.js is separate:
12
+ // only `deja install dsh-auto` writes it, so a profile can take the command
13
+ // from the installer and still want recall from here.
14
+ export function contributions(wiring, config) {
15
+ const wired = wiring || {};
16
+ const settings = config || {};
17
+ return {
18
+ tools: !wired.command,
19
+ command: !wired.command,
20
+ recall: settings.autoRecall !== false && !wired.auto,
21
+ };
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-deja",
3
- "version": "0.20.2",
3
+ "version": "0.20.4",
4
4
  "description": "Brings the session history of nineteen other coding agents into DeepSeek Harness: recall, session digest and per-file history tools over a local index, plus optional automatic recall before each step.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -10,9 +10,10 @@
10
10
  },
11
11
  "files": [
12
12
  "index.js",
13
+ "lib.js",
13
14
  "cordis.patch.yml",
14
15
  "README.md",
15
- "README.zh.md",
16
+ "docs/zh.md",
16
17
  "LICENSE"
17
18
  ],
18
19
  "license": "MIT",