agent-yes 1.303.1 → 1.304.0-beta.811.1

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 (185) hide show
  1. package/README.md +54 -0
  2. package/default.config.yaml +11 -5
  3. package/dist/{JsonlStore-BpYZZTap.js → JsonlStore-CB_0sfdT.js} +5 -4
  4. package/dist/{SUPPORTED_CLIS-Dq9Lq9WJ.js → SUPPORTED_CLIS-BUAaJSjW.js} +2 -2
  5. package/dist/SUPPORTED_CLIS-DUBxhhoS.js +12 -0
  6. package/dist/{agentShare-suB6yPgO.js → agentShare-Dz9K8yDj.js} +10 -9
  7. package/dist/{askCli-BU3CNCLU.js → askCli-KmMf-3wA.js} +6 -6
  8. package/dist/{browser-BmxN1Ur9.js → browser-BAFPmEvN.js} +2 -2
  9. package/dist/{callback-Ctj3_Wxp.js → callback-DF0Tv0hB.js} +6 -6
  10. package/dist/callback-wDnBGRws.js +17 -0
  11. package/dist/{callbackCore-DSJWhqAe.js → callbackCore-BZ_10zyc.js} +1 -1
  12. package/dist/{callbackCore-BesbQ6-Z.js → callbackCore-Deve5pv3.js} +1 -1
  13. package/dist/{channels-j5nWuzlQ.js → channels-Y36S0ccW.js} +2 -2
  14. package/dist/cli.js +118 -13
  15. package/dist/{cmdDsh-2LP0grim.js → cmdDsh-DZ8bLsH7.js} +1 -1
  16. package/dist/cmdKill-CzSBfWmx.js +116 -0
  17. package/dist/{cmdPs-wc1j85fi.js → cmdPs-CFJmpFPo.js} +11 -10
  18. package/dist/{cwdConflictWarn-skQSMwEh.js → cwdConflictWarn-y-epQyOj.js} +21 -5
  19. package/dist/{cwdPassthroughHint-BUbWMoz0.js → cwdPassthroughHint-CzWh0hrw.js} +1 -1
  20. package/dist/{expose-Dawq1LxC.js → expose-Bhsn5yUz.js} +2 -2
  21. package/dist/forceKill-BDqxx4uQ.js +44 -0
  22. package/dist/{forkNested-CavHyWzA.js → forkNested-3heLs5XC.js} +45 -5
  23. package/dist/{globalPidIndex-CRB5KtyL.js → globalPidIndex-BsjlId-h.js} +6 -5
  24. package/dist/{globalPidIndex-BftWlg2V.js → globalPidIndex-uoz8Esqz.js} +2 -2
  25. package/dist/{hist-Cs0KFSUW.js → hist-DY16wm7g.js} +1 -1
  26. package/dist/{identity-DA7YI9km.js → identity-C0MxfwI2.js} +1 -1
  27. package/dist/{identity-Bk-aG_xl.js → identity-Ckav3-Up.js} +1 -1
  28. package/dist/index.js +7 -7
  29. package/dist/{initMsg-CcTqFtsp.js → initMsg-BEVDWYnv.js} +1 -1
  30. package/dist/{initMsg-D9KJnfgC.js → initMsg-GPU52N-j.js} +1 -1
  31. package/dist/liagent/box-BSIrRRc_.js +2320 -0
  32. package/dist/liagent/box-DloywR57.d.ts +409 -0
  33. package/dist/liagent/box.d.ts +3 -0
  34. package/dist/liagent/box.js +3 -0
  35. package/dist/liagent/cli.d.ts +1 -0
  36. package/dist/liagent/cli.js +908 -0
  37. package/dist/liagent/client.d.ts +28 -0
  38. package/dist/liagent/client.js +240 -0
  39. package/dist/liagent/echo-BvzPSI0x.js +86 -0
  40. package/dist/liagent/echo-W2RcMEny.d.ts +38 -0
  41. package/dist/liagent/hub.d.ts +405 -0
  42. package/dist/liagent/hub.js +1831 -0
  43. package/dist/liagent/index.d.ts +14 -0
  44. package/dist/liagent/index.js +10 -0
  45. package/dist/liagent/liagent.js +339 -0
  46. package/dist/liagent/mic-audio-C3Shud_F.js +754 -0
  47. package/dist/liagent/mic-audio-DMCWtEI-.d.ts +317 -0
  48. package/dist/liagent/mic-button-CtZHFBSG.js +651 -0
  49. package/dist/liagent/mic-button-Y0ioPetQ.d.ts +248 -0
  50. package/dist/liagent/mic.d.ts +3 -0
  51. package/dist/liagent/mic.js +4 -0
  52. package/dist/liagent/progress-CJs08bXb.js +473 -0
  53. package/dist/liagent/progress-CfE-meHr.d.ts +205 -0
  54. package/dist/liagent/progress.d.ts +2 -0
  55. package/dist/liagent/progress.js +3 -0
  56. package/dist/liagent/protocol.d.ts +324 -0
  57. package/dist/liagent/protocol.js +504 -0
  58. package/dist/liagent/speech-rate-DXeJjRTc.js +42 -0
  59. package/dist/liagent/state-tree-BZCmAknI.js +353 -0
  60. package/dist/liagent/tree-BrR7NwMf.js +710 -0
  61. package/dist/liagent/tree-HB9RhX_H.d.ts +295 -0
  62. package/dist/liagent/tree.d.ts +2 -0
  63. package/dist/liagent/tree.js +4 -0
  64. package/dist/liagent/ui-strings-B03le3fh.d.ts +27 -0
  65. package/dist/liagent/ui-strings-CJIwW5Gf.js +794 -0
  66. package/dist/liagent/ui.d.ts +394 -0
  67. package/dist/liagent/ui.js +5 -0
  68. package/dist/liagent/voice-D7yeS9VM.js +802 -0
  69. package/dist/liagent/voice-Qo7SCgi8.d.ts +308 -0
  70. package/dist/liagent/voice.d.ts +3 -0
  71. package/dist/liagent/voice.js +4 -0
  72. package/dist/{notifyDaemon-C7GlfJ1E.js → notifyDaemon-Cfr1q4ig.js} +10 -9
  73. package/dist/{openBrowser-1cIo4dJL.js → openBrowser-CQAOIrD6.js} +1 -1
  74. package/dist/oxmgrService-DlYHmqyI.js +37 -0
  75. package/dist/oxmgrService-o9L3I6FX.js +3 -0
  76. package/dist/{parentLink-DoEWVGld.js → parentLink-BcAYcO9L.js} +2 -2
  77. package/dist/{parentLink-B58V1RVd.js → parentLink-MBUD3oY2.js} +2 -2
  78. package/dist/{parentPingLoop-C73bbmCE.js → parentPingLoop-iZWjsofA.js} +5 -5
  79. package/dist/{pidStore-433kvh9D.js → pidStore-C50VPk3E.js} +3 -3
  80. package/dist/pidStore-COkPjpW8.js +6 -0
  81. package/dist/{procStats-BvmrBrOs.js → procStats-DwTxj3rs.js} +1 -1
  82. package/dist/{remotes-MfdV9M8u.js → remotes-BqLoB5GR.js} +2 -2
  83. package/dist/{remotes-DevcBeLl.js → remotes-BsMGvAay.js} +3 -3
  84. package/dist/{roomReplyAlias-DFqg_6IU.js → roomReplyAlias-B-v76TA8.js} +3 -3
  85. package/dist/roomReplyAlias-BzWUBkQy.js +6 -0
  86. package/dist/{rustBinary-7VK7oLlW.js → rustBinary-D662yXhz.js} +2 -2
  87. package/dist/{rustBinary-BV4LxMMn.js → rustBinary-DSy54HiQ.js} +2 -2
  88. package/dist/{schedule-Dp0qkNO1.js → schedule-Bsle2pG9.js} +15 -44
  89. package/dist/schedulesCli-CLqieyQZ.js +784 -0
  90. package/dist/senderAncestry-CVHeKk1Y.js +173 -0
  91. package/dist/senderAncestry-KhAUPCQs.js +3 -0
  92. package/dist/{serve-BpOIIOVc.js → serve-D5-_Ornj.js} +67 -69
  93. package/dist/{serveRust-CbBrcUrg.js → serveRust-BfWkeL6T.js} +31 -4
  94. package/dist/{setup-DdIBk6Iv.js → setup-D5VgdZy6.js} +5 -5
  95. package/dist/{share-w5oRbvlj.js → share-CbFetL5H.js} +1 -1
  96. package/dist/{share-DrS3LYqf.js → share-_TPYAGWC.js} +1 -1
  97. package/dist/{shareCmd-DDENkBW2.js → shareCmd-BoU6fYhd.js} +10 -10
  98. package/dist/spawnGate-Dfj9V76w.js +5 -0
  99. package/dist/{spawnGate-lr3tvA6U.js → spawnGate-Dj_WaS29.js} +3 -3
  100. package/dist/subcommands-CfX1dykY.js +15 -0
  101. package/dist/{subcommands-DxgvDmZX.js → subcommands-inhA_5Bh.js} +568 -310
  102. package/dist/{systemPathLink-SjUzgSiq.js → systemPathLink-Y3iC7bYV.js} +1 -1
  103. package/dist/{terminal-C2h7tpe0.js → terminal-VU0sNl4u.js} +2 -2
  104. package/dist/terminal.js +1 -1
  105. package/dist/{todoAutomation-TTp_Qz9G.js → todoAutomation-CKlrxuZv.js} +2 -2
  106. package/dist/{todoCli-BWm5nZE0.js → todoCli-CU9vSJSJ.js} +6 -6
  107. package/dist/{todoIdentity-BvXZKWJI.js → todoIdentity-CzS1e7VL.js} +2 -2
  108. package/dist/{todoStore-C9RTz0Vs.js → todoStore-msRCEUi1.js} +2 -2
  109. package/dist/{tray-BeRSozJz.js → tray-CLktEN3G.js} +1 -1
  110. package/dist/{trayApp-QQjqhDv1.js → trayApp-BmV7Lhk8.js} +2 -2
  111. package/dist/trayApp-WCJwE61x.js +5 -0
  112. package/dist/{ts-6LF7f4fx.js → ts-cuQG3XuS.js} +126 -57
  113. package/dist/{versionChecker-Bc62HNf6.js → versionChecker-m9b0DkSe.js} +2 -2
  114. package/dist/{webrtcLink-va_gAR77.js → webrtcLink-DcvacEci.js} +1 -1
  115. package/dist/{webrtcLink-SsInrVHU.js → webrtcLink-WxS1nTIs.js} +1 -1
  116. package/dist/{webrtcRemote-BlGyNZDC.js → webrtcRemote-C3xQyf3u.js} +2 -2
  117. package/dist/{widget-Crb5zeHL.js → widget-oCv36kbd.js} +3 -3
  118. package/dist/widgets.js +1 -1
  119. package/dist/{workspaceConfig-BLWB5Wu9.js → workspaceConfig-DBgsu81B.js} +1 -1
  120. package/dist/{ws-BRhPG1Vy.js → ws-D8d8xZMK.js} +9 -8
  121. package/dist/{ws-DIbwNz8Z.js → ws-I1_6h2dZ.js} +3 -3
  122. package/lab/ui/index.html +1 -1
  123. package/lab/ui/lab/posts/2026-08-11-slack-term-safe-writes.md +1 -1
  124. package/package.json +73 -8
  125. package/ts/JsonlStore.ts +10 -3
  126. package/ts/cli-idle.bun.spec.ts +1 -1
  127. package/ts/cli-idle.spec.ts +1 -1
  128. package/ts/cli.ts +35 -0
  129. package/ts/cmdKill.bun.spec.ts +155 -0
  130. package/ts/cmdKill.spec.ts +155 -0
  131. package/ts/cmdKill.ts +183 -0
  132. package/ts/composerGuard.edges.spec.ts +93 -0
  133. package/ts/composerGuard.spec.ts +104 -6
  134. package/ts/composerGuard.ts +86 -16
  135. package/ts/configShared.spec.ts +9 -0
  136. package/ts/conptyModeFilter.spec.ts +30 -0
  137. package/ts/conptyModeFilter.ts +53 -0
  138. package/ts/copyLiagent.ts +42 -0
  139. package/ts/cwdConflictWarn.io.spec.ts +50 -0
  140. package/ts/cwdConflictWarn.spec.ts +34 -1
  141. package/ts/cwdConflictWarn.ts +43 -5
  142. package/ts/cwdGuard.spec.ts +110 -0
  143. package/ts/cwdGuard.ts +118 -0
  144. package/ts/forceKill.ts +52 -0
  145. package/ts/forkNested.bun.spec.ts +41 -0
  146. package/ts/forkNested.spec.ts +41 -0
  147. package/ts/forkNested.ts +48 -1
  148. package/ts/globalPidIndex.edges.spec.ts +125 -0
  149. package/ts/globalPidIndex.ts +6 -2
  150. package/ts/index.ts +13 -1
  151. package/ts/interruptSend.bun.spec.ts +99 -0
  152. package/ts/interruptSend.spec.ts +99 -0
  153. package/ts/interruptSend.ts +51 -0
  154. package/ts/lockRegistry.spec.ts +49 -0
  155. package/ts/lsRenderCache.spec.ts +58 -0
  156. package/ts/needsInput.edges.spec.ts +23 -0
  157. package/ts/parseCliArgs.ts +7 -0
  158. package/ts/pushGatePlan.spec.ts +147 -0
  159. package/ts/roomReplyAlias.io.spec.ts +81 -0
  160. package/ts/schedule.ts +5 -1
  161. package/ts/schedules.bun.spec.ts +397 -0
  162. package/ts/schedules.spec.ts +397 -0
  163. package/ts/schedules.ts +517 -0
  164. package/ts/schedulesCli.ts +386 -0
  165. package/ts/sendControl.bun.spec.ts +12 -0
  166. package/ts/senderAncestry.ts +1 -3
  167. package/ts/serve.ts +22 -33
  168. package/ts/serveRust.spec.ts +29 -2
  169. package/ts/serveRust.ts +27 -2
  170. package/ts/sizeNego.bun.spec.ts +9 -2
  171. package/ts/sizeNego.spec.ts +9 -2
  172. package/ts/sizeNego.ts +10 -5
  173. package/ts/subcommands.spec.ts +448 -9
  174. package/ts/subcommands.ts +613 -94
  175. package/ts/suggestAgents.spec.ts +33 -0
  176. package/ts/terminal/browser.ts +1 -1
  177. package/ts/todoParse.spec.ts +22 -1
  178. package/ts/todoParse.ts +19 -0
  179. package/dist/SUPPORTED_CLIS-ByO5twge.js +0 -12
  180. package/dist/callback-D7qfh_7p.js +0 -16
  181. package/dist/pidStore-BRlKRHXY.js +0 -6
  182. package/dist/roomReplyAlias-DuEkSSDI.js +0 -6
  183. package/dist/spawnGate-DeQBTX-o.js +0 -5
  184. package/dist/subcommands-DmiswRy4.js +0 -14
  185. package/dist/trayApp-C4TAvRvU.js +0 -5
