@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/README.md +43 -5
- package/dist/{chunk-QM4QAG3V.js → chunk-FCTZLWP7.js} +520 -118
- package/dist/cli.js +151 -6
- package/dist/index.d.ts +176 -26
- package/dist/index.js +13 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ It reads the transcripts your harness leaves on disk, reconstructs the run as sp
|
|
|
17
17
|
- [What it finds](#what-it-finds)
|
|
18
18
|
- [Supported harnesses](#supported-harnesses)
|
|
19
19
|
- [CLI reference](#cli-reference)
|
|
20
|
+
- [Live stream](#live-stream)
|
|
20
21
|
- [Improvement engine](#improvement-engine)
|
|
21
22
|
- [Session index](#session-index)
|
|
22
23
|
- [Policy-mining evidence](#policy-mining-evidence)
|
|
@@ -44,6 +45,8 @@ Requires Node ≥ 22.
|
|
|
44
45
|
```bash
|
|
45
46
|
traces analyze --harness claude-code --last 1
|
|
46
47
|
traces improve --harness claude-code --last 5 --dir .traces/improvement
|
|
48
|
+
traces watch --all
|
|
49
|
+
traces stream --all --no-spans
|
|
47
50
|
```
|
|
48
51
|
|
|
49
52
|
That's the command in the demo above. The **deterministic pass** — stuck loops, token growth, output decay, missing self-verification, tool monoculture — needs no API key and costs nothing.
|
|
@@ -100,7 +103,10 @@ traces index --all --since 24h --out session-index.json
|
|
|
100
103
|
traces inspect session-index.json --out inspection-report.md
|
|
101
104
|
traces evidence --harness codex --last 20 --out policy-evidence.jsonl
|
|
102
105
|
traces export policy-evidence.jsonl --out spans.openinference.jsonl
|
|
103
|
-
traces watch --all # live observer;
|
|
106
|
+
traces watch --all # live observer; loops + semantic findings
|
|
107
|
+
traces stream --all --mode findings # low-volume semantic feed
|
|
108
|
+
traces stream --all --mode agent # findings + deterministic report events
|
|
109
|
+
traces stream spans.openinference.jsonl --format openinference --no-spans
|
|
104
110
|
traces upload --since 1h --dry-run # redact + dedup + preview, no network
|
|
105
111
|
traces upload --since 24h # upload last day to the Intelligence Platform
|
|
106
112
|
```
|
|
@@ -116,14 +122,37 @@ traces upload --since 24h # upload last day to the Inte
|
|
|
116
122
|
| `--out <path>` | Write the report to a file |
|
|
117
123
|
| `--dir <path>` | `improve`: write the full artifact pack to this directory |
|
|
118
124
|
| `--otlp <path>` | OTLP artifact path (also evidence provenance / dry-run upload preview) |
|
|
119
|
-
| `--format <kind>` | `export`: `auto`, `policy-evidence`, `sandbox-events`, or `openinference` |
|
|
125
|
+
| `--format <kind>` | `export` / file `stream`: `auto`, `policy-evidence`, `sandbox-events`, or `openinference` |
|
|
120
126
|
| `--llm` / `--budget <usd>` | Enable agentic analysts (needs `OPENAI_API_KEY`) / cap their spend |
|
|
121
|
-
| `--config <path>` | `investigate` / `improve`: load BYO analysts, external analyzers, and proposal adapters |
|
|
122
|
-
| `--interval <s>` / `--window <m>` | `watch`: poll seconds (default 5) / active-session window minutes (default 30) |
|
|
127
|
+
| `--config <path>` | `investigate` / `improve` / `stream`: load BYO analysts, live analysts, external analyzers, and proposal adapters |
|
|
128
|
+
| `--interval <s>` / `--window <m>` | `watch` / live `stream`: poll seconds (default 5) / active-session window minutes (default 30) |
|
|
123
129
|
| `--min-loop <n>` | Identical repeated calls before flagging a loop (default 3) |
|
|
130
|
+
| `--mode <kind>` | `stream`: `visualizer` (spans + findings), `findings` (low-volume), or `agent` (findings + reports) |
|
|
131
|
+
| `--replay` / `--once` | `stream`: scan once, then exit |
|
|
132
|
+
| `--no-spans` / `--no-findings` | `stream`: suppress raw span rows / finding rows |
|
|
124
133
|
| `--no-content` | `upload`: send metadata only — strip all prompt/response text |
|
|
125
134
|
| `--dry-run` / `--yes` | `upload`: preview without sending / skip the confirm prompt |
|
|
126
135
|
|
|
136
|
+
## Live stream
|
|
137
|
+
|
|
138
|
+
`traces watch` is the human terminal view.
|
|
139
|
+
It prints repeated-tool loops and semantic findings while a coding agent is still running.
|
|
140
|
+
|
|
141
|
+
`traces stream` is the machine feed.
|
|
142
|
+
It emits newline-delimited JSON events that a dashboard, art visualizer, local watcher, or hosted product can consume without scraping terminal prose.
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
traces stream --all
|
|
146
|
+
traces stream --all --mode findings
|
|
147
|
+
traces stream --all --mode agent --config traces.config.mjs
|
|
148
|
+
traces stream spans.openinference.jsonl --format openinference --no-spans
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Live streaming emits `session`, `span`, `analysis_batch`, `finding`, and `tick` events; `--mode agent` also emits `report` events.
|
|
152
|
+
The semantic findings currently cover repeated failing commands, verification churn without code/config changes, completion claims without later verification, and high tool-error rates.
|
|
153
|
+
Use `--mode findings` when you want the low-volume meaning layer; keep `visualizer` for real-time views that need motion, timing, and tool-call texture.
|
|
154
|
+
Use `--mode agent` when another agent needs deterministic loop/tool-use reports alongside the findings.
|
|
155
|
+
|
|
127
156
|
## Improvement engine
|
|
128
157
|
|
|
129
158
|
`traces improve` turns observed sessions into a portable improvement packet:
|
|
@@ -152,6 +181,7 @@ traces improve --last 5 --config examples/improvement-config.mjs --dir .traces/i
|
|
|
152
181
|
The config can export:
|
|
153
182
|
|
|
154
183
|
- `analysts`: deterministic or LLM analysts that implement the `agent-eval` `Analyst` contract
|
|
184
|
+
- `liveAnalysts`: deterministic online analysts that implement the `TraceLiveAnalyst` contract for `traces stream`
|
|
155
185
|
- `registry`: a prebuilt `AnalystRegistry`
|
|
156
186
|
- `externalAnalyzers`: HALO or any command/model adapter that reads the OTLP artifact
|
|
157
187
|
- `improvementAdapter`: a proposal writer that maps recommendations to patches, profile edits, prompts, or validation commands
|
|
@@ -289,6 +319,11 @@ The CLI is a thin consumer of these exports.
|
|
|
289
319
|
| `runTraceStoreInvestigation` | `({ traceStore }) → TraceStoreInvestigationResult` | run the same packet layer over a hosted/custom `TraceAnalysisStore` |
|
|
290
320
|
| `loadTracesConfig` | `(path?) → TracesConfig \| undefined` | load BYO analysts, external analyzers, and proposal adapters |
|
|
291
321
|
| `watchSessions` | `(ObserverOptions) → Promise<void>` | live observer; `onLoop` / `onReport` / `signal` / `adapters` |
|
|
322
|
+
| `streamSessions` | `(TraceStreamOptions) → Promise<void>` | live JSONL-ready event stream over active sessions |
|
|
323
|
+
| `traceStreamEventsFromSpans` | `(spans, opts?) → TraceStreamEvent[]` | replay an existing span list as stream events |
|
|
324
|
+
| `analyzeLiveBatch` | `(spans, opts?) → TraceLiveBatch` | compute semantic online findings for one batch |
|
|
325
|
+
| `classifyLiveActions` | `(spans) → TraceLiveAction[]` | classify spans once as read/edit/verify/claim/tool/other |
|
|
326
|
+
| `defaultTraceLiveAnalysts` | `TraceLiveAnalyst[]` | the built-in online analysts; extend or replace them |
|
|
292
327
|
| `collectSessionIndex` | `(ScanOptions) → TraceSessionIndex` | scan sessions and return a reusable JSON-ready catalog |
|
|
293
328
|
| `inspectSessionIndex` | `(TraceSessionIndex) → TraceInspectionReport` | rank improvement findings from an index without rescanning sessions |
|
|
294
329
|
| `buildPolicyEvidenceRecord` | `(ref, spans, opts?) → PolicyEvidenceRecord` | summarize one session for downstream policy mining |
|
|
@@ -303,12 +338,15 @@ The CLI is a thin consumer of these exports.
|
|
|
303
338
|
| `ExternalAnalyzer` / `Redactor` | `haloAnalyzer` / `commandAnalyzer` / `commandRedactor` | drive engines/models you install (not bundled) |
|
|
304
339
|
|
|
305
340
|
```ts
|
|
306
|
-
import { watchSessions, analyzeSpans, AnalystRegistry, makeFinding } from '@tangle-network/traces'
|
|
341
|
+
import { watchSessions, streamSessions, analyzeSpans, AnalystRegistry, makeFinding } from '@tangle-network/traces'
|
|
307
342
|
|
|
308
343
|
// Observe live sessions, feed findings anywhere (read-only, cancellable):
|
|
309
344
|
const c = new AbortController()
|
|
310
345
|
await watchSessions({ all: true, signal: c.signal, onLoop: (l) => alert(l.toolName, l.occurrences) })
|
|
311
346
|
|
|
347
|
+
// Feed a visualizer or dashboard:
|
|
348
|
+
await streamSessions({ all: true, signal: c.signal, includeSpans: false, onEvent: (event) => console.log(event) })
|
|
349
|
+
|
|
312
350
|
// Run your own analyst instead of the built-ins:
|
|
313
351
|
const registry = new AnalystRegistry()
|
|
314
352
|
registry.register({
|