@alwith-ai/dsh-agent 0.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ALwith
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # dsh-agent
2
+
3
+ English | [中文](README.zh.md)
4
+
5
+ An **interactive ACP v2 bridge** for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh): exposes a dsh agent as a chat backend that desktop/editor clients can host — token-level streaming, run-state reporting (`state_update`), permission bridging, and cancellation. Ships as an out-of-tree plugin: no fork of dsh, dependencies pinned to exact npm versions.
6
+
7
+ Maintained by [ALwith](https://github.com/ALwith-ai); **ALwith Desktop is its reference client** (the desktop form of dsh). Upstream's own ACP surface is deliberately automation-only (fresh sessions, committed output only); this bridge provides the interactive side.
8
+
9
+ > Status: developer preview. Covers `session/new` + prompt + streaming + run-state reporting + cancel + `session/resume` (live-first reattach, cold resume from JSONL persistence, client-driven `replayFrom` history replay) + sandbox-first tools with escalation approvals + in-session model switching (`session/set_config_option`) + LLM session titles (deterministic first, one background generate upgrades) + all dsh presets (`standard` / `minimal` / `anchored` / `code` PTC on the Bun-patched official worker runtime / `cordis` creator with the vm-realm dynamic-plugin toolset and the bundled `cordis-plugin-development` skill) + host-facing `plugins` / `sessions` management CLIs + a multi-provider seat (`ALWITH_DSH_PI_PROVIDERS`: pi-ai catalog routes — openai / anthropic / google / xai / … — mounted beside the DeepSeek adapter).
10
+
11
+ ## Layout
12
+
13
+ | File | Responsibility |
14
+ |---|---|
15
+ | `src/bridge.ts` | ACP v2 server plugin (adapted from upstream's automation-only v1 bridge, MIT) |
16
+ | `src/codec.ts` | Pure wire-format translation (adapted from the upstream codec) |
17
+ | `src/plugins.ts` | Plugin manifest: the composition as data (per-preset roster, core protection, overrides) |
18
+ | `src/compose.ts` | Composes the runtime from the manifest (no dsh loader/profile — deterministic, runs on Bun) |
19
+ | `src/plugins-cli.ts` | `plugins` subcommand: list and toggle plugins without a live session |
20
+ | `src/sessions-cli.ts` | `sessions` subcommand: session-log inspection through dsh's own persistence |
21
+ | `skills/` | Skills bundled into presets (vendored from dsh's cordis preset, MIT) |
22
+ | `src/main.ts` | stdio entry for hosts to spawn |
23
+
24
+ ## Run
25
+
26
+ ```sh
27
+ DEEPSEEK_API_KEY=… bun src/main.ts # ACP v2 server over stdio
28
+ bun test # protocol tests with a mock adapter; no real model calls
29
+ ```
30
+
31
+ `session/resume` semantics: an omitted `replayFrom` means context-only restore; `{ type: "start" }` replays the whole conversation as `session/update` frames. Session logs live under `$ALWITH_DSH_SESSIONS_ROOT` (default `~/.dsh-agent/sessions`).
32
+
33
+ ## Plugins
34
+
35
+ The composition per preset is fixed here in code (deterministic), but users keep dsh's two degrees of freedom — per-plugin enable/disable and per-plugin config — through an overrides file (`$ALWITH_DSH_PLUGINS_FILE`, default `~/.dsh-agent/plugins.json`), read at spawn so changes apply to new sessions:
36
+
37
+ ```sh
38
+ bun src/main.ts plugins list --preset standard # every row of the preset, JSON
39
+ bun src/main.ts plugins set tool-web disabled # validated before writing
40
+ ```
41
+
42
+ ```json
43
+ { "disabled": ["tool-web"], "config": { "bash-sandbox": { "timeoutMs": 120000 } } }
44
+ ```
45
+
46
+ Core rows (session, llm, sandbox, approvals, …) cannot be disabled, and disabling a row another enabled row `requires` is rejected with the exact fix — both fail loud before anything is written. `config` entries shallow-merge over the row defaults.
47
+
48
+ ## License
49
+
50
+ [MIT](LICENSE); portions adapted from upstream `@deepseek-ai/dsh-acp` are noted in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
package/README.zh.md ADDED
@@ -0,0 +1,50 @@
1
+ # dsh-agent
2
+
3
+ [English](README.md) | 中文
4
+
5
+ [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(dsh)的**交互式 ACP v2 桥**:把 dsh agent 暴露成可被桌面/编辑器客户端托管的聊天后端——逐 token 流、运行态直报(`state_update`)、权限桥、取消。树外插件形态,不 fork dsh,依赖钉死 npm 精确版本。
6
+
7
+ 由 [ALwith](https://github.com/ALwith-ai) 维护;**ALwith Desktop 是它的参考客户端**(dsh 的桌面端形态)。上游的 ACP 实现是刻意的 automation-only(仅新会话、只发已提交输出),本桥补齐交互式一侧。
8
+
9
+ > 状态:developer preview。覆盖 `session/new` + prompt + 流式 + 状态直报 + cancel + `session/resume`(live-first 接续、JSONL 持久化冷恢复、客户端 `replayFrom` 游标历史回放)+ 沙箱优先工具面与升级审批 + 会话中切模型(`session/set_config_option`)+ LLM 会话标题(先落确定性截断,后台一次生成升级)+ 全部 dsh 预设(`standard` / `minimal` / `anchored` / `code` PTC,跑在 Bun 补丁版官方 worker 运行时上 / `cordis` 创造模式,vm 域动态插件工具组 + 随捆 `cordis-plugin-development` skill)+ 面向宿主的 `plugins` / `sessions` 管理 CLI + 多厂商席位(`ALWITH_DSH_PI_PROVIDERS`:pi-ai 目录路由 —— openai / anthropic / google / xai / … —— 与 DeepSeek 适配器并挂)。
10
+
11
+ ## 结构
12
+
13
+ | 文件 | 职责 |
14
+ |---|---|
15
+ | `src/bridge.ts` | ACP v2 服务器插件(改编自上游 automation-only v1 桥,MIT) |
16
+ | `src/codec.ts` | 线格式纯转换(改编自上游 codec) |
17
+ | `src/plugins.ts` | 插件清单:组合面即数据(逐预设 roster、核心行保护、用户覆盖) |
18
+ | `src/compose.ts` | 按清单组合运行时(不用 dsh loader/profile——组合确定性,Bun 可跑) |
19
+ | `src/plugins-cli.ts` | `plugins` 子命令:无活会话即可列出与开关插件 |
20
+ | `src/sessions-cli.ts` | `sessions` 子命令:经 dsh 自家 persistence 检查会话日志 |
21
+ | `skills/` | 随预设捆入的 skill(vendor 自 dsh cordis 预设,MIT) |
22
+ | `src/main.ts` | stdio 入口,供宿主 spawn |
23
+
24
+ ## 运行
25
+
26
+ ```sh
27
+ DEEPSEEK_API_KEY=… bun src/main.ts # stdio 上的 ACP v2 服务器
28
+ bun test # mock 适配器协议测试,不打真模型
29
+ ```
30
+
31
+ `session/resume` 语义:`replayFrom` 省略 = 只恢复上下文;`{ type: "start" }` = 整段对话重放为 `session/update` 帧。会话日志在 `$ALWITH_DSH_SESSIONS_ROOT`(默认 `~/.dsh-agent/sessions`)。
32
+
33
+ ## 插件
34
+
35
+ 各预设的组合面在代码里写死(确定性),但用户保有 dsh 的两个自由度——逐插件开关与逐插件配置——经覆盖文件(`$ALWITH_DSH_PLUGINS_FILE`,默认 `~/.dsh-agent/plugins.json`)生效;spawn 时读取,改动作用于新会话:
36
+
37
+ ```sh
38
+ bun src/main.ts plugins list --preset standard # 该预设的全部行,JSON
39
+ bun src/main.ts plugins set tool-web disabled # 先校验再落盘
40
+ ```
41
+
42
+ ```json
43
+ { "disabled": ["tool-web"], "config": { "bash-sandbox": { "timeoutMs": 120000 } } }
44
+ ```
45
+
46
+ 核心行(session、llm、沙箱、审批…)不可停用;停用某行会让另一启用行的 `requires` 落空时,拒绝并给出确切改法——两者都在写盘前炸清楚。`config` 条目与该行默认配置浅合并。
47
+
48
+ ## License
49
+
50
+ [MIT](LICENSE);改编自上游 `@deepseek-ai/dsh-acp` 的部分见 [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md)。
@@ -0,0 +1,32 @@
1
+ # Third-party notices
2
+
3
+ English | [中文](THIRD_PARTY_NOTICES.zh.md)
4
+
5
+ The structure of `src/bridge.ts` and `src/codec.ts` is adapted from the
6
+ `@deepseek-ai/dsh-acp` package (the automation-only ACP v1 bridge) of
7
+ [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness), whose
8
+ original copyright and license follow:
9
+
10
+ ```
11
+ MIT License
12
+
13
+ Copyright (c) 2026 DeepSeek
14
+ ```
15
+
16
+ Runtime dependencies `@deepseek-ai/dsh-*` (MIT) and `@agentclientprotocol/sdk`
17
+ (Apache-2.0) are consumed as npm packages; see their distributions for the
18
+ respective licenses.
19
+
20
+ ---
21
+
22
+ `skills/cordis-plugin-development/` is vendored verbatim from
23
+ [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (MIT),
24
+ path `apps/cli/config/agent-presets/cordis/skills/cordis-plugin-development/`.
25
+
26
+ ---
27
+
28
+ `src/vendor/anchored-tool-bootstrap.mjs` is vendored from
29
+ [dsh-web-ui](https://github.com/zhu1090093659/dsh-web-ui) (Apache-2.0), package
30
+ `dsh-liangshen`, itself derived from
31
+ [xiaobright/dsh-anchored-standard](https://github.com/xiaobright/dsh-anchored-standard)
32
+ (MIT). The file retains its upstream licenses; see the provenance header inside it.
@@ -0,0 +1,30 @@
1
+ # 第三方声明
2
+
3
+ [English](THIRD_PARTY_NOTICES.md) | 中文
4
+
5
+ `src/bridge.ts` 与 `src/codec.ts` 的结构改编自
6
+ [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 的
7
+ `@deepseek-ai/dsh-acp` 包(automation-only ACP v1 桥),原始版权与许可如下:
8
+
9
+ ```
10
+ MIT License
11
+
12
+ Copyright (c) 2026 DeepSeek
13
+ ```
14
+
15
+ 运行时依赖 `@deepseek-ai/dsh-*`(MIT)与 `@agentclientprotocol/sdk`(Apache-2.0)
16
+ 以 npm 包形式引用,各自许可见其发行物。
17
+
18
+ ---
19
+
20
+ `skills/cordis-plugin-development/` 逐字 vendor 自
21
+ [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(MIT),
22
+ 路径 `apps/cli/config/agent-presets/cordis/skills/cordis-plugin-development/`。
23
+
24
+ ---
25
+
26
+ `src/vendor/anchored-tool-bootstrap.mjs` vendor 自
27
+ [dsh-web-ui](https://github.com/zhu1090093659/dsh-web-ui)(Apache-2.0)的
28
+ `dsh-liangshen` 包,其上游为
29
+ [xiaobright/dsh-anchored-standard](https://github.com/xiaobright/dsh-anchored-standard)
30
+ (MIT)。该文件保留其上游许可;溯源见文件头。
package/package.json ADDED
@@ -0,0 +1,94 @@
1
+ {
2
+ "name": "@alwith-ai/dsh-agent",
3
+ "version": "0.2.0",
4
+ "description": "ACP v2 agent built on DeepSeek Harness: fixed plugin compositions (standard / minimal / anchored / code / cordis), streaming turns with direct state reporting, permissions, resume with replay, multi-provider credentials and subscription login",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/ALwith-ai/dsh-agent.git"
9
+ },
10
+ "bin": {
11
+ "dsh-agent": "src/main.ts"
12
+ },
13
+ "files": [
14
+ "src",
15
+ "skills",
16
+ "README.md",
17
+ "README.zh.md",
18
+ "THIRD_PARTY_NOTICES.md",
19
+ "THIRD_PARTY_NOTICES.zh.md"
20
+ ],
21
+ "type": "module",
22
+ "scripts": {
23
+ "test": "bun test",
24
+ "typecheck": "bunx tsc --noEmit"
25
+ },
26
+ "dependencies": {
27
+ "@agentclientprotocol/sdk": "1.4.0",
28
+ "@deepseek-ai/cordis": "4.0.1",
29
+ "@deepseek-ai/dsh-agent": "0.1.2-rc.1",
30
+ "@deepseek-ai/dsh-agent-loop": "0.1.2-rc.1",
31
+ "@deepseek-ai/dsh-authorization": "0.1.2-rc.1",
32
+ "@deepseek-ai/dsh-bash-local": "0.1.2-rc.1",
33
+ "@deepseek-ai/dsh-bash-sandbox": "0.1.2-rc.1",
34
+ "@deepseek-ai/dsh-code-runtime": "0.1.2-rc.1",
35
+ "@deepseek-ai/dsh-compaction": "0.1.2-rc.1",
36
+ "@deepseek-ai/dsh-cordis-host-runner": "0.1.2-rc.1",
37
+ "@deepseek-ai/dsh-credentials": "0.1.2-rc.1",
38
+ "@deepseek-ai/dsh-credentials-local": "0.1.2-rc.1",
39
+ "@deepseek-ai/dsh-fs": "0.1.2-rc.1",
40
+ "@deepseek-ai/dsh-fs-local": "0.1.2-rc.1",
41
+ "@deepseek-ai/dsh-fs-observation-policy": "0.1.2-rc.1",
42
+ "@deepseek-ai/dsh-fs-sandbox": "0.1.2-rc.1",
43
+ "@deepseek-ai/dsh-jobs": "0.1.2-rc.1",
44
+ "@deepseek-ai/dsh-jobs-local": "0.1.2-rc.1",
45
+ "@deepseek-ai/dsh-llm": "0.1.2-rc.1",
46
+ "@deepseek-ai/dsh-llm-deepseek": "0.1.2-rc.1",
47
+ "@deepseek-ai/dsh-llm-pi-ai": "0.1.2-rc.1",
48
+ "@deepseek-ai/dsh-permission-presets": "0.1.2-rc.1",
49
+ "@deepseek-ai/dsh-sandbox": "0.1.2-rc.1",
50
+ "@deepseek-ai/dsh-sandbox-local": "0.1.2-rc.1",
51
+ "@deepseek-ai/dsh-sandbox-policy": "0.1.2-rc.1",
52
+ "@deepseek-ai/dsh-session": "0.1.2-rc.1",
53
+ "@deepseek-ai/dsh-session-persistence": "0.1.2-rc.1",
54
+ "@deepseek-ai/dsh-session-persistence-jsonl": "0.1.2-rc.1",
55
+ "@deepseek-ai/dsh-session-projection": "0.1.2-rc.1",
56
+ "@deepseek-ai/dsh-shell": "0.1.2-rc.1",
57
+ "@deepseek-ai/dsh-shell-env": "0.1.2-rc.1",
58
+ "@deepseek-ai/dsh-skill": "0.1.2-rc.1",
59
+ "@deepseek-ai/dsh-skill-filesystem": "0.1.2-rc.1",
60
+ "@deepseek-ai/dsh-subprocess": "0.1.2-rc.1",
61
+ "@deepseek-ai/dsh-subprocess-local": "0.1.2-rc.1",
62
+ "@deepseek-ai/dsh-system-prompt": "0.1.2-rc.1",
63
+ "@deepseek-ai/dsh-terminal": "0.1.2-rc.1",
64
+ "@deepseek-ai/dsh-terminal-bash": "0.1.2-rc.1",
65
+ "@deepseek-ai/dsh-tool-bash": "0.1.2-rc.1",
66
+ "@deepseek-ai/dsh-tool-bash-persistent": "0.1.2-rc.1",
67
+ "@deepseek-ai/dsh-tool-cordis": "0.1.2-rc.1",
68
+ "@deepseek-ai/dsh-tool-fs": "0.1.2-rc.1",
69
+ "@deepseek-ai/dsh-tool-fs-search": "0.1.2-rc.1",
70
+ "@deepseek-ai/dsh-tool-skill": "0.1.2-rc.1",
71
+ "@deepseek-ai/dsh-tool-str-replace-editor": "0.1.2-rc.1",
72
+ "@deepseek-ai/dsh-tool-todo": "0.1.2-rc.1",
73
+ "@deepseek-ai/dsh-tool-web": "0.1.2-rc.1",
74
+ "@deepseek-ai/dsh-tools": "0.1.2-rc.1",
75
+ "@deepseek-ai/dsh-user-approval": "0.1.2-rc.1",
76
+ "@deepseek-ai/dsh-web": "0.1.2-rc.1",
77
+ "@deepseek-ai/dsh-web-search-deepseek": "0.1.2-rc.1",
78
+ "@deepseek-ai/schemastery": "3.18.1",
79
+ "@nyssance/dsh-code-runtime-worker-thread": "0.1.2-rc.1",
80
+ "amaro": "1.1.11"
81
+ },
82
+ "devDependencies": {
83
+ "@deepseek-ai/dsh-agent-loop-testkit": "0.1.2-rc.1",
84
+ "@deepseek-ai/dsh-llm-replay": "0.1.2-rc.1",
85
+ "@types/bun": "1.3.14",
86
+ "typescript": "7.0.2"
87
+ },
88
+ "trustedDependencies": [
89
+ "@deepseek-ai/dsh-subprocess-local",
90
+ "@google/genai",
91
+ "koffi",
92
+ "node-pty"
93
+ ]
94
+ }