dsh-taskbridge 0.0.0-stage → 1.3.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.
- package/CHANGELOG.md +763 -0
- package/LICENSE +21 -0
- package/README.md +622 -3
- package/bin/dsh-delegate-codex-agent.js +115 -0
- package/bin/dsh-delegate-control.d.ts +90 -0
- package/bin/dsh-delegate-control.js +450 -0
- package/bin/dsh-delegate-mcp.d.ts +121 -0
- package/bin/dsh-delegate-mcp.js +273 -0
- package/codex/dsh-taskbridge.toml +247 -0
- package/cordis.patch.yml +6 -0
- package/docs/INTRODUCTION.md +15 -0
- package/docs/INTRODUCTION.zh.md +34 -0
- package/docs/auth-contract.md +138 -0
- package/docs/claude-code.md +31 -0
- package/docs/codex-integration.md +937 -0
- package/docs/contracts-stage-b.md +443 -0
- package/docs/conversation-placement.md +304 -0
- package/docs/plugin-market.md +30 -0
- package/docs/redaction-contract.md +127 -0
- package/docs/runtime-compatibility.md +223 -0
- package/docs/silent-wait.md +191 -0
- package/docs/taskbridge-upgrade.md +28 -0
- package/docs/taskdispatch-upgrade.md +25 -0
- package/docs/worker-permissions.md +347 -0
- package/docs/workspace-contract.md +538 -0
- package/icon.svg +1 -0
- package/lib/client.d.ts +118 -0
- package/lib/client.js +3232 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +138 -4
- package/src/auth/fence.js +361 -0
- package/src/auth/grants.js +789 -0
- package/src/client/api.js +2322 -0
- package/src/client/index.jsx +2333 -0
- package/src/client/styles.js +251 -0
- package/src/codex/installer.js +3299 -0
- package/src/codex/seam.js +429 -0
- package/src/codex/toml.js +784 -0
- package/src/config/defaults.js +164 -0
- package/src/config/redact.js +184 -0
- package/src/config/settings.js +629 -0
- package/src/config/store.js +186 -0
- package/src/config/validate.js +763 -0
- package/src/credentials/seam.js +202 -0
- package/src/http/execution-plane.js +456 -0
- package/src/http/respond.js +175 -0
- package/src/http/user-plane.js +1122 -0
- package/src/index.d.ts +332 -0
- package/src/index.js +657 -0
- package/src/jobs/activity.js +1008 -0
- package/src/jobs/engine.js +3614 -0
- package/src/jobs/history.js +1467 -0
- package/src/jobs/title.js +17 -0
- package/src/mcp/server.js +1821 -0
- package/src/mcp/wait.js +536 -0
- package/src/model/connectivity.js +371 -0
- package/src/model/discovery.js +582 -0
- package/src/model/native-catalog.js +68 -0
- package/src/model/openai-adapter.js +671 -0
- package/src/model/probe.js +264 -0
- package/src/model/providers.js +756 -0
- package/src/model/routing.js +321 -0
- package/src/review/preset.js +868 -0
- package/src/review/prompts.js +126 -0
- package/src/review/reviewer.js +933 -0
- package/src/runtime/agent-runner.js +1740 -0
- package/src/runtime/endpoint-discovery.js +118 -0
- package/src/runtime/permissions.js +1429 -0
- package/src/runtime/sandbox.js +358 -0
- package/src/runtime/session-placement.js +1121 -0
- package/src/workspace/audit.js +775 -0
- package/src/workspace/locks.js +167 -0
- package/src/workspace/preflight.js +424 -0
- package/src/workspace/worktrees.js +613 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# DSH TaskBridge
|
|
2
|
+
|
|
3
|
+
Let Claude Code or Codex direct DSH tasks. Choose the execution API, model and supported reasoning effort in the DSH plugin settings.
|
|
4
|
+
|
|
5
|
+
The host plans, dispatches and reviews; DSH executes using the effective configuration. Follow-up corrections explicitly continue the same task conversation and execution checkout. Providers come from DSH's existing API connections, without copying their credentials into the plugin.
|
|
6
|
+
|
|
7
|
+
The settings include the local delegation switch, worker model/effort, task timeout, concurrency, workspace isolation, project overrides and optional additional read-only model review. A newly installed plugin starts with delegation disabled. Runtime/model capability checks remain authoritative.
|
|
8
|
+
|
|
9
|
+
The quiet wait observes execution inside the program and returns at actionable boundaries. Pending wider-permission calls are presented to the commander for a single-call decision. Completion is evidence for host review, never automatic host acceptance.
|
|
10
|
+
|
|
11
|
+
Codex has a managed agent/MCP installation button. Version 1.3.2 names the companion `dsh-taskbridge` and migrates unchanged published legacy companions. New DSH Workspaces use the task's work-content title; explicit follow-ups keep the original Workspace and conversation. Claude Code connects using standard stdio MCP; see [the manual guide](claude-code.md). A Claude one-click installer and native client mention selection are not promised.
|
|
12
|
+
|
|
13
|
+
Version 1.3.1 adopts DSH TaskBridge and the package identity `dsh-taskbridge`, replacing `dsh-delegate` and the GitHub-only `dsh-taskdispatch` 1.3.0. Read the [upgrade guide](taskbridge-upgrade.md) before replacing an old installation. Historical data, MCP tools, environment variables and the Codex `dsh-delegate` technical identifier remain compatible. Do not run old and new bundles together.
|
|
14
|
+
|
|
15
|
+
In DSH's Add plugin dialog, use `dsh-taskbridge@1.3.2`; use the official npm registry if a regional mirror has not synchronized yet. Distribution also uses GitHub releases and a [DSH custom plugin index](plugin-market.md) pinned to exact Git commits. This is not universal official marketplace inclusion. Actual token savings and a full real Desktop update/restart have not been measured.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# DSH TaskBridge
|
|
2
|
+
|
|
3
|
+
**让 Claude Code 或 Codex 指挥 DSH 完成任务,在 DSH 插件里配置执行所用的 API、模型和思考强度。**
|
|
4
|
+
|
|
5
|
+
你向指挥端说明目标,指挥端负责规划、拆分、派工和审查;DSH 根据插件设置调用执行模型。执行结束后交回结果,有需要修改的地方,指挥端可以续接同一任务对话继续处理。
|
|
6
|
+
|
|
7
|
+
## 在 DSH 中配置执行
|
|
8
|
+
|
|
9
|
+
- 从 DSH 已接入的 API 提供方中选择,无需重复填写接口地址和密钥。
|
|
10
|
+
- 选择执行模型及其支持的思考强度;也可设置任务超时、并发数量和工作区隔离方式。
|
|
11
|
+
- 用一个本机调用总开关控制是否允许派工。新安装默认关闭;安装插件不会自动授权执行。
|
|
12
|
+
- 可选开启额外模型审查,为审查单独选择 API、模型和思考强度;最终是否接收结果仍由指挥端决定。
|
|
13
|
+
- 保存项目级覆盖和非敏感配置预设。具体选项以运行时及模型实际支持能力为准。
|
|
14
|
+
|
|
15
|
+
## 在执行期间减少重复干预
|
|
16
|
+
|
|
17
|
+
`delegate_wait` 在程序内部观察任务。正常执行时保持等待,只在交付、失败、审批、停滞检查或等待上限等节点返回简短信息。连续 5 分钟无新活动时程序自查,10 分钟时请求指挥端判断;阈值可在高级设置中调整。
|
|
18
|
+
|
|
19
|
+
需要更大权限的工具调用会暂停,指挥端根据准确操作和指纹决定单次允许或拒绝,不是默认全部放行。交付后集中审查,修正通过 `continueFromTaskId` 续接原对话与执行工作区。
|
|
20
|
+
|
|
21
|
+
1.3.2 起,新建的 DSH 工作区按实际工作内容命名,例如“制作潘德 G 版装备表”,不再只显示工作树的任务编号。指挥端随派工提交标题,旧客户端则从任务目标提取;续接同一任务时保留原名称与对话。
|
|
22
|
+
|
|
23
|
+
## 连接 Claude Code 与 Codex
|
|
24
|
+
|
|
25
|
+
- **Codex**:设置页提供智能体及 MCP 的安装/修复按钮。智能体名为 `dsh-taskbridge`,更新会迁移未修改的旧智能体,派工规则随安装写入。客户端是否提供输入框 `@` 选择由客户端版本决定。
|
|
26
|
+
- **Claude Code**:通过标准 stdio MCP 连接,参见 [接入说明](claude-code.md)。目前没有一键安装 Claude Code 的按钮,也未进行真实 Claude Code 客户端验收。
|
|
27
|
+
|
|
28
|
+
## 安装、升级和边界
|
|
29
|
+
|
|
30
|
+
项目原名 DSH Delegate,1.3.0 曾使用 DSH TaskDispatch。1.3.1 起统一为 **DSH TaskBridge**,包名为 `dsh-taskbridge`。从旧包升级请先阅读 [更名升级说明](taskbridge-upgrade.md)。在 DSH“添加插件”中输入 `dsh-taskbridge@1.3.2`;中国大陆镜像若尚未同步,改选 npm 官方源。GitHub Release 同时提供安装包。
|
|
31
|
+
|
|
32
|
+
[插件索引与更新说明](plugin-market.md)介绍如何添加索引,在 DSH 的“发现”中搜索本插件。发布自定义索引不代表已进入官方内置市场;DSH 当前需要用户自行添加可信索引。
|
|
33
|
+
|
|
34
|
+
插件并不保证客户端完全零唤醒,实际 token 节省比例尚未量化。Windows 自动测试和临时目录迁移验收不等同于所有平台、完整 Desktop 更新/重启或所有 MCP 客户端均已验收。
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Local delegation switch and legacy grant internals
|
|
2
|
+
|
|
3
|
+
The current DSH plugin uses one persisted `delegationEnabled` switch. A new
|
|
4
|
+
installation starts OFF. When it is OFF, the execution plane refuses new task
|
|
5
|
+
submissions with `DELEGATION_DISABLED` and the engine requests cancellation of
|
|
6
|
+
live tasks. Status, result reads and cancellation remain available. The DSH UI
|
|
7
|
+
updates this switch through the authenticated user plane; MCP has no switch,
|
|
8
|
+
grant, credential or settings write tool and needs no issued token.
|
|
9
|
+
|
|
10
|
+
In switch mode, the user plane does not register the old connection, grant or
|
|
11
|
+
revoke-all routes. The execution plane is registered only on loopback. While the
|
|
12
|
+
switch is ON, any local process that can reach that port may submit a task, so
|
|
13
|
+
this setting is not per-process authentication or a same-user security boundary.
|
|
14
|
+
|
|
15
|
+
## The one exception: `POST /tasks/permission`
|
|
16
|
+
|
|
17
|
+
`delegate_permission_decide` reaches `POST /dsh-delegate/x/tasks/permission`. It is
|
|
18
|
+
the single external verb that answers rather than requests, and it is bounded to
|
|
19
|
+
what is already pending:
|
|
20
|
+
|
|
21
|
+
- it is gated by the switch exactly like a submission (a decision is an
|
|
22
|
+
authorization exercise), and it is refused with `DELEGATION_DISABLED` while the
|
|
23
|
+
switch is OFF;
|
|
24
|
+
- its identity is the authenticated connection (`local-mcp` on the switch path, a
|
|
25
|
+
verified connection on the grant path), never a `connectionId` in the body;
|
|
26
|
+
- it can only settle the caller's OWN task's outstanding request. A task of
|
|
27
|
+
another connection — and an unknown task id — is answered with the same
|
|
28
|
+
`JOB_TASK_NOT_FOUND` and the same details, so the route cannot be used to learn
|
|
29
|
+
which task ids or pending requests exist elsewhere;
|
|
30
|
+
- the engine re-checks `posture()` and the task's own live authorization at the
|
|
31
|
+
decision, so a switch turned off or a revoked grant between the ask and the
|
|
32
|
+
answer refuses the decision instead of applying it;
|
|
33
|
+
- the outcome is `allow-once` (that one native tool call resumes) or `reject`.
|
|
34
|
+
It creates no grant, widens no grant, changes no setting, and is not reusable.
|
|
35
|
+
|
|
36
|
+
What it does NOT add: a token, a signature, a new identity, or a per-process
|
|
37
|
+
boundary. This route is exactly as protected as the rest of the switch-mode plane
|
|
38
|
+
(loopback fence plus the shared local identity), and that is stated honestly rather
|
|
39
|
+
than dressed up as process authentication.
|
|
40
|
+
|
|
41
|
+
The remaining notes document the grant registry retained for compatibility and
|
|
42
|
+
its isolated grant-mode tests. They are not the current product authorization
|
|
43
|
+
contract.
|
|
44
|
+
|
|
45
|
+
## Legacy grant-mode contract
|
|
46
|
+
|
|
47
|
+
The short version of how a delegation authorization is created, kept alive, and
|
|
48
|
+
ended. `src/auth/grants.js` is the only component that decides any of it.
|
|
49
|
+
|
|
50
|
+
## 1. The engine uses two things, not one
|
|
51
|
+
|
|
52
|
+
`JobEngine` (`src/jobs/engine.js`) depends on the registry in exactly two ways.
|
|
53
|
+
|
|
54
|
+
**Subscribe for invalidation.** `AuthorizationRegistry#subscribe` delivers one
|
|
55
|
+
event per authorization that stops being usable for a reason other than "this
|
|
56
|
+
request failed":
|
|
57
|
+
|
|
58
|
+
| event | when |
|
|
59
|
+
| --- | --- |
|
|
60
|
+
| `{kind:'grant', grantId, connectionId, reason:'revoked'}` | operator revoked one grant |
|
|
61
|
+
| `{kind:'grant', grantId, connectionId, reason:'expired'}` | the grant passed `expiresAt`, including a grant a running task already consumed |
|
|
62
|
+
| `{kind:'connection', connectionId, reason:'revoked'}` | operator revoked a connection; its grants are revoked in the same step |
|
|
63
|
+
| `{kind:'connection', connectionId, reason:'lease-expired'}` | the connection's idle lease lapsed |
|
|
64
|
+
| `{kind:'all', reason:'revoked-all'}` | `revokeAll()` — the dispose path |
|
|
65
|
+
|
|
66
|
+
The engine cancels the tasks named by those ids. That is the whole reason
|
|
67
|
+
revocation is a cancellation rather than a promise.
|
|
68
|
+
|
|
69
|
+
**Call `assertTaskAuthorized` while a task runs.** Each progress check re-proves
|
|
70
|
+
four facts: the connection is live, the grant belongs to that connection and
|
|
71
|
+
covers that workspace, and — for a `task` grant — the grant is consumed by
|
|
72
|
+
*this* task id. Only `revokedAt` and `expiresAt` disqualify the grant itself;
|
|
73
|
+
being consumed is the binding being checked, not a refusal. An unconsumed task
|
|
74
|
+
grant yields `GRANT_NOT_CONSUMED`, a grant consumed by someone else yields
|
|
75
|
+
`GRANT_CONSUMED`.
|
|
76
|
+
|
|
77
|
+
Events are emitted once. A grant already announced as revoked is not announced
|
|
78
|
+
again as expired, and a connection already revoked is not re-announced.
|
|
79
|
+
|
|
80
|
+
## 2. The host runs the sweep timer
|
|
81
|
+
|
|
82
|
+
`AUTH_SWEEP_INTERVAL_MS` is 30 seconds. The host calls
|
|
83
|
+
`AuthorizationRegistry#sweep()` on that interval; the registry itself owns no
|
|
84
|
+
timer, so a disposed plugin cannot be woken by one. Each sweep is idempotent and
|
|
85
|
+
does three things:
|
|
86
|
+
|
|
87
|
+
1. revokes connections past their idle lease, with their grants, emitting one
|
|
88
|
+
`connection` event each;
|
|
89
|
+
2. emits one `grant` expiry event for every unrevoked grant past `expiresAt`
|
|
90
|
+
(consumed or not);
|
|
91
|
+
3. deletes grants and connections settled longer than `AUTH_RETENTION_MS`
|
|
92
|
+
(10 minutes) ago.
|
|
93
|
+
|
|
94
|
+
Deletion is measured from the moment of settlement, never from the deadline, so
|
|
95
|
+
an entry that dies during a sweep is still visible for one full retention window.
|
|
96
|
+
A sweep that settles and deletes in the same step would hide the change from the
|
|
97
|
+
operator surface.
|
|
98
|
+
|
|
99
|
+
## 3. MCP heartbeats every 30 seconds
|
|
100
|
+
|
|
101
|
+
The MCP adapter authenticates to the execution plane with
|
|
102
|
+
`Authorization: Bearer <connection token>` on every request. That authentication
|
|
103
|
+
*is* the heartbeat: `authenticate()` is the only path that pushes `lastSeenAt`
|
|
104
|
+
forward.
|
|
105
|
+
|
|
106
|
+
- Default lease: **120 seconds** (`DEFAULT_CONNECTION_LEASE_MS`), overridable per
|
|
107
|
+
registry. With a 30-second heartbeat that tolerates three missed beats.
|
|
108
|
+
- A lapsed token is refused *without* renewal, so a stale token cannot revive
|
|
109
|
+
its own connection.
|
|
110
|
+
- Heartbeat interval = sweep interval = 30 seconds, so a silent connection is
|
|
111
|
+
revoked before the next sweep would need to notice it.
|
|
112
|
+
|
|
113
|
+
## 4. Ordinary reads do not renew the lease
|
|
114
|
+
|
|
115
|
+
`listGrants`, `listConnections`, `isDelegationAuthorized`, `requireSessionGrant`,
|
|
116
|
+
`consumeTaskGrant` and `assertTaskAuthorized` never touch `lastSeenAt`. An
|
|
117
|
+
idle MCP client polling status cannot keep its delegation authorization alive;
|
|
118
|
+
only an authenticated request can. The tests pin this.
|
|
119
|
+
|
|
120
|
+
## 5. Transport fence
|
|
121
|
+
|
|
122
|
+
Before the Bearer token is examined, `src/auth/fence.js` requires a loopback
|
|
123
|
+
peer, a Host header that parses as exactly one authority naming this machine, a
|
|
124
|
+
`Sec-Fetch-Site` of `same-origin`/`none` (or absent), and — when `Origin` is
|
|
125
|
+
present — a same-origin local Origin.
|
|
126
|
+
|
|
127
|
+
`parseRequestAuthority` rejects a Host header outright rather than normalising
|
|
128
|
+
it: no leading/trailing whitespace, no userinfo, path, query, fragment,
|
|
129
|
+
backslash, comma or control character, and no numeric host that the URL parser
|
|
130
|
+
would expand. `127.1`, `2130706433`, `0x7f.0.0.1`, `0177.0.0.1` and
|
|
131
|
+
`127.0.0.256` are all refusals, not `127.0.0.1`.
|
|
132
|
+
|
|
133
|
+
The user plane (`fenceUserPlane`) is deliberately asymmetric: an authenticated
|
|
134
|
+
read (`GET`/`HEAD`) may omit `Origin`, while any write must carry a same-origin
|
|
135
|
+
`Origin` and a JSON content type. This helper is a rule under test; the live
|
|
136
|
+
user plane runs on the native `connection.fetch` carrier, which applies the
|
|
137
|
+
harness's own fence and browser-session authentication, so it does not call this
|
|
138
|
+
function and does not parse HTTP headers itself.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Claude Code 手动接入
|
|
2
|
+
|
|
3
|
+
DSH TaskBridge 提供标准 stdio MCP 服务,Claude Code 可作为指挥端连接它。这里提供配置方法,不代表已经完成真实 Claude Code 客户端验收;目前也没有一键安装 Claude Code 智能体的按钮。
|
|
4
|
+
|
|
5
|
+
## 连接
|
|
6
|
+
|
|
7
|
+
在 Claude Code 支持的 MCP 配置中登记一个 stdio 服务,`command` 指向本机 **Node.js 24 或更高版本的可执行文件**,`args` 只填写本插件实际安装目录里的 `bin/dsh-delegate-mcp.js` 的绝对路径。不要填写 `DeepSeek Harness.exe`,也不要把示例占位符直接复制为实际路径。
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"mcpServers": {
|
|
12
|
+
"dsh-taskbridge": {
|
|
13
|
+
"command": "<Node.js 可执行文件绝对路径>",
|
|
14
|
+
"args": ["<本插件安装目录>/bin/dsh-delegate-mcp.js"],
|
|
15
|
+
"env": {
|
|
16
|
+
"DSH_DELEGATE_DISCOVERY_FILE": "<DSH_HOME>/data/dsh-delegate/runtime-endpoint.json"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
配置文件的位置和作用域按你的 Claude Code 版本选择,参见 [Claude Code 官方 MCP 文档](https://code.claude.com/docs/en/mcp)。端点文件由运行中的插件维护,端口变化时重新发现;无需把 DSH API 密钥写到 Claude Code。
|
|
24
|
+
|
|
25
|
+
## 指挥规则
|
|
26
|
+
|
|
27
|
+
先在 DSH 插件页选好 API、执行模型和思考强度,并开启本机调用开关。向指挥端说明:
|
|
28
|
+
|
|
29
|
+
> 仅在我明确委派的任务中调用 DSH。你负责规划、权限判断和最终审查,DSH 负责实现。先预检授权的源仓库,提交后等待同一 taskId;普通执行期间不要反复读取结果。审批时核对准确操作与指纹,按授权决定单次允许或拒绝。交付后集中审查,有修正则通过 continueFromTaskId 续接原任务,不重复派工或自行接管实现。模型与思考强度以 DSH 插件设置为准。
|
|
30
|
+
|
|
31
|
+
先调用 `delegate_status` 验证连接,再以不修改文件的简短任务试运行。客户端可能提前结束等待,应继续等待原任务;不承诺某个客户端版本的 `@` 选择或完全零唤醒。
|