@xiangyixie/dsh-superagent 0.15.1 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,16 @@ 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.15.2 — 2026-11-17
12
+
13
+ ### 变化
14
+
15
+ - **桌面端点开「超级智能体」不再白屏。** 控制台页面原先只允许本地 http 页面把它嵌进
16
+ 主面板,而桌面端的界面跑在自己的 `dsh-app://` 地址上,浏览器按页面声明的安全策略
17
+ 拒绝渲染,右侧就只剩一片白。现在页面按「谁在嵌入我」放行:本地回环地址照旧,桌面端
18
+ 这种非 http(s) 的自定义地址由界面把自己的地址告诉页面,以后换 scheme 也不用再改
19
+ 插件。网络上的站点仍然嵌不进来,token 仍是唯一入口。
20
+
11
21
  ## 0.15.1 — 2026-11-16
12
22
 
13
23
  ### 变化
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.15.1` → install.
39
+ Desktop: **Plugins** → **Add plugin** → enter `@xiangyixie/dsh-superagent@0.15.2` → install.
40
40
 
41
41
  CLI:
42
42
 
43
43
  ```bash
44
- dsh plugin --profile web add @xiangyixie/dsh-superagent@0.15.1
44
+ dsh plugin --profile web add @xiangyixie/dsh-superagent@0.15.2
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.15.1` 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.15.2` 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.15.1` → 安装。
39
+ 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.15.2` → 安装。
40
40
 
41
41
  命令行:
42
42
 
