agent-yes 1.44.6 → 1.44.7
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 +21 -5
- package/dist/index.js +11 -3
- package/package.json +1 -1
- package/ts/index.ts +15 -2
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
|
|
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
|
|
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=
|
|
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
|
|
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=
|
|
22114
|
+
//# debugId=A9EAFC7591F2A98264756E2164756E21
|
|
22107
22115
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
package/ts/index.ts
CHANGED
|
@@ -174,6 +174,9 @@ export default async function agentYes({
|
|
|
174
174
|
const stdinReady = new ReadyManager();
|
|
175
175
|
const stdinFirstReady = new ReadyManager(); // if user send ctrl+c before
|
|
176
176
|
|
|
177
|
+
// Track when user sends Ctrl+C to avoid treating intentional exit as crash
|
|
178
|
+
let userSentCtrlC = false;
|
|
179
|
+
|
|
177
180
|
// If ready check is disabled (empty array), mark stdin ready immediately
|
|
178
181
|
if (conf.ready && conf.ready.length === 0) {
|
|
179
182
|
stdinReady.ready();
|
|
@@ -392,7 +395,10 @@ export default async function agentYes({
|
|
|
392
395
|
// Unregister from agent registry
|
|
393
396
|
globalAgentRegistry.unregister(exitedPid);
|
|
394
397
|
ctx.stdinReady.unready(); // start buffer stdin
|
|
395
|
-
|
|
398
|
+
// Exit codes 130 (SIGINT/Ctrl+C) and 143 (SIGTERM) are intentional exits, not crashes
|
|
399
|
+
// Also check if user sent Ctrl+C recently (within last 2 seconds)
|
|
400
|
+
const intentionalExit = exitCode === 130 || exitCode === 143 || userSentCtrlC;
|
|
401
|
+
const agentCrashed = exitCode !== 0 && !intentionalExit;
|
|
396
402
|
|
|
397
403
|
// Handle restart without continue args (e.g., "No conversation found to continue")
|
|
398
404
|
// logger.debug(``, { shouldRestartWithoutContinue, robust })
|
|
@@ -483,7 +489,7 @@ export default async function agentYes({
|
|
|
483
489
|
} catch (error) {
|
|
484
490
|
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
485
491
|
}
|
|
486
|
-
logger.info(`${cli} crashed, restarting...`);
|
|
492
|
+
logger.info(`${cli} crashed (exit code: ${exitCode}), restarting...`);
|
|
487
493
|
|
|
488
494
|
// For codex, try to use stored session ID for this directory
|
|
489
495
|
let restoreArgs = conf.restoreArgs;
|
|
@@ -726,6 +732,13 @@ export default async function agentYes({
|
|
|
726
732
|
return str; // still pass to agent, but they'll probably be killed
|
|
727
733
|
}
|
|
728
734
|
|
|
735
|
+
// Track Ctrl+C when stdin is ready (user is interrupting running CLI)
|
|
736
|
+
if (str === CTRL_C) {
|
|
737
|
+
userSentCtrlC = true;
|
|
738
|
+
// Reset flag after 2 seconds in case CLI doesn't exit immediately
|
|
739
|
+
setTimeout(() => { userSentCtrlC = false; }, 2000);
|
|
740
|
+
}
|
|
741
|
+
|
|
729
742
|
return str;
|
|
730
743
|
})
|
|
731
744
|
|