claude-yes 1.173.2 → 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-CFi-EoE8.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-m7NPWD_Z.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-BLOK0ZVF.js";
5
- import { n as getRustBinary } from "./rustBinary-DV9V1IKU.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-DyjXEnJk.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-Bc1ovpmC.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-CFi-EoE8.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-BLOK0ZVF.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-DovUChYP.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-OSmxbw6p.js.map
591
+ //# sourceMappingURL=notifyDaemon-BIAiDk8X.js.map
@@ -1,4 +1,4 @@
1
- import { r as getInstalledPackage } from "./versionChecker-BLOK0ZVF.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-DV9V1IKU.js.map
228
+ //# sourceMappingURL=rustBinary-B3-RzNau.js.map
@@ -1,9 +1,9 @@
1
- import "./ts-CFi-EoE8.js";
1
+ import "./ts-l6q9fhuc.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-BLOK0ZVF.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-m7NPWD_Z.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-CvSPWKJ3.js.map
144
+ //# sourceMappingURL=schedule-OIx0pPXv.js.map
@@ -1,13 +1,13 @@
1
- import "./ts-CFi-EoE8.js";
1
+ import "./ts-l6q9fhuc.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import { r as getInstalledPackage } from "./versionChecker-BLOK0ZVF.js";
4
- import { t as findSpawnHiddenLauncher } from "./rustBinary-DV9V1IKU.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-m7NPWD_Z.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-DovUChYP.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-CHgDiELn.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-CHgDiELn.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-2MpD89vI.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-DovUChYP.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-CHgDiELn.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-2MpD89vI.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-CvSPWKJ3.js");
1137
+ const { cmdSchedule } = await import("./schedule-OIx0pPXv.js");
1138
1138
  return cmdSchedule(rest);
1139
1139
  }
1140
1140
  case "remote": {
@@ -3969,7 +3969,7 @@ async function cmdNotify(rest) {
3969
3969
  }
3970
3970
  const ensure = async () => {
3971
3971
  if (!argv["ensure-daemon"]) return;
3972
- const { ensureDaemon } = await import("./notifyDaemon-OSmxbw6p.js");
3972
+ const { ensureDaemon } = await import("./notifyDaemon-BIAiDk8X.js");
3973
3973
  await ensureDaemon().catch(() => null);
3974
3974
  };
3975
3975
  await heartbeatWatcher(parent, selfStartedAt);
@@ -4043,7 +4043,7 @@ async function cmdNotifyCursor(args) {
4043
4043
  }
4044
4044
  async function cmdNotifyd(rest) {
4045
4045
  const sub = rest[0] ?? "status";
4046
- const daemon = await import("./notifyDaemon-OSmxbw6p.js");
4046
+ const daemon = await import("./notifyDaemon-BIAiDk8X.js");
4047
4047
  switch (sub) {
4048
4048
  case "run": return daemon.runDaemon();
4049
4049
  case "once": return daemon.runDaemon({ once: true });
@@ -4070,4 +4070,4 @@ async function cmdNotifyd(rest) {
4070
4070
 
4071
4071
  //#endregion
4072
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 };
4073
- //# sourceMappingURL=subcommands-DovUChYP.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-BLOK0ZVF.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-CFi-EoE8.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.2";
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-BLOK0ZVF.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.2",
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
  }
@@ -1,8 +0,0 @@
1
- import "./ts-CFi-EoE8.js";
2
- import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-BLOK0ZVF.js";
4
- import "./pidStore-BIvsBQ8X.js";
5
- import "./globalPidIndex-CoNr7tS8.js";
6
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-m7NPWD_Z.js";
7
-
8
- export { SUPPORTED_CLIS };