agent-yes 1.63.0 → 1.65.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Agent-Yes! for Claude/Codex/Gemini/Cursor/Copilot/Qwen/Auggie
2
2
 
3
- A wrapper tool that automates interactions with various AI CLI tools by automatically handling common prompts and responses. Originally designed for Claude CLI, now supports multiple AI coding assistants.
3
+ A wrapper tool that automates interactions with various AI CLI tools by automatically handling common prompts and responses. Originally designed for Claude CLI, now supports multiple AI coding assistants. Rewritten in Rust for improved performance and reliability.
4
4
 
5
5
  ⚠️ **Important Security Warning**: Only run this on trusted repositories. This tool automatically responds to prompts and can execute commands without user confirmation. Be aware of potential prompt injection attacks where malicious code or instructions could be embedded in files or user inputs to manipulate the automated responses.
6
6
 
@@ -950,19 +950,13 @@ var ReadyManager = class {
950
950
  async function sendEnter(context, waitms = 1e3) {
951
951
  const st = Date.now();
952
952
  await context.idleWaiter.wait(waitms);
953
- const et = Date.now();
954
- logger.debug(`sendingEnter| idleWaiter.wait(${String(waitms)}) took ${String(et - st)}ms`);
953
+ logger.debug(`sendEnter| idleWait took ${String(Date.now() - st)}ms`);
955
954
  context.nextStdout.unready();
956
955
  context.shell.write("\r");
957
- logger.debug(`enterSent| idleWaiter.wait(${String(waitms)}) took ${String(et - st)}ms`);
958
- await Promise.race([context.nextStdout.wait(), new Promise((resolve) => setTimeout(() => {
959
- if (!context.nextStdout.isReady) context.shell.write("\r");
960
- resolve();
961
- }, 1e3))]);
962
- await Promise.race([context.nextStdout.wait(), new Promise((resolve) => setTimeout(() => {
956
+ for (const ms of [1e3, 3e3]) await Promise.race([context.nextStdout.wait(), new Promise((resolve) => setTimeout(() => {
963
957
  if (!context.nextStdout.isReady) context.shell.write("\r");
964
958
  resolve();
965
- }, 3e3))]);
959
+ }, ms))]);
966
960
  }
967
961
  /**
968
962
  * Send a message to the shell
@@ -1065,7 +1059,7 @@ function tryCatch(catchFn, fn) {
1065
1059
  //#endregion
1066
1060
  //#region package.json
1067
1061
  var name = "agent-yes";
1068
- var version = "1.63.0";
1062
+ var version = "1.65.0";
1069
1063
 
1070
1064
  //#endregion
1071
1065
  //#region ts/pty-fix.ts
@@ -1642,6 +1636,12 @@ async function agentYes({ cli, cliArgs = [], prompt, robust = true, cwd, env, ex
1642
1636
  install,
1643
1637
  ptyOptions
1644
1638
  });
1639
+ function onData(data) {
1640
+ const currentPid = shell.pid;
1641
+ outputWriter.write(data);
1642
+ globalAgentRegistry.appendStdout(currentPid, data);
1643
+ }
1644
+ shell.onData(onData);
1645
1645
  try {
1646
1646
  await pidStore.registerProcess({
1647
1647
  pid: shell.pid,
@@ -1689,12 +1689,6 @@ async function agentYes({ cli, cliArgs = [], prompt, robust = true, cwd, env, ex
1689
1689
  if (!ctx.stdinFirstReady.isReady) ctx.stdinFirstReady.ready();
1690
1690
  });
1691
1691
  const pendingExitCode = Promise.withResolvers();
1692
- function onData(data) {
1693
- const currentPid = shell.pid;
1694
- outputWriter.write(data);
1695
- globalAgentRegistry.appendStdout(currentPid, data);
1696
- }
1697
- shell.onData(onData);
1698
1692
  shell.onExit(async function onExit({ exitCode }) {
1699
1693
  const exitedPid = shell.pid;
1700
1694
  globalAgentRegistry.unregister(exitedPid);
@@ -2118,4 +2112,4 @@ const SUPPORTED_CLIS = Object.keys(CLIS_CONFIG);
2118
2112
 
2119
2113
  //#endregion
2120
2114
  export { AgentContext as a, PidStore as c, config as i, removeControlCharacters as l, CLIS_CONFIG as n, name as o, agentYes as r, version as s, SUPPORTED_CLIS as t };
2121
- //# sourceMappingURL=SUPPORTED_CLIS-BFlBIzu3.js.map
2115
+ //# sourceMappingURL=SUPPORTED_CLIS-CWEfLDO6.js.map
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bun
2
- import { c as PidStore, o as name, s as version, t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-BFlBIzu3.js";
2
+ import { c as PidStore, o as name, s as version, t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-CWEfLDO6.js";
3
3
  import { t as logger } from "./logger-CX77vJDA.js";
4
4
  import { argv } from "process";
5
5
  import { spawn } from "child_process";
@@ -83,10 +83,15 @@ function parseCliArgs(argv) {
83
83
  description: "Control auto-yes mode: 'yes' to auto-approve prompts (default), 'no' to start in manual mode. Press Ctrl+Y during the session to toggle at any time.",
84
84
  choices: ["yes", "no"],
85
85
  default: "yes"
86
+ }).option("yes", {
87
+ type: "boolean",
88
+ description: "Pass --dangerously-skip-permissions to the CLI (claude shortcut)",
89
+ default: false,
90
+ alias: "y"
86
91
  }).option("rust", {
87
92
  type: "boolean",
88
- description: "Use the Rust implementation instead of TypeScript",
89
- default: false
93
+ description: "Use the Rust implementation (enabled by default, use --no-rust for TypeScript)",
94
+ default: true
90
95
  }).option("swarm", {
91
96
  type: "string",
92
97
  description: `Enable swarm mode for multi-agent P2P networking (requires --rust).
@@ -140,6 +145,7 @@ function parseCliArgs(argv) {
140
145
  if (key === "robust") yargsConsumed.add("-r");
141
146
  if (key === "idle") yargsConsumed.add("-i");
142
147
  if (key === "exitOnIdle") yargsConsumed.add("-e");
148
+ if (key === "yes") yargsConsumed.add("-y");
143
149
  if (key === "continue") yargsConsumed.add("-c");
144
150
  }
145
151
  });
@@ -169,7 +175,7 @@ function parseCliArgs(argv) {
169
175
  cwd: process.cwd(),
170
176
  env: process.env,
171
177
  cli: cliName || parsedArgv.cli || (dashIndex !== 0 ? parsedArgv._[0]?.toString()?.replace?.(/-yes$/, "") : void 0),
172
- cliArgs: cliArgsForSpawn,
178
+ cliArgs: [...cliArgsForSpawn, ...parsedArgv.yes ? ["--dangerously-skip-permissions"] : []],
173
179
  prompt: [parsedArgv.prompt, dashPrompt].filter(Boolean).join(" ") || void 0,
174
180
  install: parsedArgv.install,
175
181
  exitOnIdle: Number((parsedArgv.timeout || parsedArgv.idle || parsedArgv.exitOnIdle)?.replace(/.*/, (e) => String(ms(e))) || 0),
