dsh-collab-pair 1.2.2 → 1.2.3
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 +8 -2
- package/index.js +94 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,7 +61,8 @@ Set `autoNudge: false` to disable reminders.
|
|
|
61
61
|
A project is the set of workers managed by one project-manager conversation. Different managers are different projects, so nothing mixes:
|
|
62
62
|
|
|
63
63
|
- On the first link the project name defaults to the manager conversation title (role prefix removed).
|
|
64
|
-
- Rename it in the manager card or with `collab_project({ name })` / `/collab project {"name":"…"}
|
|
64
|
+
- Rename it in the manager card or with `collab_project({ name })` / `/collab project {"name":"…"}
|
|
65
|
+
/collab create {"name":"前端","preset":"standard"}`; every worker of that manager follows the project.
|
|
65
66
|
- The board groups tasks by project (project name + manager).
|
|
66
67
|
- A worker belongs to exactly one project at a time; unlink it before linking it to another manager.
|
|
67
68
|
|
|
@@ -105,6 +106,7 @@ For an existing conversation, call `collab_sessions` to get its id, then `collab
|
|
|
105
106
|
| --- | --- | --- |
|
|
106
107
|
| `collab_sessions` | anyone | List recent conversations (id / title / activity / link state) |
|
|
107
108
|
| `collab_link` | anyone | Link a worker; `role=worker` makes the current conversation the worker; `peer="new"` creates one; `mode` picks temporary/permanent; `project` names the project |
|
|
109
|
+
| `collab_worker_create` | manager | Create a new worker conversation (name, preset/model), linked automatically; can dispatch the first round |
|
|
108
110
|
| `collab_dispatch` | manager | Dispatch one round; `worker` selects the worker (optional with a single worker), `acceptance` optional |
|
|
109
111
|
| `collab_report` | worker | Report `summary` / `status`(done\|partial\|blocked) / `details` / `next` |
|
|
110
112
|
| `collab_status` | anyone | A manager sees every worker's progress; a worker sees its manager and pending task |
|
|
@@ -124,6 +126,7 @@ The settings page uses it; it can also be typed manually:
|
|
|
124
126
|
/collab link {"peer":"new"}
|
|
125
127
|
/collab link {"peer":"session-…"}
|
|
126
128
|
/collab project {"name":"…"}
|
|
129
|
+
/collab create {"name":"前端","preset":"standard"}
|
|
127
130
|
/collab configure {"worker":"session-…","preset":"ptc"}
|
|
128
131
|
/collab configure {"worker":"session-…","provider":"deepseek-account","model":"deepseek-flash"}
|
|
129
132
|
/collab dispatch {"worker":"session-…","task":"…","acceptance":"…"}
|
|
@@ -233,7 +236,8 @@ dsh plugin add dsh-collab-pair
|
|
|
233
236
|
一个项目就是「一个项目经理对话所管理的员工集合」。不同项目经理就是不同项目,互不混淆:
|
|
234
237
|
|
|
235
238
|
- 第一次关联时,项目名默认取项目经理对话的标题(去掉角色前缀)。
|
|
236
|
-
- 可在项目经理卡片里改名,或用 `collab_project({ name })` / `/collab project {"name":"…"}
|
|
239
|
+
- 可在项目经理卡片里改名,或用 `collab_project({ name })` / `/collab project {"name":"…"}
|
|
240
|
+
/collab create {"name":"前端","preset":"standard"}`;该经理的所有员工会一起归到新项目名。
|
|
237
241
|
- 看板按项目分组(项目名 + 项目经理)。
|
|
238
242
|
- 一个员工同一时间只属于一个项目;要换项目经理,先解除原关联。
|
|
239
243
|
|
|
@@ -273,6 +277,7 @@ dsh plugin add dsh-collab-pair
|
|
|
273
277
|
| --- | --- | --- |
|
|
274
278
|
| `collab_sessions` | 任何人 | 列出最近对话(id / 标题 / 活跃 / 是否已关联) |
|
|
275
279
|
| `collab_link` | 任何人 | 关联员工;`role=worker` 表示当前对话成为对方的员工;`peer="new"` 新建;`mode` 选临时/永久;`project` 指定项目名 |
|
|
280
|
+
| `collab_worker_create` | 项目经理 | 新建员工对话(可命名、设预设/模型),默认自动关联,可顺便派发第一轮 |
|
|
276
281
|
| `collab_dispatch` | 项目经理 | 派发一轮;`worker` 指定员工(只有一个时可省略),`acceptance` 可选 |
|
|
277
282
|
| `collab_report` | 员工 | 汇报 `summary` / `status`(done\|partial\|blocked) / `details` / `next` |
|
|
278
283
|
| `collab_status` | 任何人 | 经理看所有员工进度;员工看自己的经理与待办 |
|
|
@@ -292,6 +297,7 @@ dsh plugin add dsh-collab-pair
|
|
|
292
297
|
/collab link {"peer":"new"}
|
|
293
298
|
/collab link {"peer":"session-…"}
|
|
294
299
|
/collab project {"name":"…"}
|
|
300
|
+
/collab create {"name":"前端","preset":"standard"}
|
|
295
301
|
/collab configure {"worker":"session-…","preset":"ptc"}
|
|
296
302
|
/collab configure {"worker":"session-…","provider":"deepseek-account","model":"deepseek-flash"}
|
|
297
303
|
/collab dispatch {"worker":"session-…","task":"…","acceptance":"…"}
|
package/index.js
CHANGED
|
@@ -231,6 +231,7 @@ const LANGUAGES = {
|
|
|
231
231
|
'',
|
|
232
232
|
'规则:',
|
|
233
233
|
'- 用 `collab_dispatch` 派发任务;有多个员工时用 `worker` 指定员工(sessionId 或标题),只有一个时可省略。',
|
|
234
|
+
'- 需要新的员工对话时用 `collab_worker_create`(可命名、设预设/模型,并自动关联)。',
|
|
234
235
|
'- 需要调整某个员工的 agent 预设或模型时,用 `collab_configure`(worker 指定员工)。',
|
|
235
236
|
'- 收到以【协作回报】开头的消息后,继续派发,或对该员工调用 `collab_done`;`collab_status` 查看全部进度。',
|
|
236
237
|
'- 除非用户明确要求,不要自己执行员工的交付任务;你负责拆解、验收和决定下一步。',
|
|
@@ -369,6 +370,7 @@ const LANGUAGES = {
|
|
|
369
370
|
'',
|
|
370
371
|
'Rules:',
|
|
371
372
|
'- Dispatch a round with `collab_dispatch`; when several workers exist, select one with `worker` (session id or title). With a single worker you may omit it.',
|
|
373
|
+
'- To start a new worker conversation use `collab_worker_create` (name, preset/model, linked automatically).',
|
|
372
374
|
'- To change a worker\'s agent preset or model, use `collab_configure` (select the worker with `worker`).',
|
|
373
375
|
'- When a message starting with [Collaboration report] arrives, dispatch the next round or call `collab_done` for that worker; `collab_status` shows every worker.',
|
|
374
376
|
'- Unless the user explicitly asks, do not do the workers\' delivery work yourself; you break down, review, and decide.',
|
|
@@ -792,14 +794,17 @@ export function apply(ctx, rawConfig) {
|
|
|
792
794
|
}
|
|
793
795
|
|
|
794
796
|
/** Create a fresh worker conversation in the manager's working directory. */
|
|
795
|
-
async function createWorkerSession(callerId, requestedCwd, signal) {
|
|
797
|
+
async function createWorkerSession(callerId, requestedCwd, signal, agentPreset) {
|
|
796
798
|
const controller = ctx.get('sessionController')
|
|
797
799
|
if (controller === undefined) throw new CollabError('当前环境不支持新建对话;请先手动创建一个对话再关联。')
|
|
798
800
|
const callerSession = ctx.sessions.get(callerId)
|
|
799
801
|
const cwd = typeof requestedCwd === 'string' && requestedCwd.trim() !== ''
|
|
800
802
|
? requestedCwd.trim()
|
|
801
803
|
: (callerSession === undefined ? undefined : ctx.get('workingDirectory')?.get(callerSession))
|
|
802
|
-
const created = await controller.create(
|
|
804
|
+
const created = await controller.create({
|
|
805
|
+
...(cwd === undefined ? {} : { cwd }),
|
|
806
|
+
...(typeof agentPreset === 'string' && agentPreset !== '' ? { agentPreset } : {}),
|
|
807
|
+
})
|
|
803
808
|
const sessionId = created?.sessionId
|
|
804
809
|
if (typeof sessionId !== 'string') throw new CollabError('新建对话失败:没有返回 sessionId。')
|
|
805
810
|
const registry = ctx.get('workspaceRegistry')
|
|
@@ -1524,6 +1529,91 @@ export function apply(ctx, rawConfig) {
|
|
|
1524
1529
|
},
|
|
1525
1530
|
})
|
|
1526
1531
|
|
|
1532
|
+
toolExecutors.create = register({
|
|
1533
|
+
name: 'collab_worker_create',
|
|
1534
|
+
description:
|
|
1535
|
+
'创建一个新的员工对话,可命名、设 agent 预设/模型,默认立即关联到当前对话(项目经理)。相当于「新建对话 + collab_link(peer=new)」,也可以顺便派发第一轮任务。',
|
|
1536
|
+
parameters: {
|
|
1537
|
+
type: 'object',
|
|
1538
|
+
properties: {
|
|
1539
|
+
name: { type: 'string', description: '可选:员工名,会作为对话标题(自动加【员工】前缀)。' },
|
|
1540
|
+
cwd: { type: 'string', description: '可选:新对话的工作目录,默认与当前对话相同。' },
|
|
1541
|
+
preset: { type: 'string', description: '可选:agent 预设 id(如 standard / ptc / minimal)。' },
|
|
1542
|
+
provider: { type: 'string', description: '可选:模型供应商 id(配合 model)。' },
|
|
1543
|
+
model: { type: 'string', description: '可选:模型 id。' },
|
|
1544
|
+
reasoningEffort: { type: 'string', description: '可选:推理强度。' },
|
|
1545
|
+
mode: { type: 'string', enum: ['temporary', 'permanent'], description: '关联模式,默认 temporary。' },
|
|
1546
|
+
project: { type: 'string', description: '可选:项目名。' },
|
|
1547
|
+
link: { type: 'boolean', description: '是否立即关联,默认 true。' },
|
|
1548
|
+
task: { type: 'string', description: '可选:创建后立即派发的第一轮任务。' },
|
|
1549
|
+
acceptance: { type: 'string', description: '可选:第一轮验收标准。' },
|
|
1550
|
+
},
|
|
1551
|
+
},
|
|
1552
|
+
async execute(args, exec) {
|
|
1553
|
+
const agent = requireAgent(exec)
|
|
1554
|
+
if (workerAssociation(agent.id) !== undefined) throw new CollabError('当前对话是员工,不能创建或管理员工。')
|
|
1555
|
+
const link = args?.link !== false
|
|
1556
|
+
const task = typeof args?.task === 'string' ? args.task.trim() : ''
|
|
1557
|
+
const acceptance = typeof args?.acceptance === 'string' ? args.acceptance.trim() : ''
|
|
1558
|
+
if (!link && task !== '') throw new CollabError('link=false 时不能派发任务;请先关联再派发。')
|
|
1559
|
+
const presetId = typeof args?.preset === 'string' ? args.preset.trim() : ''
|
|
1560
|
+
if (presetId !== '') {
|
|
1561
|
+
const presets = ctx.get('agentPresets')
|
|
1562
|
+
if (presets === undefined) throw new CollabError('当前环境没有 agentPresets 服务,无法设置预设。')
|
|
1563
|
+
const roster = await presets.list()
|
|
1564
|
+
if (!roster.some((preset) => preset.id === presetId || preset.name === presetId)) {
|
|
1565
|
+
throw new CollabError(`没有预设 "${presetId}";可用:${roster.map((preset) => preset.id).join(' / ')}`)
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
const providerId = typeof args?.provider === 'string' ? args.provider.trim() : ''
|
|
1569
|
+
const modelId = typeof args?.model === 'string' ? args.model.trim() : ''
|
|
1570
|
+
if (modelId !== '' && providerId === '') throw new CollabError('设置模型时还需要 provider。')
|
|
1571
|
+
const name = typeof args?.name === 'string' ? args.name.trim() : ''
|
|
1572
|
+
const sessionId = await createWorkerSession(agent.id, args?.cwd, exec.signal, presetId)
|
|
1573
|
+
let title = null
|
|
1574
|
+
if (name !== '') {
|
|
1575
|
+
const base = stripKnownPrefix(name)
|
|
1576
|
+
title = cfg.addPrefix ? `${cfg.prefixWorker}${base}` : base
|
|
1577
|
+
await renameSession(sessionId, title)
|
|
1578
|
+
}
|
|
1579
|
+
if (modelId !== '') {
|
|
1580
|
+
const controller = ctx.get('sessionController')
|
|
1581
|
+
if (controller === undefined || typeof controller.selectModel !== 'function') throw new CollabError('当前环境缺少 sessionController,无法设置模型。')
|
|
1582
|
+
const effort = typeof args?.reasoningEffort === 'string' ? args.reasoningEffort.trim() : ''
|
|
1583
|
+
await controller.selectModel({
|
|
1584
|
+
sessionId,
|
|
1585
|
+
provider: providerId,
|
|
1586
|
+
model: modelId,
|
|
1587
|
+
...(effort === '' ? {} : { reasoningEffort: effort }),
|
|
1588
|
+
})
|
|
1589
|
+
}
|
|
1590
|
+
let linked = null
|
|
1591
|
+
if (link) {
|
|
1592
|
+
linked = await toolExecutors.link.execute({
|
|
1593
|
+
peer: sessionId,
|
|
1594
|
+
mode: args?.mode === 'permanent' ? 'permanent' : 'temporary',
|
|
1595
|
+
...(typeof args?.project === 'string' && args.project.trim() !== '' ? { project: args.project.trim() } : {}),
|
|
1596
|
+
}, { agent, signal: exec.signal })
|
|
1597
|
+
}
|
|
1598
|
+
let receipt = null
|
|
1599
|
+
if (linked !== null && task !== '') {
|
|
1600
|
+
receipt = await toolExecutors.dispatch.execute({ task, acceptance, worker: sessionId }, { agent, signal: exec.signal })
|
|
1601
|
+
}
|
|
1602
|
+
return {
|
|
1603
|
+
ok: true,
|
|
1604
|
+
sessionId,
|
|
1605
|
+
title,
|
|
1606
|
+
linked: linked !== null,
|
|
1607
|
+
...(linked === null ? {} : { linkId: linked.linkId, mode: linked.mode, project: managerProjectName(agent.id) || null }),
|
|
1608
|
+
...(receipt === null ? {} : { round: receipt.round }),
|
|
1609
|
+
message: linked === null
|
|
1610
|
+
? `已创建员工对话 ${sessionId}(未关联)。`
|
|
1611
|
+
: `已创建并关联员工 ${sessionId}${title === null ? '' : `(${title})`}${receipt === null ? '' : `,第 ${receipt.round} 轮任务已派发`}。`,
|
|
1612
|
+
}
|
|
1613
|
+
},
|
|
1614
|
+
when: ({ agent }) => workerAssociation(agent.id) === undefined,
|
|
1615
|
+
})
|
|
1616
|
+
|
|
1527
1617
|
toolExecutors.dispatch = register({
|
|
1528
1618
|
name: 'collab_dispatch',
|
|
1529
1619
|
description:
|
|
@@ -1967,6 +2057,7 @@ export function apply(ctx, rawConfig) {
|
|
|
1967
2057
|
const actions = {
|
|
1968
2058
|
status: 'status',
|
|
1969
2059
|
link: 'link',
|
|
2060
|
+
create: 'create',
|
|
1970
2061
|
dispatch: 'dispatch',
|
|
1971
2062
|
configure: 'configure',
|
|
1972
2063
|
project: 'project',
|
|
@@ -1978,7 +2069,7 @@ export function apply(ctx, rawConfig) {
|
|
|
1978
2069
|
name: 'collab',
|
|
1979
2070
|
description: '双对话协作:查看全部任务、关联员工、设置项目名、配置预设与语言、派发任务、收尾或解除。',
|
|
1980
2071
|
input: {
|
|
1981
|
-
hint: 'tasks | status | link --peer <id|new> | project --name <项目名> | configure --preset <id> | language <zh|en> | dispatch --worker <id> --task ... | done --worker <id> --summary ... | unlink --worker <id>',
|
|
2072
|
+
hint: 'tasks | status | link --peer <id|new> | create --name <名字> --preset <id> | project --name <项目名> | configure --preset <id> | language <zh|en> | dispatch --worker <id> --task ... | done --worker <id> --summary ... | unlink --worker <id>',
|
|
1982
2073
|
},
|
|
1983
2074
|
handler: async (invocation) => {
|
|
1984
2075
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-collab-pair",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "For large projects: link a project-manager conversation with one or more worker conversations (temporary links unbind when done, permanent links stay until unlinked), group managers and workers by project, dispatch each round from the manager instead of repeating prompts, relay results automatically, and keep unattended runs moving with a visual task board.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|