claude-use 11.87.3 → 11.87.4
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 +536 -470
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -319,10 +319,10 @@ function mergeDefs(...defs) {
|
|
|
319
319
|
function cloneDef(schema) {
|
|
320
320
|
return mergeDefs(schema._zod.def);
|
|
321
321
|
}
|
|
322
|
-
function getElementAtPath(obj,
|
|
323
|
-
if (!
|
|
322
|
+
function getElementAtPath(obj, path98) {
|
|
323
|
+
if (!path98)
|
|
324
324
|
return obj;
|
|
325
|
-
return
|
|
325
|
+
return path98.reduce((acc, key) => acc?.[key], obj);
|
|
326
326
|
}
|
|
327
327
|
function promiseAllObject(promisesObj) {
|
|
328
328
|
const keys = Object.keys(promisesObj);
|
|
@@ -581,11 +581,11 @@ function explicitlyAborted(x3, startIndex = 0) {
|
|
|
581
581
|
}
|
|
582
582
|
return false;
|
|
583
583
|
}
|
|
584
|
-
function prefixIssues(
|
|
584
|
+
function prefixIssues(path98, issues) {
|
|
585
585
|
return issues.map((iss) => {
|
|
586
586
|
var _a4;
|
|
587
587
|
(_a4 = iss).path ?? (_a4.path = []);
|
|
588
|
-
iss.path.unshift(
|
|
588
|
+
iss.path.unshift(path98);
|
|
589
589
|
return iss;
|
|
590
590
|
});
|
|
591
591
|
}
|
|
@@ -1118,16 +1118,16 @@ function flattenError(error63, mapper = (issue2) => issue2.message) {
|
|
|
1118
1118
|
}
|
|
1119
1119
|
function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
1120
1120
|
const fieldErrors = { _errors: [] };
|
|
1121
|
-
const processError = (error64,
|
|
1121
|
+
const processError = (error64, path98 = []) => {
|
|
1122
1122
|
for (const issue2 of error64.issues) {
|
|
1123
1123
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1124
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1124
|
+
issue2.errors.map((issues) => processError({ issues }, [...path98, ...issue2.path]));
|
|
1125
1125
|
} else if (issue2.code === "invalid_key") {
|
|
1126
|
-
processError({ issues: issue2.issues }, [...
|
|
1126
|
+
processError({ issues: issue2.issues }, [...path98, ...issue2.path]);
|
|
1127
1127
|
} else if (issue2.code === "invalid_element") {
|
|
1128
|
-
processError({ issues: issue2.issues }, [...
|
|
1128
|
+
processError({ issues: issue2.issues }, [...path98, ...issue2.path]);
|
|
1129
1129
|
} else {
|
|
1130
|
-
const fullpath = [...
|
|
1130
|
+
const fullpath = [...path98, ...issue2.path];
|
|
1131
1131
|
if (fullpath.length === 0) {
|
|
1132
1132
|
fieldErrors._errors.push(mapper(issue2));
|
|
1133
1133
|
} else {
|
|
@@ -1166,17 +1166,17 @@ function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
|
1166
1166
|
}
|
|
1167
1167
|
function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
1168
1168
|
const result = { errors: [] };
|
|
1169
|
-
const processError = (error64,
|
|
1169
|
+
const processError = (error64, path98 = []) => {
|
|
1170
1170
|
var _a4;
|
|
1171
1171
|
for (const issue2 of error64.issues) {
|
|
1172
1172
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1173
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1173
|
+
issue2.errors.map((issues) => processError({ issues }, [...path98, ...issue2.path]));
|
|
1174
1174
|
} else if (issue2.code === "invalid_key") {
|
|
1175
|
-
processError({ issues: issue2.issues }, [...
|
|
1175
|
+
processError({ issues: issue2.issues }, [...path98, ...issue2.path]);
|
|
1176
1176
|
} else if (issue2.code === "invalid_element") {
|
|
1177
|
-
processError({ issues: issue2.issues }, [...
|
|
1177
|
+
processError({ issues: issue2.issues }, [...path98, ...issue2.path]);
|
|
1178
1178
|
} else {
|
|
1179
|
-
const fullpath = [...
|
|
1179
|
+
const fullpath = [...path98, ...issue2.path];
|
|
1180
1180
|
if (fullpath.length === 0) {
|
|
1181
1181
|
result.errors.push(mapper(issue2));
|
|
1182
1182
|
continue;
|
|
@@ -1215,8 +1215,8 @@ function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
|
1215
1215
|
}
|
|
1216
1216
|
function toDotPath(_path) {
|
|
1217
1217
|
const segs = [];
|
|
1218
|
-
const
|
|
1219
|
-
for (const seg of
|
|
1218
|
+
const path98 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1219
|
+
for (const seg of path98) {
|
|
1220
1220
|
if (typeof seg === "number")
|
|
1221
1221
|
segs.push(`[${seg}]`);
|
|
1222
1222
|
else if (typeof seg === "symbol")
|
|
@@ -19248,13 +19248,13 @@ function resolveRef(ref, ctx) {
|
|
|
19248
19248
|
if (!ref.startsWith("#")) {
|
|
19249
19249
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
19250
19250
|
}
|
|
19251
|
-
const
|
|
19252
|
-
if (
|
|
19251
|
+
const path98 = ref.slice(1).split("/").filter(Boolean);
|
|
19252
|
+
if (path98.length === 0) {
|
|
19253
19253
|
return ctx.rootSchema;
|
|
19254
19254
|
}
|
|
19255
19255
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
19256
|
-
if (
|
|
19257
|
-
const key =
|
|
19256
|
+
if (path98[0] === defsKey) {
|
|
19257
|
+
const key = path98[1] === void 0 ? void 0 : decodeJSONPointerSegment(path98[1]);
|
|
19258
19258
|
if (!key || !ctx.defs[key]) {
|
|
19259
19259
|
throw new Error(`Reference not found: ${ref}`);
|
|
19260
19260
|
}
|
|
@@ -23761,42 +23761,42 @@ var require_defaults = __commonJS({
|
|
|
23761
23761
|
var require_env_paths = __commonJS({
|
|
23762
23762
|
"node_modules/.pnpm/env-paths@2.2.1/node_modules/env-paths/index.js"(exports2, module2) {
|
|
23763
23763
|
"use strict";
|
|
23764
|
-
var
|
|
23764
|
+
var path98 = require("path");
|
|
23765
23765
|
var os24 = require("os");
|
|
23766
23766
|
var homedir = os24.homedir();
|
|
23767
23767
|
var tmpdir2 = os24.tmpdir();
|
|
23768
23768
|
var { env } = process;
|
|
23769
23769
|
var macos = (name) => {
|
|
23770
|
-
const library =
|
|
23770
|
+
const library = path98.join(homedir, "Library");
|
|
23771
23771
|
return {
|
|
23772
|
-
data:
|
|
23773
|
-
config:
|
|
23774
|
-
cache:
|
|
23775
|
-
log:
|
|
23776
|
-
temp:
|
|
23772
|
+
data: path98.join(library, "Application Support", name),
|
|
23773
|
+
config: path98.join(library, "Preferences", name),
|
|
23774
|
+
cache: path98.join(library, "Caches", name),
|
|
23775
|
+
log: path98.join(library, "Logs", name),
|
|
23776
|
+
temp: path98.join(tmpdir2, name)
|
|
23777
23777
|
};
|
|
23778
23778
|
};
|
|
23779
23779
|
var windows = (name) => {
|
|
23780
|
-
const appData = env.APPDATA ||
|
|
23781
|
-
const localAppData = env.LOCALAPPDATA ||
|
|
23780
|
+
const appData = env.APPDATA || path98.join(homedir, "AppData", "Roaming");
|
|
23781
|
+
const localAppData = env.LOCALAPPDATA || path98.join(homedir, "AppData", "Local");
|
|
23782
23782
|
return {
|
|
23783
23783
|
// Data/config/cache/log are invented by me as Windows isn't opinionated about this
|
|
23784
|
-
data:
|
|
23785
|
-
config:
|
|
23786
|
-
cache:
|
|
23787
|
-
log:
|
|
23788
|
-
temp:
|
|
23784
|
+
data: path98.join(localAppData, name, "Data"),
|
|
23785
|
+
config: path98.join(appData, name, "Config"),
|
|
23786
|
+
cache: path98.join(localAppData, name, "Cache"),
|
|
23787
|
+
log: path98.join(localAppData, name, "Log"),
|
|
23788
|
+
temp: path98.join(tmpdir2, name)
|
|
23789
23789
|
};
|
|
23790
23790
|
};
|
|
23791
23791
|
var linux = (name) => {
|
|
23792
|
-
const username =
|
|
23792
|
+
const username = path98.basename(homedir);
|
|
23793
23793
|
return {
|
|
23794
|
-
data:
|
|
23795
|
-
config:
|
|
23796
|
-
cache:
|
|
23794
|
+
data: path98.join(env.XDG_DATA_HOME || path98.join(homedir, ".local", "share"), name),
|
|
23795
|
+
config: path98.join(env.XDG_CONFIG_HOME || path98.join(homedir, ".config"), name),
|
|
23796
|
+
cache: path98.join(env.XDG_CACHE_HOME || path98.join(homedir, ".cache"), name),
|
|
23797
23797
|
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
23798
|
-
log:
|
|
23799
|
-
temp:
|
|
23798
|
+
log: path98.join(env.XDG_STATE_HOME || path98.join(homedir, ".local", "state"), name),
|
|
23799
|
+
temp: path98.join(tmpdir2, username, name)
|
|
23800
23800
|
};
|
|
23801
23801
|
};
|
|
23802
23802
|
var envPaths = (name, options) => {
|
|
@@ -23864,11 +23864,11 @@ var require_util = __commonJS({
|
|
|
23864
23864
|
return result;
|
|
23865
23865
|
}
|
|
23866
23866
|
exports2.emplace = emplace;
|
|
23867
|
-
function getPropertyByPath(source,
|
|
23868
|
-
if (typeof
|
|
23869
|
-
return source[
|
|
23867
|
+
function getPropertyByPath(source, path98) {
|
|
23868
|
+
if (typeof path98 === "string" && Object.prototype.hasOwnProperty.call(source, path98)) {
|
|
23869
|
+
return source[path98];
|
|
23870
23870
|
}
|
|
23871
|
-
const parsedPath = typeof
|
|
23871
|
+
const parsedPath = typeof path98 === "string" ? path98.split(".") : path98;
|
|
23872
23872
|
return parsedPath.reduce((previous, key) => {
|
|
23873
23873
|
if (previous === void 0) {
|
|
23874
23874
|
return previous;
|
|
@@ -23891,9 +23891,9 @@ var require_util = __commonJS({
|
|
|
23891
23891
|
return Object.fromEntries(Object.entries(options).filter(([, value3]) => value3 !== void 0));
|
|
23892
23892
|
}
|
|
23893
23893
|
exports2.removeUndefinedValuesFromObject = removeUndefinedValuesFromObject;
|
|
23894
|
-
async function isDirectory(
|
|
23894
|
+
async function isDirectory(path98) {
|
|
23895
23895
|
try {
|
|
23896
|
-
const stat = await fs_1.promises.stat(
|
|
23896
|
+
const stat = await fs_1.promises.stat(path98);
|
|
23897
23897
|
return stat.isDirectory();
|
|
23898
23898
|
} catch (e10) {
|
|
23899
23899
|
if (e10.code === "ENOENT") {
|
|
@@ -23903,9 +23903,9 @@ var require_util = __commonJS({
|
|
|
23903
23903
|
}
|
|
23904
23904
|
}
|
|
23905
23905
|
exports2.isDirectory = isDirectory;
|
|
23906
|
-
function isDirectorySync(
|
|
23906
|
+
function isDirectorySync(path98) {
|
|
23907
23907
|
try {
|
|
23908
|
-
const stat = fs_1.default.statSync(
|
|
23908
|
+
const stat = fs_1.default.statSync(path98);
|
|
23909
23909
|
return stat.isDirectory();
|
|
23910
23910
|
} catch (e10) {
|
|
23911
23911
|
if (e10.code === "ENOENT") {
|
|
@@ -24003,7 +24003,7 @@ var require_ExplorerBase = __commonJS({
|
|
|
24003
24003
|
const idx = importStack.indexOf(fullPath);
|
|
24004
24004
|
if (idx !== -1) {
|
|
24005
24005
|
throw new Error(`Circular import detected:
|
|
24006
|
-
${[...importStack, fullPath].map((
|
|
24006
|
+
${[...importStack, fullPath].map((path98, i10) => `${i10 + 1}. ${path98}`).join("\n")} (same as ${idx + 1}.)`);
|
|
24007
24007
|
}
|
|
24008
24008
|
}
|
|
24009
24009
|
}
|
|
@@ -24191,9 +24191,9 @@ var require_Explorer = __commonJS({
|
|
|
24191
24191
|
throw error63;
|
|
24192
24192
|
}
|
|
24193
24193
|
}
|
|
24194
|
-
async #fileExists(
|
|
24194
|
+
async #fileExists(path98) {
|
|
24195
24195
|
try {
|
|
24196
|
-
await promises_1.default.stat(
|
|
24196
|
+
await promises_1.default.stat(path98);
|
|
24197
24197
|
return true;
|
|
24198
24198
|
} catch (e10) {
|
|
24199
24199
|
return false;
|
|
@@ -24353,9 +24353,9 @@ var require_ExplorerSync = __commonJS({
|
|
|
24353
24353
|
throw error63;
|
|
24354
24354
|
}
|
|
24355
24355
|
}
|
|
24356
|
-
#fileExists(
|
|
24356
|
+
#fileExists(path98) {
|
|
24357
24357
|
try {
|
|
24358
|
-
fs_1.default.statSync(
|
|
24358
|
+
fs_1.default.statSync(path98);
|
|
24359
24359
|
return true;
|
|
24360
24360
|
} catch (e10) {
|
|
24361
24361
|
return false;
|
|
@@ -24479,7 +24479,7 @@ var require_dist = __commonJS({
|
|
|
24479
24479
|
};
|
|
24480
24480
|
}
|
|
24481
24481
|
function getResolvedSearchPlaces(moduleName, toolDefinedSearchPlaces, userConfiguredOptions) {
|
|
24482
|
-
const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((
|
|
24482
|
+
const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path98) => path98.replace("{name}", moduleName));
|
|
24483
24483
|
if (userConfiguredOptions.mergeSearchPlaces) {
|
|
24484
24484
|
return [...userConfiguredSearchPlaces ?? [], ...toolDefinedSearchPlaces];
|
|
24485
24485
|
}
|
|
@@ -24609,7 +24609,7 @@ function parseIgnoringUnrecognisedKeys(schema, raw) {
|
|
|
24609
24609
|
return second.success ? { success: true, data: second.data, ignored } : { success: false, issues: second.error.issues };
|
|
24610
24610
|
}
|
|
24611
24611
|
function describeIgnoredKeys(filePath, ignored) {
|
|
24612
|
-
const places = ignored.map(({ path:
|
|
24612
|
+
const places = ignored.map(({ path: path98, keys }) => `${path98.length === 0 ? "" : `${path98.map(String).join(".")}.`}${keys.join(", ")}`);
|
|
24613
24613
|
return `${filePath} has settings this version of agent-shim does not know and ignores: ${places.join("; ")}. A newer release may read them.`;
|
|
24614
24614
|
}
|
|
24615
24615
|
function noteIgnoredKeys(filePath, ignored) {
|
|
@@ -24631,9 +24631,9 @@ function restoreIgnoredKeys(filePath, value3) {
|
|
|
24631
24631
|
return value3;
|
|
24632
24632
|
}
|
|
24633
24633
|
const restored2 = structuredClone(value3);
|
|
24634
|
-
for (const { path:
|
|
24634
|
+
for (const { path: path98, values } of ignored) {
|
|
24635
24635
|
let holder = restored2;
|
|
24636
|
-
for (const step2 of
|
|
24636
|
+
for (const step2 of path98) {
|
|
24637
24637
|
holder = isRecord(holder) ? holder[step2] : void 0;
|
|
24638
24638
|
}
|
|
24639
24639
|
if (isRecord(holder)) {
|
|
@@ -28811,8 +28811,8 @@ var require_utils = __commonJS({
|
|
|
28811
28811
|
}
|
|
28812
28812
|
return output2;
|
|
28813
28813
|
};
|
|
28814
|
-
exports2.basename = (
|
|
28815
|
-
const segs =
|
|
28814
|
+
exports2.basename = (path98, { windows } = {}) => {
|
|
28815
|
+
const segs = path98.split(windows ? /[\\/]/ : "/");
|
|
28816
28816
|
const last = segs[segs.length - 1];
|
|
28817
28817
|
if (last === "") {
|
|
28818
28818
|
return segs[segs.length - 2];
|
|
@@ -33403,9 +33403,9 @@ var init_identity = __esm({
|
|
|
33403
33403
|
});
|
|
33404
33404
|
|
|
33405
33405
|
// src/statusline/keys.ts
|
|
33406
|
-
function valueAt(source,
|
|
33406
|
+
function valueAt(source, path98) {
|
|
33407
33407
|
let current = source;
|
|
33408
|
-
for (const part of
|
|
33408
|
+
for (const part of path98) {
|
|
33409
33409
|
if (!isPlainObject2(current)) {
|
|
33410
33410
|
return void 0;
|
|
33411
33411
|
}
|
|
@@ -33413,14 +33413,14 @@ function valueAt(source, path97) {
|
|
|
33413
33413
|
}
|
|
33414
33414
|
return current;
|
|
33415
33415
|
}
|
|
33416
|
-
function acceptsNull(
|
|
33417
|
-
const layer =
|
|
33416
|
+
function acceptsNull(path98) {
|
|
33417
|
+
const layer = path98.reduceRight((inner, part) => ({ [part]: inner }), null);
|
|
33418
33418
|
return StatuslineSchema.safeParse(layer).success;
|
|
33419
33419
|
}
|
|
33420
|
-
function keyOf(
|
|
33420
|
+
function keyOf(path98, declared) {
|
|
33421
33421
|
const optional2 = declared instanceof external_exports.ZodOptional;
|
|
33422
33422
|
const leaf = optional2 ? declared.unwrap() : declared;
|
|
33423
|
-
const common = { path:
|
|
33423
|
+
const common = { path: path98.join("."), description: declared.description ?? "", defaultValue: valueAt(STATUSLINE_DEFAULTS, path98), optional: optional2, unsettable: acceptsNull(path98) };
|
|
33424
33424
|
if (leaf instanceof external_exports.ZodNumber) {
|
|
33425
33425
|
return { ...common, kind: "integer", choices: [] };
|
|
33426
33426
|
}
|
|
@@ -33445,7 +33445,7 @@ function keyOf(path97, declared) {
|
|
|
33445
33445
|
if (leaf instanceof external_exports.ZodArray && leaf.element instanceof external_exports.ZodString) {
|
|
33446
33446
|
return { ...common, kind: "textList", choices: [] };
|
|
33447
33447
|
}
|
|
33448
|
-
throw new TypeError(`statusline setting ${
|
|
33448
|
+
throw new TypeError(`statusline setting ${path98.join(".")} has a kind the key listing does not describe`);
|
|
33449
33449
|
}
|
|
33450
33450
|
function walk(shape, prefix) {
|
|
33451
33451
|
return Object.entries(shape).flatMap(([name, schema]) => schema instanceof external_exports.ZodObject ? walk(schema.shape, [...prefix, name]) : [keyOf([...prefix, name], schema)]);
|
|
@@ -33476,14 +33476,14 @@ var init_keys = __esm({
|
|
|
33476
33476
|
});
|
|
33477
33477
|
|
|
33478
33478
|
// src/statusline/change.ts
|
|
33479
|
-
function keyNamed(
|
|
33480
|
-
const found = statuslineKeys().find((key) => key.path ===
|
|
33479
|
+
function keyNamed(path98) {
|
|
33480
|
+
const found = statuslineKeys().find((key) => key.path === path98);
|
|
33481
33481
|
if (found === void 0) {
|
|
33482
|
-
throw new UsageError(`"${
|
|
33482
|
+
throw new UsageError(`"${path98}" is not a statusline setting; \`agent-shim statusline keys\` lists them.`);
|
|
33483
33483
|
}
|
|
33484
33484
|
return found;
|
|
33485
33485
|
}
|
|
33486
|
-
function textListOf(
|
|
33486
|
+
function textListOf(path98, raw) {
|
|
33487
33487
|
if (raw === "") {
|
|
33488
33488
|
return [];
|
|
33489
33489
|
}
|
|
@@ -33491,10 +33491,10 @@ function textListOf(path97, raw) {
|
|
|
33491
33491
|
try {
|
|
33492
33492
|
parsed = JSON.parse(raw);
|
|
33493
33493
|
} catch {
|
|
33494
|
-
throw new UsageError(`${
|
|
33494
|
+
throw new UsageError(`${path98}: "${raw}" is not a JSON array of strings such as ["git","describe"].`);
|
|
33495
33495
|
}
|
|
33496
33496
|
if (!Array.isArray(parsed) || parsed.some((item) => typeof item !== "string")) {
|
|
33497
|
-
throw new UsageError(`${
|
|
33497
|
+
throw new UsageError(`${path98}: "${raw}" is not a JSON array of strings such as ["git","describe"].`);
|
|
33498
33498
|
}
|
|
33499
33499
|
return parsed;
|
|
33500
33500
|
}
|
|
@@ -33503,42 +33503,42 @@ function parseStatuslineAssignment(text5) {
|
|
|
33503
33503
|
if (split < 1) {
|
|
33504
33504
|
throw new UsageError(`"${text5}" is not <setting>=<value>.`);
|
|
33505
33505
|
}
|
|
33506
|
-
const
|
|
33506
|
+
const path98 = text5.slice(0, split);
|
|
33507
33507
|
const raw = text5.slice(split + 1);
|
|
33508
|
-
const key = keyNamed(
|
|
33508
|
+
const key = keyNamed(path98);
|
|
33509
33509
|
if (key.unsettable && raw === UNSET_WORD) {
|
|
33510
|
-
return { path:
|
|
33510
|
+
return { path: path98, value: null };
|
|
33511
33511
|
}
|
|
33512
33512
|
switch (key.kind) {
|
|
33513
33513
|
case "integer": {
|
|
33514
33514
|
const number6 = Number(raw);
|
|
33515
33515
|
if (raw.trim() === "" || !Number.isFinite(number6)) {
|
|
33516
|
-
throw new UsageError(`${
|
|
33516
|
+
throw new UsageError(`${path98}: "${raw}" is not a number.`);
|
|
33517
33517
|
}
|
|
33518
|
-
return { path:
|
|
33518
|
+
return { path: path98, value: number6 };
|
|
33519
33519
|
}
|
|
33520
33520
|
case "boolean":
|
|
33521
33521
|
if (raw !== "true" && raw !== "false") {
|
|
33522
|
-
throw new UsageError(`${
|
|
33522
|
+
throw new UsageError(`${path98}: "${raw}" is not true or false.`);
|
|
33523
33523
|
}
|
|
33524
|
-
return { path:
|
|
33524
|
+
return { path: path98, value: raw === "true" };
|
|
33525
33525
|
case "text":
|
|
33526
33526
|
case "choice":
|
|
33527
|
-
return { path:
|
|
33527
|
+
return { path: path98, value: raw };
|
|
33528
33528
|
case "colour":
|
|
33529
|
-
return { path:
|
|
33529
|
+
return { path: path98, value: /^\d+$/.test(raw) ? Number(raw) : raw };
|
|
33530
33530
|
case "list":
|
|
33531
|
-
return { path:
|
|
33531
|
+
return { path: path98, value: raw === "" ? [] : raw.split(",") };
|
|
33532
33532
|
case "groups":
|
|
33533
|
-
return { path:
|
|
33533
|
+
return { path: path98, value: raw === "" ? [] : raw.split(";").map((group) => group.split(",")) };
|
|
33534
33534
|
case "textList":
|
|
33535
|
-
return { path:
|
|
33535
|
+
return { path: path98, value: textListOf(path98, raw) };
|
|
33536
33536
|
default:
|
|
33537
33537
|
return key.kind;
|
|
33538
33538
|
}
|
|
33539
33539
|
}
|
|
33540
|
-
function setAt(target,
|
|
33541
|
-
const [head, ...rest] =
|
|
33540
|
+
function setAt(target, path98, value3) {
|
|
33541
|
+
const [head, ...rest] = path98;
|
|
33542
33542
|
if (head === void 0) {
|
|
33543
33543
|
return;
|
|
33544
33544
|
}
|
|
@@ -33551,8 +33551,8 @@ function setAt(target, path97, value3) {
|
|
|
33551
33551
|
target[head] = next;
|
|
33552
33552
|
setAt(next, rest, value3);
|
|
33553
33553
|
}
|
|
33554
|
-
function removeAt(target,
|
|
33555
|
-
const [head, ...rest] =
|
|
33554
|
+
function removeAt(target, path98) {
|
|
33555
|
+
const [head, ...rest] = path98;
|
|
33556
33556
|
if (head === void 0) {
|
|
33557
33557
|
return;
|
|
33558
33558
|
}
|
|
@@ -33570,13 +33570,13 @@ function removeAt(target, path97) {
|
|
|
33570
33570
|
}
|
|
33571
33571
|
function applyStatuslineChange(existing, change) {
|
|
33572
33572
|
const draft = structuredClone(existing ?? {});
|
|
33573
|
-
for (const [
|
|
33574
|
-
keyNamed(
|
|
33575
|
-
setAt(draft,
|
|
33573
|
+
for (const [path98, value3] of Object.entries(change.set ?? {})) {
|
|
33574
|
+
keyNamed(path98);
|
|
33575
|
+
setAt(draft, path98.split("."), value3);
|
|
33576
33576
|
}
|
|
33577
|
-
for (const
|
|
33578
|
-
keyNamed(
|
|
33579
|
-
removeAt(draft,
|
|
33577
|
+
for (const path98 of change.unset ?? []) {
|
|
33578
|
+
keyNamed(path98);
|
|
33579
|
+
removeAt(draft, path98.split("."));
|
|
33580
33580
|
}
|
|
33581
33581
|
const result = StatuslineSchema.safeParse(draft);
|
|
33582
33582
|
if (!result.success) {
|
|
@@ -33814,19 +33814,19 @@ function writePools(paths, pools) {
|
|
|
33814
33814
|
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
|
|
33815
33815
|
}
|
|
33816
33816
|
function poolCycleOf(pools, name) {
|
|
33817
|
-
const walk3 = (current,
|
|
33817
|
+
const walk3 = (current, path98) => {
|
|
33818
33818
|
for (const entry of pools[current]?.identities ?? []) {
|
|
33819
33819
|
const nested = poolNameOf(poolMemberIdentity(entry));
|
|
33820
33820
|
if (nested === void 0) {
|
|
33821
33821
|
continue;
|
|
33822
33822
|
}
|
|
33823
33823
|
if (nested === name) {
|
|
33824
|
-
return [...
|
|
33824
|
+
return [...path98, nested];
|
|
33825
33825
|
}
|
|
33826
|
-
if (
|
|
33826
|
+
if (path98.includes(nested)) {
|
|
33827
33827
|
continue;
|
|
33828
33828
|
}
|
|
33829
|
-
const found = walk3(nested, [...
|
|
33829
|
+
const found = walk3(nested, [...path98, nested]);
|
|
33830
33830
|
if (found !== void 0) {
|
|
33831
33831
|
return found;
|
|
33832
33832
|
}
|
|
@@ -33997,7 +33997,7 @@ var init_schema2 = __esm({
|
|
|
33997
33997
|
endpoint: external_exports.string(),
|
|
33998
33998
|
/** The model the response named. */
|
|
33999
33999
|
model: external_exports.string().optional(),
|
|
34000
|
-
/** The model
|
|
34000
|
+
/** The model the session requested when a routing layer chose a different model, or when no response model was available to compare it with. Absent when the response confirms that the requested name was served unchanged. */
|
|
34001
34001
|
requestedModel: external_exports.string().optional(),
|
|
34002
34002
|
/** The distinct providers the choice could have landed on, present only when there was more than one, so a reader can tell a choice that crossed providers from one that stayed inside a single provider's lineup. */
|
|
34003
34003
|
candidateProviders: external_exports.array(external_exports.string()).optional(),
|
|
@@ -36217,11 +36217,11 @@ function identifyRequest(headers) {
|
|
|
36217
36217
|
function directOrigin2(port) {
|
|
36218
36218
|
return `http://127.0.0.1:${String(port)}`;
|
|
36219
36219
|
}
|
|
36220
|
-
function parseProviderPath(
|
|
36221
|
-
if (!
|
|
36220
|
+
function parseProviderPath(path98) {
|
|
36221
|
+
if (!path98.startsWith(PROVIDER_PATH_PREFIX)) {
|
|
36222
36222
|
return void 0;
|
|
36223
36223
|
}
|
|
36224
|
-
const tail =
|
|
36224
|
+
const tail = path98.slice(PROVIDER_PATH_PREFIX.length);
|
|
36225
36225
|
const slash = tail.indexOf("/");
|
|
36226
36226
|
if (slash <= 0) {
|
|
36227
36227
|
return void 0;
|
|
@@ -36557,12 +36557,12 @@ function decoderFor(encoding) {
|
|
|
36557
36557
|
return void 0;
|
|
36558
36558
|
}
|
|
36559
36559
|
}
|
|
36560
|
-
function destinationOf(
|
|
36561
|
-
const scoped = parseProviderPath(
|
|
36560
|
+
function destinationOf(path98, sessionProvider) {
|
|
36561
|
+
const scoped = parseProviderPath(path98);
|
|
36562
36562
|
if (scoped !== void 0) {
|
|
36563
36563
|
return { provider: scoped.provider, endpoint: scoped.rest };
|
|
36564
36564
|
}
|
|
36565
|
-
return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint:
|
|
36565
|
+
return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint: path98 };
|
|
36566
36566
|
}
|
|
36567
36567
|
function modelChoiceOf(event, servedModel, provider) {
|
|
36568
36568
|
if (event.modelChoice !== void 0) return event.modelChoice;
|
|
@@ -36573,6 +36573,7 @@ function buildRecord(event, context) {
|
|
|
36573
36573
|
const { scan } = context;
|
|
36574
36574
|
const { provider, endpoint } = destinationOf(event.servedPath, event.session.provider);
|
|
36575
36575
|
const choice = modelChoiceOf(event, scan?.model, provider);
|
|
36576
|
+
const requestedModel = choice?.requested ?? (scan?.model === void 0 ? event.requestedModel : void 0);
|
|
36576
36577
|
const rateLimitHeaders = rateLimitHeadersOf(event.headers);
|
|
36577
36578
|
const limit = classifyLimit({ status: event.status, headers: rateLimitHeaders ?? {}, error: scan?.error, nowMs: context.endedAt });
|
|
36578
36579
|
const requestId = headerValue(event.headers, "request-id");
|
|
@@ -36590,7 +36591,7 @@ function buildRecord(event, context) {
|
|
|
36590
36591
|
method: event.method,
|
|
36591
36592
|
endpoint,
|
|
36592
36593
|
...scan?.model === void 0 ? {} : { model: scan.model },
|
|
36593
|
-
...
|
|
36594
|
+
...requestedModel === void 0 ? {} : { requestedModel },
|
|
36594
36595
|
...choice !== void 0 && choice.providers.length > 1 ? { candidateProviders: [...choice.providers] } : {},
|
|
36595
36596
|
status: event.status,
|
|
36596
36597
|
latencyMs: Math.max(0, Math.round(context.headAt - event.receivedAt)),
|
|
@@ -40758,8 +40759,8 @@ function parseConnectTarget(authority) {
|
|
|
40758
40759
|
}
|
|
40759
40760
|
return { host, port };
|
|
40760
40761
|
}
|
|
40761
|
-
function servedByPipeline(
|
|
40762
|
-
return
|
|
40762
|
+
function servedByPipeline(path98) {
|
|
40763
|
+
return path98?.startsWith(ROUTED_PATH_PREFIX) === true;
|
|
40763
40764
|
}
|
|
40764
40765
|
function forwardableHeaders(headers) {
|
|
40765
40766
|
const connectionTokens = new Set(
|
|
@@ -41979,7 +41980,7 @@ var init_package = __esm({
|
|
|
41979
41980
|
"package.json"() {
|
|
41980
41981
|
package_default = {
|
|
41981
41982
|
name: "claude-use",
|
|
41982
|
-
version: "11.87.
|
|
41983
|
+
version: "11.87.4",
|
|
41983
41984
|
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.",
|
|
41984
41985
|
license: "MIT",
|
|
41985
41986
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -43314,14 +43315,14 @@ var require_util2 = __commonJS({
|
|
|
43314
43315
|
}
|
|
43315
43316
|
const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
|
|
43316
43317
|
let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
|
|
43317
|
-
let
|
|
43318
|
+
let path98 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
|
|
43318
43319
|
if (origin[origin.length - 1] === "/") {
|
|
43319
43320
|
origin = origin.slice(0, origin.length - 1);
|
|
43320
43321
|
}
|
|
43321
|
-
if (
|
|
43322
|
-
|
|
43322
|
+
if (path98 && path98[0] !== "/") {
|
|
43323
|
+
path98 = `/${path98}`;
|
|
43323
43324
|
}
|
|
43324
|
-
return new URL(`${origin}${
|
|
43325
|
+
return new URL(`${origin}${path98}`);
|
|
43325
43326
|
}
|
|
43326
43327
|
if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
|
|
43327
43328
|
throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -44142,9 +44143,9 @@ var require_diagnostics = __commonJS({
|
|
|
44142
44143
|
"undici:client:sendHeaders",
|
|
44143
44144
|
(evt) => {
|
|
44144
44145
|
const {
|
|
44145
|
-
request: { method, path:
|
|
44146
|
+
request: { method, path: path98, origin }
|
|
44146
44147
|
} = evt;
|
|
44147
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
44148
|
+
debugLog("sending request to %s %s%s", method, origin, path98);
|
|
44148
44149
|
}
|
|
44149
44150
|
);
|
|
44150
44151
|
}
|
|
@@ -44162,14 +44163,14 @@ var require_diagnostics = __commonJS({
|
|
|
44162
44163
|
"undici:request:headers",
|
|
44163
44164
|
(evt) => {
|
|
44164
44165
|
const {
|
|
44165
|
-
request: { method, path:
|
|
44166
|
+
request: { method, path: path98, origin },
|
|
44166
44167
|
response: { statusCode }
|
|
44167
44168
|
} = evt;
|
|
44168
44169
|
debugLog(
|
|
44169
44170
|
"received response to %s %s%s - HTTP %d",
|
|
44170
44171
|
method,
|
|
44171
44172
|
origin,
|
|
44172
|
-
|
|
44173
|
+
path98,
|
|
44173
44174
|
statusCode
|
|
44174
44175
|
);
|
|
44175
44176
|
}
|
|
@@ -44178,23 +44179,23 @@ var require_diagnostics = __commonJS({
|
|
|
44178
44179
|
"undici:request:trailers",
|
|
44179
44180
|
(evt) => {
|
|
44180
44181
|
const {
|
|
44181
|
-
request: { method, path:
|
|
44182
|
+
request: { method, path: path98, origin }
|
|
44182
44183
|
} = evt;
|
|
44183
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
44184
|
+
debugLog("trailers received from %s %s%s", method, origin, path98);
|
|
44184
44185
|
}
|
|
44185
44186
|
);
|
|
44186
44187
|
diagnosticsChannel.subscribe(
|
|
44187
44188
|
"undici:request:error",
|
|
44188
44189
|
(evt) => {
|
|
44189
44190
|
const {
|
|
44190
|
-
request: { method, path:
|
|
44191
|
+
request: { method, path: path98, origin },
|
|
44191
44192
|
error: error63
|
|
44192
44193
|
} = evt;
|
|
44193
44194
|
debugLog(
|
|
44194
44195
|
"request to %s %s%s errored - %s",
|
|
44195
44196
|
method,
|
|
44196
44197
|
origin,
|
|
44197
|
-
|
|
44198
|
+
path98,
|
|
44198
44199
|
error63.message
|
|
44199
44200
|
);
|
|
44200
44201
|
}
|
|
@@ -44309,7 +44310,7 @@ var require_request = __commonJS({
|
|
|
44309
44310
|
var kHandler = /* @__PURE__ */ Symbol("handler");
|
|
44310
44311
|
var Request2 = class {
|
|
44311
44312
|
constructor(origin, {
|
|
44312
|
-
path:
|
|
44313
|
+
path: path98,
|
|
44313
44314
|
method,
|
|
44314
44315
|
body,
|
|
44315
44316
|
headers,
|
|
@@ -44326,11 +44327,11 @@ var require_request = __commonJS({
|
|
|
44326
44327
|
maxRedirections,
|
|
44327
44328
|
typeOfService
|
|
44328
44329
|
}, handler) {
|
|
44329
|
-
if (typeof
|
|
44330
|
+
if (typeof path98 !== "string") {
|
|
44330
44331
|
throw new InvalidArgumentError2("path must be a string");
|
|
44331
|
-
} else if (
|
|
44332
|
+
} else if (path98[0] !== "/" && !(path98.startsWith("http://") || path98.startsWith("https://")) && method !== "CONNECT") {
|
|
44332
44333
|
throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
|
|
44333
|
-
} else if (invalidPathRegex.test(
|
|
44334
|
+
} else if (invalidPathRegex.test(path98)) {
|
|
44334
44335
|
throw new InvalidArgumentError2("invalid request path");
|
|
44335
44336
|
}
|
|
44336
44337
|
if (typeof method !== "string") {
|
|
@@ -44405,7 +44406,7 @@ var require_request = __commonJS({
|
|
|
44405
44406
|
this.completed = false;
|
|
44406
44407
|
this.aborted = false;
|
|
44407
44408
|
this.upgrade = upgrade || null;
|
|
44408
|
-
this.path = query ? serializePathWithQuery(
|
|
44409
|
+
this.path = query ? serializePathWithQuery(path98, query) : path98;
|
|
44409
44410
|
this.origin = origin;
|
|
44410
44411
|
this.protocol = getProtocolFromUrlString(origin);
|
|
44411
44412
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -49630,7 +49631,7 @@ var require_client_h1 = __commonJS({
|
|
|
49630
49631
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
49631
49632
|
}
|
|
49632
49633
|
function writeH1(client, request7) {
|
|
49633
|
-
const { method, path:
|
|
49634
|
+
const { method, path: path98, host, upgrade, blocking, reset } = request7;
|
|
49634
49635
|
let { body, headers, contentLength } = request7;
|
|
49635
49636
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
49636
49637
|
if (util2.isFormDataLike(body)) {
|
|
@@ -49708,7 +49709,7 @@ var require_client_h1 = __commonJS({
|
|
|
49708
49709
|
if (socket.setTypeOfService) {
|
|
49709
49710
|
socket.setTypeOfService(request7.typeOfService);
|
|
49710
49711
|
}
|
|
49711
|
-
let header = `${method} ${
|
|
49712
|
+
let header = `${method} ${path98} HTTP/1.1\r
|
|
49712
49713
|
`;
|
|
49713
49714
|
if (typeof host === "string") {
|
|
49714
49715
|
header += `host: ${host}\r
|
|
@@ -50059,7 +50060,7 @@ var require_client_h2 = __commonJS({
|
|
|
50059
50060
|
"node_modules/.pnpm/undici@7.30.1/node_modules/undici/lib/dispatcher/client-h2.js"(exports2, module2) {
|
|
50060
50061
|
"use strict";
|
|
50061
50062
|
var assert2 = require("node:assert");
|
|
50062
|
-
var { pipeline } = require("node:stream");
|
|
50063
|
+
var { pipeline: pipeline2 } = require("node:stream");
|
|
50063
50064
|
var util2 = require_util2();
|
|
50064
50065
|
var {
|
|
50065
50066
|
RequestContentLengthMismatchError,
|
|
@@ -50385,7 +50386,7 @@ var require_client_h2 = __commonJS({
|
|
|
50385
50386
|
const headersTimeout = request7.headersTimeout ?? client[kHeadersTimeout];
|
|
50386
50387
|
const bodyTimeout = request7.bodyTimeout ?? client[kBodyTimeout];
|
|
50387
50388
|
const session = client[kHTTP2Session];
|
|
50388
|
-
const { method, path:
|
|
50389
|
+
const { method, path: path98, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
|
|
50389
50390
|
let { body } = request7;
|
|
50390
50391
|
if (upgrade != null && upgrade !== "websocket") {
|
|
50391
50392
|
util2.errorRequest(client, request7, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
@@ -50454,7 +50455,7 @@ var require_client_h2 = __commonJS({
|
|
|
50454
50455
|
}
|
|
50455
50456
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
50456
50457
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
50457
|
-
headers[HTTP2_HEADER_PATH] =
|
|
50458
|
+
headers[HTTP2_HEADER_PATH] = path98;
|
|
50458
50459
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
50459
50460
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
50460
50461
|
} else {
|
|
@@ -50506,7 +50507,7 @@ var require_client_h2 = __commonJS({
|
|
|
50506
50507
|
stream.setTimeout(headersTimeout);
|
|
50507
50508
|
return true;
|
|
50508
50509
|
}
|
|
50509
|
-
headers[HTTP2_HEADER_PATH] =
|
|
50510
|
+
headers[HTTP2_HEADER_PATH] = path98;
|
|
50510
50511
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
50511
50512
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
50512
50513
|
if (body && typeof body.read === "function") {
|
|
@@ -50731,7 +50732,7 @@ var require_client_h2 = __commonJS({
|
|
|
50731
50732
|
}
|
|
50732
50733
|
function writeStream(abort, socket, expectsPayload, h2stream, body, client, request7, contentLength) {
|
|
50733
50734
|
assert2(contentLength !== 0 || client[kRunning] === 0, "stream body cannot be pipelined");
|
|
50734
|
-
const pipe2 =
|
|
50735
|
+
const pipe2 = pipeline2(
|
|
50735
50736
|
body,
|
|
50736
50737
|
h2stream,
|
|
50737
50738
|
(err) => {
|
|
@@ -52862,10 +52863,10 @@ var require_proxy_agent = __commonJS({
|
|
|
52862
52863
|
};
|
|
52863
52864
|
const {
|
|
52864
52865
|
origin,
|
|
52865
|
-
path:
|
|
52866
|
+
path: path98 = "/",
|
|
52866
52867
|
headers = {}
|
|
52867
52868
|
} = opts;
|
|
52868
|
-
opts.path = origin +
|
|
52869
|
+
opts.path = origin + path98;
|
|
52869
52870
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
52870
52871
|
const { host } = new URL(origin);
|
|
52871
52872
|
headers.host = host;
|
|
@@ -54645,7 +54646,7 @@ var require_api_pipeline = __commonJS({
|
|
|
54645
54646
|
util2.destroy(ret, err);
|
|
54646
54647
|
}
|
|
54647
54648
|
};
|
|
54648
|
-
function
|
|
54649
|
+
function pipeline2(opts, handler) {
|
|
54649
54650
|
try {
|
|
54650
54651
|
const pipelineHandler = new PipelineHandler(opts, handler);
|
|
54651
54652
|
this.dispatch({ ...opts, body: pipelineHandler.req }, pipelineHandler);
|
|
@@ -54654,7 +54655,7 @@ var require_api_pipeline = __commonJS({
|
|
|
54654
54655
|
return new PassThrough2().destroy(err);
|
|
54655
54656
|
}
|
|
54656
54657
|
}
|
|
54657
|
-
module2.exports =
|
|
54658
|
+
module2.exports = pipeline2;
|
|
54658
54659
|
}
|
|
54659
54660
|
});
|
|
54660
54661
|
|
|
@@ -55025,20 +55026,20 @@ var require_mock_utils = __commonJS({
|
|
|
55025
55026
|
}
|
|
55026
55027
|
return normalizedQp;
|
|
55027
55028
|
}
|
|
55028
|
-
function safeUrl(
|
|
55029
|
-
if (typeof
|
|
55030
|
-
return
|
|
55029
|
+
function safeUrl(path98) {
|
|
55030
|
+
if (typeof path98 !== "string") {
|
|
55031
|
+
return path98;
|
|
55031
55032
|
}
|
|
55032
|
-
const pathSegments =
|
|
55033
|
+
const pathSegments = path98.split("?", 3);
|
|
55033
55034
|
if (pathSegments.length !== 2) {
|
|
55034
|
-
return
|
|
55035
|
+
return path98;
|
|
55035
55036
|
}
|
|
55036
55037
|
const qp2 = new URLSearchParams(pathSegments.pop());
|
|
55037
55038
|
qp2.sort();
|
|
55038
55039
|
return [...pathSegments, qp2.toString()].join("?");
|
|
55039
55040
|
}
|
|
55040
|
-
function matchKey(mockDispatch2, { path:
|
|
55041
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
55041
|
+
function matchKey(mockDispatch2, { path: path98, method, body, headers }) {
|
|
55042
|
+
const pathMatch = matchValue(mockDispatch2.path, path98);
|
|
55042
55043
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
55043
55044
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
55044
55045
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -55063,8 +55064,8 @@ var require_mock_utils = __commonJS({
|
|
|
55063
55064
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
55064
55065
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
55065
55066
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
55066
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
55067
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
55067
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path98, ignoreTrailingSlash }) => {
|
|
55068
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path98)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path98), resolvedPath);
|
|
55068
55069
|
});
|
|
55069
55070
|
if (matchedMockDispatches.length === 0) {
|
|
55070
55071
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -55103,19 +55104,19 @@ var require_mock_utils = __commonJS({
|
|
|
55103
55104
|
mockDispatches.splice(index, 1);
|
|
55104
55105
|
}
|
|
55105
55106
|
}
|
|
55106
|
-
function removeTrailingSlash(
|
|
55107
|
-
while (
|
|
55108
|
-
|
|
55107
|
+
function removeTrailingSlash(path98) {
|
|
55108
|
+
while (path98.endsWith("/")) {
|
|
55109
|
+
path98 = path98.slice(0, -1);
|
|
55109
55110
|
}
|
|
55110
|
-
if (
|
|
55111
|
-
|
|
55111
|
+
if (path98.length === 0) {
|
|
55112
|
+
path98 = "/";
|
|
55112
55113
|
}
|
|
55113
|
-
return
|
|
55114
|
+
return path98;
|
|
55114
55115
|
}
|
|
55115
55116
|
function buildKey(opts) {
|
|
55116
|
-
const { path:
|
|
55117
|
+
const { path: path98, method, body, headers, query } = opts;
|
|
55117
55118
|
return {
|
|
55118
|
-
path:
|
|
55119
|
+
path: path98,
|
|
55119
55120
|
method,
|
|
55120
55121
|
body,
|
|
55121
55122
|
headers,
|
|
@@ -55805,10 +55806,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
55805
55806
|
}
|
|
55806
55807
|
format(pendingInterceptors) {
|
|
55807
55808
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
55808
|
-
({ method, path:
|
|
55809
|
+
({ method, path: path98, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
55809
55810
|
Method: method,
|
|
55810
55811
|
Origin: origin,
|
|
55811
|
-
Path:
|
|
55812
|
+
Path: path98,
|
|
55812
55813
|
"Status code": statusCode,
|
|
55813
55814
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
55814
55815
|
Invocations: timesInvoked,
|
|
@@ -55890,9 +55891,9 @@ var require_mock_agent = __commonJS({
|
|
|
55890
55891
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
55891
55892
|
const dispatchOpts = { ...opts };
|
|
55892
55893
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
55893
|
-
const [
|
|
55894
|
+
const [path98, searchParams] = dispatchOpts.path.split("?");
|
|
55894
55895
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
55895
|
-
dispatchOpts.path = `${
|
|
55896
|
+
dispatchOpts.path = `${path98}?${normalizedSearchParams}`;
|
|
55896
55897
|
}
|
|
55897
55898
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
55898
55899
|
}
|
|
@@ -56293,12 +56294,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
56293
56294
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
56294
56295
|
*/
|
|
56295
56296
|
async loadSnapshots(filePath) {
|
|
56296
|
-
const
|
|
56297
|
-
if (!
|
|
56297
|
+
const path98 = filePath || this.#snapshotPath;
|
|
56298
|
+
if (!path98) {
|
|
56298
56299
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
56299
56300
|
}
|
|
56300
56301
|
try {
|
|
56301
|
-
const data = await readFile(resolve3(
|
|
56302
|
+
const data = await readFile(resolve3(path98), "utf8");
|
|
56302
56303
|
const parsed = JSON.parse(data);
|
|
56303
56304
|
if (Array.isArray(parsed)) {
|
|
56304
56305
|
this.#snapshots.clear();
|
|
@@ -56312,7 +56313,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
56312
56313
|
if (error63.code === "ENOENT") {
|
|
56313
56314
|
this.#snapshots.clear();
|
|
56314
56315
|
} else {
|
|
56315
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
56316
|
+
throw new UndiciError(`Failed to load snapshots from ${path98}`, { cause: error63 });
|
|
56316
56317
|
}
|
|
56317
56318
|
}
|
|
56318
56319
|
}
|
|
@@ -56323,11 +56324,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
56323
56324
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
56324
56325
|
*/
|
|
56325
56326
|
async saveSnapshots(filePath) {
|
|
56326
|
-
const
|
|
56327
|
-
if (!
|
|
56327
|
+
const path98 = filePath || this.#snapshotPath;
|
|
56328
|
+
if (!path98) {
|
|
56328
56329
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
56329
56330
|
}
|
|
56330
|
-
const resolvedPath = resolve3(
|
|
56331
|
+
const resolvedPath = resolve3(path98);
|
|
56331
56332
|
await mkdir(dirname3(resolvedPath), { recursive: true });
|
|
56332
56333
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
56333
56334
|
hash: hash2,
|
|
@@ -56964,15 +56965,15 @@ var require_redirect_handler = __commonJS({
|
|
|
56964
56965
|
}
|
|
56965
56966
|
this.history[kRedirectCacheControl].push(headers["cache-control"]);
|
|
56966
56967
|
const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
56967
|
-
const
|
|
56968
|
-
const redirectUrlString = `${origin}${
|
|
56968
|
+
const path98 = search ? `${pathname}${search}` : pathname;
|
|
56969
|
+
const redirectUrlString = `${origin}${path98}`;
|
|
56969
56970
|
for (const historyUrl of this.history) {
|
|
56970
56971
|
if (historyUrl.toString() === redirectUrlString) {
|
|
56971
56972
|
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.`);
|
|
56972
56973
|
}
|
|
56973
56974
|
}
|
|
56974
56975
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
56975
|
-
this.opts.path =
|
|
56976
|
+
this.opts.path = path98;
|
|
56976
56977
|
this.opts.origin = origin;
|
|
56977
56978
|
this.opts.query = null;
|
|
56978
56979
|
}
|
|
@@ -58740,10 +58741,10 @@ var require_cache_handler = __commonJS({
|
|
|
58740
58741
|
}
|
|
58741
58742
|
return locationUrl.pathname + locationUrl.search;
|
|
58742
58743
|
}
|
|
58743
|
-
function deleteCachedUri(store, cacheKey,
|
|
58744
|
+
function deleteCachedUri(store, cacheKey, path98) {
|
|
58744
58745
|
deleteCachedValue(store, {
|
|
58745
58746
|
...cacheKey,
|
|
58746
|
-
path:
|
|
58747
|
+
path: path98
|
|
58747
58748
|
});
|
|
58748
58749
|
for (let i10 = 0; i10 < util2.safeHTTPMethods.length; i10++) {
|
|
58749
58750
|
const method = util2.safeHTTPMethods[i10];
|
|
@@ -58751,7 +58752,7 @@ var require_cache_handler = __commonJS({
|
|
|
58751
58752
|
deleteCachedValue(store, {
|
|
58752
58753
|
...cacheKey,
|
|
58753
58754
|
method,
|
|
58754
|
-
path:
|
|
58755
|
+
path: path98
|
|
58755
58756
|
});
|
|
58756
58757
|
}
|
|
58757
58758
|
}
|
|
@@ -58762,9 +58763,9 @@ var require_cache_handler = __commonJS({
|
|
|
58762
58763
|
}
|
|
58763
58764
|
const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
|
|
58764
58765
|
for (let i10 = 0; i10 < values.length; i10++) {
|
|
58765
|
-
const
|
|
58766
|
-
if (
|
|
58767
|
-
deleteCachedUri(store, cacheKey,
|
|
58766
|
+
const path98 = getSameOriginPath(cacheKey, values[i10]);
|
|
58767
|
+
if (path98 !== void 0) {
|
|
58768
|
+
deleteCachedUri(store, cacheKey, path98);
|
|
58768
58769
|
}
|
|
58769
58770
|
}
|
|
58770
58771
|
}
|
|
@@ -59931,7 +59932,7 @@ var require_decompress = __commonJS({
|
|
|
59931
59932
|
"node_modules/.pnpm/undici@7.30.1/node_modules/undici/lib/interceptor/decompress.js"(exports2, module2) {
|
|
59932
59933
|
"use strict";
|
|
59933
59934
|
var { createInflate: createInflate2, createGunzip: createGunzip2, createBrotliDecompress: createBrotliDecompress2, createZstdDecompress } = require("node:zlib");
|
|
59934
|
-
var { pipeline, Transform: TransformStream2 } = require("node:stream");
|
|
59935
|
+
var { pipeline: pipeline2, Transform: TransformStream2 } = require("node:stream");
|
|
59935
59936
|
var { InvalidArgumentError: InvalidArgumentError2, ResponseExceededMaxSizeError } = require_errors();
|
|
59936
59937
|
var DecoratorHandler = require_decorator_handler();
|
|
59937
59938
|
var { runtimeFeatures } = require_runtime_features();
|
|
@@ -60248,7 +60249,7 @@ var require_decompress = __commonJS({
|
|
|
60248
60249
|
#setupMultipleDecompressors() {
|
|
60249
60250
|
const lastDecompressor = this.#decompressors[this.#decompressors.length - 1];
|
|
60250
60251
|
this.#setupDecompressorEvents(lastDecompressor);
|
|
60251
|
-
|
|
60252
|
+
pipeline2(this.#decompressors, (err) => {
|
|
60252
60253
|
if (this.#terminated) {
|
|
60253
60254
|
return;
|
|
60254
60255
|
}
|
|
@@ -63078,7 +63079,7 @@ var require_fetch = __commonJS({
|
|
|
63078
63079
|
subresourceSet
|
|
63079
63080
|
} = require_constants4();
|
|
63080
63081
|
var EE2 = require("node:events");
|
|
63081
|
-
var { Readable: Readable3, pipeline, finished, isErrored, isReadable } = require("node:stream");
|
|
63082
|
+
var { Readable: Readable3, pipeline: pipeline2, finished, isErrored, isReadable } = require("node:stream");
|
|
63082
63083
|
var { addAbortListener, bufferToLowerCasedHeaderName } = require_util2();
|
|
63083
63084
|
var { dataURLProcessor, serializeAMimeType, minimizeSupportedMimeType } = require_data_url();
|
|
63084
63085
|
var { getGlobalDispatcher } = require_global2();
|
|
@@ -63975,11 +63976,11 @@ var require_fetch = __commonJS({
|
|
|
63975
63976
|
function dispatch({ body }) {
|
|
63976
63977
|
const url2 = requestCurrentURL(request7);
|
|
63977
63978
|
const agent = fetchParams.controller.dispatcher;
|
|
63978
|
-
const
|
|
63979
|
+
const path98 = url2.pathname + url2.search;
|
|
63979
63980
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
63980
63981
|
return new Promise((resolve3, reject) => agent.dispatch(
|
|
63981
63982
|
{
|
|
63982
|
-
path: hasTrailingQuestionMark ? `${
|
|
63983
|
+
path: hasTrailingQuestionMark ? `${path98}?` : path98,
|
|
63983
63984
|
origin: url2.origin,
|
|
63984
63985
|
method: request7.method,
|
|
63985
63986
|
body: agent.isMockActive ? request7.body && (request7.body.source || request7.body.stream) : body,
|
|
@@ -64069,7 +64070,7 @@ var require_fetch = __commonJS({
|
|
|
64069
64070
|
status,
|
|
64070
64071
|
statusText,
|
|
64071
64072
|
headersList,
|
|
64072
|
-
body: decoders.length ?
|
|
64073
|
+
body: decoders.length ? pipeline2(this.body, ...decoders, (err) => {
|
|
64073
64074
|
if (err) {
|
|
64074
64075
|
this.onError(err);
|
|
64075
64076
|
}
|
|
@@ -64926,9 +64927,9 @@ var require_util5 = __commonJS({
|
|
|
64926
64927
|
}
|
|
64927
64928
|
}
|
|
64928
64929
|
}
|
|
64929
|
-
function validateCookiePath(
|
|
64930
|
-
for (let i10 = 0; i10 <
|
|
64931
|
-
const code =
|
|
64930
|
+
function validateCookiePath(path98) {
|
|
64931
|
+
for (let i10 = 0; i10 < path98.length; ++i10) {
|
|
64932
|
+
const code = path98.charCodeAt(i10);
|
|
64932
64933
|
if (code < 32 || // exclude CTLs (0-31)
|
|
64933
64934
|
code > 126 || // exclude DEL and non-ascii
|
|
64934
64935
|
code === 59) {
|
|
@@ -67966,7 +67967,7 @@ ${value3}`;
|
|
|
67966
67967
|
var require_eventsource = __commonJS({
|
|
67967
67968
|
"node_modules/.pnpm/undici@7.30.1/node_modules/undici/lib/web/eventsource/eventsource.js"(exports2, module2) {
|
|
67968
67969
|
"use strict";
|
|
67969
|
-
var { pipeline } = require("node:stream");
|
|
67970
|
+
var { pipeline: pipeline2 } = require("node:stream");
|
|
67970
67971
|
var { fetching } = require_fetch();
|
|
67971
67972
|
var { makeRequest } = require_request2();
|
|
67972
67973
|
var { webidl } = require_webidl();
|
|
@@ -68126,7 +68127,7 @@ var require_eventsource = __commonJS({
|
|
|
68126
68127
|
));
|
|
68127
68128
|
}
|
|
68128
68129
|
});
|
|
68129
|
-
|
|
68130
|
+
pipeline2(
|
|
68130
68131
|
response.body.stream,
|
|
68131
68132
|
eventSourceStream,
|
|
68132
68133
|
(error63) => {
|
|
@@ -68364,11 +68365,11 @@ var require_undici = __commonJS({
|
|
|
68364
68365
|
if (typeof opts.path !== "string") {
|
|
68365
68366
|
throw new InvalidArgumentError2("invalid opts.path");
|
|
68366
68367
|
}
|
|
68367
|
-
let
|
|
68368
|
+
let path98 = opts.path;
|
|
68368
68369
|
if (!opts.path.startsWith("/")) {
|
|
68369
|
-
|
|
68370
|
+
path98 = `/${path98}`;
|
|
68370
68371
|
}
|
|
68371
|
-
url2 = new URL(util2.parseOrigin(url2).origin +
|
|
68372
|
+
url2 = new URL(util2.parseOrigin(url2).origin + path98);
|
|
68372
68373
|
} else {
|
|
68373
68374
|
if (!opts) {
|
|
68374
68375
|
opts = typeof url2 === "object" ? url2 : {};
|
|
@@ -113065,8 +113066,8 @@ var require_utils3 = __commonJS({
|
|
|
113065
113066
|
}
|
|
113066
113067
|
return ind;
|
|
113067
113068
|
}
|
|
113068
|
-
function removeDotSegments(
|
|
113069
|
-
let input2 =
|
|
113069
|
+
function removeDotSegments(path98) {
|
|
113070
|
+
let input2 = path98;
|
|
113070
113071
|
const output2 = [];
|
|
113071
113072
|
let nextSlash = -1;
|
|
113072
113073
|
let len = 0;
|
|
@@ -113140,11 +113141,11 @@ var require_utils3 = __commonJS({
|
|
|
113140
113141
|
}
|
|
113141
113142
|
return output2.join("");
|
|
113142
113143
|
}
|
|
113143
|
-
function removeDotSegmentsRelative(
|
|
113144
|
-
if (
|
|
113145
|
-
return removeDotSegments(
|
|
113144
|
+
function removeDotSegmentsRelative(path98) {
|
|
113145
|
+
if (path98 === "" || path98[0] === "/") {
|
|
113146
|
+
return removeDotSegments(path98);
|
|
113146
113147
|
}
|
|
113147
|
-
const segments =
|
|
113148
|
+
const segments = path98.split("/");
|
|
113148
113149
|
const last = segments.length - 1;
|
|
113149
113150
|
const output2 = [];
|
|
113150
113151
|
let trailingDirectory = false;
|
|
@@ -113507,8 +113508,8 @@ var require_schemes = __commonJS({
|
|
|
113507
113508
|
}
|
|
113508
113509
|
if (wsComponent.resourceName) {
|
|
113509
113510
|
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
113510
|
-
const
|
|
113511
|
-
wsComponent.path =
|
|
113511
|
+
const path98 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
113512
|
+
wsComponent.path = path98 && path98 !== "/" ? path98 : void 0;
|
|
113512
113513
|
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
113513
113514
|
wsComponent.resourceName = void 0;
|
|
113514
113515
|
}
|
|
@@ -117059,7 +117060,7 @@ var require_dist2 = __commonJS({
|
|
|
117059
117060
|
});
|
|
117060
117061
|
|
|
117061
117062
|
// src/cli.ts
|
|
117062
|
-
var
|
|
117063
|
+
var import_node_path97 = __toESM(require("node:path"), 1);
|
|
117063
117064
|
|
|
117064
117065
|
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
|
|
117065
117066
|
var CommanderError = class extends Error {
|
|
@@ -120172,9 +120173,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
120172
120173
|
* @param {string} [path]
|
|
120173
120174
|
* @return {(string|null|Command)}
|
|
120174
120175
|
*/
|
|
120175
|
-
executableDir(
|
|
120176
|
-
if (
|
|
120177
|
-
this._executableDir =
|
|
120176
|
+
executableDir(path98) {
|
|
120177
|
+
if (path98 === void 0) return this._executableDir;
|
|
120178
|
+
this._executableDir = path98;
|
|
120178
120179
|
return this;
|
|
120179
120180
|
}
|
|
120180
120181
|
/**
|
|
@@ -122502,7 +122503,7 @@ function statuslineChangeOf(options) {
|
|
|
122502
122503
|
return void 0;
|
|
122503
122504
|
}
|
|
122504
122505
|
const assignments = (options.statusline ?? []).map(parseStatuslineAssignment);
|
|
122505
|
-
return { set: Object.fromEntries(assignments.map(({ path:
|
|
122506
|
+
return { set: Object.fromEntries(assignments.map(({ path: path98, value: value3 }) => [path98, value3])), unset: options.unsetStatusline ?? [] };
|
|
122506
122507
|
}
|
|
122507
122508
|
function registerProfileCommand(program2, deps) {
|
|
122508
122509
|
const { paths } = deps;
|
|
@@ -127064,8 +127065,8 @@ function pathnameOf(url2) {
|
|
|
127064
127065
|
return new URL(url2 ?? "/", "http://127.0.0.1").pathname;
|
|
127065
127066
|
}
|
|
127066
127067
|
function isRcSessionExchange(url2) {
|
|
127067
|
-
const
|
|
127068
|
-
return
|
|
127068
|
+
const path98 = pathnameOf(url2);
|
|
127069
|
+
return path98 === RC_SESSIONS_PATH_PREFIX || path98.startsWith(`${RC_SESSIONS_PATH_PREFIX}/`);
|
|
127069
127070
|
}
|
|
127070
127071
|
var RC_SESSION_ID_PREFIX = "cse_";
|
|
127071
127072
|
var RC_IDLE_EXPIRY_MS = 45e3;
|
|
@@ -127603,8 +127604,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
|
|
|
127603
127604
|
function isRcReadFileEncoding(value3) {
|
|
127604
127605
|
return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value3);
|
|
127605
127606
|
}
|
|
127606
|
-
function buildRcReadFilePayload(requestId,
|
|
127607
|
-
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path:
|
|
127607
|
+
function buildRcReadFilePayload(requestId, path98, options) {
|
|
127608
|
+
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path98, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
|
|
127608
127609
|
}
|
|
127609
127610
|
function buildRcFileSuggestionsPayload(requestId, query) {
|
|
127610
127611
|
return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
|
|
@@ -127706,15 +127707,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
|
|
|
127706
127707
|
const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
|
|
127707
127708
|
return result.ok ? { ...result, requestId } : result;
|
|
127708
127709
|
}
|
|
127709
|
-
async function readRcSessionFile(deps, sessionId,
|
|
127710
|
-
if (
|
|
127710
|
+
async function readRcSessionFile(deps, sessionId, path98, options) {
|
|
127711
|
+
if (path98 === "") {
|
|
127711
127712
|
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" };
|
|
127712
127713
|
}
|
|
127713
127714
|
if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
|
|
127714
127715
|
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" };
|
|
127715
127716
|
}
|
|
127716
127717
|
const requestId = deps.newUuid();
|
|
127717
|
-
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId,
|
|
127718
|
+
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path98, options), `read ${path98} from session ${sessionId}`);
|
|
127718
127719
|
return result.ok ? { ...result, requestId } : result;
|
|
127719
127720
|
}
|
|
127720
127721
|
async function suggestRcSessionFiles(deps, sessionId, query) {
|
|
@@ -127897,11 +127898,11 @@ function createRcControlHandler(deps) {
|
|
|
127897
127898
|
path: "read-file",
|
|
127898
127899
|
read: (body) => {
|
|
127899
127900
|
const session = bodyString(body, "session");
|
|
127900
|
-
const
|
|
127901
|
+
const path98 = bodyString(body, "path");
|
|
127901
127902
|
const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
|
|
127902
127903
|
const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
|
|
127903
|
-
const refused2 = session === void 0 ||
|
|
127904
|
-
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,
|
|
127904
|
+
const refused2 = session === void 0 || path98 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
|
|
127905
|
+
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, path98, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
|
|
127905
127906
|
}
|
|
127906
127907
|
},
|
|
127907
127908
|
{
|
|
@@ -128211,9 +128212,9 @@ function requestIdOfBody(body) {
|
|
|
128211
128212
|
}
|
|
128212
128213
|
function frontDoorRcControl(transport, token) {
|
|
128213
128214
|
const headers = { authorization: `Bearer ${token}` };
|
|
128214
|
-
const listAnswerOf = async (
|
|
128215
|
+
const listAnswerOf = async (path98, what) => {
|
|
128215
128216
|
try {
|
|
128216
|
-
return await transport.request({ method: "GET", path:
|
|
128217
|
+
return await transport.request({ method: "GET", path: path98, headers });
|
|
128217
128218
|
} catch (error63) {
|
|
128218
128219
|
throw new Error(`${what}: could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}`, { cause: error63 });
|
|
128219
128220
|
}
|
|
@@ -128285,10 +128286,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
128285
128286
|
}
|
|
128286
128287
|
return pending;
|
|
128287
128288
|
};
|
|
128288
|
-
const writeOf = async (
|
|
128289
|
+
const writeOf = async (path98, body, describeFailure2) => {
|
|
128289
128290
|
let answer;
|
|
128290
128291
|
try {
|
|
128291
|
-
answer = await transport.request({ method: "POST", path:
|
|
128292
|
+
answer = await transport.request({ method: "POST", path: path98, headers: { ...headers, "content-type": "application/json" }, body });
|
|
128292
128293
|
} catch (error63) {
|
|
128293
128294
|
return { ok: false, message: `could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}` };
|
|
128294
128295
|
}
|
|
@@ -128319,10 +128320,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
128319
128320
|
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}`),
|
|
128320
128321
|
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}`),
|
|
128321
128322
|
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}`),
|
|
128322
|
-
readFile: async (sessionId,
|
|
128323
|
+
readFile: async (sessionId, path98, options) => await writeOf(
|
|
128323
128324
|
`${CONTROL_PATH_PREFIX}/read-file`,
|
|
128324
|
-
JSON.stringify({ session: sessionId, path:
|
|
128325
|
-
(status, message) => `reading ${
|
|
128325
|
+
JSON.stringify({ session: sessionId, path: path98, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
|
|
128326
|
+
(status, message) => `reading ${path98} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
|
|
128326
128327
|
),
|
|
128327
128328
|
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}`),
|
|
128328
128329
|
keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
|
|
@@ -128340,7 +128341,7 @@ var HEALTH_START_BUDGET_MS = 5e3;
|
|
|
128340
128341
|
var HEALTH_RETRY_MS = 50;
|
|
128341
128342
|
var PREFERRED_PORT_MAX_ATTEMPTS = 6;
|
|
128342
128343
|
var PREFERRED_PORT_RETRY_MS = 50;
|
|
128343
|
-
function createFrontDoorServer(
|
|
128344
|
+
function createFrontDoorServer(pipeline2, log, tls2, control, apis) {
|
|
128344
128345
|
const handler = (request7, response) => {
|
|
128345
128346
|
if (request7.method === "GET" && request7.url === "/healthz") {
|
|
128346
128347
|
response.writeHead(HTTP_STATUS.ok, { "Content-Type": "text/plain" });
|
|
@@ -128376,7 +128377,7 @@ function createFrontDoorServer(pipeline, log, tls2, control, apis) {
|
|
|
128376
128377
|
}
|
|
128377
128378
|
});
|
|
128378
128379
|
const handle = async () => {
|
|
128379
|
-
await
|
|
128380
|
+
await pipeline2({ method: request7.method ?? "GET", url: request7.url ?? "/", headers: aliasLegacyWireHeaders(request7.headers), body: request7, signal: abort.signal, response });
|
|
128380
128381
|
if (!request7.readableEnded) {
|
|
128381
128382
|
request7.resume();
|
|
128382
128383
|
}
|
|
@@ -128728,12 +128729,12 @@ function tlsFacts(options) {
|
|
|
128728
128729
|
}
|
|
128729
128730
|
function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
128730
128731
|
const agent = new ExemptTlsAgent();
|
|
128731
|
-
const post = async (
|
|
128732
|
+
const post = async (path98, headers, body) => await new Promise((resolve3, reject) => {
|
|
128732
128733
|
const options = {
|
|
128733
128734
|
host: target.host,
|
|
128734
128735
|
port: target.port,
|
|
128735
128736
|
method: "POST",
|
|
128736
|
-
path:
|
|
128737
|
+
path: path98,
|
|
128737
128738
|
// 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.
|
|
128738
128739
|
headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
|
|
128739
128740
|
agent
|
|
@@ -128798,12 +128799,12 @@ function lateRcStreamDial(resolve3) {
|
|
|
128798
128799
|
}
|
|
128799
128800
|
function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
128800
128801
|
const agent = new ExemptTlsAgent();
|
|
128801
|
-
const request7 = async (method,
|
|
128802
|
+
const request7 = async (method, path98, headers, body, signal) => await new Promise((resolve3, reject) => {
|
|
128802
128803
|
const options = {
|
|
128803
128804
|
host: target.host,
|
|
128804
128805
|
port: target.port,
|
|
128805
128806
|
method,
|
|
128806
|
-
path:
|
|
128807
|
+
path: path98,
|
|
128807
128808
|
// 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.
|
|
128808
128809
|
headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
|
|
128809
128810
|
agent,
|
|
@@ -128845,9 +128846,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
|
|
|
128845
128846
|
return { status, body: await readAll(response) };
|
|
128846
128847
|
},
|
|
128847
128848
|
openStream: async (sessionId, headers, resume, signal) => {
|
|
128848
|
-
const
|
|
128849
|
+
const path98 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
|
|
128849
128850
|
const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
|
|
128850
|
-
const { status, response } = await request7("GET",
|
|
128851
|
+
const { status, response } = await request7("GET", path98, streamHeaders, void 0, signal);
|
|
128851
128852
|
if (!isSuccessful2(status)) {
|
|
128852
128853
|
await readAll(response);
|
|
128853
128854
|
return { status, chunks: NO_CHUNKS };
|
|
@@ -130527,8 +130528,8 @@ function once(fn) {
|
|
|
130527
130528
|
return result;
|
|
130528
130529
|
};
|
|
130529
130530
|
}
|
|
130530
|
-
function pathToHttpPath(
|
|
130531
|
-
return `/${
|
|
130531
|
+
function pathToHttpPath(path98) {
|
|
130532
|
+
return `/${path98.map(safeEncodeURIComponent).join("/")}`;
|
|
130532
130533
|
}
|
|
130533
130534
|
var TRACER_SYMBOL = /* @__PURE__ */ Symbol.for("ORPC_TRACER");
|
|
130534
130535
|
function getTracer() {
|
|
@@ -131807,7 +131808,7 @@ function resolveClientRest(rest) {
|
|
|
131807
131808
|
// rest[1] can be undefined if all fields of FriendlyClientOptions are optional
|
|
131808
131809
|
];
|
|
131809
131810
|
}
|
|
131810
|
-
function createORPCClient(link, { path:
|
|
131811
|
+
function createORPCClient(link, { path: path98 = [], ...options } = {}) {
|
|
131811
131812
|
const procedureClient = (...rest) => {
|
|
131812
131813
|
const [input2, callOptions] = resolveClientRest(rest);
|
|
131813
131814
|
const interceptors = [
|
|
@@ -131816,7 +131817,7 @@ function createORPCClient(link, { path: path97 = [], ...options } = {}) {
|
|
|
131816
131817
|
];
|
|
131817
131818
|
return intercept(
|
|
131818
131819
|
interceptors,
|
|
131819
|
-
{ ...callOptions, input: input2, path:
|
|
131820
|
+
{ ...callOptions, input: input2, path: path98 },
|
|
131820
131821
|
({ path: path210, input: input22, ...callOptions2 }) => link.call(path210, input22, callOptions2)
|
|
131821
131822
|
);
|
|
131822
131823
|
};
|
|
@@ -131830,7 +131831,7 @@ function createORPCClient(link, { path: path97 = [], ...options } = {}) {
|
|
|
131830
131831
|
if (client === void 0) {
|
|
131831
131832
|
client = createORPCClient(link, {
|
|
131832
131833
|
...options,
|
|
131833
|
-
path: [...
|
|
131834
|
+
path: [...path98, key],
|
|
131834
131835
|
scoped: options.scoped?.[key]
|
|
131835
131836
|
});
|
|
131836
131837
|
cache.set(key, client);
|
|
@@ -132071,11 +132072,11 @@ function tryOrUndefined(fn) {
|
|
|
132071
132072
|
return void 0;
|
|
132072
132073
|
}
|
|
132073
132074
|
}
|
|
132074
|
-
function pathToHttpPath2(
|
|
132075
|
-
return `/${
|
|
132075
|
+
function pathToHttpPath2(path98) {
|
|
132076
|
+
return `/${path98.map(safeEncodeURIComponent2).join("/")}`;
|
|
132076
132077
|
}
|
|
132077
|
-
function normalizeHttpPath(
|
|
132078
|
-
const paths =
|
|
132078
|
+
function normalizeHttpPath(path98) {
|
|
132079
|
+
const paths = path98.split("/");
|
|
132079
132080
|
if (paths.at(0) === "") {
|
|
132080
132081
|
paths.shift();
|
|
132081
132082
|
}
|
|
@@ -132260,9 +132261,9 @@ function isPlainObject4(value3) {
|
|
|
132260
132261
|
function getOwn(object3, key) {
|
|
132261
132262
|
return Object.hasOwn(object3, key) ? object3[key] : void 0;
|
|
132262
132263
|
}
|
|
132263
|
-
function get(object3,
|
|
132264
|
+
function get(object3, path98) {
|
|
132264
132265
|
let current = object3;
|
|
132265
|
-
for (const key of
|
|
132266
|
+
for (const key of path98) {
|
|
132266
132267
|
if (!isTypescriptObject2(current)) {
|
|
132267
132268
|
return void 0;
|
|
132268
132269
|
}
|
|
@@ -132503,25 +132504,25 @@ var BracketNotationSerializer = class {
|
|
|
132503
132504
|
this.internalSerialize(data, "", true, result);
|
|
132504
132505
|
return result;
|
|
132505
132506
|
}
|
|
132506
|
-
internalSerialize(data,
|
|
132507
|
+
internalSerialize(data, path98, isRoot, result) {
|
|
132507
132508
|
if (Array.isArray(data)) {
|
|
132508
132509
|
data.forEach((item, i10) => {
|
|
132509
|
-
this.internalSerialize(item, isRoot ? i10.toString() : `${
|
|
132510
|
+
this.internalSerialize(item, isRoot ? i10.toString() : `${path98}[${i10}]`, false, result);
|
|
132510
132511
|
});
|
|
132511
132512
|
} else if (isPlainObject4(data)) {
|
|
132512
132513
|
for (const key of Object.keys(data)) {
|
|
132513
|
-
this.internalSerialize(data[key], isRoot ? key : `${
|
|
132514
|
+
this.internalSerialize(data[key], isRoot ? key : `${path98}[${key}]`, false, result);
|
|
132514
132515
|
}
|
|
132515
132516
|
} else {
|
|
132516
|
-
result.push([
|
|
132517
|
+
result.push([path98, data]);
|
|
132517
132518
|
}
|
|
132518
132519
|
}
|
|
132519
132520
|
deserialize(serialized) {
|
|
132520
132521
|
let arrayPushStyles;
|
|
132521
132522
|
const root = new NullProtoObj2();
|
|
132522
132523
|
let emptySlotsLeft = this.maxDeserializingEmptySlots;
|
|
132523
|
-
for (const [
|
|
132524
|
-
const segments = this.parsePath(
|
|
132524
|
+
for (const [path98, value3] of serialized) {
|
|
132525
|
+
const segments = this.parsePath(path98);
|
|
132525
132526
|
let currentRef = root;
|
|
132526
132527
|
let nextSegment = segments[0];
|
|
132527
132528
|
for (let i10 = 1; i10 < segments.length; i10++) {
|
|
@@ -132581,20 +132582,20 @@ var BracketNotationSerializer = class {
|
|
|
132581
132582
|
}
|
|
132582
132583
|
return result;
|
|
132583
132584
|
}
|
|
132584
|
-
parsePath(
|
|
132585
|
-
const start =
|
|
132586
|
-
if (start === -1 ||
|
|
132587
|
-
return [
|
|
132585
|
+
parsePath(path98) {
|
|
132586
|
+
const start = path98.indexOf("[");
|
|
132587
|
+
if (start === -1 || path98[path98.length - 1] !== "]") {
|
|
132588
|
+
return [path98];
|
|
132588
132589
|
}
|
|
132589
|
-
const segments = [
|
|
132590
|
+
const segments = [path98.slice(0, start)];
|
|
132590
132591
|
let from = start + 1;
|
|
132591
|
-
let to2 =
|
|
132592
|
+
let to2 = path98.indexOf("][", from);
|
|
132592
132593
|
while (to2 !== -1) {
|
|
132593
|
-
segments.push(
|
|
132594
|
+
segments.push(path98.slice(from, to2));
|
|
132594
132595
|
from = to2 + 2;
|
|
132595
|
-
to2 =
|
|
132596
|
+
to2 = path98.indexOf("][", from);
|
|
132596
132597
|
}
|
|
132597
|
-
segments.push(
|
|
132598
|
+
segments.push(path98.slice(from, -1));
|
|
132598
132599
|
return segments;
|
|
132599
132600
|
}
|
|
132600
132601
|
};
|
|
@@ -134092,11 +134093,11 @@ var OpenAPISerializer = class {
|
|
|
134092
134093
|
return json2;
|
|
134093
134094
|
}
|
|
134094
134095
|
const form = new FormData();
|
|
134095
|
-
for (const [
|
|
134096
|
+
for (const [path98, value22] of this.bracketNotation.serialize(json2)) {
|
|
134096
134097
|
if (value22 instanceof Blob) {
|
|
134097
|
-
form.append(
|
|
134098
|
+
form.append(path98, value22);
|
|
134098
134099
|
} else if (value22 !== void 0 && value22 !== null) {
|
|
134099
|
-
form.append(
|
|
134100
|
+
form.append(path98, String(value22));
|
|
134100
134101
|
}
|
|
134101
134102
|
}
|
|
134102
134103
|
return form;
|
|
@@ -134134,30 +134135,30 @@ function isBodylessMethod(method) {
|
|
|
134134
134135
|
return method === "GET" || method === "HEAD";
|
|
134135
134136
|
}
|
|
134136
134137
|
var PARAMETER_NAME_REGEX = /^[\w-]+$/;
|
|
134137
|
-
function getDynamicPathParams(
|
|
134138
|
-
if (!
|
|
134138
|
+
function getDynamicPathParams(path98) {
|
|
134139
|
+
if (!path98.includes("{")) {
|
|
134139
134140
|
return void 0;
|
|
134140
134141
|
}
|
|
134141
|
-
const len =
|
|
134142
|
+
const len = path98.length;
|
|
134142
134143
|
let params;
|
|
134143
134144
|
let index = 1;
|
|
134144
134145
|
while (index < len) {
|
|
134145
134146
|
const segmentStart = index;
|
|
134146
|
-
const slashPos =
|
|
134147
|
+
const slashPos = path98.indexOf("/", index);
|
|
134147
134148
|
const segmentEnd = slashPos === -1 ? len : slashPos;
|
|
134148
|
-
if (segmentEnd > segmentStart &&
|
|
134149
|
+
if (segmentEnd > segmentStart && path98.charCodeAt(segmentStart) === 123 && path98.charCodeAt(segmentEnd - 1) === 125) {
|
|
134149
134150
|
let parameterStart = segmentStart + 1;
|
|
134150
134151
|
let allowsSlash = false;
|
|
134151
|
-
const operator =
|
|
134152
|
+
const operator = path98.charCodeAt(parameterStart);
|
|
134152
134153
|
if (operator === 43) {
|
|
134153
134154
|
allowsSlash = true;
|
|
134154
134155
|
parameterStart++;
|
|
134155
134156
|
}
|
|
134156
|
-
const parameterName =
|
|
134157
|
+
const parameterName = path98.slice(parameterStart, segmentEnd - 1);
|
|
134157
134158
|
if (PARAMETER_NAME_REGEX.test(parameterName)) {
|
|
134158
134159
|
params ??= [];
|
|
134159
134160
|
params.push({
|
|
134160
|
-
segment:
|
|
134161
|
+
segment: path98.slice(segmentStart, segmentEnd),
|
|
134161
134162
|
startIndex: segmentStart,
|
|
134162
134163
|
parameterName,
|
|
134163
134164
|
allowsSlash
|
|
@@ -134200,8 +134201,8 @@ openapi.method = (method) => ({
|
|
|
134200
134201
|
...openapi({ method }),
|
|
134201
134202
|
name: "~openapi/method"
|
|
134202
134203
|
});
|
|
134203
|
-
openapi.path = (
|
|
134204
|
-
...openapi({ path:
|
|
134204
|
+
openapi.path = (path98) => ({
|
|
134205
|
+
...openapi({ path: path98 }),
|
|
134205
134206
|
name: "~openapi/path"
|
|
134206
134207
|
});
|
|
134207
134208
|
openapi.spec = (spec) => ({
|
|
@@ -135120,22 +135121,22 @@ function visitJsonSchemaRefs(value3, visit2, schemaLevel = true, seen = /* @__PU
|
|
|
135120
135121
|
}
|
|
135121
135122
|
}
|
|
135122
135123
|
}
|
|
135123
|
-
function mapJsonSchemaRefs(value3, map3, schemaLevel = true,
|
|
135124
|
+
function mapJsonSchemaRefs(value3, map3, schemaLevel = true, path98 = []) {
|
|
135124
135125
|
if (!value3 || typeof value3 !== "object") {
|
|
135125
135126
|
return value3;
|
|
135126
135127
|
}
|
|
135127
135128
|
if (Array.isArray(value3)) {
|
|
135128
|
-
return value3.map((item, index) => mapJsonSchemaRefs(item, map3, schemaLevel, [...
|
|
135129
|
+
return value3.map((item, index) => mapJsonSchemaRefs(item, map3, schemaLevel, [...path98, index]));
|
|
135129
135130
|
}
|
|
135130
135131
|
const result = {};
|
|
135131
135132
|
for (const key of Object.keys(value3)) {
|
|
135132
135133
|
const val = value3[key];
|
|
135133
135134
|
if (key === "$ref" && typeof val === "string") {
|
|
135134
|
-
setOwn2(result, key, map3(val, [...
|
|
135135
|
+
setOwn2(result, key, map3(val, [...path98, key]));
|
|
135135
135136
|
} else if (!schemaLevel) {
|
|
135136
|
-
setOwn2(result, key, mapJsonSchemaRefs(val, map3, true, [...
|
|
135137
|
+
setOwn2(result, key, mapJsonSchemaRefs(val, map3, true, [...path98, key]));
|
|
135137
135138
|
} else if (JSON_SCHEMA_LOGIC_KEYWORDS.has(key) || JSON_SCHEMA_RECORD_KEYWORDS.has(key)) {
|
|
135138
|
-
setOwn2(result, key, mapJsonSchemaRefs(val, map3, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...
|
|
135139
|
+
setOwn2(result, key, mapJsonSchemaRefs(val, map3, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path98, key]));
|
|
135139
135140
|
} else {
|
|
135140
135141
|
setOwn2(result, key, val);
|
|
135141
135142
|
}
|
|
@@ -135665,7 +135666,7 @@ function unlazy(maybeLazy) {
|
|
|
135665
135666
|
function createProcedureClient(lazyableProcedure, ...rest) {
|
|
135666
135667
|
const options = resolveMaybeOptionalOptions2(rest);
|
|
135667
135668
|
return async (...[input2, callerOptions]) => {
|
|
135668
|
-
const
|
|
135669
|
+
const path98 = toArray2(options.path);
|
|
135669
135670
|
const { default: procedure } = await unlazy(lazyableProcedure);
|
|
135670
135671
|
const clientContext = callerOptions?.context ?? {};
|
|
135671
135672
|
const context = await value2(options.context, clientContext) ?? {};
|
|
@@ -135678,7 +135679,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
135678
135679
|
};
|
|
135679
135680
|
try {
|
|
135680
135681
|
const output2 = await runWithSpan2("call_procedure", (span) => {
|
|
135681
|
-
span?.setAttribute("procedure.path",
|
|
135682
|
+
span?.setAttribute("procedure.path", path98);
|
|
135682
135683
|
return intercept2(
|
|
135683
135684
|
options.interceptors,
|
|
135684
135685
|
{
|
|
@@ -135686,7 +135687,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
135686
135687
|
// input can be optional if it is undefinable
|
|
135687
135688
|
input: input2,
|
|
135688
135689
|
errors,
|
|
135689
|
-
path:
|
|
135690
|
+
path: path98,
|
|
135690
135691
|
procedure,
|
|
135691
135692
|
signal: callerOptions?.signal,
|
|
135692
135693
|
lastEventId: callerOptions?.lastEventId
|
|
@@ -135937,10 +135938,10 @@ function augmentRouter(router, options) {
|
|
|
135937
135938
|
}
|
|
135938
135939
|
return enhanced;
|
|
135939
135940
|
}
|
|
135940
|
-
function getRouter(router,
|
|
135941
|
+
function getRouter(router, path98) {
|
|
135941
135942
|
let current = router;
|
|
135942
|
-
for (let i10 = 0; i10 <
|
|
135943
|
-
const segment =
|
|
135943
|
+
for (let i10 = 0; i10 < path98.length; i10++) {
|
|
135944
|
+
const segment = path98[i10];
|
|
135944
135945
|
if (!isTypescriptObject2(current)) {
|
|
135945
135946
|
return void 0;
|
|
135946
135947
|
}
|
|
@@ -135952,7 +135953,7 @@ function getRouter(router, path97) {
|
|
|
135952
135953
|
continue;
|
|
135953
135954
|
}
|
|
135954
135955
|
const lazied = current;
|
|
135955
|
-
const rest =
|
|
135956
|
+
const rest = path98.slice(i10);
|
|
135956
135957
|
return new Lazy({
|
|
135957
135958
|
...lazied["~orpc"],
|
|
135958
135959
|
async loader() {
|
|
@@ -135967,40 +135968,40 @@ function getRouter(router, path97) {
|
|
|
135967
135968
|
}
|
|
135968
135969
|
return current;
|
|
135969
135970
|
}
|
|
135970
|
-
function walkProcedureContractsSync(router, callback,
|
|
135971
|
+
function walkProcedureContractsSync(router, callback, path98 = []) {
|
|
135971
135972
|
const lazyResults = [];
|
|
135972
|
-
walkProcedureContractsSyncInternal(router, callback,
|
|
135973
|
+
walkProcedureContractsSyncInternal(router, callback, path98.slice(), lazyResults);
|
|
135973
135974
|
return lazyResults;
|
|
135974
135975
|
}
|
|
135975
|
-
function walkProcedureContractsSyncInternal(router, callback,
|
|
135976
|
+
function walkProcedureContractsSyncInternal(router, callback, path98, lazyResults) {
|
|
135976
135977
|
const hiddenContract = getHiddenRouterContract(router);
|
|
135977
135978
|
if (hiddenContract !== void 0) {
|
|
135978
135979
|
router = hiddenContract;
|
|
135979
135980
|
}
|
|
135980
135981
|
if (router instanceof ProcedureContract) {
|
|
135981
|
-
callback(router,
|
|
135982
|
+
callback(router, path98.slice());
|
|
135982
135983
|
return;
|
|
135983
135984
|
}
|
|
135984
135985
|
if (!isTypescriptObject2(router)) {
|
|
135985
135986
|
return;
|
|
135986
135987
|
}
|
|
135987
135988
|
for (const [key, value3] of Object.entries(router)) {
|
|
135988
|
-
|
|
135989
|
+
path98.push(key);
|
|
135989
135990
|
if (value3 instanceof Lazy) {
|
|
135990
|
-
lazyResults.push({ router: value3, path:
|
|
135991
|
+
lazyResults.push({ router: value3, path: path98.slice() });
|
|
135991
135992
|
} else {
|
|
135992
|
-
walkProcedureContractsSyncInternal(value3, callback,
|
|
135993
|
+
walkProcedureContractsSyncInternal(value3, callback, path98, lazyResults);
|
|
135993
135994
|
}
|
|
135994
|
-
|
|
135995
|
+
path98.pop();
|
|
135995
135996
|
}
|
|
135996
135997
|
}
|
|
135997
|
-
async function walkProcedureContractsAsync(router, callback,
|
|
135998
|
+
async function walkProcedureContractsAsync(router, callback, path98 = []) {
|
|
135998
135999
|
const hiddenContract = getHiddenRouterContract(router);
|
|
135999
136000
|
if (hiddenContract !== void 0) {
|
|
136000
136001
|
router = hiddenContract;
|
|
136001
136002
|
}
|
|
136002
136003
|
if (router instanceof ProcedureContract) {
|
|
136003
|
-
await callback(router,
|
|
136004
|
+
await callback(router, path98);
|
|
136004
136005
|
return;
|
|
136005
136006
|
}
|
|
136006
136007
|
if (!isTypescriptObject2(router)) {
|
|
@@ -136009,9 +136010,9 @@ async function walkProcedureContractsAsync(router, callback, path97 = []) {
|
|
|
136009
136010
|
for (const [key, value3] of Object.entries(router)) {
|
|
136010
136011
|
if (value3 instanceof Lazy) {
|
|
136011
136012
|
const { default: router2 } = await unlazy(value3);
|
|
136012
|
-
await walkProcedureContractsAsync(router2, callback, [...
|
|
136013
|
+
await walkProcedureContractsAsync(router2, callback, [...path98, key]);
|
|
136013
136014
|
} else {
|
|
136014
|
-
await walkProcedureContractsAsync(value3, callback, [...
|
|
136015
|
+
await walkProcedureContractsAsync(value3, callback, [...path98, key]);
|
|
136015
136016
|
}
|
|
136016
136017
|
}
|
|
136017
136018
|
}
|
|
@@ -136497,18 +136498,18 @@ function rewriteComponentSchemaRefs(schema, renameMap) {
|
|
|
136497
136498
|
}
|
|
136498
136499
|
var OpenAPIGeneratorError = class extends TypeError {
|
|
136499
136500
|
};
|
|
136500
|
-
function toOpenAPIPath(
|
|
136501
|
+
function toOpenAPIPath(path98, dynamicPathParams) {
|
|
136501
136502
|
if (!dynamicPathParams?.length) {
|
|
136502
|
-
return
|
|
136503
|
+
return path98;
|
|
136503
136504
|
}
|
|
136504
136505
|
let normalized = "";
|
|
136505
136506
|
let currentIndex = 0;
|
|
136506
136507
|
for (const param of dynamicPathParams) {
|
|
136507
|
-
normalized +=
|
|
136508
|
+
normalized += path98.slice(currentIndex, param.startIndex);
|
|
136508
136509
|
normalized += `{${param.parameterName}}`;
|
|
136509
136510
|
currentIndex = param.startIndex + param.segment.length;
|
|
136510
136511
|
}
|
|
136511
|
-
normalized +=
|
|
136512
|
+
normalized += path98.slice(currentIndex);
|
|
136512
136513
|
return normalized;
|
|
136513
136514
|
}
|
|
136514
136515
|
function buildRequest(ctx, operation, def, meta3, dynamicPathParams) {
|
|
@@ -136965,8 +136966,8 @@ var OpenAPIGenerator = class {
|
|
|
136965
136966
|
customErrorResponseBodySchema: options.customErrorResponseBodySchema
|
|
136966
136967
|
};
|
|
136967
136968
|
const errors = [];
|
|
136968
|
-
await walkProcedureContractsAsync(router, (contract,
|
|
136969
|
-
if (value2(options.filter, contract,
|
|
136969
|
+
await walkProcedureContractsAsync(router, (contract, path98) => {
|
|
136970
|
+
if (value2(options.filter, contract, path98) === false) {
|
|
136970
136971
|
return;
|
|
136971
136972
|
}
|
|
136972
136973
|
try {
|
|
@@ -136978,7 +136979,7 @@ var OpenAPIGenerator = class {
|
|
|
136978
136979
|
`QUERY operations require OpenAPI 3.2, but version "${version2}" was requested.`
|
|
136979
136980
|
);
|
|
136980
136981
|
}
|
|
136981
|
-
const postPath = meta3?.path ?? pathToHttpPath2(
|
|
136982
|
+
const postPath = meta3?.path ?? pathToHttpPath2(path98);
|
|
136982
136983
|
const httpPath = meta3?.prefix ? mergeHttpPath(meta3.prefix, postPath) : postPath;
|
|
136983
136984
|
const dynamicPathParams = getDynamicPathParams(httpPath);
|
|
136984
136985
|
const openApiPath = toOpenAPIPath(httpPath, dynamicPathParams);
|
|
@@ -136987,7 +136988,7 @@ var OpenAPIGenerator = class {
|
|
|
136987
136988
|
operation = meta3.spec;
|
|
136988
136989
|
} else {
|
|
136989
136990
|
operation = {
|
|
136990
|
-
operationId: meta3?.operationId ??
|
|
136991
|
+
operationId: meta3?.operationId ?? path98.join("."),
|
|
136991
136992
|
summary: meta3?.summary,
|
|
136992
136993
|
description: meta3?.description,
|
|
136993
136994
|
deprecated: meta3?.deprecated,
|
|
@@ -137007,7 +137008,7 @@ var OpenAPIGenerator = class {
|
|
|
137007
137008
|
if (!(e10 instanceof OpenAPIGeneratorError)) {
|
|
137008
137009
|
throw e10;
|
|
137009
137010
|
}
|
|
137010
|
-
errors.push(`Procedure at ${
|
|
137011
|
+
errors.push(`Procedure at ${path98.join(".") || "(root)"}: ${e10.message}`);
|
|
137011
137012
|
}
|
|
137012
137013
|
});
|
|
137013
137014
|
if (errors.length) {
|
|
@@ -137793,16 +137794,16 @@ var StandardLink = class {
|
|
|
137793
137794
|
/**
|
|
137794
137795
|
* @throws ORPCError, MalformedResponseError, transport-level errors (network failures, timeouts, etc.)
|
|
137795
137796
|
*/
|
|
137796
|
-
call(
|
|
137797
|
-
return runWithSpan(`${ORPC_NAME}.${
|
|
137797
|
+
call(path98, input2, options) {
|
|
137798
|
+
return runWithSpan(`${ORPC_NAME}.${path98.join("/")}`, (span) => {
|
|
137798
137799
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
137799
|
-
span?.setAttribute("rpc.method",
|
|
137800
|
+
span?.setAttribute("rpc.method", path98.join("."));
|
|
137800
137801
|
if (getTracer() && isAsyncIteratorObject(input2)) {
|
|
137801
137802
|
input2 = override(input2, traceAsyncIterator("consume_async_iterator_object_input", input2));
|
|
137802
137803
|
} else if (getTracer() && input2 instanceof ReadableStream) {
|
|
137803
137804
|
input2 = override(input2, traceReadableStream("consume_octet_stream_input", input2));
|
|
137804
137805
|
}
|
|
137805
|
-
return intercept(this.interceptors, { ...options, path:
|
|
137806
|
+
return intercept(this.interceptors, { ...options, path: path98, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
|
|
137806
137807
|
const tracer = getTracer();
|
|
137807
137808
|
const activeSpan = tracer?.getActiveSpan() ?? span;
|
|
137808
137809
|
let request7 = await runWithSpan(
|
|
@@ -137859,18 +137860,18 @@ var RPCLinkCodec = class {
|
|
|
137859
137860
|
this.headers = options.headers ?? {};
|
|
137860
137861
|
this.serializer = options.serializer ?? new RPCSerializer();
|
|
137861
137862
|
}
|
|
137862
|
-
async encodeInput(input2,
|
|
137863
|
-
let headers = toResolvedStandardHeaders(await value(this.headers, options,
|
|
137863
|
+
async encodeInput(input2, path98, options) {
|
|
137864
|
+
let headers = toResolvedStandardHeaders(await value(this.headers, options, path98, input2));
|
|
137864
137865
|
if (options.lastEventId !== void 0) {
|
|
137865
137866
|
headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
|
|
137866
137867
|
}
|
|
137867
|
-
const expectedMethod = await value(this.expectedMethod, options,
|
|
137868
|
-
const baseUrl = await value(this.baseUrl, options,
|
|
137868
|
+
const expectedMethod = await value(this.expectedMethod, options, path98, input2);
|
|
137869
|
+
const baseUrl = await value(this.baseUrl, options, path98, input2);
|
|
137869
137870
|
const [pathname, search, hash2] = parseStandardUrl(baseUrl);
|
|
137870
|
-
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(
|
|
137871
|
+
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path98)}`;
|
|
137871
137872
|
const serialized = this.serializer.serialize(input2);
|
|
137872
137873
|
if (expectedMethod === "GET" && !(serialized instanceof Blob) && !(serialized instanceof ReadableStream) && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
|
|
137873
|
-
const maxUrlLength = await value(this.maxUrlLength, options,
|
|
137874
|
+
const maxUrlLength = await value(this.maxUrlLength, options, path98, input2);
|
|
137874
137875
|
const mergedSearch = new URLSearchParams(search);
|
|
137875
137876
|
mergedSearch.append("data", stringifyJSON(serialized) ?? "");
|
|
137876
137877
|
const url22 = `${newPathname}?${mergedSearch}${hash2 ?? ""}`;
|
|
@@ -137957,8 +137958,8 @@ var FetchLinkTransport = class {
|
|
|
137957
137958
|
this.fetch = options.fetch ?? ((url2, init) => globalThis.fetch(url2, init));
|
|
137958
137959
|
this.toFetchRequestOptions = options.toFetchRequest;
|
|
137959
137960
|
}
|
|
137960
|
-
async send(standardRequest,
|
|
137961
|
-
let origin = await value(this.origin, options,
|
|
137961
|
+
async send(standardRequest, path98, options) {
|
|
137962
|
+
let origin = await value(this.origin, options, path98);
|
|
137962
137963
|
if (origin?.endsWith("/")) {
|
|
137963
137964
|
origin = origin.slice(0, -1);
|
|
137964
137965
|
}
|
|
@@ -137978,7 +137979,7 @@ var FetchLinkTransport = class {
|
|
|
137978
137979
|
}
|
|
137979
137980
|
}
|
|
137980
137981
|
const fetch3 = this.fetch;
|
|
137981
|
-
const response = await fetch3(url2, init, options,
|
|
137982
|
+
const response = await fetch3(url2, init, options, path98);
|
|
137982
137983
|
if (response.type === "opaqueredirect") {
|
|
137983
137984
|
throw new TypeError("Unexpected redirect response: redirects are not followed.");
|
|
137984
137985
|
}
|
|
@@ -138565,14 +138566,14 @@ var StandardHandler = class {
|
|
|
138565
138566
|
span?.setAttribute("url.path", request22.url);
|
|
138566
138567
|
return { matched: false };
|
|
138567
138568
|
}
|
|
138568
|
-
const { path:
|
|
138569
|
-
span?.updateName(`${ORPC_NAME2}.${
|
|
138569
|
+
const { path: path98, procedure, decodeInput } = matchedOrNot;
|
|
138570
|
+
span?.updateName(`${ORPC_NAME2}.${path98.join("/")}`);
|
|
138570
138571
|
span?.setAttribute("rpc.system", ORPC_NAME2);
|
|
138571
|
-
span?.setAttribute("rpc.method",
|
|
138572
|
+
span?.setAttribute("rpc.method", path98.join("."));
|
|
138572
138573
|
try {
|
|
138573
138574
|
const response = await intercept2(
|
|
138574
138575
|
this.interceptors,
|
|
138575
|
-
{ context: context2, prefix: prefix2, request: request22, path:
|
|
138576
|
+
{ context: context2, prefix: prefix2, request: request22, path: path98, procedure, decodeInput },
|
|
138576
138577
|
async ({ context: context3, prefix: prefix3, request: request32, path: path210, procedure: procedure2, decodeInput: decodeInput2 }) => {
|
|
138577
138578
|
step2 = "decode_input";
|
|
138578
138579
|
let input2 = await runWithSpan2("decode_input", decodeInput2);
|
|
@@ -138606,7 +138607,7 @@ var StandardHandler = class {
|
|
|
138606
138607
|
message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
|
|
138607
138608
|
cause: e10
|
|
138608
138609
|
}) : toORPCError2(e10);
|
|
138609
|
-
const response = await this.codec.encodeError(error63, procedure,
|
|
138610
|
+
const response = await this.codec.encodeError(error63, procedure, path98, { context: context2, prefix: prefix2 });
|
|
138610
138611
|
return { matched: true, response };
|
|
138611
138612
|
}
|
|
138612
138613
|
}
|
|
@@ -138713,7 +138714,7 @@ var RPCMatcher = class {
|
|
|
138713
138714
|
this.rootRouter = router;
|
|
138714
138715
|
this.index(router);
|
|
138715
138716
|
}
|
|
138716
|
-
index(router,
|
|
138717
|
+
index(router, path98 = []) {
|
|
138717
138718
|
const lazyResults = walkProcedureContractsSync(router, (procedure, procedurePath) => {
|
|
138718
138719
|
if (!value2(this.filter, procedure, procedurePath)) {
|
|
138719
138720
|
return;
|
|
@@ -138724,7 +138725,7 @@ var RPCMatcher = class {
|
|
|
138724
138725
|
// contract-first entries have no implementation yet, resolveProcedure fills it in on demand
|
|
138725
138726
|
procedure: procedure instanceof Procedure ? procedure : void 0
|
|
138726
138727
|
});
|
|
138727
|
-
},
|
|
138728
|
+
}, path98);
|
|
138728
138729
|
for (const result of lazyResults) {
|
|
138729
138730
|
this.pendingLazyRouters.set(pathToHttpPath2(result.path), result);
|
|
138730
138731
|
}
|
|
@@ -138856,10 +138857,10 @@ var RPCHandlerCodec = class {
|
|
|
138856
138857
|
}
|
|
138857
138858
|
};
|
|
138858
138859
|
}
|
|
138859
|
-
encodeOutput(output2, procedure,
|
|
138860
|
+
encodeOutput(output2, procedure, path98, options) {
|
|
138860
138861
|
return {
|
|
138861
138862
|
headers: {},
|
|
138862
|
-
status: value2(this.outputStatus, output2, procedure,
|
|
138863
|
+
status: value2(this.outputStatus, output2, procedure, path98, options) ?? DEFAULT_SUCCESS_STATUS,
|
|
138863
138864
|
body: this.serializer.serialize(output2)
|
|
138864
138865
|
};
|
|
138865
138866
|
}
|
|
@@ -138935,19 +138936,19 @@ function matchesZero(m10) {
|
|
|
138935
138936
|
const last = m10.paramsMap[m10.paramsMap.length - 1];
|
|
138936
138937
|
return last[2] || !!last[3] && !last[5];
|
|
138937
138938
|
}
|
|
138938
|
-
function normalizePath(
|
|
138939
|
-
if (!
|
|
138939
|
+
function normalizePath(path98) {
|
|
138940
|
+
if (!path98.includes("/.")) return path98;
|
|
138940
138941
|
const r10 = [];
|
|
138941
138942
|
let s = "";
|
|
138942
|
-
for (s of
|
|
138943
|
+
for (s of path98.split("/")) if (s === ".") continue;
|
|
138943
138944
|
else if (s === "..") {
|
|
138944
138945
|
if (r10.length > 1) r10.pop();
|
|
138945
138946
|
} else r10.push(s);
|
|
138946
138947
|
if (s === "." || s === "..") r10.push("");
|
|
138947
138948
|
return r10.join("/") || "/";
|
|
138948
138949
|
}
|
|
138949
|
-
function splitPath(
|
|
138950
|
-
const s =
|
|
138950
|
+
function splitPath(path98) {
|
|
138951
|
+
const s = path98.split("/");
|
|
138951
138952
|
s.shift();
|
|
138952
138953
|
return s;
|
|
138953
138954
|
}
|
|
@@ -138990,9 +138991,9 @@ function getMatchParams(segments, paramsMap, suffix, slash) {
|
|
|
138990
138991
|
}
|
|
138991
138992
|
return params;
|
|
138992
138993
|
}
|
|
138993
|
-
function encodeEscapes(
|
|
138994
|
-
if (!
|
|
138995
|
-
return
|
|
138994
|
+
function encodeEscapes(path98) {
|
|
138995
|
+
if (!path98.includes("\\")) return path98;
|
|
138996
|
+
return path98.replace(/\\([:(){}\\])/g, (_, c10) => "\uFFFD" + ESCAPABLE.indexOf(c10));
|
|
138996
138997
|
}
|
|
138997
138998
|
function decodeEscapes(segment, prefix) {
|
|
138998
138999
|
return segment.replace(/\uFFFD([0-5])/g, (_, i10) => prefix + ESCAPABLE[i10]);
|
|
@@ -139029,11 +139030,11 @@ function classSetOp(s) {
|
|
|
139029
139030
|
}))) ;
|
|
139030
139031
|
return found;
|
|
139031
139032
|
}
|
|
139032
|
-
function starGroups(
|
|
139033
|
-
if (!
|
|
139033
|
+
function starGroups(path98) {
|
|
139034
|
+
if (!path98.includes("(.*)")) return [path98];
|
|
139034
139035
|
let count2 = 0;
|
|
139035
139036
|
let unnamed;
|
|
139036
|
-
return [
|
|
139037
|
+
return [path98.replace(/\\[\s\S]|(:[A-Za-z_]\w*)?\((?!\?)(\.\*\)(?!\*))?/g, (m10, name, star, at2) => {
|
|
139037
139038
|
if (m10[0] === "\\" || !star) {
|
|
139038
139039
|
if (m10[0] === "(") count2++;
|
|
139039
139040
|
return m10;
|
|
@@ -139042,25 +139043,25 @@ function starGroups(path97) {
|
|
|
139042
139043
|
const k10 = count2;
|
|
139043
139044
|
unnamed = (index) => index === k10 ? name.slice(1) : index > k10 ? index - 1 : index;
|
|
139044
139045
|
} else count2++;
|
|
139045
|
-
return /(^|[^\\])(\\\\)*([)*}?]|:[A-Za-z_]\w*)\{?$/.test(
|
|
139046
|
+
return /(^|[^\\])(\\\\)*([)*}?]|:[A-Za-z_]\w*)\{?$/.test(path98.slice(0, at2)) ? "\uFFFF*" : "*";
|
|
139046
139047
|
}), unnamed];
|
|
139047
139048
|
}
|
|
139048
|
-
function absolutePattern(
|
|
139049
|
-
return /^[/{]/.test(
|
|
139049
|
+
function absolutePattern(path98) {
|
|
139050
|
+
return /^[/{]/.test(path98) ? path98 : `/${path98}`;
|
|
139050
139051
|
}
|
|
139051
|
-
function dotSegments(
|
|
139052
|
-
if (!DOT_SEGMENT.test(
|
|
139053
|
-
const s =
|
|
139052
|
+
function dotSegments(path98) {
|
|
139053
|
+
if (!DOT_SEGMENT.test(path98)) return path98;
|
|
139054
|
+
const s = path98.split("/");
|
|
139054
139055
|
const out = [s[0]];
|
|
139055
139056
|
let dot = false;
|
|
139056
139057
|
for (let i10 = 1; i10 < s.length; i10++) {
|
|
139057
139058
|
const m10 = /^(?:\.|%2e)(\.|%2e)?$/i.exec(s[i10]);
|
|
139058
139059
|
if (m10) {
|
|
139059
|
-
if (m10[1] && (out.length > 1 || out[0]) && !isText(out.pop())) invalidSyntax(DOT_SEGMENT_NEXT_TO,
|
|
139060
|
+
if (m10[1] && (out.length > 1 || out[0]) && !isText(out.pop())) invalidSyntax(DOT_SEGMENT_NEXT_TO, path98);
|
|
139060
139061
|
dot = true;
|
|
139061
139062
|
continue;
|
|
139062
139063
|
}
|
|
139063
|
-
if (dot && /^[:*(]/.test(s[i10])) invalidSyntax(DOT_SEGMENT_NEXT_TO,
|
|
139064
|
+
if (dot && /^[:*(]/.test(s[i10])) invalidSyntax(DOT_SEGMENT_NEXT_TO, path98);
|
|
139064
139065
|
out.push(s[i10]);
|
|
139065
139066
|
dot = false;
|
|
139066
139067
|
}
|
|
@@ -139127,17 +139128,17 @@ function splitStar(segments, input2) {
|
|
|
139127
139128
|
function oneCatchAll(input2) {
|
|
139128
139129
|
throw new Error(`rou3: a route can have only one \`*\`, \`**\`, \`:name+\` or \`:name*\` (${input2})`);
|
|
139129
139130
|
}
|
|
139130
|
-
function splitRoute(
|
|
139131
|
-
const s = splitPath(
|
|
139131
|
+
function splitRoute(path98) {
|
|
139132
|
+
const s = splitPath(path98);
|
|
139132
139133
|
while (s[s.length - 1] === "") s.pop();
|
|
139133
|
-
if (
|
|
139134
|
+
if (path98.includes("**")) {
|
|
139134
139135
|
for (let i10 = 0; i10 < s.length; i10++) if (/^\*\*[^:{}]/.test(s[i10])) s.splice(i10, 1, ...s[i10][2] === "*" ? ["**", s[i10].slice(2)] : [s[i10].slice(1)]);
|
|
139135
139136
|
}
|
|
139136
139137
|
return s;
|
|
139137
139138
|
}
|
|
139138
|
-
function expandedRouteId(
|
|
139139
|
-
if (
|
|
139140
|
-
return "/" + splitRoute(encodeEscapes(
|
|
139139
|
+
function expandedRouteId(path98) {
|
|
139140
|
+
if (path98.charCodeAt(0) !== 47) return `{${expandedRouteId(`/${path98}`)}`;
|
|
139141
|
+
return "/" + splitRoute(encodeEscapes(path98)).map((segment) => {
|
|
139141
139142
|
const key = segmentKey(segment);
|
|
139142
139143
|
return typeof key === "string" ? key : segment;
|
|
139143
139144
|
}).join("/");
|
|
@@ -139159,40 +139160,40 @@ function segmentWildcards(segment) {
|
|
|
139159
139160
|
}
|
|
139160
139161
|
return at2;
|
|
139161
139162
|
}
|
|
139162
|
-
function scanFirstGroup(
|
|
139163
|
+
function scanFirstGroup(path98) {
|
|
139163
139164
|
let i10 = 0;
|
|
139164
139165
|
let depth = 0;
|
|
139165
|
-
for (; i10 <
|
|
139166
|
-
const c10 =
|
|
139166
|
+
for (; i10 < path98.length; i10++) {
|
|
139167
|
+
const c10 = path98.charCodeAt(i10);
|
|
139167
139168
|
if (c10 === 92) i10++;
|
|
139168
139169
|
else if (c10 === 40) depth++;
|
|
139169
139170
|
else if (c10 === 41 && depth > 0) depth--;
|
|
139170
139171
|
else if (c10 === 123 && depth === 0) break;
|
|
139171
139172
|
}
|
|
139172
|
-
if (i10 >=
|
|
139173
|
+
if (i10 >= path98.length) return;
|
|
139173
139174
|
let j10 = i10 + 1;
|
|
139174
139175
|
depth = 0;
|
|
139175
|
-
for (; j10 <
|
|
139176
|
-
const c10 =
|
|
139176
|
+
for (; j10 < path98.length; j10++) {
|
|
139177
|
+
const c10 = path98.charCodeAt(j10);
|
|
139177
139178
|
if (c10 === 92) j10++;
|
|
139178
139179
|
else if (c10 === 40) depth++;
|
|
139179
139180
|
else if (c10 === 41 && depth > 0) depth--;
|
|
139180
139181
|
else if (c10 === 125 && depth === 0) break;
|
|
139181
139182
|
}
|
|
139182
|
-
if (j10 >=
|
|
139183
|
-
const mod =
|
|
139183
|
+
if (j10 >= path98.length) return;
|
|
139184
|
+
const mod = path98[j10 + 1];
|
|
139184
139185
|
const hasMod = mod === "?" || mod === "+" || mod === "*";
|
|
139185
139186
|
return [
|
|
139186
|
-
|
|
139187
|
-
|
|
139188
|
-
|
|
139187
|
+
path98.slice(0, i10),
|
|
139188
|
+
path98.slice(i10 + 1, j10).replace(NAME_CHAR, "\\$&"),
|
|
139189
|
+
path98.slice(j10 + (hasMod ? 2 : 1)).replace(NAME_CHAR, "\\$&"),
|
|
139189
139190
|
hasMod ? mod : void 0
|
|
139190
139191
|
];
|
|
139191
139192
|
}
|
|
139192
139193
|
var NAME_CHAR = /^[\w$\x80-]/;
|
|
139193
|
-
function expandGroupDelimiters(
|
|
139194
|
-
if (!
|
|
139195
|
-
const group = scanFirstGroup(
|
|
139194
|
+
function expandGroupDelimiters(path98, input2 = path98) {
|
|
139195
|
+
if (!path98.includes("{")) return;
|
|
139196
|
+
const group = scanFirstGroup(path98);
|
|
139196
139197
|
if (!group) return;
|
|
139197
139198
|
const [pre2, body, suf, mod] = group;
|
|
139198
139199
|
if (mod === "+" || mod === "*") invalidSyntax(`unsupported \`{}${mod}\``, input2);
|
|
@@ -139294,43 +139295,43 @@ function linearRegExp(regexp) {
|
|
|
139294
139295
|
return source === regexp.source ? regexp : new RegExp(`^${head}${source.slice(1)}`);
|
|
139295
139296
|
}
|
|
139296
139297
|
var upTo = (L, back) => L.replace(/^\\/, "").length < 2 ? `[^/${L}]*` : back ? `(?:[^/](?<!${L}))*` : `(?:(?!${L})[^/])*`;
|
|
139297
|
-
function addRoute(ctx, method = "",
|
|
139298
|
+
function addRoute(ctx, method = "", path98, data) {
|
|
139298
139299
|
method = method.toUpperCase();
|
|
139299
|
-
|
|
139300
|
-
checkConstraints(
|
|
139301
|
-
const resolved = dotSegments(
|
|
139300
|
+
path98 = absolutePattern(path98);
|
|
139301
|
+
checkConstraints(path98);
|
|
139302
|
+
const resolved = dotSegments(path98);
|
|
139302
139303
|
const [route, unnamed] = starGroups(resolved);
|
|
139303
139304
|
variants = void 0;
|
|
139304
|
-
_add(ctx, method, route, data, unnamed && expandedRouteId(resolved),
|
|
139305
|
+
_add(ctx, method, route, data, unnamed && expandedRouteId(resolved), path98, unnamed);
|
|
139305
139306
|
}
|
|
139306
139307
|
var variants;
|
|
139307
|
-
function _add(ctx, method,
|
|
139308
|
-
const groupExpanded = expandGroupDelimiters(
|
|
139308
|
+
function _add(ctx, method, path98, data, route, input2 = path98, unnamed = same) {
|
|
139309
|
+
const groupExpanded = expandGroupDelimiters(path98, input2);
|
|
139309
139310
|
if (groupExpanded) {
|
|
139310
139311
|
if (groupExpanded[1] !== void 0) {
|
|
139311
|
-
route ??= expandedRouteId(
|
|
139312
|
+
route ??= expandedRouteId(path98);
|
|
139312
139313
|
variants ??= {};
|
|
139313
139314
|
}
|
|
139314
139315
|
_add(ctx, method, groupExpanded[0], data, route, input2, unnamed);
|
|
139315
|
-
if (groupExpanded[1] !== void 0) _add(ctx, method, groupExpanded[1], data, route, input2, /[*(]/.test(
|
|
139316
|
+
if (groupExpanded[1] !== void 0) _add(ctx, method, groupExpanded[1], data, route, input2, /[*(]/.test(path98) ? skipGroup(path98, input2, unnamed) : unnamed);
|
|
139316
139317
|
return 0;
|
|
139317
139318
|
}
|
|
139318
|
-
|
|
139319
|
-
const segments = splitRoute(
|
|
139319
|
+
path98 = encodeEscapes(path98);
|
|
139320
|
+
const segments = splitRoute(path98);
|
|
139320
139321
|
const expanded = expandModifiers(segments, input2);
|
|
139321
139322
|
if (expanded) {
|
|
139322
|
-
route ??= expandedRouteId(
|
|
139323
|
+
route ??= expandedRouteId(path98);
|
|
139323
139324
|
variants ??= {};
|
|
139324
139325
|
let count2 = 0;
|
|
139325
139326
|
for (const p of expanded) count2 = _add(ctx, method, p, data, route, input2, unnamed);
|
|
139326
139327
|
return count2;
|
|
139327
139328
|
}
|
|
139328
|
-
const star =
|
|
139329
|
+
const star = path98.includes("*");
|
|
139329
139330
|
const split = star ? splitStar(segments, input2) : void 0;
|
|
139330
139331
|
if (split) {
|
|
139331
139332
|
const [routes, join4, head] = split;
|
|
139332
139333
|
if (routes.length > 1) {
|
|
139333
|
-
route ??= expandedRouteId(
|
|
139334
|
+
route ??= expandedRouteId(path98);
|
|
139334
139335
|
variants ??= {};
|
|
139335
139336
|
}
|
|
139336
139337
|
let count2 = 0;
|
|
@@ -139450,8 +139451,8 @@ function _insert(ctx, method, segments, data, route, input2, unnamed, star, join
|
|
|
139450
139451
|
return _unnamedParamIndex;
|
|
139451
139452
|
}
|
|
139452
139453
|
var same = (index) => index;
|
|
139453
|
-
function skipGroup(
|
|
139454
|
-
const [pre2, body] = scanFirstGroup(
|
|
139454
|
+
function skipGroup(path98, input2, unnamed = same) {
|
|
139455
|
+
const [pre2, body] = scanFirstGroup(path98);
|
|
139455
139456
|
if (!/[*(]/.test(body) && !pre2.endsWith("*")) return unnamed;
|
|
139456
139457
|
const count2 = (p) => _add(createRouter(), "", p, void 0, void 0, input2);
|
|
139457
139458
|
const before = count2(pre2);
|
|
@@ -139513,11 +139514,11 @@ function kindAt(m10, n10, p) {
|
|
|
139513
139514
|
} else if ((suffix && index > suffix[0] ? index - suffix[0] - 1 + end : index) === p) return typeof name === "string" || plain ? 0 : 2;
|
|
139514
139515
|
return 3;
|
|
139515
139516
|
}
|
|
139516
|
-
function findAllRoutes(ctx, method = "",
|
|
139517
|
-
if (opts?.normalize)
|
|
139518
|
-
const slash =
|
|
139519
|
-
if (slash)
|
|
139520
|
-
const segments = splitPath(
|
|
139517
|
+
function findAllRoutes(ctx, method = "", path98, opts) {
|
|
139518
|
+
if (opts?.normalize) path98 = normalizePath(path98);
|
|
139519
|
+
const slash = path98.charCodeAt(path98.length - 1) === 47;
|
|
139520
|
+
if (slash) path98 = path98.slice(0, -1);
|
|
139521
|
+
const segments = splitPath(path98);
|
|
139521
139522
|
const matches2 = _findRanked(ctx, method, segments);
|
|
139522
139523
|
let seen;
|
|
139523
139524
|
for (let i10 = matches2.length - 1; i10 >= 0; i10--) {
|
|
@@ -139574,16 +139575,16 @@ function pushSorted(matches2, match, reverse) {
|
|
|
139574
139575
|
}).sort((a10, b) => a10[1] - b[1]).map((e10) => e10[0]);
|
|
139575
139576
|
for (const m10 of match) matches2.push(m10);
|
|
139576
139577
|
}
|
|
139577
|
-
function findRoute(ctx, method = "",
|
|
139578
|
-
if (opts?.normalize)
|
|
139579
|
-
const slash =
|
|
139580
|
-
if (slash)
|
|
139581
|
-
const staticNode = ctx.static[
|
|
139578
|
+
function findRoute(ctx, method = "", path98, opts) {
|
|
139579
|
+
if (opts?.normalize) path98 = normalizePath(path98);
|
|
139580
|
+
const slash = path98.charCodeAt(path98.length - 1) === 47;
|
|
139581
|
+
if (slash) path98 = path98.slice(0, -1);
|
|
139582
|
+
const staticNode = ctx.static[path98];
|
|
139582
139583
|
if (staticNode && staticNode.methods) {
|
|
139583
139584
|
const staticMatch = staticNode.methods[method] || staticNode.methods[""];
|
|
139584
139585
|
if (staticMatch !== void 0) return { data: staticMatch[0].data };
|
|
139585
139586
|
}
|
|
139586
|
-
const segments = splitPath(
|
|
139587
|
+
const segments = splitPath(path98);
|
|
139587
139588
|
let match;
|
|
139588
139589
|
if (segments.includes("") || ctx.root.hasSuffix && hasSuffixMatch(ctx.root, method, segments, 0)) {
|
|
139589
139590
|
const matches2 = _findRanked(ctx, method, segments, true);
|
|
@@ -139879,8 +139880,8 @@ var STAR_SEGMENT = "*/";
|
|
|
139879
139880
|
function routeToRegExp(route = "/") {
|
|
139880
139881
|
route = absolutePattern(route);
|
|
139881
139882
|
addRoute(createRouter(), "", route);
|
|
139882
|
-
const [
|
|
139883
|
-
return new RegExp(determinize(toRegExp(
|
|
139883
|
+
const [path98, unnamed] = starGroups(dotSegments(route));
|
|
139884
|
+
return new RegExp(determinize(toRegExp(path98, route, unnamed).source));
|
|
139884
139885
|
}
|
|
139885
139886
|
function toRegExp(route, input2, unnamed) {
|
|
139886
139887
|
const inlineOptional = inlineOptionalGroup(route, input2, unnamed);
|
|
@@ -140237,7 +140238,7 @@ var OpenAPIMatcher = class {
|
|
|
140237
140238
|
this.rootRouter = router;
|
|
140238
140239
|
this.index(router);
|
|
140239
140240
|
}
|
|
140240
|
-
index(router,
|
|
140241
|
+
index(router, path98 = []) {
|
|
140241
140242
|
const routes = [];
|
|
140242
140243
|
const lazyResults = walkProcedureContractsSync(router, (contract, path210) => {
|
|
140243
140244
|
if (!value2(this.filter, contract, path210)) {
|
|
@@ -140258,7 +140259,7 @@ var OpenAPIMatcher = class {
|
|
|
140258
140259
|
...route
|
|
140259
140260
|
}
|
|
140260
140261
|
});
|
|
140261
|
-
},
|
|
140262
|
+
}, path98);
|
|
140262
140263
|
const pendingLazyRouters = lazyResults.map((result) => {
|
|
140263
140264
|
const prefix = getOpenAPIMeta(result.router)?.prefix;
|
|
140264
140265
|
return {
|
|
@@ -140358,10 +140359,10 @@ var OpenAPIMatcher = class {
|
|
|
140358
140359
|
return entry.procedure;
|
|
140359
140360
|
}
|
|
140360
140361
|
};
|
|
140361
|
-
function toRou3Route(
|
|
140362
|
-
const dynamicParams = getDynamicPathParams(
|
|
140362
|
+
function toRou3Route(path98) {
|
|
140363
|
+
const dynamicParams = getDynamicPathParams(path98);
|
|
140363
140364
|
if (!dynamicParams) {
|
|
140364
|
-
return { pattern: toRou3Literal(
|
|
140365
|
+
return { pattern: toRou3Literal(path98) };
|
|
140365
140366
|
}
|
|
140366
140367
|
let pattern = "";
|
|
140367
140368
|
let literalStart = 0;
|
|
@@ -140370,11 +140371,11 @@ function toRou3Route(path97) {
|
|
|
140370
140371
|
for (const param of dynamicParams) {
|
|
140371
140372
|
const key = `p${params.length}`;
|
|
140372
140373
|
params.push([key, param.parameterName]);
|
|
140373
|
-
pattern += toRou3Literal(
|
|
140374
|
+
pattern += toRou3Literal(path98.slice(literalStart, param.startIndex));
|
|
140374
140375
|
literalStart = param.startIndex + param.segment.length;
|
|
140375
140376
|
if (param.allowsSlash) {
|
|
140376
140377
|
if (catchAllKey !== void 0) {
|
|
140377
|
-
throw new TypeError(`OpenAPI path "${
|
|
140378
|
+
throw new TypeError(`OpenAPI path "${path98}" has more than one catch-all param ({+name}), but only one is supported per path.`);
|
|
140378
140379
|
}
|
|
140379
140380
|
catchAllKey = key;
|
|
140380
140381
|
pattern += `:${key}(.*)`;
|
|
@@ -140382,7 +140383,7 @@ function toRou3Route(path97) {
|
|
|
140382
140383
|
pattern += `:${key}`;
|
|
140383
140384
|
}
|
|
140384
140385
|
}
|
|
140385
|
-
pattern += toRou3Literal(
|
|
140386
|
+
pattern += toRou3Literal(path98.slice(literalStart));
|
|
140386
140387
|
return { pattern, params, catchAllKey };
|
|
140387
140388
|
}
|
|
140388
140389
|
var ROU3_SYNTAX_REGEX = /[\\:*?+(){}]|(?<![^/])\.(?=\.?(?:\/|$))/g;
|
|
@@ -140390,8 +140391,8 @@ function toRou3Literal(text5) {
|
|
|
140390
140391
|
const normalized = NORMALIZABLE_PATHNAME_REGEX2.test(text5) ? normalizeRou3Path(text5) : text5;
|
|
140391
140392
|
return normalized.replace(ROU3_SYNTAX_REGEX, "\\$&");
|
|
140392
140393
|
}
|
|
140393
|
-
function normalizeRou3Path(
|
|
140394
|
-
return
|
|
140394
|
+
function normalizeRou3Path(path98) {
|
|
140395
|
+
return path98.split("/").map((segment) => safeDecodeURIComponent2(segment).replace(ROU3_ENCODED_SEGMENT_TEXT_REGEX, safeEncodeURIComponent2)).join("/");
|
|
140395
140396
|
}
|
|
140396
140397
|
function toRou3PrefixMatcher(prefix) {
|
|
140397
140398
|
const catchAll = getDynamicPathParams(prefix)?.find((param) => param.allowsSlash);
|
|
@@ -140481,7 +140482,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
140481
140482
|
/**
|
|
140482
140483
|
* @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
|
|
140483
140484
|
*/
|
|
140484
|
-
encodeOutput(output2, procedure,
|
|
140485
|
+
encodeOutput(output2, procedure, path98) {
|
|
140485
140486
|
const meta3 = getOpenAPIMeta(procedure);
|
|
140486
140487
|
const successStatus = meta3?.successStatus ?? DEFAULT_SUCCESS_STATUS;
|
|
140487
140488
|
const outputStructure = meta3?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
|
|
@@ -140494,7 +140495,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
140494
140495
|
}
|
|
140495
140496
|
if (!isValidDetailedOutput(output2)) {
|
|
140496
140497
|
throw new TypeError(`
|
|
140497
|
-
Invalid "detailed" output structure returned by procedure (${
|
|
140498
|
+
Invalid "detailed" output structure returned by procedure (${path98.join(".")}):
|
|
140498
140499
|
\u2022 Expected an object with optional properties:
|
|
140499
140500
|
- status (number <400)
|
|
140500
140501
|
- headers (object)
|
|
@@ -141107,7 +141108,7 @@ function profileValue(name, paths) {
|
|
|
141107
141108
|
function createConfigApiRouter(deps) {
|
|
141108
141109
|
const authed = doorApiAuth(deps.expectedToken);
|
|
141109
141110
|
const { paths } = deps;
|
|
141110
|
-
const route = (
|
|
141111
|
+
const route = (path98, summary) => authed.meta(openapi({ method: "POST", path: path98, summary, tags: [CONFIG_API_TAG] }));
|
|
141111
141112
|
return {
|
|
141112
141113
|
config: {
|
|
141113
141114
|
identity: {
|
|
@@ -143347,8 +143348,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
|
|
|
143347
143348
|
request7.body.resume();
|
|
143348
143349
|
return;
|
|
143349
143350
|
}
|
|
143350
|
-
const
|
|
143351
|
-
const translated = { method: request7.method, path:
|
|
143351
|
+
const path98 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
143352
|
+
const translated = { method: request7.method, path: path98, body, signal: request7.signal };
|
|
143352
143353
|
const routed = await route(translated);
|
|
143353
143354
|
if (request7.signal.aborted) {
|
|
143354
143355
|
return;
|
|
@@ -143582,9 +143583,9 @@ function descendExpanded(root, value3, key) {
|
|
|
143582
143583
|
}
|
|
143583
143584
|
}
|
|
143584
143585
|
function relaxRejectedRecursiveProperty(request7, body) {
|
|
143585
|
-
const
|
|
143586
|
-
if (
|
|
143587
|
-
const propertyIndices =
|
|
143586
|
+
const path98 = rejectedPath(body);
|
|
143587
|
+
if (path98 === void 0) return void 0;
|
|
143588
|
+
const propertyIndices = path98.flatMap((part, index) => part === "properties" && path98[index + 1] !== void 0 ? [index] : []).reverse();
|
|
143588
143589
|
if (propertyIndices.length === 0) return void 0;
|
|
143589
143590
|
const copy2 = structuredClone(request7);
|
|
143590
143591
|
let changed = false;
|
|
@@ -143593,14 +143594,14 @@ function relaxRejectedRecursiveProperty(request7, body) {
|
|
|
143593
143594
|
const schema = declaration.parametersJsonSchema;
|
|
143594
143595
|
if (schema === void 0) continue;
|
|
143595
143596
|
let leaf = schema;
|
|
143596
|
-
for (const part of
|
|
143597
|
+
for (const part of path98) leaf = descendExpanded(schema, leaf, part);
|
|
143597
143598
|
if (!record2(leaf) || typeof leaf.$ref !== "string") continue;
|
|
143598
143599
|
let repairedProperty = false;
|
|
143599
143600
|
for (const propertyIndex of propertyIndices) {
|
|
143600
|
-
const name =
|
|
143601
|
+
const name = path98[propertyIndex + 1];
|
|
143601
143602
|
if (name === void 0) continue;
|
|
143602
143603
|
let owner = schema;
|
|
143603
|
-
for (const part of
|
|
143604
|
+
for (const part of path98.slice(0, propertyIndex)) owner = descendExpanded(schema, owner, part);
|
|
143604
143605
|
if (!record2(owner) || !Array.isArray(owner.required) || !owner.required.includes(name) || !record2(owner.properties)) continue;
|
|
143605
143606
|
const property = owner.properties[name];
|
|
143606
143607
|
if (!record2(property)) continue;
|
|
@@ -143614,8 +143615,8 @@ function relaxRejectedRecursiveProperty(request7, body) {
|
|
|
143614
143615
|
}
|
|
143615
143616
|
if (!repairedProperty) {
|
|
143616
143617
|
let parent = schema;
|
|
143617
|
-
for (const part of
|
|
143618
|
-
const key =
|
|
143618
|
+
for (const part of path98.slice(0, -1)) parent = descendExpanded(schema, parent, part);
|
|
143619
|
+
const key = path98.at(-1);
|
|
143619
143620
|
const truncated = { description: "Recursive value: the original tool schema validates this value." };
|
|
143620
143621
|
if (record2(parent) && key !== void 0 && Object.hasOwn(parent, key)) {
|
|
143621
143622
|
parent[key] = truncated;
|
|
@@ -144107,8 +144108,8 @@ function createAntigravityRouteMount(ports, upstreamBase, provider) {
|
|
|
144107
144108
|
request7.body.resume();
|
|
144108
144109
|
return;
|
|
144109
144110
|
}
|
|
144110
|
-
const
|
|
144111
|
-
const translated = { method: request7.method, path:
|
|
144111
|
+
const path98 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
144112
|
+
const translated = { method: request7.method, path: path98, body, signal: request7.signal };
|
|
144112
144113
|
const routed = await route(translated);
|
|
144113
144114
|
if (request7.signal.aborted) {
|
|
144114
144115
|
return;
|
|
@@ -144152,7 +144153,7 @@ function createPassthroughRoute(name, target) {
|
|
|
144152
144153
|
headroomUpstream: target.headroomUpstream,
|
|
144153
144154
|
serve: async (request7, response) => {
|
|
144154
144155
|
const incoming = new URL(request7.url, "http://127.0.0.1");
|
|
144155
|
-
const
|
|
144156
|
+
const path98 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
|
|
144156
144157
|
const headers = forwardableHeaders(request7.headers);
|
|
144157
144158
|
delete headers.host;
|
|
144158
144159
|
await new Promise((resolve3) => {
|
|
@@ -144160,7 +144161,7 @@ function createPassthroughRoute(name, target) {
|
|
|
144160
144161
|
host: base.hostname,
|
|
144161
144162
|
port: base.port === "" ? void 0 : Number(base.port),
|
|
144162
144163
|
method: request7.method,
|
|
144163
|
-
path: `${basePath}${
|
|
144164
|
+
path: `${basePath}${path98}${incoming.search}`,
|
|
144164
144165
|
headers,
|
|
144165
144166
|
agent
|
|
144166
144167
|
};
|
|
@@ -144366,13 +144367,13 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
144366
144367
|
}
|
|
144367
144368
|
|
|
144368
144369
|
// src/frontdoor/providerRoute.ts
|
|
144369
|
-
var isRcSelfHostPath = (
|
|
144370
|
+
var isRcSelfHostPath = (path98) => path98 === "/v1/code/sessions" || path98.startsWith("/v1/code/sessions/") || path98 === "/v1/sessions" || path98.startsWith("/v1/sessions/");
|
|
144370
144371
|
function scopeSessionProviderPath(request7) {
|
|
144371
144372
|
if (request7.session.provider === void 0) {
|
|
144372
144373
|
return request7;
|
|
144373
144374
|
}
|
|
144374
|
-
const
|
|
144375
|
-
if (!
|
|
144375
|
+
const path98 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
144376
|
+
if (!path98.startsWith("/v1/") || isRcSelfHostPath(path98)) {
|
|
144376
144377
|
return request7;
|
|
144377
144378
|
}
|
|
144378
144379
|
return { ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` };
|
|
@@ -144507,13 +144508,13 @@ function createProviderRouteResolver(deps) {
|
|
|
144507
144508
|
return route;
|
|
144508
144509
|
};
|
|
144509
144510
|
const resolve3 = (request7) => {
|
|
144510
|
-
const
|
|
144511
|
-
const scoped = parseProviderPath(
|
|
144511
|
+
const path98 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
144512
|
+
const scoped = parseProviderPath(path98);
|
|
144512
144513
|
if (scoped === void 0) {
|
|
144513
|
-
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(
|
|
144514
|
+
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path98)) {
|
|
144514
144515
|
return { ok: true, route: deps.rcSelfHostRoute };
|
|
144515
144516
|
}
|
|
144516
|
-
return
|
|
144517
|
+
return path98.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path98}` };
|
|
144517
144518
|
}
|
|
144518
144519
|
const { provider } = scoped;
|
|
144519
144520
|
let definition;
|
|
@@ -144609,8 +144610,8 @@ function createProviderRouteResolver(deps) {
|
|
|
144609
144610
|
let modelChoice;
|
|
144610
144611
|
const visited = /* @__PURE__ */ new Set();
|
|
144611
144612
|
for (; ; ) {
|
|
144612
|
-
const
|
|
144613
|
-
const scoped = parseProviderPath(
|
|
144613
|
+
const path98 = new URL(current.url, "http://127.0.0.1").pathname;
|
|
144614
|
+
const scoped = parseProviderPath(path98);
|
|
144614
144615
|
const providerName = scoped?.provider ?? current.session.provider;
|
|
144615
144616
|
if (providerName !== void 0 && visited.has(providerName)) {
|
|
144616
144617
|
return { ok: false, status: HTTP_STATUS.internalServerError, message: `provider routing cycle: ${[...visited, providerName].join(" -> ")}` };
|
|
@@ -144625,7 +144626,7 @@ function createProviderRouteResolver(deps) {
|
|
|
144625
144626
|
} catch {
|
|
144626
144627
|
routes = void 0;
|
|
144627
144628
|
}
|
|
144628
|
-
const resolvesNames = !nameResolved && !isRcSelfHostPath(
|
|
144629
|
+
const resolvesNames = !nameResolved && !isRcSelfHostPath(path98);
|
|
144629
144630
|
if (resolvesNames) {
|
|
144630
144631
|
const scan2 = await scanRequestHead(current, true);
|
|
144631
144632
|
if (scan2.replayed === void 0) {
|
|
@@ -144664,7 +144665,7 @@ function createProviderRouteResolver(deps) {
|
|
|
144664
144665
|
}
|
|
144665
144666
|
if (routed.provider !== providerName) {
|
|
144666
144667
|
const scopedPrefix = providerName === void 0 ? void 0 : `${PROVIDER_PATH_PREFIX}${encodeURIComponent(providerName)}`;
|
|
144667
|
-
const rest2 = scopedPrefix !== void 0 &&
|
|
144668
|
+
const rest2 = scopedPrefix !== void 0 && path98.startsWith(scopedPrefix) ? path98.slice(scopedPrefix.length) : path98;
|
|
144668
144669
|
const query2 = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
|
|
144669
144670
|
const carried = replay;
|
|
144670
144671
|
current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(routed.provider)}${rest2}${query2}`, body: carried.body, headers: carried.headers };
|
|
@@ -144718,7 +144719,7 @@ function createProviderRouteResolver(deps) {
|
|
|
144718
144719
|
const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
|
|
144719
144720
|
replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
|
|
144720
144721
|
}
|
|
144721
|
-
const rest = scoped === void 0 ?
|
|
144722
|
+
const rest = scoped === void 0 ? path98 : path98.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
|
|
144722
144723
|
const query = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
|
|
144723
144724
|
current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(matched.provider)}${rest}${query}`, body: replay.body, headers: replay.headers };
|
|
144724
144725
|
}
|
|
@@ -150705,15 +150706,15 @@ function parseNumstat(output2) {
|
|
|
150705
150706
|
if (addedText === void 0 || deletedText === void 0 || pathText === void 0) {
|
|
150706
150707
|
continue;
|
|
150707
150708
|
}
|
|
150708
|
-
const
|
|
150709
|
+
const path98 = pathText === "" ? fields[index + 2] : pathText;
|
|
150709
150710
|
if (pathText === "") {
|
|
150710
150711
|
index += 2;
|
|
150711
150712
|
}
|
|
150712
150713
|
const lines = { added: Number(addedText), deleted: Number(deletedText) };
|
|
150713
|
-
if (
|
|
150714
|
+
if (path98 !== void 0 && Number.isInteger(lines.added) && Number.isInteger(lines.deleted)) {
|
|
150714
150715
|
added += lines.added;
|
|
150715
150716
|
deleted += lines.deleted;
|
|
150716
|
-
byPath.set(
|
|
150717
|
+
byPath.set(path98, lines);
|
|
150717
150718
|
}
|
|
150718
150719
|
}
|
|
150719
150720
|
return { total: { added, deleted }, byPath };
|
|
@@ -151752,11 +151753,11 @@ function targetText(tool, columns) {
|
|
|
151752
151753
|
if (!FILE_TOOLS.includes(tool.name)) {
|
|
151753
151754
|
return truncateWithEllipsis(target, room, ELLIPSIS);
|
|
151754
151755
|
}
|
|
151755
|
-
const
|
|
151756
|
-
if (visibleLength(
|
|
151757
|
-
return
|
|
151756
|
+
const path98 = target.replaceAll("\\", "/");
|
|
151757
|
+
if (visibleLength(path98) <= room) {
|
|
151758
|
+
return path98;
|
|
151758
151759
|
}
|
|
151759
|
-
const file2 =
|
|
151760
|
+
const file2 = path98.split("/").pop() ?? path98;
|
|
151760
151761
|
return visibleLength(DIRECTORY_ELLIPSIS) + visibleLength(file2) > room ? truncateWithEllipsis(file2, room, FILE_ELLIPSIS) : `${DIRECTORY_ELLIPSIS}${file2}`;
|
|
151761
151762
|
}
|
|
151762
151763
|
function finishedByKind(tools) {
|
|
@@ -155513,8 +155514,8 @@ function getErrorMap2() {
|
|
|
155513
155514
|
|
|
155514
155515
|
// node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/helpers/parseUtil.js
|
|
155515
155516
|
var makeIssue = (params) => {
|
|
155516
|
-
const { data, path:
|
|
155517
|
-
const fullPath = [...
|
|
155517
|
+
const { data, path: path98, errorMaps, issueData } = params;
|
|
155518
|
+
const fullPath = [...path98, ...issueData.path || []];
|
|
155518
155519
|
const fullIssue = {
|
|
155519
155520
|
...issueData,
|
|
155520
155521
|
path: fullPath
|
|
@@ -155629,11 +155630,11 @@ var errorUtil;
|
|
|
155629
155630
|
|
|
155630
155631
|
// node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/types.js
|
|
155631
155632
|
var ParseInputLazyPath = class {
|
|
155632
|
-
constructor(parent, value3,
|
|
155633
|
+
constructor(parent, value3, path98, key) {
|
|
155633
155634
|
this._cachedPath = [];
|
|
155634
155635
|
this.parent = parent;
|
|
155635
155636
|
this.data = value3;
|
|
155636
|
-
this._path =
|
|
155637
|
+
this._path = path98;
|
|
155637
155638
|
this._key = key;
|
|
155638
155639
|
}
|
|
155639
155640
|
get path() {
|
|
@@ -159196,11 +159197,11 @@ function normalizeObjectSchema(schema) {
|
|
|
159196
159197
|
}
|
|
159197
159198
|
return void 0;
|
|
159198
159199
|
}
|
|
159199
|
-
function getDotPath(
|
|
159200
|
-
if (
|
|
159200
|
+
function getDotPath(path98) {
|
|
159201
|
+
if (path98.length === 0) {
|
|
159201
159202
|
return "object root";
|
|
159202
159203
|
}
|
|
159203
|
-
return
|
|
159204
|
+
return path98.reduce((acc, seg, index) => {
|
|
159204
159205
|
if (index === 0) {
|
|
159205
159206
|
return String(seg);
|
|
159206
159207
|
}
|
|
@@ -165934,6 +165935,7 @@ var realSupervisedSpawnPort = {
|
|
|
165934
165935
|
});
|
|
165935
165936
|
});
|
|
165936
165937
|
return {
|
|
165938
|
+
pid: child.pid,
|
|
165937
165939
|
exit,
|
|
165938
165940
|
signal: (signal) => {
|
|
165939
165941
|
child.kill(signal);
|
|
@@ -166851,7 +166853,9 @@ async function realRefresher(params) {
|
|
|
166851
166853
|
// src/supervise/launch.ts
|
|
166852
166854
|
var import_node_crypto35 = require("node:crypto");
|
|
166853
166855
|
var import_node_fs40 = require("node:fs");
|
|
166854
|
-
var
|
|
166856
|
+
var import_node_path96 = __toESM(require("node:path"), 1);
|
|
166857
|
+
var import_promises21 = require("node:stream/promises");
|
|
166858
|
+
init_package();
|
|
166855
166859
|
init_claudeSession();
|
|
166856
166860
|
init_claudeSubcommand();
|
|
166857
166861
|
init_pool();
|
|
@@ -167043,13 +167047,44 @@ function quotaHitOf(fs36, paths, identity, sessionId, sinceMs, nowMs) {
|
|
|
167043
167047
|
const { records } = readUsageLog(fs36, paths.usageLogDir, { sinceMs });
|
|
167044
167048
|
for (let index = records.length - 1; index >= 0; index -= 1) {
|
|
167045
167049
|
const record3 = records[index];
|
|
167046
|
-
if (record3?.sessionId === sessionId && record3.identity === identity && record3.limit?.kind === "quota-exhausted") {
|
|
167050
|
+
if (record3?.sessionId === sessionId && record3.identity === identity && record3.route === "anthropic" && record3.limit?.kind === "quota-exhausted") {
|
|
167047
167051
|
return { reason, ...record3.limit.resetAt === void 0 ? {} : { resetAt: record3.limit.resetAt } };
|
|
167048
167052
|
}
|
|
167049
167053
|
}
|
|
167050
167054
|
return void 0;
|
|
167051
167055
|
}
|
|
167052
167056
|
|
|
167057
|
+
// src/supervise/lifecycle.ts
|
|
167058
|
+
var import_node_path92 = __toESM(require("node:path"), 1);
|
|
167059
|
+
init_zod();
|
|
167060
|
+
var SignalSchema = external_exports.string().regex(/^SIG[A-Z0-9]+$/);
|
|
167061
|
+
var ChildPidSchema = external_exports.number().int().positive().nullable();
|
|
167062
|
+
var LifecycleEventSchema = external_exports.discriminatedUnion("kind", [
|
|
167063
|
+
external_exports.strictObject({ kind: external_exports.literal("child_started"), childPid: ChildPidSchema }),
|
|
167064
|
+
external_exports.strictObject({ kind: external_exports.literal("departure"), reason: external_exports.enum(["quota", "model"]) }),
|
|
167065
|
+
external_exports.strictObject({ kind: external_exports.literal("child_signal"), childPid: ChildPidSchema, signal: SignalSchema }),
|
|
167066
|
+
external_exports.strictObject({ kind: external_exports.literal("child_exited"), childPid: ChildPidSchema, status: external_exports.number().int().nullable(), signal: SignalSchema.nullable(), spawnFailed: external_exports.boolean() }),
|
|
167067
|
+
external_exports.strictObject({ kind: external_exports.literal("compaction"), phase: external_exports.enum(["live", "after_move"]), outcome: external_exports.enum(["compacted", "unchanged", "failed", "interrupted", "not_attempted"]) })
|
|
167068
|
+
]);
|
|
167069
|
+
function createLifecycleRecorder(params) {
|
|
167070
|
+
const directory = import_node_path92.default.join(params.logsDir, "supervisor");
|
|
167071
|
+
const file2 = import_node_path92.default.join(directory, `${params.fileId}.jsonl`);
|
|
167072
|
+
let warned2 = false;
|
|
167073
|
+
return (event) => {
|
|
167074
|
+
try {
|
|
167075
|
+
const safeEvent = LifecycleEventSchema.parse(event);
|
|
167076
|
+
params.fs.mkdirPrivate(directory);
|
|
167077
|
+
params.fs.appendFilePrivate(file2, `${JSON.stringify({ schemaVersion: 1, at: new Date(params.now()).toISOString(), sessionId: params.sessionId, supervisorPid: params.supervisorPid, supervisorVersion: params.supervisorVersion, entrypointSha256AtStart: params.entrypointSha256AtStart, ...safeEvent })}
|
|
167078
|
+
`);
|
|
167079
|
+
} catch {
|
|
167080
|
+
if (!warned2) {
|
|
167081
|
+
warned2 = true;
|
|
167082
|
+
params.log.warn("agent-shim: could not record supervisor lifecycle diagnostics");
|
|
167083
|
+
}
|
|
167084
|
+
}
|
|
167085
|
+
};
|
|
167086
|
+
}
|
|
167087
|
+
|
|
167053
167088
|
// src/supervise/nativeCompact.ts
|
|
167054
167089
|
var import_node_crypto34 = require("node:crypto");
|
|
167055
167090
|
var import_node_fs38 = require("node:fs");
|
|
@@ -167100,18 +167135,18 @@ async function compactInSession(plugin, conversationId, signal) {
|
|
|
167100
167135
|
// src/supervise/nativeCompactionPlugin.ts
|
|
167101
167136
|
var import_node_fs39 = require("node:fs");
|
|
167102
167137
|
var import_node_os24 = require("node:os");
|
|
167103
|
-
var
|
|
167138
|
+
var import_node_path93 = __toESM(require("node:path"), 1);
|
|
167104
167139
|
function stageNativeCompactionPlugin() {
|
|
167105
|
-
const directory = (0, import_node_fs39.mkdtempSync)(
|
|
167106
|
-
const ready =
|
|
167107
|
-
const request7 =
|
|
167108
|
-
const result =
|
|
167140
|
+
const directory = (0, import_node_fs39.mkdtempSync)(import_node_path93.default.join((0, import_node_os24.tmpdir)(), "agent-shim-compact-"));
|
|
167141
|
+
const ready = import_node_path93.default.join(directory, "ready.json");
|
|
167142
|
+
const request7 = import_node_path93.default.join(directory, "request.json");
|
|
167143
|
+
const result = import_node_path93.default.join(directory, "result.json");
|
|
167109
167144
|
try {
|
|
167110
|
-
(0, import_node_fs39.mkdirSync)(
|
|
167111
|
-
(0, import_node_fs39.mkdirSync)(
|
|
167112
|
-
(0, import_node_fs39.writeFileSync)(
|
|
167113
|
-
(0, import_node_fs39.writeFileSync)(
|
|
167114
|
-
(0, import_node_fs39.writeFileSync)(
|
|
167145
|
+
(0, import_node_fs39.mkdirSync)(import_node_path93.default.join(directory, ".claude-plugin"), { mode: 448 });
|
|
167146
|
+
(0, import_node_fs39.mkdirSync)(import_node_path93.default.join(directory, "hooks"), { mode: 448 });
|
|
167147
|
+
(0, import_node_fs39.writeFileSync)(import_node_path93.default.join(directory, ".claude-plugin", "plugin.json"), JSON.stringify({ name: "agent-shim-compaction", version: "1.0.0", description: "Compacts supervised sessions in process" }), { mode: 384 });
|
|
167148
|
+
(0, import_node_fs39.writeFileSync)(import_node_path93.default.join(directory, "hooks", "hooks.json"), JSON.stringify({ modules: ["./register.js"] }), { mode: 384 });
|
|
167149
|
+
(0, import_node_fs39.writeFileSync)(import_node_path93.default.join(directory, "hooks", "register.js"), pluginSource(ready, request7, result), { mode: 384 });
|
|
167115
167150
|
(0, import_node_fs39.writeFileSync)(request7, "{}", { mode: 384 });
|
|
167116
167151
|
(0, import_node_fs39.writeFileSync)(result, "{}", { mode: 384 });
|
|
167117
167152
|
return { directory, ready, request: request7, result, release: () => {
|
|
@@ -167185,7 +167220,7 @@ function withNativeCompactionPlugin(args, directory) {
|
|
|
167185
167220
|
}
|
|
167186
167221
|
|
|
167187
167222
|
// src/supervise/move.ts
|
|
167188
|
-
var
|
|
167223
|
+
var import_node_path94 = __toESM(require("node:path"), 1);
|
|
167189
167224
|
init_identityRecords();
|
|
167190
167225
|
init_lock();
|
|
167191
167226
|
init_poolPick();
|
|
@@ -167237,7 +167272,7 @@ function createMover(deps) {
|
|
|
167237
167272
|
if (pickedId === request7.from) {
|
|
167238
167273
|
return { kind: "stay", reason: `no other member of pool "${pool}" can take it` };
|
|
167239
167274
|
}
|
|
167240
|
-
const transcript = pickedId === void 0 ? void 0 :
|
|
167275
|
+
const transcript = pickedId === void 0 ? void 0 : import_node_path94.default.join(paths.identitiesDir, pickedId, "projects", projectDirNameOf(deps.cwd), `${request7.conversationId ?? request7.sessionId}.jsonl`);
|
|
167241
167276
|
if (pickedId === void 0 || transcript === void 0 || farmFs.lstat(transcript)?.kind !== "file") {
|
|
167242
167277
|
return { kind: "stay", reason: `${resolution.identity} does not share this conversation's history, so it could not resume it` };
|
|
167243
167278
|
}
|
|
@@ -167279,7 +167314,7 @@ function createIdentityMover(deps) {
|
|
|
167279
167314
|
if (request7.to === request7.from) {
|
|
167280
167315
|
return { kind: "stay", reason: `the model already runs under this session's identity` };
|
|
167281
167316
|
}
|
|
167282
|
-
const transcript =
|
|
167317
|
+
const transcript = import_node_path94.default.join(paths.identitiesDir, request7.to, "projects", projectDirNameOf(deps.cwd), `${request7.conversationId ?? request7.sessionId}.jsonl`);
|
|
167283
167318
|
if (farmFs.lstat(transcript)?.kind !== "file") {
|
|
167284
167319
|
return { kind: "stay", reason: `${toName} does not share this conversation's history, so it could not resume it` };
|
|
167285
167320
|
}
|
|
@@ -167342,10 +167377,10 @@ function stopHooksFinished(text5, conversationId, markedAt) {
|
|
|
167342
167377
|
}
|
|
167343
167378
|
|
|
167344
167379
|
// src/supervise/settings.ts
|
|
167345
|
-
var
|
|
167380
|
+
var import_node_path95 = __toESM(require("node:path"), 1);
|
|
167346
167381
|
function stageSupervisedSettings(fs36, paths, pool, sessionId, pid, contents) {
|
|
167347
|
-
const directory =
|
|
167348
|
-
const file2 =
|
|
167382
|
+
const directory = import_node_path95.default.join(superviseDirOf(paths, pool), "settings");
|
|
167383
|
+
const file2 = import_node_path95.default.join(directory, `${sessionId}.${String(pid)}.json`);
|
|
167349
167384
|
fs36.mkdirPrivate(directory);
|
|
167350
167385
|
fs36.writeFilePrivate(file2, `${contents}
|
|
167351
167386
|
`);
|
|
@@ -167378,6 +167413,7 @@ function messageOf2(error63) {
|
|
|
167378
167413
|
return error63 instanceof Error ? error63.message : String(error63);
|
|
167379
167414
|
}
|
|
167380
167415
|
async function stopChild(deps, child) {
|
|
167416
|
+
deps.lifecycle?.({ kind: "child_signal", childPid: child.pid ?? null, signal: "SIGTERM" });
|
|
167381
167417
|
child.signal("SIGTERM");
|
|
167382
167418
|
const grace = deps.timer.after(STOP_GRACE_MS);
|
|
167383
167419
|
const stopped = await Promise.race([child.exit.then((result2) => ({ result: result2 })), grace.elapsed.then(() => void 0)]);
|
|
@@ -167385,6 +167421,7 @@ async function stopChild(deps, child) {
|
|
|
167385
167421
|
if (stopped !== void 0) {
|
|
167386
167422
|
return stopped.result;
|
|
167387
167423
|
}
|
|
167424
|
+
deps.lifecycle?.({ kind: "child_signal", childPid: child.pid ?? null, signal: "SIGKILL" });
|
|
167388
167425
|
child.signal("SIGKILL");
|
|
167389
167426
|
const result = await child.exit;
|
|
167390
167427
|
deps.resetTerminal();
|
|
@@ -167394,6 +167431,11 @@ async function runChild2(deps, plan, identity, compactedConversation, onCompacte
|
|
|
167394
167431
|
const startedMs = deps.now();
|
|
167395
167432
|
const child = deps.spawn.spawn(plan.bin, plan.args, { stdio: "inherit", env: plan.env });
|
|
167396
167433
|
plan.markChildStarted();
|
|
167434
|
+
deps.lifecycle?.({ kind: "child_started", childPid: child.pid ?? null });
|
|
167435
|
+
const observedExit = child.exit.then((result) => {
|
|
167436
|
+
deps.lifecycle?.({ kind: "child_exited", childPid: child.pid ?? null, status: result.status, signal: result.signal, spawnFailed: result.error !== void 0 });
|
|
167437
|
+
return result;
|
|
167438
|
+
});
|
|
167397
167439
|
const state = { terminating: false, leaving: false, checking: false, compacting: false, wakes: 0, declined: false, lastWarning: "" };
|
|
167398
167440
|
const liveAbort = new AbortController();
|
|
167399
167441
|
let attemptedWake = -1;
|
|
@@ -167404,6 +167446,7 @@ async function runChild2(deps, plan, identity, compactedConversation, onCompacte
|
|
|
167404
167446
|
...["SIGHUP", "SIGTERM"].map(
|
|
167405
167447
|
(signal) => deps.signals.on(signal, () => {
|
|
167406
167448
|
state.terminating = true;
|
|
167449
|
+
deps.lifecycle?.({ kind: "child_signal", childPid: child.pid ?? null, signal });
|
|
167407
167450
|
child.signal(signal);
|
|
167408
167451
|
})
|
|
167409
167452
|
),
|
|
@@ -167426,6 +167469,7 @@ async function runChild2(deps, plan, identity, compactedConversation, onCompacte
|
|
|
167426
167469
|
const outcome = await deps.decideMove({ sessionId: plan.sessionId, ...conversationId === plan.sessionId ? {} : { conversationId }, from: identity, contextTokens: deps.contextTokens(conversationId) });
|
|
167427
167470
|
if (outcome.kind === "move") {
|
|
167428
167471
|
state.leaving = true;
|
|
167472
|
+
deps.lifecycle?.({ kind: "departure", reason: "quota" });
|
|
167429
167473
|
depart({ ...outcome, conversationId });
|
|
167430
167474
|
} else {
|
|
167431
167475
|
state.declined = true;
|
|
@@ -167452,6 +167496,7 @@ async function runChild2(deps, plan, identity, compactedConversation, onCompacte
|
|
|
167452
167496
|
const conversationId = decision.conversationId ?? plan.sessionId;
|
|
167453
167497
|
deps.log.info(`agent-shim: ${decision.reason}; compacting session ${plan.sessionId} in process`);
|
|
167454
167498
|
liveTask = live.compact(conversationId, liveAbort.signal).then((result) => {
|
|
167499
|
+
deps.lifecycle?.({ kind: "compaction", phase: "live", outcome: result.kind });
|
|
167455
167500
|
if (result.kind === "compacted") {
|
|
167456
167501
|
if (compaction.markCompacted(plan.sessionId, true, conversationId)) {
|
|
167457
167502
|
compacted = conversationId;
|
|
@@ -167462,6 +167507,7 @@ async function runChild2(deps, plan, identity, compactedConversation, onCompacte
|
|
|
167462
167507
|
deps.log.info(`agent-shim: session ${plan.sessionId} was left as it was: ${result.reason}`);
|
|
167463
167508
|
}
|
|
167464
167509
|
}).catch((error63) => {
|
|
167510
|
+
deps.lifecycle?.({ kind: "compaction", phase: "live", outcome: liveAbort.signal.aborted ? "interrupted" : "failed" });
|
|
167465
167511
|
if (!liveAbort.signal.aborted) deps.log.warn(`agent-shim: could not compact session ${plan.sessionId}: ${messageOf2(error63)}`);
|
|
167466
167512
|
}).finally(() => {
|
|
167467
167513
|
slot.release();
|
|
@@ -167490,6 +167536,7 @@ async function runChild2(deps, plan, identity, compactedConversation, onCompacte
|
|
|
167490
167536
|
const outcome = deps.decideRemodel({ sessionId: plan.sessionId, ...currentConversation2 === plan.sessionId ? {} : { conversationId: currentConversation2 }, from: identity, to: move.to, contextTokens: deps.contextTokens(currentConversation2) });
|
|
167491
167537
|
if (outcome.kind === "move") {
|
|
167492
167538
|
state.leaving = true;
|
|
167539
|
+
deps.lifecycle?.({ kind: "departure", reason: "model" });
|
|
167493
167540
|
depart({ kind: "remodel", to: outcome.to, model: move.model, conversationId: currentConversation2 });
|
|
167494
167541
|
} else {
|
|
167495
167542
|
deps.log.warn(`agent-shim: session ${plan.sessionId} picked a model under ${labelOf3(deps, move.to)}, but stays on ${labelOf3(deps, identity)}: ${outcome.reason}`);
|
|
@@ -167528,7 +167575,7 @@ async function runChild2(deps, plan, identity, compactedConversation, onCompacte
|
|
|
167528
167575
|
void check2();
|
|
167529
167576
|
});
|
|
167530
167577
|
try {
|
|
167531
|
-
const first = await Promise.race([
|
|
167578
|
+
const first = await Promise.race([observedExit.then((result2) => ({ kind: "exited", result: result2 })), departing]);
|
|
167532
167579
|
stopWatching();
|
|
167533
167580
|
stopWatchingMoves?.();
|
|
167534
167581
|
if (first.kind === "exited") {
|
|
@@ -167564,8 +167611,11 @@ async function compactSession(deps, compaction, slot, identity, sessionId, conve
|
|
|
167564
167611
|
abort.abort();
|
|
167565
167612
|
})
|
|
167566
167613
|
);
|
|
167614
|
+
let completed = false;
|
|
167567
167615
|
try {
|
|
167568
167616
|
const result = await compaction.compact({ identity: memberName(deps, identity), sessionId: conversationId, cwd: deps.cwd }, abort.signal);
|
|
167617
|
+
completed = true;
|
|
167618
|
+
deps.lifecycle?.({ kind: "compaction", phase: "after_move", outcome: result.kind });
|
|
167569
167619
|
if (result.kind === "unchanged") {
|
|
167570
167620
|
deps.log.info(`agent-shim: session ${sessionId} was left as it was: ${result.reason}`);
|
|
167571
167621
|
} else {
|
|
@@ -167573,6 +167623,7 @@ async function compactSession(deps, compaction, slot, identity, sessionId, conve
|
|
|
167573
167623
|
deps.log.info(`agent-shim: compacted session ${sessionId} on ${labelOf3(deps, identity)}${sizes}`);
|
|
167574
167624
|
}
|
|
167575
167625
|
} catch (error63) {
|
|
167626
|
+
deps.lifecycle?.({ kind: "compaction", phase: "after_move", outcome: interrupted.signal === void 0 ? "failed" : "interrupted" });
|
|
167576
167627
|
if (interrupted.signal === void 0) {
|
|
167577
167628
|
deps.log.warn(`agent-shim: could not compact session ${sessionId} on ${labelOf3(deps, identity)}, which resumes as it was: ${messageOf2(error63)}`);
|
|
167578
167629
|
}
|
|
@@ -167582,8 +167633,8 @@ async function compactSession(deps, compaction, slot, identity, sessionId, conve
|
|
|
167582
167633
|
}
|
|
167583
167634
|
slot.release();
|
|
167584
167635
|
}
|
|
167585
|
-
compaction.markCompacted(sessionId, true);
|
|
167586
|
-
return interrupted.signal;
|
|
167636
|
+
if (completed) compaction.markCompacted(sessionId, true);
|
|
167637
|
+
return { signal: interrupted.signal, completed };
|
|
167587
167638
|
}
|
|
167588
167639
|
async function supervise(deps, first) {
|
|
167589
167640
|
const { compaction } = deps;
|
|
@@ -167626,12 +167677,16 @@ async function supervise(deps, first) {
|
|
|
167626
167677
|
compaction.markCompacted(plan.sessionId, false);
|
|
167627
167678
|
const slot = compactedOnOld ? void 0 : compaction.acquire(outcome.to);
|
|
167628
167679
|
if (slot !== void 0) {
|
|
167629
|
-
const
|
|
167630
|
-
compactedHere = outcome.conversationId;
|
|
167631
|
-
if (
|
|
167632
|
-
return signalExit(
|
|
167680
|
+
const result = await compactSession(deps, compaction, slot, outcome.to, plan.sessionId, outcome.conversationId);
|
|
167681
|
+
if (result.completed) compactedHere = outcome.conversationId;
|
|
167682
|
+
if (result.signal !== void 0) {
|
|
167683
|
+
return signalExit(result.signal);
|
|
167633
167684
|
}
|
|
167685
|
+
} else {
|
|
167686
|
+
deps.lifecycle?.({ kind: "compaction", phase: "after_move", outcome: "not_attempted" });
|
|
167634
167687
|
}
|
|
167688
|
+
} else {
|
|
167689
|
+
deps.lifecycle?.({ kind: "compaction", phase: "after_move", outcome: "not_attempted" });
|
|
167635
167690
|
}
|
|
167636
167691
|
}
|
|
167637
167692
|
} finally {
|
|
@@ -167661,11 +167716,21 @@ async function runSupervised(params) {
|
|
|
167661
167716
|
log.warn(`agent-shim: pool "${pool}" resumes on a spent quota, but this launch runs unsupervised: ${first.reason}`);
|
|
167662
167717
|
return void 0;
|
|
167663
167718
|
}
|
|
167719
|
+
let entrypointSha256AtStart;
|
|
167720
|
+
try {
|
|
167721
|
+
const hash2 = (0, import_node_crypto35.createHash)("sha256");
|
|
167722
|
+
await (0, import_promises21.pipeline)((0, import_node_fs40.createReadStream)(realContentSourcePath()), hash2);
|
|
167723
|
+
entrypointSha256AtStart = hash2.digest("hex");
|
|
167724
|
+
} catch {
|
|
167725
|
+
entrypointSha256AtStart = null;
|
|
167726
|
+
log.warn("agent-shim: could not fingerprint the supervisor entrypoint");
|
|
167727
|
+
}
|
|
167728
|
+
const lifecycle = createLifecycleRecorder({ fs: realFarmFs, logsDir: paths.logsDir, fileId: (0, import_node_crypto35.randomUUID)(), sessionId: first.sessionId, supervisorPid: farm.lock.pid, supervisorVersion: package_default.version, entrypointSha256AtStart, now: farm.now, log });
|
|
167664
167729
|
let compaction;
|
|
167665
167730
|
const policy = params.pools[pool];
|
|
167666
167731
|
const markSettings = markHooksSettings(selfInvocation([]), paths.root, pool, first.sessionId);
|
|
167667
167732
|
const settingsArgs2 = [...params.extraFlags, ...params.passthrough];
|
|
167668
|
-
const settings2 = hasSettingsArgument(settingsArgs2) ? combineCallerSettings(settingsArgs2, markSettings, (name) => farm.fs.readFileUtf8(
|
|
167733
|
+
const settings2 = hasSettingsArgument(settingsArgs2) ? combineCallerSettings(settingsArgs2, markSettings, (name) => farm.fs.readFileUtf8(import_node_path96.default.resolve(farm.cwd, name))) : void 0;
|
|
167669
167734
|
const plugin = policy?.compactBeforeLimit === true ? stageNativeCompactionPlugin() : void 0;
|
|
167670
167735
|
if (policy?.compactBeforeLimit === true && plugin !== void 0) {
|
|
167671
167736
|
const baseCompaction = createCompactionDeps({
|
|
@@ -167725,6 +167790,7 @@ async function runSupervised(params) {
|
|
|
167725
167790
|
pool,
|
|
167726
167791
|
cwd: farm.cwd,
|
|
167727
167792
|
pid: farm.lock.pid,
|
|
167793
|
+
lifecycle,
|
|
167728
167794
|
prepare: (nextLaunch) => {
|
|
167729
167795
|
const plan = params.prepare(nextLaunch);
|
|
167730
167796
|
if (plugin === void 0) return plan;
|
|
@@ -167742,7 +167808,7 @@ async function runSupervised(params) {
|
|
|
167742
167808
|
let transcriptWarning = "";
|
|
167743
167809
|
const watchTranscript = () => {
|
|
167744
167810
|
const transcript = readSessionState(realFarmFs, paths, pool, first.sessionId)?.transcriptPath;
|
|
167745
|
-
const directory = transcript === void 0 ? void 0 :
|
|
167811
|
+
const directory = transcript === void 0 ? void 0 : import_node_path96.default.dirname(transcript);
|
|
167746
167812
|
if (compaction === void 0 || directory === watchedDir) {
|
|
167747
167813
|
return;
|
|
167748
167814
|
}
|
|
@@ -167978,7 +168044,7 @@ async function runClaude(argvOverride) {
|
|
|
167978
168044
|
// src/cli.ts
|
|
167979
168045
|
async function main() {
|
|
167980
168046
|
aliasLegacyEnv(process.env);
|
|
167981
|
-
const invokedName =
|
|
168047
|
+
const invokedName = import_node_path97.default.basename(process.argv[1] ?? "agent-shim");
|
|
167982
168048
|
if (isInvokedAsClaude(invokedName)) {
|
|
167983
168049
|
await runClaude();
|
|
167984
168050
|
return;
|