dsh-cabinet-mode 0.9.2 → 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,14 @@
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
+
5
13
  ## [0.9.2] - 2026-11-13
6
14
 
7
15
  ### 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.2/dsh-cabinet-mode-0.9.2.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.2/dsh-cabinet-mode-0.9.2.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.2/dsh-cabinet-mode-0.9.2.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.2/dsh-cabinet-mode-0.9.2.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,7 +3527,8 @@ window.__ModuleLoader__.load({
3512
3527
  return Math.floor(hours / 24) + 'd' + String(hours % 24).padStart(2, '0') + 'h';
3513
3528
  }
3514
3529
 
3515
- // Token totals lack provider/billing-period/model-history evidence: no currency estimate.
3530
+ // No historical model/provider/billing attribution: never reprice totals as currency.
3531
+
3516
3532
  /** Sum the four disjoint provider-usage buckets; undefined when none exists. */
3517
3533
  function tokenTotalOf(usage) {
3518
3534
  if (usage === undefined || usage === null || typeof usage !== 'object') return undefined;
@@ -3573,7 +3589,8 @@ window.__ModuleLoader__.load({
3573
3589
  segments: sum > 0 ? parts.map((part) => ({ key: part.key, ratio: part.value / sum })) : []
3574
3590
  };
3575
3591
  }
3576
- return { tokens, elapsedMs, context };
3592
+ // 4 桶原样带给费用估算(costOf 只认真实分项,不拿合计拆桶瞎算)。
3593
+ return { tokens, elapsedMs, context, buckets: source.tokenUsage?.totals ?? source.tokenUsage };
3577
3594
  }
3578
3595
 
