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
@@ -0,0 +1,173 @@
1
+ import { execFile } from "child_process";
2
+ import { promisify } from "util";
3
+
4
+ //#region ts/senderAncestry.ts
5
+ /**
6
+ * Who is calling `ay send`, established by OBSERVING the caller rather than by
7
+ * asking it.
8
+ *
9
+ * `resolveSender()` reads `AGENT_YES_PID`, which the `ay` wrapper injects. That
10
+ * covers a lane launched through the wrapper and nothing else. A session that
11
+ * shells out to `ay send` WITHOUT that env — an SDK / `claude -p` pass, a
12
+ * cron-driven script, anything re-exec'd through a shell that scrubbed the
13
+ * environment — was recorded with `from: null`, i.e. indistinguishable from an
14
+ * anonymous stranger.
15
+ *
16
+ * That is not a cosmetic mislabel. Receiving lanes refuse messages they cannot
17
+ * attribute, which is correct doctrine; so an honest sender whose env happened
18
+ * to be missing had its traffic dropped as untrustworthy, and two lanes spent
19
+ * hours on an intrusion theory that was false.
20
+ *
21
+ * The env var is a CLAIM the caller passes along. The process tree is a FACT
22
+ * the kernel keeps and the caller cannot forge from inside a message body: a
23
+ * process cannot choose its own ancestors. So when the claim is absent, walk up
24
+ * from our own pid and stop at the first ancestor that is a REGISTERED agent.
25
+ * A lane's `ay send`, however many shells deep, is a descendant of that lane.
26
+ *
27
+ * Two things this deliberately does NOT do:
28
+ *
29
+ * - It never invents a sender. No ancestor registered ⇒ nothing is attributed,
30
+ * and the caller is described by what was measured about it (user, host,
31
+ * cwd, pid) rather than guessed. Filling the field with a plausible name is
32
+ * the failure one level worse than the one this fixes.
33
+ * - It never lets the BODY supply identity. Everything here comes from the
34
+ * kernel and the registry.
35
+ */
36
+ const execFileAsync = promisify(execFile);
37
+ /**
38
+ * Ancestor pids of `pid`, nearest first, via `ps`.
39
+ *
40
+ * `ps` rather than `/proc` so it works on macOS as well as Linux — this repo's
41
+ * other walker is `/proc`-only and the fleet is mostly macOS. ONE invocation
42
+ * for the whole table: a call per hop would multiply the cost of every send by
43
+ * the depth of the tree. Measured at ~40ms for 887 processes.
44
+ *
45
+ * Best-effort by construction. A failure here means "could not establish",
46
+ * which is a legitimate answer — never an error that blocks a send.
47
+ */
48
+ async function ancestorPids(pid, opts = {}) {
49
+ const maxHops = opts.maxHops ?? 32;
50
+ let table;
51
+ try {
52
+ table = await (opts.readTable ?? readProcessTable)();
53
+ } catch {
54
+ return [];
55
+ }
56
+ const out = [];
57
+ const seen = new Set([pid]);
58
+ let cur = pid;
59
+ for (let hops = 0; hops < maxHops; hops++) {
60
+ const parent = table.get(cur)?.ppid;
61
+ if (parent === void 0 || parent <= 1 || seen.has(parent)) break;
62
+ out.push(parent);
63
+ seen.add(parent);
64
+ cur = parent;
65
+ }
66
+ return out;
67
+ }
68
+ /**
69
+ * pid → {ppid, ageSecs} for every visible process, from one `ps`.
70
+ *
71
+ * `etime` (elapsed) rather than `lstart` because it is POSIX and identically
72
+ * available on macOS and Linux, where `etimes` is Linux-only. Windows has no
73
+ * `ps` at all — the caller must not spawn one there; see {@link readProcessTable}.
74
+ */
75
+ async function readProcessTable() {
76
+ if (process.platform === "win32") throw new Error("no process table reader on win32");
77
+ const { stdout } = await execFileAsync("ps", [
78
+ "-A",
79
+ "-o",
80
+ "pid=,ppid=,etime="
81
+ ], {
82
+ timeout: 5e3,
83
+ maxBuffer: 8 * 1024 * 1024
84
+ });
85
+ return parseProcessTable(stdout);
86
+ }
87
+ /**
88
+ * Seconds from a POSIX `etime` field: `[[DD-]hh:]mm:ss`.
89
+ *
90
+ * Returns null for anything that does not match, so a `ps` variant printing an
91
+ * unexpected shape degrades to "cannot check" rather than to a wrong number —
92
+ * a bogus age would defeat the pid-reuse guard it exists to feed.
93
+ */
94
+ function parseEtime(etime) {
95
+ const m = /^(?:(?:(\d+)-)?(\d+):)?(\d+):(\d+)$/.exec(etime.trim());
96
+ if (!m) return null;
97
+ const [, dd, hh, mm, ss] = m;
98
+ return Number(dd ?? 0) * 86400 + Number(hh ?? 0) * 3600 + Number(mm) * 60 + Number(ss);
99
+ }
100
+ /**
101
+ * Parse `ps -A -o pid=,ppid=,etime=` output. Split out from the read so the
102
+ * parsing — the part that can actually be wrong — is testable without a `ps`.
103
+ */
104
+ function parseProcessTable(stdout) {
105
+ const table = /* @__PURE__ */ new Map();
106
+ for (const line of stdout.split("\n")) {
107
+ const m = /^\s*(\d+)\s+(\d+)\s+(\S+)\s*$/.exec(line);
108
+ if (!m) continue;
109
+ const ageSecs = parseEtime(m[3]);
110
+ if (ageSecs === null) continue;
111
+ table.set(Number(m[1]), {
112
+ ppid: Number(m[2]),
113
+ ageSecs
114
+ });
115
+ }
116
+ return table;
117
+ }
118
+ /**
119
+ * Is the process now at `pid` plausibly the one that registered as this agent?
120
+ *
121
+ * pids are reused. When a registered agent exits and the OS hands its number to
122
+ * something else, matching on the number alone attributes the new process to
123
+ * the dead agent — and, worse, to anything that arranges to be its child. The
124
+ * registry records when the agent started, so compare: a process that began
125
+ * AFTER the registration cannot be the thing that was registered.
126
+ *
127
+ * `toleranceSecs` absorbs the ordinary gap between a process starting and its
128
+ * record being written, plus clock granularity. Unknown age ⇒ null ⇒ the caller
129
+ * declines to attribute, because an unverifiable identity is the case this
130
+ * whole change exists to stop papering over.
131
+ */
132
+ function ageMatchesRegistration(ageSecs, startedAt, now = Date.now(), toleranceSecs = 60) {
133
+ if (ageSecs === void 0 || startedAt === void 0) return false;
134
+ return ageSecs >= (now - startedAt) / 1e3 - toleranceSecs;
135
+ }
136
+ /**
137
+ * The first ancestor of `pid` that `isAgent` recognizes, or null.
138
+ *
139
+ * Nearest-first: with nested agents, the closest enclosing lane is the one that
140
+ * actually made this call, so it is the honest attribution.
141
+ */
142
+ async function findAgentAncestor(pid, isAgent, opts) {
143
+ for (const ancestor of await ancestorPids(pid, opts)) {
144
+ const hit = isAgent(ancestor);
145
+ if (hit) return hit;
146
+ }
147
+ return null;
148
+ }
149
+ /**
150
+ * Whether the process holding a pid is still the agent that registered it.
151
+ *
152
+ * Three-way on purpose, and the third value is the point. "Cannot establish"
153
+ * is not "established that it is not ours": win32 has no process table reader
154
+ * here at all, so folding unknown into reused would not guard a destructive
155
+ * action on that platform — it would delete the action from it, permanently,
156
+ * to protect a case that has never occurred. Callers refuse on evidence
157
+ * ("reused") and keep their prior behaviour on "unknown".
158
+ */
159
+ function pidOwnershipVerdict(ageSecs, startedAt, now = Date.now(), toleranceSecs = 60) {
160
+ if (ageSecs === void 0 || startedAt === void 0) return "unknown";
161
+ return ageMatchesRegistration(ageSecs, startedAt, now, toleranceSecs) ? "ours" : "reused";
162
+ }
163
+ async function readAncestryTable(read = readProcessTable) {
164
+ try {
165
+ return await read();
166
+ } catch {
167
+ return null;
168
+ }
169
+ }
170
+
171
+ //#endregion
172
+ export { parseProcessTable as a, parseEtime as i, ancestorPids as n, pidOwnershipVerdict as o, findAgentAncestor as r, readAncestryTable as s, ageMatchesRegistration as t };
173
+ //# sourceMappingURL=senderAncestry-CVHeKk1Y.js.map
@@ -0,0 +1,3 @@
1
+ import { a as parseProcessTable, i as parseEtime, n as ancestorPids, o as pidOwnershipVerdict, r as findAgentAncestor, s as readAncestryTable, t as ageMatchesRegistration } from "./senderAncestry-CVHeKk1Y.js";
2
+
3
+ export { ancestorPids, pidOwnershipVerdict, readAncestryTable };
@@ -1,37 +1,37 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import { i as getInstalledPackage } from "./versionChecker-Bc62HNf6.js";
3
- import { c as findSpawnHiddenLauncher } from "./rustBinary-7VK7oLlW.js";
4
- import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-6LF7f4fx.js";
2
+ import { i as getInstalledPackage } from "./versionChecker-BJycAanp.js";
3
+ import { c as findSpawnHiddenLauncher } from "./rustBinary-BrJ2p8wy.js";
4
+ import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-njuddXQz.js";
5
5
  import { t as agentYesHome$1 } from "./agentYesHome-JmJC28YX.js";