43
43
  ```bash
44
- dsh plugin --profile web add @xiangyixie/dsh-superagent@0.15.1
44
+ dsh plugin --profile web add @xiangyixie/dsh-superagent@0.15.2
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.15.1` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1093
+ | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.15.2` 重装,并在宿主日志里找 `[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.15.1` → 安装。
39
+ 桌面端:侧边栏 **插件** → **Add plugin** → 输入 `@xiangyixie/dsh-superagent@0.15.2` → 安装。
40
40
 
41
41
  命令行:
42
42
 
43
43
  ```bash
44
- dsh plugin --profile web add @xiangyixie/dsh-superagent@0.15.1
44
+ dsh plugin --profile web add @xiangyixie/dsh-superagent@0.15.2
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.15.1` 重装,并在宿主日志里找 `[dsh-superagent]` 行。 |
1093
+ | `superagent_*` 工具不存在 | bundle 行没挂上,或者宿主拒绝加载插件。 | 跑 `--dump-config` 查 `@xiangyixie/dsh-superagent` 块;用 `dsh plugin --profile <p> add @xiangyixie/dsh-superagent@0.15.2` 重装,并在宿主日志里找 `[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
@@ -84,6 +84,24 @@ window.__ModuleLoader__.load({
84
84
  cursor: 'pointer',
85
85
  }
86
86
 
87
+ /**
88
+ * The page this module runs inside, as `protocol//host`. The console page
89
+ * has to name its framer in `frame-ancestors`, and a desktop shell serves
90
+ * its chrome from a custom scheme, so passing the scheme along keeps that
91
+ * list correct when the shell switches to another one.
92
+ * @returns {string} the framing page's scheme and host, or '' when opaque.
93
+ */
94
+ function parentOrigin() {
95
+ try {
96
+ const protocol = String(window.location?.protocol ?? '')
97
+ if (!/^[a-z][a-z0-9+.-]*:$/i.test(protocol)) return ''
98
+ const host = String(window.location?.host ?? '')
99
+ return host ? `${protocol}//${host}` : protocol
100
+ } catch {
101
+ return ''
102
+ }
103
+ }
104
+
87
105
  /**
88
106
  * Ask the plugin's node half where the console listens. The answer carries
89
107
  * the one-time token because this route is same-origin and loopback-only.
@@ -104,7 +122,9 @@ window.__ModuleLoader__.load({
104
122
  }
105
123
  const data = body?.data
106
124
  if (response.ok && data?.ready === true && data.url && data.token) {
107
- return { src: `${data.url}/?token=${encodeURIComponent(data.token)}` }
125
+ const parent = parentOrigin()
126
+ const hint = parent ? `&parent=${encodeURIComponent(parent)}` : ''
127
+ return { src: `${data.url}/?token=${encodeURIComponent(data.token)}${hint}` }
108
128
  }
109
129
  const reason = body?.message
110
130
  ?? (typeof data?.reason === 'string' ? data.reason : null)
package/lib/console.js CHANGED
@@ -96,6 +96,50 @@ const ARTIFACT_TYPES = new Map([
96
96
  ['.pdf', 'application/pdf'],
97
97
  ])
98
98
 
99
+ // The host seats this page in its main panel, so the page has to name the
100
+ // framing origin in `frame-ancestors`. A desktop shell serves its chrome from a
101
+ // custom scheme (`dsh-app://app` today); CSP has no wildcard that covers
102
+ // "whatever scheme the shell uses", so the list is the loopback origins plus the
103
+ // scheme in use, and the client half reports the page's own `protocol//host` on
104
+ // `parent` — a scheme change then needs no new release here.
105
+ const LOOPBACK_NAMES = new Set(['127.0.0.1', 'localhost', '[::1]'])
106
+ const BASE_FRAME_ANCESTORS = Object.freeze([
107
+ "'self'",
108
+ 'http://127.0.0.1:*',
109
+ 'http://localhost:*',
110
+ 'http://[::1]:*',
111
+ 'dsh-app:',
112
+ ])
113
+ // One source expression, nothing else: a scheme, optionally followed by `//host`.
114
+ // No quotes, spaces, semicolons or commas can slip through into the header.
115
+ const ANCESTOR_TOKEN = /^[a-z][a-z0-9+.-]*:(?:\/\/[a-z0-9._~%\-[\]:]+)?$/i
116
+
117
+ /**
118
+ * Turn the `parent` hint from the client half into one CSP source expression.
119
+ *
120
+ * Only two kinds of framer are legitimate: the loopback page the web profile
121
+ * serves, and the desktop shell's own non-http(s) scheme. An http(s) parent that
122
+ * is not loopback is refused, so a page on the internet cannot seat itself
123
+ * around the token even if the token leaked into a link.
124
+ *
125
+ * @param {string} reported - the framing page's `protocol//host`, or ''.
126
+ * @returns {string} a source expression, or '' when the value is not usable.
127
+ */
128
+ function ancestorSource(reported) {
129
+ const raw = reported.trim()
130
+ if (!raw || raw.length > 200 || !ANCESTOR_TOKEN.test(raw)) return ''
131
+ let url = null
132
+ try {
133
+ url = new URL(raw)
134
+ } catch {
135
+ return ''
136
+ }
137
+ if (!url.hostname) return ''
138
+ const scheme = url.protocol.slice(0, -1).toLowerCase()
139
+ if ((scheme === 'http' || scheme === 'https') && !LOOPBACK_NAMES.has(url.hostname)) return ''
140
+ return `${url.protocol}//${url.host}`
141
+ }
142
+
99
143
  /**
100
144
  * An artifact page runs with an opaque origin so its scripts cannot reach the
101
145
  * console's token or storage, while still rendering its own styles and CDNs.
@@ -1050,11 +1094,15 @@ export function createConsole({
1050
1094
  if (method !== 'GET') throw new WorkbenchError(405, 'only GET is allowed here', { id: 'method-not-allowed' })
1051
1095
  authorize(req, { allowQuery: true })
1052
1096
  // The host seats this page in the "超级智能体" main panel, so framing is
1053
- // allowed from loopback origins only — the token still gates the page.
1097
+ // allowed from loopback origins and from the shell scheme the client
1098
+ // half reports — the token still gates the page.
1099
+ const ancestors = [...BASE_FRAME_ANCESTORS]
1100
+ const reported = ancestorSource(parsed.searchParams.get('parent') ?? '')
1101
+ if (reported && !ancestors.includes(reported)) ancestors.push(reported)
1054
1102
  sendText(res, 200, page, 'text/html; charset=utf-8', {
1055
1103
  'content-security-policy': "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; "
1056
1104
  + "connect-src 'self'; img-src 'self' data:; frame-src 'self'; base-uri 'none'; form-action 'none'; "
1057
- + "frame-ancestors 'self' http://127.0.0.1:* http://localhost:* http://[::1]:*",
1105
+ + `frame-ancestors ${ancestors.join(' ')}`,
1058
1106
  })
1059
1107
  return
1060
1108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiangyixie/dsh-superagent",
3
- "version": "0.15.1",
3
+ "version": "0.15.2",
4
4
  "description": "长周期自主执行插件:一个目标拆成可并行的子任务,交付一份合并报告,重启后仍可继续。",
5
5
  "author": "Admire (LittleChenLiya)",
6
6
  "type": "module",