browser-debugger-cli 0.14.0 → 0.16.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/.claude/skills/bdg/SKILL.md +3 -2
- package/dist/cdp/methodTarget.d.ts +92 -0
- package/dist/cdp/methodTarget.js +159 -0
- package/dist/cdp/protocol.d.ts +16 -1
- package/dist/cdp/protocol.js +21 -0
- package/dist/cdp/schema.d.ts +55 -1
- package/dist/cdp/schema.js +134 -25
- package/dist/cdp/types.d.ts +3 -1
- package/dist/commands/cdp.d.ts +38 -1
- package/dist/commands/cdp.js +201 -133
- package/dist/commands/cleanup.js +21 -4
- package/dist/commands/dom/eval.d.ts +2 -1
- package/dist/commands/dom/eval.js +6 -21
- package/dist/commands/dom/formInteraction.js +8 -4
- package/dist/commands/dom/helpers/evalResult.d.ts +36 -0
- package/dist/commands/dom/helpers/evalResult.js +59 -0
- package/dist/commands/dom/helpers/index.d.ts +4 -4
- package/dist/commands/dom/helpers/index.js +3 -3
- package/dist/commands/dom/helpers/query.d.ts +2 -2
- package/dist/commands/dom/helpers/query.js +2 -2
- package/dist/commands/dom/helpers/screenshot.d.ts +21 -26
- package/dist/commands/dom/helpers/screenshot.js +50 -668
- package/dist/commands/dom/screenshot.js +56 -36
- package/dist/commands/helpJson.d.ts +1 -1
- package/dist/commands/helpJson.js +3 -3
- package/dist/commands/helpTopic.js +10 -4
- package/dist/commands/network/har.js +18 -14
- package/dist/commands/optionBehaviors.js +24 -9
- package/dist/commands/shared/CommandRunner.d.ts +5 -0
- package/dist/commands/shared/CommandRunner.js +18 -3
- package/dist/commands/shared/interrupt.d.ts +40 -0
- package/dist/commands/shared/interrupt.js +73 -0
- package/dist/commands/shared/optionTypes.d.ts +3 -0
- package/dist/commands/shared/outputFile.d.ts +2 -1
- package/dist/commands/shared/outputFile.js +7 -4
- package/dist/commands/shared/startHelpers.d.ts +26 -3
- package/dist/commands/shared/startHelpers.js +145 -23
- package/dist/commands/status.js +3 -1
- package/dist/commands/stop.js +2 -1
- package/dist/commands/types.d.ts +5 -0
- package/dist/connection/cdp.js +1 -16
- package/dist/connection/chromeIdentity.d.ts +24 -5
- package/dist/connection/chromeIdentity.js +53 -22
- package/dist/connection/launcher/flagsBuilder.d.ts +46 -0
- package/dist/connection/launcher/flagsBuilder.js +107 -23
- package/dist/connection/launcher.d.ts +35 -2
- package/dist/connection/launcher.js +99 -12
- package/dist/connection/typed-cdp.d.ts +3 -2
- package/dist/constants.d.ts +3 -5
- package/dist/constants.js +3 -5
- package/dist/daemon/SessionController.d.ts +10 -5
- package/dist/daemon/SessionController.js +15 -8
- package/dist/daemon/ipcServer.js +1 -1
- package/dist/daemon/launcher.d.ts +22 -3
- package/dist/daemon/launcher.js +45 -8
- package/dist/daemon/session/Session.d.ts +5 -1
- package/dist/daemon/session/Session.js +9 -8
- package/dist/daemon/session/TelemetryStore.d.ts +5 -0
- package/dist/daemon/session/TelemetryStore.js +4 -0
- package/dist/daemon/session/captureGate.d.ts +59 -0
- package/dist/daemon/session/captureGate.js +96 -0
- package/dist/daemon/session/chromeConnection.d.ts +16 -1
- package/dist/daemon/session/chromeConnection.js +34 -4
- package/dist/daemon/session/collectors.d.ts +15 -0
- package/dist/daemon/session/collectors.js +39 -2
- package/dist/daemon/session/commandRegistry.d.ts +14 -1
- package/dist/daemon/session/commandRegistry.js +48 -13
- package/dist/daemon/session/downloads.d.ts +32 -0
- package/dist/daemon/session/downloads.js +96 -0
- package/dist/daemon/session/interactions.d.ts +3 -2
- package/dist/daemon/session/interactions.js +7 -2
- package/dist/daemon/session/plugins.js +6 -0
- package/dist/daemon.js +18520 -17014
- package/dist/errors/CommandError.d.ts +2 -0
- package/dist/errors/issues.d.ts +1 -1
- package/dist/errors/messages.d.ts +81 -0
- package/dist/errors/messages.js +198 -6
- package/dist/index.js +1446 -1078
- package/dist/ipc/client.d.ts +20 -2
- package/dist/ipc/client.js +32 -6
- package/dist/ipc/protocol/commands.d.ts +36 -2
- package/dist/ipc/protocol/commands.js +1 -0
- package/dist/ipc/protocol/domTypes.d.ts +24 -1
- package/dist/ipc/session/queries.d.ts +3 -0
- package/dist/ipc/session/types.d.ts +5 -0
- package/dist/ipc/transport/IPCError.d.ts +9 -0
- package/dist/ipc/transport/IPCError.js +12 -0
- package/dist/ipc/transport/errors.d.ts +2 -1
- package/dist/ipc/transport/errors.js +4 -1
- package/dist/ipc/transport/index.d.ts +10 -2
- package/dist/ipc/transport/index.js +29 -4
- package/dist/runtime/dom/actionEffects.d.ts +48 -9
- package/dist/runtime/dom/actionEffects.js +269 -34
- package/dist/runtime/dom/actionEffectsScripts.d.ts +45 -0
- package/dist/runtime/dom/actionEffectsScripts.js +101 -2
- package/dist/runtime/dom/captureArea.d.ts +35 -0
- package/dist/runtime/dom/captureArea.js +203 -0
- package/dist/runtime/dom/elementInfo.d.ts +13 -4
- package/dist/runtime/dom/elementInfo.js +12 -3
- package/dist/runtime/dom/evalHelpers.d.ts +24 -4
- package/dist/runtime/dom/evalHelpers.js +40 -12
- package/dist/runtime/dom/formDiscovery.d.ts +1 -1
- package/dist/runtime/dom/frames.d.ts +2 -1
- package/dist/runtime/dom/frames.js +3 -1
- package/dist/runtime/page/bdgWorld.d.ts +9 -0
- package/dist/runtime/page/bdgWorld.js +11 -0
- package/dist/runtime/page/captureEmulation.d.ts +119 -0
- package/dist/runtime/page/captureEmulation.js +189 -0
- package/dist/runtime/page/captureScroll.d.ts +24 -0
- package/dist/runtime/page/captureScroll.js +124 -0
- package/dist/runtime/page/emulation.js +6 -5
- package/dist/runtime/page/screenshot.d.ts +41 -0
- package/dist/runtime/page/screenshot.js +394 -0
- package/dist/runtime/page/userAgent.d.ts +86 -2
- package/dist/runtime/page/userAgent.js +154 -33
- package/dist/session/paths.d.ts +52 -3
- package/dist/session/paths.js +179 -7
- package/dist/session/portClaims.d.ts +0 -8
- package/dist/session/portClaims.js +1 -22
- package/dist/session/sessionList.d.ts +5 -1
- package/dist/session/sessionList.js +5 -1
- package/dist/telemetry/downloads.d.ts +127 -0
- package/dist/telemetry/downloads.js +265 -0
- package/dist/telemetry/har/builder.d.ts +12 -1
- package/dist/telemetry/har/builder.js +32 -9
- package/dist/telemetry/har/sanitize.d.ts +28 -0
- package/dist/telemetry/har/sanitize.js +184 -0
- package/dist/telemetry/har/sanitizeBody.d.ts +78 -0
- package/dist/telemetry/har/sanitizeBody.js +541 -0
- package/dist/telemetry/har/types.d.ts +2 -0
- package/dist/telemetry/network.d.ts +4 -4
- package/dist/telemetry/network.js +38 -4
- package/dist/telemetry/networkRetention.d.ts +35 -14
- package/dist/telemetry/networkRetention.js +62 -26
- package/dist/types.d.ts +9 -14
- package/dist/ui/OutputBuilder.d.ts +3 -2
- package/dist/ui/OutputBuilder.js +4 -3
- package/dist/ui/formatters/cdp.d.ts +32 -9
- package/dist/ui/formatters/cdp.js +77 -6
- package/dist/ui/formatters/details.js +7 -15
- package/dist/ui/formatters/preview.d.ts +2 -0
- package/dist/ui/formatters/preview.js +7 -1
- package/dist/ui/formatters/sessions.d.ts +3 -2
- package/dist/ui/formatters/sessions.js +10 -3
- package/dist/ui/formatters/status.js +6 -1
- package/dist/ui/formatting.d.ts +7 -0
- package/dist/ui/formatting.js +13 -0
- package/dist/ui/logging/logger.d.ts +1 -1
- package/dist/ui/messages/chrome.d.ts +27 -6
- package/dist/ui/messages/chrome.js +78 -12
- package/dist/ui/messages/commands.d.ts +71 -3
- package/dist/ui/messages/commands.js +98 -3
- package/dist/ui/messages/networkMessages.d.ts +50 -5
- package/dist/ui/messages/networkMessages.js +50 -6
- package/dist/ui/messages/session.d.ts +8 -0
- package/dist/ui/messages/session.js +10 -0
- package/dist/utils/async.d.ts +3 -2
- package/dist/utils/async.js +16 -3
- package/dist/utils/atomicFile.d.ts +2 -1
- package/dist/utils/atomicFile.js +5 -2
- package/dist/utils/directories.d.ts +41 -0
- package/dist/utils/directories.js +48 -0
- package/dist/utils/http.d.ts +11 -4
- package/dist/utils/http.js +5 -3
- package/package.json +18 -4
- /package/dist/{commands/dom → runtime/page}/screenshotResize.d.ts +0 -0
- /package/dist/{commands/dom → runtime/page}/screenshotResize.js +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounds of a `dom eval --json` result (#478): one eval must not put
|
|
3
|
+
* megabytes into an agent's context.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The `result` of `dom eval --json`, and what was left out of it. A string
|
|
7
|
+
* `result` with `truncatedFrom` while `type` is `object` is the start of
|
|
8
|
+
* the value's JSON text, not a string the script returned.
|
|
9
|
+
*/
|
|
10
|
+
export interface BoundedEvalResult {
|
|
11
|
+
/** The value, its first elements, or the start of its (JSON) text */
|
|
12
|
+
result: unknown;
|
|
13
|
+
/** Elements of an array result in the page, set only when it was bounded */
|
|
14
|
+
count?: number;
|
|
15
|
+
/** Elements left out of a listed array result */
|
|
16
|
+
omitted?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Length of the string, or of the JSON text of the copied object or array
|
|
19
|
+
* (which holds at most 1000 entries per list or object), `result` was cut from
|
|
20
|
+
*/
|
|
21
|
+
truncatedFrom?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Bound an eval result for JSON output: a string is cut to
|
|
25
|
+
* {@link MAX_VALUE_LENGTH} characters, an array keeps its first
|
|
26
|
+
* {@link EVAL_JSON_ARRAY_LIMIT} elements (with `count` and `omitted`), and
|
|
27
|
+
* an object or array whose JSON is still longer than the cap becomes the
|
|
28
|
+
* start of its JSON text (with `truncatedFrom`), so the output stays valid
|
|
29
|
+
* JSON. Small values are returned as they are.
|
|
30
|
+
*
|
|
31
|
+
* @param value - Evaluated value, as copied from the page
|
|
32
|
+
* @param length - Elements of an array result in the page (its copy may hold fewer)
|
|
33
|
+
* @returns `result`, with what was left out when bounded
|
|
34
|
+
*/
|
|
35
|
+
export declare function boundEvalResult(value: unknown, length?: number): BoundedEvalResult;
|
|
36
|
+
//# sourceMappingURL=evalResult.d.ts.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounds of a `dom eval --json` result (#478): one eval must not put
|
|
3
|
+
* megabytes into an agent's context.
|
|
4
|
+
*/
|
|
5
|
+
import { EVAL_JSON_ARRAY_LIMIT, MAX_VALUE_LENGTH } from '../../../constants.js';
|
|
6
|
+
import { capLength } from '../../../utils/strings.js';
|
|
7
|
+
/**
|
|
8
|
+
* Bound an eval result for JSON output: a string is cut to
|
|
9
|
+
* {@link MAX_VALUE_LENGTH} characters, an array keeps its first
|
|
10
|
+
* {@link EVAL_JSON_ARRAY_LIMIT} elements (with `count` and `omitted`), and
|
|
11
|
+
* an object or array whose JSON is still longer than the cap becomes the
|
|
12
|
+
* start of its JSON text (with `truncatedFrom`), so the output stays valid
|
|
13
|
+
* JSON. Small values are returned as they are.
|
|
14
|
+
*
|
|
15
|
+
* @param value - Evaluated value, as copied from the page
|
|
16
|
+
* @param length - Elements of an array result in the page (its copy may hold fewer)
|
|
17
|
+
* @returns `result`, with what was left out when bounded
|
|
18
|
+
*/
|
|
19
|
+
export function boundEvalResult(value, length) {
|
|
20
|
+
if (typeof value === 'string') {
|
|
21
|
+
const { text, truncatedFrom } = capLength(value, MAX_VALUE_LENGTH);
|
|
22
|
+
return { result: text, ...(truncatedFrom !== undefined && { truncatedFrom }) };
|
|
23
|
+
}
|
|
24
|
+
if (Array.isArray(value))
|
|
25
|
+
return boundArray(value, length ?? value.length);
|
|
26
|
+
if (value === null || typeof value !== 'object')
|
|
27
|
+
return { result: value };
|
|
28
|
+
const json = JSON.stringify(value);
|
|
29
|
+
return json.length > MAX_VALUE_LENGTH ? jsonStart(json) : { result: value };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Bound an array result: its first {@link EVAL_JSON_ARRAY_LIMIT} elements,
|
|
33
|
+
* or the start of its JSON text when even those are over the cap.
|
|
34
|
+
*
|
|
35
|
+
* @param value - Array result
|
|
36
|
+
* @param count - Elements of the array in the page
|
|
37
|
+
* @returns `result` with `count`, and `omitted` or `truncatedFrom`
|
|
38
|
+
*/
|
|
39
|
+
function boundArray(value, count) {
|
|
40
|
+
const listed = value.slice(0, EVAL_JSON_ARRAY_LIMIT);
|
|
41
|
+
const listedJson = JSON.stringify(listed);
|
|
42
|
+
if (listedJson.length > MAX_VALUE_LENGTH) {
|
|
43
|
+
const json = listed.length === value.length ? listedJson : JSON.stringify(value);
|
|
44
|
+
return { ...jsonStart(json), count };
|
|
45
|
+
}
|
|
46
|
+
return listed.length < count
|
|
47
|
+
? { result: listed, count, omitted: count - listed.length }
|
|
48
|
+
: { result: value };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The first {@link MAX_VALUE_LENGTH} characters of a JSON text.
|
|
52
|
+
*
|
|
53
|
+
* @param json - JSON text of an object or array over the cap
|
|
54
|
+
* @returns Its start, and the length of all of it
|
|
55
|
+
*/
|
|
56
|
+
function jsonStart(json) {
|
|
57
|
+
return { result: capLength(json, MAX_VALUE_LENGTH).text, truncatedFrom: json.length };
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=evalResult.js.map
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* so callers can keep importing from `@/commands/dom/helpers.js`.
|
|
4
4
|
*
|
|
5
5
|
* - `query.ts` — selector → backend node ids (shadow roots, same-origin iframes), DOM.describeNode
|
|
6
|
-
* - `screenshot.ts` — page / element capture
|
|
6
|
+
* - `screenshot.ts` — page / element capture through the daemon, writing the image
|
|
7
7
|
*/
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export type {
|
|
8
|
+
export { noMatchesError, queryDOMElements, getDomContext, getDOMElements, resolveSelector, resolveBackendNodeIds, selectMatch, assertNodeAttached, pageDocumentId, } from './query.js';
|
|
9
|
+
export { captureScreenshot, screenshotInterrupted } from './screenshot.js';
|
|
10
|
+
export type { DomGetOptions, DomContext } from '../../../types.js';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* so callers can keep importing from `@/commands/dom/helpers.js`.
|
|
4
4
|
*
|
|
5
5
|
* - `query.ts` — selector → backend node ids (shadow roots, same-origin iframes), DOM.describeNode
|
|
6
|
-
* - `screenshot.ts` — page / element capture
|
|
6
|
+
* - `screenshot.ts` — page / element capture through the daemon, writing the image
|
|
7
7
|
*/
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
8
|
+
export { noMatchesError, queryDOMElements, getDomContext, getDOMElements, resolveSelector, resolveBackendNodeIds, selectMatch, assertNodeAttached, pageDocumentId, } from './query.js';
|
|
9
|
+
export { captureScreenshot, screenshotInterrupted } from './screenshot.js';
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -91,10 +91,10 @@ export declare function getDOMElements(options: DomGetOptions): Promise<DomGetRe
|
|
|
91
91
|
* Resolve a selector to its first match.
|
|
92
92
|
*
|
|
93
93
|
* @param selector - CSS selector
|
|
94
|
-
* @returns
|
|
94
|
+
* @returns Backend node id of the first match
|
|
95
95
|
* @throws CommandError (83) when nothing matches
|
|
96
96
|
*/
|
|
97
|
-
export declare function resolveSelector(selector: string): Promise<
|
|
97
|
+
export declare function resolveSelector(selector: string): Promise<number>;
|
|
98
98
|
/**
|
|
99
99
|
* Resolve selectors to backend node ids (first match each).
|
|
100
100
|
*
|
|
@@ -655,7 +655,7 @@ export async function getDOMElements(options) {
|
|
|
655
655
|
* Resolve a selector to its first match.
|
|
656
656
|
*
|
|
657
657
|
* @param selector - CSS selector
|
|
658
|
-
* @returns
|
|
658
|
+
* @returns Backend node id of the first match
|
|
659
659
|
* @throws CommandError (83) when nothing matches
|
|
660
660
|
*/
|
|
661
661
|
export async function resolveSelector(selector) {
|
|
@@ -664,7 +664,7 @@ export async function resolveSelector(selector) {
|
|
|
664
664
|
const err = await noMatchesError(selector);
|
|
665
665
|
throw new CommandError(err.message, { suggestion: err.suggestion }, EXIT_CODES.RESOURCE_NOT_FOUND);
|
|
666
666
|
}
|
|
667
|
-
return
|
|
667
|
+
return backendNodeId;
|
|
668
668
|
}
|
|
669
669
|
/**
|
|
670
670
|
* Resolve selectors to backend node ids (first match each).
|
|
@@ -1,34 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* view primitives used by page screenshots with `--scroll`.
|
|
2
|
+
* Screenshot capture for `bdg dom screenshot`: the daemon measures, captures
|
|
3
|
+
* and puts back the page's emulation (`dom_screenshot`); this writes the image
|
|
4
|
+
* it returns.
|
|
6
5
|
*/
|
|
7
|
-
import
|
|
6
|
+
import { type InterruptSignal } from '../../shared/interrupt.js';
|
|
7
|
+
import { CommandError } from '../../../errors/index.js';
|
|
8
|
+
import type { DomScreenshotCommand } from '../../../ipc/protocol/commands.js';
|
|
9
|
+
import type { ScreenshotResult } from '../../../types.js';
|
|
8
10
|
/**
|
|
9
|
-
*
|
|
10
|
-
* element via CDP DOM.getBoxModel.
|
|
11
|
+
* The error of a screenshot interrupted by Ctrl-C or SIGTERM.
|
|
11
12
|
*
|
|
12
|
-
* @param
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
export declare function getElementBounds(ref: NodeRef): Promise<ElementBounds>;
|
|
16
|
-
/**
|
|
17
|
-
* Capture a screenshot of the page. Auto-resizes oversized pages by default
|
|
18
|
-
* to keep Claude Vision token cost bounded; falls back to viewport capture
|
|
19
|
-
* when the page is taller than the tall-page threshold.
|
|
13
|
+
* @param signal - The signal
|
|
14
|
+
* @returns Command error (exit 130, or 143 for SIGTERM)
|
|
20
15
|
*/
|
|
21
|
-
export declare function
|
|
16
|
+
export declare function screenshotInterrupted(signal: InterruptSignal): CommandError;
|
|
22
17
|
/**
|
|
23
|
-
* Capture
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
18
|
+
* Capture the page (or the element `backendNodeId` names) and write the
|
|
19
|
+
* image.
|
|
20
|
+
*
|
|
21
|
+
* @param outputPath - File to write
|
|
22
|
+
* @param request - What to capture and how
|
|
23
|
+
* @param interrupt - Aborted on Ctrl-C or SIGTERM: the capture is cancelled
|
|
24
|
+
* @returns What was captured, with the file's absolute path
|
|
25
|
+
* @throws CommandError with the daemon's error (Chrome's, when the capture
|
|
26
|
+
* failed) and exit code, or 130/143 when interrupted
|
|
27
27
|
*/
|
|
28
|
-
export declare function
|
|
29
|
-
format?: 'png' | 'jpeg';
|
|
30
|
-
quality?: number;
|
|
31
|
-
noResize?: boolean;
|
|
32
|
-
padding?: number;
|
|
33
|
-
}): Promise<ScreenshotResult>;
|
|
28
|
+
export declare function captureScreenshot(outputPath: string, request: DomScreenshotCommand, interrupt?: AbortSignal): Promise<ScreenshotResult>;
|
|
34
29
|
//# sourceMappingURL=screenshot.d.ts.map
|