agent-yes 1.303.1 → 1.304.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 (184) hide show
  1. package/README.md +54 -0
  2. package/default.config.yaml +5 -5
  3. package/dist/{JsonlStore-BpYZZTap.js → JsonlStore-CB_0sfdT.js} +5 -4
  4. package/dist/{SUPPORTED_CLIS-Dq9Lq9WJ.js → SUPPORTED_CLIS-C_1IiOj3.js} +2 -2
  5. package/dist/SUPPORTED_CLIS-Do3GHAY1.js +12 -0
  6. package/dist/{agentShare-suB6yPgO.js → agentShare-BvpEm-Fr.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-BiSUhjw7.js} +6 -6
  10. package/dist/callback-SqLD2mMX.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-DBt23Qz0.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-DkUB7GV2.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-DDO592Wh.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-BrJ2p8wy.js} +2 -2
  87. package/dist/{rustBinary-BV4LxMMn.js → rustBinary-vpfpWj1q.js} +2 -2
  88. package/dist/{schedule-Dp0qkNO1.js → schedule-Bzjhl6-h.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-XwFYE0cE.js} +67 -69
  93. package/dist/{serveRust-CbBrcUrg.js → serveRust-BfWkeL6T.js} +31 -4
  94. package/dist/{setup-DdIBk6Iv.js → setup-D4-s2VZw.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-DUBsVI3e.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-DxgvDmZX.js → subcommands-B7YZJL8n.js} +471 -307
  101. package/dist/subcommands-BZPxFgkT.js +15 -0
  102. package/dist/{systemPathLink-SjUzgSiq.js → systemPathLink-Y3iC7bYV.js} +1 -1
  103. package/dist/{terminal-C2h7tpe0.js → terminal-13cGj3h6.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-5_OlvQcz.js} +2 -2
  111. package/dist/trayApp-DkAPo0m6.js +5 -0
  112. package/dist/{ts-6LF7f4fx.js → ts-njuddXQz.js} +126 -57
  113. package/dist/{versionChecker-Bc62HNf6.js → versionChecker-BJycAanp.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-DmRwOlco.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-DIbwNz8Z.js → ws-ByO6JO6m.js} +3 -3
  121. package/dist/{ws-BRhPG1Vy.js → ws-D0-Jg88z.js} +9 -8
  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 +91 -0
  133. package/ts/composerGuard.spec.ts +53 -6
  134. package/ts/composerGuard.ts +42 -13
  135. package/ts/conptyModeFilter.spec.ts +30 -0
  136. package/ts/conptyModeFilter.ts +53 -0
  137. package/ts/copyLiagent.ts +42 -0
  138. package/ts/cwdConflictWarn.io.spec.ts +50 -0
  139. package/ts/cwdConflictWarn.spec.ts +34 -1
  140. package/ts/cwdConflictWarn.ts +43 -5
  141. package/ts/cwdGuard.spec.ts +110 -0
  142. package/ts/cwdGuard.ts +118 -0
  143. package/ts/forceKill.ts +52 -0
  144. package/ts/forkNested.bun.spec.ts +41 -0
  145. package/ts/forkNested.spec.ts +41 -0
  146. package/ts/forkNested.ts +48 -1
  147. package/ts/globalPidIndex.edges.spec.ts +125 -0
  148. package/ts/globalPidIndex.ts +6 -2
  149. package/ts/index.ts +13 -1
  150. package/ts/interruptSend.bun.spec.ts +99 -0
  151. package/ts/interruptSend.spec.ts +99 -0
  152. package/ts/interruptSend.ts +51 -0
  153. package/ts/lockRegistry.spec.ts +49 -0
  154. package/ts/lsRenderCache.spec.ts +58 -0
  155. package/ts/needsInput.edges.spec.ts +23 -0
  156. package/ts/parseCliArgs.ts +7 -0
  157. package/ts/pushGatePlan.spec.ts +147 -0
  158. package/ts/roomReplyAlias.io.spec.ts +81 -0
  159. package/ts/schedule.ts +5 -1
  160. package/ts/schedules.bun.spec.ts +397 -0
  161. package/ts/schedules.spec.ts +397 -0
  162. package/ts/schedules.ts +517 -0
  163. package/ts/schedulesCli.ts +386 -0
  164. package/ts/sendControl.bun.spec.ts +12 -0
  165. package/ts/senderAncestry.ts +1 -3
  166. package/ts/serve.ts +22 -33
  167. package/ts/serveRust.spec.ts +29 -2
  168. package/ts/serveRust.ts +27 -2
  169. package/ts/sizeNego.bun.spec.ts +9 -2
  170. package/ts/sizeNego.spec.ts +9 -2
  171. package/ts/sizeNego.ts +10 -5
  172. package/ts/subcommands.spec.ts +348 -9
  173. package/ts/subcommands.ts +513 -93
  174. package/ts/suggestAgents.spec.ts +33 -0
  175. package/ts/terminal/browser.ts +1 -1
  176. package/ts/todoParse.spec.ts +22 -1
  177. package/ts/todoParse.ts +19 -0
  178. package/dist/SUPPORTED_CLIS-ByO5twge.js +0 -12
  179. package/dist/callback-D7qfh_7p.js +0 -16
  180. package/dist/pidStore-BRlKRHXY.js +0 -6
  181. package/dist/roomReplyAlias-DuEkSSDI.js +0 -6
  182. package/dist/spawnGate-DeQBTX-o.js +0 -5
  183. package/dist/subcommands-DmiswRy4.js +0 -14
  184. package/dist/trayApp-C4TAvRvU.js +0 -5
