reevesagents 1.7.3 → 1.7.5

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,52 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- killAgent,
4
- listAgents,
5
- loadConfig,
6
- nowMs,
7
- targetExists,
8
- tmuxAvailable
9
- } from "./chunk-GSWMKYSU.js";
10
-
11
- // src/core/reaper.ts
12
- function sweepAgents(options = {}) {
13
- const haveTmux = options.targetExists ? true : (options.tmuxAvailable ?? tmuxAvailable)();
14
- if (!haveTmux) return { reaped: [] };
15
- const targetExists2 = options.targetExists ?? targetExists;
16
- const now = options.now ?? nowMs;
17
- const maxLifetimeMs = options.maxLifetimeMs ?? loadConfig().global.max_lifetime_ms;
18
- const reaped = [];
19
- for (const agent of listAgents()) {
20
- if (agent.ended_at || agent.headless) continue;
21
- const ageMs = now() - new Date(agent.started_at).getTime();
22
- let reason = null;
23
- if (agent.tmux_window_id && !targetExists2(agent.tmux_window_id, agent.tmux_session)) {
24
- reason = "window-gone";
25
- } else if (maxLifetimeMs > 0 && ageMs > maxLifetimeMs) {
26
- reason = "lifetime-exceeded";
27
- }
28
- if (!reason) continue;
29
- try {
30
- killAgent(agent.id, options.driver ? { driver: options.driver } : {});
31
- reaped.push({
32
- agent_id: agent.id,
33
- run_id: agent.run_id,
34
- nickname: agent.nickname,
35
- reason,
36
- age_ms: Math.max(0, Math.round(ageMs))
37
- });
38
- } catch {
39
- }
40
- }
41
- return { reaped };
42
- }
43
- var lastSweepAt = 0;
44
- function sweepAgentsThrottled(minIntervalMs = 15e3, options = {}) {
45
- const now = (options.now ?? nowMs)();
46
- if (lastSweepAt !== 0 && now - lastSweepAt < minIntervalMs) return { reaped: [], swept: false };
47
- lastSweepAt = now;
48
- return { ...sweepAgents(options), swept: true };
49
- }
50
2
 
51
3
  // src/core/skills.ts
52
4
  import { mkdirSync, writeFileSync, readFileSync, rmSync, existsSync } from "fs";
@@ -177,10 +129,8 @@ function removeSkills() {
177
129
  }
178
130
 
179
131
  export {
180
- sweepAgents,
181
- sweepAgentsThrottled,
182
132
  installSkills,
183
133
  skillsStatus,
184
134
  removeSkills
185
135
  };
186
- //# sourceMappingURL=chunk-JX6SHZKB.js.map
136
+ //# sourceMappingURL=chunk-YAR57K3U.js.map
package/dist/cli.js CHANGED
@@ -4,21 +4,22 @@ import {
4
4
  runOnboarding,
5
5
  suggestedAgentPrompt,
6
6
  writeTuiOpenToken
7
- } from "./chunk-MKNSEZTG.js";
7
+ } from "./chunk-MEIFYC3B.js";
8
8
  import {
9
9
  installSkills,
10
10
  removeSkills,
11
- skillsStatus,
12
- sweepAgents
13
- } from "./chunk-JX6SHZKB.js";
11
+ skillsStatus
12
+ } from "./chunk-YAR57K3U.js";
14
13
  import {
15
14
  MODEL_CATALOG
16
- } from "./chunk-GNS5ULTD.js";
15
+ } from "./chunk-EZJQYBYP.js";
17
16
  import {
18
17
  REEVESAGENTS_VERSION,
19
18
  listRunApprovals,
20
- resolveRunApproval
21
- } from "./chunk-EXUYSBTC.js";
19
+ resolveRunApproval,
20
+ sweepAgents,
21
+ sweepOrphanSessions
22
+ } from "./chunk-4ARHWX5G.js";
22
23
  import {
23
24
  ALLOWED_KEYS,
24
25
  CONFIG_FIELDS,
@@ -64,15 +65,15 @@ import {
64
65
  verifyServerLaunch,
65
66
  windowByName,
66
67
  windowIds
67
- } from "./chunk-GSWMKYSU.js";
68
- import "./chunk-D24DQQ6V.js";
68
+ } from "./chunk-HHNMES47.js";
69
+ import "./chunk-Q3WWQP2R.js";
69
70
 
