browser-debugger-cli 0.6.10 → 0.6.11
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/README.md +10 -0
- package/dist/commands/cdp.js +1 -1
- package/dist/commands/cdp.js.map +1 -1
- package/dist/commands/cleanup.js +1 -1
- package/dist/commands/cleanup.js.map +1 -1
- package/dist/commands/console.d.ts +4 -28
- package/dist/commands/console.d.ts.map +1 -1
- package/dist/commands/console.js +81 -187
- package/dist/commands/console.js.map +1 -1
- package/dist/commands/details.d.ts.map +1 -1
- package/dist/commands/details.js +8 -0
- package/dist/commands/details.js.map +1 -1
- package/dist/commands/dom/DomElementResolver.d.ts +2 -2
- package/dist/commands/dom/DomElementResolver.d.ts.map +1 -1
- package/dist/commands/dom/DomElementResolver.js +6 -6
- package/dist/commands/dom/DomElementResolver.js.map +1 -1
- package/dist/commands/dom/__tests__/screenshotResize.unit.test.d.ts +2 -0
- package/dist/commands/dom/__tests__/screenshotResize.unit.test.d.ts.map +1 -0
- package/dist/commands/dom/__tests__/screenshotResize.unit.test.js +184 -0
- package/dist/commands/dom/__tests__/screenshotResize.unit.test.js.map +1 -0
- package/dist/commands/dom/a11y.d.ts.map +1 -1
- package/dist/commands/dom/a11y.js +9 -9
- package/dist/commands/dom/a11y.js.map +1 -1
- package/dist/commands/dom/evalHelpers.d.ts.map +1 -1
- package/dist/commands/dom/evalHelpers.js +10 -7
- package/dist/commands/dom/evalHelpers.js.map +1 -1
- package/dist/commands/dom/formFillHelpers.d.ts +2 -1
- package/dist/commands/dom/formFillHelpers.d.ts.map +1 -1
- package/dist/commands/dom/formFillHelpers.js +22 -20
- package/dist/commands/dom/formFillHelpers.js.map +1 -1
- package/dist/commands/dom/formInteraction.d.ts.map +1 -1
- package/dist/commands/dom/formInteraction.js +26 -10
- package/dist/commands/dom/formInteraction.js.map +1 -1
- package/dist/commands/dom/formSubmitHelpers.d.ts +2 -1
- package/dist/commands/dom/formSubmitHelpers.d.ts.map +1 -1
- package/dist/commands/dom/formSubmitHelpers.js.map +1 -1
- package/dist/commands/dom/helpers.d.ts +11 -4
- package/dist/commands/dom/helpers.d.ts.map +1 -1
- package/dist/commands/dom/helpers.js +324 -40
- package/dist/commands/dom/helpers.js.map +1 -1
- package/dist/commands/dom/index.d.ts.map +1 -1
- package/dist/commands/dom/index.js +15 -5
- package/dist/commands/dom/index.js.map +1 -1
- package/dist/commands/dom/reactEventHelpers.d.ts +4 -4
- package/dist/commands/dom/reactEventHelpers.d.ts.map +1 -1
- package/dist/commands/dom/reactEventHelpers.js +11 -11
- package/dist/commands/dom/screenshotResize.d.ts +81 -0
- package/dist/commands/dom/screenshotResize.d.ts.map +1 -0
- package/dist/commands/dom/screenshotResize.js +103 -0
- package/dist/commands/dom/screenshotResize.js.map +1 -0
- package/dist/commands/helpJson.d.ts +20 -0
- package/dist/commands/helpJson.d.ts.map +1 -1
- package/dist/commands/helpJson.js +21 -29
- package/dist/commands/helpJson.js.map +1 -1
- package/dist/commands/network/har.d.ts.map +1 -1
- package/dist/commands/network/har.js +3 -2
- package/dist/commands/network/har.js.map +1 -1
- package/dist/commands/network/list.d.ts +0 -8
- package/dist/commands/network/list.d.ts.map +1 -1
- package/dist/commands/network/list.js +131 -201
- package/dist/commands/network/list.js.map +1 -1
- package/dist/commands/network/shared.d.ts.map +1 -1
- package/dist/commands/network/shared.js +6 -0
- package/dist/commands/network/shared.js.map +1 -1
- package/dist/commands/optionBehaviors.d.ts +26 -0
- package/dist/commands/optionBehaviors.d.ts.map +1 -0
- package/dist/commands/optionBehaviors.js +184 -0
- package/dist/commands/optionBehaviors.js.map +1 -0
- package/dist/commands/peek.d.ts +2 -4
- package/dist/commands/peek.d.ts.map +1 -1
- package/dist/commands/peek.js +108 -92
- package/dist/commands/peek.js.map +1 -1
- package/dist/commands/shared/CommandRunner.js +1 -1
- package/dist/commands/shared/CommandRunner.js.map +1 -1
- package/dist/commands/shared/dataFetcher.d.ts +58 -0
- package/dist/commands/shared/dataFetcher.d.ts.map +1 -0
- package/dist/commands/shared/dataFetcher.js +98 -0
- package/dist/commands/shared/dataFetcher.js.map +1 -0
- package/dist/commands/shared/optionTypes.d.ts +8 -4
- package/dist/commands/shared/optionTypes.d.ts.map +1 -1
- package/dist/commands/shared/startHelpers.d.ts.map +1 -1
- package/dist/commands/shared/startHelpers.js +6 -5
- package/dist/commands/shared/startHelpers.js.map +1 -1
- package/dist/commands/shared/validation.d.ts +0 -45
- package/dist/commands/shared/validation.d.ts.map +1 -1
- package/dist/commands/shared/validation.js +65 -107
- package/dist/commands/shared/validation.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +13 -4
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/stop.d.ts.map +1 -1
- package/dist/commands/stop.js +15 -4
- package/dist/commands/stop.js.map +1 -1
- package/dist/commands/tail.d.ts +2 -7
- package/dist/commands/tail.d.ts.map +1 -1
- package/dist/commands/tail.js +61 -64
- package/dist/commands/tail.js.map +1 -1
- package/dist/connection/cdp.d.ts.map +1 -1
- package/dist/connection/cdp.js +5 -3
- package/dist/connection/cdp.js.map +1 -1
- package/dist/connection/diagnostics.js +1 -1
- package/dist/connection/diagnostics.js.map +1 -1
- package/dist/connection/errors.d.ts +0 -7
- package/dist/connection/errors.d.ts.map +1 -1
- package/dist/connection/errors.js +0 -7
- package/dist/connection/errors.js.map +1 -1
- package/dist/connection/launcher/binaryResolver.d.ts.map +1 -1
- package/dist/connection/launcher/binaryResolver.js +2 -1
- package/dist/connection/launcher/binaryResolver.js.map +1 -1
- package/dist/connection/launcher/preferencesLoader.d.ts.map +1 -1
- package/dist/connection/launcher/preferencesLoader.js +2 -1
- package/dist/connection/launcher/preferencesLoader.js.map +1 -1
- package/dist/connection/launcher.d.ts.map +1 -1
- package/dist/connection/launcher.js +2 -1
- package/dist/connection/launcher.js.map +1 -1
- package/dist/connection/pageReadiness.d.ts.map +1 -1
- package/dist/connection/pageReadiness.js +2 -9
- package/dist/connection/pageReadiness.js.map +1 -1
- package/dist/daemon/handlers/BaseHandler.d.ts.map +1 -1
- package/dist/daemon/handlers/BaseHandler.js +1 -1
- package/dist/daemon/handlers/BaseHandler.js.map +1 -1
- package/dist/daemon/handlers/QueryHandlers.d.ts.map +1 -1
- package/dist/daemon/handlers/QueryHandlers.js +1 -1
- package/dist/daemon/handlers/QueryHandlers.js.map +1 -1
- package/dist/daemon/handlers/SessionHandlers.d.ts.map +1 -1
- package/dist/daemon/handlers/SessionHandlers.js +1 -1
- package/dist/daemon/handlers/SessionHandlers.js.map +1 -1
- package/dist/daemon/ipcServer.js +1 -1
- package/dist/daemon/ipcServer.js.map +1 -1
- package/dist/daemon/launcher.d.ts.map +1 -1
- package/dist/daemon/launcher.js +3 -2
- package/dist/daemon/launcher.js.map +1 -1
- package/dist/daemon/lifecycle/signalHandlers.d.ts.map +1 -1
- package/dist/daemon/lifecycle/signalHandlers.js +1 -1
- package/dist/daemon/lifecycle/signalHandlers.js.map +1 -1
- package/dist/daemon/lifecycle/workerCleanup.d.ts.map +1 -1
- package/dist/daemon/lifecycle/workerCleanup.js +4 -3
- package/dist/daemon/lifecycle/workerCleanup.js.map +1 -1
- package/dist/daemon/lifecycle/workerConfig.d.ts.map +1 -1
- package/dist/daemon/lifecycle/workerConfig.js +1 -1
- package/dist/daemon/lifecycle/workerConfig.js.map +1 -1
- package/dist/daemon/lifecycle/workerIpc.d.ts.map +1 -1
- package/dist/daemon/lifecycle/workerIpc.js +1 -1
- package/dist/daemon/lifecycle/workerIpc.js.map +1 -1
- package/dist/daemon/server/JsonlParser.d.ts.map +1 -1
- package/dist/daemon/server/JsonlParser.js +1 -1
- package/dist/daemon/server/JsonlParser.js.map +1 -1
- package/dist/daemon/startSession.d.ts.map +1 -1
- package/dist/daemon/startSession.js +1 -1
- package/dist/daemon/startSession.js.map +1 -1
- package/dist/daemon/worker/plugins.js +3 -3
- package/dist/daemon/worker/plugins.js.map +1 -1
- package/dist/index.js +23 -7
- package/dist/index.js.map +1 -1
- package/dist/ipc/utils/errors.js +1 -1
- package/dist/ipc/utils/errors.js.map +1 -1
- package/dist/session/QueryCacheManager.d.ts.map +1 -1
- package/dist/session/QueryCacheManager.js +1 -1
- package/dist/session/QueryCacheManager.js.map +1 -1
- package/dist/session/chrome.js +1 -1
- package/dist/session/chrome.js.map +1 -1
- package/dist/session/cleanup.js +5 -5
- package/dist/session/cleanup.js.map +1 -1
- package/dist/session/lock.js +1 -1
- package/dist/session/lock.js.map +1 -1
- package/dist/session/metadata.d.ts.map +1 -1
- package/dist/session/metadata.js +1 -1
- package/dist/session/metadata.js.map +1 -1
- package/dist/session/pid.js +1 -1
- package/dist/session/pid.js.map +1 -1
- package/dist/telemetry/dom.d.ts.map +1 -1
- package/dist/telemetry/dom.js +1 -1
- package/dist/telemetry/dom.js.map +1 -1
- package/dist/telemetry/filterPresets.d.ts.map +1 -1
- package/dist/telemetry/filterPresets.js +5 -2
- package/dist/telemetry/filterPresets.js.map +1 -1
- package/dist/telemetry/network.d.ts.map +1 -1
- package/dist/telemetry/network.js +1 -1
- package/dist/telemetry/network.js.map +1 -1
- package/dist/types.d.ts +97 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +33 -1
- package/dist/types.js.map +1 -1
- package/dist/ui/OutputBuilder.d.ts +2 -44
- package/dist/ui/OutputBuilder.d.ts.map +1 -1
- package/dist/ui/OutputBuilder.js +71 -103
- package/dist/ui/OutputBuilder.js.map +1 -1
- package/dist/ui/errors/CommandError.d.ts +0 -2
- package/dist/ui/errors/CommandError.d.ts.map +1 -1
- package/dist/ui/errors/CommandError.js.map +1 -1
- package/dist/ui/formatters/dom.d.ts +8 -19
- package/dist/ui/formatters/dom.d.ts.map +1 -1
- package/dist/ui/formatters/dom.js +12 -68
- package/dist/ui/formatters/dom.js.map +1 -1
- package/dist/ui/logging/logger.d.ts +1 -1
- package/dist/ui/logging/logger.d.ts.map +1 -1
- package/dist/ui/logging/logger.js +1 -1
- package/dist/ui/logging/logger.js.map +1 -1
- package/dist/ui/messages/dom.d.ts +14 -0
- package/dist/ui/messages/dom.d.ts.map +1 -0
- package/dist/ui/messages/dom.js +28 -0
- package/dist/ui/messages/dom.js.map +1 -0
- package/dist/ui/messages/errors.d.ts +83 -0
- package/dist/ui/messages/errors.d.ts.map +1 -1
- package/dist/ui/messages/errors.js +171 -0
- package/dist/ui/messages/errors.js.map +1 -1
- package/dist/utils/async.d.ts +10 -0
- package/dist/utils/async.d.ts.map +1 -0
- package/dist/utils/async.js +12 -0
- package/dist/utils/async.js.map +1 -0
- package/dist/utils/atomicFile.js +1 -1
- package/dist/utils/atomicFile.js.map +1 -1
- package/dist/utils/errorMapping.d.ts.map +1 -1
- package/dist/utils/errorMapping.js +4 -1
- package/dist/utils/errorMapping.js.map +1 -1
- package/dist/utils/exitCodes.d.ts +16 -17
- package/dist/utils/exitCodes.d.ts.map +1 -1
- package/dist/utils/exitCodes.js +85 -17
- package/dist/utils/exitCodes.js.map +1 -1
- package/dist/utils/suggestions.d.ts +19 -0
- package/dist/utils/suggestions.d.ts.map +1 -0
- package/dist/utils/suggestions.js +34 -0
- package/dist/utils/suggestions.js.map +1 -0
- package/dist/utils/taskMappings.d.ts.map +1 -1
- package/dist/utils/taskMappings.js +35 -0
- package/dist/utils/taskMappings.js.map +1 -1
- package/package.json +1 -1
package/dist/types.js
CHANGED
|
@@ -1,2 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Type guard to validate BdgResponse structure.
|
|
3
|
+
*
|
|
4
|
+
* Use this to verify responses from commands or IPC.
|
|
5
|
+
*
|
|
6
|
+
* @param value - Unknown value to check
|
|
7
|
+
* @returns True if value is a valid BdgResponse
|
|
8
|
+
*/
|
|
9
|
+
export function isBdgResponse(value) {
|
|
10
|
+
if (typeof value !== 'object' || value === null) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const obj = value;
|
|
14
|
+
return typeof obj['version'] === 'string' && typeof obj['success'] === 'boolean';
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Type guard for successful BdgResponse.
|
|
18
|
+
*
|
|
19
|
+
* @param value - Unknown value to check
|
|
20
|
+
* @returns True if value is a successful BdgResponse with data
|
|
21
|
+
*/
|
|
22
|
+
export function isSuccessResponse(value) {
|
|
23
|
+
return isBdgResponse(value) && value.success === true && value.data !== undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Type guard for error BdgResponse.
|
|
27
|
+
*
|
|
28
|
+
* @param value - Unknown value to check
|
|
29
|
+
* @returns True if value is an error BdgResponse
|
|
30
|
+
*/
|
|
31
|
+
export function isErrorResponse(value) {
|
|
32
|
+
return isBdgResponse(value) && value.success === false && typeof value.error === 'string';
|
|
33
|
+
}
|
|
2
34
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAkDA;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,GAAG,GAAG,KAAgC,CAAC;IAE7C,OAAO,OAAO,GAAG,CAAC,SAAS,CAAC,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,SAAS,CAAC,KAAK,SAAS,CAAC;AACnF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,KAAc;IAEd,OAAO,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC;AACpF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAc;IAEd,OAAO,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,KAAK,KAAK,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC;AAC5F,CAAC"}
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Structured output building for CLI commands.
|
|
3
|
-
*
|
|
4
|
-
* Provides helpers for building consistent JSON output across all commands.
|
|
5
|
-
* Moved from commands/shared to ui layer as it's presentation logic, not command logic.
|
|
6
|
-
*/
|
|
7
|
-
import type { BdgOutput, CDPTarget, NetworkRequest, ConsoleMessage, DOMData, TelemetryType } from '../types';
|
|
8
|
-
/**
|
|
9
|
-
* Output mode determines what data is included and how partial flag is set
|
|
10
3
|
*/
|
|
4
|
+
import type { BdgOutput, BdgResponse, CDPTarget, NetworkRequest, ConsoleMessage, DOMData, TelemetryType } from '../types';
|
|
11
5
|
export type OutputMode = 'preview' | 'full' | 'final';
|
|
12
|
-
/**
|
|
13
|
-
* Options for building output payloads
|
|
14
|
-
*/
|
|
15
6
|
export interface OutputBuilderOptions {
|
|
16
7
|
mode: OutputMode;
|
|
17
8
|
target: CDPTarget;
|
|
@@ -21,48 +12,15 @@ export interface OutputBuilderOptions {
|
|
|
21
12
|
domData?: DOMData;
|
|
22
13
|
activeTelemetry: TelemetryType[];
|
|
23
14
|
}
|
|
24
|
-
|
|
25
|
-
* Helper: build output payloads for different modes with consistent metadata.
|
|
26
|
-
* Modes: preview (metadata only), full (with bodies), final (complete with DOM).
|
|
27
|
-
*/
|
|
15
|
+
export declare function buildSuccessResponse<T>(data: T): BdgResponse<T>;
|
|
28
16
|
export declare class OutputBuilder {
|
|
29
|
-
/**
|
|
30
|
-
* Build session output with consistent metadata.
|
|
31
|
-
*
|
|
32
|
-
* @param options - Configuration for output construction
|
|
33
|
-
* @returns BdgOutput payload
|
|
34
|
-
*/
|
|
35
17
|
static build(options: OutputBuilderOptions): BdgOutput;
|
|
36
|
-
/**
|
|
37
|
-
* Build error output with consistent structure.
|
|
38
|
-
*
|
|
39
|
-
* @param error - Error object or string
|
|
40
|
-
* @param startTime - Session start timestamp
|
|
41
|
-
* @param target - Optional target information
|
|
42
|
-
* @returns BdgOutput payload with error
|
|
43
|
-
*/
|
|
44
18
|
static buildError(error: unknown, startTime: number, target?: CDPTarget): BdgOutput;
|
|
45
|
-
/**
|
|
46
|
-
* Build a simple JSON error response for commands.
|
|
47
|
-
* Used by commands that don't follow the full BdgOutput structure (stop, cleanup, query).
|
|
48
|
-
*
|
|
49
|
-
* @param error - Error message or Error object
|
|
50
|
-
* @param options - Optional fields (exitCode, additional data)
|
|
51
|
-
* @returns JSON-serializable error object
|
|
52
|
-
*/
|
|
53
19
|
static buildJsonError(error: string | Error, options?: {
|
|
54
20
|
exitCode?: number;
|
|
55
21
|
suggestion?: string;
|
|
56
|
-
note?: string;
|
|
57
22
|
context?: Record<string, string>;
|
|
58
23
|
}): Record<string, unknown>;
|
|
59
|
-
/**
|
|
60
|
-
* Build a simple JSON success response for commands.
|
|
61
|
-
* Used by commands that don't follow the full BdgOutput structure (stop, cleanup, query).
|
|
62
|
-
*
|
|
63
|
-
* @param data - Response data
|
|
64
|
-
* @returns JSON-serializable success object
|
|
65
|
-
*/
|
|
66
24
|
static buildJsonSuccess(data: Record<string, unknown>): Record<string, unknown>;
|
|
67
25
|
}
|
|
68
26
|
//# sourceMappingURL=OutputBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OutputBuilder.d.ts","sourceRoot":"","sources":["../../src/ui/OutputBuilder.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"OutputBuilder.d.ts","sourceRoot":"","sources":["../../src/ui/OutputBuilder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,cAAc,EACd,cAAc,EACd,OAAO,EACP,aAAa,EACd,MAAM,SAAS,CAAC;AAIjB,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAEtD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAE/D;AA2ED,qBAAa,aAAa;IACxB,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,oBAAoB,GAAG,SAAS;IA0BtD,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS;IAYnF,MAAM,CAAC,cAAc,CACnB,KAAK,EAAE,MAAM,GAAG,KAAK,EACrB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,GACrF,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAS1B,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAGhF"}
|
package/dist/ui/OutputBuilder.js
CHANGED
|
@@ -1,96 +1,83 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Structured output building for CLI commands.
|
|
3
|
-
*
|
|
4
|
-
* Provides helpers for building consistent JSON output across all commands.
|
|
5
|
-
* Moved from commands/shared to ui layer as it's presentation logic, not command logic.
|
|
6
3
|
*/
|
|
7
4
|
import { getErrorMessage } from '../utils/errors.js';
|
|
8
5
|
import { VERSION } from '../utils/version.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
export function buildSuccessResponse(data) {
|
|
7
|
+
return { version: VERSION, success: true, data };
|
|
8
|
+
}
|
|
9
|
+
function buildBaseOutput(target, startTime, partial) {
|
|
10
|
+
return {
|
|
11
|
+
version: VERSION,
|
|
12
|
+
success: true,
|
|
13
|
+
timestamp: new Date().toISOString(),
|
|
14
|
+
duration: Date.now() - startTime,
|
|
15
|
+
target: { url: target.url, title: target.title },
|
|
16
|
+
partial,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function buildPreviewData(networkRequests, consoleLogs, activeTelemetry) {
|
|
20
|
+
const data = {};
|
|
21
|
+
if (activeTelemetry.includes('network')) {
|
|
22
|
+
data['network'] = networkRequests.slice(-1000).map((req) => ({
|
|
23
|
+
requestId: req.requestId,
|
|
24
|
+
url: req.url,
|
|
25
|
+
method: req.method,
|
|
26
|
+
timestamp: req.timestamp,
|
|
27
|
+
status: req.status,
|
|
28
|
+
mimeType: req.mimeType,
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
if (activeTelemetry.includes('console')) {
|
|
32
|
+
data['console'] = consoleLogs.slice(-1000).map((msg) => ({
|
|
33
|
+
type: msg.type,
|
|
34
|
+
text: msg.text,
|
|
35
|
+
timestamp: msg.timestamp,
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
return data;
|
|
39
|
+
}
|
|
40
|
+
function buildFullData(networkRequests, consoleLogs, activeTelemetry) {
|
|
41
|
+
const data = {};
|
|
42
|
+
if (activeTelemetry.includes('network'))
|
|
43
|
+
data['network'] = networkRequests;
|
|
44
|
+
if (activeTelemetry.includes('console'))
|
|
45
|
+
data['console'] = consoleLogs;
|
|
46
|
+
return data;
|
|
47
|
+
}
|
|
48
|
+
function buildFinalData(networkRequests, consoleLogs, domData, activeTelemetry) {
|
|
49
|
+
const data = {};
|
|
50
|
+
if (activeTelemetry.includes('network'))
|
|
51
|
+
data['network'] = networkRequests;
|
|
52
|
+
if (activeTelemetry.includes('console'))
|
|
53
|
+
data['console'] = consoleLogs;
|
|
54
|
+
if (activeTelemetry.includes('dom') && domData)
|
|
55
|
+
data['dom'] = domData;
|
|
56
|
+
return data;
|
|
57
|
+
}
|
|
13
58
|
export class OutputBuilder {
|
|
14
|
-
/**
|
|
15
|
-
* Build session output with consistent metadata.
|
|
16
|
-
*
|
|
17
|
-
* @param options - Configuration for output construction
|
|
18
|
-
* @returns BdgOutput payload
|
|
19
|
-
*/
|
|
20
59
|
static build(options) {
|
|
21
60
|
const { mode, target, startTime, networkRequests, consoleLogs, domData, activeTelemetry } = options;
|
|
22
|
-
const baseOutput =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
timestamp: req.timestamp,
|
|
41
|
-
status: req.status,
|
|
42
|
-
mimeType: req.mimeType,
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
if (activeTelemetry.includes('console')) {
|
|
46
|
-
previewData['console'] = consoleLogs.slice(-1000).map((msg) => ({
|
|
47
|
-
type: msg.type,
|
|
48
|
-
text: msg.text,
|
|
49
|
-
timestamp: msg.timestamp,
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
...baseOutput,
|
|
54
|
-
data: previewData,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
if (mode === 'full') {
|
|
58
|
-
const fullData = {};
|
|
59
|
-
if (activeTelemetry.includes('network')) {
|
|
60
|
-
fullData['network'] = networkRequests; // All data with bodies
|
|
61
|
-
}
|
|
62
|
-
if (activeTelemetry.includes('console')) {
|
|
63
|
-
fullData['console'] = consoleLogs; // All data with args
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
...baseOutput,
|
|
67
|
-
data: fullData,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
const finalData = {};
|
|
71
|
-
if (activeTelemetry.includes('network')) {
|
|
72
|
-
finalData['network'] = networkRequests;
|
|
73
|
-
}
|
|
74
|
-
if (activeTelemetry.includes('console')) {
|
|
75
|
-
finalData['console'] = consoleLogs;
|
|
76
|
-
}
|
|
77
|
-
if (activeTelemetry.includes('dom') && domData) {
|
|
78
|
-
finalData['dom'] = domData;
|
|
61
|
+
const baseOutput = buildBaseOutput(target, startTime, mode !== 'final');
|
|
62
|
+
switch (mode) {
|
|
63
|
+
case 'preview':
|
|
64
|
+
return {
|
|
65
|
+
...baseOutput,
|
|
66
|
+
data: buildPreviewData(networkRequests, consoleLogs, activeTelemetry),
|
|
67
|
+
};
|
|
68
|
+
case 'full':
|
|
69
|
+
return {
|
|
70
|
+
...baseOutput,
|
|
71
|
+
data: buildFullData(networkRequests, consoleLogs, activeTelemetry),
|
|
72
|
+
};
|
|
73
|
+
case 'final':
|
|
74
|
+
return {
|
|
75
|
+
...baseOutput,
|
|
76
|
+
partial: false,
|
|
77
|
+
data: buildFinalData(networkRequests, consoleLogs, domData, activeTelemetry),
|
|
78
|
+
};
|
|
79
79
|
}
|
|
80
|
-
return {
|
|
81
|
-
...baseOutput,
|
|
82
|
-
partial: false,
|
|
83
|
-
data: finalData,
|
|
84
|
-
};
|
|
85
80
|
}
|
|
86
|
-
/**
|
|
87
|
-
* Build error output with consistent structure.
|
|
88
|
-
*
|
|
89
|
-
* @param error - Error object or string
|
|
90
|
-
* @param startTime - Session start timestamp
|
|
91
|
-
* @param target - Optional target information
|
|
92
|
-
* @returns BdgOutput payload with error
|
|
93
|
-
*/
|
|
94
81
|
static buildError(error, startTime, target) {
|
|
95
82
|
return {
|
|
96
83
|
version: VERSION,
|
|
@@ -102,14 +89,6 @@ export class OutputBuilder {
|
|
|
102
89
|
error: getErrorMessage(error),
|
|
103
90
|
};
|
|
104
91
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Build a simple JSON error response for commands.
|
|
107
|
-
* Used by commands that don't follow the full BdgOutput structure (stop, cleanup, query).
|
|
108
|
-
*
|
|
109
|
-
* @param error - Error message or Error object
|
|
110
|
-
* @param options - Optional fields (exitCode, additional data)
|
|
111
|
-
* @returns JSON-serializable error object
|
|
112
|
-
*/
|
|
113
92
|
static buildJsonError(error, options) {
|
|
114
93
|
return {
|
|
115
94
|
version: VERSION,
|
|
@@ -118,19 +97,8 @@ export class OutputBuilder {
|
|
|
118
97
|
...options,
|
|
119
98
|
};
|
|
120
99
|
}
|
|
121
|
-
/**
|
|
122
|
-
* Build a simple JSON success response for commands.
|
|
123
|
-
* Used by commands that don't follow the full BdgOutput structure (stop, cleanup, query).
|
|
124
|
-
*
|
|
125
|
-
* @param data - Response data
|
|
126
|
-
* @returns JSON-serializable success object
|
|
127
|
-
*/
|
|
128
100
|
static buildJsonSuccess(data) {
|
|
129
|
-
return {
|
|
130
|
-
version: VERSION,
|
|
131
|
-
success: true,
|
|
132
|
-
...data,
|
|
133
|
-
};
|
|
101
|
+
return { version: VERSION, success: true, ...data };
|
|
134
102
|
}
|
|
135
103
|
}
|
|
136
104
|
//# sourceMappingURL=OutputBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OutputBuilder.js","sourceRoot":"","sources":["../../src/ui/OutputBuilder.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"OutputBuilder.js","sourceRoot":"","sources":["../../src/ui/OutputBuilder.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAc7C,MAAM,UAAU,oBAAoB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IAA6B;QACnD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
export interface ErrorMetadata {
|
|
13
13
|
/** User-facing suggestion for resolving the error */
|
|
14
14
|
suggestion?: string;
|
|
15
|
-
/** Technical note or additional context */
|
|
16
|
-
note?: string;
|
|
17
15
|
/** Additional contextual key-value pairs */
|
|
18
16
|
context?: Record<string, string>;
|
|
19
17
|
/** Alternative fallback command to try when high-level command fails */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandError.d.ts","sourceRoot":"","sources":["../../../src/ui/errors/CommandError.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,
|
|
1
|
+
{"version":3,"file":"CommandError.d.ts","sourceRoot":"","sources":["../../../src/ui/errors/CommandError.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACrC;;OAEG;IACH,SAAgB,QAAQ,EAAE,aAAa,CAAC;IAExC;;OAEG;IACH,SAAgB,QAAQ,EAAE,MAAM,CAAC;IAEjC;;;;;;OAMG;gBAED,OAAO,EAAE,MAAM,EACf,QAAQ,GAAE,aAAkB,EAC5B,QAAQ,GAAE,MAAmC;CAWhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandError.js","sourceRoot":"","sources":["../../../src/ui/errors/CommandError.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"CommandError.js","sourceRoot":"","sources":["../../../src/ui/errors/CommandError.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAmBlD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC;;OAEG;IACa,QAAQ,CAAgB;IAExC;;OAEG;IACa,QAAQ,CAAS;IAEjC;;;;;;OAMG;IACH,YACE,OAAe,EACf,WAA0B,EAAE,EAC5B,WAAmB,UAAU,CAAC,eAAe;QAE7C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;CACF"}
|
|
@@ -82,29 +82,18 @@ export declare function formatDomEval(data: {
|
|
|
82
82
|
/**
|
|
83
83
|
* Format screenshot capture result for human-readable display.
|
|
84
84
|
*
|
|
85
|
-
*
|
|
86
|
-
* the selector/index and bounding box information.
|
|
85
|
+
* Shows concise single-line output. Resize/capture metadata available in --json output.
|
|
87
86
|
*
|
|
88
|
-
* @param data - Screenshot metadata
|
|
89
|
-
* @returns Formatted string with screenshot
|
|
87
|
+
* @param data - Screenshot metadata
|
|
88
|
+
* @returns Formatted string with screenshot path and optional viewport message
|
|
90
89
|
*
|
|
91
90
|
* @example
|
|
92
91
|
* ```typescript
|
|
93
|
-
* formatDomScreenshot({
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
* size: 245632,
|
|
99
|
-
* fullPage: true
|
|
100
|
-
* });
|
|
101
|
-
* // Output:
|
|
102
|
-
* // Screenshot captured
|
|
103
|
-
* // Path: /path/to/screenshot.png
|
|
104
|
-
* // Format: png
|
|
105
|
-
* // Dimensions: 1920x1080
|
|
106
|
-
* // Size: 240.0 KB
|
|
107
|
-
* // Full page: yes
|
|
92
|
+
* formatDomScreenshot({ path: './page.png', ... });
|
|
93
|
+
* // Output: Screenshot saved to ./page.png
|
|
94
|
+
*
|
|
95
|
+
* formatDomScreenshot({ path: './page.png', fullPageSkipped: { reason: 'page_too_tall', ... } });
|
|
96
|
+
* // Output: Screenshot saved to ./page.png (viewport only - page too tall)
|
|
108
97
|
* ```
|
|
109
98
|
*/
|
|
110
99
|
export declare function formatDomScreenshot(data: ScreenshotResult): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../src/ui/formatters/dom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGjF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAmC3D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAcvD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAE/D;AAED
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../src/ui/formatters/dom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGjF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAmC3D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAcvD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAE/D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAQlE"}
|
|
@@ -123,81 +123,25 @@ export function formatDomEval(data) {
|
|
|
123
123
|
/**
|
|
124
124
|
* Format screenshot capture result for human-readable display.
|
|
125
125
|
*
|
|
126
|
-
*
|
|
127
|
-
* the selector/index and bounding box information.
|
|
126
|
+
* Shows concise single-line output. Resize/capture metadata available in --json output.
|
|
128
127
|
*
|
|
129
|
-
* @param data - Screenshot metadata
|
|
130
|
-
* @returns Formatted string with screenshot
|
|
128
|
+
* @param data - Screenshot metadata
|
|
129
|
+
* @returns Formatted string with screenshot path and optional viewport message
|
|
131
130
|
*
|
|
132
131
|
* @example
|
|
133
132
|
* ```typescript
|
|
134
|
-
* formatDomScreenshot({
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* size: 245632,
|
|
140
|
-
* fullPage: true
|
|
141
|
-
* });
|
|
142
|
-
* // Output:
|
|
143
|
-
* // Screenshot captured
|
|
144
|
-
* // Path: /path/to/screenshot.png
|
|
145
|
-
* // Format: png
|
|
146
|
-
* // Dimensions: 1920x1080
|
|
147
|
-
* // Size: 240.0 KB
|
|
148
|
-
* // Full page: yes
|
|
133
|
+
* formatDomScreenshot({ path: './page.png', ... });
|
|
134
|
+
* // Output: Screenshot saved to ./page.png
|
|
135
|
+
*
|
|
136
|
+
* formatDomScreenshot({ path: './page.png', fullPageSkipped: { reason: 'page_too_tall', ... } });
|
|
137
|
+
* // Output: Screenshot saved to ./page.png (viewport only - page too tall)
|
|
149
138
|
* ```
|
|
150
139
|
*/
|
|
151
140
|
export function formatDomScreenshot(data) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
fmt.text(title).blank();
|
|
156
|
-
const kvPairs = [
|
|
157
|
-
['Path', data.path],
|
|
158
|
-
['Format', data.format.toUpperCase()],
|
|
159
|
-
];
|
|
160
|
-
if (data.format === 'jpeg' && data.quality !== undefined) {
|
|
161
|
-
kvPairs.push(['Quality', `${data.quality}%`]);
|
|
162
|
-
}
|
|
163
|
-
kvPairs.push(['Dimensions', `${data.width}x${data.height}`]);
|
|
164
|
-
kvPairs.push(['Size', sizeStr]);
|
|
165
|
-
if (data.element) {
|
|
166
|
-
const elementTarget = formatElementTarget(data.element);
|
|
167
|
-
kvPairs.push(['Element', elementTarget]);
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
kvPairs.push(['Full page', data.fullPage ? 'yes' : 'no']);
|
|
171
|
-
if (data.viewport) {
|
|
172
|
-
kvPairs.push(['Viewport', `${data.viewport.width}x${data.viewport.height}`]);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
fmt.keyValueList(kvPairs);
|
|
176
|
-
return fmt.build();
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Format file size in human-readable units.
|
|
180
|
-
*
|
|
181
|
-
* @param bytes - Size in bytes
|
|
182
|
-
* @returns Formatted size string (e.g., "240.0 KB" or "1.5 MB")
|
|
183
|
-
*/
|
|
184
|
-
function formatFileSize(bytes) {
|
|
185
|
-
const kb = bytes / 1024;
|
|
186
|
-
return kb < 1024 ? `${kb.toFixed(1)} KB` : `${(kb / 1024).toFixed(1)} MB`;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Format element target description.
|
|
190
|
-
*
|
|
191
|
-
* @param element - Element info with selector or index
|
|
192
|
-
* @returns Formatted element description
|
|
193
|
-
*/
|
|
194
|
-
function formatElementTarget(element) {
|
|
195
|
-
if (element.selector !== undefined) {
|
|
196
|
-
return element.selector;
|
|
197
|
-
}
|
|
198
|
-
if (element.index !== undefined) {
|
|
199
|
-
return `index ${element.index}`;
|
|
141
|
+
let output = `Screenshot saved to ${data.path}`;
|
|
142
|
+
if (data.fullPageSkipped && !data.scrolledTo) {
|
|
143
|
+
output += ' (viewport only - page too tall)';
|
|
200
144
|
}
|
|
201
|
-
return
|
|
145
|
+
return output;
|
|
202
146
|
}
|
|
203
147
|
//# sourceMappingURL=dom.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../../../src/ui/formatters/dom.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,cAAc,CAAC,IAAoB;IACjD,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IACxC,MAAM,GAAG,GAAG,IAAI,eAAe,EAAE,CAAC;IAElC,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QAChB,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAE1E,OAAO,GAAG;aACP,IAAI,CAAC,4BAA4B,QAAQ,GAAG,CAAC;aAC7C,KAAK,EAAE;aACP,OAAO,CAAC,cAAc,EAAE;YACvB,0DAA0D,YAAY,KAAK;YAC3E,oCAAoC;SACrC,CAAC;aACD,KAAK,EAAE,CAAC;IACb,CAAC;IAED,MAA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IAED,MAAM,GAAG,GAAG,IAAI,eAAe,EAAE,CAAC;IAClC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QACxB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC,KAAK,EAAE,CAAC;AACrB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,aAAa,CAAC,IAAyB;IACrD,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAsB;IACxD,IAAI,MAAM,GAAG,uBAAuB,IAAI,CAAC,IAAI,EAAE,CAAC;IAEhD,IAAI,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;QAC7C,MAAM,IAAI,kCAAkC,CAAC;IAC/C,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -29,7 +29,7 @@ export type LogLevel = 'info' | 'debug';
|
|
|
29
29
|
* Log contexts for different components.
|
|
30
30
|
* Used to prefix log messages with component name.
|
|
31
31
|
*/
|
|
32
|
-
export type LogContext = 'bdg' | 'launcher' | 'daemon' | 'worker' | 'client' | 'cleanup' | 'session' | 'chrome' | 'cdp' | 'ipc' | 'http' | 'dialogs' | 'navigation' | 'console' | 'dom' | 'network' | 'diagnostics' | 'readiness' | 'atomic-file' | 'object-expander';
|
|
32
|
+
export type LogContext = 'bdg' | 'launcher' | 'daemon' | 'worker' | 'client' | 'cleanup' | 'session' | 'chrome' | 'cdp' | 'ipc' | 'http' | 'dialogs' | 'navigation' | 'console' | 'dom' | 'network' | 'diagnostics' | 'readiness' | 'atomic-file' | 'object-expander' | 'fetcher';
|
|
33
33
|
/**
|
|
34
34
|
* Logger instance with support for different log levels.
|
|
35
35
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/ui/logging/logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM,UAAU,GAClB,KAAK,GACL,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,QAAQ,GACR,KAAK,GACL,KAAK,GACL,MAAM,GACN,SAAS,GACT,YAAY,GACZ,SAAS,GACT,KAAK,GACL,SAAS,GACT,aAAa,GACb,WAAW,GACX,aAAa,GACb,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/ui/logging/logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAExC;;;GAGG;AACH,MAAM,MAAM,UAAU,GAClB,KAAK,GACL,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,QAAQ,GACR,KAAK,GACL,KAAK,GACL,MAAM,GACN,SAAS,GACT,YAAY,GACZ,SAAS,GACT,KAAK,GACL,SAAS,GACT,aAAa,GACb,WAAW,GACX,aAAa,GACb,iBAAiB,GACjB,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB;;;OAGG;IACH,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhC;;;OAGG;IACH,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAEjC;;;OAGG;IACH,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,CAaxD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAEhF"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* By default, only 'info' level logs are shown. Set BDG_DEBUG=1 or use --debug
|
|
6
6
|
* flag to enable verbose 'debug' level logs.
|
|
7
7
|
*/
|
|
8
|
-
import { getErrorMessage } from '../../
|
|
8
|
+
import { getErrorMessage } from '../../utils/errors.js';
|
|
9
9
|
let debugEnabled = false;
|
|
10
10
|
/**
|
|
11
11
|
* Enable debug logging globally.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/ui/logging/logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../src/ui/logging/logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,IAAI,YAAY,GAAG,KAAK,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB;IAChC,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,GAAG,CAAC;AAC1D,CAAC;AA4DD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,YAAY,CAAC,OAAmB;IAC9C,MAAM,UAAU,GAAG,CAAC,OAAe,EAAE,QAAkB,OAAO,EAAQ,EAAE;QACtE,IAAI,KAAK,KAAK,OAAO,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;YAC3C,OAAO;QACT,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC,CAAC;IAEF,MAAM,MAAM,GAAG,CAAC,CAAC,OAAe,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAW,CAAC;IAC7E,MAAM,CAAC,IAAI,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC/D,MAAM,CAAC,KAAK,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAEjE,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,OAAe,EAAE,KAAc;IACxE,GAAG,CAAC,KAAK,CAAC,aAAa,OAAO,KAAK,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM command messages (bdg dom)
|
|
3
|
+
*
|
|
4
|
+
* User-facing messages for DOM command output and formatting.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Generate resize info message for screenshot output.
|
|
8
|
+
*
|
|
9
|
+
* @param originalTokens - Token count at original size
|
|
10
|
+
* @param finalTokens - Token count after resize
|
|
11
|
+
* @returns Formatted resize info string
|
|
12
|
+
*/
|
|
13
|
+
export declare function screenshotResizeInfo(originalTokens: number, finalTokens: number): string;
|
|
14
|
+
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../src/ui/messages/dom.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAeH;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAExF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM command messages (bdg dom)
|
|
3
|
+
*
|
|
4
|
+
* User-facing messages for DOM command output and formatting.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Format token count for display.
|
|
8
|
+
*
|
|
9
|
+
* @param tokens - Token count
|
|
10
|
+
* @returns Formatted string (e.g., "1.6k" or "500")
|
|
11
|
+
*/
|
|
12
|
+
function formatTokenCount(tokens) {
|
|
13
|
+
if (tokens >= 1000) {
|
|
14
|
+
return `${(tokens / 1000).toFixed(1)}k`;
|
|
15
|
+
}
|
|
16
|
+
return String(tokens);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Generate resize info message for screenshot output.
|
|
20
|
+
*
|
|
21
|
+
* @param originalTokens - Token count at original size
|
|
22
|
+
* @param finalTokens - Token count after resize
|
|
23
|
+
* @returns Formatted resize info string
|
|
24
|
+
*/
|
|
25
|
+
export function screenshotResizeInfo(originalTokens, finalTokens) {
|
|
26
|
+
return `resized: ${formatTokenCount(originalTokens)} → ${formatTokenCount(finalTokens)} tokens`;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=dom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.js","sourceRoot":"","sources":["../../../src/ui/messages/dom.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,MAAc;IACtC,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;QACnB,OAAO,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAC1C,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;AACxB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,cAAsB,EAAE,WAAmB;IAC9E,OAAO,YAAY,gBAAgB,CAAC,cAAc,CAAC,MAAM,gBAAgB,CAAC,WAAW,CAAC,SAAS,CAAC;AAClG,CAAC"}
|