@@ -1,5 +1,5 @@
1
- import { V as listRecords } from "./subcommands-DxgvDmZX.js";
2
- import { a as getProvisionRoot } from "./workspaceConfig-BLWB5Wu9.js";
1
+ import { G as listRecords } from "./subcommands-B7YZJL8n.js";
2
+ import { a as getProvisionRoot } from "./workspaceConfig-DBgsu81B.js";
3
3
  import { existsSync } from "fs";
4
4
  import { lstat, opendir } from "fs/promises";
5
5
  import path from "path";
@@ -424,4 +424,4 @@ async function cmdWs(args) {
424
424
 
425
425
  //#endregion
426
426
  export { isPathInside as a, walkWorkspaces as c, importProvisionModule as i, workspaceStatus as l, cmdWs as n, loadProvision as o, collectWorkspaces as r, resolveOperand as s, WS_JSON_SCHEMA as t };
427
- //# sourceMappingURL=ws-DIbwNz8Z.js.map
427
+ //# sourceMappingURL=ws-ByO6JO6m.js.map
@@ -1,15 +1,16 @@
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 "./subcommands-DxgvDmZX.js";
8
+ import "./subcommands-B7YZJL8n.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 { a as isPathInside, c as walkWorkspaces, i as importProvisionModule, l as workspaceStatus, n as cmdWs, o as loadProvision, r as collectWorkspaces, s as resolveOperand, t as WS_JSON_SCHEMA } from "./ws-DIbwNz8Z.js";
13
+ import "./senderAncestry-CVHeKk1Y.js";
14
+ import { a as isPathInside, c as walkWorkspaces, i as importProvisionModule, l as workspaceStatus, n as cmdWs, o as loadProvision, r as collectWorkspaces, s as resolveOperand, t as WS_JSON_SCHEMA } from "./ws-ByO6JO6m.js";
14
15
 
15
16
  export { WS_JSON_SCHEMA, cmdWs, collectWorkspaces, isPathInside, loadProvision, walkWorkspaces, workspaceStatus };
package/lab/ui/index.html CHANGED
@@ -5973,7 +5973,7 @@ my.translate = async (text, lang) => {
5973
5973
  function pruneStale(list) {
5974
5974
  if (showStale) return list;
5975
5975
  const keep = new Set(list.filter((e) => !isStaleStopped(e) || e._key === sel));
5976
- for (let grew = true; grew; ) {
5976
+ for (let grew = true; grew;) {
5977
5977
  grew = false;
5978
5978
  const wanted = new Set();
5979
5979
  for (const e of keep)
@@ -166,7 +166,7 @@ The affordances that only make sense when the operator is a machine:
166
166
  renderer hides entire conversations. Marking them means a reader is never misled into thinking it
167
167
  has read everything.
168
168
  - **stdout is data, stderr is commentary** in the streaming path, so `slack tail "#general" | grep
169
- deploy` sees messages and not chrome.
169
+ deploy` sees messages and not chrome.
170
170
  - **Output is valid input** — a printed permalink or ISO stamp can be pasted straight back as a
171
171
  target, with strict parsers that throw rather than guess.
172
172
  - **`SKILL.md` ships in the npm tarball** with agent-skill frontmatter, so it triggers on how a user
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-yes",
3
- "version": "1.303.1",
3
+ "version": "1.304.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",
@@ -44,6 +44,7 @@
44
44
  "dsh-yes": "./dist/dsh-yes.js",
45
45
  "glm-yes": "./dist/glm-yes.js",
46
46
  "grok-yes": "./dist/grok-yes.js",
47
+ "liagent": "./dist/liagent/cli.js",
47
48
  "opencode-yes": "./dist/opencode-yes.js",
48
49
  "pi-yes": "./dist/pi-yes.js",
49
50
  "powershell-yes": "./dist/powershell-yes.js",
@@ -75,7 +76,8 @@
75
76
  "lab/ui/sw.js",
76
77
  "ts/channels/*.ts",
77
78
  "ts/terminal/*.ts",
78
- "lab/ui/lab/**"
79
+ "lab/ui/lab/**",
80
+ "dist/liagent/*.d.ts"
79
81
  ],
80
82
  "type": "module",
81
83
  "module": "ts/index.ts",
@@ -100,14 +102,74 @@
100
102
  "./widgets": {
101
103
  "types": "./ts/widgets.ts",
102
104
  "import": "./dist/widgets.js"
103
- }
105
+ },
106
+ "./liagent": {
107
+ "types": "./dist/liagent/index.d.ts",
108
+ "browser": "./dist/liagent/index.js",
109
+ "import": "./dist/liagent/index.js",
110
+ "default": "./dist/liagent/index.js"
111
+ },
112
+ "./liagent/box": {
113
+ "types": "./dist/liagent/box.d.ts",
114
+ "browser": "./dist/liagent/box.js",
115
+ "import": "./dist/liagent/box.js",
116
+ "default": "./dist/liagent/box.js"
117
+ },
118
+ "./liagent/ui": {
119
+ "types": "./dist/liagent/ui.d.ts",
120
+ "browser": "./dist/liagent/ui.js",
121
+ "import": "./dist/liagent/ui.js",
122
+ "default": "./dist/liagent/ui.js"
123
+ },
124
+ "./liagent/tree": {
125
+ "types": "./dist/liagent/tree.d.ts",
126
+ "browser": "./dist/liagent/tree.js",
127
+ "import": "./dist/liagent/tree.js",
128
+ "default": "./dist/liagent/tree.js"
129
+ },
130
+ "./liagent/mic": {
131
+ "types": "./dist/liagent/mic.d.ts",
132
+ "browser": "./dist/liagent/mic.js",
133
+ "import": "./dist/liagent/mic.js",
134
+ "default": "./dist/liagent/mic.js"
135
+ },
136
+ "./liagent/voice": {
137
+ "types": "./dist/liagent/voice.d.ts",
138
+ "browser": "./dist/liagent/voice.js",
139
+ "import": "./dist/liagent/voice.js",
140
+ "default": "./dist/liagent/voice.js"
141
+ },
142
+ "./liagent/client": {
143
+ "types": "./dist/liagent/client.d.ts",
144
+ "browser": "./dist/liagent/client.js",
145
+ "import": "./dist/liagent/client.js",
146
+ "default": "./dist/liagent/client.js"
147
+ },
148
+ "./liagent/protocol": {
149
+ "types": "./dist/liagent/protocol.d.ts",
150
+ "browser": "./dist/liagent/protocol.js",
151
+ "import": "./dist/liagent/protocol.js",
152
+ "default": "./dist/liagent/protocol.js"
153
+ },
154
+ "./liagent/progress": {
155
+ "types": "./dist/liagent/progress.d.ts",
156
+ "browser": "./dist/liagent/progress.js",
157
+ "import": "./dist/liagent/progress.js",
158
+ "default": "./dist/liagent/progress.js"
159
+ },
160
+ "./liagent/hub": {
161
+ "types": "./dist/liagent/hub.d.ts",
162
+ "import": "./dist/liagent/hub.js",
163
+ "default": "./dist/liagent/hub.js"
164
+ },
165
+ "./liagent/liagent.js": "./dist/liagent/liagent.js"
104
166
  },
105
167
  "publishConfig": {
106
168
  "access": "public",
107
169
  "registry": "https://registry.npmjs.org/"
108
170
  },
109
171
  "scripts": {
110
- "build": "tsdown",
172
+ "build": "tsdown && bun ./ts/copyLiagent.ts",
111
173
  "check:e2e": "bun scripts/check-e2e.ts",
112
174
  "cf": "bun scripts/cf.ts",
113
175
  "build:rgui": "bun scripts/build-rgui.ts",
@@ -118,7 +180,8 @@
118
180
  "postbuild": "bun ./ts/postbuild.ts",
119
181
  "demo": "bun run build && bun link && claude-yes -- demo",
120
182
  "dev": "bun ts/index.ts",
121
- "typecheck": "tsgo --noEmit",
183
+ "typecheck": "tsrs --noEmit",
184
+ "typecheck:tsgo": "tsgo --noEmit",
122
185
  "fmt": "oxlint --fix --fix-suggestions && oxfmt",
123
186
  "verify-deps": "node ./scripts/verify-deps.js",
124
187
  "_prepack": "bun run build",
@@ -160,23 +223,25 @@
160
223
  "@types/proper-lockfile": "^4.1.4",
161
224
  "@types/ws": "^8.18.1",
162
225
  "@types/yargs": "^17.0.35",
163
- "@typescript/native-preview": "^7.0.0-dev.20260124.1",
226
+ "@typescript/native-preview": "^7.0.0-dev.20260707.2",
164
227
  "@vitest/coverage-v8": "4.1.0",
165
228
  "@xterm/addon-fit": "^0.11.0",
166
229
  "@xterm/xterm": "^6.0.0",
167
230
  "codehost": "^0.39.0",
168
231
  "html2canvas-pro": "^2.3.1",
169
232
  "husky": "^9.1.7",
233
+ "liagent": "github:snolab/liagent#v0.1.2",
170
234
  "lint-staged": "^16.2.7",
171
235
  "node-pty": "^1.1.0",
172
- "oxfmt": "^0.26.0",
173
- "oxlint": "^1.41.0",
236
+ "oxfmt": "^0.75.0",
237
+ "oxlint": "^1.90.0",
174
238
  "patch-package": "^8.0.1",
175
239
  "playwright": "^1.58.2",
176
240
  "rambda": "^11.0.1",
177
241
  "semantic-release": "^25.0.2",
178
242
  "standard-version": "^9.5.0",
179
243
  "tsdown": "^0.20.3",
244
+ "tsrs": "0.20.1-ts7.1.0-beta",
180
245
  "vitest": "4.1.0",
181
246
  "ws": "^8.20.0",
182
247
  "zod": "^3.23.0"
package/ts/JsonlStore.ts CHANGED
@@ -190,11 +190,18 @@ export class JsonlStore<T extends Record<string, any> = Record<string, any>> {
190
190
  }
191
191
 
192
192
  private async withLock<R>(fn: () => Promise<R>): Promise<R> {
193
- const dir = path.dirname(this.filePath);
194
193
  let release: (() => Promise<void>) | undefined;
195
194
  try {
196
- release = await lock(dir, {
197
- lockfilePath: this.filePath + ".lock",
195
+ // proper-lockfile keys its in-process registry by the FIRST argument, so
196
+ // that must be unique to this lock: locking the shared directory made two
197
+ // stores in one directory overwrite each other's entry and crash an
198
+ // orphaned refresh timer (#516), and the bare file path is already taken
199
+ // by todoStore's write lock. Key it by the lockfile's own path.
200
+ // realpath:false because that path never exists up front.
201
+ const lockfilePath = this.filePath + ".lock";
202
+ release = await lock(lockfilePath, {
203
+ realpath: false,
204
+ lockfilePath,
198
205
  retries: { retries: 5, minTimeout: 50, maxTimeout: 500 },
199
206
  });
200
207
  return await fn();
@@ -1,7 +1,7 @@
1
1
  import { exec } from "child_process";
2
2
  import { fromStdio } from "from-node-stream";
3
3
  import sflow from "sflow";
4
- import { describe, it } from "bun:test";
4
+ import { describe, expect, it } from "bun:test";
5
5
  import { sleepms } from "./utils";
6
6
 
7
7
  describe("CLI idle tests", () => {
@@ -1,7 +1,7 @@
1
1
  import { exec } from "child_process";
2
2
  import { fromStdio } from "from-node-stream";
3
3
  import sflow from "sflow";
4
- import { describe, it } from "vitest";
4
+ import { describe, expect, it } from "vitest";
5
5
  import { sleepms } from "./utils";
6
6
 
7
7
  describe("CLI idle tests", () => {
package/ts/cli.ts CHANGED
@@ -1,4 +1,9 @@
1
1
  #!/usr/bin/env bun
2
+ // MUST stay the first import: a deleted-and-recreated cwd makes process.cwd()
3
+ // throw, and an ES module's imports are evaluated before this file's body, so
4
+ // anything below that touches the cwd (the eager config load, execa, bun-pty)
5
+ // would crash with a raw stack trace first. See ts/cwdGuard.ts.
6
+ import "./cwdGuard.ts";
2
7
  import { argv } from "process";
3
8
  import { spawn } from "child_process";
4
9
  import { parseCliArgs } from "./parseCliArgs.ts";
@@ -87,6 +92,28 @@ logger.info(versionString());
87
92
  // Parse CLI arguments (no choices validation — SUPPORTED_CLIS loaded lazily below)
88
93
  const config = parseCliArgs(process.argv);
89
94
 
95
+ // --detach is implemented by the Rust-runtime fork below (same path as a nested
96
+ // agent's fork-by-default). Refuse the contradictions up front rather than
97
+ // silently running in the foreground.
98
+ {
99
+ const { stripDetachFlag } = await import("./forkNested.ts");
100
+ const res = stripDetachFlag(process.argv.slice(2), Boolean(config.detach));
101
+ if (!res.ok) {
102
+ console.error(res.error);
103
+ process.exit(1);
104
+ }
105
+ // The Rust runner is handed process.argv below; drop the flag it doesn't know.
106
+ process.argv.splice(2, process.argv.length - 2, ...res.args);
107
+ }
108
+ if (config.detach && (config.attach || process.env.AGENT_YES_ATTACH === "1")) {
109
+ console.error("--detach and --attach (or AGENT_YES_ATTACH=1) contradict each other.");
110
+ process.exit(1);
111
+ }
112
+ if (config.detach && !config.useRust) {
113
+ console.error("--detach needs the Rust runtime (drop --no-rust / AGENT_YES_NO_RUST).");
114
+ process.exit(1);
115
+ }
116
+
90
117
  // Handle --tray: show system tray icon and block
91
118
  if (config.tray) {
92
119
  const { startTray } = await import("./tray.ts");
@@ -145,6 +172,13 @@ if (config.useRust) {
145
172
  }
146
173
  }
147
174
 
175
+ if (!rustBinary && config.detach) {
176
+ console.error(
177
+ "--detach needs the Rust runtime, and its binary is unavailable (try --verbose).",
178
+ );
179
+ process.exit(1);
180
+ }
181
+
148
182
  if (rustBinary) {
149
183
  const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS.ts");
150
184
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
@@ -170,6 +204,7 @@ if (config.useRust) {
170
204
  isTTY: Boolean(process.stdout.isTTY),
171
205
  ayPid: process.env.AGENT_YES_PID,
172
206
  attach,
207
+ detach: config.detach,
173
208
  })
174
209
  ) {
175
210
  const forked = spawn(rustBinary, rustArgs, {
@@ -0,0 +1,155 @@
1
+ import { spawn } from "child_process";
2
+ import { mkdtemp, rm } from "fs/promises";
3
+ import { tmpdir } from "os";
4
+ import path from "path";
5
+ import { afterEach, beforeEach, describe, expect, it, vi } from "bun:test";
6
+ import { cmdKill, killRefusal, reusedWrapperPid } from "./cmdKill.ts";
7
+ import { appendGlobalPid, readGlobalPids } from "./globalPidIndex.ts";
8
+ import { register } from "./reaper.ts";
9
+
10
+ describe("killRefusal", () => {
11
+ const chain = [3000, 2000];
12
+ it("allows an unrelated agent", () => {
13
+ expect(killRefusal({ pid: 1112, wrapper_pid: 1111 }, { pgid: 1112 }, chain, 2000)).toBe(null);
14
+ });
15
+ it("refuses when the agent or its wrapper is the caller or an ancestor", () => {
16
+ expect(killRefusal({ pid: 3000 }, { pgid: null }, chain, 2000)).toMatch(/ancestors/);
17
+ expect(killRefusal({ pid: 1112, wrapper_pid: 2000 }, { pgid: null }, chain, 2000)).toMatch(
18
+ /wrapper pid 2000/,
19
+ );
20
+ });
21
+ it("refuses when the recorded group is the caller's own group", () => {
22
+ expect(killRefusal({ pid: 1112 }, { pgid: 2000 }, chain, 2000)).toMatch(/own group/);
23
+ });
24
+ });
25
+
26
+ describe("reusedWrapperPid", () => {
27
+ const NOW = 1_000_000_000_000;
28
+ const record = { pid: 1112, wrapper_pid: 1111, started_at: NOW - 3_600_000 }; // 1 h ago
29
+ it("flags a wrapper pid now held by a process younger than the registration", () => {
30
+ const t = new Map([
31
+ [1112, { ageSecs: 3_700 }],
32
+ [1111, { ageSecs: 5 }],
33
+ ]);
34
+ expect(reusedWrapperPid(record, t, NOW)).toBe(1111);
35
+ });
36
+ it("keeps a wrapper that predates the registration, or that is unknown", () => {
37
+ expect(reusedWrapperPid(record, new Map([[1111, { ageSecs: 3_700 }]]), NOW)).toBe(null);
38
+ expect(reusedWrapperPid(record, new Map(), NOW)).toBe(null);
39
+ expect(reusedWrapperPid({ ...record, wrapper_pid: 1112 }, new Map(), NOW)).toBe(null);
40
+ });
41
+ });
42
+
43
+ describe.skipIf(process.platform === "win32")("ay kill <pid>", () => {
44
+ let home: string;
45
+ let prevHome: string | undefined;
46
+ let out: string;
47
+ let err: string;
48
+ beforeEach(async () => {
49
+ home = await mkdtemp(path.join(tmpdir(), "ay-kill-"));
50
+ prevHome = process.env.AGENT_YES_HOME;
51
+ process.env.AGENT_YES_HOME = home;
52
+ out = "";
53
+ err = "";
54
+ vi.spyOn(process.stdout, "write").mockImplementation((c: any) => ((out += String(c)), true));
55
+ vi.spyOn(process.stderr, "write").mockImplementation((c: any) => ((err += String(c)), true));
56
+ });
57
+ afterEach(async () => {
58
+ vi.restoreAllMocks();
59
+ if (prevHome === undefined) delete process.env.AGENT_YES_HOME;
60
+ else process.env.AGENT_YES_HOME = prevHome;
61
+ await rm(home, { recursive: true, force: true });
62
+ });
63
+
64
+ const row = (pid: number) => ({
65
+ pid,
66
+ cli: "claude",
67
+ prompt: null,
68
+ cwd: "/repo/alpha",
69
+ log_file: null,
70
+ status: "active" as const,
71
+ exit_code: null,
72
+ exit_reason: null,
73
+ started_at: Date.now() - 5_000,
74
+ wrapper_pid: pid,
75
+ });
76
+ const fakeAgent = async () => {
77
+ // detached → its own process group, like a real agent's pty session.
78
+ const child = spawn("sh", ["-c", "sleep 300 & wait"], { detached: true, stdio: "ignore" });
79
+ child.unref();
80
+ await new Promise((r) => setTimeout(r, 300)); // let the grandchild start
81
+ await appendGlobalPid(row(child.pid!));
82
+ await register(child.pid!, child.pid!);
83
+ return child.pid!;
84
+ };
85
+ const groupAlive = (g: number) => {
86
+ try {
87
+ process.kill(-g, 0);
88
+ return true;
89
+ } catch {
90
+ return false;
91
+ }
92
+ };
93
+
94
+ it("SIGKILLs the agent's whole process group and marks the row exited", async () => {
95
+ const pid = await fakeAgent();
96
+ expect(await cmdKill([String(pid)])).toBe(0);
97
+ await new Promise((r) => setTimeout(r, 200));
98
+ expect(groupAlive(pid)).toBe(false); // the grandchild sleep is gone too
99
+ expect(out).toMatch(new RegExp(`killed pid ${pid} .*group ${pid}`));
100
+ expect((await readGlobalPids()).find((r) => r.pid === pid)?.status).toBe("exited");
101
+ });
102
+
103
+ it("--dry-run signals nothing", async () => {
104
+ const pid = await fakeAgent();
105
+ try {
106
+ expect(await cmdKill([String(pid), "--dry-run"])).toBe(0);
107
+ expect(out).toMatch(new RegExp(`would SIGKILL group ${pid}`));
108
+ expect(groupAlive(pid)).toBe(true);
109
+ } finally {
110
+ process.kill(-pid, "SIGKILL");
111
+ }
112
+ });
113
+
114
+ it("accepts only one exact pid: no keywords, ids, remotes or number coercion", async () => {
115
+ for (const args of [[], ["alpha"], ["abcdef012345"], ["12e3"], ["box:1111"], ["1", "2"]]) {
116
+ err = "";
117
+ expect(await cmdKill(args)).toBe(1);
118
+ expect(err).toMatch(/expected exactly one pid/);
119
+ }
120
+ });
121
+
122
+ it("refuses a row already marked exited (its pid may have been reused)", async () => {
123
+ await appendGlobalPid({ ...row(4242), status: "exited" });
124
+ expect(await cmdKill(["4242"])).toBe(1);
125
+ expect(err).toMatch(/registered as exited/);
126
+ });
127
+
128
+ it("a signal that fails (EPERM) is reported, and the row is not marked exited", async () => {
129
+ const pid = await fakeAgent();
130
+ const real = process.kill.bind(process);
131
+ const spy = vi.spyOn(process, "kill").mockImplementation(((p: number, sig?: any) => {
132
+ if (sig === "SIGKILL") throw Object.assign(new Error("EPERM"), { code: "EPERM" });
133
+ return real(p, sig);
134
+ }) as typeof process.kill);
135
+ try {
136
+ expect(await cmdKill([String(pid)])).toBe(1);
137
+ expect(err).toMatch(/could not signal group \d+ \(EPERM\)/);
138
+ expect((await readGlobalPids()).find((r) => r.pid === pid)?.status).toBe("active");
139
+ } finally {
140
+ spy.mockRestore();
141
+ process.kill(-pid, "SIGKILL");
142
+ }
143
+ });
144
+
145
+ it("refuses an unregistered pid", async () => {
146
+ expect(await cmdKill(["99999999"])).toBe(1);
147
+ expect(err).toMatch(/no registered agent has pid 99999999/);
148
+ });
149
+
150
+ it("refuses to kill the calling process itself", async () => {
151
+ await appendGlobalPid(row(process.pid));
152
+ expect(await cmdKill([String(process.pid)])).toBe(1);
153
+ expect(err).toMatch(/this shell or one of its ancestors/);
154
+ });
155
+ });
@@ -0,0 +1,155 @@
1
+ import { spawn } from "child_process";
2
+ import { mkdtemp, rm } from "fs/promises";
3
+ import { tmpdir } from "os";
4
+ import path from "path";
5
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
6
+ import { cmdKill, killRefusal, reusedWrapperPid } from "./cmdKill.ts";
7
+ import { appendGlobalPid, readGlobalPids } from "./globalPidIndex.ts";
8
+ import { register } from "./reaper.ts";
9
+
10
+ describe("killRefusal", () => {
11
+ const chain = [3000, 2000];
12
+ it("allows an unrelated agent", () => {
13
+ expect(killRefusal({ pid: 1112, wrapper_pid: 1111 }, { pgid: 1112 }, chain, 2000)).toBe(null);
14
+ });
15
+ it("refuses when the agent or its wrapper is the caller or an ancestor", () => {
16
+ expect(killRefusal({ pid: 3000 }, { pgid: null }, chain, 2000)).toMatch(/ancestors/);
17
+ expect(killRefusal({ pid: 1112, wrapper_pid: 2000 }, { pgid: null }, chain, 2000)).toMatch(
18
+ /wrapper pid 2000/,
19
+ );
20
+ });
21
+ it("refuses when the recorded group is the caller's own group", () => {
22
+ expect(killRefusal({ pid: 1112 }, { pgid: 2000 }, chain, 2000)).toMatch(/own group/);
23
+ });
24
+ });
25
+
26
+ describe("reusedWrapperPid", () => {
27
+ const NOW = 1_000_000_000_000;
28
+ const record = { pid: 1112, wrapper_pid: 1111, started_at: NOW - 3_600_000 }; // 1 h ago
29
+ it("flags a wrapper pid now held by a process younger than the registration", () => {
30
+ const t = new Map([
31
+ [1112, { ageSecs: 3_700 }],
32
+ [1111, { ageSecs: 5 }],
33
+ ]);
34
+ expect(reusedWrapperPid(record, t, NOW)).toBe(1111);
35
+ });
36
+ it("keeps a wrapper that predates the registration, or that is unknown", () => {
37
+ expect(reusedWrapperPid(record, new Map([[1111, { ageSecs: 3_700 }]]), NOW)).toBe(null);
38
+ expect(reusedWrapperPid(record, new Map(), NOW)).toBe(null);
39
+ expect(reusedWrapperPid({ ...record, wrapper_pid: 1112 }, new Map(), NOW)).toBe(null);
40
+ });
41
+ });
42
+
43
+ describe.skipIf(process.platform === "win32")("ay kill <pid>", () => {
44
+ let home: string;
45
+ let prevHome: string | undefined;
46
+ let out: string;
47
+ let err: string;
48
+ beforeEach(async () => {
49
+ home = await mkdtemp(path.join(tmpdir(), "ay-kill-"));
50
+ prevHome = process.env.AGENT_YES_HOME;
51
+ process.env.AGENT_YES_HOME = home;
52
+ out = "";
53
+ err = "";
54
+ vi.spyOn(process.stdout, "write").mockImplementation((c: any) => ((out += String(c)), true));
55
+ vi.spyOn(process.stderr, "write").mockImplementation((c: any) => ((err += String(c)), true));
56
+ });
57
+ afterEach(async () => {
58
+ vi.restoreAllMocks();
59
+ if (prevHome === undefined) delete process.env.AGENT_YES_HOME;
60
+ else process.env.AGENT_YES_HOME = prevHome;
61
+ await rm(home, { recursive: true, force: true });
62
+ });
63
+
64
+ const row = (pid: number) => ({
65
+ pid,
66
+ cli: "claude",
67
+ prompt: null,
68
+ cwd: "/repo/alpha",
69
+ log_file: null,
70
+ status: "active" as const,
71
+ exit_code: null,
72
+ exit_reason: null,
73
+ started_at: Date.now() - 5_000,
74
+ wrapper_pid: pid,
75
+ });
76
+ const fakeAgent = async () => {
77
+ // detached → its own process group, like a real agent's pty session.
78
+ const child = spawn("sh", ["-c", "sleep 300 & wait"], { detached: true, stdio: "ignore" });
79
+ child.unref();
80
+ await new Promise((r) => setTimeout(r, 300)); // let the grandchild start
81
+ await appendGlobalPid(row(child.pid!));
82
+ await register(child.pid!, child.pid!);
83
+ return child.pid!;
84
+ };
85
+ const groupAlive = (g: number) => {
86
+ try {
87
+ process.kill(-g, 0);
88
+ return true;
89
+ } catch {
90
+ return false;
91
+ }
92
+ };
93
+
94
+ it("SIGKILLs the agent's whole process group and marks the row exited", async () => {
95
+ const pid = await fakeAgent();
96
+ expect(await cmdKill([String(pid)])).toBe(0);
97
+ await new Promise((r) => setTimeout(r, 200));
98
+ expect(groupAlive(pid)).toBe(false); // the grandchild sleep is gone too
99
+ expect(out).toMatch(new RegExp(`killed pid ${pid} .*group ${pid}`));
100
+ expect((await readGlobalPids()).find((r) => r.pid === pid)?.status).toBe("exited");
101
+ });
102
+
103
+ it("--dry-run signals nothing", async () => {
104
+ const pid = await fakeAgent();
105
+ try {
106
+ expect(await cmdKill([String(pid), "--dry-run"])).toBe(0);
107
+ expect(out).toMatch(new RegExp(`would SIGKILL group ${pid}`));
108
+ expect(groupAlive(pid)).toBe(true);
109
+ } finally {
110
+ process.kill(-pid, "SIGKILL");
111
+ }
112
+ });
113
+
114
+ it("accepts only one exact pid: no keywords, ids, remotes or number coercion", async () => {
115
+ for (const args of [[], ["alpha"], ["abcdef012345"], ["12e3"], ["box:1111"], ["1", "2"]]) {
116
+ err = "";
117
+ expect(await cmdKill(args)).toBe(1);
118
+ expect(err).toMatch(/expected exactly one pid/);
119
+ }
120
+ });
121
+
122
+ it("refuses a row already marked exited (its pid may have been reused)", async () => {
123
+ await appendGlobalPid({ ...row(4242), status: "exited" });
124
+ expect(await cmdKill(["4242"])).toBe(1);
125
+ expect(err).toMatch(/registered as exited/);
126
+ });
127
+
128
+ it("a signal that fails (EPERM) is reported, and the row is not marked exited", async () => {
129
+ const pid = await fakeAgent();
130
+ const real = process.kill.bind(process);
131
+ const spy = vi.spyOn(process, "kill").mockImplementation(((p: number, sig?: any) => {
132
+ if (sig === "SIGKILL") throw Object.assign(new Error("EPERM"), { code: "EPERM" });
133
+ return real(p, sig);
134
+ }) as typeof process.kill);
135
+ try {
136
+ expect(await cmdKill([String(pid)])).toBe(1);
137
+ expect(err).toMatch(/could not signal group \d+ \(EPERM\)/);
138
+ expect((await readGlobalPids()).find((r) => r.pid === pid)?.status).toBe("active");
139
+ } finally {
140
+ spy.mockRestore();
141
+ process.kill(-pid, "SIGKILL");
142
+ }
143
+ });
144
+
145
+ it("refuses an unregistered pid", async () => {
146
+ expect(await cmdKill(["99999999"])).toBe(1);
147
+ expect(err).toMatch(/no registered agent has pid 99999999/);
148
+ });
149
+
150
+ it("refuses to kill the calling process itself", async () => {
151
+ await appendGlobalPid(row(process.pid));
152
+ expect(await cmdKill([String(process.pid)])).toBe(1);
153
+ expect(err).toMatch(/this shell or one of its ancestors/);
154
+ });
155
+ });