package/README.md CHANGED
@@ -182,6 +182,26 @@ cy attach <keyword> # interactive attach (detach: Ctrl-\)
182
182
  cy stop <keyword> # graceful shutdown (claude/codex: /exit)
183
183
  ```
184
184
 
185
+ `ay send` writes to busy agents without waiting for idle, using native Enter
186
+ delivery (including the CLI's own queue). Existing drafts and active typing
187
+ remain protected, so these can defer delivery. It never substitutes a
188
+ cancellation shortcut based on a busy indicator or a shortcut hint.
189
+
190
+ To explicitly request agy's immediate-send shortcut, use
191
+ `ay send <keyword> "message" --code=alt-m`. This sends `ESC m` after pasting and
192
+ may interrupt the current turn; native queued delivery remains the default.
193
+ The explicit shortcut is supported by `--no-wait` and the drainer too, and is
194
+ never retried automatically.
195
+
196
+ Use `ay send <keyword> "message" --interrupt` (or `-i`) to stop a running local
197
+ Claude, Codex, or agy turn first. It sends Escape once, waits up to eight seconds
198
+ for an idle input prompt, then pastes and submits the message. If cancellation
199
+ does not reach idle, the message is not sent. Permission and confirmation
200
+ prompts are never cancelled: the command reports that interruption was skipped
201
+ and uses the normal send path. Existing drafts remain protected. `--no-wait`
202
+ still waits for cancellation before skipping message submission confirmation.
203
+
204
+
185
205
  #### Tips
186
206
 
187
207
  - A **single** `--code=ctrl-c` does not stop `claude` / `codex` — they treat it
@@ -195,6 +215,24 @@ cy stop <keyword> # graceful shutdown (claude/codex: /exit)
195
215
  so subcommands work whether the target agent is the TS or Rust runtime.
196
216
  Detailed reference (Japanese): [`docs/cy-subcommands.md`](./docs/cy-subcommands.md).
197
217
 
218
+ ### Recurring reminders (`ay cron`)
219
+
220
+ Send a message to an agent on a 5-field cron (timezone `$AY_CRON_TZ`, default Asia/Tokyo):
221
+
222
+ ```bash
223
+ ay cron "*/30 9-18 * * 1-5" lane:alpha "progress report please ({now})"
224
+ ay cron ls # id, cron, target, next run, last result
225
+ ay cron rm c1
226
+ ay schedules ls # everything: cron reminders + legacy `ay schedule` jobs
227
+ ay schedules daemon status # the per-machine scheduler daemon
228
+ ```
229
+
230
+ Reminders live in one store (`~/.config/agent-yes/schedules.json`). One scheduler
231
+ daemon per machine fires them (it sleeps until the next fire, no polling, and wakes when the store changes) with `ay send --force`; it is kept alive by oxmgr when
232
+ installed, else systemd --user, launchd, Windows Task Scheduler, or a detached process.
233
+ A tick missed while the daemon was down is skipped. Fires are logged as JSONL to
234
+ `~/.local/share/agent-yes/schedules.log`; a target that isn't live is logged and skipped.
235
+
198
236
  ### Shared task list across agents (`ay todo`)
199
237
 
200
238
  A lifecycle-tracked task list that every agent working on a repo reads and
@@ -229,6 +267,7 @@ Tasks move through a lifecycle per `--kind`, and gated transitions require
229
267
  **independent verification**: whoever did the work cannot approve it. See
230
268
  `ts/todoStore.ts` for the gate model.
231
269
 
270
+
232
271
  ### Ask another agent a question (`ay ask`)
233
272
 
234
273
  `ay send` の送信確認では、今回のメッセージ識別子が入力欄から履歴へ移ったことを調べます。終了コードは `0` = 送信確認済み、`1` = `NOT SUBMITTED`(宛先を確認してから再送)、`3` = 宛先到達不能、`4` = `QUEUED`(受付済み・処理待ち)です。`4` は失敗として本文を再送せず、宛先の処理を待ってください。確認できない画面や入力候補・ダイアログには Enter を追加しません。`--no-wait` は従来どおり確認を省略するため、終了コード `0` でも送信確認を意味しません。
@@ -618,6 +657,21 @@ await claudeYes({
618
657
  });
619
658
  ```
