dsh-browser-cdp 0.0.1 → 0.17.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/LICENSE +27 -0
- package/README.md +279 -9
- package/THIRD_PARTY_NOTICES.md +62 -0
- package/bin/cdp-cast-worker.mjs +6960 -0
- package/bin/cdp-chrome-wrapper.sh +53 -0
- package/bin/cdp-render-worker.mjs +610 -0
- package/bin/record-normalize.d.mts +32 -0
- package/bin/record-normalize.mjs +156 -0
- package/cordis.patch.yml +17 -0
- package/dsh-plugin.json +148 -0
- package/lib/client.js +3235 -0
- package/lib/index.js +8865 -0
- package/lib/launcher-CQyI8-By.js +3 -0
- package/lib/launcher-DBaxfIsF.js +269 -0
- package/package.json +89 -14
- package/runtime/PATCHES.md +30 -0
- package/runtime/ego-browser/dist/out/index.js +7206 -0
- package/runtime/ego-browser/screenshot-clip.d.mts +22 -0
- package/runtime/ego-browser/screenshot-clip.mjs +45 -0
- package/runtime/ego-linux/bin/ego-browser.mjs +399 -0
- package/runtime/ego-linux/src/agent-identity.mjs +65 -0
- package/runtime/ego-linux/src/chrome.mjs +867 -0
- package/runtime/ego-linux/src/cursor.mjs +1292 -0
- package/runtime/ego-linux/src/desktop.mjs +73 -0
- package/runtime/ego-linux/src/paths.mjs +35 -0
- package/runtime/ego-linux/src/session.mjs +37 -0
- package/runtime/ego-linux/src/shim.mjs +145 -0
- package/runtime/ego-linux/src/snapshot.mjs +424 -0
- package/runtime/ego-linux/src/spaces-server.mjs +355 -0
- package/runtime/ego-linux/src/spaces-ui.mjs +456 -0
- package/runtime/ego-linux/src/tabs.mjs +109 -0
- package/runtime/ego-linux/src/task-spaces.mjs +671 -0
- package/runtime/ego-linux/src/transport.mjs +321 -0
- package/runtime/ego-linux/src/window-fit.mjs +107 -0
- package/runtime/skills/ego-browser/SKILL.md +209 -0
- package/runtime/skills/ego-browser/agents/openai.yaml +7 -0
- package/runtime/skills/ego-browser/assets/composer-icon.png +0 -0
- package/runtime/skills/ego-browser/assets/logo.png +0 -0
- package/runtime/skills/ego-browser/learnings/google/browser-tools/autocomplete.js +11 -0
- package/runtime/skills/ego-browser/learnings/google/manifest.json +40 -0
- package/runtime/skills/ego-browser/learnings/google/notes/overview.md +23 -0
- package/runtime/skills/ego-browser/learnings/google/tools/search-extract.js +35 -0
- package/runtime/skills/ego-browser/learnings/x-com/browser-tools/extract-post.js +9 -0
- package/runtime/skills/ego-browser/learnings/x-com/manifest.json +51 -0
- package/runtime/skills/ego-browser/learnings/x-com/notes/overview.md +18 -0
- package/runtime/skills/ego-browser/learnings/x-com/notes/timeline.md +19 -0
- package/runtime/skills/ego-browser/learnings/x-com/tools/search-users.js +33 -0
- package/runtime/skills/ego-browser/learnings/x-com/tools/timeline.js +32 -0
- package/runtime/skills/ego-browser/references/install.md +131 -0
- package/runtime/skills/ego-browser/references/task-spaces.md +122 -0
- package/runtime/skills/ego-browser/references/video.md +17 -0
- package/runtime/skills/ego-browser/scripts/install.sh +309 -0
- package/index.js +0 -11
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as launchLocalBrowser, i as discoverChromeBinary, n as defaultLauncherStatePath, o as localBrowserInfo, r as defaultManagedProfileDir, s as stopLocalBrowser, t as buildLaunchArgs } from "./launcher-DBaxfIsF.js";
|
|
2
|
+
|
|
3
|
+
export { buildLaunchArgs, defaultLauncherStatePath, defaultManagedProfileDir, discoverChromeBinary, launchLocalBrowser, localBrowserInfo, stopLocalBrowser };
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { createServer } from "node:net";
|
|
6
|
+
|
|
7
|
+
//#region src/cdp/launcher.ts
|
|
8
|
+
const defaultIo = () => ({
|
|
9
|
+
exists: (path) => existsSync(path),
|
|
10
|
+
readFile: (path) => readFileSync(path, "utf8"),
|
|
11
|
+
writeFile: (path, data) => {
|
|
12
|
+
mkdirSync(join(path, ".."), { recursive: true });
|
|
13
|
+
writeFileSync(path, data, "utf8");
|
|
14
|
+
},
|
|
15
|
+
removeFile: (path) => {
|
|
16
|
+
try {
|
|
17
|
+
rmSync(path);
|
|
18
|
+
} catch {}
|
|
19
|
+
},
|
|
20
|
+
isAlive: (pid) => {
|
|
21
|
+
try {
|
|
22
|
+
process.kill(pid, 0);
|
|
23
|
+
return true;
|
|
24
|
+
} catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
killTree: (pid) => {
|
|
29
|
+
if (process.platform === "win32") {
|
|
30
|
+
try {
|
|
31
|
+
spawn("taskkill", [
|
|
32
|
+
"/PID",
|
|
33
|
+
String(pid),
|
|
34
|
+
"/T",
|
|
35
|
+
"/F"
|
|
36
|
+
], { stdio: "ignore" });
|
|
37
|
+
} catch {}
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
process.kill(pid, "SIGKILL");
|
|
42
|
+
} catch {}
|
|
43
|
+
},
|
|
44
|
+
spawn: (bin, args) => {
|
|
45
|
+
const child = spawn(bin, args, {
|
|
46
|
+
detached: true,
|
|
47
|
+
stdio: "ignore"
|
|
48
|
+
});
|
|
49
|
+
child.unref();
|
|
50
|
+
return { pid: child.pid ?? 0 };
|
|
51
|
+
},
|
|
52
|
+
fetchVersion: async (url) => {
|
|
53
|
+
return { ok: (await fetch(url)).ok };
|
|
54
|
+
},
|
|
55
|
+
now: () => Date.now(),
|
|
56
|
+
sleep: (ms) => new Promise((resolve$1) => setTimeout(resolve$1, ms)),
|
|
57
|
+
makePort: async () => {
|
|
58
|
+
const server = createServer();
|
|
59
|
+
const port = await new Promise((resolve$1, reject) => {
|
|
60
|
+
server.once("error", reject);
|
|
61
|
+
server.listen(0, "127.0.0.1", () => {
|
|
62
|
+
const address = server.address();
|
|
63
|
+
if (address && typeof address === "object") resolve$1(address.port);
|
|
64
|
+
else reject(/* @__PURE__ */ new Error("no port"));
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
server.close();
|
|
68
|
+
return port;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
const PLATFORM_CANDIDATES = {
|
|
72
|
+
win32: [
|
|
73
|
+
"C:/Program Files/Google/Chrome/Application/chrome.exe",
|
|
74
|
+
"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe",
|
|
75
|
+
"C:/Program Files/Microsoft/Edge/Application/msedge.exe"
|
|
76
|
+
],
|
|
77
|
+
darwin: ["/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"],
|
|
78
|
+
linux: [
|
|
79
|
+
"/usr/bin/google-chrome",
|
|
80
|
+
"/usr/bin/google-chrome-stable",
|
|
81
|
+
"/usr/bin/chromium",
|
|
82
|
+
"/usr/bin/chromium-browser"
|
|
83
|
+
]
|
|
84
|
+
};
|
|
85
|
+
function discoverChromeBinary(explicit, platform, exists) {
|
|
86
|
+
if (explicit !== "") return exists(explicit) ? explicit : "";
|
|
87
|
+
for (const candidate of PLATFORM_CANDIDATES[platform] ?? []) if (exists(candidate)) return candidate;
|
|
88
|
+
return "";
|
|
89
|
+
}
|
|
90
|
+
/** Flags the user must never smuggle into the managed launch. */
|
|
91
|
+
const BLOCKED_ARGS = [
|
|
92
|
+
"--user-data-dir",
|
|
93
|
+
"--remote-debugging-port",
|
|
94
|
+
"--remote-allow-origins",
|
|
95
|
+
"--no-startup-window",
|
|
96
|
+
"--proxy-server",
|
|
97
|
+
"--headless"
|
|
98
|
+
];
|
|
99
|
+
function buildLaunchArgs(options) {
|
|
100
|
+
const userArgs = (options.chromeArgs ?? "").split(/\s+/).map((arg) => arg.trim()).filter((arg) => arg !== "").filter((arg) => !BLOCKED_ARGS.some((blocked) => arg === blocked || arg.startsWith(`${blocked}=`) || arg.startsWith(`${blocked} `)));
|
|
101
|
+
return [
|
|
102
|
+
`--remote-debugging-port=${options.port}`,
|
|
103
|
+
`--user-data-dir=${options.userDataDir}`,
|
|
104
|
+
"--no-first-run",
|
|
105
|
+
"--no-default-browser-check",
|
|
106
|
+
"--remote-allow-origins=*",
|
|
107
|
+
...options.headless ? ["--headless=new"] : [],
|
|
108
|
+
...userArgs
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
function defaultLauncherStatePath() {
|
|
112
|
+
return join(homedir(), ".dsh", "cache", "dsh-browser-cdp", "launcher.json");
|
|
113
|
+
}
|
|
114
|
+
function defaultManagedProfileDir() {
|
|
115
|
+
return join(homedir(), ".dsh", "cache", "dsh-browser-cdp", "chrome-profile");
|
|
116
|
+
}
|
|
117
|
+
function readRecord(path, io) {
|
|
118
|
+
if (!io.exists(path)) return null;
|
|
119
|
+
try {
|
|
120
|
+
const parsed = JSON.parse(io.readFile(path));
|
|
121
|
+
if (typeof parsed.pid !== "number" || typeof parsed.port !== "number") return null;
|
|
122
|
+
return {
|
|
123
|
+
pid: parsed.pid,
|
|
124
|
+
port: parsed.port,
|
|
125
|
+
userDataDir: typeof parsed.userDataDir === "string" ? parsed.userDataDir : "",
|
|
126
|
+
endpoint: typeof parsed.endpoint === "string" ? parsed.endpoint : "",
|
|
127
|
+
startedAt: typeof parsed.startedAt === "number" ? parsed.startedAt : 0
|
|
128
|
+
};
|
|
129
|
+
} catch {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Launch (or reuse) the managed local browser. The readiness gate is the
|
|
135
|
+
* three-step check from T2.12: process alive → port responds → `/json/version`
|
|
136
|
+
* returns 200. `timeoutMs` bounds the readiness wait (default 20s).
|
|
137
|
+
*/
|
|
138
|
+
async function launchLocalBrowser(options, io) {
|
|
139
|
+
const ioImpl = {
|
|
140
|
+
...defaultIo(),
|
|
141
|
+
...io ?? {}
|
|
142
|
+
};
|
|
143
|
+
const now = ioImpl.now;
|
|
144
|
+
const sleep = ioImpl.sleep;
|
|
145
|
+
const statePath = options.statePath ?? defaultLauncherStatePath();
|
|
146
|
+
const record = readRecord(statePath, ioImpl);
|
|
147
|
+
if (record && ioImpl.isAlive(record.pid) && (await ioImpl.fetchVersion(`http://127.0.0.1:${record.port}/json/version`)).ok) return {
|
|
148
|
+
ok: true,
|
|
149
|
+
reused: true,
|
|
150
|
+
endpoint: record.endpoint,
|
|
151
|
+
pid: record.pid,
|
|
152
|
+
port: record.port
|
|
153
|
+
};
|
|
154
|
+
const platform = options.platform ?? process.platform;
|
|
155
|
+
const bin = discoverChromeBinary(options.chromePath ?? "", platform, ioImpl.exists);
|
|
156
|
+
if (bin === "") return {
|
|
157
|
+
ok: false,
|
|
158
|
+
code: "chrome-not-found",
|
|
159
|
+
message: "No Chrome/Chromium/Edge binary found. Set chromePath in the settings panel."
|
|
160
|
+
};
|
|
161
|
+
const userDataDir = options.userDataDir && options.userDataDir !== "" ? options.userDataDir : defaultManagedProfileDir();
|
|
162
|
+
const port = await ioImpl.makePort();
|
|
163
|
+
const args = buildLaunchArgs({
|
|
164
|
+
userDataDir,
|
|
165
|
+
port,
|
|
166
|
+
headless: options.localHeadless === true,
|
|
167
|
+
chromeArgs: options.chromeArgs
|
|
168
|
+
});
|
|
169
|
+
let pid = 0;
|
|
170
|
+
try {
|
|
171
|
+
pid = ioImpl.spawn(bin, args).pid;
|
|
172
|
+
} catch (error) {
|
|
173
|
+
return {
|
|
174
|
+
ok: false,
|
|
175
|
+
code: "spawn-failed",
|
|
176
|
+
message: String(error.message ?? error)
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
if (!pid) return {
|
|
180
|
+
ok: false,
|
|
181
|
+
code: "spawn-failed",
|
|
182
|
+
message: "spawn returned no pid"
|
|
183
|
+
};
|
|
184
|
+
const endpoint = `http://127.0.0.1:${port}`;
|
|
185
|
+
const deadline = now() + (options.timeoutMs ?? 2e4);
|
|
186
|
+
for (;;) {
|
|
187
|
+
if (!ioImpl.isAlive(pid)) return {
|
|
188
|
+
ok: false,
|
|
189
|
+
code: "launch-exited",
|
|
190
|
+
message: `chrome exited before opening the debugging port (pid ${pid})`
|
|
191
|
+
};
|
|
192
|
+
let versionOk = false;
|
|
193
|
+
try {
|
|
194
|
+
versionOk = (await ioImpl.fetchVersion(`${endpoint}/json/version`)).ok;
|
|
195
|
+
} catch {}
|
|
196
|
+
if (versionOk) break;
|
|
197
|
+
if (now() >= deadline) {
|
|
198
|
+
ioImpl.killTree(pid);
|
|
199
|
+
ioImpl.removeFile(statePath);
|
|
200
|
+
return {
|
|
201
|
+
ok: false,
|
|
202
|
+
code: "not-ready",
|
|
203
|
+
message: `chrome did not answer ${endpoint}/json/version within the readiness window`
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
await sleep(250);
|
|
207
|
+
}
|
|
208
|
+
ioImpl.writeFile(statePath, JSON.stringify({
|
|
209
|
+
pid,
|
|
210
|
+
port,
|
|
211
|
+
userDataDir,
|
|
212
|
+
endpoint,
|
|
213
|
+
startedAt: now(),
|
|
214
|
+
headless: options.localHeadless === true
|
|
215
|
+
}, null, 2));
|
|
216
|
+
return {
|
|
217
|
+
ok: true,
|
|
218
|
+
reused: false,
|
|
219
|
+
endpoint,
|
|
220
|
+
pid,
|
|
221
|
+
port
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Stop the managed instance: kill-tree, wait for the pid to disappear, drop
|
|
226
|
+
* the registry entry. T2.14 — the reaper and plugin unmount both call this.
|
|
227
|
+
*/
|
|
228
|
+
async function stopLocalBrowser(options = {}, io) {
|
|
229
|
+
const ioImpl = {
|
|
230
|
+
...defaultIo(),
|
|
231
|
+
...io ?? {}
|
|
232
|
+
};
|
|
233
|
+
const statePath = options.statePath ?? defaultLauncherStatePath();
|
|
234
|
+
const record = readRecord(statePath, ioImpl);
|
|
235
|
+
if (!record) return {
|
|
236
|
+
ok: true,
|
|
237
|
+
code: "not-running"
|
|
238
|
+
};
|
|
239
|
+
if (ioImpl.isAlive(record.pid)) {
|
|
240
|
+
ioImpl.killTree(record.pid);
|
|
241
|
+
const deadline = ioImpl.now() + (options.graceMs ?? 5e3);
|
|
242
|
+
while (ioImpl.isAlive(record.pid) && ioImpl.now() < deadline) await ioImpl.sleep(100);
|
|
243
|
+
if (ioImpl.isAlive(record.pid)) return {
|
|
244
|
+
ok: false,
|
|
245
|
+
code: "stop-timeout"
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
ioImpl.removeFile(statePath);
|
|
249
|
+
return {
|
|
250
|
+
ok: true,
|
|
251
|
+
code: "stopped"
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
/** Is a managed local browser alive right now? (reaper + doctor helper) */
|
|
255
|
+
function localBrowserInfo(statePath, io) {
|
|
256
|
+
const ioImpl = {
|
|
257
|
+
...defaultIo(),
|
|
258
|
+
...io ?? {}
|
|
259
|
+
};
|
|
260
|
+
const record = readRecord(statePath ?? defaultLauncherStatePath(), ioImpl);
|
|
261
|
+
if (!record || !ioImpl.isAlive(record.pid)) return null;
|
|
262
|
+
return {
|
|
263
|
+
endpoint: record.endpoint,
|
|
264
|
+
pid: record.pid
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
//#endregion
|
|
269
|
+
export { launchLocalBrowser as a, discoverChromeBinary as i, defaultLauncherStatePath as n, localBrowserInfo as o, defaultManagedProfileDir as r, stopLocalBrowser as s, buildLaunchArgs as t };
|
package/package.json
CHANGED
|
@@ -1,23 +1,98 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-browser-cdp",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "DSH browser plugin — attach to a running Chrome/Edge over CDP (
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
],
|
|
3
|
+
"version": "0.17.0",
|
|
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+ line: declarative settings via Config .volatile() fields; for DSH 0.1.2-rc.1 ~ 0.1.6 use the 0.16.x line]",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./lib/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./lib/index.js",
|
|
9
|
+
"./client": "./lib/client.js",
|
|
10
|
+
"./dsh-plugin.json": "./dsh-plugin.json",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
14
13
|
"files": [
|
|
15
|
-
"
|
|
16
|
-
"
|
|
14
|
+
"lib/",
|
|
15
|
+
"bin/",
|
|
16
|
+
"runtime/",
|
|
17
|
+
"cordis.patch.yml",
|
|
18
|
+
"dsh-plugin.json",
|
|
19
|
+
"THIRD_PARTY_NOTICES.md",
|
|
20
|
+
"!**/*.map"
|
|
17
21
|
],
|
|
18
|
-
"
|
|
22
|
+
"dsh": {
|
|
23
|
+
"engines": {
|
|
24
|
+
"dsh": ">=0.1.7-rc.1 <0.2.0-0"
|
|
25
|
+
},
|
|
26
|
+
"bundle": {
|
|
27
|
+
"patch": "./cordis.patch.yml"
|
|
28
|
+
},
|
|
29
|
+
"client": {
|
|
30
|
+
"platform": "web",
|
|
31
|
+
"inject": []
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.client.json",
|
|
36
|
+
"test": "vitest run",
|
|
37
|
+
"build": "tsdown -c tsdown.config.ts"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@deepseek-ai/schemastery": "^3.18.4"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@deepseek-ai/dsh-client-locale": ">=0.1.7-rc.1 <0.2.0-0",
|
|
44
|
+
"@deepseek-ai/dsh-client-store": ">=0.1.7-rc.1 <0.2.0-0",
|
|
45
|
+
"@deepseek-ai/dsh-client-ui-settings-plugins": ">=0.1.7-rc.1 <0.2.0-0",
|
|
46
|
+
"@deepseek-ai/dsh-client-ui-slots": ">=0.1.7-rc.1 <0.2.0-0",
|
|
47
|
+
"@deepseek-ai/dsh-settings": ">=0.1.7-rc.1 <0.2.0-0",
|
|
48
|
+
"@deepseek-ai/dsh-tools": ">=0.1.7-rc.1 <0.2.0-0",
|
|
49
|
+
"react": "^18.2.0"
|
|
50
|
+
},
|
|
51
|
+
"peerDependenciesMeta": {
|
|
52
|
+
"@deepseek-ai/dsh-client-locale": {
|
|
53
|
+
"optional": true
|
|
54
|
+
},
|
|
55
|
+
"@deepseek-ai/dsh-client-store": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-settings-plugins": {
|
|
59
|
+
"optional": true
|
|
60
|
+
},
|
|
61
|
+
"@deepseek-ai/dsh-client-ui-slots": {
|
|
62
|
+
"optional": true
|
|
63
|
+
},
|
|
64
|
+
"@deepseek-ai/dsh-settings": {
|
|
65
|
+
"optional": true
|
|
66
|
+
},
|
|
67
|
+
"@deepseek-ai/dsh-tools": {
|
|
68
|
+
"optional": true
|
|
69
|
+
},
|
|
70
|
+
"react": {
|
|
71
|
+
"optional": true
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@deepseek-ai/cosmokit": "^1.8.5",
|
|
76
|
+
"@deepseek-ai/dsh-tools": ">=0.1.7-rc.1 <0.2.0-0",
|
|
77
|
+
"@types/node": "^22.20.1",
|
|
78
|
+
"@types/react": "~18.3.31",
|
|
79
|
+
"@types/ws": "^8.5.10",
|
|
80
|
+
"jsdom": "^26.0.0",
|
|
81
|
+
"tsdown": "^0.15.0",
|
|
82
|
+
"typescript": "^5.9.0",
|
|
83
|
+
"vitest": "^3.2.0",
|
|
84
|
+
"ws": "^8.18.0",
|
|
85
|
+
"@deepseek-ai/dsh-sandbox": "^0.1.7-rc.1"
|
|
86
|
+
},
|
|
87
|
+
"engines": {
|
|
88
|
+
"node": ">=22"
|
|
89
|
+
},
|
|
90
|
+
"license": "MIT",
|
|
19
91
|
"repository": {
|
|
20
92
|
"type": "git",
|
|
21
93
|
"url": "git+https://github.com/drscrewdriver/dsh-browser-cdp.git"
|
|
94
|
+
},
|
|
95
|
+
"publishConfig": {
|
|
96
|
+
"tag": "dsh-0.1.7"
|
|
22
97
|
}
|
|
23
98
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# runtime/ — vendored 运行时本地改动记录
|
|
2
|
+
|
|
3
|
+
本目录来自 [CitroLabs/ego-lite](https://github.com/CitroLabs/ego-lite)(MIT,含 Linux 移植 PR #234
|
|
4
|
+
与本地代理补丁),在首次 vendoring 提交 `a77dee4` 时整体引入。**只读参照**为主。
|
|
5
|
+
|
|
6
|
+
> 排查/跟进上游前先看这里:如果一项改动只在下面列出,说明它相对上游是我们或本仓库维护引入的;
|
|
7
|
+
> 没列出的文件 = 与 vendored 时一致(它们可能本就是这个 Linux 移植自带的本地化)。
|
|
8
|
+
|
|
9
|
+
## 明确的本地改动(相对 vendored 基线)
|
|
10
|
+
|
|
11
|
+
| 文件 | 改动 | 原因 / 提交 |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `runtime/ego-linux/src/cursor.mjs` | 光标覆盖层默认名 `Claude` → `DeepSeek`(4 处:默认值 + 注释) | 品牌统一,`dacbd47` |
|
|
14
|
+
| `runtime/ego-linux/src/chrome.mjs` | `resolveBinary()`: `candidate.includes("/")` → `isAbsolute(candidate)`;`which()`: Windows 用 `where` 替代 `which` | Windows 支持:POSIX `includes("/")` 不识别 `C:\\` 路径,`which` 在 Windows 不存在 |
|
|
15
|
+
| `runtime/ego-linux/src/chrome.mjs` | `LAUNCH_FLAGS` 加 `--no-startup-window`;`launch()` 删除 `"about:blank"` 位置参数 | 消除单次 `ego_space_open` 开两个窗口:原位置参数在默认 browser context 开残留 tab,space tab 走独立 context 又开一个窗口,Chrome 把不同 context 隔离到不同窗口 → 用户看到两窗。`useSpace+ensureRealTab` 路由下不再需要 launch 残留 tab |
|
|
16
|
+
| `runtime/ego-linux/src/chrome.mjs` | `launch()` 的 `args` 末尾 spread `filterChromeArgs(process.env.EGO_LINUX_EXTRA_ARGS ?? "")`;新增模块内 `CHROME_BLOCKED` 集合 + `tokenizeArgs`/`filterChromeArgs` 函数(与 `lib/config.js` 镜像,runtime 不 import lib/) | 用户自定义 Chrome 启动参数(设置字段 `chromeArgs`):插件 `resolveEgoEnv` 把 `chromeArgs` 桥接到 `EGO_LINUX_EXTRA_ARGS`,runtime 切分 + 拉黑控制面标志(`--user-data-dir`/`--remote-debugging-port`/`--headless`/`--proxy-server` 等)后 spread 进 Chrome argv。仅浏览器下次冷启动生效 |
|
|
17
|
+
| `runtime/ego-linux/src/paths.mjs` | Windows 用 `%LOCALAPPDATA%\\ego-lite-linux` 作为 DATA_DIR / STATE_DIR;`CHROME_CONFIG_CANDIDATES` 加 Windows 路径 | Windows 支持:XDG 变量在 Windows 不存在;`ego_doctor` 已预期 `%LOCALAPPDATA%` |
|
|
18
|
+
| `runtime/ego-linux/bin/ego-browser.mjs` | headless 判定加 `hasDisplay`:有可用 X display(如 Xvfb)时忽略继承的 `EGO_LINUX_HEADLESS=1`,跑 headed | watch 面板全帧率 + ffmpeg x11grab 后端能抓到画面:headless 走 swiftshader ~1fps 且不渲染到 X display(x11grab 抓黑屏)。PR #10 曾回退此逻辑(只认 env),已重新移植(2026-08-18) |
|
|
19
|
+
| `runtime/ego-linux/bin/ego-browser.mjs` | 显式 `EGO_LINUX_HEADLESS=1/true/yes/on` 现在优先于 `hasDisplay` 推断(含 win32);未设置时维持原 hasDisplay 逻辑 | issue #35:此前 win32 硬编码 `hasDisplay=true` 导致显式设置的环境变量被静默忽略,与 CLI help / README 文档矛盾 |
|
|
20
|
+
| `runtime/ego-linux/src/task-spaces.mjs` | `createSeededContext()` 增加 `EGO_ISOLATE_SPACES` 环境变量开关支持;未开启(默认)时返回 `null` 复用磁盘 Profile,开启时保留原作者内存沙盒隔离 | 登录态持久化与沙盒隔离双模可配:用户在设置中选择是否开启空间隔离;默认关闭时所有登录态直接落盘,跨关机重启永久保留,开启时恢复独立内存沙盒 |
|
|
21
|
+
| `runtime/ego-browser/screenshot-clip.mjs` + `runtime/ego-browser/dist/out/index.js` `screenshot()` | viewport / locator 截图的 CDP clip 原点改为 `pageInfo().sx/sy`(`scrollX/scrollY`),不再固定 `{x:0,y:0}`;fullPage 仍从文档原点截整页 | CDP clip 是文档坐标且默认 `captureBeyondViewport:false`:滚动后 clip 落在未绘制区域会得到空白 PNG。与 `spaces-server.mjs` followClip 同一约定 |
|
|
22
|
+
| (其余 runtime 文件)| 与 vendoring 时一致 | 无后续本地改动 |
|
|
23
|
+
|
|
24
|
+
## 说明
|
|
25
|
+
- `chrome.mjs` 里的代理支持(`EGO_LINUX_PROXY`)在首次 vendoring 时已包含(本 Linux 移植特性),
|
|
26
|
+
非后续本地改动;如需调整走它。
|
|
27
|
+
- **同步提醒**:`lib/index.js` 与 `bin/ego-cast-worker.mjs` 各有一份 humanCheck 探针(逻辑相似)——
|
|
28
|
+
若改探针特征,两处都要同步。
|
|
29
|
+
- **同步提醒**:`lib/config.js` 的 `tokenizeArgs`/`filterArgs`/`CHROME_BLOCKED` 与 `runtime/ego-linux/src/chrome.mjs` 的 `tokenizeArgs`/`filterChromeArgs`/`CHROME_BLOCKED` 是镜像副本(runtime 不 import lib/)——改一处必须同步另一处。
|
|
30
|
+
- 若要跟进 ego-lite 上游,重点 diff 上表的 cursor.mjs;其余文件可直接与上游对齐。
|