@askalf/dario 3.10.0 → 3.10.2

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.
@@ -291,6 +291,28 @@ export function buildCCRequest(clientBody, billingTag, cache1h, identity, opts =
291
291
  }
292
292
  }
293
293
  }
294
+ // ── Drop trailing empty turns ──
295
+ // An assistant turn that was thinking-only before the strip above becomes
296
+ // content: []. Forwarding that shape makes Anthropic interpret the request
297
+ // as a prefill ("continue from this assistant text"), which Opus 4.6 under
298
+ // adaptive thinking + the claude-code beta refuses with:
299
+ // "This model does not support assistant message prefill. The
300
+ // conversation must end with a user message."
301
+ // Drop ONLY empty trailing turns. Do not pop trailing assistant turns that
302
+ // still carry text or tool_use content — v3.10.1 popped any trailing
303
+ // assistant and that caused a runaway loop in OpenClaw (#37): the client
304
+ // appended its assistant reply locally, dario stripped it from the next
305
+ // request, the model regenerated the same reply, dario stripped that, and
306
+ // the loop never terminated (133 POSTs from a single user prompt).
307
+ while (messages.length > 0) {
308
+ const last = messages[messages.length - 1];
309
+ const contentEmpty = Array.isArray(last.content) && last.content.length === 0;
310
+ if (contentEmpty) {
311
+ messages.pop();
312
+ continue;
313
+ }
314
+ break;
315
+ }
294
316
  // ── Build tool mapping ──
295
317
  // In preserveTools mode, skip the tool name/arg rewriting entirely.
296
318
  // Tool routing in real agents requires bidirectional schema fidelity that
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askalf/dario",
3
- "version": "3.10.0",
3
+ "version": "3.10.2",
4
4
  "description": "A local LLM router. One endpoint, every provider — Claude subscriptions, OpenAI, OpenRouter, Groq, local LiteLLM, any OpenAI-compat endpoint — your tools don't need to change.",
5
5
  "type": "module",
6
6
  "bin": {