claude-yes 1.173.1 → 1.174.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.
@@ -0,0 +1,8 @@
1
+ import "./ts-l6q9fhuc.js";
2
+ import "./logger-CDIsZ-Pp.js";
3
+ import "./versionChecker-DltRc0f8.js";
4
+ import "./pidStore-BIvsBQ8X.js";
5
+ import "./globalPidIndex-CoNr7tS8.js";
6
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DRYgob0H.js";
7
+
8
+ export { SUPPORTED_CLIS };
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-gLE006Iw.js";
1
+ import { t as CLIS_CONFIG } from "./ts-l6q9fhuc.js";
2
2
 
3
3
  //#region ts/SUPPORTED_CLIS.ts
4
4
  const SUPPORTED_CLIS = Object.keys(CLIS_CONFIG);
5
5
 
6
6
  //#endregion
7
7
  export { SUPPORTED_CLIS as t };
8
- //# sourceMappingURL=SUPPORTED_CLIS-C9ovj686.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-DRYgob0H.js.map
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env bun
2
2
  import { t as invokedCliName } from "./invokedCli-uqM2YYA7.js";
3
3
  import { n as logger } from "./logger-CDIsZ-Pp.js";
4
- import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-BvWNbsww.js";
5
- import { n as getRustBinary } from "./rustBinary-BF9k7cdQ.js";
4
+ import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-DltRc0f8.js";
5
+ import { n as getRustBinary } from "./rustBinary-B3-RzNau.js";
6
6
  import { argv } from "process";
7
7
  import { spawn } from "child_process";
8
8
  import ms from "ms";
@@ -285,7 +285,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
285
285
  const rawArg = process.argv[2];
286
286
  const managerCommands = !invokedCliName(process.argv);
287
287
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
288
- const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-C-dBjWJR.js");
288
+ const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-BeUD8RlG.js");
289
289
  if (isHelpFlag && process.argv.length === 3) {
290
290
  await cmdHelp(managerCommands);
291
291
  process.exit(0);
@@ -327,7 +327,7 @@ if (config.useRust) {
327
327
  }
328
328
  }
