dsh-browser-cdp 1.3.0 → 1.3.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/README.md CHANGED
@@ -221,7 +221,9 @@ dshx list # 应显示:[on] dsh-
221
221
 
222
222
  ## 工具注入分级(懒注册 / 分级 / 锁定)
223
223
 
224
- 38 个工具全量注册时,**每个会话每一轮**都要为它们的 schema 付费(AST 实测 `description` + `parameters` ≈ 18.8K 字符 ≈ 5.4K token),而不碰浏览器的会话一个也用不上。插件因此把「谁能出现在模型面前」收成一处策略(`src/toolTiers.ts`),分**八批**注入:
224
+ 38 个工具全量注册时,**每个会话每一轮**都要为它们的 schema 付费(AST 实测 `description` + `parameters` ≈ 19.3K 字符 ≈ 5.5K token),而不碰浏览器的会话一个也用不上。插件因此把「谁能出现在模型面前」收成一处策略(`src/toolTiers.ts`),分**八批**注入。
225
+
226
+ > **8 批 ≠ 8 个开关**。批次是*注入时机*,开关是*用户面*(§9.3「开关与批次解耦」)。当前 4 个开关管 8 批:`toolBrowse` 管 act+observe+wait 三批并按波次放行,`toolExtended` 管 power+session,`toolEscape`、`toolJudge` 各管一批。所以「`toolBrowse` = 16 个」指的是**并集上限**,实际第一波只放 8 个。
225
227
 
226
228
  | 批次 | 成员 | schema | 何时出现 |
227
229
  |---|---|---:|---|
@@ -231,8 +233,9 @@ dshx list # 应显示:[on] dsh-
231
233
  | **wait** 等待(4) | wait / wait_for_selector / wait_for_url / wait_for_response | 1,695 | 第三次活动 |
232
234
  | **power** 重量级(5) | raw CDP / http / upload / download / dialog | 2,947 | 首次活动(同 `toolExtended`) |
233
235
  | **session** 登录态(3) | captcha / auth_flush / login_import | 1,689 | 首次活动(同 `toolExtended`) |
234
- | **escape** 逃生舱(2) | cli / script | 1,224 | **冷启动即在**,不吃活动闸(见下) |
236
+ | **escape** 逃生舱(2) | cli / script | 1,677 | **冷启动即在**,不吃活动闸(见下) |
235
237
  | **judge** 评审链(5) | `bcdp_jev_*` | 3,183 | 除解锁外,**还要求配了 JEV 或 Laya Key** |
238
+ | **合计** | 38 | **19,287** | — |
236
239
 
237
240
  设置项在插件设置页**最上方**的「工具封印」分块(全部 volatile,翻完当场生效,不重启插件)——一个开关管一组批次,形状照 dsh-prime-memory 的「工具封印」:
238
241
 
@@ -247,7 +250,8 @@ dshx list # 应显示:[on] dsh-
247
250
  - **闲置自动收回**:`lazy` + `idleTimeoutMin > 0` 时,空闲回收把后台浏览器停掉的同一刻收回扩展面;下次活动重新铺开。`always` 模式不受影响。
248
251
  - `legacyEgoToolNames` 的 `ego_*` 别名跟随其 `bcdp_*` 本体的级别。
249
252
  - 当前注入面写在 `bcdp_doctor` 报告首行(`tool injection: mode=lazy browse=open extended=open escape=open judge=open judgeKey=none active=no → live 9 / sealed 29`),不用猜。
