browser-debugger-cli 0.6.0 → 0.6.1
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 -6
- package/dist/__tests__/smoke/error-handling.smoke.test.js +14 -48
- package/dist/__tests__/smoke/error-handling.smoke.test.js.map +1 -1
- package/dist/__tests__/smoke/session-lifecycle.smoke.test.js +1 -1
- package/dist/__tests__/smoke/session-lifecycle.smoke.test.js.map +1 -1
- package/dist/__testutils__/testCleanup.js +1 -1
- package/dist/__testutils__/testCleanup.js.map +1 -1
- package/dist/cdp/protocol.d.ts +0 -48
- package/dist/cdp/protocol.d.ts.map +1 -1
- package/dist/cdp/protocol.js +0 -94
- package/dist/cdp/protocol.js.map +1 -1
- package/dist/commands/__tests__/cdp.contract.test.js +2 -2
- package/dist/commands/__tests__/cdp.contract.test.js.map +1 -1
- package/dist/commands/__tests__/domEval.contract.test.js +8 -4
- package/dist/commands/__tests__/domEval.contract.test.js.map +1 -1
- package/dist/commands/cdp.d.ts.map +1 -1
- package/dist/commands/cdp.js +4 -37
- package/dist/commands/cdp.js.map +1 -1
- package/dist/commands/cleanup.d.ts.map +1 -1
- package/dist/commands/cleanup.js +4 -17
- package/dist/commands/cleanup.js.map +1 -1
- package/dist/commands/console.d.ts.map +1 -1
- package/dist/commands/console.js +3 -8
- package/dist/commands/console.js.map +1 -1
- package/dist/commands/details.d.ts.map +1 -1
- package/dist/commands/details.js +1 -1
- package/dist/commands/details.js.map +1 -1
- package/dist/commands/{domEvalHelpers.d.ts → dom/evalHelpers.d.ts} +8 -5
- package/dist/commands/dom/evalHelpers.d.ts.map +1 -0
- package/dist/commands/{domEvalHelpers.js → dom/evalHelpers.js} +14 -13
- package/dist/commands/dom/evalHelpers.js.map +1 -0
- package/dist/commands/dom/formFillHelpers.d.ts +47 -0
- package/dist/commands/dom/formFillHelpers.d.ts.map +1 -0
- package/dist/commands/dom/formFillHelpers.js +185 -0
- package/dist/commands/dom/formFillHelpers.js.map +1 -0
- package/dist/commands/dom/formInteraction.d.ts +17 -0
- package/dist/commands/dom/formInteraction.d.ts.map +1 -0
- package/dist/commands/dom/formInteraction.js +239 -0
- package/dist/commands/dom/formInteraction.js.map +1 -0
- package/dist/commands/dom/formSubmitHelpers.d.ts +58 -0
- package/dist/commands/dom/formSubmitHelpers.d.ts.map +1 -0
- package/dist/commands/dom/formSubmitHelpers.js +176 -0
- package/dist/commands/dom/formSubmitHelpers.js.map +1 -0
- package/dist/commands/dom/helpers.d.ts +34 -0
- package/dist/commands/dom/helpers.d.ts.map +1 -0
- package/dist/commands/dom/helpers.js +244 -0
- package/dist/commands/dom/helpers.js.map +1 -0
- package/dist/commands/{dom.d.ts → dom/index.d.ts} +1 -1
- package/dist/commands/dom/index.d.ts.map +1 -0
- package/dist/commands/{dom.js → dom/index.js} +33 -123
- package/dist/commands/dom/index.js.map +1 -0
- package/dist/commands/dom/reactEventHelpers.d.ts +80 -0
- package/dist/commands/dom/reactEventHelpers.d.ts.map +1 -0
- package/dist/commands/dom/reactEventHelpers.js +274 -0
- package/dist/commands/dom/reactEventHelpers.js.map +1 -0
- package/dist/commands/network.js +1 -1
- package/dist/commands/network.js.map +1 -1
- package/dist/commands/peek.d.ts.map +1 -1
- package/dist/commands/peek.js +47 -52
- package/dist/commands/peek.js.map +1 -1
- package/dist/commands/shared/CommandRunner.d.ts.map +1 -1
- package/dist/commands/shared/CommandRunner.js +3 -2
- package/dist/commands/shared/CommandRunner.js.map +1 -1
- package/dist/commands/shared/commonOptions.d.ts.map +1 -1
- package/dist/commands/shared/commonOptions.js +3 -1
- package/dist/commands/shared/commonOptions.js.map +1 -1
- package/dist/commands/shared/daemonErrorHandler.d.ts +30 -0
- package/dist/commands/shared/daemonErrorHandler.d.ts.map +1 -0
- package/dist/commands/shared/daemonErrorHandler.js +32 -0
- package/dist/commands/shared/daemonErrorHandler.js.map +1 -0
- package/dist/commands/shared/{daemonSessionController.d.ts → startHelpers.d.ts} +7 -1
- package/dist/commands/shared/startHelpers.d.ts.map +1 -0
- package/dist/commands/shared/{daemonSessionController.js → startHelpers.js} +13 -5
- package/dist/commands/shared/startHelpers.js.map +1 -0
- package/dist/commands/shared/validation.d.ts +44 -0
- package/dist/commands/shared/validation.d.ts.map +1 -0
- package/dist/commands/shared/validation.js +68 -0
- package/dist/commands/shared/validation.js.map +1 -0
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +9 -25
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +6 -4
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/stop.d.ts.map +1 -1
- package/dist/commands/stop.js +5 -16
- package/dist/commands/stop.js.map +1 -1
- package/dist/commands/tail.d.ts.map +1 -1
- package/dist/commands/tail.js +49 -44
- package/dist/commands/tail.js.map +1 -1
- package/dist/commands/types.d.ts +43 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/commands/types.js +8 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +3 -1
- package/dist/commands.js.map +1 -1
- package/dist/connection/__tests__/cdp.contract.test.js +7 -7
- package/dist/connection/__tests__/cdp.contract.test.js.map +1 -1
- package/dist/connection/__tests__/handlers.unit.test.d.ts +11 -0
- package/dist/connection/__tests__/handlers.unit.test.d.ts.map +1 -0
- package/dist/connection/__tests__/handlers.unit.test.js +220 -0
- package/dist/connection/__tests__/handlers.unit.test.js.map +1 -0
- package/dist/connection/__tests__/pageReadiness.contract.test.d.ts +14 -0
- package/dist/connection/__tests__/pageReadiness.contract.test.d.ts.map +1 -0
- package/dist/connection/__tests__/pageReadiness.contract.test.js +382 -0
- package/dist/connection/__tests__/pageReadiness.contract.test.js.map +1 -0
- package/dist/connection/__tests__/portReservation.contract.test.d.ts +14 -0
- package/dist/connection/__tests__/portReservation.contract.test.d.ts.map +1 -0
- package/dist/connection/__tests__/portReservation.contract.test.js +250 -0
- package/dist/connection/__tests__/portReservation.contract.test.js.map +1 -0
- package/dist/connection/cdp.d.ts +34 -11
- package/dist/connection/cdp.d.ts.map +1 -1
- package/dist/connection/cdp.js +61 -45
- package/dist/connection/cdp.js.map +1 -1
- package/dist/connection/config.d.ts +63 -0
- package/dist/connection/config.d.ts.map +1 -0
- package/dist/connection/config.js +46 -0
- package/dist/connection/config.js.map +1 -0
- package/dist/connection/errors.d.ts +6 -21
- package/dist/connection/errors.d.ts.map +1 -1
- package/dist/connection/errors.js +7 -26
- package/dist/connection/errors.js.map +1 -1
- package/dist/connection/events.d.ts +30 -0
- package/dist/connection/events.d.ts.map +1 -0
- package/dist/connection/events.js +8 -0
- package/dist/connection/events.js.map +1 -0
- package/dist/connection/handlers.d.ts +3 -5
- package/dist/connection/handlers.d.ts.map +1 -1
- package/dist/connection/handlers.js +10 -12
- package/dist/connection/handlers.js.map +1 -1
- package/dist/connection/launcher/binaryResolver.d.ts +40 -0
- package/dist/connection/launcher/binaryResolver.d.ts.map +1 -0
- package/dist/connection/launcher/binaryResolver.js +78 -0
- package/dist/connection/launcher/binaryResolver.js.map +1 -0
- package/dist/connection/launcher/flagsBuilder.d.ts +64 -0
- package/dist/connection/launcher/flagsBuilder.d.ts.map +1 -0
- package/dist/connection/launcher/flagsBuilder.js +84 -0
- package/dist/connection/launcher/flagsBuilder.js.map +1 -0
- package/dist/connection/launcher/preferencesLoader.d.ts +74 -0
- package/dist/connection/launcher/preferencesLoader.d.ts.map +1 -0
- package/dist/connection/launcher/preferencesLoader.js +89 -0
- package/dist/connection/launcher/preferencesLoader.js.map +1 -0
- package/dist/connection/launcher.d.ts +24 -1
- package/dist/connection/launcher.d.ts.map +1 -1
- package/dist/connection/launcher.js +30 -205
- package/dist/connection/launcher.js.map +1 -1
- package/dist/connection/pageReadiness.d.ts +8 -8
- package/dist/connection/pageReadiness.d.ts.map +1 -1
- package/dist/connection/pageReadiness.js +36 -52
- package/dist/connection/pageReadiness.js.map +1 -1
- package/dist/connection/portReservation.d.ts +40 -0
- package/dist/connection/portReservation.d.ts.map +1 -0
- package/dist/connection/portReservation.js +55 -0
- package/dist/connection/portReservation.js.map +1 -0
- package/dist/connection/typed-cdp.d.ts +2 -1
- package/dist/connection/typed-cdp.d.ts.map +1 -1
- package/dist/connection/typed-cdp.js.map +1 -1
- package/dist/connection/types.d.ts +103 -0
- package/dist/connection/types.d.ts.map +1 -0
- package/dist/connection/types.js +8 -0
- package/dist/connection/types.js.map +1 -0
- package/dist/constants.d.ts +0 -83
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +0 -83
- package/dist/constants.js.map +1 -1
- package/dist/daemon/__tests__/JsonlParser.unit.test.d.ts +8 -0
- package/dist/daemon/__tests__/JsonlParser.unit.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/JsonlParser.unit.test.js +140 -0
- package/dist/daemon/__tests__/JsonlParser.unit.test.js.map +1 -0
- package/dist/daemon/__tests__/PendingRequestManager.unit.test.d.ts +8 -0
- package/dist/daemon/__tests__/PendingRequestManager.unit.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/PendingRequestManager.unit.test.js +276 -0
- package/dist/daemon/__tests__/PendingRequestManager.unit.test.js.map +1 -0
- package/dist/daemon/__tests__/TelemetryStore.unit.test.d.ts +8 -0
- package/dist/daemon/__tests__/TelemetryStore.unit.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/TelemetryStore.unit.test.js +290 -0
- package/dist/daemon/__tests__/TelemetryStore.unit.test.js.map +1 -0
- package/dist/daemon/__tests__/commandRegistry.contract.test.d.ts +8 -0
- package/dist/daemon/__tests__/commandRegistry.contract.test.d.ts.map +1 -0
- package/dist/daemon/__tests__/commandRegistry.contract.test.js +384 -0
- package/dist/daemon/__tests__/commandRegistry.contract.test.js.map +1 -0
- package/dist/daemon/__tests__/ipcServer.contract.test.js +2 -1
- package/dist/daemon/__tests__/ipcServer.contract.test.js.map +1 -1
- package/dist/daemon/errors.d.ts +65 -0
- package/dist/daemon/errors.d.ts.map +1 -0
- package/dist/daemon/errors.js +82 -0
- package/dist/daemon/errors.js.map +1 -0
- package/dist/daemon/handlers/CommandHandlers.d.ts +32 -0
- package/dist/daemon/handlers/CommandHandlers.d.ts.map +1 -0
- package/dist/daemon/handlers/CommandHandlers.js +93 -0
- package/dist/daemon/handlers/CommandHandlers.js.map +1 -0
- package/dist/daemon/handlers/QueryHandlers.d.ts +35 -0
- package/dist/daemon/handlers/QueryHandlers.d.ts.map +1 -0
- package/dist/daemon/handlers/QueryHandlers.js +176 -0
- package/dist/daemon/handlers/QueryHandlers.js.map +1 -0
- package/dist/daemon/handlers/SessionHandlers.d.ts +32 -0
- package/dist/daemon/handlers/SessionHandlers.d.ts.map +1 -0
- package/dist/daemon/handlers/SessionHandlers.js +227 -0
- package/dist/daemon/handlers/SessionHandlers.js.map +1 -0
- package/dist/daemon/handlers/pendingRequests.d.ts +50 -0
- package/dist/daemon/handlers/pendingRequests.d.ts.map +1 -0
- package/dist/daemon/handlers/pendingRequests.js +57 -0
- package/dist/daemon/handlers/pendingRequests.js.map +1 -0
- package/dist/daemon/handlers/requestHandlers.d.ts +51 -0
- package/dist/daemon/handlers/requestHandlers.d.ts.map +1 -0
- package/dist/daemon/handlers/requestHandlers.js +61 -0
- package/dist/daemon/handlers/requestHandlers.js.map +1 -0
- package/dist/daemon/handlers/responseHandler.d.ts +42 -0
- package/dist/daemon/handlers/responseHandler.d.ts.map +1 -0
- package/dist/daemon/handlers/responseHandler.js +195 -0
- package/dist/daemon/handlers/responseHandler.js.map +1 -0
- package/dist/daemon/ipcServer.d.ts +19 -41
- package/dist/daemon/ipcServer.d.ts.map +1 -1
- package/dist/daemon/ipcServer.js +83 -655
- package/dist/daemon/ipcServer.js.map +1 -1
- package/dist/daemon/launcher.d.ts.map +1 -1
- package/dist/daemon/launcher.js +6 -3
- package/dist/daemon/launcher.js.map +1 -1
- package/dist/daemon/lifecycle/cdpSetup.d.ts +24 -0
- package/dist/daemon/lifecycle/cdpSetup.d.ts.map +1 -0
- package/dist/daemon/lifecycle/cdpSetup.js +59 -0
- package/dist/daemon/lifecycle/cdpSetup.js.map +1 -0
- package/dist/daemon/lifecycle/chromeConnection.d.ts +17 -0
- package/dist/daemon/lifecycle/chromeConnection.d.ts.map +1 -0
- package/dist/daemon/lifecycle/chromeConnection.js +80 -0
- package/dist/daemon/lifecycle/chromeConnection.js.map +1 -0
- package/dist/daemon/lifecycle/signalHandlers.d.ts +14 -0
- package/dist/daemon/lifecycle/signalHandlers.d.ts.map +1 -0
- package/dist/daemon/lifecycle/signalHandlers.js +35 -0
- package/dist/daemon/lifecycle/signalHandlers.js.map +1 -0
- package/dist/daemon/lifecycle/workerCleanup.d.ts +27 -0
- package/dist/daemon/lifecycle/workerCleanup.d.ts.map +1 -0
- package/dist/daemon/lifecycle/workerCleanup.js +144 -0
- package/dist/daemon/lifecycle/workerCleanup.js.map +1 -0
- package/dist/daemon/lifecycle/workerConfig.d.ts +14 -0
- package/dist/daemon/lifecycle/workerConfig.d.ts.map +1 -0
- package/dist/daemon/lifecycle/workerConfig.js +66 -0
- package/dist/daemon/lifecycle/workerConfig.js.map +1 -0
- package/dist/daemon/lifecycle/workerIpc.d.ts +14 -0
- package/dist/daemon/lifecycle/workerIpc.d.ts.map +1 -0
- package/dist/daemon/lifecycle/workerIpc.js +87 -0
- package/dist/daemon/lifecycle/workerIpc.js.map +1 -0
- package/dist/daemon/server/JsonlParser.d.ts +31 -0
- package/dist/daemon/server/JsonlParser.d.ts.map +1 -0
- package/dist/daemon/server/JsonlParser.js +57 -0
- package/dist/daemon/server/JsonlParser.js.map +1 -0
- package/dist/daemon/server/SocketServer.d.ts.map +1 -1
- package/dist/daemon/server/SocketServer.js +2 -2
- package/dist/daemon/server/SocketServer.js.map +1 -1
- package/dist/daemon/server/WorkerManager.d.ts +3 -3
- package/dist/daemon/server/WorkerManager.d.ts.map +1 -1
- package/dist/daemon/server/WorkerManager.js +10 -19
- package/dist/daemon/server/WorkerManager.js.map +1 -1
- package/dist/daemon/services/SessionService.d.ts +87 -0
- package/dist/daemon/services/SessionService.d.ts.map +1 -0
- package/dist/daemon/services/SessionService.js +45 -0
- package/dist/daemon/services/SessionService.js.map +1 -0
- package/dist/daemon/startSession.d.ts.map +1 -1
- package/dist/daemon/startSession.js +54 -31
- package/dist/daemon/startSession.js.map +1 -1
- package/dist/daemon/worker/commandRegistry.d.ts +1 -1
- package/dist/daemon/worker/commandRegistry.d.ts.map +1 -1
- package/dist/daemon/worker/commandRegistry.js +20 -215
- package/dist/daemon/worker/commandRegistry.js.map +1 -1
- package/dist/daemon/worker.d.ts +3 -12
- package/dist/daemon/worker.d.ts.map +1 -1
- package/dist/daemon/worker.js +47 -367
- package/dist/daemon/worker.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ipc/__tests__/client.contract.test.d.ts +0 -15
- package/dist/ipc/__tests__/client.contract.test.d.ts.map +1 -1
- package/dist/ipc/__tests__/client.contract.test.js +8 -23
- package/dist/ipc/__tests__/client.contract.test.js.map +1 -1
- package/dist/ipc/__tests__/errors.unit.test.d.ts +7 -0
- package/dist/ipc/__tests__/errors.unit.test.d.ts.map +1 -0
- package/dist/ipc/__tests__/errors.unit.test.js +77 -0
- package/dist/ipc/__tests__/errors.unit.test.js.map +1 -0
- package/dist/ipc/__tests__/guards.unit.test.d.ts +7 -0
- package/dist/ipc/__tests__/guards.unit.test.d.ts.map +1 -0
- package/dist/ipc/__tests__/guards.unit.test.js +73 -0
- package/dist/ipc/__tests__/guards.unit.test.js.map +1 -0
- package/dist/ipc/__tests__/jsonl.unit.test.d.ts +7 -0
- package/dist/ipc/__tests__/jsonl.unit.test.d.ts.map +1 -0
- package/dist/ipc/__tests__/jsonl.unit.test.js +85 -0
- package/dist/ipc/__tests__/jsonl.unit.test.js.map +1 -0
- package/dist/ipc/__tests__/validation.unit.test.d.ts +7 -0
- package/dist/ipc/__tests__/validation.unit.test.d.ts.map +1 -0
- package/dist/ipc/__tests__/validation.unit.test.js +60 -0
- package/dist/ipc/__tests__/validation.unit.test.js.map +1 -0
- package/dist/ipc/client.d.ts +93 -84
- package/dist/ipc/client.d.ts.map +1 -1
- package/dist/ipc/client.js +121 -192
- package/dist/ipc/client.js.map +1 -1
- package/dist/ipc/index.d.ts +17 -0
- package/dist/ipc/index.d.ts.map +1 -0
- package/dist/ipc/index.js +23 -0
- package/dist/ipc/index.js.map +1 -0
- package/dist/ipc/protocol/commands.d.ts +144 -0
- package/dist/ipc/protocol/commands.d.ts.map +1 -0
- package/dist/ipc/protocol/commands.js +23 -0
- package/dist/ipc/protocol/commands.js.map +1 -0
- package/dist/ipc/protocol/guards.d.ts +47 -0
- package/dist/ipc/protocol/guards.d.ts.map +1 -0
- package/dist/ipc/protocol/guards.js +62 -0
- package/dist/ipc/protocol/guards.js.map +1 -0
- package/dist/ipc/protocol/index.d.ts +9 -0
- package/dist/ipc/protocol/index.d.ts.map +1 -0
- package/dist/ipc/protocol/index.js +8 -0
- package/dist/ipc/protocol/index.js.map +1 -0
- package/dist/ipc/protocol/messages.d.ts +64 -0
- package/dist/ipc/protocol/messages.d.ts.map +1 -0
- package/dist/ipc/protocol/messages.js +8 -0
- package/dist/ipc/protocol/messages.js.map +1 -0
- package/dist/ipc/session/errors.d.ts +25 -0
- package/dist/ipc/session/errors.d.ts.map +1 -0
- package/dist/ipc/{types.js → session/errors.js} +11 -6
- package/dist/ipc/session/errors.js.map +1 -0
- package/dist/ipc/session/index.d.ts +16 -0
- package/dist/ipc/session/index.d.ts.map +1 -0
- package/dist/ipc/session/index.js +7 -0
- package/dist/ipc/session/index.js.map +1 -0
- package/dist/ipc/session/lifecycle.d.ts +125 -0
- package/dist/ipc/session/lifecycle.d.ts.map +1 -0
- package/dist/ipc/session/lifecycle.js +7 -0
- package/dist/ipc/session/lifecycle.js.map +1 -0
- package/dist/ipc/session/queries.d.ts +94 -0
- package/dist/ipc/session/queries.d.ts.map +1 -0
- package/dist/ipc/session/queries.js +7 -0
- package/dist/ipc/session/queries.js.map +1 -0
- package/dist/ipc/session/types.d.ts +28 -0
- package/dist/ipc/session/types.d.ts.map +1 -0
- package/dist/ipc/session/types.js +7 -0
- package/dist/ipc/session/types.js.map +1 -0
- package/dist/ipc/transport/IPCError.d.ts +82 -0
- package/dist/ipc/transport/IPCError.d.ts.map +1 -0
- package/dist/ipc/transport/IPCError.js +109 -0
- package/dist/ipc/transport/IPCError.js.map +1 -0
- package/dist/ipc/transport/errors.d.ts +11 -0
- package/dist/ipc/transport/errors.d.ts.map +1 -0
- package/dist/ipc/transport/errors.js +28 -0
- package/dist/ipc/transport/errors.js.map +1 -0
- package/dist/ipc/transport/index.d.ts +16 -0
- package/dist/ipc/transport/index.d.ts.map +1 -0
- package/dist/ipc/transport/index.js +77 -0
- package/dist/ipc/transport/index.js.map +1 -0
- package/dist/ipc/transport/jsonl.d.ts +23 -0
- package/dist/ipc/transport/jsonl.d.ts.map +1 -0
- package/dist/ipc/transport/jsonl.js +36 -0
- package/dist/ipc/transport/jsonl.js.map +1 -0
- package/dist/ipc/transport/socket.d.ts +27 -0
- package/dist/ipc/transport/socket.d.ts.map +1 -0
- package/dist/ipc/transport/socket.js +49 -0
- package/dist/ipc/transport/socket.js.map +1 -0
- package/dist/ipc/transport/validation.d.ts +21 -0
- package/dist/ipc/transport/validation.d.ts.map +1 -0
- package/dist/ipc/transport/validation.js +23 -0
- package/dist/ipc/transport/validation.js.map +1 -0
- package/dist/ipc/utils/errors.d.ts +25 -0
- package/dist/ipc/utils/errors.d.ts.map +1 -0
- package/dist/ipc/utils/errors.js +29 -0
- package/dist/ipc/utils/errors.js.map +1 -0
- package/dist/ipc/utils/index.d.ts +12 -0
- package/dist/ipc/utils/index.d.ts.map +1 -0
- package/dist/ipc/utils/index.js +11 -0
- package/dist/ipc/utils/index.js.map +1 -0
- package/dist/ipc/utils/requestId.d.ts +23 -0
- package/dist/ipc/utils/requestId.d.ts.map +1 -0
- package/dist/ipc/utils/requestId.js +27 -0
- package/dist/ipc/utils/requestId.js.map +1 -0
- package/dist/ipc/utils/responseValidator.d.ts.map +1 -0
- package/dist/ipc/{responseValidator.js → utils/responseValidator.js} +2 -1
- package/dist/ipc/utils/responseValidator.js.map +1 -0
- package/dist/ipc/utils/session.d.ts +36 -0
- package/dist/ipc/utils/session.d.ts.map +1 -0
- package/dist/ipc/utils/session.js +37 -0
- package/dist/ipc/utils/session.js.map +1 -0
- package/dist/ipc/utils/types.d.ts +17 -0
- package/dist/ipc/utils/types.d.ts.map +1 -0
- package/dist/ipc/utils/types.js +7 -0
- package/dist/ipc/utils/types.js.map +1 -0
- package/dist/session/__tests__/chrome-cache.contract.test.d.ts +7 -0
- package/dist/session/__tests__/chrome-cache.contract.test.d.ts.map +1 -0
- package/dist/session/__tests__/chrome-cache.contract.test.js +77 -0
- package/dist/session/__tests__/chrome-cache.contract.test.js.map +1 -0
- package/dist/session/__tests__/cleanup.contract.test.d.ts +7 -0
- package/dist/session/__tests__/cleanup.contract.test.d.ts.map +1 -0
- package/dist/session/__tests__/cleanup.contract.test.js +84 -0
- package/dist/session/__tests__/cleanup.contract.test.js.map +1 -0
- package/dist/session/__tests__/lock.contract.test.d.ts +7 -0
- package/dist/session/__tests__/lock.contract.test.d.ts.map +1 -0
- package/dist/session/__tests__/lock.contract.test.js +77 -0
- package/dist/session/__tests__/lock.contract.test.js.map +1 -0
- package/dist/session/__tests__/metadata.contract.test.d.ts +7 -0
- package/dist/session/__tests__/metadata.contract.test.d.ts.map +1 -0
- package/dist/session/__tests__/metadata.contract.test.js +87 -0
- package/dist/session/__tests__/metadata.contract.test.js.map +1 -0
- package/dist/session/chrome.d.ts +20 -0
- package/dist/session/chrome.d.ts.map +1 -1
- package/dist/session/chrome.js +80 -16
- package/dist/session/chrome.js.map +1 -1
- package/dist/session/cleanup.d.ts +15 -2
- package/dist/session/cleanup.d.ts.map +1 -1
- package/dist/session/cleanup.js +100 -72
- package/dist/session/cleanup.js.map +1 -1
- package/dist/session/lock.d.ts.map +1 -1
- package/dist/session/lock.js +101 -90
- package/dist/session/lock.js.map +1 -1
- package/dist/session/metadata.d.ts +10 -3
- package/dist/session/metadata.d.ts.map +1 -1
- package/dist/session/metadata.js +24 -6
- package/dist/session/metadata.js.map +1 -1
- package/dist/session/paths.d.ts +0 -9
- package/dist/session/paths.d.ts.map +1 -1
- package/dist/session/paths.js +0 -11
- package/dist/session/paths.js.map +1 -1
- package/dist/session/pid.d.ts +15 -0
- package/dist/session/pid.d.ts.map +1 -1
- package/dist/session/pid.js +39 -21
- package/dist/session/pid.js.map +1 -1
- package/dist/session/process.d.ts +4 -41
- package/dist/session/process.d.ts.map +1 -1
- package/dist/session/process.js +4 -85
- package/dist/session/process.js.map +1 -1
- package/dist/session/statusData.d.ts +50 -0
- package/dist/session/statusData.d.ts.map +1 -0
- package/dist/session/statusData.js +51 -0
- package/dist/session/statusData.js.map +1 -0
- package/dist/telemetry/__tests__/navigation.contract.test.d.ts +8 -0
- package/dist/telemetry/__tests__/navigation.contract.test.d.ts.map +1 -0
- package/dist/telemetry/__tests__/navigation.contract.test.js +211 -0
- package/dist/telemetry/__tests__/navigation.contract.test.js.map +1 -0
- package/dist/telemetry/__tests__/network.contract.test.d.ts +0 -20
- package/dist/telemetry/__tests__/network.contract.test.d.ts.map +1 -1
- package/dist/telemetry/__tests__/network.contract.test.js +2 -64
- package/dist/telemetry/__tests__/network.contract.test.js.map +1 -1
- package/dist/telemetry/__tests__/utils.unit.test.d.ts +7 -0
- package/dist/telemetry/__tests__/utils.unit.test.d.ts.map +1 -0
- package/dist/telemetry/__tests__/utils.unit.test.js +91 -0
- package/dist/telemetry/__tests__/utils.unit.test.js.map +1 -0
- package/dist/telemetry/console.d.ts.map +1 -1
- package/dist/telemetry/console.js +19 -28
- package/dist/telemetry/console.js.map +1 -1
- package/dist/telemetry/dialogs.d.ts.map +1 -1
- package/dist/telemetry/dialogs.js +4 -8
- package/dist/telemetry/dialogs.js.map +1 -1
- package/dist/telemetry/dom.d.ts.map +1 -1
- package/dist/telemetry/dom.js +51 -59
- package/dist/telemetry/dom.js.map +1 -1
- package/dist/telemetry/filters.d.ts +5 -18
- package/dist/telemetry/filters.d.ts.map +1 -1
- package/dist/telemetry/filters.js +36 -56
- package/dist/telemetry/filters.js.map +1 -1
- package/dist/telemetry/navigation.d.ts.map +1 -1
- package/dist/telemetry/navigation.js +5 -8
- package/dist/telemetry/navigation.js.map +1 -1
- package/dist/telemetry/network.d.ts.map +1 -1
- package/dist/telemetry/network.js +105 -104
- package/dist/telemetry/network.js.map +1 -1
- package/dist/telemetry/utils.d.ts +85 -0
- package/dist/telemetry/utils.d.ts.map +1 -0
- package/dist/telemetry/utils.js +138 -0
- package/dist/telemetry/utils.js.map +1 -0
- package/dist/types/dom.d.ts +66 -0
- package/dist/types/dom.d.ts.map +1 -0
- package/dist/types/dom.js +8 -0
- package/dist/types/dom.js.map +1 -0
- package/dist/types.d.ts +15 -83
- package/dist/types.d.ts.map +1 -1
- package/dist/{commands/shared → ui}/OutputBuilder.d.ts +10 -2
- package/dist/ui/OutputBuilder.d.ts.map +1 -0
- package/dist/{commands/shared → ui}/OutputBuilder.js +8 -2
- package/dist/ui/OutputBuilder.js.map +1 -0
- package/dist/ui/errors/CommandError.d.ts +16 -2
- package/dist/ui/errors/CommandError.d.ts.map +1 -1
- package/dist/ui/errors/CommandError.js +2 -1
- package/dist/ui/errors/CommandError.js.map +1 -1
- package/dist/ui/errors/index.d.ts +2 -3
- package/dist/ui/errors/index.d.ts.map +1 -1
- package/dist/ui/errors/index.js +1 -3
- package/dist/ui/errors/index.js.map +1 -1
- package/dist/ui/errors/utils.d.ts +6 -0
- package/dist/ui/errors/utils.d.ts.map +1 -1
- package/dist/ui/errors/utils.js +8 -3
- package/dist/ui/errors/utils.js.map +1 -1
- package/dist/ui/formatters/dom.d.ts +3 -18
- package/dist/ui/formatters/dom.d.ts.map +1 -1
- package/dist/ui/formatters/dom.js +4 -27
- package/dist/ui/formatters/dom.js.map +1 -1
- package/dist/ui/formatters/preview.d.ts +8 -8
- package/dist/ui/formatters/preview.d.ts.map +1 -1
- package/dist/ui/formatters/preview.js +18 -13
- package/dist/ui/formatters/preview.js.map +1 -1
- package/dist/ui/formatters/status.d.ts +1 -1
- package/dist/ui/formatters/status.d.ts.map +1 -1
- package/dist/ui/formatters/status.js +8 -30
- package/dist/ui/formatters/status.js.map +1 -1
- package/dist/ui/formatting.d.ts +2 -270
- package/dist/ui/formatting.d.ts.map +1 -1
- package/dist/ui/formatting.js +8 -331
- package/dist/ui/formatting.js.map +1 -1
- package/dist/ui/logging/index.d.ts +1 -1
- package/dist/ui/logging/index.d.ts.map +1 -1
- package/dist/ui/logging/index.js +1 -1
- package/dist/ui/logging/index.js.map +1 -1
- package/dist/ui/logging/logger.d.ts +3 -23
- package/dist/ui/logging/logger.d.ts.map +1 -1
- package/dist/ui/logging/logger.js +2 -27
- package/dist/ui/logging/logger.js.map +1 -1
- package/dist/ui/messages/chrome.d.ts +15 -7
- package/dist/ui/messages/chrome.d.ts.map +1 -1
- package/dist/ui/messages/chrome.js +23 -32
- package/dist/ui/messages/chrome.js.map +1 -1
- package/dist/ui/messages/commands.d.ts +2 -19
- package/dist/ui/messages/commands.d.ts.map +1 -1
- package/dist/ui/messages/commands.js +5 -51
- package/dist/ui/messages/commands.js.map +1 -1
- package/dist/ui/messages/consoleMessages.d.ts +1 -1
- package/dist/ui/messages/consoleMessages.d.ts.map +1 -1
- package/dist/ui/messages/consoleMessages.js +3 -6
- package/dist/ui/messages/consoleMessages.js.map +1 -1
- package/dist/ui/messages/debug.d.ts +0 -14
- package/dist/ui/messages/debug.d.ts.map +1 -1
- package/dist/ui/messages/debug.js +0 -18
- package/dist/ui/messages/debug.js.map +1 -1
- package/dist/ui/messages/errors.d.ts +0 -34
- package/dist/ui/messages/errors.d.ts.map +1 -1
- package/dist/ui/messages/errors.js +3 -81
- package/dist/ui/messages/errors.js.map +1 -1
- package/dist/ui/messages/internal.d.ts +0 -7
- package/dist/ui/messages/internal.d.ts.map +1 -1
- package/dist/ui/messages/internal.js +0 -12
- package/dist/ui/messages/internal.js.map +1 -1
- package/dist/ui/messages/preview.d.ts +14 -1
- package/dist/ui/messages/preview.d.ts.map +1 -1
- package/dist/ui/messages/preview.js +24 -7
- package/dist/ui/messages/preview.js.map +1 -1
- package/dist/ui/messages/session.d.ts.map +1 -1
- package/dist/ui/messages/session.js +7 -23
- package/dist/ui/messages/session.js.map +1 -1
- package/dist/ui/messages/validation.d.ts.map +1 -1
- package/dist/ui/messages/validation.js +7 -8
- package/dist/ui/messages/validation.js.map +1 -1
- package/dist/utils/__tests__/atomicFile.test.d.ts +2 -0
- package/dist/utils/__tests__/atomicFile.test.d.ts.map +1 -0
- package/dist/utils/__tests__/atomicFile.test.js +43 -0
- package/dist/utils/__tests__/atomicFile.test.js.map +1 -0
- package/dist/utils/__tests__/objects.test.d.ts +2 -0
- package/dist/utils/__tests__/objects.test.d.ts.map +1 -0
- package/dist/utils/__tests__/objects.test.js +50 -0
- package/dist/utils/__tests__/objects.test.js.map +1 -0
- package/dist/utils/__tests__/session.contract.test.js +13 -3
- package/dist/utils/__tests__/session.contract.test.js.map +1 -1
- package/dist/utils/__tests__/url.test.d.ts +2 -0
- package/dist/utils/__tests__/url.test.d.ts.map +1 -0
- package/dist/utils/__tests__/url.test.js +42 -0
- package/dist/utils/__tests__/url.test.js.map +1 -0
- package/dist/utils/atomicFile.d.ts +31 -5
- package/dist/utils/atomicFile.d.ts.map +1 -1
- package/dist/utils/atomicFile.js +52 -13
- package/dist/utils/atomicFile.js.map +1 -1
- package/dist/utils/concurrency.d.ts +54 -0
- package/dist/utils/concurrency.d.ts.map +1 -0
- package/dist/utils/concurrency.js +78 -0
- package/dist/utils/concurrency.js.map +1 -0
- package/dist/utils/daemonErrors.d.ts +60 -0
- package/dist/utils/daemonErrors.d.ts.map +1 -0
- package/dist/utils/daemonErrors.js +58 -0
- package/dist/utils/daemonErrors.js.map +1 -0
- package/dist/utils/errors.d.ts +28 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +33 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/exitCodes.d.ts +41 -5
- package/dist/utils/exitCodes.d.ts.map +1 -1
- package/dist/utils/exitCodes.js +43 -9
- package/dist/utils/exitCodes.js.map +1 -1
- package/dist/utils/http.d.ts +9 -4
- package/dist/utils/http.d.ts.map +1 -1
- package/dist/utils/http.js +44 -10
- package/dist/utils/http.js.map +1 -1
- package/dist/utils/levenshtein.d.ts +45 -0
- package/dist/utils/levenshtein.d.ts.map +1 -0
- package/dist/utils/levenshtein.js +85 -0
- package/dist/utils/levenshtein.js.map +1 -0
- package/dist/utils/objects.d.ts +16 -1
- package/dist/utils/objects.d.ts.map +1 -1
- package/dist/utils/objects.js +16 -1
- package/dist/utils/objects.js.map +1 -1
- package/dist/utils/process.d.ts +45 -0
- package/dist/utils/process.d.ts.map +1 -0
- package/dist/utils/process.js +91 -0
- package/dist/utils/process.js.map +1 -0
- package/dist/utils/url.d.ts +10 -3
- package/dist/utils/url.d.ts.map +1 -1
- package/dist/utils/url.js +42 -29
- package/dist/utils/url.js.map +1 -1
- package/dist/utils/validation.d.ts +101 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +131 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +1 -1
- package/dist/commands/dom.d.ts.map +0 -1
- package/dist/commands/dom.js.map +0 -1
- package/dist/commands/domEvalHelpers.d.ts.map +0 -1
- package/dist/commands/domEvalHelpers.js.map +0 -1
- package/dist/commands/domOptionsBuilder.d.ts +0 -67
- package/dist/commands/domOptionsBuilder.d.ts.map +0 -1
- package/dist/commands/domOptionsBuilder.js +0 -86
- package/dist/commands/domOptionsBuilder.js.map +0 -1
- package/dist/commands/domSelectorParser.d.ts +0 -20
- package/dist/commands/domSelectorParser.d.ts.map +0 -1
- package/dist/commands/domSelectorParser.js +0 -20
- package/dist/commands/domSelectorParser.js.map +0 -1
- package/dist/commands/shared/OutputBuilder.d.ts.map +0 -1
- package/dist/commands/shared/OutputBuilder.js.map +0 -1
- package/dist/commands/shared/daemonSessionController.d.ts.map +0 -1
- package/dist/commands/shared/daemonSessionController.js.map +0 -1
- package/dist/commands/shared/sessionController.d.ts +0 -21
- package/dist/commands/shared/sessionController.d.ts.map +0 -1
- package/dist/commands/shared/sessionController.js +0 -54
- package/dist/commands/shared/sessionController.js.map +0 -1
- package/dist/connection/__tests__/finder.contract.test.d.ts +0 -2
- package/dist/connection/__tests__/finder.contract.test.d.ts.map +0 -1
- package/dist/connection/__tests__/finder.contract.test.js +0 -239
- package/dist/connection/__tests__/finder.contract.test.js.map +0 -1
- package/dist/connection/domOperations.d.ts +0 -48
- package/dist/connection/domOperations.d.ts.map +0 -1
- package/dist/connection/domOperations.js +0 -106
- package/dist/connection/domOperations.js.map +0 -1
- package/dist/connection/finder.d.ts +0 -12
- package/dist/connection/finder.d.ts.map +0 -1
- package/dist/connection/finder.js +0 -17
- package/dist/connection/finder.js.map +0 -1
- package/dist/ipc/commands.d.ts +0 -260
- package/dist/ipc/commands.d.ts.map +0 -1
- package/dist/ipc/commands.js +0 -77
- package/dist/ipc/commands.js.map +0 -1
- package/dist/ipc/responseValidator.d.ts.map +0 -1
- package/dist/ipc/responseValidator.js.map +0 -1
- package/dist/ipc/types.d.ts +0 -226
- package/dist/ipc/types.d.ts.map +0 -1
- package/dist/ipc/types.js.map +0 -1
- package/dist/session/fileOps.d.ts +0 -25
- package/dist/session/fileOps.d.ts.map +0 -1
- package/dist/session/fileOps.js +0 -39
- package/dist/session/fileOps.js.map +0 -1
- package/dist/session/queryCache.d.ts +0 -36
- package/dist/session/queryCache.d.ts.map +0 -1
- package/dist/session/queryCache.js +0 -66
- package/dist/session/queryCache.js.map +0 -1
- /package/dist/ipc/{responseValidator.d.ts → utils/responseValidator.d.ts} +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom concurrency limiter for controlling parallel async operations.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Limits the number of concurrent async operations.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const limiter = new ConcurrencyLimiter(5);
|
|
10
|
+
* const results = await Promise.all(
|
|
11
|
+
* tasks.map(task => limiter.run(() => performTask(task)))
|
|
12
|
+
* );
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare class ConcurrencyLimiter {
|
|
16
|
+
private readonly limit;
|
|
17
|
+
private running;
|
|
18
|
+
private queue;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new concurrency limiter.
|
|
21
|
+
*
|
|
22
|
+
* @param limit - Maximum number of concurrent operations
|
|
23
|
+
*/
|
|
24
|
+
constructor(limit: number);
|
|
25
|
+
/**
|
|
26
|
+
* Executes an async function with concurrency control.
|
|
27
|
+
*
|
|
28
|
+
* @param fn - Async function to execute
|
|
29
|
+
* @returns Promise resolving to the function's result
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* const limiter = new ConcurrencyLimiter(3);
|
|
34
|
+
* const result = await limiter.run(async () => {
|
|
35
|
+
* const response = await fetch(url);
|
|
36
|
+
* return response.json();
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
run<T>(fn: () => Promise<T>): Promise<T>;
|
|
41
|
+
/**
|
|
42
|
+
* Gets the current number of running operations.
|
|
43
|
+
*
|
|
44
|
+
* @returns Number of currently executing operations
|
|
45
|
+
*/
|
|
46
|
+
getRunningCount(): number;
|
|
47
|
+
/**
|
|
48
|
+
* Gets the current queue size.
|
|
49
|
+
*
|
|
50
|
+
* @returns Number of operations waiting to execute
|
|
51
|
+
*/
|
|
52
|
+
getQueueSize(): number;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=concurrency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concurrency.d.ts","sourceRoot":"","sources":["../../src/utils/concurrency.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;GAUG;AACH,qBAAa,kBAAkB;IASjB,OAAO,CAAC,QAAQ,CAAC,KAAK;IARlC,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,KAAK,CAAyB;IAEtC;;;;OAIG;gBAC0B,KAAK,EAAE,MAAM;IAM1C;;;;;;;;;;;;;;OAcG;IACG,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAiB9C;;;;OAIG;IACH,eAAe,IAAI,MAAM;IAIzB;;;;OAIG;IACH,YAAY,IAAI,MAAM;CAGvB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom concurrency limiter for controlling parallel async operations.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Limits the number of concurrent async operations.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const limiter = new ConcurrencyLimiter(5);
|
|
10
|
+
* const results = await Promise.all(
|
|
11
|
+
* tasks.map(task => limiter.run(() => performTask(task)))
|
|
12
|
+
* );
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export class ConcurrencyLimiter {
|
|
16
|
+
limit;
|
|
17
|
+
running = 0;
|
|
18
|
+
queue = [];
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new concurrency limiter.
|
|
21
|
+
*
|
|
22
|
+
* @param limit - Maximum number of concurrent operations
|
|
23
|
+
*/
|
|
24
|
+
constructor(limit) {
|
|
25
|
+
this.limit = limit;
|
|
26
|
+
if (limit < 1) {
|
|
27
|
+
throw new Error('Concurrency limit must be at least 1');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Executes an async function with concurrency control.
|
|
32
|
+
*
|
|
33
|
+
* @param fn - Async function to execute
|
|
34
|
+
* @returns Promise resolving to the function's result
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const limiter = new ConcurrencyLimiter(3);
|
|
39
|
+
* const result = await limiter.run(async () => {
|
|
40
|
+
* const response = await fetch(url);
|
|
41
|
+
* return response.json();
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
async run(fn) {
|
|
46
|
+
while (this.running >= this.limit) {
|
|
47
|
+
await new Promise((resolve) => this.queue.push(resolve));
|
|
48
|
+
}
|
|
49
|
+
this.running++;
|
|
50
|
+
try {
|
|
51
|
+
return await fn();
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
this.running--;
|
|
55
|
+
const next = this.queue.shift();
|
|
56
|
+
if (next) {
|
|
57
|
+
next();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Gets the current number of running operations.
|
|
63
|
+
*
|
|
64
|
+
* @returns Number of currently executing operations
|
|
65
|
+
*/
|
|
66
|
+
getRunningCount() {
|
|
67
|
+
return this.running;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Gets the current queue size.
|
|
71
|
+
*
|
|
72
|
+
* @returns Number of operations waiting to execute
|
|
73
|
+
*/
|
|
74
|
+
getQueueSize() {
|
|
75
|
+
return this.queue.length;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=concurrency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concurrency.js","sourceRoot":"","sources":["../../src/utils/concurrency.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,OAAO,kBAAkB;IASA;IARrB,OAAO,GAAG,CAAC,CAAC;IACZ,KAAK,GAAsB,EAAE,CAAC;IAEtC;;;;OAIG;IACH,YAA6B,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QACxC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,GAAG,CAAI,EAAoB;QAC/B,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAClC,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;QACjE,CAAC;QAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC;YACH,OAAO,MAAM,EAAE,EAAE,CAAC;QACpB,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YAChC,IAAI,IAAI,EAAE,CAAC;gBACT,IAAI,EAAE,CAAC;YACT,CAAC;QACH,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;CACF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for handling daemon connection errors in commands.
|
|
3
|
+
*
|
|
4
|
+
* Provides consistent error handling for peek, tail, and other commands
|
|
5
|
+
* that communicate with the daemon via IPC.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Options for daemon connection error handling.
|
|
9
|
+
*/
|
|
10
|
+
export interface DaemonErrorOptions {
|
|
11
|
+
/** Use JSON output format */
|
|
12
|
+
json?: boolean | undefined;
|
|
13
|
+
/** Follow/watch mode (don't exit, show retry message) */
|
|
14
|
+
follow?: boolean | undefined;
|
|
15
|
+
/** Retry interval in milliseconds (for display message) */
|
|
16
|
+
retryIntervalMs?: number | undefined;
|
|
17
|
+
/** Custom exit code (defaults to RESOURCE_NOT_FOUND) */
|
|
18
|
+
exitCode?: number | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Result of handling a daemon connection error.
|
|
22
|
+
*/
|
|
23
|
+
export interface DaemonErrorResult {
|
|
24
|
+
/** Whether the process should exit */
|
|
25
|
+
shouldExit: boolean;
|
|
26
|
+
/** Exit code to use if exiting */
|
|
27
|
+
exitCode?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Handle daemon connection errors with consistent formatting and behavior.
|
|
31
|
+
*
|
|
32
|
+
* Formats and logs the error appropriately based on output mode.
|
|
33
|
+
* Returns whether the caller should exit and with what code.
|
|
34
|
+
*
|
|
35
|
+
* @param error - Error message to display
|
|
36
|
+
* @param options - Error handling options
|
|
37
|
+
* @returns Result indicating whether to exit
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* // One-time command
|
|
42
|
+
* const result = handleDaemonConnectionError('Daemon not running', {
|
|
43
|
+
* json: options.json,
|
|
44
|
+
* exitCode: EXIT_CODES.RESOURCE_NOT_FOUND
|
|
45
|
+
* });
|
|
46
|
+
* if (result.shouldExit) {
|
|
47
|
+
* process.exit(result.exitCode);
|
|
48
|
+
* }
|
|
49
|
+
*
|
|
50
|
+
* // Follow mode (retries)
|
|
51
|
+
* handleDaemonConnectionError('Connection lost', {
|
|
52
|
+
* json: options.json,
|
|
53
|
+
* follow: true,
|
|
54
|
+
* retryIntervalMs: 1000
|
|
55
|
+
* });
|
|
56
|
+
* // Returns { shouldExit: false }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function handleDaemonConnectionError(error: string, options: DaemonErrorOptions): DaemonErrorResult;
|
|
60
|
+
//# sourceMappingURL=daemonErrors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemonErrors.d.ts","sourceRoot":"","sources":["../../src/utils/daemonErrors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,6BAA6B;IAC7B,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC3B,yDAAyD;IACzD,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,2DAA2D;IAC3D,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,UAAU,EAAE,OAAO,CAAC;IACpB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB,CA0BnB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for handling daemon connection errors in commands.
|
|
3
|
+
*
|
|
4
|
+
* Provides consistent error handling for peek, tail, and other commands
|
|
5
|
+
* that communicate with the daemon via IPC.
|
|
6
|
+
*/
|
|
7
|
+
import { OutputBuilder } from '../ui/OutputBuilder.js';
|
|
8
|
+
import { genericError } from '../ui/messages/errors.js';
|
|
9
|
+
import { connectionLostRetryMessage, connectionLostStopHintMessage, } from '../ui/messages/preview.js';
|
|
10
|
+
import { EXIT_CODES } from '../utils/exitCodes.js';
|
|
11
|
+
/**
|
|
12
|
+
* Handle daemon connection errors with consistent formatting and behavior.
|
|
13
|
+
*
|
|
14
|
+
* Formats and logs the error appropriately based on output mode.
|
|
15
|
+
* Returns whether the caller should exit and with what code.
|
|
16
|
+
*
|
|
17
|
+
* @param error - Error message to display
|
|
18
|
+
* @param options - Error handling options
|
|
19
|
+
* @returns Result indicating whether to exit
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // One-time command
|
|
24
|
+
* const result = handleDaemonConnectionError('Daemon not running', {
|
|
25
|
+
* json: options.json,
|
|
26
|
+
* exitCode: EXIT_CODES.RESOURCE_NOT_FOUND
|
|
27
|
+
* });
|
|
28
|
+
* if (result.shouldExit) {
|
|
29
|
+
* process.exit(result.exitCode);
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* // Follow mode (retries)
|
|
33
|
+
* handleDaemonConnectionError('Connection lost', {
|
|
34
|
+
* json: options.json,
|
|
35
|
+
* follow: true,
|
|
36
|
+
* retryIntervalMs: 1000
|
|
37
|
+
* });
|
|
38
|
+
* // Returns { shouldExit: false }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export function handleDaemonConnectionError(error, options) {
|
|
42
|
+
const { json = false, follow = false, retryIntervalMs = 1000, exitCode = EXIT_CODES.RESOURCE_NOT_FOUND, } = options;
|
|
43
|
+
const retryMessage = retryIntervalMs >= 1000 ? `${retryIntervalMs / 1000}s` : `${retryIntervalMs}ms`;
|
|
44
|
+
const timestamp = new Date().toISOString();
|
|
45
|
+
if (json) {
|
|
46
|
+
console.log(JSON.stringify(OutputBuilder.buildJsonError(error, { exitCode }), null, 2));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
console.error(genericError(error));
|
|
50
|
+
}
|
|
51
|
+
if (!follow) {
|
|
52
|
+
return { shouldExit: true, exitCode };
|
|
53
|
+
}
|
|
54
|
+
console.error(connectionLostRetryMessage(timestamp, retryMessage));
|
|
55
|
+
console.error(connectionLostStopHintMessage());
|
|
56
|
+
return { shouldExit: false };
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=daemonErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemonErrors.js","sourceRoot":"","sources":["../../src/utils/daemonErrors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AA0BlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAAa,EACb,OAA2B;IAE3B,MAAM,EACJ,IAAI,GAAG,KAAK,EACZ,MAAM,GAAG,KAAK,EACd,eAAe,GAAG,IAAI,EACtB,QAAQ,GAAG,UAAU,CAAC,kBAAkB,GACzC,GAAG,OAAO,CAAC;IAEZ,MAAM,YAAY,GAChB,eAAe,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,eAAe,IAAI,CAAC;IAElF,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAE3C,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,cAAc,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1F,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IACxC,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,0BAA0B,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;IACnE,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,CAAC,CAAC;IAC/C,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error handling utilities.
|
|
3
|
+
*
|
|
4
|
+
* Pure utility functions for error message extraction.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Extract error message from unknown error type.
|
|
8
|
+
*
|
|
9
|
+
* Safely extracts error messages from various error types:
|
|
10
|
+
* - Error instances → error.message
|
|
11
|
+
* - Unknown types → String(error)
|
|
12
|
+
*
|
|
13
|
+
* Useful for error handling when error type is unknown.
|
|
14
|
+
*
|
|
15
|
+
* @param error - Error of unknown type
|
|
16
|
+
* @returns Error message string
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* try {
|
|
21
|
+
* await someOperation();
|
|
22
|
+
* } catch (error) {
|
|
23
|
+
* console.error(`Failed: ${getErrorMessage(error)}`);
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function getErrorMessage(error: unknown): string;
|
|
28
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAKtD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error handling utilities.
|
|
3
|
+
*
|
|
4
|
+
* Pure utility functions for error message extraction.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Extract error message from unknown error type.
|
|
8
|
+
*
|
|
9
|
+
* Safely extracts error messages from various error types:
|
|
10
|
+
* - Error instances → error.message
|
|
11
|
+
* - Unknown types → String(error)
|
|
12
|
+
*
|
|
13
|
+
* Useful for error handling when error type is unknown.
|
|
14
|
+
*
|
|
15
|
+
* @param error - Error of unknown type
|
|
16
|
+
* @returns Error message string
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* try {
|
|
21
|
+
* await someOperation();
|
|
22
|
+
* } catch (error) {
|
|
23
|
+
* console.error(`Failed: ${getErrorMessage(error)}`);
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export function getErrorMessage(error) {
|
|
28
|
+
if (error instanceof Error) {
|
|
29
|
+
return error.message;
|
|
30
|
+
}
|
|
31
|
+
return String(error);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -1,32 +1,68 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Semantic exit codes for agent-friendly error handling.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
4
|
+
* **STABILITY: These exit codes are part of bdg's stable public API.**
|
|
5
|
+
*
|
|
6
|
+
* Exit codes follow semantic ranges for predictable automation:
|
|
7
|
+
* - **0**: Success (command completed successfully)
|
|
8
|
+
* - **1**: Generic failure (backward compatibility, avoid in new code)
|
|
9
|
+
* - **80-99**: User errors (invalid input, permissions, resource issues)
|
|
10
|
+
* - **100-119**: Software errors (bugs, integration failures, timeouts)
|
|
11
|
+
*
|
|
12
|
+
* **Versioning guarantees:**
|
|
13
|
+
* - Exit code values are **stable** and will not change in minor versions
|
|
14
|
+
* - New exit codes may be added in minor versions (within existing ranges)
|
|
15
|
+
* - Existing codes will only be removed in major versions with deprecation notice
|
|
16
|
+
* - Exit code semantics (meaning) will remain consistent across versions
|
|
17
|
+
*
|
|
18
|
+
* **For automation users:**
|
|
19
|
+
* - Check specific exit codes (e.g., 83 for "resource not found")
|
|
20
|
+
* - Use ranges for category detection (80-99 = user error, 100-119 = software error)
|
|
21
|
+
* - Exit code 0 guarantees success, non-zero indicates failure
|
|
22
|
+
*
|
|
23
|
+
* **Migration policy:**
|
|
24
|
+
* - Deprecated codes will be documented in CHANGELOG.md with migration path
|
|
25
|
+
* - Deprecated codes will remain functional for at least one major version
|
|
9
26
|
*
|
|
10
27
|
* Reference: https://developer.squareup.com/blog/command-line-observability-with-semantic-exit-codes/
|
|
11
28
|
*/
|
|
12
29
|
/**
|
|
13
30
|
* Exit code constants following semantic ranges.
|
|
31
|
+
*
|
|
32
|
+
* **These values are stable API** - use confidently in automation scripts.
|
|
14
33
|
*/
|
|
15
34
|
export declare const EXIT_CODES: {
|
|
35
|
+
/** Command completed successfully */
|
|
16
36
|
readonly SUCCESS: 0;
|
|
37
|
+
/** Generic failure (use specific codes when possible) */
|
|
17
38
|
readonly GENERIC_FAILURE: 1;
|
|
39
|
+
/** Invalid URL format or unreachable URL */
|
|
18
40
|
readonly INVALID_URL: 80;
|
|
41
|
+
/** Invalid command-line arguments or options */
|
|
19
42
|
readonly INVALID_ARGUMENTS: 81;
|
|
43
|
+
/** Insufficient permissions for operation */
|
|
20
44
|
readonly PERMISSION_DENIED: 82;
|
|
45
|
+
/** Requested resource not found (session, file, etc.) */
|
|
21
46
|
readonly RESOURCE_NOT_FOUND: 83;
|
|
47
|
+
/** Resource already exists (duplicate session, etc.) */
|
|
22
48
|
readonly RESOURCE_ALREADY_EXISTS: 84;
|
|
49
|
+
/** Resource is locked or busy */
|
|
23
50
|
readonly RESOURCE_BUSY: 85;
|
|
51
|
+
/** Daemon already running when trying to start */
|
|
24
52
|
readonly DAEMON_ALREADY_RUNNING: 86;
|
|
53
|
+
/** Chrome browser failed to launch */
|
|
25
54
|
readonly CHROME_LAUNCH_FAILURE: 100;
|
|
55
|
+
/** CDP connection failed */
|
|
26
56
|
readonly CDP_CONNECTION_FAILURE: 101;
|
|
57
|
+
/** CDP operation timed out */
|
|
27
58
|
readonly CDP_TIMEOUT: 102;
|
|
59
|
+
/** Session file read/write error */
|
|
28
60
|
readonly SESSION_FILE_ERROR: 103;
|
|
61
|
+
/** Unhandled exception in code */
|
|
29
62
|
readonly UNHANDLED_EXCEPTION: 104;
|
|
63
|
+
/** Signal handler error */
|
|
30
64
|
readonly SIGNAL_HANDLER_ERROR: 105;
|
|
65
|
+
/** Generic software error (use specific codes when possible) */
|
|
66
|
+
readonly SOFTWARE_ERROR: 110;
|
|
31
67
|
};
|
|
32
68
|
//# sourceMappingURL=exitCodes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exitCodes.d.ts","sourceRoot":"","sources":["../../src/utils/exitCodes.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"exitCodes.d.ts","sourceRoot":"","sources":["../../src/utils/exitCodes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;;GAIG;AACH,eAAO,MAAM,UAAU;IACrB,qCAAqC;;IAGrC,yDAAyD;;IAKzD,4CAA4C;;IAG5C,gDAAgD;;IAGhD,6CAA6C;;IAG7C,yDAAyD;;IAGzD,wDAAwD;;IAGxD,iCAAiC;;IAGjC,kDAAkD;;IAKlD,sCAAsC;;IAGtC,4BAA4B;;IAG5B,8BAA8B;;IAG9B,oCAAoC;;IAGpC,kCAAkC;;IAGlC,2BAA2B;;IAG3B,gEAAgE;;CAExD,CAAC"}
|
package/dist/utils/exitCodes.js
CHANGED
|
@@ -1,36 +1,70 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Semantic exit codes for agent-friendly error handling.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
4
|
+
* **STABILITY: These exit codes are part of bdg's stable public API.**
|
|
5
|
+
*
|
|
6
|
+
* Exit codes follow semantic ranges for predictable automation:
|
|
7
|
+
* - **0**: Success (command completed successfully)
|
|
8
|
+
* - **1**: Generic failure (backward compatibility, avoid in new code)
|
|
9
|
+
* - **80-99**: User errors (invalid input, permissions, resource issues)
|
|
10
|
+
* - **100-119**: Software errors (bugs, integration failures, timeouts)
|
|
11
|
+
*
|
|
12
|
+
* **Versioning guarantees:**
|
|
13
|
+
* - Exit code values are **stable** and will not change in minor versions
|
|
14
|
+
* - New exit codes may be added in minor versions (within existing ranges)
|
|
15
|
+
* - Existing codes will only be removed in major versions with deprecation notice
|
|
16
|
+
* - Exit code semantics (meaning) will remain consistent across versions
|
|
17
|
+
*
|
|
18
|
+
* **For automation users:**
|
|
19
|
+
* - Check specific exit codes (e.g., 83 for "resource not found")
|
|
20
|
+
* - Use ranges for category detection (80-99 = user error, 100-119 = software error)
|
|
21
|
+
* - Exit code 0 guarantees success, non-zero indicates failure
|
|
22
|
+
*
|
|
23
|
+
* **Migration policy:**
|
|
24
|
+
* - Deprecated codes will be documented in CHANGELOG.md with migration path
|
|
25
|
+
* - Deprecated codes will remain functional for at least one major version
|
|
9
26
|
*
|
|
10
27
|
* Reference: https://developer.squareup.com/blog/command-line-observability-with-semantic-exit-codes/
|
|
11
28
|
*/
|
|
12
29
|
/**
|
|
13
30
|
* Exit code constants following semantic ranges.
|
|
31
|
+
*
|
|
32
|
+
* **These values are stable API** - use confidently in automation scripts.
|
|
14
33
|
*/
|
|
15
34
|
export const EXIT_CODES = {
|
|
16
|
-
|
|
35
|
+
/** Command completed successfully */
|
|
17
36
|
SUCCESS: 0,
|
|
18
|
-
|
|
37
|
+
/** Generic failure (use specific codes when possible) */
|
|
19
38
|
GENERIC_FAILURE: 1,
|
|
20
|
-
// User
|
|
39
|
+
// User Errors (80-99): Issues caused by user input or environment
|
|
40
|
+
/** Invalid URL format or unreachable URL */
|
|
21
41
|
INVALID_URL: 80,
|
|
42
|
+
/** Invalid command-line arguments or options */
|
|
22
43
|
INVALID_ARGUMENTS: 81,
|
|
44
|
+
/** Insufficient permissions for operation */
|
|
23
45
|
PERMISSION_DENIED: 82,
|
|
46
|
+
/** Requested resource not found (session, file, etc.) */
|
|
24
47
|
RESOURCE_NOT_FOUND: 83,
|
|
48
|
+
/** Resource already exists (duplicate session, etc.) */
|
|
25
49
|
RESOURCE_ALREADY_EXISTS: 84,
|
|
50
|
+
/** Resource is locked or busy */
|
|
26
51
|
RESOURCE_BUSY: 85,
|
|
52
|
+
/** Daemon already running when trying to start */
|
|
27
53
|
DAEMON_ALREADY_RUNNING: 86,
|
|
28
|
-
// Software
|
|
54
|
+
// Software Errors (100-119): Internal failures or integration issues
|
|
55
|
+
/** Chrome browser failed to launch */
|
|
29
56
|
CHROME_LAUNCH_FAILURE: 100,
|
|
57
|
+
/** CDP connection failed */
|
|
30
58
|
CDP_CONNECTION_FAILURE: 101,
|
|
59
|
+
/** CDP operation timed out */
|
|
31
60
|
CDP_TIMEOUT: 102,
|
|
61
|
+
/** Session file read/write error */
|
|
32
62
|
SESSION_FILE_ERROR: 103,
|
|
63
|
+
/** Unhandled exception in code */
|
|
33
64
|
UNHANDLED_EXCEPTION: 104,
|
|
65
|
+
/** Signal handler error */
|
|
34
66
|
SIGNAL_HANDLER_ERROR: 105,
|
|
67
|
+
/** Generic software error (use specific codes when possible) */
|
|
68
|
+
SOFTWARE_ERROR: 110,
|
|
35
69
|
};
|
|
36
70
|
//# sourceMappingURL=exitCodes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exitCodes.js","sourceRoot":"","sources":["../../src/utils/exitCodes.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"exitCodes.js","sourceRoot":"","sources":["../../src/utils/exitCodes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,qCAAqC;IACrC,OAAO,EAAE,CAAC;IAEV,yDAAyD;IACzD,eAAe,EAAE,CAAC;IAElB,kEAAkE;IAElE,4CAA4C;IAC5C,WAAW,EAAE,EAAE;IAEf,gDAAgD;IAChD,iBAAiB,EAAE,EAAE;IAErB,6CAA6C;IAC7C,iBAAiB,EAAE,EAAE;IAErB,yDAAyD;IACzD,kBAAkB,EAAE,EAAE;IAEtB,wDAAwD;IACxD,uBAAuB,EAAE,EAAE;IAE3B,iCAAiC;IACjC,aAAa,EAAE,EAAE;IAEjB,kDAAkD;IAClD,sBAAsB,EAAE,EAAE;IAE1B,qEAAqE;IAErE,sCAAsC;IACtC,qBAAqB,EAAE,GAAG;IAE1B,4BAA4B;IAC5B,sBAAsB,EAAE,GAAG;IAE3B,8BAA8B;IAC9B,WAAW,EAAE,GAAG;IAEhB,oCAAoC;IACpC,kBAAkB,EAAE,GAAG;IAEvB,kCAAkC;IAClC,mBAAmB,EAAE,GAAG;IAExB,2BAA2B;IAC3B,oBAAoB,EAAE,GAAG;IAEzB,gEAAgE;IAChE,cAAc,EAAE,GAAG;CACX,CAAC"}
|
package/dist/utils/http.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CDPTarget } from '../types';
|
|
2
|
+
import type { Logger } from '../ui/logging/index.js';
|
|
2
3
|
/**
|
|
3
4
|
* Fetch CDP targets from Chrome's HTTP API.
|
|
4
5
|
*
|
|
@@ -7,14 +8,16 @@ import type { CDPTarget } from '../types';
|
|
|
7
8
|
* scattered across the codebase.
|
|
8
9
|
*
|
|
9
10
|
* @param port - Chrome debugging port (defaults to centralized DEFAULT_CDP_PORT)
|
|
11
|
+
* @param logger - Optional logger for debug output
|
|
10
12
|
* @returns Promise resolving to array of CDP targets, or empty array on error
|
|
11
13
|
*
|
|
12
14
|
* @remarks
|
|
13
15
|
* - Uses HTTP_LOCALHOST constant for consistent host addressing
|
|
14
|
-
* - Returns empty array
|
|
15
|
-
* -
|
|
16
|
+
* - Returns empty array on HTTP errors, but logs details for debugging
|
|
17
|
+
* - 5-second timeout prevents hanging when Chrome is unreachable
|
|
18
|
+
* - Network errors are logged to help diagnose Chrome connectivity issues
|
|
16
19
|
*/
|
|
17
|
-
export declare function fetchCDPTargets(port?: number): Promise<CDPTarget[]>;
|
|
20
|
+
export declare function fetchCDPTargets(port?: number, logger?: Logger): Promise<CDPTarget[]>;
|
|
18
21
|
/**
|
|
19
22
|
* Fetch specific CDP target by ID from Chrome's HTTP API.
|
|
20
23
|
*
|
|
@@ -23,12 +26,14 @@ export declare function fetchCDPTargets(port?: number): Promise<CDPTarget[]>;
|
|
|
23
26
|
*
|
|
24
27
|
* @param targetId - Target ID to search for
|
|
25
28
|
* @param port - Chrome debugging port (defaults to centralized DEFAULT_CDP_PORT)
|
|
29
|
+
* @param logger - Optional logger for debug output
|
|
26
30
|
* @returns Promise resolving to matching target, or null if not found/error
|
|
27
31
|
*
|
|
28
32
|
* @remarks
|
|
29
33
|
* - Returns null rather than throwing on errors for easier consumption
|
|
30
34
|
* - Searches all targets returned by Chrome's /json/list endpoint
|
|
31
35
|
* - Uses shared fetchCDPTargets helper to avoid code duplication
|
|
36
|
+
* - Inherits timeout and error logging from fetchCDPTargets
|
|
32
37
|
*/
|
|
33
|
-
export declare function fetchCDPTargetById(targetId: string, port?: number): Promise<CDPTarget | null>;
|
|
38
|
+
export declare function fetchCDPTargetById(targetId: string, port?: number, logger?: Logger): Promise<CDPTarget | null>;
|
|
34
39
|
//# sourceMappingURL=http.d.ts.map
|
package/dist/utils/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAUpD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,eAAe,CACnC,IAAI,GAAE,MAAyB,EAC/B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,EAAE,CAAC,CAuCtB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,MAAyB,EAC/B,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAG3B"}
|
package/dist/utils/http.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { DEFAULT_CDP_PORT, HTTP_LOCALHOST } from '../constants.js';
|
|
2
|
+
/**
|
|
3
|
+
* Timeout for CDP HTTP requests in milliseconds.
|
|
4
|
+
*
|
|
5
|
+
* Chrome's HTTP API should respond quickly when running.
|
|
6
|
+
* A 5-second timeout helps detect when Chrome is not responding.
|
|
7
|
+
*/
|
|
8
|
+
const CDP_HTTP_TIMEOUT_MS = 5000;
|
|
2
9
|
/**
|
|
3
10
|
* Fetch CDP targets from Chrome's HTTP API.
|
|
4
11
|
*
|
|
@@ -7,22 +14,47 @@ import { DEFAULT_CDP_PORT, HTTP_LOCALHOST } from '../constants.js';
|
|
|
7
14
|
* scattered across the codebase.
|
|
8
15
|
*
|
|
9
16
|
* @param port - Chrome debugging port (defaults to centralized DEFAULT_CDP_PORT)
|
|
17
|
+
* @param logger - Optional logger for debug output
|
|
10
18
|
* @returns Promise resolving to array of CDP targets, or empty array on error
|
|
11
19
|
*
|
|
12
20
|
* @remarks
|
|
13
21
|
* - Uses HTTP_LOCALHOST constant for consistent host addressing
|
|
14
|
-
* - Returns empty array
|
|
15
|
-
* -
|
|
22
|
+
* - Returns empty array on HTTP errors, but logs details for debugging
|
|
23
|
+
* - 5-second timeout prevents hanging when Chrome is unreachable
|
|
24
|
+
* - Network errors are logged to help diagnose Chrome connectivity issues
|
|
16
25
|
*/
|
|
17
|
-
export async function fetchCDPTargets(port = DEFAULT_CDP_PORT) {
|
|
26
|
+
export async function fetchCDPTargets(port = DEFAULT_CDP_PORT, logger) {
|
|
27
|
+
const url = `http://${HTTP_LOCALHOST}:${port}/json/list`;
|
|
18
28
|
try {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
const controller = new AbortController();
|
|
30
|
+
const timeoutId = setTimeout(() => controller.abort(), CDP_HTTP_TIMEOUT_MS);
|
|
31
|
+
try {
|
|
32
|
+
const response = await fetch(url, { signal: controller.signal });
|
|
33
|
+
clearTimeout(timeoutId);
|
|
34
|
+
if (!response.ok) {
|
|
35
|
+
logger?.debug(`CDP HTTP request failed: ${response.status} ${response.statusText} (${url})`);
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
const data = await response.json();
|
|
39
|
+
if (!Array.isArray(data)) {
|
|
40
|
+
logger?.debug(`CDP HTTP response is not an array (${url})`);
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
return data;
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
clearTimeout(timeoutId);
|
|
22
47
|
}
|
|
23
|
-
return (await response.json());
|
|
24
48
|
}
|
|
25
|
-
catch {
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (error instanceof Error) {
|
|
51
|
+
if (error.name === 'AbortError') {
|
|
52
|
+
logger?.debug(`CDP HTTP request timeout after ${CDP_HTTP_TIMEOUT_MS}ms (${url})`);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
logger?.debug(`CDP HTTP request error: ${error.message} (${url})`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
26
58
|
return [];
|
|
27
59
|
}
|
|
28
60
|
}
|
|
@@ -34,15 +66,17 @@ export async function fetchCDPTargets(port = DEFAULT_CDP_PORT) {
|
|
|
34
66
|
*
|
|
35
67
|
* @param targetId - Target ID to search for
|
|
36
68
|
* @param port - Chrome debugging port (defaults to centralized DEFAULT_CDP_PORT)
|
|
69
|
+
* @param logger - Optional logger for debug output
|
|
37
70
|
* @returns Promise resolving to matching target, or null if not found/error
|
|
38
71
|
*
|
|
39
72
|
* @remarks
|
|
40
73
|
* - Returns null rather than throwing on errors for easier consumption
|
|
41
74
|
* - Searches all targets returned by Chrome's /json/list endpoint
|
|
42
75
|
* - Uses shared fetchCDPTargets helper to avoid code duplication
|
|
76
|
+
* - Inherits timeout and error logging from fetchCDPTargets
|
|
43
77
|
*/
|
|
44
|
-
export async function fetchCDPTargetById(targetId, port = DEFAULT_CDP_PORT) {
|
|
45
|
-
const targets = await fetchCDPTargets(port);
|
|
78
|
+
export async function fetchCDPTargetById(targetId, port = DEFAULT_CDP_PORT, logger) {
|
|
79
|
+
const targets = await fetchCDPTargets(port, logger);
|
|
46
80
|
return targets.find((t) => t.id === targetId) ?? null;
|
|
47
81
|
}
|
|
48
82
|
//# sourceMappingURL=http.js.map
|
package/dist/utils/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/utils/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIlE;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAEjC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAAe,gBAAgB,EAC/B,MAAe;IAEf,MAAM,GAAG,GAAG,UAAU,cAAc,IAAI,IAAI,YAAY,CAAC;IAEzD,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;QACzC,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,mBAAmB,CAAC,CAAC;QAE5E,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;YACjE,YAAY,CAAC,SAAS,CAAC,CAAC;YAExB,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,EAAE,KAAK,CACX,4BAA4B,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,KAAK,GAAG,GAAG,CAC9E,CAAC;gBACF,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,MAAM,IAAI,GAAY,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YAE5C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;gBACzB,MAAM,EAAE,KAAK,CAAC,sCAAsC,GAAG,GAAG,CAAC,CAAC;gBAC5D,OAAO,EAAE,CAAC;YACZ,CAAC;YAED,OAAO,IAAmB,CAAC;QAC7B,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,IAAI,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBAChC,MAAM,EAAE,KAAK,CAAC,kCAAkC,mBAAmB,OAAO,GAAG,GAAG,CAAC,CAAC;YACpF,CAAC;iBAAM,CAAC;gBACN,MAAM,EAAE,KAAK,CAAC,2BAA2B,KAAK,CAAC,OAAO,KAAK,GAAG,GAAG,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,QAAgB,EAChB,OAAe,gBAAgB,EAC/B,MAAe;IAEf,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,IAAI,IAAI,CAAC;AACxD,CAAC"}
|