@cortexkit/anthropic-auth-core 1.9.3 → 1.9.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/dist/auth.js CHANGED
@@ -1,4 +1,4 @@
1
- import { AUTHORIZE_URLS, CLIENT_ID, CODE_CALLBACK_URL, OAUTH_SCOPES, TOKEN_URL, } from "./constants.js";
1
+ import { AUTHORIZE_URLS, AXIOS_USER_AGENT, CLIENT_ID, CODE_CALLBACK_URL, OAUTH_SCOPES, REFRESH_SCOPE, TOKEN_URL, } from "./constants.js";
2
2
  import { generatePKCE } from "./pkce.js";
3
3
  function parseRetryAfterHeader(value) {
4
4
  if (!value)
@@ -50,13 +50,14 @@ export async function refreshClaudeOAuthToken(input) {
50
50
  method: 'POST',
51
51
  headers: {
52
52
  'Content-Type': 'application/json',
53
- Accept: 'application/json',
54
- 'User-Agent': 'axios/1.13.6',
53
+ Accept: 'application/json, text/plain, */*',
54
+ 'User-Agent': AXIOS_USER_AGENT,
55
55
  },
56
56
  body: JSON.stringify({
57
57
  grant_type: 'refresh_token',
58
58
  refresh_token: input.refreshToken,
59
59
  client_id: CLIENT_ID,
60
+ scope: REFRESH_SCOPE,
60
61
  }),
61
62
  });
