claude-discover 1.10.13 → 1.10.14

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.
@@ -1,5 +1,5 @@
1
1
  import { r as __toESM } from "./rolldown-runtime-SbdDWaPq.js";
2
- import { A as intervalToDuration, B as startOfWeek, C as ChevronDown, D as isSameMonth, E as isToday, F as endOfMonth, G as Ki, H as addMonths, I as endOfDay, J as require_jsx_runtime, K as Qi, L as isSameDay, M as format, N as endOfWeek, O as isSameWeek, P as startOfMonth, R as addWeeks, S as ChevronRight, T as ArrowDownToLine, U as addDays, V as addHours, W as Hi, X as require_client, Y as require_compiler_runtime, Z as require_react, _ as Globe, a as ve, b as DollarSign, c as Markdown$1, d as Zap, f as WandSparkles, g as LaptopMinimal, h as MessageSquare, i as JsonView, j as getDaysInMonth, k as parse, l as defaultUrlTransform, m as OctagonX, n as w, o as rehypeHighlight, p as Terminal, q as la, r as vscodeTheme, s as remarkGfm, t as C, u as encode, v as GitBranch, w as Brain, x as Clock, y as Gauge, z as startOfDay } from "./vendors-C1ZLrYHz.js";
2
+ import { $ as require_react, A as isSameWeek, B as addWeeks, C as ChevronRight, D as ArrowDownToLine, E as Brain, F as endOfWeek, G as addDays, H as startOfWeek, I as startOfMonth, J as Qi, K as Hi, L as endOfMonth, M as intervalToDuration, N as getDaysInMonth, O as isToday, P as format, Q as require_client, R as endOfDay, S as Clock, T as Bug, U as addHours, V as startOfDay, W as addMonths, X as require_jsx_runtime, Y as la, Z as require_compiler_runtime, _ as Globe, a as ve, b as DollarSign, c as Markdown$1, d as Zap, f as WandSparkles, g as LaptopMinimal, h as MessageSquare, i as JsonView, j as parse, k as isSameMonth, l as defaultUrlTransform, m as OctagonX, n as w, o as rehypeHighlight, p as Terminal, q as Ki, r as vscodeTheme, s as remarkGfm, t as C, u as encode, v as GitBranch, w as ChevronDown, x as Database, y as Gauge, z as isSameDay } from "./vendors-D1lWDKdL.js";
3
3
  // src/renderer/utils/colors.js
4
4
  var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
5
5
  var import_client = require_client();
@@ -75,11 +75,11 @@ function useLocalStorage(key, initial) {
75
75
  }
76
76
  function clearOutdatedLocalStorage() {
77
77
  const version = localStorage.getItem(VERSION_KEY);
78
- if (version !== "1.10.13") {
79
- const [MAJOR, MINOR, PATCH] = "1.10.13".split(".");
78
+ if (version !== "1.10.14") {
79
+ const [MAJOR, MINOR, PATCH] = "1.10.14".split(".");
80
80
  const [major, minor, patch] = (version ?? "").split(".");
81
81
  if (MAJOR !== major || MINOR !== minor) localStorage.clear();
82
- localStorage.setItem(VERSION_KEY, "1.10.13");
82
+ localStorage.setItem(VERSION_KEY, "1.10.14");
83
83
  }
84
84
  }
85
85
  // src/renderer/utils/useMouse.js
@@ -336,7 +336,7 @@ function MultiPicker(t0) {
336
336
  $[22] = anchor;
337
337
  $[23] = t15;
338
338
  } else t15 = $[23];
339
- const t16 = _temp$14;
339
+ const t16 = _temp$15;
340
340
  let t17;
341
341
  if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
342
342
  t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
@@ -388,7 +388,7 @@ function MultiPicker(t0) {
388
388
  } else t22 = $[36];
389
389
  return t22;
390
390
  }
391
- function _temp$14(e_3) {
391
+ function _temp$15(e_3) {
392
392
  if (e_3.shiftKey) e_3.preventDefault();
393
393
  }
394
394
  // src/renderer/timeline/HeatStrip.jsx
@@ -545,7 +545,7 @@ function SourceLegend(t0) {
545
545
  $[5] = onToggle;
546
546
  $[6] = t2;
547
547
  } else t2 = $[6];
548
- t1 = sources.toSorted(_temp$13).map(t2);
548
+ t1 = sources.toSorted(_temp$14).map(t2);
549
549
  $[0] = filter;
550
550
  $[1] = onToggle;
551
551
  $[2] = sources;
@@ -562,7 +562,7 @@ function SourceLegend(t0) {
562
562
  } else t2 = $[8];
563
563
  return t2;
564
564
  }
565
- function _temp$13(a, b) {
565
+ function _temp$14(a, b) {
566
566
  return sourceRank(a) - sourceRank(b);
567
567
  }
568
568
  // src/renderer/timeline/TimeAxis.jsx
@@ -673,7 +673,7 @@ function WorkTimeOverlay(t0) {
673
673
  const showWorkBand = t1 === void 0 ? true : t1;
674
674
  const [workTime, setWorkTime] = (0, import_react.useState)(null);
675
675
  const [dragging, setDragging] = (0, import_react.useState)(null);
676
- const [now, setNow] = (0, import_react.useState)(_temp$12);
676
+ const [now, setNow] = (0, import_react.useState)(_temp$13);
677
677
  let t2;
678
678
  let t3;
679
679
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -947,7 +947,7 @@ function WorkTimeOverlay(t0) {
947
947
  } else t11 = $[51];
948
948
  return t11;
949
949
  }
950
- function _temp$12() {
950
+ function _temp$13() {
951
951
  return Date.now();
952
952
  }
953
953
  // src/renderer/timeline/GanttChart.jsx
@@ -1431,7 +1431,7 @@ function GanttChart(t0) {
1431
1431
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("title", { children: g.key }), g.projectShort]
1432
1432
  })]
1433
1433
  }),
1434
- g.labels.map(_temp$11),
1434
+ g.labels.map(_temp$12),
1435
1435
  g.placed.map((t26) => {
1436
1436
  const { item, y } = t26;
1437
1437
  const color = SOURCE_COLORS[item.source] || SOURCE_COLORS.other;
@@ -1581,7 +1581,7 @@ function GanttChart(t0) {
1581
1581
  ]
1582
1582
  });
1583
1583
  }
1584
- function _temp$11(l) {
1584
+ function _temp$12(l) {
1585
1585
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("text", {
1586
1586
  x: l.x,
1587
1587
  y: l.y,
@@ -2151,7 +2151,7 @@ function PeriodSummary(t0) {
2151
2151
  ...m,
2152
2152
  value: m[stat] || 0
2153
2153
  }));
2154
- const mixTotal = tokenMix.reduce(_temp$10, 0);
2154
+ const mixTotal = tokenMix.reduce(_temp$11, 0);
2155
2155
  let t3;
2156
2156
  if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
2157
2157
  t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
@@ -2279,7 +2279,7 @@ function PeriodSummary(t0) {
2279
2279
  className: "token-mix-bar",
2280
2280
  role: "img",
2281
2281
  "aria-label": tokenMix.map((m_1) => `${m_1.label} ${Math.round(m_1.value / mixTotal * 100)}%`).join(", "),
2282
- children: tokenMix.filter(_temp2$6).map((m_3) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2282
+ children: tokenMix.filter(_temp2$7).map((m_3) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
2283
2283
  style: {
2284
2284
  flexGrow: m_3.value / mixTotal,
2285
2285
  background: m_3.color
@@ -2323,10 +2323,10 @@ function PeriodSummary(t0) {
2323
2323
  })]
2324
2324
  });
2325
2325
  }
2326
- function _temp2$6(m_2) {
2326
+ function _temp2$7(m_2) {
2327
2327
  return m_2.value > 0;
2328
2328
  }
2329
- function _temp$10(sum, m_0) {
2329
+ function _temp$11(sum, m_0) {
2330
2330
  return sum + m_0.value;
2331
2331
  }
2332
2332
  // src/shared/listings.js
@@ -2550,6 +2550,34 @@ function genericAttachment(att) {
2550
2550
  var renderedText = (rendered) => (rendered ?? []).map((r) => r?.content).filter((c) => typeof c === "string").join("\n").replace(/<\/?system-reminder>/g, "").trim();
2551
2551
  var attachmentView = (att, rendered) => (ATTACHMENT_RENDERERS[att?.type] ?? genericAttachment)(att, renderedText(rendered));
2552
2552
  var hasText = (view) => view.body != null && !view.raw;
2553
+ var blockView = (b) => attachmentView(b.attachment, b.rendered);
2554
+ var isCounted = (b) => b.type === "attachment" && !b.unsent && hasText(blockView(b));
2555
+ var TOOL_KINDS = {
2556
+ "System Tools": "system",
2557
+ "MCP Tools": "MCP",
2558
+ "Deferred Tools": "deferred"
2559
+ };
2560
+ var GROUP_TITLES = {
2561
+ prompt: (blocks) => blocks.every((b) => b.type === "attachment") ? "Output style" : blocks.some((b) => b.type === "attachment") ? "System Prompt (+ output style)" : "System Prompt",
2562
+ tools: (blocks) => {
2563
+ const counts = {
2564
+ system: 0,
2565
+ MCP: 0,
2566
+ deferred: 0
2567
+ };
2568
+ for (const b of blocks) counts[TOOL_KINDS[b.it?.file_path] ?? "deferred"] += b.it?.count ?? b.attachment?.addedNames?.length ?? 0;
2569
+ const listed = Object.entries(counts).filter(([, n]) => n).map(([kind, n]) => `${n} ${kind}`);
2570
+ return listed.length ? `Tools: ${listed.join(", ")}` : "Deferred tools";
2571
+ },
2572
+ mcp: () => "MCP instructions",
2573
+ memory: (blocks) => `Memory files: ${plural(blocks.length, "file")}`,
2574
+ listings: (blocks) => `Skills & agents: ${blocks.map((b) => b.it?.memory_type ?? blockView(b).title.trim()).join(", ")}`,
2575
+ context: (blocks) => {
2576
+ const sent = blocks.filter((b) => b.type === "instruction" || isCounted(b));
2577
+ return `Session context: ${[...new Set(sent.map((b) => (b.it?.file_path ?? humanize(b.attachment.type)).toLowerCase()))].join(", ")}`;
2578
+ }
2579
+ };
2580
+ var groupTitle = (key, blocks) => GROUP_TITLES[key](blocks);
2553
2581
  // src/renderer/utils/activity.js
2554
2582
  var LIVE = 6e4;
2555
2583
  var ACTIVE = 3e5;
@@ -2585,7 +2613,8 @@ var TIPS = {
2585
2613
  context: `Consider keeping it below ${fmtCompact(THRESHOLDS.context.warn)} tokens`,
2586
2614
  messages: `Consider sessions below ${fmtCompact(THRESHOLDS.messages.warn)} messages`,
2587
2615
  time: `Consider sessions under ${THRESHOLDS.workTime.warn / 6e4}m`,
2588
- effort: "Thinks longer and spends more output tokens than high"
2616
+ effort: "Thinks longer and spends more output tokens than high",
2617
+ debug: "Run with --debug"
2589
2618
  };
2590
2619
  var EFFORT_BADGE = {
2591
2620
  xhigh: "warn-badge",
@@ -2726,7 +2755,7 @@ var ProjectModels = (t0) => {
2726
2755
  if ($[4] !== efforts || $[5] !== models) {
2727
2756
  t2 = models?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
2728
2757
  className: "session-model",
2729
- children: [models.map(_temp$9).join(", "), efforts?.length > 0 && ` ${efforts.join(", ")}`]
2758
+ children: [models.map(_temp$10).join(", "), efforts?.length > 0 && ` ${efforts.join(", ")}`]
2730
2759
  });
2731
2760
  $[4] = efforts;
2732
2761
  $[5] = models;
@@ -2782,12 +2811,12 @@ function groupRuns(sorted) {
2782
2811
  })]);
2783
2812
  }
2784
2813
  function SessionList(t0) {
2785
- const $ = (0, import_compiler_runtime.c)(89);
2814
+ const $ = (0, import_compiler_runtime.c)(93);
2786
2815
  const { sessions, selectedId, deepLink, onSelect } = t0;
2787
2816
  const selectedRef = (0, import_react.useRef)(null);
2788
2817
  const [sortBy, setSortBy] = useLocalStorage("session-list.sort", "time");
2789
2818
  const [filter, setFilter] = (0, import_react.useState)("");
2790
- const [expanded, setExpanded] = (0, import_react.useState)(_temp2$5);
2819
+ const [expanded, setExpanded] = (0, import_react.useState)(_temp2$6);
2791
2820
  let t1;
2792
2821
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2793
2822
  t1 = () => {
@@ -2804,12 +2833,12 @@ function SessionList(t0) {
2804
2833
  (0, import_react.useEffect)(t1, t2);
2805
2834
  let t3;
2806
2835
  if ($[3] !== sessions) {
2807
- t3 = () => lastChange(sessions.map(_temp3$4));
2836
+ t3 = () => lastChange(sessions.map(_temp3$5));
2808
2837
  $[3] = sessions;
2809
2838
  $[4] = t3;
2810
2839
  } else t3 = $[4];
2811
2840
  const now = useClock(t3);
2812
- const labelCommand = _temp4$4;
2841
+ const labelCommand = _temp4$5;
2813
2842
  let t4;
2814
2843
  if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
2815
2844
  t4 = (s_1) => {
@@ -2859,6 +2888,8 @@ function SessionList(t0) {
2859
2888
  const sorted = t6;
2860
2889
  let t10;
2861
2890
  let t11;
2891
+ let t12;
2892
+ let t13;
2862
2893
  let t7;
2863
2894
  let t8;
2864
2895
  let t9;
@@ -2866,64 +2897,76 @@ function SessionList(t0) {
2866
2897
  const grouped = groupRuns(sorted);
2867
2898
  const selectedRun = grouped.find((i) => i.runKey && i.session?.filePath === selectedId)?.runKey;
2868
2899
  const isOpen = (key) => expanded.get(key) ?? key === selectedRun;
2869
- let t12;
2870
- if ($[30] !== isOpen) {
2871
- t12 = (key_0) => setExpanded((prev) => new Map(prev).set(key_0, !isOpen(key_0)));
2872
- $[30] = isOpen;
2873
- $[31] = t12;
2874
- } else t12 = $[31];
2875
- const toggleRun = t12;
2876
- let t13;
2900
+ let t14;
2877
2901
  if ($[32] !== isOpen) {
2878
- t13 = (i_0) => i_0.run || !i_0.runKey || isOpen(i_0.runKey);
2902
+ t14 = (key_0) => setExpanded((prev) => new Map(prev).set(key_0, !isOpen(key_0)));
2879
2903
  $[32] = isOpen;
2880
- $[33] = t13;
2881
- } else t13 = $[33];
2882
- const rows = grouped.filter(t13);
2883
- t10 = "session-list";
2884
- const t14 = `filter${q ? " filter-active" : ""}`;
2904
+ $[33] = t14;
2905
+ } else t14 = $[33];
2906
+ const toggleRun = t14;
2885
2907
  let t15;
2886
- if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
2887
- t15 = (e) => setFilter(e.target.value);
2888
- $[34] = t15;
2889
- } else t15 = $[34];
2890
- let t16;
2891
- if ($[35] !== filter || $[36] !== t14) {
2892
- t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
2893
- className: t14,
2908
+ if ($[34] !== isOpen) {
2909
+ t15 = (i_0) => i_0.run || !i_0.runKey || isOpen(i_0.runKey);
2910
+ $[34] = isOpen;
2911
+ $[35] = t15;
2912
+ } else t15 = $[35];
2913
+ const rows = grouped.filter(t15);
2914
+ const moveSelection = (e) => {
2915
+ const step = {
2916
+ ArrowDown: 1,
2917
+ ArrowUp: -1
2918
+ }[e.key];
2919
+ const visible = rows.flatMap(_temp7$1);
2920
+ const current = visible.findIndex((s_3) => s_3.filePath === selectedId);
2921
+ if (!step || current < 0) return;
2922
+ e.preventDefault();
2923
+ const next = visible[current + step];
2924
+ if (next) onSelect(next.filePath);
2925
+ };
2926
+ t12 = "session-list";
2927
+ const t16 = `filter${q ? " filter-active" : ""}`;
2928
+ let t17;
2929
+ if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
2930
+ t17 = (e_0) => setFilter(e_0.target.value);
2931
+ $[36] = t17;
2932
+ } else t17 = $[36];
2933
+ let t18;
2934
+ if ($[37] !== filter || $[38] !== t16) {
2935
+ t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
2936
+ className: t16,
2894
2937
  placeholder: "Filter sessions…",
2895
2938
  value: filter,
2896
- onChange: t15
2939
+ onChange: t17
2897
2940
  });
2898
- $[35] = filter;
2899
- $[36] = t14;
2900
- $[37] = t16;
2901
- } else t16 = $[37];
2902
- let t17;
2903
- if ($[38] !== filter) {
2904
- t17 = filter && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
2941
+ $[37] = filter;
2942
+ $[38] = t16;
2943
+ $[39] = t18;
2944
+ } else t18 = $[39];
2945
+ let t19;
2946
+ if ($[40] !== filter) {
2947
+ t19 = filter && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
2905
2948
  type: "button",
2906
2949
  className: "filter-clear",
2907
2950
  "aria-label": "Clear filter",
2908
2951
  onClick: () => setFilter(""),
2909
2952
  children: "×"
2910
2953
  });
2911
- $[38] = filter;
2912
- $[39] = t17;
2913
- } else t17 = $[39];
2914
- let t18;
2915
- if ($[40] !== t16 || $[41] !== t17) {
2916
- t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2954
+ $[40] = filter;
2955
+ $[41] = t19;
2956
+ } else t19 = $[41];
2957
+ let t20;
2958
+ if ($[42] !== t18 || $[43] !== t19) {
2959
+ t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
2917
2960
  className: "filter-wrap",
2918
- children: [t16, t17]
2961
+ children: [t18, t19]
2919
2962
  });