6
- import { u as removeControlCharacters } from "./todoAutomation-TTp_Qz9G.js";
7
- import "./JsonlStore-BpYZZTap.js";
8
- import { s as updateGlobalPidStatus } from "./globalPidIndex-CRB5KtyL.js";
9
- import "./pidStore-433kvh9D.js";
6
+ import { u as removeControlCharacters } from "./todoAutomation-CKlrxuZv.js";
7
+ import "./JsonlStore-CB_0sfdT.js";
8
+ import { s as updateGlobalPidStatus } from "./globalPidIndex-BsjlId-h.js";
9
+ import "./pidStore-C50VPk3E.js";
10
10
  import { r as recordInbox, s as isTerminalReply } from "./messageLog-Dq_ka-Bt.js";
11
- import { t as pgidForWrapper } from "./reaper-C2cuougX.js";
12
- import "./todoStore-C9RTz0Vs.js";
11
+ import "./todoStore-msRCEUi1.js";
13
12
  import "./e2e-BdLf8DvY.js";
14
13
  import "./configShared-De4bR5hH.js";
15
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-Dq9Lq9WJ.js";
16
- import { i as isWebrtcSpec, o as toWebrtcUrl } from "./webrtcLink-va_gAR77.js";
17
- import "./remotes-DevcBeLl.js";
18
- import "./roomReplyAlias-DFqg_6IU.js";
19
- import { $ as renderLogTailLines, C as extractBadges, E as extractTaskCounts, J as readLogForRender, P as isSlashCommand, Q as recentReadEdges, R as isUserTyping, T as extractNeedsInput, V as listRecords, X as readPtysize, Y as readNotes, Z as recentMessageEdges, _t as shouldFramePaste, ct as snapshotStatus, et as renderRawLog, f as cliDefaults, gt as framePaste, h as controlCodeFromName, ht as withIpcLock, mt as writeToIpc, nt as resolveOne, tt as renderRawLogLines, vt as TYPING_BADGE, y as deriveLiveStatus } from "./subcommands-DxgvDmZX.js";
14
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-C_1IiOj3.js";
15
+ import { $ as readNotes, Ct as framePaste, D as extractNeedsInput, G as listRecords, H as isUserTyping, L as isSlashCommand, O as extractTaskCounts, Q as readLogForRender, St as withIpcLock, T as extractBadges, Tt as TYPING_BADGE, at as renderRawLogLines, b as deriveLiveStatus, et as readPtysize, g as controlCodeFromName, it as renderRawLog, nt as recentReadEdges, ot as resolveOne, p as cliDefaults, pt as snapshotStatus, rt as renderLogTailLines, tt as recentMessageEdges, wt as shouldFramePaste, xt as writeToIpc } from "./subcommands-B7YZJL8n.js";
16
+ import { i as isWebrtcSpec, o as toWebrtcUrl } from "./webrtcLink-DcvacEci.js";
17
+ import "./remotes-BsMGvAay.js";
18
+ import "./roomReplyAlias-B-v76TA8.js";
20
19
  import { c as isTransientLockMkdirError } from "./notifyStore-DIfkfKB2.js";
