open-agents-ai 0.148.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 +77 -26
  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
  }
@@ -55613,6 +55641,19 @@ function copyText(text) {
55613
55641
  continue;
55614
55642
  }
55615
55643
  }
55644
+ if (!_clipboardAutoInstallAttempted) {
55645
+ _clipboardAutoInstallAttempted = true;
55646
+ try {
55647
+ execSync29("which apt-get", { timeout: 2e3, stdio: "pipe" });
55648
+ try {
55649
+ execSync29("sudo -n apt-get install -y xclip 2>/dev/null", { timeout: 15e3, stdio: "pipe" });
55650
+ execSync29("xclip -selection clipboard", { input: text, timeout: 3e3 });
55651
+ return true;
55652
+ } catch {
55653
+ }
55654
+ } catch {
55655
+ }
55656
+ }
55616
55657
  } catch {
55617
55658
  }
55618
55659
  try {
@@ -55695,7 +55736,7 @@ function hitTestHeaderButton(row, col, termWidth) {
55695
55736
  }
55696
55737
  return null;
55697
55738
  }
55698
- var SEL_BG, SEL_FG, SEL_START, SEL_END, TextSelection, _hoveredButtonCmd, _pressedButtonCmd, BTN_REST_BG, BTN_REST_FG, BTN_HOVER_BG, BTN_HOVER_FG, BTN_PRESS_BG, BTN_PRESS_FG, _updateBadgeActive, _updateBadgeCol, _updateBadgeLen;
55739
+ var SEL_BG, SEL_FG, SEL_START, SEL_END, TextSelection, _clipboardAutoInstallAttempted, _hoveredButtonCmd, _pressedButtonCmd, BTN_REST_BG, BTN_REST_FG, BTN_HOVER_BG, BTN_HOVER_FG, BTN_PRESS_BG, BTN_PRESS_FG, _updateBadgeActive, _updateBadgeCol, _updateBadgeLen;
55699
55740
  var init_text_selection = __esm({
55700
55741
  "packages/cli/dist/tui/text-selection.js"() {
55701
55742
  "use strict";
@@ -55898,6 +55939,7 @@ var init_text_selection = __esm({
55898
55939
  return copyText(text);
55899
55940
  }
55900
55941
  };
55942
+ _clipboardAutoInstallAttempted = false;
55901
55943
  _hoveredButtonCmd = null;
55902
55944
  _pressedButtonCmd = null;
55903
55945
  BTN_REST_BG = 236;
@@ -56823,7 +56865,11 @@ var init_status_bar = __esm({
56823
56865
  this.repaintContent();
56824
56866
  } else if (type === "release") {
56825
56867
  this._textSelection.onMouseRelease(row, col);
56826
- this.repaintContent();
56868
+ if (this._textSelection.hasSelection) {
56869
+ this.copySelection();
56870
+ } else {
56871
+ this.repaintContent();
56872
+ }
56827
56873
  }
56828
56874
  }
56829
56875
  /** Copy current selection to clipboard. Returns true if copied. */
@@ -56831,18 +56877,20 @@ var init_status_bar = __esm({
56831
56877
  if (!this._textSelection.hasSelection)
56832
56878
  return false;
56833
56879
  const ok = this._textSelection.copyToClipboard();
56880
+ this._textSelection.clear();
56881
+ this.repaintContent();
56882
+ const rows = process.stdout.rows ?? 24;
56883
+ const pos = this.rowPositions(rows);
56884
+ const writer = this._origWrite ?? process.stdout.write.bind(process.stdout);
56834
56885
  if (ok) {
56835
- this._textSelection.clear();
56836
- this.repaintContent();
56837
- const rows = process.stdout.rows ?? 24;
56838
- const pos = this.rowPositions(rows);
56839
- const writer = this._origWrite ?? process.stdout.write.bind(process.stdout);
56840
56886
  writer(`\x1B[${pos.metricsRow};1H\x1B[2K\x1B[38;5;${TEXT_PRIMARY}m \u2713 Copied to clipboard\x1B[0m`);
56841
- setTimeout(() => {
56842
- if (this.active)
56843
- this.renderFooterAndPositionInput();
56844
- }, 1200);
56887
+ } else {
56888
+ writer(`\x1B[${pos.metricsRow};1H\x1B[2K\x1B[38;5;214m \u26A0 Copy failed \u2014 install xclip: sudo apt install xclip\x1B[0m`);
56845
56889
  }
56890
+ setTimeout(() => {
56891
+ if (this.active)
56892
+ this.renderFooterAndPositionInput();
56893
+ }, ok ? 1200 : 3e3);
56846
56894
  return ok;
56847
56895
  }
56848
56896
  /** Arm block (rectangular) selection mode — next click starts block select */
@@ -58104,11 +58152,13 @@ function createTaskCompleteTool() {
58104
58152
  };
58105
58153
  }
58106
58154
  function buildTools(repoRoot, config, contextWindowSize) {
58155
+ const shellTool = new ShellTool(repoRoot);
58156
+ _shellToolRef = shellTool;
58107
58157
  const executionTools = [
58108
58158
  new FileReadTool(repoRoot),
58109
58159
  new FileWriteTool(repoRoot),
58110
58160
  new FileEditTool(repoRoot),
58111
- new ShellTool(repoRoot),
58161
+ shellTool,
58112
58162
  new GrepSearchTool(repoRoot),
58113
58163
  new GlobFindTool(repoRoot),
58114
58164
  new ListDirectoryTool(repoRoot),
@@ -59356,15 +59406,15 @@ async function startInteractive(config, repoPath) {
59356
59406
  const restoreScreen = () => {
59357
59407
  process.stdout.write("\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?1015l\x1B[?25h\x1B[?1049l");
59358
59408
  };
59359
- process.on("exit", restoreScreen);
59360
- process.on("SIGINT", () => {
59361
- restoreScreen();
59362
- process.exit(130);
59363
- });
59364
- process.on("SIGTERM", () => {
59409
+ const cleanupAndExit = (code) => {
59410
+ if (_shellToolRef)
59411
+ _shellToolRef.killAll();
59365
59412
  restoreScreen();
59366
- process.exit(143);
59367
- });
59413
+ process.exit(code);
59414
+ };
59415
+ process.on("exit", restoreScreen);
59416
+ process.on("SIGINT", () => cleanupAndExit(130));
59417
+ process.on("SIGTERM", () => cleanupAndExit(143));
59368
59418
  }
59369
59419
  let memoryDb = null;
59370
59420
  let taskMemoryStore = null;
@@ -62501,7 +62551,7 @@ Rules:
62501
62551
  process.exit(1);
62502
62552
  }
62503
62553
  }
62504
- var taskManager, SELF_IMPROVE_INTERVAL, _tasksSinceImprove;
62554
+ var taskManager, _shellToolRef, SELF_IMPROVE_INTERVAL, _tasksSinceImprove;
62505
62555
  var init_interactive = __esm({
62506
62556
  "packages/cli/dist/tui/interactive.js"() {
62507
62557
  "use strict";
@@ -62541,6 +62591,7 @@ var init_interactive = __esm({
62541
62591
  init_overlay_lock();
62542
62592
  init_neovim_mode();
62543
62593
  taskManager = new BackgroundTaskManager();
62594
+ _shellToolRef = null;
62544
62595
  SELF_IMPROVE_INTERVAL = 5;
62545
62596
  _tasksSinceImprove = 0;
62546
62597
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.148.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",