reevesagents 1.5.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.
@@ -6,39 +6,43 @@ import {
6
6
  // src/core/model-data.ts
7
7
  var CC_MODEL_SOURCE = "curated Claude Code aliases";
8
8
  var CC_MODELS = [
9
- "sonnet",
9
+ "fable",
10
10
  "opus",
11
+ "sonnet",
11
12
  "haiku"
12
13
  ];
13
14
  var CODEX_MODEL_SOURCE = "curated Codex CLI model ids";
14
15
  var CODEX_MODELS = [
15
- "gpt-5-codex",
16
- "gpt-5"
16
+ "gpt-5.6-sol",
17
+ "gpt-5.5",
18
+ "gpt-5.4-mini"
17
19
  ];
18
20
  var OPENCODE_MODEL_SOURCE = "curated OpenCode provider/model ids";
19
21
  var OPENCODE_MODELS = [
20
- "anthropic/claude-sonnet-4-5",
21
- "anthropic/claude-opus-4-1",
22
+ "opencode/claude-sonnet-4-6",
23
+ "opencode/claude-opus-4-8",
24
+ "opencode/gpt-5.2-codex",
25
+ "anthropic/claude-opus-4-8",
22
26
  "anthropic/claude-haiku-4-5",
23
- "openai/gpt-5-codex",
24
- "openai/gpt-5"
27
+ "openai/gpt-5.5"
25
28
  ];
26
29
  var HERMES_MODEL_SOURCE = "curated Hermes model ids";
27
30
  var HERMES_MODELS = [
28
- "anthropic/claude-sonnet-4",
29
- "anthropic/claude-opus-4",
30
- "anthropic/claude-haiku-4-5",
31
- "openai/gpt-5"
31
+ "anthropic:claude-opus-4-8",
32
+ "anthropic:claude-fable-5",
33
+ "openai-codex:gpt-5.5",
34
+ "openai-codex:gpt-5.4-mini"
32
35
  ];
33
36
  var KIMI_MODEL_SOURCE = "curated Kimi Code model aliases";
34
37
  var KIMI_MODELS = [
35
- "kimi-code/kimi-for-coding"
38
+ "kimi-code/k3",
39
+ "kimi-code/kimi-for-coding",
40
+ "kimi-code/kimi-for-coding-highspeed"
36
41
  ];
37
42
  var DEEPSEEK_MODEL_SOURCE = "curated DeepSeek CLI model ids";
38
43
  var DEEPSEEK_MODELS = [
39
- "deepseek-coder:6.7b",
40
- "deepseek-coder:1.3b",
41
- "deepseek-coder:33b"
44
+ "deepseek-v4-pro",
45
+ "deepseek-v4-flash"
42
46
  ];
43
47
  var PI_MODEL_SOURCE = "curated Pi model aliases";
44
48
  var PI_MODELS = [
@@ -50,7 +54,8 @@ var PI_MODELS = [
50
54
  var QWEN_MODEL_SOURCE = "curated Qwen Code model ids";
51
55
  var QWEN_MODELS = [
52
56
  "qwen3-coder-plus",
53
- "qwen3-coder-flash"
57
+ "qwen3-coder-flash",
58
+ "qwen3-coder-next"
54
59
  ];
55
60
  var AIDER_MODEL_SOURCE = "curated Aider model aliases";
56
61
  var AIDER_MODELS = [
@@ -140,11 +145,17 @@ var PROVIDER_REGISTRY = {
140
145
  models: CODEX_MODELS,
141
146
  modelSource: CODEX_MODEL_SOURCE,
142
147
  helpRequirements: [
143
- { feature: "skip permissions", tokens: ["--dangerously-bypass-approvals-and-sandbox"] }
148
+ { feature: "skip permissions", tokens: ["--dangerously-bypass-approvals-and-sandbox"] },
149
+ { feature: "config override", tokens: ["--config"] }
144
150
  ],
145
- buildArgs: ({ permissions, model }) => {
151
+ supportsEffort: true,
152
+ buildArgs: ({ permissions, model, effort }) => {
146
153
  const args = [];
147
154
  if (permissions === "skip") args.push("--dangerously-bypass-approvals-and-sandbox");
155
+ if (effort !== "default") {
156
+ const codexEffort = effort === "max" ? "xhigh" : effort;
157
+ args.push("-c", `model_reasoning_effort=${codexEffort}`);
158
+ }
148
159
  if (model) args.push("--model", model);
149
160
  return args;
150
161
  }
@@ -1395,8 +1406,9 @@ var DEFAULT_GLOBAL = {
1395
1406
  peek_interval_ms: 5e3,
1396
1407
  peek_lines: 10,
1397
1408
  max_depth: 5,
1398
- max_agents: 10,
1409
+ max_agents: 100,
1399
1410
  ready_delay_ms: 5e3,
1411
+ max_lifetime_ms: 0,
1400
1412
  default_permissions: "ask",
1401
1413
  language: DEFAULT_LANGUAGE
1402
1414
  };
@@ -1433,6 +1445,7 @@ function mergeDefaults(raw) {
1433
1445
  if (typeof g.max_depth === "number" && g.max_depth > 0) merged.global.max_depth = g.max_depth;
1434
1446
  if (typeof g.max_agents === "number" && g.max_agents > 0) merged.global.max_agents = g.max_agents;
1435
1447
  if (typeof g.ready_delay_ms === "number" && g.ready_delay_ms >= 0) merged.global.ready_delay_ms = g.ready_delay_ms;
1448
+ if (typeof g.max_lifetime_ms === "number" && g.max_lifetime_ms >= 0) merged.global.max_lifetime_ms = g.max_lifetime_ms;
1436
1449
  if (g.default_permissions === "skip" || g.default_permissions === "ask") merged.global.default_permissions = g.default_permissions;
1437
1450
  if (isLanguageCode(g.language)) merged.global.language = g.language;
1438
1451
  }
@@ -1465,6 +1478,7 @@ var CONFIG_FIELDS = [
1465
1478
  { key: "max_depth", kind: "posint", label: "max depth" },
1466
1479
  { key: "max_agents", kind: "posint", label: "max agents" },
1467
1480
  { key: "ready_delay_ms", kind: "nonneg-int", label: "ready delay (ms)" },
1481
+ { key: "max_lifetime_ms", kind: "nonneg-int", label: "max agent lifetime (ms)" },
1468
1482
  { key: "default_permissions", kind: "permissions", label: "default permissions" },
1469
1483
  { key: "language", kind: "language", label: "language" }
1470
1484
  ];
@@ -2231,6 +2245,7 @@ export {
2231
2245
  runsDir,
2232
2246
  runDir,
2233
2247
  nowIso,
2248
+ nowMs,
2234
2249
  withRunsLock,
2235
2250
  readRun,
2236
2251
  listRuns,
@@ -2243,6 +2258,8 @@ export {
2243
2258
  archiveAndRemoveRun,
2244
2259
  listAgents,
2245
2260
  findAgent,
2261
+ defaultTmuxAvailable,
2262
+ defaultTmuxTargetExists,
2246
2263
  runHasLiveTmuxTarget,
2247
2264
  autoCleanupRuns,
2248
2265
  resolveLaunchCmd,
@@ -2288,4 +2305,4 @@ export {
2288
2305
  stopRun,
2289
2306
  openTmuxTarget
2290
2307
  };
2291
- //# sourceMappingURL=chunk-LKJSQLX2.js.map
2308
+ //# sourceMappingURL=chunk-T7SPF4ZP.js.map
@@ -6,7 +6,7 @@ import {
6
6
  redactSecrets,
7
7
  runDir,
8
8
  withRunsLock
9
- } from "./chunk-LKJSQLX2.js";
9
+ } from "./chunk-T7SPF4ZP.js";
10
10
 
11
11
  // src/core/approvals.ts
12
12
  import {
@@ -168,4 +168,4 @@ export {
168
168
  resolveRunApproval,
169
169
  REEVESAGENTS_VERSION
170
170
  };
171
- //# sourceMappingURL=chunk-6RPG22BH.js.map
171
+ //# sourceMappingURL=chunk-VYLFTVIQ.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  PROVIDER_DEFS
4
- } from "./chunk-LKJSQLX2.js";
4
+ } from "./chunk-T7SPF4ZP.js";
5
5
 
6
6
  // src/core/model-catalog.ts
7
7
  var PROVIDER_DEFAULT_MODEL = "";
@@ -27,4 +27,4 @@ export {
27
27
  modelDisplayName,
28
28
  modelSourceForProvider
29
29
  };
30
- //# sourceMappingURL=chunk-LZMMFJYG.js.map
30
+ //# sourceMappingURL=chunk-WDJ6RTES.js.map
package/dist/cli.js CHANGED
@@ -1,17 +1,26 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ installSkills,
4
+ removeSkills,
5
+ skillsStatus
6
+ } from "./chunk-JDJW3WST.js";
2
7
  import {
3
8
  buildOnboardingState,
4
9
  runOnboarding,
10
+ suggestedAgentPrompt,
5
11
  writeTuiOpenToken
6
- } from "./chunk-OHEIERAD.js";
12
+ } from "./chunk-ICFJOMFZ.js";
13
+ import {
14
+ sweepAgents
15
+ } from "./chunk-7YW57CWK.js";
7
16
  import {
8
17
  MODEL_CATALOG
9
- } from "./chunk-LZMMFJYG.js";
18
+ } from "./chunk-WDJ6RTES.js";
10
19
  import {
11
20
  REEVESAGENTS_VERSION,
12
21
  listRunApprovals,
13
22
  resolveRunApproval
14
- } from "./chunk-6RPG22BH.js";
23
+ } from "./chunk-VYLFTVIQ.js";
15
24
  import {
16
25
  ALLOWED_KEYS,
17
26
  CONFIG_FIELDS,
@@ -53,7 +62,7 @@ import {
53
62
  startRunFromPreset,
54
63
  stopRun,
55
64
  verifyServerLaunch
56
- } from "./chunk-LKJSQLX2.js";
65
+ } from "./chunk-T7SPF4ZP.js";
57
66
  import "./chunk-D24DQQ6V.js";
58
67
 
59
68
  // src/cli.ts
@@ -234,6 +243,10 @@ function parseAgentSpec(spec) {
234
243
  }
235
244
  return { provider, nickname: nickname || void 0, model };
236
245
  }
246
+ function defaultSpawnProvider() {
247
+ const available = detectAvailable();
248
+ return PROVIDERS.find((provider) => available[provider]) ?? "codex";
249
+ }
237
250
  var EFFORT_LEVELS = ["default", "low", "medium", "high", "xhigh", "max"];
238
251
  function parseAuthModeOpt(value) {
239
252
  if (value === void 0) return void 0;
@@ -302,7 +315,7 @@ function spawnIntoRun(run, parsed, opts, available) {
302
315
  }
303
316
  program.command("spawn [agent...]").description("start a run with one or more provider agents").option("--name <name>", "run name", "run").option("--cwd <dir>", "working directory", process.cwd()).option("--prompt <text>", "initial prompt pasted into each agent", "").option("--skip", "skip permission prompts for every agent (sets permissions to skip)").option("--run <run-id>", "add the agents to an existing run instead of starting a new one").option("--auth-mode <mode>", "auth mode for every agent: default or api-key").option("--effort <level>", "reasoning effort for every agent: default, low, medium, high, xhigh, max").option("--extra-args <args>", 'extra flags appended to every agent launch, e.g. "--remote-control"').option("--json", "output JSON: the run id and the spawned agent ids").action((agentSpecs, opts) => {
304
317
  try {
305
- const specs = agentSpecs.length > 0 ? agentSpecs : ["codex"];
318
+ const specs = agentSpecs.length > 0 ? agentSpecs : [defaultSpawnProvider()];
306
319
  const parsed = specs.map(parseAgentSpec);
307
320
  const available = preflightAvailability(parsed.map((spec) => spec.provider));
308
321
  const permissions = opts.skip ? "skip" : void 0;
@@ -407,6 +420,21 @@ program.command("runs").description("list runs").option("--json", "output JSON a
407
420
  console.log(`${run.id.slice(0, 8)} ${run.view_status.padEnd(7)} ${"agent run".padEnd(9)} ${rootProvider.padEnd(14)} ${String(agents.length).padStart(2)} ${"agents".padEnd(9)} ${age(run.started_at).padEnd(4)} ${run.name} ${run.working_dir}${note ? ` ${note}` : ""}`);
408
421
  }
409
422
  });
423
+ program.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) => {
424
+ const { reaped } = sweepAgents();
425
+ if (opts.json) {
426
+ console.log(JSON.stringify(reaped, null, 2));
427
+ return;
428
+ }
429
+ if (reaped.length === 0) {
430
+ console.log("no zombie agents");
431
+ return;
432
+ }
433
+ for (const r of reaped) {
434
+ 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}`);
435
+ }
436
+ console.log(`reaped ${reaped.length} ${reaped.length === 1 ? "agent" : "agents"}`);
437
+ });
410
438
  program.command("open <id>").description("open a run tmux tab set or an agent window").action((id) => {
411
439
  openTarget(id);
412
440
  });
@@ -598,7 +626,7 @@ To connect ${state.attachable.join(", ")}, run: reevesagents setup --attach`);
598
626
  console.log(`
599
627
  verified: ${result.verify.detail}.`);
600
628
  const keys = result.attached.filter((attached) => attached.ok).map((attached) => attached.key);
601
- console.log(`Restart ${keys.join(", ")} (start a new session), then ask it: "use reevesagents to spawn a codex and summarize the README".`);
629
+ console.log(`Restart ${keys.join(", ")} (start a new session), then ask it: "${suggestedAgentPrompt(state.installedProviders)}".`);
602
630
  } else if (result.verify) {
603
631
  console.log(`
604
632
  warning: the server did not start here: ${result.verify.detail}`);
@@ -625,7 +653,9 @@ program.command("attach [cli]").description("attach the reevesagents MCP to one
625
653
  try {
626
654
  const results = cli ? [attach(cli, opts.force)] : attachAll(opts.force);
627
655
  if (results.length === 0) {
628
- console.log("no installed CLIs to attach");
656
+ console.log("no MCP-capable CLI is installed here.");
657
+ console.log('Install a host CLI (for example Claude Code or Codex) and sign in, then run "reevesagents attach" again.');
658
+ process.exitCode = 1;
629
659
  return;
630
660
  }
631
661
  for (const result of results) {
@@ -637,7 +667,9 @@ program.command("attach [cli]").description("attach the reevesagents MCP to one
637
667
  if (verify.ok) {
638
668
  console.log(`
639
669
  verified: ${verify.detail}.`);
640
- console.log(`restart ${attached.map((result) => result.key).join(", ")} (start a new session) to load the tools.`);
670
+ console.log(`restart ${attached.map((result) => result.key).join(", ")} (start a new session) to load the tools,`);
671
+ const available = detectAvailable();
672
+ console.log(`then ask it: "${suggestedAgentPrompt(PROVIDERS.filter((provider) => available[provider]))}".`);
641
673
  } else {
642
674
  console.log(`
643
675
  warning: the entry was written, but the server did not start here: ${verify.detail}`);
@@ -662,6 +694,49 @@ program.command("detach <cli>").description("detach the reevesagents MCP from on
662
694
  process.exit(1);
663
695
  }
664
696
  });
697
+ program.command("skills [action]").description("install the reevesagents skill for skill-aware CLIs (action: status, install, remove)").option("--json", "output JSON").action((action, opts) => {
698
+ const verb = action ?? "status";
699
+ try {
700
+ if (verb === "install") {
701
+ const results = installSkills();
702
+ if (opts.json) {
703
+ console.log(JSON.stringify(results, null, 2));
704
+ return;
705
+ }
706
+ for (const r of results) console.log(`${(r.ok ? "ok" : "--").padEnd(3)} ${r.label.padEnd(24)} ${r.file}`);
707
+ console.log("\nrestart your CLIs to pick up the skill.");
708
+ if (results.some((r) => !r.ok)) process.exitCode = 1;
709
+ return;
710
+ }
711
+ if (verb === "remove") {
712
+ const results = removeSkills();
713
+ if (opts.json) {
714
+ console.log(JSON.stringify(results, null, 2));
715
+ return;
716
+ }
717
+ for (const r of results) console.log(`${(r.ok ? "ok" : "--").padEnd(3)} ${r.label.padEnd(24)} ${r.message}`);
718
+ if (results.some((r) => !r.ok)) process.exitCode = 1;
719
+ return;
720
+ }
721
+ if (verb === "status") {
722
+ const rows = skillsStatus();
723
+ if (opts.json) {
724
+ console.log(JSON.stringify(rows, null, 2));
725
+ return;
726
+ }
727
+ for (const r of rows) {
728
+ const state = !r.present ? "absent" : r.current ? "installed" : "outdated";
729
+ console.log(`${state.padEnd(10)} ${r.label.padEnd(24)} ${r.file}`);
730
+ }
731
+ console.log('\nrun "reevesagents skills install" to (re)install.');
732
+ return;
733
+ }
734
+ throw new Error(`unknown action: ${verb} (use status, install, or remove)`);
735
+ } catch (err) {
736
+ console.error(err instanceof Error ? err.message : String(err));
737
+ process.exit(1);
738
+ }
739
+ });
665
740
  program.command("doctor").description("run setup and environment health checks").option("--json", "output JSON").action((opts) => {
666
741
  const result = runDoctor();
667
742
  const anyFail = result.checks.some((check) => check.status === "fail");
@@ -770,7 +845,7 @@ program.command("web").description("start the on-demand loopback web UI for agen
770
845
  });
771
846
  program.command("mcp").description("start the agent control MCP server over stdio (for CLIs that have it attached)").action(async () => {
772
847
  try {
773
- const { startAgentMcpServer } = await import("./server-TUKVM6PW.js");
848
+ const { startAgentMcpServer } = await import("./server-AP4NN6RT.js");
774
849
  await startAgentMcpServer();
775
850
  } catch (err) {
776
851
  console.error(err instanceof Error ? err.message : String(err));
@@ -784,7 +859,7 @@ async function runWeb(opts) {
784
859
  console.error(webExtrasMessage(extras.missing));
785
860
  process.exit(1);
786
861
  }
787
- const { startWebServer } = await import("./server-BNCUJ4YU.js");
862
+ const { startWebServer } = await import("./server-Y5EO5QYV.js");
788
863
  const parsed = opts.port ? Number.parseInt(opts.port, 10) : void 0;
789
864
  const handle = await startWebServer({
790
865
  port: parsed !== void 0 && Number.isFinite(parsed) ? parsed : void 0,
@@ -803,12 +878,12 @@ async function renderTui() {
803
878
  const [{ default: React }, { render }, { Router }] = await Promise.all([
804
879
  import("react"),
805
880
  import("ink"),
806
- import("./router-7MRY24Y5.js")
881
+ import("./router-L5IRXRCH.js")
807
882
  ]);
808
883
  try {
809
884
  await render(React.createElement(Router), { alternateScreen: false }).waitUntilExit();
810
885
  } finally {
811
- const { closeTuiWebServer } = await import("./tui-launch-Y5YXPUHS.js");
886
+ const { closeTuiWebServer } = await import("./tui-launch-AGR3JF4I.js");
812
887
  await closeTuiWebServer();
813
888
  }
814
889
  process.exit(0);
package/dist/index.d.ts CHANGED
@@ -112,6 +112,7 @@ interface GlobalConfig {
112
112
  max_depth: number;
113
113
  max_agents: number;
114
114
  ready_delay_ms: number;
115
+ max_lifetime_ms: number;
115
116
  default_permissions: Permissions;
116
117
  language: LanguageCode;
117
118
  }
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  modelDisplayName,
7
7
  modelSourceForProvider,
8
8
  modelValuesForProvider
9
- } from "./chunk-LZMMFJYG.js";
9
+ } from "./chunk-WDJ6RTES.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-LKJSQLX2.js";
42
+ } from "./chunk-T7SPF4ZP.js";
43
43
  import "./chunk-D24DQQ6V.js";
44
44
  export {
45
45
  BIN,
@@ -2,20 +2,23 @@
2
2
  import {
3
3
  buildOnboardingState,
4
4
  readTuiOpenToken
5
- } from "./chunk-OHEIERAD.js";
5
+ } from "./chunk-ICFJOMFZ.js";
6
+ import {
7
+ sweepAgentsThrottled
8
+ } from "./chunk-7YW57CWK.js";
6
9
  import {
7
10
  translate,
8
11
  translatePhrase
9
- } from "./chunk-BWJKK6LM.js";
12
+ } from "./chunk-J2DD52HJ.js";
10
13
  import {
11
14
  modelDisplayName,
12
15
  modelValuesForProvider
13
- } from "./chunk-LZMMFJYG.js";
16
+ } from "./chunk-WDJ6RTES.js";
14
17
  import {
15
18
  REEVESAGENTS_VERSION,
16
19
  listRunApprovals,
17
20
  resolveRunApproval
18
- } from "./chunk-6RPG22BH.js";
21
+ } from "./chunk-VYLFTVIQ.js";
19
22
  import {
20
23
  CONFIG_FIELDS,
21
24
  DEFAULT_LANGUAGE,
@@ -70,11 +73,11 @@ import {
70
73
  startRunFromPreset,
71
74
  stateRoot,
72
75
  stopRun
73
- } from "./chunk-LKJSQLX2.js";
76
+ } from "./chunk-T7SPF4ZP.js";
74
77
  import "./chunk-D24DQQ6V.js";
75
78
  import {
76
79
  startWebFromTui
77
- } from "./chunk-HL5MTR5M.js";
80
+ } from "./chunk-S4JLBMK4.js";
78
81
 
79
82
  // src/tui/router.tsx
80
83
  import { createContext as createContext6, useContext as useContext6, useState as useState37, useCallback as useCallback5, useEffect as useEffect17, useRef as useRef4 } from "react";
@@ -1139,6 +1142,7 @@ function Runs() {
1139
1142
  const [selectedIdx, setSelectedIdx] = useState8(0);
1140
1143
  const [runScroll, setRunScroll] = useState8(0);
1141
1144
  function refresh() {
1145
+ sweepAgentsThrottled();
1142
1146
  autoCleanupRuns();
1143
1147
  const next = listRuns();
1144
1148
  setRuns((prev) => {
@@ -5318,18 +5322,20 @@ function AgentControl() {
5318
5322
  }
5319
5323
  function toggleHost(host) {
5320
5324
  if (host.manual || !host.installed) return;
5321
- const res = host.attached ? detach(host.key) : attach(host.key);
5322
- 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);
5323
5328
  setRefreshKey((k) => k + 1);
5324
5329
  }
5325
5330
  function runAttachAll() {
5326
5331
  const results = attachAll();
5327
5332
  const ok = results.filter((r) => r.ok).length;
5333
+ const toast = t("agentControl.attachAllToast", { ok, total: results.length });
5328
5334
  setResult({
5329
5335
  key: "all",
5330
5336
  label: t("agentControl.attachAll"),
5331
5337
  ok: results.every((r) => r.ok),
5332
- message: t("agentControl.attachAllToast", { ok, total: results.length })
5338
+ message: ok > 0 ? `${toast} \u2014 ${t("agentControl.restartHint")}` : toast
5333
5339
  });
5334
5340
  setRefreshKey((k) => k + 1);
5335
5341
  }
@@ -6566,4 +6572,4 @@ export {
6566
6572
  nextHistoryOnReset,
6567
6573
  useRouter
6568
6574
  };
6569
- //# sourceMappingURL=router-7MRY24Y5.js.map
6575
+ //# sourceMappingURL=router-L5IRXRCH.js.map
@@ -1,11 +1,19 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ installSkills,
4
+ skillsStatus
5
+ } from "./chunk-JDJW3WST.js";
6
+ import {
7
+ sweepAgents,
8
+ sweepAgentsThrottled
9
+ } from "./chunk-7YW57CWK.js";
2
10
  import {
3
11
  REEVESAGENTS_VERSION,
4
12
  createRunApproval,
5
13
  listRunApprovals,
6
14
  readRunApproval,
7
15
  resolveRunApproval
8
- } from "./chunk-6RPG22BH.js";
16
+ } from "./chunk-VYLFTVIQ.js";
9
17
  import {
10
18
  ALLOWED_KEYS,
11
19
  BIN,
@@ -43,7 +51,7 @@ import {
43
51
  startRunFromPreset,
44
52
  startRunWithHead,
45
53
  stopRun
46
- } from "./chunk-LKJSQLX2.js";
54
+ } from "./chunk-T7SPF4ZP.js";
47
55
  import "./chunk-D24DQQ6V.js";
48
56
 
49
57
  // src/mcp/server.ts
@@ -311,7 +319,10 @@ var TOOLS = [
311
319
  name: "list",
312
320
  description: "List every live run and the agents in each, with their ids, status, provider, and tmux info. Start here to find a run_id or agent_id for the other tools. Ended runs are in list_history.",
313
321
  inputSchema: { type: "object", properties: {} },
314
- handler: () => ok(listRuns().map((run) => ({ ...run, agents: listAgents(run.id) })))
322
+ handler: () => {
323
+ sweepAgentsThrottled();
324
+ return ok(listRuns().map((run) => ({ ...run, agents: listAgents(run.id) })));
325
+ }
315
326
  },
316
327
  {
317
328
  name: "list_providers",
@@ -458,15 +469,21 @@ var TOOLS = [
458
469
  inputSchema: { type: "object", properties: {} },
459
470
  handler: () => ok(runDoctor().checks)
460
471
  },
472
+ {
473
+ name: "reap",
474
+ description: "Sweep for zombie agents and end them: any whose tmux window has died, plus any older than max_lifetime_ms when that is set above 0 (see get_config). Returns each reaped agent with the reason (window-gone or lifetime-exceeded) and its age. This runs on its own in the background; call it to force an immediate sweep, e.g. after a crash or before relying on list.",
475
+ inputSchema: { type: "object", properties: {} },
476
+ handler: () => ok(sweepAgents())
477
+ },
461
478
  {
462
479
  name: "get_config",
463
- description: "Read the global reevesagents settings: peek_interval_ms, peek_lines, max_depth, max_agents (the per-run agent cap), ready_delay_ms, default_permissions, and language. Check max_agents here when a spawn is rejected for hitting the cap.",
480
+ description: "Read the global reevesagents settings: peek_interval_ms, peek_lines, max_depth, max_agents (the per-run agent cap), ready_delay_ms, max_lifetime_ms (auto-reap agents older than this; 0 disables), default_permissions, and language. Check max_agents here when a spawn is rejected for hitting the cap.",
464
481
  inputSchema: { type: "object", properties: {} },
465
482
  handler: () => ok(loadConfig().global)
466
483
  },
467
484
  {
468
485
  name: "set_config",
469
- description: 'Change one or more global settings and save them. Pass only the fields to change. Counts must be positive integers (ready_delay_ms may be 0); default_permissions is ask or skip; language is a supported code such as en or tr. Example: raise the per-run agent cap with { "max_agents": 20 }. Returns the saved settings.',
486
+ description: 'Change one or more global settings and save them. Pass only the fields to change. Counts must be positive integers (ready_delay_ms and max_lifetime_ms may be 0); default_permissions is ask or skip; language is a supported code such as en or tr. Example: raise the per-run agent cap with { "max_agents": 20 }, or auto-kill agents running longer than an hour with { "max_lifetime_ms": 3600000 }. Returns the saved settings.',
470
487
  inputSchema: {
471
488
  type: "object",
472
489
  properties: {
@@ -475,6 +492,7 @@ var TOOLS = [
475
492
  max_depth: { type: "number", description: "Spawn recursion cap." },
476
493
  max_agents: { type: "number", description: "Max agents per run." },
477
494
  ready_delay_ms: { type: "number", description: "Delay before the startup prompt is injected." },
495
+ max_lifetime_ms: { type: "number", description: "Auto-reap any agent older than this many ms on the next sweep. 0 disables lifetime reaping." },
478
496
  default_permissions: { type: "string", enum: ["ask", "skip"], description: "Permission mode used when a spawn omits one." },
479
497
  language: { type: "string", description: "UI language code for the TUI and web UI, e.g. en, tr." }
480
498
  }
@@ -572,6 +590,17 @@ var TOOLS = [
572
590
  required: ["key"]
573
591
  },
574
592
  handler: (a) => ok(detach(asString(a.key)))
593
+ },
594
+ {
595
+ name: "install_skills",
596
+ description: "Install the reevesagents Agent Skill so skill-aware CLIs (Claude Code, Codex, Kimi, OpenCode) learn to drive reevesagents on their own. Writes one SKILL.md to the two shared skill directories under the home dir. Pass no arguments; call with status omitted to install, or read the returned rows to see where it landed. The user must restart their CLIs to pick it up.",
597
+ inputSchema: {
598
+ type: "object",
599
+ properties: {
600
+ status: { type: "boolean", description: "When true, only report where the skill is installed without writing anything." }
601
+ }
602
+ },
603
+ handler: (a) => ok(a.status === true ? skillsStatus() : installSkills())
575
604
  }
576
605
  ];
577
606
  var MCP_TOOLS = TOOLS.map(({ name, description, inputSchema }) => ({ name, description, inputSchema }));
@@ -586,32 +615,41 @@ function handleAgentMcpTool(name, a) {
586
615
  }
587
616
  }
588
617
  var GUIDE_URI = "reevesagents://guide";
589
- var MCP_INSTRUCTIONS = `reevesagents lets you run and steer other AI CLI agents from this session: Claude Code, Codex, Kimi, Qwen, OpenCode, Hermes, and more, each in its own tmux window. Hand slices of work to other models, then read or redirect what they do.
618
+ var MCP_INSTRUCTIONS = `reevesagents lets you, from this session, run and steer other AI coding CLIs (Claude Code, Codex, Kimi, Qwen, OpenCode, Hermes, and more), each in its own tmux window. Delegate slices of work to other models, then poll or redirect them. reevesagents never proxies model traffic; each CLI uses its own login.
590
619
 
591
620
  Drive loop:
592
- 1. list_providers - which CLIs are installed here and their models.
593
- 2. spawn { provider, task } - start an agent; returns agent_id and run_id. Omit run_id to keep adding agents to the same run.
594
- 3. read { agent_id } - an agent's recent output.
595
- 4. send_text { agent_id, text } then send_key { agent_id, key: "enter" } - type a message and submit it. send_text alone does NOT submit.
621
+ 1. list_providers - the CLIs installed here and their models. Spawn only these.
622
+ 2. spawn { provider, task } - start an agent; returns agent_id and run_id. Omit run_id to keep agents in one run (a team); pass run_id to add to an existing run. Set permissions:"skip" for an autonomous worker when no human is there to approve its prompts.
623
+ 3. read { agent_id } - the agent's recent output. spawn is fire-and-forget: it returns ids, not answers, so poll read until the agent replies or its output settles. A freshly spawned agent may sit at a login or trust prompt; read first to check.
624
+ 4. send_text { agent_id, text } then send_key { agent_id, key: "enter" } - type a message, then submit it. send_text alone does NOT submit.
596
625
  5. kill { agent_id } or stop { run_id } when done.
597
626
 
598
- Every id comes from spawn or list. Read the reevesagents://guide resource for a worked example.`;
627
+ Team in one call sequence: spawn several providers with run_id omitted and one task each, then poll read on each agent_id. Every id comes from spawn or list. Full worked example: read the reevesagents://guide resource.`;
599
628
  var GUIDE_TEXT = `# reevesagents: drive a team of AI CLIs
600
629
 
601
630
  You can spawn and steer other coding CLIs from here. Each agent is a real CLI in its own tmux window on this machine. reevesagents never proxies model traffic or stores credentials; each CLI uses its own login.
602
631
 
603
632
  ## Worked example: hand a task to Codex, then steer it
604
- 1. list_providers confirm "codex" is available
633
+ 1. list_providers confirm "codex" is installed here
605
634
  2. spawn { "provider": "codex", "task": "summarize README.md" }
606
635
  returns { "agent_id": "ab12...", "run_id": "cd34..." }
607
- 3. read { "agent_id": "ab12..." } see what it produced
636
+ 3. read { "agent_id": "ab12..." } poll until it answers (spawn is fire-and-forget)
608
637
  4. send_text { "agent_id": "ab12...", "text": "now write tests for it" }
609
- send_key { "agent_id": "ab12...", "key": "enter" }
638
+ send_key { "agent_id": "ab12...", "key": "enter" } send_text alone does NOT submit
610
639
  5. kill { "agent_id": "ab12..." } stop it when finished
611
640
 
641
+ ## Spawn a team
642
+ Spawn several agents with run_id omitted so they land in one run, then poll each:
643
+ spawn { "provider": "cc", "task": "lead: coordinate the others", "permissions": "skip" }
644
+ spawn { "provider": "codex", "task": "worker: the API slice", "permissions": "skip" }
645
+ spawn { "provider": "kimi", "task": "worker: the docs" }
646
+ Then read each agent_id, and send_text + send_key enter to redirect any of them.
647
+
612
648
  ## Notes
613
649
  - send_text types but does not submit; always follow it with send_key enter.
614
650
  - Omit run_id on spawn to add agents to the run you started; pass run_id to target a specific run.
651
+ - permissions:"skip" runs a worker autonomously (no per-action approval); use it when no human will sit and approve.
652
+ - A freshly spawned agent may sit at a login or trust screen; read its output before sending work.
615
653
  - list shows every run and agent; read shows recent output (20 lines by default).
616
654
  - Spawned agents are plain CLIs and cannot spawn others unless you attach this MCP to them too.`;
617
655
  function listMcpResources() {
@@ -639,11 +677,19 @@ function readMcpResource(uri) {
639
677
  }
640
678
  throw new Error(`Unknown resource: ${uri}`);
641
679
  }
680
+ var BACKGROUND_REAP_INTERVAL_MS = 3e4;
642
681
  async function startAgentMcpServer() {
643
682
  const server = new Server(
644
683
  { name: "reevesagents", version: REEVESAGENTS_VERSION },
645
684
  { capabilities: { tools: {}, resources: {} }, instructions: MCP_INSTRUCTIONS }
646
685
  );
686
+ const reapTimer = setInterval(() => {
687
+ try {
688
+ sweepAgents();
689
+ } catch {
690
+ }
691
+ }, BACKGROUND_REAP_INTERVAL_MS);
692
+ reapTimer.unref();
647
693
  server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: MCP_TOOLS }));
648
694
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
649
695
  const { name, arguments: args = {} } = request.params;
@@ -667,4 +713,4 @@ export {
667
713
  sessionRunIsLive,
668
714
  startAgentMcpServer
669
715
  };
670
- //# sourceMappingURL=server-TUKVM6PW.js.map
716
+ //# sourceMappingURL=server-AP4NN6RT.js.map