@tangle-network/traces 0.9.19 → 0.10.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/README.md +5 -2
- package/dist/{chunk-WCJVRJD5.js → chunk-7BQ2CVEA.js} +6 -8
- package/dist/cli.js +24 -12
- package/dist/index.d.ts +11 -8
- package/dist/index.js +1 -1
- package/package.json +2 -3
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 `
|
|
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
|
-
>
|
|
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.
|
|
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
|
-
|
|
8981
|
-
|
|
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.
|
|
9975
|
+
const agenticRoute = opts.engine && !opts.agenticRegistry ? planTraceAgenticRoute(pipelines, reactions) : void 0;
|
|
9977
9976
|
const analysis = await analyzeSpans(opts.spans, {
|
|
9978
|
-
|
|
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
|
-
|
|
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-
|
|
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 {
|
|
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
|
-
|
|
350
|
-
const
|
|
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
|
|
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
|
|
357
|
-
|
|
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 });
|
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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 {
|
|
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
|
|
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
|
-
/**
|
|
1194
|
-
|
|
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
|
|
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
|
|
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
|
|
1903
|
+
readonly engine?: TraceAnalysisEngine;
|
|
1901
1904
|
readonly model?: string;
|
|
1902
1905
|
readonly budgetUsd?: number;
|
|
1903
1906
|
readonly runId?: string;
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/traces",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
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
|
-
"@
|
|
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",
|