@pome-sh/checks 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 (66) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +88 -0
  3. package/dist/_types/sdk/check-discrimination.d.ts +7 -0
  4. package/dist/_types/sdk/check-state-path.d.ts +71 -0
  5. package/dist/_types/sdk/checks.d.ts +93 -0
  6. package/dist/_types/sdk/db.d.ts +44 -0
  7. package/dist/_types/sdk/failure-injection-rules.d.ts +32 -0
  8. package/dist/_types/twin-github/src/check-kind.d.ts +3 -0
  9. package/dist/_types/twin-github/src/check-state.d.ts +77 -0
  10. package/dist/_types/twin-github/src/checks.d.ts +50 -0
  11. package/dist/_types/twin-github/src/seed.d.ts +92 -0
  12. package/dist/_types/twin-github/src/types.d.ts +244 -0
  13. package/dist/_types/twin-gmail/src/check-kind.d.ts +3 -0
  14. package/dist/_types/twin-gmail/src/check-state.d.ts +138 -0
  15. package/dist/_types/twin-gmail/src/checks.d.ts +19 -0
  16. package/dist/_types/twin-gmail/src/faults.d.ts +21 -0
  17. package/dist/_types/twin-gmail/src/seed.d.ts +247 -0
  18. package/dist/_types/twin-gmail/src/types.d.ts +150 -0
  19. package/dist/_types/twin-linear/src/check-kind.d.ts +3 -0
  20. package/dist/_types/twin-linear/src/check-state.d.ts +123 -0
  21. package/dist/_types/twin-linear/src/checks.d.ts +29 -0
  22. package/dist/_types/twin-linear/src/seed.d.ts +166 -0
  23. package/dist/_types/twin-linear/src/types.d.ts +366 -0
  24. package/dist/_types/twin-slack/src/check-kind.d.ts +3 -0
  25. package/dist/_types/twin-slack/src/check-state.d.ts +107 -0
  26. package/dist/_types/twin-slack/src/checks.d.ts +14 -0
  27. package/dist/_types/twin-slack/src/seed.d.ts +62 -0
  28. package/dist/_types/twin-slack/src/types.d.ts +182 -0
  29. package/dist/_types/twin-stripe/src/check-kind.d.ts +3 -0
  30. package/dist/_types/twin-stripe/src/check-state.d.ts +107 -0
  31. package/dist/_types/twin-stripe/src/checks.d.ts +22 -0
  32. package/dist/_types/twin-stripe/src/seed.d.ts +213 -0
  33. package/dist/_types/twin-stripe/src/types.d.ts +252 -0
  34. package/dist/_types/wire/index.d.ts +23 -0
  35. package/dist/_types/wire/otel/event-schema.d.ts +424 -0
  36. package/dist/_types/wire/otel/index.d.ts +25 -0
  37. package/dist/_types/wire/otel/legacy-shim.d.ts +105 -0
  38. package/dist/_types/wire/otel/map-span.d.ts +64 -0
  39. package/dist/_types/wire/otel/nano.d.ts +26 -0
  40. package/dist/_types/wire/otel/project.d.ts +42 -0
  41. package/dist/_types/wire/otel/semconv.d.ts +57 -0
  42. package/dist/_types/wire/otel/span-event.d.ts +198 -0
  43. package/dist/_types/wire/recorder-events.d.ts +526 -0
  44. package/dist/_types/wire/redaction.d.ts +2 -0
  45. package/dist/chunk-4WXX5VPA.js +238 -0
  46. package/dist/chunk-5SJ4PVO5.js +981 -0
  47. package/dist/chunk-GYFGMULG.js +1138 -0
  48. package/dist/chunk-IVENH4KX.js +814 -0
  49. package/dist/chunk-NORTPYDQ.js +1015 -0
  50. package/dist/chunk-SJ6SVRAA.js +432 -0
  51. package/dist/chunk-ZXE6LAM3.js +1 -0
  52. package/dist/dsl.d.ts +11 -0
  53. package/dist/dsl.js +2 -0
  54. package/dist/github.d.ts +2 -0
  55. package/dist/github.js +2 -0
  56. package/dist/gmail.d.ts +2 -0
  57. package/dist/gmail.js +2 -0
  58. package/dist/index.d.ts +163 -0
  59. package/dist/index.js +24 -0
  60. package/dist/linear.d.ts +2 -0
  61. package/dist/linear.js +2 -0
  62. package/dist/slack.d.ts +2 -0
  63. package/dist/slack.js +2 -0
  64. package/dist/stripe.d.ts +2 -0
  65. package/dist/stripe.js +2 -0
  66. package/package.json +93 -0
