open-agents-ai 0.187.284 → 0.187.286

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 +70 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -328305,6 +328305,37 @@ function extractToolJson(text) {
328305
328305
  }
328306
328306
  return null;
328307
328307
  }
328308
+ function extractToolJsonLoose(text) {
328309
+ const stripped = text.replace(/```[a-zA-Z]*|```/g, "\n");
328310
+ const exact = extractToolJson(stripped);
328311
+ if (exact) return exact;
328312
+ const match = stripped.match(/[\{][\s\S]*[\}]/);
328313
+ if (match) {
328314
+ try {
328315
+ const obj = JSON.parse(match[0]);
328316
+ if (typeof obj.tool === "string") {
328317
+ const args2 = obj.args && typeof obj.args === "object" ? obj.args : {};
328318
+ return { name: obj.tool, args: args2 };
328319
+ }
328320
+ } catch {
328321
+ }
328322
+ }
328323
+ return null;
328324
+ }
328325
+ function stripToolJsonLines(text) {
328326
+ const lines = text.split(/\r?\n/);
328327
+ const kept = lines.filter((l2) => {
328328
+ const t2 = l2.trim();
328329
+ if (!t2.startsWith("{") || !t2.endsWith("}")) return true;
328330
+ try {
328331
+ const obj = JSON.parse(t2);
328332
+ return !(typeof obj.tool === "string");
328333
+ } catch {
328334
+ return true;
328335
+ }
328336
+ });
328337
+ return kept.join("\n").trim();
328338
+ }
328308
328339
  var VAD_SILENCE_MS, MAX_SEGMENT_MS, MAX_CONTEXT_TURNS, SYSTEM_PROMPT2, MIN_SIGNAL_SCORE, NOISE_ONLY_RE, VoiceChatSession;
328309
328340
  var init_voicechat = __esm({
328310
328341
  "packages/cli/src/tui/voicechat.ts"() {
@@ -328632,9 +328663,12 @@ ${out}` });
328632
328663
  } catch {
328633
328664
  }
328634
328665
  }
328635
- let response = await this.streamOllamaInference(this.abortController.signal);
328636
- const toolReq = extractToolJson(response);
328637
- if (toolReq && this.toolRelay) {
328666
+ let response = "";
328667
+ for (let i2 = 0; i2 < 3; i2++) {
328668
+ response = await this.streamOllamaInference(this.abortController.signal);
328669
+ if (!this.toolRelay) break;
328670
+ const toolReq = extractToolJsonLoose(response);
328671
+ if (!toolReq) break;
328638
328672
  const { name: name11, args: args2 } = toolReq;
328639
328673
  let toolOutput = "";
328640
328674
  try {
@@ -328648,7 +328682,6 @@ ${out}` });
328648
328682
  }
328649
328683
  this.context.push({ role: "system", content: `Tool ${name11} result (authoritative):
328650
328684
  ${toolOutput}` });
328651
- response = await this.streamOllamaInference(this.abortController.signal);
328652
328685
  }
328653
328686
  if (!this.active) return;
328654
328687
  if (this.heuristicsEnabled && this.toolRelay && /\b(can't|cannot)\b/i.test(response) && this.toolCatalogNote) {
@@ -328656,10 +328689,12 @@ ${toolOutput}` });
328656
328689
  response = await this.streamOllamaInference(this.abortController.signal);
328657
328690
  }
328658
328691
  if (response.trim()) {
328659
- this.context.push({ role: "assistant", content: response.trim() });
328692
+ const finalSpoken = stripToolJsonLines(response.trim());
328693
+ this.context.push({ role: "assistant", content: finalSpoken });
328660
328694
  this.setState("SPEAKING");
328661
- this.onAgentSpeech(response.trim());
328662
- this.voice.speak(response.trim());
328695
+ this.onAgentSpeech(finalSpoken);
328696
+ this.voice.speak(finalSpoken);
328697
+ this.voiceTranscript.push({ role: "assistant", content: finalSpoken, ts: Date.now() });
328663
328698
  this.voiceTranscript.push({ role: "assistant", content: response.trim(), ts: Date.now() });
328664
328699
  if (this.runner) {
328665
328700
  this.injectSummary();
@@ -333328,14 +333363,40 @@ Respond concisely and safely. Remember: you are talking to the general public.`;
333328
333363
  }
333329
333364
  if (name11 === "voice_tool_catalog") {
333330
333365
  const cat2 = activeTask2?.runner.getToolCatalog() ?? [];
333331
- const allow = /* @__PURE__ */ new Set(["list_directory", "file_read", "grep_search", "find_files", "memory_read", "memory_search", "todo_read"]);
333366
+ const allow = /* @__PURE__ */ new Set([
333367
+ "list_directory",
333368
+ "file_read",
333369
+ "grep_search",
333370
+ "find_files",
333371
+ "memory_read",
333372
+ "memory_search",
333373
+ "todo_read",
333374
+ "codebase_map",
333375
+ "diagnostic",
333376
+ "git_info",
333377
+ "web_search",
333378
+ "web_fetch"
333379
+ ]);
333332
333380
  const filtered = cat2.filter((t2) => allow.has(t2.name));
333333
333381
  return JSON.stringify(filtered, null, 2);
333334
333382
  }
333335
333383
  if (name11 === "voice_tool_call") {
333336
333384
  const toolName = String(args2?.name || "").trim();
333337
333385
  const toolArgs = args2?.args || {};
333338
- const allow = /* @__PURE__ */ new Set(["list_directory", "file_read", "grep_search", "find_files", "memory_read", "memory_search", "todo_read"]);
333386
+ const allow = /* @__PURE__ */ new Set([
333387
+ "list_directory",
333388
+ "file_read",
333389
+ "grep_search",
333390
+ "find_files",
333391
+ "memory_read",
333392
+ "memory_search",
333393
+ "todo_read",
333394
+ "codebase_map",
333395
+ "diagnostic",
333396
+ "git_info",
333397
+ "web_search",
333398
+ "web_fetch"
333399
+ ]);
333339
333400
  if (!allow.has(toolName)) return `Tool not allowed: ${toolName}`;
333340
333401
  if (!activeTask2) return "No active task.";
333341
333402
  const result = await activeTask2.runner.runToolByName(toolName, toolArgs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.187.284",
3
+ "version": "0.187.286",
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",