250
- - 默认档下不碰浏览器的会话只有 **9** 个工具在场(core 7 + escape 2 ≈ 3.8K 字符,−79.6%);要回到历史行为把 `toolInjection` 改成 `always`(38 件全在场需再配一个评审 Key)。
253
+ - 默认档下不碰浏览器的会话只有 **9** 个工具在场(core 7 + escape 2 = 4,287 字符 ≈ 1,225 token,−77.8%);要回到历史行为把 `toolInjection` 改成 `always`(38 件全在场需再配一个评审 Key)。
254
+ - **各档实测注入面**(AST 口径,1.3.1):默认 9 个 / 1,225 tok → 首次活动 25 个 / 3,642 tok → 第 2 波 29 个 / 4,117 tok → 第 3 波 33 个 / 4,601 tok → 全量 38 个 / 5,511 tok。工具**个数**在每一档都不高于 1.2.5(默认 7→9 是 escape 常驻的代价,首次活动 27→25 反而更小)。
251
255
  - 五个字段都带 schema `.default()`:volatile 字段的表单描述符直接拿 schema 默认值,不写默认会出现「面板显示 A、运行时用 B」。
252
256
 
253
257
  > 取舍提醒:窄工具(一个动作一个工具)是模型写对参数、少重试的护栏。把交互原子合并成脚本逃生舱会省上下文,但代价是模型要自己写 heredoc、出错率上升——本插件保持全部 38 个工具的签名不变,只改**出现时机**。
