browser-debugger-cli 0.15.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 +2 -1
- 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 +200 -133
- package/dist/commands/cleanup.js +18 -4
- package/dist/commands/dom/formInteraction.js +8 -4
- 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/optionBehaviors.js +18 -8
- 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 +2 -0
- package/dist/commands/shared/startHelpers.d.ts +26 -3
- package/dist/commands/shared/startHelpers.js +145 -23
- 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.d.ts +34 -1
- package/dist/connection/launcher.js +98 -10
- package/dist/connection/typed-cdp.d.ts +3 -2
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- 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 +5 -0
- package/dist/daemon/launcher.js +8 -1
- 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 +46 -11
- 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 +12843 -11482
- package/dist/errors/CommandError.d.ts +2 -0
- package/dist/errors/issues.d.ts +1 -1
- package/dist/errors/messages.d.ts +58 -0
- package/dist/errors/messages.js +112 -0
- package/dist/index.js +999 -1020
- package/dist/ipc/client.d.ts +14 -1
- package/dist/ipc/client.js +21 -4
- package/dist/ipc/protocol/commands.d.ts +32 -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 +4 -2
- package/dist/ipc/transport/index.js +13 -3
- 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 +10 -8
- package/dist/runtime/dom/elementInfo.js +8 -6
- package/dist/runtime/dom/formDiscovery.d.ts +1 -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/screenshot.d.ts +41 -0
- package/dist/runtime/page/screenshot.js +394 -0
- package/dist/session/paths.d.ts +14 -0
- package/dist/session/paths.js +25 -0
- package/dist/telemetry/downloads.d.ts +127 -0
- package/dist/telemetry/downloads.js +265 -0
- package/dist/telemetry/har/builder.js +22 -7
- package/dist/telemetry/har/sanitize.d.ts +7 -3
- package/dist/telemetry/har/sanitize.js +52 -6
- package/dist/telemetry/har/sanitizeBody.d.ts +47 -7
- package/dist/telemetry/har/sanitizeBody.js +429 -56
- 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/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 +13 -0
- package/dist/ui/messages/chrome.js +26 -0
- package/dist/ui/messages/commands.d.ts +71 -3
- package/dist/ui/messages/commands.js +98 -3
- package/dist/ui/messages/networkMessages.d.ts +24 -5
- package/dist/ui/messages/networkMessages.js +31 -8
- package/dist/utils/async.d.ts +3 -2
- package/dist/utils/async.js +16 -3
- 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
|
@@ -18,6 +18,8 @@ export interface ErrorMetadata {
|
|
|
18
18
|
fallback?: string;
|
|
19
19
|
/** CDP alternative for advanced use cases */
|
|
20
20
|
cdpAlternative?: string;
|
|
21
|
+
/** How the command ran despite failing (e.g. a CDP method sent though bdg's protocol lacks it) */
|
|
22
|
+
warning?: string;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* Custom error class for CLI commands with structured metadata.
|
package/dist/errors/issues.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Add new codes here as vertical slices migrate away from raw string messages.
|
|
9
9
|
*/
|
|
10
|
-
export type IssueCode = 'PORT_IN_USE' | 'INVALID_PORT' | 'USER_DATA_DIR_CREATE_FAILED' | 'CHROME_LAUNCH_FAILED' | 'CHROME_DIED_AFTER_LAUNCH' | 'CHROME_EXITED_DURING_STARTUP' | 'NO_PAGE_TARGET_FOUND' | 'CHROME_BINARY_NOT_FOUND' | 'CHROME_BINARY_NOT_EXECUTABLE' | 'CHROME_BINARY_IS_DIRECTORY' | 'PREFS_FILE_NOT_FOUND' | 'PREFS_INVALID_FORMAT' | 'PREFS_LOAD_FAILED' | 'PREFS_NOT_JSON_SERIALIZABLE';
|
|
10
|
+
export type IssueCode = 'PORT_IN_USE' | 'INVALID_PORT' | 'USER_DATA_DIR_CREATE_FAILED' | 'CHROME_LAUNCH_FAILED' | 'CHROME_DIED_AFTER_LAUNCH' | 'CHROME_PORT_NOT_OPENED' | 'CHROME_EXITED_DURING_STARTUP' | 'NO_PAGE_TARGET_FOUND' | 'CHROME_BINARY_NOT_FOUND' | 'CHROME_BINARY_NOT_EXECUTABLE' | 'CHROME_BINARY_IS_DIRECTORY' | 'PREFS_FILE_NOT_FOUND' | 'PREFS_INVALID_FORMAT' | 'PREFS_LOAD_FAILED' | 'PREFS_NOT_JSON_SERIALIZABLE';
|
|
11
11
|
export interface IssueDetails {
|
|
12
12
|
code: IssueCode;
|
|
13
13
|
context?: Record<string, unknown>;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Centralized location for reusable error messages with consistent formatting.
|
|
5
5
|
*/
|
|
6
|
+
import type { MissingMethodCause } from '../cdp/methodTarget.js';
|
|
6
7
|
import type { DomFrame, PendingRequestInfo } from '../ipc/protocol/commands.js';
|
|
7
8
|
import { type WaitCondition, type WaitSnapshot } from '../runtime/dom/waitCondition.js';
|
|
8
9
|
import { type UntrustedSessionDir } from '../session/paths.js';
|
|
@@ -83,6 +84,15 @@ export declare function sessionNotRespondingError(seconds: number): ErrorWithSug
|
|
|
83
84
|
* @param seconds - Timeout in seconds
|
|
84
85
|
*/
|
|
85
86
|
export declare function commandTimedOutError(seconds: number): ErrorWithSuggestion;
|
|
87
|
+
/**
|
|
88
|
+
* A screenshot interrupted by Ctrl-C or SIGTERM: the daemon skips the
|
|
89
|
+
* capture if it has not started and puts the page's emulation back before
|
|
90
|
+
* any later page command runs.
|
|
91
|
+
*
|
|
92
|
+
* @param signal - The signal that stopped it
|
|
93
|
+
* @returns Message and suggestion
|
|
94
|
+
*/
|
|
95
|
+
export declare function screenshotInterruptedError(signal: 'SIGINT' | 'SIGTERM'): ErrorWithSuggestion;
|
|
86
96
|
/**
|
|
87
97
|
* What to do when a command finds no session to work with.
|
|
88
98
|
*
|
|
@@ -1060,6 +1070,54 @@ export declare function formInIframeError(iframeUrl: string, crossOrigin: boolea
|
|
|
1060
1070
|
export declare function cdpCallError(method: string, message: string): ErrorWithSuggestion & {
|
|
1061
1071
|
notFound: boolean;
|
|
1062
1072
|
};
|
|
1073
|
+
/**
|
|
1074
|
+
* `bdg cdp` when Chrome answered -32601: it has no such method (for the
|
|
1075
|
+
* page target). What it says depends on why, as far as the bundled protocol
|
|
1076
|
+
* tells: an unknown domain, a redirect to a method the protocol lacks, a
|
|
1077
|
+
* Chrome older than the protocol, or a method only Chrome could know (typed
|
|
1078
|
+
* in one case, it gets a reminder that such names are case-sensitive).
|
|
1079
|
+
*
|
|
1080
|
+
* @param method - CDP method
|
|
1081
|
+
* @param chromeMessage - Chrome's error, e.g. "'Foo.bar' wasn't found"
|
|
1082
|
+
* @param cause - Why Chrome may lack it
|
|
1083
|
+
* @returns Message and suggestion
|
|
1084
|
+
*/
|
|
1085
|
+
export declare function cdpMethodNotImplementedError(method: string, chromeMessage: string, cause: MissingMethodCause): ErrorWithSuggestion;
|
|
1086
|
+
/**
|
|
1087
|
+
* `bdg cdp <Domain.Type>` without `--describe`: a type cannot be called.
|
|
1088
|
+
*
|
|
1089
|
+
* @param name - Full type name, e.g. Network.CookieSameSite
|
|
1090
|
+
* @returns Message and suggestion
|
|
1091
|
+
*/
|
|
1092
|
+
export declare function cdpTypeNotMethodError(name: string): ErrorWithSuggestion;
|
|
1093
|
+
/**
|
|
1094
|
+
* `bdg cdp <name>` for a close typo of bundled methods, or a name that is
|
|
1095
|
+
* not `Domain.method`.
|
|
1096
|
+
*
|
|
1097
|
+
* @param input - Name as typed
|
|
1098
|
+
* @param similar - Methods to suggest
|
|
1099
|
+
* @param listHint - First suggestion line (how to find methods)
|
|
1100
|
+
* @returns Message and suggestion
|
|
1101
|
+
*/
|
|
1102
|
+
export declare function cdpMethodNotFoundError(input: string, similar: string[], listHint: string): ErrorWithSuggestion;
|
|
1103
|
+
/**
|
|
1104
|
+
* `bdg cdp <name>` for a close typo of bundled methods or domains: did you
|
|
1105
|
+
* mean, or how to send it as typed (a method newer than the bundled protocol).
|
|
1106
|
+
*
|
|
1107
|
+
* @param input - Name as typed
|
|
1108
|
+
* @param similar - Methods to suggest
|
|
1109
|
+
* @param listHint - First suggestion line (how to find methods)
|
|
1110
|
+
* @returns Message and suggestion
|
|
1111
|
+
*/
|
|
1112
|
+
export declare function cdpMethodTypoError(input: string, similar: string[], listHint: string): ErrorWithSuggestion;
|
|
1113
|
+
/**
|
|
1114
|
+
* `bdg cdp <Domain.method> --describe` for a method the bundled protocol lacks.
|
|
1115
|
+
*
|
|
1116
|
+
* @param method - Method as typed
|
|
1117
|
+
* @param protocolVersion - Bundled devtools-protocol version
|
|
1118
|
+
* @returns Message and suggestion
|
|
1119
|
+
*/
|
|
1120
|
+
export declare function cdpMethodNotInBundledProtocolError(method: string, protocolVersion: string): ErrorWithSuggestion;
|
|
1063
1121
|
/**
|
|
1064
1122
|
* The skill file is not where the package should have it (a broken or
|
|
1065
1123
|
* partial install).
|
package/dist/errors/messages.js
CHANGED
|
@@ -109,6 +109,20 @@ export function commandTimedOutError(seconds) {
|
|
|
109
109
|
suggestion: `Check the session with: ${sessionCommand('bdg status')}; if the page stays frozen, end it with: ${sessionCommand('bdg cleanup --force')}`,
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* A screenshot interrupted by Ctrl-C or SIGTERM: the daemon skips the
|
|
114
|
+
* capture if it has not started and puts the page's emulation back before
|
|
115
|
+
* any later page command runs.
|
|
116
|
+
*
|
|
117
|
+
* @param signal - The signal that stopped it
|
|
118
|
+
* @returns Message and suggestion
|
|
119
|
+
*/
|
|
120
|
+
export function screenshotInterruptedError(signal) {
|
|
121
|
+
return {
|
|
122
|
+
message: `Screenshot cancelled (${signal === 'SIGINT' ? 'interrupted' : 'terminated'})`,
|
|
123
|
+
suggestion: "No file was written; run it again to capture (the next command sees the page's own emulation)",
|
|
124
|
+
};
|
|
125
|
+
}
|
|
112
126
|
/**
|
|
113
127
|
* What to do when a command finds no session to work with.
|
|
114
128
|
*
|
|
@@ -1962,6 +1976,104 @@ export function cdpCallError(method, message) {
|
|
|
1962
1976
|
notFound: false,
|
|
1963
1977
|
};
|
|
1964
1978
|
}
|
|
1979
|
+
/**
|
|
1980
|
+
* `bdg cdp` when Chrome answered -32601: it has no such method (for the
|
|
1981
|
+
* page target). What it says depends on why, as far as the bundled protocol
|
|
1982
|
+
* tells: an unknown domain, a redirect to a method the protocol lacks, a
|
|
1983
|
+
* Chrome older than the protocol, or a method only Chrome could know (typed
|
|
1984
|
+
* in one case, it gets a reminder that such names are case-sensitive).
|
|
1985
|
+
*
|
|
1986
|
+
* @param method - CDP method
|
|
1987
|
+
* @param chromeMessage - Chrome's error, e.g. "'Foo.bar' wasn't found"
|
|
1988
|
+
* @param cause - Why Chrome may lack it
|
|
1989
|
+
* @returns Message and suggestion
|
|
1990
|
+
*/
|
|
1991
|
+
export function cdpMethodNotImplementedError(method, chromeMessage, cause) {
|
|
1992
|
+
const search = sessionCommand('bdg cdp --search <keyword>');
|
|
1993
|
+
switch (cause.kind) {
|
|
1994
|
+
case 'unknownDomain':
|
|
1995
|
+
return {
|
|
1996
|
+
message: `Unknown CDP domain ${cause.domain}: it is not in bdg's bundled protocol, and this Chrome doesn't implement ${method} (${chromeMessage})`,
|
|
1997
|
+
suggestion: joinLines(cause.similar.length > 0 ? `Did you mean: ${cause.similar.join(', ')}?` : undefined, `List the domains: ${sessionCommand('bdg cdp --list')}`),
|
|
1998
|
+
};
|
|
1999
|
+
case 'deadRedirect':
|
|
2000
|
+
return {
|
|
2001
|
+
message: `This Chrome doesn't implement ${method}: the protocol redirects it to ${cause.target}, which does not exist (${chromeMessage})`,
|
|
2002
|
+
suggestion: cause.similar.length > 0
|
|
2003
|
+
? `Did you mean: ${cause.similar.join(', ')}? See: ${sessionCommand(`bdg cdp ${cause.similar[0]} --describe`)}`
|
|
2004
|
+
: `Find another method: ${search}`,
|
|
2005
|
+
};
|
|
2006
|
+
case 'older':
|
|
2007
|
+
return {
|
|
2008
|
+
message: `This Chrome doesn't implement ${method} (${chromeMessage})`,
|
|
2009
|
+
suggestion: `bdg's bundled protocol has it, but this Chrome is older (or ${method} is not available on a page). Use a newer Chrome, or find another method: ${search}`,
|
|
2010
|
+
};
|
|
2011
|
+
case 'unlisted':
|
|
2012
|
+
return {
|
|
2013
|
+
message: `This Chrome doesn't implement ${method} (${chromeMessage})`,
|
|
2014
|
+
suggestion: cause.oneCase
|
|
2015
|
+
? `CDP method names are case-sensitive for methods bdg doesn't know: ${method} was sent as typed. Type it in lowerCamelCase as Chrome names it (getCookies, not getcookies), or find a method: ${search}`
|
|
2016
|
+
: `Check the spelling (Chrome's method names are case-sensitive), or find a method: ${search}`,
|
|
2017
|
+
};
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
/**
|
|
2021
|
+
* `bdg cdp <Domain.Type>` without `--describe`: a type cannot be called.
|
|
2022
|
+
*
|
|
2023
|
+
* @param name - Full type name, e.g. Network.CookieSameSite
|
|
2024
|
+
* @returns Message and suggestion
|
|
2025
|
+
*/
|
|
2026
|
+
export function cdpTypeNotMethodError(name) {
|
|
2027
|
+
return {
|
|
2028
|
+
message: `${name} is a protocol type, not a method`,
|
|
2029
|
+
suggestion: `Use: bdg cdp ${name} --describe (to see its values or properties)`,
|
|
2030
|
+
};
|
|
2031
|
+
}
|
|
2032
|
+
/**
|
|
2033
|
+
* `bdg cdp <name>` for a close typo of bundled methods, or a name that is
|
|
2034
|
+
* not `Domain.method`.
|
|
2035
|
+
*
|
|
2036
|
+
* @param input - Name as typed
|
|
2037
|
+
* @param similar - Methods to suggest
|
|
2038
|
+
* @param listHint - First suggestion line (how to find methods)
|
|
2039
|
+
* @returns Message and suggestion
|
|
2040
|
+
*/
|
|
2041
|
+
export function cdpMethodNotFoundError(input, similar, listHint) {
|
|
2042
|
+
const didYouMean = similar.length > 0 ? ['', 'Did you mean:', ...similar.map((name) => ` - ${name}`)] : [];
|
|
2043
|
+
return {
|
|
2044
|
+
message: `Method '${input}' not found`,
|
|
2045
|
+
suggestion: [listHint, ...didYouMean].join('\n'),
|
|
2046
|
+
};
|
|
2047
|
+
}
|
|
2048
|
+
/**
|
|
2049
|
+
* `bdg cdp <name>` for a close typo of bundled methods or domains: did you
|
|
2050
|
+
* mean, or how to send it as typed (a method newer than the bundled protocol).
|
|
2051
|
+
*
|
|
2052
|
+
* @param input - Name as typed
|
|
2053
|
+
* @param similar - Methods to suggest
|
|
2054
|
+
* @param listHint - First suggestion line (how to find methods)
|
|
2055
|
+
* @returns Message and suggestion
|
|
2056
|
+
*/
|
|
2057
|
+
export function cdpMethodTypoError(input, similar, listHint) {
|
|
2058
|
+
const err = cdpMethodNotFoundError(input, similar, listHint);
|
|
2059
|
+
return {
|
|
2060
|
+
message: err.message,
|
|
2061
|
+
suggestion: `${err.suggestion}\n\nTo send it as typed (a method newer than bdg's protocol): ${sessionCommand(`bdg cdp ${input} --send-anyway`)}`,
|
|
2062
|
+
};
|
|
2063
|
+
}
|
|
2064
|
+
/**
|
|
2065
|
+
* `bdg cdp <Domain.method> --describe` for a method the bundled protocol lacks.
|
|
2066
|
+
*
|
|
2067
|
+
* @param method - Method as typed
|
|
2068
|
+
* @param protocolVersion - Bundled devtools-protocol version
|
|
2069
|
+
* @returns Message and suggestion
|
|
2070
|
+
*/
|
|
2071
|
+
export function cdpMethodNotInBundledProtocolError(method, protocolVersion) {
|
|
2072
|
+
return {
|
|
2073
|
+
message: `Method '${method}' is not in the bundled protocol (devtools-protocol ${protocolVersion})`,
|
|
2074
|
+
suggestion: `bdg cdp ${method} sends it to Chrome as is, which may still have it. Methods bdg knows: bdg cdp --search <keyword>`,
|
|
2075
|
+
};
|
|
2076
|
+
}
|
|
1965
2077
|
/**
|
|
1966
2078
|
* The skill file is not where the package should have it (a broken or
|
|
1967
2079
|
* partial install).
|