70
- // src/cli/index.ts
71
+ // src/surfaces/cli/index.ts
71
72
  import { Command } from "commander";
72
73
  import { realpathSync } from "fs";
73
74
  import { fileURLToPath } from "url";
74
75
 
75
- // src/cli/color-env.ts
76
+ // src/surfaces/cli/color-env.ts
76
77
  function prepareTuiColorEnv() {
77
78
  if (process.env.REEVES_NO_COLOR === "1") {
78
79
  delete process.env.FORCE_COLOR;
@@ -88,7 +89,7 @@ function prepareTuiColorEnv() {
88
89
  }
89
90
  }
90
91
 
91
- // src/cli/tui-launcher.ts
92
+ // src/surfaces/cli/tui-launcher.ts
92
93
  import { execFileSync } from "child_process";
93
94
  function isTuiCommand(command) {
94
95
  return command === "node" || command === "reevesagents";
@@ -128,10 +129,10 @@ function openTuiSession(command) {
128
129
  execFileSync("tmux", ["attach", "-t", exactSession(session)], { stdio: "inherit" });
129
130
  }
130
131
 
131
- // src/cli/run.ts
132
+ // src/surfaces/cli/run.ts
132
133
  import { execFileSync as execFileSync2 } from "child_process";
133
134
 
134
- // src/cli/helpers.ts
135
+ // src/surfaces/cli/helpers.ts
135
136
  function resolveRun(id) {
136
137
  const runs = listRuns();
137
138
  const exact = runs.find((run) => run.id === id || run.name === id);
@@ -158,7 +159,7 @@ function requireDestructiveConfirmation(opts, command) {
158
159
  throw new Error(`refusing to ${command} without --yes or ALLOW_DESTRUCTIVE=1`);
159
160
  }
160
161
 
161
- // src/cli/run.ts
162
+ // src/surfaces/cli/run.ts
162
163
  function age(startedAt) {
163
164
  const seconds = Math.max(0, Math.floor((Date.now() - new Date(startedAt).getTime()) / 1e3));
164
165
  if (seconds < 60) return `${seconds}s`;
@@ -399,20 +400,24 @@ function registerRuns(program2) {
399
400
  });
400
401
  }
401
402
  function registerReap(program2) {
402
- program2.command("reap").description("reap zombie agents: end any whose tmux window is gone or that outlive max_lifetime_ms").option("--json", "output JSON array of reaped agents").action((opts) => {
403
+ program2.command("reap").description("reap zombie agents and orphan tmux sessions no live record owns").option("--json", "output JSON object: { reaped, killed_sessions }").action((opts) => {
403
404
  const { reaped } = sweepAgents();
405
+ const { killed } = sweepOrphanSessions({ ignoreGrace: true });
404
406
  if (opts.json) {
405
- console.log(JSON.stringify(reaped, null, 2));
406
- return;
407
- }
408
- if (reaped.length === 0) {
409
- console.log("no zombie agents");
407
+ console.log(JSON.stringify({ reaped, killed_sessions: killed }, null, 2));
410
408
  return;
411
409
  }
412
410
  for (const r of reaped) {
413
411
  console.log(`${r.agent_id.slice(0, 8)} ${r.run_id.slice(0, 8)} ${r.reason.padEnd(17)} ${String(Math.round(r.age_ms / 1e3)).padStart(5)}s ${r.nickname}`);
414
412
  }
415
- console.log(`reaped ${reaped.length} ${reaped.length === 1 ? "agent" : "agents"}`);
413
+ for (const name of killed) {
414
+ console.log(`killed orphan session ${name}`);
415
+ }
416
+ if (reaped.length === 0 && killed.length === 0) {
417
+ console.log("no zombie agents or orphan sessions");
418
+ return;
419
+ }
420
+ console.log(`reaped ${reaped.length} ${reaped.length === 1 ? "agent" : "agents"}, killed ${killed.length} orphan ${killed.length === 1 ? "session" : "sessions"}`);
416
421
  });
417
422
  }
418
423
  function registerOpen(program2) {
@@ -429,7 +434,7 @@ function registerStop(program2) {
429
434
  });
430
435
  }
431
436
 
432
- // src/cli/agents.ts
437
+ // src/surfaces/cli/agents.ts
433
438
  function registerPeek(program2) {
434
439
  program2.command("peek <agent-id>").description("show recent output from one agent").option("-n, --lines <n>", "number of lines", "20").option("--json", "output JSON with lines array").action((id, opts) => {
435
440
  const agent = resolveAgent(id);
@@ -525,7 +530,7 @@ function registerAgents(program2) {
525
530
  });
526
531
  }
527
532
 
528
- // src/cli/history.ts
533
+ // src/surfaces/cli/history.ts
529
534
  function registerDeleteRun(program2) {
530
535
  program2.command("delete-run <run-id>").description("delete an ended run").option("-y, --yes", "confirm delete").action((id, opts) => {
531
536
  requireDestructiveConfirmation(opts, "delete run");
@@ -561,7 +566,7 @@ function registerDeleteHistory(program2) {
561
566
  });
562
567
  }
563
568
 
564
- // src/cli/providers.ts
569
+ // src/surfaces/cli/providers.ts
565
570
  function registerProviders(program2) {
566
571
  program2.command("providers").description("list providers with availability and known models").option("--json", "output JSON array").option("--models", "also print each provider's known models").action((opts) => {
567
572
  const available = detectAvailable();
@@ -585,7 +590,7 @@ function registerProviders(program2) {
585
590
  });
586
591
  }
587
592
 
588
- // src/cli/approvals.ts
593
+ // src/surfaces/cli/approvals.ts
589
594
  function registerApprovals(program2) {
590
595
  program2.command("approvals").description("list pending approvals").option("--json", "output JSON array").action((opts) => {
591
596
  const approvals = listRunApprovals(void 0, "pending");
@@ -625,7 +630,7 @@ function registerDeny(program2) {
625
630
  });
626
631
  }
627
632
 
628
- // src/cli/setup.ts
633
+ // src/surfaces/cli/setup.ts
629
634
  function registerSetup(program2) {
630
635
  program2.command("setup").description("check your setup and connect installed CLIs (the first-run wizard)").option("--attach", "connect reevesagents to every installed host CLI (default only reports)").option("--json", "print the onboarding state as JSON").action(async (opts) => {
631
636
  try {
@@ -746,7 +751,7 @@ function registerDoctor(program2) {
746
751
  });
747
752
  }
748
753
 
749
- // src/cli/hosts.ts
754
+ // src/surfaces/cli/hosts.ts
750
755
  function registerHosts(program2) {
751
756
  program2.command("hosts").description("list MCP host CLIs and whether reevesagents is attached").option("--json", "output JSON array").action((opts) => {
752
757
  const hosts = hostStatus();
@@ -812,7 +817,7 @@ function registerDetach(program2) {
812
817
  function registerMcp(program2) {
813
818
  program2.command("mcp").description("start the agent control MCP server over stdio (for CLIs that have it attached)").action(async () => {
814
819
  try {
815
- const { startAgentMcpServer } = await import("./server-R2A7E5WC.js");
820
+ const { startAgentMcpServer } = await import("./server-KHCFIUJH.js");
816
821
  await startAgentMcpServer();
817
822
  } catch (err) {
818
823
  console.error(err instanceof Error ? err.message : String(err));
@@ -821,7 +826,7 @@ function registerMcp(program2) {
821
826
  });
822
827
  }
823
828
 
824
- // src/cli/config.ts
829
+ // src/surfaces/cli/config.ts
825
830
  function registerConfig(program2) {
826
831
  program2.command("config [key] [value]").description(`show config, get one value, or set one (keys: ${CONFIG_FIELDS.map((field) => field.key).join(", ")})`).option("--json", "output JSON for show or get").action((key, value, opts) => {
827
832
  try {
@@ -852,7 +857,7 @@ function registerConfig(program2) {
852
857
  });
853
858
  }
854
859
 
855
- // src/cli/presets.ts
860
+ // src/surfaces/cli/presets.ts
856
861
  function registerPresets(program2) {
857
862
  program2.command("presets").description("list saved presets").option("--json", "output JSON array").action((opts) => {
858
863
  const presets = listPresets();
@@ -902,15 +907,15 @@ function registerStartPreset(program2) {
902
907
  });
903
908
  }
904
909
 
905
- // src/cli/web.ts
910
+ // src/surfaces/cli/web.ts
906
911
  async function runWeb(opts) {
907
- const { checkWebExtras, webExtrasMessage } = await import("./extras-25AF6TAR.js");
912
+ const { checkWebExtras, webExtrasMessage } = await import("./extras-MWGWGEPB.js");
908
913
  const extras = await checkWebExtras();
909
914
  if (!extras.ok) {
910
915
  console.error(webExtrasMessage(extras.missing));
911
916
  process.exit(1);
912
917
  }
913
- const { startWebServer } = await import("./server-WLXS227K.js");
918
+ const { startWebServer } = await import("./server-GJTDNSX7.js");
914
919
  const parsed = opts.port ? Number.parseInt(opts.port, 10) : void 0;
915
920
  const handle = await startWebServer({
916
921
  port: parsed !== void 0 && Number.isFinite(parsed) ? parsed : void 0,
@@ -933,7 +938,7 @@ function registerWeb(program2) {
933
938
  });
934
939
  }
935
940
 
936
- // src/cli/index.ts
941
+ // src/surfaces/cli/index.ts
937
942
  var program = new Command();
938
943
  program.name("reevesagents").description("local tmux-first workspace manager for AI CLI agents").version(REEVESAGENTS_VERSION).addHelpText("after", `
939
944
  First steps:
@@ -981,12 +986,12 @@ async function renderTui() {
981
986
  const [{ default: React }, { render }, { Router }] = await Promise.all([
982
987
  import("react"),
983
988
  import("ink"),
984
- import("./router-RZANKWMI.js")
989
+ import("./router-2LPA3MHU.js")
985
990
  ]);
986
991
  try {
987
992
  await render(React.createElement(Router), { alternateScreen: false }).waitUntilExit();
988
993
  } finally {
989
- const { closeTuiWebServer } = await import("./tui-launch-6V756ZBI.js");
994
+ const { closeTuiWebServer } = await import("./tui-launch-XYYH3XEY.js");
990
995
  await closeTuiWebServer();
991
996
  }
992
997
  process.exit(0);
@@ -3,10 +3,10 @@ import {
3
3
  WEB_EXTRA_MODULES,
4
4
  checkWebExtras,
5
5
  webExtrasMessage
6
- } from "./chunk-D24DQQ6V.js";
6
+ } from "./chunk-Q3WWQP2R.js";
7
7
  export {
8
8
  WEB_EXTRA_MODULES,
9
9
  checkWebExtras,
10
10
  webExtrasMessage
11
11
  };
12
- //# sourceMappingURL=extras-25AF6TAR.js.map
12
+ //# sourceMappingURL=extras-MWGWGEPB.js.map
package/dist/index.d.ts CHANGED
@@ -54,6 +54,7 @@ interface AgentRecord {
54
54
  tmux_session: string;
55
55
  tmux_window_id: string;
56
56
  tmux_pane_id: string;
57
+ pane_pid?: number | null;
57
58
  rc_enabled: boolean;
58
59
  permissions: Permissions;
59
60
  headless?: boolean;
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  modelDisplayName,
7
7
  modelSourceForProvider,
8
8
  modelValuesForProvider
9
- } from "./chunk-GNS5ULTD.js";
9
+ } from "./chunk-EZJQYBYP.js";
10
10
  import {
11
11
  BIN,
12
12
  PROVIDERS,
@@ -39,8 +39,8 @@ import {
39
39
  startRun,
40
40
  stateRoot,
41
41
  stopRun
42
- } from "./chunk-GSWMKYSU.js";
43
- import "./chunk-D24DQQ6V.js";
42
+ } from "./chunk-HHNMES47.js";
43
+ import "./chunk-Q3WWQP2R.js";
44
44
  export {
45
45
  BIN,
46
46
  MODEL_CATALOG,
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // src/web/open-browser.ts
3
+ // src/surfaces/webui/open-browser.ts
4
4
  import { spawn } from "child_process";
5
5
  function browserOpenCommand(url, env = process.env, platform = process.platform) {
6
6
  if (platform === "darwin") return { cmd: "open", args: [url] };
@@ -23,4 +23,4 @@ export {
23
23
  browserOpenCommand,
24
24
  openBrowser
25
25
  };
26
- //# sourceMappingURL=open-browser-DRSIJQ37.js.map
26
+ //# sourceMappingURL=open-browser-IQ5MTCWZ.js.map