claude-use 11.8.2 → 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 +1579 -169
- package/dist/index.cjs +146 -41
- package/dist/index.mjs +146 -41
- package/dist/types/index.d.ts +121 -5
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -203,9 +203,15 @@ function expandAllCategoryKey(pairs) {
|
|
|
203
203
|
const expanded = Object.fromEntries(OVERRIDABLE_CATEGORIES.filter((category) => !all || category !== "runtime").map((category) => [category, all]));
|
|
204
204
|
return { ...expanded, ...rest };
|
|
205
205
|
}
|
|
206
|
+
function isHttpProvider(provider) {
|
|
207
|
+
return provider.kind === void 0 || provider.kind === "http";
|
|
208
|
+
}
|
|
206
209
|
function isCodexProvider(provider) {
|
|
207
210
|
return provider.kind === "codex";
|
|
208
211
|
}
|
|
212
|
+
function isAntigravityProvider(provider) {
|
|
213
|
+
return provider.kind === "antigravity";
|
|
214
|
+
}
|
|
209
215
|
function poolMemberIdentity(member) {
|
|
210
216
|
return typeof member === "string" ? member : member.identity;
|
|
211
217
|
}
|
|
@@ -217,7 +223,7 @@ function isTimeZone(name) {
|
|
|
217
223
|
return false;
|
|
218
224
|
}
|
|
219
225
|
}
|
|
220
|
-
var CATEGORY_NAMES, OVERRIDABLE_CATEGORIES, CategoryMapSchema, DURATION_RE, DurationSchema, WhenConditionObjectSchema, WhenSchema, EntryValueSchema, ENTRY_KEY_RE, EntriesSchema, LaunchSchema, CREDENTIAL_TARGETS, PROVIDER_CREDENTIAL_TARGETS, CREDENTIAL_TARGET_VARS, ArgvSchema, CommandSourceOptions, EnvCredentialSourceSchema, FileCredentialSourceSchema, CommandCredentialSourceSchema, OpCredentialSourceSchema, KeychainCredentialSourceSchema, LiteralCredentialSourceSchema, CredentialSourceSchema, RemoteCredentialSourceSchema, CREDENTIAL_CACHE_STORES, CredentialCacheSchema, CredentialSchema, ProviderCredentialSchema, RESERVED_PROVIDER_ENV_KEYS, ProviderEnvSchema, PROVIDER_KINDS, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_TIER_MODELS, CodexProviderConfigSchema, ProviderRouteSchema, HttpProviderSchema, CodexProviderSchema, ProviderSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_NAME_PATTERN, IDENTITY_NAME_PATTERN, PoolNameSchema, SELECTOR_RE, IdentitySelectorSchema, PoolMemberSchema, POOL_PREFERENCES, PoolPreferenceSchema, PoolSchema, WEEKDAYS, AnchorSchema, JOB_WINDOWS, JobTriggerSchema, JobTargetSchema, JobSchema, DirectoryRuleSchema, DirectoryRulesSchema, PortableConfigSchema, HEADROOM_MODES, HEADROOM_CCR_MODES, HEADROOM_ROLLOUT_CHANNELS, INTERCEPT_CHANNELS, READ_MATURATION_CHANNELS, HeadroomGlobalConfigObjectSchema, HeadroomGlobalConfigSchema, HEADROOM_DEFAULT_SOURCE, HEADROOM_DEFAULT_IDLE_SHUTDOWN_MINUTES, FrontDoorGlobalConfigSchema, UPDATE_MODES, UpdateGlobalConfigSchema, GlobalConfigSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
|
|
226
|
+
var CATEGORY_NAMES, OVERRIDABLE_CATEGORIES, CategoryMapSchema, DURATION_RE, DurationSchema, WhenConditionObjectSchema, WhenSchema, EntryValueSchema, ENTRY_KEY_RE, EntriesSchema, LaunchSchema, CREDENTIAL_TARGETS, PROVIDER_CREDENTIAL_TARGETS, CREDENTIAL_TARGET_VARS, ArgvSchema, CommandSourceOptions, EnvCredentialSourceSchema, FileCredentialSourceSchema, CommandCredentialSourceSchema, OpCredentialSourceSchema, KeychainCredentialSourceSchema, LiteralCredentialSourceSchema, CredentialSourceSchema, RemoteCredentialSourceSchema, CREDENTIAL_CACHE_STORES, CredentialCacheSchema, CredentialSchema, ProviderCredentialSchema, RESERVED_PROVIDER_ENV_KEYS, ProviderEnvSchema, PROVIDER_KINDS, ANTIGRAVITY_MODES, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_TIER_MODELS, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_TIER_MODELS, CodexProviderConfigSchema, ProviderRouteSchema, HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema, ProviderSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_NAME_PATTERN, IDENTITY_NAME_PATTERN, PoolNameSchema, SELECTOR_RE, IdentitySelectorSchema, PoolMemberSchema, POOL_PREFERENCES, PoolPreferenceSchema, PoolSchema, WEEKDAYS, AnchorSchema, JOB_WINDOWS, JobTriggerSchema, JobTargetSchema, JobSchema, DirectoryRuleSchema, DirectoryRulesSchema, PortableConfigSchema, HEADROOM_MODES, HEADROOM_CCR_MODES, HEADROOM_ROLLOUT_CHANNELS, INTERCEPT_CHANNELS, READ_MATURATION_CHANNELS, HeadroomGlobalConfigObjectSchema, HeadroomGlobalConfigSchema, HEADROOM_DEFAULT_SOURCE, HEADROOM_DEFAULT_IDLE_SHUTDOWN_MINUTES, FrontDoorGlobalConfigSchema, UPDATE_MODES, UpdateGlobalConfigSchema, GlobalConfigSchema, IdentitySchema, CategoryClassificationSchema, CategoryClassificationOverlaySchema, SHIPPED_CATEGORY_DEFAULTS;
|
|
221
227
|
var init_schema = __esm({
|
|
222
228
|
"src/config/schema.ts"() {
|
|
223
229
|
"use strict";
|
|
@@ -313,7 +319,47 @@ var init_schema = __esm({
|
|
|
313
319
|
ProviderEnvSchema = z.record(z.string().min(1), z.string()).refine((env) => !Object.keys(env).some((key) => RESERVED_PROVIDER_ENV_KEYS.includes(key)), {
|
|
314
320
|
message: `env may not set ${RESERVED_PROVIDER_ENV_KEYS.join(", ")}: the credential block's target sets one and agent-shim removes the others`
|
|
315
321
|
});
|
|
316
|
-
PROVIDER_KINDS = ["http", "codex"];
|
|
322
|
+
PROVIDER_KINDS = ["http", "codex", "antigravity"];
|
|
323
|
+
ANTIGRAVITY_MODES = ["cloud", "local"];
|
|
324
|
+
ANTIGRAVITY_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"];
|
|
325
|
+
ANTIGRAVITY_DEFAULT_MODE = "cloud";
|
|
326
|
+
ANTIGRAVITY_DEFAULT_TIER_MODELS = Object.freeze({
|
|
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
|
+
});
|
|
332
|
+
AntigravityProviderConfigSchema = z.strictObject({
|
|
333
|
+
/** Operational mode: direct cloud endpoint or local ACP daemon. Defaults to `cloud`. */
|
|
334
|
+
mode: z.enum(ANTIGRAVITY_MODES).optional(),
|
|
335
|
+
/** The model a request maps to when no tier matches its model name. */
|
|
336
|
+
defaultModel: z.string().min(1).optional(),
|
|
337
|
+
/** Per-tier overrides of the shipped mapping, matched by substring of the requested model name in `ANTIGRAVITY_TIERS` order. */
|
|
338
|
+
models: z.strictObject({
|
|
339
|
+
fable: z.string().min(1).optional(),
|
|
340
|
+
opus: z.string().min(1).optional(),
|
|
341
|
+
sonnet: z.string().min(1).optional(),
|
|
342
|
+
haiku: z.string().min(1).optional()
|
|
343
|
+
}).optional(),
|
|
344
|
+
/** The reasoning effort used when the request's own effort is not one the backend accepts. */
|
|
345
|
+
effort: z.enum(ANTIGRAVITY_EFFORTS).optional(),
|
|
346
|
+
/** Cloud-specific settings (for `mode: "cloud"`). */
|
|
347
|
+
cloud: z.strictObject({
|
|
348
|
+
/** Google Gemini API or custom gateway endpoint. Defaults to `https://generativelanguage.googleapis.com`. */
|
|
349
|
+
endpoint: z.url().optional(),
|
|
350
|
+
/** Google Cloud Project ID (when using Vertex AI). */
|
|
351
|
+
projectId: z.string().min(1).optional(),
|
|
352
|
+
/** Google Cloud location/region (when using Vertex AI). */
|
|
353
|
+
location: z.string().min(1).optional()
|
|
354
|
+
}).optional(),
|
|
355
|
+
/** Local-specific settings (for `mode: "local"`). */
|
|
356
|
+
local: z.strictObject({
|
|
357
|
+
/** Command and arguments to spawn the ACP server process. */
|
|
358
|
+
command: z.array(z.string().min(1)).min(1).optional(),
|
|
359
|
+
/** Path to an existing Unix domain socket to connect to instead of spawning a process. */
|
|
360
|
+
socketPath: z.string().min(1).optional()
|
|
361
|
+
}).optional()
|
|
362
|
+
});
|
|
317
363
|
CODEX_EFFORTS = ["none", "low", "medium", "high"];
|
|
318
364
|
CODEX_LOGINS = ["codex-cli", "chatgpt-sign-in"];
|
|
319
365
|
CODEX_DEFAULT_TIER_MODELS = Object.freeze({
|
|
@@ -363,7 +409,15 @@ var init_schema = __esm({
|
|
|
363
409
|
env: ProviderEnvSchema.optional(),
|
|
364
410
|
codex: CodexProviderConfigSchema.optional()
|
|
365
411
|
});
|
|
366
|
-
|
|
412
|
+
AntigravityProviderSchema = z.strictObject({
|
|
413
|
+
$schema: z.string().optional(),
|
|
414
|
+
kind: z.literal("antigravity"),
|
|
415
|
+
displayName: z.string().min(1),
|
|
416
|
+
credential: ProviderCredentialSchema,
|
|
417
|
+
env: ProviderEnvSchema.optional(),
|
|
418
|
+
antigravity: AntigravityProviderConfigSchema.optional()
|
|
419
|
+
});
|
|
420
|
+
ProviderSchema = z.discriminatedUnion("kind", [HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema]);
|
|
367
421
|
ConfigProfileSchema = z.strictObject({
|
|
368
422
|
$schema: z.string().optional(),
|
|
369
423
|
description: z.string().optional(),
|
|
@@ -2763,7 +2817,7 @@ var init_package = __esm({
|
|
|
2763
2817
|
"package.json"() {
|
|
2764
2818
|
package_default = {
|
|
2765
2819
|
name: "claude-use",
|
|
2766
|
-
version: "11.
|
|
2820
|
+
version: "11.10.0",
|
|
2767
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.",
|
|
2768
2822
|
license: "MIT",
|
|
2769
2823
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -3191,7 +3245,7 @@ function daemonIdentity(commandLine, socketPath) {
|
|
|
3191
3245
|
function earlierReleaseAllowlistHash(providers, doorOrigin) {
|
|
3192
3246
|
const entries = /* @__PURE__ */ new Set([EARLIER_RELEASE_ANTHROPIC_UPSTREAM]);
|
|
3193
3247
|
for (const provider of providers) {
|
|
3194
|
-
if (
|
|
3248
|
+
if (isHttpProvider(provider)) {
|
|
3195
3249
|
entries.add(provider.baseUrl);
|
|
3196
3250
|
}
|
|
3197
3251
|
}
|
|
@@ -6116,11 +6170,33 @@ function formatCredentialSummary(summary) {
|
|
|
6116
6170
|
function describeCredential(credential) {
|
|
6117
6171
|
return formatCredentialSummary(summariseCredential(credential));
|
|
6118
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
|
+
}
|
|
6119
6195
|
function trySource(source, params) {
|
|
6120
6196
|
const none = (reason, warn = false) => ({ ok: false, reason, warn });
|
|
6121
6197
|
if ("env" in source) {
|
|
6122
6198
|
const value = params.env[source.env];
|
|
6123
|
-
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) };
|
|
6124
6200
|
}
|
|
6125
6201
|
if ("literal" in source) {
|
|
6126
6202
|
return { ok: true, token: source.literal };
|
|
@@ -6136,7 +6212,7 @@ function trySource(source, params) {
|
|
|
6136
6212
|
true
|
|
6137
6213
|
);
|
|
6138
6214
|
}
|
|
6139
|
-
const token2 = read.content.trim();
|
|
6215
|
+
const token2 = unpackKeyringToken(read.content.trim());
|
|
6140
6216
|
return token2 === "" ? none("is empty") : { ok: true, token: token2 };
|
|
6141
6217
|
}
|
|
6142
6218
|
const argv = commandArgv(source);
|
|
@@ -6154,7 +6230,7 @@ function trySource(source, params) {
|
|
|
6154
6230
|
const outcome = result.status === null ? "could not be run or was killed by a signal" : `exited with status ${String(result.status)}`;
|
|
6155
6231
|
return none(`${outcome}${stderr === "" ? "" : `: ${stderr}`}`);
|
|
6156
6232
|
}
|
|
6157
|
-
const token = result.stdout.trim();
|
|
6233
|
+
const token = unpackKeyringToken(result.stdout.trim());
|
|
6158
6234
|
return token === "" ? none("printed no token") : { ok: true, token };
|
|
6159
6235
|
}
|
|
6160
6236
|
function warmCommandFor(subject) {
|
|
@@ -6198,7 +6274,7 @@ function credentialVariables(target, token) {
|
|
|
6198
6274
|
CLAUDE_CODE_OAUTH_TOKEN: target === "oauthToken" ? token : void 0
|
|
6199
6275
|
};
|
|
6200
6276
|
}
|
|
6201
|
-
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;
|
|
6202
6278
|
var init_credential = __esm({
|
|
6203
6279
|
"src/credential.ts"() {
|
|
6204
6280
|
"use strict";
|
|
@@ -6209,6 +6285,7 @@ var init_credential = __esm({
|
|
|
6209
6285
|
GROUP_OTHER_PERMISSION_BITS = 63;
|
|
6210
6286
|
PERMISSION_BITS2 = 511;
|
|
6211
6287
|
OCTAL_RADIX2 = 8;
|
|
6288
|
+
GO_KEYRING_BASE64_PREFIX = "go-keyring-base64:";
|
|
6212
6289
|
}
|
|
6213
6290
|
});
|
|
6214
6291
|
|
|
@@ -6221,14 +6298,14 @@ function providerJsonPath(paths, name) {
|
|
|
6221
6298
|
function providerExists(paths, name) {
|
|
6222
6299
|
return fs7.existsSync(providerJsonPath(paths, name));
|
|
6223
6300
|
}
|
|
6224
|
-
function
|
|
6301
|
+
function isRecord6(value) {
|
|
6225
6302
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6226
6303
|
}
|
|
6227
6304
|
function legacyProviderConversion(raw) {
|
|
6228
|
-
if (!
|
|
6305
|
+
if (!isRecord6(raw) || "credential" in raw) {
|
|
6229
6306
|
return void 0;
|
|
6230
6307
|
}
|
|
6231
|
-
const env =
|
|
6308
|
+
const env = isRecord6(raw.env) ? raw.env : void 0;
|
|
6232
6309
|
const legacyEnvKeys = env === void 0 ? [] : Object.keys(env).filter((key) => LEGACY_ENV_CREDENTIAL_KEYS.includes(key));
|
|
6233
6310
|
const fields = [...LEGACY_PROVIDER_FIELDS.filter((field) => field in raw), ...legacyEnvKeys.map((key) => `env.${key}`)];
|
|
6234
6311
|
if (fields.length === 0) {
|
|
@@ -6313,11 +6390,20 @@ function listProviderNames(readdir, providersDir) {
|
|
|
6313
6390
|
return entries.filter((entry) => entry.endsWith(".json")).map((entry) => entry.slice(0, -".json".length)).sort();
|
|
6314
6391
|
}
|
|
6315
6392
|
function describeProviderEndpoint(provider) {
|
|
6316
|
-
|
|
6393
|
+
if (isCodexProvider(provider)) {
|
|
6394
|
+
return "codex translation daemon";
|
|
6395
|
+
}
|
|
6396
|
+
if (isAntigravityProvider(provider)) {
|
|
6397
|
+
return (provider.antigravity?.mode ?? ANTIGRAVITY_DEFAULT_MODE) === "local" ? "antigravity local (ACP daemon)" : "antigravity cloud (Gemini API)";
|
|
6398
|
+
}
|
|
6399
|
+
return provider.baseUrl;
|
|
6317
6400
|
}
|
|
6318
6401
|
function isEmptyCodexConfig(config) {
|
|
6319
6402
|
return config === void 0 || config.defaultModel === void 0 && config.effort === void 0 && config.login === void 0 && (config.models === void 0 || Object.keys(config.models).length === 0);
|
|
6320
6403
|
}
|
|
6404
|
+
function isEmptyAntigravityConfig(config) {
|
|
6405
|
+
return config === void 0 || config.mode === void 0 && config.defaultModel === void 0 && config.effort === void 0 && config.cloud === void 0 && config.local === void 0 && (config.models === void 0 || Object.keys(config.models).length === 0);
|
|
6406
|
+
}
|
|
6321
6407
|
function addProvider(paths, name, input) {
|
|
6322
6408
|
if (providerExists(paths, name)) {
|
|
6323
6409
|
throw new ProviderAlreadyExistsError(name);
|
|
@@ -6329,19 +6415,25 @@ function addProvider(paths, name, input) {
|
|
|
6329
6415
|
if (kind === "codex" && input.baseUrl !== void 0) {
|
|
6330
6416
|
throw new ProviderKindMismatchError("A codex provider has no base URL: the launcher points its sessions at the front-door daemon. Drop --base-url.");
|
|
6331
6417
|
}
|
|
6418
|
+
if (kind === "antigravity" && input.baseUrl !== void 0) {
|
|
6419
|
+
throw new ProviderKindMismatchError("An antigravity provider has no base URL: the launcher points its sessions at the front-door daemon. Drop --base-url.");
|
|
6420
|
+
}
|
|
6332
6421
|
if (kind === "http" && input.baseUrl === void 0) {
|
|
6333
6422
|
throw new ProviderKindMismatchError("An http provider needs --base-url.");
|
|
6334
6423
|
}
|
|
6335
|
-
if (kind
|
|
6424
|
+
if (kind !== "codex" && !isEmptyCodexConfig(input.codex)) {
|
|
6336
6425
|
throw new ProviderKindMismatchError("Codex settings apply only to a codex provider (--kind codex).");
|
|
6337
6426
|
}
|
|
6427
|
+
if (kind !== "antigravity" && !isEmptyAntigravityConfig(input.antigravity)) {
|
|
6428
|
+
throw new ProviderKindMismatchError("Antigravity settings apply only to an antigravity provider (--kind antigravity).");
|
|
6429
|
+
}
|
|
6338
6430
|
const shared = {
|
|
6339
6431
|
displayName: input.displayName,
|
|
6340
6432
|
credential: { sources: input.sources, ...input.target === void 0 ? {} : { target: input.target } },
|
|
6341
6433
|
...input.env === void 0 || Object.keys(input.env).length === 0 ? {} : { env: input.env }
|
|
6342
6434
|
};
|
|
6343
6435
|
const parsed = ProviderSchema.safeParse(
|
|
6344
|
-
kind === "codex" ? { kind, ...shared, ...isEmptyCodexConfig(input.codex) ? {} : { codex: input.codex } } : { ...shared, baseUrl: input.baseUrl }
|
|
6436
|
+
kind === "codex" ? { kind, ...shared, ...isEmptyCodexConfig(input.codex) ? {} : { codex: input.codex } } : kind === "antigravity" ? { kind, ...shared, ...isEmptyAntigravityConfig(input.antigravity) ? {} : { antigravity: input.antigravity } } : { ...shared, baseUrl: input.baseUrl }
|
|
6345
6437
|
);
|
|
6346
6438
|
if (!parsed.success) {
|
|
6347
6439
|
throw new ConfigValidationError(providerJsonPath(paths, name), parsed.error.issues);
|
|
@@ -6361,8 +6453,14 @@ function updateProvider(paths, name, input) {
|
|
|
6361
6453
|
if (isCodexProvider(existing) && input.baseUrl !== void 0) {
|
|
6362
6454
|
throw new ProviderKindMismatchError(`Provider "${name}" is a codex provider, which has no base URL.`);
|
|
6363
6455
|
}
|
|
6456
|
+
if (isAntigravityProvider(existing) && input.baseUrl !== void 0) {
|
|
6457
|
+
throw new ProviderKindMismatchError(`Provider "${name}" is an antigravity provider, which has no base URL.`);
|
|
6458
|
+
}
|
|
6364
6459
|
if (!isCodexProvider(existing) && !isEmptyCodexConfig(input.codex)) {
|
|
6365
|
-
throw new ProviderKindMismatchError(`Provider "${name}" is
|
|
6460
|
+
throw new ProviderKindMismatchError(`Provider "${name}" is not a codex provider; codex settings apply only to a codex provider.`);
|
|
6461
|
+
}
|
|
6462
|
+
if (!isAntigravityProvider(existing) && !isEmptyAntigravityConfig(input.antigravity)) {
|
|
6463
|
+
throw new ProviderKindMismatchError(`Provider "${name}" is not an antigravity provider; antigravity settings apply only to an antigravity provider.`);
|
|
6366
6464
|
}
|
|
6367
6465
|
const shared = {
|
|
6368
6466
|
...input.displayName === void 0 ? {} : { displayName: input.displayName },
|
|
@@ -6381,6 +6479,13 @@ function updateProvider(paths, name, input) {
|
|
|
6381
6479
|
...existing.codex?.models === void 0 && input.codex?.models === void 0 ? {} : { models: { ...existing.codex?.models, ...input.codex?.models } }
|
|
6382
6480
|
};
|
|
6383
6481
|
candidate = { ...existing, ...shared, codex: isEmptyCodexConfig(codex) ? void 0 : codex };
|
|
6482
|
+
} else if (isAntigravityProvider(existing)) {
|
|
6483
|
+
const antigravity = {
|
|
6484
|
+
...existing.antigravity,
|
|
6485
|
+
...input.antigravity,
|
|
6486
|
+
...existing.antigravity?.models === void 0 && input.antigravity?.models === void 0 ? {} : { models: { ...existing.antigravity?.models, ...input.antigravity?.models } }
|
|
6487
|
+
};
|
|
6488
|
+
candidate = { ...existing, ...shared, antigravity: isEmptyAntigravityConfig(antigravity) ? void 0 : antigravity };
|
|
6384
6489
|
} else {
|
|
6385
6490
|
candidate = { ...existing, ...shared, ...input.baseUrl === void 0 ? {} : { baseUrl: input.baseUrl } };
|
|
6386
6491
|
}
|
|
@@ -14840,7 +14945,7 @@ function providerValue(name, provider) {
|
|
|
14840
14945
|
name,
|
|
14841
14946
|
kind: provider.kind ?? "http",
|
|
14842
14947
|
displayName: provider.displayName,
|
|
14843
|
-
...isCodexProvider(provider) ? provider.codex === void 0 ? {} : { codex: provider.codex } : { baseUrl: provider.baseUrl },
|
|
14948
|
+
...isCodexProvider(provider) ? provider.codex === void 0 ? {} : { codex: provider.codex } : isAntigravityProvider(provider) ? provider.antigravity === void 0 ? {} : { antigravity: provider.antigravity } : { baseUrl: provider.baseUrl },
|
|
14844
14949
|
credential: summariseCredential(provider.credential),
|
|
14845
14950
|
...provider.env === void 0 ? {} : { env: provider.env }
|
|
14846
14951
|
};
|
|
@@ -15019,7 +15124,7 @@ function createConfigApiRouter(deps) {
|
|
|
15019
15124
|
throw new ProviderNotFoundError(input.name);
|
|
15020
15125
|
}
|
|
15021
15126
|
const credential = input.credential;
|
|
15022
|
-
if (input.baseUrl !== void 0 &&
|
|
15127
|
+
if (input.baseUrl !== void 0 && isHttpProvider(existing) && input.baseUrl !== existing.baseUrl && credential?.sources === void 0) {
|
|
15023
15128
|
throw new ORPCError2("BAD_REQUEST", { message: `Changing the base URL of provider "${input.name}" requires a credential block in the same call: the stored credential is not sent to a different endpoint.` });
|
|
15024
15129
|
}
|
|
15025
15130
|
const cache = credential?.cache === void 0 ? void 0 : mergeCredentialCache(credential.cache === false ? { enabled: false } : { ...credential.cache, enabled: true }, existing.credential.cache);
|
|
@@ -15759,15 +15864,15 @@ function createQuotaExpiringPublisher(hub, deps) {
|
|
|
15759
15864
|
|
|
15760
15865
|
// src/frontdoor/rcLiveUsage.ts
|
|
15761
15866
|
var RC_RATE_LIMIT_EVENT_TYPE = "rate_limit_event";
|
|
15762
|
-
function
|
|
15867
|
+
function isRecord7(value) {
|
|
15763
15868
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15764
15869
|
}
|
|
15765
15870
|
function rcRateLimitInfoOf(event) {
|
|
15766
15871
|
const payload = event.envelope.payload;
|
|
15767
|
-
if (!
|
|
15872
|
+
if (!isRecord7(payload) || payload.type !== RC_RATE_LIMIT_EVENT_TYPE) {
|
|
15768
15873
|
return void 0;
|
|
15769
15874
|
}
|
|
15770
|
-
if (!
|
|
15875
|
+
if (!isRecord7(payload.rate_limit_info)) {
|
|
15771
15876
|
return void 0;
|
|
15772
15877
|
}
|
|
15773
15878
|
const parsed = RcRateLimitInfoSchema.safeParse(payload.rate_limit_info);
|
|
@@ -15855,7 +15960,7 @@ function createSseParser() {
|
|
|
15855
15960
|
}
|
|
15856
15961
|
};
|
|
15857
15962
|
}
|
|
15858
|
-
function
|
|
15963
|
+
function isRecord8(value) {
|
|
15859
15964
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
15860
15965
|
}
|
|
15861
15966
|
function sequenceNumOf(value) {
|
|
@@ -15877,7 +15982,7 @@ function parseRcStreamEnvelope(parsed) {
|
|
|
15877
15982
|
} catch {
|
|
15878
15983
|
return void 0;
|
|
15879
15984
|
}
|
|
15880
|
-
if (!
|
|
15985
|
+
if (!isRecord8(data)) {
|
|
15881
15986
|
return void 0;
|
|
15882
15987
|
}
|
|
15883
15988
|
const eventType = data.event_type;
|
|
@@ -16118,7 +16223,7 @@ init_capability();
|
|
|
16118
16223
|
// src/frontdoor/rcSelfHostEndpoints.ts
|
|
16119
16224
|
var RC_SOURCE_WORKER = "worker";
|
|
16120
16225
|
var RC_SOURCE_CLIENT = "client";
|
|
16121
|
-
function
|
|
16226
|
+
function isRecord9(value) {
|
|
16122
16227
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16123
16228
|
}
|
|
16124
16229
|
function parseJsonObject2(body) {
|
|
@@ -16128,7 +16233,7 @@ function parseJsonObject2(body) {
|
|
|
16128
16233
|
} catch {
|
|
16129
16234
|
return void 0;
|
|
16130
16235
|
}
|
|
16131
|
-
return
|
|
16236
|
+
return isRecord9(parsed) ? parsed : void 0;
|
|
16132
16237
|
}
|
|
16133
16238
|
function nonEmptyString2(record, field) {
|
|
16134
16239
|
const value = record === void 0 ? void 0 : record[field];
|
|
@@ -16202,7 +16307,7 @@ async function serveRcClientChannels(ctx, tail, method, maxBatchEvents) {
|
|
|
16202
16307
|
}
|
|
16203
16308
|
const results = [];
|
|
16204
16309
|
for (const event of events) {
|
|
16205
|
-
if (!
|
|
16310
|
+
if (!isRecord9(event) || !isRecord9(event.payload)) {
|
|
16206
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" } });
|
|
16207
16312
|
return true;
|
|
16208
16313
|
}
|
|
@@ -16302,7 +16407,7 @@ async function serveRcCompatSessions(ctx, pathname, compatPath) {
|
|
|
16302
16407
|
// src/frontdoor/rcSelfHostConversations.ts
|
|
16303
16408
|
var RC_CONVERSATIONS_PATH_PREFIX = "/v1/code/conversations";
|
|
16304
16409
|
var RC_CONVERSATION_ID_PREFIX = "conv_";
|
|
16305
|
-
function
|
|
16410
|
+
function isRecord10(value) {
|
|
16306
16411
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16307
16412
|
}
|
|
16308
16413
|
function parseJsonObject3(body) {
|
|
@@ -16312,7 +16417,7 @@ function parseJsonObject3(body) {
|
|
|
16312
16417
|
} catch {
|
|
16313
16418
|
return void 0;
|
|
16314
16419
|
}
|
|
16315
|
-
return
|
|
16420
|
+
return isRecord10(parsed) ? parsed : void 0;
|
|
16316
16421
|
}
|
|
16317
16422
|
function nonEmptyString3(record, field) {
|
|
16318
16423
|
const value = record === void 0 ? void 0 : record[field];
|
|
@@ -16366,7 +16471,7 @@ async function serveRcConversations(ctx, pathname, method) {
|
|
|
16366
16471
|
}
|
|
16367
16472
|
const results = [];
|
|
16368
16473
|
for (const event of events) {
|
|
16369
|
-
if (!
|
|
16474
|
+
if (!isRecord10(event) || !isRecord10(event.payload)) {
|
|
16370
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" } });
|
|
16371
16476
|
return;
|
|
16372
16477
|
}
|
|
@@ -16398,7 +16503,7 @@ var RC_SELF_HOST_SCOPE_LIST = ["user:profile", "user:inference", "user:sessions:
|
|
|
16398
16503
|
var RC_SELF_HOST_OAUTH_TOKEN_TTL_SECONDS = 3600;
|
|
16399
16504
|
var MS_PER_SECOND5 = 1e3;
|
|
16400
16505
|
var HTTP_SERVICE_UNAVAILABLE = 503;
|
|
16401
|
-
function
|
|
16506
|
+
function isRecord11(value) {
|
|
16402
16507
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16403
16508
|
}
|
|
16404
16509
|
function parseJsonObject4(body) {
|
|
@@ -16408,7 +16513,7 @@ function parseJsonObject4(body) {
|
|
|
16408
16513
|
} catch {
|
|
16409
16514
|
return void 0;
|
|
16410
16515
|
}
|
|
16411
|
-
return
|
|
16516
|
+
return isRecord11(parsed) ? parsed : void 0;
|
|
16412
16517
|
}
|
|
16413
16518
|
function growthBookFeatures() {
|
|
16414
16519
|
return {
|
|
@@ -16762,7 +16867,7 @@ var RC_SELF_HOST_WORKER_EPOCH = 1;
|
|
|
16762
16867
|
var RC_STREAM_EVENT_NAME2 = "client_event";
|
|
16763
16868
|
var CONFLICT_REASON_HEADER2 = "x-ccr-conflict-reason";
|
|
16764
16869
|
var CONFLICT_REASON_EPOCH_STALE = "epoch_stale";
|
|
16765
|
-
function
|
|
16870
|
+
function isRecord12(value) {
|
|
16766
16871
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
16767
16872
|
}
|
|
16768
16873
|
function isWebSearchRefusal(value) {
|
|
@@ -16846,7 +16951,7 @@ function parseJsonObject5(body) {
|
|
|
16846
16951
|
} catch {
|
|
16847
16952
|
return void 0;
|
|
16848
16953
|
}
|
|
16849
|
-
return
|
|
16954
|
+
return isRecord12(parsed) ? parsed : void 0;
|
|
16850
16955
|
}
|
|
16851
16956
|
function mintWorkerJwt(randomToken, issuedAt) {
|
|
16852
16957
|
const encode = (value) => Buffer.from(JSON.stringify(value), "utf8").toString("base64url");
|
|
@@ -17106,7 +17211,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
17106
17211
|
if (status !== void 0) {
|
|
17107
17212
|
session.workerStatus = status;
|
|
17108
17213
|
}
|
|
17109
|
-
if (
|
|
17214
|
+
if (isRecord12(body?.external_metadata)) {
|
|
17110
17215
|
session.externalMetadata = body.external_metadata;
|
|
17111
17216
|
}
|
|
17112
17217
|
await answerJson2(response, HTTP_STATUS.ok, {});
|
|
@@ -17136,7 +17241,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
17136
17241
|
}
|
|
17137
17242
|
const results = [];
|
|
17138
17243
|
for (const event of events) {
|
|
17139
|
-
if (!
|
|
17244
|
+
if (!isRecord12(event) || !isRecord12(event.payload)) {
|
|
17140
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" } });
|
|
17141
17246
|
return;
|
|
17142
17247
|
}
|
|
@@ -17169,7 +17274,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
17169
17274
|
return;
|
|
17170
17275
|
}
|
|
17171
17276
|
for (const event of events) {
|
|
17172
|
-
if (
|
|
17277
|
+
if (isRecord12(event)) {
|
|
17173
17278
|
session.internalEvents.push({ eventId: deps.newUuid(), body: event });
|
|
17174
17279
|
}
|
|
17175
17280
|
}
|
|
@@ -17265,7 +17370,7 @@ data: ${JSON.stringify(envelope)}
|
|
|
17265
17370
|
}
|
|
17266
17371
|
const results = [];
|
|
17267
17372
|
for (const event of events) {
|
|
17268
|
-
if (!
|
|
17373
|
+
if (!isRecord12(event) || !isRecord12(event.payload)) {
|
|
17269
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" } });
|
|
17270
17375
|
return;
|
|
17271
17376
|
}
|
|
@@ -17402,7 +17507,7 @@ var RC_SELF_HOST_RECORD_DIR = "rc-selfhost";
|
|
|
17402
17507
|
var RC_SELF_HOST_RECORD_FILE = "credential.json";
|
|
17403
17508
|
var SELF_HOST_EMAIL = "selfhost@agent-shim.invalid";
|
|
17404
17509
|
var SELF_HOST_SUBSCRIPTION_TYPE = "max";
|
|
17405
|
-
function
|
|
17510
|
+
function isRecord13(value) {
|
|
17406
17511
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
17407
17512
|
}
|
|
17408
17513
|
function readJsonObject(fs13, file) {
|
|
@@ -17416,7 +17521,7 @@ function readJsonObject(fs13, file) {
|
|
|
17416
17521
|
} catch {
|
|
17417
17522
|
return void 0;
|
|
17418
17523
|
}
|
|
17419
|
-
return
|
|
17524
|
+
return isRecord13(parsed) ? parsed : void 0;
|
|
17420
17525
|
}
|
|
17421
17526
|
function readRcSelfHostRecord(fs13, frontdoorDir) {
|
|
17422
17527
|
const parsed = readJsonObject(fs13, path33.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
|
|
@@ -17440,7 +17545,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
17440
17545
|
const recordFile = path33.join(recordDir, RC_SELF_HOST_RECORD_FILE);
|
|
17441
17546
|
const previousRecord = readRcSelfHostRecord(deps.fs, deps.frontdoorDir);
|
|
17442
17547
|
const existingCredentials = readJsonObject(deps.fs, credentialsFile);
|
|
17443
|
-
const existingOauth =
|
|
17548
|
+
const existingOauth = isRecord13(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
|
|
17444
17549
|
const existingToken = typeof existingOauth?.accessToken === "string" && existingOauth.accessToken !== "" ? existingOauth.accessToken : void 0;
|
|
17445
17550
|
const existingIsOwn = existingToken !== void 0 && previousRecord?.accessToken === existingToken;
|
|
17446
17551
|
if (existingToken !== void 0 && !existingIsOwn && !deps.force) {
|
|
@@ -17457,7 +17562,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
17457
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)}
|
|
17458
17563
|
`);
|
|
17459
17564
|
const claudeJson = readJsonObject(deps.fs, claudeJsonFile) ?? {};
|
|
17460
|
-
const existingBlock = (value) =>
|
|
17565
|
+
const existingBlock = (value) => isRecord13(value) ? value : {};
|
|
17461
17566
|
deps.fs.writeFilePrivate(claudeJsonFile, `${JSON.stringify({
|
|
17462
17567
|
...claudeJson,
|
|
17463
17568
|
oauthAccount: {
|