@vidge/dsh-agent-hub 0.1.0-rc1 → 0.1.0-rc2

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
@@ -64,19 +64,36 @@ runtime state — switching never requires a restart again.
64
64
  > can take the factory slot and re-mount that loop itself. Everything else in
65
65
  > that file is preserved byte for byte.
66
66
 
67
- ### Requirements
67
+ ### Engine dependencies
68
68
 
69
- Only for the engines you actually use:
69
+ Each engine's SDK is an **optional peer** — installing this plugin pulls in the
70
+ router only. Add the engines you actually want:
70
71
 
71
- - **Claude Code** — the Claude Code CLI installed on the host. Credentials are
72
- derived from dsh's own LLM provider configuration (see below); a CLI login is
73
- a fallback, not a requirement.
72
+ ```sh
73
+ # Claude Code
74
+ pnpm add @anthropic-ai/claude-agent-sdk
75
+ # Codex
76
+ pnpm add @openai/codex
77
+ # Pi
78
+ pnpm add @earendil-works/pi-coding-agent
79
+ ```
80
+
81
+ The `in-process` engine needs nothing beyond dsh itself, so a profile that
82
+ installs no SDK at all still works.
83
+
84
+ Selecting an engine whose SDK is missing fails that turn with a message naming
85
+ the package to install; it never affects other sessions or engines.
86
+
87
+ ### Authentication
88
+
89
+ Only for the engines you use:
90
+
91
+ - **Claude Code** — credentials are derived from dsh's own LLM provider
92
+ configuration (see below); a CLI login is a fallback, not a requirement.
74
93
  - **Codex** — authenticated via `codex login`, or a `CODEX_API_KEY` entry.
75
94
  - **Pi** — authenticated the way `pi` expects: its own `~/.pi/agent/auth.json`,
76
95
  or the provider's API-key environment variable.
77
96
 
78
- The in-process engine needs nothing beyond dsh itself.
79
-
80
97
  ## Usage
81
98
 
82
99
  Choose an engine in the composer when starting a session. To change engines,
package/README.zh.md CHANGED
@@ -55,18 +55,36 @@ dsh plugin --profile web add @vidge/dsh-agent-hub
55
55
  > `agent-loop` 行,以便路由器接管 factory 槽位并由它自己重新挂载该 loop。文件中
56
56
  > 其余内容逐字节保留。
57
57
 
58
- ### 依赖要求
58
+ ### 引擎依赖
59
+
60
+ 各引擎的 SDK 都是**可选 peer 依赖**——安装本插件只会装入路由器本身。按需添加你
61
+ 真正要用的引擎:
62
+
63
+ ```sh
64
+ # Claude Code
65
+ pnpm add @anthropic-ai/claude-agent-sdk
66
+ # Codex
67
+ pnpm add @openai/codex
68
+ # Pi
69
+ pnpm add @earendil-works/pi-coding-agent
70
+ ```
71
+
72
+ `in-process` 引擎除 dsh 本身外无任何额外要求,因此一个 SDK 都不装的 profile 仍可
73
+ 正常工作。
74
+
75
+ 选择了 SDK 未安装的引擎时,只有该次对话失败,并给出需要安装哪个包的提示;不会影响
76
+ 其他会话或其他引擎。
77
+
78
+ ### 认证
59
79
 
60
80
  仅针对你实际使用的引擎:
61
81
 
62
- - **Claude Code** —— 宿主机安装 Claude Code CLI。凭证由 dsh 自身的 LLM provider
63
- 配置派生(见下文);CLI 登录只是兜底,不是必需。
82
+ - **Claude Code** —— 凭证由 dsh 自身的 LLM provider 配置派生(见下文);CLI 登录
83
+ 只是兜底,不是必需。
64
84
  - **Codex** —— 通过 `codex login` 认证,或提供 `CODEX_API_KEY`。
65
85
  - **Pi** —— 按 pi 自己的方式认证:`~/.pi/agent/auth.json`,或对应 provider 的
66
86
  API-key 环境变量。
67
87
 
68
- in-process 引擎除 dsh 本身外无任何额外要求。
69
-
70
88
  ## 使用
71
89
 
72
90
  在 composer 中开始会话时选择引擎。要换引擎,开一个新会话——当前会话保持它的引擎,
package/lib/index.js CHANGED
@@ -65,7 +65,6 @@ import { Inbox, agentEvents } from "@deepseek-ai/dsh-agent";
65
65
  import { LlmError, createAssistantMessage, createUserMessage, errorChain } from "@deepseek-ai/dsh-llm";
66
66
  import { createScope } from "@deepseek-ai/dsh-scope";
67
67
  import { canonicalHeader } from "@deepseek-ai/dsh-session";
68
- import { query as officialQuery } from "@anthropic-ai/claude-agent-sdk";
69
68
 
70
69
  // src/engine-claude/mapping.ts