2920
- $[40] = t16;
2921
- $[41] = t17;
2922
2963
  $[42] = t18;
2923
- } else t18 = $[42];
2924
- let t19;
2925
- if ($[43] !== filtered || $[44] !== q || $[45] !== sessions.length) {
2926
- t19 = q && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
2964
+ $[43] = t19;
2965
+ $[44] = t20;
2966
+ } else t20 = $[44];
2967
+ let t21;
2968
+ if ($[45] !== filtered || $[46] !== q || $[47] !== sessions.length) {
2969
+ t21 = q && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
2927
2970
  className: "filter-count",
2928
2971
  children: [
2929
2972
  "Filtered ",
@@ -2932,145 +2975,147 @@ function SessionList(t0) {
2932
2975
  sessions.length
2933
2976
  ]
2934
2977
  });
2935
- $[43] = filtered;
2936
- $[44] = q;
2937
- $[45] = sessions.length;
2938
- $[46] = t19;
2939
- } else t19 = $[46];
2940
- let t20;
2941
- if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
2942
- t20 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
2978
+ $[45] = filtered;
2979
+ $[46] = q;
2980
+ $[47] = sessions.length;
2981
+ $[48] = t21;
2982
+ } else t21 = $[48];
2983
+ let t22;
2984
+ if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
2985
+ t22 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
2943
2986
  className: "sort-toggle-label",
2944
2987
  children: "Sort by:"
2945
2988
  });
2946
- $[47] = t20;
2947
- } else t20 = $[47];
2948
- const t21 = `sort-pill ${sortBy === "time" ? "active" : ""}`;
2949
- let t22;
2950
- if ($[48] !== setSortBy) {
2951
- t22 = () => setSortBy("time");
2952
- $[48] = setSortBy;
2953
2989
  $[49] = t22;
2954
2990
  } else t22 = $[49];
2955
- let t23;
2956
- if ($[50] !== t21 || $[51] !== t22) {
2957
- t23 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
2991
+ const t23 = `sort-pill ${sortBy === "time" ? "active" : ""}`;
2992
+ let t24;
2993
+ if ($[50] !== setSortBy) {
2994
+ t24 = () => setSortBy("time");
2995
+ $[50] = setSortBy;
2996
+ $[51] = t24;
2997
+ } else t24 = $[51];
2998
+ let t25;
2999
+ if ($[52] !== t23 || $[53] !== t24) {
3000
+ t25 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
2958
3001
  type: "button",
2959
- className: t21,
2960
- onClick: t22,
3002
+ className: t23,
3003
+ onClick: t24,
2961
3004
  children: "Time"
2962
3005
  });
2963
- $[50] = t21;
2964
- $[51] = t22;
2965
3006
  $[52] = t23;
2966
- } else t23 = $[52];
2967
- const t24 = `sort-pill ${sortBy === "name" ? "active" : ""}`;
2968
- let t25;
2969
- if ($[53] !== setSortBy) {
2970
- t25 = () => setSortBy("name");
2971
- $[53] = setSortBy;
3007
+ $[53] = t24;
2972
3008
  $[54] = t25;
2973
3009
  } else t25 = $[54];
2974
- let t26;
2975
- if ($[55] !== t24 || $[56] !== t25) {
2976
- t26 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
3010
+ const t26 = `sort-pill ${sortBy === "name" ? "active" : ""}`;
3011
+ let t27;
3012
+ if ($[55] !== setSortBy) {
3013
+ t27 = () => setSortBy("name");
3014
+ $[55] = setSortBy;
3015
+ $[56] = t27;
3016
+ } else t27 = $[56];
3017
+ let t28;
3018
+ if ($[57] !== t26 || $[58] !== t27) {
3019
+ t28 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
2977
3020
  type: "button",
2978
- className: t24,
2979
- onClick: t25,
3021
+ className: t26,
3022
+ onClick: t27,
2980
3023
  children: "Name"
2981
3024
  });
2982
- $[55] = t24;
2983
- $[56] = t25;
2984
3025
  $[57] = t26;
2985
- } else t26 = $[57];
2986
- const t27 = `sort-pill ${sortBy === "cost" ? "active" : ""}`;
2987
- let t28;
2988
- if ($[58] !== setSortBy) {
2989
- t28 = () => setSortBy("cost");
2990
- $[58] = setSortBy;
3026
+ $[58] = t27;
2991
3027
  $[59] = t28;
2992
3028
  } else t28 = $[59];
2993
- let t29;
2994
- if ($[60] !== t27 || $[61] !== t28) {
2995
- t29 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
3029
+ const t29 = `sort-pill ${sortBy === "cost" ? "active" : ""}`;
3030
+ let t30;
3031
+ if ($[60] !== setSortBy) {
3032
+ t30 = () => setSortBy("cost");
3033
+ $[60] = setSortBy;
3034
+ $[61] = t30;
3035
+ } else t30 = $[61];
3036
+ let t31;
3037
+ if ($[62] !== t29 || $[63] !== t30) {
3038
+ t31 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
2996
3039
  type: "button",
2997
- className: t27,
2998
- onClick: t28,
3040
+ className: t29,
3041
+ onClick: t30,
2999
3042
  children: "Cost"
3000
3043
  });
3001
- $[60] = t27;
3002
- $[61] = t28;
3003
3044
  $[62] = t29;
3004
- } else t29 = $[62];
3005
- const t30 = `sort-pill ${sortBy === "tokens" ? "active" : ""}`;
3006
- let t31;
3007
- if ($[63] !== setSortBy) {
3008
- t31 = () => setSortBy("tokens");
3009
- $[63] = setSortBy;
3045
+ $[63] = t30;
3010
3046
  $[64] = t31;
3011
3047
  } else t31 = $[64];
3012
- let t32;
3013
- if ($[65] !== t30 || $[66] !== t31) {
3014
- t32 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
3048
+ const t32 = `sort-pill ${sortBy === "tokens" ? "active" : ""}`;
3049
+ let t33;
3050
+ if ($[65] !== setSortBy) {
3051
+ t33 = () => setSortBy("tokens");
3052
+ $[65] = setSortBy;
3053
+ $[66] = t33;
3054
+ } else t33 = $[66];
3055
+ let t34;
3056
+ if ($[67] !== t32 || $[68] !== t33) {
3057
+ t34 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
3015
3058
  type: "button",
3016
- className: t30,
3017
- onClick: t31,
3059
+ className: t32,
3060
+ onClick: t33,
3018
3061
  children: "Tokens"
3019
3062
  });
3020
- $[65] = t30;
3021
- $[66] = t31;
3022
3063
  $[67] = t32;
3023
- } else t32 = $[67];
3024
- let t33;
3025
- if ($[68] !== t23 || $[69] !== t26 || $[70] !== t29 || $[71] !== t32) {
3026
- t33 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3064
+ $[68] = t33;
3065
+ $[69] = t34;
3066
+ } else t34 = $[69];
3067
+ let t35;
3068
+ if ($[70] !== t25 || $[71] !== t28 || $[72] !== t31 || $[73] !== t34) {
3069
+ t35 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3027
3070
  className: "sort-toggle",
3028
3071
  role: "group",
3029
3072
  "aria-label": "Sort sessions",
3030
3073
  children: [
3031
- t20,
3032
- t23,
3033
- t26,
3034
- t29,
3035
- t32
3074
+ t22,
3075
+ t25,
3076
+ t28,
3077
+ t31,
3078
+ t34
3036
3079
  ]
3037
3080
  });
3038
- $[68] = t23;
3039
- $[69] = t26;
3040
- $[70] = t29;
3041
- $[71] = t32;
3042
- $[72] = t33;
3043
- } else t33 = $[72];
3044
- let t34;
3045
- if ($[73] !== t19 || $[74] !== t33) {
3046
- t34 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3081
+ $[70] = t25;
3082
+ $[71] = t28;
3083
+ $[72] = t31;
3084
+ $[73] = t34;
3085
+ $[74] = t35;
3086
+ } else t35 = $[74];
3087
+ let t36;
3088
+ if ($[75] !== t21 || $[76] !== t35) {
3089
+ t36 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3047
3090
  className: "session-list-header-row",
3048
- children: [t19, t33]
3091
+ children: [t21, t35]
3049
3092
  });
3050
- $[73] = t19;
3051
- $[74] = t33;
3052
- $[75] = t34;
3053
- } else t34 = $[75];
3054
- if ($[76] !== t18 || $[77] !== t34) {
3055
- t11 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3093
+ $[75] = t21;
3094
+ $[76] = t35;
3095
+ $[77] = t36;
3096
+ } else t36 = $[77];
3097
+ if ($[78] !== t20 || $[79] !== t36) {
3098
+ t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3056
3099
  className: "session-list-header",
3057
- children: [t18, t34]
3100
+ children: [t20, t36]
3058
3101
  });
3059
- $[76] = t18;
3060
- $[77] = t34;
3061
- $[78] = t11;
3062
- } else t11 = $[78];
3102
+ $[78] = t20;
3103
+ $[79] = t36;
3104
+ $[80] = t13;
3105
+ } else t13 = $[80];
3063
3106
  t7 = "session-list-scroll";
3064
- if ($[79] !== sorted.length) {
3065
- t8 = sorted.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
3107
+ t8 = 0;
3108
+ t9 = moveSelection;
3109
+ if ($[81] !== sorted.length) {
3110
+ t10 = sorted.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
3066
3111
  className: "empty",
3067
3112
  children: "No sessions on this day."
3068
3113
  });
3069
- $[79] = sorted.length;
3070
- $[80] = t8;
3071
- } else t8 = $[80];
3072
- t9 = rows.map((t35, i_1) => {
3073
- const { session: s_3, run, runKey } = t35;
3114
+ $[81] = sorted.length;
3115
+ $[82] = t10;
3116
+ } else t10 = $[82];
3117
+ t11 = rows.map((t37, i_1) => {
3118
+ const { session: s_4, run, runKey } = t37;
3074
3119
  const branch = rows[i_1 + 1]?.runKey ? runKey ? "branch-below" : "branch-start" : "";
3075
3120
  if (run) {
3076
3121
  const isCollapsed = !isOpen(runKey);
@@ -3079,7 +3124,7 @@ function SessionList(t0) {
3079
3124
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
3080
3125
  type: "button",
3081
3126
  ref: hidesSelected ? selectedRef : null,
3082
- className: `session-row subagent-run ${branch} ${hidesSelected ? "selected" : ""} ${activity(Math.max(...run.map(_temp7$1)), now)}`,
3127
+ className: `session-row subagent-run ${branch} ${hidesSelected ? "selected" : ""} ${activity(Math.max(...run.map(_temp8$1)), now)}`,
3083
3128
  "aria-expanded": !isCollapsed,
3084
3129
  onClick: () => toggleRun(runKey),
3085
3130
  children: [
@@ -3103,12 +3148,12 @@ function SessionList(t0) {
3103
3148
  className: "session-time-bottom",
3104
3149
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProjectModels, {
3105
3150
  ...run[0],
3106
- models: [...new Set(run.flatMap(_temp8$1))],
3107
- efforts: [...new Set(run.flatMap(_temp9$1))]
3151
+ models: [...new Set(run.flatMap(_temp9$1))],
3152
+ efforts: [...new Set(run.flatMap(_temp10$1))]
3108
3153
  })
3109
3154
  }),
3110
3155
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowStats, {
3111
- at: Math.max(...run.map(_temp10$1)),
3156
+ at: Math.max(...run.map(_temp11$1)),
3112
3157
  tokens: sumOf(run, "totalTokens"),
3113
3158
  cost: sumOf(run, "cost"),
3114
3159
  sortBy
@@ -3116,25 +3161,25 @@ function SessionList(t0) {
3116
3161
  ]
3117
3162
  }, runKey);
3118
3163
  }
3119
- const journal = isJournal(s_3);
3120
- const isFork = !!s_3.forkedFrom;
3121
- const linked = !!deepLink && s_3.filePath === selectedId;
3122
- const command = labelCommand(s_3);
3164
+ const journal = isJournal(s_4);
3165
+ const isFork = !!s_4.forkedFrom;
3166
+ const linked = !!deepLink && s_4.filePath === selectedId;
3167
+ const command = labelCommand(s_4);
3123
3168
  const commandName = command && (command.name || command.message);
3124
3169
  const commandArgs = command && command.args.trim();
3125
- const advice = cacheAdvice(s_3);
3126
- const topEffort = ["max", "xhigh"].find((e_0) => s_3.efforts?.includes(e_0));
3127
- const sessionName = s_3.customTitle && s_3.agentName && s_3.customTitle !== s_3.agentName ? `${s_3.customTitle} [${s_3.agentName}]` : s_3.customTitle || s_3.agentName || "";
3170
+ const advice = cacheAdvice(s_4);
3171
+ const topEffort = ["max", "xhigh"].find((e_1) => s_4.efforts?.includes(e_1));
3172
+ const sessionName = s_4.customTitle && s_4.agentName && s_4.customTitle !== s_4.agentName ? `${s_4.customTitle} [${s_4.agentName}]` : s_4.customTitle || s_4.agentName || "";
3128
3173
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3129
- ref: selectedId === s_3.filePath ? selectedRef : null,
3130
- className: `session-row ${branch} ${selectedId === s_3.filePath ? "selected" : ""} ${runKey ? "is-subagent-child" : ""} ${linked ? "deep-linked" : ""} ${activity(s_3.lastActivityAt, now)}`,
3131
- onClick: () => onSelect(selectedId === s_3.filePath ? null : s_3.filePath),
3174
+ ref: selectedId === s_4.filePath ? selectedRef : null,
3175
+ className: `session-row ${branch} ${selectedId === s_4.filePath ? "selected" : ""} ${runKey ? "is-subagent-child" : ""} ${linked ? "deep-linked" : ""} ${activity(s_4.lastActivityAt, now)}`,
3176
+ onClick: () => onSelect(selectedId === s_4.filePath ? null : s_4.filePath),
3132
3177
  children: [
3133
3178
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
3134
3179
  className: "session-label",
3135
3180
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
3136
3181
  className: "session-label-text",
3137
- children: command ? commandArgs || commandName : sessionLabel(s_3)
3182
+ children: command ? commandArgs || commandName : sessionLabel(s_4)
3138
3183
  })
3139
3184
  }),
3140
3185
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
@@ -3144,18 +3189,18 @@ function SessionList(t0) {
3144
3189
  className: "subagent-tag",
3145
3190
  children: [
3146
3191
  "[journal: ",
3147
- s_3.workflowAgents,
3192
+ s_4.workflowAgents,
3148
3193
  " subagent",
3149
- s_3.workflowAgents === 1 ? "" : "s",
3194
+ s_4.workflowAgents === 1 ? "" : "s",
3150
3195
  "]"
3151
3196
  ]
3152
3197
  }),
3153
- s_3.worktree && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
3198
+ s_4.worktree && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
3154
3199
  className: "worktree-tag",
