agent-yes 1.290.5 → 1.290.6-beta.716.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 (39) hide show
  1. package/dist/{SUPPORTED_CLIS-Bpby2pCs.js → SUPPORTED_CLIS-B85QCwFU.js} +2 -2
  2. package/dist/{SUPPORTED_CLIS-CAnkWLNt.js → SUPPORTED_CLIS-DZ_pM3aq.js} +4 -4
  3. package/dist/{agentShare-B2Ka3xHL.js → agentShare-3xw5h43m.js} +3 -3
  4. package/dist/{callback-oTEzC_fz.js → callback-B0sWC2Ui.js} +3 -3
  5. package/dist/{callback-C-5izsmg.js → callback-BRq8z897.js} +3 -3
  6. package/dist/cli.js +5 -5
  7. package/dist/{cmdPs-CCNLgfdW.js → cmdPs-DUopx5Y7.js} +3 -3
  8. package/dist/index.js +3 -3
  9. package/dist/messageLog-BYE4RITB.js +180 -0
  10. package/dist/{notifyDaemon-D9sg14uO.js → notifyDaemon-B35ryS14.js} +3 -3
  11. package/dist/{parentPingLoop-DpR3i-AR.js → parentPingLoop-CIAZM4Xv.js} +2 -2
  12. package/dist/{rustBinary-CpCYaez8.js → rustBinary-CiOVDXL-.js} +2 -2
  13. package/dist/{rustBinary-DWfTr6Pz.js → rustBinary-b0JcLRSe.js} +2 -2
  14. package/dist/{schedule-CYnI8Qav.js → schedule-BeUwPayh.js} +5 -5
  15. package/dist/{serve-B_ULMhXB.js → serve-DKMiKjCs.js} +18 -37
  16. package/dist/{setup-B_aqnmQ6.js → setup-TgCIbGE7.js} +2 -2
  17. package/dist/{subcommands-Cmfbg6li.js → subcommands-Bh7tMnrm.js} +2 -2
  18. package/dist/{subcommands-CtdEqyfu.js → subcommands-CzrpkV8l.js} +16 -16
  19. package/dist/{terminal-Cp3dSgZK.js → terminal-DTt2XDLI.js} +2 -2
  20. package/dist/{trayApp-Ua_zvXKo.js → trayApp-BEGzGEE9.js} +2 -2
  21. package/dist/trayApp-CHZJBZuM.js +5 -0
  22. package/dist/{ts-Dksh8h3d.js → ts-DnW2JXMn.js} +4 -4
  23. package/dist/{versionChecker-BtbA9XWt.js → versionChecker-52kwRzJQ.js} +2 -2
  24. package/dist/{widget-CATGOMqR.js → widget-BIX5o2fD.js} +3 -3
  25. package/dist/{ws-DgY3Haek.js → ws-BOR-Tu3X.js} +2 -2
  26. package/dist/{ws-DfvkhFYb.js → ws-PRA--xaC.js} +3 -3
  27. package/lab/ui/console-logic.js +83 -0
  28. package/lab/ui/index.html +115 -49
  29. package/package.json +1 -1
  30. package/scripts/benchmark-console-resize.ts +128 -0
  31. package/ts/messageLog.bun.spec.ts +122 -0
  32. package/ts/messageLog.spec.ts +122 -0
  33. package/ts/messageLog.ts +43 -0
  34. package/ts/terminalReply.bun.spec.ts +72 -1
  35. package/ts/terminalReply.spec.ts +72 -1
  36. package/ts/terminalReply.ts +30 -0
  37. package/ts/todoCli.spec.ts +4 -1
  38. package/dist/messageLog-DdjBNqgt.js +0 -94
  39. package/dist/trayApp-BuopoLE-.js +0 -5
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-Dksh8h3d.js";
1
+ import { t as CLIS_CONFIG } from "./ts-DnW2JXMn.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-Bpby2pCs.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-B85QCwFU.js.map
@@ -1,12 +1,12 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-BtbA9XWt.js";
3
- import "./ts-Dksh8h3d.js";
2
+ import "./versionChecker-52kwRzJQ.js";
3
+ import "./ts-DnW2JXMn.js";
4
4
  import "./todoAutomation-CbVVS4re.js";
5
5
  import "./JsonlStore-BqF7AQ6E.js";
6
6
  import "./globalPidIndex-DoaKEUkO.js";
7
7
  import "./pidStore-B73xnAeT.js";
8
- import "./messageLog-DdjBNqgt.js";
8
+ import "./messageLog-BYE4RITB.js";
9
9
  import "./todoStore-DF6vxHgV.js";
10
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-Bpby2pCs.js";
10
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-B85QCwFU.js";
11
11
 
12
12
  export { SUPPORTED_CLIS };
@@ -1,9 +1,9 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-DoaKEUkO.js";
3
- import "./messageLog-DdjBNqgt.js";
3
+ import "./messageLog-BYE4RITB.js";
4
4
  import "./e2e-z1xpwSAg.js";
5
5
  import "./configShared-DKTgiz7K.js";
6
- import { z as resolveOne } from "./subcommands-CtdEqyfu.js";
6
+ import { z as resolveOne } from "./subcommands-CzrpkV8l.js";
7
7
  import "./notifyStore-2SWKGwZI.js";
8
8
  import "./webrtcLink-DLaJfTcB.js";