71
70
  import {
@@ -693,6 +692,19 @@ function invokedSkillNames(messages) {
693
692
 
694
693
  // src/engine-claude/agent.ts
695
694
  var PROVIDER = "claude-code";
695
+ var claudeQueryPromise;
696
+ async function loadClaudeQuery() {
697
+ claudeQueryPromise ??= import("@anthropic-ai/claude-agent-sdk").then(
698
+ (mod) => mod.query,
699
+ (error) => {
700
+ claudeQueryPromise = void 0;
701
+ throw new Error(
702
+ `the Claude Code engine requires "@anthropic-ai/claude-agent-sdk", which is not installed. Add it to this profile, or pick another engine for this session. (${String(error)})`
703
+ );
704
+ }
705
+ );
706
+ return claudeQueryPromise;
707
+ }
696
708
  var NATIVE_MODEL_LABEL = "claude-code-native";
697
709
  function failureCode(subtype) {
698
710
  switch (subtype) {
@@ -1116,6 +1128,7 @@ var ClaudeCodeAgent = class {
1116
1128
  diagnostics.push(line);
1117
1129
  }
1118
1130
  }, controller);
1131
+ const officialQuery = await loadClaudeQuery();
1119
1132
  const query = officialQuery({ prompt, options });
1120
1133
  let finished = false;
1121
1134
  const chunkSeqs = [];
@@ -1606,7 +1619,13 @@ import { dirname, join } from "node:path";
1606
1619
  import { createInterface } from "node:readline";
1607
1620
  var require2 = createRequire(import.meta.url);
1608
1621
  function codexCliEntrypoint() {
1609
- return join(dirname(require2.resolve("@openai/codex/package.json")), "bin", "codex.js");
1622
+ try {
1623
+ return join(dirname(require2.resolve("@openai/codex/package.json")), "bin", "codex.js");
1624
+ } catch (error) {
1625
+ throw new Error(
1626
+ `the Codex engine requires "@openai/codex", which is not installed. Add it to this profile, or pick another engine for this session. (${String(error)})`
1627
+ );
1628
+ }
1610
1629
  }
1611
1630
  var AppServerClient = class _AppServerClient {
1612
1631
  process;
@@ -3609,7 +3628,14 @@ function resolveConfig3(config) {
3609
3628
  };
3610
3629
  }
3611
3630
  function piCliEntrypoint() {
3612
- const mainUrl = import.meta.resolve("@earendil-works/pi-coding-agent");
3631
+ let mainUrl;
3632
+ try {
3633
+ mainUrl = import.meta.resolve("@earendil-works/pi-coding-agent");
3634
+ } catch (error) {
3635
+ throw new Error(
3636
+ `the Pi engine requires "@earendil-works/pi-coding-agent", which is not installed. Add it to this profile, or pick another engine for this session. (${String(error)})`
3637
+ );
3638
+ }
3613
3639
  const root = dirname2(dirname2(fileURLToPath(mainUrl)));
3614
3640
  const pkg = JSON.parse(readFileSync(join2(root, "package.json"), "utf8"));
3615
3641
  const bin = pkg.bin;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.1.0-rc1",
7
+ "version": "0.1.0-rc2",
8
8
  "repository": "github:vidgewong/dsh-agent-hub",
9
9
  "type": "module",
10
10
  "main": "lib/index.js",
@@ -61,12 +61,8 @@
61
61
  "@anthropic-ai/sdk": "0.93.0",
62
62
  "@deepseek-ai/schemastery": "3.18.1"
63
63
  },
64
- "optionalDependencies": {
65
- "@anthropic-ai/claude-agent-sdk": "0.3.220",
66
- "@earendil-works/pi-coding-agent": "0.84.3",
67
- "@openai/codex": "0.149.1"
68
- },
69
64
  "peerDependencies": {
65
+ "@anthropic-ai/claude-agent-sdk": "0.3.220",
70
66
  "@deepseek-ai/cordis": "^4.0.1",
71
67
  "@deepseek-ai/dsh-agent": "0.1.1-rc.2",
72
68
  "@deepseek-ai/dsh-agent-loop": "0.1.1-rc.2",
@@ -77,11 +73,14 @@
77
73
  "@deepseek-ai/dsh-session-persistence": "0.1.1-rc.2",
78
74
  "@deepseek-ai/dsh-settings": "0.1.1-rc.2",
79
75
  "@deepseek-ai/dsh-subprocess": "0.1.1-rc.2",
80
- "@deepseek-ai/dsh-timeout": "0.1.1-rc.2"
76
+ "@deepseek-ai/dsh-timeout": "0.1.1-rc.2",
77
+ "@earendil-works/pi-coding-agent": "0.84.3",
78
+ "@openai/codex": "0.149.1"
81
79
  },
82
80
  "devDependencies": {
83
- "@deepseek-ai/dsh-attachment": "0.1.1-rc.2",
81
+ "@anthropic-ai/claude-agent-sdk": "0.3.220",
84
82
  "@deepseek-ai/dsh-agent-loop": "0.1.1-rc.2",
83
+ "@deepseek-ai/dsh-attachment": "0.1.1-rc.2",
85
84
  "@deepseek-ai/dsh-client-locale": "0.1.1-rc.2",
86
85
  "@deepseek-ai/dsh-client-runtime": "0.1.1-rc.2",
87
86
  "@deepseek-ai/dsh-client-store": "0.1.2-alpha.2",
@@ -93,6 +92,8 @@
93
92
  "@deepseek-ai/dsh-session-persistence-jsonl": "0.1.1-rc.2",
94
93
  "@deepseek-ai/dsh-subprocess-local": "0.1.1-rc.2",
95
94
  "@deepseek-ai/dsh-system-prompt": "0.1.1-rc.2",
95
+ "@earendil-works/pi-coding-agent": "0.84.3",
96
+ "@openai/codex": "0.149.1",
96
97
  "@types/node": "^22.20.0",
97
98
  "@types/react": "^19.0.0",
98
99
  "@vitest/coverage-v8": "^4.1.8",
@@ -103,5 +104,16 @@
103
104
  "vite-tsconfig-paths": "^6.1.1",
104
105
  "vitest": "^4.1.8",
105
106
  "yaml": "^2.9.0"
107
+ },
108
+ "peerDependenciesMeta": {
109
+ "@anthropic-ai/claude-agent-sdk": {
110
+ "optional": true
111
+ },
112
+ "@earendil-works/pi-coding-agent": {
113
+ "optional": true
114
+ },
115
+ "@openai/codex": {
116
+ "optional": true
117
+ }
106
118
  }
107
119
  }