329
329
  if (rustBinary) {
330
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-CvEu12EF.js");
330
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-C2CKMUGB.js");
331
331
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
332
332
  if (config.verbose) {
333
333
  console.log(`[rust] Using binary: ${rustBinary}`);
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-gLE006Iw.js";
1
+ import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-l6q9fhuc.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-BvWNbsww.js";
3
+ import "./versionChecker-DltRc0f8.js";
4
4
  import "./pidStore-BIvsBQ8X.js";
5
5
  import "./globalPidIndex-CoNr7tS8.js";
6
6
 
@@ -1,7 +1,7 @@
1
1
  import { n as logger } from "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
3
  import "./configShared-0MnIQ652.js";
4
- import { D as renderLogTailLines, G as hostId, J as readInbox, K as listInboxParents, Q as notifyDir, S as listRecords, U as appendEvent, W as gcInboxes, X as daemonLockDir, Y as shouldStealLock, Z as daemonLockOwnerPath, _ as isPidAlive, c as deriveLiveState, q as liveWatchers } from "./subcommands-DweUtFJs.js";
4
+ import { D as renderLogTailLines, G as hostId, J as readInbox, K as listInboxParents, Q as notifyDir, S as listRecords, U as appendEvent, W as gcInboxes, X as daemonLockDir, Y as shouldStealLock, Z as daemonLockOwnerPath, _ as isPidAlive, c as deriveLiveState, q as liveWatchers } from "./subcommands-DYcGpfkJ.js";
5
5
  import "./e2e-jb0Hp43q.js";
6
6
  import "./webrtcLink-B7REGtK2.js";
7
7
  import "./remotes-CC-4GuJb.js";
@@ -588,4 +588,4 @@ async function ensureDaemon() {
588
588
 
589
589
  //#endregion
590
590
  export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
591
- //# sourceMappingURL=notifyDaemon-hf-hL3m5.js.map
591
+ //# sourceMappingURL=notifyDaemon-BIAiDk8X.js.map
@@ -1,4 +1,4 @@
1
- import { r as getInstalledPackage } from "./versionChecker-BvWNbsww.js";
1
+ import { r as getInstalledPackage } from "./versionChecker-DltRc0f8.js";
2
2
  import { execFileSync } from "child_process";
3
3
  import { existsSync, mkdirSync, unlinkSync } from "fs";
4
4
  import { chmod, copyFile } from "fs/promises";
@@ -225,4 +225,4 @@ async function getRustBinary(options = {}) {
225
225
 
226
226
  //#endregion
227
227
  export { getRustBinary as n, findSpawnHiddenLauncher as t };
228
- //# sourceMappingURL=rustBinary-BF9k7cdQ.js.map
228
+ //# sourceMappingURL=rustBinary-B3-RzNau.js.map
@@ -1,9 +1,9 @@
1
- import "./ts-gLE006Iw.js";
1
+ import "./ts-l6q9fhuc.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-BvWNbsww.js";
3
+ import "./versionChecker-DltRc0f8.js";
4
4
  import "./pidStore-BIvsBQ8X.js";
5
5
  import "./globalPidIndex-CoNr7tS8.js";
6
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-C9ovj686.js";
6
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DRYgob0H.js";
7
7
  import { d as resolveSpawnCwd } from "./workspaceConfig-BgqK-31W.js";
8
8
  import { createHash } from "node:crypto";
9
9
 
@@ -141,4 +141,4 @@ async function cmdSchedule(rest) {
141
141
 
142
142
  //#endregion
143
143
  export { cmdSchedule };
144
- //# sourceMappingURL=schedule-BC2MaygL.js.map
144
+ //# sourceMappingURL=schedule-OIx0pPXv.js.map
@@ -1,13 +1,13 @@
1
- import "./ts-gLE006Iw.js";
1
+ import "./ts-l6q9fhuc.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import { r as getInstalledPackage } from "./versionChecker-BvWNbsww.js";
4
- import { t as findSpawnHiddenLauncher } from "./rustBinary-BF9k7cdQ.js";
3
+ import { r as getInstalledPackage } from "./versionChecker-DltRc0f8.js";
4
+ import { t as findSpawnHiddenLauncher } from "./rustBinary-B3-RzNau.js";
5
5
  import "./pidStore-BIvsBQ8X.js";
6
6
  import { a as updateGlobalPidStatus } from "./globalPidIndex-CoNr7tS8.js";
7
7
  import { t as pgidForWrapper } from "./reaper-CWF2_ATd.js";
8
8
  import "./configShared-0MnIQ652.js";
9
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-C9ovj686.js";
10
- import { A as resolveOne, E as readPtysize, F as snapshotStatus, H as TYPING_BADGE, O as renderRawLog, S as listRecords, T as readNotes, V as writeToIpc, b as isUserTyping, f as extractNeedsInput, l as deriveLiveStatus, o as controlCodeFromName, p as extractTaskCounts, u as extractBadges } from "./subcommands-DweUtFJs.js";
9
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DRYgob0H.js";
10
+ import { A as resolveOne, E as readPtysize, F as snapshotStatus, H as TYPING_BADGE, O as renderRawLog, S as listRecords, T as readNotes, V as writeToIpc, b as isUserTyping, f as extractNeedsInput, l as deriveLiveStatus, o as controlCodeFromName, p as extractTaskCounts, u as extractBadges } from "./subcommands-DYcGpfkJ.js";
11
11
  import "./e2e-jb0Hp43q.js";
12
12
  import "./webrtcLink-B7REGtK2.js";
13
13
  import "./remotes-CC-4GuJb.js";
@@ -240,6 +240,85 @@ function resolveDaemonManager() {
240
240
  bin: pm2
241
241
  }]).find((m) => !!m) ?? null;
242
242
  }
243
+ async function globalBinDir(installer) {
244
+ const isBun = installer[1] === "add";
245
+ const query = isBun ? [
246
+ installer[0],
247
+ "pm",
248
+ "bin",
249
+ "-g"
250
+ ] : [
251
+ installer[0],
252
+ "prefix",
253
+ "-g"
254
+ ];
255
+ const p = Bun.spawn(query, {
256
+ stdout: "pipe",
257
+ stderr: "ignore"
258
+ });
259
+ if (await p.exited !== 0) return null;
260
+ const out = (await new Response(p.stdout).text()).trim();
261
+ if (!out) return null;
262
+ return isBun ? out : path.join(out, "bin");
263
+ }
264
+ async function managerRunnable(mgr) {
265
+ try {
266
+ return (await Bun.spawn([mgr.bin, "--version"], {
267
+ stdout: "ignore",
268
+ stderr: "ignore"
269
+ }).exited ?? 1) === 0;
270
+ } catch {
271
+ return false;
272
+ }
273
+ }
274
+ async function installAndVerify(pkg) {
275
+ const bun = Bun.which("bun");
276
+ const npm = Bun.which("npm");
277
+ const installer = bun ? [
278
+ bun,
279
+ "add",
280
+ "-g",
281
+ pkg
282
+ ] : npm ? [
283
+ npm,
284
+ "install",
285
+ "-g",
286
+ pkg
287
+ ] : null;
288
+ if (!installer) return null;
289
+ process.stderr.write(`ay serve install: installing ${pkg}…\n`);
290
+ const code = await Bun.spawn(installer, { stdio: [
291
+ "ignore",
292
+ "inherit",
293
+ "inherit"
294
+ ] }).exited ?? 1;
295
+ if (code !== 0) {
296
+ process.stderr.write(`ay serve install: '${installer.join(" ")}' failed (exit ${code})\n`);
297
+ return null;
298
+ }
299
+ const binDir = await globalBinDir(installer);
300
+ if (binDir) process.env.PATH = `${binDir}${path.delimiter}${process.env.PATH ?? ""}`;
301
+ const bin = Bun.which(pkg);
302
+ if (!bin) return null;
303
+ const mgr = {
304
+ id: pkg,
305
+ bin
306
+ };
307
+ if (!await managerRunnable(mgr)) {
308
+ process.stderr.write(`ay serve install: ${pkg} installed but can't exec here (likely a native/glibc mismatch)` + (pkg === "oxmgr" ? " — falling back to pm2\n" : "\n"));
309
+ return null;
310
+ }
311
+ return mgr;
312
+ }
313
+ async function bootstrapDaemonManager() {
314
+ if (process.env.AGENT_YES_NO_PM_BOOTSTRAP === "1") return null;
315
+ const candidates = process.platform === "win32" ? ["pm2", "oxmgr"] : ["oxmgr", "pm2"];
316
+ for (const pkg of candidates) {
317
+ const mgr = await installAndVerify(pkg);
318
+ if (mgr) return mgr;
319
+ }
320
+ return null;
321
+ }
243
322
  function ayServeArgv(args) {
244
323
  const ayBin = Bun.which("ay");
245
324
  return [
@@ -359,9 +438,14 @@ async function fetchDaemonVersion(port, token) {
359
438
  }
360
439
  }
361
440
  async function cmdServeDaemon(sub, args) {
362
- const mgr = resolveDaemonManager();
441
+ let mgr = resolveDaemonManager();
442
+ if (mgr && !await managerRunnable(mgr)) {
443
+ process.stderr.write(`ay serve install: ${mgr.id} is on PATH but can't exec here (likely a native/glibc mismatch) — bootstrapping a working manager…\n`);
444
+ mgr = null;
445
+ }
446
+ if (!mgr) mgr = await bootstrapDaemonManager();
363
447
  if (!mgr) {
364
- process.stderr.write("ay serve install: no process manager found (need pm2 or oxmgr)\n install with: bun add -g pm2\n or: cargo install oxmgr\n");
448
+ process.stderr.write("ay serve install: no usable process manager (need oxmgr or pm2)\n install with: bun add -g pm2\n or: bun add -g oxmgr (needs glibc ≥ 2.39 on Linux)\n");
365
449
  return 1;
366
450
  }
367
451
  if (sub === "install") {
@@ -1577,4 +1661,4 @@ Options:
1577
1661
 
1578
1662
  //#endregion
1579
1663
  export { cmdServe };
1580
- //# sourceMappingURL=serve-WTrDsdUr.js.map
1664
+ //# sourceMappingURL=serve-ClCuMror.js.map
@@ -32,7 +32,7 @@ async function cmdSetup(rest) {
32
32
  if (!existsSync(abs)) process.stderr.write(` note: that directory doesn't exist yet — create it, or agents spawned there will fail\n`);
33
33
  if (noShare) return 0;
34
34
  process.stdout.write(`\nsharing this machine to agent-yes.com…\n`);
35
- const { cmdServe } = await import("./serve-WTrDsdUr.js");
35
+ const { cmdServe } = await import("./serve-ClCuMror.js");
36
36
  return cmdServe([
37
37
  "install",
38
38
  "--share",
@@ -42,4 +42,4 @@ async function cmdSetup(rest) {
42
42
 
43
43
  //#endregion
44
44
  export { cmdSetup };
45
- //# sourceMappingURL=setup-CXuogc1k.js.map
45
+ //# sourceMappingURL=setup-Bwb6P834.js.map
@@ -1,7 +1,7 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
3
  import "./configShared-0MnIQ652.js";
4
- import { A as resolveOne, B as writeKeysPaced, C as matchKeyword, D as renderLogTailLines, E as readPtysize, F as snapshotStatus, I as stdinActivityPath, L as stopTipForCli, M as resolveResumeArgs, N as restartHintLines, O as renderRawLog, P as runSubcommand, R as submitAndConfirm, S as listRecords, T as readNotes, V as writeToIpc, _ as isPidAlive, a as cmdHelp, b as isUserTyping, c as deriveLiveState, d as extractMenu, f as extractNeedsInput, g as isExitRequest, h as isAgentStuck, i as backoffWhileTyping, j as resolveReadWindow, k as renderRawLogLines, l as deriveLiveStatus, m as finalizedLines, n as READ_PAGE_DEFAULT, o as controlCodeFromName, p as extractTaskCounts, r as TYPING_WINDOW_MS, s as cursorAbs, t as GRACEFUL_EXIT_COMMANDS, u as extractBadges, v as isSlashCommand, w as menuSelectKeys, x as lastStdinAt, y as isSubcommand, z as waitForLogQuiet } from "./subcommands-DweUtFJs.js";
4
+ import { A as resolveOne, B as writeKeysPaced, C as matchKeyword, D as renderLogTailLines, E as readPtysize, F as snapshotStatus, I as stdinActivityPath, L as stopTipForCli, M as resolveResumeArgs, N as restartHintLines, O as renderRawLog, P as runSubcommand, R as submitAndConfirm, S as listRecords, T as readNotes, V as writeToIpc, _ as isPidAlive, a as cmdHelp, b as isUserTyping, c as deriveLiveState, d as extractMenu, f as extractNeedsInput, g as isExitRequest, h as isAgentStuck, i as backoffWhileTyping, j as resolveReadWindow, k as renderRawLogLines, l as deriveLiveStatus, m as finalizedLines, n as READ_PAGE_DEFAULT, o as controlCodeFromName, p as extractTaskCounts, r as TYPING_WINDOW_MS, s as cursorAbs, t as GRACEFUL_EXIT_COMMANDS, u as extractBadges, v as isSlashCommand, w as menuSelectKeys, x as lastStdinAt, y as isSubcommand, z as waitForLogQuiet } from "./subcommands-DYcGpfkJ.js";
5
5
  import "./e2e-jb0Hp43q.js";
6
6
  import "./webrtcLink-B7REGtK2.js";
7
7
  import "./remotes-CC-4GuJb.js";
@@ -1126,15 +1126,15 @@ async function runSubcommand(argv) {
1126
1126
  case "restart": return await cmdRestart(rest);
1127
1127
  case "note": return await cmdNote(rest);
1128
1128
  case "serve": {
1129
- const { cmdServe } = await import("./serve-WTrDsdUr.js");
1129
+ const { cmdServe } = await import("./serve-ClCuMror.js");
1130
1130
  return cmdServe(rest);
1131
1131
  }
1132
1132
  case "setup": {
1133
- const { cmdSetup } = await import("./setup-CXuogc1k.js");
1133
+ const { cmdSetup } = await import("./setup-Bwb6P834.js");
1134
1134
  return cmdSetup(rest);
1135
1135
  }
1136
1136
  case "schedule": {
1137
- const { cmdSchedule } = await import("./schedule-BC2MaygL.js");
1137
+ const { cmdSchedule } = await import("./schedule-OIx0pPXv.js");
1138
1138
  return cmdSchedule(rest);
1139
1139
  }
1140
1140
  case "remote": {
@@ -2884,6 +2884,7 @@ async function cmdSend(rest) {
2884
2884
  }
2885
2885
  const trailing = controlCodeFromName(codeName);
2886
2886
  const record = await resolveOne(keyword, opts);
2887
+ if (!/^\d+$/.test(keyword)) process.stderr.write(`ay send → pid ${record.pid} ${record.cli} @ ${shortenPath(record.cwd)}\n`);
2887
2888
  const fifoPath = record.fifo_file;
2888
2889
  if (!fifoPath) throw new Error(`pid ${record.pid}: no fifo_file recorded — this agent didn't register a stdin FIFO (an older agent, or one not started with --stdpush). Restarting it (ay restart ${record.pid}) re-registers one.`);
2889
2890
  let body;
@@ -2900,7 +2901,8 @@ async function cmdSend(rest) {
2900
2901
  process.stdout.write(`pid ${record.pid} (${record.cli}): exit requested — sent ${strategy} (${reason})\n`);
2901
2902
  return 0;
2902
2903
  }
2903
- const fullBody = (sender.agent && !isSlashCommand(body) ? `[from ${sender.agent.cli} #${sender.agent.pid} @ ${shortenPath(sender.agent.cwd)} — reply: ay send ${sender.agent.pid} "..."]\n` : "") + body;
2904
+ const replyTarget = sender.agent?.agent_id || sender.agent?.pid;
2905
+ const fullBody = (sender.agent && !isSlashCommand(body) ? `[from ${sender.agent.cli} #${sender.agent.pid} @ ${shortenPath(sender.agent.cwd)} — reply: ay send ${replyTarget} "..."]\n` : "") + body;
2904
2906
  const noWait = Boolean(argv.noWait) || process.env.AGENT_YES_SEND_NO_WAIT === "1";
2905
2907
  if (fullBody && !noWait && !force) {
2906
2908
  const { clear, waitedMs } = await backoffWhileTyping(record.pid, SEND_TYPING_MAX_WAIT_MS);
@@ -2924,7 +2926,7 @@ async function cmdSend(rest) {
2924
2926
  const status = confirmed ? "sent" : "sent but NOT confirmed submitted";
2925
2927
  process.stdout.write(`${status} to pid ${record.pid} (${record.cli}): ${truncate(payload, 80)}\n`);
2926
2928
  if (!confirmed) process.stderr.write(`\nwarning: couldn't confirm the CLI acted on it after ${SEND_SUBMIT_MAX_RETRIES + 1} attempt(s) — it may still be sitting unsubmitted in the prompt. Last screen:\n` + lastScreen.slice(-8).map((l) => ` ${l}`).join("\n") + "\n");
2927
- const replyHint = sender.agent ? ` ay send ${sender.agent.pid} "..." # reply to sender\n` : "";
2929
+ const replyHint = sender.agent ? ` ay send ${replyTarget} "..." # reply to sender\n` : "";
2928
2930
  process.stderr.write(`\n` + replyHint + ` ay tail ${record.pid} # watch output\n ay ls # list all agents\n`);
2929
2931
  if (codeName === "ctrl-c" || codeName === "ctrlc") {
2930
2932
  const tip = stopTipForCli(record.cli, record.pid);
@@ -3559,7 +3561,11 @@ async function cmdRestart(rest) {
3559
3561
  "ignore",
3560
3562
  "ignore",
3561
3563
  "ignore"
3562
- ]
3564
+ ],
3565
+ env: record.agent_id ? {
3566
+ ...process.env,
3567
+ AGENT_YES_AGENT_ID: record.agent_id
3568
+ } : process.env
3563
3569
  });
3564
3570
  const { out, err } = restartHintLines(record.cli, record.cwd, strategy);
3565
3571
  process.stdout.write(out);
@@ -3963,7 +3969,7 @@ async function cmdNotify(rest) {
3963
3969
  }
3964
3970
  const ensure = async () => {
3965
3971
  if (!argv["ensure-daemon"]) return;
3966
- const { ensureDaemon } = await import("./notifyDaemon-hf-hL3m5.js");
3972
+ const { ensureDaemon } = await import("./notifyDaemon-BIAiDk8X.js");
3967
3973
  await ensureDaemon().catch(() => null);
3968
3974
  };
3969
3975
  await heartbeatWatcher(parent, selfStartedAt);
@@ -4037,7 +4043,7 @@ async function cmdNotifyCursor(args) {
4037
4043
  }
4038
4044
  async function cmdNotifyd(rest) {
4039
4045
  const sub = rest[0] ?? "status";
4040
- const daemon = await import("./notifyDaemon-hf-hL3m5.js");
4046
+ const daemon = await import("./notifyDaemon-BIAiDk8X.js");
4041
4047
  switch (sub) {
4042
4048
  case "run": return daemon.runDaemon();
4043
4049
  case "once": return daemon.runDaemon({ once: true });
@@ -4064,4 +4070,4 @@ async function cmdNotifyd(rest) {
4064
4070
 
4065
4071
  //#endregion
4066
4072
  export { resolveOne as A, writeKeysPaced as B, matchKeyword as C, renderLogTailLines as D, readPtysize as E, snapshotStatus as F, hostId as G, TYPING_BADGE as H, stdinActivityPath as I, readInbox as J, listInboxParents as K, stopTipForCli as L, resolveResumeArgs as M, restartHintLines as N, renderRawLog as O, runSubcommand as P, notifyDir as Q, submitAndConfirm as R, listRecords as S, readNotes as T, appendEvent as U, writeToIpc as V, gcInboxes as W, daemonLockDir as X, shouldStealLock as Y, daemonLockOwnerPath as Z, isPidAlive as _, cmdHelp as a, isUserTyping as b, deriveLiveState as c, extractMenu as d, extractNeedsInput as f, isExitRequest as g, isAgentStuck as h, backoffWhileTyping as i, resolveReadWindow as j, renderRawLogLines as k, deriveLiveStatus as l, finalizedLines as m, READ_PAGE_DEFAULT as n, controlCodeFromName as o, extractTaskCounts as p, liveWatchers as q, TYPING_WINDOW_MS as r, cursorAbs as s, GRACEFUL_EXIT_COMMANDS as t, extractBadges as u, isSlashCommand as v, menuSelectKeys as w, lastStdinAt as x, isSubcommand as y, waitForLogQuiet as z };
4067
- //# sourceMappingURL=subcommands-DweUtFJs.js.map
4073
+ //# sourceMappingURL=subcommands-DYcGpfkJ.js.map
@@ -1,5 +1,5 @@
1
1
  import { n as logger, t as addTransport } from "./logger-CDIsZ-Pp.js";
2
- import { r as getInstalledPackage } from "./versionChecker-BvWNbsww.js";
2
+ import { r as getInstalledPackage } from "./versionChecker-DltRc0f8.js";
3
3
  import { t as agentYesHome } from "./agentYesHome-CtHb5b71.js";
4
4
  import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-CNMl13dC.js";
5
5
  import { t as PidStore } from "./pidStore-BIvsBQ8X.js";
@@ -1824,4 +1824,4 @@ function sleep(ms) {
1824
1824
 
1825
1825
  //#endregion
1826
1826
  export { removeControlCharacters as a, AgentContext as i, agentYes as n, config as r, CLIS_CONFIG as t };
1827
- //# sourceMappingURL=ts-gLE006Iw.js.map
1827
+ //# sourceMappingURL=ts-l6q9fhuc.js.map
@@ -7,7 +7,7 @@ import { fileURLToPath } from "url";
7
7
 
8
8
  //#region package.json
9
9
  var name = "claude-yes";
10
- var version = "1.173.1";
10
+ var version = "1.174.0";
11
11
 
12
12
  //#endregion
13
13
  //#region ts/versionChecker.ts
@@ -215,4 +215,4 @@ async function displayVersion() {
215
215
 
216
216
  //#endregion
217
217
  export { versionString as i, displayVersion as n, getInstalledPackage as r, checkAndAutoUpdate as t };
218
- //# sourceMappingURL=versionChecker-BvWNbsww.js.map
218
+ //# sourceMappingURL=versionChecker-DltRc0f8.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-yes",
3
- "version": "1.173.1",
3
+ "version": "1.174.0",
4
4
  "description": "A wrapper tool that automates interactions with various AI CLI tools by automatically handling common prompts and responses.",
5
5
  "keywords": [
6
6
  "ai",
package/ts/serve.ts CHANGED
@@ -343,6 +343,88 @@ function resolveDaemonManager(): DaemonManager | null {
343
343
  return order.find((m): m is DaemonManager => !!m) ?? null;
344
344
  }
345
345
 
346
+ // Ask a JS package manager for its global bin dir, so a binary we just
347
+ // `-g`-installed is discoverable in THIS process even though a fresh login
348
+ // shell hasn't added that dir to PATH yet (setup.sh warns about exactly this).
349
+ // - bun: `bun pm bin -g` prints the dir directly.
350
+ // - npm: `npm prefix -g` prints the prefix; the bin lives at <prefix>/bin.
351
+ async function globalBinDir(installer: string[]): Promise<string | null> {
352
+ const isBun = installer[1] === "add";
353
+ const query = isBun
354
+ ? [installer[0]!, "pm", "bin", "-g"]
355
+ : [installer[0]!, "prefix", "-g"];
356
+ const p = Bun.spawn(query, { stdout: "pipe", stderr: "ignore" });
357
+ if ((await p.exited) !== 0) return null;
358
+ const out = (await new Response(p.stdout).text()).trim();
359
+ if (!out) return null;
360
+ return isBun ? out : path.join(out, "bin");
361
+ }
362
+
363
+ // Does this manager's binary actually execute? A `bun add -g oxmgr` can succeed
364
+ // yet leave a binary that can't run: oxmgr vendors a native binary requiring
365
+ // GLIBC_2.39, which a box like Debian 12 (glibc 2.36) lacks, so exec dies with
366
+ // "GLIBC_2.39 not found". Probe with `--version`: exit 0 means runnable; a
367
+ // non-zero exit or spawn failure means the shim is on PATH but unusable.
368
+ async function managerRunnable(mgr: DaemonManager): Promise<boolean> {
369
+ try {
370
+ const p = Bun.spawn([mgr.bin, "--version"], { stdout: "ignore", stderr: "ignore" });
371
+ return ((await p.exited) ?? 1) === 0;
372
+ } catch {
373
+ return false;
374
+ }
375
+ }
376
+
377
+ // Install one PM package globally via the SAME JS package manager that installed
378
+ // `ay` (bun preferred, npm fallback — no Rust toolchain required, so a fresh
379
+ // Linux box with only bun from setup.sh works), then confirm the resulting
380
+ // binary actually execs. Returns a runnable manager, or null if the install
381
+ // failed or the binary can't run here (caller then tries the next candidate).
382
+ async function installAndVerify(pkg: "oxmgr" | "pm2"): Promise<DaemonManager | null> {
383
+ const bun = Bun.which("bun");
384
+ const npm = Bun.which("npm");
385
+ const installer = bun ? [bun, "add", "-g", pkg] : npm ? [npm, "install", "-g", pkg] : null;
386
+ if (!installer) return null;
387
+ process.stderr.write(`ay serve install: installing ${pkg}…\n`);
388
+ const code = (await Bun.spawn(installer, { stdio: ["ignore", "inherit", "inherit"] }).exited) ?? 1;
389
+ if (code !== 0) {
390
+ process.stderr.write(`ay serve install: '${installer.join(" ")}' failed (exit ${code})\n`);
391
+ return null;
392
+ }
393
+ // The shim landed in the PM's global bin dir, which may not be on our PATH —
394
+ // prepend it before resolving so Bun.which can see the fresh binary.
395
+ const binDir = await globalBinDir(installer);
396
+ if (binDir) process.env.PATH = `${binDir}${path.delimiter}${process.env.PATH ?? ""}`;
397
+ const bin = Bun.which(pkg);
398
+ if (!bin) return null;
399
+ const mgr: DaemonManager = { id: pkg, bin };
400
+ if (!(await managerRunnable(mgr))) {
401
+ process.stderr.write(
402
+ `ay serve install: ${pkg} installed but can't exec here (likely a native/glibc mismatch)` +
403
+ (pkg === "oxmgr" ? " — falling back to pm2\n" : "\n"),
404
+ );
405
+ return null;
406
+ }
407
+ return mgr;
408
+ }
409
+
410
+ // No usable process manager → bootstrap one so `ay serve install` works out of
411
+ // the box on a fresh machine. Try candidates in preference order (oxmgr first on
412
+ // non-Windows, pm2 first on Windows where oxmgr's TCP daemon socket wedges);
413
+ // each must actually EXEC, so a glibc-incompatible oxmgr transparently falls
414
+ // through to pm2 — pure JS, runs anywhere bun/node does. This is why the old
415
+ // `cargo install oxmgr`-only hint left serve-install dead on arrival on Linux.
416
+ // AGENT_YES_NO_PM_BOOTSTRAP=1 opts out.
417
+ async function bootstrapDaemonManager(): Promise<DaemonManager | null> {
418
+ if (process.env.AGENT_YES_NO_PM_BOOTSTRAP === "1") return null;
419
+ const candidates: Array<"oxmgr" | "pm2"> =
420
+ process.platform === "win32" ? ["pm2", "oxmgr"] : ["oxmgr", "pm2"];
421
+ for (const pkg of candidates) {
422
+ const mgr = await installAndVerify(pkg);
423
+ if (mgr) return mgr;
424
+ }
425
+ return null;
426
+ }
427
+
346
428
  // Resolve the argv that launches `ay serve …` from the daemon. The daemon's
347
429
  // environment may not have ~/.bun/bin on PATH, so we use an absolute path.
348
430
  // On Windows the `ay` bin is a self-contained launcher (ay.exe) we exec
@@ -499,12 +581,24 @@ async function fetchDaemonVersion(port: number, token: string): Promise<string |
499
581
  }
500
582
 
501
583
  async function cmdServeDaemon(sub: string, args: string[]): Promise<number> {
502
- const mgr = resolveDaemonManager();
584
+ // Prefer an already-installed manager — but only if it actually execs. A
585
+ // glibc-incompatible oxmgr (Debian 12: GLIBC_2.39 not found) can sit on PATH
586
+ // yet be unusable; treat it as absent so we bootstrap a working one instead of
587
+ // handing serve-install a manager that dies at runtime. Otherwise bootstrap
588
+ // (oxmgr→pm2 fallback) so a fresh box works out of the box.
589
+ let mgr = resolveDaemonManager();
590
+ if (mgr && !(await managerRunnable(mgr))) {
591
+ process.stderr.write(
592
+ `ay serve install: ${mgr.id} is on PATH but can't exec here (likely a native/glibc mismatch) — bootstrapping a working manager…\n`,
593
+ );
594
+ mgr = null;
595
+ }
596
+ if (!mgr) mgr = await bootstrapDaemonManager();
503
597
  if (!mgr) {
504
598
  process.stderr.write(
505
- "ay serve install: no process manager found (need pm2 or oxmgr)\n" +
599
+ "ay serve install: no usable process manager (need oxmgr or pm2)\n" +
506
600
  " install with: bun add -g pm2\n" +
507
- " or: cargo install oxmgr\n",
601
+ " or: bun add -g oxmgr (needs glibc ≥ 2.39 on Linux)\n",
508
602
  );
509
603
  return 1;
510
604
  }
package/ts/subcommands.ts CHANGED
@@ -2874,6 +2874,19 @@ async function cmdSend(rest: string[]): Promise<number> {
2874
2874
  const trailing = controlCodeFromName(codeName);
2875
2875
 
2876
2876
  const record = await resolveOne(keyword, opts);
2877
+
2878
+ // Misdelivery guard: when the keyword isn't a plain pid (an exact identity),
2879
+ // it resolved by cwd/cli/prompt substring — which can silently land on an
2880
+ // unintended session in another tree (resolveOne returns a lone fuzzy match
2881
+ // with no prompt). Echo exactly where it resolved to stderr BEFORE injecting,
2882
+ // so the sender can catch a wrong target instead of only finding out when the
2883
+ // reply never comes. Numeric identity sends stay quiet.
2884
+ if (!/^\d+$/.test(keyword)) {
2885
+ process.stderr.write(
2886
+ `ay send → pid ${record.pid} ${record.cli} @ ${shortenPath(record.cwd)}\n`,
2887
+ );
2888
+ }
2889
+
2877
2890
  const fifoPath = record.fifo_file;
2878
2891
  if (!fifoPath) {
2879
2892
  throw new Error(
@@ -2910,14 +2923,20 @@ async function cmdSend(rest: string[]): Promise<number> {
2910
2923
  }
2911
2924
 
2912
2925
  // When an agent sends, prefix one line so the recipient knows who pinged it
2913
- // and exactly how to reply (to a resolvable pid — the sender's own). BUT a
2914
- // slash command is only recognized when `/` is the very first character of the
2915
- // submitted message; the prefix would bump it to line 2 and the CLI would type
2916
- // the command as plain text. So skip the prefix for a command body and send it
2917
- // verbatim attribution is dropped for the command, but it actually runs.
2926
+ // and exactly how to reply. Reply to the sender's stable agent_id, NOT its pid:
2927
+ // a pid is invalidated the moment the sender restarts (new pid), silently
2928
+ // breaking the reply route; the agent_id is preserved across restart (see
2929
+ // cmdRestart's AGENT_YES_AGENT_ID injection), so the route survives. The `#pid`
2930
+ // stays in the header for human readability. Fall back to the pid only for a
2931
+ // legacy agent with no recorded agent_id. BUT a slash command is only
2932
+ // recognized when `/` is the very first character of the submitted message; the
2933
+ // prefix would bump it to line 2 and the CLI would type the command as plain
2934
+ // text. So skip the prefix for a command body and send it verbatim —
2935
+ // attribution is dropped for the command, but it actually runs.
2936
+ const replyTarget = sender.agent?.agent_id || sender.agent?.pid;
2918
2937
  const prefix =
2919
2938
  sender.agent && !isSlashCommand(body)
2920
- ? `[from ${sender.agent.cli} #${sender.agent.pid} @ ${shortenPath(sender.agent.cwd)} — reply: ay send ${sender.agent.pid} "..."]\n`
2939
+ ? `[from ${sender.agent.cli} #${sender.agent.pid} @ ${shortenPath(sender.agent.cwd)} — reply: ay send ${replyTarget} "..."]\n`
2921
2940
  : "";
2922
2941
 
2923
2942
  const fullBody = prefix + body;
@@ -2983,7 +3002,7 @@ async function cmdSend(rest: string[]): Promise<number> {
2983
3002
  }
2984
3003
 
2985
3004
  const replyHint = sender.agent
2986
- ? ` ay send ${sender.agent.pid} "..." # reply to sender\n`
3005
+ ? ` ay send ${replyTarget} "..." # reply to sender\n`
2987
3006
  : "";
2988
3007
  process.stderr.write(
2989
3008
  `\n` +
@@ -3879,10 +3898,21 @@ async function cmdRestart(rest: string[]): Promise<number> {
3879
3898
 
3880
3899
  // Detached launcher; we deliberately don't track its pid — see restartHintLines
3881
3900
  // for why the resumed agent's pid isn't reportable synchronously.
3901
+ //
3902
+ // Carry the old record's agent_id into the relaunch so the resumed agent keeps
3903
+ // the SAME stable id (only the pid changes). Without this the wrapper mints a
3904
+ // fresh id and any `ay send <agent_id>` reply route breaks across a restart —
3905
+ // exactly the misdelivery that made a pinned-pid reply header no-match after
3906
+ // the sender restarted. The Rust/TS wrapper adopts AGENT_YES_AGENT_ID for its
3907
+ // own record and strips it from the wrapped CLI's env (pty_spawner.rs /
3908
+ // index.ts), so subagents don't collide on the id.
3882
3909
  Bun.spawn(["agent-yes", "--cli=" + record.cli, ...resumeArgs], {
3883
3910
  cwd: record.cwd,
3884
3911
  detached: true,
3885
3912
  stdio: ["ignore", "ignore", "ignore"],
3913
+ env: record.agent_id
3914
+ ? { ...process.env, AGENT_YES_AGENT_ID: record.agent_id }
3915
+ : process.env,
3886
3916
  });
3887
3917
 
3888
3918
  const { out, err } = restartHintLines(record.cli, record.cwd, strategy);
@@ -1,8 +0,0 @@
1
- import "./ts-gLE006Iw.js";
2
- import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-BvWNbsww.js";
4
- import "./pidStore-BIvsBQ8X.js";
5
- import "./globalPidIndex-CoNr7tS8.js";
6
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-C9ovj686.js";
7
-
8
- export { SUPPORTED_CLIS };