open-agents-ai 0.187.284 → 0.187.285

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 +42 -7
  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();
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.285",
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",