claude-use 11.27.0 → 11.28.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 +2 -0
- package/dist/cli.cjs +160 -48
- package/dist/index.cjs +125 -22
- package/dist/index.mjs +125 -22
- package/dist/types/index.d.ts +74 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -98,6 +98,7 @@ agent-shim profile set <name> [--category <category>=<bool>]... [--entry <catego
|
|
|
98
98
|
agent-shim profile set <name> [--extends <profile>]... [--no-extends] [--description <text> | --no-description] [--json]
|
|
99
99
|
agent-shim profile set <name> [--[no-]launch-skip-permissions] [--[no-]launch-remote-control] [--[no-]launch-headroom] [--[no-]launch-track-usage]
|
|
100
100
|
agent-shim profile set <name> [--launch-claude-version <version> | --no-launch-claude-version] [--json] [--json]
|
|
101
|
+
agent-shim profile set <name> [--launch-delay <duration> | --no-launch-delay] [--[no-]launch-pause] [--json]
|
|
101
102
|
agent-shim profile set <name> [--launch-provider <provider> | --no-launch-provider] [--json]
|
|
102
103
|
agent-shim profile list [--json]
|
|
103
104
|
agent-shim profile show <name> [--json]
|
|
@@ -181,6 +182,7 @@ agent-shim run [@<identity>] [launch flags] [claude arguments]
|
|
|
181
182
|
# --category <category>=<bool> --share <category>/<path> --hide <category>/<path> (each repeatable)
|
|
182
183
|
# --[no-]skip-permissions --[no-]remote-control --[no-]headroom --[no-]track-usage --[no-]wait
|
|
183
184
|
# --claude-version <version> run exactly this installed Claude Code version
|
|
185
|
+
# --delay <duration> wait this long after the launcher's own output before starting claude; --[no-]pause waits for a key press instead
|
|
184
186
|
# --native run the real claude with nothing from agent-shim applied; cannot be combined with the flags above
|
|
185
187
|
claude @<identity> ... # the same, once `agent-shim shim enable` has run
|
|
186
188
|
```
|
package/dist/cli.cjs
CHANGED
|
@@ -27027,7 +27027,11 @@ var init_schema = __esm({
|
|
|
27027
27027
|
headroom: external_exports.boolean().optional(),
|
|
27028
27028
|
trackUsage: external_exports.boolean().optional(),
|
|
27029
27029
|
/** The exact Claude Code version to run, as it is named in Claude Code's versions directory (`2.1.220`). A pin that is not installed fails the launch; it never falls back to the highest version. */
|
|
27030
|
-
claudeVersion: external_exports.string().regex(NUMERIC_DOTTED_VERSION_RE, "must be an exact dotted-numeric Claude Code version such as 2.1.220").optional()
|
|
27030
|
+
claudeVersion: external_exports.string().regex(NUMERIC_DOTTED_VERSION_RE, "must be an exact dotted-numeric Claude Code version such as 2.1.220").optional(),
|
|
27031
|
+
/** How long the launcher waits after its own output before it starts claude, so that output can be read before Claude Code takes over the terminal (`5s`, `500ms`). Applies only when a terminal is watching. */
|
|
27032
|
+
delay: external_exports.string().regex(DURATION_RE, "must be a duration such as 5s or 500ms").optional(),
|
|
27033
|
+
/** Whether the launcher waits for a key press after its own output before it starts claude. Takes the place of `delay` when both are set. Applies only when a terminal is watching. */
|
|
27034
|
+
pause: external_exports.boolean().optional()
|
|
27031
27035
|
});
|
|
27032
27036
|
CREDENTIAL_TARGETS = ["bearer", "apiKey", "oauthToken"];
|
|
27033
27037
|
PROVIDER_CREDENTIAL_TARGETS = ["bearer", "apiKey"];
|
|
@@ -29010,7 +29014,7 @@ function realResolveClaudeBinary(isOwnBinary) {
|
|
|
29010
29014
|
function realInstalledClaudeVersions() {
|
|
29011
29015
|
return installedVersions(listVersionsDir(defaultVersionsDir()));
|
|
29012
29016
|
}
|
|
29013
|
-
var import_node_child_process2, import_node_crypto4, import_node_fs3, import_node_os2, import_node_path9, import_node_sea, realFsPort, OWNER_ONLY_DIR_MODE, OWNER_ONLY_FILE_MODE, PERMISSION_BITS, realFarmFs, INT32_BYTE_LENGTH, LINE_FEED, UTF8_CONTINUATION_MASK, UTF8_CONTINUATION_BITS, PS_TIMEOUT_MS, realRunPort, MACOS_GUI_SESSION_MANAGER, realCredentialPort, SOCKET_PERMISSION_BITS, realHeadroomSocketTrust, realSpawnPort, realProcPort, realLogPort, EXECUTE_BITS_MASK, WINDOWS_DEFAULT_PATHEXT;
|
|
29017
|
+
var import_node_child_process2, import_node_crypto4, import_node_fs3, import_node_os2, import_node_path9, import_node_sea, realFsPort, OWNER_ONLY_DIR_MODE, OWNER_ONLY_FILE_MODE, PERMISSION_BITS, realFarmFs, INT32_BYTE_LENGTH, KEY_POLL_MS, CTRL_C_BYTE, realHoldPort, LINE_FEED, UTF8_CONTINUATION_MASK, UTF8_CONTINUATION_BITS, PS_TIMEOUT_MS, realRunPort, MACOS_GUI_SESSION_MANAGER, realCredentialPort, SOCKET_PERMISSION_BITS, realHeadroomSocketTrust, realSpawnPort, realProcPort, realLogPort, EXECUTE_BITS_MASK, WINDOWS_DEFAULT_PATHEXT;
|
|
29014
29018
|
var init_realPorts = __esm({
|
|
29015
29019
|
"src/realPorts.ts"() {
|
|
29016
29020
|
"use strict";
|
|
@@ -29159,6 +29163,31 @@ var init_realPorts = __esm({
|
|
|
29159
29163
|
}
|
|
29160
29164
|
};
|
|
29161
29165
|
INT32_BYTE_LENGTH = 4;
|
|
29166
|
+
KEY_POLL_MS = 25;
|
|
29167
|
+
CTRL_C_BYTE = 3;
|
|
29168
|
+
realHoldPort = {
|
|
29169
|
+
attended: () => process.stdin.isTTY && process.stdout.isTTY,
|
|
29170
|
+
sleep: realSleepSync,
|
|
29171
|
+
waitForKey: () => {
|
|
29172
|
+
process.stdin.setRawMode(true);
|
|
29173
|
+
try {
|
|
29174
|
+
const buffer2 = Buffer.alloc(1);
|
|
29175
|
+
for (; ; ) {
|
|
29176
|
+
try {
|
|
29177
|
+
const read = import_node_fs3.default.readSync(process.stdin.fd, buffer2, 0, buffer2.length, null);
|
|
29178
|
+
return read > 0 && buffer2[0] === CTRL_C_BYTE ? "interrupt" : "key";
|
|
29179
|
+
} catch (error63) {
|
|
29180
|
+
if (!(error63 instanceof Error && "code" in error63 && error63.code === "EAGAIN")) {
|
|
29181
|
+
throw error63;
|
|
29182
|
+
}
|
|
29183
|
+
realSleepSync(KEY_POLL_MS);
|
|
29184
|
+
}
|
|
29185
|
+
}
|
|
29186
|
+
} finally {
|
|
29187
|
+
process.stdin.setRawMode(false);
|
|
29188
|
+
}
|
|
29189
|
+
}
|
|
29190
|
+
};
|
|
29162
29191
|
LINE_FEED = 10;
|
|
29163
29192
|
UTF8_CONTINUATION_MASK = 192;
|
|
29164
29193
|
UTF8_CONTINUATION_BITS = 128;
|
|
@@ -32502,6 +32531,12 @@ function flattenLayers(layers, options) {
|
|
|
32502
32531
|
if (layer.launch.claudeVersion !== void 0) {
|
|
32503
32532
|
launch.claudeVersion = layer.launch.claudeVersion;
|
|
32504
32533
|
}
|
|
32534
|
+
if (layer.launch.delay !== void 0) {
|
|
32535
|
+
launch.delay = layer.launch.delay;
|
|
32536
|
+
}
|
|
32537
|
+
if (layer.launch.pause !== void 0) {
|
|
32538
|
+
launch.pause = layer.launch.pause;
|
|
32539
|
+
}
|
|
32505
32540
|
}
|
|
32506
32541
|
if (layer.entries === void 0) {
|
|
32507
32542
|
continue;
|
|
@@ -34245,7 +34280,7 @@ var init_package = __esm({
|
|
|
34245
34280
|
"package.json"() {
|
|
34246
34281
|
package_default = {
|
|
34247
34282
|
name: "claude-use",
|
|
34248
|
-
version: "11.
|
|
34283
|
+
version: "11.28.0",
|
|
34249
34284
|
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.",
|
|
34250
34285
|
license: "MIT",
|
|
34251
34286
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -62938,6 +62973,7 @@ function parseLauncherArgv(argv) {
|
|
|
62938
62973
|
let configProfile;
|
|
62939
62974
|
let provider;
|
|
62940
62975
|
let claudeVersion;
|
|
62976
|
+
let delay;
|
|
62941
62977
|
const booleans = {};
|
|
62942
62978
|
const categoryFlags = [];
|
|
62943
62979
|
const shareFlags = [];
|
|
@@ -62995,6 +63031,9 @@ function parseLauncherArgv(argv) {
|
|
|
62995
63031
|
case "--claude-version":
|
|
62996
63032
|
claudeVersion = value2;
|
|
62997
63033
|
break;
|
|
63034
|
+
case "--delay":
|
|
63035
|
+
delay = value2;
|
|
63036
|
+
break;
|
|
62998
63037
|
case "--category":
|
|
62999
63038
|
categoryFlags.push(value2);
|
|
63000
63039
|
break;
|
|
@@ -63017,6 +63056,7 @@ function parseLauncherArgv(argv) {
|
|
|
63017
63056
|
...configProfile === void 0 ? {} : { configProfile },
|
|
63018
63057
|
...provider === void 0 ? {} : { provider },
|
|
63019
63058
|
...claudeVersion === void 0 ? {} : { claudeVersion },
|
|
63059
|
+
...delay === void 0 ? {} : { delay },
|
|
63020
63060
|
...native ? { native: true } : {},
|
|
63021
63061
|
...booleans,
|
|
63022
63062
|
categoryFlags,
|
|
@@ -63040,13 +63080,14 @@ var init_argv = __esm({
|
|
|
63040
63080
|
positional;
|
|
63041
63081
|
flag;
|
|
63042
63082
|
};
|
|
63043
|
-
VALUED_FLAGS = ["--identity", "--config-profile", "--provider", "--claude-version", "--category", "--share", "--hide"];
|
|
63083
|
+
VALUED_FLAGS = ["--identity", "--config-profile", "--provider", "--claude-version", "--delay", "--category", "--share", "--hide"];
|
|
63044
63084
|
BOOLEAN_FLAGS = [
|
|
63045
63085
|
{ flag: "--headroom", key: "headroom" },
|
|
63046
63086
|
{ flag: "--track-usage", key: "trackUsage" },
|
|
63047
63087
|
{ flag: "--skip-permissions", key: "skipPermissions" },
|
|
63048
63088
|
{ flag: "--remote-control", key: "remoteControl" },
|
|
63049
|
-
{ flag: "--wait", key: "wait" }
|
|
63089
|
+
{ flag: "--wait", key: "wait" },
|
|
63090
|
+
{ flag: "--pause", key: "pause" }
|
|
63050
63091
|
];
|
|
63051
63092
|
LAUNCHER_FLAG_NAMES = [
|
|
63052
63093
|
...VALUED_FLAGS,
|
|
@@ -63233,9 +63274,23 @@ function resolveLaunchFlags(params) {
|
|
|
63233
63274
|
skipPermissions: params.flags?.skipPermissions ?? parseEnvBool("AGENT_SHIM_SKIP_PERMISSIONS", params.env.AGENT_SHIM_SKIP_PERMISSIONS) ?? params.cascade?.skipPermissions ?? false,
|
|
63234
63275
|
remoteControl: params.flags?.remoteControl ?? parseEnvBool("AGENT_SHIM_REMOTE_CONTROL", params.env.AGENT_SHIM_REMOTE_CONTROL) ?? params.cascade?.remoteControl ?? false,
|
|
63235
63276
|
headroom: params.flags?.headroom ?? parseEnvBool("AGENT_SHIM_HEADROOM", params.env.AGENT_SHIM_HEADROOM) ?? params.cascade?.headroom ?? false,
|
|
63236
|
-
trackUsage: params.flags?.trackUsage ?? parseEnvBool("AGENT_SHIM_TRACK_USAGE", params.env.AGENT_SHIM_TRACK_USAGE) ?? params.cascade?.trackUsage ?? true
|
|
63277
|
+
trackUsage: params.flags?.trackUsage ?? parseEnvBool("AGENT_SHIM_TRACK_USAGE", params.env.AGENT_SHIM_TRACK_USAGE) ?? params.cascade?.trackUsage ?? true,
|
|
63278
|
+
pause: params.flags?.pause ?? parseEnvBool("AGENT_SHIM_PAUSE", params.env.AGENT_SHIM_PAUSE) ?? params.cascade?.pause ?? false,
|
|
63279
|
+
delayMs: resolveDelayMs(params)
|
|
63237
63280
|
};
|
|
63238
63281
|
}
|
|
63282
|
+
function resolveDelayMs(params) {
|
|
63283
|
+
const fromEnv = params.env.AGENT_SHIM_DELAY === "" ? void 0 : params.env.AGENT_SHIM_DELAY;
|
|
63284
|
+
const [literal2, source] = params.flags?.delay !== void 0 ? [params.flags.delay, "--delay"] : fromEnv !== void 0 ? [fromEnv, "AGENT_SHIM_DELAY"] : [params.cascade?.delay, "launch.delay"];
|
|
63285
|
+
if (literal2 === void 0) {
|
|
63286
|
+
return 0;
|
|
63287
|
+
}
|
|
63288
|
+
try {
|
|
63289
|
+
return parseDuration(literal2);
|
|
63290
|
+
} catch (error63) {
|
|
63291
|
+
throw new UsageError(`${source}: ${error63 instanceof Error ? error63.message : String(error63)}`);
|
|
63292
|
+
}
|
|
63293
|
+
}
|
|
63239
63294
|
function buildFlagArgs(flags) {
|
|
63240
63295
|
const args = [];
|
|
63241
63296
|
if (flags.skipPermissions) {
|
|
@@ -63308,6 +63363,8 @@ var init_flags = __esm({
|
|
|
63308
63363
|
"use strict";
|
|
63309
63364
|
import_node_path40 = __toESM(require("node:path"), 1);
|
|
63310
63365
|
init_envBool();
|
|
63366
|
+
init_cliError();
|
|
63367
|
+
init_conditions();
|
|
63311
63368
|
init_credential();
|
|
63312
63369
|
init_headers();
|
|
63313
63370
|
init_capability();
|
|
@@ -63562,6 +63619,31 @@ var init_diagnostics = __esm({
|
|
|
63562
63619
|
}
|
|
63563
63620
|
});
|
|
63564
63621
|
|
|
63622
|
+
// src/launcher/hold.ts
|
|
63623
|
+
function describeDelay(ms2) {
|
|
63624
|
+
return ms2 % MS_PER_SECOND6 === 0 ? `${String(ms2 / MS_PER_SECOND6)}s` : `${String(ms2)}ms`;
|
|
63625
|
+
}
|
|
63626
|
+
function holdBeforeLaunch(hold, port, log) {
|
|
63627
|
+
if (port === void 0 || !port.attended() || !hold.pause && hold.delayMs <= 0) {
|
|
63628
|
+
return "go";
|
|
63629
|
+
}
|
|
63630
|
+
if (hold.pause) {
|
|
63631
|
+
log.info("agent-shim: paused before launch; press any key to start, or Ctrl-C to cancel");
|
|
63632
|
+
return port.waitForKey() === "interrupt" ? "cancelled" : "go";
|
|
63633
|
+
}
|
|
63634
|
+
log.info(`agent-shim: starting in ${describeDelay(hold.delayMs)}`);
|
|
63635
|
+
port.sleep(hold.delayMs);
|
|
63636
|
+
return "go";
|
|
63637
|
+
}
|
|
63638
|
+
var LAUNCH_CANCELLED_EXIT, MS_PER_SECOND6;
|
|
63639
|
+
var init_hold = __esm({
|
|
63640
|
+
"src/launcher/hold.ts"() {
|
|
63641
|
+
"use strict";
|
|
63642
|
+
LAUNCH_CANCELLED_EXIT = 130;
|
|
63643
|
+
MS_PER_SECOND6 = 1e3;
|
|
63644
|
+
}
|
|
63645
|
+
});
|
|
63646
|
+
|
|
63565
63647
|
// src/antigravity/cloudUpstream.ts
|
|
63566
63648
|
function isCcpaEndpoint(endpoint) {
|
|
63567
63649
|
return endpoint.includes("cloudcode-pa.googleapis.com");
|
|
@@ -63746,14 +63828,14 @@ function parseRetryAfterSeconds(raw, defaultSeconds = DEFAULT_RETRY_AFTER_SECOND
|
|
|
63746
63828
|
}
|
|
63747
63829
|
const parsedDate = Date.parse(raw);
|
|
63748
63830
|
if (!Number.isNaN(parsedDate)) {
|
|
63749
|
-
const diffSec = Math.ceil((parsedDate - Date.now()) /
|
|
63831
|
+
const diffSec = Math.ceil((parsedDate - Date.now()) / MS_PER_SECOND7);
|
|
63750
63832
|
return Math.max(1, diffSec);
|
|
63751
63833
|
}
|
|
63752
63834
|
return defaultSeconds;
|
|
63753
63835
|
}
|
|
63754
63836
|
function unifiedAntigravityQuotaHeaders(params) {
|
|
63755
63837
|
const rejected = params.rejected === true;
|
|
63756
|
-
const nowSec = Math.floor(params.nowMs /
|
|
63838
|
+
const nowSec = Math.floor(params.nowMs / MS_PER_SECOND7);
|
|
63757
63839
|
const { fiveHour: b5h, weekly: bWk } = selectAntigravityBuckets(params.quota ?? {}, params.model);
|
|
63758
63840
|
const used5h = calculateUtilization(b5h?.remaining_fraction);
|
|
63759
63841
|
const reset5h = calculateResetTimestamp(nowSec, b5h?.reset_in_seconds);
|
|
@@ -63801,7 +63883,7 @@ function unifiedAntigravityQuotaHeaders(params) {
|
|
|
63801
63883
|
}
|
|
63802
63884
|
function antigravityQuotaExhaustion(quota, model, nowMs) {
|
|
63803
63885
|
const { fiveHour, weekly } = selectAntigravityBuckets(quota ?? {}, model);
|
|
63804
|
-
const nowSec = Math.floor(nowMs /
|
|
63886
|
+
const nowSec = Math.floor(nowMs / MS_PER_SECOND7);
|
|
63805
63887
|
const spent = [];
|
|
63806
63888
|
for (const [window, bucket] of [["five_hour", fiveHour], ["seven_day", weekly]]) {
|
|
63807
63889
|
const remaining = bucket?.remaining_fraction;
|
|
@@ -63822,7 +63904,7 @@ function bucketToEntry(bucket, nowMs) {
|
|
|
63822
63904
|
}
|
|
63823
63905
|
const remainingFraction = typeof bucket.remainingFraction === "number" && Number.isFinite(bucket.remainingFraction) ? bucket.remainingFraction : void 0;
|
|
63824
63906
|
const resetMs = typeof bucket.resetTime === "string" ? Date.parse(bucket.resetTime) : Number.NaN;
|
|
63825
|
-
const resetInSeconds = Number.isNaN(resetMs) ? void 0 : Math.max(0, Math.ceil((resetMs - nowMs) /
|
|
63907
|
+
const resetInSeconds = Number.isNaN(resetMs) ? void 0 : Math.max(0, Math.ceil((resetMs - nowMs) / MS_PER_SECOND7));
|
|
63826
63908
|
if (remainingFraction === void 0 && resetInSeconds === void 0) {
|
|
63827
63909
|
return void 0;
|
|
63828
63910
|
}
|
|
@@ -63902,17 +63984,17 @@ function createCachedAntigravityQuotaSource(params) {
|
|
|
63902
63984
|
};
|
|
63903
63985
|
}
|
|
63904
63986
|
function ageQuotaMap(quota, elapsedMs) {
|
|
63905
|
-
const elapsedSec = elapsedMs /
|
|
63987
|
+
const elapsedSec = elapsedMs / MS_PER_SECOND7;
|
|
63906
63988
|
return Object.fromEntries(
|
|
63907
63989
|
Object.entries(quota).map(([key, bucket]) => [key, bucket?.reset_in_seconds === void 0 ? bucket : { ...bucket, reset_in_seconds: Math.max(0, bucket.reset_in_seconds - elapsedSec) }])
|
|
63908
63990
|
);
|
|
63909
63991
|
}
|
|
63910
|
-
var
|
|
63992
|
+
var MS_PER_SECOND7, DEFAULT_RETRY_AFTER_SECONDS, FRACTION_DIGITS, GEMINI_5H_KEYS, GEMINI_WEEKLY_KEYS, ARGON_WEEKLY_KEYS, THIRD_PARTY_5H_KEYS, THIRD_PARTY_WEEKLY_KEYS, QUOTA_FAMILY_WINDOWS, SECONDS_PER_HOUR, HOURS_PER_FIVE_HOUR_WINDOW, DAYS_PER_WEEK, HOURS_PER_DAY3, FIVE_HOUR_PERIOD_SECONDS, WEEK_PERIOD_SECONDS, ANTIGRAVITY_QUOTA_REFRESH_MS;
|
|
63911
63993
|
var init_quota = __esm({
|
|
63912
63994
|
"src/antigravity/quota.ts"() {
|
|
63913
63995
|
"use strict";
|
|
63914
63996
|
init_cloudUpstream();
|
|
63915
|
-
|
|
63997
|
+
MS_PER_SECOND7 = 1e3;
|
|
63916
63998
|
DEFAULT_RETRY_AFTER_SECONDS = 60;
|
|
63917
63999
|
FRACTION_DIGITS = 3;
|
|
63918
64000
|
GEMINI_5H_KEYS = ["gemini-5h", "gemini_5h", "gemini"];
|
|
@@ -64603,7 +64685,7 @@ async function fetchCatalogue(params) {
|
|
|
64603
64685
|
}
|
|
64604
64686
|
throw new CatalogueFetchError(`no catalogue from ${outcomes.join("; ")}`);
|
|
64605
64687
|
}
|
|
64606
|
-
var import_node_path42, import_picomatch3, DEFAULT_CANDIDATE_URLS,
|
|
64688
|
+
var import_node_path42, import_picomatch3, DEFAULT_CANDIDATE_URLS, MS_PER_SECOND8, SECONDS_PER_HOUR2, HOURS_PER_DAY4, MS_PER_HOUR3, HOURS_BETWEEN_RETRIES, HTTP_OK, HTTP_MULTIPLE_CHOICES, CATALOGUE_MAX_AGE_MS, CATALOGUE_RETRY_MS, CATALOGUE_REQUEST_SECONDS, CATALOGUE_REQUEST_TIMEOUT_MS, CATALOGUE_REFRESH_TIMEOUT_MS, CatalogueModelSchema, CatalogueCacheSchema, CatalogueFetchError;
|
|
64607
64689
|
var init_providerCatalogue = __esm({
|
|
64608
64690
|
"src/providerCatalogue.ts"() {
|
|
64609
64691
|
"use strict";
|
|
@@ -64611,17 +64693,17 @@ var init_providerCatalogue = __esm({
|
|
|
64611
64693
|
import_picomatch3 = __toESM(require_picomatch2(), 1);
|
|
64612
64694
|
init_zod();
|
|
64613
64695
|
DEFAULT_CANDIDATE_URLS = 2;
|
|
64614
|
-
|
|
64696
|
+
MS_PER_SECOND8 = 1e3;
|
|
64615
64697
|
SECONDS_PER_HOUR2 = 3600;
|
|
64616
64698
|
HOURS_PER_DAY4 = 24;
|
|
64617
|
-
MS_PER_HOUR3 = SECONDS_PER_HOUR2 *
|
|
64699
|
+
MS_PER_HOUR3 = SECONDS_PER_HOUR2 * MS_PER_SECOND8;
|
|
64618
64700
|
HOURS_BETWEEN_RETRIES = 1;
|
|
64619
64701
|
HTTP_OK = 200;
|
|
64620
64702
|
HTTP_MULTIPLE_CHOICES = 300;
|
|
64621
64703
|
CATALOGUE_MAX_AGE_MS = HOURS_PER_DAY4 * MS_PER_HOUR3;
|
|
64622
64704
|
CATALOGUE_RETRY_MS = HOURS_BETWEEN_RETRIES * MS_PER_HOUR3;
|
|
64623
64705
|
CATALOGUE_REQUEST_SECONDS = 10;
|
|
64624
|
-
CATALOGUE_REQUEST_TIMEOUT_MS = CATALOGUE_REQUEST_SECONDS *
|
|
64706
|
+
CATALOGUE_REQUEST_TIMEOUT_MS = CATALOGUE_REQUEST_SECONDS * MS_PER_SECOND8;
|
|
64625
64707
|
CATALOGUE_REFRESH_TIMEOUT_MS = DEFAULT_CANDIDATE_URLS * CATALOGUE_REQUEST_TIMEOUT_MS;
|
|
64626
64708
|
CatalogueModelSchema = external_exports.strictObject({ id: external_exports.string().min(1), name: external_exports.string().min(1).optional() });
|
|
64627
64709
|
CatalogueCacheSchema = external_exports.strictObject({ fetchedAt: external_exports.number(), url: external_exports.string().min(1), models: external_exports.array(CatalogueModelSchema) });
|
|
@@ -65149,7 +65231,9 @@ function decideLaunch(params, readOnly) {
|
|
|
65149
65231
|
...parsedArgv.skipPermissions === void 0 ? {} : { skipPermissions: parsedArgv.skipPermissions },
|
|
65150
65232
|
...parsedArgv.remoteControl === void 0 ? {} : { remoteControl: parsedArgv.remoteControl },
|
|
65151
65233
|
...parsedArgv.headroom === void 0 ? {} : { headroom: parsedArgv.headroom },
|
|
65152
|
-
...parsedArgv.trackUsage === void 0 ? {} : { trackUsage: parsedArgv.trackUsage }
|
|
65234
|
+
...parsedArgv.trackUsage === void 0 ? {} : { trackUsage: parsedArgv.trackUsage },
|
|
65235
|
+
...parsedArgv.pause === void 0 ? {} : { pause: parsedArgv.pause },
|
|
65236
|
+
...parsedArgv.delay === void 0 ? {} : { delay: parsedArgv.delay }
|
|
65153
65237
|
}
|
|
65154
65238
|
});
|
|
65155
65239
|
const loginlessProvider = requestedFlags.remoteControl && selectedProvider !== void 0 && farmIdentity !== void 0 && params.hasStoredLogin?.(farmIdentity) === false ? { identity: farmIdentity, provider: selectedProvider.name } : void 0;
|
|
@@ -65294,7 +65378,8 @@ function prepareLaunch(params) {
|
|
|
65294
65378
|
registered();
|
|
65295
65379
|
}
|
|
65296
65380
|
};
|
|
65297
|
-
|
|
65381
|
+
const hold = () => holdBeforeLaunch({ delayMs: resolvedFlags.delayMs, pause: resolvedFlags.pause }, params.hold, log);
|
|
65382
|
+
return { bin: decided.bin, args: finalArgv, env: finalEnv, sessionId, release, markChildStarted: updateCheck.markChildStarted, hold, decision };
|
|
65298
65383
|
}
|
|
65299
65384
|
function resolveLaunch(params) {
|
|
65300
65385
|
const decided = decideLaunch(params, true);
|
|
@@ -65327,6 +65412,9 @@ function resolveLaunch(params) {
|
|
|
65327
65412
|
}
|
|
65328
65413
|
function runLaunchPlan(plan, spawn8) {
|
|
65329
65414
|
try {
|
|
65415
|
+
if (plan.hold() === "cancelled") {
|
|
65416
|
+
return LAUNCH_CANCELLED_EXIT;
|
|
65417
|
+
}
|
|
65330
65418
|
plan.markChildStarted();
|
|
65331
65419
|
const result = spawn8.spawnSync(plan.bin, plan.args, { stdio: "inherit", env: plan.env });
|
|
65332
65420
|
if (result.error !== void 0) {
|
|
@@ -65357,6 +65445,7 @@ var init_launcher = __esm({
|
|
|
65357
65445
|
init_extraFlags();
|
|
65358
65446
|
init_claudeSession();
|
|
65359
65447
|
init_diagnostics();
|
|
65448
|
+
init_hold();
|
|
65360
65449
|
init_modelPicker();
|
|
65361
65450
|
init_providerCatalogue();
|
|
65362
65451
|
init_pool();
|
|
@@ -65429,6 +65518,7 @@ function realPrepareLaunchParams(paths, options) {
|
|
|
65429
65518
|
headroom: realHeadroomPort(paths, { spawnDaemon: options.spawnDaemon, cwd: farm.runtime.cwd }),
|
|
65430
65519
|
frontdoor: realFrontDoorPort(paths, options.spawnDaemon),
|
|
65431
65520
|
credentials: { ...realCredentialPort, cache: realCredentialCacheEnv(paths) },
|
|
65521
|
+
hold: realHoldPort,
|
|
65432
65522
|
hasStoredLogin: (identity) => identitySignIn(realFarmFs, { platform: process.platform, run: realRunPort }, { farmRoot: import_node_path44.default.join(paths.identitiesDir, identity), hasCredentialBlock: false }).state !== "signed-out",
|
|
65433
65523
|
...farm.directoryIdentity === void 0 ? {} : { directoryPinnedIdentity: farm.directoryIdentity },
|
|
65434
65524
|
...farm.directoryConfigProfile === void 0 ? {} : { directoryRuleConfigProfile: farm.directoryConfigProfile },
|
|
@@ -65591,7 +65681,7 @@ function quotaFreshnessMs(quota) {
|
|
|
65591
65681
|
const lengths = quota.windows.flatMap((window) => window.periodMs === void 0 ? [] : [window.periodMs]);
|
|
65592
65682
|
return lengths.length === 0 ? Number.POSITIVE_INFINITY : Math.min(...lengths) / PERCENT3;
|
|
65593
65683
|
}
|
|
65594
|
-
var ProviderQuotaError,
|
|
65684
|
+
var ProviderQuotaError, MS_PER_SECOND9, SECONDS_PER_HOUR3, HOURS_PER_DAY5, DAYS_PER_MONTH, PERCENT3, HTTP_OK2, 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, ANTIGRAVITY_USER_URL, GOOGLE_TOKENINFO_URL, FIVE_HOURS2, DAYS_PER_WEEK2, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema, ANTIGRAVITY_WINDOW_MS, antigravityQuotaAdapter, PROVIDER_QUOTA_ADAPTERS;
|
|
65595
65685
|
var init_providerQuota = __esm({
|
|
65596
65686
|
"src/usage/providerQuota.ts"() {
|
|
65597
65687
|
"use strict";
|
|
@@ -65604,7 +65694,7 @@ var init_providerQuota = __esm({
|
|
|
65604
65694
|
this.name = "ProviderQuotaError";
|
|
65605
65695
|
}
|
|
65606
65696
|
};
|
|
65607
|
-
|
|
65697
|
+
MS_PER_SECOND9 = 1e3;
|
|
65608
65698
|
SECONDS_PER_HOUR3 = 3600;
|
|
65609
65699
|
HOURS_PER_DAY5 = 24;
|
|
65610
65700
|
DAYS_PER_MONTH = 30;
|
|
@@ -65616,8 +65706,8 @@ var init_providerQuota = __esm({
|
|
|
65616
65706
|
ZAI_UNIT_HOURS = 3;
|
|
65617
65707
|
ZAI_UNIT_MONTHS = 5;
|
|
65618
65708
|
ZAI_UNIT_MS = /* @__PURE__ */ new Map([
|
|
65619
|
-
[ZAI_UNIT_HOURS, SECONDS_PER_HOUR3 *
|
|
65620
|
-
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY5 * SECONDS_PER_HOUR3 *
|
|
65709
|
+
[ZAI_UNIT_HOURS, SECONDS_PER_HOUR3 * MS_PER_SECOND9],
|
|
65710
|
+
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY5 * SECONDS_PER_HOUR3 * MS_PER_SECOND9]
|
|
65621
65711
|
]);
|
|
65622
65712
|
ZAI_MEASURES = { TOKENS_LIMIT: "tokens", TIME_LIMIT: "tool-calls" };
|
|
65623
65713
|
ZaiLimitSchema = external_exports.object({
|
|
@@ -65669,7 +65759,7 @@ var init_providerQuota = __esm({
|
|
|
65669
65759
|
OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
|
|
65670
65760
|
OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
|
|
65671
65761
|
HTTP_FORBIDDEN = 403;
|
|
65672
|
-
MS_PER_DAY2 = HOURS_PER_DAY5 * SECONDS_PER_HOUR3 *
|
|
65762
|
+
MS_PER_DAY2 = HOURS_PER_DAY5 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
65673
65763
|
OpenRouterKeySchema = external_exports.object({
|
|
65674
65764
|
data: external_exports.object({
|
|
65675
65765
|
limit: external_exports.number().nonnegative().nullable(),
|
|
@@ -65717,8 +65807,8 @@ var init_providerQuota = __esm({
|
|
|
65717
65807
|
GOOGLE_TOKENINFO_URL = "https://oauth2.googleapis.com/tokeninfo";
|
|
65718
65808
|
FIVE_HOURS2 = 5;
|
|
65719
65809
|
DAYS_PER_WEEK2 = 7;
|
|
65720
|
-
FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR3 *
|
|
65721
|
-
WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY5 * SECONDS_PER_HOUR3 *
|
|
65810
|
+
FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
65811
|
+
WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY5 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
65722
65812
|
AntigravityBucketSchema = external_exports.object({
|
|
65723
65813
|
bucketId: external_exports.string(),
|
|
65724
65814
|
remainingFraction: external_exports.number().optional(),
|
|
@@ -111319,6 +111409,12 @@ function applyProfileChange(paths, name, change) {
|
|
|
111319
111409
|
if (change.launchClaudeVersion !== void 0) {
|
|
111320
111410
|
launchPatch.claudeVersion = change.launchClaudeVersion === false ? void 0 : change.launchClaudeVersion;
|
|
111321
111411
|
}
|
|
111412
|
+
if (change.launchDelay !== void 0) {
|
|
111413
|
+
launchPatch.delay = change.launchDelay === false ? void 0 : change.launchDelay;
|
|
111414
|
+
}
|
|
111415
|
+
if (change.launchPause !== void 0) {
|
|
111416
|
+
launchPatch.pause = change.launchPause;
|
|
111417
|
+
}
|
|
111322
111418
|
if (Object.keys(launchPatch).length > 0) {
|
|
111323
111419
|
setProfileLaunchFlags(paths, name, launchPatch);
|
|
111324
111420
|
touched = true;
|
|
@@ -112605,7 +112701,7 @@ function registerProfileCommand(program2, deps) {
|
|
|
112605
112701
|
withExamples(
|
|
112606
112702
|
profile.command("set <name>").description(
|
|
112607
112703
|
"Update a configuration profile's categories, entries, extends list, description or launch settings. With no options on a terminal, walks through its categories."
|
|
112608
|
-
).option("--category <category=bool>", "Share (true) or hide (false) a whole category (repeatable).", collectBoolPair).option("--entry <path=bool>", "Share (true) or hide (false) one <category>/<path> entry (repeatable).", collectBoolPair).option("--extends <profile>", "Replace the extends list with these profiles (repeatable, in order).", collectRepeated).option("--no-extends", "Clear the extends list.").option("--description <text>", "Replace the description.").option("--no-description", "Clear the description.").option("--launch-skip-permissions", "Launches under this profile skip permission prompts.").option("--no-launch-skip-permissions", "Launches under this profile keep permission prompts.").option("--launch-remote-control", "Launches under this profile enable Remote Control.").option("--no-launch-remote-control", "Launches under this profile leave Remote Control off.").option("--launch-headroom", "Launches under this profile route through headroom.").option("--no-launch-headroom", "Launches under this profile route direct.").option("--launch-track-usage", "Launches under this profile route through the front door so their requests and quota are recorded, with no headroom needed.").option("--no-launch-track-usage", "Launches under this profile are not recorded unless a provider or headroom routes them anyway.").option("--launch-provider <provider>", "Launches under this profile route through this provider.").option("--no-launch-provider", "Clear this profile's provider selection.").option("--launch-claude-version <version>", "Launches under this profile run exactly this installed Claude Code version (such as 2.1.220); a version that is not installed fails the launch.").option("--no-launch-claude-version", "Clear this profile's Claude Code version pin.").option("--json", "Print the result as JSON.").action(async (name, allOptions) => {
|
|
112704
|
+
).option("--category <category=bool>", "Share (true) or hide (false) a whole category (repeatable).", collectBoolPair).option("--entry <path=bool>", "Share (true) or hide (false) one <category>/<path> entry (repeatable).", collectBoolPair).option("--extends <profile>", "Replace the extends list with these profiles (repeatable, in order).", collectRepeated).option("--no-extends", "Clear the extends list.").option("--description <text>", "Replace the description.").option("--no-description", "Clear the description.").option("--launch-skip-permissions", "Launches under this profile skip permission prompts.").option("--no-launch-skip-permissions", "Launches under this profile keep permission prompts.").option("--launch-remote-control", "Launches under this profile enable Remote Control.").option("--no-launch-remote-control", "Launches under this profile leave Remote Control off.").option("--launch-headroom", "Launches under this profile route through headroom.").option("--no-launch-headroom", "Launches under this profile route direct.").option("--launch-track-usage", "Launches under this profile route through the front door so their requests and quota are recorded, with no headroom needed.").option("--no-launch-track-usage", "Launches under this profile are not recorded unless a provider or headroom routes them anyway.").option("--launch-provider <provider>", "Launches under this profile route through this provider.").option("--no-launch-provider", "Clear this profile's provider selection.").option("--launch-claude-version <version>", "Launches under this profile run exactly this installed Claude Code version (such as 2.1.220); a version that is not installed fails the launch.").option("--no-launch-claude-version", "Clear this profile's Claude Code version pin.").option("--launch-delay <duration>", "Launches under this profile wait this long (such as 5s) after the launcher's own output before starting claude, so the output can be read.", parseDurationLiteral).option("--no-launch-delay", "Clear this profile's launch delay.").option("--launch-pause", "Launches under this profile wait for a key press after the launcher's own output before starting claude.").option("--no-launch-pause", "Launches under this profile start claude without waiting for a key press.").option("--json", "Print the result as JSON.").action(async (name, allOptions) => {
|
|
112609
112705
|
const { json: json2, ...options } = allOptions;
|
|
112610
112706
|
requireProfileExists(paths, name);
|
|
112611
112707
|
if (Object.entries(allOptions).every(([key, value2]) => key === "json" || value2 === void 0)) {
|
|
@@ -115711,7 +115807,7 @@ var HIGH_BIT = 128;
|
|
|
115711
115807
|
var BASE_128_PAYLOAD_MASK = 127;
|
|
115712
115808
|
var FIRST_ARC_WEIGHT = 40;
|
|
115713
115809
|
var SHORT_FORM_MAX_LENGTH = 127;
|
|
115714
|
-
var
|
|
115810
|
+
var MS_PER_SECOND10 = 1e3;
|
|
115715
115811
|
var UTC_TIME_LAST_YEAR = 2049;
|
|
115716
115812
|
var YEAR_DIGITS = 4;
|
|
115717
115813
|
var TWO_DIGIT_YEAR_DIGITS = 2;
|
|
@@ -115770,7 +115866,7 @@ function wholeBitString(content) {
|
|
|
115770
115866
|
return tlv(TAG_BIT_STRING, Buffer.concat([Buffer.from([0]), content]));
|
|
115771
115867
|
}
|
|
115772
115868
|
function time3(instant) {
|
|
115773
|
-
const iso = new Date(Math.floor(instant.getTime() /
|
|
115869
|
+
const iso = new Date(Math.floor(instant.getTime() / MS_PER_SECOND10) * MS_PER_SECOND10).toISOString();
|
|
115774
115870
|
const compact = `${iso.replace(/[-:T]/g, "").slice(0, COMPACT_TIME_DIGITS)}Z`;
|
|
115775
115871
|
if (instant.getUTCFullYear() > UTC_TIME_LAST_YEAR) {
|
|
115776
115872
|
return tlv(TAG_GENERALIZED_TIME, Buffer.from(compact, "ascii"));
|
|
@@ -127505,7 +127601,9 @@ var ConfigProfileSetInputSchema = external_exports.strictObject({
|
|
|
127505
127601
|
headroom: external_exports.boolean().optional(),
|
|
127506
127602
|
trackUsage: external_exports.boolean().optional(),
|
|
127507
127603
|
provider: external_exports.union([external_exports.string().min(1), external_exports.literal(false)]).optional(),
|
|
127508
|
-
claudeVersion: external_exports.union([external_exports.string().min(1), external_exports.literal(false)]).optional()
|
|
127604
|
+
claudeVersion: external_exports.union([external_exports.string().min(1), external_exports.literal(false)]).optional(),
|
|
127605
|
+
delay: external_exports.union([external_exports.string().regex(DURATION_RE), external_exports.literal(false)]).optional(),
|
|
127606
|
+
pause: external_exports.boolean().optional()
|
|
127509
127607
|
}).optional()
|
|
127510
127608
|
});
|
|
127511
127609
|
var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
|
|
@@ -127715,7 +127813,9 @@ function createConfigApiRouter(deps) {
|
|
|
127715
127813
|
...launch?.headroom === void 0 ? {} : { launchHeadroom: launch.headroom },
|
|
127716
127814
|
...launch?.trackUsage === void 0 ? {} : { launchTrackUsage: launch.trackUsage },
|
|
127717
127815
|
...launch?.provider === void 0 ? {} : { launchProvider: launch.provider },
|
|
127718
|
-
...launch?.claudeVersion === void 0 ? {} : { launchClaudeVersion: launch.claudeVersion }
|
|
127816
|
+
...launch?.claudeVersion === void 0 ? {} : { launchClaudeVersion: launch.claudeVersion },
|
|
127817
|
+
...launch?.delay === void 0 ? {} : { launchDelay: launch.delay },
|
|
127818
|
+
...launch?.pause === void 0 ? {} : { launchPause: launch.pause }
|
|
127719
127819
|
});
|
|
127720
127820
|
return { action: "updated", kind: "profile", name: input2.name, value: profileValue(input2.name, paths) };
|
|
127721
127821
|
})
|
|
@@ -128014,7 +128114,10 @@ var LaunchFlagsSchema = external_exports.strictObject({
|
|
|
128014
128114
|
skipPermissions: external_exports.boolean(),
|
|
128015
128115
|
remoteControl: external_exports.boolean(),
|
|
128016
128116
|
headroom: external_exports.boolean(),
|
|
128017
|
-
trackUsage: external_exports.boolean()
|
|
128117
|
+
trackUsage: external_exports.boolean(),
|
|
128118
|
+
pause: external_exports.boolean(),
|
|
128119
|
+
/** How long the launch waits after its own output before it starts claude, in milliseconds. */
|
|
128120
|
+
delayMs: external_exports.number()
|
|
128018
128121
|
});
|
|
128019
128122
|
var LaunchResolveOutputSchema = external_exports.strictObject({
|
|
128020
128123
|
decision: LaunchDecisionSchema,
|
|
@@ -129177,17 +129280,17 @@ function unifiedQuotaHeaders(upstream, rejected, quotaError) {
|
|
|
129177
129280
|
}
|
|
129178
129281
|
return headers;
|
|
129179
129282
|
}
|
|
129180
|
-
var
|
|
129283
|
+
var MS_PER_SECOND11 = 1e3;
|
|
129181
129284
|
function buildUsageSnapshot(upstream, quotaError, nowMs) {
|
|
129182
129285
|
const used7 = upstream.get("x-codex-primary-used-percent") ?? (quotaError === void 0 ? null : EXHAUSTED_PERCENT);
|
|
129183
129286
|
const reset7 = upstream.get("x-codex-primary-reset-at") ?? (quotaError?.resets_at === void 0 ? null : String(quotaError.resets_at));
|
|
129184
|
-
const sevenDay = used7 !== null && reset7 !== null ? { used_percentage: Number(used7), resets_at: new Date(Number(reset7) *
|
|
129287
|
+
const sevenDay = used7 !== null && reset7 !== null ? { used_percentage: Number(used7), resets_at: new Date(Number(reset7) * MS_PER_SECOND11).toISOString() } : void 0;
|
|
129185
129288
|
let fiveHour;
|
|
129186
129289
|
if (Number(upstream.get("x-codex-secondary-window-minutes")) > 0) {
|
|
129187
129290
|
const used5 = upstream.get("x-codex-secondary-used-percent");
|
|
129188
129291
|
const reset5 = upstream.get("x-codex-secondary-reset-at");
|
|
129189
129292
|
if (used5 !== null && reset5 !== null) {
|
|
129190
|
-
fiveHour = { used_percentage: Number(used5), resets_at: new Date(Number(reset5) *
|
|
129293
|
+
fiveHour = { used_percentage: Number(used5), resets_at: new Date(Number(reset5) * MS_PER_SECOND11).toISOString() };
|
|
129191
129294
|
}
|
|
129192
129295
|
}
|
|
129193
129296
|
if (sevenDay === void 0 && fiveHour === void 0) {
|
|
@@ -129977,11 +130080,11 @@ async function* callLocalAntigravity(params) {
|
|
|
129977
130080
|
|
|
129978
130081
|
// src/antigravity/route.ts
|
|
129979
130082
|
init_quota();
|
|
129980
|
-
var
|
|
130083
|
+
var MS_PER_SECOND12 = 1e3;
|
|
129981
130084
|
var ROUTING_MEMORY_SESSIONS = 256;
|
|
129982
130085
|
function exhaustedMessage(exhaustion) {
|
|
129983
130086
|
const window = exhaustion.window === "five_hour" ? "5-hour" : "weekly";
|
|
129984
|
-
return `Antigravity ${window} limit reached; it resets at ${new Date(exhaustion.resetSec *
|
|
130087
|
+
return `Antigravity ${window} limit reached; it resets at ${new Date(exhaustion.resetSec * MS_PER_SECOND12).toISOString()}.`;
|
|
129985
130088
|
}
|
|
129986
130089
|
function createAntigravityRoute(ports) {
|
|
129987
130090
|
const fallbackId = ports.fallbackId ?? (() => (0, import_node_crypto23.randomUUID)());
|
|
@@ -130707,7 +130810,7 @@ init_account();
|
|
|
130707
130810
|
var RC_SELF_HOST_OAUTH_HOST = "platform.claude.com";
|
|
130708
130811
|
var RC_SELF_HOST_SCOPE_LIST = ["user:profile", "user:inference", "user:sessions:claude_code", "user:mcp_servers", "user:file_upload"];
|
|
130709
130812
|
var RC_SELF_HOST_OAUTH_TOKEN_TTL_SECONDS = 3600;
|
|
130710
|
-
var
|
|
130813
|
+
var MS_PER_SECOND13 = 1e3;
|
|
130711
130814
|
var HTTP_SERVICE_UNAVAILABLE = 503;
|
|
130712
130815
|
function isRecord15(value2) {
|
|
130713
130816
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
@@ -130763,7 +130866,7 @@ function createRcSelfHostLocal(deps) {
|
|
|
130763
130866
|
}
|
|
130764
130867
|
if (method === "POST" && pathname.startsWith("/api/eval/")) {
|
|
130765
130868
|
await deps.readBody(request7, CONTROL_BODY_CAP_BYTES);
|
|
130766
|
-
answerServerJson(response, HTTP_STATUS.ok, { features: growthBookFeatures(), dateUpdated: Math.floor(deps.now() /
|
|
130869
|
+
answerServerJson(response, HTTP_STATUS.ok, { features: growthBookFeatures(), dateUpdated: Math.floor(deps.now() / MS_PER_SECOND13) });
|
|
130767
130870
|
return true;
|
|
130768
130871
|
}
|
|
130769
130872
|
if (method === "GET" && pathname === "/api/oauth/profile") {
|
|
@@ -130947,12 +131050,12 @@ function eventExcerpt(text2) {
|
|
|
130947
131050
|
return text2.length <= RC_PENDING_SUMMARY_EXCERPT_CHARS ? text2 : `${text2.slice(0, RC_PENDING_SUMMARY_EXCERPT_CHARS)}...`;
|
|
130948
131051
|
}
|
|
130949
131052
|
var PERCENT_SCALE = 100;
|
|
130950
|
-
var
|
|
131053
|
+
var MS_PER_SECOND14 = 1e3;
|
|
130951
131054
|
function percentOf(fraction) {
|
|
130952
131055
|
return `${String(Math.round(fraction * PERCENT_SCALE))}%`;
|
|
130953
131056
|
}
|
|
130954
131057
|
function resetInstantOf(epochSeconds) {
|
|
130955
|
-
return new Date(epochSeconds *
|
|
131058
|
+
return new Date(epochSeconds * MS_PER_SECOND14).toISOString();
|
|
130956
131059
|
}
|
|
130957
131060
|
function formatRcRateLimitInfo(info) {
|
|
130958
131061
|
const parts = [info.status];
|
|
@@ -132387,7 +132490,7 @@ var RC_COMPAT_SESSIONS_PATH = "/v1/sessions";
|
|
|
132387
132490
|
var RC_SESSION_ID_PREFIX2 = "cse_";
|
|
132388
132491
|
var RC_SELF_HOST_API_BASE_URL = "https://api.anthropic.com";
|
|
132389
132492
|
var HTTP_CONFLICT = 409;
|
|
132390
|
-
var
|
|
132493
|
+
var MS_PER_SECOND15 = 1e3;
|
|
132391
132494
|
var HTTP_SERVICE_UNAVAILABLE2 = 503;
|
|
132392
132495
|
var RC_SELF_HOST_WORKER_JWT_TTL_SECONDS = 46800;
|
|
132393
132496
|
var RC_SELF_HOST_KEEPALIVE_MS = 15e3;
|
|
@@ -132487,7 +132590,7 @@ function parseJsonObject5(body) {
|
|
|
132487
132590
|
function mintWorkerJwt(randomToken, issuedAt) {
|
|
132488
132591
|
const encode3 = (value2) => Buffer.from(JSON.stringify(value2), "utf8").toString("base64url");
|
|
132489
132592
|
const header = encode3({ alg: "HS256", typ: "JWT" });
|
|
132490
|
-
const payload = encode3({ exp: Math.floor((issuedAt + RC_SELF_HOST_WORKER_JWT_TTL_SECONDS *
|
|
132593
|
+
const payload = encode3({ exp: Math.floor((issuedAt + RC_SELF_HOST_WORKER_JWT_TTL_SECONDS * MS_PER_SECOND15) / MS_PER_SECOND15), iat: Math.floor(issuedAt / MS_PER_SECOND15) });
|
|
132491
132594
|
return `${header}.${payload}.${Buffer.from(randomToken(), "utf8").toString("base64url")}`;
|
|
132492
132595
|
}
|
|
132493
132596
|
function createRcSelfHostSurface(deps) {
|
|
@@ -134214,7 +134317,7 @@ var realHeadroomGet = async (target, requestPath, timeoutMs) => {
|
|
|
134214
134317
|
// src/statusline/enrich.ts
|
|
134215
134318
|
init_quota();
|
|
134216
134319
|
var FULL_PERCENT = 100;
|
|
134217
|
-
var
|
|
134320
|
+
var MS_PER_SECOND16 = 1e3;
|
|
134218
134321
|
function identityOf(env) {
|
|
134219
134322
|
const headers = env.ANTHROPIC_CUSTOM_HEADERS;
|
|
134220
134323
|
if (headers !== void 0) {
|
|
@@ -134271,7 +134374,7 @@ function payloadWindow(rateLimits, key) {
|
|
|
134271
134374
|
const resetsAt = window.resets_at;
|
|
134272
134375
|
return {
|
|
134273
134376
|
used: Math.min(FULL_PERCENT, Math.max(0, window.used_percentage)),
|
|
134274
|
-
resetAt: typeof resetsAt === "number" && Number.isFinite(resetsAt) ? new Date(resetsAt *
|
|
134377
|
+
resetAt: typeof resetsAt === "number" && Number.isFinite(resetsAt) ? new Date(resetsAt * MS_PER_SECOND16).toISOString() : void 0
|
|
134275
134378
|
};
|
|
134276
134379
|
}
|
|
134277
134380
|
function payloadWindowsOf(payload) {
|
|
@@ -134299,7 +134402,7 @@ function antigravityQuotaMapOf(payload) {
|
|
|
134299
134402
|
function bucketView(bucket, nowMs) {
|
|
134300
134403
|
return {
|
|
134301
134404
|
used: bucket?.remaining_fraction === void 0 || !Number.isFinite(bucket.remaining_fraction) ? void 0 : (1 - Math.min(1, Math.max(0, bucket.remaining_fraction))) * FULL_PERCENT,
|
|
134302
|
-
resetAt: bucket?.reset_in_seconds === void 0 || !Number.isFinite(bucket.reset_in_seconds) ? void 0 : new Date(nowMs + bucket.reset_in_seconds *
|
|
134405
|
+
resetAt: bucket?.reset_in_seconds === void 0 || !Number.isFinite(bucket.reset_in_seconds) ? void 0 : new Date(nowMs + bucket.reset_in_seconds * MS_PER_SECOND16).toISOString()
|
|
134303
134406
|
};
|
|
134304
134407
|
}
|
|
134305
134408
|
function antigravityWindowsOf(payload, nowMs) {
|
|
@@ -134372,7 +134475,7 @@ function enrichStatuslinePayload(params) {
|
|
|
134372
134475
|
window.measures,
|
|
134373
134476
|
{
|
|
134374
134477
|
remaining_fraction: 1 - window.utilization,
|
|
134375
|
-
...window.resetsAt === void 0 ? {} : { reset_in_seconds: (Date.parse(window.resetsAt) - params.nowMs) /
|
|
134478
|
+
...window.resetsAt === void 0 ? {} : { reset_in_seconds: (Date.parse(window.resetsAt) - params.nowMs) / MS_PER_SECOND16 }
|
|
134376
134479
|
}
|
|
134377
134480
|
])
|
|
134378
134481
|
);
|
|
@@ -146819,11 +146922,13 @@ Launching:
|
|
|
146819
146922
|
--[no-]skip-permissions, --[no-]remote-control, --[no-]headroom, --[no-]track-usage
|
|
146820
146923
|
--claude-version <version> run exactly this installed Claude Code version (not the highest)
|
|
146821
146924
|
--[no-]wait with @pool:<name>, sleep until the earliest member returns when all are refused
|
|
146925
|
+
--delay <duration> wait this long (5s, 500ms) after the launcher's own output before starting claude
|
|
146926
|
+
--[no-]pause wait for a key press after the launcher's own output before starting claude
|
|
146822
146927
|
--native run the real claude with nothing from agent-shim applied (no other launch flag allowed)
|
|
146823
146928
|
|
|
146824
146929
|
Environment:
|
|
146825
146930
|
AGENT_SHIM_IDENTITY, AGENT_SHIM_CONFIG_PROFILE, AGENT_SHIM_SKIP_PERMISSIONS,
|
|
146826
|
-
AGENT_SHIM_REMOTE_CONTROL, AGENT_SHIM_HEADROOM, AGENT_SHIM_TRACK_USAGE, AGENT_SHIM_ALLOW_AMBIENT_CREDENTIAL,
|
|
146931
|
+
AGENT_SHIM_REMOTE_CONTROL, AGENT_SHIM_HEADROOM, AGENT_SHIM_TRACK_USAGE, AGENT_SHIM_DELAY, AGENT_SHIM_PAUSE, AGENT_SHIM_ALLOW_AMBIENT_CREDENTIAL,
|
|
146827
146932
|
AGENT_SHIM_CATEGORY_OVERRIDE, AGENT_SHIM_ENTRY_OVERRIDE, AGENT_SHIM_HOME,
|
|
146828
146933
|
AGENT_SHIM_DEBUG (print stack traces), NO_COLOR. Booleans are true, false, 1 or 0.
|
|
146829
146934
|
|
|
@@ -147212,6 +147317,7 @@ function resetTerminal() {
|
|
|
147212
147317
|
}
|
|
147213
147318
|
|
|
147214
147319
|
// src/supervise/supervise.ts
|
|
147320
|
+
init_hold();
|
|
147215
147321
|
init_spawn();
|
|
147216
147322
|
var STOP_GRACE_MS = 5e3;
|
|
147217
147323
|
function messageOf(error63) {
|
|
@@ -147383,6 +147489,10 @@ async function supervise(deps, first) {
|
|
|
147383
147489
|
plan.release();
|
|
147384
147490
|
throw new Error("a supervised launch resolved no identity to supervise");
|
|
147385
147491
|
}
|
|
147492
|
+
if (!moved && plan.hold() === "cancelled") {
|
|
147493
|
+
plan.release();
|
|
147494
|
+
return LAUNCH_CANCELLED_EXIT;
|
|
147495
|
+
}
|
|
147386
147496
|
if (!moved) {
|
|
147387
147497
|
deps.register({ pid: deps.pid, sessionId: plan.sessionId, pool: deps.pool, identity, cwd: deps.cwd, since: new Date(deps.now()).toISOString() });
|
|
147388
147498
|
}
|
|
@@ -147538,6 +147648,8 @@ function otherLaunchFlags(parsed) {
|
|
|
147538
147648
|
...parsed.configProfile === void 0 ? [] : ["--config-profile"],
|
|
147539
147649
|
...parsed.provider === void 0 ? [] : [parsed.provider === false ? "--no-provider" : "--provider"],
|
|
147540
147650
|
...parsed.claudeVersion === void 0 ? [] : ["--claude-version"],
|
|
147651
|
+
...parsed.delay === void 0 ? [] : ["--delay"],
|
|
147652
|
+
...parsed.pause === void 0 ? [] : ["--[no-]pause"],
|
|
147541
147653
|
...parsed.headroom === void 0 ? [] : ["--[no-]headroom"],
|
|
147542
147654
|
...parsed.trackUsage === void 0 ? [] : ["--[no-]track-usage"],
|
|
147543
147655
|
...parsed.skipPermissions === void 0 ? [] : ["--[no-]skip-permissions"],
|