@tangle-network/traces 0.9.1 → 0.9.2
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 +4 -0
- package/dist/cli.js +47 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -96,6 +96,7 @@ Every adapter captures the full conversation: the **user's prompt** and the **as
|
|
|
96
96
|
|
|
97
97
|
```bash
|
|
98
98
|
traces list --harness claude-code --last 20 # discover sessions
|
|
99
|
+
traces analyze --harness codex --session <id> # pin one ID printed by `list`
|
|
99
100
|
traces analyze --harness codex --last 1 # $0 findings with actions + checks
|
|
100
101
|
traces investigate --all --last 10 --out report.md # explicit investigation alias
|
|
101
102
|
traces improve --all --last 10 --dir .traces/improvement
|
|
@@ -246,6 +247,9 @@ It is intentionally read-only: it points to repeated-call loops, high tool-error
|
|
|
246
247
|
traces evidence --all --since 24h --out policy-evidence.jsonl --otlp spans.otlp.jsonl
|
|
247
248
|
```
|
|
248
249
|
|
|
250
|
+
`--last` follows recent file activity and is useful for live inspection.
|
|
251
|
+
For a reproducible report, run `traces list` first and pass its session ID with `--session`.
|
|
252
|
+
|
|
249
253
|
Each JSONL row is one session:
|
|
250
254
|
|
|
251
255
|
- session provenance: harness, session id, cwd, path, mtime
|
package/dist/cli.js
CHANGED
|
@@ -208,6 +208,50 @@ async function discover(args) {
|
|
|
208
208
|
}
|
|
209
209
|
return out;
|
|
210
210
|
}
|
|
211
|
+
function missingPath(error) {
|
|
212
|
+
return typeof error === "object" && error !== null && error.code === "ENOENT";
|
|
213
|
+
}
|
|
214
|
+
async function resolveSelectedSession(args) {
|
|
215
|
+
if (!args.session) throw new Error("resolveSelectedSession requires --session");
|
|
216
|
+
const adapter = resolveAdapter(args.harness);
|
|
217
|
+
if (!adapter && !args.all) throw new Error(`unknown harness "${args.harness}"`);
|
|
218
|
+
try {
|
|
219
|
+
const st = await stat(args.session);
|
|
220
|
+
if (!adapter) {
|
|
221
|
+
throw new Error("--session <path> requires --harness when --all is set");
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
adapter,
|
|
225
|
+
ref: {
|
|
226
|
+
harness: adapter.harness,
|
|
227
|
+
sessionId: args.session,
|
|
228
|
+
path: args.session,
|
|
229
|
+
// --session is an explicit file; honor --cwd so adoption can find the
|
|
230
|
+
// project's .evolve/skill-runs.jsonl (locate() infers cwd in the scan path).
|
|
231
|
+
cwd: args.cwd ?? null,
|
|
232
|
+
mtimeMs: st.mtimeMs
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
} catch (error) {
|
|
236
|
+
if (!missingPath(error)) throw error;
|
|
237
|
+
}
|
|
238
|
+
const matches = [];
|
|
239
|
+
for (const candidate of args.all ? adaptersFor(args) : [adapter]) {
|
|
240
|
+
const refs = await locateSessions(candidate, { cwd: args.cwd });
|
|
241
|
+
for (const ref of refs) {
|
|
242
|
+
if (ref.sessionId === args.session) matches.push({ adapter: candidate, ref });
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (matches.length === 1) return matches[0];
|
|
246
|
+
if (matches.length === 0) {
|
|
247
|
+
throw new Error(
|
|
248
|
+
`no ${args.all ? "selected" : adapter.harness} session with ID "${args.session}"; run \`traces list\` to select an ID, or pass an explicit session path`
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
throw new Error(
|
|
252
|
+
`session ID "${args.session}" is ambiguous across ${matches.length} files; select one harness or pass its explicit session path`
|
|
253
|
+
);
|
|
254
|
+
}
|
|
211
255
|
async function buildAxService() {
|
|
212
256
|
const apiKey = process.env.OPENAI_API_KEY;
|
|
213
257
|
if (!apiKey) {
|
|
@@ -265,18 +309,7 @@ function selectedSessionSource(ref, spans, sessionIdOverride) {
|
|
|
265
309
|
async function collectSpans(args) {
|
|
266
310
|
if (args.input) return collectImportedSpans(args);
|
|
267
311
|
if (args.session) {
|
|
268
|
-
const adapter =
|
|
269
|
-
if (!adapter) throw new Error(`unknown harness "${args.harness}"`);
|
|
270
|
-
const st = await stat(args.session);
|
|
271
|
-
const ref = {
|
|
272
|
-
harness: adapter.harness,
|
|
273
|
-
sessionId: args.session,
|
|
274
|
-
path: args.session,
|
|
275
|
-
// --session is an explicit file; honor --cwd so adoption can find the
|
|
276
|
-
// project's .evolve/skill-runs.jsonl (locate() infers cwd in the scan path).
|
|
277
|
-
cwd: args.cwd ?? null,
|
|
278
|
-
mtimeMs: st.mtimeMs
|
|
279
|
-
};
|
|
312
|
+
const { adapter, ref } = await resolveSelectedSession(args);
|
|
280
313
|
const spans2 = await parseSession(adapter, ref);
|
|
281
314
|
return {
|
|
282
315
|
spans: spans2,
|
|
@@ -309,16 +342,7 @@ async function cmdConvert(args) {
|
|
|
309
342
|
}
|
|
310
343
|
async function collectSessionRows(args) {
|
|
311
344
|
if (args.session) {
|
|
312
|
-
const adapter =
|
|
313
|
-
if (!adapter) throw new Error(`unknown harness "${args.harness}"`);
|
|
314
|
-
const st = await stat(args.session);
|
|
315
|
-
const ref = {
|
|
316
|
-
harness: adapter.harness,
|
|
317
|
-
sessionId: args.session,
|
|
318
|
-
path: args.session,
|
|
319
|
-
cwd: args.cwd ?? null,
|
|
320
|
-
mtimeMs: st.mtimeMs
|
|
321
|
-
};
|
|
345
|
+
const { adapter, ref } = await resolveSelectedSession(args);
|
|
322
346
|
return [{ ref, spans: await parseSession(adapter, ref) }];
|
|
323
347
|
}
|
|
324
348
|
const groups = await discover({ ...args, last: args.last || 20 });
|
|
@@ -778,7 +802,7 @@ Options:
|
|
|
778
802
|
--harness <id> Harness or alias (default: claude-code). Known: ${knownHarnesses().join(", ")}
|
|
779
803
|
--all Sweep every known harness
|
|
780
804
|
--last <n> Most-recent N sessions
|
|
781
|
-
--session <path> Analyze
|
|
805
|
+
--session <id|path> Analyze one listed session ID or one explicit harness session file
|
|
782
806
|
--cwd <dir> Filter sessions by working directory
|
|
783
807
|
--since <t> upload: window, 30m / 2h / 7d or an ISO date (default 24h); analyze: ISO cutoff
|
|
784
808
|
--out <path> Write report to a file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/traces",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
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",
|