🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@askalf/dario

Package Overview
Dependencies
Maintainers
1
Versions
363
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@askalf/dario - npm Package Compare versions

Comparing version
4.8.141
to
4.8.142
+61
-37
dist/cc-template.d.ts

@@ -375,18 +375,25 @@ /**

*
* Tracks CC's wire default. Evolution:
* - Apr 2026, CC ~2.1.116: effort = 'medium' (Discussion #13 documented this)
* - mid-May 2026: effort = 'high' (dario#87 pinned to match)
* - May 17 2026, CC 2.1.143: effort = 'xhigh' (verified by capture-full-body.mjs)
* Effort is a USER KNOB, not a wire constant: real CC sends whatever the
* user's effort setting is tuned to, and "what CC sends" in a capture is just
* that install's knob position. dario chased captured values for months
* ('medium' → 'high' → 'xhigh' across CC releases — each one somebody's
* setting, not a version default) and pinned the outbound effort to a fixed
* value, silently clamping every client's explicit choice. Since 4.8.142 the
* default is client-first, matching how real CC actually behaves:
*
* undefined → 'max' (highest *universally*-supported level. CC's own wire
* default is 'xhigh', but that's Opus/Fable-only — Sonnet/Haiku-class
* 400 on 'xhigh' ("supported: high|low|max|medium"). 'max' is
* accepted by all and still routes to the subscription pool
* (verified: representative-claim=five_hour on Opus + Sonnet).
* Set --effort=xhigh / DARIO_EFFORT=xhigh for the Opus/Fable tier.)
* 'low' / 'medium' / 'high' / 'xhigh' / 'max' → pin to that value
* undefined / 'client' → the client's `clientBody.output_config.effort`
* (normalized for the wire) — forward the knob untouched.
* Falls back to 'high' only when the client sent none
* (OpenAI-compat clients that can't set effort).
* 'low' / 'medium' / 'high' / 'xhigh' / 'max' → operator pin via
* --effort / DARIO_EFFORT (explicit override, wins over client)
* 'ultracode' → 'xhigh' (CC's ultracode mode; xhigh on the wire)
* 'client' → extract from `clientBody.output_config.effort` (normalized
* for the wire); fall back to the default if absent/non-string
*
* The 'high' fallback (not 'max') is dario#658 scar tissue: 'max' plus
* unbounded adaptive thinking exhausts max_tokens on long prompts — the
* stream ends `stop_reason: max_tokens` with ZERO text blocks. 'high' thinks
* proportionally and leaves room for the answer. A client that explicitly
* asks for 'max' gets 'max' — same outcome it would get talking to Anthropic
* directly.
*
* FABLE CLAMP — REMOVED 2026-07-01. Fable 5 was SUSPENDED 2026-06-12 (US-gov

@@ -399,8 +406,5 @@ * directive) and REDEPLOYED 2026-07-01. The pre-suspension model (2026-06-09

* — high/xhigh/max → end_turn, zero refusals. So the clamp + the fable-only
* default are gone: fable now takes the general path (no clamp), matching how
* dario treats opus. The general default is `high` (see resolveEffort below) —
* Claude Code's out-of-box default. Effort is a user-adjustable knob, so no
* single value is "the" value; `high` is the safe unconfigured baseline.
* `model` is retained in the signature in case a future model needs per-family
* effort handling again.
* default are gone: fable takes the general path, matching how dario treats
* opus. `model` is retained in the signature in case a future model needs
* per-family effort handling again.
*

@@ -447,24 +451,44 @@ * Exported for tests.

/**
* The cache-control dario stamps on every breakpoint (2 system + tools +
* conversation). `ttl: '1h'` mirrors real CC — dario shipped the 5-min
* ephemeral default, so its prefix expired 12x sooner than CC's and any
* interactive turn past the 5-min window re-created the whole prefix
* (system + all tools) at cache-creation cost, draining the Max window far
* faster than direct CC (root cause of dario#678). Single source of truth so
* the emitted TTL can't silently drift back to 5m.
* The cache-control dario stamps on every breakpoint (2 system + 2
* conversation). Plain `{type:'ephemeral'}` (the 5-minute default) mirrors
* real CC: a loopback MITM capture of CC v2.1.203 shows no `ttl` field on any
* breakpoint. v4.8.140 stamped `ttl:'1h'` here on the theory that real CC
* used 1h — it doesn't, and 1h cache WRITES bill at 2x base input vs 1.25x
* for 5m, so every write in a write-heavy agentic session cost 60% more than
* direct CC. The dario#678 re-test caught it: the reporter's cold-start burn
* went +8% -> +19% on the "fixed" build. Single source of truth so the
* emitted shape can't drift from CC again.
*/
export declare const CC_CACHE_CONTROL: CacheControl;
/**
* Place CC-style prompt-cache breakpoints on the tools array and the
* conversation. The system prompt is already cached at build time (2 system
* breakpoints); this adds the last tool + a single rolling breakpoint on the
* last message — total 4, the Anthropic max, mirroring Claude Code.
* Place CC-style prompt-cache breakpoints on the conversation. The system
* prompt is already cached at build time (2 system breakpoints); this adds a
* rolling breakpoint on the last user message plus an anchor on the previous
* one — total 4, the Anthropic max.
*
* Why: dario previously cached ONLY the system prompt and stripped every
* message breakpoint, so the tools schema (10-20KB) and the entire growing
* conversation re-billed as FRESH input every turn. Fleet cache-read ran ~1.9%
* vs CC's ~70-90%, draining the Max 5h/7d token window 10-50x faster — which is
* exactly why long agentic sessions hit a wall through dario that real CC
* sails through. CC genuinely caches tools + conversation, so NOT caching them
* was itself a wire divergence from CC. Exported for unit testing.
* Placement mirrors a live capture of CC v2.1.203 (dario#678):
*
* - Tools carry NO breakpoint. Real CC sends its tool array unstamped —
* Anthropic renders tools -> system -> messages, so the system breakpoints
* already cache the tools prefix. Stamping the last tool (pre-4.8.142) both
* diverged from CC's wire shape and spent the fourth slot the conversation
* anchor below needs.
*
* - The rolling breakpoint goes on the last USER message, not the last
* message. CC skips trailing role:"system" injections (agent-type updates
* etc.); stamping "the last message" meant any turn ending in one wrote no
* conversation entry at all, and the next request re-paid the entire
* history as fresh input.
*
* - The previous user message is anchored too. Anthropic's cache lookup
* walks back at most ~20 content blocks from a breakpoint; one parallel-
* tool turn (N tool_use + N tool_result blocks) can exceed that alone, and
* the rolling breakpoint then can't reach the prior turn's entry — the
* whole conversation re-bills at cache-WRITE cost every fan-out turn,
* which is the dario#678 burn ("read every file" sessions draining the
* Max window ~10x faster than direct CC). The anchor sits exactly where
* the previous request's rolling breakpoint was, so the lookup hits it
* positionally with no walk-back.
*
* Exported for unit testing.
*/