3155
- "data-tooltip-content": `Worktree of ${s_3.projectShort}`,
3200
+ "data-tooltip-content": `Worktree of ${s_4.projectShort}`,
3156
3201
  children: [
3157
3202
  "[",
3158
- s_3.worktree,
3203
+ s_4.worktree,
3159
3204
  "]"
3160
3205
  ]
3161
3206
  }),
@@ -3163,7 +3208,7 @@ function SessionList(t0) {
3163
3208
  className: "fork-tag",
3164
3209
  role: "img",
3165
3210
  "aria-label": "Forked",
3166
- "data-tooltip-content": `Forked from session ${s_3.forkedFrom.sessionId}`,
3211
+ "data-tooltip-content": `Forked from session ${s_4.forkedFrom.sessionId}`,
3167
3212
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GitBranch, { size: 12 })
3168
3213
  }),
3169
3214
  sessionName && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
@@ -3174,11 +3219,11 @@ function SessionList(t0) {
3174
3219
  className: "session-command",
3175
3220
  children: commandName
3176
3221
  }),
3177
- s_3.tag && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
3222
+ s_4.tag && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
3178
3223
  className: "session-tag",
3179
- children: ["#", s_3.tag]
3224
+ children: ["#", s_4.tag]
3180
3225
  }),
3181
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProjectModels, { ...s_3 }),
3226
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProjectModels, { ...s_4 }),
3182
3227
  linked && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
3183
3228
  className: "deeplink-note",
3184
3229
  children: "opened from deep link"
@@ -3188,40 +3233,40 @@ function SessionList(t0) {
3188
3233
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3189
3234
  className: "session-row-badges",
3190
3235
  children: [
3191
- s_3.avatar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Avatar, { session: s_3 }) }),
3236
+ s_4.avatar && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Suspense, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Avatar, { session: s_4 }) }),
3192
3237
  advice && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3193
3238
  className: "warn-badge",
3194
3239
  tip: `−${advice.pct.toFixed(0)}% (${fmtUSD(advice.saving)}) ${CACHE_LABELS[advice.policy]}\n${TIPS.cache[advice.policy]}`,
3195
3240
  text: advice.policy
3196
3241
  }),
3197
- s_3.lastContextTokens > THRESHOLDS.context.danger && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3242
+ s_4.lastContextTokens > THRESHOLDS.context.danger && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3198
3243
  className: "danger-badge",
3199
- tip: `Context size: ${fmtCompact(s_3.lastContextTokens)} tokens\n${TIPS.context}`,
3244
+ tip: `Context size: ${fmtCompact(s_4.lastContextTokens)} tokens\n${TIPS.context}`,
3200
3245
  icon: Gauge
3201
3246
  }),
3202
- s_3.lastContextTokens > THRESHOLDS.context.warn && s_3.lastContextTokens <= THRESHOLDS.context.danger && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3247
+ s_4.lastContextTokens > THRESHOLDS.context.warn && s_4.lastContextTokens <= THRESHOLDS.context.danger && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3203
3248
  className: "warn-badge",
3204
- tip: `Context size: ${fmtCompact(s_3.lastContextTokens)} tokens\n${TIPS.context}`,
3249
+ tip: `Context size: ${fmtCompact(s_4.lastContextTokens)} tokens\n${TIPS.context}`,
3205
3250
  icon: Gauge
3206
3251
  }),
3207
- s_3.messageCount > THRESHOLDS.messages.danger && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3252
+ s_4.messageCount > THRESHOLDS.messages.danger && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3208
3253
  className: "danger-badge",
3209
- tip: `${fmtNum(s_3.messageCount)} messages\n${TIPS.messages}`,
3254
+ tip: `${fmtNum(s_4.messageCount)} messages\n${TIPS.messages}`,
3210
3255
  icon: MessageSquare
3211
3256
  }),
3212
- s_3.messageCount > THRESHOLDS.messages.warn && s_3.messageCount <= THRESHOLDS.messages.danger && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3257
+ s_4.messageCount > THRESHOLDS.messages.warn && s_4.messageCount <= THRESHOLDS.messages.danger && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3213
3258
  className: "warn-badge",
3214
- tip: `${fmtNum(s_3.messageCount)} messages\n${TIPS.messages}`,
3259
+ tip: `${fmtNum(s_4.messageCount)} messages\n${TIPS.messages}`,
3215
3260
  icon: MessageSquare
3216
3261
  }),
3217
- s_3.activeMs > THRESHOLDS.workTime.danger && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3262
+ s_4.activeMs > THRESHOLDS.workTime.danger && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3218
3263
  className: "danger-badge",
3219
- tip: `Working time: ${fmtDuration(s_3.activeMs)}\n${TIPS.time}`,
3264
+ tip: `Working time: ${fmtDuration(s_4.activeMs)}\n${TIPS.time}`,
3220
3265
  icon: Clock
3221
3266
  }),
3222
- s_3.activeMs > THRESHOLDS.workTime.warn && s_3.activeMs <= THRESHOLDS.workTime.danger && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3267
+ s_4.activeMs > THRESHOLDS.workTime.warn && s_4.activeMs <= THRESHOLDS.workTime.danger && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3223
3268
  className: "warn-badge",
3224
- tip: `Working time: ${fmtDuration(s_3.activeMs)}\n${TIPS.time}`,
3269
+ tip: `Working time: ${fmtDuration(s_4.activeMs)}\n${TIPS.time}`,
3225
3270
  icon: Clock
3226
3271
  }),
3227
3272
  topEffort && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
@@ -3229,27 +3274,32 @@ function SessionList(t0) {
3229
3274
  tip: `Effort: ${topEffort}\n${TIPS.effort}`,
3230
3275
  icon: Brain
3231
3276
  }),
3232
- s_3.speed === "fast" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3233
- className: `fast-badge ${s_3.fastPricingUnknown ? "fast-badge-unknown" : ""}`,
3234
- tip: s_3.fastPricingUnknown ? "Used fast mode — cost is INACCURATE: no fast-mode price multiplier known for this model" : "Used fast mode (speed: fast)",
3277
+ s_4.speed === "fast" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3278
+ className: `fast-badge ${s_4.fastPricingUnknown ? "fast-badge-unknown" : ""}`,
3279
+ tip: s_4.fastPricingUnknown ? "Used fast mode — cost is INACCURATE: no fast-mode price multiplier known for this model" : "Used fast mode (speed: fast)",
3235
3280
  icon: Zap
3236
3281
  }),
3237
- s_3.priceUnknown && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3282
+ s_4.priceUnknown && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3238
3283
  className: "danger-badge",
3239
- tip: `No price entry for ${s_3.models?.join(", ") || "this model"} — cost is missing or understated`,
3284
+ tip: `No price entry for ${s_4.models?.join(", ") || "this model"} — cost is missing or understated`,
3240
3285
  icon: DollarSign
3286
+ }),
3287
+ s_4.debug && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Badge, {
3288
+ className: "debug-badge",
3289
+ tip: TIPS.debug,
3290
+ icon: Bug
3241
3291
  })
3242
3292
  ]
3243
3293
  }),
3244
3294
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowStats, {
3245
- at: s_3.lastActivityAt,
3246
- tokens: s_3.totalTokens,
3247
- cost: s_3.cost,
3295
+ at: s_4.lastActivityAt,
3296
+ tokens: s_4.totalTokens,
3297
+ cost: s_4.cost,
3248
3298
  sortBy,
3249
3299
  toned: true
3250
3300
  })
3251
3301
  ]
3252
- }, s_3.filePath);
3302
+ }, s_4.filePath);
3253
3303
  });
3254
3304
  $[13] = deepLink;
3255
3305
  $[14] = expanded;
@@ -3265,68 +3315,79 @@ function SessionList(t0) {
3265
3315
  $[24] = sorted;
3266
3316
  $[25] = t10;
3267
3317
  $[26] = t11;
3268
- $[27] = t7;
3269
- $[28] = t8;
3270
- $[29] = t9;
3318
+ $[27] = t12;
3319
+ $[28] = t13;
3320
+ $[29] = t7;
3321
+ $[30] = t8;
3322
+ $[31] = t9;
3271
3323
  } else {
3272
3324
  t10 = $[25];
3273
3325
  t11 = $[26];
3274
- t7 = $[27];
3275
- t8 = $[28];
3276
- t9 = $[29];
3326
+ t12 = $[27];
3327
+ t13 = $[28];
3328
+ t7 = $[29];
3329
+ t8 = $[30];
3330
+ t9 = $[31];
3277
3331
  }
3278
- let t12;
3279
- if ($[81] !== t7 || $[82] !== t8 || $[83] !== t9) {
3280
- t12 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3332
+ let t14;
3333
+ if ($[83] !== t10 || $[84] !== t11 || $[85] !== t7 || $[86] !== t8 || $[87] !== t9) {
3334
+ t14 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3281
3335
  className: t7,
3282
- children: [t8, t9]
3336
+ tabIndex: t8,
3337
+ onKeyDown: t9,
3338
+ children: [t10, t11]
3283
3339
  });
3284
- $[81] = t7;
3285
- $[82] = t8;
3286
- $[83] = t9;
3287
- $[84] = t12;
3288
- } else t12 = $[84];
3289
- let t13;
3290
- if ($[85] !== t10 || $[86] !== t11 || $[87] !== t12) {
3291
- t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3292
- className: t10,
3293
- children: [t11, t12]
3340
+ $[83] = t10;
3341
+ $[84] = t11;
3342
+ $[85] = t7;
3343
+ $[86] = t8;
3344
+ $[87] = t9;
3345
+ $[88] = t14;
3346
+ } else t14 = $[88];
3347
+ let t15;
3348
+ if ($[89] !== t12 || $[90] !== t13 || $[91] !== t14) {
3349
+ t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
3350
+ className: t12,
3351
+ children: [t13, t14]
3294
3352
  });
3295
- $[85] = t10;
3296
- $[86] = t11;
3297
- $[87] = t12;
3298
- $[88] = t13;
3299
- } else t13 = $[88];
3300
- return t13;
3353
+ $[89] = t12;
3354
+ $[90] = t13;
3355
+ $[91] = t14;
3356
+ $[92] = t15;
3357
+ } else t15 = $[92];
3358
+ return t15;
3301
3359
  }
