reevesagents 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,30 +1,32 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
+ buildOnboardingState,
3
4
  readTuiOpenToken
4
- } from "./chunk-PEOJCUQI.js";
5
+ } from "./chunk-ICFJOMFZ.js";
6
+ import {
7
+ sweepAgentsThrottled
8
+ } from "./chunk-7YW57CWK.js";
5
9
  import {
6
10
  translate,
7
11
  translatePhrase
8
- } from "./chunk-BELIYZTN.js";
12
+ } from "./chunk-J2DD52HJ.js";
9
13
  import {
10
14
  modelDisplayName,
11
15
  modelValuesForProvider
12
- } from "./chunk-NJWOKVBZ.js";
16
+ } from "./chunk-WDJ6RTES.js";
13
17
  import {
14
18
  REEVESAGENTS_VERSION,
15
- attach,
16
- attachAll,
17
- detach,
18
- hostStatus,
19
19
  listRunApprovals,
20
20
  resolveRunApproval
21
- } from "./chunk-EX5LH2KW.js";
21
+ } from "./chunk-VYLFTVIQ.js";
22
22
  import {
23
23
  CONFIG_FIELDS,
24
24
  DEFAULT_LANGUAGE,
25
25
  LANGUAGE_OPTIONS,
26
26
  PROVIDERS,
27
27
  archiveAndRemoveRun,
28
+ attach,
29
+ attachAll,
28
30
  autoCleanupRuns,
29
31
  coerceExtraArgs,
30
32
  colors,
@@ -34,8 +36,10 @@ import {
34
36
  deleteAgent,
35
37
  deletePreset,
36
38
  deleteRunHistory,
39
+ detach,
37
40
  detectAvailable,
38
41
  findAgent,
42
+ hostStatus,
39
43
  killAgent,
40
44
  languageOption,
41
45
  listAgents,
@@ -69,14 +73,14 @@ import {
69
73
  startRunFromPreset,
70
74
  stateRoot,
71
75
  stopRun
72
- } from "./chunk-KL5YFLQF.js";
76
+ } from "./chunk-T7SPF4ZP.js";
73
77
  import "./chunk-D24DQQ6V.js";
74
78
  import {
75
79
  startWebFromTui
76
- } from "./chunk-33EB4RUP.js";
80
+ } from "./chunk-S4JLBMK4.js";
77
81
 
78
82
  // src/tui/router.tsx
79
- import { createContext as createContext6, useContext as useContext6, useState as useState36, useCallback as useCallback5, useEffect as useEffect17, useRef as useRef4 } from "react";
83
+ import { createContext as createContext6, useContext as useContext6, useState as useState37, useCallback as useCallback5, useEffect as useEffect17, useRef as useRef4 } from "react";
80
84
  import { useApp as useApp3 } from "ink";
81
85
 
82
86
  // src/tui/contexts/ToastContext.tsx
