@tangle-network/traces 0.9.19 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -147,7 +147,7 @@ traces upload --since 24h # upload last day to the Inte
147
147
  | `--dir <path>` | `improve`: write the full artifact pack to this directory |
148
148
  | `--otlp <path>` | OTLP artifact path (also evidence provenance / dry-run upload preview) |
149
149
  | `--format <kind>` | File `analyze`, `export`, or `stream`: `auto`, `policy-evidence`, `sandbox-events`, `openinference`, `intelligence-spans`, or `chat-trajectory` |
150
- | `--llm` / `--budget <usd>` | Enable agentic analysts (needs `OPENAI_API_KEY`) / cap their spend |
150
+ | `--llm` / `--budget <usd>` | Enable agentic analysts (needs `TANGLE_API_KEY` + Python with `agent-eval-rpc[dspy]`) / cap their spend |
151
151
  | `--config <path>` | `analyze` / `investigate` / `improve` / `stream`: load BYO analysts, live analysts, and external analyzers |
152
152
  | `--interval <s>` / `--window <m>` | `watch` / live `stream`: poll seconds (default 5) / active-session window minutes (default 30) |
153
153
  | `--min-loop <n>` | Identical repeated calls before flagging a loop (default 3) |
@@ -373,7 +373,10 @@ traces upload --since 24h --dry-run --redactor "my-pii-scrubber"
373
373
  In the SDK these are the `ExternalAnalyzer` and `Redactor` interfaces (`haloAnalyzer`, `hodoscopeAnalyzer`, `commandAnalyzer`, `commandRedactor`, `applyRedactor`, `runExternalAnalyzers`).
374
374
  See [`examples/external-engines.ts`](./examples/external-engines.ts).
375
375
 
376
- > For the built-in agentic analysts (`--llm`), set `OPENAI_API_KEY`, or point at any OpenAI-compatible gateway with `OPENAI_BASE_URL` (e.g. an internal router) to use a non-OpenAI key.
376
+ > The built-in agentic analysts (`--llm`) run on the Tangle router by default: set `TANGLE_API_KEY`.
377
+ > `OPENAI_API_KEY` alone targets OpenAI instead, and `OPENAI_BASE_URL` overrides the endpoint for any other OpenAI-compatible gateway.
378
+ > `--llm` also needs a Python interpreter with `agent-eval-rpc[dspy]` installed, because agent-eval's model-backed analysts run through the DSPy RLM engine out of process; set `TRACES_PYTHON` to choose the interpreter.
379
+ > Every deterministic command — `list`, `analyze` without `--llm`, `convert`, `index`, `inspect`, `export`, `evidence`, `stream`, `watch`, `analyze --supervisor-run-dir` — needs neither a key nor Python.
377
380
 
378
381
  ## Agent skills
379
382
 
