@cleocode/adapters 2026.5.67 → 2026.5.69

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.
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-sdk/spawn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAKH,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AA+D3F;;;;;;;;;;;;;;GAcG;AACH,qBAAa,sBAAuB,YAAW,oBAAoB;IACjE,kCAAkC;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsB;IAE/C;;;;;;;;;OASG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAIlC;;;;;;;;OAQG;IACG,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAwGxD;;;;;;;OAOG;IACG,WAAW,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAU3C;;;;;;;;;OASG;IACG,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnD"}
1
+ {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-sdk/spawn.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAKH,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAmD3F;;;;;;;;;;;;;;GAcG;AACH,qBAAa,sBAAuB,YAAW,oBAAoB;IACjE,kCAAkC;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsB;IAE/C;;;;;;;;;OASG;IACG,QAAQ,IAAI,OAAO,CAAC,OAAO,CAAC;IAIlC;;;;;;;;OAQG;IACG,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAwGxD;;;;;;;OAOG;IACG,WAAW,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAU3C;;;;;;;;;OASG;IACG,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleocode/adapters",
3
- "version": "2026.5.67",
3
+ "version": "2026.5.69",
4
4
  "description": "Unified provider adapters for CLEO (Claude Code, OpenCode, Cursor)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -15,9 +15,9 @@
15
15
  "@ai-sdk/anthropic": "^3.0.69",
16
16
  "@ai-sdk/openai": "^2.0.53",
17
17
  "ai": "^6.0.168",
18
- "@cleocode/contracts": "2026.5.67",
19
- "@cleocode/caamp": "2026.5.67",
20
- "@cleocode/paths": "2026.5.67"
18
+ "@cleocode/caamp": "2026.5.69",
19
+ "@cleocode/paths": "2026.5.69",
20
+ "@cleocode/contracts": "2026.5.69"
21
21
  },
22
22
  "license": "MIT",
23
23
  "engines": {
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "@types/node": "^22.19.15",
32
32
  "vitest": "^4.1.4",
33
- "@cleocode/playbooks": "2026.5.67"
33
+ "@cleocode/playbooks": "2026.5.69"
34
34
  },
35
35
  "repository": {
36
36
  "type": "git",
@@ -27,17 +27,12 @@ import { existsSync, readFileSync } from 'node:fs';
27
27
  import { homedir } from 'node:os';
28
28
  import { join } from 'node:path';
29
29
  import type { AdapterSpawnProvider, SpawnContext, SpawnResult } from '@cleocode/contracts';
30
- import { getErrorMessage } from '@cleocode/contracts';
30
+ import { getErrorMessage, parseClaudeCodeCredentials } from '@cleocode/contracts';
31
31
  import { SessionStore } from './session-store.js';
32
32
  import { resolveTools } from './tool-bridge.js';
33
33
 
34
34
  // ---------------------------------------------------------------------------
35
- // Inline 3-tier Anthropic key resolver
36
- // NOTE: Cannot import from @cleocode/core — circular dependency
37
- // (@cleocode/core depends on @cleocode/adapters). This is a deliberate
38
- // inline copy of the resolution logic from anthropic-key-resolver.ts.
39
- // Keep in sync with packages/core/src/memory/anthropic-key-resolver.ts.
40
- // T752 — OAuth fix for canSpawn()
35
+ // 3-tier Anthropic key resolver
41
36
  // ---------------------------------------------------------------------------
42
37
 
43
38
  /**
@@ -50,12 +45,12 @@ import { resolveTools } from './tool-bridge.js';
50
45
  */
51
46
  function resolveAnthropicApiKey(): string | null {
52
47
  // 1. Explicit env var
53
- const envKey = process.env.ANTHROPIC_API_KEY;
48
+ const envKey = process.env['ANTHROPIC_API_KEY'];
54
49
  if (envKey?.trim()) return envKey;
55
50
 
56
51
  // 2. CLEO global stored key
57
52
  try {
58
- const xdg = process.env.XDG_DATA_HOME || join(homedir(), '.local', 'share');
53
+ const xdg = process.env['XDG_DATA_HOME'] ?? join(homedir(), '.local', 'share');
59
54
  const keyFile = join(xdg, 'cleo', 'anthropic-key');
60
55
  if (existsSync(keyFile)) {
61
56
  const stored = readFileSync(keyFile, 'utf-8').trim();
@@ -65,20 +60,13 @@ function resolveAnthropicApiKey(): string | null {
65
60
  // Not available — continue
66
61
  }
67
62
 
68
- // 3. Claude Code OAuth token (free for Claude Code users)
63
+ // 3. Claude Code OAuth token — parsed by the shared contracts helper
69
64
  try {
70
65
  const credPath = join(homedir(), '.claude', '.credentials.json');
71
66
  if (!existsSync(credPath)) return null;
72
67
  const raw = readFileSync(credPath, 'utf-8');
73
- const creds = JSON.parse(raw) as {
74
- claudeAiOauth?: { accessToken?: string; expiresAt?: number };
75
- };
76
- const token = creds.claudeAiOauth?.accessToken;
77
- if (token?.trim()) {
78
- const expiresAt = creds.claudeAiOauth?.expiresAt;
79
- if (expiresAt && Date.now() > expiresAt) return null;
80
- return token;
81
- }
68
+ const cred = parseClaudeCodeCredentials(raw);
69
+ return cred?.accessToken ?? null;
82
70
  } catch {
83
71
  // Credentials file missing or unreadable — not an error
84
72
  }