claude-use 11.10.0 → 11.11.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 +274 -186
- package/dist/index.cjs +33 -3
- package/dist/index.mjs +33 -3
- package/dist/types/index.d.ts +16 -0
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -33419,7 +33419,7 @@ function isRateLimitHeader(name) {
|
|
|
33419
33419
|
const lower = name.toLowerCase();
|
|
33420
33420
|
return lower === "retry-after" || lower.startsWith("anthropic-ratelimit-") || lower.startsWith("x-ratelimit-") || lower.startsWith("ratelimit") || lower.startsWith("x-codex-");
|
|
33421
33421
|
}
|
|
33422
|
-
var USAGE_SCHEMA_VERSION, VersionSchema, InstantSchema, TokenCountSchema, TokenUsageSchema, LIMIT_KINDS, LimitClassificationSchema, UsageRecordSchema, QuotaWindowSchema, ExtraUsageSpendSchema, UnifiedRateLimitSchema, RateLimitStateSchema, LimitEventSchema, ProviderQuotaWindowSchema, ProviderQuotaSchema, ProviderUsageStateSchema, AccountMetadataSchema, UsageSnapshotSchema;
|
|
33422
|
+
var USAGE_SCHEMA_VERSION, VersionSchema, InstantSchema, TokenCountSchema, TokenUsageSchema, LIMIT_KINDS, LimitClassificationSchema, UsageRecordSchema, QuotaWindowSchema, ExtraUsageSpendSchema, UnifiedRateLimitSchema, RateLimitStateSchema, LimitEventSchema, ProviderQuotaWindowSchema, ProviderAccountSchema, ProviderQuotaSchema, ProviderUsageStateSchema, AccountMetadataSchema, UsageSnapshotSchema;
|
|
33423
33423
|
var init_schema2 = __esm({
|
|
33424
33424
|
"src/usage/schema.ts"() {
|
|
33425
33425
|
"use strict";
|
|
@@ -33551,12 +33551,18 @@ var init_schema2 = __esm({
|
|
|
33551
33551
|
used: external_exports.number().nonnegative().optional(),
|
|
33552
33552
|
remaining: external_exports.number().nonnegative().optional()
|
|
33553
33553
|
});
|
|
33554
|
+
ProviderAccountSchema = external_exports.strictObject({
|
|
33555
|
+
email: external_exports.string().optional(),
|
|
33556
|
+
accountId: external_exports.string().optional()
|
|
33557
|
+
});
|
|
33554
33558
|
ProviderQuotaSchema = external_exports.strictObject({
|
|
33555
33559
|
observedAt: InstantSchema,
|
|
33556
33560
|
/** Which usage endpoint produced it (`z.ai`). */
|
|
33557
33561
|
source: external_exports.string(),
|
|
33558
33562
|
/** The subscription level the endpoint reports, when it does. */
|
|
33559
33563
|
level: external_exports.string().optional(),
|
|
33564
|
+
/** The account the provider's credential belongs to, when its endpoint reports it. */
|
|
33565
|
+
account: ProviderAccountSchema.optional(),
|
|
33560
33566
|
windows: external_exports.array(ProviderQuotaWindowSchema)
|
|
33561
33567
|
});
|
|
33562
33568
|
ProviderUsageStateSchema = external_exports.strictObject({
|
|
@@ -34087,7 +34093,7 @@ var init_package = __esm({
|
|
|
34087
34093
|
"package.json"() {
|
|
34088
34094
|
package_default = {
|
|
34089
34095
|
name: "claude-use",
|
|
34090
|
-
version: "11.
|
|
34096
|
+
version: "11.11.0",
|
|
34091
34097
|
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.",
|
|
34092
34098
|
license: "MIT",
|
|
34093
34099
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -34689,13 +34695,16 @@ function decoderFor(encoding) {
|
|
|
34689
34695
|
return void 0;
|
|
34690
34696
|
}
|
|
34691
34697
|
}
|
|
34692
|
-
function destinationOf(path59) {
|
|
34698
|
+
function destinationOf(path59, sessionProvider) {
|
|
34693
34699
|
const scoped = parseProviderPath(path59);
|
|
34694
|
-
|
|
34700
|
+
if (scoped !== void 0) {
|
|
34701
|
+
return { provider: scoped.provider, endpoint: scoped.rest };
|
|
34702
|
+
}
|
|
34703
|
+
return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint: path59 };
|
|
34695
34704
|
}
|
|
34696
34705
|
function buildRecord(event, context) {
|
|
34697
34706
|
const { scan } = context;
|
|
34698
|
-
const { provider, endpoint } = destinationOf(event.path);
|
|
34707
|
+
const { provider, endpoint } = destinationOf(event.path, event.session.provider);
|
|
34699
34708
|
const rateLimitHeaders = rateLimitHeadersOf(event.headers);
|
|
34700
34709
|
const limit = classifyLimit({ status: event.status, headers: rateLimitHeaders ?? {}, error: scan?.error, nowMs: context.endedAt });
|
|
34701
34710
|
const requestId = headerValue(event.headers, "request-id");
|
|
@@ -63981,6 +63990,125 @@ var init_identityClaude = __esm({
|
|
|
63981
63990
|
}
|
|
63982
63991
|
});
|
|
63983
63992
|
|
|
63993
|
+
// src/antigravity/cloudUpstream.ts
|
|
63994
|
+
function isCcpaEndpoint(endpoint) {
|
|
63995
|
+
return endpoint.includes("cloudcode-pa.googleapis.com");
|
|
63996
|
+
}
|
|
63997
|
+
function buildCloudUrl(config2, model) {
|
|
63998
|
+
const { cloud } = config2;
|
|
63999
|
+
if (cloud.projectId !== void 0 && cloud.location !== void 0) {
|
|
64000
|
+
const base2 = cloud.endpoint ?? `https://${cloud.location}-aiplatform.googleapis.com`;
|
|
64001
|
+
return `${base2}/v1/projects/${cloud.projectId}/locations/${cloud.location}/publishers/google/models/${encodeURIComponent(model)}:streamGenerateContent?alt=sse`;
|
|
64002
|
+
}
|
|
64003
|
+
const base = cloud.endpoint ?? CCPA_ENDPOINT;
|
|
64004
|
+
if (isCcpaEndpoint(base)) {
|
|
64005
|
+
return `${base}/v1internal:streamGenerateContent?alt=sse`;
|
|
64006
|
+
}
|
|
64007
|
+
return `${base}/v1beta/models/${encodeURIComponent(model)}:streamGenerateContent?alt=sse`;
|
|
64008
|
+
}
|
|
64009
|
+
function buildCloudHeaders(token, credentialTarget, endpoint) {
|
|
64010
|
+
const headers = {
|
|
64011
|
+
"Content-Type": "application/json",
|
|
64012
|
+
Accept: "text/event-stream"
|
|
64013
|
+
};
|
|
64014
|
+
const target = credentialTarget ?? "bearer";
|
|
64015
|
+
if (target === "apiKey") {
|
|
64016
|
+
headers["x-goog-api-key"] = token;
|
|
64017
|
+
} else {
|
|
64018
|
+
headers.Authorization = `Bearer ${token}`;
|
|
64019
|
+
}
|
|
64020
|
+
const base = endpoint ?? CCPA_ENDPOINT;
|
|
64021
|
+
if (isCcpaEndpoint(base)) {
|
|
64022
|
+
headers["User-Agent"] = CCPA_USER_AGENT;
|
|
64023
|
+
}
|
|
64024
|
+
return headers;
|
|
64025
|
+
}
|
|
64026
|
+
function buildCloudRequestBody(params) {
|
|
64027
|
+
const base = params.config.cloud.endpoint ?? CCPA_ENDPOINT;
|
|
64028
|
+
if (isCcpaEndpoint(base)) {
|
|
64029
|
+
return JSON.stringify({
|
|
64030
|
+
project: params.config.cloud.projectId ?? CCPA_DEFAULT_PROJECT_ID,
|
|
64031
|
+
requestId: `agent/${(0, import_node_crypto16.randomUUID)()}/${String(Date.now())}/1`,
|
|
64032
|
+
request: params.request,
|
|
64033
|
+
model: params.model,
|
|
64034
|
+
userAgent: "antigravity"
|
|
64035
|
+
});
|
|
64036
|
+
}
|
|
64037
|
+
return JSON.stringify(params.request);
|
|
64038
|
+
}
|
|
64039
|
+
function isRecord4(value2) {
|
|
64040
|
+
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
64041
|
+
}
|
|
64042
|
+
function isGeminiChunk(value2) {
|
|
64043
|
+
return isRecord4(value2);
|
|
64044
|
+
}
|
|
64045
|
+
async function* callCloudAntigravity(params, fetchFn = fetch) {
|
|
64046
|
+
const url2 = buildCloudUrl(params.config, params.model);
|
|
64047
|
+
const headers = buildCloudHeaders(params.token, params.credentialTarget, params.config.cloud.endpoint);
|
|
64048
|
+
const body = buildCloudRequestBody(params);
|
|
64049
|
+
const response = await fetchFn(url2, {
|
|
64050
|
+
method: "POST",
|
|
64051
|
+
headers,
|
|
64052
|
+
body,
|
|
64053
|
+
signal: params.signal
|
|
64054
|
+
});
|
|
64055
|
+
if (!response.ok) {
|
|
64056
|
+
const errorText = await response.text();
|
|
64057
|
+
const retryAfter = response.headers.get("retry-after");
|
|
64058
|
+
throw new AntigravityUpstreamError(response.status, errorText, retryAfter);
|
|
64059
|
+
}
|
|
64060
|
+
if (response.body === null) {
|
|
64061
|
+
return;
|
|
64062
|
+
}
|
|
64063
|
+
const decoder = new TextDecoder("utf-8");
|
|
64064
|
+
let buffer2 = "";
|
|
64065
|
+
const sseDataPrefix = "data:";
|
|
64066
|
+
for await (const rawChunk of response.body) {
|
|
64067
|
+
const chunk = rawChunk instanceof Uint8Array ? rawChunk : Buffer.from(String(rawChunk));
|
|
64068
|
+
buffer2 += decoder.decode(chunk, { stream: true });
|
|
64069
|
+
const lines = buffer2.split("\n");
|
|
64070
|
+
buffer2 = lines.pop() ?? "";
|
|
64071
|
+
for (const line of lines) {
|
|
64072
|
+
const trimmed = line.trim();
|
|
64073
|
+
if (trimmed.startsWith(sseDataPrefix)) {
|
|
64074
|
+
const jsonStr = trimmed.slice(sseDataPrefix.length).trim();
|
|
64075
|
+
if (jsonStr.length > 0) {
|
|
64076
|
+
try {
|
|
64077
|
+
const parsed = JSON.parse(jsonStr);
|
|
64078
|
+
if (isRecord4(parsed)) {
|
|
64079
|
+
const unwrapped = isRecord4(parsed.response) ? parsed.response : parsed;
|
|
64080
|
+
if (isGeminiChunk(unwrapped)) {
|
|
64081
|
+
yield unwrapped;
|
|
64082
|
+
}
|
|
64083
|
+
}
|
|
64084
|
+
} catch {
|
|
64085
|
+
}
|
|
64086
|
+
}
|
|
64087
|
+
}
|
|
64088
|
+
}
|
|
64089
|
+
}
|
|
64090
|
+
}
|
|
64091
|
+
var import_node_crypto16, CCPA_ENDPOINT, CCPA_DEFAULT_PROJECT_ID, CCPA_USER_AGENT, AntigravityUpstreamError;
|
|
64092
|
+
var init_cloudUpstream = __esm({
|
|
64093
|
+
"src/antigravity/cloudUpstream.ts"() {
|
|
64094
|
+
"use strict";
|
|
64095
|
+
import_node_crypto16 = require("node:crypto");
|
|
64096
|
+
CCPA_ENDPOINT = "https://daily-cloudcode-pa.googleapis.com";
|
|
64097
|
+
CCPA_DEFAULT_PROJECT_ID = "aicode-consumers";
|
|
64098
|
+
CCPA_USER_AGENT = "antigravity/cli/1.3.5 (aidev_client; os_type=darwin; arch=arm64; cl=998863838; auth_method=consumer)";
|
|
64099
|
+
AntigravityUpstreamError = class extends Error {
|
|
64100
|
+
status;
|
|
64101
|
+
retryAfter;
|
|
64102
|
+
constructor(status, message, retryAfter) {
|
|
64103
|
+
super(`Google Antigravity API error (${String(status)}): ${message}`);
|
|
64104
|
+
this.name = "AntigravityUpstreamError";
|
|
64105
|
+
this.status = status;
|
|
64106
|
+
this.retryAfter = retryAfter;
|
|
64107
|
+
}
|
|
64108
|
+
};
|
|
64109
|
+
}
|
|
64110
|
+
});
|
|
64111
|
+
|
|
63984
64112
|
// src/usage/providerQuota.ts
|
|
63985
64113
|
function zaiWindow(limit) {
|
|
63986
64114
|
const unitMs = ZAI_UNIT_MS.get(limit.unit);
|
|
@@ -64024,11 +64152,12 @@ function quotaFreshnessMs(quota) {
|
|
|
64024
64152
|
const lengths = quota.windows.flatMap((window) => window.periodMs === void 0 ? [] : [window.periodMs]);
|
|
64025
64153
|
return lengths.length === 0 ? Number.POSITIVE_INFINITY : Math.min(...lengths) / PERCENT3;
|
|
64026
64154
|
}
|
|
64027
|
-
var ProviderQuotaError, MS_PER_SECOND6, SECONDS_PER_HOUR, HOURS_PER_DAY3, DAYS_PER_MONTH, PERCENT3, HTTP_OK, ZAI_SOURCE, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZAI_MEASURES, ZaiLimitSchema, ZaiResponseSchema, zaiQuotaAdapter, OPENROUTER_SOURCE, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, HTTP_FORBIDDEN, MS_PER_DAY2, OpenRouterKeySchema, OpenRouterCreditsSchema, openRouterQuotaAdapter, PROVIDER_QUOTA_ADAPTERS;
|
|
64155
|
+
var ProviderQuotaError, MS_PER_SECOND6, SECONDS_PER_HOUR, HOURS_PER_DAY3, DAYS_PER_MONTH, PERCENT3, HTTP_OK, ZAI_SOURCE, ZAI_HOST, ZAI_QUOTA_URL, ZAI_UNIT_HOURS, ZAI_UNIT_MONTHS, ZAI_UNIT_MS, ZAI_MEASURES, ZaiLimitSchema, ZaiResponseSchema, zaiQuotaAdapter, OPENROUTER_SOURCE, OPENROUTER_HOST, OPENROUTER_KEY_URL, OPENROUTER_CREDITS_URL, HTTP_FORBIDDEN, MS_PER_DAY2, OpenRouterKeySchema, OpenRouterCreditsSchema, openRouterQuotaAdapter, ANTIGRAVITY_SOURCE, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, GOOGLE_TOKENINFO_URL, FIVE_HOURS2, DAYS_PER_WEEK, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, ANTIGRAVITY_WINDOW_MS, antigravityQuotaAdapter, PROVIDER_QUOTA_ADAPTERS;
|
|
64028
64156
|
var init_providerQuota = __esm({
|
|
64029
64157
|
"src/usage/providerQuota.ts"() {
|
|
64030
64158
|
"use strict";
|
|
64031
64159
|
init_zod();
|
|
64160
|
+
init_cloudUpstream();
|
|
64032
64161
|
init_schema2();
|
|
64033
64162
|
ProviderQuotaError = class extends Error {
|
|
64034
64163
|
constructor(source, detail) {
|
|
@@ -64142,7 +64271,71 @@ var init_providerQuota = __esm({
|
|
|
64142
64271
|
});
|
|
64143
64272
|
}
|
|
64144
64273
|
};
|
|
64145
|
-
|
|
64274
|
+
ANTIGRAVITY_SOURCE = "Cloud Code";
|
|
64275
|
+
ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
|
|
64276
|
+
ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
|
|
64277
|
+
GOOGLE_TOKENINFO_URL = "https://oauth2.googleapis.com/tokeninfo";
|
|
64278
|
+
FIVE_HOURS2 = 5;
|
|
64279
|
+
DAYS_PER_WEEK = 7;
|
|
64280
|
+
FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR * MS_PER_SECOND6;
|
|
64281
|
+
WEEK_MS = DAYS_PER_WEEK * HOURS_PER_DAY3 * SECONDS_PER_HOUR * MS_PER_SECOND6;
|
|
64282
|
+
AntigravityBucketSchema = external_exports.object({
|
|
64283
|
+
bucketId: external_exports.string(),
|
|
64284
|
+
remainingFraction: external_exports.number().optional(),
|
|
64285
|
+
resetTime: external_exports.string().optional()
|
|
64286
|
+
});
|
|
64287
|
+
AntigravitySummarySchema = external_exports.object({ groups: external_exports.array(external_exports.object({ buckets: external_exports.array(AntigravityBucketSchema) })) });
|
|
64288
|
+
GoogleTokenInfoSchema = external_exports.object({
|
|
64289
|
+
email: external_exports.string().optional(),
|
|
64290
|
+
sub: external_exports.string().optional()
|
|
64291
|
+
});
|
|
64292
|
+
ANTIGRAVITY_WINDOW_MS = { "gemini-5h": FIVE_HOURS_MS, "3p-5h": FIVE_HOURS_MS, "gemini-weekly": WEEK_MS, "3p-weekly": WEEK_MS };
|
|
64293
|
+
antigravityQuotaAdapter = {
|
|
64294
|
+
source: ANTIGRAVITY_SOURCE,
|
|
64295
|
+
matches: (baseUrl) => URL.canParse(baseUrl) && new URL(baseUrl).hostname === ANTIGRAVITY_HOST,
|
|
64296
|
+
fetch: async (apiKey, http8, signal, nowMs) => {
|
|
64297
|
+
const headers = { authorization: `Bearer ${apiKey}`, "content-type": "application/json", "user-agent": CCPA_USER_AGENT };
|
|
64298
|
+
const summaryResponse = await http8(ANTIGRAVITY_QUOTA_URL, headers, signal, { method: "POST", body: JSON.stringify({ project: "aicode-consumers" }) });
|
|
64299
|
+
if (summaryResponse.status !== HTTP_OK) {
|
|
64300
|
+
throw new ProviderQuotaError(ANTIGRAVITY_SOURCE, `answered HTTP ${String(summaryResponse.status)}`);
|
|
64301
|
+
}
|
|
64302
|
+
let summaryBody;
|
|
64303
|
+
try {
|
|
64304
|
+
summaryBody = JSON.parse(summaryResponse.text);
|
|
64305
|
+
} catch {
|
|
64306
|
+
throw new ProviderQuotaError(ANTIGRAVITY_SOURCE, "answered something that is not JSON");
|
|
64307
|
+
}
|
|
64308
|
+
const parsed = AntigravitySummarySchema.safeParse(summaryBody);
|
|
64309
|
+
if (!parsed.success) {
|
|
64310
|
+
throw new ProviderQuotaError(ANTIGRAVITY_SOURCE, `answered an unexpected shape: ${parsed.error.issues.map((issue2) => `${issue2.path.join(".")}: ${issue2.message}`).join("; ")}`);
|
|
64311
|
+
}
|
|
64312
|
+
const tokenResponse = await http8(`${GOOGLE_TOKENINFO_URL}?access_token=${encodeURIComponent(apiKey)}`, { accept: "application/json" }, signal);
|
|
64313
|
+
let account;
|
|
64314
|
+
if (tokenResponse.status === HTTP_OK) {
|
|
64315
|
+
try {
|
|
64316
|
+
const tokenInfo = GoogleTokenInfoSchema.parse(JSON.parse(tokenResponse.text));
|
|
64317
|
+
if (tokenInfo.email !== void 0 || tokenInfo.sub !== void 0) {
|
|
64318
|
+
account = { ...tokenInfo.email === void 0 ? {} : { email: tokenInfo.email }, ...tokenInfo.sub === void 0 ? {} : { accountId: tokenInfo.sub } };
|
|
64319
|
+
}
|
|
64320
|
+
} catch {
|
|
64321
|
+
}
|
|
64322
|
+
}
|
|
64323
|
+
return ProviderQuotaSchema.parse({
|
|
64324
|
+
observedAt: new Date(nowMs).toISOString(),
|
|
64325
|
+
source: ANTIGRAVITY_SOURCE,
|
|
64326
|
+
...account === void 0 ? {} : { account },
|
|
64327
|
+
windows: parsed.data.groups.flatMap(
|
|
64328
|
+
(group) => group.buckets.map((bucket) => ({
|
|
64329
|
+
measures: bucket.bucketId,
|
|
64330
|
+
...ANTIGRAVITY_WINDOW_MS[bucket.bucketId] === void 0 ? {} : { periodMs: ANTIGRAVITY_WINDOW_MS[bucket.bucketId] },
|
|
64331
|
+
utilization: bucket.remainingFraction === void 0 ? 0 : 1 - bucket.remainingFraction,
|
|
64332
|
+
...bucket.resetTime === void 0 ? {} : { resetsAt: bucket.resetTime }
|
|
64333
|
+
}))
|
|
64334
|
+
)
|
|
64335
|
+
});
|
|
64336
|
+
}
|
|
64337
|
+
};
|
|
64338
|
+
PROVIDER_QUOTA_ADAPTERS = [zaiQuotaAdapter, openRouterQuotaAdapter, antigravityQuotaAdapter];
|
|
64146
64339
|
}
|
|
64147
64340
|
});
|
|
64148
64341
|
|
|
@@ -64217,11 +64410,15 @@ function createQuotaRefresher(deps) {
|
|
|
64217
64410
|
function createProviderLookup(ports) {
|
|
64218
64411
|
return (name) => {
|
|
64219
64412
|
const definition = loadProvider(ports.providersDir, name, ports.fs);
|
|
64220
|
-
if (definition === void 0
|
|
64413
|
+
if (definition === void 0) {
|
|
64414
|
+
return void 0;
|
|
64415
|
+
}
|
|
64416
|
+
const baseUrl = isAntigravityProvider(definition) ? "https://daily-cloudcode-pa.googleapis.com" : isHttpProvider(definition) ? definition.baseUrl : void 0;
|
|
64417
|
+
if (baseUrl === void 0) {
|
|
64221
64418
|
return void 0;
|
|
64222
64419
|
}
|
|
64223
64420
|
return {
|
|
64224
|
-
baseUrl
|
|
64421
|
+
baseUrl,
|
|
64225
64422
|
apiKey: () => {
|
|
64226
64423
|
const resolution = resolveCredential({ credential: definition.credential, env: ports.env, port: ports.credentials, subject: `provider ${name}` });
|
|
64227
64424
|
if (!resolution.ok) {
|
|
@@ -113952,11 +114149,11 @@ init_capability();
|
|
|
113952
114149
|
init_capture();
|
|
113953
114150
|
|
|
113954
114151
|
// src/frontdoor/connect.ts
|
|
113955
|
-
var
|
|
114152
|
+
var import_node_crypto18 = require("node:crypto");
|
|
113956
114153
|
var fs17 = __toESM(require("node:fs"), 1);
|
|
113957
114154
|
|
|
113958
114155
|
// src/frontdoor/x509.ts
|
|
113959
|
-
var
|
|
114156
|
+
var import_node_crypto17 = require("node:crypto");
|
|
113960
114157
|
var import_node_net = __toESM(require("node:net"), 1);
|
|
113961
114158
|
var TAG_BOOLEAN = 1;
|
|
113962
114159
|
var TAG_INTEGER = 2;
|
|
@@ -114108,7 +114305,7 @@ function ipBytes(address) {
|
|
|
114108
114305
|
return bytes;
|
|
114109
114306
|
}
|
|
114110
114307
|
function keyIdentifier(publicKey) {
|
|
114111
|
-
return (0,
|
|
114308
|
+
return (0, import_node_crypto17.createHash)("sha1").update(publicKey.export({ type: "pkcs1", format: "der" })).digest();
|
|
114112
114309
|
}
|
|
114113
114310
|
function readElement(buffer2, offset) {
|
|
114114
114311
|
const tag = buffer2[offset];
|
|
@@ -114154,7 +114351,7 @@ ${body.join("\n")}
|
|
|
114154
114351
|
`;
|
|
114155
114352
|
}
|
|
114156
114353
|
function randomSerial() {
|
|
114157
|
-
const bytes = (0,
|
|
114354
|
+
const bytes = (0, import_node_crypto17.randomBytes)(SERIAL_NUMBER_BYTES);
|
|
114158
114355
|
bytes[0] = (bytes[0] ?? 0) & BASE_128_PAYLOAD_MASK | HIGH_BIT >> 1;
|
|
114159
114356
|
return bytes;
|
|
114160
114357
|
}
|
|
@@ -114169,7 +114366,7 @@ function assemble(spec) {
|
|
|
114169
114366
|
spec.subjectPublicKey.export({ type: "spki", format: "der" }),
|
|
114170
114367
|
tlv(TAG_EXTENSIONS, sequence(...spec.extensions))
|
|
114171
114368
|
);
|
|
114172
|
-
const signature = (0,
|
|
114369
|
+
const signature = (0, import_node_crypto17.sign)("sha256", tbs, spec.signingKey);
|
|
114173
114370
|
return sequence(tbs, SIGNATURE_ALGORITHM, wholeBitString(signature));
|
|
114174
114371
|
}
|
|
114175
114372
|
function subjectKeyIdentifierExtension(publicKey) {
|
|
@@ -114179,7 +114376,7 @@ function basicConstraintsExtension(isCa) {
|
|
|
114179
114376
|
return extension(OID_BASIC_CONSTRAINTS, true, sequence(...isCa ? [boolean4(true)] : []));
|
|
114180
114377
|
}
|
|
114181
114378
|
function rsaKeyPair() {
|
|
114182
|
-
return (0,
|
|
114379
|
+
return (0, import_node_crypto17.generateKeyPairSync)("rsa", { modulusLength: RSA_MODULUS_BITS });
|
|
114183
114380
|
}
|
|
114184
114381
|
function keyPem(privateKey) {
|
|
114185
114382
|
return privateKey.export({ type: "pkcs8", format: "pem" });
|
|
@@ -114203,8 +114400,8 @@ function issueLeafCertificate(ca2, names, notBefore, notAfter) {
|
|
|
114203
114400
|
if (commonName === void 0) {
|
|
114204
114401
|
throw new Error("a leaf certificate needs at least one name");
|
|
114205
114402
|
}
|
|
114206
|
-
const caCertificate = new
|
|
114207
|
-
const caPrivateKey = (0,
|
|
114403
|
+
const caCertificate = new import_node_crypto17.X509Certificate(ca2.certPem);
|
|
114404
|
+
const caPrivateKey = (0, import_node_crypto17.createPrivateKey)(ca2.keyPem);
|
|
114208
114405
|
const { publicKey, privateKey } = rsaKeyPair();
|
|
114209
114406
|
const generalNames = names.map((name) => import_node_net.default.isIP(name) === 0 ? tlv(TAG_GENERAL_NAME_DNS, Buffer.from(name, "ascii")) : tlv(TAG_GENERAL_NAME_IP, ipBytes(name)));
|
|
114210
114407
|
const der = assemble({
|
|
@@ -114559,8 +114756,8 @@ function ensureCa(store, generate) {
|
|
|
114559
114756
|
}
|
|
114560
114757
|
function caParses(ca2) {
|
|
114561
114758
|
try {
|
|
114562
|
-
new
|
|
114563
|
-
(0,
|
|
114759
|
+
new import_node_crypto18.X509Certificate(ca2.certPem);
|
|
114760
|
+
(0, import_node_crypto18.createPrivateKey)(ca2.keyPem);
|
|
114564
114761
|
return true;
|
|
114565
114762
|
} catch {
|
|
114566
114763
|
return false;
|
|
@@ -114887,7 +115084,7 @@ var LiveTaskSchema = external_exports.strictObject({
|
|
|
114887
115084
|
observedAt: external_exports.number()
|
|
114888
115085
|
});
|
|
114889
115086
|
var SYSTEM_SUBTYPES = ["task_started", "task_progress", "task_updated", "task_notification", "background_tasks_changed"];
|
|
114890
|
-
function
|
|
115087
|
+
function isRecord5(value2) {
|
|
114891
115088
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
114892
115089
|
}
|
|
114893
115090
|
function stringField(record2, field) {
|
|
@@ -114904,7 +115101,7 @@ function booleanField(record2, field) {
|
|
|
114904
115101
|
}
|
|
114905
115102
|
function usageOf(record2) {
|
|
114906
115103
|
const raw = record2.usage;
|
|
114907
|
-
if (!
|
|
115104
|
+
if (!isRecord5(raw)) {
|
|
114908
115105
|
return void 0;
|
|
114909
115106
|
}
|
|
114910
115107
|
const totalTokens = numberField(raw, "total_tokens");
|
|
@@ -114936,7 +115133,7 @@ function bounded(book) {
|
|
|
114936
115133
|
return book;
|
|
114937
115134
|
}
|
|
114938
115135
|
function applyAgentTaskEvent(book, sessionId, payload, observedAt2) {
|
|
114939
|
-
if (!
|
|
115136
|
+
if (!isRecord5(payload) || payload.type !== "system") {
|
|
114940
115137
|
return book;
|
|
114941
115138
|
}
|
|
114942
115139
|
const subtype = payload.subtype;
|
|
@@ -114952,8 +115149,8 @@ function applyAgentTaskEvent(book, sessionId, payload, observedAt2) {
|
|
|
114952
115149
|
if (subtype === "background_tasks_changed") {
|
|
114953
115150
|
const tasks = Array.isArray(payload.tasks) ? payload.tasks : [];
|
|
114954
115151
|
for (const raw of tasks) {
|
|
114955
|
-
const taskId2 =
|
|
114956
|
-
if (
|
|
115152
|
+
const taskId2 = isRecord5(raw) ? stringField(raw, "task_id") : void 0;
|
|
115153
|
+
if (isRecord5(raw) && taskId2 !== void 0) {
|
|
114957
115154
|
upsert(taskId2, { runId: stringField(raw, "run_id"), taskType: stringField(raw, "task_type"), description: stringField(raw, "description") });
|
|
114958
115155
|
}
|
|
114959
115156
|
}
|
|
@@ -114976,7 +115173,7 @@ function applyAgentTaskEvent(book, sessionId, payload, observedAt2) {
|
|
|
114976
115173
|
} else if (subtype === "task_progress") {
|
|
114977
115174
|
upsert(taskId, { ...common, subagentType: stringField(payload, "subagent_type"), lastToolName: stringField(payload, "last_tool_name"), usage: usageOf(payload) });
|
|
114978
115175
|
} else if (subtype === "task_updated") {
|
|
114979
|
-
const patch =
|
|
115176
|
+
const patch = isRecord5(payload.patch) ? payload.patch : {};
|
|
114980
115177
|
upsert(taskId, { runId: stringField(payload, "run_id"), status: stringField(patch, "status") });
|
|
114981
115178
|
} else {
|
|
114982
115179
|
upsert(taskId, { ...common, status: stringField(payload, "status"), outputFile: stringField(payload, "output_file"), summary: stringField(payload, "summary"), usage: usageOf(payload) });
|
|
@@ -115058,7 +115255,7 @@ function sessionCreateId(body) {
|
|
|
115058
115255
|
const id2 = session.id;
|
|
115059
115256
|
return typeof id2 === "string" && id2.startsWith(RC_SESSION_ID_PREFIX) ? id2 : void 0;
|
|
115060
115257
|
}
|
|
115061
|
-
function
|
|
115258
|
+
function isRecord6(value2) {
|
|
115062
115259
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
115063
115260
|
}
|
|
115064
115261
|
function parseJsonObject(body) {
|
|
@@ -115068,7 +115265,7 @@ function parseJsonObject(body) {
|
|
|
115068
115265
|
} catch {
|
|
115069
115266
|
return void 0;
|
|
115070
115267
|
}
|
|
115071
|
-
return
|
|
115268
|
+
return isRecord6(parsed) ? parsed : void 0;
|
|
115072
115269
|
}
|
|
115073
115270
|
function nonEmptyString(record2, field) {
|
|
115074
115271
|
const value2 = record2 === void 0 ? void 0 : record2[field];
|
|
@@ -115089,11 +115286,11 @@ function payloadEventsOf(body) {
|
|
|
115089
115286
|
}
|
|
115090
115287
|
const payloads = [];
|
|
115091
115288
|
for (const event of events) {
|
|
115092
|
-
if (!
|
|
115289
|
+
if (!isRecord6(event)) {
|
|
115093
115290
|
continue;
|
|
115094
115291
|
}
|
|
115095
115292
|
const payload = event.payload;
|
|
115096
|
-
if (!
|
|
115293
|
+
if (!isRecord6(payload)) {
|
|
115097
115294
|
continue;
|
|
115098
115295
|
}
|
|
115099
115296
|
payloads.push(payload);
|
|
@@ -115108,7 +115305,7 @@ function pendingOfControlRequestPayload(payload) {
|
|
|
115108
115305
|
if (requestId === void 0) {
|
|
115109
115306
|
return void 0;
|
|
115110
115307
|
}
|
|
115111
|
-
const request7 =
|
|
115308
|
+
const request7 = isRecord6(payload.request) ? payload.request : void 0;
|
|
115112
115309
|
const subtype = nonEmptyString(request7, "subtype");
|
|
115113
115310
|
const type2 = subtype ?? "control_request";
|
|
115114
115311
|
let summary = "";
|
|
@@ -115125,7 +115322,7 @@ function answeredRequestIdsOfControlResponsePayload(payload) {
|
|
|
115125
115322
|
if (payload.type !== "control_response") {
|
|
115126
115323
|
return [];
|
|
115127
115324
|
}
|
|
115128
|
-
const response =
|
|
115325
|
+
const response = isRecord6(payload.response) ? payload.response : void 0;
|
|
115129
115326
|
const id2 = nonEmptyString(response, "request_id") ?? nonEmptyString(payload, "request_id") ?? nonEmptyString(payload, "uuid");
|
|
115130
115327
|
return id2 === void 0 ? [] : [id2];
|
|
115131
115328
|
}
|
|
@@ -115354,7 +115551,7 @@ function createRcSessionTracker(deps) {
|
|
|
115354
115551
|
return;
|
|
115355
115552
|
}
|
|
115356
115553
|
entry.sequenceNum = entry.sequenceNum === void 0 || event.sequence_num > entry.sequenceNum ? event.sequence_num : entry.sequenceNum;
|
|
115357
|
-
if (!
|
|
115554
|
+
if (!isRecord6(event.payload)) {
|
|
115358
115555
|
return;
|
|
115359
115556
|
}
|
|
115360
115557
|
entry.liveTasks = applyAgentTaskEvent(entry.liveTasks, sessionId, event.payload, deps.now());
|
|
@@ -120232,7 +120429,7 @@ var HTTP_METHODS_UP_TO_V31 = [
|
|
|
120232
120429
|
function operationFields(convert) {
|
|
120233
120430
|
return Object.fromEntries(HTTP_METHODS_UP_TO_V31.map((method) => [method, convert]));
|
|
120234
120431
|
}
|
|
120235
|
-
function
|
|
120432
|
+
function isRecord7(value2) {
|
|
120236
120433
|
if (typeof value2 !== "object" || value2 === null) {
|
|
120237
120434
|
return false;
|
|
120238
120435
|
}
|
|
@@ -120252,7 +120449,7 @@ function setOwn2(object3, key, value2) {
|
|
|
120252
120449
|
}
|
|
120253
120450
|
}
|
|
120254
120451
|
function cloneValue(value2, seen) {
|
|
120255
|
-
if (!(Array.isArray(value2) ||
|
|
120452
|
+
if (!(Array.isArray(value2) || isRecord7(value2))) {
|
|
120256
120453
|
return value2;
|
|
120257
120454
|
}
|
|
120258
120455
|
const existing = seen.get(value2);
|
|
@@ -120275,14 +120472,14 @@ function cloneValue(value2, seen) {
|
|
|
120275
120472
|
return out;
|
|
120276
120473
|
}
|
|
120277
120474
|
function deepClone(value2) {
|
|
120278
|
-
if (!(Array.isArray(value2) ||
|
|
120475
|
+
if (!(Array.isArray(value2) || isRecord7(value2))) {
|
|
120279
120476
|
return value2;
|
|
120280
120477
|
}
|
|
120281
120478
|
return cloneValue(value2, /* @__PURE__ */ new WeakMap());
|
|
120282
120479
|
}
|
|
120283
120480
|
var converting = /* @__PURE__ */ new WeakMap();
|
|
120284
120481
|
function convertRecord(value2, fields, finish) {
|
|
120285
|
-
if (!
|
|
120482
|
+
if (!isRecord7(value2)) {
|
|
120286
120483
|
return deepClone(value2);
|
|
120287
120484
|
}
|
|
120288
120485
|
const inProgress = converting.get(value2);
|
|
@@ -120308,7 +120505,7 @@ function convertRecord(value2, fields, finish) {
|
|
|
120308
120505
|
}
|
|
120309
120506
|
}
|
|
120310
120507
|
function mapRecord(value2, convert) {
|
|
120311
|
-
if (!
|
|
120508
|
+
if (!isRecord7(value2)) {
|
|
120312
120509
|
return deepClone(value2);
|
|
120313
120510
|
}
|
|
120314
120511
|
const out = {};
|
|
@@ -120327,7 +120524,7 @@ function mapArray(value2, convert) {
|
|
|
120327
120524
|
return value2.map((item) => convert(item)).filter((item) => item !== DROP);
|
|
120328
120525
|
}
|
|
120329
120526
|
function getRef(value2) {
|
|
120330
|
-
if (
|
|
120527
|
+
if (isRecord7(value2) && typeof value2.$ref === "string") {
|
|
120331
120528
|
return value2.$ref;
|
|
120332
120529
|
}
|
|
120333
120530
|
return void 0;
|
|
@@ -120533,7 +120730,7 @@ function convertSchema2(schema) {
|
|
|
120533
120730
|
if (schema === false) {
|
|
120534
120731
|
return { not: {} };
|
|
120535
120732
|
}
|
|
120536
|
-
if (
|
|
120733
|
+
if (isRecord7(schema) && typeof schema.$ref === "string" && Object.keys(schema).length === 1) {
|
|
120537
120734
|
return { $ref: schema.$ref };
|
|
120538
120735
|
}
|
|
120539
120736
|
return convertRecord(schema, SCHEMA_FIELDS, finishSchema);
|
|
@@ -120545,7 +120742,7 @@ function resolveSchemeType(name, schemes, seen) {
|
|
|
120545
120742
|
return void 0;
|
|
120546
120743
|
}
|
|
120547
120744
|
const scheme = schemes[name];
|
|
120548
|
-
if (!
|
|
120745
|
+
if (!isRecord7(scheme)) {
|
|
120549
120746
|
return void 0;
|
|
120550
120747
|
}
|
|
120551
120748
|
if (typeof scheme.type === "string") {
|
|
@@ -120562,11 +120759,11 @@ function resolveSchemeType(name, schemes, seen) {
|
|
|
120562
120759
|
return void 0;
|
|
120563
120760
|
}
|
|
120564
120761
|
function createContext(spec) {
|
|
120565
|
-
const components =
|
|
120566
|
-
const pathItems =
|
|
120567
|
-
const schemes =
|
|
120762
|
+
const components = isRecord7(spec) ? spec.components : void 0;
|
|
120763
|
+
const pathItems = isRecord7(components) ? components.pathItems : void 0;
|
|
120764
|
+
const schemes = isRecord7(components) ? components.securitySchemes : void 0;
|
|
120568
120765
|
const schemeTypes = /* @__PURE__ */ new Map();
|
|
120569
|
-
if (
|
|
120766
|
+
if (isRecord7(schemes)) {
|
|
120570
120767
|
for (const name of Object.keys(schemes)) {
|
|
120571
120768
|
const type2 = resolveSchemeType(name, schemes, /* @__PURE__ */ new Set());
|
|
120572
120769
|
if (type2 !== void 0) {
|
|
@@ -120576,7 +120773,7 @@ function createContext(spec) {
|
|
|
120576
120773
|
}
|
|
120577
120774
|
return {
|
|
120578
120775
|
inlining: /* @__PURE__ */ new Set(),
|
|
120579
|
-
pathItems:
|
|
120776
|
+
pathItems: isRecord7(pathItems) ? pathItems : void 0,
|
|
120580
120777
|
schemeTypes
|
|
120581
120778
|
};
|
|
120582
120779
|
}
|
|
@@ -120584,7 +120781,7 @@ function isMutualTls(name, context) {
|
|
|
120584
120781
|
return context.schemeTypes.get(name) === "mutualTLS";
|
|
120585
120782
|
}
|
|
120586
120783
|
function convertRequirement(value2, context) {
|
|
120587
|
-
if (!
|
|
120784
|
+
if (!isRecord7(value2)) {
|
|
120588
120785
|
return deepClone(value2);
|
|
120589
120786
|
}
|
|
120590
120787
|
const entries = Object.entries(value2);
|
|
@@ -120684,10 +120881,10 @@ function resolvePathItemRef(value2, context) {
|
|
|
120684
120881
|
return void 0;
|
|
120685
120882
|
}
|
|
120686
120883
|
const target = context.pathItems[name];
|
|
120687
|
-
return
|
|
120884
|
+
return isRecord7(target) ? [name, target] : void 0;
|
|
120688
120885
|
}
|
|
120689
120886
|
function convertPathItem(value2, context) {
|
|
120690
|
-
if (!
|
|
120887
|
+
if (!isRecord7(value2)) {
|
|
120691
120888
|
return deepClone(value2);
|
|
120692
120889
|
}
|
|
120693
120890
|
const resolved = resolvePathItemRef(value2, context);
|
|
@@ -120787,7 +120984,7 @@ function convertExample(value2) {
|
|
|
120787
120984
|
});
|
|
120788
120985
|
}
|
|
120789
120986
|
function isQuerystringParameter(value2) {
|
|
120790
|
-
return
|
|
120987
|
+
return isRecord7(value2) && value2.in === "querystring";
|
|
120791
120988
|
}
|
|
120792
120989
|
function isRemovedRef(value2, removed) {
|
|
120793
120990
|
const ref = getRef(value2);
|
|
@@ -120803,7 +121000,7 @@ function convertParameterOrHeader2(value2, context) {
|
|
|
120803
121000
|
style: (item) => item === "cookie" ? DROP : deepClone(item)
|
|
120804
121001
|
},
|
|
120805
121002
|
(out, parameter) => {
|
|
120806
|
-
const lostContent =
|
|
121003
|
+
const lostContent = isRecord7(parameter.content) && Object.keys(parameter.content).length > 0 && isRecord7(out.content) && Object.keys(out.content).length === 0;
|
|
120807
121004
|
return lostContent ? DROP : out;
|
|
120808
121005
|
}
|
|
120809
121006
|
);
|
|
@@ -120924,7 +121121,7 @@ function convertComponents2(value2, context) {
|
|
|
120924
121121
|
});
|
|
120925
121122
|
}
|
|
120926
121123
|
function losesEntireContent(value2, mediaTypes) {
|
|
120927
|
-
if (!(
|
|
121124
|
+
if (!(isRecord7(value2) && isRecord7(value2.content))) {
|
|
120928
121125
|
return false;
|
|
120929
121126
|
}
|
|
120930
121127
|
const entries = Object.values(value2.content);
|
|
@@ -120932,7 +121129,7 @@ function losesEntireContent(value2, mediaTypes) {
|
|
|
120932
121129
|
}
|
|
120933
121130
|
function indexRemovedComponentRefs(map2, prefix, mediaTypes, isDirectlyRemoved) {
|
|
120934
121131
|
const removed = /* @__PURE__ */ new Set();
|
|
120935
|
-
if (!
|
|
121132
|
+
if (!isRecord7(map2)) {
|
|
120936
121133
|
return removed;
|
|
120937
121134
|
}
|
|
120938
121135
|
const entries = Object.entries(map2);
|
|
@@ -120954,12 +121151,12 @@ function indexRemovedComponentRefs(map2, prefix, mediaTypes, isDirectlyRemoved)
|
|
|
120954
121151
|
return removed;
|
|
120955
121152
|
}
|
|
120956
121153
|
function createContext2(spec) {
|
|
120957
|
-
const components =
|
|
120958
|
-
const mediaTypes =
|
|
121154
|
+
const components = isRecord7(spec) ? spec.components : void 0;
|
|
121155
|
+
const mediaTypes = isRecord7(components) && isRecord7(components.mediaTypes) ? components.mediaTypes : void 0;
|
|
120959
121156
|
return {
|
|
120960
121157
|
mediaTypes,
|
|
120961
|
-
removedHeaderRefs: indexRemovedComponentRefs(
|
|
120962
|
-
removedParameterRefs: indexRemovedComponentRefs(
|
|
121158
|
+
removedHeaderRefs: indexRemovedComponentRefs(isRecord7(components) ? components.headers : void 0, HEADERS_REF_PREFIX, mediaTypes, () => false),
|
|
121159
|
+
removedParameterRefs: indexRemovedComponentRefs(isRecord7(components) ? components.parameters : void 0, PARAMETERS_REF_PREFIX, mediaTypes, isQuerystringParameter)
|
|
120963
121160
|
};
|
|
120964
121161
|
}
|
|
120965
121162
|
function convertJsonSchemaDialect(value2) {
|
|
@@ -126728,7 +126925,7 @@ var import_consumers = require("node:stream/consumers");
|
|
|
126728
126925
|
init_route();
|
|
126729
126926
|
|
|
126730
126927
|
// src/frontdoor/lineage.ts
|
|
126731
|
-
var
|
|
126928
|
+
var import_node_crypto19 = require("node:crypto");
|
|
126732
126929
|
var CACHE_MARKER_KEY = '"cache_control"';
|
|
126733
126930
|
var THREAD_MEMBER_KEYS = /* @__PURE__ */ new Set(['"model"', '"system"', '"tools"']);
|
|
126734
126931
|
var MESSAGES_KEY = '"messages"';
|
|
@@ -126805,8 +127002,8 @@ function nextToken(body, from) {
|
|
|
126805
127002
|
return SCALAR;
|
|
126806
127003
|
}
|
|
126807
127004
|
function walk(body, hashing, parentAfter) {
|
|
126808
|
-
const thread = (0,
|
|
126809
|
-
const messages = (0,
|
|
127005
|
+
const thread = (0, import_node_crypto19.createHash)("sha256");
|
|
127006
|
+
const messages = (0, import_node_crypto19.createHash)("sha256");
|
|
126810
127007
|
let parentDigest;
|
|
126811
127008
|
let elements = 0;
|
|
126812
127009
|
let depth = 0;
|
|
@@ -126927,7 +127124,7 @@ function lineageOf(body) {
|
|
|
126927
127124
|
}
|
|
126928
127125
|
const parentAfter = counted.elements > MESSAGES_PER_TURN ? counted.elements - MESSAGES_PER_TURN : void 0;
|
|
126929
127126
|
const hashed = walk(body, true, parentAfter);
|
|
126930
|
-
const combine = (messagesDigest) => (0,
|
|
127127
|
+
const combine = (messagesDigest) => (0, import_node_crypto19.createHash)("sha256").update(hashed.threadDigest).update(messagesDigest).digest("hex");
|
|
126931
127128
|
return { ownKey: combine(hashed.messagesDigest), parentKey: hashed.parentDigest === void 0 ? void 0 : combine(hashed.parentDigest) };
|
|
126932
127129
|
}
|
|
126933
127130
|
|
|
@@ -127312,7 +127509,7 @@ init_load();
|
|
|
127312
127509
|
init_schema();
|
|
127313
127510
|
|
|
127314
127511
|
// src/codex/translate.ts
|
|
127315
|
-
var
|
|
127512
|
+
var import_node_crypto20 = require("node:crypto");
|
|
127316
127513
|
init_schema();
|
|
127317
127514
|
|
|
127318
127515
|
// src/codex/anthropic.ts
|
|
@@ -127427,7 +127624,7 @@ function shortToolName(name, names) {
|
|
|
127427
127624
|
if (name.length <= CODEX_TOOL_NAME_LIMIT) {
|
|
127428
127625
|
return name;
|
|
127429
127626
|
}
|
|
127430
|
-
const hash2 = (0,
|
|
127627
|
+
const hash2 = (0, import_node_crypto20.createHash)("sha256").update(name).digest("hex").slice(0, TOOL_NAME_HASH_CHARS);
|
|
127431
127628
|
const shortened = `${name.slice(0, CODEX_TOOL_NAME_LIMIT - TOOL_NAME_HASH_CHARS - 1)}_${hash2}`;
|
|
127432
127629
|
names.set(shortened, name);
|
|
127433
127630
|
return shortened;
|
|
@@ -127552,7 +127749,7 @@ function translateRequest(body, config2) {
|
|
|
127552
127749
|
}
|
|
127553
127750
|
|
|
127554
127751
|
// src/antigravity/translate.ts
|
|
127555
|
-
var
|
|
127752
|
+
var import_node_crypto21 = require("node:crypto");
|
|
127556
127753
|
|
|
127557
127754
|
// src/antigravity/signatures.ts
|
|
127558
127755
|
var MAX_REMEMBERED = 1024;
|
|
@@ -127637,7 +127834,7 @@ function shortToolName2(name, names) {
|
|
|
127637
127834
|
if (sanitized.length <= ANTIGRAVITY_TOOL_NAME_LIMIT) {
|
|
127638
127835
|
result = sanitized;
|
|
127639
127836
|
} else {
|
|
127640
|
-
const hash2 = (0,
|
|
127837
|
+
const hash2 = (0, import_node_crypto21.createHash)("sha256").update(name).digest("hex").slice(0, TOOL_NAME_HASH_CHARS2);
|
|
127641
127838
|
const prefix = sanitized.slice(0, ANTIGRAVITY_TOOL_NAME_LIMIT - TOOL_NAME_HASH_CHARS2 - 1);
|
|
127642
127839
|
result = `${prefix}_${hash2}`;
|
|
127643
127840
|
}
|
|
@@ -127666,7 +127863,7 @@ function turnBlocks2(message) {
|
|
|
127666
127863
|
}
|
|
127667
127864
|
return blocks.map((block2) => isTextBlock(block2) ? { ...block2, text: systemReminder2(block2.text) } : block2);
|
|
127668
127865
|
}
|
|
127669
|
-
function
|
|
127866
|
+
function isRecord8(value2) {
|
|
127670
127867
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
127671
127868
|
}
|
|
127672
127869
|
function messagesToGeminiContents(messages, names, toolIdToName) {
|
|
@@ -127712,7 +127909,7 @@ function messagesToGeminiContents(messages, names, toolIdToName) {
|
|
|
127712
127909
|
ensureRole("model").push({
|
|
127713
127910
|
functionCall: {
|
|
127714
127911
|
name: sanitizedName,
|
|
127715
|
-
args:
|
|
127912
|
+
args: isRecord8(block2.input) ? block2.input : {}
|
|
127716
127913
|
},
|
|
127717
127914
|
// The relay remembered the signature the backend attached to this exact call; echoing it back is what the backend requires of a repeated function call.
|
|
127718
127915
|
...signature === void 0 ? {} : { thoughtSignature: signature }
|
|
@@ -127734,7 +127931,7 @@ function messagesToGeminiContents(messages, names, toolIdToName) {
|
|
|
127734
127931
|
var EMPTY_SCHEMA = { type: "object", properties: {} };
|
|
127735
127932
|
var GEMINI_SCHEMA_KEYS = /* @__PURE__ */ new Set(["type", "format", "description", "nullable", "enum", "anyOf", "items", "properties", "required", "minimum", "maximum", "minItems", "maxItems"]);
|
|
127736
127933
|
function describeSchemaValue(node2) {
|
|
127737
|
-
if (!
|
|
127934
|
+
if (!isRecord8(node2)) {
|
|
127738
127935
|
return "any value";
|
|
127739
127936
|
}
|
|
127740
127937
|
const type2 = node2.type;
|
|
@@ -127745,7 +127942,7 @@ function describeSchemaValue(node2) {
|
|
|
127745
127942
|
return name === "object" ? "an object" : `a ${name}`;
|
|
127746
127943
|
}
|
|
127747
127944
|
function toGeminiSchema(node2) {
|
|
127748
|
-
if (!
|
|
127945
|
+
if (!isRecord8(node2)) {
|
|
127749
127946
|
return node2;
|
|
127750
127947
|
}
|
|
127751
127948
|
const out = {};
|
|
@@ -127763,7 +127960,7 @@ function toGeminiSchema(node2) {
|
|
|
127763
127960
|
if (!GEMINI_SCHEMA_KEYS.has(key)) {
|
|
127764
127961
|
if (key === "additionalProperties" && value2 !== false) {
|
|
127765
127962
|
notes.push(`Each value is ${describeSchemaValue(value2)}.`);
|
|
127766
|
-
} else if (key === "propertyNames" &&
|
|
127963
|
+
} else if (key === "propertyNames" && isRecord8(value2) && typeof value2.pattern === "string") {
|
|
127767
127964
|
notes.push(`Keys match ${value2.pattern}.`);
|
|
127768
127965
|
}
|
|
127769
127966
|
continue;
|
|
@@ -127780,7 +127977,7 @@ function toGeminiSchema(node2) {
|
|
|
127780
127977
|
const description = typeof out.description === "string" ? out.description : "";
|
|
127781
127978
|
out.description = `${description}${description === "" ? "" : " "}${notes.join(" ")}`;
|
|
127782
127979
|
}
|
|
127783
|
-
if ("properties" in out &&
|
|
127980
|
+
if ("properties" in out && isRecord8(out.properties)) {
|
|
127784
127981
|
out.properties = Object.fromEntries(Object.entries(out.properties).map(([name, child]) => [name, toGeminiSchema(child)]));
|
|
127785
127982
|
}
|
|
127786
127983
|
if ("items" in out) {
|
|
@@ -127802,7 +127999,7 @@ function mapTools2(tools, names) {
|
|
|
127802
127999
|
return {
|
|
127803
128000
|
name: shortToolName2(tool.name, names),
|
|
127804
128001
|
description: tool.description,
|
|
127805
|
-
parameters:
|
|
128002
|
+
parameters: isRecord8(converted) ? converted : EMPTY_SCHEMA
|
|
127806
128003
|
};
|
|
127807
128004
|
});
|
|
127808
128005
|
return [{ functionDeclarations: declarations }];
|
|
@@ -127853,120 +128050,8 @@ function translateRequest2(request7, config2) {
|
|
|
127853
128050
|
};
|
|
127854
128051
|
}
|
|
127855
128052
|
|
|
127856
|
-
// src/antigravity/cloudUpstream.ts
|
|
127857
|
-
var import_node_crypto21 = require("node:crypto");
|
|
127858
|
-
var CCPA_ENDPOINT = "https://daily-cloudcode-pa.googleapis.com";
|
|
127859
|
-
var CCPA_DEFAULT_PROJECT_ID = "aicode-consumers";
|
|
127860
|
-
var CCPA_USER_AGENT = "antigravity/cli/1.3.5 (aidev_client; os_type=darwin; arch=arm64; cl=998863838; auth_method=consumer)";
|
|
127861
|
-
function isCcpaEndpoint(endpoint) {
|
|
127862
|
-
return endpoint.includes("cloudcode-pa.googleapis.com");
|
|
127863
|
-
}
|
|
127864
|
-
function buildCloudUrl(config2, model) {
|
|
127865
|
-
const { cloud } = config2;
|
|
127866
|
-
if (cloud.projectId !== void 0 && cloud.location !== void 0) {
|
|
127867
|
-
const base2 = cloud.endpoint ?? `https://${cloud.location}-aiplatform.googleapis.com`;
|
|
127868
|
-
return `${base2}/v1/projects/${cloud.projectId}/locations/${cloud.location}/publishers/google/models/${encodeURIComponent(model)}:streamGenerateContent?alt=sse`;
|
|
127869
|
-
}
|
|
127870
|
-
const base = cloud.endpoint ?? CCPA_ENDPOINT;
|
|
127871
|
-
if (isCcpaEndpoint(base)) {
|
|
127872
|
-
return `${base}/v1internal:streamGenerateContent?alt=sse`;
|
|
127873
|
-
}
|
|
127874
|
-
return `${base}/v1beta/models/${encodeURIComponent(model)}:streamGenerateContent?alt=sse`;
|
|
127875
|
-
}
|
|
127876
|
-
function buildCloudHeaders(token, credentialTarget, endpoint) {
|
|
127877
|
-
const headers = {
|
|
127878
|
-
"Content-Type": "application/json",
|
|
127879
|
-
Accept: "text/event-stream"
|
|
127880
|
-
};
|
|
127881
|
-
const target = credentialTarget ?? "bearer";
|
|
127882
|
-
if (target === "apiKey") {
|
|
127883
|
-
headers["x-goog-api-key"] = token;
|
|
127884
|
-
} else {
|
|
127885
|
-
headers.Authorization = `Bearer ${token}`;
|
|
127886
|
-
}
|
|
127887
|
-
const base = endpoint ?? CCPA_ENDPOINT;
|
|
127888
|
-
if (isCcpaEndpoint(base)) {
|
|
127889
|
-
headers["User-Agent"] = CCPA_USER_AGENT;
|
|
127890
|
-
}
|
|
127891
|
-
return headers;
|
|
127892
|
-
}
|
|
127893
|
-
function buildCloudRequestBody(params) {
|
|
127894
|
-
const base = params.config.cloud.endpoint ?? CCPA_ENDPOINT;
|
|
127895
|
-
if (isCcpaEndpoint(base)) {
|
|
127896
|
-
return JSON.stringify({
|
|
127897
|
-
project: params.config.cloud.projectId ?? CCPA_DEFAULT_PROJECT_ID,
|
|
127898
|
-
requestId: `agent/${(0, import_node_crypto21.randomUUID)()}/${String(Date.now())}/1`,
|
|
127899
|
-
request: params.request,
|
|
127900
|
-
model: params.model,
|
|
127901
|
-
userAgent: "antigravity"
|
|
127902
|
-
});
|
|
127903
|
-
}
|
|
127904
|
-
return JSON.stringify(params.request);
|
|
127905
|
-
}
|
|
127906
|
-
function isRecord8(value2) {
|
|
127907
|
-
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
127908
|
-
}
|
|
127909
|
-
function isGeminiChunk(value2) {
|
|
127910
|
-
return isRecord8(value2);
|
|
127911
|
-
}
|
|
127912
|
-
var AntigravityUpstreamError = class extends Error {
|
|
127913
|
-
status;
|
|
127914
|
-
retryAfter;
|
|
127915
|
-
constructor(status, message, retryAfter) {
|
|
127916
|
-
super(`Google Antigravity API error (${String(status)}): ${message}`);
|
|
127917
|
-
this.name = "AntigravityUpstreamError";
|
|
127918
|
-
this.status = status;
|
|
127919
|
-
this.retryAfter = retryAfter;
|
|
127920
|
-
}
|
|
127921
|
-
};
|
|
127922
|
-
async function* callCloudAntigravity(params, fetchFn = fetch) {
|
|
127923
|
-
const url2 = buildCloudUrl(params.config, params.model);
|
|
127924
|
-
const headers = buildCloudHeaders(params.token, params.credentialTarget, params.config.cloud.endpoint);
|
|
127925
|
-
const body = buildCloudRequestBody(params);
|
|
127926
|
-
const response = await fetchFn(url2, {
|
|
127927
|
-
method: "POST",
|
|
127928
|
-
headers,
|
|
127929
|
-
body,
|
|
127930
|
-
signal: params.signal
|
|
127931
|
-
});
|
|
127932
|
-
if (!response.ok) {
|
|
127933
|
-
const errorText = await response.text();
|
|
127934
|
-
const retryAfter = response.headers.get("retry-after");
|
|
127935
|
-
throw new AntigravityUpstreamError(response.status, errorText, retryAfter);
|
|
127936
|
-
}
|
|
127937
|
-
if (response.body === null) {
|
|
127938
|
-
return;
|
|
127939
|
-
}
|
|
127940
|
-
const decoder = new TextDecoder("utf-8");
|
|
127941
|
-
let buffer2 = "";
|
|
127942
|
-
const sseDataPrefix = "data:";
|
|
127943
|
-
for await (const rawChunk of response.body) {
|
|
127944
|
-
const chunk = rawChunk instanceof Uint8Array ? rawChunk : Buffer.from(String(rawChunk));
|
|
127945
|
-
buffer2 += decoder.decode(chunk, { stream: true });
|
|
127946
|
-
const lines = buffer2.split("\n");
|
|
127947
|
-
buffer2 = lines.pop() ?? "";
|
|
127948
|
-
for (const line of lines) {
|
|
127949
|
-
const trimmed = line.trim();
|
|
127950
|
-
if (trimmed.startsWith(sseDataPrefix)) {
|
|
127951
|
-
const jsonStr = trimmed.slice(sseDataPrefix.length).trim();
|
|
127952
|
-
if (jsonStr.length > 0) {
|
|
127953
|
-
try {
|
|
127954
|
-
const parsed = JSON.parse(jsonStr);
|
|
127955
|
-
if (isRecord8(parsed)) {
|
|
127956
|
-
const unwrapped = isRecord8(parsed.response) ? parsed.response : parsed;
|
|
127957
|
-
if (isGeminiChunk(unwrapped)) {
|
|
127958
|
-
yield unwrapped;
|
|
127959
|
-
}
|
|
127960
|
-
}
|
|
127961
|
-
} catch {
|
|
127962
|
-
}
|
|
127963
|
-
}
|
|
127964
|
-
}
|
|
127965
|
-
}
|
|
127966
|
-
}
|
|
127967
|
-
}
|
|
127968
|
-
|
|
127969
128053
|
// src/antigravity/quota.ts
|
|
128054
|
+
init_cloudUpstream();
|
|
127970
128055
|
var MS_PER_SECOND8 = 1e3;
|
|
127971
128056
|
var DEFAULT_RETRY_AFTER_SECONDS = 60;
|
|
127972
128057
|
var PERCENT_MULTIPLIER = 100;
|
|
@@ -128919,6 +129004,9 @@ function createAntigravityRelay(params) {
|
|
|
128919
129004
|
return { pushChunk, finish };
|
|
128920
129005
|
}
|
|
128921
129006
|
|
|
129007
|
+
// src/antigravity/route.ts
|
|
129008
|
+
init_cloudUpstream();
|
|
129009
|
+
|
|
128922
129010
|
// src/antigravity/localUpstream.ts
|
|
128923
129011
|
var import_node_child_process6 = require("node:child_process");
|
|
128924
129012
|
var import_node_net2 = __toESM(require("node:net"), 1);
|
|
@@ -132649,8 +132737,8 @@ init_realPorts();
|
|
|
132649
132737
|
init_quotaRefresh();
|
|
132650
132738
|
|
|
132651
132739
|
// src/usage/quotaHttp.ts
|
|
132652
|
-
var realQuotaHttpGet = async (url2, headers, signal) => {
|
|
132653
|
-
const response = await fetch(url2, { method: "GET", headers: { ...headers }, signal });
|
|
132740
|
+
var realQuotaHttpGet = async (url2, headers, signal, options) => {
|
|
132741
|
+
const response = await fetch(url2, { method: options?.method ?? "GET", headers: { ...headers }, ...options?.body === void 0 ? {} : { body: options.body }, signal });
|
|
132654
132742
|
return { status: response.status, text: await response.text() };
|
|
132655
132743
|
};
|
|
132656
132744
|
|
package/dist/index.cjs
CHANGED
|
@@ -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.11.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>",
|
|
@@ -4670,7 +4670,7 @@ var init_identity = __esm({
|
|
|
4670
4670
|
});
|
|
4671
4671
|
|
|
4672
4672
|
// src/usage/schema.ts
|
|
4673
|
-
var import_zod10, USAGE_SCHEMA_VERSION, VersionSchema, InstantSchema, TokenCountSchema, TokenUsageSchema, LIMIT_KINDS, LimitClassificationSchema, UsageRecordSchema, QuotaWindowSchema, ExtraUsageSpendSchema, UnifiedRateLimitSchema, RateLimitStateSchema, LimitEventSchema, ProviderQuotaWindowSchema, ProviderQuotaSchema, ProviderUsageStateSchema, AccountMetadataSchema, UsageSnapshotSchema;
|
|
4673
|
+
var import_zod10, USAGE_SCHEMA_VERSION, VersionSchema, InstantSchema, TokenCountSchema, TokenUsageSchema, LIMIT_KINDS, LimitClassificationSchema, UsageRecordSchema, QuotaWindowSchema, ExtraUsageSpendSchema, UnifiedRateLimitSchema, RateLimitStateSchema, LimitEventSchema, ProviderQuotaWindowSchema, ProviderAccountSchema, ProviderQuotaSchema, ProviderUsageStateSchema, AccountMetadataSchema, UsageSnapshotSchema;
|
|
4674
4674
|
var init_schema2 = __esm({
|
|
4675
4675
|
"src/usage/schema.ts"() {
|
|
4676
4676
|
"use strict";
|
|
@@ -4802,12 +4802,18 @@ var init_schema2 = __esm({
|
|
|
4802
4802
|
used: import_zod10.z.number().nonnegative().optional(),
|
|
4803
4803
|
remaining: import_zod10.z.number().nonnegative().optional()
|
|
4804
4804
|
});
|
|
4805
|
+
ProviderAccountSchema = import_zod10.z.strictObject({
|
|
4806
|
+
email: import_zod10.z.string().optional(),
|
|
4807
|
+
accountId: import_zod10.z.string().optional()
|
|
4808
|
+
});
|
|
4805
4809
|
ProviderQuotaSchema = import_zod10.z.strictObject({
|
|
4806
4810
|
observedAt: InstantSchema,
|
|
4807
4811
|
/** Which usage endpoint produced it (`z.ai`). */
|
|
4808
4812
|
source: import_zod10.z.string(),
|
|
4809
4813
|
/** The subscription level the endpoint reports, when it does. */
|
|
4810
4814
|
level: import_zod10.z.string().optional(),
|
|
4815
|
+
/** The account the provider's credential belongs to, when its endpoint reports it. */
|
|
4816
|
+
account: ProviderAccountSchema.optional(),
|
|
4811
4817
|
windows: import_zod10.z.array(ProviderQuotaWindowSchema)
|
|
4812
4818
|
});
|
|
4813
4819
|
ProviderUsageStateSchema = import_zod10.z.strictObject({
|
|
@@ -8710,12 +8716,20 @@ var init_identityClaude = __esm({
|
|
|
8710
8716
|
}
|
|
8711
8717
|
});
|
|
8712
8718
|
|
|
8719
|
+
// src/antigravity/cloudUpstream.ts
|
|
8720
|
+
var init_cloudUpstream = __esm({
|
|
8721
|
+
"src/antigravity/cloudUpstream.ts"() {
|
|
8722
|
+
"use strict";
|
|
8723
|
+
}
|
|
8724
|
+
});
|
|
8725
|
+
|
|
8713
8726
|
// src/usage/providerQuota.ts
|
|
8714
|
-
var import_zod29, MS_PER_SECOND7, SECONDS_PER_HOUR, HOURS_PER_DAY4, 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;
|
|
8727
|
+
var import_zod29, MS_PER_SECOND7, SECONDS_PER_HOUR, HOURS_PER_DAY4, 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, FIVE_HOURS2, DAYS_PER_WEEK, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema;
|
|
8715
8728
|
var init_providerQuota = __esm({
|
|
8716
8729
|
"src/usage/providerQuota.ts"() {
|
|
8717
8730
|
"use strict";
|
|
8718
8731
|
import_zod29 = require("zod");
|
|
8732
|
+
init_cloudUpstream();
|
|
8719
8733
|
init_schema2();
|
|
8720
8734
|
MS_PER_SECOND7 = 1e3;
|
|
8721
8735
|
SECONDS_PER_HOUR = 3600;
|
|
@@ -8758,6 +8772,22 @@ var init_providerQuota = __esm({
|
|
|
8758
8772
|
})
|
|
8759
8773
|
});
|
|
8760
8774
|
OpenRouterCreditsSchema = import_zod29.z.object({ data: import_zod29.z.object({ total_credits: import_zod29.z.number().nonnegative(), total_usage: import_zod29.z.number().nonnegative() }) });
|
|
8775
|
+
ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
|
|
8776
|
+
ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
|
|
8777
|
+
FIVE_HOURS2 = 5;
|
|
8778
|
+
DAYS_PER_WEEK = 7;
|
|
8779
|
+
FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR * MS_PER_SECOND7;
|
|
8780
|
+
WEEK_MS = DAYS_PER_WEEK * HOURS_PER_DAY4 * SECONDS_PER_HOUR * MS_PER_SECOND7;
|
|
8781
|
+
AntigravityBucketSchema = import_zod29.z.object({
|
|
8782
|
+
bucketId: import_zod29.z.string(),
|
|
8783
|
+
remainingFraction: import_zod29.z.number().optional(),
|
|
8784
|
+
resetTime: import_zod29.z.string().optional()
|
|
8785
|
+
});
|
|
8786
|
+
AntigravitySummarySchema = import_zod29.z.object({ groups: import_zod29.z.array(import_zod29.z.object({ buckets: import_zod29.z.array(AntigravityBucketSchema) })) });
|
|
8787
|
+
GoogleTokenInfoSchema = import_zod29.z.object({
|
|
8788
|
+
email: import_zod29.z.string().optional(),
|
|
8789
|
+
sub: import_zod29.z.string().optional()
|
|
8790
|
+
});
|
|
8761
8791
|
}
|
|
8762
8792
|
});
|
|
8763
8793
|
|
package/dist/index.mjs
CHANGED
|
@@ -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.11.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>",
|
|
@@ -4645,7 +4645,7 @@ var init_identity = __esm({
|
|
|
4645
4645
|
|
|
4646
4646
|
// src/usage/schema.ts
|
|
4647
4647
|
import { z as z10 } from "zod";
|
|
4648
|
-
var USAGE_SCHEMA_VERSION, VersionSchema, InstantSchema, TokenCountSchema, TokenUsageSchema, LIMIT_KINDS, LimitClassificationSchema, UsageRecordSchema, QuotaWindowSchema, ExtraUsageSpendSchema, UnifiedRateLimitSchema, RateLimitStateSchema, LimitEventSchema, ProviderQuotaWindowSchema, ProviderQuotaSchema, ProviderUsageStateSchema, AccountMetadataSchema, UsageSnapshotSchema;
|
|
4648
|
+
var USAGE_SCHEMA_VERSION, VersionSchema, InstantSchema, TokenCountSchema, TokenUsageSchema, LIMIT_KINDS, LimitClassificationSchema, UsageRecordSchema, QuotaWindowSchema, ExtraUsageSpendSchema, UnifiedRateLimitSchema, RateLimitStateSchema, LimitEventSchema, ProviderQuotaWindowSchema, ProviderAccountSchema, ProviderQuotaSchema, ProviderUsageStateSchema, AccountMetadataSchema, UsageSnapshotSchema;
|
|
4649
4649
|
var init_schema2 = __esm({
|
|
4650
4650
|
"src/usage/schema.ts"() {
|
|
4651
4651
|
"use strict";
|
|
@@ -4776,12 +4776,18 @@ var init_schema2 = __esm({
|
|
|
4776
4776
|
used: z10.number().nonnegative().optional(),
|
|
4777
4777
|
remaining: z10.number().nonnegative().optional()
|
|
4778
4778
|
});
|
|
4779
|
+
ProviderAccountSchema = z10.strictObject({
|
|
4780
|
+
email: z10.string().optional(),
|
|
4781
|
+
accountId: z10.string().optional()
|
|
4782
|
+
});
|
|
4779
4783
|
ProviderQuotaSchema = z10.strictObject({
|
|
4780
4784
|
observedAt: InstantSchema,
|
|
4781
4785
|
/** Which usage endpoint produced it (`z.ai`). */
|
|
4782
4786
|
source: z10.string(),
|
|
4783
4787
|
/** The subscription level the endpoint reports, when it does. */
|
|
4784
4788
|
level: z10.string().optional(),
|
|
4789
|
+
/** The account the provider's credential belongs to, when its endpoint reports it. */
|
|
4790
|
+
account: ProviderAccountSchema.optional(),
|
|
4785
4791
|
windows: z10.array(ProviderQuotaWindowSchema)
|
|
4786
4792
|
});
|
|
4787
4793
|
ProviderUsageStateSchema = z10.strictObject({
|
|
@@ -8681,12 +8687,20 @@ var init_identityClaude = __esm({
|
|
|
8681
8687
|
}
|
|
8682
8688
|
});
|
|
8683
8689
|
|
|
8690
|
+
// src/antigravity/cloudUpstream.ts
|
|
8691
|
+
var init_cloudUpstream = __esm({
|
|
8692
|
+
"src/antigravity/cloudUpstream.ts"() {
|
|
8693
|
+
"use strict";
|
|
8694
|
+
}
|
|
8695
|
+
});
|
|
8696
|
+
|
|
8684
8697
|
// src/usage/providerQuota.ts
|
|
8685
8698
|
import { z as z29 } from "zod";
|
|
8686
|
-
var MS_PER_SECOND7, SECONDS_PER_HOUR, HOURS_PER_DAY4, 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;
|
|
8699
|
+
var MS_PER_SECOND7, SECONDS_PER_HOUR, HOURS_PER_DAY4, 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, FIVE_HOURS2, DAYS_PER_WEEK, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema;
|
|
8687
8700
|
var init_providerQuota = __esm({
|
|
8688
8701
|
"src/usage/providerQuota.ts"() {
|
|
8689
8702
|
"use strict";
|
|
8703
|
+
init_cloudUpstream();
|
|
8690
8704
|
init_schema2();
|
|
8691
8705
|
MS_PER_SECOND7 = 1e3;
|
|
8692
8706
|
SECONDS_PER_HOUR = 3600;
|
|
@@ -8729,6 +8743,22 @@ var init_providerQuota = __esm({
|
|
|
8729
8743
|
})
|
|
8730
8744
|
});
|
|
8731
8745
|
OpenRouterCreditsSchema = z29.object({ data: z29.object({ total_credits: z29.number().nonnegative(), total_usage: z29.number().nonnegative() }) });
|
|
8746
|
+
ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
|
|
8747
|
+
ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
|
|
8748
|
+
FIVE_HOURS2 = 5;
|
|
8749
|
+
DAYS_PER_WEEK = 7;
|
|
8750
|
+
FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR * MS_PER_SECOND7;
|
|
8751
|
+
WEEK_MS = DAYS_PER_WEEK * HOURS_PER_DAY4 * SECONDS_PER_HOUR * MS_PER_SECOND7;
|
|
8752
|
+
AntigravityBucketSchema = z29.object({
|
|
8753
|
+
bucketId: z29.string(),
|
|
8754
|
+
remainingFraction: z29.number().optional(),
|
|
8755
|
+
resetTime: z29.string().optional()
|
|
8756
|
+
});
|
|
8757
|
+
AntigravitySummarySchema = z29.object({ groups: z29.array(z29.object({ buckets: z29.array(AntigravityBucketSchema) })) });
|
|
8758
|
+
GoogleTokenInfoSchema = z29.object({
|
|
8759
|
+
email: z29.string().optional(),
|
|
8760
|
+
sub: z29.string().optional()
|
|
8761
|
+
});
|
|
8732
8762
|
}
|
|
8733
8763
|
});
|
|
8734
8764
|
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5478,6 +5478,10 @@ declare const UsageSnapshotSchema: z.ZodObject<{
|
|
|
5478
5478
|
observedAt: z.ZodISODateTime;
|
|
5479
5479
|
source: z.ZodString;
|
|
5480
5480
|
level: z.ZodOptional<z.ZodString>;
|
|
5481
|
+
account: z.ZodOptional<z.ZodObject<{
|
|
5482
|
+
email: z.ZodOptional<z.ZodString>;
|
|
5483
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
5484
|
+
}, z.core.$strict>>;
|
|
5481
5485
|
windows: z.ZodArray<z.ZodObject<{
|
|
5482
5486
|
measures: z.ZodString;
|
|
5483
5487
|
periodMs: z.ZodOptional<z.ZodNumber>;
|
|
@@ -7772,6 +7776,10 @@ declare function createControlApiRouter(deps: ControlApiDeps): {
|
|
|
7772
7776
|
observedAt: zod.ZodISODateTime;
|
|
7773
7777
|
source: zod.ZodString;
|
|
7774
7778
|
level: zod.ZodOptional<zod.ZodString>;
|
|
7779
|
+
account: zod.ZodOptional<zod.ZodObject<{
|
|
7780
|
+
email: zod.ZodOptional<zod.ZodString>;
|
|
7781
|
+
accountId: zod.ZodOptional<zod.ZodString>;
|
|
7782
|
+
}, zod_v4_core.$strict>>;
|
|
7775
7783
|
windows: zod.ZodArray<zod.ZodObject<{
|
|
7776
7784
|
measures: zod.ZodString;
|
|
7777
7785
|
periodMs: zod.ZodOptional<zod.ZodNumber>;
|
|
@@ -9904,6 +9912,10 @@ declare function createDoorApiRouter(deps: DoorApiDeps): {
|
|
|
9904
9912
|
observedAt: zod.ZodISODateTime;
|
|
9905
9913
|
source: zod.ZodString;
|
|
9906
9914
|
level: zod.ZodOptional<zod.ZodString>;
|
|
9915
|
+
account: zod.ZodOptional<zod.ZodObject<{
|
|
9916
|
+
email: zod.ZodOptional<zod.ZodString>;
|
|
9917
|
+
accountId: zod.ZodOptional<zod.ZodString>;
|
|
9918
|
+
}, zod_v4_core.$strict>>;
|
|
9907
9919
|
windows: zod.ZodArray<zod.ZodObject<{
|
|
9908
9920
|
measures: zod.ZodString;
|
|
9909
9921
|
periodMs: zod.ZodOptional<zod.ZodNumber>;
|
|
@@ -12013,6 +12025,10 @@ declare const UsageListOutputSchema: z.ZodObject<{
|
|
|
12013
12025
|
observedAt: z.ZodISODateTime;
|
|
12014
12026
|
source: z.ZodString;
|
|
12015
12027
|
level: z.ZodOptional<z.ZodString>;
|
|
12028
|
+
account: z.ZodOptional<z.ZodObject<{
|
|
12029
|
+
email: z.ZodOptional<z.ZodString>;
|
|
12030
|
+
accountId: z.ZodOptional<z.ZodString>;
|
|
12031
|
+
}, z.core.$strict>>;
|
|
12016
12032
|
windows: z.ZodArray<z.ZodObject<{
|
|
12017
12033
|
measures: z.ZodString;
|
|
12018
12034
|
periodMs: z.ZodOptional<z.ZodNumber>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-use",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.11.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>",
|