@askalf/dario 5.5.63 → 5.5.65

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.
@@ -17,6 +17,14 @@
17
17
  export interface HealthStatusLike {
18
18
  status: string;
19
19
  canRefresh?: boolean;
20
+ /**
21
+ * True when dario forwards upstream with a per-token API key
22
+ * (ANTHROPIC_UPSTREAM_API_KEY) instead of the subscription OAuth bearer.
23
+ * In that mode the OAuth pool is NOT the credential that serves, so its
24
+ * absence/expiry says nothing about whether requests succeed — see
25
+ * buildHealthResponse.
26
+ */
27
+ upstreamApiKeyMode?: boolean;
20
28
  expiresIn?: string;
21
29
  refreshFailures?: number;
22
30
  lastRefreshError?: string;
@@ -91,9 +91,18 @@ function withStalledFor(q, now) {
91
91
  return { ...rest, stalledSince, stalledForMs: Math.max(0, now - stalledSince) };
92
92
  }
93
93
  export function buildHealthResponse(s, requestCount, includeInternal, now = Date.now()) {
94
- const structurallyDead = s.status === 'broken' ||
95
- s.status === 'none' ||
96
- (s.status === 'expired' && s.canRefresh === false);
94
+ // OAuth state is only evidence about serving when OAuth is what serves. With
95
+ // an upstream API key configured, every request goes out with x-api-key and a
96
+ // missing/expired pool is irrelevant — so reporting 503 there tells an uptime
97
+ // monitor the proxy is down while it is answering normally. (Found via the
98
+ // compat job: isolating its credential left OAuth 'none', and /health 503'd
99
+ // even though the suite's own traffic was being served by the API key.) The
100
+ // probe below stays authoritative in BOTH modes, so a real failed round-trip
101
+ // still degrades — this narrows the structural guess, not the measurement.
102
+ const structurallyDead = s.upstreamApiKeyMode !== true &&
103
+ (s.status === 'broken' ||
104
+ s.status === 'none' ||
105
+ (s.status === 'expired' && s.canRefresh === false));
97
106
  // A failed round-trip is authoritative over a clean structural read: the
98
107
  // whole point of the probe (dario#905) is the state where local inspection
99
108
  // says healthy and every real request fails. When one was run and it came
package/dist/proxy.js CHANGED
@@ -1789,6 +1789,7 @@ export async function startProxy(opts = {}) {
1789
1789
  const { httpStatus, body } = buildHealthResponse({
1790
1790
  ...s,
1791
1791
  version: darioVersion(),
1792
+ upstreamApiKeyMode: !!upstreamApiKey,
1792
1793
  ...(probe ? { probe } : {}),
1793
1794
  // pool.size === 0 is single-account mode (session-id registry drives
1794
1795
  // the SESSION_ID slot); a loaded pool routes via sticky bindings.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askalf/dario",
3
- "version": "5.5.63",
3
+ "version": "5.5.65",
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": {