dsh-context-compression-improved 0.10.5 → 0.11.1

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.
Files changed (85) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/CHANGELOG.zh.md +9 -0
  3. package/README.de.md +1 -1
  4. package/assets/dshfind-card.svg +33 -0
  5. package/docs/shallow-teaching-preset-template.md +46 -0
  6. package/package.json +6 -6
  7. package/packages/selector/dsh.plugin.json +2 -2
  8. package/packages/selector/lib/client.d.ts +8 -0
  9. package/packages/selector/lib/client.js +212 -3
  10. package/packages/selector/lib/index.js +1 -1
  11. package/packages/selector/lib/profiles.d.ts +34 -0
  12. package/packages/selector/lib/pruner.d.ts +55 -0
  13. package/packages/selector/lib/pruner.js +1925 -303
  14. package/packages/selector/lib/savings-integral.js +126 -3
  15. package/packages/selector/lib/tool-result.js +9 -1
  16. package/packages/selector/package.json +21 -21
  17. package/packages/selector/src/client/CompressionProfileControls.tsx +33 -0
  18. package/packages/selector/src/client/CompressionProfileSelector.tsx +2 -0
  19. package/packages/selector/src/client/decode.ts +5 -1
  20. package/packages/selector/src/client/index.ts +4 -0
  21. package/packages/selector/src/client/locales/de.ts +7 -0
  22. package/packages/selector/src/client/locales/es.ts +7 -0
  23. package/packages/selector/src/client/locales/fr.ts +7 -0
  24. package/packages/selector/src/client/locales/it.ts +7 -0
  25. package/packages/selector/src/client/locales/ja.ts +7 -0
  26. package/packages/selector/src/client/locales/ko.ts +7 -0
  27. package/packages/selector/src/client/locales/ru.ts +7 -0
  28. package/packages/selector/src/client/locales.ts +14 -0
  29. package/packages/selector/src/client/monitor-fab.ts +14 -0
  30. package/packages/selector/src/client/settings-section.tsx +9 -2
  31. package/packages/selector/src/profiles.ts +103 -0
  32. package/packages/selector/src/pruner.ts +310 -4
  33. package/packages/selector/src/runtime/audit.ts +1 -0
  34. package/packages/selector/src/runtime/config.ts +88 -1
  35. package/packages/selector/src/runtime/fold-router.ts +143 -0
  36. package/packages/selector/src/runtime/monitor.ts +31 -0
  37. package/packages/selector/src/runtime/reducers.ts +1 -1
  38. package/packages/selector/src/runtime/sediment-card.ts +126 -0
  39. package/packages/selector/src/runtime/sediment-clock.ts +87 -0
  40. package/packages/selector/src/runtime/sediment-guard.ts +136 -0
  41. package/packages/selector/src/runtime/sediment-publish.ts +144 -0
  42. package/packages/selector/src/runtime/sediment-span.ts +170 -0
  43. package/packages/selector/src/runtime/sediment.ts +209 -0
  44. package/packages/selector/src/runtime/shallow-tools.ts +342 -0
  45. package/packages/selector/src/runtime/tool-names.ts +6 -0
  46. package/packages/selector/src/runtime/triage/masks.ts +128 -0
  47. package/packages/selector/src/runtime/triage/shallow.ts +132 -0
  48. package/packages/selector/src/runtime/triage/signals.ts +167 -0
  49. package/packages/selector/src/runtime/triage/types.ts +125 -0
  50. package/packages/selector/src/runtime/types.ts +28 -0
  51. package/packages/selector/tests/fixtures/sediment-pool/52adc205-cloud-5.orig.txt +231 -0
  52. package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-25.orig.txt +236 -0
  53. package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-38.orig.txt +220 -0
  54. package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-42.orig.txt +140 -0
  55. package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-cloud-53.orig.txt +117 -0
  56. package/packages/selector/tests/fixtures/sediment-pool/95fcba5d-local-10.orig.txt +67 -0
  57. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-45.orig.txt +119 -0
  58. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-49.orig.txt +119 -0
  59. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-63.orig.txt +131 -0
  60. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-75.orig.txt +196 -0
  61. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-76.orig.txt +71 -0
  62. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-85.orig.txt +126 -0
  63. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-86.orig.txt +86 -0
  64. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-87.orig.txt +50 -0
  65. package/packages/selector/tests/fixtures/sediment-pool/a7a767c0-cloud-96.orig.txt +102 -0
  66. package/packages/selector/tests/public/package-contract.client.spec.ts +7 -4
  67. package/packages/selector/tests/runtime/fold-router.spec.ts +140 -0
  68. package/packages/selector/tests/runtime/sediment-card.spec.ts +111 -0
  69. package/packages/selector/tests/runtime/sediment-config.spec.ts +56 -0
  70. package/packages/selector/tests/runtime/sediment-guard.spec.ts +71 -0
  71. package/packages/selector/tests/runtime/sediment-masks.spec.ts +95 -0
  72. package/packages/selector/tests/runtime/sediment-orchestrator.spec.ts +166 -0
  73. package/packages/selector/tests/runtime/sediment-pool-share.spec.ts +65 -0
  74. package/packages/selector/tests/runtime/sediment-publish.spec.ts +142 -0
  75. package/packages/selector/tests/runtime/sediment-real-shapes.spec.ts +158 -0
  76. package/packages/selector/tests/runtime/sediment-settings.spec.ts +73 -0
  77. package/packages/selector/tests/runtime/sediment-signals.spec.ts +124 -0
  78. package/packages/selector/tests/runtime/sediment-span.spec.ts +92 -0
  79. package/packages/selector/tests/runtime/shallow-primitives.spec.ts +135 -0
  80. package/packages/selector/tests/settings-seat.client.spec.ts +1 -1
  81. package/scripts/hosts.d.mts +3 -0
  82. package/scripts/hosts.mjs +3 -1
  83. package/scripts/sediment-latency-report.mjs +63 -0
  84. package/scripts/verify-release.mjs +7 -2
  85. package/$null +0 -1
