agent-yes 1.265.4 → 1.266.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.
Files changed (75) hide show
  1. package/dist/{SUPPORTED_CLIS-C3tcRetU.js → SUPPORTED_CLIS-AFV5pjSx.js} +2 -2
  2. package/dist/{SUPPORTED_CLIS-CY3SaV0D.js → SUPPORTED_CLIS-DRVuSo48.js} +3 -3
  3. package/dist/{agentShare-g6N1A6A_.js → agentShare-qdFSp9Uq.js} +6 -5
  4. package/dist/{callback-L4k-v2GG.js → callback-Da7MRLh6.js} +6 -5
  5. package/dist/{callback-z-w0ND5z.js → callback-DfNFdZin.js} +5 -5
  6. package/dist/{callbackCore-Cv4EOGjE.js → callbackCore-DcptaZwH.js} +1 -1
  7. package/dist/{callbackCore-Cg3Ye0ZS.js → callbackCore-K99x3C75.js} +1 -1
  8. package/dist/{channels-BwpN_8mu.js → channels-DQaZbare.js} +2 -2
  9. package/dist/cli.js +11 -11
  10. package/dist/{cwdConflictWarn-DZTxTGXq.js → cwdConflictWarn-CtQhl-vF.js} +1 -1
  11. package/dist/{cwdPassthroughHint-DDVkhBiD.js → cwdPassthroughHint-apaX_O7p.js} +1 -1
  12. package/dist/{expose-BG17GV7D.js → expose-BXn6My6A.js} +1 -1
  13. package/dist/{forkNested-VroZS-nk.js → forkNested-CDfWPiHw.js} +12 -2
  14. package/dist/{hist-CoXBBjJt.js → hist-BpocAe1N.js} +1 -1
  15. package/dist/index.js +2 -2
  16. package/dist/initMsg-BjRseolL.js +3 -0
  17. package/dist/initMsg-C-w4A_eF.js +85 -0
  18. package/dist/needsInput-103zhZ90.js +79 -0
  19. package/dist/{nodeRuntime-CT0w6zsB.js → nodeRuntime-CRoEMWkp.js} +1 -1
  20. package/dist/{notifyDaemon-BL1tmxUK.js → notifyDaemon-BFzqcdN1.js} +32 -5
  21. package/dist/notifyStore-CEDiVyis.js +4 -0
  22. package/dist/notifyStore-Cbw2ZJ0X.js +559 -0
  23. package/dist/{openBrowser-Cw8hg7ok.js → openBrowser-DhQ9pJRi.js} +1 -1
  24. package/dist/parentLink-B798ASCW.js +5 -0
  25. package/dist/parentLink-C0cIRjfL.js +53 -0
  26. package/dist/parentPingLoop-BIKxzbPH.js +469 -0
  27. package/dist/{remotes-DWVw-Q7V.js → remotes-Dg_JscKk.js} +2 -2
  28. package/dist/{remotes-iIvqiFWK.js → remotes-iMhdZytp.js} +3 -3
  29. package/dist/{rustBinary-DSVRhDzO.js → rustBinary-JGNROWfY.js} +2 -2
  30. package/dist/{schedule-i4o5SJ_h.js → schedule-DbLpjgl5.js} +6 -6
  31. package/dist/{serve-CpGJD2Kt.js → serve-ucVXOci1.js} +31 -30
  32. package/dist/{setup-B-iQKsQW.js → setup-De7uYRZb.js} +4 -4
  33. package/dist/{share-DOnynkf4.js → share-Db_zb6gH.js} +1 -1
  34. package/dist/{share-B-e_9WBx.js → share-NUhi-Wdd.js} +1 -1
  35. package/dist/{spawnGate-S6EoFdzX.js → spawnGate-BvaZeHE7.js} +1 -1
  36. package/dist/{spawnGate-BmsTv340.js → spawnGate-CEXVmTtv.js} +2 -2
  37. package/dist/subcommands-C04exkIM.js +11 -0
  38. package/dist/{subcommands-CQPnT5qu.js → subcommands-DtF31RoW.js} +41 -656
  39. package/dist/{systemPathLink-CjLmiPbB.js → systemPathLink-7TFPwJna.js} +1 -1
  40. package/dist/{terminal-CybRgMZu.js → terminal-Dm32SXU-.js} +2 -2
  41. package/dist/{todoCli-DZmOmcvd.js → todoCli-c_R7D7Y-.js} +1 -1
  42. package/dist/{tray-Cjm3a8JH.js → tray-DZnGjJBK.js} +1 -1
  43. package/dist/trayApp-CZbwLK9t.js +5 -0
  44. package/dist/{trayApp-UglHbk_m.js → trayApp-CfkPG0wy.js} +2 -2
  45. package/dist/{ts-nuUnrVcf.js → ts-CGtoPER5.js} +43 -10
  46. package/dist/{versionChecker-CMOLbEEi.js → versionChecker-CJgW9DHY.js} +2 -2
  47. package/dist/{webrtcLink-CS4D-3G1.js → webrtcLink-DyCj380i.js} +1 -1
  48. package/dist/{webrtcRemote-zQybN9IR.js → webrtcRemote-BDg0jjTs.js} +2 -2
  49. package/dist/{widget-y5Bpvwsa.js → widget-DXtaX3QR.js} +3 -3
  50. package/dist/{workspaceConfig-BDqp7fYl.js → workspaceConfig-HiWQzq6A.js} +1 -1
  51. package/dist/{ws-CH8GzcQn.js → ws-CqlS5JhN.js} +5 -4
  52. package/dist/{ws-BrLV-AlH.js → ws-aKRZpI9b.js} +9 -11
  53. package/package.json +1 -1
  54. package/ts/forkNested.spec.ts +22 -0
  55. package/ts/forkNested.ts +19 -0
  56. package/ts/index.ts +77 -12
  57. package/ts/initMsg.spec.ts +114 -0
  58. package/ts/initMsg.ts +107 -0
  59. package/ts/ownerHeartbeat.ts +40 -1
  60. package/ts/parentLink.spec.ts +64 -0
  61. package/ts/parentLink.ts +58 -0
  62. package/ts/parentPing.spec.ts +176 -0
  63. package/ts/parentPing.ts +195 -0
  64. package/ts/parentPingLoop.delivery.spec.ts +236 -0
  65. package/ts/parentPingLoop.spec.ts +79 -0
  66. package/ts/parentPingLoop.ts +196 -0
  67. package/ts/parentPingSend.spec.ts +195 -0
  68. package/ts/parentPingSend.ts +148 -0
  69. package/ts/parentWatching.spec.ts +61 -0
  70. package/ts/parentWatching.ts +89 -0
  71. package/ts/subcommands.ts +11 -2
  72. package/ts/trayApp.spec.ts +31 -4
  73. package/ts/ws.ts +17 -12
  74. package/dist/subcommands-Cgt2-kjg.js +0 -10
  75. package/dist/trayApp-CmwwBg8v.js +0 -5
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-nuUnrVcf.js";
1
+ import { t as CLIS_CONFIG } from "./ts-CGtoPER5.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-C3tcRetU.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-AFV5pjSx.js.map
@@ -1,11 +1,11 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-CMOLbEEi.js";
3
- import "./ts-nuUnrVcf.js";
2
+ import "./versionChecker-CJgW9DHY.js";
3
+ import "./ts-CGtoPER5.js";
4
4
  import "./todoAutomation-BQRW614S.js";