3302
- function _temp10$1(c_3) {
3360
+ function _temp11$1(c_3) {
3303
3361
  return c_3.lastActivityAt;
3304
3362
  }
3305
- function _temp9$1(c_2) {
3363
+ function _temp10$1(c_2) {
3306
3364
  return c_2.efforts ?? [];
3307
3365
  }
3308
- function _temp8$1(c_1) {
3366
+ function _temp9$1(c_1) {
3309
3367
  return c_1.models ?? [];
3310
3368
  }
3311
- function _temp7$1(c_0) {
3369
+ function _temp8$1(c_0) {
3312
3370
  return c_0.lastActivityAt;
3313
3371
  }
3372
+ function _temp7$1(r) {
3373
+ return r.session ?? [];
3374
+ }
3314
3375
  function _temp6$1(a_0, b_0) {
3315
3376
  return (b_0.totalTokens || 0) - (a_0.totalTokens || 0);
3316
3377
  }
3317
3378
  function _temp5$2(a, b) {
3318
3379
  return (b.cost || 0) - (a.cost || 0);
3319
3380
  }
3320
- function _temp4$4(s_0) {
3381
+ function _temp4$5(s_0) {
3321
3382
  return !(s_0.agentDescription || s_0.aiTitle || s_0.summary || s_0.firstUserPrompt) && parseCommand(s_0.firstUserCommand);
3322
3383
  }
3323
- function _temp3$4(s) {
3384
+ function _temp3$5(s) {
3324
3385
  return s.lastActivityAt;
3325
3386
  }
3326
- function _temp2$5() {
3387
+ function _temp2$6() {
3327
3388
  return /* @__PURE__ */ new Map();
3328
3389
  }
3329
- function _temp$9(m) {
3390
+ function _temp$10(m) {
3330
3391
  return m.replace(/^claude-/, "");
3331
3392
  }
3332
3393
  // src/renderer/sessions/view/transcript.js
@@ -3451,7 +3512,7 @@ var noteTurn = (it, note, uuid) => metaTurn(it, "system", [{
3451
3512
  folded: !note.level,
3452
3513
  ...note
3453
3514
  }], uuid);
3454
- function flatten(items, { loop = [], side = [], compacts = [] } = {}) {
3515
+ function flatten(items, { loop = [], side = [], compacts = [], mcp = [] } = {}) {
3455
3516
  const summarizing = [...compacts];
3456
3517
  const turns = [];
3457
3518
  const results = {};
@@ -3635,6 +3696,20 @@ function flatten(items, { loop = [], side = [], compacts = [] } = {}) {
3635
3696
  duration: elapsed(t.ts, resultTs[b.id])
3636
3697
  } : b).filter((b) => !(b.type === "tool_result" && calls.has(b.tool_use_id)));
3637
3698
  const out = turns.filter((t) => t.blocks.length > 0);
3699
+ for (let i = 0; i < out.length; i++) {
3700
+ const prompt = out[i];
3701
+ if (prompt.role !== "user" || isContextTurn(prompt)) continue;
3702
+ let next = i + 1;
3703
+ while (next < out.length && !isConversation(out[next])) next++;
3704
+ if (out[next]?.role === "user") continue;
3705
+ for (let j = i + 1; j < out.length && isContextTurn(out[j]); j++) if (out[j].role === "system") {
3706
+ const [context] = out.splice(j, 1);
3707
+ out.splice(i++, 0, {
3708
+ ...context,
3709
+ ts: prompt.ts
3710
+ });
3711
+ }
3712
+ }
3638
3713
  const slot = (turn) => {
3639
3714
  const i = out.findIndex((t) => t.ts != null && t.ts > turn.ts);
3640
3715
  i === -1 ? out.push(turn) : out.splice(i, 0, turn);
@@ -3649,6 +3724,14 @@ function flatten(items, { loop = [], side = [], compacts = [] } = {}) {
3649
3724
  ts: Date.parse(ts) - 500
3650
3725
  });
3651
3726
  }
3727
+ const abovePrompt = (turn) => {
3728
+ const i = out.findLastIndex((t) => t.ts != null && t.ts <= turn.ts && isConversation(t));
3729
+ out[i]?.role === "user" ? out.splice(i, 0, turn) : slot(turn);
3730
+ };
3731
+ for (const turn of mcp) abovePrompt(metaTurn({ timestamp: turn.startedAt }, "system", [{
3732
+ type: "mcp",
3733
+ turn
3734
+ }], `mcp-${turn.startedAt}`));
3652
3735
  const model = currentModel(out);
3653
3736
  for (const [ts, list] of Object.entries(Object.groupBy(loop, (it) => it.timestamp))) {
3654
3737
  const blocks = list.map((it) => ({
@@ -3658,13 +3741,7 @@ function flatten(items, { loop = [], side = [], compacts = [] } = {}) {
3658
3741
  model: it.model ?? model
3659
3742
  }
3660
3743
  }));
3661
- const turn = metaTurn({ timestamp: ts }, "system", blocks, `prompt-${ts}`);
3662
- const i = out.findLastIndex((t) => t.ts != null && t.ts <= turn.ts && [
3663
- "user",
3664
- "assistant",
3665
- "tool"
3666
- ].includes(t.role) && !isContextTurn(t));
3667
- out[i]?.role === "user" ? out.splice(i, 0, turn) : slot(turn);
3744
+ abovePrompt(metaTurn({ timestamp: ts }, "system", blocks, `prompt-${ts}`));
3668
3745
  }
3669
3746
  return out;
3670
3747
  }
@@ -3725,6 +3802,73 @@ function normalizeContent(content) {
3725
3802
  } : b);
3726
3803
  }
3727
3804
  var isContextTurn = (t) => t.blocks.every((b) => b.type === "attachment" && b.folded);
3805
+ var isConversation = (t) => [
3806
+ "user",
3807
+ "assistant",
3808
+ "tool"
3809
+ ].includes(t.role) && !isContextTurn(t);
3810
+ var blockTokens = (b) => b.type === "instruction" ? countTokens(b.it.content, b.it.model) : isCounted(b) ? countTokens(blockView(b).body) : 0;
3811
+ var STRIP_GROUPS = {
3812
+ "System Prompt": "prompt",
3813
+ "System Tools": "tools",
3814
+ "MCP Tools": "tools",
3815
+ "Deferred Tools": "tools",
3816
+ "MCP Instructions": "mcp",
3817
+ Skills: "listings",
3818
+ "Agent Types": "listings"
3819
+ };
3820
+ var ATTACHMENT_GROUPS = {
3821
+ output_style: "prompt",
3822
+ output_style_instructions: "prompt",
3823
+ deferred_tools_delta: "tools",
3824
+ mcp_instructions_delta: "mcp",
3825
+ instructions: "memory",
3826
+ skill_listing: "listings",
3827
+ agent_listing_delta: "listings"
3828
+ };
3829
+ var groupOf = (b) => {
3830
+ if (b.type === "mcp") return "mcp";
3831
+ if (b.type === "attachment") return ATTACHMENT_GROUPS[b.attachment.type] ?? "context";
3832
+ return STRIP_GROUPS[b.it.file_path] ?? (b.it.name ? "memory" : "context");
3833
+ };
3834
+ var GROUP_ORDER = [
3835
+ "prompt",
3836
+ "tools",
3837
+ "mcp",
3838
+ "memory",
3839
+ "listings",
3840
+ "context"
3841
+ ];
3842
+ function systemGroups(turns) {
3843
+ const blocks = turns.flatMap((t) => t.blocks);
3844
+ const rows = Object.groupBy(blocks.filter((b) => b.type === "instruction" || b.type === "mcp" || b.folded && isCounted(b)), groupOf);
3845
+ rows.context?.push(...blocks.filter((b) => b.type === "attachment" && b.folded && !isCounted(b)));
3846
+ rows.prompt?.sort((a, b) => (a.type === "attachment") - (b.type === "attachment"));
3847
+ return GROUP_ORDER.filter((key) => rows[key]).map((key) => ({
3848
+ key,
3849
+ blocks: rows[key],
3850
+ title: groupTitle(key, rows[key]),
3851
+ tokens: rows[key].reduce((sum, b) => sum + blockTokens(b), 0)
3852
+ }));
3853
+ }
3854
+ var latestServers = (turns) => [...new Map(turns.flatMap((t) => t.servers).map((s) => [s.name, s])).values()];
3855
+ function mcpGroupParts(blocks) {
3856
+ const turns = blocks.filter((b) => b.type === "mcp").map((b) => b.turn);
3857
+ const names = new Set(turns.flatMap((t) => t.servers.map((s) => s.name)));
3858
+ const listings = blocks.filter((b) => b.type !== "mcp").map((block) => ({
3859
+ block,
3860
+ sections: block.it?.items ?? blockView(block).items ?? []
3861
+ }));
3862
+ const nests = ({ sections }) => sections.length > 0 && sections.every((s) => names.has(s.name));
3863
+ return {
3864
+ turns,
3865
+ instructions: new Map(listings.filter(nests).flatMap(({ block, sections }) => sections.map((s) => [s.name, {
3866
+ content: s.content,
3867
+ model: block.it?.model
3868
+ }]))),
3869
+ rest: listings.filter((l) => !nests(l)).map((l) => l.block)
3870
+ };
3871
+ }
3728
3872
  function groupTurns(turns) {
3729
3873
  const groups = [];
3730
3874
  let cycle = null;
@@ -3844,124 +3988,23 @@ function tokenPoints(groups) {
3844
3988
  };
3845
3989
  });
3846
3990
  }
3847
- // src/renderer/ui/Divider.jsx
3848
- function Divider(t0) {
3849
- const $ = (0, import_compiler_runtime.c)(7);
3850
- const { children, onClick, title, className: t1 } = t0;
3851
- const className = t1 === void 0 ? "" : t1;
3852
- const Tag = onClick ? "button" : "div";
3853
- const t2 = onClick ? "button" : void 0;
3854
- const t3 = `divider ${className}`;
3855
- let t4;
3856
- if ($[0] !== Tag || $[1] !== children || $[2] !== onClick || $[3] !== t2 || $[4] !== t3 || $[5] !== title) {
3857
- t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tag, {
3858
- type: t2,
3859
- className: t3,
3860
- onClick,
3861
- "data-tooltip-content": title,
3862
- children
3863
- });
3864
- $[0] = Tag;
3865
- $[1] = children;
3866
- $[2] = onClick;
3867
- $[3] = t2;
3868
- $[4] = t3;
3869
- $[5] = title;
3870
- $[6] = t4;
3871
- } else t4 = $[6];
3872
- return t4;
3873
- }
3874
- // src/renderer/ui/LazyMount.jsx
3875
- function LazyMount(t0) {
3876
- const $ = (0, import_compiler_runtime.c)(22);
3877
- let children;
3878
- let rest;
3879
- let style;
3880
- let t1;
3991
+ // src/renderer/sessions/view/ApproxTokens.jsx
3992
+ function ApproxTokens(t0) {
3993
+ const $ = (0, import_compiler_runtime.c)(3);
3994
+ const { tokens, tip: t1 } = t0;
3995
+ const tip = t1 === void 0 ? "Approx. tokens" : t1;
3881
3996
  let t2;
3882
- let t3;
3883
- let t4;
3884
- if ($[0] !== t0) {
3885
- ({children, eager: t1, forceMount: t2, placeholderMinHeight: t3, rootRef: t4, style, ...rest} = t0);
3886
- $[0] = t0;
3887
- $[1] = children;
3888
- $[2] = rest;
3889
- $[3] = style;
3890
- $[4] = t1;
3891
- $[5] = t2;
3892
- $[6] = t3;
3893
- $[7] = t4;
3894
- } else {
3895
- children = $[1];
3896
- rest = $[2];
3897
- style = $[3];
3898
- t1 = $[4];
3899
- t2 = $[5];
3900
- t3 = $[6];
3901
- t4 = $[7];
3902
- }
3903
- const eager = t1 === void 0 ? false : t1;
3904
- const forceMount = t2 === void 0 ? false : t2;
3905
- const placeholderMinHeight = t3 === void 0 ? 120 : t3;
3906
- const rootRef = t4 === void 0 ? null : t4;
3907
- const ref = (0, import_react.useRef)(null);
3908
- const [mounted, setMounted] = (0, import_react.useState)(eager);
3909
- const render = mounted || forceMount;
3910
- let t5;
3911
- if ($[8] !== mounted || $[9] !== rootRef?.current) {
3912
- t5 = () => {
3913
- if (mounted) return;
3914
- const io = new IntersectionObserver((t6) => {
3915
- const [e] = t6;
3916
- if (e.isIntersecting) {
3917
- setMounted(true);
3918
- io.disconnect();
3919
- }
3920
- }, {
3921
- root: rootRef?.current ?? null,
3922
- rootMargin: "600px 0px"
3923
- });
3924
- io.observe(ref.current);
3925
- return () => io.disconnect();
3926
- };
3927
- $[8] = mounted;
3928
- $[9] = rootRef?.current;
3929
- $[10] = t5;
3930
- } else t5 = $[10];
3931
- let t6;
3932
- if ($[11] !== mounted || $[12] !== rootRef) {
3933
- t6 = [mounted, rootRef];
3934
- $[11] = mounted;
3935
- $[12] = rootRef;
3936
- $[13] = t6;
3937
- } else t6 = $[13];
3938
- (0, import_react.useEffect)(t5, t6);
3939
- let t7;
3940
- if ($[14] !== placeholderMinHeight || $[15] !== render || $[16] !== style) {
3941
- t7 = render ? style : {
3942
- ...style,
3943
- minHeight: placeholderMinHeight
3944
- };
3945
- $[14] = placeholderMinHeight;
3946
- $[15] = render;
3947
- $[16] = style;
3948
- $[17] = t7;
3949
- } else t7 = $[17];
3950
- const t8 = render && children;
3951
- let t9;
3952
- if ($[18] !== rest || $[19] !== t7 || $[20] !== t8) {
3953
- t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
3954
- ref,
3955
- style: t7,
3956
- ...rest,
3957
- children: t8
3997
+ if ($[0] !== tip || $[1] !== tokens) {
3998
+ t2 = tokens > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
3999
+ className: "instruction-tokens",
4000
+ "data-tooltip-content": tip,
4001
+ children: ["~ ", fmtCompact(tokens)]
3958
4002
  });
3959
- $[18] = rest;
3960
- $[19] = t7;
3961
- $[20] = t8;
3962
- $[21] = t9;
3963
- } else t9 = $[21];
3964
- return t9;
4003
+ $[0] = tip;
4004
+ $[1] = tokens;
4005
+ $[2] = t2;
4006
+ } else t2 = $[2];
4007
+ return t2;
3965
4008
  }
3966
4009
  // src/renderer/utils/textBlock.js
3967
4010
  var detectLang = (body, limit = 500) => {
@@ -4070,6 +4113,98 @@ function splitMarkdown(text, size = 1e4) {
4070
4113
  if (buf.length) chunks.push(buf.join("\n"));
4071
4114
  return chunks;
4072
4115
  }
4116
+ // src/renderer/ui/LazyMount.jsx
4117
+ function LazyMount(t0) {
4118
+ const $ = (0, import_compiler_runtime.c)(22);
4119
+ let children;
4120
+ let rest;
4121
+ let style;
4122
+ let t1;
4123
+ let t2;
4124
+ let t3;
4125
+ let t4;
4126
+ if ($[0] !== t0) {
4127
+ ({children, eager: t1, forceMount: t2, placeholderMinHeight: t3, rootRef: t4, style, ...rest} = t0);
4128
+ $[0] = t0;
4129
+ $[1] = children;
4130
+ $[2] = rest;
4131
+ $[3] = style;
4132
+ $[4] = t1;
4133
+ $[5] = t2;
4134
+ $[6] = t3;
4135
+ $[7] = t4;
4136
+ } else {
4137
+ children = $[1];
4138
+ rest = $[2];
4139
+ style = $[3];
4140
+ t1 = $[4];
4141
+ t2 = $[5];
4142
+ t3 = $[6];
4143
+ t4 = $[7];
4144
+ }
4145
+ const eager = t1 === void 0 ? false : t1;
4146
+ const forceMount = t2 === void 0 ? false : t2;
4147
+ const placeholderMinHeight = t3 === void 0 ? 120 : t3;
4148
+ const rootRef = t4 === void 0 ? null : t4;
4149
+ const ref = (0, import_react.useRef)(null);
4150
+ const [mounted, setMounted] = (0, import_react.useState)(eager);
4151
+ const render = mounted || forceMount;
4152
+ let t5;
4153
+ if ($[8] !== mounted || $[9] !== rootRef?.current) {
4154
+ t5 = () => {
4155
+ if (mounted) return;
4156
+ const io = new IntersectionObserver((t6) => {
4157
+ const [e] = t6;
4158
+ if (e.isIntersecting) {
4159
+ setMounted(true);
4160
+ io.disconnect();
4161
+ }
4162
+ }, {
4163
+ root: rootRef?.current ?? null,
4164
+ rootMargin: "600px 0px"
4165
+ });
4166
+ io.observe(ref.current);
4167
+ return () => io.disconnect();
4168
+ };
4169
+ $[8] = mounted;
4170
+ $[9] = rootRef?.current;
4171
+ $[10] = t5;
4172
+ } else t5 = $[10];
4173
+ let t6;
4174
+ if ($[11] !== mounted || $[12] !== rootRef) {
4175
+ t6 = [mounted, rootRef];
4176
+ $[11] = mounted;
4177
+ $[12] = rootRef;
4178
+ $[13] = t6;
4179
+ } else t6 = $[13];
4180
+ (0, import_react.useEffect)(t5, t6);
4181
+ let t7;
4182
+ if ($[14] !== placeholderMinHeight || $[15] !== render || $[16] !== style) {
4183
+ t7 = render ? style : {
4184
+ ...style,
4185
+ minHeight: placeholderMinHeight
4186
+ };
4187
+ $[14] = placeholderMinHeight;
4188
+ $[15] = render;
4189
+ $[16] = style;
4190
+ $[17] = t7;
4191
+ } else t7 = $[17];
4192
+ const t8 = render && children;
4193
+ let t9;
4194
+ if ($[18] !== rest || $[19] !== t7 || $[20] !== t8) {
4195
+ t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
4196
+ ref,
4197
+ style: t7,
4198
+ ...rest,
4199
+ children: t8
4200
+ });
4201
+ $[18] = rest;
4202
+ $[19] = t7;
4203
+ $[20] = t8;
4204
+ $[21] = t9;
4205
+ } else t9 = $[21];
4206
+ return t9;
4207
+ }
4073
4208
  // src/renderer/ui/OpenLink.jsx