package/dsh-plugin.json CHANGED
@@ -1,198 +1,198 @@
1
- {
2
- "$schema": "https://dsh.community/schemas/dsh-plugin-0.15.json",
3
- "id": "dsh-browser-cdp",
4
- "name": "dsh-browser-cdp",
5
- "version": "1.3.0",
6
- "manifestVersion": "0.15",
7
- "facets": {
8
- "host": {
9
- "entry": "lib/index.js",
10
- "apiVersion": "v1alpha1"
11
- }
12
- },
13
- "requires": {
14
- "contracts": [
15
- {
16
- "apiVersion": "presentation.dsh/v1alpha1",
17
- "kind": "OpenExternal",
18
- "optional": true,
19
- "fallback": "report the URL as text instead of opening it"
20
- },
21
- {
22
- "apiVersion": "presentation.dsh/v1alpha1",
23
- "kind": "Notification",
24
- "optional": true,
25
- "fallback": "log the notice to the browser-status scene"
26
- }
27
- ]
28
- },
29
- "permissions": [],
30
- "contributes": {
31
- "commands": [],
32
- "x-dsh-tui": [
33
- {
34
- "apiVersion": "tui.dsh/v1alpha1",
35
- "kind": "Scene",
36
- "id": "dsh-browser-cdp.watch",
37
- "name": "agent_browser",
38
- "spec": {
39
- "title": "Agent 浏览器",
40
- "titles": {
41
- "en": "Agent Browser",
42
- "zh": "Agent 浏览器"
43
- }
44
- }
45
- },
46
- {
47
- "apiVersion": "tui.dsh/v1alpha1",
48
- "kind": "SettingsSection",
49
- "id": "dsh-browser-cdp.settings",
50
- "name": "dsh_browser_cdp_settings",
51
- "spec": {
52
- "namespace": "dsh-browser-cdp",
53
- "title": "Agent 浏览器",
54
- "titles": {
55
- "en": "Agent Browser",
56
- "zh": "Agent 浏览器"
57
- },
58
- "fields": [
59
- {
60
- "path": [
61
- "toolInjection"
62
- ],
63
- "label": "工具注入模式 (Tool injection mode)",
64
- "kind": "select",
65
- "options": [
66
- {
67
- "value": "lazy",
68
- "label": "lazy"
69
- },
70
- {
71
- "value": "always",
72
- "label": "always"
73
- }
74
- ],
75
- "hint": "lazy(默认)= 常驻核心 7 个 + 逃生舱 2 个,其余首次 bcdp_* 调用后按下方开关注入,闲置回收时收回;always = 挂载即注册全部 38 个(历史行为)。"
76
- },
77
- {
78
- "path": [
79
- "toolBrowse"
80
- ],
81
- "label": "基础操作工具(16 个)",
82
- "kind": "boolean",
83
- "hint": "开(默认)= 浏览器活动后按 act → observe → wait 三波放行;关 = 16 个工具从模型工具列表移除(点击/填写/键鼠/拖拽/截图/读取/等待…)。"
84
- },
85
- {
86
- "path": [
87
- "toolExtended"
88
- ],
89
- "label": "扩展能力工具(8 个)",
90
- "kind": "boolean",
91
- "hint": "开(默认)= 浏览器活动后注册;关 = 8 个工具移除(裸 CDP/HTTP/上传/下载/对话框/验证码/登录落盘/登录导入)。"
92
- },
93
- {
94
- "path": [
95
- "toolEscape"
96
- ],
97
- "label": "逃生舱 cli / script(2 个)",
98
- "kind": "boolean",
99
- "hint": "始终可用——与其它档不同,它不等浏览器活动,因为一个 heredoc 就能做到其余 36 个工具的事。关 = 封印。"
100
- },
101
- {
102
- "path": [
103
- "toolJudge"
104
- ],
105
- "label": "评审工具 bcdp_jev_*(5 个)",
106
- "kind": "boolean",
107
- "hint": "开仍需配了 JEV 或 Laya Key:没 Key 的评审工具只能回答「未配置」,依旧不注入。关 = 任何情况下都不注入。"
108
- },
109
- {
110
- "path": [
111
- "isolateSpaces"
112
- ],
113
- "label": "任务空间沙盒隔离 (Space isolation)",
114
- "kind": "boolean",
115
- "hint": "默认关闭:使用磁盘持久化 Profile,任务中登录的账号跨电脑重启永久保留;开启后使用内存临时沙盒隔离,任务结束不落盘。"
116
- },
117
- {
118
- "path": [
119
- "idleTimeoutMin"
120
- ],
121
- "label": "空闲自动回收 (Idle auto-stop, minutes)",
122
- "kind": "number",
123
- "hint": "N 分钟没有任何 bcdp_* 调用后自动关闭后台浏览器进程(0 = 关闭此功能)。下次调用会自动冷启动(约 2-4 秒)。观察窗正在观看不算活动。"
124
- },
125
- {
126
- "path": [
127
- "chromePath"
128
- ],
129
- "label": "Browser binary path",
130
- "kind": "text",
131
- "hint": "Path to the Chrome/Chromium/Edge binary. Empty = auto-detect."
132
- },
133
- {
134
- "path": [
135
- "captureBackend"
136
- ],
137
- "label": "Capture backend",
138
- "kind": "select",
139
- "options": [
140
- {
141
- "value": "auto",
142
- "label": "Auto"
143
- },
144
- {
145
- "value": "cdp",
146
- "label": "CDP"
147
- },
148
- {
149
- "value": "ffmpeg",
150
- "label": "FFmpeg"
151
- }
152
- ]
153
- },
154
- {
155
- "path": [
156
- "streamProfile"
157
- ],
158
- "label": "Quality profile",
159
- "kind": "select",
160
- "options": [
161
- {
162
- "value": "balanced",
163
- "label": "Balanced"
164
- },
165
- {
166
- "value": "quality",
167
- "label": "Quality"
168
- },
169
- {
170
- "value": "speed",
171
- "label": "Speed"
172
- }
173
- ]
174
- },
175
- {
176
- "path": [
177
- "ffmpegPath"
178
- ],
179
- "label": "FFmpeg binary path",
180
- "kind": "text",
181
- "hint": "Path to ffmpeg. Empty = auto-detect / on-demand install."
182
- }
183
- ]
184
- }
185
- }
186
- ]
187
- },
188
- "subscriptions": [],
189
- "license": "MIT",
190
- "source": {
191
- "repository": "https://github.com/drscrewdriver/dsh-browser-cdp"
192
- },
193
- "compat": {
194
- "hosts": [
195
- "dsh-tui"
196
- ]
197
- }
1
+ {
2
+ "$schema": "https://dsh.community/schemas/dsh-plugin-0.15.json",
3
+ "id": "dsh-browser-cdp",
4
+ "name": "dsh-browser-cdp",
5
+ "version": "1.3.2",
6
+ "manifestVersion": "0.15",
7
+ "facets": {
8
+ "host": {
9
+ "entry": "lib/index.js",
10
+ "apiVersion": "v1alpha1"
11
+ }
12
+ },
13
+ "requires": {
14
+ "contracts": [
15
+ {
16
+ "apiVersion": "presentation.dsh/v1alpha1",
17
+ "kind": "OpenExternal",
18
+ "optional": true,
19
+ "fallback": "report the URL as text instead of opening it"
20
+ },
21
+ {
22
+ "apiVersion": "presentation.dsh/v1alpha1",
23
+ "kind": "Notification",
24
+ "optional": true,
25
+ "fallback": "log the notice to the browser-status scene"
26
+ }
27
+ ]
28
+ },
29
+ "permissions": [],
30
+ "contributes": {
31
+ "commands": [],
32
+ "x-dsh-tui": [
33
+ {
34
+ "apiVersion": "tui.dsh/v1alpha1",
35
+ "kind": "Scene",
36
+ "id": "dsh-browser-cdp.watch",
37
+ "name": "agent_browser",
38
+ "spec": {
39
+ "title": "Agent 浏览器",
40
+ "titles": {
41
+ "en": "Agent Browser",
42
+ "zh": "Agent 浏览器"
43
+ }
44
+ }
45
+ },
46
+ {
47
+ "apiVersion": "tui.dsh/v1alpha1",
48
+ "kind": "SettingsSection",
49
+ "id": "dsh-browser-cdp.settings",
50
+ "name": "dsh_browser_cdp_settings",
51
+ "spec": {
52
+ "namespace": "dsh-browser-cdp",
53
+ "title": "Agent 浏览器",
54
+ "titles": {
55
+ "en": "Agent Browser",
56
+ "zh": "Agent 浏览器"
57
+ },
58
+ "fields": [
59
+ {
60
+ "path": [
61
+ "toolInjection"
62
+ ],
63
+ "label": "工具注入模式 (Tool injection mode)",
64
+ "kind": "select",
65
+ "options": [
66
+ {
67
+ "value": "lazy",
68
+ "label": "lazy"
69
+ },
70
+ {
71
+ "value": "always",
72
+ "label": "always"
73
+ }
74
+ ],
75
+ "hint": "lazy(默认)= 常驻核心 7 个 + 逃生舱 2 个,其余首次 bcdp_* 调用后按下方开关注入,闲置回收时收回;always = 挂载即注册全部 38 个(历史行为)。"
76
+ },
77
+ {
78
+ "path": [
79
+ "toolBrowse"
80
+ ],
81
+ "label": "基础操作工具(16 个)",
82
+ "kind": "boolean",
83
+ "hint": "开(默认)= 浏览器活动后按 act → observe → wait 三波放行;关 = 16 个工具从模型工具列表移除(点击/填写/键鼠/拖拽/截图/读取/等待…)。"
84
+ },
85
+ {
86
+ "path": [
87
+ "toolExtended"
88
+ ],
89
+ "label": "扩展能力工具(8 个)",
90
+ "kind": "boolean",
91
+ "hint": "开(默认)= 浏览器活动后注册;关 = 8 个工具移除(裸 CDP/HTTP/上传/下载/对话框/验证码/登录落盘/登录导入)。"
92
+ },
93
+ {
94
+ "path": [
95
+ "toolEscape"
96
+ ],
97
+ "label": "逃生舱 cli / script(2 个)",
98
+ "kind": "boolean",
99
+ "hint": "始终可用——与其它档不同,它不等浏览器活动,因为一个 heredoc 就能做到其余 36 个工具的事。关 = 封印。"
100
+ },
101
+ {
102
+ "path": [
103
+ "toolJudge"
104
+ ],
105
+ "label": "评审工具 bcdp_jev_*(5 个)",
106
+ "kind": "boolean",
107
+ "hint": "开仍需配了 JEV 或 Laya Key:没 Key 的评审工具只能回答「未配置」,依旧不注入。关 = 任何情况下都不注入。"
108
+ },
109
+ {
110
+ "path": [
111
+ "isolateSpaces"
112
+ ],
113
+ "label": "任务空间沙盒隔离 (Space isolation)",
114
+ "kind": "boolean",
115
+ "hint": "默认关闭:使用磁盘持久化 Profile,任务中登录的账号跨电脑重启永久保留;开启后使用内存临时沙盒隔离,任务结束不落盘。"
116
+ },
117
+ {
118
+ "path": [
119
+ "idleTimeoutMin"
120
+ ],
121
+ "label": "空闲自动回收 (Idle auto-stop, minutes)",
122
+ "kind": "number",
123
+ "hint": "N 分钟没有任何 bcdp_* 调用后自动关闭后台浏览器进程(0 = 关闭此功能)。下次调用会自动冷启动(约 2-4 秒)。观察窗正在观看不算活动。"
124
+ },
125
+ {
126
+ "path": [
127
+ "chromePath"
128
+ ],
129
+ "label": "Browser binary path",
130
+ "kind": "text",
131
+ "hint": "Path to the Chrome/Chromium/Edge binary. Empty = auto-detect."
132
+ },
133
+ {
134
+ "path": [
135
+ "captureBackend"
136
+ ],
137
+ "label": "Capture backend",
138
+ "kind": "select",
139
+ "options": [
140
+ {
141
+ "value": "auto",
142
+ "label": "Auto"
143
+ },
144
+ {
145
+ "value": "cdp",
146
+ "label": "CDP"
147
+ },
148
+ {
149
+ "value": "ffmpeg",
150
+ "label": "FFmpeg"
151
+ }
152
+ ]
153
+ },
154
+ {
155
+ "path": [
156
+ "streamProfile"
157
+ ],
158
+ "label": "Quality profile",
159
+ "kind": "select",
160
+ "options": [
161
+ {
162
+ "value": "balanced",
163
+ "label": "Balanced"
164
+ },
165
+ {
166
+ "value": "quality",
167
+ "label": "Quality"
168
+ },
169
+ {
170
+ "value": "speed",
171
+ "label": "Speed"
172
+ }
173
+ ]
174
+ },
175
+ {
176
+ "path": [
177
+ "ffmpegPath"
178
+ ],
179
+ "label": "FFmpeg binary path",
180
+ "kind": "text",
181
+ "hint": "Path to ffmpeg. Empty = auto-detect / on-demand install."
182
+ }
183
+ ]
184
+ }
185
+ }
186
+ ]
187
+ },
188
+ "subscriptions": [],
189
+ "license": "MIT",
190
+ "source": {
191
+ "repository": "https://github.com/drscrewdriver/dsh-browser-cdp"
192
+ },
193
+ "compat": {
194
+ "hosts": [
195
+ "dsh-tui"
196
+ ]
197
+ }
198
198
  }
package/lib/index.js CHANGED
@@ -7409,8 +7409,19 @@ async function runWithStaleSpaceRetry(ctx, cfg, exec, buildScript, graceOverride
7409
7409
  }
7410
7410
  return result;
7411
7411
  }
