agent-yes 1.44.0 → 1.44.1
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 +25 -21
- package/dist/index.js +13 -11
- package/package.json +1 -1
- package/ts/index.ts +12 -10
package/dist/cli.js
CHANGED
|
@@ -22101,22 +22101,24 @@ ${prompt}` : prefix;
|
|
|
22101
22101
|
});
|
|
22102
22102
|
const pendingExitCode = Promise.withResolvers();
|
|
22103
22103
|
async function onData(data) {
|
|
22104
|
+
const currentPid = shell.pid;
|
|
22104
22105
|
await outputWriter.write(data);
|
|
22105
|
-
globalAgentRegistry.appendStdout(
|
|
22106
|
+
globalAgentRegistry.appendStdout(currentPid, data);
|
|
22106
22107
|
}
|
|
22107
22108
|
shell.onData(onData);
|
|
22108
22109
|
shell.onExit(async function onExit2({ exitCode: exitCode2 }) {
|
|
22109
|
-
|
|
22110
|
+
const exitedPid = shell.pid;
|
|
22111
|
+
globalAgentRegistry.unregister(exitedPid);
|
|
22110
22112
|
ctx.stdinReady.unready();
|
|
22111
22113
|
const agentCrashed = exitCode2 !== 0;
|
|
22112
22114
|
if (ctx.shouldRestartWithoutContinue) {
|
|
22113
22115
|
try {
|
|
22114
|
-
await pidStore.updateStatus(
|
|
22116
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
22115
22117
|
exitReason: "restarted",
|
|
22116
22118
|
exitCode: exitCode2 ?? undefined
|
|
22117
22119
|
});
|
|
22118
22120
|
} catch (error) {
|
|
22119
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
22121
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
22120
22122
|
}
|
|
22121
22123
|
ctx.shouldRestartWithoutContinue = false;
|
|
22122
22124
|
ctx.isFatal = false;
|
|
@@ -22163,22 +22165,22 @@ ${prompt}` : prefix;
|
|
|
22163
22165
|
}
|
|
22164
22166
|
if (ctx.isFatal) {
|
|
22165
22167
|
try {
|
|
22166
|
-
await pidStore.updateStatus(
|
|
22168
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
22167
22169
|
exitReason: "fatal",
|
|
22168
22170
|
exitCode: exitCode2 ?? undefined
|
|
22169
22171
|
});
|
|
22170
22172
|
} catch (error) {
|
|
22171
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
22173
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
22172
22174
|
}
|
|
22173
22175
|
return pendingExitCode.resolve(exitCode2);
|
|
22174
22176
|
}
|
|
22175
22177
|
try {
|
|
22176
|
-
await pidStore.updateStatus(
|
|
22178
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
22177
22179
|
exitReason: "restarted",
|
|
22178
22180
|
exitCode: exitCode2 ?? undefined
|
|
22179
22181
|
});
|
|
22180
22182
|
} catch (error) {
|
|
22181
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
22183
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
22182
22184
|
}
|
|
22183
22185
|
logger.info(`${cli} crashed, restarting...`);
|
|
22184
22186
|
let restoreArgs = conf.restoreArgs;
|
|
@@ -22223,12 +22225,12 @@ ${prompt}` : prefix;
|
|
|
22223
22225
|
}
|
|
22224
22226
|
const exitReason = agentCrashed ? "crash" : "normal";
|
|
22225
22227
|
try {
|
|
22226
|
-
await pidStore.updateStatus(
|
|
22228
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
22227
22229
|
exitReason,
|
|
22228
22230
|
exitCode: exitCode2 ?? undefined
|
|
22229
22231
|
});
|
|
22230
22232
|
} catch (error) {
|
|
22231
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
22233
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
22232
22234
|
}
|
|
22233
22235
|
return pendingExitCode.resolve(exitCode2);
|
|
22234
22236
|
});
|
|
@@ -22720,22 +22722,24 @@ ${prompt}` : prefix;
|
|
|
22720
22722
|
});
|
|
22721
22723
|
const pendingExitCode = Promise.withResolvers();
|
|
22722
22724
|
async function onData(data) {
|
|
22725
|
+
const currentPid = shell.pid;
|
|
22723
22726
|
await outputWriter.write(data);
|
|
22724
|
-
globalAgentRegistry.appendStdout(
|
|
22727
|
+
globalAgentRegistry.appendStdout(currentPid, data);
|
|
22725
22728
|
}
|
|
22726
22729
|
shell.onData(onData);
|
|
22727
22730
|
shell.onExit(async function onExit2({ exitCode: exitCode2 }) {
|
|
22728
|
-
|
|
22731
|
+
const exitedPid = shell.pid;
|
|
22732
|
+
globalAgentRegistry.unregister(exitedPid);
|
|
22729
22733
|
ctx.stdinReady.unready();
|
|
22730
22734
|
const agentCrashed = exitCode2 !== 0;
|
|
22731
22735
|
if (ctx.shouldRestartWithoutContinue) {
|
|
22732
22736
|
try {
|
|
22733
|
-
await pidStore.updateStatus(
|
|
22737
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
22734
22738
|
exitReason: "restarted",
|
|
22735
22739
|
exitCode: exitCode2 ?? undefined
|
|
22736
22740
|
});
|
|
22737
22741
|
} catch (error) {
|
|
22738
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
22742
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
22739
22743
|
}
|
|
22740
22744
|
ctx.shouldRestartWithoutContinue = false;
|
|
22741
22745
|
ctx.isFatal = false;
|
|
@@ -22782,22 +22786,22 @@ ${prompt}` : prefix;
|
|
|
22782
22786
|
}
|
|
22783
22787
|
if (ctx.isFatal) {
|
|
22784
22788
|
try {
|
|
22785
|
-
await pidStore.updateStatus(
|
|
22789
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
22786
22790
|
exitReason: "fatal",
|
|
22787
22791
|
exitCode: exitCode2 ?? undefined
|
|
22788
22792
|
});
|
|
22789
22793
|
} catch (error) {
|
|
22790
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
22794
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
22791
22795
|
}
|
|
22792
22796
|
return pendingExitCode.resolve(exitCode2);
|
|
22793
22797
|
}
|
|
22794
22798
|
try {
|
|
22795
|
-
await pidStore.updateStatus(
|
|
22799
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
22796
22800
|
exitReason: "restarted",
|
|
22797
22801
|
exitCode: exitCode2 ?? undefined
|
|
22798
22802
|
});
|
|
22799
22803
|
} catch (error) {
|
|
22800
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
22804
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
22801
22805
|
}
|
|
22802
22806
|
logger.info(`${cli} crashed, restarting...`);
|
|
22803
22807
|
let restoreArgs = conf.restoreArgs;
|
|
@@ -22842,12 +22846,12 @@ ${prompt}` : prefix;
|
|
|
22842
22846
|
}
|
|
22843
22847
|
const exitReason = agentCrashed ? "crash" : "normal";
|
|
22844
22848
|
try {
|
|
22845
|
-
await pidStore.updateStatus(
|
|
22849
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
22846
22850
|
exitReason,
|
|
22847
22851
|
exitCode: exitCode2 ?? undefined
|
|
22848
22852
|
});
|
|
22849
22853
|
} catch (error) {
|
|
22850
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
22854
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
22851
22855
|
}
|
|
22852
22856
|
return pendingExitCode.resolve(exitCode2);
|
|
22853
22857
|
});
|
|
@@ -28898,5 +28902,5 @@ var { exitCode } = await cliYes(config3);
|
|
|
28898
28902
|
console.log("exiting process");
|
|
28899
28903
|
process.exit(exitCode ?? 1);
|
|
28900
28904
|
|
|
28901
|
-
//# debugId=
|
|
28905
|
+
//# debugId=53000167C96B1B5964756E2164756E21
|
|
28902
28906
|
//# sourceMappingURL=cli.js.map
|
package/dist/index.js
CHANGED
|
@@ -21713,22 +21713,24 @@ ${prompt}` : prefix;
|
|
|
21713
21713
|
});
|
|
21714
21714
|
const pendingExitCode = Promise.withResolvers();
|
|
21715
21715
|
async function onData(data) {
|
|
21716
|
+
const currentPid = shell.pid;
|
|
21716
21717
|
await outputWriter.write(data);
|
|
21717
|
-
globalAgentRegistry.appendStdout(
|
|
21718
|
+
globalAgentRegistry.appendStdout(currentPid, data);
|
|
21718
21719
|
}
|
|
21719
21720
|
shell.onData(onData);
|
|
21720
21721
|
shell.onExit(async function onExit2({ exitCode: exitCode2 }) {
|
|
21721
|
-
|
|
21722
|
+
const exitedPid = shell.pid;
|
|
21723
|
+
globalAgentRegistry.unregister(exitedPid);
|
|
21722
21724
|
ctx.stdinReady.unready();
|
|
21723
21725
|
const agentCrashed = exitCode2 !== 0;
|
|
21724
21726
|
if (ctx.shouldRestartWithoutContinue) {
|
|
21725
21727
|
try {
|
|
21726
|
-
await pidStore.updateStatus(
|
|
21728
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
21727
21729
|
exitReason: "restarted",
|
|
21728
21730
|
exitCode: exitCode2 ?? undefined
|
|
21729
21731
|
});
|
|
21730
21732
|
} catch (error) {
|
|
21731
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
21733
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
21732
21734
|
}
|
|
21733
21735
|
ctx.shouldRestartWithoutContinue = false;
|
|
21734
21736
|
ctx.isFatal = false;
|
|
@@ -21775,22 +21777,22 @@ ${prompt}` : prefix;
|
|
|
21775
21777
|
}
|
|
21776
21778
|
if (ctx.isFatal) {
|
|
21777
21779
|
try {
|
|
21778
|
-
await pidStore.updateStatus(
|
|
21780
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
21779
21781
|
exitReason: "fatal",
|
|
21780
21782
|
exitCode: exitCode2 ?? undefined
|
|
21781
21783
|
});
|
|
21782
21784
|
} catch (error) {
|
|
21783
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
21785
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
21784
21786
|
}
|
|
21785
21787
|
return pendingExitCode.resolve(exitCode2);
|
|
21786
21788
|
}
|
|
21787
21789
|
try {
|
|
21788
|
-
await pidStore.updateStatus(
|
|
21790
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
21789
21791
|
exitReason: "restarted",
|
|
21790
21792
|
exitCode: exitCode2 ?? undefined
|
|
21791
21793
|
});
|
|
21792
21794
|
} catch (error) {
|
|
21793
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
21795
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
21794
21796
|
}
|
|
21795
21797
|
logger.info(`${cli} crashed, restarting...`);
|
|
21796
21798
|
let restoreArgs = conf.restoreArgs;
|
|
@@ -21835,12 +21837,12 @@ ${prompt}` : prefix;
|
|
|
21835
21837
|
}
|
|
21836
21838
|
const exitReason = agentCrashed ? "crash" : "normal";
|
|
21837
21839
|
try {
|
|
21838
|
-
await pidStore.updateStatus(
|
|
21840
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
21839
21841
|
exitReason,
|
|
21840
21842
|
exitCode: exitCode2 ?? undefined
|
|
21841
21843
|
});
|
|
21842
21844
|
} catch (error) {
|
|
21843
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
21845
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
21844
21846
|
}
|
|
21845
21847
|
return pendingExitCode.resolve(exitCode2);
|
|
21846
21848
|
});
|
|
@@ -22080,5 +22082,5 @@ export {
|
|
|
22080
22082
|
AgentContext
|
|
22081
22083
|
};
|
|
22082
22084
|
|
|
22083
|
-
//# debugId=
|
|
22085
|
+
//# debugId=38A281697260906C64756E2164756E21
|
|
22084
22086
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
package/ts/index.ts
CHANGED
|
@@ -379,16 +379,18 @@ export default async function agentYes({
|
|
|
379
379
|
const pendingExitCode = Promise.withResolvers<number | null>();
|
|
380
380
|
|
|
381
381
|
async function onData(data: string) {
|
|
382
|
+
const currentPid = shell.pid; // Capture PID before any potential shell reassignment
|
|
382
383
|
// append data to the buffer, so we can process it later
|
|
383
384
|
await outputWriter.write(data);
|
|
384
385
|
// append to agent registry for MCP server
|
|
385
|
-
globalAgentRegistry.appendStdout(
|
|
386
|
+
globalAgentRegistry.appendStdout(currentPid, data);
|
|
386
387
|
}
|
|
387
388
|
|
|
388
389
|
shell.onData(onData);
|
|
389
390
|
shell.onExit(async function onExit({ exitCode }) {
|
|
391
|
+
const exitedPid = shell.pid; // Capture PID immediately before any shell reassignment
|
|
390
392
|
// Unregister from agent registry
|
|
391
|
-
globalAgentRegistry.unregister(
|
|
393
|
+
globalAgentRegistry.unregister(exitedPid);
|
|
392
394
|
ctx.stdinReady.unready(); // start buffer stdin
|
|
393
395
|
const agentCrashed = exitCode !== 0;
|
|
394
396
|
|
|
@@ -397,12 +399,12 @@ export default async function agentYes({
|
|
|
397
399
|
if (ctx.shouldRestartWithoutContinue) {
|
|
398
400
|
// Update status (non-blocking)
|
|
399
401
|
try {
|
|
400
|
-
await pidStore.updateStatus(
|
|
402
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
401
403
|
exitReason: "restarted",
|
|
402
404
|
exitCode: exitCode ?? undefined,
|
|
403
405
|
});
|
|
404
406
|
} catch (error) {
|
|
405
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
407
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
406
408
|
}
|
|
407
409
|
ctx.shouldRestartWithoutContinue = false; // reset flag
|
|
408
410
|
ctx.isFatal = false; // reset fatal flag to allow restart
|
|
@@ -462,24 +464,24 @@ export default async function agentYes({
|
|
|
462
464
|
if (ctx.isFatal) {
|
|
463
465
|
// Update status (non-blocking)
|
|
464
466
|
try {
|
|
465
|
-
await pidStore.updateStatus(
|
|
467
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
466
468
|
exitReason: "fatal",
|
|
467
469
|
exitCode: exitCode ?? undefined,
|
|
468
470
|
});
|
|
469
471
|
} catch (error) {
|
|
470
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
472
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
471
473
|
}
|
|
472
474
|
return pendingExitCode.resolve(exitCode);
|
|
473
475
|
}
|
|
474
476
|
|
|
475
477
|
// Update status (non-blocking)
|
|
476
478
|
try {
|
|
477
|
-
await pidStore.updateStatus(
|
|
479
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
478
480
|
exitReason: "restarted",
|
|
479
481
|
exitCode: exitCode ?? undefined,
|
|
480
482
|
});
|
|
481
483
|
} catch (error) {
|
|
482
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
484
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
483
485
|
}
|
|
484
486
|
logger.info(`${cli} crashed, restarting...`);
|
|
485
487
|
|
|
@@ -532,12 +534,12 @@ export default async function agentYes({
|
|
|
532
534
|
const exitReason = agentCrashed ? "crash" : "normal";
|
|
533
535
|
// Update status (non-blocking)
|
|
534
536
|
try {
|
|
535
|
-
await pidStore.updateStatus(
|
|
537
|
+
await pidStore.updateStatus(exitedPid, "exited", {
|
|
536
538
|
exitReason,
|
|
537
539
|
exitCode: exitCode ?? undefined,
|
|
538
540
|
});
|
|
539
541
|
} catch (error) {
|
|
540
|
-
logger.warn(`[pidStore] Failed to update status for PID ${
|
|
542
|
+
logger.warn(`[pidStore] Failed to update status for PID ${exitedPid}:`, error);
|
|
541
543
|
}
|
|
542
544
|
return pendingExitCode.resolve(exitCode);
|
|
543
545
|
});
|