agentfootprint-lens 0.61.0 → 0.62.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 CHANGED
@@ -78,7 +78,7 @@ changes.
78
78
  |---|---|
79
79
  | `agentfootprint-lens/why` | Replay a recording as the agent's own milestones. `<WhyLens recording={...} />` takes the recording straight (`recordRun()`'s `{ snapshot, events, structure }`, or the `persistRecording` envelope), validates it at mount, and mounts the shipped `<Lens>` shell on the milestone axis — plus the axis helpers (`scrubAxisFor`, `stepForCommitIdx`, `stepForRuntimeStageId`, `resolveNavigation`) for hosts holding one cursor across views. |
80
80
  | `agentfootprint-lens/skillgraph` | Debug how a run routed through its skills. `<SkillGraphDebugger recorder={...} />` plus its headless selectors (`selectSkillRoute`, `selectSkillBeats`, `selectSkillTopology`, `selectSkillFrameContext`, `stepForRuntimeStageId`, `resolveNavigation`). |
81
- | `agentfootprint-lens/context` | What the model HAD at a stop — the served document of that epoch on top (the Served tab itself: pieces, messages, tools, verdicts, delta since the previous call) — and what it was BUILT from beneath: the record key by key, who wrote each, what moved; a long value opens in place (0.54.0). `<ContextView runner={...} />` walks the milestone axis on its own; hand it `cursor` and it follows the ONE cursor (0.53.1). Under the record, the **Findings** band (0.61.0): on an armed run (`.findings()`, agentfootprint 9.101) the model's own ledger at the stop, folded for reading — facts, conflicts as first seen (each witness with its current standing, no verdict), open, ruled out, noise, undeclared — every string off the record, absent on an unarmed run. |
81
+ | `agentfootprint-lens/context` | What the model HAD at a stop — the served document of that epoch on top (the Served tab itself: pieces, messages, tools, verdicts, delta since the previous call) — and what it was BUILT from beneath: the record key by key, who wrote each, what moved; a long value opens in place (0.54.0). `<ContextView runner={...} />` walks the milestone axis on its own; hand it `cursor` and it follows the ONE cursor (0.53.1). Under the record, the **Findings** band (0.61.0): on an armed run (`.findings()`, agentfootprint 9.101) the model's own ledger at the stop, folded for reading — facts, conflicts as first seen (each witness with its current standing, no verdict), open, ruled out, noise, undeclared — every string off the record, absent on an unarmed run. Beside it, the **Reasoning** lens (0.62.0): `<ReasoningLens runner={...} shared={shared} />` — the same ledger read BY CALL, one card per tool call at the cursor (basis before, result, current standing after, the model's words quoted) and an answer card; absent on an unarmed run. |
82
82
 
83
83
  The axis model in three sentences: one run leaves one causal trace, and each
84
84
  lens replays one AXIS of it — the Why reading scrubs the milestones, the Flow
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-S3WZBG5I.js";
21
21
  import {
22
22
  ServedTab
23
- } from "./chunk-X6AWFDSB.js";
23
+ } from "./chunk-UFC3IZPT.js";
24
24
  import {
25
25
  snapshotLogKey,
26
26
  snapshotOfRunner,
@@ -4784,4 +4784,4 @@ export {
4784
4784
  useBookmarkSidecar,
4785
4785
  Lens
4786
4786
  };
4787
- //# sourceMappingURL=chunk-DTQ44DWN.js.map
4787
+ //# sourceMappingURL=chunk-4K45VV7M.js.map
@@ -2,14 +2,16 @@ import {
2
2
  contextAt
3
3
  } from "./chunk-3LXZ7D65.js";
4
4
  import {
5
- ServedTab
6
- } from "./chunk-X6AWFDSB.js";
5
+ ServedTab,
6
+ collapsedTicketOf
7
+ } from "./chunk-UFC3IZPT.js";
7
8
  import {
8
9
  snapshotLogKey,
9
10
  snapshotOfRunner,
10
11
  tagAxisPositions
11
12
  } from "./chunk-XEAZRBOH.js";
12
13
  import {
14
+ T,
13
15
  TimeTravel
14
16
  } from "./chunk-CO5R2ODI.js";
15
17
  import {
@@ -52,36 +54,47 @@ function assertionOf(v) {
52
54
  ...typeof v.provenance === "string" ? { provenance: v.provenance } : {}
53
55
  };
54
56
  }
