@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,18 @@
1
+ /** Realm-neutral script metadata used by source backends. */
2
+ import type { RuntimeScriptKey } from './ids.ts';
3
+ /** One script visible in a realm's source catalog. */
4
+ export interface RuntimeScript {
5
+ readonly scriptKey: RuntimeScriptKey;
6
+ readonly url: string;
7
+ readonly hash: string;
8
+ readonly buildId?: string;
9
+ readonly sourceMapUrl?: string;
10
+ readonly startLine: number;
11
+ readonly startColumn: number;
12
+ readonly endLine: number;
13
+ readonly endColumn: number;
14
+ readonly executionContextId?: number;
15
+ readonly isModule?: boolean;
16
+ readonly length?: number;
17
+ }
18
+ //# sourceMappingURL=sources.d.ts.map
@@ -0,0 +1,26 @@
1
+ /** Shared Host/Client projection from live Cordis objects to a bounded semantic tree. */
2
+ import { Context } from '@deepseek-ai/cordis';
3
+ import { type CordisTreeSnapshot } from './snapshot.ts';
4
+ import { RealmObjectRegistry } from './object-registry.ts';
5
+ /** Bounds applied before one snapshot enters a source frame. */
6
+ export interface CordisTreeLimits {
7
+ readonly maxNodes: number;
8
+ readonly maxBytes: number;
9
+ }
10
+ /** Realm-local collector with a current live-object table. */
11
+ export declare class CordisTreeCollector {
12
+ private readonly root;
13
+ private readonly limits;
14
+ /** Live-object table replaced atomically with each emitted snapshot. */
15
+ readonly objects: RealmObjectRegistry;
16
+ private revision;
17
+ constructor(root: Context, limits: CordisTreeLimits);
18
+ /**
19
+ * Capture the current reachable Context/Fiber tree.
20
+ * @returns A detached JSON snapshot whose retained objects replace the prior generation atomically.
21
+ */
22
+ snapshot(): CordisTreeSnapshot;
23
+ /** Release the realm-global resolver and every retained object. */
24
+ close(): void;
25
+ }
26
+ //# sourceMappingURL=collector.d.ts.map
@@ -0,0 +1,7 @@
1
+ /** Opaque identifiers owned by a realm-local Cordis object registry. */
2
+ import type { InspectorId } from '../identity.ts';
3
+ /** Identity of one realm-local table that retains objects named in a snapshot. */
4
+ export type InspectorObjectRegistryId = InspectorId<'InspectorObjectRegistryId'>;
5
+ /** Opaque reference to one object retained by a realm-local registry. */
6
+ export type InspectorObjectHandle = InspectorId<'InspectorObjectHandle'>;
7
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1,61 @@
1
+ /** Consumer-neutral Cordis runtime tree shared by non-CDP readers. */
2
+ import { type InspectorId } from '../identity.ts';
3
+ /** Current consumer-neutral Cordis tree version. */
4
+ export declare const CORDIS_RUNTIME_TREE_SCHEMA_VERSION: 0;
5
+ /** Consumer-visible identity of one inspected Cordis runtime. */
6
+ export type CordisRuntimeSourceId = InspectorId<'CordisRuntimeSourceId'>;
7
+ /** Execution environment represented by one consumer-visible Cordis runtime. */
8
+ export type CordisRuntimeSourceKind = 'host' | 'client';
9
+ /** Availability of the realm represented by a retained tree. */
10
+ export type CordisRuntimeConnection = {
11
+ readonly state: 'connected';
12
+ } | {
13
+ readonly state: 'disconnected';
14
+ readonly reason: string;
15
+ };
16
+ /** Consumer-visible identity of one Cordis realm. */
17
+ export interface CordisRuntimeSource {
18
+ readonly sourceId: CordisRuntimeSourceId;
19
+ readonly kind: CordisRuntimeSourceKind;
20
+ readonly label: string;
21
+ }
22
+ /** One Context in a consumer-neutral Cordis tree. */
23
+ export interface CordisRuntimeContext {
24
+ readonly kind: 'context';
25
+ readonly children: readonly CordisRuntimeNode[];
26
+ }
27
+ /** One Fiber and its owned Context in a consumer-neutral Cordis tree. */
28
+ export interface CordisRuntimeFiber {
29
+ readonly kind: 'fiber';
30
+ readonly uid: number;
31
+ readonly children: readonly [CordisRuntimeContext];
32
+ }
33
+ /** One semantic Cordis runtime node. */
34
+ export type CordisRuntimeNode = CordisRuntimeContext | CordisRuntimeFiber;
35
+ /** Latest retained topology and availability of one Cordis realm. */
36
+ export interface CordisRuntimeRealm {
37
+ readonly source: CordisRuntimeSource;
38
+ readonly connection: CordisRuntimeConnection;
39
+ readonly revision: number;
40
+ readonly truncated: boolean;
41
+ readonly root: CordisRuntimeContext;
42
+ }
43
+ /** Latest Host and Client Cordis topology without routing or CDP identifiers. */
44
+ export interface CordisRuntimeTree {
45
+ readonly schemaVersion: typeof CORDIS_RUNTIME_TREE_SCHEMA_VERSION;
46
+ readonly host: CordisRuntimeRealm | null;
47
+ readonly clients: readonly CordisRuntimeRealm[];
48
+ }
49
+ /**
50
+ * Decode a consumer-neutral tree received across an Inspector transport.
51
+ * @param value - Untrusted query result value.
52
+ * @returns A detached tree containing only public semantic fields.
53
+ */
54
+ export declare function parseCordisRuntimeTree(value: unknown): CordisRuntimeTree;
55
+ /**
56
+ * Project an inspected source id into the consumer-visible Cordis identity namespace.
57
+ * @param value - Stable source id carried by the current runtime observation.
58
+ * @returns The corresponding Cordis runtime source id.
59
+ */
60
+ export declare function cordisRuntimeSourceId(value: string): CordisRuntimeSourceId;
61
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1,14 @@
1
+ /** Opaque references to live objects retained inside an observation source realm. */
2
+ import type { InspectorObjectHandle, InspectorObjectRegistryId } from './ids.ts';
3
+ /** Wire-safe identity of one live object; the source generation supplies the realm identity. */
4
+ export interface InspectorObjectReference {
5
+ readonly registryId: InspectorObjectRegistryId;
6
+ readonly handle: InspectorObjectHandle;
7
+ }
8
+ /**
9
+ * Decode one source-local live-object reference.
10
+ * @param value - Untrusted wire value.
11
+ * @returns The validated opaque reference.
12
+ */
13
+ export declare function parseInspectorObjectReference(value: unknown): InspectorObjectReference;
14
+ //# sourceMappingURL=object-reference.d.ts.map
@@ -0,0 +1,80 @@
1
+ /** Realm-local retention and identity for live objects referenced by Inspector snapshots. */
2
+ import { type InspectorObjectHandle } from './ids.ts';
3
+ import type { InspectorObjectReference } from './object-reference.ts';
4
+ /** Self-contained function sent through CDP to identify its `this` object in the inspected realm. */
5
+ export declare const IDENTIFY_REALM_OBJECT_FUNCTION: string;
6
+ /** One realm's bounded table of objects retained by its latest semantic snapshot. */
7
+ export declare class RealmObjectRegistry {
8
+ /** Realm-unique id carried by every reference from this registry. */
9
+ readonly id: import("../identity.ts").InspectorId<"InspectorObjectRegistryId">;
10
+ private readonly known;
11
+ private retained;
12
+ private nextHandle;
13
+ private disposed;
14
+ constructor();
15
+ /**
16
+ * Start one replacement generation.
17
+ * @returns A collector that atomically installs exactly the retained objects on commit.
18
+ */
19
+ begin(): RealmObjectGeneration;
20
+ /**
21
+ * Resolve one current opaque handle.
22
+ * @param handle - Handle from the latest committed snapshot.
23
+ * @returns The live object, when it remains retained.
24
+ */
25
+ resolve(handle: InspectorObjectHandle): object | undefined;
26
+ /**
27
+ * Identify one object retained by the latest snapshot. Cordis plugin calls may return nested thenable facades;
28
+ * only objects whose prototype path consists exclusively of those `then` wrappers resolve to the retained Fiber.
29
+ * @param value - Candidate live value.
30
+ * @returns Its wire reference, when present in this registry.
31
+ */
32
+ identify(value: unknown): InspectorObjectReference | undefined;
33
+ /** Remove this registry from the realm and release all strong references. */
34
+ close(): void;
35
+ /**
36
+ * Assign a stable handle and retain a value in one pending generation.
37
+ * @param value - Object represented by the pending snapshot.
38
+ * @param next - Pending generation's strong-reference table.
39
+ * @returns The registry id and stable object handle.
40
+ */
41
+ retain(value: object, next: Map<InspectorObjectHandle, object>): InspectorObjectReference;
42
+ /**
43
+ * Replace the current strong-reference set with one completed generation.
44
+ * @param next - Complete object table for the committed snapshot.
45
+ */
46
+ commit(next: Map<InspectorObjectHandle, object>): void;
47
+ }
48
+ /** Mutable object set assembled before one snapshot becomes visible. */
49
+ export declare class RealmObjectGeneration {
50
+ private readonly owner;
51
+ private readonly retained;
52
+ private committed;
53
+ constructor(owner: RealmObjectRegistry);
54
+ /**
55
+ * Retain one object and obtain its stable opaque reference.
56
+ * @param value - Context or Fiber represented in the snapshot.
57
+ * @returns Source-local wire reference.
58
+ */
59
+ retain(value: object): InspectorObjectReference;
60
+ /**
61
+ * Stop retaining an object omitted while bounding the pending snapshot.
62
+ * @param handle - Opaque handle removed from this pending generation.
63
+ */
64
+ release(handle: InspectorObjectHandle): void;
65
+ /** Atomically replace the registry's retained set. */
66
+ commit(): void;
67
+ }
68
+ /**
69
+ * Build an expression that resolves one reference inside its owning realm.
70
+ * @param reference - Validated source-local object reference.
71
+ * @returns Side-effect-free JavaScript expression for Runtime evaluation.
72
+ */
73
+ export declare function realmObjectExpression(reference: InspectorObjectReference): string;
74
+ /**
75
+ * Identify a retained object across all Inspector collectors in this realm.
76
+ * @param value - Runtime value returned to a debugger.
77
+ * @returns Its source-local reference, when the value is a visible entity.
78
+ */
79
+ export declare function identifyRealmObject(value: unknown): InspectorObjectReference | undefined;
80
+ //# sourceMappingURL=object-registry.d.ts.map
@@ -0,0 +1,15 @@
1
+ /** Lifecycle-driven Cordis tree publication shared by Host and Client plugin faces. */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ import type { CordisTreeSnapshot } from './snapshot.ts';
4
+ import { type CordisTreeLimits } from './collector.ts';
5
+ /** Receives one complete semantic snapshot after a coalesced Cordis mutation. */
6
+ export type CordisTreeSnapshotListener = (snapshot: CordisTreeSnapshot) => void;
7
+ /**
8
+ * Observe one Cordis realm and publish immutable tree replacements.
9
+ * @param ctx - Plugin context whose root is inspected and whose effects own listeners.
10
+ * @param listener - Consumer of complete snapshots in the inspected realm.
11
+ * @param limits - Snapshot node and encoded-byte limits.
12
+ * @returns A disposer that unregisters listeners and releases retained objects.
13
+ */
14
+ export declare function observeCordisTree(ctx: Context, listener: CordisTreeSnapshotListener, limits: CordisTreeLimits): () => void;
15
+ //# sourceMappingURL=observer.d.ts.map
@@ -0,0 +1,34 @@
1
+ /** Pure projection from routed Cordis snapshots to the consumer-neutral tree. */
2
+ import type { CordisTreeSnapshot } from './snapshot.ts';
3
+ import { type CordisRuntimeSourceKind, type CordisRuntimeTree } from './model.ts';
4
+ /** Whether a retained routed snapshot still has a live source generation. */
5
+ export type CordisTreeSourceConnection = {
6
+ readonly state: 'connected';
7
+ } | {
8
+ readonly state: 'disconnected';
9
+ readonly reason: string;
10
+ };
11
+ /** One source generation and its latest routed Cordis snapshot. */
12
+ export interface CordisTreeSource {
13
+ readonly sourceId: string;
14
+ readonly kind: CordisRuntimeSourceKind;
15
+ readonly label: string;
16
+ }
17
+ /** One source generation and its latest routed Cordis snapshot. */
18
+ export interface CordisTreeSourceSnapshot<Source extends CordisTreeSource = CordisTreeSource> {
19
+ readonly source: Source;
20
+ readonly snapshot: CordisTreeSnapshot;
21
+ readonly connection: CordisTreeSourceConnection;
22
+ }
23
+ /** Routed Host and Client snapshots before consumer-neutral projection. */
24
+ export interface CordisInspectionTree<Source extends CordisTreeSource = CordisTreeSource> {
25
+ readonly host: CordisTreeSourceSnapshot<Source> | null;
26
+ readonly clients: readonly CordisTreeSourceSnapshot<Source>[];
27
+ }
28
+ /**
29
+ * Strip transport and live-object routing fields from retained Cordis snapshots.
30
+ * @param tree - Worker-owned routed snapshots.
31
+ * @returns A detached semantic tree safe for non-CDP consumers.
32
+ */
33
+ export declare function projectCordisRuntimeTree<Source extends CordisTreeSource>(tree: CordisInspectionTree<Source>): CordisRuntimeTree;
34
+ //# sourceMappingURL=projector.d.ts.map
@@ -0,0 +1,13 @@
1
+ /** Shared Host/Client publication of browser-safe Cordis snapshots. */
2
+ import type { Context } from '@deepseek-ai/cordis';
3
+ import type { InspectorStatePublisher } from '../bridge/publisher.ts';
4
+ import type { CordisTreeLimits } from './collector.ts';
5
+ /**
6
+ * Observe one Cordis runtime and retain its latest source snapshot.
7
+ * @param ctx - Plugin context whose root is inspected.
8
+ * @param publisher - Active Host or Client source publisher.
9
+ * @param limits - Snapshot node and encoded-byte limits.
10
+ * @returns A disposer that stops observation and releases retained objects.
11
+ */
12
+ export declare function publishCordisTree(ctx: Context, publisher: InspectorStatePublisher, limits: CordisTreeLimits): () => void;
13
+ //# sourceMappingURL=publisher.d.ts.map
@@ -0,0 +1,18 @@
1
+ /** Environment-independent Cordis runtime tree reader. */
2
+ import type { CordisRuntimeTree } from './model.ts';
3
+ /** Read-only access to the latest committed consumer-neutral Cordis tree. */
4
+ export interface CordisRuntimeTreeReader {
5
+ /**
6
+ * Read the latest Worker snapshot without activating CDP domains.
7
+ * @returns A detached Host and Client Cordis tree.
8
+ * @throws When the source transport is unavailable, closes, times out, or rejects the query.
9
+ */
10
+ getTree(): Promise<CordisRuntimeTree>;
11
+ }
12
+ /**
13
+ * Create a reader around a local committed-tree projection.
14
+ * @param read - Synchronous or asynchronous latest-tree read.
15
+ * @returns A reader suitable for query and CDP adapters.
16
+ */
17
+ export declare function createCordisRuntimeTreeReader(read: () => CordisRuntimeTree | Promise<CordisRuntimeTree>): CordisRuntimeTreeReader;
18
+ //# sourceMappingURL=reader.d.ts.map
@@ -0,0 +1,39 @@
1
+ /** CDP-independent snapshot model for a Cordis Context and Fiber tree. */
2
+ import { type InspectorObjectHandle, type InspectorObjectRegistryId } from './ids.ts';
3
+ /** Current serialized Cordis tree model version. */
4
+ export declare const CORDIS_TREE_SCHEMA_VERSION: 0;
5
+ /** Maximum nesting accepted from one realm snapshot. */
6
+ export declare const CORDIS_TREE_MAX_DEPTH = 256;
7
+ interface CordisTreeNodeBase {
8
+ readonly objectHandle: InspectorObjectHandle;
9
+ }
10
+ /** One Context entity in a Cordis tree snapshot. */
11
+ export interface CordisContextTreeNode extends CordisTreeNodeBase {
12
+ readonly kind: 'context';
13
+ readonly children: readonly CordisTreeNode[];
14
+ }
15
+ /** One Fiber entity in a Cordis tree snapshot. */
16
+ export interface CordisFiberTreeNode extends CordisTreeNodeBase {
17
+ readonly kind: 'fiber';
18
+ readonly uid: number;
19
+ readonly children: readonly [CordisContextTreeNode];
20
+ }
21
+ /** One semantic entity node in preorder. */
22
+ export type CordisTreeNode = CordisContextTreeNode | CordisFiberTreeNode;
23
+ /** Immutable, serializable state of one realm's reachable Cordis tree. */
24
+ export interface CordisTreeSnapshot {
25
+ readonly schemaVersion: typeof CORDIS_TREE_SCHEMA_VERSION;
26
+ readonly revision: number;
27
+ readonly objectRegistryId: InspectorObjectRegistryId;
28
+ readonly root: CordisContextTreeNode;
29
+ readonly truncated: boolean;
30
+ }
31
+ /**
32
+ * Decode and validate one complete Cordis tree replacement.
33
+ * @param value - Untrusted observation payload.
34
+ * @param maxNodes - Maximum nodes admitted from one source.
35
+ * @returns A detached, validated snapshot.
36
+ */
37
+ export declare function parseCordisTreeSnapshot(value: unknown, maxNodes: number): CordisTreeSnapshot;
38
+ export {};
39
+ //# sourceMappingURL=snapshot.d.ts.map
@@ -0,0 +1,12 @@
1
+ /** Shared branded-identifier construction without assigning protocol ownership. */
2
+ import type { Branded } from '@deepseek-ai/dsh-brand';
3
+ /** String branded with one Inspector identity role. */
4
+ export type InspectorId<Role extends string> = Branded<Role>;
5
+ /**
6
+ * Validate and brand a non-empty identifier received from or sent across a runtime boundary.
7
+ * @param value - Untrusted identifier text.
8
+ * @param label - Field name used in validation errors.
9
+ * @returns The role-branded identifier.
10
+ */
11
+ export declare function inspectorId<Role extends string>(value: string, label: string): InspectorId<Role>;
12
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1,18 @@
1
+ /** Environment-independent Inspector models and bridge protocol exports. */
2
+ export * from './bridge/messages/control.ts';
3
+ export * from './bridge/control-codec.ts';
4
+ export * from './cordis/snapshot.ts';
5
+ export * from './bridge/messages/cordis.ts';
6
+ export * from './bridge/messages/runtime/index.ts';
7
+ export * from './bridge/messages/sources/index.ts';
8
+ export * from './bridge/messages/network.ts';
9
+ export * from './network/observation.ts';
10
+ export * from './bridge/ids.ts';
11
+ export * from './json.ts';
12
+ export * from './cordis/object-reference.ts';
13
+ export * from './bridge/messages/query/index.ts';
14
+ export * from './bridge/query-reader.ts';
15
+ export * from './bridge/rpc.ts';
16
+ export * from './cdp/index.ts';
17
+ export * from './bridge/messages/observation.ts';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,35 @@
1
+ /** JSON values admitted by every Inspector cross-realm message. */
2
+ /** JSON scalar accepted by Inspector transports. */
3
+ export type InspectorJsonPrimitive = null | boolean | number | string;
4
+ /** Recursively JSON-compatible value accepted by Inspector transports. */
5
+ export type InspectorJsonValue = InspectorJsonPrimitive | readonly InspectorJsonValue[] | InspectorJsonObject;
6
+ /** JSON-compatible object accepted by Inspector transports. */
7
+ export interface InspectorJsonObject {
8
+ readonly [key: string]: InspectorJsonValue;
9
+ }
10
+ /**
11
+ * Test that a value can cross both MessagePort and JSON WebSocket carriers without coercion.
12
+ * @param value - Candidate wire value.
13
+ * @returns Whether the value is lossless JSON data.
14
+ */
15
+ export declare function isJsonValue(value: unknown): value is InspectorJsonValue;
16
+ /**
17
+ * Require a plain JSON object and return it with a narrowed type.
18
+ * @param value - Candidate wire value.
19
+ * @param label - Field name used in validation errors.
20
+ * @returns The validated JSON object.
21
+ */
22
+ export declare function requireJsonObject(value: unknown, label: string): InspectorJsonObject;
23
+ /**
24
+ * Compute the UTF-8 byte length of a JSON wire value.
25
+ * @param value - Validated JSON value.
26
+ * @returns Its encoded byte length.
27
+ */
28
+ export declare function jsonByteLength(value: InspectorJsonValue): number;
29
+ /**
30
+ * Test whether a value is a plain object with string own keys.
31
+ * @param value - Candidate object.
32
+ * @returns Whether the value has `Object.prototype` or a null prototype.
33
+ */
34
+ export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
35
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1,20 @@
1
+ /** Incremental UTF-8 parser for Server-Sent Events carried by captured responses. */
2
+ import type { InspectorEventSourceMessage } from './observation.ts';
3
+ /** Parse response bytes into consumer-neutral Server-Sent Event messages. */
4
+ export declare class InspectorEventSourceParser {
5
+ private readonly decoder;
6
+ private line;
7
+ private eventName;
8
+ private eventId;
9
+ private data;
10
+ private afterCarriageReturn;
11
+ /**
12
+ * Consume one response-body chunk.
13
+ * @param bytes - Next bytes in response order.
14
+ * @returns Complete events terminated by an empty line in this chunk.
15
+ */
16
+ push(bytes: Uint8Array): readonly InspectorEventSourceMessage[];
17
+ private consume;
18
+ private parseLine;
19
+ }
20
+ //# sourceMappingURL=event-source.d.ts.map
@@ -0,0 +1,52 @@
1
+ /** Full-capture fetch observations sent to the Inspector Worker. */
2
+ /** One header entry; arrays retain duplicate header names. */
3
+ export type InspectorHeader = readonly [name: string, value: string];
4
+ /** Common request identity. */
5
+ export interface FetchIdentity {
6
+ readonly requestId: string;
7
+ }
8
+ /** A high-level global fetch call began. */
9
+ export interface FetchStartPayload extends FetchIdentity {
10
+ readonly url: string;
11
+ readonly method: string;
12
+ readonly headers: InspectorHeader[];
13
+ readonly hasBody: boolean;
14
+ readonly wallTimeMs: number;
15
+ }
16
+ /** One captured request-body chunk. */
17
+ export interface FetchBodyChunkPayload extends FetchIdentity {
18
+ readonly data: string;
19
+ }
20
+ /** Terminal state of one captured request body. */
21
+ export interface FetchRequestBodyEndPayload extends FetchIdentity {
22
+ readonly capturedBytes: number;
23
+ readonly truncated: boolean;
24
+ readonly captureError?: string;
25
+ }
26
+ /** Fetch resolved with response headers. */
27
+ export interface FetchResponsePayload extends FetchIdentity {
28
+ readonly url: string;
29
+ readonly status: number;
30
+ readonly statusText: string;
31
+ readonly headers: InspectorHeader[];
32
+ readonly mimeType: string;
33
+ }
34
+ /** One captured response-body chunk. */
35
+ /** Fetch capture reached a terminal response-body state. */
36
+ export interface FetchEndPayload extends FetchIdentity {
37
+ readonly capturedBytes: number;
38
+ readonly responseBodyTruncated: boolean;
39
+ readonly responseCaptureError?: string;
40
+ }
41
+ /** One parsed Server-Sent Event independent of its CDP projection. */
42
+ export interface InspectorEventSourceMessage {
43
+ readonly eventName: string;
44
+ readonly eventId: string;
45
+ readonly data: string;
46
+ }
47
+ /** Fetch rejected before returning a Response. */
48
+ export interface FetchErrorPayload extends FetchIdentity {
49
+ readonly message: string;
50
+ readonly canceled: boolean;
51
+ }
52
+ //# sourceMappingURL=observation.d.ts.map
@@ -0,0 +1,23 @@
1
+ /** Cordis service API shared by the Host and Client plugin faces. */
2
+ import type { CordisRuntimeTreeReader } from './cordis/reader.ts';
3
+ import type { InspectorJsonValue } from './json.ts';
4
+ import type { InspectorConnection } from './bridge/publisher.ts';
5
+ /** Shared Host/Client service façade over the realm's source publisher. */
6
+ export interface InspectorService {
7
+ /**
8
+ * Publish one JSON observation without waiting for Worker delivery.
9
+ * @param topic - Domain-owned topic name.
10
+ * @param payload - JSON value validated before it reaches the carrier.
11
+ * @param monotonicMs - Source-clock timestamp; defaults to `performance.now()`.
12
+ */
13
+ publish(topic: string, payload: InspectorJsonValue, monotonicMs?: number): void;
14
+ /** Read-only Cordis topology queries independent of CDP sessions. */
15
+ readonly cordis: CordisRuntimeTreeReader;
16
+ }
17
+ /**
18
+ * Create the shared service façade without exposing the carrier implementation.
19
+ * @param connection - Realm-local observation and query transport.
20
+ * @returns The Cordis service value.
21
+ */
22
+ export declare function createInspectorService(connection: InspectorConnection): InspectorService;
23
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1,52 @@
1
+ /** Shared exact-object readers for versioned Inspector wire protocols. */
2
+ import { type InspectorId } from './identity.ts';
3
+ /**
4
+ * Require a plain object containing only the listed fields.
5
+ * @param value - Candidate object.
6
+ * @param keys - Complete field allowlist.
7
+ * @param label - Object name used in validation errors.
8
+ * @returns The validated plain object.
9
+ */
10
+ export declare function exactObject(value: unknown, keys: readonly string[], label: string): Record<string, unknown>;
11
+ /**
12
+ * Reject fields outside one versioned object's declared field set.
13
+ * @param value - Plain object being validated.
14
+ * @param keys - Complete field allowlist.
15
+ * @param label - Object name used in validation errors.
16
+ */
17
+ export declare function exactKeys(value: Record<string, unknown>, keys: readonly string[], label: string): void;
18
+ /**
19
+ * Read one non-empty opaque identifier.
20
+ * @param value - Candidate identifier.
21
+ * @param label - Field name used in validation errors.
22
+ * @returns The role-branded identifier.
23
+ */
24
+ export declare function wireId<Role extends string>(value: unknown, label: string): InspectorId<Role>;
25
+ /**
26
+ * Read one optional string field.
27
+ * @param value - Object containing the field.
28
+ * @param key - Field name.
29
+ * @returns An empty object or the validated field.
30
+ */
31
+ export declare function optionalString<Key extends string>(value: Record<string, unknown>, key: Key): {
32
+ readonly [Property in Key]?: string;
33
+ };
34
+ /**
35
+ * Read one optional boolean field.
36
+ * @param value - Object containing the field.
37
+ * @param key - Field name.
38
+ * @returns An empty object or the validated field.
39
+ */
40
+ export declare function optionalBoolean<Key extends string>(value: Record<string, unknown>, key: Key): {
41
+ readonly [Property in Key]?: boolean;
42
+ };
43
+ /**
44
+ * Read one optional non-negative finite number field.
45
+ * @param value - Object containing the field.
46
+ * @param key - Field name.
47
+ * @returns An empty object or the validated field.
48
+ */
49
+ export declare function optionalNonNegativeNumber<Key extends string>(value: Record<string, unknown>, key: Key): {
50
+ readonly [Property in Key]?: number;
51
+ };
52
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1,49 @@
1
+ /** Worker-owned HTTP discovery, DevTools CDP, and Client-ingest endpoints. */
2
+ import type { InspectorWorkerConfig } from '../../shared/bridge/messages/control.ts';
3
+ import type { NetworkDomain } from '../cdp/domains/network/session.ts';
4
+ import type { CordisDomBackend } from '../cdp/domains/dom/index.ts';
5
+ import type { CordisRuntimeTreeReader } from '../../shared/cordis/reader.ts';
6
+ import type { InspectorQueryRouter } from '../inspection/query-router.ts';
7
+ import type { InspectorRealmRegistry } from '../inspection/realm-store.ts';
8
+ import type { InspectorSourceRegistry } from './hub.ts';
9
+ /** Bound endpoint information returned to the Host controller. */
10
+ export interface InspectorEndpointInfo {
11
+ readonly host: string;
12
+ readonly port: number;
13
+ readonly targetId: string;
14
+ }
15
+ /** Worker-owned network endpoint. */
16
+ export declare class InspectorEndpoint {
17
+ private readonly config;
18
+ private readonly sources;
19
+ private readonly network;
20
+ private readonly realms;
21
+ private readonly cordisDom;
22
+ private readonly cordisTrees;
23
+ private readonly queries;
24
+ private server;
25
+ private readonly cdpServer;
26
+ private readonly ingestServer;
27
+ private readonly cdpSessions;
28
+ private readonly ingestConnections;
29
+ constructor(config: InspectorWorkerConfig, sources: InspectorSourceRegistry, network: NetworkDomain, realms: InspectorRealmRegistry, cordisDom: CordisDomBackend, cordisTrees: CordisRuntimeTreeReader, queries: InspectorQueryRouter);
30
+ /**
31
+ * Bind the loopback endpoint.
32
+ * @returns The actual bound address and target id.
33
+ */
34
+ start(): Promise<InspectorEndpointInfo>;
35
+ /** Stop admission, dispose CDP sessions, terminate sockets, and await server close. */
36
+ close(): Promise<void>;
37
+ private handleHttp;
38
+ private handleUpgrade;
39
+ private acceptCdp;
40
+ private acceptIngest;
41
+ private authorizedClient;
42
+ private target;
43
+ private cdpUrl;
44
+ private boundPort;
45
+ private createServer;
46
+ private requireServer;
47
+ private json;
48
+ }
49
+ //# sourceMappingURL=endpoint.d.ts.map