@cleocode/adapters 2026.5.68 → 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.
package/dist/index.js
CHANGED
|
@@ -777,6 +777,34 @@ var init_branch_lock = __esm({
|
|
|
777
777
|
}
|
|
778
778
|
});
|
|
779
779
|
|
|
780
|
+
// packages/contracts/src/credentials.ts
|
|
781
|
+
function parseClaudeCodeCredentials(buf) {
|
|
782
|
+
try {
|
|
783
|
+
const text = typeof buf === "string" ? buf : buf.toString("utf-8");
|
|
784
|
+
const raw = JSON.parse(text);
|
|
785
|
+
const oauth = raw["claudeAiOauth"];
|
|
786
|
+
if (!oauth || typeof oauth !== "object") return null;
|
|
787
|
+
const block = oauth;
|
|
788
|
+
const accessToken = block["accessToken"];
|
|
789
|
+
if (typeof accessToken !== "string" || !accessToken.trim()) return null;
|
|
790
|
+
const expiresAt = typeof block["expiresAt"] === "number" ? block["expiresAt"] : void 0;
|
|
791
|
+
if (expiresAt !== void 0 && Date.now() > expiresAt) return null;
|
|
792
|
+
const refreshToken = typeof block["refreshToken"] === "string" && block["refreshToken"].trim() ? block["refreshToken"] : void 0;
|
|
793
|
+
return {
|
|
794
|
+
accessToken: accessToken.trim(),
|
|
795
|
+
...expiresAt !== void 0 ? { expiresAt } : {},
|
|
796
|
+
...refreshToken !== void 0 ? { refreshToken } : {}
|
|
797
|
+
};
|
|
798
|
+
} catch {
|
|
799
|
+
return null;
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
var init_credentials = __esm({
|
|
803
|
+
"packages/contracts/src/credentials.ts"() {
|
|
804
|
+
"use strict";
|
|
805
|
+
}
|
|
806
|
+
});
|
|
807
|
+
|
|
780
808
|
// packages/contracts/src/engine-result.ts
|
|
781
809
|
var init_engine_result = __esm({
|
|
782
810
|
"packages/contracts/src/engine-result.ts"() {
|
|
@@ -894,6 +922,13 @@ var init_lafs = __esm({
|
|
|
894
922
|
}
|
|
895
923
|
});
|
|
896
924
|
|
|
925
|
+
// packages/contracts/src/llm/plugin-llm.ts
|
|
926
|
+
var init_plugin_llm = __esm({
|
|
927
|
+
"packages/contracts/src/llm/plugin-llm.ts"() {
|
|
928
|
+
"use strict";
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
|
|
897
932
|
// packages/contracts/src/operations/admin.ts
|
|
898
933
|
var init_admin = __esm({
|
|
899
934
|
"packages/contracts/src/operations/admin.ts"() {
|
|
@@ -1292,6 +1327,7 @@ var init_src = __esm({
|
|
|
1292
1327
|
init_acceptance_gate_schema();
|
|
1293
1328
|
init_attachment_schema();
|
|
1294
1329
|
init_branch_lock();
|
|
1330
|
+
init_credentials();
|
|
1295
1331
|
init_engine_result();
|
|
1296
1332
|
init_errors();
|
|
1297
1333
|
init_evidence_record_schema();
|
|
@@ -1299,6 +1335,7 @@ var init_src = __esm({
|
|
|
1299
1335
|
init_facade();
|
|
1300
1336
|
init_graph();
|
|
1301
1337
|
init_lafs();
|
|
1338
|
+
init_plugin_llm();
|
|
1302
1339
|
init_operations();
|
|
1303
1340
|
init_nexus_scope_map();
|
|
1304
1341
|
init_params();
|
|
@@ -27160,10 +27197,10 @@ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:f
|
|
|
27160
27197
|
import { homedir as homedir2 } from "node:os";
|
|
27161
27198
|
import { join as join2 } from "node:path";
|
|
27162
27199
|
function resolveAnthropicApiKey() {
|
|
27163
|
-
const envKey = process.env
|
|
27200
|
+
const envKey = process.env["ANTHROPIC_API_KEY"];
|
|
27164
27201
|
if (envKey?.trim()) return envKey;
|
|
27165
27202
|
try {
|
|
27166
|
-
const xdg = process.env
|
|
27203
|
+
const xdg = process.env["XDG_DATA_HOME"] ?? join2(homedir2(), ".local", "share");
|
|
27167
27204
|
const keyFile = join2(xdg, "cleo", "anthropic-key");
|
|
27168
27205
|
if (existsSync2(keyFile)) {
|
|
27169
27206
|
const stored = readFileSync2(keyFile, "utf-8").trim();
|
|
@@ -27175,13 +27212,8 @@ function resolveAnthropicApiKey() {
|
|
|
27175
27212
|
const credPath = join2(homedir2(), ".claude", ".credentials.json");
|
|
27176
27213
|
if (!existsSync2(credPath)) return null;
|
|
27177
27214
|
const raw = readFileSync2(credPath, "utf-8");
|
|
27178
|
-
const
|
|
27179
|
-
|
|
27180
|
-
if (token?.trim()) {
|
|
27181
|
-
const expiresAt = creds.claudeAiOauth?.expiresAt;
|
|
27182
|
-
if (expiresAt && Date.now() > expiresAt) return null;
|
|
27183
|
-
return token;
|
|
27184
|
-
}
|
|
27215
|
+
const cred = parseClaudeCodeCredentials(raw);
|
|
27216
|
+
return cred?.accessToken ?? null;
|
|
27185
27217
|
} catch {
|
|
27186
27218
|
}
|
|
27187
27219
|
return null;
|