@tangle-network/traces 0.11.4 → 0.11.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -420,6 +420,25 @@ interface SessionIntegrity {
420
420
  status: 'degraded_not_lossless';
421
421
  corruptions: SessionCorruptionReceipt[];
422
422
  }
423
+ /**
424
+ * Execution-environment identity for a session — what replay verification
425
+ * needs to reconstruct where the session's commands actually ran. Populated
426
+ * by adapters/importers where known: sandbox sessions know their image
427
+ * (`runtime.ready` carries it); host-harness sessions usually do not.
428
+ * Absent fields mean "not recorded", never "none".
429
+ */
430
+ interface SessionEnvironment {
431
+ /** Container image reference (repo:tag or repo@digest) the session executed in. */
432
+ image?: string;
433
+ /** Immutable image digest (`sha256:…`) — the replay-grade pin when known. */
434
+ imageDigest?: string;
435
+ /** Sandbox/container instance id that executed the session. */
436
+ sandboxId?: string;
437
+ /** Working directory commands executed from; null when unrecorded. */
438
+ cwd: string | null;
439
+ /** Commit hash the workspace was at when the session ran, when recorded. */
440
+ gitCommit?: string;
441
+ }
423
442
  /** A single discovered session, before parsing. */
424
443
  interface SessionRef {
425
444
  /** Harness id (matches the nix profile / backend name). */
@@ -434,6 +453,8 @@ interface SessionRef {
434
453
  mtimeMs: number;
435
454
  /** Present when parsing recovered valid records around corrupt source records. */
436
455
  integrity?: SessionIntegrity;
456
+ /** Execution-environment identity, when the source records it (sandbox sessions). */
457
+ environment?: SessionEnvironment;
437
458
  }
438
459
  interface LocateOptions {
439
460
  /** Limit discovery to sessions whose cwd matches (exact or prefix). */
@@ -819,9 +840,44 @@ declare const ATTR: {
819
840
  readonly CORRUPTION_BYTE_LENGTH: "traces.session.corruption.byte_length";
820
841
  readonly CORRUPTION_SHA256: "traces.session.corruption.sha256";
821
842
  readonly RAW_SOURCE_RETENTION: "traces.session.raw_source_retention";
843
+ /** Container image reference the session executed in (OTel semconv key). */
844
+ readonly CONTAINER_IMAGE: "container.image.name";
845
+ /** Immutable image digest (`sha256:…`) — the replay-grade environment pin. */
846
+ readonly CONTAINER_IMAGE_DIGEST: "container.image.digest";
847
+ /** Sandbox/container instance id that executed the session. */
848
+ readonly SANDBOX_ID: "tangle.sandbox.id";
849
+ /** Recorded execution cwd, verbatim. Unlike `tangle.cwd` it is never
850
+ * repaired against the host filesystem — replay verification needs the
851
+ * in-container path even when no such path exists on this host. */
852
+ readonly ENVIRONMENT_CWD: "tangle.environment.cwd";
822
853
  };
823
854
  /** `tangle.ingest_source` value for CLI-uploaded traces. Wire contract. */
824
855
  declare const INGEST_SOURCE_CLI = "cli";
856
+ /**
857
+ * Project a `SessionEnvironment` onto span-attribute keys. Only recorded
858
+ * fields are emitted — an absent image stays absent, so "environment not
859
+ * captured" and "environment captured without an image" remain different
860
+ * artifacts downstream.
861
+ */
862
+ declare function environmentAttributes(environment: SessionEnvironment | undefined): Record<string, string>;
863
+ /**
864
+ * Stamp environment identity onto every span so it survives into the OTLP
865
+ * resource block (see `toOpenInferenceSpan`). Additive — a value an adapter
866
+ * already set deliberately is never clobbered.
867
+ */
868
+ declare function stampEnvironmentAttrs(spans: readonly {
869
+ attributes: Record<string, unknown>;
870
+ }[], environment: SessionEnvironment | undefined): void;
871
+ /**
872
+ * Recover a `SessionEnvironment` from stamped span attributes — the read
873
+ * counterpart of `stampEnvironmentAttrs`, for consumers that hold only the
874
+ * OTLP artifact (replay-environment resolution reads the exported spans, not
875
+ * the source session). Returns null when no environment identity was
876
+ * recorded — "not captured" stays distinguishable from any captured value.
877
+ */
878
+ declare function environmentFromSpanAttributes(spans: readonly {
879
+ attributes: Readonly<Record<string, unknown>>;
880
+ }[]): SessionEnvironment | null;
825
881
  /** Harness used when none is specified on a single-harness command. */
826
882
  declare const DEFAULT_HARNESS = "claude-code";
827
883
  declare function sessionIdFromAttributes(attributes: Readonly<Record<string, unknown>>): string | undefined;
@@ -1722,6 +1778,13 @@ interface TraceExecutionOptions {
1722
1778
  declare function summarizeOtlpExecution(otlpJsonl: string, opts?: TraceExecutionOptions): ExecutionReport;
1723
1779
  declare function summarizeSpanExecution(spans: readonly OtlpSpan[], opts?: TraceExecutionOptions): ExecutionReport;
1724
1780
 
1781
+ /**
1782
+ * The one sentence of prose every policy-evidence record carries. It is the
1783
+ * same for every session, so a content check that compares an evidence file
1784
+ * against a transcript must subtract it: a session that reads or writes this
1785
+ * package's source would otherwise look like it leaked its own text.
1786
+ */
1787
+ declare const POLICY_EVIDENCE_NOTE = "This is normalized coding-agent session evidence for downstream policy mining; it is not an eval campaign cell.";
1725
1788
  interface PolicyEvidenceToolSummary {
1726
1789
  readonly name: string;
1727
1790
  readonly calls: number;
@@ -1890,6 +1953,14 @@ interface CollectSessionIndexOptions extends ScanOptions, BuildSessionIndexOptio
1890
1953
  declare function buildSessionIndex(records: readonly PolicyEvidenceRecord[], opts?: BuildSessionIndexOptions & {
1891
1954
  context?: TraceContextIndex;
1892
1955
  }): TraceSessionIndex;
1956
+ /**
1957
+ * Walk up from a session cwd to the root the session's local context lives
1958
+ * under: the first ancestor carrying `.git`, `.evolve`, `AGENTS.md`, or
1959
+ * `CLAUDE.md`. The context index and the session bundler both anchor their
1960
+ * `.evolve` reads here so "which ledger belongs to this session" has exactly
1961
+ * one answer.
1962
+ */
1963
+ declare function findContextRoot(cwd: string | null | undefined): Promise<string | null>;
1893
1964
  declare function buildSessionIndexFromRows(rows: readonly {
1894
1965
  ref: SessionRef;
1895
1966
  spans: readonly OtlpSpan[];
@@ -1898,6 +1969,306 @@ declare function collectSessionIndex(opts?: CollectSessionIndexOptions): Promise
1898
1969
  declare function serializeSessionIndex(index: TraceSessionIndex): string;
1899
1970
  declare function writeSessionIndexFile(index: TraceSessionIndex, outPath?: string): Promise<string>;
1900
1971
 
1972
+ /**
1973
+ * `traces bundle` — assemble one session's durable evidence directory.
1974
+ *
1975
+ * A bundle is the input contract for downstream consumers (distillers,
1976
+ * report writers, auditors) that must cite a session long after the live
1977
+ * stores have rotated: the raw transcript + subagent transcripts, every
1978
+ * derived artifact this CLI already knows how to produce (session index,
1979
+ * deterministic analyze report, policy evidence, OTLP spans), the repo's
1980
+ * `.evolve` ledger sliced to the session window, the git log for that
1981
+ * window, and a manifest with a SHA-256 per file so any later claim can be
1982
+ * checked against the exact bytes it cites.
1983
+ *
1984
+ * The transcript is REQUIRED — no transcript, no bundle, loudly. Everything
1985
+ * else is an optional input whose absence is a recorded fact in the
1986
+ * manifest (`absent`, with the reason), never a silent gap and never an
1987
+ * error: a session without subagents or without an `.evolve` ledger is a
1988
+ * complete bundle of a smaller session.
1989
+ *
1990
+ * This module assembles the FULL view. `bundle-view.ts` projects that full
1991
+ * bundle down to the evidence-only view for a consumer that must not read the
1992
+ * session's own words; `manifest.view` names which of the two a directory is.
1993
+ */
1994
+
1995
+ interface SessionBundleFile {
1996
+ /** Bundle-relative path, `/`-separated. */
1997
+ readonly path: string;
1998
+ readonly bytes: number;
1999
+ readonly sha256: string;
2000
+ }
2001
+ interface SessionBundleAbsence {
2002
+ /** Bundle-relative path the artifact would have occupied. */
2003
+ readonly path: string;
2004
+ readonly reason: string;
2005
+ }
2006
+ type SessionBundleSliceRule =
2007
+ /** JSONL rows kept verbatim when their `ts` falls inside the padded session window. */
2008
+ 'session-window-rows' | 'copied-whole'
2009
+ /** The lexically last `handoff-*.md` — names are date-prefixed, so name order is time order. */
2010
+ | 'latest-by-name'
2011
+ /** Files whose name carries a `YYYY-MM-DD` date inside the session window's dates. */
2012
+ | 'session-window-dated-files';
2013
+ interface SessionBundleLedgerSlice {
2014
+ readonly path: string;
2015
+ /** Absolute source path the slice was read from. */
2016
+ readonly source: string;
2017
+ readonly rule: SessionBundleSliceRule;
2018
+ readonly totalRows?: number;
2019
+ readonly keptRows?: number;
2020
+ /** Rows excluded because no `ts` could be parsed — counted, never silently dropped. */
2021
+ readonly unparseableTsRows?: number;
2022
+ }
2023
+ /**
2024
+ * Which projection of a session a bundle directory holds.
2025
+ *
2026
+ * `full` is the auditor's copy: every source byte, so a claim can be checked
2027
+ * against the exact text it cites. `evidence-only` is the writer's copy: the
2028
+ * counted artifacts, with the session's own words removed, so a writer that
2029
+ * must reach its own conclusion cannot read an earlier one instead.
2030
+ */
2031
+ type SessionBundleView = 'full' | 'evidence-only';
2032
+ type SessionBundleExclusionRule =
2033
+ /** The session's raw text: transcript and subagent transcripts. */
2034
+ 'session-source'
2035
+ /** A derived artifact that replays session text (prompt lines, excerpts, span content). */
2036
+ | 'session-text-derived'
2037
+ /** A file whose body is prose someone authored: ledger notes, handoffs, commit subjects. */
2038
+ | 'authored-prose'
2039
+ /** An allow-listed file dropped because its own text repeats an excluded source. */
2040
+ | 'content-signature'
2041
+ /** Default deny: the evidence-only view carries an allow-list, and this path is not on it. */
2042
+ | 'not-allow-listed';
2043
+ interface SessionBundleExclusion {
2044
+ /** Bundle-relative path in the FULL bundle this view was projected from. */
2045
+ readonly path: string;
2046
+ readonly bytes: number;
2047
+ /** SHA-256 of the excluded bytes, so an auditor can prove which file was dropped. */
2048
+ readonly sha256: string;
2049
+ readonly rule: SessionBundleExclusionRule;
2050
+ readonly reason: string;
2051
+ /**
2052
+ * Present when `rule` is `content-signature`: how much text the file shared
2053
+ * with which excluded sources. Counts and paths only — quoting the matched
2054
+ * text here would carry into the view the very text the exclusion removes.
2055
+ */
2056
+ readonly contentMatch?: {
2057
+ readonly signatures: number;
2058
+ readonly sources: readonly string[];
2059
+ };
2060
+ }
2061
+ interface SessionBundleCarriedSignatures {
2062
+ readonly path: string;
2063
+ /** What the artifact is made of, which is the reason it is safe to carry. */
2064
+ readonly carries: string;
2065
+ /** Distinct content signatures the carried file holds at all. 0 = no prose run of that length. */
2066
+ readonly signatures: number;
2067
+ }
2068
+ /**
2069
+ * The projection's own proof that no excluded file's text survived into the
2070
+ * view. `matches` is typed `0` because a match aborts the projection: a view
2071
+ * directory carrying a leak is never written, so the artifact cannot record one.
2072
+ */
2073
+ interface SessionBundleLeakCheck {
2074
+ /** Consecutive words per content signature. */
2075
+ readonly signatureWords: number;
2076
+ /** Excluded files whose text supplied the signatures compared against. */
2077
+ readonly comparedSources: readonly string[];
2078
+ readonly sourceSignatures: number;
2079
+ readonly carried: readonly SessionBundleCarriedSignatures[];
2080
+ readonly matches: 0;
2081
+ }
2082
+ interface SessionBundleProjection {
2083
+ /** Absolute directory of the full bundle this view was projected from. */
2084
+ readonly sourceDirectory: string;
2085
+ /** SHA-256 of that bundle's `manifest.json` bytes. */
2086
+ readonly sourceManifestSha256: string;
2087
+ readonly leakCheck: SessionBundleLeakCheck;
2088
+ }
2089
+ interface SessionBundleManifest {
2090
+ readonly schemaVersion: 2;
2091
+ readonly kind: 'traces.session_bundle';
2092
+ /** Which projection this directory is. A reader must branch on this, never on the file list. */
2093
+ readonly view: SessionBundleView;
2094
+ readonly createdAt: string;
2095
+ readonly provenance: {
2096
+ readonly sessionId: string;
2097
+ readonly harness: string;
2098
+ readonly cwd: string | null;
2099
+ /** Absolute path of the source transcript at assembly time. */
2100
+ readonly transcriptPath: string;
2101
+ readonly transcriptSha256: string;
2102
+ /** Root the `.evolve` ledger and git log were read under, when found. */
2103
+ readonly contextRoot: string | null;
2104
+ readonly tracesVersion: string;
2105
+ readonly sessionWindow: {
2106
+ readonly firstSpanAt: string | null;
2107
+ readonly lastSpanAt: string | null;
2108
+ /** Pad applied to each side of the window when slicing ledger rows. */
2109
+ readonly padMs: number;
2110
+ };
2111
+ };
2112
+ readonly files: readonly SessionBundleFile[];
2113
+ readonly absent: readonly SessionBundleAbsence[];
2114
+ /** Files the view deliberately dropped. Empty in the `full` view: it drops nothing. */
2115
+ readonly excluded: readonly SessionBundleExclusion[];
2116
+ readonly ledgerSlices: readonly SessionBundleLedgerSlice[];
2117
+ readonly knownLimits: readonly string[];
2118
+ /** Present only in a projected view: where it came from, and the leak check that passed. */
2119
+ readonly projection?: SessionBundleProjection;
2120
+ }
2121
+ interface SessionBundleResult {
2122
+ readonly directory: string;
2123
+ readonly manifestPath: string;
2124
+ readonly manifest: SessionBundleManifest;
2125
+ }
2126
+ interface AssembleSessionBundleOptions {
2127
+ readonly adapter: HarnessTraceAdapter;
2128
+ readonly ref: SessionRef;
2129
+ /** Bundle directory to create. Must be new or empty: one bundle, one session. */
2130
+ readonly outDir: string;
2131
+ readonly generatedAt?: string;
2132
+ readonly minLoopOccurrences?: number;
2133
+ readonly signal?: AbortSignal;
2134
+ readonly log?: (msg: string, fields?: Record<string, unknown>) => void;
2135
+ }
2136
+ /**
2137
+ * Every file under a bundle directory, as sorted bundle-relative
2138
+ * `/`-separated paths. Both the manifest writer and the view projector walk a
2139
+ * bundle through here, so neither can see a file the other does not.
2140
+ */
2141
+ declare function listSessionBundleFiles(root: string): Promise<string[]>;
2142
+ /**
2143
+ * Assemble one session's bundle directory. Throws when the transcript is
2144
+ * missing or unparseable — a bundle without its primary source is not a
2145
+ * degraded bundle, it is not a bundle. Optional inputs (subagents directory,
2146
+ * `.evolve` ledger, git history) that are absent are recorded in
2147
+ * `manifest.absent` with the probed path and reason.
2148
+ */
2149
+ declare function assembleSessionBundle(opts: AssembleSessionBundleOptions): Promise<SessionBundleResult>;
2150
+ /** SHA-256 + byte count for every file under a bundle directory, manifest included when present. */
2151
+ declare function hashSessionBundleFiles(root: string): Promise<SessionBundleFile[]>;
2152
+ declare function writeSessionBundleManifest(outDir: string, manifest: SessionBundleManifest): Promise<string>;
2153
+ /**
2154
+ * Read a bundle's manifest and prove it is one. A directory that merely looks
2155
+ * like a bundle must not be projected: the view guarantee is only as good as
2156
+ * the classification, and the classification only holds over paths this
2157
+ * package wrote.
2158
+ */
2159
+ declare function readSessionBundleManifest(bundleDir: string): Promise<SessionBundleManifest>;
2160
+
2161
+ /**
2162
+ * `traces bundle-view` — project a full session bundle down to one view.
2163
+ *
2164
+ * A bundle has two consumers with opposite needs. An AUDITOR cites the
2165
+ * session and needs every source byte. A WRITER must reach its own conclusion
2166
+ * about the session and therefore must not be able to read the conclusion the
2167
+ * session already reached — which the transcript holds verbatim, including the
2168
+ * shell call that authored an earlier report.
2169
+ *
2170
+ * Serving both from one directory cannot work, and policing it by grep cannot
2171
+ * work either: a check that looks for the earlier report FILE passes while its
2172
+ * CONTENT sits in the transcript. So the two consumers get two directories.
2173
+ * The evidence-only view is a projection of the full bundle: an explicit
2174
+ * allow-list of counted artifacts, every other path excluded by name with its
2175
+ * reason and its hash, and a content check that proves no excluded file's text
2176
+ * survived into the view.
2177
+ *
2178
+ * The allow-list is the structure. The content check is the proof that the
2179
+ * structure is right: before anything is written, every candidate is compared
2180
+ * against every excluded file, and a candidate that repeats one is dropped
2181
+ * from the view and named in the manifest. So the written view never carries
2182
+ * text from a file the view says it removed.
2183
+ */
2184
+
2185
+ /**
2186
+ * Distinct signatures in one text: every run of `SIGNATURE_WORDS` consecutive
2187
+ * words, lowercased, taken WITHIN one line's prose. Signatures never span a
2188
+ * newline, so memory stays bounded by the longest line rather than the file,
2189
+ * and a structure whose every line is a key and a number produces no
2190
+ * signatures at all — which is the true statement about it: it holds no prose.
2191
+ */
2192
+ declare function sessionTextSignatures(text: string): Set<string>;
2193
+ interface SessionTextLeak {
2194
+ /** Bundle-relative path of the carried file that repeats excluded text. */
2195
+ readonly viewPath: string;
2196
+ /** Bundle-relative paths of the excluded files the repeated text came from. */
2197
+ readonly sources: readonly string[];
2198
+ /** Distinct signatures this file shares with those sources. */
2199
+ readonly signatures: number;
2200
+ /**
2201
+ * One matched signature, for a diagnostic message only. It is a fragment of
2202
+ * the excluded text, so it must never be written into a view artifact.
2203
+ */
2204
+ readonly example: string;
2205
+ }
2206
+ interface FindSessionTextLeaksOptions {
2207
+ /** Directory holding the carried files. */
2208
+ readonly viewDir: string;
2209
+ /** Directory holding the excluded files. */
2210
+ readonly sourceDir: string;
2211
+ /** Bundle-relative paths under `viewDir` to check. */
2212
+ readonly carriedPaths: readonly string[];
2213
+ /** Bundle-relative paths under `sourceDir` whose text must not appear in the view. */
2214
+ readonly excludedPaths: readonly string[];
2215
+ }
2216
+ interface SessionTextLeakReport {
2217
+ /** One entry per carried file that repeats excluded text. Empty is the pass. */
2218
+ readonly leaks: readonly SessionTextLeak[];
2219
+ readonly carried: readonly {
2220
+ readonly path: string;
2221
+ readonly signatures: number;
2222
+ }[];
2223
+ readonly comparedSources: readonly string[];
2224
+ readonly sourceSignatures: number;
2225
+ }
2226
+ /**
2227
+ * Compare a set of carried files against the files a view excluded.
2228
+ *
2229
+ * The signature index is built from the CARRIED files, which are small, and
2230
+ * the excluded files are then read one at a time and tested against it — the
2231
+ * cheap direction, since a transcript can be orders of magnitude larger than
2232
+ * everything a view keeps. Every excluded file is scanned to the end, so the
2233
+ * per-file counts are totals rather than "however many we saw before stopping".
2234
+ */
2235
+ declare function findSessionTextLeaks(opts: FindSessionTextLeaksOptions): Promise<SessionTextLeakReport>;
2236
+ type EvidenceOnlyVerdict = {
2237
+ readonly carried: true;
2238
+ readonly owned: boolean;
2239
+ readonly carries: string;
2240
+ } | {
2241
+ readonly carried: false;
2242
+ readonly rule: SessionBundleExclusionRule;
2243
+ readonly reason: string;
2244
+ };
2245
+ /** Classify one bundle-relative path against the evidence-only view. */
2246
+ declare function classifyEvidenceOnlyPath(path: string): EvidenceOnlyVerdict;
2247
+ interface ProjectSessionBundleOptions {
2248
+ /** Directory holding the FULL bundle to project. */
2249
+ readonly bundleDir: string;
2250
+ /** View directory to create. Must be new or empty: one directory, one view. */
2251
+ readonly outDir: string;
2252
+ readonly view: SessionBundleView;
2253
+ readonly generatedAt?: string;
2254
+ }
2255
+ interface ProjectSessionBundleResult {
2256
+ readonly directory: string;
2257
+ readonly manifestPath: string;
2258
+ readonly manifest: SessionBundleManifest;
2259
+ readonly leakCheck: SessionBundleLeakCheck;
2260
+ }
2261
+ /**
2262
+ * Project a full bundle into a narrower view.
2263
+ *
2264
+ * Every file is verified against the source manifest's hash first: a bundle
2265
+ * whose bytes have drifted from its own manifest cannot be projected, because
2266
+ * the classification is only meaningful over the files this package wrote.
2267
+ * The content check then runs before anything is written, so a candidate that
2268
+ * repeats an excluded source is dropped instead of copied.
2269
+ */
2270
+ declare function projectSessionBundle(opts: ProjectSessionBundleOptions): Promise<ProjectSessionBundleResult>;
2271
+
1901
2272
  type TraceInspectionSeverity = 'high' | 'medium' | 'low';
1902
2273
  type TraceInspectionArea = 'index' | 'session' | 'repo' | 'context';
1903
2274
  interface TraceInspectionFinding {
@@ -2516,6 +2887,85 @@ declare function writeHodoscopeInput(otlpPath: string, options?: {
2516
2887
  /** Run Hodoscope as a behavior-discovery engine. Its output requires review. */
2517
2888
  declare function hodoscopeAnalyzer(options?: HodoscopeAnalyzerOptions): ExternalAnalyzer;
2518
2889
 
2890
+ /**
2891
+ * Prime analyst engine — a bundled {@link ExternalAnalyzer} that runs a
2892
+ * one-shot RLM over the OTLP-JSONL artifact through an OpenAI-compatible
2893
+ * bridge (cli-bridge's prime backend, or any `/v1/chat/completions` endpoint).
2894
+ *
2895
+ * Protocol, in one pass with no tools:
2896
+ * 1. The FULL span projection is inlined into the prompt as JSON — prime has
2897
+ * no REPL and no trace tools, so unlike the dspy-rlm analysts (which
2898
+ * drill via viewSpans/searchTrace) every fact must travel in the prompt.
2899
+ * 2. The reply contract is one fenced ```json block of SHORT strings
2900
+ * (long strings get corrupted in transport), citing span ids verbatim.
2901
+ * 3. A structurally malformed reply gets ONE bounded stateless repair turn
2902
+ * carrying the malformed reply plus the contract — never the trajectory —
2903
+ * mirroring the typed-adapter repair the dspy arm gets, so both arms face
2904
+ * the same structured-output affordance.
2905
+ * 4. Cited span ids are resolved against the artifact; rows citing unknown
2906
+ * or ambiguous ids are rejected with a recorded reason, never guessed.
2907
+ * Zero findings from a well-formed reply is an honest null, not an error.
2908
+ *
2909
+ * Oversized traces: when the rendered projection exceeds the inline budget it
2910
+ * is re-rendered with a per-attribute character cap (the prompt-side analog of
2911
+ * the trace store's per-attribute byte cap); if still oversized the run fails
2912
+ * loud — inline delivery is the only delivery, so silently dropping spans
2913
+ * would understate the trajectory. The delivery decision is recorded in the
2914
+ * result output.
2915
+ *
2916
+ * Usage (bridge-reported token counts and call count) is recorded in the
2917
+ * result output; cost stays uncaptured because the bridge reports no priced
2918
+ * cost and this adapter carries no pricing table.
2919
+ */
2920
+
2921
+ interface PrimeTransportRequest {
2922
+ url: string;
2923
+ body: {
2924
+ model: string;
2925
+ messages: Array<{
2926
+ role: 'user';
2927
+ content: string;
2928
+ }>;
2929
+ };
2930
+ /** Aborts on the analyzer's deadline AND the caller's signal. */
2931
+ signal: AbortSignal;
2932
+ }
2933
+ interface PrimeTransportResponse {
2934
+ status: number;
2935
+ text: string;
2936
+ }
2937
+ /** POSTs one JSON chat completion; injectable so tests run on a fake bridge. */
2938
+ type PrimeTransport = (req: PrimeTransportRequest) => Promise<PrimeTransportResponse>;
2939
+ interface PrimeAnalyzerOptions {
2940
+ /** Bridge ROOT url; the adapter calls `<root>/v1/chat/completions`.
2941
+ * Default: TRACES_PRIME_BRIDGE_URL, then http://localhost:4181. */
2942
+ bridgeUrl?: string;
2943
+ /** Model id the bridge routes on. Default: TRACES_PRIME_MODEL, then prime/zai/glm-5.2. */
2944
+ model?: string;
2945
+ /** Per-call deadline. Default: TRACES_PRIME_TIMEOUT_MS, then 1200000 (20 min —
2946
+ * prime runs legitimately exceed 5 minutes). */
2947
+ timeoutMs?: number;
2948
+ /** Question asked when the caller passes no prompt. */
2949
+ defaultPrompt?: string;
2950
+ /** Rendered-projection budget before the per-attribute cap kicks in. */
2951
+ maxInlineChars?: number;
2952
+ /** Character cap applied to each attribute on the oversized re-render. */
2953
+ perAttributeCharCap?: number;
2954
+ /** Disable the bounded repair turn (one extra call on a malformed reply). */
2955
+ repair?: boolean;
2956
+ transport?: PrimeTransport;
2957
+ }
2958
+ /** Default transport: plain node:http/https, NOT fetch — undici's fixed 300s
2959
+ * headers timeout kills prime calls that legitimately run longer; the
2960
+ * analyzer's AbortSignal is the only deadline. */
2961
+ declare const httpJsonTransport: PrimeTransport;
2962
+ /** One-shot prime-RLM analysis over the emitted OTLP artifact, as a peer of
2963
+ * `haloAnalyzer` / `hodoscopeAnalyzer` on the `--analyzer` registry. Requires
2964
+ * a running OpenAI-compatible bridge with the prime backend; deterministic
2965
+ * analysis and every other engine are unaffected when it is down (`ok:false`
2966
+ * result, never a thrown run). */
2967
+ declare function primeAnalyzer(opts?: PrimeAnalyzerOptions): ExternalAnalyzer;
2968
+
2519
2969
  /**
2520
2970
  * Live trace observer — compatibility wrapper behind `traces watch`.
2521
2971
  *
@@ -3466,10 +3916,33 @@ interface FixPromptInput {
3466
3916
  /** Steps of context on each side of k (default 3). */
3467
3917
  readonly contextRadius?: number;
3468
3918
  }
3919
+ /** Head+tail excerpt with an elision marker; identity below the limit. */
3920
+ declare function clipText(text: string, limit: number): string;
3469
3921
  declare function buildFixPrompt(input: FixPromptInput): {
3470
3922
  system: string;
3471
3923
  user: string;
3472
3924
  };
3925
+ /** One prior attempt of the fix loop, rendered into the retry prompt. */
3926
+ interface FailedFixAttempt {
3927
+ readonly attempt: number;
3928
+ /** Null when the model call itself failed before producing a command. */
3929
+ readonly command: string | null;
3930
+ readonly exitCode: number | null;
3931
+ readonly stdoutTail: string | null;
3932
+ readonly stderrTail: string | null;
3933
+ readonly llmError: string | null;
3934
+ }
3935
+ /**
3936
+ * Retry prompt for fix-loop attempts ≥2: the original context plus every prior
3937
+ * attempt with its REAL executed output, and permission to answer with a short
3938
+ * script (the block still executes as one /bin/sh unit).
3939
+ */
3940
+ declare function buildRetryFixPrompt(input: FixPromptInput, priorAttempts: readonly FailedFixAttempt[], maxScriptCommands?: number): {
3941
+ system: string;
3942
+ user: string;
3943
+ };
3944
+ /** Non-empty, non-comment lines of a fix script — the loop's script-size cap. */
3945
+ declare function countScriptCommands(script: string): number;
3473
3946
  /** Last fenced code block, else the whole trimmed content; null when empty. */
3474
3947
  declare function extractFixCommand(content: string): string | null;
3475
3948
  type FixGenerationOutcome = {
@@ -3484,6 +3957,75 @@ type FixGenerationOutcome = {
3484
3957
  };
3485
3958
  declare function generateFixCommand(caller: ChatCompletionCaller, input: FixPromptInput): Promise<FixGenerationOutcome>;
3486
3959
 
3960
+ /**
3961
+ * Iterative counterfactual fix loop.
3962
+ *
3963
+ * Attempt 1 is exactly the one-shot generator (same prompt, same caller), so
3964
+ * flip@1 stays comparable to `--fix generate`. When an attempt does not flip
3965
+ * the failure — nonzero exit, signature still present, or the model call
3966
+ * itself failed — the next attempt's prompt carries every prior command and
3967
+ * its REAL executed stdout/stderr, up to a fixed attempt budget.
3968
+ *
3969
+ * Isolation invariant: every attempt executes through the injected executor,
3970
+ * which must provide a FRESH sandbox with the same replayed prefix. A used
3971
+ * sandbox is never mutated mid-arm; a flip therefore always proves the
3972
+ * corrected step against the recorded prefix state, not against debris from
3973
+ * an earlier attempt.
3974
+ */
3975
+
3976
+ /** Result of executing one corrected command as a full arm. */
3977
+ interface FixArmExecution {
3978
+ readonly exitCode: number;
3979
+ readonly prefixExecuted: number;
3980
+ readonly prefixDivergences: number;
3981
+ readonly failureVanished: boolean;
3982
+ readonly stdout: string;
3983
+ readonly stderr: string;
3984
+ }
3985
+ /** Runs one corrected command as a full arm: fresh sandbox + prefix replay. */
3986
+ type FixArmExecutor = (command: string, attempt: number) => Promise<FixArmExecution>;
3987
+ interface FixLoopOptions {
3988
+ /** Total LLM attempts per case (≥1); 1 degenerates to the one-shot path. */
3989
+ readonly maxAttempts: number;
3990
+ /** Command-line cap on retry scripts (default 5). */
3991
+ readonly maxScriptCommands?: number;
3992
+ /** Chars kept per stdout/stderr tail in records and retry prompts. */
3993
+ readonly outputTailChars?: number;
3994
+ readonly onProgress?: (message: string) => void;
3995
+ }
3996
+ interface FixLoopAttemptRecord {
3997
+ readonly attempt: number;
3998
+ readonly command: string | null;
3999
+ readonly llmError: string | null;
4000
+ readonly usage: {
4001
+ readonly promptTokens: number;
4002
+ readonly completionTokens: number;
4003
+ } | null;
4004
+ readonly executed: boolean;
4005
+ readonly exitCode: number | null;
4006
+ readonly prefixExecuted: number | null;
4007
+ readonly prefixDivergences: number | null;
4008
+ readonly failureVanished: boolean | null;
4009
+ readonly stdoutTail: string | null;
4010
+ readonly stderrTail: string | null;
4011
+ readonly armBError: string | null;
4012
+ readonly wallMs: number;
4013
+ }
4014
+ interface FixLoopResult {
4015
+ readonly flipped: boolean;
4016
+ readonly flippedAtAttempt: number | null;
4017
+ readonly attempts: readonly FixLoopAttemptRecord[];
4018
+ /** True when a sandbox error ended the loop before the attempt budget. */
4019
+ readonly aborted: boolean;
4020
+ readonly llmCalls: number;
4021
+ /** Calls that produced no runnable fix: transport errors, empty replies,
4022
+ * and retry scripts over the command cap. */
4023
+ readonly llmFailures: number;
4024
+ readonly promptTokens: number;
4025
+ readonly completionTokens: number;
4026
+ }
4027
+ declare function runFixLoop(caller: ChatCompletionCaller, input: FixPromptInput, executor: FixArmExecutor, options: FixLoopOptions): Promise<FixLoopResult>;
4028
+
3487
4029
  /**
3488
4030
  * Batch replay-verification across gold-labeled CodeTraceBench corpora.
3489
4031
  *
@@ -3538,8 +4080,12 @@ interface ReplayBatchOptions {
3538
4080
  readonly out: string;
3539
4081
  readonly baseUrl?: string;
3540
4082
  readonly apiKey?: string;
3541
- /** 'generate' runs one LLM call per arm-A-reproduced case, then arm B. */
3542
- readonly fix: 'none' | 'generate';
4083
+ /** 'generate' = one LLM call per arm-A-reproduced case, then arm B.
4084
+ * 'loop' = iterative: failed arms feed their real output into up to
4085
+ * --fix-attempts prompts, each executed in its own fresh sandbox. */
4086
+ readonly fix: 'none' | 'generate' | 'loop';
4087
+ /** Attempt budget per case in loop mode (default 3). */
4088
+ readonly fixAttempts?: number;
3543
4089
  readonly fixCaller?: ChatCompletionCaller;
3544
4090
  readonly fixModelLabel?: string;
3545
4091
  /** Cap on LLM fix calls; eligible cases beyond it are seeded-sampled out. */
@@ -3564,12 +4110,19 @@ interface ReplayBatchFixResult {
3564
4110
  readonly sampledOut: boolean;
3565
4111
  readonly command: string | null;
3566
4112
  readonly llmError: string | null;
4113
+ /** Loop mode: token totals summed across every attempt (null when the
4114
+ * provider reported no usage). */
3567
4115
  readonly usage: ChatUsage | null;
3568
4116
  readonly armBExit: number | null;
3569
4117
  readonly armBPrefixExecuted: number | null;
3570
4118
  readonly armBPrefixDivergences: number | null;
3571
4119
  readonly failureVanished: boolean | null;
3572
4120
  readonly armBError: string | null;
4121
+ /** Loop mode only: the full per-attempt trail. Null in generate mode. */
4122
+ readonly attempts: readonly FixLoopAttemptRecord[] | null;
4123
+ /** 1-based attempt that flipped the failure; null when none did.
4124
+ * Generate mode: 1 when the single attempt flipped. */
4125
+ readonly flippedAtAttempt: number | null;
3573
4126
  }
3574
4127
  interface ReplayBatchCaseRow {
3575
4128
  readonly corpus: string;
@@ -3642,6 +4195,15 @@ interface ReplayBatchReport {
3642
4195
  denominator: number;
3643
4196
  value: number | null;
3644
4197
  } | null;
4198
+ /** Loop mode only: flips at attempt 1 over cases whose attempt 1 executed —
4199
+ * the number directly comparable to the one-shot fixFlipRate. */
4200
+ readonly fixFlipAttempt1: {
4201
+ numerator: number;
4202
+ denominator: number;
4203
+ value: number | null;
4204
+ } | null;
4205
+ /** Loop mode only: flip count keyed by the attempt number that flipped. */
4206
+ readonly flipsByAttempt: Record<string, number> | null;
3645
4207
  };
3646
4208
  readonly llm: {
3647
4209
  readonly model: string;
@@ -3670,7 +4232,8 @@ declare function renderBatchReport(report: ReplayBatchReport): string;
3670
4232
  interface ReplayBatchCliArgs {
3671
4233
  readonly corpora: CorpusSpec[];
3672
4234
  readonly out: string;
3673
- readonly fix: 'none' | 'generate';
4235
+ readonly fix: 'none' | 'generate' | 'loop';
4236
+ readonly fixAttempts: number;
3674
4237
  readonly fixModel: string;
3675
4238
  readonly fixBaseUrl: string;
3676
4239
  readonly fixApiKeyEnv: string;
@@ -3753,6 +4316,177 @@ interface ReplayFindingResult {
3753
4316
  */
3754
4317
  declare function replayVerifyFinding(finding: AnalystReplayFinding, options: ReplayFindingOptions): Promise<ReplayFindingResult>;
3755
4318
 
4319
+ /**
4320
+ * Proof-carrying findings: execute analyst findings as sandbox replays.
4321
+ *
4322
+ * An analyst finding is a cited claim ("step 12 is where the run went
4323
+ * wrong"). This module turns each finding into an executed verdict by
4324
+ * replaying the trajectory prefix in a real sandbox and running the accused
4325
+ * step (arm A), optionally followed by a corrected step (arm B):
4326
+ *
4327
+ * `reproduced` arm A re-produced the recorded failure signature
4328
+ * (returncode + stable output substring).
4329
+ * `fix-flipped` arm A reproduced AND arm B's corrected command made the
4330
+ * failure vanish — the strongest per-finding proof.
4331
+ * `divergent` arm A executed but the recorded failure did NOT
4332
+ * reproduce; evidence against the finding (or against
4333
+ * replay fidelity — the receipt carries prefix
4334
+ * divergences so the reader can tell which).
4335
+ * `not-replayable` the finding could not be executed at all; the receipt
4336
+ * carries the precise reason (no step subject, unknown
4337
+ * trajectory, no docker image, submit step, …).
4338
+ *
4339
+ * Verification is execution, not generation: no LLM is involved unless the
4340
+ * caller supplies a corrected command for arm B. Sandbox infrastructure being
4341
+ * absent while a finding needs execution is an error, never a silent skip.
4342
+ *
4343
+ * Findings are matched by the shape the analyst product emits
4344
+ * (agent-eval `AnalystFinding`): `subject` (`incorrect-step-<n>` or the wire's
4345
+ * `incorrect-steps-<f>-<l>-<escaped|unescaped>-consequence-<c>`),
4346
+ * `metadata.block_first_step`, and `trace://<traj>/…` evidence refs.
4347
+ */
4348
+
4349
+ interface VerifiableFinding {
4350
+ readonly finding_id?: string;
4351
+ readonly analyst_id?: string;
4352
+ readonly subject?: string;
4353
+ readonly area?: string;
4354
+ readonly claim?: string;
4355
+ readonly evidence_refs?: readonly {
4356
+ readonly kind?: string;
4357
+ readonly uri?: string;
4358
+ readonly excerpt?: string;
4359
+ }[];
4360
+ readonly metadata?: Readonly<Record<string, unknown>>;
4361
+ }
4362
+ /**
4363
+ * 1-based step the finding accuses, or null when the finding names none.
4364
+ * `metadata.block_first_step` wins over the subject: the analyst records the
4365
+ * block's first incorrect step there even when the subject names a later
4366
+ * step of the same block.
4367
+ */
4368
+ declare function findingReplayStep(finding: VerifiableFinding): number | null;
4369
+ /** Trajectory id from the finding's `trace://<traj>/…` evidence refs, or null. */
4370
+ declare function findingTrajectoryId(finding: VerifiableFinding): string | null;
4371
+ /**
4372
+ * Where the executable trajectory lives.
4373
+ * `direct` — one trajectory's steps.json plus a replay-ready image (the
4374
+ * caller owns image preparation, exactly like `traces replay-verify`).
4375
+ * `corpus` — CodeTraceBench corpora; each finding's trajectory is resolved
4376
+ * by its `trace://` evidence and the image is derived through the batch
4377
+ * preparer (uid-1000 chown) unless a test backend is injected.
4378
+ */
4379
+ type FindingReplaySource = {
4380
+ readonly kind: 'direct';
4381
+ readonly stepsPath: string;
4382
+ readonly image: string;
4383
+ readonly cwd: string;
4384
+ readonly caseId?: string;
4385
+ } | {
4386
+ readonly kind: 'corpus';
4387
+ readonly corpora: readonly CorpusSpec[];
4388
+ readonly preparer?: ImagePreparer;
4389
+ };
4390
+ interface ResolvedFindingReplay {
4391
+ readonly caseId: string;
4392
+ readonly stepsPath: string;
4393
+ /** Raw image; corpus-mode execution derives the uid-1000 replay image from it. */
4394
+ readonly image: string;
4395
+ readonly cwd: string;
4396
+ /** 1-based step_id arm A executes. */
4397
+ readonly at: number;
4398
+ readonly recordedReturncode: number;
4399
+ readonly recordedStepTimeoutMs: number | null;
4400
+ }
4401
+ type FindingReplayability = {
4402
+ readonly replayable: true;
4403
+ readonly resolved: ResolvedFindingReplay;
4404
+ } | {
4405
+ readonly replayable: false;
4406
+ readonly reason: string;
4407
+ };
4408
+ /**
4409
+ * Decides whether one finding can be executed against the source, and with
4410
+ * what invocation. Never throws for a finding-shaped problem — every dead end
4411
+ * becomes a `not-replayable` reason the receipt can carry verbatim.
4412
+ */
4413
+ declare function resolveFindingReplayability(finding: VerifiableFinding, source: FindingReplaySource): FindingReplayability;
4414
+ type FindingVerificationStatus = 'reproduced' | 'fix-flipped' | 'not-replayable' | 'divergent';
4415
+ interface FindingVerification {
4416
+ readonly finding_id: string | null;
4417
+ readonly subject: string | null;
4418
+ readonly trajectory_id: string | null;
4419
+ /** 1-based step the proof executed at; null when not replayable. */
4420
+ readonly step: number | null;
4421
+ readonly verified: FindingVerificationStatus;
4422
+ /** Present exactly when `verified` is `not-replayable`. */
4423
+ readonly reason: string | null;
4424
+ /** Receipt directory: receipt.json plus, when executed, replay-verdict.json + report.md. */
4425
+ readonly receipt: string;
4426
+ readonly verdict_path: string | null;
4427
+ /** Receipt dir of the executed proof this finding shares (same case, step, and fix). */
4428
+ readonly deduplicated_with: string | null;
4429
+ }
4430
+ interface VerifyFindingsRun {
4431
+ readonly out: string;
4432
+ readonly verifications: readonly FindingVerification[];
4433
+ readonly counts: Readonly<Record<FindingVerificationStatus, number>>;
4434
+ /** Sandbox executions actually performed (deduplicated proofs count once). */
4435
+ readonly executions: number;
4436
+ }
4437
+ interface VerifyFindingsOptions {
4438
+ readonly source: FindingReplaySource;
4439
+ /** Receipt root; one subdirectory per finding plus verifications.json. */
4440
+ readonly out: string;
4441
+ /** Corrected command for arm B on every executed finding; omit for arm A only. */
4442
+ readonly fixCommand?: string;
4443
+ readonly stepTimeoutMs?: number;
4444
+ readonly prefixLimit?: number;
4445
+ /** Injectable for tests; when set, no sandbox reachability check and no image preparation run. */
4446
+ readonly backend?: ReplayExecBackend;
4447
+ readonly apiKey?: string;
4448
+ readonly baseUrl?: string;
4449
+ readonly maxLifetimeSeconds?: number;
4450
+ readonly onProgress?: (message: string) => void;
4451
+ }
4452
+ /** Arm A reproduced → the fix flipping it beats plain reproduction; anything else diverged. */
4453
+ declare function classifyVerdict(verdict: ReplayVerdict): FindingVerificationStatus;
4454
+ declare const DEFAULT_SANDBOX_BASE_URL = "http://127.0.0.1:4097";
4455
+ /**
4456
+ * Fails loud when the sandbox SDK adapter is not answering. Executed findings
4457
+ * require real infrastructure; verification is never silently skipped.
4458
+ */
4459
+ declare function assertSandboxReachable(baseUrl: string): Promise<void>;
4460
+ /**
4461
+ * Verifies every finding against the source: resolves replayability, executes
4462
+ * one sandbox proof per distinct (case, step, fix) — findings accusing the
4463
+ * same step share the executed proof — and writes a receipt directory per
4464
+ * finding plus a run-level verifications.json.
4465
+ */
4466
+ declare function verifyFindings(findings: readonly VerifiableFinding[], options: VerifyFindingsOptions): Promise<VerifyFindingsRun>;
4467
+ /** Markdown section the analyze report appends when --verify-findings ran. */
4468
+ declare function renderVerifiedFindingsSection(run: VerifyFindingsRun): string;
4469
+ /**
4470
+ * Accepts the two shapes findings travel in: a bare JSON array of analyst
4471
+ * findings, or an object with a `findings` array (e.g. an extracted
4472
+ * `observations[n]` from an agent-eval result.json).
4473
+ */
4474
+ declare function readFindingsFile(path: string): VerifiableFinding[];
4475
+ interface VerifyFindingsCliArgs {
4476
+ findingsPath: string;
4477
+ source: FindingReplaySource;
4478
+ out: string;
4479
+ fixCommand?: string;
4480
+ stepTimeoutMs?: number;
4481
+ prefixLimit?: number;
4482
+ baseUrl: string;
4483
+ apiKeyEnv: string;
4484
+ maxLifetimeSeconds?: number;
4485
+ }
4486
+ declare function verifyFindingsUsage(): string;
4487
+ declare function parseVerifyFindingsArgs(argv: readonly string[]): VerifyFindingsCliArgs | 'help';
4488
+ declare function cmdVerifyFindings(argv: readonly string[]): Promise<void>;
4489
+
3756
4490
  /**
3757
4491
  * Local upload-dedup state.
3758
4492
  *
@@ -3855,4 +4589,4 @@ interface ExecuteOptions {
3855
4589
  /** Send the final, new outbound items (or write their dry-run OTLP). */
3856
4590
  declare function executeUpload(plan: UploadPlan, opts?: ExecuteOptions): Promise<UploadResult>;
3857
4591
 
3858
- export { ACTOR_ATTR, ATTR, type Actor, type AdoptionOptions, type AdoptionReport, AmpAdapter, type AnalystReplayFinding, type AnalyzeOptions, type AnalyzeResult, type ArmExecutionResult, 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, type DockerImagePreparerOptions, EMPTY_SPAN_RUN_SNAPSHOT, EXPORT_RULE, EmptySessionError, type EnumerationResult, type ExcludedCase, type ExecuteOptions, type ExportRule, type ExternalAnalysisKind, type ExternalAnalysisPayload, type ExternalAnalysisResult, type ExternalAnalyzer, type ExternalAnalyzerOptions, type ExternalDiscoveryCandidate, FactoryAdapter, type FileRunContextReaderOptions, type FixGenerationOutcome, type FixPromptInput, ForgeAdapter, GeminiAdapter, type HaloAnalyzerOptions, type HaloReasoningEffort, type HarnessTraceAdapter, type HodoscopeAnalyzerOptions, type HodoscopeInput, type HodoscopeMessage, type HodoscopeSourceMapEntry, type HodoscopeTrajectory, INGEST_SOURCE_CLI, type ImagePreparation, type ImagePreparer, type IncorrectStepsSubject, type IngestedTrajectory, type InspectSessionIndexOptions, JsonSourceError, type JsonlCorruptionReceipt, JsonlParseError, type JsonlReadOptions, type LiveBatchOptions, type LocateOptions, type LoopConvergence, type LoopConvergenceReport, type LoopIteration, type LoopTrend, type LoopTrendBasis, type ObservedLoop, type ObserverOptions, OpencodeAdapter, type OtlpIngestIssue, type OtlpIngestIssueKind, type OtlpInput, type OtlpInputFile, type OtlpRowConversion, type OtlpSpan, type OtlpSpanKind, type OtlpSpanLink, type OtlpStatusCode, type ParentTaskResolution, type ParseOptions, PartialUploadError, PiAdapter, type PiAdapterOptions, type PipelineOptions, type PipelineReport, type PlanOptions, type PolicyEvidenceLoopSummary, type PolicyEvidenceRecord, type PolicyEvidenceToolSummary, type PrefixDivergence, type PrefixReplayResult, 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 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 SessionCorruptionReceipt, type SessionIdentityConflict, type SessionIdentityIndex, type SessionIntegrity, type SessionRef, type SessionRelationship, type SessionRole, type SessionSeedGroup, type SessionSelection, type SessionSelectionRow, type SessionSourceFile, 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 WatchRunTargetOptions, ZERO_ROLL, type ZaiChatCallerOptions, addSpend, alreadyUploaded, analyzeAdoption, analyzeLiveBatch, analyzeLoopConvergence, analyzeReactions, analyzeSpans, analyzeSteeringChain, applyRedactor, buildFixPrompt, buildPolicyEvidenceRecord, buildSessionIndex, buildSessionIndexFromRows, buildSpanRunTree, buildTraceFindingPacket, capText, chatTrajectoryToSpans, classifyLiveActions, classifyReaction, claudeActor, cmdReplayVerify, cmdReplayVerifyBatch, codexActor, collectPolicyEvidence, collectSessionIndex, collectSessionSelection, collectSessionWorkflow, collectSessions, commandAnalyzer, commandRedactor, conformanceOfSpans, connectors, countSkillRunsJsonl, cwdMatchesSelection, defaultTraceLiveAnalysts, deriveFailureSignature, derivedImageTag, describeSessionRelationship, dockerImagePreparer, enumerateReplayableCases, equivalentGitCwds, executeUpload, exportTraceEvidenceFile, exportTraceEvidenceRows, exportTraceEvidenceText, extractFixCommand, fileRunContextSupervisorRunReader, findSpanSourceFiles, forEachTreeNode, generateFixCommand, goldIncorrectSteps, haloAnalyzer, hodoscopeAnalyzer, importCodeTraceBench, incompleteInputsNote, indexSessionIdsByTrace, inferRole, inferSpanKind, ingestCodeTraceBenchSteps, inspectSessionIndex, int, isChatTrajectory, isChatTrajectoryMessage, isFileRunContextDir, isSubmitAction, knownHarnesses, listAdapters, loadState, loadTracesConfig, locateSessions, looksLikeAgentPrompt, mergeRolls, mergeTracesConfig, ms, normalizeRemote, otlpRowToSpan, outboundHash, parseCorpusFlag, parseIncorrectStepsSubject, parseIsoToEpochMs, parseObservationOutput, parseRecordedReturncode, parseReplayBatchArgs, parseReplayVerifyArgs, parseSession, parseSince, planTraceAgenticRoute, planUpload, readCoordinationLog, readFileRunContext, readJsonFile, readJsonl, readLabelEntries, readOtlpInput, readRunContextJournal, readRunContextSnapshot, readRunWatchSnapshot, readSessionIndexFile, readSpanRunSnapshot, recordSessionCorruption, redactSpans, renderBatchReport, renderConformance, renderInspectionReport, renderRunContextSnapshot, renderRunWatchSnapshot, renderSpanRunSnapshot, renderValidation, replayBatchUsage, replayVerify, replayVerifyFinding, replayVerifyUsage, resolveAdapter, resolveCaseResources, resolveFindingInvocation, resolveOtlpInputFiles, resolveRepoAttrs, resolveRunContextDir, resolveRunWatchTarget, resolveSessionRepoAttrs, runCommand, runExternalAnalyzers, runPipelines, runReplayBatch, runTotals, runTraceImprovement, runTraceInvestigation, runTraceStoreInvestigation, sandboxReplayBackend, saveReport, saveState, scanSessions, seededSample, selectAdapters, serializeInspectionReport, serializePolicyEvidence, serializeSessionIndex, serializeSpans, serializeTraceStreamEvent, sessionHash, sessionIdFromAttributes, sessionIntegrityAttributes, skippedAnalyses, span, spanRunTotals, stampRepoAttrs, stampSessionIdentity, stampSessionIntegrity, stampSpanWorkdirRepoAttrs, streamSessions, summarizeOtlpExecution, summarizeSpanExecution, summarizeSpanStructure, takeJsonl, textIsSynthetic, toOpenInferenceSpan, toRuntimeStore, toTraceSpanEvents, tokens, totalAgenticFailureMessage, traceAgenticKinds, traceStreamEventsFromSpans, unavailableCapabilities, uploadKey, usd, userPromptSpan, validateOtlpSpans, validationExitCode, watchRunTarget, watchSessions, wrap, wrapActionForExec, writeHodoscopeInput, writeInspectionReportFile, writeOtlpFile, writePolicyEvidenceFile, writeSessionIndexFile, writeTraceEvidenceExportFile, writeTraceImprovementArtifacts, zaiChatCaller, zeroPricedCost };
4592
+ export { ACTOR_ATTR, ATTR, type Actor, type AdoptionOptions, type AdoptionReport, AmpAdapter, type AnalystReplayFinding, type AnalyzeOptions, type AnalyzeResult, type ArmExecutionResult, type AssembleSessionBundleOptions, BLOBS_DIR, type BuildPolicyEvidenceOptions, type BuildSessionIndexOptions, type BuildTraceFindingPacketOptions, CODING_REDACTION_RULES, CONTENT_CAP, COORDINATION_LOG_FILE, CORRECTIVE_REACTIONS, type CaseResources, type ChatCompletionCaller, type ChatOutcome, type ChatTrajectory, type ChatTrajectoryMessage, type ChatTrajectoryOptions, type ChatUsage, ClaudeAdapter, type CodeTraceBenchFileRef, type CodeTraceBenchImportOptions, type CodeTraceBenchImportReceipt, type CodeTraceBenchImportResult, type CodeTraceBenchImportedTrace, type CodeTraceBenchStep, CodexAdapter, CodexExecAdapter, CodexExecStreamError, CodexTaskScopeError, type CollectOptions, type CollectPolicyEvidenceOptions, type CollectSessionIndexOptions, type CollectSessionSelectionOptions, type CollectSessionWorkflowOptions, type ConformanceRenderOptions, type CoordinationLog, type CoordinationQuestion, type CoordinationSteer, CopilotAdapter, type CorpusSpec, type CorruptionMode, type CwdSource, DEFAULT_HARNESS, DEFAULT_SANDBOX_BASE_URL, type DockerImagePreparerOptions, EMPTY_SPAN_RUN_SNAPSHOT, EXPORT_RULE, EmptySessionError, type EnumerationResult, type EvidenceOnlyVerdict, type ExcludedCase, type ExecuteOptions, type ExportRule, type ExternalAnalysisKind, type ExternalAnalysisPayload, type ExternalAnalysisResult, type ExternalAnalyzer, type ExternalAnalyzerOptions, type ExternalDiscoveryCandidate, FactoryAdapter, type FailedFixAttempt, type FileRunContextReaderOptions, type FindSessionTextLeaksOptions, type FindingReplaySource, type FindingReplayability, type FindingVerification, type FindingVerificationStatus, type FixArmExecution, type FixArmExecutor, type FixGenerationOutcome, type FixLoopAttemptRecord, type FixLoopOptions, type FixLoopResult, type FixPromptInput, ForgeAdapter, GeminiAdapter, type HaloAnalyzerOptions, type HaloReasoningEffort, type HarnessTraceAdapter, type HodoscopeAnalyzerOptions, type HodoscopeInput, type HodoscopeMessage, type HodoscopeSourceMapEntry, type HodoscopeTrajectory, INGEST_SOURCE_CLI, type ImagePreparation, type ImagePreparer, type IncorrectStepsSubject, type IngestedTrajectory, type InspectSessionIndexOptions, JsonSourceError, type JsonlCorruptionReceipt, JsonlParseError, type JsonlReadOptions, type LiveBatchOptions, type LocateOptions, type LoopConvergence, type LoopConvergenceReport, type LoopIteration, type LoopTrend, type LoopTrendBasis, type ObservedLoop, type ObserverOptions, OpencodeAdapter, type OtlpIngestIssue, type OtlpIngestIssueKind, type OtlpInput, type OtlpInputFile, type OtlpRowConversion, type OtlpSpan, type OtlpSpanKind, type OtlpSpanLink, type OtlpStatusCode, POLICY_EVIDENCE_NOTE, type ParentTaskResolution, type ParseOptions, PartialUploadError, PiAdapter, type PiAdapterOptions, type PipelineOptions, type PipelineReport, type PlanOptions, type PolicyEvidenceLoopSummary, type PolicyEvidenceRecord, type PolicyEvidenceToolSummary, type PrefixDivergence, type PrefixReplayResult, type PrimeAnalyzerOptions, type PrimeTransport, type PrimeTransportRequest, type PrimeTransportResponse, type ProjectSessionBundleOptions, type ProjectSessionBundleResult, QwenAdapter, REACTIONS, RESULT_FILE, RULE, type Reaction, type ReactionReport, type ReactionSessionReport, type Redactor, type ReplayArmVerdict, type ReplayBatchCaseRow, type ReplayBatchCliArgs, type ReplayBatchFixResult, type ReplayBatchOptions, type ReplayBatchReport, type ReplayExclusionReason, type ReplayExecBackend, type ReplayExecResult, type ReplayExecSession, type ReplayFindingOptions, type ReplayFindingResult, type ReplayVerdict, type ReplayVerifyCliArgs, type ReplayVerifyOptions, type ReplayableCase, type RepoAttrs, type RepoResolution, type RepoResolutionSource, type ResolvedFindingReplay, type ResolvedOtlpInput, type ResolvedReplayInvocation, type ResourceResolution, type RunContextJournal, type RunContextNode, type RunContextResult, type RunContextSnapshot, type RunResult, type RunWatchSnapshot, type RunWatchTarget, type RuntimeTrace, SPAWN_JOURNAL_FILE, STATUS_MARK, SUBMIT_ACTION_SIGNATURE, SandboxCounterfactualRunner, type SandboxCounterfactualRunnerOptions, type SandboxReplayBackendOptions, type ScanOptions, type ScannedSession, type SessionBatch, type SessionBundleAbsence, type SessionBundleCarriedSignatures, type SessionBundleExclusion, type SessionBundleExclusionRule, type SessionBundleFile, type SessionBundleLeakCheck, type SessionBundleLedgerSlice, type SessionBundleManifest, type SessionBundleProjection, type SessionBundleResult, type SessionBundleSliceRule, type SessionBundleView, type SessionCorruptionReceipt, type SessionEnvironment, type SessionIdentityConflict, type SessionIdentityIndex, type SessionIntegrity, type SessionRef, type SessionRelationship, type SessionRole, type SessionSeedGroup, type SessionSelection, type SessionSelectionRow, type SessionSourceFile, type SessionTextLeak, type SessionTextLeakReport, type SessionWorkflow, SessionWorkflowError, type SessionWorkflowErrorCode, type SessionWorkflowIssue, type SessionWorkflowSession, type SessionWorkflowSummary, type SkippedAnalysis, type SkippedInputFile, type SpanInput, type SpanNodeStatus, type SpanRedaction, type SpanRunNode, type SpanRunSnapshot, type SpanStructure, type SpendRoll, type SteeringChainReport, type SteeringEdge, TRACES_REDACTION_RULES, type TraceAgenticRoute, type TraceAgenticRouteReason, type TraceAgenticRouteReasonCode, type TraceContextIndex, type TraceContextRoot, type TraceEvidenceExportOptions, type TraceEvidenceExportResult, type TraceEvidenceFormatOption, type TraceEvidenceInputFormat, type TraceEvidenceRow, type TraceExecutionOptions, type TraceFindingPacket, type TraceImprovementArtifacts, type TraceImprovementOptions, type TraceImprovementResult, type TraceIndexedFile, type TraceInspectionArea, type TraceInspectionFinding, type TraceInspectionReport, type TraceInspectionSeverity, type TraceInvestigationOptions, type TraceInvestigationResult, type TraceLiveAction, type TraceLiveActionKind, type TraceLiveAnalysisContext, type TraceLiveAnalyst, type TraceLiveBatch, type TraceLiveEvidence, type TraceLiveFinding, type TraceLiveLoop, type TraceLiveSeverity, type TraceSessionIndex, type TraceSessionIndexRow, type TraceStoreInvestigationOptions, type TraceStoreInvestigationResult, type TraceStreamEvent, type TraceStreamOptions, type TraceStreamReplayOptions, type TraceStreamSession, type TracesConfig, type TriggerPair, type UnavailableCapabilities, type UploadBackend, type UploadIdentity, type UploadItem, type UploadPlan, type UploadRecord, type UploadResult, type UploadState, type UserPromptInput, type VerifiableFinding, type VerifyFindingsCliArgs, type VerifyFindingsOptions, type VerifyFindingsRun, type WatchRunTargetOptions, ZERO_ROLL, type ZaiChatCallerOptions, addSpend, alreadyUploaded, analyzeAdoption, analyzeLiveBatch, analyzeLoopConvergence, analyzeReactions, analyzeSpans, analyzeSteeringChain, applyRedactor, assembleSessionBundle, assertSandboxReachable, buildFixPrompt, buildPolicyEvidenceRecord, buildRetryFixPrompt, buildSessionIndex, buildSessionIndexFromRows, buildSpanRunTree, buildTraceFindingPacket, capText, chatTrajectoryToSpans, classifyEvidenceOnlyPath, classifyLiveActions, classifyReaction, classifyVerdict, claudeActor, clipText, cmdReplayVerify, cmdReplayVerifyBatch, cmdVerifyFindings, codexActor, collectPolicyEvidence, collectSessionIndex, collectSessionSelection, collectSessionWorkflow, collectSessions, commandAnalyzer, commandRedactor, conformanceOfSpans, connectors, countScriptCommands, countSkillRunsJsonl, cwdMatchesSelection, defaultTraceLiveAnalysts, deriveFailureSignature, derivedImageTag, describeSessionRelationship, dockerImagePreparer, enumerateReplayableCases, environmentAttributes, environmentFromSpanAttributes, equivalentGitCwds, executeUpload, exportTraceEvidenceFile, exportTraceEvidenceRows, exportTraceEvidenceText, extractFixCommand, fileRunContextSupervisorRunReader, findContextRoot, findSessionTextLeaks, findSpanSourceFiles, findingReplayStep, findingTrajectoryId, forEachTreeNode, generateFixCommand, goldIncorrectSteps, haloAnalyzer, hashSessionBundleFiles, hodoscopeAnalyzer, httpJsonTransport, importCodeTraceBench, incompleteInputsNote, indexSessionIdsByTrace, inferRole, inferSpanKind, ingestCodeTraceBenchSteps, inspectSessionIndex, int, isChatTrajectory, isChatTrajectoryMessage, isFileRunContextDir, isSubmitAction, knownHarnesses, listAdapters, listSessionBundleFiles, loadState, loadTracesConfig, locateSessions, looksLikeAgentPrompt, mergeRolls, mergeTracesConfig, ms, normalizeRemote, otlpRowToSpan, outboundHash, parseCorpusFlag, parseIncorrectStepsSubject, parseIsoToEpochMs, parseObservationOutput, parseRecordedReturncode, parseReplayBatchArgs, parseReplayVerifyArgs, parseSession, parseSince, parseVerifyFindingsArgs, planTraceAgenticRoute, planUpload, primeAnalyzer, projectSessionBundle, readCoordinationLog, readFileRunContext, readFindingsFile, readJsonFile, readJsonl, readLabelEntries, readOtlpInput, readRunContextJournal, readRunContextSnapshot, readRunWatchSnapshot, readSessionBundleManifest, readSessionIndexFile, readSpanRunSnapshot, recordSessionCorruption, redactSpans, renderBatchReport, renderConformance, renderInspectionReport, renderRunContextSnapshot, renderRunWatchSnapshot, renderSpanRunSnapshot, renderValidation, renderVerifiedFindingsSection, replayBatchUsage, replayVerify, replayVerifyFinding, replayVerifyUsage, resolveAdapter, resolveCaseResources, resolveFindingInvocation, resolveFindingReplayability, resolveOtlpInputFiles, resolveRepoAttrs, resolveRunContextDir, resolveRunWatchTarget, resolveSessionRepoAttrs, runCommand, runExternalAnalyzers, runFixLoop, runPipelines, runReplayBatch, runTotals, runTraceImprovement, runTraceInvestigation, runTraceStoreInvestigation, sandboxReplayBackend, saveReport, saveState, scanSessions, seededSample, selectAdapters, serializeInspectionReport, serializePolicyEvidence, serializeSessionIndex, serializeSpans, serializeTraceStreamEvent, sessionHash, sessionIdFromAttributes, sessionIntegrityAttributes, sessionTextSignatures, skippedAnalyses, span, spanRunTotals, stampEnvironmentAttrs, stampRepoAttrs, stampSessionIdentity, stampSessionIntegrity, stampSpanWorkdirRepoAttrs, streamSessions, summarizeOtlpExecution, summarizeSpanExecution, summarizeSpanStructure, takeJsonl, textIsSynthetic, toOpenInferenceSpan, toRuntimeStore, toTraceSpanEvents, tokens, totalAgenticFailureMessage, traceAgenticKinds, traceStreamEventsFromSpans, unavailableCapabilities, uploadKey, usd, userPromptSpan, validateOtlpSpans, validationExitCode, verifyFindings, verifyFindingsUsage, watchRunTarget, watchSessions, wrap, wrapActionForExec, writeHodoscopeInput, writeInspectionReportFile, writeOtlpFile, writePolicyEvidenceFile, writeSessionBundleManifest, writeSessionIndexFile, writeTraceEvidenceExportFile, writeTraceImprovementArtifacts, zaiChatCaller, zeroPricedCost };