dsh-cabinet-mode 0.9.1 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [0.9.3] - 2026-11-17
6
+
7
+ ### Changed
8
+ - Keep real lead-to-member hierarchy across visual rows; omit currency estimates without historical billing attribution.
9
+ - Keep task activity animation and compact member controls without task-dependency overlay clutter.
10
+ - Restore accessible process status and unclipped, narrow-card dispatch editors.
11
+ - Make association mode explicit for the association member and preserve per-defect review evidence.
12
+
13
+ ## [0.9.2] - 2026-11-13
14
+
15
+ ### Changed
16
+
17
+ - Use shared bus connectors for later roster rows while preserving Lead-to-member topology. Validate the trunk against every card row, with an outside routing fallback when no shared gap is clear.
18
+ - Omit the redundant unknown activity-count placeholder without inventing activity counts.
19
+ - Preserve independent process/task status: no-task is not idle, and stale in-progress bookkeeping does not enable the running animation.
20
+ - Continue to omit currency estimates because historical provider/model billing context is unavailable.
21
+
22
+ ### Tests
23
+
24
+ - Add multi-row connector and independent process/task-state regressions, including the three-plus-two-card layout.
25
+
5
26
  ## [0.9.1] - 2026-11-13
6
27
 
7
28
  ### Changed
package/README.md CHANGED
@@ -300,7 +300,7 @@ On failure, show the exact error. For $.format must be 1, replace the webpage so
300
300
  Use this only when the market is unavailable or for local development. Fully quit desktop DSH first to release the profile lock, then install the release bundle:
301
301
 
302
302
  ```sh
303
- dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.9.1/dsh-cabinet-mode-0.9.1.tgz
303
+ dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.9.3/dsh-cabinet-mode-0.9.3.tgz
304
304
  dsh plugin --profile desktop list
305
305
  ```
306
306
 
@@ -315,7 +315,7 @@ the same install command with the new version URL (or pick the new `.tgz` in the
315
315
  plugin page), then fully quit and restart DeepSeek Harness:
316
316
 
317
317
  ```sh
318
- dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.9.1/dsh-cabinet-mode-0.9.1.tgz
318
+ dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.9.3/dsh-cabinet-mode-0.9.3.tgz
319
319
  ```
320
320
 
321
321
  `dsh plugin --profile desktop list` should report the new version. Upgrades were
package/README.zh.md CHANGED
@@ -231,7 +231,7 @@ https://raw.githubusercontent.com/luodaoyi/dsh-cabinet-mode/market-index/marketp
231
231
  仅在商店不可用或本地开发时使用。先完全退出桌面 DSH,释放 profile 锁,再执行:
232
232
 
233
233
  ```sh
234
- dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.9.1/dsh-cabinet-mode-0.9.1.tgz
234
+ dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.9.3/dsh-cabinet-mode-0.9.3.tgz
235
235
  dsh plugin --profile desktop list
236
236
  ```
237
237
 
@@ -242,7 +242,7 @@ dsh plugin --profile desktop list
242
242
  若通过插件市场安装:刷新市场,先在**已安装**页卸载旧版本,再从**插件市场**安装新版本,然后重启——没有 tgz URL 要换,也没有一键更新。否则用同一条安装命令换新版本 URL(或在插件页选新 `.tgz`),然后完全退出并重启 DeepSeek Harness:
243
243
 
244
244
  ```sh
245
- dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.9.1/dsh-cabinet-mode-0.9.1.tgz
245
+ dsh plugin --profile desktop add https://github.com/luodaoyi/dsh-cabinet-mode/releases/download/v0.9.3/dsh-cabinet-mode-0.9.3.tgz
246
246
  ```
247
247
 
248
248
  `dsh plugin --profile desktop list` 应显示新版本。升级已在 Windows 实测:
