@askalf/dario 5.5.80 → 5.5.81

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/proxy.js +13 -6
  2. package/package.json +1 -1
package/dist/proxy.js CHANGED
@@ -756,16 +756,23 @@ export function sanitizeMessages(body, preserveTags) {
756
756
  // so keeping it is *more* wire-faithful, not less; for a non-CC client a
757
757
  // lone tag as the final turn is the actual prompt, and forwarding it beats
758
758
  // a hard 400. Every other position still scrubs exactly as before.
759
+ //
760
+ // This holds even when the tail was ALREADY empty before the scrub
761
+ // (dario#1117, second report). CC's stream-interruption retry appends a
762
+ // user turn with `content: []` as the final message — the shape the
763
+ // genuine-CC rewind in buildCCRequest (dario#1092) exists to recover. The
764
+ // message-level drop above ran first and removed that turn, and an
765
+ // "only restore a tail that had content" condition here let it go, so the
766
+ // template saw a request already ending on the assistant's real reply and
767
+ // upstream answered with the prefill rejection. Restoring an empty tail is
768
+ // never worse than dropping it: on the genuine-CC path #1092 rewinds the
769
+ // pair, and on the general path the upstream names the malformed turn
770
+ // accurately ("content must contain at least one block") — the #1033
771
+ // decision — instead of dario converting it into a misleading prefill 400.
759
772
  const tailWasDropped = tail !== undefined && kept[kept.length - 1] !== tail;
760
- const tailHadContent = Array.isArray(tailContentBeforeScrub)
761
- ? tailContentBeforeScrub.length > 0
762
- : typeof tailContentBeforeScrub === 'string'
763
- ? tailContentBeforeScrub !== ''
764
- : tailContentBeforeScrub != null;
765
773
  if (tail !== undefined &&
766
774
  tailWasDropped &&
767
775
  tail.role === 'user' &&
768
- tailHadContent &&
769
776
  kept.length > 0 &&
770
777
  kept[kept.length - 1].role === 'assistant') {
771
778
  tail.content = tailContentBeforeScrub;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askalf/dario",
3
- "version": "5.5.80",
3
+ "version": "5.5.81",
4
4
  "description": "Use your Claude Pro/Max subscription in any tool — Cursor, Cline, Aider, the Agent SDK, your scripts — at subscription pricing, not per-token API bills. One local Anthropic + OpenAI-compatible endpoint.",
5
5
  "type": "module",
6
6
  "bin": {