@@ -471,0 +495,0 @@ export declare function applyCcPromptCaching(ccRequest: Record<string, unknown>, cacheControl: CacheControl): void;

@@ -337,3 +337,3 @@ /**

// tokens on call 1, then cache_read on subsequent calls within the
// 1-hour TTL), but non-CC users routing heavy tooling get
// 5-minute TTL), but non-CC users routing heavy tooling get
// surprised by the first-request charge. Surface the size up front

@@ -359,3 +359,3 @@ // so they can plan.

`request. Cached after first hit; read-cost only on subsequent calls within ` +
`the 1-hour TTL. Exact token count surfaces as cache_creation_input_tokens ` +
`the 5-minute TTL. Exact token count surfaces as cache_creation_input_tokens ` +
`on the first response (or run \`dario doctor --usage\`).`,

@@ -362,0 +362,0 @@ });

@@ -545,4 +545,4 @@ /**

// [0] billing tag (no cache_control, tiny)
// [1] agent identity ("You are Claude Code..."), cache_control 1h
// [2] system prompt (~25KB), cache_control 1h
// [1] agent identity ("You are Claude Code..."), cache_control ephemeral (5m — no ttl field, verified CC v2.1.203)
// [2] system prompt (~25KB), cache_control ephemeral (5m)
// Billing tag is per-request — we never cache it. Identity + prompt are

@@ -549,0 +549,0 @@ // what we want.

@@ -74,2 +74,10 @@ /**

/**
* Advertised model ids — GET /v1/models (the upstream-autodetected
* catalog with the baked fallback, so a running proxy always answers).
* Returns the raw id list (base ids + generated `[1m]` variants) or
* null on any error so the Status tab renders without a Models panel
* instead of crashing.
*/
listModels(): Promise<string[] | null>;
/**
* Clear the overage-guard halt state. POSTs /admin/resume. Returns the

@@ -76,0 +84,0 @@ * server's response (`wasHalted` indicates whether the call actually

@@ -190,2 +190,20 @@ /**

/**
* Advertised model ids — GET /v1/models (the upstream-autodetected
* catalog with the baked fallback, so a running proxy always answers).
* Returns the raw id list (base ids + generated `[1m]` variants) or
* null on any error so the Status tab renders without a Models panel
* instead of crashing.
*/
async listModels() {
try {
const r = await this.getJson('/v1/models');
if (!Array.isArray(r.data))
return null;
return r.data.map((m) => String(m.id ?? '')).filter((id) => id.length > 0);
}
catch {
return null;
}
}
/**
* Clear the overage-guard halt state. POSTs /admin/resume. Returns the

@@ -192,0 +210,0 @@ * server's response (`wasHalted` indicates whether the call actually

@@ -21,2 +21,8 @@ /**

* └─────────────────────────────────────────────────┘
* ┌─ Models ────────────────────────────────────────┐
* │ claude-fable-5 +[1m] │
* │ claude-opus-4-8 +[1m] │
* │ claude-sonnet-5 +[1m] │
* │ …the advertised catalog, live from /v1/models │
* └─────────────────────────────────────────────────┘
*/

