dsh-collab-pair 1.5.3 → 1.5.4

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.
Files changed (4) hide show
  1. package/README.md +4 -0
  2. package/client.js +162 -41
  3. package/index.js +1 -1
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -52,6 +52,8 @@ Once a conversation is a manager, its prompt tells it to:
52
52
 
53
53
  The manager card also shows the **project name** and lets you rename it.
54
54
 
55
+ The page now opens with a compact **three-step guide** and an expandable **Show details** section; the cross-device and all-tasks cards start collapsed and expand on demand, so the common path (pick a conversation → link / to-do → review) stays one glance away.
56
+
55
57
  The header also has a **Message language** selector (中文 / English). It switches the generated collaboration messages; the page labels follow the app language.
56
58
 
57
59
  The page only links, unlinks, and reports status. Goals, tasks, and acceptance stay in the manager conversation.
@@ -326,6 +328,8 @@ dsh plugin add dsh-collab-pair
326
328
 
327
329
  页面只做关联/解除和查看,不代填目标、任务、验收——这些交给项目经理对话。
328
330
 
331
+ 页面顶部新增**三步上手**和可展开的**详细说明**;「跨设备协作」与「全部任务」默认收起,点「展开」再看,日常路径(选对话 → 关联/待办 → 验收)一眼可见。
332
+
329
333
  ## 中英文
330
334
 
331
335
  - 设置页跟随应用语言,包内自带中文和英文。