5
5
  import "./JsonlStore-CPGIR0Wy.js";
6
6
  import "./globalPidIndex-Dq4KY2IV.js";
7
7
  import "./pidStore-DJqSZPJi.js";
8
8
  import "./messageLog-BYFwioFY.js";
9
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-C3tcRetU.js";
9
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-AFV5pjSx.js";
10
10
 
11
11
  export { SUPPORTED_CLIS };
@@ -3,10 +3,11 @@ import "./globalPidIndex-Dq4KY2IV.js";
3
3
  import "./messageLog-BYFwioFY.js";
4
4
  import "./e2e-CUMZC53I.js";
5
5
  import "./configShared-DtHMBCl7.js";
6
- import { R as resolveOne } from "./subcommands-CQPnT5qu.js";
7
- import "./webrtcLink-CS4D-3G1.js";
8
- import "./remotes-iIvqiFWK.js";
9
- import { a as startShare } from "./share-B-e_9WBx.js";
6
+ import { B as resolveOne } from "./subcommands-DtF31RoW.js";
7
+ import "./notifyStore-Cbw2ZJ0X.js";
8
+ import "./webrtcLink-DyCj380i.js";
9
+ import "./remotes-iMhdZytp.js";
10
+ import { a as startShare } from "./share-NUhi-Wdd.js";
10
11
 
11
12
  //#region ts/agentShare.ts
12
13
  const MAX_SHARES = 8;
