reevesagents 1.7.0 → 1.7.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.7.2](https://github.com/mertkayacs/reevesagents/compare/v1.7.1...v1.7.2) (2026-07-27)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **mcp:** recognize Kimi Code as a host instead of reporting it detached ([#20](https://github.com/mertkayacs/reevesagents/issues/20)) ([d932fcb](https://github.com/mertkayacs/reevesagents/commit/d932fcbd8f1c6fab44b8e870f9f874a21721d192)), closes [#19](https://github.com/mertkayacs/reevesagents/issues/19)
9
+
10
+ ## [1.7.1](https://github.com/mertkayacs/reevesagents/compare/v1.7.0...v1.7.1) (2026-07-26)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **runtime:** verify tmux ids belong to their run session before targeting them ([#18](https://github.com/mertkayacs/reevesagents/issues/18)) ([c6e9e08](https://github.com/mertkayacs/reevesagents/commit/c6e9e089fdea40297870ee75165c58209423a09e)), closes [#17](https://github.com/mertkayacs/reevesagents/issues/17)
16
+
3
17
  # [1.7.0](https://github.com/mertkayacs/reevesagents/compare/v1.6.2...v1.7.0) (2026-07-26)
4
18
 
5
19
 
package/README.md CHANGED
@@ -327,7 +327,9 @@ remove. ReevesAgents only calls each CLI's own command and never edits provider
327
327
  config files by hand. OpenCode is the exception: it has no scriptable `mcp add`
328
328
  for a local server, so ReevesAgents attaches it by writing the `reevesagents`
329
329
  entry into its `~/.config/opencode/opencode.json` directly (and removes just that
330
- entry on detach).
330
+ entry on detach). Kimi Code is handled the same way: when the `kimi` on PATH is
331
+ Kimi Code rather than the legacy Kimi CLI, ReevesAgents reads its plugin and
332
+ `~/.kimi-code/mcp.json` for status and attaches through that config file.
331
333
 
332
334
  Codex sandboxes MCP tool calls by default, which blocks reevesagents from
333
335
  launching agents in tmux. Run Codex with full access when driving agents, for
