dsh-collab-pair 1.0.1 → 1.2.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # dsh-collab-pair
2
2
 
3
- > A DSH plugin that links one project-manager conversation to one or more worker conversations. Every worker result is relayed back automatically, and a task board shows all collaborations with their live working state.
3
+ > A DSH plugin for large projects: link one project-manager conversation to one or more worker conversations. Dispatch each round once from the manager instead of repeating prompts across conversations; results come back automatically, and unattended runs keep moving.
4
4
 
5
5
  ## Install
6
6
 
@@ -33,10 +33,47 @@ Manager receives a collaboration report → next round for that worker, or colla
33
33
  - Project manager: the workers it manages (state, round, current task, latest report, unlink) plus a form to link another worker.
34
34
  - Worker: its manager, current task, state, latest report, and a "Leave" action.
35
35
  - Not linked: the link form.
36
- 3. **All tasks** — a board across every collaboration. Each row shows the worker, its manager, round, **working state** (`Working` / `Waiting for report` / `Idle` / `Finished`), waiting time, current task, and latest report. Refresh re-reads it.
36
+ 3. **All tasks** — a board across every collaboration, grouped by **project**. Each row shows the worker, round, **working state** (`Working` / `Waiting for report` / `Idle` / `Finished`), waiting time, current task, and latest report. Refresh re-reads it.
37
+
38
+ The manager card also shows the **project name** and lets you rename it.
39
+
40
+ The header also has a **Message language** selector (中文 / English). It switches the generated collaboration messages; the page labels follow the app language.
37
41
 
38
42
  The page only links, unlinks, and reports status. Goals, tasks, and acceptance stay in the manager conversation.
39
43
 
44
+ ## Language
45
+
46
+ - The settings page follows the app language; English and Chinese ship in the package.
47
+ - Generated collaboration messages follow the `language` config (`zh` or `en`, default `zh`). Switch it in the page header (**Message language**) or with `/collab language en`. The command persists the config and reloads the plugin.
48
+
49
+ ## Unattended runs
50
+
51
+ Once a round is dispatched, the worker finishing wakes the manager automatically; the settings page does not need to stay open. For long projects:
52
+
53
+ - `autoNudge` (default on) wakes an idle manager when a worker makes no progress for `nudgeAfterMinutes` (default 20), up to `maxNudges` times (default 3), then leaves it to a human.
54
+ - A failed relay to the manager is retried once after a minute.
55
+ - Links survive plugin reloads and DSH restarts; a cold session is resumed when it needs the next message.
56
+
57
+ Set `autoNudge: false` to disable reminders.
58
+
59
+ ## Projects
60
+
61
+ A project is the set of workers managed by one project-manager conversation. Different managers are different projects, so nothing mixes:
62
+
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":"…"}`; every worker of that manager follows the project.
65
+ - The board groups tasks by project (project name + manager).
66
+ - A worker belongs to exactly one project at a time; unlink it before linking it to another manager.
67
+
68
+ ## Link modes
69
+
70
+ Each worker is linked in one of two modes:
71
+
72
+ - **Temporary** (default): `collab_done` unbinds the pair automatically — the link record is removed, the title prefix is cleared, and the worker can join another manager.
73
+ - **Permanent**: `collab_done` ends the current project but keeps the association — the prefix and record stay, the board shows the worker as finished, and you can dispatch again later or remove it with `collab_unlink`.
74
+
75
+ Choose the mode in the link form, or pass `mode` to `collab_link`.
76
+
40
77
  ## Title prefixes
41
78
 
42
79
  Linking adds a prefix to both conversations and removes it when the link ends (or the last worker finishes):
@@ -67,12 +104,13 @@ For an existing conversation, call `collab_sessions` to get its id, then `collab
67
104
  | Tool | Role | Purpose |
68
105
  | --- | --- | --- |
69
106
  | `collab_sessions` | anyone | List recent conversations (id / title / activity / link state) |
70
- | `collab_link` | anyone | Link a worker; `role=worker` makes the current conversation the worker; `peer="new"` creates one |
107
+ | `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 |
71
108
  | `collab_dispatch` | manager | Dispatch one round; `worker` selects the worker (optional with a single worker), `acceptance` optional |