@@ -229,4 +230,4 @@ function transformEvent(rawEvent, agentId, forwarded) {
229
230
 
230
231
  //#endregion
231
232
  export { createScopedShare, listShares, revokeAllShares, revokeShare };
232
- //# sourceMappingURL=agentShare-g6N1A6A_.js.map
233
+ //# sourceMappingURL=agentShare-qdFSp9Uq.js.map
@@ -3,10 +3,11 @@ import "./globalPidIndex-Dq4KY2IV.js";
3
3
  import "./messageLog-BYFwioFY.js";
4
4
  import "./e2e-CUMZC53I.js";
5
5
  import "./configShared-DtHMBCl7.js";
6
- import "./subcommands-CQPnT5qu.js";
7
- import "./webrtcLink-CS4D-3G1.js";
8
- import "./remotes-iIvqiFWK.js";
9
- import "./callbackCore-Cg3Ye0ZS.js";
10
- import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-z-w0ND5z.js";
6
+ import "./subcommands-DtF31RoW.js";
7
+ import "./notifyStore-Cbw2ZJ0X.js";
8
+ import "./webrtcLink-DyCj380i.js";
9
+ import "./remotes-iMhdZytp.js";
10
+ import "./callbackCore-K99x3C75.js";
11
+ import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-DfNFdZin.js";
11
12
 
12
13
  export { cmdCallback };
@@ -1,6 +1,6 @@
1
1
  import { t as agentYesHome } from "./agentYesHome-CtmsY6I-.js";
2
- import { R as resolveOne } from "./subcommands-CQPnT5qu.js";
3
- import { a as mintCapability, o as parseExpires } from "./callbackCore-Cg3Ye0ZS.js";
2
+ import { B as resolveOne } from "./subcommands-DtF31RoW.js";
3
+ import { a as mintCapability, o as parseExpires } from "./callbackCore-K99x3C75.js";
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { chmodSync, readFileSync, renameSync, writeFileSync } from "node:fs";
6
6
  import path from "node:path";
@@ -72,7 +72,7 @@ async function resolveBase(flag) {
72
72
  if (flag) return flag;
73
73
  if (process.env.AGENT_YES_CALLBACK_BASE) return process.env.AGENT_YES_CALLBACK_BASE;
74
74
  try {
75
- const { resolveLocalServeUrl } = await import("./serve-CpGJD2Kt.js");
75
+ const { resolveLocalServeUrl } = await import("./serve-ucVXOci1.js");
76
76
  const url = await resolveLocalServeUrl();
77
77
  if (url) return url;
78
78
  } catch {}
@@ -170,7 +170,7 @@ async function cmdCallback(rest) {
170
170
  createdAt: Date.now()
171
171
  };
172
172
  saveStore(all);
173
- const { buildSnippet } = await import("./callbackCore-Cv4EOGjE.js");
173
+ const { buildSnippet } = await import("./callbackCore-DcptaZwH.js");
174
174
  w(`callback ${id} → ${record.cli} #${record.pid} @ ${record.cwd}`);
175
175
  w(`expires: ${new Date(exp).toISOString()} (${expiresSpec})`);
176
176
  w(`endpoint: ${base.replace(/\/+$/, "")}/cb/${cap}`);
@@ -187,4 +187,4 @@ async function cmdCallback(rest) {
187
187
 
188
188
  //#endregion
189
189
  export { loadOrCreateCallbackSecret as i, isCallbackRevoked as n, loadCallbackSecretReadOnly as r, cmdCallback as t };
190
- //# sourceMappingURL=callback-z-w0ND5z.js.map
190
+ //# sourceMappingURL=callback-DfNFdZin.js.map
@@ -1,3 +1,3 @@
1
- import { a as mintCapability, i as frameVisitorMessage, n as MAX_EXPIRES_MS, o as parseExpires, r as buildSnippet, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-Cg3Ye0ZS.js";
1
+ import { a as mintCapability, i as frameVisitorMessage, n as MAX_EXPIRES_MS, o as parseExpires, r as buildSnippet, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-K99x3C75.js";
2
2
 
3
3
  export { buildSnippet };
@@ -140,4 +140,4 @@ function buildSnippet(opts) {
140
140
 
141
141
  //#endregion
142
142
  export { mintCapability as a, frameVisitorMessage as i, MAX_EXPIRES_MS as n, parseExpires as o, buildSnippet as r, verifyCapability as s, MAX_CALLBACK_MSG_BYTES as t };
143
- //# sourceMappingURL=callbackCore-Cg3Ye0ZS.js.map
143
+ //# sourceMappingURL=callbackCore-K99x3C75.js.map
@@ -387,7 +387,7 @@ function printOp(op) {
387
387
  */
388
388
  async function runMesh(cwd, entry, opts) {
389
389
  const { ChannelPeer } = await import("./peer-Cvntlw1i.js");
390
- const { importRTC, getIceServers } = await import("./share-DOnynkf4.js");
390
+ const { importRTC, getIceServers } = await import("./share-Db_zb6gH.js");
391
391
  const rtc = await importRTC();
392
392
  const seen = new Set((await readOps(cwd, entry.channelId)).map((o) => o.id));
393
393
  const peer = new ChannelPeer({
@@ -567,4 +567,4 @@ async function cmdCh(args) {
567
567
 
568
568
  //#endregion
569
569
  export { cmdCh };
570
- //# sourceMappingURL=channels-BwpN_8mu.js.map
570
+ //# sourceMappingURL=channels-DQaZbare.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-CMOLbEEi.js";
5
- import { r as getRustBinary } from "./rustBinary-DSVRhDzO.js";
4
+ import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-CJgW9DHY.js";
5
+ import { r as getRustBinary } from "./rustBinary-JGNROWfY.js";
6
6
  import { argv } from "process";
7
7
  import { spawn } from "child_process";
8
8
  import ms from "ms";
@@ -295,7 +295,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
295
295
  const rawArg = process.argv[2];
296
296
  const managerCommands = !invokedCliName(process.argv);
297
297
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
298
- const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken, isBareManagerInvocation } = await import("./subcommands-Cgt2-kjg.js");
298
+ const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken, isBareManagerInvocation } = await import("./subcommands-C04exkIM.js");
299
299
  if (isHelpFlag && process.argv.length === 3) {
300
300
  await cmdHelp(managerCommands);
301
301
  process.exit(0);
@@ -309,7 +309,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
309
309
  process.exit(code ?? 0);
310
310
  }
311
311
  {
312
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-CY3SaV0D.js");
312
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DRVuSo48.js");
313
313
  if (isUnknownManagerToken(rawArg, managerCommands, SUPPORTED_CLIS)) {
314
314
  process.stderr.write(`ay: unknown subcommand or CLI '${rawArg}'.\n See 'ay help' for subcommands. To run an agent, name a CLI:\n 'ay <cli> …' (e.g. 'ay claude …') or 'ay --cli <cli> …'.\n`);
315
315
  process.exit(1);
@@ -317,7 +317,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
317
317
  }
318
318
  }
319
319
  {
320
- const { detectCwdPassthrough, SUPPRESS_CWD_WARN_ENV } = await import("./cwdPassthroughHint-DDVkhBiD.js");
320
+ const { detectCwdPassthrough, SUPPRESS_CWD_WARN_ENV } = await import("./cwdPassthroughHint-apaX_O7p.js");
321
321
  const dep = detectCwdPassthrough(process.argv);
322
322
  if (dep) {
323
323
  console.warn(dep.message);
@@ -328,16 +328,16 @@ await checkAndAutoUpdate();
328
328
  logger.info(versionString());
329
329
  const config = parseCliArgs(process.argv);
330
330
  if (config.tray) {
331
- const { startTray } = await import("./tray-Cjm3a8JH.js");
331
+ const { startTray } = await import("./tray-DZnGjJBK.js");
332
332
  await startTray();
333
333
  await new Promise(() => {});
334
334
  }
335
335
  {
336
- const { ensureTray } = await import("./tray-Cjm3a8JH.js");
336
+ const { ensureTray } = await import("./tray-DZnGjJBK.js");
337
337
  ensureTray();
338
338
  }
339
339
  if (!config.showVersion && !config.appendPrompt && !config.tray) {
340
- const { waitForSpawnCapacity } = await import("./spawnGate-S6EoFdzX.js");
340
+ const { waitForSpawnCapacity } = await import("./spawnGate-BvaZeHE7.js");
341
341
  await waitForSpawnCapacity({
342
342
  onWait: (reason, waitedMs) => {
343
343
  if (config.verbose || waitedMs === 0) console.error(`[agent-yes] spawn gate: ${reason} — waiting…`);
@@ -346,7 +346,7 @@ if (!config.showVersion && !config.appendPrompt && !config.tray) {
346
346
  });
347
347
  }
348
348
  if (!config.showVersion && !config.appendPrompt && !config.tray) {
349
- const { warnIfCwdOccupied } = await import("./cwdConflictWarn-DZTxTGXq.js");
349
+ const { warnIfCwdOccupied } = await import("./cwdConflictWarn-CtQhl-vF.js");
350
350
  await warnIfCwdOccupied(process.argv);
351
351
  }
352
352
  if (config.useRust) {
@@ -360,14 +360,14 @@ if (config.useRust) {
360
360
  }
361
361
  }
362
362
  if (rustBinary) {
363
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-CY3SaV0D.js");
363
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DRVuSo48.js");
364
364
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
365
365
  if (config.verbose) {
366
366
  console.log(`[rust] Using binary: ${rustBinary}`);
367
367
  console.log(`[rust] Args: ${rustArgs.join(" ")}`);
368
368
  }
369
369
  const attach = config.attach || process.env.AGENT_YES_ATTACH === "1";
370
- const { shouldForkNested, buildSpawnTutorial, waitForRegistration, confirmAgentStarted, predictedLogPath } = await import("./forkNested-VroZS-nk.js");
370
+ const { shouldForkNested, buildSpawnTutorial, waitForRegistration, confirmAgentStarted, predictedLogPath } = await import("./forkNested-CDfWPiHw.js");
371
371
  if (shouldForkNested({
372
372
  isTTY: Boolean(process.stdout.isTTY),
373
373
  ayPid: process.env.AGENT_YES_PID,
@@ -61,4 +61,4 @@ async function warnIfCwdOccupied(rawArgv) {
61
61
 
62
62
  //#endregion
63
63
  export { warnIfCwdOccupied };
64
- //# sourceMappingURL=cwdConflictWarn-DZTxTGXq.js.map
64
+ //# sourceMappingURL=cwdConflictWarn-CtQhl-vF.js.map
@@ -85,4 +85,4 @@ function detectCwdPassthrough(argv) {
85
85
 
86
86
  //#endregion
87
87
  export { SUPPRESS_CWD_WARN_ENV, detectCwdPassthrough };
88
- //# sourceMappingURL=cwdPassthroughHint-DDVkhBiD.js.map
88
+ //# sourceMappingURL=cwdPassthroughHint-apaX_O7p.js.map
@@ -549,4 +549,4 @@ async function cmdExpose(args) {
549
549
 
550
550
  //#endregion
551
551
  export { cmdExpose, ensureExposure, listExposures, stopExposure };
552
- //# sourceMappingURL=expose-BG17GV7D.js.map
552
+ //# sourceMappingURL=expose-BXn6My6A.js.map
@@ -31,7 +31,17 @@ function buildSpawnTutorial(cli, pid) {
31
31
  ` ay send ${pid} /compact # send a slash command`,
32
32
  ` ay ls # list running agents`,
33
33
  ` ay result get ${pid} # read its final result when done`,
34
- ` ay exit ${pid} # stop it`
34
+ ` ay exit ${pid} # stop it`,
35
+ ``,
36
+ `Two ways to keep up with it — use whichever fits your harness:`,
37
+ ` Monitor (preferred if you have a monitor/polling loop):`,
38
+ ` ay ls --watch --json # NDJSON stream of state changes across agents`,
39
+ ` ay status ${pid} # one-shot: working | idle | needs_input | stopped`,
40
+ ` ay status ${pid} --wait-idle # block until it's done (add --timeout=Ns)`,
41
+ ` Or do nothing: it was told to report back to you, and its wrapper will`,
42
+ ` message you if it finishes, gets stuck, or exits without reporting — the`,
43
+ ` report arrives in your own input as an <ay-report …> block. That fallback`,
44
+ ` stays quiet while you are actively watching, so the two don't duplicate.`
35
45
  ].join("\n");
36
46
  }
37
47
  /**
@@ -128,4 +138,4 @@ async function confirmAgentStarted(pid, graceMs = 1500, aborted) {
128
138
 
129
139
  //#endregion
130
140
  export { buildSpawnTutorial, confirmAgentStarted, predictedLogPath, shouldForkNested, waitForRegistration };
131
- //# sourceMappingURL=forkNested-VroZS-nk.js.map
141
+ //# sourceMappingURL=forkNested-CDfWPiHw.js.map
@@ -439,4 +439,4 @@ async function cmdHist(rest) {
439
439
 
440
440
  //#endregion
441
441
  export { cmdHist };
442
- //# sourceMappingURL=hist-CoXBBjJt.js.map
442
+ //# sourceMappingURL=hist-BpocAe1N.js.map
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-CMOLbEEi.js";
3
- import { a as hasTodoStore, i as answerAsk, l as AgentContext, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-nuUnrVcf.js";
2
+ import "./versionChecker-CJgW9DHY.js";
3
+ import { a as hasTodoStore, i as answerAsk, l as AgentContext, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-CGtoPER5.js";
4
4
  import { _ as isKnownKind, a as renderTree, b as statesOf, c as monitorHint, d as openStore, f as DONE_STATE, g as initialState, h as canTransition, i as renderDigest, l as CycleError, m as ORPHANED_STATE, o as unblockedTasks, p as LIFECYCLES, r as openBlockers, s as describeBlock, t as reconcileTodos, u as TodoStore, v as nextStates, x as removeControlCharacters, y as requiredGate } from "./todoAutomation-BQRW614S.js";
5
5
  import "./JsonlStore-CPGIR0Wy.js";
6
6
  import "./globalPidIndex-Dq4KY2IV.js";
@@ -0,0 +1,3 @@
1
+ import { n as replyTargetOf, r as shortenHome, t as buildInitMsg } from "./initMsg-C-w4A_eF.js";
2
+
3
+ export { buildInitMsg };
@@ -0,0 +1,85 @@
1
+ import { homedir } from "os";
2
+
3
+ //#region ts/initMsg.ts
4
+ /**
5
+ * `<ay-init-msg …>` — the attribution wrapper around a SUB-AGENT's INITIAL prompt.
6
+ *
7
+ * `ay send` already wraps every agent→agent message in `<ay-msg nonce from …>`
8
+ * so the recipient knows who pinged it and exactly how to reply (see cmdSend in
9
+ * ts/subcommands.ts). The initial prompt had no such wrapper: an agent spawned by
10
+ * `ay claude -- "<task>"` from inside another agent's Bash tool received a bare
11
+ * task string with no idea that (a) it was spawned by an agent rather than a
12
+ * human, (b) that agent is blocked/waiting on it, or (c) how to talk back. It
13
+ * would finish, sit at an idle prompt, and nobody would ever learn.
14
+ *
15
+ * So the first message gets the same treatment as every later one — same
16
+ * nonce-delimited XML-ish framing, same `reply:` route — plus the one thing a
17
+ * later message doesn't need: an explicit REPORTING DUTY (ping the parent when
18
+ * you finish, and when you're stuck). The runtime enforces that duty
19
+ * independently in ts/parentPing.ts; this block is what makes the agent do it
20
+ * deliberately, with content, instead of the wrapper's terse automatic ping.
21
+ *
22
+ * Pure + fs-free (the caller supplies the nonce) so it is trivially unit-testable,
23
+ * mirroring `notifyRouter.ts` / `resultEnvelope.ts`. Mirrored in the Rust runtime
24
+ * by `rs/src/init_msg.rs` — keep the two formats byte-identical.
25
+ */
26
+ /** Replace a leading $HOME with `~`. Local copy of subcommands' shortenPath so
27
+ * this module stays import-light (it runs on the wrapper's cold-start path). */
28
+ function shortenHome(p, home = homedir()) {
29
+ if (!home || !p.startsWith(home)) return p;
30
+ const rest = p.slice(home.length);
31
+ if (rest !== "" && rest !== "/" && rest !== "\\") return "~" + rest;
32
+ return "~";
33
+ }
34
+ /** The stable id to address a reply to — agent_id when we have one, else pid. */
35
+ function replyTargetOf(spawner) {
36
+ const id = spawner.agentId?.trim();
37
+ return id ? id : String(spawner.pid);
38
+ }
39
+ /**
40
+ * Wrap a sub-agent's initial `prompt` in `<ay-init-msg …>`.
41
+ *
42
+ * `nonce` is generated by the CALLER, after the prompt text already exists, so
43
+ * text inside the body can't forge a matching open/close marker — the same
44
+ * forgery guard `<ay-msg>` relies on (nonce match, not tag syntax, is what makes
45
+ * the boundary trustworthy; strict-XML validity is deliberately sacrificed).
46
+ *
47
+ * Returns the prompt unchanged when there is no spawner (a top-level agent
48
+ * started from a human shell has nobody to report to, and the block would be
49
+ * pure noise on the overwhelmingly common path).
50
+ */
51
+ function buildInitMsg(prompt, spawner, nonce) {
52
+ if (!spawner) return prompt;
53
+ const target = replyTargetOf(spawner);
54
+ const where = shortenHome(spawner.cwd);
55
+ return [
56
+ `<ay-init-msg ${nonce} from ${spawner.cli} #${spawner.pid} @ ${where} — reply: ay send ${target} "...">`,
57
+ `<ay-task ${nonce}>`,
58
+ prompt,
59
+ `</ay-task ${nonce}>`,
60
+ ``,
61
+ `The task above was given to you by that agent — it spawned you and returned`,
62
+ `immediately, so it is NOT watching your terminal and will not see anything you`,
63
+ `print. Reach it by RUNNING THESE SHELL COMMANDS (in your bash/terminal tool):`,
64
+ ` ay send ${target} "..." report progress, ask a question, deliver the result`,
65
+ ` ay tail ${target} read what it has been doing`,
66
+ ``,
67
+ `\`ay\` is a SHELL COMMAND — run it in your bash/terminal tool. It is NOT your`,
68
+ `harness's built-in agent/message tool: that tool only knows agents your harness`,
69
+ `spawned and will say "no agent named ${target}". Do not substitute it, and do`,
70
+ `not conclude the parent is unreachable if it fails — use the shell.`,
71
+ ``,
72
+ `Reporting duty — you MUST run \`ay send ${target} "..."\` when either happens:`,
73
+ ` 1. You finish the task. Send the outcome itself (what changed, what you found,`,
74
+ ` files/PRs touched), not just "done" — it cannot read your transcript.`,
75
+ ` 2. You are blocked or stuck: a decision only it can make, a missing`,
76
+ ` credential/permission, a failing step you cannot get past. Say what you`,
77
+ ` tried and what you need. Do NOT sit at an idle prompt waiting.`,
78
+ `Until you do one of those, it is waiting on you.`,
79
+ `</ay-init-msg ${nonce}>`
80
+ ].join("\n");
81
+ }
82
+
83
+ //#endregion
84
+ export { replyTargetOf as n, shortenHome as r, buildInitMsg as t };
85
+ //# sourceMappingURL=initMsg-C-w4A_eF.js.map
@@ -0,0 +1,79 @@
1
+ //#region ts/needsInput.ts
2
+ function reTest(re, s) {
3
+ return (re.global || re.sticky ? new RegExp(re.source, re.flags.replace(/[gy]/g, "")) : re).test(s);
4
+ }
5
+ function isChromeLine(s) {
6
+ const t = s.trim();
7
+ return !t || /^─+$/.test(t) || /^esc to (interrupt|cancel)/i.test(t) || /\? for shortcuts/.test(t) || /\d+%\s*until auto-compact/i.test(t);
8
+ }
9
+ /**
10
+ * Returns a NeedsInput when the screen shows an unresolved selection menu, else
11
+ * null. `cfg.working` short-circuits to null (an actively-working agent isn't
12
+ * blocked). Pure + synchronous so it's trivially unit-testable.
13
+ */
14
+ function classifyNeedsInput(lines, cfg) {
15
+ const patterns = cfg.needsInput ?? [];
16
+ if (patterns.length === 0) return null;
17
+ const text = lines.join("\n");
18
+ if ((cfg.working ?? []).some((re) => reTest(re, text))) return null;
19
+ if (!patterns.some((re) => reTest(re, text))) return null;
20
+ let last = -1;
21
+ for (let i = 0; i < lines.length; i++) if (patterns.some((re) => reTest(re, lines[i]))) last = i;
22
+ const start = Math.max(0, last - 6);
23
+ const end = Math.min(lines.length, last + 6);
24
+ return { question: lines.slice(start, end).map((l) => l.trim()).filter((l) => l && !isChromeLine(l)).join(" • ").slice(0, 400) };
25
+ }
26
+ const OPTION_LINE = /^[\s❯›>▶◉○●·│*-]*?(\d+)\.\s/;
27
+ /**
28
+ * Parse the selection menu a `needs_input` agent is parked on into a cursor
29
+ * position + the available option numbers, so a caller can compute how far the
30
+ * cursor must move (Down/Up) to reach a target option. Returns null when the
31
+ * screen isn't a menu (delegates that judgement to {@link classifyNeedsInput},
32
+ * so `working` still wins) or no numbered cursor line is found. Pure — the
33
+ * `ay select` action reuses the exact detection `ay ls` renders with.
34
+ */
35
+ function parseMenu(lines, cfg) {
36
+ const ni = classifyNeedsInput(lines, cfg);
37
+ if (!ni) return null;
38
+ const patterns = cfg.needsInput ?? [];
39
+ let cursorLine = -1;
40
+ for (let i = 0; i < lines.length; i++) if (patterns.some((re) => reTest(re, lines[i]))) cursorLine = i;
41
+ if (cursorLine < 0) return null;
42
+ const cm = /(\d+)\./.exec(lines[cursorLine]);
43
+ if (!cm) return null;
44
+ const cursor = parseInt(cm[1], 10);
45
+ const start = Math.max(0, cursorLine - 12);
46
+ const end = Math.min(lines.length, cursorLine + 12);
47
+ const options = [];
48
+ for (let i = start; i < end; i++) {
49
+ const m = OPTION_LINE.exec(lines[i]);
50
+ if (m) {
51
+ const v = parseInt(m[1], 10);
52
+ if (!options.includes(v)) options.push(v);
53
+ }
54
+ }
55
+ if (!options.includes(cursor)) options.push(cursor);
56
+ options.sort((a, b) => a - b);
57
+ return {
58
+ cursor,
59
+ options,
60
+ question: ni.question
61
+ };
62
+ }
63
+ /**
64
+ * True when the rendered screen still shows a "busy" marker (config `working`,
65
+ * e.g. claude's `esc to interrupt`). Paired with a long-quiet log this is the
66
+ * `stuck` signal: a live spinner writes to the log every frame, so a busy marker
67
+ * on screen WITHOUT recent output means the agent wedged mid-stream (a silent
68
+ * API stream stall) rather than finishing. Pure + synchronous like the rest of
69
+ * this module so it's trivially unit-testable.
70
+ */
71
+ function isWorkingScreen(lines, working) {
72
+ if (!working?.length) return false;
73
+ const text = lines.join("\n");
74
+ return working.some((re) => reTest(re, text));
75
+ }
76
+
77
+ //#endregion
78
+ export { isWorkingScreen as n, parseMenu as r, classifyNeedsInput as t };
79
+ //# sourceMappingURL=needsInput-103zhZ90.js.map
@@ -53,4 +53,4 @@ async function ensureNodeRuntime(which = Bun.which) {
53
53
 
54
54
  //#endregion
55
55
  export { liveEnv as n, ensureNodeRuntime as t };
56
- //# sourceMappingURL=nodeRuntime-CT0w6zsB.js.map
56
+ //# sourceMappingURL=nodeRuntime-CRoEMWkp.js.map
@@ -3,9 +3,10 @@ import "./globalPidIndex-Dq4KY2IV.js";
3
3
  import "./messageLog-BYFwioFY.js";
4
4
  import "./e2e-CUMZC53I.js";
5
5
  import "./configShared-DtHMBCl7.js";
6
- import { E as listRecords, F as renderLogTailLines, Q as hostId, X as appendEvent, Z as gcInboxes, at as daemonLockOwnerPath, b as isPidAlive, et as listInboxParents, it as daemonLockDir, nt as readInbox, ot as notifyDir, rt as shouldStealLock, tt as liveWatchers, u as deriveLiveState } from "./subcommands-CQPnT5qu.js";
7
- import "./webrtcLink-CS4D-3G1.js";
8
- import "./remotes-iIvqiFWK.js";
6
+ import { L as renderLogTailLines, O as listRecords, d as deriveLiveState, x as isPidAlive } from "./subcommands-DtF31RoW.js";
7
+ import { f as readInbox, g as daemonLockOwnerPath, h as daemonLockDir, i as gcInboxes, l as listInboxParents, m as shouldStealLock, n as appendEvent, s as hostId, u as liveWatchers, x as notifyDir } from "./notifyStore-Cbw2ZJ0X.js";
8
+ import "./webrtcLink-DyCj380i.js";
9
+ import "./remotes-iMhdZytp.js";
9
10
  import { mkdir, readFile, rename, rm, stat, writeFile } from "fs/promises";
10
11
  import { randomUUID } from "node:crypto";
11
12
  import { execFile, execFileSync } from "node:child_process";
@@ -361,6 +362,11 @@ function startInlineHeartbeat(opts) {
361
362
  }
362
363
  };
363
364
  }
365
+ /** Upper bound on how long stop() waits for the worker thread to go away. Far
366
+ * longer than a terminate needs; short enough that shutdown never looks wedged.
367
+ * Overshooting only leaks an already-unref'd thread that cannot hold the
368
+ * process open. */
369
+ const STOP_TIMEOUT_MS = 2e3;
364
370
  function startOwnerHeartbeat(opts) {
365
371
  try {
366
372
  const worker = new Worker(WORKER_SRC, {
@@ -374,10 +380,31 @@ function startOwnerHeartbeat(opts) {
374
380
  });
375
381
  worker.on("error", () => {});
376
382
  if (typeof worker.unref === "function") worker.unref();
383
+ let exited = false;
384
+ const exitedPromise = new Promise((resolve) => {
385
+ worker.once("exit", () => {
386
+ exited = true;
387
+ resolve();
388
+ });
389
+ });
377
390
  return {
378
391
  isolated: true,
379
392
  stop: async () => {
380
- await worker.terminate().catch(() => {});
393
+ if (exited) return;
394
+ let timer;
395
+ const timeout = new Promise((resolve) => {
396
+ timer = setTimeout(resolve, STOP_TIMEOUT_MS);
397
+ if (typeof timer.unref === "function") timer.unref();
398
+ });
399
+ try {
400
+ await Promise.race([
401
+ worker.terminate().then(() => {}, () => {}),
402
+ exitedPromise,
403
+ timeout
404
+ ]);
405
+ } finally {
406
+ if (timer) clearTimeout(timer);
407
+ }
381
408
  }
382
409
  };
383
410
  } catch {
@@ -836,4 +863,4 @@ async function ensureDaemon() {
836
863
 
837
864
  //#endregion
838
865
  export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
839
- //# sourceMappingURL=notifyDaemon-BL1tmxUK.js.map
866
+ //# sourceMappingURL=notifyDaemon-BFzqcdN1.js.map
@@ -0,0 +1,4 @@
1
+ import "./logger-CDIsZ-Pp.js";
2
+ import { a as getCursor, c as isTransientLockMkdirError, d as minConsumerCursor, f as readInbox, i as gcInboxes, l as listInboxParents, m as shouldStealLock, n as appendEvent, o as heartbeatWatcher, p as setCursor, r as clearWatcher, s as hostId, t as acquireLock, u as liveWatchers } from "./notifyStore-Cbw2ZJ0X.js";
3
+
4
+ export { liveWatchers };