agent-yes 1.44.6 → 1.44.8

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/dist/cli.js CHANGED
@@ -21942,6 +21942,7 @@ async function agentYes2({
21942
21942
  await pidStore.init();
21943
21943
  const stdinReady = new ReadyManager;
21944
21944
  const stdinFirstReady = new ReadyManager;
21945
+ let userSentCtrlC = false;
21945
21946
  if (conf.ready && conf.ready.length === 0) {
21946
21947
  stdinReady.ready();
21947
21948
  stdinFirstReady.ready();
@@ -22120,7 +22121,8 @@ ${prompt}` : prefix;
22120
22121
  const exitedPid = shell.pid;
22121
22122
  globalAgentRegistry.unregister(exitedPid);
22122
22123
  ctx.stdinReady.unready();
22123
- const agentCrashed = exitCode2 !== 0;
22124
+ const intentionalExit = exitCode2 === 130 || exitCode2 === 143 || userSentCtrlC;
22125
+ const agentCrashed = exitCode2 !== 0 && !intentionalExit;
22124
22126
  if (ctx.shouldRestartWithoutContinue) {
22125
22127
  try {
22126
22128
  await pidStore.updateStatus(exitedPid, "exited", {
@@ -22192,7 +22194,7 @@ ${prompt}` : prefix;
22192
22194
  } catch (error) {
22193
22195
  logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
22194
22196
  }
22195
- logger.info(`${cli} crashed, restarting...`);
22197
+ logger.info(`${cli} crashed (exit code: ${exitCode2}), restarting...`);
22196
22198
  let restoreArgs = conf.restoreArgs;
22197
22199
  if (cli === "codex") {
22198
22200
  const storedSessionId = await getSessionForCwd(workingDir);
@@ -22364,6 +22366,12 @@ ${prompt}` : prefix;
22364
22366
  aborted2 = true;
22365
22367
  return str;
22366
22368
  }
22369
+ if (str === CTRL_C) {
22370
+ userSentCtrlC = true;
22371
+ setTimeout(() => {
22372
+ userSentCtrlC = false;
22373
+ }, 2000);
22374
+ }
22367
22375
  return str;
22368
22376
  }).onStart(async function promptOnStart() {
22369
22377
  logger.debug("Sending prompt message: " + JSON.stringify(prompt));
@@ -22574,6 +22582,7 @@ async function agentYes({
22574
22582
  await pidStore.init();
22575
22583
  const stdinReady = new ReadyManager;
22576
22584
  const stdinFirstReady = new ReadyManager;
22585
+ let userSentCtrlC = false;
22577
22586
  if (conf.ready && conf.ready.length === 0) {
22578
22587
  stdinReady.ready();
22579
22588
  stdinFirstReady.ready();
@@ -22752,7 +22761,8 @@ ${prompt}` : prefix;
22752
22761
  const exitedPid = shell.pid;
22753
22762
  globalAgentRegistry.unregister(exitedPid);
22754
22763
  ctx.stdinReady.unready();
22755
- const agentCrashed = exitCode2 !== 0;
22764
+ const intentionalExit = exitCode2 === 130 || exitCode2 === 143 || userSentCtrlC;
22765
+ const agentCrashed = exitCode2 !== 0 && !intentionalExit;
22756
22766
  if (ctx.shouldRestartWithoutContinue) {
22757
22767
  try {
22758
22768
  await pidStore.updateStatus(exitedPid, "exited", {
@@ -22824,7 +22834,7 @@ ${prompt}` : prefix;
22824
22834
  } catch (error) {
22825
22835
  logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
22826
22836
  }
22827
- logger.info(`${cli} crashed, restarting...`);
22837
+ logger.info(`${cli} crashed (exit code: ${exitCode2}), restarting...`);
22828
22838
  let restoreArgs = conf.restoreArgs;
22829
22839
  if (cli === "codex") {
22830
22840
  const storedSessionId = await getSessionForCwd(workingDir);
@@ -22996,6 +23006,12 @@ ${prompt}` : prefix;
22996
23006
  aborted2 = true;
22997
23007
  return str;
22998
23008
  }
23009
+ if (str === CTRL_C) {
23010
+ userSentCtrlC = true;
23011
+ setTimeout(() => {
23012
+ userSentCtrlC = false;
23013
+ }, 2000);
23014
+ }
22999
23015
  return str;
23000
23016
  }).onStart(async function promptOnStart() {
23001
23017
  logger.debug("Sending prompt message: " + JSON.stringify(prompt));
@@ -28947,5 +28963,5 @@ var { exitCode } = await cliYes(config3);
28947
28963
  console.log("exiting process");
28948
28964
  process.exit(exitCode ?? 1);
28949
28965
 
28950
- //# debugId=2B36C295F63F614164756E2164756E21
28966
+ //# debugId=8185C591792B0E7E64756E2164756E21
28951
28967
  //# sourceMappingURL=cli.js.map
package/dist/index.js CHANGED
@@ -21554,6 +21554,7 @@ async function agentYes({
21554
21554
  await pidStore.init();
21555
21555
  const stdinReady = new ReadyManager;
21556
21556
  const stdinFirstReady = new ReadyManager;
21557
+ let userSentCtrlC = false;
21557
21558
  if (conf.ready && conf.ready.length === 0) {
21558
21559
  stdinReady.ready();
21559
21560
  stdinFirstReady.ready();
@@ -21732,7 +21733,8 @@ ${prompt}` : prefix;
21732
21733
  const exitedPid = shell.pid;
21733
21734
  globalAgentRegistry.unregister(exitedPid);
21734
21735
  ctx.stdinReady.unready();
21735
- const agentCrashed = exitCode2 !== 0;
21736
+ const intentionalExit = exitCode2 === 130 || exitCode2 === 143 || userSentCtrlC;
21737
+ const agentCrashed = exitCode2 !== 0 && !intentionalExit;
21736
21738
  if (ctx.shouldRestartWithoutContinue) {
21737
21739
  try {
21738
21740
  await pidStore.updateStatus(exitedPid, "exited", {
@@ -21804,7 +21806,7 @@ ${prompt}` : prefix;
21804
21806
  } catch (error) {
21805
21807
  logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
21806
21808
  }
21807
- logger.info(`${cli} crashed, restarting...`);
21809
+ logger.info(`${cli} crashed (exit code: ${exitCode2}), restarting...`);
21808
21810
  let restoreArgs = conf.restoreArgs;
21809
21811
  if (cli === "codex") {
21810
21812
  const storedSessionId = await getSessionForCwd(workingDir);
@@ -21976,6 +21978,12 @@ ${prompt}` : prefix;
21976
21978
  aborted2 = true;
21977
21979
  return str;
21978
21980
  }
21981
+ if (str === CTRL_C) {
21982
+ userSentCtrlC = true;
21983
+ setTimeout(() => {
21984
+ userSentCtrlC = false;
21985
+ }, 2000);
21986
+ }
21979
21987
  return str;
21980
21988
  }).onStart(async function promptOnStart() {
21981
21989
  logger.debug("Sending prompt message: " + JSON.stringify(prompt));
@@ -22103,5 +22111,5 @@ export {
22103
22111
  AgentContext
22104
22112
  };
22105
22113
 
22106
- //# debugId=7D2DEB4034BE0DEE64756E2164756E21
22114
+ //# debugId=A9EAFC7591F2A98264756E2164756E21
22107
22115
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-yes",
3
- "version": "1.44.6",
3
+ "version": "1.44.8",
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
@@ -55,6 +55,7 @@ export type AgentCliConfig = {
55
55
 
56
56
  // auto responds
57
57
  enter?: RegExp[]; // array of regex to match for sending Enter
58
+ enterExclude?: RegExp[]; // array of regex to exclude from auto-enter (even if enter matches)
58
59
  typingRespond?: { [message: string]: RegExp[] }; // type specified message to a specified pattern
59
60
 
60
61
  // crash/resuming-session behaviour
@@ -174,6 +175,9 @@ export default async function agentYes({
174
175
  const stdinReady = new ReadyManager();
175
176
  const stdinFirstReady = new ReadyManager(); // if user send ctrl+c before
176
177
 
178
+ // Track when user sends Ctrl+C to avoid treating intentional exit as crash
179
+ let userSentCtrlC = false;
180
+
177
181
  // If ready check is disabled (empty array), mark stdin ready immediately
178
182
  if (conf.ready && conf.ready.length === 0) {
179
183
  stdinReady.ready();
@@ -392,7 +396,10 @@ export default async function agentYes({
392
396
  // Unregister from agent registry
393
397
  globalAgentRegistry.unregister(exitedPid);
394
398
  ctx.stdinReady.unready(); // start buffer stdin
395
- const agentCrashed = exitCode !== 0;
399
+ // Exit codes 130 (SIGINT/Ctrl+C) and 143 (SIGTERM) are intentional exits, not crashes
400
+ // Also check if user sent Ctrl+C recently (within last 2 seconds)
401
+ const intentionalExit = exitCode === 130 || exitCode === 143 || userSentCtrlC;
402
+ const agentCrashed = exitCode !== 0 && !intentionalExit;
396
403
 
397
404
  // Handle restart without continue args (e.g., "No conversation found to continue")
398
405
  // logger.debug(``, { shouldRestartWithoutContinue, robust })
@@ -483,7 +490,7 @@ export default async function agentYes({
483
490
  } catch (error) {
484
491
  logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
485
492
  }
486
- logger.info(`${cli} crashed, restarting...`);
493
+ logger.info(`${cli} crashed (exit code: ${exitCode}), restarting...`);
487
494
 
488
495
  // For codex, try to use stored session ID for this directory
489
496
  let restoreArgs = conf.restoreArgs;
@@ -726,6 +733,13 @@ export default async function agentYes({
726
733
  return str; // still pass to agent, but they'll probably be killed
727
734
  }
728
735
 
736
+ // Track Ctrl+C when stdin is ready (user is interrupting running CLI)
737
+ if (str === CTRL_C) {
738
+ userSentCtrlC = true;
739
+ // Reset flag after 2 seconds in case CLI doesn't exit immediately
740
+ setTimeout(() => { userSentCtrlC = false; }, 2000);
741
+ }
742
+
729
743
  return str;
730
744
  })
731
745