55
- function standingOf(row) {
56
- if (!isRecord(row) || row.kind !== "standing") return void 0;
57
- if (typeof row.toolCallId !== "string" || typeof row.standing !== "string") return void 0;
58
- const assertions = Array.isArray(row.assertions) ? row.assertions.flatMap((a) => {
57
+ function standingOf(row2) {
58
+ if (!isRecord(row2) || row2.kind !== "standing") return void 0;
59
+ if (typeof row2.toolCallId !== "string" || typeof row2.standing !== "string") return void 0;
60
+ const declaredOn = declaredOnOf(row2.declaredOn);
61
+ const assertions = Array.isArray(row2.assertions) ? row2.assertions.flatMap((a) => {
59
62
  const shaped = assertionOf(a);
60
63
  return shaped !== void 0 ? [shaped] : [];
61
64
  }) : [];
62
65
  return {
63
- toolCallId: row.toolCallId,
64
- standing: row.standing,
66
+ toolCallId: row2.toolCallId,
67
+ standing: row2.standing,
65
68
  assertions,
66
- ...typeof row.toolName === "string" ? { toolName: row.toolName } : {},
67
- ...typeof row.settles === "string" ? { settles: row.settles } : {},
68
- ...typeof row.line === "string" ? { line: row.line } : {}
69
+ ...typeof row2.toolName === "string" ? { toolName: row2.toolName } : {},
70
+ ...typeof row2.settles === "string" ? { settles: row2.settles } : {},
71
+ ...typeof row2.line === "string" ? { line: row2.line } : {},
72
+ ...typeof row2.ref === "string" ? { ref: row2.ref } : {},
73
+ ...row2.sought === true ? { sought: true } : {},
74
+ ...declaredOn !== void 0 ? { declaredOn } : {},
75
+ ...typeof row2.iteration === "number" ? { iteration: row2.iteration } : {},
76
+ ...row2.unknownId === true ? { unknownId: true } : {}
69
77
  };
70
78
  }
79
+ function declaredOnOf(v) {
80
+ if (v === "answer") return "answer";
81
+ if (isRecord(v) && typeof v.toolCallId === "string") return { toolCallId: v.toolCallId };
82
+ return void 0;
83
+ }
71
84
  function witnessOf(v) {
72
85
  if (!isRecord(v) || typeof v.toolCallId !== "string" || typeof v.predicate !== "string") return void 0;
73
86
  const subject = subjectOf(v.subject);
74
87
  if (subject === void 0) return void 0;
75
88
  return { toolCallId: v.toolCallId, subject, predicate: v.predicate };
76
89
  }
77
- function conflictOf(row) {
78
- if (!isRecord(row) || row.kind !== "conflict" || typeof row.key !== "string") return void 0;
79
- if (!Array.isArray(row.witnesses)) return void 0;
80
- const witnesses = row.witnesses.flatMap((w) => {
90
+ function conflictOf(row2) {
91
+ if (!isRecord(row2) || row2.kind !== "conflict" || typeof row2.key !== "string") return void 0;
92
+ if (!Array.isArray(row2.witnesses)) return void 0;
93
+ const witnesses = row2.witnesses.flatMap((w) => {
81
94
  const shaped = witnessOf(w);
82
95
  return shaped !== void 0 ? [shaped] : [];
83
96
  });
84
- return { key: row.key, witnesses };
97
+ return { key: row2.key, witnesses };
85
98
  }
86
99
  function resultIdOf(entry) {
87
100
  return isRecord(entry) && typeof entry.toolCallId === "string" ? entry.toolCallId : void 0;
@@ -89,13 +102,13 @@ function resultIdOf(entry) {
89
102
  function foldFindings(rows, toolResults) {
90
103
  const standing = /* @__PURE__ */ new Map();
91
104
  const conflictRows = [];
92
- for (const row of rows) {
93
- const s = standingOf(row);
105
+ for (const row2 of rows) {
106
+ const s = standingOf(row2);
94
107
  if (s !== void 0) {
95
108
  standing.set(s.toolCallId, s);
96
109
  continue;
97
110
  }
98
- const c = conflictOf(row);
111
+ const c = conflictOf(row2);
99
112
  if (c !== void 0) conflictRows.push(c);
100
113
  }
101
114
  const conflicts = conflictRows.map(
@@ -131,7 +144,8 @@ function foldFindings(rows, toolResults) {
131
144
  open: Object.freeze(open),
132
145
  ruledOut: Object.freeze(ruledOut),
133
146
  noise: Object.freeze(noise),
134
- undeclared: Object.freeze(undeclared)
147
+ undeclared: Object.freeze(undeclared),
148
+ standings: standing
135
149
  });
136
150
  }
137
151
  function valueText(value) {
@@ -586,9 +600,461 @@ var band2 = {
586
600
  var list2 = { margin: "4px 0 0", paddingLeft: 18 };
587
601
  var btn = { fontSize: 12, padding: "2px 8px" };
588
602
 
603
+ // src/react/components/ReasoningLens.tsx
604
+ import { useMemo as useMemo3 } from "react";
605
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
606
+ var LABELS3 = Object.freeze({
607
+ lens: "Reasoning",
608
+ calls: "calls",
609
+ iteration: "iteration",
610
+ basis: "basis",
611
+ expect: "expect",
612
+ malformed: "malformed",
613
+ /** The `proposition` field — what the model said it was testing. */
614
+ tested: "tested",
615
+ predicts: "predicts",
616
+ result: "result",
617
+ chars: "chars",
618
+ bytes: "bytes",
619
+ ref: "ref",
620
+ placed: "placed",
621
+ collapsed: "collapsed",
622
+ standing: "standing",
623
+ undeclared: "undeclared",
624
+ sought: "sought",
625
+ settles: "settles",
626
+ line: "line",
627
+ declaredOn: "declared on",
628
+ unknownId: "unknown id",
629
+ conflict: "conflict",
630
+ details: "details",
631
+ assertions: "assertions",
632
+ ticket: "ticket",
633
+ answer: "answer",
634
+ facts: "facts",
635
+ limitations: "limitations",
636
+ evidenceRefs: "evidenceRefs",
637
+ nextSteps: "nextSteps",
638
+ noise: "noise",
639
+ serve: "serve",
640
+ answerAsk: "answer ask"
641
+ });
642
+ var isRecord2 = (v) => typeof v === "object" && v !== null;
643
+ function basisOf(row2) {
644
+ if (!isRecord2(row2) || row2.kind !== "basis") return void 0;
645
+ if (typeof row2.toolCallId !== "string" || typeof row2.basis !== "string") return void 0;
646
+ return {
647
+ toolCallId: row2.toolCallId,
648
+ basis: row2.basis,
649
+ ...typeof row2.toolName === "string" ? { toolName: row2.toolName } : {},
650
+ ...typeof row2.iteration === "number" ? { iteration: row2.iteration } : {},
651
+ ...typeof row2.expect === "string" ? { expect: row2.expect } : {},
652
+ ...typeof row2.malformed === "number" ? { malformed: row2.malformed } : {},
653
+ ...typeof row2.proposition === "string" ? { proposition: row2.proposition } : {},
654
+ ...typeof row2.predicts === "string" ? { predicts: row2.predicts } : {}
655
+ };
656
+ }
657
+ function placedTicketOf(value) {
658
+ let v = value;
659
+ if (typeof v === "string" && v.startsWith("{")) {
660
+ try {
661
+ v = JSON.parse(v);
662
+ } catch {
663
+ return void 0;
664
+ }
665
+ }
666
+ if (!isRecord2(v) || v.placed !== true || typeof v.ref !== "string") return void 0;
667
+ return {
668
+ ref: v.ref,
669
+ ...typeof v.bytes === "number" ? { bytes: v.bytes } : {},
670
+ ...typeof v.kind === "string" ? { kind: v.kind } : {}
671
+ };
672
+ }
673
+ function resultShapeOf(value) {
674
+ const placed = placedTicketOf(value);
675
+ if (placed !== void 0) return { placed };
676
+ const text = typeof value === "string" ? value : JSON.stringify(value) ?? "";
677
+ return { chars: text.length };
678
+ }
679
+ function resultsById(history, toolResults) {
680
+ const out = /* @__PURE__ */ new Map();
681
+ for (const m of history ?? []) {
682
+ if (isRecord2(m) && m.role === "tool" && typeof m.toolCallId === "string" && !out.has(m.toolCallId)) out.set(m.toolCallId, m.content);
683
+ }
684
+ for (const r of toolResults ?? []) {
685
+ if (isRecord2(r) && typeof r.toolCallId === "string" && !out.has(r.toolCallId)) out.set(r.toolCallId, r.result);
686
+ }
687
+ return out;
688
+ }
689
+ function collapsedById(asSent) {
690
+ const out = /* @__PURE__ */ new Map();
691
+ for (const m of asSent ?? []) {
692
+ if (!isRecord2(m) || m.role !== "tool") continue;
693
+ const t = collapsedTicketOf(m.content);
694
+ if (t !== void 0) out.set(t.toolCallId, t.standing);
695
+ }
696
+ return out;
697
+ }
698
+ function foldReasoning(input) {
699
+ const findings = foldFindings(input.rows, input.toolResults);
700
+ const results = resultsById(input.history, input.toolResults);
701
+ const collapsed = collapsedById(input.asSent);
702
+ const witnessed = /* @__PURE__ */ new Map();
703
+ for (const c of findings.conflicts) {
704
+ for (const w of c.witnesses) {
705
+ const keys = witnessed.get(w.toolCallId) ?? [];
706
+ keys.push(c.key);
707
+ witnessed.set(w.toolCallId, keys);
708
+ }
709
+ }
710
+ const seen = /* @__PURE__ */ new Set();
711
+ const cards = [];
712
+ for (const row2 of input.rows) {
713
+ const before = basisOf(row2);
714
+ if (before === void 0 || seen.has(before.toolCallId)) continue;
715
+ seen.add(before.toolCallId);
716
+ const id = before.toolCallId;
717
+ const after = findings.standings.get(id);
718
+ const onWire = collapsed.get(id);
719
+ cards.push(
720
+ Object.freeze({
721
+ toolCallId: id,
722
+ before,
723
+ ...results.has(id) ? { result: resultShapeOf(results.get(id)) } : {},
724
+ ...onWire !== void 0 ? { collapsed: onWire } : {},
725
+ ...after !== void 0 ? { after } : {},
726
+ conflicts: Object.freeze(witnessed.get(id) ?? [])
727
+ })
728
+ );
729
+ }
730
+ const answered = Array.from(findings.standings.values()).some((s) => s.declaredOn === "answer");
731
+ const answer = answered ? Object.freeze({
732
+ facts: findings.facts.length,
733
+ limitations: findings.ruledOut.length,
734
+ evidenceRefs: findings.open.length,
735
+ nextSteps: findings.open.filter((s) => s.settles !== void 0).length,
736
+ noise: findings.noise.length,
737
+ undeclared: findings.undeclared.length,
738
+ ...typeof input.findingsServe === "string" ? { serve: input.findingsServe } : {},
739
+ ...input.findingsAnswerAsk !== void 0 ? { answerAsk: input.findingsAnswerAsk } : {}
740
+ }) : void 0;
741
+ return Object.freeze({
742
+ cards: Object.freeze(cards),
743
+ ...answer !== void 0 ? { answer } : {},
744
+ findings
745
+ });
746
+ }
747
+ function positionsOf2(snapshot) {
748
+ return tagAxisPositions(snapshot, MILESTONE_AXIS, []) ?? [];
749
+ }
750
+ var noMove = () => void 0;
751
+ function keyValue(context, path) {
752
+ return context.keys.find((k) => k.path === path)?.value;
753
+ }
754
+ function arrayValue(context, path) {
755
+ const v = keyValue(context, path);
756
+ return Array.isArray(v) ? v : void 0;
757
+ }
758
+ function ReasoningLens(props) {
759
+ const { runner, events, shared, recorder } = props;
760
+ const fresh = snapshotOfRunner(runner);
761
+ const logKey = snapshotLogKey(fresh);
762
+ const snapshot = useMemo3(() => fresh, [runner, logKey]);
763
+ const ownPositions = useMemo3(
764
+ () => props.cursor !== void 0 ? void 0 : recorder !== void 0 ? scrubAxisFor(recorder, "group") : positionsOf2(snapshot),
765
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- the recorder's axis moves with the log key
766
+ [snapshot, props.cursor, recorder, logKey]
767
+ );
768
+ const positions = ownPositions ?? [];
769
+ const cursor = props.cursor ?? (shared !== void 0 ? shared.over(positions) : lensCursorFrom(positions, Math.max(0, positions.length - 1), noMove));
770
+ const context = useMemo3(
771
+ () => contextAt(snapshot, { runtimeStageId: cursor.at.runtimeStageId, commitIdx: cursor.at.commitIdx }, { events }),
772
+ [snapshot, cursor.at.runtimeStageId, cursor.at.commitIdx, events]
773
+ );
774
+ const rows = arrayValue(context, "findingsLedger");
775
+ const fold = useMemo3(() => {
776
+ if (rows === void 0) return void 0;
777
+ const toolResults = arrayValue(context, "toolResults");
778
+ const history = arrayValue(context, "history");
779
+ const wire = context.served?.row.view.messages.asSent;
780
+ return foldReasoning({
781
+ rows,
782
+ ...toolResults !== void 0 ? { toolResults } : {},
783
+ ...history !== void 0 ? { history } : {},
784
+ ...Array.isArray(wire) ? { asSent: wire } : {},
785
+ findingsServe: keyValue(context, "findingsServe"),
786
+ findingsAnswerAsk: keyValue(context, "findingsAnswerAsk")
787
+ });
788
+ }, [context, rows]);
789
+ if (fold === void 0) return null;
790
+ return /* @__PURE__ */ jsxs3("div", { style: panel2, "data-testid": "reasoning-lens", "data-step": cursor.at.step, "data-commit": cursor.at.commitIdx, "data-calls": fold.cards.length, children: [
791
+ /* @__PURE__ */ jsxs3("div", { style: header2, children: [
792
+ /* @__PURE__ */ jsx3("span", { style: title2, children: LABELS3.lens }),
793
+ /* @__PURE__ */ jsxs3("span", { style: dim3, children: [
794
+ fold.cards.length,
795
+ " ",
796
+ LABELS3.calls
797
+ ] })
798
+ ] }),
799
+ fold.cards.map((card) => /* @__PURE__ */ jsx3(Card, { card }, card.toolCallId)),
800
+ fold.answer !== void 0 && /* @__PURE__ */ jsx3(Answer, { answer: fold.answer })
801
+ ] });
802
+ }
803
+ var SHORT_ID = 12;
804
+ function Card({ card }) {
805
+ const { before, after } = card;
806
+ const id = card.toolCallId;
807
+ const standing = after?.standing;
808
+ return /* @__PURE__ */ jsxs3(
809
+ "div",
810
+ {
811
+ style: cardStyle,
812
+ "data-testid": "reasoning-card",
813
+ "data-tool-call-id": id,
814
+ "data-basis": before.basis,
815
+ "data-standing": standing ?? LABELS3.undeclared,
816
+ children: [
817
+ /* @__PURE__ */ jsxs3("div", { style: row, children: [
818
+ before.toolName !== void 0 && /* @__PURE__ */ jsx3("code", { style: strong, children: before.toolName }),
819
+ /* @__PURE__ */ jsx3("code", { title: id, style: mono3, "data-testid": "reasoning-card-id", children: id.length > SHORT_ID ? `${id.slice(0, SHORT_ID)}\u2026` : id }),
820
+ before.iteration !== void 0 && /* @__PURE__ */ jsxs3("span", { style: dim3, children: [
821
+ LABELS3.iteration,
822
+ " ",
823
+ before.iteration
824
+ ] }),
825
+ /* @__PURE__ */ jsx3(Chip, { testId: "reasoning-basis", color: T.primary, children: before.basis }),
826
+ before.expect !== void 0 && /* @__PURE__ */ jsxs3(Chip, { testId: "reasoning-expect", color: T.textMuted, children: [
827
+ LABELS3.expect,
828
+ " ",
829
+ before.expect
830
+ ] }),
831
+ before.malformed !== void 0 && /* @__PURE__ */ jsxs3(Chip, { testId: "reasoning-malformed", color: T.warning, children: [
832
+ LABELS3.malformed,
833
+ " ",
834
+ before.malformed
835
+ ] }),
836
+ card.conflicts.map((key) => /* @__PURE__ */ jsx3(Chip, { testId: "reasoning-conflict", color: T.error, title: key, children: LABELS3.conflict }, key))
837
+ ] }),
838
+ /* @__PURE__ */ jsx3(Before, { before }),
839
+ /* @__PURE__ */ jsxs3("div", { style: row, "data-testid": "reasoning-after", children: [
840
+ /* @__PURE__ */ jsx3("span", { style: dim3, children: LABELS3.standing }),
841
+ /* @__PURE__ */ jsx3(Chip, { testId: "reasoning-standing", color: standing !== void 0 ? standingColor(standing) : T.textMuted, children: standing ?? LABELS3.undeclared }),
842
+ after?.sought === true && /* @__PURE__ */ jsx3(Chip, { testId: "reasoning-sought", color: T.textMuted, children: LABELS3.sought }),
843
+ after?.unknownId === true && /* @__PURE__ */ jsx3(Chip, { testId: "reasoning-unknown-id", color: T.warning, children: LABELS3.unknownId }),
844
+ card.collapsed !== void 0 && /* @__PURE__ */ jsx3(Chip, { testId: "reasoning-collapsed", color: T.textMuted, title: card.collapsed, children: LABELS3.collapsed }),
845
+ after?.declaredOn !== void 0 && /* @__PURE__ */ jsxs3("span", { style: dim3, "data-testid": "reasoning-declared-on", children: [
846
+ LABELS3.declaredOn,
847
+ " ",
848
+ /* @__PURE__ */ jsx3("code", { style: mono3, children: after.declaredOn === "answer" ? after.declaredOn : after.declaredOn.toolCallId })
849
+ ] })
850
+ ] }),
851
+ after !== void 0 && /* @__PURE__ */ jsx3(QuotedLine, { after }),
852
+ /* @__PURE__ */ jsxs3("details", { style: detailsStyle, "data-testid": "reasoning-details", children: [
853
+ /* @__PURE__ */ jsx3("summary", { style: summaryStyle, children: LABELS3.details }),
854
+ /* @__PURE__ */ jsx3(Details, { card })
855
+ ] })
856
+ ]
857
+ }
858
+ );
859
+ }
860
+ function Before({ before }) {
861
+ if (before.proposition === void 0 && before.predicts === void 0) return null;
862
+ return /* @__PURE__ */ jsxs3("div", { style: mono3, "data-testid": "reasoning-before", children: [
863
+ before.proposition !== void 0 && /* @__PURE__ */ jsxs3("div", { "data-testid": "reasoning-proposition", children: [
864
+ /* @__PURE__ */ jsx3("span", { style: dim3, children: LABELS3.tested }),
865
+ " ",
866
+ /* @__PURE__ */ jsx3("q", { children: before.proposition })
867
+ ] }),
868
+ before.predicts !== void 0 && /* @__PURE__ */ jsxs3("div", { "data-testid": "reasoning-predicts", children: [
869
+ /* @__PURE__ */ jsx3("span", { style: dim3, children: LABELS3.predicts }),
870
+ " ",
871
+ /* @__PURE__ */ jsx3("q", { children: before.predicts })
872
+ ] })
873
+ ] });
874
+ }
875
+ function QuotedLine({ after }) {
876
+ const first = after.assertions[0];
877
+ if (after.standing === "fact" && first !== void 0) {
878
+ return /* @__PURE__ */ jsx3("div", { style: mono3, "data-testid": "reasoning-line", children: /* @__PURE__ */ jsx3(AssertionText, { assertion: first }) });
879
+ }
880
+ if (after.settles !== void 0) {
881
+ return /* @__PURE__ */ jsxs3("div", { style: mono3, "data-testid": "reasoning-line", children: [
882
+ /* @__PURE__ */ jsx3("span", { style: dim3, children: LABELS3.settles }),
883
+ " ",
884
+ /* @__PURE__ */ jsx3("q", { children: after.settles })
885
+ ] });
886
+ }
887
+ if (after.line !== void 0) {
888
+ return /* @__PURE__ */ jsxs3("div", { style: mono3, "data-testid": "reasoning-line", children: [
889
+ /* @__PURE__ */ jsx3("span", { style: dim3, children: LABELS3.line }),
890
+ " ",
891
+ /* @__PURE__ */ jsx3("q", { children: after.line })
892
+ ] });
893
+ }
894
+ return null;
895
+ }
896
+ function Details({ card }) {
897
+ const { after } = card;
898
+ return /* @__PURE__ */ jsxs3("div", { style: { ...mono3, ...detailsBody }, children: [
899
+ /* @__PURE__ */ jsx3("div", { children: /* @__PURE__ */ jsx3("code", { children: card.toolCallId }) }),
900
+ card.result !== void 0 && /* @__PURE__ */ jsx3(ResultLine, { result: card.result }),
901
+ after?.ref !== void 0 && /* @__PURE__ */ jsxs3("div", { children: [
902
+ /* @__PURE__ */ jsx3("span", { style: dim3, children: LABELS3.ref }),
903
+ " ",
904
+ /* @__PURE__ */ jsx3("code", { children: after.ref })
905
+ ] }),
906
+ card.collapsed !== void 0 && /* @__PURE__ */ jsxs3("div", { "data-testid": "reasoning-ticket", children: [
907
+ /* @__PURE__ */ jsx3("span", { style: dim3, children: LABELS3.ticket }),
908
+ " ",
909
+ /* @__PURE__ */ jsx3("code", { children: card.collapsed })
910
+ ] }),
911
+ after !== void 0 && after.assertions.length > 0 && /* @__PURE__ */ jsxs3("div", { children: [
912
+ /* @__PURE__ */ jsxs3("span", { style: dim3, children: [
913
+ LABELS3.assertions,
914
+ " \xB7 ",
915
+ after.assertions.length
916
+ ] }),
917
+ /* @__PURE__ */ jsx3("ul", { style: list3, children: after.assertions.map((a, i) => /* @__PURE__ */ jsx3("li", { "data-testid": "reasoning-assertion", children: /* @__PURE__ */ jsx3(AssertionText, { assertion: a }) }, i)) })
918
+ ] }),
919
+ after?.settles !== void 0 && /* @__PURE__ */ jsxs3("div", { children: [
920
+ /* @__PURE__ */ jsx3("span", { style: dim3, children: LABELS3.settles }),
921
+ " ",
922
+ /* @__PURE__ */ jsx3("q", { children: after.settles })
923
+ ] }),
924
+ after?.line !== void 0 && /* @__PURE__ */ jsxs3("div", { children: [
925
+ /* @__PURE__ */ jsx3("span", { style: dim3, children: LABELS3.line }),
926
+ " ",
927
+ /* @__PURE__ */ jsx3("q", { children: after.line })
928
+ ] })
929
+ ] });
930
+ }
931
+ function ResultLine({ result }) {
932
+ if ("placed" in result) {
933
+ return /* @__PURE__ */ jsxs3("div", { "data-testid": "reasoning-result", "data-placed": "true", children: [
934
+ /* @__PURE__ */ jsx3("span", { style: dim3, children: LABELS3.placed }),
935
+ " ",
936
+ /* @__PURE__ */ jsx3("code", { children: result.placed.ref }),
937
+ result.placed.bytes !== void 0 && /* @__PURE__ */ jsxs3("span", { style: dim3, children: [
938
+ " ",
939
+ "\xB7 ",
940
+ result.placed.bytes,
941
+ " ",
942
+ LABELS3.bytes
943
+ ] })
944
+ ] });
945
+ }
946
+ return /* @__PURE__ */ jsxs3("div", { "data-testid": "reasoning-result", "data-chars": result.chars, children: [
947
+ /* @__PURE__ */ jsx3("span", { style: dim3, children: LABELS3.result }),
948
+ " ",
949
+ result.chars,
950
+ " ",
951
+ LABELS3.chars
952
+ ] });
953
+ }
954
+ function AssertionText({ assertion }) {
955
+ return /* @__PURE__ */ jsxs3("span", { children: [
956
+ /* @__PURE__ */ jsxs3("code", { children: [
957
+ assertion.subject.kind,
958
+ "/",
959
+ assertion.subject.id
960
+ ] }),
961
+ " \xB7 ",
962
+ /* @__PURE__ */ jsx3("code", { children: assertion.predicate }),
963
+ " = ",
964
+ /* @__PURE__ */ jsx3("code", { children: valueText2(assertion.value) })
965
+ ] });
966
+ }
967
+ function valueText2(value) {
968
+ if (typeof value === "string") return value;
969
+ return JSON.stringify(value) ?? String(value);
970
+ }
971
+ function Answer({ answer }) {
972
+ const counts = [
973
+ [LABELS3.facts, answer.facts],
974
+ [LABELS3.limitations, answer.limitations],
975
+ [LABELS3.evidenceRefs, answer.evidenceRefs],
976
+ [LABELS3.nextSteps, answer.nextSteps],
977
+ [LABELS3.noise, answer.noise],
978
+ [LABELS3.undeclared, answer.undeclared]
979
+ ];
980
+ return /* @__PURE__ */ jsxs3("div", { style: cardStyle, "data-testid": "reasoning-answer", "data-answer-ask": answer.answerAsk === void 0 ? "" : String(answer.answerAsk), children: [
981
+ /* @__PURE__ */ jsxs3("div", { style: row, children: [
982
+ /* @__PURE__ */ jsx3("span", { style: strong, children: LABELS3.answer }),
983
+ answer.serve !== void 0 && /* @__PURE__ */ jsxs3(Chip, { testId: "reasoning-serve", color: T.textMuted, children: [
984
+ LABELS3.serve,
985
+ " ",
986
+ answer.serve
987
+ ] }),
988
+ answer.answerAsk !== void 0 && /* @__PURE__ */ jsxs3(Chip, { testId: "reasoning-answer-ask", color: T.textMuted, children: [
989
+ LABELS3.answerAsk,
990
+ " ",
991
+ valueText2(answer.answerAsk)
992
+ ] })
993
+ ] }),
994
+ /* @__PURE__ */ jsx3("div", { style: { ...row, ...mono3 }, children: counts.map(([label, n]) => /* @__PURE__ */ jsxs3("span", { "data-testid": "reasoning-count", "data-bucket": label, "data-count": n, children: [
995
+ /* @__PURE__ */ jsx3("span", { style: dim3, children: label }),
996
+ " ",
997
+ n
998
+ ] }, label)) })
999
+ ] });
1000
+ }
1001
+ function standingColor(standing) {
1002
+ if (standing === "fact") return T.success;
1003
+ if (standing === "ruled-out") return T.error;
1004
+ if (standing === "open") return T.warning;
1005
+ return T.textMuted;
1006
+ }
1007
+ function Chip({
1008
+ children,
1009
+ color,
1010
+ testId,
1011
+ title: title3
1012
+ }) {
1013
+ return /* @__PURE__ */ jsx3("span", { style: { ...chip, borderColor: color, color }, "data-testid": testId, ...title3 !== void 0 ? { title: title3 } : {}, children });
1014
+ }
1015
+ var panel2 = {
1016
+ display: "flex",
1017
+ flexDirection: "column",
1018
+ gap: 8,
1019
+ padding: 10,
1020
+ fontSize: 13,
1021
+ fontFamily: T.fontSans,
1022
+ color: T.textPrimary
1023
+ };
1024
+ var header2 = { display: "flex", alignItems: "center", gap: 10 };
1025
+ var title2 = { fontWeight: 600 };
1026
+ var strong = { fontWeight: 600 };
1027
+ var dim3 = { color: T.textMuted };
1028
+ var mono3 = { fontFamily: T.fontMono, fontSize: 12, wordBreak: "break-word" };
1029
+ var row = { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 6 };
1030
+ var cardStyle = {
1031
+ display: "flex",
1032
+ flexDirection: "column",
1033
+ gap: 4,
1034
+ padding: "6px 8px",
1035
+ border: "1px solid",
1036
+ borderColor: T.border,
1037
+ borderRadius: 6,
1038
+ background: T.bgSecondary
1039
+ };
1040
+ var chip = {
1041
+ padding: "0 6px",
1042
+ borderRadius: 8,
1043
+ fontSize: 11,
1044
+ border: "1px solid",
1045
+ whiteSpace: "nowrap"
1046
+ };
1047
+ var detailsStyle = { fontSize: 12 };
1048
+ var summaryStyle = { cursor: "pointer", color: T.textMuted };
1049
+ var detailsBody = { display: "flex", flexDirection: "column", gap: 2, paddingTop: 4 };
1050
+ var list3 = { margin: "2px 0 0", paddingLeft: 18 };
1051
+
589
1052
  export {
590
1053
  LABELS2 as LABELS,
591
1054
  MILESTONE_AXIS,
592
- ContextView
1055
+ ContextView,
1056
+ LABELS3 as LABELS2,
1057
+ foldReasoning,
1058
+ ReasoningLens
593
1059
  };
594
- //# sourceMappingURL=chunk-JMH3WAZK.js.map
1060
+ //# sourceMappingURL=chunk-P4XTLLMA.js.map