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/client.js ADDED
@@ -0,0 +1,481 @@
1
+ window.__ModuleLoader__.load({
2
+ id: 'dsh-collab-pair',
3
+ factory(require) {
4
+ const React = require('react')
5
+ const h = React.createElement
6
+ const NS = 'collab-pair'
7
+
8
+ const MESSAGES = {
9
+ zh: {
10
+ nav: '双对话协作',
11
+ title: '双对话协作',
12
+ intro: '一个项目经理可以管理多个员工。插件只负责关联;目标、任务和验收都由项目经理在对话里掌握。',
13
+ workSession: '工作会话',
14
+ workSessionHint: '选择要操作的对话。建立关联时,它就是项目经理对话。',
15
+ noSessions: '还没有可用的对话,请先在左侧新建一个对话。',
16
+ loading: '读取中…',
17
+ refresh: '刷新',
18
+ busy: '处理中…',
19
+ boardTitle: '全部任务',
20
+ boardSummary: '{active} 进行中 / 共 {total}',
21
+ noTasks: '还没有任何协作任务。',
22
+ currentTitle: '当前会话',
23
+ linkTitle: '关联员工',
24
+ peer: '员工对话',
25
+ peerNew: '新建一个员工对话',
26
+ link: '关联',
27
+ linkDone: '已关联员工。接下来在项目经理对话里派发任务。',
28
+ workerPrefixHint: '关联后两个对话的标题会自动加上【项目经理】/【员工】前缀,解除时自动去掉。',
29
+ managerTitle: '项目经理',
30
+ managing: '正在管理',
31
+ workerCount: '个员工',
32
+ workerTitle: '员工',
33
+ workerHint: '这个对话是员工角色;项目目标与验收由项目经理掌握。',
34
+ leave: '退出协作',
35
+ confirmLeave: '退出这个协作?',
36
+ round: '第',
37
+ roundUnit: '轮',
38
+ waited: '已等待 {time}',
39
+ runningNow: '工作中',
40
+ waiting: '等待回报',
41
+ idle: '空闲',
42
+ finished: '已结束',
43
+ noWorkers: '还没有关联员工。',
44
+ lastReport: '最近回报',
45
+ unlink: '解除',
46
+ confirmUnlink: '解除与该员工的协作关联?',
47
+ removeDone: '已解除关联。',
48
+ statusDone: '完成',
49
+ statusPartial: '部分完成',
50
+ statusBlocked: '受阻',
51
+ statusUnreported: '未显式汇报',
52
+ seconds: '{count} 秒',
53
+ minutes: '{count} 分钟',
54
+ hours: '{count} 小时',
55
+ unknownError: '操作失败',
56
+ },
57
+ en: {
58
+ nav: 'Collaboration pair',
59
+ title: 'Collaboration pair',
60
+ intro: 'One project manager can run several workers. The plugin only manages links; goals, tasks, and acceptance stay with the manager in the conversation.',
61
+ workSession: 'Working conversation',
62
+ workSessionHint: 'The conversation to act on. When you create a link, it becomes the project manager.',
63
+ noSessions: 'No conversation is available yet. Create one in the sidebar first.',
64
+ loading: 'Loading…',
65
+ refresh: 'Refresh',
66
+ busy: 'Working…',
67
+ boardTitle: 'All tasks',
68
+ boardSummary: '{active} active / {total} total',
69
+ noTasks: 'No collaboration task yet.',
70
+ currentTitle: 'Current conversation',
71
+ linkTitle: 'Link a worker',
72
+ peer: 'Worker conversation',
73
+ peerNew: 'Create a new worker conversation',
74
+ link: 'Link',
75
+ linkDone: 'Worker linked. Dispatch tasks from the manager conversation.',
76
+ workerPrefixHint: 'Linking adds a 【项目经理】/【员工】 prefix to both titles; unlinking removes it.',
77
+ managerTitle: 'Project manager',
78
+ managing: 'Managing',
79
+ workerCount: 'workers',
80
+ workerTitle: 'Worker',
81
+ workerHint: 'This conversation is a worker; the project goal and acceptance stay with the project manager.',
82
+ leave: 'Leave',
83
+ confirmLeave: 'Leave this collaboration?',
84
+ round: 'Round',
85
+ roundUnit: '',
86
+ waited: 'waiting {time}',
87
+ runningNow: 'Working',
88
+ waiting: 'Waiting for report',
89
+ idle: 'Idle',
90
+ finished: 'Finished',
91
+ noWorkers: 'No worker linked yet.',
92
+ lastReport: 'Latest report',
93
+ unlink: 'Unlink',
94
+ confirmUnlink: 'Remove the link to this worker?',
95
+ removeDone: 'Link removed.',
96
+ statusDone: 'Done',
97
+ statusPartial: 'Partially done',
98
+ statusBlocked: 'Blocked',
99
+ statusUnreported: 'No explicit report',
100
+ seconds: '{count}s',
101
+ minutes: '{count}m',
102
+ hours: '{count}h',
103
+ unknownError: 'The operation failed',
104
+ },
105
+ }
106
+
107
+ const S = {
108
+ page: { maxWidth: 820, display: 'flex', flexDirection: 'column', gap: 18, color: 'var(--dsw-alias-label-primary)', fontSize: 13, lineHeight: 1.55 },
109
+ title: { margin: 0, fontSize: 18, fontWeight: 600 },
110
+ intro: { margin: 0, color: 'var(--dsw-alias-label-secondary)' },
111
+ hint: { color: 'var(--dsw-alias-label-secondary)', fontSize: 12, margin: 0 },
112
+ card: { display: 'flex', flexDirection: 'column', gap: 12, padding: 16, border: '1px solid var(--dsw-alias-border-l1)', borderRadius: 12, background: 'var(--dsw-alias-bg-layer-1)' },
113
+ cardHead: { display: 'flex', gap: 8, alignItems: 'baseline', justifyContent: 'space-between', flexWrap: 'wrap' },
114
+ cardTitle: { margin: 0, fontSize: 14, fontWeight: 600 },
115
+ row: { display: 'flex', gap: 8, alignItems: 'center', flexWrap: 'wrap' },
116
+ label: { display: 'flex', flexDirection: 'column', gap: 6, fontSize: 12, color: 'var(--dsw-alias-label-secondary)' },
117
+ input: { width: '100%', boxSizing: 'border-box', padding: '8px 10px', borderRadius: 8, border: '1px solid var(--dsw-alias-border-l1)', background: 'var(--dsw-alias-bg-base)', color: 'var(--dsw-alias-label-primary)', fontSize: 13, fontFamily: 'inherit' },
118
+ primary: { padding: '8px 14px', borderRadius: 8, border: '1px solid transparent', background: 'var(--dsw-alias-brand-primary)', color: '#fff', fontSize: 13, cursor: 'pointer' },
119
+ secondary: { padding: '6px 12px', borderRadius: 8, border: '1px solid var(--dsw-alias-border-l2)', background: 'transparent', color: 'var(--dsw-alias-label-primary)', fontSize: 12, cursor: 'pointer' },
120
+ danger: { padding: '6px 12px', borderRadius: 8, border: '1px solid var(--dsw-alias-state-error-primary)', background: 'transparent', color: 'var(--dsw-alias-state-error-primary)', fontSize: 12, cursor: 'pointer' },
121
+ badge: { display: 'inline-flex', alignItems: 'center', padding: '2px 8px', borderRadius: 999, fontSize: 11, fontWeight: 600, background: 'var(--dsw-alias-bg-layer-2)', whiteSpace: 'nowrap' },
122
+ mono: { fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace', fontSize: 11, color: 'var(--dsw-alias-label-secondary)', wordBreak: 'break-all' },
123
+ muted: { color: 'var(--dsw-alias-label-secondary)', fontSize: 12 },
124
+ notice: { fontSize: 12, whiteSpace: 'pre-wrap', margin: 0 },
125
+ worker: { display: 'flex', gap: 12, alignItems: 'center', justifyContent: 'space-between', padding: '10px 12px', border: '1px solid var(--dsw-alias-border-l1)', borderRadius: 10, background: 'var(--dsw-alias-bg-base)' },
126
+ workerMain: { display: 'flex', flexDirection: 'column', gap: 2, minWidth: 0 },
127
+ workerName: { fontSize: 13, fontWeight: 600, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' },
128
+ taskRow: { display: 'flex', gap: 12, alignItems: 'flex-start', justifyContent: 'space-between', padding: '10px 12px', border: '1px solid var(--dsw-alias-border-l1)', borderRadius: 10, background: 'var(--dsw-alias-bg-base)' },
129
+ taskMain: { display: 'flex', flexDirection: 'column', gap: 3, minWidth: 0, flex: 1 },
130
+ taskTitle: { fontSize: 13, fontWeight: 600, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' },
131
+ taskText: { margin: 0, color: 'var(--dsw-alias-label-secondary)', fontSize: 12, maxHeight: 34, overflow: 'hidden', wordBreak: 'break-word' },
132
+ }
133
+
134
+ /** Read every renderable conversation from the client session store. */
135
+ function sessionRows(snapshot) {
136
+ const byId = snapshot && typeof snapshot === 'object' && snapshot.byId !== null && typeof snapshot.byId === 'object' ? snapshot.byId : {}
137
+ const rows = []
138
+ for (const key of Object.keys(byId)) {
139
+ const item = byId[key]
140
+ if (item === null || typeof item !== 'object') continue
141
+ const id = typeof item.id === 'string' ? item.id : key
142
+ if (typeof id !== 'string' || id === '') continue
143
+ if (item.origin === 'subagent') continue
144
+ const retained = item.retainedBy !== undefined && (item.retainedBy.mainView ?? 0) > 0
145
+ rows.push({
146
+ id,
147
+ title: typeof item.title === 'string' && item.title !== '' ? item.title : id,
148
+ updatedAt: typeof item.updatedAt === 'number' ? item.updatedAt : (typeof item.createdAt === 'number' ? item.createdAt : 0),
149
+ retained,
150
+ running: item.running === true,
151
+ })
152
+ }
153
+ rows.sort((left, right) => (Number(right.retained) - Number(left.retained)) || (right.updatedAt - left.updatedAt))
154
+ return rows
155
+ }
156
+
157
+ /** Run one `/collab` line on a session and return its JSON payload. */
158
+ async function runCommand(commands, sessionId, line) {
159
+ if (commands === undefined || commands === null || typeof commands.execute !== 'function') throw new Error('command channel unavailable')
160
+ const response = await commands.execute(sessionId, line, [])
161
+ if (response === undefined || response === null || response.ok !== true) {
162
+ const failure = response && response.error
163
+ throw new Error(failure === undefined ? 'command failed' : `${failure.code}: ${failure.message}`)
164
+ }
165
+ const execution = response.value
166
+ if (execution === undefined) throw new Error(`unknown command: ${line}`)
167
+ const result = execution.result
168
+ if (result === undefined || result === null) throw new Error('command returned no result')
169
+ if (result.kind === 'error') throw new Error(result.text)
170
+ const text = result.text ?? ''
171
+ if (text === '') return null
172
+ try {
173
+ return JSON.parse(text)
174
+ } catch {
175
+ return { message: text }
176
+ }
177
+ }
178
+
179
+ function CollabSettings(props) {
180
+ const t = typeof props.t === 'function' ? props.t : (key) => key
181
+ const commands = props.commands
182
+ const useSessions = typeof props.useSessions === 'function' ? props.useSessions : (selector) => selector(undefined)
183
+ const snapshot = useSessions((state) => state)
184
+ const sessions = React.useMemo(() => sessionRows(snapshot), [snapshot])
185
+ const [workId, setWorkId] = React.useState(props.initialWorkId)
186
+ const [board, setBoard] = React.useState(props.initialBoard === undefined ? null : props.initialBoard)
187
+ const [error, setError] = React.useState(null)
188
+ const [notice, setNotice] = React.useState(null)
189
+ const [busy, setBusy] = React.useState(false)
190
+ const [peer, setPeer] = React.useState('new')
191
+ const commandsRef = React.useRef(commands)
192
+ commandsRef.current = commands
193
+
194
+ React.useEffect(() => {
195
+ if (workId !== undefined) return
196
+ if (sessions.length === 0) return
197
+ const preferred = sessions.find((row) => row.retained) ?? sessions[0]
198
+ setWorkId(preferred.id)
199
+ }, [sessions, workId])
200
+
201
+ const loadBoard = React.useCallback(async (sessionId) => {
202
+ const value = await runCommand(commandsRef.current, sessionId, '/collab tasks')
203
+ setBoard(value)
204
+ return value
205
+ }, [])
206
+
207
+ React.useEffect(() => {
208
+ if (workId === undefined) return undefined
209
+ let cancelled = false
210
+ setBusy(true)
211
+ setError(null)
212
+ setNotice(null)
213
+ setBoard(null)
214
+ loadBoard(workId)
215
+ .then((value) => {
216
+ if (!cancelled) setBoard(value)
217
+ })
218
+ .catch((cause) => {
219
+ if (cancelled) return
220
+ setBoard(null)
221
+ setError(cause instanceof Error ? cause.message : String(cause))
222
+ })
223
+ .finally(() => {
224
+ if (!cancelled) setBusy(false)
225
+ })
226
+ return () => {
227
+ cancelled = true
228
+ }
229
+ }, [workId, loadBoard])
230
+
231
+ const act = async (line, successText) => {
232
+ if (workId === undefined) return
233
+ setBusy(true)
234
+ setError(null)
235
+ setNotice(null)
236
+ try {
237
+ const value = await runCommand(commandsRef.current, workId, line)
238
+ setNotice(value !== null && typeof value === 'object' && typeof value.message === 'string' ? value.message : successText)
239
+ await loadBoard(workId)
240
+ } catch (cause) {
241
+ setError(cause instanceof Error ? cause.message : String(cause))
242
+ } finally {
243
+ setBusy(false)
244
+ }
245
+ }
246
+
247
+ const refresh = async () => {
248
+ if (workId === undefined) return
249
+ setBusy(true)
250
+ setError(null)
251
+ try {
252
+ await loadBoard(workId)
253
+ } catch (cause) {
254
+ setError(cause instanceof Error ? cause.message : String(cause))
255
+ } finally {
256
+ setBusy(false)
257
+ }
258
+ }
259
+
260
+ const linkWorker = () => {
261
+ void act(`/collab link ${JSON.stringify({ peer })}`, t('linkDone'))
262
+ }
263
+
264
+ const removeWorker = (worker) => {
265
+ if (typeof window.confirm === 'function' && !window.confirm(t('confirmUnlink'))) return
266
+ void act(`/collab unlink ${JSON.stringify({ worker })}`, t('removeDone'))
267
+ }
268
+
269
+ const leaveCollaboration = () => {
270
+ if (typeof window.confirm === 'function' && !window.confirm(t('confirmLeave'))) return
271
+ void act(`/collab unlink ${JSON.stringify({})}`, t('removeDone'))
272
+ }
273
+
274
+ const links = board !== null && Array.isArray(board.links) ? board.links : []
275
+ const activeLinks = links.filter((link) => link.status === 'active')
276
+ const managed = workId === undefined ? [] : activeLinks.filter((link) => link.manager === workId)
277
+ const mine = workId === undefined ? undefined : activeLinks.find((link) => link.worker === workId)
278
+ const role = managed.length > 0 ? 'manager' : mine === undefined ? null : 'worker'
279
+ const peerChoices = sessions.filter((row) => row.id !== workId)
280
+
281
+ const statusText = (value) => {
282
+ if (value === 'done') return t('statusDone')
283
+ if (value === 'partial') return t('statusPartial')
284
+ if (value === 'blocked') return t('statusBlocked')
285
+ return t('statusUnreported')
286
+ }
287
+ const formatWait = (seconds) => {
288
+ if (typeof seconds !== 'number' || seconds < 0) return ''
289
+ if (seconds < 60) return t('seconds', { count: seconds })
290
+ if (seconds < 3600) return t('minutes', { count: Math.round(seconds / 60) })
291
+ return t('hours', { count: Math.round(seconds / 360) / 10 })
292
+ }
293
+ const stateOf = (link) => {
294
+ if (link.status !== 'active') return { label: t('finished'), color: 'var(--dsw-alias-label-secondary)' }
295
+ if (link.workerRunning === true) return { label: t('runningNow'), color: 'var(--dsw-alias-state-success-primary)' }
296
+ if (link.pending !== null && link.pending !== undefined) return { label: t('waiting'), color: 'var(--dsw-alias-state-warn-primary)' }
297
+ return { label: t('idle'), color: 'var(--dsw-alias-state-idle-primary)' }
298
+ }
299
+ const roundText = (link) => {
300
+ const base = `${t('round')} ${link.round} ${t('roundUnit')}`.trim()
301
+ if (link.pending === null || link.pending === undefined) return base
302
+ const wait = formatWait(link.waitedSeconds)
303
+ return wait === '' ? base : `${base} · ${t('waited', { time: wait })}`
304
+ }
305
+
306
+ const header = h('div', { style: S.page },
307
+ h('h2', { style: S.title }, t('title')),
308
+ h('p', { style: S.intro }, t('intro')),
309
+ h('div', { style: S.card },
310
+ h('label', { style: S.label }, t('workSession'),
311
+ h('select', {
312
+ style: S.input,
313
+ value: workId ?? '',
314
+ disabled: busy || sessions.length === 0,
315
+ onChange: (event) => setWorkId(event.target.value),
316
+ },
317
+ sessions.length === 0
318
+ ? h('option', { value: '' }, t('noSessions'))
319
+ : sessions.map((row) => h('option', { key: row.id, value: row.id }, `${row.title}${row.running ? ' · ●' : ''}`))),
320
+ ),
321
+ h('div', { style: S.hint }, t('workSessionHint')),
322
+ h('div', { style: S.mono }, workId ?? ''),
323
+ h('div', { style: S.row },
324
+ h('button', { type: 'button', style: S.secondary, disabled: busy || workId === undefined, onClick: () => void refresh() }, t('refresh')),
325
+ busy ? h('span', { style: S.muted }, t('busy')) : null,
326
+ ),
327
+ ),
328
+ )
329
+
330
+ const feedback = (error !== null || notice !== null)
331
+ ? h('div', { style: S.card },
332
+ error !== null ? h('p', { style: { ...S.notice, color: 'var(--dsw-alias-state-error-primary)' } }, error) : null,
333
+ notice !== null ? h('p', { style: { ...S.notice, color: 'var(--dsw-alias-state-success-primary)' } }, notice) : null,
334
+ )
335
+ : null
336
+
337
+ const stateBadge = (state) => h('span', { style: { ...S.badge, color: state.color } }, state.label)
338
+
339
+ const taskRow = (link) => {
340
+ const state = stateOf(link)
341
+ return h('div', { key: link.linkId, style: S.taskRow },
342
+ h('div', { style: S.taskMain },
343
+ h('div', { style: S.taskTitle }, link.workerTitle || link.worker),
344
+ h('div', { style: S.mono }, link.worker),
345
+ h('div', { style: S.muted },
346
+ `${link.managerTitle || link.manager} · ${roundText(link)}`,
347
+ ),
348
+ link.pending === null || link.pending === undefined
349
+ ? null
350
+ : h('p', { style: S.taskText }, link.pending.task),
351
+ link.lastReport === null || link.lastReport === undefined
352
+ ? null
353
+ : h('div', { style: S.muted }, `${t('lastReport')}:${statusText(link.lastReport.status)}${link.lastReport.summary ? ` · ${link.lastReport.summary}` : ''}`),
354
+ ),
355
+ stateBadge(state),
356
+ )
357
+ }
358
+
359
+ const boardCard = h('div', { style: S.card },
360
+ h('div', { style: S.cardHead },
361
+ h('h3', { style: S.cardTitle }, t('boardTitle')),
362
+ h('span', { style: S.muted }, t('boardSummary', {
363
+ active: board === null ? 0 : board.activeCount ?? activeLinks.length,
364
+ total: board === null ? 0 : board.totalCount ?? links.length,
365
+ })),
366
+ ),
367
+ board === null
368
+ ? h('p', { style: S.intro }, busy ? t('loading') : t('noTasks'))
369
+ : links.length === 0
370
+ ? h('p', { style: S.intro }, t('noTasks'))
371
+ : links.map(taskRow),
372
+ )
373
+
374
+ const workerRow = (link) => {
375
+ const state = stateOf(link)
376
+ return h('div', { key: link.linkId, style: S.worker },
377
+ h('div', { style: S.workerMain },
378
+ h('div', { style: S.workerName }, link.workerTitle || link.worker),
379
+ h('div', { style: S.mono }, link.worker),
380
+ h('div', { style: S.muted }, roundText(link)),
381
+ link.pending === null || link.pending === undefined
382
+ ? null
383
+ : h('p', { style: S.taskText }, link.pending.task),
384
+ link.lastReport === null || link.lastReport === undefined
385
+ ? null
386
+ : h('div', { style: S.muted }, `${t('lastReport')}:${statusText(link.lastReport.status)}${link.lastReport.summary ? ` · ${link.lastReport.summary}` : ''}`),
387
+ ),
388
+ h('div', { style: S.row },
389
+ stateBadge(state),
390
+ h('button', { type: 'button', style: S.danger, disabled: busy, onClick: () => removeWorker(link.worker) }, t('unlink')),
391
+ ),
392
+ )
393
+ }
394
+
395
+ const linkForm = h('div', { style: S.card },
396
+ h('h3', { style: S.cardTitle }, t('linkTitle')),
397
+ h('label', { style: S.label }, t('peer'),
398
+ h('select', {
399
+ style: S.input,
400
+ value: peer,
401
+ disabled: busy,
402
+ onChange: (event) => setPeer(event.target.value),
403
+ },
404
+ h('option', { value: 'new' }, t('peerNew')),
405
+ peerChoices.map((row) => h('option', { key: row.id, value: row.id }, row.title))),
406
+ ),
407
+ h('div', { style: S.row },
408
+ h('button', { type: 'button', style: S.primary, disabled: busy, onClick: linkWorker }, t('link')),
409
+ ),
410
+ h('p', { style: S.hint }, t('workerPrefixHint')),
411
+ )
412
+
413
+ let currentCard
414
+ if (sessions.length === 0) {
415
+ currentCard = h('div', { style: S.card }, h('p', { style: S.intro }, t('noSessions')))
416
+ } else if (role === 'manager') {
417
+ currentCard = h('div', { style: { display: 'flex', flexDirection: 'column', gap: 18 } },
418
+ h('div', { style: S.card },
419
+ h('div', { style: S.row },
420
+ h('span', { style: S.badge }, t('managerTitle')),
421
+ h('span', { style: S.muted }, `${t('managing')} ${managed.length} ${t('workerCount')}`),
422
+ ),
423
+ managed.length === 0 ? h('p', { style: S.intro }, t('noWorkers')) : managed.map(workerRow),
424
+ ),
425
+ linkForm,
426
+ )
427
+ } else if (role === 'worker' && mine !== undefined) {
428
+ const pending = mine.pending
429
+ currentCard = h('div', { style: S.card },
430
+ h('div', { style: S.row },
431
+ h('span', { style: S.badge }, t('workerTitle')),
432
+ stateBadge(stateOf(mine)),
433
+ ),
434
+ h('div', { style: S.label }, t('managerTitle'),
435
+ h('div', null, mine.managerTitle || mine.manager),
436
+ h('div', { style: S.mono }, mine.manager),
437
+ ),
438
+ h('div', { style: S.muted }, roundText(mine)),
439
+ pending === null || pending === undefined ? null : h('p', { style: S.taskText }, pending.task),
440
+ mine.lastReport === null || mine.lastReport === undefined
441
+ ? null
442
+ : h('div', { style: S.muted }, `${t('lastReport')}:${statusText(mine.lastReport.status)}${mine.lastReport.summary ? ` · ${mine.lastReport.summary}` : ''}`),
443
+ h('p', { style: S.hint }, t('workerHint')),
444
+ h('div', { style: S.row },
445
+ h('button', { type: 'button', style: S.danger, disabled: busy, onClick: leaveCollaboration }, t('leave')),
446
+ ),
447
+ )
448
+ } else {
449
+ currentCard = linkForm
450
+ }
451
+
452
+ const workTitle = sessions.find((row) => row.id === workId)?.title
453
+ return h('div', { style: S.page },
454
+ header,
455
+ feedback,
456
+ h('h3', { style: S.cardTitle }, workTitle === undefined ? t('currentTitle') : `${t('currentTitle')} · ${workTitle}`),
457
+ currentCard,
458
+ boardCard,
459
+ )
460
+ }
461
+
462
+ const inject = ['slots', 'locale', 'remote', 'remote.commands']
463
+
464
+ function apply(ctx) {
465
+ const locale = ctx.locale
466
+ if (locale !== undefined && typeof locale.register === 'function') {
467
+ ctx.effect(() => locale.register(NS, MESSAGES), 'collab-pair: locale dictionaries')
468
+ }
469
+ const t = locale !== undefined && typeof locale.bind === 'function' ? locale.bind(NS) : (key) => key
470
+ ctx.slots.inject('settings.section', () => ctx.slots.register({
471
+ name: 'settings.section',
472
+ id: 'collab-pair',
473
+ order: 16,
474
+ label: () => t('nav'),
475
+ inject: () => ({ t, commands: ctx.remote.commands }),
476
+ }, CollabSettings))
477
+ }
478
+
479
+ return { inject, apply }
480
+ },
481
+ })
@@ -0,0 +1,11 @@
1
+ - insert:
2
+ - id: collab-pair
3
+ name: 'dsh-collab-pair'
4
+ config:
5
+ maxRounds: 20
6
+ maxRelayChars: 12000
7
+ maxHistory: 20
8
+ notifyWorkerOnDone: true
9
+ addPrefix: true
10
+ prefixManager: '【项目经理】'
11
+ prefixWorker: '【员工】'
package/icon.svg ADDED
@@ -0,0 +1,24 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="64" height="64" role="img" aria-label="Two linked conversations">
2
+ <defs>
3
+ <linearGradient id="cpA" x1="0" y1="0" x2="1" y2="1">
4
+ <stop offset="0" stop-color="#3b82f6"/>
5
+ <stop offset="1" stop-color="#2563eb"/>
6
+ </linearGradient>
7
+ <linearGradient id="cpB" x1="0" y1="0" x2="1" y2="1">
8
+ <stop offset="0" stop-color="#2dd4bf"/>
9
+ <stop offset="1" stop-color="#0d9488"/>
10
+ </linearGradient>
11
+ </defs>
12
+ <path d="M11 9h24a7 7 0 0 1 7 7v9a7 7 0 0 1-7 7H22l-8 6v-6h-3a7 7 0 0 1-7-7v-9a7 7 0 0 1 7-7z" fill="url(#cpA)"/>
13
+ <circle cx="15" cy="20.5" r="2.1" fill="#eaf1ff"/>
14
+ <circle cx="23" cy="20.5" r="2.1" fill="#eaf1ff"/>
15
+ <circle cx="31" cy="20.5" r="2.1" fill="#eaf1ff"/>
16
+ <path d="M29 33h24a7 7 0 0 1 7 7v9a7 7 0 0 1-7 7H46v6l-8-6H29a7 7 0 0 1-7-7v-9a7 7 0 0 1 7-7z" fill="url(#cpB)"/>
17
+ <circle cx="33" cy="44.5" r="2.1" fill="#e7fffb"/>
18
+ <circle cx="41" cy="44.5" r="2.1" fill="#e7fffb"/>
19
+ <circle cx="49" cy="44.5" r="2.1" fill="#e7fffb"/>
20
+ <path d="M40 28.5c5.4 0 8.5 2.6 8.5 6.6" fill="none" stroke="#94a3b8" stroke-width="2.6" stroke-linecap="round"/>
21
+ <path d="M48.5 35.1l-2.6-1.9 4.9-1.4" fill="none" stroke="#94a3b8" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round"/>
22
+ <path d="M24 34.5c-5.4 0-8.5-2.6-8.5-6.6" fill="none" stroke="#94a3b8" stroke-width="2.6" stroke-linecap="round"/>
23
+ <path d="M15.5 27.9l2.6 1.9-4.9 1.4" fill="none" stroke="#94a3b8" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round"/>
24
+ </svg>