claude-use 11.88.0 → 11.88.1
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 +490 -322
- package/dist/index.cjs +774 -606
- package/dist/index.mjs +756 -588
- package/dist/types/index.d.ts +8 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5189,7 +5189,7 @@ var init_package = __esm({
|
|
|
5189
5189
|
"package.json"() {
|
|
5190
5190
|
package_default = {
|
|
5191
5191
|
name: "claude-use",
|
|
5192
|
-
version: "11.88.
|
|
5192
|
+
version: "11.88.1",
|
|
5193
5193
|
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.",
|
|
5194
5194
|
license: "MIT",
|
|
5195
5195
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -6747,8 +6747,10 @@ var init_realPorts = __esm({
|
|
|
6747
6747
|
init_ensure();
|
|
6748
6748
|
init_supervisor2();
|
|
6749
6749
|
init_state2();
|
|
6750
|
+
init_sameDirectory();
|
|
6750
6751
|
init_logStyle();
|
|
6751
6752
|
realFsPort = {
|
|
6753
|
+
sameDirectory,
|
|
6752
6754
|
fileRevision(filePath) {
|
|
6753
6755
|
try {
|
|
6754
6756
|
const stat = import_node_fs4.default.statSync(filePath, { bigint: true });
|
|
@@ -7180,19 +7182,21 @@ function readActiveIdentity(fs17, activeIdentityFile) {
|
|
|
7180
7182
|
function isNonEmpty(value) {
|
|
7181
7183
|
return value !== void 0 && value !== "";
|
|
7182
7184
|
}
|
|
7183
|
-
function selected(selector, source) {
|
|
7185
|
+
function selected(selector, source, supersededConfigDir) {
|
|
7184
7186
|
if (!IdentitySelectorSchema.safeParse(selector).success) {
|
|
7185
7187
|
throw new UnsafeNameError(selector, "identity", `${FILE_NAME_RULE}, or be pool:<name> for a pool`, IDENTITY_SOURCE_LABELS[source]);
|
|
7186
7188
|
}
|
|
7187
7189
|
const pool = poolNameOf(selector);
|
|
7188
|
-
|
|
7190
|
+
const superseded = supersededConfigDir === void 0 ? {} : { supersededConfigDir };
|
|
7191
|
+
return pool === void 0 ? { name: selector, source, configDirEscapeHatch: false, ...superseded } : { pool, source, configDirEscapeHatch: false, ...superseded };
|
|
7189
7192
|
}
|
|
7190
7193
|
function decideIdentity(params) {
|
|
7191
|
-
|
|
7192
|
-
return { source: "config-dir-escape-hatch", configDirEscapeHatch: true };
|
|
7193
|
-
}
|
|
7194
|
+
const inheritedConfigDir = isNonEmpty(params.env.CLAUDE_CONFIG_DIR) ? params.env.CLAUDE_CONFIG_DIR : void 0;
|
|
7194
7195
|
if (isNonEmpty(params.argv0Identity)) {
|
|
7195
|
-
return selected(params.argv0Identity, "argv");
|
|
7196
|
+
return selected(params.argv0Identity, "argv", inheritedConfigDir);
|
|
7197
|
+
}
|
|
7198
|
+
if (inheritedConfigDir !== void 0) {
|
|
7199
|
+
return { source: "config-dir-escape-hatch", configDirEscapeHatch: true };
|
|
7196
7200
|
}
|
|
7197
7201
|
if (isNonEmpty(params.env.AGENT_SHIM_IDENTITY)) {
|
|
7198
7202
|
return selected(params.env.AGENT_SHIM_IDENTITY, "env");
|
|
@@ -7271,7 +7275,7 @@ var init_identity = __esm({
|
|
|
7271
7275
|
init_identityRecords();
|
|
7272
7276
|
init_sameDirectory();
|
|
7273
7277
|
IDENTITY_DECISION_SOURCES = [
|
|
7274
|
-
/** `CLAUDE_CONFIG_DIR` was already set: identity resolution is skipped entirely and the real binary uses whatever it already points to. */
|
|
7278
|
+
/** `CLAUDE_CONFIG_DIR` was already set and nothing on the command line names an identity: identity resolution is skipped entirely and the real binary uses whatever it already points to. */
|
|
7275
7279
|
"config-dir-escape-hatch",
|
|
7276
7280
|
/** A leading `@name` argv[0] positional, or its explicit form `--identity <name>`. */
|
|
7277
7281
|
"argv",
|
|
@@ -11561,6 +11565,156 @@ var init_claudeVersion = __esm({
|
|
|
11561
11565
|
}
|
|
11562
11566
|
});
|
|
11563
11567
|
|
|
11568
|
+
// src/headroom/headers.ts
|
|
11569
|
+
function mergeAnthropicCustomHeaders(existing, additions) {
|
|
11570
|
+
const merged = /* @__PURE__ */ new Map();
|
|
11571
|
+
for (const block of existing) {
|
|
11572
|
+
if (block === void 0) {
|
|
11573
|
+
continue;
|
|
11574
|
+
}
|
|
11575
|
+
for (const line of block.split("\n")) {
|
|
11576
|
+
const entry = parseCustomHeaderLine(line);
|
|
11577
|
+
if (entry === void 0) {
|
|
11578
|
+
continue;
|
|
11579
|
+
}
|
|
11580
|
+
merged.set(entry.name, entry.value);
|
|
11581
|
+
}
|
|
11582
|
+
}
|
|
11583
|
+
for (const entry of additions) {
|
|
11584
|
+
merged.set(entry.name, entry.value);
|
|
11585
|
+
}
|
|
11586
|
+
return [...merged].map(([name, value]) => `${name}: ${value}`).join("\n");
|
|
11587
|
+
}
|
|
11588
|
+
function parseAnthropicCustomHeaders(block) {
|
|
11589
|
+
return block.split("\n").flatMap((line) => {
|
|
11590
|
+
const entry = parseCustomHeaderLine(line);
|
|
11591
|
+
return entry === void 0 ? [] : [entry];
|
|
11592
|
+
});
|
|
11593
|
+
}
|
|
11594
|
+
function withoutAnthropicCustomHeaders(block, remove) {
|
|
11595
|
+
const lines = block.split("\n");
|
|
11596
|
+
const kept = lines.filter((line) => {
|
|
11597
|
+
const entry = parseCustomHeaderLine(line);
|
|
11598
|
+
return entry === void 0 || !remove(entry);
|
|
11599
|
+
});
|
|
11600
|
+
return kept.length === lines.length ? block : kept.join("\n");
|
|
11601
|
+
}
|
|
11602
|
+
function parseCustomHeaderLine(line) {
|
|
11603
|
+
const trimmed = line.trim();
|
|
11604
|
+
if (trimmed === "") {
|
|
11605
|
+
return void 0;
|
|
11606
|
+
}
|
|
11607
|
+
const colon = trimmed.indexOf(":");
|
|
11608
|
+
if (colon <= 0) {
|
|
11609
|
+
return void 0;
|
|
11610
|
+
}
|
|
11611
|
+
return { name: trimmed.slice(0, colon).trim(), value: trimmed.slice(colon + 1).trim() };
|
|
11612
|
+
}
|
|
11613
|
+
var init_headers = __esm({
|
|
11614
|
+
"src/headroom/headers.ts"() {
|
|
11615
|
+
"use strict";
|
|
11616
|
+
}
|
|
11617
|
+
});
|
|
11618
|
+
|
|
11619
|
+
// src/launcher/injected.ts
|
|
11620
|
+
function listKey(list) {
|
|
11621
|
+
return `${list},appended`;
|
|
11622
|
+
}
|
|
11623
|
+
function digest2(value) {
|
|
11624
|
+
return (0, import_node_crypto13.createHash)("sha256").update(value).digest("hex");
|
|
11625
|
+
}
|
|
11626
|
+
function recordedDigests(env) {
|
|
11627
|
+
const raw = env[INJECTED_ENV];
|
|
11628
|
+
if (raw === void 0 || raw === "") {
|
|
11629
|
+
return {};
|
|
11630
|
+
}
|
|
11631
|
+
let parsed;
|
|
11632
|
+
try {
|
|
11633
|
+
parsed = JSON.parse(raw);
|
|
11634
|
+
} catch {
|
|
11635
|
+
return {};
|
|
11636
|
+
}
|
|
11637
|
+
const result = InjectedSchema.safeParse(parsed);
|
|
11638
|
+
return result.success ? result.data : {};
|
|
11639
|
+
}
|
|
11640
|
+
function recordInjections(base) {
|
|
11641
|
+
const env = { ...base };
|
|
11642
|
+
const digests = new Map(Object.entries(recordedDigests(env)));
|
|
11643
|
+
return {
|
|
11644
|
+
env,
|
|
11645
|
+
set: (name, value) => {
|
|
11646
|
+
env[name] = value;
|
|
11647
|
+
digests.set(name, digest2(value));
|
|
11648
|
+
},
|
|
11649
|
+
unset: (name) => {
|
|
11650
|
+
env[name] = void 0;
|
|
11651
|
+
digests.delete(name);
|
|
11652
|
+
},
|
|
11653
|
+
recordHeaders: (names) => {
|
|
11654
|
+
const block = env[CUSTOM_HEADERS_ENV];
|
|
11655
|
+
for (const entry of block === void 0 ? [] : parseAnthropicCustomHeaders(block)) {
|
|
11656
|
+
if (names.includes(entry.name)) {
|
|
11657
|
+
digests.set(`${HEADER_KEY_PREFIX}${entry.name.toLowerCase()}`, digest2(entry.value));
|
|
11658
|
+
}
|
|
11659
|
+
}
|
|
11660
|
+
},
|
|
11661
|
+
recordBypassHosts: (list, hosts) => {
|
|
11662
|
+
const recordedHosts = [.../* @__PURE__ */ new Set([...digests.get(listKey(list))?.split(",") ?? [], ...hosts.map((host) => host.trim().toLowerCase()).filter((host) => host !== "")])];
|
|
11663
|
+
if (recordedHosts.length > 0) {
|
|
11664
|
+
digests.set(listKey(list), recordedHosts.join(","));
|
|
11665
|
+
}
|
|
11666
|
+
},
|
|
11667
|
+
finish: () => {
|
|
11668
|
+
if (digests.size > 0) {
|
|
11669
|
+
env[INJECTED_ENV] = JSON.stringify(Object.fromEntries(digests));
|
|
11670
|
+
}
|
|
11671
|
+
}
|
|
11672
|
+
};
|
|
11673
|
+
}
|
|
11674
|
+
function withoutRecordedHosts(list, value, digests) {
|
|
11675
|
+
const recordedHosts = new Set(digests[listKey(list)]?.split(","));
|
|
11676
|
+
const entries = value.split(",");
|
|
11677
|
+
const kept = entries.filter((entry) => !recordedHosts.has(entry.trim().toLowerCase()));
|
|
11678
|
+
return kept.length === entries.length ? value : kept.join(",");
|
|
11679
|
+
}
|
|
11680
|
+
function launchEnvironment(env, configDirEscapeHatch) {
|
|
11681
|
+
return configDirEscapeHatch ? env : withoutInjected(env);
|
|
11682
|
+
}
|
|
11683
|
+
function withoutInjected(env) {
|
|
11684
|
+
const digests = recordedDigests(env);
|
|
11685
|
+
const entries = Object.entries(env).flatMap(([name, value]) => {
|
|
11686
|
+
if (name === INJECTED_ENV) {
|
|
11687
|
+
return [];
|
|
11688
|
+
}
|
|
11689
|
+
if (value === void 0) {
|
|
11690
|
+
return [[name, value]];
|
|
11691
|
+
}
|
|
11692
|
+
if (name === CUSTOM_HEADERS_ENV) {
|
|
11693
|
+
const remaining = withoutAnthropicCustomHeaders(value, (entry) => digests[`${HEADER_KEY_PREFIX}${entry.name.toLowerCase()}`] === digest2(entry.value));
|
|
11694
|
+
return remaining !== value && remaining.trim() === "" ? [] : [[name, remaining]];
|
|
11695
|
+
}
|
|
11696
|
+
if (name === "NO_PROXY" || name === "no_proxy") {
|
|
11697
|
+
const remaining = withoutRecordedHosts(name, value, digests);
|
|
11698
|
+
return remaining !== value && remaining.split(",").every((entry) => entry.trim() === "") ? [] : [[name, remaining]];
|
|
11699
|
+
}
|
|
11700
|
+
return digests[name] === digest2(value) ? [] : [[name, value]];
|
|
11701
|
+
});
|
|
11702
|
+
return Object.fromEntries(entries);
|
|
11703
|
+
}
|
|
11704
|
+
var import_node_crypto13, import_zod24, INJECTED_ENV, CUSTOM_HEADERS_ENV, HEADER_KEY_PREFIX, InjectedSchema;
|
|
11705
|
+
var init_injected = __esm({
|
|
11706
|
+
"src/launcher/injected.ts"() {
|
|
11707
|
+
"use strict";
|
|
11708
|
+
import_node_crypto13 = require("node:crypto");
|
|
11709
|
+
import_zod24 = require("zod");
|
|
11710
|
+
init_headers();
|
|
11711
|
+
INJECTED_ENV = "AGENT_SHIM_INJECTED";
|
|
11712
|
+
CUSTOM_HEADERS_ENV = "ANTHROPIC_CUSTOM_HEADERS";
|
|
11713
|
+
HEADER_KEY_PREFIX = `${CUSTOM_HEADERS_ENV}:`;
|
|
11714
|
+
InjectedSchema = import_zod24.z.record(import_zod24.z.string(), import_zod24.z.string());
|
|
11715
|
+
}
|
|
11716
|
+
});
|
|
11717
|
+
|
|
11564
11718
|
// src/launcher/guard.ts
|
|
11565
11719
|
function detectAmbientCredential(env, injected) {
|
|
11566
11720
|
for (const variable of AMBIENT_CREDENTIAL_VARS) {
|
|
@@ -11599,10 +11753,22 @@ function evaluateAmbientCredentialGuard(params) {
|
|
|
11599
11753
|
message: formatAmbientCredentialGuardMessage(detected.variable, params.identityName)
|
|
11600
11754
|
};
|
|
11601
11755
|
}
|
|
11756
|
+
function ambientCredentialFinding(env) {
|
|
11757
|
+
const named = detectAmbientCredential(launchEnvironment(env, false));
|
|
11758
|
+
if (named !== void 0) {
|
|
11759
|
+
return { severity: "warn", message: formatAmbientCredentialGuardMessage(named.variable) };
|
|
11760
|
+
}
|
|
11761
|
+
const bare = env.CLAUDE_CONFIG_DIR === void 0 || env.CLAUDE_CONFIG_DIR === "" ? void 0 : detectAmbientCredential(env);
|
|
11762
|
+
if (bare !== void 0) {
|
|
11763
|
+
return { severity: "warn", message: `${bare.variable} was set in this session by the launcher that started it. A launch that names an identity drops it, but a launch naming none keeps the session's CLAUDE_CONFIG_DIR and environment and is refused. Name an identity, as in \`claude @<name>\`.` };
|
|
11764
|
+
}
|
|
11765
|
+
return { severity: "pass", message: "No ambient-credential environment variable is set." };
|
|
11766
|
+
}
|
|
11602
11767
|
var AMBIENT_CREDENTIAL_VARS;
|
|
11603
11768
|
var init_guard = __esm({
|
|
11604
11769
|
"src/launcher/guard.ts"() {
|
|
11605
11770
|
"use strict";
|
|
11771
|
+
init_injected();
|
|
11606
11772
|
AMBIENT_CREDENTIAL_VARS = [
|
|
11607
11773
|
"ANTHROPIC_API_KEY",
|
|
11608
11774
|
"ANTHROPIC_AUTH_TOKEN",
|
|
@@ -11720,46 +11886,46 @@ function findPathShadow(params) {
|
|
|
11720
11886
|
}
|
|
11721
11887
|
return params.pathDirs.some((dir) => import_node_path37.default.resolve(dir) === resolvedTargetDir) ? { status: "ok" } : { status: "not-on-path" };
|
|
11722
11888
|
}
|
|
11723
|
-
var import_node_fs11, import_node_path37,
|
|
11889
|
+
var import_node_fs11, import_node_path37, import_zod29, ClaudeShimStateSchema, nodeLinkFs;
|
|
11724
11890
|
var init_claudeShim = __esm({
|
|
11725
11891
|
"src/claudeShim.ts"() {
|
|
11726
11892
|
"use strict";
|
|
11727
11893
|
import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
11728
11894
|
import_node_path37 = __toESM(require("node:path"), 1);
|
|
11729
|
-
|
|
11895
|
+
import_zod29 = require("zod");
|
|
11730
11896
|
init_commandDeps();
|
|
11731
11897
|
init_store();
|
|
11732
11898
|
init_realPorts();
|
|
11733
11899
|
init_cliError();
|
|
11734
|
-
ClaudeShimStateSchema =
|
|
11735
|
-
targetPath:
|
|
11736
|
-
method:
|
|
11737
|
-
installedAtMs:
|
|
11900
|
+
ClaudeShimStateSchema = import_zod29.z.strictObject({
|
|
11901
|
+
targetPath: import_zod29.z.string().min(1),
|
|
11902
|
+
method: import_zod29.z.enum(["hardlink", "copy"]),
|
|
11903
|
+
installedAtMs: import_zod29.z.number()
|
|
11738
11904
|
});
|
|
11739
11905
|
nodeLinkFs = { link: import_node_fs11.default.linkSync, copyFile: import_node_fs11.default.copyFileSync, chmod: import_node_fs11.default.chmodSync };
|
|
11740
11906
|
}
|
|
11741
11907
|
});
|
|
11742
11908
|
|
|
11743
11909
|
// src/codex/auth.ts
|
|
11744
|
-
var
|
|
11910
|
+
var import_zod30, AuthFileSchema, TokenGrantSchema, CodexAuthError;
|
|
11745
11911
|
var init_auth = __esm({
|
|
11746
11912
|
"src/codex/auth.ts"() {
|
|
11747
11913
|
"use strict";
|
|
11748
|
-
|
|
11749
|
-
AuthFileSchema =
|
|
11750
|
-
tokens:
|
|
11751
|
-
access_token:
|
|
11752
|
-
refresh_token:
|
|
11753
|
-
id_token:
|
|
11754
|
-
account_id:
|
|
11914
|
+
import_zod30 = require("zod");
|
|
11915
|
+
AuthFileSchema = import_zod30.z.looseObject({
|
|
11916
|
+
tokens: import_zod30.z.looseObject({
|
|
11917
|
+
access_token: import_zod30.z.string().optional(),
|
|
11918
|
+
refresh_token: import_zod30.z.string().optional(),
|
|
11919
|
+
id_token: import_zod30.z.string().optional(),
|
|
11920
|
+
account_id: import_zod30.z.string().optional()
|
|
11755
11921
|
}).nullish(),
|
|
11756
|
-
last_refresh:
|
|
11922
|
+
last_refresh: import_zod30.z.string().optional()
|
|
11757
11923
|
});
|
|
11758
|
-
TokenGrantSchema =
|
|
11759
|
-
access_token:
|
|
11760
|
-
refresh_token:
|
|
11761
|
-
id_token:
|
|
11762
|
-
account_id:
|
|
11924
|
+
TokenGrantSchema = import_zod30.z.looseObject({
|
|
11925
|
+
access_token: import_zod30.z.string().min(1).optional(),
|
|
11926
|
+
refresh_token: import_zod30.z.string().min(1).optional(),
|
|
11927
|
+
id_token: import_zod30.z.string().min(1).optional(),
|
|
11928
|
+
account_id: import_zod30.z.string().min(1).optional()
|
|
11763
11929
|
});
|
|
11764
11930
|
CodexAuthError = class extends Error {
|
|
11765
11931
|
constructor(message) {
|
|
@@ -11771,31 +11937,31 @@ var init_auth = __esm({
|
|
|
11771
11937
|
});
|
|
11772
11938
|
|
|
11773
11939
|
// src/codex/siwc.ts
|
|
11774
|
-
var
|
|
11940
|
+
var import_zod31, SIWC_RESOURCE, SIWC_RESPONSES_URL, SIWC_PLAN_SCOPE, TokenResponseSchema, JwtHeaderSchema, IdTokenClaimsSchema, JwksSchema;
|
|
11775
11941
|
var init_siwc = __esm({
|
|
11776
11942
|
"src/codex/siwc.ts"() {
|
|
11777
11943
|
"use strict";
|
|
11778
|
-
|
|
11944
|
+
import_zod31 = require("zod");
|
|
11779
11945
|
SIWC_RESOURCE = "https://api.openai.com/v1";
|
|
11780
11946
|
SIWC_RESPONSES_URL = `${SIWC_RESOURCE}/responses`;
|
|
11781
11947
|
SIWC_PLAN_SCOPE = "chatgpt.tokens.use.direct";
|
|
11782
|
-
TokenResponseSchema =
|
|
11783
|
-
access_token:
|
|
11784
|
-
refresh_token:
|
|
11785
|
-
id_token:
|
|
11786
|
-
expires_in:
|
|
11787
|
-
scope:
|
|
11948
|
+
TokenResponseSchema = import_zod31.z.looseObject({
|
|
11949
|
+
access_token: import_zod31.z.string().min(1),
|
|
11950
|
+
refresh_token: import_zod31.z.string().min(1).optional(),
|
|
11951
|
+
id_token: import_zod31.z.string().min(1).optional(),
|
|
11952
|
+
expires_in: import_zod31.z.number().positive(),
|
|
11953
|
+
scope: import_zod31.z.string().optional()
|
|
11788
11954
|
});
|
|
11789
|
-
JwtHeaderSchema =
|
|
11790
|
-
IdTokenClaimsSchema =
|
|
11791
|
-
iss:
|
|
11792
|
-
sub:
|
|
11793
|
-
aud:
|
|
11794
|
-
exp:
|
|
11795
|
-
nonce:
|
|
11796
|
-
email:
|
|
11955
|
+
JwtHeaderSchema = import_zod31.z.looseObject({ alg: import_zod31.z.string(), kid: import_zod31.z.string().optional() });
|
|
11956
|
+
IdTokenClaimsSchema = import_zod31.z.looseObject({
|
|
11957
|
+
iss: import_zod31.z.string(),
|
|
11958
|
+
sub: import_zod31.z.string().min(1),
|
|
11959
|
+
aud: import_zod31.z.union([import_zod31.z.string(), import_zod31.z.array(import_zod31.z.string())]),
|
|
11960
|
+
exp: import_zod31.z.number(),
|
|
11961
|
+
nonce: import_zod31.z.string().optional(),
|
|
11962
|
+
email: import_zod31.z.string().optional()
|
|
11797
11963
|
});
|
|
11798
|
-
JwksSchema =
|
|
11964
|
+
JwksSchema = import_zod31.z.object({ keys: import_zod31.z.array(import_zod31.z.looseObject({ kid: import_zod31.z.string().optional(), kty: import_zod31.z.string() })) });
|
|
11799
11965
|
}
|
|
11800
11966
|
});
|
|
11801
11967
|
|
|
@@ -11813,25 +11979,25 @@ function parseSiwcFile(raw, filePath) {
|
|
|
11813
11979
|
}
|
|
11814
11980
|
return parsed.data;
|
|
11815
11981
|
}
|
|
11816
|
-
var
|
|
11982
|
+
var import_zod32, SiwcGrantSchema, SiwcFileSchema;
|
|
11817
11983
|
var init_siwcStore = __esm({
|
|
11818
11984
|
"src/codex/siwcStore.ts"() {
|
|
11819
11985
|
"use strict";
|
|
11820
|
-
|
|
11986
|
+
import_zod32 = require("zod");
|
|
11821
11987
|
init_auth();
|
|
11822
11988
|
init_siwc();
|
|
11823
|
-
SiwcGrantSchema =
|
|
11824
|
-
clientId:
|
|
11825
|
-
sub:
|
|
11826
|
-
email:
|
|
11827
|
-
idToken:
|
|
11828
|
-
accessToken:
|
|
11829
|
-
refreshToken:
|
|
11830
|
-
scopes:
|
|
11989
|
+
SiwcGrantSchema = import_zod32.z.strictObject({
|
|
11990
|
+
clientId: import_zod32.z.string().min(1),
|
|
11991
|
+
sub: import_zod32.z.string().min(1),
|
|
11992
|
+
email: import_zod32.z.string().optional(),
|
|
11993
|
+
idToken: import_zod32.z.string().min(1),
|
|
11994
|
+
accessToken: import_zod32.z.string().min(1),
|
|
11995
|
+
refreshToken: import_zod32.z.string().min(1),
|
|
11996
|
+
scopes: import_zod32.z.array(import_zod32.z.string()).readonly(),
|
|
11831
11997
|
/** When the access token stops working, in milliseconds since the epoch. */
|
|
11832
|
-
expiresAt:
|
|
11998
|
+
expiresAt: import_zod32.z.number()
|
|
11833
11999
|
});
|
|
11834
|
-
SiwcFileSchema =
|
|
12000
|
+
SiwcFileSchema = import_zod32.z.strictObject({ registeredClientId: import_zod32.z.string().min(1).optional(), grant: SiwcGrantSchema.optional() });
|
|
11835
12001
|
}
|
|
11836
12002
|
});
|
|
11837
12003
|
|
|
@@ -11899,7 +12065,7 @@ function parseCatalogueBinding(raw) {
|
|
|
11899
12065
|
}
|
|
11900
12066
|
}
|
|
11901
12067
|
function catalogueCredentialFingerprint(cli, token, accountId) {
|
|
11902
|
-
return (0,
|
|
12068
|
+
return (0, import_node_crypto14.createHash)("sha256").update(JSON.stringify([cli, token, accountId])).digest("hex");
|
|
11903
12069
|
}
|
|
11904
12070
|
function cliCatalogueFingerprint(raw) {
|
|
11905
12071
|
if (raw === void 0) return void 0;
|
|
@@ -11924,15 +12090,15 @@ function savedCatalogueFingerprint(provider, paths, env, home, read) {
|
|
|
11924
12090
|
const codexHome = configuredHome === void 0 || configuredHome === "" ? import_node_path40.default.join(home, ".codex") : configuredHome;
|
|
11925
12091
|
return cliCatalogueFingerprint(read(import_node_path40.default.join(codexHome, "auth.json")));
|
|
11926
12092
|
}
|
|
11927
|
-
var
|
|
12093
|
+
var import_node_crypto14, import_node_path40, import_zod33, CatalogueBindingSchema;
|
|
11928
12094
|
var init_catalogueCredential = __esm({
|
|
11929
12095
|
"src/codex/catalogueCredential.ts"() {
|
|
11930
12096
|
"use strict";
|
|
11931
|
-
|
|
12097
|
+
import_node_crypto14 = require("node:crypto");
|
|
11932
12098
|
import_node_path40 = __toESM(require("node:path"), 1);
|
|
11933
|
-
|
|
12099
|
+
import_zod33 = require("zod");
|
|
11934
12100
|
init_siwcStore();
|
|
11935
|
-
CatalogueBindingSchema =
|
|
12101
|
+
CatalogueBindingSchema = import_zod33.z.strictObject({ fingerprint: import_zod33.z.string().min(1), source: import_zod33.z.string().min(1), revision: import_zod33.z.string().min(1) });
|
|
11936
12102
|
}
|
|
11937
12103
|
});
|
|
11938
12104
|
|
|
@@ -11983,64 +12149,64 @@ var init_signatures = __esm({
|
|
|
11983
12149
|
});
|
|
11984
12150
|
|
|
11985
12151
|
// src/codex/anthropic.ts
|
|
11986
|
-
var
|
|
12152
|
+
var import_zod34, TextBlockSchema, Base64ImageSourceSchema, UrlImageSourceSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultContentBlockSchema, ToolResultBlockSchema, OtherBlockSchema, ContentBlockSchema, MessageSchema, ToolSchema, ToolChoiceSchema, SystemSchema, MessagesRequestSchema, CountTokensRequestSchema;
|
|
11987
12153
|
var init_anthropic = __esm({
|
|
11988
12154
|
"src/codex/anthropic.ts"() {
|
|
11989
12155
|
"use strict";
|
|
11990
|
-
|
|
11991
|
-
TextBlockSchema =
|
|
11992
|
-
Base64ImageSourceSchema =
|
|
11993
|
-
UrlImageSourceSchema =
|
|
11994
|
-
ImageBlockSchema =
|
|
11995
|
-
type:
|
|
11996
|
-
source:
|
|
12156
|
+
import_zod34 = require("zod");
|
|
12157
|
+
TextBlockSchema = import_zod34.z.looseObject({ type: import_zod34.z.literal("text"), text: import_zod34.z.string() });
|
|
12158
|
+
Base64ImageSourceSchema = import_zod34.z.looseObject({ type: import_zod34.z.literal("base64"), media_type: import_zod34.z.string().min(1), data: import_zod34.z.string() });
|
|
12159
|
+
UrlImageSourceSchema = import_zod34.z.looseObject({ type: import_zod34.z.literal("url"), url: import_zod34.z.string().min(1) });
|
|
12160
|
+
ImageBlockSchema = import_zod34.z.looseObject({
|
|
12161
|
+
type: import_zod34.z.literal("image"),
|
|
12162
|
+
source: import_zod34.z.union([Base64ImageSourceSchema, UrlImageSourceSchema])
|
|
11997
12163
|
});
|
|
11998
|
-
ToolUseBlockSchema =
|
|
11999
|
-
type:
|
|
12000
|
-
id:
|
|
12001
|
-
name:
|
|
12002
|
-
input:
|
|
12164
|
+
ToolUseBlockSchema = import_zod34.z.looseObject({
|
|
12165
|
+
type: import_zod34.z.literal("tool_use"),
|
|
12166
|
+
id: import_zod34.z.string().min(1),
|
|
12167
|
+
name: import_zod34.z.string().min(1),
|
|
12168
|
+
input: import_zod34.z.unknown()
|
|
12003
12169
|
});
|
|
12004
|
-
ToolResultContentBlockSchema =
|
|
12005
|
-
ToolResultBlockSchema =
|
|
12006
|
-
type:
|
|
12007
|
-
tool_use_id:
|
|
12008
|
-
content:
|
|
12170
|
+
ToolResultContentBlockSchema = import_zod34.z.union([TextBlockSchema, import_zod34.z.looseObject({ type: import_zod34.z.string() })]);
|
|
12171
|
+
ToolResultBlockSchema = import_zod34.z.looseObject({
|
|
12172
|
+
type: import_zod34.z.literal("tool_result"),
|
|
12173
|
+
tool_use_id: import_zod34.z.string().min(1),
|
|
12174
|
+
content: import_zod34.z.union([import_zod34.z.string(), import_zod34.z.array(ToolResultContentBlockSchema)]).optional()
|
|
12009
12175
|
});
|
|
12010
|
-
OtherBlockSchema =
|
|
12011
|
-
ContentBlockSchema =
|
|
12012
|
-
MessageSchema =
|
|
12013
|
-
role:
|
|
12014
|
-
content:
|
|
12176
|
+
OtherBlockSchema = import_zod34.z.looseObject({ type: import_zod34.z.string() });
|
|
12177
|
+
ContentBlockSchema = import_zod34.z.union([TextBlockSchema, ImageBlockSchema, ToolUseBlockSchema, ToolResultBlockSchema, OtherBlockSchema]);
|
|
12178
|
+
MessageSchema = import_zod34.z.looseObject({
|
|
12179
|
+
role: import_zod34.z.enum(["user", "assistant", "system"]),
|
|
12180
|
+
content: import_zod34.z.union([import_zod34.z.string(), import_zod34.z.array(ContentBlockSchema)])
|
|
12015
12181
|
});
|
|
12016
|
-
ToolSchema =
|
|
12017
|
-
name:
|
|
12018
|
-
description:
|
|
12019
|
-
input_schema:
|
|
12020
|
-
allowed_domains:
|
|
12021
|
-
blocked_domains:
|
|
12182
|
+
ToolSchema = import_zod34.z.looseObject({
|
|
12183
|
+
name: import_zod34.z.string().min(1),
|
|
12184
|
+
description: import_zod34.z.string().optional(),
|
|
12185
|
+
input_schema: import_zod34.z.record(import_zod34.z.string(), import_zod34.z.unknown()).optional(),
|
|
12186
|
+
allowed_domains: import_zod34.z.array(import_zod34.z.string()).optional(),
|
|
12187
|
+
blocked_domains: import_zod34.z.array(import_zod34.z.string()).optional()
|
|
12022
12188
|
});
|
|
12023
|
-
ToolChoiceSchema =
|
|
12024
|
-
|
|
12025
|
-
|
|
12189
|
+
ToolChoiceSchema = import_zod34.z.union([
|
|
12190
|
+
import_zod34.z.looseObject({ type: import_zod34.z.enum(["auto", "none", "any"]) }),
|
|
12191
|
+
import_zod34.z.looseObject({ type: import_zod34.z.literal("tool"), name: import_zod34.z.string().min(1) })
|
|
12026
12192
|
]);
|
|
12027
|
-
SystemSchema =
|
|
12028
|
-
MessagesRequestSchema =
|
|
12029
|
-
model:
|
|
12193
|
+
SystemSchema = import_zod34.z.union([import_zod34.z.string(), import_zod34.z.array(import_zod34.z.union([TextBlockSchema, OtherBlockSchema]))]);
|
|
12194
|
+
MessagesRequestSchema = import_zod34.z.looseObject({
|
|
12195
|
+
model: import_zod34.z.string().optional(),
|
|
12030
12196
|
system: SystemSchema.optional(),
|
|
12031
|
-
messages:
|
|
12032
|
-
tools:
|
|
12197
|
+
messages: import_zod34.z.array(MessageSchema),
|
|
12198
|
+
tools: import_zod34.z.array(ToolSchema).optional(),
|
|
12033
12199
|
tool_choice: ToolChoiceSchema.optional(),
|
|
12034
|
-
stream:
|
|
12200
|
+
stream: import_zod34.z.boolean().optional(),
|
|
12035
12201
|
/** `user_id` is stable for one Claude Code session and differs between sessions, which is what makes it the right key for both the backend's prompt cache and its session header. */
|
|
12036
|
-
metadata:
|
|
12202
|
+
metadata: import_zod34.z.looseObject({ user_id: import_zod34.z.string().optional() }).optional(),
|
|
12037
12203
|
/** Claude Code's effort setting. Any string is accepted; the translator honours only the levels the backend understands. */
|
|
12038
|
-
output_config:
|
|
12204
|
+
output_config: import_zod34.z.looseObject({ effort: import_zod34.z.string().optional(), format: import_zod34.z.object({ type: import_zod34.z.literal("json_schema"), schema: import_zod34.z.record(import_zod34.z.string(), import_zod34.z.unknown()) }).optional() }).optional()
|
|
12039
12205
|
});
|
|
12040
|
-
CountTokensRequestSchema =
|
|
12041
|
-
system:
|
|
12042
|
-
messages:
|
|
12043
|
-
tools:
|
|
12206
|
+
CountTokensRequestSchema = import_zod34.z.looseObject({
|
|
12207
|
+
system: import_zod34.z.unknown().optional(),
|
|
12208
|
+
messages: import_zod34.z.unknown().optional(),
|
|
12209
|
+
tools: import_zod34.z.unknown().optional()
|
|
12044
12210
|
});
|
|
12045
12211
|
}
|
|
12046
12212
|
});
|
|
@@ -12453,10 +12619,9 @@ function checkedProxyBypass(entries, source) {
|
|
|
12453
12619
|
}
|
|
12454
12620
|
return kept;
|
|
12455
12621
|
}
|
|
12456
|
-
function
|
|
12457
|
-
const
|
|
12458
|
-
|
|
12459
|
-
const added = hosts.filter((host) => {
|
|
12622
|
+
function appendedBypassHosts(existing, hosts) {
|
|
12623
|
+
const have = new Set((existing ?? "").split(",").map((entry) => entry.trim().toLowerCase()).filter((entry) => entry !== ""));
|
|
12624
|
+
return hosts.filter((host) => {
|
|
12460
12625
|
const key = host.toLowerCase();
|
|
12461
12626
|
if (have.has(key)) {
|
|
12462
12627
|
return false;
|
|
@@ -12464,7 +12629,10 @@ function withBypassHosts(existing, hosts) {
|
|
|
12464
12629
|
have.add(key);
|
|
12465
12630
|
return true;
|
|
12466
12631
|
});
|
|
12467
|
-
|
|
12632
|
+
}
|
|
12633
|
+
function withBypassHosts(existing, hosts) {
|
|
12634
|
+
const listed = (existing ?? "").split(",").map((entry) => entry.trim()).filter((entry) => entry !== "");
|
|
12635
|
+
return [...listed, ...appendedBypassHosts(existing, hosts)].join(",");
|
|
12468
12636
|
}
|
|
12469
12637
|
var init_proxyBypass2 = __esm({
|
|
12470
12638
|
"src/launcher/proxyBypass.ts"() {
|
|
@@ -12647,7 +12815,7 @@ function ensureFrontDoor(params) {
|
|
|
12647
12815
|
if (supervisorPid !== void 0 && !distrusted.has(supervisorPid) && ports.isRunning(supervisorPid)) {
|
|
12648
12816
|
if (state?.port !== void 0 && state.connectPort !== void 0) {
|
|
12649
12817
|
if (supervisorPid === params.launcherPid && params.replace === void 0 && ports.isFrontDoorSupervisor(supervisorPid)) {
|
|
12650
|
-
const token = (0,
|
|
12818
|
+
const token = (0, import_node_crypto15.randomUUID)();
|
|
12651
12819
|
writeFrontDoorSession(ports.fs, paths.frontdoorSessionsDir, { pid: params.launcherPid, startedAt: ports.now(), token, supervisorPid, ...recordOf(params.session) });
|
|
12652
12820
|
return { port: state.port, connectPort: state.connectPort, token, supervisorPid };
|
|
12653
12821
|
}
|
|
@@ -12668,7 +12836,7 @@ function ensureFrontDoor(params) {
|
|
|
12668
12836
|
continue;
|
|
12669
12837
|
}
|
|
12670
12838
|
if (verdict.ok) {
|
|
12671
|
-
const token = (0,
|
|
12839
|
+
const token = (0, import_node_crypto15.randomUUID)();
|
|
12672
12840
|
writeFrontDoorSession(ports.fs, paths.frontdoorSessionsDir, { pid: params.launcherPid, startedAt: ports.now(), token, supervisorPid, ...recordOf(params.session) });
|
|
12673
12841
|
return { port: state.port, connectPort: state.connectPort, token, supervisorPid };
|
|
12674
12842
|
}
|
|
@@ -12721,11 +12889,11 @@ function ensureFrontDoor(params) {
|
|
|
12721
12889
|
ports.sleep(FRONTDOOR_LAUNCHER_POLL_MS);
|
|
12722
12890
|
}
|
|
12723
12891
|
}
|
|
12724
|
-
var
|
|
12892
|
+
var import_node_crypto15, FRONTDOOR_START_TIMEOUT_MS, FRONTDOOR_LAUNCHER_POLL_MS, FRONTDOOR_PROBE_ATTEMPTS, FRONTDOOR_EXIT_GRACE_MS, FrontDoorStartError;
|
|
12725
12893
|
var init_ensure2 = __esm({
|
|
12726
12894
|
"src/frontdoor/ensure.ts"() {
|
|
12727
12895
|
"use strict";
|
|
12728
|
-
|
|
12896
|
+
import_node_crypto15 = require("node:crypto");
|
|
12729
12897
|
init_cliError();
|
|
12730
12898
|
init_state2();
|
|
12731
12899
|
init_replacement();
|
|
@@ -13035,43 +13203,6 @@ var init_cliOverride = __esm({
|
|
|
13035
13203
|
}
|
|
13036
13204
|
});
|
|
13037
13205
|
|
|
13038
|
-
// src/headroom/headers.ts
|
|
13039
|
-
function mergeAnthropicCustomHeaders(existing, additions) {
|
|
13040
|
-
const merged = /* @__PURE__ */ new Map();
|
|
13041
|
-
for (const block of existing) {
|
|
13042
|
-
if (block === void 0) {
|
|
13043
|
-
continue;
|
|
13044
|
-
}
|
|
13045
|
-
for (const line of block.split("\n")) {
|
|
13046
|
-
const entry = parseCustomHeaderLine(line);
|
|
13047
|
-
if (entry === void 0) {
|
|
13048
|
-
continue;
|
|
13049
|
-
}
|
|
13050
|
-
merged.set(entry.name, entry.value);
|
|
13051
|
-
}
|
|
13052
|
-
}
|
|
13053
|
-
for (const entry of additions) {
|
|
13054
|
-
merged.set(entry.name, entry.value);
|
|
13055
|
-
}
|
|
13056
|
-
return [...merged].map(([name, value]) => `${name}: ${value}`).join("\n");
|
|
13057
|
-
}
|
|
13058
|
-
function parseCustomHeaderLine(line) {
|
|
13059
|
-
const trimmed = line.trim();
|
|
13060
|
-
if (trimmed === "") {
|
|
13061
|
-
return void 0;
|
|
13062
|
-
}
|
|
13063
|
-
const colon = trimmed.indexOf(":");
|
|
13064
|
-
if (colon <= 0) {
|
|
13065
|
-
return void 0;
|
|
13066
|
-
}
|
|
13067
|
-
return { name: trimmed.slice(0, colon).trim(), value: trimmed.slice(colon + 1).trim() };
|
|
13068
|
-
}
|
|
13069
|
-
var init_headers = __esm({
|
|
13070
|
-
"src/headroom/headers.ts"() {
|
|
13071
|
-
"use strict";
|
|
13072
|
-
}
|
|
13073
|
-
});
|
|
13074
|
-
|
|
13075
13206
|
// src/statusline/settings.ts
|
|
13076
13207
|
function checkedStatusline(settings, source) {
|
|
13077
13208
|
try {
|
|
@@ -13154,7 +13285,10 @@ function buildArgv(params) {
|
|
|
13154
13285
|
return [...params.toolFlags, ...params.extraFlags, ...params.passthrough];
|
|
13155
13286
|
}
|
|
13156
13287
|
function buildEnv(params) {
|
|
13157
|
-
const
|
|
13288
|
+
const injections = recordInjections(params.baseEnv);
|
|
13289
|
+
const { env } = injections;
|
|
13290
|
+
const inject = injections.set;
|
|
13291
|
+
const injectedHeaderNames = [];
|
|
13158
13292
|
const parentCustomHeaders = params.baseEnv.ANTHROPIC_CUSTOM_HEADERS;
|
|
13159
13293
|
let providerCustomHeaders;
|
|
13160
13294
|
if (!params.configDirEscapeHatch && params.identityId !== void 0) {
|
|
@@ -13163,53 +13297,75 @@ function buildEnv(params) {
|
|
|
13163
13297
|
if (params.provider !== void 0) {
|
|
13164
13298
|
const providerEnv = params.provider.definition.kind !== void 0 && params.provider.definition.kind !== "http" ? {} : params.provider.definition.env ?? {};
|
|
13165
13299
|
providerCustomHeaders = providerEnv.ANTHROPIC_CUSTOM_HEADERS;
|
|
13166
|
-
|
|
13167
|
-
|
|
13300
|
+
injections.unset("ANTHROPIC_BASE_URL");
|
|
13301
|
+
inject("AGENT_SHIM_PROVIDER", params.provider.definition.displayName);
|
|
13168
13302
|
for (const [key, value] of Object.entries(providerEnv)) {
|
|
13169
|
-
|
|
13303
|
+
if (key === CUSTOM_HEADERS_ENV) {
|
|
13304
|
+
env[key] = value;
|
|
13305
|
+
injectedHeaderNames.push(...parseAnthropicCustomHeaders(value).map(({ name }) => name));
|
|
13306
|
+
} else if (key === "NO_PROXY" || key === "no_proxy") {
|
|
13307
|
+
env[key] = value;
|
|
13308
|
+
injections.recordBypassHosts(key, value.split(","));
|
|
13309
|
+
} else {
|
|
13310
|
+
inject(key, value);
|
|
13311
|
+
}
|
|
13170
13312
|
}
|
|
13171
13313
|
}
|
|
13172
13314
|
for (const tier of CLAUDE_TIERS) {
|
|
13173
13315
|
const ref = params.tierModels?.[tier];
|
|
13174
13316
|
if (ref !== void 0) {
|
|
13175
|
-
|
|
13317
|
+
inject(`ANTHROPIC_DEFAULT_${tier.toUpperCase()}_MODEL`, ref);
|
|
13176
13318
|
}
|
|
13177
13319
|
}
|
|
13178
13320
|
if (params.provider !== void 0) {
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
-
|
|
13321
|
+
if (params.remoteControl) {
|
|
13322
|
+
injections.unset("ANTHROPIC_AUTH_TOKEN");
|
|
13323
|
+
} else {
|
|
13324
|
+
inject("ANTHROPIC_AUTH_TOKEN", PROVIDER_SESSION_PLACEHOLDER);
|
|
13325
|
+
}
|
|
13326
|
+
injections.unset("ANTHROPIC_API_KEY");
|
|
13327
|
+
injections.unset("CLAUDE_CODE_OAUTH_TOKEN");
|
|
13182
13328
|
} else if (params.identityCredential !== void 0) {
|
|
13183
13329
|
for (const [variable, value] of Object.entries(credentialVariables(params.identityCredential.target, params.identityCredential.token))) {
|
|
13184
|
-
|
|
13330
|
+
if (value === void 0) {
|
|
13331
|
+
injections.unset(variable);
|
|
13332
|
+
} else {
|
|
13333
|
+
inject(variable, value);
|
|
13334
|
+
}
|
|
13185
13335
|
}
|
|
13186
13336
|
}
|
|
13187
13337
|
if (params.frontdoor !== void 0) {
|
|
13338
|
+
const launcherHeaders = [
|
|
13339
|
+
...params.identityId === void 0 ? [] : [{ name: IDENTITY_HEADER, value: params.identityId }],
|
|
13340
|
+
{ name: SESSION_HEADER, value: params.sessionId },
|
|
13341
|
+
{ name: AUTH_HEADER, value: params.frontdoor.sessionToken },
|
|
13342
|
+
...params.provider === void 0 ? [] : [{ name: PROVIDER_HEADER, value: params.provider.name }],
|
|
13343
|
+
...params.headroom === void 0 ? [] : [
|
|
13344
|
+
{ name: HEADROOM_FLAG_HEADER, value: "1" },
|
|
13345
|
+
{ name: PROJECT_ID_HEADER, value: params.headroom.projectId }
|
|
13346
|
+
]
|
|
13347
|
+
];
|
|
13348
|
+
injectedHeaderNames.push(...launcherHeaders.map(({ name }) => name));
|
|
13188
13349
|
env.ANTHROPIC_CUSTOM_HEADERS = mergeAnthropicCustomHeaders(
|
|
13189
13350
|
[
|
|
13190
13351
|
...parentCustomHeaders === void 0 ? [] : [parentCustomHeaders],
|
|
13191
13352
|
...providerCustomHeaders === void 0 ? [] : [providerCustomHeaders]
|
|
13192
13353
|
],
|
|
13193
|
-
|
|
13194
|
-
...params.identityId === void 0 ? [] : [{ name: IDENTITY_HEADER, value: params.identityId }],
|
|
13195
|
-
{ name: SESSION_HEADER, value: params.sessionId },
|
|
13196
|
-
{ name: AUTH_HEADER, value: params.frontdoor.sessionToken },
|
|
13197
|
-
...params.provider === void 0 ? [] : [{ name: PROVIDER_HEADER, value: params.provider.name }],
|
|
13198
|
-
...params.headroom === void 0 ? [] : [
|
|
13199
|
-
{ name: HEADROOM_FLAG_HEADER, value: "1" },
|
|
13200
|
-
{ name: PROJECT_ID_HEADER, value: params.headroom.projectId }
|
|
13201
|
-
]
|
|
13202
|
-
]
|
|
13354
|
+
launcherHeaders
|
|
13203
13355
|
);
|
|
13204
|
-
|
|
13205
|
-
|
|
13356
|
+
inject("NODE_EXTRA_CA_CERTS", params.frontdoor.trustBundlePath);
|
|
13357
|
+
inject("HTTPS_PROXY", connectProxyUrl(params.frontdoor.connectPort, params.frontdoor.sessionToken));
|
|
13206
13358
|
const bypassed = [...LOOPBACK_HOSTS, ...params.proxyBypass ?? []];
|
|
13207
|
-
|
|
13208
|
-
|
|
13359
|
+
for (const list of ["NO_PROXY", "no_proxy"]) {
|
|
13360
|
+
injections.recordBypassHosts(list, appendedBypassHosts(env[list], bypassed));
|
|
13361
|
+
env[list] = withBypassHosts(env[list], bypassed);
|
|
13362
|
+
}
|
|
13209
13363
|
}
|
|
13210
13364
|
if (params.statusline !== void 0) {
|
|
13211
|
-
|
|
13365
|
+
inject(STATUSLINE_ENV, JSON.stringify(params.statusline));
|
|
13212
13366
|
}
|
|
13367
|
+
injections.recordHeaders(injectedHeaderNames);
|
|
13368
|
+
injections.finish();
|
|
13213
13369
|
return env;
|
|
13214
13370
|
}
|
|
13215
13371
|
var import_node_path48, LOOPBACK_HOSTS, PROVIDER_SESSION_PLACEHOLDER;
|
|
@@ -13223,6 +13379,7 @@ var init_flags = __esm({
|
|
|
13223
13379
|
init_schema();
|
|
13224
13380
|
init_credential();
|
|
13225
13381
|
init_headers();
|
|
13382
|
+
init_injected();
|
|
13226
13383
|
init_capability();
|
|
13227
13384
|
init_route();
|
|
13228
13385
|
init_statusline();
|
|
@@ -13981,19 +14138,18 @@ function pickFromPool(decided, params, parsedArgv, readOnly) {
|
|
|
13981
14138
|
...resolution.lastRanAs === void 0 ? {} : { lastRanAs: { identity: resolution.lastRanAs.identity, agoMs: farmRuntime.now() - Date.parse(resolution.lastRanAs.at) } }
|
|
13982
14139
|
};
|
|
13983
14140
|
}
|
|
14141
|
+
function warnOfSupersededConfigDir(warn, fs17, superseded, identity, identityDir) {
|
|
14142
|
+
if (superseded === void 0 || superseded === identityDir || fs17.sameDirectory(superseded, identityDir)) {
|
|
14143
|
+
return;
|
|
14144
|
+
}
|
|
14145
|
+
warn(`agent-shim: the identity named on the command line outranks the inherited CLAUDE_CONFIG_DIR ${superseded}; running as ${identity} in ${identityDir}`);
|
|
14146
|
+
}
|
|
13984
14147
|
function decideLaunch(params, readOnly, onRecorded) {
|
|
13985
14148
|
const { paths, fs: fs17, proc, log } = params;
|
|
13986
|
-
const {
|
|
14149
|
+
const { argv } = proc;
|
|
13987
14150
|
const parsedArgv = parseLauncherArgv(argv);
|
|
13988
|
-
const cliOverride = buildCliOverride({
|
|
13989
|
-
env,
|
|
13990
|
-
categoryFlags: parsedArgv.categoryFlags,
|
|
13991
|
-
shareFlags: parsedArgv.shareFlags,
|
|
13992
|
-
hideFlags: parsedArgv.hideFlags
|
|
13993
|
-
});
|
|
13994
|
-
const configDirEscapeHatchApplies = env.CLAUDE_CONFIG_DIR !== void 0 && env.CLAUDE_CONFIG_DIR !== "";
|
|
13995
14151
|
const decidedIdentity = decideIdentity({
|
|
13996
|
-
env,
|
|
14152
|
+
env: proc.env,
|
|
13997
14153
|
argv0Identity: params.pickedIdentity ?? parsedArgv.identity,
|
|
13998
14154
|
directoryPinnedIdentity: params.directoryPinnedIdentity,
|
|
13999
14155
|
readActiveIdentityFile: () => {
|
|
@@ -14005,6 +14161,14 @@ function decideLaunch(params, readOnly, onRecorded) {
|
|
|
14005
14161
|
return trimmed === "" ? void 0 : trimmed;
|
|
14006
14162
|
}
|
|
14007
14163
|
});
|
|
14164
|
+
const configDirEscapeHatchApplies = decidedIdentity.configDirEscapeHatch;
|
|
14165
|
+
const env = launchEnvironment(proc.env, configDirEscapeHatchApplies);
|
|
14166
|
+
const cliOverride = buildCliOverride({
|
|
14167
|
+
env,
|
|
14168
|
+
categoryFlags: parsedArgv.categoryFlags,
|
|
14169
|
+
shareFlags: parsedArgv.shareFlags,
|
|
14170
|
+
hideFlags: parsedArgv.hideFlags
|
|
14171
|
+
});
|
|
14008
14172
|
const { identityDecision, poolPick, poolRanking, lastRanAs } = pickFromPool(decidedIdentity, params, parsedArgv, readOnly);
|
|
14009
14173
|
const lockFarm = !readOnly && !configDirEscapeHatchApplies && identityDecision.name !== void 0 ? params.farm : void 0;
|
|
14010
14174
|
const lockPorts = params.namesLock ?? (lockFarm === void 0 ? realIdentityNamesLockPorts : { fs: lockFarm.fs, nowMs: lockFarm.now, ...lockFarm.lock });
|
|
@@ -14012,6 +14176,9 @@ function decideLaunch(params, readOnly, onRecorded) {
|
|
|
14012
14176
|
try {
|
|
14013
14177
|
const farmIdentity = configDirEscapeHatchApplies || identityDecision.name === void 0 ? void 0 : resolveIdentityId(paths.identitiesDir, identityDecision.name, fs17);
|
|
14014
14178
|
const farm = farmIdentity === void 0 ? void 0 : params.farm;
|
|
14179
|
+
if (!readOnly && params.supervised?.member === void 0 && farmIdentity !== void 0 && identityDecision.name !== void 0) {
|
|
14180
|
+
warnOfSupersededConfigDir(log.warn, fs17, identityDecision.supersededConfigDir, identityDecision.name, import_node_path50.default.join(paths.identitiesDir, farmIdentity));
|
|
14181
|
+
}
|
|
14015
14182
|
if (!readOnly && farm !== void 0 && farmIdentity !== void 0) {
|
|
14016
14183
|
try {
|
|
14017
14184
|
recoverFarmWarning(
|
|
@@ -14178,7 +14345,7 @@ function decideLaunch(params, readOnly, onRecorded) {
|
|
|
14178
14345
|
const doorPid = supervisorPid ?? (recordedPid !== void 0 && proc.isProcessAlive(recordedPid) ? recordedPid : void 0);
|
|
14179
14346
|
const doorRecord = doorPid === void 0 ? void 0 : readFrontDoorCodexRecord(params.fs, paths.frontdoorDir, doorPid);
|
|
14180
14347
|
const doorHome = doorRecord?.codexHome;
|
|
14181
|
-
const catalogueEnv = doorHome === void 0 ?
|
|
14348
|
+
const catalogueEnv = doorHome === void 0 ? env : { ...env, CODEX_HOME: doorHome };
|
|
14182
14349
|
const listedProviders = listProviderNames(fs17.readdir, paths.providersDir).flatMap((name) => {
|
|
14183
14350
|
try {
|
|
14184
14351
|
const definition = loadProvider(paths.providersDir, name, fs17);
|
|
@@ -14240,6 +14407,7 @@ function decideLaunch(params, readOnly, onRecorded) {
|
|
|
14240
14407
|
billing,
|
|
14241
14408
|
notes,
|
|
14242
14409
|
configDirEscapeHatch: configDirEscapeHatchApplies,
|
|
14410
|
+
env,
|
|
14243
14411
|
farmIdentity,
|
|
14244
14412
|
farmContext,
|
|
14245
14413
|
configProfileDecision,
|
|
@@ -14275,12 +14443,12 @@ function prepareLaunch(params) {
|
|
|
14275
14443
|
}
|
|
14276
14444
|
function prepareRegisteredLaunch(params, onRecorded) {
|
|
14277
14445
|
const { paths, proc, log } = params;
|
|
14278
|
-
const { env } = proc;
|
|
14279
14446
|
let unregisterLaunch;
|
|
14280
14447
|
const decided = decideLaunch(params, false, (remove) => {
|
|
14281
14448
|
unregisterLaunch = remove;
|
|
14282
14449
|
onRecorded(remove);
|
|
14283
14450
|
});
|
|
14451
|
+
const { env } = decided;
|
|
14284
14452
|
const { identityDecision, configProfileDecision, resolvedProvider, identityCredential, poolPick, poolRanking, lastRanAs, billing, notes, flags: resolvedFlags, configDirEscapeHatch: configDirEscapeHatchApplies, decision } = decided;
|
|
14285
14453
|
const rows = [
|
|
14286
14454
|
...decisionRows({
|
|
@@ -14355,7 +14523,7 @@ function prepareRegisteredLaunch(params, onRecorded) {
|
|
|
14355
14523
|
log.error("agent-shim: this launch routes through the front-door daemon, but this launcher has no front-door port wired; refusing to launch without it.");
|
|
14356
14524
|
proc.exit(1);
|
|
14357
14525
|
}
|
|
14358
|
-
const sessionId = params.supervised?.sessionId ?? (0,
|
|
14526
|
+
const sessionId = params.supervised?.sessionId ?? (0, import_node_crypto16.randomUUID)();
|
|
14359
14527
|
const resolvedModels = decided.models ?? (decided.globalModels === void 0 ? void 0 : {});
|
|
14360
14528
|
const sessionModels = (0, import_node_util2.isDeepStrictEqual)(resolvedModels, decided.globalModels) ? void 0 : resolvedModels;
|
|
14361
14529
|
const session = { sessionId, ...sessionModels === void 0 ? {} : { models: sessionModels } };
|
|
@@ -14416,7 +14584,7 @@ function prepareRegisteredLaunch(params, onRecorded) {
|
|
|
14416
14584
|
}
|
|
14417
14585
|
function resolveLaunch(params) {
|
|
14418
14586
|
const decided = decideLaunch(params, true);
|
|
14419
|
-
const { env } =
|
|
14587
|
+
const { env } = decided;
|
|
14420
14588
|
const frontDoor = decided.provider !== void 0 || decided.flags.headroom || decided.flags.trackUsage;
|
|
14421
14589
|
const built = buildEnv({
|
|
14422
14590
|
baseEnv: env,
|
|
@@ -14432,7 +14600,7 @@ function resolveLaunch(params) {
|
|
|
14432
14600
|
...decided.flags.statusline === void 0 ? {} : { statusline: decided.flags.statusline }
|
|
14433
14601
|
});
|
|
14434
14602
|
const credentialNames = decided.identityCredentialBlock === void 0 ? [] : Object.keys(credentialVariables(decided.identityCredentialBlock.target ?? "bearer", ""));
|
|
14435
|
-
const environment = [.../* @__PURE__ */ new Set([...Object.keys(built).filter((name) => built[name] !== env[name]), ...credentialNames])].sort();
|
|
14603
|
+
const environment = [.../* @__PURE__ */ new Set([...Object.keys(built).filter((name) => name !== INJECTED_ENV && built[name] !== env[name]), ...credentialNames])].sort();
|
|
14436
14604
|
const credential = decided.provider !== void 0 ? isRouterProvider(decided.provider.definition) ? void 0 : { subject: "provider", name: decided.provider.name, summary: summariseCredential(decided.provider.definition.credential) } : decided.identityCredentialBlock !== void 0 && decided.farmIdentity !== void 0 && decided.identityDecision.name !== void 0 ? { subject: "identity", name: decided.identityDecision.name, summary: summariseCredential(decided.identityCredentialBlock) } : void 0;
|
|
14437
14605
|
return {
|
|
14438
14606
|
decision: decided.decision,
|
|
@@ -14463,11 +14631,11 @@ function runLaunchPlan(plan, spawn3) {
|
|
|
14463
14631
|
function runLauncher(params) {
|
|
14464
14632
|
params.proc.exit(runLaunchPlan(prepareLaunch(params), params.spawn));
|
|
14465
14633
|
}
|
|
14466
|
-
var
|
|
14634
|
+
var import_node_crypto16, import_node_os8, import_node_util2, import_node_path50;
|
|
14467
14635
|
var init_launcher = __esm({
|
|
14468
14636
|
"src/launcher.ts"() {
|
|
14469
14637
|
"use strict";
|
|
14470
|
-
|
|
14638
|
+
import_node_crypto16 = require("node:crypto");
|
|
14471
14639
|
import_node_os8 = __toESM(require("node:os"), 1);
|
|
14472
14640
|
init_catalogueCredential();
|
|
14473
14641
|
import_node_util2 = require("node:util");
|
|
@@ -14513,6 +14681,7 @@ var init_launcher = __esm({
|
|
|
14513
14681
|
init_launchHook();
|
|
14514
14682
|
init_targets();
|
|
14515
14683
|
init_names();
|
|
14684
|
+
init_injected();
|
|
14516
14685
|
}
|
|
14517
14686
|
});
|
|
14518
14687
|
|
|
@@ -14598,18 +14767,18 @@ function resolveTrustBundle(params) {
|
|
|
14598
14767
|
}
|
|
14599
14768
|
const combined = `${inheritedPem.trimEnd()}
|
|
14600
14769
|
${caPem}`;
|
|
14601
|
-
const bundle = import_node_path52.default.join(bundlesDir, `${(0,
|
|
14770
|
+
const bundle = import_node_path52.default.join(bundlesDir, `${(0, import_node_crypto17.createHash)("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
|
|
14602
14771
|
if (!fs17.exists(bundle)) {
|
|
14603
14772
|
fs17.mkdirp(bundlesDir);
|
|
14604
14773
|
fs17.writeFileAtomic(bundle, combined);
|
|
14605
14774
|
}
|
|
14606
14775
|
return { path: bundle };
|
|
14607
14776
|
}
|
|
14608
|
-
var
|
|
14777
|
+
var import_node_crypto17, import_node_path52, BUNDLE_NAME_HEX_DIGITS;
|
|
14609
14778
|
var init_trust = __esm({
|
|
14610
14779
|
"src/frontdoor/trust.ts"() {
|
|
14611
14780
|
"use strict";
|
|
14612
|
-
|
|
14781
|
+
import_node_crypto17 = require("node:crypto");
|
|
14613
14782
|
import_node_path52 = __toESM(require("node:path"), 1);
|
|
14614
14783
|
BUNDLE_NAME_HEX_DIGITS = 16;
|
|
14615
14784
|
}
|
|
@@ -14769,7 +14938,7 @@ function buildFarmRuntime(paths, cwd, run = realRunPort) {
|
|
|
14769
14938
|
...cliOverride === void 0 ? {} : { cliOverride }
|
|
14770
14939
|
}).input,
|
|
14771
14940
|
now: () => Date.now(),
|
|
14772
|
-
uniqueSuffix: `${String(process.pid)}.${(0,
|
|
14941
|
+
uniqueSuffix: `${String(process.pid)}.${(0, import_node_crypto18.randomUUID)()}`,
|
|
14773
14942
|
// Zombie-aware on purpose: a previous launcher that crashed out of a resync without releasing the lock may sit unreaped, still answering signal 0 as alive, and must read as a dead holder so this launch takes the lock over instead of timing out.
|
|
14774
14943
|
lock: { pid: process.pid, isRunning: realIsProcessRunning, sleep: realSleepSync }
|
|
14775
14944
|
},
|
|
@@ -14857,13 +15026,13 @@ function resolveClaudeLaunch(options, run = realRunPort) {
|
|
|
14857
15026
|
};
|
|
14858
15027
|
return { resolution: resolveLaunch(realPrepareLaunchParams(paths, { proc, log, spawnDaemon, run, farm: buildFarmRuntime(paths, options.cwd, run) })), warnings };
|
|
14859
15028
|
}
|
|
14860
|
-
var import_node_os10, import_node_path53,
|
|
15029
|
+
var import_node_os10, import_node_path53, import_node_crypto18, LaunchRefusedError;
|
|
14861
15030
|
var init_launchWiring = __esm({
|
|
14862
15031
|
"src/launchWiring.ts"() {
|
|
14863
15032
|
"use strict";
|
|
14864
15033
|
import_node_os10 = __toESM(require("node:os"), 1);
|
|
14865
15034
|
import_node_path53 = __toESM(require("node:path"), 1);
|
|
14866
|
-
|
|
15035
|
+
import_node_crypto18 = require("node:crypto");
|
|
14867
15036
|
init_cliError();
|
|
14868
15037
|
init_claudeShim();
|
|
14869
15038
|
init_classify();
|
|
@@ -15036,7 +15205,7 @@ function identityLaunchArgv(identity, flags) {
|
|
|
15036
15205
|
}
|
|
15037
15206
|
async function withIdentityClaude(params, identity, flags, use) {
|
|
15038
15207
|
const refusals = [];
|
|
15039
|
-
const env =
|
|
15208
|
+
const env = { ...process.env };
|
|
15040
15209
|
const argv = [...identityLaunchArgv(identity, flags)];
|
|
15041
15210
|
const run = await recordRuns((replay) => resolveClaudeLaunch({ argv, cwd: params.cwd, env: definedEnvironment(env), paths: params.paths }, replay), params.runAsync ?? realRunAsync);
|
|
15042
15211
|
const farm = buildFarmRuntime(params.paths, params.cwd, run);
|
|
@@ -15074,7 +15243,7 @@ async function withIdentityClaude(params, identity, flags, use) {
|
|
|
15074
15243
|
plan.release();
|
|
15075
15244
|
}
|
|
15076
15245
|
}
|
|
15077
|
-
var
|
|
15246
|
+
var IDENTITY_ONLY_FLAG;
|
|
15078
15247
|
var init_identityClaude = __esm({
|
|
15079
15248
|
"src/usage/identityClaude.ts"() {
|
|
15080
15249
|
"use strict";
|
|
@@ -15083,17 +15252,16 @@ var init_identityClaude = __esm({
|
|
|
15083
15252
|
init_realPorts();
|
|
15084
15253
|
init_replayRun();
|
|
15085
15254
|
init_identityNamesLock();
|
|
15086
|
-
CONFIG_DIR_VARIABLE = "CLAUDE_CONFIG_DIR";
|
|
15087
15255
|
IDENTITY_ONLY_FLAG = "--no-provider";
|
|
15088
15256
|
}
|
|
15089
15257
|
});
|
|
15090
15258
|
|
|
15091
15259
|
// src/usage/providerQuota.ts
|
|
15092
|
-
var
|
|
15260
|
+
var import_zod43, MS_PER_SECOND9, SECONDS_PER_HOUR3, HOURS_PER_DAY6, 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_DAY2, OpenRouterKeySchema, OpenRouterCreditsSchema, ANTIGRAVITY_HOST, ANTIGRAVITY_QUOTA_URL, ANTIGRAVITY_USER_URL, FIVE_HOURS2, DAYS_PER_WEEK2, FIVE_HOURS_MS, WEEK_MS, AntigravityBucketSchema, AntigravitySummarySchema, GoogleTokenInfoSchema, AntigravityUserSchema;
|
|
15093
15261
|
var init_providerQuota = __esm({
|
|
15094
15262
|
"src/usage/providerQuota.ts"() {
|
|
15095
15263
|
"use strict";
|
|
15096
|
-
|
|
15264
|
+
import_zod43 = require("zod");
|
|
15097
15265
|
init_cloudUpstream();
|
|
15098
15266
|
init_schema2();
|
|
15099
15267
|
MS_PER_SECOND9 = 1e3;
|
|
@@ -15108,35 +15276,35 @@ var init_providerQuota = __esm({
|
|
|
15108
15276
|
[ZAI_UNIT_HOURS, SECONDS_PER_HOUR3 * MS_PER_SECOND9],
|
|
15109
15277
|
[ZAI_UNIT_MONTHS, DAYS_PER_MONTH * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9]
|
|
15110
15278
|
]);
|
|
15111
|
-
ZaiLimitSchema =
|
|
15112
|
-
type:
|
|
15113
|
-
unit:
|
|
15114
|
-
number:
|
|
15115
|
-
percentage:
|
|
15116
|
-
nextResetTime:
|
|
15117
|
-
usage:
|
|
15118
|
-
currentValue:
|
|
15119
|
-
remaining:
|
|
15279
|
+
ZaiLimitSchema = import_zod43.z.object({
|
|
15280
|
+
type: import_zod43.z.string(),
|
|
15281
|
+
unit: import_zod43.z.number().int(),
|
|
15282
|
+
number: import_zod43.z.number().int().positive(),
|
|
15283
|
+
percentage: import_zod43.z.number().nonnegative(),
|
|
15284
|
+
nextResetTime: import_zod43.z.number().positive().optional(),
|
|
15285
|
+
usage: import_zod43.z.number().nonnegative().optional(),
|
|
15286
|
+
currentValue: import_zod43.z.number().nonnegative().optional(),
|
|
15287
|
+
remaining: import_zod43.z.number().nonnegative().optional()
|
|
15120
15288
|
});
|
|
15121
|
-
ZaiResponseSchema =
|
|
15122
|
-
success:
|
|
15123
|
-
msg:
|
|
15124
|
-
data:
|
|
15289
|
+
ZaiResponseSchema = import_zod43.z.object({
|
|
15290
|
+
success: import_zod43.z.boolean(),
|
|
15291
|
+
msg: import_zod43.z.string().optional(),
|
|
15292
|
+
data: import_zod43.z.object({ level: import_zod43.z.string().optional(), limits: import_zod43.z.array(ZaiLimitSchema) })
|
|
15125
15293
|
});
|
|
15126
15294
|
OPENROUTER_HOST = "openrouter.ai";
|
|
15127
15295
|
OPENROUTER_KEY_URL = `https://${OPENROUTER_HOST}/api/v1/key`;
|
|
15128
15296
|
OPENROUTER_CREDITS_URL = `https://${OPENROUTER_HOST}/api/v1/credits`;
|
|
15129
15297
|
MS_PER_DAY2 = HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
15130
|
-
OpenRouterKeySchema =
|
|
15131
|
-
data:
|
|
15132
|
-
limit:
|
|
15133
|
-
limit_remaining:
|
|
15134
|
-
limit_reset:
|
|
15135
|
-
is_free_tier:
|
|
15136
|
-
free_model_daily_requests:
|
|
15298
|
+
OpenRouterKeySchema = import_zod43.z.object({
|
|
15299
|
+
data: import_zod43.z.object({
|
|
15300
|
+
limit: import_zod43.z.number().nonnegative().nullable(),
|
|
15301
|
+
limit_remaining: import_zod43.z.number().nullable(),
|
|
15302
|
+
limit_reset: import_zod43.z.string().nullable(),
|
|
15303
|
+
is_free_tier: import_zod43.z.boolean().optional(),
|
|
15304
|
+
free_model_daily_requests: import_zod43.z.object({ used: import_zod43.z.number().nonnegative(), limit: import_zod43.z.number().nonnegative(), remaining: import_zod43.z.number() }).optional()
|
|
15137
15305
|
})
|
|
15138
15306
|
});
|
|
15139
|
-
OpenRouterCreditsSchema =
|
|
15307
|
+
OpenRouterCreditsSchema = import_zod43.z.object({ data: import_zod43.z.object({ total_credits: import_zod43.z.number().nonnegative(), total_usage: import_zod43.z.number().nonnegative() }) });
|
|
15140
15308
|
ANTIGRAVITY_HOST = "daily-cloudcode-pa.googleapis.com";
|
|
15141
15309
|
ANTIGRAVITY_QUOTA_URL = `https://${ANTIGRAVITY_HOST}/v1internal:retrieveUserQuotaSummary`;
|
|
15142
15310
|
ANTIGRAVITY_USER_URL = `https://${ANTIGRAVITY_HOST}/v1internal:loadCodeAssist`;
|
|
@@ -15144,21 +15312,21 @@ var init_providerQuota = __esm({
|
|
|
15144
15312
|
DAYS_PER_WEEK2 = 7;
|
|
15145
15313
|
FIVE_HOURS_MS = FIVE_HOURS2 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
15146
15314
|
WEEK_MS = DAYS_PER_WEEK2 * HOURS_PER_DAY6 * SECONDS_PER_HOUR3 * MS_PER_SECOND9;
|
|
15147
|
-
AntigravityBucketSchema =
|
|
15148
|
-
bucketId:
|
|
15149
|
-
remainingFraction:
|
|
15150
|
-
resetTime:
|
|
15315
|
+
AntigravityBucketSchema = import_zod43.z.object({
|
|
15316
|
+
bucketId: import_zod43.z.string(),
|
|
15317
|
+
remainingFraction: import_zod43.z.number().optional(),
|
|
15318
|
+
resetTime: import_zod43.z.string().optional()
|
|
15151
15319
|
});
|
|
15152
|
-
AntigravitySummarySchema =
|
|
15153
|
-
GoogleTokenInfoSchema =
|
|
15154
|
-
email:
|
|
15155
|
-
sub:
|
|
15320
|
+
AntigravitySummarySchema = import_zod43.z.object({ groups: import_zod43.z.array(import_zod43.z.object({ buckets: import_zod43.z.array(AntigravityBucketSchema) })) });
|
|
15321
|
+
GoogleTokenInfoSchema = import_zod43.z.object({
|
|
15322
|
+
email: import_zod43.z.string().optional(),
|
|
15323
|
+
sub: import_zod43.z.string().optional()
|
|
15156
15324
|
});
|
|
15157
|
-
AntigravityUserSchema =
|
|
15325
|
+
AntigravityUserSchema = import_zod43.z.object({
|
|
15158
15326
|
/** The code-assist tier context, which defaults to the free tier for every account. */
|
|
15159
|
-
currentTier:
|
|
15327
|
+
currentTier: import_zod43.z.object({ name: import_zod43.z.string().optional(), id: import_zod43.z.string().optional() }).optional(),
|
|
15160
15328
|
/** The account's paid subscription; absent when the account has none. */
|
|
15161
|
-
paidTier:
|
|
15329
|
+
paidTier: import_zod43.z.object({ name: import_zod43.z.string().optional(), id: import_zod43.z.string().optional() }).optional()
|
|
15162
15330
|
});
|
|
15163
15331
|
}
|
|
15164
15332
|
});
|
|
@@ -18567,7 +18735,7 @@ init_providersStore();
|
|
|
18567
18735
|
init_signIn();
|
|
18568
18736
|
init_realPorts();
|
|
18569
18737
|
var import_node_path36 = __toESM(require("node:path"), 1);
|
|
18570
|
-
var
|
|
18738
|
+
var import_zod25 = require("zod");
|
|
18571
18739
|
init_envBool();
|
|
18572
18740
|
init_load();
|
|
18573
18741
|
init_schema();
|
|
@@ -18579,6 +18747,7 @@ init_farm();
|
|
|
18579
18747
|
init_guard();
|
|
18580
18748
|
init_providersStore();
|
|
18581
18749
|
init_projects();
|
|
18750
|
+
init_injected();
|
|
18582
18751
|
init_pipeline();
|
|
18583
18752
|
var HISTORY_PROJECTS_KEY_PREFIX = "history/projects/";
|
|
18584
18753
|
function projectFragmentOf(rawKey) {
|
|
@@ -18648,9 +18817,9 @@ function lookupKeychainService(run, farmRoot) {
|
|
|
18648
18817
|
}
|
|
18649
18818
|
return { checked: true, found: true, serviceName, note: `Keychain service name for this identity: "${serviceName}".` };
|
|
18650
18819
|
}
|
|
18651
|
-
var SettingsSecretsShapeSchema =
|
|
18652
|
-
env:
|
|
18653
|
-
hooks:
|
|
18820
|
+
var SettingsSecretsShapeSchema = import_zod25.z.looseObject({
|
|
18821
|
+
env: import_zod25.z.record(import_zod25.z.string(), import_zod25.z.unknown()).optional(),
|
|
18822
|
+
hooks: import_zod25.z.record(import_zod25.z.string(), import_zod25.z.array(import_zod25.z.unknown())).optional()
|
|
18654
18823
|
});
|
|
18655
18824
|
function hookCommandCountOf(group) {
|
|
18656
18825
|
if (typeof group !== "object" || group === null) {
|
|
@@ -18751,10 +18920,11 @@ function runCheck(params) {
|
|
|
18751
18920
|
const resolved = resolveDecisions({ facts, cascade: params.cascade, classification: params.classification });
|
|
18752
18921
|
const decisionLines = [...resolved.decisions.values()].slice().sort((a, b) => a.relPath < b.relPath ? -1 : a.relPath > b.relPath ? 1 : 0).map(formatDecision);
|
|
18753
18922
|
const projectEncodingAmbiguities = flagAmbiguousEncodings(resolved.flattened, facts);
|
|
18923
|
+
const guardEnv = launchEnvironment(params.env, params.configDirEscapeHatch);
|
|
18754
18924
|
const ambientCredential = isCodex ? codexCredentialGuard(params.env, params.identity?.allowAmbientCredential ?? false) : evaluateAmbientCredentialGuard({
|
|
18755
|
-
env:
|
|
18925
|
+
env: guardEnv,
|
|
18756
18926
|
allowAmbientCredential: params.identity?.allowAmbientCredential ?? false,
|
|
18757
|
-
allowAmbientCredentialOverride: parseEnvBool("AGENT_SHIM_ALLOW_AMBIENT_CREDENTIAL",
|
|
18927
|
+
allowAmbientCredentialOverride: parseEnvBool("AGENT_SHIM_ALLOW_AMBIENT_CREDENTIAL", guardEnv.AGENT_SHIM_ALLOW_AMBIENT_CREDENTIAL) === true,
|
|
18758
18928
|
...params.identityName === void 0 ? {} : { identityName: params.identityName }
|
|
18759
18929
|
});
|
|
18760
18930
|
const settingsShared = resolved.flattened.categories.get("settings") ?? SHIPPED_CATEGORY_DEFAULTS.settings;
|
|
@@ -18924,6 +19094,7 @@ function collectCheckReport(params) {
|
|
|
18924
19094
|
home,
|
|
18925
19095
|
claudeHome,
|
|
18926
19096
|
env: params.env,
|
|
19097
|
+
configDirEscapeHatch: identityDecision.configDirEscapeHatch,
|
|
18927
19098
|
...git.branch === void 0 ? {} : { branch: git.branch },
|
|
18928
19099
|
...git.branchDetached === void 0 ? {} : { branchDetached: git.branchDetached },
|
|
18929
19100
|
nowMs: Date.now(),
|
|
@@ -18949,7 +19120,7 @@ function collectCheckReport(params) {
|
|
|
18949
19120
|
}
|
|
18950
19121
|
|
|
18951
19122
|
// src/checkReportSchema.ts
|
|
18952
|
-
var
|
|
19123
|
+
var import_zod27 = require("zod");
|
|
18953
19124
|
init_schema();
|
|
18954
19125
|
init_claudeVersion();
|
|
18955
19126
|
init_identity();
|
|
@@ -19013,124 +19184,124 @@ var DIAGNOSTIC_CODES = [
|
|
|
19013
19184
|
var DIAGNOSTIC_SEVERITIES = ["error", "warning", "info"];
|
|
19014
19185
|
|
|
19015
19186
|
// src/usage/pickReportSchema.ts
|
|
19016
|
-
var
|
|
19187
|
+
var import_zod26 = require("zod");
|
|
19017
19188
|
init_plan2();
|
|
19018
|
-
var PoolPickCandidateViewSchema =
|
|
19019
|
-
identity:
|
|
19189
|
+
var PoolPickCandidateViewSchema = import_zod26.z.strictObject({
|
|
19190
|
+
identity: import_zod26.z.string(),
|
|
19020
19191
|
/** In pick order: `scored` has usable quota data, `unknown` has none, `pay-per-use` bills by use, `ineligible` is refused right now. */
|
|
19021
|
-
class:
|
|
19192
|
+
class: import_zod26.z.enum(["scored", "unknown", "pay-per-use", "ineligible"]),
|
|
19022
19193
|
/** Plan-size-weighted remaining quota per hour until its reset; present for `scored` only. */
|
|
19023
|
-
score:
|
|
19194
|
+
score: import_zod26.z.number().optional(),
|
|
19024
19195
|
/** Which window's reset divides the score: the seven-day window, or the five-hour one when the member reports no seven-day utilisation or its measured-ratio five-hour term outranks the weekly one; present with `score`. */
|
|
19025
|
-
scoreWindow:
|
|
19196
|
+
scoreWindow: import_zod26.z.enum(["sevenDay", "fiveHour"]).optional(),
|
|
19026
19197
|
/** False when the five-hour window would run dry, at the observed pace, before it resets. */
|
|
19027
|
-
feasible:
|
|
19198
|
+
feasible: import_zod26.z.boolean(),
|
|
19028
19199
|
/** When an `ineligible` member can be used again, as an ISO instant. */
|
|
19029
|
-
blockedUntil:
|
|
19200
|
+
blockedUntil: import_zod26.z.iso.datetime().optional(),
|
|
19030
19201
|
plan: PlanClassSchema,
|
|
19031
19202
|
/** The facts behind the class and score, in the order they matter. */
|
|
19032
|
-
reasons:
|
|
19203
|
+
reasons: import_zod26.z.array(import_zod26.z.string())
|
|
19033
19204
|
});
|
|
19034
|
-
var PoolPickReportSchema =
|
|
19035
|
-
pool:
|
|
19036
|
-
directory:
|
|
19205
|
+
var PoolPickReportSchema = import_zod26.z.strictObject({
|
|
19206
|
+
pool: import_zod26.z.string(),
|
|
19207
|
+
directory: import_zod26.z.string(),
|
|
19037
19208
|
/** The member a launch would run as, absent when every member is refused. */
|
|
19038
|
-
pick:
|
|
19039
|
-
candidates:
|
|
19209
|
+
pick: import_zod26.z.string().optional(),
|
|
19210
|
+
candidates: import_zod26.z.array(PoolPickCandidateViewSchema),
|
|
19040
19211
|
/** Identity members anywhere in the pool's graph that do not exist; a launch skips them. */
|
|
19041
|
-
missing:
|
|
19212
|
+
missing: import_zod26.z.array(import_zod26.z.string()),
|
|
19042
19213
|
/** When nothing can be picked, the soonest any member returns. */
|
|
19043
|
-
earliestReturn:
|
|
19214
|
+
earliestReturn: import_zod26.z.strictObject({ identity: import_zod26.z.string(), at: import_zod26.z.iso.datetime() }).optional(),
|
|
19044
19215
|
/** The member a resumed conversation started on but moved off, and why, when the ranking could not keep it. */
|
|
19045
|
-
movedOff:
|
|
19216
|
+
movedOff: import_zod26.z.strictObject({ identity: import_zod26.z.string(), reason: import_zod26.z.string() }).optional(),
|
|
19046
19217
|
/** Why the last-pick record could not be read, when that is the case. */
|
|
19047
|
-
stickyProblem:
|
|
19218
|
+
stickyProblem: import_zod26.z.string().optional()
|
|
19048
19219
|
});
|
|
19049
19220
|
|
|
19050
19221
|
// src/checkReportSchema.ts
|
|
19051
19222
|
var CHECK_CREDENTIAL_APPLIES = ["provider", "identity", "stored-login"];
|
|
19052
|
-
var CheckLayerViewSchema =
|
|
19053
|
-
id:
|
|
19054
|
-
kind:
|
|
19055
|
-
source:
|
|
19223
|
+
var CheckLayerViewSchema = import_zod27.z.strictObject({
|
|
19224
|
+
id: import_zod27.z.int(),
|
|
19225
|
+
kind: import_zod27.z.enum(LAYER_KINDS),
|
|
19226
|
+
source: import_zod27.z.string()
|
|
19056
19227
|
});
|
|
19057
|
-
var CheckEntryViewSchema =
|
|
19058
|
-
path:
|
|
19059
|
-
shared:
|
|
19060
|
-
via:
|
|
19228
|
+
var CheckEntryViewSchema = import_zod27.z.strictObject({
|
|
19229
|
+
path: import_zod27.z.string(),
|
|
19230
|
+
shared: import_zod27.z.boolean(),
|
|
19231
|
+
via: import_zod27.z.enum(DECISION_VIAS),
|
|
19061
19232
|
/** The entry's real category, or null when nothing classifies it. */
|
|
19062
|
-
category:
|
|
19063
|
-
rule:
|
|
19233
|
+
category: import_zod27.z.enum(CATEGORY_NAMES).nullable(),
|
|
19234
|
+
rule: import_zod27.z.strictObject({ key: import_zod27.z.string(), layer: import_zod27.z.int() }).optional(),
|
|
19064
19235
|
/** Rules that matched but whose `when` condition failed, each with the conditions that failed. */
|
|
19065
|
-
eliminated:
|
|
19236
|
+
eliminated: import_zod27.z.readonly(import_zod27.z.array(import_zod27.z.strictObject({ key: import_zod27.z.string(), failed: import_zod27.z.readonly(import_zod27.z.array(import_zod27.z.string())) }))).optional()
|
|
19066
19237
|
});
|
|
19067
|
-
var CheckDiagnosticSchema =
|
|
19068
|
-
code:
|
|
19069
|
-
severity:
|
|
19070
|
-
message:
|
|
19071
|
-
subject:
|
|
19072
|
-
layer:
|
|
19238
|
+
var CheckDiagnosticSchema = import_zod27.z.strictObject({
|
|
19239
|
+
code: import_zod27.z.enum(DIAGNOSTIC_CODES),
|
|
19240
|
+
severity: import_zod27.z.enum(DIAGNOSTIC_SEVERITIES),
|
|
19241
|
+
message: import_zod27.z.string(),
|
|
19242
|
+
subject: import_zod27.z.string().optional(),
|
|
19243
|
+
layer: import_zod27.z.int().optional()
|
|
19073
19244
|
});
|
|
19074
|
-
var CheckAmbientCredentialSchema =
|
|
19075
|
-
var CheckKeychainSchema =
|
|
19076
|
-
checked:
|
|
19077
|
-
found:
|
|
19078
|
-
serviceName:
|
|
19079
|
-
note:
|
|
19245
|
+
var CheckAmbientCredentialSchema = import_zod27.z.union([import_zod27.z.strictObject({ ok: import_zod27.z.literal(true) }), import_zod27.z.strictObject({ ok: import_zod27.z.literal(false), variable: import_zod27.z.string(), message: import_zod27.z.string() })]);
|
|
19246
|
+
var CheckKeychainSchema = import_zod27.z.strictObject({
|
|
19247
|
+
checked: import_zod27.z.literal(true),
|
|
19248
|
+
found: import_zod27.z.boolean(),
|
|
19249
|
+
serviceName: import_zod27.z.string().optional(),
|
|
19250
|
+
note: import_zod27.z.string()
|
|
19080
19251
|
});
|
|
19081
|
-
var CheckSettingsExposureSchema =
|
|
19082
|
-
file:
|
|
19083
|
-
envKeyNames:
|
|
19084
|
-
hookEventNames:
|
|
19085
|
-
hookCommandCount:
|
|
19252
|
+
var CheckSettingsExposureSchema = import_zod27.z.strictObject({
|
|
19253
|
+
file: import_zod27.z.string(),
|
|
19254
|
+
envKeyNames: import_zod27.z.readonly(import_zod27.z.array(import_zod27.z.string())),
|
|
19255
|
+
hookEventNames: import_zod27.z.readonly(import_zod27.z.array(import_zod27.z.string())),
|
|
19256
|
+
hookCommandCount: import_zod27.z.int().nonnegative()
|
|
19086
19257
|
});
|
|
19087
|
-
var CredentialSourceSummarySchema =
|
|
19088
|
-
|
|
19089
|
-
|
|
19090
|
-
|
|
19091
|
-
|
|
19092
|
-
|
|
19093
|
-
|
|
19258
|
+
var CredentialSourceSummarySchema = import_zod27.z.union([
|
|
19259
|
+
import_zod27.z.strictObject({ kind: import_zod27.z.literal("env"), variable: import_zod27.z.string() }),
|
|
19260
|
+
import_zod27.z.strictObject({ kind: import_zod27.z.literal("file"), path: import_zod27.z.string() }),
|
|
19261
|
+
import_zod27.z.strictObject({ kind: import_zod27.z.literal("command"), program: import_zod27.z.string() }),
|
|
19262
|
+
import_zod27.z.strictObject({ kind: import_zod27.z.literal("op"), reference: import_zod27.z.string() }),
|
|
19263
|
+
import_zod27.z.strictObject({ kind: import_zod27.z.literal("keychain"), service: import_zod27.z.string(), account: import_zod27.z.string().optional() }),
|
|
19264
|
+
import_zod27.z.strictObject({ kind: import_zod27.z.literal("literal") })
|
|
19094
19265
|
]);
|
|
19095
|
-
var CredentialSummarySchema =
|
|
19096
|
-
target:
|
|
19097
|
-
sources:
|
|
19266
|
+
var CredentialSummarySchema = import_zod27.z.strictObject({
|
|
19267
|
+
target: import_zod27.z.enum(CREDENTIAL_TARGETS),
|
|
19268
|
+
sources: import_zod27.z.readonly(import_zod27.z.array(CredentialSourceSummarySchema)),
|
|
19098
19269
|
cache: CredentialCacheSchema.optional()
|
|
19099
19270
|
});
|
|
19100
|
-
var CachedCredentialStateSchema =
|
|
19101
|
-
|
|
19102
|
-
|
|
19103
|
-
|
|
19271
|
+
var CachedCredentialStateSchema = import_zod27.z.union([
|
|
19272
|
+
import_zod27.z.strictObject({ store: import_zod27.z.enum(CREDENTIAL_CACHE_STORES), status: import_zod27.z.literal("empty") }),
|
|
19273
|
+
import_zod27.z.strictObject({ store: import_zod27.z.enum(CREDENTIAL_CACHE_STORES), status: import_zod27.z.literal("unreadable"), reason: import_zod27.z.string() }),
|
|
19274
|
+
import_zod27.z.strictObject({ store: import_zod27.z.enum(CREDENTIAL_CACHE_STORES), status: import_zod27.z.enum(["fresh", "expired"]), ageMs: import_zod27.z.number(), expiresInMs: import_zod27.z.number().optional() })
|
|
19104
19275
|
]);
|
|
19105
|
-
var CheckCredentialProviderSchema =
|
|
19106
|
-
|
|
19107
|
-
|
|
19276
|
+
var CheckCredentialProviderSchema = import_zod27.z.union([
|
|
19277
|
+
import_zod27.z.strictObject({ name: import_zod27.z.string(), credential: CredentialSummarySchema.optional(), cached: CachedCredentialStateSchema.optional() }),
|
|
19278
|
+
import_zod27.z.strictObject({ name: import_zod27.z.string(), problem: import_zod27.z.string() })
|
|
19108
19279
|
]);
|
|
19109
|
-
var CheckCredentialSchema =
|
|
19110
|
-
applies:
|
|
19280
|
+
var CheckCredentialSchema = import_zod27.z.strictObject({
|
|
19281
|
+
applies: import_zod27.z.enum(CHECK_CREDENTIAL_APPLIES),
|
|
19111
19282
|
provider: CheckCredentialProviderSchema.optional(),
|
|
19112
19283
|
identity: CredentialSummarySchema.optional(),
|
|
19113
19284
|
identityCached: CachedCredentialStateSchema.optional()
|
|
19114
19285
|
});
|
|
19115
|
-
var CheckClaudeVersionSchema =
|
|
19116
|
-
pinned:
|
|
19117
|
-
highestInstalled:
|
|
19118
|
-
installed:
|
|
19286
|
+
var CheckClaudeVersionSchema = import_zod27.z.strictObject({
|
|
19287
|
+
pinned: import_zod27.z.strictObject({ version: import_zod27.z.string(), source: import_zod27.z.enum(CLAUDE_VERSION_SOURCES), installed: import_zod27.z.boolean() }).optional(),
|
|
19288
|
+
highestInstalled: import_zod27.z.string().optional(),
|
|
19289
|
+
installed: import_zod27.z.readonly(import_zod27.z.array(import_zod27.z.string()))
|
|
19119
19290
|
});
|
|
19120
|
-
var CheckReportJsonSchema =
|
|
19121
|
-
identity:
|
|
19291
|
+
var CheckReportJsonSchema = import_zod27.z.strictObject({
|
|
19292
|
+
identity: import_zod27.z.strictObject({ name: import_zod27.z.string().nullable(), source: import_zod27.z.enum(IDENTITY_DECISION_SOURCES) }),
|
|
19122
19293
|
/** The pool ranking, when the launch named a pool instead of an identity. */
|
|
19123
19294
|
pool: PoolPickReportSchema.optional(),
|
|
19124
|
-
configProfile:
|
|
19125
|
-
layers:
|
|
19126
|
-
entries:
|
|
19127
|
-
projectEncodingAmbiguities:
|
|
19128
|
-
|
|
19295
|
+
configProfile: import_zod27.z.strictObject({ name: import_zod27.z.string().nullable(), source: import_zod27.z.enum(CONFIG_PROFILE_DECISION_SOURCES) }),
|
|
19296
|
+
layers: import_zod27.z.readonly(import_zod27.z.array(CheckLayerViewSchema)),
|
|
19297
|
+
entries: import_zod27.z.readonly(import_zod27.z.array(CheckEntryViewSchema)),
|
|
19298
|
+
projectEncodingAmbiguities: import_zod27.z.readonly(
|
|
19299
|
+
import_zod27.z.array(import_zod27.z.strictObject({ fragment: import_zod27.z.string(), encoded: import_zod27.z.string(), reason: import_zod27.z.enum(ENCODING_AMBIGUITY_REASONS), detail: import_zod27.z.string() }))
|
|
19129
19300
|
),
|
|
19130
|
-
diagnostics:
|
|
19301
|
+
diagnostics: import_zod27.z.readonly(import_zod27.z.array(CheckDiagnosticSchema)),
|
|
19131
19302
|
ambientCredential: CheckAmbientCredentialSchema,
|
|
19132
19303
|
keychain: CheckKeychainSchema.optional(),
|
|
19133
|
-
settingsExposure:
|
|
19304
|
+
settingsExposure: import_zod27.z.readonly(import_zod27.z.array(CheckSettingsExposureSchema)),
|
|
19134
19305
|
credential: CheckCredentialSchema,
|
|
19135
19306
|
claudeVersion: CheckClaudeVersionSchema.optional()
|
|
19136
19307
|
});
|
|
@@ -19141,28 +19312,28 @@ init_preflight();
|
|
|
19141
19312
|
init_resets();
|
|
19142
19313
|
|
|
19143
19314
|
// src/usage/resetsSchema.ts
|
|
19144
|
-
var
|
|
19145
|
-
var ResetRowSchema =
|
|
19146
|
-
identity:
|
|
19147
|
-
provider:
|
|
19315
|
+
var import_zod28 = require("zod");
|
|
19316
|
+
var ResetRowSchema = import_zod28.z.strictObject({
|
|
19317
|
+
identity: import_zod28.z.string(),
|
|
19318
|
+
provider: import_zod28.z.string(),
|
|
19148
19319
|
/** What the window is: `5h`, `7d` or `extra usage` for an Anthropic account, or the provider's own measure and period (`tokens 5h`). */
|
|
19149
|
-
window:
|
|
19320
|
+
window: import_zod28.z.string(),
|
|
19150
19321
|
/** When the state the window comes from was observed, as an ISO instant. */
|
|
19151
|
-
observedAt:
|
|
19322
|
+
observedAt: import_zod28.z.iso.datetime(),
|
|
19152
19323
|
/** When the window resets, as an ISO instant; absent when the upstream reported none. */
|
|
19153
|
-
resetsAt:
|
|
19324
|
+
resetsAt: import_zod28.z.iso.datetime().optional(),
|
|
19154
19325
|
/** True when the reset time has passed, so the recorded observation describes a window that no longer exists and its utilisation reads as 0. */
|
|
19155
|
-
reset:
|
|
19326
|
+
reset: import_zod28.z.boolean(),
|
|
19156
19327
|
/** The fraction used, as `effectiveWindow` reads it at the report's own clock. */
|
|
19157
|
-
utilization:
|
|
19328
|
+
utilization: import_zod28.z.number().optional(),
|
|
19158
19329
|
/** The window's own status, for a window that has not reset yet. */
|
|
19159
|
-
status:
|
|
19330
|
+
status: import_zod28.z.string().optional()
|
|
19160
19331
|
});
|
|
19161
|
-
var ResetScheduleSchema =
|
|
19332
|
+
var ResetScheduleSchema = import_zod28.z.strictObject({ resets: import_zod28.z.readonly(import_zod28.z.array(ResetRowSchema)) });
|
|
19162
19333
|
|
|
19163
19334
|
// src/frontdoor/controlSchemas.ts
|
|
19164
19335
|
var import_node_path42 = __toESM(require("node:path"), 1);
|
|
19165
|
-
var
|
|
19336
|
+
var import_zod35 = require("zod");
|
|
19166
19337
|
|
|
19167
19338
|
// src/codex/doctor.ts
|
|
19168
19339
|
function codexIdentityFindings(entry, identity) {
|
|
@@ -19836,12 +20007,8 @@ function runDoctor(params) {
|
|
|
19836
20007
|
}
|
|
19837
20008
|
push(section, "warn", `${where} pins Claude Code ${version}, which is not installed (installed: ${installed.length === 0 ? "none" : installed.join(", ")}); a launch that resolves to it fails.`, subject);
|
|
19838
20009
|
};
|
|
19839
|
-
const ambient =
|
|
19840
|
-
|
|
19841
|
-
push("ambient-credential", "pass", "No ambient-credential environment variable is set.");
|
|
19842
|
-
} else {
|
|
19843
|
-
push("ambient-credential", "warn", formatAmbientCredentialGuardMessage(ambient.variable));
|
|
19844
|
-
}
|
|
20010
|
+
const ambient = ambientCredentialFinding(params.env);
|
|
20011
|
+
push("ambient-credential", ambient.severity, ambient.message);
|
|
19845
20012
|
if (params.binaryDiscovery.ok) {
|
|
19846
20013
|
const { binary } = params.binaryDiscovery;
|
|
19847
20014
|
const versionNote = binary.version === void 0 ? "" : `, version ${binary.version}`;
|
|
@@ -20393,92 +20560,92 @@ function collectDoctorReport(params) {
|
|
|
20393
20560
|
// src/frontdoor/controlSchemas.ts
|
|
20394
20561
|
init_schema2();
|
|
20395
20562
|
init_state();
|
|
20396
|
-
var UsageListOutputSchema =
|
|
20397
|
-
var UsageWindowsInputSchema =
|
|
20398
|
-
identity:
|
|
20399
|
-
provider:
|
|
20563
|
+
var UsageListOutputSchema = import_zod35.z.strictObject({ snapshots: import_zod35.z.readonly(import_zod35.z.array(UsageSnapshotSchema)) });
|
|
20564
|
+
var UsageWindowsInputSchema = import_zod35.z.strictObject({
|
|
20565
|
+
identity: import_zod35.z.string().min(1),
|
|
20566
|
+
provider: import_zod35.z.string().min(1).optional()
|
|
20400
20567
|
});
|
|
20401
|
-
var EffectiveWindowSchema =
|
|
20568
|
+
var EffectiveWindowSchema = import_zod35.z.strictObject({
|
|
20402
20569
|
/** True when the window's reset time has passed, so the recorded observation describes a window that no longer exists. */
|
|
20403
|
-
reset:
|
|
20570
|
+
reset: import_zod35.z.boolean(),
|
|
20404
20571
|
/** The fraction used: 0 for a reset window, otherwise what was last observed, absent when none was reported. */
|
|
20405
|
-
utilization:
|
|
20572
|
+
utilization: import_zod35.z.number().optional(),
|
|
20406
20573
|
/** The reset instant, for a window that has not reset yet and reported one. */
|
|
20407
|
-
resetsAtMs:
|
|
20574
|
+
resetsAtMs: import_zod35.z.number().optional(),
|
|
20408
20575
|
/** The window's own status, for a window that has not reset yet. */
|
|
20409
|
-
status:
|
|
20576
|
+
status: import_zod35.z.string().optional()
|
|
20410
20577
|
});
|
|
20411
|
-
var UsageWindowsOutputSchema =
|
|
20412
|
-
identity:
|
|
20413
|
-
provider:
|
|
20578
|
+
var UsageWindowsOutputSchema = import_zod35.z.strictObject({
|
|
20579
|
+
identity: import_zod35.z.string(),
|
|
20580
|
+
provider: import_zod35.z.string(),
|
|
20414
20581
|
/** When the rate-limit state the windows come from was observed. */
|
|
20415
|
-
observedAt:
|
|
20582
|
+
observedAt: import_zod35.z.iso.datetime().optional(),
|
|
20416
20583
|
fiveHour: EffectiveWindowSchema.optional(),
|
|
20417
20584
|
sevenDay: EffectiveWindowSchema.optional()
|
|
20418
20585
|
});
|
|
20419
|
-
var UsageLiveOutputSchema =
|
|
20586
|
+
var UsageLiveOutputSchema = import_zod35.z.strictObject({
|
|
20420
20587
|
/** The freshest observation the door holds, never narrowed by the read's session filter because it is the door's single latest statement of the account's quota; absent while no rate_limit_event has been filed at all. */
|
|
20421
20588
|
latest: RcLiveRateLimitSchema.optional(),
|
|
20422
20589
|
/** One observation per session whose stream has filed a rate_limit_event this door generation. */
|
|
20423
|
-
sessions:
|
|
20590
|
+
sessions: import_zod35.z.readonly(import_zod35.z.array(RcLiveRateLimitSchema))
|
|
20424
20591
|
});
|
|
20425
|
-
var FrontDoorSessionStatusSchema =
|
|
20426
|
-
pid:
|
|
20427
|
-
startedAt:
|
|
20428
|
-
alive:
|
|
20592
|
+
var FrontDoorSessionStatusSchema = import_zod35.z.strictObject({
|
|
20593
|
+
pid: import_zod35.z.int().positive(),
|
|
20594
|
+
startedAt: import_zod35.z.number(),
|
|
20595
|
+
alive: import_zod35.z.boolean()
|
|
20429
20596
|
});
|
|
20430
|
-
var HeadroomSocketTargetSchema =
|
|
20431
|
-
var FrontDoorStatusOutputSchema =
|
|
20597
|
+
var HeadroomSocketTargetSchema = import_zod35.z.union([import_zod35.z.strictObject({ socketPath: import_zod35.z.string() }), import_zod35.z.strictObject({ refused: import_zod35.z.string() })]);
|
|
20598
|
+
var FrontDoorStatusOutputSchema = import_zod35.z.strictObject({
|
|
20432
20599
|
state: FrontDoorStateSchema,
|
|
20433
|
-
supervisorAlive:
|
|
20600
|
+
supervisorAlive: import_zod35.z.boolean(),
|
|
20434
20601
|
/** The pids of earlier doors that released their addresses and are finishing the connections they carried: running, but not serving anything new. */
|
|
20435
|
-
draining:
|
|
20436
|
-
sessions:
|
|
20602
|
+
draining: import_zod35.z.readonly(import_zod35.z.array(import_zod35.z.number().int().positive())),
|
|
20603
|
+
sessions: import_zod35.z.readonly(import_zod35.z.array(FrontDoorSessionStatusSchema)),
|
|
20437
20604
|
headroomSocket: HeadroomSocketTargetSchema.optional(),
|
|
20438
|
-
logPath:
|
|
20439
|
-
logExists:
|
|
20605
|
+
logPath: import_zod35.z.string(),
|
|
20606
|
+
logExists: import_zod35.z.boolean()
|
|
20440
20607
|
});
|
|
20441
|
-
var FrontDoorSessionsOutputSchema =
|
|
20442
|
-
var CheckRunInputSchema =
|
|
20443
|
-
path:
|
|
20444
|
-
identity:
|
|
20608
|
+
var FrontDoorSessionsOutputSchema = import_zod35.z.strictObject({ sessions: import_zod35.z.readonly(import_zod35.z.array(FrontDoorSessionStatusSchema)) });
|
|
20609
|
+
var CheckRunInputSchema = import_zod35.z.strictObject({
|
|
20610
|
+
path: import_zod35.z.string().min(1),
|
|
20611
|
+
identity: import_zod35.z.string().min(1).optional()
|
|
20445
20612
|
}).refine((input) => import_node_path42.default.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
20446
|
-
var PoolPickInputSchema =
|
|
20447
|
-
pool:
|
|
20448
|
-
path:
|
|
20613
|
+
var PoolPickInputSchema = import_zod35.z.strictObject({
|
|
20614
|
+
pool: import_zod35.z.string().min(1),
|
|
20615
|
+
path: import_zod35.z.string().min(1)
|
|
20449
20616
|
}).refine((input) => import_node_path42.default.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
20450
|
-
var DoctorFindingSchema =
|
|
20451
|
-
section:
|
|
20452
|
-
subject:
|
|
20453
|
-
severity:
|
|
20454
|
-
message:
|
|
20617
|
+
var DoctorFindingSchema = import_zod35.z.strictObject({
|
|
20618
|
+
section: import_zod35.z.enum(DOCTOR_SECTIONS),
|
|
20619
|
+
subject: import_zod35.z.string().optional(),
|
|
20620
|
+
severity: import_zod35.z.enum(DOCTOR_SEVERITIES),
|
|
20621
|
+
message: import_zod35.z.string()
|
|
20455
20622
|
});
|
|
20456
|
-
var DoctorRunOutputSchema =
|
|
20623
|
+
var DoctorRunOutputSchema = import_zod35.z.strictObject({
|
|
20457
20624
|
/** False exactly when any finding is a `fail`; a `warn` never fails the report on its own. */
|
|
20458
|
-
ok:
|
|
20459
|
-
findings:
|
|
20625
|
+
ok: import_zod35.z.boolean(),
|
|
20626
|
+
findings: import_zod35.z.readonly(import_zod35.z.array(DoctorFindingSchema))
|
|
20460
20627
|
});
|
|
20461
|
-
var FrontDoorRestartOutputSchema =
|
|
20462
|
-
action:
|
|
20463
|
-
previousPid:
|
|
20628
|
+
var FrontDoorRestartOutputSchema = import_zod35.z.strictObject({
|
|
20629
|
+
action: import_zod35.z.literal("restarting"),
|
|
20630
|
+
previousPid: import_zod35.z.int().positive()
|
|
20464
20631
|
});
|
|
20465
|
-
var UpdateCheckOutputSchema =
|
|
20466
|
-
current:
|
|
20467
|
-
latest:
|
|
20468
|
-
action:
|
|
20632
|
+
var UpdateCheckOutputSchema = import_zod35.z.strictObject({
|
|
20633
|
+
current: import_zod35.z.string(),
|
|
20634
|
+
latest: import_zod35.z.string(),
|
|
20635
|
+
action: import_zod35.z.enum(["current", "available", "updated"])
|
|
20469
20636
|
});
|
|
20470
|
-
var CodexSignInSchema =
|
|
20471
|
-
|
|
20472
|
-
|
|
20473
|
-
|
|
20637
|
+
var CodexSignInSchema = import_zod35.z.discriminatedUnion("state", [
|
|
20638
|
+
import_zod35.z.strictObject({ state: import_zod35.z.literal("none") }),
|
|
20639
|
+
import_zod35.z.strictObject({ state: import_zod35.z.literal("signed-in"), email: import_zod35.z.string().optional(), planScope: import_zod35.z.boolean(), accessTokenExpiresAt: import_zod35.z.number() }),
|
|
20640
|
+
import_zod35.z.strictObject({ state: import_zod35.z.literal("unreadable"), message: import_zod35.z.string() })
|
|
20474
20641
|
]);
|
|
20475
|
-
var CodexStatusOutputSchema =
|
|
20642
|
+
var CodexStatusOutputSchema = import_zod35.z.strictObject({
|
|
20476
20643
|
signIn: CodexSignInSchema,
|
|
20477
|
-
codexProviders:
|
|
20644
|
+
codexProviders: import_zod35.z.readonly(import_zod35.z.array(import_zod35.z.string()))
|
|
20478
20645
|
});
|
|
20479
|
-
var CodexLogoutOutputSchema =
|
|
20480
|
-
hadGrant:
|
|
20481
|
-
revoked:
|
|
20646
|
+
var CodexLogoutOutputSchema = import_zod35.z.strictObject({
|
|
20647
|
+
hadGrant: import_zod35.z.boolean(),
|
|
20648
|
+
revoked: import_zod35.z.boolean()
|
|
20482
20649
|
});
|
|
20483
20650
|
|
|
20484
20651
|
// src/frontdoor/codexApi.ts
|
|
@@ -20542,71 +20709,71 @@ init_poolStore();
|
|
|
20542
20709
|
init_providersStore();
|
|
20543
20710
|
|
|
20544
20711
|
// src/frontdoor/configSchemas.ts
|
|
20545
|
-
var
|
|
20712
|
+
var import_zod36 = require("zod");
|
|
20546
20713
|
init_schema();
|
|
20547
20714
|
init_names();
|
|
20548
20715
|
init_keychainLogin();
|
|
20549
20716
|
init_statusline();
|
|
20550
|
-
var RemovalConfirmationSchema =
|
|
20551
|
-
var CredentialWriteSchema = (targets) =>
|
|
20552
|
-
sources:
|
|
20553
|
-
target:
|
|
20554
|
-
cache:
|
|
20717
|
+
var RemovalConfirmationSchema = import_zod36.z.boolean();
|
|
20718
|
+
var CredentialWriteSchema = (targets) => import_zod36.z.strictObject({
|
|
20719
|
+
sources: import_zod36.z.array(RemoteCredentialSourceSchema).min(1).optional(),
|
|
20720
|
+
target: import_zod36.z.enum(targets).optional(),
|
|
20721
|
+
cache: import_zod36.z.union([import_zod36.z.literal(false), CredentialCacheSchema]).optional()
|
|
20555
20722
|
});
|
|
20556
|
-
var CredentialSummarySchema2 =
|
|
20557
|
-
target:
|
|
20558
|
-
sources:
|
|
20559
|
-
|
|
20560
|
-
|
|
20561
|
-
|
|
20562
|
-
|
|
20563
|
-
|
|
20564
|
-
|
|
20565
|
-
|
|
20723
|
+
var CredentialSummarySchema2 = import_zod36.z.strictObject({
|
|
20724
|
+
target: import_zod36.z.enum(CREDENTIAL_TARGETS),
|
|
20725
|
+
sources: import_zod36.z.readonly(import_zod36.z.array(
|
|
20726
|
+
import_zod36.z.discriminatedUnion("kind", [
|
|
20727
|
+
import_zod36.z.strictObject({ kind: import_zod36.z.literal("env"), variable: import_zod36.z.string() }),
|
|
20728
|
+
import_zod36.z.strictObject({ kind: import_zod36.z.literal("file"), path: import_zod36.z.string() }),
|
|
20729
|
+
import_zod36.z.strictObject({ kind: import_zod36.z.literal("command"), program: import_zod36.z.string() }),
|
|
20730
|
+
import_zod36.z.strictObject({ kind: import_zod36.z.literal("op"), reference: import_zod36.z.string() }),
|
|
20731
|
+
import_zod36.z.strictObject({ kind: import_zod36.z.literal("keychain"), service: import_zod36.z.string(), account: import_zod36.z.string().optional() }),
|
|
20732
|
+
import_zod36.z.strictObject({ kind: import_zod36.z.literal("literal") })
|
|
20566
20733
|
])
|
|
20567
20734
|
)),
|
|
20568
20735
|
cache: CredentialCacheSchema.optional()
|
|
20569
20736
|
});
|
|
20570
|
-
var mutationOutput = (kind, action) =>
|
|
20571
|
-
var storedMutationOutput = (kind, action, value) =>
|
|
20572
|
-
var IdentityValueSchema =
|
|
20573
|
-
name:
|
|
20574
|
-
label:
|
|
20575
|
-
defaultConfigProfile:
|
|
20576
|
-
provider:
|
|
20577
|
-
allowAmbientCredential:
|
|
20737
|
+
var mutationOutput = (kind, action) => import_zod36.z.strictObject({ action: import_zod36.z.literal(action), kind: import_zod36.z.literal(kind), name: import_zod36.z.string() });
|
|
20738
|
+
var storedMutationOutput = (kind, action, value) => import_zod36.z.strictObject({ action: import_zod36.z.literal(action), kind: import_zod36.z.literal(kind), name: import_zod36.z.string(), value });
|
|
20739
|
+
var IdentityValueSchema = import_zod36.z.strictObject({
|
|
20740
|
+
name: import_zod36.z.string(),
|
|
20741
|
+
label: import_zod36.z.string().optional(),
|
|
20742
|
+
defaultConfigProfile: import_zod36.z.string().optional(),
|
|
20743
|
+
provider: import_zod36.z.string().optional(),
|
|
20744
|
+
allowAmbientCredential: import_zod36.z.boolean(),
|
|
20578
20745
|
credential: CredentialSummarySchema2.optional(),
|
|
20579
|
-
anchors:
|
|
20746
|
+
anchors: import_zod36.z.array(AnchorSchema).optional()
|
|
20580
20747
|
});
|
|
20581
20748
|
var ProfileValueSchema = ConfigProfileSchema.omit({ $schema: true });
|
|
20582
|
-
var ProviderValueSchema =
|
|
20583
|
-
name:
|
|
20584
|
-
kind:
|
|
20585
|
-
displayName:
|
|
20586
|
-
baseUrl:
|
|
20749
|
+
var ProviderValueSchema = import_zod36.z.strictObject({
|
|
20750
|
+
name: import_zod36.z.string(),
|
|
20751
|
+
kind: import_zod36.z.enum(PROVIDER_KINDS),
|
|
20752
|
+
displayName: import_zod36.z.string(),
|
|
20753
|
+
baseUrl: import_zod36.z.string().optional(),
|
|
20587
20754
|
codex: CodexProviderConfigSchema.optional(),
|
|
20588
20755
|
credential: CredentialSummarySchema2.optional(),
|
|
20589
|
-
env:
|
|
20756
|
+
env: import_zod36.z.record(import_zod36.z.string(), import_zod36.z.string()).optional()
|
|
20590
20757
|
});
|
|
20591
|
-
var ConfigNameInputSchema =
|
|
20592
|
-
var ConfigIdentityAddInputSchema =
|
|
20758
|
+
var ConfigNameInputSchema = import_zod36.z.strictObject({ name: import_zod36.z.string().min(1) });
|
|
20759
|
+
var ConfigIdentityAddInputSchema = import_zod36.z.strictObject({ name: import_zod36.z.string().min(1), keepKeychainLogin: import_zod36.z.boolean().optional().describe(KEEP_KEYCHAIN_LOGIN_DESCRIPTION) });
|
|
20593
20760
|
var ConfigIdentityAddOutputSchema = storedMutationOutput("identity", "created", IdentityValueSchema);
|
|
20594
|
-
var ConfigIdentitySetInputSchema =
|
|
20595
|
-
name:
|
|
20761
|
+
var ConfigIdentitySetInputSchema = import_zod36.z.strictObject({
|
|
20762
|
+
name: import_zod36.z.string().min(1),
|
|
20596
20763
|
/** The identity's display label; `false` clears it. */
|
|
20597
|
-
label:
|
|
20598
|
-
defaultConfigProfile:
|
|
20764
|
+
label: import_zod36.z.union([IdentityLabelSchema, import_zod36.z.literal(false)]).optional(),
|
|
20765
|
+
defaultConfigProfile: import_zod36.z.union([import_zod36.z.string().min(1), import_zod36.z.literal(false)]).optional(),
|
|
20599
20766
|
/** The provider the identity exists for; `false` clears it. */
|
|
20600
|
-
provider:
|
|
20601
|
-
allowAmbientCredential:
|
|
20602
|
-
credential:
|
|
20767
|
+
provider: import_zod36.z.union([import_zod36.z.string().min(1), import_zod36.z.literal(false)]).optional(),
|
|
20768
|
+
allowAmbientCredential: import_zod36.z.boolean().optional(),
|
|
20769
|
+
credential: import_zod36.z.union([import_zod36.z.literal(false), CredentialWriteSchema(CREDENTIAL_TARGETS)]).optional(),
|
|
20603
20770
|
/** `false` removes the anchors; a list replaces them. */
|
|
20604
|
-
anchors:
|
|
20771
|
+
anchors: import_zod36.z.union([import_zod36.z.literal(false), import_zod36.z.array(AnchorSchema).min(1)]).optional()
|
|
20605
20772
|
});
|
|
20606
20773
|
var ConfigIdentitySetOutputSchema = storedMutationOutput("identity", "updated", IdentityValueSchema);
|
|
20607
|
-
var ConfigIdentityRemoveInputSchema =
|
|
20774
|
+
var ConfigIdentityRemoveInputSchema = import_zod36.z.strictObject({ name: import_zod36.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
20608
20775
|
var ConfigIdentityRemoveOutputSchema = mutationOutput("identity", "removed");
|
|
20609
|
-
var ConfigStatuslineSetSchema =
|
|
20776
|
+
var ConfigStatuslineSetSchema = import_zod36.z.record(import_zod36.z.string(), import_zod36.z.unknown()).superRefine((settings, context) => {
|
|
20610
20777
|
for (const key of Object.keys(settings)) {
|
|
20611
20778
|
if (key === STATUSLINE_EXTRA_GROUP || key.startsWith(`${STATUSLINE_EXTRA_GROUP}.`)) {
|
|
20612
20779
|
context.addIssue({ code: "custom", path: [key], message: `a config write through the API cannot set "${key}": the extra segment's command runs a program, so only your own configuration (the global config, a profile you edit yourself, a directory rule or a command-line assignment) may set it` });
|
|
@@ -20614,93 +20781,93 @@ var ConfigStatuslineSetSchema = import_zod35.z.record(import_zod35.z.string(), i
|
|
|
20614
20781
|
}
|
|
20615
20782
|
});
|
|
20616
20783
|
var ConfigIdentityUseOutputSchema = mutationOutput("identity", "selected");
|
|
20617
|
-
var ConfigProfileAddInputSchema =
|
|
20618
|
-
name:
|
|
20619
|
-
extends:
|
|
20620
|
-
description:
|
|
20784
|
+
var ConfigProfileAddInputSchema = import_zod36.z.strictObject({
|
|
20785
|
+
name: import_zod36.z.string().min(1),
|
|
20786
|
+
extends: import_zod36.z.array(import_zod36.z.string().min(1)).optional(),
|
|
20787
|
+
description: import_zod36.z.string().optional()
|
|
20621
20788
|
});
|
|
20622
20789
|
var ConfigProfileAddOutputSchema = storedMutationOutput("profile", "created", ProfileValueSchema);
|
|
20623
|
-
var ConfigProfileSetInputSchema =
|
|
20624
|
-
name:
|
|
20625
|
-
category:
|
|
20626
|
-
entry:
|
|
20627
|
-
extends:
|
|
20628
|
-
description:
|
|
20629
|
-
launch:
|
|
20630
|
-
skipPermissions:
|
|
20631
|
-
remoteControl:
|
|
20632
|
-
headroom:
|
|
20633
|
-
trackUsage:
|
|
20634
|
-
provider:
|
|
20635
|
-
claudeVersion:
|
|
20636
|
-
delay:
|
|
20637
|
-
pause:
|
|
20638
|
-
explain:
|
|
20639
|
-
proxyBypass:
|
|
20640
|
-
statusline:
|
|
20790
|
+
var ConfigProfileSetInputSchema = import_zod36.z.strictObject({
|
|
20791
|
+
name: import_zod36.z.string().min(1),
|
|
20792
|
+
category: import_zod36.z.record(import_zod36.z.string(), import_zod36.z.boolean()).optional(),
|
|
20793
|
+
entry: import_zod36.z.record(import_zod36.z.string(), import_zod36.z.boolean()).optional(),
|
|
20794
|
+
extends: import_zod36.z.union([import_zod36.z.array(import_zod36.z.string().min(1)), import_zod36.z.literal(false)]).optional(),
|
|
20795
|
+
description: import_zod36.z.union([import_zod36.z.string(), import_zod36.z.literal(false)]).optional(),
|
|
20796
|
+
launch: import_zod36.z.strictObject({
|
|
20797
|
+
skipPermissions: import_zod36.z.boolean().optional(),
|
|
20798
|
+
remoteControl: import_zod36.z.boolean().optional(),
|
|
20799
|
+
headroom: import_zod36.z.boolean().optional(),
|
|
20800
|
+
trackUsage: import_zod36.z.boolean().optional(),
|
|
20801
|
+
provider: import_zod36.z.union([import_zod36.z.string().min(1), import_zod36.z.literal(false)]).optional(),
|
|
20802
|
+
claudeVersion: import_zod36.z.union([import_zod36.z.string().min(1), import_zod36.z.literal(false)]).optional(),
|
|
20803
|
+
delay: import_zod36.z.union([import_zod36.z.string().regex(DURATION_RE), import_zod36.z.literal(false)]).optional(),
|
|
20804
|
+
pause: import_zod36.z.boolean().optional(),
|
|
20805
|
+
explain: import_zod36.z.boolean().optional(),
|
|
20806
|
+
proxyBypass: import_zod36.z.union([import_zod36.z.array(import_zod36.z.string().min(1)), import_zod36.z.literal(false)]).optional(),
|
|
20807
|
+
statusline: import_zod36.z.strictObject({
|
|
20641
20808
|
set: ConfigStatuslineSetSchema.optional(),
|
|
20642
|
-
unset:
|
|
20809
|
+
unset: import_zod36.z.array(import_zod36.z.string()).optional()
|
|
20643
20810
|
}).optional()
|
|
20644
20811
|
}).optional()
|
|
20645
20812
|
});
|
|
20646
20813
|
var ConfigProfileSetOutputSchema = storedMutationOutput("profile", "updated", ProfileValueSchema);
|
|
20647
|
-
var ConfigProfileRemoveInputSchema =
|
|
20814
|
+
var ConfigProfileRemoveInputSchema = import_zod36.z.strictObject({ name: import_zod36.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
20648
20815
|
var ConfigProfileRemoveOutputSchema = mutationOutput("profile", "removed");
|
|
20649
20816
|
var ConfigProfileUseOutputSchema = mutationOutput("profile", "selected");
|
|
20650
|
-
var PoolMembersInputSchema =
|
|
20651
|
-
var ConfigPoolAddInputSchema =
|
|
20652
|
-
name:
|
|
20817
|
+
var PoolMembersInputSchema = import_zod36.z.array(import_zod36.z.string().min(1)).min(1);
|
|
20818
|
+
var ConfigPoolAddInputSchema = import_zod36.z.strictObject({
|
|
20819
|
+
name: import_zod36.z.string().min(1),
|
|
20653
20820
|
identities: PoolMembersInputSchema,
|
|
20654
|
-
preference:
|
|
20655
|
-
resumeOnLimit:
|
|
20656
|
-
compactBeforeLimit:
|
|
20821
|
+
preference: import_zod36.z.enum(POOL_PREFERENCES).optional(),
|
|
20822
|
+
resumeOnLimit: import_zod36.z.boolean().optional(),
|
|
20823
|
+
compactBeforeLimit: import_zod36.z.boolean().optional(),
|
|
20657
20824
|
compactAtUtilisation: CompactAtUtilisationSchema.optional()
|
|
20658
20825
|
});
|
|
20659
20826
|
var ConfigPoolAddOutputSchema = storedMutationOutput("pool", "created", PoolSchema);
|
|
20660
|
-
var ConfigPoolSetInputSchema =
|
|
20661
|
-
name:
|
|
20827
|
+
var ConfigPoolSetInputSchema = import_zod36.z.strictObject({
|
|
20828
|
+
name: import_zod36.z.string().min(1),
|
|
20662
20829
|
identities: PoolMembersInputSchema.optional(),
|
|
20663
|
-
preference:
|
|
20664
|
-
resumeOnLimit:
|
|
20665
|
-
compactBeforeLimit:
|
|
20666
|
-
compactAtUtilisation:
|
|
20830
|
+
preference: import_zod36.z.union([import_zod36.z.enum(POOL_PREFERENCES), import_zod36.z.literal(false)]).optional(),
|
|
20831
|
+
resumeOnLimit: import_zod36.z.boolean().optional(),
|
|
20832
|
+
compactBeforeLimit: import_zod36.z.boolean().optional(),
|
|
20833
|
+
compactAtUtilisation: import_zod36.z.union([CompactAtUtilisationSchema, import_zod36.z.literal(false)]).optional()
|
|
20667
20834
|
});
|
|
20668
20835
|
var ConfigPoolSetOutputSchema = storedMutationOutput("pool", "updated", PoolSchema);
|
|
20669
|
-
var ConfigPoolRemoveInputSchema =
|
|
20836
|
+
var ConfigPoolRemoveInputSchema = import_zod36.z.strictObject({ name: import_zod36.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
20670
20837
|
var ConfigPoolRemoveOutputSchema = mutationOutput("pool", "removed");
|
|
20671
20838
|
var ConfigPoolUseOutputSchema = mutationOutput("pool", "selected");
|
|
20672
|
-
var ConfigProviderAddInputSchema =
|
|
20673
|
-
name:
|
|
20674
|
-
kind:
|
|
20675
|
-
displayName:
|
|
20676
|
-
baseUrl:
|
|
20839
|
+
var ConfigProviderAddInputSchema = import_zod36.z.strictObject({
|
|
20840
|
+
name: import_zod36.z.string().min(1),
|
|
20841
|
+
kind: import_zod36.z.enum(PROVIDER_KINDS).optional(),
|
|
20842
|
+
displayName: import_zod36.z.string().min(1),
|
|
20843
|
+
baseUrl: import_zod36.z.string().min(1).optional(),
|
|
20677
20844
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).required({ sources: true }),
|
|
20678
20845
|
codex: CodexProviderConfigSchema.optional()
|
|
20679
20846
|
});
|
|
20680
20847
|
var ConfigProviderAddOutputSchema = storedMutationOutput("provider", "created", ProviderValueSchema);
|
|
20681
|
-
var ConfigProviderSetInputSchema =
|
|
20682
|
-
name:
|
|
20683
|
-
displayName:
|
|
20684
|
-
baseUrl:
|
|
20848
|
+
var ConfigProviderSetInputSchema = import_zod36.z.strictObject({
|
|
20849
|
+
name: import_zod36.z.string().min(1),
|
|
20850
|
+
displayName: import_zod36.z.string().min(1).optional(),
|
|
20851
|
+
baseUrl: import_zod36.z.string().min(1).optional(),
|
|
20685
20852
|
credential: CredentialWriteSchema(PROVIDER_CREDENTIAL_TARGETS).optional(),
|
|
20686
20853
|
codex: CodexProviderConfigSchema.optional()
|
|
20687
20854
|
});
|
|
20688
20855
|
var ConfigProviderSetOutputSchema = storedMutationOutput("provider", "updated", ProviderValueSchema);
|
|
20689
|
-
var ConfigProviderRemoveInputSchema =
|
|
20856
|
+
var ConfigProviderRemoveInputSchema = import_zod36.z.strictObject({ name: import_zod36.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
20690
20857
|
var ConfigProviderRemoveOutputSchema = mutationOutput("provider", "removed");
|
|
20691
|
-
var ConfigRuleAddInputSchema =
|
|
20692
|
-
path:
|
|
20693
|
-
configProfile:
|
|
20694
|
-
identity:
|
|
20858
|
+
var ConfigRuleAddInputSchema = import_zod36.z.strictObject({
|
|
20859
|
+
path: import_zod36.z.string().min(1),
|
|
20860
|
+
configProfile: import_zod36.z.string().min(1).optional(),
|
|
20861
|
+
identity: import_zod36.z.string().min(1).optional()
|
|
20695
20862
|
});
|
|
20696
20863
|
var ConfigRuleAddOutputSchema = storedMutationOutput("rule", "created", DirectoryRuleSchema);
|
|
20697
|
-
var ConfigRuleSetInputSchema =
|
|
20698
|
-
path:
|
|
20699
|
-
configProfile:
|
|
20700
|
-
identity:
|
|
20864
|
+
var ConfigRuleSetInputSchema = import_zod36.z.strictObject({
|
|
20865
|
+
path: import_zod36.z.string().min(1),
|
|
20866
|
+
configProfile: import_zod36.z.union([import_zod36.z.string().min(1), import_zod36.z.literal(false)]).optional(),
|
|
20867
|
+
identity: import_zod36.z.union([import_zod36.z.string().min(1), import_zod36.z.literal(false)]).optional()
|
|
20701
20868
|
});
|
|
20702
20869
|
var ConfigRuleSetOutputSchema = storedMutationOutput("rule", "updated", DirectoryRuleSchema);
|
|
20703
|
-
var ConfigRuleRemoveInputSchema =
|
|
20870
|
+
var ConfigRuleRemoveInputSchema = import_zod36.z.strictObject({ path: import_zod36.z.string().min(1), confirm: RemovalConfirmationSchema });
|
|
20704
20871
|
var ConfigRuleRemoveOutputSchema = mutationOutput("rule", "removed");
|
|
20705
20872
|
|
|
20706
20873
|
// src/frontdoor/configApi.ts
|
|
@@ -21052,51 +21219,51 @@ var import_openapi4 = require("@orpc/openapi");
|
|
|
21052
21219
|
var import_server3 = require("@orpc/server");
|
|
21053
21220
|
|
|
21054
21221
|
// src/frontdoor/eventSchemas.ts
|
|
21055
|
-
var
|
|
21222
|
+
var import_zod37 = require("zod");
|
|
21056
21223
|
init_schema2();
|
|
21057
21224
|
var DOOR_EVENT_SOURCE_RC = "rc";
|
|
21058
21225
|
var LAUNCH_EVENT_SOURCE = "launch";
|
|
21059
21226
|
var USAGE_EVENT_SOURCE = "usage";
|
|
21060
21227
|
var DOOR_HEALTH_EVENT_SOURCE = "door";
|
|
21061
21228
|
var QUOTA_EXPIRING_EVENT_SOURCE = "quota-expiring";
|
|
21062
|
-
var DoorEventSchema =
|
|
21063
|
-
source:
|
|
21229
|
+
var DoorEventSchema = import_zod37.z.strictObject({
|
|
21230
|
+
source: import_zod37.z.string().min(1),
|
|
21064
21231
|
/** A positive integer because the backbone's counters start at one and only ever increase. */
|
|
21065
|
-
sequence:
|
|
21066
|
-
payload:
|
|
21232
|
+
sequence: import_zod37.z.number().int().positive(),
|
|
21233
|
+
payload: import_zod37.z.unknown()
|
|
21067
21234
|
});
|
|
21068
|
-
var DoorEventSourceQuerySchema =
|
|
21069
|
-
sources:
|
|
21235
|
+
var DoorEventSourceQuerySchema = import_zod37.z.strictObject({
|
|
21236
|
+
sources: import_zod37.z.array(import_zod37.z.string().min(1)).min(1).optional()
|
|
21070
21237
|
});
|
|
21071
|
-
var LaunchLifecycleEventSchema =
|
|
21072
|
-
kind:
|
|
21073
|
-
pid:
|
|
21074
|
-
startedAt:
|
|
21075
|
-
observedAt:
|
|
21238
|
+
var LaunchLifecycleEventSchema = import_zod37.z.strictObject({
|
|
21239
|
+
kind: import_zod37.z.enum(["registered", "pruned", "ended"]),
|
|
21240
|
+
pid: import_zod37.z.number().int().positive(),
|
|
21241
|
+
startedAt: import_zod37.z.number(),
|
|
21242
|
+
observedAt: import_zod37.z.number()
|
|
21076
21243
|
});
|
|
21077
|
-
var DoorHealthEventSchema =
|
|
21078
|
-
|
|
21079
|
-
|
|
21080
|
-
|
|
21081
|
-
|
|
21082
|
-
|
|
21083
|
-
|
|
21244
|
+
var DoorHealthEventSchema = import_zod37.z.discriminatedUnion("kind", [
|
|
21245
|
+
import_zod37.z.strictObject({ kind: import_zod37.z.literal("generation"), pid: import_zod37.z.number().int().positive(), providerPort: import_zod37.z.number().int().positive(), connectPort: import_zod37.z.number().int().positive(), directPort: import_zod37.z.number().int().positive(), observedAt: import_zod37.z.number() }),
|
|
21246
|
+
import_zod37.z.strictObject({ kind: import_zod37.z.literal("listenerFailed"), pid: import_zod37.z.number().int().positive(), listener: import_zod37.z.enum(["provider", "connect", "direct"]), message: import_zod37.z.string(), observedAt: import_zod37.z.number() }),
|
|
21247
|
+
import_zod37.z.strictObject({ kind: import_zod37.z.literal("binaryTurnover"), pid: import_zod37.z.number().int().positive(), observedAt: import_zod37.z.number() }),
|
|
21248
|
+
import_zod37.z.strictObject({ kind: import_zod37.z.literal("idleShutdown"), pid: import_zod37.z.number().int().positive(), observedAt: import_zod37.z.number() }),
|
|
21249
|
+
import_zod37.z.strictObject({ kind: import_zod37.z.literal("superseded"), pid: import_zod37.z.number().int().positive(), ownerPid: import_zod37.z.number().int().positive(), observedAt: import_zod37.z.number() }),
|
|
21250
|
+
import_zod37.z.strictObject({ kind: import_zod37.z.literal("drained"), pid: import_zod37.z.number().int().positive(), observedAt: import_zod37.z.number() })
|
|
21084
21251
|
]);
|
|
21085
|
-
var QuotaExpiringEventSchema =
|
|
21252
|
+
var QuotaExpiringEventSchema = import_zod37.z.strictObject({
|
|
21086
21253
|
/** The id of the identity whose window it is: what its usage is filed under, which a rename keeps. */
|
|
21087
|
-
id:
|
|
21254
|
+
id: import_zod37.z.string().min(1),
|
|
21088
21255
|
/** The identity's name when the event was published, absent for an identity no longer stored under the id. */
|
|
21089
|
-
name:
|
|
21090
|
-
provider:
|
|
21091
|
-
window:
|
|
21256
|
+
name: import_zod37.z.string().min(1).optional(),
|
|
21257
|
+
provider: import_zod37.z.string().min(1),
|
|
21258
|
+
window: import_zod37.z.enum(["fiveHour", "sevenDay"]),
|
|
21092
21259
|
/** The fraction of the window already used when it was seen expiring, always below one because a fully used window has nothing left to spend. */
|
|
21093
|
-
utilization:
|
|
21094
|
-
resetsAt:
|
|
21095
|
-
observedAt:
|
|
21260
|
+
utilization: import_zod37.z.number().min(0).max(1),
|
|
21261
|
+
resetsAt: import_zod37.z.iso.datetime(),
|
|
21262
|
+
observedAt: import_zod37.z.number()
|
|
21096
21263
|
});
|
|
21097
21264
|
var UsageChangeEventSchema = UsageSnapshotSchema.extend({
|
|
21098
|
-
id:
|
|
21099
|
-
name:
|
|
21265
|
+
id: import_zod37.z.string().min(1),
|
|
21266
|
+
name: import_zod37.z.string().min(1).optional()
|
|
21100
21267
|
});
|
|
21101
21268
|
|
|
21102
21269
|
// src/frontdoor/eventsApi.ts
|
|
@@ -21140,7 +21307,7 @@ function createEventsApiRouter(deps) {
|
|
|
21140
21307
|
// src/frontdoor/lifecycleApi.ts
|
|
21141
21308
|
var import_client4 = require("@orpc/client");
|
|
21142
21309
|
var import_openapi5 = require("@orpc/openapi");
|
|
21143
|
-
var
|
|
21310
|
+
var import_zod38 = require("zod");
|
|
21144
21311
|
init_update();
|
|
21145
21312
|
var FRONTDOOR_API_TAG = "frontdoor";
|
|
21146
21313
|
var UPDATE_API_TAG = "update";
|
|
@@ -21148,7 +21315,7 @@ function createLifecycleApiRouter(deps) {
|
|
|
21148
21315
|
const authed = doorApiAuth(deps.expectedToken);
|
|
21149
21316
|
return {
|
|
21150
21317
|
frontdoor: {
|
|
21151
|
-
refreshCatalogues: authed.meta((0, import_openapi5.openapi)({ method: "POST", path: "/rest/frontdoor/catalogues/refresh", summary: "Request a catalogue refresh tick", tags: [FRONTDOOR_API_TAG] })).output(
|
|
21318
|
+
refreshCatalogues: authed.meta((0, import_openapi5.openapi)({ method: "POST", path: "/rest/frontdoor/catalogues/refresh", summary: "Request a catalogue refresh tick", tags: [FRONTDOOR_API_TAG] })).output(import_zod38.z.strictObject({ requested: import_zod38.z.literal(true) })).handler(() => {
|
|
21152
21319
|
deps.refreshCatalogues();
|
|
21153
21320
|
return { requested: true };
|
|
21154
21321
|
}),
|
|
@@ -21185,61 +21352,62 @@ init_cliError();
|
|
|
21185
21352
|
|
|
21186
21353
|
// src/frontdoor/launchSchemas.ts
|
|
21187
21354
|
var import_node_path43 = __toESM(require("node:path"), 1);
|
|
21188
|
-
var
|
|
21355
|
+
var import_zod39 = require("zod");
|
|
21189
21356
|
init_statusline();
|
|
21190
21357
|
init_claudeVersion();
|
|
21191
21358
|
init_identity();
|
|
21192
|
-
var LaunchResolveInputSchema =
|
|
21193
|
-
path:
|
|
21359
|
+
var LaunchResolveInputSchema = import_zod39.z.strictObject({
|
|
21360
|
+
path: import_zod39.z.string().min(1),
|
|
21194
21361
|
/** `@name`, launch flags, then the arguments for `claude`; empty for a bare launch. */
|
|
21195
|
-
argv:
|
|
21362
|
+
argv: import_zod39.z.readonly(import_zod39.z.array(import_zod39.z.string())).optional(),
|
|
21196
21363
|
/** The launch's inherited environment. Absent means an empty one: the door's own environment is never a substitute for the caller's, so a caller that wants `AGENT_SHIM_*` switches or a `CLAUDE_CONFIG_DIR` considered names them here. Values are read, never reported. */
|
|
21197
|
-
env:
|
|
21364
|
+
env: import_zod39.z.record(import_zod39.z.string(), import_zod39.z.string()).optional()
|
|
21198
21365
|
}).refine((input) => import_node_path43.default.isAbsolute(input.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
21199
|
-
var LaunchPoolDecisionSchema =
|
|
21200
|
-
name:
|
|
21201
|
-
reasons:
|
|
21202
|
-
movedOff:
|
|
21366
|
+
var LaunchPoolDecisionSchema = import_zod39.z.strictObject({
|
|
21367
|
+
name: import_zod39.z.string(),
|
|
21368
|
+
reasons: import_zod39.z.readonly(import_zod39.z.array(import_zod39.z.string())),
|
|
21369
|
+
movedOff: import_zod39.z.strictObject({ identity: import_zod39.z.string(), reason: import_zod39.z.string() }).optional()
|
|
21203
21370
|
});
|
|
21204
|
-
var LaunchDecisionSchema =
|
|
21205
|
-
identity:
|
|
21206
|
-
identityId:
|
|
21207
|
-
identitySource:
|
|
21371
|
+
var LaunchDecisionSchema = import_zod39.z.strictObject({
|
|
21372
|
+
identity: import_zod39.z.string().optional(),
|
|
21373
|
+
identityId: import_zod39.z.string().optional(),
|
|
21374
|
+
identitySource: import_zod39.z.enum(IDENTITY_DECISION_SOURCES),
|
|
21208
21375
|
pool: LaunchPoolDecisionSchema.optional(),
|
|
21209
|
-
|
|
21210
|
-
|
|
21211
|
-
|
|
21212
|
-
|
|
21213
|
-
|
|
21376
|
+
/** True when `CLAUDE_CONFIG_DIR` was already set and nothing on the command line named an identity; an identity named there outranks the variable and leaves it false. */
|
|
21377
|
+
configDirEscapeHatch: import_zod39.z.boolean(),
|
|
21378
|
+
configDir: import_zod39.z.string().optional(),
|
|
21379
|
+
configProfile: import_zod39.z.string().optional(),
|
|
21380
|
+
configProfileSource: import_zod39.z.enum(CONFIG_PROFILE_DECISION_SOURCES),
|
|
21381
|
+
provider: import_zod39.z.string().optional()
|
|
21214
21382
|
});
|
|
21215
|
-
var LaunchFlagsSchema =
|
|
21216
|
-
skipPermissions:
|
|
21217
|
-
remoteControl:
|
|
21218
|
-
headroom:
|
|
21219
|
-
trackUsage:
|
|
21220
|
-
pause:
|
|
21221
|
-
explain:
|
|
21383
|
+
var LaunchFlagsSchema = import_zod39.z.strictObject({
|
|
21384
|
+
skipPermissions: import_zod39.z.boolean(),
|
|
21385
|
+
remoteControl: import_zod39.z.boolean(),
|
|
21386
|
+
headroom: import_zod39.z.boolean(),
|
|
21387
|
+
trackUsage: import_zod39.z.boolean(),
|
|
21388
|
+
pause: import_zod39.z.boolean(),
|
|
21389
|
+
explain: import_zod39.z.boolean(),
|
|
21222
21390
|
/** How long the launch waits after its own output before it starts claude, in milliseconds. */
|
|
21223
|
-
delayMs:
|
|
21391
|
+
delayMs: import_zod39.z.number(),
|
|
21224
21392
|
/** The hosts the launch keeps off the front door by adding them to the child's `NO_PROXY`. */
|
|
21225
|
-
proxyBypass:
|
|
21393
|
+
proxyBypass: import_zod39.z.array(import_zod39.z.string()).readonly(),
|
|
21226
21394
|
/** How the session's built-in statusline looks, when the launch configures any of it. */
|
|
21227
21395
|
statusline: StatuslineSchema.optional()
|
|
21228
21396
|
});
|
|
21229
|
-
var LaunchResolveOutputSchema =
|
|
21397
|
+
var LaunchResolveOutputSchema = import_zod39.z.strictObject({
|
|
21230
21398
|
decision: LaunchDecisionSchema,
|
|
21231
21399
|
flags: LaunchFlagsSchema,
|
|
21232
|
-
claudeVersion:
|
|
21400
|
+
claudeVersion: import_zod39.z.strictObject({ version: import_zod39.z.string(), source: import_zod39.z.enum(CLAUDE_VERSION_SOURCES) }).optional(),
|
|
21233
21401
|
/** The real `claude` binary the launch would spawn, on the door's host. */
|
|
21234
|
-
bin:
|
|
21402
|
+
bin: import_zod39.z.string(),
|
|
21235
21403
|
/** The arguments the launch would pass it: the tool's own flags, then `CLAUDE_EXTRA_FLAGS`, then the caller's own. */
|
|
21236
|
-
args:
|
|
21404
|
+
args: import_zod39.z.readonly(import_zod39.z.array(import_zod39.z.string())),
|
|
21237
21405
|
/** The credential the launch would authenticate with, by target and source kinds. Absent when none applies. */
|
|
21238
|
-
credential:
|
|
21239
|
-
routing:
|
|
21406
|
+
credential: import_zod39.z.strictObject({ subject: import_zod39.z.enum(["provider", "identity"]), name: import_zod39.z.string(), summary: CredentialSummarySchema }).optional(),
|
|
21407
|
+
routing: import_zod39.z.strictObject({ frontDoor: import_zod39.z.boolean(), headroom: import_zod39.z.boolean() }),
|
|
21240
21408
|
/** The names of the environment variables the launch would set or unset, sorted. Values are not reported. */
|
|
21241
|
-
environment:
|
|
21242
|
-
warnings:
|
|
21409
|
+
environment: import_zod39.z.readonly(import_zod39.z.array(import_zod39.z.string())),
|
|
21410
|
+
warnings: import_zod39.z.readonly(import_zod39.z.array(import_zod39.z.string()))
|
|
21243
21411
|
});
|
|
21244
21412
|
|
|
21245
21413
|
// src/frontdoor/launchApi.ts
|
|
@@ -21275,22 +21443,22 @@ function createLaunchApiRouter(deps) {
|
|
|
21275
21443
|
// src/frontdoor/agentTreesApi.ts
|
|
21276
21444
|
var import_client6 = require("@orpc/client");
|
|
21277
21445
|
var import_openapi7 = require("@orpc/openapi");
|
|
21278
|
-
var
|
|
21446
|
+
var import_zod40 = require("zod");
|
|
21279
21447
|
init_cliError();
|
|
21280
|
-
var AgentTreesListInputSchema =
|
|
21448
|
+
var AgentTreesListInputSchema = import_zod40.z.strictObject({
|
|
21281
21449
|
/** Only this identity's sessions. */
|
|
21282
|
-
identity:
|
|
21450
|
+
identity: import_zod40.z.string().optional(),
|
|
21283
21451
|
/** Include sessions that spawned no agent and ran no workflow. */
|
|
21284
|
-
all:
|
|
21452
|
+
all: import_zod40.z.boolean().optional()
|
|
21285
21453
|
});
|
|
21286
|
-
var AgentTreesListOutputSchema =
|
|
21287
|
-
var AgentTreesShowInputSchema =
|
|
21454
|
+
var AgentTreesListOutputSchema = import_zod40.z.array(SessionSummarySchema);
|
|
21455
|
+
var AgentTreesShowInputSchema = import_zod40.z.strictObject({
|
|
21288
21456
|
/** A session id, or an unambiguous prefix of one. */
|
|
21289
|
-
session:
|
|
21457
|
+
session: import_zod40.z.string().min(1),
|
|
21290
21458
|
/** Look only in this identity. */
|
|
21291
|
-
identity:
|
|
21459
|
+
identity: import_zod40.z.string().optional()
|
|
21292
21460
|
});
|
|
21293
|
-
var AgentTreesShowOutputSchema =
|
|
21461
|
+
var AgentTreesShowOutputSchema = import_zod40.z.strictObject({ identities: import_zod40.z.array(import_zod40.z.string()), ...MergedAgentTreeSchema.shape });
|
|
21294
21462
|
function asBadRequest(error) {
|
|
21295
21463
|
if (error instanceof CliError) {
|
|
21296
21464
|
throw new import_client6.ORPCError("BAD_REQUEST", { message: error.message });
|
|
@@ -21343,7 +21511,7 @@ var import_openapi8 = require("@orpc/openapi");
|
|
|
21343
21511
|
var import_server4 = require("@orpc/server");
|
|
21344
21512
|
|
|
21345
21513
|
// src/frontdoor/rcEventLog.ts
|
|
21346
|
-
var
|
|
21514
|
+
var import_zod41 = require("zod");
|
|
21347
21515
|
|
|
21348
21516
|
// src/frontdoor/eventHub.ts
|
|
21349
21517
|
var DOOR_EVENT_BUFFER_EVENTS = 100;
|
|
@@ -21466,46 +21634,46 @@ var NUMBER_FIELDS = ["at", "sequence"].length;
|
|
|
21466
21634
|
var BYTES_PER_CODE_UNIT = Uint16Array.BYTES_PER_ELEMENT;
|
|
21467
21635
|
var RC_SESSION_END_REASONS = ["expired", "archived", "conflict"];
|
|
21468
21636
|
var RC_PENDING_RETIRE_REASONS = ["answered", "expired", "session-ended"];
|
|
21469
|
-
var transitionBase = { session:
|
|
21470
|
-
var cursorFields = { cursor:
|
|
21471
|
-
var sessionAppearedShape = { kind:
|
|
21472
|
-
var sessionEndedShape = { kind:
|
|
21473
|
-
var workerStateShape = { kind:
|
|
21474
|
-
var pendingBornShape = { kind:
|
|
21475
|
-
var pendingRetiredShape = { kind:
|
|
21476
|
-
var RcSessionTransitionSchema =
|
|
21477
|
-
|
|
21478
|
-
|
|
21479
|
-
|
|
21480
|
-
|
|
21481
|
-
|
|
21637
|
+
var transitionBase = { session: import_zod41.z.string(), at: import_zod41.z.number() };
|
|
21638
|
+
var cursorFields = { cursor: import_zod41.z.string(), sequence: import_zod41.z.int().positive() };
|
|
21639
|
+
var sessionAppearedShape = { kind: import_zod41.z.literal("session-appeared"), ...transitionBase };
|
|
21640
|
+
var sessionEndedShape = { kind: import_zod41.z.literal("session-ended"), reason: import_zod41.z.enum(RC_SESSION_END_REASONS), ...transitionBase };
|
|
21641
|
+
var workerStateShape = { kind: import_zod41.z.literal("worker-state"), state: import_zod41.z.string(), previous: import_zod41.z.string().optional(), ...transitionBase };
|
|
21642
|
+
var pendingBornShape = { kind: import_zod41.z.literal("pending-born"), requestId: import_zod41.z.string(), type: import_zod41.z.string(), summary: import_zod41.z.string(), ...transitionBase };
|
|
21643
|
+
var pendingRetiredShape = { kind: import_zod41.z.literal("pending-retired"), requestId: import_zod41.z.string(), reason: import_zod41.z.enum(RC_PENDING_RETIRE_REASONS), ...transitionBase };
|
|
21644
|
+
var RcSessionTransitionSchema = import_zod41.z.discriminatedUnion("kind", [
|
|
21645
|
+
import_zod41.z.strictObject(sessionAppearedShape),
|
|
21646
|
+
import_zod41.z.strictObject(sessionEndedShape),
|
|
21647
|
+
import_zod41.z.strictObject(workerStateShape),
|
|
21648
|
+
import_zod41.z.strictObject(pendingBornShape),
|
|
21649
|
+
import_zod41.z.strictObject(pendingRetiredShape)
|
|
21482
21650
|
]);
|
|
21483
21651
|
var KIND_MAX_CHARS = Math.max(...RcSessionTransitionSchema.options.map((option) => option.shape.kind.value.length));
|
|
21484
21652
|
var RC_SESSION_EVENT_MAX_BYTES = (RC_SESSION_EVENT_GENERATION_MAX_CHARS + ".".length + SEQUENCE_MAX_DIGITS + RC_SESSION_EVENT_TOKEN_MAX_CHARS + KIND_MAX_CHARS + RC_SESSION_EVENT_TOKEN_MAX_CHARS + RC_SESSION_EVENT_TOKEN_MAX_CHARS + RC_SESSION_EVENT_SUMMARY_MAX_CHARS) * BYTES_PER_CODE_UNIT + NUMBER_FIELDS * NUMBER_BYTES;
|
|
21485
21653
|
var RC_SESSION_EVENT_LOG_CAPACITY = Math.floor(CONTROL_BODY_CAP_BYTES / RC_SESSION_EVENT_MAX_BYTES);
|
|
21486
|
-
var RcSessionEventSchema =
|
|
21487
|
-
|
|
21488
|
-
|
|
21489
|
-
|
|
21490
|
-
|
|
21491
|
-
|
|
21654
|
+
var RcSessionEventSchema = import_zod41.z.discriminatedUnion("kind", [
|
|
21655
|
+
import_zod41.z.strictObject({ ...cursorFields, ...sessionAppearedShape }),
|
|
21656
|
+
import_zod41.z.strictObject({ ...cursorFields, ...sessionEndedShape }),
|
|
21657
|
+
import_zod41.z.strictObject({ ...cursorFields, ...workerStateShape }),
|
|
21658
|
+
import_zod41.z.strictObject({ ...cursorFields, ...pendingBornShape }),
|
|
21659
|
+
import_zod41.z.strictObject({ ...cursorFields, ...pendingRetiredShape })
|
|
21492
21660
|
]);
|
|
21493
|
-
var RcSessionEventsReadInputSchema =
|
|
21661
|
+
var RcSessionEventsReadInputSchema = import_zod41.z.strictObject({
|
|
21494
21662
|
/** The cursor of the last event the caller saw; every retained event when omitted. */
|
|
21495
|
-
since:
|
|
21663
|
+
since: import_zod41.z.string().min(1).optional(),
|
|
21496
21664
|
/** One `cse_` session id; every session when omitted. */
|
|
21497
|
-
session:
|
|
21665
|
+
session: import_zod41.z.string().min(1).optional(),
|
|
21498
21666
|
/** The most events one answer carries; every event after `since` when omitted. */
|
|
21499
|
-
limit:
|
|
21667
|
+
limit: import_zod41.z.int().positive().optional()
|
|
21500
21668
|
});
|
|
21501
21669
|
var RcSessionEventsPageInputSchema = RcSessionEventsReadInputSchema.extend({
|
|
21502
21670
|
/** The most events this page carries: by default and at most, the bound the door's event backbone already holds per slow consumer (`DOOR_EVENT_BUFFER_EVENTS`, oRPC's own documented default for that case). A page lands whole in its reader, so a reader receives at most one consumer buffer's worth at a time (at worst `DOOR_EVENT_BUFFER_EVENTS` times `RC_SESSION_EVENT_MAX_BYTES`) and pages on with the cursor for more; a maximum of the whole window would let one page carry the log's entire memory budget into an agent's context. */
|
|
21503
|
-
limit:
|
|
21671
|
+
limit: import_zod41.z.int().positive().max(DOOR_EVENT_BUFFER_EVENTS).default(DOOR_EVENT_BUFFER_EVENTS)
|
|
21504
21672
|
});
|
|
21505
21673
|
var RcSessionEventsStreamInputSchema = RcSessionEventsReadInputSchema.omit({ limit: true });
|
|
21506
|
-
var RcSessionEventsReadOutputSchema =
|
|
21507
|
-
|
|
21508
|
-
|
|
21674
|
+
var RcSessionEventsReadOutputSchema = import_zod41.z.discriminatedUnion("status", [
|
|
21675
|
+
import_zod41.z.strictObject({ status: import_zod41.z.literal("ok"), events: import_zod41.z.readonly(import_zod41.z.array(RcSessionEventSchema)), cursor: import_zod41.z.string(), more: import_zod41.z.boolean(), head: import_zod41.z.string() }),
|
|
21676
|
+
import_zod41.z.strictObject({ status: import_zod41.z.literal("expired"), message: import_zod41.z.string(), head: import_zod41.z.string() })
|
|
21509
21677
|
]);
|
|
21510
21678
|
var CURSOR_SEPARATOR = ".";
|
|
21511
21679
|
var RESYNC_ADVICE = "cursor expired, resync from status: read `rc status` for every session's present state, then resume after the head this answer names";
|
|
@@ -23833,7 +24001,7 @@ init_poolPick();
|
|
|
23833
24001
|
|
|
23834
24002
|
// src/agents/read.ts
|
|
23835
24003
|
var import_node_path46 = __toESM(require("node:path"), 1);
|
|
23836
|
-
var
|
|
24004
|
+
var import_zod42 = require("zod");
|
|
23837
24005
|
var PROJECTS_DIR = "projects";
|
|
23838
24006
|
var TASKS_DIR = "tasks";
|
|
23839
24007
|
var SUBAGENTS_DIR = "subagents";
|
|
@@ -23952,14 +24120,14 @@ function parseJson2(text) {
|
|
|
23952
24120
|
return void 0;
|
|
23953
24121
|
}
|
|
23954
24122
|
}
|
|
23955
|
-
var TaskFileSchema =
|
|
23956
|
-
var WorkflowRunFileSchema =
|
|
23957
|
-
runId:
|
|
23958
|
-
workflowName:
|
|
23959
|
-
status:
|
|
23960
|
-
startTime:
|
|
23961
|
-
phases:
|
|
23962
|
-
summary:
|
|
24123
|
+
var TaskFileSchema = import_zod42.z.object({ ...TaskItemSchema.omit({ taskList: true }).shape, blocks: import_zod42.z.array(import_zod42.z.string()).default([]), blockedBy: import_zod42.z.array(import_zod42.z.string()).default([]) });
|
|
24124
|
+
var WorkflowRunFileSchema = import_zod42.z.object({
|
|
24125
|
+
runId: import_zod42.z.string(),
|
|
24126
|
+
workflowName: import_zod42.z.string().optional(),
|
|
24127
|
+
status: import_zod42.z.string().optional(),
|
|
24128
|
+
startTime: import_zod42.z.number().optional(),
|
|
24129
|
+
phases: import_zod42.z.array(import_zod42.z.object({ title: import_zod42.z.string() })).default([]),
|
|
24130
|
+
summary: import_zod42.z.string().optional()
|
|
23963
24131
|
});
|
|
23964
24132
|
function summariseSession(fs17, configDir, ref) {
|
|
23965
24133
|
const sessionRelative = import_node_path46.default.join(PROJECTS_DIR, ref.project, ref.entry);
|