@xiangyixie/dsh-superagent 0.17.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/CHANGELOG.md CHANGED
@@ -8,6 +8,40 @@ 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.18.0 — 2026-11-17
12
+
13
+ ### 变更
14
+
15
+ - **工具不再对每个会话常驻。** 8 个核心工具只在面板自己的会话里可见;
16
+ 普通宿主会话只保留 `superagent_help`,调用后按需展开。委派出去的 worker
17
+ 一个 `superagent_*` 工具都看不到,不会再套娃起 run。
18
+ - **定时计划如实说明归属。** 这个宿主没有给插件暴露调度 API,`superagent_schedule`
19
+ 现在会在返回里写明「计划在本插件自己的存储里,不会出现在宿主自动化列表」,
20
+ 不再让用户去错误的地方找。
21
+
22
+ ### 修复
23
+
24
+ - **守卫误杀 `node -e`。** 引号内的 `>`、`=>`、`^` 不再被当成重定向目标;
25
+ 单字符运算符也不会再被解析成 `C:\^` 这类盘符路径。真实重定向仍按原规则拦截。
26
+
27
+ ## 0.17.1 — 2026-11-17
28
+
29
+ ### 新增
30
+
31
+ - **待决策不再藏在任务详情里。** 有 run 在等你回答时,问题卡直接出现在输入框
32
+ 上方;计划确认以选项按钮呈现,点一下就答复。标题栏「会话」带未读数,新问题
33
+ 到达时 +1,打开会话或回答后归零。
34
+ - **停止键现在真的停任务。** 除了中断当前 turn,还会取消所有 `running` 的
35
+ run;单条任务仍可在详情里单独停止。
36
+ - **产物三件事都能做。** 预览、在文件夹中显示、下载;「在文件夹中显示」走
37
+ 服务端白名单校验后调用系统文件管理器,不会变成任意路径的打开器。
38
+
39
+ ### 变更
40
+
41
+ - **关闭或切走面板不再回答审批。** 待决审批会保留到自己的超时,重新打开面板
42
+ 仍能看到问题;只有超时才按 `cancelled` 收尾。此前最后一个事件流断开就会把
43
+ 所有待决审批判为取消。
44
+
11
45
  ## 0.17.0 — 2026-11-17
12
46
 
13
47
  ### 新增
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.17.0` → install.
39
+ Desktop: **Plugins** → **Add plugin** → enter `@xiangyixie/dsh-superagent@0.18.0` → install.
40
40
 
41
41
  CLI:
42
42
 
43
43
  ```bash
44
- dsh plugin --profile web add @xiangyixie/dsh-superagent@0.17.0
44
+ dsh plugin --profile web add @xiangyixie/dsh-superagent@0.18.0
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.17.0` 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.18.0` 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.17.0` → 安装。
39
+ 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.18.0` → 安装。
40
40
 
41
41
  命令行:
42
42
 
