@deepseek-ai/dsh-experimental-inspector 0.1.6-alpha.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.
Files changed (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.i18n.yaml +6 -0
  3. package/README.md +156 -0
  4. package/README.zh.md +156 -0
  5. package/lib/client.js +3424 -0
  6. package/lib/index.js +2406 -0
  7. package/lib/types/client/bridge/controller.d.ts +10 -0
  8. package/lib/types/client/bridge/dispatcher.d.ts +26 -0
  9. package/lib/types/client/bridge/lifecycle.d.ts +20 -0
  10. package/lib/types/client/bridge/publisher.d.ts +42 -0
  11. package/lib/types/client/bridge/rpc.d.ts +13 -0
  12. package/lib/types/client/bridge/transport.d.ts +34 -0
  13. package/lib/types/client/cdp/console.d.ts +45 -0
  14. package/lib/types/client/cdp/debugger.d.ts +8 -0
  15. package/lib/types/client/cdp/errors.d.ts +8 -0
  16. package/lib/types/client/cdp/heap-profiler.d.ts +8 -0
  17. package/lib/types/client/cdp/index.d.ts +10 -0
  18. package/lib/types/client/cdp/objects.d.ts +69 -0
  19. package/lib/types/client/cdp/profiler.d.ts +8 -0
  20. package/lib/types/client/cdp/properties.d.ts +16 -0
  21. package/lib/types/client/cdp/runtime.d.ts +79 -0
  22. package/lib/types/client/cdp/sources.d.ts +52 -0
  23. package/lib/types/client/cdp/stack.d.ts +27 -0
  24. package/lib/types/client/index.d.ts +3 -0
  25. package/lib/types/client/inspection/cordis.d.ts +3 -0
  26. package/lib/types/client/inspection/network.d.ts +4 -0
  27. package/lib/types/client/inspection/realm.d.ts +27 -0
  28. package/lib/types/client/plugin.d.ts +28 -0
  29. package/lib/types/host/bridge/controller.d.ts +108 -0
  30. package/lib/types/host/bridge/dispatcher.d.ts +16 -0
  31. package/lib/types/host/bridge/lifecycle.d.ts +42 -0
  32. package/lib/types/host/bridge/publisher.d.ts +31 -0
  33. package/lib/types/host/bridge/rpc.d.ts +15 -0
  34. package/lib/types/host/bridge/transport.d.ts +28 -0
  35. package/lib/types/host/cdp/console.d.ts +14 -0
  36. package/lib/types/host/cdp/debugger.d.ts +8 -0
  37. package/lib/types/host/cdp/errors.d.ts +6 -0
  38. package/lib/types/host/cdp/heap-profiler.d.ts +8 -0
  39. package/lib/types/host/cdp/index.d.ts +10 -0
  40. package/lib/types/host/cdp/objects.d.ts +8 -0
  41. package/lib/types/host/cdp/profiler.d.ts +8 -0
  42. package/lib/types/host/cdp/properties.d.ts +7 -0
  43. package/lib/types/host/cdp/runtime.d.ts +16 -0
  44. package/lib/types/host/cdp/sources.d.ts +14 -0
  45. package/lib/types/host/cdp/stack.d.ts +4 -0
  46. package/lib/types/host/index.d.ts +3 -0
  47. package/lib/types/host/inspection/cordis.d.ts +3 -0
  48. package/lib/types/host/inspection/network.d.ts +23 -0
  49. package/lib/types/host/inspection/realm.d.ts +9 -0
  50. package/lib/types/host/plugin.d.ts +19 -0
  51. package/lib/types/index.d.ts +50 -0
  52. package/lib/types/shared/bridge/buffer.d.ts +62 -0
  53. package/lib/types/shared/bridge/codec.d.ts +4 -0
  54. package/lib/types/shared/bridge/control-codec.d.ts +27 -0
  55. package/lib/types/shared/bridge/ids.d.ts +19 -0
  56. package/lib/types/shared/bridge/messages/control.d.ts +64 -0
  57. package/lib/types/shared/bridge/messages/cordis.d.ts +4 -0
  58. package/lib/types/shared/bridge/messages/network.d.ts +4 -0
  59. package/lib/types/shared/bridge/messages/observation.d.ts +110 -0
  60. package/lib/types/shared/bridge/messages/query/codec.d.ts +40 -0
  61. package/lib/types/shared/bridge/messages/query/commands.d.ts +35 -0
  62. package/lib/types/shared/bridge/messages/query/frames.d.ts +31 -0
  63. package/lib/types/shared/bridge/messages/query/index.d.ts +5 -0
  64. package/lib/types/shared/bridge/messages/runtime/command-codec.d.ts +9 -0
  65. package/lib/types/shared/bridge/messages/runtime/commands.d.ts +76 -0
  66. package/lib/types/shared/bridge/messages/runtime/console-frames.d.ts +52 -0
  67. package/lib/types/shared/bridge/messages/runtime/frames.d.ts +98 -0
  68. package/lib/types/shared/bridge/messages/runtime/index.d.ts +5 -0
  69. package/lib/types/shared/bridge/messages/runtime/value-codec.d.ts +28 -0
  70. package/lib/types/shared/bridge/messages/sources/codec.d.ts +15 -0
  71. package/lib/types/shared/bridge/messages/sources/commands.d.ts +42 -0
  72. package/lib/types/shared/bridge/messages/sources/frames.d.ts +67 -0
  73. package/lib/types/shared/bridge/messages/sources/index.d.ts +5 -0
  74. package/lib/types/shared/bridge/publisher.d.ts +33 -0
  75. package/lib/types/shared/bridge/query-reader.d.ts +10 -0
  76. package/lib/types/shared/bridge/rpc.d.ts +62 -0
  77. package/lib/types/shared/bridge/validation.d.ts +3 -0
  78. package/lib/types/shared/bridge/version.d.ts +3 -0
  79. package/lib/types/shared/cdp/capabilities.d.ts +17 -0
  80. package/lib/types/shared/cdp/console.d.ts +28 -0
  81. package/lib/types/shared/cdp/debugger.d.ts +69 -0
  82. package/lib/types/shared/cdp/errors.d.ts +27 -0
  83. package/lib/types/shared/cdp/ids.d.ts +9 -0
  84. package/lib/types/shared/cdp/index.d.ts +11 -0
  85. package/lib/types/shared/cdp/operations.d.ts +86 -0
  86. package/lib/types/shared/cdp/property.d.ts +28 -0
  87. package/lib/types/shared/cdp/realm.d.ts +137 -0
  88. package/lib/types/shared/cdp/remote-object.d.ts +44 -0
  89. package/lib/types/shared/cdp/sources.d.ts +18 -0
  90. package/lib/types/shared/cordis/collector.d.ts +26 -0
  91. package/lib/types/shared/cordis/ids.d.ts +7 -0
  92. package/lib/types/shared/cordis/model.d.ts +61 -0
  93. package/lib/types/shared/cordis/object-reference.d.ts +14 -0
  94. package/lib/types/shared/cordis/object-registry.d.ts +80 -0
  95. package/lib/types/shared/cordis/observer.d.ts +15 -0
  96. package/lib/types/shared/cordis/projector.d.ts +34 -0
  97. package/lib/types/shared/cordis/publisher.d.ts +13 -0
  98. package/lib/types/shared/cordis/reader.d.ts +18 -0
  99. package/lib/types/shared/cordis/snapshot.d.ts +39 -0
  100. package/lib/types/shared/identity.d.ts +12 -0
  101. package/lib/types/shared/index.d.ts +18 -0
  102. package/lib/types/shared/json.d.ts +35 -0
  103. package/lib/types/shared/network/event-source.d.ts +20 -0
  104. package/lib/types/shared/network/observation.d.ts +52 -0
  105. package/lib/types/shared/service.d.ts +23 -0
  106. package/lib/types/shared/validation.d.ts +52 -0
  107. package/lib/types/worker/bridge/endpoint.d.ts +49 -0
  108. package/lib/types/worker/bridge/hub.d.ts +108 -0
  109. package/lib/types/worker/bridge/runtime-rpc.d.ts +90 -0
  110. package/lib/types/worker/bridge/session.d.ts +15 -0
  111. package/lib/types/worker/bridge/source-rpc.d.ts +42 -0
  112. package/lib/types/worker/cdp/domains/debugger/cdp-params.d.ts +15 -0
  113. package/lib/types/worker/cdp/domains/debugger/index.d.ts +6 -0
  114. package/lib/types/worker/cdp/domains/debugger/projector.d.ts +22 -0
  115. package/lib/types/worker/cdp/domains/debugger/script-registry.d.ts +70 -0
  116. package/lib/types/worker/cdp/domains/debugger/session.d.ts +47 -0
  117. package/lib/types/worker/cdp/domains/dom/index.d.ts +4 -0
  118. package/lib/types/worker/cdp/domains/dom/model.d.ts +108 -0
  119. package/lib/types/worker/cdp/domains/dom/session.d.ts +74 -0
  120. package/lib/types/worker/cdp/domains/native.d.ts +25 -0
  121. package/lib/types/worker/cdp/domains/network/session.d.ts +46 -0
  122. package/lib/types/worker/cdp/domains/runtime/cdp-params.d.ts +82 -0
  123. package/lib/types/worker/cdp/domains/runtime/index.d.ts +3 -0
  124. package/lib/types/worker/cdp/domains/runtime/object-table.d.ts +117 -0
  125. package/lib/types/worker/cdp/domains/runtime/session.d.ts +97 -0
  126. package/lib/types/worker/cdp/ids.d.ts +37 -0
  127. package/lib/types/worker/cdp/protocol.d.ts +46 -0
  128. package/lib/types/worker/cdp/realm-sessions.d.ts +64 -0
  129. package/lib/types/worker/cdp/session.d.ts +34 -0
  130. package/lib/types/worker/cdp/target.d.ts +17 -0
  131. package/lib/types/worker/entry.d.ts +3 -0
  132. package/lib/types/worker/inspection/cordis-query.d.ts +11 -0
  133. package/lib/types/worker/inspection/cordis-store.d.ts +94 -0
  134. package/lib/types/worker/inspection/network-store.d.ts +110 -0
  135. package/lib/types/worker/inspection/query-router.d.ts +78 -0
  136. package/lib/types/worker/inspection/realm-store.d.ts +58 -0
  137. package/lib/types/worker/inspection/realm.d.ts +43 -0
  138. package/lib/types/worker/realms/client/bridge.d.ts +18 -0
  139. package/lib/types/worker/realms/client/console.d.ts +21 -0
  140. package/lib/types/worker/realms/client/debugger.d.ts +8 -0
  141. package/lib/types/worker/realms/client/index.d.ts +18 -0
  142. package/lib/types/worker/realms/client/runtime.d.ts +28 -0
  143. package/lib/types/worker/realms/client/scripts.d.ts +15 -0
  144. package/lib/types/worker/realms/client/sources.d.ts +30 -0
  145. package/lib/types/worker/realms/client/values.d.ts +55 -0
  146. package/lib/types/worker/realms/host/bridge.d.ts +49 -0
  147. package/lib/types/worker/realms/host/console.d.ts +25 -0
  148. package/lib/types/worker/realms/host/debugger.d.ts +25 -0
  149. package/lib/types/worker/realms/host/index.d.ts +13 -0
  150. package/lib/types/worker/realms/host/runtime.d.ts +54 -0
  151. package/lib/types/worker/realms/host/scripts.d.ts +9 -0
  152. package/lib/types/worker/realms/host/sources.d.ts +26 -0
  153. package/lib/types/worker/realms/host/values.d.ts +22 -0
  154. package/lib/types/worker/server.d.ts +16 -0
  155. package/lib/worker.js +7184 -0
  156. package/package.json +64 -0
@@ -0,0 +1,67 @@
1
+ /** Versioned envelopes for Client source catalog operations. */
2
+ import type { ClientSourceRequestId, ClientSourceSessionId, InspectorSourceGeneration, InspectorSourceId } from '../../ids.ts';
3
+ import { INSPECTOR_PROTOCOL_VERSION } from '../../version.ts';
4
+ import type { ClientSourceCommand, ClientSourceError, ClientSourceResult } from './commands.ts';
5
+ /** Source capability that permits read-only Client script discovery. */
6
+ export interface ClientSourcesCapability {
7
+ readonly type: 'client-sources';
8
+ }
9
+ /** Worker request for one operation in a Client source catalog. */
10
+ export interface ClientSourceRequestFrame {
11
+ readonly v: typeof INSPECTOR_PROTOCOL_VERSION;
12
+ readonly t: 'client-sources/request';
13
+ readonly sourceId: InspectorSourceId;
14
+ readonly generation: InspectorSourceGeneration;
15
+ readonly sessionId: ClientSourceSessionId;
16
+ readonly requestId: ClientSourceRequestId;
17
+ readonly command: ClientSourceCommand;
18
+ }
19
+ /** Client response to one source catalog operation. */
20
+ export interface ClientSourceResponseFrame {
21
+ readonly v: typeof INSPECTOR_PROTOCOL_VERSION;
22
+ readonly t: 'client-sources/response';
23
+ readonly sourceId: InspectorSourceId;
24
+ readonly generation: InspectorSourceGeneration;
25
+ readonly sessionId: ClientSourceSessionId;
26
+ readonly requestId: ClientSourceRequestId;
27
+ readonly outcome: {
28
+ readonly ok: true;
29
+ readonly result: ClientSourceResult;
30
+ } | {
31
+ readonly ok: false;
32
+ readonly error: ClientSourceError;
33
+ };
34
+ }
35
+ /** One-way cleanup for in-flight operations owned by a closed DevTools session. */
36
+ export interface ClientSourceSessionClosedFrame {
37
+ readonly v: typeof INSPECTOR_PROTOCOL_VERSION;
38
+ readonly t: 'client-sources/session-closed';
39
+ readonly sourceId: InspectorSourceId;
40
+ readonly generation: InspectorSourceGeneration;
41
+ readonly sessionId: ClientSourceSessionId;
42
+ }
43
+ /**
44
+ * Parse the marker capability for a Client source catalog.
45
+ * @param value - Untrusted capability declaration.
46
+ * @returns The validated marker capability.
47
+ */
48
+ export declare function parseClientSourcesCapability(value: unknown): ClientSourcesCapability;
49
+ /**
50
+ * Parse one Worker-to-Client source request.
51
+ * @param value - Untrusted decoded request.
52
+ * @returns The validated request frame.
53
+ */
54
+ export declare function parseClientSourceRequestFrame(value: Record<string, unknown>): ClientSourceRequestFrame;
55
+ /**
56
+ * Parse one Client-to-Worker source response.
57
+ * @param value - Untrusted decoded response.
58
+ * @returns The validated response frame.
59
+ */
60
+ export declare function parseClientSourceResponseFrame(value: Record<string, unknown>): ClientSourceResponseFrame;
61
+ /**
62
+ * Parse one Client source-session cleanup notification.
63
+ * @param value - Untrusted decoded notification.
64
+ * @returns The validated cleanup frame.
65
+ */
66
+ export declare function parseClientSourceSessionClosedFrame(value: Record<string, unknown>): ClientSourceSessionClosedFrame;
67
+ //# sourceMappingURL=frames.d.ts.map
@@ -0,0 +1,5 @@
1
+ /** Public types and decoders for the Client source catalog protocol. */
2
+ export * from './codec.ts';
3
+ export * from './commands.ts';
4
+ export * from './frames.ts';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,33 @@
1
+ /** Source-side interfaces shared by MessagePort and WebSocket bridge implementations. */
2
+ import type { InspectorJsonValue } from '../json.ts';
3
+ import type { InspectorQuery, InspectorQueryRequester, InspectorQueryResultFor } from './messages/query/commands.ts';
4
+ /** Transport-independent observation publisher. */
5
+ export interface InspectorPublisher {
6
+ /** Publish one validated observation. */
7
+ publish(topic: string, payload: InspectorJsonValue, monotonicMs?: number): void;
8
+ }
9
+ /** Publisher that also retains the latest value of stateful observation topics. */
10
+ export interface InspectorStatePublisher extends InspectorPublisher {
11
+ /**
12
+ * Replace one topic's retained state and publish the replacement.
13
+ * @param topic - Domain-owned state topic.
14
+ * @param payload - Latest JSON state, replayed after source resynchronization.
15
+ * @param monotonicMs - Source-clock timestamp; defaults to `performance.now()`.
16
+ */
17
+ setState(topic: string, payload: InspectorJsonValue, monotonicMs?: number): void;
18
+ }
19
+ /** Shared capabilities exposed above a Host MessagePort or Client WebSocket carrier. */
20
+ export interface InspectorConnection extends InspectorStatePublisher, InspectorQueryRequester {
21
+ }
22
+ /** Shared observation and query delegation inherited by both source transports. */
23
+ export declare abstract class InspectorSourceConnection implements InspectorConnection {
24
+ protected abstract readonly publisher: InspectorStatePublisher;
25
+ protected abstract readonly queries: InspectorQueryRequester;
26
+ /** Publish one JSON observation without waiting on its carrier. */
27
+ publish(topic: string, payload: InspectorJsonValue, monotonicMs?: number): void;
28
+ /** Retain and publish one state value for reconnect or replacement recovery. */
29
+ setState(topic: string, payload: InspectorJsonValue, monotonicMs?: number): void;
30
+ /** Execute one non-CDP query through the active source generation. */
31
+ request<Query extends InspectorQuery>(query: Query): Promise<InspectorQueryResultFor<Query>>;
32
+ }
33
+ //# sourceMappingURL=publisher.d.ts.map
@@ -0,0 +1,10 @@
1
+ /** Query-backed adapter for the transport-independent Cordis tree reader. */
2
+ import type { CordisRuntimeTreeReader } from '../cordis/reader.ts';
3
+ import type { InspectorQueryRequester } from './messages/query/commands.ts';
4
+ /**
5
+ * Create a reader that obtains the tree through the typed Inspector query protocol.
6
+ * @param requester - Active Host or Client query connection.
7
+ * @returns A non-CDP Cordis tree reader.
8
+ */
9
+ export declare function createQueryCordisRuntimeTreeReader(requester: InspectorQueryRequester): CordisRuntimeTreeReader;
10
+ //# sourceMappingURL=query-reader.d.ts.map
@@ -0,0 +1,62 @@
1
+ /** Shared Host/Client owner of correlated non-CDP query requests. */
2
+ import { type InspectorSourceGeneration, type InspectorSourceId } from './ids.ts';
3
+ import type { InspectorQuery, InspectorQueryError, InspectorQueryRequester, InspectorQueryResultFor } from './messages/query/commands.ts';
4
+ import type { InspectorQueryRequestFrame } from './messages/query/frames.ts';
5
+ /** Active carrier write used by the shared query owner. */
6
+ export interface InspectorQuerySender {
7
+ /**
8
+ * Send one validated query request frame.
9
+ * @param frame - Request belonging to the active source generation.
10
+ */
11
+ send(frame: InspectorQueryRequestFrame): void;
12
+ }
13
+ /** Bounds applied by one Host or Client query connection. */
14
+ export interface InspectorQueryConnectionOptions {
15
+ readonly timeoutMs: number;
16
+ readonly maxFrameBytes: number;
17
+ }
18
+ /** Failure deliberately returned by the Worker query handler. */
19
+ export declare class InspectorQueryRemoteError extends Error {
20
+ readonly code: InspectorQueryError['code'];
21
+ constructor(code: InspectorQueryError['code'], message: string);
22
+ }
23
+ /** Correlates requests for one reconnecting Host or Client source. */
24
+ export declare class InspectorQueryConnection implements InspectorQueryRequester {
25
+ private readonly options;
26
+ private readonly pending;
27
+ private active;
28
+ private nextRequestId;
29
+ private closed;
30
+ constructor(options: InspectorQueryConnectionOptions);
31
+ /**
32
+ * Admit the source generation acknowledged by the Worker.
33
+ * @param sourceId - Stable source identity.
34
+ * @param generation - Newly accepted transport generation.
35
+ * @param sender - Carrier writer valid for that generation.
36
+ */
37
+ connect(sourceId: InspectorSourceId, generation: InspectorSourceGeneration, sender: InspectorQuerySender): void;
38
+ /**
39
+ * Execute a query against the currently accepted source generation.
40
+ * @param query - Closed typed query command.
41
+ * @returns The result with the same operation discriminant.
42
+ */
43
+ request<Query extends InspectorQuery>(query: Query): Promise<InspectorQueryResultFor<Query>>;
44
+ /**
45
+ * Consume a decoded carrier value when it is a query response.
46
+ * @param value - Untrusted Worker-to-source value.
47
+ * @returns Whether the value belonged to the query protocol.
48
+ */
49
+ receive(value: unknown): boolean;
50
+ /**
51
+ * Reject active requests while permitting a later source generation.
52
+ * @param reason - Failure reported to every pending caller.
53
+ */
54
+ disconnect(reason: string): void;
55
+ /**
56
+ * Permanently reject requests and prevent later reconnection.
57
+ * @param reason - Failure reported to every pending caller.
58
+ */
59
+ close(reason?: string): void;
60
+ private rejectPending;
61
+ }
62
+ //# sourceMappingURL=rpc.d.ts.map
@@ -0,0 +1,3 @@
1
+ /** Bridge-facing exports for the shared untrusted-value validation primitives. */
2
+ export * from '../validation.ts';
3
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1,3 @@
1
+ /** Current Inspector wire version. Pre-release peers reject every other version. */
2
+ export declare const INSPECTOR_PROTOCOL_VERSION: 0;
3
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1,17 @@
1
+ /** Explicit operation support advertised by each Inspector realm. */
2
+ /** Runtime operations implemented by a realm backend. */
3
+ export type RuntimeOperation = 'evaluate' | 'get-properties' | 'call-function' | 'await-promise' | 'release-object' | 'release-object-group' | 'global-lexical-scope-names';
4
+ /** Console operations implemented by a realm backend. */
5
+ export type ConsoleOperation = 'events' | 'exceptions' | 'clear';
6
+ /** Source catalog operations implemented by a realm backend. */
7
+ export type SourceOperation = 'catalog' | 'content' | 'source-map';
8
+ /** Active debugger operations implemented by a realm backend. */
9
+ export type DebuggerOperation = 'breakpoint' | 'pause' | 'resume' | 'step' | 'call-frame';
10
+ /** Complete capability declaration for one inspected realm. */
11
+ export interface InspectorRealmCapabilities {
12
+ readonly runtime: readonly RuntimeOperation[];
13
+ readonly console: readonly ConsoleOperation[];
14
+ readonly sources: readonly SourceOperation[];
15
+ readonly debugger: readonly DebuggerOperation[];
16
+ }
17
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1,28 @@
1
+ /** Realm-neutral Console events emitted by Runtime backends. */
2
+ import type { RuntimeRemoteObject } from './remote-object.ts';
3
+ import type { RuntimeExceptionDetails, RuntimeStackTrace } from './errors.ts';
4
+ /** Console API categories exposed by CDP Runtime. */
5
+ export type RuntimeConsoleType = 'log' | 'debug' | 'info' | 'error' | 'warning' | 'dir' | 'dirxml' | 'table' | 'trace' | 'clear' | 'startGroup' | 'startGroupCollapsed' | 'endGroup' | 'assert' | 'profile' | 'profileEnd' | 'count' | 'timeEnd';
6
+ /** One Console event associated with a single inspected realm. */
7
+ export interface RuntimeConsoleEvent<Handle extends string> {
8
+ readonly type: RuntimeConsoleType;
9
+ readonly arguments: readonly RuntimeRemoteObject<Handle>[];
10
+ readonly timestamp: number;
11
+ readonly contextId?: number;
12
+ readonly stackTrace?: RuntimeStackTrace;
13
+ }
14
+ /** One uncaught exception observed in an inspected realm. */
15
+ export interface RuntimeExceptionEvent<Handle extends string> {
16
+ readonly timestamp: number;
17
+ readonly contextId?: number;
18
+ readonly details: RuntimeExceptionDetails<Handle>;
19
+ }
20
+ /** Console-domain event emitted by a realm backend. */
21
+ export type RuntimeConsoleBackendEvent<Handle extends string> = {
22
+ readonly type: 'console-api';
23
+ readonly event: RuntimeConsoleEvent<Handle>;
24
+ } | {
25
+ readonly type: 'exception';
26
+ readonly event: RuntimeExceptionEvent<Handle>;
27
+ };
28
+ //# sourceMappingURL=console.d.ts.map
@@ -0,0 +1,69 @@
1
+ /** Realm-neutral values used by active debugger backends. */
2
+ import type { InspectorJsonValue } from '../json.ts';
3
+ import type { RuntimeScriptKey } from './ids.ts';
4
+ import type { RuntimeStackTrace } from './errors.ts';
5
+ import type { RuntimeCompletion } from './operations.ts';
6
+ import type { RuntimeRemoteObject } from './remote-object.ts';
7
+ /** One source location independent of a CDP ScriptId allocation policy. */
8
+ export interface RuntimeDebuggerLocation {
9
+ readonly scriptKey: RuntimeScriptKey;
10
+ readonly lineNumber: number;
11
+ readonly columnNumber?: number;
12
+ }
13
+ /** One lexical scope attached to a paused call frame. */
14
+ export interface RuntimeDebuggerScope<Handle extends string> {
15
+ readonly type: string;
16
+ readonly object: RuntimeRemoteObject<Handle>;
17
+ readonly name?: string;
18
+ readonly startLocation?: RuntimeDebuggerLocation;
19
+ readonly endLocation?: RuntimeDebuggerLocation;
20
+ }
21
+ /** One paused JavaScript call frame. */
22
+ export interface RuntimeDebuggerCallFrame<Handle extends string> {
23
+ readonly callFrameId: string;
24
+ readonly functionName: string;
25
+ readonly functionLocation?: RuntimeDebuggerLocation;
26
+ readonly location: RuntimeDebuggerLocation;
27
+ readonly url: string;
28
+ readonly scopeChain: readonly RuntimeDebuggerScope<Handle>[];
29
+ readonly thisObject: RuntimeRemoteObject<Handle>;
30
+ readonly returnValue?: RuntimeRemoteObject<Handle>;
31
+ }
32
+ /** Engine-independent evaluation request for one paused call frame. */
33
+ export interface RuntimeCallFrameEvaluationRequest {
34
+ readonly callFrameId: string;
35
+ readonly expression: string;
36
+ readonly objectGroup?: string;
37
+ readonly includeCommandLineAPI?: boolean;
38
+ readonly silent?: boolean;
39
+ readonly returnByValue?: boolean;
40
+ readonly generatePreview?: boolean;
41
+ readonly throwOnSideEffect?: boolean;
42
+ readonly timeoutMs?: number;
43
+ }
44
+ /** Optional native script-cache limit requested while enabling Debugger. */
45
+ export interface RuntimeDebuggerEnableRequest {
46
+ readonly maxScriptsCacheSize?: number;
47
+ }
48
+ /** Optional termination requested while resuming a native debugger. */
49
+ export interface RuntimeDebuggerResumeRequest {
50
+ readonly terminateOnResume?: boolean;
51
+ }
52
+ /** Debugger lifecycle notification emitted by a realm backend. */
53
+ export type RuntimeDebuggerEvent<Handle extends string> = {
54
+ readonly type: 'paused';
55
+ readonly callFrames: readonly RuntimeDebuggerCallFrame<Handle>[];
56
+ readonly reason: string;
57
+ readonly data?: InspectorJsonValue;
58
+ readonly hitBreakpoints?: readonly string[];
59
+ readonly asyncStackTrace?: RuntimeStackTrace;
60
+ } | {
61
+ readonly type: 'resumed';
62
+ } | {
63
+ readonly type: 'breakpoint-resolved';
64
+ readonly breakpointId: string;
65
+ readonly location: RuntimeDebuggerLocation;
66
+ };
67
+ /** Active debugger operation result containing a Runtime value. */
68
+ export type RuntimeCallFrameEvaluation<Handle extends string> = RuntimeCompletion<Handle>;
69
+ //# sourceMappingURL=debugger.d.ts.map
@@ -0,0 +1,27 @@
1
+ /** Realm-neutral JavaScript exception and stack information. */
2
+ import type { RuntimeScriptKey } from './ids.ts';
3
+ import type { RuntimeRemoteObject } from './remote-object.ts';
4
+ /** One source location in a Runtime exception stack. */
5
+ export interface RuntimeCallFrame {
6
+ readonly functionName: string;
7
+ readonly scriptKey?: RuntimeScriptKey;
8
+ readonly url: string;
9
+ readonly lineNumber: number;
10
+ readonly columnNumber: number;
11
+ }
12
+ /** JavaScript stack information independent of a Debugger script id. */
13
+ export interface RuntimeStackTrace {
14
+ readonly description?: string;
15
+ readonly callFrames: readonly RuntimeCallFrame[];
16
+ readonly parent?: RuntimeStackTrace;
17
+ }
18
+ /** JavaScript exception produced while executing one Runtime command. */
19
+ export interface RuntimeExceptionDetails<Handle extends string> {
20
+ readonly text: string;
21
+ readonly lineNumber: number;
22
+ readonly columnNumber: number;
23
+ readonly url?: string;
24
+ readonly stackTrace?: RuntimeStackTrace;
25
+ readonly exception?: RuntimeRemoteObject<Handle>;
26
+ }
27
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1,9 @@
1
+ /** Opaque identifiers owned by normalized realm backends. */
2
+ import type { InspectorId } from '../identity.ts';
3
+ /** Worker identity of one active Host or Client realm incarnation. */
4
+ export type InspectorRealmId = InspectorId<'InspectorRealmId'>;
5
+ /** Backend-owned object handle interpreted only by its realm session. */
6
+ export type RuntimeBackendObjectHandle = InspectorId<'RuntimeBackendObjectHandle'>;
7
+ /** Backend-independent identity of one script in a realm catalog. */
8
+ export type RuntimeScriptKey = InspectorId<'RuntimeScriptKey'>;
9
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1,11 @@
1
+ /** Realm-neutral Runtime, Console, Source, and Debugger protocol types. */
2
+ export * from './capabilities.ts';
3
+ export * from './console.ts';
4
+ export * from './debugger.ts';
5
+ export * from './errors.ts';
6
+ export * from './ids.ts';
7
+ export * from './operations.ts';
8
+ export * from './property.ts';
9
+ export * from './remote-object.ts';
10
+ export * from './sources.ts';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,86 @@
1
+ /** Realm-neutral Runtime operations and results. */
2
+ import type { InspectorJsonObject, InspectorJsonValue } from '../json.ts';
3
+ import type { RuntimeExceptionDetails } from './errors.ts';
4
+ import type { RuntimeInternalPropertyDescriptor, RuntimePrivatePropertyDescriptor, RuntimePropertyDescriptor } from './property.ts';
5
+ import type { RuntimeRemoteObject } from './remote-object.ts';
6
+ /** One argument supplied to a function in an inspected realm. */
7
+ export type RuntimeCallArgument<Handle extends string> = {
8
+ readonly kind: 'value';
9
+ readonly value: InspectorJsonValue;
10
+ } | {
11
+ readonly kind: 'unserializable';
12
+ readonly value: string;
13
+ } | {
14
+ readonly kind: 'object';
15
+ readonly handle: Handle;
16
+ } | {
17
+ readonly kind: 'undefined';
18
+ };
19
+ /** Backend-local selector for a native execution context within one realm. */
20
+ export type RuntimeExecutionContext = {
21
+ readonly kind: 'numeric';
22
+ readonly id: number;
23
+ } | {
24
+ readonly kind: 'unique';
25
+ readonly id: string;
26
+ };
27
+ /** Engine-independent evaluation options supported by Runtime backends. */
28
+ export interface RuntimeEvaluateRequest {
29
+ readonly expression: string;
30
+ readonly context?: RuntimeExecutionContext;
31
+ readonly objectGroup?: string;
32
+ readonly includeCommandLineAPI?: boolean;
33
+ readonly silent?: boolean;
34
+ readonly returnByValue?: boolean;
35
+ readonly generatePreview?: boolean;
36
+ readonly userGesture?: boolean;
37
+ readonly awaitPromise?: boolean;
38
+ readonly disableBreaks?: boolean;
39
+ readonly replMode?: boolean;
40
+ readonly allowUnsafeEvalBlockedByCSP?: boolean;
41
+ readonly throwOnSideEffect?: boolean;
42
+ readonly serializationOptions?: InspectorJsonObject;
43
+ readonly timeoutMs?: number;
44
+ }
45
+ /** Property enumeration request for one backend object. */
46
+ export interface RuntimeGetPropertiesRequest<Handle extends string> {
47
+ readonly handle: Handle;
48
+ readonly ownProperties?: boolean;
49
+ readonly accessorPropertiesOnly?: boolean;
50
+ readonly generatePreview?: boolean;
51
+ readonly nonIndexedPropertiesOnly?: boolean;
52
+ }
53
+ /** Function invocation request within one inspected realm. */
54
+ export interface RuntimeCallFunctionRequest<Handle extends string> {
55
+ readonly functionDeclaration: string;
56
+ readonly context?: RuntimeExecutionContext;
57
+ readonly receiver?: Handle;
58
+ readonly arguments?: readonly RuntimeCallArgument<Handle>[];
59
+ readonly objectGroup?: string;
60
+ readonly silent?: boolean;
61
+ readonly returnByValue?: boolean;
62
+ readonly generatePreview?: boolean;
63
+ readonly userGesture?: boolean;
64
+ readonly awaitPromise?: boolean;
65
+ readonly throwOnSideEffect?: boolean;
66
+ readonly serializationOptions?: InspectorJsonObject;
67
+ }
68
+ /** Promise-await request for one retained backend object. */
69
+ export interface RuntimeAwaitPromiseRequest<Handle extends string> {
70
+ readonly promise: Handle;
71
+ readonly returnByValue?: boolean;
72
+ readonly generatePreview?: boolean;
73
+ }
74
+ /** Shared result of evaluation, function calls, and promise awaiting. */
75
+ export interface RuntimeCompletion<Handle extends string> {
76
+ readonly result: RuntimeRemoteObject<Handle>;
77
+ readonly exceptionDetails?: RuntimeExceptionDetails<Handle>;
78
+ }
79
+ /** Shared result of property enumeration. */
80
+ export interface RuntimeProperties<Handle extends string> {
81
+ readonly properties: readonly RuntimePropertyDescriptor<Handle>[];
82
+ readonly internalProperties?: readonly RuntimeInternalPropertyDescriptor<Handle>[];
83
+ readonly privateProperties?: readonly RuntimePrivatePropertyDescriptor<Handle>[];
84
+ readonly exceptionDetails?: RuntimeExceptionDetails<Handle>;
85
+ }
86
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1,28 @@
1
+ /** Realm-neutral property descriptors returned by Runtime backends. */
2
+ import type { RuntimeRemoteObject } from './remote-object.ts';
3
+ /** One JavaScript property descriptor returned without invoking accessors. */
4
+ export interface RuntimePropertyDescriptor<Handle extends string> {
5
+ readonly name: string;
6
+ readonly value?: RuntimeRemoteObject<Handle>;
7
+ readonly writable?: boolean;
8
+ readonly get?: RuntimeRemoteObject<Handle>;
9
+ readonly set?: RuntimeRemoteObject<Handle>;
10
+ readonly configurable: boolean;
11
+ readonly enumerable: boolean;
12
+ readonly wasThrown?: boolean;
13
+ readonly isOwn?: boolean;
14
+ readonly symbol?: RuntimeRemoteObject<Handle>;
15
+ }
16
+ /** One engine-owned property such as `[[Prototype]]`. */
17
+ export interface RuntimeInternalPropertyDescriptor<Handle extends string> {
18
+ readonly name: string;
19
+ readonly value?: RuntimeRemoteObject<Handle>;
20
+ }
21
+ /** One engine private property exposed when a backend supports it. */
22
+ export interface RuntimePrivatePropertyDescriptor<Handle extends string> {
23
+ readonly name: string;
24
+ readonly value?: RuntimeRemoteObject<Handle>;
25
+ readonly get?: RuntimeRemoteObject<Handle>;
26
+ readonly set?: RuntimeRemoteObject<Handle>;
27
+ }
28
+ //# sourceMappingURL=property.d.ts.map
@@ -0,0 +1,137 @@
1
+ /** Environment-independent backend interfaces for inspected JavaScript realms. */
2
+ import type { RuntimeBackendObjectHandle, RuntimeScriptKey } from './ids.ts';
3
+ import type { RuntimeAwaitPromiseRequest, RuntimeCallFunctionRequest, RuntimeCompletion, RuntimeConsoleBackendEvent, RuntimeDebuggerEvent, RuntimeDebuggerEnableRequest, RuntimeDebuggerResumeRequest, RuntimeCallFrameEvaluationRequest, RuntimeEvaluateRequest, RuntimeGetPropertiesRequest, RuntimeExecutionContext, RuntimeProperties, RuntimeScript } from './index.ts';
4
+ /** Raw notification emitted by a native engine protocol backend. */
5
+ export interface NativeProtocolNotification {
6
+ readonly method: string;
7
+ readonly params?: Readonly<Record<string, unknown>>;
8
+ }
9
+ /** Explicitly supported or unsupported realm capability. */
10
+ export type RealmCapability<Backend> = {
11
+ readonly state: 'supported';
12
+ readonly backend: Backend;
13
+ } | {
14
+ readonly state: 'unsupported';
15
+ readonly reason: string;
16
+ };
17
+ /** Runtime operations implemented inside one per-connection realm session. */
18
+ export interface RuntimeBackend {
19
+ /** Prepare Runtime events and execution state for this connection. */
20
+ enable(): Promise<void>;
21
+ /** Disable Runtime events and release backend session state. */
22
+ disable(): Promise<void>;
23
+ /**
24
+ * Evaluate source in this realm.
25
+ * @param request - Engine-independent evaluation request.
26
+ * @returns Completion containing a value or JavaScript exception.
27
+ */
28
+ evaluate(request: RuntimeEvaluateRequest): Promise<RuntimeCompletion<RuntimeBackendObjectHandle>>;
29
+ /**
30
+ * Enumerate one retained object's properties.
31
+ * @param request - Property request containing this backend's object handle.
32
+ * @returns Property descriptors and optional exception details.
33
+ */
34
+ getProperties(request: RuntimeGetPropertiesRequest<RuntimeBackendObjectHandle>): Promise<RuntimeProperties<RuntimeBackendObjectHandle>>;
35
+ /**
36
+ * Invoke a function with references owned by this realm session.
37
+ * @param request - Function source, receiver, arguments, and result options.
38
+ * @returns Completion containing the invocation result or JavaScript exception.
39
+ */
40
+ callFunction(request: RuntimeCallFunctionRequest<RuntimeBackendObjectHandle>): Promise<RuntimeCompletion<RuntimeBackendObjectHandle>>;
41
+ /**
42
+ * Await one retained Promise.
43
+ * @param request - Promise handle and result options.
44
+ * @returns Completion containing the fulfilled value or rejection.
45
+ */
46
+ awaitPromise(request: RuntimeAwaitPromiseRequest<RuntimeBackendObjectHandle>): Promise<RuntimeCompletion<RuntimeBackendObjectHandle>>;
47
+ /**
48
+ * Read names visible in one backend execution context's global lexical scope.
49
+ * @param context - Native sub-context selector, or the realm default when omitted.
50
+ * @returns Names visible in the selected global lexical scope.
51
+ */
52
+ globalLexicalScopeNames(context?: RuntimeExecutionContext): Promise<readonly string[]>;
53
+ /**
54
+ * Release one backend object reference.
55
+ * @param handle - Handle owned by this realm session.
56
+ */
57
+ releaseObject(handle: RuntimeBackendObjectHandle): Promise<void>;
58
+ /**
59
+ * Release every backend object retained under one group.
60
+ * @param group - DevTools object-group name.
61
+ */
62
+ releaseObjectGroup(group: string): Promise<void>;
63
+ }
64
+ /** Realm Console event source. */
65
+ export interface ConsoleBackend {
66
+ /**
67
+ * Subscribe to Console and uncaught-exception events.
68
+ * @param listener - Connection-local event consumer.
69
+ * @returns A disposer for the subscription.
70
+ */
71
+ subscribe(listener: (event: RuntimeConsoleBackendEvent<RuntimeBackendObjectHandle>) => void): () => void;
72
+ /** Clear backend-owned Console history when supported. */
73
+ clear(): Promise<void>;
74
+ }
75
+ /** Realm script catalog independent of CDP ScriptId allocation. */
76
+ export interface SourceBackend {
77
+ /** @returns Every script currently known to this realm. */
78
+ listScripts(): Promise<readonly RuntimeScript[]>;
79
+ /**
80
+ * Read source text for one realm-local script key.
81
+ * @param scriptKey - Script identity allocated by this realm.
82
+ * @returns The complete source text.
83
+ */
84
+ getScriptSource(scriptKey: RuntimeScriptKey): Promise<string>;
85
+ /**
86
+ * Read an optional source map for one realm-local script key.
87
+ * @param scriptKey - Script identity allocated by this realm.
88
+ * @returns Source-map JSON when one exists.
89
+ */
90
+ getSourceMap(scriptKey: RuntimeScriptKey): Promise<string | undefined>;
91
+ /**
92
+ * Subscribe to scripts discovered after the initial catalog read.
93
+ * @param listener - Consumer of newly discovered scripts.
94
+ * @returns A disposer for the subscription.
95
+ */
96
+ subscribe(listener: (script: RuntimeScript) => void): () => void;
97
+ }
98
+ /** Active JavaScript debugging backend for one realm session. */
99
+ export interface DebuggerBackend {
100
+ /** Enable debugger events for this connection. */
101
+ enable(request: RuntimeDebuggerEnableRequest): Promise<Readonly<Record<string, unknown>>>;
102
+ /** Disable debugger events for this connection. */
103
+ disable(): Promise<Readonly<Record<string, unknown>>>;
104
+ /** Pause this realm. */
105
+ pause(): Promise<Readonly<Record<string, unknown>>>;
106
+ /** Resume this realm. */
107
+ resume(request: RuntimeDebuggerResumeRequest): Promise<Readonly<Record<string, unknown>>>;
108
+ /**
109
+ * Evaluate an expression in one paused frame.
110
+ * @param request - Frame identity, expression, and result options.
111
+ * @returns A common Runtime completion.
112
+ */
113
+ evaluateOnCallFrame(request: RuntimeCallFrameEvaluationRequest): Promise<RuntimeCompletion<RuntimeBackendObjectHandle>>;
114
+ /**
115
+ * Subscribe to paused, resumed, and breakpoint events.
116
+ * @param listener - Connection-local debugger event consumer.
117
+ * @returns A disposer removing the consumer.
118
+ */
119
+ subscribe(listener: (event: RuntimeDebuggerEvent<RuntimeBackendObjectHandle>) => void): () => void;
120
+ }
121
+ /** Explicit Host-only native protocol adapter for domains not yet normalized. */
122
+ export interface NativeDomainBackend {
123
+ /**
124
+ * Execute one native protocol request.
125
+ * @param method - CDP method owned by the native engine.
126
+ * @param params - Parsed CDP parameters.
127
+ * @returns Native response fields.
128
+ */
129
+ request(method: string, params: Readonly<Record<string, unknown>>): Promise<Readonly<Record<string, unknown>>>;
130
+ /**
131
+ * Subscribe to native protocol notifications.
132
+ * @param listener - Notification consumer.
133
+ * @returns A disposer removing the consumer.
134
+ */
135
+ subscribe(listener: (message: NativeProtocolNotification) => void): () => void;
136
+ }
137
+ //# sourceMappingURL=realm.d.ts.map
@@ -0,0 +1,44 @@
1
+ /** Realm-neutral JavaScript value descriptions used by Inspector backends. */
2
+ import type { InspectorObjectReference } from '../cordis/object-reference.ts';
3
+ import type { InspectorJsonValue } from '../json.ts';
4
+ /** Runtime value kinds represented by CDP `Runtime.RemoteObject`. */
5
+ export type RuntimeRemoteObjectType = 'object' | 'function' | 'undefined' | 'string' | 'number' | 'boolean' | 'symbol' | 'bigint';
6
+ /** Runtime object subtype hints understood by Chrome DevTools. */
7
+ export type RuntimeRemoteObjectSubtype = 'array' | 'null' | 'node' | 'regexp' | 'date' | 'map' | 'set' | 'weakmap' | 'weakset' | 'iterator' | 'generator' | 'error' | 'proxy' | 'promise' | 'typedarray' | 'arraybuffer' | 'dataview' | 'webassemblymemory' | 'wasmvalue';
8
+ /** Shallow property rendered inline by DevTools. */
9
+ export interface RuntimePropertyPreview {
10
+ readonly name: string;
11
+ readonly type: RuntimeRemoteObjectType | 'accessor';
12
+ readonly value?: string;
13
+ readonly valuePreview?: RuntimeObjectPreview;
14
+ readonly subtype?: RuntimeRemoteObjectSubtype;
15
+ }
16
+ /** Shallow object rendering that never carries a live-object reference. */
17
+ export interface RuntimeObjectPreview {
18
+ readonly type: RuntimeRemoteObjectType;
19
+ readonly subtype?: RuntimeRemoteObjectSubtype;
20
+ readonly description?: string;
21
+ readonly overflow: boolean;
22
+ readonly properties: readonly RuntimePropertyPreview[];
23
+ }
24
+ /** Engine-independent description of one JavaScript value. */
25
+ export interface RuntimeRemoteObjectDescriptor {
26
+ readonly type: RuntimeRemoteObjectType;
27
+ readonly subtype?: RuntimeRemoteObjectSubtype;
28
+ readonly className?: string;
29
+ readonly value?: InspectorJsonValue;
30
+ readonly unserializableValue?: string;
31
+ readonly description?: string;
32
+ readonly preview?: RuntimeObjectPreview;
33
+ }
34
+ /** Backend-owned reference to a retained object in one realm session. */
35
+ export interface RuntimeBackendObjectReference<Handle extends string> {
36
+ readonly handle: Handle;
37
+ }
38
+ /** Realm-neutral value plus optional backend and Cordis identities. */
39
+ export interface RuntimeRemoteObject<Handle extends string> {
40
+ readonly descriptor: RuntimeRemoteObjectDescriptor;
41
+ readonly object?: RuntimeBackendObjectReference<Handle>;
42
+ readonly semanticReference?: InspectorObjectReference;
43
+ }
44
+ //# sourceMappingURL=remote-object.d.ts.map