claude-use 11.9.0 → 11.10.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.
- package/dist/cli.cjs +583 -288
- package/dist/index.cjs +58 -35
- package/dist/index.mjs +58 -35
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -346,10 +346,10 @@ var init_schema = __esm({
|
|
|
346
346
|
ANTIGRAVITY_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"];
|
|
347
347
|
ANTIGRAVITY_DEFAULT_MODE = "cloud";
|
|
348
348
|
ANTIGRAVITY_DEFAULT_TIER_MODELS = Object.freeze({
|
|
349
|
-
fable: "gemini-
|
|
350
|
-
opus: "gemini-
|
|
351
|
-
sonnet: "gemini-
|
|
352
|
-
haiku: "gemini-
|
|
349
|
+
fable: "gemini-3.8-flash-high",
|
|
350
|
+
opus: "gemini-3.8-flash-high",
|
|
351
|
+
sonnet: "gemini-3.8-flash-medium",
|
|
352
|
+
haiku: "gemini-3.8-flash-low"
|
|
353
353
|
});
|
|
354
354
|
AntigravityProviderConfigSchema = import_zod.z.strictObject({
|
|
355
355
|
/** Operational mode: direct cloud endpoint or local ACP daemon. Defaults to `cloud`. */
|
|
@@ -2841,7 +2841,7 @@ var init_package = __esm({
|
|
|
2841
2841
|
"package.json"() {
|
|
2842
2842
|
package_default = {
|
|
2843
2843
|
name: "claude-use",
|
|
2844
|
-
version: "11.
|
|
2844
|
+
version: "11.10.0",
|
|
2845
2845
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
2846
2846
|
license: "MIT",
|
|
2847
2847
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -6197,11 +6197,33 @@ function formatCredentialSummary(summary) {
|
|
|
6197
6197
|
function describeCredential(credential) {
|
|
6198
6198
|
return formatCredentialSummary(summariseCredential(credential));
|
|
6199
6199
|
}
|
|
6200
|
+
function isRecord5(value) {
|
|
6201
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6202
|
+
}
|
|
6203
|
+
function unpackKeyringToken(raw) {
|
|
6204
|
+
const trimmed = raw.trim();
|
|
6205
|
+
if (!trimmed.startsWith(GO_KEYRING_BASE64_PREFIX)) {
|
|
6206
|
+
return trimmed;
|
|
6207
|
+
}
|
|
6208
|
+
try {
|
|
6209
|
+
const base64Str = trimmed.slice(GO_KEYRING_BASE64_PREFIX.length);
|
|
6210
|
+
const decoded = Buffer.from(base64Str, "base64").toString("utf8");
|
|
6211
|
+
const parsed = JSON.parse(decoded);
|
|
6212
|
+
if (isRecord5(parsed) && isRecord5(parsed.token)) {
|
|
6213
|
+
const accessToken = parsed.token.access_token;
|
|
6214
|
+
if (typeof accessToken === "string" && accessToken.trim() !== "") {
|
|
6215
|
+
return accessToken.trim();
|
|
6216
|
+
}
|
|
6217
|
+
}
|
|
6218
|
+
} catch {
|
|
6219
|
+
}
|
|
6220
|
+
return trimmed;
|
|
6221
|
+
}
|
|
6200
6222
|
function trySource(source, params) {
|
|
6201
6223
|
const none = (reason, warn = false) => ({ ok: false, reason, warn });
|
|
6202
6224
|
if ("env" in source) {
|
|
6203
6225
|
const value = params.env[source.env];
|
|
6204
|
-
return value === void 0 || value === "" ? none("is unset or empty") : { ok: true, token: value };
|
|
6226
|
+
return value === void 0 || value === "" ? none("is unset or empty") : { ok: true, token: unpackKeyringToken(value) };
|
|
6205
6227
|
}
|
|
6206
6228
|
if ("literal" in source) {
|
|
6207
6229
|
return { ok: true, token: source.literal };
|
|
@@ -6217,7 +6239,7 @@ function trySource(source, params) {
|
|
|
6217
6239
|
true
|
|
6218
6240
|
);
|
|
6219
6241
|
}
|
|
6220
|
-
const token2 = read.content.trim();
|
|
6242
|
+
const token2 = unpackKeyringToken(read.content.trim());
|
|
6221
6243
|
return token2 === "" ? none("is empty") : { ok: true, token: token2 };
|
|
6222
6244
|
}
|
|
6223
6245
|
const argv = commandArgv(source);
|
|
@@ -6235,7 +6257,7 @@ function trySource(source, params) {
|
|
|
6235
6257
|
const outcome = result.status === null ? "could not be run or was killed by a signal" : `exited with status ${String(result.status)}`;
|
|
6236
6258
|
return none(`${outcome}${stderr === "" ? "" : `: ${stderr}`}`);
|
|
6237
6259
|
}
|
|
6238
|
-
const token = result.stdout.trim();
|
|
6260
|
+
const token = unpackKeyringToken(result.stdout.trim());
|
|
6239
6261
|
return token === "" ? none("printed no token") : { ok: true, token };
|
|
6240
6262
|
}
|
|
6241
6263
|
function warmCommandFor(subject) {
|
|
@@ -6279,7 +6301,7 @@ function credentialVariables(target, token) {
|
|
|
6279
6301
|
CLAUDE_CODE_OAUTH_TOKEN: target === "oauthToken" ? token : void 0
|
|
6280
6302
|
};
|
|
6281
6303
|
}
|
|
6282
|
-
var CREDENTIAL_UNAVAILABLE_EXIT, CREDENTIAL_COMMAND_TIMEOUT_MS, CREDENTIAL_INTERACTIVE_TIMEOUT_MS, GROUP_OTHER_PERMISSION_BITS, PERMISSION_BITS2, OCTAL_RADIX2;
|
|
6304
|
+
var CREDENTIAL_UNAVAILABLE_EXIT, CREDENTIAL_COMMAND_TIMEOUT_MS, CREDENTIAL_INTERACTIVE_TIMEOUT_MS, GROUP_OTHER_PERMISSION_BITS, PERMISSION_BITS2, OCTAL_RADIX2, GO_KEYRING_BASE64_PREFIX;
|
|
6283
6305
|
var init_credential = __esm({
|
|
6284
6306
|
"src/credential.ts"() {
|
|
6285
6307
|
"use strict";
|
|
@@ -6290,6 +6312,7 @@ var init_credential = __esm({
|
|
|
6290
6312
|
GROUP_OTHER_PERMISSION_BITS = 63;
|
|
6291
6313
|
PERMISSION_BITS2 = 511;
|
|
6292
6314
|
OCTAL_RADIX2 = 8;
|
|
6315
|
+
GO_KEYRING_BASE64_PREFIX = "go-keyring-base64:";
|
|
6293
6316
|
}
|
|
6294
6317
|
});
|
|
6295
6318
|
|
|
@@ -6300,14 +6323,14 @@ function providerJsonPath(paths, name) {
|
|
|
6300
6323
|
function providerExists(paths, name) {
|
|
6301
6324
|
return import_node_fs6.default.existsSync(providerJsonPath(paths, name));
|
|
6302
6325
|
}
|
|
6303
|
-
function
|
|
6326
|
+
function isRecord6(value) {
|
|
6304
6327
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6305
6328
|
}
|
|
6306
6329
|
function legacyProviderConversion(raw) {
|
|
6307
|
-
if (!
|
|
6330
|
+
if (!isRecord6(raw) || "credential" in raw) {
|
|
6308
6331
|
return void 0;
|
|
6309
6332
|
}
|
|
6310
|
-
const env =
|
|
6333
|
+
const env = isRecord6(raw.env) ? raw.env : void 0;
|
|
6311
6334
|
const legacyEnvKeys = env === void 0 ? [] : Object.keys(env).filter((key) => LEGACY_ENV_CREDENTIAL_KEYS.includes(key));
|
|
6312
6335
|
const fields = [...LEGACY_PROVIDER_FIELDS.filter((field) => field in raw), ...legacyEnvKeys.map((key) => `env.${key}`)];
|
|
6313
6336
|
if (fields.length === 0) {
|
|
@@ -16254,15 +16277,15 @@ function createQuotaExpiringPublisher(hub, deps) {
|
|
|
16254
16277
|
|
|
16255
16278
|
// src/frontdoor/rcLiveUsage.ts
|
|
16256
16279
|
var RC_RATE_LIMIT_EVENT_TYPE = "rate_limit_event";
|
|
16257
|
-
function
|
|
16280
|
+
function isRecord7(value) {
|
|
16258
16281
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16259
16282
|
}
|
|
16260
16283
|
function rcRateLimitInfoOf(event) {
|
|
16261
16284
|
const payload = event.envelope.payload;
|
|
16262
|
-
if (!
|
|
16285
|
+
if (!isRecord7(payload) || payload.type !== RC_RATE_LIMIT_EVENT_TYPE) {
|
|
16263
16286
|
return void 0;
|
|
16264
16287
|
}
|
|
16265
|
-
if (!
|
|
16288
|
+
if (!isRecord7(payload.rate_limit_info)) {
|
|
16266
16289
|
return void 0;
|
|
16267
16290
|
}
|
|
16268
16291
|
const parsed = RcRateLimitInfoSchema.safeParse(payload.rate_limit_info);
|
|
@@ -16350,7 +16373,7 @@ function createSseParser() {
|
|
|
16350
16373
|
}
|
|
16351
16374
|
};
|
|
16352
16375
|
}
|
|
16353
|
-
function
|
|
16376
|
+
function isRecord8(value) {
|
|
16354
16377
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16355
16378
|
}
|
|
16356
16379
|
function sequenceNumOf(value) {
|
|
@@ -16372,7 +16395,7 @@ function parseRcStreamEnvelope(parsed) {
|
|
|
16372
16395
|
} catch {
|
|
16373
16396
|
return void 0;
|
|
16374
16397
|
}
|
|
16375
|
-
if (!
|
|
16398
|
+
if (!isRecord8(data)) {
|
|
16376
16399
|
return void 0;
|
|
16377
16400
|
}
|
|
16378
16401
|
const eventType = data.event_type;
|
|
@@ -16613,7 +16636,7 @@ init_capability();
|
|
|
16613
16636
|
// src/frontdoor/rcSelfHostEndpoints.ts
|
|
16614
16637
|
var RC_SOURCE_WORKER = "worker";
|
|
16615
16638
|
var RC_SOURCE_CLIENT = "client";
|
|
16616
|
-
function
|
|
16639
|
+
function isRecord9(value) {
|
|
16617
16640
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16618
16641
|
}
|
|
16619
16642
|
function parseJsonObject2(body) {
|
|
@@ -16623,7 +16646,7 @@ function parseJsonObject2(body) {
|
|
|
16623
16646
|
} catch {
|
|
16624
16647
|
return void 0;
|
|
16625
16648
|
}
|
|
16626
|
-
return
|
|
16649
|
+
return isRecord9(parsed) ? parsed : void 0;
|
|
16627
16650
|
}
|
|
16628
16651
|
function nonEmptyString2(record, field) {
|
|
16629
16652
|
const value = record === void 0 ? void 0 : record[field];
|
|
@@ -16697,7 +16720,7 @@ async function serveRcClientChannels(ctx, tail, method, maxBatchEvents) {
|
|
|
16697
16720
|
}
|
|
16698
16721
|
const results = [];
|
|
16699
16722
|
for (const event of events) {
|
|
16700
|
-
if (!
|
|
16723
|
+
if (!isRecord9(event) || !isRecord9(event.payload)) {
|
|
16701
16724
|
await ctx.answerJson(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a teleport write is an object carrying one payload object" } });
|
|
16702
16725
|
return true;
|
|
16703
16726
|
}
|
|
@@ -16797,7 +16820,7 @@ async function serveRcCompatSessions(ctx, pathname, compatPath) {
|
|
|
16797
16820
|
// src/frontdoor/rcSelfHostConversations.ts
|
|
16798
16821
|
var RC_CONVERSATIONS_PATH_PREFIX = "/v1/code/conversations";
|
|
16799
16822
|
var RC_CONVERSATION_ID_PREFIX = "conv_";
|
|
16800
|
-
function
|
|
16823
|
+
function isRecord10(value) {
|
|
16801
16824
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16802
16825
|
}
|
|
16803
16826
|
function parseJsonObject3(body) {
|
|
@@ -16807,7 +16830,7 @@ function parseJsonObject3(body) {
|
|
|
16807
16830
|
} catch {
|
|
16808
16831
|
return void 0;
|
|
16809
16832
|
}
|
|
16810
|
-
return
|
|
16833
|
+
return isRecord10(parsed) ? parsed : void 0;
|
|
16811
16834
|
}
|
|
16812
16835
|
function nonEmptyString3(record, field) {
|
|
16813
16836
|
const value = record === void 0 ? void 0 : record[field];
|
|
@@ -16861,7 +16884,7 @@ async function serveRcConversations(ctx, pathname, method) {
|
|
|
16861
16884
|
}
|
|
16862
16885
|
const results = [];
|
|
16863
16886
|
for (const event of events) {
|
|
16864
|
-
if (!
|
|
16887
|
+
if (!isRecord10(event) || !isRecord10(event.payload)) {
|
|
16865
16888
|
await ctx.answerJson(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a write is an object carrying one payload object" } });
|
|
16866
16889
|
return;
|
|
16867
16890
|
}
|
|
@@ -16893,7 +16916,7 @@ var RC_SELF_HOST_SCOPE_LIST = ["user:profile", "user:inference", "user:sessions:
|
|
|
16893
16916
|
var RC_SELF_HOST_OAUTH_TOKEN_TTL_SECONDS = 3600;
|
|
16894
16917
|
var MS_PER_SECOND5 = 1e3;
|
|
16895
16918
|
var HTTP_SERVICE_UNAVAILABLE = 503;
|
|
16896
|
-
function
|
|
16919
|
+
function isRecord11(value) {
|
|
16897
16920
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16898
16921
|
}
|
|
16899
16922
|
function parseJsonObject4(body) {
|
|
@@ -16903,7 +16926,7 @@ function parseJsonObject4(body) {
|
|
|
16903
16926
|
} catch {
|
|
16904
16927
|
return void 0;
|
|
16905
16928
|
}
|
|
16906
|
-
return
|
|
16929
|
+
return isRecord11(parsed) ? parsed : void 0;
|
|
16907
16930
|
}
|
|
16908
16931
|
function growthBookFeatures() {
|
|
16909
16932
|
return {
|
|
@@ -17257,7 +17280,7 @@ var RC_SELF_HOST_WORKER_EPOCH = 1;
|
|
|
17257
17280
|
var RC_STREAM_EVENT_NAME2 = "client_event";
|
|
17258
17281
|
var CONFLICT_REASON_HEADER2 = "x-ccr-conflict-reason";
|
|
17259
17282
|
var CONFLICT_REASON_EPOCH_STALE = "epoch_stale";
|
|
17260
|
-
function
|
|
17283
|
+
function isRecord12(value) {
|
|
17261
17284
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17262
17285
|
}
|
|
17263
17286
|
function isWebSearchRefusal(value) {
|
|
@@ -17341,7 +17364,7 @@ function parseJsonObject5(body) {
|
|
|
17341
17364
|
} catch {
|
|
17342
17365
|
return void 0;
|
|
17343
17366
|
}
|
|
17344
|
-
return
|
|
17367
|
+
return isRecord12(parsed) ? parsed : void 0;
|
|
17345
17368
|
}
|
|
17346
17369
|
function mintWorkerJwt(randomToken, issuedAt) {
|
|
17347
17370
|
const encode = (value) => Buffer.from(JSON.stringify(value), "utf8").toString("base64url");
|
|
@@ -17601,7 +17624,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
17601
17624
|
if (status !== void 0) {
|
|
17602
17625
|
session.workerStatus = status;
|
|
17603
17626
|
}
|
|
17604
|
-
if (
|
|
17627
|
+
if (isRecord12(body?.external_metadata)) {
|
|
17605
17628
|
session.externalMetadata = body.external_metadata;
|
|
17606
17629
|
}
|
|
17607
17630
|
await answerJson2(response, HTTP_STATUS.ok, {});
|
|
@@ -17631,7 +17654,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
17631
17654
|
}
|
|
17632
17655
|
const results = [];
|
|
17633
17656
|
for (const event of events) {
|
|
17634
|
-
if (!
|
|
17657
|
+
if (!isRecord12(event) || !isRecord12(event.payload)) {
|
|
17635
17658
|
await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a batch is an object carrying one payload object" } });
|
|
17636
17659
|
return;
|
|
17637
17660
|
}
|
|
@@ -17664,7 +17687,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
17664
17687
|
return;
|
|
17665
17688
|
}
|
|
17666
17689
|
for (const event of events) {
|
|
17667
|
-
if (
|
|
17690
|
+
if (isRecord12(event)) {
|
|
17668
17691
|
session.internalEvents.push({ eventId: deps.newUuid(), body: event });
|
|
17669
17692
|
}
|
|
17670
17693
|
}
|
|
@@ -17760,7 +17783,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
17760
17783
|
}
|
|
17761
17784
|
const results = [];
|
|
17762
17785
|
for (const event of events) {
|
|
17763
|
-
if (!
|
|
17786
|
+
if (!isRecord12(event) || !isRecord12(event.payload)) {
|
|
17764
17787
|
await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a write is an object carrying one payload object" } });
|
|
17765
17788
|
return;
|
|
17766
17789
|
}
|
|
@@ -17897,7 +17920,7 @@ var RC_SELF_HOST_RECORD_DIR = "rc-selfhost";
|
|
|
17897
17920
|
var RC_SELF_HOST_RECORD_FILE = "credential.json";
|
|
17898
17921
|
var SELF_HOST_EMAIL = "selfhost@agent-shim.invalid";
|
|
17899
17922
|
var SELF_HOST_SUBSCRIPTION_TYPE = "max";
|
|
17900
|
-
function
|
|
17923
|
+
function isRecord13(value) {
|
|
17901
17924
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17902
17925
|
}
|
|
17903
17926
|
function readJsonObject(fs13, file) {
|
|
@@ -17911,7 +17934,7 @@ function readJsonObject(fs13, file) {
|
|
|
17911
17934
|
} catch {
|
|
17912
17935
|
return void 0;
|
|
17913
17936
|
}
|
|
17914
|
-
return
|
|
17937
|
+
return isRecord13(parsed) ? parsed : void 0;
|
|
17915
17938
|
}
|
|
17916
17939
|
function readRcSelfHostRecord(fs13, frontdoorDir) {
|
|
17917
17940
|
const parsed = readJsonObject(fs13, import_node_path33.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
|
|
@@ -17935,7 +17958,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
17935
17958
|
const recordFile = import_node_path33.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
|
|
17936
17959
|
const previousRecord = readRcSelfHostRecord(deps.fs, deps.frontdoorDir);
|
|
17937
17960
|
const existingCredentials = readJsonObject(deps.fs, credentialsFile);
|
|
17938
|
-
const existingOauth =
|
|
17961
|
+
const existingOauth = isRecord13(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
|
|
17939
17962
|
const existingToken = typeof existingOauth?.accessToken === "string" && existingOauth.accessToken !== "" ? existingOauth.accessToken : void 0;
|
|
17940
17963
|
const existingIsOwn = existingToken !== void 0 && previousRecord?.accessToken === existingToken;
|
|
17941
17964
|
if (existingToken !== void 0 && !existingIsOwn && !deps.force) {
|
|
@@ -17952,7 +17975,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
17952
17975
|
deps.fs.writeFilePrivate(credentialsFile, `${JSON.stringify({ ...existingCredentials, claudeAiOauth: { accessToken, refreshToken, expiresAt: null, scopes: [...RC_SELF_HOST_SCOPE_LIST], subscriptionType: SELF_HOST_SUBSCRIPTION_TYPE, rateLimitTier: null } }, null, 2)}
|
|
17953
17976
|
`);
|
|
17954
17977
|
const claudeJson = readJsonObject(deps.fs, claudeJsonFile) ?? {};
|
|
17955
|
-
const existingBlock = (value) =>
|
|
17978
|
+
const existingBlock = (value) => isRecord13(value) ? value : {};
|
|
17956
17979
|
deps.fs.writeFilePrivate(claudeJsonFile, `${JSON.stringify({
|
|
17957
17980
|
...claudeJson,
|
|
17958
17981
|
oauthAccount: {
|
package/dist/index.mjs
CHANGED
|
@@ -324,10 +324,10 @@ var init_schema = __esm({
|
|
|
324
324
|
ANTIGRAVITY_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"];
|
|
325
325
|
ANTIGRAVITY_DEFAULT_MODE = "cloud";
|
|
326
326
|
ANTIGRAVITY_DEFAULT_TIER_MODELS = Object.freeze({
|
|
327
|
-
fable: "gemini-
|
|
328
|
-
opus: "gemini-
|
|
329
|
-
sonnet: "gemini-
|
|
330
|
-
haiku: "gemini-
|
|
327
|
+
fable: "gemini-3.8-flash-high",
|
|
328
|
+
opus: "gemini-3.8-flash-high",
|
|
329
|
+
sonnet: "gemini-3.8-flash-medium",
|
|
330
|
+
haiku: "gemini-3.8-flash-low"
|
|
331
331
|
});
|
|
332
332
|
AntigravityProviderConfigSchema = z.strictObject({
|
|
333
333
|
/** Operational mode: direct cloud endpoint or local ACP daemon. Defaults to `cloud`. */
|
|
@@ -2817,7 +2817,7 @@ var init_package = __esm({
|
|
|
2817
2817
|
"package.json"() {
|
|
2818
2818
|
package_default = {
|
|
2819
2819
|
name: "claude-use",
|
|
2820
|
-
version: "11.
|
|
2820
|
+
version: "11.10.0",
|
|
2821
2821
|
description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
2822
2822
|
license: "MIT",
|
|
2823
2823
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -6170,11 +6170,33 @@ function formatCredentialSummary(summary) {
|
|
|
6170
6170
|
function describeCredential(credential) {
|
|
6171
6171
|
return formatCredentialSummary(summariseCredential(credential));
|
|
6172
6172
|
}
|
|
6173
|
+
function isRecord5(value) {
|
|
6174
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6175
|
+
}
|
|
6176
|
+
function unpackKeyringToken(raw) {
|
|
6177
|
+
const trimmed = raw.trim();
|
|
6178
|
+
if (!trimmed.startsWith(GO_KEYRING_BASE64_PREFIX)) {
|
|
6179
|
+
return trimmed;
|
|
6180
|
+
}
|
|
6181
|
+
try {
|
|
6182
|
+
const base64Str = trimmed.slice(GO_KEYRING_BASE64_PREFIX.length);
|
|
6183
|
+
const decoded = Buffer.from(base64Str, "base64").toString("utf8");
|
|
6184
|
+
const parsed = JSON.parse(decoded);
|
|
6185
|
+
if (isRecord5(parsed) && isRecord5(parsed.token)) {
|
|
6186
|
+
const accessToken = parsed.token.access_token;
|
|
6187
|
+
if (typeof accessToken === "string" && accessToken.trim() !== "") {
|
|
6188
|
+
return accessToken.trim();
|
|
6189
|
+
}
|
|
6190
|
+
}
|
|
6191
|
+
} catch {
|
|
6192
|
+
}
|
|
6193
|
+
return trimmed;
|
|
6194
|
+
}
|
|
6173
6195
|
function trySource(source, params) {
|
|
6174
6196
|
const none = (reason, warn = false) => ({ ok: false, reason, warn });
|
|
6175
6197
|
if ("env" in source) {
|
|
6176
6198
|
const value = params.env[source.env];
|
|
6177
|
-
return value === void 0 || value === "" ? none("is unset or empty") : { ok: true, token: value };
|
|
6199
|
+
return value === void 0 || value === "" ? none("is unset or empty") : { ok: true, token: unpackKeyringToken(value) };
|
|
6178
6200
|
}
|
|
6179
6201
|
if ("literal" in source) {
|
|
6180
6202
|
return { ok: true, token: source.literal };
|
|
@@ -6190,7 +6212,7 @@ function trySource(source, params) {
|
|
|
6190
6212
|
true
|
|
6191
6213
|
);
|
|
6192
6214
|
}
|
|
6193
|
-
const token2 = read.content.trim();
|
|
6215
|
+
const token2 = unpackKeyringToken(read.content.trim());
|
|
6194
6216
|
return token2 === "" ? none("is empty") : { ok: true, token: token2 };
|
|
6195
6217
|
}
|
|
6196
6218
|
const argv = commandArgv(source);
|
|
@@ -6208,7 +6230,7 @@ function trySource(source, params) {
|
|
|
6208
6230
|
const outcome = result.status === null ? "could not be run or was killed by a signal" : `exited with status ${String(result.status)}`;
|
|
6209
6231
|
return none(`${outcome}${stderr === "" ? "" : `: ${stderr}`}`);
|
|
6210
6232
|
}
|
|
6211
|
-
const token = result.stdout.trim();
|
|
6233
|
+
const token = unpackKeyringToken(result.stdout.trim());
|
|
6212
6234
|
return token === "" ? none("printed no token") : { ok: true, token };
|
|
6213
6235
|
}
|
|
6214
6236
|
function warmCommandFor(subject) {
|
|
@@ -6252,7 +6274,7 @@ function credentialVariables(target, token) {
|
|
|
6252
6274
|
CLAUDE_CODE_OAUTH_TOKEN: target === "oauthToken" ? token : void 0
|
|
6253
6275
|
};
|
|
6254
6276
|
}
|
|
6255
|
-
var CREDENTIAL_UNAVAILABLE_EXIT, CREDENTIAL_COMMAND_TIMEOUT_MS, CREDENTIAL_INTERACTIVE_TIMEOUT_MS, GROUP_OTHER_PERMISSION_BITS, PERMISSION_BITS2, OCTAL_RADIX2;
|
|
6277
|
+
var CREDENTIAL_UNAVAILABLE_EXIT, CREDENTIAL_COMMAND_TIMEOUT_MS, CREDENTIAL_INTERACTIVE_TIMEOUT_MS, GROUP_OTHER_PERMISSION_BITS, PERMISSION_BITS2, OCTAL_RADIX2, GO_KEYRING_BASE64_PREFIX;
|
|
6256
6278
|
var init_credential = __esm({
|
|
6257
6279
|
"src/credential.ts"() {
|
|
6258
6280
|
"use strict";
|
|
@@ -6263,6 +6285,7 @@ var init_credential = __esm({
|
|
|
6263
6285
|
GROUP_OTHER_PERMISSION_BITS = 63;
|
|
6264
6286
|
PERMISSION_BITS2 = 511;
|
|
6265
6287
|
OCTAL_RADIX2 = 8;
|
|
6288
|
+
GO_KEYRING_BASE64_PREFIX = "go-keyring-base64:";
|
|
6266
6289
|
}
|
|
6267
6290
|
});
|
|
6268
6291
|
|
|
@@ -6275,14 +6298,14 @@ function providerJsonPath(paths, name) {
|
|
|
6275
6298
|
function providerExists(paths, name) {
|
|
6276
6299
|
return fs7.existsSync(providerJsonPath(paths, name));
|
|
6277
6300
|
}
|
|
6278
|
-
function
|
|
6301
|
+
function isRecord6(value) {
|
|
6279
6302
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6280
6303
|
}
|
|
6281
6304
|
function legacyProviderConversion(raw) {
|
|
6282
|
-
if (!
|
|
6305
|
+
if (!isRecord6(raw) || "credential" in raw) {
|
|
6283
6306
|
return void 0;
|
|
6284
6307
|
}
|
|
6285
|
-
const env =
|
|
6308
|
+
const env = isRecord6(raw.env) ? raw.env : void 0;
|
|
6286
6309
|
const legacyEnvKeys = env === void 0 ? [] : Object.keys(env).filter((key) => LEGACY_ENV_CREDENTIAL_KEYS.includes(key));
|
|
6287
6310
|
const fields = [...LEGACY_PROVIDER_FIELDS.filter((field) => field in raw), ...legacyEnvKeys.map((key) => `env.${key}`)];
|
|
6288
6311
|
if (fields.length === 0) {
|
|
@@ -15841,15 +15864,15 @@ function createQuotaExpiringPublisher(hub, deps) {
|
|
|
15841
15864
|
|
|
15842
15865
|
// src/frontdoor/rcLiveUsage.ts
|
|
15843
15866
|
var RC_RATE_LIMIT_EVENT_TYPE = "rate_limit_event";
|
|
15844
|
-
function
|
|
15867
|
+
function isRecord7(value) {
|
|
15845
15868
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15846
15869
|
}
|
|
15847
15870
|
function rcRateLimitInfoOf(event) {
|
|
15848
15871
|
const payload = event.envelope.payload;
|
|
15849
|
-
if (!
|
|
15872
|
+
if (!isRecord7(payload) || payload.type !== RC_RATE_LIMIT_EVENT_TYPE) {
|
|
15850
15873
|
return void 0;
|
|
15851
15874
|
}
|
|
15852
|
-
if (!
|
|
15875
|
+
if (!isRecord7(payload.rate_limit_info)) {
|
|
15853
15876
|
return void 0;
|
|
15854
15877
|
}
|
|
15855
15878
|
const parsed = RcRateLimitInfoSchema.safeParse(payload.rate_limit_info);
|
|
@@ -15937,7 +15960,7 @@ function createSseParser() {
|
|
|
15937
15960
|
}
|
|
15938
15961
|
};
|
|
15939
15962
|
}
|
|
15940
|
-
function
|
|
15963
|
+
function isRecord8(value) {
|
|
15941
15964
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15942
15965
|
}
|
|
15943
15966
|
function sequenceNumOf(value) {
|
|
@@ -15959,7 +15982,7 @@ function parseRcStreamEnvelope(parsed) {
|
|
|
15959
15982
|
} catch {
|
|
15960
15983
|
return void 0;
|
|
15961
15984
|
}
|
|
15962
|
-
if (!
|
|
15985
|
+
if (!isRecord8(data)) {
|
|
15963
15986
|
return void 0;
|
|
15964
15987
|
}
|
|
15965
15988
|
const eventType = data.event_type;
|
|
@@ -16200,7 +16223,7 @@ init_capability();
|
|
|
16200
16223
|
// src/frontdoor/rcSelfHostEndpoints.ts
|
|
16201
16224
|
var RC_SOURCE_WORKER = "worker";
|
|
16202
16225
|
var RC_SOURCE_CLIENT = "client";
|
|
16203
|
-
function
|
|
16226
|
+
function isRecord9(value) {
|
|
16204
16227
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16205
16228
|
}
|
|
16206
16229
|
function parseJsonObject2(body) {
|
|
@@ -16210,7 +16233,7 @@ function parseJsonObject2(body) {
|
|
|
16210
16233
|
} catch {
|
|
16211
16234
|
return void 0;
|
|
16212
16235
|
}
|
|
16213
|
-
return
|
|
16236
|
+
return isRecord9(parsed) ? parsed : void 0;
|
|
16214
16237
|
}
|
|
16215
16238
|
function nonEmptyString2(record, field) {
|
|
16216
16239
|
const value = record === void 0 ? void 0 : record[field];
|
|
@@ -16284,7 +16307,7 @@ async function serveRcClientChannels(ctx, tail, method, maxBatchEvents) {
|
|
|
16284
16307
|
}
|
|
16285
16308
|
const results = [];
|
|
16286
16309
|
for (const event of events) {
|
|
16287
|
-
if (!
|
|
16310
|
+
if (!isRecord9(event) || !isRecord9(event.payload)) {
|
|
16288
16311
|
await ctx.answerJson(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a teleport write is an object carrying one payload object" } });
|
|
16289
16312
|
return true;
|
|
16290
16313
|
}
|
|
@@ -16384,7 +16407,7 @@ async function serveRcCompatSessions(ctx, pathname, compatPath) {
|
|
|
16384
16407
|
// src/frontdoor/rcSelfHostConversations.ts
|
|
16385
16408
|
var RC_CONVERSATIONS_PATH_PREFIX = "/v1/code/conversations";
|
|
16386
16409
|
var RC_CONVERSATION_ID_PREFIX = "conv_";
|
|
16387
|
-
function
|
|
16410
|
+
function isRecord10(value) {
|
|
16388
16411
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16389
16412
|
}
|
|
16390
16413
|
function parseJsonObject3(body) {
|
|
@@ -16394,7 +16417,7 @@ function parseJsonObject3(body) {
|
|
|
16394
16417
|
} catch {
|
|
16395
16418
|
return void 0;
|
|
16396
16419
|
}
|
|
16397
|
-
return
|
|
16420
|
+
return isRecord10(parsed) ? parsed : void 0;
|
|
16398
16421
|
}
|
|
16399
16422
|
function nonEmptyString3(record, field) {
|
|
16400
16423
|
const value = record === void 0 ? void 0 : record[field];
|
|
@@ -16448,7 +16471,7 @@ async function serveRcConversations(ctx, pathname, method) {
|
|
|
16448
16471
|
}
|
|
16449
16472
|
const results = [];
|
|
16450
16473
|
for (const event of events) {
|
|
16451
|
-
if (!
|
|
16474
|
+
if (!isRecord10(event) || !isRecord10(event.payload)) {
|
|
16452
16475
|
await ctx.answerJson(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a write is an object carrying one payload object" } });
|
|
16453
16476
|
return;
|
|
16454
16477
|
}
|
|
@@ -16480,7 +16503,7 @@ var RC_SELF_HOST_SCOPE_LIST = ["user:profile", "user:inference", "user:sessions:
|
|
|
16480
16503
|
var RC_SELF_HOST_OAUTH_TOKEN_TTL_SECONDS = 3600;
|
|
16481
16504
|
var MS_PER_SECOND5 = 1e3;
|
|
16482
16505
|
var HTTP_SERVICE_UNAVAILABLE = 503;
|
|
16483
|
-
function
|
|
16506
|
+
function isRecord11(value) {
|
|
16484
16507
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16485
16508
|
}
|
|
16486
16509
|
function parseJsonObject4(body) {
|
|
@@ -16490,7 +16513,7 @@ function parseJsonObject4(body) {
|
|
|
16490
16513
|
} catch {
|
|
16491
16514
|
return void 0;
|
|
16492
16515
|
}
|
|
16493
|
-
return
|
|
16516
|
+
return isRecord11(parsed) ? parsed : void 0;
|
|
16494
16517
|
}
|
|
16495
16518
|
function growthBookFeatures() {
|
|
16496
16519
|
return {
|
|
@@ -16844,7 +16867,7 @@ var RC_SELF_HOST_WORKER_EPOCH = 1;
|
|
|
16844
16867
|
var RC_STREAM_EVENT_NAME2 = "client_event";
|
|
16845
16868
|
var CONFLICT_REASON_HEADER2 = "x-ccr-conflict-reason";
|
|
16846
16869
|
var CONFLICT_REASON_EPOCH_STALE = "epoch_stale";
|
|
16847
|
-
function
|
|
16870
|
+
function isRecord12(value) {
|
|
16848
16871
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16849
16872
|
}
|
|
16850
16873
|
function isWebSearchRefusal(value) {
|
|
@@ -16928,7 +16951,7 @@ function parseJsonObject5(body) {
|
|
|
16928
16951
|
} catch {
|
|
16929
16952
|
return void 0;
|
|
16930
16953
|
}
|
|
16931
|
-
return
|
|
16954
|
+
return isRecord12(parsed) ? parsed : void 0;
|
|
16932
16955
|
}
|
|
16933
16956
|
function mintWorkerJwt(randomToken, issuedAt) {
|
|
16934
16957
|
const encode = (value) => Buffer.from(JSON.stringify(value), "utf8").toString("base64url");
|
|
@@ -17188,7 +17211,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
17188
17211
|
if (status !== void 0) {
|
|
17189
17212
|
session.workerStatus = status;
|
|
17190
17213
|
}
|
|
17191
|
-
if (
|
|
17214
|
+
if (isRecord12(body?.external_metadata)) {
|
|
17192
17215
|
session.externalMetadata = body.external_metadata;
|
|
17193
17216
|
}
|
|
17194
17217
|
await answerJson2(response, HTTP_STATUS.ok, {});
|
|
@@ -17218,7 +17241,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
17218
17241
|
}
|
|
17219
17242
|
const results = [];
|
|
17220
17243
|
for (const event of events) {
|
|
17221
|
-
if (!
|
|
17244
|
+
if (!isRecord12(event) || !isRecord12(event.payload)) {
|
|
17222
17245
|
await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a batch is an object carrying one payload object" } });
|
|
17223
17246
|
return;
|
|
17224
17247
|
}
|
|
@@ -17251,7 +17274,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
17251
17274
|
return;
|
|
17252
17275
|
}
|
|
17253
17276
|
for (const event of events) {
|
|
17254
|
-
if (
|
|
17277
|
+
if (isRecord12(event)) {
|
|
17255
17278
|
session.internalEvents.push({ eventId: deps.newUuid(), body: event });
|
|
17256
17279
|
}
|
|
17257
17280
|
}
|
|
@@ -17347,7 +17370,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
17347
17370
|
}
|
|
17348
17371
|
const results = [];
|
|
17349
17372
|
for (const event of events) {
|
|
17350
|
-
if (!
|
|
17373
|
+
if (!isRecord12(event) || !isRecord12(event.payload)) {
|
|
17351
17374
|
await answerJson2(response, HTTP_STATUS.badRequest, { type: "error", error: { type: "invalid_request_error", message: "every event in a write is an object carrying one payload object" } });
|
|
17352
17375
|
return;
|
|
17353
17376
|
}
|
|
@@ -17484,7 +17507,7 @@ var RC_SELF_HOST_RECORD_DIR = "rc-selfhost";
|
|
|
17484
17507
|
var RC_SELF_HOST_RECORD_FILE = "credential.json";
|
|
17485
17508
|
var SELF_HOST_EMAIL = "selfhost@agent-shim.invalid";
|
|
17486
17509
|
var SELF_HOST_SUBSCRIPTION_TYPE = "max";
|
|
17487
|
-
function
|
|
17510
|
+
function isRecord13(value) {
|
|
17488
17511
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17489
17512
|
}
|
|
17490
17513
|
function readJsonObject(fs13, file) {
|
|
@@ -17498,7 +17521,7 @@ function readJsonObject(fs13, file) {
|
|
|
17498
17521
|
} catch {
|
|
17499
17522
|
return void 0;
|
|
17500
17523
|
}
|
|
17501
|
-
return
|
|
17524
|
+
return isRecord13(parsed) ? parsed : void 0;
|
|
17502
17525
|
}
|
|
17503
17526
|
function readRcSelfHostRecord(fs13, frontdoorDir) {
|
|
17504
17527
|
const parsed = readJsonObject(fs13, path33.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
|
|
@@ -17522,7 +17545,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
17522
17545
|
const recordFile = path33.join(recordDir, RC_SELF_HOST_RECORD_FILE);
|
|
17523
17546
|
const previousRecord = readRcSelfHostRecord(deps.fs, deps.frontdoorDir);
|
|
17524
17547
|
const existingCredentials = readJsonObject(deps.fs, credentialsFile);
|
|
17525
|
-
const existingOauth =
|
|
17548
|
+
const existingOauth = isRecord13(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
|
|
17526
17549
|
const existingToken = typeof existingOauth?.accessToken === "string" && existingOauth.accessToken !== "" ? existingOauth.accessToken : void 0;
|
|
17527
17550
|
const existingIsOwn = existingToken !== void 0 && previousRecord?.accessToken === existingToken;
|
|
17528
17551
|
if (existingToken !== void 0 && !existingIsOwn && !deps.force) {
|
|
@@ -17539,7 +17562,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
17539
17562
|
deps.fs.writeFilePrivate(credentialsFile, `${JSON.stringify({ ...existingCredentials, claudeAiOauth: { accessToken, refreshToken, expiresAt: null, scopes: [...RC_SELF_HOST_SCOPE_LIST], subscriptionType: SELF_HOST_SUBSCRIPTION_TYPE, rateLimitTier: null } }, null, 2)}
|
|
17540
17563
|
`);
|
|
17541
17564
|
const claudeJson = readJsonObject(deps.fs, claudeJsonFile) ?? {};
|
|
17542
|
-
const existingBlock = (value) =>
|
|
17565
|
+
const existingBlock = (value) => isRecord13(value) ? value : {};
|
|
17543
17566
|
deps.fs.writeFilePrivate(claudeJsonFile, `${JSON.stringify({
|
|
17544
17567
|
...claudeJson,
|
|
17545
17568
|
oauthAccount: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-use",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.10.0",
|
|
4
4
|
"description": "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Joseph Mearman <joseph@mearman.co.uk>",
|