@tangle-network/traces 0.8.12 → 0.8.13

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 +33 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -45,15 +45,40 @@ var SEVERITY_BADGE = {
45
45
  low: "\u{1F535} LOW",
46
46
  info: "\u2139\uFE0F INFO"
47
47
  };
48
+ function deterministicSummaryText(summary) {
49
+ const parts = [];
50
+ if (summary.stuckLoops > 0) parts.push(`${summary.stuckLoops} stuck loop(s)`);
51
+ if (summary.reactionSignals > 0) parts.push(`${summary.reactionSignals} human reaction signal(s)`);
52
+ if (summary.toolErrorRuns > 0) parts.push(`${summary.toolErrorRuns} tool-error run(s)`);
53
+ if (parts.length === 0) return "0 deterministic signals";
54
+ if (parts.length === 1) return parts[0];
55
+ return `${parts.slice(0, -1).join(", ")} and ${parts[parts.length - 1]}`;
56
+ }
57
+ function plural(count, singular, pluralForm = `${singular}s`) {
58
+ return count === 1 ? singular : pluralForm;
59
+ }
60
+ function summarizeDeterministicSignals(pipelines, reactions) {
61
+ const stuckLoops = pipelines.stuckLoops.findings.length;
62
+ const reactionSignals = Object.values(reactions.signals).reduce((total, count) => total + count, 0);
63
+ const toolErrorRuns = pipelines.toolUse.filter((run) => run.errorRate > 0).length;
64
+ return {
65
+ stuckLoops,
66
+ reactionSignals,
67
+ toolErrorRuns,
68
+ totalSignals: stuckLoops + reactionSignals + toolErrorRuns
69
+ };
70
+ }
48
71
  function renderReport(result, meta) {
49
72
  const lines = [];
50
73
  const findings = [...result.findings].sort(
51
74
  (a, b) => (SEVERITY_RANK[a.severity] ?? 9) - (SEVERITY_RANK[b.severity] ?? 9)
52
75
  );
76
+ const deterministic = meta.deterministic ?? { stuckLoops: 0, reactionSignals: 0, toolErrorRuns: 0, totalSignals: 0 };
77
+ const findingSummary = deterministic.totalSignals > 0 ? `${findings.length} analyst ${plural(findings.length, "finding")} + ${deterministic.totalSignals} deterministic ${plural(deterministic.totalSignals, "signal")}` : `${findings.length} ${plural(findings.length, "finding")}`;
53
78
  lines.push(`# Trace analysis \u2014 ${meta.harness}`);
54
79
  lines.push("");
55
80
  lines.push(
56
- `${meta.sessionCount} session(s), ${meta.spanCount} spans \u2192 **${findings.length} findings** across ${result.per_analyst.length} analyst(s). Cost: $${result.total_cost_usd.toFixed(4)}.`
81
+ `${meta.sessionCount} session(s), ${meta.spanCount} spans \u2192 **${findingSummary}** across ${result.per_analyst.length} analyst(s). Cost: $${result.total_cost_usd.toFixed(4)}.`
57
82
  );
58
83
  lines.push("");
59
84
  lines.push("| Analyst | Status | Findings | Latency |");
@@ -62,8 +87,12 @@ function renderReport(result, meta) {
62
87
  lines.push(`| \`${s.analyst_id}\` | ${s.status} | ${s.findings_count} | ${s.latency_ms}ms |`);
63
88
  }
64
89
  lines.push("");
65
- if (findings.length === 0) {
90
+ if (findings.length === 0 && deterministic.totalSignals === 0) {
66
91
  lines.push("_No findings \u2014 no behavioral inefficiencies or failure modes detected._");
92
+ } else if (findings.length === 0) {
93
+ lines.push(
94
+ `_No analyst findings. Deterministic checks found ${deterministicSummaryText(deterministic)}; see sections below._`
95
+ );
67
96
  } else {
68
97
  const byArea = /* @__PURE__ */ new Map();
69
98
  for (const f of findings) {
@@ -526,7 +555,8 @@ async function cmdAnalyze(args) {
526
555
  const pipelines = await runPipelines(spans, { minLoopOccurrences: args.minLoop });
527
556
  const reactions = analyzeReactions(spans);
528
557
  const adoption = await analyzeAdoption(spans, { cwds });
529
- let report = `${renderReport(result, { harness, sessionCount, spanCount: spans.length, otlpPath })}
558
+ const deterministic = summarizeDeterministicSignals(pipelines, reactions);
559
+ let report = `${renderReport(result, { harness, sessionCount, spanCount: spans.length, otlpPath, deterministic })}
530
560
  ${renderPipelines(pipelines)}
531
561
  ${renderReactions(reactions)}
532
562
  ${renderAdoption(adoption)}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/traces",
3
- "version": "0.8.12",
3
+ "version": "0.8.13",
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",