@@ -271,10 +277,11 @@ function getBinDir() {
271
277
  */
272
278
  function findRustBinary(verbose = false) {
273
279
  const binaryName = getBinaryName();
280
+ const ext = process.platform === "win32" ? ".exe" : "";
274
281
  const searchPaths = [
282
+ path.resolve(import.meta.dirname ?? import.meta.dir, `../rs/target/release/agent-yes${ext}`),
283
+ path.resolve(import.meta.dirname ?? import.meta.dir, `../rs/target/debug/agent-yes${ext}`),
275
284
  path.join(getBinDir(), binaryName),
276
- path.resolve(import.meta.dirname ?? import.meta.dir, "../rs/target/release/agent-yes"),
277
- path.resolve(import.meta.dirname ?? import.meta.dir, "../rs/target/debug/agent-yes"),
278
285
  path.join(getBinDir(), binaryName)
279
286
  ];
280
287
  if (verbose) {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as AgentContext, i as config, l as removeControlCharacters, n as CLIS_CONFIG, r as agentYes } from "./SUPPORTED_CLIS-BFlBIzu3.js";
1
+ import { a as AgentContext, i as config, l as removeControlCharacters, n as CLIS_CONFIG, r as agentYes } from "./SUPPORTED_CLIS-CWEfLDO6.js";
2
2
  import "./logger-CX77vJDA.js";
3
3
 
4
4
  export { AgentContext, CLIS_CONFIG, config, agentYes as default, removeControlCharacters };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-yes",
3
- "version": "1.63.0",
3
+ "version": "1.65.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/index.ts CHANGED
@@ -327,6 +327,15 @@ export default async function agentYes({
327
327
  ptyOptions,
328
328
  });
329
329
 
330
+ // Attach data handler IMMEDIATELY after spawn to avoid losing early PTY output.
331
+ // node-pty emits 'data' events eagerly — if no listener is attached, events are lost.
332
+ function onData(data: string) {
333
+ const currentPid = shell.pid;
334
+ outputWriter.write(data);
335
+ globalAgentRegistry.appendStdout(currentPid, data);
336
+ }
337
+ shell.onData(onData);
338
+
330
339
  // Register process in pidStore (non-blocking - failures should not prevent agent from running)
331
340
  try {
332
341
  await pidStore.registerProcess({ pid: shell.pid, cli, args: cliArgs, prompt, cwd: workingDir });
@@ -386,16 +395,6 @@ export default async function agentYes({
386
395
 
387
396
  const pendingExitCode = Promise.withResolvers<number | null>();
388
397
 
389
- function onData(data: string) {
390
- const currentPid = shell.pid; // Capture PID before any potential shell reassignment
391
- // Write eagerly — TerminalRenderStream never exerts backpressure,
392
- // so the PTY is always drained and the child process never blocks.
393
- outputWriter.write(data);
394
- // append to agent registry for MCP server
395
- globalAgentRegistry.appendStdout(currentPid, data);
396
- }
397
-
398
- shell.onData(onData);
399
398
  shell.onExit(async function onExit({ exitCode }) {
400
399
  const exitedPid = shell.pid; // Capture PID immediately before any shell reassignment
401
400
  // Unregister from agent registry
@@ -119,10 +119,16 @@ export function parseCliArgs(argv: string[]) {
119
119
  choices: ["yes", "no"] as const,
120
120
  default: "yes",
121
121
  })
122
- .option("rust", {
122
+ .option("yes", {
123
123
  type: "boolean",
124
- description: "Use the Rust implementation instead of TypeScript",
124
+ description: "Pass --dangerously-skip-permissions to the CLI (claude shortcut)",
125
125
  default: false,
126
+ alias: "y",
127
+ })
128
+ .option("rust", {
129
+ type: "boolean",
130
+ description: "Use the Rust implementation (enabled by default, use --no-rust for TypeScript)",
131
+ default: true,
126
132
  })
127
133
  .option("swarm", {
128
134
  type: "string",
@@ -194,6 +200,7 @@ export function parseCliArgs(argv: string[]) {
194
200
  if (key === "robust") yargsConsumed.add("-r");
195
201
  if (key === "idle") yargsConsumed.add("-i");
196
202
  if (key === "exitOnIdle") yargsConsumed.add("-e");
203
+ if (key === "yes") yargsConsumed.add("-y");
197
204
  if (key === "continue") yargsConsumed.add("-c");
198
205
  }
199
206
  });
@@ -248,7 +255,7 @@ export function parseCliArgs(argv: string[]) {
248
255
  (dashIndex !== 0
249
256
  ? parsedArgv._[0]?.toString()?.replace?.(/-yes$/, "")
250
257
  : undefined)) as (typeof SUPPORTED_CLIS)[number],
251
- cliArgs: cliArgsForSpawn,
258
+ cliArgs: [...cliArgsForSpawn, ...(parsedArgv.yes ? ["--dangerously-skip-permissions"] : [])],
252
259
  prompt: [parsedArgv.prompt, dashPrompt].filter(Boolean).join(" ") || undefined,
253
260
  install: parsedArgv.install,
254
261
  exitOnIdle: Number(
package/ts/rustBinary.ts CHANGED
@@ -61,13 +61,14 @@ export function getBinDir(): string {
61
61
  export function findRustBinary(verbose = false): string | undefined {
62
62
  const binaryName = getBinaryName();
63
63
 
64
+ const ext = process.platform === "win32" ? ".exe" : "";
64
65
  const searchPaths = [
65
- // 1. Check in npm package bin directory
66
- path.join(getBinDir(), binaryName),
66
+ // 1. Check relative to this script (in the repo during development)
67
+ path.resolve(import.meta.dirname ?? import.meta.dir, `../rs/target/release/agent-yes${ext}`),
68
+ path.resolve(import.meta.dirname ?? import.meta.dir, `../rs/target/debug/agent-yes${ext}`),
67
69
 
68
- // 2. Check relative to this script (in the repo during development)
69
- path.resolve(import.meta.dirname ?? import.meta.dir, "../rs/target/release/agent-yes"),
70
- path.resolve(import.meta.dirname ?? import.meta.dir, "../rs/target/debug/agent-yes"),
70
+ // 2. Check in npm package bin directory
71
+ path.join(getBinDir(), binaryName),
71
72
 
72
73
  // 3. Check in user's cache directory
73
74
  path.join(getBinDir(), binaryName),