43
43
  ```bash
44
- dsh plugin --profile web add @xiangyixie/dsh-superagent@0.17.0
44
+ dsh plugin --profile web add @xiangyixie/dsh-superagent@0.18.0
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.17.0` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1093
+ | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.18.0` 重装,并在宿主日志里找 `[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.17.0` → 安装。
39
+ 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.18.0` → 安装。
40
40
 
41
41
  命令行:
42
42
 
43
43
  ```bash
44
- dsh plugin --profile web add @xiangyixie/dsh-superagent@0.17.0
44
+ dsh plugin --profile web add @xiangyixie/dsh-superagent@0.18.0
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.17.0` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1093
+ | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.18.0` 重装,并在宿主日志里找 `[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
@@ -167,7 +167,7 @@ window.__ModuleLoader__.load({
167
167
  .dsa-crumb-current{font-weight:500;color:var(--dsw-alias-label-primary,#f9fafb)}
168
168
  .dsa-sep{color:var(--dsw-alias-label-caption,rgb(129,133,140));font-size:14px;line-height:20px}
169
169
  .dsa-head-actions{display:flex;flex:none;align-items:center;gap:8px;margin-left:20px}
170
- .dsa-iconbtn{display:inline-flex;flex:none;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:0;border-radius:var(--dsw-radius-sm,8px);background:transparent;color:var(--dsw-alias-label-secondary,rgb(207,211,214));cursor:pointer}
170
+ .dsa-iconbtn{position:relative;display:inline-flex;flex:none;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:0;border-radius:var(--dsw-radius-sm,8px);background:transparent;color:var(--dsw-alias-label-secondary,rgb(207,211,214));cursor:pointer}
171
171
  .dsa-iconbtn svg{width:15px;height:15px}
172
172
  .dsa-iconbtn:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08))}
173
173
  .dsa-iconbtn:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-alias-state-business-primary,#7aaaff);outline-offset:-2px}
@@ -266,6 +266,15 @@ window.__ModuleLoader__.load({
266
266
  .dsa-answer-input{flex:1;min-width:0;box-sizing:border-box;padding:5px 8px;border:1px solid var(--dsw-alias-border-l3,rgba(255,255,255,.16));border-radius:var(--dsw-radius-sm,8px);background:transparent;color:var(--dsw-alias-label-primary,#f9fafb);font:inherit;font-size:12px;outline:none}
267
267
  .dsa-artifact-link{display:flex;align-items:center;gap:6px;width:100%;padding:5px 8px;border:0;border-radius:var(--dsw-radius-sm,8px);background:transparent;color:var(--dsw-alias-state-business-primary,#7aaaff);font:inherit;font-size:12px;text-align:left;cursor:pointer}
268
268
  .dsa-artifact-link:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08))}
269
+ .dsa-attention{display:flex;flex-direction:column;gap:8px;margin:8px 0}
270
+ .dsa-attention-card{display:flex;flex-direction:column;gap:8px;padding:12px 14px;border:1px solid var(--dsw-alias-state-warning-primary,rgba(255,193,64,.45));border-radius:var(--dsw-radius-lg,16px);background:var(--dsw-alias-bg-base,rgb(21,21,23))}
271
+ .dsa-attention-head{display:flex;align-items:center;gap:6px;font-size:12px;line-height:18px;color:var(--dsw-alias-state-warning-primary,#ffc140)}
272
+ .dsa-attention-dot{width:7px;height:7px;border-radius:50%;background:var(--dsw-alias-state-warning-primary,#ffc140)}
273
+ .dsa-attention-options{display:flex;flex-wrap:wrap;gap:6px}
274
+ .dsa-artifact-row{display:flex;align-items:center;gap:4px}
275
+ .dsa-artifact-row .dsa-artifact-link{flex:1;min-width:0;overflow:hidden}
276
+ .dsa-chip{padding:3px 10px;border:1px solid var(--dsw-alias-border-l3,rgba(255,255,255,.16));border-radius:999px;background:transparent;color:var(--dsw-alias-label-primary,#f9fafb);font:inherit;font-size:12px;line-height:18px;cursor:pointer}
277
+ .dsa-chip:hover{background:var(--dsw-alias-interactive-bg-hover,rgba(255,255,255,.08))}
269
278
  `
270
279
 
271
280
  /** Inject the sheet once; the panel is mounted once per window. */
@@ -349,6 +358,8 @@ window.__ModuleLoader__.load({
349
358
  answerDraft: '',
350
359
  uploadInsert: '',
351
360
  uploading: false,
361
+ unread: 0,
362
+ seenAttention: [],
352
363
  }
353
364
  }
354
365
 
@@ -562,7 +573,7 @@ window.__ModuleLoader__.load({
562
573
  const approval = frame.approval
563
574
  if (frame.action === 'asked' && approval?.id) {
564
575
  const others = model.approvals.filter(entry => entry.id !== approval.id)
565
- return { ...model, approvals: [...others, approval] }
576
+ return { ...model, approvals: [...others, approval], unread: (model.unread ?? 0) + 1 }
566
577
  }
567
578
  if (frame.id) {
568
579
  return { ...model, approvals: model.approvals.filter(entry => entry.id !== frame.id) }
@@ -572,7 +583,20 @@ window.__ModuleLoader__.load({
572
583
  case 'runs': {
573
584
  const runs = Array.isArray(frame.runs) ? frame.runs : []
574
585
  const detail = model.detail ? runs.find(run => run.id === model.detail.id) ?? model.detail : null
575
- return { ...model, runs, detail }
586
+ const seen = Array.isArray(model.seenAttention) ? model.seenAttention : []
587
+ const fresh = []
588
+ for (const run of runs) {
589
+ for (const item of Array.isArray(run.attention) ? run.attention : []) {
590
+ if (item?.id && !seen.includes(item.id) && !fresh.includes(item.id)) fresh.push(item.id)
591
+ }
592
+ }
593
+ return {
594
+ ...model,
595
+ runs,
596
+ detail,
597
+ unread: model.unread + fresh.length,
598
+ seenAttention: fresh.length > 0 ? [...seen, ...fresh].slice(-200) : seen,
599
+ }
576
600
  }
577
601
  case 'canceling':
578
602
  return { ...model, canceling: true }
@@ -582,19 +606,20 @@ window.__ModuleLoader__.load({
582
606
  }
583
607
 
584
608
  function Header(props) {
585
- const { railOpen, runningCount, onToggleRail, onToggleSessions, sessionsOpen } = props
609
+ const { railOpen, runningCount, onToggleRail, onToggleSessions, sessionsOpen, unread } = props
586
610
  const toggleLabel = railOpen ? '收起任务栏(Ctrl+Shift+B)' : '展开任务栏(Ctrl+Shift+B)'
587
611
  return h('header', { className: 'dsa-header' },
588
612
  h('div', { className: 'dsa-crumbs' },
589
613
  h('span', { className: 'dsa-crumb dsa-crumb-current' }, PANEL_LABEL)),
590
614
  h('div', { className: 'dsa-head-actions' },
591
- tipped('会话', h('button', {
615
+ tipped(unread > 0 ? `会话(${unread} 个新问题)` : '会话', h('button', {
592
616
  type: 'button',
593
617
  className: 'dsa-iconbtn',
594
618
  'aria-label': '会话',
595
619
  'aria-expanded': sessionsOpen ? 'true' : 'false',
596
620
  onClick: onToggleSessions,
597
- }, h(Icon, { of: 'clock' })), 'bottom'),
621
+ }, h(Icon, { of: 'clock' }),
622
+ unread > 0 ? h('span', { className: 'dsa-badge' }, unread > 9 ? '9+' : String(unread)) : null), 'bottom'),
598
623
  tipped(toggleLabel, h('button', {
599
624
  type: 'button',
600
625
  className: 'dsa-iconbtn dsa-railtoggle',
@@ -937,12 +962,22 @@ window.__ModuleLoader__.load({
937
962
  artifacts.length > 0
938
963
  ? h('div', { className: 'dsa-detail-sec' },
939
964
  h('div', { className: 'dsa-detail-label' }, '产物'),
940
- artifacts.map(item => h('button', {
941
- key: item.href,
942
- type: 'button',
943
- className: 'dsa-artifact-link',
944
- onClick: () => props.onArtifact?.(item),
945
- }, item.name)))
965
+ artifacts.map(item => h('div', { key: item.href, className: 'dsa-artifact-row' },
966
+ h('button', {
967
+ type: 'button',
968
+ className: 'dsa-artifact-link',
969
+ onClick: () => props.onArtifact?.(item),
970
+ }, item.name),
971
+ h('button', {
972
+ type: 'button',
973
+ className: 'dsa-linkbtn',
974
+ onClick: () => props.onReveal?.(item),
975
+ }, '在文件夹中显示'),
976
+ h('button', {
977
+ type: 'button',
978
+ className: 'dsa-linkbtn',
979
+ onClick: () => props.onDownload?.(item),
980
+ }, '下载'))))
946
981
  : h('div', { className: 'dsa-detail-sec' },
947
982
  h('div', { className: 'dsa-detail-label' }, '产物'),
948
983
  h('div', { className: 'dsa-hint' }, '这条任务还没有报告产物')),
@@ -953,6 +988,61 @@ window.__ModuleLoader__.load({
953
988
  : null))
954
989
  }
955
990
 
991
+ /**
992
+ * Questions that block a run, shown where the user is already typing.
993
+ * A plan confirmation is the same shape with options, so it renders as
994
+ * one-tap chips instead of a yes/no dialog of its own.
995
+ */
996
+ function AttentionCards(props) {
997
+ const { model } = props
998
+ const entries = []
999
+ for (const run of Array.isArray(model.runs) ? model.runs : []) {
1000
+ for (const item of Array.isArray(run.attention) ? run.attention : []) {
1001
+ if (item?.id) entries.push({ run, item })
1002
+ }
1003
+ }
1004
+ if (entries.length === 0) return null
1005
+ return h('div', { className: 'dsa-attention' },
1006
+ entries.map(({ run, item }) => {
1007
+ const options = Array.isArray(item.options) ? item.options : []
1008
+ return h('div', { key: `${run.id}:${item.id}`, className: 'dsa-attention-card' },
1009
+ h('div', { className: 'dsa-attention-head' },
1010
+ h('span', { className: 'dsa-attention-dot' }),
1011
+ h('span', null, item.source === 'plan' ? '计划确认' : '等你决定'),
1012
+ h('span', { className: 'dsa-session-meta' }, run.goal ?? '')),
1013
+ h('div', { className: 'dsa-detail-q' }, item.question ?? '有一个问题需要你回答'),
1014
+ item.reason ? h('div', { className: 'dsa-detail-label' }, item.reason) : null,
1015
+ h('div', { className: 'dsa-answer-row' },
1016
+ h('input', {
1017
+ className: 'dsa-answer-input',
1018
+ value: model.answerDraft,
1019
+ placeholder: options.length > 0 ? '或者直接写别的回答' : '写下你的回答',
1020
+ onInput: event => props.onDraft?.(event.target.value),
1021
+ onKeyDown: event => {
1022
+ if (event.key === 'Enter' && !event.nativeEvent?.isComposing) {
1023
+ event.preventDefault()
1024
+ props.onAnswer?.(run.id, item.id, model.answerDraft)
1025
+ }
1026
+ },
1027
+ }),
1028
+ h(Button ?? 'button', {
1029
+ variant: Button ? 'primary' : undefined,
1030
+ type: Button ? undefined : 'button',
1031
+ disabled: !String(model.answerDraft ?? '').trim(),
1032
+ onClick: () => props.onAnswer?.(run.id, item.id, model.answerDraft),
1033
+ }, '回答')),
1034
+ options.length > 0
1035
+ ? h('div', { className: 'dsa-attention-options' },
1036
+ options.map(option => h('button', {
1037
+ key: option,
1038
+ type: 'button',
1039
+ className: 'dsa-chip',
1040
+ onClick: () => props.onAnswer?.(run.id, item.id, option),
1041
+ }, option)))
1042
+ : null)
1043
+ }))
1044
+ }
1045
+
956
1046
  function Hero(props) {
957
1047
  const ready = props.model.capabilities?.chat !== false
958
1048
  return h('div', { className: 'dsa-hero' },
@@ -1021,6 +1111,7 @@ window.__ModuleLoader__.load({
1021
1111
  h(Header, {
1022
1112
  railOpen,
1023
1113
  runningCount,
1114
+ unread: model.unread ?? 0,
1024
1115
  sessionsOpen: model.sessionsOpen === true,
1025
1116
  onToggleRail: toggleRail,
1026
1117
  onToggleSessions: () => dispatch({ type: 'sessions' }),
@@ -1053,6 +1144,11 @@ window.__ModuleLoader__.load({
1053
1144
  busy: model.approvalBusy,
1054
1145
  onDecide: (id, decision) => dispatch({ type: 'decide', id, decision }),
1055
1146
  }),
1147
+ h(AttentionCards, {
1148
+ model,
1149
+ onDraft: value => dispatch({ type: 'draft', value }),
1150
+ onAnswer: (runId, attentionId, answer) => dispatch({ type: 'answer', runId, attentionId, answer }),
1151
+ }),
1056
1152
  empty ? null : h(Composer, {
1057
1153
  model,
1058
1154
  disabled: model.sending || model.capabilities?.chat === false,
@@ -1072,6 +1168,8 @@ window.__ModuleLoader__.load({
1072
1168
  onDraft: value => dispatch({ type: 'draft', value }),
1073
1169
  onAnswer: (runId, attentionId, answer) => dispatch({ type: 'answer', runId, attentionId, answer }),
1074
1170
  onArtifact: item => dispatch({ type: 'artifact', item }),
1171
+ onReveal: item => dispatch({ type: 'revealArtifact', item }),
1172
+ onDownload: item => dispatch({ type: 'downloadArtifact', item }),
1075
1173
  })),
1076
1174
  h(Rail, { model, onOpen: runId => dispatch({ type: 'openRun', runId }) })))
1077
1175
  }
@@ -1200,12 +1298,16 @@ window.__ModuleLoader__.load({
1200
1298
  },
1201
1299
  cancel: async () => {
1202
1300
  patch(current => ({ ...current, canceling: true }))
1203
- try {
1204
- await call('/cancel', { method: 'POST', body: JSON.stringify({ sessionId: modelRef.current.sessionId }) })
1205
- } catch (error) {
1301
+ const running = (modelRef.current.runs ?? []).filter(run => run.status === 'running')
1302
+ const settled = await Promise.allSettled([
1303
+ call('/cancel', { method: 'POST', body: JSON.stringify({ sessionId: modelRef.current.sessionId }) }),
1304
+ ...running.map(run => call(`/runs/${encodeURIComponent(run.id)}/cancel`, { method: 'POST' })),
1305
+ ])
1306
+ if (settled.every(item => item.status === 'rejected')) {
1206
1307
  patch(current => ({ ...current, canceling: false }))
1207
- throw error
1308
+ throw settled[0].reason
1208
1309
  }
1310
+ patch(current => ({ ...current, canceling: false }))
1209
1311
  },
1210
1312
  sessions: async action => {
1211
1313
  const open = typeof action.open === 'boolean' ? action.open : modelRef.current.sessionsOpen !== true
@@ -1214,6 +1316,9 @@ window.__ModuleLoader__.load({
1214
1316
  return
1215
1317
  }
1216
1318
  patch(current => ({ ...current, sessionsOpen: true, sessionsBusy: true }))
1319
+ call('/notices/read', { method: 'POST', body: '{}' })
1320
+ .then(() => patch(current => ({ ...current, unread: 0 })))
1321
+ .catch(() => {})
1217
1322
  try {
1218
1323
  const data = await call('/sessions')
1219
1324
  patch(current => ({
@@ -1277,6 +1382,7 @@ window.__ModuleLoader__.load({
1277
1382
  patch(current => ({
1278
1383
  ...current,
1279
1384
  answerDraft: '',
1385
+ unread: Math.max(0, (current.unread ?? 0) - 1),
1280
1386
  detail: current.detail && current.detail.id === action.runId
1281
1387
  ? {
1282
1388
  ...current.detail,
@@ -1290,6 +1396,17 @@ window.__ModuleLoader__.load({
1290
1396
  const url = `${API}/artifact?path=${encodeURIComponent(item.href ?? '')}&runId=${encodeURIComponent(item.runId ?? '')}`
1291
1397
  if (typeof window !== 'undefined' && typeof window.open === 'function') window.open(url, '_blank', 'noopener')
1292
1398
  },
1399
+ revealArtifact: async action => {
1400
+ const item = action.item ?? {}
1401
+ const query = `?path=${encodeURIComponent(item.href ?? '')}&runId=${encodeURIComponent(item.runId ?? '')}`
1402
+ await call(`/artifact/reveal${query}`, { method: 'POST', body: '{}' })
1403
+ },
1404
+ downloadArtifact: action => {
1405
+ const item = action.item ?? {}
1406
+ const url = `${API}/artifact?download=1&path=${encodeURIComponent(item.href ?? '')}`
1407
+ + `&runId=${encodeURIComponent(item.runId ?? '')}`
1408
+ if (typeof window !== 'undefined' && typeof window.open === 'function') window.open(url, '_blank', 'noopener')
1409
+ },
1293
1410
  upload: async action => {
1294
1411
  const file = action.file ?? {}
1295
1412
  if (file.error) throw new Error(file.error)
package/lib/console.js CHANGED
@@ -10,6 +10,7 @@
10
10
  * @module dsh-superagent/console
11
11
  */
12
12
  import { randomBytes } from 'node:crypto'
13
+ import { spawn } from 'node:child_process'
13
14
  import { readFileSync } from 'node:fs'
14
15
  import fsp from 'node:fs/promises'
15
16
  import { createServer, request } from 'node:http'
@@ -713,6 +714,7 @@ export function createConsole({
713
714
  if (typeof sessionId !== 'string' || !sessionId) {
714
715
  throw new WorkbenchError(502, 'the host created a session but returned no id', { id: 'session-create-failed' })
715
716
  }
717
+ markPanel(sessionId)
716
718
  if (currentSessionId !== sessionId) {
717
719
  sessionAllowedTools.clear()
718
720
  detach()
@@ -759,6 +761,7 @@ export function createConsole({
759
761
  }
760
762
  currentSessionId = target.sessionId
761
763
  rememberedSessionId = target.sessionId
764
+ markPanel(target.sessionId)
762
765
  sessionAllowedTools.clear()
763
766
  detach()
764
767
  resetStore(target.sessionId)
@@ -770,10 +773,22 @@ export function createConsole({
770
773
  }
771
774
 
772
775
  async function ensureSession() {
773
- if (currentSessionId) return { sessionId: currentSessionId, capabilities: capabilities() }
776
+ if (currentSessionId) {
777
+ markPanel(currentSessionId)
778
+ return { sessionId: currentSessionId, capabilities: capabilities() }
779
+ }
774
780
  return createSession()
775
781
  }
776
782
 
783
+ /** Tell the node half this session is driven from the panel, so its core tools stay on. */
784
+ function markPanel(sessionId) {
785
+ try {
786
+ host.markPanelSession?.(sessionId)
787
+ } catch {
788
+ // A host without the hook just keeps the previous tool list.
789
+ }
790
+ }
791
+
777
792
  async function state() {
778
793
  const caps = capabilities()
779
794
  return {
@@ -873,14 +888,11 @@ export function createConsole({
873
888
  clients.delete(res)
874
889
  // With nobody watching there is no reason to keep the follow loop alive.
875
890
  // The transcript stays cached so a reconnect can rebuild the page.
876
- if (clients.size === 0) {
877
- detach()
878
- // A decision can no longer arrive: settle every pending question
879
- // cancelled now instead of leaving the tool call parked until the
880
- // ten-minute deadline. Cancellation is the fail-closed outcome, so a
881
- // closed page or a dropped stream never approves anything.
882
- for (const entry of [...approvals.values()]) entry.settle('cancelled')
883
- }
891
+ // Pending approvals deliberately survive this: closing or switching the
892
+ // panel must not answer them. They stay parked for the tool call and
893
+ // expire on their own deadline, so reopening the page still shows the
894
+ // question instead of a call that failed behind the user's back.
895
+ if (clients.size === 0) detach()
884
896
  }
885
897
  req.on('close', cleanup)
886
898
  res.on('close', cleanup)
@@ -896,6 +908,42 @@ export function createConsole({
896
908
  * @param {import('node:http').ServerResponse} res - response sink.
897
909
  */
898
910
  async function serveArtifact(parsed, res) {
911
+ const { target } = await listedArtifact(parsed)
912
+ const download = parsed.searchParams.get('download') === '1'
913
+ const type = ARTIFACT_TYPES.get(path.extname(target).toLowerCase())
914
+ if (!type && !download) {
915
+ throw new WorkbenchError(415, 'this file type is not previewable in the console', { id: 'artifact-type' })
916
+ }
917
+ let stat
918
+ try {
919
+ stat = await fsp.stat(target)
920
+ } catch {
921
+ throw new WorkbenchError(404, 'the run named this file but it is no longer on disk', { id: 'artifact-missing' })
922
+ }
923
+ if (!stat.isFile()) throw new WorkbenchError(404, 'that path is not a file', { id: 'artifact-not-file' })
924
+ if (stat.size > MAX_ARTIFACT_BYTES && !download) {
925
+ throw new WorkbenchError(413, `the file is above the ${MAX_ARTIFACT_BYTES}-byte preview limit`, {
926
+ id: 'artifact-too-large',
927
+ })
928
+ }
929
+ const body = await fsp.readFile(target)
930
+ const name = path.basename(target).replace(/["\\]/g, '_')
931
+ const headers = {
932
+ 'content-disposition': `${download ? 'attachment' : 'inline'}; filename="${name}"`,
933
+ }
934
+ if (type?.startsWith('text/html') && !download) headers['content-security-policy'] = ARTIFACT_PAGE_CSP
935
+ sendText(res, 200, body, download ? 'application/octet-stream' : type, headers)
936
+ }
937
+
938
+ /**
939
+ * Resolve an artifact path against the run reports that name it. Reports are
940
+ * the allowlist: a console client cannot ask for an arbitrary file, only one
941
+ * the agent already wrote about.
942
+ *
943
+ * @param {URL} parsed - request URL carrying `path` and optionally `runId`.
944
+ * @returns {Promise<{raw: string, target: string}>} resolved file.
945
+ */
946
+ async function listedArtifact(parsed) {
899
947
  const sessionId = currentSessionId
900
948
  if (!sessionId) throw new WorkbenchError(409, 'there is no conversation yet', { id: 'no-session' })
901
949
  const raw = (parsed.searchParams.get('path') || '').trim()
@@ -920,28 +968,24 @@ export function createConsole({
920
968
  hint: 'only files a run reported can be previewed here; copy the path and open it in your editor instead.',
921
969
  })
922
970
  }
923
- const type = ARTIFACT_TYPES.get(path.extname(target).toLowerCase())
924
- if (!type) {
925
- throw new WorkbenchError(415, 'this file type is not previewable in the console', { id: 'artifact-type' })
926
- }
927
- let stat
928
- try {
929
- stat = await fsp.stat(target)
930
- } catch {
931
- throw new WorkbenchError(404, 'the run named this file but it is no longer on disk', { id: 'artifact-missing' })
932
- }
933
- if (!stat.isFile()) throw new WorkbenchError(404, 'that path is not a file', { id: 'artifact-not-file' })
934
- if (stat.size > MAX_ARTIFACT_BYTES) {
935
- throw new WorkbenchError(413, `the file is above the ${MAX_ARTIFACT_BYTES}-byte preview limit`, {
936
- id: 'artifact-too-large',
937
- })
938
- }
939
- const body = await fsp.readFile(target)
940
- const headers = {
941
- 'content-disposition': `inline; filename="${path.basename(target).replace(/["\\]/g, '_')}"`,
971
+ return { raw, target }
972
+ }
973
+
974
+ /**
975
+ * Show one artifact in the platform file manager. The same report allowlist
976
+ * applies, so this cannot be used as an arbitrary "open anything" oracle.
977
+ *
978
+ * @param {string} target - absolute file path already vetted by listedArtifact.
979
+ */
980
+ function revealInFolder(target) {
981
+ if (process.platform === 'win32') {
982
+ const child = spawn('explorer.exe', ['/select,', target], { detached: true, stdio: 'ignore' })
983
+ child.unref()
984
+ return
942
985
  }
943
- if (type.startsWith('text/html')) headers['content-security-policy'] = ARTIFACT_PAGE_CSP
944
- sendText(res, 200, body, type, headers)
986
+ const command = process.platform === 'darwin' ? ['open', ['-R', target]] : ['xdg-open', [path.dirname(target)]]
987
+ const child = spawn(command[0], command[1], { detached: true, stdio: 'ignore' })
988
+ child.unref()
945
989
  }
946
990
 
947
991
  /**
@@ -1123,6 +1167,14 @@ export function createConsole({
1123
1167
  }
1124
1168
  const leaf = parts[2] ?? ''
1125
1169
 
1170
+ if (leaf === 'artifact' && parts.length === 4 && parts[3] === 'reveal') {
1171
+ if (method !== 'POST') throw new WorkbenchError(405, 'only POST is allowed here', { id: 'method-not-allowed' })
1172
+ const { target } = await listedArtifact(parsed)
1173
+ revealInFolder(target)
1174
+ send(res, 200, { ok: true, data: { revealed: true, path: target } })
1175
+ return
1176
+ }
1177
+
1126
1178
  if (leaf === 'health' && parts.length === 3) {
1127
1179
  if (method !== 'GET') throw new WorkbenchError(405, 'only GET is allowed here', { id: 'method-not-allowed' })
1128
1180
  const caps = capabilities()
package/lib/doctor.js CHANGED
@@ -123,7 +123,9 @@ export function scanRelativeImports(source) {
123
123
  */
124
124
  export function readRegisteredTools(source) {
125
125
  const names = []
126
- for (const chunk of String(source).split('ctx.tools.register(').slice(1)) {
126
+ // Tools may be registered directly or through the local `registerTool`
127
+ // wrapper that applies the panel/worker gate; both count as registrations.
128
+ for (const chunk of String(source).split(/ctx\.tools\.register\(|registerTool\(/).slice(1)) {
127
129
  const match = /name:\s*['"]([^'"]+)['"]/.exec(chunk)
128
130
  if (match) names.push(match[1])
129
131
  }
package/lib/guard.js CHANGED
@@ -192,6 +192,10 @@ function resolveTarget(raw, { cwd, platform, homedir, env }) {
192
192
  value = value.slice(1, -1).trim()
193
193
  }
194
194
  if (!value || value === '-' || /^(nul|\/dev\/null)$/i.test(value)) return null
195
+ // A lone shell operator (`^`, `&`, `=`, `>`) is not a path. Raw command
196
+ // scanning can surface one when PowerShell or a quoted script body contains
197
+ // it; resolving that against cwd used to produce a bogus `C:\^` target.
198
+ if (/^[^\w./\\~:$@%+()[\]{}'-]+$/.test(value)) return null
195
199
  if (/^[a-z][a-z0-9+.-]*:\/\//i.test(value)) return null
196
200
  value = expandPath(value, { platform, homedir, env })
197
201
  // An unresolved variable is not a literal path. Treating it as one would
@@ -327,12 +331,60 @@ function destructiveTargetVerdict(policy, target, context) {
327
331
  return null
328
332
  }
329
333
 
330
- /** Split a command line into independently evaluated segments. */
334
+ /** Split a command line into independently evaluated segments, ignoring operators inside quotes. */
331
335
  function segmentsOf(command) {
332
- return command
333
- .split(/\r?\n|&&|\|\||;|\|/)
334
- .map(segment => segment.trim())
335
- .filter(Boolean)
336
+ const segments = []
337
+ let current = ''
338
+ let quote = null
339
+ for (let index = 0; index < command.length; index += 1) {
340
+ const char = command[index]
341
+ if (quote) {
342
+ current += char
343
+ if (char === quote && command[index - 1] !== '\\') quote = null
344
+ continue
345
+ }
346
+ if (char === '"' || char === "'") {
347
+ quote = char
348
+ current += char
349
+ continue
350
+ }
351
+ const pair = command.slice(index, index + 2)
352
+ if (pair === '&&' || pair === '||') {
353
+ segments.push(current)
354
+ current = ''
355
+ index += 1
356
+ continue
357
+ }
358
+ if (char === ';' || char === '|' || char === '\n' || char === '\r') {
359
+ segments.push(current)
360
+ current = ''
361
+ continue
362
+ }
363
+ current += char
364
+ }
365
+ segments.push(current)
366
+ return segments.map(segment => segment.trim()).filter(Boolean)
367
+ }
368
+
369
+ /** Character ranges that sit inside a single- or double-quoted run. */
370
+ function quotedRanges(text) {
371
+ const ranges = []
372
+ let quote = null
373
+ let start = 0
374
+ for (let index = 0; index < text.length; index += 1) {
375
+ const char = text[index]
376
+ if (quote) {
377
+ if (char === quote && text[index - 1] !== '\\') {
378
+ ranges.push([start, index + 1])
379
+ quote = null
380
+ }
381
+ } else if (char === '"' || char === "'") {
382
+ quote = char
383
+ start = index
384
+ }
385
+ }
386
+ if (quote) ranges.push([start, text.length])
387
+ return ranges
336
388
  }
337
389
 
338
390
  /** Tokenize one segment, keeping quoted strings as one token. */
@@ -359,9 +411,15 @@ function writeTargetsOf(segment, platform) {
359
411
  const push = value => {
360
412
  if (value && !isFlagToken(value, platform)) targets.push(value)
361
413
  }
362
- // `> path`, `>> path`, but not `2>&1`.
363
- for (const match of segment.matchAll(/(?:^|[^0-9&])>>?\s*(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))/g)) {
364
- push(match[1] ?? match[2] ?? match[3])
414
+ // `> path`, `>> path`, but not `2>&1`, and never a `>` that lives inside a
415
+ // quoted script body such as `node -e "const f = a => a + 1"`.
416
+ const quoted = quotedRanges(segment)
417
+ const insideQuotes = index => quoted.some(([start, end]) => index >= start && index < end)
418
+ for (let index = 0; index < segment.length; index += 1) {
419
+ if (segment[index] !== '>' || insideQuotes(index)) continue
420
+ if (segment[index - 1] === '&') continue
421
+ const match = /^>>?\s*(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))/.exec(segment.slice(index))
422
+ if (match) push(match[1] ?? match[2] ?? match[3])
365
423
  }
366
424
  for (const match of segment.matchAll(/\btee\s+(?:-a\s+)?(?:"([^"]+)"|'([^']+)'|([^\s;&|]+))/gi)) {
367
425
  push(match[1] ?? match[2] ?? match[3])
package/lib/index.js CHANGED
@@ -1306,6 +1306,36 @@ export function apply(ctx, config) {
1306
1306
  // declarations and dispatch.
1307
1307
  const EXTRA_TOOLS = { when: context => isExpanded(context?.agent) }
1308
1308
 
1309
+ // Delegated workers must not see the superagent surface at all: a worker that
1310
+ // could start another run would nest schedulers and double the token spend.
1311
+ const isWorker = agent => {
1312
+ const header = agent?.session?.header
1313
+ return (header?.delegationDepth ?? 0) > 0 || header?.origin === 'subagent'
1314
+ }
1315
+ // Sessions opened through the console are the user's own space, so the eight
1316
+ // core tools stay visible there. A plain host conversation sees only
1317
+ // `superagent_help`, which expands the rest on demand.
1318
+ const panelSessions = new Set()
1319
+ const isPanelSession = agent => {
1320
+ const header = agent?.session?.header
1321
+ return panelSessions.has(agent?.id)
1322
+ || (header?.id ? panelSessions.has(header.id) : false)
1323
+ || (header?.sessionId ? panelSessions.has(header.sessionId) : false)
1324
+ }
1325
+ const residentGate = definition => {
1326
+ const name = typeof definition?.name === 'string' ? definition.name : ''
1327
+ if (!name.startsWith('superagent_')) return undefined
1328
+ if (name === 'superagent_help') return { when: context => !isWorker(context?.agent) }
1329
+ return {
1330
+ when: context => !isWorker(context?.agent)
1331
+ && (isPanelSession(context?.agent) || isExpanded(context?.agent)),
1332
+ }
1333
+ }
1334
+ const registerTool = (definition, options) => ctx.tools.register(
1335
+ definition,
1336
+ options ?? residentGate(definition),
1337
+ )
1338
+
1309
1339
  // Runtime control is opt-in. With `runtime.enabled` false nothing below is
1310
1340
  // registered, which is why a profile that never asked for browser or desktop
1311
1341
  // access sees exactly the same tool list as before this layer existed.
@@ -1316,7 +1346,7 @@ export function apply(ctx, config) {
1316
1346
  warn: log,
1317
1347
  })
1318
1348
  if (runtime.tools.length > 0) {
1319
- for (const spec of runtime.tools) ctx.tools.register(defineTool(spec))
1349
+ for (const spec of runtime.tools) registerTool(defineTool(spec))
1320
1350
  log(
1321
1351
  `runtime control: ${runtime.tools.length} tool(s) registered; stop switch ${runtime.stopFile}; `
1322
1352
  + `screenshots ${runtime.shotDir}`,
@@ -1817,6 +1847,11 @@ export function apply(ctx, config) {
1817
1847
  return null
1818
1848
  }
1819
1849
 
1850
+ // This host build does not expose a scheduling API on the plugin context,
1851
+ // so plans stay in the plugin store. The tool reports that instead of
1852
+ // letting the user look for them in the host's automation list.
1853
+ const hostScheduleVisible = typeof ctx.schedule === 'function'
1854
+
1820
1855
  const scheduler = createScheduler({
1821
1856
  stateFile: path.join(store.root, 'schedules.json'),
1822
1857
  orchestrator: {
@@ -2025,7 +2060,7 @@ export function apply(ctx, config) {
2025
2060
  return agent
2026
2061
  }
2027
2062
 
2028
- ctx.tools.register(defineTool({
2063
+ registerTool(defineTool({
2029
2064
  name: 'superagent_start',
2030
2065
  description:
2031
2066
  'Start an autonomous run: a planner splits the goal into subtasks, independent ones run in parallel, and their '
@@ -2151,7 +2186,7 @@ export function apply(ctx, config) {
2151
2186
  },
2152
2187
  }))
2153
2188
 
2154
- ctx.tools.register(defineTool({
2189
+ registerTool(defineTool({
2155
2190
  name: 'superagent_goal',
2156
2191
  description:
2157
2192
  'Run a long-term goal as ordered phases: each phase is its own run with planner and parallel workers, and later '
@@ -2371,7 +2406,7 @@ export function apply(ctx, config) {
2371
2406
  return ''
2372
2407
  }
2373
2408
 
2374
- ctx.tools.register(defineTool({
2409
+ registerTool(defineTool({
2375
2410
  name: 'superagent_status',
2376
2411
  description:
2377
2412
  'Read one run: status, subtask outcomes, measured token usage, and the final report. wait_seconds blocks for a '
@@ -2394,7 +2429,7 @@ export function apply(ctx, config) {
2394
2429
  },
2395
2430
  }))
2396
2431
 
2397
- ctx.tools.register(defineTool({
2432
+ registerTool(defineTool({
2398
2433
  name: 'superagent_list',
2399
2434
  description: 'List recorded runs, newest first, with status and progress.',
2400
2435
  properties: {
@@ -2434,7 +2469,7 @@ export function apply(ctx, config) {
2434
2469
  // Every declaration is paid for on every request, so the capabilities most
2435
2470
  // sessions never touch are registered behind a per-session activation
2436
2471
  // condition: `superagent_help` names them and turns them on for that session.
2437
- ctx.tools.register(defineTool({
2472
+ registerTool(defineTool({
2438
2473
  name: 'superagent_help',
2439
2474
  description:
2440
2475
  'Show the extra superagent tools and when each applies: long-term goals, cron schedules, live steering, '
@@ -2461,7 +2496,7 @@ export function apply(ctx, config) {
2461
2496
  },
2462
2497
  }))
2463
2498
 
2464
- ctx.tools.register(defineTool({
2499
+ registerTool(defineTool({
2465
2500
  name: 'superagent_cancel',
2466
2501
  description:
2467
2502
  'Cancel a run: stops its subtasks and marks it cancelled; the state file stays inspectable.',
@@ -2489,7 +2524,7 @@ export function apply(ctx, config) {
2489
2524
  },
2490
2525
  }))
2491
2526
 
2492
- ctx.tools.register(defineTool({
2527
+ registerTool(defineTool({
2493
2528
  name: 'superagent_resume',
2494
2529
  description:
2495
2530
  'Resume an interrupted, timed-out, or failed run: completed subtasks are kept, pending and failed ones run '
@@ -2534,7 +2569,7 @@ export function apply(ctx, config) {
2534
2569
  },
2535
2570
  }))
2536
2571
 
2537
- ctx.tools.register(defineTool({
2572
+ registerTool(defineTool({
2538
2573
  name: 'superagent_followup',
2539
2574
  description:
2540
2575
  'Add an instruction to a run that is already executing instead of starting a second one. It is queued and '
@@ -2568,7 +2603,7 @@ export function apply(ctx, config) {
2568
2603
  },
2569
2604
  }))
2570
2605
 
2571
- ctx.tools.register(defineTool({
2606
+ registerTool(defineTool({
2572
2607
  name: 'superagent_inject',
2573
2608
  description:
2574
2609
  'Deliver an instruction into the workers running right now: it becomes part of each child\'s next model request, '
@@ -2606,7 +2641,7 @@ export function apply(ctx, config) {
2606
2641
  },
2607
2642
  }), EXTRA_TOOLS)
2608
2643
 
2609
- ctx.tools.register(defineTool({
2644
+ registerTool(defineTool({
2610
2645
  name: 'superagent_answer',
2611
2646
  description:
2612
2647
  'Answer the question a run asked (the qN item in superagent_status), so that run continues instead of a new one '
@@ -2651,7 +2686,7 @@ export function apply(ctx, config) {
2651
2686
  },
2652
2687
  }))
2653
2688
 
2654
- ctx.tools.register(defineTool({
2689
+ registerTool(defineTool({
2655
2690
  name: 'superagent_memory',
2656
2691
  description:
2657
2692
  'Read or correct the cross-run notebook: short notes earlier runs left for the next one, or (layer="user") '
@@ -2883,7 +2918,7 @@ export function apply(ctx, config) {
2883
2918
  return [`[error] ${error.message}`, `hint: ${hint}`].join('\n')
2884
2919
  }
2885
2920
 
2886
- ctx.tools.register(defineTool({
2921
+ registerTool(defineTool({
2887
2922
  name: 'superagent_template',
2888
2923
  description:
2889
2924
  'List, show, expand, save, or delete a workflow template: a fixed goal skeleton with required parameters. '
@@ -2967,7 +3002,7 @@ export function apply(ctx, config) {
2967
3002
  },
2968
3003
  }), EXTRA_TOOLS)
2969
3004
 
2970
- ctx.tools.register(defineTool({
3005
+ registerTool(defineTool({
2971
3006
  name: 'superagent_schedule',
2972
3007
  description:
2973
3008
  'Create and manage scheduled runs that start on a cron expression or fixed interval without anyone calling '
@@ -3119,8 +3154,13 @@ export function apply(ctx, config) {
3119
3154
  + 'restart. The plan is marked as requiring a resident session; it will not silently pause, but it '
3120
3155
  + 'will not run while that session is closed.'
3121
3156
  : ''
3157
+ const hostNotice = hostScheduleVisible
3158
+ ? ''
3159
+ : '\n\nnote: this host build exposes no scheduling API to plugins, so the plan lives in this '
3160
+ + "plugin's own store and will not appear under the host's automation list. It still fires "
3161
+ + `every ${cfg.schedulerTickSeconds}s while the app is running.`
3122
3162
  return `created schedule ${plan.id}. The timer is armed from now on; no further tool call is needed.\n\n`
3123
- + formatSchedule(plan) + warning
3163
+ + formatSchedule(plan) + warning + hostNotice
3124
3164
  }
3125
3165
  if (action === 'list') {
3126
3166
  const plans = await scheduler.list()
@@ -3159,7 +3199,7 @@ export function apply(ctx, config) {
3159
3199
  // unasked. When it is on, every request goes through the same orchestrator as
3160
3200
  // the tools, so quota, budgets, ownership, and cancel behave identically.
3161
3201
  if (auditor) {
3162
- ctx.tools.register(defineTool({
3202
+ registerTool(defineTool({
3163
3203
  name: 'superagent_audit',
3164
3204
  description:
3165
3205
  'Query the append-only audit trail (tool calls, path writes, commands, blocks, approvals, decisions, run '
@@ -3718,6 +3758,15 @@ export function apply(ctx, config) {
3718
3758
  return wizard.trial()
3719
3759
  },
3720
3760
 
3761
+ /**
3762
+ * Remember that a session is driven from the superagent panel, so the
3763
+ * eight core tools stay in its tool list. A plain host conversation is
3764
+ * not marked and keeps only `superagent_help`.
3765
+ */
3766
+ markPanelSession(sessionId) {
3767
+ if (typeof sessionId === 'string' && sessionId) panelSessions.add(sessionId)
3768
+ },
3769
+
3721
3770
  async createSession() {
3722
3771
  const caps = consoleCapabilities()
3723
3772
  if (!caps.chat) throw new Error(caps.reason)
@@ -3738,6 +3787,7 @@ export function apply(ctx, config) {
3738
3787
  if (!created || typeof created.sessionId !== 'string' || !created.sessionId) {
3739
3788
  throw new Error('sessionController.create returned no sessionId')
3740
3789
  }
3790
+ panelSessions.add(created.sessionId)
3741
3791
  return { sessionId: created.sessionId, preset: created.preset ?? cfg.consolePreset ?? null }
3742
3792
  },
3743
3793
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiangyixie/dsh-superagent",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "长周期自主执行插件:一个目标拆成可并行的子任务,交付一份合并报告,重启后仍可继续。",
5
5
  "author": "Admire (LittleChenLiya)",
6
6
  "type": "module",