620
659
 
660
+ ### Chat with your agent from any web page
661
+
662
+ `agent-yes/liagent` is [liagent](https://github.com/snolab/liagent): a
663
+ floating chat box for your own web pages (a framework-free custom element),
664
+ the hub it talks to (a Cloudflare Durable Object), and the `liagent` CLI that
665
+ delivers each message into an agent-yes agent. It needs none of agent-yes's
666
+ CLI dependencies, so it bundles cleanly for browsers and Workers.
667
+
668
+ ```typescript
669
+ import { connectHub, defineChatBox } from "agent-yes/liagent";
670
+ import { chatHub, routeChat } from "agent-yes/liagent/hub";
671
+ ```
672
+
673
+ See liagent's README and docs for the hub setup and each framework.
674
+
621
675
  ## Implementation
622
676
 
623
677
  The tool uses `node-pty` to spawn and manage AI CLI processes, with a sophisticated pattern-matching system that:
@@ -55,14 +55,14 @@ clis:
55
55
  # then confirms it once the screen has moved. Single-line on purpose —
56
56
  # the TS runtime matches typingRespond per rendered line.
57
57
  "\u001b[B":
58
- - pattern: '❯ ?No, exit'
58
+ - pattern: "❯ ?No, exit"
59
59
  flags: m
60
60
  enter:
61
61
  # Trust dialog, legacy numbered layout (cursor already on Yes).
62
62
  - pattern: ' > 1\. Yes, I trust this folder'
63
63
  flags: m
64
64
  # Trust dialog, current layout — after the Down above moved the cursor.
65
- - pattern: '❯ ?Yes, I trust this folder'
65
+ - pattern: "❯ ?Yes, I trust this folder"
66
66
  flags: m
67
67
  - pattern: '❯ ?1\. ?Dark mode ?✔'
68
68
  flags: m
@@ -223,14 +223,14 @@ clis:
223
223
  # then confirms it once the screen has moved. Single-line on purpose —
224
224
  # the TS runtime matches typingRespond per rendered line.
225
225
  "\u001b[B":
226
- - pattern: '❯ ?No, exit'
226
+ - pattern: "❯ ?No, exit"
227
227
  flags: m
228
228
  enter:
229
229
  # Trust dialog, legacy numbered layout (cursor already on Yes).
230
230
  - pattern: ' > 1\. Yes, I trust this folder'
231
231
  flags: m
232
232
  # Trust dialog, current layout — after the Down above moved the cursor.
233
- - pattern: '❯ ?Yes, I trust this folder'
233
+ - pattern: "❯ ?Yes, I trust this folder"
234
234
  flags: m
235
235
  - pattern: '❯ ?1\. ?Dark mode ?✔'
236
236
  flags: m
@@ -365,9 +365,15 @@ clis:
365
365
  needsInput:
366
366
  - pattern: '^ {0,4}> ?\d+\.'
367
367
  flags: m
368
+ typingRespond:
369
+ # Feedback survey agy shows after a turn ("How's the CLI experience so
370
+ # far? ... [1] Good [2] Fine [3] Bad [0] Skip"). A digit key answers it;
371
+ # until then it holds the keyboard, so press 0 to skip.
372
+ "0":
373
+ - '\[1\] Good +\[2\] Fine +\[3\] Bad +\[0\] Skip'
368
374
  enter:
369
375
  # First-launch trust dialog; cursor starts on "Yes, I trust this folder".
370
- - pattern: '^ {0,4}> ?Yes, I trust this folder'
376
+ - pattern: "^ {0,4}> ?Yes, I trust this folder"
371
377
  flags: m
372
378
  # Tool permission menu ("1. Yes, run command" / "1. Yes, ..."); the
373
379
  # cursor starts on option 1.
@@ -160,11 +160,12 @@ var JsonlStore = class {
160
160
  }
161
161
  }