@@ -8973,13 +8973,12 @@ async function analyzeSpans(spans, opts = {}) {
8973
8973
  const detRegistry = opts.registry ?? buildDefaultAnalystRegistry({ registry: { log: opts.log } });
8974
8974
  const result = await detRegistry.run(runId, { traceStore: detStore }, { signal: opts.signal });
8975
8975
  opts.signal?.throwIfAborted();
8976
- if (opts.ai || opts.agenticRegistry) {
8976
+ if (opts.engine || opts.agenticRegistry) {
8977
8977
  const agStore = new OtlpFileTraceStore({ path: otlpPath, maxFileBytes: GENERATED_TRACE_FILE_CEILING });
8978
8978
  await agStore.ensureIndexed();
8979
8979
  const agRegistry = opts.agenticRegistry ?? buildDefaultAnalystRegistry({
8980
- ai: opts.ai,
8981
- model: opts.model,
8982
- kinds: opts.agenticKinds,
8980
+ engine: opts.engine,
8981
+ ...opts.agenticKinds ? { definitions: opts.agenticKinds } : {},
8983
8982
  includeBehavioral: false,
8984
8983
  registry: { log: opts.log }
8985
8984
  });
@@ -9973,9 +9972,9 @@ async function runTraceInvestigation(opts) {
9973
9972
  ]);
9974
9973
  opts.signal?.throwIfAborted();
9975
9974
  const deterministic = deterministicFindings(pipelines, reactions, adoption, opts.spans);
9976
- const agenticRoute = opts.ai && !opts.agenticRegistry ? planTraceAgenticRoute(pipelines, reactions) : void 0;
9975
+ const agenticRoute = opts.engine && !opts.agenticRegistry ? planTraceAgenticRoute(pipelines, reactions) : void 0;
9977
9976
  const analysis = await analyzeSpans(opts.spans, {
9978
- ai: opts.ai,
9977
+ engine: opts.engine,
9979
9978
  model: opts.model,
9980
9979
  budgetUsd: opts.budgetUsd,
9981
9980
  registry: opts.registry,
@@ -10025,8 +10024,7 @@ async function runTraceStoreInvestigation(opts) {
10025
10024
  opts.signal?.throwIfAborted();
10026
10025
  const generatedAt = opts.generatedAt ?? (/* @__PURE__ */ new Date()).toISOString();
10027
10026
  const registry = opts.registry ?? buildDefaultAnalystRegistry2({
10028
- ai: opts.ai,
10029
- model: opts.model,
10027
+ ...opts.engine ? { engine: opts.engine } : {},
10030
10028
  registry: { log: opts.log }
10031
10029
  });
10032
10030
  const runId = opts.runId ?? `traces-store-investigation-${Date.parse(generatedAt) || Date.now()}`;
package/dist/cli.js CHANGED
@@ -44,7 +44,7 @@ import {
44
44
  writePolicyEvidenceFile,
45
45
  writeSessionIndexFile,
46
46
  writeTraceEvidenceExportFile
47
- } from "./chunk-WCJVRJD5.js";
47
+ } from "./chunk-7BQ2CVEA.js";
48
48
 
49
49
  // src/cli.ts
50
50
  import { readFileSync } from "fs";
@@ -58,8 +58,9 @@ import {
58
58
  renderSupervisorRunMarkdown,
59
59
  rollupSupervisorRuns
60
60
  } from "@tangle-network/agent-eval/supervisor-run";
61
- import { createAnalystAi } from "@tangle-network/agent-eval/analyst";
61
+ import { createDspyRlmTraceEngine } from "@tangle-network/agent-eval/analyst";
62
62
  var DEFAULT_ANALYST_MODEL = "gpt-5-mini";
63
+ var TANGLE_ROUTER_BASE_URL = "https://router.tangle.tools/v1";
63
64
  function packageVersion() {
64
65
  const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
65
66
  if (typeof pkg.version !== "string" || !pkg.version) throw new Error("package.json is missing version");
@@ -346,15 +347,23 @@ async function resolveSelectedSession(args) {
346
347
  `session ID "${args.session}" is ambiguous across ${matches.length} files; select one harness or pass its explicit session path`
347
348
  );
348
349
  }
349
- async function buildAxService(model) {
350
- const apiKey = process.env.OPENAI_API_KEY;
350
+ function buildAnalysisEngine(model) {
351
+ const tangleKey = process.env.TANGLE_API_KEY;
352
+ const openAiKey = process.env.OPENAI_API_KEY;
353
+ const apiKey = tangleKey || openAiKey;
351
354
  if (!apiKey) {
352
355
  throw new Error(
353
- "--llm needs OPENAI_API_KEY: an OpenAI key, or a router/gateway key with OPENAI_BASE_URL set to an OpenAI-compatible endpoint (e.g. the Tangle router). Deterministic analysis needs no key."
356
+ "--llm needs a model key: TANGLE_API_KEY for the Tangle router (the default endpoint), or OPENAI_API_KEY for OpenAI. Set OPENAI_BASE_URL to target any other OpenAI-compatible gateway. Deterministic analysis needs no key."
354
357
  );
355
358
  }
356
- const apiURL = process.env.OPENAI_BASE_URL || void 0;
357
- return createAnalystAi({ apiKey, baseUrl: apiURL, model });
359
+ const baseUrl = process.env.OPENAI_BASE_URL || (tangleKey ? TANGLE_ROUTER_BASE_URL : "https://api.openai.com/v1");
360
+ const python = process.env.TRACES_PYTHON;
361
+ return createDspyRlmTraceEngine({
362
+ apiKey,
363
+ baseUrl,
364
+ model,
365
+ ...python ? { runner: { command: python } } : {}
366
+ });
358
367
  }
359
368
  async function cmdList(args) {
360
369
  const groups = await discover({ ...args, last: args.last || 20 });
@@ -640,7 +649,7 @@ async function cmdAnalyzeSupervisorRun(runDir, args) {
640
649
  const report = await analyzeSupervisorRun(runDir);
641
650
  if (isUnavailable(report.orchestration.workersSpawned)) {
642
651
  throw new Error(
643
- `no supervisor run found at ${runDir} \u2014 expected <runDir>/ws/.loops/supervisor/<id>, or a parent directory containing such runs`
652
+ `no supervisor run found at ${runDir} \u2014 expected <runDir>/ws/.agent/supervisor/<id> (or the pre-rename <runDir>/ws/.loops/supervisor/<id>), or a parent directory containing such runs`
644
653
  );
645
654
  }
646
655
  markdown = renderSupervisorRunMarkdown(report);
@@ -702,7 +711,7 @@ async function investigate(args, options = {}) {
702
711
  if (spans.length === 0) throw new Error("no spans found for the given selection");
703
712
  const config = args.config !== void 0 || options.loadDefaultConfig !== false ? await loadTracesConfig(args.config) : void 0;
704
713
  const analystModel = args.model ?? process.env.TRACES_ANALYST_MODEL ?? DEFAULT_ANALYST_MODEL;
705
- const ai = args.llm ? await buildAxService(analystModel) : void 0;
714
+ const engine = args.llm ? buildAnalysisEngine(analystModel) : void 0;
706
715
  return runTraceInvestigation(mergeTracesConfig({
707
716
  spans,
708
717
  harness,
@@ -710,7 +719,7 @@ async function investigate(args, options = {}) {
710
719
  workflow,
711
720
  cwds,
712
721
  minLoopOccurrences: args.minLoop,
713
- ai,
722
+ engine,
714
723
  model: args.llm ? analystModel : args.model,
715
724
  budgetUsd: args.budget,
716
725
  otlpOutPath: args.otlp,
@@ -725,7 +734,7 @@ async function cmdImprove(args) {
725
734
  if (spans.length === 0) throw new Error("no spans found for the given selection");
726
735
  const config = await loadTracesConfig(args.config);
727
736
  const analystModel = args.model ?? process.env.TRACES_ANALYST_MODEL ?? DEFAULT_ANALYST_MODEL;
728
- const ai = args.llm ? await buildAxService(analystModel) : void 0;
737
+ const engine = args.llm ? buildAnalysisEngine(analystModel) : void 0;
729
738
  const result = await runTraceImprovement({
730
739
  ...mergeTracesConfig({
731
740
  spans,
@@ -734,7 +743,7 @@ async function cmdImprove(args) {
734
743
  workflow,
735
744
  cwds,
736
745
  minLoopOccurrences: args.minLoop,
737
- ai,
746
+ engine,
738
747
  model: args.llm ? analystModel : args.model,
739
748
  budgetUsd: args.budget,
740
749
  otlpOutPath: args.otlp,
@@ -1039,7 +1048,10 @@ Options:
1039
1048
  --replay, --once stream: scan once and exit (default for positional input / --session)
1040
1049
  --no-spans stream: omit per-span pulse events
1041
1050
  --no-findings stream: omit semantic live-finding events
1042
- --llm Enable agentic RLM analysts (needs OPENAI_API_KEY / OPENAI_BASE_URL)
1051
+ --llm Enable agentic RLM analysts. Runs on the Tangle router by
1052
+ default (TANGLE_API_KEY); OPENAI_API_KEY alone targets OpenAI,
1053
+ OPENAI_BASE_URL overrides the endpoint. Needs Python with
1054
+ agent-eval-rpc[dspy] (TRACES_PYTHON selects the interpreter).
1043
1055
  --model <id> Model for --llm, HALO, and Hodoscope (default for --llm: ${DEFAULT_ANALYST_MODEL})
1044
1056
  --config <path> investigate/improve/stream: JS config with analysts, liveAnalysts, or external analyzers
1045
1057
  --budget <usd> USD cap for agentic analysts
package/dist/index.d.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { ToolUseMetrics, InMemoryTraceStore } from '@tangle-network/agent-eval';
2
2
  import { StuckLoopReport, FailureClusterReport } from '@tangle-network/agent-eval/pipelines';
3
- import { TraceAnalystKindSpec, AnalystRegistry, AnalystFinding, buildDefaultAnalystRegistry, AnalystRunResult, Analyst } from '@tangle-network/agent-eval/analyst';
3
+ import { TraceAnalystDefinition, TraceAnalysisEngine, AnalystRegistry, AnalystFinding, buildDefaultAnalystRegistry, AnalystRunResult, Analyst } from '@tangle-network/agent-eval/analyst';
4
4
  export { Analyst, AnalystContext, AnalystFinding, AnalystRegistry, buildDefaultAnalystRegistry, makeFinding } from '@tangle-network/agent-eval/analyst';
5
- import { AxAIService } from '@ax-llm/ax';
6
5
  import { ExecutionReport } from '@tangle-network/agent-eval/contract';
7
6
  import { TraceAnalysisStore, RedactionRule, RedactionReport } from '@tangle-network/agent-eval/traces';
8
7
  export { DEFAULT_REDACTION_RULES, ErrorCluster, RedactionReport, RedactionRule, TraceAnalysisStore, redactString, redactValue } from '@tangle-network/agent-eval/traces';
@@ -1154,7 +1153,7 @@ interface TraceAgenticRoute {
1154
1153
  */
1155
1154
  declare function planTraceAgenticRoute(pipelines: PipelineReport, reactions: ReactionReport): TraceAgenticRoute;
1156
1155
  /** Resolve a route into the maintained agent-eval kind specifications. */
1157
- declare function traceAgenticKinds(route: TraceAgenticRoute): readonly TraceAnalystKindSpec[];
1156
+ declare function traceAgenticKinds(route: TraceAgenticRoute): readonly TraceAnalystDefinition[];
1158
1157
 
1159
1158
  /**
1160
1159
  * Project normalized `OtlpSpan[]` onto agent-eval's runtime trace store.
@@ -1190,8 +1189,12 @@ declare function toRuntimeStore(spans: readonly OtlpSpan[]): Promise<RuntimeTrac
1190
1189
  */
1191
1190
 
1192
1191
  interface AnalyzeOptions {
1193
- /** Ax service enabling the agentic RLM kinds. Omit → deterministic only. */
1194
- ai?: AxAIService;
1192
+ /**
1193
+ * Recursive analysis engine enabling the agentic analyst kinds. Omit →
1194
+ * deterministic only. The engine's id, version, and model become the
1195
+ * exact-run identity of every analyst it executes.
1196
+ */
1197
+ engine?: TraceAnalysisEngine;
1195
1198
  model?: string;
1196
1199
  /** USD cap across agentic analysts. */
1197
1200
  budgetUsd?: number;
@@ -1206,7 +1209,7 @@ interface AnalyzeOptions {
1206
1209
  * deterministic pass and receives its compact findings as prior context. */
1207
1210
  agenticRegistry?: AnalystRegistry;
1208
1211
  /** Select a subset of agent-eval's maintained trace analyst kinds. */
1209
- agenticKinds?: readonly TraceAnalystKindSpec[];
1212
+ agenticKinds?: readonly TraceAnalystDefinition[];
1210
1213
  /** Compact deterministic findings that agents receive before reading spans. */
1211
1214
  agenticPriorFindings?: readonly AnalystFinding[];
1212
1215
  /** Where to write the OTLP-JSONL artifact. Defaults to a temp file. */
@@ -1827,7 +1830,7 @@ interface TraceInvestigationOptions {
1827
1830
  readonly workflow?: SessionWorkflowSummary;
1828
1831
  readonly cwds?: readonly string[];
1829
1832
  readonly minLoopOccurrences?: number;
1830
- readonly ai?: AxAIService;
1833
+ readonly engine?: TraceAnalysisEngine;
1831
1834
  readonly model?: string;
1832
1835
  readonly budgetUsd?: number;
1833
1836
  readonly registry?: AnalystRegistry;
@@ -1897,7 +1900,7 @@ interface BuildTraceFindingPacketOptions {
1897
1900
  interface TraceStoreInvestigationOptions {
1898
1901
  readonly traceStore: TraceAnalysisStore;
1899
1902
  readonly registry?: AnalystRegistry;
1900
- readonly ai?: AxAIService;
1903
+ readonly engine?: TraceAnalysisEngine;
1901
1904
  readonly model?: string;
1902
1905
  readonly budgetUsd?: number;
1903
1906
  readonly runId?: string;
package/dist/index.js CHANGED
@@ -131,7 +131,7 @@ import {
131
131
  writeSessionIndexFile,
132
132
  writeTraceEvidenceExportFile,
133
133
  writeTraceImprovementArtifacts
134
- } from "./chunk-WCJVRJD5.js";
134
+ } from "./chunk-7BQ2CVEA.js";
135
135
 
136
136
  // src/collect.ts
137
137
  async function collectSessions(opts = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/traces",
3
- "version": "0.9.19",
3
+ "version": "0.10.1",
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",
@@ -47,8 +47,7 @@
47
47
  "node": ">=22"
48
48
  },
49
49
  "dependencies": {
50
- "@ax-llm/ax": "^23.0.6",
51
- "@tangle-network/agent-eval": "0.137.0"
50
+ "@tangle-network/agent-eval": "0.139.3"
52
51
  },
53
52
  "devDependencies": {
54
53
  "@types/node": "^22.0.0",