@askalf/dario 4.8.88 → 4.8.89

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.
@@ -213,11 +213,18 @@ export declare function detectTextToolClient(systemText: string): string | null;
213
213
  * per-client maintenance.
214
214
  *
215
215
  * Threshold reasoning:
216
- * - len < 3: too few tools to be confident; let the existing detector
217
- * decide. Single-purpose bridges and partial loads land here.
218
- * - 80% unmapped: leaves room for a non-CC client that legitimately
219
- * reuses 1-2 of TOOL_MAP's bash/grep/read aliases. 100% would miss
220
- * those; 50% would catch Cline forks that use 4 mapped + 4 custom.
216
+ * - 100% unmapped (ANY size, including 1-2 tools): unambiguously non-CC. A real
217
+ * CC client always carries Bash + Read — both TOOL_MAP keys once lowercased —
218
+ * so it can never present a fully-unmapped surface; only a foreign tool set
219
+ * can. This is what catches the small in-house clients the 3-tool rule below
220
+ * misses, e.g. forge inspection agents dispatched with just their capability
221
+ * floor ([memory_store, db_query]). Before this, those 2-tool surfaces fell
222
+ * under a len<3 guard and got round-robined onto CC fallback slots, which
223
+ * silently corrupts every call (the model upstream never sees the real tool).
224
+ * - Mixed surface (some tools map): require 3+ tools AND ≥80% unmapped. The 80%
225
+ * leaves room for a non-CC client that legitimately reuses 1-2 of TOOL_MAP's
226
+ * bash/grep/read aliases; the 3-tool floor avoids mis-flagging a partial CC
227
+ * load (1-2 tools, some mapped) mid-handshake — those stay null and remap.
221
228
  */
222
229
  export declare function detectNonCCByTools(clientTools: Array<Record<string, unknown>> | undefined): string | null;
223
230
  /**
@@ -439,14 +439,21 @@ export function detectTextToolClient(systemText) {
439
439
  * per-client maintenance.
440
440
  *
441
441
  * Threshold reasoning:
442
- * - len < 3: too few tools to be confident; let the existing detector
443
- * decide. Single-purpose bridges and partial loads land here.
444
- * - 80% unmapped: leaves room for a non-CC client that legitimately
445
- * reuses 1-2 of TOOL_MAP's bash/grep/read aliases. 100% would miss
446
- * those; 50% would catch Cline forks that use 4 mapped + 4 custom.
442
+ * - 100% unmapped (ANY size, including 1-2 tools): unambiguously non-CC. A real
443
+ * CC client always carries Bash + Read — both TOOL_MAP keys once lowercased —
444
+ * so it can never present a fully-unmapped surface; only a foreign tool set
445
+ * can. This is what catches the small in-house clients the 3-tool rule below
446
+ * misses, e.g. forge inspection agents dispatched with just their capability
447
+ * floor ([memory_store, db_query]). Before this, those 2-tool surfaces fell
448
+ * under a len<3 guard and got round-robined onto CC fallback slots, which
449
+ * silently corrupts every call (the model upstream never sees the real tool).
450
+ * - Mixed surface (some tools map): require 3+ tools AND ≥80% unmapped. The 80%
451
+ * leaves room for a non-CC client that legitimately reuses 1-2 of TOOL_MAP's
452
+ * bash/grep/read aliases; the 3-tool floor avoids mis-flagging a partial CC
453
+ * load (1-2 tools, some mapped) mid-handshake — those stay null and remap.
447
454
  */
448
455
  export function detectNonCCByTools(clientTools) {
449
- if (!clientTools || clientTools.length < 3)
456
+ if (!clientTools || clientTools.length === 0)
450
457
  return null;
451
458
  let unmapped = 0;
452
459
  for (const tool of clientTools) {
@@ -454,9 +461,14 @@ export function detectNonCCByTools(clientTools) {
454
461
  if (!TOOL_MAP[name])
455
462
  unmapped++;
456
463
  }
457
- if (unmapped / clientTools.length >= 0.8) {
464
+ const ratio = unmapped / clientTools.length;
465
+ // Fully-unmapped surface → non-CC at any size. Real CC always has Bash+Read
466
+ // mapped, so ratio === 1 is unreachable for it; only a foreign client hits it.
467
+ if (ratio === 1)
468
+ return 'unknown-non-cc';
469
+ // Mixed surface: only flag once there are enough tools to be confident.
470
+ if (clientTools.length >= 3 && ratio >= 0.8)
458
471
  return 'unknown-non-cc';
459
- }
460
472
  return null;
461
473
  }
462
474
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askalf/dario",
3
- "version": "4.8.88",
3
+ "version": "4.8.89",
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": {