autotel-devtools 21.0.1 → 23.0.0

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 (46) hide show
  1. package/README.md +183 -28
  2. package/dist/cli.cjs +80 -13
  3. package/dist/cli.js +80 -13
  4. package/dist/compile-JDFHUCo5.d.cts +177 -0
  5. package/dist/compile-JDFHUCo5.d.ts +177 -0
  6. package/dist/{error-aggregator-D8VKciLY.d.ts → error-aggregator-B52JI8jL.d.ts} +1 -1
  7. package/dist/{error-aggregator-DCEKMOm3.d.cts → error-aggregator-DSwUvgFF.d.cts} +1 -1
  8. package/dist/exporter-BrEcnzoT.d.ts +546 -0
  9. package/dist/exporter-C4uKgo7l.d.cts +546 -0
  10. package/dist/fullpage.global.js +39 -0
  11. package/dist/grpc-CSWjMRiB.cjs +82 -0
  12. package/dist/grpc-CZEDUYCM.js +77 -0
  13. package/dist/http-Cqm_MAtc.cjs +3942 -0
  14. package/dist/http-Dbd9TIYU.js +3776 -0
  15. package/dist/index.cjs +25 -7
  16. package/dist/index.d.cts +30 -3
  17. package/dist/index.d.ts +30 -3
  18. package/dist/index.js +25 -7
  19. package/dist/{listen-DBfsfcdd.js → listen-D-lLgfro.js} +5 -2
  20. package/dist/{listen-CEJ3nYJf.cjs → listen-l09RRHht.cjs} +5 -2
  21. package/dist/parse-BRlosZft.cjs +642 -0
  22. package/dist/parse-D_RmPPQs.js +612 -0
  23. package/dist/query/index.cjs +8 -0
  24. package/dist/query/index.d.cts +16 -0
  25. package/dist/query/index.d.ts +16 -0
  26. package/dist/query/index.js +3 -0
  27. package/dist/server/exporter.d.cts +1 -1
  28. package/dist/server/exporter.d.ts +1 -1
  29. package/dist/server/index.cjs +6 -2
  30. package/dist/server/index.d.cts +19 -6
  31. package/dist/server/index.d.ts +18 -5
  32. package/dist/server/index.js +3 -2
  33. package/dist/types-B0tjwFqj.d.cts +107 -0
  34. package/dist/types-DM8y4A9Z.d.ts +107 -0
  35. package/dist/widget.global.js +15 -23
  36. package/dist/wire/index.cjs +7 -0
  37. package/dist/wire/index.d.cts +26 -0
  38. package/dist/wire/index.d.ts +26 -0
  39. package/dist/wire/index.js +3 -0
  40. package/dist/wire-2Rmfg6IT.js +51 -0
  41. package/dist/wire-CHU1PkMo.cjs +75 -0
  42. package/package.json +22 -6
  43. package/dist/exporter-Dt4kx128.d.cts +0 -207
  44. package/dist/exporter-Due9Rd4s.d.ts +0 -207
  45. package/dist/http-CNZMrnzv.js +0 -1453
  46. package/dist/http-CXSzX4ee.cjs +0 -1607
