miii-agent 0.1.33 → 0.1.34

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/cli.js +19 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -244,9 +244,13 @@ async function* chat(entry, model, messages, tools, opts) {
244
244
  }
245
245
  throw err;
246
246
  }
247
+ let sawOutput = false;
247
248
  try {
248
249
  for await (const chunk of stream) {
249
250
  if (signal?.aborted) break;
251
+ if (chunk.message.content || chunk.message.thinking || (chunk.message.tool_calls?.length ?? 0) > 0) {
252
+ sawOutput = true;
253
+ }
250
254
  yield {
251
255
  content: stripHarmony(chunk.message.content),
252
256
  thinking: stripHarmony(chunk.message.thinking),
@@ -266,8 +270,13 @@ async function* chat(entry, model, messages, tools, opts) {
266
270
  }
267
271
  const msg = err instanceof Error ? err.message : String(err);
268
272
  if (msg.includes("Did not receive done or success response in stream")) {
269
- yield { content: "", done: true, prompt_eval_count: 0, eval_count: 0 };
270
- return;
273
+ if (sawOutput) {
274
+ yield { content: "", done: true, prompt_eval_count: 0, eval_count: 0 };
275
+ return;
276
+ }
277
+ throw new Error(
278
+ "Ollama closed the stream before sending any output \u2014 the model likely unloaded, ran out of memory, or crashed mid-request. Check `ollama ps`, then retry or switch to a smaller model."
279
+ );
271
280
  }
272
281
  throw err;
273
282
  } finally {
@@ -2103,6 +2112,14 @@ async function* runAgent(opts) {
2103
2112
  yield { type: "turn-end", stop_reason: "tool_use" };
2104
2113
  continue;
2105
2114
  }
2115
+ if (assistantText.trim() === "") {
2116
+ yield {
2117
+ type: "error",
2118
+ message: "The model returned an empty response \u2014 likely unloaded/OOM mid-stream or the output cap was consumed by thinking before any answer. Retry, switch models, or lower the context/effort."
2119
+ };
2120
+ yield { type: "done", prompt_tokens: promptTokens, eval_tokens: evalTokens };
2121
+ return history;
2122
+ }
2106
2123
  endedCleanly = true;
2107
2124
  yield { type: "turn-end", stop_reason: "end_turn" };
2108
2125
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miii-agent",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "description": "Local AI coding agent for your terminal — an open-source, offline alternative to Claude Code, Cursor, and GitHub Copilot, powered by Ollama. Private by default, free forever.",
5
5
  "type": "module",
6
6
  "bin": {