@tangle-network/traces 0.11.6 → 0.15.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.
package/dist/index.d.ts CHANGED
@@ -1,17 +1,29 @@
1
1
  import { TraceValidation, SpanKind, Outcome } from '@tangle-network/agent-trace-contract';
2
2
  export { Capability, ConformanceFinding, ContractSpan, SpanLink, TraceValidation } from '@tangle-network/agent-trace-contract';
3
- import { ToolUseMetrics, InMemoryTraceStore, CounterfactualRunner, CounterfactualContext, TraceEmitter, TraceStore } from '@tangle-network/agent-eval';
3
+ import { SpanSourceReader, TraceAnalysisStore, RedactionRule, RedactionReport } from '@tangle-network/agent-eval/traces';
4
+ export { DEFAULT_REDACTION_RULES, ErrorCluster, RedactionReport, RedactionRule, TraceAnalysisStore, redactString, redactValue } from '@tangle-network/agent-eval/traces';
5
+ import { ToolUseMetrics, InMemoryTraceStore, CostProvenance, CounterfactualRunner, CounterfactualContext, TraceEmitter, TraceStore } from '@tangle-network/agent-eval';
4
6
  import { StuckLoopReport, FailureClusterReport } from '@tangle-network/agent-eval/pipelines';
5
- import { TraceAnalystDefinition, TraceAnalysisEngine, AnalystRegistry, AnalystFinding, buildDefaultAnalystRegistry, AnalystRunSummary, AnalystRunResult, Analyst } from '@tangle-network/agent-eval/analyst';
7
+ import { TraceAnalystDefinition, TraceAnalysisEngine, AnalystRegistry, AnalystFinding, buildDefaultAnalystRegistry, AnalystRunSummary, AnalystRunResult, Analyst, RawAnalystFinding, AnalystUsageReceipt, TraceAnalystLimits } from '@tangle-network/agent-eval/analyst';
6
8
  export { Analyst, AnalystContext, AnalystFinding, AnalystRegistry, buildDefaultAnalystRegistry, makeFinding } from '@tangle-network/agent-eval/analyst';
7
9
  import { ExecutionReport } from '@tangle-network/agent-eval/contract';
8
- import { TraceAnalysisStore, RedactionRule, RedactionReport } from '@tangle-network/agent-eval/traces';
9
- export { DEFAULT_REDACTION_RULES, ErrorCluster, RedactionReport, RedactionRule, TraceAnalysisStore, redactString, redactValue } from '@tangle-network/agent-eval/traces';
10
10
  import { SpawnEvent, NodeStatus, Runtime, Budget, Spend } from '@tangle-network/agent-runtime/kernel';
11
11
  import { SupervisorRunNodeRole, SupervisorRunReader, SupervisorRunSources } from '@tangle-network/agent-eval/supervisor-run';
12
12
  import { TraceSpanEvent } from '@tangle-network/agent-eval/hosted';
13
13
  export { HostedClient, createHostedClient, hostedClientFromEnv } from '@tangle-network/agent-eval/hosted';
14
14
 
15
+ declare const SOURCE_ATTRIBUTE_PREFIX = "traces.source_record.";
16
+ /** Location of original bytes, never a copy of their content. */
17
+ interface SourceRecordReference {
18
+ sourceId: string;
19
+ sourceSha256?: string;
20
+ recordOffset: number;
21
+ recordBytes: number;
22
+ recordSha256: string;
23
+ fieldLocator: string;
24
+ }
25
+ type SourceReferences = SourceRecordReference | readonly SourceRecordReference[] | undefined;
26
+
15
27
  /**
16
28
  * The INBOUND path: read OTLP-JSONL that some other system emitted and hand it
17
29
  * to the same analysis pipeline the adapters feed.
@@ -263,6 +275,7 @@ interface OtlpSpan {
263
275
  links?: OtlpSpanLink[];
264
276
  }
265
277
  interface SpanInput {
278
+ contentSource?: SourceReferences;
266
279
  traceId: string;
267
280
  spanId: string;
268
281
  parentSpanId?: string | null;
@@ -361,13 +374,15 @@ interface JsonlCorruptionReceipt {
361
374
  rawBytes: 'local_source_only';
362
375
  }
363
376
  type JsonlReadOptions = {
377
+ captureSources?: boolean;
378
+ } & ({
364
379
  mode?: 'strict';
365
380
  signal?: AbortSignal;
366
381
  } | {
367
382
  mode: 'recover';
368
383
  onCorruption: (receipt: JsonlCorruptionReceipt) => void;
369
384
  signal?: AbortSignal;
370
- };
385
+ });
371
386
  declare class JsonlParseError extends SyntaxError {
372
387
  readonly sourcePath: string;
373
388
  readonly lineNumber: number;
@@ -395,6 +410,8 @@ declare function takeJsonl<T>(path: string, limit: number, options?: JsonlReadOp
395
410
 
396
411
  type CorruptionMode = 'recover' | 'strict';
397
412
  interface ParseOptions {
413
+ /** Attach source locations for a caller that will retain the original files. */
414
+ captureSources?: boolean;
398
415
  /** Recover valid JSONL records by default; strict rejects the first corruption. */
399
416
  corruptionMode?: CorruptionMode;
400
417
  /** For resumed session formats, parse all turns, the latest turn, or one exact turn. */
@@ -480,6 +497,24 @@ interface HarnessTraceAdapter {
480
497
  * Adapters must not infer this from names or timestamps.
481
498
  */
482
499
  resolveParentTask?(ref: SessionRef, childSessionId: string, options?: Pick<ParseOptions, 'corruptionMode' | 'signal'>): Promise<ParentTaskResolution>;
500
+ /**
501
+ * Resolve the child sessions a parent spawned when the harness recorded no child session ID.
502
+ *
503
+ * Some harness builds name a spawned child only by the task path the parent asked for
504
+ * (codex `exec` 0.148-0.152 returns `{"task_name": "/root/c1_b_grid"}` and emits no
505
+ * `sub_agent_activity` stream). The same path is stamped in the child's own session metadata
506
+ * alongside its parent's ID, so the pair (parent session ID, agent path) is an exact key.
507
+ * Adapters must match that pair exactly and must not infer a child from names or timestamps.
508
+ */
509
+ locateSpawnedChildren?(parentSessionId: string, agentPaths: readonly string[], options?: LocateOptions & Pick<ParseOptions, 'corruptionMode' | 'signal'>): Promise<readonly SpawnedChildResolution[]>;
510
+ }
511
+ /** One `agent path -> child session` answer. `ref` is absent when the pair matched no file. */
512
+ interface SpawnedChildResolution {
513
+ readonly agentPath: string;
514
+ readonly ref?: SessionRef;
515
+ readonly reason?: 'not-found' | 'ambiguous';
516
+ /** Session IDs that matched the pair when more than one did. */
517
+ readonly candidates?: readonly string[];
483
518
  }
484
519
 
485
520
  /**
@@ -665,11 +700,13 @@ interface LoopConvergenceReport {
665
700
  /** One causal edge: a graded span, and the work it caused. */
