dsh-browser-playwright-codex 0.7.7 → 0.8.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 +85 -0
- package/NOTICE.md +26 -5
- package/README.md +27 -4
- package/lib/browser-lifecycle.js +27 -1
- package/lib/client.js +1219 -647
- package/lib/config.d.ts +26 -0
- package/lib/config.js +24 -1
- package/lib/page-actions.js +32 -1
- package/lib/provider.js +8 -0
- package/lib/read-deadline.d.ts +22 -0
- package/lib/read-deadline.js +77 -0
- package/lib/runtime-state.d.ts +26 -0
- package/lib/runtime-state.js +100 -0
- package/lib/session.d.ts +22 -0
- package/lib/session.js +69 -8
- package/lib/settings-card.js +123 -0
- package/lib/swarm-contract.d.ts +226 -0
- package/lib/swarm-contract.js +209 -0
- package/lib/swarm-curtain.d.ts +22 -0
- package/lib/swarm-curtain.js +115 -0
- package/lib/swarm-intro.d.ts +66 -0
- package/lib/swarm-intro.js +827 -0
- package/lib/tool.js +19 -4
- package/package.json +4 -2
package/lib/tool.js
CHANGED
|
@@ -109,6 +109,11 @@ export function apply(ctx, config) {
|
|
|
109
109
|
throw new BrowserError('DISABLED', 'dsh-browser-playwright-codex is disabled; open Settings → Plugins → 浏览器 and turn it on to use the browser');
|
|
110
110
|
}
|
|
111
111
|
return ctx.browser.acquire(ownerFor(exec), exec.signal).then((session) => {
|
|
112
|
+
// Let the session's page read honour this call's cancellation signal:
|
|
113
|
+
// a stuck page no longer hangs the whole tool call (issue #5).
|
|
114
|
+
const withSet = session;
|
|
115
|
+
if (typeof withSet.setSignal === 'function')
|
|
116
|
+
withSet.setSignal(exec.signal);
|
|
112
117
|
publishLogins(session);
|
|
113
118
|
return session;
|
|
114
119
|
});
|
|
@@ -133,13 +138,18 @@ export function apply(ctx, config) {
|
|
|
133
138
|
waitFor: {
|
|
134
139
|
type: 'string',
|
|
135
140
|
enum: ['load', 'domcontentloaded', 'networkidle'],
|
|
136
|
-
description: 'Load condition to wait for. Defaults to load
|
|
141
|
+
description: 'Load condition to wait for. Defaults to domcontentloaded; load never fires on long-polling or ' +
|
|
142
|
+
'download pages and hangs the call (issue #5).',
|
|
137
143
|
},
|
|
138
144
|
},
|
|
139
145
|
output: { schema: SNAPSHOT_SCHEMA, render: renderSnapshotValue },
|
|
140
146
|
async execute(args, exec) {
|
|
141
147
|
const session = await acquire(exec);
|
|
142
|
-
|
|
148
|
+
// domcontentloaded, not load: a page with an endless subresource (long
|
|
149
|
+
// poll, streaming download, ad frame that never settles) never reaches
|
|
150
|
+
// 'load', so the default burned the whole navigation timeout on pages
|
|
151
|
+
// that were perfectly usable already (issue #5).
|
|
152
|
+
const waitUntil = args.waitFor ?? 'domcontentloaded';
|
|
143
153
|
return snapshotValue(await session.navigate(args.url, waitUntil, exec.signal));
|
|
144
154
|
},
|
|
145
155
|
}));
|
|
@@ -430,13 +440,18 @@ export function apply(ctx, config) {
|
|
|
430
440
|
waitFor: {
|
|
431
441
|
type: 'string',
|
|
432
442
|
enum: ['load', 'domcontentloaded', 'networkidle'],
|
|
433
|
-
description: 'Load condition to wait for. Defaults to load
|
|
443
|
+
description: 'Load condition to wait for. Defaults to domcontentloaded; load never fires on long-polling or ' +
|
|
444
|
+
'download pages and hangs the call (issue #5).',
|
|
434
445
|
},
|
|
435
446
|
},
|
|
436
447
|
output: { schema: SNAPSHOT_SCHEMA, render: renderSnapshotValue },
|
|
437
448
|
async execute(args, exec) {
|
|
438
449
|
const session = await acquire(exec);
|
|
439
|
-
|
|
450
|
+
// domcontentloaded, not load: a page with an endless subresource (long
|
|
451
|
+
// poll, streaming download, ad frame that never settles) never reaches
|
|
452
|
+
// 'load', so the default burned the whole navigation timeout on pages
|
|
453
|
+
// that were perfectly usable already (issue #5).
|
|
454
|
+
const waitUntil = args.waitFor ?? 'domcontentloaded';
|
|
440
455
|
return snapshotValue(await session.openTab(args.url, waitUntil, exec.signal));
|
|
441
456
|
},
|
|
442
457
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-browser-playwright-codex",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Browser automation for DeepSeek Harness, one plugin: fill in forms, scrape lists and work across tabs in real pages, using the logins you already have. Runs in a visible window that stays quiet when minimised; native dialogs are parked instead of confirmed, CAPTCHA pages are flagged with a note that says stop and hand the page back, password / one-time-code / card fields are refused by browser_fill, and the Settings card (enable/disable, page-reading mode, capability gates) now lives inside this package.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -57,10 +57,12 @@
|
|
|
57
57
|
"verify": "npm run build && node scripts/dsh-browser-verify.mjs",
|
|
58
58
|
"verify:live": "npm run build && node scripts/dsh-browser-verify.mjs --live",
|
|
59
59
|
"doctor": "node scripts/doctor.mjs",
|
|
60
|
+
"swarm:patch": "node scripts/swarm-patch.mjs",
|
|
61
|
+
"swarm:check": "node scripts/swarm-patch.mjs --check",
|
|
60
62
|
"cost": "node node_modules/tsx/dist/cli.mjs scripts/measure-prompt-cost.mjs",
|
|
61
63
|
"format": "node node_modules/prettier/bin/prettier.cjs --write \"src/**/*.ts\" \"tests/**/*.ts\" \"scripts/**/*.mjs\"",
|
|
62
64
|
"format:check": "node node_modules/prettier/bin/prettier.cjs --check \"src/**/*.ts\" \"tests/**/*.ts\" \"scripts/**/*.mjs\"",
|
|
63
|
-
"prepublishOnly": "npm run build && npm run typecheck && npm test && npm run verify && npm run preflight",
|
|
65
|
+
"prepublishOnly": "npm run build && npm run typecheck && npm test && npm run swarm:check && npm run verify && npm run preflight",
|
|
64
66
|
"preflight": "node scripts/preflight.mjs ."
|
|
65
67
|
},
|
|
66
68
|
"dependencies": {
|