dsh-collab-pair 0.0.0-stage → 1.0.1
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 +21 -0
- package/README.md +254 -2
- package/client.js +481 -0
- package/cordis.patch.yml +11 -0
- package/icon.svg +24 -0
- package/index.js +1612 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +46 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 dsh-collab-pair contributors
|
|
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
CHANGED
|
@@ -1,3 +1,255 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-collab-pair
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> A DSH plugin that links one project-manager conversation to one or more worker conversations. Every worker result is relayed back automatically, and a task board shows all collaborations with their live working state.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
dsh plugin add dsh-collab-pair
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or install `dsh-collab-pair` from the DSH plugin manager, refresh the page, and open **Settings → Collaboration pair**. The settings UI ships English and Chinese and follows the app language.
|
|
12
|
+
|
|
13
|
+
**The plugin only links conversations.** Goals, task breakdown, and acceptance criteria stay with the project manager; the plugin never asks for them again.
|
|
14
|
+
|
|
15
|
+
One manager can run several workers, each with its own round counter:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
Project manager (owns the goal, breakdown, acceptance)
|
|
19
|
+
│ collab_dispatch(worker="A") — round N
|
|
20
|
+
▼
|
|
21
|
+
Worker A / Worker B / … (execute the task, then collab_report)
|
|
22
|
+
│ the worker turn ends → the plugin captures report + final output
|
|
23
|
+
▼
|
|
24
|
+
Manager receives a collaboration report → next round for that worker, or collab_done
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Visual settings page
|
|
28
|
+
|
|
29
|
+
**Settings → Collaboration pair**, top to bottom:
|
|
30
|
+
|
|
31
|
+
1. **Working conversation** — the conversation to act on (defaults to the open one).
|
|
32
|
+
2. **Current conversation · <title>** — this conversation's own links and status first:
|
|
33
|
+
- Project manager: the workers it manages (state, round, current task, latest report, unlink) plus a form to link another worker.
|
|
34
|
+
- Worker: its manager, current task, state, latest report, and a "Leave" action.
|
|
35
|
+
- Not linked: the link form.
|
|
36
|
+
3. **All tasks** — a board across every collaboration. Each row shows the worker, its manager, round, **working state** (`Working` / `Waiting for report` / `Idle` / `Finished`), waiting time, current task, and latest report. Refresh re-reads it.
|
|
37
|
+
|
|
38
|
+
The page only links, unlinks, and reports status. Goals, tasks, and acceptance stay in the manager conversation.
|
|
39
|
+
|
|
40
|
+
## Title prefixes
|
|
41
|
+
|
|
42
|
+
Linking adds a prefix to both conversations and removes it when the link ends (or the last worker finishes):
|
|
43
|
+
|
|
44
|
+
- Manager: `【项目经理】<title>`
|
|
45
|
+
- Worker: `【员工】<title>`
|
|
46
|
+
|
|
47
|
+
The prefix text is configurable and can be turned off.
|
|
48
|
+
|
|
49
|
+
## Quick start
|
|
50
|
+
|
|
51
|
+
1. Open the conversation that should manage the project and say:
|
|
52
|
+
|
|
53
|
+
> Link a worker. The goal is to finish XXX. Dispatch round one: …
|
|
54
|
+
|
|
55
|
+
The model calls `collab_link({ peer: "new" })` and `collab_dispatch({ task: "…" })`.
|
|
56
|
+
|
|
57
|
+
2. Link a second worker the same way. With several workers, dispatch with `worker`:
|
|
58
|
+
|
|
59
|
+
> Dispatch to worker B: … (worker="session-…")
|
|
60
|
+
|
|
61
|
+
3. Worker results come back automatically. Continue with `collab_dispatch`, or close that worker with `collab_done({ worker, summary })`.
|
|
62
|
+
|
|
63
|
+
For an existing conversation, call `collab_sessions` to get its id, then `collab_link({ peer: "<sessionId>" })`.
|
|
64
|
+
|
|
65
|
+
## Tools
|
|
66
|
+
|
|
67
|
+
| Tool | Role | Purpose |
|
|
68
|
+
| --- | --- | --- |
|
|
69
|
+
| `collab_sessions` | anyone | List recent conversations (id / title / activity / link state) |
|
|
70
|
+
| `collab_link` | anyone | Link a worker; `role=worker` makes the current conversation the worker; `peer="new"` creates one |
|
|
71
|
+
| `collab_dispatch` | manager | Dispatch one round; `worker` selects the worker (optional with a single worker), `acceptance` optional |
|
|
72
|
+
| `collab_report` | worker | Report `summary` / `status`(done\|partial\|blocked) / `details` / `next` |
|
|
73
|
+
| `collab_status` | anyone | A manager sees every worker's progress; a worker sees its manager and pending task |
|
|
74
|
+
| `collab_configure` | manager | Set a worker's agent preset or model; without arguments it lists available presets |
|
|
75
|
+
| `collab_done` | manager | Finish one worker (or `all=true`) |
|
|
76
|
+
| `collab_unlink` | both | Remove a link; a manager uses `worker` or `all`, a worker leaves its own |
|
|
77
|
+
|
|
78
|
+
## `/collab` command
|
|
79
|
+
|
|
80
|
+
The settings page uses it; it can also be typed manually:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
/collab tasks
|
|
84
|
+
/collab status
|
|
85
|
+
/collab link {"peer":"new"}
|
|
86
|
+
/collab link {"peer":"session-…"}
|
|
87
|
+
/collab configure {"worker":"session-…","preset":"ptc"}
|
|
88
|
+
/collab configure {"worker":"session-…","provider":"deepseek-account","model":"deepseek-flash"}
|
|
89
|
+
/collab dispatch {"worker":"session-…","task":"…","acceptance":"…"}
|
|
90
|
+
/collab done {"worker":"session-…","summary":"…"}
|
|
91
|
+
/collab done {"all":true,"summary":"…"}
|
|
92
|
+
/collab unlink {"worker":"session-…"}
|
|
93
|
+
/collab unlink {"all":true}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`--key value` flags are accepted too: `/collab link --peer new`. `/collab tasks` returns the board data (all links plus live state).
|
|
97
|
+
|
|
98
|
+
## Configuration
|
|
99
|
+
|
|
100
|
+
The `collab-pair` row in `cordis.patch.yml`:
|
|
101
|
+
|
|
102
|
+
```yaml
|
|
103
|
+
- id: collab-pair
|
|
104
|
+
name: 'dsh-collab-pair'
|
|
105
|
+
config:
|
|
106
|
+
maxRounds: 20 # rounds per worker
|
|
107
|
+
maxRelayChars: 12000 # max characters of the worker's final output in a relay
|
|
108
|
+
maxHistory: 20 # recent rounds kept per worker
|
|
109
|
+
notifyWorkerOnDone: true # tell the worker to stop when the link is finished
|
|
110
|
+
autoRelay: true # false records the report without delivering it
|
|
111
|
+
addPrefix: true # add the title prefix to linked conversations
|
|
112
|
+
prefixManager: '【项目经理】'
|
|
113
|
+
prefixWorker: '【员工】'
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Persistence
|
|
117
|
+
|
|
118
|
+
One record per worker lives in `$DSH_HOME/storages/collab_pair.json` (storage-domain `collab_pair`, table `links`). Links survive plugin reloads and DSH restarts; without the storage service the plugin falls back to memory and `collab_status.storage` reports `memory`.
|
|
119
|
+
|
|
120
|
+
## Limits
|
|
121
|
+
|
|
122
|
+
- A worker conversation belongs to one collaboration at a time; a manager can own several workers.
|
|
123
|
+
- A conversation cannot be both manager and worker.
|
|
124
|
+
- Worker conversations need a configured model (new conversations inherit the deployment default).
|
|
125
|
+
- Relayed results arrive as user messages in the manager conversation, with a report header and round marker. The generated message text is Chinese in this release; the settings UI is English.
|
|
126
|
+
- With a PTC preset the worker calls `collab_report` inside `run_code`; the plugin still reads the structured report.
|
|
127
|
+
- A new worker has no title until its first message; the prefix is applied once the title exists.
|
|
128
|
+
- The board is a snapshot on Refresh (working state comes from the agent status at that moment). It does not poll, which keeps command records out of the session log.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
# 中文说明
|
|
133
|
+
|
|
134
|
+
> DSH 插件:一个项目经理对话管理多个员工对话,任务自动流转,并提供全部任务看板。
|
|
135
|
+
|
|
136
|
+
## 安装
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
dsh plugin add dsh-collab-pair
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
或在 DSH 的插件管理里用包名 `dsh-collab-pair` 安装。安装后刷新页面,在 **设置 → 双对话协作** 打开。界面中英文跟随应用语言。
|
|
143
|
+
|
|
144
|
+
**插件只做一件事:把员工对话关联到项目经理对话。** 目标、任务拆解、验收标准都由项目经理在对话里掌握,插件不重复收集。
|
|
145
|
+
|
|
146
|
+
一个项目经理可以同时管理**多个员工**,每个员工各自跑自己的轮次:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
项目经理(掌握目标、拆解、验收)
|
|
150
|
+
│ collab_dispatch(worker="员工A") 派发第 N 轮
|
|
151
|
+
▼
|
|
152
|
+
员工A / 员工B / …(各自执行、collab_report 汇报)
|
|
153
|
+
│ 该员工本轮 turn 结束 → 插件抓取「汇报 + 最终产出」
|
|
154
|
+
▼
|
|
155
|
+
项目经理收到【协作回报】→ 决定该员工的下一轮,或 collab_done 收尾
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## 可视化设置页
|
|
159
|
+
|
|
160
|
+
**设置 → 双对话协作**,从上到下:
|
|
161
|
+
|
|
162
|
+
1. **工作会话**:选择要操作的对话(默认当前打开的对话)。
|
|
163
|
+
2. **当前会话 · <标题>**:先看**这个对话自己的**关联与状态。
|
|
164
|
+
- 是项目经理:列出它管理的员工(状态、轮次、本轮任务、最近回报、解除),并可继续**关联员工**。
|
|
165
|
+
- 是员工:显示项目经理、当前任务、状态与最近回报,可**退出协作**。
|
|
166
|
+
- 无关联:直接显示关联表单。
|
|
167
|
+
3. **全部任务**:所有协作的任务看板,不限当前会话。每行显示员工、所属项目经理、第几轮、**工作状态**(`工作中` / `等待回报` / `空闲` / `已结束`)、等待时长、本轮任务、最近回报。点「刷新」重新读取。
|
|
168
|
+
|
|
169
|
+
页面只做关联/解除和查看,不代填目标、任务、验收——这些交给项目经理对话。
|
|
170
|
+
|
|
171
|
+
## 标题前缀
|
|
172
|
+
|
|
173
|
+
关联时自动给两个对话加前缀,解除(或最后一个员工结束时)自动去掉:
|
|
174
|
+
|
|
175
|
+
- 项目经理:`【项目经理】对话标题`
|
|
176
|
+
- 员工:`【员工】对话标题`
|
|
177
|
+
|
|
178
|
+
可在配置里改文字或关掉(见下)。
|
|
179
|
+
|
|
180
|
+
## 快速开始
|
|
181
|
+
|
|
182
|
+
1. 打开一个对话作为项目经理,对它说:
|
|
183
|
+
> 关联一个员工,目标是把 XXX 做完,先派发第一轮:……
|
|
184
|
+
模型会 `collab_link({ peer: "new" })` + `collab_dispatch({ task: "…" })`。
|
|
185
|
+
2. 再关联第二个员工时,同一句即可;派发时用 `worker` 指定是谁:
|
|
186
|
+
|
|
187
|
+
> 给员工 B 派发:……(worker="session-…")
|
|
188
|
+
3. 员工完成后产出自动回传,项目经理继续或 `collab_done({ worker, summary })` 收尾。
|
|
189
|
+
|
|
190
|
+
已有对话:先 `collab_sessions` 拿到 sessionId,再 `collab_link({ peer: "<sessionId>" })`。
|
|
191
|
+
|
|
192
|
+
## 工具
|
|
193
|
+
|
|
194
|
+
| 工具 | 角色 | 作用 |
|
|
195
|
+
| --- | --- | --- |
|
|
196
|
+
| `collab_sessions` | 任何人 | 列出最近对话(id / 标题 / 活跃 / 是否已关联) |
|
|
197
|
+
| `collab_link` | 任何人 | 关联员工;`role=worker` 表示当前对话成为对方的员工;`peer="new"` 新建员工 |
|
|
198
|
+
| `collab_dispatch` | 项目经理 | 派发一轮;`worker` 指定员工(只有一个时可省略),`acceptance` 可选 |
|
|
199
|
+
| `collab_report` | 员工 | 汇报 `summary` / `status`(done\|partial\|blocked) / `details` / `next` |
|
|
200
|
+
| `collab_status` | 任何人 | 经理看所有员工进度;员工看自己的经理与待办 |
|
|
201
|
+
| `collab_configure` | 项目经理 | 设置某个员工的 agent 预设或模型;不传参数时列出可用预设 |
|
|
202
|
+
| `collab_done` | 项目经理 | 结束某个员工的协作;`all=true` 结束全部 |
|
|
203
|
+
| `collab_unlink` | 双方 | 删除关联;经理用 `worker` 或 `all`,员工解除自己 |
|
|
204
|
+
|
|
205
|
+
## `/collab` 命令
|
|
206
|
+
|
|
207
|
+
设置页通过它操作,也可以手动输入:
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
/collab tasks
|
|
211
|
+
/collab status
|
|
212
|
+
/collab link {"peer":"new"}
|
|
213
|
+
/collab link {"peer":"session-…"}
|
|
214
|
+
/collab configure {"worker":"session-…","preset":"ptc"}
|
|
215
|
+
/collab configure {"worker":"session-…","provider":"deepseek-account","model":"deepseek-flash"}
|
|
216
|
+
/collab dispatch {"worker":"session-…","task":"…","acceptance":"…"}
|
|
217
|
+
/collab done {"worker":"session-…","summary":"…"}
|
|
218
|
+
/collab done {"all":true,"summary":"…"}
|
|
219
|
+
/collab unlink {"worker":"session-…"}
|
|
220
|
+
/collab unlink {"all":true}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
也支持 `--key value`:`/collab link --peer new`。`/collab tasks` 返回看板数据(所有关联 + 运行状态)。
|
|
224
|
+
|
|
225
|
+
## 配置
|
|
226
|
+
|
|
227
|
+
`cordis.patch.yml` 的 `collab-pair` 行:
|
|
228
|
+
|
|
229
|
+
```yaml
|
|
230
|
+
- id: collab-pair
|
|
231
|
+
name: 'dsh-collab-pair'
|
|
232
|
+
config:
|
|
233
|
+
maxRounds: 20 # 每个员工最多派发多少轮
|
|
234
|
+
maxRelayChars: 12000 # 回传时最终产出的最大字符数
|
|
235
|
+
maxHistory: 20 # 每个员工保留的最近轮次
|
|
236
|
+
notifyWorkerOnDone: true # done 时通知员工停止
|
|
237
|
+
autoRelay: true # false 时只记录、不自动投递
|
|
238
|
+
addPrefix: true # 是否给关联对话加标题前缀
|
|
239
|
+
prefixManager: '【项目经理】'
|
|
240
|
+
prefixWorker: '【员工】'
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
## 持久化
|
|
244
|
+
|
|
245
|
+
每个员工一条记录,存在 `$DSH_HOME/storages/collab_pair.json`(storage-domain 的 `collab_pair` 域,表 `links`)。插件重载、DSH 重启后自动恢复;存储不可用时退回内存模式,`collab_status` 的 `storage` 字段会显示 `memory`。
|
|
246
|
+
|
|
247
|
+
## 限制
|
|
248
|
+
|
|
249
|
+
- 员工对话同时只能属于一个协作;项目经理可以关联多个员工。
|
|
250
|
+
- 一个对话不能同时是项目经理和员工。
|
|
251
|
+
- 员工对话需要已配置模型(新建对话继承部署默认模型)。
|
|
252
|
+
- 回传以用户消息形式进入项目经理对话(带【协作回报】标题与轮次标记)。本版本生成的消息文本为中文,设置页支持英文。
|
|
253
|
+
- 员工用 PTC 预设时 `collab_report` 会在 `run_code` 里调用,插件仍能读到结构化汇报。
|
|
254
|
+
- 新建员工在产生第一条消息前没有标题,前缀会在它第一轮结束拿到标题后补上。
|
|
255
|
+
- 看板是点「刷新」时的快照(`工作中`/`等待回报` 来自当时的 agent 状态),不做轮询,避免往会话日志里反复写命令记录。
|