dsh-collab-pair 1.4.2 → 1.4.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 +18 -2
- package/client.js +3 -3
- package/index.js +50 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,15 @@ Manager receives a collaboration report → next round for that worker, or colla
|
|
|
39
39
|
4. **Cross-device** — relay mode (off / self-hosted hub / free ntfy.sh), URL, room, token and device name; save/test, connection status, worker alias registration, and remote-worker linking.
|
|
40
40
|
5. **Stage queue** (manager only) — pick a worker, add a stage title/prompt/acceptance, then start it, complete it (auto-dispatches the next), or remove a pending one.
|
|
41
41
|
|
|
42
|
-
Right-click a conversation in the sidebar and choose **Set as project manager (
|
|
42
|
+
Right-click a conversation in the sidebar and choose **Set as project manager (start)**: the plugin creates and links a starter worker, then sends that conversation a manager-mode instruction to create more workers itself and delegate the execution.
|
|
43
|
+
|
|
44
|
+
### Manager mode
|
|
45
|
+
|
|
46
|
+
Once a conversation is a manager, its prompt tells it to:
|
|
47
|
+
|
|
48
|
+
- create workers itself with `collab_worker_create` instead of waiting for the human to do it;
|
|
49
|
+
- delegate execution and keep its own context for reviewing reports and dispatching again — it should not spend a long turn doing a worker's job;
|
|
50
|
+
- confirm the project goal before creating workers and dispatching the first stage.
|
|
43
51
|
|
|
44
52
|
The manager card also shows the **project name** and lets you rename it.
|
|
45
53
|
|
|
@@ -283,7 +291,15 @@ dsh plugin add dsh-collab-pair
|
|
|
283
291
|
4. **跨设备协作**:中继模式(关闭 / 自建 hub / 免费 ntfy.sh)、URL、房间、令牌、设备名;保存/测试、连接状态、员工别名注册、远端员工关联。
|
|
284
292
|
5. **阶段队列**(仅项目经理):选员工,填标题/提示词/验收标准;可开始、完成并自动派发下一阶段、删除待开始阶段。
|
|
285
293
|
|
|
286
|
-
|
|
294
|
+
在侧栏右键一个对话,选「设为项目经理并启动」:插件会新建并关联一个起始员工,然后给该对话发一条「项目经理模式」指令,让它自己创建更多员工并把执行工作派出去。
|
|
295
|
+
|
|
296
|
+
### 项目经理模式
|
|
297
|
+
|
|
298
|
+
对话成为项目经理后,提示词会要求它:
|
|
299
|
+
|
|
300
|
+
- 需要人干活时自己用 `collab_worker_create` 创建员工,不等待用户手动新建;
|
|
301
|
+
- 把执行交给员工,自己的上下文留给验收和继续派发——不要花长时间亲自做员工的活;
|
|
302
|
+
- 创建员工和派发第一阶段之前,先确认项目目标。
|
|
287
303
|
|
|
288
304
|
页面只做关联/解除和查看,不代填目标、任务、验收——这些交给项目经理对话。
|
|
289
305
|
|
package/client.js
CHANGED
|
@@ -138,7 +138,7 @@ window.__ModuleLoader__.load({
|
|
|
138
138
|
stageStart: '开始',
|
|
139
139
|
stageComplete: '完成并发下一阶段',
|
|
140
140
|
stageRemove: '删除',
|
|
141
|
-
menuSetManager: '
|
|
141
|
+
menuSetManager: '设为项目经理并启动',
|
|
142
142
|
menuWorkerName: '新员工名字',
|
|
143
143
|
menuFailed: '创建员工失败',
|
|
144
144
|
},
|
|
@@ -274,7 +274,7 @@ window.__ModuleLoader__.load({
|
|
|
274
274
|
stageStart: 'Start',
|
|
275
275
|
stageComplete: 'Complete and dispatch next',
|
|
276
276
|
stageRemove: 'Remove',
|
|
277
|
-
menuSetManager: 'Set as project manager (
|
|
277
|
+
menuSetManager: 'Set as project manager (start)',
|
|
278
278
|
menuWorkerName: 'New worker name',
|
|
279
279
|
menuFailed: 'Could not create the worker',
|
|
280
280
|
},
|
|
@@ -1279,7 +1279,7 @@ window.__ModuleLoader__.load({
|
|
|
1279
1279
|
const name = typeof answer === 'string' ? answer.trim() : ''
|
|
1280
1280
|
setBusy(true)
|
|
1281
1281
|
try {
|
|
1282
|
-
await runCommand(commands, sessionId, `/collab
|
|
1282
|
+
await runCommand(commands, sessionId, `/collab manage ${JSON.stringify(name === '' ? {} : { name })}`)
|
|
1283
1283
|
} catch (cause) {
|
|
1284
1284
|
const detail = cause instanceof Error ? cause.message : String(cause)
|
|
1285
1285
|
if (typeof window.alert === 'function') window.alert(`${boundT('menuFailed')}\n${detail}`)
|
package/index.js
CHANGED
|
@@ -41,7 +41,7 @@ const DONE = 'done'
|
|
|
41
41
|
const STOPPED = 'stopped'
|
|
42
42
|
const REPORTS = new Set(['done', 'partial', 'blocked'])
|
|
43
43
|
const PROMPT_TIMEOUT_MS = 180000
|
|
44
|
-
const ENGINE = 'collab-pair/1.4.
|
|
44
|
+
const ENGINE = 'collab-pair/1.4.3'
|
|
45
45
|
|
|
46
46
|
/** A recoverable failure whose message is meant for the model. */
|
|
47
47
|
class CollabError extends Error {}
|
|
@@ -270,17 +270,17 @@ const LANGUAGES = {
|
|
|
270
270
|
return [
|
|
271
271
|
'## 双对话协作 · 你是项目经理',
|
|
272
272
|
...(project ? [`项目:${project}`] : []),
|
|
273
|
-
`你正在协调 ${count}
|
|
273
|
+
`你正在协调 ${count} 个员工对话。默认由你自主创建员工并把执行工作派出去;项目目标、拆解与验收标准由你掌握。`,
|
|
274
274
|
'员工:',
|
|
275
275
|
...rows,
|
|
276
276
|
'',
|
|
277
277
|
'规则:',
|
|
278
|
+
'- 默认自主创建员工:需要人干活时,先用 `collab_worker_create` 建立合适的员工(可按角色建多个),再派发;不要等用户手动新建。',
|
|
279
|
+
'- 不要自己承担员工的具体执行工作。你负责拆解、派发、验收和决定下一步;自己动手只限于规划、审阅和必要协调,避免因长时间执行而错过员工回报。',
|
|
278
280
|
'- 用 `collab_dispatch` 派发任务;有多个员工时用 `worker` 指定员工(sessionId 或标题),只有一个时可省略。',
|
|
279
|
-
'- 需要新的员工对话时用 `collab_worker_create`(可命名、设预设/模型,并自动关联)。',
|
|
280
281
|
'- 阶段队列:用 `collab_stage` 添加/查看;当前阶段验收通过后调用 `collab_stage({action:"complete"})`,会自动派发下一阶段。',
|
|
282
|
+
'- 收到【协作回报】后尽快验收并继续派发;保持自己的上下文轻量,细节让员工在回报里给出摘要。',
|
|
281
283
|
'- 需要调整某个员工的 agent 预设或模型时,用 `collab_configure`(worker 指定员工)。',
|
|
282
|
-
'- 收到以【协作回报】开头的消息后,继续派发,或对该员工调用 `collab_done`;`collab_status` 查看全部进度。',
|
|
283
|
-
'- 除非用户明确要求,不要自己执行员工的交付任务;你负责拆解、验收和决定下一步。',
|
|
284
284
|
maxRounds > 0 ? `- 每个员工最多 ${maxRounds} 轮。` : '- 不限制轮次,直到你调用 collab_done 收尾。',
|
|
285
285
|
].join('\n')
|
|
286
286
|
},
|
|
@@ -410,17 +410,17 @@ const LANGUAGES = {
|
|
|
410
410
|
return [
|
|
411
411
|
'## Collaboration pair · You are the project manager',
|
|
412
412
|
...(project ? [`Project: ${project}`] : []),
|
|
413
|
-
`You coordinate ${count} worker conversations.
|
|
413
|
+
`You coordinate ${count} worker conversations. By default you create workers yourself and delegate the execution; you own the project goal, breakdown and acceptance criteria.`,
|
|
414
414
|
'Workers:',
|
|
415
415
|
...rows,
|
|
416
416
|
'',
|
|
417
417
|
'Rules:',
|
|
418
|
+
'- Create workers by default: when work needs doing, use `collab_worker_create` to make the right worker(s) (multiple roles if needed), then dispatch. Do not wait for the user to create them manually.',
|
|
419
|
+
'- Do not do the workers\' execution work yourself. You break down, dispatch, review and decide; your own hands-on work should be limited to planning, review and necessary coordination, so a long execution does not make you miss worker reports.',
|
|
418
420
|
'- 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.',
|
|
419
|
-
'- To start a new worker conversation use `collab_worker_create` (name, preset/model, linked automatically).',
|
|
420
421
|
'- Stage queue: manage it with `collab_stage`; when the current stage passes acceptance, call `collab_stage({action:"complete"})` to dispatch the next stage automatically.',
|
|
422
|
+
'- When a [Collaboration report] arrives, review it quickly and dispatch again; keep your own context light and let workers summarise details in their reports.',
|
|
421
423
|
'- To change a worker\'s agent preset or model, use `collab_configure` (select the worker with `worker`).',
|
|
422
|
-
'- When a message starting with [Collaboration report] arrives, dispatch the next round or call `collab_done` for that worker; `collab_status` shows every worker.',
|
|
423
|
-
'- Unless the user explicitly asks, do not do the workers\' delivery work yourself; you break down, review, and decide.',
|
|
424
424
|
maxRounds > 0 ? `- At most ${maxRounds} rounds per worker.` : '- Rounds are unlimited; continue until you call collab_done.',
|
|
425
425
|
].join('\n')
|
|
426
426
|
},
|
|
@@ -2908,7 +2908,7 @@ export function apply(ctx, rawConfig) {
|
|
|
2908
2908
|
name: 'collab',
|
|
2909
2909
|
description: '双对话协作:查看全部任务、关联员工、阶段队列、跨设备中继、设置项目名、配置预设与语言、派发任务、收尾或解除。',
|
|
2910
2910
|
input: {
|
|
2911
|
-
hint: 'tasks | status | link --peer <id|new> | create --name <名字> | stage --action add --prompt ... | relay --action set --mode hub|ntfy | remote --action link --device <名> --worker <别名> | project --name <项目名> | dispatch --worker <id> --task ... | done --worker <id> --summary ...',
|
|
2911
|
+
hint: 'tasks | status | link --peer <id|new> | create --name <名字> | manage --name <名字> | stage --action add --prompt ... | relay --action set --mode hub|ntfy | remote --action link --device <名> --worker <别名> | project --name <项目名> | dispatch --worker <id> --task ... | done --worker <id> --summary ...',
|
|
2912
2912
|
},
|
|
2913
2913
|
handler: async (invocation) => {
|
|
2914
2914
|
try {
|
|
@@ -2916,6 +2916,46 @@ export function apply(ctx, rawConfig) {
|
|
|
2916
2916
|
if (action === 'tasks' || action === 'board') {
|
|
2917
2917
|
return { kind: 'success', text: JSON.stringify(await tasksBoard()) }
|
|
2918
2918
|
}
|
|
2919
|
+
if (action === 'manage') {
|
|
2920
|
+
const agent = invocation.agent
|
|
2921
|
+
if (agent === undefined) return { kind: 'error', text: '无法确定当前对话。' }
|
|
2922
|
+
if (workerAssociation(agent.id) !== undefined) return { kind: 'error', text: '当前对话是员工,不能设为项目经理。' }
|
|
2923
|
+
let worker = null
|
|
2924
|
+
if (usableManagerLinks(agent.id).length === 0) {
|
|
2925
|
+
try {
|
|
2926
|
+
const created = await toolExecutors.create.execute(
|
|
2927
|
+
{ name: typeof args?.name === 'string' ? args.name : '', mode: 'temporary' },
|
|
2928
|
+
{ agent, signal: invocation.signal },
|
|
2929
|
+
)
|
|
2930
|
+
worker = created.sessionId
|
|
2931
|
+
} catch (error) {
|
|
2932
|
+
return { kind: 'error', text: error instanceof Error ? error.message : String(error) }
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
const text = cfg.language === 'en'
|
|
2936
|
+
? [
|
|
2937
|
+
'[Project manager mode]',
|
|
2938
|
+
'You have been set as the project manager. By default you create workers yourself and delegate the execution.',
|
|
2939
|
+
'',
|
|
2940
|
+
'- When work needs doing, use `collab_worker_create` to make the right worker(s) (multiple roles if needed), then `collab_dispatch`.',
|
|
2941
|
+
'- Do not do the workers\' execution work yourself; keep your context for reviewing reports and dispatching again, so a long execution does not make you miss worker reports.',
|
|
2942
|
+
'- Confirm the project goal first; if the user has not given one, ask before creating workers and dispatching the first stage.',
|
|
2943
|
+
].join('\n')
|
|
2944
|
+
: [
|
|
2945
|
+
'【项目经理模式】',
|
|
2946
|
+
'你已被设为项目经理。默认由你自主创建员工,并把执行工作派给员工。',
|
|
2947
|
+
'',
|
|
2948
|
+
'- 需要执行时,先用 `collab_worker_create` 创建合适的员工(可以按角色建多个),再用 `collab_dispatch` 派发。',
|
|
2949
|
+
'- 不要自己承担员工的具体执行工作;把上下文留给验收和继续派发,避免因长时间自己干活而错过员工回报。',
|
|
2950
|
+
'- 先确认项目目标;如果用户还没给目标,先问清楚,再创建员工并派发第一阶段。',
|
|
2951
|
+
].join('\n')
|
|
2952
|
+
try {
|
|
2953
|
+
await deliver(agent.id, text, `cp-manage-${randomUUID().slice(0, 8)}`, 'queue', AbortSignal.timeout(PROMPT_TIMEOUT_MS))
|
|
2954
|
+
} catch (error) {
|
|
2955
|
+
return { kind: 'error', text: `项目经理已设置,但启动提示投递失败:${deliveryFailure(error)}` }
|
|
2956
|
+
}
|
|
2957
|
+
return { kind: 'success', text: JSON.stringify({ ok: true, worker, prompted: true }) }
|
|
2958
|
+
}
|
|
2919
2959
|
if (action === 'relay') {
|
|
2920
2960
|
const sub = typeof args?.action === 'string' ? args.action : 'get'
|
|
2921
2961
|
if (sub === 'get') return { kind: 'success', text: JSON.stringify(relayStatus()) }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-collab-pair",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
4
4
|
"description": "For large projects: link a project-manager conversation with local or remote workers across devices (temporary or permanent), dispatch each round from the manager, relay results automatically, pre-write a stage queue that advances when a stage completes, and manage it all from a visual Settings page and a conversation context menu. Includes a relay hub and a free ntfy.sh transport for cross-device runs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|