7412
- /** Find the last line carrying the sentinel and JSON-parse its payload. */
7413
- /** @internal exported for tests */
7412
+ /**
7413
+ * Find the last line carrying the sentinel and JSON-parse its payload.
7414
+ *
7415
+ * Fallback: `bcdp_script` / `bcdp_cli` run user-authored heredocs, and both
7416
+ * tool descriptions tell the model to "end with console.log(JSON.stringify(...))"
7417
+ * — without the sentinel prefix. A script written to that instruction used to
7418
+ * succeed and still be reported as a failure ("no @@DSH_RESULT@@ payload"), so
7419
+ * when no sentinel line exists we accept the last line that parses as a JSON
7420
+ * object. The sentinel still wins whenever it is present (it marks the payload
7421
+ * deliberately, across any amount of surrounding log noise).
7422
+ *
7423
+ * @internal exported for tests
7424
+ */
7414
7425
  function parseSentinel(stdout) {
7415
7426
  const lines = stdout.split("\n");
7416
7427
  for (let i = lines.length - 1; i >= 0; i--) {
@@ -7423,6 +7434,57 @@ function parseSentinel(stdout) {
7423
7434
  return;
7424
7435
  }
7425
7436
  }
7437
+ return lastJsonObject(stdout);
7438
+ }
7439
+ /**
7440
+ * The last balanced `{...}` run in `text` that parses as a JSON object.
7441
+ *
7442
+ * Tracks double-quoted strings (JSON's only string syntax) so braces inside a
7443
+ * string value do not unbalance the scan. Invalid candidates are skipped, not
7444
+ * fatal: log noise before the payload is common.
7445
+ *
7446
+ * A candidate must begin its own line (leading whitespace is fine). That keeps
7447
+ * pretty-printed payloads working while refusing an object merely mentioned in
7448
+ * prose: `[warn] retrying {"attempt":2}` must not become the result, because a
7449
+ * silently wrong payload is worse than no payload at all.
7450
+ */
7451
+ function lastJsonObject(text) {
7452
+ let best;
7453
+ let depth = 0;
7454
+ let start = -1;
7455
+ let inString = false;
7456
+ let escaped = false;
7457
+ for (let i = 0; i < text.length; i++) {
7458
+ const c = text[i];
7459
+ if (inString) {
7460
+ if (escaped) escaped = false;
7461
+ else if (c === "\\") escaped = true;
7462
+ else if (c === "\"") inString = false;
7463
+ continue;
7464
+ }
7465
+ if (c === "\"") {
7466
+ inString = true;
7467
+ continue;
7468
+ }
7469
+ if (c === "{") {
7470
+ if (depth === 0) start = i;
7471
+ depth += 1;
7472
+ continue;
7473
+ }
7474
+ if (c !== "}") continue;
7475
+ if (depth === 0) continue;
7476
+ depth -= 1;
7477
+ if (depth !== 0 || start < 0) continue;
7478
+ let p = start - 1;
7479
+ while (p >= 0 && (text[p] === " " || text[p] === " " || text[p] === "\r")) p -= 1;
7480
+ const atLineStart = p < 0 || text[p] === "\n";
7481
+ try {
7482
+ const parsed = atLineStart ? JSON.parse(text.slice(start, i + 1)) : null;
7483
+ if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) best = parsed;
7484
+ } catch {}
7485
+ start = -1;
7486
+ }
7487
+ return best;
7426
7488
  }
