@askalf/dario 3.19.3 → 3.19.4
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/README.md +1 -1
- package/dist/cc-oauth-detect.d.ts +4 -3
- package/dist/cc-oauth-detect.js +21 -18
- package/dist/cli.js +25 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -565,7 +565,7 @@ Yes — anything that speaks the OpenAI Chat Completions API. Groq, OpenRouter,
|
|
|
565
565
|
`dario doctor`. One command, one aggregated report — dario version, Node, platform, CC binary compat, template source + age + drift, OAuth status, pool state, backends, home dir. Exit code 1 if any check fails. Paste the output when you file an issue.
|
|
566
566
|
|
|
567
567
|
**What happens when Anthropic rotates the OAuth config?**
|
|
568
|
-
Dario auto-detects OAuth config from the installed Claude Code binary. When CC ships a new version with rotated values, dario picks them up on the next run. Cache at `~/.dario/cc-oauth-cache-
|
|
568
|
+
Dario auto-detects OAuth config from the installed Claude Code binary. When CC ships a new version with rotated values, dario picks them up on the next run. Cache at `~/.dario/cc-oauth-cache-v4.json`, keyed by the CC binary fingerprint.
|
|
569
569
|
|
|
570
570
|
**What happens when Anthropic changes the CC request template?**
|
|
571
571
|
Dario extracts the live request template from your installed Claude Code binary on startup — the system prompt, tool schemas, user-agent, beta flags, and header insertion order — and uses those to replay requests instead of a version pinned into dario itself. When CC ships a new version with a tweaked template, the next `dario proxy` run picks it up automatically. Drift detection (v3.17) forces a refresh when the installed CC version changes under dario.
|
|
@@ -28,9 +28,10 @@
|
|
|
28
28
|
* "MANUAL_REDIRECT_URL" on platform.claude.com is only used when dario's
|
|
29
29
|
* local HTTP server can't bind a port; dario never hits that path.)
|
|
30
30
|
*
|
|
31
|
-
* Results are cached per-binary-hash at ~/.dario/cc-oauth-cache-
|
|
32
|
-
* startup only re-scans when the user upgrades Claude Code. The
|
|
33
|
-
*
|
|
31
|
+
* Results are cached per-binary-hash at ~/.dario/cc-oauth-cache-v4.json so
|
|
32
|
+
* startup only re-scans when the user upgrades Claude Code. The cache suffix
|
|
33
|
+
* is bumped each time scope handling or the fallback config changes, so
|
|
34
|
+
* upgrading dario picks up the new values without a manual cache clear.
|
|
34
35
|
*/
|
|
35
36
|
export interface DetectedOAuthConfig {
|
|
36
37
|
clientId: string;
|
package/dist/cc-oauth-detect.js
CHANGED
|
@@ -28,9 +28,10 @@
|
|
|
28
28
|
* "MANUAL_REDIRECT_URL" on platform.claude.com is only used when dario's
|
|
29
29
|
* local HTTP server can't bind a port; dario never hits that path.)
|
|
30
30
|
*
|
|
31
|
-
* Results are cached per-binary-hash at ~/.dario/cc-oauth-cache-
|
|
32
|
-
* startup only re-scans when the user upgrades Claude Code. The
|
|
33
|
-
*
|
|
31
|
+
* Results are cached per-binary-hash at ~/.dario/cc-oauth-cache-v4.json so
|
|
32
|
+
* startup only re-scans when the user upgrades Claude Code. The cache suffix
|
|
33
|
+
* is bumped each time scope handling or the fallback config changes, so
|
|
34
|
+
* upgrading dario picks up the new values without a manual cache clear.
|
|
34
35
|
*/
|
|
35
36
|
import { readFile, writeFile, mkdir, stat, open as openFile } from 'node:fs/promises';
|
|
36
37
|
import { existsSync } from 'node:fs';
|
|
@@ -44,23 +45,25 @@ const FALLBACK = {
|
|
|
44
45
|
clientId: '9d1c250a-e61b-44d9-88ed-5944d1962f5e',
|
|
45
46
|
authorizeUrl: 'https://claude.com/cai/oauth/authorize',
|
|
46
47
|
tokenUrl: 'https://platform.claude.com/v1/oauth/token',
|
|
47
|
-
// Scopes
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
|
|
48
|
+
// Scopes match CC v2.1.107+ interactive login: the 5-scope user-only set.
|
|
49
|
+
// Between CC v2.1.104 and v2.1.107, Anthropic's authorize endpoint flipped
|
|
50
|
+
// its policy on `org:create_api_key` for this client_id — the shorter list
|
|
51
|
+
// is now the only accepted one, and the 6-scope form returns "Invalid
|
|
52
|
+
// request format". CC's own binary dropped `org:create_api_key` from the
|
|
53
|
+
// `n36` union to match. Dario #42 (tetsuco, 2026-04-17) surfaced this as
|
|
54
|
+
// a fresh-login failure on macOS against CC v2.1.107.
|
|
55
|
+
//
|
|
56
|
+
// History: dario 3.2.7–3.4.3 once dropped this scope by mistake (misread
|
|
57
|
+
// of the "Console-only" name); 3.4.4 added it back after users hit auth
|
|
58
|
+
// failures with the dev client_id accepting it but prod rejecting. That
|
|
59
|
+
// situation has now inverted — prod rejects the longer list.
|
|
60
|
+
scopes: 'user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload',
|
|
57
61
|
source: 'fallback',
|
|
58
62
|
};
|
|
59
|
-
// -
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
const CACHE_PATH = join(homedir(), '.dario', 'cc-oauth-cache-v3.json');
|
|
63
|
+
// -v4 suffix invalidates v3.x caches populated with the 6-scope list that
|
|
64
|
+
// Anthropic now rejects (dario #42). On upgrade, users regenerate the cache
|
|
65
|
+
// with the new FALLBACK scopes automatically — no manual clear required.
|
|
66
|
+
const CACHE_PATH = join(homedir(), '.dario', 'cc-oauth-cache-v4.json');
|
|
64
67
|
function candidatePaths() {
|
|
65
68
|
const home = homedir();
|
|
66
69
|
if (platform() === 'win32') {
|
package/dist/cli.js
CHANGED
|
@@ -54,8 +54,31 @@ async function login() {
|
|
|
54
54
|
await proxy();
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
// Credentials exist but are expired — try refresh before falling through
|
|
58
|
+
// to a fresh OAuth flow. Without this, dario silently burned every
|
|
59
|
+
// fresh-login attempt (surfaced by dario #42 when Anthropic's authorize
|
|
60
|
+
// endpoint started rejecting the 6-scope list and `dario login` kept
|
|
61
|
+
// reporting "No credentials found" even though refresh would have worked).
|
|
62
|
+
if (creds?.claudeAiOauth?.refreshToken) {
|
|
63
|
+
console.log(' Existing credentials expired — attempting token refresh...');
|
|
64
|
+
try {
|
|
65
|
+
const tokens = await refreshTokens();
|
|
66
|
+
const expiresIn = Math.round((tokens.expiresAt - Date.now()) / 60000);
|
|
67
|
+
console.log(` Refresh successful! Token expires in ${expiresIn} minutes.`);
|
|
68
|
+
console.log('');
|
|
69
|
+
console.log(' Run `dario proxy` to start the API proxy.');
|
|
70
|
+
console.log('');
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
console.log(` Refresh failed (${sanitizeError(err)}). Starting fresh OAuth flow...`);
|
|
75
|
+
console.log('');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
console.log(' No Claude Code credentials found. Starting OAuth flow...');
|
|
80
|
+
console.log('');
|
|
81
|
+
}
|
|
59
82
|
try {
|
|
60
83
|
const tokens = await startAutoOAuthFlow();
|
|
61
84
|
const expiresIn = Math.round((tokens.expiresAt - Date.now()) / 60000);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@askalf/dario",
|
|
3
|
-
"version": "3.19.
|
|
3
|
+
"version": "3.19.4",
|
|
4
4
|
"description": "A local LLM router. One endpoint, every provider — Claude subscriptions, OpenAI, OpenRouter, Groq, local LiteLLM, any OpenAI-compat endpoint — your tools don't need to change.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|