@@ -0,0 +1,7 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_wire = require('../wire-CHU1PkMo.cjs');
3
+
4
+ exports.decodeTrace = require_wire.decodeTrace;
5
+ exports.decodeTraces = require_wire.decodeTraces;
6
+ exports.encodeTrace = require_wire.encodeTrace;
7
+ exports.encodeTraces = require_wire.encodeTraces;
@@ -0,0 +1,26 @@
1
+ import { a as SpanData, o as TraceData } from "../types-B0tjwFqj.cjs";
2
+ //#region src/wire/wire.d.ts
3
+ /** A span as sent: `endTime` present only when `duration` cannot reproduce it. */
4
+ type WireSpan = Omit<SpanData, 'endTime'> & {
5
+ endTime?: number;
6
+ };
7
+ /** A trace as sent. `rootSpan` stays whole; deduping it measured at 0%. */
8
+ type WireTrace = Omit<TraceData, 'endTime' | 'spans' | 'rootSpan'> & {
9
+ endTime?: number;
10
+ spans: WireSpan[];
11
+ rootSpan: WireSpan;
12
+ };
13
+ declare function encodeTrace(trace: TraceData): WireTrace;
14
+ /**
15
+ * Rebuild a trace from the wire.
16
+ *
17
+ * Defensive about `spans` and `rootSpan` because this is a trust boundary: it
18
+ * parses whatever answered on the port, and a decode that throws would blank
19
+ * the list rather than showing one odd trace. The encoder above always writes
20
+ * both.
21
+ */
22
+ declare function decodeTrace(wire: WireTrace): TraceData;
23
+ declare const encodeTraces: (traces: TraceData[]) => WireTrace[];
24
+ declare const decodeTraces: (wire: WireTrace[]) => TraceData[];
25
+ //#endregion
26
+ export { type WireSpan, type WireTrace, decodeTrace, decodeTraces, encodeTrace, encodeTraces };
@@ -0,0 +1,26 @@
1
+ import { a as SpanData, o as TraceData } from "../types-DM8y4A9Z.js";
2
+ //#region src/wire/wire.d.ts
3
+ /** A span as sent: `endTime` present only when `duration` cannot reproduce it. */
4
+ type WireSpan = Omit<SpanData, 'endTime'> & {
5
+ endTime?: number;
6
+ };
7
+ /** A trace as sent. `rootSpan` stays whole; deduping it measured at 0%. */
8
+ type WireTrace = Omit<TraceData, 'endTime' | 'spans' | 'rootSpan'> & {
9
+ endTime?: number;
10
+ spans: WireSpan[];
11
+ rootSpan: WireSpan;
12
+ };
13
+ declare function encodeTrace(trace: TraceData): WireTrace;
14
+ /**
15
+ * Rebuild a trace from the wire.
16
+ *
17
+ * Defensive about `spans` and `rootSpan` because this is a trust boundary: it
18
+ * parses whatever answered on the port, and a decode that throws would blank
19
+ * the list rather than showing one odd trace. The encoder above always writes
20
+ * both.
21
+ */
22
+ declare function decodeTrace(wire: WireTrace): TraceData;
23
+ declare const encodeTraces: (traces: TraceData[]) => WireTrace[];
24
+ declare const decodeTraces: (wire: WireTrace[]) => TraceData[];
25
+ //#endregion
26
+ export { type WireSpan, type WireTrace, decodeTrace, decodeTraces, encodeTrace, encodeTraces };
@@ -0,0 +1,3 @@
1
+ import { i as encodeTraces, n as decodeTraces, r as encodeTrace, t as decodeTrace } from "../wire-2Rmfg6IT.js";
2
+
3
+ export { decodeTrace, decodeTraces, encodeTrace, encodeTraces };
@@ -0,0 +1,51 @@
1
+ //#region src/wire/wire.ts
2
+ /**
3
+ * Drop an end time the start and duration already imply.
4
+ *
5
+ * Ingest always sets `duration` to `endTime - startTime`, so in practice this
6
+ * drops every one. It is written as a condition rather than an assumption
7
+ * because an embedder calling `ingestTraces` directly is bound by no such
8
+ * invariant, and a silently wrong `endTime` draws a waterfall bar of the wrong
9
+ * width rather than failing.
10
+ */
11
+ function encodeTimes(value) {
12
+ const { endTime, ...rest } = value;
13
+ return endTime === value.startTime + value.duration ? rest : {
14
+ ...rest,
15
+ endTime
16
+ };
17
+ }
18
+ function decodeTimes(value) {
19
+ return {
20
+ ...value,
21
+ endTime: value.endTime ?? (value.startTime ?? 0) + (value.duration ?? 0)
22
+ };
23
+ }
24
+ function encodeTrace(trace) {
25
+ return {
26
+ ...encodeTimes(trace),
27
+ rootSpan: encodeTimes(trace.rootSpan),
28
+ spans: trace.spans.map(encodeTimes)
29
+ };
30
+ }
31
+ /**
32
+ * Rebuild a trace from the wire.
33
+ *
34
+ * Defensive about `spans` and `rootSpan` because this is a trust boundary: it
35
+ * parses whatever answered on the port, and a decode that throws would blank
36
+ * the list rather than showing one odd trace. The encoder above always writes
37
+ * both.
38
+ */
39
+ function decodeTrace(wire) {
40
+ const spans = Array.isArray(wire.spans) ? wire.spans.map(decodeTimes) : [];
41
+ return {
42
+ ...decodeTimes(wire),
43
+ rootSpan: wire.rootSpan ? decodeTimes(wire.rootSpan) : spans[0],
44
+ spans
45
+ };
46
+ }
47
+ const encodeTraces = (traces) => traces.map(encodeTrace);
48
+ const decodeTraces = (wire) => wire.map(decodeTrace);
49
+
50
+ //#endregion
51
+ export { encodeTraces as i, decodeTraces as n, encodeTrace as r, decodeTrace as t };
@@ -0,0 +1,75 @@
1
+
2
+ //#region src/wire/wire.ts
3
+ /**
4
+ * Drop an end time the start and duration already imply.
5
+ *
6
+ * Ingest always sets `duration` to `endTime - startTime`, so in practice this
7
+ * drops every one. It is written as a condition rather than an assumption
8
+ * because an embedder calling `ingestTraces` directly is bound by no such
9
+ * invariant, and a silently wrong `endTime` draws a waterfall bar of the wrong
10
+ * width rather than failing.
11
+ */
12
+ function encodeTimes(value) {
13
+ const { endTime, ...rest } = value;
14
+ return endTime === value.startTime + value.duration ? rest : {
15
+ ...rest,
16
+ endTime
17
+ };
18
+ }
19
+ function decodeTimes(value) {
20
+ return {
21
+ ...value,
22
+ endTime: value.endTime ?? (value.startTime ?? 0) + (value.duration ?? 0)
23
+ };
24
+ }
25
+ function encodeTrace(trace) {
26
+ return {
27
+ ...encodeTimes(trace),
28
+ rootSpan: encodeTimes(trace.rootSpan),
29
+ spans: trace.spans.map(encodeTimes)
30
+ };
31
+ }
32
+ /**
33
+ * Rebuild a trace from the wire.
34
+ *
35
+ * Defensive about `spans` and `rootSpan` because this is a trust boundary: it
36
+ * parses whatever answered on the port, and a decode that throws would blank
37
+ * the list rather than showing one odd trace. The encoder above always writes
38
+ * both.
39
+ */
40
+ function decodeTrace(wire) {
41
+ const spans = Array.isArray(wire.spans) ? wire.spans.map(decodeTimes) : [];
42
+ return {
43
+ ...decodeTimes(wire),
44
+ rootSpan: wire.rootSpan ? decodeTimes(wire.rootSpan) : spans[0],
45
+ spans
46
+ };
47
+ }
48
+ const encodeTraces = (traces) => traces.map(encodeTrace);
49
+ const decodeTraces = (wire) => wire.map(decodeTrace);
50
+
51
+ //#endregion
52
+ Object.defineProperty(exports, 'decodeTrace', {
53
+ enumerable: true,
54
+ get: function () {
55
+ return decodeTrace;
56
+ }
57
+ });
58
+ Object.defineProperty(exports, 'decodeTraces', {
59
+ enumerable: true,
60
+ get: function () {
61
+ return decodeTraces;
62
+ }
63
+ });
64
+ Object.defineProperty(exports, 'encodeTrace', {
65
+ enumerable: true,
66
+ get: function () {
67
+ return encodeTrace;
68
+ }
69
+ });
70
+ Object.defineProperty(exports, 'encodeTraces', {
71
+ enumerable: true,
72
+ get: function () {
73
+ return encodeTraces;
74
+ }
75
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autotel-devtools",
3
- "version": "21.0.1",
3
+ "version": "23.0.0",
4
4
  "description": "Standalone OTLP receiver with web UI for local development",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -27,6 +27,16 @@
27
27
  "types": "./dist/genai/index.d.ts",
28
28
  "import": "./dist/genai/index.js",
29
29
  "require": "./dist/genai/index.cjs"
30
+ },
31
+ "./query": {
32
+ "types": "./dist/query/index.d.ts",
33
+ "import": "./dist/query/index.js",
34
+ "require": "./dist/query/index.cjs"
35
+ },
36
+ "./wire": {
37
+ "types": "./dist/wire/index.d.ts",
38
+ "import": "./dist/wire/index.js",
39
+ "require": "./dist/wire/index.cjs"
30
40
  }
31
41
  },
