@xiangyixie/dsh-superagent 0.16.3 → 0.16.5

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
@@ -8,6 +8,42 @@ along with the next code release. A doc-only version leaves `lib/` and `bin/`
8
8
  byte-identical to the version before it, and the pinned install line in the
9
9
  README is updated to the version being released.
10
10
 
11
+ ## 0.16.5 — 2026-11-17
12
+
13
+ ### 变化
14
+
15
+ - **不再显示会话列表。** 用户只和超级智能体对话,右栏只展示它调度出去的会话
16
+ (任务线:目标 + 运行状态),不再提供普通会话式的历史会话切换;`switch`
17
+ 动作一并删除。
18
+ - **边栏开合按宿主普通会话的行为重做。** 右栏改为网格轨道 + 位移的组合动画
19
+ (与宿主 `AppFrame` / `SidebarRight` 同一套 slow/ease-in-out 节奏),收起时
20
+ 轨道归零、面板滑出;展开时轨道占 360px,正文重新居中而不是被贴边压窄。
21
+ 头栏按钮在展开/收起时镜像图标(宿主 `collapseGlyph` 的做法),保留运行中
22
+ 数量徽标。
23
+ - **窄窗口(≤960px)改为浮层抽屉。** 轨道保持 0,不挤压正文,面板带
24
+ `shadow lv2` 浮在右侧。
25
+ - 正文列宽优先使用宿主 `--dsh-chat-content-width`,缺失时才退回
26
+ `clamp(680px, 会话列宽 * .64, 920px)`,不再拿 `--dsh-chat-user-width`
27
+ 二次相乘。
28
+ - 输入区状态行去掉会话 id,只保留调度会话数量。
29
+
30
+ ## 0.16.4 — 2026-11-17
31
+
32
+ ### 变化
33
+
34
+ - **默认布局回到单列。** 打开时只有正文,没有常驻右栏;会话/任务线列表默认
35
+ 收起,和普通会话一致。
36
+ - **右栏改成可展开的抽屉。** 头栏放宿主 `IconPanelLeft` 图标按钮展开/收起,
37
+ 快捷键 `Ctrl/Cmd+Shift+B`,`Esc` 关闭;状态存 `localStorage`
38
+ (`dsh-superagent.rail-open`),下次打开保持上次选择。
39
+ - **展开不挤压正文。** 抽屉用绝对定位浮在正文右侧(`z-index` 30、
40
+ `shadow lv2`、最大宽度 `min(84vw, 320px)`),正文列宽仍按宿主
41
+ `--dsh-chat-user-width` 公式计算,窄窗口下也是浮层而不是横向挤压。
42
+ - **收起时保留最小信息。** 按钮上显示运行中任务线的数字徽标(超过 9 显示
43
+ `9+`),不再为了状态保留一整列。
44
+ - **头栏标题固定为「超级智能体」。** 去掉自动生成的会话名和面包屑分隔斜杠;
45
+ 会话名仍保留在数据层与抽屉列表里,不再当页面标题展示。
46
+
11
47
  ## 0.16.3 — 2026-11-17
12
48
 
13
49
  ### 修复
package/README.en.md CHANGED
@@ -36,12 +36,12 @@ Three steps. The desktop app and the CLI install the same plugin; each step says
36
36
 
37
37
  ### 1. Install
38
38
 
39
- Desktop: **Plugins** → **Add plugin** → enter `@xiangyixie/dsh-superagent@0.16.3` → install.
39
+ Desktop: **Plugins** → **Add plugin** → enter `@xiangyixie/dsh-superagent@0.16.5` → install.
40
40
 
41
41
  CLI:
42
42
 
43
43
  ```bash
44
- dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.3
44
+ dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.5
45
45
  ```
46
46
 
