reevesagents 2.1.0 → 2.2.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.d.ts CHANGED
@@ -98,6 +98,10 @@ interface GlobalConfig {
98
98
  default_permissions: Permissions;
99
99
  language: LanguageCode;
100
100
  web_theme: 'dark' | 'light';
101
+ agent_pulse_ms: number;
102
+ review_min_seconds: number;
103
+ review_evidence_retries: number;
104
+ dispatch_confirm_seconds: number;
101
105
  }
102
106
  interface Config {
103
107
  version: number;
@@ -177,6 +181,7 @@ declare function modelDisplayName(model: string): string;
177
181
  declare function modelSourceForProvider(provider: Provider): string;
178
182
 
179
183
  declare function stateRoot(): string;
184
+
180
185
  declare function runsDir(): string;
181
186
  declare function nowIso(): string;
182
187
  declare function readRun(runId: string): RunRecord;
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  modelDisplayName,
7
7
  modelSourceForProvider,
8
8
  modelValuesForProvider
9
- } from "./chunk-UEYJAKAZ.js";
9
+ } from "./chunk-DGLUP7Q7.js";
10
10
  import {
11
11
  BIN,
12
12
  PROVIDERS,
@@ -39,7 +39,7 @@ import {
39
39
  startRun,
40
40
  stateRoot,
41
41
  stopRun
42
- } from "./chunk-DLWYZPW6.js";
42
+ } from "./chunk-CJKEBBUI.js";
43
43
  import "./chunk-Q3WWQP2R.js";
44
44
  export {
45
45
  BIN,
@@ -2,23 +2,30 @@
2
2
  import {
3
3
  buildOnboardingState,
4
4
  readTuiOpenToken
5
- } from "./chunk-OQJNBACW.js";
5
+ } from "./chunk-QWUBYDUV.js";
6
6
  import "./chunk-QIHT27ZG.js";
7
7
  import {
8
+ flowAttentionText,
9
+ flowBadgeText,
8
10
  translate,
9
11
  translatePhrase
10
- } from "./chunk-KROKGL2R.js";
12
+ } from "./chunk-XHP63Y64.js";
11
13
  import {
12
14
  modelDisplayName,
13
15
  modelValuesForProvider
14
- } from "./chunk-UEYJAKAZ.js";
16
+ } from "./chunk-DGLUP7Q7.js";
15
17
  import {
16
18
  REEVESAGENTS_VERSION,
19
+ flowSectionLines,
20
+ listFlowBadges,
17
21
  listRunApprovals,
22
+ planAttentionOf,
23
+ readTickStatus,
18
24
  resolveRunApproval,
25
+ sameFlowBadges,
19
26
  sweepAgentsThrottled,
20
27
  sweepOrphanSessionsThrottled
21
- } from "./chunk-YWS3MILO.js";
28
+ } from "./chunk-XEOWHTRQ.js";
22
29
  import {
23
30
  CONFIG_FIELDS,
24
31
  DEFAULT_LANGUAGE,
@@ -58,6 +65,7 @@ import {
58
65
  providerDisplayName,
59
66
  providerSupportsAuthMode,
60
67
  providerSupportsEffort,
68
+ readFlow,
61
69
  readRun,
62
70
  runDoctor,
63
71
  runHasLiveTmuxTarget,
@@ -70,11 +78,11 @@ import {
70
78
  startRunFromPreset,
71
79
  stateRoot,
72
80
  stopRun
73
- } from "./chunk-DLWYZPW6.js";
81
+ } from "./chunk-CJKEBBUI.js";
74
82
  import "./chunk-Q3WWQP2R.js";
75
83
  import {
76
84
  startWebFromTui
77
- } from "./chunk-PWYG5IM5.js";
85
+ } from "./chunk-HTCENB3Q.js";
78
86
 
79
87
  // src/surfaces/tui/router.tsx
80
88
  import { createContext as createContext6, useContext as useContext6, useState as useState37, useCallback as useCallback5, useEffect as useEffect17, useRef as useRef4 } from "react";