666
701
  interface SteeringEdge {
667
702
  /** The span that CAUSED the work — a verdict, an earlier attempt. */
703
+ readonly causeTraceId: string;
668
704
  readonly causeSpanId: string;
669
705
  readonly causeName: string | null;
670
706
  readonly causeOutcome: Outcome | null;
671
707
  readonly causeScore: number | null;
672
708
  /** The span the link was recorded on: the work that was caused. */
709
+ readonly effectTraceId: string;
673
710
  readonly effectSpanId: string;
674
711
  readonly effectName: string;
675
712
  readonly effectIteration: number | null;
@@ -916,7 +953,9 @@ declare class JsonSourceError extends Error {
916
953
  readonly code?: string;
917
954
  constructor(sourcePath: string, kind: JsonSourceErrorKind, cause: unknown);
918
955
  }
919
- declare function readJsonFile<T>(path: string): Promise<T>;
956
+ declare function readJsonFile<T>(path: string, options?: {
957
+ captureSources?: boolean;
958
+ }): Promise<T>;
920
959
 
921
960
  declare function recordSessionCorruption(ref: SessionRef, receipt: JsonlCorruptionReceipt): void;
922
961
  declare function sessionIntegrityAttributes(ref: SessionRef): Record<string, string | number>;
@@ -995,6 +1034,12 @@ interface ScannedSession {
995
1034
  * propagate unless an explicit `onError` callback handles them. */
996
1035
  declare function scanSessions(opts: ScanOptions): AsyncGenerator<ScannedSession>;
997
1036
 
1037
+ /** Grant only the original records associated with unchanged attributes in these selected spans. */
1038
+ declare function createBundleSourceReader(directory: string, spans: readonly OtlpSpan[], options?: {
1039
+ signal?: AbortSignal;
1040
+ maxRecordBytes?: number;
1041
+ }): Promise<SpanSourceReader | undefined>;
1042
+
998
1043
  type SessionRole = 'operator' | 'child' | 'unknown';
999
1044
  interface SessionRelationship {
1000
1045
  readonly sessionId: string;
@@ -1005,6 +1050,15 @@ interface SessionRelationship {
1005
1050
  readonly spawnedChildSessionIds: readonly string[];
1006
1051
  /** Existing child sessions resumed or steered in this task. */
1007
1052
  readonly resumedChildSessionIds: readonly string[];
1053
+ /**
1054
+ * Agent paths this session spawned that carry NO child session ID.
1055
+ *
1056
+ * A codex `exec` build returns `{"task_name": "/root/c1_b_grid"}` from `spawn_agent` and emits
1057
+ * no `sub_agent_activity` stream, so both id-bearing keys are absent. The child exists, ran,
1058
+ * and spent tokens; only the ID is missing. These paths are the join key of last resort, and
1059
+ * a path still on this list after expansion is a child that was NOT joined.
1060
+ */
1061
+ readonly unjoinedSpawnPaths: readonly string[];
1008
1062
  readonly depth?: number;
1009
1063
  readonly agentNickname?: string;
1010
1064
  readonly agentRole?: string;
@@ -1040,6 +1094,20 @@ type SessionWorkflowIssue = {
1040
1094
  } | {
1041
1095
  readonly kind: 'cycle';
1042
1096
  readonly sessionIds: readonly string[];
1097
+ } | {
1098
+ /**
1099
+ * A child the parent demonstrably spawned that no session file could be joined to.
1100
+ *
1101
+ * This exists so a silent miss can never read as clean. `--workflow` used to report
1102
+ * `0 relationship issues` for a codex parent with three `spawn_agent` calls and three child
1103
+ * rollouts in the same directory, because the harness recorded no child session ID and the
1104
+ * expansion therefore had nothing to look for. An unjoinable child is now a stated issue.
1105
+ */
1106
+ readonly kind: 'unjoined-child';
1107
+ readonly parentSessionId: string;
1108
+ readonly agentPath: string;
1109
+ readonly reason: 'not-found' | 'ambiguous' | 'unsupported';
1110
+ readonly candidates?: readonly string[];
1043
1111
  } | {
1044
1112
  readonly kind: 'unresolved-parent-task';
1045
1113
  readonly parentSessionId: string;
@@ -1101,6 +1169,7 @@ interface CollectSessionSelectionOptions {
1101
1169
  readonly bindSources?: boolean;
1102
1170
  readonly signal?: AbortSignal;
1103
1171
  }
1172
+ declare function fileSha256(path: string, signal?: AbortSignal): Promise<string>;
1104
1173
  /** Parse selected seed groups, optionally expanding and byte-binding their session tree. */
1105
1174
  declare function collectSessionSelection(groups: readonly SessionSeedGroup[], options?: CollectSessionSelectionOptions): Promise<SessionSelection>;
1106
1175
 
@@ -1121,8 +1190,19 @@ interface RepoResolution {
1121
1190
  * `git@host:owner/repo.git` SCP-style forms. Returns null when unparseable.
1122
1191
  */
1123
1192
  declare function normalizeRemote(url: string): string | null;
1124
- /** Expand a selected cwd to every checked-out worktree for the same git repo. */
1193
+ /**
1194
+ * Expand a selected cwd to every checked-out worktree for the same git repo.
1195
+ * Each candidate is emitted in both its selected and its resolved form: git
1196
+ * prints symlink-resolved paths (macOS `/var` → `/private/var`), while a
1197
+ * recorded session cwd usually keeps the unresolved spelling, and a match
1198
+ * must not depend on which spelling either side used.
1199
+ */
1125
1200
  declare function equivalentGitCwds(cwd: string | null | undefined): Promise<string[]>;
1201
+ /**
1202
+ * `cwdMatchesSelection`, then a second attempt with the cwd's resolved
1203
+ * (symlink-free) form. A deleted cwd cannot resolve and keeps the raw verdict.
1204
+ */
1205
+ declare function cwdMatchesSelectionResolved(cwd: string | null | undefined, selections: readonly string[]): Promise<boolean>;
1126
1206
  /** Boundary-aware cwd matching; `/repo` matches `/repo/src`, not `/repo-old`. */
1127
1207
  declare function cwdMatchesSelection(cwd: string | null | undefined, selections: readonly string[]): boolean;
1128
1208
  /**
@@ -1197,6 +1277,13 @@ declare class CodexAdapter implements HarnessTraceAdapter {
1197
1277
  locate(opts?: LocateOptions): Promise<SessionRef[]>;
1198
1278
  locateBySessionId(sessionId: string, opts?: LocateOptions): Promise<SessionRef[]>;
1199
1279
  resolveParentTask(ref: SessionRef, childSessionId: string, options?: Pick<ParseOptions, 'corruptionMode'>): Promise<ParentTaskResolution>;
1280
+ /**
1281
+ * Join a parent's `spawn_agent` calls to the child rollouts they produced, by the exact pair
1282
+ * (parent thread ID, agent path). Only the head of each candidate file is read.
1283
+ */
1284
+ locateSpawnedChildren(parentSessionId: string, agentPaths: readonly string[], opts?: LocateOptions & Pick<ParseOptions, 'corruptionMode' | 'signal'>): Promise<readonly SpawnedChildResolution[]>;
1285
+ /** The parent thread ID and agent path a child rollout stamps in its own session metadata. */
1286
+ private readSpawnIdentity;
1200
1287
  parse(ref: SessionRef, options?: ParseOptions): Promise<OtlpSpan[]>;
1201
1288
  }
1202
1289
 
@@ -1235,7 +1322,8 @@ declare class OpencodeAdapter implements HarnessTraceAdapter {
1235
1322
  readonly harness = "opencode";
1236
1323
  private storage;
1237
1324
  locate(opts?: LocateOptions): Promise<SessionRef[]>;
1238
- parse(ref: SessionRef): Promise<OtlpSpan[]>;
1325
+ sourcePaths(ref: SessionRef): Promise<readonly string[]>;
1326
+ parse(ref: SessionRef, options?: ParseOptions): Promise<OtlpSpan[]>;
1239
1327
  }
1240
1328
 
1241
1329
  /**
@@ -1270,7 +1358,7 @@ declare class GeminiFamilyAdapter implements HarnessTraceAdapter {
1270
1358
  * digests and stay null.) Loaded once per locate(). */
1271
1359
  private loadProjectCwds;
1272
1360
  locate(opts?: LocateOptions): Promise<SessionRef[]>;
1273
- parse(ref: SessionRef): Promise<OtlpSpan[]>;
1361
+ parse(ref: SessionRef, options?: ParseOptions): Promise<OtlpSpan[]>;
1274
1362
  }
1275
1363
  declare class GeminiAdapter extends GeminiFamilyAdapter {
1276
1364
  constructor();
@@ -1316,6 +1404,7 @@ declare class FactoryAdapter implements HarnessTraceAdapter {
1316
1404
  readonly aliases: readonly ["factory-droids", "droid"];
1317
1405
  private root;
1318
1406
  locate(opts?: LocateOptions): Promise<SessionRef[]>;
1407
+ sourcePaths(ref: SessionRef): Promise<readonly string[]>;
1319
1408
  parse(ref: SessionRef, options?: ParseOptions): Promise<OtlpSpan[]>;
1320
1409
  }
1321
1410
 
@@ -1361,7 +1450,7 @@ declare class AmpAdapter implements HarnessTraceAdapter {
1361
1450
  readonly harness = "amp";
1362
1451
  private threadsRoot;
1363
1452
  locate(opts?: LocateOptions): Promise<SessionRef[]>;
1364
- parse(ref: SessionRef): Promise<OtlpSpan[]>;
1453
+ parse(ref: SessionRef, options?: ParseOptions): Promise<OtlpSpan[]>;
1365
1454
  }
1366
1455
 
1367
1456
  /**
@@ -1407,7 +1496,7 @@ declare class ForgeAdapter implements HarnessTraceAdapter {
1407
1496
  /** Directories scanned for `*-dump.json` exports. */
1408
1497
  private dumpDirs;
1409
1498
  locate(opts?: LocateOptions): Promise<SessionRef[]>;
1410
- parse(ref: SessionRef): Promise<OtlpSpan[]>;
1499
+ parse(ref: SessionRef, options?: ParseOptions): Promise<OtlpSpan[]>;
1411
1500
  }
1412
1501
 
1413
1502
  /**
@@ -1441,6 +1530,7 @@ type Actor = 'human' | 'agent' | 'subagent-spawn' | 'injected' | 'tool-result';
1441
1530
  * `tangle.sessionId`/`tangle.ingest_source` wire contract. */
1442
1531
  declare const ACTOR_ATTR = "tangle.actor";
1443
1532
  interface UserPromptInput {
1533
+ contentSource?: SourceReferences;
1444
1534
  traceId: string;
1445
1535
  spanId: string;
1446
1536
  parentSpanId: string | null;
@@ -1500,13 +1590,19 @@ declare function claudeActor(args: {
1500
1590
  isFirstUserTurn?: boolean;
1501
1591
  }): Actor;
1502
1592
  /**
1503
- * Derive the actor for a Codex user message. Codex has no sidechain/userType,
1504
- * so it's text-only: synthetic markers → injected, first-turn agent-spawn
1505
- * brief → injected, otherwise human.
1593
+ * Derive the actor for a Codex user message.
1594
+ *
1595
+ * `kinds` is Codex's own per-item labelling and decides whenever the record
1596
+ * carries it. Without it the decision is text-only: a Codex context block →
1597
+ * injected, synthetic markers → injected, first-turn agent-spawn brief →
1598
+ * injected, otherwise human. `blocks` are the message's separate text blocks;
1599
+ * Codex treats the whole message as context when any one block is.
1506
1600
  */
1507
1601
  declare function codexActor(args: {
1508
1602
  text: string;
1603
+ blocks?: readonly string[];
1509
1604
  isFirstUserTurn?: boolean;
1605
+ kinds?: readonly unknown[];
1510
1606
  }): Actor;
1511
1607
  type Reaction = 'correction' | 'frustration' | 'praise' | 'jargon' | 'structure';
1512
1608
  /** Label a human turn with every reaction signal it matches. Mirrors
@@ -1516,6 +1612,100 @@ declare function classifyReaction(text: string): Reaction[];
1516
1612
  * corrective-to-positive ratio). `praise` is the positive denominator. */
1517
1613
  declare const CORRECTIVE_REACTIONS: readonly Reaction[];
1518
1614
 
1615
+ /**
1616
+ * Provenance markers for spans an adapter did NOT take from an action the agent
1617
+ * performed inside the parsed scope.
1618
+ *
1619
+ * Three cases, and all of them used to be invisible:
1620
+ *
1621
+ * - SYNTHESIZED — the adapter built the span from harness lifecycle events,
1622
+ * not from a call the model issued. A Codex subagent's start/finish stream
1623
+ * is one span per child thread; recording it as a TOOL call named
1624
+ * `tool.Agent` made every tool-call count high by exactly the number of
1625
+ * child threads, and nothing on the span let a counter tell the difference.
1626
+ * - INHERITED — the record belongs to context this session carries but did
1627
+ * not produce: the prefix a fork copies from its parent, and the history a
1628
+ * `compacted` record retains. Keeping the human's words is the point;
1629
+ * counting them as turns of THIS scope is not.
1630
+ * - SUBAGENT — the record came from a child agent's OWN transcript, folded
1631
+ * into the parent's trace by an adapter that reads the whole session tree.
1632
+ * Claude Code writes one file per spawned agent under the session
1633
+ * directory and the adapter parses all of them into one trace, so the
1634
+ * parent's TOOL spans and the children's sat in the same trace with
1635
+ * nothing to tell them apart: one measured session showed 2,675 tool spans
1636
+ * where the session's own agent made 332. The subagent did that work; the
1637
+ * parent did not, and a fact about the parent must not claim it.
1638
+ *
1639
+ * All three markers are additive attributes. A count that means "what the agent
1640
+ * did in this scope" filters them out; a reader that wants the context selects
1641
+ * them. They are harness-neutral on purpose: the sheet that reads them must not
1642
+ * carry a rule per harness.
1643
+ */
1644
+ /** `true` on a span the adapter synthesized from lifecycle events. */
1645
+ declare const SYNTHESIZED_SPAN_ATTR = "traces.span.synthesized";
1646
+ /** What the synthesized span was built from, e.g. `codex.sub_agent_activity`. */
1647
+ declare const SYNTHESIZED_SOURCE_ATTR = "traces.span.synthesized_from";
1648
+ /** `true` on a span carrying context from outside the parsed scope. */
1649
+ declare const INHERITED_SPAN_ATTR = "traces.session.inherited";
1650
+ /** Where the inherited record came from: `pre-task-prefix` or `compacted`. */
1651
+ declare const INHERITED_SOURCE_ATTR = "traces.session.inherited_source";
1652
+ type InheritedSpanSource = 'pre-task-prefix' | 'compacted';
1653
+ /** Count of inherited spans in the batch, stamped on the root span. */
1654
+ declare const INHERITED_SPAN_COUNT_ATTR = "traces.session.inherited_span_count";
1655
+ /** Inherited records the adapter's per-session cap dropped, stamped on the root. */
1656
+ declare const INHERITED_SPANS_OMITTED_ATTR = "traces.session.inherited_spans_omitted";
1657
+ declare function isSynthesizedSpan(attributes: Readonly<Record<string, unknown>>): boolean;
1658
+ declare function isInheritedSpan(attributes: Readonly<Record<string, unknown>>): boolean;
1659
+
1660
+ /**
1661
+ * Failure follow-up classification — the retry-with-state marker.
1662
+ *
1663
+ * The tool-use line has long counted "failed calls followed by another
1664
+ * same-tool call", but that count cannot separate a blind retry (the same
1665
+ * arguments re-sent after a failure, so the failure produced no new state)
1666
+ * from an adapted one (the arguments changed, so the failure taught the agent
1667
+ * something). Without the split the number reads as pure waste even in a run
1668
+ * where every retry adapted — or as healthy adaptation in a run that re-sent
1669
+ * the same command 300 times.
1670
+ *
1671
+ * Arguments are compared by the full-input hash (`traces.input.sha256`) when
1672
+ * both sides carry it, because it survives `input.value` truncation, and by
1673
+ * the verbatim `input.value` otherwise. A pair whose arguments cannot be
1674
+ * compared is counted as unknown, never guessed. Calls marked
1675
+ * `traces.expected_blocking` are excluded: re-sending an identical poll after
1676
+ * a not-ready failure is the protocol working, not thrash.
1677
+ */
1678
+
1679
+ type FollowUpKind = 'blind' | 'adapted' | 'args-unknown' | 'none';
1680
+ interface FailureFollowUp {
1681
+ traceId: string;
1682
+ toolName: string;
1683
+ failedSpanId: string;
1684
+ /** Null when the tool was never called again after the failure. */
1685
+ followUpSpanId: string | null;
1686
+ kind: FollowUpKind;
1687
+ /** Captured follow-up outcome; null when absent or unknown. */
1688
+ followUpSucceeded: boolean | null;
1689
+ }
1690
+ interface FailureFollowUpReport {
1691
+ /** Failed TOOL calls classified; expected-blocking failures are excluded. */
1692
+ failures: number;
1693
+ /** Failures with a later call of the same tool in the same trace. */
1694
+ followed: number;
1695
+ /** Follow-up re-sent identical arguments. */
1696
+ blind: number;
1697
+ /** Follow-up changed the arguments. */
1698
+ adapted: number;
1699
+ /** Arguments were not captured or not comparable on one side of the pair. */
1700
+ argsUnknown: number;
1701
+ /** Follow-ups with explicit success, out of `followed`. */
1702
+ followUpSucceeded: number;
1703
+ /** Blind-retry count per tool, largest offender first when rendered. */
1704
+ blindByTool: Record<string, number>;
1705
+ items: FailureFollowUp[];
1706
+ }
1707
+ declare function classifyFailureFollowUps(spans: readonly OtlpSpan[]): FailureFollowUpReport;
1708
+
1519
1709
  /**
1520
1710
  * Run agent-eval's shipped trace pipelines over normalized harness spans.
1521
1711
  *
@@ -1524,6 +1714,10 @@ declare const CORRECTIVE_REACTIONS: readonly Reaction[];
1524
1714
  * - stuckLoopView — same tool + same args ≥ N times in a short interval
1525
1715
  * - computeToolUseMetrics — duplicate-call / retry / error rates per run
1526
1716
  *
1717
+ * One local view runs beside them: `classifyFailureFollowUps` splits each
1718
+ * failed call's same-tool follow-up into blind (identical args) vs adapted
1719
+ * (changed args), which the aggregate retry rate cannot express.
1720
+ *
1527
1721
  * `toolWasteView` is intentionally NOT used: its default heuristic needs
1528
1722
  * verbatim tool *results* + per-turn LLM `messages`, which traces
1529
1723
  * doesn't capture from harness logs (we store tool args + error status). Its
@@ -1540,6 +1734,8 @@ interface PipelineReport {
1540
1734
  stuckLoops: StuckLoopReport;
1541
1735
  failureClusters: FailureClusterReport;
1542
1736
  toolUse: ToolUseMetrics[];
1737
+ /** Absent only on hand-built reports; runPipelines always computes it. */
1738
+ failureFollowUps?: FailureFollowUpReport;
1543
1739
  }
1544
1740
  interface PipelineOptions {
1545
1741
  /** Minimum repeated identical calls to flag a loop (default 3). */
@@ -1726,6 +1922,11 @@ declare function toRuntimeStore(spans: readonly OtlpSpan[]): Promise<RuntimeTrac
1726
1922
  */
1727
1923
 
1728
1924
  interface AnalyzeOptions {
1925
+ /** Explicitly authorize original source reads from this full session bundle. */
1926
+ sourceBundle?: {
1927
+ path: string;
1928
+ maxRecordBytes?: number;
1929
+ };
1729
1930
  /**
1730
1931
  * Recursive analysis engine enabling the agentic analyst kinds. Omit →
1731
1932
  * deterministic only. The engine's id, version, and model become the
@@ -1747,6 +1948,16 @@ interface AnalyzeOptions {
1747
1948
  agenticRegistry?: AnalystRegistry;
1748
1949
  /** Select a subset of agent-eval's maintained trace analyst kinds. */
1749
1950
  agenticKinds?: readonly TraceAnalystDefinition[];
1951
+ /**
1952
+ * Supply the deterministic session-facts sheet to the agentic kinds as
1953
+ * prepared context (default true). It costs nothing and removes the guessing
1954
+ * the bounded trace tools force on a model that needs an exact count. Set
1955
+ * false to measure an analyst without it.
1956
+ *
1957
+ * It applies only to definitions this call builds a registry from; a caller
1958
+ * who brings `agenticRegistry` owns its own prepared context.
1959
+ */
1960
+ sessionFactsContext?: boolean;
1750
1961
  /** Compact deterministic findings that agents receive before reading spans. */
1751
1962
  agenticPriorFindings?: readonly AnalystFinding[];
1752
1963
  /** Where to write the OTLP-JSONL artifact. Defaults to a temp file. */
@@ -1770,6 +1981,56 @@ interface AnalyzeResult {
1770
1981
  }
1771
1982
  declare function analyzeSpans(spans: readonly OtlpSpan[], opts?: AnalyzeOptions): Promise<AnalyzeResult>;
1772
1983
 
1984
+ /**
1985
+ * Citation normalization for model-backed trace analysts.
1986
+ *
1987
+ * agent-eval's evidence gate accepts a finding only when every citation
1988
+ * resolves to a stored span and every excerpt is an exact substring of that
1989
+ * span's decoded content. Two artifacts of how `traces` exports spans make the
1990
+ * engine's own honest citations fail that check:
1991
+ *
1992
+ * - `searchTrace` returns raw OTLP-JSONL text, so an excerpt copied from a hit
1993
+ * carries JSON escapes (`\"`, `\n`) that the decoded attribute does not.
1994
+ * - Adapters rewrite readable harness IDs (`tool:<call_id>`, a session UUID)
1995
+ * to fixed-width hex OTLP IDs and keep the readable form only in
1996
+ * `traces.<harness>.source_trace_id` / `source_span_id` attributes, so a
1997
+ * citation of the readable ID names no stored span.
1998
+ *
1999
+ * A third rejection is a subject from another kind's vocabulary (for example a
2000
+ * `tool-doc:` locus on the cluster-only failure-mode kind). The subject is an
2001
+ * optional label, and the finding schema tells the model to omit it rather
2002
+ * than guess, so a subject the kind cannot hold is removed.
2003
+ *
2004
+ * Protected invariant: normalization never lets absent evidence pass. A
2005
+ * citation is rewritten only to a form proven present in the span it cites: a
2006
+ * readable ID must name exactly one span, and a decoded excerpt must be a
2007
+ * substring of that span's own attributes or status message. Anything else is
2008
+ * left untouched, and agent-eval's gate re-checks every rewritten row
2009
+ * unchanged. Normalization never adds a citation, so it cannot satisfy a
2010
+ * kind's minimum citation count on its own.
2011
+ *
2012
+ * Temporary: the agent-eval gate issue (agent-eval#TBD) makes this module
2013
+ * unnecessary. Delete it when traces adopts a release whose gate accepts
2014
+ * JSON-escaped excerpts, resolves the readable source-ID aliases above, and
2015
+ * treats an out-of-kind optional subject as omitted.
2016
+ */
2017
+
2018
+ /**
2019
+ * Appended to each wrapped definition's version. agent-eval records a
2020
+ * `postProcess` hook as `version-bound`, so the version names this behavior.
2021
+ * Bump it whenever the normalization rules change.
2022
+ */
2023
+ declare const CITATION_NORMALIZATION_VERSION = "traces-citations-1";
2024
+ /**
2025
+ * Wrap trace-analyst definitions so each submitted finding is normalized
2026
+ * against `spans` before agent-eval's evidence gate runs.
2027
+ *
2028
+ * Pass the same spans the analysts' trace store was written from. A
2029
+ * definition's own `postProcess` runs after normalization and keeps the final
2030
+ * say over the row.
2031
+ */
2032
+ declare function normalizeAnalystCitations(definitions: readonly TraceAnalystDefinition[], spans: readonly OtlpSpan[]): TraceAnalystDefinition[];
2033
+
1773
2034
  interface TraceExecutionOptions {
1774
2035
  readonly experimentId?: string;
1775
2036
  readonly candidateId?: string;
@@ -1993,6 +2254,8 @@ declare function writeSessionIndexFile(index: TraceSessionIndex, outPath?: strin
1993
2254
  */
1994
2255
 
1995
2256
  interface SessionBundleFile {
2257
+ /** Opaque source identity when this file backs native span attributes. */
2258
+ readonly sourceId?: string;
1996
2259
  /** Bundle-relative path, `/`-separated. */
1997
2260
  readonly path: string;
1998
2261
  readonly bytes: number;
@@ -2467,6 +2730,13 @@ declare function runExternalAnalyzers(otlpPath: string, analyzers: readonly Exte
2467
2730
  signal?: AbortSignal;
2468
2731
  spans?: readonly OtlpSpan[];
2469
2732
  }): Promise<ExternalAnalysisResult[]>;
2733
+ /**
2734
+ * Operator-facing message naming every external analyzer that failed, or
2735
+ * undefined when all succeeded. A caller that requested an engine should
2736
+ * treat its failure as a failed run: the report still carries the error, but
2737
+ * exit 0 would read as "the engine ran and found nothing".
2738
+ */
2739
+ declare function externalFailureMessage(results: readonly ExternalAnalysisResult[]): string | undefined;
2470
2740
  /** An external PII/secret scrubber for free-form text — catches what regex
2471
2741
  * can't (names, addresses). Use to harden upload beyond the built-in rules. */
2472
2742
  interface Redactor {
@@ -2484,6 +2754,57 @@ declare function commandRedactor(spec: {
2484
2754
  timeoutMs?: number;
2485
2755
  }): Redactor;
2486
2756
 
2757
+ /**
2758
+ * Evidence-gate rejections, counted per analyst and reason.
2759
+ *
2760
+ * agent-eval's trace analysts drop a submitted finding when its citations do
2761
+ * not resolve, and report each drop only as a `finding rejected: ...` log
2762
+ * event. A report that shows "0 findings" without those events reads as "the
2763
+ * model found nothing" when the truth may be "the gate refused everything it
2764
+ * found". This module turns the log events into counts a report can print.
2765
+ */
2766
+ /** Rejection counts by reason, for one analyst or question. */
2767
+ type FindingRejectionReasons = Readonly<Record<string, number>>;
2768
+ /** Rejection counts keyed by analyst ID, then by reason. */
2769
+ type FindingRejectionCounts = Readonly<Record<string, FindingRejectionReasons>>;
2770
+ /**
2771
+ * The analyst and reason behind one `finding rejected:` log event, or
2772
+ * undefined for any other event. The registry prefixes each analyst's log
2773
+ * message with `[<analyst-id>] `; a direct `runTraceAnalyst` caller does not,
2774
+ * so the analyst ID is optional here.
2775
+ */
2776
+ declare function findingRejection(message: string, fields?: Readonly<Record<string, unknown>>): {
2777
+ analystId?: string;
2778
+ reason: string;
2779
+ } | undefined;
2780
+ /**
2781
+ * What a rejection log event carries beyond its own message: the cause, the
2782
+ * offending URI, the citation counts, the subject. Empty when the message
2783
+ * already says everything known — the kind is in the message, so repeating it
2784
+ * would print "finding rejected: schema failure — schema failure". Undefined
2785
+ * for an event that is not a rejection at all.
2786
+ */
2787
+ declare function findingRejectionDetail(message: string, fields?: Readonly<Record<string, unknown>>): string | undefined;
2788
+ interface FindingRejectionTally {
2789
+ /** Record one log event; events that are not rejections are ignored. */
2790
+ record(message: string, fields?: Readonly<Record<string, unknown>>): void;
2791
+ /** A snapshot of the counts so far. */
2792
+ counts(): FindingRejectionCounts;
2793
+ }
2794
+ /**
2795
+ * Count rejections from a log stream. `defaultAnalystId` names the analyst
2796
+ * for unprefixed events, as when one tally observes one question.
2797
+ */
2798
+ declare function createFindingRejectionTally(defaultAnalystId?: string): FindingRejectionTally;
2799
+ /** Total rejections across every reason. */
2800
+ declare function totalFindingRejections(reasons: FindingRejectionReasons | undefined): number;
2801
+ /**
2802
+ * "2 finding(s) rejected: excerpt is not present in the cited span content ×2".
2803
+ * Empty when nothing was rejected. Reasons are ordered by count, then name, so
2804
+ * the same counts always render the same text.
2805
+ */
2806
+ declare function formatFindingRejections(reasons: FindingRejectionReasons | undefined): string;
2807
+
2487
2808
  type TraceLiveSeverity = 'info' | 'low' | 'medium' | 'high';
2488
2809
  interface TraceLiveEvidence {
2489
2810
  readonly kind: 'metric' | 'span' | 'pattern';
@@ -2683,6 +3004,8 @@ interface TracesConfig {
2683
3004
  readonly externalAnalyzers?: readonly ExternalAnalyzer[];
2684
3005
  }
2685
3006
  interface TraceInvestigationOptions {
3007
+ /** Explicit full-bundle source access for local analyst tools only. */
3008
+ readonly sourceBundle?: AnalyzeOptions['sourceBundle'];
2686
3009
  readonly spans: readonly OtlpSpan[];
2687
3010
  readonly harness: string;
2688
3011
  readonly sources?: readonly ReportSource[];
@@ -2774,6 +3097,12 @@ interface TraceInvestigationResult {
2774
3097
  * findings as if the requested LLM analysis had happened.
2775
3098
  */
2776
3099
  readonly agenticPerAnalyst?: readonly AnalystRunSummary[];
3100
+ /**
3101
+ * Findings the evidence gate refused, by analyst ID and reason. Present
3102
+ * whenever an agentic pass ran, empty when nothing was refused, so a zero
3103
+ * finding count can be told apart from "every finding was rejected".
3104
+ */
3105
+ readonly findingRejections?: FindingRejectionCounts;
2777
3106
  readonly external: readonly ExternalAnalysisResult[];
2778
3107
  readonly report: string;
2779
3108
  }
@@ -2817,6 +3146,8 @@ declare function buildTraceFindingPacket(opts: BuildTraceFindingPacketOptions):
2817
3146
  declare function loadTracesConfig(path?: string): Promise<TracesConfig | undefined>;
2818
3147
  declare function mergeTracesConfig(opts: TraceInvestigationOptions, config?: TracesConfig): TraceInvestigationOptions;
2819
3148
  declare function runTraceInvestigation(opts: TraceInvestigationOptions): Promise<TraceInvestigationResult>;
3149
+ /** True when an engine error looks like bridge version skew or a missing bridge install. */
3150
+ declare function isBridgeMismatchError(message: string): boolean;
2820
3151
  /**
2821
3152
  * Operator-facing message for a fully dead agentic pass: non-empty exactly
2822
3153
  * when an agentic pass ran and NO analyst in it succeeded — failed and
@@ -2832,6 +3163,651 @@ declare function writeTraceImprovementArtifacts(result: Omit<TraceImprovementRes
2832
3163
  declare function runTraceImprovement(opts: TraceImprovementOptions): Promise<TraceImprovementResult>;
2833
3164
  declare function saveReport(path: string, report: string): Promise<void>;
2834
3165
 
3166
+ /**
3167
+ * Answer schemas for `traces ask`.
3168
+ *
3169
+ * A question may fix the shape of its answer with a JSON Schema, so a scorer
3170
+ * can compare fields exactly instead of reading prose. This package carries no
3171
+ * JSON Schema library, so it checks a small subset and REJECTS any schema that
3172
+ * uses a keyword outside it: a schema whose constraint is silently ignored
3173
+ * would let a wrong answer pass as checked.
3174
+ *
3175
+ * Supported keywords: `type`, `properties`, `required`, `additionalProperties`
3176
+ * (boolean), `items` (one schema), `enum`, `const`, and the annotations
3177
+ * `title` and `description`. The four keywords that constrain one JSON type
3178
+ * must declare that type: `required` without `"type": "object"`, or `items`
3179
+ * without `"type": "array"`, checks nothing against an answer of another shape.
3180
+ */
3181
+ type AnswerSchema = Readonly<Record<string, unknown>>;
3182
+ /** Throw a TypeError naming the first unsupported or malformed part of `schema`. */
3183
+ declare function assertAnswerSchema(schema: unknown, path?: string, depth?: number): asserts schema is AnswerSchema;
3184
+ /**
3185
+ * Every way `value` breaks `schema`, as `$.path: problem` strings. Empty means
3186
+ * the value conforms. The schema must already have passed `assertAnswerSchema`.
3187
+ */
3188
+ declare function answerSchemaErrors(value: unknown, schema: AnswerSchema, path?: string): string[];
3189
+ /**
3190
+ * Read one JSON value from a model's answer text. The whole text is tried
3191
+ * first; a single fenced block is accepted because models wrap JSON in one
3192
+ * even when told not to. Anything else is a parse failure, not a guess.
3193
+ */
3194
+ declare function parseJsonAnswer(text: string): {
3195
+ ok: true;
3196
+ value: unknown;
3197
+ } | {
3198
+ ok: false;
3199
+ error: string;
3200
+ };
3201
+
3202
+ /**
3203
+ * `traces ask`: free-form questions over trace sessions, answered by a
3204
+ * recursive trace-analysis engine.
3205
+ *
3206
+ * Each question runs through agent-eval's `runTraceAnalyst` directly instead
3207
+ * of the analyst registry. The registry keeps only findings, so it discards
3208
+ * the engine's prose answer, and it runs analysts one at a time. Here the
3209
+ * questions run concurrently under one shared cost ledger, so a single budget
3210
+ * bounds all of them, and every `trace://` citation in an answer is checked
3211
+ * against the store before the answer counts as answered.
3212
+ */
3213
+
3214
+ /** One question to ask of the selected traces. */
3215
+ interface TraceQuestion {
3216
+ /** Stable ID for the report, the JSON result, and cost attribution. Default: `q<n>`. */
3217
+ readonly id?: string;
3218
+ readonly question: string;
3219
+ /** Extra guidance for this question only, placed after the shared rules. */
3220
+ readonly instructions?: string;
3221
+ /**
3222
+ * JSON Schema the answer must satisfy (see `answer-schema.ts` for the
3223
+ * supported subset). With a schema the answer must be one JSON value.
3224
+ */
3225
+ readonly answerSchema?: AnswerSchema;
3226
+ }
3227
+ /** Why a question did not produce a checked answer. */
3228
+ type TraceQuestionFailureKind = 'error' | 'aborted' | 'budget-refused' | 'no-answer' | 'invalid-answer' | 'unresolved-citations';
3229
+ interface TraceQuestionCitation {
3230
+ readonly uri: string;
3231
+ readonly traceId: string | null;
3232
+ readonly spanId: string | null;
3233
+ /** True only when the store holds the cited span. */
3234
+ readonly resolved: boolean;
3235
+ }
3236
+ interface TraceQuestionAnswer {
3237
+ readonly id: string;
3238
+ readonly question: string;
3239
+ readonly status: 'answered' | 'failed';
3240
+ readonly failure?: {
3241
+ readonly kind: TraceQuestionFailureKind;
3242
+ readonly message: string;
3243
+ };
3244
+ /** The engine's prose answer, verbatim. Null when the engine returned none. */
3245
+ readonly answer: string | null;
3246
+ /** The answer parsed as JSON, present when the question had an answer schema and it parsed. */
3247
+ readonly parsedAnswer?: unknown;
3248
+ /** Every `trace://` URI in the answer text, with whether it resolved. */
3249
+ readonly citations: readonly TraceQuestionCitation[];
3250
+ /** Findings the evidence gate accepted. */
3251
+ readonly findings: readonly RawAnalystFinding[];
3252
+ /** Findings the evidence gate refused, by reason. */
3253
+ readonly rejectedFindings: FindingRejectionReasons;
3254
+ readonly model: string | null;
3255
+ /** Successful model completions the engine reported; null when the engine failed. */
3256
+ readonly modelCalls: number | null;
3257
+ /** Trace-tool requests the engine reported; null when the engine failed. */
3258
+ readonly toolCalls: number | null;
3259
+ /** Provider usage and cost for this question alone, from the shared ledger. */
3260
+ readonly usage: AnalystUsageReceipt | null;
3261
+ readonly startedAt: string;
3262
+ readonly endedAt: string;
3263
+ readonly latencyMs: number;
3264
+ /** Engine-native steps, retained for audit. */
3265
+ readonly trajectory?: readonly unknown[];
3266
+ }
3267
+ /** One trace the questions could read. */
3268
+ interface TraceQuestionTrace {
3269
+ readonly traceId: string;
3270
+ readonly sessionId: string | null;
3271
+ readonly spanCount: number;
3272
+ readonly startTime: string | null;
3273
+ readonly endTime: string | null;
3274
+ readonly rootSpan: string | null;
3275
+ }
3276
+ interface TraceQuestionsTotals {
3277
+ readonly questions: number;
3278
+ readonly answered: number;
3279
+ readonly failed: number;
3280
+ /** Null when at least one question's count is unknown. */
3281
+ readonly modelCalls: number | null;
3282
+ /** Null when at least one question's count is unknown. */
3283
+ readonly toolCalls: number | null;
3284
+ /** Paid provider calls the shared ledger recorded, including failed ones. */
3285
+ readonly providerCalls: number;
3286
+ /** Total spend with its provenance; `uncaptured` carries a null amount, never 0. */
3287
+ readonly cost: CostProvenance;
3288
+ /** Wall time of the whole run, from the first span written to the last answer. */
3289
+ readonly wallTimeMs: number;
3290
+ /** Part of `wallTimeMs` spent writing and indexing the trace file, before any question ran. */
3291
+ readonly setupTimeMs: number;
3292
+ /** Sum of the questions' own latencies; above `wallTimeMs` when questions overlapped. */
3293
+ readonly questionTimeMs: number;
3294
+ /** Most questions observed running at the same time. */
3295
+ readonly peakConcurrency: number;
3296
+ }
3297
+ interface TraceQuestionsResult {
3298
+ readonly schemaVersion: 1;
3299
+ readonly kind: 'traces.ask';
3300
+ readonly generatedAt: string;
3301
+ readonly harness: string;
3302
+ readonly engine: {
3303
+ readonly id: string;
3304
+ readonly version: string;
3305
+ readonly model: string | null;
3306
+ };
3307
+ /** Questions the run was allowed to overlap, as requested. */
3308
+ readonly concurrency: number;
3309
+ /** Workers the run actually created: `min(concurrency, questions)`. */
3310
+ readonly effectiveConcurrency: number;
3311
+ /** Shared ceiling across every question; null when uncapped. */
3312
+ readonly budgetUsd: number | null;
3313
+ /** The engine's own ceiling for one question, when it declares one. */
3314
+ readonly questionBudgetUsd: number | null;
3315
+ readonly spanCount: number;
3316
+ readonly otlpPath: string;
3317
+ readonly traces: readonly TraceQuestionTrace[];
3318
+ readonly questions: readonly TraceQuestionAnswer[];
3319
+ readonly totals: TraceQuestionsTotals;
3320
+ readonly warnings: readonly string[];
3321
+ /** True when every question produced an answer whose citations all resolved. */
3322
+ readonly ok: boolean;
3323
+ readonly report: string;
3324
+ }
3325
+ interface TraceQuestionsOptions {
3326
+ readonly questions: readonly TraceQuestion[];
3327
+ readonly spans: readonly OtlpSpan[];
3328
+ readonly engine: TraceAnalysisEngine;
3329
+ readonly harness?: string;
3330
+ /** Questions running at once. Default 4. */
3331
+ readonly concurrency?: number;
3332
+ /** Shared USD ceiling across every question. Omit for no shared ceiling. */
3333
+ readonly budgetUsd?: number;
3334
+ readonly limits?: Partial<TraceAnalystLimits>;
3335
+ /** Explicit full-bundle source access for `readSpanSource`. */
3336
+ readonly sourceBundle?: {
3337
+ path: string;
3338
+ maxRecordBytes?: number;
3339
+ };
3340
+ /** Where to write the OpenInference file the engine reads. Default: a temp file. */
3341
+ readonly otlpOutPath?: string;
3342
+ readonly generatedAt?: string;
3343
+ readonly signal?: AbortSignal;
3344
+ readonly log?: (msg: string, fields?: Record<string, unknown>) => void;
3345
+ }
3346
+ interface TraceQuestionsArtifacts {
3347
+ readonly directory: string;
3348
+ readonly result: string;
3349
+ readonly report: string;
3350
+ readonly traces: string;
3351
+ }
3352
+ declare const DEFAULT_ASK_CONCURRENCY = 4;
3353
+ /** Longest question that keeps the whole question field inside the preview. */
3354
+ declare const MAX_TRACE_QUESTION_CHARS: number;
3355
+ /**
3356
+ * Validate questions and assign default IDs. Throws on an empty list, a
3357
+ * duplicate or malformed ID, a question too long for the preview, or an answer
3358
+ * schema outside the supported subset.
3359
+ *
3360
+ * Explicit IDs are reserved before any default is assigned, so a file entry
3361
+ * named `q2` plus a positional question cannot collide and kill the run before
3362
+ * it starts. A default keeps its own position where it can: it starts at
3363
+ * `q<index + 1>` and takes the next free number only when that one is spoken for.
3364
+ */
3365
+ declare function normalizeTraceQuestions(questions: readonly TraceQuestion[]): Array<TraceQuestion & {
3366
+ id: string;
3367
+ }>;
3368
+ /**
3369
+ * Read questions from a JSON file: an array, or an object with a `questions`
3370
+ * array. Each entry is a question string or an object with `question` and
3371
+ * optional `id`, `instructions`, and `answerSchema`. Unknown keys are
3372
+ * rejected so a misspelled field cannot be ignored silently.
3373
+ */
3374
+ declare function loadTraceQuestionsFile(path: string): Promise<TraceQuestion[]>;
3375
+ /** The engine's `question` input: a short header, then the question, whole. */
3376
+ declare function renderTraceQuestionPrompt(question: string): string;
3377
+ /** The definition's instructions: rules first, so the preview keeps them. */
3378
+ declare function renderTraceQuestionInstructions(question: Pick<TraceQuestion, 'instructions' | 'answerSchema'>): string;
3379
+ /** Characters of the instructions the DSPy preview keeps from the start; the rules must fit. */
3380
+ declare const TRACE_QUESTION_PREVIEW_HEAD_CHARS = 500;
3381
+ /** Every distinct `trace://<trace>/span/<span>` URI in the text, in order. */
3382
+ declare function traceCitationsInText(text: string): Array<{
3383
+ uri: string;
3384
+ traceId: string | null;
3385
+ spanId: string | null;
3386
+ }>;
3387
+ /**
3388
+ * Smallest reservation one model call makes before it runs: its full output and
3389
+ * reasoning allowance at the output rate, before any input tokens. Undefined
3390
+ * when the engine does not describe its pricing and token caps.
3391
+ */
3392
+ declare function engineCallReservationFloorUsd(engine: TraceAnalysisEngine): number | undefined;
3393
+ /**
3394
+ * Ask every question of the spans, concurrently, under one shared cost
3395
+ * ledger. Never throws for a failed question: each failure is recorded on its
3396
+ * answer and `ok` turns false. An aborted run is one of those failures, not an
3397
+ * exception: answers already bought are kept and the questions the run never
3398
+ * reached are recorded as `aborted`, so the caller can still write both
3399
+ * artifacts. Throws before any model call for invalid questions, options, or a
3400
+ * budget below one call's reservation.
3401
+ */
3402
+ declare function runTraceQuestions(opts: TraceQuestionsOptions): Promise<TraceQuestionsResult>;
3403
+ /** Readable Markdown for a result; the JSON result carries every field. */
3404
+ declare function renderTraceQuestionsReport(result: Omit<TraceQuestionsResult, 'report'>): string;
3405
+ /** Write `answers.json` and `report.md` next to the trace file the engine read. */
3406
+ declare function writeTraceQuestionsArtifacts(result: TraceQuestionsResult, outDir: string): Promise<TraceQuestionsArtifacts>;
3407
+
3408
+ /**
3409
+ * Which pull requests a session created, and which it merged.
3410
+ *
3411
+ * The spans already hold the answer and no reader was extracting it. A Codex
3412
+ * `CommandExecution` item becomes a `command.execution` span carrying the
3413
+ * script, its exit code and its output; a Claude Code `Bash` call becomes a
3414
+ * TOOL span with the same three things under the same I/O keys. A `gh pr
3415
+ * create` is therefore visible, and so is the pull-request URL `gh` printed
3416
+ * back — which is the only place the new PR's number appears.
3417
+ *
3418
+ * Three rules keep the reading honest:
3419
+ *
3420
+ * 1. The command is found by scanning the script the way a shell would
3421
+ * ({@link shellCommands}), not by matching text. A `gh pr create` quoted
3422
+ * inside a heredoc body or a commit message never ran and is not counted.
3423
+ * 2. A pull request is named by its number when the command or an output that
3424
+ * joins to it shows one, and by its head branch when it does not — the
3425
+ * identity the command itself supplies. A call with neither stays a
3426
+ * recorded event with a null identifier and a stated reason.
3427
+ * 3. Every entry names the span its command came from, plus the span whose
3428
+ * output supplied the number, so the reading can be checked against the
3429
+ * raw spans rather than trusted.
3430
+ *
3431
+ * A command that never reached `gh` is not an event: a failed
3432
+ * `git push … && gh pr create` exited non-zero without running `gh`, so it
3433
+ * counts only when the exit code is zero or the output shows `gh` itself
3434
+ * answering.
3435
+ */
3436
+
3437
+ /** One pull request the agent created or merged, with the evidence that named it. */
3438
+ interface PullRequestFact {
3439
+ /** The PR number when one is known, else the head branch. Null when neither is. */
3440
+ readonly identifier: string | null;
3441
+ readonly number: string | null;
3442
+ readonly headBranch: string | null;
3443
+ /** The `gh` command, as the scanner read it. */
3444
+ readonly command: string;
3445
+ /** How `identifier` was arrived at, naming the span that supplied it. */
3446
+ readonly evidence: string;
3447
+ /** The command span, plus any span whose output supplied the number. */
3448
+ readonly spanIds: readonly string[];
3449
+ /** Why `identifier` is null. Null when the pull request was identified. */
3450
+ readonly unavailable: string | null;
3451
+ }
3452
+ interface PullRequestFacts {
3453
+ readonly created: readonly PullRequestFact[];
3454
+ readonly merged: readonly PullRequestFact[];
3455
+ }
3456
+ interface PullRequestReading {
3457
+ /** Null exactly when `unavailable` explains why the spans cannot support it. */
3458
+ readonly facts: PullRequestFacts | null;
3459
+ readonly spanIds: readonly string[];
3460
+ readonly unavailable: string | null;
3461
+ readonly partial: string | null;
3462
+ /** Spans carrying an executed command: the denominator of this reading. */
3463
+ readonly commandSpans: number;
3464
+ }
3465
+ /**
3466
+ * Read every pull request the spans show the agent creating or merging.
3467
+ *
3468
+ * `spans` must be in trace order: a number a later command states is joined to
3469
+ * the create it belongs to by position, and that ordering is the position.
3470
+ */
3471
+ declare function readPullRequests(spans: readonly OtlpSpan[]): PullRequestReading;
3472
+
3473
+ /**
3474
+ * The deterministic session-facts sheet.
3475
+ *
3476
+ * A handful of facts about a session decide most audit questions — how many
3477
+ * tools ran, which subagents were spawned, which pull requests were opened and
3478
+ * merged, what the human actually typed, what the agent said last, which files
3479
+ * changed, when the session started and ended, and how many tokens it burned.
3480
+ * Every one of them is already carried by the normalized
3481
+ * spans, but no trace tool returns any of them: `viewTrace` degrades to a
3482
+ * 20-entry name histogram above its byte ceiling, `countTraces` counts traces
3483
+ * rather than spans, `viewSpans` needs span ids the reader does not have, and
3484
+ * `searchTrace` stops at 500 hits. A model asked for a tool-call total therefore
3485
+ * adds up a capped histogram and decides by eye which names count.
3486
+ *
3487
+ * This module computes those facts mechanically instead. No model call, no
3488
+ * budget, no byte ceiling: it reads the spans directly, so a session far above
3489
+ * the tool ceiling still yields exact numbers.
3490
+ *
3491
+ * Two rules make the sheet auditable:
3492
+ *
3493
+ * 1. Every field carries the span ids it was computed from, so a reader can
3494
+ * open those spans and check the number.
3495
+ * 2. A field the spans cannot support is `null` with a stated `unavailable`
3496
+ * reason. It is never guessed, and never silently zero. A value the sheet
3497
+ * filtered — a `user.prompt` turn that is not a human turn of this session
3498
+ * — is reported beside the count with the reason, never silently dropped.
3499
+ *
3500
+ * Every fact below is about THE SESSION'S OWN AGENT. Some harnesses fold a
3501
+ * spawned agent's transcript into the parent's trace (Claude Code writes one
3502
+ * file per subagent under the session directory and the adapter reads them
3503
+ * all), so a trace can hold two kinds of record: what this session's agent did,
3504
+ * and what a child agent it spawned did. The child's work is the child's: it is
3505
+ * excluded from this sheet's counts, named in `subagents` and counted in
3506
+ * `subagentToolSpans`, never added to the parent's totals. A trace with no
3507
+ * subagent records is unaffected — every one of those counts is zero.
3508
+ *
3509
+ * The sheet is NOT a span and cannot be cited. It is prepared context, and
3510
+ * `trace://` citations still resolve against the raw spans — which is why every
3511
+ * fact names its span ids rather than asking the reader to trust the sheet.
3512
+ */
3513
+
3514
+ /**
3515
+ * The cumulative harness token total for a whole session, when the adapter
3516
+ * records one. Codex's `token_count` events carry
3517
+ * `info.total_token_usage.total_tokens`; the adapter uses that object only as a
3518
+ * de-duplication signature today, so no span carries the value and
3519
+ * {@link SessionFacts.tokenTotal} states that rather than summing the per-turn
3520
+ * deltas, which is a different (and smaller) number.
3521
+ */
3522
+ declare const SESSION_TOKEN_TOTAL_ATTR = "traces.session.total_tokens";
3523
+ /**
3524
+ * The first marker an adapter used for a span it created to describe a
3525
+ * lifecycle rather than an invocation the agent made. The current marker is
3526
+ * `traces.span.synthesized` (see `adapters/provenance.ts`); this one is still
3527
+ * recognized so a trace exported before the rename keeps counting correctly.
3528
+ */
3529
+ declare const SPAN_SYNTHESIZED_ATTR = "traces.codex.span_synthesized";
3530
+ /** Max characters of message or prompt text kept per fact entry. */
3531
+ declare const FACT_TEXT_CAP = 2000;
3532
+ /** Entries kept per list field before the sheet reports the rest as omitted. */
3533
+ declare const FACT_LIST_CAP = 200;
3534
+ /**
3535
+ * Entries kept for {@link SessionFacts.changedFiles}.
3536
+ *
3537
+ * The cap above bounds the sheet's size against lists whose entries carry up to
3538
+ * {@link FACT_TEXT_CAP} characters of message or prompt text. A changed-file
3539
+ * entry is a path and two short arrays, two orders of magnitude smaller, and a
3540
+ * session that edits hundreds of files is the one whose file list a reader most
3541
+ * needs whole — the rendered context prints only the count either way. So this
3542
+ * list gets its own ceiling, still finite so a runaway session cannot make the
3543
+ * sheet unbounded.
3544
+ */
3545
+ declare const CHANGED_FILE_LIST_CAP = 5000;
3546
+ /**
3547
+ * One measured fact. `value` is `null` exactly when `unavailable` explains why
3548
+ * the spans cannot support it; `spanIds` names the spans the value came from,
3549
+ * in the order they appear in the trace.
3550
+ */
3551
+ interface SessionFact<T> {
3552
+ readonly value: T | null;
3553
+ readonly spanIds: readonly string[];
3554
+ /** Why `value` is null. Null when the fact was measured. */
3555
+ readonly unavailable: string | null;
3556
+ /** A measured value that is known to be incomplete says so here. */
3557
+ readonly partial?: string;
3558
+ }
3559
+ /** One subagent-spawning call, with the task name the adapter recorded for it. */
3560
+ interface SubagentSpawnFact {
3561
+ /** The task name the spawn span carries, verbatim. Null when it carries none. */
3562
+ readonly taskName: string | null;
3563
+ /** Why `taskName` is null. Null when it was recorded. */
3564
+ readonly taskNameUnavailable: string | null;
3565
+ readonly startedAt: string;
3566
+ /** The spawn span's status: `OK`, `ERROR`, or `UNSET` while still open. */
3567
+ readonly status: string;
3568
+ /** The spawn call span, plus the subagent lifecycle span when one joined it. */
3569
+ readonly spanIds: readonly string[];
3570
+ }
3571
+ /** One `user.prompt` turn, with the actor the adapter classified it as. */
3572
+ interface SessionTurnFact {
3573
+ readonly actor: string;
3574
+ readonly at: string;
3575
+ readonly text: string;
3576
+ readonly spanId: string;
3577
+ }
3578
+ /** How many `user.prompt` turns each actor produced. */
3579
+ interface TurnActorCount {
3580
+ readonly actor: string;
3581
+ readonly turns: number;
3582
+ readonly spanIds: readonly string[];
3583
+ }
3584
+ /**
3585
+ * `user.prompt` turns {@link SessionFacts.humanTurns} did not count, grouped by
3586
+ * the reason they were not counted. Nothing is dropped silently: every excluded
3587
+ * span is named here, so a reader who disagrees with a reason can open the span
3588
+ * and count it back in.
3589
+ */
3590
+ interface ExcludedTurnFact {
3591
+ readonly reason: string;
3592
+ readonly turns: number;
3593
+ readonly spanIds: readonly string[];
3594
+ }
3595
+ /** The last thing one agent said, for the main session or for one subagent. */
3596
+ interface FinalMessageFact {
3597
+ /**
3598
+ * The subagent's task path, or null for the session's own agent. One session
3599
+ * interleaves its own `message.assistant` spans with the `message.agent.*`
3600
+ * traffic of every subagent under the same root, so "the final message" is
3601
+ * only well defined per task.
3602
+ */
3603
+ readonly task: string | null;
3604
+ readonly at: string;
3605
+ readonly text: string;
3606
+ readonly spanId: string;
3607
+ }
3608
+ /** One path a tool call changed, and how. */
3609
+ interface ChangedFileFact {
3610
+ readonly path: string;
3611
+ /**
3612
+ * `add`, `update`, `delete`, or `move`, in the order first observed. A kind a
3613
+ * harness reports under another name is kept verbatim rather than mapped.
3614
+ */
3615
+ readonly operations: readonly string[];
3616
+ readonly spanIds: readonly string[];
3617
+ }
3618
+ /** Everything the spans of one session state, computed without a model. */
3619
+ interface SessionFacts {
3620
+ readonly schemaVersion: 1;
3621
+ readonly kind: 'traces.session_facts';
3622
+ readonly traceId: string;
3623
+ readonly sessionId: string | null;
3624
+ readonly harness: string | null;
3625
+ /** Spans in this trace, including the synthesized ones. */
3626
+ readonly spanCount: number;
3627
+ /**
3628
+ * Spans the adapter built from the session's own records. The session root
3629
+ * and the integrity receipts are not among them, so zero means nothing in the
3630
+ * file was read and every count below would be an unsupported zero.
3631
+ */
3632
+ readonly recordSpans: number;
3633
+ /** Records the adapter could not read, from the session's integrity receipt. */
3634
+ readonly unreadRecords: SessionFact<number>;
3635
+ /**
3636
+ * TOOL spans THIS session's agent invoked. Synthesized lifecycle spans and
3637
+ * the tool calls of subagents it spawned are excluded, and each exclusion is
3638
+ * counted below so the reader can add them back.
3639
+ */
3640
+ readonly toolCalls: SessionFact<number>;
3641
+ /** Every synthesized span excluded from `toolCalls`, so the exclusion is checkable. */
3642
+ readonly synthesizedToolSpans: SessionFact<number>;
3643
+ /** TOOL spans excluded because a subagent, not this agent, made the call. */
3644
+ readonly subagentToolSpans: SessionFact<number>;
3645
+ /** Tool-call counts by tool name, over the same spans `toolCalls` counted. */
3646
+ readonly toolCallsByName: SessionFact<Readonly<Record<string, number>>>;
3647
+ readonly subagents: SessionFact<readonly SubagentSpawnFact[]>;
3648
+ /** Pull requests this session created and merged, each with its evidence. */
3649
+ readonly pullRequests: SessionFact<PullRequestFacts>;
3650
+ /** `user.prompt` turns a person typed into THIS session, in order. */
3651
+ readonly humanTurns: SessionFact<readonly SessionTurnFact[]>;
3652
+ /** Every `user.prompt` turn `humanTurns` left out, with the reason. */
3653
+ readonly excludedTurns: SessionFact<readonly ExcludedTurnFact[]>;
3654
+ /** Every `user.prompt` turn by actor, so the human filter is checkable. */
3655
+ readonly turnsByActor: SessionFact<readonly TurnActorCount[]>;
3656
+ /** The last message of the session's own agent, and of each subagent task. */
3657
+ readonly finalMessages: SessionFact<readonly FinalMessageFact[]>;
3658
+ readonly changedFiles: SessionFact<readonly ChangedFileFact[]>;
3659
+ /** Earliest span start among this session's own records. Not the session
3660
+ * file's first record when the adapter selected a task boundary inside the
3661
+ * file, and not a spawned subagent's first record. */
3662
+ readonly firstRecordAt: SessionFact<string>;
3663
+ /** Latest span end among this session's own records. */
3664
+ readonly lastRecordAt: SessionFact<string>;
3665
+ /** The harness's own cumulative token total, when a span carries it. */
3666
+ readonly tokenTotal: SessionFact<number>;
3667
+ }
3668
+ interface SessionFactsReport {
3669
+ readonly schemaVersion: 1;
3670
+ readonly kind: 'traces.session_facts_report';
3671
+ readonly generatedAt: string;
3672
+ readonly harness: string | null;
3673
+ readonly spanCount: number;
3674
+ readonly sessions: readonly SessionFacts[];
3675
+ }
3676
+ /**
3677
+ * Compute the facts sheet for every trace in `spans`. One trace is one session.
3678
+ * Deterministic and free: the same spans always produce the same sheet, and no
3679
+ * model, network call, or budget is involved.
3680
+ */
3681
+ declare function computeSessionFacts(spans: readonly OtlpSpan[]): SessionFacts[];
3682
+ /** The facts sheet for a set of spans, as one report. */
3683
+ declare function buildSessionFactsReport(spans: readonly OtlpSpan[], options?: {
3684
+ harness?: string | null;
3685
+ generatedAt?: string;
3686
+ }): SessionFactsReport;
3687
+ /** The short readable form: the same facts, one screen, no span-id lists. */
3688
+ declare function renderSessionFacts(report: SessionFactsReport): string;
3689
+ /**
3690
+ * The byte ceiling one prepared-context string stays under.
3691
+ *
3692
+ * `DEFAULT_TRACE_ANALYST_BUDGETS.perCallByteCeiling` is 150,000 — the size one
3693
+ * trace-tool result may return. Prepared context is read by the same model in
3694
+ * the same turn as those results, so the sheet claims a fifth of that ceiling
3695
+ * and leaves the rest for the tool calls the model still has to make.
3696
+ */
3697
+ declare const PREPARED_CONTEXT_BYTE_CEILING = 30000;
3698
+ /**
3699
+ * Render the sheet as bounded prepared context.
3700
+ *
3701
+ * Prepared context is not evidence: it is a head start. The rendering therefore
3702
+ * keeps every field's span ids so that each fact can be checked against the raw
3703
+ * spans, and says out loud that the sheet itself is not citable.
3704
+ *
3705
+ * The result is guaranteed to be at most `byteCeiling` bytes. Fields are shed
3706
+ * from the largest list downward, and the shed is reported inside the context
3707
+ * rather than silently applied.
3708
+ */
3709
+ declare function renderSessionFactsContext(report: SessionFactsReport, options?: {
3710
+ byteCeiling?: number;
3711
+ }): string;
3712
+ /**
3713
+ * The prepared-context string for one set of spans, or undefined when there is
3714
+ * nothing to prepare. Analyst definitions install this through
3715
+ * `TraceAnalystDefinition.prepareContext`, which runs before the model does.
3716
+ */
3717
+ declare function sessionFactsContext(spans: readonly OtlpSpan[], options?: {
3718
+ byteCeiling?: number;
3719
+ generatedAt?: string;
3720
+ }): string | undefined;
3721
+ /**
3722
+ * Version suffix stamped on a definition that receives the sheet.
3723
+ *
3724
+ * `createTraceAnalyst` records `prepare_context: "version-bound"` in an
3725
+ * analyst's exact-run identity, which is a contract: a definition whose
3726
+ * prepared context changed is a different analyst. Wrapping therefore bumps the
3727
+ * version instead of quietly changing what the same version does.
3728
+ */
3729
+ declare const SESSION_FACTS_VERSION_SUFFIX = "session-facts.1";
3730
+ /**
3731
+ * Supply the sheet to every definition as prepared context, before the model
3732
+ * runs. A definition that already prepares context keeps it; the sheet is
3733
+ * appended after it, bounded by its own ceiling, so the pair stays inside the
3734
+ * documented `perCallByteCeiling` of 150,000 bytes.
3735
+ *
3736
+ * The sheet is computed once for the whole set: it is deterministic, so every
3737
+ * definition receives the identical text.
3738
+ */
3739
+ declare function withSessionFactsContext(definitions: readonly TraceAnalystDefinition[], spans: readonly OtlpSpan[], options?: {
3740
+ byteCeiling?: number;
3741
+ }): TraceAnalystDefinition[];
3742
+
3743
+ /**
3744
+ * Split one shell script into the simple commands it would actually run.
3745
+ *
3746
+ * A trace records a command as the script the agent handed to `/bin/zsh -lc`,
3747
+ * and one script routinely runs several commands: `git push && gh pr create`,
3748
+ * a `cat > file <<'EOF' … EOF` heredoc followed by a `gh` call, a `sh -c`
3749
+ * wrapper around another script. Asking "did this session create a pull
3750
+ * request?" with a regular expression over that text answers yes for a heredoc
3751
+ * body that merely mentions `gh pr create`, and no for a command hidden behind
3752
+ * a `$( … )` substitution.
3753
+ *
3754
+ * This scanner answers the question the way the shell would: it walks the
3755
+ * script once, tracking quoting, comments, redirections and heredoc bodies, and
3756
+ * returns the word list of every simple command it finds — recursing into
3757
+ * command substitutions, subshells, and the `-c` argument of a nested shell.
3758
+ *
3759
+ * It is a reader, not an interpreter. Variables are not expanded, globs are not
3760
+ * matched, and a word built from a variable comes back as the literal text of
3761
+ * the script. A caller therefore learns which command *names* ran with which
3762
+ * *literal* arguments, which is exactly what an audit of `gh pr create` needs
3763
+ * and is never mistaken for a claim about what the shell computed.
3764
+ */
3765
+ /** Recursion limit for `$( … )`, backticks, subshells and nested `sh -c`. */
3766
+ declare const MAX_SHELL_DEPTH = 4;
3767
+ /**
3768
+ * Every simple command in `script`, as word lists, in the order the scanner
3769
+ * meets them. Commands inside substitutions and nested shells are included.
3770
+ */
3771
+ declare function shellCommands(script: string, depth?: number): string[][];
3772
+ /**
3773
+ * The script a tool span recorded, from its `input.value`.
3774
+ *
3775
+ * Adapters store a command as JSON — `{"command": ["/bin/zsh", "-lc", "…"]}`
3776
+ * for a Codex `CommandExecution` item, `{"command": "…"}` for a Claude Code
3777
+ * `Bash` call, `{"cmd": "…"}` for a Codex `exec_command` argument list. An argv
3778
+ * array whose head is a shell keeps only the script that shell was given; any
3779
+ * other array is joined back into one command line. A value that is not JSON,
3780
+ * or JSON without a command field, yields undefined: the span records something
3781
+ * other than an executed command, and guessing from its text is how a heredoc
3782
+ * body becomes a pull request.
3783
+ */
3784
+ declare function commandTextFromInput(input: string): string | undefined;
3785
+
3786
+ /** Model the CLI's recursive analysts use when neither `--model` nor TRACES_ANALYST_MODEL names one. */
3787
+ declare const DEFAULT_ANALYST_MODEL = "gpt-5.6-luna";
3788
+ interface AnalysisEngineFromEnvOptions {
3789
+ model: string;
3790
+ /**
3791
+ * Provider-side spend ceiling for ONE investigation (one analyst or one
3792
+ * question). Omitted, the engine keeps its own default. A caller that runs
3793
+ * several investigations under one shared ledger passes the per-investigation
3794
+ * cap here and the total to the ledger.
3795
+ */
3796
+ maxCostUsd?: number;
3797
+ /** Receives one line per model call, in the CLI's analyst log format. */
3798
+ log?: (msg: string, fields?: Record<string, unknown>) => void;
3799
+ /** Environment to read credentials and the Python interpreter from. Default: process.env. */
3800
+ env?: NodeJS.ProcessEnv;
3801
+ }
3802
+ /**
3803
+ * The recursive analysis engine behind `--llm` and `ask`. agent-eval's
3804
+ * model-backed analysts run through DSPy RLM, which drives
3805
+ * `agent-eval-rpc[dspy]` out of process, so this needs a Python interpreter
3806
+ * with that extra installed, selectable via TRACES_PYTHON. Every deterministic
3807
+ * command is unaffected and still needs neither a key nor Python.
3808
+ */
3809
+ declare function analysisEngineFromEnv(opts: AnalysisEngineFromEnvOptions): TraceAnalysisEngine;
3810
+
2835
3811
  type Json = null | boolean | number | string | Json[] | {
2836
3812
  [key: string]: Json;
2837
3813
  };
@@ -3012,45 +3988,10 @@ interface ObserverOptions {
3012
3988
  declare function watchSessions(opts: ObserverOptions): Promise<void>;
3013
3989
 
3014
3990
  /**
3015
- * A SECOND implementation of agent-eval's `SupervisorRunReader` port, over the
3016
- * run directory that agent-runtime's `createFileRunContext(dir)` writes:
3017
- *
3018
- * <runDir>/spawn-journal.jsonl required — the append-only SpawnEvent log
3019
- * <runDir>/coordination-log.jsonl optional — steer / delivery / question / settled
3020
- * <runDir>/blobs/ optional — content-addressed settled results
3021
- * <runDir>/result.json optional — the terminal outcome document
3022
- *
3023
- * `loopsSupervisorRunReader` is the other implementation, over a completely
3024
- * different layout. Neither knows about the other, and NOTHING here analyzes:
3025
- * `analyzeSupervisorRun` / `parseSupervisorTree` / `rollupSupervisorRuns` in
3026
- * `@tangle-network/agent-eval/supervisor-run` compute every metric, and
3027
- * `materializeTreeView` in `@tangle-network/agent-runtime/kernel` folds the
3028
- * event log into the tree. This file is translation only.
3029
- *
3030
- * ## Two translations, both faithful
3031
- *
3032
- * 1. **The envelope.** agent-runtime's `FileSpawnJournal` writes each event
3033
- * wrapped as `{kind:'event', root, event:{…}}` after one `{kind:'begin'}`
3034
- * record. agent-eval's parser reads `kind` at the TOP level, so an
3035
- * un-translated file parses as zero spawns AND zero malformed rows — a run
3036
- * that reads as "the supervisor did nothing" rather than "I cannot read
3037
- * this". The reader unwraps the envelope and re-emits flat JSONL.
3038
- *
3039
- * 2. **`role`.** `SupervisorRunSources.journal` documents
3040
- * `role: 'supervisor' | 'worker'` on spawned rows for recursive readers.
3041
- * agent-runtime's `SpawnEvent` has no such field, so it is INFERRED
3042
- * structurally and exactly: a node that appears as another spawn's `parent`
3043
- * is a supervisor; the root is a supervisor because it has no parent;
3044
- * everything else is a worker. No new upstream field is needed for this,
3045
- * and no depth limit applies — `<root>:s0:s0` classifies its parent
3046
- * `<root>:s0` as a supervisor by the same rule that classifies the root.
3047
- *
3048
- * Steer traffic is translated the same way: this layout records steers in
3049
- * `coordination-log.jsonl` rather than per-worker inbox files, and each
3050
- * recorded field maps 1:1 onto the per-worker artifacts the analyzer reads.
3051
- * Nothing is synthesized from an absent fact — an artifact this layout does
3052
- * not keep is declared in `SourceLimits`, which is what turns the dependent
3053
- * metric into `unavailable` instead of 0.
3991
+ * Runtime journal snapshots for the live view, plus report-reader enrichment.
3992
+ * Eval owns report normalization, terminal records, and evidence accounting.
3993
+ * This module adds coordination-log steers and questions to those sources.
3994
+ * The live view uses Runtime's tree fold and keeps partial journal tails visible.
3054
3995
  */
3055
3996
 
3056
3997
  declare const SPAWN_JOURNAL_FILE = "spawn-journal.jsonl";
@@ -3121,16 +4062,15 @@ interface CoordinationLog {
3121
4062
  */
3122
4063
  declare function readCoordinationLog(text: string | null): CoordinationLog;
3123
4064
  interface FileRunContextReaderOptions {
3124
- /** Override the run identity used for rollup grouping (default: the journal root). */
4065
+ /** Override the recorded Runtime identity used for rollup grouping. */
3125
4066
  readonly instanceId?: string | null;
3126
4067
  /** Which arm of a comparison this run is (default: the run directory's basename). */
3127
4068
  readonly arm?: string | null;
3128
4069
  }
3129
4070
  /**
3130
4071
  * Read a `createFileRunContext` run directory into `SupervisorRunSources`.
3131
- * Never throws on a missing artifact: an absent file becomes a `null` field or
3132
- * a declared `SourceLimits` reason, which is what makes the dependent metric
3133
- * `unavailable` rather than 0.
4072
+ * Eval preserves missing evidence and rejects malformed Runtime records.
4073
+ * Coordination-log evidence extends the normalized worker sources.
3134
4074
  */
3135
4075
  declare function readFileRunContext(runDir: string, opts?: FileRunContextReaderOptions): Promise<SupervisorRunSources>;
3136
4076
  /** The `createFileRunContext` on-disk layout, as a `SupervisorRunReader`. */
@@ -4589,4 +5529,4 @@ interface ExecuteOptions {
4589
5529
  /** Send the final, new outbound items (or write their dry-run OTLP). */
4590
5530
  declare function executeUpload(plan: UploadPlan, opts?: ExecuteOptions): Promise<UploadResult>;
4591
5531
 
4592
- export { ACTOR_ATTR, ATTR, type Actor, type AdoptionOptions, type AdoptionReport, AmpAdapter, type AnalystReplayFinding, type AnalyzeOptions, type AnalyzeResult, type ArmExecutionResult, type AssembleSessionBundleOptions, BLOBS_DIR, type BuildPolicyEvidenceOptions, type BuildSessionIndexOptions, type BuildTraceFindingPacketOptions, CODING_REDACTION_RULES, CONTENT_CAP, COORDINATION_LOG_FILE, CORRECTIVE_REACTIONS, type CaseResources, type ChatCompletionCaller, type ChatOutcome, type ChatTrajectory, type ChatTrajectoryMessage, type ChatTrajectoryOptions, type ChatUsage, ClaudeAdapter, type CodeTraceBenchFileRef, type CodeTraceBenchImportOptions, type CodeTraceBenchImportReceipt, type CodeTraceBenchImportResult, type CodeTraceBenchImportedTrace, type CodeTraceBenchStep, CodexAdapter, CodexExecAdapter, CodexExecStreamError, CodexTaskScopeError, type CollectOptions, type CollectPolicyEvidenceOptions, type CollectSessionIndexOptions, type CollectSessionSelectionOptions, type CollectSessionWorkflowOptions, type ConformanceRenderOptions, type CoordinationLog, type CoordinationQuestion, type CoordinationSteer, CopilotAdapter, type CorpusSpec, type CorruptionMode, type CwdSource, DEFAULT_HARNESS, DEFAULT_SANDBOX_BASE_URL, type DockerImagePreparerOptions, EMPTY_SPAN_RUN_SNAPSHOT, EXPORT_RULE, EmptySessionError, type EnumerationResult, type EvidenceOnlyVerdict, type ExcludedCase, type ExecuteOptions, type ExportRule, type ExternalAnalysisKind, type ExternalAnalysisPayload, type ExternalAnalysisResult, type ExternalAnalyzer, type ExternalAnalyzerOptions, type ExternalDiscoveryCandidate, FactoryAdapter, type FailedFixAttempt, type FileRunContextReaderOptions, type FindSessionTextLeaksOptions, type FindingReplaySource, type FindingReplayability, type FindingVerification, type FindingVerificationStatus, type FixArmExecution, type FixArmExecutor, type FixGenerationOutcome, type FixLoopAttemptRecord, type FixLoopOptions, type FixLoopResult, type FixPromptInput, ForgeAdapter, GeminiAdapter, type HaloAnalyzerOptions, type HaloReasoningEffort, type HarnessTraceAdapter, type HodoscopeAnalyzerOptions, type HodoscopeInput, type HodoscopeMessage, type HodoscopeSourceMapEntry, type HodoscopeTrajectory, INGEST_SOURCE_CLI, type ImagePreparation, type ImagePreparer, type IncorrectStepsSubject, type IngestedTrajectory, type InspectSessionIndexOptions, JsonSourceError, type JsonlCorruptionReceipt, JsonlParseError, type JsonlReadOptions, type LiveBatchOptions, type LocateOptions, type LoopConvergence, type LoopConvergenceReport, type LoopIteration, type LoopTrend, type LoopTrendBasis, type ObservedLoop, type ObserverOptions, OpencodeAdapter, type OtlpIngestIssue, type OtlpIngestIssueKind, type OtlpInput, type OtlpInputFile, type OtlpRowConversion, type OtlpSpan, type OtlpSpanKind, type OtlpSpanLink, type OtlpStatusCode, POLICY_EVIDENCE_NOTE, type ParentTaskResolution, type ParseOptions, PartialUploadError, PiAdapter, type PiAdapterOptions, type PipelineOptions, type PipelineReport, type PlanOptions, type PolicyEvidenceLoopSummary, type PolicyEvidenceRecord, type PolicyEvidenceToolSummary, type PrefixDivergence, type PrefixReplayResult, type PrimeAnalyzerOptions, type PrimeTransport, type PrimeTransportRequest, type PrimeTransportResponse, type ProjectSessionBundleOptions, type ProjectSessionBundleResult, QwenAdapter, REACTIONS, RESULT_FILE, RULE, type Reaction, type ReactionReport, type ReactionSessionReport, type Redactor, type ReplayArmVerdict, type ReplayBatchCaseRow, type ReplayBatchCliArgs, type ReplayBatchFixResult, type ReplayBatchOptions, type ReplayBatchReport, type ReplayExclusionReason, type ReplayExecBackend, type ReplayExecResult, type ReplayExecSession, type ReplayFindingOptions, type ReplayFindingResult, type ReplayVerdict, type ReplayVerifyCliArgs, type ReplayVerifyOptions, type ReplayableCase, type RepoAttrs, type RepoResolution, type RepoResolutionSource, type ResolvedFindingReplay, type ResolvedOtlpInput, type ResolvedReplayInvocation, type ResourceResolution, type RunContextJournal, type RunContextNode, type RunContextResult, type RunContextSnapshot, type RunResult, type RunWatchSnapshot, type RunWatchTarget, type RuntimeTrace, SPAWN_JOURNAL_FILE, STATUS_MARK, SUBMIT_ACTION_SIGNATURE, SandboxCounterfactualRunner, type SandboxCounterfactualRunnerOptions, type SandboxReplayBackendOptions, type ScanOptions, type ScannedSession, type SessionBatch, type SessionBundleAbsence, type SessionBundleCarriedSignatures, type SessionBundleExclusion, type SessionBundleExclusionRule, type SessionBundleFile, type SessionBundleLeakCheck, type SessionBundleLedgerSlice, type SessionBundleManifest, type SessionBundleProjection, type SessionBundleResult, type SessionBundleSliceRule, type SessionBundleView, type SessionCorruptionReceipt, type SessionEnvironment, type SessionIdentityConflict, type SessionIdentityIndex, type SessionIntegrity, type SessionRef, type SessionRelationship, type SessionRole, type SessionSeedGroup, type SessionSelection, type SessionSelectionRow, type SessionSourceFile, type SessionTextLeak, type SessionTextLeakReport, type SessionWorkflow, SessionWorkflowError, type SessionWorkflowErrorCode, type SessionWorkflowIssue, type SessionWorkflowSession, type SessionWorkflowSummary, type SkippedAnalysis, type SkippedInputFile, type SpanInput, type SpanNodeStatus, type SpanRedaction, type SpanRunNode, type SpanRunSnapshot, type SpanStructure, type SpendRoll, type SteeringChainReport, type SteeringEdge, TRACES_REDACTION_RULES, type TraceAgenticRoute, type TraceAgenticRouteReason, type TraceAgenticRouteReasonCode, type TraceContextIndex, type TraceContextRoot, type TraceEvidenceExportOptions, type TraceEvidenceExportResult, type TraceEvidenceFormatOption, type TraceEvidenceInputFormat, type TraceEvidenceRow, type TraceExecutionOptions, type TraceFindingPacket, type TraceImprovementArtifacts, type TraceImprovementOptions, type TraceImprovementResult, type TraceIndexedFile, type TraceInspectionArea, type TraceInspectionFinding, type TraceInspectionReport, type TraceInspectionSeverity, type TraceInvestigationOptions, type TraceInvestigationResult, type TraceLiveAction, type TraceLiveActionKind, type TraceLiveAnalysisContext, type TraceLiveAnalyst, type TraceLiveBatch, type TraceLiveEvidence, type TraceLiveFinding, type TraceLiveLoop, type TraceLiveSeverity, type TraceSessionIndex, type TraceSessionIndexRow, type TraceStoreInvestigationOptions, type TraceStoreInvestigationResult, type TraceStreamEvent, type TraceStreamOptions, type TraceStreamReplayOptions, type TraceStreamSession, type TracesConfig, type TriggerPair, type UnavailableCapabilities, type UploadBackend, type UploadIdentity, type UploadItem, type UploadPlan, type UploadRecord, type UploadResult, type UploadState, type UserPromptInput, type VerifiableFinding, type VerifyFindingsCliArgs, type VerifyFindingsOptions, type VerifyFindingsRun, type WatchRunTargetOptions, ZERO_ROLL, type ZaiChatCallerOptions, addSpend, alreadyUploaded, analyzeAdoption, analyzeLiveBatch, analyzeLoopConvergence, analyzeReactions, analyzeSpans, analyzeSteeringChain, applyRedactor, assembleSessionBundle, assertSandboxReachable, buildFixPrompt, buildPolicyEvidenceRecord, buildRetryFixPrompt, buildSessionIndex, buildSessionIndexFromRows, buildSpanRunTree, buildTraceFindingPacket, capText, chatTrajectoryToSpans, classifyEvidenceOnlyPath, classifyLiveActions, classifyReaction, classifyVerdict, claudeActor, clipText, cmdReplayVerify, cmdReplayVerifyBatch, cmdVerifyFindings, codexActor, collectPolicyEvidence, collectSessionIndex, collectSessionSelection, collectSessionWorkflow, collectSessions, commandAnalyzer, commandRedactor, conformanceOfSpans, connectors, countScriptCommands, countSkillRunsJsonl, cwdMatchesSelection, defaultTraceLiveAnalysts, deriveFailureSignature, derivedImageTag, describeSessionRelationship, dockerImagePreparer, enumerateReplayableCases, environmentAttributes, environmentFromSpanAttributes, equivalentGitCwds, executeUpload, exportTraceEvidenceFile, exportTraceEvidenceRows, exportTraceEvidenceText, extractFixCommand, fileRunContextSupervisorRunReader, findContextRoot, findSessionTextLeaks, findSpanSourceFiles, findingReplayStep, findingTrajectoryId, forEachTreeNode, generateFixCommand, goldIncorrectSteps, haloAnalyzer, hashSessionBundleFiles, hodoscopeAnalyzer, httpJsonTransport, importCodeTraceBench, incompleteInputsNote, indexSessionIdsByTrace, inferRole, inferSpanKind, ingestCodeTraceBenchSteps, inspectSessionIndex, int, isChatTrajectory, isChatTrajectoryMessage, isFileRunContextDir, isSubmitAction, knownHarnesses, listAdapters, listSessionBundleFiles, loadState, loadTracesConfig, locateSessions, looksLikeAgentPrompt, mergeRolls, mergeTracesConfig, ms, normalizeRemote, otlpRowToSpan, outboundHash, parseCorpusFlag, parseIncorrectStepsSubject, parseIsoToEpochMs, parseObservationOutput, parseRecordedReturncode, parseReplayBatchArgs, parseReplayVerifyArgs, parseSession, parseSince, parseVerifyFindingsArgs, planTraceAgenticRoute, planUpload, primeAnalyzer, projectSessionBundle, readCoordinationLog, readFileRunContext, readFindingsFile, readJsonFile, readJsonl, readLabelEntries, readOtlpInput, readRunContextJournal, readRunContextSnapshot, readRunWatchSnapshot, readSessionBundleManifest, readSessionIndexFile, readSpanRunSnapshot, recordSessionCorruption, redactSpans, renderBatchReport, renderConformance, renderInspectionReport, renderRunContextSnapshot, renderRunWatchSnapshot, renderSpanRunSnapshot, renderValidation, renderVerifiedFindingsSection, replayBatchUsage, replayVerify, replayVerifyFinding, replayVerifyUsage, resolveAdapter, resolveCaseResources, resolveFindingInvocation, resolveFindingReplayability, resolveOtlpInputFiles, resolveRepoAttrs, resolveRunContextDir, resolveRunWatchTarget, resolveSessionRepoAttrs, runCommand, runExternalAnalyzers, runFixLoop, runPipelines, runReplayBatch, runTotals, runTraceImprovement, runTraceInvestigation, runTraceStoreInvestigation, sandboxReplayBackend, saveReport, saveState, scanSessions, seededSample, selectAdapters, serializeInspectionReport, serializePolicyEvidence, serializeSessionIndex, serializeSpans, serializeTraceStreamEvent, sessionHash, sessionIdFromAttributes, sessionIntegrityAttributes, sessionTextSignatures, skippedAnalyses, span, spanRunTotals, stampEnvironmentAttrs, stampRepoAttrs, stampSessionIdentity, stampSessionIntegrity, stampSpanWorkdirRepoAttrs, streamSessions, summarizeOtlpExecution, summarizeSpanExecution, summarizeSpanStructure, takeJsonl, textIsSynthetic, toOpenInferenceSpan, toRuntimeStore, toTraceSpanEvents, tokens, totalAgenticFailureMessage, traceAgenticKinds, traceStreamEventsFromSpans, unavailableCapabilities, uploadKey, usd, userPromptSpan, validateOtlpSpans, validationExitCode, verifyFindings, verifyFindingsUsage, watchRunTarget, watchSessions, wrap, wrapActionForExec, writeHodoscopeInput, writeInspectionReportFile, writeOtlpFile, writePolicyEvidenceFile, writeSessionBundleManifest, writeSessionIndexFile, writeTraceEvidenceExportFile, writeTraceImprovementArtifacts, zaiChatCaller, zeroPricedCost };
5532
+ export { ACTOR_ATTR, ATTR, type Actor, type AdoptionOptions, type AdoptionReport, AmpAdapter, type AnalysisEngineFromEnvOptions, type AnalystReplayFinding, type AnalyzeOptions, type AnalyzeResult, type AnswerSchema, type ArmExecutionResult, type AssembleSessionBundleOptions, BLOBS_DIR, type BuildPolicyEvidenceOptions, type BuildSessionIndexOptions, type BuildTraceFindingPacketOptions, CHANGED_FILE_LIST_CAP, CITATION_NORMALIZATION_VERSION, CODING_REDACTION_RULES, CONTENT_CAP, COORDINATION_LOG_FILE, CORRECTIVE_REACTIONS, type CaseResources, type ChangedFileFact, type ChatCompletionCaller, type ChatOutcome, type ChatTrajectory, type ChatTrajectoryMessage, type ChatTrajectoryOptions, type ChatUsage, ClaudeAdapter, type CodeTraceBenchFileRef, type CodeTraceBenchImportOptions, type CodeTraceBenchImportReceipt, type CodeTraceBenchImportResult, type CodeTraceBenchImportedTrace, type CodeTraceBenchStep, CodexAdapter, CodexExecAdapter, CodexExecStreamError, CodexTaskScopeError, type CollectOptions, type CollectPolicyEvidenceOptions, type CollectSessionIndexOptions, type CollectSessionSelectionOptions, type CollectSessionWorkflowOptions, type ConformanceRenderOptions, type CoordinationLog, type CoordinationQuestion, type CoordinationSteer, CopilotAdapter, type CorpusSpec, type CorruptionMode, type CwdSource, DEFAULT_ANALYST_MODEL, DEFAULT_ASK_CONCURRENCY, DEFAULT_HARNESS, DEFAULT_SANDBOX_BASE_URL, type DockerImagePreparerOptions, EMPTY_SPAN_RUN_SNAPSHOT, EXPORT_RULE, EmptySessionError, type EnumerationResult, type EvidenceOnlyVerdict, type ExcludedCase, type ExcludedTurnFact, type ExecuteOptions, type ExportRule, type ExternalAnalysisKind, type ExternalAnalysisPayload, type ExternalAnalysisResult, type ExternalAnalyzer, type ExternalAnalyzerOptions, type ExternalDiscoveryCandidate, FACT_LIST_CAP, FACT_TEXT_CAP, FactoryAdapter, type FailedFixAttempt, type FailureFollowUp, type FailureFollowUpReport, type FileRunContextReaderOptions, type FinalMessageFact, type FindSessionTextLeaksOptions, type FindingRejectionCounts, type FindingRejectionReasons, type FindingRejectionTally, type FindingReplaySource, type FindingReplayability, type FindingVerification, type FindingVerificationStatus, type FixArmExecution, type FixArmExecutor, type FixGenerationOutcome, type FixLoopAttemptRecord, type FixLoopOptions, type FixLoopResult, type FixPromptInput, type FollowUpKind, ForgeAdapter, GeminiAdapter, type HaloAnalyzerOptions, type HaloReasoningEffort, type HarnessTraceAdapter, type HodoscopeAnalyzerOptions, type HodoscopeInput, type HodoscopeMessage, type HodoscopeSourceMapEntry, type HodoscopeTrajectory, INGEST_SOURCE_CLI, INHERITED_SOURCE_ATTR, INHERITED_SPANS_OMITTED_ATTR, INHERITED_SPAN_ATTR, INHERITED_SPAN_COUNT_ATTR, type ImagePreparation, type ImagePreparer, type IncorrectStepsSubject, type IngestedTrajectory, type InheritedSpanSource, type InspectSessionIndexOptions, JsonSourceError, type JsonlCorruptionReceipt, JsonlParseError, type JsonlReadOptions, type LiveBatchOptions, type LocateOptions, type LoopConvergence, type LoopConvergenceReport, type LoopIteration, type LoopTrend, type LoopTrendBasis, MAX_SHELL_DEPTH, MAX_TRACE_QUESTION_CHARS, type ObservedLoop, type ObserverOptions, OpencodeAdapter, type OtlpIngestIssue, type OtlpIngestIssueKind, type OtlpInput, type OtlpInputFile, type OtlpRowConversion, type OtlpSpan, type OtlpSpanKind, type OtlpSpanLink, type OtlpStatusCode, POLICY_EVIDENCE_NOTE, PREPARED_CONTEXT_BYTE_CEILING, type ParentTaskResolution, type ParseOptions, PartialUploadError, PiAdapter, type PiAdapterOptions, type PipelineOptions, type PipelineReport, type PlanOptions, type PolicyEvidenceLoopSummary, type PolicyEvidenceRecord, type PolicyEvidenceToolSummary, type PrefixDivergence, type PrefixReplayResult, type PrimeAnalyzerOptions, type PrimeTransport, type PrimeTransportRequest, type PrimeTransportResponse, type ProjectSessionBundleOptions, type ProjectSessionBundleResult, type PullRequestFact, type PullRequestFacts, type PullRequestReading, QwenAdapter, REACTIONS, RESULT_FILE, RULE, type Reaction, type ReactionReport, type ReactionSessionReport, type Redactor, type ReplayArmVerdict, type ReplayBatchCaseRow, type ReplayBatchCliArgs, type ReplayBatchFixResult, type ReplayBatchOptions, type ReplayBatchReport, type ReplayExclusionReason, type ReplayExecBackend, type ReplayExecResult, type ReplayExecSession, type ReplayFindingOptions, type ReplayFindingResult, type ReplayVerdict, type ReplayVerifyCliArgs, type ReplayVerifyOptions, type ReplayableCase, type RepoAttrs, type RepoResolution, type RepoResolutionSource, type ResolvedFindingReplay, type ResolvedOtlpInput, type ResolvedReplayInvocation, type ResourceResolution, type RunContextJournal, type RunContextNode, type RunContextResult, type RunContextSnapshot, type RunResult, type RunWatchSnapshot, type RunWatchTarget, type RuntimeTrace, SESSION_FACTS_VERSION_SUFFIX, SESSION_TOKEN_TOTAL_ATTR, SOURCE_ATTRIBUTE_PREFIX, SPAN_SYNTHESIZED_ATTR, SPAWN_JOURNAL_FILE, STATUS_MARK, SUBMIT_ACTION_SIGNATURE, SYNTHESIZED_SOURCE_ATTR, SYNTHESIZED_SPAN_ATTR, SandboxCounterfactualRunner, type SandboxCounterfactualRunnerOptions, type SandboxReplayBackendOptions, type ScanOptions, type ScannedSession, type SessionBatch, type SessionBundleAbsence, type SessionBundleCarriedSignatures, type SessionBundleExclusion, type SessionBundleExclusionRule, type SessionBundleFile, type SessionBundleLeakCheck, type SessionBundleLedgerSlice, type SessionBundleManifest, type SessionBundleProjection, type SessionBundleResult, type SessionBundleSliceRule, type SessionBundleView, type SessionCorruptionReceipt, type SessionEnvironment, type SessionFact, type SessionFacts, type SessionFactsReport, type SessionIdentityConflict, type SessionIdentityIndex, type SessionIntegrity, type SessionRef, type SessionRelationship, type SessionRole, type SessionSeedGroup, type SessionSelection, type SessionSelectionRow, type SessionSourceFile, type SessionTextLeak, type SessionTextLeakReport, type SessionTurnFact, type SessionWorkflow, SessionWorkflowError, type SessionWorkflowErrorCode, type SessionWorkflowIssue, type SessionWorkflowSession, type SessionWorkflowSummary, type SkippedAnalysis, type SkippedInputFile, type SourceRecordReference, type SpanInput, type SpanNodeStatus, type SpanRedaction, type SpanRunNode, type SpanRunSnapshot, type SpanStructure, type SpawnedChildResolution, type SpendRoll, type SteeringChainReport, type SteeringEdge, type SubagentSpawnFact, TRACES_REDACTION_RULES, TRACE_QUESTION_PREVIEW_HEAD_CHARS, type TraceAgenticRoute, type TraceAgenticRouteReason, type TraceAgenticRouteReasonCode, type TraceContextIndex, type TraceContextRoot, type TraceEvidenceExportOptions, type TraceEvidenceExportResult, type TraceEvidenceFormatOption, type TraceEvidenceInputFormat, type TraceEvidenceRow, type TraceExecutionOptions, type TraceFindingPacket, type TraceImprovementArtifacts, type TraceImprovementOptions, type TraceImprovementResult, type TraceIndexedFile, type TraceInspectionArea, type TraceInspectionFinding, type TraceInspectionReport, type TraceInspectionSeverity, type TraceInvestigationOptions, type TraceInvestigationResult, type TraceLiveAction, type TraceLiveActionKind, type TraceLiveAnalysisContext, type TraceLiveAnalyst, type TraceLiveBatch, type TraceLiveEvidence, type TraceLiveFinding, type TraceLiveLoop, type TraceLiveSeverity, type TraceQuestion, type TraceQuestionAnswer, type TraceQuestionCitation, type TraceQuestionFailureKind, type TraceQuestionTrace, type TraceQuestionsArtifacts, type TraceQuestionsOptions, type TraceQuestionsResult, type TraceQuestionsTotals, type TraceSessionIndex, type TraceSessionIndexRow, type TraceStoreInvestigationOptions, type TraceStoreInvestigationResult, type TraceStreamEvent, type TraceStreamOptions, type TraceStreamReplayOptions, type TraceStreamSession, type TracesConfig, type TriggerPair, type TurnActorCount, type UnavailableCapabilities, type UploadBackend, type UploadIdentity, type UploadItem, type UploadPlan, type UploadRecord, type UploadResult, type UploadState, type UserPromptInput, type VerifiableFinding, type VerifyFindingsCliArgs, type VerifyFindingsOptions, type VerifyFindingsRun, type WatchRunTargetOptions, ZERO_ROLL, type ZaiChatCallerOptions, addSpend, alreadyUploaded, analysisEngineFromEnv, analyzeAdoption, analyzeLiveBatch, analyzeLoopConvergence, analyzeReactions, analyzeSpans, analyzeSteeringChain, answerSchemaErrors, applyRedactor, assembleSessionBundle, assertAnswerSchema, assertSandboxReachable, buildFixPrompt, buildPolicyEvidenceRecord, buildRetryFixPrompt, buildSessionFactsReport, buildSessionIndex, buildSessionIndexFromRows, buildSpanRunTree, buildTraceFindingPacket, capText, chatTrajectoryToSpans, classifyEvidenceOnlyPath, classifyFailureFollowUps, classifyLiveActions, classifyReaction, classifyVerdict, claudeActor, clipText, cmdReplayVerify, cmdReplayVerifyBatch, cmdVerifyFindings, codexActor, collectPolicyEvidence, collectSessionIndex, collectSessionSelection, collectSessionWorkflow, collectSessions, commandAnalyzer, commandRedactor, commandTextFromInput, computeSessionFacts, conformanceOfSpans, connectors, countScriptCommands, countSkillRunsJsonl, createBundleSourceReader, createFindingRejectionTally, cwdMatchesSelection, cwdMatchesSelectionResolved, defaultTraceLiveAnalysts, deriveFailureSignature, derivedImageTag, describeSessionRelationship, dockerImagePreparer, engineCallReservationFloorUsd, enumerateReplayableCases, environmentAttributes, environmentFromSpanAttributes, equivalentGitCwds, executeUpload, exportTraceEvidenceFile, exportTraceEvidenceRows, exportTraceEvidenceText, externalFailureMessage, extractFixCommand, fileRunContextSupervisorRunReader, fileSha256, findContextRoot, findSessionTextLeaks, findSpanSourceFiles, findingRejection, findingRejectionDetail, findingReplayStep, findingTrajectoryId, forEachTreeNode, formatFindingRejections, generateFixCommand, goldIncorrectSteps, haloAnalyzer, hashSessionBundleFiles, hodoscopeAnalyzer, httpJsonTransport, importCodeTraceBench, incompleteInputsNote, indexSessionIdsByTrace, inferRole, inferSpanKind, ingestCodeTraceBenchSteps, inspectSessionIndex, int, isBridgeMismatchError, isChatTrajectory, isChatTrajectoryMessage, isFileRunContextDir, isInheritedSpan, isSubmitAction, isSynthesizedSpan, knownHarnesses, listAdapters, listSessionBundleFiles, loadState, loadTraceQuestionsFile, loadTracesConfig, locateSessions, looksLikeAgentPrompt, mergeRolls, mergeTracesConfig, ms, normalizeAnalystCitations, normalizeRemote, normalizeTraceQuestions, otlpRowToSpan, outboundHash, parseCorpusFlag, parseIncorrectStepsSubject, parseIsoToEpochMs, parseJsonAnswer, parseObservationOutput, parseRecordedReturncode, parseReplayBatchArgs, parseReplayVerifyArgs, parseSession, parseSince, parseVerifyFindingsArgs, planTraceAgenticRoute, planUpload, primeAnalyzer, projectSessionBundle, readCoordinationLog, readFileRunContext, readFindingsFile, readJsonFile, readJsonl, readLabelEntries, readOtlpInput, readPullRequests, readRunContextJournal, readRunContextSnapshot, readRunWatchSnapshot, readSessionBundleManifest, readSessionIndexFile, readSpanRunSnapshot, recordSessionCorruption, redactSpans, renderBatchReport, renderConformance, renderInspectionReport, renderRunContextSnapshot, renderRunWatchSnapshot, renderSessionFacts, renderSessionFactsContext, renderSpanRunSnapshot, renderTraceQuestionInstructions, renderTraceQuestionPrompt, renderTraceQuestionsReport, renderValidation, renderVerifiedFindingsSection, replayBatchUsage, replayVerify, replayVerifyFinding, replayVerifyUsage, resolveAdapter, resolveCaseResources, resolveFindingInvocation, resolveFindingReplayability, resolveOtlpInputFiles, resolveRepoAttrs, resolveRunContextDir, resolveRunWatchTarget, resolveSessionRepoAttrs, runCommand, runExternalAnalyzers, runFixLoop, runPipelines, runReplayBatch, runTotals, runTraceImprovement, runTraceInvestigation, runTraceQuestions, runTraceStoreInvestigation, sandboxReplayBackend, saveReport, saveState, scanSessions, seededSample, selectAdapters, serializeInspectionReport, serializePolicyEvidence, serializeSessionIndex, serializeSpans, serializeTraceStreamEvent, sessionFactsContext, sessionHash, sessionIdFromAttributes, sessionIntegrityAttributes, sessionTextSignatures, shellCommands, skippedAnalyses, span, spanRunTotals, stampEnvironmentAttrs, stampRepoAttrs, stampSessionIdentity, stampSessionIntegrity, stampSpanWorkdirRepoAttrs, streamSessions, summarizeOtlpExecution, summarizeSpanExecution, summarizeSpanStructure, takeJsonl, textIsSynthetic, toOpenInferenceSpan, toRuntimeStore, toTraceSpanEvents, tokens, totalAgenticFailureMessage, totalFindingRejections, traceAgenticKinds, traceCitationsInText, traceStreamEventsFromSpans, unavailableCapabilities, uploadKey, usd, userPromptSpan, validateOtlpSpans, validationExitCode, verifyFindings, verifyFindingsUsage, watchRunTarget, watchSessions, withSessionFactsContext, wrap, wrapActionForExec, writeHodoscopeInput, writeInspectionReportFile, writeOtlpFile, writePolicyEvidenceFile, writeSessionBundleManifest, writeSessionIndexFile, writeTraceEvidenceExportFile, writeTraceImprovementArtifacts, writeTraceQuestionsArtifacts, zaiChatCaller, zeroPricedCost };