@cultured_computer/sight 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +120 -28
- package/dist/cli.js +198 -7
- package/dist/index.cjs +332 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +827 -29
- package/dist/index.d.ts +827 -29
- package/dist/index.js +322 -41
- package/dist/index.js.map +1 -1
- package/package.json +12 -11
package/dist/index.d.cts
CHANGED
|
@@ -196,7 +196,49 @@ declare const EnvironmentEventsBatchSchema: z.ZodObject<{
|
|
|
196
196
|
};
|
|
197
197
|
}>;
|
|
198
198
|
type EnvironmentEventsBatch = z.infer<typeof EnvironmentEventsBatchSchema>;
|
|
199
|
-
declare const
|
|
199
|
+
declare const SPAN_TYPES: readonly ["agent_call", "llm_call", "tool_call", "framework_step", "custom"];
|
|
200
|
+
type SpanType = (typeof SPAN_TYPES)[number];
|
|
201
|
+
declare const SPAN_STATUSES: readonly ["unset", "ok", "error"];
|
|
202
|
+
type SpanStatus = (typeof SPAN_STATUSES)[number];
|
|
203
|
+
declare const SPAN_V2_STATUSES: readonly ["ok", "error"];
|
|
204
|
+
declare const SPAN_PAYLOAD_STATES: readonly ["captured", "empty", "not_captured", "redacted", "unavailable"];
|
|
205
|
+
type SpanPayloadState = (typeof SPAN_PAYLOAD_STATES)[number];
|
|
206
|
+
interface SpanPayload {
|
|
207
|
+
state: SpanPayloadState;
|
|
208
|
+
value: unknown;
|
|
209
|
+
}
|
|
210
|
+
declare const SPAN_INTERVAL_KINDS: readonly ["active", "waiting", "retry", "error"];
|
|
211
|
+
type SpanIntervalKind = (typeof SPAN_INTERVAL_KINDS)[number];
|
|
212
|
+
interface SpanInterval {
|
|
213
|
+
kind: SpanIntervalKind;
|
|
214
|
+
startedAt: string;
|
|
215
|
+
endedAt: string;
|
|
216
|
+
}
|
|
217
|
+
declare const SpanIntervalSchema: z.ZodEffects<z.ZodObject<{
|
|
218
|
+
kind: z.ZodEnum<["active", "waiting", "retry", "error"]>;
|
|
219
|
+
startedAt: z.ZodString;
|
|
220
|
+
endedAt: z.ZodString;
|
|
221
|
+
}, "strip", z.ZodTypeAny, {
|
|
222
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
223
|
+
startedAt: string;
|
|
224
|
+
endedAt: string;
|
|
225
|
+
}, {
|
|
226
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
227
|
+
startedAt: string;
|
|
228
|
+
endedAt: string;
|
|
229
|
+
}>, {
|
|
230
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
231
|
+
startedAt: string;
|
|
232
|
+
endedAt: string;
|
|
233
|
+
}, {
|
|
234
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
235
|
+
startedAt: string;
|
|
236
|
+
endedAt: string;
|
|
237
|
+
}>;
|
|
238
|
+
declare const SpanPayloadSchema: z.ZodType<SpanPayload>;
|
|
239
|
+
/** Legacy span wire shape. Kept as an explicit compatibility lane while SDK
|
|
240
|
+
* callers migrate to the versioned v2 telemetry contract. */
|
|
241
|
+
declare const SpanInputV1Schema: z.ZodObject<{
|
|
200
242
|
deploymentSlug: z.ZodString;
|
|
201
243
|
sessionExternalId: z.ZodString;
|
|
202
244
|
/**
|
|
@@ -207,7 +249,9 @@ declare const SpanInputSchema: z.ZodObject<{
|
|
|
207
249
|
* worker (logged, batch still processed): spans never land unattributed.
|
|
208
250
|
*/
|
|
209
251
|
turnIndex: z.ZodOptional<z.ZodNumber>;
|
|
210
|
-
spanType: z.ZodEnum<["llm_call", "tool_call", "framework_step", "custom"]>;
|
|
252
|
+
spanType: z.ZodEnum<["agent_call", "llm_call", "tool_call", "framework_step", "custom"]>;
|
|
253
|
+
} & {
|
|
254
|
+
contractVersion: z.ZodOptional<z.ZodLiteral<1>>;
|
|
211
255
|
/** Human/otel-style span name (tool name, model call label). */
|
|
212
256
|
name: z.ZodOptional<z.ZodString>;
|
|
213
257
|
/**
|
|
@@ -245,44 +289,462 @@ declare const SpanInputSchema: z.ZodObject<{
|
|
|
245
289
|
}, "strip", z.ZodTypeAny, {
|
|
246
290
|
deploymentSlug: string;
|
|
247
291
|
sessionExternalId: string;
|
|
248
|
-
spanType: "tool_call" | "custom" | "llm_call" | "framework_step";
|
|
292
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
293
|
+
error?: string | undefined;
|
|
249
294
|
name?: string | undefined;
|
|
250
295
|
turnIndex?: number | undefined;
|
|
251
296
|
startedAt?: string | undefined;
|
|
252
297
|
endedAt?: string | undefined;
|
|
298
|
+
contractVersion?: 1 | undefined;
|
|
253
299
|
durationMs?: number | undefined;
|
|
254
300
|
model?: string | undefined;
|
|
255
301
|
provider?: string | undefined;
|
|
256
302
|
tokensInput?: number | undefined;
|
|
257
303
|
tokensOutput?: number | undefined;
|
|
258
304
|
costUsd?: number | undefined;
|
|
305
|
+
attributes?: Record<string, unknown> | undefined;
|
|
306
|
+
spanId?: string | undefined;
|
|
307
|
+
parentSpanId?: string | undefined;
|
|
308
|
+
}, {
|
|
309
|
+
deploymentSlug: string;
|
|
310
|
+
sessionExternalId: string;
|
|
311
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
259
312
|
error?: string | undefined;
|
|
313
|
+
name?: string | undefined;
|
|
314
|
+
turnIndex?: number | undefined;
|
|
315
|
+
startedAt?: string | undefined;
|
|
316
|
+
endedAt?: string | undefined;
|
|
317
|
+
contractVersion?: 1 | undefined;
|
|
318
|
+
durationMs?: number | undefined;
|
|
319
|
+
model?: string | undefined;
|
|
320
|
+
provider?: string | undefined;
|
|
321
|
+
tokensInput?: number | undefined;
|
|
322
|
+
tokensOutput?: number | undefined;
|
|
323
|
+
costUsd?: number | undefined;
|
|
260
324
|
attributes?: Record<string, unknown> | undefined;
|
|
261
325
|
spanId?: string | undefined;
|
|
262
326
|
parentSpanId?: string | undefined;
|
|
327
|
+
}>;
|
|
328
|
+
/** First-class span telemetry. Every operational key exists on every agent,
|
|
329
|
+
* tool and model span; null means unknown rather than a fabricated zero. */
|
|
330
|
+
declare const SpanInputV2Schema: z.ZodEffects<z.ZodObject<{
|
|
331
|
+
deploymentSlug: z.ZodString;
|
|
332
|
+
sessionExternalId: z.ZodString;
|
|
333
|
+
/**
|
|
334
|
+
* Turn the span belongs to. Optional: when omitted the worker resolves the
|
|
335
|
+
* session's latest turn at/under the span's startedAt (falling back to the
|
|
336
|
+
* session's most recent turn when startedAt is also absent — the outcome
|
|
337
|
+
* events' rule). A span whose turn cannot be resolved is SKIPPED by the
|
|
338
|
+
* worker (logged, batch still processed): spans never land unattributed.
|
|
339
|
+
*/
|
|
340
|
+
turnIndex: z.ZodOptional<z.ZodNumber>;
|
|
341
|
+
spanType: z.ZodEnum<["agent_call", "llm_call", "tool_call", "framework_step", "custom"]>;
|
|
342
|
+
} & {
|
|
343
|
+
contractVersion: z.ZodLiteral<2>;
|
|
344
|
+
/** Stable within a deployment/session across batches and retries. */
|
|
345
|
+
spanId: z.ZodString;
|
|
346
|
+
parentSpanId: z.ZodNullable<z.ZodString>;
|
|
347
|
+
name: z.ZodString;
|
|
348
|
+
status: z.ZodEnum<["ok", "error"]>;
|
|
349
|
+
startedAt: z.ZodString;
|
|
350
|
+
endedAt: z.ZodNullable<z.ZodString>;
|
|
351
|
+
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
352
|
+
model: z.ZodNullable<z.ZodString>;
|
|
353
|
+
provider: z.ZodNullable<z.ZodString>;
|
|
354
|
+
tokensInput: z.ZodNullable<z.ZodNumber>;
|
|
355
|
+
tokensOutput: z.ZodNullable<z.ZodNumber>;
|
|
356
|
+
costUsd: z.ZodNullable<z.ZodNumber>;
|
|
357
|
+
error: z.ZodNullable<z.ZodString>;
|
|
358
|
+
input: z.ZodType<SpanPayload, z.ZodTypeDef, SpanPayload>;
|
|
359
|
+
output: z.ZodType<SpanPayload, z.ZodTypeDef, SpanPayload>;
|
|
360
|
+
/** Optional first-class internal timing. An omitted list means the source
|
|
361
|
+
* did not capture interval telemetry; readers must not infer segments. */
|
|
362
|
+
intervals: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
363
|
+
kind: z.ZodEnum<["active", "waiting", "retry", "error"]>;
|
|
364
|
+
startedAt: z.ZodString;
|
|
365
|
+
endedAt: z.ZodString;
|
|
366
|
+
}, "strip", z.ZodTypeAny, {
|
|
367
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
368
|
+
startedAt: string;
|
|
369
|
+
endedAt: string;
|
|
370
|
+
}, {
|
|
371
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
372
|
+
startedAt: string;
|
|
373
|
+
endedAt: string;
|
|
374
|
+
}>, {
|
|
375
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
376
|
+
startedAt: string;
|
|
377
|
+
endedAt: string;
|
|
378
|
+
}, {
|
|
379
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
380
|
+
startedAt: string;
|
|
381
|
+
endedAt: string;
|
|
382
|
+
}>, "many">>;
|
|
383
|
+
attributes: z.ZodEffects<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>, Record<string, unknown> | null, Record<string, unknown> | null>;
|
|
384
|
+
}, "strip", z.ZodTypeAny, {
|
|
385
|
+
error: string | null;
|
|
386
|
+
status: "ok" | "error";
|
|
387
|
+
name: string;
|
|
388
|
+
deploymentSlug: string;
|
|
389
|
+
sessionExternalId: string;
|
|
390
|
+
startedAt: string;
|
|
391
|
+
endedAt: string | null;
|
|
392
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
393
|
+
contractVersion: 2;
|
|
394
|
+
durationMs: number | null;
|
|
395
|
+
model: string | null;
|
|
396
|
+
provider: string | null;
|
|
397
|
+
tokensInput: number | null;
|
|
398
|
+
tokensOutput: number | null;
|
|
399
|
+
costUsd: number | null;
|
|
400
|
+
attributes: Record<string, unknown> | null;
|
|
401
|
+
spanId: string;
|
|
402
|
+
parentSpanId: string | null;
|
|
403
|
+
input: SpanPayload;
|
|
404
|
+
output: SpanPayload;
|
|
405
|
+
turnIndex?: number | undefined;
|
|
406
|
+
intervals?: {
|
|
407
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
408
|
+
startedAt: string;
|
|
409
|
+
endedAt: string;
|
|
410
|
+
}[] | undefined;
|
|
411
|
+
}, {
|
|
412
|
+
error: string | null;
|
|
413
|
+
status: "ok" | "error";
|
|
414
|
+
name: string;
|
|
415
|
+
deploymentSlug: string;
|
|
416
|
+
sessionExternalId: string;
|
|
417
|
+
startedAt: string;
|
|
418
|
+
endedAt: string | null;
|
|
419
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
420
|
+
contractVersion: 2;
|
|
421
|
+
durationMs: number | null;
|
|
422
|
+
model: string | null;
|
|
423
|
+
provider: string | null;
|
|
424
|
+
tokensInput: number | null;
|
|
425
|
+
tokensOutput: number | null;
|
|
426
|
+
costUsd: number | null;
|
|
427
|
+
attributes: Record<string, unknown> | null;
|
|
428
|
+
spanId: string;
|
|
429
|
+
parentSpanId: string | null;
|
|
430
|
+
input: SpanPayload;
|
|
431
|
+
output: SpanPayload;
|
|
432
|
+
turnIndex?: number | undefined;
|
|
433
|
+
intervals?: {
|
|
434
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
435
|
+
startedAt: string;
|
|
436
|
+
endedAt: string;
|
|
437
|
+
}[] | undefined;
|
|
438
|
+
}>, {
|
|
439
|
+
error: string | null;
|
|
440
|
+
status: "ok" | "error";
|
|
441
|
+
name: string;
|
|
442
|
+
deploymentSlug: string;
|
|
443
|
+
sessionExternalId: string;
|
|
444
|
+
startedAt: string;
|
|
445
|
+
endedAt: string | null;
|
|
446
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
447
|
+
contractVersion: 2;
|
|
448
|
+
durationMs: number | null;
|
|
449
|
+
model: string | null;
|
|
450
|
+
provider: string | null;
|
|
451
|
+
tokensInput: number | null;
|
|
452
|
+
tokensOutput: number | null;
|
|
453
|
+
costUsd: number | null;
|
|
454
|
+
attributes: Record<string, unknown> | null;
|
|
455
|
+
spanId: string;
|
|
456
|
+
parentSpanId: string | null;
|
|
457
|
+
input: SpanPayload;
|
|
458
|
+
output: SpanPayload;
|
|
459
|
+
turnIndex?: number | undefined;
|
|
460
|
+
intervals?: {
|
|
461
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
462
|
+
startedAt: string;
|
|
463
|
+
endedAt: string;
|
|
464
|
+
}[] | undefined;
|
|
465
|
+
}, {
|
|
466
|
+
error: string | null;
|
|
467
|
+
status: "ok" | "error";
|
|
468
|
+
name: string;
|
|
469
|
+
deploymentSlug: string;
|
|
470
|
+
sessionExternalId: string;
|
|
471
|
+
startedAt: string;
|
|
472
|
+
endedAt: string | null;
|
|
473
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
474
|
+
contractVersion: 2;
|
|
475
|
+
durationMs: number | null;
|
|
476
|
+
model: string | null;
|
|
477
|
+
provider: string | null;
|
|
478
|
+
tokensInput: number | null;
|
|
479
|
+
tokensOutput: number | null;
|
|
480
|
+
costUsd: number | null;
|
|
481
|
+
attributes: Record<string, unknown> | null;
|
|
482
|
+
spanId: string;
|
|
483
|
+
parentSpanId: string | null;
|
|
484
|
+
input: SpanPayload;
|
|
485
|
+
output: SpanPayload;
|
|
486
|
+
turnIndex?: number | undefined;
|
|
487
|
+
intervals?: {
|
|
488
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
489
|
+
startedAt: string;
|
|
490
|
+
endedAt: string;
|
|
491
|
+
}[] | undefined;
|
|
492
|
+
}>;
|
|
493
|
+
declare const SpanInputSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<{
|
|
494
|
+
deploymentSlug: z.ZodString;
|
|
495
|
+
sessionExternalId: z.ZodString;
|
|
496
|
+
/**
|
|
497
|
+
* Turn the span belongs to. Optional: when omitted the worker resolves the
|
|
498
|
+
* session's latest turn at/under the span's startedAt (falling back to the
|
|
499
|
+
* session's most recent turn when startedAt is also absent — the outcome
|
|
500
|
+
* events' rule). A span whose turn cannot be resolved is SKIPPED by the
|
|
501
|
+
* worker (logged, batch still processed): spans never land unattributed.
|
|
502
|
+
*/
|
|
503
|
+
turnIndex: z.ZodOptional<z.ZodNumber>;
|
|
504
|
+
spanType: z.ZodEnum<["agent_call", "llm_call", "tool_call", "framework_step", "custom"]>;
|
|
505
|
+
} & {
|
|
506
|
+
contractVersion: z.ZodLiteral<2>;
|
|
507
|
+
/** Stable within a deployment/session across batches and retries. */
|
|
508
|
+
spanId: z.ZodString;
|
|
509
|
+
parentSpanId: z.ZodNullable<z.ZodString>;
|
|
510
|
+
name: z.ZodString;
|
|
511
|
+
status: z.ZodEnum<["ok", "error"]>;
|
|
512
|
+
startedAt: z.ZodString;
|
|
513
|
+
endedAt: z.ZodNullable<z.ZodString>;
|
|
514
|
+
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
515
|
+
model: z.ZodNullable<z.ZodString>;
|
|
516
|
+
provider: z.ZodNullable<z.ZodString>;
|
|
517
|
+
tokensInput: z.ZodNullable<z.ZodNumber>;
|
|
518
|
+
tokensOutput: z.ZodNullable<z.ZodNumber>;
|
|
519
|
+
costUsd: z.ZodNullable<z.ZodNumber>;
|
|
520
|
+
error: z.ZodNullable<z.ZodString>;
|
|
521
|
+
input: z.ZodType<SpanPayload, z.ZodTypeDef, SpanPayload>;
|
|
522
|
+
output: z.ZodType<SpanPayload, z.ZodTypeDef, SpanPayload>;
|
|
523
|
+
/** Optional first-class internal timing. An omitted list means the source
|
|
524
|
+
* did not capture interval telemetry; readers must not infer segments. */
|
|
525
|
+
intervals: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
526
|
+
kind: z.ZodEnum<["active", "waiting", "retry", "error"]>;
|
|
527
|
+
startedAt: z.ZodString;
|
|
528
|
+
endedAt: z.ZodString;
|
|
529
|
+
}, "strip", z.ZodTypeAny, {
|
|
530
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
531
|
+
startedAt: string;
|
|
532
|
+
endedAt: string;
|
|
533
|
+
}, {
|
|
534
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
535
|
+
startedAt: string;
|
|
536
|
+
endedAt: string;
|
|
537
|
+
}>, {
|
|
538
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
539
|
+
startedAt: string;
|
|
540
|
+
endedAt: string;
|
|
541
|
+
}, {
|
|
542
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
543
|
+
startedAt: string;
|
|
544
|
+
endedAt: string;
|
|
545
|
+
}>, "many">>;
|
|
546
|
+
attributes: z.ZodEffects<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>, Record<string, unknown> | null, Record<string, unknown> | null>;
|
|
547
|
+
}, "strip", z.ZodTypeAny, {
|
|
548
|
+
error: string | null;
|
|
549
|
+
status: "ok" | "error";
|
|
550
|
+
name: string;
|
|
551
|
+
deploymentSlug: string;
|
|
552
|
+
sessionExternalId: string;
|
|
553
|
+
startedAt: string;
|
|
554
|
+
endedAt: string | null;
|
|
555
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
556
|
+
contractVersion: 2;
|
|
557
|
+
durationMs: number | null;
|
|
558
|
+
model: string | null;
|
|
559
|
+
provider: string | null;
|
|
560
|
+
tokensInput: number | null;
|
|
561
|
+
tokensOutput: number | null;
|
|
562
|
+
costUsd: number | null;
|
|
563
|
+
attributes: Record<string, unknown> | null;
|
|
564
|
+
spanId: string;
|
|
565
|
+
parentSpanId: string | null;
|
|
566
|
+
input: SpanPayload;
|
|
567
|
+
output: SpanPayload;
|
|
568
|
+
turnIndex?: number | undefined;
|
|
569
|
+
intervals?: {
|
|
570
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
571
|
+
startedAt: string;
|
|
572
|
+
endedAt: string;
|
|
573
|
+
}[] | undefined;
|
|
574
|
+
}, {
|
|
575
|
+
error: string | null;
|
|
576
|
+
status: "ok" | "error";
|
|
577
|
+
name: string;
|
|
578
|
+
deploymentSlug: string;
|
|
579
|
+
sessionExternalId: string;
|
|
580
|
+
startedAt: string;
|
|
581
|
+
endedAt: string | null;
|
|
582
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
583
|
+
contractVersion: 2;
|
|
584
|
+
durationMs: number | null;
|
|
585
|
+
model: string | null;
|
|
586
|
+
provider: string | null;
|
|
587
|
+
tokensInput: number | null;
|
|
588
|
+
tokensOutput: number | null;
|
|
589
|
+
costUsd: number | null;
|
|
590
|
+
attributes: Record<string, unknown> | null;
|
|
591
|
+
spanId: string;
|
|
592
|
+
parentSpanId: string | null;
|
|
593
|
+
input: SpanPayload;
|
|
594
|
+
output: SpanPayload;
|
|
595
|
+
turnIndex?: number | undefined;
|
|
596
|
+
intervals?: {
|
|
597
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
598
|
+
startedAt: string;
|
|
599
|
+
endedAt: string;
|
|
600
|
+
}[] | undefined;
|
|
601
|
+
}>, {
|
|
602
|
+
error: string | null;
|
|
603
|
+
status: "ok" | "error";
|
|
604
|
+
name: string;
|
|
605
|
+
deploymentSlug: string;
|
|
606
|
+
sessionExternalId: string;
|
|
607
|
+
startedAt: string;
|
|
608
|
+
endedAt: string | null;
|
|
609
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
610
|
+
contractVersion: 2;
|
|
611
|
+
durationMs: number | null;
|
|
612
|
+
model: string | null;
|
|
613
|
+
provider: string | null;
|
|
614
|
+
tokensInput: number | null;
|
|
615
|
+
tokensOutput: number | null;
|
|
616
|
+
costUsd: number | null;
|
|
617
|
+
attributes: Record<string, unknown> | null;
|
|
618
|
+
spanId: string;
|
|
619
|
+
parentSpanId: string | null;
|
|
620
|
+
input: SpanPayload;
|
|
621
|
+
output: SpanPayload;
|
|
622
|
+
turnIndex?: number | undefined;
|
|
623
|
+
intervals?: {
|
|
624
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
625
|
+
startedAt: string;
|
|
626
|
+
endedAt: string;
|
|
627
|
+
}[] | undefined;
|
|
263
628
|
}, {
|
|
629
|
+
error: string | null;
|
|
630
|
+
status: "ok" | "error";
|
|
631
|
+
name: string;
|
|
632
|
+
deploymentSlug: string;
|
|
633
|
+
sessionExternalId: string;
|
|
634
|
+
startedAt: string;
|
|
635
|
+
endedAt: string | null;
|
|
636
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
637
|
+
contractVersion: 2;
|
|
638
|
+
durationMs: number | null;
|
|
639
|
+
model: string | null;
|
|
640
|
+
provider: string | null;
|
|
641
|
+
tokensInput: number | null;
|
|
642
|
+
tokensOutput: number | null;
|
|
643
|
+
costUsd: number | null;
|
|
644
|
+
attributes: Record<string, unknown> | null;
|
|
645
|
+
spanId: string;
|
|
646
|
+
parentSpanId: string | null;
|
|
647
|
+
input: SpanPayload;
|
|
648
|
+
output: SpanPayload;
|
|
649
|
+
turnIndex?: number | undefined;
|
|
650
|
+
intervals?: {
|
|
651
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
652
|
+
startedAt: string;
|
|
653
|
+
endedAt: string;
|
|
654
|
+
}[] | undefined;
|
|
655
|
+
}>, z.ZodObject<{
|
|
656
|
+
deploymentSlug: z.ZodString;
|
|
657
|
+
sessionExternalId: z.ZodString;
|
|
658
|
+
/**
|
|
659
|
+
* Turn the span belongs to. Optional: when omitted the worker resolves the
|
|
660
|
+
* session's latest turn at/under the span's startedAt (falling back to the
|
|
661
|
+
* session's most recent turn when startedAt is also absent — the outcome
|
|
662
|
+
* events' rule). A span whose turn cannot be resolved is SKIPPED by the
|
|
663
|
+
* worker (logged, batch still processed): spans never land unattributed.
|
|
664
|
+
*/
|
|
665
|
+
turnIndex: z.ZodOptional<z.ZodNumber>;
|
|
666
|
+
spanType: z.ZodEnum<["agent_call", "llm_call", "tool_call", "framework_step", "custom"]>;
|
|
667
|
+
} & {
|
|
668
|
+
contractVersion: z.ZodOptional<z.ZodLiteral<1>>;
|
|
669
|
+
/** Human/otel-style span name (tool name, model call label). */
|
|
670
|
+
name: z.ZodOptional<z.ZodString>;
|
|
671
|
+
/**
|
|
672
|
+
* Caller-asserted span start (ISO). OPTIONAL and honored like
|
|
673
|
+
* TurnInput.startedAt: provenance, not verification — when absent the
|
|
674
|
+
* worker stamps processing time.
|
|
675
|
+
*/
|
|
676
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
677
|
+
endedAt: z.ZodOptional<z.ZodString>;
|
|
678
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
679
|
+
model: z.ZodOptional<z.ZodString>;
|
|
680
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
681
|
+
tokensInput: z.ZodOptional<z.ZodNumber>;
|
|
682
|
+
tokensOutput: z.ZodOptional<z.ZodNumber>;
|
|
683
|
+
costUsd: z.ZodOptional<z.ZodNumber>;
|
|
684
|
+
error: z.ZodOptional<z.ZodString>;
|
|
685
|
+
/**
|
|
686
|
+
* OpenInference / OpenTelemetry gen_ai.*-style attributes. String values
|
|
687
|
+
* are Presidio-scrubbed by the worker before storage (see the PII rule
|
|
688
|
+
* above). Capped at 16k JSON chars per span.
|
|
689
|
+
*/
|
|
690
|
+
attributes: z.ZodEffects<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>, Record<string, unknown> | undefined, Record<string, unknown> | undefined>;
|
|
691
|
+
/**
|
|
692
|
+
* Caller-local span id, unique within the batch. Exists only so sibling
|
|
693
|
+
* spans can name this span as their parentSpanId; never stored (the DB
|
|
694
|
+
* assigns the real uuid).
|
|
695
|
+
*/
|
|
696
|
+
spanId: z.ZodOptional<z.ZodString>;
|
|
697
|
+
/**
|
|
698
|
+
* Caller-local reference to another span's `spanId` IN THE SAME BATCH (NOT
|
|
699
|
+
* a database uuid). The worker wires spans.parent_span_id when the parent
|
|
700
|
+
* resolves within the batch, stores null otherwise.
|
|
701
|
+
*/
|
|
702
|
+
parentSpanId: z.ZodOptional<z.ZodString>;
|
|
703
|
+
}, "strip", z.ZodTypeAny, {
|
|
264
704
|
deploymentSlug: string;
|
|
265
705
|
sessionExternalId: string;
|
|
266
|
-
spanType: "tool_call" | "custom" | "llm_call" | "framework_step";
|
|
706
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
707
|
+
error?: string | undefined;
|
|
267
708
|
name?: string | undefined;
|
|
268
709
|
turnIndex?: number | undefined;
|
|
269
710
|
startedAt?: string | undefined;
|
|
270
711
|
endedAt?: string | undefined;
|
|
712
|
+
contractVersion?: 1 | undefined;
|
|
271
713
|
durationMs?: number | undefined;
|
|
272
714
|
model?: string | undefined;
|
|
273
715
|
provider?: string | undefined;
|
|
274
716
|
tokensInput?: number | undefined;
|
|
275
717
|
tokensOutput?: number | undefined;
|
|
276
718
|
costUsd?: number | undefined;
|
|
719
|
+
attributes?: Record<string, unknown> | undefined;
|
|
720
|
+
spanId?: string | undefined;
|
|
721
|
+
parentSpanId?: string | undefined;
|
|
722
|
+
}, {
|
|
723
|
+
deploymentSlug: string;
|
|
724
|
+
sessionExternalId: string;
|
|
725
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
277
726
|
error?: string | undefined;
|
|
727
|
+
name?: string | undefined;
|
|
728
|
+
turnIndex?: number | undefined;
|
|
729
|
+
startedAt?: string | undefined;
|
|
730
|
+
endedAt?: string | undefined;
|
|
731
|
+
contractVersion?: 1 | undefined;
|
|
732
|
+
durationMs?: number | undefined;
|
|
733
|
+
model?: string | undefined;
|
|
734
|
+
provider?: string | undefined;
|
|
735
|
+
tokensInput?: number | undefined;
|
|
736
|
+
tokensOutput?: number | undefined;
|
|
737
|
+
costUsd?: number | undefined;
|
|
278
738
|
attributes?: Record<string, unknown> | undefined;
|
|
279
739
|
spanId?: string | undefined;
|
|
280
740
|
parentSpanId?: string | undefined;
|
|
281
|
-
}>;
|
|
741
|
+
}>]>;
|
|
282
742
|
type SpanInput = z.infer<typeof SpanInputSchema>;
|
|
283
|
-
|
|
743
|
+
type SpanInputV1 = z.infer<typeof SpanInputV1Schema>;
|
|
744
|
+
type SpanInputV2 = z.infer<typeof SpanInputV2Schema>;
|
|
745
|
+
declare const SpansBatchSchema: z.ZodEffects<z.ZodObject<{
|
|
284
746
|
/** Spans are self-addressed: a batch may span sessions/deployments. */
|
|
285
|
-
spans: z.ZodArray<z.ZodObject<{
|
|
747
|
+
spans: z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodObject<{
|
|
286
748
|
deploymentSlug: z.ZodString;
|
|
287
749
|
sessionExternalId: z.ZodString;
|
|
288
750
|
/**
|
|
@@ -293,7 +755,171 @@ declare const SpansBatchSchema: z.ZodObject<{
|
|
|
293
755
|
* worker (logged, batch still processed): spans never land unattributed.
|
|
294
756
|
*/
|
|
295
757
|
turnIndex: z.ZodOptional<z.ZodNumber>;
|
|
296
|
-
spanType: z.ZodEnum<["llm_call", "tool_call", "framework_step", "custom"]>;
|
|
758
|
+
spanType: z.ZodEnum<["agent_call", "llm_call", "tool_call", "framework_step", "custom"]>;
|
|
759
|
+
} & {
|
|
760
|
+
contractVersion: z.ZodLiteral<2>;
|
|
761
|
+
/** Stable within a deployment/session across batches and retries. */
|
|
762
|
+
spanId: z.ZodString;
|
|
763
|
+
parentSpanId: z.ZodNullable<z.ZodString>;
|
|
764
|
+
name: z.ZodString;
|
|
765
|
+
status: z.ZodEnum<["ok", "error"]>;
|
|
766
|
+
startedAt: z.ZodString;
|
|
767
|
+
endedAt: z.ZodNullable<z.ZodString>;
|
|
768
|
+
durationMs: z.ZodNullable<z.ZodNumber>;
|
|
769
|
+
model: z.ZodNullable<z.ZodString>;
|
|
770
|
+
provider: z.ZodNullable<z.ZodString>;
|
|
771
|
+
tokensInput: z.ZodNullable<z.ZodNumber>;
|
|
772
|
+
tokensOutput: z.ZodNullable<z.ZodNumber>;
|
|
773
|
+
costUsd: z.ZodNullable<z.ZodNumber>;
|
|
774
|
+
error: z.ZodNullable<z.ZodString>;
|
|
775
|
+
input: z.ZodType<SpanPayload, z.ZodTypeDef, SpanPayload>;
|
|
776
|
+
output: z.ZodType<SpanPayload, z.ZodTypeDef, SpanPayload>;
|
|
777
|
+
/** Optional first-class internal timing. An omitted list means the source
|
|
778
|
+
* did not capture interval telemetry; readers must not infer segments. */
|
|
779
|
+
intervals: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
780
|
+
kind: z.ZodEnum<["active", "waiting", "retry", "error"]>;
|
|
781
|
+
startedAt: z.ZodString;
|
|
782
|
+
endedAt: z.ZodString;
|
|
783
|
+
}, "strip", z.ZodTypeAny, {
|
|
784
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
785
|
+
startedAt: string;
|
|
786
|
+
endedAt: string;
|
|
787
|
+
}, {
|
|
788
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
789
|
+
startedAt: string;
|
|
790
|
+
endedAt: string;
|
|
791
|
+
}>, {
|
|
792
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
793
|
+
startedAt: string;
|
|
794
|
+
endedAt: string;
|
|
795
|
+
}, {
|
|
796
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
797
|
+
startedAt: string;
|
|
798
|
+
endedAt: string;
|
|
799
|
+
}>, "many">>;
|
|
800
|
+
attributes: z.ZodEffects<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>, Record<string, unknown> | null, Record<string, unknown> | null>;
|
|
801
|
+
}, "strip", z.ZodTypeAny, {
|
|
802
|
+
error: string | null;
|
|
803
|
+
status: "ok" | "error";
|
|
804
|
+
name: string;
|
|
805
|
+
deploymentSlug: string;
|
|
806
|
+
sessionExternalId: string;
|
|
807
|
+
startedAt: string;
|
|
808
|
+
endedAt: string | null;
|
|
809
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
810
|
+
contractVersion: 2;
|
|
811
|
+
durationMs: number | null;
|
|
812
|
+
model: string | null;
|
|
813
|
+
provider: string | null;
|
|
814
|
+
tokensInput: number | null;
|
|
815
|
+
tokensOutput: number | null;
|
|
816
|
+
costUsd: number | null;
|
|
817
|
+
attributes: Record<string, unknown> | null;
|
|
818
|
+
spanId: string;
|
|
819
|
+
parentSpanId: string | null;
|
|
820
|
+
input: SpanPayload;
|
|
821
|
+
output: SpanPayload;
|
|
822
|
+
turnIndex?: number | undefined;
|
|
823
|
+
intervals?: {
|
|
824
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
825
|
+
startedAt: string;
|
|
826
|
+
endedAt: string;
|
|
827
|
+
}[] | undefined;
|
|
828
|
+
}, {
|
|
829
|
+
error: string | null;
|
|
830
|
+
status: "ok" | "error";
|
|
831
|
+
name: string;
|
|
832
|
+
deploymentSlug: string;
|
|
833
|
+
sessionExternalId: string;
|
|
834
|
+
startedAt: string;
|
|
835
|
+
endedAt: string | null;
|
|
836
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
837
|
+
contractVersion: 2;
|
|
838
|
+
durationMs: number | null;
|
|
839
|
+
model: string | null;
|
|
840
|
+
provider: string | null;
|
|
841
|
+
tokensInput: number | null;
|
|
842
|
+
tokensOutput: number | null;
|
|
843
|
+
costUsd: number | null;
|
|
844
|
+
attributes: Record<string, unknown> | null;
|
|
845
|
+
spanId: string;
|
|
846
|
+
parentSpanId: string | null;
|
|
847
|
+
input: SpanPayload;
|
|
848
|
+
output: SpanPayload;
|
|
849
|
+
turnIndex?: number | undefined;
|
|
850
|
+
intervals?: {
|
|
851
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
852
|
+
startedAt: string;
|
|
853
|
+
endedAt: string;
|
|
854
|
+
}[] | undefined;
|
|
855
|
+
}>, {
|
|
856
|
+
error: string | null;
|
|
857
|
+
status: "ok" | "error";
|
|
858
|
+
name: string;
|
|
859
|
+
deploymentSlug: string;
|
|
860
|
+
sessionExternalId: string;
|
|
861
|
+
startedAt: string;
|
|
862
|
+
endedAt: string | null;
|
|
863
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
864
|
+
contractVersion: 2;
|
|
865
|
+
durationMs: number | null;
|
|
866
|
+
model: string | null;
|
|
867
|
+
provider: string | null;
|
|
868
|
+
tokensInput: number | null;
|
|
869
|
+
tokensOutput: number | null;
|
|
870
|
+
costUsd: number | null;
|
|
871
|
+
attributes: Record<string, unknown> | null;
|
|
872
|
+
spanId: string;
|
|
873
|
+
parentSpanId: string | null;
|
|
874
|
+
input: SpanPayload;
|
|
875
|
+
output: SpanPayload;
|
|
876
|
+
turnIndex?: number | undefined;
|
|
877
|
+
intervals?: {
|
|
878
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
879
|
+
startedAt: string;
|
|
880
|
+
endedAt: string;
|
|
881
|
+
}[] | undefined;
|
|
882
|
+
}, {
|
|
883
|
+
error: string | null;
|
|
884
|
+
status: "ok" | "error";
|
|
885
|
+
name: string;
|
|
886
|
+
deploymentSlug: string;
|
|
887
|
+
sessionExternalId: string;
|
|
888
|
+
startedAt: string;
|
|
889
|
+
endedAt: string | null;
|
|
890
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
891
|
+
contractVersion: 2;
|
|
892
|
+
durationMs: number | null;
|
|
893
|
+
model: string | null;
|
|
894
|
+
provider: string | null;
|
|
895
|
+
tokensInput: number | null;
|
|
896
|
+
tokensOutput: number | null;
|
|
897
|
+
costUsd: number | null;
|
|
898
|
+
attributes: Record<string, unknown> | null;
|
|
899
|
+
spanId: string;
|
|
900
|
+
parentSpanId: string | null;
|
|
901
|
+
input: SpanPayload;
|
|
902
|
+
output: SpanPayload;
|
|
903
|
+
turnIndex?: number | undefined;
|
|
904
|
+
intervals?: {
|
|
905
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
906
|
+
startedAt: string;
|
|
907
|
+
endedAt: string;
|
|
908
|
+
}[] | undefined;
|
|
909
|
+
}>, z.ZodObject<{
|
|
910
|
+
deploymentSlug: z.ZodString;
|
|
911
|
+
sessionExternalId: z.ZodString;
|
|
912
|
+
/**
|
|
913
|
+
* Turn the span belongs to. Optional: when omitted the worker resolves the
|
|
914
|
+
* session's latest turn at/under the span's startedAt (falling back to the
|
|
915
|
+
* session's most recent turn when startedAt is also absent — the outcome
|
|
916
|
+
* events' rule). A span whose turn cannot be resolved is SKIPPED by the
|
|
917
|
+
* worker (logged, batch still processed): spans never land unattributed.
|
|
918
|
+
*/
|
|
919
|
+
turnIndex: z.ZodOptional<z.ZodNumber>;
|
|
920
|
+
spanType: z.ZodEnum<["agent_call", "llm_call", "tool_call", "framework_step", "custom"]>;
|
|
921
|
+
} & {
|
|
922
|
+
contractVersion: z.ZodOptional<z.ZodLiteral<1>>;
|
|
297
923
|
/** Human/otel-style span name (tool name, model call label). */
|
|
298
924
|
name: z.ZodOptional<z.ZodString>;
|
|
299
925
|
/**
|
|
@@ -331,40 +957,42 @@ declare const SpansBatchSchema: z.ZodObject<{
|
|
|
331
957
|
}, "strip", z.ZodTypeAny, {
|
|
332
958
|
deploymentSlug: string;
|
|
333
959
|
sessionExternalId: string;
|
|
334
|
-
spanType: "tool_call" | "custom" | "llm_call" | "framework_step";
|
|
960
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
961
|
+
error?: string | undefined;
|
|
335
962
|
name?: string | undefined;
|
|
336
963
|
turnIndex?: number | undefined;
|
|
337
964
|
startedAt?: string | undefined;
|
|
338
965
|
endedAt?: string | undefined;
|
|
966
|
+
contractVersion?: 1 | undefined;
|
|
339
967
|
durationMs?: number | undefined;
|
|
340
968
|
model?: string | undefined;
|
|
341
969
|
provider?: string | undefined;
|
|
342
970
|
tokensInput?: number | undefined;
|
|
343
971
|
tokensOutput?: number | undefined;
|
|
344
972
|
costUsd?: number | undefined;
|
|
345
|
-
error?: string | undefined;
|
|
346
973
|
attributes?: Record<string, unknown> | undefined;
|
|
347
974
|
spanId?: string | undefined;
|
|
348
975
|
parentSpanId?: string | undefined;
|
|
349
976
|
}, {
|
|
350
977
|
deploymentSlug: string;
|
|
351
978
|
sessionExternalId: string;
|
|
352
|
-
spanType: "tool_call" | "custom" | "llm_call" | "framework_step";
|
|
979
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
980
|
+
error?: string | undefined;
|
|
353
981
|
name?: string | undefined;
|
|
354
982
|
turnIndex?: number | undefined;
|
|
355
983
|
startedAt?: string | undefined;
|
|
356
984
|
endedAt?: string | undefined;
|
|
985
|
+
contractVersion?: 1 | undefined;
|
|
357
986
|
durationMs?: number | undefined;
|
|
358
987
|
model?: string | undefined;
|
|
359
988
|
provider?: string | undefined;
|
|
360
989
|
tokensInput?: number | undefined;
|
|
361
990
|
tokensOutput?: number | undefined;
|
|
362
991
|
costUsd?: number | undefined;
|
|
363
|
-
error?: string | undefined;
|
|
364
992
|
attributes?: Record<string, unknown> | undefined;
|
|
365
993
|
spanId?: string | undefined;
|
|
366
994
|
parentSpanId?: string | undefined;
|
|
367
|
-
}>, "many">;
|
|
995
|
+
}>]>, "many">;
|
|
368
996
|
alignment: z.ZodObject<{
|
|
369
997
|
clock_source: z.ZodString;
|
|
370
998
|
skew_bound_ms: z.ZodOptional<z.ZodNumber>;
|
|
@@ -384,50 +1012,212 @@ declare const SpansBatchSchema: z.ZodObject<{
|
|
|
384
1012
|
rule_version: string;
|
|
385
1013
|
skew_bound_ms?: number | undefined;
|
|
386
1014
|
};
|
|
387
|
-
spans: {
|
|
1015
|
+
spans: ({
|
|
388
1016
|
deploymentSlug: string;
|
|
389
1017
|
sessionExternalId: string;
|
|
390
|
-
spanType: "tool_call" | "custom" | "llm_call" | "framework_step";
|
|
1018
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
1019
|
+
error?: string | undefined;
|
|
391
1020
|
name?: string | undefined;
|
|
392
1021
|
turnIndex?: number | undefined;
|
|
393
1022
|
startedAt?: string | undefined;
|
|
394
1023
|
endedAt?: string | undefined;
|
|
1024
|
+
contractVersion?: 1 | undefined;
|
|
395
1025
|
durationMs?: number | undefined;
|
|
396
1026
|
model?: string | undefined;
|
|
397
1027
|
provider?: string | undefined;
|
|
398
1028
|
tokensInput?: number | undefined;
|
|
399
1029
|
tokensOutput?: number | undefined;
|
|
400
1030
|
costUsd?: number | undefined;
|
|
401
|
-
error?: string | undefined;
|
|
402
1031
|
attributes?: Record<string, unknown> | undefined;
|
|
403
1032
|
spanId?: string | undefined;
|
|
404
1033
|
parentSpanId?: string | undefined;
|
|
405
|
-
}
|
|
1034
|
+
} | {
|
|
1035
|
+
error: string | null;
|
|
1036
|
+
status: "ok" | "error";
|
|
1037
|
+
name: string;
|
|
1038
|
+
deploymentSlug: string;
|
|
1039
|
+
sessionExternalId: string;
|
|
1040
|
+
startedAt: string;
|
|
1041
|
+
endedAt: string | null;
|
|
1042
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
1043
|
+
contractVersion: 2;
|
|
1044
|
+
durationMs: number | null;
|
|
1045
|
+
model: string | null;
|
|
1046
|
+
provider: string | null;
|
|
1047
|
+
tokensInput: number | null;
|
|
1048
|
+
tokensOutput: number | null;
|
|
1049
|
+
costUsd: number | null;
|
|
1050
|
+
attributes: Record<string, unknown> | null;
|
|
1051
|
+
spanId: string;
|
|
1052
|
+
parentSpanId: string | null;
|
|
1053
|
+
input: SpanPayload;
|
|
1054
|
+
output: SpanPayload;
|
|
1055
|
+
turnIndex?: number | undefined;
|
|
1056
|
+
intervals?: {
|
|
1057
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
1058
|
+
startedAt: string;
|
|
1059
|
+
endedAt: string;
|
|
1060
|
+
}[] | undefined;
|
|
1061
|
+
})[];
|
|
406
1062
|
}, {
|
|
407
1063
|
alignment: {
|
|
408
1064
|
clock_source: string;
|
|
409
1065
|
rule_version: string;
|
|
410
1066
|
skew_bound_ms?: number | undefined;
|
|
411
1067
|
};
|
|
412
|
-
spans: {
|
|
1068
|
+
spans: ({
|
|
413
1069
|
deploymentSlug: string;
|
|
414
1070
|
sessionExternalId: string;
|
|
415
|
-
spanType: "tool_call" | "custom" | "llm_call" | "framework_step";
|
|
1071
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
1072
|
+
error?: string | undefined;
|
|
416
1073
|
name?: string | undefined;
|
|
417
1074
|
turnIndex?: number | undefined;
|
|
418
1075
|
startedAt?: string | undefined;
|
|
419
1076
|
endedAt?: string | undefined;
|
|
1077
|
+
contractVersion?: 1 | undefined;
|
|
420
1078
|
durationMs?: number | undefined;
|
|
421
1079
|
model?: string | undefined;
|
|
422
1080
|
provider?: string | undefined;
|
|
423
1081
|
tokensInput?: number | undefined;
|
|
424
1082
|
tokensOutput?: number | undefined;
|
|
425
1083
|
costUsd?: number | undefined;
|
|
1084
|
+
attributes?: Record<string, unknown> | undefined;
|
|
1085
|
+
spanId?: string | undefined;
|
|
1086
|
+
parentSpanId?: string | undefined;
|
|
1087
|
+
} | {
|
|
1088
|
+
error: string | null;
|
|
1089
|
+
status: "ok" | "error";
|
|
1090
|
+
name: string;
|
|
1091
|
+
deploymentSlug: string;
|
|
1092
|
+
sessionExternalId: string;
|
|
1093
|
+
startedAt: string;
|
|
1094
|
+
endedAt: string | null;
|
|
1095
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
1096
|
+
contractVersion: 2;
|
|
1097
|
+
durationMs: number | null;
|
|
1098
|
+
model: string | null;
|
|
1099
|
+
provider: string | null;
|
|
1100
|
+
tokensInput: number | null;
|
|
1101
|
+
tokensOutput: number | null;
|
|
1102
|
+
costUsd: number | null;
|
|
1103
|
+
attributes: Record<string, unknown> | null;
|
|
1104
|
+
spanId: string;
|
|
1105
|
+
parentSpanId: string | null;
|
|
1106
|
+
input: SpanPayload;
|
|
1107
|
+
output: SpanPayload;
|
|
1108
|
+
turnIndex?: number | undefined;
|
|
1109
|
+
intervals?: {
|
|
1110
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
1111
|
+
startedAt: string;
|
|
1112
|
+
endedAt: string;
|
|
1113
|
+
}[] | undefined;
|
|
1114
|
+
})[];
|
|
1115
|
+
}>, {
|
|
1116
|
+
alignment: {
|
|
1117
|
+
clock_source: string;
|
|
1118
|
+
rule_version: string;
|
|
1119
|
+
skew_bound_ms?: number | undefined;
|
|
1120
|
+
};
|
|
1121
|
+
spans: ({
|
|
1122
|
+
deploymentSlug: string;
|
|
1123
|
+
sessionExternalId: string;
|
|
1124
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
426
1125
|
error?: string | undefined;
|
|
1126
|
+
name?: string | undefined;
|
|
1127
|
+
turnIndex?: number | undefined;
|
|
1128
|
+
startedAt?: string | undefined;
|
|
1129
|
+
endedAt?: string | undefined;
|
|
1130
|
+
contractVersion?: 1 | undefined;
|
|
1131
|
+
durationMs?: number | undefined;
|
|
1132
|
+
model?: string | undefined;
|
|
1133
|
+
provider?: string | undefined;
|
|
1134
|
+
tokensInput?: number | undefined;
|
|
1135
|
+
tokensOutput?: number | undefined;
|
|
1136
|
+
costUsd?: number | undefined;
|
|
427
1137
|
attributes?: Record<string, unknown> | undefined;
|
|
428
1138
|
spanId?: string | undefined;
|
|
429
1139
|
parentSpanId?: string | undefined;
|
|
430
|
-
}
|
|
1140
|
+
} | {
|
|
1141
|
+
error: string | null;
|
|
1142
|
+
status: "ok" | "error";
|
|
1143
|
+
name: string;
|
|
1144
|
+
deploymentSlug: string;
|
|
1145
|
+
sessionExternalId: string;
|
|
1146
|
+
startedAt: string;
|
|
1147
|
+
endedAt: string | null;
|
|
1148
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
1149
|
+
contractVersion: 2;
|
|
1150
|
+
durationMs: number | null;
|
|
1151
|
+
model: string | null;
|
|
1152
|
+
provider: string | null;
|
|
1153
|
+
tokensInput: number | null;
|
|
1154
|
+
tokensOutput: number | null;
|
|
1155
|
+
costUsd: number | null;
|
|
1156
|
+
attributes: Record<string, unknown> | null;
|
|
1157
|
+
spanId: string;
|
|
1158
|
+
parentSpanId: string | null;
|
|
1159
|
+
input: SpanPayload;
|
|
1160
|
+
output: SpanPayload;
|
|
1161
|
+
turnIndex?: number | undefined;
|
|
1162
|
+
intervals?: {
|
|
1163
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
1164
|
+
startedAt: string;
|
|
1165
|
+
endedAt: string;
|
|
1166
|
+
}[] | undefined;
|
|
1167
|
+
})[];
|
|
1168
|
+
}, {
|
|
1169
|
+
alignment: {
|
|
1170
|
+
clock_source: string;
|
|
1171
|
+
rule_version: string;
|
|
1172
|
+
skew_bound_ms?: number | undefined;
|
|
1173
|
+
};
|
|
1174
|
+
spans: ({
|
|
1175
|
+
deploymentSlug: string;
|
|
1176
|
+
sessionExternalId: string;
|
|
1177
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
1178
|
+
error?: string | undefined;
|
|
1179
|
+
name?: string | undefined;
|
|
1180
|
+
turnIndex?: number | undefined;
|
|
1181
|
+
startedAt?: string | undefined;
|
|
1182
|
+
endedAt?: string | undefined;
|
|
1183
|
+
contractVersion?: 1 | undefined;
|
|
1184
|
+
durationMs?: number | undefined;
|
|
1185
|
+
model?: string | undefined;
|
|
1186
|
+
provider?: string | undefined;
|
|
1187
|
+
tokensInput?: number | undefined;
|
|
1188
|
+
tokensOutput?: number | undefined;
|
|
1189
|
+
costUsd?: number | undefined;
|
|
1190
|
+
attributes?: Record<string, unknown> | undefined;
|
|
1191
|
+
spanId?: string | undefined;
|
|
1192
|
+
parentSpanId?: string | undefined;
|
|
1193
|
+
} | {
|
|
1194
|
+
error: string | null;
|
|
1195
|
+
status: "ok" | "error";
|
|
1196
|
+
name: string;
|
|
1197
|
+
deploymentSlug: string;
|
|
1198
|
+
sessionExternalId: string;
|
|
1199
|
+
startedAt: string;
|
|
1200
|
+
endedAt: string | null;
|
|
1201
|
+
spanType: "tool_call" | "custom" | "agent_call" | "llm_call" | "framework_step";
|
|
1202
|
+
contractVersion: 2;
|
|
1203
|
+
durationMs: number | null;
|
|
1204
|
+
model: string | null;
|
|
1205
|
+
provider: string | null;
|
|
1206
|
+
tokensInput: number | null;
|
|
1207
|
+
tokensOutput: number | null;
|
|
1208
|
+
costUsd: number | null;
|
|
1209
|
+
attributes: Record<string, unknown> | null;
|
|
1210
|
+
spanId: string;
|
|
1211
|
+
parentSpanId: string | null;
|
|
1212
|
+
input: SpanPayload;
|
|
1213
|
+
output: SpanPayload;
|
|
1214
|
+
turnIndex?: number | undefined;
|
|
1215
|
+
intervals?: {
|
|
1216
|
+
kind: "error" | "active" | "waiting" | "retry";
|
|
1217
|
+
startedAt: string;
|
|
1218
|
+
endedAt: string;
|
|
1219
|
+
}[] | undefined;
|
|
1220
|
+
})[];
|
|
431
1221
|
}>;
|
|
432
1222
|
type SpansBatch = z.infer<typeof SpansBatchSchema>;
|
|
433
1223
|
|
|
@@ -525,7 +1315,7 @@ declare const OutcomeHookSchema: z.ZodObject<{
|
|
|
525
1315
|
type OutcomeHook = z.infer<typeof OutcomeHookSchema>;
|
|
526
1316
|
type OutcomeResult = {
|
|
527
1317
|
outcome: string;
|
|
528
|
-
type:
|
|
1318
|
+
type: "numeric" | "categorical" | "boolean" | "duration";
|
|
529
1319
|
value: string;
|
|
530
1320
|
};
|
|
531
1321
|
declare const ProbeConfigSchema: z.ZodObject<{
|
|
@@ -799,6 +1589,13 @@ type SessionEndInput = z.infer<typeof SessionEndSchema>;
|
|
|
799
1589
|
type CapturedTurn = {
|
|
800
1590
|
deploymentSlug: string;
|
|
801
1591
|
sessionExternalId: string;
|
|
1592
|
+
/**
|
|
1593
|
+
* The SDK payload contract version (D2, research-grade consolidation):
|
|
1594
|
+
* stamped on EVERY captured turn by this SDK; absent on payloads from
|
|
1595
|
+
* older SDKs (read as 'envelope-v0-unstamped' downstream). Data lineage
|
|
1596
|
+
* across SDK upgrades — additive-only, tolerated-absent.
|
|
1597
|
+
*/
|
|
1598
|
+
envelopeVersion?: string;
|
|
802
1599
|
/**
|
|
803
1600
|
* Customer's user identity. Forwarded by captureTurn from the session
|
|
804
1601
|
* state (Probe.startSession({ externalUserId })); the worker persists it
|
|
@@ -866,7 +1663,7 @@ type CapturedTurn = {
|
|
|
866
1663
|
userOutcome?: {
|
|
867
1664
|
flaggedBreak?: boolean;
|
|
868
1665
|
explicitRating?: number;
|
|
869
|
-
thumbs?:
|
|
1666
|
+
thumbs?: "up" | "down";
|
|
870
1667
|
};
|
|
871
1668
|
/**
|
|
872
1669
|
* Propensity + candidate set (harness-supplied).
|
|
@@ -891,7 +1688,7 @@ type CapturedTurn = {
|
|
|
891
1688
|
* (populated by captureTurn from Probe.startSession state; the worker
|
|
892
1689
|
* persists both at session find-or-create). Omitted on later turns.
|
|
893
1690
|
*/
|
|
894
|
-
openedVia?:
|
|
1691
|
+
openedVia?: "link" | "notification" | "resume" | "direct" | "share";
|
|
895
1692
|
clientContext?: Record<string, unknown>;
|
|
896
1693
|
/**
|
|
897
1694
|
* RLDS episode-level provenance. Forwarded from the session
|
|
@@ -994,7 +1791,8 @@ declare class IngestClient {
|
|
|
994
1791
|
* short-lived processes (serverless, CLI scripts) can actually exit after
|
|
995
1792
|
* it — the documented "in-flight sends finish within 15s" only holds while
|
|
996
1793
|
* the process lives. Polling is coarse on purpose: sends report through
|
|
997
|
-
* guardedFetch's counter, never awaited individually.
|
|
1794
|
+
* guardedFetch's counter and scheduled retries, never awaited individually.
|
|
1795
|
+
* Retries beyond the drain budget remain best-effort, not durable delivery.
|
|
998
1796
|
*/
|
|
999
1797
|
drainInFlight(timeoutMs?: number): Promise<void>;
|
|
1000
1798
|
constructor(opts: IngestClientOptions);
|
|
@@ -1153,8 +1951,8 @@ type ProbeState = {
|
|
|
1153
1951
|
preSessionBuffer: Map<string, PreSessionSignals>;
|
|
1154
1952
|
};
|
|
1155
1953
|
type PreSessionSignals = {
|
|
1156
|
-
pendingUserInput: SessionState[
|
|
1157
|
-
pendingUserOutcome: SessionState[
|
|
1954
|
+
pendingUserInput: SessionState["pendingUserInput"];
|
|
1955
|
+
pendingUserOutcome: SessionState["pendingUserOutcome"];
|
|
1158
1956
|
lastUserSubmitAt: number | null;
|
|
1159
1957
|
};
|
|
1160
1958
|
|
|
@@ -1200,7 +1998,7 @@ type SessionState = {
|
|
|
1200
1998
|
} | null;
|
|
1201
1999
|
/** Per-turn user outcome pending on the SDK edge (thumbs / rating). */
|
|
1202
2000
|
pendingUserOutcome: {
|
|
1203
|
-
thumbs?:
|
|
2001
|
+
thumbs?: "up" | "down";
|
|
1204
2002
|
explicitRating?: number;
|
|
1205
2003
|
} | null;
|
|
1206
2004
|
};
|
|
@@ -1305,7 +2103,7 @@ declare class Probe {
|
|
|
1305
2103
|
*/
|
|
1306
2104
|
static userInputSubmit(externalId: string, text: string): void;
|
|
1307
2105
|
/** Attach a thumbs-up/down to the current turn. */
|
|
1308
|
-
static userThumbs(externalId: string, thumbs:
|
|
2106
|
+
static userThumbs(externalId: string, thumbs: "up" | "down"): void;
|
|
1309
2107
|
/** Attach an explicit 1-5 rating to the current turn. */
|
|
1310
2108
|
static userRating(externalId: string, rating: number): void;
|
|
1311
2109
|
/**
|
|
@@ -1458,4 +2256,4 @@ declare class Probe {
|
|
|
1458
2256
|
*/
|
|
1459
2257
|
declare function wrapOpenAI<T extends object>(client: T): T;
|
|
1460
2258
|
|
|
1461
|
-
export { type AlignmentProvenance, type CapturedTurn, type EnvironmentEventInput, type OutcomeEventEmit, type OutcomeHook, type OutcomeResult, type PersonaConfig, Probe, type ProbeConfig, type ProbeConfigInput, Probe as Sight, type AlignmentProvenance as SightAlignmentProvenance, type CapturedTurn as SightCapturedTurn, type ProbeConfig as SightConfig, type ProbeConfigInput as SightConfigInput, type EnvironmentEventInput as SightEnvironmentEventInput, type OutcomeEventEmit as SightOutcomeEventEmit, type OutcomeHook as SightOutcomeHook, type OutcomeResult as SightOutcomeResult, type PersonaConfig as SightPersonaConfig, type SpanInput as SightSpanInput, type SpansBatch as SightSpansBatch, type SpanInput, type SpansBatch, wrapOpenAI };
|
|
2259
|
+
export { type AlignmentProvenance, type CapturedTurn, type EnvironmentEventInput, type OutcomeEventEmit, type OutcomeHook, type OutcomeResult, type PersonaConfig, Probe, type ProbeConfig, type ProbeConfigInput, SPAN_INTERVAL_KINDS, SPAN_PAYLOAD_STATES, SPAN_STATUSES, SPAN_TYPES, SPAN_V2_STATUSES, Probe as Sight, type AlignmentProvenance as SightAlignmentProvenance, type CapturedTurn as SightCapturedTurn, type ProbeConfig as SightConfig, type ProbeConfigInput as SightConfigInput, type EnvironmentEventInput as SightEnvironmentEventInput, type OutcomeEventEmit as SightOutcomeEventEmit, type OutcomeHook as SightOutcomeHook, type OutcomeResult as SightOutcomeResult, type PersonaConfig as SightPersonaConfig, type SpanInput as SightSpanInput, type SpanInputV2 as SightSpanInputV2, type SpansBatch as SightSpansBatch, type SpanInput, SpanInputSchema, type SpanInputV1, SpanInputV1Schema, type SpanInputV2, SpanInputV2Schema, type SpanInterval, type SpanIntervalKind, SpanIntervalSchema, type SpanPayload, SpanPayloadSchema, type SpanPayloadState, type SpanStatus, type SpanType, type SpansBatch, SpansBatchSchema, wrapOpenAI };
|