agent-yes 1.258.2 → 1.258.3

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 (26) hide show
  1. package/dist/{SUPPORTED_CLIS-B3WKb4vp.js → SUPPORTED_CLIS-D1BoydrZ.js} +3 -3
  2. package/dist/{SUPPORTED_CLIS-a2RZRGGX.js → SUPPORTED_CLIS-DD6bhkyI.js} +2 -2
  3. package/dist/{agentShare-B7Kw7jsl.js → agentShare-CoI7IHeq.js} +2 -2
  4. package/dist/{callback-4rXZ89hg.js → callback-CbdkyTRw.js} +3 -3
  5. package/dist/{callback-D8b4cqDL.js → callback-DNI__ASS.js} +2 -2
  6. package/dist/cli.js +21 -14
  7. package/dist/index.js +2 -2
  8. package/dist/{notifyDaemon-Cgt9NOpH.js → notifyDaemon-BQ6_UbJS.js} +2 -2
  9. package/dist/{rustBinary-CTrWqcUg.js → rustBinary-orhBmTNo.js} +2 -2
  10. package/dist/{schedule-CwYc6fmZ.js → schedule-BQy6gXYk.js} +4 -4
  11. package/dist/{serve-BSqkv0ID.js → serve-C2mQMjUR.js} +15 -15
  12. package/dist/{setup-GcSqhFuR.js → setup-EEF1vfhi.js} +2 -2
  13. package/dist/{subcommands-0PlB-s4J.js → subcommands-CiX7J7hA.js} +13 -13
  14. package/dist/{subcommands-JgqyhIMd.js → subcommands-S7uULM_d.js} +1 -1
  15. package/dist/{terminal-D9Ll04hy.js → terminal-i7IimD_R.js} +2 -2
  16. package/dist/{trayApp-pNVA4NUf.js → trayApp-4sZgxxP-.js} +2 -2
  17. package/dist/trayApp-C35IkXnz.js +5 -0
  18. package/dist/{ts-VhXG2C8W.js → ts-D-E4xqpA.js} +2 -2
  19. package/dist/{versionChecker-Cgv9K3sr.js → versionChecker-YDl8a9il.js} +2 -2
  20. package/dist/{widget-C56RLLYV.js → widget-7j9RrYZR.js} +3 -3
  21. package/dist/{ws-RsKGmEKG.js → ws-Clem1WQ-.js} +2 -2
  22. package/dist/{ws-DeVCKyoE.js → ws-DjyQ20AD.js} +2 -2
  23. package/package.json +1 -1
  24. package/ts/parseCliArgs.spec.ts +27 -33
  25. package/ts/parseCliArgs.ts +42 -28
  26. package/dist/trayApp-DTwdnJdq.js +0 -5
@@ -1,11 +1,11 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-Cgv9K3sr.js";
3
- import "./ts-VhXG2C8W.js";
2
+ import "./versionChecker-YDl8a9il.js";
3
+ import "./ts-D-E4xqpA.js";
4
4
  import "./todoAutomation-BQRW614S.js";
5
5
  import "./JsonlStore-CPGIR0Wy.js";
6
6
  import "./globalPidIndex-Dq4KY2IV.js";
7
7
  import "./pidStore-Cmcc8Oej.js";
8
8
  import "./messageLog-BYFwioFY.js";
9
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-a2RZRGGX.js";
9
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DD6bhkyI.js";
10
10
 
11
11
  export { SUPPORTED_CLIS };
@@ -1,8 +1,8 @@
1
- import { t as CLIS_CONFIG } from "./ts-VhXG2C8W.js";
1
+ import { t as CLIS_CONFIG } from "./ts-D-E4xqpA.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-a2RZRGGX.js.map
8
+ //# sourceMappingURL=SUPPORTED_CLIS-DD6bhkyI.js.map
@@ -3,7 +3,7 @@ import "./globalPidIndex-Dq4KY2IV.js";
3
3
  import "./messageLog-BYFwioFY.js";
4
4
  import "./e2e-CUMZC53I.js";
5
5
  import "./configShared-DtHMBCl7.js";
6
- import { I as resolveOne } from "./subcommands-0PlB-s4J.js";
6
+ import { I as resolveOne } from "./subcommands-CiX7J7hA.js";
7
7
  import "./webrtcLink-CS4D-3G1.js";
8
8
  import "./remotes-Dy4Rg8Yp.js";
9
9
  import { a as startShare } from "./share-B-e_9WBx.js";
@@ -229,4 +229,4 @@ function transformEvent(rawEvent, agentId, forwarded) {
229
229
 
230
230
  //#endregion
231
231
  export { createScopedShare, listShares, revokeAllShares, revokeShare };
232
- //# sourceMappingURL=agentShare-B7Kw7jsl.js.map
232
+ //# sourceMappingURL=agentShare-CoI7IHeq.js.map
@@ -1,5 +1,5 @@
1
1
  import { t as agentYesHome } from "./agentYesHome-CtmsY6I-.js";
2
- import { I as resolveOne } from "./subcommands-0PlB-s4J.js";
2
+ import { I as resolveOne } from "./subcommands-CiX7J7hA.js";
3
3
  import { a as mintCapability, o as parseExpires } from "./callbackCore-Cg3Ye0ZS.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-BSqkv0ID.js");