4074
4209
  function OpenLink(t0) {
4075
4210
  const $ = (0, import_compiler_runtime.c)(13);
@@ -4133,9 +4268,9 @@ var subscribe$1 = (cb) => {
4133
4268
  return () => listeners$1.delete(cb);
4134
4269
  };
4135
4270
  function useFindActive() {
4136
- return (0, import_react.useSyncExternalStore)(subscribe$1, _temp$8);
4271
+ return (0, import_react.useSyncExternalStore)(subscribe$1, _temp$9);
4137
4272
  }
4138
- function _temp$8() {
4273
+ function _temp$9() {
4139
4274
  return active;
4140
4275
  }
4141
4276
  function closeFind() {
@@ -4267,42 +4402,437 @@ function Markdown(t0) {
4267
4402
  text: c,
4268
4403
  components
4269
4404
  })
4270
- }, i));
4271
- }
4272
- $[8] = autoFence;
4273
- $[9] = className;
4274
- $[10] = components;
4275
- $[11] = findOpen;
4276
- $[12] = rest;
4277
- $[13] = text;
4278
- $[14] = t5;
4279
- $[15] = t6;
4280
- $[16] = t7;
4281
- $[17] = t8;
4282
- $[18] = t9;
4283
- } else {
4284
- t5 = $[14];
4285
- t6 = $[15];
4286
- t7 = $[16];
4287
- t8 = $[17];
4288
- t9 = $[18];
4289
- }
4290
- if (t9 !== Symbol.for("react.early_return_sentinel")) return t9;
4291
- let t10;
4292
- if ($[22] !== t5 || $[23] !== t6 || $[24] !== t7 || $[25] !== t8) {
4293
- t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
4294
- className: t5,
4295
- ref: t6,
4296
- ...t7,
4297
- children: t8
4405
+ }, i));
4406
+ }
4407
+ $[8] = autoFence;
4408
+ $[9] = className;
4409
+ $[10] = components;
4410
+ $[11] = findOpen;
4411
+ $[12] = rest;
4412
+ $[13] = text;
4413
+ $[14] = t5;
4414
+ $[15] = t6;
4415
+ $[16] = t7;
4416
+ $[17] = t8;
4417
+ $[18] = t9;
4418
+ } else {
4419
+ t5 = $[14];
4420
+ t6 = $[15];
4421
+ t7 = $[16];
4422
+ t8 = $[17];
4423
+ t9 = $[18];
4424
+ }
4425
+ if (t9 !== Symbol.for("react.early_return_sentinel")) return t9;
4426
+ let t10;
4427
+ if ($[22] !== t5 || $[23] !== t6 || $[24] !== t7 || $[25] !== t8) {
4428
+ t10 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
4429
+ className: t5,
4430
+ ref: t6,
4431
+ ...t7,
4432
+ children: t8
4433
+ });
4434
+ $[22] = t5;
4435
+ $[23] = t6;
4436
+ $[24] = t7;
4437
+ $[25] = t8;
4438
+ $[26] = t10;
4439
+ } else t10 = $[26];
4440
+ return t10;
4441
+ }
4442
+ // src/renderer/sessions/view/useCollapsed.js
4443
+ var ExpandAllContext = (0, import_react.createContext)(null);
4444
+ function useCollapsed(defaultOpen) {
4445
+ const $ = (0, import_compiler_runtime.c)(2);
4446
+ const expandAll = (0, import_react.useContext)(ExpandAllContext);
4447
+ const [open, setOpen] = (0, import_react.useState)(expandAll ?? defaultOpen);
4448
+ const [applied, setApplied] = (0, import_react.useState)(expandAll);
4449
+ if (applied !== expandAll) {
4450
+ setApplied(expandAll);
4451
+ if (expandAll != null) setOpen(expandAll);
4452
+ }
4453
+ let t0;
4454
+ if ($[0] !== open) {
4455
+ t0 = [open, setOpen];
4456
+ $[0] = open;
4457
+ $[1] = t0;
4458
+ } else t0 = $[1];
4459
+ return t0;
4460
+ }
4461
+ // src/renderer/sessions/view/McpConnections.jsx
4462
+ var ms = (n) => n === null ? "—" : `${fmtNum(n)}ms`;
4463
+ var RUN_WITH_DEBUG = "Run with --debug (debug: true in the Agent SDK) to see it";
4464
+ var TRANSPORT_TIP = `Transport: how this server connects (stdio, http, …). ${RUN_WITH_DEBUG}`;
4465
+ var TIME_TIP = `Connect time: how long this server took to connect. ${RUN_WITH_DEBUG}`;
4466
+ var READY_TIP = "Connect time: at most this long. It was still connecting at an earlier request and ready at this one";
4467
+ var VERSION_TIP = "The version this server reported when it connected";
4468
+ var CACHED_TIP = "Connected from a cache: the server tagged its version +cached";
4469
+ var INSTRUCTIONS_TIP = "Approx. tokens of this server's instructions. Click the row to read them";
4470
+ var label = (status) => status.replace("-", " ");
4471
+ var counts = (servers) => Object.entries(Object.groupBy(servers, (s) => s.status)).map(([status, list]) => `${list.length} ${label(status)}`).join(", ");
4472
+ function McpTitle(t0) {
4473
+ const $ = (0, import_compiler_runtime.c)(7);
4474
+ const { servers } = t0;
4475
+ let t1;
4476
+ if ($[0] !== servers) {
4477
+ t1 = servers.filter(_temp$8);
4478
+ $[0] = servers;
4479
+ $[1] = t1;
4480
+ } else t1 = $[1];
4481
+ const started = t1.length;
4482
+ let t2;
4483
+ if ($[2] !== servers) {
4484
+ t2 = counts(servers);
4485
+ $[2] = servers;
4486
+ $[3] = t2;
4487
+ } else t2 = $[3];
4488
+ const t3 = started > 0 && ` · ${started} ${started === 1 ? "process" : "processes"} started`;
4489
+ let t4;
4490
+ if ($[4] !== t2 || $[5] !== t3) {
4491
+ t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
4492
+ className: "mcp-title",
4493
+ children: [
4494
+ "MCP servers: ",
4495
+ t2,
4496
+ t3
4497
+ ]
4498
+ });
4499
+ $[4] = t2;
4500
+ $[5] = t3;
4501
+ $[6] = t4;
4502
+ } else t4 = $[6];
4503
+ return t4;
4504
+ }
4505
+ function _temp$8(s) {
4506
+ return s.transport === "stdio";
4507
+ }
4508
+ function McpConnections(t0) {
4509
+ const $ = (0, import_compiler_runtime.c)(10);
4510
+ const { turn, instructions } = t0;
4511
+ let t1;
4512
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
4513
+ t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("colgroup", { children: [
4514
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("col", {}),
4515
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("col", { className: "mcp-col-transport" }),
4516
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("col", { className: "mcp-col-time" }),
4517
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("col", { className: "mcp-col-status" }),
4518
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("col", { className: "mcp-col-tokens" })
4519
+ ] });
4520
+ $[0] = t1;
4521
+ } else t1 = $[0];
4522
+ let t2;
4523
+ if ($[1] !== instructions || $[2] !== turn.debug || $[3] !== turn.servers) {
4524
+ let t3;
4525
+ if ($[5] !== instructions || $[6] !== turn.debug) {
4526
+ t3 = (s) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Server, {
4527
+ s,
4528
+ debug: turn.debug,
4529
+ instructions: instructions?.get(s.name),
4530
+ gutter: instructions?.size > 0
4531
+ }, s.name);
4532
+ $[5] = instructions;
4533
+ $[6] = turn.debug;
4534
+ $[7] = t3;
4535
+ } else t3 = $[7];
4536
+ t2 = turn.servers.map(t3);
4537
+ $[1] = instructions;
4538
+ $[2] = turn.debug;
4539
+ $[3] = turn.servers;
4540
+ $[4] = t2;
4541
+ } else t2 = $[4];
4542
+ let t3;
4543
+ if ($[8] !== t2) {
4544
+ t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", {
4545
+ className: "mcp-servers",
4546
+ children: [t1, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: t2 })]
4547
+ });
4548
+ $[8] = t2;
4549
+ $[9] = t3;
4550
+ } else t3 = $[9];
4551
+ return t3;
4552
+ }
4553
+ function Server(t0) {
4554
+ const $ = (0, import_compiler_runtime.c)(58);
4555
+ const { s, debug, instructions, gutter } = t0;
4556
+ const [open, setOpen] = useCollapsed(false);
4557
+ const t1 = instructions && "mcp-foldable";
4558
+ let t2;
4559
+ if ($[0] !== instructions || $[1] !== setOpen) {
4560
+ t2 = instructions && (() => setOpen(_temp2$5));
4561
+ $[0] = instructions;
4562
+ $[1] = setOpen;
4563
+ $[2] = t2;
4564
+ } else t2 = $[2];
4565
+ let t3;
4566
+ if ($[3] !== gutter || $[4] !== instructions || $[5] !== open) {
4567
+ t3 = gutter && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
4568
+ className: `mcp-chevron${instructions ? "" : " none"}`,
4569
+ "aria-expanded": open,
4570
+ "aria-label": "Instructions",
4571
+ children: open ? "▾" : "▸"
4572
+ });
4573
+ $[3] = gutter;
4574
+ $[4] = instructions;
4575
+ $[5] = open;
4576
+ $[6] = t3;
4577
+ } else t3 = $[6];
4578
+ let t4;
4579
+ if ($[7] !== s.toolCount) {
4580
+ t4 = s.toolCount != null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
4581
+ className: "mcp-dim",
4582
+ children: [
4583
+ " (",
4584
+ plural(s.toolCount, "tool"),
4585
+ ")"
4586
+ ]
4587
+ });
4588
+ $[7] = s.toolCount;
4589
+ $[8] = t4;
4590
+ } else t4 = $[8];
4591
+ let t5;
4592
+ if ($[9] !== s.version) {
4593
+ t5 = s.version && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
4594
+ className: "mcp-version",
4595
+ "data-tooltip-content": VERSION_TIP,
4596
+ children: s.version
4597
+ });
4598
+ $[9] = s.version;
4599
+ $[10] = t5;
4600
+ } else t5 = $[10];
4601
+ let t6;
4602
+ if ($[11] !== s.name || $[12] !== t3 || $[13] !== t4 || $[14] !== t5) {
4603
+ t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
4604
+ t3,
4605
+ s.name,
4606
+ t4,
4607
+ t5
4608
+ ] });
4609
+ $[11] = s.name;
4610
+ $[12] = t3;
4611
+ $[13] = t4;
4612
+ $[14] = t5;
4613
+ $[15] = t6;
4614
+ } else t6 = $[15];
4615
+ const t7 = debug ? void 0 : TRANSPORT_TIP;
4616
+ const t8 = s.transport ?? "—";
4617
+ let t9;
4618
+ if ($[16] !== t7 || $[17] !== t8) {
4619
+ t9 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
4620
+ className: "mcp-dim",
4621
+ "data-tooltip-content": t7,
4622
+ children: t8
4623
+ });
4624
+ $[16] = t7;
4625
+ $[17] = t8;
4626
+ $[18] = t9;
4627
+ } else t9 = $[18];
4628
+ let t10;
4629
+ if ($[19] !== debug || $[20] !== s.cached || $[21] !== s.ms || $[22] !== s.readyWithin) {
4630
+ t10 = s.readyWithin != null ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", {
4631
+ className: "mcp-ms",
4632
+ "data-tooltip-content": READY_TIP,
4633
+ children: ["≤ ", ms(s.readyWithin)]
4634
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", {
4635
+ className: "mcp-ms",
4636
+ "data-tooltip-content": debug ? void 0 : TIME_TIP,
4637
+ children: [s.cached && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
4638
+ className: "mcp-cached",
4639
+ "data-tooltip-content": CACHED_TIP,
4640
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Database, {})
4641
+ }), ms(s.ms)]
4642
+ });
4643
+ $[19] = debug;
4644
+ $[20] = s.cached;
4645
+ $[21] = s.ms;
4646
+ $[22] = s.readyWithin;
4647
+ $[23] = t10;
4648
+ } else t10 = $[23];
4649
+ const t11 = `mcp-status ${s.status}`;
4650
+ let t12;
4651
+ if ($[24] !== s.status) {
4652
+ t12 = label(s.status);
4653
+ $[24] = s.status;
4654
+ $[25] = t12;
4655
+ } else t12 = $[25];
4656
+ let t13;
4657
+ if ($[26] !== t11 || $[27] !== t12) {
4658
+ t13 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
4659
+ className: t11,
4660
+ children: t12
4661
+ });
4662
+ $[26] = t11;
4663
+ $[27] = t12;
4664
+ $[28] = t13;
4665
+ } else t13 = $[28];
4666
+ let t14;
4667
+ if ($[29] !== instructions) {
4668
+ t14 = instructions && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ApproxTokens, {
4669
+ tokens: countTokens(instructions.content, instructions.model),
4670
+ tip: INSTRUCTIONS_TIP
4671
+ });
4672
+ $[29] = instructions;
4673
+ $[30] = t14;
4674
+ } else t14 = $[30];
4675
+ let t15;
4676
+ if ($[31] !== t14) {
4677
+ t15 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
4678
+ className: "mcp-tokens",
4679
+ children: t14
4680
+ });
4681
+ $[31] = t14;
4682
+ $[32] = t15;
4683
+ } else t15 = $[32];
4684
+ let t16;
4685
+ if ($[33] !== t1 || $[34] !== t10 || $[35] !== t13 || $[36] !== t15 || $[37] !== t2 || $[38] !== t6 || $[39] !== t9) {
4686
+ t16 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", {
4687
+ className: t1,
4688
+ onClick: t2,
4689
+ children: [
4690
+ t6,
4691
+ t9,
4692
+ t10,
4693
+ t13,
4694
+ t15
4695
+ ]
4696
+ });
4697
+ $[33] = t1;
4698
+ $[34] = t10;
4699
+ $[35] = t13;
4700
+ $[36] = t15;
4701
+ $[37] = t2;
4702
+ $[38] = t6;
4703
+ $[39] = t9;
4704
+ $[40] = t16;
4705
+ } else t16 = $[40];
4706
+ let t17;
4707
+ if ($[41] !== s.error || $[42] !== s.status || $[43] !== s.stderr) {
4708
+ t17 = (s.error || s.stderr.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
4709
+ colSpan: 5,
4710
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
4711
+ className: `mcp-error ${s.status}`,
4712
+ children: [s.error, ...s.stderr].filter(Boolean).join("\n")
4713
+ })
4714
+ }) });
4715
+ $[41] = s.error;
4716
+ $[42] = s.status;
4717
+ $[43] = s.stderr;
4718
+ $[44] = t17;
4719
+ } else t17 = $[44];
4720
+ let t18;
4721
+ if ($[45] !== instructions || $[46] !== open) {
4722
+ t18 = open && instructions && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
4723
+ colSpan: 5,
4724
+ className: "mcp-tool",
4725
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
4726
+ className: "aux-body",
4727
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Markdown, {
4728
+ className: "block-text",
4729
+ text: instructions.content
4730
+ })
4731
+ })
4732
+ }) });
4733
+ $[45] = instructions;
4734
+ $[46] = open;
4735
+ $[47] = t18;
4736
+ } else t18 = $[47];
4737
+ let t19;
4738
+ if ($[48] !== s.groups) {
4739
+ t19 = s.groups.map(_temp3$4);
4740
+ $[48] = s.groups;
4741
+ $[49] = t19;
4742
+ } else t19 = $[49];
4743
+ let t20;
4744
+ if ($[50] !== s.tools) {
4745
+ t20 = s.tools.map(_temp4$4);
4746
+ $[50] = s.tools;
4747
+ $[51] = t20;
4748
+ } else t20 = $[51];
4749
+ let t21;
4750
+ if ($[52] !== t16 || $[53] !== t17 || $[54] !== t18 || $[55] !== t19 || $[56] !== t20) {
4751
+ t21 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
4752
+ t16,
4753
+ t17,
4754
+ t18,
4755
+ t19,
4756
+ t20
4757
+ ] });
4758
+ $[52] = t16;
4759
+ $[53] = t17;
4760
+ $[54] = t18;
4761
+ $[55] = t19;
4762
+ $[56] = t20;
4763
+ $[57] = t21;
4764
+ } else t21 = $[57];
4765
+ return t21;
4766
+ }
4767
+ function _temp4$4(t, j) {
4768
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", {
4769
+ className: "mcp-dim",
4770
+ children: [
4771
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", {
4772
+ colSpan: 2,
4773
+ className: "mcp-tool",
4774
+ children: [
4775
+ "↳ ",
4776
+ t.name,
4777
+ t.error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
4778
+ className: "mcp-tool-error",
4779
+ children: [" · ", t.error]
4780
+ })
4781
+ ]
4782
+ }),
4783
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
4784
+ className: "mcp-ms",
4785
+ children: ms(t.ms)
4786
+ }),
4787
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { colSpan: 2 })
4788
+ ]
4789
+ }, j);
4790
+ }
4791
+ function _temp3$4(g) {
4792
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", {
4793
+ className: "mcp-dim",
4794
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", {
4795
+ colSpan: 5,
4796
+ className: "mcp-tool",
4797
+ children: [
4798
+ "↳ ",
4799
+ g.name,
4800
+ " (",
4801
+ plural(g.toolCount, "tool"),
4802
+ ")"
4803
+ ]
4804
+ })
4805
+ }, g.name);
4806
+ }
4807
+ function _temp2$5(v) {
4808
+ return !v;
4809
+ }
4810
+ // src/renderer/ui/Divider.jsx
4811
+ function Divider(t0) {
4812
+ const $ = (0, import_compiler_runtime.c)(7);
4813
+ const { children, onClick, title, className: t1 } = t0;
4814
+ const className = t1 === void 0 ? "" : t1;
4815
+ const Tag = onClick ? "button" : "div";
4816
+ const t2 = onClick ? "button" : void 0;
4817
+ const t3 = `divider ${className}`;
4818
+ let t4;
4819
+ if ($[0] !== Tag || $[1] !== children || $[2] !== onClick || $[3] !== t2 || $[4] !== t3 || $[5] !== title) {
4820
+ t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tag, {
4821
+ type: t2,
4822
+ className: t3,
4823
+ onClick,
4824
+ "data-tooltip-content": title,
4825
+ children
4298
4826
  });
4299
- $[22] = t5;
4300
- $[23] = t6;
4301
- $[24] = t7;
4302
- $[25] = t8;
4303
- $[26] = t10;
4304
- } else t10 = $[26];
4305
- return t10;
4827
+ $[0] = Tag;
4828
+ $[1] = children;
4829
+ $[2] = onClick;
4830
+ $[3] = t2;
4831
+ $[4] = t3;
4832
+ $[5] = title;
4833
+ $[6] = t4;
4834
+ } else t4 = $[6];
4835
+ return t4;
4306
4836
  }
4307
4837
  // src/renderer/ui/ProgressBar.jsx
4308
4838
  function ProgressBar(t0) {
@@ -4365,25 +4895,7 @@ function Tip(t0) {
4365
4895
  // src/renderer/assets/claude-icon.svg
4366
4896
  var claude_icon_default = new URL("claude-icon-BqihzN4C.svg", import.meta.url).href;
4367
4897
  // src/renderer/sessions/view/ConversationView.jsx
4368
- var ExpandAllContext = import_react.createContext(null);
4369
4898
  var TranscriptFileContext = import_react.createContext(null);
4370
- function useCollapsed(defaultOpen) {
4371
- const $ = (0, import_compiler_runtime.c)(2);
4372
- const expandAll = (0, import_react.useContext)(ExpandAllContext);
4373
- const [open, setOpen] = (0, import_react.useState)(expandAll ?? defaultOpen);
4374
- const [applied, setApplied] = (0, import_react.useState)(expandAll);
4375
- if (applied !== expandAll) {
4376
- setApplied(expandAll);
4377
- if (expandAll != null) setOpen(expandAll);
4378
- }
4379
- let t0;
4380
- if ($[0] !== open) {
4381
- t0 = [open, setOpen];
4382
- $[0] = open;
4383
- $[1] = t0;
4384
- } else t0 = $[1];
4385
- return t0;
4386
- }
4387
4899
  var FILTERS = [
4388
4900
  {
4389
4901
  value: "user",
@@ -4947,21 +5459,22 @@ var AUTHORS = {
4947
5459
  }
4948
5460
  };
4949
5461
  var isFolded = (t) => t.blocks.every((b) => b.folded);
4950
- var isCounted = (b) => b.type === "attachment" && !b.unsent && hasText(attachmentView(b.attachment, b.rendered));
4951
5462
  function InputRow(t0) {
4952
- const $ = (0, import_compiler_runtime.c)(19);
5463
+ const $ = (0, import_compiler_runtime.c)(21);
4953
5464
  const { kind, turns, point, index } = t0;
4954
5465
  const [open, setOpen] = useCollapsed(false);
4955
5466
  let t1;
4956
5467
  if ($[0] !== index || $[1] !== kind || $[2] !== open || $[3] !== point || $[4] !== setOpen || $[5] !== turns) {
4957
- const msgs = turns.filter(_temp4$3);
4958
- const folded = turns.filter(isFolded).flatMap(_temp5$1);
5468
+ const groups = kind === "system" ? systemGroups(turns) : [];
5469
+ const grouped = new Set(groups.flatMap(_temp4$3));
5470
+ const msgs = turns.filter(_temp5$1);
5471
+ const folded = turns.filter(isFolded).flatMap(_temp6).filter((b) => !grouped.has(b));
4959
5472
  const counted = new Set(folded.filter(isCounted));
4960
- const ctxItems = folded.filter((b) => !counted.has(b));
5473
+ const ctxItems = folded.filter((b_0) => !counted.has(b_0));
4961
5474
  const ts = (msgs[0] ?? turns[0]).ts;
4962
5475
  const { Icon, name } = AUTHORS[kind];
4963
5476
  const count = (type, noun) => {
4964
- const n = ctxItems.filter((b_0) => b_0.type === type).length;
5477
+ const n = ctxItems.filter((b_1) => b_1.type === type).length;
4965
5478
  return n > 0 && plural(n, noun);
4966
5479
  };
4967
5480
  const t2 = [count("attachment", "attachment"), count("system", "notice")];
@@ -5011,6 +5524,12 @@ function InputRow(t0) {
5011
5524
  $[17] = t7;
5012
5525
  $[18] = t8;
5013
5526
  } else t8 = $[18];
5527
+ let t9;
5528
+ if ($[19] !== grouped) {
5529
+ t9 = (t_2) => !t_2.blocks.every((b_3) => grouped.has(b_3));
5530
+ $[19] = grouped;
5531
+ $[20] = t9;
5532
+ } else t9 = $[20];
5014
5533
  t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
5015
5534
  className: `msg-${kind}`,
5016
5535
  children: [
@@ -5019,13 +5538,13 @@ function InputRow(t0) {
5019
5538
  children: [
5020
5539
  t4,
5021
5540
  t5,
5022
- msgs.some(_temp6) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
5541
+ msgs.some(_temp7) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
5023
5542
  className: "msg-summary",
5024
5543
  children: "queued during the previous turn"
5025
5544
  }),
5026
5545
  ctxItems.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
5027
5546
  className: "msg-summary",
5028
- onClick: () => setOpen(_temp7),
5547
+ onClick: () => setOpen(_temp8),
5029
5548
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
5030
5549
  className: "aux-chevron",
5031
5550
  children: open ? "▾" : "▸"
@@ -5034,14 +5553,18 @@ function InputRow(t0) {
5034
5553
  t8
5035
5554
  ]
5036
5555
  }),
5037
- (open ? folded.length : counted.size) > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
5556
+ (groups.length > 0 || (open ? folded.length : counted.size) > 0) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
5038
5557
  className: "msg-context",
5039
- children: folded.map((b_1, i) => counted.has(b_1) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
5040
- className: "listed",
5041
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Block, { block: b_1 })
5042
- }, i) : open && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Block, { block: b_1 }, i))
5558
+ children: [
5559
+ groups.map(_temp9),
5560
+ groups.filter(_temp10).length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TotalTokens, { tokens: groups.reduce(_temp11, 0) }),
5561
+ folded.map((b_2, i) => counted.has(b_2) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
5562
+ className: "listed",
5563
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Block, { block: b_2 })
5564
+ }, i) : open && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Block, { block: b_2 }, i))
5565
+ ]
5043
5566
  }),
5044
- msgs.map(_temp8)
5567
+ msgs.filter(t9).map(_temp12)
5045
5568
  ]
5046
5569
  });
5047
5570
  $[0] = index;
@@ -5054,32 +5577,202 @@ function InputRow(t0) {
5054
5577
  } else t1 = $[6];
5055
5578
  return t1;
5056
5579
  }
5057
- function _temp8(t_2) {
5058
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TurnRow, { turn: t_2 }, t_2.uuid);
5580
+ function _temp12(t_3) {
5581
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TurnRow, { turn: t_3 }, t_3.uuid);
5582
+ }
5583
+ function _temp11(sum, g_1) {
5584
+ return sum + g_1.tokens;
5059
5585
  }
5060
- function _temp7(v) {
5586
+ function _temp10(g_2) {
5587
+ return g_2.tokens > 0;
5588
+ }
5589
+ function _temp9(g_0) {
5590
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SystemGroup, { group: g_0 }, g_0.key);
5591
+ }
5592
+ function _temp8(v) {
5061
5593
  return !v;
5062
5594
  }
5063
- function _temp6(t_1) {
5595
+ function _temp7(t_1) {
5064
5596
  return t_1.queued;
5065
5597
  }
5066
- function _temp5$1(t_0) {
5598
+ function _temp6(t_0) {
5067
5599
  return t_0.blocks;
5068
5600
  }
5069
- function _temp4$3(t) {
5601
+ function _temp5$1(t) {
5070
5602
  return !isFolded(t);
5071
5603
  }
5604
+ function _temp4$3(g) {
5605
+ return g.blocks;
5606
+ }
5607
+ function SystemGroup(t0) {
5608
+ const $ = (0, import_compiler_runtime.c)(21);
5609
+ const { group: t1 } = t0;
5610
+ const { blocks, title, tokens } = t1;
5611
+ if (blocks.length === 1) {
5612
+ const [block] = blocks;
5613
+ let t2;
5614
+ if ($[0] !== block) {
5615
+ t2 = block.type === "attachment" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
5616
+ className: "listed",
5617
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Block, { block })
5618
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Block, { block });
5619
+ $[0] = block;
5620
+ $[1] = t2;
5621
+ } else t2 = $[1];
5622
+ return t2;
5623
+ }
5624
+ if (!blocks.some(_temp13)) {
5625
+ let t2;
5626
+ if ($[2] !== blocks) {
5627
+ t2 = blocks.map(_temp14);
5628
+ $[2] = blocks;
5629
+ $[3] = t2;
5630
+ } else t2 = $[3];
5631
+ let t3;
5632
+ if ($[4] !== t2 || $[5] !== title || $[6] !== tokens) {
5633
+ t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collapsible, {
5634
+ title,
5635
+ className: "instruction-file directive system-group",
5636
+ defaultOpen: false,
5637
+ tokens,
5638
+ children: t2
5639
+ });
5640
+ $[4] = t2;
5641
+ $[5] = title;
5642
+ $[6] = tokens;
5643
+ $[7] = t3;
5644
+ } else t3 = $[7];
5645
+ return t3;
5646
+ }
5647
+ let T0;
5648
+ let t2;
5649
+ let t3;
5650
+ let t4;
5651
+ let t5;
5652
+ if ($[8] !== blocks || $[9] !== tokens) {
5653
+ const { turns, instructions, rest } = mcpGroupParts(blocks);
5654
+ T0 = McpBlock;
5655
+ t2 = turns;
5656
+ t3 = instructions;
5657
+ t4 = tokens;
5658
+ t5 = rest.map(_temp15);
5659
+ $[8] = blocks;
5660
+ $[9] = tokens;
5661
+ $[10] = T0;
5662
+ $[11] = t2;
5663
+ $[12] = t3;
5664
+ $[13] = t4;
5665
+ $[14] = t5;
5666
+ } else {
5667
+ T0 = $[10];
5668
+ t2 = $[11];
5669
+ t3 = $[12];
5670
+ t4 = $[13];
5671
+ t5 = $[14];
5672
+ }
5673
+ let t6;
5674
+ if ($[15] !== T0 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4 || $[19] !== t5) {
5675
+ t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(T0, {
5676
+ turns: t2,
5677
+ instructions: t3,
5678
+ tokens: t4,
5679
+ children: t5
5680
+ });
5681
+ $[15] = T0;
5682
+ $[16] = t2;
5683
+ $[17] = t3;
5684
+ $[18] = t4;
5685
+ $[19] = t5;
5686
+ $[20] = t6;
5687
+ } else t6 = $[20];
5688
+ return t6;
5689
+ }
5690
+ function _temp15(b_1, i_0) {
5691
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Block, { block: b_1 }, i_0);
5692
+ }
5693
+ function _temp14(b, i) {
5694
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Block, { block: b }, i);
5695
+ }
5696
+ function _temp13(b_0) {
5697
+ return b_0.type === "mcp";
5698
+ }
5699
+ function McpBlock(t0) {
5700
+ const $ = (0, import_compiler_runtime.c)(20);
5701
+ const { turns, instructions, tokens, speaker, children } = t0;
5702
+ let t1;
5703
+ if ($[0] !== turns) {
5704
+ t1 = latestServers(turns);
5705
+ $[0] = turns;
5706
+ $[1] = t1;
5707
+ } else t1 = $[1];
5708
+ const servers = t1;
5709
+ let t2;
5710
+ if ($[2] !== servers) {
5711
+ t2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(McpTitle, { servers });
5712
+ $[2] = servers;
5713
+ $[3] = t2;
5714
+ } else t2 = $[3];
5715
+ let t3;
5716
+ if ($[4] !== speaker || $[5] !== t2) {
5717
+ t3 = said(speaker, t2);
5718
+ $[4] = speaker;
5719
+ $[5] = t2;
5720
+ $[6] = t3;
5721
+ } else t3 = $[6];
5722
+ let t4;
5723
+ if ($[7] !== servers) {
5724
+ t4 = servers.some(_temp16);
5725
+ $[7] = servers;
5726
+ $[8] = t4;
5727
+ } else t4 = $[8];
5728
+ let t5;
5729
+ if ($[9] !== instructions || $[10] !== turns) {
5730
+ let t6;
5731
+ if ($[12] !== instructions) {
5732
+ t6 = (t, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(McpConnections, {
5733
+ turn: t,
5734
+ instructions
5735
+ }, i);
5736
+ $[12] = instructions;
5737
+ $[13] = t6;
5738
+ } else t6 = $[13];
5739
+ t5 = turns.map(t6);
5740
+ $[9] = instructions;
5741
+ $[10] = turns;
5742
+ $[11] = t5;
5743
+ } else t5 = $[11];
5744
+ let t6;
5745
+ if ($[14] !== children || $[15] !== t3 || $[16] !== t4 || $[17] !== t5 || $[18] !== tokens) {
5746
+ t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Collapsible, {
5747
+ title: t3,
5748
+ className: "mcp-block",
5749
+ defaultOpen: t4,
5750
+ tokens,
5751
+ children: [t5, children]
5752
+ });
5753
+ $[14] = children;
5754
+ $[15] = t3;
5755
+ $[16] = t4;
5756
+ $[17] = t5;
5757
+ $[18] = tokens;
5758
+ $[19] = t6;
5759
+ } else t6 = $[19];
5760
+ return t6;
5761
+ }
5762
+ function _temp16(s) {
5763
+ return s.status === "failed";
5764
+ }
5072
5765
  function AssistantCard(t0) {
5073
5766
  const $ = (0, import_compiler_runtime.c)(32);
5074
5767
  const { turns, point, index, duration, ctxLimit, showAuthor: t1 } = t0;
5075
5768
  const showAuthor = t1 === void 0 ? true : t1;
5076
5769
  const [open, setOpen] = useCollapsed(false);
5077
- const toolBlocks = turns.flatMap(_temp10);
5078
- const errorCount = toolBlocks.filter(_temp11).length;
5079
- const skillCount = toolBlocks.filter(_temp12).length;
5080
- const isAux = _temp14;
5770
+ const toolBlocks = turns.flatMap(_temp18);
5771
+ const errorCount = toolBlocks.filter(_temp19).length;
5772
+ const skillCount = toolBlocks.filter(_temp20).length;
5773
+ const isAux = _temp22;
5081
5774
  const foldable = toolBlocks.length > 0 && turns.some(isAux);
5082
- const end = turns.findLast(_temp15)?.ts ?? null;
5775
+ const end = turns.findLast(_temp23)?.ts ?? null;
5083
5776
  const [everOpen, setEverOpen] = (0, import_react.useState)(false);
5084
5777
  if (open && !everOpen) setEverOpen(true);
5085
5778
  const hidden = (t_2) => !open && foldable && isAux(t_2);
@@ -5115,7 +5808,7 @@ function AssistantCard(t0) {
5115
5808
  const parts = t5;
5116
5809
  let t6;
5117
5810
  if ($[8] !== parts) {
5118
- t6 = parts.map(_temp16);
5811
+ t6 = parts.map(_temp24);
5119
5812
  $[8] = parts;
5120
5813
  $[9] = t6;
5121
5814
  } else t6 = $[9];
@@ -5138,7 +5831,7 @@ function AssistantCard(t0) {
5138
5831
  } else t9 = $[13];
5139
5832
  const t10 = parts.length > 0 && (foldable ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
5140
5833
  className: "msg-summary",
5141
- onClick: () => setOpen(_temp17),
5834
+ onClick: () => setOpen(_temp25),
5142
5835
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
5143
5836
  className: "aux-chevron",
5144
5837
  children: open ? "▾" : "▸"
@@ -5224,31 +5917,31 @@ function AssistantCard(t0) {
5224
5917
  } else t17 = $[31];
5225
5918
  return t17;
5226
5919
  }
5227
- function _temp17(v) {
5920
+ function _temp25(v) {
5228
5921
  return !v;
5229
5922
  }
5230
- function _temp16(p, i) {
5923
+ function _temp24(p, i) {
5231
5924
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [i > 0 && ", ", p] }, i);
5232
5925
  }
5233
- function _temp15(t_1) {
5926
+ function _temp23(t_1) {
5234
5927
  return t_1.ts != null;
5235
5928
  }
5236
- function _temp14(t_0) {
5237
- return t_0.role === "system" ? isFolded(t_0) : !t_0.blocks.some(_temp13);
5929
+ function _temp22(t_0) {
5930
+ return t_0.role === "system" ? isFolded(t_0) : !t_0.blocks.some(_temp21);
5238
5931
  }
5239
- function _temp13(b_2) {
5932
+ function _temp21(b_2) {
5240
5933
  return b_2.type === "text";
5241
5934
  }
5242
- function _temp12(b_1) {
5935
+ function _temp20(b_1) {
5243
5936
  return b_1.name === "Skill";
5244
5937
  }
5245
- function _temp11(b_0) {
5938
+ function _temp19(b_0) {
5246
5939
  return b_0.result?.is_error;
5247
5940
  }
5248
- function _temp10(t) {
5249
- return t.blocks.filter(_temp9);
5941
+ function _temp18(t) {
5942
+ return t.blocks.filter(_temp17);
5250
5943
  }
5251
- function _temp9(b) {
5944
+ function _temp17(b) {
5252
5945
  return b.type === "tool_use";
5253
5946
  }
5254
5947
  function TurnRow(t0) {
@@ -5274,7 +5967,7 @@ function TurnRow(t0) {
5274
5967
  }
5275
5968
  let t3;
5276
5969
  if ($[4] !== turn.blocks) {
5277
- t3 = turn.blocks.some(_temp18);
5970
+ t3 = turn.blocks.some(_temp26);
5278
5971
  $[4] = turn.blocks;
5279
5972
  $[5] = t3;
5280
5973
  } else t3 = $[5];
@@ -5285,7 +5978,7 @@ function TurnRow(t0) {
5285
5978
  let t7;
5286
5979
  let t8;
5287
5980
  if ($[6] !== contextBlocks || $[7] !== hasError || $[8] !== hidden || $[9] !== otherBlocks || $[10] !== speaker || $[11] !== turn.blocks || $[12] !== turn.role || $[13] !== turn.ts) {
5288
- const instructions = turn.blocks.filter(_temp19);
5981
+ const instructions = turn.blocks.filter(_temp27);
5289
5982
  t8 = `turn turn-${turn.role} ${hasError ? "turn-error" : ""} ${hidden ? "turn-hidden" : ""}`;
5290
5983
  t4 = "turn-blocks";
5291
5984
  if ($[19] !== contextBlocks) {
@@ -5293,7 +5986,7 @@ function TurnRow(t0) {
5293
5986
  className: "attachment",
5294
5987
  defaultOpen: false,
5295
5988
  title: plural(contextBlocks.length, "attachment"),
5296
- children: contextBlocks.map(_temp20)
5989
+ children: contextBlocks.map(_temp28)
5297
5990
  });
5298
5991
  $[19] = contextBlocks;
5299
5992
  $[20] = t5;
@@ -5309,13 +6002,7 @@ function TurnRow(t0) {
5309
6002
  $[23] = turn.ts;
5310
6003
  $[24] = t6;
5311
6004
  } else t6 = $[24];
5312
- t7 = instructions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
5313
- className: "aux instruction-total",
5314
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ApproxTokens, {
5315
- tokens: instructions.reduce(_temp21, 0),
5316
- tip: "Approx. total tokens"
5317
- })
5318
- });
6005
+ t7 = instructions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TotalTokens, { tokens: instructions.reduce(_temp29, 0) });
5319
6006
  $[6] = contextBlocks;
5320
6007
  $[7] = hasError;
5321
6008
  $[8] = hidden;
@@ -5364,10 +6051,10 @@ function TurnRow(t0) {
5364
6051
  } else t10 = $[32];
5365
6052
  return t10;
5366
6053
  }
5367
- function _temp21(a, b_4) {
5368
- return a + countTokens(b_4.it.content, b_4.it.model);
6054
+ function _temp29(sum, b_4) {
6055
+ return sum + blockTokens(b_4);
5369
6056
  }
5370
- function _temp20(b_2, i) {
6057
+ function _temp28(b_2, i) {
5371
6058
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Attachment, {
5372
6059
  att: b_2.attachment,
5373
6060
  rendered: b_2.rendered,
@@ -5375,14 +6062,14 @@ function _temp20(b_2, i) {
5375
6062
  unsent: b_2.unsent
5376
6063
  }, i);
5377
6064
  }
5378
- function _temp19(b_1) {
6065
+ function _temp27(b_1) {
5379
6066
  return b_1.type === "instruction";
5380
6067
  }
5381
- function _temp18(b_0) {
6068
+ function _temp26(b_0) {
5382
6069
  return b_0.type === "tool_use" && b_0.result?.is_error;
5383
6070
  }
5384
6071
  function Block(t0) {
5385
- const $ = (0, import_compiler_runtime.c)(98);
6072
+ const $ = (0, import_compiler_runtime.c)(102);
5386
6073
  const { block, speaker: t1, ts: t2 } = t0;
5387
6074
  const speaker = t1 === void 0 ? null : t1;
5388
6075
  const ts = t2 === void 0 ? null : t2;
@@ -5616,7 +6303,7 @@ function Block(t0) {
5616
6303
  } else t6 = $[49];
5617
6304
  let t7;
5618
6305
  if ($[50] !== parts) {
5619
- t7 = parts.map(_temp22);
6306
+ t7 = parts.map(_temp30);
5620
6307
  $[50] = parts;
5621
6308
  $[51] = t7;
5622
6309
  } else t7 = $[51];
@@ -5656,14 +6343,13 @@ function Block(t0) {
5656
6343
  const t3 = block.it;
5657
6344
  const t4 = block.it.model;
5658
6345
  let t5;
5659
- if ($[62] !== block.it.content || $[63] !== block.it.model) {
5660
- t5 = countTokens(block.it.content, block.it.model);
5661
- $[62] = block.it.content;
5662
- $[63] = block.it.model;
5663
- $[64] = t5;
5664
- } else t5 = $[64];
6346
+ if ($[62] !== block) {
6347
+ t5 = blockTokens(block);
6348
+ $[62] = block;
6349
+ $[63] = t5;
6350
+ } else t5 = $[63];
5665
6351
  let t6;
5666
- if ($[65] !== block.it || $[66] !== speaker || $[67] !== t5) {
6352
+ if ($[64] !== block.it || $[65] !== speaker || $[66] !== t5) {
5667
6353
  t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InstructionFile, {
5668
6354
  it: t3,
5669
6355
  model: t4,
@@ -5671,73 +6357,92 @@ function Block(t0) {
5671
6357
  speaker,
5672
6358
  className: "directive"
5673
6359
  });
5674
- $[65] = block.it;
5675
- $[66] = speaker;
5676
- $[67] = t5;
5677
- $[68] = t6;
5678
- } else t6 = $[68];
6360
+ $[64] = block.it;
6361
+ $[65] = speaker;
6362
+ $[66] = t5;
6363
+ $[67] = t6;
6364
+ } else t6 = $[67];
5679
6365
  return t6;
5680
6366
  }
6367
+ if (block.type === "mcp") {
6368
+ let t3;
6369
+ if ($[68] !== block.turn) {
6370
+ t3 = [block.turn];
6371
+ $[68] = block.turn;
6372
+ $[69] = t3;
6373
+ } else t3 = $[69];
6374
+ let t4;
6375
+ if ($[70] !== speaker || $[71] !== t3) {
6376
+ t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(McpBlock, {
6377
+ turns: t3,
6378
+ speaker
6379
+ });
6380
+ $[70] = speaker;
6381
+ $[71] = t3;
6382
+ $[72] = t4;
6383
+ } else t4 = $[72];
6384
+ return t4;
6385
+ }
5681
6386
  if (block.type === "system") {
5682
6387
  const className = `system-note ${block.level ?? ""} ${block.kind ?? ""}`;
5683
6388
  if (!block.body) {
5684
6389
  let t3;
5685
- if ($[69] !== block.title || $[70] !== block.url) {
6390
+ if ($[73] !== block.title || $[74] !== block.url) {
5686
6391
  t3 = block.url ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(OpenLink, {
5687
6392
  href: block.url,
5688
6393
  children: block.title
5689
6394
  }) : block.title;
5690
- $[69] = block.title;
5691
- $[70] = block.url;
5692
- $[71] = t3;
5693
- } else t3 = $[71];
6395
+ $[73] = block.title;
6396
+ $[74] = block.url;
6397
+ $[75] = t3;
6398
+ } else t3 = $[75];
5694
6399
  let t4;
5695
- if ($[72] !== speaker || $[73] !== t3) {
6400
+ if ($[76] !== speaker || $[77] !== t3) {
5696
6401
  t4 = said(speaker, t3);
5697
- $[72] = speaker;
5698
- $[73] = t3;
5699
- $[74] = t4;
5700
- } else t4 = $[74];
6402
+ $[76] = speaker;
6403
+ $[77] = t3;
6404
+ $[78] = t4;
6405
+ } else t4 = $[78];
5701
6406
  let t5;
5702
- if ($[75] !== className || $[76] !== t4) {
6407
+ if ($[79] !== className || $[80] !== t4) {
5703
6408
  t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, {
5704
6409
  title: t4,
5705
6410
  className
5706
6411
  });
5707
- $[75] = className;
5708
- $[76] = t4;
5709
- $[77] = t5;
5710
- } else t5 = $[77];
6412
+ $[79] = className;
6413
+ $[80] = t4;
6414
+ $[81] = t5;
6415
+ } else t5 = $[81];
5711
6416
  return t5;
5712
6417
  }
5713
6418
  let t3;
5714
- if ($[78] !== block.title || $[79] !== speaker) {
6419
+ if ($[82] !== block.title || $[83] !== speaker) {
5715
6420
  t3 = said(speaker, block.title);
5716
- $[78] = block.title;
5717
- $[79] = speaker;
5718
- $[80] = t3;
5719
- } else t3 = $[80];
6421
+ $[82] = block.title;
6422
+ $[83] = speaker;
6423
+ $[84] = t3;
6424
+ } else t3 = $[84];
5720
6425
  const t4 = !block.folded;
5721
6426
  let t5;
5722
- if ($[81] !== block.body) {
6427
+ if ($[85] !== block.body) {
5723
6428
  t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: block.body });
5724
- $[81] = block.body;
5725
- $[82] = t5;
5726
- } else t5 = $[82];
6429
+ $[85] = block.body;
6430
+ $[86] = t5;
6431
+ } else t5 = $[86];
5727
6432
  let t6;
5728
- if ($[83] !== className || $[84] !== t3 || $[85] !== t4 || $[86] !== t5) {
6433
+ if ($[87] !== className || $[88] !== t3 || $[89] !== t4 || $[90] !== t5) {
5729
6434
  t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collapsible, {
5730
6435
  title: t3,
5731
6436
  className,
5732
6437
  defaultOpen: t4,
5733
6438
  children: t5
5734
6439
  });
5735
- $[83] = className;
5736
- $[84] = t3;
5737
- $[85] = t4;
5738
- $[86] = t5;
5739
- $[87] = t6;
5740
- } else t6 = $[87];
6440
+ $[87] = className;
6441
+ $[88] = t3;
6442
+ $[89] = t4;
6443
+ $[90] = t5;
6444
+ $[91] = t6;
6445
+ } else t6 = $[91];
5741
6446
  return t6;
5742
6447
  }
5743
6448
  if (block.type === "image") {
@@ -5745,53 +6450,53 @@ function Block(t0) {
5745
6450
  if (src && src.type === "base64") {
5746
6451
  const t3 = `data:${src.media_type};base64,${src.data}`;
5747
6452
  let t4;
5748
- if ($[88] !== t3) {
6453
+ if ($[92] !== t3) {
5749
6454
  t4 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", {
5750
6455
  className: "block-image",
5751
6456
  src: t3,
5752
6457
  alt: ""
5753
6458
  });
5754
- $[88] = t3;
5755
- $[89] = t4;
5756
- } else t4 = $[89];
6459
+ $[92] = t3;
6460
+ $[93] = t4;
6461
+ } else t4 = $[93];
5757
6462
  return t4;
5758
6463
  }
5759
6464
  let t3;
5760
- if ($[90] === Symbol.for("react.memo_cache_sentinel")) {
6465
+ if ($[94] === Symbol.for("react.memo_cache_sentinel")) {
5761
6466
  t3 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
5762
6467
  className: "block-aux",
5763
6468
  children: "[image]"
5764
6469
  });
5765
- $[90] = t3;
5766
- } else t3 = $[90];
6470
+ $[94] = t3;
6471
+ } else t3 = $[94];
5767
6472
  return t3;
5768
6473
  }
5769
6474
  const t3 = block.type || "block";
5770
6475
  let t4;
5771
- if ($[91] !== block) {
6476
+ if ($[95] !== block) {
5772
6477
  t4 = safeJson(block);
5773
- $[91] = block;
5774
- $[92] = t4;
5775
- } else t4 = $[92];
6478
+ $[95] = block;
6479
+ $[96] = t4;
6480
+ } else t4 = $[96];
5776
6481
  let t5;
5777
- if ($[93] !== t4) {
6482
+ if ($[97] !== t4) {
5778
6483
  t5 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: t4 });
5779
- $[93] = t4;
5780
- $[94] = t5;
5781
- } else t5 = $[94];
6484
+ $[97] = t4;
6485
+ $[98] = t5;
6486
+ } else t5 = $[98];
5782
6487
  let t6;
5783
- if ($[95] !== t3 || $[96] !== t5) {
6488
+ if ($[99] !== t3 || $[100] !== t5) {
5784
6489
  t6 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collapsible, {
5785
6490
  title: t3,
5786
6491
  children: t5
5787
6492
  });
5788
- $[95] = t3;
5789
- $[96] = t5;
5790
- $[97] = t6;
5791
- } else t6 = $[97];
6493
+ $[99] = t3;
6494
+ $[100] = t5;
6495
+ $[101] = t6;
6496
+ } else t6 = $[101];
5792
6497
  return t6;
5793
6498
  }
5794
- function _temp22(p, i) {
6499
+ function _temp30(p, i) {
5795
6500
  return p.type === "text" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SavedOutputLink, { text: p.text }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: p.text })] }, i) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Block, { block: p }, i);
5796
6501
  }
5797
6502
  function SavedOutputLink(t0) {
@@ -5953,7 +6658,7 @@ function Collapsible(t0) {
5953
6658
  const t3 = `aux ${className || ""}`;
5954
6659
  let t4;
5955
6660
  if ($[0] !== setOpen) {
5956
- t4 = () => setOpen(_temp23);
6661
+ t4 = () => setOpen(_temp31);
5957
6662
  $[0] = setOpen;
5958
6663
  $[1] = t4;
5959
6664
  } else t4 = $[1];
@@ -6032,26 +6737,26 @@ function Collapsible(t0) {
6032
6737
  } else t12 = $[23];
6033
6738
  return t12;
6034
6739
  }
6035
- function _temp23(v) {
6740
+ function _temp31(v) {
6036
6741
  return !v;
6037
6742
  }
6038
6743
  var fmtElapsed = (ms) => ms < 1e3 ? "<1s" : fmtDuration(ms);
6039
- var ApproxTokens = (t0) => {
6040
- const $ = (0, import_compiler_runtime.c)(3);
6041
- const { tokens, tip: t1 } = t0;
6042
- const tip = t1 === void 0 ? "Approx. tokens" : t1;
6043
- let t2;
6044
- if ($[0] !== tip || $[1] !== tokens) {
6045
- t2 = tokens > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
6046
- className: "instruction-tokens",
6047
- "data-tooltip-content": tip,
6048
- children: ["~ ", fmtCompact(tokens)]
6744
+ var TotalTokens = (t0) => {
6745
+ const $ = (0, import_compiler_runtime.c)(2);
6746
+ const { tokens } = t0;
6747
+ let t1;
6748
+ if ($[0] !== tokens) {
6749
+ t1 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
6750
+ className: "aux instruction-total",
6751
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ApproxTokens, {
6752
+ tokens,
6753
+ tip: "Approx. total tokens"
6754
+ })
6049
6755
  });
6050
- $[0] = tip;
6051
- $[1] = tokens;
6052
- $[2] = t2;
6053
- } else t2 = $[2];
6054
- return t2;
6756
+ $[0] = tokens;
6757
+ $[1] = t1;
6758
+ } else t1 = $[1];
6759
+ return t1;
6055
6760
  };
