claude-use 11.23.0 → 11.25.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/README.md +1 -0
- package/dist/cli.cjs +18045 -17836
- package/dist/index.cjs +379 -63
- package/dist/index.mjs +379 -63
- package/dist/types/index.d.ts +101 -47
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -242,7 +242,7 @@ function isTimeZone(name) {
|
|
|
242
242
|
return false;
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
var import_node_path2, import_zod, import_trilean, 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, AntigravityModelTargetSchema, 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, WHOLE_PERCENT_MAX, CompactAtUtilisationSchema, 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;
|
|
245
|
+
var import_node_path2, import_zod, import_trilean, 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, CLAUDE_TIERS, ANTIGRAVITY_EFFORTS, ANTIGRAVITY_DEFAULT_MODE, ANTIGRAVITY_DEFAULT_MODEL, ANTIGRAVITY_DEFAULT_TIER_MODELS, ANTIGRAVITY_DEFAULT_EFFORT, AntigravityModelTargetSchema, AntigravityProviderConfigSchema, CODEX_EFFORTS, CODEX_LOGINS, CODEX_DEFAULT_LOGIN, CODEX_DEFAULT_MODEL, CODEX_DEFAULT_TIER_MODELS, CODEX_DEFAULT_EFFORT, CodexProviderConfigSchema, ProviderRouteSchema, PickerModelSchema, PickerModelsSchema, HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema, ProviderSchema, ConfigProfileSchema, POOL_SELECTOR_PREFIX, POOL_NAME_PATTERN, IDENTITY_NAME_PATTERN, PoolNameSchema, SELECTOR_RE, IdentitySelectorSchema, PoolMemberSchema, POOL_PREFERENCES, PoolPreferenceSchema, WHOLE_PERCENT_MAX, CompactAtUtilisationSchema, 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;
|
|
246
246
|
var init_schema = __esm({
|
|
247
247
|
"src/config/schema.ts"() {
|
|
248
248
|
"use strict";
|
|
@@ -343,21 +343,24 @@ var init_schema = __esm({
|
|
|
343
343
|
});
|
|
344
344
|
PROVIDER_KINDS = ["http", "codex", "antigravity"];
|
|
345
345
|
ANTIGRAVITY_MODES = ["cloud", "local"];
|
|
346
|
+
CLAUDE_TIERS = ["fable", "opus", "sonnet", "haiku"];
|
|
346
347
|
ANTIGRAVITY_EFFORTS = ["none", "low", "medium", "high", "xhigh", "max"];
|
|
347
348
|
ANTIGRAVITY_DEFAULT_MODE = "cloud";
|
|
349
|
+
ANTIGRAVITY_DEFAULT_MODEL = "gemini-3.8-flash-high";
|
|
348
350
|
ANTIGRAVITY_DEFAULT_TIER_MODELS = Object.freeze({
|
|
349
351
|
fable: ["gemini-4-argon-high", "claude-opus-5-5-high", "gemini-3.8-flash-high"],
|
|
350
352
|
opus: ["claude-opus-5-5-high", "gemini-4-argon-high", "gemini-3.8-flash-high"],
|
|
351
353
|
sonnet: ["claude-sonnet-5-5-medium", "gemini-4-argon-medium", "gemini-3.8-flash-medium"],
|
|
352
354
|
haiku: ["gemini-3.8-flash-low", "gemini-4-argon-low", "claude-sonnet-5-5-low"]
|
|
353
355
|
});
|
|
356
|
+
ANTIGRAVITY_DEFAULT_EFFORT = "low";
|
|
354
357
|
AntigravityModelTargetSchema = import_zod.z.union([import_zod.z.string().min(1), import_zod.z.array(import_zod.z.string().min(1)).min(1)]);
|
|
355
358
|
AntigravityProviderConfigSchema = import_zod.z.strictObject({
|
|
356
359
|
/** Operational mode: direct cloud endpoint or local ACP daemon. Defaults to `cloud`. */
|
|
357
360
|
mode: import_zod.z.enum(ANTIGRAVITY_MODES).optional(),
|
|
358
361
|
/** The model a request maps to when no tier matches its model name. */
|
|
359
362
|
defaultModel: import_zod.z.string().min(1).optional(),
|
|
360
|
-
/** Model name mapping. A key naming a tier (`fable`, `opus`, `sonnet`, `haiku`) overrides that tier's shipped model and is matched by substring of the requested name in `
|
|
363
|
+
/** Model name mapping. A key naming a tier (`fable`, `opus`, `sonnet`, `haiku`) overrides that tier's shipped model and is matched by substring of the requested name in `CLAUDE_TIERS` order; any other key is an alias, matched against the whole requested name case-insensitively, so `/model <alias>` selects its backend model. An alias outranks every other rule, including the pass-through of backend names. A value is one model or an ordered list of candidates: the request goes to the first whose quota windows are not spent, and when every candidate is spent, to the one whose binding window lifts soonest. */
|
|
361
364
|
models: import_zod.z.record(import_zod.z.string().min(1), AntigravityModelTargetSchema).optional(),
|
|
362
365
|
/** When every candidate of the tier a request names has no quota left, serve it from the next tier down, and onward through the lower tiers, instead of failing with the quota limit. Applies to a name that selects a tier (`/model fable`), not to an alias or a backend model name. Defaults to false. */
|
|
363
366
|
degradeDownTiers: import_zod.z.boolean().optional(),
|
|
@@ -382,16 +385,19 @@ var init_schema = __esm({
|
|
|
382
385
|
});
|
|
383
386
|
CODEX_EFFORTS = ["none", "low", "medium", "high"];
|
|
384
387
|
CODEX_LOGINS = ["codex-cli", "chatgpt-sign-in"];
|
|
388
|
+
CODEX_DEFAULT_LOGIN = "codex-cli";
|
|
389
|
+
CODEX_DEFAULT_MODEL = "gpt-5.6-sol";
|
|
385
390
|
CODEX_DEFAULT_TIER_MODELS = Object.freeze({
|
|
386
391
|
fable: "gpt-5.6-sol",
|
|
387
392
|
opus: "gpt-5.6-sol",
|
|
388
393
|
sonnet: "gpt-5.6-terra",
|
|
389
394
|
haiku: "gpt-5.6-luna"
|
|
390
395
|
});
|
|
396
|
+
CODEX_DEFAULT_EFFORT = "low";
|
|
391
397
|
CodexProviderConfigSchema = import_zod.z.strictObject({
|
|
392
398
|
/** The codex model a request maps to when no tier matches its model name. */
|
|
393
399
|
defaultModel: import_zod.z.string().min(1).optional(),
|
|
394
|
-
/** Per-tier overrides of the shipped mapping, matched by substring of the requested model name in `
|
|
400
|
+
/** Per-tier overrides of the shipped mapping, matched by substring of the requested model name in `CLAUDE_TIERS` order. */
|
|
395
401
|
models: import_zod.z.strictObject({
|
|
396
402
|
fable: import_zod.z.string().min(1).optional(),
|
|
397
403
|
opus: import_zod.z.string().min(1).optional(),
|
|
@@ -411,6 +417,13 @@ var init_schema = __esm({
|
|
|
411
417
|
/** The model name to rewrite the request to before it reaches the target, for a provider that expects another form (OpenRouter's `anthropic/claude-...` for instance). A route that rewrites reads the whole body, the one copy the rewrite needs. */
|
|
412
418
|
model: import_zod.z.string().min(1).optional()
|
|
413
419
|
});
|
|
420
|
+
PickerModelSchema = import_zod.z.strictObject({
|
|
421
|
+
model: import_zod.z.string().min(1),
|
|
422
|
+
tier: import_zod.z.enum(CLAUDE_TIERS),
|
|
423
|
+
label: import_zod.z.string().min(1).optional(),
|
|
424
|
+
description: import_zod.z.string().min(1).optional()
|
|
425
|
+
});
|
|
426
|
+
PickerModelsSchema = import_zod.z.array(PickerModelSchema).refine((models) => new Set(models.map((entry) => entry.model)).size === models.length, { message: "pickerModels names a model more than once" });
|
|
414
427
|
HttpProviderSchema = import_zod.z.strictObject({
|
|
415
428
|
$schema: import_zod.z.string().optional(),
|
|
416
429
|
kind: import_zod.z.literal("http").optional(),
|
|
@@ -418,6 +431,8 @@ var init_schema = __esm({
|
|
|
418
431
|
baseUrl: import_zod.z.url(),
|
|
419
432
|
credential: ProviderCredentialSchema,
|
|
420
433
|
env: ProviderEnvSchema.optional(),
|
|
434
|
+
/** Extra models `/model` lists beside the ones the tier settings name. */
|
|
435
|
+
pickerModels: PickerModelsSchema.optional(),
|
|
421
436
|
/** Per-request routing: when present, each request this provider would serve is matched against the list in order, and the first definite match is sent to that entry's provider instead (itself resolved exactly as a directly dialled request would be). Unmatched requests stay on this provider. */
|
|
422
437
|
routes: import_zod.z.array(ProviderRouteSchema).optional()
|
|
423
438
|
});
|
|
@@ -427,6 +442,8 @@ var init_schema = __esm({
|
|
|
427
442
|
displayName: import_zod.z.string().min(1),
|
|
428
443
|
credential: ProviderCredentialSchema,
|
|
429
444
|
env: ProviderEnvSchema.optional(),
|
|
445
|
+
/** Extra models `/model` lists beside the ones the tier settings name. */
|
|
446
|
+
pickerModels: PickerModelsSchema.optional(),
|
|
430
447
|
codex: CodexProviderConfigSchema.optional()
|
|
431
448
|
});
|
|
432
449
|
AntigravityProviderSchema = import_zod.z.strictObject({
|
|
@@ -435,6 +452,8 @@ var init_schema = __esm({
|
|
|
435
452
|
displayName: import_zod.z.string().min(1),
|
|
436
453
|
credential: ProviderCredentialSchema,
|
|
437
454
|
env: ProviderEnvSchema.optional(),
|
|
455
|
+
/** Extra models `/model` lists beside the ones the tier settings name. */
|
|
456
|
+
pickerModels: PickerModelsSchema.optional(),
|
|
438
457
|
antigravity: AntigravityProviderConfigSchema.optional()
|
|
439
458
|
});
|
|
440
459
|
ProviderSchema = import_zod.z.discriminatedUnion("kind", [HttpProviderSchema, CodexProviderSchema, AntigravityProviderSchema]);
|
|
@@ -2928,7 +2947,7 @@ var init_package = __esm({
|
|
|
2928
2947
|
"package.json"() {
|
|
2929
2948
|
package_default = {
|
|
2930
2949
|
name: "claude-use",
|
|
2931
|
-
version: "11.
|
|
2950
|
+
version: "11.25.0",
|
|
2932
2951
|
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.",
|
|
2933
2952
|
license: "MIT",
|
|
2934
2953
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -6555,7 +6574,8 @@ function addProvider(paths, name, input) {
|
|
|
6555
6574
|
const shared = {
|
|
6556
6575
|
displayName: input.displayName,
|
|
6557
6576
|
credential: { sources: input.sources, ...input.target === void 0 ? {} : { target: input.target } },
|
|
6558
|
-
...input.env === void 0 || Object.keys(input.env).length === 0 ? {} : { env: input.env }
|
|
6577
|
+
...input.env === void 0 || Object.keys(input.env).length === 0 ? {} : { env: input.env },
|
|
6578
|
+
...input.pickerModels === void 0 || input.pickerModels.length === 0 ? {} : { pickerModels: input.pickerModels }
|
|
6559
6579
|
};
|
|
6560
6580
|
const parsed = ProviderSchema.safeParse(
|
|
6561
6581
|
kind === "codex" ? { kind, ...shared, ...isEmptyCodexConfig(input.codex) ? {} : { codex: input.codex } } : kind === "antigravity" ? { kind, ...shared, ...isEmptyAntigravityConfig(input.antigravity) ? {} : { antigravity: input.antigravity } } : { ...shared, baseUrl: input.baseUrl }
|
|
@@ -6573,6 +6593,12 @@ function updateProvider(paths, name, input) {
|
|
|
6573
6593
|
}
|
|
6574
6594
|
const unset = new Set(input.unsetEnv);
|
|
6575
6595
|
const env = Object.fromEntries(Object.entries({ ...existing.env, ...input.env }).filter(([key]) => !unset.has(key)));
|
|
6596
|
+
const unsetPicker = new Set(input.unsetPickerModels);
|
|
6597
|
+
const added = new Map((input.pickerModels ?? []).map((entry) => [entry.model, entry]));
|
|
6598
|
+
const pickerModels = [
|
|
6599
|
+
...(existing.pickerModels ?? []).filter((entry) => !unsetPicker.has(entry.model)).map((entry) => added.get(entry.model) ?? entry),
|
|
6600
|
+
...[...added.values()].filter((entry) => !(existing.pickerModels ?? []).some((kept) => kept.model === entry.model))
|
|
6601
|
+
];
|
|
6576
6602
|
const target = input.target ?? existing.credential.target;
|
|
6577
6603
|
const cache = input.cache === void 0 ? existing.credential.cache : input.cache === false ? void 0 : input.cache;
|
|
6578
6604
|
if (isCodexProvider(existing) && input.baseUrl !== void 0) {
|
|
@@ -6594,7 +6620,8 @@ function updateProvider(paths, name, input) {
|
|
|
6594
6620
|
...target === void 0 ? {} : { target },
|
|
6595
6621
|
...cache === void 0 ? {} : { cache }
|
|
6596
6622
|
},
|
|
6597
|
-
env: Object.keys(env).length === 0 ? void 0 : env
|
|
6623
|
+
env: Object.keys(env).length === 0 ? void 0 : env,
|
|
6624
|
+
pickerModels: pickerModels.length === 0 ? void 0 : pickerModels
|
|
6598
6625
|
};
|
|
6599
6626
|
let candidate;
|
|
6600
6627
|
if (isCodexProvider(existing)) {
|
|
@@ -7796,13 +7823,43 @@ function withConversation(passthrough, conversation, id) {
|
|
|
7796
7823
|
}
|
|
7797
7824
|
return [...kept, conversation === "start" ? "--session-id" : "--resume", id, ...tail];
|
|
7798
7825
|
}
|
|
7826
|
+
function hasSettingsArgument(passthrough) {
|
|
7827
|
+
const end = passthrough.indexOf(TERMINATOR2);
|
|
7828
|
+
return (end === -1 ? passthrough : passthrough.slice(0, end)).some((token) => token === "--settings" || token.startsWith("--settings="));
|
|
7829
|
+
}
|
|
7799
7830
|
function withSupervision(passthrough, supervised) {
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7831
|
+
return supervised.conversation === "as-given" ? passthrough : withConversation(passthrough, supervised.conversation, supervised.sessionId);
|
|
7832
|
+
}
|
|
7833
|
+
function withLauncherSettings(passthrough, settings) {
|
|
7834
|
+
if (settings === void 0) {
|
|
7835
|
+
return passthrough;
|
|
7836
|
+
}
|
|
7837
|
+
const end = passthrough.indexOf(TERMINATOR2);
|
|
7838
|
+
return end === -1 ? [...passthrough, "--settings", settings] : [...passthrough.slice(0, end), "--settings", settings, ...passthrough.slice(end)];
|
|
7839
|
+
}
|
|
7840
|
+
function isRecord15(value) {
|
|
7841
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7842
|
+
}
|
|
7843
|
+
function mergeSettings(parts) {
|
|
7844
|
+
const merged = {};
|
|
7845
|
+
let any = false;
|
|
7846
|
+
for (const part of parts) {
|
|
7847
|
+
if (part === void 0) {
|
|
7848
|
+
continue;
|
|
7849
|
+
}
|
|
7850
|
+
const parsed = JSON.parse(part);
|
|
7851
|
+
if (!isRecord15(parsed)) {
|
|
7852
|
+
throw new Error("a launch's settings part is not a JSON object");
|
|
7853
|
+
}
|
|
7854
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
7855
|
+
if (key in merged) {
|
|
7856
|
+
throw new Error(`two launch settings parts both set "${key}"`);
|
|
7857
|
+
}
|
|
7858
|
+
merged[key] = value;
|
|
7859
|
+
}
|
|
7860
|
+
any = true;
|
|
7803
7861
|
}
|
|
7804
|
-
|
|
7805
|
-
return end === -1 ? [...conversation, "--settings", supervised.settings] : [...conversation.slice(0, end), "--settings", supervised.settings, ...conversation.slice(end)];
|
|
7862
|
+
return any ? JSON.stringify(merged) : void 0;
|
|
7806
7863
|
}
|
|
7807
7864
|
var TERMINATOR2, VALUED_CONVERSATION_FLAGS, CONTINUE_FLAGS;
|
|
7808
7865
|
var init_claudeSession = __esm({
|
|
@@ -7815,6 +7872,265 @@ var init_claudeSession = __esm({
|
|
|
7815
7872
|
}
|
|
7816
7873
|
});
|
|
7817
7874
|
|
|
7875
|
+
// src/antigravity/cloudUpstream.ts
|
|
7876
|
+
var init_cloudUpstream = __esm({
|
|
7877
|
+
"src/antigravity/cloudUpstream.ts"() {
|
|
7878
|
+
"use strict";
|
|
7879
|
+
}
|
|
7880
|
+
});
|
|
7881
|
+
|
|
7882
|
+
// src/antigravity/quota.ts
|
|
7883
|
+
var SECONDS_PER_HOUR, HOURS_PER_FIVE_HOUR_WINDOW, DAYS_PER_WEEK, HOURS_PER_DAY4, FIVE_HOUR_PERIOD_SECONDS, WEEK_PERIOD_SECONDS;
|
|
7884
|
+
var init_quota = __esm({
|
|
7885
|
+
"src/antigravity/quota.ts"() {
|
|
7886
|
+
"use strict";
|
|
7887
|
+
init_cloudUpstream();
|
|
7888
|
+
SECONDS_PER_HOUR = 3600;
|
|
7889
|
+
HOURS_PER_FIVE_HOUR_WINDOW = 5;
|
|
7890
|
+
DAYS_PER_WEEK = 7;
|
|
7891
|
+
HOURS_PER_DAY4 = 24;
|
|
7892
|
+
FIVE_HOUR_PERIOD_SECONDS = HOURS_PER_FIVE_HOUR_WINDOW * SECONDS_PER_HOUR;
|
|
7893
|
+
WEEK_PERIOD_SECONDS = DAYS_PER_WEEK * HOURS_PER_DAY4 * SECONDS_PER_HOUR;
|
|
7894
|
+
}
|
|
7895
|
+
});
|
|
7896
|
+
|
|
7897
|
+
// src/antigravity/signatures.ts
|
|
7898
|
+
var init_signatures = __esm({
|
|
7899
|
+
"src/antigravity/signatures.ts"() {
|
|
7900
|
+
"use strict";
|
|
7901
|
+
}
|
|
7902
|
+
});
|
|
7903
|
+
|
|
7904
|
+
// src/codex/anthropic.ts
|
|
7905
|
+
var import_zod29, TextBlockSchema, Base64ImageSourceSchema, UrlImageSourceSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultContentBlockSchema, ToolResultBlockSchema, OtherBlockSchema, ContentBlockSchema, MessageSchema, ToolSchema, ToolChoiceSchema, SystemSchema, MessagesRequestSchema, CountTokensRequestSchema;
|
|
7906
|
+
var init_anthropic = __esm({
|
|
7907
|
+
"src/codex/anthropic.ts"() {
|
|
7908
|
+
"use strict";
|
|
7909
|
+
import_zod29 = require("zod");
|
|
7910
|
+
TextBlockSchema = import_zod29.z.looseObject({ type: import_zod29.z.literal("text"), text: import_zod29.z.string() });
|
|
7911
|
+
Base64ImageSourceSchema = import_zod29.z.looseObject({ type: import_zod29.z.literal("base64"), media_type: import_zod29.z.string().min(1), data: import_zod29.z.string() });
|
|
7912
|
+
UrlImageSourceSchema = import_zod29.z.looseObject({ type: import_zod29.z.literal("url"), url: import_zod29.z.string().min(1) });
|
|
7913
|
+
ImageBlockSchema = import_zod29.z.looseObject({
|
|
7914
|
+
type: import_zod29.z.literal("image"),
|
|
7915
|
+
source: import_zod29.z.union([Base64ImageSourceSchema, UrlImageSourceSchema])
|
|
7916
|
+
});
|
|
7917
|
+
ToolUseBlockSchema = import_zod29.z.looseObject({
|
|
7918
|
+
type: import_zod29.z.literal("tool_use"),
|
|
7919
|
+
id: import_zod29.z.string().min(1),
|
|
7920
|
+
name: import_zod29.z.string().min(1),
|
|
7921
|
+
input: import_zod29.z.unknown()
|
|
7922
|
+
});
|
|
7923
|
+
ToolResultContentBlockSchema = import_zod29.z.union([TextBlockSchema, import_zod29.z.looseObject({ type: import_zod29.z.string() })]);
|
|
7924
|
+
ToolResultBlockSchema = import_zod29.z.looseObject({
|
|
7925
|
+
type: import_zod29.z.literal("tool_result"),
|
|
7926
|
+
tool_use_id: import_zod29.z.string().min(1),
|
|
7927
|
+
content: import_zod29.z.union([import_zod29.z.string(), import_zod29.z.array(ToolResultContentBlockSchema)]).optional()
|
|
7928
|
+
});
|
|
7929
|
+
OtherBlockSchema = import_zod29.z.looseObject({ type: import_zod29.z.string() });
|
|
7930
|
+
ContentBlockSchema = import_zod29.z.union([TextBlockSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultBlockSchema, OtherBlockSchema]);
|
|
7931
|
+
MessageSchema = import_zod29.z.looseObject({
|
|
7932
|
+
role: import_zod29.z.enum(["user", "assistant", "system"]),
|
|
7933
|
+
content: import_zod29.z.union([import_zod29.z.string(), import_zod29.z.array(ContentBlockSchema)])
|
|
7934
|
+
});
|
|
7935
|
+
ToolSchema = import_zod29.z.looseObject({
|
|
7936
|
+
name: import_zod29.z.string().min(1),
|
|
7937
|
+
description: import_zod29.z.string().optional(),
|
|
7938
|
+
input_schema: import_zod29.z.record(import_zod29.z.string(), import_zod29.z.unknown()).optional()
|
|
7939
|
+
});
|
|
7940
|
+
ToolChoiceSchema = import_zod29.z.union([
|
|
7941
|
+
import_zod29.z.looseObject({ type: import_zod29.z.enum(["auto", "none", "any"]) }),
|
|
7942
|
+
import_zod29.z.looseObject({ type: import_zod29.z.literal("tool"), name: import_zod29.z.string().min(1) })
|
|
7943
|
+
]);
|
|
7944
|
+
SystemSchema = import_zod29.z.union([import_zod29.z.string(), import_zod29.z.array(import_zod29.z.union([TextBlockSchema, OtherBlockSchema]))]);
|
|
7945
|
+
MessagesRequestSchema = import_zod29.z.looseObject({
|
|
7946
|
+
model: import_zod29.z.string().optional(),
|
|
7947
|
+
system: SystemSchema.optional(),
|
|
7948
|
+
messages: import_zod29.z.array(MessageSchema),
|
|
7949
|
+
tools: import_zod29.z.array(ToolSchema).optional(),
|
|
7950
|
+
tool_choice: ToolChoiceSchema.optional(),
|
|
7951
|
+
stream: import_zod29.z.boolean().optional(),
|
|
7952
|
+
/** `user_id` is stable for one Claude Code session and differs between sessions, which is what makes it the right key for both the backend's prompt cache and its session header. */
|
|
7953
|
+
metadata: import_zod29.z.looseObject({ user_id: import_zod29.z.string().optional() }).optional(),
|
|
7954
|
+
/** Claude Code's effort setting. Any string is accepted; the translator honours only the levels the backend understands. */
|
|
7955
|
+
output_config: import_zod29.z.looseObject({ effort: import_zod29.z.string().optional() }).optional()
|
|
7956
|
+
});
|
|
7957
|
+
CountTokensRequestSchema = import_zod29.z.looseObject({
|
|
7958
|
+
system: import_zod29.z.unknown().optional(),
|
|
7959
|
+
messages: import_zod29.z.unknown().optional(),
|
|
7960
|
+
tools: import_zod29.z.unknown().optional()
|
|
7961
|
+
});
|
|
7962
|
+
}
|
|
7963
|
+
});
|
|
7964
|
+
|
|
7965
|
+
// src/antigravity/translate.ts
|
|
7966
|
+
function candidatesOf(target) {
|
|
7967
|
+
return typeof target === "string" ? [target] : target;
|
|
7968
|
+
}
|
|
7969
|
+
function isAntigravityTier(key) {
|
|
7970
|
+
return CLAUDE_TIERS.some((tier) => tier === key);
|
|
7971
|
+
}
|
|
7972
|
+
function resolveAntigravityConfig(config) {
|
|
7973
|
+
const overrides = config?.models ?? {};
|
|
7974
|
+
const aliases = /* @__PURE__ */ new Map();
|
|
7975
|
+
for (const [key, target] of Object.entries(overrides)) {
|
|
7976
|
+
if (!isAntigravityTier(key)) {
|
|
7977
|
+
aliases.set(key.toLowerCase(), candidatesOf(target));
|
|
7978
|
+
}
|
|
7979
|
+
}
|
|
7980
|
+
const tierModel = (tier) => {
|
|
7981
|
+
const target = overrides[tier];
|
|
7982
|
+
return target === void 0 ? ANTIGRAVITY_DEFAULT_TIER_MODELS[tier] : candidatesOf(target);
|
|
7983
|
+
};
|
|
7984
|
+
return {
|
|
7985
|
+
mode: config?.mode ?? ANTIGRAVITY_DEFAULT_MODE,
|
|
7986
|
+
defaultModel: config?.defaultModel ?? ANTIGRAVITY_DEFAULT_MODEL,
|
|
7987
|
+
models: { fable: tierModel("fable"), opus: tierModel("opus"), sonnet: tierModel("sonnet"), haiku: tierModel("haiku") },
|
|
7988
|
+
aliases,
|
|
7989
|
+
degradeDownTiers: config?.degradeDownTiers ?? false,
|
|
7990
|
+
effort: config?.effort ?? ANTIGRAVITY_DEFAULT_EFFORT,
|
|
7991
|
+
cloud: {
|
|
7992
|
+
endpoint: config?.cloud?.endpoint,
|
|
7993
|
+
projectId: config?.cloud?.projectId,
|
|
7994
|
+
location: config?.cloud?.location
|
|
7995
|
+
},
|
|
7996
|
+
local: {
|
|
7997
|
+
command: config?.local?.command,
|
|
7998
|
+
socketPath: config?.local?.socketPath
|
|
7999
|
+
}
|
|
8000
|
+
};
|
|
8001
|
+
}
|
|
8002
|
+
var init_translate = __esm({
|
|
8003
|
+
"src/antigravity/translate.ts"() {
|
|
8004
|
+
"use strict";
|
|
8005
|
+
init_quota();
|
|
8006
|
+
init_signatures();
|
|
8007
|
+
init_schema();
|
|
8008
|
+
init_anthropic();
|
|
8009
|
+
}
|
|
8010
|
+
});
|
|
8011
|
+
|
|
8012
|
+
// src/codex/translate.ts
|
|
8013
|
+
function resolveCodexConfig(config) {
|
|
8014
|
+
const overrides = config?.models;
|
|
8015
|
+
return {
|
|
8016
|
+
defaultModel: config?.defaultModel ?? CODEX_DEFAULT_MODEL,
|
|
8017
|
+
models: {
|
|
8018
|
+
fable: overrides?.fable ?? CODEX_DEFAULT_TIER_MODELS.fable,
|
|
8019
|
+
opus: overrides?.opus ?? CODEX_DEFAULT_TIER_MODELS.opus,
|
|
8020
|
+
sonnet: overrides?.sonnet ?? CODEX_DEFAULT_TIER_MODELS.sonnet,
|
|
8021
|
+
haiku: overrides?.haiku ?? CODEX_DEFAULT_TIER_MODELS.haiku
|
|
8022
|
+
},
|
|
8023
|
+
effort: config?.effort ?? CODEX_DEFAULT_EFFORT,
|
|
8024
|
+
login: config?.login ?? CODEX_DEFAULT_LOGIN
|
|
8025
|
+
};
|
|
8026
|
+
}
|
|
8027
|
+
var init_translate2 = __esm({
|
|
8028
|
+
"src/codex/translate.ts"() {
|
|
8029
|
+
"use strict";
|
|
8030
|
+
init_schema();
|
|
8031
|
+
init_anthropic();
|
|
8032
|
+
}
|
|
8033
|
+
});
|
|
8034
|
+
|
|
8035
|
+
// src/launcher/modelPicker.ts
|
|
8036
|
+
function labelOf(model) {
|
|
8037
|
+
return model.toLowerCase().endsWith(CONTEXT_MARKER_1M) ? model.slice(0, -CONTEXT_MARKER_1M.length) : model;
|
|
8038
|
+
}
|
|
8039
|
+
function describedAs(model, description) {
|
|
8040
|
+
return model.toLowerCase().endsWith(CONTEXT_MARKER_1M) ? `${description}; 1M context` : description;
|
|
8041
|
+
}
|
|
8042
|
+
function joined(parts) {
|
|
8043
|
+
const last = parts[parts.length - 1];
|
|
8044
|
+
return last === void 0 || parts.length === 1 ? last ?? "" : `${parts.slice(0, -1).join(", ")} and ${last}`;
|
|
8045
|
+
}
|
|
8046
|
+
function rowOf2(model, reaches) {
|
|
8047
|
+
const lead = reaches.find((reach) => reach.standing === "first") ?? reaches[0];
|
|
8048
|
+
if (lead === void 0) {
|
|
8049
|
+
throw new Error(`model ${model} is reached by no tier`);
|
|
8050
|
+
}
|
|
8051
|
+
const firsts = reaches.filter((reach) => reach.standing === "first").map((reach) => reach.tier);
|
|
8052
|
+
const fallbacks = reaches.filter((reach) => reach.standing === "fallback").map((reach) => reach.tier);
|
|
8053
|
+
const serves = firsts.length === 0 ? [] : [`Serves the ${joined(firsts)} tier${firsts.length === 1 ? "" : "s"}`];
|
|
8054
|
+
const falls = fallbacks.length === 0 ? [] : [`${serves.length === 0 ? "Fallback" : "fallback"} for ${joined(fallbacks)}`];
|
|
8055
|
+
return { model, label: labelOf(model), description: describedAs(model, [...serves, ...falls].join("; ")), behavesAs: TIER_BEHAVES_AS[lead.tier] };
|
|
8056
|
+
}
|
|
8057
|
+
function rowsOfTable(table) {
|
|
8058
|
+
const reachesByModel = /* @__PURE__ */ new Map();
|
|
8059
|
+
for (const [tier, candidates] of table) {
|
|
8060
|
+
candidates.forEach((model, index) => {
|
|
8061
|
+
const reaches = reachesByModel.get(model) ?? [];
|
|
8062
|
+
if (!reaches.some((reach) => reach.tier === tier)) {
|
|
8063
|
+
reaches.push({ tier, standing: index === 0 ? "first" : "fallback" });
|
|
8064
|
+
}
|
|
8065
|
+
reachesByModel.set(model, reaches);
|
|
8066
|
+
});
|
|
8067
|
+
}
|
|
8068
|
+
return [...reachesByModel].map(([model, reaches]) => rowOf2(model, reaches));
|
|
8069
|
+
}
|
|
8070
|
+
function antigravityRows(provider) {
|
|
8071
|
+
const config = resolveAntigravityConfig(provider.antigravity);
|
|
8072
|
+
const tiers = rowsOfTable(CLAUDE_TIERS.map((tier) => [tier, config.models[tier]]));
|
|
8073
|
+
const behavesAsOf = new Map(tiers.map((row) => [row.model, row.behavesAs]));
|
|
8074
|
+
const aliases = [...config.aliases].flatMap(([alias, candidates]) => {
|
|
8075
|
+
const [first] = candidates;
|
|
8076
|
+
const behavesAs = first === void 0 ? void 0 : behavesAsOf.get(first);
|
|
8077
|
+
return behavesAs === void 0 ? [] : [{ model: alias, label: labelOf(alias), description: `Alias for ${candidates.join(", then ")}`, behavesAs }];
|
|
8078
|
+
});
|
|
8079
|
+
return [...tiers, ...aliases];
|
|
8080
|
+
}
|
|
8081
|
+
function codexRows(provider) {
|
|
8082
|
+
const config = resolveCodexConfig(provider.codex);
|
|
8083
|
+
return rowsOfTable(CLAUDE_TIERS.map((tier) => [tier, [config.models[tier]]]));
|
|
8084
|
+
}
|
|
8085
|
+
function httpRows(provider) {
|
|
8086
|
+
const env = provider.env ?? {};
|
|
8087
|
+
const table = CLAUDE_TIERS.flatMap((tier) => {
|
|
8088
|
+
const model = env[TIER_ENV_VARIABLES[tier]];
|
|
8089
|
+
return model === void 0 || model === "" ? [] : [[tier, [model]]];
|
|
8090
|
+
});
|
|
8091
|
+
return rowsOfTable(table);
|
|
8092
|
+
}
|
|
8093
|
+
function declaredRow(entry) {
|
|
8094
|
+
return {
|
|
8095
|
+
model: entry.model,
|
|
8096
|
+
label: entry.label ?? labelOf(entry.model),
|
|
8097
|
+
description: entry.description ?? describedAs(entry.model, `Declared by the provider for the ${entry.tier} tier`),
|
|
8098
|
+
behavesAs: TIER_BEHAVES_AS[entry.tier]
|
|
8099
|
+
};
|
|
8100
|
+
}
|
|
8101
|
+
function providerModelRows(provider) {
|
|
8102
|
+
const derived = provider.kind === "codex" ? codexRows(provider) : provider.kind === "antigravity" ? antigravityRows(provider) : httpRows(provider);
|
|
8103
|
+
const declared = (provider.pickerModels ?? []).map(declaredRow);
|
|
8104
|
+
const declaredModels = new Set(declared.map((row) => row.model));
|
|
8105
|
+
return [...derived.filter((row) => !declaredModels.has(row.model)), ...declared];
|
|
8106
|
+
}
|
|
8107
|
+
function modelPickerSettings(provider) {
|
|
8108
|
+
const options = providerModelRows(provider);
|
|
8109
|
+
return options.length === 0 ? void 0 : JSON.stringify({ modelPicker: { options, replaceBuiltInOptions: true } });
|
|
8110
|
+
}
|
|
8111
|
+
var CONTEXT_MARKER_1M, TIER_BEHAVES_AS, TIER_ENV_VARIABLES;
|
|
8112
|
+
var init_modelPicker = __esm({
|
|
8113
|
+
"src/launcher/modelPicker.ts"() {
|
|
8114
|
+
"use strict";
|
|
8115
|
+
init_translate();
|
|
8116
|
+
init_translate2();
|
|
8117
|
+
init_schema();
|
|
8118
|
+
CONTEXT_MARKER_1M = "[1m]";
|
|
8119
|
+
TIER_BEHAVES_AS = Object.freeze({
|
|
8120
|
+
fable: "claude-fable-5-1",
|
|
8121
|
+
opus: "claude-opus-5-5",
|
|
8122
|
+
sonnet: "claude-sonnet-5-5",
|
|
8123
|
+
haiku: "claude-haiku-5-5"
|
|
8124
|
+
});
|
|
8125
|
+
TIER_ENV_VARIABLES = Object.freeze({
|
|
8126
|
+
fable: "ANTHROPIC_DEFAULT_FABLE_MODEL",
|
|
8127
|
+
opus: "ANTHROPIC_DEFAULT_OPUS_MODEL",
|
|
8128
|
+
sonnet: "ANTHROPIC_DEFAULT_SONNET_MODEL",
|
|
8129
|
+
haiku: "ANTHROPIC_DEFAULT_HAIKU_MODEL"
|
|
8130
|
+
});
|
|
8131
|
+
}
|
|
8132
|
+
});
|
|
8133
|
+
|
|
7818
8134
|
// src/launcher/pool.ts
|
|
7819
8135
|
function isResuming(passthrough) {
|
|
7820
8136
|
const end = passthrough.indexOf(TERMINATOR3);
|
|
@@ -8239,10 +8555,16 @@ function decideLaunch(params, readOnly) {
|
|
|
8239
8555
|
log.info(`agent-shim: identity ${loginlessProvider.identity} has no stored login, so Remote Control, which needs one, is off for this launch; provider ${loginlessProvider.provider} runs without it`);
|
|
8240
8556
|
}
|
|
8241
8557
|
const flags = loginlessProvider === void 0 ? requestedFlags : { ...requestedFlags, remoteControl: false };
|
|
8558
|
+
const pickerSettings = selectedProvider === void 0 ? void 0 : modelPickerSettings(selectedProvider.definition);
|
|
8559
|
+
const callerSettings = hasSettingsArgument(parsedArgv.rest);
|
|
8560
|
+
if (pickerSettings !== void 0 && callerSettings && !readOnly) {
|
|
8561
|
+
log.info("agent-shim: this launch passes its own --settings, so /model keeps Claude Code's own model names instead of listing the provider's models");
|
|
8562
|
+
}
|
|
8563
|
+
const launcherSettings = mergeSettings([params.supervised?.settings, callerSettings ? void 0 : pickerSettings]);
|
|
8242
8564
|
const args = buildArgv({
|
|
8243
8565
|
toolFlags: buildFlagArgs(flags),
|
|
8244
8566
|
extraFlags: splitExtraFlags(env.CLAUDE_EXTRA_FLAGS),
|
|
8245
|
-
passthrough: params.supervised === void 0 ? parsedArgv.rest : withSupervision(parsedArgv.rest, params.supervised)
|
|
8567
|
+
passthrough: withLauncherSettings(params.supervised === void 0 ? parsedArgv.rest : withSupervision(parsedArgv.rest, params.supervised), launcherSettings)
|
|
8246
8568
|
});
|
|
8247
8569
|
const configDir = configDirEscapeHatchApplies || identityDecision.name === void 0 ? env.CLAUDE_CONFIG_DIR : import_node_path38.default.join(paths.identitiesDir, identityDecision.name);
|
|
8248
8570
|
const decision = {
|
|
@@ -8435,6 +8757,7 @@ var init_launcher = __esm({
|
|
|
8435
8757
|
init_flags();
|
|
8436
8758
|
init_extraFlags();
|
|
8437
8759
|
init_claudeSession();
|
|
8760
|
+
init_modelPicker();
|
|
8438
8761
|
init_pool();
|
|
8439
8762
|
init_resumeContext();
|
|
8440
8763
|
init_lock();
|
|
@@ -8915,84 +9238,77 @@ var init_identityClaude = __esm({
|
|
|
8915
9238
|
}
|
|
8916
9239
|
});
|
|
8917
9240
|
|
|
8918
|
-
// src/antigravity/cloudUpstream.ts
|
|
8919
|
-
var init_cloudUpstream = __esm({
|
|
8920
|
-
"src/antigravity/cloudUpstream.ts"() {
|
|
8921
|
-
"use strict";
|
|
8922
|
-
}
|
|
8923
|
-
});
|
|
8924
|
-
|
|
8925
9241
|
// src/usage/providerQuota.ts
|
|
8926
|
-
var
|
|
9242
|
+
var import_zod30, MS_PER_SECOND7, SECONDS_PER_HOUR2, HOURS_PER_DAY5, DAYS_PER_MONTH, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZaiLimitSchema, ZaiResponseSchema, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, MS_PER_DAY3, OpenRouterKeySchema, OpenRouterCreditsSchema, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, FIVE_HOURS2, DAYS_PER_WEEK2, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema;
|
|
8927
9243
|
var init_providerQuota = __esm({
|
|
8928
9244
|
"src/usage/providerQuota.ts"() {
|
|
8929
9245
|
"use strict";
|
|
8930
|
-
|
|
9246
|
+
import_zod30 = require("zod");
|
|
8931
9247
|
init_cloudUpstream();
|
|
8932
9248
|
init_schema2();
|
|
8933
9249
|
MS_PER_SECOND7 = 1e3;
|
|
8934
|
-
|
|
8935
|
-
|
|
9250
|
+
SECONDS_PER_HOUR2 = 3600;
|
|
9251
|
+
HOURS_PER_DAY5 = 24;
|
|
8936
9252
|
DAYS_PER_MONTH = 30;
|
|
8937
9253
|
ZAI_HOST = "api.z.ai";
|
|
8938
9254
|
ZAI_QUOTA_URL = `https://${ZAI_HOST}/api/monitor/usage/quota/limit`;
|
|
8939
9255
|
ZAI_UNIT_HOURS = 3;
|
|
8940
9256
|
ZAI_UNIT_MONTHS = 5;
|
|
8941
9257
|
ZAI_UNIT_MS = /* @__PURE__ */ new Map([
|
|
8942
|
-
[ZAI_UNIT_HOURS,
|
|
8943
|
-
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH *
|
|
9258
|
+
[ZAI_UNIT_HOURS, SECONDS_PER_HOUR2 * MS_PER_SECOND7],
|
|
9259
|
+
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY5 * SECONDS_PER_HOUR2 * MS_PER_SECOND7]
|
|
8944
9260
|
]);
|
|
8945
|
-
ZaiLimitSchema =
|
|
8946
|
-
type:
|
|
8947
|
-
unit:
|
|
8948
|
-
number:
|
|
8949
|
-
percentage:
|
|
8950
|
-
nextResetTime:
|
|
8951
|
-
usage:
|
|
8952
|
-
currentValue:
|
|
8953
|
-
remaining:
|
|
9261
|
+
ZaiLimitSchema = import_zod30.z.object({
|
|
9262
|
+
type: import_zod30.z.string(),
|
|
9263
|
+
unit: import_zod30.z.number().int(),
|
|
9264
|
+
number: import_zod30.z.number().int().positive(),
|
|
9265
|
+
percentage: import_zod30.z.number().nonnegative(),
|
|
9266
|
+
nextResetTime: import_zod30.z.number().positive().optional(),
|
|
9267
|
+
usage: import_zod30.z.number().nonnegative().optional(),
|
|
9268
|
+
currentValue: import_zod30.z.number().nonnegative().optional(),
|
|
9269
|
+
remaining: import_zod30.z.number().nonnegative().optional()
|
|
8954
9270
|
});
|
|
8955
|
-
ZaiResponseSchema =
|
|
8956
|
-
success:
|
|
8957
|
-
msg:
|
|
8958
|
-
data:
|
|
9271
|
+
ZaiResponseSchema = import_zod30.z.object({
|
|
9272
|
+
success: import_zod30.z.boolean(),
|
|
9273
|
+
msg: import_zod30.z.string().optional(),
|
|
9274
|
+
data: import_zod30.z.object({ level: import_zod30.z.string().optional(), limits: import_zod30.z.array(ZaiLimitSchema) })
|
|
8959
9275
|
});
|
|
8960
9276
|
OPENROUTER_HOST = "openrouter.ai";
|
|
8961
9277
|
OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
|
|
8962
9278
|
OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
|
|
8963
|
-
MS_PER_DAY3 =
|
|
8964
|
-
OpenRouterKeySchema =
|
|
8965
|
-
data:
|
|
8966
|
-
limit:
|
|
8967
|
-
limit_remaining:
|
|
8968
|
-
limit_reset:
|
|
8969
|
-
is_free_tier:
|
|
8970
|
-
free_model_daily_requests:
|
|
9279
|
+
MS_PER_DAY3 = HOURS_PER_DAY5 * SECONDS_PER_HOUR2 * MS_PER_SECOND7;
|
|
9280
|
+
OpenRouterKeySchema = import_zod30.z.object({
|
|
9281
|
+
data: import_zod30.z.object({
|
|
9282
|
+
limit: import_zod30.z.number().nonnegative().nullable(),
|
|
9283
|
+
limit_remaining: import_zod30.z.number().nullable(),
|
|
9284
|
+
limit_reset: import_zod30.z.string().nullable(),
|
|
9285
|
+
is_free_tier: import_zod30.z.boolean().optional(),
|
|
9286
|
+
free_model_daily_requests: import_zod30.z.object({ used: import_zod30.z.number().nonnegative(), limit: import_zod30.z.number().nonnegative(), remaining: import_zod30.z.number() }).optional()
|
|
8971
9287
|
})
|
|
8972
9288
|
});
|
|
8973
|
-
OpenRouterCreditsSchema =
|
|
9289
|
+
OpenRouterCreditsSchema = import_zod30.z.object({ data: import_zod30.z.object({ total_credits: import_zod30.z.number().nonnegative(), total_usage: import_zod30.z.number().nonnegative() }) });
|
|
8974
9290
|
ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
|
|
8975
9291
|
ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
|
|
8976
9292
|
ANTIGRAVITY_USER_URL = `https://${ANTIGRAVITY_HOST}/v1internal:loadCodeAssist`;
|
|
8977
9293
|
FIVE_HOURS2 = 5;
|
|
8978
|
-
|
|
8979
|
-
FIVE_HOURS_MS = FIVE_HOURS2 *
|
|
8980
|
-
WEEK_MS =
|
|
8981
|
-
AntigravityBucketSchema =
|
|
8982
|
-
bucketId:
|
|
8983
|
-
remainingFraction:
|
|
8984
|
-
resetTime:
|
|
9294
|
+
DAYS_PER_WEEK2 = 7;
|
|
9295
|
+
FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR2 * MS_PER_SECOND7;
|
|
9296
|
+
WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY5 * SECONDS_PER_HOUR2 * MS_PER_SECOND7;
|
|
9297
|
+
AntigravityBucketSchema = import_zod30.z.object({
|
|
9298
|
+
bucketId: import_zod30.z.string(),
|
|
9299
|
+
remainingFraction: import_zod30.z.number().optional(),
|
|
9300
|
+
resetTime: import_zod30.z.string().optional()
|
|
8985
9301
|
});
|
|
8986
|
-
AntigravitySummarySchema =
|
|
8987
|
-
GoogleTokenInfoSchema =
|
|
8988
|
-
email:
|
|
8989
|
-
sub:
|
|
9302
|
+
AntigravitySummarySchema = import_zod30.z.object({ groups: import_zod30.z.array(import_zod30.z.object({ buckets: import_zod30.z.array(AntigravityBucketSchema) })) });
|
|
9303
|
+
GoogleTokenInfoSchema = import_zod30.z.object({
|
|
9304
|
+
email: import_zod30.z.string().optional(),
|
|
9305
|
+
sub: import_zod30.z.string().optional()
|
|
8990
9306
|
});
|
|
8991
|
-
AntigravityUserSchema =
|
|
9307
|
+
AntigravityUserSchema = import_zod30.z.object({
|
|
8992
9308
|
/** The code-assist tier context, which defaults to the free tier for every account. */
|
|
8993
|
-
currentTier:
|
|
9309
|
+
currentTier: import_zod30.z.object({ name: import_zod30.z.string().optional(), id: import_zod30.z.string().optional() }).optional(),
|
|
8994
9310
|
/** The account's paid subscription; absent when the account has none. */
|
|
8995
|
-
paidTier:
|
|
9311
|
+
paidTier: import_zod30.z.object({ name: import_zod30.z.string().optional(), id: import_zod30.z.string().optional() }).optional()
|
|
8996
9312
|
});
|
|
8997
9313
|
}
|
|
8998
9314
|
});
|
|
@@ -16910,7 +17226,7 @@ function numberOf(record, field) {
|
|
|
16910
17226
|
}
|
|
16911
17227
|
return void 0;
|
|
16912
17228
|
}
|
|
16913
|
-
function pageOfRcChannel(url, rows, idOf,
|
|
17229
|
+
function pageOfRcChannel(url, rows, idOf, rowOf3) {
|
|
16914
17230
|
const query = new URL(url, "http://127.0.0.1").searchParams;
|
|
16915
17231
|
const anchor = query.get("after_event_id") ?? query.get("cursor");
|
|
16916
17232
|
const rawLimit = query.get("limit");
|
|
@@ -16924,7 +17240,7 @@ function pageOfRcChannel(url, rows, idOf, rowOf2) {
|
|
|
16924
17240
|
}
|
|
16925
17241
|
const page = limit === void 0 ? rows.slice(from) : rows.slice(from, from + limit);
|
|
16926
17242
|
const last = page[page.length - 1];
|
|
16927
|
-
return { data: page.map(
|
|
17243
|
+
return { data: page.map(rowOf3), ...last === void 0 ? {} : { next_cursor: idOf(last) } };
|
|
16928
17244
|
}
|
|
16929
17245
|
async function serveRcClientChannels(ctx, tail, method, maxBatchEvents) {
|
|
16930
17246
|
const { request: request4, response, host } = ctx;
|