@askalf/dario 5.2.11 → 5.2.12

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.
package/dist/cli.js CHANGED
@@ -1287,13 +1287,15 @@ async function help() {
1287
1287
  intact even when a text-tool client is
1288
1288
  detected; use --preserve-tools per session
1289
1289
  when edits are needed. (dario#40)
1290
- --strict-tls Refuse to start proxy mode if this process
1291
- isn't running under Bun. Bun is what Claude
1292
- Code uses; matching its TLS stack keeps the
1290
+ --strict-tls Refuse to start proxy mode unless this process
1291
+ runs under Bun at a version whose JA3 is verified
1292
+ to match Claude Code (≥ v1.3.14). Bun is what
1293
+ Claude Code uses; matching its TLS stack keeps the
1293
1294
  proxy's JA3/JA4 ClientHello indistinguishable
1294
- from a stock CC request. Install Bun
1295
- (https://bun.sh) so dario auto-relaunches
1296
- under it. (v3.23)
1295
+ from a stock CC request but an older Bun ships an
1296
+ older BoringSSL whose ClientHello diverges (#813).
1297
+ Install/upgrade Bun (https://bun.sh) so dario
1298
+ auto-relaunches under it. (v3.23)
1297
1299
  --stealth Single-flag behavioral-stealth preset.
1298
1300
  Flips pace-jitter, think-time, and
1299
1301
  session-start defaults from 0 to non-zero
@@ -282,7 +282,7 @@ export declare function _resetInstalledVersionProbeForTest(): void;
282
282
  */
283
283
  export declare const SUPPORTED_CC_RANGE: {
284
284
  readonly min: "1.0.0";
285
- readonly maxTested: "2.1.214";
285
+ readonly maxTested: "2.1.215";
286
286
  };
287
287
  /**
288
288
  * Compare two dotted-numeric version strings. Returns negative if `a<b`,
@@ -806,7 +806,7 @@ export function _resetInstalledVersionProbeForTest() {
806
806
  */
807
807
  export const SUPPORTED_CC_RANGE = {
808
808
  min: '1.0.0',
809
- maxTested: '2.1.214',
809
+ maxTested: '2.1.215',
810
810
  };
811
811
  /**
812
812
  * Compare two dotted-numeric version strings. Returns negative if `a<b`,
package/dist/proxy.js CHANGED
@@ -1638,6 +1638,19 @@ export async function startProxy(opts = {}) {
1638
1638
  }
1639
1639
  // Strip query parameters for endpoint matching
1640
1640
  const urlPath = req.url?.split('?')[0] ?? '';
1641
+ // Liveness probe — always 200 while the HTTP server is accepting requests,
1642
+ // deliberately decoupled from OAuth state. Docker's healthcheck (and the
1643
+ // autoheal watchdog that keys on it) points HERE, not /health: a broken or
1644
+ // expired refresh token makes /health return 503, but a container restart
1645
+ // cannot mint a new token, so restarting on that is a pointless loop (one
1646
+ // shared-refresh-family outage thrashed dario for 4h+ this way). Readiness —
1647
+ // the 503-on-broken-OAuth verdict that uptime monitors and
1648
+ // `depends_on: service_healthy` need — stays on /health.
1649
+ if (urlPath === '/livez') {
1650
+ res.writeHead(200, JSON_HEADERS);
1651
+ res.end(JSON.stringify({ status: 'ok' }));
1652
+ return;
1653
+ }
1641
1654
  // Health check
1642
1655
  //
1643
1656
  // Returns HTTP 503 when OAuth is in a state that will cause every upstream
@@ -25,8 +25,16 @@
25
25
  */
26
26
  /** Canonical buckets the caller pivots on. */
27
27
  export type RuntimeFingerprintStatus =
28
- /** Running under Bun — TLS stack matches CC. */
28
+ /** Running under Bun ≥ the JA3-verified floor — TLS ClientHello matches CC. */
29
29
  'bun-match'
30
+ /**
31
+ * Running under Bun, but at a version below the JA3-verified floor: being on
32
+ * Bun is necessary but not sufficient. Older Bun ships an older BoringSSL
33
+ * whose ClientHello is not confirmed to match CC's (measured divergent on
34
+ * Bun 1.0.9 — see #813). Treated as a warn so an old Bun on PATH can't
35
+ * report a false-green match while emitting a divergent JA3.
36
+ */
37
+ | 'bun-ja3-unverified'
30
38
  /** Running under Node, Bun available on PATH but auto-relaunch was bypassed. */
31
39
  | 'bun-bypassed'
32
40
  /** Running under Node, Bun not installed. */
@@ -54,6 +62,24 @@ export interface RuntimeFingerprint {
54
62
  * the (~sub-100ms) cost when Bun is installed.
55
63
  */
56
64
  export declare function probeBunVersion(): string | undefined;
65
+ /**
66
+ * Lowest public Bun version whose TLS ClientHello (JA3) is *measured* to match
67
+ * the Bun/BoringSSL fingerprint Claude Code presents on the wire. Empirical
68
+ * basis (#813, macOS arm64): CC 2.1.214 embeds the Bun canary line and hashes
69
+ * to JA3 `e97f5146a7009cc2918b50e903b6ff8d`; bare public Bun 1.3.14 and canary
70
+ * reproduce it byte-for-byte, while Bun 1.0.9 diverges (adds 3DES, ECH,
71
+ * padding → `2ae7eb4b…`). The window between 1.0.9 and 1.3.14 is unmeasured,
72
+ * so anything below this floor is reported unverified rather than a green match.
73
+ */
74
+ export declare const JA3_VERIFIED_BUN_FLOOR = "1.3.14";
75
+ /**
76
+ * True when Bun `version` is at or above `floor`. Parses the leading
77
+ * `major.minor.patch` and ignores any pre-release/`-canary…` suffix, so Bun's
78
+ * canary tags (e.g. `1.4.0-canary.x`) compare as their base triple. Returns
79
+ * `undefined` when either string can't be parsed — the caller decides how to
80
+ * treat "can't tell" (we keep those as a best-effort match rather than warn).
81
+ */
82
+ export declare function bunVersionMeetsJa3Floor(version: string, floor?: string): boolean | undefined;
57
83
  /**
58
84
  * Synthesize the TLS-fingerprint status from three inputs. All three are
59
85
  * passed explicitly so tests can cover every combination without touching
@@ -51,6 +51,38 @@ export function probeBunVersion() {
51
51
  return undefined;
52
52
  }
53
53
  }
54
+ /**
55
+ * Lowest public Bun version whose TLS ClientHello (JA3) is *measured* to match
56
+ * the Bun/BoringSSL fingerprint Claude Code presents on the wire. Empirical
57
+ * basis (#813, macOS arm64): CC 2.1.214 embeds the Bun canary line and hashes
58
+ * to JA3 `e97f5146a7009cc2918b50e903b6ff8d`; bare public Bun 1.3.14 and canary
59
+ * reproduce it byte-for-byte, while Bun 1.0.9 diverges (adds 3DES, ECH,
60
+ * padding → `2ae7eb4b…`). The window between 1.0.9 and 1.3.14 is unmeasured,
61
+ * so anything below this floor is reported unverified rather than a green match.
62
+ */
63
+ export const JA3_VERIFIED_BUN_FLOOR = '1.3.14';
64
+ /**
65
+ * True when Bun `version` is at or above `floor`. Parses the leading
66
+ * `major.minor.patch` and ignores any pre-release/`-canary…` suffix, so Bun's
67
+ * canary tags (e.g. `1.4.0-canary.x`) compare as their base triple. Returns
68
+ * `undefined` when either string can't be parsed — the caller decides how to
69
+ * treat "can't tell" (we keep those as a best-effort match rather than warn).
70
+ */
71
+ export function bunVersionMeetsJa3Floor(version, floor = JA3_VERIFIED_BUN_FLOOR) {
72
+ const parse = (v) => {
73
+ const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v.trim());
74
+ return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : undefined;
75
+ };
76
+ const a = parse(version);
77
+ const b = parse(floor);
78
+ if (!a || !b)
79
+ return undefined;
80
+ for (let i = 0; i < 3; i++) {
81
+ if (a[i] !== b[i])
82
+ return a[i] > b[i];
83
+ }
84
+ return true; // equal versions meet the floor
85
+ }
54
86
  /**
55
87
  * Synthesize the TLS-fingerprint status from three inputs. All three are
56
88
  * passed explicitly so tests can cover every combination without touching
@@ -65,6 +97,21 @@ export function classifyRuntimeFingerprint(runningUnderBun, availableBunVersion,
65
97
  // is readable; we don't require a separate probe. The caller passes the
66
98
  // resolved version string as `availableBunVersion` in the bun case.
67
99
  const bunVer = availableBunVersion ?? 'unknown';
100
+ // Being on Bun is necessary but NOT sufficient: only Bun ≥ the JA3-verified
101
+ // floor is measured to reproduce CC's ClientHello (#813). A readable version
102
+ // below the floor is the false-green case — dario auto-relaunches into an
103
+ // old Bun on PATH and would otherwise report a match while emitting a
104
+ // divergent JA3. An unreadable version (rare; Bun almost always exposes
105
+ // .version) has nothing to check, so we leave it as a best-effort match.
106
+ if (bunVer !== 'unknown' && bunVersionMeetsJa3Floor(bunVer) === false) {
107
+ return {
108
+ status: 'bun-ja3-unverified',
109
+ runtime: 'bun',
110
+ runtimeVersion: bunVer,
111
+ detail: `Bun v${bunVer} — under Bun, but its TLS ClientHello (JA3) is not verified to match Claude Code (known-good ≥ v${JA3_VERIFIED_BUN_FLOOR})`,
112
+ hint: `Upgrade Bun to ≥ v${JA3_VERIFIED_BUN_FLOOR} (https://bun.sh); older Bun ships an older BoringSSL whose ClientHello diverges from Claude Code's.`,
113
+ };
114
+ }
68
115
  return {
69
116
  status: 'bun-match',
70
117
  runtime: 'bun',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askalf/dario",
3
- "version": "5.2.11",
3
+ "version": "5.2.12",
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": {