dsh-collab-pair 1.3.1 → 1.4.0
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 +38 -0
- package/client.js +716 -0
- package/cordis.patch.yml +1 -0
- package/index.js +348 -34
- package/package.json +2 -2
package/client.js
CHANGED
|
@@ -69,6 +69,77 @@ window.__ModuleLoader__.load({
|
|
|
69
69
|
minutes: '{count} 分钟',
|
|
70
70
|
hours: '{count} 小时',
|
|
71
71
|
unknownError: '操作失败',
|
|
72
|
+
relayTitle: '跨设备协作',
|
|
73
|
+
relayIntro: '把员工对话搬到另一台设备:ntfy.sh 免费、免部署,但消息经过公共服务器,token 只用于派生私有 topic;自建 hub 更私密。两台设备需要填同一个令牌。',
|
|
74
|
+
relayModeLabel: '中继模式',
|
|
75
|
+
relayOff: '关闭',
|
|
76
|
+
relayHub: '自建 hub',
|
|
77
|
+
relayNtfy: '免费公共中继 ntfy.sh',
|
|
78
|
+
relayOffHint: '关闭后不再轮询中继,令牌会保留,切回时无需重填。',
|
|
79
|
+
relayHubUrl: 'Hub 地址',
|
|
80
|
+
relayRoom: '房间',
|
|
81
|
+
relayToken: '令牌',
|
|
82
|
+
relayTokenKeep: '留空保留已保存的令牌',
|
|
83
|
+
relayDevice: '设备名',
|
|
84
|
+
relayDeviceHint: '设备名由字母、数字、下划线或连字符组成,两台设备各用一个。',
|
|
85
|
+
relayTokenHint: '令牌不会被回显;有已保存的令牌时,留空即沿用。',
|
|
86
|
+
relaySave: '保存中继设置',
|
|
87
|
+
relayTest: '测试连接',
|
|
88
|
+
relayTestHint: '连接测试使用已保存的设置。',
|
|
89
|
+
relaySaved: '中继设置已保存。',
|
|
90
|
+
relaySavedPending: '已保存,插件正在重新加载;稍后点「刷新」查看状态。',
|
|
91
|
+
relayNotSaved: '中继设置未保存。',
|
|
92
|
+
relayTestOk: '连接测试通过。',
|
|
93
|
+
relayStatusTitle: '中继状态',
|
|
94
|
+
relayConnected: '已连接',
|
|
95
|
+
relayDisconnected: '未连接',
|
|
96
|
+
relayLastPoll: '最近轮询',
|
|
97
|
+
relayNever: '从未',
|
|
98
|
+
relayLastError: '最近错误',
|
|
99
|
+
relayStatusLine: '设备 {device} · 房间 {room}',
|
|
100
|
+
relayMissingHubUrl: '请填写 Hub 地址。',
|
|
101
|
+
relayMissingToken: '请填写令牌。',
|
|
102
|
+
relayMissingRoom: '请填写房间名。',
|
|
103
|
+
aliasTitle: '本机别名',
|
|
104
|
+
aliasHint: '在员工设备上把当前对话注册为别名,经理在另一台设备用「关联远端员工」把它接进来。',
|
|
105
|
+
aliasPlaceholder: '如 worker-a',
|
|
106
|
+
aliasRegister: '把当前对话注册为员工',
|
|
107
|
+
aliasDone: '别名已注册。',
|
|
108
|
+
aliasRemoved: '别名已删除。',
|
|
109
|
+
aliasRemove: '删除',
|
|
110
|
+
aliasEmpty: '本机还没有别名。',
|
|
111
|
+
aliasOff: '启用中继后才能注册别名。',
|
|
112
|
+
remoteTitle: '关联远端员工',
|
|
113
|
+
remoteDevice: '远端设备',
|
|
114
|
+
remoteWorker: '远端别名',
|
|
115
|
+
remoteName: '显示名',
|
|
116
|
+
remoteLink: '关联远端员工',
|
|
117
|
+
remoteMissing: '请填写远端设备和别名。',
|
|
118
|
+
remoteLinkDone: '已关联远端员工,接着给它派发任务。',
|
|
119
|
+
stageTitle: '阶段队列',
|
|
120
|
+
stageIntro: '先写好几个大阶段,完成一个会自动派发下一个。',
|
|
121
|
+
stageEmpty: '还没有阶段。先添加几个大阶段,完成一个会自动派发下一个。',
|
|
122
|
+
stageWorker: '员工',
|
|
123
|
+
stageNoWorker: '还没有可用的员工,先关联一个。',
|
|
124
|
+
stageAddTitle: '阶段标题',
|
|
125
|
+
stagePrompt: '提示词',
|
|
126
|
+
stageAcceptance: '验收标准',
|
|
127
|
+
stageAdd: '添加到阶段队列',
|
|
128
|
+
stageAdded: '阶段已添加。',
|
|
129
|
+
stageStarted: '阶段已开始。',
|
|
130
|
+
stageFinished: '阶段已完成。',
|
|
131
|
+
stageRemoved: '阶段已删除。',
|
|
132
|
+
stageUntitled: '未命名阶段',
|
|
133
|
+
stagePromptEmpty: '(无提示词)',
|
|
134
|
+
stageStatusPending: '待开始',
|
|
135
|
+
stageStatusActive: '进行中',
|
|
136
|
+
stageStatusDone: '已完成',
|
|
137
|
+
stageStart: '开始',
|
|
138
|
+
stageComplete: '完成并发下一阶段',
|
|
139
|
+
stageRemove: '删除',
|
|
140
|
+
menuSetManager: '设为项目经理(新建员工)',
|
|
141
|
+
menuWorkerName: '新员工名字',
|
|
142
|
+
menuFailed: '创建员工失败',
|
|
72
143
|
},
|
|
73
144
|
en: {
|
|
74
145
|
nav: 'Collaboration pair',
|
|
@@ -133,6 +204,77 @@ window.__ModuleLoader__.load({
|
|
|
133
204
|
minutes: '{count}m',
|
|
134
205
|
hours: '{count}h',
|
|
135
206
|
unknownError: 'The operation failed',
|
|
207
|
+
relayTitle: 'Cross-device relay',
|
|
208
|
+
relayIntro: 'Move a worker conversation to another machine. ntfy.sh is free and needs no deployment, but messages pass through a public server and the token only derives a private topic; a self-hosted hub is more private. Both devices use the same token.',
|
|
209
|
+
relayModeLabel: 'Relay mode',
|
|
210
|
+
relayOff: 'Off',
|
|
211
|
+
relayHub: 'Self-hosted hub',
|
|
212
|
+
relayNtfy: 'Free public relay ntfy.sh',
|
|
213
|
+
relayOffHint: 'Turning it off stops polling and keeps the token for next time.',
|
|
214
|
+
relayHubUrl: 'Hub URL',
|
|
215
|
+
relayRoom: 'Room',
|
|
216
|
+
relayToken: 'Token',
|
|
217
|
+
relayTokenKeep: 'Leave blank to keep the saved token',
|
|
218
|
+
relayDevice: 'Device name',
|
|
219
|
+
relayDeviceHint: 'A device name uses letters, digits, underscore or hyphen; one per machine.',
|
|
220
|
+
relayTokenHint: 'The token is never echoed back; leave it blank to reuse a saved one.',
|
|
221
|
+
relaySave: 'Save relay settings',
|
|
222
|
+
relayTest: 'Test connection',
|
|
223
|
+
relayTestHint: 'The test uses the saved settings.',
|
|
224
|
+
relaySaved: 'Relay settings saved.',
|
|
225
|
+
relaySavedPending: 'Saved; the plugin is reloading. Refresh in a moment to see the state.',
|
|
226
|
+
relayNotSaved: 'Relay settings were not saved.',
|
|
227
|
+
relayTestOk: 'Connection test passed.',
|
|
228
|
+
relayStatusTitle: 'Relay status',
|
|
229
|
+
relayConnected: 'Connected',
|
|
230
|
+
relayDisconnected: 'Not connected',
|
|
231
|
+
relayLastPoll: 'Last poll',
|
|
232
|
+
relayNever: 'never',
|
|
233
|
+
relayLastError: 'Last error',
|
|
234
|
+
relayStatusLine: 'Device {device} · room {room}',
|
|
235
|
+
relayMissingHubUrl: 'Enter the hub URL.',
|
|
236
|
+
relayMissingToken: 'Enter the token.',
|
|
237
|
+
relayMissingRoom: 'Enter a room name.',
|
|
238
|
+
aliasTitle: 'Local aliases',
|
|
239
|
+
aliasHint: 'Register this conversation as an alias on the worker device; the manager links it from the other machine.',
|
|
240
|
+
aliasPlaceholder: 'e.g. worker-a',
|
|
241
|
+
aliasRegister: 'Register this conversation as a worker',
|
|
242
|
+
aliasDone: 'Alias registered.',
|
|
243
|
+
aliasRemoved: 'Alias removed.',
|
|
244
|
+
aliasRemove: 'Remove',
|
|
245
|
+
aliasEmpty: 'No alias on this device yet.',
|
|
246
|
+
aliasOff: 'Enable the relay before registering an alias.',
|
|
247
|
+
remoteTitle: 'Link a remote worker',
|
|
248
|
+
remoteDevice: 'Remote device',
|
|
249
|
+
remoteWorker: 'Remote alias',
|
|
250
|
+
remoteName: 'Display name',
|
|
251
|
+
remoteLink: 'Link remote worker',
|
|
252
|
+
remoteMissing: 'Enter the remote device and alias.',
|
|
253
|
+
remoteLinkDone: 'Remote worker linked; dispatch a task next.',
|
|
254
|
+
stageTitle: 'Stage queue',
|
|
255
|
+
stageIntro: 'Write a few large stages up front; completing one dispatches the next automatically.',
|
|
256
|
+
stageEmpty: 'No stage yet. Add a few large stages; completing one dispatches the next automatically.',
|
|
257
|
+
stageWorker: 'Worker',
|
|
258
|
+
stageNoWorker: 'No worker available; link one first.',
|
|
259
|
+
stageAddTitle: 'Stage title',
|
|
260
|
+
stagePrompt: 'Prompt',
|
|
261
|
+
stageAcceptance: 'Acceptance',
|
|
262
|
+
stageAdd: 'Add to stage queue',
|
|
263
|
+
stageAdded: 'Stage added.',
|
|
264
|
+
stageStarted: 'Stage started.',
|
|
265
|
+
stageFinished: 'Stage finished.',
|
|
266
|
+
stageRemoved: 'Stage removed.',
|
|
267
|
+
stageUntitled: 'Untitled stage',
|
|
268
|
+
stagePromptEmpty: '(no prompt)',
|
|
269
|
+
stageStatusPending: 'Pending',
|
|
270
|
+
stageStatusActive: 'Active',
|
|
271
|
+
stageStatusDone: 'Done',
|
|
272
|
+
stageStart: 'Start',
|
|
273
|
+
stageComplete: 'Complete and dispatch next',
|
|
274
|
+
stageRemove: 'Remove',
|
|
275
|
+
menuSetManager: 'Set as project manager (new worker)',
|
|
276
|
+
menuWorkerName: 'New worker name',
|
|
277
|
+
menuFailed: 'Could not create the worker',
|
|
136
278
|
},
|
|
137
279
|
}
|
|
138
280
|
|
|
@@ -223,6 +365,24 @@ window.__ModuleLoader__.load({
|
|
|
223
365
|
const [peer, setPeer] = React.useState('new')
|
|
224
366
|
const [mode, setMode] = React.useState('temporary')
|
|
225
367
|
const [projectDraft, setProjectDraft] = React.useState('')
|
|
368
|
+
const [relayMode, setRelayMode] = React.useState('off')
|
|
369
|
+
const [relayHubUrl, setRelayHubUrl] = React.useState('')
|
|
370
|
+
const [relayRoom, setRelayRoom] = React.useState('')
|
|
371
|
+
const [relayToken, setRelayToken] = React.useState('')
|
|
372
|
+
const [relayDevice, setRelayDevice] = React.useState('')
|
|
373
|
+
const [relayState, setRelayState] = React.useState(null)
|
|
374
|
+
const [relayMessage, setRelayMessage] = React.useState(null)
|
|
375
|
+
const [relayError, setRelayError] = React.useState(null)
|
|
376
|
+
const [relayBusy, setRelayBusy] = React.useState(false)
|
|
377
|
+
const [aliases, setAliases] = React.useState([])
|
|
378
|
+
const [aliasDraft, setAliasDraft] = React.useState('')
|
|
379
|
+
const [remoteDevice, setRemoteDevice] = React.useState('')
|
|
380
|
+
const [remoteWorker, setRemoteWorker] = React.useState('')
|
|
381
|
+
const [remoteName, setRemoteName] = React.useState('')
|
|
382
|
+
const [stageWorker, setStageWorker] = React.useState('')
|
|
383
|
+
const [stageTitle, setStageTitle] = React.useState('')
|
|
384
|
+
const [stagePrompt, setStagePrompt] = React.useState('')
|
|
385
|
+
const [stageAcceptance, setStageAcceptance] = React.useState('')
|
|
226
386
|
const commandsRef = React.useRef(commands)
|
|
227
387
|
commandsRef.current = commands
|
|
228
388
|
|
|
@@ -263,6 +423,30 @@ window.__ModuleLoader__.load({
|
|
|
263
423
|
}
|
|
264
424
|
}, [workId, loadBoard])
|
|
265
425
|
|
|
426
|
+
React.useEffect(() => {
|
|
427
|
+
if (workId === undefined) return undefined
|
|
428
|
+
let cancelled = false
|
|
429
|
+
const load = async () => {
|
|
430
|
+
try {
|
|
431
|
+
const value = await runCommand(commandsRef.current, workId, '/collab relay {"action":"get"}')
|
|
432
|
+
if (cancelled) return
|
|
433
|
+
applyRelayState(value)
|
|
434
|
+
if (value === null || typeof value !== 'object' || value.mode === 'off') {
|
|
435
|
+
setAliases([])
|
|
436
|
+
return
|
|
437
|
+
}
|
|
438
|
+
const list = await runCommand(commandsRef.current, workId, '/collab remote {"action":"aliases"}')
|
|
439
|
+
if (!cancelled && list !== null && typeof list === 'object' && Array.isArray(list.aliases)) setAliases(list.aliases)
|
|
440
|
+
} catch {
|
|
441
|
+
// The relay state is optional for this page; keep whatever the person is typing.
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
void load()
|
|
445
|
+
return () => {
|
|
446
|
+
cancelled = true
|
|
447
|
+
}
|
|
448
|
+
}, [workId])
|
|
449
|
+
|
|
266
450
|
const act = async (line, successText) => {
|
|
267
451
|
if (workId === undefined) return
|
|
268
452
|
setBusy(true)
|
|
@@ -285,6 +469,8 @@ window.__ModuleLoader__.load({
|
|
|
285
469
|
setError(null)
|
|
286
470
|
try {
|
|
287
471
|
await loadBoard(workId)
|
|
472
|
+
const relay = await readRelay(workId).catch(() => null)
|
|
473
|
+
if (relay !== null && relay.mode !== 'off') await loadAliases(workId).catch(() => undefined)
|
|
288
474
|
} catch (cause) {
|
|
289
475
|
setError(cause instanceof Error ? cause.message : String(cause))
|
|
290
476
|
} finally {
|
|
@@ -335,6 +521,178 @@ window.__ModuleLoader__.load({
|
|
|
335
521
|
void act(`/collab project ${JSON.stringify({ name })}`, t('projectSaved')).then(() => setProjectDraft(''))
|
|
336
522
|
}
|
|
337
523
|
|
|
524
|
+
const applyRelayState = (value) => {
|
|
525
|
+
if (value === null || typeof value !== 'object') return
|
|
526
|
+
setRelayState(value)
|
|
527
|
+
setRelayMode(value.mode === 'hub' || value.mode === 'ntfy' ? value.mode : 'off')
|
|
528
|
+
setRelayHubUrl(typeof value.hubUrl === 'string' ? value.hubUrl : '')
|
|
529
|
+
setRelayRoom(typeof value.room === 'string' ? value.room : '')
|
|
530
|
+
setRelayDevice(typeof value.device === 'string' ? value.device : '')
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
const readRelay = async (sessionId) => {
|
|
534
|
+
const value = await runCommand(commandsRef.current, sessionId, '/collab relay {"action":"get"}')
|
|
535
|
+
applyRelayState(value)
|
|
536
|
+
return value
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
const loadAliases = async (sessionId) => {
|
|
540
|
+
const value = await runCommand(commandsRef.current, sessionId, '/collab remote {"action":"aliases"}')
|
|
541
|
+
setAliases(value !== null && typeof value === 'object' && Array.isArray(value.aliases) ? value.aliases : [])
|
|
542
|
+
return value
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/** Run one command, show the dictionary text, then refresh the board. */
|
|
546
|
+
const runAction = async (line, successText) => {
|
|
547
|
+
if (workId === undefined) return
|
|
548
|
+
setBusy(true)
|
|
549
|
+
setError(null)
|
|
550
|
+
setNotice(null)
|
|
551
|
+
try {
|
|
552
|
+
await runCommand(commandsRef.current, workId, line)
|
|
553
|
+
setNotice(successText)
|
|
554
|
+
await loadBoard(workId)
|
|
555
|
+
} catch (cause) {
|
|
556
|
+
setError(cause instanceof Error ? cause.message : String(cause))
|
|
557
|
+
} finally {
|
|
558
|
+
setBusy(false)
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
const saveRelay = async () => {
|
|
563
|
+
if (workId === undefined) return
|
|
564
|
+
const mode = relayMode
|
|
565
|
+
const token = relayToken.trim()
|
|
566
|
+
// The Host keeps the stored token when hubToken is empty and keepToken is set.
|
|
567
|
+
const keepToken = token === '' && relayState !== null && relayState.hasToken === true
|
|
568
|
+
if (mode === 'hub' && relayHubUrl.trim() === '') {
|
|
569
|
+
setRelayError(t('relayMissingHubUrl'))
|
|
570
|
+
return
|
|
571
|
+
}
|
|
572
|
+
if (mode !== 'off' && token === '' && !keepToken) {
|
|
573
|
+
setRelayError(t('relayMissingToken'))
|
|
574
|
+
return
|
|
575
|
+
}
|
|
576
|
+
if (mode === 'ntfy' && relayRoom.trim() === '') {
|
|
577
|
+
setRelayError(t('relayMissingRoom'))
|
|
578
|
+
return
|
|
579
|
+
}
|
|
580
|
+
setRelayBusy(true)
|
|
581
|
+
setRelayError(null)
|
|
582
|
+
setRelayMessage(null)
|
|
583
|
+
const payload = {
|
|
584
|
+
action: 'set',
|
|
585
|
+
mode,
|
|
586
|
+
hubUrl: relayHubUrl.trim(),
|
|
587
|
+
hubRoom: relayRoom.trim(),
|
|
588
|
+
hubToken: token,
|
|
589
|
+
...(keepToken ? { keepToken: true } : {}),
|
|
590
|
+
deviceName: relayDevice.trim(),
|
|
591
|
+
}
|
|
592
|
+
let failure = null
|
|
593
|
+
try {
|
|
594
|
+
await runCommand(commandsRef.current, workId, `/collab relay ${JSON.stringify(payload)}`)
|
|
595
|
+
} catch (cause) {
|
|
596
|
+
// Saving a setting restarts the Host plugin, so this call may be interrupted.
|
|
597
|
+
failure = cause instanceof Error ? cause.message : String(cause)
|
|
598
|
+
}
|
|
599
|
+
await new Promise((resolve) => setTimeout(resolve, 2000))
|
|
600
|
+
try {
|
|
601
|
+
const value = await readRelay(workId)
|
|
602
|
+
if (value !== null && typeof value === 'object' && value.mode === mode) {
|
|
603
|
+
setRelayMessage(t('relaySaved'))
|
|
604
|
+
if (mode === 'off') setAliases([])
|
|
605
|
+
else await loadAliases(workId).catch(() => undefined)
|
|
606
|
+
await loadBoard(workId).catch(() => undefined)
|
|
607
|
+
} else {
|
|
608
|
+
setRelayError(failure === null ? t('relayNotSaved') : failure)
|
|
609
|
+
}
|
|
610
|
+
} catch {
|
|
611
|
+
// The page may still be reconnecting after the reload.
|
|
612
|
+
if (failure === null) setRelayMessage(t('relaySavedPending'))
|
|
613
|
+
else setRelayError(failure)
|
|
614
|
+
} finally {
|
|
615
|
+
setRelayBusy(false)
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
const testRelay = async () => {
|
|
620
|
+
if (workId === undefined) return
|
|
621
|
+
setRelayBusy(true)
|
|
622
|
+
setRelayError(null)
|
|
623
|
+
setRelayMessage(null)
|
|
624
|
+
try {
|
|
625
|
+
const value = await runCommand(commandsRef.current, workId, '/collab relay {"action":"test"}')
|
|
626
|
+
const text = value !== null && typeof value === 'object' && typeof value.message === 'string' ? value.message : ''
|
|
627
|
+
setRelayMessage(text === '' ? t('relayTestOk') : text)
|
|
628
|
+
await readRelay(workId).catch(() => undefined)
|
|
629
|
+
} catch (cause) {
|
|
630
|
+
setRelayError(cause instanceof Error ? cause.message : String(cause))
|
|
631
|
+
} finally {
|
|
632
|
+
setRelayBusy(false)
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
const registerAlias = async () => {
|
|
637
|
+
if (workId === undefined) return
|
|
638
|
+
const alias = aliasDraft.trim()
|
|
639
|
+
if (alias === '') return
|
|
640
|
+
setRelayBusy(true)
|
|
641
|
+
setRelayError(null)
|
|
642
|
+
setRelayMessage(null)
|
|
643
|
+
try {
|
|
644
|
+
await runCommand(commandsRef.current, workId, `/collab remote ${JSON.stringify({ action: 'alias', alias })}`)
|
|
645
|
+
setRelayMessage(t('aliasDone'))
|
|
646
|
+
setAliasDraft('')
|
|
647
|
+
await loadAliases(workId).catch(() => undefined)
|
|
648
|
+
} catch (cause) {
|
|
649
|
+
setRelayError(cause instanceof Error ? cause.message : String(cause))
|
|
650
|
+
} finally {
|
|
651
|
+
setRelayBusy(false)
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
const removeAlias = async (alias) => {
|
|
656
|
+
if (workId === undefined) return
|
|
657
|
+
setRelayBusy(true)
|
|
658
|
+
setRelayError(null)
|
|
659
|
+
setRelayMessage(null)
|
|
660
|
+
try {
|
|
661
|
+
await runCommand(commandsRef.current, workId, `/collab remote ${JSON.stringify({ action: 'remove-alias', alias })}`)
|
|
662
|
+
setRelayMessage(t('aliasRemoved'))
|
|
663
|
+
await loadAliases(workId).catch(() => undefined)
|
|
664
|
+
} catch (cause) {
|
|
665
|
+
setRelayError(cause instanceof Error ? cause.message : String(cause))
|
|
666
|
+
} finally {
|
|
667
|
+
setRelayBusy(false)
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
const linkRemote = async () => {
|
|
672
|
+
if (workId === undefined) return
|
|
673
|
+
const device = remoteDevice.trim()
|
|
674
|
+
const worker = remoteWorker.trim()
|
|
675
|
+
if (device === '' || worker === '') {
|
|
676
|
+
setRelayError(t('remoteMissing'))
|
|
677
|
+
return
|
|
678
|
+
}
|
|
679
|
+
setRelayBusy(true)
|
|
680
|
+
setRelayError(null)
|
|
681
|
+
setRelayMessage(null)
|
|
682
|
+
try {
|
|
683
|
+
await runCommand(commandsRef.current, workId, `/collab remote ${JSON.stringify({ action: 'link', device, worker, name: remoteName.trim() })}`)
|
|
684
|
+
setRelayMessage(t('remoteLinkDone'))
|
|
685
|
+
setRemoteDevice('')
|
|
686
|
+
setRemoteWorker('')
|
|
687
|
+
setRemoteName('')
|
|
688
|
+
await loadBoard(workId).catch(() => undefined)
|
|
689
|
+
} catch (cause) {
|
|
690
|
+
setRelayError(cause instanceof Error ? cause.message : String(cause))
|
|
691
|
+
} finally {
|
|
692
|
+
setRelayBusy(false)
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
|
|
338
696
|
const links = board !== null && Array.isArray(board.links) ? board.links : []
|
|
339
697
|
const messageLang = board !== null && board.language === 'en' ? 'en' : 'zh'
|
|
340
698
|
const associated = links.filter((link) => link.status === 'active' || link.mode === 'permanent')
|
|
@@ -345,6 +703,38 @@ window.__ModuleLoader__.load({
|
|
|
345
703
|
const managerProject = managed.find((link) => typeof link.project === 'string' && link.project !== '')?.project ?? ''
|
|
346
704
|
const peerChoices = sessions.filter((row) => row.id !== workId)
|
|
347
705
|
|
|
706
|
+
/** What the stage queue can pass as the worker parameter for one board link. */
|
|
707
|
+
const stageRef = (link) => (typeof link.linkId === 'string' && link.linkId !== '' ? link.linkId : link.worker)
|
|
708
|
+
const managedKey = managed.map((link) => stageRef(link)).join('|')
|
|
709
|
+
React.useEffect(() => {
|
|
710
|
+
if (managed.length === 0) return
|
|
711
|
+
if (managed.some((link) => stageRef(link) === stageWorker)) return
|
|
712
|
+
setStageWorker(stageRef(managed[0]))
|
|
713
|
+
}, [managedKey, stageWorker])
|
|
714
|
+
|
|
715
|
+
const stageLink = managed.find((link) => stageRef(link) === stageWorker) ?? (managed.length === 0 ? undefined : managed[0])
|
|
716
|
+
const stageList = stageLink !== undefined && Array.isArray(stageLink.stages) ? stageLink.stages : []
|
|
717
|
+
const stageStatusOf = (value) => {
|
|
718
|
+
if (value === 'active') return { label: t('stageStatusActive'), color: 'var(--dsw-alias-state-success-primary)' }
|
|
719
|
+
if (value === 'done') return { label: t('stageStatusDone'), color: 'var(--dsw-alias-label-secondary)' }
|
|
720
|
+
return { label: t('stageStatusPending'), color: 'var(--dsw-alias-state-warn-primary)' }
|
|
721
|
+
}
|
|
722
|
+
const runStage = (payload) => {
|
|
723
|
+
if (workId === undefined || stageLink === undefined) return
|
|
724
|
+
const line = `/collab stage ${JSON.stringify({ ...payload, worker: stageRef(stageLink) })}`
|
|
725
|
+
void runAction(line, payload.action === 'remove' ? t('stageRemoved') : payload.action === 'complete' ? t('stageFinished') : t('stageStarted'))
|
|
726
|
+
}
|
|
727
|
+
const addStage = () => {
|
|
728
|
+
if (workId === undefined || stageLink === undefined) return
|
|
729
|
+
const prompt = stagePrompt.trim()
|
|
730
|
+
if (prompt === '') return
|
|
731
|
+
const line = `/collab stage ${JSON.stringify({ action: 'add', worker: stageRef(stageLink), title: stageTitle.trim(), prompt, acceptance: stageAcceptance.trim() })}`
|
|
732
|
+
setStageTitle('')
|
|
733
|
+
setStagePrompt('')
|
|
734
|
+
setStageAcceptance('')
|
|
735
|
+
void runAction(line, t('stageAdded'))
|
|
736
|
+
}
|
|
737
|
+
|
|
348
738
|
const statusText = (value) => {
|
|
349
739
|
if (value === 'done') return t('statusDone')
|
|
350
740
|
if (value === 'partial') return t('statusPartial')
|
|
@@ -438,6 +828,257 @@ window.__ModuleLoader__.load({
|
|
|
438
828
|
)
|
|
439
829
|
}
|
|
440
830
|
|
|
831
|
+
const relayModeText = (value) => (value === 'hub' ? t('relayHub') : value === 'ntfy' ? t('relayNtfy') : t('relayOff'))
|
|
832
|
+
const relayTimeText = (value) => {
|
|
833
|
+
if (typeof value !== 'string' || value === '') return t('relayNever')
|
|
834
|
+
const time = new Date(value)
|
|
835
|
+
return Number.isNaN(time.getTime()) ? value : time.toLocaleTimeString()
|
|
836
|
+
}
|
|
837
|
+
const relayReady = relayState !== null && typeof relayState === 'object' && relayState.mode !== 'off'
|
|
838
|
+
const relayField = (value) => (busy || relayBusy || workId === undefined)
|
|
839
|
+
|
|
840
|
+
const relayStatusView = h('div', { style: { display: 'flex', flexDirection: 'column', gap: 4 } },
|
|
841
|
+
h('div', { style: S.muted }, t('relayStatusTitle')),
|
|
842
|
+
relayState === null
|
|
843
|
+
? h('div', { style: S.muted }, t('loading'))
|
|
844
|
+
: h('div', { style: { display: 'flex', flexDirection: 'column', gap: 4 } },
|
|
845
|
+
h('div', { style: S.row },
|
|
846
|
+
h('span', { style: S.badge }, relayModeText(relayState.mode)),
|
|
847
|
+
h('span', { style: { ...S.badge, color: relayState.connected === true ? 'var(--dsw-alias-state-success-primary)' : 'var(--dsw-alias-label-secondary)' } }, relayState.connected === true ? t('relayConnected') : t('relayDisconnected')),
|
|
848
|
+
),
|
|
849
|
+
h('div', { style: S.muted }, t('relayStatusLine', {
|
|
850
|
+
device: typeof relayState.device === 'string' && relayState.device !== '' ? relayState.device : '-',
|
|
851
|
+
room: typeof relayState.room === 'string' && relayState.room !== '' ? relayState.room : '-',
|
|
852
|
+
})),
|
|
853
|
+
h('div', { style: S.muted }, `${t('relayLastPoll')}:${relayTimeText(relayState.lastPollAt)}`),
|
|
854
|
+
typeof relayState.lastError === 'string' && relayState.lastError !== ''
|
|
855
|
+
? h('div', { style: { ...S.muted, color: 'var(--dsw-alias-state-warn-primary)' } }, `${t('relayLastError')}:${relayState.lastError}`)
|
|
856
|
+
: null,
|
|
857
|
+
),
|
|
858
|
+
)
|
|
859
|
+
|
|
860
|
+
const relayCard = h('div', { style: S.card },
|
|
861
|
+
h('h3', { style: S.cardTitle }, t('relayTitle')),
|
|
862
|
+
h('p', { style: S.hint }, t('relayIntro')),
|
|
863
|
+
h('label', { style: S.label }, t('relayModeLabel'),
|
|
864
|
+
h('select', {
|
|
865
|
+
style: S.input,
|
|
866
|
+
value: relayMode,
|
|
867
|
+
disabled: relayField(),
|
|
868
|
+
onChange: (event) => setRelayMode(event.target.value),
|
|
869
|
+
},
|
|
870
|
+
h('option', { value: 'off' }, t('relayOff')),
|
|
871
|
+
h('option', { value: 'hub' }, t('relayHub')),
|
|
872
|
+
h('option', { value: 'ntfy' }, t('relayNtfy'))),
|
|
873
|
+
),
|
|
874
|
+
relayMode === 'off' ? h('div', { style: S.hint }, t('relayOffHint')) : null,
|
|
875
|
+
relayMode === 'hub'
|
|
876
|
+
? h('label', { style: S.label }, t('relayHubUrl'),
|
|
877
|
+
h('input', {
|
|
878
|
+
style: S.input,
|
|
879
|
+
value: relayHubUrl,
|
|
880
|
+
placeholder: 'https://hub.example.com',
|
|
881
|
+
disabled: relayField(),
|
|
882
|
+
onChange: (event) => setRelayHubUrl(event.target.value),
|
|
883
|
+
}))
|
|
884
|
+
: null,
|
|
885
|
+
relayMode === 'off'
|
|
886
|
+
? null
|
|
887
|
+
: h('div', { style: { display: 'flex', gap: 8, flexWrap: 'wrap' } },
|
|
888
|
+
h('label', { style: { ...S.label, flex: 1, minWidth: 160 } }, t('relayRoom'),
|
|
889
|
+
h('input', {
|
|
890
|
+
style: S.input,
|
|
891
|
+
value: relayRoom,
|
|
892
|
+
placeholder: 'default',
|
|
893
|
+
disabled: relayField(),
|
|
894
|
+
onChange: (event) => setRelayRoom(event.target.value),
|
|
895
|
+
})),
|
|
896
|
+
h('label', { style: { ...S.label, flex: 1, minWidth: 160 } }, t('relayToken'),
|
|
897
|
+
h('input', {
|
|
898
|
+
type: 'password',
|
|
899
|
+
style: S.input,
|
|
900
|
+
value: relayToken,
|
|
901
|
+
placeholder: relayState !== null && relayState.hasToken === true && relayToken === '' ? t('relayTokenKeep') : '',
|
|
902
|
+
disabled: relayField(),
|
|
903
|
+
onChange: (event) => setRelayToken(event.target.value),
|
|
904
|
+
})),
|
|
905
|
+
),
|
|
906
|
+
h('label', { style: S.label }, t('relayDevice'),
|
|
907
|
+
h('input', {
|
|
908
|
+
style: S.input,
|
|
909
|
+
value: relayDevice,
|
|
910
|
+
disabled: relayField(),
|
|
911
|
+
onChange: (event) => setRelayDevice(event.target.value),
|
|
912
|
+
})),
|
|
913
|
+
h('div', { style: S.hint }, t('relayDeviceHint')),
|
|
914
|
+
relayMode === 'off' ? null : h('div', { style: S.hint }, t('relayTokenHint')),
|
|
915
|
+
h('div', { style: S.row },
|
|
916
|
+
h('button', { type: 'button', style: S.primary, disabled: relayField(), onClick: () => void saveRelay() }, t('relaySave')),
|
|
917
|
+
h('button', { type: 'button', style: S.secondary, disabled: relayField() || !relayReady, onClick: () => void testRelay() }, t('relayTest')),
|
|
918
|
+
relayBusy ? h('span', { style: S.muted }, t('busy')) : null,
|
|
919
|
+
),
|
|
920
|
+
h('div', { style: S.hint }, t('relayTestHint')),
|
|
921
|
+
relayStatusView,
|
|
922
|
+
relayError !== null ? h('p', { style: { ...S.notice, color: 'var(--dsw-alias-state-error-primary)' } }, relayError) : null,
|
|
923
|
+
relayMessage !== null ? h('p', { style: { ...S.notice, color: 'var(--dsw-alias-state-success-primary)' } }, relayMessage) : null,
|
|
924
|
+
h('hr', { style: { border: 0, borderTop: '1px solid var(--dsw-alias-border-l1)', margin: '2px 0' } }),
|
|
925
|
+
h('h4', { style: S.cardTitle }, t('aliasTitle')),
|
|
926
|
+
h('p', { style: S.hint }, t('aliasHint')),
|
|
927
|
+
relayReady ? null : h('p', { style: S.hint }, t('aliasOff')),
|
|
928
|
+
h('div', { style: S.row },
|
|
929
|
+
h('input', {
|
|
930
|
+
style: { ...S.input, flex: 1, minWidth: 160 },
|
|
931
|
+
value: aliasDraft,
|
|
932
|
+
placeholder: t('aliasPlaceholder'),
|
|
933
|
+
disabled: relayField() || !relayReady,
|
|
934
|
+
onChange: (event) => setAliasDraft(event.target.value),
|
|
935
|
+
}),
|
|
936
|
+
h('button', {
|
|
937
|
+
type: 'button',
|
|
938
|
+
style: S.secondary,
|
|
939
|
+
disabled: relayField() || !relayReady || aliasDraft.trim() === '',
|
|
940
|
+
onClick: () => void registerAlias(),
|
|
941
|
+
}, t('aliasRegister')),
|
|
942
|
+
),
|
|
943
|
+
aliases.length === 0
|
|
944
|
+
? h('p', { style: S.hint }, t('aliasEmpty'))
|
|
945
|
+
: aliases.map((record) => h('div', { key: String(record.alias), style: S.worker },
|
|
946
|
+
h('div', { style: S.workerMain },
|
|
947
|
+
h('div', { style: S.workerName }, record.alias),
|
|
948
|
+
h('div', { style: S.mono }, record.session),
|
|
949
|
+
),
|
|
950
|
+
h('button', {
|
|
951
|
+
type: 'button',
|
|
952
|
+
style: S.danger,
|
|
953
|
+
disabled: relayField(),
|
|
954
|
+
onClick: () => void removeAlias(record.alias),
|
|
955
|
+
}, t('aliasRemove')),
|
|
956
|
+
)),
|
|
957
|
+
role === 'worker'
|
|
958
|
+
? null
|
|
959
|
+
: h('div', { style: { display: 'flex', flexDirection: 'column', gap: 8 } },
|
|
960
|
+
h('h4', { style: S.cardTitle }, t('remoteTitle')),
|
|
961
|
+
h('div', { style: { display: 'flex', gap: 8, flexWrap: 'wrap' } },
|
|
962
|
+
h('label', { style: { ...S.label, flex: 1, minWidth: 120 } }, t('remoteDevice'),
|
|
963
|
+
h('input', {
|
|
964
|
+
style: S.input,
|
|
965
|
+
value: remoteDevice,
|
|
966
|
+
disabled: relayField() || !relayReady,
|
|
967
|
+
onChange: (event) => setRemoteDevice(event.target.value),
|
|
968
|
+
})),
|
|
969
|
+
h('label', { style: { ...S.label, flex: 1, minWidth: 120 } }, t('remoteWorker'),
|
|
970
|
+
h('input', {
|
|
971
|
+
style: S.input,
|
|
972
|
+
value: remoteWorker,
|
|
973
|
+
disabled: relayField() || !relayReady,
|
|
974
|
+
onChange: (event) => setRemoteWorker(event.target.value),
|
|
975
|
+
})),
|
|
976
|
+
h('label', { style: { ...S.label, flex: 1, minWidth: 120 } }, t('remoteName'),
|
|
977
|
+
h('input', {
|
|
978
|
+
style: S.input,
|
|
979
|
+
value: remoteName,
|
|
980
|
+
disabled: relayField() || !relayReady,
|
|
981
|
+
onChange: (event) => setRemoteName(event.target.value),
|
|
982
|
+
})),
|
|
983
|
+
),
|
|
984
|
+
h('div', { style: S.row },
|
|
985
|
+
h('button', {
|
|
986
|
+
type: 'button',
|
|
987
|
+
style: S.primary,
|
|
988
|
+
disabled: relayField() || !relayReady || remoteDevice.trim() === '' || remoteWorker.trim() === '',
|
|
989
|
+
onClick: () => void linkRemote(),
|
|
990
|
+
}, t('remoteLink')),
|
|
991
|
+
),
|
|
992
|
+
),
|
|
993
|
+
)
|
|
994
|
+
|
|
995
|
+
const stageRow = (stage, index) => {
|
|
996
|
+
const status = stageStatusOf(stage.status)
|
|
997
|
+
return h('div', { key: typeof stage.id === 'string' ? stage.id : String(index), style: S.taskRow },
|
|
998
|
+
h('div', { style: S.taskMain },
|
|
999
|
+
h('div', { style: S.taskTitle }, `${index + 1}. ${typeof stage.title === 'string' && stage.title !== '' ? stage.title : t('stageUntitled')}`),
|
|
1000
|
+
h('p', { style: S.taskText }, typeof stage.prompt === 'string' && stage.prompt !== '' ? stage.prompt : t('stagePromptEmpty')),
|
|
1001
|
+
stage.status === 'done' && typeof stage.summary === 'string' && stage.summary !== ''
|
|
1002
|
+
? h('div', { style: S.muted }, stage.summary)
|
|
1003
|
+
: null,
|
|
1004
|
+
),
|
|
1005
|
+
h('div', { style: S.row },
|
|
1006
|
+
h('span', { style: { ...S.badge, color: status.color } }, status.label),
|
|
1007
|
+
stage.status === 'pending'
|
|
1008
|
+
? h('button', { type: 'button', style: S.secondary, disabled: busy, onClick: () => void runStage({ action: 'start' }) }, t('stageStart'))
|
|
1009
|
+
: null,
|
|
1010
|
+
stage.status === 'pending'
|
|
1011
|
+
? h('button', { type: 'button', style: S.danger, disabled: busy, onClick: () => void runStage({ action: 'remove', index: index + 1 }) }, t('stageRemove'))
|
|
1012
|
+
: null,
|
|
1013
|
+
stage.status === 'active'
|
|
1014
|
+
? h('button', { type: 'button', style: S.primary, disabled: busy, onClick: () => void runStage({ action: 'complete' }) }, t('stageComplete'))
|
|
1015
|
+
: null,
|
|
1016
|
+
),
|
|
1017
|
+
)
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
const stageCard = role !== 'manager'
|
|
1021
|
+
? null
|
|
1022
|
+
: h('div', { style: S.card },
|
|
1023
|
+
h('div', { style: S.cardHead },
|
|
1024
|
+
h('h3', { style: S.cardTitle }, t('stageTitle')),
|
|
1025
|
+
h('span', { style: S.muted }, t('stageIntro')),
|
|
1026
|
+
),
|
|
1027
|
+
managed.length === 0
|
|
1028
|
+
? h('p', { style: S.intro }, t('stageNoWorker'))
|
|
1029
|
+
: h('div', { style: { display: 'flex', flexDirection: 'column', gap: 12 } },
|
|
1030
|
+
h('label', { style: S.label }, t('stageWorker'),
|
|
1031
|
+
h('select', {
|
|
1032
|
+
style: S.input,
|
|
1033
|
+
value: stageLink === undefined ? '' : stageRef(stageLink),
|
|
1034
|
+
disabled: busy,
|
|
1035
|
+
onChange: (event) => {
|
|
1036
|
+
setStageWorker(event.target.value)
|
|
1037
|
+
setStageTitle('')
|
|
1038
|
+
setStagePrompt('')
|
|
1039
|
+
setStageAcceptance('')
|
|
1040
|
+
},
|
|
1041
|
+
},
|
|
1042
|
+
managed.map((link) => h('option', { key: stageRef(link), value: stageRef(link) },
|
|
1043
|
+
link.remote !== null && link.remote !== undefined
|
|
1044
|
+
? `${link.workerTitle || link.worker} · ${t('remoteLabel')}`
|
|
1045
|
+
: link.workerTitle || link.worker))),
|
|
1046
|
+
),
|
|
1047
|
+
h('label', { style: S.label }, t('stageAddTitle'),
|
|
1048
|
+
h('input', {
|
|
1049
|
+
style: S.input,
|
|
1050
|
+
value: stageTitle,
|
|
1051
|
+
disabled: busy,
|
|
1052
|
+
onChange: (event) => setStageTitle(event.target.value),
|
|
1053
|
+
})),
|
|
1054
|
+
h('label', { style: S.label }, t('stagePrompt'),
|
|
1055
|
+
h('textarea', {
|
|
1056
|
+
style: { ...S.input, minHeight: 88, resize: 'vertical' },
|
|
1057
|
+
value: stagePrompt,
|
|
1058
|
+
disabled: busy,
|
|
1059
|
+
onChange: (event) => setStagePrompt(event.target.value),
|
|
1060
|
+
})),
|
|
1061
|
+
h('label', { style: S.label }, t('stageAcceptance'),
|
|
1062
|
+
h('textarea', {
|
|
1063
|
+
style: { ...S.input, minHeight: 56, resize: 'vertical' },
|
|
1064
|
+
value: stageAcceptance,
|
|
1065
|
+
disabled: busy,
|
|
1066
|
+
onChange: (event) => setStageAcceptance(event.target.value),
|
|
1067
|
+
})),
|
|
1068
|
+
h('div', { style: S.row },
|
|
1069
|
+
h('button', {
|
|
1070
|
+
type: 'button',
|
|
1071
|
+
style: S.primary,
|
|
1072
|
+
disabled: busy || stagePrompt.trim() === '',
|
|
1073
|
+
onClick: () => void addStage(),
|
|
1074
|
+
}, t('stageAdd')),
|
|
1075
|
+
),
|
|
1076
|
+
stageList.length === 0
|
|
1077
|
+
? h('p', { style: S.intro }, t('stageEmpty'))
|
|
1078
|
+
: h('div', { style: { display: 'flex', flexDirection: 'column', gap: 8 } }, stageList.map(stageRow)),
|
|
1079
|
+
),
|
|
1080
|
+
)
|
|
1081
|
+
|
|
441
1082
|
const groups = []
|
|
442
1083
|
const groupMap = new Map()
|
|
443
1084
|
for (const link of links) {
|
|
@@ -587,6 +1228,8 @@ window.__ModuleLoader__.load({
|
|
|
587
1228
|
feedback,
|
|
588
1229
|
h('h3', { style: S.cardTitle }, workTitle === undefined ? t('currentTitle') : `${t('currentTitle')} · ${workTitle}`),
|
|
589
1230
|
currentCard,
|
|
1231
|
+
relayCard,
|
|
1232
|
+
stageCard,
|
|
590
1233
|
boardCard,
|
|
591
1234
|
starRow,
|
|
592
1235
|
)
|
|
@@ -600,6 +1243,79 @@ window.__ModuleLoader__.load({
|
|
|
600
1243
|
ctx.effect(() => locale.register(NS, MESSAGES), 'collab-pair: locale dictionaries')
|
|
601
1244
|
}
|
|
602
1245
|
const t = locale !== undefined && typeof locale.bind === 'function' ? locale.bind(NS) : (key) => key
|
|
1246
|
+
const boundT = locale !== undefined && typeof locale.bind === 'function' ? locale.bind(NS) : (key) => key
|
|
1247
|
+
const commands = ctx.remote !== undefined && ctx.remote !== null ? ctx.remote.commands : undefined
|
|
1248
|
+
|
|
1249
|
+
/** Session context menu: make this conversation a manager with one fresh worker. */
|
|
1250
|
+
function SetManagerItem(props) {
|
|
1251
|
+
const [busy, setBusy] = React.useState(false)
|
|
1252
|
+
const menu = typeof props.useMenuOpenState === 'function' ? props.useMenuOpenState() : undefined
|
|
1253
|
+
/** Close the menu through whatever handle the owner hands us; older menus pass none. */
|
|
1254
|
+
const closeMenu = () => {
|
|
1255
|
+
if (typeof menu === 'function') {
|
|
1256
|
+
menu()
|
|
1257
|
+
return
|
|
1258
|
+
}
|
|
1259
|
+
if (Array.isArray(menu) && typeof menu[1] === 'function') {
|
|
1260
|
+
menu[1](false)
|
|
1261
|
+
return
|
|
1262
|
+
}
|
|
1263
|
+
if (menu === undefined || menu === null) return
|
|
1264
|
+
if (typeof menu.close === 'function') {
|
|
1265
|
+
menu.close()
|
|
1266
|
+
return
|
|
1267
|
+
}
|
|
1268
|
+
if (typeof menu.setOpen === 'function') menu.setOpen(false)
|
|
1269
|
+
}
|
|
1270
|
+
const setManager = async () => {
|
|
1271
|
+
if (busy) return
|
|
1272
|
+
closeMenu()
|
|
1273
|
+
const sessionId = typeof props.sessionId === 'string' ? props.sessionId : ''
|
|
1274
|
+
if (sessionId === '') return
|
|
1275
|
+
const answer = typeof window.prompt === 'function' ? window.prompt(boundT('menuWorkerName'), '员工') : null
|
|
1276
|
+
if (answer === null) return
|
|
1277
|
+
const name = typeof answer === 'string' ? answer.trim() : ''
|
|
1278
|
+
setBusy(true)
|
|
1279
|
+
try {
|
|
1280
|
+
await runCommand(commands, sessionId, `/collab create ${JSON.stringify(name === '' ? {} : { name })}`)
|
|
1281
|
+
} catch (cause) {
|
|
1282
|
+
const detail = cause instanceof Error ? cause.message : String(cause)
|
|
1283
|
+
if (typeof window.alert === 'function') window.alert(`${boundT('menuFailed')}\n${detail}`)
|
|
1284
|
+
} finally {
|
|
1285
|
+
setBusy(false)
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
return h('button', {
|
|
1289
|
+
type: 'button',
|
|
1290
|
+
role: 'menuitem',
|
|
1291
|
+
disabled: busy,
|
|
1292
|
+
onClick: () => void setManager(),
|
|
1293
|
+
style: {
|
|
1294
|
+
display: 'flex',
|
|
1295
|
+
alignItems: 'center',
|
|
1296
|
+
gap: 8,
|
|
1297
|
+
width: '100%',
|
|
1298
|
+
padding: '6px 10px',
|
|
1299
|
+
border: '1px solid transparent',
|
|
1300
|
+
borderRadius: 6,
|
|
1301
|
+
background: 'transparent',
|
|
1302
|
+
color: 'var(--dsw-alias-label-primary)',
|
|
1303
|
+
fontFamily: 'inherit',
|
|
1304
|
+
fontSize: 13,
|
|
1305
|
+
lineHeight: 1.4,
|
|
1306
|
+
textAlign: 'left',
|
|
1307
|
+
cursor: busy ? 'default' : 'pointer',
|
|
1308
|
+
opacity: busy ? 0.6 : 1,
|
|
1309
|
+
},
|
|
1310
|
+
}, boundT('menuSetManager'))
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
ctx.slots.inject('sidebar.workspaces.session.menu.item', () => ctx.slots.register({
|
|
1314
|
+
name: 'sidebar.workspaces.session.menu.item',
|
|
1315
|
+
id: 'collab-pair-set-manager',
|
|
1316
|
+
order: 20,
|
|
1317
|
+
}, (props) => h(SetManagerItem, { ...props, t: boundT })))
|
|
1318
|
+
|
|
603
1319
|
ctx.slots.inject('settings.section', () => ctx.slots.register({
|
|
604
1320
|
name: 'settings.section',
|
|
605
1321
|
id: 'collab-pair',
|