@askalf/dario 4.8.135 → 4.8.136

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.
@@ -56,12 +56,33 @@ export declare const CC_TOOL_DEFINITIONS: {
56
56
  description: string;
57
57
  input_schema: Record<string, unknown>;
58
58
  }[];
59
+ /** The UNFILTERED bundled union — every tool the bake knows across platforms
60
+ * (PLATFORM_ONLY_TOOLS keeps the bundle a superset). The identity-mapping,
61
+ * detection, and advertise paths intersect with what the CLIENT declared,
62
+ * and the client's declaration already encodes its platform — a Linux CC
63
+ * never declares PowerShell. Filtering those paths by the PROXY HOST's
64
+ * process.platform (pre-v4.8.136) made a Linux-hosted dario treat a win32
65
+ * client's PowerShell/Glob/Grep as non-native: PowerShell fell to the
66
+ * unmapped round-robin, and all three were dropped from the advertised
67
+ * array (Glob/Grep translated via lowercase aliases but were never sent
68
+ * upstream). Host-filtered CC_TOOL_DEFINITIONS stays correct for the paths
69
+ * with no client declaration to mirror: the full-template fallback, the
70
+ * merge-mode base array, and Fable's no-tools shape. */
71
+ export declare const CC_TOOL_DEFINITIONS_UNION: {
72
+ name: string;
73
+ description: string;
74
+ input_schema: Record<string, unknown>;
75
+ }[];
76
+ export declare const CC_NATIVE_NAMES_UNION: Set<string>;
59
77
  /** CC's own tool names, EXACT case ("Read", "Bash", "Agent", …). A CC client's
60
78
  * tools identity-map to themselves and OVERRIDE TOOL_MAP — whose lowercase
61
79
  * cross-client aliases ('read' → {path}/{filePath}) would otherwise mistranslate
62
80
  * a CC tool (Read's file_path → path). Exact case is the discriminator: CC sends
63
81
  * PascalCase, the {path}-style clients send lowercase/snake, so a non-CC `read`
64
- * still routes through TOOL_MAP. Tracks the live bundle (refreshed each bake). */
82
+ * still routes through TOOL_MAP. Tracks the live bundle (refreshed each bake).
83
+ * HOST-filtered — the routing, detection, and advertise paths use the
84
+ * _UNION variants below so a client on a different platform than the proxy
85
+ * host still identity-maps (v4.8.136). */
65
86
  export declare const CC_NATIVE_NAMES: Set<string>;
66
87
  /** MCP tools attached to a CC session are namespaced `mcp__<server>__<tool>`.
67
88
  * Real CC advertises them VERBATIM after its built-ins — the schemas are
@@ -66,12 +66,29 @@ export const INTERACTIVE_ONLY_TOOLS = new Set([
66
66
  ]);
67
67
  /** CC's exact tool definitions for the current platform — filtered from the bundled union. */
68
68
  export const CC_TOOL_DEFINITIONS = filterToolsForPlatform(TEMPLATE.tools, process.platform);
69
+ /** The UNFILTERED bundled union — every tool the bake knows across platforms
70
+ * (PLATFORM_ONLY_TOOLS keeps the bundle a superset). The identity-mapping,
71
+ * detection, and advertise paths intersect with what the CLIENT declared,
72
+ * and the client's declaration already encodes its platform — a Linux CC
73
+ * never declares PowerShell. Filtering those paths by the PROXY HOST's
74
+ * process.platform (pre-v4.8.136) made a Linux-hosted dario treat a win32
75
+ * client's PowerShell/Glob/Grep as non-native: PowerShell fell to the
76
+ * unmapped round-robin, and all three were dropped from the advertised
77
+ * array (Glob/Grep translated via lowercase aliases but were never sent
78
+ * upstream). Host-filtered CC_TOOL_DEFINITIONS stays correct for the paths
79
+ * with no client declaration to mirror: the full-template fallback, the
80
+ * merge-mode base array, and Fable's no-tools shape. */
81
+ export const CC_TOOL_DEFINITIONS_UNION = TEMPLATE.tools;
82
+ export const CC_NATIVE_NAMES_UNION = new Set(TEMPLATE.tools.map((t) => String(t.name)));
69
83
  /** CC's own tool names, EXACT case ("Read", "Bash", "Agent", …). A CC client's
70
84
  * tools identity-map to themselves and OVERRIDE TOOL_MAP — whose lowercase
71
85
  * cross-client aliases ('read' → {path}/{filePath}) would otherwise mistranslate
72
86
  * a CC tool (Read's file_path → path). Exact case is the discriminator: CC sends
73
87
  * PascalCase, the {path}-style clients send lowercase/snake, so a non-CC `read`
74
- * still routes through TOOL_MAP. Tracks the live bundle (refreshed each bake). */
88
+ * still routes through TOOL_MAP. Tracks the live bundle (refreshed each bake).
89
+ * HOST-filtered — the routing, detection, and advertise paths use the
90
+ * _UNION variants below so a client on a different platform than the proxy
91
+ * host still identity-maps (v4.8.136). */
75
92
  export const CC_NATIVE_NAMES = new Set(CC_TOOL_DEFINITIONS.map((t) => String(t.name)));