72
109
  | `collab_report` | worker | Report `summary` / `status`(done\|partial\|blocked) / `details` / `next` |
73
110
  | `collab_status` | anyone | A manager sees every worker's progress; a worker sees its manager and pending task |
74
111
  | `collab_configure` | manager | Set a worker's agent preset or model; without arguments it lists available presets |
75
- | `collab_done` | manager | Finish one worker (or `all=true`) |
112
+ | `collab_project` | manager | Set the project name shared by this manager's workers |
113
+ | `collab_done` | manager | Finish one worker (or `all=true`); temporary links unbind automatically |
76
114
  | `collab_unlink` | both | Remove a link; a manager uses `worker` or `all`, a worker leaves its own |
77
115
 
78
116
  ## `/collab` command
@@ -81,9 +119,11 @@ The settings page uses it; it can also be typed manually:
81
119
 
82
120
  ```
83
121
  /collab tasks
122
+ /collab language en
84
123
  /collab status
85
124
  /collab link {"peer":"new"}
86
125
  /collab link {"peer":"session-…"}
126
+ /collab project {"name":"…"}
87
127
  /collab configure {"worker":"session-…","preset":"ptc"}
88
128
  /collab configure {"worker":"session-…","provider":"deepseek-account","model":"deepseek-flash"}
89
129
  /collab dispatch {"worker":"session-…","task":"…","acceptance":"…"}
@@ -108,6 +148,10 @@ The `collab-pair` row in `cordis.patch.yml`:
108
148
  maxHistory: 20 # recent rounds kept per worker
109
149
  notifyWorkerOnDone: true # tell the worker to stop when the link is finished
110
150
  autoRelay: true # false records the report without delivering it
151
+ language: zh # generated message language: zh | en
152
+ autoNudge: true # wake an idle manager when a worker stalls
153
+ nudgeAfterMinutes: 20 # minutes of no progress before a reminder
154
+ maxNudges: 3 # reminders per link before leaving it to a human
111
155
  addPrefix: true # add the title prefix to linked conversations
112
156
  prefixManager: '【项目经理】'
113
157
  prefixWorker: '【员工】'
@@ -122,7 +166,7 @@ One record per worker lives in `$DSH_HOME/storages/collab_pair.json` (storage-do
122
166
  - A worker conversation belongs to one collaboration at a time; a manager can own several workers.
123
167
  - A conversation cannot be both manager and worker.
124
168
  - Worker conversations need a configured model (new conversations inherit the deployment default).
125
- - Relayed results arrive as user messages in the manager conversation, with a report header and round marker. The generated message text is Chinese in this release; the settings UI is English.
169
+ - Relayed results arrive as user messages in the manager conversation, with a report header and round marker. The generated text follows `language`; tool descriptions and internal error messages are Chinese in this release.
126
170
  - With a PTC preset the worker calls `collab_report` inside `run_code`; the plugin still reads the structured report.
127
171
  - A new worker has no title until its first message; the prefix is applied once the title exists.
128
172
  - The board is a snapshot on Refresh (working state comes from the agent status at that moment). It does not poll, which keeps command records out of the session log.
@@ -168,6 +212,39 @@ dsh plugin add dsh-collab-pair
168
212
 
169
213
  页面只做关联/解除和查看,不代填目标、任务、验收——这些交给项目经理对话。
170
214
 
215
+ ## 中英文
216
+
217
+ - 设置页跟随应用语言,包内自带中文和英文。
218
+ - 对话里生成的消息由配置 `language` 决定(`zh` / `en`,默认 `zh`)。可在页面顶部「对话消息语言」切换,或用 `/collab language en`;命令会保存配置并重载插件。
219
+
220
+ ## 挂机运行
221
+
222
+ 派发一轮后,员工完成会自动唤醒项目经理,设置页不需要一直开着。长时间项目还有:
223
+
224
+ - `autoNudge`(默认开启):员工长时间无推进时唤醒空闲的项目经理,间隔 `nudgeAfterMinutes`(默认 20 分钟),最多 `maxNudges` 次(默认 3),之后留给人工处理。
225
+ - 回传项目经理失败会在 1 分钟后自动重试一次。
226
+ - 关联在插件重载、DSH 重启后自动恢复;需要下一条消息时会恢复冷会话。
227
+
228
+ 不需要提醒时设 `autoNudge: false`。
229
+
230
+ ## 项目
231
+
232
+ 一个项目就是「一个项目经理对话所管理的员工集合」。不同项目经理就是不同项目,互不混淆:
233
+
234
+ - 第一次关联时,项目名默认取项目经理对话的标题(去掉角色前缀)。
235
+ - 可在项目经理卡片里改名,或用 `collab_project({ name })` / `/collab project {"name":"…"}`;该经理的所有员工会一起归到新项目名。
236
+ - 看板按项目分组(项目名 + 项目经理)。
237
+ - 一个员工同一时间只属于一个项目;要换项目经理,先解除原关联。
238
+
239
+ ## 关联模式
240
+
241
+ 每个员工关联时选择一种模式:
242
+
243
+ - **临时**(默认):`collab_done` 后自动解绑——关联记录删除、标题前缀去掉,员工可以再加入其他项目经理。
244
+ - **永久**:`collab_done` 只结束当前项目,关联保留——前缀和记录都在,看板显示已结束,之后可以继续派发,直到手动 `collab_unlink`。
245
+
246
+ 在关联表单里选择,或给 `collab_link` 传 `mode`。
247
+
171
248
  ## 标题前缀
172
249
 
173
250
  关联时自动给两个对话加前缀,解除(或最后一个员工结束时)自动去掉:
@@ -194,12 +271,13 @@ dsh plugin add dsh-collab-pair
194
271
  | 工具 | 角色 | 作用 |
195
272
  | --- | --- | --- |
196
273
  | `collab_sessions` | 任何人 | 列出最近对话(id / 标题 / 活跃 / 是否已关联) |
197
- | `collab_link` | 任何人 | 关联员工;`role=worker` 表示当前对话成为对方的员工;`peer="new"` 新建员工 |
274
+ | `collab_link` | 任何人 | 关联员工;`role=worker` 表示当前对话成为对方的员工;`peer="new"` 新建;`mode` 选临时/永久;`project` 指定项目名 |
198
275
  | `collab_dispatch` | 项目经理 | 派发一轮;`worker` 指定员工(只有一个时可省略),`acceptance` 可选 |
199
276
  | `collab_report` | 员工 | 汇报 `summary` / `status`(done\|partial\|blocked) / `details` / `next` |
200
277
  | `collab_status` | 任何人 | 经理看所有员工进度;员工看自己的经理与待办 |
201
278
  | `collab_configure` | 项目经理 | 设置某个员工的 agent 预设或模型;不传参数时列出可用预设 |
202
- | `collab_done` | 项目经理 | 结束某个员工的协作;`all=true` 结束全部 |
279
+ | `collab_project` | 项目经理 | 设置该经理的员工所属的项目名 |
280
+ | `collab_done` | 项目经理 | 结束某个员工;临时关联会自动解绑;`all=true` 结束全部 |
203
281
  | `collab_unlink` | 双方 | 删除关联;经理用 `worker` 或 `all`,员工解除自己 |
204
282
 
205
283
  ## `/collab` 命令
@@ -208,9 +286,11 @@ dsh plugin add dsh-collab-pair
208
286
 
209
287
  ```
