@tangle-network/traces 0.9.3 → 0.9.4

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.
Files changed (2) hide show
  1. package/dist/cli.js +43 -0
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -46,6 +46,14 @@ import {
46
46
  import { readFileSync } from "fs";
47
47
  import { readFile, stat } from "fs/promises";
48
48
  import { basename, resolve } from "path";
49
+ import {
50
+ analyzeSupervisorRun,
51
+ findSupervisorRunDirs,
52
+ isUnavailable,
53
+ renderSupervisorRollupMarkdown,
54
+ renderSupervisorRunMarkdown,
55
+ rollupSupervisorRuns
56
+ } from "@tangle-network/agent-eval/supervisor-run";
49
57
  function packageVersion() {
50
58
  const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
51
59
  if (typeof pkg.version !== "string" || !pkg.version) throw new Error("package.json is missing version");
@@ -92,6 +100,9 @@ function parseArgs(argv) {
92
100
  case "--cwd":
93
101
  a.cwd = next();
94
102
  break;
103
+ case "--supervisor-run-dir":
104
+ a.supervisorRunDir = next();
105
+ break;
95
106
  case "--since":
96
107
  a.since = next();
97
108
  break;
@@ -453,6 +464,7 @@ async function loadExportAttributes(args) {
453
464
  return attributes;
454
465
  }
455
466
  async function cmdAnalyze(args) {
467
+ if (args.supervisorRunDir) return cmdAnalyzeSupervisorRun(args.supervisorRunDir, args);
456
468
  const result = await investigate(args, { loadDefaultConfig: false });
457
469
  if (args.out) {
458
470
  await saveReport(args.out, result.report);
@@ -463,6 +475,32 @@ async function cmdAnalyze(args) {
463
475
  console.log(result.report);
464
476
  }
465
477
  }
478
+ async function cmdAnalyzeSupervisorRun(runDir, args) {
479
+ const nested = await findSupervisorRunDirs(runDir);
480
+ let markdown;
481
+ if (nested.length > 0) {
482
+ markdown = renderSupervisorRollupMarkdown(
483
+ rollupSupervisorRuns(await Promise.all(nested.map((dir) => analyzeSupervisorRun(dir)))),
484
+ `Supervisor rollup \u2014 ${runDir}`
485
+ );
486
+ } else {
487
+ const report = await analyzeSupervisorRun(runDir);
488
+ if (isUnavailable(report.orchestration.workersSpawned)) {
489
+ throw new Error(
490
+ `no supervisor run found at ${runDir} \u2014 expected <runDir>/ws/.loops/supervisor/<id>, or a parent directory containing such runs`
491
+ );
492
+ }
493
+ markdown = renderSupervisorRunMarkdown(report);
494
+ }
495
+ if (args.out) {
496
+ await saveReport(args.out, markdown);
497
+ console.log(
498
+ `supervisor report \u2192 ${args.out} (${nested.length > 0 ? `${nested.length} runs` : "1 run"})`
499
+ );
500
+ } else {
501
+ console.log(markdown);
502
+ }
503
+ }
466
504
  async function collectImportedSpans(args) {
467
505
  if (!args.input) throw new Error("input file missing");
468
506
  const attributes = await loadExportAttributes(args);
@@ -787,6 +825,7 @@ function usage() {
787
825
  Commands:
788
826
  list List discovered sessions
789
827
  analyze Run analyst suite + loop/waste pipelines over sessions or an input file
828
+ (--supervisor-run-dir <dir> reports a supervision tree instead)
790
829
  investigate Run typed investigation flow, including BYO config + evidence-backed actions
791
830
  improve Write findings, evidence, report, and canonical trace artifacts
792
831
  convert Emit OTLP-JSONL only (HALO: use analyze --analyzer halo)
@@ -804,6 +843,10 @@ Options:
804
843
  --last <n> Most-recent N sessions
805
844
  --session <id|path> Analyze one listed session ID or one explicit harness session file
806
845
  --cwd <dir> Filter sessions by working directory
846
+ --supervisor-run-dir <dir>
847
+ analyze: report a SUPERVISION TREE instead of harness sessions \u2014
848
+ steers, spawn waves, concurrency, idle wall, cost by role,
849
+ accepted vs rejected. Rolls up when the dir holds many runs.
807
850
  --since <t> upload: window, 30m / 2h / 7d or an ISO date (default 24h); analyze: ISO cutoff
808
851
  --out <path> Write report to a file
809
852
  --dir <path> improve: write artifacts to this directory
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/traces",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
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",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@ax-llm/ax": "^23.0.1",
48
- "@tangle-network/agent-eval": "^0.122.8"
48
+ "@tangle-network/agent-eval": "^0.124.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "^22.0.0",