@tangle-network/traces 0.16.4 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -31,6 +31,7 @@ import {
31
31
  indexSessionIdsByTrace,
32
32
  inspectSessionIndex,
33
33
  isBridgeMismatchError,
34
+ iterSerializedSpans,
34
35
  knownHarnesses,
35
36
  loadTraceQuestionsFile,
36
37
  loadTracesConfig,
@@ -61,7 +62,6 @@ import {
61
62
  selectAdapters,
62
63
  serializePolicyEvidence,
63
64
  serializeSessionIndex,
64
- serializeSpans,
65
65
  serializeTraceStreamEvent,
66
66
  sessionReportSource,
67
67
  streamSessions,
@@ -83,7 +83,7 @@ import {
83
83
  writeSessionIndexFile,
84
84
  writeTraceEvidenceExportFile,
85
85
  writeTraceQuestionsArtifacts
86
- } from "./chunk-SMT635QV.js";
86
+ } from "./chunk-4QY4U4XW.js";
87
87
 
88
88
  // src/cli.ts
89
89
  import { readFileSync } from "fs";
@@ -1194,7 +1194,7 @@ async function cmdFacts(args) {
1194
1194
  const collected = await collectSpans(args);
1195
1195
  if (collected.spans.length === 0) throw new Error("no spans found for the given selection");
1196
1196
  warnIncompleteWorkflow(collected.workflow);
1197
- const report = buildSessionFactsReport(collected.spans, { harness: collected.harness });
1197
+ const report = buildSessionFactsReport(collected.spans, { harness: collected.harness, includeContent: !args.noContent });
1198
1198
  const unread = report.sessions.filter((facts) => facts.recordSpans === 0);
1199
1199
  if (unread.length > 0) {
1200
1200
  throw new Error(
@@ -1234,7 +1234,7 @@ async function cmdExport(args) {
1234
1234
  return;
1235
1235
  }
1236
1236
  const result = await exportTraceEvidenceFile(args.input, { format, attributes });
1237
- process.stdout.write(serializeSpans(result.spans));
1237
+ for (const line of iterSerializedSpans(result.spans)) process.stdout.write(line);
1238
1238
  }
1239
1239
  async function cmdImportCodeTraceBench(args) {
1240
1240
  if (!args.input) {
@@ -2110,7 +2110,8 @@ Options:
2110
2110
  --window <m> watch/stream: only sessions active in the last N minutes (default 30)
2111
2111
  --min-loop <n> Min identical repeated calls to flag a loop (default 3)
2112
2112
  --dry-run upload: redact + dedup + preview, write OTLP, but do NOT send
2113
- --no-content upload: strip prompt/response text; send metadata only
2113
+ --no-content facts: omit conversation, commands, paths and assignments;
2114
+ upload: strip prompt/response text; send metadata only
2114
2115
  --redactor <cmd> upload: external PII scrubber (JSON array stdin\u2192stdout) after the redaction core
2115
2116
  --yes, -y upload: skip the confirmation prompt
2116
2117
  --version, -v Print the installed traces version
package/dist/index.d.ts CHANGED
@@ -355,9 +355,18 @@ declare const EXPORT_RULE: Readonly<Record<SubstitutedField, ExportRule>>;
355
355
  declare function toOpenInferenceSpan(s: OtlpSpan): Record<string, unknown>;
356
356
  /** Serialize spans to OpenInference JSONL (one complete span per line). This is a
357
357
  * standard OpenInference representation: it feeds our analysts, HALO, and other
358
- * OpenInference tools directly — no per-tool conversion. */
358
+ * OpenInference tools directly — no per-tool conversion.
359
+ *
360
+ * The returned string is the WHOLE export; for span counts whose export can
361
+ * approach V8's maximum string length, iterate {@link iterSerializedSpans}
362
+ * instead so the export never has to exist as one allocation. */
359
363
  declare function serializeSpans(spans: readonly OtlpSpan[]): string;
360
- /** Write spans to an OTLP-JSONL file (a temp file when no path is given). */
364
+ /** Yield the export one span line at a time (each line ends in `\n`), so a
365
+ * writer stays bounded no matter how many spans it is handed. */
366
+ declare function iterSerializedSpans(spans: readonly OtlpSpan[]): Generator<string>;
367
+ /** Write spans to an OTLP-JSONL file (a temp file when no path is given), one
368
+ * bounded chunk at a time — never the whole export as one string, so a
369
+ * session larger than V8's string limit still exports. */
361
370
  declare function writeOtlpFile(spans: readonly OtlpSpan[], outPath?: string): Promise<string>;
362
371
 
363
372
  interface JsonlCorruptionReceipt {
@@ -1870,6 +1879,9 @@ interface AdoptionOptions {
1870
1879
  * passes the cwds of the analyzed sessions. */
1871
1880
  cwds?: readonly string[];
1872
1881
  }
1882
+ /** Pure span evidence. Repository history is added only by analyzeAdoption. */
1883
+ declare function computeAdoption(spans: readonly OtlpSpan[]): AdoptionReport;
1884
+ /** Add only explicitly requested repository history to the same span measurements. */
1873
1885
  declare function analyzeAdoption(spans: readonly OtlpSpan[], opts?: AdoptionOptions): Promise<AdoptionReport>;
1874
1886
 
1875
1887
  type TraceAgenticRouteReasonCode = 'requested-baseline' | 'execution-failures' | 'repeated-tool-loops' | 'corrective-human-feedback';
@@ -3507,6 +3519,66 @@ declare function renderTraceQuestionsReport(result: Omit<TraceQuestionsResult, '
3507
3519
  /** Write `answers.json` and `report.md` next to the trace file the engine read. */
3508
3520
  declare function writeTraceQuestionsArtifacts(result: TraceQuestionsResult, outDir: string): Promise<TraceQuestionsArtifacts>;
3509
3521
 
3522
+ /** Coverage counts refer to observed records, never an assertion that capture was complete. */
3523
+ interface CoveredMeasurement {
3524
+ readonly total: number | null;
3525
+ readonly measured: number;
3526
+ readonly eligible: number;
3527
+ readonly unavailable: string | null;
3528
+ }
3529
+ interface ToolMeasurement {
3530
+ readonly name: string;
3531
+ readonly calls: number;
3532
+ readonly outcomes: {
3533
+ readonly ok: number;
3534
+ readonly error: number;
3535
+ readonly unset: number;
3536
+ };
3537
+ readonly inputBytes: CoveredMeasurement;
3538
+ readonly outputBytes: CoveredMeasurement;
3539
+ /** Recorded call-to-result interval. Not CPU time or model latency; overlaps may occur. */
3540
+ readonly callToResultMs: CoveredMeasurement;
3541
+ readonly spanIds: readonly string[];
3542
+ }
3543
+ interface CompactionMeasurement {
3544
+ readonly spanId: string;
3545
+ readonly at: string;
3546
+ readonly sincePreviousMs: number | null;
3547
+ readonly latencyMs: number | null;
3548
+ readonly tokensBefore: number | null;
3549
+ readonly tokensAfter: number | null;
3550
+ }
3551
+ interface ContentFootprint {
3552
+ readonly spanId: string;
3553
+ readonly field: string;
3554
+ readonly bytes: number;
3555
+ readonly lines: number;
3556
+ readonly entries: number | null;
3557
+ /** Source representation, not the reconstructed full model request. */
3558
+ readonly scope: 'captured-attribute';
3559
+ }
3560
+ interface SessionMeasurements {
3561
+ readonly execution: ExecutionReport | null;
3562
+ readonly adoption: AdoptionReport;
3563
+ readonly relationship: SessionRelationship;
3564
+ readonly tools: readonly ToolMeasurement[];
3565
+ readonly observedSpawns: number;
3566
+ readonly spawnIntervalsMs: readonly {
3567
+ readonly spanId: string;
3568
+ readonly intervalMs: number | null;
3569
+ }[];
3570
+ readonly compactions: SessionFact<readonly CompactionMeasurement[]>;
3571
+ readonly contextFootprints: readonly ContentFootprint[];
3572
+ readonly coverage: {
3573
+ readonly profile: string;
3574
+ readonly materializedResources: string;
3575
+ readonly contextTokens: string;
3576
+ readonly toolTokens: string;
3577
+ readonly compaction: string;
3578
+ readonly semanticAssessments: string;
3579
+ };
3580
+ }
3581
+
3510
3582
  /**
3511
3583
  * Which pull requests a session created, and which it merged.
3512
3584
  *
@@ -3621,6 +3693,12 @@ declare function readPullRequests(spans: readonly OtlpSpan[]): PullRequestReadin
3621
3693
  * {@link SessionFacts.tokenTotal} states that rather than summing the per-turn
3622
3694
  * deltas, which is a different (and smaller) number.
3623
3695
  */
3696
+ /** Cache invalidation key for deterministic measurements and prepared analyst context. */
3697
+ declare const SESSION_FACTS_MEASUREMENT_VERSION = "3";
3698
+ interface SessionFactsOptions {
3699
+ /** Defaults to true for compatibility. False withholds conversation, commands, paths and assignment text. */
3700
+ readonly includeContent?: boolean;
3701
+ }
3624
3702
  declare const SESSION_TOKEN_TOTAL_ATTR = "traces.session.total_tokens";
3625
3703
  /**
3626
3704
  * The first marker an adapter used for a span it created to describe a
@@ -3772,11 +3850,18 @@ interface SessionFacts {
3772
3850
  * Failures that ended at the same instant are `ambiguous`, never guessed.
3773
3851
  */
3774
3852
  readonly firstFailure: FirstFailure;
3853
+ readonly measurements: SessionMeasurements;
3775
3854
  }
3776
3855
  interface SessionFactsReport {
3777
3856
  readonly schemaVersion: 1;
3778
3857
  readonly kind: 'traces.session_facts_report';
3779
3858
  readonly generatedAt: string;
3859
+ readonly measurementVersion: typeof SESSION_FACTS_MEASUREMENT_VERSION;
3860
+ /** SHA-256 of the canonical selected spans, including content, attributes, links and timing. */
3861
+ readonly sourceDigest: string;
3862
+ /** Latest recorded endpoint, not the last time the filesystem was checked. */
3863
+ readonly evidenceThrough: string | null;
3864
+ readonly contentIncluded: boolean;
3780
3865
  readonly harness: string | null;
3781
3866
  readonly spanCount: number;
3782
3867
  readonly sessions: readonly SessionFacts[];
@@ -3786,9 +3871,9 @@ interface SessionFactsReport {
3786
3871
  * Deterministic and free: the same spans always produce the same sheet, and no
3787
3872
  * model, network call, or budget is involved.
3788
3873
  */
3789
- declare function computeSessionFacts(spans: readonly OtlpSpan[]): SessionFacts[];
3874
+ declare function computeSessionFacts(spans: readonly OtlpSpan[], options?: SessionFactsOptions): SessionFacts[];
3790
3875
  /** The facts sheet for a set of spans, as one report. */
3791
- declare function buildSessionFactsReport(spans: readonly OtlpSpan[], options?: {
3876
+ declare function buildSessionFactsReport(spans: readonly OtlpSpan[], options?: SessionFactsOptions & {
3792
3877
  harness?: string | null;
3793
3878
  generatedAt?: string;
3794
3879
  }): SessionFactsReport;
@@ -3834,7 +3919,7 @@ declare function sessionFactsContext(spans: readonly OtlpSpan[], options?: {
3834
3919
  * prepared context changed is a different analyst. Wrapping therefore bumps the
3835
3920
  * version instead of quietly changing what the same version does.
3836
3921
  */
3837
- declare const SESSION_FACTS_VERSION_SUFFIX = "session-facts.2";
3922
+ declare const SESSION_FACTS_VERSION_SUFFIX: string;
3838
3923
  /**
3839
3924
  * Supply the sheet to every definition as prepared context, before the model
3840
3925
  * runs. A definition that already prepares context keeps it; the sheet is
@@ -3976,26 +4061,33 @@ declare function hodoscopeAnalyzer(options?: HodoscopeAnalyzerOptions): External
3976
4061
  * one-shot RLM over the OTLP-JSONL artifact through an OpenAI-compatible
3977
4062
  * bridge (cli-bridge's prime backend, or any `/v1/chat/completions` endpoint).
3978
4063
  *
3979
- * Protocol, in one pass with no tools:
3980
- * 1. The FULL span projection is inlined into the prompt as JSON — prime has
3981
- * no REPL and no trace tools, so unlike the dspy-rlm analysts (which
3982
- * drill via viewSpans/searchTrace) every fact must travel in the prompt.
3983
- * 2. The reply contract is one fenced ```json block of SHORT strings
3984
- * (long strings get corrupted in transport), citing span ids verbatim.
3985
- * 3. A structurally malformed reply gets ONE bounded stateless repair turn
3986
- * carrying the malformed reply plus the contract — never the trajectory —
3987
- * mirroring the typed-adapter repair the dspy arm gets, so both arms face
3988
- * the same structured-output affordance.
3989
- * 4. Cited span ids are resolved against the artifact; rows citing unknown
3990
- * or ambiguous ids are rejected with a recorded reason, never guessed.
3991
- * Zero findings from a well-formed reply is an honest null, not an error.
3992
- *
3993
- * Oversized traces: when the rendered projection exceeds the inline budget it
3994
- * is re-rendered with a per-attribute character cap (the prompt-side analog of
3995
- * the trace store's per-attribute byte cap); if still oversized the run fails
3996
- * loud — inline delivery is the only delivery, so silently dropping spans
3997
- * would understate the trajectory. The delivery decision is recorded in the
3998
- * result output.
4064
+ * Delivery, small traces first:
4065
+ * 1. INLINE — the full span projection is inlined into the prompt as JSON.
4066
+ * Cheap and bridge-portable, but bounded: past `maxInlineChars` the
4067
+ * projection is re-rendered with a per-attribute character cap (the
4068
+ * prompt-side analog of the trace store's per-attribute byte cap).
4069
+ * 2. FILE — when even the capped render overflows the budget, the artifact
4070
+ * is copied into a per-run directory and that directory is passed as
4071
+ * `cwd` on the chat-completions request (cli-bridge starts prime there).
4072
+ * Prime is a recursive language model with a REPL, so the prompt tells
4073
+ * it to load `trajectory.otlp.jsonl` itself and fan out with `rlm()` —
4074
+ * the trajectory travels as a file, not as prompt bytes. A bridged
4075
+ * prime must be able to READ that directory (host-mode bridges do; a
4076
+ * jailed or remote bridge needs the dir registered/uploaded on the
4077
+ * bridge side — cli-bridge's jail already covers its own dirs).
4078
+ *
4079
+ * Reply contract, both modes: one fenced ```json block of SHORT strings
4080
+ * (long strings get corrupted in transport), citing span ids verbatim.
4081
+ * - A structurally malformed reply gets ONE bounded stateless repair turn
4082
+ * carrying the malformed reply plus the contract — never the trajectory —
4083
+ * mirroring the typed-adapter repair the dspy arm gets, so both arms face
4084
+ * the same structured-output affordance.
4085
+ * - Cited span ids are resolved against the artifact in BOTH delivery
4086
+ * modes; rows citing unknown or ambiguous ids are rejected with a recorded
4087
+ * reason, never guessed. Zero findings from a well-formed reply is an
4088
+ * honest null, not an error.
4089
+ *
4090
+ * The delivery decision is recorded in the result output.
3999
4091
  *
4000
4092
  * Usage (bridge-reported token counts and call count) is recorded in the
4001
4093
  * result output; cost stays uncaptured because the bridge reports no priced
@@ -4010,6 +4102,9 @@ interface PrimeTransportRequest {
4010
4102
  role: 'user';
4011
4103
  content: string;
4012
4104
  }>;
4105
+ /** File delivery: the per-run directory the artifact was copied into;
4106
+ * cli-bridge starts prime here, so `trajectory.otlp.jsonl` resolves. */
4107
+ cwd?: string;
4013
4108
  };
4014
4109
  /** Aborts on the analyzer's deadline AND the caller's signal. */
4015
4110
  signal: AbortSignal;
@@ -4035,6 +4130,11 @@ interface PrimeAnalyzerOptions {
4035
4130
  maxInlineChars?: number;
4036
4131
  /** Character cap applied to each attribute on the oversized re-render. */
4037
4132
  perAttributeCharCap?: number;
4133
+ /** How the trajectory reaches prime. `auto` (default) inlines when it fits
4134
+ * the budget and falls back to file delivery when it does not; `file`
4135
+ * always ships the artifact as `cwd` + `trajectory.otlp.jsonl`; `inline`
4136
+ * keeps the legacy refusal when the capped render still overflows. */
4137
+ delivery?: 'auto' | 'file' | 'inline';
4038
4138
  /** Disable the bounded repair turn (one extra call on a malformed reply). */
4039
4139
  repair?: boolean;
4040
4140
  transport?: PrimeTransport;
@@ -4834,4 +4934,4 @@ interface ExecuteOptions {
4834
4934
  /** Send the final, new outbound items (or write their dry-run OTLP). */
4835
4935
  declare function executeUpload(plan: UploadPlan, opts?: ExecuteOptions): Promise<UploadResult>;
4836
4936
 
4837
- export { ACTOR_ATTR, ATTR, type Actor, type AdoptionOptions, type AdoptionReport, AmpAdapter, type AnalysisEngineFromEnvOptions, type AnalyzeOptions, type AnalyzeResult, type AnswerSchema, type AssembleSessionBundleOptions, BLOBS_DIR, type BuildPolicyEvidenceOptions, type BuildSessionIndexOptions, type BuildTraceFindingPacketOptions, CHANGED_FILE_LIST_CAP, CITATION_NORMALIZATION_VERSION, CONTENT_CAP, COORDINATION_LOG_FILE, CORRECTIVE_REACTIONS, type ChangedFileFact, type ChatTrajectory, type ChatTrajectoryMessage, type ChatTrajectoryOptions, 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 CorruptionMode, DEFAULT_ANALYST_MODEL, DEFAULT_ASK_CONCURRENCY, DEFAULT_HARNESS, DEFAULT_SANDBOX_BASE_URL, EMPTY_SPAN_RUN_SNAPSHOT, EXPORT_RULE, EmptySessionError, type EvidenceOnlyVerdict, 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 FailureFollowUp, type FailureFollowUpReport, type FileRunContextReaderOptions, type FinalMessageFact, type FindSessionTextLeaksOptions, type FindingRejectionCounts, type FindingRejectionReasons, type FindingRejectionTally, 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 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 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 RedactSpansOptions, type Redactor, type RefusedSession, type RepoAttrs, type RepoResolution, type RepoResolutionSource, type ResolvedOtlpInput, type RunContextJournal, type RunContextNode, type RunContextResult, type RunContextSnapshot, type RunDiffOptions, type RunDiffReport, type RunDiffSide, 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, SYNTHESIZED_SOURCE_ATTR, SYNTHESIZED_SPAN_ATTR, type SandboxReplayBackendOptions, type ScanOptions, type ScannedSession, type SessionBatch, type SessionBundleAbsence, type SessionBundleCarriedSignatures, type SessionBundleExclusion, type SessionBundleExclusionRule, type SessionBundleFile, type SessionBundleIssue, type SessionBundleIssueKind, type SessionBundleLeakCheck, type SessionBundleLedgerSlice, type SessionBundleManifest, type SessionBundleProjection, type SessionBundleResult, type SessionBundleSliceRule, type SessionBundleVerification, 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, 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 VerifySafeOptions, type VerifySafeResult, type WatchRunTargetOptions, ZERO_ROLL, type ZaiChatCallerOptions, addSpend, alreadyUploaded, analysisEngineFromEnv, analyzeAdoption, analyzeLiveBatch, analyzeLoopConvergence, analyzeReactions, analyzeSpans, analyzeSteeringChain, answerSchemaErrors, applyRedactor, assembleSessionBundle, assertAnswerSchema, assertSandboxReachable, assessSpans, buildPolicyEvidenceRecord, buildSessionFactsReport, buildSessionIndex, buildSessionIndexFromRows, buildSpanRunTree, buildTraceFindingPacket, capText, chatTrajectoryToSpans, classifyEvidenceOnlyPath, classifyFailureFollowUps, classifyLiveActions, classifyReaction, claudeActor, codexActor, collectPolicyEvidence, collectSessionIndex, collectSessionSelection, collectSessionWorkflow, collectSessions, commandAnalyzer, commandRedactor, commandTextFromInput, computeSessionFacts, conformanceOfSpans, connectors, countSkillRunsJsonl, createBundleSourceReader, createFindingRejectionTally, cwdMatchesSelection, cwdMatchesSelectionResolved, defaultTraceLiveAnalysts, describeSessionRelationship, diffRuns, engineCallReservationFloorUsd, environmentAttributes, environmentFromSpanAttributes, equivalentGitCwds, executeUpload, exportTraceEvidenceFile, exportTraceEvidenceRows, exportTraceEvidenceText, externalFailureMessage, fileRunContextSupervisorRunReader, fileSha256, findContextRoot, findSessionTextLeaks, findSpanSourceFiles, findingRejection, findingRejectionDetail, forEachTreeNode, formatFindingRejections, formatVerdict, haloAnalyzer, hashSessionBundleFiles, hodoscopeAnalyzer, httpJsonTransport, importCodeTraceBench, incompleteInputsNote, indexSessionIdsByTrace, inferRole, inferSpanKind, inspectSessionIndex, int, isBridgeMismatchError, isChatTrajectory, isChatTrajectoryMessage, isFileRunContextDir, isInheritedSpan, isSynthesizedSpan, knownHarnesses, listAdapters, listSessionBundleFiles, loadState, loadTraceQuestionsFile, loadTracesConfig, locateSessions, looksLikeAgentPrompt, mergeRolls, mergeTracesConfig, ms, normalizeAnalystCitations, normalizeRemote, normalizeTraceQuestions, otlpRowToSpan, outboundHash, parseIsoToEpochMs, parseJsonAnswer, parseSession, parseSince, planTraceAgenticRoute, planUpload, primeAnalyzer, projectSessionBundle, readCoordinationLog, readFileRunContext, readJsonFile, readJsonl, readOtlpInput, readPullRequests, readRunContextJournal, readRunContextSnapshot, readRunSide, readRunWatchSnapshot, readSessionBundleManifest, readSessionIndexFile, readSpanRunSnapshot, recordSessionCorruption, redactSpans, renderConformance, renderInspectionReport, renderRunContextSnapshot, renderRunDiff, renderRunWatchSnapshot, renderSessionFacts, renderSessionFactsContext, renderSpanRunSnapshot, renderTraceQuestionInstructions, renderTraceQuestionPrompt, renderTraceQuestionsReport, renderValidation, resolveAdapter, resolveOtlpInputFiles, resolveRepoAttrs, resolveRunContextDir, resolveRunWatchTarget, resolveSessionRepoAttrs, runCommand, runExternalAnalyzers, runPipelines, runTotals, runTraceImprovement, runTraceInvestigation, runTraceQuestions, runTraceStoreInvestigation, sandboxReplayBackend, saveReport, saveState, scanSessions, 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, verdictExitCode, verifyFindingsInSandbox, verifySafe, verifySessionBundle, watchRunTarget, watchSessions, withSessionFactsContext, wrap, writeHodoscopeInput, writeInspectionReportFile, writeOtlpFile, writePolicyEvidenceFile, writeSessionBundleManifest, writeSessionIndexFile, writeTraceEvidenceExportFile, writeTraceImprovementArtifacts, writeTraceQuestionsArtifacts, zaiChatCaller, zeroPricedCost };
4937
+ export { ACTOR_ATTR, ATTR, type Actor, type AdoptionOptions, type AdoptionReport, AmpAdapter, type AnalysisEngineFromEnvOptions, type AnalyzeOptions, type AnalyzeResult, type AnswerSchema, type AssembleSessionBundleOptions, BLOBS_DIR, type BuildPolicyEvidenceOptions, type BuildSessionIndexOptions, type BuildTraceFindingPacketOptions, CHANGED_FILE_LIST_CAP, CITATION_NORMALIZATION_VERSION, CONTENT_CAP, COORDINATION_LOG_FILE, CORRECTIVE_REACTIONS, type ChangedFileFact, type ChatTrajectory, type ChatTrajectoryMessage, type ChatTrajectoryOptions, 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 CompactionMeasurement, type ConformanceRenderOptions, type ContentFootprint, type CoordinationLog, type CoordinationQuestion, type CoordinationSteer, CopilotAdapter, type CorruptionMode, type CoveredMeasurement, DEFAULT_ANALYST_MODEL, DEFAULT_ASK_CONCURRENCY, DEFAULT_HARNESS, DEFAULT_SANDBOX_BASE_URL, EMPTY_SPAN_RUN_SNAPSHOT, EXPORT_RULE, EmptySessionError, type EvidenceOnlyVerdict, 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 FailureFollowUp, type FailureFollowUpReport, type FileRunContextReaderOptions, type FinalMessageFact, type FindSessionTextLeaksOptions, type FindingRejectionCounts, type FindingRejectionReasons, type FindingRejectionTally, 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 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 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 RedactSpansOptions, type Redactor, type RefusedSession, type RepoAttrs, type RepoResolution, type RepoResolutionSource, type ResolvedOtlpInput, type RunContextJournal, type RunContextNode, type RunContextResult, type RunContextSnapshot, type RunDiffOptions, type RunDiffReport, type RunDiffSide, type RunResult, type RunWatchSnapshot, type RunWatchTarget, type RuntimeTrace, SESSION_FACTS_MEASUREMENT_VERSION, SESSION_FACTS_VERSION_SUFFIX, SESSION_TOKEN_TOTAL_ATTR, SOURCE_ATTRIBUTE_PREFIX, SPAN_SYNTHESIZED_ATTR, SPAWN_JOURNAL_FILE, STATUS_MARK, SYNTHESIZED_SOURCE_ATTR, SYNTHESIZED_SPAN_ATTR, type SandboxReplayBackendOptions, type ScanOptions, type ScannedSession, type SessionBatch, type SessionBundleAbsence, type SessionBundleCarriedSignatures, type SessionBundleExclusion, type SessionBundleExclusionRule, type SessionBundleFile, type SessionBundleIssue, type SessionBundleIssueKind, type SessionBundleLeakCheck, type SessionBundleLedgerSlice, type SessionBundleManifest, type SessionBundleProjection, type SessionBundleResult, type SessionBundleSliceRule, type SessionBundleVerification, type SessionBundleView, type SessionCorruptionReceipt, type SessionEnvironment, type SessionFact, type SessionFacts, type SessionFactsOptions, type SessionFactsReport, type SessionIdentityConflict, type SessionIdentityIndex, type SessionIntegrity, type SessionMeasurements, 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, TRACE_QUESTION_PREVIEW_HEAD_CHARS, type ToolMeasurement, 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 VerifySafeOptions, type VerifySafeResult, type WatchRunTargetOptions, ZERO_ROLL, type ZaiChatCallerOptions, addSpend, alreadyUploaded, analysisEngineFromEnv, analyzeAdoption, analyzeLiveBatch, analyzeLoopConvergence, analyzeReactions, analyzeSpans, analyzeSteeringChain, answerSchemaErrors, applyRedactor, assembleSessionBundle, assertAnswerSchema, assertSandboxReachable, assessSpans, buildPolicyEvidenceRecord, buildSessionFactsReport, buildSessionIndex, buildSessionIndexFromRows, buildSpanRunTree, buildTraceFindingPacket, capText, chatTrajectoryToSpans, classifyEvidenceOnlyPath, classifyFailureFollowUps, classifyLiveActions, classifyReaction, claudeActor, codexActor, collectPolicyEvidence, collectSessionIndex, collectSessionSelection, collectSessionWorkflow, collectSessions, commandAnalyzer, commandRedactor, commandTextFromInput, computeAdoption, computeSessionFacts, conformanceOfSpans, connectors, countSkillRunsJsonl, createBundleSourceReader, createFindingRejectionTally, cwdMatchesSelection, cwdMatchesSelectionResolved, defaultTraceLiveAnalysts, describeSessionRelationship, diffRuns, engineCallReservationFloorUsd, environmentAttributes, environmentFromSpanAttributes, equivalentGitCwds, executeUpload, exportTraceEvidenceFile, exportTraceEvidenceRows, exportTraceEvidenceText, externalFailureMessage, fileRunContextSupervisorRunReader, fileSha256, findContextRoot, findSessionTextLeaks, findSpanSourceFiles, findingRejection, findingRejectionDetail, forEachTreeNode, formatFindingRejections, formatVerdict, haloAnalyzer, hashSessionBundleFiles, hodoscopeAnalyzer, httpJsonTransport, importCodeTraceBench, incompleteInputsNote, indexSessionIdsByTrace, inferRole, inferSpanKind, inspectSessionIndex, int, isBridgeMismatchError, isChatTrajectory, isChatTrajectoryMessage, isFileRunContextDir, isInheritedSpan, isSynthesizedSpan, iterSerializedSpans, knownHarnesses, listAdapters, listSessionBundleFiles, loadState, loadTraceQuestionsFile, loadTracesConfig, locateSessions, looksLikeAgentPrompt, mergeRolls, mergeTracesConfig, ms, normalizeAnalystCitations, normalizeRemote, normalizeTraceQuestions, otlpRowToSpan, outboundHash, parseIsoToEpochMs, parseJsonAnswer, parseSession, parseSince, planTraceAgenticRoute, planUpload, primeAnalyzer, projectSessionBundle, readCoordinationLog, readFileRunContext, readJsonFile, readJsonl, readOtlpInput, readPullRequests, readRunContextJournal, readRunContextSnapshot, readRunSide, readRunWatchSnapshot, readSessionBundleManifest, readSessionIndexFile, readSpanRunSnapshot, recordSessionCorruption, redactSpans, renderConformance, renderInspectionReport, renderRunContextSnapshot, renderRunDiff, renderRunWatchSnapshot, renderSessionFacts, renderSessionFactsContext, renderSpanRunSnapshot, renderTraceQuestionInstructions, renderTraceQuestionPrompt, renderTraceQuestionsReport, renderValidation, resolveAdapter, resolveOtlpInputFiles, resolveRepoAttrs, resolveRunContextDir, resolveRunWatchTarget, resolveSessionRepoAttrs, runCommand, runExternalAnalyzers, runPipelines, runTotals, runTraceImprovement, runTraceInvestigation, runTraceQuestions, runTraceStoreInvestigation, sandboxReplayBackend, saveReport, saveState, scanSessions, 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, verdictExitCode, verifyFindingsInSandbox, verifySafe, verifySessionBundle, watchRunTarget, watchSessions, withSessionFactsContext, wrap, writeHodoscopeInput, writeInspectionReportFile, writeOtlpFile, writePolicyEvidenceFile, writeSessionBundleManifest, writeSessionIndexFile, writeTraceEvidenceExportFile, writeTraceImprovementArtifacts, writeTraceQuestionsArtifacts, zaiChatCaller, zeroPricedCost };
package/dist/index.js CHANGED
@@ -44,6 +44,7 @@ import {
44
44
  REACTIONS,
45
45
  RESULT_FILE,
46
46
  RULE,
47
+ SESSION_FACTS_MEASUREMENT_VERSION,
47
48
  SESSION_FACTS_VERSION_SUFFIX,
48
49
  SESSION_TOKEN_TOTAL_ATTR,
49
50
  SOURCE_ATTRIBUTE_PREFIX,
@@ -91,6 +92,7 @@ import {
91
92
  commandAnalyzer,
92
93
  commandRedactor,
93
94
  commandTextFromInput,
95
+ computeAdoption,
94
96
  computeSessionFacts,
95
97
  conformanceOfSpans,
96
98
  connectors,
@@ -138,6 +140,7 @@ import {
138
140
  isFileRunContextDir,
139
141
  isInheritedSpan,
140
142
  isSynthesizedSpan,
143
+ iterSerializedSpans,
141
144
  knownHarnesses,
142
145
  listAdapters,
143
146
  listSessionBundleFiles,
@@ -267,7 +270,7 @@ import {
267
270
  writeTraceQuestionsArtifacts,
268
271
  zaiChatCaller,
269
272
  zeroPricedCost
270
- } from "./chunk-SMT635QV.js";
273
+ } from "./chunk-4QY4U4XW.js";
271
274
 
272
275
  // src/collect.ts
273
276
  async function collectSessions(opts = {}) {
@@ -345,6 +348,7 @@ export {
345
348
  REACTIONS,
346
349
  RESULT_FILE,
347
350
  RULE,
351
+ SESSION_FACTS_MEASUREMENT_VERSION,
348
352
  SESSION_FACTS_VERSION_SUFFIX,
349
353
  SESSION_TOKEN_TOTAL_ATTR,
350
354
  SOURCE_ATTRIBUTE_PREFIX,
@@ -395,6 +399,7 @@ export {
395
399
  commandAnalyzer,
396
400
  commandRedactor,
397
401
  commandTextFromInput,
402
+ computeAdoption,
398
403
  computeSessionFacts,
399
404
  conformanceOfSpans,
400
405
  connectors,
@@ -444,6 +449,7 @@ export {
444
449
  isFileRunContextDir,
445
450
  isInheritedSpan,
446
451
  isSynthesizedSpan,
452
+ iterSerializedSpans,
447
453
  knownHarnesses,
448
454
  listAdapters,
449
455
  listSessionBundleFiles,
@@ -353,8 +353,12 @@ Hodoscope always returns `discovery`, and each candidate has `status: 'needs_rev
353
353
  ### Prime engine
354
354
 
355
355
  `--analyzer prime` runs a one-shot analyst over the emitted OTLP artifact through an OpenAI-compatible bridge, such as cli-bridge's prime backend.
356
- Unlike the `--llm` analysts, which drill into the trace with paged tools, prime has no REPL and no trace tools: the full span projection is inlined into a single prompt as JSON.
357
- Oversized projections are re-rendered with a per-attribute character cap; if the projection still exceeds the inline budget the engine fails loud instead of silently dropping spans.
356
+ Unlike the `--llm` analysts, which drill into the trace with paged tools, prime is a recursive language model with its own REPL, so the trajectory reaches it one of two ways:
357
+
358
+ - **Inline (small traces):** the full span projection is inlined into a single prompt as JSON. Oversized projections are re-rendered with a per-attribute character cap.
359
+ - **File (large traces):** when even the capped projection exceeds the inline budget, the artifact is copied into a per-run directory, that directory is sent as `cwd` on the chat-completions request (cli-bridge starts prime there), and the prompt tells prime to load `trajectory.otlp.jsonl` itself and fan out with `rlm()` — so the trajectory travels as a readable file, not prompt bytes, and no trace is refused for size. The bridge must be able to read that directory: host-mode bridges do by construction; a jailed or remote bridge needs the directory registered or uploaded on the bridge side.
360
+
361
+ Span-id grounding is identical in both modes: every cited id is validated against the artifact, and the delivery decision is recorded in the result output.
358
362
 
359
363
  Prerequisites:
360
364
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tangle-network/traces",
3
- "version": "0.16.4",
4
- "description": "Point it at your coding-agent session traces (Claude Code, Codex, OpenCode, Gemini, Pi, …) and get failure-mode + efficiency findings. CLI + SDK over the @tangle-network/agent-eval analyst suite — observe live sessions, run your own analysts, redact, and upload to the Tangle Intelligence Platform.",
3
+ "version": "0.17.0",
4
+ "description": "Point it at your coding-agent session traces (Claude Code, Codex, OpenCode, Gemini, Pi, \u2026) and get failure-mode + efficiency findings. CLI + SDK over the @tangle-network/agent-eval analyst suite \u2014 observe live sessions, run your own analysts, redact, and upload to the Tangle Intelligence Platform.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {