agenttop 0.9.4 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -19,18 +19,18 @@ import {
19
19
  setNickname,
20
20
  startMcpServer,
21
21
  unarchiveSession
22
- } from "./chunk-3LEBAMTZ.js";
22
+ } from "./chunk-24HX2MSZ.js";
23
23
 
24
24
  // src/index.tsx
25
25
  import { readFileSync as readFileSync3 } from "fs";
26
26
  import { join as join5, dirname as dirname4 } from "path";
27
27
  import { fileURLToPath as fileURLToPath3 } from "url";
28
- import React16 from "react";
28
+ import React17 from "react";
29
29
  import { render } from "ink";
30
30
 
31
31
  // src/ui/App.tsx
32
- import { useState as useState15, useEffect as useEffect9, useCallback as useCallback6 } from "react";
33
- import { Box as Box15, Text as Text14, useApp, useStdout as useStdout3 } from "ink";
32
+ import { useState as useState16, useEffect as useEffect9, useCallback as useCallback6 } from "react";
33
+ import { Box as Box16, Text as Text15, useApp, useStdout as useStdout3 } from "ink";
34
34
 
35
35
  // src/config/themes.ts
36
36
  var COLOR_KEYS = [
@@ -694,7 +694,19 @@ var summarizeInput = (call) => {
694
694
  }
695
695
  };
696
696
  var ActivityFeed = React3.memo(
697
- ({ events, sessionSlug, sessionId, isActive, focused, height, scrollOffset, filter, merged, mergedSessions }) => {
697
+ ({
698
+ events,
699
+ sessionSlug,
700
+ sessionId,
701
+ isActive,
702
+ focused,
703
+ height,
704
+ scrollOffset,
705
+ filter,
706
+ merged,
707
+ mergedSessions,
708
+ selectedEventIndex
709
+ }) => {
698
710
  const viewportRows = height - 2;
699
711
  const totalEvents = events.length;
700
712
  const start = Math.max(0, totalEvents - viewportRows - scrollOffset);
@@ -709,6 +721,7 @@ var ActivityFeed = React3.memo(
709
721
  slugColorMap.set(s.sessionId, TAG_COLORS[i % TAG_COLORS.length]);
710
722
  });
711
723
  }
724
+ const hasSelection = focused && selectedEventIndex !== void 0;
712
725
  return /* @__PURE__ */ jsxs3(
713
726
  Box3,
714
727
  {
@@ -732,30 +745,34 @@ var ActivityFeed = React3.memo(
732
745
  "]"
733
746
  ] })
734
747
  ] }),
735
- focused && canScroll && !isAtBottom && /* @__PURE__ */ jsxs3(Text3, { color: colors.muted, children: [
736
- "[",
737
- totalEvents - end + viewportRows,
738
- "/",
739
- totalEvents,
740
- "]"
748
+ /* @__PURE__ */ jsxs3(Box3, { children: [
749
+ hasSelection && /* @__PURE__ */ jsx3(Text3, { color: colors.muted, children: "enter:detail " }),
750
+ focused && canScroll && !isAtBottom && /* @__PURE__ */ jsxs3(Text3, { color: colors.muted, children: [
751
+ "[",
752
+ totalEvents - end + viewportRows,
753
+ "/",
754
+ totalEvents,
755
+ "]"
756
+ ] })
741
757
  ] })
742
758
  ] }),
743
759
  visible.length === 0 && /* @__PURE__ */ jsx3(Box3, { paddingX: 1, paddingY: 1, children: /* @__PURE__ */ jsx3(Text3, { color: colors.muted, italic: true, children: sessionSlug || merged ? "Waiting for activity..." : "Select a session" }) }),
744
760
  visible.map((event, i) => {
745
- const tag = merged ? event.slug.slice(0, 4) : null;
746
- const tagColor = merged ? slugColorMap.get(event.sessionId) || colors.muted : void 0;
761
+ const call = event.call;
762
+ const globalIndex = start + i;
763
+ const isSelected = hasSelection && globalIndex === selectedEventIndex;
764
+ const tag = merged ? call.slug.slice(0, 4) : null;
765
+ const tagColor = merged ? slugColorMap.get(call.sessionId) || colors.muted : void 0;
747
766
  return /* @__PURE__ */ jsxs3(Box3, { paddingX: 1, children: [
748
767
  tag && /* @__PURE__ */ jsx3(Text3, { color: tagColor, children: tag.padEnd(5) }),
749
- /* @__PURE__ */ jsxs3(Text3, { color: colors.muted, children: [
750
- formatTime(event.timestamp),
751
- " "
752
- ] }),
753
- /* @__PURE__ */ jsx3(Text3, { color: getToolColor(event.toolName), bold: true, children: event.toolName.padEnd(8) }),
754
- /* @__PURE__ */ jsxs3(Text3, { color: colors.text, children: [
768
+ /* @__PURE__ */ jsx3(Text3, { color: isSelected ? colors.bright : colors.muted, underline: isSelected, children: formatTime(call.timestamp) }),
769
+ /* @__PURE__ */ jsx3(Text3, { children: " " }),
770
+ /* @__PURE__ */ jsx3(Text3, { color: getToolColor(call.toolName), bold: true, underline: isSelected, children: call.toolName.padEnd(8) }),
771
+ /* @__PURE__ */ jsxs3(Text3, { color: isSelected ? colors.bright : colors.text, underline: isSelected, children: [
755
772
  " ",
756
- summarizeInput(event)
773
+ summarizeInput(call)
757
774
  ] })
758
- ] }, `${event.timestamp}-${i}`);
775
+ ] }, `${call.timestamp}-${i}`);
759
776
  }),
760
777
  focused && canScroll && !isAtTop && visible.length > 0 && /* @__PURE__ */ jsx3(Box3, { paddingX: 1, justifyContent: "flex-end", children: /* @__PURE__ */ jsx3(Text3, { color: colors.muted, children: isAtBottom ? "" : "G:bottom " }) }),
761
778
  !merged && sessionId && isActive === false && /* @__PURE__ */ jsxs3(Box3, { paddingX: 1, flexDirection: "column", children: [
@@ -1080,10 +1097,224 @@ var FooterBar = React7.memo(
1080
1097
  ] })
1081
1098
  );
1082
1099
 
1083
- // src/ui/components/SettingsMenu.tsx
1084
- import React8, { useState as useState3, useMemo, useEffect as useEffect2, useRef } from "react";
1085
- import { Box as Box8, Text as Text8, useInput as useInput2, useStdout } from "ink";
1100
+ // src/ui/components/ToolCallDetail.tsx
1101
+ import React8, { useState as useState3 } from "react";
1102
+ import { Box as Box8, Text as Text8, useInput as useInput2 } from "ink";
1086
1103
  import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