7427
7489
  /** R2/R3 — sentinel + payload for the `bcdp_status` facade probe. @internal exported for tests */
7428
7490
  const STATUS_FACADE_SENTINEL = "__BCDP_STATUS__";
@@ -8887,11 +8949,11 @@ function registerActionTools(ctx, cfg, reg) {
8887
8949
  reg((() => {
8888
8950
  return defineTool({
8889
8951
  name: "bcdp_cli",
8890
- description: "Escape hatch: run an arbitrary `ego-browser nodejs` heredoc script verbatim (facades page/browser/taskSpaces/site/fetch and the raw cdp() are preloaded). Use when the structured bcdp_* tools do not cover the task. Returns raw stdout plus the parsed console.log payload when present.",
8952
+ description: "Escape hatch: run an arbitrary `ego-browser nodejs` heredoc script VERBATIM (facades page/browser/taskSpaces/site/fetch and the raw cdp() are preloaded; no preamble is added, so select the task space yourself before touching page.*). Use when the structured bcdp_* tools do not cover the task. Returns the raw output plus the parsed console.log payload when present.",
8891
8953
  parameters: { script: {
8892
8954
  type: "string",
8893
8955
  required: true,
8894
- description: "Full JS script body for the heredoc; ego-browser helpers are preloaded. End with console.log(JSON.stringify(...)) for a parseable sentinel payload."
8956
+ description: "Full JS script body for the heredoc; ego-browser helpers are preloaded. Runs verbatim — call `await taskSpaces.useOrCreate(name)` first if your script uses page.*. End with console.log(JSON.stringify(payload)) to get it back as `result`."
8895
8957
  } },
8896
8958
  output: {
8897
8959
  schema: {
@@ -9172,12 +9234,12 @@ function registerHelpAndDoctor(ctx, cfg, reg, tiers) {
9172
9234
  reg((() => {
9173
9235
  return defineTool({
9174
9236
  name: "bcdp_script",
9175
- description: "Run an arbitrary `ego-browser nodejs` heredoc script in ONE invocation (same runtime/API as bcdp_cli: page/…locator/browser/taskSpaces/site/fetch/cdp preloaded), and return structured {ok, stdout, stderr, result, durationMs, timedOut}. Use for a full multi-step browser task as a single script.",
9237
+ description: "Run an arbitrary `ego-browser nodejs` heredoc script in ONE invocation (page/…locator/browser/taskSpaces/site/fetch/cdp preloaded), and return structured {ok, stdout, stderr, result, durationMs, timedOut}. Use for a full multi-step browser task as a single script. The task space is selected and a real (non-blank) tab activated for you before your script runs, so page.* works directly. Differs from bcdp_cli, which runs the body verbatim with no preamble.",
9176
9238
  parameters: {
9177
9239
  script: {
9178
9240
  type: "string",
9179
9241
  required: true,
9180
- description: "Full JS script body; end with console.log(JSON.stringify(...)) for a parseable sentinel payload."
9242
+ description: "Full JS script body. You may end with console.log(JSON.stringify(payload)) — bare or prefixed with the sentinel — and it is returned as `result`. Without one, `output` still carries everything the script printed."
9181
9243
  },
9182
9244
  timeoutMs: {
9183
9245
  type: "integer",
@@ -9215,7 +9277,11 @@ function registerHelpAndDoctor(ctx, cfg, reg, tiers) {
9215
9277
  markEgoToolCall(callingSessionId(exec));
9216
9278
  const timeoutMs = typeof args.timeoutMs === "number" && Number.isFinite(args.timeoutMs) && args.timeoutMs > 0 ? args.timeoutMs : void 0;
9217
9279
  const start = Date.now();
9218
- const result = await runWithStaleSpaceRetry(ctx, cfg, exec, () => str(args.script, ""), timeoutMs);
9280
+ const preamble = (body) => {
9281
+ if (/taskSpaces\s*\.\s*useOrCreate\s*\(/.test(body)) return body;
9282
+ return `${useSpace(cfg.defaultSpace)}${ensureRealTab()}${body}`;
9283
+ };
9284
+ const result = await runWithStaleSpaceRetry(ctx, cfg, exec, () => preamble(str(args.script, "")), timeoutMs);
9219
9285
  const durationMs = Date.now() - start;
9220
9286
  if (!result.ok) return {
9221
9287
  ok: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-browser-cdp",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "dsh-browser-cdp: DSH browser plugin — attach to a running Chrome/Edge over CDP (no bundled browser needed); structured browser-automation tools (30+ bcdp_*) that drive the vendored ego runtime through ctx.subprocess, plus a realtime watch panel (live SSE screencast + direct mouse interaction + download capture + human-verification notice). Web shell: floating watch panel without dsh-better-sidebar, sidebar tab with it. Headless/TUI hosts: tools-only. [DSH 0.1.7-rc.1 ~ 0.2.1-rc.1 line (exact rc enumeration): declarative settings via Config .volatile() fields; for DSH 0.1.2-rc.1 ~ 0.1.5-rc.3 use the 0.17.x line]",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",