@suifei/dsh-ai-team 0.3.53 → 0.3.56

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
@@ -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
- * This is the M2.5 workbench client: it reads
11
- * `/ai-team/api/bootstrap`, falls back to embedded demo data, and every
12
- * write action only produces local feedback. The registration contract
13
- * (`sidebar.panellist` id `ai-team`, `main` key `ai-team`) is unchanged.
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
  */
@@ -55,6 +56,7 @@ window.__ModuleLoader__.load({
55
56
  follow: '关注',
56
57
  unfollow: '取消关注',
57
58
  convert: '转为 Task',
59
+ you: '你',
58
60
  reply: '回复此 Thread…',
59
61
  replyHint: '将基于 #{seq} 发送',
60
62
  replyHintNew: '将新建此 Task 的 Thread',
@@ -83,8 +85,8 @@ window.__ModuleLoader__.load({
83
85
  groupLess: '收起其余 {n} 项',
84
86
  fromDiscussion: '由讨论升格',
85
87
  loading: '加载中…',
86
- fallbackTitle: '演示数据',
87
- fallbackBody: 'bootstrap 接口(/ai-team)不可达,已使用内置样例;发送、关注、验收只做本地反馈,不写账本。',
88
+ loadFailedTitle: '工作台不可达',
89
+ loadFailedBody: 'bootstrap 接口(/ai-team)无法访问;请确认插件已启用后重试。',
88
90
  spike: 'AI Team',
89
91
  spikeTitle: '文渊阁 AI Team 工作台:修书、校勘、纂辑;方向、验收与账本。',
90
92
  navAria: '页面导航',
@@ -127,9 +129,8 @@ window.__ModuleLoader__.load({
127
129
  decisionReopened: '已重开一份可编辑的决策项。',
128
130
  decisionSubmit: '提交决策',
129
131
  decisionSubmitted: '决策已提交给团队。',
130
- inboxEmptyAction: '看任务看板',
131
- projectEmptyTitle: '还没有项目',
132
- projectEmptyBody: '创建项目属于 S-01;M1 之后接入。',
132
+ inboxEmptyAction: '看任务看板', projectEmptyTitle: '还没有项目',
133
+ projectEmptyBody: '用左栏「新建项目」创建第一个项目。',
133
134
  emptyColumn: '暂无',
134
135
  expandDone: '展开全部',
135
136
  collapseDone: '收起',
@@ -151,7 +152,6 @@ window.__ModuleLoader__.load({
151
152
  diff: '差异',
152
153
  noDiff: '未提供差异',
153
154
  taskActions: '任务动作',
154
- mockOnly: '仅演示,不写账本',
155
155
  actCancel: '取消任务',
156
156
  actReopen: '重开',
157
157
  actReassign: '改派…',
@@ -166,7 +166,6 @@ window.__ModuleLoader__.load({
166
166
  reassignNoTarget: '没有可改派的活跃成员。',
167
167
  actHandoff: '交接…',
168
168
  actDelete: '删除',
169
- actionMock: 'spike:{action} 需要二次确认并写账本,命令接入后启用。',
170
169
  convertTitle: '转为 Task',
171
170
  titleLabel: '标题',
172
171
  convertNamePlaceholder: '一句话说清要做什么',
@@ -175,15 +174,12 @@ window.__ModuleLoader__.load({
175
174
  convertContext: '上下文:引用 #{n} 的 {m} 条消息',
176
175
  convertCancel: '取消',
177
176
  convertSubmit: '创建 Task',
178
- convertMock: 'spike:将从 #{n} 创建 Task,并带上下文引用(命令未接入)。',
177
+ convertDone: '已创建 #{n},来自本 Thread。',
178
+ convertNoSource: '本 Thread 没有可锚定的账本消息,无法转为 Task。',
179
179
  conflictTitle: '你的回复基于较早的 Thread,已退回',
180
180
  conflictNew: 'Thread 已到 #{head}(新增 {n} 条)',
181
181
  conflictContinue: '基于最新继续写',
182
- conflictContext: '查看我当时的上下文',
183
- conflictContinueMock: 'spike:已把发送基线更新到 #{head}(不写账本)。',
184
- conflictContextMock: 'spike:将展示你在 #{base} 时的上下文(命令未接入)。',
185
- replyMock: 'spike:回复将基于 #{seq} 发送并写入账本(命令未接入)。',
186
- replyMockNew: 'spike:将新建 Thread 并写入回复(命令未接入)。',
182
+ conflictContinued: '已把发送基线更新到 #{head}。',
187
183
  replySent: '已写入 Thread #{seq}。',
188
184
  replyFailed: '回复失败:{message}',
189
185
  acceptNote: '工作台验收:已核对 Thread 与证据。',
@@ -192,13 +188,9 @@ window.__ModuleLoader__.load({
192
188
  changesNeedNote: '先把返工理由写在回复框,再点退回。',
193
189
  changesDone: '已退回 #{n},要求返工。',
194
190
  changesFailed: '退回失败:{message}',
195
- followMock: '已关注 #{n},写入账本。',
196
- unfollowMock: '已取消关注 #{n};完成、受阻或需要你决定时仍会出现在看板。',
197
- acceptMock: 'spike:接受 #{n} 将写验收记录并标记完成(命令未接入)。',
198
- changesMock: 'spike:退回需要至少 10 字原因并写账本(命令未接入)。',
199
- projectSwitchMock: 'spike:项目切换只更新视图标题;按项目读取账本在 M1 接入。',
200
- archivedMock: 'spike:归档项目只读;取消归档在 M3 接入。',
201
- agentMock: 'spike:成员详情(打开会话 / 发消息 / 记忆与技能)在 M3 接入。',
191
+ followedTask: '已关注 #{n},写入账本。',
192
+ unfollowedTask: '已取消关注 #{n};完成、受阻或需要你决定时仍会出现在看板。',
193
+ archivedNote: '归档项目只读;取消归档暂未开放。',
202
194
  agentOpen: '与 {name} 对话',
203
195
  moreActions: '更多操作',
204
196
  agentChat: '直接对话',
@@ -216,7 +208,6 @@ window.__ModuleLoader__.load({
216
208
  teamPulseAgents: '运行中:{names}',
217
209
  newProject: '新建项目',
218
210
  addAgent: '添加成员',
219
- newProjectMock: 'spike:新建项目属于 S-01 流程,M1 之后接入。',
220
211
  newProjectTitle: '新建项目',
221
212
  projectName: '项目名',
222
213
  projectGoal: '目标',
@@ -251,7 +242,6 @@ window.__ModuleLoader__.load({
251
242
  projectCreate: '创建项目',
252
243
  projectCreated: '已创建项目 {name}。',
253
244
  projectSwitched: '已切换项目。',
254
- addAgentMock: 'spike:添加成员在 M1 之后接入。',
255
245
  addAgentTitle: '添加成员',
256
246
  memberName: '名字',
257
247
  memberRole: '职责',
@@ -275,6 +265,7 @@ window.__ModuleLoader__.load({
275
265
  memberAdding: '正在创建…',
276
266
  memberAdded: '成员已创建并激活。',
277
267
  cancel: '取消',
268
+ dialogConfirm: '确定',
278
269
  memberProfileTitle: '成员资料',
279
270
  memberProfileTitleName: '成员资料 · {name}',
280
271
  memberProfileMeta: '{status} · 资料 v{version} · 蒸馏 v{distill}',
@@ -308,14 +299,14 @@ window.__ModuleLoader__.load({
308
299
  recruit: '重新招募',
309
300
  profileSaved: '成员资料已保存,下一次唤醒生效。',
310
301
  profileDistilled: '已重新蒸馏并记录新版本。',
311
- conversationMock: 'spike:宿主没有可用的 layout.selectPanel(conversation)。',
312
302
  discussSent: '已发送给 Project owner。',
313
303
  taskSent: '已创建 Task。',
314
304
  sendFailed: '发送失败:{message}',
305
+ duplicateTask: '相同 Task 已存在(#{number}),已为你打开它。',
306
+ qaNeedsChecklist: 'QA Task 至少需要一条验收清单。',
315
307
  pendingHuman: '待你处理',
316
308
  inboxUnread: '收件箱,{n} 条未读',
317
309
  dismiss: '关闭提示',
318
- retry: '重试',
319
310
  crashTitle: '工作台渲染失败',
320
311
  noProject: '未选择项目',
321
312
  archivedCount: '已归档 {n}',
@@ -345,8 +336,7 @@ window.__ModuleLoader__.load({
345
336
  catDone: '已完成',
346
337
  waitOn: '等 {ref}',
347
338
  waitDependency: '依赖未完成',
348
- decisionMock: 'spike:决策项需要在收件箱页处理(M1 之后接入),当前只在态势里展示。',
349
- quadrantMissing: 'spike:该条目对应的 Task 不在当前 bootstrap 数据里。',
339
+ quadrantMissing: '该条目对应的 Task 不在当前数据里。',
350
340
  filterLabel: '筛选:{name}',
351
341
  filterClear: '清除筛选',
352
342
  filterInboxExtra: '另有 {n} 条收件箱决策项',
@@ -395,6 +385,7 @@ window.__ModuleLoader__.load({
395
385
  follow: 'Follow',
396
386
  unfollow: 'Unfollow',
397
387
  convert: 'Turn into task',
388
+ you: 'You',
398
389
  reply: 'Reply to this thread…',
399
390
  replyHint: 'Will send on #{seq}',
400
391
  replyHintNew: 'Will start a new thread',
@@ -423,8 +414,8 @@ window.__ModuleLoader__.load({
423
414
  groupLess: 'Collapse {n}',
424
415
  fromDiscussion: 'Promoted from discussion',
425
416
  loading: 'Loading…',
426
- fallbackTitle: 'Demo data',
427
- fallbackBody: 'The bootstrap endpoint (/ai-team) is unreachable, so the embedded sample is shown. Sending, following and acceptance only give local feedback; nothing is written to the ledger.',
417
+ loadFailedTitle: 'Workbench unreachable',
418
+ loadFailedBody: 'The bootstrap endpoint (/ai-team) cannot be reached; confirm the plugin is enabled and retry.',
428
419
  spike: 'AI Team',
429
420
  spikeTitle: 'Wenyuan Pavilion AI Team workbench: compile, collate, edit; direction, acceptance and ledger.',
430
421
  navAria: 'Page navigation',
@@ -469,7 +460,7 @@ window.__ModuleLoader__.load({
469
460
  decisionSubmitted: 'Decision sent to the team.',
470
461
  inboxEmptyAction: 'Open the board',
471
462
  projectEmptyTitle: 'No projects yet',
472
- projectEmptyBody: 'Project creation belongs to S-01; it lands after M1.',
463
+ projectEmptyBody: 'Create the first project with “New project” in the sidebar.',
473
464
  emptyColumn: 'None',
474
465
  expandDone: 'Show all',
475
466
  collapseDone: 'Collapse',
@@ -491,7 +482,6 @@ window.__ModuleLoader__.load({
491
482
  diff: 'Diff',
492
483
  noDiff: 'No diff provided',
493
484
  taskActions: 'Task actions',
494
- mockOnly: 'Demo only; nothing is written',
495
485
  actCancel: 'Cancel task',
496
486
  actReopen: 'Reopen',
497
487
  actReassign: 'Reassign…',
@@ -506,7 +496,6 @@ window.__ModuleLoader__.load({
506
496
  reassignNoTarget: 'No active member is available for reassignment.',
507
497
  actHandoff: 'Hand off…',
508
498
  actDelete: 'Delete',
509
- actionMock: 'spike: {action} needs confirmation and a ledger write; enabled when commands land.',
510
499
  convertTitle: 'Turn into task',
511
500
  titleLabel: 'Title',
512
501
  convertNamePlaceholder: 'One line about what needs doing',
@@ -515,15 +504,12 @@ window.__ModuleLoader__.load({
515
504
  convertContext: 'Context: {m} messages from #{n}',
516
505
  convertCancel: 'Cancel',
517
506
  convertSubmit: 'Create task',
518
- convertMock: 'spike: will create a task from #{n} with context refs (commands not wired).',
507
+ convertDone: 'Created #{n} from this thread.',
508
+ convertNoSource: 'This thread has no ledger messages to anchor; cannot convert.',
519
509
  conflictTitle: 'Your reply was based on an older thread and was returned',
520
510
  conflictNew: 'Thread is at #{head} ({n} new)',
521
511
  conflictContinue: 'Continue from latest',
522
- conflictContext: 'See what I had',
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).',
512
+ conflictContinued: 'Send baseline moved to #{head}.',
527
513
  replySent: 'Written to Thread #{seq}.',
528
514
  replyFailed: 'Reply failed: {message}',
529
515
  acceptNote: 'Workbench acceptance: Thread and evidence reviewed.',
@@ -532,13 +518,9 @@ window.__ModuleLoader__.load({
532
518
  changesNeedNote: 'Write the change request in the reply box first.',
533
519
  changesDone: 'Changes requested on #{n}.',
534
520
  changesFailed: 'Change request failed: {message}',
535
- followMock: 'Following #{n}; written to the ledger.',
536
- unfollowMock: 'Unfollowed #{n}; completion, blockage or decisions still appear on the board.',
537
- acceptMock: 'spike: accepting #{n} will write an acceptance record and mark it done (commands not wired).',
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.',
521
+ followedTask: 'Following #{n}; written to the ledger.',
522
+ unfollowedTask: 'Unfollowed #{n}; completion, blockage or decisions still appear on the board.',
523
+ archivedNote: 'Archived projects are read-only; unarchive is not available yet.',
542
524
  agentOpen: 'Chat with {name}',
543
525
  moreActions: 'More actions',
544
526
  agentChat: 'Direct chat',
@@ -556,7 +538,6 @@ window.__ModuleLoader__.load({
556
538
  teamPulseAgents: 'Running: {names}',
557
539
  newProject: 'New project',
558
540
  addAgent: 'Add member',
559
- newProjectMock: 'spike: project creation belongs to S-01 and lands after M1.',
560
541
  newProjectTitle: 'New project',
561
542
  projectName: 'Project name',
562
543
  projectGoal: 'Goal',
@@ -591,7 +572,6 @@ window.__ModuleLoader__.load({
591
572
  projectCreate: 'Create project',
592
573
  projectCreated: 'Created project {name}.',
593
574
  projectSwitched: 'Switched project.',
594
- addAgentMock: 'spike: adding members lands after M1.',
595
575
  addAgentTitle: 'Add member',
596
576
  memberName: 'Name',
597
577
  memberRole: 'Role',
@@ -615,6 +595,7 @@ window.__ModuleLoader__.load({
615
595
  memberAdding: 'Creating…',
616
596
  memberAdded: 'Member created and activated.',
617
597
  cancel: 'Cancel',
598
+ dialogConfirm: 'OK',
618
599
  memberProfileTitle: 'Member profile',
619
600
  memberProfileTitleName: 'Member profile · {name}',
620
601
  memberProfileMeta: '{status} · profile v{version} · distill v{distill}',
@@ -648,18 +629,14 @@ window.__ModuleLoader__.load({
648
629
  recruit: 'Recruit',
649
630
  profileSaved: 'Profile saved; effective on the next wake.',
650
631
  profileDistilled: 'Re-distilled and recorded as a new version.',
651
- conversationMock: 'spike: this host has no working layout.selectPanel(conversation).',
652
632
  discussSent: 'Sent to the Project owner.',
653
633
  taskSent: 'Task created.',
654
634
  duplicateTask: 'An identical Task already exists (#{number}); opened it instead.',
655
635
  qaNeedsChecklist: 'A QA Task needs at least one checklist item.',
656
- duplicateTask: '相同 Task 已存在(#{number}),已为你打开它。',
657
- qaNeedsChecklist: 'QA Task 至少需要一条验收清单。',
658
636
  sendFailed: 'Send failed: {message}',
659
637
  pendingHuman: 'Needs you',
660
638
  inboxUnread: 'Inbox, {n} unread',
661
639
  dismiss: 'Dismiss',
662
- retry: 'Retry',
663
640
  crashTitle: 'Workbench failed to render',
664
641
  noProject: 'No project selected',
665
642
  archivedCount: 'Archived {n}',
@@ -689,8 +666,7 @@ window.__ModuleLoader__.load({
689
666
  catDone: 'Done',
690
667
  waitOn: 'waiting on {ref}',
691
668
  waitDependency: 'dependency unfinished',
692
- decisionMock: 'spike: decisions are handled on the inbox page (after M1); for now they only show in Situation.',
693
- quadrantMissing: 'spike: the Task behind this item is not in the current bootstrap data.',
669
+ quadrantMissing: 'The Task behind this item is not in the current data.',
694
670
  filterLabel: 'Filter: {name}',
695
671
  filterClear: 'Clear filter',
696
672
  filterInboxExtra: '{n} inbox decision item(s) not on the board',
@@ -707,105 +683,6 @@ window.__ModuleLoader__.load({
707
683
  doneNoInfo: 'No completion details recorded',
708
684
  };
709
685
 
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
686
  const STATUS = {
810
687
  pending: { label: 'stPending', tone: 'idle' },
811
688
  in_progress: { label: 'stInProgress', tone: 'business' },
@@ -837,9 +714,7 @@ window.__ModuleLoader__.load({
837
714
  stalled: 'catStalled',
838
715
  done: 'catDone',
839
716
  };
840
- const Q1_ORDER = { irreversible: 0, review: 1, decision: 2, owner_blocked: 3 };
841
717
  const TABS = ['main', 'board', 'situation'];
842
-
843
718
  const cx = (...parts) => parts.filter(Boolean).join(' ');
844
719
  const tf = (t, key, vars) => String(t(key)).replace(/\{(\w+)\}/g, (match, name) => (
845
720
  vars && Object.prototype.hasOwnProperty.call(vars, name) ? String(vars[name]) : match
@@ -896,95 +771,19 @@ window.__ModuleLoader__.load({
896
771
  && !(Array.isArray(item.ref?.questions) && item.ref.questions.length > 0);
897
772
  }
898
773
 
899
- /** Derive the read-only quadrants projection from the bootstrap DTO (spike fallback). */
774
+ /** The host computes quadrants; the client only renders them (single read model). */
900
775
  function deriveQuadrants(data) {
901
- const direct = data?.quadrants;
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
- };
776
+ return data?.quadrants ?? null;
981
777
  }
982
778
 
983
779
  /** Only the four board columns; `blocked` stays a badge, never a column. */
984
- function matchesFilter(task, filter) {
985
- if (filter === 'q1') return task.status === 'pending_acceptance' || (task.owner === '你' && task.status === 'pending' && (task.blockedBy?.length || task.handoffTo));
780
+ function matchesFilter(task, filter, humanId) {
781
+ if (filter === 'q1') {
782
+ return task.status === 'pending_acceptance'
783
+ || (task.ownerId === humanId && task.status === 'pending' && task.blocked === true);
784
+ }
986
785
  if (filter === 'q2') return task.status === 'in_progress';
987
- if (filter === 'q3') return task.status === 'pending' && (task.blockedBy?.length || task.handoffTo);
786
+ if (filter === 'q3') return task.status === 'pending' && task.blocked === true;
988
787
  if (filter === 'q4') return task.status === 'done';
989
788
  return true;
990
789
  }
@@ -993,7 +792,7 @@ window.__ModuleLoader__.load({
993
792
  .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
793
  .at-root *, .at-root *::before, .at-root *::after { box-sizing: border-box; }
995
794
  .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 rgba(0,0,0,.16); color: var(--dsw-alias-label-primary); font-size: 12px; line-height: 18px; }
795
+ .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
796
  .at-toasticon { display: inline-flex; color: var(--dsw-alias-state-business-primary); flex: 0 0 auto; }
998
797
  .at-toasttext { min-width: 0; overflow-wrap: anywhere; }
999
798
  .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 +807,11 @@ window.__ModuleLoader__.load({
1008
807
  .at-mobilesummary::-webkit-details-marker { display: none; }
1009
808
  .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
809
  .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
810
  .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
811
  .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
- .at-right { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-layer-1); }
812
+ /* 右栏是覆盖层(fixed 语义的 absolute 覆盖,不占网格列):任何宽度下
813
+ 开/关线程面板都不挤压中栏、不触发整栏重排(规格 #6)。 */
814
+ .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
815
  .at-nav { display: flex; flex-direction: column; gap: 1px; }
1016
816
  .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
817
  .at-navrow:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
@@ -1297,7 +1097,6 @@ window.__ModuleLoader__.load({
1297
1097
  .at-actions { margin: 12px 0; padding-top: 12px; border-top: 1px solid var(--dsw-alias-border-l1); }
1298
1098
  .at-actionhead { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
1299
1099
  .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
1100
  .at-actionrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
1302
1101
  .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
1102
  .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; }
@@ -1342,13 +1141,13 @@ window.__ModuleLoader__.load({
1342
1141
  }
1343
1142
  @container at-wb (max-width: 1119px) {
1344
1143
  .at-grid, .at-grid.at-withthread { grid-template-columns: 200px minmax(0, 1fr); }
1345
- .at-right { position: absolute; top: 0; right: 0; bottom: 0; z-index: 10; width: min(420px, 100%); border-left: 1px solid var(--dsw-alias-border-l1); box-shadow: var(--dsw-elevation-panel, 0 8px 24px var(--dsw-alias-bg-mask-2)); }
1144
+ .at-right { width: min(420px, 100%); }
1346
1145
  .at-boardwrap { padding: 12px; }
1347
1146
  .at-board { gap: 8px; }
1348
1147
  }
1349
1148
  @container at-wb (max-width: 959px) {
1350
1149
  .at-grid, .at-grid.at-withthread { grid-template-columns: 200px minmax(0, 1fr); }
1351
- .at-right { top: 0; right: 0; bottom: 0; width: 100%; max-width: none; border-left: 0; }
1150
+ .at-right { width: 100%; max-width: none; border-left: 0; box-shadow: none; }
1352
1151
  .at-board { grid-template-columns: minmax(0, 1fr); }
1353
1152
  .at-quadrants { grid-template-columns: minmax(0, 1fr); }
1354
1153
  .at-chead { padding: 10px 12px 0; }
@@ -1541,11 +1340,12 @@ window.__ModuleLoader__.load({
1541
1340
 
1542
1341
  function StreamMessage({ t, item, data, tasks, selected, follows, onOpen, onToggleFollow }) {
1543
1342
  const author = item.author ?? {};
1544
- const human = author.kind === 'human' || author.name === '你';
1343
+ // 结构化判定:kind 是权威字段;显示名回退只兼容旧账本流。
1344
+ const human = author.kind === 'human' || (author.kind === undefined && agentFor(data, author.name) === null && author.name === t('you'));
1545
1345
  const agent = agentFor(data, author.name);
1546
1346
  const cards = (item.taskIds ?? []).map((id) => tasks.find((task) => task.id === id)).filter(Boolean);
1547
1347
  return h('article', { className: cx('at-msg', human && 'at-msg-human') },
1548
- h(Avatar, { name: author.name ?? (human ? '你' : '?'), human }),
1348
+ h(Avatar, { name: author.name ?? (human ? t('you') : '?'), human }),
1549
1349
  h('div', { className: 'at-msgb' },
1550
1350
  h('div', { className: 'at-msgh' },
1551
1351
  h('b', null, author.name ?? '—'),
@@ -1560,10 +1360,90 @@ window.__ModuleLoader__.load({
1560
1360
  function ToastStack({ t, toasts, onClose }) {
1561
1361
  if (toasts.length === 0) return null;
1562
1362
  return h('div', { className: 'at-toaststack', role: 'status', 'aria-live': 'polite' },
1563
- toasts.map((toast) => h('div', { className: 'at-toast', key: toast.id },
1564
- h('span', { className: 'at-toasticon', 'aria-hidden': 'true' }, h(Ico, { name: 'inbox', size: 13 })),
1565
- h('span', { className: 'at-toasttext' }, toast.text),
1566
- h('button', { className: 'at-toastclose', type: 'button', 'aria-label': t('notifyClose'), onClick: () => onClose(toast.id) }, '×'))));
1363
+ toasts.map((toast) => h(ToastRow, { key: toast.id, toast, t, onClose })));
1364
+ }
1365
+
1366
+ /** One toast row owning its own expiry timer (cleared on unmount). */
1367
+ function ToastRow({ t, toast, onClose }) {
1368
+ React.useEffect(() => {
1369
+ const timer = setTimeout(() => onClose(toast.id), 7000);
1370
+ return () => clearTimeout(timer);
1371
+ }, []);
1372
+ return h('div', { className: 'at-toast' },
1373
+ h('span', { className: 'at-toasticon', 'aria-hidden': 'true' }, h(Ico, { name: 'inbox', size: 13 })),
1374
+ h('span', { className: 'at-toasttext' }, toast.text),
1375
+ h('button', { className: 'at-toastclose', type: 'button', 'aria-label': t('notifyClose'), onClick: () => onClose(toast.id) }, '×'));
1376
+ }
1377
+
1378
+ /**
1379
+ * Shared modal backdrop: Escape closes, Tab stays inside the dialog.
1380
+ * Module-level so React sees a stable component type across renders.
1381
+ */
1382
+ function ModalBack({ onClose, children }) {
1383
+ const backRef = React.useRef(null);
1384
+ const onCloseRef = React.useRef(onClose);
1385
+ onCloseRef.current = onClose;
1386
+ React.useEffect(() => {
1387
+ const onKey = (event) => {
1388
+ if (event.defaultPrevented) return;
1389
+ if (event.key === 'Escape') {
1390
+ event.preventDefault();
1391
+ event.stopPropagation();
1392
+ onCloseRef.current();
1393
+ return;
1394
+ }
1395
+ if (event.key !== 'Tab' || !backRef.current) return;
1396
+ const focusables = backRef.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
1397
+ if (focusables.length === 0) {
1398
+ event.preventDefault();
1399
+ return;
1400
+ }
1401
+ const first = focusables[0];
1402
+ const last = focusables[focusables.length - 1];
1403
+ if (event.shiftKey && document.activeElement === first) {
1404
+ event.preventDefault();
1405
+ last.focus();
1406
+ } else if (!event.shiftKey && document.activeElement === last) {
1407
+ event.preventDefault();
1408
+ first.focus();
1409
+ }
1410
+ };
1411
+ window.addEventListener('keydown', onKey);
1412
+ return () => window.removeEventListener('keydown', onKey);
1413
+ }, []);
1414
+ return h('div', { className: 'at-modalback', ref: backRef }, children);
1415
+ }
1416
+
1417
+ /**
1418
+ * 自绘确认/输入对话框(替代原生 confirm/prompt):confirm 布尔、
1419
+ * prompt 文本、choice 选项。模块级组件 + 调用方自增 key 保证每次
1420
+ * 新对话框重建(输入初始值生效)。
1421
+ */
1422
+ function WorkbenchDialog({ t, dialog }) {
1423
+ 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());
1426
+ const canSubmit = dialog.mode === 'confirm' || value.trim() !== '';
1427
+ return h(ModalBack, { onClose: cancel },
1428
+ h('div', { className: 'at-modal', role: 'dialog', 'aria-modal': 'true', 'aria-label': dialog.title },
1429
+ h('h2', { className: 'at-modaltitle' }, dialog.title),
1430
+ dialog.body ? h('p', { className: 'at-modalmeta' }, dialog.body) : null,
1431
+ dialog.mode === 'prompt'
1432
+ ? h('input', {
1433
+ value,
1434
+ onChange: (event) => setValue(event.target.value),
1435
+ placeholder: dialog.placeholder ?? '',
1436
+ autoFocus: true,
1437
+ onKeyDown: (event) => { if (event.key === 'Enter' && canSubmit) submit(); },
1438
+ })
1439
+ : null,
1440
+ dialog.mode === 'choice'
1441
+ ? h('select', { value, onChange: (event) => setValue(event.target.value), autoFocus: true },
1442
+ (dialog.options ?? []).map((option) => h('option', { key: option, value: option }, option)))
1443
+ : null,
1444
+ h('div', { className: 'at-modalactions' },
1445
+ 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')))));
1567
1447
  }
1568
1448
 
1569
1449
  function EmptyState({ t, icon, title, body, action, compact }) {
@@ -1598,8 +1478,8 @@ window.__ModuleLoader__.load({
1598
1478
  })));
1599
1479
  }
1600
1480
 
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)))
1481
+ function Board({ t, tasks, selected, follows, doneOpen, onToggleDone, onOpen, onToggleFollow, filter, onClearFilter, q1Extra, onBackMain, onOpenInbox, humanId }) {
1482
+ const filtered = (filter === 'all' ? tasks : tasks.filter((task) => matchesFilter(task, filter, humanId)))
1603
1483
  .slice()
1604
1484
  .sort((left, right) => (right.number ?? 0) - (left.number ?? 0));
1605
1485
  const filterName = filter === 'all' ? '' : t(filter === 'q1' ? 'q1Title' : filter === 'q2' ? 'q2Title' : filter === 'q3' ? 'q3Title' : 'q4Title');
@@ -1959,15 +1839,14 @@ window.__ModuleLoader__.load({
1959
1839
  }, task.irreversible ? t('acceptIrreversibleCta') : t('acceptCta'))));
1960
1840
  }
1961
1841
 
1962
- function ConflictBanner({ t, thread, baseSeq, headSeq, onContinue, onContext }) {
1842
+ function ConflictBanner({ t, thread, baseSeq, headSeq, onContinue }) {
1963
1843
  const changes = Array.isArray(thread?.changes) ? thread.changes.slice(0, 5) : [];
1964
1844
  return h('div', { className: 'at-conflict', role: 'alert' },
1965
1845
  h('div', { className: 'at-conflicttitle' }, t('conflictTitle')),
1966
1846
  h('div', { className: 'at-conflictnew' }, tf(t, 'conflictNew', { head: headSeq, n: headSeq - baseSeq })),
1967
1847
  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
1848
  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'))));
1849
+ h('button', { className: 'at-btn at-btn-quiet', type: 'button', onClick: onContinue }, t('conflictContinue'))));
1971
1850
  }
1972
1851
 
1973
1852
  function DoneSummary({ t, task }) {
@@ -2000,7 +1879,7 @@ window.__ModuleLoader__.load({
2000
1879
  h('div', { className: 'at-kvbody' }, task.updatedAt ? fmtDateTime(task.updatedAt) : '—'))));
2001
1880
  }
2002
1881
 
2003
- function ThreadPanel({ t, task, thread, project, following, onToggleFollow, onClose, onChat, converting, convert, reply, onReplyChange, onReplySend, replyBase, onContinue, onContext, note, onDismissNote, acceptChecked, onAcceptChecked, qaChecks, onQaCheck, onAccept, onChanges, actions, panelRef, replyRef }) {
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 }) {
2004
1883
  const headSeq = thread?.headSeq ?? thread?.entries?.length ?? 0;
2005
1884
  const stale = replyBase !== null && replyBase !== undefined && headSeq > replyBase;
2006
1885
  const entries = Array.isArray(thread?.entries) ? thread.entries : [];
@@ -2019,7 +1898,7 @@ window.__ModuleLoader__.load({
2019
1898
  converting
2020
1899
  ? 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
1900
  : h('div', { className: 'at-rbody' },
2022
- stale ? h(ConflictBanner, { t, thread, baseSeq: replyBase, headSeq, onContinue, onContext }) : null,
1901
+ stale ? h(ConflictBanner, { t, thread, baseSeq: replyBase, headSeq, onContinue }) : null,
2023
1902
  task.status === 'done' ? h(DoneSummary, { t, task }) : h(TaskDetail, { t, task }),
2024
1903
  entries.length
2025
1904
  ? h('div', { className: 'at-tmsgs' }, entries.map((message, index) => h('div', { key: message.seq ?? index, className: 'at-tmsg' },
@@ -2181,6 +2060,11 @@ window.__ModuleLoader__.load({
2181
2060
  }
2182
2061
 
2183
2062
  function Situation({ t, quadrants, tasks, onItem, onViewAll }) {
2063
+ if (!quadrants) {
2064
+ return h('div', { className: 'at-situation', role: 'tabpanel', id: 'at-panel-situation', 'aria-labelledby': 'at-tab-situation' },
2065
+ h('div', { className: 'at-situationinner' },
2066
+ h(EmptyState, { t, icon: 'dot', title: t('situationAria'), body: '' })));
2067
+ }
2184
2068
  return h('div', { className: 'at-situation', role: 'tabpanel', id: 'at-panel-situation', 'aria-labelledby': 'at-tab-situation' },
2185
2069
  h('div', { className: 'at-situationinner' },
2186
2070
  h('div', { className: 'at-qmeta' },
@@ -2285,6 +2169,7 @@ window.__ModuleLoader__.load({
2285
2169
  function Workbench({ t, ctx }) {
2286
2170
  const [phase, setPhase] = React.useState('loading');
2287
2171
  const [data, setData] = React.useState(null);
2172
+ const [loadError, setLoadError] = React.useState('');
2288
2173
  const [projectId, setProjectId] = React.useState('');
2289
2174
  const [scope, setScope] = React.useState('project');
2290
2175
  const [tab, setTab] = React.useState('main');
@@ -2344,62 +2229,102 @@ window.__ModuleLoader__.load({
2344
2229
  const [pBusy, setPBusy] = React.useState(false);
2345
2230
  const [pError, setPError] = React.useState('');
2346
2231
  const [replyBase, setReplyBase] = React.useState(null);
2232
+ // 自绘确认/输入对话框(替代原生 prompt/confirm,观感与宿主一致)。
2233
+ // dialog: { mode: 'confirm'|'prompt'|'choice', title, body, placeholder,
2234
+ // value, options, resolve } — resolve(false|null|字符串)。
2235
+ const [dialog, setDialog] = React.useState(null);
2236
+ const dialogSeqRef = React.useRef(0);
2237
+ // 每次打开新对话框自增 key:WorkbenchDialog 以全新实例挂载,
2238
+ // 输入框的初始值(useState 初值)随之生效。
2239
+ const askConfirm = (title, body) => new Promise((resolve) => {
2240
+ dialogSeqRef.current += 1;
2241
+ setDialog({ mode: 'confirm', title, body, resolve });
2242
+ });
2243
+ const askPrompt = (title, { placeholder = '', value = '', options = null } = {}) => new Promise((resolve) => {
2244
+ dialogSeqRef.current += 1;
2245
+ setDialog({
2246
+ mode: options === null ? 'prompt' : 'choice',
2247
+ title,
2248
+ placeholder,
2249
+ value: value ?? (options && options.length > 0 ? options[0] : ''),
2250
+ options,
2251
+ resolve,
2252
+ });
2253
+ });
2347
2254
  const rightRef = React.useRef(null);
2348
2255
  const replyRef = React.useRef(null);
2349
2256
  const triggerRef = React.useRef(null);
2350
2257
  const mobileRef = React.useRef(null);
2258
+ // Latest-data mirror for effects that must react to `selected` alone,
2259
+ // and a monotonically increasing load sequence so a stale bootstrap
2260
+ // response can never overwrite a newer one.
2261
+ const dataRef = React.useRef(null);
2262
+ const loadSeqRef = React.useRef(0);
2263
+ const applyData = (next) => {
2264
+ dataRef.current = next;
2265
+ setData(next);
2266
+ };
2351
2267
 
2352
2268
  React.useEffect(() => {
2353
2269
  let alive = true;
2354
2270
  const controller = typeof AbortController === 'function' ? new AbortController() : null;
2355
2271
  // The package is @suifei/dsh-ai-team; the Host prefix is /ai-team.
2356
2272
  const query = projectId ? '?project=' + encodeURIComponent(projectId) : '';
2357
- const paths = ['/ai-team/api/bootstrap' + query];
2358
2273
  async function load() {
2274
+ const seq = ++loadSeqRef.current;
2359
2275
  let lastError = null;
2360
- for (const path of paths) {
2361
- try {
2362
- const response = await fetch(path, {
2363
- headers: { accept: 'application/json' },
2364
- signal: controller ? controller.signal : undefined,
2365
- });
2366
- if (!response.ok) {
2367
- lastError = new Error('HTTP ' + response.status + ' for ' + path);
2368
- continue;
2369
- }
2370
- const next = normalizePayload(await response.json());
2371
- if (!next) {
2372
- lastError = new Error('invalid bootstrap payload from ' + path);
2373
- continue;
2374
- }
2375
- if (!alive) return;
2376
- setData(next);
2377
- setPhase('ready');
2378
- return;
2379
- } catch (error) {
2380
- lastError = error;
2381
- if (!alive || (controller && controller.signal.aborted)) return;
2382
- }
2276
+ try {
2277
+ const response = await fetch('/ai-team/api/bootstrap' + query, {
2278
+ headers: { accept: 'application/json' },
2279
+ signal: controller ? controller.signal : undefined,
2280
+ });
2281
+ if (!response.ok) throw new Error('HTTP ' + response.status + ' for /ai-team/api/bootstrap');
2282
+ const next = normalizePayload(await response.json());
2283
+ if (!next) throw new Error('invalid bootstrap payload');
2284
+ if (!alive || seq !== loadSeqRef.current) return;
2285
+ applyData(next);
2286
+ setLoadError('');
2287
+ setPhase('ready');
2288
+ return;
2289
+ } catch (error) {
2290
+ lastError = error;
2291
+ if (!alive || (controller && controller.signal.aborted)) return;
2292
+ }
2293
+ if (seq !== loadSeqRef.current) return;
2294
+ // First load: an honest error state with retry. Refresh failure:
2295
+ // keep the current data, only record the diagnostic.
2296
+ if (dataRef.current === null) {
2297
+ console.error(PKG + ': bootstrap unavailable', lastError);
2298
+ setLoadError(lastError?.message ?? String(lastError ?? 'unknown'));
2299
+ setPhase('error');
2300
+ } else {
2301
+ console.error(PKG + ': bootstrap refresh failed, keeping current data', lastError);
2383
2302
  }
2384
- if (!alive) return;
2385
- console.error(PKG + ': bootstrap unavailable, using embedded demo data', lastError);
2386
- setData(MOCK);
2387
- setPhase('fallback');
2388
2303
  }
2389
2304
  load();
2390
2305
  // Event-driven refresh only; the Host sends one frame per command and
2391
- // no heartbeat/timer. EventSource reconnects on its own.
2392
- const source = typeof EventSource === 'function'
2393
- ? new EventSource('/ai-team/api/projects/' + encodeURIComponent(projectId || 'prj_main') + '/events')
2306
+ // no heartbeat/timer. EventSource reconnects on its own; a project is
2307
+ // required — no magic fallback id here.
2308
+ const source = typeof EventSource === 'function' && projectId
2309
+ ? new EventSource('/ai-team/api/projects/' + encodeURIComponent(projectId) + '/events')
2394
2310
  : null;
2395
- if (source) source.addEventListener('change', (raw) => {
2396
- if (!alive) return;
2397
- try {
2398
- const frame = JSON.parse(raw.data);
2399
- pushToast(notificationText(frame?.event));
2400
- } catch { /* malformed frame ignored */ }
2401
- load();
2402
- });
2311
+ if (source) {
2312
+ source.addEventListener('change', (raw) => {
2313
+ if (!alive) return;
2314
+ try {
2315
+ const frame = JSON.parse(raw.data);
2316
+ pushToast(notificationText(frame?.event));
2317
+ } catch (error) {
2318
+ console.error(PKG + ': malformed SSE frame', error);
2319
+ }
2320
+ load();
2321
+ });
2322
+ source.addEventListener('error', () => {
2323
+ // One-shot diagnostic: EventSource reconnects by itself; this row
2324
+ // only makes the console explain why the panel may lag behind.
2325
+ if (alive && dataRef.current === null) console.error(PKG + ': event stream unavailable (retrying)');
2326
+ });
2327
+ }
2403
2328
  return () => {
2404
2329
  alive = false;
2405
2330
  if (controller) controller.abort();
@@ -2441,17 +2366,21 @@ window.__ModuleLoader__.load({
2441
2366
  if (!selected && data.tasks[0]) setSelected(data.tasks[0].id);
2442
2367
  }, [data, projectId, selected]);
2443
2368
 
2369
+ // Reset the right-panel editing state only when the selected Task
2370
+ // changes — a background refresh (SSE) must never wipe a draft the
2371
+ // user is typing or QA boxes they already ticked.
2444
2372
  React.useEffect(() => {
2445
- const thread = threadFor(data, selected);
2373
+ const current = dataRef.current;
2374
+ const thread = threadFor(current, selected);
2446
2375
  setReplyBase(thread?.baseSeq ?? null);
2447
2376
  setAcceptChecked(false);
2448
- const nextTask = data?.tasks?.find((task) => task.id === selected) ?? data?.tasks?.[0];
2377
+ const nextTask = current?.tasks?.find((task) => task.id === selected) ?? current?.tasks?.[0];
2449
2378
  setQaChecks((nextTask?.qaChecklist ?? []).map((item) => ({ item, passed: false })));
2450
2379
  setConverting(false);
2451
2380
  setCTitle('');
2452
2381
  setCDod('');
2453
2382
  setRightNote('');
2454
- }, [selected, data]);
2383
+ }, [selected]);
2455
2384
 
2456
2385
  React.useEffect(() => {
2457
2386
  if (!threadOpen) return;
@@ -2472,6 +2401,8 @@ window.__ModuleLoader__.load({
2472
2401
  if (!threadOpen) return undefined;
2473
2402
  const onKey = (event) => {
2474
2403
  if (event.key !== 'Escape') return;
2404
+ // Host overlays handle Escape first (defaultPrevented); don't swallow.
2405
+ if (event.defaultPrevented) return;
2475
2406
  event.preventDefault();
2476
2407
  event.stopPropagation();
2477
2408
  if (converting) { setConverting(false); return; }
@@ -2481,6 +2412,14 @@ window.__ModuleLoader__.load({
2481
2412
  return () => window.removeEventListener('keydown', onKey);
2482
2413
  }, [threadOpen, converting]);
2483
2414
 
2415
+ if (phase === 'error' && !data) {
2416
+ return h('div', { className: 'at-root', role: 'alert' },
2417
+ h('div', { className: 'at-empty' },
2418
+ h('span', { className: 'at-emptyicon', 'aria-hidden': 'true' }, h(Ico, { name: 'alert', size: 28 })),
2419
+ h('div', { className: 'at-emptytitle' }, t('loadFailedTitle')),
2420
+ h('div', { className: 'at-emptybody' }, loadError || t('loadFailedBody')),
2421
+ h('button', { className: 'at-btn', type: 'button', onClick: () => { setPhase('loading'); location.reload(); } }, t('retry'))));
2422
+ }
2484
2423
  if (phase === 'loading' || !data) return h(Skeleton, { t });
2485
2424
 
2486
2425
  const projectRecord = data.projects.find((item) => item.id === projectId) ?? data.projects[0] ?? null;
@@ -2488,6 +2427,7 @@ window.__ModuleLoader__.load({
2488
2427
  ...projectRecord,
2489
2428
  workspacePath: projectRecord.workspacePath || (data.project?.id === projectRecord.id ? data.project.workspacePath ?? '' : ''),
2490
2429
  };
2430
+ const humanId = (data.members ?? []).find((member) => member.kind === 'human')?.id ?? null;
2491
2431
  const tasks = data.tasks;
2492
2432
  const boardTaskCount = tasks.filter((task) => ['pending', 'in_progress', 'pending_acceptance', 'done'].includes(task.status)).length;
2493
2433
  const selectedTask = tasks.find((task) => task.id === selected) ?? tasks[0] ?? null;
@@ -2525,7 +2465,7 @@ window.__ModuleLoader__.load({
2525
2465
  async function toggleFollow(card) {
2526
2466
  if (!card) return;
2527
2467
  const next = !followingOf(card);
2528
- const text = next ? tf(t, 'followMock', { n: taskNo(card) }) : tf(t, 'unfollowMock', { n: taskNo(card) });
2468
+ const text = next ? tf(t, 'followedTask', { n: taskNo(card) }) : tf(t, 'unfollowedTask', { n: taskNo(card) });
2529
2469
  try {
2530
2470
  await runCommand('task.follow', { taskId: card.id, following: next });
2531
2471
  setFollows((prev) => ({ ...prev, [card.id]: next }));
@@ -2612,7 +2552,7 @@ window.__ModuleLoader__.load({
2612
2552
  setReply('');
2613
2553
  await reloadData(next.id);
2614
2554
  setProjectId(next.id);
2615
- say(next.archived ? t('archivedMock') : t('projectSwitched'));
2555
+ say(next.archived ? t('archivedNote') : t('projectSwitched'));
2616
2556
  } catch (error) {
2617
2557
  say(tf(t, 'sendFailed', { message: error?.message ?? String(error) }));
2618
2558
  }
@@ -2716,15 +2656,17 @@ window.__ModuleLoader__.load({
2716
2656
  buttons.forEach((button) => { if (button.dataset.tab === next) button.focus(); });
2717
2657
  }
2718
2658
  async function reloadData(forProject = projectId) {
2659
+ const seq = ++loadSeqRef.current;
2719
2660
  const query = forProject ? '?project=' + encodeURIComponent(forProject) : '';
2720
2661
  const response = await fetch('/ai-team/api/bootstrap' + query, { headers: { accept: 'application/json' } });
2721
2662
  if (!response.ok) throw new Error('HTTP ' + response.status);
2722
2663
  const next = normalizePayload(await response.json());
2723
- if (next) setData(next);
2664
+ // A stale response (superseded by a newer load) must not land.
2665
+ if (next && seq === loadSeqRef.current) applyData(next);
2724
2666
  }
2725
2667
  async function runCommand(type, payload, targetProject = projectId) {
2726
- const target = targetProject || 'prj_main';
2727
- const response = await fetch('/ai-team/api/projects/' + encodeURIComponent(target) + '/commands', {
2668
+ if (!targetProject) throw new Error(t('noProject'));
2669
+ const response = await fetch('/ai-team/api/projects/' + encodeURIComponent(targetProject) + '/commands', {
2728
2670
  method: 'POST',
2729
2671
  headers: { 'content-type': 'application/json', accept: 'application/json' },
2730
2672
  body: JSON.stringify({ type, payload }),
@@ -2964,7 +2906,7 @@ window.__ModuleLoader__.load({
2964
2906
  }
2965
2907
  async function leaveProfile() {
2966
2908
  if (!profileAgent || pBusy) return;
2967
- if (typeof window.confirm === 'function' && !window.confirm(t('leaveConfirm'))) return;
2909
+ if (!(await askConfirm(t('leaveTeam'), t('leaveConfirm')))) return;
2968
2910
  setPBusy(true);
2969
2911
  setPError('');
2970
2912
  try {
@@ -3103,12 +3045,30 @@ window.__ModuleLoader__.load({
3103
3045
  }
3104
3046
  setConverting(true);
3105
3047
  }
3106
- function submitConvert() {
3048
+ async function submitConvert() {
3107
3049
  if (!selectedTask || !cTitle.trim() || !cDod.trim()) return;
3108
- sayRight(tf(t, 'convertMock', { n: taskNo(selectedTask) }));
3109
- setConverting(false);
3110
- setCTitle('');
3111
- setCDod('');
3050
+ // FR-049 trigger ②: the whole Thread converts, anchored on the
3051
+ // ledger event ids of its entries (dedupe + audit by the Host).
3052
+ const sources = (thread?.entries ?? []).map((entry) => entry.eventId).filter(Boolean);
3053
+ if (sources.length === 0) { sayRight(t('convertNoSource')); return; }
3054
+ try {
3055
+ const result = await runCommand('task.convert', {
3056
+ sourceEventIds: sources,
3057
+ title: cTitle.trim(),
3058
+ doneCriteria: cDod.trim(),
3059
+ });
3060
+ setConverting(false);
3061
+ setCTitle('');
3062
+ setCDod('');
3063
+ sayRight(tf(t, 'convertDone', { n: taskNo(result.task) }));
3064
+ await reloadData();
3065
+ } catch (error) {
3066
+ if (error?.details?.taskId) {
3067
+ const card = tasks.find((task) => task.id === error.details.taskId);
3068
+ if (card) openTaskById(card.id);
3069
+ }
3070
+ sayRight(tf(t, 'sendFailed', { message: error?.message ?? String(error) }));
3071
+ }
3112
3072
  }
3113
3073
  async function acceptTask() {
3114
3074
  if (!selectedTask) return;
@@ -3153,9 +3113,10 @@ window.__ModuleLoader__.load({
3153
3113
  sayRight(t('reassignNoTarget'));
3154
3114
  return;
3155
3115
  }
3156
- const answer = typeof window.prompt === 'function'
3157
- ? window.prompt(t('reassignPrompt') + '\n' + options.map((agent) => agent.name).join('、'), options[0].name)
3158
- : null;
3116
+ const answer = await askPrompt(t('reassignPrompt'), {
3117
+ options: options.map((agent) => agent.name),
3118
+ value: options[0].name,
3119
+ });
3159
3120
  if (answer === null) return;
3160
3121
  const target = options.find((agent) => agent.name === answer.trim() || agent.id === answer.trim());
3161
3122
  if (target === undefined) {
@@ -3177,7 +3138,7 @@ window.__ModuleLoader__.load({
3177
3138
  }
3178
3139
  async function cancelSelected() {
3179
3140
  if (!selectedTask) return;
3180
- const reason = typeof window.prompt === 'function' ? window.prompt(t('cancelPrompt'), '') : null;
3141
+ const reason = await askPrompt(t('cancelPrompt'));
3181
3142
  if (reason === null) return;
3182
3143
  try {
3183
3144
  await runCommand('task.cancel', { taskId: selectedTask.id, expectedRevision: selectedTask.revision, reason });
@@ -3189,7 +3150,7 @@ window.__ModuleLoader__.load({
3189
3150
  }
3190
3151
  async function reopenSelected() {
3191
3152
  if (!selectedTask) return;
3192
- const reason = typeof window.prompt === 'function' ? window.prompt(t('reopenPrompt'), '') : null;
3153
+ const reason = await askPrompt(t('reopenPrompt'));
3193
3154
  if (reason === null) return;
3194
3155
  try {
3195
3156
  await runCommand('task.reopen', { taskId: selectedTask.id, expectedRevision: selectedTask.revision, reason });
@@ -3201,7 +3162,7 @@ window.__ModuleLoader__.load({
3201
3162
  }
3202
3163
  async function deleteSelected() {
3203
3164
  if (!selectedTask) return;
3204
- if (typeof window.confirm === 'function' && !window.confirm(t('deleteConfirm'))) return;
3165
+ if (!(await askConfirm(t('actDelete'), t('deleteConfirm')))) return;
3205
3166
  try {
3206
3167
  await runCommand('task.delete', { taskId: selectedTask.id, expectedRevision: selectedTask.revision });
3207
3168
  sayRight(tf(t, 'deleteDone', { n: taskNo(selectedTask) }));
@@ -3213,10 +3174,7 @@ window.__ModuleLoader__.load({
3213
3174
  function continueFromLatest() {
3214
3175
  const latest = threadHead;
3215
3176
  setReplyBase(latest);
3216
- sayRight(tf(t, 'conflictContinueMock', { head: latest }));
3217
- }
3218
- function contextAtBase() {
3219
- sayRight(tf(t, 'conflictContextMock', { base: replyBase ?? 0 }));
3177
+ sayRight(tf(t, 'conflictContinued', { head: latest }));
3220
3178
  }
3221
3179
 
3222
3180
  const actions = [];
@@ -3274,7 +3232,7 @@ window.__ModuleLoader__.load({
3274
3232
  Array.isArray(question.options) && question.options.length
3275
3233
  ? h('span', { className: 'at-inboxoptions' }, question.options.join(' / '))
3276
3234
  : null,
3277
- question.recommendation ? h('span', { className: 'at-inboxrecommend' }, '推荐:' + question.recommendation) : null)))
3235
+ question.recommendation ? h('span', { className: 'at-inboxrecommend' }, t('decisionRecommend') + ':' + question.recommendation) : null)))
3278
3236
  : null,
3279
3237
  h('div', { className: 'at-inboxmeta' },
3280
3238
  item.projectName ? item.projectName + ' · ' : '',
@@ -3323,6 +3281,7 @@ window.__ModuleLoader__.load({
3323
3281
  q1Extra,
3324
3282
  onOpenInbox: switchInbox,
3325
3283
  onBackMain: () => setTab('main'),
3284
+ humanId,
3326
3285
  })
3327
3286
  : tab === 'situation'
3328
3287
  ? h(Situation, { t, quadrants, tasks, onItem: openQuadrantItem, onViewAll: viewQuadrant })
@@ -3409,7 +3368,6 @@ window.__ModuleLoader__.load({
3409
3368
  tabIndex: tab === 'situation' ? 0 : -1,
3410
3369
  onClick: () => selectTab('situation'),
3411
3370
  }, t('tabSituation')))),
3412
- phase === 'fallback' ? h('div', { className: 'at-banner', role: 'note' }, h('b', null, t('fallbackTitle') + ' · '), h('span', null, t('fallbackBody'))) : null,
3413
3371
  note ? h('div', { className: 'at-notewrap' },
3414
3372
  h('div', { className: 'at-note', role: 'status' },
3415
3373
  h('span', { className: 'at-notetext' }, note),
@@ -3454,7 +3412,6 @@ window.__ModuleLoader__.load({
3454
3412
  onReplySend: sendReply,
3455
3413
  replyBase,
3456
3414
  onContinue: continueFromLatest,
3457
- onContext: contextAtBase,
3458
3415
  note: rightNote,
3459
3416
  onDismissNote: () => setRightNote(''),
3460
3417
  acceptChecked,
@@ -3467,7 +3424,7 @@ window.__ModuleLoader__.load({
3467
3424
  panelRef: rightRef,
3468
3425
  replyRef,
3469
3426
  }) : null,
3470
- addOpen ? h('div', { className: 'at-modalback' },
3427
+ addOpen ? h(ModalBack, { onClose: () => setAddOpen(false) },
3471
3428
  h('form', {
3472
3429
  className: 'at-modal',
3473
3430
  role: 'dialog',
@@ -3502,7 +3459,7 @@ window.__ModuleLoader__.load({
3502
3459
  h('div', { className: 'at-modalactions' },
3503
3460
  h('button', { className: 'at-btn', type: 'button', onClick: () => setAddOpen(false), disabled: mBusy }, t('cancel')),
3504
3461
  h('button', { className: 'at-btn at-btn-primary', type: 'submit', disabled: mBusy || !mName.trim() }, mBusy ? t('memberAdding') : t('memberCreate'))))) : null,
3505
- profileAgent ? h('div', { className: 'at-modalback' },
3462
+ profileAgent ? h(ModalBack, { onClose: () => setProfileAgent(null) },
3506
3463
  h('form', {
3507
3464
  className: 'at-modal',
3508
3465
  role: 'dialog',
@@ -3573,7 +3530,7 @@ window.__ModuleLoader__.load({
3573
3530
  profileAgent.status === 'failed' ? h('button', { className: 'at-btn', type: 'button', onClick: retryProfile, disabled: pBusy }, t('retry')) : null,
3574
3531
  h('button', { className: 'at-btn', type: 'button', onClick: distillProfile, disabled: pBusy }, t('redistill')),
3575
3532
  h('button', { className: 'at-btn at-btn-primary', type: 'submit', disabled: pBusy || !pName.trim() }, pBusy ? t('saving') : t('save'))))) : null,
3576
- workspaceOpen ? h('div', { className: 'at-modalback' },
3533
+ workspaceOpen ? h(ModalBack, { onClose: () => setWorkspaceOpen(false) },
3577
3534
  h('form', {
3578
3535
  className: 'at-modal',
3579
3536
  role: 'dialog',
@@ -3591,7 +3548,7 @@ window.__ModuleLoader__.load({
3591
3548
  h('div', { className: 'at-modalactions' },
3592
3549
  h('button', { className: 'at-btn', type: 'button', onClick: () => setWorkspaceOpen(false), disabled: workspaceBusy }, t('cancel')),
3593
3550
  h('button', { className: 'at-btn at-btn-primary', type: 'submit', disabled: workspaceBusy || !workspaceDraft.trim() }, workspaceBusy ? t('saving') : t('workspaceSave'))))) : null,
3594
- newOpen ? h('div', { className: 'at-modalback' },
3551
+ newOpen ? h(ModalBack, { onClose: () => setNewOpen(false) },
3595
3552
  h('form', {
3596
3553
  className: 'at-modal',
3597
3554
  role: 'dialog',
@@ -3611,7 +3568,8 @@ window.__ModuleLoader__.load({
3611
3568
  nError ? h('div', { className: 'at-modalerror', role: 'alert' }, nError) : null,
3612
3569
  h('div', { className: 'at-modalactions' },
3613
3570
  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));
3571
+ 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));
3615
3573
  }
3616
3574
 
3617
3575
  function PavilionMark({ size = 18 }) {
@@ -3653,7 +3611,6 @@ window.__ModuleLoader__.load({
3653
3611
  name: 'sidebar.panellist', id: 'ai-team', order: 25, label: () => ctx.locale.bind(NS)('panel'),
3654
3612
  }, PanelIcon));
3655
3613
  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
3614
  }
3658
3615
 
3659
3616
  return { inject: ['slots', 'locale'], apply };