@@ -947,7 +947,7 @@ function findAgent(agentId) {
947
947
  function defaultTmuxSessionExists(session) {
948
948
  if (!session) return false;
949
949
  try {
950
- const result = spawnSync2("tmux", ["has-session", "-t", session], { stdio: "ignore" });
950
+ const result = spawnSync2("tmux", ["has-session", "-t", `=${session}`], { stdio: "ignore" });
951
951
  return result.status === 0;
952
952
  } catch {
953
953
  return false;
@@ -961,12 +961,12 @@ function defaultTmuxAvailable() {
961
961
  return false;
962
962
  }
963
963
  }
964
- function defaultTmuxTargetExists(target) {
965
- if (!target) return false;
964
+ function defaultTmuxTargetExists(target, session) {
965
+ if (!target || !session) return false;
966
966
  try {
967
- const format = target.startsWith("%") ? "#{pane_id}" : "#{window_id}";
968
- const result = spawnSync2("tmux", ["display-message", "-p", "-t", target, format], { encoding: "utf8" });
969
- return result.status === 0 && result.stdout.trim() === target;
967
+ const args = target.startsWith("%") ? ["list-panes", "-s", "-t", `=${session}`, "-F", "#{pane_id}"] : ["list-windows", "-t", `=${session}`, "-F", "#{window_id}"];
968
+ const result = spawnSync2("tmux", args, { encoding: "utf8" });
969
+ return result.status === 0 && result.stdout.split("\n").some((line) => line.trim() === target);
970
970
  } catch {
971
971
  return false;
972
972
  }
@@ -976,7 +976,7 @@ function runHasLiveTmuxTarget(run, options = {}) {
976
976
  const sessionExists = options.sessionExists ?? defaultTmuxSessionExists;
977
977
  const agents = listAgents(run.id).filter((agent) => !agent.ended_at);
978
978
  const windowedAgents = agents.filter((agent) => !agent.headless && agent.tmux_window_id);
979
- if (windowedAgents.length > 0) return windowedAgents.some((agent) => targetExists(agent.tmux_window_id));
979
+ if (windowedAgents.length > 0) return windowedAgents.some((agent) => targetExists(agent.tmux_window_id, agent.tmux_session));
980
980
  return sessionExists(run.tmux_session);
981
981
  }
982
982
  function autoCleanupRuns(options = {}) {
@@ -1061,6 +1061,67 @@ function opencodeDetach() {
1061
1061
  `, "utf-8");
1062
1062
  }
1063
1063
  }
1064
+ function kimiCodeHome() {
1065
+ if (process.env.REEVES_HOME) return join2(process.env.REEVES_HOME, ".kimi-code");
1066
+ return process.env.KIMI_CODE_HOME || join2(homedir2(), ".kimi-code");
1067
+ }
1068
+ function isKimiCode(bin) {
1069
+ try {
1070
+ const out = execFileSync2(bin, ["--version"], {
1071
+ encoding: "utf8",
1072
+ timeout: STATUS_TIMEOUT_MS,
1073
+ stdio: ["ignore", "pipe", "pipe"]
1074
+ }).trim();
1075
+ return out !== "" && !/^kimi,/i.test(out);
1076
+ } catch {
1077
+ return false;
1078
+ }
1079
+ }
1080
+ function kimiCodePluginAttached() {
1081
+ try {
1082
+ const installed = JSON.parse(readFileSync2(join2(kimiCodeHome(), "plugins", "installed.json"), "utf-8"));
1083
+ return Array.isArray(installed.plugins) && installed.plugins.some((p) => p.id === SERVER_NAME && p.enabled !== false);
1084
+ } catch {
1085
+ return false;
1086
+ }
1087
+ }
1088
+ function kimiCodeMcpConfig() {
1089
+ try {
1090
+ const raw = readFileSync2(join2(kimiCodeHome(), "mcp.json"), "utf-8").trim();
1091
+ return raw ? JSON.parse(raw) : {};
1092
+ } catch {
1093
+ return {};
1094
+ }
1095
+ }
1096
+ function kimiCodeMcpAttached() {
1097
+ const servers = kimiCodeMcpConfig().mcpServers;
1098
+ return !!servers && typeof servers === "object" && SERVER_NAME in servers;
1099
+ }
1100
+ var KIMI_CODE_FILE_OPS = {
1101
+ attached: () => kimiCodePluginAttached() || kimiCodeMcpAttached(),
1102
+ attach: (cmd) => {
1103
+ if (kimiCodePluginAttached()) return;
1104
+ const path = join2(kimiCodeHome(), "mcp.json");
1105
+ const cfg = kimiCodeMcpConfig();
1106
+ const servers = typeof cfg.mcpServers === "object" && cfg.mcpServers !== null ? cfg.mcpServers : {};
1107
+ servers[SERVER_NAME] = { command: cmd.command, args: cmd.args };
1108
+ cfg.mcpServers = servers;
1109
+ mkdirSync2(dirname2(path), { recursive: true });
1110
+ writeFileSync2(path, `${JSON.stringify(cfg, null, 2)}
1111
+ `, "utf-8");
1112
+ },
1113
+ detach: () => {
1114
+ const path = join2(kimiCodeHome(), "mcp.json");
1115
+ if (!existsSync2(path)) return;
1116
+ const cfg = kimiCodeMcpConfig();
1117
+ const servers = cfg.mcpServers;
1118
+ if (servers && SERVER_NAME in servers) {
1119
+ delete servers[SERVER_NAME];
1120
+ writeFileSync2(path, `${JSON.stringify(cfg, null, 2)}
1121
+ `, "utf-8");
1122
+ }
1123
+ }
1124
+ };
1064
1125
  function resolveLaunchCmd(entry = process.argv[1]) {
1065
1126
  if (entry) {
1066
1127
  try {
@@ -1127,6 +1188,11 @@ function hostBin(host) {
1127
1188
  function hostLabel(host) {
1128
1189
  return PROVIDER_REGISTRY[host.provider].displayName;
1129
1190
  }
1191
+ function hostFileOps(host) {
1192
+ if (host.file) return host.file;
1193
+ if (host.provider === "kimi" && isKimiCode(hostBin(host))) return KIMI_CODE_FILE_OPS;
1194
+ return void 0;
1195
+ }
1130
1196
  function isInstalled(bin) {
1131
1197
  try {
1132
1198
  execFileSync2("which", [bin], { stdio: "pipe" });
@@ -1167,12 +1233,13 @@ function findHost(key) {
1167
1233
  function hostStatus() {
1168
1234
  return HOSTS.map((host) => {
1169
1235
  const installed = isInstalled(hostBin(host));
1236
+ const file = installed ? hostFileOps(host) : void 0;
1170
1237
  return {
1171
1238
  key: host.provider,
1172
1239
  bin: hostBin(host),
1173
1240
  label: hostLabel(host),
1174
1241
  installed,
1175
- attached: installed && (host.file ? host.file.attached() : isAttached(host)),
1242
+ attached: installed && (file ? file.attached() : isAttached(host)),
1176
1243
  manual: host.add === void 0 && host.file === void 0
1177
1244
  };
1178
1245
  });
@@ -1191,9 +1258,10 @@ function attach(key, force = false) {
1191
1258
  if (!isInstalled(hostBin(host))) {
1192
1259
  return { key, label, ok: false, message: `${hostBin(host)} is not installed` };
1193
1260
  }
1194
- if (host.file) {
1261
+ const file = hostFileOps(host);
1262
+ if (file) {
1195
1263
  try {
1196
- host.file.attach(resolveLaunchCmd());
1264
+ file.attach(resolveLaunchCmd());
1197
1265
  return { key, label, ok: true, message: force ? "reattached" : "attached" };
1198
1266
  } catch (err) {
1199
1267
  return { key, label, ok: false, message: `could not edit config (add it manually): ${cliError(err)}` };
@@ -1221,9 +1289,10 @@ function detach(key) {
1221
1289
  if (!isInstalled(hostBin(host))) {
1222
1290
  return { key, label, ok: false, message: `${hostBin(host)} is not installed` };
1223
1291
  }
1224
- if (host.file) {
1292
+ const file = hostFileOps(host);
1293
+ if (file) {
1225
1294
  try {
1226
- host.file.detach();
1295
+ file.detach();
1227
1296
  return { key, label, ok: true, message: "detached" };
1228
1297
  } catch (err) {
1229
1298
  return { key, label, ok: false, message: cliError(err) };
@@ -1238,7 +1307,8 @@ function detach(key) {
1238
1307
  }
1239
1308
  function attachAll(force = false) {
1240
1309
  return HOSTS.filter((host) => (host.add || host.file) && isInstalled(hostBin(host))).map((host) => {
1241
- const attached = host.file ? host.file.attached() : isAttached(host);
1310
+ const file = hostFileOps(host);
1311
+ const attached = file ? file.attached() : isAttached(host);
1242
1312
  if (!force && attached) {
1243
1313
  return { key: host.provider, label: hostLabel(host), ok: true, message: "already attached" };
1244
1314
  }
@@ -1803,6 +1873,23 @@ function pasteTextToPane(driver, paneId, text) {
1803
1873
  }
1804
1874
  }
1805
1875
  }
1876
+ var STALE_WINDOW_ERROR = "agent window no longer exists (tmux server may have restarted)";
1877
+ function windowInSession(driver, session, windowId) {
1878
+ if (!session || !windowId) return false;
1879
+ try {
1880
+ return driver.tmux(["list-windows", "-t", `=${session}`, "-F", "#{window_id}"]).split("\n").some((line) => line.trim() === windowId);
1881
+ } catch {
1882
+ return false;
1883
+ }
1884
+ }
1885
+ function paneInSession(driver, session, paneId) {
1886
+ if (!session || !paneId) return false;
1887
+ try {
1888
+ return driver.tmux(["list-panes", "-s", "-t", `=${session}`, "-F", "#{pane_id}"]).split("\n").some((line) => line.trim() === paneId);
1889
+ } catch {
1890
+ return false;
1891
+ }
1892
+ }
1806
1893
  function sanitizeName(raw) {
1807
1894
  const cleaned = raw.trim().replace(/[^a-zA-Z0-9_-]/g, "-").replace(/-+/g, "-").slice(0, 40);
1808
1895
  return cleaned || "run";
@@ -1902,6 +1989,7 @@ function sendDelayedStartupInput(driver, agent, config, readyDelayMs) {
1902
1989
  }
1903
1990
  function waitForReadyThenSend(previousOutput = "", waitedMs = 0) {
1904
1991
  try {
1992
+ if (!paneInSession(driver, agent.tmux_session, agent.tmux_pane_id)) return;
1905
1993
  const output = driver.tmux(["capture-pane", "-p", "-e", "-S", "-80", "-t", agent.tmux_pane_id]);
1906
1994
  if (paneLooksReady(output, previousOutput) || waitedMs >= STARTUP_READY_TIMEOUT_MS) {
1907
1995
  sendStartupTask();
@@ -2128,8 +2216,11 @@ function spawnWorker(request, options = {}) {
2128
2216
  function openReeves(runId, options = {}) {
2129
2217
  const driver = options.driver ?? realDriver;
2130
2218
  const run = readRun(runId);
2131
- if (!run.reeves_window_id) throw new Error("Reeves TUI window is unavailable for this run");
2132
- const target = `${run.reeves_session ?? run.tmux_session}:${run.reeves_window_id}`;
2219
+ const reevesSession = run.reeves_session ?? run.tmux_session;
2220
+ if (!run.reeves_window_id || !windowInSession(driver, reevesSession, run.reeves_window_id)) {
2221
+ throw new Error("Reeves TUI window is unavailable for this run");
2222
+ }
2223
+ const target = `${reevesSession}:${run.reeves_window_id}`;
2133
2224
  try {
2134
2225
  driver.tmux(["switch-client", "-t", target]);
2135
2226
  } catch {
@@ -2150,6 +2241,7 @@ function openAgent(agentId, options = {}) {
2150
2241
  const driver = options.driver ?? realDriver;
2151
2242
  const agent = findAgent(agentId);
2152
2243
  if (agent.headless || !agent.tmux_window_id) throw new Error("This agent is headless - no tmux window exists");
2244
+ if (!windowInSession(driver, agent.tmux_session, agent.tmux_window_id)) throw new Error(STALE_WINDOW_ERROR);
2153
2245
  const target = `${agent.tmux_session}:${agent.tmux_window_id}`;
2154
2246
  try {
2155
2247
  driver.tmux(["switch-client", "-t", target]);
@@ -2163,6 +2255,7 @@ function peekAgent(agentId, lines = 10, options = {}) {
2163
2255
  try {
2164
2256
  const agent = findAgent(agentId);
2165
2257
  if (agent.headless || !agent.tmux_pane_id) return "(headless agent - no output)";
2258
+ if (!paneInSession(driver, agent.tmux_session, agent.tmux_pane_id)) return "";
2166
2259
  let output = driver.tmux(["capture-pane", "-p", "-e", "-S", String(-n), "-t", agent.tmux_pane_id]);
2167
2260
  if (!output.trim()) {
2168
2261
  try {
@@ -2179,6 +2272,7 @@ function sendText(agentId, text, options = {}) {
2179
2272
  const driver = options.driver ?? realDriver;
2180
2273
  const agent = findAgent(agentId);
2181
2274
  if (agent.headless || !agent.tmux_pane_id) throw new Error("This agent is headless - no tmux pane exists");
2275
+ if (!paneInSession(driver, agent.tmux_session, agent.tmux_pane_id)) throw new Error(STALE_WINDOW_ERROR);
2182
2276
  pasteTextToPane(driver, agent.tmux_pane_id, text);
2183
2277
  lastPasteAtByPane.set(agent.tmux_pane_id, Date.now());
2184
2278
  if (!agent.ended_at && agent.task_status === "queued") updateAgent(agent.run_id, agent.id, { task_status: "working" });
@@ -2200,6 +2294,7 @@ function sendKey(agentId, key, options = {}) {
2200
2294
  const agent = findAgent(agentId);
2201
2295
  if (agent.headless || !agent.tmux_pane_id) throw new Error("This agent is headless - no tmux pane exists");
2202
2296
  if (!ALLOWED_KEYS.includes(key)) throw new Error(`Unsupported key: ${String(key)}`);
2297
+ if (!paneInSession(driver, agent.tmux_session, agent.tmux_pane_id)) throw new Error(STALE_WINDOW_ERROR);
2203
2298
  if (key === "enter") {
2204
2299
  const lastPasteAt = lastPasteAtByPane.get(agent.tmux_pane_id) ?? 0;
2205
2300
  const remaining = POST_PASTE_ENTER_DELAY_MS - (Date.now() - lastPasteAt);
@@ -2219,18 +2314,23 @@ function killAgent(agentId, options = {}) {
2219
2314
  const driver = options.driver ?? realDriver;
2220
2315
  const agent = findAgent(agentId);
2221
2316
  const run = readRun(agent.run_id);
2222
- try {
2223
- driver.tmux(["kill-window", "-t", agent.tmux_window_id]);
2224
- } catch {
2317
+ if (windowInSession(driver, agent.tmux_session, agent.tmux_window_id)) {
2318
+ try {
2319
+ driver.tmux(["kill-window", "-t", agent.tmux_window_id]);
2320
+ } catch {
2321
+ }
2225
2322
  }
2226
2323
  const endedAt = nowIso();
2227
2324
  updateAgent(agent.run_id, agent.id, { ended_at: endedAt, task_status: "done" });
2228
2325
  const updatedAgent = readAgent(agent.run_id, agent.id);
2229
2326
  const endedRun = endRunIfNoLiveAgents(agent.run_id, endedAt);
2230
2327
  if (endedRun.status === "ended" || endedRun.ended_at !== null) {
2231
- try {
2232
- driver.tmux(["kill-session", "-t", run.tmux_session]);
2233
- } catch {
2328
+ const runOwnsSession = !!run.reeves_session && run.reeves_session !== run.tmux_session;
2329
+ if (runOwnsSession) {
2330
+ try {
2331
+ driver.tmux(["kill-session", "-t", `=${run.tmux_session}`]);
2332
+ } catch {
2333
+ }
2234
2334
  }
2235
2335
  archiveAndRemoveRun(run.id, "ended");
2236
2336
  }
@@ -2243,13 +2343,13 @@ function stopRun(runId, options = {}) {
2243
2343
  const runOwnsSession = !!run.reeves_session && run.reeves_session !== run.tmux_session;
2244
2344
  if (runOwnsSession) {
2245
2345
  try {
2246
- driver.tmux(["kill-session", "-t", run.tmux_session]);
2346
+ driver.tmux(["kill-session", "-t", `=${run.tmux_session}`]);
2247
2347
  } catch {
2248
2348
  }
2249
2349
  }
2250
2350
  for (const agent of listAgents(run.id)) {
2251
2351
  if (agent.ended_at) continue;
2252
- if (!runOwnsSession && agent.tmux_window_id) {
2352
+ if (!runOwnsSession && windowInSession(driver, agent.tmux_session, agent.tmux_window_id)) {
2253
2353
  try {
2254
2354
  driver.tmux(["kill-window", "-t", agent.tmux_window_id]);
2255
2355
  } catch {
@@ -2281,6 +2381,7 @@ function openTmuxTarget(id, options = {}) {
2281
2381
  } catch {
2282
2382
  throw new Error(`no run or agent found: ${id}`);
2283
2383
  }
2384
+ if (!windowInSession(driver, session, window)) throw new Error(STALE_WINDOW_ERROR);
2284
2385
  }
2285
2386
  const target = `${session}:${window}`;
2286
2387
  try {
@@ -2377,4 +2478,4 @@ export {
2377
2478
  stopRun,
2378
2479
  openTmuxTarget
2379
2480
  };
2380
- //# sourceMappingURL=chunk-YDBE6CMQ.js.map
2481
+ //# sourceMappingURL=chunk-CE6YASBF.js.map
@@ -28,7 +28,7 @@ async function startTuiWebServer() {
28
28
  const { checkWebExtras, webExtrasMessage } = await import("./extras-25AF6TAR.js");
29
29
  const extras = await checkWebExtras();
30
30
  if (!extras.ok) throw new Error(webExtrasMessage(extras.missing));
31
- const { startWebServer } = await import("./server-7UHJTQRL.js");
31
+ const { startWebServer } = await import("./server-VR6AHRBE.js");
32
32
  return startWebServer({ open: true });
33
33
  }
34
34
  async function closeTuiWebServer() {
@@ -48,4 +48,4 @@ export {
48
48
  startWebFromTui,
49
49
  closeTuiWebServer
50
50
  };
51
- //# sourceMappingURL=chunk-IIQU2TK6.js.map
51
+ //# sourceMappingURL=chunk-EA6OGFOE.js.map
@@ -6,7 +6,7 @@ import {
6
6
  listAgents,
7
7
  loadConfig,
8
8
  nowMs
9
- } from "./chunk-YDBE6CMQ.js";
9
+ } from "./chunk-CE6YASBF.js";
10
10
 
11
11
  // src/core/reaper.ts
12
12
  function sweepAgents(options = {}) {
@@ -20,7 +20,7 @@ function sweepAgents(options = {}) {
20
20
  if (agent.ended_at || agent.headless) continue;
21
21
  const ageMs = now() - new Date(agent.started_at).getTime();
22
22
  let reason = null;
23
- if (agent.tmux_window_id && !targetExists(agent.tmux_window_id)) {
23
+ if (agent.tmux_window_id && !targetExists(agent.tmux_window_id, agent.tmux_session)) {
24
24
  reason = "window-gone";
25
25
  } else if (maxLifetimeMs > 0 && ageMs > maxLifetimeMs) {
26
26
  reason = "lifetime-exceeded";
@@ -183,4 +183,4 @@ export {
183
183
  skillsStatus,
184
184
  removeSkills
185
185
  };
186
- //# sourceMappingURL=chunk-DA4YL4DE.js.map
186
+ //# sourceMappingURL=chunk-FL3LI2MU.js.map
@@ -6,7 +6,7 @@ import {
6
6
  redactSecrets,
7
7
  runDir,
8
8
  withRunsLock
9
- } from "./chunk-YDBE6CMQ.js";
9
+ } from "./chunk-CE6YASBF.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-AKAFR25Q.js.map
171
+ //# sourceMappingURL=chunk-NKT6GFCD.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  PROVIDER_DEFS
4
- } from "./chunk-YDBE6CMQ.js";
4
+ } from "./chunk-CE6YASBF.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-STFC6PVR.js.map
30
+ //# sourceMappingURL=chunk-QMRLJAEV.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  DEFAULT_LANGUAGE
4
- } from "./chunk-YDBE6CMQ.js";
4
+ } from "./chunk-CE6YASBF.js";
5
5
 
6
6
  // src/i18n/locales/en.ts
7
7
  var en = {
@@ -5712,4 +5712,4 @@ export {
5712
5712
  localeCatalog,
5713
5713
  translatePhrase
5714
5714
  };
5715
- //# sourceMappingURL=chunk-XBNUWMMW.js.map
5715
+ //# sourceMappingURL=chunk-SFF7SYI6.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  installSkills
4
- } from "./chunk-DA4YL4DE.js";
4
+ } from "./chunk-FL3LI2MU.js";
5
5
  import {
6
6
  attachAll,
7
7
  checkTmux,
@@ -11,7 +11,7 @@ import {
11
11
  resolveLaunchCmd,
12
12
  stateRoot,
13
13
  verifyServerLaunch
14
- } from "./chunk-YDBE6CMQ.js";
14
+ } from "./chunk-CE6YASBF.js";
15
15
 
16
16
  // src/core/onboard.ts
17
17
  function buildOnboardingState() {
@@ -67,4 +67,4 @@ export {
67
67
  readTuiOpenToken,
68
68
  writeTuiOpenToken
69
69
  };
70
- //# sourceMappingURL=chunk-QWZH352G.js.map
70
+ //# sourceMappingURL=chunk-TUYP7APK.js.map
package/dist/cli.js CHANGED
@@ -4,21 +4,21 @@ import {
4
4
  runOnboarding,
5
5
  suggestedAgentPrompt,
6
6
  writeTuiOpenToken
7
- } from "./chunk-QWZH352G.js";
7
+ } from "./chunk-TUYP7APK.js";
8
8
  import {
9
9
  installSkills,
10
10
  removeSkills,
11
11
  skillsStatus,
12
12
  sweepAgents
13
- } from "./chunk-DA4YL4DE.js";
13
+ } from "./chunk-FL3LI2MU.js";
14
14
  import {
15
15
  MODEL_CATALOG
16
- } from "./chunk-STFC6PVR.js";
16
+ } from "./chunk-QMRLJAEV.js";
17
17
  import {
18
18
  REEVESAGENTS_VERSION,
19
19
  listRunApprovals,
20
20
  resolveRunApproval
21
- } from "./chunk-AKAFR25Q.js";
21
+ } from "./chunk-NKT6GFCD.js";
22
22
  import {
23
23
  ALLOWED_KEYS,
24
24
  CONFIG_FIELDS,
@@ -60,7 +60,7 @@ import {
60
60
  startRunFromPreset,
61
61
  stopRun,
62
62
  verifyServerLaunch
63
- } from "./chunk-YDBE6CMQ.js";
63
+ } from "./chunk-CE6YASBF.js";
64
64
  import "./chunk-D24DQQ6V.js";
65
65
 
66
66
  // src/cli.ts
@@ -203,6 +203,12 @@ function openTuiSession(command) {
203
203
  }
204
204
  function openTarget(id) {
205
205
  const target = resolveOpenTarget(id);
206
+ if (!tmuxSessionExists(target.session)) {
207
+ throw new Error(`tmux session not found: ${target.session}`);
208
+ }
209
+ if (target.windowId.startsWith("@") && !tmuxWindowIds(target.session).includes(target.windowId)) {
210
+ throw new Error("agent window no longer exists (tmux server may have restarted)");
211
+ }
206
212
  const tmuxTarget = `${target.session}:${target.windowId}`;
207
213
  if (process.env.TMUX) {
208
214
  execFileSync("tmux", ["switch-client", "-t", tmuxTarget], { stdio: "ignore" });
@@ -841,7 +847,7 @@ program.command("web").description("start the on-demand loopback web UI for agen
841
847
  });
842
848
  program.command("mcp").description("start the agent control MCP server over stdio (for CLIs that have it attached)").action(async () => {
843
849
  try {
844
- const { startAgentMcpServer } = await import("./server-AAEBEKUH.js");
850
+ const { startAgentMcpServer } = await import("./server-KTPEQQRJ.js");
845
851
  await startAgentMcpServer();
846
852
  } catch (err) {
847
853
  console.error(err instanceof Error ? err.message : String(err));
@@ -855,7 +861,7 @@ async function runWeb(opts) {
855
861
  console.error(webExtrasMessage(extras.missing));
856
862
  process.exit(1);
857
863
  }
858
- const { startWebServer } = await import("./server-7UHJTQRL.js");
864
+ const { startWebServer } = await import("./server-VR6AHRBE.js");
859
865
  const parsed = opts.port ? Number.parseInt(opts.port, 10) : void 0;
860
866
  const handle = await startWebServer({
861
867
  port: parsed !== void 0 && Number.isFinite(parsed) ? parsed : void 0,
@@ -874,12 +880,12 @@ async function renderTui() {
874
880
  const [{ default: React }, { render }, { Router }] = await Promise.all([
875
881
  import("react"),
876
882
  import("ink"),
877
- import("./router-WHLEGC73.js")
883
+ import("./router-Q2JZ7NEX.js")
878
884
  ]);
879
885
  try {
880
886
  await render(React.createElement(Router), { alternateScreen: false }).waitUntilExit();
881
887
  } finally {
882
- const { closeTuiWebServer } = await import("./tui-launch-5VWXIMN6.js");
888
+ const { closeTuiWebServer } = await import("./tui-launch-JTZU3RFS.js");
883
889
  await closeTuiWebServer();
884
890
  }
885
891
  process.exit(0);
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  modelDisplayName,
7
7
  modelSourceForProvider,
8
8
  modelValuesForProvider
9
- } from "./chunk-STFC6PVR.js";
9
+ } from "./chunk-QMRLJAEV.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-YDBE6CMQ.js";
42
+ } from "./chunk-CE6YASBF.js";
43
43
  import "./chunk-D24DQQ6V.js";
44
44
  export {
45
45
  BIN,
@@ -2,23 +2,23 @@
2
2
  import {
3
3
  buildOnboardingState,
4
4
  readTuiOpenToken
5
- } from "./chunk-QWZH352G.js";
5
+ } from "./chunk-TUYP7APK.js";
6
6
  import {
7
7
  sweepAgentsThrottled
8
- } from "./chunk-DA4YL4DE.js";
8
+ } from "./chunk-FL3LI2MU.js";
9
9
  import {
10
10
  translate,
11
11
  translatePhrase
12
- } from "./chunk-XBNUWMMW.js";
12
+ } from "./chunk-SFF7SYI6.js";
13
13
  import {
14
14
  modelDisplayName,
15
15
  modelValuesForProvider
16
- } from "./chunk-STFC6PVR.js";
16
+ } from "./chunk-QMRLJAEV.js";
17
17
  import {
18
18
  REEVESAGENTS_VERSION,
19
19
  listRunApprovals,
20
20
  resolveRunApproval
21
- } from "./chunk-AKAFR25Q.js";
21
+ } from "./chunk-NKT6GFCD.js";
22
22
  import {
23
23
  CONFIG_FIELDS,
24
24
  DEFAULT_LANGUAGE,
@@ -73,11 +73,11 @@ import {
73
73
  startRunFromPreset,
74
74
  stateRoot,
75
75
  stopRun
76
- } from "./chunk-YDBE6CMQ.js";
76
+ } from "./chunk-CE6YASBF.js";
77
77
  import "./chunk-D24DQQ6V.js";
78
78
  import {
79
79
  startWebFromTui
80
- } from "./chunk-IIQU2TK6.js";
80
+ } from "./chunk-EA6OGFOE.js";
81
81
 
82
82
  // src/tui/router.tsx
83
83
  import { createContext as createContext6, useContext as useContext6, useState as useState37, useCallback as useCallback5, useEffect as useEffect17, useRef as useRef4 } from "react";
@@ -6572,4 +6572,4 @@ export {
6572
6572
  nextHistoryOnReset,
6573
6573
  useRouter
6574
6574
  };
6575
- //# sourceMappingURL=router-WHLEGC73.js.map
6575
+ //# sourceMappingURL=router-Q2JZ7NEX.js.map
@@ -4,14 +4,14 @@ import {
4
4
  skillsStatus,
5
5
  sweepAgents,
6
6
  sweepAgentsThrottled
7
- } from "./chunk-DA4YL4DE.js";
7
+ } from "./chunk-FL3LI2MU.js";
8
8
  import {
9
9
  REEVESAGENTS_VERSION,
10
10
  createRunApproval,
11
11
  listRunApprovals,
12
12
  readRunApproval,
13
13
  resolveRunApproval
14
- } from "./chunk-AKAFR25Q.js";
14
+ } from "./chunk-NKT6GFCD.js";
15
15
  import {
16
16
  ALLOWED_KEYS,
17
17
  BIN,
@@ -49,7 +49,7 @@ import {
49
49
  startRunFromPreset,
50
50
  startRunWithHead,
51
51
  stopRun
52
- } from "./chunk-YDBE6CMQ.js";
52
+ } from "./chunk-CE6YASBF.js";
53
53
  import "./chunk-D24DQQ6V.js";
54
54
 
55
55
  // src/mcp/server.ts
@@ -711,4 +711,4 @@ export {
711
711
  sessionRunIsLive,
712
712
  startAgentMcpServer
713
713
  };
714
- //# sourceMappingURL=server-AAEBEKUH.js.map
714
+ //# sourceMappingURL=server-KTPEQQRJ.js.map
@@ -2,15 +2,15 @@
2
2
  import {
3
3
  localeCatalog,
4
4
  translatePhrase
5
- } from "./chunk-XBNUWMMW.js";
5
+ } from "./chunk-SFF7SYI6.js";
6
6
  import {
7
7
  modelValuesForProvider
8
- } from "./chunk-STFC6PVR.js";
8
+ } from "./chunk-QMRLJAEV.js";
9
9
  import {
10
10
  REEVESAGENTS_VERSION,
11
11
  listRunApprovals,
12
12
  resolveRunApproval
13
- } from "./chunk-AKAFR25Q.js";
13
+ } from "./chunk-NKT6GFCD.js";
14
14
  import {
15
15
  CONFIG_FIELDS,
16
16
  LANGUAGE_OPTIONS,
@@ -21,6 +21,7 @@ import {
21
21
  autoCleanupRuns,
22
22
  coerceExtraArgs,
23
23
  computeRunStatus,
24
+ defaultTmuxTargetExists,
24
25
  deleteAgent,
25
26
  deletePreset,
26
27
  deleteRunHistory,
@@ -50,7 +51,7 @@ import {
50
51
  startRunFromPreset,
51
52
  stopRun,
52
53
  verifyServerLaunch
53
- } from "./chunk-YDBE6CMQ.js";
54
+ } from "./chunk-CE6YASBF.js";
54
55
  import "./chunk-D24DQQ6V.js";
55
56
 
56
57
  // src/web/server.ts
@@ -359,9 +360,14 @@ function openBridge(ws, id, bridges) {
359
360
  ws.close();
360
361
  return;
361
362
  }
363
+ if (!defaultTmuxTargetExists(target.windowId, target.session)) {
364
+ send(ws, { t: "e", m: "agent window no longer exists (tmux server may have restarted)" });
365
+ ws.close();
366
+ return;
367
+ }
362
368
  const viewer = `reevesweb_${randomBytes(4).toString("hex")}`;
363
369
  try {
364
- execFileSync("tmux", ["new-session", "-d", "-s", viewer, "-t", target.session], { stdio: "ignore" });
370
+ execFileSync("tmux", ["new-session", "-d", "-s", viewer, "-t", `=${target.session}`], { stdio: "ignore" });
365
371
  execFileSync("tmux", ["select-window", "-t", `${viewer}:${target.windowId}`], { stdio: "ignore" });
366
372
  } catch {
367
373
  try {
@@ -1016,4 +1022,4 @@ async function startWebServer(options = {}) {
1016
1022
  export {
1017
1023
  startWebServer
1018
1024
  };
1019
- //# sourceMappingURL=server-7UHJTQRL.js.map
1025
+ //# sourceMappingURL=server-VR6AHRBE.js.map
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  closeTuiWebServer,
4
4
  startWebFromTui
5
- } from "./chunk-IIQU2TK6.js";
5
+ } from "./chunk-EA6OGFOE.js";
6
6
  export {
7
7
  closeTuiWebServer,
8
8
  startWebFromTui
9
9
  };
10
- //# sourceMappingURL=tui-launch-5VWXIMN6.js.map
10
+ //# sourceMappingURL=tui-launch-JTZU3RFS.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reevesagents",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "Local tmux-first workspace manager for AI CLI agents",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.34.1",