open-agents-ai 0.185.84 → 0.185.86

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 +60 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -68073,12 +68073,30 @@ Respond conversationally. Call task_complete with your final response.`;
68073
68073
  child.stderr?.on("data", () => {
68074
68074
  });
68075
68075
  child.on("close", () => {
68076
- if (!fullContent && rawBuffer.trim()) {
68076
+ if (rawBuffer.trim()) {
68077
+ for (const line of rawBuffer.split("\n")) {
68078
+ if (!line.trim())
68079
+ continue;
68080
+ try {
68081
+ const evt = JSON.parse(line);
68082
+ if (evt.type === "text" && evt.content && !fullContent.includes(evt.content)) {
68083
+ fullContent += evt.content + "\n";
68084
+ res.write("data: " + JSON.stringify({
68085
+ id: `chatcmpl-${session.id.slice(0, 8)}`,
68086
+ object: "chat.completion.chunk",
68087
+ choices: [{ index: 0, delta: { content: evt.content + "\n" }, finish_reason: null }]
68088
+ }) + "\n\n");
68089
+ }
68090
+ } catch {
68091
+ }
68092
+ }
68093
+ }
68094
+ if (!fullContent) {
68077
68095
  try {
68078
- const result = JSON.parse(rawBuffer.trim());
68079
- const summary = result.summary || "";
68080
- const match = summary.match(/Tokens:\s*[\d,]+\s+([\s\S]*)/);
68081
- const cleanContent = match ? match[1].trim() : summary;
68096
+ const result = JSON.parse(rawBuffer.trim().split("\n").pop() || "{}");
68097
+ const summary = result.summary || result.text || "";
68098
+ const match = summary.match ? summary.match(/Tokens:\s*[\d,]+\s+([\s\S]*)/) : null;
68099
+ const cleanContent = match ? match[1].trim() : result.text || summary;
68082
68100
  if (cleanContent) {
68083
68101
  fullContent = cleanContent;
68084
68102
  res.write("data: " + JSON.stringify({
@@ -68112,26 +68130,31 @@ Respond conversationally. Call task_complete with your final response.`;
68112
68130
  });
68113
68131
  await new Promise((resolve36) => child.on("close", resolve36));
68114
68132
  let content = "";
68115
- try {
68116
- const result = JSON.parse(output.trim());
68117
- const summary = result.summary || "";
68118
- const match = summary.match(/Tokens:\s*[\d,]+\s+([\s\S]*)/);
68119
- content = match ? match[1].trim() : summary;
68120
- } catch {
68121
- for (const line of output.split("\n")) {
68122
- if (!line.trim())
68123
- continue;
68124
- try {
68125
- const evt = JSON.parse(line);
68126
- if (evt.status === "completed") {
68133
+ let summaryContent = "";
68134
+ for (const line of output.split("\n")) {
68135
+ if (!line.trim())
68136
+ continue;
68137
+ try {
68138
+ const evt = JSON.parse(line);
68139
+ if (evt.type === "text" && evt.content) {
68140
+ const t = evt.content;
68141
+ const skip = /^(open-agents |i Context|⚡ |✅ |✔ |Tokens:|Previous conversation:|Respond conversationally|▸ Stream|▹ )/.test(t) || t === "\u2714 Done" || t === "\u2705 Complete";
68142
+ if (!skip)
68143
+ content += t + "\n";
68144
+ } else if (evt.status === "completed" || evt.status === "failed") {
68145
+ if (evt.text)
68146
+ content = evt.text;
68147
+ if (!content.trim()) {
68127
68148
  const summary = evt.summary || "";
68128
68149
  const match = summary.match(/Tokens:\s*[\d,]+\s+([\s\S]*)/);
68129
- content = match ? match[1].trim() : summary;
68150
+ summaryContent = match ? match[1].trim() : summary;
68130
68151
  }
68131
- } catch {
68132
68152
  }
68153
+ } catch {
68133
68154
  }
68134
68155
  }
68156
+ if (!content.trim())
68157
+ content = summaryContent;
68135
68158
  addAssistantMessage(session, content.trim());
68136
68159
  jsonResponse(res, 200, {
68137
68160
  session_id: session.id,
@@ -73618,12 +73641,25 @@ async function runCommand(opts, config) {
73618
73641
  async function runJson(task, config, repoPath) {
73619
73642
  const startTime = Date.now();
73620
73643
  const origWrite = process.stdout.write.bind(process.stdout);
73644
+ const origStderr = process.stderr.write.bind(process.stderr);
73621
73645
  const captured = [];
73646
+ let assistantText = "";
73647
+ let textBuffer = "";
73622
73648
  process.stdout.write = ((chunk, ...args) => {
73623
- if (typeof chunk === "string")
73649
+ if (typeof chunk === "string") {
73624
73650
  captured.push(chunk);
73651
+ const clean = chunk.replace(/\x1B\[[0-9;]*[A-Za-z]/g, "").replace(/\x1B\].*?\x07/g, "").replace(/\x1B[78]/g, "");
73652
+ if (clean.trim()) {
73653
+ const stripped = clean.replace(/[▸▹⎿]/g, "").trim();
73654
+ if (stripped.length > 0 && !stripped.startsWith("\x1B") && stripped.length < 5e3) {
73655
+ textBuffer += stripped + "\n";
73656
+ origWrite(JSON.stringify({ type: "text", content: stripped }) + "\n");
73657
+ }
73658
+ }
73659
+ }
73625
73660
  return true;
73626
73661
  });
73662
+ process.stderr.write = (() => true);
73627
73663
  let result;
73628
73664
  try {
73629
73665
  await runWithTUI(task, config, repoPath);
@@ -73642,6 +73678,10 @@ async function runJson(task, config, repoPath) {
73642
73678
  };
73643
73679
  }
73644
73680
  process.stdout.write = origWrite;
73681
+ process.stderr.write = origStderr;
73682
+ if (textBuffer.trim()) {
73683
+ result.text = textBuffer.trim();
73684
+ }
73645
73685
  process.stdout.write(JSON.stringify(result, null, 2) + "\n");
73646
73686
  if (result.exitCode !== 0)
73647
73687
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.185.84",
3
+ "version": "0.185.86",
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",