@suifei/dsh-ai-team 0.3.54 → 0.3.60
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/CHANGELOG.md +85 -0
- package/client.js +910 -384
- package/index.js +360 -45
- package/lib/diaglog.js +105 -0
- package/lib/domain/member-profile.js +4 -11
- package/lib/domain/policy.js +31 -0
- package/lib/host/member-tools.js +1 -1
- package/lib/host/people-view.js +104 -0
- package/lib/host/project-registry.js +6 -1
- package/lib/host/project-runtime.js +31 -3
- package/lib/host/risk-view.js +94 -0
- package/lib/host/service.js +195 -108
- package/lib/host/views.js +6 -16
- package/lib/host/waker.js +11 -1
- package/lib/host/weekly-view.js +83 -0
- package/lib/ledger/fold.js +36 -8
- package/lib/ledger/tools.js +118 -0
- package/lib/ledger/writer.js +115 -9
- package/lib/runtime/failure-policy.js +22 -8
- package/lib/runtime/member-runtime.js +6 -1
- package/lib/runtime/skill-provider.js +96 -33
- package/lib/vendor/skillopt/src/index.js +63 -3
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +6 -1
package/client.js
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
* right = Task Thread panel (discussion, acceptance, done receipt)
|
|
8
8
|
*
|
|
9
9
|
* UI references: docs/04 §4–§7/§10, docs/appendix/D §2–§3, docs/07 §4–§6.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* (`sidebar.panellist` id `ai-team`, `main` key
|
|
10
|
+
* The client reads `/ai-team/api/bootstrap` and the SSE change stream; every
|
|
11
|
+
* write goes through `POST /ai-team/api/projects/:id/commands`. Without the
|
|
12
|
+
* endpoint it shows an honest error state with retry — no embedded demo data.
|
|
13
|
+
* The registration contract (`sidebar.panellist` id `ai-team`, `main` key
|
|
14
|
+
* `ai-team`) is unchanged.
|
|
14
15
|
*
|
|
15
16
|
* Colors come from `--dsw-alias-*` only; radii/font steps from host tokens.
|
|
16
17
|
*/
|
|
@@ -28,7 +29,6 @@ window.__ModuleLoader__.load({
|
|
|
28
29
|
inbox: '收件箱',
|
|
29
30
|
board: '任务看板',
|
|
30
31
|
projects: '项目',
|
|
31
|
-
agents: 'Agents',
|
|
32
32
|
main: '主对话',
|
|
33
33
|
boardTab: '看板',
|
|
34
34
|
tabSituation: '态势',
|
|
@@ -55,6 +55,7 @@ window.__ModuleLoader__.load({
|
|
|
55
55
|
follow: '关注',
|
|
56
56
|
unfollow: '取消关注',
|
|
57
57
|
convert: '转为 Task',
|
|
58
|
+
you: '你',
|
|
58
59
|
reply: '回复此 Thread…',
|
|
59
60
|
replyHint: '将基于 #{seq} 发送',
|
|
60
61
|
replyHintNew: '将新建此 Task 的 Thread',
|
|
@@ -83,8 +84,8 @@ window.__ModuleLoader__.load({
|
|
|
83
84
|
groupLess: '收起其余 {n} 项',
|
|
84
85
|
fromDiscussion: '由讨论升格',
|
|
85
86
|
loading: '加载中…',
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
loadFailedTitle: '工作台不可达',
|
|
88
|
+
loadFailedBody: 'bootstrap 接口(/ai-team)无法访问;请确认插件已启用后重试。',
|
|
88
89
|
spike: 'AI Team',
|
|
89
90
|
spikeTitle: '文渊阁 AI Team 工作台:修书、校勘、纂辑;方向、验收与账本。',
|
|
90
91
|
navAria: '页面导航',
|
|
@@ -93,8 +94,7 @@ window.__ModuleLoader__.load({
|
|
|
93
94
|
projectsAria: '项目',
|
|
94
95
|
agentsAria: '成员',
|
|
95
96
|
streamAria: '主对话',
|
|
96
|
-
|
|
97
|
-
situationAria: '项目态势',
|
|
97
|
+
situationAria: '项目态势',
|
|
98
98
|
threadAria: '任务讨论',
|
|
99
99
|
composerAria: '写一条消息',
|
|
100
100
|
modeAria: '发送模式',
|
|
@@ -127,10 +127,8 @@ window.__ModuleLoader__.load({
|
|
|
127
127
|
decisionReopened: '已重开一份可编辑的决策项。',
|
|
128
128
|
decisionSubmit: '提交决策',
|
|
129
129
|
decisionSubmitted: '决策已提交给团队。',
|
|
130
|
-
inboxEmptyAction: '看任务看板',
|
|
131
|
-
|
|
132
|
-
projectEmptyBody: '创建项目属于 S-01;M1 之后接入。',
|
|
133
|
-
emptyColumn: '暂无',
|
|
130
|
+
inboxEmptyAction: '看任务看板', projectEmptyTitle: '还没有项目',
|
|
131
|
+
emptyColumn: '暂无',
|
|
134
132
|
expandDone: '展开全部',
|
|
135
133
|
collapseDone: '收起',
|
|
136
134
|
threadEmptyTitle: '还没有消息',
|
|
@@ -151,7 +149,6 @@ window.__ModuleLoader__.load({
|
|
|
151
149
|
diff: '差异',
|
|
152
150
|
noDiff: '未提供差异',
|
|
153
151
|
taskActions: '任务动作',
|
|
154
|
-
mockOnly: '仅演示,不写账本',
|
|
155
152
|
actCancel: '取消任务',
|
|
156
153
|
actReopen: '重开',
|
|
157
154
|
actReassign: '改派…',
|
|
@@ -164,9 +161,7 @@ window.__ModuleLoader__.load({
|
|
|
164
161
|
reassignPrompt: '把 accountable owner 改派给(输入名字):',
|
|
165
162
|
reassignDone: '已把 #{n} 改派给 {name}。',
|
|
166
163
|
reassignNoTarget: '没有可改派的活跃成员。',
|
|
167
|
-
|
|
168
|
-
actDelete: '删除',
|
|
169
|
-
actionMock: 'spike:{action} 需要二次确认并写账本,命令接入后启用。',
|
|
164
|
+
actDelete: '删除',
|
|
170
165
|
convertTitle: '转为 Task',
|
|
171
166
|
titleLabel: '标题',
|
|
172
167
|
convertNamePlaceholder: '一句话说清要做什么',
|
|
@@ -175,15 +170,12 @@ window.__ModuleLoader__.load({
|
|
|
175
170
|
convertContext: '上下文:引用 #{n} 的 {m} 条消息',
|
|
176
171
|
convertCancel: '取消',
|
|
177
172
|
convertSubmit: '创建 Task',
|
|
178
|
-
|
|
173
|
+
convertDone: '已创建 #{n},来自本 Thread。',
|
|
174
|
+
convertNoSource: '本 Thread 没有可锚定的账本消息,无法转为 Task。',
|
|
179
175
|
conflictTitle: '你的回复基于较早的 Thread,已退回',
|
|
180
176
|
conflictNew: 'Thread 已到 #{head}(新增 {n} 条)',
|
|
181
177
|
conflictContinue: '基于最新继续写',
|
|
182
|
-
|
|
183
|
-
conflictContinueMock: 'spike:已把发送基线更新到 #{head}(不写账本)。',
|
|
184
|
-
conflictContextMock: 'spike:将展示你在 #{base} 时的上下文(命令未接入)。',
|
|
185
|
-
replyMock: 'spike:回复将基于 #{seq} 发送并写入账本(命令未接入)。',
|
|
186
|
-
replyMockNew: 'spike:将新建 Thread 并写入回复(命令未接入)。',
|
|
178
|
+
conflictContinued: '已把发送基线更新到 #{head}。',
|
|
187
179
|
replySent: '已写入 Thread #{seq}。',
|
|
188
180
|
replyFailed: '回复失败:{message}',
|
|
189
181
|
acceptNote: '工作台验收:已核对 Thread 与证据。',
|
|
@@ -192,13 +184,9 @@ window.__ModuleLoader__.load({
|
|
|
192
184
|
changesNeedNote: '先把返工理由写在回复框,再点退回。',
|
|
193
185
|
changesDone: '已退回 #{n},要求返工。',
|
|
194
186
|
changesFailed: '退回失败:{message}',
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
changesMock: 'spike:退回需要至少 10 字原因并写账本(命令未接入)。',
|
|
199
|
-
projectSwitchMock: 'spike:项目切换只更新视图标题;按项目读取账本在 M1 接入。',
|
|
200
|
-
archivedMock: 'spike:归档项目只读;取消归档在 M3 接入。',
|
|
201
|
-
agentMock: 'spike:成员详情(打开会话 / 发消息 / 记忆与技能)在 M3 接入。',
|
|
187
|
+
followedTask: '已关注 #{n},写入账本。',
|
|
188
|
+
unfollowedTask: '已取消关注 #{n};完成、受阻或需要你决定时仍会出现在看板。',
|
|
189
|
+
archivedNote: '归档项目只读;取消归档暂未开放。',
|
|
202
190
|
agentOpen: '与 {name} 对话',
|
|
203
191
|
moreActions: '更多操作',
|
|
204
192
|
agentChat: '直接对话',
|
|
@@ -210,13 +198,11 @@ window.__ModuleLoader__.load({
|
|
|
210
198
|
taskOwner: '负责人',
|
|
211
199
|
taskAssignee: '执行',
|
|
212
200
|
teamPulseTitle: '团队动态',
|
|
213
|
-
|
|
214
|
-
teamPulseWorking: '成员已接单',
|
|
201
|
+
teamPulseWorking: '成员已接单',
|
|
215
202
|
teamPulseStarting: '成员已唤醒,正在拆解任务…',
|
|
216
203
|
teamPulseAgents: '运行中:{names}',
|
|
217
204
|
newProject: '新建项目',
|
|
218
205
|
addAgent: '添加成员',
|
|
219
|
-
newProjectMock: 'spike:新建项目属于 S-01 流程,M1 之后接入。',
|
|
220
206
|
newProjectTitle: '新建项目',
|
|
221
207
|
projectName: '项目名',
|
|
222
208
|
projectGoal: '目标',
|
|
@@ -251,7 +237,6 @@ window.__ModuleLoader__.load({
|
|
|
251
237
|
projectCreate: '创建项目',
|
|
252
238
|
projectCreated: '已创建项目 {name}。',
|
|
253
239
|
projectSwitched: '已切换项目。',
|
|
254
|
-
addAgentMock: 'spike:添加成员在 M1 之后接入。',
|
|
255
240
|
addAgentTitle: '添加成员',
|
|
256
241
|
memberName: '名字',
|
|
257
242
|
memberRole: '职责',
|
|
@@ -275,6 +260,47 @@ window.__ModuleLoader__.load({
|
|
|
275
260
|
memberAdding: '正在创建…',
|
|
276
261
|
memberAdded: '成员已创建并激活。',
|
|
277
262
|
cancel: '取消',
|
|
263
|
+
dialogConfirm: '确定',
|
|
264
|
+
reseatSession: '重置会话',
|
|
265
|
+
reseatConfirm: '将关闭该成员的旧会话,并在当前项目工作目录里重建一个新会话(旧会话的 cwd 是创建时钉死的,无法原地修改)。确定?',
|
|
266
|
+
reseatDone: '会话已在当前项目工作目录重建。',
|
|
267
|
+
decisionNotePlaceholder: '补充说明(可选,随决策写入 Thread)',
|
|
268
|
+
decisionFollowUp: '看项目进展',
|
|
269
|
+
followUpMissing: '主对话里还没有决策之后的新消息。',
|
|
270
|
+
riskTitle: '风险清单',
|
|
271
|
+
riskBlocked: '受阻',
|
|
272
|
+
riskStaleHours: '待决 {n} 小时',
|
|
273
|
+
riskCounts: '受阻 {blocked} · 失败 {failures} · 待决超时 {stale}',
|
|
274
|
+
followUpMissing: '主对话里还没有决策之后的新消息。',
|
|
275
|
+
permissionBadge: '完全权限',
|
|
276
|
+
permissionNote: '该成员以完全权限、只在本项目的工作目录里运行。请只在可信目录创建项目。',
|
|
277
|
+
obTitle: '开工三步',
|
|
278
|
+
obStep1: '① 给项目一个工作目录',
|
|
279
|
+
obStep1Done: '① 工作目录已就绪',
|
|
280
|
+
obStep2: '② 认识你的成员(右侧 AGENTS 列表,可改名可增减)',
|
|
281
|
+
obStep3: '③ 说出第一句话',
|
|
282
|
+
obExample: '把这次回归里失败的三条都修了',
|
|
283
|
+
obFill: '填入示例',
|
|
284
|
+
teamQuiet: '团队安静:没有需要处理的事,健康。',
|
|
285
|
+
teamBusy: '团队推进中:{n} 个任务在做。',
|
|
286
|
+
teamNeedsYou: '有 {n} 件事等你处理或放行。',
|
|
287
|
+
failureAuth: 'API key 无效或没有权限',
|
|
288
|
+
failureBilling: '账户余额或配额不足',
|
|
289
|
+
failureRateLimit: '请求太频繁,被限流',
|
|
290
|
+
failureNetwork: '网络连接失败',
|
|
291
|
+
failureServer: '模型服务端出错',
|
|
292
|
+
failureModelUnavailable: '指定模型不存在或不可用',
|
|
293
|
+
failureContextOverflow: '上下文超出模型窗口',
|
|
294
|
+
failurePolicy: '内容被安全策略拒绝',
|
|
295
|
+
failureUnknown: '未知失败',
|
|
296
|
+
shortcutTitle: '键盘快捷键',
|
|
297
|
+
shortcutInbox: '收件箱',
|
|
298
|
+
shortcutBoard: '任务看板',
|
|
299
|
+
shortcutPeople: '人员池',
|
|
300
|
+
shortcutHome: '对话',
|
|
301
|
+
shortcutComposer: '聚焦输入框',
|
|
302
|
+
shortcutClose: '关闭线程 / 浮层',
|
|
303
|
+
close: '关闭',
|
|
278
304
|
memberProfileTitle: '成员资料',
|
|
279
305
|
memberProfileTitleName: '成员资料 · {name}',
|
|
280
306
|
memberProfileMeta: '{status} · 资料 v{version} · 蒸馏 v{distill}',
|
|
@@ -308,16 +334,40 @@ window.__ModuleLoader__.load({
|
|
|
308
334
|
recruit: '重新招募',
|
|
309
335
|
profileSaved: '成员资料已保存,下一次唤醒生效。',
|
|
310
336
|
profileDistilled: '已重新蒸馏并记录新版本。',
|
|
311
|
-
conversationMock: 'spike:宿主没有可用的 layout.selectPanel(conversation)。',
|
|
312
337
|
discussSent: '已发送给 Project owner。',
|
|
313
338
|
taskSent: '已创建 Task。',
|
|
314
339
|
sendFailed: '发送失败:{message}',
|
|
340
|
+
duplicateTask: '相同 Task 已存在(#{number}),已为你打开它。',
|
|
341
|
+
qaNeedsChecklist: 'QA Task 至少需要一条验收清单。',
|
|
315
342
|
pendingHuman: '待你处理',
|
|
316
343
|
inboxUnread: '收件箱,{n} 条未读',
|
|
317
344
|
dismiss: '关闭提示',
|
|
318
|
-
retry: '重试',
|
|
319
345
|
crashTitle: '工作台渲染失败',
|
|
320
346
|
noProject: '未选择项目',
|
|
347
|
+
navHome: '对话',
|
|
348
|
+
agentsScope: '本项目成员',
|
|
349
|
+
people: '人员',
|
|
350
|
+
peopleTitle: '人员池',
|
|
351
|
+
peopleEmpty: '还没有成员;先在项目里添加。',
|
|
352
|
+
peopleProjects: '{n} 个项目',
|
|
353
|
+
refresh: '刷新',
|
|
354
|
+
peopleActiveTasks: '{n} 个活跃任务',
|
|
355
|
+
peopleFailure: '最近失败 ×{n}',
|
|
356
|
+
peopleOpenProject: '打开项目',
|
|
357
|
+
peopleLoadFailed: '人员池加载失败:{message}',
|
|
358
|
+
irreversibleBadge: '不可撤回',
|
|
359
|
+
pendingTitle: '等你验收(跨项目)',
|
|
360
|
+
eventHistoryTitle: '任务事件历史',
|
|
361
|
+
eventHistoryEmpty: '该任务暂无关联事件。',
|
|
362
|
+
aliasTitle: '同人绑定',
|
|
363
|
+
aliasSourcePlaceholder: '另一个名字',
|
|
364
|
+
aliasTargetPlaceholder: '并到这个人',
|
|
365
|
+
aliasBind: '绑定',
|
|
366
|
+
aliasHint: '绑定后两个名字在人员池合并为同一行。',
|
|
367
|
+
aliasRequired: '请先填写要合并的名字。',
|
|
368
|
+
aliasSaved: '已把「{name}」并到「{person}」。',
|
|
369
|
+
teamBusyN: '在做 ×{n}',
|
|
370
|
+
pendingAcceptanceN: '待验收 ×{n}',
|
|
321
371
|
archivedCount: '已归档 {n}',
|
|
322
372
|
q1Title: '需要你',
|
|
323
373
|
q2Title: '团队在做',
|
|
@@ -345,8 +395,7 @@ window.__ModuleLoader__.load({
|
|
|
345
395
|
catDone: '已完成',
|
|
346
396
|
waitOn: '等 {ref}',
|
|
347
397
|
waitDependency: '依赖未完成',
|
|
348
|
-
|
|
349
|
-
quadrantMissing: 'spike:该条目对应的 Task 不在当前 bootstrap 数据里。',
|
|
398
|
+
quadrantMissing: '该条目对应的 Task 不在当前数据里。',
|
|
350
399
|
filterLabel: '筛选:{name}',
|
|
351
400
|
filterClear: '清除筛选',
|
|
352
401
|
filterInboxExtra: '另有 {n} 条收件箱决策项',
|
|
@@ -368,8 +417,7 @@ window.__ModuleLoader__.load({
|
|
|
368
417
|
inbox: 'Inbox',
|
|
369
418
|
board: 'All tasks',
|
|
370
419
|
projects: 'Projects',
|
|
371
|
-
|
|
372
|
-
main: 'Main',
|
|
420
|
+
main: 'Main',
|
|
373
421
|
boardTab: 'Board',
|
|
374
422
|
tabSituation: 'Situation',
|
|
375
423
|
tabsAria: 'Project views',
|
|
@@ -395,6 +443,7 @@ window.__ModuleLoader__.load({
|
|
|
395
443
|
follow: 'Follow',
|
|
396
444
|
unfollow: 'Unfollow',
|
|
397
445
|
convert: 'Turn into task',
|
|
446
|
+
you: 'You',
|
|
398
447
|
reply: 'Reply to this thread…',
|
|
399
448
|
replyHint: 'Will send on #{seq}',
|
|
400
449
|
replyHintNew: 'Will start a new thread',
|
|
@@ -423,8 +472,8 @@ window.__ModuleLoader__.load({
|
|
|
423
472
|
groupLess: 'Collapse {n}',
|
|
424
473
|
fromDiscussion: 'Promoted from discussion',
|
|
425
474
|
loading: 'Loading…',
|
|
426
|
-
|
|
427
|
-
|
|
475
|
+
loadFailedTitle: 'Workbench unreachable',
|
|
476
|
+
loadFailedBody: 'The bootstrap endpoint (/ai-team) cannot be reached; confirm the plugin is enabled and retry.',
|
|
428
477
|
spike: 'AI Team',
|
|
429
478
|
spikeTitle: 'Wenyuan Pavilion AI Team workbench: compile, collate, edit; direction, acceptance and ledger.',
|
|
430
479
|
navAria: 'Page navigation',
|
|
@@ -433,8 +482,7 @@ window.__ModuleLoader__.load({
|
|
|
433
482
|
projectsAria: 'Projects',
|
|
434
483
|
agentsAria: 'Agents',
|
|
435
484
|
streamAria: 'Main stream',
|
|
436
|
-
|
|
437
|
-
situationAria: 'Project situation',
|
|
485
|
+
situationAria: 'Project situation',
|
|
438
486
|
threadAria: 'Task discussion',
|
|
439
487
|
composerAria: 'Write a message',
|
|
440
488
|
modeAria: 'Send mode',
|
|
@@ -469,8 +517,7 @@ window.__ModuleLoader__.load({
|
|
|
469
517
|
decisionSubmitted: 'Decision sent to the team.',
|
|
470
518
|
inboxEmptyAction: 'Open the board',
|
|
471
519
|
projectEmptyTitle: 'No projects yet',
|
|
472
|
-
|
|
473
|
-
emptyColumn: 'None',
|
|
520
|
+
emptyColumn: 'None',
|
|
474
521
|
expandDone: 'Show all',
|
|
475
522
|
collapseDone: 'Collapse',
|
|
476
523
|
threadEmptyTitle: 'No messages yet',
|
|
@@ -491,7 +538,6 @@ window.__ModuleLoader__.load({
|
|
|
491
538
|
diff: 'Diff',
|
|
492
539
|
noDiff: 'No diff provided',
|
|
493
540
|
taskActions: 'Task actions',
|
|
494
|
-
mockOnly: 'Demo only; nothing is written',
|
|
495
541
|
actCancel: 'Cancel task',
|
|
496
542
|
actReopen: 'Reopen',
|
|
497
543
|
actReassign: 'Reassign…',
|
|
@@ -504,9 +550,7 @@ window.__ModuleLoader__.load({
|
|
|
504
550
|
reassignPrompt: 'Reassign the accountable owner to (name):',
|
|
505
551
|
reassignDone: 'Reassigned #{n} to {name}.',
|
|
506
552
|
reassignNoTarget: 'No active member is available for reassignment.',
|
|
507
|
-
|
|
508
|
-
actDelete: 'Delete',
|
|
509
|
-
actionMock: 'spike: {action} needs confirmation and a ledger write; enabled when commands land.',
|
|
553
|
+
actDelete: 'Delete',
|
|
510
554
|
convertTitle: 'Turn into task',
|
|
511
555
|
titleLabel: 'Title',
|
|
512
556
|
convertNamePlaceholder: 'One line about what needs doing',
|
|
@@ -515,15 +559,12 @@ window.__ModuleLoader__.load({
|
|
|
515
559
|
convertContext: 'Context: {m} messages from #{n}',
|
|
516
560
|
convertCancel: 'Cancel',
|
|
517
561
|
convertSubmit: 'Create task',
|
|
518
|
-
|
|
562
|
+
convertDone: 'Created #{n} from this thread.',
|
|
563
|
+
convertNoSource: 'This thread has no ledger messages to anchor; cannot convert.',
|
|
519
564
|
conflictTitle: 'Your reply was based on an older thread and was returned',
|
|
520
565
|
conflictNew: 'Thread is at #{head} ({n} new)',
|
|
521
566
|
conflictContinue: 'Continue from latest',
|
|
522
|
-
|
|
523
|
-
conflictContinueMock: 'spike: send base moved to #{head} (nothing written).',
|
|
524
|
-
conflictContextMock: 'spike: will show your context at #{base} (commands not wired).',
|
|
525
|
-
replyMock: 'spike: reply will be sent on #{seq} and written to the ledger (commands not wired).',
|
|
526
|
-
replyMockNew: 'spike: will start a thread and write the reply (commands not wired).',
|
|
567
|
+
conflictContinued: 'Send baseline moved to #{head}.',
|
|
527
568
|
replySent: 'Written to Thread #{seq}.',
|
|
528
569
|
replyFailed: 'Reply failed: {message}',
|
|
529
570
|
acceptNote: 'Workbench acceptance: Thread and evidence reviewed.',
|
|
@@ -532,13 +573,9 @@ window.__ModuleLoader__.load({
|
|
|
532
573
|
changesNeedNote: 'Write the change request in the reply box first.',
|
|
533
574
|
changesDone: 'Changes requested on #{n}.',
|
|
534
575
|
changesFailed: 'Change request failed: {message}',
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
changesMock: 'spike: requesting changes needs at least 10 characters and a ledger write (commands not wired).',
|
|
539
|
-
projectSwitchMock: 'spike: switching projects only updates the header; per-project ledger reads land with M1.',
|
|
540
|
-
archivedMock: 'spike: archived projects are read-only; unarchive lands with M3.',
|
|
541
|
-
agentMock: 'spike: member detail (open session / message / memory & skills) lands with M3.',
|
|
576
|
+
followedTask: 'Following #{n}; written to the ledger.',
|
|
577
|
+
unfollowedTask: 'Unfollowed #{n}; completion, blockage or decisions still appear on the board.',
|
|
578
|
+
archivedNote: 'Archived projects are read-only; unarchive is not available yet.',
|
|
542
579
|
agentOpen: 'Chat with {name}',
|
|
543
580
|
moreActions: 'More actions',
|
|
544
581
|
agentChat: 'Direct chat',
|
|
@@ -550,13 +587,11 @@ window.__ModuleLoader__.load({
|
|
|
550
587
|
taskOwner: 'Owner',
|
|
551
588
|
taskAssignee: 'Assignee',
|
|
552
589
|
teamPulseTitle: 'Team activity',
|
|
553
|
-
|
|
554
|
-
teamPulseWorking: 'Members picked up the work',
|
|
590
|
+
teamPulseWorking: 'Members picked up the work',
|
|
555
591
|
teamPulseStarting: 'Members are awake and breaking the work down…',
|
|
556
592
|
teamPulseAgents: 'Running: {names}',
|
|
557
593
|
newProject: 'New project',
|
|
558
594
|
addAgent: 'Add member',
|
|
559
|
-
newProjectMock: 'spike: project creation belongs to S-01 and lands after M1.',
|
|
560
595
|
newProjectTitle: 'New project',
|
|
561
596
|
projectName: 'Project name',
|
|
562
597
|
projectGoal: 'Goal',
|
|
@@ -591,7 +626,6 @@ window.__ModuleLoader__.load({
|
|
|
591
626
|
projectCreate: 'Create project',
|
|
592
627
|
projectCreated: 'Created project {name}.',
|
|
593
628
|
projectSwitched: 'Switched project.',
|
|
594
|
-
addAgentMock: 'spike: adding members lands after M1.',
|
|
595
629
|
addAgentTitle: 'Add member',
|
|
596
630
|
memberName: 'Name',
|
|
597
631
|
memberRole: 'Role',
|
|
@@ -615,6 +649,47 @@ window.__ModuleLoader__.load({
|
|
|
615
649
|
memberAdding: 'Creating…',
|
|
616
650
|
memberAdded: 'Member created and activated.',
|
|
617
651
|
cancel: 'Cancel',
|
|
652
|
+
dialogConfirm: 'OK',
|
|
653
|
+
reseatSession: 'Reset session',
|
|
654
|
+
reseatConfirm: 'This closes the member\'s old session and rebuilds a new one in the current project workspace (a session\'s cwd is pinned at creation and cannot be changed in place). Continue?',
|
|
655
|
+
reseatDone: 'Session rebuilt in the current project workspace.',
|
|
656
|
+
decisionNotePlaceholder: 'Extra note (optional, recorded on the thread)',
|
|
657
|
+
decisionFollowUp: 'See project progress',
|
|
658
|
+
followUpMissing: 'No new stream messages since that decision yet.',
|
|
659
|
+
riskTitle: 'Risk list',
|
|
660
|
+
riskBlocked: 'Blocked',
|
|
661
|
+
riskStaleHours: 'pending {n}h',
|
|
662
|
+
riskCounts: 'blocked {blocked} · failures {failures} · stale {stale}',
|
|
663
|
+
followUpMissing: 'No new stream messages since that decision yet.',
|
|
664
|
+
permissionBadge: 'full access',
|
|
665
|
+
permissionNote: 'This member runs with full permissions, only inside this project\'s workspace. Create projects in trusted directories only.',
|
|
666
|
+
obTitle: 'Three steps to start',
|
|
667
|
+
obStep1: '① Set the project workspace',
|
|
668
|
+
obStep1Done: '① Workspace is ready',
|
|
669
|
+
obStep2: '② Meet your members (AGENTS list on the right; rename or adjust freely)',
|
|
670
|
+
obStep3: '③ Say the first sentence',
|
|
671
|
+
obExample: 'Fix the three failing regressions from this run',
|
|
672
|
+
obFill: 'Use example',
|
|
673
|
+
teamQuiet: 'Team is quiet: nothing needs you right now. Healthy.',
|
|
674
|
+
teamBusy: 'Team is moving: {n} task(s) in progress.',
|
|
675
|
+
teamNeedsYou: '{n} thing(s) need your decision or release.',
|
|
676
|
+
failureAuth: 'API key invalid or unauthorized',
|
|
677
|
+
failureBilling: 'Insufficient balance or quota',
|
|
678
|
+
failureRateLimit: 'Rate limited — too many requests',
|
|
679
|
+
failureNetwork: 'Network connection failed',
|
|
680
|
+
failureServer: 'Model server error',
|
|
681
|
+
failureModelUnavailable: 'Requested model not found or unavailable',
|
|
682
|
+
failureContextOverflow: 'Context exceeds the model window',
|
|
683
|
+
failurePolicy: 'Content rejected by safety policy',
|
|
684
|
+
failureUnknown: 'Unknown failure',
|
|
685
|
+
shortcutTitle: 'Keyboard shortcuts',
|
|
686
|
+
shortcutInbox: 'Inbox',
|
|
687
|
+
shortcutBoard: 'Task board',
|
|
688
|
+
shortcutPeople: 'People',
|
|
689
|
+
shortcutHome: 'Conversation',
|
|
690
|
+
shortcutComposer: 'Focus composer',
|
|
691
|
+
shortcutClose: 'Close thread / overlay',
|
|
692
|
+
close: 'Close',
|
|
618
693
|
memberProfileTitle: 'Member profile',
|
|
619
694
|
memberProfileTitleName: 'Member profile · {name}',
|
|
620
695
|
memberProfileMeta: '{status} · profile v{version} · distill v{distill}',
|
|
@@ -648,20 +723,40 @@ window.__ModuleLoader__.load({
|
|
|
648
723
|
recruit: 'Recruit',
|
|
649
724
|
profileSaved: 'Profile saved; effective on the next wake.',
|
|
650
725
|
profileDistilled: 'Re-distilled and recorded as a new version.',
|
|
651
|
-
conversationMock: 'spike: this host has no working layout.selectPanel(conversation).',
|
|
652
726
|
discussSent: 'Sent to the Project owner.',
|
|
653
727
|
taskSent: 'Task created.',
|
|
654
728
|
duplicateTask: 'An identical Task already exists (#{number}); opened it instead.',
|
|
655
729
|
qaNeedsChecklist: 'A QA Task needs at least one checklist item.',
|
|
656
|
-
duplicateTask: '相同 Task 已存在(#{number}),已为你打开它。',
|
|
657
|
-
qaNeedsChecklist: 'QA Task 至少需要一条验收清单。',
|
|
658
730
|
sendFailed: 'Send failed: {message}',
|
|
659
731
|
pendingHuman: 'Needs you',
|
|
660
732
|
inboxUnread: 'Inbox, {n} unread',
|
|
661
733
|
dismiss: 'Dismiss',
|
|
662
|
-
retry: 'Retry',
|
|
663
734
|
crashTitle: 'Workbench failed to render',
|
|
664
735
|
noProject: 'No project selected',
|
|
736
|
+
navHome: 'Conversation',
|
|
737
|
+
agentsScope: 'Project members',
|
|
738
|
+
people: 'People',
|
|
739
|
+
peopleTitle: 'People',
|
|
740
|
+
peopleEmpty: 'No members yet; add them in a project.',
|
|
741
|
+
peopleProjects: '{n} project(s)',
|
|
742
|
+
refresh: 'Refresh',
|
|
743
|
+
peopleActiveTasks: '{n} active task(s)',
|
|
744
|
+
peopleFailure: '{n} recent failure(s)',
|
|
745
|
+
peopleOpenProject: 'Open project',
|
|
746
|
+
peopleLoadFailed: 'Failed to load people: {message}',
|
|
747
|
+
irreversibleBadge: 'no undo',
|
|
748
|
+
pendingTitle: 'Awaiting your acceptance (across projects)',
|
|
749
|
+
eventHistoryTitle: 'Task event history',
|
|
750
|
+
eventHistoryEmpty: 'No events linked to this task yet.',
|
|
751
|
+
aliasTitle: 'Same-person binding',
|
|
752
|
+
aliasSourcePlaceholder: 'Other name',
|
|
753
|
+
aliasTargetPlaceholder: 'Merge into person',
|
|
754
|
+
aliasBind: 'Bind',
|
|
755
|
+
aliasHint: 'Bound names merge into one row in the people pool.',
|
|
756
|
+
aliasRequired: 'Fill in the name to merge first.',
|
|
757
|
+
aliasSaved: 'Merged "{name}" into "{person}".',
|
|
758
|
+
teamBusyN: 'in progress ×{n}',
|
|
759
|
+
pendingAcceptanceN: 'awaiting acceptance ×{n}',
|
|
665
760
|
archivedCount: 'Archived {n}',
|
|
666
761
|
q1Title: 'Needs you',
|
|
667
762
|
q2Title: 'Team is doing',
|
|
@@ -689,8 +784,7 @@ window.__ModuleLoader__.load({
|
|
|
689
784
|
catDone: 'Done',
|
|
690
785
|
waitOn: 'waiting on {ref}',
|
|
691
786
|
waitDependency: 'dependency unfinished',
|
|
692
|
-
|
|
693
|
-
quadrantMissing: 'spike: the Task behind this item is not in the current bootstrap data.',
|
|
787
|
+
quadrantMissing: 'The Task behind this item is not in the current data.',
|
|
694
788
|
filterLabel: 'Filter: {name}',
|
|
695
789
|
filterClear: 'Clear filter',
|
|
696
790
|
filterInboxExtra: '{n} inbox decision item(s) not on the board',
|
|
@@ -707,105 +801,6 @@ window.__ModuleLoader__.load({
|
|
|
707
801
|
doneNoInfo: 'No completion details recorded',
|
|
708
802
|
};
|
|
709
803
|
|
|
710
|
-
const MOCK = (() => {
|
|
711
|
-
const now = Date.now();
|
|
712
|
-
const ago = (min) => now - min * 60_000;
|
|
713
|
-
const thread11 = {
|
|
714
|
-
taskId: 'tsk_11',
|
|
715
|
-
headSeq: 6,
|
|
716
|
-
baseSeq: 4,
|
|
717
|
-
entries: [
|
|
718
|
-
{ seq: 1, author: '沈舟', at: ago(18), body: '先复现,再判断是不是同一个根因。' },
|
|
719
|
-
{ seq: 2, author: '林岚', at: ago(16), body: '我这边跑到第二条就复现了,日志在 /tmp/regression-2.log。' },
|
|
720
|
-
{ seq: 3, author: '沈舟', at: ago(14), body: '收到,把第三条也跑一遍,我加锁修。' },
|
|
721
|
-
{ seq: 4, author: '林岚', at: ago(11), body: 'upload.ts:88 的锁范围扩大后,第三条不再失败。' },
|
|
722
|
-
{ seq: 5, author: '沈舟', at: ago(7), body: '我认领 #11,先把修复提上来。' },
|
|
723
|
-
{ seq: 6, author: '沈舟', at: ago(5), body: '已提交待验收:3 条用例全绿,回归 214 条通过。' },
|
|
724
|
-
],
|
|
725
|
-
changes: [
|
|
726
|
-
{ who: '沈舟', what: '认领修复', seq: 5 },
|
|
727
|
-
{ who: '沈舟', what: '提交待验收', seq: 6 },
|
|
728
|
-
],
|
|
729
|
-
};
|
|
730
|
-
return {
|
|
731
|
-
projects: [
|
|
732
|
-
{ id: 'prj_main', name: 'Main-Dev', goal: '把这次回归清干净', owner: '沈舟', active: true },
|
|
733
|
-
{ id: 'prj_bug', name: 'Bug-Check-Fix', goal: '排查 issue 与后续修复', owner: '沈舟' },
|
|
734
|
-
{ id: 'prj_ui', name: 'UI-UX-AX', goal: '工作台体验与可访问性', owner: '顾言' },
|
|
735
|
-
{ id: 'prj_old', name: 'Old-Spike', goal: '已结束的第一阶段验证', owner: '顾言', archived: true },
|
|
736
|
-
],
|
|
737
|
-
agents: [
|
|
738
|
-
{ id: 'mem_shenzhou', name: '沈舟', role: '架构 · 管验收标准', status: 'running' },
|
|
739
|
-
{ id: 'mem_linlan', name: '林岚', role: '研究 · 复跑门禁', status: 'idle' },
|
|
740
|
-
{ id: 'mem_chenmo', name: '陈默', role: '产品 · 验收', status: 'idle' },
|
|
741
|
-
{ id: 'mem_guyan', name: '顾言', role: 'UI/UX · 工作台体验', status: 'idle' },
|
|
742
|
-
{ id: 'mem_xiaoman', name: '小满', role: '开发 · 正在准备记忆', status: 'provisioning' },
|
|
743
|
-
{ id: 'mem_laozhou', name: '老周', role: '已退役(历史保留)', status: 'retired' },
|
|
744
|
-
],
|
|
745
|
-
inbox: [
|
|
746
|
-
{ id: 'inbox_d1', kind: 'inbox', category: 'decision', title: '决策:首页文案选 A 还是 B', waitingSince: ago(25), read: false },
|
|
747
|
-
{ id: 'inbox_m1', kind: 'inbox', category: 'mention', title: '林岚在 #16 提到了你', waitingSince: ago(12), read: false },
|
|
748
|
-
],
|
|
749
|
-
stream: [
|
|
750
|
-
{ id: 'str_1', seq: 1, kind: 'human_message', at: ago(15), author: { kind: 'human', name: '你' }, body: '把这次回归里失败的三条都修了,谁该看谁看。' },
|
|
751
|
-
{
|
|
752
|
-
id: 'str_2', seq: 2, kind: 'task_card', at: ago(14), author: { kind: 'agent', name: '沈舟' },
|
|
753
|
-
body: '拆成 5 项,2 项互相依赖。我先复现,其余并行。',
|
|
754
|
-
taskIds: ['tsk_11', 'tsk_12', 'tsk_13', 'tsk_14', 'tsk_15'],
|
|
755
|
-
},
|
|
756
|
-
{
|
|
757
|
-
id: 'str_3', seq: 3, kind: 'task_card', at: ago(6), author: { kind: 'agent', name: '林岚' },
|
|
758
|
-
body: '两条已提交待验收,一条已完成;验收前先看证据。',
|
|
759
|
-
taskIds: ['tsk_16', 'tsk_17', 'tsk_18'],
|
|
760
|
-
},
|
|
761
|
-
],
|
|
762
|
-
tasks: [
|
|
763
|
-
{ id: 'tsk_11', number: 11, title: '复现三条失败的用例,界定影响面与不修什么', status: 'in_progress', owner: '沈舟', assignee: '沈舟', replies: 2, following: true, blockedBy: [], originRefs: ['str_1'], updatedAt: ago(8), summary: '先复现,再判断是不是同一个根因;不修与本次无关的 2 条 flaky。' },
|
|
764
|
-
{ id: 'tsk_12', number: 12, title: '登录超时:先加锁再断言,见 upload.ts:88', status: 'pending', owner: '沈舟', assignee: null, replies: 0, following: true, blockedBy: [], originRefs: ['str_2'], updatedAt: ago(11) },
|
|
765
|
-
{ id: 'tsk_13', number: 13, title: '上传 413:前端表单与后端限制不一致', status: 'pending', owner: '沈舟', assignee: null, replies: 0, following: true, blockedBy: ['tsk_12'], originRefs: ['str_2'], updatedAt: ago(30) },
|
|
766
|
-
{ id: 'tsk_14', number: 14, title: '回归门禁:复跑 build 与 browser 8/8', status: 'in_progress', owner: '林岚', assignee: '林岚', replies: 1, following: false, blockedBy: [], originRefs: ['str_2'], updatedAt: ago(20) },
|
|
767
|
-
{ id: 'tsk_15', number: 15, title: '把修法写成可复核的验收证据', status: 'in_progress', owner: '陈默', assignee: '陈默', replies: 0, following: false, blockedBy: [], originRefs: ['str_2'], updatedAt: ago(30) },
|
|
768
|
-
{
|
|
769
|
-
id: 'tsk_16', number: 16, title: '上传 413:前后端限制对齐后复验', status: 'pending_acceptance', owner: '沈舟', assignee: '沈舟', replies: 3, following: true, blockedBy: [], originRefs: ['str_3'], updatedAt: ago(5),
|
|
770
|
-
submission: { summary: '三条用例已修,回归全绿。', evidence: [{ label: 'test/report.xml', ref: 'a1f3' }, { label: 'pnpm test', ref: '214 passed' }], diffStat: '3 files · +48 −12' },
|
|
771
|
-
},
|
|
772
|
-
{
|
|
773
|
-
id: 'tsk_17', number: 17, title: '发布前确认:测试环境 v0.2', status: 'pending_acceptance', owner: '顾言', assignee: '顾言', replies: 2, following: false, blockedBy: [], originRefs: ['str_3'], updatedAt: ago(3), irreversible: true,
|
|
774
|
-
submission: { summary: '已发布 v0.2 到测试环境,对外可见。', evidence: [{ label: 'release-note.md', ref: 'draft' }], diffStat: '2 files · +6 −2' },
|
|
775
|
-
},
|
|
776
|
-
{ id: 'tsk_18', number: 18, title: '看板已完成列展开控件的可见性判断修正', status: 'done', owner: '林岚', assignee: '林岚', replies: 1, following: false, blockedBy: [], originRefs: ['str_3'], updatedAt: ago(5), completedAt: ago(5), acceptedBy: '沈舟', evidenceCount: 2 },
|
|
777
|
-
{ id: 'tsk_19', number: 19, title: '工作台窄容器三档截图与横向滚动检查', status: 'in_progress', owner: '顾言', assignee: '顾言', replies: 0, following: false, blockedBy: [], updatedAt: ago(40) },
|
|
778
|
-
{ id: 'tsk_20', number: 20, title: '把回归脚本的失败日志整理成证据', status: 'pending', owner: '沈舟', assignee: '沈舟', handoffTo: '简', replies: 0, following: false, blockedBy: [], updatedAt: ago(10) },
|
|
779
|
-
{ id: 'tsk_21', number: 21, title: '修复上传 413 的前端限制', status: 'done', owner: '沈舟', assignee: '沈舟', replies: 0, following: false, blockedBy: [], updatedAt: ago(60), completedAt: ago(60), acceptedBy: '你', evidenceCount: 1 },
|
|
780
|
-
{ id: 'tsk_22', number: 22, title: '回归门禁复跑 8/8', status: 'done', owner: '陈默', assignee: '陈默', replies: 0, following: false, blockedBy: [], updatedAt: ago(120), completedAt: ago(120), acceptedBy: '你', evidenceCount: 3 },
|
|
781
|
-
{ id: 'tsk_23', number: 23, title: 'Thread 引用与复制动作补齐', status: 'done', owner: '林岚', assignee: '林岚', replies: 0, following: false, blockedBy: [], updatedAt: ago(1440), completedAt: ago(1440), acceptedBy: '沈舟', evidenceCount: 0 },
|
|
782
|
-
{ id: 'tsk_24', number: 24, title: '工作台三栏骨架首次安装验证', status: 'done', owner: '沈舟', assignee: '沈舟', replies: 0, following: false, blockedBy: [], updatedAt: ago(2880), completedAt: ago(2880), acceptedBy: '你', evidenceCount: 1 },
|
|
783
|
-
],
|
|
784
|
-
threads: {
|
|
785
|
-
tsk_11: thread11,
|
|
786
|
-
tsk_16: {
|
|
787
|
-
taskId: 'tsk_16', headSeq: 3,
|
|
788
|
-
entries: [
|
|
789
|
-
{ seq: 1, author: '林岚', at: ago(12), body: '三条用例已修,回归全绿。' },
|
|
790
|
-
{ seq: 2, author: '沈舟', at: ago(8), body: '已提交待验收,证据见 test/report.xml。' },
|
|
791
|
-
{ seq: 3, author: '林岚', at: ago(6), body: '复跑 build 与 browser 8/8 通过。' },
|
|
792
|
-
],
|
|
793
|
-
},
|
|
794
|
-
tsk_17: {
|
|
795
|
-
taskId: 'tsk_17', headSeq: 2,
|
|
796
|
-
entries: [
|
|
797
|
-
{ seq: 1, author: '顾言', at: ago(10), body: '测试环境已发布 v0.2,对外可见。' },
|
|
798
|
-
{ seq: 2, author: '顾言', at: ago(4), body: '发布动作不可撤回,请确认影响。' },
|
|
799
|
-
],
|
|
800
|
-
},
|
|
801
|
-
tsk_18: {
|
|
802
|
-
taskId: 'tsk_18', headSeq: 1,
|
|
803
|
-
entries: [{ seq: 1, author: '沈舟', at: ago(6), body: '看板已完成列展开逻辑修好了。' }],
|
|
804
|
-
},
|
|
805
|
-
},
|
|
806
|
-
};
|
|
807
|
-
})();
|
|
808
|
-
|
|
809
804
|
const STATUS = {
|
|
810
805
|
pending: { label: 'stPending', tone: 'idle' },
|
|
811
806
|
in_progress: { label: 'stInProgress', tone: 'business' },
|
|
@@ -837,10 +832,20 @@ window.__ModuleLoader__.load({
|
|
|
837
832
|
stalled: 'catStalled',
|
|
838
833
|
done: 'catDone',
|
|
839
834
|
};
|
|
840
|
-
const Q1_ORDER = { irreversible: 0, review: 1, decision: 2, owner_blocked: 3 };
|
|
841
835
|
const TABS = ['main', 'board', 'situation'];
|
|
842
|
-
|
|
843
836
|
const cx = (...parts) => parts.filter(Boolean).join(' ');
|
|
837
|
+
// R-04 失败人话化:账本事件语言(member/llm-failed 的 category)转译为
|
|
838
|
+
// 用户语言 + 固定建议动作句式(谁/卡在哪/原因/你可以做什么)。
|
|
839
|
+
const failKey = (category) => 'failure' + String(category ?? 'unknown')
|
|
840
|
+
.split('_')
|
|
841
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
842
|
+
.join('');
|
|
843
|
+
const failureHuman = (t, category) => t(failKey(category ?? 'unknown'));
|
|
844
|
+
// R-18 事件历史的 actor 后缀。
|
|
845
|
+
const actorSuffix = (actor) => actor?.kind === 'human' ? ' · Human'
|
|
846
|
+
: actor?.kind === 'agent' ? ' · ' + (actor.memberId ?? 'Agent')
|
|
847
|
+
: actor?.kind === 'system' ? ' · 系统'
|
|
848
|
+
: '';
|
|
844
849
|
const tf = (t, key, vars) => String(t(key)).replace(/\{(\w+)\}/g, (match, name) => (
|
|
845
850
|
vars && Object.prototype.hasOwnProperty.call(vars, name) ? String(vars[name]) : match
|
|
846
851
|
));
|
|
@@ -896,95 +901,19 @@ window.__ModuleLoader__.load({
|
|
|
896
901
|
&& !(Array.isArray(item.ref?.questions) && item.ref.questions.length > 0);
|
|
897
902
|
}
|
|
898
903
|
|
|
899
|
-
/**
|
|
904
|
+
/** The host computes quadrants; the client only renders them (single read model). */
|
|
900
905
|
function deriveQuadrants(data) {
|
|
901
|
-
|
|
902
|
-
if (direct && direct.q1 && direct.q2 && direct.q3 && direct.q4) {
|
|
903
|
-
const inboxById = new Map((data?.inbox ?? []).map((item) => [item.id, item]));
|
|
904
|
-
const q1Items = (direct.q1.items ?? []).filter((item) =>
|
|
905
|
-
item.kind !== 'inbox' || !isInformationalInboxItem(inboxById.get(item.id)));
|
|
906
|
-
return { ...direct, q1: { ...direct.q1, count: q1Items.length, items: q1Items } };
|
|
907
|
-
}
|
|
908
|
-
const tasks = data?.tasks ?? [];
|
|
909
|
-
const inbox = data?.inbox ?? [];
|
|
910
|
-
const q1 = [];
|
|
911
|
-
const q2 = [];
|
|
912
|
-
const q3 = [];
|
|
913
|
-
const q4 = [];
|
|
914
|
-
const used = new Set();
|
|
915
|
-
const take = (bucket, item) => {
|
|
916
|
-
if (!item || used.has(item.id)) return;
|
|
917
|
-
used.add(item.id);
|
|
918
|
-
bucket.push(item);
|
|
919
|
-
};
|
|
920
|
-
const itemOf = (task, category) => ({
|
|
921
|
-
id: task.id,
|
|
922
|
-
kind: 'task',
|
|
923
|
-
category,
|
|
924
|
-
title: task.title,
|
|
925
|
-
taskId: task.id,
|
|
926
|
-
taskNumber: task.number,
|
|
927
|
-
ownerName: task.owner,
|
|
928
|
-
assigneeName: task.assignee,
|
|
929
|
-
waitingSince: task.updatedAt,
|
|
930
|
-
doneAt: task.completedAt,
|
|
931
|
-
evidenceCount: task.evidenceCount ?? task.submission?.evidence?.length ?? 0,
|
|
932
|
-
blockedBy: task.blockedBy,
|
|
933
|
-
handoffTo: task.handoffTo,
|
|
934
|
-
acceptedBy: task.acceptedBy,
|
|
935
|
-
});
|
|
936
|
-
tasks.forEach((task) => {
|
|
937
|
-
if (task.status === 'pending_acceptance') take(q1, itemOf(task, task.irreversible ? 'irreversible' : 'review'));
|
|
938
|
-
});
|
|
939
|
-
tasks.forEach((task) => {
|
|
940
|
-
if (task.owner === '你' && task.status === 'pending' && (task.blockedBy?.length || task.handoffTo)) {
|
|
941
|
-
take(q1, itemOf(task, 'owner_blocked'));
|
|
942
|
-
}
|
|
943
|
-
});
|
|
944
|
-
inbox.forEach((item) => {
|
|
945
|
-
if (item.category === 'decision' && !used.has(item.id)) {
|
|
946
|
-
used.add(item.id);
|
|
947
|
-
q1.push({
|
|
948
|
-
id: item.id,
|
|
949
|
-
kind: 'inbox',
|
|
950
|
-
category: 'decision',
|
|
951
|
-
title: item.title,
|
|
952
|
-
taskId: item.taskId,
|
|
953
|
-
taskNumber: item.taskNumber,
|
|
954
|
-
waitingSince: item.waitingSince,
|
|
955
|
-
});
|
|
956
|
-
}
|
|
957
|
-
});
|
|
958
|
-
tasks.forEach((task) => {
|
|
959
|
-
if (task.status === 'in_progress') take(q2, itemOf(task, 'in_progress'));
|
|
960
|
-
});
|
|
961
|
-
tasks.forEach((task) => {
|
|
962
|
-
if (task.status !== 'pending' || used.has(task.id)) return;
|
|
963
|
-
if (task.handoffTo) take(q3, itemOf(task, 'handoff'));
|
|
964
|
-
else if (task.blockedBy?.length) take(q3, itemOf(task, 'blocked'));
|
|
965
|
-
});
|
|
966
|
-
tasks.forEach((task) => {
|
|
967
|
-
if (task.status === 'done') take(q4, itemOf(task, 'done'));
|
|
968
|
-
});
|
|
969
|
-
q1.sort((a, b) => (Q1_ORDER[a.category] ?? 9) - (Q1_ORDER[b.category] ?? 9) || (a.waitingSince ?? 0) - (b.waitingSince ?? 0));
|
|
970
|
-
q2.sort((a, b) => (b.waitingSince ?? 0) - (a.waitingSince ?? 0));
|
|
971
|
-
q3.sort((a, b) => (a.waitingSince ?? 0) - (b.waitingSince ?? 0));
|
|
972
|
-
q4.sort((a, b) => (b.doneAt ?? 0) - (a.doneAt ?? 0));
|
|
973
|
-
return {
|
|
974
|
-
rev: data?.rev ?? 0,
|
|
975
|
-
generatedAt: data?.generatedAt ?? Date.now(),
|
|
976
|
-
q1: { count: q1.length, items: q1.slice(0, 5) },
|
|
977
|
-
q2: { count: q2.length, items: q2.slice(0, 5) },
|
|
978
|
-
q3: { count: q3.length, items: q3.slice(0, 5) },
|
|
979
|
-
q4: { count: Math.min(q4.length, 20), items: q4.slice(0, 5), total: q4.length },
|
|
980
|
-
};
|
|
906
|
+
return data?.quadrants ?? null;
|
|
981
907
|
}
|
|
982
908
|
|
|
983
909
|
/** Only the four board columns; `blocked` stays a badge, never a column. */
|
|
984
|
-
function matchesFilter(task, filter) {
|
|
985
|
-
if (filter === 'q1')
|
|
910
|
+
function matchesFilter(task, filter, humanId) {
|
|
911
|
+
if (filter === 'q1') {
|
|
912
|
+
return task.status === 'pending_acceptance'
|
|
913
|
+
|| (task.ownerId === humanId && task.status === 'pending' && task.blocked === true);
|
|
914
|
+
}
|
|
986
915
|
if (filter === 'q2') return task.status === 'in_progress';
|
|
987
|
-
if (filter === 'q3') return task.status === 'pending' &&
|
|
916
|
+
if (filter === 'q3') return task.status === 'pending' && task.blocked === true;
|
|
988
917
|
if (filter === 'q4') return task.status === 'done';
|
|
989
918
|
return true;
|
|
990
919
|
}
|
|
@@ -993,7 +922,7 @@ window.__ModuleLoader__.load({
|
|
|
993
922
|
.at-root { height: 100%; min-height: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; color: var(--dsw-alias-label-primary); background: var(--dsw-alias-bg-base); font-family: var(--dsw-font-family); font-size: 13px; line-height: 21px; container-type: inline-size; container-name: at-wb; }
|
|
994
923
|
.at-root *, .at-root *::before, .at-root *::after { box-sizing: border-box; }
|
|
995
924
|
.at-toaststack { position: fixed; right: 18px; bottom: 18px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; max-width: min(360px, calc(100vw - 36px)); pointer-events: none; }
|
|
996
|
-
.at-toast { pointer-events: auto; display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 7px 9px; border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-md); background: var(--dsw-alias-bg-layer-1); box-shadow: 0 8px 24px
|
|
925
|
+
.at-toast { pointer-events: auto; display: flex; align-items: center; gap: 8px; max-width: 100%; padding: 7px 9px; border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-md); background: var(--dsw-alias-bg-layer-1); box-shadow: var(--dsw-elevation-panel, 0 8px 24px var(--dsw-alias-bg-mask-2)); color: var(--dsw-alias-label-primary); font-size: 12px; line-height: 18px; }
|
|
997
926
|
.at-toasticon { display: inline-flex; color: var(--dsw-alias-state-business-primary); flex: 0 0 auto; }
|
|
998
927
|
.at-toasttext { min-width: 0; overflow-wrap: anywhere; }
|
|
999
928
|
.at-toastclose { border: 0; background: transparent; color: var(--dsw-alias-label-tertiary); font: inherit; font-size: 14px; line-height: 16px; cursor: pointer; padding: 0 2px; }
|
|
@@ -1008,10 +937,11 @@ window.__ModuleLoader__.load({
|
|
|
1008
937
|
.at-mobilesummary::-webkit-details-marker { display: none; }
|
|
1009
938
|
.at-mobilepop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; width: min(320px, calc(100vw - 32px)); width: min(320px, calc(100cqw - 16px)); max-height: 70vh; overflow-y: auto; overflow-x: hidden; padding: 8px; border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-md); background: var(--dsw-alias-bg-layer-1); box-shadow: var(--dsw-elevation-panel, 0 8px 24px var(--dsw-alias-bg-mask-2)); }
|
|
1010
939
|
.at-grid { flex: 1; min-height: 0; min-width: 0; position: relative; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
|
|
1011
|
-
.at-grid.at-withthread { grid-template-columns: 248px minmax(0, 1fr) 384px; }
|
|
1012
940
|
.at-left { min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 8px 8px 12px; border-right: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-base); scrollbar-width: thin; scrollbar-color: var(--dsw-alias-scrollbar-bg-l1) transparent; }
|
|
1013
941
|
.at-center { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--dsw-alias-bg-base); container-type: inline-size; container-name: at-center; }
|
|
1014
|
-
|
|
942
|
+
/* 右栏是覆盖层(fixed 语义的 absolute 覆盖,不占网格列):任何宽度下
|
|
943
|
+
开/关线程面板都不挤压中栏、不触发整栏重排(规格 #6)。 */
|
|
944
|
+
.at-right { position: absolute; top: 0; right: 0; bottom: 0; z-index: 10; min-width: 0; min-height: 0; width: min(420px, 100%); display: flex; flex-direction: column; border-left: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-1); box-shadow: var(--dsw-elevation-panel, 0 8px 24px var(--dsw-alias-bg-mask-2)); }
|
|
1015
945
|
.at-nav { display: flex; flex-direction: column; gap: 1px; }
|
|
1016
946
|
.at-navrow { width: 100%; min-height: 32px; display: flex; align-items: center; gap: 8px; padding: 0 8px; border: 0; border-radius: var(--dsw-radius-sm); background: transparent; color: var(--dsw-alias-label-secondary); font: inherit; font-size: 12px; line-height: 18px; text-align: left; cursor: pointer; }
|
|
1017
947
|
.at-navrow:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
|
|
@@ -1044,6 +974,8 @@ window.__ModuleLoader__.load({
|
|
|
1044
974
|
.at-agentrole { min-width: 0; color: var(--dsw-alias-label-caption); font-size: 11px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
1045
975
|
.at-inboxitem { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 11px 13px; border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-bg-layer-2); }
|
|
1046
976
|
.at-inboxitem.at-inboxdone { opacity: 0.62; }
|
|
977
|
+
.at-inboxitem.at-inboxstale { border-left: 2px solid var(--dsw-alias-state-warn-primary); }
|
|
978
|
+
.at-inboxitem.at-inboxstale2 { border-left: 3px solid var(--dsw-alias-state-error-primary); }
|
|
1047
979
|
.at-inboxbody { min-width: 0; flex: 1; }
|
|
1048
980
|
.at-inboxquestions { margin: 6px 0 2px; padding-left: 20px; color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 19px; }
|
|
1049
981
|
.at-inboxquestions li { margin: 3px 0; }
|
|
@@ -1297,7 +1229,6 @@ window.__ModuleLoader__.load({
|
|
|
1297
1229
|
.at-actions { margin: 12px 0; padding-top: 12px; border-top: 1px solid var(--dsw-alias-border-l1); }
|
|
1298
1230
|
.at-actionhead { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
|
|
1299
1231
|
.at-actiontitle { color: var(--dsw-alias-label-secondary); font-size: 12px; font-weight: 500; line-height: 18px; }
|
|
1300
|
-
.at-mocktag { color: var(--dsw-alias-label-caption); font-size: 10px; line-height: 16px; }
|
|
1301
1232
|
.at-actionrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
|
|
1302
1233
|
.at-done { margin: 12px 0 0; padding: 12px; border-left: 2px solid var(--dsw-alias-state-success-primary); border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-bg-layer-2); display: flex; flex-direction: column; gap: 4px; }
|
|
1303
1234
|
.at-donehead { display: flex; align-items: center; gap: 6px; color: var(--dsw-alias-state-success-primary); font-size: 12px; font-weight: 500; line-height: 18px; }
|
|
@@ -1315,8 +1246,8 @@ window.__ModuleLoader__.load({
|
|
|
1315
1246
|
.at-modal { width: min(420px, 100%); max-height: 86vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--dsw-alias-border-l1); border-radius: 12px; background: var(--dsw-alias-bg-layer-2); }
|
|
1316
1247
|
.at-modaltitle { margin: 0 0 2px; font-size: 15px; font-weight: 600; color: var(--dsw-alias-label-primary); }
|
|
1317
1248
|
.at-modalmeta { color: var(--dsw-alias-label-tertiary); font-size: 11px; line-height: 16px; }
|
|
1318
|
-
.at-check { display: flex; align-items: center; gap: 6px; color: var(--dsw-alias-label-secondary); font-size: 12px; }
|
|
1319
|
-
.at-check input { accent-color: var(--dsw-alias-state-business-primary); }
|
|
1249
|
+
.at-modal .at-check { display: flex; align-items: center; gap: 6px; color: var(--dsw-alias-label-secondary); font-size: 12px; }
|
|
1250
|
+
.at-modal .at-check input { accent-color: var(--dsw-alias-state-business-primary); }
|
|
1320
1251
|
.at-modalerror { color: var(--dsw-alias-state-error-primary); font-size: 11.5px; line-height: 16px; }
|
|
1321
1252
|
.at-inlineadd { display: flex; align-items: center; gap: 6px; }
|
|
1322
1253
|
.at-inlineadd input { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); font: inherit; font-size: 12px; }
|
|
@@ -1332,6 +1263,34 @@ window.__ModuleLoader__.load({
|
|
|
1332
1263
|
.at-skel-agent { height: 40px; margin-bottom: 6px; }
|
|
1333
1264
|
.at-skel-col { height: 120px; }
|
|
1334
1265
|
.at-crash { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; color: var(--dsw-alias-state-error-primary); text-align: center; }
|
|
1266
|
+
.at-people { margin: 0 12px 8px; border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-md); background: var(--dsw-alias-bg-layer-1); }
|
|
1267
|
+
.at-people-failed { border-color: var(--dsw-alias-state-error-primary); }
|
|
1268
|
+
.at-peoplesum { display: flex; align-items: center; gap: 8px; padding: 9px 10px; cursor: pointer; list-style: none; }
|
|
1269
|
+
.at-peoplesum::-webkit-details-marker { display: none; }
|
|
1270
|
+
.at-peoplename { color: var(--dsw-alias-label-primary); font-size: 13px; font-weight: 500; }
|
|
1271
|
+
.at-people-role { color: var(--dsw-alias-label-tertiary); font-size: 11px; }
|
|
1272
|
+
.at-peoplebadges { margin-left: auto; color: var(--dsw-alias-label-caption); font-size: 11px; font-variant-numeric: tabular-nums; }
|
|
1273
|
+
.at-peopleprojects { display: flex; flex-direction: column; gap: 4px; padding: 0 10px 10px; }
|
|
1274
|
+
.at-peopleproject { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-bg-layer-2); }
|
|
1275
|
+
.at-peopleprojectname { color: var(--dsw-alias-label-secondary); font-size: 12px; }
|
|
1276
|
+
.at-peoplestate { color: var(--dsw-alias-label-tertiary); font-size: 11px; }
|
|
1277
|
+
.at-peopletasks { margin-left: auto; color: var(--dsw-alias-label-caption); font-size: 11px; font-variant-numeric: tabular-nums; }
|
|
1278
|
+
.at-peoplefail { color: var(--dsw-alias-state-error-primary); font-size: 11px; }
|
|
1279
|
+
.at-onboard { max-width: 520px; margin: 0 auto; padding: 14px; border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-md); background: var(--dsw-alias-bg-layer-1); display: flex; flex-direction: column; gap: 8px; }
|
|
1280
|
+
.at-onboardtitle { color: var(--dsw-alias-label-primary); font-size: 13px; font-weight: 500; }
|
|
1281
|
+
.at-obstep { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 18px; }
|
|
1282
|
+
.at-obstep.at-obdone { color: var(--dsw-alias-label-tertiary); }
|
|
1283
|
+
.at-obmark { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--dsw-alias-border-l2); color: var(--dsw-alias-label-caption); font-size: 11px; flex: 0 0 auto; }
|
|
1284
|
+
.at-obstep.at-obdone .at-obmark { border-color: var(--dsw-alias-state-success-primary); color: var(--dsw-alias-state-success-primary); }
|
|
1285
|
+
.at-oblabel { flex: 1 1 auto; min-width: 0; }
|
|
1286
|
+
.at-peoplehead { display: flex; align-items: center; gap: 8px; margin: 0 12px 8px; }
|
|
1287
|
+
.at-peoplecount { color: var(--dsw-alias-label-caption); font-size: 11px; margin-right: auto; }
|
|
1288
|
+
.at-permbadge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--dsw-alias-state-warn-primary); color: var(--dsw-alias-state-warn-label); font-size: 10.5px; }
|
|
1289
|
+
.at-msg-highlight { border-left: 2px solid var(--dsw-alias-state-business-primary); padding-left: 10px; }
|
|
1290
|
+
.at-decisionnote { width: 100%; padding: 6px 8px; border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); font: inherit; font-size: 12px; line-height: 18px; resize: vertical; }
|
|
1291
|
+
.at-shortcuts { width: 100%; border-collapse: collapse; }
|
|
1292
|
+
.at-shortcuts td { padding: 4px 6px; color: var(--dsw-alias-label-secondary); font-size: 12px; }
|
|
1293
|
+
.at-shortcuts kbd { display: inline-block; min-width: 34px; padding: 1px 6px; border: 1px solid var(--dsw-alias-border-l2); border-radius: var(--dsw-radius-sm); background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); font-family: var(--dsw-font-family); font-size: 11px; text-align: center; }
|
|
1335
1294
|
.at-crashtitle { font-size: 14px; font-weight: 500; line-height: 22px; }
|
|
1336
1295
|
.at-crashbody { max-width: 60ch; margin: 0; color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
1337
1296
|
@container at-center (max-width: 759px) {
|
|
@@ -1341,14 +1300,14 @@ window.__ModuleLoader__.load({
|
|
|
1341
1300
|
.at-board { grid-template-columns: minmax(0, 1fr); }
|
|
1342
1301
|
}
|
|
1343
1302
|
@container at-wb (max-width: 1119px) {
|
|
1344
|
-
.at-grid
|
|
1345
|
-
.at-right {
|
|
1303
|
+
.at-grid { grid-template-columns: 200px minmax(0, 1fr); }
|
|
1304
|
+
.at-right { width: min(420px, 100%); }
|
|
1346
1305
|
.at-boardwrap { padding: 12px; }
|
|
1347
1306
|
.at-board { gap: 8px; }
|
|
1348
1307
|
}
|
|
1349
1308
|
@container at-wb (max-width: 959px) {
|
|
1350
|
-
.at-grid
|
|
1351
|
-
.at-right {
|
|
1309
|
+
.at-grid { grid-template-columns: 200px minmax(0, 1fr); }
|
|
1310
|
+
.at-right { width: 100%; max-width: none; border-left: 0; box-shadow: none; }
|
|
1352
1311
|
.at-board { grid-template-columns: minmax(0, 1fr); }
|
|
1353
1312
|
.at-quadrants { grid-template-columns: minmax(0, 1fr); }
|
|
1354
1313
|
.at-chead { padding: 10px 12px 0; }
|
|
@@ -1359,7 +1318,7 @@ window.__ModuleLoader__.load({
|
|
|
1359
1318
|
.at-situation { padding: 12px 12px 16px; }
|
|
1360
1319
|
}
|
|
1361
1320
|
@container at-wb (max-width: 719px) {
|
|
1362
|
-
.at-grid
|
|
1321
|
+
.at-grid { grid-template-columns: minmax(0, 1fr); }
|
|
1363
1322
|
.at-left { display: none; }
|
|
1364
1323
|
.at-mobile { display: block; }
|
|
1365
1324
|
.at-top { padding: 0 8px; gap: 6px; }
|
|
@@ -1487,6 +1446,7 @@ window.__ModuleLoader__.load({
|
|
|
1487
1446
|
fromDiscussion ? h('span', { className: 'at-origin', title: t('fromDiscussion'), 'aria-hidden': 'true' }, h(Ico, { name: 'reply', size: 12 })) : null,
|
|
1488
1447
|
h('span', { className: 'at-num' }, 'Task #' + no),
|
|
1489
1448
|
h(StatusPill, { t, status: card.status }),
|
|
1449
|
+
card.irreversible ? h('span', { className: 'at-blocked', title: t('irreversibleBadge') }, t('irreversibleBadge')) : null,
|
|
1490
1450
|
refs.length ? h('span', { className: 'at-blocked' }, h(Ico, { name: 'block', size: 12 }), t('blocked'), h('span', { className: 'at-dep' }, '· ' + t('dependsOn') + ' ' + refs.join('、'))) : null,
|
|
1491
1451
|
h('span', { className: 'at-replies' }, replyLabel + (time ? ' · ' + time : '')),
|
|
1492
1452
|
),
|
|
@@ -1539,16 +1499,19 @@ window.__ModuleLoader__.load({
|
|
|
1539
1499
|
);
|
|
1540
1500
|
}
|
|
1541
1501
|
|
|
1542
|
-
function StreamMessage({ t, item, data, tasks, selected, follows, onOpen, onToggleFollow }) {
|
|
1502
|
+
function StreamMessage({ t, item, data, tasks, selected, follows, highlight, onOpenProfile, onOpen, onToggleFollow }) {
|
|
1543
1503
|
const author = item.author ?? {};
|
|
1544
|
-
|
|
1504
|
+
// 结构化判定:kind 是权威字段;显示名回退只兼容旧账本流。
|
|
1505
|
+
const human = author.kind === 'human' || (author.kind === undefined && agentFor(data, author.name) === null && author.name === t('you'));
|
|
1545
1506
|
const agent = agentFor(data, author.name);
|
|
1546
1507
|
const cards = (item.taskIds ?? []).map((id) => tasks.find((task) => task.id === id)).filter(Boolean);
|
|
1547
|
-
return h('article', { className: cx('at-msg', human && 'at-msg-human') },
|
|
1548
|
-
h(Avatar, { name: author.name ?? (human ? '
|
|
1508
|
+
return h('article', { className: cx('at-msg', human && 'at-msg-human', highlight && 'at-msg-highlight') },
|
|
1509
|
+
h(Avatar, { name: author.name ?? (human ? t('you') : '?'), human }),
|
|
1549
1510
|
h('div', { className: 'at-msgb' },
|
|
1550
1511
|
h('div', { className: 'at-msgh' },
|
|
1551
|
-
|
|
1512
|
+
// R-03 入口统一:点成员名 = 打开成员面板(与左栏/人员池一致)。
|
|
1513
|
+
agent ? h('button', { className: 'at-agentname', type: 'button', onClick: () => onOpenProfile(agent), title: agent.name }, author.name ?? '—')
|
|
1514
|
+
: h('b', null, author.name ?? '—'),
|
|
1552
1515
|
agent ? h('span', { className: 'at-role' }, agent.role) : null,
|
|
1553
1516
|
h('time', { dateTime: iso(item.at) }, fmtTime(item.at)),
|
|
1554
1517
|
),
|
|
@@ -1560,10 +1523,117 @@ window.__ModuleLoader__.load({
|
|
|
1560
1523
|
function ToastStack({ t, toasts, onClose }) {
|
|
1561
1524
|
if (toasts.length === 0) return null;
|
|
1562
1525
|
return h('div', { className: 'at-toaststack', role: 'status', 'aria-live': 'polite' },
|
|
1563
|
-
toasts.map((toast) => h(
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1526
|
+
toasts.map((toast) => h(ToastRow, { key: toast.id, toast, t, onClose })));
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
/** One toast row owning its own expiry timer (cleared on unmount). */
|
|
1530
|
+
function ToastRow({ t, toast, onClose }) {
|
|
1531
|
+
React.useEffect(() => {
|
|
1532
|
+
const timer = setTimeout(() => onClose(toast.id), 7000);
|
|
1533
|
+
return () => clearTimeout(timer);
|
|
1534
|
+
}, []);
|
|
1535
|
+
return h('div', { className: 'at-toast' },
|
|
1536
|
+
h('span', { className: 'at-toasticon', 'aria-hidden': 'true' }, h(Ico, { name: 'inbox', size: 13 })),
|
|
1537
|
+
h('span', { className: 'at-toasttext' }, toast.text),
|
|
1538
|
+
h('button', { className: 'at-toastclose', type: 'button', 'aria-label': t('notifyClose'), onClick: () => onClose(toast.id) }, '×'));
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
/** 模态栈:多模态同开时只有栈顶响应 Escape(后开先关)。 */
|
|
1542
|
+
const MODAL_STACK = [];
|
|
1543
|
+
|
|
1544
|
+
/**
|
|
1545
|
+
* Shared modal backdrop: Escape closes the TOP modal only, Tab stays
|
|
1546
|
+
* inside the dialog. Module-level so React sees a stable component
|
|
1547
|
+
* type across renders.
|
|
1548
|
+
*/
|
|
1549
|
+
function ModalBack({ onClose, children }) {
|
|
1550
|
+
const backRef = React.useRef(null);
|
|
1551
|
+
const onCloseRef = React.useRef(onClose);
|
|
1552
|
+
onCloseRef.current = onClose;
|
|
1553
|
+
React.useEffect(() => {
|
|
1554
|
+
const modalId = Symbol('at-modal');
|
|
1555
|
+
MODAL_STACK.push(modalId);
|
|
1556
|
+
const onKey = (event) => {
|
|
1557
|
+
if (event.defaultPrevented) return;
|
|
1558
|
+
// 非栈顶(被更晚打开的模态覆盖)时让位:Escape/Tab 都不处理。
|
|
1559
|
+
if (MODAL_STACK[MODAL_STACK.length - 1] !== modalId) return;
|
|
1560
|
+
if (event.key === 'Escape') {
|
|
1561
|
+
event.preventDefault();
|
|
1562
|
+
event.stopPropagation();
|
|
1563
|
+
onCloseRef.current();
|
|
1564
|
+
return;
|
|
1565
|
+
}
|
|
1566
|
+
if (event.key !== 'Tab' || !backRef.current) return;
|
|
1567
|
+
const focusables = backRef.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
1568
|
+
if (focusables.length === 0) {
|
|
1569
|
+
event.preventDefault();
|
|
1570
|
+
return;
|
|
1571
|
+
}
|
|
1572
|
+
const first = focusables[0];
|
|
1573
|
+
const last = focusables[focusables.length - 1];
|
|
1574
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
1575
|
+
event.preventDefault();
|
|
1576
|
+
last.focus();
|
|
1577
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
1578
|
+
event.preventDefault();
|
|
1579
|
+
first.focus();
|
|
1580
|
+
}
|
|
1581
|
+
};
|
|
1582
|
+
window.addEventListener('keydown', onKey);
|
|
1583
|
+
return () => {
|
|
1584
|
+
window.removeEventListener('keydown', onKey);
|
|
1585
|
+
const index = MODAL_STACK.indexOf(modalId);
|
|
1586
|
+
if (index >= 0) MODAL_STACK.splice(index, 1);
|
|
1587
|
+
};
|
|
1588
|
+
}, []);
|
|
1589
|
+
return h('div', { className: 'at-modalback', ref: backRef }, children);
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* 自绘确认/输入对话框(替代原生 confirm/prompt):confirm 布尔、
|
|
1594
|
+
* prompt 文本、choice 选项。模块级组件 + 调用方自增 key 保证每次
|
|
1595
|
+
* 新对话框重建(输入初始值生效)。
|
|
1596
|
+
*/
|
|
1597
|
+
function WorkbenchDialog({ t, dialog, onDismiss }) {
|
|
1598
|
+
const [value, setValue] = React.useState(dialog.value ?? '');
|
|
1599
|
+
const settle = (result) => {
|
|
1600
|
+
dialog.resolve(result);
|
|
1601
|
+
onDismiss();
|
|
1602
|
+
};
|
|
1603
|
+
const cancel = () => settle(dialog.mode === 'confirm' ? false : null);
|
|
1604
|
+
const submit = () => settle(dialog.mode === 'confirm' ? true : value.trim());
|
|
1605
|
+
const canSubmit = dialog.mode === 'confirm' || value.trim() !== '';
|
|
1606
|
+
return h(ModalBack, { onClose: cancel },
|
|
1607
|
+
h('div', {
|
|
1608
|
+
className: 'at-modal',
|
|
1609
|
+
role: 'dialog',
|
|
1610
|
+
'aria-modal': 'true',
|
|
1611
|
+
'aria-label': dialog.title,
|
|
1612
|
+
onKeyDown: (event) => {
|
|
1613
|
+
// 三模式统一:Enter=确认(与原生 prompt 风格一致)。
|
|
1614
|
+
if (event.key === 'Enter' && event.target.tagName !== 'TEXTAREA' && canSubmit) {
|
|
1615
|
+
event.preventDefault();
|
|
1616
|
+
submit();
|
|
1617
|
+
}
|
|
1618
|
+
},
|
|
1619
|
+
},
|
|
1620
|
+
h('h2', { className: 'at-modaltitle' }, dialog.title),
|
|
1621
|
+
dialog.body ? h('p', { className: 'at-modalmeta' }, dialog.body) : null,
|
|
1622
|
+
dialog.mode === 'prompt'
|
|
1623
|
+
? h('input', {
|
|
1624
|
+
value,
|
|
1625
|
+
onChange: (event) => setValue(event.target.value),
|
|
1626
|
+
placeholder: dialog.placeholder ?? '',
|
|
1627
|
+
autoFocus: true,
|
|
1628
|
+
})
|
|
1629
|
+
: null,
|
|
1630
|
+
dialog.mode === 'choice'
|
|
1631
|
+
? h('select', { value, onChange: (event) => setValue(event.target.value), autoFocus: true },
|
|
1632
|
+
(dialog.options ?? []).map((option) => h('option', { key: option, value: option }, option)))
|
|
1633
|
+
: null,
|
|
1634
|
+
h('div', { className: 'at-modalactions' },
|
|
1635
|
+
h('button', { className: 'at-btn', type: 'button', onClick: cancel }, t('cancel')),
|
|
1636
|
+
h('button', { className: 'at-btn at-btn-primary', type: 'button', onClick: submit, disabled: !canSubmit, autoFocus: dialog.mode === 'confirm' }, t('dialogConfirm')))));
|
|
1567
1637
|
}
|
|
1568
1638
|
|
|
1569
1639
|
function EmptyState({ t, icon, title, body, action, compact }) {
|
|
@@ -1598,8 +1668,8 @@ window.__ModuleLoader__.load({
|
|
|
1598
1668
|
})));
|
|
1599
1669
|
}
|
|
1600
1670
|
|
|
1601
|
-
function Board({ t, tasks, selected, follows, doneOpen, onToggleDone, onOpen, onToggleFollow, filter, onClearFilter, q1Extra, onBackMain, onOpenInbox }) {
|
|
1602
|
-
const filtered = (filter === 'all' ? tasks : tasks.filter((task) => matchesFilter(task, filter)))
|
|
1671
|
+
function Board({ t, tasks, selected, follows, doneOpen, onToggleDone, onOpen, onToggleFollow, filter, onClearFilter, q1Extra, onBackMain, onOpenInbox, humanId }) {
|
|
1672
|
+
const filtered = (filter === 'all' ? tasks : tasks.filter((task) => matchesFilter(task, filter, humanId)))
|
|
1603
1673
|
.slice()
|
|
1604
1674
|
.sort((left, right) => (right.number ?? 0) - (left.number ?? 0));
|
|
1605
1675
|
const filterName = filter === 'all' ? '' : t(filter === 'q1' ? 'q1Title' : filter === 'q2' ? 'q2Title' : filter === 'q3' ? 'q3Title' : 'q4Title');
|
|
@@ -1752,6 +1822,7 @@ window.__ModuleLoader__.load({
|
|
|
1752
1822
|
function InboxDecision({ t, item, onSubmit }) {
|
|
1753
1823
|
const questions = Array.isArray(item.ref?.questions) ? item.ref.questions : [];
|
|
1754
1824
|
const [answers, setAnswers] = React.useState(() => questions.map(() => ''));
|
|
1825
|
+
const [note, setNote] = React.useState('');
|
|
1755
1826
|
const [busy, setBusy] = React.useState(false);
|
|
1756
1827
|
const setAnswer = (index, value) => setAnswers((prev) => prev.map((entry, i) => i === index ? value : entry));
|
|
1757
1828
|
const recommendations = questions.map((question) => typeof question.recommendation === 'string' ? question.recommendation.trim() : '');
|
|
@@ -1762,7 +1833,8 @@ window.__ModuleLoader__.load({
|
|
|
1762
1833
|
if (!complete || busy) return;
|
|
1763
1834
|
setBusy(true);
|
|
1764
1835
|
try {
|
|
1765
|
-
|
|
1836
|
+
// R-06:可选补充说明随决策一起入 Thread/收件箱存档。
|
|
1837
|
+
await onSubmit(item, questions.map((question, index) => ({ id: question.id, value: answers[index].trim() })), note.trim());
|
|
1766
1838
|
} finally {
|
|
1767
1839
|
setBusy(false);
|
|
1768
1840
|
}
|
|
@@ -1781,9 +1853,90 @@ window.__ModuleLoader__.load({
|
|
|
1781
1853
|
question.recommendation ? h('div', { className: 'at-decisionrecommend' },
|
|
1782
1854
|
h('span', null, t('decisionRecommend') + ':' + question.recommendation),
|
|
1783
1855
|
h('button', { className: 'at-adopt', type: 'button', onClick: () => setAnswer(index, question.recommendation) }, t('decisionAdopt'))) : null))),
|
|
1856
|
+
h('textarea', {
|
|
1857
|
+
className: 'at-decisionnote',
|
|
1858
|
+
value: note,
|
|
1859
|
+
placeholder: t('decisionNotePlaceholder'),
|
|
1860
|
+
'aria-label': t('decisionNotePlaceholder'),
|
|
1861
|
+
onChange: (event) => setNote(event.target.value),
|
|
1862
|
+
rows: 2,
|
|
1863
|
+
}),
|
|
1784
1864
|
h('button', { className: 'at-btn at-btn-primary at-btn-small', type: 'button', disabled: !complete || busy, onClick: submit }, busy ? t('saving') : t('decisionSubmit')));
|
|
1785
1865
|
}
|
|
1786
1866
|
|
|
1867
|
+
/**
|
|
1868
|
+
* 人员池总览(全局层,11-管理视角 §2):按"人"聚合各项目身份。
|
|
1869
|
+
* 数据 = GET /ai-team/api/people(各项目账本 members/tasks 的只读聚合)。
|
|
1870
|
+
*/
|
|
1871
|
+
function PeoplePage({ t, people, error, loading, onOpenProject, onRefresh, localNames, onOpenPerson, onChatPerson }) {
|
|
1872
|
+
if (error) return h('div', { className: 'at-stream', role: 'alert' },
|
|
1873
|
+
h('div', { className: 'at-streaminner' }, h(EmptyState, { t, icon: 'alert', title: t('peopleTitle'), body: tf(t, 'peopleLoadFailed', { message: error }) })));
|
|
1874
|
+
// loading 用中心区域骨架(流内行),不用整页 Skeleton——本组件位于
|
|
1875
|
+
// at-center 槽位,整页骨架会嵌套出第二个工作台并干扰容器查询。
|
|
1876
|
+
if (loading && !people) {
|
|
1877
|
+
return h('div', { className: 'at-stream', role: 'status', 'aria-busy': 'true' },
|
|
1878
|
+
h('div', { className: 'at-streaminner' },
|
|
1879
|
+
h('div', { className: 'at-skel at-skel-line', style: { width: '40%' } }),
|
|
1880
|
+
h('div', { className: 'at-skel at-skel-line', style: { width: '70%' } }),
|
|
1881
|
+
h('div', { className: 'at-skel at-skel-line', style: { width: '55%' } })));
|
|
1882
|
+
}
|
|
1883
|
+
if (!people || people.length === 0) return h('div', { className: 'at-stream', role: 'region', 'aria-label': t('peopleTitle') },
|
|
1884
|
+
h('div', { className: 'at-streaminner' }, h(EmptyState, { t, icon: 'layers', title: t('peopleTitle'), body: t('peopleEmpty') })));
|
|
1885
|
+
return h('div', { className: 'at-stream', role: 'region', 'aria-label': t('peopleTitle') },
|
|
1886
|
+
h('div', { className: 'at-streaminner' },
|
|
1887
|
+
h('div', { className: 'at-peoplehead' },
|
|
1888
|
+
h('span', { className: 'at-peoplecount' }, loading ? t('loading') : tf(t, 'peopleProjects', { n: people.length })),
|
|
1889
|
+
h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: onRefresh, disabled: loading }, t('refresh'))),
|
|
1890
|
+
people.map((person) => {
|
|
1891
|
+
const badges = [
|
|
1892
|
+
tf(t, 'peopleProjects', { n: person.projects.length }),
|
|
1893
|
+
tf(t, 'peopleActiveTasks', { n: person.activeTasks }),
|
|
1894
|
+
];
|
|
1895
|
+
if (person.failures > 0) badges.push(tf(t, 'peopleFailure', { n: person.failures }));
|
|
1896
|
+
return h('details', { key: person.name, className: cx('at-people', person.failures > 0 && 'at-people-failed') },
|
|
1897
|
+
h('summary', { className: 'at-peoplesum' },
|
|
1898
|
+
h(Avatar, { name: person.name, human: false }),
|
|
1899
|
+
h('span', { className: 'at-peoplename' }, person.name),
|
|
1900
|
+
person.role ? h('span', { className: 'at-people-role' }, person.role) : null,
|
|
1901
|
+
h('span', { className: 'at-peoplebadges' }, badges.join(' · '))),
|
|
1902
|
+
h('div', { className: 'at-peopleprojects' }, person.projects.map((row) => {
|
|
1903
|
+
const failed = row.lastFailure !== undefined && row.lastFailure !== null;
|
|
1904
|
+
const localHere = localNames.has(person.name);
|
|
1905
|
+
return h('div', { key: row.projectId, className: 'at-peopleproject' },
|
|
1906
|
+
h('span', { className: 'at-peopleprojectname' }, row.projectName),
|
|
1907
|
+
row.talentPool
|
|
1908
|
+
? h('span', { className: 'at-peoplestate' }, t('talentPool'))
|
|
1909
|
+
: h('span', { className: 'at-peoplestate' }, t(AGENT_STATUS[row.status] ?? 'agentIdle')),
|
|
1910
|
+
h('span', { className: 'at-peopletasks' }, tf(t, 'peopleActiveTasks', { n: row.activeTasks })),
|
|
1911
|
+
failed ? h('span', { className: 'at-peoplefail', title: row.lastFailure.message ?? '' }, tf(t, 'peopleFailure', { n: 1 }) + ' · ' + failureHuman(t, row.lastFailure.category)) : null,
|
|
1912
|
+
// R-03 入口统一:在本项目内才能直达资料/私信(跨项目先切项目)。
|
|
1913
|
+
localHere ? h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: () => onOpenPerson(person.name) }, t('memberProfileTitle')) : null,
|
|
1914
|
+
localHere ? h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: () => onChatPerson(person.name) }, t('agentChat')) : null,
|
|
1915
|
+
h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: () => onOpenProject(row.projectId) }, t('peopleOpenProject')));
|
|
1916
|
+
})));
|
|
1917
|
+
})));
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
/**
|
|
1921
|
+
* R-01 onboarding 三步(空项目主对话内嵌):设目录 → 认识成员 → 第一
|
|
1922
|
+
* 句话。完成态存会话内,不做持久化(避免新增存储)。
|
|
1923
|
+
*/
|
|
1924
|
+
function Onboarding({ t, project, agents, onSetWorkspace, onExample }) {
|
|
1925
|
+
const step1Done = Boolean(project?.workspacePath);
|
|
1926
|
+
const step2Done = agents.length > 0;
|
|
1927
|
+
const step = (mark, done, label, action) => h('div', { className: cx('at-obstep', done && 'at-obdone') },
|
|
1928
|
+
h('span', { className: 'at-obmark', 'aria-hidden': 'true' }, done ? '✓' : mark),
|
|
1929
|
+
h('span', { className: 'at-oblabel' }, label),
|
|
1930
|
+
action ?? null);
|
|
1931
|
+
return h('div', { className: 'at-onboard', role: 'group', 'aria-label': t('obTitle') },
|
|
1932
|
+
h('div', { className: 'at-onboardtitle' }, t('obTitle')),
|
|
1933
|
+
step('1', step1Done, t(step1Done ? 'obStep1Done' : 'obStep1'),
|
|
1934
|
+
!step1Done ? h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: onSetWorkspace }, t('workspaceChoose')) : null),
|
|
1935
|
+
step('2', step2Done, t('obStep2')),
|
|
1936
|
+
step('3', false, t('obStep3'),
|
|
1937
|
+
h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: onExample }, t('obFill'))));
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1787
1940
|
function MemberView({ t, agent, tasks, onBack, onOpenTask, onOpenChat, onOpenProfile }) {
|
|
1788
1941
|
const recentTasks = tasks.slice().sort((left, right) => (right.number ?? 0) - (left.number ?? 0)).slice(0, 3);
|
|
1789
1942
|
return h('div', { className: 'at-memberview' },
|
|
@@ -1819,7 +1972,7 @@ window.__ModuleLoader__.load({
|
|
|
1819
1972
|
: h(EmptyState, { t, title: t('memberNoTasks'), body: t('memberNoTasksBody'), compact: true })));
|
|
1820
1973
|
}
|
|
1821
1974
|
|
|
1822
|
-
function LeftPanel({ t, data, projectId, scope, tab, inboxUnread, onBack, onInbox, onBoard, onProject, onNewProject, onAgent, onAgentMore, onAgentChat, onAddAgent, onRecruit }) {
|
|
1975
|
+
function LeftPanel({ t, data, projectId, scope, tab, inboxUnread, onBack, onInbox, onBoard, onPeople, peopleActive, onProject, onNewProject, onAgent, onAgentMore, onAgentChat, onAddAgent, onRecruit }) {
|
|
1823
1976
|
const projects = data.projects.filter((project) => !project.archived);
|
|
1824
1977
|
const activeAgents = data.agents.filter((agent) => agent.status !== 'retired');
|
|
1825
1978
|
const talentAgents = data.agents.filter((agent) => agent.status === 'retired');
|
|
@@ -1827,7 +1980,7 @@ window.__ModuleLoader__.load({
|
|
|
1827
1980
|
const boardActive = scope === 'project' && tab === 'board';
|
|
1828
1981
|
return h('div', null,
|
|
1829
1982
|
h('nav', { className: 'at-nav', 'aria-label': t('navAria') },
|
|
1830
|
-
h('button', { className: 'at-navrow', type: 'button', onClick: onBack }, h(Ico, { name: 'back' }), h('span', null, t('
|
|
1983
|
+
h('button', { className: 'at-navrow', type: 'button', onClick: onBack }, h(Ico, { name: 'back' }), h('span', null, t('navHome'))),
|
|
1831
1984
|
h('button', {
|
|
1832
1985
|
className: cx('at-navrow', scope === 'inbox' && 'at-on'),
|
|
1833
1986
|
type: 'button',
|
|
@@ -1841,6 +1994,12 @@ window.__ModuleLoader__.load({
|
|
|
1841
1994
|
'aria-current': boardActive ? 'page' : undefined,
|
|
1842
1995
|
onClick: onBoard,
|
|
1843
1996
|
}, h(Ico, { name: 'board' }), h('span', null, t('board'))),
|
|
1997
|
+
h('button', {
|
|
1998
|
+
className: cx('at-navrow', peopleActive && 'at-on'),
|
|
1999
|
+
type: 'button',
|
|
2000
|
+
'aria-current': peopleActive ? 'page' : undefined,
|
|
2001
|
+
onClick: onPeople,
|
|
2002
|
+
}, h(Ico, { name: 'layers' }), h('span', null, t('people'))),
|
|
1844
2003
|
),
|
|
1845
2004
|
h('div', { className: 'at-h' },
|
|
1846
2005
|
h('span', null, t('projects')),
|
|
@@ -1865,7 +2024,7 @@ window.__ModuleLoader__.load({
|
|
|
1865
2024
|
onSelect: onProject,
|
|
1866
2025
|
})))) : null,
|
|
1867
2026
|
h('div', { className: 'at-h' },
|
|
1868
|
-
h('span',
|
|
2027
|
+
h('span', { title: t('agentsScope') }, t('agentsScope')),
|
|
1869
2028
|
h('button', { className: 'at-mini', type: 'button', 'aria-label': t('addAgent'), title: t('addAgent'), onClick: onAddAgent }, h(Ico, { name: 'plus', size: 12 })),
|
|
1870
2029
|
),
|
|
1871
2030
|
activeAgents.length
|
|
@@ -1959,15 +2118,14 @@ window.__ModuleLoader__.load({
|
|
|
1959
2118
|
}, task.irreversible ? t('acceptIrreversibleCta') : t('acceptCta'))));
|
|
1960
2119
|
}
|
|
1961
2120
|
|
|
1962
|
-
function ConflictBanner({ t, thread, baseSeq, headSeq, onContinue
|
|
2121
|
+
function ConflictBanner({ t, thread, baseSeq, headSeq, onContinue }) {
|
|
1963
2122
|
const changes = Array.isArray(thread?.changes) ? thread.changes.slice(0, 5) : [];
|
|
1964
2123
|
return h('div', { className: 'at-conflict', role: 'alert' },
|
|
1965
2124
|
h('div', { className: 'at-conflicttitle' }, t('conflictTitle')),
|
|
1966
2125
|
h('div', { className: 'at-conflictnew' }, tf(t, 'conflictNew', { head: headSeq, n: headSeq - baseSeq })),
|
|
1967
2126
|
changes.length ? h('ul', { className: 'at-conflictlist' }, changes.map((change) => h('li', { key: (change.seq ?? '') + ':' + (change.what ?? '') }, (change.who ?? '—') + ' #' + (change.seq ?? '') + ' ' + (change.what ?? '')))) : null,
|
|
1968
2127
|
h('div', { className: 'at-conflictactions' },
|
|
1969
|
-
h('button', { className: 'at-btn at-btn-quiet', type: 'button', onClick: onContinue }, t('conflictContinue'))
|
|
1970
|
-
h('button', { className: 'at-btn at-btn-quiet', type: 'button', onClick: onContext }, t('conflictContext'))));
|
|
2128
|
+
h('button', { className: 'at-btn at-btn-quiet', type: 'button', onClick: onContinue }, t('conflictContinue'))));
|
|
1971
2129
|
}
|
|
1972
2130
|
|
|
1973
2131
|
function DoneSummary({ t, task }) {
|
|
@@ -2000,7 +2158,7 @@ window.__ModuleLoader__.load({
|
|
|
2000
2158
|
h('div', { className: 'at-kvbody' }, task.updatedAt ? fmtDateTime(task.updatedAt) : '—'))));
|
|
2001
2159
|
}
|
|
2002
2160
|
|
|
2003
|
-
function ThreadPanel({ t, task, thread, project, following, onToggleFollow, onClose, onChat, converting, convert, reply, onReplyChange, onReplySend, replyBase, onContinue,
|
|
2161
|
+
function ThreadPanel({ t, task, thread, project, following, onToggleFollow, onClose, onChat, converting, convert, reply, onReplyChange, onReplySend, replyBase, onContinue, note, onDismissNote, acceptChecked, onAcceptChecked, qaChecks, onQaCheck, onAccept, onChanges, actions, panelRef, replyRef, taskEventsData }) {
|
|
2004
2162
|
const headSeq = thread?.headSeq ?? thread?.entries?.length ?? 0;
|
|
2005
2163
|
const stale = replyBase !== null && replyBase !== undefined && headSeq > replyBase;
|
|
2006
2164
|
const entries = Array.isArray(thread?.entries) ? thread.entries : [];
|
|
@@ -2019,7 +2177,7 @@ window.__ModuleLoader__.load({
|
|
|
2019
2177
|
converting
|
|
2020
2178
|
? h(ConvertForm, { t, project, task, thread, title: convert.title, dod: convert.dod, onTitle: convert.onTitle, onDod: convert.onDod, onCancel: convert.onCancel, onSubmit: convert.onSubmit })
|
|
2021
2179
|
: h('div', { className: 'at-rbody' },
|
|
2022
|
-
stale ? h(ConflictBanner, { t, thread, baseSeq: replyBase, headSeq, onContinue
|
|
2180
|
+
stale ? h(ConflictBanner, { t, thread, baseSeq: replyBase, headSeq, onContinue }) : null,
|
|
2023
2181
|
task.status === 'done' ? h(DoneSummary, { t, task }) : h(TaskDetail, { t, task }),
|
|
2024
2182
|
entries.length
|
|
2025
2183
|
? h('div', { className: 'at-tmsgs' }, entries.map((message, index) => h('div', { key: message.seq ?? index, className: 'at-tmsg' },
|
|
@@ -2048,6 +2206,13 @@ window.__ModuleLoader__.load({
|
|
|
2048
2206
|
type: 'button',
|
|
2049
2207
|
onClick: action.onClick,
|
|
2050
2208
|
}, action.label)))) : null),
|
|
2209
|
+
// R-18 可追溯入口:这条任务的账本事件时间序。
|
|
2210
|
+
taskEventsData && taskEventsData.taskId === task.id ? h('details', { className: 'at-events' },
|
|
2211
|
+
h('summary', { className: 'at-actiontitle' }, t('eventHistoryTitle') + ' · ' + taskEventsData.events.length),
|
|
2212
|
+
h('div', { className: 'at-peopleprojects' }, taskEventsData.events.map((event) => h('div', { key: event.seq, className: 'at-peopleproject' },
|
|
2213
|
+
h('span', { className: 'at-peopleprojectname' }, '#' + event.seq),
|
|
2214
|
+
h('span', { className: 'at-peoplestate' }, event.type),
|
|
2215
|
+
h('span', { className: 'at-peopletasks' }, fmtTime(event.at) + actorSuffix(event.actor)))))) : null,
|
|
2051
2216
|
!converting ? h('div', { className: 'at-rfoot' },
|
|
2052
2217
|
h('div', { className: 'at-box at-rbox' },
|
|
2053
2218
|
h('textarea', {
|
|
@@ -2069,7 +2234,7 @@ window.__ModuleLoader__.load({
|
|
|
2069
2234
|
h('button', { className: 'at-send', type: 'button', disabled: !reply.trim(), onClick: onReplySend }, t('send'))))) : null);
|
|
2070
2235
|
}
|
|
2071
2236
|
|
|
2072
|
-
function Composer({ t, mode, draft, definition, qaChecklist, disabled, qaRequired, onQaRequired, onDefinition, onQaChecklist, onMode, onDraft, onSend }) {
|
|
2237
|
+
function Composer({ t, mode, draft, definition, qaChecklist, disabled, qaRequired, onQaRequired, onDefinition, onQaChecklist, onMode, onDraft, onSend, inputRef }) {
|
|
2073
2238
|
const send = () => {
|
|
2074
2239
|
if (!draft.trim() || disabled) return;
|
|
2075
2240
|
if (mode === 'task' && (!definition.trim() || (qaRequired && !qaChecklist.trim()))) return;
|
|
@@ -2077,8 +2242,9 @@ window.__ModuleLoader__.load({
|
|
|
2077
2242
|
};
|
|
2078
2243
|
return h('div', { className: 'at-composer' },
|
|
2079
2244
|
h('div', { className: 'at-composerinner' },
|
|
2080
|
-
h('div', { className: cx('at-box',
|
|
2245
|
+
h('div', { className: cx('at-box', mode === 'task' && 'at-taskmode') },
|
|
2081
2246
|
h('textarea', {
|
|
2247
|
+
ref: inputRef,
|
|
2082
2248
|
value: draft,
|
|
2083
2249
|
rows: 2,
|
|
2084
2250
|
disabled,
|
|
@@ -2181,10 +2347,23 @@ window.__ModuleLoader__.load({
|
|
|
2181
2347
|
}
|
|
2182
2348
|
|
|
2183
2349
|
function Situation({ t, quadrants, tasks, onItem, onViewAll }) {
|
|
2350
|
+
if (!quadrants) {
|
|
2351
|
+
return h('div', { className: 'at-situation', role: 'tabpanel', id: 'at-panel-situation', 'aria-labelledby': 'at-tab-situation' },
|
|
2352
|
+
h('div', { className: 'at-situationinner' },
|
|
2353
|
+
h(EmptyState, { t, icon: 'dot', title: t('situationAria'), body: '' })));
|
|
2354
|
+
}
|
|
2355
|
+
// R-04:「团队安静」与「团队停滞」必须是两种语感——安静是健康,
|
|
2356
|
+
// 停滞(等你/等验收/受阻)是要处理的事。
|
|
2357
|
+
const needsYou = quadrants.q1.count + quadrants.q3.count;
|
|
2358
|
+
const mood = needsYou > 0
|
|
2359
|
+
? tf(t, 'teamNeedsYou', { n: needsYou })
|
|
2360
|
+
: quadrants.q2.count > 0
|
|
2361
|
+
? tf(t, 'teamBusy', { n: quadrants.q2.count })
|
|
2362
|
+
: t('teamQuiet');
|
|
2184
2363
|
return h('div', { className: 'at-situation', role: 'tabpanel', id: 'at-panel-situation', 'aria-labelledby': 'at-tab-situation' },
|
|
2185
2364
|
h('div', { className: 'at-situationinner' },
|
|
2186
2365
|
h('div', { className: 'at-qmeta' },
|
|
2187
|
-
h('span', null, tf(t, 'quadrantMeta', { time: fmtTime(quadrants.generatedAt) })),
|
|
2366
|
+
h('span', null, mood + ' · ' + tf(t, 'quadrantMeta', { time: fmtTime(quadrants.generatedAt) })),
|
|
2188
2367
|
quadrants.rev ? h('span', null, 'rev ' + quadrants.rev) : null),
|
|
2189
2368
|
h('div', { className: 'at-quadrants' }, QUADRANTS.map((quadrant) => {
|
|
2190
2369
|
const block = quadrants[quadrant.key] ?? { count: 0, items: [] };
|
|
@@ -2285,6 +2464,7 @@ window.__ModuleLoader__.load({
|
|
|
2285
2464
|
function Workbench({ t, ctx }) {
|
|
2286
2465
|
const [phase, setPhase] = React.useState('loading');
|
|
2287
2466
|
const [data, setData] = React.useState(null);
|
|
2467
|
+
const [loadError, setLoadError] = React.useState('');
|
|
2288
2468
|
const [projectId, setProjectId] = React.useState('');
|
|
2289
2469
|
const [scope, setScope] = React.useState('project');
|
|
2290
2470
|
const [tab, setTab] = React.useState('main');
|
|
@@ -2338,68 +2518,165 @@ window.__ModuleLoader__.load({
|
|
|
2338
2518
|
const [workspaceError, setWorkspaceError] = React.useState('');
|
|
2339
2519
|
const [workspaceBusy, setWorkspaceBusy] = React.useState(false);
|
|
2340
2520
|
const [memberViewId, setMemberViewId] = React.useState(null);
|
|
2521
|
+
// 人员池(全局层):进入该 scope 时拉取一次聚合视图。
|
|
2522
|
+
const [peopleData, setPeopleData] = React.useState(null);
|
|
2523
|
+
const [peopleError, setPeopleError] = React.useState('');
|
|
2524
|
+
const [peopleLoading, setPeopleLoading] = React.useState(false);
|
|
2525
|
+
// 人员池拉取序号:并发/乱序响应只认最新一次。
|
|
2526
|
+
const peopleSeqRef = React.useRef(0);
|
|
2527
|
+
// 风险清单(R-07):进入收件箱时拉取当前项目三类风险。
|
|
2528
|
+
const [risksData, setRisksData] = React.useState(null);
|
|
2529
|
+
// R-18 任务事件历史。
|
|
2530
|
+
const [taskEventsData, setTaskEventsData] = React.useState(null);
|
|
2531
|
+
const riskSeqRef = React.useRef(0);
|
|
2532
|
+
// R-18 任务事件历史(只读)。
|
|
2533
|
+
function openTaskEvents(taskId) {
|
|
2534
|
+
fetch(`/ai-team/api/projects/${encodeURIComponent(projectId || '')}/tasks/${encodeURIComponent(taskId)}/events`, { headers: { accept: 'application/json' } })
|
|
2535
|
+
.then(async (response) => {
|
|
2536
|
+
const payload = await response.json().catch(() => null);
|
|
2537
|
+
if (!response.ok) throw new Error(payload?.error?.message ?? ('HTTP ' + response.status));
|
|
2538
|
+
setTaskEventsData({ taskId, events: payload.events ?? [] });
|
|
2539
|
+
})
|
|
2540
|
+
.catch(() => setTaskEventsData(null));
|
|
2541
|
+
}
|
|
2542
|
+
// R-09 待验收跨项目队列。
|
|
2543
|
+
const [pendingRows, setPendingRows] = React.useState(null);
|
|
2544
|
+
function loadPending() {
|
|
2545
|
+
fetch('/ai-team/api/pending-acceptance', { headers: { accept: 'application/json' } })
|
|
2546
|
+
.then(async (response) => {
|
|
2547
|
+
const payload = await response.json().catch(() => null);
|
|
2548
|
+
if (!response.ok) throw new Error(payload?.error?.message ?? ('HTTP ' + response.status));
|
|
2549
|
+
setPendingRows(Array.isArray(payload?.rows) ? payload.rows : []);
|
|
2550
|
+
})
|
|
2551
|
+
.catch(() => setPendingRows([]));
|
|
2552
|
+
}
|
|
2553
|
+
function loadRisks() {
|
|
2554
|
+
const seq = ++riskSeqRef.current;
|
|
2555
|
+
setPeopleLoading(true);
|
|
2556
|
+
fetch('/ai-team/api/risks' + (projectId ? '?project=' + encodeURIComponent(projectId) : ''), { headers: { accept: 'application/json' } })
|
|
2557
|
+
.then(async (response) => {
|
|
2558
|
+
const payload = await response.json().catch(() => null);
|
|
2559
|
+
if (!response.ok) throw new Error(payload?.error?.message ?? ('HTTP ' + response.status));
|
|
2560
|
+
if (seq !== riskSeqRef.current) return;
|
|
2561
|
+
setRisksData(payload?.risks ?? null);
|
|
2562
|
+
})
|
|
2563
|
+
.catch(() => { if (seq === riskSeqRef.current) setRisksData(null); })
|
|
2564
|
+
.finally(() => { if (seq === riskSeqRef.current) setPeopleLoading(false); });
|
|
2565
|
+
}
|
|
2566
|
+
// 最新 scope 镜像:SSE 回调在 effect 闭包里拿不到最新值。
|
|
2567
|
+
const scopeRef = React.useRef(scope);
|
|
2568
|
+
scopeRef.current = scope;
|
|
2341
2569
|
const [nBusy, setNBusy] = React.useState(false);
|
|
2342
2570
|
const [nError, setNError] = React.useState('');
|
|
2343
2571
|
const [pSuccessor, setPSuccessor] = React.useState('');
|
|
2344
2572
|
const [pBusy, setPBusy] = React.useState(false);
|
|
2345
2573
|
const [pError, setPError] = React.useState('');
|
|
2346
2574
|
const [replyBase, setReplyBase] = React.useState(null);
|
|
2575
|
+
// R-06 决策回流高亮:主对话中被指认的 stream 消息 id。
|
|
2576
|
+
const [streamHighlight, setStreamHighlight] = React.useState(null);
|
|
2577
|
+
// 自绘确认/输入对话框(替代原生 prompt/confirm,观感与宿主一致)。
|
|
2578
|
+
// dialog: { mode: 'confirm'|'prompt'|'choice', title, body, placeholder,
|
|
2579
|
+
// value, options, resolve } — resolve(false|null|字符串)。
|
|
2580
|
+
const [dialog, setDialog] = React.useState(null);
|
|
2581
|
+
const dialogSeqRef = React.useRef(0);
|
|
2582
|
+
// 每次打开新对话框自增 key:WorkbenchDialog 以全新实例挂载,
|
|
2583
|
+
// 输入框的初始值(useState 初值)随之生效。
|
|
2584
|
+
const askConfirm = (title, body) => new Promise((resolve) => {
|
|
2585
|
+
dialogSeqRef.current += 1;
|
|
2586
|
+
setDialog({ mode: 'confirm', title, body, resolve });
|
|
2587
|
+
});
|
|
2588
|
+
const askPrompt = (title, { placeholder = '', value = '', options = null } = {}) => new Promise((resolve) => {
|
|
2589
|
+
dialogSeqRef.current += 1;
|
|
2590
|
+
setDialog({
|
|
2591
|
+
mode: options === null ? 'prompt' : 'choice',
|
|
2592
|
+
title,
|
|
2593
|
+
placeholder,
|
|
2594
|
+
value: value ?? (options && options.length > 0 ? options[0] : ''),
|
|
2595
|
+
options,
|
|
2596
|
+
resolve,
|
|
2597
|
+
});
|
|
2598
|
+
});
|
|
2347
2599
|
const rightRef = React.useRef(null);
|
|
2348
2600
|
const replyRef = React.useRef(null);
|
|
2349
2601
|
const triggerRef = React.useRef(null);
|
|
2350
2602
|
const mobileRef = React.useRef(null);
|
|
2603
|
+
// R-08 快捷键:composer 聚焦句柄 + `?` 帮助浮层开关。
|
|
2604
|
+
const composerInputRef = React.useRef(null);
|
|
2605
|
+
const [shortcutsOpen, setShortcutsOpen] = React.useState(false);
|
|
2606
|
+
const gPrefixRef = React.useRef(0);
|
|
2607
|
+
// Latest-data mirror for effects that must react to `selected` alone,
|
|
2608
|
+
// and a monotonically increasing load sequence so a stale bootstrap
|
|
2609
|
+
// response can never overwrite a newer one.
|
|
2610
|
+
const dataRef = React.useRef(null);
|
|
2611
|
+
const loadSeqRef = React.useRef(0);
|
|
2612
|
+
const applyData = (next) => {
|
|
2613
|
+
dataRef.current = next;
|
|
2614
|
+
setData(next);
|
|
2615
|
+
};
|
|
2351
2616
|
|
|
2352
2617
|
React.useEffect(() => {
|
|
2353
2618
|
let alive = true;
|
|
2354
2619
|
const controller = typeof AbortController === 'function' ? new AbortController() : null;
|
|
2355
2620
|
// The package is @suifei/dsh-ai-team; the Host prefix is /ai-team.
|
|
2356
2621
|
const query = projectId ? '?project=' + encodeURIComponent(projectId) : '';
|
|
2357
|
-
const paths = ['/ai-team/api/bootstrap' + query];
|
|
2358
2622
|
async function load() {
|
|
2623
|
+
const seq = ++loadSeqRef.current;
|
|
2359
2624
|
let lastError = null;
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2625
|
+
try {
|
|
2626
|
+
const response = await fetch('/ai-team/api/bootstrap' + query, {
|
|
2627
|
+
headers: { accept: 'application/json' },
|
|
2628
|
+
signal: controller ? controller.signal : undefined,
|
|
2629
|
+
});
|
|
2630
|
+
if (!response.ok) throw new Error('HTTP ' + response.status + ' for /ai-team/api/bootstrap');
|
|
2631
|
+
const next = normalizePayload(await response.json());
|
|
2632
|
+
if (!next) throw new Error('invalid bootstrap payload');
|
|
2633
|
+
if (!alive || seq !== loadSeqRef.current) return;
|
|
2634
|
+
applyData(next);
|
|
2635
|
+
setLoadError('');
|
|
2636
|
+
setPhase('ready');
|
|
2637
|
+
return;
|
|
2638
|
+
} catch (error) {
|
|
2639
|
+
lastError = error;
|
|
2640
|
+
if (!alive || (controller && controller.signal.aborted)) return;
|
|
2641
|
+
}
|
|
2642
|
+
if (seq !== loadSeqRef.current) return;
|
|
2643
|
+
// First load: an honest error state with retry. Refresh failure:
|
|
2644
|
+
// keep the current data, only record the diagnostic.
|
|
2645
|
+
if (dataRef.current === null) {
|
|
2646
|
+
console.error(PKG + ': bootstrap unavailable', lastError);
|
|
2647
|
+
setLoadError(lastError?.message ?? String(lastError ?? 'unknown'));
|
|
2648
|
+
setPhase('error');
|
|
2649
|
+
} else {
|
|
2650
|
+
console.error(PKG + ': bootstrap refresh failed, keeping current data', lastError);
|
|
2383
2651
|
}
|
|
2384
|
-
if (!alive) return;
|
|
2385
|
-
console.error(PKG + ': bootstrap unavailable, using embedded demo data', lastError);
|
|
2386
|
-
setData(MOCK);
|
|
2387
|
-
setPhase('fallback');
|
|
2388
2652
|
}
|
|
2389
2653
|
load();
|
|
2390
2654
|
// Event-driven refresh only; the Host sends one frame per command and
|
|
2391
|
-
// no heartbeat/timer. EventSource reconnects on its own
|
|
2392
|
-
|
|
2393
|
-
|
|
2655
|
+
// no heartbeat/timer. EventSource reconnects on its own; a project is
|
|
2656
|
+
// required — no magic fallback id here.
|
|
2657
|
+
const source = typeof EventSource === 'function' && projectId
|
|
2658
|
+
? new EventSource('/ai-team/api/projects/' + encodeURIComponent(projectId) + '/events')
|
|
2394
2659
|
: null;
|
|
2395
|
-
if (source)
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2660
|
+
if (source) {
|
|
2661
|
+
source.addEventListener('change', (raw) => {
|
|
2662
|
+
if (!alive) return;
|
|
2663
|
+
try {
|
|
2664
|
+
const frame = JSON.parse(raw.data);
|
|
2665
|
+
pushToast(notificationText(frame?.event));
|
|
2666
|
+
} catch (error) {
|
|
2667
|
+
console.error(PKG + ': malformed SSE frame', error);
|
|
2668
|
+
}
|
|
2669
|
+
// R-05:人员池驻留时,任何团队变化都触发重拉(无定时器,
|
|
2670
|
+
// 事件驱动刷新——与宿主 SSE 合帧节奏一致)。
|
|
2671
|
+
if (scopeRef.current === 'people') loadPeople();
|
|
2672
|
+
load();
|
|
2673
|
+
});
|
|
2674
|
+
source.addEventListener('error', () => {
|
|
2675
|
+
// One-shot diagnostic: EventSource reconnects by itself; this row
|
|
2676
|
+
// only makes the console explain why the panel may lag behind.
|
|
2677
|
+
if (alive && dataRef.current === null) console.error(PKG + ': event stream unavailable (retrying)');
|
|
2678
|
+
});
|
|
2679
|
+
}
|
|
2403
2680
|
return () => {
|
|
2404
2681
|
alive = false;
|
|
2405
2682
|
if (controller) controller.abort();
|
|
@@ -2441,17 +2718,21 @@ window.__ModuleLoader__.load({
|
|
|
2441
2718
|
if (!selected && data.tasks[0]) setSelected(data.tasks[0].id);
|
|
2442
2719
|
}, [data, projectId, selected]);
|
|
2443
2720
|
|
|
2721
|
+
// Reset the right-panel editing state only when the selected Task
|
|
2722
|
+
// changes — a background refresh (SSE) must never wipe a draft the
|
|
2723
|
+
// user is typing or QA boxes they already ticked.
|
|
2444
2724
|
React.useEffect(() => {
|
|
2445
|
-
const
|
|
2725
|
+
const current = dataRef.current;
|
|
2726
|
+
const thread = threadFor(current, selected);
|
|
2446
2727
|
setReplyBase(thread?.baseSeq ?? null);
|
|
2447
2728
|
setAcceptChecked(false);
|
|
2448
|
-
const nextTask =
|
|
2729
|
+
const nextTask = current?.tasks?.find((task) => task.id === selected) ?? current?.tasks?.[0];
|
|
2449
2730
|
setQaChecks((nextTask?.qaChecklist ?? []).map((item) => ({ item, passed: false })));
|
|
2450
2731
|
setConverting(false);
|
|
2451
2732
|
setCTitle('');
|
|
2452
2733
|
setCDod('');
|
|
2453
2734
|
setRightNote('');
|
|
2454
|
-
}, [selected
|
|
2735
|
+
}, [selected]);
|
|
2455
2736
|
|
|
2456
2737
|
React.useEffect(() => {
|
|
2457
2738
|
if (!threadOpen) return;
|
|
@@ -2472,6 +2753,10 @@ window.__ModuleLoader__.load({
|
|
|
2472
2753
|
if (!threadOpen) return undefined;
|
|
2473
2754
|
const onKey = (event) => {
|
|
2474
2755
|
if (event.key !== 'Escape') return;
|
|
2756
|
+
// Host overlays handle Escape first (defaultPrevented); don't swallow.
|
|
2757
|
+
if (event.defaultPrevented) return;
|
|
2758
|
+
// 插件自身的模态(确认/表单)是更上层:让位,先关模态。
|
|
2759
|
+
if (MODAL_STACK.length > 0) return;
|
|
2475
2760
|
event.preventDefault();
|
|
2476
2761
|
event.stopPropagation();
|
|
2477
2762
|
if (converting) { setConverting(false); return; }
|
|
@@ -2481,6 +2766,51 @@ window.__ModuleLoader__.load({
|
|
|
2481
2766
|
return () => window.removeEventListener('keydown', onKey);
|
|
2482
2767
|
}, [threadOpen, converting]);
|
|
2483
2768
|
|
|
2769
|
+
// R-08 快捷键体系(渐进增强):`g` 前缀导航(i 收件箱 / b 看板 /
|
|
2770
|
+
// p 人员 / c 对话)、`/` 聚焦 composer、`?` 帮助浮层。规则:
|
|
2771
|
+
// ① 焦点在输入控件时旁路;② 模态栈非空时让位;③ 序列窗口 600ms。
|
|
2772
|
+
React.useEffect(() => {
|
|
2773
|
+
const onKey = (event) => {
|
|
2774
|
+
if (event.defaultPrevented || event.ctrlKey || event.metaKey || event.altKey) return;
|
|
2775
|
+
const tag = document.activeElement?.tagName;
|
|
2776
|
+
if (tag === 'INPUT' || tag === 'TEXTAREA' || tag === 'SELECT') return;
|
|
2777
|
+
if (MODAL_STACK.length > 0) return;
|
|
2778
|
+
if (event.key === '/') {
|
|
2779
|
+
event.preventDefault();
|
|
2780
|
+
event.stopPropagation();
|
|
2781
|
+
if (composerInputRef.current && typeof composerInputRef.current.focus === 'function') composerInputRef.current.focus();
|
|
2782
|
+
return;
|
|
2783
|
+
}
|
|
2784
|
+
if (event.key === '?') {
|
|
2785
|
+
event.preventDefault();
|
|
2786
|
+
event.stopPropagation();
|
|
2787
|
+
setShortcutsOpen(true);
|
|
2788
|
+
return;
|
|
2789
|
+
}
|
|
2790
|
+
if (event.key.toLowerCase() !== 'g') return;
|
|
2791
|
+
if (Date.now() - gPrefixRef.current > 600) {
|
|
2792
|
+
gPrefixRef.current = Date.now();
|
|
2793
|
+
return;
|
|
2794
|
+
}
|
|
2795
|
+
gPrefixRef.current = 0;
|
|
2796
|
+
const key = event.key.toLowerCase();
|
|
2797
|
+
if (key === 'i') { event.preventDefault(); switchInbox(); }
|
|
2798
|
+
else if (key === 'b') { event.preventDefault(); switchBoard(); }
|
|
2799
|
+
else if (key === 'p') { event.preventDefault(); openPeople(); }
|
|
2800
|
+
else if (key === 'c') { event.preventDefault(); goConversation(); }
|
|
2801
|
+
};
|
|
2802
|
+
window.addEventListener('keydown', onKey);
|
|
2803
|
+
return () => window.removeEventListener('keydown', onKey);
|
|
2804
|
+
}, []);
|
|
2805
|
+
|
|
2806
|
+
if (phase === 'error' && !data) {
|
|
2807
|
+
return h('div', { className: 'at-root', role: 'alert' },
|
|
2808
|
+
h('div', { className: 'at-empty' },
|
|
2809
|
+
h('span', { className: 'at-emptyicon', 'aria-hidden': 'true' }, h(Ico, { name: 'alert', size: 28 })),
|
|
2810
|
+
h('div', { className: 'at-emptytitle' }, t('loadFailedTitle')),
|
|
2811
|
+
h('div', { className: 'at-emptybody' }, loadError || t('loadFailedBody')),
|
|
2812
|
+
h('button', { className: 'at-btn', type: 'button', onClick: () => { setPhase('loading'); location.reload(); } }, t('retry'))));
|
|
2813
|
+
}
|
|
2484
2814
|
if (phase === 'loading' || !data) return h(Skeleton, { t });
|
|
2485
2815
|
|
|
2486
2816
|
const projectRecord = data.projects.find((item) => item.id === projectId) ?? data.projects[0] ?? null;
|
|
@@ -2488,12 +2818,20 @@ window.__ModuleLoader__.load({
|
|
|
2488
2818
|
...projectRecord,
|
|
2489
2819
|
workspacePath: projectRecord.workspacePath || (data.project?.id === projectRecord.id ? data.project.workspacePath ?? '' : ''),
|
|
2490
2820
|
};
|
|
2821
|
+
const humanId = (data.members ?? []).find((member) => member.kind === 'human')?.id ?? null;
|
|
2491
2822
|
const tasks = data.tasks;
|
|
2492
2823
|
const boardTaskCount = tasks.filter((task) => ['pending', 'in_progress', 'pending_acceptance', 'done'].includes(task.status)).length;
|
|
2493
2824
|
const selectedTask = tasks.find((task) => task.id === selected) ?? tasks[0] ?? null;
|
|
2494
2825
|
const thread = threadFor(data, selectedTask?.id);
|
|
2495
2826
|
const quadrants = deriveQuadrants(data);
|
|
2496
2827
|
const inboxItems = (data.inbox ?? []).filter((item) => !isInformationalInboxItem(item));
|
|
2828
|
+
// R-13 老化分档(纯前端派生):决策项 >24h 加深、>72h 升错误色。
|
|
2829
|
+
const inboxAge = (item) => {
|
|
2830
|
+
const created = item.createdAt ?? 0;
|
|
2831
|
+
if (!Number.isFinite(created) || created <= 0) return '';
|
|
2832
|
+
const age = Date.now() - created;
|
|
2833
|
+
return age > 72 * 60 * 60 * 1000 ? 'at-inboxstale2' : age > 24 * 60 * 60 * 1000 ? 'at-inboxstale' : '';
|
|
2834
|
+
};
|
|
2497
2835
|
const inboxUnread = inboxItems.filter((item) => item.state === 'unread').length;
|
|
2498
2836
|
const q1Extra = inboxItems.filter((item) => item.requiresDecision === true && item.state === 'unread').length;
|
|
2499
2837
|
const threadHead = thread?.headSeq ?? thread?.entries?.length ?? 0;
|
|
@@ -2525,7 +2863,7 @@ window.__ModuleLoader__.load({
|
|
|
2525
2863
|
async function toggleFollow(card) {
|
|
2526
2864
|
if (!card) return;
|
|
2527
2865
|
const next = !followingOf(card);
|
|
2528
|
-
const text = next ? tf(t, '
|
|
2866
|
+
const text = next ? tf(t, 'followedTask', { n: taskNo(card) }) : tf(t, 'unfollowedTask', { n: taskNo(card) });
|
|
2529
2867
|
try {
|
|
2530
2868
|
await runCommand('task.follow', { taskId: card.id, following: next });
|
|
2531
2869
|
setFollows((prev) => ({ ...prev, [card.id]: next }));
|
|
@@ -2591,6 +2929,35 @@ window.__ModuleLoader__.load({
|
|
|
2591
2929
|
setScope('inbox');
|
|
2592
2930
|
setThreadOpen(false);
|
|
2593
2931
|
setNote('');
|
|
2932
|
+
loadPending();
|
|
2933
|
+
loadRisks();
|
|
2934
|
+
}
|
|
2935
|
+
function openPeople() {
|
|
2936
|
+
closeMobile();
|
|
2937
|
+
setMemberViewId(null);
|
|
2938
|
+
setScope('people');
|
|
2939
|
+
setThreadOpen(false);
|
|
2940
|
+
setNote('');
|
|
2941
|
+
loadPeople();
|
|
2942
|
+
}
|
|
2943
|
+
// R-05:可复用的拉取(页头刷新按钮与 toast 触发共用),序号守卫防乱序。
|
|
2944
|
+
function loadPeople() {
|
|
2945
|
+
const seq = ++peopleSeqRef.current;
|
|
2946
|
+
setPeopleLoading(true);
|
|
2947
|
+
setPeopleError('');
|
|
2948
|
+
fetch('/ai-team/api/people', { headers: { accept: 'application/json' } })
|
|
2949
|
+
.then(async (response) => {
|
|
2950
|
+
const payload = await response.json().catch(() => null);
|
|
2951
|
+
if (!response.ok) throw new Error(payload?.error?.message ?? ('HTTP ' + response.status));
|
|
2952
|
+
if (seq !== peopleSeqRef.current) return;
|
|
2953
|
+
setPeopleData(Array.isArray(payload?.people) ? payload.people : []);
|
|
2954
|
+
})
|
|
2955
|
+
.catch((error) => {
|
|
2956
|
+
if (seq === peopleSeqRef.current) setPeopleError(error?.message ?? String(error));
|
|
2957
|
+
})
|
|
2958
|
+
.finally(() => {
|
|
2959
|
+
if (seq === peopleSeqRef.current) setPeopleLoading(false);
|
|
2960
|
+
});
|
|
2594
2961
|
}
|
|
2595
2962
|
function switchBoard() {
|
|
2596
2963
|
closeMobile();
|
|
@@ -2601,7 +2968,7 @@ window.__ModuleLoader__.load({
|
|
|
2601
2968
|
}
|
|
2602
2969
|
async function switchProject(next) {
|
|
2603
2970
|
closeMobile();
|
|
2604
|
-
if (next.id === projectId && scope === 'project') return;
|
|
2971
|
+
if (next.id === projectId && scope === 'project') return true;
|
|
2605
2972
|
try {
|
|
2606
2973
|
await runCommand('project.activate', { projectId: next.id });
|
|
2607
2974
|
setScope('project');
|
|
@@ -2612,9 +2979,11 @@ window.__ModuleLoader__.load({
|
|
|
2612
2979
|
setReply('');
|
|
2613
2980
|
await reloadData(next.id);
|
|
2614
2981
|
setProjectId(next.id);
|
|
2615
|
-
say(next.archived ? t('
|
|
2982
|
+
say(next.archived ? t('archivedNote') : t('projectSwitched'));
|
|
2983
|
+
return true;
|
|
2616
2984
|
} catch (error) {
|
|
2617
2985
|
say(tf(t, 'sendFailed', { message: error?.message ?? String(error) }));
|
|
2986
|
+
return false;
|
|
2618
2987
|
}
|
|
2619
2988
|
}
|
|
2620
2989
|
function openNewProject() {
|
|
@@ -2716,15 +3085,17 @@ window.__ModuleLoader__.load({
|
|
|
2716
3085
|
buttons.forEach((button) => { if (button.dataset.tab === next) button.focus(); });
|
|
2717
3086
|
}
|
|
2718
3087
|
async function reloadData(forProject = projectId) {
|
|
3088
|
+
const seq = ++loadSeqRef.current;
|
|
2719
3089
|
const query = forProject ? '?project=' + encodeURIComponent(forProject) : '';
|
|
2720
3090
|
const response = await fetch('/ai-team/api/bootstrap' + query, { headers: { accept: 'application/json' } });
|
|
2721
3091
|
if (!response.ok) throw new Error('HTTP ' + response.status);
|
|
2722
3092
|
const next = normalizePayload(await response.json());
|
|
2723
|
-
|
|
3093
|
+
// A stale response (superseded by a newer load) must not land.
|
|
3094
|
+
if (next && seq === loadSeqRef.current) applyData(next);
|
|
2724
3095
|
}
|
|
2725
3096
|
async function runCommand(type, payload, targetProject = projectId) {
|
|
2726
|
-
|
|
2727
|
-
const response = await fetch('/ai-team/api/projects/' + encodeURIComponent(
|
|
3097
|
+
if (!targetProject) throw new Error(t('noProject'));
|
|
3098
|
+
const response = await fetch('/ai-team/api/projects/' + encodeURIComponent(targetProject) + '/commands', {
|
|
2728
3099
|
method: 'POST',
|
|
2729
3100
|
headers: { 'content-type': 'application/json', accept: 'application/json' },
|
|
2730
3101
|
body: JSON.stringify({ type, payload }),
|
|
@@ -2942,6 +3313,29 @@ window.__ModuleLoader__.load({
|
|
|
2942
3313
|
setPBusy(false);
|
|
2943
3314
|
}
|
|
2944
3315
|
}
|
|
3316
|
+
// 会话重建(reseat):旧会话 cwd 是创建时钉死的(历史账本目录兜底
|
|
3317
|
+
// 或先建项目后设目录的成员),resume 不覆盖;force 重建让新会话落
|
|
3318
|
+
// 在当前项目工作目录。
|
|
3319
|
+
async function reseatProfile() {
|
|
3320
|
+
if (!profileAgent || pBusy) return;
|
|
3321
|
+
if (!(await askConfirm(t('reseatSession'), t('reseatConfirm')))) return;
|
|
3322
|
+
setPBusy(true);
|
|
3323
|
+
setPError('');
|
|
3324
|
+
try {
|
|
3325
|
+
const result = await runCommand('member.activate', {
|
|
3326
|
+
memberId: profileAgent.id,
|
|
3327
|
+
force: true,
|
|
3328
|
+
prompt: '你的会话已在当前项目工作目录重建。先读 tasks/inbox 与项目简报,再继续未完成的工作;不要修改无关文件。',
|
|
3329
|
+
});
|
|
3330
|
+
setProfileAgent(result.member);
|
|
3331
|
+
say(t('reseatDone'));
|
|
3332
|
+
await reloadData();
|
|
3333
|
+
} catch (error) {
|
|
3334
|
+
setPError(error?.message ?? String(error));
|
|
3335
|
+
} finally {
|
|
3336
|
+
setPBusy(false);
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
2945
3339
|
async function distillProfile() {
|
|
2946
3340
|
if (!profileAgent || pBusy) return;
|
|
2947
3341
|
setPBusy(true);
|
|
@@ -2964,7 +3358,7 @@ window.__ModuleLoader__.load({
|
|
|
2964
3358
|
}
|
|
2965
3359
|
async function leaveProfile() {
|
|
2966
3360
|
if (!profileAgent || pBusy) return;
|
|
2967
|
-
if (
|
|
3361
|
+
if (!(await askConfirm(t('leaveTeam'), t('leaveConfirm')))) return;
|
|
2968
3362
|
setPBusy(true);
|
|
2969
3363
|
setPError('');
|
|
2970
3364
|
try {
|
|
@@ -3003,22 +3397,40 @@ window.__ModuleLoader__.load({
|
|
|
3003
3397
|
}
|
|
3004
3398
|
async function openInboxTask(item) {
|
|
3005
3399
|
if (item.projectId && item.projectId !== projectId) {
|
|
3006
|
-
await switchProject({ id: item.projectId, name: item.projectName });
|
|
3400
|
+
const switched = await switchProject({ id: item.projectId, name: item.projectName });
|
|
3401
|
+
// 切换失败(含 project.activate 被拒)时中止:不把 selected 指向
|
|
3402
|
+
// 本项目里不存在的任务卡(否则 effect 会误开第一张卡)。
|
|
3403
|
+
if (!switched) return;
|
|
3007
3404
|
}
|
|
3008
3405
|
setScope('project');
|
|
3009
3406
|
setSelected(item.ref?.taskId ?? '');
|
|
3010
3407
|
setThreadOpen(true);
|
|
3011
3408
|
setRightNote('');
|
|
3012
3409
|
}
|
|
3013
|
-
async function answerDecision(item, answers) {
|
|
3410
|
+
async function answerDecision(item, answers, note) {
|
|
3014
3411
|
try {
|
|
3015
|
-
await runCommand('decision.answer', { itemId: item.id, answers }, item.projectId ?? projectId);
|
|
3412
|
+
await runCommand('decision.answer', { itemId: item.id, answers, ...(note ? { note } : {}) }, item.projectId ?? projectId);
|
|
3016
3413
|
say(t('decisionSubmitted'));
|
|
3017
3414
|
await reloadData();
|
|
3018
3415
|
} catch (error) {
|
|
3019
3416
|
say(tf(t, 'sendFailed', { message: error?.message ?? String(error) }));
|
|
3020
3417
|
}
|
|
3021
3418
|
}
|
|
3419
|
+
// R-06 决策回流:切到决策所在项目 → 主对话 → 高亮决策之后的首条非 Human
|
|
3420
|
+
// 消息(团队接下来的动作)。不做滚动(全局规格 #6),只用左缘强调条。
|
|
3421
|
+
async function followUpDecision(item) {
|
|
3422
|
+
if (item.projectId && item.projectId !== projectId) {
|
|
3423
|
+
const switched = await switchProject({ id: item.projectId, name: item.projectName });
|
|
3424
|
+
if (!switched) return;
|
|
3425
|
+
}
|
|
3426
|
+
setScope('project');
|
|
3427
|
+
setTab('main');
|
|
3428
|
+
setMemberViewId(null);
|
|
3429
|
+
setThreadOpen(false);
|
|
3430
|
+
const anchorAt = item.ackedAt ?? item.updatedAt ?? item.createdAt ?? 0;
|
|
3431
|
+
const hit = (data.stream ?? []).find((entry) => (entry.at ?? 0) >= anchorAt && entry.author?.kind !== 'human');
|
|
3432
|
+
setStreamHighlight(hit?.id ?? null);
|
|
3433
|
+
}
|
|
3022
3434
|
async function reopenDecision(item) {
|
|
3023
3435
|
try {
|
|
3024
3436
|
await runCommand('decision.request', {
|
|
@@ -3045,7 +3457,13 @@ window.__ModuleLoader__.load({
|
|
|
3045
3457
|
async function send() {
|
|
3046
3458
|
const text = draft.trim();
|
|
3047
3459
|
if (!text) return;
|
|
3048
|
-
|
|
3460
|
+
// 目录门槛只拦"要动手"的任务:讨论与建卡无需工作目录(11-管理视角
|
|
3461
|
+
// §3);激活/认领由 Host fail-closed,并把用户引导到目录设置。
|
|
3462
|
+
if (!project?.workspacePath && mode === 'task') {
|
|
3463
|
+
say(t('workspaceRequired'));
|
|
3464
|
+
openWorkspaceEditor();
|
|
3465
|
+
return;
|
|
3466
|
+
}
|
|
3049
3467
|
try {
|
|
3050
3468
|
if (mode === 'task') {
|
|
3051
3469
|
const definition = taskDefinition.trim();
|
|
@@ -3103,12 +3521,30 @@ window.__ModuleLoader__.load({
|
|
|
3103
3521
|
}
|
|
3104
3522
|
setConverting(true);
|
|
3105
3523
|
}
|
|
3106
|
-
function submitConvert() {
|
|
3524
|
+
async function submitConvert() {
|
|
3107
3525
|
if (!selectedTask || !cTitle.trim() || !cDod.trim()) return;
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3526
|
+
// FR-049 trigger ②: the whole Thread converts, anchored on the
|
|
3527
|
+
// ledger event ids of its entries (dedupe + audit by the Host).
|
|
3528
|
+
const sources = (thread?.entries ?? []).map((entry) => entry.eventId).filter(Boolean);
|
|
3529
|
+
if (sources.length === 0) { sayRight(t('convertNoSource')); return; }
|
|
3530
|
+
try {
|
|
3531
|
+
const result = await runCommand('task.convert', {
|
|
3532
|
+
sourceEventIds: sources,
|
|
3533
|
+
title: cTitle.trim(),
|
|
3534
|
+
doneCriteria: cDod.trim(),
|
|
3535
|
+
});
|
|
3536
|
+
setConverting(false);
|
|
3537
|
+
setCTitle('');
|
|
3538
|
+
setCDod('');
|
|
3539
|
+
sayRight(tf(t, 'convertDone', { n: taskNo(result.task) }));
|
|
3540
|
+
await reloadData();
|
|
3541
|
+
} catch (error) {
|
|
3542
|
+
if (error?.details?.taskId) {
|
|
3543
|
+
const card = tasks.find((task) => task.id === error.details.taskId);
|
|
3544
|
+
if (card) openTaskById(card.id);
|
|
3545
|
+
}
|
|
3546
|
+
sayRight(tf(t, 'sendFailed', { message: error?.message ?? String(error) }));
|
|
3547
|
+
}
|
|
3112
3548
|
}
|
|
3113
3549
|
async function acceptTask() {
|
|
3114
3550
|
if (!selectedTask) return;
|
|
@@ -3153,9 +3589,10 @@ window.__ModuleLoader__.load({
|
|
|
3153
3589
|
sayRight(t('reassignNoTarget'));
|
|
3154
3590
|
return;
|
|
3155
3591
|
}
|
|
3156
|
-
const answer =
|
|
3157
|
-
|
|
3158
|
-
:
|
|
3592
|
+
const answer = await askPrompt(t('reassignPrompt'), {
|
|
3593
|
+
options: options.map((agent) => agent.name),
|
|
3594
|
+
value: options[0].name,
|
|
3595
|
+
});
|
|
3159
3596
|
if (answer === null) return;
|
|
3160
3597
|
const target = options.find((agent) => agent.name === answer.trim() || agent.id === answer.trim());
|
|
3161
3598
|
if (target === undefined) {
|
|
@@ -3177,7 +3614,7 @@ window.__ModuleLoader__.load({
|
|
|
3177
3614
|
}
|
|
3178
3615
|
async function cancelSelected() {
|
|
3179
3616
|
if (!selectedTask) return;
|
|
3180
|
-
const reason =
|
|
3617
|
+
const reason = await askPrompt(t('cancelPrompt'));
|
|
3181
3618
|
if (reason === null) return;
|
|
3182
3619
|
try {
|
|
3183
3620
|
await runCommand('task.cancel', { taskId: selectedTask.id, expectedRevision: selectedTask.revision, reason });
|
|
@@ -3189,7 +3626,7 @@ window.__ModuleLoader__.load({
|
|
|
3189
3626
|
}
|
|
3190
3627
|
async function reopenSelected() {
|
|
3191
3628
|
if (!selectedTask) return;
|
|
3192
|
-
const reason =
|
|
3629
|
+
const reason = await askPrompt(t('reopenPrompt'));
|
|
3193
3630
|
if (reason === null) return;
|
|
3194
3631
|
try {
|
|
3195
3632
|
await runCommand('task.reopen', { taskId: selectedTask.id, expectedRevision: selectedTask.revision, reason });
|
|
@@ -3201,7 +3638,7 @@ window.__ModuleLoader__.load({
|
|
|
3201
3638
|
}
|
|
3202
3639
|
async function deleteSelected() {
|
|
3203
3640
|
if (!selectedTask) return;
|
|
3204
|
-
if (
|
|
3641
|
+
if (!(await askConfirm(t('actDelete'), t('deleteConfirm')))) return;
|
|
3205
3642
|
try {
|
|
3206
3643
|
await runCommand('task.delete', { taskId: selectedTask.id, expectedRevision: selectedTask.revision });
|
|
3207
3644
|
sayRight(tf(t, 'deleteDone', { n: taskNo(selectedTask) }));
|
|
@@ -3213,10 +3650,7 @@ window.__ModuleLoader__.load({
|
|
|
3213
3650
|
function continueFromLatest() {
|
|
3214
3651
|
const latest = threadHead;
|
|
3215
3652
|
setReplyBase(latest);
|
|
3216
|
-
sayRight(tf(t, '
|
|
3217
|
-
}
|
|
3218
|
-
function contextAtBase() {
|
|
3219
|
-
sayRight(tf(t, 'conflictContextMock', { base: replyBase ?? 0 }));
|
|
3653
|
+
sayRight(tf(t, 'conflictContinued', { head: latest }));
|
|
3220
3654
|
}
|
|
3221
3655
|
|
|
3222
3656
|
const actions = [];
|
|
@@ -3229,10 +3663,11 @@ window.__ModuleLoader__.load({
|
|
|
3229
3663
|
}
|
|
3230
3664
|
|
|
3231
3665
|
const inInbox = scope === 'inbox';
|
|
3666
|
+
const inPeople = scope === 'people';
|
|
3232
3667
|
const memberViewAgent = data.agents.find((agent) => agent.id === memberViewId) ?? null;
|
|
3233
3668
|
const memberViewTasks = memberViewAgent === null ? [] : tasks.filter((task) => task.ownerId === memberViewAgent.id || task.assigneeId === memberViewAgent.id);
|
|
3234
|
-
const headerTitle = inInbox ? t('inboxTitle') : project ? '# ' + project.name : t('noProject');
|
|
3235
|
-
const headerGoal = inInbox ? t('inboxGoal') : (project?.goal ?? '');
|
|
3669
|
+
const headerTitle = inPeople ? t('peopleTitle') : inInbox ? t('inboxTitle') : project ? '# ' + project.name : t('noProject');
|
|
3670
|
+
const headerGoal = inPeople ? t('peopleEmpty') : inInbox ? t('inboxGoal') : (project?.goal ?? '');
|
|
3236
3671
|
const unread = inboxUnread > 99 ? '99+' : inboxUnread;
|
|
3237
3672
|
|
|
3238
3673
|
const leftProps = {
|
|
@@ -3245,20 +3680,85 @@ window.__ModuleLoader__.load({
|
|
|
3245
3680
|
onBack: () => { closeMobile(); goConversation(); },
|
|
3246
3681
|
onInbox: switchInbox,
|
|
3247
3682
|
onBoard: switchBoard,
|
|
3683
|
+
onPeople: openPeople,
|
|
3684
|
+
peopleActive: scope === 'people',
|
|
3248
3685
|
onProject: switchProject,
|
|
3249
3686
|
onNewProject: () => { closeMobile(); openNewProject(); },
|
|
3250
|
-
onAgent: (agent) => { closeMobile();
|
|
3687
|
+
onAgent: (agent) => { closeMobile(); openProfile(agent); },
|
|
3251
3688
|
onAgentMore: (agent) => { closeMobile(); openProfile(agent); },
|
|
3252
3689
|
onAgentChat: (agent) => { closeMobile(); void openAgentChat(agent); },
|
|
3253
3690
|
onAddAgent: () => { closeMobile(); openAddAgent(); },
|
|
3254
3691
|
onRecruit: (agent) => { closeMobile(); recruit(agent); },
|
|
3255
3692
|
};
|
|
3256
3693
|
|
|
3257
|
-
const body =
|
|
3694
|
+
const body = inPeople
|
|
3695
|
+
? h(PeoplePage, {
|
|
3696
|
+
t,
|
|
3697
|
+
people: peopleData,
|
|
3698
|
+
error: peopleError,
|
|
3699
|
+
loading: peopleLoading,
|
|
3700
|
+
onRefresh: loadPeople,
|
|
3701
|
+
localNames: new Set((data.agents ?? []).map((agent) => agent.name)),
|
|
3702
|
+
onOpenPerson: (personName) => {
|
|
3703
|
+
const agent = data.agents.find((candidate) => candidate.name === personName);
|
|
3704
|
+
if (agent) { closeMobile(); openProfile(agent); } else say(t('quadrantMissing'));
|
|
3705
|
+
},
|
|
3706
|
+
onChatPerson: (personName) => {
|
|
3707
|
+
const agent = data.agents.find((candidate) => candidate.name === personName);
|
|
3708
|
+
if (agent) { closeMobile(); void openAgentChat(agent); } else say(t('quadrantMissing'));
|
|
3709
|
+
},
|
|
3710
|
+
onOpenProject: (targetId) => {
|
|
3711
|
+
const target = data.projects.find((project) => project.id === targetId);
|
|
3712
|
+
if (target) void switchProject(target);
|
|
3713
|
+
else say(t('quadrantMissing'));
|
|
3714
|
+
},
|
|
3715
|
+
})
|
|
3716
|
+
: inInbox
|
|
3258
3717
|
? h('div', { className: 'at-stream', role: 'region', 'aria-label': t('inboxTitle') },
|
|
3259
3718
|
h('div', { className: 'at-streaminner' },
|
|
3719
|
+
// R-09 待验收跨项目队列。
|
|
3720
|
+
pendingRows !== null && pendingRows.length > 0
|
|
3721
|
+
? h('details', { className: 'at-people', open: true },
|
|
3722
|
+
h('summary', { className: 'at-peoplesum' },
|
|
3723
|
+
h('span', { className: 'at-peoplename' }, t('pendingTitle')),
|
|
3724
|
+
h('span', { className: 'at-peoplebadges' }, tf(t, 'peopleProjects', { n: new Set(pendingRows.map((row) => row.projectId)).size }))),
|
|
3725
|
+
h('div', { className: 'at-peopleprojects' },
|
|
3726
|
+
pendingRows.map((row) => h('div', { key: row.taskId + ':' + row.projectId, className: 'at-peopleproject' },
|
|
3727
|
+
h('span', { className: 'at-peopleprojectname' }, '#' + (row.taskNumber ?? row.taskId) + ' ' + row.title),
|
|
3728
|
+
row.category === 'irreversible' ? h('span', { className: 'at-peoplefail' }, t('irreversibleBadge')) : null,
|
|
3729
|
+
h('span', { className: 'at-peoplestate' }, row.projectName),
|
|
3730
|
+
h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: () => openInboxTask({ ref: { taskId: row.taskId }, projectId: row.projectId }) }, t('inboxOpenTask'))))))
|
|
3731
|
+
: null,
|
|
3732
|
+
// R-07 风险分区(三类需要 Human 注意的风险,进入收件箱时拉取)。
|
|
3733
|
+
risksData && (risksData.counts.blocked + risksData.counts.failures + risksData.counts.staleDecisions) > 0
|
|
3734
|
+
? h('details', { className: 'at-people', open: true },
|
|
3735
|
+
h('summary', { className: 'at-peoplesum' },
|
|
3736
|
+
h('span', { className: 'at-peoplename' }, t('riskTitle')),
|
|
3737
|
+
h('span', { className: 'at-peoplebadges' }, tf(t, 'riskCounts', {
|
|
3738
|
+
blocked: risksData.counts.blocked,
|
|
3739
|
+
failures: risksData.counts.failures,
|
|
3740
|
+
stale: risksData.counts.staleDecisions,
|
|
3741
|
+
}))),
|
|
3742
|
+
h('div', { className: 'at-peopleprojects' },
|
|
3743
|
+
risksData.blocked.map((row) => h('div', { key: 'b' + row.taskId, className: 'at-peopleproject' },
|
|
3744
|
+
h('span', { className: 'at-peopleprojectname' }, '#' + (row.taskNumber ?? row.taskId) + ' ' + row.title),
|
|
3745
|
+
h('span', { className: 'at-peoplestate' }, t('riskBlocked')),
|
|
3746
|
+
h('span', { className: 'at-peoplefail' }, t('dependsOn') + ' ' + row.blockedBy.map((id) => '#' + id).join('、')),
|
|
3747
|
+
h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: () => openInboxTask({ ref: { taskId: row.taskId }, projectId: projectId }) }, t('inboxOpenTask')))),
|
|
3748
|
+
risksData.failures.map((row) => h('div', { key: 'f' + row.memberId, className: 'at-peopleproject' },
|
|
3749
|
+
h('span', { className: 'at-peopleprojectname' }, row.name),
|
|
3750
|
+
h('span', { className: 'at-peoplefail' }, failureHuman(t, row.category ?? 'unknown') + (row.message ? ' · ' + row.message : '')),
|
|
3751
|
+
h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: () => {
|
|
3752
|
+
const agent = data.agents.find((candidate) => candidate.name === row.name);
|
|
3753
|
+
if (agent) { closeMobile(); openProfile(agent); } else say(t('quadrantMissing'));
|
|
3754
|
+
} }, t('memberProfileTitle')))),
|
|
3755
|
+
risksData.staleDecisions.map((row) => h('div', { key: 's' + row.itemId, className: 'at-peopleproject' },
|
|
3756
|
+
h('span', { className: 'at-peopleprojectname' }, row.title),
|
|
3757
|
+
h('span', { className: 'at-peoplefail' }, tf(t, 'riskStaleHours', { n: row.waitingHours })),
|
|
3758
|
+
row.taskId ? h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: () => openInboxTask({ ref: { taskId: row.taskId }, projectId: projectId }) }, t('inboxOpenTask')) : null))))
|
|
3759
|
+
: null,
|
|
3260
3760
|
inboxItems.length
|
|
3261
|
-
? inboxItems.map((item) => h('div', { key: item.id, className: cx('at-inboxitem', item.state !== 'unread' && 'at-inboxdone') },
|
|
3761
|
+
? inboxItems.map((item) => h('div', { key: item.id, className: cx('at-inboxitem', inboxAge(item), item.state !== 'unread' && 'at-inboxdone') },
|
|
3262
3762
|
h('div', { className: 'at-inboxbody' },
|
|
3263
3763
|
h('div', { className: 'at-inboxtitle' },
|
|
3264
3764
|
item.type === 'decision_required'
|
|
@@ -3268,17 +3768,19 @@ window.__ModuleLoader__.load({
|
|
|
3268
3768
|
: t('inboxItemTitle')),
|
|
3269
3769
|
Array.isArray(item.ref?.questions) && item.ref.questions.length
|
|
3270
3770
|
? item.state === 'unread'
|
|
3271
|
-
? h(InboxDecision, { t, item, onSubmit: answerDecision })
|
|
3771
|
+
? h(InboxDecision, { t, item, onSubmit: (target, answers, note) => answerDecision(target, answers, note) })
|
|
3272
3772
|
: h('ol', { className: 'at-inboxquestions' }, item.ref.questions.map((question, index) => h('li', { key: question.id ?? index },
|
|
3273
3773
|
h('span', { className: 'at-inboxquestion' }, question.text),
|
|
3274
3774
|
Array.isArray(question.options) && question.options.length
|
|
3275
3775
|
? h('span', { className: 'at-inboxoptions' }, question.options.join(' / '))
|
|
3276
3776
|
: null,
|
|
3277
|
-
question.recommendation ? h('span', { className: 'at-inboxrecommend' }, '
|
|
3777
|
+
question.recommendation ? h('span', { className: 'at-inboxrecommend' }, t('decisionRecommend') + ':' + question.recommendation) : null)))
|
|
3278
3778
|
: null,
|
|
3279
3779
|
h('div', { className: 'at-inboxmeta' },
|
|
3280
3780
|
item.projectName ? item.projectName + ' · ' : '',
|
|
3281
|
-
item.ref?.category
|
|
3781
|
+
item.ref?.category
|
|
3782
|
+
? failureHuman(t, item.ref.category) + ' · '
|
|
3783
|
+
: '',
|
|
3282
3784
|
item.ref?.memberName ?? (item.ref?.memberId ? item.ref.memberId : ''),
|
|
3283
3785
|
' · ',
|
|
3284
3786
|
fmtTime(item.createdAt)),
|
|
@@ -3288,6 +3790,8 @@ window.__ModuleLoader__.load({
|
|
|
3288
3790
|
item.type === 'decision_required' && item.state !== 'unread' && Array.isArray(item.ref?.questions) && item.ref.questions.length
|
|
3289
3791
|
? h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: () => reopenDecision(item) }, t('decisionReopen'))
|
|
3290
3792
|
: null,
|
|
3793
|
+
// R-06 决策回流:处理完回到项目现场,看团队接下来的动作。
|
|
3794
|
+
item.state !== 'unread' ? h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: () => { void followUpDecision(item); } }, t('decisionFollowUp')) : null,
|
|
3291
3795
|
item.state === 'unread' && !(item.type === 'decision_required' && Array.isArray(item.ref?.questions) && item.ref.questions.length)
|
|
3292
3796
|
? h('button', { className: 'at-btn at-btn-small at-btn-primary', type: 'button', onClick: () => ackInbox(item) }, t('inboxAck'))
|
|
3293
3797
|
: null)))
|
|
@@ -3323,6 +3827,7 @@ window.__ModuleLoader__.load({
|
|
|
3323
3827
|
q1Extra,
|
|
3324
3828
|
onOpenInbox: switchInbox,
|
|
3325
3829
|
onBackMain: () => setTab('main'),
|
|
3830
|
+
humanId,
|
|
3326
3831
|
})
|
|
3327
3832
|
: tab === 'situation'
|
|
3328
3833
|
? h(Situation, { t, quadrants, tasks, onItem: openQuadrantItem, onViewAll: viewQuadrant })
|
|
@@ -3338,14 +3843,17 @@ window.__ModuleLoader__.load({
|
|
|
3338
3843
|
tasks,
|
|
3339
3844
|
selected,
|
|
3340
3845
|
follows: followingOf,
|
|
3846
|
+
highlight: streamHighlight === item.id,
|
|
3847
|
+
onOpenProfile,
|
|
3341
3848
|
onOpen: openTask,
|
|
3342
3849
|
onToggleFollow: toggleFollow,
|
|
3343
3850
|
}))
|
|
3344
|
-
: h(
|
|
3851
|
+
: h(Onboarding, {
|
|
3345
3852
|
t,
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3853
|
+
project,
|
|
3854
|
+
agents: data.agents,
|
|
3855
|
+
onSetWorkspace: openWorkspaceEditor,
|
|
3856
|
+
onExample: () => setDraft(t('emptyStreamExample')),
|
|
3349
3857
|
})));
|
|
3350
3858
|
|
|
3351
3859
|
return h('div', { className: 'at-root', role: 'region', 'aria-label': t('panel') },
|
|
@@ -3364,7 +3872,7 @@ window.__ModuleLoader__.load({
|
|
|
3364
3872
|
h('header', { className: 'at-chead' },
|
|
3365
3873
|
h('div', { className: 'at-title', title: headerTitle }, headerTitle),
|
|
3366
3874
|
headerGoal ? h('div', { className: 'at-goal', title: headerGoal }, headerGoal) : null,
|
|
3367
|
-
!inInbox && project ? h('div', { className: 'at-workspacebar' },
|
|
3875
|
+
!inInbox && !inPeople && project ? h('div', { className: 'at-workspacebar' },
|
|
3368
3876
|
h('span', { className: 'at-workspacepath', title: project.workspacePath || t('workspaceHint') },
|
|
3369
3877
|
project.workspacePath ? t('workspace') + ':' + project.workspacePath : t('workspaceUnset')),
|
|
3370
3878
|
h('button', { className: 'at-workspacebtn', type: 'button', onClick: openWorkspaceEditor }, project.workspacePath ? t('workspaceChange') : t('workspaceChoose')),
|
|
@@ -3375,7 +3883,7 @@ window.__ModuleLoader__.load({
|
|
|
3375
3883
|
'aria-pressed': project.pmoAuto !== false,
|
|
3376
3884
|
onClick: togglePmo,
|
|
3377
3885
|
}, project.pmoAuto !== false ? t('pmoOn') : t('pmoOff'))) : null,
|
|
3378
|
-
inInbox ? null : h('div', { className: 'at-tabs', role: 'tablist', 'aria-label': t('tabsAria'), onKeyDown: tabKeyDown },
|
|
3886
|
+
inInbox || inPeople ? null : h('div', { className: 'at-tabs', role: 'tablist', 'aria-label': t('tabsAria'), onKeyDown: tabKeyDown },
|
|
3379
3887
|
h('button', {
|
|
3380
3888
|
className: cx('at-tab', tab === 'main' && 'at-on'),
|
|
3381
3889
|
type: 'button',
|
|
@@ -3409,17 +3917,18 @@ window.__ModuleLoader__.load({
|
|
|
3409
3917
|
tabIndex: tab === 'situation' ? 0 : -1,
|
|
3410
3918
|
onClick: () => selectTab('situation'),
|
|
3411
3919
|
}, t('tabSituation')))),
|
|
3412
|
-
phase === 'fallback' ? h('div', { className: 'at-banner', role: 'note' }, h('b', null, t('fallbackTitle') + ' · '), h('span', null, t('fallbackBody'))) : null,
|
|
3413
3920
|
note ? h('div', { className: 'at-notewrap' },
|
|
3414
3921
|
h('div', { className: 'at-note', role: 'status' },
|
|
3415
3922
|
h('span', { className: 'at-notetext' }, note),
|
|
3416
3923
|
h('button', { className: 'at-noteclose', type: 'button', 'aria-label': t('dismiss'), title: t('dismiss'), onClick: () => setNote('') }, h(Ico, { name: 'close', size: 12 })))) : null,
|
|
3417
3924
|
body,
|
|
3418
|
-
|
|
3925
|
+
scope === 'project' && tab === 'main' && !memberViewAgent ? h(Composer, {
|
|
3419
3926
|
t,
|
|
3420
3927
|
mode,
|
|
3421
3928
|
draft,
|
|
3422
|
-
|
|
3929
|
+
// R-04:无目录只限制「任务」模式(执行需要工作目录),讨论仍可发;
|
|
3930
|
+
// 输入框本体不禁用,保持轻入口可用。
|
|
3931
|
+
disabled: mode === 'task' && (!project || !project.workspacePath),
|
|
3423
3932
|
qaRequired: qaTask,
|
|
3424
3933
|
definition: taskDefinition,
|
|
3425
3934
|
qaChecklist: qaChecklistText,
|
|
@@ -3429,6 +3938,7 @@ window.__ModuleLoader__.load({
|
|
|
3429
3938
|
onMode: setMode,
|
|
3430
3939
|
onDraft: setDraft,
|
|
3431
3940
|
onSend: send,
|
|
3941
|
+
inputRef: composerInputRef,
|
|
3432
3942
|
}) : null),
|
|
3433
3943
|
threadOpen && selectedTask ? h(ThreadPanel, {
|
|
3434
3944
|
t,
|
|
@@ -3454,7 +3964,6 @@ window.__ModuleLoader__.load({
|
|
|
3454
3964
|
onReplySend: sendReply,
|
|
3455
3965
|
replyBase,
|
|
3456
3966
|
onContinue: continueFromLatest,
|
|
3457
|
-
onContext: contextAtBase,
|
|
3458
3967
|
note: rightNote,
|
|
3459
3968
|
onDismissNote: () => setRightNote(''),
|
|
3460
3969
|
acceptChecked,
|
|
@@ -3466,8 +3975,9 @@ window.__ModuleLoader__.load({
|
|
|
3466
3975
|
actions,
|
|
3467
3976
|
panelRef: rightRef,
|
|
3468
3977
|
replyRef,
|
|
3978
|
+
taskEventsData,
|
|
3469
3979
|
}) : null,
|
|
3470
|
-
addOpen ? h(
|
|
3980
|
+
addOpen ? h(ModalBack, { onClose: () => setAddOpen(false) },
|
|
3471
3981
|
h('form', {
|
|
3472
3982
|
className: 'at-modal',
|
|
3473
3983
|
role: 'dialog',
|
|
@@ -3498,11 +4008,12 @@ window.__ModuleLoader__.load({
|
|
|
3498
4008
|
h('label', { className: 'at-check' },
|
|
3499
4009
|
h('input', { type: 'checkbox', checked: mOwner, onChange: (event) => setMOwner(event.target.checked) }),
|
|
3500
4010
|
h('span', null, t('memberOwner'))),
|
|
4011
|
+
h('div', { className: 'at-modalmeta' }, t('permissionNote')),
|
|
3501
4012
|
mError ? h('div', { className: 'at-modalerror', role: 'alert' }, mError) : null,
|
|
3502
4013
|
h('div', { className: 'at-modalactions' },
|
|
3503
4014
|
h('button', { className: 'at-btn', type: 'button', onClick: () => setAddOpen(false), disabled: mBusy }, t('cancel')),
|
|
3504
4015
|
h('button', { className: 'at-btn at-btn-primary', type: 'submit', disabled: mBusy || !mName.trim() }, mBusy ? t('memberAdding') : t('memberCreate'))))) : null,
|
|
3505
|
-
profileAgent ? h(
|
|
4016
|
+
profileAgent ? h(ModalBack, { onClose: () => setProfileAgent(null) },
|
|
3506
4017
|
h('form', {
|
|
3507
4018
|
className: 'at-modal',
|
|
3508
4019
|
role: 'dialog',
|
|
@@ -3517,6 +4028,10 @@ window.__ModuleLoader__.load({
|
|
|
3517
4028
|
version: profileAgent.profileVersion ?? 1,
|
|
3518
4029
|
distill: profileAgent.distillVersion ?? 0,
|
|
3519
4030
|
})),
|
|
4031
|
+
// R-02 权限可见性:把守卫背后的运行事实亮给用户(P6 诚实边界)。
|
|
4032
|
+
h('div', { className: 'at-permbadge', title: t('permissionNote') },
|
|
4033
|
+
t('permissionBadge') + ' @ ' + (project?.workspacePath || '—')),
|
|
4034
|
+
h('div', { className: 'at-modalmeta' }, t('permissionNote')),
|
|
3520
4035
|
(profileAgent.skills?.length || profileAgent.notes?.length)
|
|
3521
4036
|
? h('div', { className: 'at-modalmeta' },
|
|
3522
4037
|
(profileAgent.skills?.length ? t('memberSkills') + ':' + profileAgent.skills.join('、') : ''),
|
|
@@ -3571,9 +4086,10 @@ window.__ModuleLoader__.load({
|
|
|
3571
4086
|
h('button', { className: 'at-btn', type: 'button', onClick: () => { const target = profileAgent; setProfileAgent(null); void openAgentChat(target); } }, t('agentChat')),
|
|
3572
4087
|
h('button', { className: 'at-btn', type: 'button', onClick: leaveProfile, disabled: pBusy }, t('leaveTeam')),
|
|
3573
4088
|
profileAgent.status === 'failed' ? h('button', { className: 'at-btn', type: 'button', onClick: retryProfile, disabled: pBusy }, t('retry')) : null,
|
|
4089
|
+
profileAgent.sessionId ? h('button', { className: 'at-btn', type: 'button', title: t('reseatConfirm'), onClick: reseatProfile, disabled: pBusy }, t('reseatSession')) : null,
|
|
3574
4090
|
h('button', { className: 'at-btn', type: 'button', onClick: distillProfile, disabled: pBusy }, t('redistill')),
|
|
3575
4091
|
h('button', { className: 'at-btn at-btn-primary', type: 'submit', disabled: pBusy || !pName.trim() }, pBusy ? t('saving') : t('save'))))) : null,
|
|
3576
|
-
workspaceOpen ? h(
|
|
4092
|
+
workspaceOpen ? h(ModalBack, { onClose: () => setWorkspaceOpen(false) },
|
|
3577
4093
|
h('form', {
|
|
3578
4094
|
className: 'at-modal',
|
|
3579
4095
|
role: 'dialog',
|
|
@@ -3591,7 +4107,7 @@ window.__ModuleLoader__.load({
|
|
|
3591
4107
|
h('div', { className: 'at-modalactions' },
|
|
3592
4108
|
h('button', { className: 'at-btn', type: 'button', onClick: () => setWorkspaceOpen(false), disabled: workspaceBusy }, t('cancel')),
|
|
3593
4109
|
h('button', { className: 'at-btn at-btn-primary', type: 'submit', disabled: workspaceBusy || !workspaceDraft.trim() }, workspaceBusy ? t('saving') : t('workspaceSave'))))) : null,
|
|
3594
|
-
newOpen ? h(
|
|
4110
|
+
newOpen ? h(ModalBack, { onClose: () => setNewOpen(false) },
|
|
3595
4111
|
h('form', {
|
|
3596
4112
|
className: 'at-modal',
|
|
3597
4113
|
role: 'dialog',
|
|
@@ -3611,7 +4127,18 @@ window.__ModuleLoader__.load({
|
|
|
3611
4127
|
nError ? h('div', { className: 'at-modalerror', role: 'alert' }, nError) : null,
|
|
3612
4128
|
h('div', { className: 'at-modalactions' },
|
|
3613
4129
|
h('button', { className: 'at-btn', type: 'button', onClick: () => setNewOpen(false), disabled: nBusy }, t('cancel')),
|
|
3614
|
-
h('button', { className: 'at-btn at-btn-primary', type: 'submit', disabled: nBusy || !nName.trim() || !nWorkspace.trim() }, nBusy ? t('saving') : t('projectCreate'))))) : null
|
|
4130
|
+
h('button', { className: 'at-btn at-btn-primary', type: 'submit', disabled: nBusy || !nName.trim() || !nWorkspace.trim() }, nBusy ? t('saving') : t('projectCreate'))))) : null,
|
|
4131
|
+
dialog ? h(WorkbenchDialog, { key: dialogSeqRef.current, t, dialog }) : null,
|
|
4132
|
+
shortcutsOpen ? h(ModalBack, { onClose: () => setShortcutsOpen(false) },
|
|
4133
|
+
h('div', { className: 'at-modal', role: 'dialog', 'aria-modal': 'true', 'aria-label': t('shortcutTitle') },
|
|
4134
|
+
h('h2', { className: 'at-modaltitle' }, t('shortcutTitle')),
|
|
4135
|
+
h('table', { className: 'at-shortcuts' },
|
|
4136
|
+
h('tbody', null,
|
|
4137
|
+
[['g i', 'shortcutInbox'], ['g b', 'shortcutBoard'], ['g p', 'shortcutPeople'], ['g c', 'shortcutHome'], ['/', 'shortcutComposer'], ['Esc', 'shortcutClose']].map(([keys, key]) => h('tr', { key: keys },
|
|
4138
|
+
h('td', null, h('kbd', null, keys)),
|
|
4139
|
+
h('td', null, t(key)))))),
|
|
4140
|
+
h('div', { className: 'at-modalactions' },
|
|
4141
|
+
h('button', { className: 'at-btn', type: 'button', onClick: () => setShortcutsOpen(false) }, t('close'))))) : null));
|
|
3615
4142
|
}
|
|
3616
4143
|
|
|
3617
4144
|
function PavilionMark({ size = 18 }) {
|
|
@@ -3653,7 +4180,6 @@ window.__ModuleLoader__.load({
|
|
|
3653
4180
|
name: 'sidebar.panellist', id: 'ai-team', order: 25, label: () => ctx.locale.bind(NS)('panel'),
|
|
3654
4181
|
}, PanelIcon));
|
|
3655
4182
|
ctx.slots.inject('main', () => ctx.slots.register({ name: 'main', key: 'ai-team' }, () => h(Boundary, { t }, h(Workbench, { t, ctx }))));
|
|
3656
|
-
console.log(`${PKG}: client workbench spike applied`);
|
|
3657
4183
|
}
|
|
3658
4184
|
|
|
3659
4185
|
return { inject: ['slots', 'locale'], apply };
|