open-agents-ai 0.187.379 → 0.187.381

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 +114 -39
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -329,6 +329,32 @@ var init_updater = __esm({
329
329
  }
330
330
  });
331
331
 
332
+ // packages/cli/src/utils/typed-node-events.ts
333
+ function callEmitterMethod(emitter, method, eventName, listener) {
334
+ const typedEmitter = emitter;
335
+ typedEmitter[method](eventName, listener);
336
+ }
337
+ function onChildClose(child, listener) {
338
+ callEmitterMethod(child, "on", "close", listener);
339
+ }
340
+ function onChildExit(child, listener) {
341
+ callEmitterMethod(child, "on", "exit", listener);
342
+ }
343
+ function onChildError(child, listener) {
344
+ callEmitterMethod(child, "on", "error", listener);
345
+ }
346
+ function onReadlineLine(rl, listener) {
347
+ callEmitterMethod(rl, "on", "line", listener);
348
+ }
349
+ function onReadlineClose(rl, listener) {
350
+ callEmitterMethod(rl, "on", "close", listener);
351
+ }
352
+ var init_typed_node_events = __esm({
353
+ "packages/cli/src/utils/typed-node-events.ts"() {
354
+ "use strict";
355
+ }
356
+ });
357
+
332
358
  // packages/cli/src/ui/spinner.ts
333
359
  var FRAMES, INTERVAL_MS, Spinner;
334
360
  var init_spinner = __esm({
@@ -520396,6 +520422,37 @@ ${transcript}`
520396
520422
  const allTools = Array.from(this.tools.values()).filter((tool) => tool.name !== "tool_search");
520397
520423
  const tier = this.options.modelTier ?? "large";
520398
520424
  const taskGoal = this._taskState.goal || "";
520425
+ const STOPWORDS = /* @__PURE__ */ new Set([
520426
+ "with",
520427
+ "that",
520428
+ "this",
520429
+ "from",
520430
+ "into",
520431
+ "your",
520432
+ "when",
520433
+ "what",
520434
+ "have",
520435
+ "will",
520436
+ "then",
520437
+ "than",
520438
+ "them",
520439
+ "they",
520440
+ "tool",
520441
+ "tools",
520442
+ "using",
520443
+ "used",
520444
+ "additional",
520445
+ "current",
520446
+ "list",
520447
+ "search",
520448
+ "activate",
520449
+ "query",
520450
+ "call",
520451
+ "support",
520452
+ "supports",
520453
+ "allows",
520454
+ "allow"
520455
+ ]);
520399
520456
  const dynamicDescs = /* @__PURE__ */ new Map();
520400
520457
  const promptTools = allTools.filter((t2) => typeof t2.prompt === "function");
520401
520458
  if (promptTools.length > 0) {
@@ -520413,6 +520470,11 @@ ${transcript}`
520413
520470
  }
520414
520471
  }
520415
520472
  const getDesc = (tool) => dynamicDescs.get(tool.name) ?? tool.description;