@@ -1199,6 +1207,7 @@ function Runs() {
1199
1207
  const { t, language } = useLanguage();
1200
1208
  const { push, resetStack, setSelectedRunId } = useRouter();
1201
1209
  const { rows: termRows } = useWindowSize4();
1210
+ const columns = useLayoutColumns();
1202
1211
  const bodyRows = frameBodyRows(termRows, true, true);
1203
1212
  const compactBody = bodyRows <= 11;
1204
1213
  const visibleRunCount = Math.max(1, compactBody ? bodyRows - 3 : Math.min(termRows - CHROME_ROWS, bodyRows - 9));
@@ -1208,6 +1217,9 @@ function Runs() {
1208
1217
  });
1209
1218
  const [selectedIdx, setSelectedIdx] = useState8(0);
1210
1219
  const [runScroll, setRunScroll] = useState8(0);
1220
+ const [flowBadges, setFlowBadges] = useState8(
1221
+ () => listFlowBadges(listRuns().map((run) => run.id), Date.now())
1222
+ );
1211
1223
  function refresh() {
1212
1224
  sweepAgentsThrottled();
1213
1225
  sweepOrphanSessionsThrottled();
@@ -1222,6 +1234,8 @@ function Runs() {
1222
1234
  return prev;
1223
1235
  });
1224
1236
  setSelectedIdx((idx) => normalizeSelectedIndex(idx, next.length));
1237
+ const nextBadges = listFlowBadges(next.map((run) => run.id), Date.now());
1238
+ setFlowBadges((prev) => sameFlowBadges(prev, nextBadges) ? prev : nextBadges);
1225
1239
  }
