effect-inspect 0.1.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 (38) hide show
  1. package/README.md +122 -0
  2. package/app/dist/client/assets/index-smV05cfr.js +25 -0
  3. package/app/dist/client/assets/rolldown-runtime-CbXtAM7H.js +1 -0
  4. package/app/dist/client/assets/routes-TKgeFdSW.js +5 -0
  5. package/app/dist/client/assets/styles-B3rAZGvS.css +2 -0
  6. package/app/dist/server/assets/_tanstack-start-manifest_v-Co953HeC.js +20 -0
  7. package/app/dist/server/assets/empty-plugin-adapters-D9UWiqvJ.js +5 -0
  8. package/app/dist/server/assets/router-CN98Ramo.js +491 -0
  9. package/app/dist/server/assets/routes-eZ4XqxE9.js +3999 -0
  10. package/app/dist/server/assets/start-5Z2QO8AU.js +4 -0
  11. package/app/dist/server/server.js +1812 -0
  12. package/dist/cli.d.ts +3 -0
  13. package/dist/cli.js +29 -0
  14. package/dist/client/Client.d.ts +52 -0
  15. package/dist/client/Client.js +224 -0
  16. package/dist/client/Edge.d.ts +31 -0
  17. package/dist/client/Edge.js +108 -0
  18. package/dist/client/Inspect.d.ts +49 -0
  19. package/dist/client/Inspect.js +55 -0
  20. package/dist/client/Tracer.d.ts +31 -0
  21. package/dist/client/Tracer.js +119 -0
  22. package/dist/collector/Config.d.ts +8 -0
  23. package/dist/collector/Config.js +9 -0
  24. package/dist/collector/Server.d.ts +24 -0
  25. package/dist/collector/Server.js +172 -0
  26. package/dist/collector/Store.d.ts +86 -0
  27. package/dist/collector/Store.js +119 -0
  28. package/dist/collector/WebApp.d.ts +3 -0
  29. package/dist/collector/WebApp.js +36 -0
  30. package/dist/collector/main.d.ts +1 -0
  31. package/dist/collector/main.js +22 -0
  32. package/dist/index.d.ts +3 -0
  33. package/dist/index.js +3 -0
  34. package/dist/protocol/Codec.d.ts +575 -0
  35. package/dist/protocol/Codec.js +50 -0
  36. package/dist/protocol/Schema.d.ts +1237 -0
  37. package/dist/protocol/Schema.js +327 -0
  38. package/package.json +85 -0