76
93
  /** MCP tools attached to a CC session are namespaced `mcp__<server>__<tool>`.
77
94
  * Real CC advertises them VERBATIM after its built-ins — the schemas are
@@ -551,7 +568,9 @@ export function detectNonCCByTools(clientTools) {
551
568
  // routing agree. An ALL-mcp surface now scores ratio 0 and stays in default
552
569
  // mode — safe, because the advertise path sends an mcp-only declaration
553
570
  // verbatim rather than falling back to the full CC template.
554
- if (!TOOL_MAP[rawName.toLowerCase()] && !CC_NATIVE_NAMES.has(rawName) && !isMcpToolName(rawName))
571
+ // Union set, not the host-filtered one: a win32 client's PowerShell is
572
+ // native regardless of the platform dario itself runs on (v4.8.136).
573
+ if (!TOOL_MAP[rawName.toLowerCase()] && !CC_NATIVE_NAMES_UNION.has(rawName) && !isMcpToolName(rawName))
555
574
  unmapped++;
556
575
  }
557
576
  const ratio = unmapped / clientTools.length;
@@ -1360,7 +1379,10 @@ export function buildCCRequest(clientBody, billingTag, cacheControl, identity, o
1360
1379
  // Exact case is the discriminator (CC sends PascalCase; {path}-style clients
1361
1380
  // send lowercase/snake) so a genuine non-CC `read` still routes via TOOL_MAP.
1362
1381
  // Tracks the live bundle, so future CC tools are covered after the next bake.
1363
- const mapping = CC_NATIVE_NAMES.has(tool.name) || isMcpToolName(tool.name)
1382
+ // UNION set: identity must hold for a win32 client's PowerShell/Glob/Grep
1383
+ // even when dario itself runs on Linux (v4.8.136) — the exact-case check
1384
+ // still keeps a non-CC lowercase `glob`/`grep` on its TOOL_MAP alias.
1385
+ const mapping = CC_NATIVE_NAMES_UNION.has(tool.name) || isMcpToolName(tool.name)
1364
1386
  ? { ccTool: tool.name, translateArgs: (a) => a, translateBack: (a) => a }
1365
1387
  : TOOL_MAP[name];
1366
1388
  if (mapping) {
@@ -1398,8 +1420,8 @@ export function buildCCRequest(clientBody, billingTag, cacheControl, identity, o
1398
1420
  const CC_FALLBACK_TOOLS = ['Bash', 'Read', 'Grep', 'Glob', 'WebSearch', 'WebFetch'];
1399
1421
  for (const tool of clientTools) {
1400
1422
  const name = (tool.name || '').toLowerCase();
1401
- if (CC_NATIVE_NAMES.has(tool.name) || isMcpToolName(tool.name) || TOOL_MAP[name])
1402
- continue; // CC-native / MCP (identity in pass 1) or mapped
1423
+ if (CC_NATIVE_NAMES_UNION.has(tool.name) || isMcpToolName(tool.name) || TOOL_MAP[name])
1424
+ continue; // CC-native (union) / MCP (identity in pass 1) or mapped
1403
1425
  unmappedTools.push(tool.name);
1404
1426
  if (opts.hybridTools)
1405
1427
  continue; // dropped — see comment above
@@ -1592,7 +1614,11 @@ export function buildCCRequest(clientBody, billingTag, cacheControl, identity, o
1592
1614
  const clientToolNames = new Set(clientTools
1593
1615
  .map((t) => t.name?.toLowerCase())
1594
1616
  .filter((n) => Boolean(n)));
1595
- const availableCC = CC_TOOL_DEFINITIONS.filter((t) => clientToolNames.has(t.name.toLowerCase()));
1617
+ // Intersect against the UNION, not the host-filtered set: the client's
1618
+ // declaration encodes the client's platform, so a win32 CC declaring
1619
+ // PowerShell/Glob/Grep gets their canonical defs even from a Linux-hosted
1620
+ // dario. The host filter only governs the no-declaration fallbacks.
1621
+ const availableCC = CC_TOOL_DEFINITIONS_UNION.filter((t) => clientToolNames.has(t.name.toLowerCase()));
1596
1622
  const mcpTools = clientTools.filter((t) => isMcpToolName(t.name));
1597
1623
  ccRequest.tools = availableCC.length > 0 || mcpTools.length > 0
1598
1624
  ? [...availableCC, ...mcpTools]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askalf/dario",
3
- "version": "4.8.135",
3
+ "version": "4.8.136",
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": {