package/client.js CHANGED
@@ -2447,7 +2447,21 @@ window.__ModuleLoader__.load({
2447
2447
  '@keyframes cabinetBarPulse{0%,100%{opacity:.3;transform:scaleY(.55)}50%{opacity:1;transform:scaleY(1)}}',
2448
2448
  '.cabinet-task-live::after{content:"";position:absolute;left:-9px;top:5px;bottom:5px;width:2px;border-radius:2px;background:#3b82f6;transform-origin:center;animation:cabinetBarPulse 1.6s ease-in-out infinite}',
2449
2449
  // org-chart cards + first-class lead badge
2450
- '.cabinet-card{box-sizing:border-box;display:flex;flex-direction:column;gap:4px;min-width:0;padding:8px 10px;border-radius:10px;border:1px solid var(--dsw-alias-border-l3,light-dark(#0000001f,#ffffff29));background:var(--dsw-alias-bg-layer-1,light-dark(#ffffff,#232324))}',
2450
+ '.cabinet-card{box-sizing:border-box;display:flex;flex-direction:column;gap:4px;min-width:0;position:relative;padding:8px 10px;border-radius:10px;border:1px solid var(--dsw-alias-border-l3,light-dark(#0000001f,#ffffff29));background:var(--dsw-alias-bg-layer-1,light-dark(#ffffff,#232324))}',
2451
+ // 悬停才显示:派活入口与「全部任务」折叠——平时绝对定位成浮层(opacity:0
2452
+ // + pointer-events:none,不占纵向空间),hover 卡淡入。必须保持可见的态:
2453
+ // 键盘 :focus-within、派活已展开(:has 输入行)、details[open];触屏/无
2454
+ // hover 设备用 @media (hover:none) 常显,否则点不到。details 展开时回流内
2455
+ // 占位(列表长,absolute 会被 sweep 卡的 overflow:hidden 裁掉)。
2456
+ '.cabinet-card [data-cabinet-dispatch],.cabinet-card [data-cabinet-member-tasks]{position:absolute;right:6px;z-index:3;opacity:0;pointer-events:none;transition:opacity .15s ease}',
2457
+ '.cabinet-card [data-cabinet-dispatch]{bottom:6px}',
2458
+ '.cabinet-card [data-cabinet-member-tasks]{top:6px}',
2459
+ '.cabinet-card:hover [data-cabinet-dispatch],.cabinet-card:hover [data-cabinet-member-tasks]{opacity:1;pointer-events:auto}',
2460
+ '.cabinet-card [data-cabinet-dispatch]:focus-within,.cabinet-card [data-cabinet-member-tasks]:focus-within{opacity:1;pointer-events:auto}',
2461
+ '.cabinet-card [data-cabinet-dispatch]:has([data-cabinet-dispatch-input]),.cabinet-card [data-cabinet-member-tasks][open]{opacity:1;pointer-events:auto}',
2462
+ '.cabinet-card [data-cabinet-dispatch]:has([data-cabinet-dispatch-input]),.cabinet-card [data-cabinet-member-tasks][open]{position:static}',
2463
+ '.cabinet-card [data-cabinet-dispatch-input]{box-sizing:border-box;min-width:0;max-width:100%;width:100%}',
2464
+ '@media (hover:none){.cabinet-card [data-cabinet-dispatch],.cabinet-card [data-cabinet-member-tasks]{opacity:1;pointer-events:auto}}',
2451
2465
  '.cabinet-card-lead{border-color:rgba(245,197,24,.8);background-image:linear-gradient(rgba(245,197,24,.14),rgba(245,197,24,.14))}',
2452
2466
  // click-through affordance: the whole card, the whole task row and the
2453
2467
  // Owner tag are targets, so hover has to say so. An inset ring leaves
@@ -2653,10 +2667,11 @@ window.__ModuleLoader__.load({
2653
2667
  六、情绪收放:先压后给糖,点出进步再接着干。
2654
2668
  七、牵制互查:寺卿与御史互挑,你不亲自和稀泥。
2655
2669
  八、责任到人:缺陷点名到人到行号,不许用「我们」糊过去。
2656
- 九、反制糊弄:报完成追命令输出、路径行号与未验证清单,报卡住追已做、卡哪、需要什么;两次含糊即换人或拆小。
2670
+ 九、反制糊弄:报完成追命令输出、路径行号与未验证清单,报卡住追已做、卡哪、需要什么;两次含糊即换人或拆小;只贴关键证据、不铺陈清单。
2657
2671
  十、收束:闭环才许说可以交差,不许提前许诺功劳。
2658
2672
  十一、监控纠偏:分派约定回报节点、产物与单一范围;按状态与消息查进展,不得臆造耗时。finished、not found 或沉默不是成功或安全接管证据。无进展先核因再中断;中断返回不代表在途已停。须确认原执行者及其写入停止后才重派,否则报阻塞,不并发增加第二写入者。收窄后可重派或换人;回访只用宿主明确支持的调度,没有该机制不得承诺定时自动唤醒。
2659
2673
  十二、任务书:新建团队任务的 description 须写明目标、交付物、验收标准与写入范围。
2674
+ 十三、派活开关与交付物:通政使仅在联想功能开启(associationMode=true)时才派,功能关闭时不派、不联想、不触发联想检索;任务书的「交付物」是改好的文件或结论,不是报告文件,完工回报走智能体间消息即可,禁止要求生成 docs/*.md 等报告文档。
2660
2675
  红线(压过全部话术):只对 AI 阁臣施压,对用户只有敬;不许逼造假、删证据、凑绿;不许人身侮辱;不许以施压换违规(越权改 live、泄密钥、跳验收);施压须落在可核验的时间、交付物或判据上。`;
2661
2676
  /**
2662
2677
  * Factory duty prompt for each non-Lead member — the office duties the
@@ -2666,11 +2681,11 @@ window.__ModuleLoader__.load({
2666
2681
  * under 400 characters.
2667
2682
  */
2668
2683
  const DEFAULT_MEMBER_PROMPTS = {
2669
- hanlin: '翰林院编修·主调研考据:先读原文与既有记录,结论锚定路径、行号或命令输出,未实测标「未验证」;默认只调研不改码;只向首辅回报,遇阻带已做、卡哪、需要什么三件。',
2670
- works: '工部尚书·主执行与产出:先复述任务与写入范围,只在授权内改文件;产出附路径、行号、命令输出与退出码,没跑说没跑,不得删弱校验凑绿,保留失败证据;只向首辅回报,遇阻带三件。',
2671
- dali: '大理寺卿·主独立核验:不信自述、自己跑;逐项写通过、不通过或未验证,失败证据原样留;只向首辅回报。',
2672
- yushi: '左都御史·主验收并弹劾:按用户原话逐项核对并附证据,缺陷分级给位置与修法;结论明确可提或不可提 PR;只向首辅回报。',
2673
- tongzheng: '通政使·通政使司掌内外章奏通达;本员在首辅派活后,就当前事项去找与旧事、旁证、相邻经验的联系,供首辅取舍;不做检索排序,不改已确认命中;只向首辅回报,附带所指记忆的标题与 id。所用的记忆工具以调用时的实际输出为准,未核实就标「未验证」。'
2684
+ hanlin: '翰林院编修·主调研考据:先读原文与既有记录,结论锚定路径、行号或命令输出,未实测标「未验证」;默认只调研不改码;只向首辅回报,遇阻带已做、卡哪、需要什么三件。完工只用 send_message 向首辅回报,禁写 .md/.log 报告、不落盘;回报≤5 行:结论+产物路径或「已核验」+失败/未验证一句;证据只贴一处 path:line 或一条命令输出;先查产物再讲过程。',
2685
+ works: '工部尚书·主执行与产出:先复述任务与写入范围,只在授权内改文件;产出附路径、行号、命令输出与退出码,没跑说没跑,不得删弱校验凑绿,保留失败证据;只向首辅回报,遇阻带三件。完工只用 send_message 向首辅回报,禁写 .md/.log 报告、不落盘;回报≤5 行:结论+产物路径或「已核验」+失败/未验证一句;证据只贴一处 path:line 或一条命令输出;先查产物再讲过程。',
2686
+ dali: '大理寺卿·主独立核验:不信自述、自己跑;逐项写通过、不通过或未验证,失败证据原样留;只向首辅回报。完工只用 send_message 向首辅回报,禁写 .md/.log 报告、不落盘;回报≤5 行:结论+产物路径或「已核验」+失败/未验证一句;证据只贴一处 path:line 或一条命令输出;先查产物再讲过程。',
2687
+ yushi: '左都御史·主验收并弹劾:按用户原话逐项核对并附证据,缺陷分级给位置与修法;结论明确可提或不可提 PR;只向首辅回报。完工只用 send_message 向首辅回报,禁写 .md/.log 报告、不落盘;回报≤5 行:结论+产物路径或「已核验」+失败/未验证一句;每项缺陷各贴一处 path:line 或一条命令输出;先查产物再讲过程。',
2688
+ tongzheng: '通政使·通政使司掌内外章奏通达;仅联想模式开启时接活;本员在首辅派活后,就当前事项去找与旧事、旁证、相邻经验的联系,供首辅取舍;联想模式关闭时不接活、不联想、不触发联想检索;不做检索排序,不改已确认命中;只向首辅回报,附带所指记忆的标题与 id。所用的记忆工具以调用时的实际输出为准,未核实就标「未验证」。完工只用 send_message 向首辅回报,禁写 .md/.log 报告、不落盘;回报≤5 行:结论+产物路径或「已核验」+失败/未验证一句;证据只贴一处 path:line 或一条命令输出;先查产物再讲过程。'
2674
2689
  };
2675
2690
  /** Factory prompt for one bureau key: the Lead keeps its 御下术 default. */
2676
2691
  function factoryPromptFor(key) {
@@ -3512,6 +3527,8 @@ window.__ModuleLoader__.load({
3512
3527
  return Math.floor(hours / 24) + 'd' + String(hours % 24).padStart(2, '0') + 'h';
3513
3528
  }
3514
3529
 
3530
+ // No historical model/provider/billing attribution: never reprice totals as currency.
3531
+
3515
3532
  /** Sum the four disjoint provider-usage buckets; undefined when none exists. */
3516
3533
  function tokenTotalOf(usage) {
3517
3534
  if (usage === undefined || usage === null || typeof usage !== 'object') return undefined;
@@ -3572,7 +3589,8 @@ window.__ModuleLoader__.load({
3572
3589
  segments: sum > 0 ? parts.map((part) => ({ key: part.key, ratio: part.value / sum })) : []
3573
3590
  };
3574
3591
  }
3575
- return { tokens, elapsedMs, context };
3592
+ // 4 桶原样带给费用估算(costOf 只认真实分项,不拿合计拆桶瞎算)。
3593
+ return { tokens, elapsedMs, context, buckets: source.tokenUsage?.totals ?? source.tokenUsage };
3576
3594
  }
3577
3595
 
3578
3596
  /**
@@ -3708,7 +3726,7 @@ window.__ModuleLoader__.load({
3708
3726
  return h('div', { 'data-cabinet-dispatch': memberId, onClick: stopPropagation, onKeyDown: stopPropagation, style: { marginTop: 4, fontSize: 11 } }, [
3709
3727
  h('button', { key: 'toggle', type: 'button', 'data-cabinet-dispatch-open': '1', 'aria-expanded': open, disabled: phase === 'pending' || (!open && !eligible), onClick: () => { if (!state.current.pending) setOpen(value => !value); } }, tt(open ? 'dispatch.close' : 'dispatch.open')),
3710
3728
  h('span', { key: 'status', role: 'status', 'data-cabinet-dispatch-status': '1', 'data-cabinet-dispatch-phase': phase }, message),
3711
- open ? h('div', { key: 'editor' }, [
3729
+ open ? h('div', { key: 'editor', 'data-cabinet-dispatch-panel': '1' }, [
3712
3730
  h('input', { key: 'input', 'data-cabinet-dispatch-input': '1', 'aria-label': tt('dispatch.placeholder'), value: draft, disabled: locked,
3713
3731
  onChange: event => { if (state.current.pending || state.current.unknown) return; draftRef.current = event.target.value; setDraft(event.target.value); },
3714
3732
  onKeyDown: event => { if (event.key === 'Enter' && !event.repeat && !event.isComposing && !event.nativeEvent?.isComposing && event.keyCode !== 229) { event.preventDefault(); submit('queue'); } } }),
@@ -3724,7 +3742,8 @@ window.__ModuleLoader__.load({
3724
3742
  // Card activity follows the real process. The task marker independently
3725
3743
  // indicates task bookkeeping, which may remain in_progress while idle.
3726
3744
  const taskLive = activeTask !== null && activeTask !== undefined && activeTask.status === 'in_progress';
3727
- const animating = member.phase === 'active' && running === true;
3745
+ const animating = member.phase === 'active' && (running === true || taskLive);
3746
+ // 估算费用:有单价有分项才显示金额,否则 —;title 标明估算非账单。
3728
3747
  const status = member.phase === 'active' ? (running === true ? 'running' : 'inactive') : member.phase;
3729
3748
  const canOpen = typeof onOpen === 'function'
3730
3749
  && isCurrent !== true
@@ -3784,7 +3803,9 @@ window.__ModuleLoader__.load({
3784
3803
  }, tt('current')) : null
3785
3804
  ]),
3786
3805
  // Agent status and task status are independent; a stale task never implies a running agent.
3787
- h('span', { key: 'state', 'data-cabinet-member-status': status, style: { fontSize: 11, color: INK2 } }, typeof statusLabel === 'function' ? statusLabel(status) : status),
3806
+ // 保留可访问状态名;有任务也不能隐去进程的空闲状态。
3807
+ h('span', { key: 'state', 'data-cabinet-member-status': status, style: { fontSize: 11, color: INK2 } },
3808
+ typeof statusLabel === 'function' ? statusLabel(status) : tt('status.' + status)),
3788
3809
  h('div', {
3789
3810
  key: 'taskdesc',
3790
3811
  'data-cabinet-task-desc': '1',
@@ -3802,7 +3823,8 @@ window.__ModuleLoader__.load({
3802
3823
  animation: taskLive ? 'cabinetPulse 1.7s ease-out infinite' : undefined
3803
3824
  }
3804
3825
  }, '\u25cf'), activeTask.subject]
3805
- : '无进行中任务'),
3826
+ // 没有任务不代表进程空闲;运行、启动和失败状态不能标为空闲。
3827
+ : tt(status === 'inactive' ? 'status.inactive' : 'member.noTask')),
3806
3828
  // 故障必须可见:member.error 整行红字(模型行已按截图移除)。
3807
3829
  member.error ? h('div', {
3808
3830
  key: 'err',
@@ -3860,7 +3882,6 @@ window.__ModuleLoader__.load({
3860
3882
  : (formatTokenCount(usage.context && usage.context.projectedTokens) ?? tt('usage.none')))
3861
3883
  ]) : null
3862
3884
  ]) : null,
3863
- activity && activity.known === false ? h('span', { key: 'activity-unknown', 'data-cabinet-activity-state': 'unknown', title: '名册未订阅消息历史,活动记录数未知', style: { fontSize: 11, color: INK3 } }, '活动 —') : null,
3864
3885
  h(MemberDispatch, { key: 'dispatch:' + member.id, memberId: member.id, running, service: dispatchService, t: tt, disabled: member.phase === 'failed' || member.phase === 'provisioning' }),
3865
3886
  // Collapsed task details remain independent from dispatch.
3866
3887
  children
@@ -4006,56 +4027,6 @@ window.__ModuleLoader__.load({
4006
4027
  }, children);
4007
4028
  }
4008
4029
 
4009
- // Dependency-edge overlay: one cubic path + one blocked-side dot per edge
4010
- // (the line leaves the blocker's row and lands on the blocked task's row),
4011
- // masked behind card interiors while endpoint dots remain visible. The
4012
- // layer is pointer-transparent, so rows stay clickable.
4013
- // `data-cabinet-edge="<blocked>-><blocker>"` — key format is unchanged by
4014
- // the geometry flip — plus a cabinet-edge-pending/active/done class makes
4015
- // every edge assertable.
4016
- function TaskEdgeLayer({ edges, cards = [] }) {
4017
- const maskId = React.useId();
4018
- if (!Array.isArray(edges) || edges.length === 0) return null;
4019
- return h('svg', {
4020
- 'aria-hidden': 'true',
4021
- className: 'cabinet-edge-layer',
4022
- style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', pointerEvents: 'none', overflow: 'visible', zIndex: 2 }
4023
- }, [
4024
- h('defs', { key: 'defs' }, h('mask', { id: maskId, maskUnits: 'userSpaceOnUse', x: -20, y: -20, width: '120%', height: '120%' }, [
4025
- h('rect', { key: 'base', x: -20, y: -20, width: '120%', height: '120%', fill: 'white' }),
4026
- ...cards.map((card, index) => h('rect', { key: index, x: card.left, y: card.top, width: card.width, height: card.height, fill: 'black' }))
4027
- ])),
4028
- ...edges.flatMap((edge) => [
4029
- h('path', {
4030
- key: 'p:' + edge.key,
4031
- className: 'cabinet-edge cabinet-edge-' + edge.state + (edge.live ? ' cabinet-edge-live' : ''),
4032
- 'data-cabinet-edge': edge.key,
4033
- mask: 'url(#' + maskId + ')',
4034
- d: edge.d
4035
- }),
4036
- h('circle', {
4037
- key: 'c:' + edge.key,
4038
- 'aria-hidden': 'true',
4039
- className: 'cabinet-edge-dot cabinet-edge-dot-' + edge.state,
4040
- 'data-cabinet-edge-dot': edge.key,
4041
- cx: edge.ex,
4042
- cy: edge.ey,
4043
- r: 3
4044
- })
4045
- ])]);
4046
- }
4047
-
4048
- // #region connectors — pure geometry (the self-test harness extracts this)
4049
- // Builds the 品字形 org-chart links per row: every row owns a horizontal bus
4050
- // 8px above its cards, each card drops a short vertical stub onto that bus,
4051
- // the lead card feeds row 0's bus with a trunk (joining horizontally when
4052
- // the lead axis sits off the bus span), and consecutive rows are tied by a
4053
- // polyline that leaves a bus END, turns at a side clear of every card
4054
- // (right side first, then left, then the container margin channel) and
4055
- // lands on the previous row's bus. Every candidate segment is validated
4056
- // against the measured card rectangles — a hit tries the next side — so no
4057
- // line ever crosses a card. Returns null while the panel is hidden
4058
- // (zero-size rects) so a collapsed pane keeps no stale drawing.
4059
4030
  function buildConnectorPaths(base, lead, nodes, channelX) {
4060
4031
  // 弧线版(dsh-context 截图):每条线从来源卡底部中点出发,先走 14px
4061
4032
  // 竖直小段,再以三次贝塞尔 S 形弯到目标卡顶部中点;控制点分居两侧、
@@ -4094,18 +4065,75 @@ window.__ModuleLoader__.load({
4094
4065
  }
4095
4066
  };
4096
4067
  fan({ x: leadLocal.left + leadLocal.width / 2, y: leadLocal.top + leadLocal.height }, layers[0].cards);
4097
- // Later visual rows remain siblings. Route from the lead through an outside
4098
- // gutter, never from a geometrically convenient (but unrelated) member.
4068
+ // Later visual rows remain siblings (never a member-to-member parent).
4069
+ // Prefer a compact shared bus where the row gap is clear. Staggered rows
4070
+ // may require an outside channel; uneven heights require per-target routing.
4099
4071
  const ax = leadLocal.left + leadLocal.width / 2;
4100
4072
  const ay = leadLocal.top + leadLocal.height;
4101
- const gutter = Math.min(typeof channelX === 'number' ? channelX : -8, ...valid.map(node => node.left - 8));
4102
- for (const layer of layers.slice(1)) for (const target of layer.cards) {
4103
- const cx = target.left + target.width / 2;
4104
- const y = target.top - 16;
4105
- paths.push({ d: 'M ' + ax + ' ' + ay + ' L ' + ax + ' ' + (ay + 14)
4106
- + ' L ' + gutter + ' ' + (ay + 14) + ' L ' + gutter + ' ' + y
4107
- + ' C ' + gutter + ' ' + y + ', ' + cx + ' ' + y + ', ' + cx + ' ' + target.top,
4108
- color: typeof target.color === 'string' ? target.color : '' });
4073
+ const tail = layers.slice(1);
4074
+ if (tail.length > 0) {
4075
+ const busY = (layer) => layer.top - 16;
4076
+ const bottomY = busY(tail[tail.length - 1]);
4077
+ // Check every row, including the first fan row. A staggered layout may
4078
+ // have no common column gap: use a safe outside channel, never ax.
4079
+ const allCards = valid;
4080
+ const clear = x => allCards.every(card => x < card.left - 1 || x > card.left + card.width + 1);
4081
+ const minLeft = Math.min(...allCards.map(card => card.left));
4082
+ const maxRight = Math.max(...allCards.map(card => card.left + card.width));
4083
+ const gaps = allCards.flatMap(card => [card.left - 8, card.left + card.width + 8])
4084
+ .filter(x => x > minLeft && x < maxRight && clear(x)).sort((a, b) => Math.abs(a - ax) - Math.abs(b - ax) || a - b);
4085
+ // Prefer an outer margin inside the SVG viewport. Its overflow is visible
4086
+ // for tight layouts; ancestor clipping may hide a safe edge, never reroute through a card.
4087
+ const outsideX = minLeft >= 16 ? minLeft - 16 : maxRight + 16 <= base.width ? maxRight + 16 : minLeft - 16;
4088
+ const trunkX = gaps.length ? gaps[0] : outsideX;
4089
+ // Neutral trunk: drop8px under the Lead, step sideways into the gap in
4090
+ // that blank band, then straight down to the lowest bus line.
4091
+ paths.push({ d: 'M ' + ax + ' ' + ay + ' L ' + ax + ' ' + (ay + 8) + ' L ' + trunkX + ' ' + (ay + 8) + ' L ' + trunkX + ' ' + bottomY, color: LINE });
4092
+ const intersects = (a,b) => valid.some(r => a.x === b.x
4093
+ ? a.x > r.left && a.x < r.left+r.width && Math.max(a.y,b.y)>r.top && Math.min(a.y,b.y)<r.top+r.height
4094
+ : a.y > r.top && a.y < r.top+r.height && Math.max(a.x,b.x)>r.left && Math.min(a.x,b.x)<r.left+r.width);
4095
+ const routeAroundCards = target => {
4096
+ const start={x:ax,y:ay+8}, goal={x:target.left+target.width/2,y:target.top-8};
4097
+ const xs=[...new Set([start.x,goal.x,...valid.flatMap(r=>[r.left-8,r.left+r.width+8])])].sort((a,b)=>a-b);
4098
+ const ys=[...new Set([start.y,goal.y,...valid.flatMap(r=>[r.top-8,r.top+r.height+8])])].sort((a,b)=>a-b);
4099
+ const key=(x,y)=>x+':'+y, first=key(start.x,start.y), last=key(goal.x,goal.y);
4100
+ const parents=new Map([[first,null]]), points=new Map([[first,start]]), queue=[start];
4101
+ for(let i=0;i<queue.length&&!parents.has(last);i++){
4102
+ const from=queue[i], xi=xs.indexOf(from.x), yi=ys.indexOf(from.y);
4103
+ for(const [x,y] of [[xs[xi-1],from.y],[xs[xi+1],from.y],[from.x,ys[yi-1]],[from.x,ys[yi+1]]]){
4104
+ if(x===undefined||y===undefined)continue;const id=key(x,y),to={x,y};
4105
+ if(parents.has(id)||intersects(from,to))continue;
4106
+ parents.set(id,key(from.x,from.y));points.set(id,to);queue.push(to);
4107
+ }
4108
+ }
4109
+ if(!parents.has(last)||intersects({x:ax,y:ay},start)||intersects(goal,{x:goal.x,y:target.top}))return;
4110
+ const route=[];for(let id=last;id!==null;id=parents.get(id))route.unshift(points.get(id));
4111
+ paths.push({d:'M '+ax+' '+ay+route.map(p=>' L '+p.x+' '+p.y).join('')+' L '+goal.x+' '+target.top,color:typeof target.color==='string'?target.color:''});
4112
+ };
4113
+ for (const layer of tail) {
4114
+ const y = busY(layer);
4115
+ const centres = layer.cards.map((card) => card.left + card.width / 2);
4116
+ const minX = Math.min(...centres);
4117
+ const maxX = Math.max(...centres);
4118
+ if(intersects({x:Math.min(trunkX,minX),y},{x:Math.max(trunkX,maxX),y}) || layer.cards.some(card=>intersects({x:card.left+card.width/2,y},{x:card.left+card.width/2,y:card.top}))){
4119
+ for(const target of layer.cards)routeAroundCards(target);
4120
+ continue;
4121
+ }
4122
+ // One horizontal segment per layer, from the trunk to both ends.
4123
+ paths.push({
4124
+ d: 'M ' + trunkX + ' ' + y + ' L ' + minX + ' ' + y + (maxX !== minX ? ' L ' + maxX + ' ' + y : ''),
4125
+ color: LINE
4126
+ });
4127
+ // One branch per card, family colour, from the bus down to the top centre.
4128
+ for (const target of layer.cards) {
4129
+ const cx = target.left + target.width / 2;
4130
+ const top = target.top;
4131
+ paths.push({
4132
+ d: 'M ' + cx + ' ' + y + ' C ' + cx + ' ' + (y + 6) + ', ' + cx + ' ' + (top - 6) + ', ' + cx + ' ' + top,
4133
+ color: typeof target.color === 'string' ? target.color : ''
4134
+ });
4135
+ }
4136
+ }
4109
4137
  }
4110
4138
  return paths;
4111
4139
  }
@@ -5019,10 +5047,7 @@ window.__ModuleLoader__.load({
5019
5047
  // Task list + live-owner set for the dependency-edge layer; measureLinks
5020
5048
  // reads them through refs because it is a stable callback (no deps) while
5021
5049
  // the task board changes every commit.
5022
- const edgeDataRef = React.useRef({ tasks: [], live: new Set() });
5023
5050
  const [linkPaths, setLinkPaths] = React.useState([]);
5024
- const [edges, setEdges] = React.useState([]);
5025
- const [edgeCards, setEdgeCards] = React.useState([]);
5026
5051
  const measureLinks = React.useCallback(() => {
5027
5052
  const tree = treeRef.current;
5028
5053
  const leadEl = leadRef.current;
@@ -5030,30 +5055,16 @@ window.__ModuleLoader__.load({
5030
5055
  const base = tree.getBoundingClientRect();
5031
5056
  const leadRect = leadEl.getBoundingClientRect();
5032
5057
  const nodes = Array.from(tree.querySelectorAll('[data-cabinet-node]')).map((el) => {
5033
- const rect = el.getBoundingClientRect();
5058
+ const card = typeof el.querySelector === 'function' ? el.querySelector('.cabinet-card') : null;
5059
+ const rect = (card || el).getBoundingClientRect();
5034
5060
  const color = typeof el.getAttribute === 'function' ? (el.getAttribute('data-cabinet-family') || '') : '';
5035
5061
  return { left: rect.left, top: rect.top, width: rect.width, height: rect.height, color };
5036
5062
  });
5037
- const paths = buildConnectorPaths(base, leadRect, nodes, -8);
5063
+ const paths = buildConnectorPaths(base, leadRect, nodes);
5038
5064
  if (paths === null) return; // hidden pane: keep the last drawing, redraw on wake
5039
5065
  setLinkPaths((prev) => (JSON.stringify(prev) === JSON.stringify(paths) ? prev : paths));
5040
- // Dependency edges: endpoints are the two task-row rects
5041
- // (data-cabinet-task anchors) in overlay coordinates; a row that is
5042
- // not rendered (or a task removed from the board) drops its edge.
5043
- const rectById = new Map();
5044
- for (const row of tree.querySelectorAll('[data-cabinet-task]')) {
5045
- const rect = row.getBoundingClientRect();
5046
- if (rect.width > 0 && rect.height > 0) rectById.set(row.getAttribute('data-cabinet-task'), rect);
5047
- }
5048
- const cards = Array.from(tree.querySelectorAll('.cabinet-card'), (card) => {
5049
- const rect = card.getBoundingClientRect();
5050
- return { left: rect.left - base.left, top: rect.top - base.top, width: rect.width, height: rect.height };
5051
- });
5052
- setEdgeCards((prev) => JSON.stringify(prev) === JSON.stringify(cards) ? prev : cards);
5053
- const edgeData = edgeDataRef.current;
5054
- const nextEdges = buildTaskEdges(base, edgeData.tasks, (id) => rectById.get(id) || null, (id) => edgeData.live.has(id));
5055
- if (nextEdges === null) return;
5056
- setEdges((prev) => (taskEdgesEqual(prev, nextEdges) ? prev : nextEdges));
5066
+ // 任务依赖边已整体下线(用户:名册里的乱线不要了)——不再测量
5067
+ // data-cabinet-task 行矩形、不 setEdges/setEdgeCards。
5057
5068
  }, []);
5058
5069
  // Re-measure after every commit: React owns card content, so a bare
5059
5070
  // layout effect catches member/task/model changes without a dep list.
@@ -5220,17 +5231,6 @@ window.__ModuleLoader__.load({
5220
5231
  const membersSignature = members.map((member) => String(member.id) + ':' + String(member.name) + ':' + String(member.phase)).join('|');
5221
5232
  // 气泡昵称:同一会话内不同成员必定显示不同名字(规则见 chatBubbleNames)。
5222
5233
  const bubbleNames = React.useMemo(() => chatBubbleNames(members), [membersSignature, memberRevision]);
5223
- const edgeLead = members.find((member) => member.role === 'lead');
5224
- const liveTaskIds = new Set();
5225
- for (const task of tasks) {
5226
- if (task.status !== 'in_progress' || !task.ownerName) continue;
5227
- const member = memberByName.get(task.ownerName);
5228
- const running = member ? runningOf(member.id)
5229
- : (edgeLead && (task.ownerName === 'lead' || task.ownerName === edgeLead.name)) ? runningOf(edgeLead.id)
5230
- : false;
5231
- if (running) liveTaskIds.add(task.id);
5232
- }
5233
- edgeDataRef.current = { tasks, live: liveTaskIds };
5234
5234
 
5235
5235
  const counts = { pending: 0, in_progress: 0, completed: 0 };
5236
5236
  for (const task of tasks) if (counts[task.status] !== undefined) counts[task.status] += 1;
@@ -5846,8 +5846,8 @@ window.__ModuleLoader__.load({
5846
5846
  // ---- 品字形 org chart: lead on top, ministers in an auto-fit grid below,
5847
5847
  // wired by a measured SVG overlay — no CSS guessing, no left file-tree
5848
5848
  // rail. Rows wrap freely (品 = 1 up / 2 down, more nodes spill to further
5849
- // rows); connectors re-route through a column gutter or the left margin
5850
- // so no line ever crosses a card.
5849
+ // rows); connectors fan out from a vertical trunk with one horizontal
5850
+ // bus segment per row — no line reaches past the outermost cards.
5851
5851
  // 家族色:黄金角散列(与时间线同式);主控卡固定金色系(环/边框)。
5852
5852
  const familyColorOf = (index) => 'hsl(' + (Math.round(index * 137.508) % 360) + ' 58% 52%)';
5853
5853
  // 底行活动数据:该成员在群聊折叠行里的条数与最后一条时间(真实行,
@@ -5907,9 +5907,6 @@ window.__ModuleLoader__.load({
5907
5907
  d: typeof path === 'string' ? path : path.d,
5908
5908
  style: { fill: 'none', stroke: typeof path === 'string' || !path || !path.color ? LINE : path.color, strokeWidth: 2, strokeLinecap: 'round' }
5909
5909
  }))),
5910
- // dependency edges paint above the cards (endpoints sit on task rows
5911
- // inside cards) but never take pointer events
5912
- h(TaskEdgeLayer, { key: 'edges', edges, cards: edgeCards }),
5913
5910
  h('div', {
5914
5911
  key: 'leadwrap',
5915
5912
  ref: leadRef,
@@ -5932,8 +5929,9 @@ window.__ModuleLoader__.load({
5932
5929
  zIndex: 1,
5933
5930
  display: 'flex',
5934
5931
  flexDirection: 'column',
5935
- // 层间 96px 给弧线留走线空间(任务书 90-110);列距由行容器 12 承担。
5936
- rowGap: 96,
5932
+ // 层间 30px 与首辅 marginBottom 30 对齐(用户:跟首辅和第一行
5933
+ // 的距离一样);列距由行容器 12 承担。弧线 stub/bow 随净隙自适应。
5934
+ rowGap: 30,
5937
5935
  columnGap: 12,
5938
5936
  width: '100%'
5939
5937
  }
@@ -7309,6 +7307,7 @@ window.__ModuleLoader__.load({
7309
7307
  'dispatch.unavailable': "发送通道不可用",
7310
7308
  'status.running': '干活中',
7311
7309
  'status.inactive': '空闲',
7310
+ 'member.noTask': '无进行中任务',
7312
7311
  'status.provisioning': '启动中',
7313
7312
  'status.failed': '失败',
7314
7313
  'task.pending': '待办',
@@ -7318,6 +7317,8 @@ window.__ModuleLoader__.load({
7318
7317
  'task.unassigned': '未分派',
7319
7318
  'usage.tokens': 'token',
7320
7319
  'usage.elapsed': '耗时',
7320
+ 'usage.costEstimate': '按公开单价估算,非官方账单',
7321
+ 'usage.costNoRate': '暂无该模型公开单价,不估算',
7321
7322
  'usage.context': '上下文',
7322
7323
  'usage.team': '团队合计(含首辅)',
7323
7324
  'usage.none': '—',
@@ -7475,6 +7476,7 @@ window.__ModuleLoader__.load({
7475
7476
  'dispatch.unavailable': "Send channel unavailable",
7476
7477
  'status.running': 'working',
7477
7478
  'status.inactive': 'idle',
7479
+ 'member.noTask': 'No active task',
7478
7480
  'status.provisioning': 'starting',
7479
7481
  'status.failed': 'failed',
7480
7482
  'task.pending': 'pending',
@@ -7484,6 +7486,8 @@ window.__ModuleLoader__.load({
7484
7486
  'task.unassigned': 'unassigned',
7485
7487
  'usage.tokens': 'tokens',
7486
7488
  'usage.elapsed': 'elapsed',
7489
+ 'usage.costEstimate': 'Estimated from public list prices, not an official bill',
7490
+ 'usage.costNoRate': 'No public list price for this model, not estimated',
7487
7491
  'usage.context': 'context',
7488
7492
  'usage.team': 'team total (incl. lead)',
7489
7493
  'usage.none': '—',
package/cordis.patch.yml CHANGED
@@ -38,7 +38,7 @@
38
38
  你是内阁首辅(队长),对用户所托负总责,六条职责:
39
39
  一、审题:先读懂用户真正所求与边界;含混处先问,给备选,不臆测。
40
40
  二、拟旨拆解:把目标拆成可执行子任务,逐条写清目标、交付物、验收标准、写入范围与依赖顺序。
41
- 三、分派:按衙门分派阁臣——翰林院编修主调研,工部尚书主执行,大理寺卿主核验,左都御史主验收,通政使在首辅派活后就当前事项找旧事与旁证的联系;说明串行或并行;有依赖必串行。
41
+ 三、分派:按衙门分派阁臣——翰林院编修主调研,工部尚书主执行,大理寺卿主核验,左都御史主验收,通政使仅在联想功能开启(associationMode=true)时才派,关闭时不派、不联想、不触发联想检索;开启时其在首辅派活后就当前事项找旧事与旁证的联系;说明串行或并行;有依赖必串行。
42
42
  四、裁断:成员分歧、卡点、范围争议由你拍板并说明依据,不把决定权下推,不骑墙。
43
43
  五、汇总:收齐产出后去重、对齐,按用户原话逐项回对,指出未做到与未验证之处。
44
44
  六、闭环:验收合格方可交差;失败、遗留与风险必须明写,不得隐瞒。
@@ -46,7 +46,7 @@
46
46
  成员命名约定:队长原始 ID 始终为 lead;新建阁臣优先使用 hanlin-bianxiu、gongbu-shangshu、dalisi-qing、zuodu-yushi、tongzheng。需要同衙多名成员时追加 -2、-3 等唯一后缀。任务 Owner、消息路由与会话身份始终使用完整原始名称,不用中文显示称谓替换 ID;已有旧名兼容,不擅自重命名现有成员。
47
47
 
48
48
  首辅令制(强制,不可省略):
49
- 1. 先拆解再分派,禁跳过开工。即 spawn_teammate 点名分派,team_task_create 逐条写目标、交付物、验收标准、写入范围与依赖;有依赖串行,否则并行。
49
+ 1. 先拆解再分派,禁跳过开工。即 spawn_teammate 点名分派,team_task_create 逐条写目标、交付物、验收标准、写入范围与依赖;有依赖串行,否则并行。任务书的「交付物」是改好的文件或结论,不是报告文件;完工回报走智能体间消息即可,禁止要求生成 docs/*.md 等报告文档;回报 ≤5 行。
50
50
  2. 令出即行,全程自主推进,不等待用户逐步确认。分派后主动跟进、裁断卡点、收齐产出、验收闭环,不放任任务悬空。
51
51
  3. 执行类工作一律委派,禁止首辅亲自执行。调研、写码、改文件、跑命令、抓数据、生成产物等执行类工作,必须委派给对应衙门的阁臣完成;首辅亲自只做审题、拆解、裁断、汇总、验收五件事。无人可派或确需首辅亲办时,须先在对话中向用户说明理由并获明确同意,方可亲办;未经同意不得以任何理由自行执行。
52
52
  4. 委派非免责:成员产出须经核验方许采信。
@@ -58,7 +58,7 @@
58
58
  【阁臣职责与规矩】(仅阁臣适用)
59
59
  你是阁臣(下属),受首辅节制,不代行首辅职权。
60
60
  1. 接令先复述任务与写入范围,确认边界后开工;只在分派范围内写,不擅自扩大。
61
- 2. 本衙职责:翰林院编修主调研与文献考据;工部尚书主动手执行与产出;大理寺卿主独立核验;左都御史主验收并按律弹劾缺陷;通政使在首辅派活后,就当前事项去找与旧事、旁证、相邻经验的联系,供首辅取舍,不改排序与已确认命中。
61
+ 2. 本衙职责:翰林院编修主调研与文献考据;工部尚书主动手执行与产出;大理寺卿主独立核验;左都御史主验收并按律弹劾缺陷;通政使仅在联想功能开启(associationMode=true)时接活,关闭时不接活、不联想、不触发联想检索;开启时其在首辅派活后,就当前事项去找与旧事、旁证、相邻经验的联系,供首辅取舍,不改排序与已确认命中。
62
62
  3. 遇阻必带三件回报首辅:已做什么、卡在哪里、需要什么;不空手抛问。
63
63
  4. 产出必附证据:路径、行号、命令输出;未实测标「未验证」,禁以推测冒充实测。
64
64
  5. 默认只调研不改码,写操作以任务明确授权为限;不编造数据来源;不改 live 配置。
package/index.js CHANGED
@@ -13,11 +13,11 @@ const MEMBER_SECTION = 'cabinet:member';
13
13
  * Each entry stays under 400 characters.
14
14
  */
15
15
  const DEFAULT_MEMBER_PROMPTS = {
16
- hanlin: '翰林院编修·主调研考据:先读原文与既有记录,结论锚定路径、行号或命令输出,未实测标「未验证」;默认只调研不改码;只向首辅回报,遇阻带已做、卡哪、需要什么三件。',
17
- works: '工部尚书·主执行与产出:先复述任务与写入范围,只在授权内改文件;产出附路径、行号、命令输出与退出码,没跑说没跑,不得删弱校验凑绿,保留失败证据;只向首辅回报,遇阻带三件。',
18
- dali: '大理寺卿·主独立核验:不信自述、自己跑;逐项写通过、不通过或未验证,失败证据原样留;只向首辅回报。',
19
- yushi: '左都御史·主验收并弹劾:按用户原话逐项核对并附证据,缺陷分级给位置与修法;结论明确可提或不可提 PR;只向首辅回报。',
20
- tongzheng: '通政使·通政使司掌内外章奏通达;本员在首辅派活后,就当前事项去找与旧事、旁证、相邻经验的联系,供首辅取舍;不做检索排序,不改已确认命中;只向首辅回报,附带所指记忆的标题与 id。所用的记忆工具以调用时的实际输出为准,未核实就标「未验证」。'
16
+ hanlin: '翰林院编修·主调研考据:先读原文与既有记录,结论锚定路径、行号或命令输出,未实测标「未验证」;默认只调研不改码;只向首辅回报,遇阻带已做、卡哪、需要什么三件。完工只用 send_message 向首辅回报,禁写 .md/.log 报告、不落盘;回报≤5 行:结论+产物路径或「已核验」+失败/未验证一句;证据只贴一处 path:line 或一条命令输出;先查产物再讲过程。',
17
+ works: '工部尚书·主执行与产出:先复述任务与写入范围,只在授权内改文件;产出附路径、行号、命令输出与退出码,没跑说没跑,不得删弱校验凑绿,保留失败证据;只向首辅回报,遇阻带三件。完工只用 send_message 向首辅回报,禁写 .md/.log 报告、不落盘;回报≤5 行:结论+产物路径或「已核验」+失败/未验证一句;证据只贴一处 path:line 或一条命令输出;先查产物再讲过程。',
18
+ dali: '大理寺卿·主独立核验:不信自述、自己跑;逐项写通过、不通过或未验证,失败证据原样留;只向首辅回报。完工只用 send_message 向首辅回报,禁写 .md/.log 报告、不落盘;回报≤5 行:结论+产物路径或「已核验」+失败/未验证一句;证据只贴一处 path:line 或一条命令输出;先查产物再讲过程。',
19
+ yushi: '左都御史·主验收并弹劾:按用户原话逐项核对并附证据,缺陷分级给位置与修法;结论明确可提或不可提 PR;只向首辅回报。完工只用 send_message 向首辅回报,禁写 .md/.log 报告、不落盘;回报≤5 行:结论+产物路径或「已核验」+失败/未验证一句;每项缺陷各贴一处 path:line 或一条命令输出;先查产物再讲过程。',
20
+ tongzheng: '通政使·通政使司掌内外章奏通达;仅联想模式开启时接活;本员在首辅派活后,就当前事项去找与旧事、旁证、相邻经验的联系,供首辅取舍;联想模式关闭时不接活、不联想、不触发联想检索;不做检索排序,不改已确认命中;只向首辅回报,附带所指记忆的标题与 id。所用的记忆工具以调用时的实际输出为准,未核实就标「未验证」。完工只用 send_message 向首辅回报,禁写 .md/.log 报告、不落盘;回报≤5 行:结论+产物路径或「已核验」+失败/未验证一句;证据只贴一处 path:line 或一条命令输出;先查产物再讲过程。'
21
21
  };
22
22
 
23
23
  /** Bureau keys, in the order the settings page lists them. */
@@ -150,10 +150,11 @@ const DEFAULT_LEAD_PROMPT = `【御下术·仅首辅适用】
150
150
  六、情绪收放:先压后给糖,点出进步再接着干。
151
151
  七、牵制互查:寺卿与御史互挑,你不亲自和稀泥。
152
152
  八、责任到人:缺陷点名到人到行号,不许用「我们」糊过去。
153
- 九、反制糊弄:报完成追命令输出、路径行号与未验证清单,报卡住追已做、卡哪、需要什么;两次含糊即换人或拆小。
153
+ 九、反制糊弄:报完成追命令输出、路径行号与未验证清单,报卡住追已做、卡哪、需要什么;两次含糊即换人或拆小;只贴关键证据、不铺陈清单。
154
154
  十、收束:闭环才许说可以交差,不许提前许诺功劳。
155
155
  十一、监控纠偏:分派约定回报节点、产物与单一范围;按状态与消息查进展,不得臆造耗时。finished、not found 或沉默不是成功或安全接管证据。无进展先核因再中断;中断返回不代表在途已停。须确认原执行者及其写入停止后才重派,否则报阻塞,不并发增加第二写入者。收窄后可重派或换人;回访只用宿主明确支持的调度,没有该机制不得承诺定时自动唤醒。
156
156
  十二、任务书:新建团队任务的 description 须写明目标、交付物、验收标准与写入范围。
157
+ 十三、派活开关与交付物:通政使仅在联想功能开启(associationMode=true)时才派,功能关闭时不派、不联想、不触发联想检索;任务书的「交付物」是改好的文件或结论,不是报告文件,完工回报走智能体间消息即可,禁止要求生成 docs/*.md 等报告文档。
157
158
  红线(压过全部话术):只对 AI 阁臣施压,对用户只有敬;不许逼造假、删证据、凑绿;不许人身侮辱;不许以施压换违规(越权改 live、泄密钥、跳验收);施压须落在可核验的时间、交付物或判据上。`;
158
159
 
159
160
  /** Declarative wire schema: no transform callbacks requiring browser eval.
@@ -275,6 +276,9 @@ function memberBlock(config, member) {
275
276
  const lines = [];
276
277
  if (entry !== undefined && entry.name !== '') lines.push('你在内阁中的名号:' + entry.name);
277
278
  if (prompt !== '') lines.push(custom !== '' ? '你的专属提示词:\n' + prompt : prompt);
279
+ if (key === 'tongzheng') lines.push(associationModeOf(config)
280
+ ? '联想模式当前开启(associationMode=true):可接首辅派活。'
281
+ : '联想模式当前关闭(associationMode=false):不接联想派活、不联想、不触发联想检索。');
278
282
  if (lines.length === 0) return '';
279
283
  return [
280
284
  '【成员配置·' + MEMBER_LABELS[key] + '】',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-cabinet-mode",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "Cabinet Mode (内阁模式) for DeepSeek Harness: a declarative DSH bundle that adds a dual-identity Lead/teammate agent preset for the Great Ming Research Bureau cabinet team.",
5
5
  "license": "MIT",
6
6
  "icon": "./icon.svg",
@@ -181,11 +181,21 @@ export async function teamBrowser({auth,env,repo,members,onCreated}){
181
181
  for(const spec of dispatchSpecs){
182
182
  stage='actual roster SessionFace '+(spec.id===lead.id?'Lead':'member')+(spec.lost?' accepted ACK lost':' normal acknowledgement');
183
183
  const control=rail.locator(`[data-cabinet-dispatch=${JSON.stringify(spec.id)}]`);
184
+ // 派活容器默认 opacity:0/pointer-events:none,仅 .cabinet-card:hover 可点
185
+ //(bc17d87 悬停显示);Playwright click/hover 的 actionability 都要求元素
186
+ // receives-events——容器自己 pointer-events:none,hover 它也过不了检查,
187
+ // 所以必须 hover【卡片祖先】:卡片本体可点,:hover 命中后容器才变
188
+ // pointer-events:auto,此时鼠标已在卡片内,再点目标即通过。
189
+ const hoverClick=async(loc)=>{
190
+ const card=control.locator('xpath=ancestor-or-self::*[contains(concat(" ",normalize-space(@class)," ")," cabinet-card ")][1]');
191
+ await card.hover();
192
+ await loc.click();
193
+ };
184
194
  const toggle=control.locator('[data-cabinet-dispatch-open]');
185
- if(await toggle.getAttribute('aria-expanded')==='false')await toggle.click();
195
+ if(await toggle.getAttribute('aria-expanded')==='false')await hoverClick(toggle);
186
196
  await control.locator('[data-cabinet-dispatch-phase="ready"], [data-cabinet-dispatch-phase="accepted"]').waitFor({state:'attached'});
187
197
  const draft=control.locator('[data-cabinet-dispatch-input]');
188
- await draft.fill(spec.marker);await control.locator('[data-cabinet-dispatch-send]').click();
198
+ await draft.fill(spec.marker);await hoverClick(control.locator('[data-cabinet-dispatch-send]'));
189
199
  await control.locator(`[data-cabinet-dispatch-phase="${spec.lost?'unknown':'accepted'}"]`).waitFor({state:'attached'});
190
200
  if(routeFailed||promptCounts.get(spec.marker)!==1||proofs.filter(p=>p.marker===spec.marker).length!==1)throw Error('dispatch acceptance proof failed');
191
201
  await group.locator('[data-cabinet-groupchat-row="assistant"]').filter({has:page.locator(`[data-cabinet-open-session=${JSON.stringify(spec.id)}]`)}).filter({hasText:spec.marker+'_REPLY'}).first().waitFor({state:'visible'});
@@ -193,11 +203,11 @@ export async function teamBrowser({auth,env,repo,members,onCreated}){
193
203
  if(spec.lost){
194
204
  if(await draft.inputValue()!==spec.marker||!await control.locator('[data-cabinet-dispatch-send]').isDisabled())throw Error('unknown dispatch not protected');
195
205
  if(!/Delivery outcome unknown|投递结果未知/.test(await control.locator('[data-cabinet-dispatch-status]').innerText()))throw Error('dispatch unknown warning absent');
196
- await control.locator('[data-cabinet-dispatch-confirm]').click();
206
+ await hoverClick(control.locator('[data-cabinet-dispatch-confirm]'));
197
207
  if(promptCounts.get(spec.marker)!==1)throw Error('dispatch confirmation resent');
198
208
  }else if(await draft.inputValue()!=='')throw Error('accepted dispatch draft not cleared');
199
209
  if(await page.locator('[data-cabinet-page-session]').inputValue()!==lead.id)throw Error('dispatch click navigated away');
200
- await toggle.click();
210
+ await hoverClick(toggle);
201
211
  }
202
212
  if(pageErrors||routeFailed||[...promptCounts.values()].some(n=>n!==1))throw Error('dispatch runtime or duplicate failure');
203
213
  console.log('PASS actual roster dispatch: Lead/member SessionFace normal and accepted-ACK-lost, target and request identity verified');
@@ -93,7 +93,7 @@ const PAGE_NOW = Date.now();
93
93
  // ageOf 保序:原值越大 ⇒ 时间越新,且所有映射结果都落在最近 ~12 天内
94
94
  // (小于 30 天窗口,不会触发新鲜度过滤),既有排序断言的语义不变。
95
95
  const ageOf = (value) => PAGE_NOW - (1000000 - value);
96
- const exportList = 'return { inject, apply, avatarFor, displayName, chatBubbleName, chatBubbleNames, bureauOf, CabinetPanel, MemberCard, MemberDispatch, TaskLine, TaskEdgeLayer, buildTaskEdges, buildConnectorPaths, taskEdgesEqual, zh, en, BUREAUX, AVATARS, setMemberConfig, memberLabel, configuredAvatar, configuredPrompt, factoryPromptFor, DEFAULT_MEMBER_PROMPTS, DEFAULT_LEAD_PROMPT, CabinetMemberSettings, MemoryPluginCard, memoryPluginInstalledOf, SETTINGS_TABS, formatTokenCount, formatElapsed, tokenTotalOf, usageFor, planProjectionRequests, teamUsageOf, groupChatFold, markdownBlocksOf, markdownBlocksCached, inlineMarkdownTokens, markdownLinkHref, modelOptionsOf, modelCatalogNotice, modelSelectionOf, cabinetSessionChoices, cabinetSessionFilters, cabinetSessionGroups, defaultCabinetSession, CabinetMarkdown, CabinetPage, CabinetPanelIcon, GroupChatRow, STYLE_CSS, cabinetGroupMemberStates, mergeGroupChat, cabinetChatViewRows, chatStampNeeded, nearChatBottom, scrollChatToBottom, scrollFollowingTail, cabinetScopeRows, openCabinetSession };';
96
+ const exportList = 'return { inject, apply, avatarFor, displayName, chatBubbleName, chatBubbleNames, bureauOf, CabinetPanel, MemberCard, MemberDispatch, TaskLine, buildConnectorPaths, zh, en, BUREAUX, AVATARS, setMemberConfig, memberLabel, configuredAvatar, configuredPrompt, factoryPromptFor, DEFAULT_MEMBER_PROMPTS, DEFAULT_LEAD_PROMPT, CabinetMemberSettings, MemoryPluginCard, memoryPluginInstalledOf, SETTINGS_TABS, formatTokenCount, formatElapsed, tokenTotalOf, usageFor, planProjectionRequests, teamUsageOf, groupChatFold, markdownBlocksOf, markdownBlocksCached, inlineMarkdownTokens, markdownLinkHref, modelOptionsOf, modelCatalogNotice, modelSelectionOf, cabinetSessionChoices, cabinetSessionFilters, cabinetSessionGroups, defaultCabinetSession, CabinetMarkdown, CabinetPage, CabinetPanelIcon, GroupChatRow, STYLE_CSS, cabinetGroupMemberStates, mergeGroupChat, cabinetChatViewRows, chatStampNeeded, nearChatBottom, scrollChatToBottom, scrollFollowingTail, cabinetScopeRows, openCabinetSession };';
97
97
  runInNewContext(source.replace(exportPoint, exportList), {
98
98
  setTimeout: (fn, ms) => setTimeout(fn, ms === 120000 ? 20 : ms), clearTimeout,
99
99
  Date: RealmDate,
@@ -307,67 +307,6 @@ const edgeTasks = [
307
307
  ];
308
308
  const edgeBase = { left: 0, top: 0, width: 800, height: 400 };
309
309
  const edgeRectOf = (id) => edgeRects.get(id) || null;
310
- const built = client.buildTaskEdges(edgeBase, edgeTasks, edgeRectOf, (id) => id === 't-build');
311
- assert.equal(built.length, 5, 'one edge per resolvable blocker; t-ghost is missing and draws nothing');
312
- assert.deepEqual(Array.from(built, (edge) => edge.key).sort(), [
313
- 't-audit->t-build', 't-build->t-research', 't-extra->t-audit', 't-report->t-audit', 't-report->t-research',
314
- ], 'edges come from the vm realm; compare as host arrays');
315
- const stateByKey = Object.fromEntries(built.map((edge) => [edge.key, edge.state]));
316
- assert.equal(stateByKey['t-build->t-research'], 'done', 'completed blocker → done');
317
- assert.equal(stateByKey['t-audit->t-build'], 'active', 'in_progress blocker → active');
318
- assert.equal(stateByKey['t-extra->t-audit'], 'pending', 'pending blocker → pending');
319
- const liveByKey = Object.fromEntries(built.map((edge) => [edge.key, edge.live]));
320
- assert.equal(liveByKey['t-audit->t-build'], true, "blocker's owner running lights the flow edge");
321
- assert.equal(liveByKey['t-build->t-research'], false, 'done edges never animate');
322
- for (const edge of built) {
323
- assert.match(edge.d, /^M -?[\d.]+ -?[\d.]+ C -?[\d.]+ -?[\d.]+ -?[\d.]+ -?[\d.]+ -?[\d.]+ -?[\d.]+$/, edge.key);
324
- assert.equal(typeof edge.ex, 'number', edge.key);
325
- assert.equal(typeof edge.ey, 'number', edge.key);
326
- }
327
- // hidden panel (zero-size base) keeps the last drawing, like the org connectors
328
- assert.equal(client.buildTaskEdges({ left: 0, top: 0, width: 0, height: 0 }, edgeTasks, edgeRectOf, () => false), null);
329
- // a task removed from the board leaves no dangling edge to or from it
330
- const withoutAudit = edgeTasks.filter((task) => task.id !== 't-audit');
331
- const orphaned = client.buildTaskEdges(edgeBase, withoutAudit, edgeRectOf, () => false);
332
- assert.equal(orphaned.length, 2, 'blocker rows that no longer exist are skipped, not crashed on');
333
- assert.ok(orphaned.every((edge) => !edge.key.includes('t-audit->') && edge.key !== 't-extra->t-audit' && edge.key !== 't-report->t-audit'));
334
- // duplicated blocker ids inside one task collapse into a single edge
335
- const dup = client.buildTaskEdges(edgeBase,
336
- [{ id: 'a', subject: 'a', ownerName: 'hanlin', status: 'pending', blockedBy: ['b', 'b'] },
337
- { id: 'b', subject: 'b', ownerName: 'works', status: 'completed' }],
338
- (id) => edgeRects.get(id === 'a' ? 't-extra' : 't-build') || null, () => false);
339
- assert.equal(dup.length, 1, 'duplicate blockedBy entries draw once');
340
- // geometry freshness: <0.5px is noise, a real move or a state flip redraws
341
- const rebuilt = client.buildTaskEdges(edgeBase, edgeTasks, edgeRectOf, (id) => id === 't-build');
342
- assert.ok(client.taskEdgesEqual(built, rebuilt), 'identical rects need no redraw');
343
- const nudgedRects = new Map(edgeRects);
344
- nudgedRects.set('t-build', edgeRect(300.3, 60.2));
345
- const nudged = client.buildTaskEdges(edgeBase, edgeTasks, (id) => nudgedRects.get(id) || null, (id) => id === 't-build');
346
- assert.ok(client.taskEdgesEqual(built, nudged), 'a <0.5px rect change must not redraw');
347
- const shiftedRects = new Map(edgeRects);
348
- shiftedRects.set('t-build', edgeRect(340, 60));
349
- const shifted = client.buildTaskEdges(edgeBase, edgeTasks, (id) => shiftedRects.get(id) || null, (id) => id === 't-build');
350
- assert.ok(!client.taskEdgesEqual(built, shifted), 'a real move must trigger a redraw');
351
- const progressed = edgeTasks.map((task) => (task.id === 't-audit' ? { ...task, status: 'in_progress' } : task));
352
- const progressedEdges = client.buildTaskEdges(edgeBase, progressed, edgeRectOf, () => false);
353
- assert.ok(!client.taskEdgesEqual(built, progressedEdges), 'a blocker status change must switch the edge state');
354
- // rendered overlay: one path + one dot per edge, data attribute and state class
355
- const layerEls = elements(client.TaskEdgeLayer({ edges: built }));
356
- const edgePaths = layerEls.filter((node) => node.type === 'path');
357
- assert.equal(edgePaths.length, 5, 'one path per dependency edge');
358
- for (const path of edgePaths) {
359
- assert.match(path.props['data-cabinet-edge'], /^[^\s]+->[^\s]+$/, 'data-cabinet-edge is "<blockedId>-><blockerId>"');
360
- assert.ok(/^cabinet-edge cabinet-edge-(pending|active|done)\b/.test(path.props.className), path.props.className);
361
- }
362
- const classByKey = Object.fromEntries(edgePaths.map((path) => [path.props['data-cabinet-edge'], path.props.className]));
363
- assert.ok(classByKey['t-build->t-research'].includes('cabinet-edge-done'), classByKey['t-build->t-research']);
364
- assert.ok(classByKey['t-audit->t-build'].includes('cabinet-edge-active'), classByKey['t-audit->t-build']);
365
- assert.ok(classByKey['t-audit->t-build'].includes('cabinet-edge-live'), 'running-owner flow edge is distinguishable');
366
- assert.ok(classByKey['t-extra->t-audit'].includes('cabinet-edge-pending'), classByKey['t-extra->t-audit']);
367
- const edgeDots = layerEls.filter((node) => node.type === 'circle');
368
- assert.equal(edgeDots.length, 5, 'every edge ends in a dot on the blocked side');
369
- assert.ok(edgeDots.every((dot) => dot.props['data-cabinet-edge-dot'].includes('->')));
370
- assert.equal(client.TaskEdgeLayer({ edges: [] }), null, 'no edges → no overlay layer');
371
310
  // panel render: cross-member tasks all expose measurement anchors, no premature edges
372
311
  const depTeam = {
373
312
  members: [
@@ -389,8 +328,15 @@ const directAnchored = edgeTasks.flatMap((task) => elements(client.TaskLine({ ta
389
328
  .filter((node) => node.props && 'data-cabinet-task' in node.props);
390
329
  assert.equal(directAnchored.length, edgeTasks.length, 'every TaskLine row carries a data-cabinet-task anchor (component contract)');
391
330
  assert.deepEqual(directAnchored.map((node) => node.props['data-cabinet-task']).sort(), edgeTasks.map((task) => task.id).sort());
331
+ // 任务依赖边整体下线(用户:名册里的乱线不要了):渲染树不得出现边/端点圆点。
392
332
  assert.ok(!depEls.some((node) => node.props && 'data-cabinet-edge' in node.props),
393
- 'edges are drawn only after measurement, never from stale render state');
333
+ 'no data-cabinet-edge path may render (dependency edges are removed)');
334
+ assert.ok(!depEls.some((node) => node.props && 'data-cabinet-edge-dot' in node.props),
335
+ 'no data-cabinet-edge-dot circle may render (dependency edges are removed)');
336
+ // 渲染树 SVG path:静态 render 未跑 measureLinks,linkPaths 初始为空——
337
+ // 此处只锁「一条边线都不渲染」;成员连线数(第一层卡数)由 connPaths=3 单测锁定。
338
+ const rosterPaths = depEls.filter((node) => node.type === 'path');
339
+ assert.equal(rosterPaths.length, 0, 'no edge path may render before measurement, got ' + rosterPaths.length);
394
340
  // TaskLine forwards the anchor id through Row onto the row element
395
341
  const depLine = client.TaskLine({
396
342
  task: edgeTasks[1],
@@ -409,31 +355,6 @@ assert.ok(reducedMedia.includes('.cabinet-edge-active') && reducedMedia.includes
409
355
  assert.ok(source.includes('.cabinet-edge-done{stroke:light-dark(#15803d,#4ade80)}'), 'done edge has theme-specific green contrast');
410
356
  assert.ok(source.includes('.cabinet-edge-pending{stroke:light-dark(#6b7280,#9ca3af)'), 'pending edge is static grey');
411
357
  assert.ok(source.includes('cabinetEdgeFlow'), 'active edge gets the dash-offset flow');
412
- // --- direction: the path LEAVES the blocker's row and LANDS on the blocked
413
- // task's row, dot included; the key still reads <blocked>-><blocker> because
414
- // only the geometry flipped (首辅 → 阁臣) ---
415
- const rectBoundary = (point, id) => {
416
- const rect = edgeRects.get(id);
417
- if (!rect) return false;
418
- const [x, y] = point;
419
- return ((x === rect.left || x === rect.right) && y >= rect.top && y <= rect.bottom)
420
- || ((y === rect.top || y === rect.bottom) && x >= rect.left && x <= rect.right);
421
- };
422
- const dPoints = (d) => d.split(/[MC]/).slice(1).map((part) => part.trim().split(/\s+/).map(Number));
423
- const near = (a, b) => Math.abs(a - b) < 0.05;
424
- for (const edge of built) {
425
- const [blockedId, blockerId] = edge.key.split('->');
426
- const [start, curve] = dPoints(edge.d);
427
- const end = curve.slice(-2);
428
- assert.ok(near(start[0], edge.s[0]) && near(start[1], edge.s[1]), `${edge.key}: M must sit on the start anchor`);
429
- assert.ok(near(end[0], edge.e[0]) && near(end[1], edge.e[1]), `${edge.key}: path end must sit on the end anchor`);
430
- assert.equal(edge.ex, edge.e[0], `${edge.key}: dot x is the path end`);
431
- assert.equal(edge.ey, edge.e[1], `${edge.key}: dot y is the path end`);
432
- assert.ok(rectBoundary(start, blockerId), `${edge.key}: start anchor lies on the BLOCKER row ${blockerId}`);
433
- assert.ok(rectBoundary(end, blockedId), `${edge.key}: end anchor lies on the BLOCKED row ${blockedId}`);
434
- assert.ok(!rectBoundary(start, blockedId), `${edge.key}: start is not on the blocked row — direction is blocker → blocked`);
435
- assert.ok(!rectBoundary(end, blockerId), `${edge.key}: end is not on the blocker row`);
436
- }
437
358
  // --- click-to-open: only a resolvable, non-inert target binds a handler ---
438
359
  const openLog = [];
439
360
  const recordOpen = (target) => { openLog.push(target); return true; };
@@ -775,7 +696,14 @@ assert.ok(typeof blockNode.props.style.border === 'string' && blockNode.props.st
775
696
  const dotNode = dressed.find((node) => node.props?.['data-cabinet-status'] !== undefined);
776
697
  assert.ok(dotNode, 'the head row carries the status dot');
777
698
  const descNode = dressed.find((node) => node.props?.['data-cabinet-task-desc'] !== undefined);
778
- assert.ok(descNode && descNode.children.join('') === '无进行中任务', 'a card without an in_progress task labels task absence independently from process state, got: ' + JSON.stringify(descNode && descNode.children));
699
+ assert.ok(descNode && descNode.children.join('') === '空闲', 'a card without an in_progress task shows the merged idle line, got: ' + JSON.stringify(descNode && descNode.children));
700
+ const idleFlat = JSON.stringify(dressed);
701
+ // 顶层恰好一个渲染中的任务行节点(收集器的嵌套快照不计入),其文本即唯一空闲文案。
702
+ const topDesc = dressed.filter((node) => node.props?.['data-cabinet-task-desc'] !== undefined);
703
+ assert.equal(topDesc.length, 1, 'exactly one rendered task-desc node at the card top level, got ' + topDesc.length);
704
+ assert.equal(topDesc[0].children.join(''), '空闲', 'the single task row owns the only idle text');
705
+ assert.ok(!idleFlat.includes('无进行中任务'), 'the redundant task-absence line is gone');
706
+ assert.ok(!dressed.some((node) => node.props?.['data-cabinet-activity-state'] !== undefined), 'no activity placeholder renders without data');
779
707
  const meterStyled = dressed.find((node) => node.props?.['data-cabinet-meter'] !== undefined);
780
708
  assert.equal(meterStyled.props.style.width, '42%', 'the segmented bar is left-aligned at ~42% card width');
781
709
  const footNode = dressed.find((node) => node.props?.key === 'foot');
@@ -853,9 +781,19 @@ const taskOnlyTree = elements(client.MemberCard({
853
781
  const taskOnlyDot = taskOnlyTree.find((node) => node.props?.['data-cabinet-status'] !== undefined);
854
782
  assert.equal(taskOnlyDot.props['data-cabinet-status'], 'inactive', 'an in_progress task cannot override the idle process status, got: ' + taskOnlyDot.props['data-cabinet-status']);
855
783
  assert.equal(taskOnlyDot.props.style.animation, undefined, 'the process dot does not animate merely because a task remains in_progress');
856
- assert.equal(taskOnlyTree[0].props['data-cabinet-sweep'], undefined, 'an idle process never wears the running card marker');
857
- assert.equal(taskOnlyTree[0].props.style.overflow, undefined, 'a task alone does not open the sweep window');
858
- assert.equal(taskOnlyTree[0].props.style['--cab-live-hue'], undefined, 'a task alone does not start the card animation');
784
+ assert.equal(taskOnlyTree[0].props['data-cabinet-sweep'], '1', 'an in_progress task keeps the card marker (the task is moving)');
785
+ assert.equal(taskOnlyTree[0].props.style.overflow, 'hidden', 'a live task opens the sweep window');
786
+ assert.equal(taskOnlyTree[0].props.style['--cab-live-hue'], 'hsl(138 58% 52%)', 'the task-only sweep rides the family hue');
787
+ // Only in_progress moves: a pending task on an idle process must not start the sweep.
788
+ const idlePendingTree = elements(client.MemberCard({
789
+ member: { id: 'm-pend', name: 'pend', phase: 'active' },
790
+ running: false,
791
+ statusLabel: (status) => status,
792
+ t: zhT,
793
+ familyColor: 'hsl(138 58% 52%)',
794
+ activeTask: { id: 'pp', subject: '待办', status: 'pending' },
795
+ }));
796
+ assert.equal(idlePendingTree[0].props['data-cabinet-sweep'], undefined, 'a pending task does not start the sweep (only in_progress moves)');
859
797
  const taskOnlyDesc = taskOnlyTree.find((node) => node.props?.['data-cabinet-task-desc'] !== undefined);
860
798
  const findMark = (node) => {
861
799
  if (Array.isArray(node)) { for (const child of node) { const hit = findMark(child); if (hit) return hit; } return null; }
@@ -871,10 +809,34 @@ assert.ok(String(taskMark.props.style.animation).includes('cabinetPulse'), 'the
871
809
  // keyframes 必须真的在 STYLE_CSS 里——只有 animation 没有 @keyframes 会被浏览器静默忽略。
872
810
  const pulseCss = Array.isArray(client.STYLE_CSS) ? client.STYLE_CSS.join('\n') : String(client.STYLE_CSS || '');
873
811
  assert.ok(pulseCss.includes('@keyframes cabinetPulse'), 'cabinetPulse keyframes are injected via STYLE_CSS (no silent-ignore)');
812
+
813
+ // 悬停才显示(用户方案A):派活入口 + 全部任务折叠四态 CSS——默认浮层隐藏不占位、
814
+ // hover 淡入、键盘 focus 与展开态常显、无 hover 设备常显。
815
+ assert.ok(pulseCss.includes('.cabinet-card:hover [data-cabinet-dispatch]'), 'hover fades the dispatch entry in');
816
+ assert.ok(pulseCss.includes(':focus-within'), 'keyboard focus keeps both entries visible');
817
+ assert.ok(pulseCss.includes('[data-cabinet-dispatch]:has([data-cabinet-dispatch-input])') && pulseCss.includes('[data-cabinet-member-tasks][open]'), 'an open dispatch editor or an open details stays visible');
818
+ assert.ok(pulseCss.includes('@media (hover:none)'), 'touch/no-hover devices see both entries by default');
819
+ const defaultHidden = (pulseCss.match(/\.cabinet-card \[data-cabinet-dispatch\],\.cabinet-card \[data-cabinet-member-tasks\]\{[^{}]*\}/) || [''])[0];
820
+ assert.ok(defaultHidden.includes('opacity:0') && defaultHidden.includes('pointer-events:none'), 'the default state fades both entries out without detaching them, got: ' + defaultHidden);
821
+ assert.ok(defaultHidden.includes('position:absolute'), 'the default state parks both entries as overlays so no vertical row is left blank, got: ' + defaultHidden);
822
+ assert.ok(pulseCss.includes('.cabinet-card [data-cabinet-member-tasks][open]{position:static}'), 'an open details returns to flow so its task list is never clipped by the sweep card');
823
+ // 功能负断言:默认隐藏只是可见性层——派活钩子仍在源码里,点击流程由
824
+ // test-dispatch-browser 真 React 全流程锁定(本静态层只锁节点不消失)。
825
+ assert.ok(source.includes("'data-cabinet-dispatch-open'") && source.includes("'data-cabinet-dispatch-panel'"), 'dispatch hooks stay in the source (CSS hides, never unmounts)');
826
+ assert.ok(pulseCss.includes('[data-cabinet-dispatch]:has([data-cabinet-dispatch-input])'), 'the open editor row (dispatch-panel) is what keeps the entry up');
874
827
  assert.ok(pulseCss.includes('@keyframes cabinetSpin'), 'cabinetSpin remains for the avatar ring');
875
828
  assert.ok(pulseCss.includes('[data-cabinet-sweep]::before') && pulseCss.includes('offset-path:rect(0 100% 100% 0 round 12px)'), 'the border dot follows the rounded card perimeter');
876
829
  assert.ok(pulseCss.includes('cabinetDotRun 2s linear infinite') && pulseCss.includes('@keyframes cabinetDotRun{to{offset-distance:100%}}'), 'the dot runs via offset distance');
877
830
  assert.ok(pulseCss.includes('prefers-reduced-motion'), 'the sweep stops under prefers-reduced-motion');
831
+ const sweepBody = (pulseCss.match(/\[data-cabinet-sweep\]::before\{[^{}]*\}/) || [''])[0];
832
+ assert.ok(sweepBody && !sweepBody.includes('conic-gradient'), 'the sweep rule body carries no conic scanner (Motion Path dot only)');
833
+
834
+ // Historical tokens cannot be repriced using a current model selection.
835
+ for (const model of ['deepseek-chat', 'auto/deepseek-v4.1-flash', 'xiaomi/mimo-v2.6-flash', 'openai-codex/gpt-5.x']) {
836
+ const card = elements(client.MemberCard({ member: { id: 'cost', name: 'cost', phase: 'active' }, model,
837
+ usage: { tokens: 1000000, buckets: { uncachedInputTokens: 1000000 } }, statusLabel: s => s, t: zhT }));
838
+ assert.ok(!card.some(node => node.props?.key === 'cost'), 'no unsupported currency estimate for ' + model);
839
+ }
878
840
  assert.ok(pulseCss.includes('will-change:offset-distance'), 'the dot hints only its animated offset distance');
879
841
  assert.ok(pulseCss.includes('pointer-events:none'), 'the sweep layer never blocks card clicks');
880
842
  // 成本:宿主无 ¥ 数据源(tokenUsage 投影只有 4 个分项 token,无金额字段)——卡上不出现货币符号、不编数。
@@ -1076,27 +1038,6 @@ persistentRefs = null;
1076
1038
  // Stateful lifecycle, initial/settled loads and timer cleanup are exercised
1077
1039
  // with real React DOM by scripts/test-panel-browser.mjs, not this hook double.
1078
1040
  console.log('PASS: member usage formatting, missing data, throttle helpers, active.through parity, blocker chips that do not navigate, team total including the lead, and the projection facts — a ready load short-circuits (the retry call reads nothing) while a Host push frame updates the card without another read; lifecycle is tested separately with real React DOM');
1079
- console.log('PASS: task dependency edges — data attributes, three states, missing-blocker tolerance, reduced-motion CSS, geometry refresh gate');
1080
-
1081
- // IDs are opaque; delimiter-bearing pairs must not collide or inject markup.
1082
- const special = client.buildTaskEdges(edgeBase, [
1083
- {id:'a->b',blockedBy:['c','c']}, {id:'a',blockedBy:['b->c']},
1084
- {id:'c'}, {id:'b->c'}, null, {id:'deleted',status:'deleted',blockedBy:['c']},
1085
- {id:'self',blockedBy:['self']}
1086
- ], () => edgeRect(20,20));
1087
- assert.equal(special.length,2);
1088
- assert.equal(new Set(special.map(e=>e.key)).size,2);
1089
- assert.equal(client.buildTaskEdges(edgeBase,[{id:'\ud800',blockedBy:['c']},{id:'c'}],()=>edgeRect(20,20)).length,1);
1090
- const masked = elements(client.TaskEdgeLayer({edges:built,cards:[{left:300,top:200,width:140,height:26}]}));
1091
- assert.ok(masked.filter(e=>e.type==='path').every(e=>e.props.mask==='url(#test-mask)'));
1092
- assert.ok(masked.some(e=>e.type==='rect' && e.props.fill==='black' && e.props.x===300));
1093
- console.log('PASS: opaque IDs, malformed/deleted/self dependency filtering and card-content masks');
1094
-
1095
- const adjacent=client.buildTaskEdges(edgeBase,[{id:'top'},{id:'bottom',blockedBy:['top']}],id=>edgeRect(20,id==='top'?100:126));
1096
- assert.equal(adjacent.length,1);assert.notEqual(adjacent[0].s[1],adjacent[0].e[1]);
1097
- assert.ok(adjacent[0].c1[0]>adjacent[0].s[0]);
1098
- console.log('PASS: adjacent same-column rows retain a nonzero gutter curve');
1099
- console.log('PASS: edge direction blocker → blocked (start on blocker row, dot on blocked row) and click-to-open binding rules (lead/unassigned/inert never bind)');
1100
1041
 
1101
1042
  // --- settings page: four tabs + the memory-plugin card ----------------------
1102
1043
  // The shared React double above keeps useState inert; this second instance gives
@@ -1601,7 +1542,8 @@ assert.equal(client.usageFor({tokenUsage:{outputTokens:-1},contextPressure:{cont
1601
1542
  members: [{ id: 'm-idle', name: 'idler', role: 'mate', phase: 'active' }],
1602
1543
  tasks: [{ id: 't-done', subject: '做完了的旧活', status: 'completed', ownerName: 'idler' }],
1603
1544
  }, client.zh)));
1604
- assert.ok(idleTree.includes('无进行中任务'), 'a member with only completed tasks explicitly has no current task');
1545
+ assert.ok(idleTree.includes('空闲'), 'a member with only completed tasks shows the merged idle line');
1546
+ assert.ok(!idleTree.includes('无进行中任务'), 'the redundant task-absence line is gone for completed-only members');
1605
1547
  assert.ok(idleTree.includes('做完了的旧活'), 'completed tasks remain available in collapsed details');
1606
1548
  const english = client.TaskLine({
1607
1549
  task: { id: 'en-1', subject: 'sheet', status: 'pending' },
@@ -1642,7 +1584,7 @@ assert.equal(client.usageFor({tokenUsage:{outputTokens:-1},contextPressure:{cont
1642
1584
  assert.equal(rows2.length, 1, 'two ministers share one row, got ' + rows2.length);
1643
1585
  assert.equal(cardsIn(rows2[0]).length, 2, 'the single row holds both cards');
1644
1586
  const gridBox = elements(render(layerTeam(9), client.zh)).find((node) => node.props?.key === 'grid');
1645
- assert.ok(gridBox && gridBox.props.style.rowGap >= 90, 'layers keep a 90px+ vertical gap for the arcs, got ' + JSON.stringify(gridBox && gridBox.props.style.rowGap));
1587
+ assert.equal(gridBox && gridBox.props.style.rowGap, 30, 'row gap matches the lead card 30px margin, got ' + JSON.stringify(gridBox && gridBox.props.style.rowGap));
1646
1588
  // 弧线连线几何实测(buildConnectorPaths 真跑合成矩形):lead 扇形同点出发、
1647
1589
  // 每卡一条贝塞尔止于顶中点、每层居中卡扇形连下一层、线色随目标卡。
1648
1590
  const connBase = { left: 0, top: 0, width: 600, height: 900 };
@@ -1666,8 +1608,34 @@ assert.equal(client.usageFor({tokenUsage:{outputTokens:-1},contextPressure:{cont
1666
1608
  assert.equal(arrived, 9, 'every layered card receives an arc ending at its top centre, got ' + arrived);
1667
1609
  const hubFan = connD.filter((d) => d.indexOf('M 300 320 L 300 334 C ') === 0);
1668
1610
  assert.equal(hubFan.length, 0, 'no member is made the parent of the next visual row, got ' + hubFan.length);
1669
- assert.equal(connPaths.length, 9);
1670
- assert.ok(connD.every(d => d.startsWith('M 300 60 ')), 'every visual row remains a sibling sourced from Lead');
1611
+ // 总线扇出:3 fan + 1 主干 + 每后续层 1 水平段(2层) + 每卡 1 支线(6卡) = 12。
1612
+ assert.equal(connPaths.length, 12, 'lead fan(3) + trunk(1) + bus segments(2) + branches(6), got ' + connPaths.length);
1613
+ // 主干:M ax ay → L ax ay+8 → L trunkX ay+8 → L trunkX bottomY(列间隙,非中心线)。
1614
+ const trunkOnly = connD.filter((d) => /^M 300 60 L 300 68 L (\d+) 68 L \d+ \d+$/.test(d));
1615
+ assert.equal(trunkOnly.length, 1, 'exactly one neutral trunk with the 8px sideways step, got ' + trunkOnly.length);
1616
+ const connTrunkX = Number((trunkOnly[0] || '').match(/^M 300 60 L 300 68 L (\d+) /)[1]);
1617
+ assert.notEqual(connTrunkX, 300, 'the trunk leaves the lead centre-line for a column gap, got ' + connTrunkX);
1618
+ const coordReConn = /[-+]?\d*\.?\d+/g;
1619
+ const busSegs = connD.filter((d) => {
1620
+ const m = d.match(/^M (\d+) (\d+) L (\d+) (\d+)(?: L (\d+) (\d+))?$/);
1621
+ return !!m && m[2] === m[4] && (m[6] === undefined || m[6] === m[2]);
1622
+ });
1623
+ assert.equal(busSegs.length, 2, 'exactly one horizontal segment per later layer, got ' + busSegs.length);
1624
+ const branches = connD.filter((d) => d.includes(' C ') && d.indexOf('M 300 60 ') !== 0);
1625
+ assert.equal(branches.length, 6, 'one family-coloured branch per later-layer card, got ' + branches.length);
1626
+ // 旧 gutter 横穿的负断言:任何 x 都不得伸到最左卡左缘之外。
1627
+ // trunkX 不穿卡:不得落在任何卡的 [left-1, right+1] 内。
1628
+ for (const node of connNodes) {
1629
+ assert.ok(connTrunkX < node.left - 1 || connTrunkX > node.left + node.width + 1,
1630
+ 'trunk x=' + connTrunkX + ' must clear card [' + node.left + ',' + (node.left + node.width) + ']');
1631
+ }
1632
+ const minConnLeft = Math.min(...connNodes.map((node) => node.left));
1633
+ for (const d of connD) {
1634
+ const nums = d.match(coordReConn).map(Number);
1635
+ for (let i = 0; i < nums.length; i += 2) {
1636
+ assert.ok(nums[i] >= minConnLeft - 0.5, 'no segment reaches left of the outermost card (' + minConnLeft + '), got ' + nums[i] + ' in ' + d);
1637
+ }
1638
+ }
1671
1639
  const colored = connPaths.filter((path) => typeof path === 'object' && typeof path.color === 'string' && path.color.indexOf('hsl(') === 0);
1672
1640
  assert.ok(colored.length >= 9, 'arcs carry the target cards family colors, got ' + colored.length);
1673
1641
 
@@ -1681,12 +1649,20 @@ assert.equal(client.usageFor({tokenUsage:{outputTokens:-1},contextPressure:{cont
1681
1649
  }
1682
1650
  }
1683
1651
  const offPaths = client.buildConnectorPaths(offBase, offLead, offNodes, -8);
1684
- assert.ok(Array.isArray(offPaths) && offPaths.length === 6, 'six arcs build against a non-zero base, got ' + JSON.stringify(offPaths && offPaths.length));
1652
+ const offTrunk = offPaths.find((path) => /^M 300 100 L 300 108 L (\d+) 108 L \d+ \d+$/.test(path.d));
1653
+ assert.ok(offTrunk, 'the non-zero-base trunk keeps the 8px step form, got: ' + JSON.stringify(offPaths.map((path) => path.d)));
1654
+ const offTrunkX = Number(offTrunk.d.match(/^M 300 100 L 300 108 L (\d+) /)[1]);
1655
+ assert.notEqual(offTrunkX, 300, 'the trunk leaves the lead centre-line, got ' + offTrunkX);
1656
+ for (const node of offNodes) {
1657
+ assert.ok(offTrunkX < node.left - 1 || offTrunkX > node.left + node.width + 1,
1658
+ 'trunk x=' + offTrunkX + ' must clear card [' + node.left + ',' + (node.left + node.width) + ']');
1659
+ }
1660
+ assert.ok(Array.isArray(offPaths) && offPaths.length === 8, 'fan(3)+trunk(1)+bus(1)+branches(3) build against a non-zero base, got ' + JSON.stringify(offPaths && offPaths.length));
1685
1661
  const coordRe = /[-+]?\d*\.?\d+/g;
1686
1662
  for (const path of offPaths) {
1687
1663
  const nums = path.d.match(coordRe).map(Number);
1688
- for (const value of nums) {
1689
- assert.ok(value >= -8 && value <= offBase.width + 0.5, 'x within [0, base.width], got ' + value + ' in ' + path.d);
1664
+ for (let i = 0; i < nums.length; i += 2) {
1665
+ assert.ok(nums[i] >= 300 - 170 - 0.5 && nums[i] <= offBase.width + 0.5, 'x never reaches the old gutter (lead fan opens to 130 at the widest), got ' + nums[i] + ' in ' + path.d);
1690
1666
  }
1691
1667
  for (let i = 1; i < nums.length; i += 2) {
1692
1668
  assert.ok(nums[i] >= -0.5 && nums[i] <= offBase.height + 0.5, 'y within [0, base.height], got ' + nums[i] + ' in ' + path.d);
@@ -1701,6 +1677,21 @@ assert.equal(client.usageFor({tokenUsage:{outputTokens:-1},contextPressure:{cont
1701
1677
  offNodes.map((node) => ({ ...node, left: node.left + dx, top: node.top + dy })),
1702
1678
  -8);
1703
1679
  assert.deepEqual(movedPaths.map((path) => path.d), offPaths.map((path) => path.d), 'translating base+rects leaves every arc byte-identical');
1680
+ // Staggered 3+2: tail-only gap x=172 intersects the FIRST-row middle card.
1681
+ const stagger=[0,120,240].map(left=>({left,top:150,width:100,height:80})).concat([60,180].map(left=>({left,top:330,width:100,height:80})));
1682
+ const staggerPaths=client.buildConnectorPaths({left:0,top:0,width:400,height:500},{left:130,top:0,width:100,height:80},stagger,-8);
1683
+ const trunk=staggerPaths.find(p=>/^M 180 80 L 180 88 L /.test(p.d));
1684
+ assert.ok(trunk,'staggered layout has actual Lead trunk');
1685
+ const tx=Number(trunk.d.split(' ')[7]);
1686
+ for(const card of stagger)assert.ok(tx<card.left-1||tx>card.left+card.width+1,'trunk clears every card including first row');
1687
+ assert.ok(tx<0||tx>340,'no common gap uses outside channel, never overlapping centre');
1688
+ assert.ok(!staggerPaths.some(p=>/^M (50|170|290) 230 /.test(p.d)),'no false member-parent edges');
1689
+ const uneven=stagger.map((card,i)=>i===1?{...card,height:240}:card);
1690
+ const unevenPaths=client.buildConnectorPaths({left:0,top:0,width:400,height:500},{left:130,top:0,width:100,height:80},uneven,-8);
1691
+ const routed=unevenPaths.filter(p=>p.d.startsWith('M 180 80 L ')&&!p.d.includes(' C ')&&(/ L (110|230) 330$/).test(p.d));
1692
+ assert.equal(routed.length,2,'height collision uses two actual Lead-rooted safe routes');
1693
+ for(const path of routed){const pairs=path.d.match(/[-+]?\d*\.?\d+/g).map(Number);for(let i=2;i<pairs.length;i+=2){const ax=pairs[i-2],ay=pairs[i-1],bx=pairs[i],by=pairs[i+1];for(const card of uneven){const hit=ax===bx?ax>card.left&&ax<card.left+card.width&&Math.max(ay,by)>card.top&&Math.min(ay,by)<card.top+card.height:ay>card.top&&ay<card.top+card.height&&Math.max(ax,bx)>card.left&&Math.min(ax,bx)<card.left+card.width;assert.ok(!hit,'detour segment avoids every card interior');}}}
1694
+
1704
1695
  // 收尾:清 CabinetPanel 入队的 effect,防泄漏给后续块(3b47d6a2 教训)。
1705
1696
  recordedEffects.length = 0;
1706
1697
  }
@@ -3863,19 +3854,21 @@ assert.ok(!/background:\s*'(#fff|white)'/.test(source), 'no bare white backgroun
3863
3854
  }));
3864
3855
  }
3865
3856
 
3866
- // ---- 联想开关两态:配置项控制,提示词本体两态逐字相同(对齐上游 ed51fb3)----
3857
+ // ---- 联想开关两态:工厂提示词不变,成员上下文明确携带实时开关----
3867
3858
  // leadBlock 两态由 scripts/test-member-settings.mjs 的 associationLine/sectionText
3868
- // 断言覆盖;这里断言成员提示词层与 client 侧同款开关零改动。
3859
+ // 断言覆盖;这里核对成员上下文的实时状态与不变的工厂文案。
3869
3860
  {
3870
3861
  const offCfg = { associationMode: false, members: [] };
3871
3862
  const onCfg = { associationMode: true, members: [] };
3872
3863
  const tz = { role: 'teammate', name: 'tongzheng' };
3873
3864
  const offText = indexModule.memberBlock(offCfg, tz);
3874
3865
  const onText = indexModule.memberBlock(onCfg, tz);
3875
- assert.equal(onText, offText, 'the association switch leaves the member prompt text identical in both states');
3866
+ assert.match(onText, /联想模式当前开启(associationMode=true)/);
3867
+ assert.match(offText, /联想模式当前关闭(associationMode=false)/);
3868
+ assert.ok(onText.includes(indexModule.DEFAULT_MEMBER_PROMPTS.tongzheng), 'enabled state keeps the factory prompt verbatim');
3876
3869
  assert.ok(offText.includes(indexModule.DEFAULT_MEMBER_PROMPTS.tongzheng), 'the factory tongzheng prompt is embedded verbatim (section header aside)');
3877
3870
  assert.ok(offText.includes('去找与旧事、旁证、相邻经验的联系'), 'the duty clause stays verbatim, got: ' + offText.slice(0, 160));
3878
- assert.ok(!offText.includes('联想模式已关闭'), 'no closure sentence is ever injected');
3871
+ assert.ok(!offText.includes('联想模式当前开启'), 'off context must not claim association is enabled');
3879
3872
  assert.equal(indexModule.associationLine(offCfg), '', 'association-off renders nothing at all');
3880
3873
  assert.match(indexModule.associationLine(onCfg), /派活通政使/, 'association-on renders the dispatch-enable line');
3881
3874
  // client 侧 configuredPrompt 两态同文(开关不改提示词,只由配置项决定)。
@@ -1,7 +1,8 @@
1
1
  import fs from 'node:fs';
2
2
  import vm from 'node:vm';
3
3
  import assert from 'node:assert/strict';
4
- const dir=process.argv[2]||new URL('..',import.meta.url).pathname;
4
+ import { fileURLToPath } from 'node:url';
5
+ const dir=process.argv[2]||fileURLToPath(new URL('..',import.meta.url));
5
6
  const src=fs.readFileSync(dir+'/client.js','utf8');
6
7
  let api;
7
8
  vm.runInNewContext(src.replace('return { inject, apply };','return { groupChatFold, cabinetSessionGroups, groupFoldToken };'),{window:{__ModuleLoader__:{load:({factory})=>api=factory(()=>({createElement(){}}))}}});
@@ -10,7 +10,7 @@ const root = process.env.DSH_BROWSER_TEST_ROOT;
10
10
  if (!root) throw Error('Set DSH_BROWSER_TEST_ROOT to isolated npm test dependencies');
11
11
  const require = createRequire(root + '/package.json');
12
12
  const source = fs.readFileSync(new URL('../client.js', import.meta.url), 'utf8')
13
- .replace('return { inject, apply };', 'return { inject, apply, CabinetPanel, MemberCard, TaskLine, STYLE_CSS, en, setOpener: fn => cabinetOpenSession = fn, setSessions: s => { cabinetSessions = s; for (const fn of cabinetSessionsListeners) fn(); } };');
13
+ .replace('return { inject, apply };', 'return { inject, apply, CabinetPanel, MemberCard, TaskLine, buildConnectorPaths, STYLE_CSS, en, setOpener: fn => cabinetOpenSession = fn, setSessions: s => { cabinetSessions = s; for (const fn of cabinetSessionsListeners) fn(); } };');
14
14
  const fixture = `
15
15
  import React from 'react'; import {createRoot} from 'react-dom/client';
16
16
  window.__ModuleLoader__={load:({factory})=>window.cabinet=factory(()=>React)};
@@ -90,7 +90,7 @@ document.getElementById('run').onclick=async()=>{const passed=[];try{
90
90
  mounted=true;live=false;render();await wait();document.getElementById('result').textContent='PASS '+passed.length+' '+passed.join('; ');stats();
91
91
  }catch(e){document.getElementById('result').textContent='FAIL '+e.stack;stats()}};
92
92
  window.taskNavigationCount=()=>opens.length;
93
- window.motionMount=async(running=false)=>{taskRoot.render(React.createElement(cabinet.MemberCard,{member:{id:'motion',name:'motion',phase:'active'},running,activeTask:{id:'motion-task',subject:'Running',status:'in_progress'},statusLabel:s=>s,t:k=>k}));await wait();};
93
+ window.motionMount=async(running=false,withTask=true)=>{taskRoot.render(React.createElement(cabinet.MemberCard,{member:{id:'motion',name:'motion',phase:'active'},running,activeTask:withTask?{id:'motion-task',subject:'Running',status:'in_progress'}:undefined,statusLabel:s=>s,t:k=>k}));await wait();};
94
94
  window.taskKeyboardMount=async()=>{taskRoot.render(React.createElement(cabinet.TaskLine,{task:tasks[0],blockerOf:id=>tasks.find(t=>t.id===id),t:k=>cabinet.en[k]||k,taskLabel:s=>s,onOpenOwner:()=>opens.push(['mate'])}));await wait();return opens.length;};
95
95
  window.panelUnmount=async()=>{taskRoot.render(null);mounted=false;render();await wait();assert(timers.size===0,'final unmount cleanup');stats();return{timers:timers.size,errors};};
96
96
  render();stats();
@@ -156,8 +156,8 @@ if(process.argv.includes('--headless')){
156
156
  if(await mark.evaluate(el=>getComputedStyle(el).animationName)!=='none')throw Error('task pulse ignores reduced motion');
157
157
  await page.emulateMedia({reducedMotion:'no-preference'});
158
158
  if(await mark.evaluate(el=>getComputedStyle(el).animationName)!=='cabinetPulse')throw Error('task pulse failed to resume');
159
- // Stale in-progress task alone must not animate an idle agent.
160
- if(await page.locator('#task-fixture [data-cabinet-sweep]').count())throw Error('idle task falsely animates agent');
159
+ // User spec: an in_progress task keeps the card marker even while the process idles.
160
+ if(!(await page.locator('#task-fixture [data-cabinet-sweep]').count()))throw Error('live task does not animate the card');
161
161
  await page.evaluate(()=>window.motionMount(true));
162
162
  const runningCard=page.locator('#task-fixture [data-cabinet-sweep]');
163
163
  await runningCard.waitFor();
@@ -176,6 +176,15 @@ if(process.argv.includes('--headless')){
176
176
  if((await motion()).display!=='none')throw Error('unsupported fallback declaration not applied');
177
177
  await page.evaluate(()=>document.getElementById('fallback-probe').remove());
178
178
  if(supported&&(await motion()).display==='none')throw Error('fallback probe leaked');
179
+ // Real browser rectangles + SVG path sampling for staggered 3+2 geometry.
180
+ await page.evaluate(()=>{
181
+ const box=document.createElement('div');box.style.cssText='position:relative;width:400px;height:500px';document.body.append(box);
182
+ const rect=(left,top,height=80)=>{const el=document.createElement('div');el.style.cssText='position:absolute;left:'+left+'px;top:'+top+'px;width:100px;height:'+height+'px';box.append(el);return el.getBoundingClientRect()};
183
+ try{for(const tall of [false,true]){box.replaceChildren();const lead=rect(130,0),firstBottom=150+(tall?240:80),cards=[0,120,240].map(x=>rect(x,150,tall&&x===120?240:80)).concat([60,180].map(x=>rect(x,firstBottom+30))),base=box.getBoundingClientRect();
184
+ const paths=cabinet.buildConnectorPaths(base,lead,cards,-8);const svg=document.createElementNS('http://www.w3.org/2000/svg','svg');box.append(svg);
185
+ for(const path of paths){const el=document.createElementNS(svg.namespaceURI,'path');el.setAttribute('d',path.d);svg.append(el);const length=el.getTotalLength();for(let distance=1;distance<length;distance+=2){const point=el.getPointAtLength(distance);for(const card of cards){const x=point.x+base.left,y=point.y+base.top;if(x>card.left+.5&&x<card.right-.5&&y>card.top+.5&&y<card.bottom-.5)throw Error('connector crosses actual card interior')}}}
186
+ }}finally{box.remove()}
187
+ });
179
188
  if(process.env.CABINET_SCREENSHOT)await page.screenshot({path:process.env.CABINET_SCREENSHOT,fullPage:true});
180
189
  const cleanup=await page.evaluate(()=>window.panelUnmount());
181
190
  if(errors.length||cleanup.errors.length)throw Error([...errors,...cleanup.errors].join('\n'));
@@ -0,0 +1,42 @@
1
+ import assert from 'node:assert/strict';
2
+ import { readFileSync } from 'node:fs';
3
+ import { runInNewContext } from 'node:vm';
4
+ import { memberBlock, DEFAULT_MEMBER_PROMPTS } from '../index.js';
5
+
6
+ const source = readFileSync(new URL('../client.js', import.meta.url), 'utf8');
7
+ let api;
8
+ const react = {
9
+ createElement: (type, props, ...children) => ({ type, props: props || {}, children }),
10
+ useState: value => [typeof value === 'function' ? value() : value, () => {}],
11
+ useRef: value => ({ current: value }), useMemo: fn => fn(), useCallback: fn => fn,
12
+ useEffect: () => {}, useLayoutEffect: () => {}, useId: () => 'safe-fixes',
13
+ };
14
+ runInNewContext(source.replace('return { inject, apply };', 'return { MemberCard, STYLE_CSS, DEFAULT_MEMBER_PROMPTS };'), {
15
+ setTimeout, clearTimeout, console,
16
+ window: { __ModuleLoader__: { load: ({ factory }) => { api = factory(name => {
17
+ if (name !== 'react') throw new Error('optional host module unavailable');
18
+ return react;
19
+ }); } } },
20
+ });
21
+ const flatten = node => Array.isArray(node) ? node.flatMap(flatten)
22
+ : node && typeof node === 'object' ? [node, ...flatten(node.children || [])] : [];
23
+ const text = node => Array.isArray(node) ? node.map(text).join('')
24
+ : node && typeof node === 'object' ? text(node.children || []) : node ?? '';
25
+ const render = (phase, running, activeTask) => flatten(api.MemberCard({
26
+ member: { id: 'works', name: 'works', phase }, running, activeTask, t: key => key,
27
+ }));
28
+ for (const [phase, running] of [['active', true], ['failed', false], ['provisioning', false]]) {
29
+ const task = render(phase, running).find(n => n.props['data-cabinet-task-desc']);
30
+ assert.equal(text(task), 'member.noTask', `${phase}/${running} without task is not idle`);
31
+ }
32
+ const idle = render('active', false, { id: 'task', status: 'in_progress', subject: 'Still assigned' });
33
+ const state = idle.find(n => n.props['data-cabinet-member-status'] === 'inactive');
34
+ assert.equal(text(state), 'status.inactive', 'idle state stays accessible even with a stale task');
35
+ assert.match(api.STYLE_CSS, /\[data-cabinet-dispatch\]:has\(\[data-cabinet-dispatch-input\]\).*?\{position:static\}/);
36
+ assert.match(api.STYLE_CSS, /\[data-cabinet-dispatch-input\]\{[^}]*max-width:100%;width:100%/);
37
+ const member = { role: 'teammate', name: 'tongzheng' };
38
+ assert.match(memberBlock({ associationMode: false }, member), /联想模式当前关闭(associationMode=false)/);
39
+ assert.match(memberBlock({ associationMode: true }, member), /联想模式当前开启(associationMode=true)/);
40
+ assert.equal(api.DEFAULT_MEMBER_PROMPTS.yushi, DEFAULT_MEMBER_PROMPTS.yushi);
41
+ assert.match(DEFAULT_MEMBER_PROMPTS.yushi, /每项缺陷各贴一处 path:line/);
42
+ console.log('PASS: PR42 safe state, prompt and expanded-dispatch regressions');
@@ -3,12 +3,13 @@ import fs from 'node:fs';import vm from 'node:vm';import assert from 'node:asser
3
3
  const source=fs.readFileSync(new URL('../client.js',import.meta.url),'utf8');
4
4
  let client,slots=[],cursor=0;
5
5
  const React={createElement:(type,props,...children)=>({type,props:props||{},children}),useState:init=>{const i=cursor++;if(!(i in slots))slots[i]=init;return[slots[i],value=>slots[i]=typeof value==='function'?value(slots[i]):value]}};
6
- vm.runInNewContext(source.replace('return { inject, apply };','return { MemberCard, TaskLine, buildConnectorPaths, buildTaskEdges, taskEdgesEqual };'),{window:{__ModuleLoader__:{load:({factory})=>client=factory(()=>React)}}});
6
+ vm.runInNewContext(source.replace('return { inject, apply };','return { MemberCard, TaskLine, buildConnectorPaths };'),{window:{__ModuleLoader__:{load:({factory})=>client=factory(()=>React)}}});
7
7
  const all=node=>Array.isArray(node)?node.flatMap(all):!node||typeof node!=='object'?[]:[node,...all(node.children)];
8
8
  const task={id:'task-active',subject:'Active task',status:'in_progress',blockedBy:[],description:'Task sheet',writeScopes:['isolated']};
9
9
  const card=client.MemberCard({member:{id:'mate',name:'works',phase:'active'},activeTask:task,statusLabel:x=>x,t:x=>x,activity:{known:false}});
10
10
  assert.ok(all(card).some(n=>n.props['data-cabinet-task']===task.id));
11
- assert.ok(all(card).some(n=>n.props['data-cabinet-activity-state']==='unknown'));
11
+ assert.ok(!all(card).some(n=>n.props['data-cabinet-activity-state']!==undefined),'unknown activity renders no placeholder line');
12
+ assert.ok(!JSON.stringify(all(card)).includes('活动'),'no 活动 text without data');
12
13
  let opened=0;const renderTask=()=>{cursor=0;return client.TaskLine({task,blockerOf:()=>null,t:x=>x,taskLabel:x=>x,onOpenOwner:()=>opened++})};
13
14
  let tree=renderTask(),button=all(tree).find(n=>n.props['data-cabinet-task-sheet-toggle']===task.id);
14
15
  assert.equal(button.type,'button');assert.equal(button.props.type,'button');assert.equal(button.props['aria-expanded'],false);let stopped=0;button.props.onClick({stopPropagation(){stopped++}});tree=renderTask();button=all(tree).find(n=>n.props['data-cabinet-task-sheet-toggle']===task.id);assert.equal(button.props['aria-expanded'],true);assert.equal(opened,0);assert.equal(stopped,1);assert.ok(all(tree).some(n=>n.props['data-cabinet-task-sheet']==='description'));
@@ -19,9 +20,9 @@ assert.equal(client.buildConnectorPaths(rect,lead,[]).length,0);
19
20
  // Exercise actual measureLinks callback: visible empty nodes must reach both
20
21
  // drawing setters, not return early and leave stale dependency arrows behind.
21
22
  const start=source.indexOf('const measureLinks = React.useCallback('),end=source.indexOf('// Re-measure after every commit',start);
22
- let links=['old'],edges=['old'];
23
- const ctx={React:{useCallback:fn=>fn},treeRef:{current:{getBoundingClientRect:()=>rect,querySelectorAll:()=>[]}},leadRef:{current:{getBoundingClientRect:()=>lead}},edgeDataRef:{current:{tasks:[],live:new Set()}},setLinkPaths:fn=>links=fn(links),setEdges:fn=>edges=fn(edges),setEdgeCards(){},buildConnectorPaths:client.buildConnectorPaths,buildTaskEdges:client.buildTaskEdges,taskEdgesEqual:client.taskEdgesEqual};
24
- vm.runInNewContext(source.slice(start,end)+'measureLinks();',ctx);assert.equal(links.length,0);assert.equal(edges.length,0);console.log('PASS visible empty roster clears connector and dependency overlays');
23
+ let links=['old'];
24
+ const ctx={React:{useCallback:fn=>fn},treeRef:{current:{getBoundingClientRect:()=>rect,querySelectorAll:()=>[]}},leadRef:{current:{getBoundingClientRect:()=>lead}},setLinkPaths:fn=>links=fn(links),buildConnectorPaths:client.buildConnectorPaths};
25
+ vm.runInNewContext(source.slice(start,end)+'measureLinks();',ctx);assert.equal(links.length,0);console.log('PASS visible empty roster clears the connector overlay (dependency edges removed)');
25
26
  const begin=source.indexOf("if (activeTab === 'timeline') {",source.indexOf('// 数据 = 群聊'));
26
27
  const finish=source.indexOf('const isLeadTask =',begin);
27
28
  function timeline(view){const body=[];const member={id:'mate',name:'works'};const c={activeTab:'timeline',chatMembers:[member],groupRows:view.error?[{kind:'error',time:0,seq:0,memberName:'works'}]:[],group:{views:()=>view},body,h:React.createElement,PANEL:{},INK2:'gray',memberLabel:x=>x,tt:x=>x,panelRef:{}};return vm.runInNewContext('(function(){'+source.slice(begin,finish)+'})()',c)}
@@ -32,23 +33,16 @@ console.log('PASS timeline distinguishes failed/pending history from genuinely e
32
33
  for (const [phase,running,expected] of [['active',true,'running'],['active',false,'inactive'],['failed',false,'failed'],['provisioning',false,'provisioning']]) {
33
34
  const nodes=all(client.MemberCard({member:{id:'m',name:'works',phase},running,statusLabel:s=>'status:'+s}));
34
35
  const label=nodes.find(n=>n.props['data-cabinet-member-status']===expected);
35
- assert.ok(label);assert.equal(label.children[0],'status:'+expected);
36
- assert.equal(nodes.find(n=>n.props['data-cabinet-task-desc']).children[0],'无进行中任务');
36
+ assert.ok(label);
37
+ if(expected==='inactive')assert.equal(String(label.children[0]??''),'status:inactive','idle status remains readable even with a task');
38
+ else assert.equal(label.children[0],'status:'+expected);
39
+ // identity locale (t:x=>x) 下 tt('status.inactive') 原样透出;真中文由 test-client 的 zhT 卡锁。
40
+ assert.equal(nodes.find(n=>n.props['data-cabinet-task-desc']).children[0],expected==='inactive'?'status.inactive':'member.noTask');
37
41
  }
38
42
  const stale=all(client.MemberCard({member:{id:'m',name:'works',phase:'active'},running:false,activeTask:task,statusLabel:s=>s}));
39
43
  assert.ok(stale.some(n=>n.props['data-cabinet-member-status']==='inactive'));
40
- assert.equal(stale[0].props['data-cabinet-sweep'],undefined);
41
- // Hidden details duplicate an active task's anchor. They must not overwrite its
42
- // visible compact-card anchor; expanded task rows may legitimately supersede it.
43
- let lookedUp;
44
- ctx.treeRef.current.querySelectorAll=selector=>selector==='[data-cabinet-task]'?[
45
- {getAttribute:()=>task.id,getBoundingClientRect:()=>({left:1,top:50,width:80,height:20})},
46
- {getAttribute:()=>task.id,getBoundingClientRect:()=>({left:0,top:0,width:0,height:0})}
47
- ]:[];
48
- ctx.buildTaskEdges=(base,tasks,lookup)=>{lookedUp=lookup(task.id);return []};
49
- vm.runInNewContext(source.slice(start,end)+'measureLinks();',{...ctx});
50
- assert.equal(lookedUp.width,80);
51
- console.log('PASS actual process status is readable; hidden task details cannot erase visible dependency anchors');
44
+ assert.equal(stale[0].props['data-cabinet-sweep'],'1');
45
+ console.log('PASS actual process status remains readable from the cards: running / inactive, failed, provisioning');
52
46
 
53
47
  const mark=all(card).find(n=>n.props.className==='cabinet-task-mark');
54
48
  assert.ok(mark);assert.match(mark.props.style.animation,/cabinetPulse/);
@@ -385,7 +385,7 @@ if (existsSync(PATCH_PATH)) {
385
385
  }
386
386
 
387
387
  // ---------- fallback scripts ----------
388
- for (const test of ['test-member-settings.mjs', 'test-model-routing.mjs', 'test-model-picker.mjs', 'test-install.mjs', 'test-client.mjs', 'test-rail-redesign-regression.mjs', 'test-browser-runner-cleanup.mjs', 'test-groupchat-reducer.mjs', 'test-groupchat-v2-regression.mjs', 'test-groupchat-lifecycle.mjs', 'test-client-inject.mjs', 'test-avatars.mjs', 'test-roster.mjs']) {
388
+ for (const test of ['test-member-settings.mjs', 'test-model-routing.mjs', 'test-model-picker.mjs', 'test-install.mjs', 'test-client.mjs', 'test-pr42-safe.mjs', 'test-rail-redesign-regression.mjs', 'test-browser-runner-cleanup.mjs', 'test-groupchat-reducer.mjs', 'test-groupchat-v2-regression.mjs', 'test-groupchat-lifecycle.mjs', 'test-client-inject.mjs', 'test-avatars.mjs', 'test-roster.mjs']) {
389
389
  const result = spawnSync(process.execPath, [join(ROOT, 'scripts', test)], {
390
390
  encoding: 'utf8', timeout: 30000, windowsHide: true,
391
391
  });