32
42
  "main": "./dist/index.js",
@@ -47,13 +57,17 @@
47
57
  "widget"
48
58
  ],
49
59
  "dependencies": {
50
- "clsx": "^2.1.1",
60
+ "@grpc/grpc-js": "^1.14.4",
51
61
  "@lucide/svelte": "^1.27.0",
62
+ "bits-ui": "2.19.0",
63
+ "clsx": "^2.1.1",
64
+ "d3-scale": "4.0.2",
65
+ "d3-shape": "3.2.0",
52
66
  "protobufjs": "^8.7.1",
53
67
  "svelte": "^5.56.8",
54
68
  "tailwind-merge": "^3.6.0",
55
69
  "ws": "^8.21.1",
56
- "autotel-agents": "0.3.1"
70
+ "autotel-agents": "0.4.0"
57
71
  },
58
72
  "devDependencies": {
59
73
  "@chromatic-com/storybook": "^5.2.1",
@@ -70,6 +84,8 @@
70
84
  "@tailwindcss/vite": "^4.3.3",
71
85
  "@testing-library/jest-dom": "^7.0.0",
72
86
  "@testing-library/svelte": "^5.4.2",
87
+ "@types/d3-scale": "4.0.9",
88
+ "@types/d3-shape": "3.1.8",
73
89
  "@types/node": "^26.1.2",
74
90
  "@types/ws": "^8.18.1",
75
91
  "@vitest/browser-playwright": "4.1.10",
@@ -90,7 +106,7 @@
90
106
  "vitest-mock-extended": "^5.1.0"
91
107
  },