9
9
  import "./remotes-BjsglpjL.js";
@@ -230,4 +230,4 @@ function transformEvent(rawEvent, agentId, forwarded) {
230
230
 
231
231
  //#endregion
232
232
  export { createScopedShare, listShares, revokeAllShares, revokeShare };
233
- //# sourceMappingURL=agentShare-B2Ka3xHL.js.map
233
+ //# sourceMappingURL=agentShare-3xw5h43m.js.map
@@ -1,5 +1,5 @@
1
1
  import { t as agentYesHome } from "./agentYesHome-BNtn19J4.js";
2
- import { z as resolveOne } from "./subcommands-CtdEqyfu.js";
2
+ import { z as resolveOne } from "./subcommands-CzrpkV8l.js";
3
3
  import { a as mintCapability, o as parseExpires } from "./callbackCore-Bl2gGcxg.js";
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { chmodSync, readFileSync, renameSync, writeFileSync } from "node:fs";
@@ -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-B_ULMhXB.js");
75
+ const { resolveLocalServeUrl } = await import("./serve-DKMiKjCs.js");
76
76
  const url = await resolveLocalServeUrl();
77
77
  if (url) return url;
78
78
  } catch {}
@@ -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-oTEzC_fz.js.map
190
+ //# sourceMappingURL=callback-B0sWC2Ui.js.map
@@ -1,13 +1,13 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-DoaKEUkO.js";
3
- import "./messageLog-DdjBNqgt.js";
3
+ import "./messageLog-BYE4RITB.js";
4
4
  import "./e2e-z1xpwSAg.js";
5
5
  import "./configShared-DKTgiz7K.js";
6
- import "./subcommands-CtdEqyfu.js";
6
+ import "./subcommands-CzrpkV8l.js";
7
7
  import "./notifyStore-2SWKGwZI.js";
8
8
  import "./webrtcLink-DLaJfTcB.js";
9
9
  import "./remotes-BjsglpjL.js";
10
10
  import "./callbackCore-Bl2gGcxg.js";
11
- import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-oTEzC_fz.js";
11
+ import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-B0sWC2Ui.js";
12
12
 
13
13
  export { cmdCallback };
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
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-BtbA9XWt.js";
5
- import { l as getRustBinary } from "./rustBinary-DWfTr6Pz.js";
4
+ import { a as versionString, r as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-52kwRzJQ.js";
5
+ import { l as getRustBinary } from "./rustBinary-b0JcLRSe.js";
6
6
  import { argv } from "process";
7
7
  import { spawn } from "child_process";
8
8
  import ms from "ms";
@@ -295,7 +295,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
295
295
  const rawArg = process.argv[2];
296
296
  const managerCommands = !invokedCliName(process.argv);
297
297
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
298
- const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken, isBareManagerInvocation } = await import("./subcommands-Cmfbg6li.js");
298
+ const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken, isBareManagerInvocation } = await import("./subcommands-Bh7tMnrm.js");
299
299
  if (isHelpFlag && process.argv.length === 3) {
300
300
  await cmdHelp(managerCommands);
301
301
  process.exit(0);
@@ -309,7 +309,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
309
309
  process.exit(code ?? 0);
310
310
  }
