@tangle-network/traces 0.12.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +132 -3
- package/dist/{chunk-CV22VGCK.js → chunk-7DOBU7BJ.js} +16040 -12291
- package/dist/cli.js +221 -169
- package/dist/index.d.ts +933 -59
- package/dist/index.js +109 -1
- package/docs/trace-analysts.md +307 -0
- package/install.sh +0 -0
- package/package.json +23 -19
- package/skills/build-trace-analyst/SKILL.md +3 -0
- package/skills/inspect-agent-traces/SKILL.md +22 -20
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 {
|
|
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
|
|
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
|
|
|
@@ -1208,6 +1277,13 @@ declare class CodexAdapter implements HarnessTraceAdapter {
|
|
|
1208
1277
|
locate(opts?: LocateOptions): Promise<SessionRef[]>;
|
|
1209
1278
|
locateBySessionId(sessionId: string, opts?: LocateOptions): Promise<SessionRef[]>;
|
|
1210
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;
|
|
1211
1287
|
parse(ref: SessionRef, options?: ParseOptions): Promise<OtlpSpan[]>;
|
|
1212
1288
|
}
|
|
1213
1289
|
|
|
@@ -1246,7 +1322,8 @@ declare class OpencodeAdapter implements HarnessTraceAdapter {
|
|
|
1246
1322
|
readonly harness = "opencode";
|
|
1247
1323
|
private storage;
|
|
1248
1324
|
locate(opts?: LocateOptions): Promise<SessionRef[]>;
|
|
1249
|
-
|
|
1325
|
+
sourcePaths(ref: SessionRef): Promise<readonly string[]>;
|
|
1326
|
+
parse(ref: SessionRef, options?: ParseOptions): Promise<OtlpSpan[]>;
|
|
1250
1327
|
}
|
|
1251
1328
|
|
|
1252
1329
|
/**
|
|
@@ -1281,7 +1358,7 @@ declare class GeminiFamilyAdapter implements HarnessTraceAdapter {
|
|
|
1281
1358
|
* digests and stay null.) Loaded once per locate(). */
|
|
1282
1359
|
private loadProjectCwds;
|
|
1283
1360
|
locate(opts?: LocateOptions): Promise<SessionRef[]>;
|
|
1284
|
-
parse(ref: SessionRef): Promise<OtlpSpan[]>;
|
|
1361
|
+
parse(ref: SessionRef, options?: ParseOptions): Promise<OtlpSpan[]>;
|
|
1285
1362
|
}
|
|
1286
1363
|
declare class GeminiAdapter extends GeminiFamilyAdapter {
|
|
1287
1364
|
constructor();
|
|
@@ -1327,6 +1404,7 @@ declare class FactoryAdapter implements HarnessTraceAdapter {
|
|
|
1327
1404
|
readonly aliases: readonly ["factory-droids", "droid"];
|
|
1328
1405
|
private root;
|
|
1329
1406
|
locate(opts?: LocateOptions): Promise<SessionRef[]>;
|
|
1407
|
+
sourcePaths(ref: SessionRef): Promise<readonly string[]>;
|
|
1330
1408
|
parse(ref: SessionRef, options?: ParseOptions): Promise<OtlpSpan[]>;
|
|
1331
1409
|
}
|
|
1332
1410
|
|
|
@@ -1372,7 +1450,7 @@ declare class AmpAdapter implements HarnessTraceAdapter {
|
|
|
1372
1450
|
readonly harness = "amp";
|
|
1373
1451
|
private threadsRoot;
|
|
1374
1452
|
locate(opts?: LocateOptions): Promise<SessionRef[]>;
|
|
1375
|
-
parse(ref: SessionRef): Promise<OtlpSpan[]>;
|
|
1453
|
+
parse(ref: SessionRef, options?: ParseOptions): Promise<OtlpSpan[]>;
|
|
1376
1454
|
}
|
|
1377
1455
|
|
|
1378
1456
|
/**
|
|
@@ -1418,7 +1496,7 @@ declare class ForgeAdapter implements HarnessTraceAdapter {
|
|
|
1418
1496
|
/** Directories scanned for `*-dump.json` exports. */
|
|
1419
1497
|
private dumpDirs;
|
|
1420
1498
|
locate(opts?: LocateOptions): Promise<SessionRef[]>;
|
|
1421
|
-
parse(ref: SessionRef): Promise<OtlpSpan[]>;
|
|
1499
|
+
parse(ref: SessionRef, options?: ParseOptions): Promise<OtlpSpan[]>;
|
|
1422
1500
|
}
|
|
1423
1501
|
|
|
1424
1502
|
/**
|
|
@@ -1452,6 +1530,7 @@ type Actor = 'human' | 'agent' | 'subagent-spawn' | 'injected' | 'tool-result';
|
|
|
1452
1530
|
* `tangle.sessionId`/`tangle.ingest_source` wire contract. */
|
|
1453
1531
|
declare const ACTOR_ATTR = "tangle.actor";
|
|
1454
1532
|
interface UserPromptInput {
|
|
1533
|
+
contentSource?: SourceReferences;
|
|
1455
1534
|
traceId: string;
|
|
1456
1535
|
spanId: string;
|
|
1457
1536
|
parentSpanId: string | null;
|
|
@@ -1511,13 +1590,19 @@ declare function claudeActor(args: {
|
|
|
1511
1590
|
isFirstUserTurn?: boolean;
|
|
1512
1591
|
}): Actor;
|
|
1513
1592
|
/**
|
|
1514
|
-
* Derive the actor for a Codex user message.
|
|
1515
|
-
*
|
|
1516
|
-
*
|
|
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.
|
|
1517
1600
|
*/
|
|
1518
1601
|
declare function codexActor(args: {
|
|
1519
1602
|
text: string;
|
|
1603
|
+
blocks?: readonly string[];
|
|
1520
1604
|
isFirstUserTurn?: boolean;
|
|
1605
|
+
kinds?: readonly unknown[];
|
|
1521
1606
|
}): Actor;
|
|
1522
1607
|
type Reaction = 'correction' | 'frustration' | 'praise' | 'jargon' | 'structure';
|
|
1523
1608
|
/** Label a human turn with every reaction signal it matches. Mirrors
|
|
@@ -1527,6 +1612,51 @@ declare function classifyReaction(text: string): Reaction[];
|
|
|
1527
1612
|
* corrective-to-positive ratio). `praise` is the positive denominator. */
|
|
1528
1613
|
declare const CORRECTIVE_REACTIONS: readonly Reaction[];
|
|
1529
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
|
+
|
|
1530
1660
|
/**
|
|
1531
1661
|
* Failure follow-up classification — the retry-with-state marker.
|
|
1532
1662
|
*
|
|
@@ -1554,7 +1684,7 @@ interface FailureFollowUp {
|
|
|
1554
1684
|
/** Null when the tool was never called again after the failure. */
|
|
1555
1685
|
followUpSpanId: string | null;
|
|
1556
1686
|
kind: FollowUpKind;
|
|
1557
|
-
/**
|
|
1687
|
+
/** Captured follow-up outcome; null when absent or unknown. */
|
|
1558
1688
|
followUpSucceeded: boolean | null;
|
|
1559
1689
|
}
|
|
1560
1690
|
interface FailureFollowUpReport {
|
|
@@ -1568,7 +1698,7 @@ interface FailureFollowUpReport {
|
|
|
1568
1698
|
adapted: number;
|
|
1569
1699
|
/** Arguments were not captured or not comparable on one side of the pair. */
|
|
1570
1700
|
argsUnknown: number;
|
|
1571
|
-
/** Follow-ups
|
|
1701
|
+
/** Follow-ups with explicit success, out of `followed`. */
|
|
1572
1702
|
followUpSucceeded: number;
|
|
1573
1703
|
/** Blind-retry count per tool, largest offender first when rendered. */
|
|
1574
1704
|
blindByTool: Record<string, number>;
|
|
@@ -1792,6 +1922,11 @@ declare function toRuntimeStore(spans: readonly OtlpSpan[]): Promise<RuntimeTrac
|
|
|
1792
1922
|
*/
|
|
1793
1923
|
|
|
1794
1924
|
interface AnalyzeOptions {
|
|
1925
|
+
/** Explicitly authorize original source reads from this full session bundle. */
|
|
1926
|
+
sourceBundle?: {
|
|
1927
|
+
path: string;
|
|
1928
|
+
maxRecordBytes?: number;
|
|
1929
|
+
};
|
|
1795
1930
|
/**
|
|
1796
1931
|
* Recursive analysis engine enabling the agentic analyst kinds. Omit →
|
|
1797
1932
|
* deterministic only. The engine's id, version, and model become the
|
|
@@ -1813,6 +1948,16 @@ interface AnalyzeOptions {
|
|
|
1813
1948
|
agenticRegistry?: AnalystRegistry;
|
|
1814
1949
|
/** Select a subset of agent-eval's maintained trace analyst kinds. */
|
|
1815
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;
|
|
1816
1961
|
/** Compact deterministic findings that agents receive before reading spans. */
|
|
1817
1962
|
agenticPriorFindings?: readonly AnalystFinding[];
|
|
1818
1963
|
/** Where to write the OTLP-JSONL artifact. Defaults to a temp file. */
|
|
@@ -1836,6 +1981,56 @@ interface AnalyzeResult {
|
|
|
1836
1981
|
}
|
|
1837
1982
|
declare function analyzeSpans(spans: readonly OtlpSpan[], opts?: AnalyzeOptions): Promise<AnalyzeResult>;
|
|
1838
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
|
+
|
|
1839
2034
|
interface TraceExecutionOptions {
|
|
1840
2035
|
readonly experimentId?: string;
|
|
1841
2036
|
readonly candidateId?: string;
|
|
@@ -2059,6 +2254,8 @@ declare function writeSessionIndexFile(index: TraceSessionIndex, outPath?: strin
|
|
|
2059
2254
|
*/
|
|
2060
2255
|
|
|
2061
2256
|
interface SessionBundleFile {
|
|
2257
|
+
/** Opaque source identity when this file backs native span attributes. */
|
|
2258
|
+
readonly sourceId?: string;
|
|
2062
2259
|
/** Bundle-relative path, `/`-separated. */
|
|
2063
2260
|
readonly path: string;
|
|
2064
2261
|
readonly bytes: number;
|
|
@@ -2533,6 +2730,13 @@ declare function runExternalAnalyzers(otlpPath: string, analyzers: readonly Exte
|
|
|
2533
2730
|
signal?: AbortSignal;
|
|
2534
2731
|
spans?: readonly OtlpSpan[];
|
|
2535
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;
|
|
2536
2740
|
/** An external PII/secret scrubber for free-form text — catches what regex
|
|
2537
2741
|
* can't (names, addresses). Use to harden upload beyond the built-in rules. */
|
|
2538
2742
|
interface Redactor {
|
|
@@ -2550,6 +2754,57 @@ declare function commandRedactor(spec: {
|
|
|
2550
2754
|
timeoutMs?: number;
|
|
2551
2755
|
}): Redactor;
|
|
2552
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
|
+
|
|
2553
2808
|
type TraceLiveSeverity = 'info' | 'low' | 'medium' | 'high';
|
|
2554
2809
|
interface TraceLiveEvidence {
|
|
2555
2810
|
readonly kind: 'metric' | 'span' | 'pattern';
|
|
@@ -2749,6 +3004,8 @@ interface TracesConfig {
|
|
|
2749
3004
|
readonly externalAnalyzers?: readonly ExternalAnalyzer[];
|
|
2750
3005
|
}
|
|
2751
3006
|
interface TraceInvestigationOptions {
|
|
3007
|
+
/** Explicit full-bundle source access for local analyst tools only. */
|
|
3008
|
+
readonly sourceBundle?: AnalyzeOptions['sourceBundle'];
|
|
2752
3009
|
readonly spans: readonly OtlpSpan[];
|
|
2753
3010
|
readonly harness: string;
|
|
2754
3011
|
readonly sources?: readonly ReportSource[];
|
|
@@ -2840,6 +3097,12 @@ interface TraceInvestigationResult {
|
|
|
2840
3097
|
* findings as if the requested LLM analysis had happened.
|
|
2841
3098
|
*/
|
|
2842
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;
|
|
2843
3106
|
readonly external: readonly ExternalAnalysisResult[];
|
|
2844
3107
|
readonly report: string;
|
|
2845
3108
|
}
|
|
@@ -2883,6 +3146,8 @@ declare function buildTraceFindingPacket(opts: BuildTraceFindingPacketOptions):
|
|
|
2883
3146
|
declare function loadTracesConfig(path?: string): Promise<TracesConfig | undefined>;
|
|
2884
3147
|
declare function mergeTracesConfig(opts: TraceInvestigationOptions, config?: TracesConfig): TraceInvestigationOptions;
|
|
2885
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;
|
|
2886
3151
|
/**
|
|
2887
3152
|
* Operator-facing message for a fully dead agentic pass: non-empty exactly
|
|
2888
3153
|
* when an agentic pass ran and NO analyst in it succeeded — failed and
|
|
@@ -2898,6 +3163,651 @@ declare function writeTraceImprovementArtifacts(result: Omit<TraceImprovementRes
|
|
|
2898
3163
|
declare function runTraceImprovement(opts: TraceImprovementOptions): Promise<TraceImprovementResult>;
|
|
2899
3164
|
declare function saveReport(path: string, report: string): Promise<void>;
|
|
2900
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
|
+
|
|
2901
3811
|
type Json = null | boolean | number | string | Json[] | {
|
|
2902
3812
|
[key: string]: Json;
|
|
2903
3813
|
};
|
|
@@ -3078,45 +3988,10 @@ interface ObserverOptions {
|
|
|
3078
3988
|
declare function watchSessions(opts: ObserverOptions): Promise<void>;
|
|
3079
3989
|
|
|
3080
3990
|
/**
|
|
3081
|
-
*
|
|
3082
|
-
*
|
|
3083
|
-
*
|
|
3084
|
-
*
|
|
3085
|
-
* <runDir>/coordination-log.jsonl optional — steer / delivery / question / settled
|
|
3086
|
-
* <runDir>/blobs/ optional — content-addressed settled results
|
|
3087
|
-
* <runDir>/result.json optional — the terminal outcome document
|
|
3088
|
-
*
|
|
3089
|
-
* `loopsSupervisorRunReader` is the other implementation, over a completely
|
|
3090
|
-
* different layout. Neither knows about the other, and NOTHING here analyzes:
|
|
3091
|
-
* `analyzeSupervisorRun` / `parseSupervisorTree` / `rollupSupervisorRuns` in
|
|
3092
|
-
* `@tangle-network/agent-eval/supervisor-run` compute every metric, and
|
|
3093
|
-
* `materializeTreeView` in `@tangle-network/agent-runtime/kernel` folds the
|
|
3094
|
-
* event log into the tree. This file is translation only.
|
|
3095
|
-
*
|
|
3096
|
-
* ## Two translations, both faithful
|
|
3097
|
-
*
|
|
3098
|
-
* 1. **The envelope.** agent-runtime's `FileSpawnJournal` writes each event
|
|
3099
|
-
* wrapped as `{kind:'event', root, event:{…}}` after one `{kind:'begin'}`
|
|
3100
|
-
* record. agent-eval's parser reads `kind` at the TOP level, so an
|
|
3101
|
-
* un-translated file parses as zero spawns AND zero malformed rows — a run
|
|
3102
|
-
* that reads as "the supervisor did nothing" rather than "I cannot read
|
|
3103
|
-
* this". The reader unwraps the envelope and re-emits flat JSONL.
|
|
3104
|
-
*
|
|
3105
|
-
* 2. **`role`.** `SupervisorRunSources.journal` documents
|
|
3106
|
-
* `role: 'supervisor' | 'worker'` on spawned rows for recursive readers.
|
|
3107
|
-
* agent-runtime's `SpawnEvent` has no such field, so it is INFERRED
|
|
3108
|
-
* structurally and exactly: a node that appears as another spawn's `parent`
|
|
3109
|
-
* is a supervisor; the root is a supervisor because it has no parent;
|
|
3110
|
-
* everything else is a worker. No new upstream field is needed for this,
|
|
3111
|
-
* and no depth limit applies — `<root>:s0:s0` classifies its parent
|
|
3112
|
-
* `<root>:s0` as a supervisor by the same rule that classifies the root.
|
|
3113
|
-
*
|
|
3114
|
-
* Steer traffic is translated the same way: this layout records steers in
|
|
3115
|
-
* `coordination-log.jsonl` rather than per-worker inbox files, and each
|
|
3116
|
-
* recorded field maps 1:1 onto the per-worker artifacts the analyzer reads.
|
|
3117
|
-
* Nothing is synthesized from an absent fact — an artifact this layout does
|
|
3118
|
-
* not keep is declared in `SourceLimits`, which is what turns the dependent
|
|
3119
|
-
* 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.
|
|
3120
3995
|
*/
|
|
3121
3996
|
|
|
3122
3997
|
declare const SPAWN_JOURNAL_FILE = "spawn-journal.jsonl";
|
|
@@ -3187,16 +4062,15 @@ interface CoordinationLog {
|
|
|
3187
4062
|
*/
|
|
3188
4063
|
declare function readCoordinationLog(text: string | null): CoordinationLog;
|
|
3189
4064
|
interface FileRunContextReaderOptions {
|
|
3190
|
-
/** Override the
|
|
4065
|
+
/** Override the recorded Runtime identity used for rollup grouping. */
|
|
3191
4066
|
readonly instanceId?: string | null;
|
|
3192
4067
|
/** Which arm of a comparison this run is (default: the run directory's basename). */
|
|
3193
4068
|
readonly arm?: string | null;
|
|
3194
4069
|
}
|
|
3195
4070
|
/**
|
|
3196
4071
|
* Read a `createFileRunContext` run directory into `SupervisorRunSources`.
|
|
3197
|
-
*
|
|
3198
|
-
*
|
|
3199
|
-
* `unavailable` rather than 0.
|
|
4072
|
+
* Eval preserves missing evidence and rejects malformed Runtime records.
|
|
4073
|
+
* Coordination-log evidence extends the normalized worker sources.
|
|
3200
4074
|
*/
|
|
3201
4075
|
declare function readFileRunContext(runDir: string, opts?: FileRunContextReaderOptions): Promise<SupervisorRunSources>;
|
|
3202
4076
|
/** The `createFileRunContext` on-disk layout, as a `SupervisorRunReader`. */
|
|
@@ -4655,4 +5529,4 @@ interface ExecuteOptions {
|
|
|
4655
5529
|
/** Send the final, new outbound items (or write their dry-run OTLP). */
|
|
4656
5530
|
declare function executeUpload(plan: UploadPlan, opts?: ExecuteOptions): Promise<UploadResult>;
|
|
4657
5531
|
|
|
4658
|
-
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 FailureFollowUp, type FailureFollowUpReport, 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, type FollowUpKind, 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, classifyFailureFollowUps, classifyLiveActions, classifyReaction, classifyVerdict, claudeActor, clipText, cmdReplayVerify, cmdReplayVerifyBatch, cmdVerifyFindings, codexActor, collectPolicyEvidence, collectSessionIndex, collectSessionSelection, collectSessionWorkflow, collectSessions, commandAnalyzer, commandRedactor, conformanceOfSpans, connectors, countScriptCommands, countSkillRunsJsonl, cwdMatchesSelection, cwdMatchesSelectionResolved, 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 };
|