package/client.js CHANGED
@@ -10,6 +10,44 @@ window.__ModuleLoader__.load({
10
10
  nav: '协作待办',
11
11
  title: '协作待办',
12
12
  intro: '把对话组织成协作网络:项目经理自主创建员工、派发任务并验收回报;也可以给任意对话预设一串提示词,完成一轮自动发下一条。核心是协作,待办队列用来把长流程串起来。',
13
+ guideTitle: '三步上手',
14
+ guideStep1: '选择要操作的对话(默认当前打开的对话)。',
15
+ guideStep2: '要协作:在「当前会话」关联员工,或右键对话选「设为项目经理并启动」,让经理自己建员工、派任务、验收。',
16
+ guideStep3: '要串任务:在下方「对话待办」写好提示词,点「发送下一条」,每轮结束自动发下一条。',
17
+ guideMore: '查看详细说明',
18
+ guideLess: '收起详细说明',
19
+ guideDetail: [
20
+ '① 关联员工',
21
+ '• 在「当前会话」选择员工对话后点「关联」;只有一个员工时 worker 可省略。',
22
+ '• 想新建:填名字后点「新建员工」。',
23
+ '• 右键侧栏对话 →「设为项目经理并启动」:自动建一个起始员工,并让该对话自己继续建员工。',
24
+ '',
25
+ '② 项目经理怎么用',
26
+ '• 在经理对话里说清目标;经理会用 collab_worker_create 建人、collab_dispatch 派任务。',
27
+ '• 员工每轮结束会自动回传【协作回报】;验收后继续派发,或 collab_done 收尾。',
28
+ '• 不要让经理自己埋头干活,上下文留给验收和继续派发。',
29
+ '',
30
+ '③ 对话待办(自动连发)',
31
+ '• 普通对话可用:写多条提示词,点「发送下一条」。',
32
+ '• 当前回合结束后自动发下一条;可暂停/恢复/清空。',
33
+ '• 失败/中止会标红并暂停;点「重置队列」把卡住的条目退回待发。',
34
+ '',
35
+ '④ 阶段待办(项目经理)',
36
+ '• 给某个员工预写多个大阶段;点「开始」,验收后「完成并发下一阶段」。',
37
+ '• 阶段是派给员工的;对话待办是发给当前对话自己的。',
38
+ '',
39
+ '⑤ 跨设备',
40
+ '• 自建 hub:hub 机器运行 node hub.js --port 8787 --token <密钥>;用局域网 IP 或 HTTPS 隧道;127.0.0.1 只在本机有效。',
41
+ '• 免费 ntfy:两台设备填同一个 room + 长 token,免部署;消息经公共服务器。',
42
+ '• 员工设备注册别名;经理设备填设备名+别名关联;点「测试连接」。',
43
+ '• 远程员工文件不共享:用共同 git remote/网络盘,或让员工回报 patch。',
44
+ '',
45
+ '⑥ 语言与前缀',
46
+ '• 页面顶部切换消息语言;中文前缀【项目经理】/【员工】,英文 [Manager]/[Worker]。',
47
+ ].join('\n'),
48
+ summaryExpand: '展开',
49
+ summaryCollapse: '收起',
50
+ summaryRelayHint: '自建 hub 或免费 ntfy.sh;两台设备同 room/token。',
13
51
  workSession: '工作会话',
14
52
  workSessionHint: '选择要操作的对话。建立关联时,它就是项目经理对话。',
15
53
  messageLanguage: '对话消息语言',
@@ -168,6 +206,44 @@ window.__ModuleLoader__.load({
168
206
  nav: 'Collab To-do',
169
207
  title: 'Collab To-do',
170
208
  intro: 'Organise conversations into a collaboration network: a manager creates workers, dispatches tasks and reviews reports; pre-write a prompt queue for any conversation to advance after each turn. Collaboration is the core; the to-do queue strings long workflows together.',
209
+ guideTitle: 'Three steps',
210
+ guideStep1: 'Pick the conversation to work on (the open one is selected by default).',
211
+ guideStep2: 'To collaborate: link a worker in **Current conversation**, or right-click a conversation and choose **Set as project manager (start)** so the manager creates workers, dispatches and reviews.',
212
+ guideStep3: 'To string tasks: add prompts to **Conversation to-do** below and click **Send next**; the next one is sent when a turn ends.',
213
+ guideMore: 'Show details',
214
+ guideLess: 'Hide details',
215
+ guideDetail: [
216
+ '① Link a worker',
217
+ '• In Current conversation, pick a worker conversation and click Link; with one worker you can omit worker.',
218
+ '• To create one: type a name and click New worker.',
219
+ '• Right-click a sidebar conversation → Set as project manager (start): creates a starter worker and lets that conversation create more itself.',
220
+ '',
221
+ '② How the manager works',
222
+ '• State the goal in the manager conversation; it uses collab_worker_create and collab_dispatch.',
223
+ '• A finished worker turn comes back as a [Collaboration report]; review it, dispatch again, or call collab_done.',
224
+ '• The manager should not do the workers’ execution; keep its context for review and dispatching.',
225
+ '',
226
+ '③ Conversation to-do',
227
+ '• For any ordinary conversation: add several prompts, then click Send next.',
228
+ '• The next prompt is sent when the current turn ends; pause, resume or clear pending items.',
229
+ '• Failed/aborted items turn red and pause auto-advance; Reset queue returns stuck items to pending.',
230
+ '',
231
+ '④ Stage queue (manager)',
232
+ '• Pre-write stages for one worker; Start, then Complete to dispatch the next stage.',
233
+ '• Stages go to workers; the conversation to-do goes to this conversation itself.',
234
+ '',
235
+ '⑤ Cross-device',
236
+ '• Self-hosted hub: run node hub.js --port 8787 --token <secret>; use a LAN IP or HTTPS tunnel; 127.0.0.1 is local only.',
237
+ '• Free ntfy: same room + long token on both devices; no deployment, public server.',
238
+ '• Worker device registers an alias; manager links device + alias; press Test connection.',
239
+ '• Remote workers do not share files: use a common git remote/network drive, or return patches.',
240
+ '',
241
+ '⑥ Language and prefixes',
242
+ '• Switch message language at the top; zh prefixes 【项目经理】/【员工】, en [Manager]/[Worker].',
243
+ ].join('\n'),
244
+ summaryExpand: 'Expand',
245
+ summaryCollapse: 'Collapse',
246
+ summaryRelayHint: 'Self-hosted hub or free ntfy.sh; both devices share room/token.',
171
247
  workSession: 'Working conversation',
172
248
  workSessionHint: 'The conversation to act on. When you create a link, it becomes the project manager.',
173
249
  messageLanguage: 'Message language',
@@ -433,6 +509,9 @@ window.__ModuleLoader__.load({
433
509
  const [queueTitle, setQueueTitle] = React.useState('')
434
510
  const [queuePrompt, setQueuePrompt] = React.useState('')
435
511
  const [queueBusy, setQueueBusy] = React.useState(false)
512
+ const [showGuide, setShowGuide] = React.useState(false)
513
+ const [showRelay, setShowRelay] = React.useState(false)
514
+ const [showBoard, setShowBoard] = React.useState(false)
436
515
  const [queueError, setQueueError] = React.useState(null)
437
516
  const commandsRef = React.useRef(commands)
438
517
  commandsRef.current = commands
@@ -879,32 +958,43 @@ window.__ModuleLoader__.load({
879
958
  return wait === '' ? base : `${base} · ${t('waited', { time: wait })}`
880
959
  }
881
960
 
961
+ const starLink = h('a', {
962
+ href: 'https://github.com/awa1231/dsh-collab-pair',
963
+ target: '_blank',
964
+ rel: 'noreferrer noopener',
965
+ style: S.starLink,
966
+ }, t('starLabel'))
882
967
  const header = h('div', { style: S.page },
883
- h('h2', { style: S.title }, t('title')),
884
- h('p', { style: S.intro }, t('intro')),
885
- h('div', { style: S.card },
886
- h('label', { style: S.label }, t('workSession'),
887
- h('select', {
888
- style: S.input,
889
- value: workId ?? '',
890
- disabled: busy || sessions.length === 0,
891
- onChange: (event) => setWorkId(event.target.value),
892
- },
893
- sessions.length === 0
894
- ? h('option', { value: '' }, t('noSessions'))
895
- : sessions.map((row) => h('option', { key: row.id, value: row.id }, `${row.title}${row.running ? ' · ●' : ''}`))),
968
+ h('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'flex-start', gap: 12, flexWrap: 'wrap' } },
969
+ h('div', { style: { display: 'flex', flexDirection: 'column', gap: 6, minWidth: 0 } },
970
+ h('h2', { style: S.title }, t('title')),
971
+ h('p', { style: S.intro }, t('intro')),
896
972
  ),
897
- h('div', { style: S.hint }, t('workSessionHint')),
898
- h('div', { style: S.mono }, workId ?? ''),
899
- h('label', { style: S.label }, t('messageLanguage'),
900
- h('select', {
901
- style: S.input,
902
- value: board !== null && board.language === 'en' ? 'en' : 'zh',
903
- disabled: busy || workId === undefined,
904
- onChange: (event) => void changeLanguage(event.target.value),
905
- },
906
- h('option', { value: 'zh' }, t('langZh')),
907
- h('option', { value: 'en' }, t('langEn'))),
973
+ starLink,
974
+ ),
975
+ h('div', { style: S.card },
976
+ h('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: 10 } },
977
+ h('label', { style: S.label }, t('workSession'),
978
+ h('select', {
979
+ style: S.input,
980
+ value: workId ?? '',
981
+ disabled: busy || sessions.length === 0,
982
+ onChange: (event) => setWorkId(event.target.value),
983
+ },
984
+ sessions.length === 0
985
+ ? h('option', { value: '' }, t('noSessions'))
986
+ : sessions.map((row) => h('option', { key: row.id, value: row.id }, `${row.title}${row.running ? ' · ●' : ''}`))),
987
+ ),
988
+ h('label', { style: S.label }, t('messageLanguage'),
989
+ h('select', {
990
+ style: S.input,
991
+ value: board !== null && board.language === 'en' ? 'en' : 'zh',
992
+ disabled: busy || workId === undefined,
993
+ onChange: (event) => void changeLanguage(event.target.value),
994
+ },
995
+ h('option', { value: 'zh' }, t('langZh')),
996
+ h('option', { value: 'en' }, t('langEn'))),
997
+ ),
908
998
  ),
909
999
  h('div', { style: S.row },
910
1000
  h('button', { type: 'button', style: S.secondary, disabled: busy || queueBusy || workId === undefined, onClick: () => void refresh() }, t('refresh')),
@@ -920,6 +1010,19 @@ window.__ModuleLoader__.load({
920
1010
  )
921
1011
  : null
922
1012
 
1013
+ const quickGuide = h('div', { style: S.card },
1014
+ h('div', { style: S.cardHead },
1015
+ h('h3', { style: S.cardTitle }, t('guideTitle')),
1016
+ h('button', { type: 'button', style: S.secondary, onClick: () => setShowGuide(!showGuide) }, showGuide ? t('guideLess') : t('guideMore')),
1017
+ ),
1018
+ h('ol', { style: { margin: 0, paddingLeft: 18, display: 'flex', flexDirection: 'column', gap: 4, fontSize: 12, color: 'var(--dsw-alias-label-secondary)' } },
1019
+ h('li', null, t('guideStep1')),
1020
+ h('li', null, t('guideStep2')),
1021
+ h('li', null, t('guideStep3')),
1022
+ ),
1023
+ showGuide ? h('p', { style: { ...S.hint, whiteSpace: 'pre-wrap', lineHeight: 1.75 } }, t('guideDetail')) : null,
1024
+ )
1025
+
923
1026
  const stateBadge = (state) => h('span', { style: { ...S.badge, color: state.color } }, state.label)
924
1027
 
925
1028
  const reminderText = (link) => (link.nudges > 0
@@ -977,8 +1080,10 @@ window.__ModuleLoader__.load({
977
1080
  )
978
1081
 
979
1082
  const relayCard = h('div', { style: S.card },
980
- h('h3', { style: S.cardTitle }, t('relayTitle')),
981
- h('p', { style: S.hint }, t('relayIntro')),
1083
+ h('div', { style: S.cardHead },
1084
+ h('h3', { style: S.cardTitle }, t('relayTitle')),
1085
+ h('button', { type: 'button', style: S.secondary, onClick: () => setShowRelay(false) }, t('summaryCollapse')),
1086
+ ),
982
1087
  h('label', { style: S.label }, t('relayModeLabel'),
983
1088
  h('select', {
984
1089
  style: S.input,
@@ -1305,11 +1410,14 @@ window.__ModuleLoader__.load({
1305
1410
 
1306
1411
  const boardCard = h('div', { style: S.card },
1307
1412
  h('div', { style: S.cardHead },
1308
- h('h3', { style: S.cardTitle }, t('boardTitle')),
1309
- h('span', { style: S.muted }, t('boardSummary', {
1310
- active: board === null ? 0 : board.activeCount ?? activeLinks.length,
1311
- total: board === null ? 0 : board.totalCount ?? links.length,
1312
- })),
1413
+ h('div', { style: S.row },
1414
+ h('h3', { style: S.cardTitle }, t('boardTitle')),
1415
+ h('span', { style: S.muted }, t('boardSummary', {
1416
+ active: board === null ? 0 : board.activeCount ?? activeLinks.length,
1417
+ total: board === null ? 0 : board.totalCount ?? links.length,
1418
+ })),
1419
+ ),
1420
+ h('button', { type: 'button', style: S.secondary, onClick: () => setShowBoard(false) }, t('summaryCollapse')),
1313
1421
  ),
1314
1422
  board === null
1315
1423
  ? h('p', { style: S.intro }, busy ? t('loading') : t('noTasks'))
@@ -1426,24 +1534,37 @@ window.__ModuleLoader__.load({
1426
1534
  }
1427
1535
 
1428
1536
  const workTitle = sessions.find((row) => row.id === workId)?.title
1429
- const starRow = h('div', { style: { display: 'flex', justifyContent: 'center', padding: '2px 0 6px' } },
1430
- h('a', {
1431
- href: 'https://github.com/awa1231/dsh-collab-pair',
1432
- target: '_blank',
1433
- rel: 'noreferrer noopener',
1434
- style: S.starLink,
1435
- }, t('starLabel')),
1537
+ const relaySummary = h('div', { style: S.card },
1538
+ h('div', { style: S.cardHead },
1539
+ h('h3', { style: S.cardTitle }, t('relayTitle')),
1540
+ h('span', { style: S.badge }, relayState === null ? t('loading') : relayModeText(relayState.mode)),
1541
+ ),
1542
+ h('div', { style: S.row },
1543
+ h('span', { style: S.muted }, t('summaryRelayHint')),
1544
+ h('button', { type: 'button', style: S.secondary, onClick: () => setShowRelay(true) }, t('summaryExpand')),
1545
+ ),
1546
+ )
1547
+ const totalCount = board !== null && typeof board.totalCount === 'number' ? board.totalCount : 0
1548
+ const activeCount = board !== null && typeof board.activeCount === 'number' ? board.activeCount : 0
1549
+ const boardSummary = h('div', { style: S.card },
1550
+ h('div', { style: S.cardHead },
1551
+ h('h3', { style: S.cardTitle }, t('boardTitle')),
1552
+ h('span', { style: S.muted }, t('boardSummary', { active: activeCount, total: totalCount })),
1553
+ ),
1554
+ h('div', { style: S.row },
1555
+ h('button', { type: 'button', style: S.secondary, onClick: () => setShowBoard(true) }, t('summaryExpand')),
1556
+ ),
1436
1557
  )
1437
1558
  return h('div', { style: S.page },
1438
- starRow,
1439
1559
  header,
1440
1560
  feedback,
1561
+ quickGuide,
1441
1562
  h('h3', { style: S.cardTitle }, workTitle === undefined ? t('currentTitle') : `${t('currentTitle')} · ${workTitle}`),
1442
1563
  currentCard,
1443
- relayCard,
1564
+ showRelay ? relayCard : relaySummary,
1444
1565
  stageCard,
1445
1566
  queueCard,
1446
- boardCard,
1567
+ showBoard ? boardCard : boardSummary,
1447
1568
  )
1448
1569
  }
1449
1570
 
package/index.js CHANGED
@@ -43,7 +43,7 @@ const REPORTS = new Set(['done', 'partial', 'blocked'])
43
43
  const PROMPT_TIMEOUT_MS = 180000
44
44
  const QUEUE_LIMIT = 100
45
45
  const QUEUE_DONE_LIMIT = 20
46
- const ENGINE = 'collab-pair/1.5.3'
46
+ const ENGINE = 'collab-pair/1.5.4'
47
47
  const PREFIX_DEFAULTS = {
48
48
  zh: { manager: '【项目经理】', worker: '【员工】' },
49
49
  en: { manager: '[Manager]', worker: '[Worker]' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-collab-pair",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "DSH collaboration plugin: link a project-manager conversation with local or remote workers across devices, dispatch rounds, relay results and manage projects/stages automatically. Also ships a prompt to-do queue for any conversation: pre-write a series of prompts and the next one is sent when a turn ends. Includes a relay hub and a free ntfy.sh transport.",
5
5
  "type": "module",
6
6
  "license": "MIT",