1104
+ var formatTime3 = (ts) => {
1105
+ const d = new Date(ts);
1106
+ return d.toLocaleTimeString("en-GB", { hour12: false });
1107
+ };
1108
+ var renderBash = (event) => {
1109
+ const lines = [];
1110
+ const cmd = String(event.call.toolInput.command || "");
1111
+ lines.push("$ " + cmd);
1112
+ if (event.result) {
1113
+ lines.push("");
1114
+ lines.push(...event.result.content.split("\n"));
1115
+ }
1116
+ return lines;
1117
+ };
1118
+ var renderRead = (event) => {
1119
+ const lines = [];
1120
+ lines.push("file: " + String(event.call.toolInput.file_path || ""));
1121
+ if (event.call.toolInput.offset) lines.push("offset: " + String(event.call.toolInput.offset));
1122
+ if (event.call.toolInput.limit) lines.push("limit: " + String(event.call.toolInput.limit));
1123
+ if (event.result) {
1124
+ lines.push("");
1125
+ lines.push(...event.result.content.split("\n"));
1126
+ }
1127
+ return lines;
1128
+ };
1129
+ var renderWrite = (event) => {
1130
+ const lines = [];
1131
+ lines.push("file: " + String(event.call.toolInput.file_path || ""));
1132
+ const content = String(event.call.toolInput.content || "");
1133
+ if (content) {
1134
+ lines.push("");
1135
+ lines.push("--- content ---");
1136
+ lines.push(...content.split("\n"));
1137
+ }
1138
+ if (event.result) {
1139
+ lines.push("");
1140
+ lines.push("--- result ---");
1141
+ lines.push(...event.result.content.split("\n"));
1142
+ }
1143
+ return lines;
1144
+ };
1145
+ var renderEdit = (event) => {
1146
+ const lines = [];
1147
+ lines.push("file: " + String(event.call.toolInput.file_path || ""));
1148
+ const oldStr = String(event.call.toolInput.old_string || "");
1149
+ const newStr = String(event.call.toolInput.new_string || "");
1150
+ if (oldStr || newStr) {
1151
+ lines.push("");
1152
+ for (const l of oldStr.split("\n")) {
1153
+ lines.push("- " + l);
1154
+ }
1155
+ lines.push("---");
1156
+ for (const l of newStr.split("\n")) {
1157
+ lines.push("+ " + l);
1158
+ }
1159
+ }
1160
+ if (event.result) {
1161
+ lines.push("");
1162
+ lines.push("--- result ---");
1163
+ lines.push(...event.result.content.split("\n"));
1164
+ }
1165
+ return lines;
1166
+ };
1167
+ var renderGrepGlob = (event) => {
1168
+ const lines = [];
1169
+ const pattern = String(event.call.toolInput.pattern || "");
1170
+ const path = String(event.call.toolInput.path || "");
1171
+ lines.push("pattern: " + pattern);
1172
+ if (path) lines.push("path: " + path);
1173
+ if (event.result) {
1174
+ lines.push("");
1175
+ lines.push(...event.result.content.split("\n"));
1176
+ }
1177
+ return lines;
1178
+ };
1179
+ var renderTask = (event) => {
1180
+ const lines = [];
1181
+ const desc = String(event.call.toolInput.description || "");
1182
+ const prompt = String(event.call.toolInput.prompt || "");
1183
+ lines.push("description: " + desc);
1184
+ if (prompt) {
1185
+ lines.push("");
1186
+ lines.push("--- prompt ---");
1187
+ lines.push(...prompt.split("\n"));
1188
+ }
1189
+ if (event.result) {
1190
+ lines.push("");
1191
+ lines.push("--- result ---");
1192
+ lines.push(...event.result.content.split("\n"));
1193
+ }
1194
+ return lines;
1195
+ };
1196
+ var renderWebFetch = (event) => {
1197
+ const lines = [];
1198
+ lines.push("url: " + String(event.call.toolInput.url || ""));
1199
+ if (event.call.toolInput.prompt) lines.push("prompt: " + String(event.call.toolInput.prompt));
1200
+ if (event.result) {
1201
+ lines.push("");
1202
+ lines.push(...event.result.content.split("\n"));
1203
+ }
1204
+ return lines;
1205
+ };
1206
+ var renderWebSearch = (event) => {
1207
+ const lines = [];
1208
+ lines.push("query: " + String(event.call.toolInput.query || ""));
1209
+ if (event.result) {
1210
+ lines.push("");
1211
+ lines.push(...event.result.content.split("\n"));
1212
+ }
1213
+ return lines;
1214
+ };
1215
+ var renderDefault = (event) => {
1216
+ const lines = [];
1217
+ lines.push("--- input ---");
1218
+ lines.push(JSON.stringify(event.call.toolInput, null, 2));
1219
+ if (event.result) {
1220
+ lines.push("");
1221
+ lines.push("--- result ---");
1222
+ lines.push(...event.result.content.split("\n"));
1223
+ }
1224
+ return lines;
1225
+ };
1226
+ var getDetailLines = (event) => {
1227
+ switch (event.call.toolName) {
1228
+ case "Bash":
1229
+ return renderBash(event);
1230
+ case "Read":
1231
+ return renderRead(event);
1232
+ case "Write":
1233
+ return renderWrite(event);
1234
+ case "Edit":
1235
+ return renderEdit(event);
1236
+ case "Grep":
1237
+ case "Glob":
1238
+ return renderGrepGlob(event);
1239
+ case "Task":
1240
+ return renderTask(event);
1241
+ case "WebFetch":
1242
+ return renderWebFetch(event);
1243
+ case "WebSearch":
1244
+ return renderWebSearch(event);
1245
+ default:
1246
+ return renderDefault(event);
1247
+ }
1248
+ };
1249
+ var ToolCallDetail = React8.memo(({ event, focused, height }) => {
1250
+ const [scrollOffset, setScrollOffset] = useState3(0);
1251
+ const contentLines = getDetailLines(event);
1252
+ const viewportRows = height - 4;
1253
+ const maxScroll = Math.max(0, contentLines.length - viewportRows);
1254
+ const start = Math.min(scrollOffset, maxScroll);
1255
+ const visible = contentLines.slice(start, start + viewportRows);
1256
+ useInput2(
1257
+ (input, key) => {
1258
+ if (!focused) return;
1259
+ if (input === "j" || key.downArrow) setScrollOffset((s) => Math.min(s + 1, maxScroll));
1260
+ if (input === "k" || key.upArrow) setScrollOffset((s) => Math.max(s - 1, 0));
1261
+ if (input === "G") setScrollOffset(maxScroll);
1262
+ if (input === "g") setScrollOffset(0);
1263
+ },
1264
+ { isActive: focused }
1265
+ );
1266
+ return /* @__PURE__ */ jsxs8(
1267
+ Box8,
1268
+ {
1269
+ flexDirection: "column",
1270
+ flexGrow: 1,
1271
+ flexShrink: 1,
1272
+ overflow: "hidden",
1273
+ borderStyle: "single",
1274
+ borderColor: focused ? colors.primary : colors.border,
1275
+ children: [
1276
+ /* @__PURE__ */ jsxs8(Box8, { paddingX: 1, justifyContent: "space-between", children: [
1277
+ /* @__PURE__ */ jsxs8(Box8, { children: [
1278
+ /* @__PURE__ */ jsx8(Text8, { color: getToolColor(event.call.toolName), bold: true, children: event.call.toolName }),
1279
+ /* @__PURE__ */ jsxs8(Text8, { color: colors.muted, children: [
1280
+ " ",
1281
+ formatTime3(event.call.timestamp)
1282
+ ] }),
1283
+ /* @__PURE__ */ jsxs8(Text8, { color: colors.muted, children: [
1284
+ " ",
1285
+ event.call.slug
1286
+ ] }),
1287
+ event.result?.isError && /* @__PURE__ */ jsx8(Text8, { color: colors.error, children: " ERROR" })
1288
+ ] }),
1289
+ /* @__PURE__ */ jsx8(Text8, { color: colors.muted, children: "Esc:back j/k:scroll" })
1290
+ ] }),
1291
+ /* @__PURE__ */ jsx8(Box8, { flexDirection: "column", paddingX: 1, children: visible.map((line, i) => {
1292
+ let lineColor = colors.text;
1293
+ if (line.startsWith("- ") && event.call.toolName === "Edit") lineColor = colors.error;
1294
+ else if (line.startsWith("+ ") && event.call.toolName === "Edit") lineColor = colors.secondary;
1295
+ else if (line.startsWith("$ ")) lineColor = colors.bright;
1296
+ else if (line.startsWith("---")) lineColor = colors.muted;
1297
+ else if (event.result?.isError) lineColor = colors.error;
1298
+ return /* @__PURE__ */ jsx8(Text8, { color: lineColor, wrap: "truncate", children: line }, `${start + i}`);
1299
+ }) }),
1300
+ contentLines.length > viewportRows && /* @__PURE__ */ jsx8(Box8, { paddingX: 1, justifyContent: "flex-end", children: /* @__PURE__ */ jsxs8(Text8, { color: colors.muted, children: [
1301
+ "[",
1302
+ start + 1,
1303
+ "-",
1304
+ Math.min(start + viewportRows, contentLines.length),
1305
+ "/",
1306
+ contentLines.length,
1307
+ "]"
1308
+ ] }) })
1309
+ ]
1310
+ }
1311
+ );
1312
+ });
1313
+
1314
+ // src/ui/components/SettingsMenu.tsx
1315
+ import React9, { useState as useState4, useMemo, useEffect as useEffect2, useRef } from "react";
1316
+ import { Box as Box9, Text as Text9, useInput as useInput3, useStdout } from "ink";
1317
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1087
1318
  var KEYBIND_LABELS = {
1088
1319
  quit: "Quit",
1089
1320
  navUp: "Navigate up",
@@ -1243,13 +1474,13 @@ var buildMenuItems = () => {
1243
1474
  };
1244
1475
  var MENU_ITEMS = buildMenuItems();
1245
1476
  var SELECTABLE_INDICES = MENU_ITEMS.map((item, i) => item.type !== "header" ? i : -1).filter((i) => i >= 0);
1246
- var SettingsMenu = React8.memo(({ config, onClose, onOpenThemeMenu }) => {
1477
+ var SettingsMenu = React9.memo(({ config, onClose, onOpenThemeMenu }) => {
1247
1478
  const { stdout } = useStdout();
1248
1479
  const termHeight = stdout?.rows ?? 40;
1249
- const [localConfig, setLocalConfig] = useState3(() => JSON.parse(JSON.stringify(config)));
1250
- const [selectablePos, setSelectablePos] = useState3(0);
1251
- const [rebinding, setRebinding] = useState3(false);
1252
- const [toast, setToast] = useState3("");
1480
+ const [localConfig, setLocalConfig] = useState4(() => JSON.parse(JSON.stringify(config)));
1481
+ const [selectablePos, setSelectablePos] = useState4(0);
1482
+ const [rebinding, setRebinding] = useState4(false);
1483
+ const [toast, setToast] = useState4("");
1253
1484
  const toastTimer = useRef(null);
1254
1485
  const showToast = (msg) => {
1255
1486
  if (toastTimer.current) clearTimeout(toastTimer.current);
@@ -1267,7 +1498,7 @@ var SettingsMenu = React8.memo(({ config, onClose, onOpenThemeMenu }) => {
1267
1498
  () => Math.max(...MENU_ITEMS.filter((i) => i.type !== "header").map((i) => i.label.length)),
1268
1499
  []
1269
1500
  );
1270
- useInput2((input, key) => {
1501
+ useInput3((input, key) => {
1271
1502
  if (rebinding) {
1272
1503
  const item = MENU_ITEMS[selectedIndex];
1273
1504
  let newKey;
@@ -1331,8 +1562,8 @@ var SettingsMenu = React8.memo(({ config, onClose, onOpenThemeMenu }) => {
1331
1562
  const scrollStart = Math.max(0, Math.min(menuItemIndex - halfView, MENU_ITEMS.length - contentHeight));
1332
1563
  const visibleItems = MENU_ITEMS.slice(Math.max(0, scrollStart), Math.max(0, scrollStart) + contentHeight);
1333
1564
  const visibleStartIndex = Math.max(0, scrollStart);
1334
- return /* @__PURE__ */ jsx8(Box8, { flexDirection: "column", height: termHeight, children: /* @__PURE__ */ jsxs8(
1335
- Box8,
1565
+ return /* @__PURE__ */ jsx9(Box9, { flexDirection: "column", height: termHeight, children: /* @__PURE__ */ jsxs9(
1566
+ Box9,
1336
1567
  {
1337
1568
  borderStyle: "round",
1338
1569
  borderColor: colors.primary,
@@ -1341,9 +1572,9 @@ var SettingsMenu = React8.memo(({ config, onClose, onOpenThemeMenu }) => {
1341
1572
  paddingY: 1,
1342
1573
  height: termHeight,
1343
1574
  children: [
1344
- /* @__PURE__ */ jsxs8(Box8, { justifyContent: "space-between", marginBottom: 1, children: [
1345
- /* @__PURE__ */ jsx8(Text8, { color: colors.header, bold: true, children: "SETTINGS" }),
1346
- /* @__PURE__ */ jsxs8(Text8, { color: colors.muted, children: [
1575
+ /* @__PURE__ */ jsxs9(Box9, { justifyContent: "space-between", marginBottom: 1, children: [
1576
+ /* @__PURE__ */ jsx9(Text9, { color: colors.header, bold: true, children: "SETTINGS" }),
1577
+ /* @__PURE__ */ jsxs9(Text9, { color: colors.muted, children: [
1347
1578
  "esc to save & close ",
1348
1579
  rebinding ? "| backspace to reset" : ""
1349
1580
  ] })
@@ -1352,7 +1583,7 @@ var SettingsMenu = React8.memo(({ config, onClose, onOpenThemeMenu }) => {
1352
1583
  const realIndex = visibleStartIndex + vi;
1353
1584
  const isSelected = realIndex === selectedIndex;
1354
1585
  if (item.type === "header") {
1355
- return /* @__PURE__ */ jsx8(Box8, { marginTop: realIndex > 0 ? 1 : 0, children: /* @__PURE__ */ jsxs8(Text8, { color: colors.accent, bold: true, children: [
1586
+ return /* @__PURE__ */ jsx9(Box9, { marginTop: realIndex > 0 ? 1 : 0, children: /* @__PURE__ */ jsxs9(Text9, { color: colors.accent, bold: true, children: [
1356
1587
  " ",
1357
1588
  item.label
1358
1589
  ] }) }, `h-${item.label}`);
@@ -1363,45 +1594,45 @@ var SettingsMenu = React8.memo(({ config, onClose, onOpenThemeMenu }) => {
1363
1594
  const valueColor = isRebindingThis ? colors.warning : value === "ON" ? colors.secondary : value === "OFF" ? colors.error : colors.bright;
1364
1595
  const isReset = item.key === "resetAllKeybinds";
1365
1596
  const dots = isReset ? "" : ".".repeat(Math.max(2, maxLabelLen - item.label.length + 4)) + " ";
1366
- return /* @__PURE__ */ jsxs8(Box8, { children: [
1367
- /* @__PURE__ */ jsxs8(Text8, { color: isSelected ? colors.primary : colors.text, children: [
1597
+ return /* @__PURE__ */ jsxs9(Box9, { children: [
1598
+ /* @__PURE__ */ jsxs9(Text9, { color: isSelected ? colors.primary : colors.text, children: [
1368
1599
  isSelected ? "> " : " ",
1369
1600
  " ",
1370
1601
  item.label,
1371
1602
  " ",
1372
1603
  dots
1373
1604
  ] }),
1374
- !isReset && /* @__PURE__ */ jsx8(Text8, { color: valueColor, children: displayValue })
1605
+ !isReset && /* @__PURE__ */ jsx9(Text9, { color: valueColor, children: displayValue })
1375
1606
  ] }, `${item.section}-${item.key}`);
1376
1607
  }),
1377
- toast && /* @__PURE__ */ jsx8(Box8, { marginTop: 1, paddingX: 2, children: /* @__PURE__ */ jsx8(Text8, { color: colors.warning, children: toast }) })
1608
+ toast && /* @__PURE__ */ jsx9(Box9, { marginTop: 1, paddingX: 2, children: /* @__PURE__ */ jsx9(Text9, { color: colors.warning, children: toast }) })
1378
1609
  ]
1379
1610
  }
1380
1611
  ) });
1381
1612
  });
1382
1613
 
1383
1614
  // src/ui/components/ThemeMenu.tsx
1384
- import React10, { useState as useState5, useCallback, useRef as useRef2, useEffect as useEffect3 } from "react";
1385
- import { Box as Box10, Text as Text10, useInput as useInput4, useStdout as useStdout2 } from "ink";
1615
+ import React11, { useState as useState6, useCallback, useRef as useRef2, useEffect as useEffect3 } from "react";
1616
+ import { Box as Box11, Text as Text11, useInput as useInput5, useStdout as useStdout2 } from "ink";
1386
1617
 
1387
1618
  // src/ui/components/ThemeEditor.tsx
1388
- import React9, { useState as useState4 } from "react";
1389
- import { Box as Box9, Text as Text9, useInput as useInput3 } from "ink";
1390
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
1619
+ import React10, { useState as useState5 } from "react";
1620
+ import { Box as Box10, Text as Text10, useInput as useInput4 } from "ink";
1621
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1391
1622
  var ALL_KEYS = [
1392
1623
  ...COLOR_KEYS.map((key) => ({ group: "colors", key })),
1393
1624
  ...TOOL_COLOR_KEYS.map((key) => ({ group: "toolColors", key }))
1394
1625
  ];
1395
1626
  var isValidHex = (v) => /^#[0-9A-Fa-f]{6}$/.test(v);
1396
- var ThemeEditor = React9.memo(({ theme, onSave, onCancel }) => {
1397
- const [editColors, setEditColors] = useState4({ ...theme.colors });
1398
- const [editToolColors, setEditToolColors] = useState4({ ...theme.toolColors });
1399
- const [selectedIdx, setSelectedIdx] = useState4(0);
1400
- const [editing, setEditing] = useState4(false);
1401
- const [inputValue, setInputValue] = useState4("");
1627
+ var ThemeEditor = React10.memo(({ theme, onSave, onCancel }) => {
1628
+ const [editColors, setEditColors] = useState5({ ...theme.colors });
1629
+ const [editToolColors, setEditToolColors] = useState5({ ...theme.toolColors });
1630
+ const [selectedIdx, setSelectedIdx] = useState5(0);
1631
+ const [editing, setEditing] = useState5(false);
1632
+ const [inputValue, setInputValue] = useState5("");
1402
1633
  const currentTarget = ALL_KEYS[selectedIdx];
1403
1634
  const getCurrentValue = (t) => t.group === "colors" ? editColors[t.key] : editToolColors[t.key];
1404
- useInput3((input, key) => {
1635
+ useInput4((input, key) => {
1405
1636
  if (editing) {
1406
1637
  if (key.escape) {
1407
1638
  setEditing(false);
@@ -1451,15 +1682,15 @@ var ThemeEditor = React9.memo(({ theme, onSave, onCancel }) => {
1451
1682
  onSave({ ...theme, colors: editColors, toolColors: editToolColors });
1452
1683
  }
1453
1684
  });
1454
- return /* @__PURE__ */ jsxs9(Box9, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1455
- /* @__PURE__ */ jsxs9(Box9, { justifyContent: "space-between", marginBottom: 1, children: [
1456
- /* @__PURE__ */ jsxs9(Text9, { color: colors.header, bold: true, children: [
1685
+ return /* @__PURE__ */ jsxs10(Box10, { flexDirection: "column", paddingX: 2, paddingY: 1, children: [
1686
+ /* @__PURE__ */ jsxs10(Box10, { justifyContent: "space-between", marginBottom: 1, children: [
1687
+ /* @__PURE__ */ jsxs10(Text10, { color: colors.header, bold: true, children: [
1457
1688
  "EDIT THEME: ",
1458
1689
  theme.name
1459
1690
  ] }),
1460
- /* @__PURE__ */ jsx9(Text9, { color: colors.muted, children: "enter:edit s:save esc:cancel" })
1691
+ /* @__PURE__ */ jsx10(Text10, { color: colors.muted, children: "enter:edit s:save esc:cancel" })
1461
1692
  ] }),
1462
- /* @__PURE__ */ jsx9(Box9, { marginBottom: 1, children: /* @__PURE__ */ jsxs9(Text9, { color: colors.accent, bold: true, children: [
1693
+ /* @__PURE__ */ jsx10(Box10, { marginBottom: 1, children: /* @__PURE__ */ jsxs10(Text10, { color: colors.accent, bold: true, children: [
1463
1694
  " ",
1464
1695
  "COLORS"
1465
1696
  ] }) }),
@@ -1467,20 +1698,20 @@ var ThemeEditor = React9.memo(({ theme, onSave, onCancel }) => {
1467
1698
  const isSelected = selectedIdx === i;
1468
1699
  const value = editColors[k];
1469
1700
  const isEditingThis = editing && isSelected;
1470
- return /* @__PURE__ */ jsxs9(Box9, { children: [
1471
- /* @__PURE__ */ jsxs9(Text9, { color: isSelected ? colors.primary : colors.text, children: [
1701
+ return /* @__PURE__ */ jsxs10(Box10, { children: [
1702
+ /* @__PURE__ */ jsxs10(Text10, { color: isSelected ? colors.primary : colors.text, children: [
1472
1703
  isSelected ? "> " : " ",
1473
1704
  " ",
1474
1705
  k.padEnd(12)
1475
1706
  ] }),
1476
- /* @__PURE__ */ jsx9(Text9, { color: value, children: isEditingThis ? inputValue + "_" : value }),
1477
- /* @__PURE__ */ jsxs9(Text9, { color: value, children: [
1707
+ /* @__PURE__ */ jsx10(Text10, { color: value, children: isEditingThis ? inputValue + "_" : value }),
1708
+ /* @__PURE__ */ jsxs10(Text10, { color: value, children: [
1478
1709
  " ",
1479
1710
  "\u2588\u2588"
1480
1711
  ] })
1481
1712
  ] }, k);
1482
1713
  }),
1483
- /* @__PURE__ */ jsx9(Box9, { marginTop: 1, marginBottom: 1, children: /* @__PURE__ */ jsxs9(Text9, { color: colors.accent, bold: true, children: [
1714
+ /* @__PURE__ */ jsx10(Box10, { marginTop: 1, marginBottom: 1, children: /* @__PURE__ */ jsxs10(Text10, { color: colors.accent, bold: true, children: [
1484
1715
  " ",
1485
1716
  "TOOL COLORS"
1486
1717
  ] }) }),
@@ -1489,14 +1720,14 @@ var ThemeEditor = React9.memo(({ theme, onSave, onCancel }) => {
1489
1720
  const isSelected = selectedIdx === realIdx;
1490
1721
  const value = editToolColors[k];
1491
1722
  const isEditingThis = editing && isSelected;
1492
- return /* @__PURE__ */ jsxs9(Box9, { children: [
1493
- /* @__PURE__ */ jsxs9(Text9, { color: isSelected ? colors.primary : colors.text, children: [
1723
+ return /* @__PURE__ */ jsxs10(Box10, { children: [
1724
+ /* @__PURE__ */ jsxs10(Text10, { color: isSelected ? colors.primary : colors.text, children: [
1494
1725
  isSelected ? "> " : " ",
1495
1726
  " ",
1496
1727
  k.padEnd(12)
1497
1728
  ] }),
1498
- /* @__PURE__ */ jsx9(Text9, { color: value, children: isEditingThis ? inputValue + "_" : value }),
1499
- /* @__PURE__ */ jsxs9(Text9, { color: value, children: [
1729
+ /* @__PURE__ */ jsx10(Text10, { color: value, children: isEditingThis ? inputValue + "_" : value }),
1730
+ /* @__PURE__ */ jsxs10(Text10, { color: value, children: [
1500
1731
  " ",
1501
1732
  "\u2588\u2588"
1502
1733
  ] })
@@ -1506,17 +1737,17 @@ var ThemeEditor = React9.memo(({ theme, onSave, onCancel }) => {
1506
1737
  });
1507
1738
 
1508
1739
  // src/ui/components/ThemeMenu.tsx
1509
- import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
1510
- var ThemeMenu = React10.memo(({ config, onClose }) => {
1740
+ import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
1741
+ var ThemeMenu = React11.memo(({ config, onClose }) => {
1511
1742
  const { stdout } = useStdout2();
1512
1743
  const termHeight = stdout?.rows ?? 40;
1513
- const [localConfig, setLocalConfig] = useState5(() => JSON.parse(JSON.stringify(config)));
1514
- const [selectedIdx, setSelectedIdx] = useState5(0);
1515
- const [view, setView] = useState5("list");
1516
- const [editingTheme, setEditingTheme] = useState5(null);
1517
- const [nameInput, setNameInput] = useState5("");
1518
- const [namingAction, setNamingAction] = useState5("copy");
1519
- const [toast, setToast] = useState5("");
1744
+ const [localConfig, setLocalConfig] = useState6(() => JSON.parse(JSON.stringify(config)));
1745
+ const [selectedIdx, setSelectedIdx] = useState6(0);
1746
+ const [view, setView] = useState6("list");
1747
+ const [editingTheme, setEditingTheme] = useState6(null);
1748
+ const [nameInput, setNameInput] = useState6("");
1749
+ const [namingAction, setNamingAction] = useState6("copy");
1750
+ const [toast, setToast] = useState6("");
1520
1751
  const toastTimer = useRef2(null);
1521
1752
  const showToast = (msg) => {
1522
1753
  if (toastTimer.current) clearTimeout(toastTimer.current);
@@ -1544,7 +1775,7 @@ var ThemeMenu = React10.memo(({ config, onClose }) => {
1544
1775
  },
1545
1776
  [previewTheme]
1546
1777
  );
1547
- useInput4((input, key) => {
1778
+ useInput5((input, key) => {
1548
1779
  if (view === "naming") {
1549
1780
  if (key.escape) {
1550
1781
  setView("list");
@@ -1681,15 +1912,15 @@ var ThemeMenu = React10.memo(({ config, onClose }) => {
1681
1912
  setEditingTheme(null);
1682
1913
  }, [localConfig]);
1683
1914
  if (view === "editor" && editingTheme) {
1684
- return /* @__PURE__ */ jsx10(Box10, { flexDirection: "column", height: termHeight, children: /* @__PURE__ */ jsx10(Box10, { borderStyle: "round", borderColor: colors.primary, flexDirection: "column", height: termHeight, children: /* @__PURE__ */ jsx10(ThemeEditor, { theme: editingTheme, onSave: handleEditorSave, onCancel: handleEditorCancel }) }) });
1915
+ return /* @__PURE__ */ jsx11(Box11, { flexDirection: "column", height: termHeight, children: /* @__PURE__ */ jsx11(Box11, { borderStyle: "round", borderColor: colors.primary, flexDirection: "column", height: termHeight, children: /* @__PURE__ */ jsx11(ThemeEditor, { theme: editingTheme, onSave: handleEditorSave, onCancel: handleEditorCancel }) }) });
1685
1916
  }
1686
1917
  const contentHeight = termHeight - 8;
1687
1918
  const halfView = Math.floor(contentHeight / 2);
1688
1919
  const scrollStart = Math.max(0, Math.min(selectedIdx - halfView, themes.length - contentHeight));
1689
1920
  const visibleThemes = themes.slice(Math.max(0, scrollStart), Math.max(0, scrollStart) + contentHeight);
1690
1921
  const visibleStartIdx = Math.max(0, scrollStart);
1691
- return /* @__PURE__ */ jsx10(Box10, { flexDirection: "column", height: termHeight, children: /* @__PURE__ */ jsxs10(
1692
- Box10,
1922
+ return /* @__PURE__ */ jsx11(Box11, { flexDirection: "column", height: termHeight, children: /* @__PURE__ */ jsxs11(
1923
+ Box11,
1693
1924
  {
1694
1925
  borderStyle: "round",
1695
1926
  borderColor: colors.primary,
@@ -1698,16 +1929,16 @@ var ThemeMenu = React10.memo(({ config, onClose }) => {
1698
1929
  paddingY: 1,
1699
1930
  height: termHeight,
1700
1931
  children: [
1701
- /* @__PURE__ */ jsxs10(Box10, { justifyContent: "space-between", marginBottom: 1, children: [
1702
- /* @__PURE__ */ jsx10(Text10, { color: colors.header, bold: true, children: "THEMES" }),
1703
- /* @__PURE__ */ jsx10(Text10, { color: colors.muted, children: "enter:apply c:copy e:edit r:rename d:delete esc:back" })
1932
+ /* @__PURE__ */ jsxs11(Box11, { justifyContent: "space-between", marginBottom: 1, children: [
1933
+ /* @__PURE__ */ jsx11(Text11, { color: colors.header, bold: true, children: "THEMES" }),
1934
+ /* @__PURE__ */ jsx11(Text11, { color: colors.muted, children: "enter:apply c:copy e:edit r:rename d:delete esc:back" })
1704
1935
  ] }),
1705
- view === "naming" && /* @__PURE__ */ jsxs10(Box10, { marginBottom: 1, children: [
1706
- /* @__PURE__ */ jsxs10(Text10, { color: colors.warning, children: [
1936
+ view === "naming" && /* @__PURE__ */ jsxs11(Box11, { marginBottom: 1, children: [
1937
+ /* @__PURE__ */ jsxs11(Text11, { color: colors.warning, children: [
1707
1938
  namingAction === "copy" ? "New name" : "Rename to",
1708
1939
  ": "
1709
1940
  ] }),
1710
- /* @__PURE__ */ jsxs10(Text10, { color: colors.bright, children: [
1941
+ /* @__PURE__ */ jsxs11(Text11, { color: colors.bright, children: [
1711
1942
  nameInput,
1712
1943
  "_"
1713
1944
  ] })
@@ -1716,38 +1947,38 @@ var ThemeMenu = React10.memo(({ config, onClose }) => {
1716
1947
  const realIdx = visibleStartIdx + vi;
1717
1948
  const isSelected = realIdx === selectedIdx;
1718
1949
  const isActive = theme.name === localConfig.theme;
1719
- return /* @__PURE__ */ jsxs10(Box10, { children: [
1720
- /* @__PURE__ */ jsxs10(Text10, { color: isSelected ? colors.primary : colors.text, children: [
1950
+ return /* @__PURE__ */ jsxs11(Box11, { children: [
1951
+ /* @__PURE__ */ jsxs11(Text11, { color: isSelected ? colors.primary : colors.text, children: [
1721
1952
  isSelected ? "> " : " ",
1722
1953
  isActive ? "* " : " ",
1723
1954
  theme.name
1724
1955
  ] }),
1725
- /* @__PURE__ */ jsx10(Text10, { color: colors.muted, children: theme.builtin ? " (built-in)" : " (custom)" }),
1726
- /* @__PURE__ */ jsx10(Text10, { children: " " }),
1727
- /* @__PURE__ */ jsx10(Text10, { color: theme.colors.primary, children: "\u2588" }),
1728
- /* @__PURE__ */ jsx10(Text10, { color: theme.colors.secondary, children: "\u2588" }),
1729
- /* @__PURE__ */ jsx10(Text10, { color: theme.colors.accent, children: "\u2588" }),
1730
- /* @__PURE__ */ jsx10(Text10, { color: theme.colors.warning, children: "\u2588" }),
1731
- /* @__PURE__ */ jsx10(Text10, { color: theme.colors.error, children: "\u2588" })
1956
+ /* @__PURE__ */ jsx11(Text11, { color: colors.muted, children: theme.builtin ? " (built-in)" : " (custom)" }),
1957
+ /* @__PURE__ */ jsx11(Text11, { children: " " }),
1958
+ /* @__PURE__ */ jsx11(Text11, { color: theme.colors.primary, children: "\u2588" }),
1959
+ /* @__PURE__ */ jsx11(Text11, { color: theme.colors.secondary, children: "\u2588" }),
1960
+ /* @__PURE__ */ jsx11(Text11, { color: theme.colors.accent, children: "\u2588" }),
1961
+ /* @__PURE__ */ jsx11(Text11, { color: theme.colors.warning, children: "\u2588" }),
1962
+ /* @__PURE__ */ jsx11(Text11, { color: theme.colors.error, children: "\u2588" })
1732
1963
  ] }, theme.name);
1733
1964
  }),
1734
- toast && /* @__PURE__ */ jsx10(Box10, { marginTop: 1, paddingX: 2, children: /* @__PURE__ */ jsx10(Text10, { color: colors.warning, children: toast }) })
1965
+ toast && /* @__PURE__ */ jsx11(Box11, { marginTop: 1, paddingX: 2, children: /* @__PURE__ */ jsx11(Text11, { color: colors.warning, children: toast }) })
1735
1966
  ]
1736
1967
  }
1737
1968
  ) });
1738
1969
  });
1739
1970
 
1740
1971
  // src/ui/components/ThemePickerModal.tsx
1741
- import React11, { useState as useState6, useEffect as useEffect4 } from "react";
1742
- import { Box as Box11, Text as Text11, useInput as useInput5 } from "ink";
1743
- import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
1744
- var ThemePickerModal = React11.memo(({ onSelect, onSkip, onDismiss }) => {
1745
- const [selectedIndex, setSelectedIndex] = useState6(0);
1972
+ import React12, { useState as useState7, useEffect as useEffect4 } from "react";
1973
+ import { Box as Box12, Text as Text12, useInput as useInput6 } from "ink";
1974
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
1975
+ var ThemePickerModal = React12.memo(({ onSelect, onSkip, onDismiss }) => {
1976
+ const [selectedIndex, setSelectedIndex] = useState7(0);
1746
1977
  const themes = BUILTIN_THEMES;
1747
1978
  useEffect4(() => {
1748
1979
  applyTheme(themes[selectedIndex]);
1749
1980
  }, [selectedIndex]);
1750
- useInput5((input, key) => {
1981
+ useInput6((input, key) => {
1751
1982
  if (key.upArrow) setSelectedIndex((i) => Math.max(0, i - 1));
1752
1983
  if (key.downArrow) setSelectedIndex((i) => Math.min(themes.length - 1, i + 1));
1753
1984
  if (key.return) onSelect(themes[selectedIndex].name);
@@ -1756,33 +1987,33 @@ var ThemePickerModal = React11.memo(({ onSelect, onSkip, onDismiss }) => {
1756
1987
  });
1757
1988
  const renderSwatch = (theme) => {
1758
1989
  const c = theme.colors;
1759
- return /* @__PURE__ */ jsxs11(Text11, { children: [
1760
- /* @__PURE__ */ jsx11(Text11, { color: c.primary, children: "\u2588" }),
1761
- /* @__PURE__ */ jsx11(Text11, { color: c.secondary, children: "\u2588" }),
1762
- /* @__PURE__ */ jsx11(Text11, { color: c.accent, children: "\u2588" }),
1763
- /* @__PURE__ */ jsx11(Text11, { color: c.warning, children: "\u2588" }),
1764
- /* @__PURE__ */ jsx11(Text11, { color: c.error, children: "\u2588" })
1990
+ return /* @__PURE__ */ jsxs12(Text12, { children: [
1991
+ /* @__PURE__ */ jsx12(Text12, { color: c.primary, children: "\u2588" }),
1992
+ /* @__PURE__ */ jsx12(Text12, { color: c.secondary, children: "\u2588" }),
1993
+ /* @__PURE__ */ jsx12(Text12, { color: c.accent, children: "\u2588" }),
1994
+ /* @__PURE__ */ jsx12(Text12, { color: c.warning, children: "\u2588" }),
1995
+ /* @__PURE__ */ jsx12(Text12, { color: c.error, children: "\u2588" })
1765
1996
  ] });
1766
1997
  };
1767
- return /* @__PURE__ */ jsx11(Box11, { flexDirection: "column", paddingX: 4, paddingY: 1, children: /* @__PURE__ */ jsxs11(Box11, { borderStyle: "round", borderColor: colors.primary, flexDirection: "column", paddingX: 3, paddingY: 1, children: [
1768
- /* @__PURE__ */ jsx11(Box11, { marginBottom: 1, children: /* @__PURE__ */ jsx11(Text11, { color: colors.header, bold: true, children: "Choose a theme" }) }),
1769
- /* @__PURE__ */ jsx11(Box11, { marginBottom: 1, children: /* @__PURE__ */ jsx11(Text11, { color: colors.text, children: "Select a theme to get started. You can change this later in settings (s)." }) }),
1770
- themes.map((theme, i) => /* @__PURE__ */ jsxs11(Box11, { children: [
1771
- /* @__PURE__ */ jsx11(Text11, { color: i === selectedIndex ? colors.primary : colors.muted, children: i === selectedIndex ? "> " : " " }),
1998
+ return /* @__PURE__ */ jsx12(Box12, { flexDirection: "column", paddingX: 4, paddingY: 1, children: /* @__PURE__ */ jsxs12(Box12, { borderStyle: "round", borderColor: colors.primary, flexDirection: "column", paddingX: 3, paddingY: 1, children: [
1999
+ /* @__PURE__ */ jsx12(Box12, { marginBottom: 1, children: /* @__PURE__ */ jsx12(Text12, { color: colors.header, bold: true, children: "Choose a theme" }) }),
2000
+ /* @__PURE__ */ jsx12(Box12, { marginBottom: 1, children: /* @__PURE__ */ jsx12(Text12, { color: colors.text, children: "Select a theme to get started. You can change this later in settings (s)." }) }),
2001
+ themes.map((theme, i) => /* @__PURE__ */ jsxs12(Box12, { children: [
2002
+ /* @__PURE__ */ jsx12(Text12, { color: i === selectedIndex ? colors.primary : colors.muted, children: i === selectedIndex ? "> " : " " }),
1772
2003
  renderSwatch(theme),
1773
- /* @__PURE__ */ jsxs11(Text11, { color: i === selectedIndex ? colors.bright : colors.text, children: [
2004
+ /* @__PURE__ */ jsxs12(Text12, { color: i === selectedIndex ? colors.bright : colors.text, children: [
1774
2005
  " ",
1775
2006
  theme.name
1776
2007
  ] })
1777
2008
  ] }, theme.name)),
1778
- /* @__PURE__ */ jsx11(Box11, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx11(Text11, { color: colors.muted, children: "Enter = select | n = not now | d = don't ask again" }) })
2009
+ /* @__PURE__ */ jsx12(Box12, { marginTop: 1, flexDirection: "column", children: /* @__PURE__ */ jsx12(Text12, { color: colors.muted, children: "Enter = select | n = not now | d = don't ask again" }) })
1779
2010
  ] }) });
1780
2011
  });
1781
2012
 
1782
2013
  // src/ui/components/GuidedTour.tsx
1783
- import React12, { useState as useState7 } from "react";
1784
- import { Box as Box12, Text as Text12, useInput as useInput6 } from "ink";
1785
- import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
2014
+ import React13, { useState as useState8 } from "react";
2015
+ import { Box as Box13, Text as Text13, useInput as useInput7 } from "ink";
2016
+ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
1786
2017
  var STEPS = [
1787
2018
  {
1788
2019
  title: "Session list",
@@ -1813,11 +2044,11 @@ var STEPS = [
1813
2044
  body: "Press s to open settings. Customise keybindings, manage themes, and configure updates."
1814
2045
  }
1815
2046
  ];
1816
- var GuidedTour = React12.memo(({ onComplete, onSkip }) => {
1817
- const [stepIndex, setStepIndex] = useState7(0);
2047
+ var GuidedTour = React13.memo(({ onComplete, onSkip }) => {
2048
+ const [stepIndex, setStepIndex] = useState8(0);
1818
2049
  const step = STEPS[stepIndex];
1819
2050
  const isLast = stepIndex === STEPS.length - 1;
1820
- useInput6((input, key) => {
2051
+ useInput7((input, key) => {
1821
2052
  if (key.return || key.rightArrow) {
1822
2053
  if (isLast) onComplete();
1823
2054
  else setStepIndex((i) => i + 1);
@@ -1825,17 +2056,17 @@ var GuidedTour = React12.memo(({ onComplete, onSkip }) => {
1825
2056
  if (key.leftArrow && stepIndex > 0) setStepIndex((i) => i - 1);
1826
2057
  if (input === "q" || key.escape) onSkip();
1827
2058
  });
1828
- return /* @__PURE__ */ jsx12(Box12, { flexDirection: "column", paddingX: 4, paddingY: 1, children: /* @__PURE__ */ jsxs12(Box12, { borderStyle: "round", borderColor: colors.primary, flexDirection: "column", paddingX: 3, paddingY: 1, children: [
1829
- /* @__PURE__ */ jsx12(Box12, { marginBottom: 1, children: /* @__PURE__ */ jsxs12(Text12, { color: colors.header, bold: true, children: [
2059
+ return /* @__PURE__ */ jsx13(Box13, { flexDirection: "column", paddingX: 4, paddingY: 1, children: /* @__PURE__ */ jsxs13(Box13, { borderStyle: "round", borderColor: colors.primary, flexDirection: "column", paddingX: 3, paddingY: 1, children: [
2060
+ /* @__PURE__ */ jsx13(Box13, { marginBottom: 1, children: /* @__PURE__ */ jsxs13(Text13, { color: colors.header, bold: true, children: [
1830
2061
  "Quick tour (",
1831
2062
  stepIndex + 1,
1832
2063
  "/",
1833
2064
  STEPS.length,
1834
2065
  ")"
1835
2066
  ] }) }),
1836
- /* @__PURE__ */ jsx12(Box12, { marginBottom: 1, children: /* @__PURE__ */ jsx12(Text12, { color: colors.bright, bold: true, children: step.title }) }),
1837
- /* @__PURE__ */ jsx12(Box12, { marginBottom: 1, children: /* @__PURE__ */ jsx12(Text12, { color: colors.text, children: step.body }) }),
1838
- /* @__PURE__ */ jsxs12(Text12, { color: colors.muted, children: [
2067
+ /* @__PURE__ */ jsx13(Box13, { marginBottom: 1, children: /* @__PURE__ */ jsx13(Text13, { color: colors.bright, bold: true, children: step.title }) }),
2068
+ /* @__PURE__ */ jsx13(Box13, { marginBottom: 1, children: /* @__PURE__ */ jsx13(Text13, { color: colors.text, children: step.body }) }),
2069
+ /* @__PURE__ */ jsxs13(Text13, { color: colors.muted, children: [
1839
2070
  isLast ? "Enter = finish" : "Enter/\u2192 = next",
1840
2071
  " | ",
1841
2072
  stepIndex > 0 ? "\u2190 = back | " : "",
@@ -1845,19 +2076,19 @@ var GuidedTour = React12.memo(({ onComplete, onSkip }) => {
1845
2076
  });
1846
2077
 
1847
2078
  // src/ui/components/ConfirmModal.tsx
1848
- import React13 from "react";
1849
- import { Box as Box13, Text as Text13, useInput as useInput7 } from "ink";
1850
- import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
1851
- var ConfirmModal = React13.memo(({ title, message, onConfirm, onCancel }) => {
1852
- useInput7((input, key) => {
2079
+ import React14 from "react";
2080
+ import { Box as Box14, Text as Text14, useInput as useInput8 } from "ink";
2081
+ import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
2082
+ var ConfirmModal = React14.memo(({ title, message, onConfirm, onCancel }) => {
2083
+ useInput8((input, key) => {
1853
2084
  if (input === "y" || input === "Y") {
1854
2085
  onConfirm();
1855
2086
  } else if (input === "n" || input === "N" || key.escape) {
1856
2087
  onCancel();
1857
2088
  }
1858
2089
  });
1859
- return /* @__PURE__ */ jsxs13(
1860
- Box13,
2090
+ return /* @__PURE__ */ jsxs14(
2091
+ Box14,
1861
2092
  {
1862
2093
  borderStyle: "round",
1863
2094
  borderColor: colors.warning,
@@ -1866,19 +2097,19 @@ var ConfirmModal = React13.memo(({ title, message, onConfirm, onCancel }) => {
1866
2097
  paddingY: 1,
1867
2098
  alignSelf: "center",
1868
2099
  children: [
1869
- /* @__PURE__ */ jsx13(Text13, { color: colors.warning, bold: true, children: title }),
1870
- /* @__PURE__ */ jsx13(Text13, { color: colors.text, children: message }),
1871
- /* @__PURE__ */ jsx13(Box13, { marginTop: 1, children: /* @__PURE__ */ jsx13(Text13, { color: colors.muted, children: "[y] confirm [n/esc] cancel" }) })
2100
+ /* @__PURE__ */ jsx14(Text14, { color: colors.warning, bold: true, children: title }),
2101
+ /* @__PURE__ */ jsx14(Text14, { color: colors.text, children: message }),
2102
+ /* @__PURE__ */ jsx14(Box14, { marginTop: 1, children: /* @__PURE__ */ jsx14(Text14, { color: colors.muted, children: "[y] confirm [n/esc] cancel" }) })
1872
2103
  ]
1873
2104
  }
1874
2105
  );
1875
2106
  });
1876
2107
 
1877
2108
  // src/ui/components/SplitPanel.tsx
1878
- import React14 from "react";
1879
- import { Box as Box14 } from "ink";
1880
- import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
1881
- var SplitPanel = React14.memo(
2109
+ import React15 from "react";
2110
+ import { Box as Box15 } from "ink";
2111
+ import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
2112
+ var SplitPanel = React15.memo(
1882
2113
  ({
1883
2114
  activePanel,
1884
2115
  leftSession,
@@ -1893,7 +2124,7 @@ var SplitPanel = React14.memo(
1893
2124
  rightShowDetail,
1894
2125
  height
1895
2126
  }) => {
1896
- const left = leftShowDetail && leftSession ? /* @__PURE__ */ jsx14(SessionDetail, { session: leftSession, focused: activePanel === "left", height }) : /* @__PURE__ */ jsx14(
2127
+ const left = leftShowDetail && leftSession ? /* @__PURE__ */ jsx15(SessionDetail, { session: leftSession, focused: activePanel === "left", height }) : /* @__PURE__ */ jsx15(
1897
2128
  ActivityFeed,
1898
2129
  {
1899
2130
  events: leftEvents,
@@ -1906,7 +2137,7 @@ var SplitPanel = React14.memo(
1906
2137
  filter: leftFilter || void 0
1907
2138
  }
1908
2139
  );
1909
- const right = rightShowDetail && rightSession ? /* @__PURE__ */ jsx14(SessionDetail, { session: rightSession, focused: activePanel === "right", height }) : /* @__PURE__ */ jsx14(
2140
+ const right = rightShowDetail && rightSession ? /* @__PURE__ */ jsx15(SessionDetail, { session: rightSession, focused: activePanel === "right", height }) : /* @__PURE__ */ jsx15(
1910
2141
  ActivityFeed,
1911
2142
  {
1912
2143
  events: rightEvents,
@@ -1919,9 +2150,9 @@ var SplitPanel = React14.memo(
1919
2150
  filter: rightFilter || void 0
1920
2151
  }
1921
2152
  );
1922
- return /* @__PURE__ */ jsxs14(Box14, { flexDirection: "row", flexGrow: 1, children: [
1923
- /* @__PURE__ */ jsx14(
1924
- Box14,
2153
+ return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "row", flexGrow: 1, children: [
2154
+ /* @__PURE__ */ jsx15(
2155
+ Box15,
1925
2156
  {
1926
2157
  flexGrow: 1,
1927
2158
  borderStyle: "single",
@@ -1939,7 +2170,7 @@ var SplitPanel = React14.memo(
1939
2170
  );
1940
2171
 
1941
2172
  // src/ui/hooks/useSessions.ts
1942
- import { useState as useState8, useEffect as useEffect5, useCallback as useCallback2, useRef as useRef3, useMemo as useMemo2 } from "react";
2173
+ import { useState as useState9, useEffect as useEffect5, useCallback as useCallback2, useRef as useRef3, useMemo as useMemo2 } from "react";
1943
2174
 
1944
2175
  // src/discovery/sessionsAsync.ts
1945
2176
  import { readdir, stat as stat2 } from "fs/promises";
@@ -2424,9 +2655,9 @@ var enrichAndFilter = (found, usageOverrides, filter, archivedIds, viewingArchiv
2424
2655
  return enriched;
2425
2656
  };
2426
2657
  var useSessions = (allUsers, filter, archivedIds, viewingArchive) => {
2427
- const [sessions2, setSessions] = useState8([]);
2428
- const [selectedIndex, setSelectedIndex] = useState8(0);
2429
- const [expandedKeys, setExpandedKeys] = useState8(/* @__PURE__ */ new Set());
2658
+ const [sessions2, setSessions] = useState9([]);
2659
+ const [selectedIndex, setSelectedIndex] = useState9(0);
2660
+ const [expandedKeys, setExpandedKeys] = useState9(/* @__PURE__ */ new Set());
2430
2661
  const usageOverrides = useRef3(/* @__PURE__ */ new Map());
2431
2662
  const refresh = useCallback2(() => {
2432
2663
  const found = getCachedSessions();
@@ -2502,16 +2733,18 @@ var useSessions = (allUsers, filter, archivedIds, viewingArchive) => {
2502
2733
  };
2503
2734
 
2504
2735
  // src/ui/hooks/useActivityStream.ts
2505
- import { useState as useState9, useEffect as useEffect6, useRef as useRef4 } from "react";
2736
+ import { useState as useState10, useEffect as useEffect6, useRef as useRef4, useMemo as useMemo3 } from "react";
2506
2737
  var MAX_EVENTS = 200;
2507
2738
  var useActivityStream = (session, allUsers) => {
2508
- const [events, setEvents] = useState9([]);
2739
+ const [calls, setCalls] = useState10([]);
2740
+ const [results, setResults] = useState10([]);
2509
2741
  const watcherRef = useRef4(null);
2510
2742
  const sessions2 = session === null ? [] : Array.isArray(session) ? session : [session];
2511
2743
  const sessionKey = sessions2.map((s) => s.sessionId).sort().join(",");
2512
2744
  const sessionIdSet = new Set(sessions2.map((s) => s.sessionId));
2513
2745
  useEffect6(() => {
2514
- setEvents([]);
2746
+ setCalls([]);
2747
+ setResults([]);
2515
2748
  if (sessions2.length === 0) return;
2516
2749
  let cancelled = false;
2517
2750
  const loadExisting = async () => {
@@ -2520,25 +2753,32 @@ var useActivityStream = (session, allUsers) => {
2520
2753
  const allFiles = sessions2.flatMap((s) => s.outputFiles);
2521
2754
  const seen = /* @__PURE__ */ new Set();
2522
2755
  const existingCalls = [];
2756
+ const existingResults = [];
2523
2757
  for (const file of allFiles) {
2524
2758
  if (cancelled) return;
2525
2759
  if (seen.has(file)) continue;
2526
2760
  seen.add(file);
2527
- if (cancelled) return;
2528
- const calls = await tempWatcher.readExistingAsync(file);
2529
- existingCalls.push(...calls);
2761
+ const { calls: c, results: r } = await tempWatcher.readExistingWithResultsAsync(file);
2762
+ existingCalls.push(...c);
2763
+ existingResults.push(...r);
2530
2764
  }
2531
2765
  if (cancelled) return;
2532
2766
  existingCalls.sort((a, b) => a.timestamp - b.timestamp);
2533
- setEvents(existingCalls.slice(-MAX_EVENTS));
2767
+ setCalls(existingCalls.slice(-MAX_EVENTS));
2768
+ setResults(existingResults);
2534
2769
  };
2535
2770
  loadExisting();
2536
- const handler = (calls) => {
2537
- const matched = calls.filter((c) => sessionIdSet.has(c.sessionId));
2771
+ const callHandler = (newCalls) => {
2772
+ const matched = newCalls.filter((c) => sessionIdSet.has(c.sessionId));
2538
2773
  if (matched.length === 0) return;
2539
- setEvents((prev) => [...prev, ...matched].slice(-MAX_EVENTS));
2774
+ setCalls((prev) => [...prev, ...matched].slice(-MAX_EVENTS));
2540
2775
  };
2541
- const watcher = new Watcher(handler, allUsers);
2776
+ const resultHandler = (newResults) => {
2777
+ const matched = newResults.filter((r) => sessionIdSet.has(r.sessionId));
2778
+ if (matched.length === 0) return;
2779
+ setResults((prev) => [...prev, ...matched]);
2780
+ };
2781
+ const watcher = new Watcher(callHandler, allUsers, void 0, void 0, resultHandler);
2542
2782
  watcherRef.current = watcher;
2543
2783
  watcher.start();
2544
2784
  return () => {
@@ -2547,22 +2787,31 @@ var useActivityStream = (session, allUsers) => {
2547
2787
  watcherRef.current = null;
2548
2788
  };
2549
2789
  }, [sessionKey, allUsers]);
2550
- return events;
2790
+ return useMemo3(() => {
2791
+ const resultMap = /* @__PURE__ */ new Map();
2792
+ for (const r of results) {
2793
+ resultMap.set(r.toolUseId, r);
2794
+ }
2795
+ return calls.map((call) => ({
2796
+ call,
2797
+ result: call.toolUseId ? resultMap.get(call.toolUseId) : void 0
2798
+ }));
2799
+ }, [calls, results]);
2551
2800
  };
2552
2801
 
2553
2802
  // src/ui/hooks/useFilteredEvents.ts
2554
- import { useMemo as useMemo3 } from "react";
2803
+ import { useMemo as useMemo4 } from "react";
2555
2804
  var applyFilter = (events, filter) => {
2556
2805
  if (!filter) return events;
2557
2806
  const lower = filter.toLowerCase();
2558
2807
  return events.filter(
2559
- (e) => e.toolName.toLowerCase().includes(lower) || JSON.stringify(e.toolInput).toLowerCase().includes(lower)
2808
+ (e) => e.call.toolName.toLowerCase().includes(lower) || JSON.stringify(e.call.toolInput).toLowerCase().includes(lower)
2560
2809
  );
2561
2810
  };
2562
- var useFilteredEvents = (rawEvents, filter) => useMemo3(() => applyFilter(rawEvents, filter), [rawEvents, filter]);
2811
+ var useFilteredEvents = (rawEvents, filter) => useMemo4(() => applyFilter(rawEvents, filter), [rawEvents, filter]);
2563
2812
 
2564
2813
  // src/ui/hooks/useAlerts.ts
2565
- import { useState as useState10, useEffect as useEffect7, useRef as useRef5 } from "react";
2814
+ import { useState as useState11, useEffect as useEffect7, useRef as useRef5 } from "react";
2566
2815
 
2567
2816
  // src/notifications.ts
2568
2817
  import { exec as exec2 } from "child_process";
@@ -2630,7 +2879,7 @@ var AlertLogger = class {
2630
2879
  // src/ui/hooks/useAlerts.ts
2631
2880
  var MAX_ALERTS = 100;
2632
2881
  var useAlerts = (enabled, alertLevel, allUsers, config) => {
2633
- const [alerts, setAlerts] = useState10([]);
2882
+ const [alerts, setAlerts] = useState11([]);
2634
2883
  const engineRef = useRef5(new SecurityEngine(alertLevel));
2635
2884
  const watcherRef = useRef5(null);
2636
2885
  const loggerRef = useRef5(null);
@@ -2670,10 +2919,10 @@ var useAlerts = (enabled, alertLevel, allUsers, config) => {
2670
2919
  };
2671
2920
 
2672
2921
  // src/ui/hooks/useTextInput.ts
2673
- import { useState as useState11, useCallback as useCallback3 } from "react";
2922
+ import { useState as useState12, useCallback as useCallback3 } from "react";
2674
2923
  var useTextInput = (onConfirm, onCancel) => {
2675
- const [value, setValue] = useState11("");
2676
- const [isActive, setIsActive] = useState11(false);
2924
+ const [value, setValue] = useState12("");
2925
+ const [isActive, setIsActive] = useState12(false);
2677
2926
  const start = useCallback3((initial = "") => {
2678
2927
  setValue(initial);
2679
2928
  setIsActive(true);
@@ -2723,7 +2972,7 @@ var useTextInput = (onConfirm, onCancel) => {
2723
2972
  };
2724
2973
 
2725
2974
  // src/ui/hooks/useKeyHandler.ts
2726
- import { useInput as useInput8 } from "ink";
2975
+ import { useInput as useInput9 } from "ink";
2727
2976
  var matchKey = (binding, input, key) => {
2728
2977
  if (binding === "tab") return Boolean(key.tab);
2729
2978
  if (binding === "shift+tab") return Boolean(key.shift && key.tab);
@@ -2732,7 +2981,7 @@ var matchKey = (binding, input, key) => {
2732
2981
  };
2733
2982
  var useKeyHandler = (deps) => {
2734
2983
  const d = deps;
2735
- useInput8((input, key) => {
2984
+ useInput9((input, key) => {
2736
2985
  if (d.showSetup || d.showSettings || d.confirmAction) return;
2737
2986
  if (d.inputMode === "nickname") {
2738
2987
  d.nicknameInput.handleInput(input, key);
@@ -2755,6 +3004,10 @@ var useKeyHandler = (deps) => {
2755
3004
  d.exit();
2756
3005
  return;
2757
3006
  }
3007
+ if (d.showEventDetail) {
3008
+ if (key.escape || key.return || key.leftArrow) d.setShowEventDetail(false);
3009
+ return;
3010
+ }
2758
3011
  if (d.showDetail && !d.splitMode) {
2759
3012
  if (key.escape || key.return || key.leftArrow) d.setShowDetail(false);
2760
3013
  return;
@@ -2929,10 +3182,21 @@ var useKeyHandler = (deps) => {
2929
3182
  if (matchKey(d.kb.navUp, input, key) || key.upArrow) d.selectPrev();
2930
3183
  }
2931
3184
  if (d.activePanel === "activity") {
2932
- if (matchKey(d.kb.navUp, input, key) || key.upArrow) d.setActivityScroll((s) => Math.min(s + 1, d.maxScroll));
2933
- if (matchKey(d.kb.navDown, input, key) || key.downArrow) d.setActivityScroll((s) => Math.max(s - 1, 0));
2934
- if (matchKey(d.kb.scrollBottom, input, key)) d.setActivityScroll(0);
2935
- if (matchKey(d.kb.scrollTop, input, key)) d.setActivityScroll(d.maxScroll);
3185
+ if (matchKey(d.kb.navDown, input, key) || key.downArrow) {
3186
+ d.setSelectedEventIndex((i) => Math.min(i + 1, d.activityEventCount - 1));
3187
+ }
3188
+ if (matchKey(d.kb.navUp, input, key) || key.upArrow) {
3189
+ d.setSelectedEventIndex((i) => Math.max(i - 1, 0));
3190
+ }
3191
+ if (matchKey(d.kb.scrollBottom, input, key)) {
3192
+ d.setSelectedEventIndex(d.activityEventCount - 1);
3193
+ }
3194
+ if (matchKey(d.kb.scrollTop, input, key)) {
3195
+ d.setSelectedEventIndex(0);
3196
+ }
3197
+ if (matchKey(d.kb.detail, input, key) && d.activityEventCount > 0) {
3198
+ d.setShowEventDetail(true);
3199
+ }
2936
3200
  }
2937
3201
  if (d.activePanel === "left") {
2938
3202
  if (matchKey(d.kb.navUp, input, key) || key.upArrow) d.setLeftScroll((s) => Math.min(s + 1, d.leftMaxScroll));
@@ -2950,9 +3214,9 @@ var useKeyHandler = (deps) => {
2950
3214
  };
2951
3215
 
2952
3216
  // src/ui/hooks/useUpdateChecker.ts
2953
- import { useState as useState12, useEffect as useEffect8 } from "react";
3217
+ import { useState as useState13, useEffect as useEffect8 } from "react";
2954
3218
  var useUpdateChecker = (disabled, checkOnLaunch, checkInterval) => {
2955
- const [updateInfo, setUpdateInfo] = useState12(null);
3219
+ const [updateInfo, setUpdateInfo] = useState13(null);
2956
3220
  useEffect8(() => {
2957
3221
  if (disabled || !checkOnLaunch) return;
2958
3222
  let cancelled = false;
@@ -2973,7 +3237,7 @@ var useUpdateChecker = (disabled, checkOnLaunch, checkInterval) => {
2973
3237
  };
2974
3238
 
2975
3239
  // src/ui/hooks/useSetupFlow.ts
2976
- import { useState as useState13, useCallback as useCallback4 } from "react";
3240
+ import { useState as useState14, useCallback as useCallback4 } from "react";
2977
3241
 
2978
3242
  // src/hooks/installer.ts
2979
3243
  import { existsSync, readFileSync, writeFileSync, copyFileSync, mkdirSync as mkdirSync2, chmodSync } from "fs";
@@ -3093,12 +3357,12 @@ var installMcpConfig = () => {
3093
3357
 
3094
3358
  // src/ui/hooks/useSetupFlow.ts
3095
3359
  var useSetupFlow = (initialConfig, firstRun) => {
3096
- const [liveConfig, setLiveConfig] = useState13(initialConfig);
3097
- const [showSetup, setShowSetup] = useState13(firstRun);
3098
- const [showThemePicker, setShowThemePicker] = useState13(false);
3099
- const [showTour, setShowTour] = useState13(false);
3100
- const [showSettings, setShowSettings] = useState13(false);
3101
- const [showThemeMenu, setShowThemeMenu] = useState13(false);
3360
+ const [liveConfig, setLiveConfig] = useState14(initialConfig);
3361
+ const [showSetup, setShowSetup] = useState14(firstRun);
3362
+ const [showThemePicker, setShowThemePicker] = useState14(false);
3363
+ const [showTour, setShowTour] = useState14(false);
3364
+ const [showSettings, setShowSettings] = useState14(false);
3365
+ const [showThemeMenu, setShowThemeMenu] = useState14(false);
3102
3366
  const handleSettingsClose = useCallback4((c) => {
3103
3367
  setLiveConfig(c);
3104
3368
  saveConfig(c);
@@ -3189,17 +3453,17 @@ var useSetupFlow = (initialConfig, firstRun) => {
3189
3453
  };
3190
3454
 
3191
3455
  // src/ui/hooks/useSplitPanel.ts
3192
- import { useState as useState14, useCallback as useCallback5 } from "react";
3456
+ import { useState as useState15, useCallback as useCallback5 } from "react";
3193
3457
  var useSplitPanel = () => {
3194
- const [splitMode, setSplitMode] = useState14(false);
3195
- const [leftSession, setLeftSession] = useState14(null);
3196
- const [rightSession, setRightSession] = useState14(null);
3197
- const [leftScroll, setLeftScroll] = useState14(0);
3198
- const [rightScroll, setRightScroll] = useState14(0);
3199
- const [leftFilter, setLeftFilter] = useState14("");
3200
- const [rightFilter, setRightFilter] = useState14("");
3201
- const [leftShowDetail, setLeftShowDetail] = useState14(false);
3202
- const [rightShowDetail, setRightShowDetail] = useState14(false);
3458
+ const [splitMode, setSplitMode] = useState15(false);
3459
+ const [leftSession, setLeftSession] = useState15(null);
3460
+ const [rightSession, setRightSession] = useState15(null);
3461
+ const [leftScroll, setLeftScroll] = useState15(0);
3462
+ const [rightScroll, setRightScroll] = useState15(0);
3463
+ const [leftFilter, setLeftFilter] = useState15("");
3464
+ const [rightFilter, setRightFilter] = useState15("");
3465
+ const [leftShowDetail, setLeftShowDetail] = useState15(false);
3466
+ const [rightShowDetail, setRightShowDetail] = useState15(false);
3203
3467
  const clearSplitState = useCallback5(() => {
3204
3468
  setSplitMode(false);
3205
3469
  setLeftSession(null);
@@ -3265,7 +3529,7 @@ var useSplitPanel = () => {
3265
3529
  };
3266
3530
 
3267
3531
  // src/ui/App.tsx
3268
- import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
3532
+ import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
3269
3533
  var App = ({ options, config: initialConfig, version, firstRun }) => {
3270
3534
  const { exit } = useApp();
3271
3535
  const { stdout } = useStdout3();
@@ -3273,19 +3537,21 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
3273
3537
  const setup = useSetupFlow(initialConfig, firstRun);
3274
3538
  const split = useSplitPanel();
3275
3539
  const kb = setup.liveConfig.keybindings;
3276
- const [activePanel, setActivePanel] = useState15("sessions");
3277
- const [activityScroll, setActivityScroll] = useState15(0);
3278
- const [inputMode, setInputMode] = useState15("normal");
3279
- const [filter, setFilter] = useState15("");
3280
- const [activityFilter, setActivityFilter] = useState15("");
3281
- const [updateStatus, setUpdateStatus] = useState15("");
3282
- const [showDetail, setShowDetail] = useState15(false);
3283
- const [viewingArchive, setViewingArchive] = useState15(false);
3284
- const [confirmAction, setConfirmAction] = useState15(
3540
+ const [activePanel, setActivePanel] = useState16("sessions");
3541
+ const [activityScroll, setActivityScroll] = useState16(0);
3542
+ const [inputMode, setInputMode] = useState16("normal");
3543
+ const [filter, setFilter] = useState16("");
3544
+ const [activityFilter, setActivityFilter] = useState16("");
3545
+ const [updateStatus, setUpdateStatus] = useState16("");
3546
+ const [showDetail, setShowDetail] = useState16(false);
3547
+ const [viewingArchive, setViewingArchive] = useState16(false);
3548
+ const [confirmAction, setConfirmAction] = useState16(
3285
3549
  null
3286
3550
  );
3287
- const [archivedIds, setArchivedIds] = useState15(() => new Set(Object.keys(getArchived())));
3288
- const [sidebarWidth, setSidebarWidth] = useState15(() => initialConfig.sidebarWidth ?? 30);
3551
+ const [archivedIds, setArchivedIds] = useState16(() => new Set(Object.keys(getArchived())));
3552
+ const [sidebarWidth, setSidebarWidth] = useState16(() => initialConfig.sidebarWidth ?? 30);
3553
+ const [selectedEventIndex, setSelectedEventIndex] = useState16(0);
3554
+ const [showEventDetail, setShowEventDetail] = useState16(false);
3289
3555
  const refreshArchived = useCallback6(() => setArchivedIds(new Set(Object.keys(getArchived()))), []);
3290
3556
  const persistSidebarWidth = useCallback6((v) => {
3291
3557
  setSidebarWidth((prev) => {
@@ -3357,7 +3623,26 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
3357
3623
  }, []);
3358
3624
  useEffect9(() => {
3359
3625
  setActivityScroll(0);
3626
+ setSelectedEventIndex(0);
3627
+ setShowEventDetail(false);
3360
3628
  }, [selectedSession?.sessionId, selectedGroup?.key]);
3629
+ useEffect9(() => {
3630
+ const totalEvents = events.length;
3631
+ const vRows = termHeight - 3 - (options.noSecurity ? 0 : 6) - 1 - (inputMode !== "normal" ? 1 : 0) - 2;
3632
+ if (vRows <= 0 || totalEvents === 0) return;
3633
+ const start = Math.max(0, totalEvents - vRows - activityScroll);
3634
+ const end = start + vRows;
3635
+ if (selectedEventIndex < start) {
3636
+ setActivityScroll(totalEvents - vRows - selectedEventIndex);
3637
+ } else if (selectedEventIndex >= end) {
3638
+ setActivityScroll(totalEvents - vRows - (selectedEventIndex - vRows + 1));
3639
+ }
3640
+ }, [selectedEventIndex, events.length]);
3641
+ useEffect9(() => {
3642
+ if (events.length > 0 && selectedEventIndex >= events.length) {
3643
+ setSelectedEventIndex(events.length - 1);
3644
+ }
3645
+ }, [events.length]);
3361
3646
  const alertHeight = options.noSecurity ? 0 : 6;
3362
3647
  const mainHeight = termHeight - 3 - alertHeight - 1 - (inputMode !== "normal" ? 1 : 0);
3363
3648
  const viewportRows = mainHeight - 2;
@@ -3383,6 +3668,7 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
3383
3668
  showSetup: setup.showSetup,
3384
3669
  showSettings: setup.showSettings || setup.showThemeMenu || setup.showThemePicker || setup.showTour,
3385
3670
  showDetail,
3671
+ showEventDetail,
3386
3672
  leftShowDetail: split.leftShowDetail,
3387
3673
  rightShowDetail: split.rightShowDetail,
3388
3674
  confirmAction,
@@ -3403,6 +3689,8 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
3403
3689
  maxScroll: Math.max(0, events.length - viewportRows),
3404
3690
  leftMaxScroll: Math.max(0, leftEvents.length - viewportRows),
3405
3691
  rightMaxScroll: Math.max(0, rightEvents.length - viewportRows),
3692
+ activityEventCount: events.length,
3693
+ selectedEventIndex,
3406
3694
  exit,
3407
3695
  selectNext,
3408
3696
  selectPrev,
@@ -3428,6 +3716,8 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
3428
3716
  setLeftScroll: split.setLeftScroll,
3429
3717
  setRightScroll: split.setRightScroll,
3430
3718
  setActivityScroll,
3719
+ setSelectedEventIndex,
3720
+ setShowEventDetail,
3431
3721
  setConfirmAction,
3432
3722
  setUpdateStatus,
3433
3723
  setSidebarWidth: persistSidebarWidth,
@@ -3489,10 +3779,10 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
3489
3779
  setup.setShowSetup(false);
3490
3780
  return null;
3491
3781
  }
3492
- return /* @__PURE__ */ jsx15(SetupModal, { steps, onComplete: setup.handleSetupComplete });
3782
+ return /* @__PURE__ */ jsx16(SetupModal, { steps, onComplete: setup.handleSetupComplete });
3493
3783
  }
3494
3784
  if (setup.showThemePicker)
3495
- return /* @__PURE__ */ jsx15(
3785
+ return /* @__PURE__ */ jsx16(
3496
3786
  ThemePickerModal,
3497
3787
  {
3498
3788
  onSelect: setup.handleThemePickerSelect,
@@ -3500,10 +3790,10 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
3500
3790
  onDismiss: setup.handleThemePickerDismiss
3501
3791
  }
3502
3792
  );
3503
- if (setup.showTour) return /* @__PURE__ */ jsx15(GuidedTour, { onComplete: setup.handleTourComplete, onSkip: setup.handleTourSkip });
3504
- if (setup.showThemeMenu) return /* @__PURE__ */ jsx15(ThemeMenu, { config: setup.liveConfig, onClose: setup.handleThemeMenuClose });
3793
+ if (setup.showTour) return /* @__PURE__ */ jsx16(GuidedTour, { onComplete: setup.handleTourComplete, onSkip: setup.handleTourSkip });
3794
+ if (setup.showThemeMenu) return /* @__PURE__ */ jsx16(ThemeMenu, { config: setup.liveConfig, onClose: setup.handleThemeMenuClose });
3505
3795
  if (setup.showSettings)
3506
- return /* @__PURE__ */ jsx15(
3796
+ return /* @__PURE__ */ jsx16(
3507
3797
  SettingsMenu,
3508
3798
  {
3509
3799
  config: setup.liveConfig,
@@ -3512,7 +3802,7 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
3512
3802
  }
3513
3803
  );
3514
3804
  if (confirmAction) {
3515
- return /* @__PURE__ */ jsx15(Box15, { flexDirection: "column", height: termHeight, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsx15(
3805
+ return /* @__PURE__ */ jsx16(Box16, { flexDirection: "column", height: termHeight, justifyContent: "center", alignItems: "center", children: /* @__PURE__ */ jsx16(
3516
3806
  ConfirmModal,
3517
3807
  {
3518
3808
  title: confirmAction.title,
@@ -3524,7 +3814,8 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
3524
3814
  }
3525
3815
  const activitySlug = selectedGroup ? selectedGroup.key : selectedSession?.slug ?? null;
3526
3816
  const isMerged = selectedGroup !== null;
3527
- const rightPanel = split.splitMode ? /* @__PURE__ */ jsx15(
3817
+ const selectedEvent = events[selectedEventIndex];
3818
+ const rightPanel = split.splitMode ? /* @__PURE__ */ jsx16(
3528
3819
  SplitPanel,
3529
3820
  {
3530
3821
  activePanel,
@@ -3540,7 +3831,7 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
3540
3831
  rightShowDetail: split.rightShowDetail,
3541
3832
  height: mainHeight
3542
3833
  }
3543
- ) : showDetail && selectedSession ? /* @__PURE__ */ jsx15(SessionDetail, { session: selectedSession, focused: activePanel === "activity", height: mainHeight }) : /* @__PURE__ */ jsx15(
3834
+ ) : showEventDetail && selectedEvent ? /* @__PURE__ */ jsx16(ToolCallDetail, { event: selectedEvent, focused: activePanel === "activity", height: mainHeight }) : showDetail && selectedSession ? /* @__PURE__ */ jsx16(SessionDetail, { session: selectedSession, focused: activePanel === "activity", height: mainHeight }) : /* @__PURE__ */ jsx16(
3544
3835
  ActivityFeed,
3545
3836
  {
3546
3837
  events,
@@ -3552,13 +3843,14 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
3552
3843
  scrollOffset: activityScroll,
3553
3844
  filter: activityFilter || void 0,
3554
3845
  merged: isMerged,
3555
- mergedSessions: selectedGroup?.sessions
3846
+ mergedSessions: selectedGroup?.sessions,
3847
+ selectedEventIndex
3556
3848
  }
3557
3849
  );
3558
- return /* @__PURE__ */ jsxs15(Box15, { flexDirection: "column", height: termHeight, children: [
3559
- /* @__PURE__ */ jsx15(StatusBar, { sessionCount: sessions2.length, alertCount: alerts.length, version, updateInfo }),
3560
- /* @__PURE__ */ jsxs15(Box15, { flexGrow: 1, height: mainHeight, children: [
3561
- /* @__PURE__ */ jsx15(
3850
+ return /* @__PURE__ */ jsxs16(Box16, { flexDirection: "column", height: termHeight, children: [
3851
+ /* @__PURE__ */ jsx16(StatusBar, { sessionCount: sessions2.length, alertCount: alerts.length, version, updateInfo }),
3852
+ /* @__PURE__ */ jsxs16(Box16, { flexGrow: 1, height: mainHeight, children: [
3853
+ /* @__PURE__ */ jsx16(
3562
3854
  SessionList,
3563
3855
  {
3564
3856
  visibleItems,
@@ -3573,19 +3865,19 @@ var App = ({ options, config: initialConfig, version, firstRun }) => {
3573
3865
  ),
3574
3866
  rightPanel
3575
3867
  ] }),
3576
- !options.noSecurity && /* @__PURE__ */ jsx15(AlertBar, { alerts }),
3577
- inputMode === "nickname" && /* @__PURE__ */ jsxs15(Box15, { paddingX: 1, children: [
3578
- /* @__PURE__ */ jsx15(Text14, { color: colors.primary, children: "nickname: " }),
3579
- /* @__PURE__ */ jsx15(Text14, { color: colors.bright, children: nicknameInput.value }),
3580
- /* @__PURE__ */ jsx15(Text14, { color: colors.muted, children: "_" })
3868
+ !options.noSecurity && /* @__PURE__ */ jsx16(AlertBar, { alerts }),
3869
+ inputMode === "nickname" && /* @__PURE__ */ jsxs16(Box16, { paddingX: 1, children: [
3870
+ /* @__PURE__ */ jsx16(Text15, { color: colors.primary, children: "nickname: " }),
3871
+ /* @__PURE__ */ jsx16(Text15, { color: colors.bright, children: nicknameInput.value }),
3872
+ /* @__PURE__ */ jsx16(Text15, { color: colors.muted, children: "_" })
3581
3873
  ] }),
3582
- inputMode === "filter" && /* @__PURE__ */ jsxs15(Box15, { paddingX: 1, children: [
3583
- /* @__PURE__ */ jsx15(Text14, { color: colors.muted, children: activePanel === "sessions" ? "sessions" : activePanel === "left" ? "left" : activePanel === "right" ? "right" : "activity" }),
3584
- /* @__PURE__ */ jsx15(Text14, { color: colors.primary, children: "/" }),
3585
- /* @__PURE__ */ jsx15(Text14, { color: colors.bright, children: filterInput.value }),
3586
- /* @__PURE__ */ jsx15(Text14, { color: colors.muted, children: "_" })
3874
+ inputMode === "filter" && /* @__PURE__ */ jsxs16(Box16, { paddingX: 1, children: [
3875
+ /* @__PURE__ */ jsx16(Text15, { color: colors.muted, children: activePanel === "sessions" ? "sessions" : activePanel === "left" ? "left" : activePanel === "right" ? "right" : "activity" }),
3876
+ /* @__PURE__ */ jsx16(Text15, { color: colors.primary, children: "/" }),
3877
+ /* @__PURE__ */ jsx16(Text15, { color: colors.bright, children: filterInput.value }),
3878
+ /* @__PURE__ */ jsx16(Text15, { color: colors.muted, children: "_" })
3587
3879
  ] }),
3588
- inputMode === "normal" && /* @__PURE__ */ jsx15(
3880
+ inputMode === "normal" && /* @__PURE__ */ jsx16(
3589
3881
  FooterBar,
3590
3882
  {
3591
3883
  keybindings: kb,
@@ -3831,7 +4123,7 @@ var main = () => {
3831
4123
  if (options.noUpdates) config.updates.checkOnLaunch = false;
3832
4124
  if (options.noSecurity) config.security.enabled = false;
3833
4125
  if (firstRun) saveConfig(config);
3834
- render(React16.createElement(App, { options, config, version: VERSION, firstRun }));
4126
+ render(React17.createElement(App, { options, config, version: VERSION, firstRun }));
3835
4127
  };
3836
4128
  main();
3837
4129
  //# sourceMappingURL=index.js.map