6056
6761
  function JsonBlock(t0) {
6057
6762
  const $ = (0, import_compiler_runtime.c)(2);
@@ -6073,7 +6778,7 @@ function InstructionRun(t0) {
6073
6778
  const { turns, model } = t0;
6074
6779
  let t1;
6075
6780
  if ($[0] !== model || $[1] !== turns) {
6076
- const strips = turns.flatMap(_temp24).map(_temp25);
6781
+ const strips = turns.flatMap(_temp32).map(_temp33);
6077
6782
  let t2;
6078
6783
  let t3;
6079
6784
  let t4;
@@ -6133,11 +6838,11 @@ function InstructionRun(t0) {
6133
6838
  } else t1 = $[2];
6134
6839
  return t1;
6135
6840
  }
6136
- function _temp25(t0) {
6841
+ function _temp33(t0) {
6137
6842
  const { it } = t0;
6138
6843
  return it;
6139
6844
  }
6140
- function _temp24(t) {
6845
+ function _temp32(t) {
6141
6846
  return t.blocks;
6142
6847
  }
6143
6848
  function InstructionFile(t0) {
@@ -6159,7 +6864,7 @@ function InstructionFile(t0) {
6159
6864
  t10 = `aux instruction-file ${className}`;
6160
6865
  t7 = "aux-toggle";
6161
6866
  if ($[14] !== setOpen) {
6162
- t8 = () => setOpen(_temp26);
6867
+ t8 = () => setOpen(_temp34);
6163
6868
  $[14] = setOpen;
6164
6869
  $[15] = t8;
6165
6870
  } else t8 = $[15];
@@ -6272,7 +6977,7 @@ function InstructionFile(t0) {
6272
6977
  } else t15 = $[38];
6273
6978
  return t15;
6274
6979
  }
6275
- function _temp26(v) {
6980
+ function _temp34(v) {
6276
6981
  return !v;
6277
6982
  }
6278
6983
  function ItemFolds(t0) {
@@ -7434,8 +8139,8 @@ function AgentOutput(t0) {
7434
8139
  }
7435
8140
  // src/renderer/sessions/SessionSummary.jsx
7436
8141
  function SessionSummary(t0) {
7437
- const $ = (0, import_compiler_runtime.c)(236);
7438
- const { meta, items, instructions, requestLog, agent, granularity: t1 } = t0;
8142
+ const $ = (0, import_compiler_runtime.c)(239);
8143
+ const { meta, items, instructions, requestLog, debugLog, agent, granularity: t1 } = t0;
7439
8144
  const timeFormat = (t1 === void 0 ? "day" : t1) === "day" ? "pp" : "MMM d, pp";
7440
8145
  const t = meta.tokens;
7441
8146
  const totalTokens = meta.totalTokens;
@@ -8245,8 +8950,20 @@ function SessionSummary(t0) {
8245
8950
  $[207] = t61;
8246
8951
  } else t61 = $[207];
8247
8952
  let t62;
8248
- if ($[208] !== t43 || $[209] !== t44 || $[210] !== t45 || $[211] !== t46 || $[212] !== t47 || $[213] !== t48 || $[214] !== t50 || $[215] !== t52 || $[216] !== t53 || $[217] !== t55 || $[218] !== t57 || $[219] !== t58 || $[220] !== t59 || $[221] !== t60 || $[222] !== t61) {
8249
- t62 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Section, {
8953
+ if ($[208] !== debugLog) {
8954
+ t62 = debugLog && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, {
8955
+ label: "Debug log",
8956
+ value: debugLog,
8957
+ mono: true,
8958
+ full: true,
8959
+ autoselect: true
8960
+ });
8961
+ $[208] = debugLog;
8962
+ $[209] = t62;
8963
+ } else t62 = $[209];
8964
+ let t63;
8965
+ if ($[210] !== t43 || $[211] !== t44 || $[212] !== t45 || $[213] !== t46 || $[214] !== t47 || $[215] !== t48 || $[216] !== t50 || $[217] !== t52 || $[218] !== t53 || $[219] !== t55 || $[220] !== t57 || $[221] !== t58 || $[222] !== t59 || $[223] !== t60 || $[224] !== t61 || $[225] !== t62) {
8966
+ t63 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Section, {
8250
8967
  title: "Identity",
8251
8968
  children: [
8252
8969
  t43,
@@ -8264,29 +8981,31 @@ function SessionSummary(t0) {
8264
8981
  t58,
8265
8982
  t59,
8266
8983
  t60,
8267
- t61
8984
+ t61,
8985
+ t62
8268
8986
  ]
8269
8987
  });
8270
- $[208] = t43;
8271
- $[209] = t44;
8272
- $[210] = t45;
8273
- $[211] = t46;
8274
- $[212] = t47;
8275
- $[213] = t48;
8276
- $[214] = t50;
8277
- $[215] = t52;
8278
- $[216] = t53;
8279
- $[217] = t55;
8280
- $[218] = t57;
8281
- $[219] = t58;
8282
- $[220] = t59;
8283
- $[221] = t60;
8284
- $[222] = t61;
8285
- $[223] = t62;
8286
- } else t62 = $[223];
8287
- let t63;
8288
- if ($[224] !== t26 || $[225] !== t3 || $[226] !== t4 || $[227] !== t42 || $[228] !== t5 || $[229] !== t6 || $[230] !== t62) {
8289
- t63 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
8988
+ $[210] = t43;
8989
+ $[211] = t44;
8990
+ $[212] = t45;
8991
+ $[213] = t46;
8992
+ $[214] = t47;
8993
+ $[215] = t48;
8994
+ $[216] = t50;
8995
+ $[217] = t52;
8996
+ $[218] = t53;
8997
+ $[219] = t55;
8998
+ $[220] = t57;
8999
+ $[221] = t58;
9000
+ $[222] = t59;
9001
+ $[223] = t60;
9002
+ $[224] = t61;
9003
+ $[225] = t62;
9004
+ $[226] = t63;
9005
+ } else t63 = $[226];
9006
+ let t64;
9007
+ if ($[227] !== t26 || $[228] !== t3 || $[229] !== t4 || $[230] !== t42 || $[231] !== t5 || $[232] !== t6 || $[233] !== t63) {
9008
+ t64 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
8290
9009
  className: t3,
8291
9010
  children: [
8292
9011
  t4,
@@ -8294,30 +9013,30 @@ function SessionSummary(t0) {
8294
9013
  t6,
8295
9014
  t26,
8296
9015
  t42,
8297
- t62
9016
+ t63
8298
9017
  ]
8299
9018
  });
8300
- $[224] = t26;
8301
- $[225] = t3;
8302
- $[226] = t4;
8303
- $[227] = t42;
8304
- $[228] = t5;
8305
- $[229] = t6;
8306
- $[230] = t62;
8307
- $[231] = t63;
8308
- } else t63 = $[231];
8309
- let t64;
8310
- if ($[232] !== t63 || $[233] !== t7 || $[234] !== t8) {
8311
- t64 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
9019
+ $[227] = t26;
9020
+ $[228] = t3;
9021
+ $[229] = t4;
9022
+ $[230] = t42;
9023
+ $[231] = t5;
9024
+ $[232] = t6;
9025
+ $[233] = t63;
9026
+ $[234] = t64;
9027
+ } else t64 = $[234];
9028
+ let t65;
9029
+ if ($[235] !== t64 || $[236] !== t7 || $[237] !== t8) {
9030
+ t65 = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
8312
9031
  className: t7,
8313
- children: [t8, t63]
9032
+ children: [t8, t64]
8314
9033
  });
8315
- $[232] = t63;
8316
- $[233] = t7;
8317
- $[234] = t8;
8318
9034
  $[235] = t64;
8319
- } else t64 = $[235];
8320
- return t64;
9035
+ $[236] = t7;
9036
+ $[237] = t8;
9037
+ $[238] = t65;
9038
+ } else t65 = $[238];
9039
+ return t65;
8321
9040
  }
8322
9041
  function _temp3$1(e_0) {
8323
9042
  if (e_0.key === "Enter" && !e_0.shiftKey) {
@@ -8551,6 +9270,7 @@ function renderBlock(b, model) {
8551
9270
  const body = it.error ? fence(`error: ${it.error}`) : it.items?.length ? renderItems(it, own) : fence(it.content || "");
8552
9271
  return `_${instructionTitle(it, model)}_${size(it.content, own)}${path}\n${body}`;
8553
9272
  }
9273
+ if (b.type === "mcp") return renderMcp(b.turn);
8554
9274
  return fence(safeJson(b), "json");
8555
9275
  }
8556
9276
  function renderTurn(t, seen, model) {
@@ -8586,7 +9306,19 @@ function renderTranscript(turns, { forkedFrom, forkedAt, continuesFrom }) {
8586
9306
  }
8587
9307
  return rows.filter(Boolean).join("\n\n---\n\n");
8588
9308
  }
8589
- function markdownSession(meta, items, instructions = {}, requestLog = null) {
9309
+ function renderMcp(turn) {
9310
+ const title = turn.change ? "MCP servers changed" : turn.debug ? "MCP servers connected (debug log)" : "MCP servers";
9311
+ const status = (s) => `${s.status}${s.ms === null ? "" : ` in ${s.ms}ms`}${s.readyWithin != null ? ` within ${s.readyWithin}ms of the request that found it connecting` : ""}`;
9312
+ const server = (s) => `- ${s.name}: ${[
9313
+ s.version && `version ${s.version}`,
9314
+ s.cached && "cached",
9315
+ s.transport,
9316
+ status(s),
9317
+ s.toolCount != null && plural(s.toolCount, "tool")
9318
+ ].filter(Boolean).join(", ")}${s.error ? ` (${s.error})` : ""}` + s.groups.map((g) => `\n - mounted ${g.name}: ${plural(g.toolCount, "tool")}`).join("") + s.stderr.map((line) => `\n - stderr: ${line}`).join("") + s.tools.map((t) => `\n - tool ${t.name}${t.ms === null ? "" : `: ${t.ms}ms`}${t.error ? ` (failed: ${t.error})` : ""}`).join("");
9319
+ return `_${title}_\n${turn.servers.map(server).join("\n")}`;
9320
+ }
9321
+ function markdownSession(meta, items, instructions = {}, requestLog = null, debugLog = null) {
8590
9322
  const t = meta.tokens;
8591
9323
  const stu = meta.serverToolUse;
8592
9324
  const wallDuration = meta.lastActivityAt - meta.startedAt;
@@ -8648,6 +9380,7 @@ ${meta.tag ? `- Tag: ${meta.tag}
8648
9380
  - Project: ${meta.project || "—"}
8649
9381
  ${meta.subdir ? `- Subfolder: ${meta.subdir}\n` : ""}${meta.worktreePath ? `- Worktree: ${meta.worktreePath}\n` : ""}- Log file: ${meta.filePath}
8650
9382
  ${requestLog ? `- Proxy log: ${requestLog}
9383
+ ` : ""}${debugLog ? `- Debug log: ${debugLog}
8651
9384
  ` : ""}`)}
8652
9385
  </summary>
8653
9386
 
@@ -8680,8 +9413,8 @@ var EMPTY = {
8680
9413
  error: ""
8681
9414
  };
8682
9415
  function useAgent(key, meta, t0) {
8683
- const $ = (0, import_compiler_runtime.c)(21);
8684
- const { items, instructions, requestLog } = t0;
9416
+ const $ = (0, import_compiler_runtime.c)(22);
9417
+ const { items, instructions, requestLog, debugLog } = t0;
8685
9418
  let t1;
8686
9419
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
8687
9420
  t1 = {};
@@ -8719,12 +9452,12 @@ function useAgent(key, meta, t0) {
8719
9452
  }
8720
9453
  (0, import_react.useEffect)(t3, t4);
8721
9454
  let t5;
8722
- if ($[4] !== instructions || $[5] !== items || $[6] !== key || $[7] !== meta || $[8] !== requestLog) {
9455
+ if ($[4] !== debugLog || $[5] !== instructions || $[6] !== items || $[7] !== key || $[8] !== meta || $[9] !== requestLog) {
8723
9456
  t5 = async (prompt, tag) => {
8724
9457
  patch(key, _temp$3);
8725
9458
  let error = "";
8726
9459
  try {
8727
- const { body } = markdownSession(meta, items, instructions, requestLog);
9460
+ const { body } = markdownSession(meta, items, instructions, requestLog, debugLog);
8728
9461
  const { code } = await window.api.runAgentPrompt({
8729
9462
  id: key,
8730
9463
  prompt: `${prompt}\n\n---\n${body}`,
@@ -8741,50 +9474,51 @@ function useAgent(key, meta, t0) {
8741
9474
  error
8742
9475
  }));
8743
9476
  };
8744
- $[4] = instructions;
8745
- $[5] = items;
8746
- $[6] = key;
8747
- $[7] = meta;
8748
- $[8] = requestLog;
8749
- $[9] = t5;
8750
- } else t5 = $[9];
9477
+ $[4] = debugLog;
9478
+ $[5] = instructions;
9479
+ $[6] = items;
9480
+ $[7] = key;
9481
+ $[8] = meta;
9482
+ $[9] = requestLog;
9483
+ $[10] = t5;
9484
+ } else t5 = $[10];
8751
9485
  const run = t5;
8752
9486
  let t6;
8753
- if ($[10] !== run) {
9487
+ if ($[11] !== run) {
8754
9488
  t6 = () => run(analyzePrompt, "claude-discover:analyze");
8755
- $[10] = run;
8756
- $[11] = t6;
8757
- } else t6 = $[11];
9489
+ $[11] = run;
9490
+ $[12] = t6;
9491
+ } else t6 = $[12];
8758
9492
  const analyze = t6;
8759
9493
  let t7;
8760
- if ($[12] !== run) {
9494
+ if ($[13] !== run) {
8761
9495
  t7 = () => run(diagnosePrompt, "claude-discover:diagnose");
8762
- $[12] = run;
8763
- $[13] = t7;
8764
- } else t7 = $[13];
9496
+ $[13] = run;
9497
+ $[14] = t7;
9498
+ } else t7 = $[14];
8765
9499
  const diagnose = t7;
8766
9500
  let t8;
8767
- if ($[14] !== run) {
9501
+ if ($[15] !== run) {
8768
9502
  t8 = (question) => run(askPrompt(question), "claude-discover:ask");
8769
- $[14] = run;
8770
- $[15] = t8;
8771
- } else t8 = $[15];
9503
+ $[15] = run;
9504
+ $[16] = t8;
9505
+ } else t8 = $[16];
8772
9506
  const ask = t8;
8773
9507
  const t9 = results[key] ?? EMPTY;
8774
9508
  let t10;
8775
- if ($[16] !== analyze || $[17] !== ask || $[18] !== diagnose || $[19] !== t9) {
9509
+ if ($[17] !== analyze || $[18] !== ask || $[19] !== diagnose || $[20] !== t9) {
8776
9510
  t10 = {
8777
9511
  ...t9,
8778
9512
  analyze,
8779
9513
  diagnose,
8780
9514
  ask
8781
9515
  };
8782
- $[16] = analyze;
8783
- $[17] = ask;
8784
- $[18] = diagnose;
8785
- $[19] = t9;
8786
- $[20] = t10;
8787
- } else t10 = $[20];
9516
+ $[17] = analyze;
9517
+ $[18] = ask;
9518
+ $[19] = diagnose;
9519
+ $[20] = t9;
9520
+ $[21] = t10;
9521
+ } else t10 = $[21];
8788
9522
  return t10;
8789
9523
  }
8790
9524
  function _temp$3() {
@@ -8797,7 +9531,8 @@ function _temp$3() {
8797
9531
  var NOT_READ = {
8798
9532
  items: null,
8799
9533
  instructions: {},
8800
- requestLog: null
9534
+ requestLog: null,
9535
+ debugLog: null
8801
9536
  };
8802
9537
  var TABS = [
8803
9538
  {
@@ -8814,7 +9549,7 @@ var TABS = [
8814
9549
  }
8815
9550
  ];
8816
9551
  function Session(t0) {
8817
- const $ = (0, import_compiler_runtime.c)(60);
9552
+ const $ = (0, import_compiler_runtime.c)(61);
8818
9553
  const { meta, missing, date, granularity: t1, onShowPeriodOf } = t0;
8819
9554
  const granularity = t1 === void 0 ? "day" : t1;
8820
9555
  const [read, setRead] = (0, import_react.useState)(NOT_READ);
@@ -8830,7 +9565,7 @@ function Session(t0) {
8830
9565
  const filePath = meta?.filePath;
8831
9566
  const fileSize = meta?.fileSize;
8832
9567
  const desktop = meta?.entrypoint === "claude-desktop";
8833
- const { items, instructions, requestLog } = read;
9568
+ const { items, instructions, requestLog, debugLog } = read;
8834
9569
  const viewKey = `${filePath}|${date}|${granularity}`;
8835
9570
  const agent = useAgent(viewKey, meta, read);
8836
9571
  const [readKey, setReadKey] = (0, import_react.useState)(viewKey);
@@ -9038,26 +9773,28 @@ function Session(t0) {
9038
9773
  $[48] = t16;
9039
9774
  } else t16 = $[48];
9040
9775
  let t17;
9041
- if ($[49] !== agent || $[50] !== granularity || $[51] !== instructions || $[52] !== items || $[53] !== meta || $[54] !== requestLog || $[55] !== viewKey) {
9776
+ if ($[49] !== agent || $[50] !== debugLog || $[51] !== granularity || $[52] !== instructions || $[53] !== items || $[54] !== meta || $[55] !== requestLog || $[56] !== viewKey) {
9042
9777
  t17 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SessionSummary, {
9043
9778
  meta,
9044
9779
  items,
9045
9780
  instructions,
9046
9781
  requestLog,
9782
+ debugLog,
9047
9783
  agent,
9048
9784
  granularity
9049
9785
  }, viewKey);
9050
9786
  $[49] = agent;
9051
- $[50] = granularity;
9052
- $[51] = instructions;
9053
- $[52] = items;
9054
- $[53] = meta;
9055
- $[54] = requestLog;
9056
- $[55] = viewKey;
9057
- $[56] = t17;
9058
- } else t17 = $[56];
9787
+ $[50] = debugLog;
9788
+ $[51] = granularity;
9789
+ $[52] = instructions;
9790
+ $[53] = items;
9791
+ $[54] = meta;
9792
+ $[55] = requestLog;
9793
+ $[56] = viewKey;
9794
+ $[57] = t17;
9795
+ } else t17 = $[57];
9059
9796
  let t18;
9060
- if ($[57] !== t16 || $[58] !== t17) {
9797
+ if ($[58] !== t16 || $[59] !== t17) {
9061
9798
  t18 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
9062
9799
  className: "session-view",
9063
9800
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
@@ -9074,10 +9811,10 @@ function Session(t0) {
9074
9811
  })
9075
9812
  })
9076
9813
  });
9077
- $[57] = t16;
9078
- $[58] = t17;
9079
- $[59] = t18;
9080
- } else t18 = $[59];
9814
+ $[58] = t16;
9815
+ $[59] = t17;
9816
+ $[60] = t18;
9817
+ } else t18 = $[60];
9081
9818
  return t18;
9082
9819
  }
9083
9820
  // src/renderer/ui/StatusSwitch.jsx