520473
+ const getIndexLabel = (tool) => {
520474
+ const desc = getDesc(tool).toLowerCase().replace(/[`"'()[\]{}:;,.!?/\\|-]+/g, " ");
520475
+ const keywords = Array.from(new Set(desc.split(/\s+/).filter((word2) => word2.length > 2 && !STOPWORDS.has(word2) && !tool.name.toLowerCase().includes(word2)))).slice(0, 4);
520476
+ return keywords.length > 0 ? `${tool.name}(${keywords.join(",")})` : tool.name;
520477
+ };
520416
520478
  const CORE_TOOLS2 = /* @__PURE__ */ new Set([
520417
520479
  "file_read",
520418
520480
  "file_write",
@@ -520456,7 +520518,7 @@ ${transcript}`
520456
520518
  scored.push({ tool, score });
520457
520519
  }
520458
520520
  scored.sort((a2, b) => b.score - a2.score);
520459
- const maxInlineExtra = tier === "small" ? 4 : tier === "medium" ? 8 : 12;
520521
+ const maxInlineExtra = tier === "small" ? 4 : 8;
520460
520522
  const inlineExtras = scored.slice(0, maxInlineExtra).filter((s2) => s2.score > 0);
520461
520523
  const inlineNames = /* @__PURE__ */ new Set([
520462
520524
  ...allTools.filter((t2) => CORE_TOOLS2.has(t2.name)).map((t2) => t2.name),
@@ -520471,7 +520533,7 @@ ${transcript}`
520471
520533
  seen.add(t2.name);
520472
520534
  return true;
520473
520535
  });
520474
- const compressDesc = tier === "small" || tier === "medium";
520536
+ const compressDesc = true;
520475
520537
  const defs = dedupedInline.map((tool) => {
520476
520538
  const desc = getDesc(tool);
520477
520539
  return {
@@ -520484,16 +520546,19 @@ ${transcript}`
520484
520546
  };
520485
520547
  });
520486
520548
  if (deferred.length > 0) {
520487
- const catalog = deferred.map((t2) => {
520488
- const desc = getDesc(t2);
520489
- const shortDesc = desc.split(/\.\s/)[0]?.slice(0, 80) ?? desc.slice(0, 80);
520490
- return `- ${t2.name}: ${shortDesc}`;
520491
- }).join("\n");
520549
+ const catalogEntries = deferred.map(getIndexLabel);
520550
+ const catalog = catalogEntries.reduce((lines, entry, index) => {
520551
+ const lineIdx = Math.floor(index / 6);
520552
+ if (!lines[lineIdx])
520553
+ lines[lineIdx] = [];
520554
+ lines[lineIdx].push(entry);
520555
+ return lines;
520556
+ }, []).map((line) => `- ${line.join(", ")}`).join("\n");
520492
520557
  defs.push({
520493
520558
  type: "function",
520494
520559
  function: {
520495
520560
  name: "tool_search",
520496
- description: `Search for and activate additional tools not in your current tool list. Call this when your task needs a tool you don't have. Pass a search query describing what you need.
520561
+ description: `Search for and activate additional tools not in your current tool list. Call this when your task needs a tool you don't have. Pass a search query describing what you need. The catalog below is a compact index; full schemas are returned only after search.
520497
520562
 
520498
520563
  Available tools (${deferred.length}):
520499
520564
  ${catalog}`,
@@ -524378,6 +524443,7 @@ var AUDIO_EXTENSIONS, VIDEO_EXTENSIONS, WhisperFallbackTranscriber, ListenEngine
524378
524443
  var init_listen = __esm({
524379
524444
  "packages/cli/src/tui/listen.ts"() {
524380
524445
  "use strict";
524446
+ init_typed_node_events();
524381
524447
  AUDIO_EXTENSIONS = /* @__PURE__ */ new Set([
524382
524448
  ".mp3",
524383
524449
  ".wav",
@@ -524447,7 +524513,7 @@ var init_listen = __esm({
524447
524513
  reject(new Error("Whisper fallback: model load timeout (5 min). First run downloads the model."));
524448
524514
  }, 3e5);
524449
524515
  const rl = createInterface2({ input: this.process.stdout });
524450
- rl.on("line", (line) => {
524516
+ onReadlineLine(rl, (line) => {
524451
524517
  try {
524452
524518
  const evt = JSON.parse(line);
524453
524519
  switch (evt.type) {
@@ -524477,11 +524543,11 @@ var init_listen = __esm({
524477
524543
  const text = data.toString().trim();
524478
524544
  if (text) this.emit("status", text);
524479
524545
  });
524480
- this.process.on("error", (err) => {
524546
+ onChildError(this.process, (err) => {
524481
524547
  clearTimeout(timeout2);
524482
524548
  reject(err);
524483
524549
  });
524484
- this.process.on("close", (code8) => {
524550
+ onChildClose(this.process, (code8) => {
524485
524551
  if (!this._ready) {
524486
524552
  clearTimeout(timeout2);
524487
524553
  reject(new Error(`Whisper worker exited with code ${code8} before ready`));
@@ -524767,11 +524833,11 @@ transcribe-cli error: ${transcribeCliError}` : "";
524767
524833
  });
524768
524834
  this.micProcess.stderr?.on("data", () => {
524769
524835
  });
524770
- this.micProcess.on("error", (err) => {
524836
+ onChildError(this.micProcess, (err) => {
524771
524837
  this.emit("error", new Error(`Mic capture failed: ${err.message}`));
524772
524838
  this.stop();
524773
524839
  });
524774
- this.micProcess.on("close", () => {
524840
+ onChildClose(this.micProcess, () => {
524775
524841
  if (this.active) {
524776
524842
  this.stop();
524777
524843
  }
@@ -535346,11 +535412,11 @@ function execAsync(cmd, opts = {}) {
535346
535412
  child.stderr?.on("data", (d2) => {
535347
535413
  stderr += d2.toString();
535348
535414
  });
535349
- child.on("close", (code8, signal) => {
535415
+ onChildClose(child, (code8, signal) => {
535350
535416
  if (code8 === 0) resolve41(stdout.trim());
535351
535417
  else reject(new Error(`Exit ${code8}${signal ? ` (signal: ${signal})` : ""}: ${stderr.slice(0, 500)}`));
535352
535418
  });
535353
- child.on("error", reject);
535419
+ onChildError(child, reject);
535354
535420
  });
535355
535421
  }
535356
535422
  function selectWeightTier(vramGB) {
@@ -536122,7 +536188,7 @@ async function clonePersonaPlexVoice(inputWav, voiceName, onInfo) {
536122
536188
  child.stderr?.on("data", (d2) => {
536123
536189
  output += d2.toString();
536124
536190
  });
536125
- child.on("close", (code8) => {
536191
+ onChildClose(child, (code8) => {
536126
536192
  if (code8 === 0 && existsSync59(outputPt)) {
536127
536193
  log22(`Voice "${voiceName}" cloned successfully.`);
536128
536194
  resolve41(outputPt);
@@ -536283,6 +536349,7 @@ var init_personaplex = __esm({
536283
536349
  "use strict";
536284
536350
  init_render2();
536285
536351
  init_daemon_registry();
536352
+ init_typed_node_events();
536286
536353
  WEIGHT_REPOS = {
536287
536354
  original: { repo: "nvidia/personaplex-7b-v1", file: "model.safetensors", sizeGB: 15.6, needsToken: true },
536288
536355
  nf4: { repo: "cudabenchmarktest/personaplex-7b-nf4", file: "model-nf4.safetensors", sizeGB: 4.1, needsToken: false },
@@ -544025,8 +544092,8 @@ async function runSudoScript(ctx3, script) {
544025
544092
  child.stderr?.on("data", (data) => {
544026
544093
  stderr += data.toString();
544027
544094
  });
544028
- child.on("exit", () => resolve41());
544029
- child.on("error", () => resolve41());
544095
+ onChildExit(child, () => resolve41());
544096
+ onChildError(child, () => resolve41());
544030
544097
  });
544031
544098
  } catch {
544032
544099
  }
@@ -546512,7 +546579,7 @@ sleep 1
546512
546579
  const { spawn: spawn27 } = await import("node:child_process");
546513
546580
  await new Promise((resolve41) => {
546514
546581
  const child = spawn27("bash", ["-lc", takeover], { stdio: "inherit" });
546515
- child.on("exit", () => resolve41());
546582
+ onChildExit(child, () => resolve41());
546516
546583
  });
546517
546584
  renderInfo2("Daemon takeover complete.");
546518
546585
  } catch (e2) {
@@ -551533,6 +551600,7 @@ var init_commands = __esm({
551533
551600
  init_status_bar();
551534
551601
  init_layout2();
551535
551602
  init_setup();
551603
+ init_typed_node_events();
551536
551604
  init_listen();
551537
551605
  init_dist();
551538
551606
  init_tui_select();
@@ -551893,8 +551961,8 @@ function formatInlineMarkdown(text) {
551893
551961
  result = result.replace(/\*{2}([^*]+)\*{2}/g, (_m, t2) => c3.bold(t2));
551894
551962
  result = result.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g, (_m, t2) => c3.italic(t2));
551895
551963
  result = result.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_m, label, url) => c3.bold(fg2563(MD.link, label)) + " " + c3.dim(fg2563(MD.link, `(${url})`)));
551896
- result = result.replace(/__([^_]+)__/g, (_m, t2) => c3.bold(t2));
551897
- result = result.replace(/(?<!_)_([^_]+)_(?!_)/g, (_m, t2) => c3.italic(t2));
551964
+ result = result.replace(/(?<!\w)__([^_]+)__(?!\w)/g, (_m, t2) => c3.bold(t2));
551965
+ result = result.replace(/(?<!\w)_([^_]+)_(?!\w)/g, (_m, t2) => c3.italic(t2));
551898
551966
  result = result.replace(/~~([^~]+)~~/g, (_m, t2) => c3.dim(t2));
551899
551967
  return result;
551900
551968
  }
@@ -553614,6 +553682,7 @@ var init_voice_session = __esm({
553614
553682
  "use strict";
553615
553683
  init_wrapper2();
553616
553684
  init_render2();
553685
+ init_typed_node_events();
553617
553686
  VoiceSession = class extends EventEmitter5 {
553618
553687
  state;
553619
553688
  server = null;
@@ -553942,11 +554011,11 @@ var init_voice_session = __esm({
553942
554011
  };
553943
554012
  this.cloudflaredProcess.stdout?.on("data", handleOutput);
553944
554013
  this.cloudflaredProcess.stderr?.on("data", handleOutput);
553945
- this.cloudflaredProcess.on("error", (err) => {
554014
+ onChildError(this.cloudflaredProcess, (err) => {
553946
554015
  clearTimeout(timeout2);
553947
554016
  reject(new Error(`Failed to start cloudflared: ${err.message}`));
553948
554017
  });
553949
- this.cloudflaredProcess.on("close", (code8) => {
554018
+ onChildClose(this.cloudflaredProcess, (code8) => {
553950
554019
  if (!urlFound) {
553951
554020
  clearTimeout(timeout2);
553952
554021
  reject(new Error(`Cloudflared exited with code ${code8} before providing URL`));
@@ -554168,6 +554237,7 @@ var init_expose = __esm({
554168
554237
  "packages/cli/src/tui/expose.ts"() {
554169
554238
  "use strict";
554170
554239
  init_render2();
554240
+ init_typed_node_events();
554171
554241
  HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
554172
554242
  "connection",
554173
554243
  "keep-alive",
@@ -554820,7 +554890,7 @@ var init_expose = __esm({
554820
554890
  };
554821
554891
  this.cloudflaredProcess.stdout?.on("data", handleOutput);
554822
554892
  this.cloudflaredProcess.stderr?.on("data", handleOutput);
554823
- this.cloudflaredProcess.on("error", (err) => {
554893
+ onChildError(this.cloudflaredProcess, (err) => {
554824
554894
  cleanTimers();
554825
554895
  const msg = err.message;
554826
554896
  if (msg.includes("ENOENT")) {
@@ -554829,7 +554899,7 @@ var init_expose = __esm({
554829
554899
  reject(new Error(`Failed to start cloudflared: ${msg}`));
554830
554900
  }
554831
554901
  });
554832
- this.cloudflaredProcess.on("close", (code8) => {
554902
+ onChildClose(this.cloudflaredProcess, (code8) => {
554833
554903
  if (!urlFound) {
554834
554904
  cleanTimers();
554835
554905
  const hint = stderrOutput.trim().split("\n").slice(-3).join(" | ");
@@ -558794,8 +558864,8 @@ var init_stream_renderer = __esm({
558794
558864
  result = result.replace(/\*{2}([^*]+)\*{2}/g, (_m, t2) => boldText(t2));
558795
558865
  result = result.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g, (_m, t2) => italicText(t2));
558796
558866
  result = result.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_m, label, url) => boldText(fg2564(PASTEL.link, label)) + " " + dimText(fg2564(PASTEL.link, `(${url})`)));
558797
- result = result.replace(/__([^_]+)__/g, (_m, t2) => boldText(t2));
558798
- result = result.replace(/(?<!_)_([^_]+)_(?!_)/g, (_m, t2) => italicText(t2));
558867
+ result = result.replace(/(?<!\w)__([^_]+)__(?!\w)/g, (_m, t2) => boldText(t2));
558868
+ result = result.replace(/(?<!\w)_([^_]+)_(?!\w)/g, (_m, t2) => italicText(t2));
558799
558869
  result = result.replace(/~~([^~]+)~~/g, (_m, t2) => dimText(t2));
558800
558870
  return result;
558801
558871
  }
@@ -574416,7 +574486,7 @@ ${task}` : task;
574416
574486
  resolve210();
574417
574487
  }
574418
574488
  };
574419
- child.on("close", finish);
574489
+ onChildClose(child, finish);
574420
574490
  const deadline = setTimeout(() => {
574421
574491
  if (done) return;
574422
574492
  try {
@@ -574502,7 +574572,7 @@ ${task}` : task;
574502
574572
  resolve210();
574503
574573
  }
574504
574574
  };
574505
- child.on("close", finish);
574575
+ onChildClose(child, finish);
574506
574576
  const deadline = setTimeout(() => {
574507
574577
  if (done) return;
574508
574578
  killedByDeadline = true;
@@ -575012,7 +575082,7 @@ async function handleV1Run(req2, res) {
575012
575082
 
575013
575083
  `);
575014
575084
  });
575015
- child.on("exit", (code8) => {
575085
+ onChildExit(child, (code8) => {
575016
575086
  job.status = code8 === 0 ? "completed" : "failed";
575017
575087
  job.completedAt = (/* @__PURE__ */ new Date()).toISOString();
575018
575088
  atomicJobWrite(dir, id, job);
@@ -575059,7 +575129,7 @@ async function handleV1Run(req2, res) {
575059
575129
  tailBytes = output.length;
575060
575130
  }
575061
575131
  });
575062
- child.on("exit", (code8) => {
575132
+ onChildExit(child, (code8) => {
575063
575133
  try {
575064
575134
  const lines = output.trim().split("\n");
575065
575135
  let finalJson = "";
@@ -575434,8 +575504,8 @@ async function handlePostCommand(res, cmd) {
575434
575504
  stderr += chunk.toString();
575435
575505
  });
575436
575506
  await new Promise((resolve41) => {
575437
- child.on("exit", () => resolve41());
575438
- child.on("error", () => resolve41());
575507
+ onChildExit(child, () => resolve41());
575508
+ onChildError(child, () => resolve41());
575439
575509
  });
575440
575510
  jsonResponse(res, 200, {
575441
575511
  command: cmd,
@@ -576157,7 +576227,7 @@ ${historyLines}
576157
576227
  child.stderr?.on("data", () => {
576158
576228
  });
576159
576229
  await new Promise((resolve41) => {
576160
- child.on("close", () => {
576230
+ onChildClose(child, () => {
576161
576231
  if (lineBuffer.trim()) finalLines.push(lineBuffer);
576162
576232
  const rawFinal = finalLines.join("\n").trim();
576163
576233
  let backendError;
@@ -576262,7 +576332,7 @@ ${historyLines}
576262
576332
  resolve41();
576263
576333
  }
576264
576334
  };
576265
- child.on("close", finish);
576335
+ onChildClose(child, finish);
576266
576336
  const deadline = setTimeout(() => {
576267
576337
  if (done) return;
576268
576338
  killedByDeadline = true;
@@ -578127,6 +578197,7 @@ var init_serve = __esm({
578127
578197
  init_render2();
578128
578198
  init_profiles();
578129
578199
  init_docker();
578200
+ init_typed_node_events();
578130
578201
  endpointRegistry = [];
578131
578202
  modelRouteMap = /* @__PURE__ */ new Map();
578132
578203
  endpointUsage = /* @__PURE__ */ new Map();
@@ -585273,7 +585344,7 @@ async function runBackground(task, config, opts) {
585273
585344
  child.stderr?.on("data", (chunk) => {
585274
585345
  output += chunk.toString();
585275
585346
  });
585276
- child.on("exit", (code8) => {
585347
+ onChildExit(child, (code8) => {
585277
585348
  try {
585278
585349
  const result = output.trim() ? JSON.parse(output) : { status: code8 === 0 ? "completed" : "failed" };
585279
585350
  job.status = result.status || (code8 === 0 ? "completed" : "failed");
@@ -585338,6 +585409,7 @@ var init_run = __esm({
585338
585409
  "use strict";
585339
585410
  init_interactive();
585340
585411
  init_dist8();
585412
+ init_typed_node_events();
585341
585413
  }
585342
585414
  });
585343
585415
 
@@ -585900,6 +585972,7 @@ var init_serve2 = __esm({
585900
585972
  init_dist();
585901
585973
  init_output();
585902
585974
  init_serve();
585975
+ init_typed_node_events();
585903
585976
  }
585904
585977
  });
585905
585978
 
@@ -586102,12 +586175,14 @@ var init_eval = __esm({
586102
586175
  init_config();
586103
586176
  init_output();
586104
586177
  init_updater();
586178
+ init_typed_node_events();
586105
586179
  import { parseArgs as nodeParseArgs2 } from "node:util";
586106
586180
  import { createRequire as createRequire6 } from "node:module";
586107
586181
  import { fileURLToPath as fileURLToPath19 } from "node:url";
586108
586182
  import { dirname as dirname32, join as join109 } from "node:path";
586109
586183
 
586110
586184
  // packages/cli/src/cli.ts
586185
+ init_typed_node_events();
586111
586186
  import { createInterface } from "node:readline";
586112
586187
  function createCli(options2) {
586113
586188
  return {
@@ -586123,7 +586198,7 @@ function createCli(options2) {
586123
586198
  prompt: "> "
586124
586199
  });
586125
586200
  rl.prompt();
586126
- rl.on("line", async (line) => {
586201
+ onReadlineLine(rl, async (line) => {
586127
586202
  const input = line.trim();
586128
586203
  if (!input) {
586129
586204
  rl.prompt();
@@ -586139,7 +586214,7 @@ function createCli(options2) {
586139
586214
  console.log("");
586140
586215
  rl.prompt();
586141
586216
  });
586142
- rl.on("close", () => {
586217
+ onReadlineClose(rl, () => {
586143
586218
  process.exit(0);
586144
586219
  });
586145
586220
  }
@@ -586406,7 +586481,7 @@ async function main() {
586406
586481
  const p2 = spawn27(process.execPath, [file], { stdio: ["ignore", "pipe", "pipe"] });
586407
586482
  p2.stdout.on("data", (d2) => process.stdout.write(d2));
586408
586483
  p2.stderr.on("data", (d2) => process.stdout.write(d2));
586409
- p2.on("exit", (code8) => code8 === 0 ? resolve41() : reject(new Error(`${file} exited ${code8}`)));
586484
+ onChildExit(p2, (code8) => code8 === 0 ? resolve41() : reject(new Error(`${file} exited ${code8}`)));
586410
586485
  });
586411
586486
  const base3 = process.cwd();
586412
586487
  await run(`${base3}/eval/test-crossmodal.mjs`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.379",
3
+ "version": "0.187.381",
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",