@cultured_computer/sight 0.3.0 → 0.3.2
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 +62 -6
- package/dist/index.cjs +243 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +295 -19
- package/dist/index.d.ts +295 -19
- package/dist/index.js +243 -46
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -196,6 +196,240 @@ declare const EnvironmentEventsBatchSchema: z.ZodObject<{
|
|
|
196
196
|
};
|
|
197
197
|
}>;
|
|
198
198
|
type EnvironmentEventsBatch = z.infer<typeof EnvironmentEventsBatchSchema>;
|
|
199
|
+
declare const SpanInputSchema: z.ZodObject<{
|
|
200
|
+
deploymentSlug: z.ZodString;
|
|
201
|
+
sessionExternalId: z.ZodString;
|
|
202
|
+
/**
|
|
203
|
+
* Turn the span belongs to. Optional: when omitted the worker resolves the
|
|
204
|
+
* session's latest turn at/under the span's startedAt (falling back to the
|
|
205
|
+
* session's most recent turn when startedAt is also absent — the outcome
|
|
206
|
+
* events' rule). A span whose turn cannot be resolved is SKIPPED by the
|
|
207
|
+
* worker (logged, batch still processed): spans never land unattributed.
|
|
208
|
+
*/
|
|
209
|
+
turnIndex: z.ZodOptional<z.ZodNumber>;
|
|
210
|
+
spanType: z.ZodEnum<["llm_call", "tool_call", "framework_step", "custom"]>;
|
|
211
|
+
/** Human/otel-style span name (tool name, model call label). */
|
|
212
|
+
name: z.ZodOptional<z.ZodString>;
|
|
213
|
+
/**
|
|
214
|
+
* Caller-asserted span start (ISO). OPTIONAL and honored like
|
|
215
|
+
* TurnInput.startedAt: provenance, not verification — when absent the
|
|
216
|
+
* worker stamps processing time.
|
|
217
|
+
*/
|
|
218
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
219
|
+
endedAt: z.ZodOptional<z.ZodString>;
|
|
220
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
221
|
+
model: z.ZodOptional<z.ZodString>;
|
|
222
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
223
|
+
tokensInput: z.ZodOptional<z.ZodNumber>;
|
|
224
|
+
tokensOutput: z.ZodOptional<z.ZodNumber>;
|
|
225
|
+
costUsd: z.ZodOptional<z.ZodNumber>;
|
|
226
|
+
error: z.ZodOptional<z.ZodString>;
|
|
227
|
+
/**
|
|
228
|
+
* OpenInference / OpenTelemetry gen_ai.*-style attributes. String values
|
|
229
|
+
* are Presidio-scrubbed by the worker before storage (see the PII rule
|
|
230
|
+
* above). Capped at 16k JSON chars per span.
|
|
231
|
+
*/
|
|
232
|
+
attributes: z.ZodEffects<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>, Record<string, unknown> | undefined, Record<string, unknown> | undefined>;
|
|
233
|
+
/**
|
|
234
|
+
* Caller-local span id, unique within the batch. Exists only so sibling
|
|
235
|
+
* spans can name this span as their parentSpanId; never stored (the DB
|
|
236
|
+
* assigns the real uuid).
|
|
237
|
+
*/
|
|
238
|
+
spanId: z.ZodOptional<z.ZodString>;
|
|
239
|
+
/**
|
|
240
|
+
* Caller-local reference to another span's `spanId` IN THE SAME BATCH (NOT
|
|
241
|
+
* a database uuid). The worker wires spans.parent_span_id when the parent
|
|
242
|
+
* resolves within the batch, stores null otherwise.
|
|
243
|
+
*/
|
|
244
|
+
parentSpanId: z.ZodOptional<z.ZodString>;
|
|
245
|
+
}, "strip", z.ZodTypeAny, {
|
|
246
|
+
deploymentSlug: string;
|
|
247
|
+
sessionExternalId: string;
|
|
248
|
+
spanType: "tool_call" | "custom" | "llm_call" | "framework_step";
|
|
249
|
+
name?: string | undefined;
|
|
250
|
+
turnIndex?: number | undefined;
|
|
251
|
+
startedAt?: string | undefined;
|
|
252
|
+
endedAt?: string | undefined;
|
|
253
|
+
durationMs?: number | undefined;
|
|
254
|
+
model?: string | undefined;
|
|
255
|
+
provider?: string | undefined;
|
|
256
|
+
tokensInput?: number | undefined;
|
|
257
|
+
tokensOutput?: number | undefined;
|
|
258
|
+
costUsd?: number | undefined;
|
|
259
|
+
error?: string | undefined;
|
|
260
|
+
attributes?: Record<string, unknown> | undefined;
|
|
261
|
+
spanId?: string | undefined;
|
|
262
|
+
parentSpanId?: string | undefined;
|
|
263
|
+
}, {
|
|
264
|
+
deploymentSlug: string;
|
|
265
|
+
sessionExternalId: string;
|
|
266
|
+
spanType: "tool_call" | "custom" | "llm_call" | "framework_step";
|
|
267
|
+
name?: string | undefined;
|
|
268
|
+
turnIndex?: number | undefined;
|
|
269
|
+
startedAt?: string | undefined;
|
|
270
|
+
endedAt?: string | undefined;
|
|
271
|
+
durationMs?: number | undefined;
|
|
272
|
+
model?: string | undefined;
|
|
273
|
+
provider?: string | undefined;
|
|
274
|
+
tokensInput?: number | undefined;
|
|
275
|
+
tokensOutput?: number | undefined;
|
|
276
|
+
costUsd?: number | undefined;
|
|
277
|
+
error?: string | undefined;
|
|
278
|
+
attributes?: Record<string, unknown> | undefined;
|
|
279
|
+
spanId?: string | undefined;
|
|
280
|
+
parentSpanId?: string | undefined;
|
|
281
|
+
}>;
|
|
282
|
+
type SpanInput = z.infer<typeof SpanInputSchema>;
|
|
283
|
+
declare const SpansBatchSchema: z.ZodObject<{
|
|
284
|
+
/** Spans are self-addressed: a batch may span sessions/deployments. */
|
|
285
|
+
spans: z.ZodArray<z.ZodObject<{
|
|
286
|
+
deploymentSlug: z.ZodString;
|
|
287
|
+
sessionExternalId: z.ZodString;
|
|
288
|
+
/**
|
|
289
|
+
* Turn the span belongs to. Optional: when omitted the worker resolves the
|
|
290
|
+
* session's latest turn at/under the span's startedAt (falling back to the
|
|
291
|
+
* session's most recent turn when startedAt is also absent — the outcome
|
|
292
|
+
* events' rule). A span whose turn cannot be resolved is SKIPPED by the
|
|
293
|
+
* worker (logged, batch still processed): spans never land unattributed.
|
|
294
|
+
*/
|
|
295
|
+
turnIndex: z.ZodOptional<z.ZodNumber>;
|
|
296
|
+
spanType: z.ZodEnum<["llm_call", "tool_call", "framework_step", "custom"]>;
|
|
297
|
+
/** Human/otel-style span name (tool name, model call label). */
|
|
298
|
+
name: z.ZodOptional<z.ZodString>;
|
|
299
|
+
/**
|
|
300
|
+
* Caller-asserted span start (ISO). OPTIONAL and honored like
|
|
301
|
+
* TurnInput.startedAt: provenance, not verification — when absent the
|
|
302
|
+
* worker stamps processing time.
|
|
303
|
+
*/
|
|
304
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
305
|
+
endedAt: z.ZodOptional<z.ZodString>;
|
|
306
|
+
durationMs: z.ZodOptional<z.ZodNumber>;
|
|
307
|
+
model: z.ZodOptional<z.ZodString>;
|
|
308
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
309
|
+
tokensInput: z.ZodOptional<z.ZodNumber>;
|
|
310
|
+
tokensOutput: z.ZodOptional<z.ZodNumber>;
|
|
311
|
+
costUsd: z.ZodOptional<z.ZodNumber>;
|
|
312
|
+
error: z.ZodOptional<z.ZodString>;
|
|
313
|
+
/**
|
|
314
|
+
* OpenInference / OpenTelemetry gen_ai.*-style attributes. String values
|
|
315
|
+
* are Presidio-scrubbed by the worker before storage (see the PII rule
|
|
316
|
+
* above). Capped at 16k JSON chars per span.
|
|
317
|
+
*/
|
|
318
|
+
attributes: z.ZodEffects<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>, Record<string, unknown> | undefined, Record<string, unknown> | undefined>;
|
|
319
|
+
/**
|
|
320
|
+
* Caller-local span id, unique within the batch. Exists only so sibling
|
|
321
|
+
* spans can name this span as their parentSpanId; never stored (the DB
|
|
322
|
+
* assigns the real uuid).
|
|
323
|
+
*/
|
|
324
|
+
spanId: z.ZodOptional<z.ZodString>;
|
|
325
|
+
/**
|
|
326
|
+
* Caller-local reference to another span's `spanId` IN THE SAME BATCH (NOT
|
|
327
|
+
* a database uuid). The worker wires spans.parent_span_id when the parent
|
|
328
|
+
* resolves within the batch, stores null otherwise.
|
|
329
|
+
*/
|
|
330
|
+
parentSpanId: z.ZodOptional<z.ZodString>;
|
|
331
|
+
}, "strip", z.ZodTypeAny, {
|
|
332
|
+
deploymentSlug: string;
|
|
333
|
+
sessionExternalId: string;
|
|
334
|
+
spanType: "tool_call" | "custom" | "llm_call" | "framework_step";
|
|
335
|
+
name?: string | undefined;
|
|
336
|
+
turnIndex?: number | undefined;
|
|
337
|
+
startedAt?: string | undefined;
|
|
338
|
+
endedAt?: string | undefined;
|
|
339
|
+
durationMs?: number | undefined;
|
|
340
|
+
model?: string | undefined;
|
|
341
|
+
provider?: string | undefined;
|
|
342
|
+
tokensInput?: number | undefined;
|
|
343
|
+
tokensOutput?: number | undefined;
|
|
344
|
+
costUsd?: number | undefined;
|
|
345
|
+
error?: string | undefined;
|
|
346
|
+
attributes?: Record<string, unknown> | undefined;
|
|
347
|
+
spanId?: string | undefined;
|
|
348
|
+
parentSpanId?: string | undefined;
|
|
349
|
+
}, {
|
|
350
|
+
deploymentSlug: string;
|
|
351
|
+
sessionExternalId: string;
|
|
352
|
+
spanType: "tool_call" | "custom" | "llm_call" | "framework_step";
|
|
353
|
+
name?: string | undefined;
|
|
354
|
+
turnIndex?: number | undefined;
|
|
355
|
+
startedAt?: string | undefined;
|
|
356
|
+
endedAt?: string | undefined;
|
|
357
|
+
durationMs?: number | undefined;
|
|
358
|
+
model?: string | undefined;
|
|
359
|
+
provider?: string | undefined;
|
|
360
|
+
tokensInput?: number | undefined;
|
|
361
|
+
tokensOutput?: number | undefined;
|
|
362
|
+
costUsd?: number | undefined;
|
|
363
|
+
error?: string | undefined;
|
|
364
|
+
attributes?: Record<string, unknown> | undefined;
|
|
365
|
+
spanId?: string | undefined;
|
|
366
|
+
parentSpanId?: string | undefined;
|
|
367
|
+
}>, "many">;
|
|
368
|
+
alignment: z.ZodObject<{
|
|
369
|
+
clock_source: z.ZodString;
|
|
370
|
+
skew_bound_ms: z.ZodOptional<z.ZodNumber>;
|
|
371
|
+
rule_version: z.ZodString;
|
|
372
|
+
}, "strip", z.ZodTypeAny, {
|
|
373
|
+
clock_source: string;
|
|
374
|
+
rule_version: string;
|
|
375
|
+
skew_bound_ms?: number | undefined;
|
|
376
|
+
}, {
|
|
377
|
+
clock_source: string;
|
|
378
|
+
rule_version: string;
|
|
379
|
+
skew_bound_ms?: number | undefined;
|
|
380
|
+
}>;
|
|
381
|
+
}, "strip", z.ZodTypeAny, {
|
|
382
|
+
alignment: {
|
|
383
|
+
clock_source: string;
|
|
384
|
+
rule_version: string;
|
|
385
|
+
skew_bound_ms?: number | undefined;
|
|
386
|
+
};
|
|
387
|
+
spans: {
|
|
388
|
+
deploymentSlug: string;
|
|
389
|
+
sessionExternalId: string;
|
|
390
|
+
spanType: "tool_call" | "custom" | "llm_call" | "framework_step";
|
|
391
|
+
name?: string | undefined;
|
|
392
|
+
turnIndex?: number | undefined;
|
|
393
|
+
startedAt?: string | undefined;
|
|
394
|
+
endedAt?: string | undefined;
|
|
395
|
+
durationMs?: number | undefined;
|
|
396
|
+
model?: string | undefined;
|
|
397
|
+
provider?: string | undefined;
|
|
398
|
+
tokensInput?: number | undefined;
|
|
399
|
+
tokensOutput?: number | undefined;
|
|
400
|
+
costUsd?: number | undefined;
|
|
401
|
+
error?: string | undefined;
|
|
402
|
+
attributes?: Record<string, unknown> | undefined;
|
|
403
|
+
spanId?: string | undefined;
|
|
404
|
+
parentSpanId?: string | undefined;
|
|
405
|
+
}[];
|
|
406
|
+
}, {
|
|
407
|
+
alignment: {
|
|
408
|
+
clock_source: string;
|
|
409
|
+
rule_version: string;
|
|
410
|
+
skew_bound_ms?: number | undefined;
|
|
411
|
+
};
|
|
412
|
+
spans: {
|
|
413
|
+
deploymentSlug: string;
|
|
414
|
+
sessionExternalId: string;
|
|
415
|
+
spanType: "tool_call" | "custom" | "llm_call" | "framework_step";
|
|
416
|
+
name?: string | undefined;
|
|
417
|
+
turnIndex?: number | undefined;
|
|
418
|
+
startedAt?: string | undefined;
|
|
419
|
+
endedAt?: string | undefined;
|
|
420
|
+
durationMs?: number | undefined;
|
|
421
|
+
model?: string | undefined;
|
|
422
|
+
provider?: string | undefined;
|
|
423
|
+
tokensInput?: number | undefined;
|
|
424
|
+
tokensOutput?: number | undefined;
|
|
425
|
+
costUsd?: number | undefined;
|
|
426
|
+
error?: string | undefined;
|
|
427
|
+
attributes?: Record<string, unknown> | undefined;
|
|
428
|
+
spanId?: string | undefined;
|
|
429
|
+
parentSpanId?: string | undefined;
|
|
430
|
+
}[];
|
|
431
|
+
}>;
|
|
432
|
+
type SpansBatch = z.infer<typeof SpansBatchSchema>;
|
|
199
433
|
|
|
200
434
|
/**
|
|
201
435
|
* Sight SDK (@cultured-computer/sight) shared types.
|
|
@@ -299,7 +533,7 @@ declare const ProbeConfigSchema: z.ZodObject<{
|
|
|
299
533
|
apiKey: z.ZodString;
|
|
300
534
|
/** Deployment slug registered in the Probe backend. Required. */
|
|
301
535
|
deployment: z.ZodString;
|
|
302
|
-
/** Ingest endpoint. Defaults to
|
|
536
|
+
/** Ingest endpoint. Defaults to the production ingest service. */
|
|
303
537
|
endpoint: z.ZodDefault<z.ZodString>;
|
|
304
538
|
/**
|
|
305
539
|
* Dashboard base URL used by the one-time first-capture announcement
|
|
@@ -485,7 +719,7 @@ declare const SessionStartSchema: z.ZodObject<{
|
|
|
485
719
|
*/
|
|
486
720
|
persona: z.ZodOptional<z.ZodString>;
|
|
487
721
|
/**
|
|
488
|
-
* How the user got into this session
|
|
722
|
+
* How the user got into this session.
|
|
489
723
|
* Retention semantics differ radically between a resume and a fresh
|
|
490
724
|
* notification landing.
|
|
491
725
|
*/
|
|
@@ -502,8 +736,8 @@ declare const SessionStartSchema: z.ZodObject<{
|
|
|
502
736
|
*/
|
|
503
737
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
504
738
|
/**
|
|
505
|
-
* RLDS episode-level provenance
|
|
506
|
-
*
|
|
739
|
+
* RLDS episode-level provenance. Powers the version behavioral diff
|
|
740
|
+
* on the dashboard. All optional.
|
|
507
741
|
* agentId — model/policy version
|
|
508
742
|
* experimentId — A/B arm or feature flag
|
|
509
743
|
* environmentConfigHash — SHA of prompt/config file(s)
|
|
@@ -539,17 +773,27 @@ declare const SessionStartSchema: z.ZodObject<{
|
|
|
539
773
|
type SessionStart = z.infer<typeof SessionStartSchema>;
|
|
540
774
|
/**
|
|
541
775
|
* Session end input (P2). Sent by Probe.endSession() so the worker records
|
|
542
|
-
* why a session ended.
|
|
776
|
+
* why a session ended. `outcome` + `outcomeDetail` are the one-call
|
|
777
|
+
* outcome helper: when the deployer knows the outcome at close (a
|
|
778
|
+
* resolved ticket, an escalation, an abandonment), the SDK emits it as an
|
|
779
|
+
* outcome event alongside the session end — it never rides the
|
|
780
|
+
* session-end wire itself.
|
|
543
781
|
*/
|
|
544
782
|
declare const SessionEndSchema: z.ZodObject<{
|
|
545
783
|
externalId: z.ZodString;
|
|
546
784
|
endedReason: z.ZodOptional<z.ZodEnum<["natural", "user_closed", "timeout", "agent_error", "user_flagged", "crashed"]>>;
|
|
785
|
+
outcome: z.ZodOptional<z.ZodString>;
|
|
786
|
+
outcomeDetail: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
547
787
|
}, "strip", z.ZodTypeAny, {
|
|
548
788
|
externalId: string;
|
|
549
789
|
endedReason?: "natural" | "user_closed" | "timeout" | "agent_error" | "user_flagged" | "crashed" | undefined;
|
|
790
|
+
outcome?: string | undefined;
|
|
791
|
+
outcomeDetail?: Record<string, unknown> | undefined;
|
|
550
792
|
}, {
|
|
551
793
|
externalId: string;
|
|
552
794
|
endedReason?: "natural" | "user_closed" | "timeout" | "agent_error" | "user_flagged" | "crashed" | undefined;
|
|
795
|
+
outcome?: string | undefined;
|
|
796
|
+
outcomeDetail?: Record<string, unknown> | undefined;
|
|
553
797
|
}>;
|
|
554
798
|
type SessionEndInput = z.infer<typeof SessionEndSchema>;
|
|
555
799
|
type CapturedTurn = {
|
|
@@ -576,7 +820,7 @@ type CapturedTurn = {
|
|
|
576
820
|
signaturePhraseMatches?: string[];
|
|
577
821
|
/**
|
|
578
822
|
* Interpretive record fields passed through from a customer harness
|
|
579
|
-
* (
|
|
823
|
+
* (read hook wired). Populated only if the customer
|
|
580
824
|
* runs the Cultured Computer harness pattern; null for non-harness deployments.
|
|
581
825
|
*/
|
|
582
826
|
interpretive?: {
|
|
@@ -587,7 +831,7 @@ type CapturedTurn = {
|
|
|
587
831
|
reactionNextTurn?: string;
|
|
588
832
|
};
|
|
589
833
|
/**
|
|
590
|
-
* User-side input for this turn
|
|
834
|
+
* User-side input for this turn. What the human
|
|
591
835
|
* said + UI-level interactivity signals. Text is Presidio-scrubbed
|
|
592
836
|
* server-side before landing on probe_user_reply_text.
|
|
593
837
|
*/
|
|
@@ -612,7 +856,7 @@ type CapturedTurn = {
|
|
|
612
856
|
}>;
|
|
613
857
|
};
|
|
614
858
|
/**
|
|
615
|
-
* User outcome signals
|
|
859
|
+
* User outcome signals:
|
|
616
860
|
* flagged break, explicit rating (1-5), thumbs.
|
|
617
861
|
*
|
|
618
862
|
* `flaggedBreak` is DEPRECATED in favor of Probe.flagPersonaBreak(),
|
|
@@ -625,9 +869,9 @@ type CapturedTurn = {
|
|
|
625
869
|
thumbs?: 'up' | 'down';
|
|
626
870
|
};
|
|
627
871
|
/**
|
|
628
|
-
* Propensity + candidate set (harness-supplied
|
|
872
|
+
* Propensity + candidate set (harness-supplied).
|
|
629
873
|
* Manual-capture callers put this in payload.propensity; captureTurn
|
|
630
|
-
* validates the
|
|
874
|
+
* validates the contract and hoists the valid object to
|
|
631
875
|
* this top-level field so the worker projection lands it on the
|
|
632
876
|
* read_candidates / read_propensities / selection_meta columns.
|
|
633
877
|
*/
|
|
@@ -650,7 +894,7 @@ type CapturedTurn = {
|
|
|
650
894
|
openedVia?: 'link' | 'notification' | 'resume' | 'direct' | 'share';
|
|
651
895
|
clientContext?: Record<string, unknown>;
|
|
652
896
|
/**
|
|
653
|
-
* RLDS episode-level provenance
|
|
897
|
+
* RLDS episode-level provenance. Forwarded from the session
|
|
654
898
|
* state on every turn so downstream storage can attribute each turn to the
|
|
655
899
|
* arm/version that produced it. Populated by startSession() from either
|
|
656
900
|
* the customer-provided value or the init-time default; null when neither
|
|
@@ -718,7 +962,7 @@ declare class IngestClient {
|
|
|
718
962
|
private debug;
|
|
719
963
|
private dashboardUrl;
|
|
720
964
|
/**
|
|
721
|
-
* First-trace permalink
|
|
965
|
+
* First-trace permalink: the first
|
|
722
966
|
* SUCCESSFUL sendTurn prints one stderr line with a dashboard permalink,
|
|
723
967
|
* then never again for the life of this client (one IngestClient per
|
|
724
968
|
* process — one `init` per process; a restart prints once more, accepted).
|
|
@@ -744,7 +988,7 @@ declare class IngestClient {
|
|
|
744
988
|
sendTurn(turn: CapturedTurn): Promise<void>;
|
|
745
989
|
/**
|
|
746
990
|
* Send a persona-break flag to the ingest API. Fire-and-log, same as sendTurn.
|
|
747
|
-
* Populates the `user_flagged_break` outcome column
|
|
991
|
+
* Populates the `user_flagged_break` outcome column on the dashboard.
|
|
748
992
|
*/
|
|
749
993
|
sendFlag(deploymentSlug: string, flag: FlagPersonaBreakInput): Promise<void>;
|
|
750
994
|
/**
|
|
@@ -754,7 +998,7 @@ declare class IngestClient {
|
|
|
754
998
|
sendSessionEnd(deploymentSlug: string, end: SessionEndInput): Promise<void>;
|
|
755
999
|
/**
|
|
756
1000
|
* Send an outcome event to the ingest API. Fire-and-log. Populates
|
|
757
|
-
*
|
|
1001
|
+
* the outcome-events store.
|
|
758
1002
|
*/
|
|
759
1003
|
sendOutcomeEvent(deploymentSlug: string, event: OutcomeEventEmit): Promise<void>;
|
|
760
1004
|
/**
|
|
@@ -763,6 +1007,13 @@ declare class IngestClient {
|
|
|
763
1007
|
* its session's record by time; meaning is per-deployment.
|
|
764
1008
|
*/
|
|
765
1009
|
sendEnvironmentEvents(batch: EnvironmentEventsBatch): Promise<void>;
|
|
1010
|
+
/**
|
|
1011
|
+
* Send a span batch to the ingest API. Fire-and-log, same as sendTurn.
|
|
1012
|
+
* Spans carry sub-turn structure (llm_call / tool_call / framework_step /
|
|
1013
|
+
* custom); the worker resolves each span's session/turn and wires in-batch
|
|
1014
|
+
* parent references.
|
|
1015
|
+
*/
|
|
1016
|
+
sendSpans(batch: SpansBatch): Promise<void>;
|
|
766
1017
|
/**
|
|
767
1018
|
* Route a send response through the 429 retry policy. Non-429 responses
|
|
768
1019
|
* pass through untouched. A 429 is re-sent exactly once after Retry-After
|
|
@@ -988,7 +1239,7 @@ declare class Probe {
|
|
|
988
1239
|
* for the diff table axis (a card keyed by a3f9c2… is unreadable).
|
|
989
1240
|
*
|
|
990
1241
|
* Ships as a helper because inconsistent hashing across restarts breaks
|
|
991
|
-
*
|
|
1242
|
+
* The version behavioral diff — every customer would
|
|
992
1243
|
* hash their own way and version-diff would become noise.
|
|
993
1244
|
*
|
|
994
1245
|
* The same hashing (src/hash.ts) backs the OTel processor's automatic
|
|
@@ -1070,7 +1321,7 @@ declare class Probe {
|
|
|
1070
1321
|
static captureTurn(turn: CapturedTurn): Promise<void>;
|
|
1071
1322
|
/**
|
|
1072
1323
|
* Emit a custom outcome event on a session. Populates probe_outcome_events
|
|
1073
|
-
* with the customer-supplied `kind` string
|
|
1324
|
+
* with the customer-supplied `kind` string. Use for
|
|
1074
1325
|
* customer-defined kinds like "purchase_complete", "handoff_to_human",
|
|
1075
1326
|
* "character_break_severe". Universal seed kinds (break, escalation,
|
|
1076
1327
|
* resolution, thumbs_*, rating_*) are also emitted by worker-side
|
|
@@ -1079,7 +1330,7 @@ declare class Probe {
|
|
|
1079
1330
|
*/
|
|
1080
1331
|
static emitOutcomeEvent(input: OutcomeEventEmit): Promise<void>;
|
|
1081
1332
|
/**
|
|
1082
|
-
* Capture one environment event against a session
|
|
1333
|
+
* Capture one environment event against a session. The
|
|
1083
1334
|
* envelope is generalized: `source_type` and `event` are free strings whose
|
|
1084
1335
|
* meaning is defined per deployment — the instrument stores the event and
|
|
1085
1336
|
* attaches it to the session's record by time (the next turn's state
|
|
@@ -1100,10 +1351,35 @@ declare class Probe {
|
|
|
1100
1351
|
* capture above.
|
|
1101
1352
|
*/
|
|
1102
1353
|
static captureEnvironmentEvents(events: EnvironmentEventInput[], alignment: AlignmentProvenance): Promise<void>;
|
|
1354
|
+
/**
|
|
1355
|
+
* Capture one sub-turn span against a session: one LLM call, one tool
|
|
1356
|
+
* call, one framework step, or a custom unit inside a turn. The span lands
|
|
1357
|
+
* on the turn named by `turnIndex`, or — when omitted — on the session's
|
|
1358
|
+
* latest turn at/under the span's `startedAt` (most recent turn when
|
|
1359
|
+
* `startedAt` is also absent). A span whose turn cannot be resolved is
|
|
1360
|
+
* dropped server-side; spans never land unattributed. Fire-and-log, like
|
|
1361
|
+
* captureTurn: errors are debug-logged, never thrown.
|
|
1362
|
+
*
|
|
1363
|
+
* `attributes` are metadata only (tool names, argument shapes) — never
|
|
1364
|
+
* free-text conversation content. Alignment defaults to the SDK's own
|
|
1365
|
+
* clock claim; deployments with a stricter clock contract (or batches, or
|
|
1366
|
+
* parent references between spans) should call captureSpans.
|
|
1367
|
+
*/
|
|
1368
|
+
static captureSpan(span: SpanInput, alignment?: AlignmentProvenance): Promise<void>;
|
|
1369
|
+
/**
|
|
1370
|
+
* Capture a batch of spans with explicit alignment provenance
|
|
1371
|
+
* (clock_source, skew_bound_ms, rule_version). Batches are capped at 50
|
|
1372
|
+
* spans and may span sessions — every span is self-addressed. Parent
|
|
1373
|
+
* structure rides the batch: a span's `parentSpanId` names another span's
|
|
1374
|
+
* caller-local `spanId` within the same batch and is wired server-side
|
|
1375
|
+
* (unresolvable references land null). Same fire-and-log discipline as the
|
|
1376
|
+
* single-span capture above.
|
|
1377
|
+
*/
|
|
1378
|
+
static captureSpans(spans: SpanInput[], alignment: AlignmentProvenance): Promise<void>;
|
|
1103
1379
|
/**
|
|
1104
1380
|
* Flag a persona break for a session. Wire this to the customer's in-product
|
|
1105
1381
|
* "that didn't sound like you" UX. Populates the `user_flagged_break`
|
|
1106
|
-
* outcome column
|
|
1382
|
+
* outcome column on the dashboard.
|
|
1107
1383
|
*
|
|
1108
1384
|
* If `turnIndex` is omitted, the flag attaches to the session's most
|
|
1109
1385
|
* recent turn.
|
|
@@ -1128,4 +1404,4 @@ declare class Probe {
|
|
|
1128
1404
|
private static shouldSample;
|
|
1129
1405
|
}
|
|
1130
1406
|
|
|
1131
|
-
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 };
|
|
1407
|
+
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 };
|