claude-use 14.0.1 → 14.0.2
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 +14418 -13999
- package/dist/index.cjs +265 -157
- package/dist/index.mjs +257 -149
- package/dist/types/index.d.ts +897 -897
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -96,14 +96,42 @@ var init_categories_default = __esm({
|
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
-
// src/
|
|
100
|
-
function
|
|
101
|
-
const
|
|
102
|
-
return
|
|
99
|
+
// src/hostName.ts
|
|
100
|
+
function isDottedDecimalIpv4(host) {
|
|
101
|
+
const parts = host.split(".");
|
|
102
|
+
return parts.length === IPV4_PARTS && parts.every((part) => IPV4_PART.test(part) && Number(part) <= MAX_OCTET);
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
|
|
104
|
+
function dnsNameProblem(name) {
|
|
105
|
+
if (name.length > MAX_NAME_LENGTH) {
|
|
106
|
+
return `a host longer than ${String(MAX_NAME_LENGTH)} characters`;
|
|
107
|
+
}
|
|
108
|
+
const labels = name.split(".");
|
|
109
|
+
if (labels.some((label) => label.length > MAX_LABEL_LENGTH)) {
|
|
110
|
+
return `a host with a label longer than ${String(MAX_LABEL_LENGTH)} characters`;
|
|
111
|
+
}
|
|
112
|
+
if (!labels.every((label) => LABEL.test(label))) {
|
|
113
|
+
return "a host that is not letters, digits, underscores and interior hyphens in non-empty dot-separated labels";
|
|
114
|
+
}
|
|
115
|
+
if (NUMERIC_LAST_LABEL.test(labels[labels.length - 1] ?? "")) {
|
|
116
|
+
return "a numeric host that is not a dotted-decimal IPv4 address";
|
|
117
|
+
}
|
|
118
|
+
return void 0;
|
|
106
119
|
}
|
|
120
|
+
var MAX_LABEL_LENGTH, MAX_NAME_LENGTH, IPV4_PARTS, MAX_OCTET, LABEL, NUMERIC_LAST_LABEL, IPV4_PART;
|
|
121
|
+
var init_hostName = __esm({
|
|
122
|
+
"src/hostName.ts"() {
|
|
123
|
+
"use strict";
|
|
124
|
+
MAX_LABEL_LENGTH = 63;
|
|
125
|
+
MAX_NAME_LENGTH = 253;
|
|
126
|
+
IPV4_PARTS = 4;
|
|
127
|
+
MAX_OCTET = 255;
|
|
128
|
+
LABEL = /^[a-z0-9_](?:[a-z0-9_-]*[a-z0-9_])?$/i;
|
|
129
|
+
NUMERIC_LAST_LABEL = /^(?:\d+|0x[0-9a-f]*)$/i;
|
|
130
|
+
IPV4_PART = /^(?:0|[1-9]\d{0,2})$/;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// src/config/proxyBypass.ts
|
|
107
135
|
function proxyBypassSyntaxProblem(entry) {
|
|
108
136
|
if (entry === "" || entry !== entry.trim()) {
|
|
109
137
|
return "is empty or has surrounding whitespace";
|
|
@@ -120,21 +148,15 @@ function proxyBypassSyntaxProblem(entry) {
|
|
|
120
148
|
if (entry.includes(":")) {
|
|
121
149
|
return "has a port, which the proxy variable cannot express: list the host alone";
|
|
122
150
|
}
|
|
123
|
-
return
|
|
151
|
+
return isDottedDecimalIpv4(entry) || dnsNameProblem(entry.replace(/^\./, "")) === void 0 ? void 0 : "is not a host name or an IPv4 address";
|
|
124
152
|
}
|
|
125
153
|
function proxyBypassName(entry) {
|
|
126
|
-
return
|
|
154
|
+
return isDottedDecimalIpv4(entry) ? void 0 : entry.replace(/^\./, "").toLowerCase();
|
|
127
155
|
}
|
|
128
|
-
var MAX_NAME_LENGTH, MAX_LABEL_LENGTH, MAX_OCTET, LABEL_RE, IPV4_RE, DIGITS_RE;
|
|
129
156
|
var init_proxyBypass = __esm({
|
|
130
157
|
"src/config/proxyBypass.ts"() {
|
|
131
158
|
"use strict";
|
|
132
|
-
|
|
133
|
-
MAX_LABEL_LENGTH = 63;
|
|
134
|
-
MAX_OCTET = 255;
|
|
135
|
-
LABEL_RE = /^[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?$/;
|
|
136
|
-
IPV4_RE = /^\d{1,3}(?:\.\d{1,3}){3}$/;
|
|
137
|
-
DIGITS_RE = /^\d+$/;
|
|
159
|
+
init_hostName();
|
|
138
160
|
}
|
|
139
161
|
});
|
|
140
162
|
|
|
@@ -328,7 +350,7 @@ function resolveStatusline(settings) {
|
|
|
328
350
|
}
|
|
329
351
|
return resolved;
|
|
330
352
|
}
|
|
331
|
-
var import_string_width2, import_zod2, STATUSLINE_HEADER_SEGMENTS, STATUSLINE_ROWS, STATUSLINE_SESSION_TIME_PARTS, PROMPT_CACHE_TTL_SECONDS, ORANGE_PALETTE_INDEX, STATUSLINE_COLOUR_NAMES, DEFAULT_HEADER_SEGMENTS, DEFAULT_ROWS, CLAUDE_HUD_DEFAULTS, STATUSLINE_PRESETS, GIT_WITH_DIRTY_MARKER, JJ_OFF, PRESET_BUNDLES, STATUSLINE_PATH_LEVELS, STATUSLINE_USAGE_VALUES, STATUSLINE_BAR_GRADIENTS, STATUSLINE_TIME_FORMATS, STATUSLINE_HOUR_CYCLES, MAX_PERCENT, MAX_STATUSLINE_PALETTE_INDEX, MAX_STATUSLINE_LABEL_COLUMNS, MIN_STATUSLINE_COLUMNS, MAX_STATUSLINE_COLUMNS, MAX_BAR_CELLS, MAX_ACCOUNT_USER_CHARS, MAX_DISPLAY_TEXT_CHARS, MAX_EXTRA_COMMAND_ARGUMENTS, MAX_EXTRA_COMMAND_ARGUMENT_CHARS, STATUSLINE_EXTRA_GROUP, commandArgument,
|
|
353
|
+
var import_string_width2, import_zod2, STATUSLINE_HEADER_SEGMENTS, STATUSLINE_ROWS, STATUSLINE_SESSION_TIME_PARTS, PROMPT_CACHE_TTL_SECONDS, ORANGE_PALETTE_INDEX, STATUSLINE_COLOUR_NAMES, DEFAULT_HEADER_SEGMENTS, DEFAULT_ROWS, CLAUDE_HUD_DEFAULTS, STATUSLINE_PRESETS, GIT_WITH_DIRTY_MARKER, JJ_OFF, PRESET_BUNDLES, STATUSLINE_PATH_LEVELS, STATUSLINE_USAGE_VALUES, STATUSLINE_BAR_GRADIENTS, STATUSLINE_TIME_FORMATS, STATUSLINE_HOUR_CYCLES, MAX_PERCENT, MAX_STATUSLINE_PALETTE_INDEX, MAX_STATUSLINE_LABEL_COLUMNS, MIN_STATUSLINE_COLUMNS, MAX_STATUSLINE_COLUMNS, MAX_BAR_CELLS, MAX_ACCOUNT_USER_CHARS, MAX_DISPLAY_TEXT_CHARS, MAX_EXTRA_COMMAND_ARGUMENTS, MAX_EXTRA_COMMAND_ARGUMENT_CHARS, STATUSLINE_EXTRA_GROUP, commandArgument, LABEL_RE, OPTIONAL_LABEL_RE, mergeGroups, colourValue, barCharacter, STATUSLINE_CONTEXT_VALUES, STATUSLINE_CONTEXT_ESTIMATES, AUTOCOMPACT_RESERVE_FRACTION, AUTOCOMPACT_RESERVE_RAMP_START, AUTOCOMPACT_RESERVE_RAMP_END, labelWithinColumns, labelWithinColumnsMessage, labelShowsSomething, labelShowsSomethingMessage, labelIsPlainText, labelIsPlainTextMessage, windowLabel, overrideText, wholePercent, thresholdPercent, SHAPES, UNSET_NOTE, RESET_NOTE, LANGUAGE_DESCRIPTION, LANGUAGE_TAGS, LANGUAGE_ALIASES, TOP_LEVEL, StatuslineSchema, ResolvedStatuslineSchema, STATUSLINE_DEFAULTS, STATUSLINE_ENV;
|
|
332
354
|
var init_statusline = __esm({
|
|
333
355
|
"src/config/statusline.ts"() {
|
|
334
356
|
"use strict";
|
|
@@ -401,7 +423,7 @@ var init_statusline = __esm({
|
|
|
401
423
|
MAX_EXTRA_COMMAND_ARGUMENT_CHARS = 1024;
|
|
402
424
|
STATUSLINE_EXTRA_GROUP = "extra";
|
|
403
425
|
commandArgument = import_zod2.z.string().max(MAX_EXTRA_COMMAND_ARGUMENT_CHARS).refine((argument) => !argument.includes("\0"), "must not contain a NUL character");
|
|
404
|
-
|
|
426
|
+
LABEL_RE = /^[^\p{C}\p{Z}]+(?: [^\p{C}\p{Z}]+)*$/u;
|
|
405
427
|
OPTIONAL_LABEL_RE = /^(?:[^\p{C}\p{Z}]+(?: [^\p{C}\p{Z}]+)*)?$/u;
|
|
406
428
|
mergeGroups = import_zod2.z.array(distinctList(import_zod2.z.enum(STATUSLINE_ROWS)).min(2)).refine((groups) => {
|
|
407
429
|
const rows = groups.flat();
|
|
@@ -418,7 +440,7 @@ var init_statusline = __esm({
|
|
|
418
440
|
labelWithinColumnsMessage = `must take no more than ${String(MAX_STATUSLINE_LABEL_COLUMNS)} terminal columns`;
|
|
419
441
|
labelShowsSomething = (text) => !drawsNothing(text);
|
|
420
442
|
labelShowsSomethingMessage = "must show something: a label of only combining marks or blank characters draws nothing";
|
|
421
|
-
labelIsPlainText = (text) =>
|
|
443
|
+
labelIsPlainText = (text) => LABEL_RE.test(text);
|
|
422
444
|
labelIsPlainTextMessage = "must be visible text without control characters";
|
|
423
445
|
windowLabel = import_zod2.z.string().refine((text) => text === "" || labelWithinColumns(text), labelWithinColumnsMessage).refine((text) => text === "" || labelShowsSomething(text), labelShowsSomethingMessage).refine((text) => text === "" || labelIsPlainText(text), labelIsPlainTextMessage);
|
|
424
446
|
overrideText = import_zod2.z.string().max(MAX_DISPLAY_TEXT_CHARS).regex(OPTIONAL_LABEL_RE, "must be visible text without control characters");
|
|
@@ -3771,6 +3793,120 @@ var init_farm = __esm({
|
|
|
3771
3793
|
}
|
|
3772
3794
|
});
|
|
3773
3795
|
|
|
3796
|
+
// src/baseUrlDial.ts
|
|
3797
|
+
function dialHostOf(url) {
|
|
3798
|
+
return withoutRootDot(url.hostname.replace(/^\[(.*)\]$/, "$1"));
|
|
3799
|
+
}
|
|
3800
|
+
function withoutRootDot(host) {
|
|
3801
|
+
return host.endsWith(".") ? host.slice(0, -1) : host;
|
|
3802
|
+
}
|
|
3803
|
+
function bareZone(literal) {
|
|
3804
|
+
return literal.replace("%25", "%");
|
|
3805
|
+
}
|
|
3806
|
+
function portOf(text) {
|
|
3807
|
+
if (text === "") {
|
|
3808
|
+
return "has no port after the colon";
|
|
3809
|
+
}
|
|
3810
|
+
if (!/^\d+$/.test(text)) {
|
|
3811
|
+
return "has a port that is not a number";
|
|
3812
|
+
}
|
|
3813
|
+
const port = Number(text);
|
|
3814
|
+
return port >= 1 && port <= MAX_TCP_PORT ? port : `has a port outside 1 to ${String(MAX_TCP_PORT)}`;
|
|
3815
|
+
}
|
|
3816
|
+
function isAscii(text) {
|
|
3817
|
+
return new RegExp("^\\p{ASCII}*$", "u").test(text);
|
|
3818
|
+
}
|
|
3819
|
+
function nameOf(host) {
|
|
3820
|
+
const rooted = withoutRootDot(host.toLowerCase());
|
|
3821
|
+
if (rooted === "") {
|
|
3822
|
+
return { refusal: "an authority that names no host" };
|
|
3823
|
+
}
|
|
3824
|
+
const lowered = isAscii(rooted) ? rooted : (0, import_node_url.domainToASCII)(rooted);
|
|
3825
|
+
if (lowered === "") {
|
|
3826
|
+
return { refusal: "a host that does not convert to an ASCII name" };
|
|
3827
|
+
}
|
|
3828
|
+
if (isDottedDecimalIpv4(lowered)) {
|
|
3829
|
+
return lowered;
|
|
3830
|
+
}
|
|
3831
|
+
const problem = dnsNameProblem(lowered);
|
|
3832
|
+
if (problem !== void 0) {
|
|
3833
|
+
return { refusal: problem };
|
|
3834
|
+
}
|
|
3835
|
+
return lowered;
|
|
3836
|
+
}
|
|
3837
|
+
function canonicalLiteral(literal) {
|
|
3838
|
+
return literal.includes("%") ? lowerHost(literal) : dialHostOf(new URL(`http://[${literal}]/`));
|
|
3839
|
+
}
|
|
3840
|
+
function lowerHost(host) {
|
|
3841
|
+
const zone = host.indexOf("%");
|
|
3842
|
+
return zone === -1 ? host.toLowerCase() : `${host.slice(0, zone).toLowerCase()}${host.slice(zone)}`;
|
|
3843
|
+
}
|
|
3844
|
+
function parseDialAuthority(authority, defaultPort) {
|
|
3845
|
+
if (authority.includes("@")) {
|
|
3846
|
+
return { refusal: "an authority with userinfo cannot be dialled" };
|
|
3847
|
+
}
|
|
3848
|
+
if (NOT_AUTHORITY.test(authority)) {
|
|
3849
|
+
return { refusal: "an authority holds whitespace, a path, a query or a fragment" };
|
|
3850
|
+
}
|
|
3851
|
+
if (authority.startsWith("[")) {
|
|
3852
|
+
const close = authority.indexOf("]");
|
|
3853
|
+
if (close === -1) {
|
|
3854
|
+
return { refusal: "an authority with an unterminated bracket" };
|
|
3855
|
+
}
|
|
3856
|
+
const literal = bareZone(authority.slice(1, close));
|
|
3857
|
+
const rest = authority.slice(close + 1);
|
|
3858
|
+
if (literal === "") {
|
|
3859
|
+
return { refusal: "an authority that names no host" };
|
|
3860
|
+
}
|
|
3861
|
+
if (!(0, import_node_net.isIPv6)(literal)) {
|
|
3862
|
+
return { refusal: "a bracketed host that is not an IPv6 literal" };
|
|
3863
|
+
}
|
|
3864
|
+
if (rest !== "" && !rest.startsWith(":")) {
|
|
3865
|
+
return { refusal: "an authority with text after the closing bracket other than a port" };
|
|
3866
|
+
}
|
|
3867
|
+
const port2 = rest === "" ? defaultPort : portOf(rest.slice(1));
|
|
3868
|
+
return typeof port2 === "string" ? { refusal: `an authority that ${port2}` } : { host: canonicalLiteral(literal), port: port2 };
|
|
3869
|
+
}
|
|
3870
|
+
const colons = authority.split(":").length - 1;
|
|
3871
|
+
if (colons > 1) {
|
|
3872
|
+
return { refusal: "an unbracketed IPv6 literal, which must be written in brackets" };
|
|
3873
|
+
}
|
|
3874
|
+
const colon = authority.indexOf(":");
|
|
3875
|
+
const host = colon === -1 ? authority : authority.slice(0, colon);
|
|
3876
|
+
if (host === "") {
|
|
3877
|
+
return { refusal: "an authority that names no host" };
|
|
3878
|
+
}
|
|
3879
|
+
if (/[[\]]/.test(host)) {
|
|
3880
|
+
return { refusal: "an authority with brackets round something other than an IPv6 literal" };
|
|
3881
|
+
}
|
|
3882
|
+
const name = nameOf(host);
|
|
3883
|
+
if (typeof name !== "string") {
|
|
3884
|
+
return name;
|
|
3885
|
+
}
|
|
3886
|
+
const port = colon === -1 ? defaultPort : portOf(authority.slice(colon + 1));
|
|
3887
|
+
return typeof port === "string" ? { refusal: `an authority that ${port}` } : { host: name, port };
|
|
3888
|
+
}
|
|
3889
|
+
function dialTargetOf(baseUrl) {
|
|
3890
|
+
const url = new URL(baseUrl);
|
|
3891
|
+
const defaultPort = DEFAULT_PORTS[url.protocol];
|
|
3892
|
+
if (defaultPort === void 0) {
|
|
3893
|
+
throw new Error(`${url.protocol} is not a scheme a provider's base URL can have`);
|
|
3894
|
+
}
|
|
3895
|
+
return { host: dialHostOf(url), port: url.port === "" ? defaultPort : Number(url.port) };
|
|
3896
|
+
}
|
|
3897
|
+
var import_node_net, import_node_url, MAX_TCP_PORT, NOT_AUTHORITY, DEFAULT_PORTS;
|
|
3898
|
+
var init_baseUrlDial = __esm({
|
|
3899
|
+
"src/baseUrlDial.ts"() {
|
|
3900
|
+
"use strict";
|
|
3901
|
+
import_node_net = require("node:net");
|
|
3902
|
+
import_node_url = require("node:url");
|
|
3903
|
+
init_hostName();
|
|
3904
|
+
MAX_TCP_PORT = 65535;
|
|
3905
|
+
NOT_AUTHORITY = /[\s/?#\\]/;
|
|
3906
|
+
DEFAULT_PORTS = { "http:": 80, "https:": 443 };
|
|
3907
|
+
}
|
|
3908
|
+
});
|
|
3909
|
+
|
|
3774
3910
|
// src/frontdoor/x509.ts
|
|
3775
3911
|
function tlv(tag, content) {
|
|
3776
3912
|
const length = content.length;
|
|
@@ -3853,7 +3989,7 @@ function ipv6Groups(address) {
|
|
|
3853
3989
|
const [head = "", tail] = address.split("::");
|
|
3854
3990
|
const split = (text) => text === "" ? [] : text.split(":");
|
|
3855
3991
|
const expand = (groups) => groups.flatMap((group) => {
|
|
3856
|
-
if (!
|
|
3992
|
+
if (!import_node_net2.default.isIPv4(group)) {
|
|
3857
3993
|
return [Number.parseInt(group, HEX_RADIX)];
|
|
3858
3994
|
}
|
|
3859
3995
|
const [a = 0, b = 0, c = 0, d = 0] = group.split(".").map(Number);
|
|
@@ -3865,10 +4001,10 @@ function ipv6Groups(address) {
|
|
|
3865
4001
|
return [...before, ...filler, ...after];
|
|
3866
4002
|
}
|
|
3867
4003
|
function ipBytes(address) {
|
|
3868
|
-
if (
|
|
4004
|
+
if (import_node_net2.default.isIPv4(address)) {
|
|
3869
4005
|
return Buffer.from(address.split(".").map(Number));
|
|
3870
4006
|
}
|
|
3871
|
-
if (!
|
|
4007
|
+
if (!import_node_net2.default.isIPv6(address)) {
|
|
3872
4008
|
throw new Error(`${address} is not an IP address`);
|
|
3873
4009
|
}
|
|
3874
4010
|
const bytes = Buffer.alloc(IPV6_GROUPS * BYTES_PER_IPV6_GROUP);
|
|
@@ -3976,7 +4112,7 @@ function issueLeafCertificate(ca, names, notBefore, notAfter) {
|
|
|
3976
4112
|
const caCertificate = new import_node_crypto3.X509Certificate(ca.certPem);
|
|
3977
4113
|
const caPrivateKey = (0, import_node_crypto3.createPrivateKey)(ca.keyPem);
|
|
3978
4114
|
const { publicKey, privateKey } = rsaKeyPair();
|
|
3979
|
-
const generalNames = names.map((name) =>
|
|
4115
|
+
const generalNames = names.map((name) => import_node_net2.default.isIP(name) === 0 ? tlv(TAG_GENERAL_NAME_DNS, Buffer.from(name, "ascii")) : tlv(TAG_GENERAL_NAME_IP, ipBytes(name)));
|
|
3980
4116
|
const der = assemble({
|
|
3981
4117
|
subjectPublicKey: publicKey,
|
|
3982
4118
|
subjectName: commonNameOnly(commonName),
|
|
@@ -3995,12 +4131,12 @@ function issueLeafCertificate(ca, names, notBefore, notAfter) {
|
|
|
3995
4131
|
});
|
|
3996
4132
|
return { certPem: toPem("CERTIFICATE", der), keyPem: keyPem(privateKey) };
|
|
3997
4133
|
}
|
|
3998
|
-
var import_node_crypto3,
|
|
4134
|
+
var import_node_crypto3, import_node_net2, TAG_BOOLEAN, TAG_INTEGER, TAG_BIT_STRING, TAG_OCTET_STRING, TAG_NULL, TAG_OID, TAG_UTF8_STRING, TAG_UTC_TIME, TAG_GENERALIZED_TIME, TAG_SEQUENCE, TAG_SET, TAG_VERSION, TAG_EXTENSIONS, TAG_GENERAL_NAME_DNS, TAG_GENERAL_NAME_IP, TAG_KEY_IDENTIFIER, OID_COMMON_NAME, OID_SHA256_WITH_RSA, OID_SUBJECT_KEY_IDENTIFIER, OID_KEY_USAGE, OID_SUBJECT_ALT_NAME, OID_BASIC_CONSTRAINTS, OID_AUTHORITY_KEY_IDENTIFIER, OID_EXT_KEY_USAGE, OID_SERVER_AUTH, VERSION_3, SERIAL_NUMBER_BYTES, RSA_MODULUS_BITS, BITS_PER_BYTE, BYTE_MASK, HIGH_BIT, BASE_128_PAYLOAD_MASK, FIRST_ARC_WEIGHT, SHORT_FORM_MAX_LENGTH, MS_PER_SECOND, UTC_TIME_LAST_YEAR, YEAR_DIGITS, TWO_DIGIT_YEAR_DIGITS, COMPACT_TIME_DIGITS, KEY_USAGE, SIGNATURE_ALGORITHM, IPV6_GROUPS, HEX_RADIX, BYTES_PER_IPV6_GROUP;
|
|
3999
4135
|
var init_x509 = __esm({
|
|
4000
4136
|
"src/frontdoor/x509.ts"() {
|
|
4001
4137
|
"use strict";
|
|
4002
4138
|
import_node_crypto3 = require("node:crypto");
|
|
4003
|
-
|
|
4139
|
+
import_node_net2 = __toESM(require("node:net"), 1);
|
|
4004
4140
|
TAG_BOOLEAN = 1;
|
|
4005
4141
|
TAG_INTEGER = 2;
|
|
4006
4142
|
TAG_BIT_STRING = 3;
|
|
@@ -4159,6 +4295,39 @@ var init_route = __esm({
|
|
|
4159
4295
|
}
|
|
4160
4296
|
});
|
|
4161
4297
|
|
|
4298
|
+
// src/processRole.ts
|
|
4299
|
+
function enterProcessRole(role) {
|
|
4300
|
+
const previous = currentRole;
|
|
4301
|
+
currentRole = role;
|
|
4302
|
+
return () => {
|
|
4303
|
+
currentRole = previous;
|
|
4304
|
+
};
|
|
4305
|
+
}
|
|
4306
|
+
function noteBlockingStep() {
|
|
4307
|
+
blockingStepObserver?.();
|
|
4308
|
+
}
|
|
4309
|
+
function refuseToBlockInRole(operation) {
|
|
4310
|
+
noteBlockingStep();
|
|
4311
|
+
if (currentRole !== void 0) {
|
|
4312
|
+
throw new BlockingInEventLoopError(operation, currentRole);
|
|
4313
|
+
}
|
|
4314
|
+
}
|
|
4315
|
+
var currentRole, BlockingInEventLoopError, blockingStepObserver;
|
|
4316
|
+
var init_processRole = __esm({
|
|
4317
|
+
"src/processRole.ts"() {
|
|
4318
|
+
"use strict";
|
|
4319
|
+
init_cliError();
|
|
4320
|
+
BlockingInEventLoopError = class extends CliError {
|
|
4321
|
+
constructor(operation, role) {
|
|
4322
|
+
super(
|
|
4323
|
+
`${operation} blocks the calling thread, which in the ${role} is the event loop that answers every session; it must not run there (a launch planned inside the door reaches it through its own addresses, never through the launcher's synchronous coordination)`
|
|
4324
|
+
);
|
|
4325
|
+
this.name = "BlockingInEventLoopError";
|
|
4326
|
+
}
|
|
4327
|
+
};
|
|
4328
|
+
}
|
|
4329
|
+
});
|
|
4330
|
+
|
|
4162
4331
|
// src/baseUrlDisplay.ts
|
|
4163
4332
|
function displayBaseUrl(baseUrl) {
|
|
4164
4333
|
const url = new URL(baseUrl);
|
|
@@ -4909,36 +5078,62 @@ var init_providerCatalogue = __esm({
|
|
|
4909
5078
|
}
|
|
4910
5079
|
});
|
|
4911
5080
|
|
|
5081
|
+
// src/frontdoor/catalogueCleanup.ts
|
|
5082
|
+
async function pruneAbandonedCatalogueGenerations(fs17, paths, ownPid, generation, runningAmong) {
|
|
5083
|
+
const root = import_node_path12.default.join(paths.catalogueDir, "supervisors");
|
|
5084
|
+
const owners = fs17.readdir(root).flatMap((entry) => {
|
|
5085
|
+
const pid = Number(entry);
|
|
5086
|
+
return Number.isSafeInteger(pid) && pid > 0 && String(pid) === entry && fs17.lstat(import_node_path12.default.join(root, entry))?.kind === "dir" ? [pid] : [];
|
|
5087
|
+
});
|
|
5088
|
+
const running = await runningAmong(owners);
|
|
5089
|
+
for (const pid of owners) {
|
|
5090
|
+
if (pid !== ownPid && running.has(pid)) continue;
|
|
5091
|
+
const directory = import_node_path12.default.join(root, String(pid));
|
|
5092
|
+
for (const entry of fs17.readdir(directory)) {
|
|
5093
|
+
const candidate = import_node_path12.default.join(directory, entry);
|
|
5094
|
+
if (import_zod8.z.uuid().safeParse(entry).success && (pid !== ownPid || entry !== generation) && fs17.lstat(candidate)?.kind === "dir") fs17.removeRecursive(candidate);
|
|
5095
|
+
}
|
|
5096
|
+
}
|
|
5097
|
+
}
|
|
5098
|
+
var import_node_path12, import_zod8;
|
|
5099
|
+
var init_catalogueCleanup = __esm({
|
|
5100
|
+
"src/frontdoor/catalogueCleanup.ts"() {
|
|
5101
|
+
"use strict";
|
|
5102
|
+
import_node_path12 = __toESM(require("node:path"), 1);
|
|
5103
|
+
import_zod8 = require("zod");
|
|
5104
|
+
}
|
|
5105
|
+
});
|
|
5106
|
+
|
|
4912
5107
|
// src/frontdoor/state.ts
|
|
4913
5108
|
function readCatalogueStatus(fs17, paths, pid, generation, name) {
|
|
4914
|
-
const file =
|
|
5109
|
+
const file = import_node_path13.default.join(import_node_path13.default.dirname(catalogueCachePath(paths, name, pid, generation)), `${name}.status.json`);
|
|
4915
5110
|
const raw = fs17.readFileUtf8(file);
|
|
4916
5111
|
if (raw === void 0) return void 0;
|
|
4917
5112
|
try {
|
|
4918
|
-
const value =
|
|
5113
|
+
const value = import_zod9.z.strictObject({ status: import_zod9.z.enum(["running", "ready", "failed"]), fingerprint: import_zod9.z.string().min(1).optional(), recordedAt: import_zod9.z.number().optional() }).safeParse(JSON.parse(raw));
|
|
4919
5114
|
return value.success ? value.data : void 0;
|
|
4920
5115
|
} catch {
|
|
4921
5116
|
return void 0;
|
|
4922
5117
|
}
|
|
4923
5118
|
}
|
|
4924
5119
|
function writeFrontDoorCodexHome(fs17, frontdoorDir, pid, codexHome, generation) {
|
|
4925
|
-
const directory =
|
|
5120
|
+
const directory = import_node_path13.default.join(frontdoorDir, "codex-homes");
|
|
4926
5121
|
fs17.mkdirp(directory);
|
|
4927
|
-
fs17.writeFilePrivate(
|
|
5122
|
+
fs17.writeFilePrivate(import_node_path13.default.join(directory, `${String(pid)}.json`), `${JSON.stringify({ codexHome, generation })}
|
|
4928
5123
|
`);
|
|
4929
5124
|
}
|
|
4930
5125
|
function readFrontDoorCodexRecord(fs17, frontdoorDir, pid) {
|
|
4931
|
-
const raw = fs17.readFileUtf8(
|
|
5126
|
+
const raw = fs17.readFileUtf8(import_node_path13.default.join(frontdoorDir, "codex-homes", `${String(pid)}.json`));
|
|
4932
5127
|
if (raw === void 0) return void 0;
|
|
4933
5128
|
try {
|
|
4934
|
-
const parsed =
|
|
4935
|
-
return parsed.success &&
|
|
5129
|
+
const parsed = import_zod9.z.strictObject({ codexHome: import_zod9.z.string().min(1), generation: import_zod9.z.uuid() }).safeParse(JSON.parse(raw));
|
|
5130
|
+
return parsed.success && import_node_path13.default.isAbsolute(parsed.data.codexHome) ? parsed.data : void 0;
|
|
4936
5131
|
} catch {
|
|
4937
5132
|
return void 0;
|
|
4938
5133
|
}
|
|
4939
5134
|
}
|
|
4940
5135
|
function removeFrontDoorCodexHome(fs17, frontdoorDir, pid) {
|
|
4941
|
-
fs17.removeRecursive(
|
|
5136
|
+
fs17.removeRecursive(import_node_path13.default.join(frontdoorDir, "codex-homes", `${String(pid)}.json`));
|
|
4942
5137
|
}
|
|
4943
5138
|
function readFrontDoorState(fs17, stateFile) {
|
|
4944
5139
|
let raw;
|
|
@@ -4958,7 +5153,7 @@ function readFrontDoorState(fs17, stateFile) {
|
|
|
4958
5153
|
}
|
|
4959
5154
|
}
|
|
4960
5155
|
function writeFrontDoorState(fs17, stateFile, state) {
|
|
4961
|
-
fs17.mkdirp(
|
|
5156
|
+
fs17.mkdirp(import_node_path13.default.dirname(stateFile));
|
|
4962
5157
|
fs17.writeFilePrivate(stateFile, `${JSON.stringify(state, null, 2)}
|
|
4963
5158
|
`);
|
|
4964
5159
|
}
|
|
@@ -4971,18 +5166,18 @@ function frontDoorOrigin(state) {
|
|
|
4971
5166
|
}
|
|
4972
5167
|
function writeFrontDoorDirectRecord(fs17, recordsDir, record) {
|
|
4973
5168
|
fs17.mkdirp(recordsDir);
|
|
4974
|
-
fs17.writeFilePrivate(
|
|
5169
|
+
fs17.writeFilePrivate(import_node_path13.default.join(recordsDir, `${String(record.pid)}.json`), `${JSON.stringify({ directPort: record.directPort })}
|
|
4975
5170
|
`);
|
|
4976
5171
|
}
|
|
4977
5172
|
function removeFrontDoorDirectRecord(fs17, recordsDir, pid) {
|
|
4978
|
-
fs17.removeRecursive(
|
|
5173
|
+
fs17.removeRecursive(import_node_path13.default.join(recordsDir, `${String(pid)}.json`));
|
|
4979
5174
|
}
|
|
4980
5175
|
function markFrontDoorDraining(fs17, markersDir, pid) {
|
|
4981
5176
|
fs17.mkdirp(markersDir);
|
|
4982
|
-
fs17.writeFilePrivate(
|
|
5177
|
+
fs17.writeFilePrivate(import_node_path13.default.join(markersDir, String(pid)), "\n");
|
|
4983
5178
|
}
|
|
4984
5179
|
function unmarkFrontDoorDraining(fs17, markersDir, pid) {
|
|
4985
|
-
fs17.removeRecursive(
|
|
5180
|
+
fs17.removeRecursive(import_node_path13.default.join(markersDir, String(pid)));
|
|
4986
5181
|
}
|
|
4987
5182
|
function listDrainingFrontDoors(fs17, markersDir, isRunning) {
|
|
4988
5183
|
return fs17.readdir(markersDir).flatMap((file) => /^[1-9]\d*$/.test(file) && Number.isSafeInteger(Number(file)) ? [Number(file)] : []).filter(isRunning).sort((a, b) => a - b);
|
|
@@ -4999,7 +5194,7 @@ function readDirectRecordEntry(fs17, recordsDir, file) {
|
|
|
4999
5194
|
}
|
|
5000
5195
|
let raw;
|
|
5001
5196
|
try {
|
|
5002
|
-
raw = fs17.readFileUtf8(
|
|
5197
|
+
raw = fs17.readFileUtf8(import_node_path13.default.join(recordsDir, file));
|
|
5003
5198
|
} catch {
|
|
5004
5199
|
return void 0;
|
|
5005
5200
|
}
|
|
@@ -5024,7 +5219,7 @@ function pruneMalformedFrontDoorDirectFiles(fs17, recordsDir, isRunning) {
|
|
|
5024
5219
|
const writer = RECORD_TEMPORARY_FILE.exec(file)?.[1];
|
|
5025
5220
|
const stale = writer !== void 0 && !isRunning(Number(writer));
|
|
5026
5221
|
if (stale || readDirectRecordEntry(fs17, recordsDir, file)?.malformed === true) {
|
|
5027
|
-
fs17.removeRecursive(
|
|
5222
|
+
fs17.removeRecursive(import_node_path13.default.join(recordsDir, file));
|
|
5028
5223
|
}
|
|
5029
5224
|
}
|
|
5030
5225
|
}
|
|
@@ -5043,7 +5238,7 @@ function recordOf(details) {
|
|
|
5043
5238
|
}
|
|
5044
5239
|
function writeFrontDoorSession(fs17, sessionsDir, session) {
|
|
5045
5240
|
fs17.mkdirPrivate(sessionsDir);
|
|
5046
|
-
fs17.writeFilePrivate(
|
|
5241
|
+
fs17.writeFilePrivate(import_node_path13.default.join(sessionsDir, sessionRecordName(session.pid)), `${JSON.stringify(session, null, 2)}
|
|
5047
5242
|
`);
|
|
5048
5243
|
}
|
|
5049
5244
|
function sessionRecordName(pid) {
|
|
@@ -5057,7 +5252,7 @@ function summaryOf(session) {
|
|
|
5057
5252
|
}
|
|
5058
5253
|
function readFrontDoorSessionRecord(fs17, sessionsDir, name) {
|
|
5059
5254
|
try {
|
|
5060
|
-
const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(fs17.readFileUtf8(
|
|
5255
|
+
const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(fs17.readFileUtf8(import_node_path13.default.join(sessionsDir, name)) ?? ""));
|
|
5061
5256
|
return parsed.success ? parsed.data : void 0;
|
|
5062
5257
|
} catch {
|
|
5063
5258
|
return void 0;
|
|
@@ -5074,7 +5269,7 @@ function listFrontDoorSessions(fs17, sessionsDir) {
|
|
|
5074
5269
|
return sessions.sort((a, b) => a.pid - b.pid);
|
|
5075
5270
|
}
|
|
5076
5271
|
function removeFrontDoorSession(fs17, sessionsDir, pid) {
|
|
5077
|
-
fs17.removeRecursive(
|
|
5272
|
+
fs17.removeRecursive(import_node_path13.default.join(sessionsDir, sessionRecordName(pid)));
|
|
5078
5273
|
}
|
|
5079
5274
|
function pruneDeadFrontDoorSessions(fs17, sessionsDir, listed, isRunning) {
|
|
5080
5275
|
const removed = [];
|
|
@@ -5086,112 +5281,53 @@ function pruneDeadFrontDoorSessions(fs17, sessionsDir, listed, isRunning) {
|
|
|
5086
5281
|
}
|
|
5087
5282
|
return removed;
|
|
5088
5283
|
}
|
|
5089
|
-
var
|
|
5284
|
+
var import_node_path13, import_zod9, FRONT_DOOR_PROTOCOL, FRONT_DOOR_HANDOVER_PROTOCOL, FrontDoorSessionSchema, FrontDoorStateSchema, FrontDoorDirectRecordSchema, RECORD_TEMPORARY_FILE;
|
|
5090
5285
|
var init_state = __esm({
|
|
5091
5286
|
"src/frontdoor/state.ts"() {
|
|
5092
5287
|
"use strict";
|
|
5093
|
-
|
|
5094
|
-
|
|
5288
|
+
import_node_path13 = __toESM(require("node:path"), 1);
|
|
5289
|
+
import_zod9 = require("zod");
|
|
5095
5290
|
init_schema();
|
|
5291
|
+
init_baseUrlDial();
|
|
5096
5292
|
init_providerCatalogue();
|
|
5097
5293
|
FRONT_DOOR_PROTOCOL = 8;
|
|
5098
5294
|
FRONT_DOOR_HANDOVER_PROTOCOL = 6;
|
|
5099
|
-
FrontDoorSessionSchema =
|
|
5100
|
-
FrontDoorStateSchema =
|
|
5295
|
+
FrontDoorSessionSchema = import_zod9.z.strictObject({ pid: import_zod9.z.number().int().positive(), startedAt: import_zod9.z.number(), token: import_zod9.z.string().min(1), supervisorPid: import_zod9.z.number().int().positive().optional(), sessionId: import_zod9.z.string().min(1).optional(), identity: import_zod9.z.string().min(1).optional(), models: ModelsConfigSchema.optional() });
|
|
5296
|
+
FrontDoorStateSchema = import_zod9.z.strictObject({
|
|
5101
5297
|
/**
|
|
5102
5298
|
* The launcher-to-door wire protocol this supervisor speaks, written once it is serving; absent in state written by a release that predates the field, which `ensureFrontDoor` reads as protocol 0. A launcher replaces a door whose protocol is lower than its own (see `FRONT_DOOR_PROTOCOL`).
|
|
5103
5299
|
*/
|
|
5104
|
-
protocol:
|
|
5300
|
+
protocol: import_zod9.z.number().int().nonnegative().optional(),
|
|
5105
5301
|
/** The supervisor process serving the front door. Alive means both listeners are up in that process. */
|
|
5106
|
-
supervisorPid:
|
|
5302
|
+
supervisorPid: import_zod9.z.number().int().positive().optional(),
|
|
5107
5303
|
/** The loopback port the HTTPS provider listener serves on. Absent until the listener has bound and answered its health probe, so "port is set" is itself the ready signal a launcher polls for. */
|
|
5108
|
-
port:
|
|
5304
|
+
port: import_zod9.z.number().int().positive().optional(),
|
|
5109
5305
|
/**
|
|
5110
5306
|
* The sticky port preference for the provider listener: kept across crashes, restarts and idle shutdowns so every provider session, whose base URL was frozen at launch, keeps finding the front door at the same address.
|
|
5111
5307
|
*/
|
|
5112
|
-
lastPort:
|
|
5308
|
+
lastPort: import_zod9.z.number().int().positive().optional(),
|
|
5113
5309
|
/**
|
|
5114
5310
|
* The loopback port the CONNECT surface listens on. Absent whenever no supervisor is serving it, so "connectPort is set" is the ready signal an OAuth launch polls for alongside `port`.
|
|
5115
5311
|
*/
|
|
5116
|
-
connectPort:
|
|
5312
|
+
connectPort: import_zod9.z.number().int().positive().optional(),
|
|
5117
5313
|
/**
|
|
5118
5314
|
* The sticky port preference for the CONNECT surface, the exact analogue of `lastPort` for the second listener: it survives every shutdown, because every OAuth session's environment was frozen at launch with HTTPS_PROXY pointing at this address and a restart that moves strands them.
|
|
5119
5315
|
*/
|
|
5120
|
-
lastConnectPort:
|
|
5316
|
+
lastConnectPort: import_zod9.z.number().int().positive().optional(),
|
|
5121
5317
|
/**
|
|
5122
5318
|
* The loopback port the direct listener serves on: the listener a headroom hop tells the daemon to forward routed traffic back to. Sticky like the others, because headroom's allowlist admits its exact origin: the headroom supervisor rewrites the daemon's allowlist file when the origin moves, but a provider launch waits at its gate until it has, so an ephemeral port would hold launches up after every restart.
|
|
5123
5319
|
*/
|
|
5124
|
-
directPort:
|
|
5320
|
+
directPort: import_zod9.z.number().int().positive().optional(),
|
|
5125
5321
|
/** The sticky port preference for the direct listener, for the reason `directPort` gives. */
|
|
5126
|
-
lastDirectPort:
|
|
5322
|
+
lastDirectPort: import_zod9.z.number().int().positive().optional(),
|
|
5127
5323
|
/** The last fatal error, kept across shutdowns so `frontdoor status` can explain a front door that is not running. */
|
|
5128
|
-
lastError:
|
|
5324
|
+
lastError: import_zod9.z.string().optional()
|
|
5129
5325
|
});
|
|
5130
|
-
|
|
5131
|
-
FrontDoorDirectRecordSchema = import_zod8.z.strictObject({ directPort: import_zod8.z.number().int().positive().max(MAX_TCP_PORT) });
|
|
5326
|
+
FrontDoorDirectRecordSchema = import_zod9.z.strictObject({ directPort: import_zod9.z.number().int().positive().max(MAX_TCP_PORT) });
|
|
5132
5327
|
RECORD_TEMPORARY_FILE = /^[1-9]\d*\.json\.([1-9]\d*)\.tmp$/;
|
|
5133
5328
|
}
|
|
5134
5329
|
});
|
|
5135
5330
|
|
|
5136
|
-
// src/processRole.ts
|
|
5137
|
-
function enterProcessRole(role) {
|
|
5138
|
-
const previous = currentRole;
|
|
5139
|
-
currentRole = role;
|
|
5140
|
-
return () => {
|
|
5141
|
-
currentRole = previous;
|
|
5142
|
-
};
|
|
5143
|
-
}
|
|
5144
|
-
function noteBlockingStep() {
|
|
5145
|
-
blockingStepObserver?.();
|
|
5146
|
-
}
|
|
5147
|
-
function refuseToBlockInRole(operation) {
|
|
5148
|
-
noteBlockingStep();
|
|
5149
|
-
if (currentRole !== void 0) {
|
|
5150
|
-
throw new BlockingInEventLoopError(operation, currentRole);
|
|
5151
|
-
}
|
|
5152
|
-
}
|
|
5153
|
-
var currentRole, BlockingInEventLoopError, blockingStepObserver;
|
|
5154
|
-
var init_processRole = __esm({
|
|
5155
|
-
"src/processRole.ts"() {
|
|
5156
|
-
"use strict";
|
|
5157
|
-
init_cliError();
|
|
5158
|
-
BlockingInEventLoopError = class extends CliError {
|
|
5159
|
-
constructor(operation, role) {
|
|
5160
|
-
super(
|
|
5161
|
-
`${operation} blocks the calling thread, which in the ${role} is the event loop that answers every session; it must not run there (a launch planned inside the door reaches it through its own addresses, never through the launcher's synchronous coordination)`
|
|
5162
|
-
);
|
|
5163
|
-
this.name = "BlockingInEventLoopError";
|
|
5164
|
-
}
|
|
5165
|
-
};
|
|
5166
|
-
}
|
|
5167
|
-
});
|
|
5168
|
-
|
|
5169
|
-
// src/frontdoor/catalogueCleanup.ts
|
|
5170
|
-
async function pruneAbandonedCatalogueGenerations(fs17, paths, ownPid, generation, runningAmong) {
|
|
5171
|
-
const root = import_node_path13.default.join(paths.catalogueDir, "supervisors");
|
|
5172
|
-
const owners = fs17.readdir(root).flatMap((entry) => {
|
|
5173
|
-
const pid = Number(entry);
|
|
5174
|
-
return Number.isSafeInteger(pid) && pid > 0 && String(pid) === entry && fs17.lstat(import_node_path13.default.join(root, entry))?.kind === "dir" ? [pid] : [];
|
|
5175
|
-
});
|
|
5176
|
-
const running = await runningAmong(owners);
|
|
5177
|
-
for (const pid of owners) {
|
|
5178
|
-
if (pid !== ownPid && running.has(pid)) continue;
|
|
5179
|
-
const directory = import_node_path13.default.join(root, String(pid));
|
|
5180
|
-
for (const entry of fs17.readdir(directory)) {
|
|
5181
|
-
const candidate = import_node_path13.default.join(directory, entry);
|
|
5182
|
-
if (import_zod9.z.uuid().safeParse(entry).success && (pid !== ownPid || entry !== generation) && fs17.lstat(candidate)?.kind === "dir") fs17.removeRecursive(candidate);
|
|
5183
|
-
}
|
|
5184
|
-
}
|
|
5185
|
-
}
|
|
5186
|
-
var import_node_path13, import_zod9;
|
|
5187
|
-
var init_catalogueCleanup = __esm({
|
|
5188
|
-
"src/frontdoor/catalogueCleanup.ts"() {
|
|
5189
|
-
"use strict";
|
|
5190
|
-
import_node_path13 = __toESM(require("node:path"), 1);
|
|
5191
|
-
import_zod9 = require("zod");
|
|
5192
|
-
}
|
|
5193
|
-
});
|
|
5194
|
-
|
|
5195
5331
|
// src/frontdoor/supervisor.ts
|
|
5196
5332
|
function watchedInstallEntry(resolvedOwnExecutablePath, siblingExists) {
|
|
5197
5333
|
const parsed = import_node_path14.default.parse(resolvedOwnExecutablePath);
|
|
@@ -5440,17 +5576,8 @@ var init_supervisor = __esm({
|
|
|
5440
5576
|
|
|
5441
5577
|
// src/frontdoor/connect.ts
|
|
5442
5578
|
function parseConnectTarget(authority) {
|
|
5443
|
-
const
|
|
5444
|
-
|
|
5445
|
-
const host2 = authority.trim().toLowerCase();
|
|
5446
|
-
return host2 === "" ? void 0 : { host: host2, port: HTTPS_PORT };
|
|
5447
|
-
}
|
|
5448
|
-
const host = authority.slice(0, colon).trim().toLowerCase();
|
|
5449
|
-
const port = Number.parseInt(authority.slice(colon + 1), 10);
|
|
5450
|
-
if (host === "" || !Number.isInteger(port) || port <= 0 || port > MAX_TCP_PORT) {
|
|
5451
|
-
return void 0;
|
|
5452
|
-
}
|
|
5453
|
-
return { host, port };
|
|
5579
|
+
const parsed = parseDialAuthority(authority, HTTPS_PORT);
|
|
5580
|
+
return "refusal" in parsed ? void 0 : parsed;
|
|
5454
5581
|
}
|
|
5455
5582
|
function isInterceptedHost(host, interceptHosts) {
|
|
5456
5583
|
return interceptHosts.includes(host);
|
|
@@ -5769,9 +5896,9 @@ function routeConnect(socket, head, context) {
|
|
|
5769
5896
|
const requestLine = head.split("\r\n", 1)[0] ?? "";
|
|
5770
5897
|
const parts = requestLine.split(" ");
|
|
5771
5898
|
const authority = parts.length === CONNECT_LINE_TOKENS && parts[0]?.toUpperCase() === "CONNECT" ? parts[1] ?? "" : void 0;
|
|
5772
|
-
const target = authority === void 0 ? void 0 :
|
|
5773
|
-
if (target === void 0) {
|
|
5774
|
-
refuse(socket, REFUSAL.badRequest);
|
|
5899
|
+
const target = authority === void 0 ? void 0 : parseDialAuthority(authority, HTTPS_PORT);
|
|
5900
|
+
if (target === void 0 || "refusal" in target) {
|
|
5901
|
+
refuse(socket, REFUSAL.badRequest, target === void 0 ? [] : [`${REFUSAL_HEADER}: ${target.refusal}`]);
|
|
5775
5902
|
return;
|
|
5776
5903
|
}
|
|
5777
5904
|
const session = sessions.find((entry) => entry.host === target.host);
|
|
@@ -5842,17 +5969,17 @@ function realConnectCertStore(paths) {
|
|
|
5842
5969
|
}
|
|
5843
5970
|
};
|
|
5844
5971
|
}
|
|
5845
|
-
var import_node_crypto5, fs3, CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, ROUTED_PATH_PREFIX, HTTPS_PORT, HTTP_BAD_GATEWAY, CA_KEY_FILE_MODE, CONNECT_LINE_TOKENS, HEAD_TERMINATOR, MAX_CONNECT_HEAD_BYTES, CONNECT_ESTABLISHED, REFUSAL, CONNECT_LIMITS, CA_VALIDITY_DAYS, LEAF_VALIDITY_DAYS, CA_SUBJECT_COMMON_NAME, MS_PER_DAY, HOP_BY_HOP_HEADERS, TAP_ALPN_PROTOCOLS;
|
|
5972
|
+
var import_node_crypto5, fs3, CONNECT_INTERCEPT_HOST, CONNECT_INTERCEPT_HOSTS, ROUTED_PATH_PREFIX, HTTPS_PORT, HTTP_BAD_GATEWAY, CA_KEY_FILE_MODE, CONNECT_LINE_TOKENS, HEAD_TERMINATOR, MAX_CONNECT_HEAD_BYTES, CONNECT_ESTABLISHED, REFUSAL_HEADER, REFUSAL, CONNECT_LIMITS, CA_VALIDITY_DAYS, LEAF_VALIDITY_DAYS, CA_SUBJECT_COMMON_NAME, MS_PER_DAY, HOP_BY_HOP_HEADERS, TAP_ALPN_PROTOCOLS;
|
|
5846
5973
|
var init_connect = __esm({
|
|
5847
5974
|
"src/frontdoor/connect.ts"() {
|
|
5848
5975
|
"use strict";
|
|
5849
5976
|
import_node_crypto5 = require("node:crypto");
|
|
5850
5977
|
fs3 = __toESM(require("node:fs"), 1);
|
|
5978
|
+
init_baseUrlDial();
|
|
5851
5979
|
init_x509();
|
|
5852
5980
|
init_tap();
|
|
5853
5981
|
init_capability();
|
|
5854
5982
|
init_route();
|
|
5855
|
-
init_state();
|
|
5856
5983
|
init_supervisor();
|
|
5857
5984
|
CONNECT_INTERCEPT_HOST = "api.anthropic.com";
|
|
5858
5985
|
CONNECT_INTERCEPT_HOSTS = [CONNECT_INTERCEPT_HOST, "platform.claude.com"];
|
|
@@ -5864,6 +5991,7 @@ var init_connect = __esm({
|
|
|
5864
5991
|
HEAD_TERMINATOR = "\r\n\r\n";
|
|
5865
5992
|
MAX_CONNECT_HEAD_BYTES = 8192;
|
|
5866
5993
|
CONNECT_ESTABLISHED = "HTTP/1.1 200 Connection Established\r\n\r\n";
|
|
5994
|
+
REFUSAL_HEADER = "x-agent-shim-refusal";
|
|
5867
5995
|
REFUSAL = {
|
|
5868
5996
|
badRequest: "400 Bad Request",
|
|
5869
5997
|
proxyAuthenticationRequired: "407 Proxy Authentication Required",
|
|
@@ -13686,7 +13814,7 @@ var init_package = __esm({
|
|
|
13686
13814
|
"package.json"() {
|
|
13687
13815
|
package_default = {
|
|
13688
13816
|
name: "claude-use",
|
|
13689
|
-
version: "14.0.
|
|
13817
|
+
version: "14.0.2",
|
|
13690
13818
|
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.",
|
|
13691
13819
|
license: "MIT",
|
|
13692
13820
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -13735,7 +13863,7 @@ var init_package = __esm({
|
|
|
13735
13863
|
schema: "node scripts/gen-schema.mts"
|
|
13736
13864
|
},
|
|
13737
13865
|
dependencies: {
|
|
13738
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
13866
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.316",
|
|
13739
13867
|
"@clack/prompts": "^1.8.0",
|
|
13740
13868
|
"@modelcontextprotocol/sdk": "1.32.0",
|
|
13741
13869
|
"@orpc/client": "2.0.0-beta.46",
|
|
@@ -14950,26 +15078,6 @@ var init_paths = __esm({
|
|
|
14950
15078
|
}
|
|
14951
15079
|
});
|
|
14952
15080
|
|
|
14953
|
-
// src/baseUrlDial.ts
|
|
14954
|
-
function dialHostOf(url) {
|
|
14955
|
-
return url.hostname.replace(/^\[(.*)\]$/, "$1");
|
|
14956
|
-
}
|
|
14957
|
-
function dialTargetOf(baseUrl) {
|
|
14958
|
-
const url = new URL(baseUrl);
|
|
14959
|
-
const defaultPort = DEFAULT_PORTS[url.protocol];
|
|
14960
|
-
if (defaultPort === void 0) {
|
|
14961
|
-
throw new Error(`${url.protocol} is not a scheme a provider's base URL can have`);
|
|
14962
|
-
}
|
|
14963
|
-
return { host: dialHostOf(url), port: url.port === "" ? defaultPort : Number(url.port) };
|
|
14964
|
-
}
|
|
14965
|
-
var DEFAULT_PORTS;
|
|
14966
|
-
var init_baseUrlDial = __esm({
|
|
14967
|
-
"src/baseUrlDial.ts"() {
|
|
14968
|
-
"use strict";
|
|
14969
|
-
DEFAULT_PORTS = { "http:": 80, "https:": 443 };
|
|
14970
|
-
}
|
|
14971
|
-
});
|
|
14972
|
-
|
|
14973
15081
|
// src/frontdoor/probe.ts
|
|
14974
15082
|
function probeWorkerSource(body) {
|
|
14975
15083
|
return `const { workerData } = require("node:worker_threads");
|
|
@@ -19256,13 +19364,13 @@ function withRegisteredSessionFacts(statuses, registry) {
|
|
|
19256
19364
|
};
|
|
19257
19365
|
});
|
|
19258
19366
|
}
|
|
19259
|
-
function withIdentityNames(statuses,
|
|
19367
|
+
function withIdentityNames(statuses, nameOf2) {
|
|
19260
19368
|
return statuses.map((status) => {
|
|
19261
19369
|
if (status.identity === void 0) {
|
|
19262
19370
|
return status;
|
|
19263
19371
|
}
|
|
19264
19372
|
const { identity: id, ...rest } = status;
|
|
19265
|
-
const name =
|
|
19373
|
+
const name = nameOf2(id);
|
|
19266
19374
|
return name === void 0 ? rest : { ...rest, identity: name };
|
|
19267
19375
|
});
|
|
19268
19376
|
}
|