@suifei/dsh-ai-team 0.3.56 → 0.3.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -29,7 +29,6 @@ window.__ModuleLoader__.load({
29
29
  inbox: '收件箱',
30
30
  board: '任务看板',
31
31
  projects: '项目',
32
- agents: 'Agents',
33
32
  main: '主对话',
34
33
  boardTab: '看板',
35
34
  tabSituation: '态势',
@@ -95,8 +94,7 @@ window.__ModuleLoader__.load({
95
94
  projectsAria: '项目',
96
95
  agentsAria: '成员',
97
96
  streamAria: '主对话',
98
- boardAria: '任务看板',
99
- situationAria: '项目态势',
97
+ situationAria: '项目态势',
100
98
  threadAria: '任务讨论',
101
99
  composerAria: '写一条消息',
102
100
  modeAria: '发送模式',
@@ -130,8 +128,7 @@ window.__ModuleLoader__.load({
130
128
  decisionSubmit: '提交决策',
131
129
  decisionSubmitted: '决策已提交给团队。',
132
130
  inboxEmptyAction: '看任务看板', projectEmptyTitle: '还没有项目',
133
- projectEmptyBody: '用左栏「新建项目」创建第一个项目。',
134
- emptyColumn: '暂无',
131
+ emptyColumn: '暂无',
135
132
  expandDone: '展开全部',
136
133
  collapseDone: '收起',
137
134
  threadEmptyTitle: '还没有消息',
@@ -164,8 +161,7 @@ window.__ModuleLoader__.load({
164
161
  reassignPrompt: '把 accountable owner 改派给(输入名字):',
165
162
  reassignDone: '已把 #{n} 改派给 {name}。',
166
163
  reassignNoTarget: '没有可改派的活跃成员。',
167
- actHandoff: '交接…',
168
- actDelete: '删除',
164
+ actDelete: '删除',
169
165
  convertTitle: '转为 Task',
170
166
  titleLabel: '标题',
171
167
  convertNamePlaceholder: '一句话说清要做什么',
@@ -202,8 +198,7 @@ window.__ModuleLoader__.load({
202
198
  taskOwner: '负责人',
203
199
  taskAssignee: '执行',
204
200
  teamPulseTitle: '团队动态',
205
- teamPulseCount: '{n} 个 Task 正在推进',
206
- teamPulseWorking: '成员已接单',
201
+ teamPulseWorking: '成员已接单',
207
202
  teamPulseStarting: '成员已唤醒,正在拆解任务…',
208
203
  teamPulseAgents: '运行中:{names}',
209
204
  newProject: '新建项目',
@@ -266,6 +261,46 @@ window.__ModuleLoader__.load({
266
261
  memberAdded: '成员已创建并激活。',
267
262
  cancel: '取消',
268
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: '关闭',
269
304
  memberProfileTitle: '成员资料',
270
305
  memberProfileTitleName: '成员资料 · {name}',
271
306
  memberProfileMeta: '{status} · 资料 v{version} · 蒸馏 v{distill}',
@@ -309,6 +344,30 @@ window.__ModuleLoader__.load({
309
344
  dismiss: '关闭提示',
310
345
  crashTitle: '工作台渲染失败',
311
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}',
312
371
  archivedCount: '已归档 {n}',
313
372
  q1Title: '需要你',
314
373
  q2Title: '团队在做',
@@ -358,8 +417,7 @@ window.__ModuleLoader__.load({
358
417
  inbox: 'Inbox',
359
418
  board: 'All tasks',
360
419
  projects: 'Projects',
361
- agents: 'Agents',
362
- main: 'Main',
420
+ main: 'Main',
363
421
  boardTab: 'Board',
364
422
  tabSituation: 'Situation',
365
423
  tabsAria: 'Project views',
@@ -424,8 +482,7 @@ window.__ModuleLoader__.load({
424
482
  projectsAria: 'Projects',
425
483
  agentsAria: 'Agents',
426
484
  streamAria: 'Main stream',
427
- boardAria: 'Task board',
428
- situationAria: 'Project situation',
485
+ situationAria: 'Project situation',
429
486
  threadAria: 'Task discussion',
430
487
  composerAria: 'Write a message',
431
488
  modeAria: 'Send mode',
@@ -460,8 +517,7 @@ window.__ModuleLoader__.load({
460
517
  decisionSubmitted: 'Decision sent to the team.',
461
518
  inboxEmptyAction: 'Open the board',
462
519
  projectEmptyTitle: 'No projects yet',
463
- projectEmptyBody: 'Create the first project with “New project” in the sidebar.',
464
- emptyColumn: 'None',
520
+ emptyColumn: 'None',
465
521
  expandDone: 'Show all',
466
522
  collapseDone: 'Collapse',
467
523
  threadEmptyTitle: 'No messages yet',
@@ -494,8 +550,7 @@ window.__ModuleLoader__.load({
494
550
  reassignPrompt: 'Reassign the accountable owner to (name):',
495
551
  reassignDone: 'Reassigned #{n} to {name}.',
496
552
  reassignNoTarget: 'No active member is available for reassignment.',
497
- actHandoff: 'Hand off…',
498
- actDelete: 'Delete',
553
+ actDelete: 'Delete',
499
554
  convertTitle: 'Turn into task',
500
555
  titleLabel: 'Title',
501
556
  convertNamePlaceholder: 'One line about what needs doing',
@@ -532,8 +587,7 @@ window.__ModuleLoader__.load({
532
587
  taskOwner: 'Owner',
533
588
  taskAssignee: 'Assignee',
534
589
  teamPulseTitle: 'Team activity',
535
- teamPulseCount: '{n} Task(s) in motion',
536
- teamPulseWorking: 'Members picked up the work',
590
+ teamPulseWorking: 'Members picked up the work',
537
591
  teamPulseStarting: 'Members are awake and breaking the work down…',
538
592
  teamPulseAgents: 'Running: {names}',
539
593
  newProject: 'New project',
@@ -596,6 +650,46 @@ window.__ModuleLoader__.load({
596
650
  memberAdded: 'Member created and activated.',
597
651
  cancel: 'Cancel',
598
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',
599
693
  memberProfileTitle: 'Member profile',
600
694
  memberProfileTitleName: 'Member profile · {name}',
601
695
  memberProfileMeta: '{status} · profile v{version} · distill v{distill}',
@@ -639,6 +733,30 @@ window.__ModuleLoader__.load({
639
733
  dismiss: 'Dismiss',
640
734
  crashTitle: 'Workbench failed to render',
641
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}',
642
760
  archivedCount: 'Archived {n}',
643
761
  q1Title: 'Needs you',
644
762
  q2Title: 'Team is doing',
@@ -716,6 +834,18 @@ window.__ModuleLoader__.load({
716
834
  };
717
835
  const TABS = ['main', 'board', 'situation'];
718
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
+ : '';
719
849
  const tf = (t, key, vars) => String(t(key)).replace(/\{(\w+)\}/g, (match, name) => (
720
850
  vars && Object.prototype.hasOwnProperty.call(vars, name) ? String(vars[name]) : match
721
851
  ));
@@ -844,6 +974,8 @@ window.__ModuleLoader__.load({
844
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; }
845
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); }
846
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); }
847
979
  .at-inboxbody { min-width: 0; flex: 1; }
848
980
  .at-inboxquestions { margin: 6px 0 2px; padding-left: 20px; color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 19px; }
849
981
  .at-inboxquestions li { margin: 3px 0; }
@@ -1114,8 +1246,8 @@ window.__ModuleLoader__.load({
1114
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); }
1115
1247
  .at-modaltitle { margin: 0 0 2px; font-size: 15px; font-weight: 600; color: var(--dsw-alias-label-primary); }
1116
1248
  .at-modalmeta { color: var(--dsw-alias-label-tertiary); font-size: 11px; line-height: 16px; }
1117
- .at-check { display: flex; align-items: center; gap: 6px; color: var(--dsw-alias-label-secondary); font-size: 12px; }
1118
- .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); }
1119
1251
  .at-modalerror { color: var(--dsw-alias-state-error-primary); font-size: 11.5px; line-height: 16px; }
1120
1252
  .at-inlineadd { display: flex; align-items: center; gap: 6px; }
1121
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; }
@@ -1131,6 +1263,34 @@ window.__ModuleLoader__.load({
1131
1263
  .at-skel-agent { height: 40px; margin-bottom: 6px; }
1132
1264
  .at-skel-col { height: 120px; }
1133
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; }
1134
1294
  .at-crashtitle { font-size: 14px; font-weight: 500; line-height: 22px; }
1135
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; }
1136
1296
  @container at-center (max-width: 759px) {
@@ -1140,13 +1300,13 @@ window.__ModuleLoader__.load({
1140
1300
  .at-board { grid-template-columns: minmax(0, 1fr); }
1141
1301
  }
1142
1302
  @container at-wb (max-width: 1119px) {
1143
- .at-grid, .at-grid.at-withthread { grid-template-columns: 200px minmax(0, 1fr); }
1303
+ .at-grid { grid-template-columns: 200px minmax(0, 1fr); }
1144
1304
  .at-right { width: min(420px, 100%); }
1145
1305
  .at-boardwrap { padding: 12px; }
1146
1306
  .at-board { gap: 8px; }
1147
1307
  }
1148
1308
  @container at-wb (max-width: 959px) {
1149
- .at-grid, .at-grid.at-withthread { grid-template-columns: 200px minmax(0, 1fr); }
1309
+ .at-grid { grid-template-columns: 200px minmax(0, 1fr); }
1150
1310
  .at-right { width: 100%; max-width: none; border-left: 0; box-shadow: none; }
1151
1311
  .at-board { grid-template-columns: minmax(0, 1fr); }
1152
1312
  .at-quadrants { grid-template-columns: minmax(0, 1fr); }
@@ -1158,7 +1318,7 @@ window.__ModuleLoader__.load({
1158
1318
  .at-situation { padding: 12px 12px 16px; }
1159
1319
  }
1160
1320
  @container at-wb (max-width: 719px) {
1161
- .at-grid, .at-grid.at-withthread { grid-template-columns: minmax(0, 1fr); }
1321
+ .at-grid { grid-template-columns: minmax(0, 1fr); }
1162
1322
  .at-left { display: none; }
1163
1323
  .at-mobile { display: block; }
1164
1324
  .at-top { padding: 0 8px; gap: 6px; }
@@ -1286,6 +1446,7 @@ window.__ModuleLoader__.load({
1286
1446
  fromDiscussion ? h('span', { className: 'at-origin', title: t('fromDiscussion'), 'aria-hidden': 'true' }, h(Ico, { name: 'reply', size: 12 })) : null,
1287
1447
  h('span', { className: 'at-num' }, 'Task #' + no),
1288
1448
  h(StatusPill, { t, status: card.status }),
1449
+ card.irreversible ? h('span', { className: 'at-blocked', title: t('irreversibleBadge') }, t('irreversibleBadge')) : null,
1289
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,
1290
1451
  h('span', { className: 'at-replies' }, replyLabel + (time ? ' · ' + time : '')),
1291
1452
  ),
@@ -1338,17 +1499,19 @@ window.__ModuleLoader__.load({
1338
1499
  );
1339
1500
  }
1340
1501
 
1341
- function StreamMessage({ t, item, data, tasks, selected, follows, onOpen, onToggleFollow }) {
1502
+ function StreamMessage({ t, item, data, tasks, selected, follows, highlight, onOpenProfile, onOpen, onToggleFollow }) {
1342
1503
  const author = item.author ?? {};
1343
1504
  // 结构化判定:kind 是权威字段;显示名回退只兼容旧账本流。
1344
1505
  const human = author.kind === 'human' || (author.kind === undefined && agentFor(data, author.name) === null && author.name === t('you'));
1345
1506
  const agent = agentFor(data, author.name);
1346
1507
  const cards = (item.taskIds ?? []).map((id) => tasks.find((task) => task.id === id)).filter(Boolean);
1347
- return h('article', { className: cx('at-msg', human && 'at-msg-human') },
1508
+ return h('article', { className: cx('at-msg', human && 'at-msg-human', highlight && 'at-msg-highlight') },
1348
1509
  h(Avatar, { name: author.name ?? (human ? t('you') : '?'), human }),
1349
1510
  h('div', { className: 'at-msgb' },
1350
1511
  h('div', { className: 'at-msgh' },
1351
- h('b', null, author.name ?? '—'),
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 ?? '—'),
1352
1515
  agent ? h('span', { className: 'at-role' }, agent.role) : null,
1353
1516
  h('time', { dateTime: iso(item.at) }, fmtTime(item.at)),
1354
1517
  ),
@@ -1375,17 +1538,25 @@ window.__ModuleLoader__.load({
1375
1538
  h('button', { className: 'at-toastclose', type: 'button', 'aria-label': t('notifyClose'), onClick: () => onClose(toast.id) }, '×'));
1376
1539
  }
1377
1540
 
1541
+ /** 模态栈:多模态同开时只有栈顶响应 Escape(后开先关)。 */
1542
+ const MODAL_STACK = [];
1543
+
1378
1544
  /**
1379
- * Shared modal backdrop: Escape closes, Tab stays inside the dialog.
1380
- * Module-level so React sees a stable component type across renders.
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.
1381
1548
  */
1382
1549
  function ModalBack({ onClose, children }) {
1383
1550
  const backRef = React.useRef(null);
1384
1551
  const onCloseRef = React.useRef(onClose);
1385
1552
  onCloseRef.current = onClose;
1386
1553
  React.useEffect(() => {
1554
+ const modalId = Symbol('at-modal');
1555
+ MODAL_STACK.push(modalId);
1387
1556
  const onKey = (event) => {
1388
1557
  if (event.defaultPrevented) return;
1558
+ // 非栈顶(被更晚打开的模态覆盖)时让位:Escape/Tab 都不处理。
1559
+ if (MODAL_STACK[MODAL_STACK.length - 1] !== modalId) return;
1389
1560
  if (event.key === 'Escape') {
1390
1561
  event.preventDefault();
1391
1562
  event.stopPropagation();
@@ -1409,7 +1580,11 @@ window.__ModuleLoader__.load({
1409
1580
  }
1410
1581
  };
1411
1582
  window.addEventListener('keydown', onKey);
1412
- return () => window.removeEventListener('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
+ };
1413
1588
  }, []);
1414
1589
  return h('div', { className: 'at-modalback', ref: backRef }, children);
1415
1590
  }
@@ -1419,13 +1594,29 @@ window.__ModuleLoader__.load({
1419
1594
  * prompt 文本、choice 选项。模块级组件 + 调用方自增 key 保证每次
1420
1595
  * 新对话框重建(输入初始值生效)。
1421
1596
  */
1422
- function WorkbenchDialog({ t, dialog }) {
1597
+ function WorkbenchDialog({ t, dialog, onDismiss }) {
1423
1598
  const [value, setValue] = React.useState(dialog.value ?? '');
1424
- const cancel = () => dialog.resolve(dialog.mode === 'confirm' ? false : null);
1425
- const submit = () => dialog.resolve(dialog.mode === 'confirm' ? true : value.trim());
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());
1426
1605
  const canSubmit = dialog.mode === 'confirm' || value.trim() !== '';
1427
1606
  return h(ModalBack, { onClose: cancel },
1428
- h('div', { className: 'at-modal', role: 'dialog', 'aria-modal': 'true', 'aria-label': dialog.title },
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
+ },
1429
1620
  h('h2', { className: 'at-modaltitle' }, dialog.title),
1430
1621
  dialog.body ? h('p', { className: 'at-modalmeta' }, dialog.body) : null,
1431
1622
  dialog.mode === 'prompt'
@@ -1434,7 +1625,6 @@ window.__ModuleLoader__.load({
1434
1625
  onChange: (event) => setValue(event.target.value),
1435
1626
  placeholder: dialog.placeholder ?? '',
1436
1627
  autoFocus: true,
1437
- onKeyDown: (event) => { if (event.key === 'Enter' && canSubmit) submit(); },
1438
1628
  })
1439
1629
  : null,
1440
1630
  dialog.mode === 'choice'
@@ -1443,7 +1633,7 @@ window.__ModuleLoader__.load({
1443
1633
  : null,
1444
1634
  h('div', { className: 'at-modalactions' },
1445
1635
  h('button', { className: 'at-btn', type: 'button', onClick: cancel }, t('cancel')),
1446
- h('button', { className: 'at-btn at-btn-primary', type: 'button', onClick: submit, disabled: !canSubmit }, t('dialogConfirm')))));
1636
+ h('button', { className: 'at-btn at-btn-primary', type: 'button', onClick: submit, disabled: !canSubmit, autoFocus: dialog.mode === 'confirm' }, t('dialogConfirm')))));
1447
1637
  }
1448
1638
 
1449
1639
  function EmptyState({ t, icon, title, body, action, compact }) {
@@ -1632,6 +1822,7 @@ window.__ModuleLoader__.load({
1632
1822
  function InboxDecision({ t, item, onSubmit }) {
1633
1823
  const questions = Array.isArray(item.ref?.questions) ? item.ref.questions : [];
1634
1824
  const [answers, setAnswers] = React.useState(() => questions.map(() => ''));
1825
+ const [note, setNote] = React.useState('');
1635
1826
  const [busy, setBusy] = React.useState(false);
1636
1827
  const setAnswer = (index, value) => setAnswers((prev) => prev.map((entry, i) => i === index ? value : entry));
1637
1828
  const recommendations = questions.map((question) => typeof question.recommendation === 'string' ? question.recommendation.trim() : '');
@@ -1642,7 +1833,8 @@ window.__ModuleLoader__.load({
1642
1833
  if (!complete || busy) return;
1643
1834
  setBusy(true);
1644
1835
  try {
1645
- await onSubmit(item, questions.map((question, index) => ({ id: question.id, value: answers[index].trim() })));
1836
+ // R-06:可选补充说明随决策一起入 Thread/收件箱存档。
1837
+ await onSubmit(item, questions.map((question, index) => ({ id: question.id, value: answers[index].trim() })), note.trim());
1646
1838
  } finally {
1647
1839
  setBusy(false);
1648
1840
  }
@@ -1661,9 +1853,90 @@ window.__ModuleLoader__.load({
1661
1853
  question.recommendation ? h('div', { className: 'at-decisionrecommend' },
1662
1854
  h('span', null, t('decisionRecommend') + ':' + question.recommendation),
1663
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
+ }),
1664
1864
  h('button', { className: 'at-btn at-btn-primary at-btn-small', type: 'button', disabled: !complete || busy, onClick: submit }, busy ? t('saving') : t('decisionSubmit')));
1665
1865
  }
1666
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
+
1667
1940
  function MemberView({ t, agent, tasks, onBack, onOpenTask, onOpenChat, onOpenProfile }) {
1668
1941
  const recentTasks = tasks.slice().sort((left, right) => (right.number ?? 0) - (left.number ?? 0)).slice(0, 3);
1669
1942
  return h('div', { className: 'at-memberview' },
@@ -1699,7 +1972,7 @@ window.__ModuleLoader__.load({
1699
1972
  : h(EmptyState, { t, title: t('memberNoTasks'), body: t('memberNoTasksBody'), compact: true })));
1700
1973
  }
1701
1974
 
1702
- 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 }) {
1703
1976
  const projects = data.projects.filter((project) => !project.archived);
1704
1977
  const activeAgents = data.agents.filter((agent) => agent.status !== 'retired');
1705
1978
  const talentAgents = data.agents.filter((agent) => agent.status === 'retired');
@@ -1707,7 +1980,7 @@ window.__ModuleLoader__.load({
1707
1980
  const boardActive = scope === 'project' && tab === 'board';
1708
1981
  return h('div', null,
1709
1982
  h('nav', { className: 'at-nav', 'aria-label': t('navAria') },
1710
- h('button', { className: 'at-navrow', type: 'button', onClick: onBack }, h(Ico, { name: 'back' }), h('span', null, t('back'))),
1983
+ h('button', { className: 'at-navrow', type: 'button', onClick: onBack }, h(Ico, { name: 'back' }), h('span', null, t('navHome'))),
1711
1984
  h('button', {
1712
1985
  className: cx('at-navrow', scope === 'inbox' && 'at-on'),
1713
1986
  type: 'button',
@@ -1721,6 +1994,12 @@ window.__ModuleLoader__.load({
1721
1994
  'aria-current': boardActive ? 'page' : undefined,
1722
1995
  onClick: onBoard,
1723
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'))),
1724
2003
  ),
1725
2004
  h('div', { className: 'at-h' },
1726
2005
  h('span', null, t('projects')),
@@ -1745,7 +2024,7 @@ window.__ModuleLoader__.load({
1745
2024
  onSelect: onProject,
1746
2025
  })))) : null,
1747
2026
  h('div', { className: 'at-h' },
1748
- h('span', null, t('agents')),
2027
+ h('span', { title: t('agentsScope') }, t('agentsScope')),
1749
2028
  h('button', { className: 'at-mini', type: 'button', 'aria-label': t('addAgent'), title: t('addAgent'), onClick: onAddAgent }, h(Ico, { name: 'plus', size: 12 })),
1750
2029
  ),
1751
2030
  activeAgents.length
@@ -1879,7 +2158,7 @@ window.__ModuleLoader__.load({
1879
2158
  h('div', { className: 'at-kvbody' }, task.updatedAt ? fmtDateTime(task.updatedAt) : '—'))));
1880
2159
  }
1881
2160
 
1882
- 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 }) {
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 }) {
1883
2162
  const headSeq = thread?.headSeq ?? thread?.entries?.length ?? 0;
1884
2163
  const stale = replyBase !== null && replyBase !== undefined && headSeq > replyBase;
1885
2164
  const entries = Array.isArray(thread?.entries) ? thread.entries : [];
@@ -1927,6 +2206,13 @@ window.__ModuleLoader__.load({
1927
2206
  type: 'button',
1928
2207
  onClick: action.onClick,
1929
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,
1930
2216
  !converting ? h('div', { className: 'at-rfoot' },
1931
2217
  h('div', { className: 'at-box at-rbox' },
1932
2218
  h('textarea', {
@@ -1948,7 +2234,7 @@ window.__ModuleLoader__.load({
1948
2234
  h('button', { className: 'at-send', type: 'button', disabled: !reply.trim(), onClick: onReplySend }, t('send'))))) : null);
1949
2235
  }
1950
2236
 
1951
- 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 }) {
1952
2238
  const send = () => {
1953
2239
  if (!draft.trim() || disabled) return;
1954
2240
  if (mode === 'task' && (!definition.trim() || (qaRequired && !qaChecklist.trim()))) return;
@@ -1956,8 +2242,9 @@ window.__ModuleLoader__.load({
1956
2242
  };
1957
2243
  return h('div', { className: 'at-composer' },
1958
2244
  h('div', { className: 'at-composerinner' },
1959
- h('div', { className: cx('at-box', 'at-composerbox', mode === 'task' && 'at-taskmode') },
2245
+ h('div', { className: cx('at-box', mode === 'task' && 'at-taskmode') },
1960
2246
  h('textarea', {
2247
+ ref: inputRef,
1961
2248
  value: draft,
1962
2249
  rows: 2,
1963
2250
  disabled,
@@ -2065,10 +2352,18 @@ window.__ModuleLoader__.load({
2065
2352
  h('div', { className: 'at-situationinner' },
2066
2353
  h(EmptyState, { t, icon: 'dot', title: t('situationAria'), body: '' })));
2067
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');
2068
2363
  return h('div', { className: 'at-situation', role: 'tabpanel', id: 'at-panel-situation', 'aria-labelledby': 'at-tab-situation' },
2069
2364
  h('div', { className: 'at-situationinner' },
2070
2365
  h('div', { className: 'at-qmeta' },
2071
- h('span', null, tf(t, 'quadrantMeta', { time: fmtTime(quadrants.generatedAt) })),
2366
+ h('span', null, mood + ' · ' + tf(t, 'quadrantMeta', { time: fmtTime(quadrants.generatedAt) })),
2072
2367
  quadrants.rev ? h('span', null, 'rev ' + quadrants.rev) : null),
2073
2368
  h('div', { className: 'at-quadrants' }, QUADRANTS.map((quadrant) => {
2074
2369
  const block = quadrants[quadrant.key] ?? { count: 0, items: [] };
@@ -2223,12 +2518,62 @@ window.__ModuleLoader__.load({
2223
2518
  const [workspaceError, setWorkspaceError] = React.useState('');
2224
2519
  const [workspaceBusy, setWorkspaceBusy] = React.useState(false);
2225
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;
2226
2569
  const [nBusy, setNBusy] = React.useState(false);
2227
2570
  const [nError, setNError] = React.useState('');
2228
2571
  const [pSuccessor, setPSuccessor] = React.useState('');
2229
2572
  const [pBusy, setPBusy] = React.useState(false);
2230
2573
  const [pError, setPError] = React.useState('');
2231
2574
  const [replyBase, setReplyBase] = React.useState(null);
2575
+ // R-06 决策回流高亮:主对话中被指认的 stream 消息 id。
2576
+ const [streamHighlight, setStreamHighlight] = React.useState(null);
2232
2577
  // 自绘确认/输入对话框(替代原生 prompt/confirm,观感与宿主一致)。
2233
2578
  // dialog: { mode: 'confirm'|'prompt'|'choice', title, body, placeholder,
2234
2579
  // value, options, resolve } — resolve(false|null|字符串)。
@@ -2255,6 +2600,10 @@ window.__ModuleLoader__.load({
2255
2600
  const replyRef = React.useRef(null);
2256
2601
  const triggerRef = React.useRef(null);
2257
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);
2258
2607
  // Latest-data mirror for effects that must react to `selected` alone,
2259
2608
  // and a monotonically increasing load sequence so a stale bootstrap
2260
2609
  // response can never overwrite a newer one.
@@ -2317,6 +2666,9 @@ window.__ModuleLoader__.load({
2317
2666
  } catch (error) {
2318
2667
  console.error(PKG + ': malformed SSE frame', error);
2319
2668
  }
2669
+ // R-05:人员池驻留时,任何团队变化都触发重拉(无定时器,
2670
+ // 事件驱动刷新——与宿主 SSE 合帧节奏一致)。
2671
+ if (scopeRef.current === 'people') loadPeople();
2320
2672
  load();
2321
2673
  });
2322
2674
  source.addEventListener('error', () => {
@@ -2403,6 +2755,8 @@ window.__ModuleLoader__.load({
2403
2755
  if (event.key !== 'Escape') return;
2404
2756
  // Host overlays handle Escape first (defaultPrevented); don't swallow.
2405
2757
  if (event.defaultPrevented) return;
2758
+ // 插件自身的模态(确认/表单)是更上层:让位,先关模态。
2759
+ if (MODAL_STACK.length > 0) return;
2406
2760
  event.preventDefault();
2407
2761
  event.stopPropagation();
2408
2762
  if (converting) { setConverting(false); return; }
@@ -2412,6 +2766,43 @@ window.__ModuleLoader__.load({
2412
2766
  return () => window.removeEventListener('keydown', onKey);
2413
2767
  }, [threadOpen, converting]);
2414
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
+
2415
2806
  if (phase === 'error' && !data) {
2416
2807
  return h('div', { className: 'at-root', role: 'alert' },
2417
2808
  h('div', { className: 'at-empty' },
@@ -2434,6 +2825,13 @@ window.__ModuleLoader__.load({
2434
2825
  const thread = threadFor(data, selectedTask?.id);
2435
2826
  const quadrants = deriveQuadrants(data);
2436
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
+ };
2437
2835
  const inboxUnread = inboxItems.filter((item) => item.state === 'unread').length;
2438
2836
  const q1Extra = inboxItems.filter((item) => item.requiresDecision === true && item.state === 'unread').length;
2439
2837
  const threadHead = thread?.headSeq ?? thread?.entries?.length ?? 0;
@@ -2531,6 +2929,35 @@ window.__ModuleLoader__.load({
2531
2929
  setScope('inbox');
2532
2930
  setThreadOpen(false);
2533
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
+ });
2534
2961
  }
2535
2962
  function switchBoard() {
2536
2963
  closeMobile();
@@ -2541,7 +2968,7 @@ window.__ModuleLoader__.load({
2541
2968
  }
2542
2969
  async function switchProject(next) {
2543
2970
  closeMobile();
2544
- if (next.id === projectId && scope === 'project') return;
2971
+ if (next.id === projectId && scope === 'project') return true;
2545
2972
  try {
2546
2973
  await runCommand('project.activate', { projectId: next.id });
2547
2974
  setScope('project');
@@ -2553,8 +2980,10 @@ window.__ModuleLoader__.load({
2553
2980
  await reloadData(next.id);
2554
2981
  setProjectId(next.id);
2555
2982
  say(next.archived ? t('archivedNote') : t('projectSwitched'));
2983
+ return true;
2556
2984
  } catch (error) {
2557
2985
  say(tf(t, 'sendFailed', { message: error?.message ?? String(error) }));
2986
+ return false;
2558
2987
  }
2559
2988
  }
2560
2989
  function openNewProject() {
@@ -2884,6 +3313,29 @@ window.__ModuleLoader__.load({
2884
3313
  setPBusy(false);
2885
3314
  }
2886
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
+ }
2887
3339
  async function distillProfile() {
2888
3340
  if (!profileAgent || pBusy) return;
2889
3341
  setPBusy(true);
@@ -2945,22 +3397,40 @@ window.__ModuleLoader__.load({
2945
3397
  }
2946
3398
  async function openInboxTask(item) {
2947
3399
  if (item.projectId && item.projectId !== projectId) {
2948
- 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;
2949
3404
  }
2950
3405
  setScope('project');
2951
3406
  setSelected(item.ref?.taskId ?? '');
2952
3407
  setThreadOpen(true);
2953
3408
  setRightNote('');
2954
3409
  }
2955
- async function answerDecision(item, answers) {
3410
+ async function answerDecision(item, answers, note) {
2956
3411
  try {
2957
- 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);
2958
3413
  say(t('decisionSubmitted'));
2959
3414
  await reloadData();
2960
3415
  } catch (error) {
2961
3416
  say(tf(t, 'sendFailed', { message: error?.message ?? String(error) }));
2962
3417
  }
2963
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
+ }
2964
3434
  async function reopenDecision(item) {
2965
3435
  try {
2966
3436
  await runCommand('decision.request', {
@@ -2987,7 +3457,13 @@ window.__ModuleLoader__.load({
2987
3457
  async function send() {
2988
3458
  const text = draft.trim();
2989
3459
  if (!text) return;
2990
- if (!project?.workspacePath) { say(t('workspaceRequired')); return; }
3460
+ // 目录门槛只拦"要动手"的任务:讨论与建卡无需工作目录(11-管理视角
3461
+ // §3);激活/认领由 Host fail-closed,并把用户引导到目录设置。
3462
+ if (!project?.workspacePath && mode === 'task') {
3463
+ say(t('workspaceRequired'));
3464
+ openWorkspaceEditor();
3465
+ return;
3466
+ }
2991
3467
  try {
2992
3468
  if (mode === 'task') {
2993
3469
  const definition = taskDefinition.trim();
@@ -3187,10 +3663,11 @@ window.__ModuleLoader__.load({
3187
3663
  }
3188
3664
 
3189
3665
  const inInbox = scope === 'inbox';
3666
+ const inPeople = scope === 'people';
3190
3667
  const memberViewAgent = data.agents.find((agent) => agent.id === memberViewId) ?? null;
3191
3668
  const memberViewTasks = memberViewAgent === null ? [] : tasks.filter((task) => task.ownerId === memberViewAgent.id || task.assigneeId === memberViewAgent.id);
3192
- const headerTitle = inInbox ? t('inboxTitle') : project ? '# ' + project.name : t('noProject');
3193
- 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 ?? '');
3194
3671
  const unread = inboxUnread > 99 ? '99+' : inboxUnread;
3195
3672
 
3196
3673
  const leftProps = {
@@ -3203,20 +3680,85 @@ window.__ModuleLoader__.load({
3203
3680
  onBack: () => { closeMobile(); goConversation(); },
3204
3681
  onInbox: switchInbox,
3205
3682
  onBoard: switchBoard,
3683
+ onPeople: openPeople,
3684
+ peopleActive: scope === 'people',
3206
3685
  onProject: switchProject,
3207
3686
  onNewProject: () => { closeMobile(); openNewProject(); },
3208
- onAgent: (agent) => { closeMobile(); void openAgentChat(agent); },
3687
+ onAgent: (agent) => { closeMobile(); openProfile(agent); },
3209
3688
  onAgentMore: (agent) => { closeMobile(); openProfile(agent); },
3210
3689
  onAgentChat: (agent) => { closeMobile(); void openAgentChat(agent); },
3211
3690
  onAddAgent: () => { closeMobile(); openAddAgent(); },
3212
3691
  onRecruit: (agent) => { closeMobile(); recruit(agent); },
3213
3692
  };
3214
3693
 
3215
- const body = inInbox
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
3216
3717
  ? h('div', { className: 'at-stream', role: 'region', 'aria-label': t('inboxTitle') },
3217
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,
3218
3760
  inboxItems.length
3219
- ? 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') },
3220
3762
  h('div', { className: 'at-inboxbody' },
3221
3763
  h('div', { className: 'at-inboxtitle' },
3222
3764
  item.type === 'decision_required'
@@ -3226,7 +3768,7 @@ window.__ModuleLoader__.load({
3226
3768
  : t('inboxItemTitle')),
3227
3769
  Array.isArray(item.ref?.questions) && item.ref.questions.length
3228
3770
  ? item.state === 'unread'
3229
- ? h(InboxDecision, { t, item, onSubmit: answerDecision })
3771
+ ? h(InboxDecision, { t, item, onSubmit: (target, answers, note) => answerDecision(target, answers, note) })
3230
3772
  : h('ol', { className: 'at-inboxquestions' }, item.ref.questions.map((question, index) => h('li', { key: question.id ?? index },
3231
3773
  h('span', { className: 'at-inboxquestion' }, question.text),
3232
3774
  Array.isArray(question.options) && question.options.length
@@ -3236,7 +3778,9 @@ window.__ModuleLoader__.load({
3236
3778
  : null,
3237
3779
  h('div', { className: 'at-inboxmeta' },
3238
3780
  item.projectName ? item.projectName + ' · ' : '',
3239
- item.ref?.category ? item.ref.category + ' · ' : '',
3781
+ item.ref?.category
3782
+ ? failureHuman(t, item.ref.category) + ' · '
3783
+ : '',
3240
3784
  item.ref?.memberName ?? (item.ref?.memberId ? item.ref.memberId : ''),
3241
3785
  ' · ',
3242
3786
  fmtTime(item.createdAt)),
@@ -3246,6 +3790,8 @@ window.__ModuleLoader__.load({
3246
3790
  item.type === 'decision_required' && item.state !== 'unread' && Array.isArray(item.ref?.questions) && item.ref.questions.length
3247
3791
  ? h('button', { className: 'at-btn at-btn-small', type: 'button', onClick: () => reopenDecision(item) }, t('decisionReopen'))
3248
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,
3249
3795
  item.state === 'unread' && !(item.type === 'decision_required' && Array.isArray(item.ref?.questions) && item.ref.questions.length)
3250
3796
  ? h('button', { className: 'at-btn at-btn-small at-btn-primary', type: 'button', onClick: () => ackInbox(item) }, t('inboxAck'))
3251
3797
  : null)))
@@ -3297,14 +3843,17 @@ window.__ModuleLoader__.load({
3297
3843
  tasks,
3298
3844
  selected,
3299
3845
  follows: followingOf,
3846
+ highlight: streamHighlight === item.id,
3847
+ onOpenProfile,
3300
3848
  onOpen: openTask,
3301
3849
  onToggleFollow: toggleFollow,
3302
3850
  }))
3303
- : h(EmptyState, {
3851
+ : h(Onboarding, {
3304
3852
  t,
3305
- title: t('emptyStreamTitle'),
3306
- body: t('emptyStreamBody'),
3307
- action: { label: t('fillExample'), onClick: () => setDraft(t('emptyStreamExample')) },
3853
+ project,
3854
+ agents: data.agents,
3855
+ onSetWorkspace: openWorkspaceEditor,
3856
+ onExample: () => setDraft(t('emptyStreamExample')),
3308
3857
  })));
3309
3858
 
3310
3859
  return h('div', { className: 'at-root', role: 'region', 'aria-label': t('panel') },
@@ -3323,7 +3872,7 @@ window.__ModuleLoader__.load({
3323
3872
  h('header', { className: 'at-chead' },
3324
3873
  h('div', { className: 'at-title', title: headerTitle }, headerTitle),
3325
3874
  headerGoal ? h('div', { className: 'at-goal', title: headerGoal }, headerGoal) : null,
3326
- !inInbox && project ? h('div', { className: 'at-workspacebar' },
3875
+ !inInbox && !inPeople && project ? h('div', { className: 'at-workspacebar' },
3327
3876
  h('span', { className: 'at-workspacepath', title: project.workspacePath || t('workspaceHint') },
3328
3877
  project.workspacePath ? t('workspace') + ':' + project.workspacePath : t('workspaceUnset')),
3329
3878
  h('button', { className: 'at-workspacebtn', type: 'button', onClick: openWorkspaceEditor }, project.workspacePath ? t('workspaceChange') : t('workspaceChoose')),
@@ -3334,7 +3883,7 @@ window.__ModuleLoader__.load({
3334
3883
  'aria-pressed': project.pmoAuto !== false,
3335
3884
  onClick: togglePmo,
3336
3885
  }, project.pmoAuto !== false ? t('pmoOn') : t('pmoOff'))) : null,
3337
- 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 },
3338
3887
  h('button', {
3339
3888
  className: cx('at-tab', tab === 'main' && 'at-on'),
3340
3889
  type: 'button',
@@ -3373,11 +3922,13 @@ window.__ModuleLoader__.load({
3373
3922
  h('span', { className: 'at-notetext' }, note),
3374
3923
  h('button', { className: 'at-noteclose', type: 'button', 'aria-label': t('dismiss'), title: t('dismiss'), onClick: () => setNote('') }, h(Ico, { name: 'close', size: 12 })))) : null,
3375
3924
  body,
3376
- !inInbox && tab === 'main' && !memberViewAgent ? h(Composer, {
3925
+ scope === 'project' && tab === 'main' && !memberViewAgent ? h(Composer, {
3377
3926
  t,
3378
3927
  mode,
3379
3928
  draft,
3380
- disabled: !project || !project.workspacePath,
3929
+ // R-04:无目录只限制「任务」模式(执行需要工作目录),讨论仍可发;
3930
+ // 输入框本体不禁用,保持轻入口可用。
3931
+ disabled: mode === 'task' && (!project || !project.workspacePath),
3381
3932
  qaRequired: qaTask,
3382
3933
  definition: taskDefinition,
3383
3934
  qaChecklist: qaChecklistText,
@@ -3387,6 +3938,7 @@ window.__ModuleLoader__.load({
3387
3938
  onMode: setMode,
3388
3939
  onDraft: setDraft,
3389
3940
  onSend: send,
3941
+ inputRef: composerInputRef,
3390
3942
  }) : null),
3391
3943
  threadOpen && selectedTask ? h(ThreadPanel, {
3392
3944
  t,
@@ -3423,6 +3975,7 @@ window.__ModuleLoader__.load({
3423
3975
  actions,
3424
3976
  panelRef: rightRef,
3425
3977
  replyRef,
3978
+ taskEventsData,
3426
3979
  }) : null,
3427
3980
  addOpen ? h(ModalBack, { onClose: () => setAddOpen(false) },
3428
3981
  h('form', {
@@ -3455,6 +4008,7 @@ window.__ModuleLoader__.load({
3455
4008
  h('label', { className: 'at-check' },
3456
4009
  h('input', { type: 'checkbox', checked: mOwner, onChange: (event) => setMOwner(event.target.checked) }),
3457
4010
  h('span', null, t('memberOwner'))),
4011
+ h('div', { className: 'at-modalmeta' }, t('permissionNote')),
3458
4012
  mError ? h('div', { className: 'at-modalerror', role: 'alert' }, mError) : null,
3459
4013
  h('div', { className: 'at-modalactions' },
3460
4014
  h('button', { className: 'at-btn', type: 'button', onClick: () => setAddOpen(false), disabled: mBusy }, t('cancel')),
@@ -3474,6 +4028,10 @@ window.__ModuleLoader__.load({
3474
4028
  version: profileAgent.profileVersion ?? 1,
3475
4029
  distill: profileAgent.distillVersion ?? 0,
3476
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')),
3477
4035
  (profileAgent.skills?.length || profileAgent.notes?.length)
3478
4036
  ? h('div', { className: 'at-modalmeta' },
3479
4037
  (profileAgent.skills?.length ? t('memberSkills') + ':' + profileAgent.skills.join('、') : ''),
@@ -3528,6 +4086,7 @@ window.__ModuleLoader__.load({
3528
4086
  h('button', { className: 'at-btn', type: 'button', onClick: () => { const target = profileAgent; setProfileAgent(null); void openAgentChat(target); } }, t('agentChat')),
3529
4087
  h('button', { className: 'at-btn', type: 'button', onClick: leaveProfile, disabled: pBusy }, t('leaveTeam')),
3530
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,
3531
4090
  h('button', { className: 'at-btn', type: 'button', onClick: distillProfile, disabled: pBusy }, t('redistill')),
3532
4091
  h('button', { className: 'at-btn at-btn-primary', type: 'submit', disabled: pBusy || !pName.trim() }, pBusy ? t('saving') : t('save'))))) : null,
3533
4092
  workspaceOpen ? h(ModalBack, { onClose: () => setWorkspaceOpen(false) },
@@ -3569,7 +4128,17 @@ window.__ModuleLoader__.load({
3569
4128
  h('div', { className: 'at-modalactions' },
3570
4129
  h('button', { className: 'at-btn', type: 'button', onClick: () => setNewOpen(false), disabled: nBusy }, t('cancel')),
3571
4130
  h('button', { className: 'at-btn at-btn-primary', type: 'submit', disabled: nBusy || !nName.trim() || !nWorkspace.trim() }, nBusy ? t('saving') : t('projectCreate'))))) : null,
3572
- dialog ? h(WorkbenchDialog, { key: dialogSeqRef.current, t, dialog }) : 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));
3573
4142
  }
3574
4143
 
3575
4144
  function PavilionMark({ size = 18 }) {