@@ -0,0 +1,1237 @@
1
+ /**
2
+ * The effect-inspect wire protocol.
3
+ *
4
+ * Three unions: {@link ClientMessage} (instrumented program → collector),
5
+ * {@link CollectorMessage} (collector → instrumented program) and
6
+ * {@link WebappMessage} (collector → webapp).
7
+ *
8
+ * Informed by `effect/devtools/DevToolsSchema` but deliberately different:
9
+ * spans are delta-encoded as `SpanStart` / `SpanEnd` rather than a full span
10
+ * snapshot re-sent on end, every message carries a `sessionId`, and attribute
11
+ * values are a bounded {@link Json} union instead of `Schema.Any`.
12
+ */
13
+ import { Schema } from 'effect';
14
+ /**
15
+ * Monotonic nanosecond timestamp, matching `Tracer.Span#startTime`.
16
+ *
17
+ * Carried as a decimal string on the wire because JSON numbers cannot hold
18
+ * nanos without precision loss.
19
+ */
20
+ export declare const Timestamp: Schema.BigIntFromString;
21
+ export type Timestamp = Schema.Schema.Type<typeof Timestamp>;
22
+ /**
23
+ * A JSON value.
24
+ *
25
+ * Attribute and annotation values are bounded to this rather than
26
+ * `Schema.Any`: anything unrepresentable (a function, a symbol, a class
27
+ * instance, a `bigint`) is stringified by the producer at the edge, so a
28
+ * decoder never has to guess.
29
+ */
30
+ export type Json = string | number | boolean | null | ReadonlyArray<Json> | {
31
+ readonly [key: string]: Json;
32
+ };
33
+ export declare const Json: Schema.Codec<Json>;
34
+ /** Span attributes, log annotations, and metric/event attributes. */
35
+ export declare const Attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
36
+ export type Attributes = Schema.Schema.Type<typeof Attributes>;
37
+ /** Identifies one run of an instrumented program. */
38
+ export declare const SessionId: Schema.String;
39
+ export type SessionId = Schema.Schema.Type<typeof SessionId>;
40
+ /** Mirrors `Tracer.SpanKind`. */
41
+ export declare const SpanKind: Schema.Literals<readonly ["internal", "server", "client", "producer", "consumer"]>;
42
+ export type SpanKind = Schema.Schema.Type<typeof SpanKind>;
43
+ /** Mirrors `LogLevel.LogLevel`. */
44
+ export declare const LogLevel: Schema.Literals<readonly ["All", "Fatal", "Error", "Warn", "Info", "Debug", "Trace", "None"]>;
45
+ export type LogLevel = Schema.Schema.Type<typeof LogLevel>;
46
+ /**
47
+ * Wall-clock anchor for a session's monotonic clock.
48
+ *
49
+ * `startTime` is nanos from the same monotonic source as span times;
50
+ * `wallClockEpochMillis` is `Date.now()` sampled at the same instant. Together
51
+ * they let the webapp render absolute times and align sessions with each other.
52
+ */
53
+ export declare const Clock: Schema.Struct<{
54
+ readonly startTime: Schema.BigIntFromString;
55
+ readonly wallClockEpochMillis: Schema.Natural;
56
+ }>;
57
+ export type Clock = Schema.Schema.Type<typeof Clock>;
58
+ /** First message on a client connection; opens the session. */
59
+ export declare const Hello: Schema.Struct<{
60
+ readonly sessionId: Schema.String;
61
+ readonly _tag: Schema.tag<"Hello">;
62
+ readonly program: Schema.String;
63
+ readonly pid: Schema.Natural;
64
+ readonly runtime: Schema.String;
65
+ readonly protocolVersion: Schema.Natural;
66
+ readonly clock: Schema.Struct<{
67
+ readonly startTime: Schema.BigIntFromString;
68
+ readonly wallClockEpochMillis: Schema.Natural;
69
+ }>;
70
+ }>;
71
+ export type Hello = Schema.Schema.Type<typeof Hello>;
72
+ /** The protocol version a `Hello` must carry. Bump on any breaking change. */
73
+ export declare const protocolVersion = 1;
74
+ /**
75
+ * A span parent that lives outside this session's span tree — propagated from
76
+ * another tracing system, so the collector has ids but no span body.
77
+ */
78
+ export declare const ExternalParent: Schema.Struct<{
79
+ readonly _tag: Schema.tag<"ExternalParent">;
80
+ readonly spanId: Schema.String;
81
+ readonly traceId: Schema.String;
82
+ readonly sampled: Schema.Boolean;
83
+ }>;
84
+ export type ExternalParent = Schema.Schema.Type<typeof ExternalParent>;
85
+ /** A span parent within this session, referenced by id only. */
86
+ export declare const LocalParent: Schema.Struct<{
87
+ readonly _tag: Schema.tag<"LocalParent">;
88
+ readonly spanId: Schema.String;
89
+ }>;
90
+ export type LocalParent = Schema.Schema.Type<typeof LocalParent>;
91
+ export declare const SpanParent: Schema.Union<readonly [Schema.Struct<{
92
+ readonly _tag: Schema.tag<"LocalParent">;
93
+ readonly spanId: Schema.String;
94
+ }>, Schema.Struct<{
95
+ readonly _tag: Schema.tag<"ExternalParent">;
96
+ readonly spanId: Schema.String;
97
+ readonly traceId: Schema.String;
98
+ readonly sampled: Schema.Boolean;
99
+ }>]>;
100
+ export type SpanParent = Schema.Schema.Type<typeof SpanParent>;
101
+ /**
102
+ * A span opened. Sent once, when the span starts — never re-sent.
103
+ *
104
+ * `parent` is absent for a root span.
105
+ */
106
+ export declare const SpanStart: Schema.Struct<{
107
+ readonly sessionId: Schema.String;
108
+ readonly _tag: Schema.tag<"SpanStart">;
109
+ readonly spanId: Schema.String;
110
+ readonly traceId: Schema.String;
111
+ readonly parent: Schema.optional<Schema.Union<readonly [Schema.Struct<{
112
+ readonly _tag: Schema.tag<"LocalParent">;
113
+ readonly spanId: Schema.String;
114
+ }>, Schema.Struct<{
115
+ readonly _tag: Schema.tag<"ExternalParent">;
116
+ readonly spanId: Schema.String;
117
+ readonly traceId: Schema.String;
118
+ readonly sampled: Schema.Boolean;
119
+ }>]>>;
120
+ readonly name: Schema.String;
121
+ readonly kind: Schema.Literals<readonly ["internal", "server", "client", "producer", "consumer"]>;
122
+ readonly startTime: Schema.BigIntFromString;
123
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
124
+ readonly sampled: Schema.Boolean;
125
+ readonly fiberId: Schema.optional<Schema.Natural>;
126
+ }>;
127
+ export type SpanStart = Schema.Schema.Type<typeof SpanStart>;
128
+ /**
129
+ * How a span finished.
130
+ *
131
+ * The full `Cause` is not carried: the webapp only needs to colour the span and
132
+ * show a message, so the producer flattens failures to `error` (rendered
133
+ * message) plus optional `stack`. `_tag: "Failure"` covers expected errors,
134
+ * defects and interrupts alike, distinguished by `kind`.
135
+ */
136
+ export declare const SpanOutcomeSuccess: Schema.Struct<{
137
+ readonly _tag: Schema.tag<"Success">;
138
+ }>;
139
+ export type SpanOutcomeSuccess = Schema.Schema.Type<typeof SpanOutcomeSuccess>;
140
+ export declare const SpanOutcomeFailure: Schema.Struct<{
141
+ readonly _tag: Schema.tag<"Failure">;
142
+ readonly kind: Schema.Literals<readonly ["Fail", "Die", "Interrupt"]>;
143
+ readonly error: Schema.String;
144
+ readonly stack: Schema.optional<Schema.String>;
145
+ }>;
146
+ export type SpanOutcomeFailure = Schema.Schema.Type<typeof SpanOutcomeFailure>;
147
+ export declare const SpanOutcome: Schema.Union<readonly [Schema.Struct<{
148
+ readonly _tag: Schema.tag<"Success">;
149
+ }>, Schema.Struct<{
150
+ readonly _tag: Schema.tag<"Failure">;
151
+ readonly kind: Schema.Literals<readonly ["Fail", "Die", "Interrupt"]>;
152
+ readonly error: Schema.String;
153
+ readonly stack: Schema.optional<Schema.String>;
154
+ }>]>;
155
+ export type SpanOutcome = Schema.Schema.Type<typeof SpanOutcome>;
156
+ /**
157
+ * A span closed.
158
+ *
159
+ * `attributes` carries only attributes added after `SpanStart` was sent; the
160
+ * collector merges them over the ones it already has.
161
+ */
162
+ export declare const SpanEnd: Schema.Struct<{
163
+ readonly sessionId: Schema.String;
164
+ readonly _tag: Schema.tag<"SpanEnd">;
165
+ readonly spanId: Schema.String;
166
+ readonly endTime: Schema.BigIntFromString;
167
+ readonly outcome: Schema.Union<readonly [Schema.Struct<{
168
+ readonly _tag: Schema.tag<"Success">;
169
+ }>, Schema.Struct<{
170
+ readonly _tag: Schema.tag<"Failure">;
171
+ readonly kind: Schema.Literals<readonly ["Fail", "Die", "Interrupt"]>;
172
+ readonly error: Schema.String;
173
+ readonly stack: Schema.optional<Schema.String>;
174
+ }>]>;
175
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
176
+ }>;
177
+ export type SpanEnd = Schema.Schema.Type<typeof SpanEnd>;
178
+ /** A point-in-time event recorded against a span. */
179
+ export declare const SpanEvent: Schema.Struct<{
180
+ readonly sessionId: Schema.String;
181
+ readonly _tag: Schema.tag<"SpanEvent">;
182
+ readonly spanId: Schema.String;
183
+ readonly name: Schema.String;
184
+ readonly time: Schema.BigIntFromString;
185
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
186
+ }>;
187
+ export type SpanEvent = Schema.Schema.Type<typeof SpanEvent>;
188
+ /** A log record, in the same ordered stream as spans. */
189
+ export declare const Log: Schema.Struct<{
190
+ readonly sessionId: Schema.String;
191
+ readonly _tag: Schema.tag<"Log">;
192
+ readonly time: Schema.BigIntFromString;
193
+ readonly level: Schema.Literals<readonly ["All", "Fatal", "Error", "Warn", "Info", "Debug", "Trace", "None"]>;
194
+ readonly message: Schema.Codec<Json, Json, never, never>;
195
+ readonly spanId: Schema.optional<Schema.String>;
196
+ readonly fiberId: Schema.optional<Schema.Natural>;
197
+ readonly annotations: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
198
+ }>;
199
+ export type Log = Schema.Schema.Type<typeof Log>;
200
+ export declare const Counter: Schema.Struct<{
201
+ readonly type: Schema.tag<"Counter">;
202
+ readonly name: Schema.String;
203
+ readonly description: Schema.optional<Schema.String>;
204
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
205
+ readonly state: Schema.Struct<{
206
+ readonly count: Schema.Natural;
207
+ readonly incremental: Schema.Boolean;
208
+ }>;
209
+ }>;
210
+ export type Counter = Schema.Schema.Type<typeof Counter>;
211
+ export declare const Gauge: Schema.Struct<{
212
+ readonly type: Schema.tag<"Gauge">;
213
+ readonly name: Schema.String;
214
+ readonly description: Schema.optional<Schema.String>;
215
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
216
+ readonly state: Schema.Struct<{
217
+ readonly value: Schema.Finite;
218
+ }>;
219
+ }>;
220
+ export type Gauge = Schema.Schema.Type<typeof Gauge>;
221
+ export declare const Histogram: Schema.Struct<{
222
+ readonly type: Schema.tag<"Histogram">;
223
+ readonly name: Schema.String;
224
+ readonly description: Schema.optional<Schema.String>;
225
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
226
+ readonly state: Schema.Struct<{
227
+ readonly buckets: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.Natural]>>;
228
+ readonly count: Schema.Natural;
229
+ readonly min: Schema.Finite;
230
+ readonly max: Schema.Finite;
231
+ readonly sum: Schema.Finite;
232
+ }>;
233
+ }>;
234
+ export type Histogram = Schema.Schema.Type<typeof Histogram>;
235
+ export declare const Frequency: Schema.Struct<{
236
+ readonly type: Schema.tag<"Frequency">;
237
+ readonly name: Schema.String;
238
+ readonly description: Schema.optional<Schema.String>;
239
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
240
+ readonly state: Schema.Struct<{
241
+ readonly occurrences: Schema.$Record<Schema.String, Schema.Natural>;
242
+ }>;
243
+ }>;
244
+ export type Frequency = Schema.Schema.Type<typeof Frequency>;
245
+ export declare const Summary: Schema.Struct<{
246
+ readonly type: Schema.tag<"Summary">;
247
+ readonly name: Schema.String;
248
+ readonly description: Schema.optional<Schema.String>;
249
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
250
+ readonly state: Schema.Struct<{
251
+ readonly quantiles: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.NullOr<Schema.Finite>]>>;
252
+ readonly count: Schema.Natural;
253
+ readonly min: Schema.Finite;
254
+ readonly max: Schema.Finite;
255
+ readonly sum: Schema.Finite;
256
+ }>;
257
+ }>;
258
+ export type Summary = Schema.Schema.Type<typeof Summary>;
259
+ export declare const Metric: Schema.Union<readonly [Schema.Struct<{
260
+ readonly type: Schema.tag<"Counter">;
261
+ readonly name: Schema.String;
262
+ readonly description: Schema.optional<Schema.String>;
263
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
264
+ readonly state: Schema.Struct<{
265
+ readonly count: Schema.Natural;
266
+ readonly incremental: Schema.Boolean;
267
+ }>;
268
+ }>, Schema.Struct<{
269
+ readonly type: Schema.tag<"Gauge">;
270
+ readonly name: Schema.String;
271
+ readonly description: Schema.optional<Schema.String>;
272
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
273
+ readonly state: Schema.Struct<{
274
+ readonly value: Schema.Finite;
275
+ }>;
276
+ }>, Schema.Struct<{
277
+ readonly type: Schema.tag<"Histogram">;
278
+ readonly name: Schema.String;
279
+ readonly description: Schema.optional<Schema.String>;
280
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
281
+ readonly state: Schema.Struct<{
282
+ readonly buckets: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.Natural]>>;
283
+ readonly count: Schema.Natural;
284
+ readonly min: Schema.Finite;
285
+ readonly max: Schema.Finite;
286
+ readonly sum: Schema.Finite;
287
+ }>;
288
+ }>, Schema.Struct<{
289
+ readonly type: Schema.tag<"Frequency">;
290
+ readonly name: Schema.String;
291
+ readonly description: Schema.optional<Schema.String>;
292
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
293
+ readonly state: Schema.Struct<{
294
+ readonly occurrences: Schema.$Record<Schema.String, Schema.Natural>;
295
+ }>;
296
+ }>, Schema.Struct<{
297
+ readonly type: Schema.tag<"Summary">;
298
+ readonly name: Schema.String;
299
+ readonly description: Schema.optional<Schema.String>;
300
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
301
+ readonly state: Schema.Struct<{
302
+ readonly quantiles: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.NullOr<Schema.Finite>]>>;
303
+ readonly count: Schema.Natural;
304
+ readonly min: Schema.Finite;
305
+ readonly max: Schema.Finite;
306
+ readonly sum: Schema.Finite;
307
+ }>;
308
+ }>]>;
309
+ export type Metric = Schema.Schema.Type<typeof Metric>;
310
+ /** A snapshot of every metric, taken at `time`. */
311
+ export declare const Metrics: Schema.Struct<{
312
+ readonly sessionId: Schema.String;
313
+ readonly _tag: Schema.tag<"Metrics">;
314
+ readonly time: Schema.BigIntFromString;
315
+ readonly metrics: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
316
+ readonly type: Schema.tag<"Counter">;
317
+ readonly name: Schema.String;
318
+ readonly description: Schema.optional<Schema.String>;
319
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
320
+ readonly state: Schema.Struct<{
321
+ readonly count: Schema.Natural;
322
+ readonly incremental: Schema.Boolean;
323
+ }>;
324
+ }>, Schema.Struct<{
325
+ readonly type: Schema.tag<"Gauge">;
326
+ readonly name: Schema.String;
327
+ readonly description: Schema.optional<Schema.String>;
328
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
329
+ readonly state: Schema.Struct<{
330
+ readonly value: Schema.Finite;
331
+ }>;
332
+ }>, Schema.Struct<{
333
+ readonly type: Schema.tag<"Histogram">;
334
+ readonly name: Schema.String;
335
+ readonly description: Schema.optional<Schema.String>;
336
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
337
+ readonly state: Schema.Struct<{
338
+ readonly buckets: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.Natural]>>;
339
+ readonly count: Schema.Natural;
340
+ readonly min: Schema.Finite;
341
+ readonly max: Schema.Finite;
342
+ readonly sum: Schema.Finite;
343
+ }>;
344
+ }>, Schema.Struct<{
345
+ readonly type: Schema.tag<"Frequency">;
346
+ readonly name: Schema.String;
347
+ readonly description: Schema.optional<Schema.String>;
348
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
349
+ readonly state: Schema.Struct<{
350
+ readonly occurrences: Schema.$Record<Schema.String, Schema.Natural>;
351
+ }>;
352
+ }>, Schema.Struct<{
353
+ readonly type: Schema.tag<"Summary">;
354
+ readonly name: Schema.String;
355
+ readonly description: Schema.optional<Schema.String>;
356
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
357
+ readonly state: Schema.Struct<{
358
+ readonly quantiles: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.NullOr<Schema.Finite>]>>;
359
+ readonly count: Schema.Natural;
360
+ readonly min: Schema.Finite;
361
+ readonly max: Schema.Finite;
362
+ readonly sum: Schema.Finite;
363
+ }>;
364
+ }>]>>;
365
+ }>;
366
+ export type Metrics = Schema.Schema.Type<typeof Metrics>;
367
+ /** A fiber lifecycle transition. */
368
+ export declare const FiberEvent: Schema.Struct<{
369
+ readonly sessionId: Schema.String;
370
+ readonly _tag: Schema.tag<"FiberEvent">;
371
+ readonly fiberId: Schema.Natural;
372
+ readonly event: Schema.Literals<readonly ["Start", "End", "Suspend", "Resume"]>;
373
+ readonly parentFiberId: Schema.optional<Schema.Natural>;
374
+ readonly time: Schema.BigIntFromString;
375
+ }>;
376
+ export type FiberEvent = Schema.Schema.Type<typeof FiberEvent>;
377
+ /**
378
+ * A `process.memoryUsage()` reading, sampled on an interval by the client.
379
+ *
380
+ * Node and Bun only: a runtime without `process.memoryUsage` emits none of
381
+ * these and a session simply has no memory track. Figures are bytes, as the
382
+ * runtime reports them; `time` shares the monotonic base of span times, so the
383
+ * webapp can draw the curve against the same x-axis as the flame chart.
384
+ */
385
+ export declare const MemorySample: Schema.Struct<{
386
+ readonly sessionId: Schema.String;
387
+ readonly _tag: Schema.tag<"MemorySample">;
388
+ readonly time: Schema.BigIntFromString;
389
+ readonly heapUsed: Schema.Natural;
390
+ readonly heapTotal: Schema.Natural;
391
+ readonly rss: Schema.Natural;
392
+ readonly external: Schema.Natural;
393
+ }>;
394
+ export type MemorySample = Schema.Schema.Type<typeof MemorySample>;
395
+ export declare const Ping: Schema.Struct<{
396
+ readonly sessionId: Schema.String;
397
+ readonly _tag: Schema.tag<"Ping">;
398
+ }>;
399
+ export type Ping = Schema.Schema.Type<typeof Ping>;
400
+ export declare const Pong: Schema.Struct<{
401
+ readonly sessionId: Schema.String;
402
+ readonly _tag: Schema.tag<"Pong">;
403
+ }>;
404
+ export type Pong = Schema.Schema.Type<typeof Pong>;
405
+ /** Asks the client for a {@link Metrics} snapshot. */
406
+ export declare const MetricsRequest: Schema.Struct<{
407
+ readonly _tag: Schema.tag<"MetricsRequest">;
408
+ }>;
409
+ export type MetricsRequest = Schema.Schema.Type<typeof MetricsRequest>;
410
+ /** Telemetry the instrumented program sends to the collector. */
411
+ export declare const ClientMessage: Schema.Union<readonly [Schema.Struct<{
412
+ readonly sessionId: Schema.String;
413
+ readonly _tag: Schema.tag<"Hello">;
414
+ readonly program: Schema.String;
415
+ readonly pid: Schema.Natural;
416
+ readonly runtime: Schema.String;
417
+ readonly protocolVersion: Schema.Natural;
418
+ readonly clock: Schema.Struct<{
419
+ readonly startTime: Schema.BigIntFromString;
420
+ readonly wallClockEpochMillis: Schema.Natural;
421
+ }>;
422
+ }>, Schema.Struct<{
423
+ readonly sessionId: Schema.String;
424
+ readonly _tag: Schema.tag<"SpanStart">;
425
+ readonly spanId: Schema.String;
426
+ readonly traceId: Schema.String;
427
+ readonly parent: Schema.optional<Schema.Union<readonly [Schema.Struct<{
428
+ readonly _tag: Schema.tag<"LocalParent">;
429
+ readonly spanId: Schema.String;
430
+ }>, Schema.Struct<{
431
+ readonly _tag: Schema.tag<"ExternalParent">;
432
+ readonly spanId: Schema.String;
433
+ readonly traceId: Schema.String;
434
+ readonly sampled: Schema.Boolean;
435
+ }>]>>;
436
+ readonly name: Schema.String;
437
+ readonly kind: Schema.Literals<readonly ["internal", "server", "client", "producer", "consumer"]>;
438
+ readonly startTime: Schema.BigIntFromString;
439
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
440
+ readonly sampled: Schema.Boolean;
441
+ readonly fiberId: Schema.optional<Schema.Natural>;
442
+ }>, Schema.Struct<{
443
+ readonly sessionId: Schema.String;
444
+ readonly _tag: Schema.tag<"SpanEnd">;
445
+ readonly spanId: Schema.String;
446
+ readonly endTime: Schema.BigIntFromString;
447
+ readonly outcome: Schema.Union<readonly [Schema.Struct<{
448
+ readonly _tag: Schema.tag<"Success">;
449
+ }>, Schema.Struct<{
450
+ readonly _tag: Schema.tag<"Failure">;
451
+ readonly kind: Schema.Literals<readonly ["Fail", "Die", "Interrupt"]>;
452
+ readonly error: Schema.String;
453
+ readonly stack: Schema.optional<Schema.String>;
454
+ }>]>;
455
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
456
+ }>, Schema.Struct<{
457
+ readonly sessionId: Schema.String;
458
+ readonly _tag: Schema.tag<"SpanEvent">;
459
+ readonly spanId: Schema.String;
460
+ readonly name: Schema.String;
461
+ readonly time: Schema.BigIntFromString;
462
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
463
+ }>, Schema.Struct<{
464
+ readonly sessionId: Schema.String;
465
+ readonly _tag: Schema.tag<"Log">;
466
+ readonly time: Schema.BigIntFromString;
467
+ readonly level: Schema.Literals<readonly ["All", "Fatal", "Error", "Warn", "Info", "Debug", "Trace", "None"]>;
468
+ readonly message: Schema.Codec<Json, Json, never, never>;
469
+ readonly spanId: Schema.optional<Schema.String>;
470
+ readonly fiberId: Schema.optional<Schema.Natural>;
471
+ readonly annotations: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
472
+ }>, Schema.Struct<{
473
+ readonly sessionId: Schema.String;
474
+ readonly _tag: Schema.tag<"Metrics">;
475
+ readonly time: Schema.BigIntFromString;
476
+ readonly metrics: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
477
+ readonly type: Schema.tag<"Counter">;
478
+ readonly name: Schema.String;
479
+ readonly description: Schema.optional<Schema.String>;
480
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
481
+ readonly state: Schema.Struct<{
482
+ readonly count: Schema.Natural;
483
+ readonly incremental: Schema.Boolean;
484
+ }>;
485
+ }>, Schema.Struct<{
486
+ readonly type: Schema.tag<"Gauge">;
487
+ readonly name: Schema.String;
488
+ readonly description: Schema.optional<Schema.String>;
489
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
490
+ readonly state: Schema.Struct<{
491
+ readonly value: Schema.Finite;
492
+ }>;
493
+ }>, Schema.Struct<{
494
+ readonly type: Schema.tag<"Histogram">;
495
+ readonly name: Schema.String;
496
+ readonly description: Schema.optional<Schema.String>;
497
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
498
+ readonly state: Schema.Struct<{
499
+ readonly buckets: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.Natural]>>;
500
+ readonly count: Schema.Natural;
501
+ readonly min: Schema.Finite;
502
+ readonly max: Schema.Finite;
503
+ readonly sum: Schema.Finite;
504
+ }>;
505
+ }>, Schema.Struct<{
506
+ readonly type: Schema.tag<"Frequency">;
507
+ readonly name: Schema.String;
508
+ readonly description: Schema.optional<Schema.String>;
509
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
510
+ readonly state: Schema.Struct<{
511
+ readonly occurrences: Schema.$Record<Schema.String, Schema.Natural>;
512
+ }>;
513
+ }>, Schema.Struct<{
514
+ readonly type: Schema.tag<"Summary">;
515
+ readonly name: Schema.String;
516
+ readonly description: Schema.optional<Schema.String>;
517
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
518
+ readonly state: Schema.Struct<{
519
+ readonly quantiles: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.NullOr<Schema.Finite>]>>;
520
+ readonly count: Schema.Natural;
521
+ readonly min: Schema.Finite;
522
+ readonly max: Schema.Finite;
523
+ readonly sum: Schema.Finite;
524
+ }>;
525
+ }>]>>;
526
+ }>, Schema.Struct<{
527
+ readonly sessionId: Schema.String;
528
+ readonly _tag: Schema.tag<"FiberEvent">;
529
+ readonly fiberId: Schema.Natural;
530
+ readonly event: Schema.Literals<readonly ["Start", "End", "Suspend", "Resume"]>;
531
+ readonly parentFiberId: Schema.optional<Schema.Natural>;
532
+ readonly time: Schema.BigIntFromString;
533
+ }>, Schema.Struct<{
534
+ readonly sessionId: Schema.String;
535
+ readonly _tag: Schema.tag<"MemorySample">;
536
+ readonly time: Schema.BigIntFromString;
537
+ readonly heapUsed: Schema.Natural;
538
+ readonly heapTotal: Schema.Natural;
539
+ readonly rss: Schema.Natural;
540
+ readonly external: Schema.Natural;
541
+ }>, Schema.Struct<{
542
+ readonly sessionId: Schema.String;
543
+ readonly _tag: Schema.tag<"Ping">;
544
+ }>]>;
545
+ export type ClientMessage = Schema.Schema.Type<typeof ClientMessage>;
546
+ /** What the collector sends back to the instrumented program. */
547
+ export declare const CollectorMessage: Schema.Union<readonly [Schema.Struct<{
548
+ readonly sessionId: Schema.String;
549
+ readonly _tag: Schema.tag<"Pong">;
550
+ }>, Schema.Struct<{
551
+ readonly _tag: Schema.tag<"MetricsRequest">;
552
+ }>]>;
553
+ export type CollectorMessage = Schema.Schema.Type<typeof CollectorMessage>;
554
+ /** A session the collector knows about, as listed to the webapp. */
555
+ export declare const Session: Schema.Struct<{
556
+ readonly sessionId: Schema.String;
557
+ readonly program: Schema.String;
558
+ readonly pid: Schema.Natural;
559
+ readonly runtime: Schema.String;
560
+ readonly clock: Schema.Struct<{
561
+ readonly startTime: Schema.BigIntFromString;
562
+ readonly wallClockEpochMillis: Schema.Natural;
563
+ }>;
564
+ readonly active: Schema.Boolean;
565
+ readonly endedAtEpochMillis: Schema.optional<Schema.Natural>;
566
+ }>;
567
+ export type Session = Schema.Schema.Type<typeof Session>;
568
+ /** Every session the collector holds. Sent on connect and on change. */
569
+ export declare const SessionList: Schema.Struct<{
570
+ readonly _tag: Schema.tag<"SessionList">;
571
+ readonly sessions: Schema.$Array<Schema.Struct<{
572
+ readonly sessionId: Schema.String;
573
+ readonly program: Schema.String;
574
+ readonly pid: Schema.Natural;
575
+ readonly runtime: Schema.String;
576
+ readonly clock: Schema.Struct<{
577
+ readonly startTime: Schema.BigIntFromString;
578
+ readonly wallClockEpochMillis: Schema.Natural;
579
+ }>;
580
+ readonly active: Schema.Boolean;
581
+ readonly endedAtEpochMillis: Schema.optional<Schema.Natural>;
582
+ }>>;
583
+ }>;
584
+ export type SessionList = Schema.Schema.Type<typeof SessionList>;
585
+ /**
586
+ * Everything already recorded for a session, replayed in arrival order.
587
+ *
588
+ * Sent once when the webapp subscribes, before any live telemetry for that
589
+ * session. `complete` is false when the backlog is split across several
590
+ * messages, so the webapp knows more is coming.
591
+ */
592
+ export declare const Backlog: Schema.Struct<{
593
+ readonly sessionId: Schema.String;
594
+ readonly _tag: Schema.tag<"Backlog">;
595
+ readonly messages: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
596
+ readonly sessionId: Schema.String;
597
+ readonly _tag: Schema.tag<"Hello">;
598
+ readonly program: Schema.String;
599
+ readonly pid: Schema.Natural;
600
+ readonly runtime: Schema.String;
601
+ readonly protocolVersion: Schema.Natural;
602
+ readonly clock: Schema.Struct<{
603
+ readonly startTime: Schema.BigIntFromString;
604
+ readonly wallClockEpochMillis: Schema.Natural;
605
+ }>;
606
+ }>, Schema.Struct<{
607
+ readonly sessionId: Schema.String;
608
+ readonly _tag: Schema.tag<"SpanStart">;
609
+ readonly spanId: Schema.String;
610
+ readonly traceId: Schema.String;
611
+ readonly parent: Schema.optional<Schema.Union<readonly [Schema.Struct<{
612
+ readonly _tag: Schema.tag<"LocalParent">;
613
+ readonly spanId: Schema.String;
614
+ }>, Schema.Struct<{
615
+ readonly _tag: Schema.tag<"ExternalParent">;
616
+ readonly spanId: Schema.String;
617
+ readonly traceId: Schema.String;
618
+ readonly sampled: Schema.Boolean;
619
+ }>]>>;
620
+ readonly name: Schema.String;
621
+ readonly kind: Schema.Literals<readonly ["internal", "server", "client", "producer", "consumer"]>;
622
+ readonly startTime: Schema.BigIntFromString;
623
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
624
+ readonly sampled: Schema.Boolean;
625
+ readonly fiberId: Schema.optional<Schema.Natural>;
626
+ }>, Schema.Struct<{
627
+ readonly sessionId: Schema.String;
628
+ readonly _tag: Schema.tag<"SpanEnd">;
629
+ readonly spanId: Schema.String;
630
+ readonly endTime: Schema.BigIntFromString;
631
+ readonly outcome: Schema.Union<readonly [Schema.Struct<{
632
+ readonly _tag: Schema.tag<"Success">;
633
+ }>, Schema.Struct<{
634
+ readonly _tag: Schema.tag<"Failure">;
635
+ readonly kind: Schema.Literals<readonly ["Fail", "Die", "Interrupt"]>;
636
+ readonly error: Schema.String;
637
+ readonly stack: Schema.optional<Schema.String>;
638
+ }>]>;
639
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
640
+ }>, Schema.Struct<{
641
+ readonly sessionId: Schema.String;
642
+ readonly _tag: Schema.tag<"SpanEvent">;
643
+ readonly spanId: Schema.String;
644
+ readonly name: Schema.String;
645
+ readonly time: Schema.BigIntFromString;
646
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
647
+ }>, Schema.Struct<{
648
+ readonly sessionId: Schema.String;
649
+ readonly _tag: Schema.tag<"Log">;
650
+ readonly time: Schema.BigIntFromString;
651
+ readonly level: Schema.Literals<readonly ["All", "Fatal", "Error", "Warn", "Info", "Debug", "Trace", "None"]>;
652
+ readonly message: Schema.Codec<Json, Json, never, never>;
653
+ readonly spanId: Schema.optional<Schema.String>;
654
+ readonly fiberId: Schema.optional<Schema.Natural>;
655
+ readonly annotations: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
656
+ }>, Schema.Struct<{
657
+ readonly sessionId: Schema.String;
658
+ readonly _tag: Schema.tag<"Metrics">;
659
+ readonly time: Schema.BigIntFromString;
660
+ readonly metrics: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
661
+ readonly type: Schema.tag<"Counter">;
662
+ readonly name: Schema.String;
663
+ readonly description: Schema.optional<Schema.String>;
664
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
665
+ readonly state: Schema.Struct<{
666
+ readonly count: Schema.Natural;
667
+ readonly incremental: Schema.Boolean;
668
+ }>;
669
+ }>, Schema.Struct<{
670
+ readonly type: Schema.tag<"Gauge">;
671
+ readonly name: Schema.String;
672
+ readonly description: Schema.optional<Schema.String>;
673
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
674
+ readonly state: Schema.Struct<{
675
+ readonly value: Schema.Finite;
676
+ }>;
677
+ }>, Schema.Struct<{
678
+ readonly type: Schema.tag<"Histogram">;
679
+ readonly name: Schema.String;
680
+ readonly description: Schema.optional<Schema.String>;
681
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
682
+ readonly state: Schema.Struct<{
683
+ readonly buckets: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.Natural]>>;
684
+ readonly count: Schema.Natural;
685
+ readonly min: Schema.Finite;
686
+ readonly max: Schema.Finite;
687
+ readonly sum: Schema.Finite;
688
+ }>;
689
+ }>, Schema.Struct<{
690
+ readonly type: Schema.tag<"Frequency">;
691
+ readonly name: Schema.String;
692
+ readonly description: Schema.optional<Schema.String>;
693
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
694
+ readonly state: Schema.Struct<{
695
+ readonly occurrences: Schema.$Record<Schema.String, Schema.Natural>;
696
+ }>;
697
+ }>, Schema.Struct<{
698
+ readonly type: Schema.tag<"Summary">;
699
+ readonly name: Schema.String;
700
+ readonly description: Schema.optional<Schema.String>;
701
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
702
+ readonly state: Schema.Struct<{
703
+ readonly quantiles: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.NullOr<Schema.Finite>]>>;
704
+ readonly count: Schema.Natural;
705
+ readonly min: Schema.Finite;
706
+ readonly max: Schema.Finite;
707
+ readonly sum: Schema.Finite;
708
+ }>;
709
+ }>]>>;
710
+ }>, Schema.Struct<{
711
+ readonly sessionId: Schema.String;
712
+ readonly _tag: Schema.tag<"FiberEvent">;
713
+ readonly fiberId: Schema.Natural;
714
+ readonly event: Schema.Literals<readonly ["Start", "End", "Suspend", "Resume"]>;
715
+ readonly parentFiberId: Schema.optional<Schema.Natural>;
716
+ readonly time: Schema.BigIntFromString;
717
+ }>, Schema.Struct<{
718
+ readonly sessionId: Schema.String;
719
+ readonly _tag: Schema.tag<"MemorySample">;
720
+ readonly time: Schema.BigIntFromString;
721
+ readonly heapUsed: Schema.Natural;
722
+ readonly heapTotal: Schema.Natural;
723
+ readonly rss: Schema.Natural;
724
+ readonly external: Schema.Natural;
725
+ }>, Schema.Struct<{
726
+ readonly sessionId: Schema.String;
727
+ readonly _tag: Schema.tag<"Ping">;
728
+ }>]>>;
729
+ readonly complete: Schema.Boolean;
730
+ }>;
731
+ export type Backlog = Schema.Schema.Type<typeof Backlog>;
732
+ /** A live client message forwarded to the webapp as it arrives. */
733
+ export declare const Live: Schema.Struct<{
734
+ readonly _tag: Schema.tag<"Live">;
735
+ readonly message: Schema.Union<readonly [Schema.Struct<{
736
+ readonly sessionId: Schema.String;
737
+ readonly _tag: Schema.tag<"Hello">;
738
+ readonly program: Schema.String;
739
+ readonly pid: Schema.Natural;
740
+ readonly runtime: Schema.String;
741
+ readonly protocolVersion: Schema.Natural;
742
+ readonly clock: Schema.Struct<{
743
+ readonly startTime: Schema.BigIntFromString;
744
+ readonly wallClockEpochMillis: Schema.Natural;
745
+ }>;
746
+ }>, Schema.Struct<{
747
+ readonly sessionId: Schema.String;
748
+ readonly _tag: Schema.tag<"SpanStart">;
749
+ readonly spanId: Schema.String;
750
+ readonly traceId: Schema.String;
751
+ readonly parent: Schema.optional<Schema.Union<readonly [Schema.Struct<{
752
+ readonly _tag: Schema.tag<"LocalParent">;
753
+ readonly spanId: Schema.String;
754
+ }>, Schema.Struct<{
755
+ readonly _tag: Schema.tag<"ExternalParent">;
756
+ readonly spanId: Schema.String;
757
+ readonly traceId: Schema.String;
758
+ readonly sampled: Schema.Boolean;
759
+ }>]>>;
760
+ readonly name: Schema.String;
761
+ readonly kind: Schema.Literals<readonly ["internal", "server", "client", "producer", "consumer"]>;
762
+ readonly startTime: Schema.BigIntFromString;
763
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
764
+ readonly sampled: Schema.Boolean;
765
+ readonly fiberId: Schema.optional<Schema.Natural>;
766
+ }>, Schema.Struct<{
767
+ readonly sessionId: Schema.String;
768
+ readonly _tag: Schema.tag<"SpanEnd">;
769
+ readonly spanId: Schema.String;
770
+ readonly endTime: Schema.BigIntFromString;
771
+ readonly outcome: Schema.Union<readonly [Schema.Struct<{
772
+ readonly _tag: Schema.tag<"Success">;
773
+ }>, Schema.Struct<{
774
+ readonly _tag: Schema.tag<"Failure">;
775
+ readonly kind: Schema.Literals<readonly ["Fail", "Die", "Interrupt"]>;
776
+ readonly error: Schema.String;
777
+ readonly stack: Schema.optional<Schema.String>;
778
+ }>]>;
779
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
780
+ }>, Schema.Struct<{
781
+ readonly sessionId: Schema.String;
782
+ readonly _tag: Schema.tag<"SpanEvent">;
783
+ readonly spanId: Schema.String;
784
+ readonly name: Schema.String;
785
+ readonly time: Schema.BigIntFromString;
786
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
787
+ }>, Schema.Struct<{
788
+ readonly sessionId: Schema.String;
789
+ readonly _tag: Schema.tag<"Log">;
790
+ readonly time: Schema.BigIntFromString;
791
+ readonly level: Schema.Literals<readonly ["All", "Fatal", "Error", "Warn", "Info", "Debug", "Trace", "None"]>;
792
+ readonly message: Schema.Codec<Json, Json, never, never>;
793
+ readonly spanId: Schema.optional<Schema.String>;
794
+ readonly fiberId: Schema.optional<Schema.Natural>;
795
+ readonly annotations: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
796
+ }>, Schema.Struct<{
797
+ readonly sessionId: Schema.String;
798
+ readonly _tag: Schema.tag<"Metrics">;
799
+ readonly time: Schema.BigIntFromString;
800
+ readonly metrics: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
801
+ readonly type: Schema.tag<"Counter">;
802
+ readonly name: Schema.String;
803
+ readonly description: Schema.optional<Schema.String>;
804
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
805
+ readonly state: Schema.Struct<{
806
+ readonly count: Schema.Natural;
807
+ readonly incremental: Schema.Boolean;
808
+ }>;
809
+ }>, Schema.Struct<{
810
+ readonly type: Schema.tag<"Gauge">;
811
+ readonly name: Schema.String;
812
+ readonly description: Schema.optional<Schema.String>;
813
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
814
+ readonly state: Schema.Struct<{
815
+ readonly value: Schema.Finite;
816
+ }>;
817
+ }>, Schema.Struct<{
818
+ readonly type: Schema.tag<"Histogram">;
819
+ readonly name: Schema.String;
820
+ readonly description: Schema.optional<Schema.String>;
821
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
822
+ readonly state: Schema.Struct<{
823
+ readonly buckets: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.Natural]>>;
824
+ readonly count: Schema.Natural;
825
+ readonly min: Schema.Finite;
826
+ readonly max: Schema.Finite;
827
+ readonly sum: Schema.Finite;
828
+ }>;
829
+ }>, Schema.Struct<{
830
+ readonly type: Schema.tag<"Frequency">;
831
+ readonly name: Schema.String;
832
+ readonly description: Schema.optional<Schema.String>;
833
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
834
+ readonly state: Schema.Struct<{
835
+ readonly occurrences: Schema.$Record<Schema.String, Schema.Natural>;
836
+ }>;
837
+ }>, Schema.Struct<{
838
+ readonly type: Schema.tag<"Summary">;
839
+ readonly name: Schema.String;
840
+ readonly description: Schema.optional<Schema.String>;
841
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
842
+ readonly state: Schema.Struct<{
843
+ readonly quantiles: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.NullOr<Schema.Finite>]>>;
844
+ readonly count: Schema.Natural;
845
+ readonly min: Schema.Finite;
846
+ readonly max: Schema.Finite;
847
+ readonly sum: Schema.Finite;
848
+ }>;
849
+ }>]>>;
850
+ }>, Schema.Struct<{
851
+ readonly sessionId: Schema.String;
852
+ readonly _tag: Schema.tag<"FiberEvent">;
853
+ readonly fiberId: Schema.Natural;
854
+ readonly event: Schema.Literals<readonly ["Start", "End", "Suspend", "Resume"]>;
855
+ readonly parentFiberId: Schema.optional<Schema.Natural>;
856
+ readonly time: Schema.BigIntFromString;
857
+ }>, Schema.Struct<{
858
+ readonly sessionId: Schema.String;
859
+ readonly _tag: Schema.tag<"MemorySample">;
860
+ readonly time: Schema.BigIntFromString;
861
+ readonly heapUsed: Schema.Natural;
862
+ readonly heapTotal: Schema.Natural;
863
+ readonly rss: Schema.Natural;
864
+ readonly external: Schema.Natural;
865
+ }>, Schema.Struct<{
866
+ readonly sessionId: Schema.String;
867
+ readonly _tag: Schema.tag<"Ping">;
868
+ }>]>;
869
+ }>;
870
+ export type Live = Schema.Schema.Type<typeof Live>;
871
+ /**
872
+ * A session ended — its program exited or its connection dropped.
873
+ *
874
+ * **Nothing emits this.** The collector marks the session `active: false` and
875
+ * re-sends the whole {@link SessionList} on every change, which already tells
876
+ * the webapp everything this message would. The variant is kept because the
877
+ * protocol is extended additively and removing it would break the union for
878
+ * anyone decoding an older stream; the webapp handler for it was deleted
879
+ * rather than left looking implemented.
880
+ */
881
+ export declare const SessionEnded: Schema.Struct<{
882
+ readonly sessionId: Schema.String;
883
+ readonly _tag: Schema.tag<"SessionEnded">;
884
+ readonly endedAtEpochMillis: Schema.Natural;
885
+ }>;
886
+ export type SessionEnded = Schema.Schema.Type<typeof SessionEnded>;
887
+ /** What the collector sends to the webapp. */
888
+ export declare const WebappMessage: Schema.Union<readonly [Schema.Struct<{
889
+ readonly _tag: Schema.tag<"SessionList">;
890
+ readonly sessions: Schema.$Array<Schema.Struct<{
891
+ readonly sessionId: Schema.String;
892
+ readonly program: Schema.String;
893
+ readonly pid: Schema.Natural;
894
+ readonly runtime: Schema.String;
895
+ readonly clock: Schema.Struct<{
896
+ readonly startTime: Schema.BigIntFromString;
897
+ readonly wallClockEpochMillis: Schema.Natural;
898
+ }>;
899
+ readonly active: Schema.Boolean;
900
+ readonly endedAtEpochMillis: Schema.optional<Schema.Natural>;
901
+ }>>;
902
+ }>, Schema.Struct<{
903
+ readonly sessionId: Schema.String;
904
+ readonly _tag: Schema.tag<"Backlog">;
905
+ readonly messages: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
906
+ readonly sessionId: Schema.String;
907
+ readonly _tag: Schema.tag<"Hello">;
908
+ readonly program: Schema.String;
909
+ readonly pid: Schema.Natural;
910
+ readonly runtime: Schema.String;
911
+ readonly protocolVersion: Schema.Natural;
912
+ readonly clock: Schema.Struct<{
913
+ readonly startTime: Schema.BigIntFromString;
914
+ readonly wallClockEpochMillis: Schema.Natural;
915
+ }>;
916
+ }>, Schema.Struct<{
917
+ readonly sessionId: Schema.String;
918
+ readonly _tag: Schema.tag<"SpanStart">;
919
+ readonly spanId: Schema.String;
920
+ readonly traceId: Schema.String;
921
+ readonly parent: Schema.optional<Schema.Union<readonly [Schema.Struct<{
922
+ readonly _tag: Schema.tag<"LocalParent">;
923
+ readonly spanId: Schema.String;
924
+ }>, Schema.Struct<{
925
+ readonly _tag: Schema.tag<"ExternalParent">;
926
+ readonly spanId: Schema.String;
927
+ readonly traceId: Schema.String;
928
+ readonly sampled: Schema.Boolean;
929
+ }>]>>;
930
+ readonly name: Schema.String;
931
+ readonly kind: Schema.Literals<readonly ["internal", "server", "client", "producer", "consumer"]>;
932
+ readonly startTime: Schema.BigIntFromString;
933
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
934
+ readonly sampled: Schema.Boolean;
935
+ readonly fiberId: Schema.optional<Schema.Natural>;
936
+ }>, Schema.Struct<{
937
+ readonly sessionId: Schema.String;
938
+ readonly _tag: Schema.tag<"SpanEnd">;
939
+ readonly spanId: Schema.String;
940
+ readonly endTime: Schema.BigIntFromString;
941
+ readonly outcome: Schema.Union<readonly [Schema.Struct<{
942
+ readonly _tag: Schema.tag<"Success">;
943
+ }>, Schema.Struct<{
944
+ readonly _tag: Schema.tag<"Failure">;
945
+ readonly kind: Schema.Literals<readonly ["Fail", "Die", "Interrupt"]>;
946
+ readonly error: Schema.String;
947
+ readonly stack: Schema.optional<Schema.String>;
948
+ }>]>;
949
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
950
+ }>, Schema.Struct<{
951
+ readonly sessionId: Schema.String;
952
+ readonly _tag: Schema.tag<"SpanEvent">;
953
+ readonly spanId: Schema.String;
954
+ readonly name: Schema.String;
955
+ readonly time: Schema.BigIntFromString;
956
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
957
+ }>, Schema.Struct<{
958
+ readonly sessionId: Schema.String;
959
+ readonly _tag: Schema.tag<"Log">;
960
+ readonly time: Schema.BigIntFromString;
961
+ readonly level: Schema.Literals<readonly ["All", "Fatal", "Error", "Warn", "Info", "Debug", "Trace", "None"]>;
962
+ readonly message: Schema.Codec<Json, Json, never, never>;
963
+ readonly spanId: Schema.optional<Schema.String>;
964
+ readonly fiberId: Schema.optional<Schema.Natural>;
965
+ readonly annotations: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
966
+ }>, Schema.Struct<{
967
+ readonly sessionId: Schema.String;
968
+ readonly _tag: Schema.tag<"Metrics">;
969
+ readonly time: Schema.BigIntFromString;
970
+ readonly metrics: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
971
+ readonly type: Schema.tag<"Counter">;
972
+ readonly name: Schema.String;
973
+ readonly description: Schema.optional<Schema.String>;
974
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
975
+ readonly state: Schema.Struct<{
976
+ readonly count: Schema.Natural;
977
+ readonly incremental: Schema.Boolean;
978
+ }>;
979
+ }>, Schema.Struct<{
980
+ readonly type: Schema.tag<"Gauge">;
981
+ readonly name: Schema.String;
982
+ readonly description: Schema.optional<Schema.String>;
983
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
984
+ readonly state: Schema.Struct<{
985
+ readonly value: Schema.Finite;
986
+ }>;
987
+ }>, Schema.Struct<{
988
+ readonly type: Schema.tag<"Histogram">;
989
+ readonly name: Schema.String;
990
+ readonly description: Schema.optional<Schema.String>;
991
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
992
+ readonly state: Schema.Struct<{
993
+ readonly buckets: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.Natural]>>;
994
+ readonly count: Schema.Natural;
995
+ readonly min: Schema.Finite;
996
+ readonly max: Schema.Finite;
997
+ readonly sum: Schema.Finite;
998
+ }>;
999
+ }>, Schema.Struct<{
1000
+ readonly type: Schema.tag<"Frequency">;
1001
+ readonly name: Schema.String;
1002
+ readonly description: Schema.optional<Schema.String>;
1003
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
1004
+ readonly state: Schema.Struct<{
1005
+ readonly occurrences: Schema.$Record<Schema.String, Schema.Natural>;
1006
+ }>;
1007
+ }>, Schema.Struct<{
1008
+ readonly type: Schema.tag<"Summary">;
1009
+ readonly name: Schema.String;
1010
+ readonly description: Schema.optional<Schema.String>;
1011
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
1012
+ readonly state: Schema.Struct<{
1013
+ readonly quantiles: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.NullOr<Schema.Finite>]>>;
1014
+ readonly count: Schema.Natural;
1015
+ readonly min: Schema.Finite;
1016
+ readonly max: Schema.Finite;
1017
+ readonly sum: Schema.Finite;
1018
+ }>;
1019
+ }>]>>;
1020
+ }>, Schema.Struct<{
1021
+ readonly sessionId: Schema.String;
1022
+ readonly _tag: Schema.tag<"FiberEvent">;
1023
+ readonly fiberId: Schema.Natural;
1024
+ readonly event: Schema.Literals<readonly ["Start", "End", "Suspend", "Resume"]>;
1025
+ readonly parentFiberId: Schema.optional<Schema.Natural>;
1026
+ readonly time: Schema.BigIntFromString;
1027
+ }>, Schema.Struct<{
1028
+ readonly sessionId: Schema.String;
1029
+ readonly _tag: Schema.tag<"MemorySample">;
1030
+ readonly time: Schema.BigIntFromString;
1031
+ readonly heapUsed: Schema.Natural;
1032
+ readonly heapTotal: Schema.Natural;
1033
+ readonly rss: Schema.Natural;
1034
+ readonly external: Schema.Natural;
1035
+ }>, Schema.Struct<{
1036
+ readonly sessionId: Schema.String;
1037
+ readonly _tag: Schema.tag<"Ping">;
1038
+ }>]>>;
1039
+ readonly complete: Schema.Boolean;
1040
+ }>, Schema.Struct<{
1041
+ readonly _tag: Schema.tag<"Live">;
1042
+ readonly message: Schema.Union<readonly [Schema.Struct<{
1043
+ readonly sessionId: Schema.String;
1044
+ readonly _tag: Schema.tag<"Hello">;
1045
+ readonly program: Schema.String;
1046
+ readonly pid: Schema.Natural;
1047
+ readonly runtime: Schema.String;
1048
+ readonly protocolVersion: Schema.Natural;
1049
+ readonly clock: Schema.Struct<{
1050
+ readonly startTime: Schema.BigIntFromString;
1051
+ readonly wallClockEpochMillis: Schema.Natural;
1052
+ }>;
1053
+ }>, Schema.Struct<{
1054
+ readonly sessionId: Schema.String;
1055
+ readonly _tag: Schema.tag<"SpanStart">;
1056
+ readonly spanId: Schema.String;
1057
+ readonly traceId: Schema.String;
1058
+ readonly parent: Schema.optional<Schema.Union<readonly [Schema.Struct<{
1059
+ readonly _tag: Schema.tag<"LocalParent">;
1060
+ readonly spanId: Schema.String;
1061
+ }>, Schema.Struct<{
1062
+ readonly _tag: Schema.tag<"ExternalParent">;
1063
+ readonly spanId: Schema.String;
1064
+ readonly traceId: Schema.String;
1065
+ readonly sampled: Schema.Boolean;
1066
+ }>]>>;
1067
+ readonly name: Schema.String;
1068
+ readonly kind: Schema.Literals<readonly ["internal", "server", "client", "producer", "consumer"]>;
1069
+ readonly startTime: Schema.BigIntFromString;
1070
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
1071
+ readonly sampled: Schema.Boolean;
1072
+ readonly fiberId: Schema.optional<Schema.Natural>;
1073
+ }>, Schema.Struct<{
1074
+ readonly sessionId: Schema.String;
1075
+ readonly _tag: Schema.tag<"SpanEnd">;
1076
+ readonly spanId: Schema.String;
1077
+ readonly endTime: Schema.BigIntFromString;
1078
+ readonly outcome: Schema.Union<readonly [Schema.Struct<{
1079
+ readonly _tag: Schema.tag<"Success">;
1080
+ }>, Schema.Struct<{
1081
+ readonly _tag: Schema.tag<"Failure">;
1082
+ readonly kind: Schema.Literals<readonly ["Fail", "Die", "Interrupt"]>;
1083
+ readonly error: Schema.String;
1084
+ readonly stack: Schema.optional<Schema.String>;
1085
+ }>]>;
1086
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
1087
+ }>, Schema.Struct<{
1088
+ readonly sessionId: Schema.String;
1089
+ readonly _tag: Schema.tag<"SpanEvent">;
1090
+ readonly spanId: Schema.String;
1091
+ readonly name: Schema.String;
1092
+ readonly time: Schema.BigIntFromString;
1093
+ readonly attributes: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
1094
+ }>, Schema.Struct<{
1095
+ readonly sessionId: Schema.String;
1096
+ readonly _tag: Schema.tag<"Log">;
1097
+ readonly time: Schema.BigIntFromString;
1098
+ readonly level: Schema.Literals<readonly ["All", "Fatal", "Error", "Warn", "Info", "Debug", "Trace", "None"]>;
1099
+ readonly message: Schema.Codec<Json, Json, never, never>;
1100
+ readonly spanId: Schema.optional<Schema.String>;
1101
+ readonly fiberId: Schema.optional<Schema.Natural>;
1102
+ readonly annotations: Schema.$Record<Schema.String, Schema.Codec<Json, Json, never, never>>;
1103
+ }>, Schema.Struct<{
1104
+ readonly sessionId: Schema.String;
1105
+ readonly _tag: Schema.tag<"Metrics">;
1106
+ readonly time: Schema.BigIntFromString;
1107
+ readonly metrics: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
1108
+ readonly type: Schema.tag<"Counter">;
1109
+ readonly name: Schema.String;
1110
+ readonly description: Schema.optional<Schema.String>;
1111
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
1112
+ readonly state: Schema.Struct<{
1113
+ readonly count: Schema.Natural;
1114
+ readonly incremental: Schema.Boolean;
1115
+ }>;
1116
+ }>, Schema.Struct<{
1117
+ readonly type: Schema.tag<"Gauge">;
1118
+ readonly name: Schema.String;
1119
+ readonly description: Schema.optional<Schema.String>;
1120
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
1121
+ readonly state: Schema.Struct<{
1122
+ readonly value: Schema.Finite;
1123
+ }>;
1124
+ }>, Schema.Struct<{
1125
+ readonly type: Schema.tag<"Histogram">;
1126
+ readonly name: Schema.String;
1127
+ readonly description: Schema.optional<Schema.String>;
1128
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
1129
+ readonly state: Schema.Struct<{
1130
+ readonly buckets: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.Natural]>>;
1131
+ readonly count: Schema.Natural;
1132
+ readonly min: Schema.Finite;
1133
+ readonly max: Schema.Finite;
1134
+ readonly sum: Schema.Finite;
1135
+ }>;
1136
+ }>, Schema.Struct<{
1137
+ readonly type: Schema.tag<"Frequency">;
1138
+ readonly name: Schema.String;
1139
+ readonly description: Schema.optional<Schema.String>;
1140
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
1141
+ readonly state: Schema.Struct<{
1142
+ readonly occurrences: Schema.$Record<Schema.String, Schema.Natural>;
1143
+ }>;
1144
+ }>, Schema.Struct<{
1145
+ readonly type: Schema.tag<"Summary">;
1146
+ readonly name: Schema.String;
1147
+ readonly description: Schema.optional<Schema.String>;
1148
+ readonly attributes: Schema.$Record<Schema.String, Schema.String>;
1149
+ readonly state: Schema.Struct<{
1150
+ readonly quantiles: Schema.$Array<Schema.Tuple<readonly [Schema.Finite, Schema.NullOr<Schema.Finite>]>>;
1151
+ readonly count: Schema.Natural;
1152
+ readonly min: Schema.Finite;
1153
+ readonly max: Schema.Finite;
1154
+ readonly sum: Schema.Finite;
1155
+ }>;
1156
+ }>]>>;
1157
+ }>, Schema.Struct<{
1158
+ readonly sessionId: Schema.String;
1159
+ readonly _tag: Schema.tag<"FiberEvent">;
1160
+ readonly fiberId: Schema.Natural;
1161
+ readonly event: Schema.Literals<readonly ["Start", "End", "Suspend", "Resume"]>;
1162
+ readonly parentFiberId: Schema.optional<Schema.Natural>;
1163
+ readonly time: Schema.BigIntFromString;
1164
+ }>, Schema.Struct<{
1165
+ readonly sessionId: Schema.String;
1166
+ readonly _tag: Schema.tag<"MemorySample">;
1167
+ readonly time: Schema.BigIntFromString;
1168
+ readonly heapUsed: Schema.Natural;
1169
+ readonly heapTotal: Schema.Natural;
1170
+ readonly rss: Schema.Natural;
1171
+ readonly external: Schema.Natural;
1172
+ }>, Schema.Struct<{
1173
+ readonly sessionId: Schema.String;
1174
+ readonly _tag: Schema.tag<"Ping">;
1175
+ }>]>;
1176
+ }>, Schema.Struct<{
1177
+ readonly sessionId: Schema.String;
1178
+ readonly _tag: Schema.tag<"SessionEnded">;
1179
+ readonly endedAtEpochMillis: Schema.Natural;
1180
+ }>]>;
1181
+ export type WebappMessage = Schema.Schema.Type<typeof WebappMessage>;
1182
+ /** Asks the collector to stream one session: its backlog, then live messages. */
1183
+ export declare const Subscribe: Schema.Struct<{
1184
+ readonly sessionId: Schema.String;
1185
+ readonly _tag: Schema.tag<"Subscribe">;
1186
+ }>;
1187
+ export type Subscribe = Schema.Schema.Type<typeof Subscribe>;
1188
+ /** Stops the stream started by {@link Subscribe}. */
1189
+ export declare const Unsubscribe: Schema.Struct<{
1190
+ readonly sessionId: Schema.String;
1191
+ readonly _tag: Schema.tag<"Unsubscribe">;
1192
+ }>;
1193
+ export type Unsubscribe = Schema.Schema.Type<typeof Unsubscribe>;
1194
+ /** What the webapp sends to the collector. */
1195
+ export declare const WebappRequest: Schema.Union<readonly [Schema.Struct<{
1196
+ readonly sessionId: Schema.String;
1197
+ readonly _tag: Schema.tag<"Subscribe">;
1198
+ }>, Schema.Struct<{
1199
+ readonly sessionId: Schema.String;
1200
+ readonly _tag: Schema.tag<"Unsubscribe">;
1201
+ }>]>;
1202
+ export type WebappRequest = Schema.Schema.Type<typeof WebappRequest>;
1203
+ /**
1204
+ * Line 1 of a saved trace file.
1205
+ *
1206
+ * The rest of the file is {@link ClientMessage} NDJSON, byte-identical to what
1207
+ * the wire carries — a trace file is the protocol message stream with a header
1208
+ * on top, not a second representation of a trace. So any new `ClientMessage`
1209
+ * variant is carried by a saved trace for free, and {@link traceFileFormatVersion}
1210
+ * only moves if *this* struct or the line layout changes.
1211
+ *
1212
+ * The full {@link Session} is embedded because a loaded trace has no
1213
+ * `SessionList` to get its `clock` from, and without the clock the webapp
1214
+ * cannot show absolute times.
1215
+ */
1216
+ export declare const TraceFileHeader: Schema.Struct<{
1217
+ readonly _tag: Schema.tag<"TraceFileHeader">;
1218
+ readonly formatVersion: Schema.Natural;
1219
+ /** {@link protocolVersion} at save time. Recorded for diagnosis, not enforced. */
1220
+ readonly protocolVersion: Schema.Natural;
1221
+ readonly session: Schema.Struct<{
1222
+ readonly sessionId: Schema.String;
1223
+ readonly program: Schema.String;
1224
+ readonly pid: Schema.Natural;
1225
+ readonly runtime: Schema.String;
1226
+ readonly clock: Schema.Struct<{
1227
+ readonly startTime: Schema.BigIntFromString;
1228
+ readonly wallClockEpochMillis: Schema.Natural;
1229
+ }>;
1230
+ readonly active: Schema.Boolean;
1231
+ readonly endedAtEpochMillis: Schema.optional<Schema.Natural>;
1232
+ }>;
1233
+ readonly savedAtEpochMillis: Schema.Natural;
1234
+ }>;
1235
+ export type TraceFileHeader = Schema.Schema.Type<typeof TraceFileHeader>;
1236
+ /** The trace file layout version. Bump only on a change to the header or the line layout. */
1237
+ export declare const traceFileFormatVersion = 1;