47
47
  **Restart DSH** afterwards — plugins are loaded once at host startup. You can also add the [plugin index](https://raw.githubusercontent.com/LittleChenLiya/dsh-superagent/main/plugin-index.json) on the **Discover** page for one-click installs; upgrades are always remove-then-add.
@@ -1666,7 +1666,7 @@ appears to "hang" until the ignored-abort child returns.
1666
1666
 
1667
1667
  | What you see | What it means | What to do |
1668
1668
  | --- | --- | --- |
1669
- | `superagent_*` tools do not exist | The bundle row is not mounted, or the host refused to load the plugin. | Run `--dump-config` and check for the `@xiangyixie/dsh-superagent` block; reinstall with `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.3` and read the host log for `[dsh-superagent]` lines. |
1669
+ | `superagent_*` tools do not exist | The bundle row is not mounted, or the host refused to load the plugin. | Run `--dump-config` and check for the `@xiangyixie/dsh-superagent` block; reinstall with `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.5` and read the host log for `[dsh-superagent]` lines. |
1670
1670
  | `Cannot find module .../lib/control.js` (or `watch.js` / `report.js` / `wizard.js`), or `[dsh-superagent] dsh-superagent failed to load because a file it imports is missing: ...` in the host log | The copy in that profile is incomplete — an `add` that was interrupted leaves a partial extraction. From 0.14.3 the entry point names the missing file itself. The published package is not the cause: every version ships all thirty-four `lib/` files. | Delete the plugin's directory under the profile's `node_modules` (scoped `@xiangyixie/dsh-superagent`, or unscoped `dsh-superagent` from an older tarball install) and run the same `add` command again, with the version number. Do not copy files in by hand. |
1671
1671
  | `[error] the model provider rejected the API key` | The key env var is missing in the process that started the host. | Export `DEEPSEEK_API_KEY` (the default route) or the variable your route names, then restart `dsh`. |
1672
1672
  | `MISSING_CREDENTIAL ... no API key for provider route "..."` | The profile's route has no credential in the environment. | Set the env var named for that route and restart. The error line names the route, so use that, not this page. |
package/README.md CHANGED
@@ -36,12 +36,12 @@ dsh-superagent 把这件事接过去:你说一句目标,它负责拆、负
36
36
 
37
37
  ### 1. 装
38
38
 
39
- 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.16.3` → 安装。
39
+ 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.16.5` → 安装。
40
40
 
41
41
  命令行:
42
42
 
43
43
  ```bash
44
- dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.3
44
+ dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.5
45
45
  ```
46
46
 
47
47
  装完**重启 DSH**(插件只在宿主启动时加载一次)。也可以从「发现」页添加[插件索引](https://raw.githubusercontent.com/LittleChenLiya/dsh-superagent/main/plugin-index.json)一键安装;升级一律先 `remove` 再 `add`。
@@ -1090,7 +1090,7 @@ SHA-256)。`--format html` 把同样的内容写成一个自包含
1090
1090
 
1091
1091
  | 你看到的 | 含义 | 怎么办 |
1092
1092
  | --- | --- | --- |
1093
- | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.3` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1093
+ | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.5` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1094
1094
  | `Cannot find module .../lib/control.js`(或 `watch.js` / `report.js` / `wizard.js`),或宿主日志里的 `[dsh-superagent] dsh-superagent failed to load because a file it imports is missing: ...` | 那个 profile 里的副本不完整——被中断的 `add` 会留下残缺的解包结果。0.14.3 起的入口会直接点名缺哪个文件。已发布的包不是原因:每个版本都带全部三十四个 `lib/` 文件。 | 删掉 profile 的 `node_modules` 下该插件的目录(带 scope 的 `@xiangyixie/dsh-superagent`,或旧 tarball 安装留下的无 scope 的 `dsh-superagent`),再用同一条 `add` 命令重装,并带上版本号。不要手工拷贝文件进去。 |
1095
1095
  | `[error] the model provider rejected the API key` | 启动宿主的那个进程里缺 key 环境变量。 | 导出 `DEEPSEEK_API_KEY`(默认路由)或你那条路由声明的变量,然后重启 `dsh`。 |
1096
1096
  | `MISSING_CREDENTIAL ... no API key for provider route "..."` | profile 的路由在环境里没有凭据。 | 设置该路由对应的环境变量并重启。错误行里写了路由名,以它为准,不要照本文。 |
package/README.zh.md CHANGED
@@ -36,12 +36,12 @@ dsh-superagent 把这件事接过去:你说一句目标,它负责拆、负
36
36
 
37
37
  ### 1. 装
38
38
 
39
- 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.16.3` → 安装。
39
+ 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.16.5` → 安装。
40
40
 
41
41
  命令行:
42
42
 
43
43
  ```bash
44
- dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.3
44
+ dsh plugin --profile web add @xiangyixie/dsh-superagent@0.16.5
45
45
  ```
46
46
 
47
47
  装完**重启 DSH**(插件只在宿主启动时加载一次)。也可以从「发现」页添加[插件索引](https://raw.githubusercontent.com/LittleChenLiya/dsh-superagent/main/plugin-index.json)一键安装;升级一律先 `remove` 再 `add`。
@@ -1090,7 +1090,7 @@ SHA-256)。`--format html` 把同样的内容写成一个自包含
1090
1090
 
1091
1091
  | 你看到的 | 含义 | 怎么办 |
1092
1092
  | --- | --- | --- |
1093
- | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.3` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1093
+ | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.16.5` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1094
1094
  | `Cannot find module .../lib/control.js`(或 `watch.js` / `report.js` / `wizard.js`),或宿主日志里的 `[dsh-superagent] dsh-superagent failed to load because a file it imports is missing: ...` | 那个 profile 里的副本不完整——被中断的 `add` 会留下残缺的解包结果。0.14.3 起的入口会直接点名缺哪个文件。已发布的包不是原因:每个版本都带全部三十四个 `lib/` 文件。 | 删掉 profile 的 `node_modules` 下该插件的目录(带 scope 的 `@xiangyixie/dsh-superagent`,或旧 tarball 安装留下的无 scope 的 `dsh-superagent`),再用同一条 `add` 命令重装,并带上版本号。不要手工拷贝文件进去。 |
1095
1095
  | `[error] the model provider rejected the API key` | 启动宿主的那个进程里缺 key 环境变量。 | 导出 `DEEPSEEK_API_KEY`(默认路由)或你那条路由声明的变量,然后重启 `dsh`。 |
1096
1096
  | `MISSING_CREDENTIAL ... no API key for provider route "..."` | profile 的路由在环境里没有凭据。 | 设置该路由对应的环境变量并重启。错误行里写了路由名,以它为准,不要照本文。 |
package/lib/client.js CHANGED
@@ -85,6 +85,7 @@ window.__ModuleLoader__.load({
85
85
  close: ui?.IconCloseOutlineRegular ?? ui?.IconCloseOutlineMedium,
86
86
  folder: ui?.IconFolderCloseRegular ?? ui?.IconFolderCloseMedium,
87
87
  chevron: ui?.IconChevronDownOutlineRegular ?? ui?.IconChevronDownOutlineMedium,
88
+ panel: ui?.IconPanelLeftOutlineRegular ?? ui?.IconPanelLeftOutlineMedium,
88
89
  }
89
90
  // MarkdownText reads `labels.code` on every fenced block, so the host
90
91
  // component is only safe with this shape filled in.
@@ -105,6 +106,22 @@ window.__ModuleLoader__.load({
105
106
  { id: 'queue', label: '排队' },
106
107
  { id: 'steer', label: '插话' },
107
108
  ]
109
+ const RAIL_KEY = 'dsh-superagent.rail-open'
110
+ function readRailOpen() {
111
+ try {
112
+ return window.localStorage.getItem(RAIL_KEY) === '1'
113
+ } catch (error) {
114
+ return false
115
+ }
116
+ }
117
+ function saveRailOpen(open) {
118
+ try {
119
+ window.localStorage.setItem(RAIL_KEY, open ? '1' : '0')
120
+ } catch (error) {
121
+ // Private mode or a sandboxed webview: the layout still works, it just
122
+ // does not remember the choice.
123
+ }
124
+ }
108
125
 
109
126
  /**
110
127
  * Host tooltip when it exists; the native `title` only survives as the
@@ -152,7 +169,7 @@ window.__ModuleLoader__.load({
152
169
  * 12px gaps, send 34px circle on button-info-fill, stats row 22px.
153
170
  */
154
171
  const CSS = `
155
- .dsa-root{--dsa-col:clamp(680px,calc(var(--dsh-chat-user-width,100%) * .64),920px);display:flex;flex-direction:column;height:100%;min-width:0;background:var(--dsw-alias-bg-base,rgb(21,21,23));color:var(--dsw-alias-label-primary,#f9fafb);font-family:var(--dsw-font-family,inherit);font-size:14px;line-height:22px}
172
+ .dsa-root{--dsa-col:var(--dsh-chat-content-width,clamp(680px,calc(var(--dsh-conversation-column-width,100%) * .64),920px));display:flex;flex-direction:column;height:100%;min-width:0;background:var(--dsw-alias-bg-base,rgb(21,21,23));color:var(--dsw-alias-label-primary,#f9fafb);font-family:var(--dsw-font-family,inherit);font-size:14px;line-height:22px}
156
173
  .dsa-header{display:flex;align-items:center;gap:10px;flex:none;box-sizing:border-box;min-height:76px;padding:10px 28px 0 20px;border-bottom:.5px solid var(--dsw-alias-border-l3,rgba(255,255,255,.12))}
157
174
  .dsa-crumbs{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow:hidden;white-space:nowrap}
158
175
  .dsa-crumb{display:inline-block;max-width:220px;overflow:hidden;padding:4px 8px;border:0;border-radius:var(--dsw-radius-md,12px);background:transparent;color:var(--dsw-alias-label-tertiary,rgb(129,133,140));font-size:14px;line-height:20px;text-overflow:ellipsis;white-space:nowrap}
@@ -163,12 +180,16 @@ window.__ModuleLoader__.load({
163
180
  .dsa-iconbtn svg{width:15px;height:15px}
164
181
  .dsa-iconbtn:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08))}
165
182
  .dsa-iconbtn:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-alias-state-business-primary,#7aaaff);outline-offset:-2px}
183
+ .dsa-railtoggle{position:relative}
184
+ .dsa-railtoggle[aria-expanded=false] svg{transform:scaleX(-1)}
185
+ .dsa-badge{position:absolute;top:-2px;right:-2px;min-width:14px;height:14px;padding:0 3px;border-radius:7px;background:var(--dsw-alias-state-business-primary,#4d6bfe);color:#fff;font-size:9px;line-height:14px;font-weight:600;text-align:center;box-sizing:border-box}
166
186
  .dsa-status{display:inline-flex;align-items:center;gap:6px;font-size:12px;line-height:18px;color:var(--dsw-alias-label-tertiary,rgb(129,133,140))}
167
187
  .dsa-dot{width:6px;height:6px;border-radius:50%;background:var(--dsw-alias-label-caption,rgb(129,133,140))}
168
188
  .dsa-dot[data-state=live]{background:var(--dsw-alias-state-success-primary,#22c55e)}
169
189
  .dsa-dot[data-state=warn]{background:var(--dsw-alias-state-warn-primary,#f59e0b)}
170
- .dsa-body{display:flex;flex:1;min-height:0}
171
- .dsa-main{position:relative;display:flex;flex-direction:column;flex:1;min-width:0}
190
+ .dsa-body{position:relative;display:grid;grid-template-columns:minmax(0,1fr) 0;grid-template-rows:minmax(0,1fr);flex:1;min-height:0;overflow:hidden;transition:grid-template-columns var(--ds-transition-duration-slow,240ms) var(--ds-ease-in-out,ease)}
191
+ .dsa-body[data-rail=open]{grid-template-columns:minmax(0,1fr) 360px}
192
+ .dsa-main{grid-column:1;grid-row:1;position:relative;display:flex;flex-direction:column;min-width:0;min-height:0}
172
193
  .dsa-scroll{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;margin-right:2px;padding:0 32px;scrollbar-gutter:stable}
173
194
  .dsa-scroll::-webkit-scrollbar{width:10px}
174
195
  .dsa-scroll::-webkit-scrollbar-thumb{border-radius:5px;background:var(--dsw-alias-scrollbar-bg-l1,rgba(255,255,255,.16))}
@@ -215,13 +236,22 @@ window.__ModuleLoader__.load({
215
236
  .dsa-approval-title{font-size:14px;line-height:22px;font-weight:500;color:var(--dsw-alias-label-primary,#f9fafb)}
216
237
  .dsa-approval-body{font-size:13px;line-height:20px;color:var(--dsw-alias-label-secondary,rgb(207,211,214));overflow-wrap:anywhere}
217
238
  .dsa-approval-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-end}
218
- .dsa-rail{display:flex;flex:none;flex-direction:column;width:260px;min-width:0;box-sizing:border-box;padding:6px 8px;border-left:.5px solid var(--dsw-alias-border-l3,rgba(255,255,255,.12))}
239
+ .dsa-rail{grid-column:2;grid-row:1;justify-self:end;display:flex;flex-direction:column;width:360px;max-width:min(84vw,360px);min-width:0;box-sizing:border-box;padding:8px;border-left:.5px solid var(--dsw-alias-border-l3,rgba(255,255,255,.12));background:var(--dsw-alias-bg-base,rgb(21,21,23));overflow:hidden;visibility:hidden;transform:translateX(100%);transition:transform var(--ds-transition-duration-slow,240ms) var(--ds-ease-in-out,ease),visibility 0s linear var(--ds-transition-duration-slow,240ms)}
240
+ .dsa-body[data-rail=open] .dsa-rail{visibility:visible;transform:none;transition:transform var(--ds-transition-duration-slow,240ms) var(--ds-ease-in-out,ease)}
241
+ @media (max-width:960px){
242
+ .dsa-body[data-rail=open]{grid-template-columns:minmax(0,1fr) 0}
243
+ .dsa-body[data-rail=open] .dsa-rail{box-shadow:var(--dsw-shadow-lv2,0 8px 28px rgba(0,0,0,.32))}
244
+ }
245
+ @media (prefers-reduced-motion:reduce){
246
+ .dsa-body,.dsa-rail,.dsa-body[data-rail=open] .dsa-rail{transition:none}
247
+ }
248
+ .dsa-rail-count{font-size:11px;line-height:16px;color:var(--dsw-alias-label-tertiary,rgb(129,133,140))}
249
+ .dsa-rowdot{flex:none;width:6px;height:6px;border-radius:50%;background:var(--dsw-alias-label-caption,rgb(129,133,140))}
250
+ .dsa-rowdot[data-status=running]{background:var(--dsw-alias-state-success-primary,#22c55e)}
251
+ .dsa-rowdot[data-status=stopped]{background:var(--dsw-alias-state-warn-primary,#f59e0b)}
219
252
  .dsa-rail-head{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:6px 8px;font-size:13px;line-height:20px;color:var(--dsw-alias-label-tertiary,rgb(129,133,140))}
220
- .dsa-rail-list{display:flex;flex-direction:column;gap:2px;min-height:0;overflow-y:auto;margin-bottom:8px}
221
- .dsa-rowitem{display:flex;align-items:center;gap:6px;box-sizing:border-box;width:100%;height:32px;padding:0 8px 0 9px;border:0;border-radius:var(--dsw-radius-md,12px);background:transparent;color:var(--dsw-alias-label-primary,#f9fafb);font:inherit;font-size:14px;line-height:20px;text-align:left;cursor:pointer}
222
- .dsa-rowitem:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08))}
223
- .dsa-rowitem[data-selected=true]{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08))}
224
- .dsa-rowitem:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-alias-state-business-primary,#7aaaff);outline-offset:-2px}
253
+ .dsa-rail-list{display:flex;flex:1;flex-direction:column;gap:2px;min-height:0;overflow-y:auto;margin-bottom:8px}
254
+ .dsa-rowitem{display:flex;align-items:center;gap:6px;box-sizing:border-box;width:100%;height:32px;padding:0 8px 0 9px;border:0;border-radius:var(--dsw-radius-md,12px);background:transparent;color:var(--dsw-alias-label-primary,#f9fafb);font:inherit;font-size:14px;line-height:20px;text-align:left;cursor:default}
225
255
  .dsa-rowtitle{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
226
256
  .dsa-rowtime{flex:none;font-size:10px;line-height:16px;color:var(--dsw-alias-label-tertiary,rgb(129,133,140));margin-inline-end:-1px}
227
257
  .dsa-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;height:100%;padding:24px;text-align:center}
@@ -261,29 +291,6 @@ window.__ModuleLoader__.load({
261
291
  .join('')
262
292
  }
263
293
 
264
- function shortId(value) {
265
- const text = typeof value === 'string' ? value : ''
266
- return text ? text.slice(0, 8) : ''
267
- }
268
-
269
- function clockOf(value) {
270
- const time = value ? Date.parse(value) : NaN
271
- if (!Number.isFinite(time)) return ''
272
- const date = new Date(time)
273
- const sameDay = new Date().toDateString() === date.toDateString()
274
- const pad = number => String(number).padStart(2, '0')
275
- return sameDay
276
- ? `${pad(date.getHours())}:${pad(date.getMinutes())}`
277
- : `${date.getMonth() + 1}/${date.getDate()}`
278
- }
279
-
280
- function sessionTitle(session) {
281
- if (!session || typeof session !== 'object') return ''
282
- if (typeof session.title === 'string' && session.title.trim()) return session.title.trim()
283
- if (typeof session.first === 'string' && session.first.trim()) return session.first.trim().slice(0, 60)
284
- return shortId(session.sessionId) || '会话'
285
- }
286
-
287
294
  /** JSON call against the same-origin relay. */
288
295
  async function call(path, init) {
289
296
  const options = { cache: 'no-store', ...(init ?? {}) }
@@ -539,16 +546,24 @@ window.__ModuleLoader__.load({
539
546
  }
540
547
 
541
548
  function Header(props) {
542
- const { model, title, onNew, onRefresh } = props
549
+ const { model, railOpen, runningCount, onToggleRail, onNew, onRefresh } = props
550
+ const toggleLabel = railOpen ? '收起任务栏(Ctrl+Shift+B)' : '展开任务栏(Ctrl+Shift+B)'
543
551
  return h('header', { className: 'dsa-header' },
544
552
  h('div', { className: 'dsa-crumbs' },
545
- h('span', { className: 'dsa-crumb' }, PANEL_LABEL),
546
- h('span', { className: 'dsa-sep' }, '/'),
547
- h('span', { className: 'dsa-crumb dsa-crumb-current' }, title)),
553
+ h('span', { className: 'dsa-crumb dsa-crumb-current' }, PANEL_LABEL)),
548
554
  h('div', { className: 'dsa-head-actions' },
549
555
  h('span', { className: 'dsa-status' },
550
556
  h('span', { className: 'dsa-dot', 'data-state': model.conn }),
551
557
  model.conn === 'live' ? '已连接' : model.conn === 'warn' ? '流中断' : '连接中'),
558
+ tipped(toggleLabel, h('button', {
559
+ type: 'button',
560
+ className: 'dsa-iconbtn dsa-railtoggle',
561
+ 'aria-label': runningCount > 0 ? `${toggleLabel},${runningCount} 条任务线运行中` : toggleLabel,
562
+ 'aria-expanded': railOpen ? 'true' : 'false',
563
+ onClick: onToggleRail,
564
+ },
565
+ h(Icon, { of: 'panel' }),
566
+ runningCount > 0 ? h('span', { className: 'dsa-badge' }, runningCount > 9 ? '9+' : String(runningCount)) : null)),
552
567
  tipped('刷新', h('button', { type: 'button', className: 'dsa-iconbtn', onClick: onRefresh },
553
568
  h(Icon, { of: 'refresh' }))),
554
569
  tipped('新建会话', h('button', { type: 'button', className: 'dsa-iconbtn', onClick: onNew },
@@ -809,39 +824,31 @@ window.__ModuleLoader__.load({
809
824
  onClick: submit,
810
825
  }, h(Icon, { of: 'send', size: 15 })), 'top')))),
811
826
  h('div', { className: 'dsa-stats' },
812
- h('span', null, props.model.sessionId ? `会话 ${shortId(props.model.sessionId)}` : '还没有会话'),
813
- h('span', null, `${props.model.runs.length} 条任务线`)))
827
+ h('span', null, `${props.model.runs.length} 条调度会话`)))
814
828
  }
815
829
 
830
+ /**
831
+ * The superagent is the only conversation. This panel lists what it is
832
+ * orchestrating — the delegated sessions/task lines — never a chat history
833
+ * of the user's own conversations.
834
+ */
816
835
  function Rail(props) {
817
- const { model, onSwitch } = props
818
- return h('aside', { className: 'dsa-rail' },
819
- h('div', { className: 'dsa-rail-head' },
820
- h('span', null, '会话'),
821
- h('span', null, `${model.sessions.length}`)),
822
- h('div', { className: 'dsa-rail-list' },
823
- model.sessions.length === 0
824
- ? h('div', { className: 'dsa-hint', style: { padding: '8px' } }, model.sessionsReason || '还没有历史会话')
825
- : model.sessions.map(session => tipped(sessionTitle(session), h('button', {
826
- key: session.sessionId,
827
- type: 'button',
828
- className: 'dsa-rowitem',
829
- 'data-selected': session.sessionId === model.sessionId ? 'true' : 'false',
830
- onClick: () => onSwitch(session.sessionId),
831
- },
832
- h('span', { className: 'dsa-rowtitle' }, sessionTitle(session)),
833
- h('span', { className: 'dsa-rowtime' }, clockOf(session.updatedAt))), 'left', session.sessionId))),
836
+ const { model } = props
837
+ const runs = Array.isArray(model.runs) ? model.runs : []
838
+ const running = runs.filter(run => run.status === 'running').length
839
+ return h('aside', { className: 'dsa-rail', 'aria-label': '调度的会话' },
834
840
  h('div', { className: 'dsa-rail-head' },
835
- h('span', null, '任务线'),
836
- h('span', null, `${model.runs.length}`)),
841
+ h('span', null, '调度的会话'),
842
+ h('span', { className: 'dsa-rail-count' }, running > 0 ? `${running} 运行中` : `${runs.length}`)),
837
843
  h('div', { className: 'dsa-rail-list' },
838
- model.runs.length === 0
839
- ? h('div', { className: 'dsa-hint', style: { padding: '8px' } }, '这一轮还没有任务线')
840
- : model.runs.map(run => tipped(run.goal ?? '', h('div', {
844
+ runs.length === 0
845
+ ? h('div', { className: 'dsa-hint', style: { padding: '8px' } }, '超级智能体还没有调度新的会话')
846
+ : runs.map(run => tipped(run.goal ?? '', h('div', {
841
847
  key: run.id,
842
848
  className: 'dsa-rowitem',
843
849
  },
844
- h('span', { className: 'dsa-rowtitle' }, run.goal ?? '任务线'),
850
+ h('span', { className: 'dsa-rowdot', 'data-status': run.status }),
851
+ h('span', { className: 'dsa-rowtitle' }, run.goal ?? '调度中的会话'),
845
852
  h('span', { className: 'dsa-rowtime' }, run.status === 'running' ? '运行中' : run.status === 'completed' ? '完成' : '已停')), 'left', run.id))))
846
853
  }
847
854
 
@@ -860,6 +867,35 @@ window.__ModuleLoader__.load({
860
867
 
861
868
  function Seat(props) {
862
869
  const { model, dispatch } = props
870
+ // Hooks must run before the loading/error early returns.
871
+ const [railOpen, setRailOpen] = react.useState(readRailOpen)
872
+ const toggleRail = () => {
873
+ setRailOpen(current => {
874
+ const next = !current
875
+ saveRailOpen(next)
876
+ return next
877
+ })
878
+ }
879
+ react.useEffect(() => {
880
+ if (typeof window === 'undefined' || typeof window.addEventListener !== 'function') return undefined
881
+ const onKey = event => {
882
+ if ((event.ctrlKey || event.metaKey) && event.shiftKey && String(event.key).toLowerCase() === 'b') {
883
+ event.preventDefault()
884
+ setRailOpen(current => {
885
+ const next = !current
886
+ saveRailOpen(next)
887
+ return next
888
+ })
889
+ return
890
+ }
891
+ if (event.key === 'Escape' && railOpen) {
892
+ setRailOpen(false)
893
+ saveRailOpen(false)
894
+ }
895
+ }
896
+ window.addEventListener('keydown', onKey)
897
+ return () => window.removeEventListener('keydown', onKey)
898
+ }, [railOpen])
863
899
  if (model.phase === 'loading') {
864
900
  return h('div', { className: 'dsa-root' },
865
901
  h('div', { className: 'dsa-empty' },
@@ -876,21 +912,22 @@ window.__ModuleLoader__.load({
876
912
  onClick: () => dispatch({ type: 'retry' }),
877
913
  }, '重试')))
878
914
  }
879
- const title = (() => {
880
- const current = model.sessions.find(session => session.sessionId === model.sessionId)
881
- return current ? sessionTitle(current) : model.sessionId ? `会话 ${shortId(model.sessionId)}` : '新会话'
882
- })()
883
915
  const empty = model.messages.length === 0
916
+ const runningCount = Array.isArray(model.runs)
917
+ ? model.runs.filter(run => run.status === 'running').length
918
+ : 0
884
919
  const notify = text => dispatch({ type: 'toast', text })
885
- return h('div', { className: 'dsa-root' },
920
+ return h('div', { className: 'dsa-root', 'data-rail': railOpen ? 'open' : 'closed' },
886
921
  h(Header, {
887
922
  model,
888
- title,
923
+ railOpen,
924
+ runningCount,
925
+ onToggleRail: toggleRail,
889
926
  onNew: () => dispatch({ type: 'new-session' }),
890
927
  onRefresh: () => dispatch({ type: 'refresh' }),
891
928
  }),
892
929
  h(Toast, { toast: model.toast }),
893
- h('div', { className: 'dsa-body' },
930
+ h('div', { className: 'dsa-body', 'data-rail': railOpen ? 'open' : 'closed' },
894
931
  h('div', { className: 'dsa-main' },
895
932
  empty
896
933
  ? h(Hero, {
@@ -921,10 +958,7 @@ window.__ModuleLoader__.load({
921
958
  onMode: mode => dispatch({ type: 'mode', mode }),
922
959
  onError: notify,
923
960
  })),
924
- h(Rail, {
925
- model,
926
- onSwitch: sessionId => dispatch({ type: 'switch', sessionId }),
927
- })))
961
+ h(Rail, { model })))
928
962
  }
929
963
 
930
964
  /** One-line status above the composer; errors stay until replaced. */
@@ -1075,13 +1109,6 @@ window.__ModuleLoader__.load({
1075
1109
  throw error
1076
1110
  }
1077
1111
  },
1078
- switch: async action => {
1079
- const { sessionId } = action
1080
- if (!sessionId || sessionId === modelRef.current.sessionId) return
1081
- await call('/session/switch', { method: 'POST', body: JSON.stringify({ sessionId }) })
1082
- patch(current => ({ ...current, phase: 'loading', messages: [], approvals: [], currentId: null, typing: false }))
1083
- setAttempt(value => value + 1)
1084
- },
1085
1112
  'new-session': async () => {
1086
1113
  await call('/session', { method: 'POST', body: JSON.stringify({}) })
1087
1114
  patch(current => ({ ...current, phase: 'loading', messages: [], approvals: [], currentId: null, typing: false }))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiangyixie/dsh-superagent",
3
- "version": "0.16.3",
3
+ "version": "0.16.5",
4
4
  "description": "长周期自主执行插件:一个目标拆成可并行的子任务,交付一份合并报告,重启后仍可继续。",
5
5
  "author": "Admire (LittleChenLiya)",
6
6
  "type": "module",