311
311
  {
312
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-CAnkWLNt.js");
312
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DZ_pM3aq.js");
313
313
  if (isUnknownManagerToken(rawArg, managerCommands, SUPPORTED_CLIS)) {
314
314
  process.stderr.write(`ay: unknown subcommand or CLI '${rawArg}'.\n See 'ay help' for subcommands. To run an agent, name a CLI:\n 'ay <cli> …' (e.g. 'ay claude …') or 'ay --cli <cli> …'.\n`);
315
315
  process.exit(1);
@@ -360,7 +360,7 @@ if (config.useRust) {
360
360
  }
361
361
  }
362
362
  if (rustBinary) {
363
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-CAnkWLNt.js");
363
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DZ_pM3aq.js");
364
364
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
365
365
  if (config.verbose) {
366
366
  console.log(`[rust] Using binary: ${rustBinary}`);
@@ -1,9 +1,9 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-DoaKEUkO.js";
3
- import "./messageLog-DdjBNqgt.js";
3
+ import "./messageLog-BYE4RITB.js";
4
4
  import "./e2e-z1xpwSAg.js";
5
5
  import "./configShared-DKTgiz7K.js";
6
- import { $ as buildAgentForest, D as listRecords, et as flattenForest, u as deriveLiveState } from "./subcommands-CtdEqyfu.js";
6
+ import { $ as buildAgentForest, D as listRecords, et as flattenForest, u as deriveLiveState } from "./subcommands-CzrpkV8l.js";
7
7
  import "./notifyStore-2SWKGwZI.js";
8
8
  import "./webrtcLink-DLaJfTcB.js";
9
9
  import "./remotes-BjsglpjL.js";
@@ -328,4 +328,4 @@ function readPpidSync(pid) {
328
328
 
329
329
  //#endregion
330
330
  export { cmdPs };
331
- //# sourceMappingURL=cmdPs-CCNLgfdW.js.map
331
+ //# sourceMappingURL=cmdPs-DUopx5Y7.js.map
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-BtbA9XWt.js";
3
- import { a as hasTodoStore, i as answerAsk, l as AgentContext, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-Dksh8h3d.js";
2
+ import "./versionChecker-52kwRzJQ.js";
3
+ import { a as hasTodoStore, i as answerAsk, l as AgentContext, n as agentYes, o as listAsks, r as config, s as listAsksForProject, t as CLIS_CONFIG } from "./ts-DnW2JXMn.js";
4
4
  import { a as renderTree, c as describeBlock, i as renderDigest, l as monitorHint, o as unblockedTasks, r as openBlockers, t as reconcileTodos, u as removeControlCharacters } from "./todoAutomation-CbVVS4re.js";
5
5
  import "./JsonlStore-BqF7AQ6E.js";
6
6
  import "./globalPidIndex-DoaKEUkO.js";
7
7
  import "./pidStore-B73xnAeT.js";
8
- import "./messageLog-DdjBNqgt.js";
8
+ import "./messageLog-BYE4RITB.js";
9
9
  import { a as LIFECYCLES, c as initialState, d as requiredGate, f as statesOf, i as DONE_STATE, l as isKnownKind, n as TodoStore, o as ORPHANED_STATE, r as openStore, s as canTransition, t as CycleError, u as nextStates } from "./todoStore-DF6vxHgV.js";
10
10
 
11
11
  export { AgentContext, CLIS_CONFIG, CycleError, DONE_STATE, LIFECYCLES, ORPHANED_STATE, TodoStore, answerAsk, canTransition, config, agentYes as default, describeBlock, hasTodoStore, initialState, isKnownKind, listAsks, listAsksForProject, monitorHint, nextStates, openBlockers, openStore, reconcileTodos, removeControlCharacters, renderDigest, renderTree, requiredGate, statesOf, unblockedTasks };
@@ -0,0 +1,180 @@
1
+ import { n as logger } from "./logger-CDIsZ-Pp.js";
2
+ import { appendFile, mkdir, readFile, writeFile } from "fs/promises";
3
+ import path from "path";
4
+
5
+ //#region ts/terminalReply.ts
6
+ /**
7
+ * Is this /api/send payload PURELY terminal auto-reply chatter — the responses
8
+ * a viewer's xterm generates to the agent TUI's protocol queries (Cursor
9
+ * Position Report incl. the DECXCPR `?`-prefixed form, Device Attributes,
10
+ * Device Status Report) — rather than a keystroke?
11
+ *
12
+ * Used by the serve daemon to keep such writes out of `last_stdin_at`, so a
13
+ * redraw/resize (or a TUI polling `ESC[?6n` every render) can't pin the
14
+ * console's stdin-flash + stdin age at "just typed".
15
+ *
16
+ * Anchored over ONE-OR-MORE replies: a burst of queries (e.g. tail replay on
17
+ * viewer attach) is answered in a single onData chunk, so several replies
18
+ * arrive concatenated in one payload. Real typing — including arrow keys like
19
+ * `ESC[A` — never matches any alternative.
20
+ */
21
+ const isTerminalReply = (s) => /^(?:\x1b\[(?:\??\d+(?:;\d+)*R|\?[\d;]*c|>[\d;]*c|\d*n))+$/.test(s);
22
+ /**
23
+ * Is this payload nothing but replies a terminal sends UNPROMPTED BY ANY PERSON —
24
+ * answers to queries the application itself made?
25
+ *
26
+ * Deliberately NARROWER than `isTerminalReply`, even though it also covers OSC
27
+ * colour replies, because the two answer different questions. `isTerminalReply`
28
+ * decides whether to refresh `last_stdin_at`; being wrong there mislabels a
29
+ * console as "just typed". This one decides whether a byte is stored in the
30
+ * message log at all; being wrong here DELETES SOMETHING A PERSON DID. Where a
31
+ * shape is ambiguous, this predicate declines.
32
+ *
33
+ * Two families that `isTerminalReply` accepts are excluded for exactly that
34
+ * reason, and the exclusions are measurements, not caution:
35
+ *
36
+ * - PLAIN CPR `ESC[<n>;<n>R`. xterm's modified F3 is `ESC[1;<mod>R` — the same
37
+ * shape. "Only the final byte separates an input from a reply" is false: `R`
38
+ * ends both. Measured over 128,827 stored rows, plain CPR appears ONCE while
39
+ * the `?`-prefixed DECXCPR form — which no key can produce — appears 46,693
40
+ * times. Keeping plain CPR buys one row and costs a real keypress.
41
+ * - SGR MOUSE `ESC[<b;x;yM|m`. `M` is press/wheel/motion and `m` is release, so
42
+ * a person clicking a button inside a TUI emits the same bytes as the pointer
43
+ * drifting across it. 36,616 rows, the second largest family — and no shape
44
+ * separates the deliberate click from the drift. A discriminator has to come
45
+ * from the producer, which is the only place the intent is known.
46
+ */
47
+ const isUnpromptedTerminalReply = (s) => /^(?:\x1b\[(?:\?\d+(?:;\d+)*R|\?[\d;]*c|>[\d;]*c|\d*n)|\x1b\](?:10|11|12|4;\d+);rgb:[0-9a-fA-F]{1,4}(?:\/[0-9a-fA-F]{1,4})*(?:\x1b\\|\x07))+$/.test(s);
48
+
49
+ //#endregion
50
+ //#region ts/messageLog.ts
51
+ /**
52
+ * Durable inter-agent message log.
53
+ *
54
+ * Every `ay send` that carries a real body is recorded twice — from the two
55
+ * ends' points of view — as append-only JSONL colocated with each agent's
56
+ * project dir (the same `<cwd>/.agent-yes/` convention the session logs use):
57
+ *
58
+ * - the SENDER's `<from.cwd>/.agent-yes/outbox.jsonl`
59
+ * - the RECIPIENT's `<to.cwd>/.agent-yes/inbox.jsonl`
60
+ *
61
+ * A single cwd may host several agents, so records carry the stable `agent_id`
62
+ * (falling back to `pid`) of each end; `ay msgs` filters a mailbox down to one
63
+ * agent by that key. Reading needs no lock (last line wins isn't relevant — a
64
+ * message log keeps every entry); writing is best-effort and never blocks or
65
+ * fails a send.
66
+ */
67
+ /**
68
+ * Whether a record belongs in a mailbox at all.
69
+ *
70
+ * A terminal answers protocol queries the TUI makes — where is the cursor, what
71
+ * terminal are you, what is your background colour — and those answers reach the
72
+ * agent's stdin the same way a message does. Without this they are stored as
73
+ * messages, and the mailbox is capped, so they evict it.
74
+ *
75
+ * Why that is worse than untidy: this log is the documented recovery path for a
76
+ * message that arrived truncated, and an evicted message is indistinguishable
77
+ * from one that was never sent. Measured on one agent, 1,989 of its 2,000 slots
78
+ * were `ESC[?59;3R` arriving at ~292/min, so the window held SEVEN MINUTES.
79
+ * Raising MAILBOX_MAX_LINES cannot fix a rate; the rows have to stop being
80
+ * recorded.
81
+ *
82
+ * TWO conditions, and only the first discriminates:
83
+ *
84
+ * 1. The body is nothing but replies nobody asked for
85
+ * (`isUnpromptedTerminalReply`). That predicate is deliberately narrower
86
+ * than serve's `isTerminalReply` — see its doc for the two families it
87
+ * refuses to claim, and why "only the final byte separates an input from a
88
+ * reply" turned out to be false.
89
+ * 2. No agent sent it. Across 128,827 stored rows every reply-shaped body had
90
+ * `from === null` and none had a sender, so this never fires today. It is
91
+ * here so an agent that deliberately pushes such bytes still gets a durable
92
+ * record. Shape decides; the sender is a margin, and NOT a safety net for
93
+ * humans — an interactive human sender is also `from === null`, which is why
94
+ * every ambiguous shape has to be excluded by shape.
95
+ *
96
+ * NOT COVERED, named rather than silently missed: SGR mouse reports (36,616
97
+ * rows) and plain CPR, both excluded because they collide with real input;
98
+ * focus in/out (`ESC[I` / `ESC[O`, 215 rows), shape-identical to a two-byte CSI
99
+ * key. What is left still drops 47,331 of 128,827 stored rows (36.7%) — and
100
+ * 99.5% of the mailbox that was measured broken, whose noise was pure DECXCPR.
101
+ */
102
+ function shouldRecord(record) {
103
+ if (record.from) return true;
104
+ return !isUnpromptedTerminalReply(record.body ?? "");
105
+ }
106
+ /** Keep at most this many lines per mailbox; older entries are compacted away. */
107
+ const MAILBOX_MAX_LINES = 2e3;
108
+ /** Path to a cwd's mailbox file (`<cwd>/.agent-yes/{inbox,outbox}.jsonl`). */
109
+ function mailboxPath(cwd, box) {
110
+ return path.join(cwd, ".agent-yes", `${box}.jsonl`);
111
+ }
112
+ /** Whether a mail party is the agent identified by (agentId, pid). Prefers the
113
+ * stable agent_id (survives restart); falls back to pid for legacy records. */
114
+ function partyMatches(party, agentId, pid) {
115
+ if (!party) return false;
116
+ if (agentId && party.agent_id && party.agent_id === agentId) return true;
117
+ if (typeof pid === "number" && party.pid === pid) return true;
118
+ return false;
119
+ }
120
+ async function appendCapped(filePath, record) {
121
+ await mkdir(path.dirname(filePath), { recursive: true });
122
+ await appendFile(filePath, JSON.stringify(record) + "\n");
123
+ const lines = (await readFile(filePath, "utf-8").catch(() => "")).split("\n").filter((l) => l.trim());
124
+ if (lines.length > MAILBOX_MAX_LINES) await writeFile(filePath, lines.slice(lines.length - MAILBOX_MAX_LINES).join("\n") + "\n");
125
+ }
126
+ /**
127
+ * Record the SENDER's view in its outbox. Best-effort — a filesystem error is
128
+ * logged and swallowed so persistence never breaks a send. The outbox lives
129
+ * under `from.cwd`; a human sender (from === null) writes under `process.cwd()`.
130
+ */
131
+ async function recordOutbox(record) {
132
+ if (!shouldRecord(record)) return;
133
+ const outCwd = record.from?.cwd ?? process.cwd();
134
+ try {
135
+ await appendCapped(mailboxPath(outCwd, "outbox"), record);
136
+ } catch (err) {
137
+ logger.debug(`[messageLog] outbox append failed: ${err}`);
138
+ }
139
+ }
140
+ /** Record the RECIPIENT's view in its inbox (under `to.cwd`). Best-effort. */
141
+ async function recordInbox(record) {
142
+ if (!shouldRecord(record)) return;
143
+ try {
144
+ await appendCapped(mailboxPath(record.to.cwd, "inbox"), record);
145
+ } catch (err) {
146
+ logger.debug(`[messageLog] inbox append failed: ${err}`);
147
+ }
148
+ }
149
+ /**
150
+ * Record a same-host message in both mailboxes — the sender's outbox and the
151
+ * recipient's inbox both live on this machine. For a message that crossed the
152
+ * wire, each end calls `recordOutbox`/`recordInbox` on its own host instead.
153
+ */
154
+ async function recordMessage(record) {
155
+ await recordOutbox(record);
156
+ await recordInbox(record);
157
+ }
158
+ /** Read and parse a cwd's mailbox, oldest first. Missing/corrupt lines skipped. */
159
+ async function readMailbox(cwd, box) {
160
+ let raw;
161
+ try {
162
+ raw = await readFile(mailboxPath(cwd, box), "utf-8");
163
+ } catch {
164
+ return [];
165
+ }
166
+ const out = [];
167
+ for (const line of raw.split("\n")) {
168
+ const t = line.trim();
169
+ if (!t) continue;
170
+ try {
171
+ const rec = JSON.parse(t);
172
+ if (rec && typeof rec.at === "number" && rec.to) out.push(rec);
173
+ } catch {}
174
+ }
175
+ return out;
176
+ }
177
+
178
+ //#endregion
179
+ export { recordOutbox as a, recordMessage as i, readMailbox as n, isTerminalReply as o, recordInbox as r, partyMatches as t };
180
+ //# sourceMappingURL=messageLog-BYE4RITB.js.map
@@ -1,9 +1,9 @@
1
1
  import { n as logger } from "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-DoaKEUkO.js";
3
- import "./messageLog-DdjBNqgt.js";
3
+ import "./messageLog-BYE4RITB.js";
4
4
  import "./e2e-z1xpwSAg.js";
5
5
  import "./configShared-DKTgiz7K.js";
6
- import { D as listRecords, I as renderLogTailLines, b as isPidAlive, u as deriveLiveState } from "./subcommands-CtdEqyfu.js";
6
+ import { D as listRecords, I as renderLogTailLines, b as isPidAlive, u as deriveLiveState } from "./subcommands-CzrpkV8l.js";
7
7
  import { f as readInbox, g as daemonLockOwnerPath, h as daemonLockDir, i as gcInboxes, l as listInboxParents, m as shouldStealLock, n as appendEvent, s as hostId, u as liveWatchers, x as notifyDir } from "./notifyStore-2SWKGwZI.js";
8
8
  import "./webrtcLink-DLaJfTcB.js";
9
9
  import "./remotes-BjsglpjL.js";
@@ -871,4 +871,4 @@ async function ensureDaemon() {
871
871
 
872
872
  //#endregion
873
873
  export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
874
- //# sourceMappingURL=notifyDaemon-D9sg14uO.js.map
874
+ //# sourceMappingURL=notifyDaemon-B35ryS14.js.map
@@ -338,7 +338,7 @@ async function isParentWatching(parentWrapperPid, parentAgentPid, selfAgentPid,
338
338
  logger.debug("[parent-ping] watcher lookup failed:", error);
339
339
  }
340
340
  try {
341
- const { lastReadAt, READ_WINDOW_MS } = await import("./subcommands-Cmfbg6li.js");
341
+ const { lastReadAt, READ_WINDOW_MS } = await import("./subcommands-Bh7tMnrm.js");
342
342
  const last = await lastReadAt(`agent:${parentAgentPid}`, selfAgentPid);
343
343
  if (last !== null && now - last <= READ_WINDOW_MS) return true;
344
344
  } catch (error) {
@@ -466,4 +466,4 @@ function startParentPingLoop(opts) {
466
466
 
467
467
  //#endregion
468
468
  export { startParentPingLoop };
469
- //# sourceMappingURL=parentPingLoop-DpR3i-AR.js.map
469
+ //# sourceMappingURL=parentPingLoop-CIAZM4Xv.js.map
@@ -1,4 +1,4 @@
1
- import "./versionChecker-BtbA9XWt.js";
2
- import { a as gcOldBinaryDirs, c as getDownloadUrl, i as findTrayLauncher, l as getRustBinary, n as findRustBinary, o as getBinDir, r as findSpawnHiddenLauncher, s as getBinaryName, t as downloadBinary } from "./rustBinary-DWfTr6Pz.js";
1
+ import "./versionChecker-52kwRzJQ.js";
2
+ import { a as gcOldBinaryDirs, c as getDownloadUrl, i as findTrayLauncher, l as getRustBinary, n as findRustBinary, o as getBinDir, r as findSpawnHiddenLauncher, s as getBinaryName, t as downloadBinary } from "./rustBinary-b0JcLRSe.js";
3
3
 
4
4
  export { gcOldBinaryDirs };
@@ -1,4 +1,4 @@
1
- import { i as getInstalledPackage, n as compareVersions } from "./versionChecker-BtbA9XWt.js";
1
+ import { i as getInstalledPackage, n as compareVersions } from "./versionChecker-52kwRzJQ.js";
2
2
  import { execFileSync } from "child_process";
3
3
  import { existsSync, mkdirSync, readdirSync, rmSync, statSync, unlinkSync } from "fs";
4
4
  import { chmod, copyFile } from "fs/promises";
@@ -310,4 +310,4 @@ async function getRustBinary(options = {}) {
310
310
 
311
311
  //#endregion
312
312
  export { gcOldBinaryDirs as a, getDownloadUrl as c, findTrayLauncher as i, getRustBinary as l, findRustBinary as n, getBinDir as o, findSpawnHiddenLauncher as r, getBinaryName as s, downloadBinary as t };
313
- //# sourceMappingURL=rustBinary-DWfTr6Pz.js.map
313
+ //# sourceMappingURL=rustBinary-b0JcLRSe.js.map
@@ -1,13 +1,13 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-BtbA9XWt.js";
3
- import "./ts-Dksh8h3d.js";
2
+ import "./versionChecker-52kwRzJQ.js";
3
+ import "./ts-DnW2JXMn.js";
4
4
  import "./todoAutomation-CbVVS4re.js";
5
5
  import "./JsonlStore-BqF7AQ6E.js";
6
6
  import "./globalPidIndex-DoaKEUkO.js";
7
7
  import "./pidStore-B73xnAeT.js";
8
- import "./messageLog-DdjBNqgt.js";
8
+ import "./messageLog-BYE4RITB.js";
9
9
  import "./todoStore-DF6vxHgV.js";
10
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-Bpby2pCs.js";
10
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-B85QCwFU.js";
11
11
  import { f as resolveSpawnCwd } from "./workspaceConfig-DTvPtr5j.js";
12
12
  import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-CipjIwfO.js";
13
13
  import { createHash } from "node:crypto";
@@ -154,4 +154,4 @@ async function cmdSchedule(rest) {
154
154
 
155
155
  //#endregion
156
156
  export { cmdSchedule };
157
- //# sourceMappingURL=schedule-CYnI8Qav.js.map
157
+ //# sourceMappingURL=schedule-BeUwPayh.js.map
@@ -1,30 +1,30 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import { i as getInstalledPackage } from "./versionChecker-BtbA9XWt.js";
3
- import { r as findSpawnHiddenLauncher } from "./rustBinary-DWfTr6Pz.js";
4
- import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-Dksh8h3d.js";
2
+ import { i as getInstalledPackage } from "./versionChecker-52kwRzJQ.js";
3
+ import { r as findSpawnHiddenLauncher } from "./rustBinary-b0JcLRSe.js";
4
+ import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-DnW2JXMn.js";
5
5
  import { t as agentYesHome$1 } from "./agentYesHome-BNtn19J4.js";
6
6
  import { u as removeControlCharacters } from "./todoAutomation-CbVVS4re.js";
7
7
  import "./JsonlStore-BqF7AQ6E.js";
8
8
  import { a as updateGlobalPidStatus } from "./globalPidIndex-DoaKEUkO.js";
9
9
  import "./pidStore-B73xnAeT.js";
10
- import { r as recordInbox } from "./messageLog-DdjBNqgt.js";
10
+ import { o as isTerminalReply, r as recordInbox } from "./messageLog-BYE4RITB.js";
11
11
  import { t as pgidForWrapper } from "./reaper-UimuuTfO.js";
12
12
  import "./todoStore-DF6vxHgV.js";
13
13
  import "./e2e-z1xpwSAg.js";
14
14
  import "./configShared-DKTgiz7K.js";
15
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-Bpby2pCs.js";
16
- import { D as listRecords, F as recentReadEdges, I as renderLogTailLines, L as renderRawLog, M as readNotes, N as readPtysize, P as recentMessageEdges, Q as TYPING_BADGE, R as renderRawLogLines, W as snapshotStatus, X as writeToIpc, Z as withIpcLock, c as controlCodeFromName, d as deriveLiveStatus, f as extractBadges, h as extractTaskCounts, j as readLogForRender, m as extractNeedsInput, w as isUserTyping, z as resolveOne } from "./subcommands-CtdEqyfu.js";
15
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-B85QCwFU.js";
16
+ import { D as listRecords, F as recentReadEdges, I as renderLogTailLines, L as renderRawLog, M as readNotes, N as readPtysize, P as recentMessageEdges, Q as TYPING_BADGE, R as renderRawLogLines, W as snapshotStatus, X as writeToIpc, Z as withIpcLock, c as controlCodeFromName, d as deriveLiveStatus, f as extractBadges, h as extractTaskCounts, j as readLogForRender, m as extractNeedsInput, w as isUserTyping, z as resolveOne } from "./subcommands-CzrpkV8l.js";
17
17
  import { c as isTransientLockMkdirError } from "./notifyStore-2SWKGwZI.js";
18
18
  import "./webrtcLink-DLaJfTcB.js";
19
19
  import "./remotes-BjsglpjL.js";
20
20
  import { i as frameVisitorMessage, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-Bl2gGcxg.js";
21
- import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-oTEzC_fz.js";
21
+ import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-B0sWC2Ui.js";
22
22
  import { n as sampleTrees } from "./procStats-CyD8h5nx.js";
23
23
  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-DTvPtr5j.js";
24
24
  import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-CipjIwfO.js";
25
- import { i as importProvisionModule } from "./ws-DgY3Haek.js";
25
+ import { i as importProvisionModule } from "./ws-BOR-Tu3X.js";
26
26
  import { r as spawnRejectionReason } from "./spawnGate-B26UnzqP.js";
27
- import { i as launchTray } from "./trayApp-Ua_zvXKo.js";
27
+ import { i as launchTray } from "./trayApp-BEGzGEE9.js";
28
28
  import yargs from "yargs";
29
29
  import { appendFile, mkdir, open, readFile, readdir, rename, rm, stat, unlink, writeFile } from "fs/promises";
30
30
  import { arch, cpus, freemem, homedir, hostname, loadavg, platform, totalmem, uptime, userInfo } from "os";
@@ -106,25 +106,6 @@ function verifyTermToken(masterToken, tok, nowSec = Math.floor(Date.now() / 1e3)
106
106
  };
107
107
  }
108
108
 
109
- //#endregion
110
- //#region ts/terminalReply.ts
111
- /**
112
- * Is this /api/send payload PURELY terminal auto-reply chatter — the responses
113
- * a viewer's xterm generates to the agent TUI's protocol queries (Cursor
114
- * Position Report incl. the DECXCPR `?`-prefixed form, Device Attributes,
115
- * Device Status Report) — rather than a keystroke?
116
- *
117
- * Used by the serve daemon to keep such writes out of `last_stdin_at`, so a
118
- * redraw/resize (or a TUI polling `ESC[?6n` every render) can't pin the
119
- * console's stdin-flash + stdin age at "just typed".
120
- *
121
- * Anchored over ONE-OR-MORE replies: a burst of queries (e.g. tail replay on
122
- * viewer attach) is answered in a single onData chunk, so several replies
123
- * arrive concatenated in one payload. Real typing — including arrow keys like
124
- * `ESC[A` — never matches any alternative.
125
- */
126
- const isTerminalReply = (s) => /^(?:\x1b\[(?:\??\d+(?:;\d+)*R|\?[\d;]*c|>[\d;]*c|\d*n))+$/.test(s);
127
-
128
109
  //#endregion
129
110
  //#region ts/serveSampler.ts
130
111
  /**
@@ -2582,7 +2563,7 @@ Options:
2582
2563
  }
2583
2564
  });
2584
2565
  if (req.method === "GET" && p === "/api/ws") {
2585
- const ws = await import("./ws-DfvkhFYb.js");
2566
+ const ws = await import("./ws-PRA--xaC.js");
2586
2567
  try {
2587
2568
  await ws.loadProvision();
2588
2569
  } catch (e) {
@@ -2602,7 +2583,7 @@ Options:
2602
2583
  if (req.method === "GET" && p === "/api/ws/status") {
2603
2584
  const dirRaw = url.searchParams.get("path");
2604
2585
  if (!dirRaw) return new Response("missing ?path=<workspace dir>", { status: 400 });
2605
- const ws = await import("./ws-DfvkhFYb.js");
2586
+ const ws = await import("./ws-PRA--xaC.js");
2606
2587
  let prov;
2607
2588
  try {
2608
2589
  prov = await ws.loadProvision();
@@ -2624,7 +2605,7 @@ Options:
2624
2605
  }
2625
2606
  }
2626
2607
  if (req.method === "GET" && p === "/api/ws/repos") {
2627
- const ws = await import("./ws-DfvkhFYb.js");
2608
+ const ws = await import("./ws-PRA--xaC.js");
2628
2609
  try {
2629
2610
  await ws.loadProvision();
2630
2611
  } catch (e) {
@@ -2705,7 +2686,7 @@ Options:
2705
2686
  const m = /^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)$/.exec(repoParam);
2706
2687
  if (!m || m[1] === "." || m[1] === ".." || m[2] === "." || m[2] === "..") return new Response("missing/invalid ?repo=<owner>/<repo>", { status: 400 });
2707
2688
  const [, owner, repo] = m;
2708
- const ws = await import("./ws-DfvkhFYb.js");
2689
+ const ws = await import("./ws-PRA--xaC.js");
2709
2690
  let prov;
2710
2691
  try {
2711
2692
  prov = await ws.loadProvision();
@@ -3616,7 +3597,7 @@ Options:
3616
3597
  const perm = body.perm ?? "r";
3617
3598
  if (perm !== "r" && perm !== "rw") return new Response(`invalid perm ${perm} (want r or rw)`, { status: 400 });
3618
3599
  try {
3619
- const { createScopedShare } = await import("./agentShare-B2Ka3xHL.js");
3600
+ const { createScopedShare } = await import("./agentShare-3xw5h43m.js");
3620
3601
  const share = await createScopedShare({
3621
3602
  agent: body.agent,
3622
3603
  perm,
@@ -3631,12 +3612,12 @@ Options:
3631
3612
  }
3632
3613
  }
3633
3614
  if (req.method === "GET" && p === "/api/shares") {
3634
- const { listShares } = await import("./agentShare-B2Ka3xHL.js");
3615
+ const { listShares } = await import("./agentShare-3xw5h43m.js");
3635
3616
  return Response.json(listShares());
3636
3617
  }
3637
3618
  const revokeM = /^\/api\/share\/([^/]+)$/.exec(p);
3638
3619
  if (req.method === "DELETE" && revokeM) {
3639
- const { revokeShare } = await import("./agentShare-B2Ka3xHL.js");
3620
+ const { revokeShare } = await import("./agentShare-3xw5h43m.js");
3640
3621
  const ok = revokeShare(decodeURIComponent(revokeM[1]));
3641
3622
  return new Response(ok ? "revoked" : "no such share", { status: ok ? 200 : 404 });
3642
3623
  }
@@ -3942,7 +3923,7 @@ Options:
3942
3923
  const shutdown = (resolve) => {
3943
3924
  if (heartbeat) clearInterval(heartbeat);
3944
3925
  closeShare?.();
3945
- import("./agentShare-B2Ka3xHL.js").then((m) => m.revokeAllShares()).catch(() => {});
3926
+ import("./agentShare-3xw5h43m.js").then((m) => m.revokeAllShares()).catch(() => {});
3946
3927
  server?.stop();
3947
3928
  Promise.resolve(releaseHostLock?.()).catch(() => {}).then(resolve);
3948
3929
  };
@@ -3955,4 +3936,4 @@ Options:
3955
3936
 
3956
3937
  //#endregion
3957
3938
  export { cmdServe, loadTokenReadOnly, mintScopedTermToken, resolveDaemonHttpBase, resolveLocalServeUrl };
3958
- //# sourceMappingURL=serve-B_ULMhXB.js.map
3939
+ //# sourceMappingURL=serve-DKMiKjCs.js.map
@@ -40,7 +40,7 @@ async function cmdSetup(rest) {
40
40
  } catch {}
41
41
  if (noShare) return 0;
42
42
  process.stdout.write(`\nsharing this machine to agent-yes.com…\n`);
43
- const { cmdServe } = await import("./serve-B_ULMhXB.js");
43
+ const { cmdServe } = await import("./serve-DKMiKjCs.js");
44
44
  return cmdServe([
45
45
  "install",
46
46
  "--share",
@@ -50,4 +50,4 @@ async function cmdSetup(rest) {
50
50
 
51
51
  //#endregion
52
52
  export { cmdSetup };
53
- //# sourceMappingURL=setup-B_aqnmQ6.js.map
53
+ //# sourceMappingURL=setup-TgCIbGE7.js.map
@@ -1,9 +1,9 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-DoaKEUkO.js";
3
- import "./messageLog-DdjBNqgt.js";
3
+ import "./messageLog-BYE4RITB.js";
4
4
  import "./e2e-z1xpwSAg.js";
5
5
  import "./configShared-DKTgiz7K.js";
6
- import { A as readAgentPtysize, B as resolveReadWindow, C as isUnknownManagerToken, D as listRecords, E as lastStdinAt, F as recentReadEdges, G as stdinActivityPath, H as restartHintLines, I as renderLogTailLines, J as waitForLogQuiet, K as stopTipForCli, L as renderRawLog, M as readNotes, N as readPtysize, O as matchKeyword, P as recentMessageEdges, R as renderRawLogLines, S as isSubcommand, T as lastReadAt, U as runSubcommand, V as resolveResumeArgs, W as snapshotStatus, X as writeToIpc, Y as writeKeysPaced, _ as isAgentStuck, a as TYPING_WINDOW_MS, b as isPidAlive, c as controlCodeFromName, d as deriveLiveStatus, f as extractBadges, g as finalizedLines, h as extractTaskCounts, i as READ_WINDOW_MS, j as readLogForRender, k as menuSelectKeys, l as cursorAbs, m as extractNeedsInput, n as MAX_RENDER_BYTES, o as backoffWhileTyping, p as extractMenu, q as submitAndConfirm, r as READ_PAGE_DEFAULT, s as cmdHelp, t as GRACEFUL_EXIT_COMMANDS, u as deriveLiveState, v as isBareManagerInvocation, w as isUserTyping, x as isSlashCommand, y as isExitRequest, z as resolveOne } from "./subcommands-CtdEqyfu.js";
6
+ import { A as readAgentPtysize, B as resolveReadWindow, C as isUnknownManagerToken, D as listRecords, E as lastStdinAt, F as recentReadEdges, G as stdinActivityPath, H as restartHintLines, I as renderLogTailLines, J as waitForLogQuiet, K as stopTipForCli, L as renderRawLog, M as readNotes, N as readPtysize, O as matchKeyword, P as recentMessageEdges, R as renderRawLogLines, S as isSubcommand, T as lastReadAt, U as runSubcommand, V as resolveResumeArgs, W as snapshotStatus, X as writeToIpc, Y as writeKeysPaced, _ as isAgentStuck, a as TYPING_WINDOW_MS, b as isPidAlive, c as controlCodeFromName, d as deriveLiveStatus, f as extractBadges, g as finalizedLines, h as extractTaskCounts, i as READ_WINDOW_MS, j as readLogForRender, k as menuSelectKeys, l as cursorAbs, m as extractNeedsInput, n as MAX_RENDER_BYTES, o as backoffWhileTyping, p as extractMenu, q as submitAndConfirm, r as READ_PAGE_DEFAULT, s as cmdHelp, t as GRACEFUL_EXIT_COMMANDS, u as deriveLiveState, v as isBareManagerInvocation, w as isUserTyping, x as isSlashCommand, y as isExitRequest, z as resolveOne } from "./subcommands-CzrpkV8l.js";
7
7
  import "./notifyStore-2SWKGwZI.js";
8
8
  import "./webrtcLink-DLaJfTcB.js";
9
9
  import "./remotes-BjsglpjL.js";