@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,108 @@
1
+ /** Host controller that owns the Inspector Worker and Host observation source. */
2
+ import type { InspectorClientBootstrap } from '../../shared/bridge/messages/control.ts';
3
+ import type { InspectorConnection } from '../../shared/bridge/publisher.ts';
4
+ /** User-facing Host options; every memory and lifecycle bound is configurable. */
5
+ export interface InspectorOptions {
6
+ /** Loopback address used by the Worker HTTP and WebSocket endpoint. */
7
+ readonly host?: '127.0.0.1';
8
+ /** First port to bind; occupied ports advance until one is available. */
9
+ readonly port?: number;
10
+ /** Additional exact browser origins admitted to the Client ingest socket. */
11
+ readonly clientOrigins?: readonly string[];
12
+ /** Whether to observe calls made through the current global fetch function. */
13
+ readonly captureFetch?: boolean;
14
+ /** Maximum request-body prefix retained for one fetch. */
15
+ readonly maxRequestBodyBytes?: number;
16
+ /** Maximum response-body prefix retained for one fetch. */
17
+ readonly maxResponseBodyBytes?: number;
18
+ /** Maximum raw bytes encoded into one body observation. */
19
+ readonly maxBodyChunkBytes?: number;
20
+ /** Maximum total request and response body bytes retained by the Worker. */
21
+ readonly maxJournalBytes?: number;
22
+ /** Maximum active and completed fetch requests retained by the Worker. */
23
+ readonly maxRetainedRequests?: number;
24
+ /** Maximum encoded bytes accepted in one source transport frame. */
25
+ readonly maxSourceFrameBytes?: number;
26
+ /** Maximum observation records accepted in one source batch. */
27
+ readonly maxSourceRecordsPerFrame?: number;
28
+ /** Maximum records waiting in one producer queue. */
29
+ readonly maxQueuedRecords?: number;
30
+ /** Maximum encoded bytes waiting in one producer queue. */
31
+ readonly maxQueuedBytes?: number;
32
+ /** Maximum time allowed for the Worker to become ready. */
33
+ readonly startupTimeoutMs?: number;
34
+ /** Grace period before a stopping Worker is terminated. */
35
+ readonly stopTimeoutMs?: number;
36
+ /** Initial upper bound for randomized Client reconnect delay. */
37
+ readonly clientReconnectBaseMs?: number;
38
+ /** Maximum upper bound for randomized Client reconnect delay. */
39
+ readonly clientReconnectMaxMs?: number;
40
+ /** Deadline for one Worker-to-Client Runtime or Sources request. */
41
+ readonly clientRuntimeTimeoutMs?: number;
42
+ /** Deadline for one non-CDP semantic query. */
43
+ readonly queryTimeoutMs?: number;
44
+ /** Maximum live object handles retained per Client Runtime session. */
45
+ readonly maxClientRuntimeObjects?: number;
46
+ /** Maximum descriptors returned by one Client property request. */
47
+ readonly maxClientRuntimeProperties?: number;
48
+ /** Maximum encoded bytes read for one Client script or source map. */
49
+ readonly maxClientSourceBytes?: number;
50
+ /** Maximum Context and Fiber nodes retained in one realm snapshot. */
51
+ readonly maxCordisNodes?: number;
52
+ /** Disconnected Cordis snapshots retained after their live realm closes. */
53
+ readonly maxDisconnectedCordisTrees?: number;
54
+ }
55
+ /** Fully resolved options used by one running Inspector. */
56
+ export interface InspectorSpec {
57
+ readonly host: '127.0.0.1';
58
+ readonly port: number;
59
+ readonly clientOrigins: readonly string[];
60
+ readonly captureFetch: boolean;
61
+ readonly maxRequestBodyBytes: number;
62
+ readonly maxResponseBodyBytes: number;
63
+ readonly maxBodyChunkBytes: number;
64
+ readonly maxJournalBytes: number;
65
+ readonly maxRetainedRequests: number;
66
+ readonly maxSourceFrameBytes: number;
67
+ readonly maxSourceRecordsPerFrame: number;
68
+ readonly maxQueuedRecords: number;
69
+ readonly maxQueuedBytes: number;
70
+ readonly startupTimeoutMs: number;
71
+ readonly stopTimeoutMs: number;
72
+ readonly clientReconnectBaseMs: number;
73
+ readonly clientReconnectMaxMs: number;
74
+ readonly clientRuntimeTimeoutMs: number;
75
+ readonly queryTimeoutMs: number;
76
+ readonly maxClientRuntimeObjects: number;
77
+ readonly maxClientRuntimeProperties: number;
78
+ readonly maxClientSourceBytes: number;
79
+ readonly maxCordisNodes: number;
80
+ readonly maxDisconnectedCordisTrees: number;
81
+ }
82
+ /** Addresses and browser bootstrap of one bound Worker. */
83
+ export interface InspectorEndpoint {
84
+ readonly httpUrl: string;
85
+ readonly webSocketDebuggerUrl: string;
86
+ readonly devtoolsFrontendUrl: string;
87
+ readonly client: InspectorClientBootstrap;
88
+ }
89
+ /** Running Host-side Inspector owner. */
90
+ export interface InspectorHandle {
91
+ readonly endpoint: InspectorEndpoint;
92
+ readonly source: InspectorConnection;
93
+ /** Stop capture and wait for the Worker to release every socket and V8 session. */
94
+ close(): Promise<void>;
95
+ }
96
+ /**
97
+ * Resolve and validate all deployment-varying Inspector choices.
98
+ * @param options - Partial caller configuration.
99
+ * @returns A complete immutable configuration.
100
+ */
101
+ export declare function resolveInspectorOptions(options?: InspectorOptions): InspectorSpec;
102
+ /**
103
+ * Start the Worker, create the Host source, and install full fetch capture by default.
104
+ * @param options - Partial caller configuration.
105
+ * @returns The ready endpoint and its quiescent shutdown handle.
106
+ */
107
+ export declare function startInspector(options?: InspectorOptions): Promise<InspectorHandle>;
108
+ //# sourceMappingURL=controller.d.ts.map
@@ -0,0 +1,16 @@
1
+ /** Dispatch of validated Worker frames accepted by the Host MessagePort. */
2
+ import type { SourceAcceptedFrame, SourceAppendAcknowledgedFrame, SourceRejectedFrame, SourceResnapshotFrame, WorkerToSourceFrame } from '../../shared/bridge/messages/observation.ts';
3
+ /** Operations invoked for source-lifecycle frames addressed to the Host. */
4
+ export interface HostBridgeFrameHandlers {
5
+ accepted(frame: SourceAcceptedFrame): void;
6
+ acknowledged(frame: SourceAppendAcknowledgedFrame): void;
7
+ resnapshot(frame: SourceResnapshotFrame): void;
8
+ rejected(frame: SourceRejectedFrame): void;
9
+ }
10
+ /**
11
+ * Dispatch one validated Worker frame and reject Client-only commands on the Host carrier.
12
+ * @param frame - Decoded Worker-to-source frame.
13
+ * @param handlers - Host source-lifecycle operations.
14
+ */
15
+ export declare function dispatchBridgeFrame(frame: WorkerToSourceFrame, handlers: HostBridgeFrameHandlers): void;
16
+ //# sourceMappingURL=dispatcher.d.ts.map
@@ -0,0 +1,42 @@
1
+ /** Failure containment and shutdown coordination for the Inspector Worker. */
2
+ import type { Worker } from 'node:worker_threads';
3
+ import type { InspectorWorkerControl } from '../../shared/bridge/messages/control.ts';
4
+ /** Tracks Worker termination without removing the listener that contains runtime errors. */
5
+ export declare class InspectorWorkerLifecycle {
6
+ private readonly worker;
7
+ private readonly exitResolution;
8
+ private readonly failureResolution;
9
+ private failure;
10
+ private running;
11
+ private expectedExit;
12
+ private notified;
13
+ private onUnexpectedExit;
14
+ private exitCodeValue;
15
+ /** Worker exit code once its `exit` event has fired. */
16
+ get exitCode(): number | undefined;
17
+ constructor(worker: Worker);
18
+ /**
19
+ * Wait for the validated ready frame while also observing startup failure and exit.
20
+ * @param timeoutMs - Readiness deadline in milliseconds.
21
+ * @returns The Worker's bound endpoint fields.
22
+ */
23
+ waitForReady(timeoutMs: number): Promise<Extract<InspectorWorkerControl, {
24
+ type: 'ready';
25
+ }>>;
26
+ /**
27
+ * Begin reporting an unexpected runtime exit through one contained callback.
28
+ * @param listener - Failure observer that must not throw.
29
+ */
30
+ markRunning(listener: (error: Error) => void): void;
31
+ /** Mark subsequent Worker termination as owner-requested. */
32
+ expectExit(): void;
33
+ /** Terminate the Worker during failed initialization. */
34
+ terminate(): Promise<void>;
35
+ /**
36
+ * Request graceful shutdown and terminate after the deadline.
37
+ * @param timeoutMs - Grace period before forced termination.
38
+ */
39
+ stop(timeoutMs: number): Promise<void>;
40
+ private notifyUnexpectedExit;
41
+ }
42
+ //# sourceMappingURL=lifecycle.d.ts.map
@@ -0,0 +1,31 @@
1
+ /** Buffered Host observation publication over a dedicated Worker MessagePort. */
2
+ import type { MessagePort } from 'node:worker_threads';
3
+ import { type InspectorSourceBufferOptions } from '../../shared/bridge/buffer.ts';
4
+ import type { InspectorJsonValue } from '../../shared/json.ts';
5
+ import type { InspectorStatePublisher } from '../../shared/bridge/publisher.ts';
6
+ import type { InspectorSourceDescriptor } from '../../shared/bridge/messages/observation.ts';
7
+ /** Non-blocking Host publisher with microtask-coalesced MessagePort writes. */
8
+ export declare class HostBridgePublisher implements InspectorStatePublisher {
9
+ private readonly port;
10
+ private readonly source;
11
+ private readonly records;
12
+ private flushScheduled;
13
+ private inFlightNextSequence;
14
+ private closed;
15
+ constructor(port: MessagePort, source: InspectorSourceDescriptor, options: InspectorSourceBufferOptions);
16
+ publish(topic: string, payload: InspectorJsonValue, monotonicMs?: number): void;
17
+ setState(topic: string, payload: InspectorJsonValue, monotonicMs?: number): void;
18
+ /** Send the retained state as a complete source replacement. */
19
+ replace(): void;
20
+ /** Send one queued batch when no earlier MessagePort batch awaits acknowledgement. */
21
+ flush(): void;
22
+ /**
23
+ * Release one in-flight batch and schedule the next bounded transfer.
24
+ * @param nextSequence - First sequence expected by the Worker after the accepted batch.
25
+ */
26
+ acknowledge(nextSequence: number): void;
27
+ /** Send at most one final batch, discard later queued observations, and reject publication. */
28
+ close(): void;
29
+ private scheduleFlush;
30
+ }
31
+ //# sourceMappingURL=publisher.d.ts.map
@@ -0,0 +1,15 @@
1
+ /** Host-side non-CDP query bridge over the Worker MessagePort. */
2
+ import type { MessagePort } from 'node:worker_threads';
3
+ import type { InspectorSourceDescriptor } from '../../shared/bridge/messages/observation.ts';
4
+ import { InspectorQueryConnection, type InspectorQueryConnectionOptions } from '../../shared/bridge/rpc.ts';
5
+ /** Owns query correlation for one Host source generation. */
6
+ export declare class HostBridgeRpc extends InspectorQueryConnection {
7
+ private readonly port;
8
+ constructor(port: MessagePort, options: InspectorQueryConnectionOptions);
9
+ /**
10
+ * Connect query writes after the Worker accepts the Host source.
11
+ * @param source - Accepted Host source descriptor.
12
+ */
13
+ connectPort(source: InspectorSourceDescriptor): void;
14
+ }
15
+ //# sourceMappingURL=rpc.d.ts.map
@@ -0,0 +1,28 @@
1
+ /** Host-realm observation publisher over a dedicated MessagePort. */
2
+ import type { MessagePort } from 'node:worker_threads';
3
+ import { InspectorSourceConnection } from '../../shared/bridge/publisher.ts';
4
+ import { HostBridgePublisher } from './publisher.ts';
5
+ import { HostBridgeRpc } from './rpc.ts';
6
+ /** Buffer limits for one source publisher. */
7
+ export interface HostSourceOptions {
8
+ readonly label: string;
9
+ readonly topics: readonly string[];
10
+ readonly maxQueuedRecords: number;
11
+ readonly maxQueuedBytes: number;
12
+ readonly maxRecordsPerFrame: number;
13
+ readonly maxFrameBytes: number;
14
+ readonly queryTimeoutMs: number;
15
+ }
16
+ /** Non-blocking Host source; queue overflow is represented by `droppedBefore` on the next batch. */
17
+ export declare class HostInspectorSource extends InspectorSourceConnection {
18
+ private readonly port;
19
+ private readonly source;
20
+ protected readonly publisher: HostBridgePublisher;
21
+ private closed;
22
+ protected readonly queries: HostBridgeRpc;
23
+ constructor(port: MessagePort, options: HostSourceOptions);
24
+ /** Flush pending observations and close the source port. */
25
+ close(): void;
26
+ private receive;
27
+ }
28
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1,14 @@
1
+ /** Host Console is served directly by the Worker-side Node inspector adapter. */
2
+ import type { InspectorSourceCapability } from '../../shared/bridge/messages/observation.ts';
3
+ /**
4
+ * Describe Host Console transport ownership.
5
+ * @returns No Host-main-thread Console bridge capability.
6
+ */
7
+ export declare function consoleBridgeCapability(): InspectorSourceCapability | undefined;
8
+ /**
9
+ * Reject a Client Console control frame that was routed to the Host source.
10
+ * @param operation - Misrouted Console frame type.
11
+ * @returns This function never returns.
12
+ */
13
+ export declare function rejectConsoleBridgeCommand(operation: string): never;
14
+ //# sourceMappingURL=console.d.ts.map
@@ -0,0 +1,8 @@
1
+ /** Host debugging is served directly by the Worker-side Node inspector adapter. */
2
+ import type { InspectorSourceCapability } from '../../shared/bridge/messages/observation.ts';
3
+ /**
4
+ * Describe Host debugger transport ownership.
5
+ * @returns No Host-main-thread Debugger bridge capability.
6
+ */
7
+ export declare function debuggerBridgeCapability(): InspectorSourceCapability | undefined;
8
+ //# sourceMappingURL=debugger.d.ts.map
@@ -0,0 +1,6 @@
1
+ /** Explicit failure for Client-style CDP bridge commands misrouted to the Host. */
2
+ /** Host Runtime uses the Worker-side Node inspector session instead of source RPC. */
3
+ export declare class HostCdpBridgeUnavailableError extends Error {
4
+ constructor(operation: string);
5
+ }
6
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1,8 @@
1
+ /** Host heap profiling is served directly by the Worker-side Node inspector adapter. */
2
+ import type { InspectorSourceCapability } from '../../shared/bridge/messages/observation.ts';
3
+ /**
4
+ * Describe Host heap profiler transport ownership.
5
+ * @returns No Host-main-thread HeapProfiler bridge capability.
6
+ */
7
+ export declare function heapProfilerBridgeCapability(): InspectorSourceCapability | undefined;
8
+ //# sourceMappingURL=heap-profiler.d.ts.map
@@ -0,0 +1,10 @@
1
+ /** Source-side CDP capability declarations for the Host realm. */
2
+ import type { InspectorSourceCapability } from '../../shared/bridge/messages/observation.ts';
3
+ /**
4
+ * Collect Host source-bridge capabilities.
5
+ * @param _origin - Unused Host origin supplied for parity with the Client adapter.
6
+ * @param _hasSources - Unused source availability supplied for parity with the Client adapter.
7
+ * @returns No capabilities because the Worker attaches to Host V8 directly.
8
+ */
9
+ export declare function bridgeCapabilities(_origin: string, _hasSources: boolean): readonly InspectorSourceCapability[];
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,8 @@
1
+ /** Host RemoteObject handles never cross the Host source bridge. */
2
+ /**
3
+ * Reject an object operation that must use the Worker-owned native inspector session.
4
+ * @param operation - Misrouted object operation.
5
+ * @returns This function never returns.
6
+ */
7
+ export declare function rejectObjectBridgeOperation(operation: string): never;
8
+ //# sourceMappingURL=objects.d.ts.map
@@ -0,0 +1,8 @@
1
+ /** Host CPU profiling is served directly by the Worker-side Node inspector adapter. */
2
+ import type { InspectorSourceCapability } from '../../shared/bridge/messages/observation.ts';
3
+ /**
4
+ * Describe Host CPU profiler transport ownership.
5
+ * @returns No Host-main-thread Profiler bridge capability.
6
+ */
7
+ export declare function profilerBridgeCapability(): InspectorSourceCapability | undefined;
8
+ //# sourceMappingURL=profiler.d.ts.map
@@ -0,0 +1,7 @@
1
+ /** Host property enumeration never crosses the Host source bridge. */
2
+ /**
3
+ * Reject a property request that must use the Worker-owned native inspector session.
4
+ * @returns This function never returns.
5
+ */
6
+ export declare function rejectPropertyBridgeOperation(): never;
7
+ //# sourceMappingURL=properties.d.ts.map
@@ -0,0 +1,16 @@
1
+ /** Host Runtime is served directly by the Worker-side Node inspector adapter. */
2
+ import type { ClientRuntimeCommand } from '../../shared/bridge/messages/runtime/index.ts';
3
+ import type { InspectorSourceCapability } from '../../shared/bridge/messages/observation.ts';
4
+ /**
5
+ * Describe Host Runtime transport ownership.
6
+ * @param _origin - Ignored because Host Runtime does not cross the source bridge.
7
+ * @returns No Host-main-thread Runtime bridge capability.
8
+ */
9
+ export declare function runtimeBridgeCapability(_origin: string): InspectorSourceCapability | undefined;
10
+ /**
11
+ * Reject a Client Runtime command that was routed to the Host source.
12
+ * @param command - Misrouted Client Runtime operation.
13
+ * @returns This function never returns.
14
+ */
15
+ export declare function rejectRuntimeBridgeCommand(command: ClientRuntimeCommand): never;
16
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1,14 @@
1
+ /** Host Sources are served directly by the Worker-side Node inspector adapter. */
2
+ import type { InspectorSourceCapability } from '../../shared/bridge/messages/observation.ts';
3
+ /**
4
+ * Describe Host Sources transport ownership.
5
+ * @param _available - Ignored because Host Sources do not cross the source bridge.
6
+ * @returns No Host-main-thread Sources bridge capability.
7
+ */
8
+ export declare function sourcesBridgeCapability(_available: boolean): InspectorSourceCapability | undefined;
9
+ /**
10
+ * Reject a Client Sources request that was routed to the Host source.
11
+ * @returns This function never returns.
12
+ */
13
+ export declare function rejectSourcesBridgeCommand(): never;
14
+ //# sourceMappingURL=sources.d.ts.map
@@ -0,0 +1,4 @@
1
+ /** Host stack and call-frame data remain owned by the Worker-side Node inspector session. */
2
+ /** Stable explanation used for Host bridge rejections. */
3
+ export declare const HOST_CDP_BRIDGE_REASON = "Host Runtime is attached directly from the Inspector Worker";
4
+ //# sourceMappingURL=stack.d.ts.map
@@ -0,0 +1,3 @@
1
+ /** Host entry for the experimental Inspector Cordis plugin and library API. */
2
+ export * from './plugin.ts';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,3 @@
1
+ /** Host entry for the shared Cordis snapshot publisher. */
2
+ export { publishCordisTree } from '../../shared/cordis/publisher.ts';
3
+ //# sourceMappingURL=cordis.d.ts.map
@@ -0,0 +1,23 @@
1
+ /** Full `globalThis.fetch` capture that publishes without delaying response delivery. */
2
+ import type { InspectorPublisher } from '../../shared/bridge/publisher.ts';
3
+ /** Observation topics published by the Host network adapter. */
4
+ export declare const NETWORK_TOPICS: readonly string[];
5
+ /** Byte limits for request and response clone capture. */
6
+ export interface FetchCaptureOptions {
7
+ readonly maxRequestBodyBytes: number;
8
+ readonly maxResponseBodyBytes: number;
9
+ readonly maxChunkBytes: number;
10
+ }
11
+ /** Active global fetch wrapper. */
12
+ export interface FetchObserver {
13
+ /** Restore the prior fetch implementation, cancel clone readers, and await their settlement. */
14
+ stop(): Promise<void>;
15
+ }
16
+ /**
17
+ * Install full fetch capture for every later call through `globalThis.fetch`.
18
+ * @param publisher - Host source that receives fetch lifecycle records.
19
+ * @param options - Per-body capture limits.
20
+ * @returns The owner that stops capture and awaits pending body readers.
21
+ */
22
+ export declare function installFetchObserver(publisher: InspectorPublisher, options: FetchCaptureOptions): FetchObserver;
23
+ //# sourceMappingURL=network.d.ts.map
@@ -0,0 +1,9 @@
1
+ /** Stable descriptor for the Host observation source generation. */
2
+ import type { InspectorSourceDescriptor } from '../../shared/bridge/messages/observation.ts';
3
+ /**
4
+ * Create the descriptor for one Host-to-Worker MessagePort generation.
5
+ * @param label - Human-readable Host execution-context label.
6
+ * @returns The complete Host source descriptor.
7
+ */
8
+ export declare function createHostRealmSource(label: string): InspectorSourceDescriptor;
9
+ //# sourceMappingURL=realm.d.ts.map
@@ -0,0 +1,19 @@
1
+ /** Host Cordis plugin for the cross-realm Inspector Worker and full fetch capture. */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ import { type InspectorOptions } from './bridge/controller.ts';
4
+ export { resolveInspectorOptions, startInspector } from './bridge/controller.ts';
5
+ export type { InspectorEndpoint, InspectorHandle, InspectorOptions, InspectorSpec } from './bridge/controller.ts';
6
+ export type { CordisRuntimeTreeReader } from '../shared/cordis/reader.ts';
7
+ export type { CordisRuntimeConnection, CordisRuntimeContext, CordisRuntimeFiber, CordisRuntimeNode, CordisRuntimeRealm, CordisRuntimeSource, CordisRuntimeTree, } from '../shared/cordis/model.ts';
8
+ export type { InspectorClientBootstrap } from '../shared/bridge/messages/control.ts';
9
+ export type { InspectorRecordInput, InspectorSourceDescriptor, InspectorSourceKind } from '../shared/bridge/messages/observation.ts';
10
+ export type { InspectorJsonObject, InspectorJsonPrimitive, InspectorJsonValue } from '../shared/json.ts';
11
+ export type { CordisContextTreeNode, CordisFiberTreeNode, CordisTreeNode, CordisTreeSnapshot, } from '../shared/cordis/snapshot.ts';
12
+ /** Configuration consumed by the Host implementation after package-entry validation. */
13
+ export interface HostPluginConfig extends Omit<InspectorOptions, 'clientOrigins'> {
14
+ /** Browser origins allowed to open the Client ingest WebSocket. */
15
+ clientOrigins?: string[];
16
+ }
17
+ /** Start the Worker, expose `ctx.inspector`, and inject the matching Client bootstrap. */
18
+ export declare function apply(ctx: Context, config: HostPluginConfig): Promise<void>;
19
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1,50 @@
1
+ /** Repository-facing Host package entry over the mirrored implementation tree. */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ import z from '@deepseek-ai/schemastery';
4
+ import { type InspectorOptions } from './host/bridge/controller.ts';
5
+ import type { CordisRuntimeTreeReader } from './shared/cordis/reader.ts';
6
+ import type { InspectorJsonValue } from './shared/json.ts';
7
+ export { resolveInspectorOptions, startInspector } from './host/plugin.ts';
8
+ export type { InspectorEndpoint, InspectorHandle, InspectorOptions, InspectorSpec } from './host/plugin.ts';
9
+ export type { CordisRuntimeTreeReader } from './shared/cordis/reader.ts';
10
+ export type { CordisRuntimeConnection, CordisRuntimeContext, CordisRuntimeFiber, CordisRuntimeNode, CordisRuntimeRealm, CordisRuntimeSource, CordisRuntimeTree, } from './shared/cordis/model.ts';
11
+ export type { InspectorClientBootstrap } from './shared/bridge/messages/control.ts';
12
+ export type { InspectorRecordInput, InspectorSourceDescriptor, InspectorSourceKind, } from './shared/bridge/messages/observation.ts';
13
+ export type { InspectorJsonObject, InspectorJsonPrimitive, InspectorJsonValue } from './shared/json.ts';
14
+ export type { CordisContextTreeNode, CordisFiberTreeNode, CordisTreeNode, CordisTreeSnapshot, } from './shared/cordis/snapshot.ts';
15
+ /** Shared Host/Client service façade over the realm's source publisher. */
16
+ export interface InspectorService {
17
+ /**
18
+ * Publish one JSON observation without waiting for Worker delivery.
19
+ * @param topic - Domain-owned topic name.
20
+ * @param payload - JSON value validated before it reaches the carrier.
21
+ * @param monotonicMs - Source-clock timestamp; defaults to `performance.now()`.
22
+ */
23
+ publish(topic: string, payload: InspectorJsonValue, monotonicMs?: number): void;
24
+ /** Read-only Cordis topology queries independent of CDP sessions. */
25
+ readonly cordis: CordisRuntimeTreeReader;
26
+ }
27
+ declare module '@deepseek-ai/cordis' {
28
+ interface Context {
29
+ /** Publish Host-realm observations and query the shared Inspector state. */
30
+ inspector: InspectorService;
31
+ }
32
+ }
33
+ /** Cordis plugin name shared with the Client face. */
34
+ export declare const name = "experimental-inspector";
35
+ /** Host service required to inject the Client connection bootstrap into index.html. */
36
+ export declare const inject: string[];
37
+ /** Host plugin configuration. Fetch capture is enabled by default. */
38
+ export interface Config extends Omit<InspectorOptions, 'clientOrigins'> {
39
+ /** Browser origins allowed to open the Client ingest WebSocket. */
40
+ clientOrigins?: string[];
41
+ }
42
+ /** Runtime validation for {@link Config}. */
43
+ export declare const Config: z<Config>;
44
+ /**
45
+ * Apply the Host implementation from the repository-standard package entry.
46
+ * @param ctx - Host Cordis plugin context.
47
+ * @param config - Validated Inspector configuration.
48
+ */
49
+ export declare function apply(ctx: Context, config: Config): Promise<void>;
50
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,62 @@
1
+ /** Realm-neutral bounded buffering for Host and Client observation sources. */
2
+ import type { InspectorSourceGeneration, InspectorSourceId } from './ids.ts';
3
+ import { type InspectorJsonValue } from '../json.ts';
4
+ import type { SourceAppendFrame, SourceReplaceFrame } from './messages/observation.ts';
5
+ /** Limits and declared topics shared by both source transports. */
6
+ export interface InspectorSourceBufferOptions {
7
+ readonly topics: readonly string[];
8
+ readonly maxQueuedRecords: number;
9
+ readonly maxQueuedBytes: number;
10
+ readonly maxRecordsPerFrame: number;
11
+ readonly maxFrameBytes: number;
12
+ }
13
+ /**
14
+ * Owns retained state, queued events, and source-local sequencing independently
15
+ * of whether frames travel over MessagePort or WebSocket.
16
+ */
17
+ export declare class InspectorSourceBuffer {
18
+ private readonly options;
19
+ private readonly queue;
20
+ private readonly state;
21
+ private queuedBytes;
22
+ private nextSequence;
23
+ private expectedSequence;
24
+ constructor(options: InspectorSourceBufferOptions);
25
+ /** Whether at least one observation is waiting for transport. */
26
+ get hasPending(): boolean;
27
+ /**
28
+ * Validate and enqueue one observation, dropping the oldest prefix as needed.
29
+ * A record larger than one transport frame is dropped after consuming its sequence number.
30
+ * @param topic - Declared domain topic.
31
+ * @param payload - Lossless JSON payload.
32
+ * @param monotonicMs - Finite source-clock timestamp.
33
+ */
34
+ publish(topic: string, payload: InspectorJsonValue, monotonicMs: number): void;
35
+ /**
36
+ * Replace one retained topic and enqueue the same observation for live delivery.
37
+ * @param topic - Declared state topic.
38
+ * @param payload - Lossless JSON payload retained for replacement frames.
39
+ * @param monotonicMs - Finite source-clock timestamp.
40
+ */
41
+ setState(topic: string, payload: InspectorJsonValue, monotonicMs: number): void;
42
+ /**
43
+ * Build a complete state replacement and absorb every preceding queue drop.
44
+ * @param sourceId - Logical source identity.
45
+ * @param generation - Current transport generation.
46
+ * @returns A replacement frame whose sequence is the next append position.
47
+ */
48
+ replacement(sourceId: InspectorSourceId, generation: InspectorSourceGeneration): SourceReplaceFrame;
49
+ /**
50
+ * Remove and sequence the next transport-sized observation batch.
51
+ * @param sourceId - Logical source identity.
52
+ * @param generation - Current transport generation.
53
+ * @returns The next append frame, or `undefined` when the queue is empty.
54
+ */
55
+ takeBatch(sourceId: InspectorSourceId, generation: InspectorSourceGeneration): SourceAppendFrame | undefined;
56
+ /** Discard observations that have not entered a transport frame. */
57
+ discardPending(): void;
58
+ private record;
59
+ private enqueue;
60
+ private stateFits;
61
+ }
62
+ //# sourceMappingURL=buffer.d.ts.map
@@ -0,0 +1,4 @@
1
+ /** Bridge-facing exports for lossless JSON values and common wire validators. */
2
+ export * from '../json.ts';
3
+ export * from '../validation.ts';
4
+ //# sourceMappingURL=codec.d.ts.map
@@ -0,0 +1,27 @@
1
+ /** Exact decoders for Host, Worker, and injected Client lifecycle values. */
2
+ import type { InspectorClientBootstrap, InspectorHostControl, InspectorWorkerConfig, InspectorWorkerControl } from './messages/control.ts';
3
+ /**
4
+ * Decode the structured-cloned Worker configuration.
5
+ * @param value - Untrusted workerData config value.
6
+ * @returns The validated Worker configuration.
7
+ */
8
+ export declare function parseInspectorWorkerConfig(value: unknown): InspectorWorkerConfig;
9
+ /**
10
+ * Decode one Host-to-Worker lifecycle command.
11
+ * @param value - Untrusted control message.
12
+ * @returns The validated Host command.
13
+ */
14
+ export declare function parseInspectorHostControl(value: unknown): InspectorHostControl;
15
+ /**
16
+ * Decode one Worker-to-Host lifecycle event.
17
+ * @param value - Untrusted control message.
18
+ * @returns The validated Worker event.
19
+ */
20
+ export declare function parseInspectorWorkerControl(value: unknown): InspectorWorkerControl;
21
+ /**
22
+ * Decode bootstrap data injected into the browser global.
23
+ * @param value - Untrusted injected value.
24
+ * @returns The validated Client bootstrap.
25
+ */
26
+ export declare function parseInspectorClientBootstrap(value: unknown): InspectorClientBootstrap;
27
+ //# sourceMappingURL=control-codec.d.ts.map
@@ -0,0 +1,19 @@
1
+ /** Opaque identifiers owned by the cross-realm Inspector bridge. */
2
+ import type { InspectorId } from '../identity.ts';
3
+ export { inspectorId } from '../identity.ts';
4
+ export type { InspectorId } from '../identity.ts';
5
+ /** Stable identity of one logical observation source. */
6
+ export type InspectorSourceId = InspectorId<'InspectorSourceId'>;
7
+ /** Identity of one source connection generation. */
8
+ export type InspectorSourceGeneration = InspectorId<'InspectorSourceGeneration'>;
9
+ /** Identity of one DevTools connection's Client Runtime state. */
10
+ export type ClientRuntimeSessionId = InspectorId<'ClientRuntimeSessionId'>;
11
+ /** Identity of one in-flight Worker-to-Client Runtime operation. */
12
+ export type ClientRuntimeRequestId = InspectorId<'ClientRuntimeRequestId'>;
13
+ /** Identity of one DevTools connection's Client source catalog session. */
14
+ export type ClientSourceSessionId = InspectorId<'ClientSourceSessionId'>;
15
+ /** Identity of one in-flight Worker-to-Client source operation. */
16
+ export type ClientSourceRequestId = InspectorId<'ClientSourceRequestId'>;
17
+ /** Opaque reference to an object retained inside one Client Runtime session. */
18
+ export type ClientRemoteObjectHandle = InspectorId<'ClientRemoteObjectHandle'>;
19
+ //# sourceMappingURL=ids.d.ts.map