@proagentstore/cli 0.4.12 → 0.4.13
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.
|
@@ -33,9 +33,14 @@ export class HeadlessSession {
|
|
|
33
33
|
this.cmdArgs = args;
|
|
34
34
|
this.binName = (this.cmdBin.split("/").pop() || this.cmdBin) || "cli";
|
|
35
35
|
}
|
|
36
|
-
/** True while the agent process is running.
|
|
36
|
+
/** True while the agent process is running. NOTE: do NOT use `proc.killed` — Node sets
|
|
37
|
+
* it true the instant a signal is DELIVERED, not when the process exits. interrupt()
|
|
38
|
+
* SIGINTs to abort a turn while the process keeps running, so `killed` gave a false
|
|
39
|
+
* "dead" → input() then spawned a SECOND process (orphaning the first). exitCode is
|
|
40
|
+
* null while running and set on normal exit; signalCode is set when a signal actually
|
|
41
|
+
* terminated it — together they're the real liveness signal. */
|
|
37
42
|
get alive() {
|
|
38
|
-
return this.proc !== null && this.proc.exitCode === null &&
|
|
43
|
+
return this.proc !== null && this.proc.exitCode === null && this.proc.signalCode === null;
|
|
39
44
|
}
|
|
40
45
|
/** Idle = ready for the next instruction. */
|
|
41
46
|
get ready() {
|
|
@@ -275,8 +280,12 @@ export function buildClaudeArgs(userArgs, resumeId) {
|
|
|
275
280
|
i++;
|
|
276
281
|
continue;
|
|
277
282
|
}
|
|
278
|
-
|
|
279
|
-
|
|
283
|
+
// Push every user token as-is. A previous `!args.includes(a)` dedup silently
|
|
284
|
+
// dropped a REPEATED flag token (e.g. the 2nd `--add-dir` in `--add-dir /a
|
|
285
|
+
// --add-dir /b`), which orphaned its value (`/b` became a stray positional).
|
|
286
|
+
// Our own structural flags are already protected via RESERVED_CLAUDE_FLAGS, so
|
|
287
|
+
// no dedup is needed here.
|
|
288
|
+
args.push(a);
|
|
280
289
|
}
|
|
281
290
|
if (!args.includes("--dangerously-skip-permissions"))
|
|
282
291
|
args.push("--dangerously-skip-permissions");
|
|
@@ -54,7 +54,11 @@ export class CodingRuntime {
|
|
|
54
54
|
snapshot(sessionId) {
|
|
55
55
|
const session = this.require(sessionId);
|
|
56
56
|
const alive = session.alive;
|
|
57
|
-
|
|
57
|
+
// ALWAYS return the transcript — it holds the produced output AND the
|
|
58
|
+
// `[exited with code N]` / `[error]` lines recorded on exit. Blanking it when the
|
|
59
|
+
// process is dead lost exactly the output + failure reason the brain/console needs
|
|
60
|
+
// to diagnose a crash or read a one-shot CLI's final result.
|
|
61
|
+
const pane = clip(session.snapshot());
|
|
58
62
|
return {
|
|
59
63
|
sessionId,
|
|
60
64
|
pane,
|
package/dist/index.js
CHANGED
|
@@ -952,10 +952,14 @@ function createRunnerCommand() {
|
|
|
952
952
|
});
|
|
953
953
|
runner.stdout?.on("data", (data) => process.stdout.write(data));
|
|
954
954
|
runner.stderr?.on("data", (data) => process.stderr.write(data));
|
|
955
|
+
let shuttingDown = false;
|
|
955
956
|
runner.on("exit", (code) => {
|
|
956
|
-
if (
|
|
957
|
+
if (shuttingDown) return;
|
|
958
|
+
writeError(`Local browser runtime exited unexpectedly${code ? ` (code ${code})` : ""}. Run \`pags up\` again to reconnect.`);
|
|
959
|
+
process.exit(code ?? 1);
|
|
957
960
|
});
|
|
958
961
|
const shutdown = () => {
|
|
962
|
+
shuttingDown = true;
|
|
959
963
|
if (!runner.killed) runner.kill("SIGTERM");
|
|
960
964
|
};
|
|
961
965
|
process.once("SIGINT", () => {
|