62
63
  if (!response.ok) {
@@ -120,7 +121,7 @@ async function exchangeCode(callback, verifier, redirectUri) {
120
121
  headers: {
121
122
  'Content-Type': 'application/json',
122
123
  Accept: 'application/json, text/plain, */*',
123
- 'User-Agent': 'axios/1.13.6',
124
+ 'User-Agent': AXIOS_USER_AGENT,
124
125
  },
125
126
  body: JSON.stringify({
126
127
  code: callback.code,
@@ -7,7 +7,7 @@ export declare function getClaudeCodeIdentity(seed: string): ClaudeCodeIdentity;
7
7
  export declare function resolveClaudeCodeIdentity(accessToken: string, model?: string): Promise<ClaudeCodeIdentity>;
8
8
  export declare function buildClaudeCodeMetadataUserId(identity: ClaudeCodeIdentity): string | null;
9
9
  export declare function applyClaudeCodeMetadata(body: Record<string, unknown>, identity: ClaudeCodeIdentity): boolean;
10
- export declare const CLAUDE_CODE_FULL_AGENT_BETAS: readonly ["claude-code-20250219", "oauth-2025-04-20", "interleaved-thinking-2025-05-14", "context-management-2025-06-27", "prompt-caching-scope-2026-01-05", "advisor-tool-2026-03-01", "advanced-tool-use-2025-11-20", "context-1m-2025-08-07", "effort-2025-11-24", "extended-cache-ttl-2025-04-11", "cache-diagnosis-2026-04-07"];
10
+ export declare const CLAUDE_CODE_FULL_AGENT_BETAS: readonly ["oauth-2025-04-20", "interleaved-thinking-2025-05-14", "thinking-token-count-2026-05-13", "context-management-2025-06-27", "prompt-caching-scope-2026-01-05", "claude-code-20250219", "advisor-tool-2026-03-01", "advanced-tool-use-2025-11-20", "extended-cache-ttl-2025-04-11", "cache-diagnosis-2026-04-07"];
11
11
  export declare function selectClaudeCodeBetas(body?: Record<string, unknown> | null, extraBetas?: string[]): string;
12
12
  export declare function applyClaudeCodeHeaders(headers: Headers, accessToken: string, options?: {
13
13
  body?: Record<string, unknown> | null;
@@ -130,21 +130,21 @@ export function applyClaudeCodeMetadata(body, identity) {
130
130
  return true;
131
131
  }
132
132
  export const CLAUDE_CODE_FULL_AGENT_BETAS = [
133
- 'claude-code-20250219',
134
133
  'oauth-2025-04-20',
135
134
  'interleaved-thinking-2025-05-14',
135
+ 'thinking-token-count-2026-05-13',
136
136
  'context-management-2025-06-27',
137
137
  'prompt-caching-scope-2026-01-05',
138
+ 'claude-code-20250219',
138
139
  'advisor-tool-2026-03-01',
139
140
  'advanced-tool-use-2025-11-20',
140
- 'context-1m-2025-08-07',
141
- 'effort-2025-11-24',
142
141
  'extended-cache-ttl-2025-04-11',
143
142
  'cache-diagnosis-2026-04-07',
144
143
  ];
145
144
  const CLAUDE_CODE_STRUCTURED_OUTPUT_BETAS = [
146
145
  'oauth-2025-04-20',
147
146
  'interleaved-thinking-2025-05-14',
147
+ 'thinking-token-count-2026-05-13',
148
148
  'context-management-2025-06-27',
149
149
  'prompt-caching-scope-2026-01-05',
150
150
  'advisor-tool-2026-03-01',
@@ -154,9 +154,12 @@ const CLAUDE_CODE_STRUCTURED_OUTPUT_BETAS = [
154
154
  const CLAUDE_CODE_BASE_BETAS = [
155
155
  'oauth-2025-04-20',
156
156
  'interleaved-thinking-2025-05-14',
157
+ 'thinking-token-count-2026-05-13',
157
158
  'context-management-2025-06-27',
158
159
  'prompt-caching-scope-2026-01-05',
159
160
  'advisor-tool-2026-03-01',
161
+ 'advanced-tool-use-2025-11-20',
162
+ 'extended-cache-ttl-2025-04-11',
160
163
  'cache-diagnosis-2026-04-07',
161
164
  ];
162
165
  function hasStructuredOutput(body) {
@@ -1,27 +1,29 @@
1
1
  export declare const CLIENT_ID = "9d1c250a-e61b-44d9-88ed-5944d1962f5e";
2
2
  export declare const AUTHORIZE_URLS: {
3
3
  readonly console: "https://platform.claude.com/oauth/authorize";
4
- readonly max: "https://claude.ai/oauth/authorize";
4
+ readonly max: "https://claude.com/cai/oauth/authorize";
5
5
  };
6
6
  export declare const CODE_CALLBACK_URL = "https://platform.claude.com/oauth/code/callback";
7
7
  export declare const TOKEN_URL = "https://platform.claude.com/v1/oauth/token";
8
+ export declare const AXIOS_USER_AGENT = "axios/1.15.2";
8
9
  export declare const OAUTH_SCOPES: string[];
10
+ export declare const REFRESH_SCOPE = "user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload";
9
11
  export declare const TOOL_PREFIX = "mcp_";
10
12
  export declare const REQUIRED_BETAS: string[];
11
13
  export declare const FAST_MODE_BETA = "fast-mode-2026-02-01";
12
14
  export declare function mergeAnthropicBetas(existing: string | null | undefined, betas: string[]): string;
13
15
  export declare function isFastModeSupportedModel(model: unknown): boolean;
14
16
  export declare const OPENCODE_IDENTITY_PREFIX = "You are OpenCode";
15
- export declare const CLAUDE_CODE_IDENTITY = "You are a Claude agent, built on Anthropic's Claude Agent SDK.";
17
+ export declare const CLAUDE_CODE_IDENTITY = "You are Claude Code, Anthropic's official CLI for Claude.";
16
18
  export declare const PARALLEL_TOOL_CALLS_SYSTEM_PROMPT: string;
17
19
  export declare const CCH_SALT = "59cf53e54c78";
18
20
  export declare const CCH_POSITIONS: number[];
19
- export declare const CLAUDE_CODE_VERSION = "2.1.141";
20
- export declare const CLAUDE_CODE_BUILD_HASH = "67b";
21
- export declare const CLAUDE_CODE_ENTRYPOINT = "sdk-cli";
21
+ export declare const CLAUDE_CODE_VERSION = "2.1.177";
22
+ export declare const CLAUDE_CODE_BUILD_HASH = "3bf";
23
+ export declare const CLAUDE_CODE_ENTRYPOINT = "cli";
22
24
  export declare const CLAUDE_CODE_STAINLESS_PACKAGE_VERSION = "0.94.0";
23
25
  export declare const CLAUDE_CODE_STAINLESS_RUNTIME_VERSION = "v24.3.0";
24
- export declare const USER_AGENT = "claude-cli/2.1.141 (external, sdk-cli)";
26
+ export declare const USER_AGENT = "claude-cli/2.1.177 (external, cli)";
25
27
  export declare const CACHE_1H_MODES: readonly ["explicit", "automatic", "hybrid"];
26
28
  export type Cache1hMode = (typeof CACHE_1H_MODES)[number];
27
29
  export declare const DEFAULT_CACHE_1H_MODE: Cache1hMode;
package/dist/constants.js CHANGED
@@ -1,10 +1,11 @@
1
1
  export const CLIENT_ID = '9d1c250a-e61b-44d9-88ed-5944d1962f5e';
2
2
  export const AUTHORIZE_URLS = {
3
3
  console: 'https://platform.claude.com/oauth/authorize',
4
- max: 'https://claude.ai/oauth/authorize',
4
+ max: 'https://claude.com/cai/oauth/authorize',
5
5
  };
6
6
  export const CODE_CALLBACK_URL = 'https://platform.claude.com/oauth/code/callback';
7
7
  export const TOKEN_URL = 'https://platform.claude.com/v1/oauth/token';
8
+ export const AXIOS_USER_AGENT = 'axios/1.15.2';
8
9
  export const OAUTH_SCOPES = [
9
10
  'org:create_api_key',
10
11
  'user:profile',
@@ -13,6 +14,7 @@ export const OAUTH_SCOPES = [
13
14
  'user:mcp_servers',
14
15
  'user:file_upload',
15
16
  ];
17
+ export const REFRESH_SCOPE = 'user:profile user:inference user:sessions:claude_code user:mcp_servers user:file_upload';
16
18
  export const TOOL_PREFIX = 'mcp_';
17
19
  export const REQUIRED_BETAS = [
18
20
  'oauth-2025-04-20',
@@ -33,7 +35,7 @@ export function isFastModeSupportedModel(model) {
33
35
  model.startsWith('claude-opus-4-8')));
34
36
  }
35
37
  export const OPENCODE_IDENTITY_PREFIX = 'You are OpenCode';
36
- export const CLAUDE_CODE_IDENTITY = "You are a Claude agent, built on Anthropic's Claude Agent SDK.";
38
+ export const CLAUDE_CODE_IDENTITY = "You are Claude Code, Anthropic's official CLI for Claude.";
37
39
  export const PARALLEL_TOOL_CALLS_SYSTEM_PROMPT = [
38
40
  '<use_parallel_tool_calls>',
39
41
  'For maximum efficiency, whenever you perform multiple independent operations, invoke all relevant tools simultaneously rather than sequentially. Prioritize calling independent tools in parallel whenever possible. For example, when reading 3 known files, run 3 tool calls in parallel to read all 3 files into context at the same time. When running multiple independent read-only commands like `ls` or `list_dir`, run all of those commands in parallel. Err on the side of maximizing parallel tool calls for independent work rather than running too many tools sequentially.',
@@ -43,12 +45,12 @@ export const PARALLEL_TOOL_CALLS_SYSTEM_PROMPT = [
43
45
  ].join('\n');
44
46
  export const CCH_SALT = '59cf53e54c78';
45
47
  export const CCH_POSITIONS = [4, 7, 20];
46
- export const CLAUDE_CODE_VERSION = '2.1.141';
47
- export const CLAUDE_CODE_BUILD_HASH = '67b';
48
- export const CLAUDE_CODE_ENTRYPOINT = 'sdk-cli';
48
+ export const CLAUDE_CODE_VERSION = '2.1.177';
49
+ export const CLAUDE_CODE_BUILD_HASH = '3bf';
50
+ export const CLAUDE_CODE_ENTRYPOINT = 'cli';
49
51
  export const CLAUDE_CODE_STAINLESS_PACKAGE_VERSION = '0.94.0';
50
52
  export const CLAUDE_CODE_STAINLESS_RUNTIME_VERSION = 'v24.3.0';
51
- export const USER_AGENT = 'claude-cli/2.1.141 (external, sdk-cli)';
53
+ export const USER_AGENT = 'claude-cli/2.1.177 (external, cli)';
52
54
  export const CACHE_1H_MODES = ['explicit', 'automatic', 'hybrid'];
53
55
  export const DEFAULT_CACHE_1H_MODE = 'explicit';
54
56
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/anthropic-auth-core",
3
- "version": "1.9.3",
3
+ "version": "1.9.4",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",