@@ -36,2 +42,4 @@ import type { Tab, TabContext } from '../tab.js';

configSource: 'file' | 'missing' | 'invalid' | null;
/** Advertised model ids from /v1/models — null if unreachable. */
models: string[] | null;
/** Overage-guard state from /admin/resume — null if unreachable. */

@@ -50,2 +58,14 @@ overageGuard: OverageGuardStatus | null;

/**
* Fold `<base>[1m]` variants onto their base id: the /v1/models listing
* advertises both forms for every long-context-capable family, and showing
* fourteen rows for seven models is noise. Preserves the catalog's order
* (family rank, version desc). A `[1m]`-only id with no base row (shouldn't
* happen — the generator always emits the pair) still gets its own row so
* nothing silently disappears. Exported for unit testing.
*/
export declare function foldLongContextVariants(ids: readonly string[]): Array<{
base: string;
has1m: boolean;
}>;
/**
* Refresh the Status tab's data — probe /health, load config file

@@ -52,0 +72,0 @@ * metadata. Exported separately so the parent can re-invoke on key

@@ -21,2 +21,8 @@ /**

* └─────────────────────────────────────────────────┘
* ┌─ Models ────────────────────────────────────────┐
* │ claude-fable-5 +[1m] │
* │ claude-opus-4-8 +[1m] │
* │ claude-sonnet-5 +[1m] │
* │ …the advertised catalog, live from /v1/models │
* └─────────────────────────────────────────────────┘
*/

@@ -34,2 +40,3 @@ import { fg, dim, brand } from '../render.js';

configSource: null,
models: null,
overageGuard: null,

@@ -117,2 +124,14 @@ resumePending: false,

lines.push('');
// ── Models section ─────────────────────────────────────────
// Live from the proxy's /v1/models (upstream-autodetected catalog,
// baked fallback) so newly-shipped families — Sonnet 5, Fable 5 —
// show up here without a TUI change. `[1m]` variants are folded
// onto their base id as a +[1m] marker instead of doubling the list.
if (state.models && state.models.length > 0) {
lines.push(' ' + brand('Models'));
for (const row of foldLongContextVariants(state.models)) {
lines.push(' ' + renderKvRow(row.base, row.has1m ? dim('+[1m]') : '', w - 4));
}
lines.push('');
}
// ── Overage-guard section (v4.1, dario#288) ────────────────

@@ -150,2 +169,36 @@ if (state.overageGuard) {

};
/**
* Fold `<base>[1m]` variants onto their base id: the /v1/models listing
* advertises both forms for every long-context-capable family, and showing
* fourteen rows for seven models is noise. Preserves the catalog's order
* (family rank, version desc). A `[1m]`-only id with no base row (shouldn't
* happen — the generator always emits the pair) still gets its own row so
* nothing silently disappears. Exported for unit testing.
*/
export function foldLongContextVariants(ids) {
const bases = [];
const seen = new Map();
for (const id of ids) {
const m = id.match(/^(.*)\[1m\]$/);
if (m) {
const existing = seen.get(m[1]);
if (existing) {
existing.has1m = true;
continue;
}
// [1m] before (or without) its base — record under the base id.
const row = { base: m[1], has1m: true };
seen.set(m[1], row);
bases.push(row);
continue;
}
const existing = seen.get(id);
if (existing)
continue;
const row = { base: id, has1m: false };
seen.set(id, row);
bases.push(row);
}
return bases;
}
function formatDuration(ms) {

@@ -182,5 +235,6 @@ if (ms <= 0)

}
// Overage-guard state — best-effort; never throws (proxy-client wraps the
// GET in try/catch and returns null). Surface as 'unknown' when null.
// Overage-guard state + model catalog — best-effort; never throw
// (proxy-client wraps both GETs in try/catch and returns null).
const overageGuard = await ctx.client.getOverageGuard();
const models = await ctx.client.listModels();
return {

@@ -190,2 +244,3 @@ loading: false,

configSource: fileResult.source,
models,
overageGuard,

@@ -192,0 +247,0 @@ resumePending: false,

{
"name": "@askalf/dario",
"version": "4.8.141",
"version": "4.8.142",
"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,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display