open-agents-ai 0.149.0 → 0.150.0

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.
Files changed (2) hide show
  1. package/dist/index.js +46 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1315,9 +1315,13 @@ var init_shell = __esm({
1315
1315
  this.workingDir = workingDir;
1316
1316
  this.defaultTimeout = defaultTimeout;
1317
1317
  }
1318
- /** Kill all active child processes immediately (called by /stop) */
1318
+ /** Kill all active child processes and their entire process groups (called by /stop) */
1319
1319
  killAll() {
1320
1320
  for (const child of this._activeChildren) {
1321
+ try {
1322
+ process.kill(-child.pid, "SIGKILL");
1323
+ } catch {
1324
+ }
1321
1325
  try {
1322
1326
  child.kill("SIGKILL");
1323
1327
  } catch {
@@ -1380,8 +1384,14 @@ ${stdinInput ?? ""}`);
1380
1384
  NO_COLOR: "1",
1381
1385
  FORCE_COLOR: "0"
1382
1386
  },
1383
- stdio: ["pipe", "pipe", "pipe"]
1387
+ stdio: ["pipe", "pipe", "pipe"],
1388
+ // Process group: `detached: true` puts the child in its own pgid.
1389
+ // On timeout or cleanup, we kill the entire group with `process.kill(-pid)`,
1390
+ // which recursively kills all descendants (npm → vitest → 48 workers).
1391
+ // Without this, child processes survive parent death as orphans.
1392
+ detached: true
1384
1393
  });
1394
+ child.unref();
1385
1395
  this._activeChildren.add(child);
1386
1396
  let stdout = "";
1387
1397
  let stderr = "";
@@ -1399,11 +1409,22 @@ ${stdinInput ?? ""}`);
1399
1409
  };
1400
1410
  const timer = setTimeout(() => {
1401
1411
  killed = true;
1402
- child.kill("SIGTERM");
1412
+ try {
1413
+ process.kill(-child.pid, "SIGTERM");
1414
+ } catch {
1415
+ try {
1416
+ child.kill("SIGTERM");
1417
+ } catch {
1418
+ }
1419
+ }
1403
1420
  setTimeout(() => {
1404
1421
  try {
1405
- child.kill("SIGKILL");
1422
+ process.kill(-child.pid, "SIGKILL");
1406
1423
  } catch {
1424
+ try {
1425
+ child.kill("SIGKILL");
1426
+ } catch {
1427
+ }
1407
1428
  }
1408
1429
  }, 5e3);
1409
1430
  }, timeout);
@@ -12926,8 +12947,11 @@ except NameError:
12926
12947
  PYTHONUNBUFFERED: "1",
12927
12948
  PYTHONDONTWRITEBYTECODE: "1",
12928
12949
  OA_LLM_QUERY_SOCKET: this.ipcPath ?? ""
12929
- }
12950
+ },
12951
+ detached: true
12952
+ // Own process group — killed cleanly on session end
12930
12953
  });
12954
+ this.proc.unref();
12931
12955
  this.proc.on("error", () => {
12932
12956
  });
12933
12957
  const initCode = this.buildInitCode();
@@ -13225,6 +13249,10 @@ print("${sentinel}")
13225
13249
  if (this.proc && !this.proc.killed) {
13226
13250
  try {
13227
13251
  this.proc.stdin?.end();
13252
+ try {
13253
+ process.kill(-this.proc.pid, "SIGTERM");
13254
+ } catch {
13255
+ }
13228
13256
  this.proc.kill("SIGTERM");
13229
13257
  } catch {
13230
13258
  }
@@ -58124,11 +58152,13 @@ function createTaskCompleteTool() {
58124
58152
  };
58125
58153
  }
58126
58154
  function buildTools(repoRoot, config, contextWindowSize) {
58155
+ const shellTool = new ShellTool(repoRoot);
58156
+ _shellToolRef = shellTool;
58127
58157
  const executionTools = [
58128
58158
  new FileReadTool(repoRoot),
58129
58159
  new FileWriteTool(repoRoot),
58130
58160
  new FileEditTool(repoRoot),
58131
- new ShellTool(repoRoot),
58161
+ shellTool,
58132
58162
  new GrepSearchTool(repoRoot),
58133
58163
  new GlobFindTool(repoRoot),
58134
58164
  new ListDirectoryTool(repoRoot),
@@ -59376,15 +59406,15 @@ async function startInteractive(config, repoPath) {
59376
59406
  const restoreScreen = () => {
59377
59407
  process.stdout.write("\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?1015l\x1B[?25h\x1B[?1049l");
59378
59408
  };
59379
- process.on("exit", restoreScreen);
59380
- process.on("SIGINT", () => {
59381
- restoreScreen();
59382
- process.exit(130);
59383
- });
59384
- process.on("SIGTERM", () => {
59409
+ const cleanupAndExit = (code) => {
59410
+ if (_shellToolRef)
59411
+ _shellToolRef.killAll();
59385
59412
  restoreScreen();
59386
- process.exit(143);
59387
- });
59413
+ process.exit(code);
59414
+ };
59415
+ process.on("exit", restoreScreen);
59416
+ process.on("SIGINT", () => cleanupAndExit(130));
59417
+ process.on("SIGTERM", () => cleanupAndExit(143));
59388
59418
  }
59389
59419
  let memoryDb = null;
59390
59420
  let taskMemoryStore = null;
@@ -62521,7 +62551,7 @@ Rules:
62521
62551
  process.exit(1);
62522
62552
  }
62523
62553
  }
62524
- var taskManager, SELF_IMPROVE_INTERVAL, _tasksSinceImprove;
62554
+ var taskManager, _shellToolRef, SELF_IMPROVE_INTERVAL, _tasksSinceImprove;
62525
62555
  var init_interactive = __esm({
62526
62556
  "packages/cli/dist/tui/interactive.js"() {
62527
62557
  "use strict";
@@ -62561,6 +62591,7 @@ var init_interactive = __esm({
62561
62591
  init_overlay_lock();
62562
62592
  init_neovim_mode();
62563
62593
  taskManager = new BackgroundTaskManager();
62594
+ _shellToolRef = null;
62564
62595
  SELF_IMPROVE_INTERVAL = 5;
62565
62596
  _tasksSinceImprove = 0;
62566
62597
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.149.0",
3
+ "version": "0.150.0",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",