@anthropic-ai/sdk 0.91.1 → 0.93.0

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.
Files changed (167) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/client.d.mts +73 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +73 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +269 -9
  7. package/client.js.map +1 -1
  8. package/client.mjs +269 -9
  9. package/client.mjs.map +1 -1
  10. package/core/credentials.d.mts +111 -0
  11. package/core/credentials.d.mts.map +1 -0
  12. package/core/credentials.d.ts +111 -0
  13. package/core/credentials.d.ts.map +1 -0
  14. package/core/credentials.js +298 -0
  15. package/core/credentials.js.map +1 -0
  16. package/core/credentials.mjs +259 -0
  17. package/core/credentials.mjs.map +1 -0
  18. package/internal/types.d.mts +12 -6
  19. package/internal/types.d.ts +12 -6
  20. package/internal/utils/time.d.mts +3 -0
  21. package/internal/utils/time.d.mts.map +1 -0
  22. package/internal/utils/time.d.ts +3 -0
  23. package/internal/utils/time.d.ts.map +1 -0
  24. package/internal/utils/time.js +8 -0
  25. package/internal/utils/time.js.map +1 -0
  26. package/internal/utils/time.mjs +5 -0
  27. package/internal/utils/time.mjs.map +1 -0
  28. package/lib/credentials/credential-chain.d.mts +39 -0
  29. package/lib/credentials/credential-chain.d.mts.map +1 -0
  30. package/lib/credentials/credential-chain.d.ts +39 -0
  31. package/lib/credentials/credential-chain.d.ts.map +1 -0
  32. package/lib/credentials/credential-chain.js +237 -0
  33. package/lib/credentials/credential-chain.js.map +1 -0
  34. package/lib/credentials/credential-chain.mjs +200 -0
  35. package/lib/credentials/credential-chain.mjs.map +1 -0
  36. package/lib/credentials/identity-token.d.mts +11 -0
  37. package/lib/credentials/identity-token.d.mts.map +1 -0
  38. package/lib/credentials/identity-token.d.ts +11 -0
  39. package/lib/credentials/identity-token.d.ts.map +1 -0
  40. package/lib/credentials/identity-token.js +72 -0
  41. package/lib/credentials/identity-token.js.map +1 -0
  42. package/lib/credentials/identity-token.mjs +35 -0
  43. package/lib/credentials/identity-token.mjs.map +1 -0
  44. package/lib/credentials/oidc-federation.d.mts +28 -0
  45. package/lib/credentials/oidc-federation.d.mts.map +1 -0
  46. package/lib/credentials/oidc-federation.d.ts +28 -0
  47. package/lib/credentials/oidc-federation.d.ts.map +1 -0
  48. package/lib/credentials/oidc-federation.js +69 -0
  49. package/lib/credentials/oidc-federation.js.map +1 -0
  50. package/lib/credentials/oidc-federation.mjs +66 -0
  51. package/lib/credentials/oidc-federation.mjs.map +1 -0
  52. package/lib/credentials/token-cache.d.mts +54 -0
  53. package/lib/credentials/token-cache.d.mts.map +1 -0
  54. package/lib/credentials/token-cache.d.ts +54 -0
  55. package/lib/credentials/token-cache.d.ts.map +1 -0
  56. package/lib/credentials/token-cache.js +112 -0
  57. package/lib/credentials/token-cache.js.map +1 -0
  58. package/lib/credentials/token-cache.mjs +108 -0
  59. package/lib/credentials/token-cache.mjs.map +1 -0
  60. package/lib/credentials/types.d.mts +96 -0
  61. package/lib/credentials/types.d.mts.map +1 -0
  62. package/lib/credentials/types.d.ts +96 -0
  63. package/lib/credentials/types.d.ts.map +1 -0
  64. package/lib/credentials/types.js +266 -0
  65. package/lib/credentials/types.js.map +1 -0
  66. package/lib/credentials/types.mjs +224 -0
  67. package/lib/credentials/types.mjs.map +1 -0
  68. package/lib/credentials/user-oauth.d.mts +21 -0
  69. package/lib/credentials/user-oauth.d.mts.map +1 -0
  70. package/lib/credentials/user-oauth.d.ts +21 -0
  71. package/lib/credentials/user-oauth.d.ts.map +1 -0
  72. package/lib/credentials/user-oauth.js +130 -0
  73. package/lib/credentials/user-oauth.js.map +1 -0
  74. package/lib/credentials/user-oauth.mjs +94 -0
  75. package/lib/credentials/user-oauth.mjs.map +1 -0
  76. package/lib/credentials.d.mts +4 -0
  77. package/lib/credentials.d.mts.map +1 -0
  78. package/lib/credentials.d.ts +4 -0
  79. package/lib/credentials.d.ts.map +1 -0
  80. package/lib/credentials.js +8 -0
  81. package/lib/credentials.js.map +1 -0
  82. package/lib/credentials.mjs +3 -0
  83. package/lib/credentials.mjs.map +1 -0
  84. package/package.json +1 -1
  85. package/resources/beta/environments.d.mts +1 -1
  86. package/resources/beta/environments.d.ts +1 -1
  87. package/resources/beta/index.d.mts +1 -1
  88. package/resources/beta/index.d.mts.map +1 -1
  89. package/resources/beta/index.d.ts +1 -1
  90. package/resources/beta/index.d.ts.map +1 -1
  91. package/resources/beta/index.js.map +1 -1
  92. package/resources/beta/index.mjs.map +1 -1
  93. package/resources/beta/memory-stores/memories.d.mts +126 -11
  94. package/resources/beta/memory-stores/memories.d.mts.map +1 -1
  95. package/resources/beta/memory-stores/memories.d.ts +126 -11
  96. package/resources/beta/memory-stores/memories.d.ts.map +1 -1
  97. package/resources/beta/memory-stores/memories.js +5 -5
  98. package/resources/beta/memory-stores/memories.mjs +5 -5
  99. package/resources/beta/memory-stores/memory-stores.d.mts +58 -14
  100. package/resources/beta/memory-stores/memory-stores.d.mts.map +1 -1
  101. package/resources/beta/memory-stores/memory-stores.d.ts +58 -14
  102. package/resources/beta/memory-stores/memory-stores.d.ts.map +1 -1
  103. package/resources/beta/memory-stores/memory-stores.js +6 -6
  104. package/resources/beta/memory-stores/memory-stores.js.map +1 -1
  105. package/resources/beta/memory-stores/memory-stores.mjs +6 -6
  106. package/resources/beta/memory-stores/memory-stores.mjs.map +1 -1
  107. package/resources/beta/memory-stores/memory-versions.d.mts +88 -5
  108. package/resources/beta/memory-stores/memory-versions.d.mts.map +1 -1
  109. package/resources/beta/memory-stores/memory-versions.d.ts +88 -5
  110. package/resources/beta/memory-stores/memory-versions.d.ts.map +1 -1
  111. package/resources/beta/memory-stores/memory-versions.js +3 -3
  112. package/resources/beta/memory-stores/memory-versions.mjs +3 -3
  113. package/resources/beta/messages/batches.d.mts +4 -0
  114. package/resources/beta/messages/batches.d.mts.map +1 -1
  115. package/resources/beta/messages/batches.d.ts +4 -0
  116. package/resources/beta/messages/batches.d.ts.map +1 -1
  117. package/resources/beta/messages/index.d.mts +1 -1
  118. package/resources/beta/messages/index.d.mts.map +1 -1
  119. package/resources/beta/messages/index.d.ts +1 -1
  120. package/resources/beta/messages/index.d.ts.map +1 -1
  121. package/resources/beta/messages/index.js.map +1 -1
  122. package/resources/beta/messages/index.mjs.map +1 -1
  123. package/resources/beta/messages/messages.d.mts +5 -1
  124. package/resources/beta/messages/messages.d.mts.map +1 -1
  125. package/resources/beta/messages/messages.d.ts +5 -1
  126. package/resources/beta/messages/messages.d.ts.map +1 -1
  127. package/resources/beta/messages/messages.js +1 -1
  128. package/resources/beta/messages/messages.js.map +1 -1
  129. package/resources/beta/messages/messages.mjs +1 -1
  130. package/resources/beta/messages/messages.mjs.map +1 -1
  131. package/resources/beta/sessions/sessions.d.mts +5 -0
  132. package/resources/beta/sessions/sessions.d.mts.map +1 -1
  133. package/resources/beta/sessions/sessions.d.ts +5 -0
  134. package/resources/beta/sessions/sessions.d.ts.map +1 -1
  135. package/resources/beta/sessions/sessions.js.map +1 -1
  136. package/resources/beta/sessions/sessions.mjs.map +1 -1
  137. package/resources/messages/messages.d.mts +4 -0
  138. package/resources/messages/messages.d.mts.map +1 -1
  139. package/resources/messages/messages.d.ts +4 -0
  140. package/resources/messages/messages.d.ts.map +1 -1
  141. package/resources/messages/messages.js.map +1 -1
  142. package/resources/messages/messages.mjs.map +1 -1
  143. package/src/client.ts +354 -14
  144. package/src/core/credentials.ts +349 -0
  145. package/src/internal/utils/time.ts +4 -0
  146. package/src/lib/credentials/credential-chain.ts +284 -0
  147. package/src/lib/credentials/identity-token.ts +37 -0
  148. package/src/lib/credentials/oidc-federation.ts +112 -0
  149. package/src/lib/credentials/token-cache.ts +130 -0
  150. package/src/lib/credentials/types.ts +295 -0
  151. package/src/lib/credentials/user-oauth.ts +144 -0
  152. package/src/lib/credentials.ts +3 -0
  153. package/src/resources/beta/environments.ts +1 -1
  154. package/src/resources/beta/index.ts +1 -0
  155. package/src/resources/beta/memory-stores/memories.ts +126 -11
  156. package/src/resources/beta/memory-stores/memory-stores.ts +58 -14
  157. package/src/resources/beta/memory-stores/memory-versions.ts +88 -5
  158. package/src/resources/beta/messages/batches.ts +4 -0
  159. package/src/resources/beta/messages/index.ts +1 -0
  160. package/src/resources/beta/messages/messages.ts +5 -1
  161. package/src/resources/beta/sessions/sessions.ts +6 -0
  162. package/src/resources/messages/messages.ts +4 -0
  163. package/src/version.ts +1 -1
  164. package/version.d.mts +1 -1
  165. package/version.d.ts +1 -1
  166. package/version.js +1 -1
  167. package/version.mjs +1 -1
