dsh-atc 0.16.0 → 0.18.0

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/README.md CHANGED
@@ -8,6 +8,16 @@ DeepSeek Harness 的 Agent 空管中心:在**左侧栏**加一行(和「插
8
8
 
9
9
  零 token —— 宿主侧只读本地会话存储、纯本地推断状态,不经过任何模型。
10
10
 
11
+ ```powershell
12
+ dsh plugin add dsh-atc
13
+ ```
14
+
15
+ 装完重启 DSH(宿主侧插件只在启动时组合),左侧栏出现「空管」。
16
+
17
+ ![界面](docs/preview-board.png)
18
+
19
+ *截图是用**合成数据**渲染的真实组件——布局、图标、分档都是真的,会话标题/工作区/计数全是编的,不来自任何一台机器。*
20
+
11
21
  ## 它解决什么
12
22
 
13
23
  同时用 DSH / codex / opencode / WorkBuddy / Trae / MiniMax 时,注意力会被切成 N 份。这个插件把「谁在跑、谁停了、谁在等我」压到一屏。
@@ -44,51 +54,54 @@ DeepSeek Harness 的 Agent 空管中心:在**左侧栏**加一行(和「插
44
54
 
45
55
  本机能有 500+ 条历史会话,**平铺等于没有信息**。所以整页从「一眼看全貌」开始,再落到「谁在等我」:
46
56
 
47
- ```
48
- ┌ Agent 空管中心 [本地推断·零 token] 更新于 11:02 [今天|近7天|近30天|全部] [⟳ 刷新]
49
- ├ 6 个 KPI:在跑 3 · 等你 0 · 失败 0 · 完成 38 · 本机会话 524 · 接入的 agent 4/4
50
- ├ 活跃度(热力图) │ Agent 分布(字形 + 排行条)
51
- ├ 状态分布(分段条:在跑 / 完成 / 刚停 / 无动静)
52
- ├ 会话 124 [搜索标题、工作区…] [最近更新 | 按工具 | 按工作区]
53
- │ agent 全部 124 · ● dsh 40 · > opencode 40 · ■ workbuddy 40 │ 状态 在跑 3 · 失败 1 · 完成 38 …
54
- ├ ✓ 没有需要你处理的 ← 有事时才出现,且永远在最前
55
- ├ ▾ 正在跑 3 > opencode 1 · ■ workbuddy 2 ← 卡片网格
56
- ├ ▾ 最近动过 7 ■ workbuddy 3 · ● dsh 3 · > opencode 1
57
- └ ▸ 更早 114 点开查看 ← 默认折叠,展开最多 60 张卡片
57
+ ```text
58
+ Agent 空管中心 [本地推断·零 token] 更新于 11:02 [今天|近7天|近30天|全部] [⏸ 暂停][⟳ 刷新]
59
+ ────────────────────────────────────────────────────────────────────────
60
+ 1 要你处理 │ 2 在跑 │ 1 失败 ← 只有三个行动数字
61
+ 完成 39 · 本机 546 · 接入 7/9 ← 库存收成一行小字
62
+ ────────────────────────────────────────────────────────────────────────
63
+ 活跃度(热力图) │ Agent 分布 26 / 142 [近24h|近7天|全部]
64
+ │ workbuddy 15 · dsh 8 · opencode 2 · minimax 1
65
+ 状态分布(分段条) │ 在跑 2 · 失败 1 · 完成 39 · 中止 2 · 刚动过 1 · 长期无动静 98
66
+ ────────────────────────────────────────────────────────────────────────
67
+ 会话 142 [搜索标题、工作区…] [最近更新 | 按工具 | 按工作区]
68
+ agent 全部 142 · dsh 40 · opencode 40 · workbuddy 40 · minimax 14 …
69
+ ────────────────────────────────────────────────────────────────────────
70
+ ★ 标星 3 你标过的,永远在最上
71
+ ✓ 要你处理 1 有事才出现
72
+ ▾ 正在跑 2
73
+ ▸ 刚结束 15 24 小时内有终态 · 默认折叠
74
+ ▾ 刚动过 1 半小时内动过、没有终态
75
+ ▸ 更早 123 近 7 天 · 点开查看 ← 展开先给一周,底部可「显示全部」
58
76
  ```
59
77
 
60
78
  每个会话是一张卡片:标题 + 相对时间、日期、agent / 工作区标签、状态药丸、上下文占用条。
79
+ 右键卡片有菜单:从看板移除 / 标星 / 打开会话 / 复制标题。
61
80
 
62
- 判据:`needs-you`/`failed` → 第一段;`running` → 第二段;其余按 `recentMinutes` 切「最近动过 / 更早」。组标题上的数字是条数,右边是各 agent 分布。顶部的「本机共 524 个会话,只取最近 124 个」说明每个源最多取 `perSource` 条。
63
-
64
- 热力图的周数是算出来的:按当前结果里最早的一条会话撑开(4–10 周),既不留大片空白,也不编造没有的历史。
81
+ 两处刻意的口径:
65
82
 
66
- ## agent 靠字形区分,不靠颜色
83
+ - **顶栏只放行动类数字**。「完成 / 本机会话 / 接入率」是库存,放成一行小字——同一组数字在顶栏、分布条、筛选芯片各报一遍只会稀释注意力。
84
+ - **Agent 分布默认按近 24h 统计**,可切近 7 天 / 全部。「全部」比的是谁历史攒得多——几个主力 agent 常常各占一样的份额,齐刷刷并列,说明不了现在谁在干活。
67
85
 
68
- 八个色相装不下九个 agent:总有两个撞在一起,色弱用户则一个都分不出。所以每个 agent 有一个**专属轮廓**,颜色只做冗余补充:
86
+ ## agent 靠图标区分,不靠颜色
69
87
 
70
- | agent | 记号 | agent | 记号 |
71
- | --- | --- | --- | --- |
72
- | dsh | ● 实心圆 | minimax | △ 空心三角 |
73
- | codex | ⬡ 空心六边形 | trae | ○ 空心圆环 |
74
- | opencode | > 尖括号 | claude | ✳ 八向米字 |
75
- | workbuddy | ■ 实心圆角方 | 其他/未接入 | ◌ 虚线圆环 |
76
- | gemini | ✦ 四角星 | zcode | Z 字形 |
88
+ 八个色相装不下九个 agent:总有两个撞在一起,色弱用户则一个都分不出。所以每个 agent 用**自己的品牌图标**(DeepSeek 的鲸鱼、Claude 的花、OpenAI 的 knot…),颜色只做冗余补充。
77
89
 
78
- 这些是**抽象记号,不是品牌 Logo** —— 不臆造任何厂商的商标。同一套记号贯穿全页:筛选胶囊、卡片标签、Agent 分布的排行条、分组标题右侧的 agent 构成,扫一眼就能对上。
90
+ - 品牌图标取自 [simple-icons](https://simpleicons.org)(CC0),由 `scripts/build-brand-icons.mjs` 生成后写进 `client/client.js` 的 `BRAND_ICONS`:**一个 path、一条 24×24 viewBox、一个品牌色**。桌面端不联网,图标全部内联。
91
+ - 没有公开图标的工具(codex、zcode…)保留几何记号作回退,**不臆造厂商商标**。
92
+ - 同一套图标贯穿全页:筛选胶囊、卡片标签、Agent 分布的排行条、分组标题右侧的 agent 构成,扫一眼就能对上。
79
93
 
80
- 同一批记号因此替代了两样东西:
94
+ 状态那一维另有一套**线性记号**(▶ ! ✕ ✓ ⊘ ⏱ 🌙),见「状态词典」。**填充 = 是谁,线条 = 什么状态**,两个维度一眼可分。
81
95
 
82
- - **环形图换成排行条**。九个 agent 挤进一个环就是九条细缝的纯颜色,是最难分辨的形态;排行条里「形状=是谁、条长=多少、颜色=重复一遍」。
83
- - **状态颜色仍然保留**。状态那一维本来就带文字(在跑 / 失败 / 完成),颜色是语义色的补充,不承担识别职责。
96
+ 环形图因此换成了排行条:九个 agent 挤进一个环就是九条细缝的纯颜色,是最难分辨的形态;排行条里「图标=是谁、条长=多少、颜色=重复一遍」。
84
97
 
85
98
  ## 筛选
86
99
 
87
100
  右上角的时间窗口(今天 / 近 7 天 / 近 30 天 / 全部)作用在**最后活动时间**上;「会话」区可按标题、工作区、agent 搜索。
88
101
 
89
- 筛选胶囊分成两组:**agent**(哪些 agent)和**状态**(哪些状态)。点一下是选中,**再点一下同一个胶囊就取消** —— 选不掉的筛选是坑。各组数字是**分面计数**:算当前这组的分布时,另一组不参与,所以切来切去数字不会变成一片 0。
102
+ 筛选胶囊分成**两行**:上面一行是 **agent**(哪些 agent),下面一行是 **状态**(哪些状态)。分两行是因为 agent 的数量随机器增长、状态最多四个,挤在一行时两个维度会互相挤掉,中间那条分隔线一换行就没了。点一下是选中,**再点一下同一个胶囊就取消** —— 选不掉的筛选是坑。各组数字是**分面计数**:算当前这组的分布时,另一组不参与,所以切来切去数字不会变成一片 0。
90
103
 
91
- 状态组只给四个值得筛的状态:**在跑 / 等你 / 失败 / 完成**。`刚停` 和 `无动静` 是兜底桶("最近没动静"),筛它们等于把「更早」那一段再翻一遍,所以不做成胶囊 —— 但卡片上的状态药丸照样显示这两个状态。默认全部时间、全部状态,不藏任何东西;筛完可以「清空筛选」复原。
104
+ 状态组只给四个值得筛的状态:**在跑 / 等你 / 失败 / 完成**。`刚动过` 和 `长期无动静` 是兜底桶("最近没动静"),筛它们等于把「更早」那一段再翻一遍,所以不做成胶囊 —— 但卡片上的状态药丸照样显示这两个状态。默认全部时间、全部状态,不藏任何东西;筛完可以「清空筛选」复原。
92
105
 
93
106
  ## 跳转
94
107
 
@@ -152,18 +165,30 @@ turn/end.reason.kind → completed / error / aborted / approval / …
152
165
 
153
166
  ## 状态词典
154
167
 
168
+ 每个状态有自己的记号,和 agent 的品牌图标分开:**填充的品牌图标 = 是谁,线性描边的记号 = 什么状态**。颜色只是第三重冗余,色弱用户靠形状也能分清。
169
+
170
+ | 状态 | 记号 | 含义 |
171
+ |---|---|---|
172
+ | 在跑 | ▶ | 存储自带 `running/active`,或刚刚还有动静 |
173
+ | 等你 | ! | 存储自带 `wait/pending/confirm/approv` —— 在等你拍板 |
174
+ | 失败 | ✕ | 存储自带 `error`,且是最近才失败的 |
175
+ | 完成 | ✓ | 存储自带 `completed/archived` —— 归档的会话也算完成 |
176
+ | 中止 | ⊘ | 存储自带 `terminated/cancel/stop/aborted` |
177
+ | 刚动过 | ⏱ | 半小时内动过,但存储没说它结束 —— 这是时间,不是终态 |
178
+ | 长期无动静 | 🌙 | 半小时以上没动,存储也没说它结束 —— 不代表已归档 |
179
+
155
180
  各源的自带状态按这套规则映射,不猜:
156
181
 
157
182
  | 原始状态 | 归到 |
158
183
  |---|---|
159
184
  | `working` / `active` | 在跑 |
160
185
  | `error` | 失败(且只在 `attentionHours` 内进「要你处理」) |
161
- | `terminated` | 已停 |
186
+ | `terminated` | 中止 |
162
187
  | `completed` / `archived` | 完成 |
163
188
  | `waiting` / `pending` / `confirm` / `approv` | 等你 |
164
189
  | 其余 | 按最后活动时间推断 |
165
190
 
166
- **「无动静」不是归档。** 它是兜底状态:该存储没有自带状态、而且已经很久(默认 > `recentMinutes` = 30 分钟)没有任何动静。真正归档的会话,如果存储自带 `archived`,会落在**完成**里;存储不给状态、只是很久没动的,就落在**无动静**。每个状态药丸都有 tooltip 说明它是怎么来的。
191
+ **「长期无动静」不是归档。** 它是兜底状态:该存储没有自带状态、而且已经很久(默认 > `recentMinutes` = 30 分钟)没有任何动静。真正归档的会话,如果存储自带 `archived`,会落在**完成**里;存储不给状态、只是很久没动的,就落在**长期无动静**。每个状态药丸都有 tooltip 说明它是怎么来的。
167
192
 
168
193
  ## 状态怎么来的
169
194
 
@@ -184,24 +209,75 @@ turn/end.reason.kind → completed / error / aborted / approval / …
184
209
  | codex | `volcengine` | rollout 头部的 `model_provider` |
185
210
  | dsh / opencode | 无 | 其存储不提供 per-session 成本 |
186
211
 
187
- ## 安装(desktop profile)
212
+ ## 下一步
213
+
214
+ 按价值和依赖排的,不是承诺:
215
+
216
+ | 方向 | 要做什么 | 代价 |
217
+ |---|---|---|
218
+ | **点卡片直接跳到对应工具** | 现在只有 DSH 行能跳(`uiWorkspace.openSession`),其它 agent 点击是复制工作区路径。目标是每张卡片都落到「那个工具里的这条会话」,例如 opencode 用 `opencode --session <id>`、WorkBuddy 走它的 deep link。缺的是各家「打开某会话」的入口,要逐个确认能不能从外部唤起 | 中 |
219
+ | **卡片详情抽屉** | 点开看最近几条消息、tool 调用、耗时。前置是 `tool/call` 事件解析——那同时也是「在跑卡显示正在干什么」的前提,一次做完两件事 | 大 |
220
+ | **spec 引擎取代手写 collector** | sqlite 系仍是四个手写采集器,`lib/sources.mjs` 目前只用于匹配。改成走 `lib/generic.mjs` 的通用查询,能删掉约 150 行重复代码 | 中 |
221
+ | **接入扫描到的候选** | 本机扫描已经能识别 AionUi、GitKrakenCLI 这类「有会话表但没 spec」的库,缺的只是一行 spec | 小 |
222
+
223
+ ## 开发与发布工具
224
+
225
+ 都在 `scripts/` 下,都不需要起 DSH(除 `live-check`):
226
+
227
+ | 命令 | 作用 |
228
+ |---|---|
229
+ | `npm run preview` | 用**合成数据**渲染真实组件并截图,产出 `docs/preview-board.png`(README 顶部那张)。布局/图标是真的,会话内容全是编的——所以不需要打码,也不可能漏 |
230
+ | `npm run sync-mirror` | 把 npm 发布产物原样镜像到 gitcode 同步仓:取 `dist.tarball`、校验 sha512、生成目录 README 与索引行。详见 [PUBLISHING.md](PUBLISHING.md) |
231
+ | `npm run scan-agents` | 扫本机应用目录,报每个库的形状、体量和匹配到的 spec。`lib/discover.mjs` 是同一套逻辑的运行时版本 |
232
+ | `npm run render-check` / `npm run empty-check` | 离线渲染校验:一个是真实数据下的整页,一个是零会话时的空状态(含「按钮不许回来」的反向断言) |
233
+ | `npm run live-check` | 真机无头浏览器:点开侧栏「空管」、按 aria 标签点控件、截图、抓 console 异常 |
234
+ | `npm run check` | 语法 + 品牌图标是否与 simple-icons 同步 |
235
+
236
+ ## 安装
237
+
238
+ ### 从 npm(推荐)
188
239
 
189
240
  ```powershell
190
- # 1. 备份
191
- Copy-Item "$env:USERPROFILE\.dsh\profiles\desktop\package.json" `
192
- "$env:USERPROFILE\.dsh\profiles\desktop\package.json.bak"
241
+ dsh plugin add dsh-atc
242
+ ```
243
+
244
+ 桌面端也可以在「插件 → 添加插件」里填 `dsh-atc`。
193
245
 
194
- # 2. 在 package.json 里加两处
195
- # dependencies."dsh-atc" = "link:/path/to/dsh-atc"
196
- # dsh.profile.bundles 追加 "dsh-atc"
246
+ 装指定版本:
197
247
 
198
- # 3. 用 runtime 自带 pnpm 装(不要用系统 pnpm)
248
+ ```powershell
249
+ dsh plugin add dsh-atc@0.16.0
250
+ ```
251
+
252
+ ### 从 GitHub(npm 不可用时)
253
+
254
+ ```powershell
255
+ dsh plugin add github:littleyellowbicycle/dsh-atc#v0.16.0
256
+ ```
257
+
258
+ 这条不需要 npm,但首次安装会走一次源码构建,需要放行构建脚本。
259
+
260
+ ### 从本地源码
261
+
262
+ 用来改代码,改动会立刻生效(`lib/` 需重启,`client/` 刷新页面即可):
263
+
264
+ ```powershell
265
+ dsh plugin add "link:/path/to/dsh-atc"
266
+ ```
267
+
268
+ 或者手改 profile 的 `package.json`,把 `dependencies."dsh-atc"` 指向本地路径、`dsh.profile.bundles` 里追加 `"dsh-atc"`,然后用 DSH runtime 自带的 pnpm 安装(不要用系统 pnpm,版本不匹配会报 lockfile 错误):
269
+
270
+ ```powershell
199
271
  $rt = "$env:USERPROFILE\.dsh\dsh-runtimes\dsh-primary-runtime\dependencies"
200
272
  cd "$env:USERPROFILE\.dsh\profiles\desktop"
201
273
  & "$rt\node\bin\node.exe" "$rt\pnpm\bin\pnpm.cjs" install
202
274
  ```
203
275
 
204
- **必须重启桌面端**:宿主侧插件只在启动时组合进 profile,热加载不生效。
276
+ > desktop profile 由桌面应用独占管理,CLI 的 `dsh plugin` 命令不能改它——桌面端请走「插件」页面。
277
+
278
+ ### 装完必须重启桌面端
279
+
280
+ 宿主侧插件只在启动时组合进 profile,热加载不生效。只改了 `client/` 的话,刷新页面就够。
205
281
 
206
282
  ## 使用
207
283
 
@@ -241,4 +317,10 @@ node scripts/live-check.mjs 'http://127.0.0.1:60200/?token=<token>' `
241
317
 
242
318
  ## 卸载
243
319
 
244
- 删掉 `package.json` 里那两处,重跑 pnpm install,重启。
320
+ ```powershell
321
+ dsh plugin remove dsh-atc
322
+ ```
323
+
324
+ 然后重启 DSH。桌面端在「插件」页面里移除。
325
+
326
+ 从本地源码装的话,删掉 profile `package.json` 里 `dependencies` 和 `bundles` 这两处,重跑 pnpm install,再重启。
package/client/client.js CHANGED
@@ -197,6 +197,126 @@ window.__ModuleLoader__.load({
197
197
  },
198
198
  }
199
199
 
200
+ /**
201
+ * Status marks, one shape per state.
202
+ *
203
+ * The agents now carry real brand logos, which leaves colour as the only
204
+ * thing telling the states apart — the very thing we just got rid of on
205
+ * the agent side. These marks are strokes, the brand logos are fills, so
206
+ * the two dimensions never read as the same kind of thing: filled = who,
207
+ * lined = what state.
208
+ */
209
+ const STATUS_SHAPES = {
210
+ running: [
211
+ {
212
+ tag: 'path',
213
+ attrs: {
214
+ d: 'M4.4 2.9 9.2 6l-4.8 3.1z',
215
+ stroke: 'currentColor',
216
+ strokeWidth: 1.5,
217
+ fill: 'none',
218
+ strokeLinejoin: 'round',
219
+ },
220
+ },
221
+ ],
222
+ 'needs-you': [
223
+ {
224
+ tag: 'path',
225
+ attrs: {
226
+ d: 'M6 2.3v4.3',
227
+ stroke: 'currentColor',
228
+ strokeWidth: 1.6,
229
+ fill: 'none',
230
+ strokeLinecap: 'round',
231
+ },
232
+ },
233
+ { tag: 'circle', attrs: { cx: 6, cy: 9.3, r: 0.8, fill: 'currentColor' } },
234
+ ],
235
+ failed: [
236
+ {
237
+ tag: 'path',
238
+ attrs: {
239
+ d: 'M3.7 3.7 8.3 8.3M8.3 3.7 3.7 8.3',
240
+ stroke: 'currentColor',
241
+ strokeWidth: 1.6,
242
+ fill: 'none',
243
+ strokeLinecap: 'round',
244
+ },
245
+ },
246
+ ],
247
+ done: [
248
+ {
249
+ tag: 'path',
250
+ attrs: {
251
+ d: 'M2.9 6.3 4.9 8.4 9.1 3.7',
252
+ stroke: 'currentColor',
253
+ strokeWidth: 1.7,
254
+ fill: 'none',
255
+ strokeLinecap: 'round',
256
+ strokeLinejoin: 'round',
257
+ },
258
+ },
259
+ ],
260
+ stopped: [
261
+ { tag: 'circle', attrs: { cx: 6, cy: 6, r: 4.2, stroke: 'currentColor', strokeWidth: 1.5, fill: 'none' } },
262
+ {
263
+ tag: 'path',
264
+ attrs: {
265
+ d: 'M3.4 3.4 8.6 8.6',
266
+ stroke: 'currentColor',
267
+ strokeWidth: 1.5,
268
+ fill: 'none',
269
+ strokeLinecap: 'round',
270
+ },
271
+ },
272
+ ],
273
+ recent: [
274
+ { tag: 'circle', attrs: { cx: 6, cy: 6, r: 4.2, stroke: 'currentColor', strokeWidth: 1.4, fill: 'none' } },
275
+ {
276
+ tag: 'path',
277
+ attrs: {
278
+ d: 'M6 3.5V6l1.9 1.3',
279
+ stroke: 'currentColor',
280
+ strokeWidth: 1.4,
281
+ fill: 'none',
282
+ strokeLinecap: 'round',
283
+ strokeLinejoin: 'round',
284
+ },
285
+ },
286
+ ],
287
+ idle: [
288
+ {
289
+ tag: 'path',
290
+ attrs: {
291
+ d: 'M9.4 8.8A4.1 4.1 0 0 1 4.2 3.6a4.3 4.3 0 1 0 5.2 5.2z',
292
+ stroke: 'currentColor',
293
+ strokeWidth: 1.4,
294
+ fill: 'none',
295
+ strokeLinejoin: 'round',
296
+ },
297
+ },
298
+ ],
299
+ }
300
+
301
+ /** One state mark, in the colour of the state it stands for. */
302
+ function StatusGlyph({ status, size = 12, color }) {
303
+ const parts = STATUS_SHAPES[status] || STATUS_SHAPES.idle
304
+ return h(
305
+ 'svg',
306
+ {
307
+ className: 'fb-status-glyph',
308
+ width: size,
309
+ height: size,
310
+ viewBox: '0 0 12 12',
311
+ fill: 'none',
312
+ 'aria-hidden': 'true',
313
+ focusable: 'false',
314
+ style: color ? { '--fb-status-color': color } : undefined,
315
+ },
316
+ parts.map((part, index) => h(part.tag, { key: index, ...part.attrs })),
317
+ )
318
+ }
319
+
200
320
  /**
201
321
  * Only these states are worth a filter chip. 刚停 / 无动静 are catch-all
202
322
  * buckets: they only say "nothing happened lately", and filtering by them
@@ -401,6 +521,17 @@ window.__ModuleLoader__.load({
401
521
  /** Status order used by the stacked bar and the legend. */
402
522
  const STATUS_ORDER = ['running', 'needs-you', 'failed', 'done', 'stopped', 'recent', 'idle']
403
523
 
524
+ /**
525
+ * Windows for the agent distribution. "All" counts history, so whoever keeps
526
+ * the most old sessions wins — true but useless. A rolling window answers
527
+ * the question a dashboard is for: who has been working lately.
528
+ */
529
+ const AGENT_SCOPES = [
530
+ { key: 'd1', label: '近 24h', ms: DAY },
531
+ { key: 'd7', label: '近 7 天', ms: 7 * DAY },
532
+ { key: 'all', label: '全部', ms: Infinity },
533
+ ]
534
+
404
535
  /** Time windows; `all` keeps the historical default of showing everything. */
405
536
  const RANGES = [
406
537
  { key: 'today', label: '今天', ms: DAY },
@@ -704,21 +835,31 @@ window.__ModuleLoader__.load({
704
835
  viewBox: '0 0 24 24',
705
836
  fill: 'none',
706
837
  stroke: 'currentColor',
707
- strokeWidth: 1.7,
838
+ // The group below is scaled by 1.42, so this lands on ~1.9 once
839
+ // rendered: as heavy as the icons the host draws beside it.
840
+ strokeWidth: 1.34,
708
841
  strokeLinecap: 'round',
709
842
  strokeLinejoin: 'round',
710
843
  'aria-hidden': 'true',
711
844
  },
712
845
  // Control tower: mast, cabin, tapered leg, and two outbound sweep arcs.
713
- h('path', { d: 'M12 2.4v2.6' }),
714
- h('rect', { x: 9, y: 5, width: 6, height: 2.8, rx: 1 }),
715
- h('path', { d: 'M10.2 7.8 9.4 15M13.8 7.8 14.6 15' }),
716
- h('path', { d: 'M8.6 15h6.8' }),
717
- h('path', { d: 'M16.9 6.2a4.2 4.2 0 0 1 0 6.1' }),
718
- h('path', { d: 'M19.1 4.1a7.4 7.4 0 0 1 0 10.3', opacity: 0.55 }),
719
- attention > 0
720
- ? h('circle', { cx: 19.6, cy: 4.4, r: 3, fill: 'var(--dsw-alias-state-warn-primary)', stroke: 'none' })
721
- : null,
846
+ //
847
+ // As authored the drawing filled barely half of the box and sat off to
848
+ // the right, so the row read as a smaller icon next to the host's.
849
+ // The transform scales it up and centres it in the viewBox.
850
+ h(
851
+ 'g',
852
+ { transform: 'translate(-9.21 -0.91) scale(1.42)' },
853
+ h('path', { d: 'M12 2.4v2.6' }),
854
+ h('rect', { x: 9, y: 5, width: 6, height: 2.8, rx: 1 }),
855
+ h('path', { d: 'M10.2 7.8 9.4 15M13.8 7.8 14.6 15' }),
856
+ h('path', { d: 'M8.6 15h6.8' }),
857
+ h('path', { d: 'M16.9 6.2a4.2 4.2 0 0 1 0 6.1' }),
858
+ h('path', { d: 'M19.1 4.1a7.4 7.4 0 0 1 0 10.3', opacity: 0.55 }),
859
+ attention > 0
860
+ ? h('circle', { cx: 19.8, cy: 3.8, r: 2.6, fill: 'var(--dsw-alias-state-warn-primary)', stroke: 'none' })
861
+ : null,
862
+ ),
722
863
  )
723
864
  }
724
865
 
@@ -762,8 +903,8 @@ window.__ModuleLoader__.load({
762
903
  * bar: the shape says who, the bar says how much, and the hue only
763
904
  * repeats what the shape already said.
764
905
  */
765
- function AgentBars({ rows, total }) {
766
- if (rows.length === 0) return h('div', { className: 'fb-agent-bar-empty' }, '没有数据')
906
+ function AgentBars({ rows, total, empty }) {
907
+ if (rows.length === 0) return h('div', { className: 'fb-agent-bar-empty' }, empty ?? '没有数据')
767
908
  const max = Math.max(...rows.map((row) => row.value))
768
909
  return h(
769
910
  'div',
@@ -953,7 +1094,7 @@ window.__ModuleLoader__.load({
953
1094
  style: { color: status.color, background: status.soft },
954
1095
  title: status.hint,
955
1096
  },
956
- h('i', { className: 'fb-status-dot', style: { background: status.color } }),
1097
+ h(StatusGlyph, { status: item.status, size: 11 }),
957
1098
  status.label,
958
1099
  ),
959
1100
  ctx
@@ -1106,6 +1247,7 @@ function EmptyState({ board }) {
1106
1247
  const [hidden, setHidden] = useState(() => loadHidden())
1107
1248
  const [menu, setMenu] = useState(null)
1108
1249
  const [starred, setStarred] = useState(() => loadStarred())
1250
+ const [agentScope, setAgentScope] = useState('d1')
1109
1251
  const board = state.data
1110
1252
 
1111
1253
  // The poller reads this flag; keeping it in the store means pausing does
@@ -1234,7 +1376,13 @@ function EmptyState({ board }) {
1234
1376
  [bands, sort],
1235
1377
  )
1236
1378
 
1237
- const tools = useMemo(() => toolBreakdown(filtered), [filtered])
1379
+ const agentWindow = AGENT_SCOPES.find((entry) => entry.key === agentScope) ?? AGENT_SCOPES[0]
1380
+ const agentItems = useMemo(() => {
1381
+ if (agentWindow.ms === Infinity) return filtered
1382
+ const floor = Date.now() - agentWindow.ms
1383
+ return filtered.filter((item) => item.lastActivity >= floor)
1384
+ }, [filtered, agentWindow])
1385
+ const tools = useMemo(() => toolBreakdown(agentItems), [agentItems])
1238
1386
  const statuses = useMemo(() => statusBreakdown(filtered), [filtered])
1239
1387
  // Widen the heatmap just enough to cover the oldest visible session, so
1240
1388
  // the grid is never half empty and never invents history that is not there.
@@ -1481,9 +1629,20 @@ function EmptyState({ board }) {
1481
1629
  'div',
1482
1630
  { className: 'fb-card-head' },
1483
1631
  h('span', { className: 'fb-card-title' }, 'Agent 分布'),
1484
- h('span', { className: 'fb-card-meta' }, `${filtered.length} 个会话`),
1632
+ h(
1633
+ 'span',
1634
+ { className: 'fb-card-meta' },
1635
+ agentItems.length === filtered.length
1636
+ ? `${agentItems.length} 个会话`
1637
+ : `${agentItems.length} / ${filtered.length} 个会话`,
1638
+ ),
1639
+ h(Segmented, { options: AGENT_SCOPES, value: agentScope, onChange: setAgentScope }),
1485
1640
  ),
1486
- h(AgentBars, { rows: tools, total: filtered.length }),
1641
+ h(AgentBars, {
1642
+ rows: tools,
1643
+ total: agentItems.length,
1644
+ empty: agentScope === 'all' ? '没有数据' : `${agentWindow.label}没有会话,切到别的窗口或点「全部」`,
1645
+ }),
1487
1646
  ),
1488
1647
  ),
1489
1648
 
@@ -1522,7 +1681,7 @@ function EmptyState({ board }) {
1522
1681
  h(
1523
1682
  'span',
1524
1683
  { className: 'fb-statusbar-item', key: status.key },
1525
- h('i', { className: 'fb-legend-dot', style: { background: status.color } }),
1684
+ h(StatusGlyph, { status: status.key, size: 12, color: status.color }),
1526
1685
  `${status.label} ${status.value}`,
1527
1686
  ),
1528
1687
  ),
@@ -1561,96 +1720,105 @@ function EmptyState({ board }) {
1561
1720
  h(
1562
1721
  'div',
1563
1722
  { className: 'fb-filters' },
1564
- // Two labelled groups instead of two "全部" chips sitting next
1565
- // to each other and both looking selected.
1566
- h('span', { className: 'fb-filter-label' }, 'agent'),
1723
+ // Two rows, one per dimension. The agent row grows with the
1724
+ // machine and the status row never has more than four chips:
1725
+ // sharing a line meant the states drifted right and the
1726
+ // divider between the two groups vanished on the first wrap.
1567
1727
  h(
1568
- 'button',
1569
- {
1570
- type: 'button',
1571
- className: `fb-chip${toolFilter === 'all' ? ' fb-chip-active' : ''}`,
1572
- title: '显示所有 agent',
1573
- onClick: () => setToolFilter('all'),
1574
- },
1575
- '全部',
1576
- h('span', { className: 'fb-chip-count' }, String(agentTotal)),
1577
- ),
1578
- // A source that is readable but holds nothing (an empty store)
1579
- // earns no chip: showing "claude 0" reads like a broken agent.
1580
- (board.sources || [])
1581
- .filter((source) => source.available && (toolCounts.get(source.tool) || 0) > 0)
1582
- .map((source) =>
1728
+ 'div',
1729
+ { className: 'fb-filter-row' },
1730
+ h('span', { className: 'fb-filter-label' }, 'agent'),
1583
1731
  h(
1584
1732
  'button',
1585
1733
  {
1586
- key: source.tool,
1587
1734
  type: 'button',
1588
- className: `fb-chip${toolFilter === source.tool ? ' fb-chip-active' : ''}`,
1589
- title: `${toolCounts.get(source.tool) || 0} 个会话 · 再点一次取消筛选`,
1590
- // Clicking the selected chip again releases it: a filter
1591
- // you cannot take off is a trap.
1592
- onClick: () => setToolFilter((current) => toggleFilter(current, source.tool)),
1735
+ className: `fb-chip${toolFilter === 'all' ? ' fb-chip-active' : ''}`,
1736
+ title: '显示所有 agent',
1737
+ onClick: () => setToolFilter('all'),
1593
1738
  },
1594
- h(AgentGlyph, {
1595
- tool: source.tool,
1596
- size: 12,
1597
- color: AGENT_COLOR[source.tool],
1598
- }),
1599
- source.tool,
1600
- h('span', { className: 'fb-chip-count' }, String(toolCounts.get(source.tool) || 0)),
1739
+ '全部',
1740
+ h('span', { className: 'fb-chip-count' }, String(agentTotal)),
1601
1741
  ),
1602
- ),
1603
- (() => {
1604
- // Agents found on this machine that no parser reads yet: shown
1605
- // so the chip row never passes for a complete inventory.
1606
- const unparsed = (board.agents || []).filter((agent) => !agent.parsed)
1607
- if (unparsed.length === 0) return null
1608
- return [
1609
- h('span', { key: 'unparsed-sep', className: 'fb-chip-sep' }),
1610
- ...unparsed.map((agent) =>
1611
- h(
1612
- 'span',
1613
- {
1614
- key: `unparsed-${agent.tool}`,
1615
- className: 'fb-chip fb-chip-off fb-chip-muted',
1616
- title: agent.reason
1617
- ? `${agent.path} — ${agent.reason}`
1618
- : `检测到 ${agent.path},但还没有解析器`,
1619
- },
1620
- h(AgentGlyph, { tool: agent.tool, size: 12 }),
1621
- agent.tool,
1622
- h('span', { className: 'fb-chip-count' }, agent.reason?.includes('加密') ? '已加密' : '未接入'),
1623
- ),
1742
+ // A source that is readable but holds nothing (an empty store)
1743
+ // earns no chip: showing "claude 0" reads like a broken agent.
1744
+ (board.sources || [])
1745
+ .filter((source) => source.available && (toolCounts.get(source.tool) || 0) > 0)
1746
+ .map((source) =>
1747
+ h(
1748
+ 'button',
1749
+ {
1750
+ key: source.tool,
1751
+ type: 'button',
1752
+ className: `fb-chip${toolFilter === source.tool ? ' fb-chip-active' : ''}`,
1753
+ title: `${toolCounts.get(source.tool) || 0} 个会话 · 再点一次取消筛选`,
1754
+ // Clicking the selected chip again releases it: a filter
1755
+ // you cannot take off is a trap.
1756
+ onClick: () => setToolFilter((current) => toggleFilter(current, source.tool)),
1757
+ },
1758
+ h(AgentGlyph, {
1759
+ tool: source.tool,
1760
+ size: 12,
1761
+ color: AGENT_COLOR[source.tool],
1762
+ }),
1763
+ source.tool,
1764
+ h('span', { className: 'fb-chip-count' }, String(toolCounts.get(source.tool) || 0)),
1624
1765
  ),
1625
- ]
1626
- })(),
1627
- h('span', { className: 'fb-chip-sep' }),
1628
- h('span', { className: 'fb-filter-label' }, '状态'),
1629
- // Only the states worth filtering on. 刚停 and 无动静 are the
1630
- // catch-all buckets: they say "nothing happened lately", and
1631
- // filtering by them just reproduces the 更早 band.
1632
- FILTERABLE_STATUSES.filter((status) => statusCounts.has(status)).map((status) =>
1633
- h(
1634
- 'button',
1635
- {
1636
- key: status,
1637
- type: 'button',
1638
- className: `fb-chip${statusFilter === status ? ' fb-chip-active' : ''}`,
1639
- title: `${STATUS[status].hint} · 再点一次取消筛选`,
1640
- onClick: () => setStatusFilter((current) => toggleFilter(current, status)),
1641
- },
1642
- h('i', { className: 'fb-legend-dot', style: { background: STATUS[status].color } }),
1643
- STATUS[status].label,
1644
- h('span', { className: 'fb-chip-count' }, String(statusCounts.get(status))),
1645
1766
  ),
1767
+ (() => {
1768
+ // Agents found on this machine that no parser reads yet: shown
1769
+ // so the chip row never passes for a complete inventory.
1770
+ const unparsed = (board.agents || []).filter((agent) => !agent.parsed)
1771
+ if (unparsed.length === 0) return null
1772
+ return [
1773
+ h('span', { key: 'unparsed-sep', className: 'fb-chip-sep' }),
1774
+ ...unparsed.map((agent) =>
1775
+ h(
1776
+ 'span',
1777
+ {
1778
+ key: `unparsed-${agent.tool}`,
1779
+ className: 'fb-chip fb-chip-off fb-chip-muted',
1780
+ title: agent.reason
1781
+ ? `${agent.path} — ${agent.reason}`
1782
+ : `检测到 ${agent.path},但还没有解析器`,
1783
+ },
1784
+ h(AgentGlyph, { tool: agent.tool, size: 12 }),
1785
+ agent.tool,
1786
+ h('span', { className: 'fb-chip-count' }, agent.reason?.includes('加密') ? '已加密' : '未接入'),
1787
+ ),
1788
+ ),
1789
+ ]
1790
+ })(),
1646
1791
  ),
1647
- filtersActive
1648
- ? h(
1792
+ h(
1793
+ 'div',
1794
+ { className: 'fb-filter-row' },
1795
+ h('span', { className: 'fb-filter-label' }, '状态'),
1796
+ // Only the states worth filtering on. 刚停 and 无动静 are the
1797
+ // catch-all buckets: they say "nothing happened lately", and
1798
+ // filtering by them just reproduces the 更早 band.
1799
+ FILTERABLE_STATUSES.filter((status) => statusCounts.has(status)).map((status) =>
1800
+ h(
1649
1801
  'button',
1650
- { type: 'button', className: 'fb-chip fb-chip-reset', onClick: resetFilters },
1651
- '清空筛选',
1652
- )
1653
- : null,
1802
+ {
1803
+ key: status,
1804
+ type: 'button',
1805
+ className: `fb-chip${statusFilter === status ? ' fb-chip-active' : ''}`,
1806
+ title: `${STATUS[status].hint} · 再点一次取消筛选`,
1807
+ onClick: () => setStatusFilter((current) => toggleFilter(current, status)),
1808
+ },
1809
+ h(StatusGlyph, { status, size: 12, color: STATUS[status].color }),
1810
+ STATUS[status].label,
1811
+ h('span', { className: 'fb-chip-count' }, String(statusCounts.get(status))),
1812
+ ),
1813
+ ),
1814
+ filtersActive
1815
+ ? h(
1816
+ 'button',
1817
+ { type: 'button', className: 'fb-chip fb-chip-reset', onClick: resetFilters },
1818
+ '清空筛选',
1819
+ )
1820
+ : null,
1821
+ ),
1654
1822
  ),
1655
1823
 
1656
1824
  board.items.length === 0
@@ -1792,7 +1960,7 @@ function EmptyState({ board }) {
1792
1960
  .fb-kpi-note{margin-top:1px;font-size:10.5px;color:var(--fb-text-4);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1793
1961
  .fb-charts{display:grid;grid-template-columns:repeat(auto-fit,minmax(380px,1fr));gap:12px;margin-bottom:12px}
1794
1962
  .fb-card{border:1px solid var(--fb-line);border-radius:var(--fb-r-md);background:var(--fb-surface);padding:14px 16px}
1795
- .fb-card-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:12px}
1963
+ .fb-card-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;flex-wrap:wrap}
1796
1964
  .fb-card-title{font-size:13px;font-weight:600}
1797
1965
  .fb-card-meta{font-size:11px;color:var(--fb-text-4)}
1798
1966
  .fb-heat-wrap{display:flex;gap:20px;align-items:flex-start;flex-wrap:wrap}
@@ -1810,6 +1978,9 @@ function EmptyState({ board }) {
1810
1978
  .fb-heat-legend{display:flex;align-items:center;gap:4px;font-size:10.5px;color:var(--fb-text-4);margin-top:14px}
1811
1979
  .fb-heat-legend i{width:10px;height:10px;border-radius:2px;display:inline-block}
1812
1980
  .fb-glyph{display:inline-block;flex:none;color:var(--fb-agent-color,currentColor)}
1981
+ /* Lined marks for the states; the agent logos are filled, so the two
1982
+ dimensions never read as the same kind of thing. */
1983
+ .fb-status-glyph{display:inline-block;flex:none;color:var(--fb-status-color,currentColor)}
1813
1984
  .fb-agent-bars{display:flex;flex-direction:column;gap:8px}
1814
1985
  .fb-agent-bar{display:flex;align-items:center;gap:9px;font-size:12px}
1815
1986
  .fb-agent-bar-name{width:76px;flex:none;color:var(--fb-text-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@@ -1820,7 +1991,6 @@ function EmptyState({ board }) {
1820
1991
  .fb-agent-bar-empty{font-size:12px;color:var(--fb-text-4)}
1821
1992
  .fb-agent-strip{display:flex;flex-wrap:wrap;align-items:center;gap:7px;margin-top:7px}
1822
1993
  .fb-agent-strip-item{display:inline-flex;align-items:center;flex:none}
1823
- .fb-legend-dot{width:8px;height:8px;border-radius:2px;display:inline-block;flex:none}
1824
1994
  .fb-statusbar{margin-bottom:4px}
1825
1995
  .fb-statusbar-track{display:flex;height:8px;border-radius:999px;overflow:hidden;background:var(--fb-line-soft)}
1826
1996
  .fb-statusbar-seg{height:100%;display:block}
@@ -1834,13 +2004,17 @@ function EmptyState({ board }) {
1834
2004
  .fb-search:focus-within{border-color:var(--fb-blue,#4c7cf3)}
1835
2005
  .fb-search input{border:none;outline:none;background:transparent;font-family:inherit;font-size:12px;color:var(--fb-text);width:100%}
1836
2006
  .fb-search input::placeholder{color:var(--fb-text-4)}
1837
- .fb-filters{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin-bottom:12px}
1838
- .fb-filter-label{font-size:10.5px;color:var(--fb-text-4);margin-right:1px;user-select:none;white-space:nowrap}
2007
+ .fb-filters{display:flex;flex-direction:column;gap:7px;margin-bottom:12px}
2008
+ .fb-filter-row{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
2009
+ /* Fixed label width: the chips of both rows start at the same x, so the two
2010
+ dimensions line up instead of stepping in and out. */
2011
+ .fb-filter-label{width:32px;flex:none;font-size:10.5px;color:var(--fb-text-4);user-select:none;white-space:nowrap}
1839
2012
  .fb-chip{display:inline-flex;align-items:center;gap:6px;font-size:11.5px;padding:3px 10px;border-radius:var(--fb-r-sm);border:1px solid var(--fb-line);background:var(--fb-surface);color:var(--fb-text-2);cursor:pointer;font-family:inherit;transition:background .15s,color .15s,border-color .15s}
1840
2013
  .fb-chip:hover{background:var(--fb-hover)}
1841
2014
  .fb-chip-active{background:var(--fb-text);border-color:var(--fb-text);color:var(--fb-surface)}
1842
2015
  .fb-chip-active:hover{background:var(--fb-text);opacity:.9}
1843
2016
  .fb-chip-active .fb-glyph{color:inherit}
2017
+ .fb-chip-active .fb-status-glyph{color:inherit}
1844
2018
  .fb-chip-off{color:var(--fb-text-4);border-style:dashed;cursor:default}
1845
2019
  .fb-chip-off:hover{background:transparent}
1846
2020
  .fb-chip-muted{opacity:.75;cursor:default}
@@ -1875,7 +2049,6 @@ function EmptyState({ board }) {
1875
2049
  .fb-meter{width:52px;height:4px;border-radius:999px;background:var(--fb-line-soft);overflow:hidden;flex:none;display:inline-block}
1876
2050
  .fb-meter i{display:block;height:100%;border-radius:999px;background:#d98324}
1877
2051
  .fb-status{display:inline-flex;align-items:center;gap:5px;font-size:11px;padding:2px 9px;border-radius:999px;white-space:nowrap}
1878
- .fb-status-dot{width:5px;height:5px;border-radius:50%;display:inline-block}
1879
2052
  /* Star: quiet until hovered, gold once set — a deliberate signal, so it stays visible. */
1880
2053
  .fb-star{border:0;background:none;padding:0 2px;margin-left:auto;font-size:12px;line-height:1;color:var(--fb-text-4);cursor:pointer;opacity:0;transition:opacity .12s ease,color .12s ease;font-family:inherit}
1881
2054
  .fb-session:hover .fb-star,.fb-star-on{opacity:1}
@@ -1956,7 +2129,7 @@ function EmptyState({ board }) {
1956
2129
  inject,
1957
2130
  apply,
1958
2131
  /** Seams for the offline render check; the host never reads these. */
1959
- __test: { FleetPage, store, refresh, toggleFilter, AGENT_GLYPH, agentGlyph },
2132
+ __test: { FleetPage, store, refresh, toggleFilter, AGENT_GLYPH, agentGlyph, STATUS_SHAPES, STATUS_ORDER },
1960
2133
  }
1961
2134
  },
1962
2135
  })
package/lib/index.js CHANGED
@@ -76,11 +76,14 @@ function writeCache(result) {
76
76
  * @param {boolean} force - ignore the cache and walk again.
77
77
  */
78
78
  async function discovery(force = false) {
79
- const cached = state.result ?? readCache()
80
- const fresh = cached && Date.now() - cached.scannedAt < DISCOVERY_TTL_MS
79
+ const onDisk = readCache()
80
+ // Another process may have scanned more recently than this one; prefer it.
81
+ const newest =
82
+ onDisk && (!state.result || onDisk.scannedAt > state.result.scannedAt) ? onDisk : state.result ?? onDisk
83
+ const fresh = newest && Date.now() - newest.scannedAt < DISCOVERY_TTL_MS
81
84
  if (fresh && !force) {
82
- state.result = cached
83
- return cached
85
+ state.result = newest
86
+ return newest
84
87
  }
85
88
  if (state.running) return state.running
86
89
  state.running = discoverStores()
@@ -89,7 +92,7 @@ async function discovery(force = false) {
89
92
  writeCache(result)
90
93
  return result
91
94
  })
92
- .catch(() => cached ?? null)
95
+ .catch(() => newest ?? null)
93
96
  .finally(() => {
94
97
  state.running = null
95
98
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-atc",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "description": "Agent 空管中心 for DeepSeek Harness: one sidebar panel listing every local agent session (DSH, codex, opencode, WorkBuddy, Gemini) with attention-first grouping and folded history — zero token, host-side inference.",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -67,7 +67,8 @@
67
67
  "brand-icons": "node scripts/build-brand-icons.mjs",
68
68
  "brand-icons:check": "node scripts/build-brand-icons.mjs --check",
69
69
  "scan-agents": "node scripts/scan-agents.mjs",
70
- "empty-check": "node scripts/empty-check.mjs"
70
+ "empty-check": "node scripts/empty-check.mjs",
71
+ "sync-mirror": "node scripts/sync-mirror.mjs"
71
72
  },
72
73
  "peerDependencies": {
73
74
  "@deepseek-ai/cordis": "^4.0.1"