162
162
  async withLock(fn) {
163
- const dir = path.dirname(this.filePath);
164
163
  let release;
165
164
  try {
166
- release = await lock(dir, {
167
- lockfilePath: this.filePath + ".lock",
165
+ const lockfilePath = this.filePath + ".lock";
166
+ release = await lock(lockfilePath, {
167
+ realpath: false,
168
+ lockfilePath,
168
169
  retries: {
169
170
  retries: 5,
170
171
  minTimeout: 50,
@@ -184,4 +185,4 @@ function generateId() {
184
185
 
185
186
  //#endregion
186
187
  export { JsonlStore as t };
187
- //# sourceMappingURL=JsonlStore-BpYZZTap.js.map
188
+ //# sourceMappingURL=JsonlStore-CB_0sfdT.js.map
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-6LF7f4fx.js";
1
+ import { t as CLIS_CONFIG } from "./ts-cuQG3XuS.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-Dq9Lq9WJ.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-BUAaJSjW.js.map
@@ -0,0 +1,12 @@
1
+ import "./logger-CDIsZ-Pp.js";
2
+ import "./versionChecker-m9b0DkSe.js";
3
+ import "./ts-cuQG3XuS.js";
4
+ import "./todoAutomation-CKlrxuZv.js";
5
+ import "./JsonlStore-CB_0sfdT.js";
6
+ import "./globalPidIndex-BsjlId-h.js";
7
+ import "./pidStore-C50VPk3E.js";
8
+ import "./messageLog-Dq_ka-Bt.js";
9
+ import "./todoStore-msRCEUi1.js";
10
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BUAaJSjW.js";
11
+
12
+ export { SUPPORTED_CLIS };
@@ -1,16 +1,17 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./JsonlStore-BpYZZTap.js";
3
- import "./globalPidIndex-CRB5KtyL.js";
4
- import "./pidStore-433kvh9D.js";
2
+ import "./JsonlStore-CB_0sfdT.js";
3
+ import "./globalPidIndex-BsjlId-h.js";
4
+ import "./pidStore-C50VPk3E.js";
5
5
  import "./messageLog-Dq_ka-Bt.js";
6
6
  import "./e2e-BdLf8DvY.js";
7
7
  import "./configShared-De4bR5hH.js";
8
- import "./webrtcLink-va_gAR77.js";
9
- import "./remotes-DevcBeLl.js";
10
- import "./roomReplyAlias-DFqg_6IU.js";
11
- import { nt as resolveOne } from "./subcommands-DxgvDmZX.js";
8
+ import { ot as resolveOne } from "./subcommands-inhA_5Bh.js";
9
+ import "./webrtcLink-DcvacEci.js";
10
+ import "./remotes-BsMGvAay.js";
11
+ import "./roomReplyAlias-B-v76TA8.js";
12
12
  import "./notifyStore-DIfkfKB2.js";
13
- import { l as startShare } from "./share-w5oRbvlj.js";
13
+ import "./senderAncestry-CVHeKk1Y.js";
14
+ import { l as startShare } from "./share-CbFetL5H.js";
14
15
 
15
16
  //#region ts/agentShare.ts
16
17
  const MAX_SHARES = 8;
@@ -233,4 +234,4 @@ function transformEvent(rawEvent, agentId, forwarded) {
233
234
 
234
235
  //#endregion
235
236
  export { createScopedShare, listShares, revokeAllShares, revokeShare };
236
- //# sourceMappingURL=agentShare-suB6yPgO.js.map
237
+ //# sourceMappingURL=agentShare-Dz9K8yDj.js.map
@@ -1,9 +1,9 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./JsonlStore-BpYZZTap.js";
3
- import "./globalPidIndex-CRB5KtyL.js";
4
- import { r as openStore } from "./todoStore-C9RTz0Vs.js";
5
- import { t as formatIdentity } from "./identity-Bk-aG_xl.js";
6
- import { a as resolveTodoRoot, i as resolveSelf } from "./todoIdentity-BvXZKWJI.js";
2
+ import "./JsonlStore-CB_0sfdT.js";
3
+ import "./globalPidIndex-BsjlId-h.js";
4
+ import { r as openStore } from "./todoStore-msRCEUi1.js";
5
+ import { t as formatIdentity } from "./identity-Ckav3-Up.js";
6
+ import { a as resolveTodoRoot, i as resolveSelf } from "./todoIdentity-CzS1e7VL.js";
7
7
  import yargs from "yargs";
8
8
  import { randomBytes } from "crypto";
9
9
 
@@ -269,4 +269,4 @@ async function runAnswerSubcommand(rest, deps) {
269
269
 
270
270
  //#endregion
271
271
  export { runAnswerSubcommand, runAskSubcommand };
272
- //# sourceMappingURL=askCli-BU3CNCLU.js.map
272
+ //# sourceMappingURL=askCli-KmMf-3wA.js.map
@@ -13031,7 +13031,7 @@ var AyTerminal = class {
13031
13031
  * daemon's negotiation (3a/3b) can shrink the shared PTY to what the panel shows —
13032
13032
  * the "drag the widget to resize the agent" behavior, but through the same
13033
13033
  * smallest-client-wins negotiation as every other viewer (bounded by the operator's
13034
- * local terminal + the 40×10 floor), NOT a raw /api/resize that scrambled everyone.
13034
+ * local terminal + the 80×10 floor), NOT a raw /api/resize that scrambled everyone.
13035
13035
  * Debounced so a drag doesn't spam. Read-only widgets never report (pure observers).
13036
13036
  */
13037
13037
  sendCap(cols, rows) {
@@ -13566,4 +13566,4 @@ const XTERM_CSS = `
13566
13566
 
13567
13567
  //#endregion
13568
13568
  export { AyTerminal as t };
13569
- //# sourceMappingURL=browser-BmxN1Ur9.js.map
13569
+ //# sourceMappingURL=browser-BAFPmEvN.js.map
@@ -1,9 +1,9 @@
1
1
  import { t as agentYesHome } from "./agentYesHome-JmJC28YX.js";
2
- import { nt as resolveOne } from "./subcommands-DxgvDmZX.js";
3
- import { a as mintCapability, o as parseExpires } from "./callbackCore-BesbQ6-Z.js";
4
- import { randomBytes } from "node:crypto";
2
+ import { ot as resolveOne } from "./subcommands-inhA_5Bh.js";
3
+ import { a as mintCapability, o as parseExpires } from "./callbackCore-Deve5pv3.js";
5
4
  import { chmodSync, readFileSync, renameSync, writeFileSync } from "node:fs";
6
5
  import path from "node:path";
6
+ import { randomBytes } from "node:crypto";
7
7
  import { mkdir, readFile, writeFile } from "node:fs/promises";
8
8
 
9
9
  //#region ts/callback.ts
@@ -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-BpOIIOVc.js");
75
+ const { resolveLocalServeUrl } = await import("./serve-D5-_Ornj.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-DSJWhqAe.js");
173
+ const { buildSnippet } = await import("./callbackCore-BZ_10zyc.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-Ctj3_Wxp.js.map
190
+ //# sourceMappingURL=callback-DF0Tv0hB.js.map
@@ -0,0 +1,17 @@
1
+ import "./logger-CDIsZ-Pp.js";
2
+ import "./JsonlStore-CB_0sfdT.js";
3
+ import "./globalPidIndex-BsjlId-h.js";
4
+ import "./pidStore-C50VPk3E.js";
5
+ import "./messageLog-Dq_ka-Bt.js";
6
+ import "./e2e-BdLf8DvY.js";
7
+ import "./configShared-De4bR5hH.js";
8
+ import "./subcommands-inhA_5Bh.js";
9
+ import "./webrtcLink-DcvacEci.js";
10
+ import "./remotes-BsMGvAay.js";
11
+ import "./roomReplyAlias-B-v76TA8.js";
12
+ import "./notifyStore-DIfkfKB2.js";
13
+ import "./senderAncestry-CVHeKk1Y.js";
14
+ import "./callbackCore-Deve5pv3.js";
15
+ import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-DF0Tv0hB.js";
16
+
17
+ export { cmdCallback };
@@ -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-BesbQ6-Z.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-Deve5pv3.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-BesbQ6-Z.js.map
143
+ //# sourceMappingURL=callbackCore-Deve5pv3.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-3F7owPWt.js");
390
- const { importRTC, getIceServers } = await import("./share-DrS3LYqf.js");
390
+ const { importRTC, getIceServers } = await import("./share-_TPYAGWC.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-j5nWuzlQ.js.map
570
+ //# sourceMappingURL=channels-Y36S0ccW.js.map
package/dist/cli.js CHANGED
@@ -1,14 +1,92 @@
1
1
  #!/usr/bin/env bun
2
2
  import { t as invokedCliName } from "./invokedCli-zdFbz1ST.js";
3
3
  import { n as logger } from "./logger-CDIsZ-Pp.js";
4
- import { a as versionString, r as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-Bc62HNf6.js";
5
- import { m as getRustBinary } from "./rustBinary-7VK7oLlW.js";
4
+ import { a as versionString, r as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-m9b0DkSe.js";
5
+ import { m as getRustBinary } from "./rustBinary-D662yXhz.js";
6
+ import { statSync } from "node:fs";
7
+ import { isAbsolute } from "node:path";
6
8
  import { argv } from "process";
7
9
  import { spawn } from "child_process";
8
10
  import ms from "ms";
9
11
  import yargs from "yargs";
10
12
  import { hideBin } from "yargs/helpers";
11
13
 
14
+ //#region ts/cwdGuard.ts
15
+ /**
16
+ * Startup guard for a working directory that no longer exists.
17
+ *
18
+ * A shell can sit in a directory that gets deleted and recreated under it —
19
+ * routine here, since `ay ws new` re-clones `<ws>/tree/<branch>` and worktrees
20
+ * get removed and re-added while a terminal is parked inside one. The path
21
+ * still resolves, but the inode the shell holds is gone, so `process.cwd()`
22
+ * throws ENOENT/uv_cwd.
23
+ *
24
+ * Nothing used to catch that. The first thing to call `process.cwd()` was the
25
+ * eager config load (ts/index.ts top-level-awaits agent-yes.config.ts, whose
26
+ * body awaits loadCascadingConfig → process.cwd()), and later execa and
27
+ * bun-pty, so `cy` died with a raw Bun stack trace — three of them — before any
28
+ * of our own error handling existed. No pid record, no log, nothing to read
29
+ * back; see the no-trace symptom in the report that prompted this.
30
+ *
31
+ * So this runs FIRST, before anything else can touch the cwd: recover when the
32
+ * shell's `$PWD` still names a real directory (the recreated workspace — which
33
+ * is where the user meant to be), and otherwise fail with one actionable line
34
+ * instead of a stack trace.
35
+ *
36
+ * Imported for its side effect as the first import of ts/cli.ts: an ES module's
37
+ * imports are evaluated before the importing module's body, so an inline check
38
+ * in cli.ts would already be too late if any import touched the cwd.
39
+ * cwdGuard.spec.ts pins that import position.
40
+ */
41
+ function staleMessage(pwd) {
42
+ return `agent-yes: this shell's working directory${pwd ? ` ('${pwd}')` : ""} no longer exists.\n It was deleted or replaced while the shell stayed in it, so process.cwd()\n fails (ENOENT/uv_cwd) and no agent can be started here.\n Re-enter it, then retry:\n cd "$PWD" # if the path was recreated\n cd <some-dir> # otherwise, go somewhere that exists\n`;
43
+ }
44
+ /**
45
+ * Is the cwd usable, and can it be recovered when not? Pure given `deps`; the
46
+ * process-mutating `chdir` only runs on the recovery path.
47
+ */
48
+ function checkCwd(deps = {}) {
49
+ const cwd = deps.cwd ?? (() => process.cwd());
50
+ const chdir = deps.chdir ?? ((dir) => process.chdir(dir));
51
+ const pwd = "pwd" in deps ? deps.pwd : process.env.PWD;
52
+ const isDir = deps.isDir ?? ((dir) => {
53
+ try {
54
+ return statSync(dir).isDirectory();
55
+ } catch {
56
+ return false;
57
+ }
58
+ });
59
+ try {
60
+ cwd();
61
+ return { state: "ok" };
62
+ } catch {}
63
+ if (pwd && isAbsolute(pwd) && isDir(pwd)) try {
64
+ chdir(pwd);
65
+ return {
66
+ state: "recovered",
67
+ dir: pwd
68
+ };
69
+ } catch {}
70
+ return {
71
+ state: "stale",
72
+ message: staleMessage(pwd)
73
+ };
74
+ }
75
+ /** Apply the verdict: notify on recovery, exit 1 with one readable line otherwise. */
76
+ function applyCwdGuard(deps = {}, io = {}) {
77
+ const warn = io.warn ?? ((s) => void process.stderr.write(s));
78
+ const fail = io.fail ?? ((s) => {
79
+ process.stderr.write(s);
80
+ process.exit(1);
81
+ });
82
+ const verdict = checkCwd(deps);
83
+ if (verdict.state === "recovered") warn(`agent-yes: the working directory was replaced while this shell sat in it; continuing in ${verdict.dir}\n`);
84
+ else if (verdict.state === "stale") fail(verdict.message);
85
+ return verdict;
86
+ }
87
+ applyCwdGuard();
88
+
89
+ //#endregion
12
90
  //#region ts/parseCliArgs.ts
13
91
  /**
14
92
  * Parse CLI arguments the same way cli.ts does
@@ -26,6 +104,10 @@ function parseCliArgs(argv, supportedClis) {
26
104
  default: false,
27
105
  description: "Run the agent in the foreground even when nested inside another agent (disables fork-by-default; also AGENT_YES_ATTACH=1).",
28
106
  alias: "foreground"
107
+ }).option("detach", {
108
+ type: "boolean",
109
+ default: false,
110
+ description: "Start the agent in the background and return immediately (prints its pid and how to drive it) — e.g. when spawning over ssh. Rust runtime only."
29
111
  }).option("logFile", {
30
112
  type: "string",
31
113
  description: "Rendered log file to write to."
@@ -232,6 +314,7 @@ function parseCliArgs(argv, supportedClis) {
232
314
  queue: parsedArgv.queue,
233
315
  robust: parsedArgv.robust,
234
316
  attach: parsedArgv.attach,
317
+ detach: parsedArgv.detach,
235
318
  logFile: parsedArgv.logFile,
236
319
  verbose: parsedArgv.verbose,
237
320
  resume: parsedArgv.continue,
@@ -295,7 +378,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
295
378
  const rawArg = process.argv[2];
296
379
  const managerCommands = !invokedCliName(process.argv);
297
380
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
298
- const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken, isBareManagerInvocation } = await import("./subcommands-DmiswRy4.js");
381
+ const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken, isBareManagerInvocation } = await import("./subcommands-CfX1dykY.js");
299
382
  if (isHelpFlag && process.argv.length === 3) {
300
383
  await cmdHelp(managerCommands);
301
384
  process.exit(0);
@@ -309,7 +392,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
309
392
  process.exit(code ?? 0);
310
393
  }
311
394
  {
312
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-ByO5twge.js");
395
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DUBxhhoS.js");
313
396
  if (isUnknownManagerToken(rawArg, managerCommands, SUPPORTED_CLIS)) {
314
397
  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
398
  process.exit(1);
@@ -317,7 +400,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
317
400
  }
318
401
  }
319
402
  {
320
- const { detectCwdPassthrough, SUPPRESS_CWD_WARN_ENV } = await import("./cwdPassthroughHint-BUbWMoz0.js");
403
+ const { detectCwdPassthrough, SUPPRESS_CWD_WARN_ENV } = await import("./cwdPassthroughHint-CzWh0hrw.js");
321
404
  const dep = detectCwdPassthrough(process.argv);
322
405
  if (dep) {
323
406
  console.warn(dep.message);
@@ -327,17 +410,34 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
327
410
  await checkAndAutoUpdate();
328
411
  logger.info(versionString());
329
412
  const config = parseCliArgs(process.argv);
413
+ {
414
+ const { stripDetachFlag } = await import("./forkNested-3heLs5XC.js");
415
+ const res = stripDetachFlag(process.argv.slice(2), Boolean(config.detach));
416
+ if (!res.ok) {
417
+ console.error(res.error);
418
+ process.exit(1);
419
+ }
420
+ process.argv.splice(2, process.argv.length - 2, ...res.args);
421
+ }
422
+ if (config.detach && (config.attach || process.env.AGENT_YES_ATTACH === "1")) {
423
+ console.error("--detach and --attach (or AGENT_YES_ATTACH=1) contradict each other.");
424
+ process.exit(1);
425
+ }
426
+ if (config.detach && !config.useRust) {
427
+ console.error("--detach needs the Rust runtime (drop --no-rust / AGENT_YES_NO_RUST).");
428
+ process.exit(1);
429
+ }
330
430
  if (config.tray) {
331
- const { startTray } = await import("./tray-BeRSozJz.js");
431
+ const { startTray } = await import("./tray-CLktEN3G.js");
332
432
  await startTray();
333
433
  await new Promise(() => {});
334
434
  }
335
435
  {
336
- const { ensureTray } = await import("./tray-BeRSozJz.js");
436
+ const { ensureTray } = await import("./tray-CLktEN3G.js");
337
437
  ensureTray();
338
438
  }
339
439
  if (!config.showVersion && !config.appendPrompt && !config.tray) {
340
- const { waitForSpawnCapacity } = await import("./spawnGate-DeQBTX-o.js");
440
+ const { waitForSpawnCapacity } = await import("./spawnGate-Dfj9V76w.js");
341
441
  await waitForSpawnCapacity({
342
442
  onWait: (reason, waitedMs) => {
343
443
  if (config.verbose || waitedMs === 0) console.error(`[agent-yes] spawn gate: ${reason} — waiting…`);
@@ -346,7 +446,7 @@ if (!config.showVersion && !config.appendPrompt && !config.tray) {
346
446
  });
347
447
  }
348
448
  if (!config.showVersion && !config.appendPrompt && !config.tray) {
349
- const { warnIfCwdOccupied } = await import("./cwdConflictWarn-skQSMwEh.js");
449
+ const { warnIfCwdOccupied } = await import("./cwdConflictWarn-y-epQyOj.js");
350
450
  await warnIfCwdOccupied(process.argv);
351
451
  }
352
452
  if (config.useRust) {
@@ -359,19 +459,24 @@ if (config.useRust) {
359
459
  console.error("[rust] Falling back to TypeScript implementation.");
360
460
  }
361
461
  }
462
+ if (!rustBinary && config.detach) {
463
+ console.error("--detach needs the Rust runtime, and its binary is unavailable (try --verbose).");
464
+ process.exit(1);
465
+ }
362
466
  if (rustBinary) {
363
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-ByO5twge.js");
467
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DUBxhhoS.js");
364
468
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
365
469
  if (config.verbose) {
366
470
  console.log(`[rust] Using binary: ${rustBinary}`);
367
471
  console.log(`[rust] Args: ${rustArgs.join(" ")}`);
368
472
  }
369
473
  const attach = config.attach || process.env.AGENT_YES_ATTACH === "1";
370
- const { shouldForkNested, buildSpawnTutorial, waitForRegistration, confirmAgentStarted, predictedLogPath } = await import("./forkNested-CavHyWzA.js");
474
+ const { shouldForkNested, buildSpawnTutorial, waitForRegistration, confirmAgentStarted, predictedLogPath } = await import("./forkNested-3heLs5XC.js");
371
475
  if (shouldForkNested({
372
476
  isTTY: Boolean(process.stdout.isTTY),
373
477
  ayPid: process.env.AGENT_YES_PID,
374
- attach
478
+ attach,
479
+ detach: config.detach
375
480
  })) {
376
481
  const forked = spawn(rustBinary, rustArgs, {
377
482
  detached: true,
@@ -434,7 +539,7 @@ if (config.showVersion) {
434
539
  process.exit(0);
435
540
  }
436
541
  if (config.appendPrompt) {
437
- const { PidStore } = await import("./pidStore-BRlKRHXY.js");
542
+ const { PidStore } = await import("./pidStore-COkPjpW8.js");
438
543
  const ipcPath = await PidStore.findActiveFifo(process.cwd());
439
544
  if (!ipcPath) {
440
545
  console.error("No active agent with IPC found in current directory.");
@@ -42,4 +42,4 @@ async function cmdDsh(rest, spawn = defaultSpawn) {
42
42
 
43
43
  //#endregion
44
44
  export { cmdDsh };
45
- //# sourceMappingURL=cmdDsh-2LP0grim.js.map
45
+ //# sourceMappingURL=cmdDsh-DZ8bLsH7.js.map