@tangle-network/traces 0.8.17 → 0.8.19

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
@@ -33,18 +33,22 @@ import {
33
33
  serializePolicyEvidence,
34
34
  serializeSessionIndex,
35
35
  serializeSpans,
36
+ serializeTraceStreamEvent,
37
+ streamSessions,
36
38
  summarizeDeterministicSignals,
39
+ traceStreamEventsFromSpans,
37
40
  watchSessions,
38
41
  writeInspectionReportFile,
39
42
  writeOtlpFile,
40
43
  writePolicyEvidenceFile,
41
44
  writeSessionIndexFile,
42
45
  writeTraceEvidenceExportFile
43
- } from "./chunk-QM4QAG3V.js";
46
+ } from "./chunk-FCTZLWP7.js";
44
47
 
45
48
  // src/cli.ts
46
49
  import { readFileSync } from "fs";
47
50
  import { readFile, stat, writeFile } from "fs/promises";
51
+ import { basename, resolve } from "path";
48
52
  function packageVersion() {
49
53
  const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
50
54
  if (typeof pkg.version !== "string" || !pkg.version) throw new Error("package.json is missing version");
@@ -66,6 +70,9 @@ function parseArgs(argv) {
66
70
  yes: false,
67
71
  noContent: false,
68
72
  analyzers: [],
73
+ replay: false,
74
+ noSpans: false,
75
+ noFindings: false,
69
76
  attrs: []
70
77
  };
71
78
  for (let i = 1; i < argv.length; i++) {
@@ -112,6 +119,9 @@ function parseArgs(argv) {
112
119
  case "--config":
113
120
  a.config = next();
114
121
  break;
122
+ case "--mode":
123
+ a.mode = next();
124
+ break;
115
125
  case "--metadata":
116
126
  a.metadata = next();
117
127
  break;
@@ -135,6 +145,16 @@ function parseArgs(argv) {
135
145
  case "--no-content":
136
146
  a.noContent = true;
137
147
  break;
148
+ case "--replay":
149
+ case "--once":
150
+ a.replay = true;
151
+ break;
152
+ case "--no-spans":
153
+ a.noSpans = true;
154
+ break;
155
+ case "--no-findings":
156
+ a.noFindings = true;
157
+ break;
138
158
  case "--analyzer": {
139
159
  const v = next();
140
160
  if (v) a.analyzers.push(v);
@@ -486,12 +506,125 @@ async function cmdImprove(args) {
486
506
  `improvement artifacts \u2192 ${dir} (${result.findings.length} findings, ${result.recommendations.length} recommendations, ${result.proposals.length} proposal(s), OTLP: ${result.otlpPath})`
487
507
  );
488
508
  }
509
+ function summarizeFindingEvidence(finding) {
510
+ const first = finding.evidence[0];
511
+ if (!first) return "no evidence";
512
+ return `${first.label}: ${first.value}`;
513
+ }
514
+ function formatLiveFinding(finding) {
515
+ const ts = new Date(finding.observedAt).toISOString().slice(11, 19);
516
+ const where = `[${finding.session.harness}] ${finding.session.sessionId.slice(0, 8)}`;
517
+ const cwd = finding.session.cwd ? ` \xB7 ${finding.session.cwd}` : "";
518
+ return [
519
+ `${ts} ${finding.severity.toUpperCase()} ${where} \u2014 ${finding.title}${cwd}`,
520
+ ` evidence: ${summarizeFindingEvidence(finding)}`,
521
+ ` action: ${finding.action}`,
522
+ ` check: ${finding.check}`
523
+ ].join("\n");
524
+ }
525
+ function streamMode(raw) {
526
+ if (raw === void 0) return "visualizer";
527
+ if (raw === "visualizer" || raw === "findings" || raw === "agent") return raw;
528
+ throw new Error(`unknown stream mode "${raw}" (expected visualizer, findings, or agent)`);
529
+ }
530
+ function streamPreset(args) {
531
+ const mode = streamMode(args.mode);
532
+ return {
533
+ mode,
534
+ includeSpans: !args.noSpans && mode === "visualizer",
535
+ includeFindings: !args.noFindings,
536
+ includeBatches: true,
537
+ includeReports: mode === "agent"
538
+ };
539
+ }
540
+ async function streamExplicitSession(args, extraAnalysts) {
541
+ if (!args.session) throw new Error("streamExplicitSession needs --session");
542
+ const adapter = resolveAdapter(args.harness);
543
+ if (!adapter) throw new Error(`unknown harness "${args.harness}"`);
544
+ const preset = streamPreset(args);
545
+ const st = await stat(args.session);
546
+ const ref = {
547
+ harness: adapter.harness,
548
+ sessionId: basename(args.session),
549
+ path: resolve(args.session),
550
+ cwd: args.cwd ?? null,
551
+ mtimeMs: st.mtimeMs
552
+ };
553
+ const spans = await parseSession(adapter, ref);
554
+ for (const event of traceStreamEventsFromSpans(spans, {
555
+ ref,
556
+ includeSpans: preset.includeSpans,
557
+ includeFindings: preset.includeFindings,
558
+ extraAnalysts
559
+ })) {
560
+ process.stdout.write(serializeTraceStreamEvent(event));
561
+ }
562
+ }
563
+ async function cmdStream(args) {
564
+ const config = await loadTracesConfig(args.config);
565
+ const preset = streamPreset(args);
566
+ if (args.input) {
567
+ const { spans, harness } = await collectImportedSpans(args);
568
+ const ref = {
569
+ harness,
570
+ sessionId: basename(args.input),
571
+ path: resolve(args.input),
572
+ cwd: args.cwd ?? null,
573
+ mtimeMs: Date.now()
574
+ };
575
+ for (const event of traceStreamEventsFromSpans(spans, {
576
+ ref,
577
+ includeSpans: preset.includeSpans,
578
+ includeFindings: preset.includeFindings,
579
+ extraAnalysts: config?.liveAnalysts
580
+ })) {
581
+ process.stdout.write(serializeTraceStreamEvent(event));
582
+ }
583
+ return;
584
+ }
585
+ if (args.session) {
586
+ await streamExplicitSession(args, config?.liveAnalysts);
587
+ return;
588
+ }
589
+ const all = args.all || !args.harnessExplicit && !args.cwd;
590
+ const controller = new AbortController();
591
+ process.once("SIGINT", () => controller.abort());
592
+ if (!args.replay) {
593
+ process.stderr.write(
594
+ `traces stream \u2014 ${preset.mode} JSONL feed for ${all ? "all harnesses" : args.harness}, last ${args.window}m, every ${args.interval}s. Ctrl-C to stop.
595
+ `
596
+ );
597
+ }
598
+ await streamSessions({
599
+ all,
600
+ harnesses: all ? void 0 : [args.harness],
601
+ cwd: args.cwd,
602
+ last: args.last > 0 ? args.last : args.replay ? 1 : void 0,
603
+ windowMs: args.window * 6e4,
604
+ intervalMs: args.interval * 1e3,
605
+ once: args.replay,
606
+ includeSpans: preset.includeSpans,
607
+ includeFindings: preset.includeFindings,
608
+ includeBatches: preset.includeBatches,
609
+ includeReports: preset.includeReports,
610
+ extraAnalysts: config?.liveAnalysts,
611
+ signal: controller.signal,
612
+ onEvent: (event) => {
613
+ process.stdout.write(serializeTraceStreamEvent(event));
614
+ },
615
+ onError: (err, ref) => {
616
+ const where = ref ? ` [${ref.harness}] ${ref.sessionId}` : "";
617
+ process.stderr.write(`stream error${where}: ${err instanceof Error ? err.message : String(err)}
618
+ `);
619
+ }
620
+ });
621
+ }
489
622
  async function cmdWatch(args) {
490
623
  const all = args.all || !args.harnessExplicit && !args.cwd;
491
624
  const controller = new AbortController();
492
625
  process.once("SIGINT", () => controller.abort());
493
626
  process.stderr.write(
494
- `traces watch \u2014 observing ${all ? "all harnesses" : args.harness}, sessions active in the last ${args.window}m, every ${args.interval}s. Read-only; Ctrl-C to stop.
627
+ `traces watch \u2014 observing ${all ? "all harnesses" : args.harness}, sessions active in the last ${args.window}m, every ${args.interval}s. Loop + semantic live findings; read-only; Ctrl-C to stop.
495
628
  `
496
629
  );
497
630
  await watchSessions({
@@ -505,9 +638,13 @@ async function cmdWatch(args) {
505
638
  onLoop: (l) => {
506
639
  const ts = (/* @__PURE__ */ new Date()).toISOString().slice(11, 19);
507
640
  process.stdout.write(
508
- `\u26A0\uFE0F ${ts} [${l.harness}] ${l.sessionId.slice(0, 8)} \u2014 \`${l.toolName}\` repeated \xD7${l.occurrences} with identical args (${(l.windowMs / 1e3).toFixed(0)}s)${l.cwd ? ` \xB7 ${l.cwd}` : ""}
641
+ `${ts} LOOP [${l.harness}] ${l.sessionId.slice(0, 8)} \u2014 \`${l.toolName}\` repeated \xD7${l.occurrences} with identical args (${(l.windowMs / 1e3).toFixed(0)}s)${l.cwd ? ` \xB7 ${l.cwd}` : ""}
509
642
  `
510
643
  );
644
+ },
645
+ onFinding: (finding) => {
646
+ process.stdout.write(`${formatLiveFinding(finding)}
647
+ `);
511
648
  }
512
649
  });
513
650
  }
@@ -607,14 +744,15 @@ Commands:
607
744
  inspect Read a session index and print ranked improvement findings
608
745
  export Convert evidence/events files to OpenInference JSONL for HALO
609
746
  evidence Emit compact session-evidence JSONL for downstream policy miners
610
- watch Online observer: tail active sessions, notify on stuck loops (read-only)
747
+ stream Emit JSONL trace stream events for live visualizers or replay
748
+ watch Online observer: tail active sessions, notify on loops + semantic findings
611
749
  upload Redact + upload sessions in a time window to the Tangle Intelligence Platform
612
750
 
613
751
  Options:
614
752
  --harness <id> Harness or alias (default: claude-code). Known: ${knownHarnesses().join(", ")}
615
753
  --all Sweep every known harness
616
754
  --last <n> Most-recent N sessions
617
- --session <path> Analyze one explicit session file
755
+ --session <path> Analyze/stream one explicit harness session file
618
756
  --cwd <dir> Filter sessions by working directory
619
757
  --since <t> upload: window \u2014 30m / 2h / 7d or an ISO date (default 24h); analyze: ISO cutoff
620
758
  --out <path> Write report to a file
@@ -623,9 +761,13 @@ Options:
623
761
  --format <kind> analyze/export file: auto | policy-evidence | sandbox-events | openinference | intelligence-spans
624
762
  --metadata <json> analyze/export file: attach JSON object fields as span attributes
625
763
  --attr <k=v> analyze/export file: attach one span attribute (repeatable)
764
+ --mode <kind> stream: visualizer | findings | agent (default visualizer)
765
+ --replay, --once stream: scan once and exit (default for positional input / --session)
766
+ --no-spans stream: omit per-span pulse events
767
+ --no-findings stream: omit semantic live-finding events
626
768
  --llm Enable agentic RLM analysts (needs OPENAI_API_KEY / OPENAI_BASE_URL)
627
769
  --model <id> --llm model id (e.g. a router model like glm-5.2); default is agent-eval's
628
- --config <path> investigate/improve: JS config with analysts, external analyzers, or proposal adapter
770
+ --config <path> investigate/improve/stream: JS config with analysts, liveAnalysts, external analyzers, or proposal adapter
629
771
  --budget <usd> USD cap for agentic analysts
630
772
  --analyzer <cmd> analyze: also run an external engine over the OTLP (repeatable; "halo" or any command)
631
773
  --analyzer-prompt <p> analyze: prompt passed to external analyzers (default: diagnose)
@@ -685,6 +827,9 @@ async function main() {
685
827
  case "evidence":
686
828
  await cmdEvidence(args);
687
829
  break;
830
+ case "stream":
831
+ await cmdStream(args);
832
+ break;
688
833
  case "watch":
689
834
  await cmdWatch(args);
690
835
  break;
package/dist/index.d.ts CHANGED
@@ -1106,9 +1106,175 @@ declare function commandRedactor(spec: {
1106
1106
  timeoutMs?: number;
1107
1107
  }): Redactor;
1108
1108
 
1109
+ type TraceLiveSeverity = 'info' | 'low' | 'medium' | 'high';
1110
+ interface TraceLiveEvidence {
1111
+ readonly kind: 'metric' | 'span' | 'pattern';
1112
+ readonly label: string;
1113
+ readonly value: string;
1114
+ readonly spanIds?: readonly string[];
1115
+ }
1116
+ interface TraceLiveFinding {
1117
+ readonly schemaVersion: 1;
1118
+ readonly kind: 'traces.live_finding';
1119
+ readonly id: string;
1120
+ readonly ruleId: string;
1121
+ readonly fingerprint: string;
1122
+ readonly severity: TraceLiveSeverity;
1123
+ readonly title: string;
1124
+ readonly claim: string;
1125
+ readonly action: string;
1126
+ readonly check: string;
1127
+ readonly evidence: readonly TraceLiveEvidence[];
1128
+ readonly session: TraceStreamSession;
1129
+ readonly observedAt: string;
1130
+ }
1131
+ interface TraceStreamSession {
1132
+ readonly harness: string;
1133
+ readonly sessionId: string;
1134
+ readonly cwd: string | null;
1135
+ readonly path?: string;
1136
+ }
1137
+ type TraceLiveActionKind = 'tool' | 'read' | 'edit' | 'verify' | 'claim' | 'other';
1138
+ interface TraceLiveAction {
1139
+ readonly kind: TraceLiveActionKind;
1140
+ readonly spanId: string;
1141
+ readonly span: OtlpSpan;
1142
+ readonly toolName?: string;
1143
+ readonly signature: string;
1144
+ readonly errored: boolean;
1145
+ }
1146
+ interface TraceLiveLoop {
1147
+ readonly harness: string;
1148
+ readonly sessionId: string;
1149
+ readonly cwd: string | null;
1150
+ readonly toolName: string;
1151
+ readonly argHash: string;
1152
+ readonly occurrences: number;
1153
+ readonly windowMs: number;
1154
+ }
1155
+ interface TraceLiveAnalysisContext {
1156
+ readonly spans: readonly OtlpSpan[];
1157
+ readonly actions: readonly TraceLiveAction[];
1158
+ readonly tools: readonly OtlpSpan[];
1159
+ readonly erroredTools: readonly OtlpSpan[];
1160
+ readonly verificationActions: readonly TraceLiveAction[];
1161
+ readonly changeActions: readonly TraceLiveAction[];
1162
+ readonly session: TraceStreamSession;
1163
+ readonly generatedAt: string;
1164
+ readonly newSpanCount: number;
1165
+ }
1166
+ interface TraceLiveAnalyst {
1167
+ readonly id: string;
1168
+ analyze(context: TraceLiveAnalysisContext): readonly TraceLiveFinding[];
1169
+ }
1170
+ interface TraceLiveBatch {
1171
+ readonly schemaVersion: 1;
1172
+ readonly kind: 'traces.live_batch';
1173
+ readonly generatedAt: string;
1174
+ readonly session: TraceStreamSession;
1175
+ readonly spanCount: number;
1176
+ readonly newSpanCount: number;
1177
+ readonly toolCallCount: number;
1178
+ readonly erroredToolCallCount: number;
1179
+ readonly verificationCallCount: number;
1180
+ readonly changeCallCount: number;
1181
+ readonly actionCounts: Readonly<Record<TraceLiveActionKind, number>>;
1182
+ readonly findingCount: number;
1183
+ readonly findings: readonly TraceLiveFinding[];
1184
+ }
1185
+ type TraceStreamEvent = {
1186
+ readonly schemaVersion: 1;
1187
+ readonly kind: 'traces.stream.session';
1188
+ readonly event: 'session';
1189
+ readonly generatedAt: string;
1190
+ readonly session: TraceStreamSession;
1191
+ readonly spanCount: number;
1192
+ readonly startedAt: string | null;
1193
+ readonly endedAt: string | null;
1194
+ } | {
1195
+ readonly schemaVersion: 1;
1196
+ readonly kind: 'traces.stream.span';
1197
+ readonly event: 'span';
1198
+ readonly generatedAt: string;
1199
+ readonly session: TraceStreamSession;
1200
+ readonly span: OtlpSpan;
1201
+ } | {
1202
+ readonly schemaVersion: 1;
1203
+ readonly kind: 'traces.stream.batch';
1204
+ readonly event: 'analysis_batch';
1205
+ readonly generatedAt: string;
1206
+ readonly ref?: SessionRef;
1207
+ readonly batch: TraceLiveBatch;
1208
+ } | {
1209
+ readonly schemaVersion: 1;
1210
+ readonly kind: 'traces.stream.report';
1211
+ readonly event: 'report';
1212
+ readonly generatedAt: string;
1213
+ readonly session: TraceStreamSession;
1214
+ readonly ref: SessionRef;
1215
+ readonly report: PipelineReport;
1216
+ readonly loops: readonly TraceLiveLoop[];
1217
+ } | {
1218
+ readonly schemaVersion: 1;
1219
+ readonly kind: 'traces.stream.finding';
1220
+ readonly event: 'finding';
1221
+ readonly generatedAt: string;
1222
+ readonly finding: TraceLiveFinding;
1223
+ } | {
1224
+ readonly schemaVersion: 1;
1225
+ readonly kind: 'traces.stream.tick';
1226
+ readonly event: 'tick';
1227
+ readonly generatedAt: string;
1228
+ readonly sessions: number;
1229
+ readonly newSpans: number;
1230
+ readonly findings: number;
1231
+ };
1232
+ interface LiveBatchOptions {
1233
+ readonly generatedAt?: string;
1234
+ readonly session?: Partial<TraceStreamSession>;
1235
+ readonly newSpanCount?: number;
1236
+ /** Replaces the built-in deterministic live analysts. */
1237
+ readonly analysts?: readonly TraceLiveAnalyst[];
1238
+ /** Adds custom live analysts after the built-ins. */
1239
+ readonly extraAnalysts?: readonly TraceLiveAnalyst[];
1240
+ }
1241
+ interface TraceStreamReplayOptions extends LiveBatchOptions {
1242
+ readonly ref?: SessionRef;
1243
+ readonly includeSpans?: boolean;
1244
+ readonly includeFindings?: boolean;
1245
+ }
1246
+ interface TraceStreamOptions extends ScanOptions {
1247
+ /** Observe sessions active within this window. Default 30 min. */
1248
+ readonly windowMs?: number;
1249
+ /** Poll interval. Default 5s. */
1250
+ readonly intervalMs?: number;
1251
+ /** Stop after one scan, useful for replay or tests. */
1252
+ readonly once?: boolean;
1253
+ /** Emit one JSON event per new span. Default true. */
1254
+ readonly includeSpans?: boolean;
1255
+ /** Emit live semantic findings. Default true. */
1256
+ readonly includeFindings?: boolean;
1257
+ /** Emit session and analysis-batch events. Default true. */
1258
+ readonly includeBatches?: boolean;
1259
+ /** Emit deterministic pipeline report events. Default false. */
1260
+ readonly includeReports?: boolean;
1261
+ /** Minimum repeated identical calls for report loop detection. Default 3. */
1262
+ readonly minLoopOccurrences?: number;
1263
+ /** Adds custom live analysts after the built-ins. */
1264
+ readonly extraAnalysts?: readonly TraceLiveAnalyst[];
1265
+ readonly onEvent: (event: TraceStreamEvent) => void | Promise<void>;
1266
+ }
1267
+ declare function classifyLiveActions(spans: readonly OtlpSpan[]): TraceLiveAction[];
1268
+ declare const defaultTraceLiveAnalysts: readonly TraceLiveAnalyst[];
1269
+ declare function analyzeLiveBatch(spans: readonly OtlpSpan[], opts?: LiveBatchOptions): TraceLiveBatch;
1270
+ declare function traceStreamEventsFromSpans(spans: readonly OtlpSpan[], opts?: TraceStreamReplayOptions): TraceStreamEvent[];
1271
+ declare function serializeTraceStreamEvent(event: TraceStreamEvent): string;
1272
+ declare function streamSessions(opts: TraceStreamOptions): Promise<void>;
1273
+
1109
1274
  interface TracesConfig {
1110
1275
  readonly registry?: AnalystRegistry;
1111
1276
  readonly analysts?: readonly Analyst[];
1277
+ readonly liveAnalysts?: readonly TraceLiveAnalyst[];
1112
1278
  readonly externalAnalyzers?: readonly ExternalAnalyzer[];
1113
1279
  readonly improvementAdapter?: ImprovementAdapter;
1114
1280
  }
@@ -1277,29 +1443,14 @@ declare function runTraceImprovementLoop(opts: TraceImprovementOptions): Promise
1277
1443
  declare function saveReport(path: string, report: string): Promise<void>;
1278
1444
 
1279
1445
  /**
1280
- * Live trace observer — the reusable, event-driven core behind `traces watch`.
1446
+ * Live trace observer — compatibility wrapper behind `traces watch`.
1281
1447
  *
1282
- * `watchSessions` tails active coding-agent sessions across harnesses and emits
1283
- * structured events as it goes: every session's pipeline report each tick
1284
- * (`onReport`), and a deduped signal whenever a stuck loop first appears or
1285
- * grows (`onLoop`). It's read-only (never touches the agent or its harness) and
1286
- * cancellable via an `AbortSignal`, so a third party can subscribe to the live
1287
- * findings stream and feed it into any system — a dashboard, an alerter, a
1288
- * steering layer, or another agent — without shelling out to the CLI.
1448
+ * `streamSessions` is the single live scanner. `watchSessions` keeps the
1449
+ * callback-oriented SDK surface for existing users while consuming stream
1450
+ * events instead of running a second polling loop.
1289
1451
  */
1290
1452
 
1291
- /** A newly-observed (or grown) stuck loop in a live session. */
1292
- interface ObservedLoop {
1293
- harness: string;
1294
- sessionId: string;
1295
- cwd: string | null;
1296
- toolName: string;
1297
- argHash: string;
1298
- /** Identical repeated calls observed so far. */
1299
- occurrences: number;
1300
- /** Milliseconds between the first and last call in the loop. */
1301
- windowMs: number;
1302
- }
1453
+ type ObservedLoop = TraceLiveLoop;
1303
1454
  interface ObserverOptions {
1304
1455
  /** Harness ids/aliases to observe. Omit (or pass `all: true`) → every harness. */
1305
1456
  harnesses?: string[];
@@ -1323,6 +1474,10 @@ interface ObserverOptions {
1323
1474
  /** Fired for every observed session each tick, with its full pipeline report
1324
1475
  * (stuck loops + tool-use metrics) — react to anything, not just loops. */
1325
1476
  onReport?: (ref: SessionRef, report: PipelineReport) => void | Promise<void>;
1477
+ /** Fired for every observed session each tick, after semantic live analysis. */
1478
+ onBatch?: (ref: SessionRef, batch: TraceLiveBatch) => void | Promise<void>;
1479
+ /** Fired once for each newly-observed live semantic finding. */
1480
+ onFinding?: (finding: TraceLiveFinding) => void | Promise<void>;
1326
1481
  /** Per-session parse/pipeline error (the observer keeps going). */
1327
1482
  onError?: (error: unknown, ref?: SessionRef) => void;
1328
1483
  /** Fired after each poll cycle. */
@@ -1330,11 +1485,6 @@ interface ObserverOptions {
1330
1485
  sessions: number;
1331
1486
  }) => void;
1332
1487
  }
1333
- /**
1334
- * Observe active sessions until `opts.signal` aborts. Returns a promise that
1335
- * resolves on abort. Errors in a single session are routed to `onError` and
1336
- * never stop the loop.
1337
- */
1338
1488
  declare function watchSessions(opts: ObserverOptions): Promise<void>;
1339
1489
 
1340
1490
  /**
@@ -1489,4 +1639,4 @@ interface ExecuteOptions {
1489
1639
  /** Send the NEW items (or, on dryRun, write the redacted OTLP that would send). */
1490
1640
  declare function executeUpload(plan: UploadPlan, opts?: ExecuteOptions): Promise<UploadResult>;
1491
1641
 
1492
- export { ACTOR_ATTR, ATTR, type Actor, type AdoptionOptions, type AdoptionReport, AmpAdapter, type AnalyzeOptions, type AnalyzeResult, type BuildPolicyEvidenceOptions, type BuildSessionIndexOptions, type BuildTraceFindingPacketOptions, CODING_REDACTION_RULES, CONTENT_CAP, CORRECTIVE_REACTIONS, ClaudeAdapter, CodexAdapter, type CollectOptions, type CollectPolicyEvidenceOptions, type CollectSessionIndexOptions, CopilotAdapter, DEFAULT_HARNESS, type ExecuteOptions, type ExternalAnalysisResult, type ExternalAnalyzer, FactoryAdapter, type FindingStore, ForgeAdapter, GeminiAdapter, type HarnessTraceAdapter, INGEST_SOURCE_CLI, type ImprovementAdapter, type ImprovementAdapterInput, type ImprovementProposal, type InspectSessionIndexOptions, type LocateOptions, type ObservedLoop, type ObserverOptions, OpencodeAdapter, type OtlpSpan, type OtlpSpanKind, type OtlpStatusCode, PiAdapter, type PipelineOptions, type PipelineReport, type PlanOptions, type PolicyEvidenceLoopSummary, type PolicyEvidenceRecord, type PolicyEvidenceToolSummary, QwenAdapter, REACTIONS, type Reaction, type ReactionReport, type ReactionSessionReport, type RecommendationWriter, type Redactor, type RepoAttrs, type RepoResolution, type RepoResolutionSource, type RunResult, type RuntimeTrace, type ScanOptions, type ScannedSession, type SessionBatch, type SessionRef, type SpanInput, type SpanRedaction, TRACES_REDACTION_RULES, type TraceClaim, type TraceContextIndex, type TraceContextRoot, type TraceEvidenceExportOptions, type TraceEvidenceExportResult, type TraceEvidenceFormatOption, type TraceEvidenceInputFormat, type TraceEvidenceRow, type TraceFindingPacket, type TraceImprovementArtifacts, type TraceImprovementOptions, type TraceImprovementResult, type TraceIndexedFile, type TraceInspectionArea, type TraceInspectionFinding, type TraceInspectionReport, type TraceInspectionSeverity, type TraceInvestigationOptions, type TraceInvestigationResult, type TraceRecommendation, type TraceReplayProof, type TraceSessionIndex, type TraceSessionIndexRow, type TraceStoreInvestigationOptions, type TraceStoreInvestigationResult, type TracesConfig, type TriggerPair, type UploadBackend, type UploadItem, type UploadPlan, type UploadRecord, type UploadResult, type UploadState, type UserPromptInput, alreadyUploaded, analyzeAdoption, analyzeReactions, analyzeSpans, applyRedactor, buildPolicyEvidenceRecord, buildSessionIndex, buildSessionIndexFromRows, buildTraceFindingPacket, capText, classifyReaction, claudeActor, codexActor, collectPolicyEvidence, collectSessionIndex, collectSessions, commandAnalyzer, commandRedactor, countSkillRunsJsonl, executeUpload, exportTraceEvidenceFile, exportTraceEvidenceRows, exportTraceEvidenceText, haloAnalyzer, inspectSessionIndex, knownHarnesses, listAdapters, loadState, loadTracesConfig, looksLikeAgentPrompt, mergeTracesConfig, normalizeRemote, parseIsoToEpochMs, parseSession, parseSince, planUpload, readSessionIndexFile, redactSpans, renderInspectionReport, resolveAdapter, resolveRepoAttrs, resolveSessionRepoAttrs, runCommand, runExternalAnalyzers, runPipelines, runTraceImprovementLoop, runTraceInvestigation, runTraceStoreInvestigation, saveReport, saveState, scanSessions, selectAdapters, serializeInspectionReport, serializePolicyEvidence, serializeSessionIndex, serializeSpans, sessionHash, span, stampRepoAttrs, textIsSynthetic, toOpenInferenceSpan, toRuntimeStore, toTraceSpanEvents, uploadKey, userPromptSpan, watchSessions, writeInspectionReportFile, writeOtlpFile, writePolicyEvidenceFile, writeSessionIndexFile, writeTraceEvidenceExportFile, writeTraceImprovementArtifacts };
1642
+ export { ACTOR_ATTR, ATTR, type Actor, type AdoptionOptions, type AdoptionReport, AmpAdapter, type AnalyzeOptions, type AnalyzeResult, type BuildPolicyEvidenceOptions, type BuildSessionIndexOptions, type BuildTraceFindingPacketOptions, CODING_REDACTION_RULES, CONTENT_CAP, CORRECTIVE_REACTIONS, ClaudeAdapter, CodexAdapter, type CollectOptions, type CollectPolicyEvidenceOptions, type CollectSessionIndexOptions, CopilotAdapter, DEFAULT_HARNESS, type ExecuteOptions, type ExternalAnalysisResult, type ExternalAnalyzer, FactoryAdapter, type FindingStore, ForgeAdapter, GeminiAdapter, type HarnessTraceAdapter, INGEST_SOURCE_CLI, type ImprovementAdapter, type ImprovementAdapterInput, type ImprovementProposal, type InspectSessionIndexOptions, type LiveBatchOptions, type LocateOptions, type ObservedLoop, type ObserverOptions, OpencodeAdapter, type OtlpSpan, type OtlpSpanKind, type OtlpStatusCode, PiAdapter, type PipelineOptions, type PipelineReport, type PlanOptions, type PolicyEvidenceLoopSummary, type PolicyEvidenceRecord, type PolicyEvidenceToolSummary, QwenAdapter, REACTIONS, type Reaction, type ReactionReport, type ReactionSessionReport, type RecommendationWriter, type Redactor, type RepoAttrs, type RepoResolution, type RepoResolutionSource, type RunResult, type RuntimeTrace, type ScanOptions, type ScannedSession, type SessionBatch, type SessionRef, type SpanInput, type SpanRedaction, TRACES_REDACTION_RULES, type TraceClaim, type TraceContextIndex, type TraceContextRoot, type TraceEvidenceExportOptions, type TraceEvidenceExportResult, type TraceEvidenceFormatOption, type TraceEvidenceInputFormat, type TraceEvidenceRow, 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 TraceRecommendation, type TraceReplayProof, type TraceSessionIndex, type TraceSessionIndexRow, type TraceStoreInvestigationOptions, type TraceStoreInvestigationResult, type TraceStreamEvent, type TraceStreamOptions, type TraceStreamReplayOptions, type TraceStreamSession, type TracesConfig, type TriggerPair, type UploadBackend, type UploadItem, type UploadPlan, type UploadRecord, type UploadResult, type UploadState, type UserPromptInput, alreadyUploaded, analyzeAdoption, analyzeLiveBatch, analyzeReactions, analyzeSpans, applyRedactor, buildPolicyEvidenceRecord, buildSessionIndex, buildSessionIndexFromRows, buildTraceFindingPacket, capText, classifyLiveActions, classifyReaction, claudeActor, codexActor, collectPolicyEvidence, collectSessionIndex, collectSessions, commandAnalyzer, commandRedactor, countSkillRunsJsonl, defaultTraceLiveAnalysts, executeUpload, exportTraceEvidenceFile, exportTraceEvidenceRows, exportTraceEvidenceText, haloAnalyzer, inspectSessionIndex, knownHarnesses, listAdapters, loadState, loadTracesConfig, looksLikeAgentPrompt, mergeTracesConfig, normalizeRemote, parseIsoToEpochMs, parseSession, parseSince, planUpload, readSessionIndexFile, redactSpans, renderInspectionReport, resolveAdapter, resolveRepoAttrs, resolveSessionRepoAttrs, runCommand, runExternalAnalyzers, runPipelines, runTraceImprovementLoop, runTraceInvestigation, runTraceStoreInvestigation, saveReport, saveState, scanSessions, selectAdapters, serializeInspectionReport, serializePolicyEvidence, serializeSessionIndex, serializeSpans, serializeTraceStreamEvent, sessionHash, span, stampRepoAttrs, streamSessions, textIsSynthetic, toOpenInferenceSpan, toRuntimeStore, toTraceSpanEvents, traceStreamEventsFromSpans, uploadKey, userPromptSpan, watchSessions, writeInspectionReportFile, writeOtlpFile, writePolicyEvidenceFile, writeSessionIndexFile, writeTraceEvidenceExportFile, writeTraceImprovementArtifacts };
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ import {
20
20
  TRACES_REDACTION_RULES,
21
21
  alreadyUploaded,
22
22
  analyzeAdoption,
23
+ analyzeLiveBatch,
23
24
  analyzeReactions,
24
25
  analyzeSpans,
25
26
  applyRedactor,
@@ -28,6 +29,7 @@ import {
28
29
  buildSessionIndexFromRows,
29
30
  buildTraceFindingPacket,
30
31
  capText,
32
+ classifyLiveActions,
31
33
  classifyReaction,
32
34
  claudeActor,
33
35
  codexActor,
@@ -36,6 +38,7 @@ import {
36
38
  commandAnalyzer,
37
39
  commandRedactor,
38
40
  countSkillRunsJsonl,
41
+ defaultTraceLiveAnalysts,
39
42
  executeUpload,
40
43
  exportTraceEvidenceFile,
41
44
  exportTraceEvidenceRows,
@@ -73,13 +76,16 @@ import {
73
76
  serializePolicyEvidence,
74
77
  serializeSessionIndex,
75
78
  serializeSpans,
79
+ serializeTraceStreamEvent,
76
80
  sessionHash,
77
81
  span,
78
82
  stampRepoAttrs,
83
+ streamSessions,
79
84
  textIsSynthetic,
80
85
  toOpenInferenceSpan,
81
86
  toRuntimeStore,
82
87
  toTraceSpanEvents,
88
+ traceStreamEventsFromSpans,
83
89
  uploadKey,
84
90
  userPromptSpan,
85
91
  watchSessions,
@@ -89,7 +95,7 @@ import {
89
95
  writeSessionIndexFile,
90
96
  writeTraceEvidenceExportFile,
91
97
  writeTraceImprovementArtifacts
92
- } from "./chunk-QM4QAG3V.js";
98
+ } from "./chunk-FCTZLWP7.js";
93
99
 
94
100
  // src/collect.ts
95
101
  async function collectSessions(opts = {}) {
@@ -137,6 +143,7 @@ export {
137
143
  TRACES_REDACTION_RULES,
138
144
  alreadyUploaded,
139
145
  analyzeAdoption,
146
+ analyzeLiveBatch,
140
147
  analyzeReactions,
141
148
  analyzeSpans,
142
149
  applyRedactor,
@@ -146,6 +153,7 @@ export {
146
153
  buildSessionIndexFromRows,
147
154
  buildTraceFindingPacket,
148
155
  capText,
156
+ classifyLiveActions,
149
157
  classifyReaction,
150
158
  claudeActor,
151
159
  codexActor,
@@ -156,6 +164,7 @@ export {
156
164
  commandRedactor,
157
165
  countSkillRunsJsonl,
158
166
  createHostedClient,
167
+ defaultTraceLiveAnalysts,
159
168
  executeUpload,
160
169
  exportTraceEvidenceFile,
161
170
  exportTraceEvidenceRows,
@@ -197,13 +206,16 @@ export {
197
206
  serializePolicyEvidence,
198
207
  serializeSessionIndex,
199
208
  serializeSpans,
209
+ serializeTraceStreamEvent,
200
210
  sessionHash,
201
211
  span,
202
212
  stampRepoAttrs,
213
+ streamSessions,
203
214
  textIsSynthetic,
204
215
  toOpenInferenceSpan,
205
216
  toRuntimeStore,
206
217
  toTraceSpanEvents,
218
+ traceStreamEventsFromSpans,
207
219
  uploadKey,
208
220
  userPromptSpan,
209
221
  watchSessions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/traces",
3
- "version": "0.8.17",
3
+ "version": "0.8.19",
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.",
5
5
  "type": "module",
6
6
  "license": "MIT",