21
- import { i as frameVisitorMessage, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-BesbQ6-Z.js";
22
- import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-Ctj3_Wxp.js";
23
- import { n as sampleTrees } from "./procStats-BvmrBrOs.js";
24
- import { a as getProvisionRoot, d as isProvisionAllowed, f as resolveSpawnCwd, i as getProvisionHook, l as hasProvisionHook, o as getSpawnHook, t as allowsSkipPermissions, u as hasSpawnHook } from "./workspaceConfig-BLWB5Wu9.js";
20
+ import "./senderAncestry-CVHeKk1Y.js";
21
+ import { i as frameVisitorMessage, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-Deve5pv3.js";
22
+ import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-BiSUhjw7.js";
23
+ import { n as sampleTrees } from "./procStats-DwTxj3rs.js";
25
24
  import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-DGMQRTGT.js";
26
- import { i as importProvisionModule } from "./ws-DIbwNz8Z.js";
27
- import { r as spawnRejectionReason } from "./spawnGate-lr3tvA6U.js";
28
- import { i as launchTray } from "./trayApp-QQjqhDv1.js";
25
+ import { a as getProvisionRoot, d as isProvisionAllowed, f as resolveSpawnCwd, i as getProvisionHook, l as hasProvisionHook, o as getSpawnHook, t as allowsSkipPermissions, u as hasSpawnHook } from "./workspaceConfig-DBgsu81B.js";
26
+ import { i as importProvisionModule } from "./ws-ByO6JO6m.js";
27
+ import { r as spawnRejectionReason } from "./spawnGate-Dj_WaS29.js";
28
+ import { i as launchTray } from "./trayApp-5_OlvQcz.js";
29
+ import { existsSync, realpathSync, renameSync, watch, writeFileSync } from "node:fs";
29
30
  import yargs from "yargs";
30
31
  import { appendFile, mkdir, open, readFile, readdir, rename, rm, stat, unlink, writeFile } from "fs/promises";
31
32
  import { arch, cpus, freemem, homedir, hostname, loadavg, platform, totalmem, uptime, userInfo } from "os";
32
33
  import path from "path";
33
34
  import { execFileSync } from "node:child_process";
34
- import { existsSync, realpathSync, renameSync, watch, writeFileSync } from "node:fs";
35
35
  import { fileURLToPath } from "node:url";
36
36
  import { createHash, createHmac, randomBytes, timingSafeEqual } from "crypto";
37
37
 
@@ -421,9 +421,11 @@ const CAP_MIN_COLS = 20;
421
421
  const CAP_MIN_ROWS = 5;
422
422
  const CAP_MAX_COLS = 500;
423
423
  const CAP_MAX_ROWS = 200;
424
- /** Never negotiate below this — TUIs (claude, codex) break down when the grid
425
- * gets absurdly narrow, so a tiny watch-sized viewer can't wedge the agent. */
426
- const NEGO_FLOOR_COLS = 40;
424
+ /** Never negotiate below this. A narrower viewer letterboxes instead: below 80
425
+ * cols TUIs hard-wrap, and the wrapped text is what `ay read` / other agents get
426
+ * from the log, long after that viewer has gone. Lowered to the operator's own
427
+ * terminal width when that is narrower (never grow the PTY past a real tty). */
428
+ const NEGO_FLOOR_COLS = 80;
427
429
  const NEGO_FLOOR_ROWS = 10;
428
430
  /** Parse a presence-reported cap into a sane SizeCap, or null if unusable. */
429
431
  function sanitizeCap(cap) {
@@ -442,7 +444,7 @@ function sanitizeCap(cap) {
442
444
  * Returns null when no viewer reports a capacity — meaning "withdraw the
443
445
  * negotiated size, let the real tty size rule again".
444
446
  */
445
- function negotiateSize(caps) {
447
+ function negotiateSize(caps, local = null) {
446
448
  let cols = Infinity;
447
449
  let rows = Infinity;
448
450
  for (const cap of caps) {
@@ -451,7 +453,7 @@ function negotiateSize(caps) {
451
453
  }
452
454
  if (!Number.isFinite(cols) || !Number.isFinite(rows)) return null;
453
455
  return {
454
- cols: Math.max(NEGO_FLOOR_COLS, cols),
456
+ cols: Math.max(Math.min(NEGO_FLOOR_COLS, local?.cols ?? Infinity), cols),
455
457
  rows: Math.max(NEGO_FLOOR_ROWS, rows)
456
458
  };
457
459
  }
@@ -1344,8 +1346,8 @@ async function warnStrayServeProcesses() {
1344
1346
  process.stderr.write(`warning: ${stray.length} unmanaged ay serve process(es) running (pid ${pids.join(", ")}) — they will fight the daemon for the WebRTC room; stop them: kill ${pids.join(" ")}\n`);
1345
1347
  }
1346
1348
  async function daemonShareRuntime(args) {
1347
- const { daemonShareRuntime: decide } = await import("./serveRust-CbBrcUrg.js");
1348
- const { findAyrsBinary } = await import("./rustBinary-BV4LxMMn.js");
1349
+ const { daemonShareRuntime: decide } = await import("./serveRust-BfWkeL6T.js");
1350
+ const { findAyrsBinary } = await import("./rustBinary-vpfpWj1q.js");
1349
1351
  return decide(args, () => !!findAyrsBinary());
1350
1352
  }
1351
1353
  function explicitWebrtcUrl(args) {
@@ -1483,7 +1485,7 @@ async function cmdServeDaemon(sub, args) {
1483
1485
  let shareLinkMinted = false;
1484
1486
  let roomFile = ".share-room";
1485
1487
  if (webrtcDaemon) try {
1486
- const { loadOrCreateShareRoom, shareLinkFromRoomUrl, shareRoomFileName } = await import("./share-DrS3LYqf.js");
1488
+ const { loadOrCreateShareRoom, shareLinkFromRoomUrl, shareRoomFileName } = await import("./share-_TPYAGWC.js");
1487
1489
  const runtime = await daemonShareRuntime(effArgs);
1488
1490
  roomFile = shareRoomFileName(runtime);
1489
1491
  const explicit = explicitWebrtcUrl(effArgs);
@@ -1494,7 +1496,7 @@ async function cmdServeDaemon(sub, args) {
1494
1496
  if (!webrtcDaemon) return;
1495
1497
  if (shareLink) {
1496
1498
  process.stdout.write(`\nshared over WebRTC — open this link (the token is eaten from the URL on open):\n ${shareLink}\n` + (shareLinkMinted ? ` (persistent room — same link across restarts; delete ~/.agent-yes/${roomFile} to rotate)\n` : ``));
1497
- const { offerOpenInBrowser } = await import("./openBrowser-1cIo4dJL.js");
1499
+ const { offerOpenInBrowser } = await import("./openBrowser-CQAOIrD6.js");
1498
1500
  await offerOpenInBrowser(shareLink);
1499
1501
  } else process.stdout.write(`
1500
1502
  the WebRTC share link carries a secret, so the daemon does NOT log it —
@@ -1643,7 +1645,7 @@ async function cmdServeStatus(args) {
1643
1645
  const token = await loadTokenReadOnly();
1644
1646
  const daemonArgs = mgr ? await readDaemonServeArgs(mgr) : null;
1645
1647
  const installed = daemonArgs !== null;
1646
- const { daemonShareLink, foregroundAyrsShareLink } = await import("./shareCmd-DDENkBW2.js");
1648
+ const { daemonShareLink, foregroundAyrsShareLink } = await import("./shareCmd-DUBsVI3e.js");
1647
1649
  const shareLink = (installed ? await daemonShareLink(daemonArgs) : await foregroundAyrsShareLink()) ?? await readShareLink();
1648
1650
  const running = installed ? await readDaemonRunning(mgr) : false;
1649
1651
  const a = daemonArgs ?? [];
@@ -1774,17 +1776,17 @@ Options:
1774
1776
  return 0;
1775
1777
  }
1776
1778
  {
1777
- const { planRustServe } = await import("./serveRust-CbBrcUrg.js");
1779
+ const { planRustServe, SERVE_SUBCOMMANDS } = await import("./serveRust-BfWkeL6T.js");
1778
1780
  const plan = planRustServe(rest);
1779
1781
  if (plan.kind === "rust-only") {
1780
- const { ensureAyrsBinary } = await import("./rustBinary-BV4LxMMn.js");
1782
+ const { ensureAyrsBinary } = await import("./rustBinary-vpfpWj1q.js");
1781
1783
  const ayrs = await ensureAyrsBinary();
1782
1784
  if (ayrs) return runAyrsServe(ayrs, plan.argv);
1783
1785
  process.stderr.write(`ay serve: ${plan.feature} needs the Rust daemon (ayrs), which was not found (bun run build:rs, or reinstall)\n`);
1784
1786
  return 1;
1785
1787
  }
1786
1788
  if (plan.kind === "rust") {
1787
- const { ensureAyrsBinary } = await import("./rustBinary-BV4LxMMn.js");
1789
+ const { ensureAyrsBinary } = await import("./rustBinary-vpfpWj1q.js");
1788
1790
  const ayrs = await ensureAyrsBinary();
1789
1791
  if (ayrs) return runAyrsServe(ayrs, plan.argv);
1790
1792
  process.stderr.write("ay serve: ayrs binary not found — running the TypeScript server (bun run build:rs, or reinstall, to get the Rust daemon)\n");
@@ -1794,6 +1796,7 @@ Options:
1794
1796
  process.stderr.write(`ay serve: ${plan.reason}: joining rooms needs the Rust daemon\n`);
1795
1797
  return 1;
1796
1798
  }
1799
+ if (!(plan.reason === "--no-rust" || plan.reason === "AGENT_YES_NO_RUST=1") && !SERVE_SUBCOMMANDS.has(rest[0] ?? "")) process.stderr.write(`ay serve: running the TypeScript server (${plan.reason})\n`);
1797
1800
  }
1798
1801
  }
1799
1802
  const sub = rest[0];
@@ -2193,11 +2196,15 @@ Options:
2193
2196
  await unlink(capFile(pid, `${daemonTag}:${viewer}`)).catch(() => {});
2194
2197
  };
2195
2198
  const readSharedCaps = async (pid) => {
2199
+ let local = null;
2196
2200
  let files;
2197
2201
  try {
2198
2202
  files = await readdir(capsDir(pid));
2199
2203
  } catch {
2200
- return [];
2204
+ return {
2205
+ caps: [],
2206
+ local
2207
+ };
2201
2208
  }
2202
2209
  const now = Date.now();
2203
2210
  const caps = [];
@@ -2215,9 +2222,13 @@ Options:
2215
2222
  rows: Number(parts[1])
2216
2223
  });
2217
2224
  if (cap) caps.push(cap);
2225
+ if (cap && parts[3] === "local") local = cap;
2218
2226
  } catch {}
2219
2227
  }
2220
- return caps;
2228
+ return {
2229
+ caps,
2230
+ local
2231
+ };
2221
2232
  };
2222
2233
  const negoApplied = /* @__PURE__ */ new Map();
2223
2234
  const negoTimers = /* @__PURE__ */ new Map();
@@ -2241,8 +2252,8 @@ Options:
2241
2252
  const winsizePathFor = (pid) => path.join(process.env.AGENT_YES_HOME ?? path.join(homedir(), ".agent-yes"), "winsize", String(pid));
2242
2253
  const applyNego = async (pid) => {
2243
2254
  negoTimers.delete(pid);
2244
- const caps = await readSharedCaps(pid);
2245
- const eff = negotiateSize(caps);
2255
+ const { caps, local } = await readSharedCaps(pid);
2256
+ const eff = negotiateSize(caps, local);
2246
2257
  const file = winsizePathFor(pid);
2247
2258
  const prev = negoApplied.get(pid);
2248
2259
  try {
@@ -2765,7 +2776,7 @@ Options:
2765
2776
  }
2766
2777
  });
2767
2778
  if (req.method === "GET" && p === "/api/ws") {
2768
- const ws = await import("./ws-BRhPG1Vy.js");
2779
+ const ws = await import("./ws-D0-Jg88z.js");
2769
2780
  try {
2770
2781
  await ws.loadProvision();
2771
2782
  } catch (e) {
@@ -2785,7 +2796,7 @@ Options:
2785
2796
  if (req.method === "GET" && p === "/api/ws/status") {
2786
2797
  const dirRaw = url.searchParams.get("path");
2787
2798
  if (!dirRaw) return new Response("missing ?path=<workspace dir>", { status: 400 });
2788
- const ws = await import("./ws-BRhPG1Vy.js");
2799
+ const ws = await import("./ws-D0-Jg88z.js");
2789
2800
  let prov;
2790
2801
  try {
2791
2802
  prov = await ws.loadProvision();
@@ -2807,7 +2818,7 @@ Options:
2807
2818
  }
2808
2819
  }
2809
2820
  if (req.method === "GET" && p === "/api/ws/repos") {
2810
- const ws = await import("./ws-BRhPG1Vy.js");
2821
+ const ws = await import("./ws-D0-Jg88z.js");
2811
2822
  try {
2812
2823
  await ws.loadProvision();
2813
2824
  } catch (e) {
@@ -2888,7 +2899,7 @@ Options:
2888
2899
  const m = /^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)$/.exec(repoParam);
2889
2900
  if (!m || m[1] === "." || m[1] === ".." || m[2] === "." || m[2] === "..") return new Response("missing/invalid ?repo=<owner>/<repo>", { status: 400 });
2890
2901
  const [, owner, repo] = m;
2891
- const ws = await import("./ws-BRhPG1Vy.js");
2902
+ const ws = await import("./ws-D0-Jg88z.js");
2892
2903
  let prov;
2893
2904
  try {
2894
2905
  prov = await ws.loadProvision();
@@ -3251,7 +3262,7 @@ Options:
3251
3262
  const { keyword, code = "enter", from = null, raw = false } = body;
3252
3263
  let msg = body.msg ?? "";
3253
3264
  if (!raw && msg.startsWith("<ay-msg ") && msg.includes("<alias-for-room-")) {
3254
- const { fillRoomAlias, roomAliases } = await import("./roomReplyAlias-DuEkSSDI.js");
3265
+ const { fillRoomAlias, roomAliases } = await import("./roomReplyAlias-BzWUBkQy.js");
3255
3266
  const aliases = await roomAliases();
3256
3267
  msg = fillRoomAlias(msg, (room) => aliases.get(room));
3257
3268
  }
@@ -3323,21 +3334,8 @@ Options:
3323
3334
  if (process.platform === "win32") return new Response("force-kill unsupported on a Windows serve", { status: 501 });
3324
3335
  try {
3325
3336
  const record = await resolveOne(keyword, defaultOpts({ all: true }));
3326
- const killed = [];
3327
- const sig = (target, label) => {
3328
- if (!target || target <= 1) return;
3329
- try {
3330
- process.kill(target, "SIGKILL");
3331
- killed.push(label);
3332
- } catch {}
3333
- };
3334
- const pgid = await pgidForWrapper(record.wrapper_pid ?? 0);
3335
- if (pgid && pgid > 1) try {
3336
- process.kill(-pgid, "SIGKILL");
3337
- killed.push(`group ${pgid}`);
3338
- } catch {}
3339
- sig(record.pid, `pid ${record.pid}`);
3340
- if (record.wrapper_pid && record.wrapper_pid !== record.pid) sig(record.wrapper_pid, `wrapper ${record.wrapper_pid}`);
3337
+ const { forceKill, forceKillTargets } = await import("./forceKill-BDqxx4uQ.js");
3338
+ const { killed } = forceKill(await forceKillTargets(record));
3341
3339
  await updateGlobalPidStatus(record.pid, {
3342
3340
  status: "exited",
3343
3341
  exit_reason: "force-killed via console"
@@ -3812,7 +3810,7 @@ Options:
3812
3810
  const perm = body.perm ?? "r";
3813
3811
  if (perm !== "r" && perm !== "rw") return new Response(`invalid perm ${perm} (want r or rw)`, { status: 400 });
3814
3812
  try {
3815
- const { createScopedShare } = await import("./agentShare-suB6yPgO.js");
3813
+ const { createScopedShare } = await import("./agentShare-BvpEm-Fr.js");
3816
3814
  const share = await createScopedShare({
3817
3815
  agent: body.agent,
3818
3816
  perm,
@@ -3827,12 +3825,12 @@ Options:
3827
3825
  }
3828
3826
  }
3829
3827
  if (req.method === "GET" && p === "/api/shares") {
3830
- const { listShares } = await import("./agentShare-suB6yPgO.js");
3828
+ const { listShares } = await import("./agentShare-BvpEm-Fr.js");
3831
3829
  return Response.json(listShares());
3832
3830
  }
3833
3831
  const revokeM = /^\/api\/share\/([^/]+)$/.exec(p);
3834
3832
  if (req.method === "DELETE" && revokeM) {
3835
- const { revokeShare } = await import("./agentShare-suB6yPgO.js");
3833
+ const { revokeShare } = await import("./agentShare-BvpEm-Fr.js");
3836
3834
  const ok = revokeShare(decodeURIComponent(revokeM[1]));
3837
3835
  return new Response(ok ? "revoked" : "no such share", { status: ok ? 200 : 404 });
3838
3836
  }
@@ -3846,7 +3844,7 @@ Options:
3846
3844
  const port = Number(body.port);
3847
3845
  if (!Number.isInteger(port) || port < 1 || port > 65535) return new Response("valid port required", { status: 400 });
3848
3846
  try {
3849
- const { ensureExposure } = await import("./expose-Dawq1LxC.js");
3847
+ const { ensureExposure } = await import("./expose-Bhsn5yUz.js");
3850
3848
  const h = await ensureExposure(port, body.relay);
3851
3849
  return Response.json({
3852
3850
  id: h.id,
@@ -3860,12 +3858,12 @@ Options:
3860
3858
  }
3861
3859
  }
3862
3860
  if (req.method === "GET" && p === "/api/exposes") {
3863
- const { listExposures } = await import("./expose-Dawq1LxC.js");
3861
+ const { listExposures } = await import("./expose-Bhsn5yUz.js");
3864
3862
  return Response.json(listExposures());
3865
3863
  }
3866
3864
  const unexposeM = /^\/api\/expose\/(\d+)$/.exec(p);
3867
3865
  if (req.method === "DELETE" && unexposeM) {
3868
- const { stopExposure } = await import("./expose-Dawq1LxC.js");
3866
+ const { stopExposure } = await import("./expose-Bhsn5yUz.js");
3869
3867
  const ok = stopExposure(Number(unexposeM[1]));
3870
3868
  return new Response(ok ? "revoked" : "no such exposure", { status: ok ? 200 : 404 });
3871
3869
  }
@@ -4094,7 +4092,7 @@ Options:
4094
4092
  if (wantWebrtc) {
4095
4093
  const explicitUrl = explicitRoomUrl;
4096
4094
  try {
4097
- const { startShare, loadOrCreateShareRoom } = await import("./share-DrS3LYqf.js");
4095
+ const { startShare, loadOrCreateShareRoom } = await import("./share-_TPYAGWC.js");
4098
4096
  const linkFile = path.join(process.env.AGENT_YES_HOME ?? path.join(homedir(), ".agent-yes"), ".share-link");
4099
4097
  const announce = async (room, link, joinLink, rotated) => {
4100
4098
  const lead = rotated ? "the room was rejected by signaling (stale generation) — rotated to a fresh link" : "shared over WebRTC — open this link (the token is eaten from the URL on open)";
@@ -4102,7 +4100,7 @@ Options:
4102
4100
  const persistNote = explicitUrl ? "\n" : ` (persistent room — same link across restarts; delete ~/.agent-yes/.share-room to rotate)\n\n`;
4103
4101
  process.stdout.write(`${wantHttp ? "\n" : ""}${lead}:\n ${link}\n\nto attach ANOTHER machine to this room, open this there (or paste it into\n\`ay serve --webrtc\`) — one machine per link:\n ${joinLink}\n` + persistNote);
4104
4102
  if (!rotated) {
4105
- const { offerOpenInBrowser } = await import("./openBrowser-1cIo4dJL.js");
4103
+ const { offerOpenInBrowser } = await import("./openBrowser-CQAOIrD6.js");
4106
4104
  await offerOpenInBrowser(link);
4107
4105
  }
4108
4106
  } else {
@@ -4144,7 +4142,7 @@ Options:
4144
4142
  const shutdown = (resolve) => {
4145
4143
  if (heartbeat) clearInterval(heartbeat);
4146
4144
  closeShare?.();
4147
- import("./agentShare-suB6yPgO.js").then((m) => m.revokeAllShares()).catch(() => {});
4145
+ import("./agentShare-BvpEm-Fr.js").then((m) => m.revokeAllShares()).catch(() => {});
4148
4146
  server?.stop();
4149
4147
  Promise.resolve(releaseHostLock?.()).catch(() => {}).then(resolve);
4150
4148
  };
@@ -4157,4 +4155,4 @@ Options:
4157
4155
 
4158
4156
  //#endregion
4159
4157
  export { cmdServe, inspectServeDaemon, loadTokenReadOnly, mintScopedTermToken, resolveDaemonHttpBase, resolveLocalServeUrl };
4160
- //# sourceMappingURL=serve-BpOIIOVc.js.map
4158
+ //# sourceMappingURL=serve-XwFYE0cE.js.map
@@ -1,5 +1,5 @@
1
1
  import "./e2e-BdLf8DvY.js";
2
- import { o as toWebrtcUrl } from "./webrtcLink-va_gAR77.js";
2
+ import { o as toWebrtcUrl } from "./webrtcLink-DcvacEci.js";
3
3
 
4
4
  //#region ts/serveRust.ts
5
5
  /**
@@ -20,6 +20,10 @@ import { o as toWebrtcUrl } from "./webrtcLink-va_gAR77.js";
20
20
  * join-secret (print the link + join secret members need; ayrs only)
21
21
  * --port <n> / --port=<n> (loopback HTTP console; 0 = free port)
22
22
  * --sighost <host> / --sighost=<host>
23
+ * --http (with --port: ayrs's --port listener IS the HTTP
24
+ * console, so the flag is implied and dropped)
25
+ * --host <loopback> (with --port: 127.0.0.1 / localhost / ::1 — ayrs
26
+ * binds loopback anyway, so the flag is dropped)
23
27
  *
24
28
  * What stays on TypeScript, with the reason printed:
25
29
  * - `--no-rust` / AGENT_YES_NO_RUST=1 (explicit opt-out)
@@ -28,7 +32,8 @@ import { o as toWebrtcUrl } from "./webrtcLink-va_gAR77.js";
28
32
  * - the daemon subcommands (install/uninstall/status/logs/start/stop/
29
33
  * healthcheck) and -d/--daemon: ayrs has its own OS-supervisor install and
30
34
  * the two must not manage each other's registration
31
- * - --share (http+webrtc over Portless), --http, --host, --token, --tls-*,
35
+ * - --share (http+webrtc over Portless), --http without --port (Portless),
36
+ * a non-loopback --host (ayrs listens on loopback only), --token, --tls-*,
32
37
  * --local
33
38
  */
34
39
  /** Subcommands `ay serve` dispatches before flag parsing — never delegated. */
@@ -41,6 +46,11 @@ const SERVE_SUBCOMMANDS = new Set([
41
46
  "stop",
42
47
  "healthcheck"
43
48
  ]);
49
+ const LOOPBACK_HOSTS = new Set([
50
+ "127.0.0.1",
51
+ "localhost",
52
+ "::1"
53
+ ]);
44
54
  /**
45
55
  * Decide whether `rest` (the argv after `serve`) can run as `ayrs serve`.
46
56
  * Returns the ayrs argv (without the program) or the TS fallback with its
@@ -86,6 +96,7 @@ function planRustServe(rest, env = process.env) {
86
96
  reason: `\`ay serve ${first}\``,
87
97
  rest
88
98
  };
99
+ const hasPort = rest.some((a) => a === "--port" || a.startsWith("--port="));
89
100
  const argv = ["serve"];
90
101
  for (let i = 0; i < rest.length; i++) {
91
102
  const a = rest[i];
@@ -131,6 +142,22 @@ function planRustServe(rest, env = process.env) {
131
142
  argv.push("--port", v);
132
143
  break;
133
144
  }
145
+ case "--http":
146
+ if (inline !== void 0 || !hasPort) return {
147
+ kind: "ts",
148
+ reason: `${a} without --port (Portless HTTPS console)`,
149
+ rest
150
+ };
151
+ break;
152
+ case "--host": {
153
+ const v = takeNext();
154
+ if (v === void 0 || !LOOPBACK_HOSTS.has(v) || !hasPort) return {
155
+ kind: "ts",
156
+ reason: `--host ${v ?? "(missing)"} (ayrs listens on loopback only)`,
157
+ rest
158
+ };
159
+ break;
160
+ }
134
161
  case "--sighost": {
135
162
  const v = takeNext();
136
163
  if (v === void 0) return {
@@ -181,5 +208,5 @@ function daemonShareRuntime(args, hasAyrs, env = process.env) {
181
208
  }
182
209
 
183
210
  //#endregion
184
- export { daemonShareRuntime, planRustServe };
185
- //# sourceMappingURL=serveRust-CbBrcUrg.js.map
211
+ export { SERVE_SUBCOMMANDS, daemonShareRuntime, planRustServe };
212
+ //# sourceMappingURL=serveRust-BfWkeL6T.js.map
@@ -1,7 +1,7 @@
1
- import { c as getWorkspaceRoot, p as setWorkspaceRoot } from "./workspaceConfig-BLWB5Wu9.js";
1
+ import { c as getWorkspaceRoot, p as setWorkspaceRoot } from "./workspaceConfig-DBgsu81B.js";
2
+ import { existsSync } from "node:fs";
2
3
  import { homedir } from "os";
3
4
  import path from "path";
4
- import { existsSync } from "node:fs";
5
5
  import { stdin, stdout } from "node:process";
6
6
  import { createInterface } from "node:readline/promises";
7
7
 
@@ -88,7 +88,7 @@ async function cmdSetup(rest) {
88
88
  process.stdout.write(`workspace root: ${abs}\n`);
89
89
  if (!existsSync(abs)) process.stderr.write(` note: that directory doesn't exist yet — create it, or agents spawned there will fail\n`);
90
90
  try {
91
- const { linkBunBinsToSystemPath } = await import("./systemPathLink-SjUzgSiq.js");
91
+ const { linkBunBinsToSystemPath } = await import("./systemPathLink-Y3iC7bYV.js");
92
92
  const r = linkBunBinsToSystemPath();
93
93
  if (r && (r.linked.length || r.refreshed.length)) {
94
94
  const n = r.linked.length + r.refreshed.length;
@@ -97,7 +97,7 @@ async function cmdSetup(rest) {
97
97
  } catch {}
98
98
  if (noShare) return 0;
99
99
  process.stdout.write(`\nsharing this machine to agent-yes.com…\n`);
100
- const { cmdServe } = await import("./serve-BpOIIOVc.js");
100
+ const { cmdServe } = await import("./serve-XwFYE0cE.js");
101
101
  return cmdServe([
102
102
  "install",
103
103
  "--share",
@@ -107,4 +107,4 @@ async function cmdSetup(rest) {
107
107
 
108
108
  //#endregion
109
109
  export { cmdSetup };
110
- //# sourceMappingURL=setup-DdIBk6Iv.js.map
110
+ //# sourceMappingURL=setup-D4-s2VZw.js.map
@@ -642,4 +642,4 @@ async function startShare(opts) {
642
642
 
643
643
  //#endregion
644
644
  export { readShareRoom as a, shareRoomPath as c, loadOrCreateShareRoom as i, startShare as l, getIceServers as n, shareLinkFromRoomUrl as o, importRTC as r, shareRoomFileName as s, formatRoomLink as t };
645
- //# sourceMappingURL=share-w5oRbvlj.js.map
645
+ //# sourceMappingURL=share-CbFetL5H.js.map
@@ -1,4 +1,4 @@
1
1
  import "./e2e-BdLf8DvY.js";
2
- import { a as readShareRoom, c as shareRoomPath, i as loadOrCreateShareRoom, l as startShare, n as getIceServers, o as shareLinkFromRoomUrl, r as importRTC, s as shareRoomFileName, t as formatRoomLink } from "./share-w5oRbvlj.js";
2
+ import { a as readShareRoom, c as shareRoomPath, i as loadOrCreateShareRoom, l as startShare, n as getIceServers, o as shareLinkFromRoomUrl, r as importRTC, s as shareRoomFileName, t as formatRoomLink } from "./share-CbFetL5H.js";
3
3
 
4
4
  export { getIceServers, importRTC, loadOrCreateShareRoom, readShareRoom, shareLinkFromRoomUrl, shareRoomFileName, startShare };