@@ -0,0 +1,259 @@
1
+ import { getPlatformHeaders } from "../internal/detect-platform.mjs";
2
+ import { readEnv } from "../internal/utils.mjs";
3
+ /** Current schema version written to `configs/<profile>.json`. Absent on read ⇒ "1.0". */
4
+ export const CONFIG_FILE_VERSION = '1.0';
5
+ /** Current schema version written to `credentials/<profile>.json`. Absent on read ⇒ "1.0". */
6
+ export const CREDENTIALS_FILE_VERSION = '1.0';
7
+ const PROFILE_NAME_PATTERN = /^[A-Za-z0-9_.-]+$/;
8
+ function validateProfileName(name) {
9
+ if (!name) {
10
+ throw new Error('profile name is empty');
11
+ }
12
+ if (name === '.' || name === '..') {
13
+ throw new Error(`profile name "${name}" is not allowed`);
14
+ }
15
+ if (name.includes('/') || name.includes('\\')) {
16
+ throw new Error(`profile name "${name}" must not contain path separators`);
17
+ }
18
+ if (!PROFILE_NAME_PATTERN.test(name)) {
19
+ throw new Error(`profile name "${name}" contains disallowed characters (allowed: letters, digits, '_', '.', '-')`);
20
+ }
21
+ }
22
+ /**
23
+ * Loads the Anthropic configuration for the given (or active) profile.
24
+ *
25
+ * Returns `null` when running in a browser or no configuration can be resolved.
26
+ * Otherwise, returns the configuration based on the config file and environment variables.
27
+ *
28
+ * **Profile resolution** (first match wins):
29
+ * 1. Explicit `profile` argument
30
+ * 2. `ANTHROPIC_PROFILE` environment variable
31
+ * 3. Contents of `<config_dir>/active_config` file
32
+ * 4. `"default"`
33
+ *
34
+ * **Config resolution:**
35
+ * - If `<config_dir>/configs/<profile>.json` exists, it is loaded and
36
+ * missing fields are filled from environment variables. Values present
37
+ * in the file take precedence — env vars only fill gaps:
38
+ * - `ANTHROPIC_BASE_URL` → `base_url`
39
+ * - `ANTHROPIC_ORGANIZATION_ID` → `organization_id`
40
+ * - `ANTHROPIC_SCOPE` → `authentication.scope`
41
+ * - `ANTHROPIC_FEDERATION_RULE_ID` → `authentication.federation_rule_id` (oidc_federation)
42
+ * - `ANTHROPIC_IDENTITY_TOKEN_FILE` → `authentication.identity_token` (oidc_federation)
43
+ * - `ANTHROPIC_SERVICE_ACCOUNT_ID` → `authentication.service_account_id` (oidc_federation)
44
+ * - If no config file exists, an `oidc_federation` config is synthesized
45
+ * entirely from environment variables when both `ANTHROPIC_FEDERATION_RULE_ID`
46
+ * and `ANTHROPIC_ORGANIZATION_ID` are set.
47
+ */
48
+ export const loadConfig = async (profile) => {
49
+ var _a, _b;
50
+ const rootConfigPath = await getRootConfigPath();
51
+ if (rootConfigPath === null) {
52
+ return null;
53
+ }
54
+ const profileName = profile ?? (await getActiveProfileName());
55
+ if (profileName === null) {
56
+ return null;
57
+ }
58
+ validateProfileName(profileName);
59
+ const fs = await import('node:fs');
60
+ const path = await import('node:path');
61
+ const configPath = path.join(rootConfigPath, 'configs', `${profileName}.json`);
62
+ let configRaw;
63
+ try {
64
+ configRaw = await fs.promises.readFile(configPath, 'utf-8');
65
+ }
66
+ catch (err) {
67
+ if (err?.code !== 'ENOENT') {
68
+ throw new Error(`failed to read config file ${configPath}: ${err}`);
69
+ }
70
+ configRaw = null;
71
+ }
72
+ if (configRaw === null) {
73
+ const organizationId = readEnv('ANTHROPIC_ORGANIZATION_ID');
74
+ const identityTokenFile = readEnv('ANTHROPIC_IDENTITY_TOKEN_FILE');
75
+ const federationRuleId = readEnv('ANTHROPIC_FEDERATION_RULE_ID');
76
+ if (federationRuleId && organizationId) {
77
+ return {
78
+ organization_id: organizationId,
79
+ base_url: readEnv('ANTHROPIC_BASE_URL'),
80
+ authentication: {
81
+ type: 'oidc_federation',
82
+ federation_rule_id: federationRuleId,
83
+ service_account_id: readEnv('ANTHROPIC_SERVICE_ACCOUNT_ID'),
84
+ identity_token: identityTokenFile ? { source: 'file', path: identityTokenFile } : undefined,
85
+ scope: readEnv('ANTHROPIC_SCOPE'),
86
+ },
87
+ };
88
+ }
89
+ return null;
90
+ }
91
+ let config;
92
+ try {
93
+ config = JSON.parse(configRaw);
94
+ }
95
+ catch (err) {
96
+ throw new Error(`failed to parse config file ${configPath}: ${err}`);
97
+ }
98
+ if (!config.authentication) {
99
+ throw new Error(`config file ${configPath} is missing "authentication"`);
100
+ }
101
+ const authType = config.authentication.type;
102
+ if (authType !== 'oidc_federation' && authType !== 'user_oauth') {
103
+ throw new Error(`authentication.type "${authType}" is not a known authentication type`);
104
+ }
105
+ // File values are authoritative; env vars only fill fields the file left unset.
106
+ config.organization_id ?? (config.organization_id = readEnv('ANTHROPIC_ORGANIZATION_ID'));
107
+ config.base_url ?? (config.base_url = readEnv('ANTHROPIC_BASE_URL'));
108
+ (_a = config.authentication).scope ?? (_a.scope = readEnv('ANTHROPIC_SCOPE'));
109
+ if (config.authentication.type === 'oidc_federation') {
110
+ if (!config.authentication.identity_token) {
111
+ const identityTokenFile = readEnv('ANTHROPIC_IDENTITY_TOKEN_FILE');
112
+ if (identityTokenFile) {
113
+ config.authentication.identity_token = {
114
+ source: 'file',
115
+ path: identityTokenFile,
116
+ };
117
+ }
118
+ }
119
+ // Unlike siblings using `??= readEnv()` (which leaves `undefined`), coerce
120
+ // to '' so the type stays `string` (always set). The downstream required
121
+ // check in credential-chain rejects empty, so semantics match but types are
122
+ // cleaner.
123
+ if (!config.authentication.federation_rule_id) {
124
+ config.authentication.federation_rule_id = readEnv('ANTHROPIC_FEDERATION_RULE_ID') ?? '';
125
+ }
126
+ (_b = config.authentication).service_account_id ?? (_b.service_account_id = readEnv('ANTHROPIC_SERVICE_ACCOUNT_ID'));
127
+ }
128
+ return config;
129
+ };
130
+ /**
131
+ * Loads the credential material for the active profile.
132
+ *
133
+ * Returns the parsed credentials or `null` when running in a browser or
134
+ * no credentials file can be found.
135
+ *
136
+ * **Profile resolution** (first match wins):
137
+ * 1. `ANTHROPIC_PROFILE` environment variable
138
+ * 2. Contents of `<config_dir>/active_config` file
139
+ * 3. `"default"`
140
+ *
141
+ * **Credentials path resolution** (first match wins):
142
+ * 1. `authentication.credentials_path` from the active profile's config (via {@link loadConfig})
143
+ * 2. `<config_dir>/credentials/<profile>.json`
144
+ */
145
+ export const loadCredentials = async () => {
146
+ const config = await loadConfig();
147
+ const credentialsPath = await getCredentialsPath(config);
148
+ if (!credentialsPath) {
149
+ return null;
150
+ }
151
+ const fs = await import('node:fs');
152
+ let raw;
153
+ try {
154
+ raw = await fs.promises.readFile(credentialsPath, 'utf-8');
155
+ }
156
+ catch (err) {
157
+ if (err?.code !== 'ENOENT') {
158
+ throw new Error(`failed to read credentials file ${credentialsPath}: ${err}`);
159
+ }
160
+ return null;
161
+ }
162
+ let creds;
163
+ try {
164
+ creds = JSON.parse(raw);
165
+ }
166
+ catch (err) {
167
+ throw new Error(`failed to parse credentials file ${credentialsPath}: ${err}`);
168
+ }
169
+ if (creds.type && creds.type !== 'oauth_token') {
170
+ throw new Error(`credentials file ${credentialsPath} has unsupported type "${creds.type}" (want "oauth_token")`);
171
+ }
172
+ return creds;
173
+ };
174
+ /**
175
+ * Resolves the credentials file path for the given config.
176
+ *
177
+ * Uses `authentication.credentials_path` from the config if set, otherwise
178
+ * falls back to `<config_dir>/credentials/<profile>.json`.
179
+ *
180
+ * Returns `null` when running in a browser or the path cannot be resolved.
181
+ */
182
+ export const getCredentialsPath = async (config, profile) => {
183
+ if (config?.authentication.credentials_path) {
184
+ return config.authentication.credentials_path;
185
+ }
186
+ const rootConfigPath = await getRootConfigPath();
187
+ if (!rootConfigPath) {
188
+ return null;
189
+ }
190
+ const profileName = profile ?? (await getActiveProfileName());
191
+ if (!profileName) {
192
+ return null;
193
+ }
194
+ validateProfileName(profileName);
195
+ const path = await import('node:path');
196
+ return path.join(rootConfigPath, 'credentials', `${profileName}.json`);
197
+ };
198
+ const getRootConfigPath = async () => {
199
+ if (!supportsLocalConfigFiles()) {
200
+ return null;
201
+ }
202
+ const path = await import('node:path');
203
+ // ANTHROPIC_CONFIG_DIR is treated as a trusted path: it is set by the
204
+ // process operator, not by remote input, so it is not validated.
205
+ const configDir = readEnv('ANTHROPIC_CONFIG_DIR');
206
+ if (configDir) {
207
+ return configDir;
208
+ }
209
+ const os = getPlatformHeaders()['X-Stainless-OS'];
210
+ if (os === 'Windows') {
211
+ const appData = readEnv('APPDATA');
212
+ if (appData) {
213
+ return path.join(appData, 'Anthropic');
214
+ }
215
+ const userProfile = readEnv('USERPROFILE');
216
+ if (userProfile) {
217
+ return path.join(userProfile, 'AppData', 'Roaming', 'Anthropic');
218
+ }
219
+ // No usable Windows config root — return null so callers fall through to
220
+ // "no config available" rather than silently writing under C:\.
221
+ return null;
222
+ }
223
+ const xdgConfigHome = readEnv('XDG_CONFIG_HOME');
224
+ if (xdgConfigHome) {
225
+ return path.join(xdgConfigHome, 'anthropic');
226
+ }
227
+ const home = readEnv('HOME');
228
+ if (home) {
229
+ return path.join(home, '.config', 'anthropic');
230
+ }
231
+ return null;
232
+ };
233
+ const supportsLocalConfigFiles = () => {
234
+ const runtime = getPlatformHeaders()['X-Stainless-Runtime'];
235
+ return runtime === 'node' || runtime === 'deno';
236
+ };
237
+ const getActiveProfileName = async () => {
238
+ const rootConfigPath = await getRootConfigPath();
239
+ if (!rootConfigPath) {
240
+ return null;
241
+ }
242
+ const profileName = readEnv('ANTHROPIC_PROFILE');
243
+ if (profileName) {
244
+ return profileName;
245
+ }
246
+ const fs = await import('node:fs');
247
+ const path = await import('node:path');
248
+ const filePath = path.join(rootConfigPath, 'active_config');
249
+ try {
250
+ return (await fs.promises.readFile(filePath, 'utf-8')).trim() || 'default';
251
+ }
252
+ catch (err) {
253
+ if (err?.code !== 'ENOENT') {
254
+ throw new Error(`failed to read ${filePath}: ${err}`);
255
+ }
256
+ return 'default';
257
+ }
258
+ };
259
+ //# sourceMappingURL=credentials.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.mjs","sourceRoot":"","sources":["../src/core/credentials.ts"],"names":[],"mappings":"OAAO,EAAE,kBAAkB,EAAE;OACtB,EAAE,OAAO,EAAE;AAElB,0FAA0F;AAC1F,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC;AACzC,8FAA8F;AAC9F,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAgE9C,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AAEjD,SAAS,mBAAmB,CAAC,IAAY;IACvC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,kBAAkB,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,oCAAoC,CAAC,CAAC;IAC7E,CAAC;IACD,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CACb,iBAAiB,IAAI,4EAA4E,CAClG,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,OAAgB,EAAmC,EAAE;;IACpF,MAAM,cAAc,GAAG,MAAM,iBAAiB,EAAE,CAAC;IACjD,IAAI,cAA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d,CAAC,CAAC;AAEF,MAAM,wBAAwB,GAAG,GAAY,EAAE;IAC7C,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC,qBAAqB,CAAC,CAAC;IAC5D,OAAO,OAAO,KAAK,MAAM,IAAI,OAAO,KAAK,MAAM,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,KAAK,IAA4B,EAAE;IAC9D,MAAM,cAAc,GAAG,MAAM,iBAAiB,EAAE,CAAC;IACjD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACjD,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;IACnC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;IACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;IAC5D,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,SAAS,CAAC;IAC7E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,EAAE,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,kBAAkB,QAAQ,KAAK,GAAG,EAAE,CAAC,CAAC;QACxD,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC"}
@@ -45,12 +45,18 @@ type OverloadedParameters<T> = T extends ({
45
45
  *
46
46
  * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
47
47
  */
48
- /** @ts-ignore For users with \@types/node */ type UndiciTypesRequestInit = NotAny<import('undici-types').RequestInit> | NotAny<import('undici-types').RequestInit> | NotAny<import('../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit>;
49
- /** @ts-ignore For users with undici */ type UndiciRequestInit = NotAny<import('undici').RequestInit> | NotAny<import('undici').RequestInit> | NotAny<import('../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici/index.d.ts').RequestInit>;
50
- /** @ts-ignore For users with \@types/bun */ type BunRequestInit = globalThis.FetchRequestInit;
51
- /** @ts-ignore For users with node-fetch@2 */ type NodeFetch2RequestInit = NotAny<import('node-fetch').RequestInit> | NotAny<import('node-fetch').RequestInit> | NotAny<import('../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit>;
52
- /** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ type NodeFetch3RequestInit = NotAny<import('node-fetch.js').RequestInit> | NotAny<import('node-fetch.js').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
53
- /** @ts-ignore For users who use Deno */ type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
48
+ // @ts-ignore
49
+ type UndiciTypesRequestInit = NotAny<import('undici-types').RequestInit> | NotAny<import('undici-types').RequestInit> | NotAny<import('../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit>;
50
+ // @ts-ignore
51
+ type UndiciRequestInit = NotAny<import('undici').RequestInit> | NotAny<import('undici').RequestInit> | NotAny<import('../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici/index.d.ts').RequestInit>;
52
+ // @ts-ignore
53
+ type BunRequestInit = globalThis.FetchRequestInit;
54
+ // @ts-ignore
55
+ type NodeFetch2RequestInit = NotAny<import('node-fetch').RequestInit> | NotAny<import('node-fetch').RequestInit> | NotAny<import('../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit>;
56
+ // @ts-ignore
57
+ type NodeFetch3RequestInit = NotAny<import('node-fetch.js').RequestInit> | NotAny<import('node-fetch.js').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
58
+ // @ts-ignore
59
+ type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
54
60
  type RequestInits = NotAny<UndiciTypesRequestInit> | NotAny<UndiciRequestInit> | NotAny<BunRequestInit> | NotAny<NodeFetch2RequestInit> | NotAny<NodeFetch3RequestInit> | NotAny<RequestInit> | NotAny<FetchRequestInit>;
55
61
  /**
56
62
  * This type contains `RequestInit` options that may be available on the current runtime,
@@ -45,12 +45,18 @@ type OverloadedParameters<T> = T extends ({
45
45
  *
46
46
  * [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
47
47
  */
48
- /** @ts-ignore For users with \@types/node */ type UndiciTypesRequestInit = NotAny<import('undici-types').RequestInit> | NotAny<import('undici-types').RequestInit> | NotAny<import('../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit>;
49
- /** @ts-ignore For users with undici */ type UndiciRequestInit = NotAny<import('undici').RequestInit> | NotAny<import('undici').RequestInit> | NotAny<import('../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici/index.d.ts').RequestInit>;
50
- /** @ts-ignore For users with \@types/bun */ type BunRequestInit = globalThis.FetchRequestInit;
51
- /** @ts-ignore For users with node-fetch@2 */ type NodeFetch2RequestInit = NotAny<import('node-fetch').RequestInit> | NotAny<import('node-fetch').RequestInit> | NotAny<import('../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit>;
52
- /** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ type NodeFetch3RequestInit = NotAny<import('node-fetch.js').RequestInit> | NotAny<import('node-fetch.js').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
53
- /** @ts-ignore For users who use Deno */ type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
48
+ // @ts-ignore
49
+ type UndiciTypesRequestInit = NotAny<import('undici-types').RequestInit> | NotAny<import('undici-types').RequestInit> | NotAny<import('../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit>;
50
+ // @ts-ignore
51
+ type UndiciRequestInit = NotAny<import('undici').RequestInit> | NotAny<import('undici').RequestInit> | NotAny<import('../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici/index.d.ts').RequestInit>;
52
+ // @ts-ignore
53
+ type BunRequestInit = globalThis.FetchRequestInit;
54
+ // @ts-ignore
55
+ type NodeFetch2RequestInit = NotAny<import('node-fetch').RequestInit> | NotAny<import('node-fetch').RequestInit> | NotAny<import('../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit>;
56
+ // @ts-ignore
57
+ type NodeFetch3RequestInit = NotAny<import('node-fetch.js').RequestInit> | NotAny<import('node-fetch.js').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
58
+ // @ts-ignore
59
+ type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
54
60
  type RequestInits = NotAny<UndiciTypesRequestInit> | NotAny<UndiciRequestInit> | NotAny<BunRequestInit> | NotAny<NodeFetch2RequestInit> | NotAny<NodeFetch3RequestInit> | NotAny<RequestInit> | NotAny<FetchRequestInit>;
55
61
  /**
56
62
  * This type contains `RequestInit` options that may be available on the current runtime,
@@ -0,0 +1,3 @@
1
+ /** Current time as unix epoch seconds. */
2
+ export declare function nowAsSeconds(): number;
3
+ //# sourceMappingURL=time.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.mts","sourceRoot":"","sources":["../../src/internal/utils/time.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
@@ -0,0 +1,3 @@
1
+ /** Current time as unix epoch seconds. */
2
+ export declare function nowAsSeconds(): number;
3
+ //# sourceMappingURL=time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/internal/utils/time.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nowAsSeconds = nowAsSeconds;
4
+ /** Current time as unix epoch seconds. */
5
+ function nowAsSeconds() {
6
+ return Math.floor(Date.now() / 1000);
7
+ }
8
+ //# sourceMappingURL=time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.js","sourceRoot":"","sources":["../../src/internal/utils/time.ts"],"names":[],"mappings":";;AACA,oCAEC;AAHD,0CAA0C;AAC1C,SAAgB,YAAY;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /** Current time as unix epoch seconds. */
2
+ export function nowAsSeconds() {
3
+ return Math.floor(Date.now() / 1000);
4
+ }
5
+ //# sourceMappingURL=time.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.mjs","sourceRoot":"","sources":["../../src/internal/utils/time.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,39 @@
1
+ import type { Fetch } from "../../internal/builtin-types.mjs";
2
+ import { type AnthropicConfig } from "../../core/credentials.mjs";
3
+ import type { CredentialResult } from "./types.mjs";
4
+ /**
5
+ * Builds a {@link CredentialResult} from an explicit {@link AnthropicConfig}.
6
+ *
7
+ * Use this when constructing a client from an in-memory config object rather
8
+ * than from profile files or environment variables.
9
+ *
10
+ * For `oidc_federation`, `authentication.credentials_path` is optional —
11
+ * if omitted, every call performs a fresh exchange with no on-disk cache.
12
+ * For `user_oauth`, `authentication.credentials_path` is required (it is
13
+ * where the access/refresh tokens live).
14
+ */
15
+ export type ResolverOptions = {
16
+ baseURL: string;
17
+ fetch: Fetch;
18
+ userAgent?: string | undefined;
19
+ onCacheWriteError?: ((err: unknown) => void) | undefined;
20
+ onSafetyWarning?: ((msg: string) => void) | undefined;
21
+ };
22
+ export declare function resolveCredentialsFromConfig(config: AnthropicConfig, options: ResolverOptions): CredentialResult;
23
+ /**
24
+ * Resolves a {@link CredentialResult} from the environment. Returns `null`
25
+ * when no credentials can be resolved.
26
+ *
27
+ * Resolution order:
28
+ *
29
+ * 1. Config file for the active profile (or the explicit `profile` argument)
30
+ * → dispatch on `authentication.type` (`oidc_federation`, `user_oauth`)
31
+ * 2. Environment variables `ANTHROPIC_FEDERATION_RULE_ID` +
32
+ * `ANTHROPIC_ORGANIZATION_ID` (+ identity token) → OIDC federation
33
+ * 3. Nothing matches → `null`
34
+ *
35
+ * Passing `profile` selects `<config_dir>/configs/<profile>.json` directly,
36
+ * skipping `ANTHROPIC_PROFILE` / `active_config` resolution.
37
+ */
38
+ export declare function defaultCredentials(options: ResolverOptions, profile?: string): Promise<CredentialResult | null>;
39
+ //# sourceMappingURL=credential-chain.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-chain.d.mts","sourceRoot":"","sources":["../../src/lib/credentials/credential-chain.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,KAAK,EAAE;OAEd,EAIL,KAAK,eAAe,EACrB;OACM,KAAK,EAAuB,gBAAgB,EAAyB;AAY5E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,iBAAiB,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACzD,eAAe,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACvD,CAAC;AAEF,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,eAAe,GACvB,gBAAgB,CAkBlB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,eAAe,EACxB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAsBlC"}
@@ -0,0 +1,39 @@
1
+ import type { Fetch } from "../../internal/builtin-types.js";
2
+ import { type AnthropicConfig } from "../../core/credentials.js";
3
+ import type { CredentialResult } from "./types.js";
4
+ /**
5
+ * Builds a {@link CredentialResult} from an explicit {@link AnthropicConfig}.
6
+ *
7
+ * Use this when constructing a client from an in-memory config object rather
8
+ * than from profile files or environment variables.
9
+ *
10
+ * For `oidc_federation`, `authentication.credentials_path` is optional —
11
+ * if omitted, every call performs a fresh exchange with no on-disk cache.
12
+ * For `user_oauth`, `authentication.credentials_path` is required (it is
13
+ * where the access/refresh tokens live).
14
+ */
15
+ export type ResolverOptions = {
16
+ baseURL: string;
17
+ fetch: Fetch;
18
+ userAgent?: string | undefined;
19
+ onCacheWriteError?: ((err: unknown) => void) | undefined;
20
+ onSafetyWarning?: ((msg: string) => void) | undefined;
21
+ };
22
+ export declare function resolveCredentialsFromConfig(config: AnthropicConfig, options: ResolverOptions): CredentialResult;
23
+ /**
24
+ * Resolves a {@link CredentialResult} from the environment. Returns `null`
25
+ * when no credentials can be resolved.
26
+ *
27
+ * Resolution order:
28
+ *
29
+ * 1. Config file for the active profile (or the explicit `profile` argument)
30
+ * → dispatch on `authentication.type` (`oidc_federation`, `user_oauth`)
31
+ * 2. Environment variables `ANTHROPIC_FEDERATION_RULE_ID` +
32
+ * `ANTHROPIC_ORGANIZATION_ID` (+ identity token) → OIDC federation
33
+ * 3. Nothing matches → `null`
34
+ *
35
+ * Passing `profile` selects `<config_dir>/configs/<profile>.json` directly,
36
+ * skipping `ANTHROPIC_PROFILE` / `active_config` resolution.
37
+ */
38
+ export declare function defaultCredentials(options: ResolverOptions, profile?: string): Promise<CredentialResult | null>;
39
+ //# sourceMappingURL=credential-chain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-chain.d.ts","sourceRoot":"","sources":["../../src/lib/credentials/credential-chain.ts"],"names":[],"mappings":"OAAO,KAAK,EAAE,KAAK,EAAE;OAEd,EAIL,KAAK,eAAe,EACrB;OACM,KAAK,EAAuB,gBAAgB,EAAyB;AAY5E;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,iBAAiB,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACzD,eAAe,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACvD,CAAC;AAEF,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,eAAe,GACvB,gBAAgB,CAkBlB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,eAAe,EACxB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAsBlC"}