claude-yes 1.161.0 → 1.162.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.
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-CRo3qQWb.js";
1
+ import { t as CLIS_CONFIG } from "./ts--UKFJGU-.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-DYTnLX8C.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-BNLYYzBZ.js.map
@@ -0,0 +1,8 @@
1
+ import "./ts--UKFJGU-.js";
2
+ import "./logger-CDIsZ-Pp.js";
3
+ import "./versionChecker-DJObC8O_.js";
4
+ import "./pidStore-BfoBWUjc.js";
5
+ import "./globalPidIndex-DlmmJlO8.js";
6
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BNLYYzBZ.js";
7
+
8
+ export { SUPPORTED_CLIS };
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
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, r as getInstalledPackage, t as checkAndAutoUpdate } from "./versionChecker-DrjR4P0K.js";
4
+ import { i as versionString, n as displayVersion, r as getInstalledPackage, t as checkAndAutoUpdate } from "./versionChecker-DJObC8O_.js";
5
5
  import { argv } from "process";
6
6
  import { execFileSync, spawn } from "child_process";
7
7
  import ms from "ms";
@@ -481,7 +481,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
481
481
  const rawArg = process.argv[2];
482
482
  const managerCommands = !invokedCliName(process.argv);
483
483
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
484
- const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-5AXvxB0S.js");
484
+ const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-DeW-4FGU.js");
485
485
  if (isHelpFlag && process.argv.length === 3) {
486
486
  cmdHelp(managerCommands);
487
487
  process.exit(0);
@@ -514,7 +514,7 @@ if (config.useRust) {
514
514
  }
515
515
  }