210
288
  /collab tasks
289
+ /collab language en
211
290
  /collab status
212
291
  /collab link {"peer":"new"}
213
292
  /collab link {"peer":"session-…"}
293
+ /collab project {"name":"…"}
214
294
  /collab configure {"worker":"session-…","preset":"ptc"}
215
295
  /collab configure {"worker":"session-…","provider":"deepseek-account","model":"deepseek-flash"}
216
296
  /collab dispatch {"worker":"session-…","task":"…","acceptance":"…"}
@@ -235,6 +315,10 @@ dsh plugin add dsh-collab-pair
235
315
  maxHistory: 20 # 每个员工保留的最近轮次
236
316
  notifyWorkerOnDone: true # done 时通知员工停止
237
317
  autoRelay: true # false 时只记录、不自动投递
318
+ language: zh # 生成消息的语言:zh / en
319
+ autoNudge: true # 员工停滞时唤醒空闲的项目经理
320
+ nudgeAfterMinutes: 20 # 多久无推进后提醒(分钟)
321
+ maxNudges: 3 # 每条关联最多提醒几次
238
322
  addPrefix: true # 是否给关联对话加标题前缀
239
323
  prefixManager: '【项目经理】'
240
324
  prefixWorker: '【员工】'
@@ -249,7 +333,7 @@ dsh plugin add dsh-collab-pair
249
333
  - 员工对话同时只能属于一个协作;项目经理可以关联多个员工。
