@ai-development-environment/control-agent 0.0.82 → 0.0.84
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/control-agent.js +22 -4
- package/package.json +1 -1
package/dist/control-agent.js
CHANGED
|
@@ -8400,6 +8400,7 @@ function captureCommand(options) {
|
|
|
8400
8400
|
let cancelled = false;
|
|
8401
8401
|
let settled = false;
|
|
8402
8402
|
let killTimer = null;
|
|
8403
|
+
const detached = process.platform !== "win32";
|
|
8403
8404
|
const child = spawn(options.command, options.args, {
|
|
8404
8405
|
shell: false,
|
|
8405
8406
|
stdio: [
|
|
@@ -8408,7 +8409,11 @@ function captureCommand(options) {
|
|
|
8408
8409
|
"pipe"
|
|
8409
8410
|
],
|
|
8410
8411
|
env: options.env ?? process.env,
|
|
8411
|
-
cwd: options.cwd
|
|
8412
|
+
cwd: options.cwd,
|
|
8413
|
+
// Git can leave credential helpers, SSH processes, hooks, or signing
|
|
8414
|
+
// prompts behind. A separate process group lets timeout and cancellation
|
|
8415
|
+
// stop the entire command tree instead of only the immediate Git process.
|
|
8416
|
+
detached
|
|
8412
8417
|
});
|
|
8413
8418
|
const append = (current, chunk) => `${current}${String(chunk)}`.slice(0, MAX_OUTPUT_BYTES);
|
|
8414
8419
|
child.stdout?.on("data", (chunk) => {
|
|
@@ -8417,11 +8422,24 @@ function captureCommand(options) {
|
|
|
8417
8422
|
child.stderr?.on("data", (chunk) => {
|
|
8418
8423
|
stderr = append(stderr, chunk);
|
|
8419
8424
|
});
|
|
8425
|
+
const sendSignal = (signal) => {
|
|
8426
|
+
if (detached && child.pid) {
|
|
8427
|
+
try {
|
|
8428
|
+
process.kill(-child.pid, signal);
|
|
8429
|
+
return;
|
|
8430
|
+
} catch (error) {
|
|
8431
|
+
if (!(error instanceof Error) || !("code" in error) || error.code !== "ESRCH") {
|
|
8432
|
+
throw error;
|
|
8433
|
+
}
|
|
8434
|
+
}
|
|
8435
|
+
}
|
|
8436
|
+
child.kill(signal);
|
|
8437
|
+
};
|
|
8420
8438
|
const terminate = () => {
|
|
8421
8439
|
if (child.exitCode !== null || child.killed) return;
|
|
8422
|
-
|
|
8440
|
+
sendSignal("SIGTERM");
|
|
8423
8441
|
killTimer = setTimeout(() => {
|
|
8424
|
-
if (child.exitCode === null)
|
|
8442
|
+
if (child.exitCode === null) sendSignal("SIGKILL");
|
|
8425
8443
|
}, 5e3);
|
|
8426
8444
|
killTimer.unref();
|
|
8427
8445
|
};
|
|
@@ -49917,7 +49935,7 @@ var OpenCodeAdapter = class {
|
|
|
49917
49935
|
);
|
|
49918
49936
|
}
|
|
49919
49937
|
prependPathDirectory(dirname9(executable));
|
|
49920
|
-
this.runtime = await createOpencode();
|
|
49938
|
+
this.runtime = await createOpencode({ port: 0 });
|
|
49921
49939
|
}
|
|
49922
49940
|
return this.runtime.client;
|
|
49923
49941
|
}
|