open-agents-ai 0.185.93 → 0.185.94

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 +29 -35
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -68141,48 +68141,42 @@ Respond conversationally. Call task_complete with your final response.`;
68141
68141
  child.stderr?.on("data", () => {
68142
68142
  });
68143
68143
  child.on("close", () => {
68144
- if (rawBuffer.trim()) {
68145
- for (const line of rawBuffer.split("\n")) {
68146
- if (!line.trim())
68147
- continue;
68148
- try {
68149
- const evt = JSON.parse(line);
68150
- if (evt.type === "text" && evt.content && !fullContent.includes(evt.content)) {
68151
- fullContent += evt.content + "\n";
68152
- res.write("data: " + JSON.stringify({
68153
- id: `chatcmpl-${session.id.slice(0, 8)}`,
68154
- object: "chat.completion.chunk",
68155
- choices: [{ index: 0, delta: { content: evt.content + "\n" }, finish_reason: null }]
68156
- }) + "\n\n");
68157
- }
68158
- } catch {
68159
- }
68160
- }
68161
- }
68162
68144
  if (!fullContent) {
68145
+ const allOutput = rawBuffer.trim();
68163
68146
  try {
68164
- const result = JSON.parse(rawBuffer.trim().split("\n").pop() || "{}");
68165
- const summary = result.summary || result.text || "";
68166
- const match = summary.match ? summary.match(/Tokens:\s*[\d,]+\s+([\s\S]*)/) : null;
68167
- const cleanContent = match ? match[1].trim() : result.text || summary;
68168
- if (cleanContent) {
68169
- fullContent = cleanContent;
68147
+ const result = JSON.parse(allOutput);
68148
+ const summary = result.summary || "";
68149
+ const summaryMatch = summary.match(/Tokens:\s*[\d,]+\s+([\s\S]*)/);
68150
+ let content = summaryMatch ? summaryMatch[1].trim() : "";
68151
+ if (content.length < 20 && result.text) {
68152
+ const textMatch = result.text.match(/Tokens:[\s\S]*?\n\s*([\s\S]+?)$/);
68153
+ if (textMatch)
68154
+ content = textMatch[1].trim();
68155
+ }
68156
+ if (!content)
68157
+ content = summary;
68158
+ fullContent = content;
68159
+ res.write("data: " + JSON.stringify({
68160
+ id: `chatcmpl-${session.id.slice(0, 8)}`,
68161
+ object: "chat.completion.chunk",
68162
+ choices: [{ index: 0, delta: { content }, finish_reason: null }]
68163
+ }) + "\n\n");
68164
+ res.write("data: " + JSON.stringify({
68165
+ type: "complete",
68166
+ turns: summary.match(/(\d+) turns/)?.[1],
68167
+ tokens: summary.match(/Tokens:\s*([\d,]+)/)?.[1],
68168
+ toolCalls: parseInt(summary.match(/(\d+) tool calls/)?.[1] || "0", 10),
68169
+ duration: result.durationMs
68170
+ }) + "\n\n");
68171
+ } catch {
68172
+ if (allOutput) {
68173
+ fullContent = allOutput.slice(0, 500);
68170
68174
  res.write("data: " + JSON.stringify({
68171
68175
  id: `chatcmpl-${session.id.slice(0, 8)}`,
68172
68176
  object: "chat.completion.chunk",
68173
- choices: [{ index: 0, delta: { content: cleanContent }, finish_reason: null }]
68174
- }) + "\n\n");
68175
- const turns = summary.match(/(\d+) turns/)?.[1];
68176
- const tokens = summary.match(/Tokens:\s*([\d,]+)/)?.[1];
68177
- res.write("data: " + JSON.stringify({
68178
- type: "complete",
68179
- turns,
68180
- tokens,
68181
- duration: result.durationMs,
68182
- toolCalls: parseInt(summary.match(/(\d+) tool calls/)?.[1] || "0", 10)
68177
+ choices: [{ index: 0, delta: { content: fullContent }, finish_reason: null }]
68183
68178
  }) + "\n\n");
68184
68179
  }
68185
- } catch {
68186
68180
  }
68187
68181
  }
68188
68182
  addAssistantMessage(session, fullContent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.185.93",
3
+ "version": "0.185.94",
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",