agent-yes 1.191.0 → 1.192.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.
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-BQh1-ljE.js";
1
+ import { t as CLIS_CONFIG } from "./ts-BdFKarex.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-mUaQHk4M.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-C0fh_eJs.js.map
@@ -0,0 +1,8 @@
1
+ import "./ts-BdFKarex.js";
2
+ import "./logger-CDIsZ-Pp.js";
3
+ import "./versionChecker-DEJVuzWZ.js";
4
+ import "./pidStore-BIvsBQ8X.js";
5
+ import "./globalPidIndex-CoNr7tS8.js";
6
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-C0fh_eJs.js";
7
+
8
+ export { SUPPORTED_CLIS };
@@ -1,7 +1,7 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
3
  import "./configShared-0MnIQ652.js";
4
- import { j as resolveOne } from "./subcommands-CNCgJ48t.js";
4
+ import { j as resolveOne } from "./subcommands-IIDRpOa1.js";
5
5
  import "./e2e-BeKjLhmO.js";
6
6
  import "./webrtcLink-BG0Xc4-W.js";
7
7
  import "./remotes-CgT91bMo.js";
@@ -228,4 +228,4 @@ function transformEvent(rawEvent, agentId, forwarded) {
228
228
 
229
229
  //#endregion
230
230
  export { createScopedShare, listShares, revokeAllShares, revokeShare };
231
- //# sourceMappingURL=agentShare-Boa9P2dK.js.map
231
+ //# sourceMappingURL=agentShare-Byzqbfk6.js.map
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env bun
2
2
  import { t as invokedCliName } from "./invokedCli-uqM2YYA7.js";
3
3
  import { n as logger } from "./logger-CDIsZ-Pp.js";
4
- import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-DhCi7ncH.js";
5
- import { n as getRustBinary } from "./rustBinary-Cu8q2m9s.js";
4
+ import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-DEJVuzWZ.js";
5
+ import { n as getRustBinary } from "./rustBinary-INWRomvk.js";
6
6
  import { argv } from "process";
7
7
  import { spawn } from "child_process";
8
8
  import ms from "ms";
@@ -285,7 +285,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
285
285
  const rawArg = process.argv[2];
286
286
  const managerCommands = !invokedCliName(process.argv);
287
287
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
288
- const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-Uerol8Tz.js");
288
+ const { isSubcommand, runSubcommand, cmdHelp } = await import("./subcommands-D_QHSUp-.js");
289
289
  if (isHelpFlag && process.argv.length === 3) {
290
290
  await cmdHelp(managerCommands);
291
291
  process.exit(0);
@@ -327,7 +327,7 @@ if (config.useRust) {
327
327
  }
328
328
  }
329
329
  if (rustBinary) {
330
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-P3I0D3Ka.js");
330
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-DAzPSQ95.js");
331
331
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
332
332
  if (config.verbose) {
333
333
  console.log(`[rust] Using binary: ${rustBinary}`);
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-BQh1-ljE.js";
1
+ import { a as removeControlCharacters, i as AgentContext, n as agentYes, r as config, t as CLIS_CONFIG } from "./ts-BdFKarex.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-DhCi7ncH.js";
3
+ import "./versionChecker-DEJVuzWZ.js";
4
4
  import "./pidStore-BIvsBQ8X.js";
5
5
  import "./globalPidIndex-CoNr7tS8.js";
6
6
 
@@ -1,7 +1,7 @@
1
1
  import { n as logger } from "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
3
  import "./configShared-0MnIQ652.js";
4
- import { G as hostId, J as readInbox, K as listInboxParents, O as renderLogTailLines, Q as notifyDir, S as listRecords, U as appendEvent, W as gcInboxes, X as daemonLockDir, Y as shouldStealLock, Z as daemonLockOwnerPath, _ as isPidAlive, c as deriveLiveState, q as liveWatchers } from "./subcommands-CNCgJ48t.js";
4
+ import { G as hostId, J as readInbox, K as listInboxParents, O as renderLogTailLines, Q as notifyDir, S as listRecords, U as appendEvent, W as gcInboxes, X as daemonLockDir, Y as shouldStealLock, Z as daemonLockOwnerPath, _ as isPidAlive, c as deriveLiveState, q as liveWatchers } from "./subcommands-IIDRpOa1.js";
5
5
  import "./e2e-BeKjLhmO.js";
6
6
  import "./webrtcLink-BG0Xc4-W.js";
7
7
  import "./remotes-CgT91bMo.js";
@@ -588,4 +588,4 @@ async function ensureDaemon() {
588
588
 
589
589
  //#endregion
590
590
  export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
591
- //# sourceMappingURL=notifyDaemon-hKT38cBs.js.map
591
+ //# sourceMappingURL=notifyDaemon-DjuvLK7-.js.map
@@ -1,4 +1,4 @@
1
- import { r as getInstalledPackage } from "./versionChecker-DhCi7ncH.js";
1
+ import { r as getInstalledPackage } from "./versionChecker-DEJVuzWZ.js";
2
2
  import { execFileSync } from "child_process";
3
3
  import { existsSync, mkdirSync, unlinkSync } from "fs";
4
4
  import { chmod, copyFile } from "fs/promises";
@@ -225,4 +225,4 @@ async function getRustBinary(options = {}) {
225
225
 
226
226
  //#endregion
227
227
  export { getRustBinary as n, findSpawnHiddenLauncher as t };
228
- //# sourceMappingURL=rustBinary-Cu8q2m9s.js.map
228
+ //# sourceMappingURL=rustBinary-INWRomvk.js.map
@@ -1,9 +1,9 @@
1
- import "./ts-BQh1-ljE.js";
1
+ import "./ts-BdFKarex.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-DhCi7ncH.js";
3
+ import "./versionChecker-DEJVuzWZ.js";
4
4
  import "./pidStore-BIvsBQ8X.js";
5
5
  import "./globalPidIndex-CoNr7tS8.js";
6
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-mUaQHk4M.js";
6
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-C0fh_eJs.js";
7
7
  import { d as resolveSpawnCwd } from "./workspaceConfig-_GtAZtsi.js";
8
8
  import { createHash } from "node:crypto";
9
9
 
@@ -141,4 +141,4 @@ async function cmdSchedule(rest) {
141
141
 
142
142
  //#endregion
143
143
  export { cmdSchedule };
144
- //# sourceMappingURL=schedule-Bb98iG9W.js.map
144
+ //# sourceMappingURL=schedule-CsNFNbbW.js.map
@@ -1,13 +1,13 @@
1
- import "./ts-BQh1-ljE.js";
1
+ import "./ts-BdFKarex.js";
2
2
  import "./logger-CDIsZ-Pp.js";
3
- import { r as getInstalledPackage } from "./versionChecker-DhCi7ncH.js";
4
- import { t as findSpawnHiddenLauncher } from "./rustBinary-Cu8q2m9s.js";
3
+ import { r as getInstalledPackage } from "./versionChecker-DEJVuzWZ.js";
4
+ import { t as findSpawnHiddenLauncher } from "./rustBinary-INWRomvk.js";
5
5
  import "./pidStore-BIvsBQ8X.js";
6
6
  import { a as updateGlobalPidStatus } from "./globalPidIndex-CoNr7tS8.js";
7
7
  import { t as pgidForWrapper } from "./reaper-CWF2_ATd.js";
8
8
  import "./configShared-0MnIQ652.js";
9
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-mUaQHk4M.js";
10
- import { $ as TYPING_BADGE, D as recentReadEdges, E as readPtysize, H as writeToIpc, I as snapshotStatus, O as renderLogTailLines, S as listRecords, T as readNotes, b as isUserTyping, f as extractNeedsInput, j as resolveOne, k as renderRawLog, l as deriveLiveStatus, o as controlCodeFromName, p as extractTaskCounts, u as extractBadges } from "./subcommands-CNCgJ48t.js";
9
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-C0fh_eJs.js";
10
+ import { $ as TYPING_BADGE, D as recentReadEdges, E as readPtysize, H as writeToIpc, I as snapshotStatus, O as renderLogTailLines, S as listRecords, T as readNotes, b as isUserTyping, f as extractNeedsInput, j as resolveOne, k as renderRawLog, l as deriveLiveStatus, o as controlCodeFromName, p as extractTaskCounts, u as extractBadges } from "./subcommands-IIDRpOa1.js";
11
11
  import "./e2e-BeKjLhmO.js";
12
12
  import "./webrtcLink-BG0Xc4-W.js";
13
13
  import "./remotes-CgT91bMo.js";
@@ -1851,7 +1851,7 @@ Options:
1851
1851
  const perm = body.perm ?? "r";
1852
1852
  if (perm !== "r" && perm !== "rw") return new Response(`invalid perm ${perm} (want r or rw)`, { status: 400 });
1853
1853
  try {
1854
- const { createScopedShare } = await import("./agentShare-Boa9P2dK.js");
1854
+ const { createScopedShare } = await import("./agentShare-Byzqbfk6.js");
1855
1855
  const share = await createScopedShare({
1856
1856
  agent: body.agent,
1857
1857
  perm,
@@ -1866,12 +1866,12 @@ Options:
1866
1866
  }
1867
1867
  }
1868
1868
  if (req.method === "GET" && p === "/api/shares") {
1869
- const { listShares } = await import("./agentShare-Boa9P2dK.js");
1869
+ const { listShares } = await import("./agentShare-Byzqbfk6.js");
1870
1870
  return Response.json(listShares());
1871
1871
  }
1872
1872
  const revokeM = /^\/api\/share\/([^/]+)$/.exec(p);
1873
1873
  if (req.method === "DELETE" && revokeM) {
1874
- const { revokeShare } = await import("./agentShare-Boa9P2dK.js");
1874
+ const { revokeShare } = await import("./agentShare-Byzqbfk6.js");
1875
1875
  const ok = revokeShare(decodeURIComponent(revokeM[1]));
1876
1876
  return new Response(ok ? "revoked" : "no such share", { status: ok ? 200 : 404 });
1877
1877
  }
@@ -2052,7 +2052,7 @@ Options:
2052
2052
  const shutdown = (resolve) => {
2053
2053
  if (heartbeat) clearInterval(heartbeat);
2054
2054
  closeShare?.();
2055
- import("./agentShare-Boa9P2dK.js").then((m) => m.revokeAllShares()).catch(() => {});
2055
+ import("./agentShare-Byzqbfk6.js").then((m) => m.revokeAllShares()).catch(() => {});
2056
2056
  server?.stop();
2057
2057
  resolve();
2058
2058
  };
@@ -2065,4 +2065,4 @@ Options:
2065
2065
 
2066
2066
  //#endregion
2067
2067
  export { cmdServe };
2068
- //# sourceMappingURL=serve-DVhbtjR4.js.map
2068
+ //# sourceMappingURL=serve-CfR-7uMU.js.map
@@ -32,7 +32,7 @@ async function cmdSetup(rest) {
32
32
  if (!existsSync(abs)) process.stderr.write(` note: that directory doesn't exist yet — create it, or agents spawned there will fail\n`);
33
33
  if (noShare) return 0;
34
34
  process.stdout.write(`\nsharing this machine to agent-yes.com…\n`);
35
- const { cmdServe } = await import("./serve-DVhbtjR4.js");
35
+ const { cmdServe } = await import("./serve-CfR-7uMU.js");
36
36
  return cmdServe([
37
37
  "install",
38
38
  "--share",
@@ -42,4 +42,4 @@ async function cmdSetup(rest) {
42
42
 
43
43
  //#endregion
44
44
  export { cmdSetup };
45
- //# sourceMappingURL=setup-Dj8Grg0K.js.map
45
+ //# sourceMappingURL=setup-0Oby3hYf.js.map
@@ -1,7 +1,7 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
2
  import "./globalPidIndex-CoNr7tS8.js";
3
3
  import "./configShared-0MnIQ652.js";
4
- import { A as renderRawLogLines, B as waitForLogQuiet, C as matchKeyword, D as recentReadEdges, E as readPtysize, F as runSubcommand, H as writeToIpc, I as snapshotStatus, L as stdinActivityPath, M as resolveReadWindow, N as resolveResumeArgs, O as renderLogTailLines, P as restartHintLines, R as stopTipForCli, S as listRecords, T as readNotes, V as writeKeysPaced, _ as isPidAlive, a as cmdHelp, b as isUserTyping, c as deriveLiveState, d as extractMenu, f as extractNeedsInput, g as isExitRequest, h as isAgentStuck, i as backoffWhileTyping, j as resolveOne, k as renderRawLog, l as deriveLiveStatus, m as finalizedLines, n as READ_PAGE_DEFAULT, o as controlCodeFromName, p as extractTaskCounts, r as TYPING_WINDOW_MS, s as cursorAbs, t as GRACEFUL_EXIT_COMMANDS, u as extractBadges, v as isSlashCommand, w as menuSelectKeys, x as lastStdinAt, y as isSubcommand, z as submitAndConfirm } from "./subcommands-CNCgJ48t.js";
4
+ import { A as renderRawLogLines, B as waitForLogQuiet, C as matchKeyword, D as recentReadEdges, E as readPtysize, F as runSubcommand, H as writeToIpc, I as snapshotStatus, L as stdinActivityPath, M as resolveReadWindow, N as resolveResumeArgs, O as renderLogTailLines, P as restartHintLines, R as stopTipForCli, S as listRecords, T as readNotes, V as writeKeysPaced, _ as isPidAlive, a as cmdHelp, b as isUserTyping, c as deriveLiveState, d as extractMenu, f as extractNeedsInput, g as isExitRequest, h as isAgentStuck, i as backoffWhileTyping, j as resolveOne, k as renderRawLog, l as deriveLiveStatus, m as finalizedLines, n as READ_PAGE_DEFAULT, o as controlCodeFromName, p as extractTaskCounts, r as TYPING_WINDOW_MS, s as cursorAbs, t as GRACEFUL_EXIT_COMMANDS, u as extractBadges, v as isSlashCommand, w as menuSelectKeys, x as lastStdinAt, y as isSubcommand, z as submitAndConfirm } from "./subcommands-IIDRpOa1.js";
5
5
  import "./e2e-BeKjLhmO.js";
6
6
  import "./webrtcLink-BG0Xc4-W.js";
7
7
  import "./remotes-CgT91bMo.js";
@@ -12,6 +12,7 @@ import { homedir } from "os";
12
12
  import path from "path";
13
13
  import { randomUUID } from "node:crypto";
14
14
  import os from "node:os";
15
+ import { randomBytes as randomBytes$1 } from "crypto";
15
16
 
16
17
  //#region ts/agentTree.ts
17
18
  /**
@@ -1146,15 +1147,15 @@ async function runSubcommand(argv) {
1146
1147
  case "restart": return await cmdRestart(rest);
1147
1148
  case "note": return await cmdNote(rest);
1148
1149
  case "serve": {
1149
- const { cmdServe } = await import("./serve-DVhbtjR4.js");
1150
+ const { cmdServe } = await import("./serve-CfR-7uMU.js");
1150
1151
  return cmdServe(rest);
1151
1152
  }
1152
1153
  case "setup": {
1153
- const { cmdSetup } = await import("./setup-Dj8Grg0K.js");
1154
+ const { cmdSetup } = await import("./setup-0Oby3hYf.js");
1154
1155
  return cmdSetup(rest);
1155
1156
  }
1156
1157
  case "schedule": {
1157
- const { cmdSchedule } = await import("./schedule-Bb98iG9W.js");
1158
+ const { cmdSchedule } = await import("./schedule-CsNFNbbW.js");
1158
1159
  return cmdSchedule(rest);
1159
1160
  }
1160
1161
  case "remote": {
@@ -2729,7 +2730,7 @@ async function cmdSpawn(rest) {
2729
2730
  * (`send`, `key`, `select`): refuse a self-targeting loop, and require that THIS
2730
2731
  * sender actually looked at THIS target recently — an agent is blocked, an
2731
2732
  * interactive human is only warned — unless `force`. Returns the sender context
2732
- * so a caller can reuse it (e.g. `send`'s `[from …]` prefix). Extracted from
2733
+ * so a caller can reuse it (e.g. `send`'s `[ay-msg …]` header). Extracted from
2733
2734
  * cmdSend so the action commands enforce the identical guard.
2734
2735
  */
2735
2736
  async function enforceSendGuards(record, force) {
@@ -2926,7 +2927,14 @@ async function cmdSend(rest) {
2926
2927
  return 0;
2927
2928
  }
2928
2929
  const replyTarget = sender.agent?.agent_id || sender.agent?.pid;
2929
- const fullBody = (sender.agent && !isSlashCommand(body) ? `[from ${sender.agent.cli} #${sender.agent.pid} @ ${shortenPath(sender.agent.cwd)} — reply: ay send ${replyTarget} "..."]\n` : "") + body;
2930
+ let prefix = "";
2931
+ let suffix = "";
2932
+ if (sender.agent && !isSlashCommand(body)) {
2933
+ const nonce = randomBytes$1(4).toString("hex");
2934
+ prefix = `[ay-msg ${nonce} from ${sender.agent.cli} #${sender.agent.pid} @ ${shortenPath(sender.agent.cwd)} — reply: ay send ${replyTarget} "..."]\n`;
2935
+ suffix = `\n[/ay-msg ${nonce}]`;
2936
+ }
2937
+ const fullBody = prefix + body + suffix;
2930
2938
  const noWait = Boolean(argv.noWait) || process.env.AGENT_YES_SEND_NO_WAIT === "1";
2931
2939
  if (fullBody && !noWait && !force) {
2932
2940
  const { clear, waitedMs } = await backoffWhileTyping(record.pid, SEND_TYPING_MAX_WAIT_MS);
@@ -3996,7 +4004,7 @@ async function cmdNotify(rest) {
3996
4004
  }
3997
4005
  const ensure = async () => {
3998
4006
  if (!argv["ensure-daemon"]) return;
3999
- const { ensureDaemon } = await import("./notifyDaemon-hKT38cBs.js");
4007
+ const { ensureDaemon } = await import("./notifyDaemon-DjuvLK7-.js");
4000
4008
  await ensureDaemon().catch(() => null);
4001
4009
  };
4002
4010
  await heartbeatWatcher(parent, selfStartedAt);
@@ -4070,7 +4078,7 @@ async function cmdNotifyCursor(args) {
4070
4078
  }
4071
4079
  async function cmdNotifyd(rest) {
4072
4080
  const sub = rest[0] ?? "status";
4073
- const daemon = await import("./notifyDaemon-hKT38cBs.js");
4081
+ const daemon = await import("./notifyDaemon-DjuvLK7-.js");
4074
4082
  switch (sub) {
4075
4083
  case "run": return daemon.runDaemon();
4076
4084
  case "once": return daemon.runDaemon({ once: true });
@@ -4097,4 +4105,4 @@ async function cmdNotifyd(rest) {
4097
4105
 
4098
4106
  //#endregion
4099
4107
  export { TYPING_BADGE as $, renderRawLogLines as A, waitForLogQuiet as B, matchKeyword as C, recentReadEdges as D, readPtysize as E, runSubcommand as F, hostId as G, writeToIpc as H, snapshotStatus as I, readInbox as J, listInboxParents as K, stdinActivityPath as L, resolveReadWindow as M, resolveResumeArgs as N, renderLogTailLines as O, restartHintLines as P, notifyDir as Q, stopTipForCli as R, listRecords as S, readNotes as T, appendEvent as U, writeKeysPaced as V, gcInboxes as W, daemonLockDir as X, shouldStealLock as Y, daemonLockOwnerPath as Z, isPidAlive as _, cmdHelp as a, isUserTyping as b, deriveLiveState as c, extractMenu as d, extractNeedsInput as f, isExitRequest as g, isAgentStuck as h, backoffWhileTyping as i, resolveOne as j, renderRawLog as k, deriveLiveStatus as l, finalizedLines as m, READ_PAGE_DEFAULT as n, controlCodeFromName as o, extractTaskCounts as p, liveWatchers as q, TYPING_WINDOW_MS as r, cursorAbs as s, GRACEFUL_EXIT_COMMANDS as t, extractBadges as u, isSlashCommand as v, menuSelectKeys as w, lastStdinAt as x, isSubcommand as y, submitAndConfirm as z };
4100
- //# sourceMappingURL=subcommands-CNCgJ48t.js.map
4108
+ //# sourceMappingURL=subcommands-IIDRpOa1.js.map
@@ -1,5 +1,5 @@
1
1
  import { n as logger, t as addTransport } from "./logger-CDIsZ-Pp.js";
2
- import { r as getInstalledPackage } from "./versionChecker-DhCi7ncH.js";
2
+ import { r as getInstalledPackage } from "./versionChecker-DEJVuzWZ.js";
3
3
  import { t as agentYesHome } from "./agentYesHome-CtHb5b71.js";
4
4
  import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-CNMl13dC.js";
5
5
  import { t as PidStore } from "./pidStore-BIvsBQ8X.js";
@@ -1824,4 +1824,4 @@ function sleep(ms) {
1824
1824
 
1825
1825
  //#endregion
1826
1826
  export { removeControlCharacters as a, AgentContext as i, agentYes as n, config as r, CLIS_CONFIG as t };
1827
- //# sourceMappingURL=ts-BQh1-ljE.js.map
1827
+ //# sourceMappingURL=ts-BdFKarex.js.map
@@ -7,7 +7,7 @@ import { fileURLToPath } from "url";
7
7
 
8
8
  //#region package.json
9
9
  var name = "agent-yes";
10
- var version = "1.191.0";
10
+ var version = "1.192.0";
11
11
 
12
12
  //#endregion
13
13
  //#region ts/versionChecker.ts
@@ -215,4 +215,4 @@ async function displayVersion() {
215
215
 
216
216
  //#endregion
217
217
  export { versionString as i, displayVersion as n, getInstalledPackage as r, checkAndAutoUpdate as t };
218
- //# sourceMappingURL=versionChecker-DhCi7ncH.js.map
218
+ //# sourceMappingURL=versionChecker-DEJVuzWZ.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-yes",
3
- "version": "1.191.0",
3
+ "version": "1.192.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",
package/ts/subcommands.ts CHANGED
@@ -11,6 +11,7 @@
11
11
  * to the normal agent-spawning flow.
12
12
  */
13
13
 
14
+ import { randomBytes } from "crypto";
14
15
  import { appendFile, mkdir, open, readFile, stat, writeFile } from "fs/promises";
15
16
  import ms from "ms";
16
17
  import { homedir } from "os";
@@ -2653,7 +2654,7 @@ async function cmdSpawn(rest: string[]): Promise<number> {
2653
2654
  * (`send`, `key`, `select`): refuse a self-targeting loop, and require that THIS
2654
2655
  * sender actually looked at THIS target recently — an agent is blocked, an
2655
2656
  * interactive human is only warned — unless `force`. Returns the sender context
2656
- * so a caller can reuse it (e.g. `send`'s `[from …]` prefix). Extracted from
2657
+ * so a caller can reuse it (e.g. `send`'s `[ay-msg …]` header). Extracted from
2657
2658
  * cmdSend so the action commands enforce the identical guard.
2658
2659
  */
2659
2660
  async function enforceSendGuards(
@@ -2962,13 +2963,21 @@ async function cmdSend(rest: string[]): Promise<number> {
2962
2963
  // prefix would bump it to line 2 and the CLI would type the command as plain
2963
2964
  // text. So skip the prefix for a command body and send it verbatim —
2964
2965
  // attribution is dropped for the command, but it actually runs.
2966
+ // The header/footer pair shares a random nonce so the recipient can trust the
2967
+ // block's boundaries: text INSIDE the body can't forge a matching open/close
2968
+ // marker (the nonce is generated here, after the body was authored), so a
2969
+ // spoofed "[from …]" line or a premature "[/ay-msg]" embedded in a message
2970
+ // can't impersonate another sender or truncate/extend the trusted region.
2965
2971
  const replyTarget = sender.agent?.agent_id || sender.agent?.pid;
2966
- const prefix =
2967
- sender.agent && !isSlashCommand(body)
2968
- ? `[from ${sender.agent.cli} #${sender.agent.pid} @ ${shortenPath(sender.agent.cwd)} — reply: ay send ${replyTarget} "..."]\n`
2969
- : "";
2972
+ let prefix = "";
2973
+ let suffix = "";
2974
+ if (sender.agent && !isSlashCommand(body)) {
2975
+ const nonce = randomBytes(4).toString("hex");
2976
+ prefix = `[ay-msg ${nonce} from ${sender.agent.cli} #${sender.agent.pid} @ ${shortenPath(sender.agent.cwd)} — reply: ay send ${replyTarget} "..."]\n`;
2977
+ suffix = `\n[/ay-msg ${nonce}]`;
2978
+ }
2970
2979
 
2971
- const fullBody = prefix + body;
2980
+ const fullBody = prefix + body + suffix;
2972
2981
  const noWait = Boolean(argv.noWait) || process.env.AGENT_YES_SEND_NO_WAIT === "1";
2973
2982
 
2974
2983
  // Back off while the user is typing at the target's terminal — injecting our
@@ -1,8 +0,0 @@
1
- import "./ts-BQh1-ljE.js";
2
- import "./logger-CDIsZ-Pp.js";
3
- import "./versionChecker-DhCi7ncH.js";
4
- import "./pidStore-BIvsBQ8X.js";
5
- import "./globalPidIndex-CoNr7tS8.js";
6
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-mUaQHk4M.js";
7
-
8
- export { SUPPORTED_CLIS };