3579
3596
  /**
@@ -3709,7 +3726,7 @@ window.__ModuleLoader__.load({
3709
3726
  return h('div', { 'data-cabinet-dispatch': memberId, onClick: stopPropagation, onKeyDown: stopPropagation, style: { marginTop: 4, fontSize: 11 } }, [
3710
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')),
3711
3728
  h('span', { key: 'status', role: 'status', 'data-cabinet-dispatch-status': '1', 'data-cabinet-dispatch-phase': phase }, message),
3712
- open ? h('div', { key: 'editor' }, [
3729
+ open ? h('div', { key: 'editor', 'data-cabinet-dispatch-panel': '1' }, [
3713
3730
  h('input', { key: 'input', 'data-cabinet-dispatch-input': '1', 'aria-label': tt('dispatch.placeholder'), value: draft, disabled: locked,
3714
3731
  onChange: event => { if (state.current.pending || state.current.unknown) return; draftRef.current = event.target.value; setDraft(event.target.value); },
3715
3732
  onKeyDown: event => { if (event.key === 'Enter' && !event.repeat && !event.isComposing && !event.nativeEvent?.isComposing && event.keyCode !== 229) { event.preventDefault(); submit('queue'); } } }),
@@ -3725,7 +3742,8 @@ window.__ModuleLoader__.load({
3725
3742
  // Card activity follows the real process. The task marker independently
3726
3743
  // indicates task bookkeeping, which may remain in_progress while idle.
3727
3744
  const taskLive = activeTask !== null && activeTask !== undefined && activeTask.status === 'in_progress';
3728
- const animating = member.phase === 'active' && running === true;
3745
+ const animating = member.phase === 'active' && (running === true || taskLive);
3746
+ // 估算费用:有单价有分项才显示金额,否则 —;title 标明估算非账单。
3729
3747
  const status = member.phase === 'active' ? (running === true ? 'running' : 'inactive') : member.phase;
3730
3748
  const canOpen = typeof onOpen === 'function'
3731
3749
  && isCurrent !== true
@@ -3785,8 +3803,9 @@ window.__ModuleLoader__.load({
3785
3803
  }, tt('current')) : null
3786
3804
  ]),
3787
3805
  // Agent status and task status are independent; a stale task never implies a running agent.
3806
+ // 保留可访问状态名;有任务也不能隐去进程的空闲状态。
3788
3807
  h('span', { key: 'state', 'data-cabinet-member-status': status, style: { fontSize: 11, color: INK2 } },
3789
- typeof statusLabel === 'function' ? statusLabel(status) : status),
3808
+ typeof statusLabel === 'function' ? statusLabel(status) : tt('status.' + status)),
3790
3809
  h('div', {
3791
3810
  key: 'taskdesc',
3792
3811
  'data-cabinet-task-desc': '1',
@@ -3804,8 +3823,8 @@ window.__ModuleLoader__.load({
3804
3823
  animation: taskLive ? 'cabinetPulse 1.7s ease-out infinite' : undefined
3805
3824
  }
3806
3825
  }, '\u25cf'), activeTask.subject]
3807
- // Absence of a task says nothing about the process state.
3808
- : tt('member.noTask')),
3826
+ // 没有任务不代表进程空闲;运行、启动和失败状态不能标为空闲。
3827
+ : tt(status === 'inactive' ? 'status.inactive' : 'member.noTask')),
3809
3828
  // 故障必须可见:member.error 整行红字(模型行已按截图移除)。
3810
3829
  member.error ? h('div', {
3811
3830
  key: 'err',
@@ -4008,56 +4027,6 @@ window.__ModuleLoader__.load({
4008
4027
  }, children);
4009
4028
  }
4010
4029
 
4011
- // Dependency-edge overlay: one cubic path + one blocked-side dot per edge
4012
- // (the line leaves the blocker's row and lands on the blocked task's row),
4013
- // masked behind card interiors while endpoint dots remain visible. The
4014
- // layer is pointer-transparent, so rows stay clickable.
4015
- // `data-cabinet-edge="<blocked>-><blocker>"` — key format is unchanged by
4016
- // the geometry flip — plus a cabinet-edge-pending/active/done class makes
4017
- // every edge assertable.
4018
- function TaskEdgeLayer({ edges, cards = [] }) {
4019
- const maskId = React.useId();
4020
- if (!Array.isArray(edges) || edges.length === 0) return null;
4021
- return h('svg', {
4022
- 'aria-hidden': 'true',
4023
- className: 'cabinet-edge-layer',
4024
- style: { position: 'absolute', left: 0, top: 0, width: '100%', height: '100%', pointerEvents: 'none', overflow: 'visible', zIndex: 2 }
4025
- }, [
4026
- h('defs', { key: 'defs' }, h('mask', { id: maskId, maskUnits: 'userSpaceOnUse', x: -20, y: -20, width: '120%', height: '120%' }, [
4027
- h('rect', { key: 'base', x: -20, y: -20, width: '120%', height: '120%', fill: 'white' }),
4028
- ...cards.map((card, index) => h('rect', { key: index, x: card.left, y: card.top, width: card.width, height: card.height, fill: 'black' }))
4029
- ])),
4030
- ...edges.flatMap((edge) => [
4031
- h('path', {
4032
- key: 'p:' + edge.key,
4033
- className: 'cabinet-edge cabinet-edge-' + edge.state + (edge.live ? ' cabinet-edge-live' : ''),
4034
- 'data-cabinet-edge': edge.key,
4035
- mask: 'url(#' + maskId + ')',
4036
- d: edge.d
4037
- }),
4038
- h('circle', {
4039
- key: 'c:' + edge.key,
4040
- 'aria-hidden': 'true',
4041
- className: 'cabinet-edge-dot cabinet-edge-dot-' + edge.state,
4042
- 'data-cabinet-edge-dot': edge.key,
4043
- cx: edge.ex,
4044
- cy: edge.ey,
4045
- r: 3
4046
- })
4047
- ])]);
4048
- }
4049
-
4050
- // #region connectors — pure geometry (the self-test harness extracts this)
4051
- // Builds the 品字形 org-chart links per row: every row owns a horizontal bus
4052
- // 8px above its cards, each card drops a short vertical stub onto that bus,
4053
- // the lead card feeds row 0's bus with a trunk (joining horizontally when
4054
- // the lead axis sits off the bus span), and consecutive rows are tied by a
4055
- // polyline that leaves a bus END, turns at a side clear of every card
4056
- // (right side first, then left, then the container margin channel) and
4057
- // lands on the previous row's bus. Every candidate segment is validated
4058
- // against the measured card rectangles — a hit tries the next side — so no
4059
- // line ever crosses a card. Returns null while the panel is hidden
4060
- // (zero-size rects) so a collapsed pane keeps no stale drawing.
4061
4030
  function buildConnectorPaths(base, lead, nodes, channelX) {
4062
4031
  // 弧线版(dsh-context 截图):每条线从来源卡底部中点出发,先走 14px
4063
4032
  // 竖直小段,再以三次贝塞尔 S 形弯到目标卡顶部中点;控制点分居两侧、
@@ -5078,10 +5047,7 @@ window.__ModuleLoader__.load({
5078
5047
  // Task list + live-owner set for the dependency-edge layer; measureLinks
5079
5048
  // reads them through refs because it is a stable callback (no deps) while
5080
5049
  // the task board changes every commit.
5081
- const edgeDataRef = React.useRef({ tasks: [], live: new Set() });
5082
5050
  const [linkPaths, setLinkPaths] = React.useState([]);
5083
- const [edges, setEdges] = React.useState([]);
5084
- const [edgeCards, setEdgeCards] = React.useState([]);
5085
5051
  const measureLinks = React.useCallback(() => {
5086
5052
  const tree = treeRef.current;
5087
5053
  const leadEl = leadRef.current;
@@ -5089,30 +5055,16 @@ window.__ModuleLoader__.load({
5089
5055
  const base = tree.getBoundingClientRect();
5090
5056
  const leadRect = leadEl.getBoundingClientRect();
5091
5057
  const nodes = Array.from(tree.querySelectorAll('[data-cabinet-node]')).map((el) => {
5092
- const rect = el.getBoundingClientRect();
5058
+ const card = typeof el.querySelector === 'function' ? el.querySelector('.cabinet-card') : null;
5059
+ const rect = (card || el).getBoundingClientRect();
5093
5060
  const color = typeof el.getAttribute === 'function' ? (el.getAttribute('data-cabinet-family') || '') : '';
5094
5061
  return { left: rect.left, top: rect.top, width: rect.width, height: rect.height, color };
5095
5062
  });
5096
- const paths = buildConnectorPaths(base, leadRect, nodes, -8);
5063
+ const paths = buildConnectorPaths(base, leadRect, nodes);
5097
5064
  if (paths === null) return; // hidden pane: keep the last drawing, redraw on wake
5098
5065
  setLinkPaths((prev) => (JSON.stringify(prev) === JSON.stringify(paths) ? prev : paths));
5099
- // Dependency edges: endpoints are the two task-row rects
5100
- // (data-cabinet-task anchors) in overlay coordinates; a row that is
5101
- // not rendered (or a task removed from the board) drops its edge.
5102
- const rectById = new Map();
5103
- for (const row of tree.querySelectorAll('[data-cabinet-task]')) {
5104
- const rect = row.getBoundingClientRect();
5105
- if (rect.width > 0 && rect.height > 0) rectById.set(row.getAttribute('data-cabinet-task'), rect);
5106
- }
5107
- const cards = Array.from(tree.querySelectorAll('.cabinet-card'), (card) => {
5108
- const rect = card.getBoundingClientRect();
5109
- return { left: rect.left - base.left, top: rect.top - base.top, width: rect.width, height: rect.height };
5110
- });
5111
- setEdgeCards((prev) => JSON.stringify(prev) === JSON.stringify(cards) ? prev : cards);
5112
- const edgeData = edgeDataRef.current;
5113
- const nextEdges = buildTaskEdges(base, edgeData.tasks, (id) => rectById.get(id) || null, (id) => edgeData.live.has(id));
5114
- if (nextEdges === null) return;
5115
- setEdges((prev) => (taskEdgesEqual(prev, nextEdges) ? prev : nextEdges));
5066
+ // 任务依赖边已整体下线(用户:名册里的乱线不要了)——不再测量
5067
+ // data-cabinet-task 行矩形、不 setEdges/setEdgeCards。
5116
5068
  }, []);
5117
5069
  // Re-measure after every commit: React owns card content, so a bare
5118
5070
  // layout effect catches member/task/model changes without a dep list.
@@ -5279,17 +5231,6 @@ window.__ModuleLoader__.load({
5279
5231
  const membersSignature = members.map((member) => String(member.id) + ':' + String(member.name) + ':' + String(member.phase)).join('|');
5280
5232
  // 气泡昵称:同一会话内不同成员必定显示不同名字(规则见 chatBubbleNames)。
5281
5233
  const bubbleNames = React.useMemo(() => chatBubbleNames(members), [membersSignature, memberRevision]);
5282
- const edgeLead = members.find((member) => member.role === 'lead');
5283
- const liveTaskIds = new Set();
5284
- for (const task of tasks) {
5285
- if (task.status !== 'in_progress' || !task.ownerName) continue;
5286
- const member = memberByName.get(task.ownerName);
5287
- const running = member ? runningOf(member.id)
5288
- : (edgeLead && (task.ownerName === 'lead' || task.ownerName === edgeLead.name)) ? runningOf(edgeLead.id)
5289
- : false;
5290
- if (running) liveTaskIds.add(task.id);
5291
- }
5292
- edgeDataRef.current = { tasks, live: liveTaskIds };
5293
5234
 
5294
5235
  const counts = { pending: 0, in_progress: 0, completed: 0 };
5295
5236
  for (const task of tasks) if (counts[task.status] !== undefined) counts[task.status] += 1;
@@ -5966,9 +5907,6 @@ window.__ModuleLoader__.load({
5966
5907
  d: typeof path === 'string' ? path : path.d,
5967
5908
  style: { fill: 'none', stroke: typeof path === 'string' || !path || !path.color ? LINE : path.color, strokeWidth: 2, strokeLinecap: 'round' }
5968
5909
  }))),
5969
- // dependency edges paint above the cards (endpoints sit on task rows
5970
- // inside cards) but never take pointer events
5971
- h(TaskEdgeLayer, { key: 'edges', edges, cards: edgeCards }),
5972
5910
  h('div', {
5973
5911
  key: 'leadwrap',
5974
5912
  ref: leadRef,
@@ -5991,8 +5929,9 @@ window.__ModuleLoader__.load({
5991
5929
  zIndex: 1,
5992
5930
  display: 'flex',
5993
5931
  flexDirection: 'column',
5994
- // 层间 96px 给弧线留走线空间(任务书 90-110);列距由行容器 12 承担。
5995
- rowGap: 96,
5932
+ // 层间 30px 与首辅 marginBottom 30 对齐(用户:跟首辅和第一行
5933
+ // 的距离一样);列距由行容器 12 承担。弧线 stub/bow 随净隙自适应。
5934
+ rowGap: 30,
5996
5935
  columnGap: 12,
5997
5936
  width: '100%'
5998
5937
  }
@@ -7378,6 +7317,8 @@ window.__ModuleLoader__.load({
7378
7317
  'task.unassigned': '未分派',
7379
7318
  'usage.tokens': 'token',
7380
7319
  'usage.elapsed': '耗时',
7320
+ 'usage.costEstimate': '按公开单价估算,非官方账单',
7321
+ 'usage.costNoRate': '暂无该模型公开单价,不估算',
7381
7322
  'usage.context': '上下文',
7382
7323
  'usage.team': '团队合计(含首辅)',
7383
7324
  'usage.none': '—',
@@ -7545,6 +7486,8 @@ window.__ModuleLoader__.load({
7545
7486
  'task.unassigned': 'unassigned',
7546
7487
  'usage.tokens': 'tokens',
7547
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',
7548
7491
  'usage.context': 'context',
7549
7492
  'usage.team': 'team total (incl. lead)',
7550
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.2",
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,13 +696,13 @@ 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 shows the merged idle line, 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));
779
700
  const idleFlat = JSON.stringify(dressed);
780
701
  // 顶层恰好一个渲染中的任务行节点(收集器的嵌套快照不计入),其文本即唯一空闲文案。
781
702
  const topDesc = dressed.filter((node) => node.props?.['data-cabinet-task-desc'] !== undefined);
782
703
  assert.equal(topDesc.length, 1, 'exactly one rendered task-desc node at the card top level, got ' + topDesc.length);
783
- assert.equal(topDesc[0].children.join(''), '无进行中任务', 'the single task row owns the only idle text');
784
- assert.ok(idleFlat.includes('无进行中任务'), 'task absence is independent from process status');
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');
785
706
  assert.ok(!dressed.some((node) => node.props?.['data-cabinet-activity-state'] !== undefined), 'no activity placeholder renders without data');
786
707
  const meterStyled = dressed.find((node) => node.props?.['data-cabinet-meter'] !== undefined);
787
708
  assert.equal(meterStyled.props.style.width, '42%', 'the segmented bar is left-aligned at ~42% card width');
@@ -860,9 +781,9 @@ const taskOnlyTree = elements(client.MemberCard({
860
781
  const taskOnlyDot = taskOnlyTree.find((node) => node.props?.['data-cabinet-status'] !== undefined);
861
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']);
862
783
  assert.equal(taskOnlyDot.props.style.animation, undefined, 'the process dot does not animate merely because a task remains in_progress');
863
- assert.equal(taskOnlyTree[0].props['data-cabinet-sweep'], undefined, 'stale task does not animate idle process');
864
- assert.equal(taskOnlyTree[0].props.style.overflow, undefined, 'stale task opens no sweep');
865
- assert.equal(taskOnlyTree[0].props.style['--cab-live-hue'], undefined, 'no task-only sweep hue');
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');
866
787
  // Only in_progress moves: a pending task on an idle process must not start the sweep.
867
788
  const idlePendingTree = elements(client.MemberCard({
868
789
  member: { id: 'm-pend', name: 'pend', phase: 'active' },
@@ -888,6 +809,21 @@ assert.ok(String(taskMark.props.style.animation).includes('cabinetPulse'), 'the
888
809
  // keyframes 必须真的在 STYLE_CSS 里——只有 animation 没有 @keyframes 会被浏览器静默忽略。
889
810
  const pulseCss = Array.isArray(client.STYLE_CSS) ? client.STYLE_CSS.join('\n') : String(client.STYLE_CSS || '');
890
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');
891
827
  assert.ok(pulseCss.includes('@keyframes cabinetSpin'), 'cabinetSpin remains for the avatar ring');
892
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');
893
829
  assert.ok(pulseCss.includes('cabinetDotRun 2s linear infinite') && pulseCss.includes('@keyframes cabinetDotRun{to{offset-distance:100%}}'), 'the dot runs via offset distance');
@@ -895,23 +831,11 @@ assert.ok(pulseCss.includes('prefers-reduced-motion'), 'the sweep stops under pr
895
831
  const sweepBody = (pulseCss.match(/\[data-cabinet-sweep\]::before\{[^{}]*\}/) || [''])[0];
896
832
  assert.ok(sweepBody && !sweepBody.includes('conic-gradient'), 'the sweep rule body carries no conic scanner (Motion Path dot only)');
897
833
 
898
- // A running agent can have no task; a stale task cannot hide an idle agent.
899
- for (const [running,task] of [[true,undefined],[false,{id:'stale',subject:'Old task',status:'in_progress'}]]) {
900
- const card=elements(client.MemberCard({member:{id:'state',name:'state',phase:'active'},running,activeTask:task,statusLabel:s=>client.zh['status.'+s],t:zhT}));
901
- const state=card.find(node=>node.props?.['data-cabinet-member-status']);
902
- assert.equal(state.children.join(''),running?client.zh['status.running']:client.zh['status.inactive'],'real process status always readable');
903
- const desc=card.find(node=>node.props?.['data-cabinet-task-desc']);
904
- if(running)assert.equal(desc.children.join(''),'无进行中任务');else assert.ok(JSON.stringify(desc.children).includes('Old task'),'stale task stays distinct from idle process');
905
- assert.equal(card[0].props['data-cabinet-sweep'],running?'1':undefined,'only true running enables sweep');
906
- }
907
- // Incomplete buckets/provider aliases and next-model selection cannot price history.
908
- assert.ok(!source.includes('MODEL_RATE_TABLE') && !source.includes('function costOf('), 'no unsafe rate matching or currency calculator');
909
- for (const model of ['auto/deepseek-v4.1-flash', 'other/notdeepseek-v4.1-flash', 'xiaomi/mimo-v2.6-flash']) {
910
- for (const buckets of [{outputTokens: 1}, {outputTokens: NaN, uncachedInputTokens: -1}, {uncachedInputTokens: 1000000, outputTokens: 0, cacheReadTokens: 0, cacheWriteTokens: 0}]) {
911
- const card = elements(client.MemberCard({member:{id:'cost',name:'cost',phase:'active'},running:false,t:zhT,model,usage:{tokens:1000,buckets}}));
912
- assert.ok(!card.some(node=>node.props?.key==='cost'), 'billing context unavailable: no currency node');
913
- assert.ok(card.some(node=>node.props?.key==='tok'), 'token display retained');
914
- }
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);
915
839
  }
916
840
  assert.ok(pulseCss.includes('will-change:offset-distance'), 'the dot hints only its animated offset distance');
917
841
  assert.ok(pulseCss.includes('pointer-events:none'), 'the sweep layer never blocks card clicks');
@@ -1114,27 +1038,6 @@ persistentRefs = null;
1114
1038
  // Stateful lifecycle, initial/settled loads and timer cleanup are exercised
1115
1039
  // with real React DOM by scripts/test-panel-browser.mjs, not this hook double.
1116
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');
1117
- console.log('PASS: task dependency edges — data attributes, three states, missing-blocker tolerance, reduced-motion CSS, geometry refresh gate');
1118
-
1119
- // IDs are opaque; delimiter-bearing pairs must not collide or inject markup.
1120
- const special = client.buildTaskEdges(edgeBase, [
1121
- {id:'a->b',blockedBy:['c','c']}, {id:'a',blockedBy:['b->c']},
1122
- {id:'c'}, {id:'b->c'}, null, {id:'deleted',status:'deleted',blockedBy:['c']},
1123
- {id:'self',blockedBy:['self']}
1124
- ], () => edgeRect(20,20));
1125
- assert.equal(special.length,2);
1126
- assert.equal(new Set(special.map(e=>e.key)).size,2);
1127
- assert.equal(client.buildTaskEdges(edgeBase,[{id:'\ud800',blockedBy:['c']},{id:'c'}],()=>edgeRect(20,20)).length,1);
1128
- const masked = elements(client.TaskEdgeLayer({edges:built,cards:[{left:300,top:200,width:140,height:26}]}));
1129
- assert.ok(masked.filter(e=>e.type==='path').every(e=>e.props.mask==='url(#test-mask)'));
1130
- assert.ok(masked.some(e=>e.type==='rect' && e.props.fill==='black' && e.props.x===300));
1131
- console.log('PASS: opaque IDs, malformed/deleted/self dependency filtering and card-content masks');
1132
-
1133
- const adjacent=client.buildTaskEdges(edgeBase,[{id:'top'},{id:'bottom',blockedBy:['top']}],id=>edgeRect(20,id==='top'?100:126));
1134
- assert.equal(adjacent.length,1);assert.notEqual(adjacent[0].s[1],adjacent[0].e[1]);
1135
- assert.ok(adjacent[0].c1[0]>adjacent[0].s[0]);
1136
- console.log('PASS: adjacent same-column rows retain a nonzero gutter curve');
1137
- 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)');
1138
1041
 
1139
1042
  // --- settings page: four tabs + the memory-plugin card ----------------------
1140
1043
  // The shared React double above keeps useState inert; this second instance gives
@@ -1640,7 +1543,7 @@ assert.equal(client.usageFor({tokenUsage:{outputTokens:-1},contextPressure:{cont
1640
1543
  tasks: [{ id: 't-done', subject: '做完了的旧活', status: 'completed', ownerName: 'idler' }],
1641
1544
  }, client.zh)));
1642
1545
  assert.ok(idleTree.includes('空闲'), 'a member with only completed tasks shows the merged idle line');
1643
- assert.ok(idleTree.includes('无进行中任务'), 'completed-only members show no active task independently');
1546
+ assert.ok(!idleTree.includes('无进行中任务'), 'the redundant task-absence line is gone for completed-only members');
1644
1547
  assert.ok(idleTree.includes('做完了的旧活'), 'completed tasks remain available in collapsed details');
1645
1548
  const english = client.TaskLine({
1646
1549
  task: { id: 'en-1', subject: 'sheet', status: 'pending' },
@@ -1681,7 +1584,7 @@ assert.equal(client.usageFor({tokenUsage:{outputTokens:-1},contextPressure:{cont
1681
1584
  assert.equal(rows2.length, 1, 'two ministers share one row, got ' + rows2.length);
1682
1585
  assert.equal(cardsIn(rows2[0]).length, 2, 'the single row holds both cards');
1683
1586
  const gridBox = elements(render(layerTeam(9), client.zh)).find((node) => node.props?.key === 'grid');
1684
- 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));
1685
1588
  // 弧线连线几何实测(buildConnectorPaths 真跑合成矩形):lead 扇形同点出发、
1686
1589
  // 每卡一条贝塞尔止于顶中点、每层居中卡扇形连下一层、线色随目标卡。
1687
1590
  const connBase = { left: 0, top: 0, width: 600, height: 900 };
@@ -3951,19 +3854,21 @@ assert.ok(!/background:\s*'(#fff|white)'/.test(source), 'no bare white backgroun
3951
3854
  }));
3952
3855
  }
3953
3856
 
3954
- // ---- 联想开关两态:配置项控制,提示词本体两态逐字相同(对齐上游 ed51fb3)----
3857
+ // ---- 联想开关两态:工厂提示词不变,成员上下文明确携带实时开关----
3955
3858
  // leadBlock 两态由 scripts/test-member-settings.mjs 的 associationLine/sectionText
3956
- // 断言覆盖;这里断言成员提示词层与 client 侧同款开关零改动。
3859
+ // 断言覆盖;这里核对成员上下文的实时状态与不变的工厂文案。
3957
3860
  {
3958
3861
  const offCfg = { associationMode: false, members: [] };
3959
3862
  const onCfg = { associationMode: true, members: [] };
3960
3863
  const tz = { role: 'teammate', name: 'tongzheng' };
3961
3864
  const offText = indexModule.memberBlock(offCfg, tz);
3962
3865
  const onText = indexModule.memberBlock(onCfg, tz);
3963
- 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');
3964
3869
  assert.ok(offText.includes(indexModule.DEFAULT_MEMBER_PROMPTS.tongzheng), 'the factory tongzheng prompt is embedded verbatim (section header aside)');
3965
3870
  assert.ok(offText.includes('去找与旧事、旁证、相邻经验的联系'), 'the duty clause stays verbatim, got: ' + offText.slice(0, 160));
3966
- assert.ok(!offText.includes('联想模式已关闭'), 'no closure sentence is ever injected');
3871
+ assert.ok(!offText.includes('联想模式当前开启'), 'off context must not claim association is enabled');
3967
3872
  assert.equal(indexModule.associationLine(offCfg), '', 'association-off renders nothing at all');
3968
3873
  assert.match(indexModule.associationLine(onCfg), /派活通政使/, 'association-on renders the dispatch-enable line');
3969
3874
  // client 侧 configuredPrompt 两态同文(开关不改提示词,只由配置项决定)。
@@ -156,11 +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
- // Process state is independent from stale task bookkeeping.
160
- if(await page.locator('#task-fixture [data-cabinet-sweep]').count())throw Error('stale task falsely animates idle agent');
161
- if(await page.locator('#task-fixture [data-cabinet-member-status]').innerText()!=='inactive')throw Error('idle state hidden by stale task');
162
- await page.evaluate(()=>window.motionMount(true,false));
163
- if(await page.locator('#task-fixture [data-cabinet-member-status]').innerText()!=='running'||await page.locator('#task-fixture [data-cabinet-task-desc]').innerText()!=='member.noTask')throw Error('running without task must not claim idle');
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');
164
161
  await page.evaluate(()=>window.motionMount(true));
165
162
  const runningCard=page.locator('#task-fixture [data-cabinet-sweep]');
166
163
  await runningCard.waitFor();
@@ -183,7 +180,7 @@ if(process.argv.includes('--headless')){
183
180
  await page.evaluate(()=>{
184
181
  const box=document.createElement('div');box.style.cssText='position:relative;width:400px;height:500px';document.body.append(box);
185
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()};
186
- try{for(const tall of [false,true]){box.replaceChildren();const lead=rect(130,0),cards=[0,120,240].map(x=>rect(x,150,tall&&x===120?240:80)).concat([60,180].map(x=>rect(x,330))),base=box.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();
187
184
  const paths=cabinet.buildConnectorPaths(base,lead,cards,-8);const svg=document.createElementNS('http://www.w3.org/2000/svg','svg');box.append(svg);
188
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')}}}
189
186
  }}finally{box.remove()}
@@ -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,7 +3,7 @@ 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}});
@@ -20,9 +20,9 @@ assert.equal(client.buildConnectorPaths(rect,lead,[]).length,0);
20
20
  // Exercise actual measureLinks callback: visible empty nodes must reach both
21
21
  // drawing setters, not return early and leave stale dependency arrows behind.
22
22
  const start=source.indexOf('const measureLinks = React.useCallback('),end=source.indexOf('// Re-measure after every commit',start);
23
- let links=['old'],edges=['old'];
24
- 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};
25
- 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)');
26
26
  const begin=source.indexOf("if (activeTab === 'timeline') {",source.indexOf('// 数据 = 群聊'));
27
27
  const finish=source.indexOf('const isLeadTask =',begin);
28
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)}
@@ -34,24 +34,15 @@ for (const [phase,running,expected] of [['active',true,'running'],['active',fals
34
34
  const nodes=all(client.MemberCard({member:{id:'m',name:'works',phase},running,statusLabel:s=>'status:'+s}));
35
35
  const label=nodes.find(n=>n.props['data-cabinet-member-status']===expected);
36
36
  assert.ok(label);
37
- assert.equal(label.children[0],'status:'+expected);
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);
38
39
  // identity locale (t:x=>x) 下 tt('status.inactive') 原样透出;真中文由 test-client 的 zhT 卡锁。
39
- assert.equal(nodes.find(n=>n.props['data-cabinet-task-desc']).children[0],'member.noTask');
40
+ assert.equal(nodes.find(n=>n.props['data-cabinet-task-desc']).children[0],expected==='inactive'?'status.inactive':'member.noTask');
40
41
  }
41
42
  const stale=all(client.MemberCard({member:{id:'m',name:'works',phase:'active'},running:false,activeTask:task,statusLabel:s=>s}));
42
43
  assert.ok(stale.some(n=>n.props['data-cabinet-member-status']==='inactive'));
43
- assert.equal(stale[0].props['data-cabinet-sweep'],undefined);
44
- // Hidden details duplicate an active task's anchor. They must not overwrite its
45
- // visible compact-card anchor; expanded task rows may legitimately supersede it.
46
- let lookedUp;
47
- ctx.treeRef.current.querySelectorAll=selector=>selector==='[data-cabinet-task]'?[
48
- {getAttribute:()=>task.id,getBoundingClientRect:()=>({left:1,top:50,width:80,height:20})},
49
- {getAttribute:()=>task.id,getBoundingClientRect:()=>({left:0,top:0,width:0,height:0})}
50
- ]:[];
51
- ctx.buildTaskEdges=(base,tasks,lookup)=>{lookedUp=lookup(task.id);return []};
52
- vm.runInNewContext(source.slice(start,end)+'measureLinks();',{...ctx});
53
- assert.equal(lookedUp.width,80);
54
- 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');
55
46
 
56
47
  const mark=all(card).find(n=>n.props.className==='cabinet-task-mark');
57
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
  });