@@ -0,0 +1,526 @@
1
+ /**
2
+ * recorder-events — twin runtime trace format
3
+ *
4
+ * Single source of truth for the per-request event a twin runtime emits into
5
+ * its recorder ring buffer. Consumed by:
6
+ * - twin runtimes (`@pome-sh/twin-github`, `@pome-sh/twin-stripe`) — emit shape
7
+ * - `@pome-sh/sdk` — read shape for post-run analysis
8
+ * - `pome-cloud` correlator — input to trace correlation on ingest
9
+ * - `pome-cloud` recorder writers — persisted shape for events.jsonl S3 blob
10
+ *
11
+ * v1.0 freeze of the twin runtime trace format. Breaking changes go through a
12
+ * documented deprecation policy.
13
+ */
14
+ import { z } from "zod";
15
+ export declare const KNOWN_TWIN_IDS: readonly ["github", "stripe", "slack", "gmail", "linear"];
16
+ export type KnownTwinId = (typeof KNOWN_TWIN_IDS)[number];
17
+ export declare const twinIdSchema: z.ZodString;
18
+ export type TwinId = z.infer<typeof twinIdSchema>;
19
+ export declare const recorderFidelitySchema: z.ZodEnum<{
20
+ semantic: "semantic";
21
+ unsupported: "unsupported";
22
+ }>;
23
+ export type RecorderFidelity = z.infer<typeof recorderFidelitySchema>;
24
+ export declare const stateDeltaSchema: z.ZodNullable<z.ZodObject<{
25
+ before: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
26
+ after: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
27
+ }, z.core.$strip>>;
28
+ export type StateDelta = z.infer<typeof stateDeltaSchema>;
29
+ export declare const recorderEventSchema: z.ZodPipe<z.ZodObject<{
30
+ ts: z.ZodString;
31
+ run_id: z.ZodString;
32
+ twin: z.ZodString;
33
+ request_id: z.ZodString;
34
+ correlation_id: z.ZodOptional<z.ZodString>;
35
+ task_step_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ scenario_step_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
+ step_id: z.ZodNullable<z.ZodString>;
38
+ tool_call_id: z.ZodNullable<z.ZodString>;
39
+ method: z.ZodString;
40
+ path: z.ZodString;
41
+ request_body: z.ZodUnknown;
42
+ request_headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
43
+ tool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
44
+ status: z.ZodNumber;
45
+ response_body: z.ZodUnknown;
46
+ latency_ms: z.ZodNumber;
47
+ fidelity: z.ZodEnum<{
48
+ semantic: "semantic";
49
+ unsupported: "unsupported";
50
+ }>;
51
+ state_mutation: z.ZodBoolean;
52
+ state_delta: z.ZodNullable<z.ZodObject<{
53
+ before: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
54
+ after: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
55
+ }, z.core.$strip>>;
56
+ idempotency_dedupe: z.ZodOptional<z.ZodBoolean>;
57
+ error: z.ZodNullable<z.ZodString>;
58
+ }, z.core.$strip>, z.ZodTransform<{
59
+ ts: string;
60
+ run_id: string;
61
+ twin: string;
62
+ request_id: string;
63
+ step_id: string | null;
64
+ tool_call_id: string | null;
65
+ method: string;
66
+ path: string;
67
+ request_body: unknown;
68
+ status: number;
69
+ response_body: unknown;
70
+ latency_ms: number;
71
+ fidelity: "semantic" | "unsupported";
72
+ state_mutation: boolean;
73
+ state_delta: {
74
+ before: Record<string, unknown> | null;
75
+ after: Record<string, unknown> | null;
76
+ } | null;
77
+ error: string | null;
78
+ correlation_id?: string | undefined;
79
+ task_step_id?: string | null | undefined;
80
+ scenario_step_id?: string | null | undefined;
81
+ request_headers?: Record<string, string> | undefined;
82
+ tool?: string | null | undefined;
83
+ idempotency_dedupe?: boolean | undefined;
84
+ }, {
85
+ ts: string;
86
+ run_id: string;
87
+ twin: string;
88
+ request_id: string;
89
+ step_id: string | null;
90
+ tool_call_id: string | null;
91
+ method: string;
92
+ path: string;
93
+ request_body: unknown;
94
+ status: number;
95
+ response_body: unknown;
96
+ latency_ms: number;
97
+ fidelity: "semantic" | "unsupported";
98
+ state_mutation: boolean;
99
+ state_delta: {
100
+ before: Record<string, unknown> | null;
101
+ after: Record<string, unknown> | null;
102
+ } | null;
103
+ error: string | null;
104
+ correlation_id?: string | undefined;
105
+ task_step_id?: string | null | undefined;
106
+ scenario_step_id?: string | null | undefined;
107
+ request_headers?: Record<string, string> | undefined;
108
+ tool?: string | null | undefined;
109
+ idempotency_dedupe?: boolean | undefined;
110
+ }>>;
111
+ export type RecorderEvent = z.infer<typeof recorderEventSchema>;
112
+ export declare const twinHttpEventSchema: z.ZodObject<{
113
+ ts: z.ZodString;
114
+ run_id: z.ZodString;
115
+ twin: z.ZodString;
116
+ request_id: z.ZodString;
117
+ correlation_id: z.ZodOptional<z.ZodString>;
118
+ task_step_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
119
+ scenario_step_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
120
+ step_id: z.ZodNullable<z.ZodString>;
121
+ tool_call_id: z.ZodNullable<z.ZodString>;
122
+ method: z.ZodString;
123
+ path: z.ZodString;
124
+ request_body: z.ZodUnknown;
125
+ request_headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
126
+ tool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
127
+ status: z.ZodNumber;
128
+ response_body: z.ZodUnknown;
129
+ latency_ms: z.ZodNumber;
130
+ fidelity: z.ZodEnum<{
131
+ semantic: "semantic";
132
+ unsupported: "unsupported";
133
+ }>;
134
+ state_mutation: z.ZodBoolean;
135
+ state_delta: z.ZodNullable<z.ZodObject<{
136
+ before: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
137
+ after: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
138
+ }, z.core.$strip>>;
139
+ idempotency_dedupe: z.ZodOptional<z.ZodBoolean>;
140
+ error: z.ZodNullable<z.ZodString>;
141
+ kind: z.ZodLiteral<"TwinHttpEvent">;
142
+ event_id: z.ZodString;
143
+ parent_event_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
144
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
145
+ }, z.core.$strip>;
146
+ export type TwinHttpEvent = z.infer<typeof twinHttpEventSchema>;
147
+ export declare const llmCallEventSchema: z.ZodObject<{
148
+ kind: z.ZodLiteral<"LlmCallEvent">;
149
+ host: z.ZodString;
150
+ port: z.ZodNumber;
151
+ latency_ms: z.ZodNumber;
152
+ bytes_in: z.ZodNumber;
153
+ bytes_out: z.ZodNumber;
154
+ url: z.ZodNullable<z.ZodString>;
155
+ method: z.ZodNullable<z.ZodString>;
156
+ status: z.ZodNullable<z.ZodNumber>;
157
+ model: z.ZodNullable<z.ZodString>;
158
+ prompt_tokens: z.ZodNullable<z.ZodNumber>;
159
+ completion_tokens: z.ZodNullable<z.ZodNumber>;
160
+ cost_usd: z.ZodNullable<z.ZodNumber>;
161
+ ts: z.ZodString;
162
+ event_id: z.ZodString;
163
+ parent_event_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
164
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
165
+ }, z.core.$strip>;
166
+ export type LlmCallEvent = z.infer<typeof llmCallEventSchema>;
167
+ export declare const toolUseEventSchema: z.ZodObject<{
168
+ kind: z.ZodLiteral<"ToolUseEvent">;
169
+ tool_use_id: z.ZodString;
170
+ tool_name: z.ZodString;
171
+ input: z.ZodUnknown;
172
+ ts: z.ZodString;
173
+ event_id: z.ZodString;
174
+ parent_event_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
175
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
176
+ }, z.core.$strip>;
177
+ export type ToolUseEvent = z.infer<typeof toolUseEventSchema>;
178
+ export declare const toolResultEventSchema: z.ZodObject<{
179
+ kind: z.ZodLiteral<"ToolResultEvent">;
180
+ tool_use_id: z.ZodString;
181
+ output: z.ZodUnknown;
182
+ is_error: z.ZodBoolean;
183
+ ts: z.ZodString;
184
+ event_id: z.ZodString;
185
+ parent_event_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
186
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
187
+ }, z.core.$strip>;
188
+ export type ToolResultEvent = z.infer<typeof toolResultEventSchema>;
189
+ export declare const subagentSpawnEventSchema: z.ZodObject<{
190
+ kind: z.ZodLiteral<"SubagentSpawnEvent">;
191
+ parent_tool_use_id: z.ZodString;
192
+ ts: z.ZodString;
193
+ event_id: z.ZodString;
194
+ parent_event_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
195
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
196
+ }, z.core.$strip>;
197
+ export type SubagentSpawnEvent = z.infer<typeof subagentSpawnEventSchema>;
198
+ export declare const hookEventSchema: z.ZodObject<{
199
+ kind: z.ZodLiteral<"HookEvent">;
200
+ hook_name: z.ZodString;
201
+ tool_name: z.ZodNullable<z.ZodString>;
202
+ causing_tool_use_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
203
+ ts: z.ZodString;
204
+ event_id: z.ZodString;
205
+ parent_event_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
206
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
207
+ }, z.core.$strip>;
208
+ export type HookEvent = z.infer<typeof hookEventSchema>;
209
+ export declare const llmTurnEventSchema: z.ZodObject<{
210
+ kind: z.ZodLiteral<"LlmTurnEvent">;
211
+ turn_index: z.ZodNumber;
212
+ model: z.ZodNullable<z.ZodString>;
213
+ input_tokens: z.ZodNullable<z.ZodNumber>;
214
+ output_tokens: z.ZodNullable<z.ZodNumber>;
215
+ cache_read_input_tokens: z.ZodNullable<z.ZodNumber>;
216
+ cache_creation_input_tokens: z.ZodNullable<z.ZodNumber>;
217
+ finish_reasons: z.ZodNullable<z.ZodArray<z.ZodString>>;
218
+ latency_ms: z.ZodNumber;
219
+ latency_ms_estimated: z.ZodBoolean;
220
+ session_id: z.ZodNullable<z.ZodString>;
221
+ ts: z.ZodString;
222
+ event_id: z.ZodString;
223
+ parent_event_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
224
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
225
+ }, z.core.$strip>;
226
+ export type LlmTurnEvent = z.infer<typeof llmTurnEventSchema>;
227
+ export declare const eventSchema: z.ZodPipe<z.ZodDiscriminatedUnion<[z.ZodObject<{
228
+ ts: z.ZodString;
229
+ run_id: z.ZodString;
230
+ twin: z.ZodString;
231
+ request_id: z.ZodString;
232
+ correlation_id: z.ZodOptional<z.ZodString>;
233
+ task_step_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
234
+ scenario_step_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
235
+ step_id: z.ZodNullable<z.ZodString>;
236
+ tool_call_id: z.ZodNullable<z.ZodString>;
237
+ method: z.ZodString;
238
+ path: z.ZodString;
239
+ request_body: z.ZodUnknown;
240
+ request_headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
241
+ tool: z.ZodOptional<z.ZodNullable<z.ZodString>>;
242
+ status: z.ZodNumber;
243
+ response_body: z.ZodUnknown;
244
+ latency_ms: z.ZodNumber;
245
+ fidelity: z.ZodEnum<{
246
+ semantic: "semantic";
247
+ unsupported: "unsupported";
248
+ }>;
249
+ state_mutation: z.ZodBoolean;
250
+ state_delta: z.ZodNullable<z.ZodObject<{
251
+ before: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
252
+ after: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
253
+ }, z.core.$strip>>;
254
+ idempotency_dedupe: z.ZodOptional<z.ZodBoolean>;
255
+ error: z.ZodNullable<z.ZodString>;
256
+ kind: z.ZodLiteral<"TwinHttpEvent">;
257
+ event_id: z.ZodString;
258
+ parent_event_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
259
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
260
+ }, z.core.$strip>, z.ZodObject<{
261
+ kind: z.ZodLiteral<"LlmCallEvent">;
262
+ host: z.ZodString;
263
+ port: z.ZodNumber;
264
+ latency_ms: z.ZodNumber;
265
+ bytes_in: z.ZodNumber;
266
+ bytes_out: z.ZodNumber;
267
+ url: z.ZodNullable<z.ZodString>;
268
+ method: z.ZodNullable<z.ZodString>;
269
+ status: z.ZodNullable<z.ZodNumber>;
270
+ model: z.ZodNullable<z.ZodString>;
271
+ prompt_tokens: z.ZodNullable<z.ZodNumber>;
272
+ completion_tokens: z.ZodNullable<z.ZodNumber>;
273
+ cost_usd: z.ZodNullable<z.ZodNumber>;
274
+ ts: z.ZodString;
275
+ event_id: z.ZodString;
276
+ parent_event_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
277
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
278
+ }, z.core.$strip>, z.ZodObject<{
279
+ kind: z.ZodLiteral<"ToolUseEvent">;
280
+ tool_use_id: z.ZodString;
281
+ tool_name: z.ZodString;
282
+ input: z.ZodUnknown;
283
+ ts: z.ZodString;
284
+ event_id: z.ZodString;
285
+ parent_event_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
286
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
287
+ }, z.core.$strip>, z.ZodObject<{
288
+ kind: z.ZodLiteral<"ToolResultEvent">;
289
+ tool_use_id: z.ZodString;
290
+ output: z.ZodUnknown;
291
+ is_error: z.ZodBoolean;
292
+ ts: z.ZodString;
293
+ event_id: z.ZodString;
294
+ parent_event_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
295
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
296
+ }, z.core.$strip>, z.ZodObject<{
297
+ kind: z.ZodLiteral<"SubagentSpawnEvent">;
298
+ parent_tool_use_id: z.ZodString;
299
+ ts: z.ZodString;
300
+ event_id: z.ZodString;
301
+ parent_event_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
302
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
303
+ }, z.core.$strip>, z.ZodObject<{
304
+ kind: z.ZodLiteral<"HookEvent">;
305
+ hook_name: z.ZodString;
306
+ tool_name: z.ZodNullable<z.ZodString>;
307
+ causing_tool_use_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
308
+ ts: z.ZodString;
309
+ event_id: z.ZodString;
310
+ parent_event_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
311
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
312
+ }, z.core.$strip>, z.ZodObject<{
313
+ kind: z.ZodLiteral<"LlmTurnEvent">;
314
+ turn_index: z.ZodNumber;
315
+ model: z.ZodNullable<z.ZodString>;
316
+ input_tokens: z.ZodNullable<z.ZodNumber>;
317
+ output_tokens: z.ZodNullable<z.ZodNumber>;
318
+ cache_read_input_tokens: z.ZodNullable<z.ZodNumber>;
319
+ cache_creation_input_tokens: z.ZodNullable<z.ZodNumber>;
320
+ finish_reasons: z.ZodNullable<z.ZodArray<z.ZodString>>;
321
+ latency_ms: z.ZodNumber;
322
+ latency_ms_estimated: z.ZodBoolean;
323
+ session_id: z.ZodNullable<z.ZodString>;
324
+ ts: z.ZodString;
325
+ event_id: z.ZodString;
326
+ parent_event_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
327
+ parent_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
328
+ }, z.core.$strip>], "kind">, z.ZodTransform<{
329
+ ts: string;
330
+ run_id: string;
331
+ twin: string;
332
+ request_id: string;
333
+ step_id: string | null;
334
+ tool_call_id: string | null;
335
+ method: string;
336
+ path: string;
337
+ request_body: unknown;
338
+ status: number;
339
+ response_body: unknown;
340
+ latency_ms: number;
341
+ fidelity: "semantic" | "unsupported";
342
+ state_mutation: boolean;
343
+ state_delta: {
344
+ before: Record<string, unknown> | null;
345
+ after: Record<string, unknown> | null;
346
+ } | null;
347
+ error: string | null;
348
+ kind: "TwinHttpEvent";
349
+ event_id: string;
350
+ correlation_id?: string | undefined;
351
+ task_step_id?: string | null | undefined;
352
+ scenario_step_id?: string | null | undefined;
353
+ request_headers?: Record<string, string> | undefined;
354
+ tool?: string | null | undefined;
355
+ idempotency_dedupe?: boolean | undefined;
356
+ parent_event_id?: string | null | undefined;
357
+ parent_id?: string | null | undefined;
358
+ } | {
359
+ kind: "LlmCallEvent";
360
+ host: string;
361
+ port: number;
362
+ latency_ms: number;
363
+ bytes_in: number;
364
+ bytes_out: number;
365
+ url: string | null;
366
+ method: string | null;
367
+ status: number | null;
368
+ model: string | null;
369
+ prompt_tokens: number | null;
370
+ completion_tokens: number | null;
371
+ cost_usd: number | null;
372
+ ts: string;
373
+ event_id: string;
374
+ parent_event_id?: string | null | undefined;
375
+ parent_id?: string | null | undefined;
376
+ } | {
377
+ kind: "ToolUseEvent";
378
+ tool_use_id: string;
379
+ tool_name: string;
380
+ input: unknown;
381
+ ts: string;
382
+ event_id: string;
383
+ parent_event_id?: string | null | undefined;
384
+ parent_id?: string | null | undefined;
385
+ } | {
386
+ kind: "ToolResultEvent";
387
+ tool_use_id: string;
388
+ output: unknown;
389
+ is_error: boolean;
390
+ ts: string;
391
+ event_id: string;
392
+ parent_event_id?: string | null | undefined;
393
+ parent_id?: string | null | undefined;
394
+ } | {
395
+ kind: "SubagentSpawnEvent";
396
+ parent_tool_use_id: string;
397
+ ts: string;
398
+ event_id: string;
399
+ parent_event_id?: string | null | undefined;
400
+ parent_id?: string | null | undefined;
401
+ } | {
402
+ kind: "HookEvent";
403
+ hook_name: string;
404
+ tool_name: string | null;
405
+ ts: string;
406
+ event_id: string;
407
+ causing_tool_use_id?: string | null | undefined;
408
+ parent_event_id?: string | null | undefined;
409
+ parent_id?: string | null | undefined;
410
+ } | {
411
+ kind: "LlmTurnEvent";
412
+ turn_index: number;
413
+ model: string | null;
414
+ input_tokens: number | null;
415
+ output_tokens: number | null;
416
+ cache_read_input_tokens: number | null;
417
+ cache_creation_input_tokens: number | null;
418
+ finish_reasons: string[] | null;
419
+ latency_ms: number;
420
+ latency_ms_estimated: boolean;
421
+ session_id: string | null;
422
+ ts: string;
423
+ event_id: string;
424
+ parent_event_id?: string | null | undefined;
425
+ parent_id?: string | null | undefined;
426
+ }, {
427
+ ts: string;
428
+ run_id: string;
429
+ twin: string;
430
+ request_id: string;
431
+ step_id: string | null;
432
+ tool_call_id: string | null;
433
+ method: string;
434
+ path: string;
435
+ request_body: unknown;
436
+ status: number;
437
+ response_body: unknown;
438
+ latency_ms: number;
439
+ fidelity: "semantic" | "unsupported";
440
+ state_mutation: boolean;
441
+ state_delta: {
442
+ before: Record<string, unknown> | null;
443
+ after: Record<string, unknown> | null;
444
+ } | null;
445
+ error: string | null;
446
+ kind: "TwinHttpEvent";
447
+ event_id: string;
448
+ correlation_id?: string | undefined;
449
+ task_step_id?: string | null | undefined;
450
+ scenario_step_id?: string | null | undefined;
451
+ request_headers?: Record<string, string> | undefined;
452
+ tool?: string | null | undefined;
453
+ idempotency_dedupe?: boolean | undefined;
454
+ parent_event_id?: string | null | undefined;
455
+ parent_id?: string | null | undefined;
456
+ } | {
457
+ kind: "LlmCallEvent";
458
+ host: string;
459
+ port: number;
460
+ latency_ms: number;
461
+ bytes_in: number;
462
+ bytes_out: number;
463
+ url: string | null;
464
+ method: string | null;
465
+ status: number | null;
466
+ model: string | null;
467
+ prompt_tokens: number | null;
468
+ completion_tokens: number | null;
469
+ cost_usd: number | null;
470
+ ts: string;
471
+ event_id: string;
472
+ parent_event_id?: string | null | undefined;
473
+ parent_id?: string | null | undefined;
474
+ } | {
475
+ kind: "ToolUseEvent";
476
+ tool_use_id: string;
477
+ tool_name: string;
478
+ input: unknown;
479
+ ts: string;
480
+ event_id: string;
481
+ parent_event_id?: string | null | undefined;
482
+ parent_id?: string | null | undefined;
483
+ } | {
484
+ kind: "ToolResultEvent";
485
+ tool_use_id: string;
486
+ output: unknown;
487
+ is_error: boolean;
488
+ ts: string;
489
+ event_id: string;
490
+ parent_event_id?: string | null | undefined;
491
+ parent_id?: string | null | undefined;
492
+ } | {
493
+ kind: "SubagentSpawnEvent";
494
+ parent_tool_use_id: string;
495
+ ts: string;
496
+ event_id: string;
497
+ parent_event_id?: string | null | undefined;
498
+ parent_id?: string | null | undefined;
499
+ } | {
500
+ kind: "HookEvent";
501
+ hook_name: string;
502
+ tool_name: string | null;
503
+ ts: string;
504
+ event_id: string;
505
+ causing_tool_use_id?: string | null | undefined;
506
+ parent_event_id?: string | null | undefined;
507
+ parent_id?: string | null | undefined;
508
+ } | {
509
+ kind: "LlmTurnEvent";
510
+ turn_index: number;
511
+ model: string | null;
512
+ input_tokens: number | null;
513
+ output_tokens: number | null;
514
+ cache_read_input_tokens: number | null;
515
+ cache_creation_input_tokens: number | null;
516
+ finish_reasons: string[] | null;
517
+ latency_ms: number;
518
+ latency_ms_estimated: boolean;
519
+ session_id: string | null;
520
+ ts: string;
521
+ event_id: string;
522
+ parent_event_id?: string | null | undefined;
523
+ parent_id?: string | null | undefined;
524
+ }>>;
525
+ export type Event = z.infer<typeof eventSchema>;
526
+ export declare function isLegacyEventRow(row: unknown): boolean;
@@ -0,0 +1,2 @@
1
+ export declare function redactSecrets(value: unknown): unknown;
2
+ export declare function redactEvent<T>(event: T): T;