agent-yes 1.66.0 → 1.67.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.
@@ -1059,7 +1059,7 @@ function tryCatch(catchFn, fn) {
1059
1059
  //#endregion
1060
1060
  //#region package.json
1061
1061
  var name = "agent-yes";
1062
- var version = "1.66.0";
1062
+ var version = "1.67.0";
1063
1063
 
1064
1064
  //#endregion
1065
1065
  //#region ts/pty-fix.ts
@@ -1516,7 +1516,7 @@ const CLIS_CONFIG = config.clis;
1516
1516
  * });
1517
1517
  * ```
1518
1518
  */
1519
- async function agentYes({ cli, cliArgs = [], prompt, robust = true, cwd, env, exitOnIdle, logFile, removeControlCharactersFromStdout = false, verbose = false, queue = false, install = false, resume = false, useSkills = false, useStdinAppend = false, autoYes = true }) {
1519
+ async function agentYes({ cli, cliArgs = [], prompt, robust = true, cwd, env, exitOnIdle, logFile, removeControlCharactersFromStdout = false, verbose = false, queue = false, install = false, resume = false, useSkills = false, useStdinAppend = false, autoYes = true, idleAction }) {
1520
1520
  if (!cli) throw new Error(`cli is required`);
1521
1521
  const conf = CLIS_CONFIG[cli] || DIE(`Unsupported cli tool: ${cli}, current process.argv: ${process.argv.join(" ")}`);
1522
1522
  const workingDir = cwd ?? process.cwd();
@@ -1908,16 +1908,26 @@ async function agentYes({ cli, cliArgs = [], prompt, robust = true, cwd, env, ex
1908
1908
  }, 800);
1909
1909
  const cleanupHeartbeat = () => clearInterval(heartbeatInterval);
1910
1910
  shell.onExit(cleanupHeartbeat);
1911
- if (exitOnIdle) ctx.idleWaiter.wait(exitOnIdle).then(async () => {
1912
- await pidStore.updateStatus(shell.pid, "idle").catch(() => null);
1913
- if (isStillWorkingQ()) {
1914
- logger.warn(`[${cli}-yes] ${cli} is idle, but seems still working, not exiting yet`);
1915
- return;
1911
+ if (exitOnIdle) (async () => {
1912
+ while (true) {
1913
+ await ctx.idleWaiter.wait(exitOnIdle);
1914
+ await pidStore.updateStatus(shell.pid, "idle").catch(() => null);
1915
+ if (isStillWorkingQ()) {
1916
+ logger.warn(`[${cli}-yes] ${cli} is idle, but seems still working, not exiting yet`);
1917
+ continue;
1918
+ }
1919
+ if (idleAction) {
1920
+ logger.info(`[${cli}-yes] ${cli} is idle, performing idle action: ${idleAction}`);
1921
+ notifyWebhook("IDLE", `action=${idleAction}`, workingDir).catch(() => null);
1922
+ await sendMessage(ctx.messageContext, idleAction);
1923
+ continue;
1924
+ }
1925
+ logger.info(`[${cli}-yes] ${cli} is idle, exiting...`);
1926
+ notifyWebhook("IDLE", "", workingDir).catch(() => null);
1927
+ await exitAgent();
1928
+ break;
1916
1929
  }
1917
- logger.info(`[${cli}-yes] ${cli} is idle, exiting...`);
1918
- notifyWebhook("IDLE", "", workingDir).catch(() => null);
1919
- await exitAgent();
1920
- });
1930
+ })();
1921
1931
  const stdinStream = new ReadableStream({
1922
1932
  start(controller) {
1923
1933
  process.stdin.resume();
@@ -2129,4 +2139,4 @@ const SUPPORTED_CLIS = Object.keys(CLIS_CONFIG);
2129
2139
 
2130
2140
  //#endregion
2131
2141
  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 };
2132
- //# sourceMappingURL=SUPPORTED_CLIS-DbTReaSd.js.map
2142
+ //# sourceMappingURL=SUPPORTED_CLIS-CmSMCHW2.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-DbTReaSd.js";
2
+ import { c as PidStore, o as name, s as version, t as SUPPORTED_CLIS } from "./SUPPORTED_CLIS-CmSMCHW2.js";
3
3
  import { t as logger } from "./logger-CX77vJDA.js";
4
4
  import { argv } from "process";
5
5
  import { spawn } from "child_process";
@@ -56,7 +56,8 @@ function parseCliArgs(argv) {
56
56
  alias: "i"
57
57
  }).option("idle-action", {
58
58
  type: "string",
59
- description: "Idle action to perform when idle time is reached, e.g., \"/exit\" or \"check TODO.md\""
59
+ description: "Idle action to perform when idle time is reached, e.g., \"/exit\" or \"check TODO.md\"",
60
+ alias: "ia"
60
61
  }).option("queue", {
61
62
  type: "boolean",
62
63
  description: "Queue Agent Commands when spawning multiple agents in the same directory/repo, can be disabled with --no-queue",
@@ -189,6 +190,7 @@ function parseCliArgs(argv) {
189
190
  useStdinAppend: Boolean(parsedArgv.stdpush || parsedArgv.ipc || parsedArgv.fifo),
190
191
  showVersion: parsedArgv.version,
191
192
  autoYes: parsedArgv.auto !== "no",
193
+ idleAction: parsedArgv.idleAction,
192
194
  useRust: parsedArgv.rust,
193
195
  swarm: parsedArgv.swarm ?? (parsedArgv.experimentalSwarm ? parsedArgv.swarmTopic : void 0),
194
196
  experimentalSwarm: parsedArgv.experimentalSwarm,
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-DbTReaSd.js";
1
+ import { a as AgentContext, i as config, l as removeControlCharacters, n as CLIS_CONFIG, r as agentYes } from "./SUPPORTED_CLIS-CmSMCHW2.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.66.0",
3
+ "version": "1.67.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
@@ -119,6 +119,7 @@ export default async function agentYes({
119
119
  useSkills = false,
120
120
  useStdinAppend = false,
121
121
  autoYes = true,
122
+ idleAction,
122
123
  }: {
123
124
  cli: SUPPORTED_CLIS;
124
125
  cliArgs?: string[];
@@ -136,6 +137,7 @@ export default async function agentYes({
136
137
  useSkills?: boolean; // if true, prepend SKILL.md header to the prompt for non-Claude agents
137
138
  useStdinAppend?: boolean; // if true, enable FIFO input stream on Linux, for additional stdin input
138
139
  autoYes?: boolean; // if true, auto-yes is enabled (default), toggle with Ctrl+Y during session
140
+ idleAction?: string; // if set, type this message when idle instead of exiting
139
141
  }) {
140
142
  if (!cli) throw new Error(`cli is required`);
141
143
  const conf =
@@ -689,17 +691,26 @@ export default async function agentYes({
689
691
  shell.onExit(cleanupHeartbeat);
690
692
 
691
693
  if (exitOnIdle)
692
- ctx.idleWaiter.wait(exitOnIdle).then(async () => {
693
- await pidStore.updateStatus(shell.pid, "idle").catch(() => null);
694
- if (isStillWorkingQ()) {
695
- logger.warn(`[${cli}-yes] ${cli} is idle, but seems still working, not exiting yet`);
696
- return;
694
+ (async () => {
695
+ while (true) {
696
+ await ctx.idleWaiter.wait(exitOnIdle);
697
+ await pidStore.updateStatus(shell.pid, "idle").catch(() => null);
698
+ if (isStillWorkingQ()) {
699
+ logger.warn(`[${cli}-yes] ${cli} is idle, but seems still working, not exiting yet`);
700
+ continue;
701
+ }
702
+ if (idleAction) {
703
+ logger.info(`[${cli}-yes] ${cli} is idle, performing idle action: ${idleAction}`);
704
+ notifyWebhook("IDLE", `action=${idleAction}`, workingDir).catch(() => null);
705
+ await sendMessage(ctx.messageContext, idleAction);
706
+ continue;
707
+ }
708
+ logger.info(`[${cli}-yes] ${cli} is idle, exiting...`);
709
+ notifyWebhook("IDLE", "", workingDir).catch(() => null);
710
+ await exitAgent();
711
+ break;
697
712
  }
698
-
699
- logger.info(`[${cli}-yes] ${cli} is idle, exiting...`);
700
- notifyWebhook("IDLE", "", workingDir).catch(() => null);
701
- await exitAgent();
702
- });
713
+ })();
703
714
 
704
715
  // Message streaming
705
716
 
@@ -83,6 +83,7 @@ export function parseCliArgs(argv: string[]) {
83
83
  type: "string",
84
84
  description:
85
85
  'Idle action to perform when idle time is reached, e.g., "/exit" or "check TODO.md"',
86
+ alias: "ia",
86
87
  })
87
88
  .option("queue", {
88
89
  type: "boolean",
@@ -273,6 +274,7 @@ export function parseCliArgs(argv: string[]) {
273
274
  useStdinAppend: Boolean(parsedArgv.stdpush || parsedArgv.ipc || parsedArgv.fifo), // Support --stdpush, --ipc, and --fifo (backward compatibility)
274
275
  showVersion: parsedArgv.version,
275
276
  autoYes: parsedArgv.auto !== "no", // auto-yes enabled by default, disabled with --auto=no
277
+ idleAction: parsedArgv.idleAction as string | undefined,
276
278
  useRust: parsedArgv.rust,
277
279
  // New unified --swarm flag (takes precedence over deprecated flags)
278
280
  swarm: parsedArgv.swarm ?? (parsedArgv.experimentalSwarm ? parsedArgv.swarmTopic : undefined),