@@ -0,0 +1,236 @@
1
+ [assistant] [tool-call pwsh "{\"command\":\"$p = \\\"C:\\\\Users\\\\joshua\\\\.dsh\\\\profiles\\\\desktop\\\"\\nGet-ChildItem $p -Directory | Select]
2
+ [tool-call pwsh "{\"command\":\"\\\"=== npm registry latest ===\\\"\\ntry { (Invoke-WebRequest -UseBasicParsing -Uri \\\"https://registr]
3
+ ===
4
+ [tool]
5
+ Name
6
+ ----
7
+ .dsh-market
8
+ .plugin-manager
9
+ node_modules
10
+ ---- installed plugin version ----
11
+ C:\Users\joshua\.dsh\profiles\desktop\node_modules\dsh-browser-cdp\package.json
12
+ 1.2.4
13
+ ---- search anywhere ----
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+ ===
22
+ [tool] === npm registry latest ===
23
+ latest: 1.2.4
24
+ versions: 0.0.1, 0.17.0, 0.17.1, 0.17.2, 0.17.3, 0.17.4, 0.18.0, 0.17.5, 0.18.1, 0.17.6, 0.18.2, 0.17.7, 0.18.3, 0.17.8, 0.18.4, 0.17.9, 0.18.6, 0.17.10, 0.18.7, 0.17.11, 0.18.8, 0.17.12, 0.18.9, 0.17.13, 0.17.14, 0.18.11, 0.17.15, 0.18.12, 0.17.16, 0.18.13, 0.18.10, 0.17.17, 0.18.14, 0.17.18, 0.18.15, 0.18.16, 0.17.19, 0.18.5, 0.17.20, 0.18.17, 0.17.21, 0.18.18, 0.17.22, 0.17.23, 0.18.19, 0.16.23, 0.16.24, 0.18.21, 0.17.25, 1.1.5, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.2.4
25
+ modified: 2026-10-20T19:25:47.962Z
26
+
27
+ ===
28
+ [assistant] 本地已安装 **1.2.4**,npm latest 也是 **1.2.4**(发布于昨天 19:25Z),所以“更新”这一步已经完成。关键问题变成:**1.2.4 里到底有没有修 `--sdk-path` 贯通**。直接查已安装的 dist 产物:
29
+ [tool-call pwsh "{\"command\":\"$d = \\\"C:\\\\Users\\\\joshua\\\\.dsh\\\\profiles\\\\desktop\\\\node_modules\\\\dsh-browser-cdp\\\"\\nG]
30
+ [tool-call pwsh "{\"command\":\"$d = \\\"C:\\\\Users\\\\joshua\\\\.dsh\\\\profiles\\\\desktop\\\\node_modules\\\\dsh-browser-cdp\\\"\\n\]
31
+ ===
32
+ [tool]
33
+ Name Length
34
+ ---- ------
35
+ bin
36
+ lib
37
+ runtime
38
+ cordis.patch.yml 945
39
+ dsh-plugin.json 6068
40
+ LICENSE 1387
41
+ package.json 3858
42
+ README.de.md 37862
43
+ README.es.md 39073
44
+ README.fr.md 40011
45
+ README.it.md 38438
46
+ README.md 37087
47
+ README.ru.md 56945
48
+ THIRD_PARTY_NOTICES.md 4323
49
+ ---- dist files ----
50
+ 227805
51
+ 28203
52
+ 5672
53
+ 188301
54
+ 357880
55
+ 12470
56
+ 588
57
+ 412234
58
+ 1437
59
+ 14754
60
+ 2259
61
+ 32835
62
+ 55062
63
+ 2752
64
+ 1781
65
+ 1378
66
+ 6743
67
+ 16260
68
+ 12705
69
+ 16113
70
+ 4495
71
+ 27329
72
+ 11557
73
+ 3741
74
+ 373
75
+ 1147
76
+ 458
77
+ 978
78
+ 1052
79
+
80
+
81
+
82
+ ===
83
+ [tool] === grep sdk-path ===
84
+ --- C:\Users\joshua\.dsh\profiles\desktop\node_modules\dsh-browser-cdp\lib\client.js
85
+ L106: useSdkPath: false,
86
+ L2311: checked: row.useSdkPath === true,
87
+ L2315: writeLinks(updateRow(links, row.id, { useSdkPath: next }));
88
+ --- C:\Users\joshua\.dsh\profiles\desktop\node_modules\dsh-browser-cdp\lib\index.js
89
+ L989: return /unknown option.*sdk-path|unrecognized option.*sdk-path|invalid option.*sdk-path/i.test(text);
90
+ L1061: const sdkArgs = input.useSdkPath === true && (input.sdkPath ?? "") !== "" ? ["--sdk-path", input.sdkPath] : [];
91
+ L1069: let result = await runHeredoc(sdkArgs);
92
+ L1070: if (sdkArgs.length > 0 && looksLikeUnknownSdkFlag(result.stdout + result.stderr)) {
93
+ L1071: warning = "this ego CLI does not support --sdk-path; retried with the CLI's own harness";
94
+ L1096: const facadesOk = input.useSdkPath !== true || facadeMatch?.[1] === "object" && facadeMatch?.[2] === "object";
95
+ L1234: ...rec.useSdkPath === void 0 ? {} : { useSdkPath: Boolean(rec.useSdkPath) }
96
+ L1500: useSdkPath: link.useSdkPath === true,
97
+ L1501: sdkPath: input.sdkPath ?? "",
98
+ L1523: sdkPath: link.useSdkPath === true && probe.warning === void 0 ? input.sdkPath ?? "" : "",
99
+ L2652: useSdkPath: z.boolean(),
100
+ L2746: * `--headless` is managed by EGO_LINUX_HEADLESS; `--sdk-path` is allowed.
101
+ L3101: sdkPath: fileURLToPath(new URL("../runtime/ego-browser/dist/out/index.js", import.meta.url)),
102
+ L7459: * R1 — argv for one tool run. Single source of truth for the `--sdk-path`
103
+ L7466: const sdkArgs = attach.linkKind === EGO_CLI_KIND && (attach.sdkPath ?? "") !== "" ? ["--sdk-path", attach.sdkPath] : [];
104
+ L7470: ...sdkArgs,
105
+ L7895: sdkPath: fileURLToPath(new URL("../runtime/ego-browser/dist/out/index.js", import.meta.url)),
106
+ --- C:\Users\joshua\.dsh\profiles\desktop\node_modules\dsh-browser-cdp\runtime\ego-linux\bin\ego-browser.mjs
107
+ L365: // `--sdk-path <file>` selects which harness bundle to run. Upstream's real
108
+ L369: const sdkFlag = rest.indexOf("--sdk-path");
109
+ L373: process.stderr.write("--sdk-path requires a path\n");
110
+
111
+ ===
112
+ [assistant] 1.2.4 的 dist 里出现了 `R1 — argv for one tool run. Single source of truth for the --sdk-path`、`probe.warning === void 0` 守卫、`facadeMatch` 校验 —— 这几乎就是我们计划里 Phase 1/2 的内容。先读实锤:
113
+ [tool-call pwsh "{\"command\":\"$f = \\\"C:\\\\Users\\\\joshua\\\\.dsh\\\\profiles\\\\desktop\\\\node_modules\\\\dsh-browser-cdp\\\\lib\]
114
+ [tool-call pwsh "{\"command\":\"$f = \\\"C:\\\\Users\\\\joshua\\\\.dsh\\\\profiles\\\\desktop\\\\node_modules\\\\dsh-browser-cdp\\\\lib\]
115
+ ===
116
+ [tool] ===== 7440-7500 =====
117
+ 7451: ...prefix,
118
+ 7452: "nodejs",
119
+ 7453: ...sdkArgs,
120
+ 7454: ...extraCliArgs
121
+ 7455: ];
122
+ 7456: }
123
+ 7457: async function runEgoScript(subprocess, script, exec, cfg, graceOverrideMs) {
124
+ 7458: let handle;
125
+ 7459: try {
126
+ 7460: const attach = defaultAttachCache.get();
127
+ 7461: handle = subprocess.spawn({
128
+ 7462: argv: buildEgoToolArgv(cfg.egoArgvPrefix, attach, cfg.runtimeArgs ?? ""),
129
+ 7463: cwd: process.cwd(),
130
+ 7464: env: resolveEgoEnv(cfg),
131
+ 7465: stdio: {
132
+ 7466: stdin: { data: script },
133
+ 7467: stdout: {
134
+ 7468: maxBytes: cfg.maxOutputBytes,
135
+ 7469: spill: { maxBytes: cfg.maxOutputBytes }
136
+ 7470: },
137
+ 7471: stderr: {
138
+ 7472: maxBytes: 512e3,
139
+ 7473: spill: { maxBytes: 2e6 }
140
+ 7474: }
141
+ 7475: },
142
+ 7476: graceMs: Number.isFinite(graceOverrideMs) && graceOverrideMs > 0 ? graceOverrideMs : cfg.graceMs,
143
+ 7477: ...exec.signal !== void 0 ? { signal: exec.signal } : {}
144
+ 7478: });
145
+ 7479: } catch (err) {
146
+ 7480: return {
147
+ 7481: ok: false,
148
+ 7482: error: describeSpawnFailure(err),
149
+ 7483: stdout: "",
150
+ 7484: stderr: ""
151
+ 7485: };
152
+ 7486: }
153
+ 7487: let outcome;
154
+ 7488: try {
155
+ 7489: outcome = await handle.done;
156
+ 7490: } catch (err) {
157
+ 7491: return {
158
+ 7492: ok: false,
159
+ 7493: error: describeSpawnFailure(err),
160
+ 7494: stdout: "",
161
+ 7495: stderr: ""
162
+ 7496: };
163
+ 7497: }
164
+ 7498: const stdout = readAll(handle.collected.stdout);
165
+ 7499: const stderr = readAll(handle.collected.stderr);
166
+ 7500: if (exec.signal !== void 0 && exec.signal.aborted) return {
167
+ 7501: ok: false,
168
+
169
+ ===
170
+ [tool] ===== 1480-1545 =====
171
+ 1481: targetId: link.id,
172
+ 1482: endpoint: "",
173
+ 1483: wsUrl: "",
174
+ 1484: linkKind: EGO_CLI_KIND
175
+ 1485: };
176
+ 1486: const io = input.cliIo;
177
+ 1487: if (!io) return cache.patch({
178
+ 1488: ...base,
179
+ 1489: status: "unreachable",
180
+ 1490: code: "cli-io-missing",
181
+ 1491: message: "the host did not provide CLI IO for the local ego CLI link",
182
+ 1492: resolvedAt: now()
183
+ 1493: });
184
+ 1494: const probe = await probeCliLink({
185
+ 1495: cliPath: link.cliPath,
186
+ 1496: bundled: input.bundledCli ?? "",
187
+ 1497: useSdkPath: link.useSdkPath === true,
188
+ 1498: sdkPath: input.sdkPath ?? "",
189
+ 1499: timeoutMs: input.timeoutMs
190
+ 1500: }, io);
191
+ 1501: if (!probe.ok) return cache.patch({
192
+ 1502: ...base,
193
+ 1503: status: "unreachable",
194
+ 1504: code: probe.code,
195
+ 1505: message: probe.message,
196
+ 1506: cliPath: probe.cliPath,
197
+ 1507: cliShape: probe.shape,
198
+ 1508: latencyMs: probe.latencyMs,
199
+ 1509: resolvedAt: now()
200
+ 1510: });
201
+ 1511: const coldStart = probe.running === false;
202
+ 1512: return cache.patch({
203
+ 1513: ...base,
204
+ 1514: status: "ready",
205
+ 1515: endpointSource: coldStart ? "cli-launch" : "cli",
206
+ 1516: code: "",
207
+ 1517: message: probe.warning ?? (coldStart ? "local ego CLI reachable; the backing browser is not running yet and will start on the first call" : "local ego CLI ready"),
208
+ 1518: cliPath: probe.cliPath,
209
+ 1519: cliShape: probe.shape,
210
+ 1520: sdkPath: link.useSdkPath === true && probe.warning === void 0 ? input.sdkPath ?? "" : "",
211
+ 1521: latencyMs: probe.latencyMs,
212
+ 1522: resolvedAt: now()
213
+ 1523: });
214
+ 1524: }
215
+ 1525: /**
216
+ 1526: * Lightpanda backend 鈥?ensure the managed serve for an activated `lightpanda`
217
+ 1527: * row, then probe its endpoint. The launcher owns launch/reuse/exclusivity
218
+ 1528: * (a live managed Chrome loses the singleton slot to the serve and vice
219
+ 1529: * versa); `engine` is stamped from the ROW 鈥?the source the user picked 鈥?and
220
+ 1530: * `/json/version`'s `Browser: Lightpanda/鈥 merely re-confirms it.
221
+ 1531: */
222
+ 1532: async function refreshLightpandaAttach(input, cache, suggested, link, now) {
223
+ 1533: const base = {
224
+ 1534: ...suggested,
225
+ 1535: targetId: link.id,
226
+ 1536: endpoint: "",
227
+ 1537: wsUrl: "",
228
+ 1538: linkKind: LP_KIND
229
+ 1539: };
230
+ 1540: const launch = await launchLocalBrowser({
231
+ 1541: engine: "lightpanda",
232
+ 1542: lightpandaPath: link.servePath ?? "",
233
+ 1543: lightpandaArgs: input.lightpandaArgs
234
+ 1544: }, input.launcherIo);
235
+ 1545: if (!launch.ok) return cache.patch({
236
+ 1546: ...base,
@@ -0,0 +1,220 @@
1
+ [assistant] 1.2.5 已上架。现在核对 dist-tag,看 latest 是否已经指向它:
2
+ [tool-call pwsh "{\"command\":\"\\\"=== dist-tags ===\\\"\\n& npm view dsh-browser-cdp dist-tags --json --registry=https://registry.npmj]
3
+ ===
4
+ [tool] === dist-tags ===
5
+ {
6
+ "beta-0.2.0": "0.18.21",
7
+ "beta-0.1.7": "0.17.25",
8
+ "dsh-0.1.5": "1.2.0",
9
+ "dsh-0.1.7": "1.2.0",
10
+ "dsh-0.2.0": "1.2.0",
11
+ "dsh-1.1.0": "1.2.5",
12
+ "dsh-0.2.1-rc.2": "1.2.4",
13
+ "latest": "1.2.4"
14
+ }
15
+
16
+ === 1.2.5 元数据 ===
17
+ 发布时间 = 2026-10-20T20:10:29.549Z
18
+ shasum = 8e550108a43372fcce34119ada2d87ed8b0323fb
19
+ integrity= sha512-fIQEeKXvpQvZH9z+MyA2iK8m1yPPZ5s3didrgxlKGPSx60bc6HgpkS+Ct5IUmHfAf23eY6mhdFEds/vCvQzbJA==
20
+ latest = 1.2.4
21
+
22
+ === tarball 探测 ===
23
+ HTTP 200 length=
24
+
25
+ ===
26
+ [assistant] [tool-call pwsh "{\"command\":\"$reg = \\\"https://registry.npmjs.org\\\"\\n\\\"=== 1) latest -> 1.2.5 ===\\\"\\n& npm dist-tag add dsh-]
27
+ ===
28
+ [tool] === 1) latest -> 1.2.5 ===
29
+ +latest: dsh-browser-cdp@1.2.5
30
+ === 2) dsh-0.2.1-rc.2 -> 1.2.5 ===
31
+ +dsh-0.2.1-rc.2: dsh-browser-cdp@1.2.5
32
+ === 3) dsh-1.1.0 复位 -> 1.2.1 ===
33
+ +dsh-1.1.0: dsh-browser-cdp@1.2.1
34
+
35
+ === 结果 ===
36
+ {
37
+ "beta-0.2.0": "0.18.21",
38
+ "beta-0.1.7": "0.17.25",
39
+ "dsh-0.1.5": "1.2.0",
40
+ "dsh-0.2.0": "1.2.0",
41
+ "dsh-0.1.7": "1.2.0",
42
+ "latest": "1.2.5",
43
+ "dsh-0.2.1-rc.2": "1.2.5",
44
+ "dsh-1.1.0": "1.2.1"
45
+ }
46
+
47
+ ===
48
+ [assistant] dist-tags 已经修正:latest 指向 1.2.5,dsh-1.1.0 恢复为 1.2.1。现在把引发问题的 `publishConfig.tag` 一并修掉,并核对 tarball 内容:
49
+ [tool-call pwsh "{\"command\":\"$pj = \\\"E:\\\\test\\\\rewrite-agently\\\\mine-dsh-plugins\\\\dsh-browser-cdp\\\\package.json\\\"\\n\\\]
50
+ ===
51
+ [tool] === publishConfig 段 ===
52
+ "publishConfig": {
53
+ "registry": "https://registry.npmjs.org",
54
+ "tag": "dsh-1.1.0"
55
+ }
56
+ }
57
+
58
+ === 下载 tarball 校验内容 ===
59
+ 下载大小 = 508738 B
60
+ lib/index.js 大小 = 359246
61
+ mergeCliOutput 出现次数 = 12
62
+ 包内 version = 1.2.5
63
+ 与本地构建 SHA256 一致 = True
64
+
65
+ ===
66
+ [assistant] Tarball 校验通过:其中包含 `mergeCliOutput` ×12,版本为 1.2.5,与本地构建的 SHA256 完全一致。现在修掉 `publishConfig.tag` 这个隐患:
67
+ [tool-call apply_patch "{\"patch\":\"*** Begin Patch\\n*** Update File: E:\\\\test\\\\rewrite-agently\\\\mine-dsh-plugins\\\\dsh-browser-cdp\\\]
68
+ [tool-call read "{\"file_path\":\"E:\\\\test\\\\rewrite-agently\\\\.agents\\\\plans\\\\browser-cdp-stderr-merge\\\\checklist.md\"}"]
69
+ ===
70
+ [tool] Applied patch: 1 file(s), 0 added, 1 modified, 0 deleted, +1 -1 lines
71
+ M E:\test\rewrite-agently\mine-dsh-plugins\dsh-browser-cdp\package.json
72
+ ===
73
+ [tool] <path>E:\test\rewrite-agently\.agents\plans\browser-cdp-stderr-merge\checklist.md</path>
74
+ <type>file</type>
75
+ <content>
76
+ 1: # Checklist
77
+ 2:
78
+ 3: > 勾选点位约定:完成时 `- [ ]`→`- [x]`,行尾追加 `✅ <证据/实测值>(YYYY-MM-DD)`;
79
+ 4: > 未过项保持原样,不得预勾。
80
+ 5:
81
+ 6: ## Must Pass
82
+ 7:
83
+ 8: ### 代码层
84
+ 9: - [ ] `mergeCliOutput` 三态正确:仅 stdout / 仅 stderr / 两者都有(顺序 stdout 在前)
85
+ 10: - [ ] `probeCliLink` 在「哨兵只在 stderr」时判 `ok: true`
86
+ 11: - [ ] `probeCliLink` 在「facades 只在 stderr」且 `useSdkPath: true` 时判 `ok: true`
87
+ 12: - [ ] `probeCliLink` 在 stderr 含噪音行 + 哨兵行时仍能取到哨兵
88
+ 13: - [ ] `parseSentinel` 能从合并文本取到 `@@DSH_RESULT@@` 载荷
89
+ 14: - [ ] `parseStatusFacades` 能处理 `\r\n` 行尾
90
+ 15: - [ ] `bcdp_status` 的 facades 来自 stdout+stderr 合并
91
+ 16:
92
+ 17: ### 运行层
93
+ 18: - [ ] `bcdp_status` 返回 `available: true` 且 `facades.taskSpaces === "object"`、`facades.browser === "object"`
94
+ 19: - [ ] `POST /bcdp/api/cdp-status` 的 attach 为 `status: "ready"`、`linkKind: "ego-cli"`、`sdkPath` 非空
95
+ 20: - [ ] `bcdp_navigate https://www.baidu.com` 返回成功且页面标题含「百度」
96
+ 21: - [ ] `bcdp_snapshot` 或 `bcdp_page_info` 能返回真实页面内容
97
+ 22: - [ ] `bcdp_script` 返回的 `output` 字段非空(不再是空串)
98
+ 23:
99
+ 24: ### 工程层
100
+ 25: - [ ] `pnpm run typecheck` 通过(两条 tsconfig 均无错误)
101
+ 26: - [ ] `pnpm test` 全量通过,新增用例全绿
102
+ 27: - [ ] `pnpm run build` 产物成功生成
103
+ 28: - [ ] 仓库 `lib/index.js` 与 profile 副本 SHA256 一致
104
+ 29: - [ ] `package.json` 版本为 `1.2.5`
105
+ 30:
106
+ 31: ## Should Pass
107
+ 32:
108
+ 33: - [ ] `stderr` 的 `maxBytes` / `spill` 已对齐 `cfg.maxOutputBytes`(4 MiB)
109
+ 34: - [ ] 错误文案由 `found on stdout` 改为 `found on stdout/stderr`
110
+ 35: - [ ] 大输出(> 512 KB)不被截断
111
+ 36: - [ ] `bcdp_cli` / `bcdp_script` 的 `stdout` / `stderr` 原始字段语义未被改变
112
+ 37: - [ ] 既有 `cli-link.test.ts` 26 个用例无回归
113
+ 38: - [ ] vendored CLI 路线(输出在 stdout)仍判 ready
114
+ 39: - [ ] `git diff` 仅涉及本计划列出的文件
115
+ 40:
116
+ 41: ## 不可接受
117
+ 42:
118
+ 43: - [ ] 通过只改 profile 副本"修好"(仓库未同步)
119
+ 44: - [ ] 通过放宽判据(例如只查 `exitCode === 0`)让探针通过
120
+ 45: - [ ] 删除或跳过既有测试用例
121
+ 46: - [ ] 修改 `--sdk-path` 拼装逻辑
122
+
123
+ (End of file - total 46 lines)
124
+ </content>
125
+ ===
126
+ [assistant] [tool-call pwsh "{\"command\":\"$repo = \\\"E:\\\\test\\\\rewrite-agently\\\\mine-dsh-plugins\\\\dsh-browser-cdp\\\"\\n\\\"=== git statu]
127
+ ===
128
+ [tool] === git status ===
129
+ M lib/index.js
130
+ M package.json
131
+ M src/cdp/cli-link.ts
132
+ M src/index.ts
133
+ M tests/cli-link.test.ts
134
+ M tests/status-facade.test.ts
135
+ ?? tests/cli-stream-merge.test.ts
136
+
137
+ === diff 文件清单 ===
138
+ lib/index.js
139
+ package.json
140
+ src/cdp/cli-link.ts
141
+ src/index.ts
142
+ tests/cli-link.test.ts
143
+ tests/status-facade.test.ts
144
+
145
+ === 未跟踪新增 ===
146
+ tests/cli-stream-merge.test.ts
147
+ [stderr]
148
+ warning: in the working copy of 'src/index.ts', CRLF will be replaced by LF the next time Git touches it
149
+
150
+ ===
151
+ [assistant] 改动文件都在计划范围内,没有多余文件。现在核对测试文件用例数,用于回写清单:
152
+ [tool-call pwsh "{\"command\":\"cd \\\"E:\\\\test\\\\rewrite-agently\\\\mine-dsh-plugins\\\\dsh-browser-cdp\\\"\\n& pnpm vitest run test]
153
+ ===
154
+ [tool] ✓ tests/cli-link.test.ts (25 tests) 13ms
155
+ ✓ tests/cli-stream-merge.test.ts (9 tests) 5ms
156
+ ✓ tests/status-facade.test.ts (6 tests) 5ms
157
+
158
+
159
+ Test Files 3 passed (3)
160
+ Tests 40 passed (40)
161
+ Start at 04:15:37
162
+ Duration 1.47s (transform 401ms, setup 0ms, collect 1.33s, tests 23ms, environment 1ms, prepare 612ms)
163
+
164
+ [stderr]
165
+ }
166
+ }
167
+
168
+ ===
169
+ [assistant] 需要核实 `cli-link.test.ts` 的用例数:计划里写的是「既有 26 例」,现在总共只有 25 例(含新增的 3 例),原文件应为 22 例。必须确认没有误删:
170
+ [tool-call pwsh "{\"command\":\"cd \\\"E:\\\\test\\\\rewrite-agently\\\\mine-dsh-plugins\\\\dsh-browser-cdp\\\"\\n\\\"=== HEAD 版 it( 数量 ]
171
+ ===
172
+ [tool] === HEAD 版 it( 数量 ===
173
+ HEAD it() = 22
174
+ === 工作区 it( 数量 ===
175
+ work it() = 25
176
+
177
+ === diff 只应新增(无删除行)===
178
+ 39 0 tests/cli-link.test.ts
179
+
180
+ === 被删除的行(应为空)===
181
+
182
+ ===
183
+ [assistant] 确认无误:HEAD 版原本有 22 例,现在有 25 例,diff 为 `+39/-0`,没有删除任何行。计划里写的「26 例」是笔误,实际基线是 22 例。现在回写 checklist:
184
+ [tool-call write "{\"content\":\"# Checklist\\n\\n> 勾选点位约定:完成时 `- [ ]`→`- [x]`,行尾追加 `✅ <证据/实测值>(YYYY-MM-DD)`;\\n> 未过项保持原样,不得预勾。\\n\\n## M]
185
+ ===
186
+ [tool] <path>E:\test\rewrite-agently\.agents\plans\browser-cdp-stderr-merge\checklist.md</path>
187
+ <type>file</type>
188
+ <content>
189
+ Updated file
190
+ </content>
191
+ ===
192
+ [assistant] [tool-call pwsh "{\"command\":\"$repo = \\\"E:\\\\test\\\\rewrite-agently\\\\mine-dsh-plugins\\\\dsh-browser-cdp\\\"\\n\\\"=== 最终一致性核验 =]
193
+ ===
194
+ [tool] === 最终一致性核验 ===
195
+ repo lib SHA256 = 30378B940065431689F4654C8A130C43A384616205FA211DC1F2CE3FFB0C5DAF
196
+ prof lib SHA256 = 30378B940065431689F4654C8A130C43A384616205FA211DC1F2CE3FFB0C5DAF
197
+ 一致 = True
198
+
199
+ === 版本三侧 ===
200
+ repo package.json = 1.2.5
201
+ prof package.json = 1.2.5
202
+ npm latest = 1.2.5
203
+ npm 1.2.5 时间 = 2026-10-20T20:10:29.549Z (本地 04:10:29)
204
+
205
+ === publishConfig 已修 ===
206
+ {"registry":"https://registry.npmjs.org","tag":"latest"}
207
+
208
+ ===
209
+ [assistant] 构建与发布已完成,三侧结果一致。最后提交仓库改动:
210
+ [tool-call pwsh "{\"command\":\"cd \\\"E:\\\\test\\\\rewrite-agently\\\\mine-dsh-plugins\\\\dsh-browser-cdp\\\"\\n\\\"=== remote ===\\\"]
211
+ ===
212
+ [tool] === remote ===
213
+ origin git@github.com:drscrewdriver/dsh-browser-cdp.git (fetch)
214
+ origin git@github.com:drscrewdriver/dsh-browser-cdp.git (push)
215
+
216
+ === 分支与上游 ===
217
+ unified/15rc
218
+ d7b6ebd feat(1.2.4): --sdk-path execution injection, facade status probe, ego-cli gating, schema compression
219
+ 2e9becd fix(1.2.3): issue #1 + #2 — login_import schema fields, import error typing, family-host uSES crash backstop
220
+ 21a7b57 hosts: add 0.2.1-rc.2 (declaration-level enum; 34/34 host peers npm-verified; sync-hosts artifacts; release 1.2.2)
@@ -0,0 +1,140 @@
1
+ [assistant] 需要先核实数字:你担心的「爆炸」和「整合回 16」是否真实,不能只靠口算。
2
+ [tool-call write "{\"content\": \"// 计算每一档注入面的真实 schema 成本(按 1.3.1 的八批策略)\\nimport { readFileSync } from 'node:fs'\\nimport { execFileSyn]
3
+ ===
4
+ [tool] <path>E:\test\rewrite-agently\.tmp-surface.mjs</path>
5
+ <type>file</type>
6
+ <content>
7
+ Created file
8
+ </content>
9
+ ===
10
+ [assistant] [tool-call pwsh "{\"command\": \"& node \\\"E:\\\\test\\\\rewrite-agently\\\\.tmp-surface.mjs\\\" 2>&1\", \"description\": \"Compute rea]
11
+ ===
12
+ [tool] tier count chars
13
+ [stderr]
14
+ node.exe : file:///E:/test/rewrite-agently/.tmp-surface.mjs:45
15
+ 所在位置 行:1 字符: 129
16
+ + ... ::new($false); & node "E:\test\rewrite-agently\.tmp-surface.mjs" 2>&1
17
+ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18
+ + CategoryInfo : NotSpecified: (file:///E:/test...-surface.mjs:45:String) [], RemoteException
19
+ + FullyQualifiedErrorId : NativeCommandError
20
+
21
+ console.log(`${t.padEnd(9)} ${String(cost[t].count).padStart(5)} ${String(cost[t].chars).padStart(6)}`)
22
+ ^
23
+ TypeError: Cannot read properties of undefined (reading 'count')
24
+ at file:///E:/test/rewrite-agently/.tmp-surface.mjs:45:48
25
+ at ModuleJob.run (node:internal/modules/esm/module_job:343:25)
26
+ at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:665:26)
27
+ at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)
28
+ Node.js v22.22.1
29
+ [exit code: 1]
30
+ ===
31
+ [assistant] 我的脚本把 `bcdp_` 前缀拼了两次,现在修正:
32
+ [tool-call apply_patch "{\"patch\": \"*** Begin Patch\\n*** Update File: E:\\\\test\\\\rewrite-agently\\\\.tmp-surface.mjs\\n@@\\n- for (const]
33
+ ===
34
+ [tool] Applied patch: 1 file(s), 0 added, 1 modified, 0 deleted, +1 -1 lines
35
+ M E:\test\rewrite-agently\.tmp-surface.mjs
36
+ ===
37
+ [assistant] [tool-call pwsh "{\"command\": \"& node \\\"E:\\\\test\\\\rewrite-agently\\\\.tmp-surface.mjs\\\" 2>&1\", \"description\": \"Recompute i]
38
+ ===
39
+ [tool] tier count chars
40
+ core 7 2610
41
+ act 8 3823
42
+ observe 4 1663
43
+ wait 4 1695
44
+ power 5 2947
45
+ session 3 1689
46
+ escape 2 1677
47
+ judge 5 3183
48
+
49
+ --- 各档注入面 ---
50
+ 1.2.5 默认(lazy,无活动) 7 tools 2610 chars ≈ 746 tok
51
+ 1.3.1 默认(lazy,无活动)= core + escape 9 tools 4287 chars ≈ 1225 tok
52
+ 1.3.1 首次活动(第1波)= +act +power +session 25 tools 12746 chars ≈ 3642 tok
53
+ 1.3.1 第2波 = +observe 29 tools 14409 chars ≈ 4117 tok
54
+ 1.3.1 第3波 = +wait(全部非评审) 33 tools 16104 chars ≈ 4601 tok
55
+ 1.3.1 全量 38(含评审) 38 tools 19287 chars ≈ 5511 tok
56
+
57
+ ===
58
+ [assistant] 数字已经算出,并且发现一个问题:**我之前报的 escape 1,224 字符是旧数据**。1.3.1 中我加长描述后,它变成 1,677。先修正文档中的陈旧数字:
59
+ [tool-call apply_patch "{\"patch\": \"*** Begin Patch\\n*** Update File: E:\\\\test\\\\rewrite-agently\\\\mine-dsh-plugins\\\\dsh-browser-cdp\\]
60
+ ===
61
+ [tool] Error: Hunk 3 of "E:\test\rewrite-agently\mine-dsh-plugins\dsh-browser-cdp\README.md" does not apply: the context does not match the file.
62
+ Search started at line 235.
63
+ Expected lines:
64
+ |[space]合计[space]|[space]38[space]|[space]18,834[space]|[space]100%[space]|[space]—[space]|
65
+ File around the search origin:
66
+ |[space]**judge**[space]评审链(5)[space]|[space]`bcdp_jev_*`[space]|[space]3,183[space]|[space]除解锁外,**还要求配了[space]JEV[space]或[space]Laya[space]Key**[space]|
67
+ [empty]
68
+ 设置项在插件设置页**最上方**的「工具封印」分块(全部[space]volatile,翻完当场生效,不重启插件)——一个开关管一组批次,形状照[space]dsh-prime-memory[space]的「工具封印」:
69
+ [empty]
70
+ -[space]**`toolInjection`**[space]`lazy`(**默认**:常驻[space]core[space]+[space]escape,其余首次[space]`bcdp_*`[space]调用后按开关注入)/[space]`always`(挂载即全量,历史行为)。
71
+ -[space]**`toolBrowse`**(act[space]+[space]observe[space]+[space]wait[space]=[space]16)/[space]**`toolExtended`**(power[space]+[space]session[space]=[space]8)/[space]**`toolEscape`**(cli[space]+[space]script[space]=[space]2)/[space]**`toolJudge`**(5):开[space]=[space]开放注册,关[space]=[space]该批从模型工具列表移除。四组各自独立,封一组不波及别组;`core`[space]级不给开关(封了就没了活动入口)。
72
+ [empty]
73
+ **escape[space]批为什么单独成组、且不等活动**:`cli`[space]/[space]`script`[space]是唯一能在一次调用里干完任意多步任务的入口(`page`[space]/[space]`browser`[space]/[space]`taskSpaces`[space]/[space]`fetch`[space]/[space]`cdp`[space]全预置),其余[space]36[space]个工具能做的事它都能做。所以它必须始终可达——否则模型遇到「结构化工具没覆盖」的情形时手里没有任何逃生手段。这也让它成为**按需只开逃生舱**的合法姿势:关掉[space]`toolExtended`、留着[space]`toolEscape`,只留[space]2[space]个工具。
74
+ [empty]
75
+ 行为要点:
76
+ ===
77
+ [assistant] [tool-call read "{\"file_path\": \"E:\\\\test\\\\rewrite-agently\\\\mine-dsh-plugins\\\\dsh-browser-cdp\\\\README.md\", \"limit\": 14, \]
78
+ ===
79
+ [tool] <path>E:\test\rewrite-agently\mine-dsh-plugins\dsh-browser-cdp\README.md</path>
80
+ <type>file</type>
81
+ <content>
82
+ 224: 38 个工具全量注册时,**每个会话每一轮**都要为它们的 schema 付费(AST 实测 `description` + `parameters` ≈ 18.8K 字符 ≈ 5.4K token),而不碰浏览器的会话一个也用不上。插件因此把「谁能出现在模型面前」收成一处策略(`src/toolTiers.ts`),分**八批**注入:
83
+ 225:
84
+ 226: | 批次 | 成员 | schema | 何时出现 |
85
+ 227: |---|---|---:|---|
86
+ 228: | **core** 常驻(7) | `bcdp_status` `bcdp_doctor` `bcdp_help` `bcdp_space_open` `bcdp_space_close` `bcdp_navigate` `bcdp_snapshot` | 2,610 | 永远在场,不可封印——否则 lazy 模式连解锁入口都没有 |
87
+ 229: | **act** 动手(8) | click / fill / key / hover / scroll / select / check / drag | 3,823 | `lazy` 下首次活动放第一波 |
88
+ 230: | **observe** 观察(4) | screenshot / page_info / read_element / js | 1,663 | 第二次活动 |
89
+ 231: | **wait** 等待(4) | wait / wait_for_selector / wait_for_url / wait_for_response | 1,695 | 第三次活动 |
90
+ 232: | **power** 重量级(5) | raw CDP / http / upload / download / dialog | 2,947 | 首次活动(同 `toolExtended`) |
91
+ 233: | **session** 登录态(3) | captcha / auth_flush / login_import | 1,689 | 首次活动(同 `toolExtended`) |
92
+ 234: | **escape** 逃生舱(2) | cli / script | 1,224 | **冷启动即在**,不吃活动闸(见下) |
93
+ 235: | **judge** 评审链(5) | `bcdp_jev_*` | 3,183 | 除解锁外,**还要求配了 JEV 或 Laya Key** |
94
+ 236:
95
+ 237: 设置项在插件设置页**最上方**的「工具封印」分块(全部 volatile,翻完当场生效,不重启插件)——一个开关管一组批次,形状照 dsh-prime-memory 的「工具封印」:
96
+
97
+ (Showing lines 224-237 of 357. Use offset=238 to continue.)
98
+ </content>
99
+ ===
100
+ [assistant] [tool-call apply_patch "{\"patch\": \"*** Begin Patch\\n*** Update File: E:\\\\test\\\\rewrite-agently\\\\mine-dsh-plugins\\\\dsh-browser-cdp\\]
101
+ ===
102
+ [tool] Applied patch: 1 file(s), 0 added, 1 modified, 0 deleted, +5 -2 lines
103
+ M E:\test\rewrite-agently\mine-dsh-plugins\dsh-browser-cdp\README.md
104
+ ===
105
+ [assistant] [tool-call pwsh "{\"command\": \"$repo = \\\"E:\\\\test\\\\rewrite-agently\\\\mine-dsh-plugins\\\\dsh-browser-cdp\\\"\\n\\\"=== README 默]
106
+ ===
107
+ [tool] === README 默认档数字核对 ===
108
+ L252 - 当前注入面写在 `bcdp_doctor` 报告首行(`tool injection: mode=lazy browse=open extended=open escape=open judge=open judgeKey=none active=no → live 9 / sealed 29`),不用猜。
109
+ L253 - 默认档下不碰浏览器的会话只有 **9** 个工具在场(core 7 + escape 2 ≈ 3.8K 字符,−79.6%);要回到历史行为把 `toolInjection` 改成 `always`(38 件全在场需再配一个评审 Key)。
110
+
111
+ ===
112
+ [assistant] [tool-call apply_patch "{\"patch\": \"*** Begin Patch\\n*** Update File: E:\\\\test\\\\rewrite-agently\\\\mine-dsh-plugins\\\\dsh-browser-cdp\\]
113
+ ===
114
+ [tool] Applied patch: 1 file(s), 0 added, 1 modified, 0 deleted, +2 -1 lines
115
+ M E:\test\rewrite-agently\mine-dsh-plugins\dsh-browser-cdp\README.md
116
+ ===
117
+ [assistant] [tool-call apply_patch "{\"patch\": \"*** Begin Patch\\n*** Update File: E:\\\\test\\\\rewrite-agently\\\\ego-browser-cdp-issues.md\\n@@\\n-| 批]
118
+ ===
119
+ [tool] Applied patch: 1 file(s), 0 added, 1 modified, 0 deleted, +24 -12 lines
120
+ M E:\test\rewrite-agently\ego-browser-cdp-issues.md
121
+ ===
122
+ [assistant] 文档已经修正。现在核对“整合回 16”是否复原到旧状态,并确认分批放行是否真的生效:
123
+ [tool-call pwsh "{\"command\": \"cd \\\"E:\\\\test\\\\rewrite-agently\\\\mine-dsh-plugins\\\\dsh-browser-cdp\\\"\\n\\\"=== 1.2.5 的 brows]
124
+ ===
125
+ [tool] === 1.2.5 的 browse 是 13 个,1.3.1 的三批并集是 16 个:差在哪 ===
126
+ 旧 browse 13 = 0
127
+ 新 browse 并集 = 16
128
+ 新进 browse 的 = bcdp_click, bcdp_fill, bcdp_key, bcdp_hover, bcdp_scroll, bcdp_select, bcdp_check, bcdp_drag, bcdp_screenshot, bcdp_page_info, bcdp_read_element, bcdp_js, bcdp_wait, bcdp_wait_for_selector, bcdp_wait_for_url, bcdp_wait_for_response
129
+ 仍在 extended 的 = 8 (旧 extended 13)
130
+ 总数不变 = 38
131
+
132
+ ===
133
+ [assistant] 脚本里 git 的那部分没有取到旧表(返回 0,明显是解析问题)。我直接核对旧表:
134
+ [tool-call pwsh "{\"command\": \"cd \\\"E:\\\\test\\\\rewrite-agently\\\\mine-dsh-plugins\\\\dsh-browser-cdp\\\"\\ngit show 73ad3f7:src/]
135
+ ===
136
+ [tool] === 旧表成员数 ===
137
+ CORE 0
138
+ BROWSE 0
139
+ EXTENDED 0
140
+ JUDGE 0