@tangle-network/traces 0.10.2 → 0.11.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 +59 -2
- package/dist/{chunk-LC66I5TE.js → chunk-JCI5YXNT.js} +1162 -47
- package/dist/cli.js +79 -10
- package/dist/index.d.ts +509 -1
- package/dist/index.js +77 -3
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ It reads the transcripts your harness leaves on disk, reconstructs the run as sp
|
|
|
18
18
|
- [Supported harnesses](#supported-harnesses)
|
|
19
19
|
- [CLI reference](#cli-reference)
|
|
20
20
|
- [Live stream](#live-stream)
|
|
21
|
+
- [Watch a run tree](#watch-a-run-tree)
|
|
21
22
|
- [Improvement engine](#improvement-engine)
|
|
22
23
|
- [Session index](#session-index)
|
|
23
24
|
- [Policy-mining evidence](#policy-mining-evidence)
|
|
@@ -124,6 +125,10 @@ traces evidence --harness codex-exec --session /tmp/codex.jsonl --cwd "$PWD" --o
|
|
|
124
125
|
traces export policy-evidence.jsonl --out spans.openinference.jsonl
|
|
125
126
|
traces import-codetracebench verified.jsonl --trajectory-dir normalized --out traces --revision <40-or-64-character-hex>
|
|
126
127
|
traces watch --all # live observer; loops + semantic findings
|
|
128
|
+
traces watch runs/my-run # live run tree: status, budget, driver vs child spend
|
|
129
|
+
traces watch runs/my-run --once # one snapshot, then exit
|
|
130
|
+
traces watch traces.otlp.jsonl # any OTLP span file, any emitter
|
|
131
|
+
traces analyze --supervisor-run-dir runs/my-run # the full tree report
|
|
127
132
|
traces stream --all --mode findings # low-volume semantic feed
|
|
128
133
|
traces stream --all --mode agent # findings + deterministic report events
|
|
129
134
|
traces stream spans.openinference.jsonl --format openinference --no-spans
|
|
@@ -149,10 +154,12 @@ traces upload --since 24h # upload last day to the Inte
|
|
|
149
154
|
| `--format <kind>` | File `analyze`, `export`, or `stream`: `auto`, `policy-evidence`, `sandbox-events`, `openinference`, `intelligence-spans`, or `chat-trajectory` |
|
|
150
155
|
| `--llm` / `--budget <usd>` | Enable agentic analysts (needs `TANGLE_API_KEY` + Python with `agent-eval-rpc[dspy]`) / cap their spend |
|
|
151
156
|
| `--config <path>` | `analyze` / `investigate` / `improve` / `stream`: load BYO analysts, live analysts, and external analyzers |
|
|
152
|
-
| `--interval <s>` / `--window <m>` | `watch` / live `stream`: poll seconds (
|
|
157
|
+
| `--interval <s>` / `--window <m>` | `watch` / live `stream`: poll seconds (sessions 5, run tree 2) / active-session window minutes (default 30) |
|
|
153
158
|
| `--min-loop <n>` | Identical repeated calls before flagging a loop (default 3) |
|
|
154
159
|
| `--mode <kind>` | `stream`: `visualizer` (spans + findings), `findings` (low-volume), or `agent` (findings + reports) |
|
|
155
|
-
| `--
|
|
160
|
+
| `--supervisor-run-dir <dir>` | `analyze`: report one run tree; `watch`: tail it live |
|
|
161
|
+
| `--replay` | `stream`: scan once, then exit |
|
|
162
|
+
| `--once` | `stream`: scan once; `watch <target>`: print ONE snapshot and exit |
|
|
156
163
|
| `--no-spans` / `--no-findings` | `stream`: suppress raw span rows / finding rows |
|
|
157
164
|
| `--no-content` | `upload`: send metadata only; strip all prompt/response text |
|
|
158
165
|
| `--dry-run` / `--yes` | `upload`: preview without sending / skip the confirm prompt |
|
|
@@ -207,6 +214,56 @@ export default {
|
|
|
207
214
|
}
|
|
208
215
|
```
|
|
209
216
|
|
|
217
|
+
## Watch a run tree
|
|
218
|
+
|
|
219
|
+
`traces watch <target>` tails ONE run that fans work out to other agents, instead of one harness session.
|
|
220
|
+
It prints the tree at any depth: per node the status, the runtime, the authored budget, and the actual spend.
|
|
221
|
+
Plain stdout, no cursor control, no extra dependency — it works over SSH, in a CI log, and through a pipe.
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
traces watch runs/my-run # live: reprints only when something changed
|
|
225
|
+
traces watch runs/my-run --once # one snapshot, for a script or an agent
|
|
226
|
+
traces watch traces.otlp.jsonl # spans only, for any emitter
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Two sources sit behind the one verb, and the output always names which number came from which:
|
|
230
|
+
|
|
231
|
+
| Source | Reads | Gives you | Cannot give you |
|
|
232
|
+
|---|---|---|---|
|
|
233
|
+
| **General** — OTLP spans | `trace_id` / `span_id` / `parent_span_id` in any `*.otlp.jsonl`, `*.spans.jsonl`, `*.traces.jsonl` | tree shape, wall time, per-turn tokens, cost when the emitter priced it | the authored budget — no span vocabulary carries one |
|
|
234
|
+
| **Specific** — the spawn journal | `spawn-journal.jsonl` written by agent-runtime's `createFileRunContext` | authored budget, settled spend, settlement status, blocking questions, steers, the typed result | per-turn detail the journal does not tap |
|
|
235
|
+
|
|
236
|
+
The general source is the one that matters for a system nobody has written yet: anything that emits a parent span pointer gets a tree, whether it is a supervisor, a pi session, a Claude subagent fan-out, or a custom fanout.
|
|
237
|
+
Attributes are read through `@tangle-network/agent-eval/trace-attributes` alias lists, so both live vocabularies — OpenInference's `llm.token_count.*` and GenAI semconv's `gen_ai.usage.*` — already work, and no key is invented here.
|
|
238
|
+
|
|
239
|
+
Two rules the view will not bend on:
|
|
240
|
+
|
|
241
|
+
- **Driver inference and child work never merge.** A node that drove and the work it delegated are separate lines, because one total cannot answer "which half spent the budget" — the decisive question in three real runs.
|
|
242
|
+
- **Unknown is never rendered as zero.** A turn the harness did not price reads `cost unknown (n unpriced)`, never `$0.0000`. A recorded `$0` paid on real tokens is printed AND flagged, because "free" and "unmetered" are different facts.
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
run proof-harness-mcp-20260731i
|
|
246
|
+
2 node(s) · depth 1 · elapsed 9m59s
|
|
247
|
+
driver total in 639,632 · out 35,077 · $0.0000 (zero across 58 priced)
|
|
248
|
+
worker total in 47,965 · out 515 · cost unknown (1 unpriced)
|
|
249
|
+
|
|
250
|
+
● · root [pending] supervisor inline budget 12it/400,000tok/$2.00/15m00s
|
|
251
|
+
driver 58 turn(s) · in 639,632 · out 35,077 · $0.0000 (zero across 58 priced) · 169% tok of budget
|
|
252
|
+
children 1 settled · in 47,965 · out 515 · cost unknown (1 unpriced)
|
|
253
|
+
└─ ✗ artifact-writer-s0 [failed] worker pi budget 6it/80,000tok wall 20.8s
|
|
254
|
+
settled 3it · in 47,965 · out 515 · cost unknown (1 unpriced) · 50% it, 61% tok of budget
|
|
255
|
+
|
|
256
|
+
! spend recorded $0 with tokens spent: usdKnown was never set false, so this reads as FREE rather
|
|
257
|
+
than unmetered. A harness-billed brain (a CLI on a subscription) looks exactly like this.
|
|
258
|
+
|
|
259
|
+
RESULT no-winner · budget-exhausted
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
`traces analyze --supervisor-run-dir <dir>` writes the full report for the same run.
|
|
263
|
+
Every metric there comes from `@tangle-network/agent-eval/supervisor-run`; this package contributes a reader, never an analysis.
|
|
264
|
+
|
|
265
|
+
Replay and resume are a separate concern: they belong to the durable spawn journal, and nothing here routes them through telemetry.
|
|
266
|
+
|
|
210
267
|
## Improvement engine
|
|
211
268
|
|
|
212
269
|
`traces improve` turns observed sessions into a portable improvement packet:
|