@askalf/dario 5.5.6 → 5.5.7

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 +14 -3
  2. package/package.json +1 -1
package/dist/proxy.js CHANGED
@@ -615,9 +615,20 @@ const ORCHESTRATION_PATTERNS_DEFAULT = buildOrchestrationPatterns();
615
615
  /** Strip orchestration wrapper tags from message content. */
616
616
  function sanitizeContent(text, patterns) {
617
617
  let result = text;
618
- for (const pattern of patterns) {
619
- pattern.lastIndex = 0;
620
- result = result.replace(pattern, '');
618
+ // Fast path: every pattern in buildOrchestrationPatterns is anchored on a
619
+ // literal `<`, so a body with no `<` cannot match any of them — skip the
620
+ // ~28 full-string regex passes. sanitizeMessages runs on EVERY request,
621
+ // including byte-faithful CC traffic, and most message blocks (prose user
622
+ // turns, command/tool output) carry no tag; on a realistic mix this drops
623
+ // ~80% of the scrub's CPU while producing byte-identical output (the loop
624
+ // is skipped only when it provably cannot change the string). The trailing
625
+ // whitespace normalization still runs so no-tag blocks are treated exactly
626
+ // as before.
627
+ if (result.indexOf('<') !== -1) {
628
+ for (const pattern of patterns) {
629
+ pattern.lastIndex = 0;
630
+ result = result.replace(pattern, '');
631
+ }
621
632
  }
622
633
  return result.replace(/\n{3,}/g, '\n\n').trim();
623
634
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askalf/dario",
3
- "version": "5.5.6",
3
+ "version": "5.5.7",
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": {