1226
1240
  useEffect3(() => {
1227
1241
  const timer = setInterval(refresh, 2e3);
@@ -1230,6 +1244,20 @@ function Runs() {
1230
1244
  useEffect3(() => {
1231
1245
  setSelectedIdx((idx) => normalizeSelectedIndex(idx, runs.length));
1232
1246
  }, [runs.length]);
1247
+ useEffect3(() => {
1248
+ const nextBadges = listFlowBadges(runs.map((run) => run.id), Date.now());
1249
+ setFlowBadges((prev) => sameFlowBadges(prev, nextBadges) ? prev : nextBadges);
1250
+ }, [runs]);
1251
+ const attentionCount = [...flowBadges.values()].filter((badge) => badge.attention !== null).length;
1252
+ const flowBadgeFor = (run) => {
1253
+ const badge = flowBadges.get(run.id);
1254
+ if (!badge) return null;
1255
+ return {
1256
+ label: flowBadgeText(t, badge, { compact: columns < 96 }),
1257
+ color: badge.attention ? colors.status.warn : colors.status.info,
1258
+ attention: flowAttentionText(t, badge)
1259
+ };
1260
+ };
1233
1261
  const items = [
1234
1262
  ...runs.map((run) => ({ type: "run", run })),
1235
1263
  { type: "section" },
@@ -1324,7 +1352,9 @@ function Runs() {
1324
1352
  breadcrumb: ["ReevesAgents", "Runs"],
1325
1353
  meta: [
1326
1354
  { label: "running", value: String(runningCount) },
1327
- { label: "stale", value: String(staleCount) }
1355
+ { label: "stale", value: String(staleCount) },
1356
+ // Only when something is waiting: an "attention 0" counter is noise in a 80x24 header.
1357
+ ...attentionCount > 0 ? [{ label: t("flow.meta.attention"), value: String(attentionCount) }] : []
1328
1358
  ],
1329
1359
  tagline: "Manage active runs and the agents inside them.",
1330
1360
  statusContext,
@@ -1350,12 +1380,14 @@ function Runs() {
1350
1380
  const run = entry.run;
1351
1381
  const agents = listAgents(run.id);
1352
1382
  const root = agents.find((a) => a.role === "root");
1383
+ const flowBadge = flowBadgeFor(run);
1353
1384
  const badges = [
1354
1385
  { label: "run", color: colors.accent.primary },
1355
1386
  ...root ? [
1356
1387
  { label: providerDisplayName(root.provider), color: providerColor(root.provider) },
1357
1388
  { label: modelBadgeLabel(root.model), color: modelColor(root.model, root.provider) }
1358
- ] : []
1389
+ ] : [],
1390
+ ...flowBadge ? [{ label: flowBadge.label, color: flowBadge.color }] : []
1359
1391
  ];
1360
1392
  return /* @__PURE__ */ jsx19(
1361
1393
  Row,
@@ -1394,12 +1426,14 @@ function Runs() {
1394
1426
  const absoluteIdx = runScroll + idx;
1395
1427
  const agents = listAgents(run.id);
1396
1428
  const root = agents.find((a) => a.role === "root");
1429
+ const flowBadge = flowBadgeFor(run);
1397
1430
  const badges = [
1398
1431
  { label: "run", color: colors.accent.primary },
1399
1432
  ...root ? [
1400
1433
  { label: providerDisplayName(root.provider), color: providerColor(root.provider) },
1401
1434
  { label: modelBadgeLabel(root.model), color: modelColor(root.model, root.provider) }
1402
- ] : []
1435
+ ] : [],
1436
+ ...flowBadge ? [{ label: flowBadge.label, color: flowBadge.color }] : []
1403
1437
  ];
1404
1438
  return /* @__PURE__ */ jsx19(
1405
1439
  Row,
@@ -1429,7 +1463,8 @@ function Runs() {
1429
1463
  {
1430
1464
  items: [
1431
1465
  { glyph: glyphs.status.ok, label: "running", color: colors.status.ok },
1432
- { glyph: glyphs.status.warn, label: "stale", color: colors.status.warn }
1466
+ { glyph: glyphs.status.warn, label: "stale", color: colors.status.warn },
1467
+ ...attentionCount > 0 ? [{ glyph: glyphs.status.warn, label: t("flow.legend.attention"), color: colors.status.warn }] : []
1433
1468
  ]
1434
1469
  }
1435
1470
  ),
@@ -1826,6 +1861,31 @@ function Run() {
1826
1861
  );
1827
1862
  const [selectedIdx, setSelectedIdx] = useState11(0);
1828
1863
  const agents = run ? listAgents(run.id) : [];
1864
+ const [flowLines, setFlowLines] = useState11([]);
1865
+ useEffect5(() => {
1866
+ const runId = run?.id;
1867
+ if (!runId) {
1868
+ setFlowLines([]);
1869
+ return void 0;
1870
+ }
1871
+ const readFlowSection = () => {
1872
+ try {
1873
+ const state = readFlow(runId);
1874
+ setFlowLines(flowSectionLines(state, {
1875
+ tick: readTickStatus(),
1876
+ plan: planAttentionOf(runId),
1877
+ active_plan_item: state.active_plan_item,
1878
+ queue_depth: state.specs.filter((spec) => !state.dispatched_specs.includes(spec.id)).length
1879
+ }));
1880
+ } catch {
1881
+ setFlowLines([]);
1882
+ }
1883
+ };
1884
+ readFlowSection();
1885
+ const timer = setInterval(readFlowSection, REFRESH_INTERVAL_MS);
1886
+ timer.unref();
1887
+ return () => clearInterval(timer);
1888
+ }, [run?.id]);
1829
1889
  useEffect5(() => {
1830
1890
  if (!selectedRunId) return;
1831
1891
  const refresh = () => {
@@ -1954,7 +2014,7 @@ function Run() {
1954
2014
  };
1955
2015
  statusContext = actionLabels[selected.action] || "";
1956
2016
  }
1957
- return /* @__PURE__ */ jsx22(
2017
+ return /* @__PURE__ */ jsxs16(
1958
2018
  Frame,
1959
2019
  {
1960
2020
  breadcrumb: ["ReevesAgents", "Runs", run.name],
@@ -1965,73 +2025,80 @@ function Run() {
1965
2025
  tagline: "Open, add, stop, or inspect agents in this run.",
1966
2026
  statusContext,
1967
2027
  statusKeys: "enter open \xB7 \u2191\u2193 move \xB7 esc back",
1968
- children: compactBody ? /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", children: [
1969
- /* @__PURE__ */ jsx22(Section, { label: selectedIdx < 4 ? "Actions" : "Lifecycle" }),
1970
- visibleCompactItems.map(({ item, itemIdx }) => {
1971
- const isDisabledAddWorker = item.action === "AddWorker" && isRunEnded;
1972
- const primary = item.action === "StopRun" && isRunEnded ? "Delete Run" : LABELS[item.action];
1973
- const hints = {
1974
- Agents: `${agents.length} agents`,
1975
- Output: "peek across all agents",
1976
- OpenTabs: isRunEnded ? "run is ended" : "switch to tmux tabs for this run",
1977
- AddWorker: isRunEnded ? "run is ended" : "add an agent to this run",
1978
- StopRun: isRunEnded ? "delete stopped run" : "stop the run and move it to history",
1979
- Back: "return to all runs",
1980
- "__section__": ""
1981
- };
1982
- const isDisabledOpenTabs = item.action === "OpenTabs" && isRunEnded;
1983
- return /* @__PURE__ */ jsx22(
1984
- Row,
1985
- {
1986
- selected: selectedIdx === itemIdx,
1987
- primary,
1988
- primaryWidth: ACTION_LABEL_WIDTH3,
1989
- hint: hints[item.action],
1990
- disabled: isDisabledAddWorker || isDisabledOpenTabs,
1991
- danger: item.action === "StopRun"
1992
- },
1993
- item.action
1994
- );
1995
- }),
1996
- /* @__PURE__ */ jsx22(SectionEnd, {})
1997
- ] }) : /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", children: [
1998
- /* @__PURE__ */ jsx22(Box17, { marginBottom: 1, children: /* @__PURE__ */ jsx22(Text15, { color: colors.text.dim, wrap: "truncate-end", children: summaryLine }) }),
1999
- /* @__PURE__ */ jsx22(Section, { label: "Actions" }),
2000
- items.map((item, idx) => {
2001
- const isSelected = selectedIdx === idx;
2002
- if (item.action === "__section__") {
2003
- return /* @__PURE__ */ jsxs16(React8.Fragment, { children: [
2004
- /* @__PURE__ */ jsx22(SectionEnd, {}),
2005
- /* @__PURE__ */ jsx22(Section, { label: "Lifecycle" })
2006
- ] }, "__section__");
2007
- }
2008
- const isDisabledAddWorker = item.action === "AddWorker" && isRunEnded;
2009
- const primary = item.action === "StopRun" && isRunEnded ? "Delete Run" : LABELS[item.action];
2010
- const hints = {
2011
- Agents: `${agents.length} agents`,
2012
- Output: "peek across all agents",
2013
- OpenTabs: isRunEnded ? "run is ended" : "switch to tmux tabs for this run",
2014
- AddWorker: isRunEnded ? "run is ended" : "add an agent to this run",
2015
- StopRun: isRunEnded ? "delete stopped run" : "stop the run and move it to history",
2016
- Back: "return to all runs",
2017
- "__section__": ""
2018
- };
2019
- const isDisabledOpenTabs = item.action === "OpenTabs" && isRunEnded;
2020
- return /* @__PURE__ */ jsx22(
2021
- Row,
2022
- {
2023
- selected: isSelected,
2024
- primary,
2025
- primaryWidth: ACTION_LABEL_WIDTH3,
2026
- hint: hints[item.action],
2027
- disabled: isDisabledAddWorker || isDisabledOpenTabs,
2028
- danger: item.action === "StopRun"
2029
- },
2030
- item.action
2031
- );
2032
- }),
2033
- /* @__PURE__ */ jsx22(SectionEnd, {})
2034
- ] })
2028
+ children: [
2029
+ flowLines.length > 0 ? /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", children: [
2030
+ /* @__PURE__ */ jsx22(Section, { label: "Flow" }),
2031
+ flowLines.map((line) => /* @__PURE__ */ jsx22(Box17, { children: /* @__PURE__ */ jsx22(Text15, { color: colors.text.dim, wrap: "truncate-end", children: line }) }, line)),
2032
+ /* @__PURE__ */ jsx22(SectionEnd, {})
2033
+ ] }) : null,
2034
+ compactBody ? /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", children: [
2035
+ /* @__PURE__ */ jsx22(Section, { label: selectedIdx < 4 ? "Actions" : "Lifecycle" }),
2036
+ visibleCompactItems.map(({ item, itemIdx }) => {
2037
+ const isDisabledAddWorker = item.action === "AddWorker" && isRunEnded;
2038
+ const primary = item.action === "StopRun" && isRunEnded ? "Delete Run" : LABELS[item.action];
2039
+ const hints = {
2040
+ Agents: `${agents.length} agents`,
2041
+ Output: "peek across all agents",
2042
+ OpenTabs: isRunEnded ? "run is ended" : "switch to tmux tabs for this run",
2043
+ AddWorker: isRunEnded ? "run is ended" : "add an agent to this run",
2044
+ StopRun: isRunEnded ? "delete stopped run" : "stop the run and move it to history",
2045
+ Back: "return to all runs",
2046
+ "__section__": ""
2047
+ };
2048
+ const isDisabledOpenTabs = item.action === "OpenTabs" && isRunEnded;
2049
+ return /* @__PURE__ */ jsx22(
2050
+ Row,
2051
+ {
2052
+ selected: selectedIdx === itemIdx,
2053
+ primary,
2054
+ primaryWidth: ACTION_LABEL_WIDTH3,
2055
+ hint: hints[item.action],
2056
+ disabled: isDisabledAddWorker || isDisabledOpenTabs,
2057
+ danger: item.action === "StopRun"
2058
+ },
2059
+ item.action
2060
+ );
2061
+ }),
2062
+ /* @__PURE__ */ jsx22(SectionEnd, {})
2063
+ ] }) : /* @__PURE__ */ jsxs16(Box17, { flexDirection: "column", children: [
2064
+ /* @__PURE__ */ jsx22(Box17, { marginBottom: 1, children: /* @__PURE__ */ jsx22(Text15, { color: colors.text.dim, wrap: "truncate-end", children: summaryLine }) }),
2065
+ /* @__PURE__ */ jsx22(Section, { label: "Actions" }),
2066
+ items.map((item, idx) => {
2067
+ const isSelected = selectedIdx === idx;
2068
+ if (item.action === "__section__") {
2069
+ return /* @__PURE__ */ jsxs16(React8.Fragment, { children: [
2070
+ /* @__PURE__ */ jsx22(SectionEnd, {}),
2071
+ /* @__PURE__ */ jsx22(Section, { label: "Lifecycle" })
2072
+ ] }, "__section__");
2073
+ }
2074
+ const isDisabledAddWorker = item.action === "AddWorker" && isRunEnded;
2075
+ const primary = item.action === "StopRun" && isRunEnded ? "Delete Run" : LABELS[item.action];
2076
+ const hints = {
2077
+ Agents: `${agents.length} agents`,
2078
+ Output: "peek across all agents",
2079
+ OpenTabs: isRunEnded ? "run is ended" : "switch to tmux tabs for this run",
2080
+ AddWorker: isRunEnded ? "run is ended" : "add an agent to this run",
2081
+ StopRun: isRunEnded ? "delete stopped run" : "stop the run and move it to history",
2082
+ Back: "return to all runs",
2083
+ "__section__": ""
2084
+ };
2085
+ const isDisabledOpenTabs = item.action === "OpenTabs" && isRunEnded;
2086
+ return /* @__PURE__ */ jsx22(
2087
+ Row,
2088
+ {
2089
+ selected: isSelected,
2090
+ primary,
2091
+ primaryWidth: ACTION_LABEL_WIDTH3,
2092
+ hint: hints[item.action],
2093
+ disabled: isDisabledAddWorker || isDisabledOpenTabs,
2094
+ danger: item.action === "StopRun"
2095
+ },
2096
+ item.action
2097
+ );
2098
+ }),
2099
+ /* @__PURE__ */ jsx22(SectionEnd, {})
2100
+ ] })
2101
+ ]
2035
2102
  }
2036
2103
  );
2037
2104
  }
@@ -6664,4 +6731,4 @@ export {
6664
6731
  nextHistoryOnReset,
6665
6732
  useRouter
6666
6733
  };
6667
- //# sourceMappingURL=router-AYNTF24M.js.map
6734
+ //# sourceMappingURL=router-S7KR2CIE.js.map