@@ -714,8 +718,9 @@ function LanguageSelect() {
714
718
  const visibleOptions = LANGUAGE_OPTIONS.slice(firstVisible, firstVisible + visibleLanguageCount);
715
719
  function choose() {
716
720
  const option = LANGUAGE_OPTIONS[selectedIdx] ?? LANGUAGE_OPTIONS[0];
721
+ const firstRun = !configExists();
717
722
  setLanguage(option.code);
718
- replace("Welcome");
723
+ replace(firstRun ? "Setup" : "Welcome");
719
724
  }
720
725
  useInput((_input, key) => {
721
726
  if (key.upArrow) {
@@ -1137,6 +1142,7 @@ function Runs() {
1137
1142
  const [selectedIdx, setSelectedIdx] = useState8(0);
1138
1143
  const [runScroll, setRunScroll] = useState8(0);
1139
1144
  function refresh() {
1145
+ sweepAgentsThrottled();
1140
1146
  autoCleanupRuns();
1141
1147
  const next = listRuns();
1142
1148
  setRuns((prev) => {
@@ -4974,19 +4980,20 @@ function Settings() {
4974
4980
  const { language, setLanguage, t } = useLanguage();
4975
4981
  const { rows: termRows } = useWindowSize17();
4976
4982
  const bodyRows = frameBodyRows(termRows, true, true);
4977
- const nonCompactRows = PROVIDERS.length + LANGUAGE_OPTIONS.length + 3 + 4 + 8;
4983
+ const nonCompactRows = PROVIDERS.length + LANGUAGE_OPTIONS.length + 3 + 5 + 8;
4978
4984
  const compactBody = bodyRows < nonCompactRows;
4979
4985
  const showCompactStatePaths = compactBody && bodyRows >= 10;
4980
4986
  const [selectedIdx, setSelectedIdx] = useState27(0);
4981
4987
  const [refreshKey, setRefreshKey] = useState27(0);
4982
4988
  const available = useMemo8(() => detectAvailable(), [refreshKey]);
4983
- const actionLabelWidth = Math.max(t("settings.recheck").length, t("settings.showConfig").length, t("settings.editConfig").length, t("common.back").length);
4989
+ const actionLabelWidth = Math.max(t("welcome.setup").length, t("settings.recheck").length, t("settings.showConfig").length, t("settings.editConfig").length, t("common.back").length);
4984
4990
  const rows = [
4985
4991
  ...PROVIDERS.map((p) => ({ type: "provider", id: p, provider: p, selectable: true })),
4986
4992
  ...LANGUAGE_OPTIONS.map((option) => ({ type: "language", id: `language-${option.code}`, language: option.code, selectable: true })),
4987
4993
  { type: "statePath", id: "state", selectable: false },
4988
4994
  { type: "statePath", id: "runs", selectable: false },
4989
4995
  { type: "statePath", id: "presets", selectable: false },
4996
+ { type: "action", id: "setup", selectable: true },
4990
4997
  { type: "action", id: "recheck", selectable: true },
4991
4998
  { type: "action", id: "showConfig", selectable: true },
4992
4999
  { type: "action", id: "editConfig", selectable: true },
@@ -5009,6 +5016,10 @@ function Settings() {
5009
5016
  async function activate() {
5010
5017
  const row = selectableRows[currentIdx];
5011
5018
  if (!row) return;
5019
+ if (row.id === "setup") {
5020
+ push("Setup");
5021
+ return;
5022
+ }
5012
5023
  if (row.id === "recheck") {
5013
5024
  setRefreshKey((k) => k + 1);
5014
5025
  return;
@@ -5102,6 +5113,7 @@ function Settings() {
5102
5113
  );
5103
5114
  }
5104
5115
  const actionLabels = {
5116
+ setup: { primary: t("welcome.setup"), hint: t("welcome.setupHint") },
5105
5117
  recheck: { primary: t("settings.recheck"), hint: t("settings.recheckHint") },
5106
5118
  showConfig: { primary: t("settings.showConfig"), hint: t("settings.showConfigHint") },
5107
5119
  editConfig: { primary: t("settings.editConfig"), hint: t("settings.editConfigHint") },
@@ -5201,6 +5213,15 @@ function Settings() {
5201
5213
  ),
5202
5214
  /* @__PURE__ */ jsx43(SectionEnd, {}),
5203
5215
  /* @__PURE__ */ jsx43(Section, { label: t("common.actions") }),
5216
+ /* @__PURE__ */ jsx43(
5217
+ Row,
5218
+ {
5219
+ selected: selectedIdx === rows.findIndex((r) => r.id === "setup"),
5220
+ primary: t("welcome.setup"),
5221
+ primaryWidth: actionLabelWidth,
5222
+ hint: t("welcome.setupHint")
5223
+ }
5224
+ ),
5204
5225
  /* @__PURE__ */ jsx43(
5205
5226
  Row,
5206
5227
  {
@@ -5301,18 +5322,20 @@ function AgentControl() {
5301
5322
  }
5302
5323
  function toggleHost(host) {
5303
5324
  if (host.manual || !host.installed) return;
5304
- const res = host.attached ? detach(host.key) : attach(host.key);
5305
- setResult(res);
5325
+ const wasAttached = host.attached;
5326
+ const res = wasAttached ? detach(host.key) : attach(host.key);
5327
+ setResult(!wasAttached && res.ok ? { ...res, message: `${res.message} \u2014 ${t("agentControl.restartHint")}` } : res);
5306
5328
  setRefreshKey((k) => k + 1);
5307
5329
  }
5308
5330
  function runAttachAll() {
5309
5331
  const results = attachAll();
5310
5332
  const ok = results.filter((r) => r.ok).length;
5333
+ const toast = t("agentControl.attachAllToast", { ok, total: results.length });
5311
5334
  setResult({
5312
5335
  key: "all",
5313
5336
  label: t("agentControl.attachAll"),
5314
5337
  ok: results.every((r) => r.ok),
5315
- message: t("agentControl.attachAllToast", { ok, total: results.length })
5338
+ message: ok > 0 ? `${toast} \u2014 ${t("agentControl.restartHint")}` : toast
5316
5339
  });
5317
5340
  setRefreshKey((k) => k + 1);
5318
5341
  }
@@ -5430,10 +5453,92 @@ function AgentControl() {
5430
5453
  );
5431
5454
  }
5432
5455
 
5456
+ // src/tui/screens/Setup.tsx
5457
+ import { useMemo as useMemo10, useState as useState29 } from "react";
5458
+ import { Box as Box32, Text as Text28, useInput as useInput24 } from "ink";
5459
+ import { jsx as jsx46, jsxs as jsxs37 } from "react/jsx-runtime";
5460
+ function Setup() {
5461
+ const { push, replace, pop, canBack } = useRouter();
5462
+ const { t } = useLanguage();
5463
+ const [refreshKey, setRefreshKey] = useState29(0);
5464
+ const [selectedIdx, setSelectedIdx] = useState29(0);
5465
+ const [toast, setToast] = useState29(null);
5466
+ const state = useMemo10(() => buildOnboardingState(), [refreshKey]);
5467
+ function leave() {
5468
+ if (canBack) pop();
5469
+ else replace("Welcome");
5470
+ }
5471
+ const actions = [];
5472
+ if (state.attachable.length > 0) {
5473
+ actions.push({
5474
+ key: "connect",
5475
+ label: t("setup.connectAll"),
5476
+ hint: t("setup.connectAllHint"),
5477
+ run: () => {
5478
+ const results = attachAll();
5479
+ const ok = results.filter((result) => result.ok).length;
5480
+ setToast(t("setup.connectedToast", { ok, total: results.length }));
5481
+ setRefreshKey((key) => key + 1);
5482
+ }
5483
+ });
5484
+ }
5485
+ actions.push({ key: "hosts", label: t("setup.manageHosts"), hint: t("setup.manageHostsHint"), run: () => push("AgentControl") });
5486
+ actions.push({ key: "run", label: t("setup.startRun"), hint: t("setup.startRunHint"), run: () => push("NewRun") });
5487
+ actions.push({ key: "done", label: t("setup.done"), hint: t("setup.doneHint"), run: leave });
5488
+ const maxIdx = actions.length - 1;
5489
+ useInput24((_input, key) => {
5490
+ if (key.upArrow) {
5491
+ setSelectedIdx((idx) => Math.max(0, idx - 1));
5492
+ return;
5493
+ }
5494
+ if (key.downArrow) {
5495
+ setSelectedIdx((idx) => Math.min(maxIdx, idx + 1));
5496
+ return;
5497
+ }
5498
+ if (key.return) {
5499
+ actions[Math.min(selectedIdx, maxIdx)]?.run();
5500
+ return;
5501
+ }
5502
+ if (key.escape) {
5503
+ leave();
5504
+ return;
5505
+ }
5506
+ });
5507
+ const providersText = state.installedProviders.length > 0 ? state.installedProviders.map(providerDisplayName).join(", ") : t("setup.noProviders");
5508
+ return /* @__PURE__ */ jsx46(
5509
+ Frame,
5510
+ {
5511
+ breadcrumb: ["ReevesAgents", t("setup.title")],
5512
+ tagline: t("setup.subtitle"),
5513
+ statusKeys: t("setup.status"),
5514
+ children: /* @__PURE__ */ jsxs37(Box32, { flexDirection: "column", children: [
5515
+ /* @__PURE__ */ jsx46(Text28, { color: colors.text.dim, wrap: "truncate-end", children: t("setup.intro") }),
5516
+ /* @__PURE__ */ jsx46(Section, { label: t("setup.environment") }),
5517
+ /* @__PURE__ */ jsx46(Row, { selected: false, disabled: true, primary: "tmux", primaryWidth: 12, hint: state.tmuxOk ? t("setup.ok") : t("setup.tmuxMissing") }),
5518
+ /* @__PURE__ */ jsx46(Row, { selected: false, disabled: true, primary: "node", primaryWidth: 12, hint: state.nodeOk ? t("setup.ok") : t("setup.nodeOld") }),
5519
+ /* @__PURE__ */ jsx46(Row, { selected: false, disabled: true, primary: t("setup.providersLabel"), primaryWidth: 12, hint: providersText }),
5520
+ /* @__PURE__ */ jsx46(Section, { label: t("setup.actions") }),
5521
+ actions.map((action, idx) => /* @__PURE__ */ jsx46(
5522
+ Row,
5523
+ {
5524
+ selected: selectedIdx === idx,
5525
+ primary: action.label,
5526
+ primaryWidth: 26,
5527
+ hint: action.hint
5528
+ },
5529
+ action.key
5530
+ )),
5531
+ toast && /* @__PURE__ */ jsx46(Text28, { color: colors.status.ok, wrap: "truncate-end", children: toast }),
5532
+ /* @__PURE__ */ jsx46(SectionEnd, {})
5533
+ ] })
5534
+ }
5535
+ );
5536
+ }
5537
+
5433
5538
  // src/tui/screens/Reference.tsx
5434
- import { useState as useState29 } from "react";
5435
- import { useInput as useInput24, useWindowSize as useWindowSize19 } from "ink";
5436
- import { Fragment as Fragment12, jsx as jsx46, jsxs as jsxs37 } from "react/jsx-runtime";
5539
+ import { useState as useState30 } from "react";
5540
+ import { useInput as useInput25, useWindowSize as useWindowSize19 } from "ink";
5541
+ import { Fragment as Fragment12, jsx as jsx47, jsxs as jsxs38 } from "react/jsx-runtime";
5437
5542
  var CONTENT = [
5438
5543
  { type: "section", label: "TUI Pages" },
5439
5544
  { type: "row", primary: "Welcome", trailing: "main menu, current run, reference, credits" },
@@ -5462,8 +5567,8 @@ function Reference() {
5462
5567
  const compactBody = bodyRows <= 10;
5463
5568
  const visibleCount = Math.max(1, compactBody ? bodyRows - 3 : bodyRows - 5);
5464
5569
  const maxScroll = Math.max(0, CONTENT.length - visibleCount);
5465
- const [scroll, setScroll] = useState29(0);
5466
- useInput24((_input, key) => {
5570
+ const [scroll, setScroll] = useState30(0);
5571
+ useInput25((_input, key) => {
5467
5572
  if (key.upArrow) {
5468
5573
  setScroll((value) => Math.max(0, value - 1));
5469
5574
  return;
@@ -5480,25 +5585,25 @@ function Reference() {
5480
5585
  let openSection = false;
5481
5586
  visible.forEach((item, idx) => {
5482
5587
  if (item.type === "section") {
5483
- if (openSection) contentRows.push(/* @__PURE__ */ jsx46(SectionEnd, {}, `end-${idx}`));
5484
- contentRows.push(/* @__PURE__ */ jsx46(Section, { label: item.label }, `${item.label}-${idx}`));
5588
+ if (openSection) contentRows.push(/* @__PURE__ */ jsx47(SectionEnd, {}, `end-${idx}`));
5589
+ contentRows.push(/* @__PURE__ */ jsx47(Section, { label: item.label }, `${item.label}-${idx}`));
5485
5590
  openSection = true;
5486
5591
  return;
5487
5592
  }
5488
- contentRows.push(/* @__PURE__ */ jsx46(Row, { selected: false, primary: item.primary, trailing: item.trailing }, `${item.primary}-${idx}`));
5593
+ contentRows.push(/* @__PURE__ */ jsx47(Row, { selected: false, primary: item.primary, trailing: item.trailing }, `${item.primary}-${idx}`));
5489
5594
  });
5490
- if (openSection) contentRows.push(/* @__PURE__ */ jsx46(SectionEnd, {}, "end-visible"));
5491
- return /* @__PURE__ */ jsx46(
5595
+ if (openSection) contentRows.push(/* @__PURE__ */ jsx47(SectionEnd, {}, "end-visible"));
5596
+ return /* @__PURE__ */ jsx47(
5492
5597
  Frame,
5493
5598
  {
5494
5599
  breadcrumb: ["ReevesAgents", "Reference"],
5495
5600
  tagline: "Quick map of run mode, command line, tmux workflow, and roles.",
5496
5601
  statusContext,
5497
5602
  statusKeys: maxScroll > 0 ? "\u2191\u2193 scroll \xB7 enter back \xB7 esc back" : "enter back \xB7 esc back",
5498
- children: compactBody ? /* @__PURE__ */ jsxs37(Fragment12, { children: [
5499
- /* @__PURE__ */ jsx46(Section, { label: "Reference" }),
5500
- visible.map((item, idx) => item.type === "section" ? /* @__PURE__ */ jsx46(Row, { selected: false, primary: item.label, disabled: true }, `${item.label}-${idx}`) : /* @__PURE__ */ jsx46(Row, { selected: false, primary: item.primary, trailing: item.trailing }, `${item.primary}-${idx}`)),
5501
- maxScroll > 0 && /* @__PURE__ */ jsx46(
5603
+ children: compactBody ? /* @__PURE__ */ jsxs38(Fragment12, { children: [
5604
+ /* @__PURE__ */ jsx47(Section, { label: "Reference" }),
5605
+ visible.map((item, idx) => item.type === "section" ? /* @__PURE__ */ jsx47(Row, { selected: false, primary: item.label, disabled: true }, `${item.label}-${idx}`) : /* @__PURE__ */ jsx47(Row, { selected: false, primary: item.primary, trailing: item.trailing }, `${item.primary}-${idx}`)),
5606
+ maxScroll > 0 && /* @__PURE__ */ jsx47(
5502
5607
  Row,
5503
5608
  {
5504
5609
  selected: false,
@@ -5507,21 +5612,21 @@ function Reference() {
5507
5612
  disabled: true
5508
5613
  }
5509
5614
  ),
5510
- /* @__PURE__ */ jsx46(SectionEnd, {})
5511
- ] }) : /* @__PURE__ */ jsxs37(Fragment12, { children: [
5615
+ /* @__PURE__ */ jsx47(SectionEnd, {})
5616
+ ] }) : /* @__PURE__ */ jsxs38(Fragment12, { children: [
5512
5617
  contentRows,
5513
- /* @__PURE__ */ jsx46(Section, { label: "Actions" }),
5514
- /* @__PURE__ */ jsx46(Row, { selected: true, primary: "Back", hint: "return to previous page" }),
5515
- /* @__PURE__ */ jsx46(SectionEnd, {})
5618
+ /* @__PURE__ */ jsx47(Section, { label: "Actions" }),
5619
+ /* @__PURE__ */ jsx47(Row, { selected: true, primary: "Back", hint: "return to previous page" }),
5620
+ /* @__PURE__ */ jsx47(SectionEnd, {})
5516
5621
  ] })
5517
5622
  }
5518
5623
  );
5519
5624
  }
5520
5625
 
5521
5626
  // src/tui/screens/Credits.tsx
5522
- import { useState as useState30 } from "react";
5523
- import { Box as Box32, useInput as useInput25, useWindowSize as useWindowSize20 } from "ink";
5524
- import { Fragment as Fragment13, jsx as jsx47, jsxs as jsxs38 } from "react/jsx-runtime";
5627
+ import { useState as useState31 } from "react";
5628
+ import { Box as Box33, useInput as useInput26, useWindowSize as useWindowSize20 } from "ink";
5629
+ import { Fragment as Fragment13, jsx as jsx48, jsxs as jsxs39 } from "react/jsx-runtime";
5525
5630
  function Credits() {
5526
5631
  const { pop } = useRouter();
5527
5632
  const { t } = useLanguage();
@@ -5539,10 +5644,10 @@ function Credits() {
5539
5644
  { primary: "Repository", trailing: "See package metadata" }
5540
5645
  ];
5541
5646
  const visibleCount = Math.max(1, bodyRows - (compactBody ? 3 : 6));
5542
- const [scroll, setScroll] = useState30(0);
5647
+ const [scroll, setScroll] = useState31(0);
5543
5648
  const maxScroll = Math.max(0, content.length - visibleCount);
5544
5649
  const visible = content.slice(scroll, scroll + visibleCount);
5545
- useInput25((_input, key) => {
5650
+ useInput26((_input, key) => {
5546
5651
  if (key.upArrow) {
5547
5652
  setScroll((value) => Math.max(0, value - 1));
5548
5653
  return;
@@ -5553,17 +5658,17 @@ function Credits() {
5553
5658
  }
5554
5659
  if (key.return || key.escape || key.backspace) pop();
5555
5660
  });
5556
- return /* @__PURE__ */ jsx47(
5661
+ return /* @__PURE__ */ jsx48(
5557
5662
  Frame,
5558
5663
  {
5559
5664
  breadcrumb: ["ReevesAgents", "Credits"],
5560
5665
  tagline: "About this local tmux-first workspace manager.",
5561
5666
  statusContext: `ReevesAgents ${REEVESAGENTS_VERSION}`,
5562
5667
  statusKeys: "enter back \xB7 esc back",
5563
- children: /* @__PURE__ */ jsxs38(Box32, { flexDirection: "column", children: [
5564
- /* @__PURE__ */ jsx47(Section, { label: "Credits" }),
5565
- visible.map((item) => /* @__PURE__ */ jsx47(Row, { selected: false, primary: item.primary, trailing: item.trailing }, item.primary)),
5566
- maxScroll > 0 && /* @__PURE__ */ jsx47(
5668
+ children: /* @__PURE__ */ jsxs39(Box33, { flexDirection: "column", children: [
5669
+ /* @__PURE__ */ jsx48(Section, { label: "Credits" }),
5670
+ visible.map((item) => /* @__PURE__ */ jsx48(Row, { selected: false, primary: item.primary, trailing: item.trailing }, item.primary)),
5671
+ maxScroll > 0 && /* @__PURE__ */ jsx48(
5567
5672
  Row,
5568
5673
  {
5569
5674
  selected: false,
@@ -5572,11 +5677,11 @@ function Credits() {
5572
5677
  disabled: true
5573
5678
  }
5574
5679
  ),
5575
- /* @__PURE__ */ jsx47(SectionEnd, {}),
5576
- !compactBody && /* @__PURE__ */ jsxs38(Fragment13, { children: [
5577
- /* @__PURE__ */ jsx47(Section, { label: "Actions" }),
5578
- /* @__PURE__ */ jsx47(Row, { selected: true, primary: "Back", hint: "return to main menu" }),
5579
- /* @__PURE__ */ jsx47(SectionEnd, {})
5680
+ /* @__PURE__ */ jsx48(SectionEnd, {}),
5681
+ !compactBody && /* @__PURE__ */ jsxs39(Fragment13, { children: [
5682
+ /* @__PURE__ */ jsx48(Section, { label: "Actions" }),
5683
+ /* @__PURE__ */ jsx48(Row, { selected: true, primary: "Back", hint: "return to main menu" }),
5684
+ /* @__PURE__ */ jsx48(SectionEnd, {})
5580
5685
  ] })
5581
5686
  ] })
5582
5687
  }
@@ -5584,9 +5689,9 @@ function Credits() {
5584
5689
  }
5585
5690
 
5586
5691
  // src/tui/screens/Doctor.tsx
5587
- import { useEffect as useEffect13, useMemo as useMemo10, useState as useState31 } from "react";
5588
- import { Box as Box33, useInput as useInput26, useWindowSize as useWindowSize21 } from "ink";
5589
- import { Fragment as Fragment14, jsx as jsx48, jsxs as jsxs39 } from "react/jsx-runtime";
5692
+ import { useEffect as useEffect13, useMemo as useMemo11, useState as useState32 } from "react";
5693
+ import { Box as Box34, useInput as useInput27, useWindowSize as useWindowSize21 } from "ink";
5694
+ import { Fragment as Fragment14, jsx as jsx49, jsxs as jsxs40 } from "react/jsx-runtime";
5590
5695
  var CHROME_ROWS5 = 17;
5591
5696
  function statusGlyph4(status) {
5592
5697
  if (status === "ok") return { char: glyphs.status.ok, color: colors.status.ok };
@@ -5600,11 +5705,11 @@ function Doctor() {
5600
5705
  const bodyRows = frameBodyRows(termRows, true, true);
5601
5706
  const compactBody = bodyRows <= 10;
5602
5707
  const pageSize = Math.max(1, compactBody ? bodyRows - 3 : Math.min(termRows - CHROME_ROWS5, bodyRows - 7));
5603
- const [selectedIdx, setSelectedIdx] = useState31(0);
5604
- const [refreshKey, setRefreshKey] = useState31(0);
5605
- const [isSpinning, setIsSpinning] = useState31(false);
5606
- const [page, setPage] = useState31(1);
5607
- const result = useMemo10(() => runDoctor(), [refreshKey]);
5708
+ const [selectedIdx, setSelectedIdx] = useState32(0);
5709
+ const [refreshKey, setRefreshKey] = useState32(0);
5710
+ const [isSpinning, setIsSpinning] = useState32(false);
5711
+ const [page, setPage] = useState32(1);
5712
+ const result = useMemo11(() => runDoctor(), [refreshKey]);
5608
5713
  const checks = result.checks;
5609
5714
  const counts = {
5610
5715
  ok: checks.filter((c) => c.status === "ok").length,
@@ -5641,7 +5746,7 @@ function Doctor() {
5641
5746
  setIsSpinning(false);
5642
5747
  }, 200);
5643
5748
  };
5644
- useInput26((_input, key) => {
5749
+ useInput27((_input, key) => {
5645
5750
  if (key.escape || key.backspace) {
5646
5751
  pop();
5647
5752
  return;
@@ -5671,7 +5776,7 @@ function Doctor() {
5671
5776
  }
5672
5777
  }
5673
5778
  });
5674
- return /* @__PURE__ */ jsx48(
5779
+ return /* @__PURE__ */ jsx49(
5675
5780
  Frame,
5676
5781
  {
5677
5782
  breadcrumb: ["ReevesAgents", "Doctor"],
@@ -5682,12 +5787,12 @@ function Doctor() {
5682
5787
  ],
5683
5788
  tagline: "Setup and environment health for TUI, CLI, Web UI, and tmux.",
5684
5789
  statusContext: selectedCheck ? `${selectedCheck.name}: ${selectedCheck.detail}` : "",
5685
- children: compactBody ? /* @__PURE__ */ jsxs39(Primary, { children: [
5686
- /* @__PURE__ */ jsx48(Section, { label: selectedIdx < pagedChecks.length ? "Checks" : "Actions" }),
5687
- isSpinning ? /* @__PURE__ */ jsx48(Spinner, { label: translatePhrase(language, "checking..."), color: colors.accent.bright }) : compactEntryIndexes.map((idx) => {
5790
+ children: compactBody ? /* @__PURE__ */ jsxs40(Primary, { children: [
5791
+ /* @__PURE__ */ jsx49(Section, { label: selectedIdx < pagedChecks.length ? "Checks" : "Actions" }),
5792
+ isSpinning ? /* @__PURE__ */ jsx49(Spinner, { label: translatePhrase(language, "checking..."), color: colors.accent.bright }) : compactEntryIndexes.map((idx) => {
5688
5793
  if (idx < pagedChecks.length) {
5689
5794
  const check = pagedChecks[idx];
5690
- return /* @__PURE__ */ jsx48(
5795
+ return /* @__PURE__ */ jsx49(
5691
5796
  Row,
5692
5797
  {
5693
5798
  selected: idx === selectedIdx,
@@ -5700,7 +5805,7 @@ function Doctor() {
5700
5805
  );
5701
5806
  }
5702
5807
  if (totalPages > 1 && idx === pagedChecks.length) {
5703
- return /* @__PURE__ */ jsx48(
5808
+ return /* @__PURE__ */ jsx49(
5704
5809
  Pagination,
5705
5810
  {
5706
5811
  page,
@@ -5713,14 +5818,14 @@ function Doctor() {
5713
5818
  );
5714
5819
  }
5715
5820
  if (idx === actionOffset) {
5716
- return /* @__PURE__ */ jsx48(Row, { selected: selectedIdx === actionOffset, primary: "Recheck", primaryWidth: checkLabelWidth, hint: "run doctor again" }, "recheck");
5821
+ return /* @__PURE__ */ jsx49(Row, { selected: selectedIdx === actionOffset, primary: "Recheck", primaryWidth: checkLabelWidth, hint: "run doctor again" }, "recheck");
5717
5822
  }
5718
- return /* @__PURE__ */ jsx48(Row, { selected: selectedIdx === actionOffset + 1, primary: "Back", primaryWidth: checkLabelWidth, hint: "return to previous page" }, "back");
5823
+ return /* @__PURE__ */ jsx49(Row, { selected: selectedIdx === actionOffset + 1, primary: "Back", primaryWidth: checkLabelWidth, hint: "return to previous page" }, "back");
5719
5824
  }),
5720
- /* @__PURE__ */ jsx48(SectionEnd, {})
5721
- ] }) : /* @__PURE__ */ jsxs39(Primary, { children: [
5722
- isSpinning && /* @__PURE__ */ jsx48(Spinner, { label: translatePhrase(language, "checking..."), color: colors.accent.bright }),
5723
- !isSpinning && pagedChecks.map((check, idx) => /* @__PURE__ */ jsx48(
5825
+ /* @__PURE__ */ jsx49(SectionEnd, {})
5826
+ ] }) : /* @__PURE__ */ jsxs40(Primary, { children: [
5827
+ isSpinning && /* @__PURE__ */ jsx49(Spinner, { label: translatePhrase(language, "checking..."), color: colors.accent.bright }),
5828
+ !isSpinning && pagedChecks.map((check, idx) => /* @__PURE__ */ jsx49(
5724
5829
  Row,
5725
5830
  {
5726
5831
  selected: idx === selectedIdx,
@@ -5731,7 +5836,7 @@ function Doctor() {
5731
5836
  },
5732
5837
  check.name
5733
5838
  )),
5734
- !isSpinning && totalPages > 1 && /* @__PURE__ */ jsx48(
5839
+ !isSpinning && totalPages > 1 && /* @__PURE__ */ jsx49(
5735
5840
  Pagination,
5736
5841
  {
5737
5842
  page,
@@ -5741,9 +5846,9 @@ function Doctor() {
5741
5846
  onNext: () => setPage((p) => Math.min(totalPages, p + 1))
5742
5847
  }
5743
5848
  ),
5744
- !isSpinning && /* @__PURE__ */ jsxs39(Fragment14, { children: [
5745
- /* @__PURE__ */ jsx48(Box33, { marginTop: 1 }),
5746
- /* @__PURE__ */ jsx48(
5849
+ !isSpinning && /* @__PURE__ */ jsxs40(Fragment14, { children: [
5850
+ /* @__PURE__ */ jsx49(Box34, { marginTop: 1 }),
5851
+ /* @__PURE__ */ jsx49(
5747
5852
  Legend,
5748
5853
  {
5749
5854
  items: [
@@ -5754,20 +5859,20 @@ function Doctor() {
5754
5859
  }
5755
5860
  )
5756
5861
  ] }),
5757
- /* @__PURE__ */ jsx48(Box33, { marginTop: 1 }),
5758
- /* @__PURE__ */ jsx48(Section, { label: "Actions" }),
5759
- /* @__PURE__ */ jsx48(Row, { selected: selectedIdx === actionOffset, primary: "Recheck", primaryWidth: checkLabelWidth, hint: "run doctor again" }),
5760
- /* @__PURE__ */ jsx48(Row, { selected: selectedIdx === actionOffset + 1, primary: "Back", primaryWidth: checkLabelWidth, hint: "return to previous page" }),
5761
- /* @__PURE__ */ jsx48(SectionEnd, {})
5862
+ /* @__PURE__ */ jsx49(Box34, { marginTop: 1 }),
5863
+ /* @__PURE__ */ jsx49(Section, { label: "Actions" }),
5864
+ /* @__PURE__ */ jsx49(Row, { selected: selectedIdx === actionOffset, primary: "Recheck", primaryWidth: checkLabelWidth, hint: "run doctor again" }),
5865
+ /* @__PURE__ */ jsx49(Row, { selected: selectedIdx === actionOffset + 1, primary: "Back", primaryWidth: checkLabelWidth, hint: "return to previous page" }),
5866
+ /* @__PURE__ */ jsx49(SectionEnd, {})
5762
5867
  ] })
5763
5868
  }
5764
5869
  );
5765
5870
  }
5766
5871
 
5767
5872
  // src/tui/screens/DoctorCheck.tsx
5768
- import { useEffect as useEffect14, useMemo as useMemo11, useState as useState32 } from "react";
5769
- import { Box as Box34, Text as Text28, useInput as useInput27 } from "ink";
5770
- import { Fragment as Fragment15, jsx as jsx49, jsxs as jsxs40 } from "react/jsx-runtime";
5873
+ import { useEffect as useEffect14, useMemo as useMemo12, useState as useState33 } from "react";
5874
+ import { Box as Box35, Text as Text29, useInput as useInput28 } from "ink";
5875
+ import { Fragment as Fragment15, jsx as jsx50, jsxs as jsxs41 } from "react/jsx-runtime";
5771
5876
  function statusGlyph5(status) {
5772
5877
  if (status === "ok") return { char: glyphs.status.ok, color: colors.status.ok };
5773
5878
  if (status === "warn") return { char: glyphs.status.warn, color: colors.status.warn };
@@ -5782,14 +5887,14 @@ function findFixHint(check) {
5782
5887
  function DoctorCheck() {
5783
5888
  const { pop, selectedCheckName } = useRouter();
5784
5889
  const { language } = useLanguage();
5785
- const [selectedIdx, setSelectedIdx] = useState32(0);
5786
- const result = useMemo11(() => runDoctor(), []);
5890
+ const [selectedIdx, setSelectedIdx] = useState33(0);
5891
+ const result = useMemo12(() => runDoctor(), []);
5787
5892
  const check = result.checks.find((c) => c.name === selectedCheckName);
5788
5893
  const backIdx = check ? 1 : 0;
5789
5894
  useEffect14(() => {
5790
5895
  setSelectedIdx(backIdx);
5791
5896
  }, [backIdx]);
5792
- useInput27((_input, key) => {
5897
+ useInput28((_input, key) => {
5793
5898
  if (key.escape || key.backspace) {
5794
5899
  pop();
5795
5900
  return;
@@ -5803,56 +5908,56 @@ function DoctorCheck() {
5803
5908
  }
5804
5909
  });
5805
5910
  if (!check) {
5806
- return /* @__PURE__ */ jsx49(
5911
+ return /* @__PURE__ */ jsx50(
5807
5912
  Frame,
5808
5913
  {
5809
5914
  breadcrumb: ["ReevesAgents", "Doctor", "Check"],
5810
5915
  tagline: "Check not found.",
5811
- children: /* @__PURE__ */ jsx49(Primary, { children: /* @__PURE__ */ jsx49(Row, { selected: selectedIdx === backIdx, primary: "Back" }) })
5916
+ children: /* @__PURE__ */ jsx50(Primary, { children: /* @__PURE__ */ jsx50(Row, { selected: selectedIdx === backIdx, primary: "Back" }) })
5812
5917
  }
5813
5918
  );
5814
5919
  }
5815
5920
  const fixHint = findFixHint(check);
5816
- return /* @__PURE__ */ jsx49(
5921
+ return /* @__PURE__ */ jsx50(
5817
5922
  Frame,
5818
5923
  {
5819
5924
  breadcrumb: ["ReevesAgents", "Doctor", check.name],
5820
5925
  meta: [{ label: "status", value: check.status }],
5821
5926
  tagline: "Check details and suggested fix.",
5822
- children: /* @__PURE__ */ jsxs40(Primary, { children: [
5823
- /* @__PURE__ */ jsxs40(Box34, { flexDirection: "column", children: [
5824
- /* @__PURE__ */ jsx49(Row, { selected: false, primary: "Name", trailing: check.name }),
5825
- /* @__PURE__ */ jsx49(Row, { selected: false, primary: "Status", trailing: check.status, glyph: statusGlyph5(check.status) }),
5826
- /* @__PURE__ */ jsx49(Row, { selected: false, primary: "Detail", trailing: check.detail })
5927
+ children: /* @__PURE__ */ jsxs41(Primary, { children: [
5928
+ /* @__PURE__ */ jsxs41(Box35, { flexDirection: "column", children: [
5929
+ /* @__PURE__ */ jsx50(Row, { selected: false, primary: "Name", trailing: check.name }),
5930
+ /* @__PURE__ */ jsx50(Row, { selected: false, primary: "Status", trailing: check.status, glyph: statusGlyph5(check.status) }),
5931
+ /* @__PURE__ */ jsx50(Row, { selected: false, primary: "Detail", trailing: check.detail })
5827
5932
  ] }),
5828
- fixHint && /* @__PURE__ */ jsxs40(Fragment15, { children: [
5829
- /* @__PURE__ */ jsx49(Box34, { marginY: 1 }),
5830
- /* @__PURE__ */ jsx49(Section, { label: "Fix" }),
5831
- /* @__PURE__ */ jsxs40(Box34, { marginY: 1, marginLeft: 2, flexDirection: "column", children: [
5832
- /* @__PURE__ */ jsx49(Text28, { color: colors.text.dim, children: translatePhrase(language, "Suggested fix:") }),
5833
- /* @__PURE__ */ jsx49(Text28, { color: colors.accent.primary, children: translatePhrase(language, fixHint) })
5933
+ fixHint && /* @__PURE__ */ jsxs41(Fragment15, { children: [
5934
+ /* @__PURE__ */ jsx50(Box35, { marginY: 1 }),
5935
+ /* @__PURE__ */ jsx50(Section, { label: "Fix" }),
5936
+ /* @__PURE__ */ jsxs41(Box35, { marginY: 1, marginLeft: 2, flexDirection: "column", children: [
5937
+ /* @__PURE__ */ jsx50(Text29, { color: colors.text.dim, children: translatePhrase(language, "Suggested fix:") }),
5938
+ /* @__PURE__ */ jsx50(Text29, { color: colors.accent.primary, children: translatePhrase(language, fixHint) })
5834
5939
  ] }),
5835
- /* @__PURE__ */ jsx49(SectionEnd, {})
5940
+ /* @__PURE__ */ jsx50(SectionEnd, {})
5836
5941
  ] }),
5837
- !fixHint && /* @__PURE__ */ jsxs40(Fragment15, { children: [
5838
- /* @__PURE__ */ jsx49(Box34, { marginY: 1 }),
5839
- /* @__PURE__ */ jsx49(Section, { label: "Fix" }),
5840
- /* @__PURE__ */ jsx49(Box34, { marginY: 1, marginLeft: 2, children: /* @__PURE__ */ jsx49(Text28, { color: colors.text.dim, children: translatePhrase(language, "No suggested fix. Check the source code or open an issue.") }) }),
5841
- /* @__PURE__ */ jsx49(SectionEnd, {})
5942
+ !fixHint && /* @__PURE__ */ jsxs41(Fragment15, { children: [
5943
+ /* @__PURE__ */ jsx50(Box35, { marginY: 1 }),
5944
+ /* @__PURE__ */ jsx50(Section, { label: "Fix" }),
5945
+ /* @__PURE__ */ jsx50(Box35, { marginY: 1, marginLeft: 2, children: /* @__PURE__ */ jsx50(Text29, { color: colors.text.dim, children: translatePhrase(language, "No suggested fix. Check the source code or open an issue.") }) }),
5946
+ /* @__PURE__ */ jsx50(SectionEnd, {})
5842
5947
  ] }),
5843
- /* @__PURE__ */ jsx49(Box34, { marginY: 1 }),
5844
- /* @__PURE__ */ jsx49(Section, { label: "Actions" }),
5845
- /* @__PURE__ */ jsx49(Row, { selected: selectedIdx === backIdx, primary: "Back" }),
5846
- /* @__PURE__ */ jsx49(SectionEnd, {})
5948
+ /* @__PURE__ */ jsx50(Box35, { marginY: 1 }),
5949
+ /* @__PURE__ */ jsx50(Section, { label: "Actions" }),
5950
+ /* @__PURE__ */ jsx50(Row, { selected: selectedIdx === backIdx, primary: "Back" }),
5951
+ /* @__PURE__ */ jsx50(SectionEnd, {})
5847
5952
  ] })
5848
5953
  }
5849
5954
  );
5850
5955
  }
5851
5956
 
5852
5957
  // src/tui/screens/Approvals.tsx
5853
- import { useEffect as useEffect15, useState as useState33 } from "react";
5854
- import { Box as Box35, useInput as useInput28 } from "ink";
5855
- import { jsx as jsx50, jsxs as jsxs41 } from "react/jsx-runtime";
5958
+ import { useEffect as useEffect15, useState as useState34 } from "react";
5959
+ import { Box as Box36, useInput as useInput29 } from "ink";
5960
+ import { jsx as jsx51, jsxs as jsxs42 } from "react/jsx-runtime";
5856
5961
  var ACTIONS3 = ["Approve", "Deny", "Back", "Main Menu"];
5857
5962
  var ACTION_COPY3 = {
5858
5963
  Approve: { label: "Approve", hint: "approve the selected request" },
@@ -5870,10 +5975,10 @@ function Approvals() {
5870
5975
  const { pop, resetStack } = useRouter();
5871
5976
  const { toast } = useToast();
5872
5977
  const { t } = useLanguage();
5873
- const [approvals, setApprovals] = useState33(() => listRunApprovals(void 0, "pending"));
5874
- const [selectedIdx, setSelectedIdx] = useState33(0);
5875
- const [selectedApprovalId, setSelectedApprovalId] = useState33(() => approvals[0]?.id ?? null);
5876
- const [pending, setPending] = useState33(null);
5978
+ const [approvals, setApprovals] = useState34(() => listRunApprovals(void 0, "pending"));
5979
+ const [selectedIdx, setSelectedIdx] = useState34(0);
5980
+ const [selectedApprovalId, setSelectedApprovalId] = useState34(() => approvals[0]?.id ?? null);
5981
+ const [pending, setPending] = useState34(null);
5877
5982
  useEffect15(() => {
5878
5983
  const timer = setInterval(() => setApprovals(listRunApprovals(void 0, "pending")), 5e3);
5879
5984
  return () => clearInterval(timer);
@@ -5918,7 +6023,7 @@ function Approvals() {
5918
6023
  break;
5919
6024
  }
5920
6025
  }
5921
- useInput28((_input, key) => {
6026
+ useInput29((_input, key) => {
5922
6027
  if (pending) return;
5923
6028
  if (key.upArrow) {
5924
6029
  setSelectedIdx((idx) => Math.max(0, Math.min(idx, itemCount - 1) - 1));
@@ -5938,7 +6043,7 @@ function Approvals() {
5938
6043
  }
5939
6044
  });
5940
6045
  if (pending) {
5941
- return /* @__PURE__ */ jsx50(Frame, { breadcrumb: ["ReevesAgents", "Approvals"], statusKeys: "\u2190\u2192 switch \xB7 enter select \xB7 esc cancel", children: /* @__PURE__ */ jsx50(
6046
+ return /* @__PURE__ */ jsx51(Frame, { breadcrumb: ["ReevesAgents", "Approvals"], statusKeys: "\u2190\u2192 switch \xB7 enter select \xB7 esc cancel", children: /* @__PURE__ */ jsx51(
5942
6047
  Dialog,
5943
6048
  {
5944
6049
  title: pending.decision === "approved" ? "Approve this request?" : "Deny this request?",
@@ -5957,7 +6062,7 @@ function Approvals() {
5957
6062
  } else if (selectedAction) {
5958
6063
  statusContext = (selectedAction === "Approve" || selectedAction === "Deny") && actionTarget ? `${ACTION_COPY3[selectedAction].hint} \xB7 ${actionTarget.action}` : ACTION_COPY3[selectedAction].hint;
5959
6064
  }
5960
- return /* @__PURE__ */ jsx50(
6065
+ return /* @__PURE__ */ jsx51(
5961
6066
  Frame,
5962
6067
  {
5963
6068
  breadcrumb: ["ReevesAgents", "Approvals"],
@@ -5965,9 +6070,9 @@ function Approvals() {
5965
6070
  tagline: "Pending approval requests raised by agents. Approve or deny them here.",
5966
6071
  statusContext,
5967
6072
  statusKeys: "enter action \xB7 \u2191\u2193 move \xB7 esc back",
5968
- children: /* @__PURE__ */ jsxs41(Box35, { flexDirection: "column", children: [
5969
- /* @__PURE__ */ jsx50(Section, { label: "Pending" }),
5970
- approvals.length === 0 ? /* @__PURE__ */ jsx50(Row, { selected: false, primary: "No pending approvals", trailing: "requests appear here", disabled: true }) : approvals.map((approval, idx) => /* @__PURE__ */ jsx50(
6073
+ children: /* @__PURE__ */ jsxs42(Box36, { flexDirection: "column", children: [
6074
+ /* @__PURE__ */ jsx51(Section, { label: "Pending" }),
6075
+ approvals.length === 0 ? /* @__PURE__ */ jsx51(Row, { selected: false, primary: "No pending approvals", trailing: "requests appear here", disabled: true }) : approvals.map((approval, idx) => /* @__PURE__ */ jsx51(
5971
6076
  Row,
5972
6077
  {
5973
6078
  selected: clampedIdx === idx,
@@ -5979,9 +6084,9 @@ function Approvals() {
5979
6084
  },
5980
6085
  approval.id
5981
6086
  )),
5982
- /* @__PURE__ */ jsx50(SectionEnd, {}),
5983
- /* @__PURE__ */ jsx50(Section, { label: "Actions" }),
5984
- ACTIONS3.map((action, idx) => /* @__PURE__ */ jsx50(
6087
+ /* @__PURE__ */ jsx51(SectionEnd, {}),
6088
+ /* @__PURE__ */ jsx51(Section, { label: "Actions" }),
6089
+ ACTIONS3.map((action, idx) => /* @__PURE__ */ jsx51(
5985
6090
  Row,
5986
6091
  {
5987
6092
  selected: clampedIdx === approvals.length + idx,
@@ -5993,16 +6098,16 @@ function Approvals() {
5993
6098
  },
5994
6099
  action
5995
6100
  )),
5996
- /* @__PURE__ */ jsx50(SectionEnd, {})
6101
+ /* @__PURE__ */ jsx51(SectionEnd, {})
5997
6102
  ] })
5998
6103
  }
5999
6104
  );
6000
6105
  }
6001
6106
 
6002
6107
  // src/tui/screens/Config.tsx
6003
- import { useState as useState34 } from "react";
6004
- import { Box as Box36, useInput as useInput29 } from "ink";
6005
- import { jsx as jsx51, jsxs as jsxs42 } from "react/jsx-runtime";
6108
+ import { useState as useState35 } from "react";
6109
+ import { Box as Box37, useInput as useInput30 } from "ink";
6110
+ import { jsx as jsx52, jsxs as jsxs43 } from "react/jsx-runtime";
6006
6111
  var EDITABLE_FIELDS = CONFIG_FIELDS.filter((field) => field.kind !== "language");
6007
6112
  function isNumeric(field) {
6008
6113
  return field.kind === "posint" || field.kind === "nonneg-int";
@@ -6011,10 +6116,10 @@ function Config() {
6011
6116
  const { pop } = useRouter();
6012
6117
  const { toast } = useToast();
6013
6118
  const { language } = useLanguage();
6014
- const [global, setGlobal] = useState34(() => loadConfig().global);
6015
- const [selectedIdx, setSelectedIdx] = useState34(0);
6016
- const [editingKey, setEditingKey] = useState34(null);
6017
- const [draft, setDraft] = useState34("");
6119
+ const [global, setGlobal] = useState35(() => loadConfig().global);
6120
+ const [selectedIdx, setSelectedIdx] = useState35(0);
6121
+ const [editingKey, setEditingKey] = useState35(null);
6122
+ const [draft, setDraft] = useState35("");
6018
6123
  const totalRows = EDITABLE_FIELDS.length + 1;
6019
6124
  function applyValue(key, value) {
6020
6125
  try {
@@ -6031,7 +6136,7 @@ function Config() {
6031
6136
  toast(err instanceof Error ? err.message : String(err), "error");
6032
6137
  }
6033
6138
  }
6034
- useInput29((_input, key) => {
6139
+ useInput30((_input, key) => {
6035
6140
  if (editingKey) return;
6036
6141
  if (key.escape || key.backspace) {
6037
6142
  pop();
@@ -6061,18 +6166,18 @@ function Config() {
6061
6166
  setEditingKey(field.key);
6062
6167
  }
6063
6168
  });
6064
- return /* @__PURE__ */ jsx51(
6169
+ return /* @__PURE__ */ jsx52(
6065
6170
  Frame,
6066
6171
  {
6067
6172
  breadcrumb: ["ReevesAgents", "Settings", "Config"],
6068
6173
  tagline: "Edit global settings. Numbers edit inline; permissions cycle.",
6069
6174
  statusKeys: "enter edit/cycle \xB7 \u2190\u2192 cycle \xB7 esc back",
6070
- children: /* @__PURE__ */ jsxs42(Box36, { flexDirection: "column", children: [
6071
- /* @__PURE__ */ jsx51(Section, { label: "Config" }),
6175
+ children: /* @__PURE__ */ jsxs43(Box37, { flexDirection: "column", children: [
6176
+ /* @__PURE__ */ jsx52(Section, { label: "Config" }),
6072
6177
  EDITABLE_FIELDS.map((field, idx) => {
6073
6178
  const value = global[field.key];
6074
6179
  if (isNumeric(field)) {
6075
- return /* @__PURE__ */ jsx51(
6180
+ return /* @__PURE__ */ jsx52(
6076
6181
  TextField,
6077
6182
  {
6078
6183
  label: field.label,
@@ -6088,7 +6193,7 @@ function Config() {
6088
6193
  field.key
6089
6194
  );
6090
6195
  }
6091
- return /* @__PURE__ */ jsx51(
6196
+ return /* @__PURE__ */ jsx52(
6092
6197
  Row,
6093
6198
  {
6094
6199
  selected: selectedIdx === idx,
@@ -6099,19 +6204,19 @@ function Config() {
6099
6204
  field.key
6100
6205
  );
6101
6206
  }),
6102
- /* @__PURE__ */ jsx51(SectionEnd, {}),
6103
- /* @__PURE__ */ jsx51(Section, { label: "Actions" }),
6104
- /* @__PURE__ */ jsx51(Row, { selected: selectedIdx === EDITABLE_FIELDS.length, primary: "Back", hint: "return to settings" }),
6105
- /* @__PURE__ */ jsx51(SectionEnd, {})
6207
+ /* @__PURE__ */ jsx52(SectionEnd, {}),
6208
+ /* @__PURE__ */ jsx52(Section, { label: "Actions" }),
6209
+ /* @__PURE__ */ jsx52(Row, { selected: selectedIdx === EDITABLE_FIELDS.length, primary: "Back", hint: "return to settings" }),
6210
+ /* @__PURE__ */ jsx52(SectionEnd, {})
6106
6211
  ] })
6107
6212
  }
6108
6213
  );
6109
6214
  }
6110
6215
 
6111
6216
  // src/tui/screens/Presets.tsx
6112
- import { useEffect as useEffect16, useState as useState35 } from "react";
6113
- import { Box as Box37, useInput as useInput30 } from "ink";
6114
- import { jsx as jsx52, jsxs as jsxs43 } from "react/jsx-runtime";
6217
+ import { useEffect as useEffect16, useState as useState36 } from "react";
6218
+ import { Box as Box38, useInput as useInput31 } from "ink";
6219
+ import { jsx as jsx53, jsxs as jsxs44 } from "react/jsx-runtime";
6115
6220
  var ACTIONS4 = ["Start", "SaveCurrentRun", "Delete", "Back", "Main Menu"];
6116
6221
  var ACTION_COPY4 = {
6117
6222
  Start: { label: "Start", hint: "launch a run from the selected preset" },
@@ -6125,12 +6230,12 @@ function Presets() {
6125
6230
  const { pop, resetStack, selectedRunId, setSelectedRunId } = useRouter();
6126
6231
  const { toast } = useToast();
6127
6232
  const { t } = useLanguage();
6128
- const [presets, setPresets] = useState35(() => listPresets());
6129
- const [selectedIdx, setSelectedIdx] = useState35(0);
6130
- const [actOnName, setActOnName] = useState35(() => presets[0]?.name ?? null);
6131
- const [pendingDelete, setPendingDelete] = useState35(null);
6132
- const [saving, setSaving] = useState35(false);
6133
- const [draftName, setDraftName] = useState35("");
6233
+ const [presets, setPresets] = useState36(() => listPresets());
6234
+ const [selectedIdx, setSelectedIdx] = useState36(0);
6235
+ const [actOnName, setActOnName] = useState36(() => presets[0]?.name ?? null);
6236
+ const [pendingDelete, setPendingDelete] = useState36(null);
6237
+ const [saving, setSaving] = useState36(false);
6238
+ const [draftName, setDraftName] = useState36("");
6134
6239
  const total = presets.length + ACTIONS4.length;
6135
6240
  const clampedIdx = Math.min(selectedIdx, Math.max(0, total - 1));
6136
6241
  const onPreset = clampedIdx < presets.length;
@@ -6196,7 +6301,7 @@ function Presets() {
6196
6301
  setSaving(true);
6197
6302
  }
6198
6303
  }
6199
- useInput30((_input, key) => {
6304
+ useInput31((_input, key) => {
6200
6305
  if (saving) return;
6201
6306
  if (key.upArrow) {
6202
6307
  setSelectedIdx(() => Math.max(0, clampedIdx - 1));
@@ -6216,15 +6321,15 @@ function Presets() {
6216
6321
  }
6217
6322
  });
6218
6323
  if (saving) {
6219
- return /* @__PURE__ */ jsx52(
6324
+ return /* @__PURE__ */ jsx53(
6220
6325
  Frame,
6221
6326
  {
6222
6327
  breadcrumb: ["ReevesAgents", "Presets", "Save"],
6223
6328
  tagline: "Name the preset captured from the current run.",
6224
6329
  statusKeys: "enter save \xB7 esc cancel",
6225
- children: /* @__PURE__ */ jsxs43(Box37, { flexDirection: "column", children: [
6226
- /* @__PURE__ */ jsx52(Section, { label: "Save Current Run as Preset" }),
6227
- /* @__PURE__ */ jsx52(
6330
+ children: /* @__PURE__ */ jsxs44(Box38, { flexDirection: "column", children: [
6331
+ /* @__PURE__ */ jsx53(Section, { label: "Save Current Run as Preset" }),
6332
+ /* @__PURE__ */ jsx53(
6228
6333
  TextField,
6229
6334
  {
6230
6335
  label: "Preset name",
@@ -6238,13 +6343,13 @@ function Presets() {
6238
6343
  onCancel: () => setSaving(false)
6239
6344
  }
6240
6345
  ),
6241
- /* @__PURE__ */ jsx52(SectionEnd, {})
6346
+ /* @__PURE__ */ jsx53(SectionEnd, {})
6242
6347
  ] })
6243
6348
  }
6244
6349
  );
6245
6350
  }
6246
6351
  if (pendingDelete) {
6247
- return /* @__PURE__ */ jsx52(Frame, { breadcrumb: ["ReevesAgents", "Presets"], statusKeys: "enter select \xB7 esc cancel", children: /* @__PURE__ */ jsx52(
6352
+ return /* @__PURE__ */ jsx53(Frame, { breadcrumb: ["ReevesAgents", "Presets"], statusKeys: "enter select \xB7 esc cancel", children: /* @__PURE__ */ jsx53(
6248
6353
  Dialog,
6249
6354
  {
6250
6355
  title: t("presets.deleteTitle", { name: pendingDelete.name }),
@@ -6257,16 +6362,16 @@ function Presets() {
6257
6362
  }
6258
6363
  ) });
6259
6364
  }
6260
- return /* @__PURE__ */ jsx52(
6365
+ return /* @__PURE__ */ jsx53(
6261
6366
  Frame,
6262
6367
  {
6263
6368
  breadcrumb: ["ReevesAgents", "Presets"],
6264
6369
  meta: [{ label: "presets", value: String(presets.length) }],
6265
6370
  tagline: "Saved agent-team templates. Start one, save the current run, or delete.",
6266
6371
  statusKeys: "enter start/select \xB7 \u2191\u2193 move \xB7 esc back",
6267
- children: /* @__PURE__ */ jsxs43(Box37, { flexDirection: "column", children: [
6268
- /* @__PURE__ */ jsx52(Section, { label: "Presets" }),
6269
- presets.length === 0 ? /* @__PURE__ */ jsx52(Row, { selected: false, primary: "No presets yet", trailing: "save a run to create one", disabled: true }) : presets.map((preset, idx) => /* @__PURE__ */ jsx52(
6372
+ children: /* @__PURE__ */ jsxs44(Box38, { flexDirection: "column", children: [
6373
+ /* @__PURE__ */ jsx53(Section, { label: "Presets" }),
6374
+ presets.length === 0 ? /* @__PURE__ */ jsx53(Row, { selected: false, primary: "No presets yet", trailing: "save a run to create one", disabled: true }) : presets.map((preset, idx) => /* @__PURE__ */ jsx53(
6270
6375
  Row,
6271
6376
  {
6272
6377
  selected: clampedIdx === idx,
@@ -6276,9 +6381,9 @@ function Presets() {
6276
6381
  },
6277
6382
  preset.name
6278
6383
  )),
6279
- /* @__PURE__ */ jsx52(SectionEnd, {}),
6280
- /* @__PURE__ */ jsx52(Section, { label: "Actions" }),
6281
- ACTIONS4.map((action, idx) => /* @__PURE__ */ jsx52(
6384
+ /* @__PURE__ */ jsx53(SectionEnd, {}),
6385
+ /* @__PURE__ */ jsx53(Section, { label: "Actions" }),
6386
+ ACTIONS4.map((action, idx) => /* @__PURE__ */ jsx53(
6282
6387
  Row,
6283
6388
  {
6284
6389
  selected: clampedIdx === presets.length + idx,
@@ -6290,14 +6395,14 @@ function Presets() {
6290
6395
  },
6291
6396
  action
6292
6397
  )),
6293
- /* @__PURE__ */ jsx52(SectionEnd, {})
6398
+ /* @__PURE__ */ jsx53(SectionEnd, {})
6294
6399
  ] })
6295
6400
  }
6296
6401
  );
6297
6402
  }
6298
6403
 
6299
6404
  // src/tui/router.tsx
6300
- import { jsx as jsx53 } from "react/jsx-runtime";
6405
+ import { jsx as jsx54 } from "react/jsx-runtime";
6301
6406
  var RouterContext = createContext6(null);
6302
6407
  function useRouter() {
6303
6408
  const ctx = useContext6(RouterContext);
@@ -6310,65 +6415,67 @@ function normalizeScreen(screen) {
6310
6415
  function renderScreen(screen) {
6311
6416
  switch (normalizeScreen(screen)) {
6312
6417
  case "LanguageSelect":
6313
- return /* @__PURE__ */ jsx53(LanguageSelect, {});
6418
+ return /* @__PURE__ */ jsx54(LanguageSelect, {});
6314
6419
  case "Welcome":
6315
- return /* @__PURE__ */ jsx53(Welcome, {});
6420
+ return /* @__PURE__ */ jsx54(Welcome, {});
6316
6421
  case "Runs":
6317
- return /* @__PURE__ */ jsx53(Runs, {});
6422
+ return /* @__PURE__ */ jsx54(Runs, {});
6318
6423
  case "RunHistory":
6319
- return /* @__PURE__ */ jsx53(RunHistory, {});
6424
+ return /* @__PURE__ */ jsx54(RunHistory, {});
6320
6425
  case "Run":
6321
- return /* @__PURE__ */ jsx53(Run, {});
6426
+ return /* @__PURE__ */ jsx54(Run, {});
6322
6427
  case "RunAgents":
6323
- return /* @__PURE__ */ jsx53(RunAgents, {});
6428
+ return /* @__PURE__ */ jsx54(RunAgents, {});
6324
6429
  case "RunOutput":
6325
- return /* @__PURE__ */ jsx53(RunOutput, {});
6430
+ return /* @__PURE__ */ jsx54(RunOutput, {});
6326
6431
  case "RunStop":
6327
- return /* @__PURE__ */ jsx53(RunStop, {});
6432
+ return /* @__PURE__ */ jsx54(RunStop, {});
6328
6433
  case "AgentDetail":
6329
- return /* @__PURE__ */ jsx53(AgentDetail, {});
6434
+ return /* @__PURE__ */ jsx54(AgentDetail, {});
6330
6435
  case "AgentOutput":
6331
- return /* @__PURE__ */ jsx53(AgentOutput, {});
6436
+ return /* @__PURE__ */ jsx54(AgentOutput, {});
6332
6437
  case "AgentTask":
6333
- return /* @__PURE__ */ jsx53(AgentTask, {});
6438
+ return /* @__PURE__ */ jsx54(AgentTask, {});
6334
6439
  case "AgentKill":
6335
- return /* @__PURE__ */ jsx53(AgentKill, {});
6440
+ return /* @__PURE__ */ jsx54(AgentKill, {});
6336
6441
  case "NewRun":
6337
- return /* @__PURE__ */ jsx53(NewRun, {});
6442
+ return /* @__PURE__ */ jsx54(NewRun, {});
6338
6443
  case "NewRunBasics":
6339
- return /* @__PURE__ */ jsx53(NewRunBasics, {});
6444
+ return /* @__PURE__ */ jsx54(NewRunBasics, {});
6340
6445
  case "NewRunRoot":
6341
- return /* @__PURE__ */ jsx53(NewRunRoot, {});
6446
+ return /* @__PURE__ */ jsx54(NewRunRoot, {});
6342
6447
  case "NewRunWorkers":
6343
- return /* @__PURE__ */ jsx53(NewRunWorkers, {});
6448
+ return /* @__PURE__ */ jsx54(NewRunWorkers, {});
6344
6449
  case "NewRunWorker":
6345
- return /* @__PURE__ */ jsx53(NewRunWorker, {});
6450
+ return /* @__PURE__ */ jsx54(NewRunWorker, {});
6346
6451
  case "NewRunReview":
6347
- return /* @__PURE__ */ jsx53(NewRunReview, {});
6452
+ return /* @__PURE__ */ jsx54(NewRunReview, {});
6348
6453
  case "NewRunStarting":
6349
- return /* @__PURE__ */ jsx53(NewRunStarting, {});
6454
+ return /* @__PURE__ */ jsx54(NewRunStarting, {});
6350
6455
  case "AddWorker":
6351
- return /* @__PURE__ */ jsx53(AddWorker, {});
6456
+ return /* @__PURE__ */ jsx54(AddWorker, {});
6352
6457
  case "Settings":
6353
- return /* @__PURE__ */ jsx53(Settings, {});
6458
+ return /* @__PURE__ */ jsx54(Settings, {});
6459
+ case "Setup":
6460
+ return /* @__PURE__ */ jsx54(Setup, {});
6354
6461
  case "AgentControl":
6355
- return /* @__PURE__ */ jsx53(AgentControl, {});
6462
+ return /* @__PURE__ */ jsx54(AgentControl, {});
6356
6463
  case "Reference":
6357
- return /* @__PURE__ */ jsx53(Reference, {});
6464
+ return /* @__PURE__ */ jsx54(Reference, {});
6358
6465
  case "Credits":
6359
- return /* @__PURE__ */ jsx53(Credits, {});
6466
+ return /* @__PURE__ */ jsx54(Credits, {});
6360
6467
  case "Doctor":
6361
- return /* @__PURE__ */ jsx53(Doctor, {});
6468
+ return /* @__PURE__ */ jsx54(Doctor, {});
6362
6469
  case "DoctorCheck":
6363
- return /* @__PURE__ */ jsx53(DoctorCheck, {});
6470
+ return /* @__PURE__ */ jsx54(DoctorCheck, {});
6364
6471
  case "Approvals":
6365
- return /* @__PURE__ */ jsx53(Approvals, {});
6472
+ return /* @__PURE__ */ jsx54(Approvals, {});
6366
6473
  case "Config":
6367
- return /* @__PURE__ */ jsx53(Config, {});
6474
+ return /* @__PURE__ */ jsx54(Config, {});
6368
6475
  case "Presets":
6369
- return /* @__PURE__ */ jsx53(Presets, {});
6476
+ return /* @__PURE__ */ jsx54(Presets, {});
6370
6477
  default:
6371
- return /* @__PURE__ */ jsx53(Runs, {});
6478
+ return /* @__PURE__ */ jsx54(Runs, {});
6372
6479
  }
6373
6480
  }
6374
6481
  function nextHistoryOnPush(prev, screen) {
@@ -6391,12 +6498,12 @@ function Router({ initialScreen } = {}) {
6391
6498
  const { exit } = useApp3();
6392
6499
  const envRunId = process.env.REEVES_RUN_ID ?? null;
6393
6500
  const openTokenRef = useRef4(readTuiOpenToken());
6394
- const [selectedRunId, setSelectedRunId] = useState36(envRunId);
6395
- const [selectedAgentId, setSelectedAgentId] = useState36(null);
6396
- const [selectedCheckName, setSelectedCheckName] = useState36(null);
6397
- const [selectedWorkerIdx, setSelectedWorkerIdx] = useState36(null);
6501
+ const [selectedRunId, setSelectedRunId] = useState37(envRunId);
6502
+ const [selectedAgentId, setSelectedAgentId] = useState37(null);
6503
+ const [selectedCheckName, setSelectedCheckName] = useState37(null);
6504
+ const [selectedWorkerIdx, setSelectedWorkerIdx] = useState37(null);
6398
6505
  const firstRunNeedsLanguage = !initialScreen && !configExists();
6399
- const [history, setHistory] = useState36(() => ({
6506
+ const [history, setHistory] = useState37(() => ({
6400
6507
  entries: [initialScreen ? normalizeScreen(initialScreen) : firstRunNeedsLanguage ? "LanguageSelect" : "Welcome"],
6401
6508
  index: 0
6402
6509
  }));
@@ -6439,7 +6546,7 @@ function Router({ initialScreen } = {}) {
6439
6546
  const current = normalizeScreen(history.entries[history.index] ?? "Runs");
6440
6547
  const canBack = history.index > 0;
6441
6548
  const canForward = history.index < history.entries.length - 1;
6442
- return /* @__PURE__ */ jsx53(RouterContext.Provider, { value: {
6549
+ return /* @__PURE__ */ jsx54(RouterContext.Provider, { value: {
6443
6550
  screen: current,
6444
6551
  push,
6445
6552
  pop,
@@ -6456,7 +6563,7 @@ function Router({ initialScreen } = {}) {
6456
6563
  setSelectedWorkerIdx,
6457
6564
  canBack,
6458
6565
  canForward
6459
- }, children: /* @__PURE__ */ jsx53(LanguageProvider, { children: /* @__PURE__ */ jsx53(WizardProvider, { children: /* @__PURE__ */ jsx53(WorkerDraftProvider, { children: /* @__PURE__ */ jsx53(ToastProvider, { children: /* @__PURE__ */ jsx53(ErrorBoundary, { children: renderScreen(current) }) }) }) }) }) });
6566
+ }, children: /* @__PURE__ */ jsx54(LanguageProvider, { children: /* @__PURE__ */ jsx54(WizardProvider, { children: /* @__PURE__ */ jsx54(WorkerDraftProvider, { children: /* @__PURE__ */ jsx54(ToastProvider, { children: /* @__PURE__ */ jsx54(ErrorBoundary, { children: renderScreen(current) }) }) }) }) }) });
6460
6567
  }
6461
6568
  export {
6462
6569
  Router,
@@ -6465,4 +6572,4 @@ export {
6465
6572
  nextHistoryOnReset,
6466
6573
  useRouter
6467
6574
  };
6468
- //# sourceMappingURL=router-MGXDADKM.js.map
6575
+ //# sourceMappingURL=router-L5IRXRCH.js.map