250
334
  - 一个对话不能同时是项目经理和员工。
251
335
  - 员工对话需要已配置模型(新建对话继承部署默认模型)。
252
- - 回传以用户消息形式进入项目经理对话(带【协作回报】标题与轮次标记)。本版本生成的消息文本为中文,设置页支持英文。
336
+ - 回传以用户消息形式进入项目经理对话(带【协作回报】标题与轮次标记)。生成文本跟随 `language`;工具描述与内部错误信息本版本仍为中文。
253
337
  - 员工用 PTC 预设时 `collab_report` 会在 `run_code` 里调用,插件仍能读到结构化汇报。
254
338
  - 新建员工在产生第一条消息前没有标题,前缀会在它第一轮结束拿到标题后补上。
255
339
  - 看板是点「刷新」时的快照(`工作中`/`等待回报` 来自当时的 agent 状态),不做轮询,避免往会话日志里反复写命令记录。
package/client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  window.__ModuleLoader__.load({
2
- id: 'dsh-collab-pair',
2
+ id: '@local/collab-pair',
3
3
  factory(require) {
4
4
  const React = require('react')
5
5
  const h = React.createElement
@@ -9,9 +9,13 @@ window.__ModuleLoader__.load({
9
9
  zh: {
10
10
  nav: '双对话协作',
11
11
  title: '双对话协作',
12
- intro: '一个项目经理可以管理多个员工。插件只负责关联;目标、任务和验收都由项目经理在对话里掌握。',
12
+ intro: '做大项目时,不必再反复把同一套提示词分别发给多个对话:关联一次,之后每轮都由项目经理派发,员工产出自动回传;长时间挂机也能自动推进。插件只负责关联与推进,目标、任务和验收仍由项目经理掌握。',
13
13
  workSession: '工作会话',
14
14
  workSessionHint: '选择要操作的对话。建立关联时,它就是项目经理对话。',
15
+ messageLanguage: '对话消息语言',
16
+ langZh: '中文',
17
+ langEn: 'English',
18
+ languageChanged: '消息语言已切换,正在重新加载…',
15
19
  noSessions: '还没有可用的对话,请先在左侧新建一个对话。',
16
20
  loading: '读取中…',
17
21
  refresh: '刷新',
@@ -24,6 +28,15 @@ window.__ModuleLoader__.load({
24
28
  peer: '员工对话',
25
29
  peerNew: '新建一个员工对话',
26
30
  link: '关联',
31
+ linkMode: '关联模式',
32
+ modeTemporary: '临时关联(完成即解绑)',
33
+ modePermanent: '永久关联(直到手动解除)',
34
+ modeTempShort: '临时',
35
+ modePermShort: '永久',
36
+ projectLabel: '项目',
37
+ projectUnnamed: '未命名项目',
38
+ projectSave: '保存项目名',
39
+ projectSaved: '项目名已更新',
27
40
  linkDone: '已关联员工。接下来在项目经理对话里派发任务。',
28
41
  workerPrefixHint: '关联后两个对话的标题会自动加上【项目经理】/【员工】前缀,解除时自动去掉。',
29
42
  managerTitle: '项目经理',
@@ -42,6 +55,7 @@ window.__ModuleLoader__.load({
42
55
  finished: '已结束',
43
56
  noWorkers: '还没有关联员工。',
44
57
  lastReport: '最近回报',
58
+ reminder: '已提醒 {count}/{max}',
45
59
  unlink: '解除',
46
60
  confirmUnlink: '解除与该员工的协作关联?',
47
61
  removeDone: '已解除关联。',
@@ -57,9 +71,13 @@ window.__ModuleLoader__.load({
57
71
  en: {
58
72
  nav: 'Collaboration pair',
59
73
  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.',
74
+ intro: 'On large projects you no longer repeat the same prompts across conversations: link once, then the manager dispatches every round and worker results come back automatically, with unattended runs kept moving. The plugin only links and drives; the goal, tasks, and acceptance stay with the manager.',
61
75
  workSession: 'Working conversation',
62
76
  workSessionHint: 'The conversation to act on. When you create a link, it becomes the project manager.',
77
+ messageLanguage: 'Message language',
78
+ langZh: '中文',
79
+ langEn: 'English',
80
+ languageChanged: 'Message language changed; reloading…',
63
81
  noSessions: 'No conversation is available yet. Create one in the sidebar first.',
64
82
  loading: 'Loading…',
65
83
  refresh: 'Refresh',
@@ -72,6 +90,15 @@ window.__ModuleLoader__.load({
72
90
  peer: 'Worker conversation',
73
91
  peerNew: 'Create a new worker conversation',
74
92
  link: 'Link',
93
+ linkMode: 'Link mode',
94
+ modeTemporary: 'Temporary (unbind when done)',
95
+ modePermanent: 'Permanent (until unlinked)',
96
+ modeTempShort: 'Temporary',
97
+ modePermShort: 'Permanent',
98
+ projectLabel: 'Project',
99
+ projectUnnamed: 'Unnamed project',
100
+ projectSave: 'Save project name',
101
+ projectSaved: 'Project name updated',
75
102
  linkDone: 'Worker linked. Dispatch tasks from the manager conversation.',
76
103
  workerPrefixHint: 'Linking adds a 【项目经理】/【员工】 prefix to both titles; unlinking removes it.',
77
104
  managerTitle: 'Project manager',
@@ -90,6 +117,7 @@ window.__ModuleLoader__.load({
90
117
  finished: 'Finished',
91
118
  noWorkers: 'No worker linked yet.',
92
119
  lastReport: 'Latest report',
120
+ reminder: 'reminder {count}/{max}',
93
121
  unlink: 'Unlink',
94
122
  confirmUnlink: 'Remove the link to this worker?',
95
123
  removeDone: 'Link removed.',
@@ -188,6 +216,8 @@ window.__ModuleLoader__.load({
188
216
  const [notice, setNotice] = React.useState(null)
189
217
  const [busy, setBusy] = React.useState(false)
190
218
  const [peer, setPeer] = React.useState('new')
219
+ const [mode, setMode] = React.useState('temporary')
220
+ const [projectDraft, setProjectDraft] = React.useState('')
191
221
  const commandsRef = React.useRef(commands)
192
222
  commandsRef.current = commands
193
223
 
@@ -257,8 +287,31 @@ window.__ModuleLoader__.load({
257
287
  }
258
288
  }
259
289
 
290
+ const changeLanguage = async (code) => {
291
+ if (workId === undefined) return
292
+ setBusy(true)
293
+ setError(null)
294
+ setNotice(t('languageChanged'))
295
+ try {
296
+ await runCommand(commandsRef.current, workId, `/collab language ${JSON.stringify({ language: code })}`)
297
+ } catch {
298
+ // A config write restarts the Host plugin; the pending call may reject.
299
+ }
300
+ await new Promise((resolve) => setTimeout(resolve, 1200))
301
+ try {
302
+ const next = await loadBoard(workId)
303
+ if (next === null || next === undefined || next.language !== code) {
304
+ setError('语言未保存:请手动修改 cordis.patch.yml 里的 language。')
305
+ }
306
+ } catch (cause) {
307
+ setError(cause instanceof Error ? cause.message : String(cause))
308
+ } finally {
309
+ setBusy(false)
310
+ }
311
+ }
312
+
260
313
  const linkWorker = () => {
261
- void act(`/collab link ${JSON.stringify({ peer })}`, t('linkDone'))
314
+ void act(`/collab link ${JSON.stringify({ peer, mode })}`, t('linkDone'))
262
315
  }
263
316
 
264
317
  const removeWorker = (worker) => {
@@ -271,11 +324,20 @@ window.__ModuleLoader__.load({
271
324
  void act(`/collab unlink ${JSON.stringify({})}`, t('removeDone'))
272
325
  }
273
326
 
327
+ const saveProject = () => {
328
+ const name = projectDraft.trim()
329
+ if (name === '') return
330
+ void act(`/collab project ${JSON.stringify({ name })}`, t('projectSaved')).then(() => setProjectDraft(''))
331
+ }
332
+
274
333
  const links = board !== null && Array.isArray(board.links) ? board.links : []
334
+ const messageLang = board !== null && board.language === 'en' ? 'en' : 'zh'
335
+ const associated = links.filter((link) => link.status === 'active' || link.mode === 'permanent')
275
336
  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)
337
+ const managed = workId === undefined ? [] : associated.filter((link) => link.manager === workId)
338
+ const mine = workId === undefined ? undefined : associated.find((link) => link.worker === workId)
278
339
  const role = managed.length > 0 ? 'manager' : mine === undefined ? null : 'worker'
340
+ const managerProject = managed.find((link) => typeof link.project === 'string' && link.project !== '')?.project ?? ''
279
341
  const peerChoices = sessions.filter((row) => row.id !== workId)
280
342
 
281
343
  const statusText = (value) => {
@@ -320,6 +382,16 @@ window.__ModuleLoader__.load({
320
382
  ),
321
383
  h('div', { style: S.hint }, t('workSessionHint')),
322
384
  h('div', { style: S.mono }, workId ?? ''),
385
+ h('label', { style: S.label }, t('messageLanguage'),
386
+ h('select', {
387
+ style: S.input,
388
+ value: board !== null && board.language === 'en' ? 'en' : 'zh',
389
+ disabled: busy || workId === undefined,
390
+ onChange: (event) => void changeLanguage(event.target.value),
391
+ },
392
+ h('option', { value: 'zh' }, t('langZh')),
393
+ h('option', { value: 'en' }, t('langEn'))),
394
+ ),
323
395
  h('div', { style: S.row },
324
396
  h('button', { type: 'button', style: S.secondary, disabled: busy || workId === undefined, onClick: () => void refresh() }, t('refresh')),
325
397
  busy ? h('span', { style: S.muted }, t('busy')) : null,
@@ -336,6 +408,11 @@ window.__ModuleLoader__.load({
336
408
 
337
409
  const stateBadge = (state) => h('span', { style: { ...S.badge, color: state.color } }, state.label)
338
410
 
411
+ const reminderText = (link) => (link.nudges > 0
412
+ ? ` · ${t('reminder', { count: link.nudges, max: board !== null && typeof board.maxNudges === 'number' ? board.maxNudges : 3 })}`
413
+ : '')
414
+ const modeText = (link) => (link.mode === 'permanent' ? t('modePermShort') : t('modeTempShort'))
415
+
339
416
  const taskRow = (link) => {
340
417
  const state = stateOf(link)
341
418
  return h('div', { key: link.linkId, style: S.taskRow },
@@ -343,7 +420,7 @@ window.__ModuleLoader__.load({
343
420
  h('div', { style: S.taskTitle }, link.workerTitle || link.worker),
344
421
  h('div', { style: S.mono }, link.worker),
345
422
  h('div', { style: S.muted },
346
- `${link.managerTitle || link.manager} · ${roundText(link)}`,
423
+ `${link.managerTitle || link.manager} · ${roundText(link)}${reminderText(link)} · ${modeText(link)}`,
347
424
  ),
348
425
  link.pending === null || link.pending === undefined
349
426
  ? null
@@ -356,6 +433,19 @@ window.__ModuleLoader__.load({
356
433
  )
357
434
  }
358
435
 
436
+ const groups = []
437
+ const groupMap = new Map()
438
+ for (const link of links) {
439
+ const key = `${link.manager}\u0000${link.project || ''}`
440
+ let group = groupMap.get(key)
441
+ if (group === undefined) {
442
+ group = { key, manager: link.manager, managerTitle: link.managerTitle || link.manager, project: link.project || '', links: [] }
443
+ groupMap.set(key, group)
444
+ groups.push(group)
445
+ }
446
+ group.links.push(link)
447
+ }
448
+
359
449
  const boardCard = h('div', { style: S.card },
360
450
  h('div', { style: S.cardHead },
361
451
  h('h3', { style: S.cardTitle }, t('boardTitle')),
@@ -368,7 +458,13 @@ window.__ModuleLoader__.load({
368
458
  ? h('p', { style: S.intro }, busy ? t('loading') : t('noTasks'))
369
459
  : links.length === 0
370
460
  ? h('p', { style: S.intro }, t('noTasks'))
371
- : links.map(taskRow),
461
+ : groups.map((group) => h('div', { key: group.key, style: { display: 'flex', flexDirection: 'column', gap: 8 } },
462
+ h('div', { style: { display: 'flex', gap: 8, alignItems: 'baseline', flexWrap: 'wrap' } },
463
+ h('span', { style: { fontSize: 13, fontWeight: 600 } }, group.project || t('projectUnnamed')),
464
+ h('span', { style: S.muted }, `${t('managerTitle')}:${group.managerTitle}`),
465
+ ),
466
+ group.links.map(taskRow),
467
+ )),
372
468
  )
373
469
 
374
470
  const workerRow = (link) => {
@@ -377,7 +473,7 @@ window.__ModuleLoader__.load({
377
473
  h('div', { style: S.workerMain },
378
474
  h('div', { style: S.workerName }, link.workerTitle || link.worker),
379
475
  h('div', { style: S.mono }, link.worker),
380
- h('div', { style: S.muted }, roundText(link)),
476
+ h('div', { style: S.muted }, `${roundText(link)}${reminderText(link)} · ${modeText(link)}`),
381
477
  link.pending === null || link.pending === undefined
382
478
  ? null
383
479
  : h('p', { style: S.taskText }, link.pending.task),
@@ -404,6 +500,16 @@ window.__ModuleLoader__.load({
404
500
  h('option', { value: 'new' }, t('peerNew')),
405
501
  peerChoices.map((row) => h('option', { key: row.id, value: row.id }, row.title))),
406
502
  ),
503
+ h('label', { style: S.label }, t('linkMode'),
504
+ h('select', {
505
+ style: S.input,
506
+ value: mode,
507
+ disabled: busy,
508
+ onChange: (event) => setMode(event.target.value),
509
+ },
510
+ h('option', { value: 'temporary' }, t('modeTemporary')),
511
+ h('option', { value: 'permanent' }, t('modePermanent'))),
512
+ ),
407
513
  h('div', { style: S.row },
408
514
  h('button', { type: 'button', style: S.primary, disabled: busy, onClick: linkWorker }, t('link')),
409
515
  ),
@@ -420,6 +526,19 @@ window.__ModuleLoader__.load({
420
526
  h('span', { style: S.badge }, t('managerTitle')),
421
527
  h('span', { style: S.muted }, `${t('managing')} ${managed.length} ${t('workerCount')}`),
422
528
  ),
529
+ h('div', { style: S.row },
530
+ h('span', { style: S.muted }, `${t('projectLabel')}:${managerProject || t('projectUnnamed')}`),
531
+ ),
532
+ h('div', { style: S.row },
533
+ h('input', {
534
+ style: { ...S.input, flex: 1 },
535
+ value: projectDraft,
536
+ placeholder: managerProject || t('projectUnnamed'),
537
+ disabled: busy,
538
+ onChange: (event) => setProjectDraft(event.target.value),
539
+ }),
540
+ h('button', { type: 'button', style: S.secondary, disabled: busy || projectDraft.trim() === '', onClick: saveProject }, t('projectSave')),
541
+ ),
423
542
  managed.length === 0 ? h('p', { style: S.intro }, t('noWorkers')) : managed.map(workerRow),
424
543
  ),
425
544
  linkForm,
package/cordis.patch.yml CHANGED
@@ -9,3 +9,7 @@
9
9
  addPrefix: true
10
10
  prefixManager: '【项目经理】'
11
11
  prefixWorker: '【员工】'
12
+ language: zh
13
+ autoNudge: true
14
+ nudgeAfterMinutes: 20
15
+ maxNudges: 3