@cleocode/adapters 2026.5.74 → 2026.5.76

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/index.js CHANGED
@@ -1349,6 +1349,39 @@ var init_src = __esm({
1349
1349
  }
1350
1350
  });
1351
1351
 
1352
+ // packages/adapters/src/providers/shared/credentials.ts
1353
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
1354
+ import { homedir as homedir2 } from "node:os";
1355
+ import { join as join2 } from "node:path";
1356
+ function resolveCredentials(_provider) {
1357
+ const envKey = process.env["ANTHROPIC_API_KEY"];
1358
+ if (envKey?.trim()) return { apiKey: envKey.trim() };
1359
+ try {
1360
+ const xdg = process.env["XDG_DATA_HOME"] ?? join2(homedir2(), ".local", "share");
1361
+ const keyFile = join2(xdg, "cleo", "anthropic-key");
1362
+ if (existsSync2(keyFile)) {
1363
+ const stored = readFileSync2(keyFile, "utf-8").trim();
1364
+ if (stored) return { apiKey: stored };
1365
+ }
1366
+ } catch {
1367
+ }
1368
+ try {
1369
+ const credPath = join2(homedir2(), ".claude", ".credentials.json");
1370
+ if (!existsSync2(credPath)) return { apiKey: null };
1371
+ const raw = readFileSync2(credPath, "utf-8");
1372
+ const cred = parseClaudeCodeCredentials(raw);
1373
+ return { apiKey: cred?.accessToken ?? null };
1374
+ } catch {
1375
+ }
1376
+ return { apiKey: null };
1377
+ }
1378
+ var init_credentials2 = __esm({
1379
+ "packages/adapters/src/providers/shared/credentials.ts"() {
1380
+ "use strict";
1381
+ init_src();
1382
+ }
1383
+ });
1384
+
1352
1385
  // packages/adapters/src/providers/claude-sdk/session-store.ts
1353
1386
  var SessionStore;
1354
1387
  var init_session_store = __esm({
@@ -27193,36 +27226,12 @@ var init_dist4 = __esm({
27193
27226
  });
27194
27227
 
27195
27228
  // packages/adapters/src/providers/claude-sdk/spawn.ts
27196
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
27197
- import { homedir as homedir2 } from "node:os";
27198
- import { join as join2 } from "node:path";
27199
- function resolveAnthropicApiKey() {
27200
- const envKey = process.env["ANTHROPIC_API_KEY"];
27201
- if (envKey?.trim()) return envKey;
27202
- try {
27203
- const xdg = process.env["XDG_DATA_HOME"] ?? join2(homedir2(), ".local", "share");
27204
- const keyFile = join2(xdg, "cleo", "anthropic-key");
27205
- if (existsSync2(keyFile)) {
27206
- const stored = readFileSync2(keyFile, "utf-8").trim();
27207
- if (stored) return stored;
27208
- }
27209
- } catch {
27210
- }
27211
- try {
27212
- const credPath = join2(homedir2(), ".claude", ".credentials.json");
27213
- if (!existsSync2(credPath)) return null;
27214
- const raw = readFileSync2(credPath, "utf-8");
27215
- const cred = parseClaudeCodeCredentials(raw);
27216
- return cred?.accessToken ?? null;
27217
- } catch {
27218
- }
27219
- return null;
27220
- }
27221
27229
  var DEFAULT_MODEL, ClaudeSDKSpawnProvider;
27222
27230
  var init_spawn = __esm({
27223
27231
  "packages/adapters/src/providers/claude-sdk/spawn.ts"() {
27224
27232
  "use strict";
27225
27233
  init_src();
27234
+ init_credentials2();
27226
27235
  init_session_store();
27227
27236
  init_tool_bridge();
27228
27237
  DEFAULT_MODEL = "claude-sonnet-4-5";
@@ -27240,7 +27249,7 @@ var init_spawn = __esm({
27240
27249
  * @returns `true` when any Anthropic credential is available
27241
27250
  */
27242
27251
  async canSpawn() {
27243
- return !!resolveAnthropicApiKey();
27252
+ return !!resolveCredentials("anthropic").apiKey;
27244
27253
  }
27245
27254
  /**
27246
27255
  * Spawn a subagent using the Vercel AI SDK.
@@ -27274,7 +27283,7 @@ var init_spawn = __esm({
27274
27283
  }
27275
27284
  const { createAnthropic: createAnthropic2 } = await Promise.resolve().then(() => (init_dist4(), dist_exports));
27276
27285
  const { generateText } = await import("ai");
27277
- const apiKey = resolveAnthropicApiKey();
27286
+ const apiKey = resolveCredentials("anthropic").apiKey;
27278
27287
  if (!apiKey) {
27279
27288
  this.sessions.remove(instanceId);
27280
27289
  return {