92
108
  "peerDependencies": {
93
- "autotel": "7.0.1"
109
+ "autotel": "7.2.0"
94
110
  },
95
111
  "peerDependenciesMeta": {
96
112
  "autotel": {
@@ -104,14 +120,14 @@
104
120
  },
105
121
  "license": "Apache-2.0",
106
122
  "scripts": {
107
- "build": "tsdown && vite build --config vite.widget.config.ts",
123
+ "build": "tsdown && vite build --config vite.widget.config.ts && FULLPAGE=1 vite build --config vite.widget.config.ts",
108
124
  "dev": "tsdown --watch",
109
125
  "type-check": "svelte-check --tsconfig ./tsconfig.json && tsc --noEmit",
110
126
  "lint": "eslint src/",
111
127
  "test": "vitest run --config vitest.config.ts --project server && vitest run --config vitest.config.ts --project widget && vitest run --config vitest.storybook.config.ts",
112
128
  "test:storybook": "vitest run --config vitest.storybook.config.ts",
113
129
  "test:watch": "vitest --config vitest.config.ts",
114
- "test:dist": "node scripts/check-dist-esm.mjs",
130
+ "test:dist": "node scripts/check-dist-esm.mjs && node scripts/check-widget-size.mjs",
115
131
  "storybook": "storybook dev -p 6006",
116
132
  "build-storybook": "storybook build"
117
133
  }
@@ -1,207 +0,0 @@
1
- import { n as SpanAttributes } from "./types-DHDvZnnn.cjs";
2
- import { Server } from "node:http";
3
- import { AgentRawEvent, AgentSession, OtelMetricRecord } from "autotel-agents";
4
- import { ReadableSpan, SpanExporter } from "@opentelemetry/sdk-trace-base";
5
- import { ExportResult } from "@opentelemetry/core";
6
- //#region src/server/types.d.ts
7
- interface SpanData {
8
- traceId: string;
9
- spanId: string;
10
- parentSpanId?: string;
11
- name: string;
12
- kind: 'INTERNAL' | 'SERVER' | 'CLIENT' | 'PRODUCER' | 'CONSUMER';
13
- startTime: number;
14
- endTime: number;
15
- duration: number;
16
- attributes: SpanAttributes;
17
- status: {
18
- code: 'OK' | 'ERROR' | 'UNSET';
19
- message?: string;
20
- };
21
- events?: Array<{
22
- name: string;
23
- timestamp: number;
24
- attributes?: SpanAttributes;
25
- }>;
26
- links?: Array<{
27
- traceId: string;
28
- spanId: string;
29
- attributes?: SpanAttributes;
30
- }>;
31
- scope?: {
32
- name?: string;
33
- version?: string;
34
- };
35
- }
36
- interface TraceData {
37
- traceId: string;
38
- correlationId: string;
39
- rootSpan: SpanData;
40
- spans: SpanData[];
41
- startTime: number;
42
- endTime: number;
43
- duration: number;
44
- status: 'OK' | 'ERROR' | 'UNSET';
45
- service: string;
46
- /**
47
- * True when no span in this trace is a true root: every span received has a
48
- * parent that did not arrive. The trace is a fragment, normally because
49
- * sampling kept only part of it or because the rest is still in flight.
50
- * `rootSpan` is then the earliest span whose parent is absent rather than the
51
- * real root, and the duration covers only the part present. Recomputed as
52
- * spans merge, so it clears once the real root arrives.
53
- */
54
- partial?: boolean;
55
- }
56
- interface LogData {
57
- id: string;
58
- traceId?: string;
59
- spanId?: string;
60
- resourceName?: string;
61
- severityText?: string;
62
- severityNumber?: number;
63
- body: string | Record<string, unknown>;
64
- timestamp: number;
65
- attributes?: SpanAttributes;
66
- resource?: Record<string, unknown>;
67
- }
68
- interface MetricData {
69
- type: 'event' | 'funnel' | 'outcome' | 'value';
70
- name: string;
71
- value?: number;
72
- attributes: SpanAttributes;
73
- timestamp: number;
74
- traceId?: string;
75
- }
76
- interface ErrorGroup {
77
- fingerprint: string;
78
- type: string;
79
- message: string;
80
- stackTrace?: string;
81
- count: number;
82
- firstSeen: number;
83
- lastSeen: number;
84
- affectedTraces: string[];
85
- affectedSpans: string[];
86
- service?: string;
87
- attributes?: SpanAttributes;
88
- }
89
- interface ErrorOccurrence {
90
- traceId: string;
91
- spanId: string;
92
- spanName: string;
93
- service: string;
94
- timestamp: number;
95
- error: {
96
- type: string;
97
- message: string;
98
- stackTrace?: string;
99
- /**
100
- * Grouping key the emitting SDK already decided on (`exception.fingerprint`,
101
- * written by autotel's `exceptionFingerprint()` enricher). When present the
102
- * aggregator groups by it instead of re-deriving one from the stack string,
103
- * so this tab agrees with every other backend receiving the same spans.
104
- */
105
- fingerprint?: string;
106
- };
107
- attributes?: SpanAttributes;
108
- }
109
- interface DevtoolsData {
110
- traces: TraceData[];
111
- metrics: MetricData[];
112
- logs: LogData[];
113
- errors: ErrorGroup[];
114
- /** Full-state on every broadcast (client replaces, like `errors`). Coding-agent
115
- * sessions reconstructed from agent metrics + log events. */
116
- agents?: AgentSession[];
117
- }
118
- //#endregion
119
- //#region src/server/server.d.ts
120
- interface DevtoolsServerOptions {
121
- port?: number;
122
- server?: Server;
123
- path?: string;
124
- verbose?: boolean;
125
- maxHistory?: number;
126
- maxTraceCount?: number;
127
- maxLogCount?: number;
128
- maxMetricCount?: number;
129
- /**
130
- * Bind host, used only to decide the WebSocket origin policy. A loopback host
131
- * (the default) enables the DNS-rebinding `Host` check on the live stream; an
132
- * explicit non-loopback bind opts out, leaving just the cross-origin check.
133
- */
134
- host?: string;
135
- /**
136
- * Called after each ingest, with the incremental data just broadcast to WS
137
- * clients. Lets an embedder (e.g. the VS Code extension) react to new
138
- * telemetry — refresh its own tree views — while the server owns the buffer.
139
- */
140
- onData?: (incremental: DevtoolsData) => void;
141
- }
142
- declare class DevtoolsServer {
143
- private wss;
144
- private clients;
145
- private httpServer;
146
- private traces;
147
- private logs;
148
- private metrics;
149
- private agentSessions;
150
- private errorAggregator;
151
- private limits;
152
- private verbose;
153
- private _port;
154
- private onData?;
155
- constructor(options?: DevtoolsServerOptions);
156
- get port(): number;
157
- get clientCount(): number;
158
- addTrace(trace: TraceData): void;
159
- addTraces(traces: TraceData[]): void;
160
- addLog(log: LogData): void;
161
- addLogs(logs: LogData[]): void;
162
- addMetric(metric: MetricData): void;
163
- /** Fold decoded agent log events into sessions and broadcast the full set. */
164
- ingestAgentEvents(records: AgentRawEvent[]): void;
165
- /** Fold decoded agent metric records into sessions and broadcast the full set. */
166
- ingestAgentMetrics(records: OtelMetricRecord[]): void;
167
- private broadcastAgents;
168
- getCurrentData(): DevtoolsData;
169
- clearData(): void;
170
- private broadcast;
171
- private log;
172
- close(): Promise<void>;
173
- }
174
- //#endregion
175
- //#region src/server/exporter.d.ts
176
- declare class DevtoolsSpanExporter implements SpanExporter {
177
- private server;
178
- private serviceName;
179
- constructor(server: DevtoolsServer, serviceName?: string);
180
- /**
181
- * Export spans to the WebSocket server
182
- */
183
- export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): Promise<void>;
184
- /**
185
- * Shutdown the exporter
186
- */
187
- shutdown(): Promise<void>;
188
- /**
189
- * Force flush any buffered spans
190
- */
191
- forceFlush(): Promise<void>;
192
- /**
193
- * Convert OpenTelemetry spans to TraceData
194
- */
195
- private convertToTraceData;
196
- /**
197
- * Convert OpenTelemetry span to SpanData
198
- */
199
- private convertSpan;
200
- private convertScope;
201
- /**
202
- * Convert OpenTelemetry SpanKind to string
203
- */
204
- private convertSpanKind;
205
- }
206
- //#endregion
207
- export { ErrorGroup as a, MetricData as c, DevtoolsData as i, SpanData as l, DevtoolsServer as n, ErrorOccurrence as o, DevtoolsServerOptions as r, LogData as s, DevtoolsSpanExporter as t, TraceData as u };
@@ -1,207 +0,0 @@
1
- import { n as SpanAttributes } from "./types-DHDvZnnn.js";
2
- import { Server } from "node:http";
3
- import { AgentRawEvent, AgentSession, OtelMetricRecord } from "autotel-agents";
4
- import { ExportResult } from "@opentelemetry/core";
5
- import { ReadableSpan, SpanExporter } from "@opentelemetry/sdk-trace-base";
6
- //#region src/server/types.d.ts
7
- interface SpanData {
8
- traceId: string;
9
- spanId: string;
10
- parentSpanId?: string;
11
- name: string;
12
- kind: 'INTERNAL' | 'SERVER' | 'CLIENT' | 'PRODUCER' | 'CONSUMER';
13
- startTime: number;
14
- endTime: number;
15
- duration: number;
16
- attributes: SpanAttributes;
17
- status: {
18
- code: 'OK' | 'ERROR' | 'UNSET';
19
- message?: string;
20
- };
21
- events?: Array<{
22
- name: string;
23
- timestamp: number;
24
- attributes?: SpanAttributes;
25
- }>;
26
- links?: Array<{
27
- traceId: string;
28
- spanId: string;
29
- attributes?: SpanAttributes;
30
- }>;
31
- scope?: {
32
- name?: string;
33
- version?: string;
34
- };
35
- }
36
- interface TraceData {
37
- traceId: string;
38
- correlationId: string;
39
- rootSpan: SpanData;
40
- spans: SpanData[];
41
- startTime: number;
42
- endTime: number;
43
- duration: number;
44
- status: 'OK' | 'ERROR' | 'UNSET';
45
- service: string;
46
- /**
47
- * True when no span in this trace is a true root: every span received has a
48
- * parent that did not arrive. The trace is a fragment, normally because
49
- * sampling kept only part of it or because the rest is still in flight.
50
- * `rootSpan` is then the earliest span whose parent is absent rather than the
51
- * real root, and the duration covers only the part present. Recomputed as
52
- * spans merge, so it clears once the real root arrives.
53
- */
54
- partial?: boolean;
55
- }
56
- interface LogData {
57
- id: string;
58
- traceId?: string;
59
- spanId?: string;
60
- resourceName?: string;
61
- severityText?: string;
62
- severityNumber?: number;
63
- body: string | Record<string, unknown>;
64
- timestamp: number;
65
- attributes?: SpanAttributes;
66
- resource?: Record<string, unknown>;
67
- }
68
- interface MetricData {
69
- type: 'event' | 'funnel' | 'outcome' | 'value';
70
- name: string;
71
- value?: number;
72
- attributes: SpanAttributes;
73
- timestamp: number;
74
- traceId?: string;
75
- }
76
- interface ErrorGroup {
77
- fingerprint: string;
78
- type: string;
79
- message: string;
80
- stackTrace?: string;
81
- count: number;
82
- firstSeen: number;
83
- lastSeen: number;
84
- affectedTraces: string[];
85
- affectedSpans: string[];
86
- service?: string;
87
- attributes?: SpanAttributes;
88
- }
89
- interface ErrorOccurrence {
90
- traceId: string;
91
- spanId: string;
92
- spanName: string;
93
- service: string;
94
- timestamp: number;
95
- error: {
96
- type: string;
97
- message: string;
98
- stackTrace?: string;
99
- /**
100
- * Grouping key the emitting SDK already decided on (`exception.fingerprint`,
101
- * written by autotel's `exceptionFingerprint()` enricher). When present the
102
- * aggregator groups by it instead of re-deriving one from the stack string,
103
- * so this tab agrees with every other backend receiving the same spans.
104
- */
105
- fingerprint?: string;
106
- };
107
- attributes?: SpanAttributes;
108
- }
109
- interface DevtoolsData {
110
- traces: TraceData[];
111
- metrics: MetricData[];
112
- logs: LogData[];
113
- errors: ErrorGroup[];
114
- /** Full-state on every broadcast (client replaces, like `errors`). Coding-agent
115
- * sessions reconstructed from agent metrics + log events. */
116
- agents?: AgentSession[];
117
- }
118
- //#endregion
119
- //#region src/server/server.d.ts
120
- interface DevtoolsServerOptions {
121
- port?: number;
122
- server?: Server;
123
- path?: string;
124
- verbose?: boolean;
125
- maxHistory?: number;
126
- maxTraceCount?: number;
127
- maxLogCount?: number;
128
- maxMetricCount?: number;
129
- /**
130
- * Bind host, used only to decide the WebSocket origin policy. A loopback host
131
- * (the default) enables the DNS-rebinding `Host` check on the live stream; an
132
- * explicit non-loopback bind opts out, leaving just the cross-origin check.
133
- */
134
- host?: string;
135
- /**
136
- * Called after each ingest, with the incremental data just broadcast to WS
137
- * clients. Lets an embedder (e.g. the VS Code extension) react to new
138
- * telemetry — refresh its own tree views — while the server owns the buffer.
139
- */
140
- onData?: (incremental: DevtoolsData) => void;
141
- }
142
- declare class DevtoolsServer {
143
- private wss;
144
- private clients;
145
- private httpServer;
146
- private traces;
147
- private logs;
148
- private metrics;
149
- private agentSessions;
150
- private errorAggregator;
151
- private limits;
152
- private verbose;
153
- private _port;
154
- private onData?;
155
- constructor(options?: DevtoolsServerOptions);
156
- get port(): number;
157
- get clientCount(): number;
158
- addTrace(trace: TraceData): void;
159
- addTraces(traces: TraceData[]): void;
160
- addLog(log: LogData): void;
161
- addLogs(logs: LogData[]): void;
162
- addMetric(metric: MetricData): void;
163
- /** Fold decoded agent log events into sessions and broadcast the full set. */
164
- ingestAgentEvents(records: AgentRawEvent[]): void;
165
- /** Fold decoded agent metric records into sessions and broadcast the full set. */
166
- ingestAgentMetrics(records: OtelMetricRecord[]): void;
167
- private broadcastAgents;
168
- getCurrentData(): DevtoolsData;
169
- clearData(): void;
170
- private broadcast;
171
- private log;
172
- close(): Promise<void>;
173
- }
174
- //#endregion
175
- //#region src/server/exporter.d.ts
176
- declare class DevtoolsSpanExporter implements SpanExporter {
177
- private server;
178
- private serviceName;
179
- constructor(server: DevtoolsServer, serviceName?: string);
180
- /**
181
- * Export spans to the WebSocket server
182
- */
183
- export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): Promise<void>;
184
- /**
185
- * Shutdown the exporter
186
- */
187
- shutdown(): Promise<void>;
188
- /**
189
- * Force flush any buffered spans
190
- */
191
- forceFlush(): Promise<void>;
192
- /**
193
- * Convert OpenTelemetry spans to TraceData
194
- */
195
- private convertToTraceData;
196
- /**
197
- * Convert OpenTelemetry span to SpanData
198
- */
199
- private convertSpan;
200
- private convertScope;
201
- /**
202
- * Convert OpenTelemetry SpanKind to string
203
- */
204
- private convertSpanKind;
205
- }
206
- //#endregion
207
- export { ErrorGroup as a, MetricData as c, DevtoolsData as i, SpanData as l, DevtoolsServer as n, ErrorOccurrence as o, DevtoolsServerOptions as r, LogData as s, DevtoolsSpanExporter as t, TraceData as u };