claude-use 9.7.2 → 9.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +418 -367
- package/dist/index.cjs +111 -74
- package/dist/index.mjs +107 -70
- package/dist/types/index.d.ts +7 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -318,10 +318,10 @@ function mergeDefs(...defs) {
|
|
|
318
318
|
function cloneDef(schema) {
|
|
319
319
|
return mergeDefs(schema._zod.def);
|
|
320
320
|
}
|
|
321
|
-
function getElementAtPath(obj,
|
|
322
|
-
if (!
|
|
321
|
+
function getElementAtPath(obj, path50) {
|
|
322
|
+
if (!path50)
|
|
323
323
|
return obj;
|
|
324
|
-
return
|
|
324
|
+
return path50.reduce((acc, key) => acc?.[key], obj);
|
|
325
325
|
}
|
|
326
326
|
function promiseAllObject(promisesObj) {
|
|
327
327
|
const keys = Object.keys(promisesObj);
|
|
@@ -580,11 +580,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
580
580
|
}
|
|
581
581
|
return false;
|
|
582
582
|
}
|
|
583
|
-
function prefixIssues(
|
|
583
|
+
function prefixIssues(path50, issues) {
|
|
584
584
|
return issues.map((iss) => {
|
|
585
585
|
var _a4;
|
|
586
586
|
(_a4 = iss).path ?? (_a4.path = []);
|
|
587
|
-
iss.path.unshift(
|
|
587
|
+
iss.path.unshift(path50);
|
|
588
588
|
return iss;
|
|
589
589
|
});
|
|
590
590
|
}
|
|
@@ -1105,16 +1105,16 @@ function flattenError(error63, mapper = (issue2) => issue2.message) {
|
|
|
1105
1105
|
}
|
|
1106
1106
|
function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
1107
1107
|
const fieldErrors = { _errors: [] };
|
|
1108
|
-
const processError = (error64,
|
|
1108
|
+
const processError = (error64, path50 = []) => {
|
|
1109
1109
|
for (const issue2 of error64.issues) {
|
|
1110
1110
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1111
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1111
|
+
issue2.errors.map((issues) => processError({ issues }, [...path50, ...issue2.path]));
|
|
1112
1112
|
} else if (issue2.code === "invalid_key") {
|
|
1113
|
-
processError({ issues: issue2.issues }, [...
|
|
1113
|
+
processError({ issues: issue2.issues }, [...path50, ...issue2.path]);
|
|
1114
1114
|
} else if (issue2.code === "invalid_element") {
|
|
1115
|
-
processError({ issues: issue2.issues }, [...
|
|
1115
|
+
processError({ issues: issue2.issues }, [...path50, ...issue2.path]);
|
|
1116
1116
|
} else {
|
|
1117
|
-
const fullpath = [...
|
|
1117
|
+
const fullpath = [...path50, ...issue2.path];
|
|
1118
1118
|
if (fullpath.length === 0) {
|
|
1119
1119
|
fieldErrors._errors.push(mapper(issue2));
|
|
1120
1120
|
} else {
|
|
@@ -1153,17 +1153,17 @@ function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
1155
1155
|
const result = { errors: [] };
|
|
1156
|
-
const processError = (error64,
|
|
1156
|
+
const processError = (error64, path50 = []) => {
|
|
1157
1157
|
var _a4;
|
|
1158
1158
|
for (const issue2 of error64.issues) {
|
|
1159
1159
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1160
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1160
|
+
issue2.errors.map((issues) => processError({ issues }, [...path50, ...issue2.path]));
|
|
1161
1161
|
} else if (issue2.code === "invalid_key") {
|
|
1162
|
-
processError({ issues: issue2.issues }, [...
|
|
1162
|
+
processError({ issues: issue2.issues }, [...path50, ...issue2.path]);
|
|
1163
1163
|
} else if (issue2.code === "invalid_element") {
|
|
1164
|
-
processError({ issues: issue2.issues }, [...
|
|
1164
|
+
processError({ issues: issue2.issues }, [...path50, ...issue2.path]);
|
|
1165
1165
|
} else {
|
|
1166
|
-
const fullpath = [...
|
|
1166
|
+
const fullpath = [...path50, ...issue2.path];
|
|
1167
1167
|
if (fullpath.length === 0) {
|
|
1168
1168
|
result.errors.push(mapper(issue2));
|
|
1169
1169
|
continue;
|
|
@@ -1202,8 +1202,8 @@ function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
|
1202
1202
|
}
|
|
1203
1203
|
function toDotPath(_path) {
|
|
1204
1204
|
const segs = [];
|
|
1205
|
-
const
|
|
1206
|
-
for (const seg of
|
|
1205
|
+
const path50 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1206
|
+
for (const seg of path50) {
|
|
1207
1207
|
if (typeof seg === "number")
|
|
1208
1208
|
segs.push(`[${seg}]`);
|
|
1209
1209
|
else if (typeof seg === "symbol")
|
|
@@ -19199,13 +19199,13 @@ function resolveRef(ref, ctx) {
|
|
|
19199
19199
|
if (!ref.startsWith("#")) {
|
|
19200
19200
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
19201
19201
|
}
|
|
19202
|
-
const
|
|
19203
|
-
if (
|
|
19202
|
+
const path50 = ref.slice(1).split("/").filter(Boolean);
|
|
19203
|
+
if (path50.length === 0) {
|
|
19204
19204
|
return ctx.rootSchema;
|
|
19205
19205
|
}
|
|
19206
19206
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
19207
|
-
if (
|
|
19208
|
-
const key =
|
|
19207
|
+
if (path50[0] === defsKey) {
|
|
19208
|
+
const key = path50[1] === void 0 ? void 0 : decodeJSONPointerSegment(path50[1]);
|
|
19209
19209
|
if (!key || !ctx.defs[key]) {
|
|
19210
19210
|
throw new Error(`Reference not found: ${ref}`);
|
|
19211
19211
|
}
|
|
@@ -23712,42 +23712,42 @@ var require_defaults = __commonJS({
|
|
|
23712
23712
|
var require_env_paths = __commonJS({
|
|
23713
23713
|
"node_modules/.pnpm/env-paths@2.2.1/node_modules/env-paths/index.js"(exports2, module2) {
|
|
23714
23714
|
"use strict";
|
|
23715
|
-
var
|
|
23715
|
+
var path50 = require("path");
|
|
23716
23716
|
var os12 = require("os");
|
|
23717
23717
|
var homedir = os12.homedir();
|
|
23718
23718
|
var tmpdir = os12.tmpdir();
|
|
23719
23719
|
var { env } = process;
|
|
23720
23720
|
var macos = (name) => {
|
|
23721
|
-
const library =
|
|
23721
|
+
const library = path50.join(homedir, "Library");
|
|
23722
23722
|
return {
|
|
23723
|
-
data:
|
|
23724
|
-
config:
|
|
23725
|
-
cache:
|
|
23726
|
-
log:
|
|
23727
|
-
temp:
|
|
23723
|
+
data: path50.join(library, "Application Support", name),
|
|
23724
|
+
config: path50.join(library, "Preferences", name),
|
|
23725
|
+
cache: path50.join(library, "Caches", name),
|
|
23726
|
+
log: path50.join(library, "Logs", name),
|
|
23727
|
+
temp: path50.join(tmpdir, name)
|
|
23728
23728
|
};
|
|
23729
23729
|
};
|
|
23730
23730
|
var windows = (name) => {
|
|
23731
|
-
const appData = env.APPDATA ||
|
|
23732
|
-
const localAppData = env.LOCALAPPDATA ||
|
|
23731
|
+
const appData = env.APPDATA || path50.join(homedir, "AppData", "Roaming");
|
|
23732
|
+
const localAppData = env.LOCALAPPDATA || path50.join(homedir, "AppData", "Local");
|
|
23733
23733
|
return {
|
|
23734
23734
|
// Data/config/cache/log are invented by me as Windows isn't opinionated about this
|
|
23735
|
-
data:
|
|
23736
|
-
config:
|
|
23737
|
-
cache:
|
|
23738
|
-
log:
|
|
23739
|
-
temp:
|
|
23735
|
+
data: path50.join(localAppData, name, "Data"),
|
|
23736
|
+
config: path50.join(appData, name, "Config"),
|
|
23737
|
+
cache: path50.join(localAppData, name, "Cache"),
|
|
23738
|
+
log: path50.join(localAppData, name, "Log"),
|
|
23739
|
+
temp: path50.join(tmpdir, name)
|
|
23740
23740
|
};
|
|
23741
23741
|
};
|
|
23742
23742
|
var linux = (name) => {
|
|
23743
|
-
const username =
|
|
23743
|
+
const username = path50.basename(homedir);
|
|
23744
23744
|
return {
|
|
23745
|
-
data:
|
|
23746
|
-
config:
|
|
23747
|
-
cache:
|
|
23745
|
+
data: path50.join(env.XDG_DATA_HOME || path50.join(homedir, ".local", "share"), name),
|
|
23746
|
+
config: path50.join(env.XDG_CONFIG_HOME || path50.join(homedir, ".config"), name),
|
|
23747
|
+
cache: path50.join(env.XDG_CACHE_HOME || path50.join(homedir, ".cache"), name),
|
|
23748
23748
|
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
23749
|
-
log:
|
|
23750
|
-
temp:
|
|
23749
|
+
log: path50.join(env.XDG_STATE_HOME || path50.join(homedir, ".local", "state"), name),
|
|
23750
|
+
temp: path50.join(tmpdir, username, name)
|
|
23751
23751
|
};
|
|
23752
23752
|
};
|
|
23753
23753
|
var envPaths = (name, options) => {
|
|
@@ -23815,11 +23815,11 @@ var require_util = __commonJS({
|
|
|
23815
23815
|
return result;
|
|
23816
23816
|
}
|
|
23817
23817
|
exports2.emplace = emplace;
|
|
23818
|
-
function getPropertyByPath(source,
|
|
23819
|
-
if (typeof
|
|
23820
|
-
return source[
|
|
23818
|
+
function getPropertyByPath(source, path50) {
|
|
23819
|
+
if (typeof path50 === "string" && Object.prototype.hasOwnProperty.call(source, path50)) {
|
|
23820
|
+
return source[path50];
|
|
23821
23821
|
}
|
|
23822
|
-
const parsedPath = typeof
|
|
23822
|
+
const parsedPath = typeof path50 === "string" ? path50.split(".") : path50;
|
|
23823
23823
|
return parsedPath.reduce((previous, key) => {
|
|
23824
23824
|
if (previous === void 0) {
|
|
23825
23825
|
return previous;
|
|
@@ -23842,9 +23842,9 @@ var require_util = __commonJS({
|
|
|
23842
23842
|
return Object.fromEntries(Object.entries(options).filter(([, value2]) => value2 !== void 0));
|
|
23843
23843
|
}
|
|
23844
23844
|
exports2.removeUndefinedValuesFromObject = removeUndefinedValuesFromObject;
|
|
23845
|
-
async function isDirectory(
|
|
23845
|
+
async function isDirectory(path50) {
|
|
23846
23846
|
try {
|
|
23847
|
-
const stat = await fs_1.promises.stat(
|
|
23847
|
+
const stat = await fs_1.promises.stat(path50);
|
|
23848
23848
|
return stat.isDirectory();
|
|
23849
23849
|
} catch (e14) {
|
|
23850
23850
|
if (e14.code === "ENOENT") {
|
|
@@ -23854,9 +23854,9 @@ var require_util = __commonJS({
|
|
|
23854
23854
|
}
|
|
23855
23855
|
}
|
|
23856
23856
|
exports2.isDirectory = isDirectory;
|
|
23857
|
-
function isDirectorySync(
|
|
23857
|
+
function isDirectorySync(path50) {
|
|
23858
23858
|
try {
|
|
23859
|
-
const stat = fs_1.default.statSync(
|
|
23859
|
+
const stat = fs_1.default.statSync(path50);
|
|
23860
23860
|
return stat.isDirectory();
|
|
23861
23861
|
} catch (e14) {
|
|
23862
23862
|
if (e14.code === "ENOENT") {
|
|
@@ -23954,7 +23954,7 @@ var require_ExplorerBase = __commonJS({
|
|
|
23954
23954
|
const idx = importStack.indexOf(fullPath);
|
|
23955
23955
|
if (idx !== -1) {
|
|
23956
23956
|
throw new Error(`Circular import detected:
|
|
23957
|
-
${[...importStack, fullPath].map((
|
|
23957
|
+
${[...importStack, fullPath].map((path50, i10) => `${i10 + 1}. ${path50}`).join("\n")} (same as ${idx + 1}.)`);
|
|
23958
23958
|
}
|
|
23959
23959
|
}
|
|
23960
23960
|
}
|
|
@@ -24142,9 +24142,9 @@ var require_Explorer = __commonJS({
|
|
|
24142
24142
|
throw error63;
|
|
24143
24143
|
}
|
|
24144
24144
|
}
|
|
24145
|
-
async #fileExists(
|
|
24145
|
+
async #fileExists(path50) {
|
|
24146
24146
|
try {
|
|
24147
|
-
await promises_1.default.stat(
|
|
24147
|
+
await promises_1.default.stat(path50);
|
|
24148
24148
|
return true;
|
|
24149
24149
|
} catch (e14) {
|
|
24150
24150
|
return false;
|
|
@@ -24304,9 +24304,9 @@ var require_ExplorerSync = __commonJS({
|
|
|
24304
24304
|
throw error63;
|
|
24305
24305
|
}
|
|
24306
24306
|
}
|
|
24307
|
-
#fileExists(
|
|
24307
|
+
#fileExists(path50) {
|
|
24308
24308
|
try {
|
|
24309
|
-
fs_1.default.statSync(
|
|
24309
|
+
fs_1.default.statSync(path50);
|
|
24310
24310
|
return true;
|
|
24311
24311
|
} catch (e14) {
|
|
24312
24312
|
return false;
|
|
@@ -24430,7 +24430,7 @@ var require_dist = __commonJS({
|
|
|
24430
24430
|
};
|
|
24431
24431
|
}
|
|
24432
24432
|
function getResolvedSearchPlaces(moduleName, toolDefinedSearchPlaces, userConfiguredOptions) {
|
|
24433
|
-
const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((
|
|
24433
|
+
const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path50) => path50.replace("{name}", moduleName));
|
|
24434
24434
|
if (userConfiguredOptions.mergeSearchPlaces) {
|
|
24435
24435
|
return [...userConfiguredSearchPlaces ?? [], ...toolDefinedSearchPlaces];
|
|
24436
24436
|
}
|
|
@@ -28870,8 +28870,8 @@ var require_utils = __commonJS({
|
|
|
28870
28870
|
}
|
|
28871
28871
|
return output2;
|
|
28872
28872
|
};
|
|
28873
|
-
exports2.basename = (
|
|
28874
|
-
const segs =
|
|
28873
|
+
exports2.basename = (path50, { windows } = {}) => {
|
|
28874
|
+
const segs = path50.split(windows ? /[\\/]/ : "/");
|
|
28875
28875
|
const last = segs[segs.length - 1];
|
|
28876
28876
|
if (last === "") {
|
|
28877
28877
|
return segs[segs.length - 2];
|
|
@@ -33242,7 +33242,7 @@ var init_package = __esm({
|
|
|
33242
33242
|
"package.json"() {
|
|
33243
33243
|
package_default = {
|
|
33244
33244
|
name: "claude-use",
|
|
33245
|
-
version: "9.
|
|
33245
|
+
version: "9.8.0",
|
|
33246
33246
|
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.",
|
|
33247
33247
|
license: "MIT",
|
|
33248
33248
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -33513,11 +33513,11 @@ function identifyRequest(headers) {
|
|
|
33513
33513
|
function directOrigin(port) {
|
|
33514
33514
|
return `http://127.0.0.1:${String(port)}`;
|
|
33515
33515
|
}
|
|
33516
|
-
function parseProviderPath(
|
|
33517
|
-
if (!
|
|
33516
|
+
function parseProviderPath(path50) {
|
|
33517
|
+
if (!path50.startsWith(PROVIDER_PATH_PREFIX)) {
|
|
33518
33518
|
return void 0;
|
|
33519
33519
|
}
|
|
33520
|
-
const tail =
|
|
33520
|
+
const tail = path50.slice(PROVIDER_PATH_PREFIX.length);
|
|
33521
33521
|
const slash = tail.indexOf("/");
|
|
33522
33522
|
if (slash <= 0) {
|
|
33523
33523
|
return void 0;
|
|
@@ -33843,9 +33843,9 @@ function decoderFor(encoding) {
|
|
|
33843
33843
|
return void 0;
|
|
33844
33844
|
}
|
|
33845
33845
|
}
|
|
33846
|
-
function destinationOf(
|
|
33847
|
-
const scoped = parseProviderPath(
|
|
33848
|
-
return scoped === void 0 ? { provider: ANTHROPIC_PROVIDER, endpoint:
|
|
33846
|
+
function destinationOf(path50) {
|
|
33847
|
+
const scoped = parseProviderPath(path50);
|
|
33848
|
+
return scoped === void 0 ? { provider: ANTHROPIC_PROVIDER, endpoint: path50 } : { provider: scoped.provider, endpoint: scoped.rest };
|
|
33849
33849
|
}
|
|
33850
33850
|
function buildRecord(event, context) {
|
|
33851
33851
|
const { scan } = context;
|
|
@@ -36255,14 +36255,14 @@ var require_util2 = __commonJS({
|
|
|
36255
36255
|
}
|
|
36256
36256
|
const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
|
|
36257
36257
|
let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
|
|
36258
|
-
let
|
|
36258
|
+
let path50 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
|
|
36259
36259
|
if (origin[origin.length - 1] === "/") {
|
|
36260
36260
|
origin = origin.slice(0, origin.length - 1);
|
|
36261
36261
|
}
|
|
36262
|
-
if (
|
|
36263
|
-
|
|
36262
|
+
if (path50 && path50[0] !== "/") {
|
|
36263
|
+
path50 = `/${path50}`;
|
|
36264
36264
|
}
|
|
36265
|
-
return new URL(`${origin}${
|
|
36265
|
+
return new URL(`${origin}${path50}`);
|
|
36266
36266
|
}
|
|
36267
36267
|
if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
|
|
36268
36268
|
throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -37083,9 +37083,9 @@ var require_diagnostics = __commonJS({
|
|
|
37083
37083
|
"undici:client:sendHeaders",
|
|
37084
37084
|
(evt) => {
|
|
37085
37085
|
const {
|
|
37086
|
-
request: { method, path:
|
|
37086
|
+
request: { method, path: path50, origin }
|
|
37087
37087
|
} = evt;
|
|
37088
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
37088
|
+
debugLog("sending request to %s %s%s", method, origin, path50);
|
|
37089
37089
|
}
|
|
37090
37090
|
);
|
|
37091
37091
|
}
|
|
@@ -37103,14 +37103,14 @@ var require_diagnostics = __commonJS({
|
|
|
37103
37103
|
"undici:request:headers",
|
|
37104
37104
|
(evt) => {
|
|
37105
37105
|
const {
|
|
37106
|
-
request: { method, path:
|
|
37106
|
+
request: { method, path: path50, origin },
|
|
37107
37107
|
response: { statusCode }
|
|
37108
37108
|
} = evt;
|
|
37109
37109
|
debugLog(
|
|
37110
37110
|
"received response to %s %s%s - HTTP %d",
|
|
37111
37111
|
method,
|
|
37112
37112
|
origin,
|
|
37113
|
-
|
|
37113
|
+
path50,
|
|
37114
37114
|
statusCode
|
|
37115
37115
|
);
|
|
37116
37116
|
}
|
|
@@ -37119,23 +37119,23 @@ var require_diagnostics = __commonJS({
|
|
|
37119
37119
|
"undici:request:trailers",
|
|
37120
37120
|
(evt) => {
|
|
37121
37121
|
const {
|
|
37122
|
-
request: { method, path:
|
|
37122
|
+
request: { method, path: path50, origin }
|
|
37123
37123
|
} = evt;
|
|
37124
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
37124
|
+
debugLog("trailers received from %s %s%s", method, origin, path50);
|
|
37125
37125
|
}
|
|
37126
37126
|
);
|
|
37127
37127
|
diagnosticsChannel.subscribe(
|
|
37128
37128
|
"undici:request:error",
|
|
37129
37129
|
(evt) => {
|
|
37130
37130
|
const {
|
|
37131
|
-
request: { method, path:
|
|
37131
|
+
request: { method, path: path50, origin },
|
|
37132
37132
|
error: error63
|
|
37133
37133
|
} = evt;
|
|
37134
37134
|
debugLog(
|
|
37135
37135
|
"request to %s %s%s errored - %s",
|
|
37136
37136
|
method,
|
|
37137
37137
|
origin,
|
|
37138
|
-
|
|
37138
|
+
path50,
|
|
37139
37139
|
error63.message
|
|
37140
37140
|
);
|
|
37141
37141
|
}
|
|
@@ -37250,7 +37250,7 @@ var require_request = __commonJS({
|
|
|
37250
37250
|
var kHandler = /* @__PURE__ */ Symbol("handler");
|
|
37251
37251
|
var Request2 = class {
|
|
37252
37252
|
constructor(origin, {
|
|
37253
|
-
path:
|
|
37253
|
+
path: path50,
|
|
37254
37254
|
method,
|
|
37255
37255
|
body,
|
|
37256
37256
|
headers,
|
|
@@ -37267,11 +37267,11 @@ var require_request = __commonJS({
|
|
|
37267
37267
|
maxRedirections,
|
|
37268
37268
|
typeOfService
|
|
37269
37269
|
}, handler) {
|
|
37270
|
-
if (typeof
|
|
37270
|
+
if (typeof path50 !== "string") {
|
|
37271
37271
|
throw new InvalidArgumentError2("path must be a string");
|
|
37272
|
-
} else if (
|
|
37272
|
+
} else if (path50[0] !== "/" && !(path50.startsWith("http://") || path50.startsWith("https://")) && method !== "CONNECT") {
|
|
37273
37273
|
throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
|
|
37274
|
-
} else if (invalidPathRegex.test(
|
|
37274
|
+
} else if (invalidPathRegex.test(path50)) {
|
|
37275
37275
|
throw new InvalidArgumentError2("invalid request path");
|
|
37276
37276
|
}
|
|
37277
37277
|
if (typeof method !== "string") {
|
|
@@ -37346,7 +37346,7 @@ var require_request = __commonJS({
|
|
|
37346
37346
|
this.completed = false;
|
|
37347
37347
|
this.aborted = false;
|
|
37348
37348
|
this.upgrade = upgrade || null;
|
|
37349
|
-
this.path = query ? serializePathWithQuery(
|
|
37349
|
+
this.path = query ? serializePathWithQuery(path50, query) : path50;
|
|
37350
37350
|
this.origin = origin;
|
|
37351
37351
|
this.protocol = getProtocolFromUrlString(origin);
|
|
37352
37352
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -42528,7 +42528,7 @@ var require_client_h1 = __commonJS({
|
|
|
42528
42528
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
42529
42529
|
}
|
|
42530
42530
|
function writeH1(client, request7) {
|
|
42531
|
-
const { method, path:
|
|
42531
|
+
const { method, path: path50, host, upgrade, blocking, reset } = request7;
|
|
42532
42532
|
let { body, headers, contentLength } = request7;
|
|
42533
42533
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
42534
42534
|
if (util2.isFormDataLike(body)) {
|
|
@@ -42606,7 +42606,7 @@ var require_client_h1 = __commonJS({
|
|
|
42606
42606
|
if (socket.setTypeOfService) {
|
|
42607
42607
|
socket.setTypeOfService(request7.typeOfService);
|
|
42608
42608
|
}
|
|
42609
|
-
let header = `${method} ${
|
|
42609
|
+
let header = `${method} ${path50} HTTP/1.1\r
|
|
42610
42610
|
`;
|
|
42611
42611
|
if (typeof host === "string") {
|
|
42612
42612
|
header += `host: ${host}\r
|
|
@@ -43285,7 +43285,7 @@ var require_client_h2 = __commonJS({
|
|
|
43285
43285
|
const headersTimeout = request7.headersTimeout ?? client[kHeadersTimeout];
|
|
43286
43286
|
const bodyTimeout = request7.bodyTimeout ?? client[kBodyTimeout];
|
|
43287
43287
|
const session = client[kHTTP2Session];
|
|
43288
|
-
const { method, path:
|
|
43288
|
+
const { method, path: path50, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
|
|
43289
43289
|
let { body } = request7;
|
|
43290
43290
|
if (upgrade != null && upgrade !== "websocket") {
|
|
43291
43291
|
util2.errorRequest(client, request7, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
@@ -43354,7 +43354,7 @@ var require_client_h2 = __commonJS({
|
|
|
43354
43354
|
}
|
|
43355
43355
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
43356
43356
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
43357
|
-
headers[HTTP2_HEADER_PATH] =
|
|
43357
|
+
headers[HTTP2_HEADER_PATH] = path50;
|
|
43358
43358
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
43359
43359
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
43360
43360
|
} else {
|
|
@@ -43396,7 +43396,7 @@ var require_client_h2 = __commonJS({
|
|
|
43396
43396
|
stream.setTimeout(headersTimeout);
|
|
43397
43397
|
return true;
|
|
43398
43398
|
}
|
|
43399
|
-
headers[HTTP2_HEADER_PATH] =
|
|
43399
|
+
headers[HTTP2_HEADER_PATH] = path50;
|
|
43400
43400
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
43401
43401
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
43402
43402
|
if (body && typeof body.read === "function") {
|
|
@@ -45748,10 +45748,10 @@ var require_proxy_agent = __commonJS({
|
|
|
45748
45748
|
};
|
|
45749
45749
|
const {
|
|
45750
45750
|
origin,
|
|
45751
|
-
path:
|
|
45751
|
+
path: path50 = "/",
|
|
45752
45752
|
headers = {}
|
|
45753
45753
|
} = opts;
|
|
45754
|
-
opts.path = origin +
|
|
45754
|
+
opts.path = origin + path50;
|
|
45755
45755
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
45756
45756
|
const { host } = new URL(origin);
|
|
45757
45757
|
headers.host = host;
|
|
@@ -47860,20 +47860,20 @@ var require_mock_utils = __commonJS({
|
|
|
47860
47860
|
}
|
|
47861
47861
|
return normalizedQp;
|
|
47862
47862
|
}
|
|
47863
|
-
function safeUrl(
|
|
47864
|
-
if (typeof
|
|
47865
|
-
return
|
|
47863
|
+
function safeUrl(path50) {
|
|
47864
|
+
if (typeof path50 !== "string") {
|
|
47865
|
+
return path50;
|
|
47866
47866
|
}
|
|
47867
|
-
const pathSegments =
|
|
47867
|
+
const pathSegments = path50.split("?", 3);
|
|
47868
47868
|
if (pathSegments.length !== 2) {
|
|
47869
|
-
return
|
|
47869
|
+
return path50;
|
|
47870
47870
|
}
|
|
47871
47871
|
const qp2 = new URLSearchParams(pathSegments.pop());
|
|
47872
47872
|
qp2.sort();
|
|
47873
47873
|
return [...pathSegments, qp2.toString()].join("?");
|
|
47874
47874
|
}
|
|
47875
|
-
function matchKey(mockDispatch2, { path:
|
|
47876
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
47875
|
+
function matchKey(mockDispatch2, { path: path50, method, body, headers }) {
|
|
47876
|
+
const pathMatch = matchValue(mockDispatch2.path, path50);
|
|
47877
47877
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
47878
47878
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
47879
47879
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -47898,8 +47898,8 @@ var require_mock_utils = __commonJS({
|
|
|
47898
47898
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
47899
47899
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
47900
47900
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
47901
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
47902
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
47901
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path50, ignoreTrailingSlash }) => {
|
|
47902
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path50)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path50), resolvedPath);
|
|
47903
47903
|
});
|
|
47904
47904
|
if (matchedMockDispatches.length === 0) {
|
|
47905
47905
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -47938,19 +47938,19 @@ var require_mock_utils = __commonJS({
|
|
|
47938
47938
|
mockDispatches.splice(index, 1);
|
|
47939
47939
|
}
|
|
47940
47940
|
}
|
|
47941
|
-
function removeTrailingSlash(
|
|
47942
|
-
while (
|
|
47943
|
-
|
|
47941
|
+
function removeTrailingSlash(path50) {
|
|
47942
|
+
while (path50.endsWith("/")) {
|
|
47943
|
+
path50 = path50.slice(0, -1);
|
|
47944
47944
|
}
|
|
47945
|
-
if (
|
|
47946
|
-
|
|
47945
|
+
if (path50.length === 0) {
|
|
47946
|
+
path50 = "/";
|
|
47947
47947
|
}
|
|
47948
|
-
return
|
|
47948
|
+
return path50;
|
|
47949
47949
|
}
|
|
47950
47950
|
function buildKey(opts) {
|
|
47951
|
-
const { path:
|
|
47951
|
+
const { path: path50, method, body, headers, query } = opts;
|
|
47952
47952
|
return {
|
|
47953
|
-
path:
|
|
47953
|
+
path: path50,
|
|
47954
47954
|
method,
|
|
47955
47955
|
body,
|
|
47956
47956
|
headers,
|
|
@@ -48640,10 +48640,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
48640
48640
|
}
|
|
48641
48641
|
format(pendingInterceptors) {
|
|
48642
48642
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
48643
|
-
({ method, path:
|
|
48643
|
+
({ method, path: path50, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
48644
48644
|
Method: method,
|
|
48645
48645
|
Origin: origin,
|
|
48646
|
-
Path:
|
|
48646
|
+
Path: path50,
|
|
48647
48647
|
"Status code": statusCode,
|
|
48648
48648
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
48649
48649
|
Invocations: timesInvoked,
|
|
@@ -48725,9 +48725,9 @@ var require_mock_agent = __commonJS({
|
|
|
48725
48725
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
48726
48726
|
const dispatchOpts = { ...opts };
|
|
48727
48727
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
48728
|
-
const [
|
|
48728
|
+
const [path50, searchParams] = dispatchOpts.path.split("?");
|
|
48729
48729
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
48730
|
-
dispatchOpts.path = `${
|
|
48730
|
+
dispatchOpts.path = `${path50}?${normalizedSearchParams}`;
|
|
48731
48731
|
}
|
|
48732
48732
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
48733
48733
|
}
|
|
@@ -49128,12 +49128,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
49128
49128
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
49129
49129
|
*/
|
|
49130
49130
|
async loadSnapshots(filePath) {
|
|
49131
|
-
const
|
|
49132
|
-
if (!
|
|
49131
|
+
const path50 = filePath || this.#snapshotPath;
|
|
49132
|
+
if (!path50) {
|
|
49133
49133
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
49134
49134
|
}
|
|
49135
49135
|
try {
|
|
49136
|
-
const data = await readFile(resolve2(
|
|
49136
|
+
const data = await readFile(resolve2(path50), "utf8");
|
|
49137
49137
|
const parsed = JSON.parse(data);
|
|
49138
49138
|
if (Array.isArray(parsed)) {
|
|
49139
49139
|
this.#snapshots.clear();
|
|
@@ -49147,7 +49147,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
49147
49147
|
if (error63.code === "ENOENT") {
|
|
49148
49148
|
this.#snapshots.clear();
|
|
49149
49149
|
} else {
|
|
49150
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
49150
|
+
throw new UndiciError(`Failed to load snapshots from ${path50}`, { cause: error63 });
|
|
49151
49151
|
}
|
|
49152
49152
|
}
|
|
49153
49153
|
}
|
|
@@ -49158,11 +49158,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
49158
49158
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
49159
49159
|
*/
|
|
49160
49160
|
async saveSnapshots(filePath) {
|
|
49161
|
-
const
|
|
49162
|
-
if (!
|
|
49161
|
+
const path50 = filePath || this.#snapshotPath;
|
|
49162
|
+
if (!path50) {
|
|
49163
49163
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
49164
49164
|
}
|
|
49165
|
-
const resolvedPath = resolve2(
|
|
49165
|
+
const resolvedPath = resolve2(path50);
|
|
49166
49166
|
await mkdir(dirname3(resolvedPath), { recursive: true });
|
|
49167
49167
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
49168
49168
|
hash: hash2,
|
|
@@ -49794,15 +49794,15 @@ var require_redirect_handler = __commonJS({
|
|
|
49794
49794
|
return;
|
|
49795
49795
|
}
|
|
49796
49796
|
const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
49797
|
-
const
|
|
49798
|
-
const redirectUrlString = `${origin}${
|
|
49797
|
+
const path50 = search ? `${pathname}${search}` : pathname;
|
|
49798
|
+
const redirectUrlString = `${origin}${path50}`;
|
|
49799
49799
|
for (const historyUrl of this.history) {
|
|
49800
49800
|
if (historyUrl.toString() === redirectUrlString) {
|
|
49801
49801
|
throw new InvalidArgumentError2(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
|
|
49802
49802
|
}
|
|
49803
49803
|
}
|
|
49804
49804
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
49805
|
-
this.opts.path =
|
|
49805
|
+
this.opts.path = path50;
|
|
49806
49806
|
this.opts.origin = origin;
|
|
49807
49807
|
this.opts.query = null;
|
|
49808
49808
|
}
|
|
@@ -51562,10 +51562,10 @@ var require_cache_handler = __commonJS({
|
|
|
51562
51562
|
}
|
|
51563
51563
|
return locationUrl.pathname + locationUrl.search;
|
|
51564
51564
|
}
|
|
51565
|
-
function deleteCachedUri(store, cacheKey,
|
|
51565
|
+
function deleteCachedUri(store, cacheKey, path50) {
|
|
51566
51566
|
deleteCachedValue(store, {
|
|
51567
51567
|
...cacheKey,
|
|
51568
|
-
path:
|
|
51568
|
+
path: path50
|
|
51569
51569
|
});
|
|
51570
51570
|
for (let i10 = 0; i10 < util2.safeHTTPMethods.length; i10++) {
|
|
51571
51571
|
const method = util2.safeHTTPMethods[i10];
|
|
@@ -51573,7 +51573,7 @@ var require_cache_handler = __commonJS({
|
|
|
51573
51573
|
deleteCachedValue(store, {
|
|
51574
51574
|
...cacheKey,
|
|
51575
51575
|
method,
|
|
51576
|
-
path:
|
|
51576
|
+
path: path50
|
|
51577
51577
|
});
|
|
51578
51578
|
}
|
|
51579
51579
|
}
|
|
@@ -51584,9 +51584,9 @@ var require_cache_handler = __commonJS({
|
|
|
51584
51584
|
}
|
|
51585
51585
|
const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
|
|
51586
51586
|
for (let i10 = 0; i10 < values.length; i10++) {
|
|
51587
|
-
const
|
|
51588
|
-
if (
|
|
51589
|
-
deleteCachedUri(store, cacheKey,
|
|
51587
|
+
const path50 = getSameOriginPath(cacheKey, values[i10]);
|
|
51588
|
+
if (path50 !== void 0) {
|
|
51589
|
+
deleteCachedUri(store, cacheKey, path50);
|
|
51590
51590
|
}
|
|
51591
51591
|
}
|
|
51592
51592
|
}
|
|
@@ -56586,11 +56586,11 @@ var require_fetch = __commonJS({
|
|
|
56586
56586
|
function dispatch({ body }) {
|
|
56587
56587
|
const url2 = requestCurrentURL(request7);
|
|
56588
56588
|
const agent = fetchParams.controller.dispatcher;
|
|
56589
|
-
const
|
|
56589
|
+
const path50 = url2.pathname + url2.search;
|
|
56590
56590
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
56591
56591
|
return new Promise((resolve2, reject) => agent.dispatch(
|
|
56592
56592
|
{
|
|
56593
|
-
path: hasTrailingQuestionMark ? `${
|
|
56593
|
+
path: hasTrailingQuestionMark ? `${path50}?` : path50,
|
|
56594
56594
|
origin: url2.origin,
|
|
56595
56595
|
method: request7.method,
|
|
56596
56596
|
body: agent.isMockActive ? request7.body && (request7.body.source || request7.body.stream) : body,
|
|
@@ -57537,9 +57537,9 @@ var require_util5 = __commonJS({
|
|
|
57537
57537
|
}
|
|
57538
57538
|
}
|
|
57539
57539
|
}
|
|
57540
|
-
function validateCookiePath(
|
|
57541
|
-
for (let i10 = 0; i10 <
|
|
57542
|
-
const code =
|
|
57540
|
+
function validateCookiePath(path50) {
|
|
57541
|
+
for (let i10 = 0; i10 < path50.length; ++i10) {
|
|
57542
|
+
const code = path50.charCodeAt(i10);
|
|
57543
57543
|
if (code < 32 || // exclude CTLs (0-31)
|
|
57544
57544
|
code > 126 || // exclude DEL and non-ascii
|
|
57545
57545
|
code === 59) {
|
|
@@ -60887,11 +60887,11 @@ var require_undici = __commonJS({
|
|
|
60887
60887
|
if (typeof opts.path !== "string") {
|
|
60888
60888
|
throw new InvalidArgumentError2("invalid opts.path");
|
|
60889
60889
|
}
|
|
60890
|
-
let
|
|
60890
|
+
let path50 = opts.path;
|
|
60891
60891
|
if (!opts.path.startsWith("/")) {
|
|
60892
|
-
|
|
60892
|
+
path50 = `/${path50}`;
|
|
60893
60893
|
}
|
|
60894
|
-
url2 = new URL(util2.parseOrigin(url2).origin +
|
|
60894
|
+
url2 = new URL(util2.parseOrigin(url2).origin + path50);
|
|
60895
60895
|
} else {
|
|
60896
60896
|
if (!opts) {
|
|
60897
60897
|
opts = typeof url2 === "object" ? url2 : {};
|
|
@@ -99847,8 +99847,8 @@ var require_utils3 = __commonJS({
|
|
|
99847
99847
|
}
|
|
99848
99848
|
return ind;
|
|
99849
99849
|
}
|
|
99850
|
-
function removeDotSegments(
|
|
99851
|
-
let input2 =
|
|
99850
|
+
function removeDotSegments(path50) {
|
|
99851
|
+
let input2 = path50;
|
|
99852
99852
|
const output2 = [];
|
|
99853
99853
|
let nextSlash = -1;
|
|
99854
99854
|
let len = 0;
|
|
@@ -100257,8 +100257,8 @@ var require_schemes = __commonJS({
|
|
|
100257
100257
|
}
|
|
100258
100258
|
if (wsComponent.resourceName) {
|
|
100259
100259
|
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
100260
|
-
const
|
|
100261
|
-
wsComponent.path =
|
|
100260
|
+
const path50 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
100261
|
+
wsComponent.path = path50 && path50 !== "/" ? path50 : void 0;
|
|
100262
100262
|
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
100263
100263
|
wsComponent.resourceName = void 0;
|
|
100264
100264
|
}
|
|
@@ -103785,7 +103785,7 @@ var require_dist2 = __commonJS({
|
|
|
103785
103785
|
});
|
|
103786
103786
|
|
|
103787
103787
|
// src/cli.ts
|
|
103788
|
-
var
|
|
103788
|
+
var import_node_path49 = __toESM(require("node:path"), 1);
|
|
103789
103789
|
|
|
103790
103790
|
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
|
|
103791
103791
|
var CommanderError = class extends Error {
|
|
@@ -106898,9 +106898,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
106898
106898
|
* @param {string} [path]
|
|
106899
106899
|
* @return {(string|null|Command)}
|
|
106900
106900
|
*/
|
|
106901
|
-
executableDir(
|
|
106902
|
-
if (
|
|
106903
|
-
this._executableDir =
|
|
106901
|
+
executableDir(path50) {
|
|
106902
|
+
if (path50 === void 0) return this._executableDir;
|
|
106903
|
+
this._executableDir = path50;
|
|
106904
106904
|
return this;
|
|
106905
106905
|
}
|
|
106906
106906
|
/**
|
|
@@ -108549,19 +108549,19 @@ function writePools(paths, pools) {
|
|
|
108549
108549
|
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
|
|
108550
108550
|
}
|
|
108551
108551
|
function poolCycleOf(pools, name) {
|
|
108552
|
-
const walk = (current,
|
|
108552
|
+
const walk = (current, path50) => {
|
|
108553
108553
|
for (const entry of pools[current]?.identities ?? []) {
|
|
108554
108554
|
const nested = poolNameOf(poolMemberIdentity(entry));
|
|
108555
108555
|
if (nested === void 0) {
|
|
108556
108556
|
continue;
|
|
108557
108557
|
}
|
|
108558
108558
|
if (nested === name) {
|
|
108559
|
-
return [...
|
|
108559
|
+
return [...path50, nested];
|
|
108560
108560
|
}
|
|
108561
|
-
if (
|
|
108561
|
+
if (path50.includes(nested)) {
|
|
108562
108562
|
continue;
|
|
108563
108563
|
}
|
|
108564
|
-
const found = walk(nested, [...
|
|
108564
|
+
const found = walk(nested, [...path50, nested]);
|
|
108565
108565
|
if (found !== void 0) {
|
|
108566
108566
|
return found;
|
|
108567
108567
|
}
|
|
@@ -111378,7 +111378,7 @@ function registerCodexCommand(program2, deps) {
|
|
|
111378
111378
|
|
|
111379
111379
|
// src/frontdoor/commands.ts
|
|
111380
111380
|
var import_node_crypto20 = require("node:crypto");
|
|
111381
|
-
var
|
|
111381
|
+
var import_node_path45 = __toESM(require("node:path"), 1);
|
|
111382
111382
|
var import_node_fs16 = __toESM(require("node:fs"), 1);
|
|
111383
111383
|
init_commandDeps();
|
|
111384
111384
|
init_schema();
|
|
@@ -112329,8 +112329,8 @@ function parseConnectTarget(authority) {
|
|
|
112329
112329
|
}
|
|
112330
112330
|
return { host, port };
|
|
112331
112331
|
}
|
|
112332
|
-
function servedByPipeline(
|
|
112333
|
-
return
|
|
112332
|
+
function servedByPipeline(path50) {
|
|
112333
|
+
return path50?.startsWith(ROUTED_PATH_PREFIX) === true;
|
|
112334
112334
|
}
|
|
112335
112335
|
var HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
|
|
112336
112336
|
"connection",
|
|
@@ -112849,11 +112849,11 @@ function createRcSessionTracker(deps) {
|
|
|
112849
112849
|
};
|
|
112850
112850
|
const observeExchange = (request7) => {
|
|
112851
112851
|
const method = (request7.method ?? "").toUpperCase();
|
|
112852
|
-
const
|
|
112853
|
-
if (!
|
|
112852
|
+
const path50 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
|
|
112853
|
+
if (!path50.startsWith(RC_SESSIONS_PATH_PREFIX)) {
|
|
112854
112854
|
return void 0;
|
|
112855
112855
|
}
|
|
112856
|
-
const tail =
|
|
112856
|
+
const tail = path50.slice(RC_SESSIONS_PATH_PREFIX.length);
|
|
112857
112857
|
const facts = {
|
|
112858
112858
|
oauthAuthorization: oauthAuthorizationOf(request7.headers),
|
|
112859
112859
|
anthropicVersion: singleHeader(request7.headers, "anthropic-version"),
|
|
@@ -113214,8 +113214,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
|
|
|
113214
113214
|
function isRcReadFileEncoding(value2) {
|
|
113215
113215
|
return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value2);
|
|
113216
113216
|
}
|
|
113217
|
-
function buildRcReadFilePayload(requestId,
|
|
113218
|
-
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path:
|
|
113217
|
+
function buildRcReadFilePayload(requestId, path50, options) {
|
|
113218
|
+
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path50, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
|
|
113219
113219
|
}
|
|
113220
113220
|
function buildRcFileSuggestionsPayload(requestId, query) {
|
|
113221
113221
|
return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
|
|
@@ -113317,15 +113317,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
|
|
|
113317
113317
|
const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
|
|
113318
113318
|
return result.ok ? { ...result, requestId } : result;
|
|
113319
113319
|
}
|
|
113320
|
-
async function readRcSessionFile(deps, sessionId,
|
|
113321
|
-
if (
|
|
113320
|
+
async function readRcSessionFile(deps, sessionId, path50, options) {
|
|
113321
|
+
if (path50 === "") {
|
|
113322
113322
|
return { ok: false, message: "a read-file write needs a non-empty path: the SDK's own field names the file the worker resolves against the session's cwd, and an empty string names none" };
|
|
113323
113323
|
}
|
|
113324
113324
|
if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
|
|
113325
113325
|
return { ok: false, message: "a read-file write's max-bytes is a positive whole number of bytes: the SDK's own field caps the read, and a zero or negative cap reads nothing" };
|
|
113326
113326
|
}
|
|
113327
113327
|
const requestId = deps.newUuid();
|
|
113328
|
-
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId,
|
|
113328
|
+
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path50, options), `read ${path50} from session ${sessionId}`);
|
|
113329
113329
|
return result.ok ? { ...result, requestId } : result;
|
|
113330
113330
|
}
|
|
113331
113331
|
async function suggestRcSessionFiles(deps, sessionId, query) {
|
|
@@ -113496,11 +113496,11 @@ function createRcControlHandler(deps) {
|
|
|
113496
113496
|
path: "read-file",
|
|
113497
113497
|
read: (body) => {
|
|
113498
113498
|
const session = bodyString(body, "session");
|
|
113499
|
-
const
|
|
113499
|
+
const path50 = bodyString(body, "path");
|
|
113500
113500
|
const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
|
|
113501
113501
|
const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
|
|
113502
|
-
const refused2 = session === void 0 ||
|
|
113503
|
-
return refused2 ? { error: `the read-file body must be JSON naming a non-empty session id and path, maxBytes only as a positive whole number or absent, and an encoding the SDK's own type permits (${RC_READ_FILE_ENCODINGS.join(", ")}) or none` } : { session, run: async () => await deps.readFile(session,
|
|
113502
|
+
const refused2 = session === void 0 || path50 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
|
|
113503
|
+
return refused2 ? { error: `the read-file body must be JSON naming a non-empty session id and path, maxBytes only as a positive whole number or absent, and an encoding the SDK's own type permits (${RC_READ_FILE_ENCODINGS.join(", ")}) or none` } : { session, run: async () => await deps.readFile(session, path50, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
|
|
113504
113504
|
}
|
|
113505
113505
|
},
|
|
113506
113506
|
{
|
|
@@ -113810,9 +113810,9 @@ function requestIdOfBody(body) {
|
|
|
113810
113810
|
}
|
|
113811
113811
|
function frontDoorRcControl(transport, token) {
|
|
113812
113812
|
const headers = { authorization: `Bearer ${token}` };
|
|
113813
|
-
const listAnswerOf = async (
|
|
113813
|
+
const listAnswerOf = async (path50, what) => {
|
|
113814
113814
|
try {
|
|
113815
|
-
return await transport.request({ method: "GET", path:
|
|
113815
|
+
return await transport.request({ method: "GET", path: path50, headers });
|
|
113816
113816
|
} catch (error63) {
|
|
113817
113817
|
throw new Error(`${what}: could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}`, { cause: error63 });
|
|
113818
113818
|
}
|
|
@@ -113884,10 +113884,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
113884
113884
|
}
|
|
113885
113885
|
return pending;
|
|
113886
113886
|
};
|
|
113887
|
-
const writeOf = async (
|
|
113887
|
+
const writeOf = async (path50, body, describeFailure) => {
|
|
113888
113888
|
let answer;
|
|
113889
113889
|
try {
|
|
113890
|
-
answer = await transport.request({ method: "POST", path:
|
|
113890
|
+
answer = await transport.request({ method: "POST", path: path50, headers: { ...headers, "content-type": "application/json" }, body });
|
|
113891
113891
|
} catch (error63) {
|
|
113892
113892
|
return { ok: false, message: `could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}` };
|
|
113893
113893
|
}
|
|
@@ -113918,10 +113918,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
113918
113918
|
endSession: async (sessionId, reason) => await writeOf(`${CONTROL_PATH_PREFIX}/end-session`, JSON.stringify({ session: sessionId, ...reason === void 0 ? {} : { reason } }), (status, message) => `ending ${sessionId} failed (HTTP ${String(status)}): ${message}`),
|
|
113919
113919
|
getUsage: async (sessionId, skipBehaviors) => await writeOf(`${CONTROL_PATH_PREFIX}/get-usage`, JSON.stringify({ session: sessionId, ...skipBehaviors === void 0 ? {} : { skipBehaviors } }), (status, message) => `requesting the usage of ${sessionId} failed (HTTP ${String(status)}): ${message}`),
|
|
113920
113920
|
getContextUsage: async (sessionId, detail) => await writeOf(`${CONTROL_PATH_PREFIX}/get-context-usage`, JSON.stringify({ session: sessionId, ...detail === void 0 ? {} : { detail } }), (status, message) => `requesting the context usage of ${sessionId} failed (HTTP ${String(status)}): ${message}`),
|
|
113921
|
-
readFile: async (sessionId,
|
|
113921
|
+
readFile: async (sessionId, path50, options) => await writeOf(
|
|
113922
113922
|
`${CONTROL_PATH_PREFIX}/read-file`,
|
|
113923
|
-
JSON.stringify({ session: sessionId, path:
|
|
113924
|
-
(status, message) => `reading ${
|
|
113923
|
+
JSON.stringify({ session: sessionId, path: path50, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
|
|
113924
|
+
(status, message) => `reading ${path50} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
|
|
113925
113925
|
),
|
|
113926
113926
|
fileSuggestions: async (sessionId, query) => await writeOf(`${CONTROL_PATH_PREFIX}/file-suggestions`, JSON.stringify({ session: sessionId, query }), (status, message) => `requesting file suggestions from ${sessionId} failed (HTTP ${String(status)}): ${message}`),
|
|
113927
113927
|
keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
|
|
@@ -114215,12 +114215,12 @@ function tlsFacts(options) {
|
|
|
114215
114215
|
}
|
|
114216
114216
|
function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
114217
114217
|
const agent = new ExemptTlsAgent();
|
|
114218
|
-
const post = async (
|
|
114218
|
+
const post = async (path50, headers, body) => await new Promise((resolve2, reject) => {
|
|
114219
114219
|
const options = {
|
|
114220
114220
|
host: target.host,
|
|
114221
114221
|
port: target.port,
|
|
114222
114222
|
method: "POST",
|
|
114223
|
-
path:
|
|
114223
|
+
path: path50,
|
|
114224
114224
|
// The Host header names the host whose API this is, not the address dialled: a redirected test dials a loopback stand-in while still speaking to the API host by name, exactly as the forwarded paths present their SNI.
|
|
114225
114225
|
headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
|
|
114226
114226
|
agent
|
|
@@ -114285,12 +114285,12 @@ function lateRcStreamDial(resolve2) {
|
|
|
114285
114285
|
}
|
|
114286
114286
|
function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
114287
114287
|
const agent = new ExemptTlsAgent();
|
|
114288
|
-
const request7 = async (method,
|
|
114288
|
+
const request7 = async (method, path50, headers, body, signal) => await new Promise((resolve2, reject) => {
|
|
114289
114289
|
const options = {
|
|
114290
114290
|
host: target.host,
|
|
114291
114291
|
port: target.port,
|
|
114292
114292
|
method,
|
|
114293
|
-
path:
|
|
114293
|
+
path: path50,
|
|
114294
114294
|
// The Host header names the host whose API this is, not the address dialled: a redirected test dials a loopback stand-in while still speaking to the API host by name, exactly as the forwarded paths present their SNI.
|
|
114295
114295
|
headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
|
|
114296
114296
|
agent,
|
|
@@ -114332,9 +114332,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
|
|
|
114332
114332
|
return { status, body: await readAll(response) };
|
|
114333
114333
|
},
|
|
114334
114334
|
openStream: async (sessionId, headers, resume, signal) => {
|
|
114335
|
-
const
|
|
114335
|
+
const path50 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
|
|
114336
114336
|
const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
|
|
114337
|
-
const { status, response } = await request7("GET",
|
|
114337
|
+
const { status, response } = await request7("GET", path50, streamHeaders, void 0, signal);
|
|
114338
114338
|
if (!isSuccessful2(status)) {
|
|
114339
114339
|
await readAll(response);
|
|
114340
114340
|
return { status, chunks: NO_CHUNKS };
|
|
@@ -114550,7 +114550,40 @@ init_claudeShim();
|
|
|
114550
114550
|
init_store();
|
|
114551
114551
|
init_realPorts();
|
|
114552
114552
|
var import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
114553
|
+
var import_node_path40 = __toESM(require("node:path"), 1);
|
|
114554
|
+
|
|
114555
|
+
// src/usage/signIn.ts
|
|
114553
114556
|
var import_node_path39 = __toESM(require("node:path"), 1);
|
|
114557
|
+
var CREDENTIALS_FILE = ".credentials.json";
|
|
114558
|
+
function keychainHasItem(run, account) {
|
|
114559
|
+
return run.run("security", ["find-generic-password", "-a", account]).status === 0;
|
|
114560
|
+
}
|
|
114561
|
+
function decideSignIn(facts) {
|
|
114562
|
+
if (facts.hasCredentialBlock) {
|
|
114563
|
+
return { state: "token", detail: "supplies its own credential through a credential block, so a stored login is not what a launch uses" };
|
|
114564
|
+
}
|
|
114565
|
+
if (facts.keychainItem === true) {
|
|
114566
|
+
return { state: "signed-in", detail: "a login is stored in the macOS Keychain" };
|
|
114567
|
+
}
|
|
114568
|
+
if (facts.credentialsFile) {
|
|
114569
|
+
return { state: "signed-in", detail: `a login is stored in ${CREDENTIALS_FILE}` };
|
|
114570
|
+
}
|
|
114571
|
+
return { state: "signed-out", detail: facts.platform === "darwin" ? `no Keychain item and no ${CREDENTIALS_FILE}` : `no ${CREDENTIALS_FILE}` };
|
|
114572
|
+
}
|
|
114573
|
+
function credentialsFilePath(farmRoot) {
|
|
114574
|
+
return import_node_path39.default.join(farmRoot, CREDENTIALS_FILE);
|
|
114575
|
+
}
|
|
114576
|
+
function identitySignIn(fs21, probe, identity) {
|
|
114577
|
+
const probing = !identity.hasCredentialBlock;
|
|
114578
|
+
return decideSignIn({
|
|
114579
|
+
hasCredentialBlock: identity.hasCredentialBlock,
|
|
114580
|
+
keychainItem: probing && probe.platform === "darwin" && probe.run !== void 0 ? keychainHasItem(probe.run, identity.farmRoot) : void 0,
|
|
114581
|
+
credentialsFile: probing && fs21.lstat(credentialsFilePath(identity.farmRoot)) !== void 0,
|
|
114582
|
+
platform: probe.platform
|
|
114583
|
+
});
|
|
114584
|
+
}
|
|
114585
|
+
|
|
114586
|
+
// src/doctorReport.ts
|
|
114554
114587
|
init_load();
|
|
114555
114588
|
init_schema();
|
|
114556
114589
|
init_credential();
|
|
@@ -114572,6 +114605,7 @@ var DOCTOR_SECTIONS = [
|
|
|
114572
114605
|
"legacy-name",
|
|
114573
114606
|
"config-profile",
|
|
114574
114607
|
"identity",
|
|
114608
|
+
"sign-in",
|
|
114575
114609
|
"pool",
|
|
114576
114610
|
"provider",
|
|
114577
114611
|
"keychain",
|
|
@@ -114614,7 +114648,7 @@ function tcpPortEraRecord(raw) {
|
|
|
114614
114648
|
return (has("port") || has("lastPort")) && !has("socketPath");
|
|
114615
114649
|
}
|
|
114616
114650
|
function pushPathResolution(push, resolution) {
|
|
114617
|
-
const ownDir =
|
|
114651
|
+
const ownDir = import_node_path40.default.dirname(resolution.ownExecutablePath);
|
|
114618
114652
|
switch (resolution.agentShim.status) {
|
|
114619
114653
|
case "ok":
|
|
114620
114654
|
push("path-resolution", "pass", `\`agent-shim\` on PATH resolves to this running executable, ${resolution.ownExecutablePath}.`, "agent-shim");
|
|
@@ -114713,14 +114747,14 @@ function pushProvider(push, entry, cacheEnv, signIn) {
|
|
|
114713
114747
|
}
|
|
114714
114748
|
function pushLegacyName(push, params) {
|
|
114715
114749
|
const legacyVariables = Object.keys(params.env).filter((name) => name.startsWith(LEGACY_ENV_PREFIX) && params.env[name] !== void 0).sort();
|
|
114716
|
-
if (legacyVariables.length === 0 &&
|
|
114750
|
+
if (legacyVariables.length === 0 && import_node_path40.default.basename(params.rootPath) !== LEGACY_HOME_DIRNAME) {
|
|
114717
114751
|
push("legacy-name", "pass", "Nothing here still uses the former `claude-use` name.");
|
|
114718
114752
|
return;
|
|
114719
114753
|
}
|
|
114720
114754
|
for (const name of legacyVariables) {
|
|
114721
114755
|
push("legacy-name", "warn", `${name} is the former name of ${name.replace(LEGACY_ENV_PREFIX, ENV_PREFIX)}. Rename it; the old name still works but is only a fallback.`, name);
|
|
114722
114756
|
}
|
|
114723
|
-
if (
|
|
114757
|
+
if (import_node_path40.default.basename(params.rootPath) === LEGACY_HOME_DIRNAME) {
|
|
114724
114758
|
push(
|
|
114725
114759
|
"legacy-name",
|
|
114726
114760
|
"warn",
|
|
@@ -114817,6 +114851,18 @@ function runDoctor(params) {
|
|
|
114817
114851
|
`${entry.name} is valid and authenticates with ${credential === void 0 ? "its stored login" : `credential ${describeCredential(credential)}`}${cache.text}.`,
|
|
114818
114852
|
entry.name
|
|
114819
114853
|
);
|
|
114854
|
+
const signIn = decideSignIn({
|
|
114855
|
+
hasCredentialBlock: credential !== void 0,
|
|
114856
|
+
keychainItem: params.platform === "darwin" && params.run !== void 0 ? keychainHasItem(params.run, entry.farmRoot) : void 0,
|
|
114857
|
+
credentialsFile: entry.credentialsFilePresent,
|
|
114858
|
+
platform: params.platform
|
|
114859
|
+
});
|
|
114860
|
+
push(
|
|
114861
|
+
"sign-in",
|
|
114862
|
+
signIn.state === "signed-out" ? "warn" : "pass",
|
|
114863
|
+
signIn.state === "signed-out" ? `${entry.name} is signed out (${signIn.detail}). Run \`agent-shim run @${entry.name}\` and sign in.` : `${entry.name} ${signIn.state === "token" ? "uses a credential block" : "is signed in"} (${signIn.detail}).`,
|
|
114864
|
+
entry.name
|
|
114865
|
+
);
|
|
114820
114866
|
}
|
|
114821
114867
|
}
|
|
114822
114868
|
const validatedGlobalConfig = params.globalConfig.raw === void 0 ? void 0 : validateJson(GlobalConfigSchema, params.globalConfig);
|
|
@@ -114862,7 +114908,7 @@ function runDoctor(params) {
|
|
|
114862
114908
|
} else {
|
|
114863
114909
|
for (const entry of params.identities) {
|
|
114864
114910
|
const result = lookupKeychainService(params.run, entry.farmRoot);
|
|
114865
|
-
push("keychain", result.found ?
|
|
114911
|
+
push("keychain", "pass", result.found ? result.note : `${result.note} The sign-in section reports whether a login is stored elsewhere.`, entry.name);
|
|
114866
114912
|
}
|
|
114867
114913
|
}
|
|
114868
114914
|
if (params.directoryRules.raw === void 0) {
|
|
@@ -114997,6 +115043,7 @@ var SECTION_TITLES = {
|
|
|
114997
115043
|
"legacy-name": "Former `claude-use` name",
|
|
114998
115044
|
"config-profile": "Configuration profiles",
|
|
114999
115045
|
identity: "Identities",
|
|
115046
|
+
"sign-in": "Sign-in",
|
|
115000
115047
|
pool: "Pools",
|
|
115001
115048
|
provider: "Providers",
|
|
115002
115049
|
keychain: "macOS Keychain",
|
|
@@ -115013,6 +115060,7 @@ var SECTION_ORDER = [
|
|
|
115013
115060
|
"path-resolution",
|
|
115014
115061
|
"config-profile",
|
|
115015
115062
|
"identity",
|
|
115063
|
+
"sign-in",
|
|
115016
115064
|
"pool",
|
|
115017
115065
|
"provider",
|
|
115018
115066
|
"keychain",
|
|
@@ -115062,18 +115110,18 @@ function collectDoctorReport(params) {
|
|
|
115062
115110
|
const { paths } = params;
|
|
115063
115111
|
const identityNames = import_node_fs15.default.existsSync(paths.identitiesDir) ? import_node_fs15.default.readdirSync(paths.identitiesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && isIdentityDirectoryName(entry.name)).map((entry) => entry.name).sort() : [];
|
|
115064
115112
|
const identities = identityNames.map((name) => {
|
|
115065
|
-
const farmRoot =
|
|
115066
|
-
const identityPath =
|
|
115067
|
-
return { name, path: identityPath, raw: realFsPort.readFileUtf8(identityPath), farmRoot };
|
|
115113
|
+
const farmRoot = import_node_path40.default.join(paths.identitiesDir, name);
|
|
115114
|
+
const identityPath = import_node_path40.default.join(farmRoot, "identity.json");
|
|
115115
|
+
return { name, path: identityPath, raw: realFsPort.readFileUtf8(identityPath), farmRoot, credentialsFilePresent: import_node_fs15.default.existsSync(credentialsFilePath(farmRoot)) };
|
|
115068
115116
|
});
|
|
115069
115117
|
const profileNames = import_node_fs15.default.existsSync(paths.configProfilesDir) ? import_node_fs15.default.readdirSync(paths.configProfilesDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
|
|
115070
115118
|
const configProfiles = profileNames.map((name) => {
|
|
115071
|
-
const profilePath =
|
|
115119
|
+
const profilePath = import_node_path40.default.join(paths.configProfilesDir, `${name}.json`);
|
|
115072
115120
|
return { name, path: profilePath, raw: realFsPort.readFileUtf8(profilePath) };
|
|
115073
115121
|
});
|
|
115074
115122
|
const providerNames = import_node_fs15.default.existsSync(paths.providersDir) ? import_node_fs15.default.readdirSync(paths.providersDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
|
|
115075
115123
|
const providers = providerNames.map((name) => {
|
|
115076
|
-
const providerPath =
|
|
115124
|
+
const providerPath = import_node_path40.default.join(paths.providersDir, `${name}.json`);
|
|
115077
115125
|
return { name, path: providerPath, raw: realFsPort.readFileUtf8(providerPath) };
|
|
115078
115126
|
});
|
|
115079
115127
|
const ownExecutablePath = realOwnExecutablePath();
|
|
@@ -115085,12 +115133,12 @@ function collectDoctorReport(params) {
|
|
|
115085
115133
|
binaryDiscovery = { ok: false, message: error63 instanceof Error ? error63.message : String(error63) };
|
|
115086
115134
|
}
|
|
115087
115135
|
const shimState = readJson(paths.claudeShimFile, ClaudeShimStateSchema);
|
|
115088
|
-
const pathDirs = (params.env.PATH ?? "").split(
|
|
115136
|
+
const pathDirs = (params.env.PATH ?? "").split(import_node_path40.default.delimiter).filter((dir) => dir !== "");
|
|
115089
115137
|
const claudeShimShadow = shimState === void 0 ? void 0 : refinePathShadow(
|
|
115090
115138
|
findPathShadow({
|
|
115091
115139
|
pathDirs,
|
|
115092
|
-
targetDir:
|
|
115093
|
-
targetFilename:
|
|
115140
|
+
targetDir: import_node_path40.default.dirname(shimState.targetPath),
|
|
115141
|
+
targetFilename: import_node_path40.default.basename(shimState.targetPath),
|
|
115094
115142
|
findExecutableInDir
|
|
115095
115143
|
}),
|
|
115096
115144
|
shimState.targetPath,
|
|
@@ -115116,7 +115164,7 @@ function collectDoctorReport(params) {
|
|
|
115116
115164
|
agentShim: refinePathShadow(
|
|
115117
115165
|
findPathShadow({
|
|
115118
115166
|
pathDirs,
|
|
115119
|
-
targetDir:
|
|
115167
|
+
targetDir: import_node_path40.default.dirname(ownExecutablePath),
|
|
115120
115168
|
targetFilename: commandFilename(ownExecutablePath, "agent-shim"),
|
|
115121
115169
|
findExecutableInDir
|
|
115122
115170
|
}),
|
|
@@ -115374,11 +115422,11 @@ function tryOrUndefined(fn2) {
|
|
|
115374
115422
|
return void 0;
|
|
115375
115423
|
}
|
|
115376
115424
|
}
|
|
115377
|
-
function pathToHttpPath(
|
|
115378
|
-
return `/${
|
|
115425
|
+
function pathToHttpPath(path50) {
|
|
115426
|
+
return `/${path50.map(safeEncodeURIComponent).join("/")}`;
|
|
115379
115427
|
}
|
|
115380
|
-
function normalizeHttpPath(
|
|
115381
|
-
const paths =
|
|
115428
|
+
function normalizeHttpPath(path50) {
|
|
115429
|
+
const paths = path50.split("/");
|
|
115382
115430
|
if (paths.at(0) === "") {
|
|
115383
115431
|
paths.shift();
|
|
115384
115432
|
}
|
|
@@ -115563,9 +115611,9 @@ function isPlainObject2(value2) {
|
|
|
115563
115611
|
function getOwn(object3, key) {
|
|
115564
115612
|
return Object.hasOwn(object3, key) ? object3[key] : void 0;
|
|
115565
115613
|
}
|
|
115566
|
-
function get(object3,
|
|
115614
|
+
function get(object3, path50) {
|
|
115567
115615
|
let current = object3;
|
|
115568
|
-
for (const key of
|
|
115616
|
+
for (const key of path50) {
|
|
115569
115617
|
if (!isTypescriptObject(current)) {
|
|
115570
115618
|
return void 0;
|
|
115571
115619
|
}
|
|
@@ -116788,7 +116836,7 @@ function resolveClientRest(rest) {
|
|
|
116788
116836
|
// rest[1] can be undefined if all fields of FriendlyClientOptions are optional
|
|
116789
116837
|
];
|
|
116790
116838
|
}
|
|
116791
|
-
function createORPCClient(link, { path:
|
|
116839
|
+
function createORPCClient(link, { path: path50 = [], ...options } = {}) {
|
|
116792
116840
|
const procedureClient = (...rest) => {
|
|
116793
116841
|
const [input2, callOptions] = resolveClientRest(rest);
|
|
116794
116842
|
const interceptors = [
|
|
@@ -116797,7 +116845,7 @@ function createORPCClient(link, { path: path48 = [], ...options } = {}) {
|
|
|
116797
116845
|
];
|
|
116798
116846
|
return intercept(
|
|
116799
116847
|
interceptors,
|
|
116800
|
-
{ ...callOptions, input: input2, path:
|
|
116848
|
+
{ ...callOptions, input: input2, path: path50 },
|
|
116801
116849
|
({ path: path210, input: input22, ...callOptions2 }) => link.call(path210, input22, callOptions2)
|
|
116802
116850
|
);
|
|
116803
116851
|
};
|
|
@@ -116811,7 +116859,7 @@ function createORPCClient(link, { path: path48 = [], ...options } = {}) {
|
|
|
116811
116859
|
if (client === void 0) {
|
|
116812
116860
|
client = createORPCClient(link, {
|
|
116813
116861
|
...options,
|
|
116814
|
-
path: [...
|
|
116862
|
+
path: [...path50, key],
|
|
116815
116863
|
scoped: options.scoped?.[key]
|
|
116816
116864
|
});
|
|
116817
116865
|
cache.set(key, client);
|
|
@@ -116833,24 +116881,24 @@ var BracketNotationSerializer = class {
|
|
|
116833
116881
|
this.internalSerialize(data, "", true, result);
|
|
116834
116882
|
return result;
|
|
116835
116883
|
}
|
|
116836
|
-
internalSerialize(data,
|
|
116884
|
+
internalSerialize(data, path50, isRoot, result) {
|
|
116837
116885
|
if (Array.isArray(data)) {
|
|
116838
116886
|
data.forEach((item, i10) => {
|
|
116839
|
-
this.internalSerialize(item, isRoot ? i10.toString() : `${
|
|
116887
|
+
this.internalSerialize(item, isRoot ? i10.toString() : `${path50}[${i10}]`, false, result);
|
|
116840
116888
|
});
|
|
116841
116889
|
} else if (isPlainObject2(data)) {
|
|
116842
116890
|
for (const key of Object.keys(data)) {
|
|
116843
|
-
this.internalSerialize(data[key], isRoot ? key : `${
|
|
116891
|
+
this.internalSerialize(data[key], isRoot ? key : `${path50}[${key}]`, false, result);
|
|
116844
116892
|
}
|
|
116845
116893
|
} else {
|
|
116846
|
-
result.push([
|
|
116894
|
+
result.push([path50, data]);
|
|
116847
116895
|
}
|
|
116848
116896
|
}
|
|
116849
116897
|
deserialize(serialized) {
|
|
116850
116898
|
const arrayPushStyles = /* @__PURE__ */ new WeakSet();
|
|
116851
116899
|
const root = new NullProtoObj();
|
|
116852
|
-
for (const [
|
|
116853
|
-
const segments = this.parsePath(
|
|
116900
|
+
for (const [path50, value2] of serialized) {
|
|
116901
|
+
const segments = this.parsePath(path50);
|
|
116854
116902
|
let currentRef = root;
|
|
116855
116903
|
let nextSegment = segments[0];
|
|
116856
116904
|
for (let i10 = 1; i10 < segments.length; i10++) {
|
|
@@ -116901,13 +116949,13 @@ var BracketNotationSerializer = class {
|
|
|
116901
116949
|
}
|
|
116902
116950
|
return result;
|
|
116903
116951
|
}
|
|
116904
|
-
parsePath(
|
|
116952
|
+
parsePath(path50) {
|
|
116905
116953
|
const segments = [];
|
|
116906
116954
|
let inBrackets = false;
|
|
116907
116955
|
let currentSegment = "";
|
|
116908
|
-
for (let i10 = 0; i10 <
|
|
116909
|
-
const char =
|
|
116910
|
-
const nextChar =
|
|
116956
|
+
for (let i10 = 0; i10 < path50.length; i10++) {
|
|
116957
|
+
const char = path50[i10];
|
|
116958
|
+
const nextChar = path50[i10 + 1];
|
|
116911
116959
|
if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[")) {
|
|
116912
116960
|
if (nextChar === void 0) {
|
|
116913
116961
|
inBrackets = false;
|
|
@@ -116923,7 +116971,7 @@ var BracketNotationSerializer = class {
|
|
|
116923
116971
|
currentSegment += char;
|
|
116924
116972
|
}
|
|
116925
116973
|
}
|
|
116926
|
-
return inBrackets || segments.length === 0 ? [
|
|
116974
|
+
return inBrackets || segments.length === 0 ? [path50] : segments;
|
|
116927
116975
|
}
|
|
116928
116976
|
};
|
|
116929
116977
|
var INTEGER_PATTERN = /^0$|^[1-9]\d*$/;
|
|
@@ -117496,11 +117544,11 @@ var OpenAPISerializer = class {
|
|
|
117496
117544
|
return json2;
|
|
117497
117545
|
}
|
|
117498
117546
|
const form = new FormData();
|
|
117499
|
-
for (const [
|
|
117547
|
+
for (const [path50, value22] of this.bracketNotation.serialize(json2)) {
|
|
117500
117548
|
if (value22 instanceof Blob) {
|
|
117501
|
-
form.append(
|
|
117549
|
+
form.append(path50, value22);
|
|
117502
117550
|
} else if (value22 !== void 0 && value22 !== null) {
|
|
117503
|
-
form.append(
|
|
117551
|
+
form.append(path50, String(value22));
|
|
117504
117552
|
}
|
|
117505
117553
|
}
|
|
117506
117554
|
return form;
|
|
@@ -117538,30 +117586,30 @@ function isBodylessMethod(method) {
|
|
|
117538
117586
|
return method === "GET" || method === "HEAD";
|
|
117539
117587
|
}
|
|
117540
117588
|
var PARAMETER_NAME_REGEX = /^[\w-]+$/;
|
|
117541
|
-
function getDynamicPathParams(
|
|
117542
|
-
if (!
|
|
117589
|
+
function getDynamicPathParams(path50) {
|
|
117590
|
+
if (!path50.includes("{")) {
|
|
117543
117591
|
return void 0;
|
|
117544
117592
|
}
|
|
117545
|
-
const len =
|
|
117593
|
+
const len = path50.length;
|
|
117546
117594
|
let params;
|
|
117547
117595
|
let index = 1;
|
|
117548
117596
|
while (index < len) {
|
|
117549
117597
|
const segmentStart = index;
|
|
117550
|
-
const slashPos =
|
|
117598
|
+
const slashPos = path50.indexOf("/", index);
|
|
117551
117599
|
const segmentEnd = slashPos === -1 ? len : slashPos;
|
|
117552
|
-
if (segmentEnd > segmentStart &&
|
|
117600
|
+
if (segmentEnd > segmentStart && path50.charCodeAt(segmentStart) === 123 && path50.charCodeAt(segmentEnd - 1) === 125) {
|
|
117553
117601
|
let parameterStart = segmentStart + 1;
|
|
117554
117602
|
let allowsSlash = false;
|
|
117555
|
-
const operator =
|
|
117603
|
+
const operator = path50.charCodeAt(parameterStart);
|
|
117556
117604
|
if (operator === 43) {
|
|
117557
117605
|
allowsSlash = true;
|
|
117558
117606
|
parameterStart++;
|
|
117559
117607
|
}
|
|
117560
|
-
const parameterName =
|
|
117608
|
+
const parameterName = path50.slice(parameterStart, segmentEnd - 1);
|
|
117561
117609
|
if (PARAMETER_NAME_REGEX.test(parameterName)) {
|
|
117562
117610
|
params ??= [];
|
|
117563
117611
|
params.push({
|
|
117564
|
-
segment:
|
|
117612
|
+
segment: path50.slice(segmentStart, segmentEnd),
|
|
117565
117613
|
startIndex: segmentStart,
|
|
117566
117614
|
parameterName,
|
|
117567
117615
|
allowsSlash
|
|
@@ -117604,8 +117652,8 @@ openapi.method = (method) => ({
|
|
|
117604
117652
|
...openapi({ method }),
|
|
117605
117653
|
name: "~openapi/method"
|
|
117606
117654
|
});
|
|
117607
|
-
openapi.path = (
|
|
117608
|
-
...openapi({ path:
|
|
117655
|
+
openapi.path = (path50) => ({
|
|
117656
|
+
...openapi({ path: path50 }),
|
|
117609
117657
|
name: "~openapi/path"
|
|
117610
117658
|
});
|
|
117611
117659
|
openapi.spec = (spec) => ({
|
|
@@ -118466,22 +118514,22 @@ function visitJsonSchemaRefs(value2, visit2, schemaLevel = true, seen = /* @__PU
|
|
|
118466
118514
|
}
|
|
118467
118515
|
}
|
|
118468
118516
|
}
|
|
118469
|
-
function mapJsonSchemaRefs(value2, map2, schemaLevel = true,
|
|
118517
|
+
function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path50 = []) {
|
|
118470
118518
|
if (!value2 || typeof value2 !== "object") {
|
|
118471
118519
|
return value2;
|
|
118472
118520
|
}
|
|
118473
118521
|
if (Array.isArray(value2)) {
|
|
118474
|
-
return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...
|
|
118522
|
+
return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path50, index]));
|
|
118475
118523
|
}
|
|
118476
118524
|
const result = {};
|
|
118477
118525
|
for (const key of Object.keys(value2)) {
|
|
118478
118526
|
const val = value2[key];
|
|
118479
118527
|
if (key === "$ref" && typeof val === "string") {
|
|
118480
|
-
setOwn(result, key, map2(val, [...
|
|
118528
|
+
setOwn(result, key, map2(val, [...path50, key]));
|
|
118481
118529
|
} else if (!schemaLevel) {
|
|
118482
|
-
setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...
|
|
118530
|
+
setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path50, key]));
|
|
118483
118531
|
} else if (JSON_SCHEMA_LOGIC_KEYWORDS.has(key) || JSON_SCHEMA_RECORD_KEYWORDS.has(key)) {
|
|
118484
|
-
setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...
|
|
118532
|
+
setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path50, key]));
|
|
118485
118533
|
} else {
|
|
118486
118534
|
setOwn(result, key, val);
|
|
118487
118535
|
}
|
|
@@ -119011,7 +119059,7 @@ function unlazy(maybeLazy) {
|
|
|
119011
119059
|
function createProcedureClient(lazyableProcedure, ...rest) {
|
|
119012
119060
|
const options = resolveMaybeOptionalOptions(rest);
|
|
119013
119061
|
return async (...[input2, callerOptions]) => {
|
|
119014
|
-
const
|
|
119062
|
+
const path50 = toArray(options.path);
|
|
119015
119063
|
const { default: procedure } = await unlazy(lazyableProcedure);
|
|
119016
119064
|
const clientContext = callerOptions?.context ?? {};
|
|
119017
119065
|
const context = await value(options.context, clientContext) ?? {};
|
|
@@ -119024,7 +119072,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
119024
119072
|
};
|
|
119025
119073
|
try {
|
|
119026
119074
|
const output2 = await runWithSpan("call_procedure", (span) => {
|
|
119027
|
-
span?.setAttribute("procedure.path",
|
|
119075
|
+
span?.setAttribute("procedure.path", path50);
|
|
119028
119076
|
return intercept(
|
|
119029
119077
|
options.interceptors,
|
|
119030
119078
|
{
|
|
@@ -119032,7 +119080,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
119032
119080
|
// input can be optional if it is undefinable
|
|
119033
119081
|
input: input2,
|
|
119034
119082
|
errors,
|
|
119035
|
-
path:
|
|
119083
|
+
path: path50,
|
|
119036
119084
|
procedure,
|
|
119037
119085
|
signal: callerOptions?.signal,
|
|
119038
119086
|
lastEventId: callerOptions?.lastEventId
|
|
@@ -119283,10 +119331,10 @@ function augmentRouter(router, options) {
|
|
|
119283
119331
|
}
|
|
119284
119332
|
return enhanced;
|
|
119285
119333
|
}
|
|
119286
|
-
function getRouter(router,
|
|
119334
|
+
function getRouter(router, path50) {
|
|
119287
119335
|
let current = router;
|
|
119288
|
-
for (let i10 = 0; i10 <
|
|
119289
|
-
const segment =
|
|
119336
|
+
for (let i10 = 0; i10 < path50.length; i10++) {
|
|
119337
|
+
const segment = path50[i10];
|
|
119290
119338
|
if (!isTypescriptObject(current)) {
|
|
119291
119339
|
return void 0;
|
|
119292
119340
|
}
|
|
@@ -119298,7 +119346,7 @@ function getRouter(router, path48) {
|
|
|
119298
119346
|
continue;
|
|
119299
119347
|
}
|
|
119300
119348
|
const lazied = current;
|
|
119301
|
-
const rest =
|
|
119349
|
+
const rest = path50.slice(i10);
|
|
119302
119350
|
return new Lazy({
|
|
119303
119351
|
...lazied["~orpc"],
|
|
119304
119352
|
async loader() {
|
|
@@ -119313,40 +119361,40 @@ function getRouter(router, path48) {
|
|
|
119313
119361
|
}
|
|
119314
119362
|
return current;
|
|
119315
119363
|
}
|
|
119316
|
-
function walkProcedureContractsSync(router, callback,
|
|
119364
|
+
function walkProcedureContractsSync(router, callback, path50 = []) {
|
|
119317
119365
|
const lazyResults = [];
|
|
119318
|
-
walkProcedureContractsSyncInternal(router, callback,
|
|
119366
|
+
walkProcedureContractsSyncInternal(router, callback, path50.slice(), lazyResults);
|
|
119319
119367
|
return lazyResults;
|
|
119320
119368
|
}
|
|
119321
|
-
function walkProcedureContractsSyncInternal(router, callback,
|
|
119369
|
+
function walkProcedureContractsSyncInternal(router, callback, path50, lazyResults) {
|
|
119322
119370
|
const hiddenContract = getHiddenRouterContract(router);
|
|
119323
119371
|
if (hiddenContract !== void 0) {
|
|
119324
119372
|
router = hiddenContract;
|
|
119325
119373
|
}
|
|
119326
119374
|
if (router instanceof ProcedureContract) {
|
|
119327
|
-
callback(router,
|
|
119375
|
+
callback(router, path50.slice());
|
|
119328
119376
|
return;
|
|
119329
119377
|
}
|
|
119330
119378
|
if (!isTypescriptObject(router)) {
|
|
119331
119379
|
return;
|
|
119332
119380
|
}
|
|
119333
119381
|
for (const [key, value2] of Object.entries(router)) {
|
|
119334
|
-
|
|
119382
|
+
path50.push(key);
|
|
119335
119383
|
if (value2 instanceof Lazy) {
|
|
119336
|
-
lazyResults.push({ router: value2, path:
|
|
119384
|
+
lazyResults.push({ router: value2, path: path50.slice() });
|
|
119337
119385
|
} else {
|
|
119338
|
-
walkProcedureContractsSyncInternal(value2, callback,
|
|
119386
|
+
walkProcedureContractsSyncInternal(value2, callback, path50, lazyResults);
|
|
119339
119387
|
}
|
|
119340
|
-
|
|
119388
|
+
path50.pop();
|
|
119341
119389
|
}
|
|
119342
119390
|
}
|
|
119343
|
-
async function walkProcedureContractsAsync(router, callback,
|
|
119391
|
+
async function walkProcedureContractsAsync(router, callback, path50 = []) {
|
|
119344
119392
|
const hiddenContract = getHiddenRouterContract(router);
|
|
119345
119393
|
if (hiddenContract !== void 0) {
|
|
119346
119394
|
router = hiddenContract;
|
|
119347
119395
|
}
|
|
119348
119396
|
if (router instanceof ProcedureContract) {
|
|
119349
|
-
await callback(router,
|
|
119397
|
+
await callback(router, path50);
|
|
119350
119398
|
return;
|
|
119351
119399
|
}
|
|
119352
119400
|
if (!isTypescriptObject(router)) {
|
|
@@ -119355,9 +119403,9 @@ async function walkProcedureContractsAsync(router, callback, path48 = []) {
|
|
|
119355
119403
|
for (const [key, value2] of Object.entries(router)) {
|
|
119356
119404
|
if (value2 instanceof Lazy) {
|
|
119357
119405
|
const { default: router2 } = await unlazy(value2);
|
|
119358
|
-
await walkProcedureContractsAsync(router2, callback, [...
|
|
119406
|
+
await walkProcedureContractsAsync(router2, callback, [...path50, key]);
|
|
119359
119407
|
} else {
|
|
119360
|
-
await walkProcedureContractsAsync(value2, callback, [...
|
|
119408
|
+
await walkProcedureContractsAsync(value2, callback, [...path50, key]);
|
|
119361
119409
|
}
|
|
119362
119410
|
}
|
|
119363
119411
|
}
|
|
@@ -119843,18 +119891,18 @@ function rewriteComponentSchemaRefs(schema, renameMap) {
|
|
|
119843
119891
|
}
|
|
119844
119892
|
var OpenAPIGeneratorError = class extends TypeError {
|
|
119845
119893
|
};
|
|
119846
|
-
function toOpenAPIPath(
|
|
119894
|
+
function toOpenAPIPath(path50, dynamicPathParams) {
|
|
119847
119895
|
if (!dynamicPathParams?.length) {
|
|
119848
|
-
return
|
|
119896
|
+
return path50;
|
|
119849
119897
|
}
|
|
119850
119898
|
let normalized = "";
|
|
119851
119899
|
let currentIndex = 0;
|
|
119852
119900
|
for (const param of dynamicPathParams) {
|
|
119853
|
-
normalized +=
|
|
119901
|
+
normalized += path50.slice(currentIndex, param.startIndex);
|
|
119854
119902
|
normalized += `{${param.parameterName}}`;
|
|
119855
119903
|
currentIndex = param.startIndex + param.segment.length;
|
|
119856
119904
|
}
|
|
119857
|
-
normalized +=
|
|
119905
|
+
normalized += path50.slice(currentIndex);
|
|
119858
119906
|
return normalized;
|
|
119859
119907
|
}
|
|
119860
119908
|
function buildRequest(ctx, operation, def, meta3, dynamicPathParams) {
|
|
@@ -120288,8 +120336,8 @@ var OpenAPIGenerator = class {
|
|
|
120288
120336
|
customErrorResponseBodySchema: options.customErrorResponseBodySchema
|
|
120289
120337
|
};
|
|
120290
120338
|
const errors = [];
|
|
120291
|
-
await walkProcedureContractsAsync(router, (contract,
|
|
120292
|
-
if (value(options.filter, contract,
|
|
120339
|
+
await walkProcedureContractsAsync(router, (contract, path50) => {
|
|
120340
|
+
if (value(options.filter, contract, path50) === false) {
|
|
120293
120341
|
return;
|
|
120294
120342
|
}
|
|
120295
120343
|
try {
|
|
@@ -120301,7 +120349,7 @@ var OpenAPIGenerator = class {
|
|
|
120301
120349
|
`QUERY operations require OpenAPI 3.2, but version "${version2}" was requested.`
|
|
120302
120350
|
);
|
|
120303
120351
|
}
|
|
120304
|
-
const postPath = meta3?.path ?? pathToHttpPath(
|
|
120352
|
+
const postPath = meta3?.path ?? pathToHttpPath(path50);
|
|
120305
120353
|
const httpPath = meta3?.prefix ? mergeHttpPath(meta3.prefix, postPath) : postPath;
|
|
120306
120354
|
const dynamicPathParams = getDynamicPathParams(httpPath);
|
|
120307
120355
|
const openApiPath = toOpenAPIPath(httpPath, dynamicPathParams);
|
|
@@ -120310,7 +120358,7 @@ var OpenAPIGenerator = class {
|
|
|
120310
120358
|
operation = meta3.spec;
|
|
120311
120359
|
} else {
|
|
120312
120360
|
operation = {
|
|
120313
|
-
operationId: meta3?.operationId ??
|
|
120361
|
+
operationId: meta3?.operationId ?? path50.join("."),
|
|
120314
120362
|
summary: meta3?.summary,
|
|
120315
120363
|
description: meta3?.description,
|
|
120316
120364
|
deprecated: meta3?.deprecated,
|
|
@@ -120330,7 +120378,7 @@ var OpenAPIGenerator = class {
|
|
|
120330
120378
|
if (!(e14 instanceof OpenAPIGeneratorError)) {
|
|
120331
120379
|
throw e14;
|
|
120332
120380
|
}
|
|
120333
|
-
errors.push(`Procedure at ${
|
|
120381
|
+
errors.push(`Procedure at ${path50.join(".") || "(root)"}: ${e14.message}`);
|
|
120334
120382
|
}
|
|
120335
120383
|
});
|
|
120336
120384
|
if (errors.length) {
|
|
@@ -120562,7 +120610,7 @@ init_middleware();
|
|
|
120562
120610
|
init_preflight();
|
|
120563
120611
|
|
|
120564
120612
|
// src/frontdoor/controlSchemas.ts
|
|
120565
|
-
var
|
|
120613
|
+
var import_node_path41 = __toESM(require("node:path"), 1);
|
|
120566
120614
|
init_zod();
|
|
120567
120615
|
init_schema2();
|
|
120568
120616
|
|
|
@@ -120774,11 +120822,11 @@ var FrontDoorSessionsOutputSchema = external_exports.strictObject({ sessions: ex
|
|
|
120774
120822
|
var CheckRunInputSchema = external_exports.strictObject({
|
|
120775
120823
|
path: external_exports.string().min(1),
|
|
120776
120824
|
identity: external_exports.string().min(1).optional()
|
|
120777
|
-
}).refine((input2) =>
|
|
120825
|
+
}).refine((input2) => import_node_path41.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
120778
120826
|
var PoolPickInputSchema = external_exports.strictObject({
|
|
120779
120827
|
pool: external_exports.string().min(1),
|
|
120780
120828
|
path: external_exports.string().min(1)
|
|
120781
|
-
}).refine((input2) =>
|
|
120829
|
+
}).refine((input2) => import_node_path41.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
120782
120830
|
var DoctorFindingSchema = external_exports.strictObject({
|
|
120783
120831
|
section: external_exports.enum(DOCTOR_SECTIONS),
|
|
120784
120832
|
subject: external_exports.string().optional(),
|
|
@@ -121099,16 +121147,16 @@ var StandardLink = class {
|
|
|
121099
121147
|
/**
|
|
121100
121148
|
* @throws ORPCError, transport-level errors (network failures, timeouts, etc.)
|
|
121101
121149
|
*/
|
|
121102
|
-
call(
|
|
121103
|
-
return runWithSpan(`${ORPC_NAME}.${
|
|
121150
|
+
call(path50, input2, options) {
|
|
121151
|
+
return runWithSpan(`${ORPC_NAME}.${path50.join("/")}`, (span) => {
|
|
121104
121152
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
121105
|
-
span?.setAttribute("rpc.method",
|
|
121153
|
+
span?.setAttribute("rpc.method", path50.join("."));
|
|
121106
121154
|
if (getTracer() && isAsyncIteratorObject(input2)) {
|
|
121107
121155
|
input2 = override(input2, traceAsyncIterator("consume_async_iterator_object_input", input2));
|
|
121108
121156
|
} else if (getTracer() && input2 instanceof ReadableStream) {
|
|
121109
121157
|
input2 = override(input2, traceReadableStream("consume_octet_stream_input", input2));
|
|
121110
121158
|
}
|
|
121111
|
-
return intercept(this.interceptors, { ...options, path:
|
|
121159
|
+
return intercept(this.interceptors, { ...options, path: path50, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
|
|
121112
121160
|
const tracer = getTracer();
|
|
121113
121161
|
const activeSpan = tracer?.getActiveSpan() ?? span;
|
|
121114
121162
|
let request7 = await runWithSpan(
|
|
@@ -121165,18 +121213,18 @@ var RPCLinkCodec = class {
|
|
|
121165
121213
|
this.headers = options.headers ?? {};
|
|
121166
121214
|
this.serializer = options.serializer ?? new RPCSerializer();
|
|
121167
121215
|
}
|
|
121168
|
-
async encodeInput(input2,
|
|
121169
|
-
let headers = toResolvedStandardHeaders(await value(this.headers, options,
|
|
121216
|
+
async encodeInput(input2, path50, options) {
|
|
121217
|
+
let headers = toResolvedStandardHeaders(await value(this.headers, options, path50, input2));
|
|
121170
121218
|
if (options.lastEventId !== void 0) {
|
|
121171
121219
|
headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
|
|
121172
121220
|
}
|
|
121173
|
-
const expectedMethod = await value(this.expectedMethod, options,
|
|
121174
|
-
const baseUrl = await value(this.baseUrl, options,
|
|
121221
|
+
const expectedMethod = await value(this.expectedMethod, options, path50, input2);
|
|
121222
|
+
const baseUrl = await value(this.baseUrl, options, path50, input2);
|
|
121175
121223
|
const [pathname, search, hash2] = parseStandardUrl(baseUrl);
|
|
121176
|
-
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(
|
|
121224
|
+
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path50)}`;
|
|
121177
121225
|
const serialized = this.serializer.serialize(input2);
|
|
121178
121226
|
if (expectedMethod === "GET" && !(serialized instanceof Blob) && !(serialized instanceof ReadableStream) && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
|
|
121179
|
-
const maxUrlLength = await value(this.maxUrlLength, options,
|
|
121227
|
+
const maxUrlLength = await value(this.maxUrlLength, options, path50, input2);
|
|
121180
121228
|
const mergedSearch = new URLSearchParams(search);
|
|
121181
121229
|
mergedSearch.append("data", stringifyJSON(serialized) ?? "");
|
|
121182
121230
|
const url22 = `${newPathname}?${mergedSearch}${hash2 ?? ""}`;
|
|
@@ -121261,8 +121309,8 @@ var FetchLinkTransport = class {
|
|
|
121261
121309
|
this.fetch = options.fetch ?? ((url2, init) => globalThis.fetch(url2, init));
|
|
121262
121310
|
this.toFetchRequestOptions = options.toFetchRequest;
|
|
121263
121311
|
}
|
|
121264
|
-
async send(standardRequest,
|
|
121265
|
-
let origin = await value(this.origin, options,
|
|
121312
|
+
async send(standardRequest, path50, options) {
|
|
121313
|
+
let origin = await value(this.origin, options, path50);
|
|
121266
121314
|
if (origin?.endsWith("/")) {
|
|
121267
121315
|
origin = origin.slice(0, -1);
|
|
121268
121316
|
}
|
|
@@ -121282,7 +121330,7 @@ var FetchLinkTransport = class {
|
|
|
121282
121330
|
}
|
|
121283
121331
|
}
|
|
121284
121332
|
const fetch3 = this.fetch;
|
|
121285
|
-
const response = await fetch3(url2, init, options,
|
|
121333
|
+
const response = await fetch3(url2, init, options, path50);
|
|
121286
121334
|
const standardResponse = toStandardLazyResponse(response);
|
|
121287
121335
|
return standardResponse;
|
|
121288
121336
|
}
|
|
@@ -121673,14 +121721,14 @@ var StandardHandler = class {
|
|
|
121673
121721
|
span?.setAttribute("url.path", request22.url);
|
|
121674
121722
|
return { matched: false };
|
|
121675
121723
|
}
|
|
121676
|
-
const { path:
|
|
121677
|
-
span?.updateName(`${ORPC_NAME}.${
|
|
121724
|
+
const { path: path50, procedure, decodeInput } = matchedOrNot;
|
|
121725
|
+
span?.updateName(`${ORPC_NAME}.${path50.join("/")}`);
|
|
121678
121726
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
121679
|
-
span?.setAttribute("rpc.method",
|
|
121727
|
+
span?.setAttribute("rpc.method", path50.join("."));
|
|
121680
121728
|
try {
|
|
121681
121729
|
const response = await intercept(
|
|
121682
121730
|
this.interceptors,
|
|
121683
|
-
{ context: context2, prefix: prefix2, request: request22, path:
|
|
121731
|
+
{ context: context2, prefix: prefix2, request: request22, path: path50, procedure, decodeInput },
|
|
121684
121732
|
async ({ context: context3, prefix: prefix3, request: request32, path: path210, procedure: procedure2, decodeInput: decodeInput2 }) => {
|
|
121685
121733
|
step2 = "decode_input";
|
|
121686
121734
|
let input2 = await runWithSpan("decode_input", decodeInput2);
|
|
@@ -121714,7 +121762,7 @@ var StandardHandler = class {
|
|
|
121714
121762
|
message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
|
|
121715
121763
|
cause: e14
|
|
121716
121764
|
}) : toORPCError(e14);
|
|
121717
|
-
const response = await this.codec.encodeError(error63, procedure,
|
|
121765
|
+
const response = await this.codec.encodeError(error63, procedure, path50, { context: context2, prefix: prefix2 });
|
|
121718
121766
|
return { matched: true, response };
|
|
121719
121767
|
}
|
|
121720
121768
|
}
|
|
@@ -121820,7 +121868,7 @@ var RPCMatcher = class {
|
|
|
121820
121868
|
this.rootRouter = router;
|
|
121821
121869
|
this.index(router);
|
|
121822
121870
|
}
|
|
121823
|
-
index(router,
|
|
121871
|
+
index(router, path50 = []) {
|
|
121824
121872
|
const lazyResults = walkProcedureContractsSync(router, (procedure, procedurePath) => {
|
|
121825
121873
|
if (!value(this.filter, procedure, procedurePath)) {
|
|
121826
121874
|
return;
|
|
@@ -121831,7 +121879,7 @@ var RPCMatcher = class {
|
|
|
121831
121879
|
// contract-first entries have no implementation yet, resolveProcedure fills it in on demand
|
|
121832
121880
|
procedure: procedure instanceof Procedure ? procedure : void 0
|
|
121833
121881
|
});
|
|
121834
|
-
},
|
|
121882
|
+
}, path50);
|
|
121835
121883
|
for (const result of lazyResults) {
|
|
121836
121884
|
this.pendingLazyRouters.set(pathToHttpPath(result.path), result);
|
|
121837
121885
|
}
|
|
@@ -121963,10 +122011,10 @@ var RPCHandlerCodec = class {
|
|
|
121963
122011
|
}
|
|
121964
122012
|
};
|
|
121965
122013
|
}
|
|
121966
|
-
encodeOutput(output2, procedure,
|
|
122014
|
+
encodeOutput(output2, procedure, path50, options) {
|
|
121967
122015
|
return {
|
|
121968
122016
|
headers: {},
|
|
121969
|
-
status: value(this.outputStatus, output2, procedure,
|
|
122017
|
+
status: value(this.outputStatus, output2, procedure, path50, options) ?? DEFAULT_SUCCESS_STATUS,
|
|
121970
122018
|
body: this.serializer.serialize(output2)
|
|
121971
122019
|
};
|
|
121972
122020
|
}
|
|
@@ -122020,39 +122068,39 @@ function createRouter() {
|
|
|
122020
122068
|
static: new NullProtoObj2()
|
|
122021
122069
|
};
|
|
122022
122070
|
}
|
|
122023
|
-
function scanFirstGroup(
|
|
122071
|
+
function scanFirstGroup(path50) {
|
|
122024
122072
|
let i10 = 0;
|
|
122025
122073
|
let depth = 0;
|
|
122026
|
-
for (; i10 <
|
|
122027
|
-
const c10 =
|
|
122074
|
+
for (; i10 < path50.length; i10++) {
|
|
122075
|
+
const c10 = path50.charCodeAt(i10);
|
|
122028
122076
|
if (c10 === 92) i10++;
|
|
122029
122077
|
else if (c10 === 40) depth++;
|
|
122030
122078
|
else if (c10 === 41 && depth > 0) depth--;
|
|
122031
122079
|
else if (c10 === 123 && depth === 0) break;
|
|
122032
122080
|
}
|
|
122033
|
-
if (i10 >=
|
|
122081
|
+
if (i10 >= path50.length) return;
|
|
122034
122082
|
let j10 = i10 + 1;
|
|
122035
122083
|
depth = 0;
|
|
122036
|
-
for (; j10 <
|
|
122037
|
-
const c10 =
|
|
122084
|
+
for (; j10 < path50.length; j10++) {
|
|
122085
|
+
const c10 = path50.charCodeAt(j10);
|
|
122038
122086
|
if (c10 === 92) j10++;
|
|
122039
122087
|
else if (c10 === 40) depth++;
|
|
122040
122088
|
else if (c10 === 41 && depth > 0) depth--;
|
|
122041
122089
|
else if (c10 === 125 && depth === 0) break;
|
|
122042
122090
|
}
|
|
122043
|
-
if (j10 >=
|
|
122044
|
-
const mod =
|
|
122091
|
+
if (j10 >= path50.length) return;
|
|
122092
|
+
const mod = path50[j10 + 1];
|
|
122045
122093
|
const hasMod = mod === "?" || mod === "+" || mod === "*";
|
|
122046
122094
|
return [
|
|
122047
|
-
|
|
122048
|
-
|
|
122049
|
-
|
|
122095
|
+
path50.slice(0, i10),
|
|
122096
|
+
path50.slice(i10 + 1, j10),
|
|
122097
|
+
path50.slice(j10 + (hasMod ? 2 : 1)),
|
|
122050
122098
|
hasMod ? mod : void 0
|
|
122051
122099
|
];
|
|
122052
122100
|
}
|
|
122053
|
-
function expandGroupDelimiters(
|
|
122054
|
-
if (!
|
|
122055
|
-
const group = scanFirstGroup(
|
|
122101
|
+
function expandGroupDelimiters(path50) {
|
|
122102
|
+
if (!path50.includes("{")) return;
|
|
122103
|
+
const group = scanFirstGroup(path50);
|
|
122056
122104
|
if (!group) return;
|
|
122057
122105
|
const [pre2, body, suf, mod] = group;
|
|
122058
122106
|
if (!mod) return [pre2 + body + suf];
|
|
@@ -122122,9 +122170,9 @@ function replaceSegmentWildcards(segment, unnamedStart, toGroupKey = toUnnamedGr
|
|
|
122122
122170
|
}
|
|
122123
122171
|
return [replaced, nextIndex];
|
|
122124
122172
|
}
|
|
122125
|
-
function encodeEscapes(
|
|
122126
|
-
if (!
|
|
122127
|
-
return
|
|
122173
|
+
function encodeEscapes(path50) {
|
|
122174
|
+
if (!path50.includes("\\")) return path50;
|
|
122175
|
+
return path50.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
|
|
122128
122176
|
}
|
|
122129
122177
|
function segmentKey(segment) {
|
|
122130
122178
|
if (segment.startsWith("**")) return 2;
|
|
@@ -122153,22 +122201,22 @@ function expandModifiers(segments) {
|
|
|
122153
122201
|
return m10[2] === "+" ? [wc2] : [wc2, without];
|
|
122154
122202
|
}
|
|
122155
122203
|
}
|
|
122156
|
-
function normalizePath(
|
|
122157
|
-
if (!
|
|
122204
|
+
function normalizePath(path50) {
|
|
122205
|
+
if (!path50.includes("/.")) return path50;
|
|
122158
122206
|
const r10 = [];
|
|
122159
|
-
for (const s of
|
|
122207
|
+
for (const s of path50.split("/")) if (s === ".") continue;
|
|
122160
122208
|
else if (s === ".." && r10.length > 1) r10.pop();
|
|
122161
122209
|
else r10.push(s);
|
|
122162
122210
|
return r10.join("/") || "/";
|
|
122163
122211
|
}
|
|
122164
|
-
function splitPath(
|
|
122165
|
-
const s =
|
|
122212
|
+
function splitPath(path50) {
|
|
122213
|
+
const s = path50.split("/");
|
|
122166
122214
|
s.shift();
|
|
122167
122215
|
if (s[s.length - 1] === "") s.pop();
|
|
122168
122216
|
return s;
|
|
122169
122217
|
}
|
|
122170
|
-
function splitRoute(
|
|
122171
|
-
const s = splitPath(
|
|
122218
|
+
function splitRoute(path50) {
|
|
122219
|
+
const s = splitPath(path50);
|
|
122172
122220
|
while (s[s.length - 1] === "") s.pop();
|
|
122173
122221
|
return s;
|
|
122174
122222
|
}
|
|
@@ -122184,16 +122232,16 @@ function getMatchParams(segments, paramsMap) {
|
|
|
122184
122232
|
}
|
|
122185
122233
|
return params;
|
|
122186
122234
|
}
|
|
122187
|
-
function addRoute(ctx, method = "",
|
|
122235
|
+
function addRoute(ctx, method = "", path50, data) {
|
|
122188
122236
|
method = method.toUpperCase();
|
|
122189
|
-
if (
|
|
122190
|
-
const groupExpanded = expandGroupDelimiters(
|
|
122237
|
+
if (path50.charCodeAt(0) !== 47) path50 = `/${path50}`;
|
|
122238
|
+
const groupExpanded = expandGroupDelimiters(path50);
|
|
122191
122239
|
if (groupExpanded) {
|
|
122192
122240
|
for (const expandedPath of groupExpanded) addRoute(ctx, method, expandedPath, data);
|
|
122193
122241
|
return;
|
|
122194
122242
|
}
|
|
122195
|
-
|
|
122196
|
-
const segments = splitRoute(
|
|
122243
|
+
path50 = encodeEscapes(path50);
|
|
122244
|
+
const segments = splitRoute(path50);
|
|
122197
122245
|
const expanded = expandModifiers(segments);
|
|
122198
122246
|
if (expanded) {
|
|
122199
122247
|
for (const p of expanded) addRoute(ctx, method, p, data);
|
|
@@ -122284,15 +122332,15 @@ function getParamRegexp(segment, unnamedStart = 0) {
|
|
|
122284
122332
|
const regex = _s2.replace(/:([\w-]+)(?:\(([^)]*)\))?/g, (_, id2, p) => `(?<${toGroupName(id2)}>${p || "[^/]+"})`).replace(/\((?![?<])/g, () => `(?<${toUnnamedGroupKey(_i2++)}>`).replace(/\uFFFE(.)/g, (_, c10) => /[.*+?^${}()|[\]\\]/.test(c10) ? `\\${c10}` : c10);
|
|
122285
122333
|
return [new RegExp(`^${regex}$`), _i2];
|
|
122286
122334
|
}
|
|
122287
|
-
function findRoute(ctx, method = "",
|
|
122288
|
-
if (opts?.normalize)
|
|
122289
|
-
if (
|
|
122290
|
-
const staticNode = ctx.static[
|
|
122335
|
+
function findRoute(ctx, method = "", path50, opts) {
|
|
122336
|
+
if (opts?.normalize) path50 = normalizePath(path50);
|
|
122337
|
+
if (path50.charCodeAt(path50.length - 1) === 47) path50 = path50.slice(0, -1);
|
|
122338
|
+
const staticNode = ctx.static[path50];
|
|
122291
122339
|
if (staticNode && staticNode.methods) {
|
|
122292
122340
|
const staticMatch = staticNode.methods[method] || staticNode.methods[""];
|
|
122293
122341
|
if (staticMatch !== void 0) return staticMatch[0];
|
|
122294
122342
|
}
|
|
122295
|
-
const segments = splitPath(
|
|
122343
|
+
const segments = splitPath(path50);
|
|
122296
122344
|
const match = _lookupTree(ctx.root, method, segments, 0);
|
|
122297
122345
|
if (match === void 0) return;
|
|
122298
122346
|
if (opts?.params === false) return match;
|
|
@@ -122492,7 +122540,7 @@ var OpenAPIMatcher = class {
|
|
|
122492
122540
|
this.rootRouter = router;
|
|
122493
122541
|
this.index(router);
|
|
122494
122542
|
}
|
|
122495
|
-
index(router,
|
|
122543
|
+
index(router, path50 = []) {
|
|
122496
122544
|
const lazyResults = walkProcedureContractsSync(router, (contract, path210) => {
|
|
122497
122545
|
if (!value(this.filter, contract, path210)) {
|
|
122498
122546
|
return;
|
|
@@ -122507,7 +122555,7 @@ var OpenAPIMatcher = class {
|
|
|
122507
122555
|
contract,
|
|
122508
122556
|
procedure: contract instanceof Procedure ? contract : void 0
|
|
122509
122557
|
});
|
|
122510
|
-
},
|
|
122558
|
+
}, path50);
|
|
122511
122559
|
for (const result of lazyResults) {
|
|
122512
122560
|
const prefix = getOpenAPIMeta(result.router)?.prefix;
|
|
122513
122561
|
this.pendingLazyRouters.add({
|
|
@@ -122594,20 +122642,20 @@ var OpenAPIMatcher = class {
|
|
|
122594
122642
|
return entry.procedure;
|
|
122595
122643
|
}
|
|
122596
122644
|
};
|
|
122597
|
-
function toRou3Pattern(
|
|
122598
|
-
const params = getDynamicPathParams(
|
|
122645
|
+
function toRou3Pattern(path50) {
|
|
122646
|
+
const params = getDynamicPathParams(path50);
|
|
122599
122647
|
if (!params?.length) {
|
|
122600
|
-
return
|
|
122648
|
+
return path50;
|
|
122601
122649
|
}
|
|
122602
122650
|
for (let i10 = params.length - 1; i10 >= 0; i10--) {
|
|
122603
122651
|
const param = params[i10];
|
|
122604
122652
|
const pattern = param.allowsSlash ? `**:${param.parameterName}` : `:${param.parameterName}`;
|
|
122605
|
-
|
|
122653
|
+
path50 = path50.slice(0, param.startIndex) + pattern + path50.slice(param.startIndex + param.segment.length);
|
|
122606
122654
|
}
|
|
122607
|
-
return
|
|
122655
|
+
return path50;
|
|
122608
122656
|
}
|
|
122609
|
-
function toRou3PrefixMatcher(
|
|
122610
|
-
const pattern = toRou3Pattern(
|
|
122657
|
+
function toRou3PrefixMatcher(path50) {
|
|
122658
|
+
const pattern = toRou3Pattern(path50);
|
|
122611
122659
|
return routeToRegExp(pattern === "/" ? "/**" : `${pattern}/**`);
|
|
122612
122660
|
}
|
|
122613
122661
|
function decodeParams(params) {
|
|
@@ -122686,7 +122734,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
122686
122734
|
/**
|
|
122687
122735
|
* @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
|
|
122688
122736
|
*/
|
|
122689
|
-
encodeOutput(output2, procedure,
|
|
122737
|
+
encodeOutput(output2, procedure, path50) {
|
|
122690
122738
|
const meta3 = getOpenAPIMeta(procedure);
|
|
122691
122739
|
const successStatus = meta3?.successStatus ?? DEFAULT_SUCCESS_STATUS;
|
|
122692
122740
|
const outputStructure = meta3?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
|
|
@@ -122699,7 +122747,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
122699
122747
|
}
|
|
122700
122748
|
if (!isValidDetailedOutput(output2)) {
|
|
122701
122749
|
throw new TypeError(`
|
|
122702
|
-
Invalid "detailed" output structure returned by procedure (${
|
|
122750
|
+
Invalid "detailed" output structure returned by procedure (${path50.join(".")}):
|
|
122703
122751
|
\u2022 Expected an object with optional properties:
|
|
122704
122752
|
- status (number <400)
|
|
122705
122753
|
- headers (object)
|
|
@@ -123247,7 +123295,7 @@ function profileValue(name, paths) {
|
|
|
123247
123295
|
function createConfigApiRouter(deps) {
|
|
123248
123296
|
const authed = doorApiAuth(deps.expectedToken);
|
|
123249
123297
|
const { paths } = deps;
|
|
123250
|
-
const route = (
|
|
123298
|
+
const route = (path50, summary) => authed.meta(openapi({ method: "POST", path: path50, summary, tags: [CONFIG_API_TAG] }));
|
|
123251
123299
|
return {
|
|
123252
123300
|
config: {
|
|
123253
123301
|
identity: {
|
|
@@ -123597,7 +123645,7 @@ function createLifecycleApiRouter(deps) {
|
|
|
123597
123645
|
init_cliError();
|
|
123598
123646
|
|
|
123599
123647
|
// src/frontdoor/launchSchemas.ts
|
|
123600
|
-
var
|
|
123648
|
+
var import_node_path42 = __toESM(require("node:path"), 1);
|
|
123601
123649
|
init_zod();
|
|
123602
123650
|
init_claudeVersion();
|
|
123603
123651
|
init_identity();
|
|
@@ -123607,7 +123655,7 @@ var LaunchResolveInputSchema = external_exports.strictObject({
|
|
|
123607
123655
|
argv: external_exports.readonly(external_exports.array(external_exports.string())).optional(),
|
|
123608
123656
|
/** 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. */
|
|
123609
123657
|
env: external_exports.record(external_exports.string(), external_exports.string()).optional()
|
|
123610
|
-
}).refine((input2) =>
|
|
123658
|
+
}).refine((input2) => import_node_path42.default.isAbsolute(input2.path), { message: "path must be absolute: the door cannot resolve a relative path against the caller's working directory" });
|
|
123611
123659
|
var LaunchPoolDecisionSchema = external_exports.strictObject({
|
|
123612
123660
|
name: external_exports.string(),
|
|
123613
123661
|
reasons: external_exports.readonly(external_exports.array(external_exports.string())),
|
|
@@ -125097,8 +125145,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
|
|
|
125097
125145
|
request7.body.resume();
|
|
125098
125146
|
return;
|
|
125099
125147
|
}
|
|
125100
|
-
const
|
|
125101
|
-
const translated = { method: request7.method, path:
|
|
125148
|
+
const path50 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
125149
|
+
const translated = { method: request7.method, path: path50, body, signal: request7.signal };
|
|
125102
125150
|
const routed = await route(translated);
|
|
125103
125151
|
if (request7.signal.aborted) {
|
|
125104
125152
|
return;
|
|
@@ -125132,7 +125180,7 @@ function createPassthroughRoute(name, target) {
|
|
|
125132
125180
|
headroomUpstream: target.headroomUpstream,
|
|
125133
125181
|
serve: async (request7, response) => {
|
|
125134
125182
|
const incoming = new URL(request7.url, "http://127.0.0.1");
|
|
125135
|
-
const
|
|
125183
|
+
const path50 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
|
|
125136
125184
|
const headers = forwardableHeaders(request7.headers);
|
|
125137
125185
|
delete headers.host;
|
|
125138
125186
|
await new Promise((resolve2) => {
|
|
@@ -125140,7 +125188,7 @@ function createPassthroughRoute(name, target) {
|
|
|
125140
125188
|
host: base.hostname,
|
|
125141
125189
|
port: base.port === "" ? void 0 : Number(base.port),
|
|
125142
125190
|
method: request7.method,
|
|
125143
|
-
path: `${basePath}${
|
|
125191
|
+
path: `${basePath}${path50}${incoming.search}`,
|
|
125144
125192
|
headers,
|
|
125145
125193
|
agent
|
|
125146
125194
|
};
|
|
@@ -125273,7 +125321,7 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
125273
125321
|
|
|
125274
125322
|
// src/frontdoor/providerRoute.ts
|
|
125275
125323
|
function createProviderRouteResolver(deps) {
|
|
125276
|
-
const isRcSelfHostPath = (
|
|
125324
|
+
const isRcSelfHostPath = (path50) => path50 === "/v1/code/sessions" || path50.startsWith("/v1/code/sessions/") || path50 === "/v1/sessions" || path50.startsWith("/v1/sessions/");
|
|
125277
125325
|
const oauthRoute = createPassthroughRoute("anthropic", { baseUrl: `https://${CONNECT_INTERCEPT_HOST}:${String(HTTPS_PORT)}`, stripPrefix: void 0, headroomUpstream: void 0 });
|
|
125278
125326
|
const passthroughByTarget = /* @__PURE__ */ new Map();
|
|
125279
125327
|
const passthroughFor = (name, target) => {
|
|
@@ -125287,16 +125335,16 @@ function createProviderRouteResolver(deps) {
|
|
|
125287
125335
|
return route;
|
|
125288
125336
|
};
|
|
125289
125337
|
const resolve2 = (request7) => {
|
|
125290
|
-
const
|
|
125291
|
-
const scoped = parseProviderPath(
|
|
125338
|
+
const path50 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
125339
|
+
const scoped = parseProviderPath(path50);
|
|
125292
125340
|
if (scoped === void 0) {
|
|
125293
|
-
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(
|
|
125341
|
+
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path50)) {
|
|
125294
125342
|
return { ok: true, route: deps.rcSelfHostRoute };
|
|
125295
125343
|
}
|
|
125296
|
-
if (request7.session.provider !== void 0 &&
|
|
125344
|
+
if (request7.session.provider !== void 0 && path50.startsWith("/v1/") && !isRcSelfHostPath(path50)) {
|
|
125297
125345
|
return resolve2({ ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` });
|
|
125298
125346
|
}
|
|
125299
|
-
return
|
|
125347
|
+
return path50.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path50}` };
|
|
125300
125348
|
}
|
|
125301
125349
|
const { provider } = scoped;
|
|
125302
125350
|
let definition;
|
|
@@ -125349,8 +125397,8 @@ function createProviderRouteResolver(deps) {
|
|
|
125349
125397
|
let replay;
|
|
125350
125398
|
const visited = /* @__PURE__ */ new Set();
|
|
125351
125399
|
for (; ; ) {
|
|
125352
|
-
const
|
|
125353
|
-
const scoped = parseProviderPath(
|
|
125400
|
+
const path50 = new URL(current.url, "http://127.0.0.1").pathname;
|
|
125401
|
+
const scoped = parseProviderPath(path50);
|
|
125354
125402
|
const providerName = scoped?.provider ?? current.session.provider;
|
|
125355
125403
|
if (providerName !== void 0 && visited.has(providerName)) {
|
|
125356
125404
|
return { ok: false, status: HTTP_STATUS.internalServerError, message: `provider routing cycle: ${[...visited, providerName].join(" -> ")}` };
|
|
@@ -125408,7 +125456,7 @@ function createProviderRouteResolver(deps) {
|
|
|
125408
125456
|
const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
|
|
125409
125457
|
replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
|
|
125410
125458
|
}
|
|
125411
|
-
const rest = scoped === void 0 ?
|
|
125459
|
+
const rest = scoped === void 0 ? path50 : path50.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
|
|
125412
125460
|
const query = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
|
|
125413
125461
|
current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(matched.provider)}${rest}${query}`, body: replay.body, headers: replay.headers };
|
|
125414
125462
|
}
|
|
@@ -125515,7 +125563,7 @@ function createRcLiveUsage(deps) {
|
|
|
125515
125563
|
}
|
|
125516
125564
|
|
|
125517
125565
|
// src/frontdoor/rcSelfHostMint.ts
|
|
125518
|
-
var
|
|
125566
|
+
var import_node_path43 = __toESM(require("node:path"), 1);
|
|
125519
125567
|
init_account();
|
|
125520
125568
|
|
|
125521
125569
|
// src/frontdoor/rcSelfHostLocal.ts
|
|
@@ -125622,7 +125670,7 @@ function createRcSelfHostLocal(deps) {
|
|
|
125622
125670
|
}
|
|
125623
125671
|
|
|
125624
125672
|
// src/frontdoor/rcSelfHostMint.ts
|
|
125625
|
-
var
|
|
125673
|
+
var CREDENTIALS_FILE2 = ".credentials.json";
|
|
125626
125674
|
var CLAUDE_JSON2 = ".claude.json";
|
|
125627
125675
|
var RC_SELF_HOST_RECORD_DIR = "rc-selfhost";
|
|
125628
125676
|
var RC_SELF_HOST_RECORD_FILE = "credential.json";
|
|
@@ -125645,7 +125693,7 @@ function readJsonObject(fs21, file2) {
|
|
|
125645
125693
|
return isRecord7(parsed) ? parsed : void 0;
|
|
125646
125694
|
}
|
|
125647
125695
|
function readRcSelfHostRecord(fs21, frontdoorDir) {
|
|
125648
|
-
const parsed = readJsonObject(fs21,
|
|
125696
|
+
const parsed = readJsonObject(fs21, import_node_path43.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
|
|
125649
125697
|
if (parsed === void 0) {
|
|
125650
125698
|
return void 0;
|
|
125651
125699
|
}
|
|
@@ -125659,11 +125707,11 @@ function mintRcSelfHostCredential(deps) {
|
|
|
125659
125707
|
if (!isIdentityName(deps.identity)) {
|
|
125660
125708
|
throw new Error(`"${deps.identity}" is not a valid identity name.`);
|
|
125661
125709
|
}
|
|
125662
|
-
const identityDir =
|
|
125663
|
-
const credentialsFile =
|
|
125664
|
-
const claudeJsonFile =
|
|
125665
|
-
const recordDir =
|
|
125666
|
-
const recordFile =
|
|
125710
|
+
const identityDir = import_node_path43.default.join(deps.identitiesDir, deps.identity);
|
|
125711
|
+
const credentialsFile = import_node_path43.default.join(identityDir, CREDENTIALS_FILE2);
|
|
125712
|
+
const claudeJsonFile = import_node_path43.default.join(identityDir, CLAUDE_JSON2);
|
|
125713
|
+
const recordDir = import_node_path43.default.join(deps.frontdoorDir, RC_SELF_HOST_RECORD_DIR);
|
|
125714
|
+
const recordFile = import_node_path43.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
|
|
125667
125715
|
const previousRecord = readRcSelfHostRecord(deps.fs, deps.frontdoorDir);
|
|
125668
125716
|
const existingCredentials = readJsonObject(deps.fs, credentialsFile);
|
|
125669
125717
|
const existingOauth = isRecord7(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
|
|
@@ -125679,7 +125727,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
125679
125727
|
const organizationUuid = deps.newUuid();
|
|
125680
125728
|
const accountUuid = deps.newUuid();
|
|
125681
125729
|
const mintedAt = new Date(deps.now()).toISOString();
|
|
125682
|
-
deps.fs.mkdirPrivate(
|
|
125730
|
+
deps.fs.mkdirPrivate(import_node_path43.default.dirname(credentialsFile));
|
|
125683
125731
|
deps.fs.writeFilePrivate(credentialsFile, `${JSON.stringify({ ...existingCredentials, claudeAiOauth: { accessToken, refreshToken, expiresAt: null, scopes: [...RC_SELF_HOST_SCOPE_LIST], subscriptionType: SELF_HOST_SUBSCRIPTION_TYPE, rateLimitTier: null } }, null, 2)}
|
|
125684
125732
|
`);
|
|
125685
125733
|
const claudeJson = readJsonObject(deps.fs, claudeJsonFile) ?? {};
|
|
@@ -126066,7 +126114,7 @@ function registerRcCommand(frontdoor, paths) {
|
|
|
126066
126114
|
}
|
|
126067
126115
|
|
|
126068
126116
|
// src/frontdoor/rcCredentialStore.ts
|
|
126069
|
-
var
|
|
126117
|
+
var import_node_path44 = __toESM(require("node:path"), 1);
|
|
126070
126118
|
function isSafeSessionId(sessionId) {
|
|
126071
126119
|
return /^[A-Za-z0-9_-]+$/.test(sessionId);
|
|
126072
126120
|
}
|
|
@@ -126092,7 +126140,7 @@ function sequenceNumOfJson(value2) {
|
|
|
126092
126140
|
}
|
|
126093
126141
|
function createRcCredentialStore(fs21, dir) {
|
|
126094
126142
|
fs21.mkdirPrivate(dir);
|
|
126095
|
-
const fileFor = (sessionId) =>
|
|
126143
|
+
const fileFor = (sessionId) => import_node_path44.default.join(dir, `${sessionId}.json`);
|
|
126096
126144
|
const readParsed = (sessionId) => {
|
|
126097
126145
|
const raw = fs21.readFileUtf8(fileFor(sessionId));
|
|
126098
126146
|
if (raw === void 0) {
|
|
@@ -128516,7 +128564,7 @@ function realFrontDoorSupervisorPorts(paths) {
|
|
|
128516
128564
|
const leafFor = createLeafCache(loadCa(), () => /* @__PURE__ */ new Date());
|
|
128517
128565
|
const capture = captureFromEnv(process.env, paths.logsDir);
|
|
128518
128566
|
if (capture !== void 0) {
|
|
128519
|
-
log(`capture enabled, recording CONNECT targets and piped exchanges to ${
|
|
128567
|
+
log(`capture enabled, recording CONNECT targets and piped exchanges to ${import_node_path45.default.join(paths.logsDir, "frontdoor-capture.jsonl")}`);
|
|
128520
128568
|
}
|
|
128521
128569
|
if (rcSelfHostSurface !== void 0) {
|
|
128522
128570
|
log("self-hosted Remote Control surface on: the door serves the CCR session family itself, and its own client-half dials its own transparent surface");
|
|
@@ -130652,8 +130700,8 @@ function getErrorMap2() {
|
|
|
130652
130700
|
|
|
130653
130701
|
// node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/helpers/parseUtil.js
|
|
130654
130702
|
var makeIssue = (params) => {
|
|
130655
|
-
const { data, path:
|
|
130656
|
-
const fullPath = [...
|
|
130703
|
+
const { data, path: path50, errorMaps, issueData } = params;
|
|
130704
|
+
const fullPath = [...path50, ...issueData.path || []];
|
|
130657
130705
|
const fullIssue = {
|
|
130658
130706
|
...issueData,
|
|
130659
130707
|
path: fullPath
|
|
@@ -130768,11 +130816,11 @@ var errorUtil;
|
|
|
130768
130816
|
|
|
130769
130817
|
// node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/types.js
|
|
130770
130818
|
var ParseInputLazyPath = class {
|
|
130771
|
-
constructor(parent, value2,
|
|
130819
|
+
constructor(parent, value2, path50, key) {
|
|
130772
130820
|
this._cachedPath = [];
|
|
130773
130821
|
this.parent = parent;
|
|
130774
130822
|
this.data = value2;
|
|
130775
|
-
this._path =
|
|
130823
|
+
this._path = path50;
|
|
130776
130824
|
this._key = key;
|
|
130777
130825
|
}
|
|
130778
130826
|
get path() {
|
|
@@ -134335,11 +134383,11 @@ function normalizeObjectSchema(schema) {
|
|
|
134335
134383
|
}
|
|
134336
134384
|
return void 0;
|
|
134337
134385
|
}
|
|
134338
|
-
function getDotPath(
|
|
134339
|
-
if (
|
|
134386
|
+
function getDotPath(path50) {
|
|
134387
|
+
if (path50.length === 0) {
|
|
134340
134388
|
return "object root";
|
|
134341
134389
|
}
|
|
134342
|
-
return
|
|
134390
|
+
return path50.reduce((acc, seg, index) => {
|
|
134343
134391
|
if (index === 0) {
|
|
134344
134392
|
return String(seg);
|
|
134345
134393
|
}
|
|
@@ -138636,16 +138684,16 @@ init_credentialCache();
|
|
|
138636
138684
|
|
|
138637
138685
|
// src/identityToken.ts
|
|
138638
138686
|
var import_node_fs17 = __toESM(require("node:fs"), 1);
|
|
138639
|
-
var
|
|
138687
|
+
var import_node_path46 = __toESM(require("node:path"), 1);
|
|
138640
138688
|
init_cliError();
|
|
138641
138689
|
var TOKEN_FILE_MODE = 384;
|
|
138642
138690
|
var TOKEN_DIR_MODE = 448;
|
|
138643
138691
|
var OAUTH_TOKEN_RE = /^sk-ant-oat\d+-[A-Za-z0-9_-]+$/;
|
|
138644
138692
|
function identityTokenDir(paths) {
|
|
138645
|
-
return
|
|
138693
|
+
return import_node_path46.default.join(paths.root, "credentials");
|
|
138646
138694
|
}
|
|
138647
138695
|
function identityTokenPath(paths, identityName) {
|
|
138648
|
-
return
|
|
138696
|
+
return import_node_path46.default.join(identityTokenDir(paths), `${identityName}.token`);
|
|
138649
138697
|
}
|
|
138650
138698
|
function storeIdentityToken(paths, identityName, raw) {
|
|
138651
138699
|
const token = raw.trim();
|
|
@@ -138656,7 +138704,7 @@ function storeIdentityToken(paths, identityName, raw) {
|
|
|
138656
138704
|
import_node_fs17.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
|
|
138657
138705
|
import_node_fs17.default.chmodSync(dir, TOKEN_DIR_MODE);
|
|
138658
138706
|
const target = identityTokenPath(paths, identityName);
|
|
138659
|
-
const temp =
|
|
138707
|
+
const temp = import_node_path46.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
|
|
138660
138708
|
import_node_fs17.default.writeFileSync(temp, `${token}
|
|
138661
138709
|
`, { mode: TOKEN_FILE_MODE });
|
|
138662
138710
|
import_node_fs17.default.renameSync(temp, target);
|
|
@@ -138824,7 +138872,7 @@ function registerDoctorCommand(program2, deps) {
|
|
|
138824
138872
|
// src/headroom/commands.ts
|
|
138825
138873
|
var import_node_fs18 = __toESM(require("node:fs"), 1);
|
|
138826
138874
|
var import_node_http4 = __toESM(require("node:http"), 1);
|
|
138827
|
-
var
|
|
138875
|
+
var import_node_path47 = __toESM(require("node:path"), 1);
|
|
138828
138876
|
var import_node_child_process6 = require("node:child_process");
|
|
138829
138877
|
init_commandDeps();
|
|
138830
138878
|
init_realFrontDoorPort();
|
|
@@ -138938,12 +138986,12 @@ function readInstalledHeadroomCommit() {
|
|
|
138938
138986
|
if (toolDir.status !== 0) {
|
|
138939
138987
|
return void 0;
|
|
138940
138988
|
}
|
|
138941
|
-
const libDir =
|
|
138989
|
+
const libDir = import_node_path47.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
|
|
138942
138990
|
for (const python of realFarmFs.readdir(libDir)) {
|
|
138943
|
-
const sitePackages =
|
|
138991
|
+
const sitePackages = import_node_path47.default.join(libDir, python, "site-packages");
|
|
138944
138992
|
for (const entry of realFarmFs.readdir(sitePackages)) {
|
|
138945
138993
|
if (entry.startsWith("headroom_ai-") && entry.endsWith(".dist-info")) {
|
|
138946
|
-
const directUrl = realFarmFs.readFileUtf8(
|
|
138994
|
+
const directUrl = realFarmFs.readFileUtf8(import_node_path47.default.join(sitePackages, entry, "direct_url.json"));
|
|
138947
138995
|
return directUrl === void 0 ? void 0 : parseInstalledCommit(directUrl);
|
|
138948
138996
|
}
|
|
138949
138997
|
}
|
|
@@ -139483,6 +139531,7 @@ function registerRunCommand(program2, handler) {
|
|
|
139483
139531
|
}
|
|
139484
139532
|
|
|
139485
139533
|
// src/usage/commands.ts
|
|
139534
|
+
var import_node_path48 = __toESM(require("node:path"), 1);
|
|
139486
139535
|
init_commandDeps();
|
|
139487
139536
|
init_realPorts();
|
|
139488
139537
|
init_account();
|
|
@@ -139621,7 +139670,7 @@ function formatUsageReport(report) {
|
|
|
139621
139670
|
}
|
|
139622
139671
|
return lines;
|
|
139623
139672
|
}
|
|
139624
|
-
function collectAccounts(fs21, paths, identity) {
|
|
139673
|
+
function collectAccounts(fs21, paths, identity, probe) {
|
|
139625
139674
|
if (identity !== void 0) {
|
|
139626
139675
|
requireIdentity(paths, identity);
|
|
139627
139676
|
}
|
|
@@ -139629,6 +139678,7 @@ function collectAccounts(fs21, paths, identity) {
|
|
|
139629
139678
|
return names.map((name) => ({
|
|
139630
139679
|
identity: name,
|
|
139631
139680
|
account: readAccountMetadata(fs21, paths.identitiesDir, name),
|
|
139681
|
+
signIn: identitySignIn(fs21, probe, { farmRoot: import_node_path48.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
|
|
139632
139682
|
usage: readUsageSnapshot(fs21, paths.usageSnapshotsDir, name)
|
|
139633
139683
|
}));
|
|
139634
139684
|
}
|
|
@@ -139639,6 +139689,7 @@ function formatAccounts(views) {
|
|
|
139639
139689
|
return views.flatMap((view, index) => {
|
|
139640
139690
|
const { account } = view;
|
|
139641
139691
|
const lines = [...index === 0 ? [] : [""], `Identity: ${view.identity}`];
|
|
139692
|
+
lines.push(`Sign-in: ${view.signIn.state === "signed-out" ? "signed out" : view.signIn.state === "token" ? "token" : "signed in"} (${view.signIn.detail})`);
|
|
139642
139693
|
if (account === void 0) {
|
|
139643
139694
|
lines.push("Account: (no stored login profile: never logged in, or a setup-token identity, which has no profile scope)");
|
|
139644
139695
|
} else {
|
|
@@ -139731,7 +139782,7 @@ function registerUsageCommands(program2, deps) {
|
|
|
139731
139782
|
console.error(warning);
|
|
139732
139783
|
}
|
|
139733
139784
|
}
|
|
139734
|
-
const views = collectAccounts(realFarmFs, paths, identity);
|
|
139785
|
+
const views = collectAccounts(realFarmFs, paths, identity, { platform: process.platform, run: realRunPort });
|
|
139735
139786
|
if (options.json === true) {
|
|
139736
139787
|
printJson(identity === void 0 ? views : views[0]);
|
|
139737
139788
|
return;
|
|
@@ -139960,7 +140011,7 @@ async function runClaude(argvOverride) {
|
|
|
139960
140011
|
// src/cli.ts
|
|
139961
140012
|
async function main() {
|
|
139962
140013
|
aliasLegacyEnv(process.env);
|
|
139963
|
-
const invokedName =
|
|
140014
|
+
const invokedName = import_node_path49.default.basename(process.argv[1] ?? "agent-shim");
|
|
139964
140015
|
if (isInvokedAsClaude(invokedName)) {
|
|
139965
140016
|
await runClaude();
|
|
139966
140017
|
return;
|