516
516
  if (rustBinary) {
517
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-CHmQfHCh.js");
517
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-C9TQK7ME.js");
518
518
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
519
519
  if (config.verbose) {
520
520
  console.log(`[rust] Using binary: ${rustBinary}`);
@@ -544,7 +544,7 @@ if (config.showVersion) {
544
544
  process.exit(0);
545
545
  }
546
546
  if (config.appendPrompt) {
547
- const { PidStore } = await import("./pidStore-DfHh3Yt0.js");
547
+ const { PidStore } = await import("./pidStore-5qyLX3Fh.js");
548
548
  const ipcPath = await PidStore.findActiveFifo(process.cwd());
549
549
  if (!ipcPath) {
550
550
  console.error("No active agent with IPC found in current directory.");
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-CRo3qQWb.js";
1
+ import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts--UKFJGU-.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-DrjR4P0K.js";
4
- import "./pidStore-fqXqTKkh.js";
3
+ import "./versionChecker-DJObC8O_.js";
4
+ import "./pidStore-BfoBWUjc.js";
5
5
  import "./globalPidIndex-DlmmJlO8.js";
6
6
 
7
7
  export { AgentContext, CLIS_CONFIG, config, agentYes as default, removeControlCharacters };
@@ -0,0 +1,5 @@
1
+ import "./logger-CDIsZ-Pp.js";
2
+ import { t as PidStore } from "./pidStore-BfoBWUjc.js";
3
+ import "./globalPidIndex-DlmmJlO8.js";
4
+
5
+ export { PidStore };
@@ -209,8 +209,9 @@ var PidStore = class PidStore {
209
209
  const argsJson = JSON.stringify(args);
210
210
  const logFile = this.getRawLogPath(pid);
211
211
  const fifoFile = this.getFifoPath(pid);
212
+ const injected = process.env.AGENT_YES_AGENT_ID;
212
213
  const existing = this.store.findOne((doc) => doc.pid === pid);
213
- const agentId = existing?.agentId ?? randomBytes(6).toString("hex");
214
+ const agentId = existing?.agentId ?? (injected && /^[0-9a-f]{6,32}$/i.test(injected) ? injected : randomBytes(6).toString("hex"));
214
215
  const record = {
215
216
  pid,
216
217
  cli,
@@ -367,4 +368,4 @@ pid-db/
367
368
 
368
369
  //#endregion
369
370
  export { PidStore as t };
370
- //# sourceMappingURL=pidStore-fqXqTKkh.js.map
371
+ //# sourceMappingURL=pidStore-BfoBWUjc.js.map
@@ -1,9 +1,9 @@
1
- import "./ts-CRo3qQWb.js";
1
+ import "./ts--UKFJGU-.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-DrjR4P0K.js";
4
- import "./pidStore-fqXqTKkh.js";
3
+ import "./versionChecker-DJObC8O_.js";
4
+ import "./pidStore-BfoBWUjc.js";
5
5
  import "./globalPidIndex-DlmmJlO8.js";
6
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DYTnLX8C.js";
6
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BNLYYzBZ.js";
7
7
  import { o as resolveSpawnCwd } from "./workspaceConfig-B0Q9-q2B.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-CCvB7SCT.js.map
144
+ //# sourceMappingURL=schedule-DzFEVEoq.js.map
@@ -1,16 +1,16 @@
1
- import "./ts-CRo3qQWb.js";
1
+ import "./ts--UKFJGU-.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import { r as getInstalledPackage } from "./versionChecker-DrjR4P0K.js";
4
- import "./pidStore-fqXqTKkh.js";
3
+ import { r as getInstalledPackage } from "./versionChecker-DJObC8O_.js";
4
+ import "./pidStore-BfoBWUjc.js";
5
5
  import { a as updateGlobalPidStatus } from "./globalPidIndex-DlmmJlO8.js";
6
6
  import { t as pgidForWrapper } from "./reaper-C-eWAxIj.js";
7
7
  import "./configShared-CEyhl0WH.js";
8
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DYTnLX8C.js";
8
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BNLYYzBZ.js";
9
9
  import "./e2e-Bfw7qL9O.js";
10
10
  import "./webrtcLink-CBZkZ-LT.js";
11
11
  import "./remotes-DBCvpp3B.js";
12
12
  import { a as isProvisionAllowed, i as hasSpawnHook, n as getSpawnHook, o as resolveSpawnCwd, t as getProvisionRoot } from "./workspaceConfig-B0Q9-q2B.js";
13
- import { D as writeToIpc, T as snapshotStatus, _ as readPtysize, b as resolveOne, c as extractTaskCounts, g as readNotes, i as controlCodeFromName, m as listRecords, o as deriveLiveStatus, v as renderRawLog } from "./subcommands-DGkBxWS5.js";
13
+ import { D as writeToIpc, T as snapshotStatus, _ as readPtysize, b as resolveOne, c as extractTaskCounts, g as readNotes, i as controlCodeFromName, m as listRecords, o as deriveLiveStatus, v as renderRawLog } from "./subcommands-CKMEWv6U.js";
14
14
  import yargs from "yargs";
15
15
  import { mkdir, open, readFile, stat, unlink, writeFile } from "fs/promises";
16
16
  import { homedir, hostname, userInfo } from "os";
@@ -1200,6 +1200,7 @@ Options:
1200
1200
  ...prompt ? ["--", prompt] : []
1201
1201
  ];
1202
1202
  const agentEnv = freshAgentEnv();
1203
+ const agentId = randomBytes(6).toString("hex");
1203
1204
  try {
1204
1205
  const hook = getSpawnHook();
1205
1206
  if (hook) {
@@ -1218,7 +1219,8 @@ Options:
1218
1219
  env: {
1219
1220
  ...agentEnv,
1220
1221
  AGENT_YES_CWD: cwd,
1221
- AGENT_YES_CLI: cli
1222
+ AGENT_YES_CLI: cli,
1223
+ AGENT_YES_AGENT_ID: agentId
1222
1224
  },
1223
1225
  stdin: "ignore",
1224
1226
  stdout: "ignore",
@@ -1239,6 +1241,7 @@ Options:
1239
1241
  return Response.json({
1240
1242
  ok: true,
1241
1243
  pid: child.pid,
1244
+ agentId,
1242
1245
  cli,
1243
1246
  cwd,
1244
1247
  hook: true,
@@ -1248,7 +1251,10 @@ Options:
1248
1251
  const child = Bun.spawn(agentArgv, {
1249
1252
  cwd,
1250
1253
  detached: true,
1251
- env: agentEnv,
1254
+ env: {
1255
+ ...agentEnv,
1256
+ AGENT_YES_AGENT_ID: agentId
1257
+ },
1252
1258
  stdin: "ignore",
1253
1259
  stdout: "ignore",
1254
1260
  stderr: "ignore"
@@ -1257,6 +1263,7 @@ Options:
1257
1263
  return Response.json({
1258
1264
  ok: true,
1259
1265
  pid: child.pid,
1266
+ agentId,
1260
1267
  cli,
1261
1268
  cwd,
1262
1269
  ...provisioned ? { provisioned } : {}
@@ -1389,4 +1396,4 @@ Options:
1389
1396
 
1390
1397
  //#endregion
1391
1398
  export { cmdServe };
1392
- //# sourceMappingURL=serve-BRARQjsC.js.map
1399
+ //# sourceMappingURL=serve-BFnjq7JW.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-BRARQjsC.js");
35
+ const { cmdServe } = await import("./serve-BFnjq7JW.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-Cx7jDKtC.js.map
45
+ //# sourceMappingURL=setup-BmUQ_Zbt.js.map
@@ -556,15 +556,15 @@ async function runSubcommand(argv) {
556
556
  case "restart": return await cmdRestart(rest);
557
557
  case "note": return await cmdNote(rest);
558
558
  case "serve": {
559
- const { cmdServe } = await import("./serve-BRARQjsC.js");
559
+ const { cmdServe } = await import("./serve-BFnjq7JW.js");
560
560
  return cmdServe(rest);
561
561
  }
562
562
  case "setup": {
563
- const { cmdSetup } = await import("./setup-Cx7jDKtC.js");
563
+ const { cmdSetup } = await import("./setup-BmUQ_Zbt.js");
564
564
  return cmdSetup(rest);
565
565
  }
566
566
  case "schedule": {
567
- const { cmdSchedule } = await import("./schedule-CCvB7SCT.js");
567
+ const { cmdSchedule } = await import("./schedule-DzFEVEoq.js");
568
568
  return cmdSchedule(rest);
569
569
  }
570
570
  case "remote": {
@@ -913,7 +913,8 @@ async function runRemoteSpawn(remote, hint, spec) {
913
913
  }
914
914
  const r = await res.json();
915
915
  process.stdout.write(`spawned ${r.cli} on ${remote.url} in ${r.cwd}${r.hook ? " (via spawn hook)" : ""}${r.provisioned ? ` (${r.provisioned.action})` : ""}\n`);
916
- process.stderr.write(`\n ay ls ${hint} # the new ${r.cli} agent appears here\n`);
916
+ if (r.agentId && !hint.includes("://")) process.stderr.write(`\n ay tail ${hint}:${r.agentId} # watch its output\n ay status ${hint}:${r.agentId} --wait # block until it needs you\n`);
917
+ else process.stderr.write(`\n ay ls ${hint} # the new ${r.cli} agent appears here\n`);
917
918
  return 0;
918
919
  }
919
920
  async function runRemoteStatus(remote) {
@@ -1933,7 +1934,7 @@ async function cmdSend(rest) {
1933
1934
  const trailing = controlCodeFromName(codeName);
1934
1935
  const record = await resolveOne(keyword, opts);
1935
1936
  const fifoPath = record.fifo_file;
1936
- if (!fifoPath) throw new Error(`pid ${record.pid}: no fifo_file recorded — agent was not started with --stdpush (or was spawned by Rust which doesn't yet support FIFO IPC; see ROADMAP item 10)`);
1937
+ 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.`);
1937
1938
  let body;
1938
1939
  if (rawMessage === "-") {
1939
1940
  const chunks = [];
@@ -2794,4 +2795,4 @@ async function cmdResultSet(rest) {
2794
2795
 
2795
2796
  //#endregion
2796
2797
  export { restartHintLines as C, writeToIpc as D, stopTipForCli as E, resolveResumeArgs as S, snapshotStatus as T, readPtysize as _, cursorAbs as a, resolveOne as b, extractTaskCounts as c, isExitRequest as d, isPidAlive as f, readNotes as g, matchKeyword as h, controlCodeFromName as i, finalizedLines as l, listRecords as m, READ_PAGE_DEFAULT as n, deriveLiveStatus as o, isSubcommand as p, cmdHelp as r, extractNeedsInput as s, GRACEFUL_EXIT_COMMANDS as t, isAgentStuck as u, renderRawLog as v, runSubcommand as w, resolveReadWindow as x, renderRawLogLines as y };
2797
- //# sourceMappingURL=subcommands-DGkBxWS5.js.map
2798
+ //# sourceMappingURL=subcommands-CKMEWv6U.js.map
@@ -4,6 +4,6 @@ import "./configShared-CEyhl0WH.js";
4
4
  import "./e2e-Bfw7qL9O.js";
5
5
  import "./webrtcLink-CBZkZ-LT.js";
6
6
  import "./remotes-DBCvpp3B.js";
7
- import { C as restartHintLines, D as writeToIpc, E as stopTipForCli, S as resolveResumeArgs, T as snapshotStatus, _ as readPtysize, a as cursorAbs, b as resolveOne, c as extractTaskCounts, d as isExitRequest, f as isPidAlive, g as readNotes, h as matchKeyword, i as controlCodeFromName, l as finalizedLines, m as listRecords, n as READ_PAGE_DEFAULT, o as deriveLiveStatus, p as isSubcommand, r as cmdHelp, s as extractNeedsInput, t as GRACEFUL_EXIT_COMMANDS, u as isAgentStuck, v as renderRawLog, w as runSubcommand, x as resolveReadWindow, y as renderRawLogLines } from "./subcommands-DGkBxWS5.js";
7
+ import { C as restartHintLines, D as writeToIpc, E as stopTipForCli, S as resolveResumeArgs, T as snapshotStatus, _ as readPtysize, a as cursorAbs, b as resolveOne, c as extractTaskCounts, d as isExitRequest, f as isPidAlive, g as readNotes, h as matchKeyword, i as controlCodeFromName, l as finalizedLines, m as listRecords, n as READ_PAGE_DEFAULT, o as deriveLiveStatus, p as isSubcommand, r as cmdHelp, s as extractNeedsInput, t as GRACEFUL_EXIT_COMMANDS, u as isAgentStuck, v as renderRawLog, w as runSubcommand, x as resolveReadWindow, y as renderRawLogLines } from "./subcommands-CKMEWv6U.js";
8
8
 
9
9
  export { cmdHelp, isSubcommand, runSubcommand };
@@ -1,8 +1,8 @@
1
1
  import { n as logger, t as addTransport } from "./logger-CDIsZ-Pp.js";
2
- import { r as getInstalledPackage } from "./versionChecker-DrjR4P0K.js";
2
+ import { r as getInstalledPackage } from "./versionChecker-DJObC8O_.js";
3
3
  import { t as agentYesHome } from "./agentYesHome-_eJa3DaX.js";
4
4
  import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-V4qvXgAw.js";
5
- import { t as PidStore } from "./pidStore-fqXqTKkh.js";
5
+ import { t as PidStore } from "./pidStore-BfoBWUjc.js";
6
6
  import { i as readGlobalPids } from "./globalPidIndex-DlmmJlO8.js";
7
7
  import { n as register, r as sweep } from "./reaper-C-eWAxIj.js";
8
8
  import { arch, platform } from "process";
@@ -1216,6 +1216,7 @@ async function agentYes({ cli, cliArgs = [], skipPermissions = false, prompt, ro
1216
1216
  const inheritedAyPid = Number(ptyEnv.AGENT_YES_PID);
1217
1217
  const parentPid = Number.isInteger(inheritedAyPid) && inheritedAyPid > 0 ? inheritedAyPid : void 0;
1218
1218
  ptyEnv.AGENT_YES_PID = String(process.pid);
1219
+ delete ptyEnv.AGENT_YES_AGENT_ID;
1219
1220
  if (cliConf?.env) for (const [key, raw] of Object.entries(cliConf.env)) {
1220
1221
  let unresolved = false;
1221
1222
  const value = raw.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)(?::-([^}]*))?\}/g, (_, name, fallback) => {
@@ -1802,4 +1803,4 @@ function sleep(ms) {
1802
1803
 
1803
1804
  //#endregion
1804
1805
  export { removeControlCharacters as a, AgentContext as i, agentYes as n, config as r, CLIS_CONFIG as t };
1805
- //# sourceMappingURL=ts-CRo3qQWb.js.map
1806
+ //# sourceMappingURL=ts--UKFJGU-.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.161.0";
10
+ var version = "1.162.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-DrjR4P0K.js.map
218
+ //# sourceMappingURL=versionChecker-DJObC8O_.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-yes",
3
- "version": "1.161.0",
3
+ "version": "1.162.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/index.ts CHANGED
@@ -374,6 +374,12 @@ export default async function agentYes({
374
374
  const parentPid =
375
375
  Number.isInteger(inheritedAyPid) && inheritedAyPid > 0 ? inheritedAyPid : undefined;
376
376
  ptyEnv.AGENT_YES_PID = String(process.pid);
377
+ // A caller-injected AGENT_YES_AGENT_ID (from `ay serve`'s /api/spawn) is meant
378
+ // for THIS agent's record only — pidStore.registerProcess reads it from our own
379
+ // env. Strip it from the wrapped CLI's env so the agent's subagents (a nested
380
+ // `ay`) don't inherit it and register under the same id (which would make that
381
+ // id ambiguous). The wrapper's own process.env still carries it for pidStore.
382
+ delete ptyEnv.AGENT_YES_AGENT_ID;
377
383
  // Inject per-CLI env (e.g. glm → Z.AI endpoint). Expand ${VAR} against the
378
384
  // launching env; skip entries whose vars are unset so we never blank out an
379
385
  // inherited value (e.g. ANTHROPIC_AUTH_TOKEN when ZAI_API_KEY isn't exported).
package/ts/pidStore.ts CHANGED
@@ -77,9 +77,15 @@ export class PidStore {
77
77
  const fifoFile = this.getFifoPath(pid);
78
78
 
79
79
  // Upsert by pid. Reuse an existing record's agent id so re-registration
80
- // (e.g. status churn) keeps the id stable; mint a fresh 12-hex id otherwise.
80
+ // (e.g. status churn) keeps the id stable; else adopt a caller-injected
81
+ // AGENT_YES_AGENT_ID (so `ay serve`'s /api/spawn can hand back an id that
82
+ // addresses this exact agent — index.ts strips it from the wrapped CLI's env
83
+ // so subagents don't inherit it); else mint a fresh 12-hex id.
84
+ const injected = process.env.AGENT_YES_AGENT_ID;
81
85
  const existing = this.store.findOne((doc) => doc.pid === pid);
82
- const agentId = existing?.agentId ?? randomBytes(6).toString("hex");
86
+ const agentId =
87
+ existing?.agentId ??
88
+ (injected && /^[0-9a-f]{6,32}$/i.test(injected) ? injected : randomBytes(6).toString("hex"));
83
89
 
84
90
  const record: Omit<PidRecord, "_id"> = {
85
91
  pid,
package/ts/serve.ts CHANGED
@@ -1763,6 +1763,14 @@ export async function cmdServe(rest: string[]): Promise<number> {
1763
1763
  const agentArgv = [...ayCmd, cli, ...(prompt ? ["--", prompt] : [])];
1764
1764
  // don't leak our Claude Code session into the agent
1765
1765
  const agentEnv = freshAgentEnv();
1766
+ // Correlation id: the spawn response returns the `ay` LAUNCHER pid, which is
1767
+ // NOT the agent's registered pid — so the caller can't find the agent it just
1768
+ // spawned. Mint a 12-hex id (the agent_id format), inject it as
1769
+ // AGENT_YES_AGENT_ID, and return it. Both runtimes adopt it as their agent_id
1770
+ // (instead of minting a random one) and strip it from the wrapped CLI's env so
1771
+ // subagents don't inherit and collide. The caller can then address the agent
1772
+ // immediately: `ay <verb> <remote>:<agentId>`.
1773
+ const agentId = randomBytes(6).toString("hex");
1766
1774
  // Detach the agent into its OWN session (setsid). When `ay serve` runs WITH a
1767
1775
  // controlling terminal (started in a shell rather than as a headless daemon),
1768
1776
  // an undetached child inherits the daemon's session + controlling tty and lands
@@ -1792,7 +1800,7 @@ export async function cmdServe(rest: string[]): Promise<number> {
1792
1800
  const child = Bun.spawn([shell, "-c", script, "ay-spawn", ...agentArgv], {
1793
1801
  cwd,
1794
1802
  detached: true,
1795
- env: { ...agentEnv, AGENT_YES_CWD: cwd, AGENT_YES_CLI: cli },
1803
+ env: { ...agentEnv, AGENT_YES_CWD: cwd, AGENT_YES_CLI: cli, AGENT_YES_AGENT_ID: agentId },
1796
1804
  stdin: "ignore",
1797
1805
  stdout: "ignore",
1798
1806
  stderr: Bun.file(errPath),
@@ -1829,6 +1837,7 @@ export async function cmdServe(rest: string[]): Promise<number> {
1829
1837
  return Response.json({
1830
1838
  ok: true,
1831
1839
  pid: child.pid,
1840
+ agentId,
1832
1841
  cli,
1833
1842
  cwd,
1834
1843
  hook: true,
@@ -1838,7 +1847,7 @@ export async function cmdServe(rest: string[]): Promise<number> {
1838
1847
  const child = Bun.spawn(agentArgv, {
1839
1848
  cwd,
1840
1849
  detached: true,
1841
- env: agentEnv,
1850
+ env: { ...agentEnv, AGENT_YES_AGENT_ID: agentId },
1842
1851
  stdin: "ignore",
1843
1852
  stdout: "ignore",
1844
1853
  stderr: "ignore",
@@ -1847,6 +1856,7 @@ export async function cmdServe(rest: string[]): Promise<number> {
1847
1856
  return Response.json({
1848
1857
  ok: true,
1849
1858
  pid: child.pid,
1859
+ agentId,
1850
1860
  cli,
1851
1861
  cwd,
1852
1862
  ...(provisioned ? { provisioned } : {}),
package/ts/subcommands.ts CHANGED
@@ -897,6 +897,7 @@ async function runRemoteSpawn(
897
897
  pid: number;
898
898
  cli: string;
899
899
  cwd: string;
900
+ agentId?: string;
900
901
  hook?: boolean;
901
902
  provisioned?: { action: string };
902
903
  };
@@ -905,15 +906,19 @@ async function runRemoteSpawn(
905
906
  `${r.hook ? " (via spawn hook)" : ""}` +
906
907
  `${r.provisioned ? ` (${r.provisioned.action})` : ""}\n`,
907
908
  );
908
- // We deliberately do NOT print the agent's own pid. `/api/spawn` returns the
909
- // `ay` LAUNCHER pid, which is not the agent's registered pid (the record's
910
- // pid/wrapper_pid are the runtime process, not the launcher) — and picking the
911
- // freshly-registered agent by "newest" would, under a concurrent spawn,
912
- // surface a sibling's (or another user's) pid. Point at the remote's list,
913
- // where the new agent reliably appears, instead of guessing.
914
- // (A one-step `ay tail <remote>:<pid>` would need /api/spawn to return a
915
- // correlatable agent id a server change left for a follow-up.)
916
- process.stderr.write(`\n ay ls ${hint} # the new ${r.cli} agent appears here\n`);
909
+ // `/api/spawn` returns a correlation `agentId` that the agent adopts as its
910
+ // agent_id so we address the EXACT agent by it (no pid guessing, no race). A
911
+ // webrtc:// / share-link target isn't `:keyword`-addressable, so the keyword
912
+ // hint is only for an alias / token@host:port. Older remotes omit agentId →
913
+ // fall back to pointing at `ay ls`.
914
+ if (r.agentId && !hint.includes("://")) {
915
+ process.stderr.write(
916
+ `\n ay tail ${hint}:${r.agentId} # watch its output\n` +
917
+ ` ay status ${hint}:${r.agentId} --wait # block until it needs you\n`,
918
+ );
919
+ } else {
920
+ process.stderr.write(`\n ay ls ${hint} # the new ${r.cli} agent appears here\n`);
921
+ }
917
922
  return 0;
918
923
  }
919
924
 
@@ -2258,7 +2263,7 @@ async function cmdSend(rest: string[]): Promise<number> {
2258
2263
  const fifoPath = record.fifo_file;
2259
2264
  if (!fifoPath) {
2260
2265
  throw new Error(
2261
- `pid ${record.pid}: no fifo_file recorded — agent was not started with --stdpush (or was spawned by Rust which doesn't yet support FIFO IPC; see ROADMAP item 10)`,
2266
+ `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.`,
2262
2267
  );
2263
2268
  }
2264
2269
 
@@ -1,8 +0,0 @@
1
- import "./ts-CRo3qQWb.js";
2
- import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-DrjR4P0K.js";
4
- import "./pidStore-fqXqTKkh.js";
5
- import "./globalPidIndex-DlmmJlO8.js";
6
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DYTnLX8C.js";
7
-
8
- export { SUPPORTED_CLIS };
@@ -1,5 +0,0 @@
1
- import "./logger-CDIsZ-Pp.js";
2
- import { t as PidStore } from "./pidStore-fqXqTKkh.js";
3
- import "./globalPidIndex-DlmmJlO8.js";
4
-
5
- export { PidStore };