dsh-cabinet-mode 0.9.1 → 0.9.2
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 +13 -0
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/client.js +76 -15
- package/package.json +1 -1
- package/scripts/test-client.mjs +98 -10
- package/scripts/test-groupchat-v2-regression.mjs +2 -1
- package/scripts/test-panel-browser.mjs +16 -4
- package/scripts/test-rail-redesign-regression.mjs +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.9.2] - 2026-11-13
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- 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.
|
|
10
|
+
- Omit the redundant unknown activity-count placeholder without inventing activity counts.
|
|
11
|
+
- Preserve independent process/task status: no-task is not idle, and stale in-progress bookkeeping does not enable the running animation.
|
|
12
|
+
- Continue to omit currency estimates because historical provider/model billing context is unavailable.
|
|
13
|
+
|
|
14
|
+
### Tests
|
|
15
|
+
|
|
16
|
+
- Add multi-row connector and independent process/task-state regressions, including the three-plus-two-card layout.
|
|
17
|
+
|
|
5
18
|
## [0.9.1] - 2026-11-13
|
|
6
19
|
|
|
7
20
|
### 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.
|
|
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
|
|
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.
|
|
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
|
|
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.
|
|
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
|
|
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.
|
|
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
|
|
246
246
|
```
|
|
247
247
|
|
|
248
248
|
`dsh plugin --profile desktop list` 应显示新版本。升级已在 Windows 实测:
|
package/client.js
CHANGED
|
@@ -3512,6 +3512,7 @@ window.__ModuleLoader__.load({
|
|
|
3512
3512
|
return Math.floor(hours / 24) + 'd' + String(hours % 24).padStart(2, '0') + 'h';
|
|
3513
3513
|
}
|
|
3514
3514
|
|
|
3515
|
+
// Token totals lack provider/billing-period/model-history evidence: no currency estimate.
|
|
3515
3516
|
/** Sum the four disjoint provider-usage buckets; undefined when none exists. */
|
|
3516
3517
|
function tokenTotalOf(usage) {
|
|
3517
3518
|
if (usage === undefined || usage === null || typeof usage !== 'object') return undefined;
|
|
@@ -3784,7 +3785,8 @@ window.__ModuleLoader__.load({
|
|
|
3784
3785
|
}, tt('current')) : null
|
|
3785
3786
|
]),
|
|
3786
3787
|
// 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 } },
|
|
3788
|
+
h('span', { key: 'state', 'data-cabinet-member-status': status, style: { fontSize: 11, color: INK2 } },
|
|
3789
|
+
typeof statusLabel === 'function' ? statusLabel(status) : status),
|
|
3788
3790
|
h('div', {
|
|
3789
3791
|
key: 'taskdesc',
|
|
3790
3792
|
'data-cabinet-task-desc': '1',
|
|
@@ -3802,7 +3804,8 @@ window.__ModuleLoader__.load({
|
|
|
3802
3804
|
animation: taskLive ? 'cabinetPulse 1.7s ease-out infinite' : undefined
|
|
3803
3805
|
}
|
|
3804
3806
|
}, '\u25cf'), activeTask.subject]
|
|
3805
|
-
|
|
3807
|
+
// Absence of a task says nothing about the process state.
|
|
3808
|
+
: tt('member.noTask')),
|
|
3806
3809
|
// 故障必须可见:member.error 整行红字(模型行已按截图移除)。
|
|
3807
3810
|
member.error ? h('div', {
|
|
3808
3811
|
key: 'err',
|
|
@@ -3860,7 +3863,6 @@ window.__ModuleLoader__.load({
|
|
|
3860
3863
|
: (formatTokenCount(usage.context && usage.context.projectedTokens) ?? tt('usage.none')))
|
|
3861
3864
|
]) : null
|
|
3862
3865
|
]) : null,
|
|
3863
|
-
activity && activity.known === false ? h('span', { key: 'activity-unknown', 'data-cabinet-activity-state': 'unknown', title: '名册未订阅消息历史,活动记录数未知', style: { fontSize: 11, color: INK3 } }, '活动 —') : null,
|
|
3864
3866
|
h(MemberDispatch, { key: 'dispatch:' + member.id, memberId: member.id, running, service: dispatchService, t: tt, disabled: member.phase === 'failed' || member.phase === 'provisioning' }),
|
|
3865
3867
|
// Collapsed task details remain independent from dispatch.
|
|
3866
3868
|
children
|
|
@@ -4094,18 +4096,75 @@ window.__ModuleLoader__.load({
|
|
|
4094
4096
|
}
|
|
4095
4097
|
};
|
|
4096
4098
|
fan({ x: leadLocal.left + leadLocal.width / 2, y: leadLocal.top + leadLocal.height }, layers[0].cards);
|
|
4097
|
-
// Later visual rows remain siblings
|
|
4098
|
-
//
|
|
4099
|
+
// Later visual rows remain siblings (never a member-to-member parent).
|
|
4100
|
+
// Prefer a compact shared bus where the row gap is clear. Staggered rows
|
|
4101
|
+
// may require an outside channel; uneven heights require per-target routing.
|
|
4099
4102
|
const ax = leadLocal.left + leadLocal.width / 2;
|
|
4100
4103
|
const ay = leadLocal.top + leadLocal.height;
|
|
4101
|
-
const
|
|
4102
|
-
|
|
4103
|
-
const
|
|
4104
|
-
const
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4104
|
+
const tail = layers.slice(1);
|
|
4105
|
+
if (tail.length > 0) {
|
|
4106
|
+
const busY = (layer) => layer.top - 16;
|
|
4107
|
+
const bottomY = busY(tail[tail.length - 1]);
|
|
4108
|
+
// Check every row, including the first fan row. A staggered layout may
|
|
4109
|
+
// have no common column gap: use a safe outside channel, never ax.
|
|
4110
|
+
const allCards = valid;
|
|
4111
|
+
const clear = x => allCards.every(card => x < card.left - 1 || x > card.left + card.width + 1);
|
|
4112
|
+
const minLeft = Math.min(...allCards.map(card => card.left));
|
|
4113
|
+
const maxRight = Math.max(...allCards.map(card => card.left + card.width));
|
|
4114
|
+
const gaps = allCards.flatMap(card => [card.left - 8, card.left + card.width + 8])
|
|
4115
|
+
.filter(x => x > minLeft && x < maxRight && clear(x)).sort((a, b) => Math.abs(a - ax) - Math.abs(b - ax) || a - b);
|
|
4116
|
+
// Prefer an outer margin inside the SVG viewport. Its overflow is visible
|
|
4117
|
+
// for tight layouts; ancestor clipping may hide a safe edge, never reroute through a card.
|
|
4118
|
+
const outsideX = minLeft >= 16 ? minLeft - 16 : maxRight + 16 <= base.width ? maxRight + 16 : minLeft - 16;
|
|
4119
|
+
const trunkX = gaps.length ? gaps[0] : outsideX;
|
|
4120
|
+
// Neutral trunk: drop8px under the Lead, step sideways into the gap in
|
|
4121
|
+
// that blank band, then straight down to the lowest bus line.
|
|
4122
|
+
paths.push({ d: 'M ' + ax + ' ' + ay + ' L ' + ax + ' ' + (ay + 8) + ' L ' + trunkX + ' ' + (ay + 8) + ' L ' + trunkX + ' ' + bottomY, color: LINE });
|
|
4123
|
+
const intersects = (a,b) => valid.some(r => a.x === b.x
|
|
4124
|
+
? 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
|
|
4125
|
+
: 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);
|
|
4126
|
+
const routeAroundCards = target => {
|
|
4127
|
+
const start={x:ax,y:ay+8}, goal={x:target.left+target.width/2,y:target.top-8};
|
|
4128
|
+
const xs=[...new Set([start.x,goal.x,...valid.flatMap(r=>[r.left-8,r.left+r.width+8])])].sort((a,b)=>a-b);
|
|
4129
|
+
const ys=[...new Set([start.y,goal.y,...valid.flatMap(r=>[r.top-8,r.top+r.height+8])])].sort((a,b)=>a-b);
|
|
4130
|
+
const key=(x,y)=>x+':'+y, first=key(start.x,start.y), last=key(goal.x,goal.y);
|
|
4131
|
+
const parents=new Map([[first,null]]), points=new Map([[first,start]]), queue=[start];
|
|
4132
|
+
for(let i=0;i<queue.length&&!parents.has(last);i++){
|
|
4133
|
+
const from=queue[i], xi=xs.indexOf(from.x), yi=ys.indexOf(from.y);
|
|
4134
|
+
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]]]){
|
|
4135
|
+
if(x===undefined||y===undefined)continue;const id=key(x,y),to={x,y};
|
|
4136
|
+
if(parents.has(id)||intersects(from,to))continue;
|
|
4137
|
+
parents.set(id,key(from.x,from.y));points.set(id,to);queue.push(to);
|
|
4138
|
+
}
|
|
4139
|
+
}
|
|
4140
|
+
if(!parents.has(last)||intersects({x:ax,y:ay},start)||intersects(goal,{x:goal.x,y:target.top}))return;
|
|
4141
|
+
const route=[];for(let id=last;id!==null;id=parents.get(id))route.unshift(points.get(id));
|
|
4142
|
+
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:''});
|
|
4143
|
+
};
|
|
4144
|
+
for (const layer of tail) {
|
|
4145
|
+
const y = busY(layer);
|
|
4146
|
+
const centres = layer.cards.map((card) => card.left + card.width / 2);
|
|
4147
|
+
const minX = Math.min(...centres);
|
|
4148
|
+
const maxX = Math.max(...centres);
|
|
4149
|
+
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}))){
|
|
4150
|
+
for(const target of layer.cards)routeAroundCards(target);
|
|
4151
|
+
continue;
|
|
4152
|
+
}
|
|
4153
|
+
// One horizontal segment per layer, from the trunk to both ends.
|
|
4154
|
+
paths.push({
|
|
4155
|
+
d: 'M ' + trunkX + ' ' + y + ' L ' + minX + ' ' + y + (maxX !== minX ? ' L ' + maxX + ' ' + y : ''),
|
|
4156
|
+
color: LINE
|
|
4157
|
+
});
|
|
4158
|
+
// One branch per card, family colour, from the bus down to the top centre.
|
|
4159
|
+
for (const target of layer.cards) {
|
|
4160
|
+
const cx = target.left + target.width / 2;
|
|
4161
|
+
const top = target.top;
|
|
4162
|
+
paths.push({
|
|
4163
|
+
d: 'M ' + cx + ' ' + y + ' C ' + cx + ' ' + (y + 6) + ', ' + cx + ' ' + (top - 6) + ', ' + cx + ' ' + top,
|
|
4164
|
+
color: typeof target.color === 'string' ? target.color : ''
|
|
4165
|
+
});
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4109
4168
|
}
|
|
4110
4169
|
return paths;
|
|
4111
4170
|
}
|
|
@@ -5846,8 +5905,8 @@ window.__ModuleLoader__.load({
|
|
|
5846
5905
|
// ---- 品字形 org chart: lead on top, ministers in an auto-fit grid below,
|
|
5847
5906
|
// wired by a measured SVG overlay — no CSS guessing, no left file-tree
|
|
5848
5907
|
// rail. Rows wrap freely (品 = 1 up / 2 down, more nodes spill to further
|
|
5849
|
-
// rows); connectors
|
|
5850
|
-
//
|
|
5908
|
+
// rows); connectors fan out from a vertical trunk with one horizontal
|
|
5909
|
+
// bus segment per row — no line reaches past the outermost cards.
|
|
5851
5910
|
// 家族色:黄金角散列(与时间线同式);主控卡固定金色系(环/边框)。
|
|
5852
5911
|
const familyColorOf = (index) => 'hsl(' + (Math.round(index * 137.508) % 360) + ' 58% 52%)';
|
|
5853
5912
|
// 底行活动数据:该成员在群聊折叠行里的条数与最后一条时间(真实行,
|
|
@@ -7309,6 +7368,7 @@ window.__ModuleLoader__.load({
|
|
|
7309
7368
|
'dispatch.unavailable': "发送通道不可用",
|
|
7310
7369
|
'status.running': '干活中',
|
|
7311
7370
|
'status.inactive': '空闲',
|
|
7371
|
+
'member.noTask': '无进行中任务',
|
|
7312
7372
|
'status.provisioning': '启动中',
|
|
7313
7373
|
'status.failed': '失败',
|
|
7314
7374
|
'task.pending': '待办',
|
|
@@ -7475,6 +7535,7 @@ window.__ModuleLoader__.load({
|
|
|
7475
7535
|
'dispatch.unavailable': "Send channel unavailable",
|
|
7476
7536
|
'status.running': 'working',
|
|
7477
7537
|
'status.inactive': 'idle',
|
|
7538
|
+
'member.noTask': 'No active task',
|
|
7478
7539
|
'status.provisioning': 'starting',
|
|
7479
7540
|
'status.failed': 'failed',
|
|
7480
7541
|
'task.pending': 'pending',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cabinet-mode",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
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",
|
package/scripts/test-client.mjs
CHANGED
|
@@ -775,7 +775,14 @@ assert.ok(typeof blockNode.props.style.border === 'string' && blockNode.props.st
|
|
|
775
775
|
const dotNode = dressed.find((node) => node.props?.['data-cabinet-status'] !== undefined);
|
|
776
776
|
assert.ok(dotNode, 'the head row carries the status dot');
|
|
777
777
|
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
|
|
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));
|
|
779
|
+
const idleFlat = JSON.stringify(dressed);
|
|
780
|
+
// 顶层恰好一个渲染中的任务行节点(收集器的嵌套快照不计入),其文本即唯一空闲文案。
|
|
781
|
+
const topDesc = dressed.filter((node) => node.props?.['data-cabinet-task-desc'] !== undefined);
|
|
782
|
+
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');
|
|
785
|
+
assert.ok(!dressed.some((node) => node.props?.['data-cabinet-activity-state'] !== undefined), 'no activity placeholder renders without data');
|
|
779
786
|
const meterStyled = dressed.find((node) => node.props?.['data-cabinet-meter'] !== undefined);
|
|
780
787
|
assert.equal(meterStyled.props.style.width, '42%', 'the segmented bar is left-aligned at ~42% card width');
|
|
781
788
|
const footNode = dressed.find((node) => node.props?.key === 'foot');
|
|
@@ -853,9 +860,19 @@ const taskOnlyTree = elements(client.MemberCard({
|
|
|
853
860
|
const taskOnlyDot = taskOnlyTree.find((node) => node.props?.['data-cabinet-status'] !== undefined);
|
|
854
861
|
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
862
|
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, '
|
|
857
|
-
assert.equal(taskOnlyTree[0].props.style.overflow, undefined, '
|
|
858
|
-
assert.equal(taskOnlyTree[0].props.style['--cab-live-hue'], undefined, '
|
|
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');
|
|
866
|
+
// Only in_progress moves: a pending task on an idle process must not start the sweep.
|
|
867
|
+
const idlePendingTree = elements(client.MemberCard({
|
|
868
|
+
member: { id: 'm-pend', name: 'pend', phase: 'active' },
|
|
869
|
+
running: false,
|
|
870
|
+
statusLabel: (status) => status,
|
|
871
|
+
t: zhT,
|
|
872
|
+
familyColor: 'hsl(138 58% 52%)',
|
|
873
|
+
activeTask: { id: 'pp', subject: '待办', status: 'pending' },
|
|
874
|
+
}));
|
|
875
|
+
assert.equal(idlePendingTree[0].props['data-cabinet-sweep'], undefined, 'a pending task does not start the sweep (only in_progress moves)');
|
|
859
876
|
const taskOnlyDesc = taskOnlyTree.find((node) => node.props?.['data-cabinet-task-desc'] !== undefined);
|
|
860
877
|
const findMark = (node) => {
|
|
861
878
|
if (Array.isArray(node)) { for (const child of node) { const hit = findMark(child); if (hit) return hit; } return null; }
|
|
@@ -875,6 +892,27 @@ assert.ok(pulseCss.includes('@keyframes cabinetSpin'), 'cabinetSpin remains for
|
|
|
875
892
|
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
893
|
assert.ok(pulseCss.includes('cabinetDotRun 2s linear infinite') && pulseCss.includes('@keyframes cabinetDotRun{to{offset-distance:100%}}'), 'the dot runs via offset distance');
|
|
877
894
|
assert.ok(pulseCss.includes('prefers-reduced-motion'), 'the sweep stops under prefers-reduced-motion');
|
|
895
|
+
const sweepBody = (pulseCss.match(/\[data-cabinet-sweep\]::before\{[^{}]*\}/) || [''])[0];
|
|
896
|
+
assert.ok(sweepBody && !sweepBody.includes('conic-gradient'), 'the sweep rule body carries no conic scanner (Motion Path dot only)');
|
|
897
|
+
|
|
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
|
+
}
|
|
915
|
+
}
|
|
878
916
|
assert.ok(pulseCss.includes('will-change:offset-distance'), 'the dot hints only its animated offset distance');
|
|
879
917
|
assert.ok(pulseCss.includes('pointer-events:none'), 'the sweep layer never blocks card clicks');
|
|
880
918
|
// 成本:宿主无 ¥ 数据源(tokenUsage 投影只有 4 个分项 token,无金额字段)——卡上不出现货币符号、不编数。
|
|
@@ -1601,7 +1639,8 @@ assert.equal(client.usageFor({tokenUsage:{outputTokens:-1},contextPressure:{cont
|
|
|
1601
1639
|
members: [{ id: 'm-idle', name: 'idler', role: 'mate', phase: 'active' }],
|
|
1602
1640
|
tasks: [{ id: 't-done', subject: '做完了的旧活', status: 'completed', ownerName: 'idler' }],
|
|
1603
1641
|
}, client.zh)));
|
|
1604
|
-
assert.ok(idleTree.includes('
|
|
1642
|
+
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');
|
|
1605
1644
|
assert.ok(idleTree.includes('做完了的旧活'), 'completed tasks remain available in collapsed details');
|
|
1606
1645
|
const english = client.TaskLine({
|
|
1607
1646
|
task: { id: 'en-1', subject: 'sheet', status: 'pending' },
|
|
@@ -1666,8 +1705,34 @@ assert.equal(client.usageFor({tokenUsage:{outputTokens:-1},contextPressure:{cont
|
|
|
1666
1705
|
assert.equal(arrived, 9, 'every layered card receives an arc ending at its top centre, got ' + arrived);
|
|
1667
1706
|
const hubFan = connD.filter((d) => d.indexOf('M 300 320 L 300 334 C ') === 0);
|
|
1668
1707
|
assert.equal(hubFan.length, 0, 'no member is made the parent of the next visual row, got ' + hubFan.length);
|
|
1669
|
-
|
|
1670
|
-
assert.
|
|
1708
|
+
// 总线扇出:3 fan + 1 主干 + 每后续层 1 水平段(2层) + 每卡 1 支线(6卡) = 12。
|
|
1709
|
+
assert.equal(connPaths.length, 12, 'lead fan(3) + trunk(1) + bus segments(2) + branches(6), got ' + connPaths.length);
|
|
1710
|
+
// 主干:M ax ay → L ax ay+8 → L trunkX ay+8 → L trunkX bottomY(列间隙,非中心线)。
|
|
1711
|
+
const trunkOnly = connD.filter((d) => /^M 300 60 L 300 68 L (\d+) 68 L \d+ \d+$/.test(d));
|
|
1712
|
+
assert.equal(trunkOnly.length, 1, 'exactly one neutral trunk with the 8px sideways step, got ' + trunkOnly.length);
|
|
1713
|
+
const connTrunkX = Number((trunkOnly[0] || '').match(/^M 300 60 L 300 68 L (\d+) /)[1]);
|
|
1714
|
+
assert.notEqual(connTrunkX, 300, 'the trunk leaves the lead centre-line for a column gap, got ' + connTrunkX);
|
|
1715
|
+
const coordReConn = /[-+]?\d*\.?\d+/g;
|
|
1716
|
+
const busSegs = connD.filter((d) => {
|
|
1717
|
+
const m = d.match(/^M (\d+) (\d+) L (\d+) (\d+)(?: L (\d+) (\d+))?$/);
|
|
1718
|
+
return !!m && m[2] === m[4] && (m[6] === undefined || m[6] === m[2]);
|
|
1719
|
+
});
|
|
1720
|
+
assert.equal(busSegs.length, 2, 'exactly one horizontal segment per later layer, got ' + busSegs.length);
|
|
1721
|
+
const branches = connD.filter((d) => d.includes(' C ') && d.indexOf('M 300 60 ') !== 0);
|
|
1722
|
+
assert.equal(branches.length, 6, 'one family-coloured branch per later-layer card, got ' + branches.length);
|
|
1723
|
+
// 旧 gutter 横穿的负断言:任何 x 都不得伸到最左卡左缘之外。
|
|
1724
|
+
// trunkX 不穿卡:不得落在任何卡的 [left-1, right+1] 内。
|
|
1725
|
+
for (const node of connNodes) {
|
|
1726
|
+
assert.ok(connTrunkX < node.left - 1 || connTrunkX > node.left + node.width + 1,
|
|
1727
|
+
'trunk x=' + connTrunkX + ' must clear card [' + node.left + ',' + (node.left + node.width) + ']');
|
|
1728
|
+
}
|
|
1729
|
+
const minConnLeft = Math.min(...connNodes.map((node) => node.left));
|
|
1730
|
+
for (const d of connD) {
|
|
1731
|
+
const nums = d.match(coordReConn).map(Number);
|
|
1732
|
+
for (let i = 0; i < nums.length; i += 2) {
|
|
1733
|
+
assert.ok(nums[i] >= minConnLeft - 0.5, 'no segment reaches left of the outermost card (' + minConnLeft + '), got ' + nums[i] + ' in ' + d);
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1671
1736
|
const colored = connPaths.filter((path) => typeof path === 'object' && typeof path.color === 'string' && path.color.indexOf('hsl(') === 0);
|
|
1672
1737
|
assert.ok(colored.length >= 9, 'arcs carry the target cards family colors, got ' + colored.length);
|
|
1673
1738
|
|
|
@@ -1681,12 +1746,20 @@ assert.equal(client.usageFor({tokenUsage:{outputTokens:-1},contextPressure:{cont
|
|
|
1681
1746
|
}
|
|
1682
1747
|
}
|
|
1683
1748
|
const offPaths = client.buildConnectorPaths(offBase, offLead, offNodes, -8);
|
|
1684
|
-
|
|
1749
|
+
const offTrunk = offPaths.find((path) => /^M 300 100 L 300 108 L (\d+) 108 L \d+ \d+$/.test(path.d));
|
|
1750
|
+
assert.ok(offTrunk, 'the non-zero-base trunk keeps the 8px step form, got: ' + JSON.stringify(offPaths.map((path) => path.d)));
|
|
1751
|
+
const offTrunkX = Number(offTrunk.d.match(/^M 300 100 L 300 108 L (\d+) /)[1]);
|
|
1752
|
+
assert.notEqual(offTrunkX, 300, 'the trunk leaves the lead centre-line, got ' + offTrunkX);
|
|
1753
|
+
for (const node of offNodes) {
|
|
1754
|
+
assert.ok(offTrunkX < node.left - 1 || offTrunkX > node.left + node.width + 1,
|
|
1755
|
+
'trunk x=' + offTrunkX + ' must clear card [' + node.left + ',' + (node.left + node.width) + ']');
|
|
1756
|
+
}
|
|
1757
|
+
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
1758
|
const coordRe = /[-+]?\d*\.?\d+/g;
|
|
1686
1759
|
for (const path of offPaths) {
|
|
1687
1760
|
const nums = path.d.match(coordRe).map(Number);
|
|
1688
|
-
for (
|
|
1689
|
-
assert.ok(
|
|
1761
|
+
for (let i = 0; i < nums.length; i += 2) {
|
|
1762
|
+
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
1763
|
}
|
|
1691
1764
|
for (let i = 1; i < nums.length; i += 2) {
|
|
1692
1765
|
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 +1774,21 @@ assert.equal(client.usageFor({tokenUsage:{outputTokens:-1},contextPressure:{cont
|
|
|
1701
1774
|
offNodes.map((node) => ({ ...node, left: node.left + dx, top: node.top + dy })),
|
|
1702
1775
|
-8);
|
|
1703
1776
|
assert.deepEqual(movedPaths.map((path) => path.d), offPaths.map((path) => path.d), 'translating base+rects leaves every arc byte-identical');
|
|
1777
|
+
// Staggered 3+2: tail-only gap x=172 intersects the FIRST-row middle card.
|
|
1778
|
+
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})));
|
|
1779
|
+
const staggerPaths=client.buildConnectorPaths({left:0,top:0,width:400,height:500},{left:130,top:0,width:100,height:80},stagger,-8);
|
|
1780
|
+
const trunk=staggerPaths.find(p=>/^M 180 80 L 180 88 L /.test(p.d));
|
|
1781
|
+
assert.ok(trunk,'staggered layout has actual Lead trunk');
|
|
1782
|
+
const tx=Number(trunk.d.split(' ')[7]);
|
|
1783
|
+
for(const card of stagger)assert.ok(tx<card.left-1||tx>card.left+card.width+1,'trunk clears every card including first row');
|
|
1784
|
+
assert.ok(tx<0||tx>340,'no common gap uses outside channel, never overlapping centre');
|
|
1785
|
+
assert.ok(!staggerPaths.some(p=>/^M (50|170|290) 230 /.test(p.d)),'no false member-parent edges');
|
|
1786
|
+
const uneven=stagger.map((card,i)=>i===1?{...card,height:240}:card);
|
|
1787
|
+
const unevenPaths=client.buildConnectorPaths({left:0,top:0,width:400,height:500},{left:130,top:0,width:100,height:80},uneven,-8);
|
|
1788
|
+
const routed=unevenPaths.filter(p=>p.d.startsWith('M 180 80 L ')&&!p.d.includes(' C ')&&(/ L (110|230) 330$/).test(p.d));
|
|
1789
|
+
assert.equal(routed.length,2,'height collision uses two actual Lead-rooted safe routes');
|
|
1790
|
+
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');}}}
|
|
1791
|
+
|
|
1704
1792
|
// 收尾:清 CabinetPanel 入队的 effect,防泄漏给后续块(3b47d6a2 教训)。
|
|
1705
1793
|
recordedEffects.length = 0;
|
|
1706
1794
|
}
|
|
@@ -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
|
-
|
|
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,11 @@ 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
|
-
//
|
|
160
|
-
if(await page.locator('#task-fixture [data-cabinet-sweep]').count())throw Error('
|
|
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');
|
|
161
164
|
await page.evaluate(()=>window.motionMount(true));
|
|
162
165
|
const runningCard=page.locator('#task-fixture [data-cabinet-sweep]');
|
|
163
166
|
await runningCard.waitFor();
|
|
@@ -176,6 +179,15 @@ if(process.argv.includes('--headless')){
|
|
|
176
179
|
if((await motion()).display!=='none')throw Error('unsupported fallback declaration not applied');
|
|
177
180
|
await page.evaluate(()=>document.getElementById('fallback-probe').remove());
|
|
178
181
|
if(supported&&(await motion()).display==='none')throw Error('fallback probe leaked');
|
|
182
|
+
// Real browser rectangles + SVG path sampling for staggered 3+2 geometry.
|
|
183
|
+
await page.evaluate(()=>{
|
|
184
|
+
const box=document.createElement('div');box.style.cssText='position:relative;width:400px;height:500px';document.body.append(box);
|
|
185
|
+
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();
|
|
187
|
+
const paths=cabinet.buildConnectorPaths(base,lead,cards,-8);const svg=document.createElementNS('http://www.w3.org/2000/svg','svg');box.append(svg);
|
|
188
|
+
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
|
+
}}finally{box.remove()}
|
|
190
|
+
});
|
|
179
191
|
if(process.env.CABINET_SCREENSHOT)await page.screenshot({path:process.env.CABINET_SCREENSHOT,fullPage:true});
|
|
180
192
|
const cleanup=await page.evaluate(()=>window.panelUnmount());
|
|
181
193
|
if(errors.length||cleanup.errors.length)throw Error([...errors,...cleanup.errors].join('\n'));
|
|
@@ -8,7 +8,8 @@ const all=node=>Array.isArray(node)?node.flatMap(all):!node||typeof node!=='obje
|
|
|
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']
|
|
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'));
|
|
@@ -32,8 +33,10 @@ 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);
|
|
36
|
-
assert.equal(
|
|
36
|
+
assert.ok(label);
|
|
37
|
+
assert.equal(label.children[0],'status:'+expected);
|
|
38
|
+
// 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');
|
|
37
40
|
}
|
|
38
41
|
const stale=all(client.MemberCard({member:{id:'m',name:'works',phase:'active'},running:false,activeTask:task,statusLabel:s=>s}));
|
|
39
42
|
assert.ok(stale.some(n=>n.props['data-cabinet-member-status']==='inactive'));
|