75
+ const { resolveLocalServeUrl } = await import("./serve-C2mQMjUR.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-4rXZ89hg.js.map
190
+ //# sourceMappingURL=callback-CbdkyTRw.js.map
@@ -3,10 +3,10 @@ import "./globalPidIndex-Dq4KY2IV.js";
3
3
  import "./messageLog-BYFwioFY.js";
4
4
  import "./e2e-CUMZC53I.js";
5
5
  import "./configShared-DtHMBCl7.js";
6
- import "./subcommands-0PlB-s4J.js";
6
+ import "./subcommands-CiX7J7hA.js";
7
7
  import "./webrtcLink-CS4D-3G1.js";
8
8
  import "./remotes-Dy4Rg8Yp.js";
9
9
  import "./callbackCore-Cg3Ye0ZS.js";
10
- import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-4rXZ89hg.js";
10
+ import { i as loadOrCreateCallbackSecret, n as isCallbackRevoked, r as loadCallbackSecretReadOnly, t as cmdCallback } from "./callback-CbdkyTRw.js";
11
11
 
12
12
  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-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-Cgv9K3sr.js";
5
- import { r as getRustBinary } from "./rustBinary-CTrWqcUg.js";
4
+ import { i as versionString, n as displayVersion, t as checkAndAutoUpdate } from "./versionChecker-YDl8a9il.js";
5
+ import { r as getRustBinary } from "./rustBinary-orhBmTNo.js";
6
6
  import { argv } from "process";
7
7
  import { spawn } from "child_process";
8
8
  import ms from "ms";
@@ -16,7 +16,7 @@ import { hideBin } from "yargs/helpers";
16
16
  */
17
17
  function parseCliArgs(argv, supportedClis) {
18
18
  const cliName = invokedCliName(argv);
19
- const parsedArgv = yargs(hideBin(argv)).usage("Usage: $0 [cli] [agent-yes args] [agent-cli args] [--] [prompts...]").example("$0 claude --timeout=30s -- solve all todos in my codebase, commit one by one", "Run Claude with a 30 seconds idle timeout (will type /exit when timeout), everything after `--` will be treated as the prompt").example("$0 claude --stdpush", "Run Claude with external stdin input enabled via --append-prompt").option("robust", {
19
+ const yargsInstance = yargs(hideBin(argv)).usage("Usage: $0 [agent-yes args] [cli] [agent-cli args] [--] [prompts...]").example("$0 --timeout=30s claude -- solve all todos in my codebase, commit one by one", "Run Claude with a 30 seconds idle timeout (will type /exit when timeout), everything after `--` will be treated as the prompt").example("$0 claude --stdpush", "Run Claude with external stdin input enabled via --append-prompt").option("robust", {
20
20
  type: "boolean",
21
21
  default: true,
22
22
  description: "re-spawn Claude with --continue if it crashes, only works for claude yet",
@@ -137,7 +137,12 @@ function parseCliArgs(argv, supportedClis) {
137
137
  type: "boolean",
138
138
  description: "Show version number",
139
139
  alias: "v"
140
- }).parserConfiguration({ "unknown-options-as-args": true }).parseSync();
140
+ }).parserConfiguration({
141
+ "unknown-options-as-args": true,
142
+ "halt-at-non-option": true
143
+ });
144
+ const parsedArgv = yargsInstance.parseSync();
145
+ const knownAyFlags = new Set(Object.entries(yargsInstance.getOptions().alias ?? {}).flatMap(([key, aliases]) => [key, ...aliases]).concat(Object.keys(yargsInstance.getOptions().key ?? {})).map((k) => `--${k}`));
141
146
  const optionalIndex = (e) => 0 <= e ? e : void 0;
142
147
  const rawArgs = argv.slice(2);
143
148
  const cliArgIndex = optionalIndex(rawArgs.indexOf(String(parsedArgv._[0])));
@@ -158,16 +163,18 @@ function parseCliArgs(argv, supportedClis) {
158
163
  const cliArgsForSpawn = (() => {
159
164
  if (parsedArgv._[0] && !cliName) {
160
165
  const allAfterCli = rawArgs.slice((cliArgIndex ?? 0) + 1, dashIndex ?? void 0);
166
+ const misplaced = allAfterCli.filter((arg) => {
167
+ const [flag] = arg.split("=");
168
+ return flag?.startsWith("--") && (knownAyFlags.has(flag) || flag.startsWith("--no-") && knownAyFlags.has(`--${flag.slice(5)}`)) || false;
169
+ });
170
+ if (misplaced.length > 0) {
171
+ const cli = String(parsedArgv._[0]);
172
+ console.warn(`\x1b[33m⚠ ${misplaced.join(", ")}: agent-yes flags must come BEFORE the CLI name to apply (e.g. \`ay ${misplaced[0].split("=")[0]} ${cli}\`). Placed after \`${cli}\` they are passed to ${cli} instead.\x1b[0m`);
173
+ }
161
174
  const result = [];
162
175
  for (let i = 0; i < allAfterCli.length; i++) {
163
176
  const arg = allAfterCli[i];
164
- const [flag] = arg.split("=");
165
- if (flag && yargsConsumed.has(flag) || flag?.startsWith("--no-") && yargsConsumed.has(`--${flag.slice(5)}`)) {
166
- if (!arg.includes("=") && i + 1 < allAfterCli.length) {
167
- const nextArg = allAfterCli[i + 1];
168
- if (nextArg && !nextArg.startsWith("-")) i++;
169
- }
170
- } else if (arg.startsWith("-")) {
177
+ if (arg.startsWith("-")) {
171
178
  result.push(arg);
172
179
  if (!arg.includes("=") && i + 1 < allAfterCli.length) {
173
180
  const nextArg = allAfterCli[i + 1];
@@ -288,7 +295,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
288
295
  const rawArg = process.argv[2];
289
296
  const managerCommands = !invokedCliName(process.argv);
290
297
  const isHelpFlag = rawArg === "-h" || rawArg === "--help";
291
- const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken } = await import("./subcommands-JgqyhIMd.js");
298
+ const { isSubcommand, runSubcommand, cmdHelp, isUnknownManagerToken } = await import("./subcommands-S7uULM_d.js");
292
299
  if (isHelpFlag && process.argv.length === 3) {
293
300
  await cmdHelp(managerCommands);
294
301
  process.exit(0);
@@ -298,7 +305,7 @@ function buildRustArgs(argv, cliFromScript, supportedClis) {
298
305
  process.exit(code ?? 0);
299
306
  }
300
307
  {
301
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-B3WKb4vp.js");
308
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-D1BoydrZ.js");
302
309
  if (isUnknownManagerToken(rawArg, managerCommands, SUPPORTED_CLIS)) {
303
310
  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`);
304
311
  process.exit(1);
@@ -349,7 +356,7 @@ if (config.useRust) {
349
356
  }
350
357
  }
351
358
  if (rustBinary) {
352
- const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-B3WKb4vp.js");
359
+ const { SUPPORTED_CLIS } = await import("./SUPPORTED_CLIS-D1BoydrZ.js");
353
360
  const rustArgs = buildRustArgs(process.argv, config.cli, SUPPORTED_CLIS);
354
361
  if (config.verbose) {
355
362
  console.log(`[rust] Using binary: ${rustBinary}`);
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-Cgv9K3sr.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-VhXG2C8W.js";
2
+ import "./versionChecker-YDl8a9il.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-D-E4xqpA.js";
4
4
  import { _ as isKnownKind, a as renderTree, b as statesOf, c as monitorHint, d as openStore, f as DONE_STATE, g as initialState, h as canTransition, i as renderDigest, l as CycleError, m as ORPHANED_STATE, o as unblockedTasks, p as LIFECYCLES, r as openBlockers, s as describeBlock, t as reconcileTodos, u as TodoStore, v as nextStates, x as removeControlCharacters, y as requiredGate } from "./todoAutomation-BQRW614S.js";
5
5
  import "./JsonlStore-CPGIR0Wy.js";
6
6
  import "./globalPidIndex-Dq4KY2IV.js";
@@ -3,7 +3,7 @@ import "./globalPidIndex-Dq4KY2IV.js";
3
3
  import "./messageLog-BYFwioFY.js";
4
4
  import "./e2e-CUMZC53I.js";
5
5
  import "./configShared-DtHMBCl7.js";
6
- import { $ as liveWatchers, J as appendEvent, N as renderLogTailLines, Q as listInboxParents, X as hostId, Y as gcInboxes, et as readInbox, it as notifyDir, l as deriveLiveState, nt as daemonLockDir, rt as daemonLockOwnerPath, tt as shouldStealLock, v as isPidAlive, w as listRecords } from "./subcommands-0PlB-s4J.js";
6
+ import { $ as liveWatchers, J as appendEvent, N as renderLogTailLines, Q as listInboxParents, X as hostId, Y as gcInboxes, et as readInbox, it as notifyDir, l as deriveLiveState, nt as daemonLockDir, rt as daemonLockOwnerPath, tt as shouldStealLock, v as isPidAlive, w as listRecords } from "./subcommands-CiX7J7hA.js";
7
7
  import "./webrtcLink-CS4D-3G1.js";
8
8
  import "./remotes-Dy4Rg8Yp.js";
9
9
  import { mkdir, readFile, rename, rm, stat, writeFile } from "fs/promises";
@@ -836,4 +836,4 @@ async function ensureDaemon() {
836
836
 
837
837
  //#endregion
838
838
  export { daemonStatus, ensureDaemon, requestDaemonStop, runDaemon };
839
- //# sourceMappingURL=notifyDaemon-Cgt9NOpH.js.map
839
+ //# sourceMappingURL=notifyDaemon-BQ6_UbJS.js.map
@@ -1,4 +1,4 @@
1
- import { r as getInstalledPackage } from "./versionChecker-Cgv9K3sr.js";
1
+ import { r as getInstalledPackage } from "./versionChecker-YDl8a9il.js";
2
2
  import { execFileSync } from "child_process";
3
3
  import { existsSync, mkdirSync, unlinkSync } from "fs";
4
4
  import { chmod, copyFile } from "fs/promises";
@@ -243,4 +243,4 @@ async function getRustBinary(options = {}) {
243
243
 
244
244
  //#endregion
245
245
  export { findTrayLauncher as n, getRustBinary as r, findSpawnHiddenLauncher as t };
246
- //# sourceMappingURL=rustBinary-CTrWqcUg.js.map
246
+ //# sourceMappingURL=rustBinary-orhBmTNo.js.map
@@ -1,12 +1,12 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import "./versionChecker-Cgv9K3sr.js";
3
- import "./ts-VhXG2C8W.js";
2
+ import "./versionChecker-YDl8a9il.js";
3
+ import "./ts-D-E4xqpA.js";
4
4
  import "./todoAutomation-BQRW614S.js";
5
5
  import "./JsonlStore-CPGIR0Wy.js";
6
6
  import "./globalPidIndex-Dq4KY2IV.js";
7
7
  import "./pidStore-Cmcc8Oej.js";
8
8
  import "./messageLog-BYFwioFY.js";
9
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-a2RZRGGX.js";
9
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DD6bhkyI.js";
10
10
  import { f as resolveSpawnCwd } from "./workspaceConfig-Bxuk_MOq.js";
11
11
  import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-vhOBffJ3.js";
12
12
  import { createHash } from "node:crypto";
@@ -153,4 +153,4 @@ async function cmdSchedule(rest) {
153
153
 
154
154
  //#endregion
155
155
  export { cmdSchedule };
156
- //# sourceMappingURL=schedule-CwYc6fmZ.js.map
156
+ //# sourceMappingURL=schedule-BQy6gXYk.js.map
@@ -1,7 +1,7 @@
1
1
  import "./logger-CDIsZ-Pp.js";
2
- import { r as getInstalledPackage } from "./versionChecker-Cgv9K3sr.js";
3
- import { t as findSpawnHiddenLauncher } from "./rustBinary-CTrWqcUg.js";
4
- import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-VhXG2C8W.js";
2
+ import { r as getInstalledPackage } from "./versionChecker-YDl8a9il.js";
3
+ import { t as findSpawnHiddenLauncher } from "./rustBinary-orhBmTNo.js";
4
+ import { c as permissionBadge, i as answerAsk, o as listAsks, u as CLAUDE_SESSION_PIN_ENV } from "./ts-D-E4xqpA.js";
5
5
  import { t as agentYesHome$1 } from "./agentYesHome-CtmsY6I-.js";
6
6
  import { x as removeControlCharacters } from "./todoAutomation-BQRW614S.js";
7
7
  import "./JsonlStore-CPGIR0Wy.js";
@@ -11,17 +11,17 @@ import { r as recordInbox } from "./messageLog-BYFwioFY.js";
11
11
  import { t as pgidForWrapper } from "./reaper-C4BvNylH.js";
12
12
  import "./e2e-CUMZC53I.js";
13
13
  import "./configShared-DtHMBCl7.js";
14
- import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-a2RZRGGX.js";
15
- import { A as readPtysize, F as renderRawLogLines, I as resolveOne, M as recentReadEdges, N as renderLogTailLines, O as readLogForRender, P as renderRawLog, S as isUserTyping, V as snapshotStatus, Z as isTransientLockMkdirError, at as TYPING_BADGE, d as extractBadges, j as recentMessageEdges, k as readNotes, m as extractTaskCounts, p as extractNeedsInput, q as writeToIpc, s as controlCodeFromName, u as deriveLiveStatus, w as listRecords } from "./subcommands-0PlB-s4J.js";
14
+ import { t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-DD6bhkyI.js";
15
+ import { A as readPtysize, F as renderRawLogLines, I as resolveOne, M as recentReadEdges, N as renderLogTailLines, O as readLogForRender, P as renderRawLog, S as isUserTyping, V as snapshotStatus, Z as isTransientLockMkdirError, at as TYPING_BADGE, d as extractBadges, j as recentMessageEdges, k as readNotes, m as extractTaskCounts, p as extractNeedsInput, q as writeToIpc, s as controlCodeFromName, u as deriveLiveStatus, w as listRecords } from "./subcommands-CiX7J7hA.js";
16
16
  import "./webrtcLink-CS4D-3G1.js";
17
17
  import "./remotes-Dy4Rg8Yp.js";
18
18
  import { i as frameVisitorMessage, s as verifyCapability, t as MAX_CALLBACK_MSG_BYTES } from "./callbackCore-Cg3Ye0ZS.js";
19
- import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-4rXZ89hg.js";
19
+ import { n as isCallbackRevoked, r as loadCallbackSecretReadOnly } from "./callback-CbdkyTRw.js";
20
20
  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-Bxuk_MOq.js";
21
21
  import { n as liveEnv, t as ensureNodeRuntime } from "./nodeRuntime-vhOBffJ3.js";
22
- import { i as importProvisionModule } from "./ws-DeVCKyoE.js";
22
+ import { i as importProvisionModule } from "./ws-DjyQ20AD.js";
23
23
  import { r as spawnRejectionReason } from "./spawnGate-D0E1uRP7.js";
24
- import { i as launchTray } from "./trayApp-pNVA4NUf.js";
24
+ import { i as launchTray } from "./trayApp-4sZgxxP-.js";
25
25
  import yargs from "yargs";
26
26
  import { appendFile, mkdir, open, readFile, readdir, rename, rm, stat, unlink, writeFile } from "fs/promises";
27
27
  import { arch, cpus, freemem, homedir, hostname, loadavg, platform, totalmem, uptime, userInfo } from "os";
@@ -2368,7 +2368,7 @@ Options:
2368
2368
  }
2369
2369
  });
2370
2370
  if (req.method === "GET" && p === "/api/ws") {
2371
- const ws = await import("./ws-RsKGmEKG.js");
2371
+ const ws = await import("./ws-Clem1WQ-.js");
2372
2372
  try {
2373
2373
  await ws.loadProvision();
2374
2374
  } catch (e) {
@@ -2388,7 +2388,7 @@ Options:
2388
2388
  if (req.method === "GET" && p === "/api/ws/status") {
2389
2389
  const dirRaw = url.searchParams.get("path");
2390
2390
  if (!dirRaw) return new Response("missing ?path=<workspace dir>", { status: 400 });
2391
- const ws = await import("./ws-RsKGmEKG.js");
2391
+ const ws = await import("./ws-Clem1WQ-.js");
2392
2392
  let prov;
2393
2393
  try {
2394
2394
  prov = await ws.loadProvision();
@@ -3145,7 +3145,7 @@ Options:
3145
3145
  const perm = body.perm ?? "r";
3146
3146
  if (perm !== "r" && perm !== "rw") return new Response(`invalid perm ${perm} (want r or rw)`, { status: 400 });
3147
3147
  try {
3148
- const { createScopedShare } = await import("./agentShare-B7Kw7jsl.js");
3148
+ const { createScopedShare } = await import("./agentShare-CoI7IHeq.js");
3149
3149
  const share = await createScopedShare({
3150
3150
  agent: body.agent,
3151
3151
  perm,
@@ -3160,12 +3160,12 @@ Options:
3160
3160
  }
3161
3161
  }
3162
3162
  if (req.method === "GET" && p === "/api/shares") {
3163
- const { listShares } = await import("./agentShare-B7Kw7jsl.js");
3163
+ const { listShares } = await import("./agentShare-CoI7IHeq.js");
3164
3164
  return Response.json(listShares());
3165
3165
  }
3166
3166
  const revokeM = /^\/api\/share\/([^/]+)$/.exec(p);
3167
3167
  if (req.method === "DELETE" && revokeM) {
3168
- const { revokeShare } = await import("./agentShare-B7Kw7jsl.js");
3168
+ const { revokeShare } = await import("./agentShare-CoI7IHeq.js");
3169
3169
  const ok = revokeShare(decodeURIComponent(revokeM[1]));
3170
3170
  return new Response(ok ? "revoked" : "no such share", { status: ok ? 200 : 404 });
3171
3171
  }
@@ -3467,7 +3467,7 @@ Options:
3467
3467
  const shutdown = (resolve) => {
3468
3468
  if (heartbeat) clearInterval(heartbeat);
3469
3469
  closeShare?.();
3470
- import("./agentShare-B7Kw7jsl.js").then((m) => m.revokeAllShares()).catch(() => {});
3470
+ import("./agentShare-CoI7IHeq.js").then((m) => m.revokeAllShares()).catch(() => {});
3471
3471
  server?.stop();
3472
3472
  Promise.resolve(releaseHostLock?.()).catch(() => {}).then(resolve);
3473
3473
  };
@@ -3480,4 +3480,4 @@ Options:
3480
3480
 
3481
3481
  //#endregion
3482
3482
  export { cmdServe, loadTokenReadOnly, mintScopedTermToken, resolveDaemonHttpBase, resolveLocalServeUrl };
3483
- //# sourceMappingURL=serve-BSqkv0ID.js.map
3483
+ //# sourceMappingURL=serve-C2mQMjUR.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-BSqkv0ID.js");
35
+ const { cmdServe } = await import("./serve-C2mQMjUR.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-GcSqhFuR.js.map
45
+ //# sourceMappingURL=setup-EEF1vfhi.js.map
@@ -1398,35 +1398,35 @@ async function runSubcommand(argv) {
1398
1398
  return cmdCh(rest);
1399
1399
  }
1400
1400
  case "term": {
1401
- const { cmdTerm } = await import("./terminal-D9Ll04hy.js");
1401
+ const { cmdTerm } = await import("./terminal-i7IimD_R.js");
1402
1402
  return cmdTerm(rest);
1403
1403
  }
1404
1404
  case "widget": {
1405
- const { cmdWidget } = await import("./widget-C56RLLYV.js");
1405
+ const { cmdWidget } = await import("./widget-7j9RrYZR.js");
1406
1406
  return cmdWidget(rest);
1407
1407
  }
1408
1408
  case "mint": {
1409
- const { cmdMint } = await import("./widget-C56RLLYV.js");
1409
+ const { cmdMint } = await import("./widget-7j9RrYZR.js");
1410
1410
  return cmdMint(rest);
1411
1411
  }
1412
1412
  case "serve": {
1413
- const { cmdServe } = await import("./serve-BSqkv0ID.js");
1413
+ const { cmdServe } = await import("./serve-C2mQMjUR.js");
1414
1414
  return cmdServe(rest);
1415
1415
  }
1416
1416
  case "tray": {
1417
- const { cmdTray } = await import("./trayApp-DTwdnJdq.js");
1417
+ const { cmdTray } = await import("./trayApp-C35IkXnz.js");
1418
1418
  return cmdTray(rest);
1419
1419
  }
1420
1420
  case "setup": {
1421
- const { cmdSetup } = await import("./setup-GcSqhFuR.js");
1421
+ const { cmdSetup } = await import("./setup-EEF1vfhi.js");
1422
1422
  return cmdSetup(rest);
1423
1423
  }
1424
1424
  case "ws": {
1425
- const { cmdWs } = await import("./ws-RsKGmEKG.js");
1425
+ const { cmdWs } = await import("./ws-Clem1WQ-.js");
1426
1426
  return cmdWs(rest);
1427
1427
  }
1428
1428
  case "schedule": {
1429
- const { cmdSchedule } = await import("./schedule-CwYc6fmZ.js");
1429
+ const { cmdSchedule } = await import("./schedule-BQy6gXYk.js");
1430
1430
  return cmdSchedule(rest);
1431
1431
  }
1432
1432
  case "remote": {
@@ -1438,7 +1438,7 @@ async function runSubcommand(argv) {
1438
1438
  return cmdExpose(rest);
1439
1439
  }
1440
1440
  case "callback": {
1441
- const { cmdCallback } = await import("./callback-D8b4cqDL.js");
1441
+ const { cmdCallback } = await import("./callback-DNI__ASS.js");
1442
1442
  return cmdCallback(rest);
1443
1443
  }
1444
1444
  case "reap":
@@ -3887,7 +3887,7 @@ async function cmdAttach(rest) {
3887
3887
  const winsizeDir = path.join(ayHome, "winsize");
3888
3888
  await mkdir(winsizeDir, { recursive: true });
3889
3889
  const winsizePath = path.join(winsizeDir, String(record.pid));
3890
- const { resolveDaemonHttpBase, loadTokenReadOnly } = await import("./serve-BSqkv0ID.js");
3890
+ const { resolveDaemonHttpBase, loadTokenReadOnly } = await import("./serve-C2mQMjUR.js");
3891
3891
  const daemonBase = await resolveDaemonHttpBase().catch(() => null);
3892
3892
  const daemonToken = daemonBase ? await loadTokenReadOnly().catch(() => null) ?? "" : "";
3893
3893
  const capViewer = `attach:${process.pid}`;
@@ -4597,7 +4597,7 @@ async function cmdNotify(rest) {
4597
4597
  }
4598
4598
  const ensure = async () => {
4599
4599
  if (!argv["ensure-daemon"]) return;
4600
- const { ensureDaemon } = await import("./notifyDaemon-Cgt9NOpH.js");
4600
+ const { ensureDaemon } = await import("./notifyDaemon-BQ6_UbJS.js");
4601
4601
  await ensureDaemon().catch(() => null);
4602
4602
  };
4603
4603
  await heartbeatWatcher(parent, selfStartedAt);
@@ -4671,7 +4671,7 @@ async function cmdNotifyCursor(args) {
4671
4671
  }
4672
4672
  async function cmdNotifyd(rest) {
4673
4673
  const sub = rest[0] ?? "status";
4674
- const daemon = await import("./notifyDaemon-Cgt9NOpH.js");
4674
+ const daemon = await import("./notifyDaemon-BQ6_UbJS.js");
4675
4675
  switch (sub) {
4676
4676
  case "run": return daemon.runDaemon();
4677
4677
  case "once": return daemon.runDaemon({ once: true });
@@ -4698,4 +4698,4 @@ async function cmdNotifyd(rest) {
4698
4698
 
4699
4699
  //#endregion
4700
4700
  export { liveWatchers as $, readPtysize as A, runSubcommand as B, lastStdinAt as C, readAgentPtysize as D, menuSelectKeys as E, renderRawLogLines as F, waitForLogQuiet as G, stdinActivityPath as H, resolveOne as I, appendEvent as J, writeKeysPaced as K, resolveReadWindow as L, recentReadEdges as M, renderLogTailLines as N, readLogForRender as O, renderRawLog as P, listInboxParents as Q, resolveResumeArgs as R, isUserTyping as S, matchKeyword as T, stopTipForCli as U, snapshotStatus as V, submitAndConfirm as W, hostId as X, gcInboxes as Y, isTransientLockMkdirError as Z, isExitRequest as _, backoffWhileTyping as a, TYPING_BADGE as at, isSubcommand as b, cursorAbs as c, extractBadges as d, readInbox as et, extractMenu as f, isAgentStuck as g, finalizedLines as h, TYPING_WINDOW_MS as i, notifyDir as it, recentMessageEdges as j, readNotes as k, deriveLiveState as l, extractTaskCounts as m, MAX_RENDER_BYTES as n, daemonLockDir as nt, cmdHelp as o, extractNeedsInput as p, writeToIpc as q, READ_PAGE_DEFAULT as r, daemonLockOwnerPath as rt, controlCodeFromName as s, GRACEFUL_EXIT_COMMANDS as t, shouldStealLock as tt, deriveLiveStatus as u, isPidAlive as v, listRecords as w, isUnknownManagerToken as x, isSlashCommand as y, restartHintLines as z };
4701
- //# sourceMappingURL=subcommands-0PlB-s4J.js.map
4701
+ //# sourceMappingURL=subcommands-CiX7J7hA.js.map
@@ -3,7 +3,7 @@ import "./globalPidIndex-Dq4KY2IV.js";
3
3
  import "./messageLog-BYFwioFY.js";
4
4
  import "./e2e-CUMZC53I.js";
5
5
  import "./configShared-DtHMBCl7.js";
6
- import { A as readPtysize, B as runSubcommand, C as lastStdinAt, D as readAgentPtysize, E as menuSelectKeys, F as renderRawLogLines, G as waitForLogQuiet, H as stdinActivityPath, I as resolveOne, K as writeKeysPaced, L as resolveReadWindow, M as recentReadEdges, N as renderLogTailLines, O as readLogForRender, P as renderRawLog, R as resolveResumeArgs, S as isUserTyping, T as matchKeyword, U as stopTipForCli, V as snapshotStatus, W as submitAndConfirm, _ as isExitRequest, a as backoffWhileTyping, b as isSubcommand, c as cursorAbs, d as extractBadges, f as extractMenu, g as isAgentStuck, h as finalizedLines, i as TYPING_WINDOW_MS, j as recentMessageEdges, k as readNotes, l as deriveLiveState, m as extractTaskCounts, n as MAX_RENDER_BYTES, o as cmdHelp, p as extractNeedsInput, q as writeToIpc, r as READ_PAGE_DEFAULT, s as controlCodeFromName, t as GRACEFUL_EXIT_COMMANDS, u as deriveLiveStatus, v as isPidAlive, w as listRecords, x as isUnknownManagerToken, y as isSlashCommand, z as restartHintLines } from "./subcommands-0PlB-s4J.js";
6
+ import { A as readPtysize, B as runSubcommand, C as lastStdinAt, D as readAgentPtysize, E as menuSelectKeys, F as renderRawLogLines, G as waitForLogQuiet, H as stdinActivityPath, I as resolveOne, K as writeKeysPaced, L as resolveReadWindow, M as recentReadEdges, N as renderLogTailLines, O as readLogForRender, P as renderRawLog, R as resolveResumeArgs, S as isUserTyping, T as matchKeyword, U as stopTipForCli, V as snapshotStatus, W as submitAndConfirm, _ as isExitRequest, a as backoffWhileTyping, b as isSubcommand, c as cursorAbs, d as extractBadges, f as extractMenu, g as isAgentStuck, h as finalizedLines, i as TYPING_WINDOW_MS, j as recentMessageEdges, k as readNotes, l as deriveLiveState, m as extractTaskCounts, n as MAX_RENDER_BYTES, o as cmdHelp, p as extractNeedsInput, q as writeToIpc, r as READ_PAGE_DEFAULT, s as controlCodeFromName, t as GRACEFUL_EXIT_COMMANDS, u as deriveLiveStatus, v as isPidAlive, w as listRecords, x as isUnknownManagerToken, y as isSlashCommand, z as restartHintLines } from "./subcommands-CiX7J7hA.js";
7
7
  import "./webrtcLink-CS4D-3G1.js";
8
8
  import "./remotes-Dy4Rg8Yp.js";
9
9
 
@@ -98,7 +98,7 @@ async function cmdTermMint(args) {
98
98
  if (flags.ro && flags.interactive) throw new Error("--ro and --interactive are mutually exclusive");
99
99
  const ttlSec = parseTtlSec(typeof flags.ttl === "string" ? flags.ttl : "15m");
100
100
  const canSend = flags.interactive === true;
101
- const { mintScopedTermToken } = await import("./serve-BSqkv0ID.js");
101
+ const { mintScopedTermToken } = await import("./serve-C2mQMjUR.js");
102
102
  const r = await mintScopedTermToken(pid, {
103
103
  ttlSec,
104
104
  canSend
@@ -135,4 +135,4 @@ async function cmdTerm(args) {
135
135
 
136
136
  //#endregion
137
137
  export { cmdTerm };
138
- //# sourceMappingURL=terminal-D9Ll04hy.js.map
138
+ //# sourceMappingURL=terminal-i7IimD_R.js.map
@@ -1,4 +1,4 @@
1
- import { n as findTrayLauncher } from "./rustBinary-CTrWqcUg.js";
1
+ import { n as findTrayLauncher } from "./rustBinary-orhBmTNo.js";
2
2
  import { t as agentYesHome } from "./agentYesHome-CtmsY6I-.js";
3
3
  import { existsSync } from "node:fs";
4
4
  import path from "node:path";
@@ -97,4 +97,4 @@ async function cmdTray(args) {
97
97
 
98
98
  //#endregion
99
99
  export { trayHiddenMarker as a, launchTray as i, hasDesktop as n, isTrayHidden as r, cmdTray as t };
100
- //# sourceMappingURL=trayApp-pNVA4NUf.js.map
100
+ //# sourceMappingURL=trayApp-4sZgxxP-.js.map
@@ -0,0 +1,5 @@
1
+ import "./versionChecker-YDl8a9il.js";
2
+ import "./rustBinary-orhBmTNo.js";
3
+ import { a as trayHiddenMarker, i as launchTray, n as hasDesktop, r as isTrayHidden, t as cmdTray } from "./trayApp-4sZgxxP-.js";
4
+
5
+ export { cmdTray };
@@ -1,6 +1,6 @@
1
1
  import { n as __esmMin, r as __exportAll } from "./chunk-cZBX9HZv.js";
2
2
  import { n as logger, t as addTransport } from "./logger-CDIsZ-Pp.js";
3
- import { r as getInstalledPackage } from "./versionChecker-Cgv9K3sr.js";
3
+ import { r as getInstalledPackage } from "./versionChecker-YDl8a9il.js";
4
4
  import { t as agentYesHome } from "./agentYesHome-CtmsY6I-.js";
5
5
  import { d as openStore, p as LIFECYCLES, x as removeControlCharacters } from "./todoAutomation-BQRW614S.js";
6
6
  import { i as shouldUseLock, r as releaseLock, t as acquireLock } from "./runningLock-DBoONoM-.js";
@@ -2180,4 +2180,4 @@ function sleep(ms) {
2180
2180
 
2181
2181
  //#endregion
2182
2182
  export { hasTodoStore as a, permissionBadge as c, answerAsk as i, AgentContext as l, agentYes as n, listAsks as o, config as r, listAsksForProject as s, CLIS_CONFIG as t, CLAUDE_SESSION_PIN_ENV as u };
2183
- //# sourceMappingURL=ts-VhXG2C8W.js.map
2183
+ //# sourceMappingURL=ts-D-E4xqpA.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.258.2";
10
+ var version = "1.258.3";
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-Cgv9K3sr.js.map
218
+ //# sourceMappingURL=versionChecker-YDl8a9il.js.map
@@ -28,7 +28,7 @@ function parseFlags(args, known) {
28
28
  }
29
29
  /** Resolve the local daemon base URL + token (flags override discovery). */
30
30
  async function daemonTarget(flags) {
31
- const { resolveDaemonHttpBase, loadTokenReadOnly } = await import("./serve-BSqkv0ID.js");
31
+ const { resolveDaemonHttpBase, loadTokenReadOnly } = await import("./serve-C2mQMjUR.js");
32
32
  const base = typeof flags.base === "string" ? flags.base : await resolveDaemonHttpBase();
33
33
  if (!base) throw new Error("no running ay serve daemon found — start `ay serve` or pass --base <url> (e.g. http://127.0.0.1:PORT)");
34
34
  const token = typeof flags.token === "string" ? flags.token : await loadTokenReadOnly() ?? "";
@@ -186,7 +186,7 @@ async function cmdMint(args) {
186
186
  const bad = caps.filter((c) => !KNOWN_CAPS.has(c));
187
187
  if (bad.length) throw new Error(`unknown cap(s): ${bad.join(", ")} (valid: ${[...KNOWN_CAPS].join(", ")})`);
188
188
  const ttlSec = parseTtlSec(typeof flags.ttl === "string" ? flags.ttl : "15m");
189
- const { mintScopedTermToken } = await import("./serve-BSqkv0ID.js");
189
+ const { mintScopedTermToken } = await import("./serve-C2mQMjUR.js");
190
190
  const r = await mintScopedTermToken(target, {
191
191
  ttlSec,
192
192
  caps
@@ -202,4 +202,4 @@ async function cmdMint(args) {
202
202
 
203
203
  //#endregion
204
204
  export { cmdMint, cmdWidget };
205
- //# sourceMappingURL=widget-C56RLLYV.js.map
205
+ //# sourceMappingURL=widget-7j9RrYZR.js.map
@@ -3,9 +3,9 @@ import "./globalPidIndex-Dq4KY2IV.js";
3
3
  import "./messageLog-BYFwioFY.js";
4
4
  import "./e2e-CUMZC53I.js";
5
5
  import "./configShared-DtHMBCl7.js";
6
- import "./subcommands-0PlB-s4J.js";
6
+ import "./subcommands-CiX7J7hA.js";
7
7
  import "./webrtcLink-CS4D-3G1.js";
8
8
  import "./remotes-Dy4Rg8Yp.js";
9
- import { a as isPathInside, c as walkWorkspaces, i as importProvisionModule, l as workspaceStatus, n as cmdWs, o as loadProvision, r as collectWorkspaces, s as resolveOperand, t as WS_JSON_SCHEMA } from "./ws-DeVCKyoE.js";
9
+ import { a as isPathInside, c as walkWorkspaces, i as importProvisionModule, l as workspaceStatus, n as cmdWs, o as loadProvision, r as collectWorkspaces, s as resolveOperand, t as WS_JSON_SCHEMA } from "./ws-DjyQ20AD.js";
10
10
 
11
11
  export { WS_JSON_SCHEMA, cmdWs, collectWorkspaces, isPathInside, loadProvision, workspaceStatus };
@@ -1,4 +1,4 @@
1
- import { w as listRecords } from "./subcommands-0PlB-s4J.js";
1
+ import { w as listRecords } from "./subcommands-CiX7J7hA.js";
2
2
  import { a as getProvisionRoot } from "./workspaceConfig-Bxuk_MOq.js";
3
3
  import { existsSync } from "fs";
4
4
  import { lstat, opendir } from "fs/promises";
@@ -426,4 +426,4 @@ async function cmdWs(args) {
426
426
 
427
427
  //#endregion
428
428
  export { isPathInside as a, walkWorkspaces as c, importProvisionModule as i, workspaceStatus as l, cmdWs as n, loadProvision as o, collectWorkspaces as r, resolveOperand as s, WS_JSON_SCHEMA as t };
429
- //# sourceMappingURL=ws-DeVCKyoE.js.map
429
+ //# sourceMappingURL=ws-DjyQ20AD.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-yes",
3
- "version": "1.258.2",
3
+ "version": "1.258.3",
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",
@@ -430,43 +430,37 @@ describe("CLI argument parsing", () => {
430
430
  expect(result.useStdinAppend).toBe(true);
431
431
  });
432
432
 
433
- it("respects --no-stdpush opt-out on either side of the CLI positional", () => {
434
- // Usage promises `ay [cli] [agent-yes args] [agent-cli args]` agent-yes
435
- // flags are consumed after the CLI name too (#349).
433
+ it("respects --no-stdpush opt-out only when placed before the CLI positional", () => {
434
+ // By design, everything after the CLI name belongs to the wrapped CLI:
435
+ // `ay [agent-yes args] <cli> [agent-cli args]`.
436
436
  const beforeCli = parseCliArgs(["node", "/path/to/ay", "--no-stdpush", "claude"]);
437
437
  const afterCli = parseCliArgs(["node", "/path/to/ay", "claude", "--no-stdpush"]);
438
438
 
439
439
  expect(beforeCli.useStdinAppend).toBe(false);
440
- expect(afterCli.useStdinAppend).toBe(false);
441
- expect(afterCli.cliArgs).not.toContain("--no-stdpush");
442
- });
443
-
444
- it("consumes agent-yes flags after the CLI name and forwards unknown flags (#349)", () => {
445
- // The reporter's table: `ay claude --no-rust` / `--timeout=30s` were
446
- // silently forwarded to the child instead of applying to agent-yes.
447
- const noRust = parseCliArgs(["node", "/path/to/ay", "claude", "--no-rust"]);
448
- expect(noRust.useRust).toBe(false);
449
- expect(noRust.cliArgs).toEqual([]);
450
-
451
- const timeout = parseCliArgs(["node", "/path/to/ay", "claude", "--timeout=30s"]);
452
- expect(timeout.exitOnIdle).toBe(30000);
453
- expect(timeout.cliArgs).toEqual([]);
454
-
455
- // Separate-value form, mixed with prompt words and a child flag.
456
- const mixed = parseCliArgs([
457
- "node",
458
- "/path/to/ay",
459
- "claude",
460
- "--timeout",
461
- "30s",
462
- "--model",
463
- "opus",
464
- "fix",
465
- "bugs",
466
- ]);
467
- expect(mixed.exitOnIdle).toBe(30000);
468
- expect(mixed.cliArgs).toEqual(["--model", "opus"]); // unknown → child
469
- expect(mixed.prompt).toBe("fix bugs");
440
+ expect(afterCli.useStdinAppend).toBe(true);
441
+ expect(afterCli.cliArgs).toContain("--no-stdpush");
442
+ });
443
+
444
+ it("warns when an agent-yes flag is placed after the CLI name, still forwarding it (#349)", () => {
445
+ // `ay claude --timeout=30s` — the timeout belongs before the CLI name; the
446
+ // flag is forwarded to claude by design, but silently losing the timeout is
447
+ // the #349 footgun, so a stderr warning points at the fix.
448
+ const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
449
+ try {
450
+ const result = parseCliArgs(["node", "/path/to/ay", "claude", "--timeout=30s"]);
451
+ expect(result.exitOnIdle).toBe(0); // NOT applied child territory
452
+ expect(result.cliArgs).toContain("--timeout=30s"); // forwarded unchanged
453
+ expect(warn).toHaveBeenCalledWith(expect.stringContaining("--timeout"));
454
+ expect(warn).toHaveBeenCalledWith(expect.stringContaining("BEFORE the CLI name"));
455
+
456
+ warn.mockClear();
457
+ // A flag agent-yes doesn't define stays silent.
458
+ const clean = parseCliArgs(["node", "/path/to/ay", "claude", "--model", "opus"]);
459
+ expect(clean.cliArgs).toEqual(["--model", "opus"]);
460
+ expect(warn).not.toHaveBeenCalled();
461
+ } finally {
462
+ warn.mockRestore();
463
+ }
470
464
  });
471
465
 
472
466
  it("consumes --attach as an agent-yes flag before the CLI positional", () => {
@@ -12,10 +12,13 @@ export function parseCliArgs(argv: string[], supportedClis?: readonly string[])
12
12
  const cliName = invokedCliName(argv);
13
13
 
14
14
  // Parse args with yargs (same logic as cli.ts:16-73)
15
- const parsedArgv = yargs(hideBin(argv))
16
- .usage("Usage: $0 [cli] [agent-yes args] [agent-cli args] [--] [prompts...]")
15
+ const yargsInstance = yargs(hideBin(argv))
16
+ // Everything after the CLI name is the wrapped CLI's territory — by
17
+ // design, agent-yes never claims flags there (so `ay claude -c` reaches
18
+ // claude). agent-yes's own flags go BEFORE the CLI name.
19
+ .usage("Usage: $0 [agent-yes args] [cli] [agent-cli args] [--] [prompts...]")
17
20
  .example(
18
- "$0 claude --timeout=30s -- solve all todos in my codebase, commit one by one",
21
+ "$0 --timeout=30s claude -- solve all todos in my codebase, commit one by one",
19
22
  "Run Claude with a 30 seconds idle timeout (will type /exit when timeout), everything after `--` will be treated as the prompt",
20
23
  )
21
24
  .example(
@@ -184,15 +187,21 @@ export function parseCliArgs(argv: string[], supportedClis?: readonly string[])
184
187
  alias: "v",
185
188
  })
186
189
  .parserConfiguration({
187
- // Unknown options (the wrapped CLI's flags, e.g. --model) stay in `_`
188
- // untouched and are forwarded to the child below. Known agent-yes
189
- // options are consumed WHEREVER they appear — the usage string promises
190
- // `$0 [cli] [agent-yes args] [agent-cli args]`, and with the former
191
- // "halt-at-non-option" everything after the cli positional was skipped,
192
- // so `ay claude --timeout=30s` silently dropped the timeout (#349).
193
190
  "unknown-options-as-args": true,
194
- })
195
- .parseSync();
191
+ "halt-at-non-option": true,
192
+ });
193
+ const parsedArgv = yargsInstance.parseSync();
194
+
195
+ // Every option name agent-yes defines (canonical + aliases), as "--flag"
196
+ // strings — used only for the misplaced-flag warning below. Unlike
197
+ // `yargsConsumed`, this includes no-default options (--timeout, --prompt…)
198
+ // whether or not they were passed.
199
+ const knownAyFlags = new Set<string>(
200
+ Object.entries(yargsInstance.getOptions().alias ?? {})
201
+ .flatMap(([key, aliases]) => [key, ...(aliases as string[])])
202
+ .concat(Object.keys(yargsInstance.getOptions().key ?? {}))
203
+ .map((k) => `--${k}`),
204
+ );
196
205
 
197
206
  // Extract cli args and dash prompt (same logic as cli.ts:76-91)
198
207
  const optionalIndex = (e: number) => (0 <= e ? e : undefined);
@@ -222,27 +231,32 @@ export function parseCliArgs(argv: string[], supportedClis?: readonly string[])
222
231
 
223
232
  const cliArgsForSpawn = (() => {
224
233
  if (parsedArgv._[0] && !cliName) {
225
- // Explicit CLI name provided as positional arg — flags agent-yes itself
226
- // consumed are filtered out (same rule as the cli-bound branch below),
227
- // remaining flags go to the child, bare words become prompt text.
234
+ // Explicit CLI name provided as positional arg — separate flags from bare
235
+ // words. Every flag here is forwarded to the wrapped CLI BY DESIGN (its
236
+ // flags must stay reachable), but a flag that agent-yes also defines is a
237
+ // likely misplacement — `ay claude --timeout=30s` would silently drop the
238
+ // timeout (#349) — so warn on those without changing what's forwarded.
228
239
  const allAfterCli = rawArgs.slice((cliArgIndex ?? 0) + 1, dashIndex ?? undefined);
240
+ const misplaced = allAfterCli.filter((arg) => {
241
+ const [flag] = arg.split("=");
242
+ return (
243
+ (flag?.startsWith("--") &&
244
+ (knownAyFlags.has(flag) ||
245
+ (flag.startsWith("--no-") && knownAyFlags.has(`--${flag.slice(5)}`)))) ||
246
+ false
247
+ );
248
+ });
249
+ if (misplaced.length > 0) {
250
+ const cli = String(parsedArgv._[0]);
251
+ console.warn(
252
+ `\x1b[33m⚠ ${misplaced.join(", ")}: agent-yes flags must come BEFORE the CLI name to apply ` +
253
+ `(e.g. \`ay ${misplaced[0]!.split("=")[0]} ${cli}\`). Placed after \`${cli}\` they are passed to ${cli} instead.\x1b[0m`,
254
+ );
255
+ }
229
256
  const result: string[] = [];
230
257
  for (let i = 0; i < allAfterCli.length; i++) {
231
258
  const arg = allAfterCli[i]!;
232
- const [flag] = arg.split("=");
233
- // Check both the flag itself and its --no- negation (yargs stores --no-x as key "x")
234
- const isConsumed =
235
- (flag && yargsConsumed.has(flag)) ||
236
- (flag?.startsWith("--no-") && yargsConsumed.has(`--${flag.slice(5)}`));
237
- if (isConsumed) {
238
- // Skip consumed flag and its value if separate
239
- if (!arg.includes("=") && i + 1 < allAfterCli.length) {
240
- const nextArg = allAfterCli[i + 1];
241
- if (nextArg && !nextArg.startsWith("-")) {
242
- i++; // Skip value
243
- }
244
- }
245
- } else if (arg.startsWith("-")) {
259
+ if (arg.startsWith("-")) {
246
260
  result.push(arg);
247
261
  // Consume the next arg as the flag's value if separate (--flag value)
248
262
  if (!arg.includes("=") && i + 1 < allAfterCli.length) {
@@ -1,5 +0,0 @@
1
- import "./versionChecker-Cgv9K3sr.js";
2
- import "./rustBinary-CTrWqcUg.js";
3
- import { a as trayHiddenMarker, i as launchTray, n as hasDesktop, r as isTrayHidden, t as cmdTray } from "./trayApp-pNVA4NUf.js";
4
-
5
- export { cmdTray };