claude-use 11.46.0 → 11.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/cli.cjs +1077 -765
- package/dist/index.cjs +506 -451
- package/dist/index.mjs +502 -447
- package/dist/types/index.d.ts +12 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -318,10 +318,10 @@ function mergeDefs(...defs) {
|
|
|
318
318
|
function cloneDef(schema) {
|
|
319
319
|
return mergeDefs(schema._zod.def);
|
|
320
320
|
}
|
|
321
|
-
function getElementAtPath(obj,
|
|
322
|
-
if (!
|
|
321
|
+
function getElementAtPath(obj, path66) {
|
|
322
|
+
if (!path66)
|
|
323
323
|
return obj;
|
|
324
|
-
return
|
|
324
|
+
return path66.reduce((acc, key) => acc?.[key], obj);
|
|
325
325
|
}
|
|
326
326
|
function promiseAllObject(promisesObj) {
|
|
327
327
|
const keys = Object.keys(promisesObj);
|
|
@@ -580,11 +580,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
580
580
|
}
|
|
581
581
|
return false;
|
|
582
582
|
}
|
|
583
|
-
function prefixIssues(
|
|
583
|
+
function prefixIssues(path66, issues) {
|
|
584
584
|
return issues.map((iss) => {
|
|
585
585
|
var _a4;
|
|
586
586
|
(_a4 = iss).path ?? (_a4.path = []);
|
|
587
|
-
iss.path.unshift(
|
|
587
|
+
iss.path.unshift(path66);
|
|
588
588
|
return iss;
|
|
589
589
|
});
|
|
590
590
|
}
|
|
@@ -1105,16 +1105,16 @@ function flattenError(error63, mapper = (issue2) => issue2.message) {
|
|
|
1105
1105
|
}
|
|
1106
1106
|
function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
1107
1107
|
const fieldErrors = { _errors: [] };
|
|
1108
|
-
const processError = (error64,
|
|
1108
|
+
const processError = (error64, path66 = []) => {
|
|
1109
1109
|
for (const issue2 of error64.issues) {
|
|
1110
1110
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1111
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1111
|
+
issue2.errors.map((issues) => processError({ issues }, [...path66, ...issue2.path]));
|
|
1112
1112
|
} else if (issue2.code === "invalid_key") {
|
|
1113
|
-
processError({ issues: issue2.issues }, [...
|
|
1113
|
+
processError({ issues: issue2.issues }, [...path66, ...issue2.path]);
|
|
1114
1114
|
} else if (issue2.code === "invalid_element") {
|
|
1115
|
-
processError({ issues: issue2.issues }, [...
|
|
1115
|
+
processError({ issues: issue2.issues }, [...path66, ...issue2.path]);
|
|
1116
1116
|
} else {
|
|
1117
|
-
const fullpath = [...
|
|
1117
|
+
const fullpath = [...path66, ...issue2.path];
|
|
1118
1118
|
if (fullpath.length === 0) {
|
|
1119
1119
|
fieldErrors._errors.push(mapper(issue2));
|
|
1120
1120
|
} else {
|
|
@@ -1153,17 +1153,17 @@ function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
1155
1155
|
const result = { errors: [] };
|
|
1156
|
-
const processError = (error64,
|
|
1156
|
+
const processError = (error64, path66 = []) => {
|
|
1157
1157
|
var _a4;
|
|
1158
1158
|
for (const issue2 of error64.issues) {
|
|
1159
1159
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1160
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1160
|
+
issue2.errors.map((issues) => processError({ issues }, [...path66, ...issue2.path]));
|
|
1161
1161
|
} else if (issue2.code === "invalid_key") {
|
|
1162
|
-
processError({ issues: issue2.issues }, [...
|
|
1162
|
+
processError({ issues: issue2.issues }, [...path66, ...issue2.path]);
|
|
1163
1163
|
} else if (issue2.code === "invalid_element") {
|
|
1164
|
-
processError({ issues: issue2.issues }, [...
|
|
1164
|
+
processError({ issues: issue2.issues }, [...path66, ...issue2.path]);
|
|
1165
1165
|
} else {
|
|
1166
|
-
const fullpath = [...
|
|
1166
|
+
const fullpath = [...path66, ...issue2.path];
|
|
1167
1167
|
if (fullpath.length === 0) {
|
|
1168
1168
|
result.errors.push(mapper(issue2));
|
|
1169
1169
|
continue;
|
|
@@ -1202,8 +1202,8 @@ function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
|
1202
1202
|
}
|
|
1203
1203
|
function toDotPath(_path) {
|
|
1204
1204
|
const segs = [];
|
|
1205
|
-
const
|
|
1206
|
-
for (const seg of
|
|
1205
|
+
const path66 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1206
|
+
for (const seg of path66) {
|
|
1207
1207
|
if (typeof seg === "number")
|
|
1208
1208
|
segs.push(`[${seg}]`);
|
|
1209
1209
|
else if (typeof seg === "symbol")
|
|
@@ -19199,13 +19199,13 @@ function resolveRef(ref, ctx) {
|
|
|
19199
19199
|
if (!ref.startsWith("#")) {
|
|
19200
19200
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
19201
19201
|
}
|
|
19202
|
-
const
|
|
19203
|
-
if (
|
|
19202
|
+
const path66 = ref.slice(1).split("/").filter(Boolean);
|
|
19203
|
+
if (path66.length === 0) {
|
|
19204
19204
|
return ctx.rootSchema;
|
|
19205
19205
|
}
|
|
19206
19206
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
19207
|
-
if (
|
|
19208
|
-
const key =
|
|
19207
|
+
if (path66[0] === defsKey) {
|
|
19208
|
+
const key = path66[1] === void 0 ? void 0 : decodeJSONPointerSegment(path66[1]);
|
|
19209
19209
|
if (!key || !ctx.defs[key]) {
|
|
19210
19210
|
throw new Error(`Reference not found: ${ref}`);
|
|
19211
19211
|
}
|
|
@@ -23712,42 +23712,42 @@ var require_defaults = __commonJS({
|
|
|
23712
23712
|
var require_env_paths = __commonJS({
|
|
23713
23713
|
"node_modules/.pnpm/env-paths@2.2.1/node_modules/env-paths/index.js"(exports2, module2) {
|
|
23714
23714
|
"use strict";
|
|
23715
|
-
var
|
|
23715
|
+
var path66 = require("path");
|
|
23716
23716
|
var os13 = require("os");
|
|
23717
23717
|
var homedir = os13.homedir();
|
|
23718
23718
|
var tmpdir = os13.tmpdir();
|
|
23719
23719
|
var { env } = process;
|
|
23720
23720
|
var macos = (name) => {
|
|
23721
|
-
const library =
|
|
23721
|
+
const library = path66.join(homedir, "Library");
|
|
23722
23722
|
return {
|
|
23723
|
-
data:
|
|
23724
|
-
config:
|
|
23725
|
-
cache:
|
|
23726
|
-
log:
|
|
23727
|
-
temp:
|
|
23723
|
+
data: path66.join(library, "Application Support", name),
|
|
23724
|
+
config: path66.join(library, "Preferences", name),
|
|
23725
|
+
cache: path66.join(library, "Caches", name),
|
|
23726
|
+
log: path66.join(library, "Logs", name),
|
|
23727
|
+
temp: path66.join(tmpdir, name)
|
|
23728
23728
|
};
|
|
23729
23729
|
};
|
|
23730
23730
|
var windows = (name) => {
|
|
23731
|
-
const appData = env.APPDATA ||
|
|
23732
|
-
const localAppData = env.LOCALAPPDATA ||
|
|
23731
|
+
const appData = env.APPDATA || path66.join(homedir, "AppData", "Roaming");
|
|
23732
|
+
const localAppData = env.LOCALAPPDATA || path66.join(homedir, "AppData", "Local");
|
|
23733
23733
|
return {
|
|
23734
23734
|
// Data/config/cache/log are invented by me as Windows isn't opinionated about this
|
|
23735
|
-
data:
|
|
23736
|
-
config:
|
|
23737
|
-
cache:
|
|
23738
|
-
log:
|
|
23739
|
-
temp:
|
|
23735
|
+
data: path66.join(localAppData, name, "Data"),
|
|
23736
|
+
config: path66.join(appData, name, "Config"),
|
|
23737
|
+
cache: path66.join(localAppData, name, "Cache"),
|
|
23738
|
+
log: path66.join(localAppData, name, "Log"),
|
|
23739
|
+
temp: path66.join(tmpdir, name)
|
|
23740
23740
|
};
|
|
23741
23741
|
};
|
|
23742
23742
|
var linux = (name) => {
|
|
23743
|
-
const username =
|
|
23743
|
+
const username = path66.basename(homedir);
|
|
23744
23744
|
return {
|
|
23745
|
-
data:
|
|
23746
|
-
config:
|
|
23747
|
-
cache:
|
|
23745
|
+
data: path66.join(env.XDG_DATA_HOME || path66.join(homedir, ".local", "share"), name),
|
|
23746
|
+
config: path66.join(env.XDG_CONFIG_HOME || path66.join(homedir, ".config"), name),
|
|
23747
|
+
cache: path66.join(env.XDG_CACHE_HOME || path66.join(homedir, ".cache"), name),
|
|
23748
23748
|
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
23749
|
-
log:
|
|
23750
|
-
temp:
|
|
23749
|
+
log: path66.join(env.XDG_STATE_HOME || path66.join(homedir, ".local", "state"), name),
|
|
23750
|
+
temp: path66.join(tmpdir, username, name)
|
|
23751
23751
|
};
|
|
23752
23752
|
};
|
|
23753
23753
|
var envPaths = (name, options) => {
|
|
@@ -23815,11 +23815,11 @@ var require_util = __commonJS({
|
|
|
23815
23815
|
return result;
|
|
23816
23816
|
}
|
|
23817
23817
|
exports2.emplace = emplace;
|
|
23818
|
-
function getPropertyByPath(source,
|
|
23819
|
-
if (typeof
|
|
23820
|
-
return source[
|
|
23818
|
+
function getPropertyByPath(source, path66) {
|
|
23819
|
+
if (typeof path66 === "string" && Object.prototype.hasOwnProperty.call(source, path66)) {
|
|
23820
|
+
return source[path66];
|
|
23821
23821
|
}
|
|
23822
|
-
const parsedPath = typeof
|
|
23822
|
+
const parsedPath = typeof path66 === "string" ? path66.split(".") : path66;
|
|
23823
23823
|
return parsedPath.reduce((previous, key) => {
|
|
23824
23824
|
if (previous === void 0) {
|
|
23825
23825
|
return previous;
|
|
@@ -23842,9 +23842,9 @@ var require_util = __commonJS({
|
|
|
23842
23842
|
return Object.fromEntries(Object.entries(options).filter(([, value2]) => value2 !== void 0));
|
|
23843
23843
|
}
|
|
23844
23844
|
exports2.removeUndefinedValuesFromObject = removeUndefinedValuesFromObject;
|
|
23845
|
-
async function isDirectory(
|
|
23845
|
+
async function isDirectory(path66) {
|
|
23846
23846
|
try {
|
|
23847
|
-
const stat = await fs_1.promises.stat(
|
|
23847
|
+
const stat = await fs_1.promises.stat(path66);
|
|
23848
23848
|
return stat.isDirectory();
|
|
23849
23849
|
} catch (e14) {
|
|
23850
23850
|
if (e14.code === "ENOENT") {
|
|
@@ -23854,9 +23854,9 @@ var require_util = __commonJS({
|
|
|
23854
23854
|
}
|
|
23855
23855
|
}
|
|
23856
23856
|
exports2.isDirectory = isDirectory;
|
|
23857
|
-
function isDirectorySync(
|
|
23857
|
+
function isDirectorySync(path66) {
|
|
23858
23858
|
try {
|
|
23859
|
-
const stat = fs_1.default.statSync(
|
|
23859
|
+
const stat = fs_1.default.statSync(path66);
|
|
23860
23860
|
return stat.isDirectory();
|
|
23861
23861
|
} catch (e14) {
|
|
23862
23862
|
if (e14.code === "ENOENT") {
|
|
@@ -23954,7 +23954,7 @@ var require_ExplorerBase = __commonJS({
|
|
|
23954
23954
|
const idx = importStack.indexOf(fullPath);
|
|
23955
23955
|
if (idx !== -1) {
|
|
23956
23956
|
throw new Error(`Circular import detected:
|
|
23957
|
-
${[...importStack, fullPath].map((
|
|
23957
|
+
${[...importStack, fullPath].map((path66, i10) => `${i10 + 1}. ${path66}`).join("\n")} (same as ${idx + 1}.)`);
|
|
23958
23958
|
}
|
|
23959
23959
|
}
|
|
23960
23960
|
}
|
|
@@ -24142,9 +24142,9 @@ var require_Explorer = __commonJS({
|
|
|
24142
24142
|
throw error63;
|
|
24143
24143
|
}
|
|
24144
24144
|
}
|
|
24145
|
-
async #fileExists(
|
|
24145
|
+
async #fileExists(path66) {
|
|
24146
24146
|
try {
|
|
24147
|
-
await promises_1.default.stat(
|
|
24147
|
+
await promises_1.default.stat(path66);
|
|
24148
24148
|
return true;
|
|
24149
24149
|
} catch (e14) {
|
|
24150
24150
|
return false;
|
|
@@ -24304,9 +24304,9 @@ var require_ExplorerSync = __commonJS({
|
|
|
24304
24304
|
throw error63;
|
|
24305
24305
|
}
|
|
24306
24306
|
}
|
|
24307
|
-
#fileExists(
|
|
24307
|
+
#fileExists(path66) {
|
|
24308
24308
|
try {
|
|
24309
|
-
fs_1.default.statSync(
|
|
24309
|
+
fs_1.default.statSync(path66);
|
|
24310
24310
|
return true;
|
|
24311
24311
|
} catch (e14) {
|
|
24312
24312
|
return false;
|
|
@@ -24430,7 +24430,7 @@ var require_dist = __commonJS({
|
|
|
24430
24430
|
};
|
|
24431
24431
|
}
|
|
24432
24432
|
function getResolvedSearchPlaces(moduleName, toolDefinedSearchPlaces, userConfiguredOptions) {
|
|
24433
|
-
const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((
|
|
24433
|
+
const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path66) => path66.replace("{name}", moduleName));
|
|
24434
24434
|
if (userConfiguredOptions.mergeSearchPlaces) {
|
|
24435
24435
|
return [...userConfiguredSearchPlaces ?? [], ...toolDefinedSearchPlaces];
|
|
24436
24436
|
}
|
|
@@ -24560,7 +24560,7 @@ function parseIgnoringUnrecognisedKeys(schema, raw) {
|
|
|
24560
24560
|
return second.success ? { success: true, data: second.data, ignored } : { success: false, issues: second.error.issues };
|
|
24561
24561
|
}
|
|
24562
24562
|
function describeIgnoredKeys(filePath, ignored) {
|
|
24563
|
-
const places = ignored.map(({ path:
|
|
24563
|
+
const places = ignored.map(({ path: path66, keys }) => `${path66.length === 0 ? "" : `${path66.map(String).join(".")}.`}${keys.join(", ")}`);
|
|
24564
24564
|
return `${filePath} has settings this version of agent-shim does not know and ignores: ${places.join("; ")}. A newer release may read them.`;
|
|
24565
24565
|
}
|
|
24566
24566
|
function noteIgnoredKeys(filePath, ignored) {
|
|
@@ -24582,9 +24582,9 @@ function restoreIgnoredKeys(filePath, value2) {
|
|
|
24582
24582
|
return value2;
|
|
24583
24583
|
}
|
|
24584
24584
|
const restored = structuredClone(value2);
|
|
24585
|
-
for (const { path:
|
|
24585
|
+
for (const { path: path66, values } of ignored) {
|
|
24586
24586
|
let holder = restored;
|
|
24587
|
-
for (const step2 of
|
|
24587
|
+
for (const step2 of path66) {
|
|
24588
24588
|
holder = isRecord(holder) ? holder[step2] : void 0;
|
|
24589
24589
|
}
|
|
24590
24590
|
if (isRecord(holder)) {
|
|
@@ -27035,7 +27035,6 @@ var init_schema = __esm({
|
|
|
27035
27035
|
delay: external_exports.string().regex(DURATION_RE, "must be a duration such as 5s or 500ms").optional(),
|
|
27036
27036
|
/** Whether the launcher waits for a key press after its own output before it starts claude. Takes the place of `delay` when both are set. Applies only when a terminal is watching. */
|
|
27037
27037
|
pause: external_exports.boolean().optional(),
|
|
27038
|
-
/** Whether a provider session routes provider-qualified model names (`z/glm-5.3`, `auto`) through the `models` block to the provider that serves them, instead of sending every request to the launch provider. */
|
|
27039
27038
|
/** Whether the launcher's report, for a launch that picks from a pool, lists every member the pick ranked with why each stands where it does, and not only the member it picked. */
|
|
27040
27039
|
explain: external_exports.boolean().optional()
|
|
27041
27040
|
});
|
|
@@ -27439,10 +27438,10 @@ var init_schema = __esm({
|
|
|
27439
27438
|
});
|
|
27440
27439
|
|
|
27441
27440
|
// src/frontdoor/state.ts
|
|
27442
|
-
function readFrontDoorState(
|
|
27441
|
+
function readFrontDoorState(fs28, stateFile) {
|
|
27443
27442
|
let raw;
|
|
27444
27443
|
try {
|
|
27445
|
-
raw =
|
|
27444
|
+
raw = fs28.readFileUtf8(stateFile);
|
|
27446
27445
|
} catch {
|
|
27447
27446
|
return void 0;
|
|
27448
27447
|
}
|
|
@@ -27456,9 +27455,9 @@ function readFrontDoorState(fs26, stateFile) {
|
|
|
27456
27455
|
return void 0;
|
|
27457
27456
|
}
|
|
27458
27457
|
}
|
|
27459
|
-
function writeFrontDoorState(
|
|
27460
|
-
|
|
27461
|
-
|
|
27458
|
+
function writeFrontDoorState(fs28, stateFile, state) {
|
|
27459
|
+
fs28.mkdirp(import_node_path5.default.dirname(stateFile));
|
|
27460
|
+
fs28.writeFilePrivate(stateFile, `${JSON.stringify(state, null, 2)}
|
|
27462
27461
|
`);
|
|
27463
27462
|
}
|
|
27464
27463
|
function directOrigin(port) {
|
|
@@ -27468,27 +27467,27 @@ function frontDoorOrigin(state) {
|
|
|
27468
27467
|
const port = state?.directPort ?? state?.lastDirectPort;
|
|
27469
27468
|
return port === void 0 ? void 0 : directOrigin(port);
|
|
27470
27469
|
}
|
|
27471
|
-
function writeFrontDoorDirectRecord(
|
|
27472
|
-
|
|
27473
|
-
|
|
27470
|
+
function writeFrontDoorDirectRecord(fs28, recordsDir, record2) {
|
|
27471
|
+
fs28.mkdirp(recordsDir);
|
|
27472
|
+
fs28.writeFilePrivate(import_node_path5.default.join(recordsDir, `${String(record2.pid)}.json`), `${JSON.stringify({ directPort: record2.directPort })}
|
|
27474
27473
|
`);
|
|
27475
27474
|
}
|
|
27476
|
-
function removeFrontDoorDirectRecord(
|
|
27477
|
-
|
|
27475
|
+
function removeFrontDoorDirectRecord(fs28, recordsDir, pid) {
|
|
27476
|
+
fs28.removeRecursive(import_node_path5.default.join(recordsDir, `${String(pid)}.json`));
|
|
27478
27477
|
}
|
|
27479
27478
|
function recordPid(file2) {
|
|
27480
27479
|
const pidText = /^([1-9]\d*)\.json$/.exec(file2)?.[1];
|
|
27481
27480
|
const pid = pidText === void 0 ? void 0 : Number(pidText);
|
|
27482
27481
|
return pid !== void 0 && Number.isSafeInteger(pid) ? pid : void 0;
|
|
27483
27482
|
}
|
|
27484
|
-
function readDirectRecordEntry(
|
|
27483
|
+
function readDirectRecordEntry(fs28, recordsDir, file2) {
|
|
27485
27484
|
const pid = recordPid(file2);
|
|
27486
27485
|
if (pid === void 0) {
|
|
27487
27486
|
return void 0;
|
|
27488
27487
|
}
|
|
27489
27488
|
let raw;
|
|
27490
27489
|
try {
|
|
27491
|
-
raw =
|
|
27490
|
+
raw = fs28.readFileUtf8(import_node_path5.default.join(recordsDir, file2));
|
|
27492
27491
|
} catch {
|
|
27493
27492
|
return void 0;
|
|
27494
27493
|
}
|
|
@@ -27502,47 +27501,47 @@ function readDirectRecordEntry(fs26, recordsDir, file2) {
|
|
|
27502
27501
|
return { malformed: true };
|
|
27503
27502
|
}
|
|
27504
27503
|
}
|
|
27505
|
-
function listFrontDoorDirectRecords(
|
|
27506
|
-
return
|
|
27507
|
-
const entry = readDirectRecordEntry(
|
|
27504
|
+
function listFrontDoorDirectRecords(fs28, recordsDir) {
|
|
27505
|
+
return fs28.readdir(recordsDir).flatMap((file2) => {
|
|
27506
|
+
const entry = readDirectRecordEntry(fs28, recordsDir, file2);
|
|
27508
27507
|
return entry?.record === void 0 ? [] : [entry.record];
|
|
27509
27508
|
}).sort((a10, b) => a10.pid - b.pid);
|
|
27510
27509
|
}
|
|
27511
|
-
function pruneMalformedFrontDoorDirectFiles(
|
|
27512
|
-
for (const file2 of
|
|
27510
|
+
function pruneMalformedFrontDoorDirectFiles(fs28, recordsDir, isRunning) {
|
|
27511
|
+
for (const file2 of fs28.readdir(recordsDir)) {
|
|
27513
27512
|
const writer = RECORD_TEMPORARY_FILE.exec(file2)?.[1];
|
|
27514
27513
|
const stale = writer !== void 0 && !isRunning(Number(writer));
|
|
27515
|
-
if (stale || readDirectRecordEntry(
|
|
27516
|
-
|
|
27514
|
+
if (stale || readDirectRecordEntry(fs28, recordsDir, file2)?.malformed === true) {
|
|
27515
|
+
fs28.removeRecursive(import_node_path5.default.join(recordsDir, file2));
|
|
27517
27516
|
}
|
|
27518
27517
|
}
|
|
27519
27518
|
}
|
|
27520
27519
|
function liveFrontDoorDirectRecords(records, liveness) {
|
|
27521
27520
|
return records.filter((record2) => liveness.doors.has(record2.pid) || liveness.unknown.has(record2.pid));
|
|
27522
27521
|
}
|
|
27523
|
-
function pruneDeadFrontDoorDirectRecords(
|
|
27522
|
+
function pruneDeadFrontDoorDirectRecords(fs28, recordsDir, records, liveness) {
|
|
27524
27523
|
for (const record2 of records) {
|
|
27525
27524
|
if (!liveness.doors.has(record2.pid) && !liveness.unknown.has(record2.pid)) {
|
|
27526
|
-
removeFrontDoorDirectRecord(
|
|
27525
|
+
removeFrontDoorDirectRecord(fs28, recordsDir, record2.pid);
|
|
27527
27526
|
}
|
|
27528
27527
|
}
|
|
27529
27528
|
}
|
|
27530
27529
|
function recordOf(details) {
|
|
27531
27530
|
return details === void 0 ? {} : { sessionId: details.sessionId, ...details.models === void 0 ? {} : { models: details.models } };
|
|
27532
27531
|
}
|
|
27533
|
-
function writeFrontDoorSession(
|
|
27534
|
-
|
|
27535
|
-
|
|
27532
|
+
function writeFrontDoorSession(fs28, sessionsDir, session) {
|
|
27533
|
+
fs28.mkdirPrivate(sessionsDir);
|
|
27534
|
+
fs28.writeFilePrivate(import_node_path5.default.join(sessionsDir, `${String(session.pid)}.json`), `${JSON.stringify(session, null, 2)}
|
|
27536
27535
|
`);
|
|
27537
27536
|
}
|
|
27538
|
-
function listFrontDoorSessions(
|
|
27537
|
+
function listFrontDoorSessions(fs28, sessionsDir) {
|
|
27539
27538
|
const sessions = [];
|
|
27540
|
-
for (const name of
|
|
27539
|
+
for (const name of fs28.readdir(sessionsDir)) {
|
|
27541
27540
|
if (!name.endsWith(".json")) {
|
|
27542
27541
|
continue;
|
|
27543
27542
|
}
|
|
27544
27543
|
try {
|
|
27545
|
-
const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(
|
|
27544
|
+
const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(fs28.readFileUtf8(import_node_path5.default.join(sessionsDir, name)) ?? ""));
|
|
27546
27545
|
if (parsed.success) {
|
|
27547
27546
|
sessions.push({ pid: parsed.data.pid, startedAt: parsed.data.startedAt, ...parsed.data.supervisorPid === void 0 ? {} : { supervisorPid: parsed.data.supervisorPid } });
|
|
27548
27547
|
}
|
|
@@ -27552,27 +27551,27 @@ function listFrontDoorSessions(fs26, sessionsDir) {
|
|
|
27552
27551
|
}
|
|
27553
27552
|
return sessions.sort((a10, b) => a10.pid - b.pid);
|
|
27554
27553
|
}
|
|
27555
|
-
function removeFrontDoorSession(
|
|
27556
|
-
|
|
27554
|
+
function removeFrontDoorSession(fs28, sessionsDir, pid) {
|
|
27555
|
+
fs28.removeRecursive(import_node_path5.default.join(sessionsDir, `${String(pid)}.json`));
|
|
27557
27556
|
}
|
|
27558
|
-
function pruneDeadFrontDoorSessions(
|
|
27557
|
+
function pruneDeadFrontDoorSessions(fs28, sessionsDir, isRunning) {
|
|
27559
27558
|
const removed = [];
|
|
27560
|
-
for (const session of listFrontDoorSessions(
|
|
27559
|
+
for (const session of listFrontDoorSessions(fs28, sessionsDir)) {
|
|
27561
27560
|
if (!isRunning(session.pid)) {
|
|
27562
|
-
removeFrontDoorSession(
|
|
27561
|
+
removeFrontDoorSession(fs28, sessionsDir, session.pid);
|
|
27563
27562
|
removed.push(session.pid);
|
|
27564
27563
|
}
|
|
27565
27564
|
}
|
|
27566
27565
|
return removed;
|
|
27567
27566
|
}
|
|
27568
|
-
function liveSessionTokens(
|
|
27567
|
+
function liveSessionTokens(fs28, sessionsDir) {
|
|
27569
27568
|
const tokens = /* @__PURE__ */ new Set();
|
|
27570
|
-
for (const name of
|
|
27569
|
+
for (const name of fs28.readdir(sessionsDir)) {
|
|
27571
27570
|
if (!name.endsWith(".json")) {
|
|
27572
27571
|
continue;
|
|
27573
27572
|
}
|
|
27574
27573
|
try {
|
|
27575
|
-
const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(
|
|
27574
|
+
const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(fs28.readFileUtf8(import_node_path5.default.join(sessionsDir, name)) ?? ""));
|
|
27576
27575
|
if (parsed.success) {
|
|
27577
27576
|
tokens.add(parsed.data.token);
|
|
27578
27577
|
}
|
|
@@ -27582,13 +27581,13 @@ function liveSessionTokens(fs26, sessionsDir) {
|
|
|
27582
27581
|
}
|
|
27583
27582
|
return tokens;
|
|
27584
27583
|
}
|
|
27585
|
-
function readFrontDoorSessionModels(
|
|
27586
|
-
for (const name of
|
|
27584
|
+
function readFrontDoorSessionModels(fs28, sessionsDir, sessionId) {
|
|
27585
|
+
for (const name of fs28.readdir(sessionsDir)) {
|
|
27587
27586
|
if (!name.endsWith(".json")) {
|
|
27588
27587
|
continue;
|
|
27589
27588
|
}
|
|
27590
27589
|
try {
|
|
27591
|
-
const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(
|
|
27590
|
+
const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(fs28.readFileUtf8(import_node_path5.default.join(sessionsDir, name)) ?? ""));
|
|
27592
27591
|
if (parsed.success && parsed.data.sessionId === sessionId) {
|
|
27593
27592
|
return parsed.data.models;
|
|
27594
27593
|
}
|
|
@@ -27651,43 +27650,43 @@ function parseJson(raw, schema) {
|
|
|
27651
27650
|
const parsed = schema.safeParse(JSON.parse(raw));
|
|
27652
27651
|
return parsed.success ? parsed.data : void 0;
|
|
27653
27652
|
}
|
|
27654
|
-
function readHeadroomState(
|
|
27653
|
+
function readHeadroomState(fs28, stateFile) {
|
|
27655
27654
|
try {
|
|
27656
|
-
return parseJson(
|
|
27655
|
+
return parseJson(fs28.readFileUtf8(stateFile), HeadroomStateSchema);
|
|
27657
27656
|
} catch {
|
|
27658
27657
|
return void 0;
|
|
27659
27658
|
}
|
|
27660
27659
|
}
|
|
27661
|
-
function writeHeadroomState(
|
|
27662
|
-
|
|
27663
|
-
|
|
27660
|
+
function writeHeadroomState(fs28, stateFile, state) {
|
|
27661
|
+
fs28.mkdirp(import_node_path6.default.dirname(stateFile));
|
|
27662
|
+
fs28.writeFilePrivate(stateFile, `${JSON.stringify(state, null, 2)}
|
|
27664
27663
|
`);
|
|
27665
27664
|
}
|
|
27666
|
-
function resolveServingHeadroomState(
|
|
27667
|
-
const current = readHeadroomState(
|
|
27665
|
+
function resolveServingHeadroomState(fs28, files, isRunning) {
|
|
27666
|
+
const current = readHeadroomState(fs28, files.stateFile);
|
|
27668
27667
|
if (current !== void 0) {
|
|
27669
27668
|
return { path: files.stateFile, state: current };
|
|
27670
27669
|
}
|
|
27671
|
-
const legacy = readHeadroomState(
|
|
27670
|
+
const legacy = readHeadroomState(fs28, files.legacyStateFile);
|
|
27672
27671
|
if (legacy?.supervisorPid !== void 0 && isRunning(legacy.supervisorPid)) {
|
|
27673
27672
|
return { path: files.legacyStateFile, state: legacy };
|
|
27674
27673
|
}
|
|
27675
27674
|
return void 0;
|
|
27676
27675
|
}
|
|
27677
|
-
function migrateHeadroomState(
|
|
27678
|
-
const legacy = readHeadroomState(
|
|
27676
|
+
function migrateHeadroomState(fs28, files, isRunning) {
|
|
27677
|
+
const legacy = readHeadroomState(fs28, files.legacyStateFile);
|
|
27679
27678
|
const legacyLive = legacy?.supervisorPid !== void 0 && isRunning(legacy.supervisorPid);
|
|
27680
|
-
const current = readHeadroomState(
|
|
27679
|
+
const current = readHeadroomState(fs28, files.stateFile);
|
|
27681
27680
|
if (current !== void 0 || legacyLive) {
|
|
27682
|
-
if (!legacyLive &&
|
|
27683
|
-
|
|
27681
|
+
if (!legacyLive && fs28.readFileUtf8(files.legacyStateFile) !== void 0) {
|
|
27682
|
+
fs28.removeRecursive(files.legacyStateFile);
|
|
27684
27683
|
}
|
|
27685
27684
|
return;
|
|
27686
27685
|
}
|
|
27687
27686
|
if (legacy !== void 0) {
|
|
27688
|
-
writeHeadroomState(
|
|
27687
|
+
writeHeadroomState(fs28, files.stateFile, legacy);
|
|
27689
27688
|
}
|
|
27690
|
-
|
|
27689
|
+
fs28.removeRecursive(files.legacyStateFile);
|
|
27691
27690
|
}
|
|
27692
27691
|
function hashAllowlist(allowlist) {
|
|
27693
27692
|
return (0, import_node_crypto2.createHash)("sha256").update(allowlist.join("\n")).digest("hex");
|
|
@@ -27720,27 +27719,27 @@ function isAdmissibleUrl(entry) {
|
|
|
27720
27719
|
function parseAllowlistFile(content) {
|
|
27721
27720
|
return content.replace(/^\uFEFF/, "").replace(ALLOWLIST_FILE_COMMENT, "").split(ALLOWLIST_FILE_SEPARATORS).map((entry) => entry.replace(ALLOWLIST_SURROUNDING_WHITESPACE, "")).filter((entry) => entry !== "" && !ALLOWLIST_ENTRY_WHITESPACE.test(entry) && (entry.includes("://") ? isAdmissibleUrl(entry) : isBareHost(entry)));
|
|
27722
27721
|
}
|
|
27723
|
-
function writeAllowlistFile(
|
|
27724
|
-
|
|
27725
|
-
|
|
27722
|
+
function writeAllowlistFile(fs28, allowlistFile, allowlist) {
|
|
27723
|
+
fs28.mkdirPrivate(import_node_path6.default.dirname(allowlistFile));
|
|
27724
|
+
fs28.writeFilePrivate(allowlistFile, formatAllowlistFile(allowlist));
|
|
27726
27725
|
}
|
|
27727
|
-
function pruneStaleAllowlistTemporaries(
|
|
27726
|
+
function pruneStaleAllowlistTemporaries(fs28, allowlistFile, isRunning) {
|
|
27728
27727
|
const prefix = `${import_node_path6.default.basename(allowlistFile)}.`;
|
|
27729
|
-
for (const name of
|
|
27728
|
+
for (const name of fs28.readdir(import_node_path6.default.dirname(allowlistFile))) {
|
|
27730
27729
|
const writer = name.startsWith(prefix) ? /^([1-9]\d*)\.tmp$/.exec(name.slice(prefix.length))?.[1] : void 0;
|
|
27731
27730
|
if (writer !== void 0 && !isRunning(Number(writer))) {
|
|
27732
|
-
|
|
27731
|
+
fs28.removeRecursive(import_node_path6.default.join(import_node_path6.default.dirname(allowlistFile), name));
|
|
27733
27732
|
}
|
|
27734
27733
|
}
|
|
27735
27734
|
}
|
|
27736
|
-
function readAllProviders(
|
|
27735
|
+
function readAllProviders(fs28, providersDir) {
|
|
27737
27736
|
const result = [];
|
|
27738
|
-
for (const name of
|
|
27737
|
+
for (const name of fs28.readdir(providersDir)) {
|
|
27739
27738
|
if (!name.endsWith(".json")) {
|
|
27740
27739
|
continue;
|
|
27741
27740
|
}
|
|
27742
27741
|
try {
|
|
27743
|
-
const parsed = parseJson(
|
|
27742
|
+
const parsed = parseJson(fs28.readFileUtf8(import_node_path6.default.join(providersDir, name)), ProviderSchema);
|
|
27744
27743
|
if (parsed !== void 0) {
|
|
27745
27744
|
result.push({ name: name.slice(0, -".json".length), provider: parsed });
|
|
27746
27745
|
}
|
|
@@ -27750,22 +27749,22 @@ function readAllProviders(fs26, providersDir) {
|
|
|
27750
27749
|
}
|
|
27751
27750
|
return result;
|
|
27752
27751
|
}
|
|
27753
|
-
function writeSession(
|
|
27754
|
-
|
|
27755
|
-
|
|
27752
|
+
function writeSession(fs28, sessionsDir, session) {
|
|
27753
|
+
fs28.mkdirp(sessionsDir);
|
|
27754
|
+
fs28.writeFileUtf8(import_node_path6.default.join(sessionsDir, `${String(session.pid)}.json`), `${JSON.stringify(session, null, 2)}
|
|
27756
27755
|
`);
|
|
27757
27756
|
}
|
|
27758
|
-
function removeSession(
|
|
27759
|
-
|
|
27757
|
+
function removeSession(fs28, sessionsDir, pid) {
|
|
27758
|
+
fs28.removeRecursive(import_node_path6.default.join(sessionsDir, `${String(pid)}.json`));
|
|
27760
27759
|
}
|
|
27761
|
-
function listSessions(
|
|
27760
|
+
function listSessions(fs28, sessionsDir) {
|
|
27762
27761
|
const sessions = [];
|
|
27763
|
-
for (const name of
|
|
27762
|
+
for (const name of fs28.readdir(sessionsDir)) {
|
|
27764
27763
|
if (!name.endsWith(".json")) {
|
|
27765
27764
|
continue;
|
|
27766
27765
|
}
|
|
27767
27766
|
try {
|
|
27768
|
-
const parsed = parseJson(
|
|
27767
|
+
const parsed = parseJson(fs28.readFileUtf8(import_node_path6.default.join(sessionsDir, name)), HeadroomSessionSchema);
|
|
27769
27768
|
if (parsed !== void 0) {
|
|
27770
27769
|
sessions.push(parsed);
|
|
27771
27770
|
}
|
|
@@ -27775,22 +27774,22 @@ function listSessions(fs26, sessionsDir) {
|
|
|
27775
27774
|
}
|
|
27776
27775
|
return sessions.sort((a10, b) => a10.pid - b.pid);
|
|
27777
27776
|
}
|
|
27778
|
-
function sessionsForSupervisor(
|
|
27779
|
-
return listSessions(
|
|
27777
|
+
function sessionsForSupervisor(fs28, sessionsDir, supervisorPid) {
|
|
27778
|
+
return listSessions(fs28, sessionsDir).filter((session) => session.supervisorPid === supervisorPid);
|
|
27780
27779
|
}
|
|
27781
|
-
function pruneDeadSessions(
|
|
27780
|
+
function pruneDeadSessions(fs28, sessionsDir, isRunning) {
|
|
27782
27781
|
const removed = [];
|
|
27783
|
-
for (const session of listSessions(
|
|
27782
|
+
for (const session of listSessions(fs28, sessionsDir)) {
|
|
27784
27783
|
if (!isRunning(session.pid)) {
|
|
27785
|
-
removeSession(
|
|
27784
|
+
removeSession(fs28, sessionsDir, session.pid);
|
|
27786
27785
|
removed.push(session.pid);
|
|
27787
27786
|
}
|
|
27788
27787
|
}
|
|
27789
27788
|
return removed;
|
|
27790
27789
|
}
|
|
27791
|
-
function readStartLock(
|
|
27790
|
+
function readStartLock(fs28, lockFile) {
|
|
27792
27791
|
try {
|
|
27793
|
-
return parseJson(
|
|
27792
|
+
return parseJson(fs28.readFileUtf8(lockFile), HeadroomLockSchema);
|
|
27794
27793
|
} catch {
|
|
27795
27794
|
return void 0;
|
|
27796
27795
|
}
|
|
@@ -27883,12 +27882,12 @@ function earlierReleaseAllowlistHash(providers, doorOrigin) {
|
|
|
27883
27882
|
}
|
|
27884
27883
|
return hashAllowlist([...entries].sort());
|
|
27885
27884
|
}
|
|
27886
|
-
function earlierReleaseDaemon(
|
|
27885
|
+
function earlierReleaseDaemon(fs28, paths, daemon) {
|
|
27887
27886
|
if (daemonIdentity(daemon.commandLine, daemon.socketPath) !== "earlier-release") {
|
|
27888
27887
|
return void 0;
|
|
27889
27888
|
}
|
|
27890
|
-
const providers = readAllProviders(
|
|
27891
|
-
const expected = earlierReleaseAllowlistHash(providers, frontDoorOrigin(readFrontDoorState(
|
|
27889
|
+
const providers = readAllProviders(fs28, paths.providersDir).map((entry) => entry.provider);
|
|
27890
|
+
const expected = earlierReleaseAllowlistHash(providers, frontDoorOrigin(readFrontDoorState(fs28, paths.frontdoorStateFile)));
|
|
27892
27891
|
return { admitsServingDoor: daemon.recordedHash === expected };
|
|
27893
27892
|
}
|
|
27894
27893
|
var EARLIER_RELEASE_ALLOWLIST, EARLIER_RELEASE_ANTHROPIC_UPSTREAM;
|
|
@@ -27913,8 +27912,8 @@ function awaitingCause(daemonPid, identity, allowlistFile) {
|
|
|
27913
27912
|
}
|
|
27914
27913
|
return `the headroom supervisor has not written an allowlist admitting this launch's upstreams to ${allowlistFile} within ${String(HEADROOM_START_TIMEOUT_MS)}ms`;
|
|
27915
27914
|
}
|
|
27916
|
-
function daemonAdmits(
|
|
27917
|
-
const content =
|
|
27915
|
+
function daemonAdmits(fs28, allowlistFile, recordedHash, required2) {
|
|
27916
|
+
const content = fs28.readFileUtf8(allowlistFile);
|
|
27918
27917
|
if (content === void 0 || recordedHash === void 0) {
|
|
27919
27918
|
return false;
|
|
27920
27919
|
}
|
|
@@ -28304,7 +28303,7 @@ function verifyAllowlistFile(allowlistFile, ports) {
|
|
|
28304
28303
|
const replaceable = fileStat === void 0 || fileStat.kind === "file" || fileStat.kind === "symlink";
|
|
28305
28304
|
return { message: refusal2, repairable: replaceable };
|
|
28306
28305
|
}
|
|
28307
|
-
function prepareHeadroomSocket(
|
|
28306
|
+
function prepareHeadroomSocket(fs28, ports, paths, supervisorPid) {
|
|
28308
28307
|
const unsupported = platformRefusal(ports.platform);
|
|
28309
28308
|
if (unsupported !== void 0) {
|
|
28310
28309
|
return { refused: unsupported };
|
|
@@ -28319,18 +28318,18 @@ function prepareHeadroomSocket(fs26, ports, paths, supervisorPid) {
|
|
|
28319
28318
|
if (ports.lstat(paths.headroomSocketDir)?.kind === "symlink") {
|
|
28320
28319
|
return { refused: `the headroom socket directory ${paths.headroomSocketDir} is a symlink; it must be the real directory` };
|
|
28321
28320
|
}
|
|
28322
|
-
|
|
28321
|
+
fs28.mkdirPrivate(paths.headroomSocketDir);
|
|
28323
28322
|
const refusal2 = ownerOnlyRefusal("socket directory", paths.headroomSocketDir, ports.lstat(paths.headroomSocketDir), "dir", ports.currentUid());
|
|
28324
28323
|
return refusal2 === void 0 ? { socketPath } : { refused: refusal2 };
|
|
28325
28324
|
}
|
|
28326
|
-
function pruneStaleHeadroomSockets(
|
|
28325
|
+
function pruneStaleHeadroomSockets(fs28, paths, isRunning) {
|
|
28327
28326
|
const removed = [];
|
|
28328
|
-
for (const name of
|
|
28327
|
+
for (const name of fs28.readdir(paths.headroomSocketDir)) {
|
|
28329
28328
|
const pid = HEADROOM_SOCKET_NAME.exec(name)?.[1];
|
|
28330
28329
|
if (pid === void 0 || isRunning(Number.parseInt(pid, 10))) {
|
|
28331
28330
|
continue;
|
|
28332
28331
|
}
|
|
28333
|
-
|
|
28332
|
+
fs28.removeRecursive(import_node_path7.default.join(paths.headroomSocketDir, name));
|
|
28334
28333
|
removed.push(name);
|
|
28335
28334
|
}
|
|
28336
28335
|
return removed;
|
|
@@ -28477,37 +28476,37 @@ function compareVersions2(a10, b) {
|
|
|
28477
28476
|
return 0;
|
|
28478
28477
|
}
|
|
28479
28478
|
async function runSupervisor(initialConfig, ports, options = {}) {
|
|
28480
|
-
const { fs:
|
|
28479
|
+
const { fs: fs28, paths } = ports;
|
|
28481
28480
|
let config2 = initialConfig;
|
|
28482
|
-
migrateHeadroomState(
|
|
28483
|
-
const previousState = resolveServingHeadroomState(
|
|
28481
|
+
migrateHeadroomState(fs28, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning);
|
|
28482
|
+
const previousState = resolveServingHeadroomState(fs28, { stateFile: paths.headroomStateFile, legacyStateFile: paths.headroomLegacyStateFile }, ports.isRunning)?.state;
|
|
28484
28483
|
if (previousState?.supervisorPid !== void 0 && previousState.supervisorPid !== ports.ownPid && ports.isRunning(previousState.supervisorPid)) {
|
|
28485
28484
|
ports.log(`agent-shim headroom supervisor ${String(ports.ownPid)}: supervisor ${String(previousState.supervisorPid)} already owns the daemon; exiting`);
|
|
28486
28485
|
return 0;
|
|
28487
28486
|
}
|
|
28488
28487
|
let installedSource = previousState?.installedSource;
|
|
28489
28488
|
const ownsState = () => {
|
|
28490
|
-
const owner = readHeadroomState(
|
|
28489
|
+
const owner = readHeadroomState(fs28, paths.headroomStateFile)?.supervisorPid;
|
|
28491
28490
|
return owner === void 0 || owner === ports.ownPid || !ports.isRunning(owner);
|
|
28492
28491
|
};
|
|
28493
28492
|
const writeOwnState = (state) => {
|
|
28494
28493
|
if (!ownsState()) {
|
|
28495
28494
|
return false;
|
|
28496
28495
|
}
|
|
28497
|
-
writeHeadroomState(
|
|
28496
|
+
writeHeadroomState(fs28, paths.headroomStateFile, state);
|
|
28498
28497
|
return true;
|
|
28499
28498
|
};
|
|
28500
28499
|
const fail = (message) => {
|
|
28501
28500
|
if (writeOwnState({ lastError: message })) {
|
|
28502
|
-
|
|
28501
|
+
fs28.removeRecursive(paths.headroomLockFile);
|
|
28503
28502
|
}
|
|
28504
28503
|
ports.log(`agent-shim headroom supervisor: ${message}`);
|
|
28505
28504
|
return 1;
|
|
28506
28505
|
};
|
|
28507
28506
|
const syncAllowlistFile = (allowlist) => {
|
|
28508
28507
|
try {
|
|
28509
|
-
if (
|
|
28510
|
-
writeAllowlistFile(
|
|
28508
|
+
if (fs28.readFileUtf8(paths.headroomAllowlistFile) !== formatAllowlistFile(allowlist)) {
|
|
28509
|
+
writeAllowlistFile(fs28, paths.headroomAllowlistFile, allowlist);
|
|
28511
28510
|
ports.log(`agent-shim headroom supervisor: wrote allowlist [${allowlist.join(", ")}] to ${paths.headroomAllowlistFile}`);
|
|
28512
28511
|
}
|
|
28513
28512
|
return void 0;
|
|
@@ -28525,9 +28524,9 @@ async function runSupervisor(initialConfig, ports, options = {}) {
|
|
|
28525
28524
|
}
|
|
28526
28525
|
ports.log(`agent-shim headroom supervisor: repairing the allowlist file: ${problem.message}`);
|
|
28527
28526
|
try {
|
|
28528
|
-
|
|
28529
|
-
|
|
28530
|
-
writeAllowlistFile(
|
|
28527
|
+
fs28.mkdirPrivate(paths.headroomDir);
|
|
28528
|
+
fs28.mkdirPrivate(import_node_path8.default.dirname(paths.headroomAllowlistFile));
|
|
28529
|
+
writeAllowlistFile(fs28, paths.headroomAllowlistFile, allowlist);
|
|
28531
28530
|
} catch (error63) {
|
|
28532
28531
|
return `could not write the headroom allowlist file ${paths.headroomAllowlistFile}: ${error63 instanceof Error ? error63.message : String(error63)}`;
|
|
28533
28532
|
}
|
|
@@ -28552,20 +28551,20 @@ async function runSupervisor(initialConfig, ports, options = {}) {
|
|
|
28552
28551
|
installedSource = config2.source;
|
|
28553
28552
|
return void 0;
|
|
28554
28553
|
};
|
|
28555
|
-
const socket = prepareHeadroomSocket(
|
|
28554
|
+
const socket = prepareHeadroomSocket(fs28, ports.socketTrust, paths, ports.ownPid);
|
|
28556
28555
|
if (socket.refused !== void 0) {
|
|
28557
28556
|
return fail(socket.refused);
|
|
28558
28557
|
}
|
|
28559
28558
|
const { socketPath } = socket;
|
|
28560
|
-
pruneStaleHeadroomSockets(
|
|
28561
|
-
pruneStaleAllowlistTemporaries(
|
|
28559
|
+
pruneStaleHeadroomSockets(fs28, paths, ports.isRunning);
|
|
28560
|
+
pruneStaleAllowlistTemporaries(fs28, paths.headroomAllowlistFile, ports.isRunning);
|
|
28562
28561
|
const installFailure = ensureInstalled();
|
|
28563
28562
|
if (installFailure !== void 0) {
|
|
28564
28563
|
return fail(installFailure);
|
|
28565
28564
|
}
|
|
28566
28565
|
const version2 = ports.headroomVersion() ?? "unknown";
|
|
28567
28566
|
writeOwnState({ supervisorPid: ports.ownPid, version: version2, installedSource });
|
|
28568
|
-
ports.log(`agent-shim headroom supervisor ${String(ports.ownPid)}: managing headroom on allowlist [${currentHeadroomAllowlistInputs(
|
|
28567
|
+
ports.log(`agent-shim headroom supervisor ${String(ports.ownPid)}: managing headroom on allowlist [${currentHeadroomAllowlistInputs(fs28, paths, ports.frontDoorLiveness).frontDoorOrigins.join(", ")}]`);
|
|
28569
28568
|
const orphanPid = previousState?.headroomPid;
|
|
28570
28569
|
const orphanSocket = previousState?.socketPath ?? (previousState?.supervisorPid === void 0 ? void 0 : headroomSocketPath(paths, previousState.supervisorPid));
|
|
28571
28570
|
const orphanIdentity = orphanPid === void 0 || orphanSocket === void 0 || !ports.isRunning(orphanPid) ? void 0 : daemonIdentity(ports.daemonCommandLine(orphanPid), orphanSocket);
|
|
@@ -28600,12 +28599,12 @@ async function runSupervisor(initialConfig, ports, options = {}) {
|
|
|
28600
28599
|
ticks += 1;
|
|
28601
28600
|
config2 = ports.readConfig();
|
|
28602
28601
|
const settingsHash = hashSettings(config2.settings);
|
|
28603
|
-
const inputs = currentHeadroomAllowlistInputs(
|
|
28604
|
-
pruneDeadFrontDoorDirectRecords(
|
|
28605
|
-
pruneMalformedFrontDoorDirectFiles(
|
|
28602
|
+
const inputs = currentHeadroomAllowlistInputs(fs28, paths, ports.frontDoorLiveness);
|
|
28603
|
+
pruneDeadFrontDoorDirectRecords(fs28, paths.frontdoorDirectRecordsDir, inputs.frontDoorRecords, inputs.frontDoorLiveness);
|
|
28604
|
+
pruneMalformedFrontDoorDirectFiles(fs28, paths.frontdoorDirectRecordsDir, ports.isRunning);
|
|
28606
28605
|
const allowlist = inputs.frontDoorOrigins;
|
|
28607
28606
|
const allowlistHash = hashAllowlist(allowlist);
|
|
28608
|
-
pruneDeadSessions(
|
|
28607
|
+
pruneDeadSessions(fs28, paths.headroomSessionsDir, ports.isRunning);
|
|
28609
28608
|
const ownsNow = ownsState();
|
|
28610
28609
|
if (!ownsNow && !superseded) {
|
|
28611
28610
|
ports.log("agent-shim headroom supervisor: another supervisor now owns the state file; serving this daemon's own sessions until they end");
|
|
@@ -28652,7 +28651,7 @@ async function runSupervisor(initialConfig, ports, options = {}) {
|
|
|
28652
28651
|
runningSettingsHash = settingsHash;
|
|
28653
28652
|
const recorded = writeOwnState(servingState(pid));
|
|
28654
28653
|
if (recorded) {
|
|
28655
|
-
|
|
28654
|
+
fs28.removeRecursive(paths.headroomLockFile);
|
|
28656
28655
|
}
|
|
28657
28656
|
idleSince = void 0;
|
|
28658
28657
|
ports.log(`agent-shim headroom supervisor: headroom pid ${String(pid)} ready on unix socket ${socketPath}`);
|
|
@@ -28680,7 +28679,7 @@ async function runSupervisor(initialConfig, ports, options = {}) {
|
|
|
28680
28679
|
ports.log(`agent-shim headroom supervisor: headroom pid ${String(headroomPid)} now serves allowlist [${allowlist.join(", ")}]`);
|
|
28681
28680
|
}
|
|
28682
28681
|
if (runningSettingsHash !== settingsHash || installedSource !== config2.source) {
|
|
28683
|
-
if (sessionsForSupervisor(
|
|
28682
|
+
if (sessionsForSupervisor(fs28, paths.headroomSessionsDir, ports.ownPid).length === 0) {
|
|
28684
28683
|
ports.log("agent-shim headroom supervisor: configuration drifted and no sessions are live; restarting headroom");
|
|
28685
28684
|
ports.stopProcess(headroomPid);
|
|
28686
28685
|
headroomPid = void 0;
|
|
@@ -28689,7 +28688,7 @@ async function runSupervisor(initialConfig, ports, options = {}) {
|
|
|
28689
28688
|
continue;
|
|
28690
28689
|
}
|
|
28691
28690
|
}
|
|
28692
|
-
const sessions = sessionsForSupervisor(
|
|
28691
|
+
const sessions = sessionsForSupervisor(fs28, paths.headroomSessionsDir, ports.ownPid);
|
|
28693
28692
|
if (sessions.length === 0) {
|
|
28694
28693
|
idleSince ??= ports.now();
|
|
28695
28694
|
const idleMs = ports.now() - idleSince;
|
|
@@ -28714,9 +28713,9 @@ function undeterminedFrontDoors(inputs) {
|
|
|
28714
28713
|
return reason === void 0 ? [] : [{ pid: record2.pid, origin: directOrigin(record2.directPort), reason }];
|
|
28715
28714
|
});
|
|
28716
28715
|
}
|
|
28717
|
-
function currentHeadroomAllowlistInputs(
|
|
28718
|
-
const named = frontDoorOrigin(readFrontDoorState(
|
|
28719
|
-
const records = listFrontDoorDirectRecords(
|
|
28716
|
+
function currentHeadroomAllowlistInputs(fs28, paths, frontDoorLiveness) {
|
|
28717
|
+
const named = frontDoorOrigin(readFrontDoorState(fs28, paths.frontdoorStateFile));
|
|
28718
|
+
const records = listFrontDoorDirectRecords(fs28, paths.frontdoorDirectRecordsDir);
|
|
28720
28719
|
const liveness = frontDoorLiveness(records.map((record2) => record2.pid));
|
|
28721
28720
|
const live = liveFrontDoorDirectRecords(records, liveness).map((record2) => directOrigin(record2.directPort));
|
|
28722
28721
|
return {
|
|
@@ -28725,8 +28724,8 @@ function currentHeadroomAllowlistInputs(fs26, paths, frontDoorLiveness) {
|
|
|
28725
28724
|
frontDoorOrigins: [.../* @__PURE__ */ new Set([...named === void 0 ? [] : [named], ...live])].sort()
|
|
28726
28725
|
};
|
|
28727
28726
|
}
|
|
28728
|
-
function launchRequiredUpstreams(
|
|
28729
|
-
const door = frontDoorOrigin(readFrontDoorState(
|
|
28727
|
+
function launchRequiredUpstreams(fs28, paths) {
|
|
28728
|
+
const door = frontDoorOrigin(readFrontDoorState(fs28, paths.frontdoorStateFile));
|
|
28730
28729
|
return door === void 0 ? [] : [door];
|
|
28731
28730
|
}
|
|
28732
28731
|
async function waitUntilReady(ports, socketPath, pid) {
|
|
@@ -29977,8 +29976,8 @@ var require_utils = __commonJS({
|
|
|
29977
29976
|
}
|
|
29978
29977
|
return output2;
|
|
29979
29978
|
};
|
|
29980
|
-
exports2.basename = (
|
|
29981
|
-
const segs =
|
|
29979
|
+
exports2.basename = (path66, { windows } = {}) => {
|
|
29980
|
+
const segs = path66.split(windows ? /[\\/]/ : "/");
|
|
29982
29981
|
const last = segs[segs.length - 1];
|
|
29983
29982
|
if (last === "") {
|
|
29984
29983
|
return segs[segs.length - 2];
|
|
@@ -31653,8 +31652,8 @@ var init_classify = __esm({
|
|
|
31653
31652
|
function poolNameOf(selector) {
|
|
31654
31653
|
return selector.startsWith(POOL_SELECTOR_PREFIX) ? selector.slice(POOL_SELECTOR_PREFIX.length) : void 0;
|
|
31655
31654
|
}
|
|
31656
|
-
function readActiveIdentity(
|
|
31657
|
-
const trimmed =
|
|
31655
|
+
function readActiveIdentity(fs28, activeIdentityFile) {
|
|
31656
|
+
const trimmed = fs28.readFileUtf8(activeIdentityFile)?.trim();
|
|
31658
31657
|
return trimmed === void 0 || trimmed === "" ? void 0 : trimmed;
|
|
31659
31658
|
}
|
|
31660
31659
|
function isNonEmpty(value2) {
|
|
@@ -31701,8 +31700,8 @@ function decideConfigProfile(params) {
|
|
|
31701
31700
|
}
|
|
31702
31701
|
return { source: "none" };
|
|
31703
31702
|
}
|
|
31704
|
-
function loadIdentity(identitiesDir, name,
|
|
31705
|
-
return loadConfigFile(import_node_path11.default.join(identitiesDir, name, "identity.json"), IdentitySchema,
|
|
31703
|
+
function loadIdentity(identitiesDir, name, fs28) {
|
|
31704
|
+
return loadConfigFile(import_node_path11.default.join(identitiesDir, name, "identity.json"), IdentitySchema, fs28.readConfigFile);
|
|
31706
31705
|
}
|
|
31707
31706
|
var import_node_path11, IDENTITY_DECISION_SOURCES, CONFIG_PROFILE_DECISION_SOURCES;
|
|
31708
31707
|
var init_identity = __esm({
|
|
@@ -33403,8 +33402,8 @@ var init_pipeline = __esm({
|
|
|
33403
33402
|
});
|
|
33404
33403
|
|
|
33405
33404
|
// src/launcher/farm.ts
|
|
33406
|
-
function readFarmManifest(
|
|
33407
|
-
const raw =
|
|
33405
|
+
function readFarmManifest(fs28, farmRoot) {
|
|
33406
|
+
const raw = fs28.readFileUtf8(import_node_path19.default.join(farmRoot, FARM_MANIFEST_FILENAME)) ?? fs28.readFileUtf8(import_node_path19.default.join(farmRoot, LEGACY_FARM_MANIFEST_FILENAME));
|
|
33408
33407
|
if (raw === void 0) {
|
|
33409
33408
|
return void 0;
|
|
33410
33409
|
}
|
|
@@ -33462,9 +33461,9 @@ function buildEntryFacts(params) {
|
|
|
33462
33461
|
entries
|
|
33463
33462
|
};
|
|
33464
33463
|
}
|
|
33465
|
-
function listSubtree(
|
|
33464
|
+
function listSubtree(fs28, root, rel) {
|
|
33466
33465
|
const absolute = import_node_path19.default.join(root, rel);
|
|
33467
|
-
const stat =
|
|
33466
|
+
const stat = fs28.lstat(absolute);
|
|
33468
33467
|
if (stat === void 0) {
|
|
33469
33468
|
return [];
|
|
33470
33469
|
}
|
|
@@ -33472,10 +33471,10 @@ function listSubtree(fs26, root, rel) {
|
|
|
33472
33471
|
return [{ rel, kind: "symlink" }];
|
|
33473
33472
|
}
|
|
33474
33473
|
if (stat.kind === "dir") {
|
|
33475
|
-
const children = [...
|
|
33474
|
+
const children = [...fs28.readdir(absolute)].sort().flatMap((name) => listSubtree(fs28, root, `${rel}/${name}`));
|
|
33476
33475
|
return [{ rel, kind: "dir" }, ...children];
|
|
33477
33476
|
}
|
|
33478
|
-
const contentHash =
|
|
33477
|
+
const contentHash = fs28.hashFile(absolute);
|
|
33479
33478
|
return [{ rel, kind: "file", ...contentHash === void 0 ? {} : { contentHash } }];
|
|
33480
33479
|
}
|
|
33481
33480
|
function topLevelScopeRoots(roots) {
|
|
@@ -33489,25 +33488,25 @@ function topLevelScopeRoots(roots) {
|
|
|
33489
33488
|
}
|
|
33490
33489
|
return kept;
|
|
33491
33490
|
}
|
|
33492
|
-
function reconciliationScope(
|
|
33491
|
+
function reconciliationScope(fs28, farmRoot, manifest) {
|
|
33493
33492
|
if (manifest !== void 0) {
|
|
33494
33493
|
return topLevelScopeRoots(manifest.materialised);
|
|
33495
33494
|
}
|
|
33496
|
-
return [...
|
|
33495
|
+
return [...fs28.readdir(farmRoot)].filter((name) => name !== FARM_MANIFEST_FILENAME && name !== LEGACY_FARM_MANIFEST_FILENAME && fs28.lstat(import_node_path19.default.join(farmRoot, name))?.kind === "dir").sort();
|
|
33497
33496
|
}
|
|
33498
|
-
function collectFarmListing(
|
|
33499
|
-
return scopeRoots.flatMap((root) => listSubtree(
|
|
33497
|
+
function collectFarmListing(fs28, farmRoot, scopeRoots) {
|
|
33498
|
+
return scopeRoots.flatMap((root) => listSubtree(fs28, farmRoot, root));
|
|
33500
33499
|
}
|
|
33501
|
-
function collectCanonicalCounterparts(
|
|
33500
|
+
function collectCanonicalCounterparts(fs28, claudeHome, farmListing) {
|
|
33502
33501
|
const out = [];
|
|
33503
33502
|
for (const entry of farmListing) {
|
|
33504
33503
|
const absolute = import_node_path19.default.join(claudeHome, entry.rel);
|
|
33505
|
-
const stat =
|
|
33504
|
+
const stat = fs28.lstat(absolute);
|
|
33506
33505
|
if (stat === void 0) {
|
|
33507
33506
|
continue;
|
|
33508
33507
|
}
|
|
33509
33508
|
if (stat.kind === "file") {
|
|
33510
|
-
const contentHash =
|
|
33509
|
+
const contentHash = fs28.hashFile(absolute);
|
|
33511
33510
|
out.push({ rel: entry.rel, kind: "file", ...contentHash === void 0 ? {} : { contentHash } });
|
|
33512
33511
|
continue;
|
|
33513
33512
|
}
|
|
@@ -33915,6 +33914,7 @@ function buildLayoutPaths(root) {
|
|
|
33915
33914
|
identitiesDir: import_node_path20.default.join(root, "identities"),
|
|
33916
33915
|
configProfilesDir: import_node_path20.default.join(root, "config-profiles"),
|
|
33917
33916
|
providersDir: import_node_path20.default.join(root, "providers"),
|
|
33917
|
+
providerAliasesFile: import_node_path20.default.join(root, "provider-aliases.json"),
|
|
33918
33918
|
directoryRulesFile: import_node_path20.default.join(root, "directory-rules.json"),
|
|
33919
33919
|
activeIdentityFile: import_node_path20.default.join(root, "active-identity"),
|
|
33920
33920
|
globalConfigFile: import_node_path20.default.join(root, "config.json"),
|
|
@@ -34694,7 +34694,7 @@ var init_package = __esm({
|
|
|
34694
34694
|
"package.json"() {
|
|
34695
34695
|
package_default = {
|
|
34696
34696
|
name: "claude-use",
|
|
34697
|
-
version: "11.
|
|
34697
|
+
version: "11.47.0",
|
|
34698
34698
|
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.",
|
|
34699
34699
|
license: "MIT",
|
|
34700
34700
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -34807,14 +34807,14 @@ function isIdentityName(name) {
|
|
|
34807
34807
|
function claudeJsonPath(identitiesDir, identity) {
|
|
34808
34808
|
return import_node_path24.default.join(identitiesDir, identity, CLAUDE_JSON);
|
|
34809
34809
|
}
|
|
34810
|
-
function readAccountMetadata(
|
|
34810
|
+
function readAccountMetadata(fs28, identitiesDir, identity) {
|
|
34811
34811
|
if (!isIdentityName(identity)) {
|
|
34812
34812
|
throw new Error(`"${identity}" is not a valid identity name.`);
|
|
34813
34813
|
}
|
|
34814
|
-
return readAccountMetadataFile(
|
|
34814
|
+
return readAccountMetadataFile(fs28, claudeJsonPath(identitiesDir, identity));
|
|
34815
34815
|
}
|
|
34816
|
-
function readAccountMetadataFile(
|
|
34817
|
-
const raw =
|
|
34816
|
+
function readAccountMetadataFile(fs28, file2) {
|
|
34817
|
+
const raw = fs28.readFileUtf8(file2);
|
|
34818
34818
|
if (raw === void 0) {
|
|
34819
34819
|
return void 0;
|
|
34820
34820
|
}
|
|
@@ -34844,19 +34844,19 @@ function readAccountMetadataFile(fs26, file2) {
|
|
|
34844
34844
|
}
|
|
34845
34845
|
return account.data;
|
|
34846
34846
|
}
|
|
34847
|
-
function createAccountReader(
|
|
34847
|
+
function createAccountReader(fs28, identitiesDir) {
|
|
34848
34848
|
const cache = /* @__PURE__ */ new Map();
|
|
34849
34849
|
return (identity) => {
|
|
34850
34850
|
if (!isIdentityName(identity)) {
|
|
34851
34851
|
throw new Error(`"${identity}" is not a valid identity name.`);
|
|
34852
34852
|
}
|
|
34853
|
-
const stat =
|
|
34853
|
+
const stat = fs28.lstat(claudeJsonPath(identitiesDir, identity));
|
|
34854
34854
|
const stamp = stat === void 0 ? "absent" : `${String(stat.mtimeMs)}:${String(stat.sizeBytes)}`;
|
|
34855
34855
|
const cached2 = cache.get(identity);
|
|
34856
34856
|
if (cached2?.stamp === stamp) {
|
|
34857
34857
|
return cached2.account;
|
|
34858
34858
|
}
|
|
34859
|
-
const account = readAccountMetadata(
|
|
34859
|
+
const account = readAccountMetadata(fs28, identitiesDir, identity);
|
|
34860
34860
|
cache.set(identity, { stamp, account });
|
|
34861
34861
|
return account;
|
|
34862
34862
|
};
|
|
@@ -34967,17 +34967,26 @@ function identifyRequest(headers) {
|
|
|
34967
34967
|
function directOrigin2(port) {
|
|
34968
34968
|
return `http://127.0.0.1:${String(port)}`;
|
|
34969
34969
|
}
|
|
34970
|
-
function parseProviderPath(
|
|
34971
|
-
if (!
|
|
34970
|
+
function parseProviderPath(path66) {
|
|
34971
|
+
if (!path66.startsWith(PROVIDER_PATH_PREFIX)) {
|
|
34972
34972
|
return void 0;
|
|
34973
34973
|
}
|
|
34974
|
-
const tail =
|
|
34974
|
+
const tail = path66.slice(PROVIDER_PATH_PREFIX.length);
|
|
34975
34975
|
const slash = tail.indexOf("/");
|
|
34976
34976
|
if (slash <= 0) {
|
|
34977
34977
|
return void 0;
|
|
34978
34978
|
}
|
|
34979
34979
|
return { provider: decodeURIComponent(tail.slice(0, slash)), rest: tail.slice(slash) };
|
|
34980
34980
|
}
|
|
34981
|
+
function withCanonicalProviderTarget(target, canonical) {
|
|
34982
|
+
const { pathname, search } = new URL(target, "http://127.0.0.1");
|
|
34983
|
+
const scoped = parseProviderPath(pathname);
|
|
34984
|
+
if (scoped === void 0) {
|
|
34985
|
+
return target;
|
|
34986
|
+
}
|
|
34987
|
+
const current = canonical(scoped.provider);
|
|
34988
|
+
return current === scoped.provider ? target : `${PROVIDER_PATH_PREFIX}${encodeURIComponent(current)}${scoped.rest}${search}`;
|
|
34989
|
+
}
|
|
34981
34990
|
var HEADROOM_SESSION_HEADER, INTERNAL_HEADER_NAMES, IDENTITY_HEADER, SESSION_HEADER, PROVIDER_HEADER, HEADROOM_FLAG_HEADER, PROJECT_ID_HEADER, CLIENT_SESSION_HEADER, HEADROOM_BASE_URL_HEADER, AUTH_HEADER, HOP_SECRET_HEADER, HOP_ID_HEADER, PROVIDER_PATH_PREFIX;
|
|
34982
34991
|
var init_route = __esm({
|
|
34983
34992
|
"src/frontdoor/route.ts"() {
|
|
@@ -35298,12 +35307,12 @@ function decoderFor(encoding) {
|
|
|
35298
35307
|
return void 0;
|
|
35299
35308
|
}
|
|
35300
35309
|
}
|
|
35301
|
-
function destinationOf(
|
|
35302
|
-
const scoped = parseProviderPath(
|
|
35310
|
+
function destinationOf(path66, sessionProvider) {
|
|
35311
|
+
const scoped = parseProviderPath(path66);
|
|
35303
35312
|
if (scoped !== void 0) {
|
|
35304
35313
|
return { provider: scoped.provider, endpoint: scoped.rest };
|
|
35305
35314
|
}
|
|
35306
|
-
return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint:
|
|
35315
|
+
return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint: path66 };
|
|
35307
35316
|
}
|
|
35308
35317
|
function modelChoiceOf(event, servedModel, provider) {
|
|
35309
35318
|
if (event.modelChoice !== void 0) return event.modelChoice;
|
|
@@ -35768,8 +35777,8 @@ function segmentDay(epochMs) {
|
|
|
35768
35777
|
function segmentName(day, pid) {
|
|
35769
35778
|
return `${day}.${String(pid)}.jsonl`;
|
|
35770
35779
|
}
|
|
35771
|
-
function listLogSegments(
|
|
35772
|
-
return
|
|
35780
|
+
function listLogSegments(fs28, logDir) {
|
|
35781
|
+
return fs28.readdir(logDir).flatMap((name) => {
|
|
35773
35782
|
const match = SEGMENT_RE.exec(name);
|
|
35774
35783
|
const day = match?.[1];
|
|
35775
35784
|
if (day === void 0) {
|
|
@@ -35778,15 +35787,15 @@ function listLogSegments(fs26, logDir) {
|
|
|
35778
35787
|
return [{ name, day, endsAt: Date.parse(`${day}T00:00:00.000Z`) + DAY_MS }];
|
|
35779
35788
|
}).sort((left, right) => left.day.localeCompare(right.day) || left.name.localeCompare(right.name));
|
|
35780
35789
|
}
|
|
35781
|
-
function readUsageLog(
|
|
35790
|
+
function readUsageLog(fs28, logDir, options = {}) {
|
|
35782
35791
|
const { sinceMs } = options;
|
|
35783
35792
|
const records = [];
|
|
35784
35793
|
let invalidLines = 0;
|
|
35785
|
-
for (const segment of listLogSegments(
|
|
35794
|
+
for (const segment of listLogSegments(fs28, logDir)) {
|
|
35786
35795
|
if (sinceMs !== void 0 && segment.endsAt <= sinceMs) {
|
|
35787
35796
|
continue;
|
|
35788
35797
|
}
|
|
35789
|
-
const contents =
|
|
35798
|
+
const contents = fs28.readFileUtf8(import_node_path25.default.join(logDir, segment.name));
|
|
35790
35799
|
if (contents === void 0) {
|
|
35791
35800
|
continue;
|
|
35792
35801
|
}
|
|
@@ -35822,9 +35831,9 @@ function snapshotPath(snapshotsDir, identity) {
|
|
|
35822
35831
|
}
|
|
35823
35832
|
return import_node_path25.default.join(snapshotsDir, `${identity}.json`);
|
|
35824
35833
|
}
|
|
35825
|
-
function readUsageSnapshot(
|
|
35834
|
+
function readUsageSnapshot(fs28, snapshotsDir, identity) {
|
|
35826
35835
|
const file2 = snapshotPath(snapshotsDir, identity);
|
|
35827
|
-
const raw =
|
|
35836
|
+
const raw = fs28.readFileUtf8(file2);
|
|
35828
35837
|
if (raw === void 0) {
|
|
35829
35838
|
return void 0;
|
|
35830
35839
|
}
|
|
@@ -35840,8 +35849,8 @@ function readUsageSnapshot(fs26, snapshotsDir, identity) {
|
|
|
35840
35849
|
}
|
|
35841
35850
|
return snapshot.data;
|
|
35842
35851
|
}
|
|
35843
|
-
function listUsageSnapshots(
|
|
35844
|
-
return
|
|
35852
|
+
function listUsageSnapshots(fs28, snapshotsDir) {
|
|
35853
|
+
return fs28.readdir(snapshotsDir).flatMap((name) => {
|
|
35845
35854
|
if (!name.endsWith(".json")) {
|
|
35846
35855
|
return [];
|
|
35847
35856
|
}
|
|
@@ -35849,7 +35858,7 @@ function listUsageSnapshots(fs26, snapshotsDir) {
|
|
|
35849
35858
|
if (!isIdentityName(identity)) {
|
|
35850
35859
|
return [];
|
|
35851
35860
|
}
|
|
35852
|
-
const snapshot = readUsageSnapshot(
|
|
35861
|
+
const snapshot = readUsageSnapshot(fs28, snapshotsDir, identity);
|
|
35853
35862
|
return snapshot === void 0 ? [] : [snapshot];
|
|
35854
35863
|
}).sort((left, right) => left.identity.localeCompare(right.identity));
|
|
35855
35864
|
}
|
|
@@ -35923,11 +35932,11 @@ var init_read = __esm({
|
|
|
35923
35932
|
});
|
|
35924
35933
|
|
|
35925
35934
|
// src/usage/store.ts
|
|
35926
|
-
function pruneUsageLog(
|
|
35935
|
+
function pruneUsageLog(fs28, logDir, nowMs) {
|
|
35927
35936
|
const cutoff = nowMs - USAGE_RETENTION_MS;
|
|
35928
|
-
for (const segment of listLogSegments(
|
|
35937
|
+
for (const segment of listLogSegments(fs28, logDir)) {
|
|
35929
35938
|
if (segment.endsAt <= cutoff) {
|
|
35930
|
-
|
|
35939
|
+
fs28.removeRecursive(import_node_path26.default.join(logDir, segment.name));
|
|
35931
35940
|
}
|
|
35932
35941
|
}
|
|
35933
35942
|
}
|
|
@@ -35956,7 +35965,7 @@ function foldProviderState(current, record2) {
|
|
|
35956
35965
|
};
|
|
35957
35966
|
}
|
|
35958
35967
|
function createUsageStore(deps) {
|
|
35959
|
-
const { fs:
|
|
35968
|
+
const { fs: fs28, paths } = deps;
|
|
35960
35969
|
let prunedDay;
|
|
35961
35970
|
const rewriteSnapshot = (identity, fold) => {
|
|
35962
35971
|
if (!isIdentityName(identity)) {
|
|
@@ -35965,7 +35974,7 @@ function createUsageStore(deps) {
|
|
|
35965
35974
|
}
|
|
35966
35975
|
let current;
|
|
35967
35976
|
try {
|
|
35968
|
-
current = readUsageSnapshot(
|
|
35977
|
+
current = readUsageSnapshot(fs28, paths.usageSnapshotsDir, identity);
|
|
35969
35978
|
} catch (error63) {
|
|
35970
35979
|
if (!(error63 instanceof UsageSnapshotError)) {
|
|
35971
35980
|
throw error63;
|
|
@@ -35992,8 +36001,8 @@ function createUsageStore(deps) {
|
|
|
35992
36001
|
...account === void 0 ? {} : { account },
|
|
35993
36002
|
providers
|
|
35994
36003
|
});
|
|
35995
|
-
|
|
35996
|
-
|
|
36004
|
+
fs28.mkdirPrivate(paths.usageSnapshotsDir);
|
|
36005
|
+
fs28.writeFilePrivate(snapshotPath(paths.usageSnapshotsDir, identity), `${JSON.stringify(snapshot, null, 2)}
|
|
35997
36006
|
`);
|
|
35998
36007
|
deps.publish?.(snapshot);
|
|
35999
36008
|
return true;
|
|
@@ -36002,14 +36011,14 @@ function createUsageStore(deps) {
|
|
|
36002
36011
|
record: (input2) => {
|
|
36003
36012
|
const record2 = UsageRecordSchema.parse(input2);
|
|
36004
36013
|
const nowMs = deps.now();
|
|
36005
|
-
|
|
36006
|
-
|
|
36014
|
+
fs28.mkdirPrivate(paths.usageDir);
|
|
36015
|
+
fs28.mkdirPrivate(paths.usageLogDir);
|
|
36007
36016
|
const day = segmentDay(nowMs);
|
|
36008
36017
|
if (prunedDay !== day) {
|
|
36009
|
-
pruneUsageLog(
|
|
36018
|
+
pruneUsageLog(fs28, paths.usageLogDir, nowMs);
|
|
36010
36019
|
prunedDay = day;
|
|
36011
36020
|
}
|
|
36012
|
-
|
|
36021
|
+
fs28.appendFilePrivate(import_node_path26.default.join(paths.usageLogDir, segmentName(day, deps.pid)), `${JSON.stringify(record2)}
|
|
36013
36022
|
`);
|
|
36014
36023
|
deps.onRecord?.(record2);
|
|
36015
36024
|
if (record2.identity !== void 0) {
|
|
@@ -36052,14 +36061,14 @@ var init_store2 = __esm({
|
|
|
36052
36061
|
function errorMessage(error63) {
|
|
36053
36062
|
return error63 instanceof Error ? error63.message : String(error63);
|
|
36054
36063
|
}
|
|
36055
|
-
function loadPoolMembers(
|
|
36064
|
+
function loadPoolMembers(fs28, paths, identities, nowMs) {
|
|
36056
36065
|
const windowStartMs = nowMs - FIVE_HOUR_WINDOW_MS;
|
|
36057
|
-
const log = readUsageLog(
|
|
36066
|
+
const log = readUsageLog(fs28, paths.usageLogDir, { sinceMs: windowStartMs });
|
|
36058
36067
|
return identities.map((identity) => {
|
|
36059
36068
|
const records = log.records.filter((record2) => record2.identity === identity && record2.provider === ANTHROPIC_PROVIDER && Date.parse(record2.at) >= windowStartMs);
|
|
36060
36069
|
try {
|
|
36061
|
-
const snapshot = readUsageSnapshot(
|
|
36062
|
-
const account = readAccountMetadata(
|
|
36070
|
+
const snapshot = readUsageSnapshot(fs28, paths.usageSnapshotsDir, identity);
|
|
36071
|
+
const account = readAccountMetadata(fs28, paths.identitiesDir, identity) ?? snapshot?.account;
|
|
36063
36072
|
return { identity, records, ...snapshot === void 0 ? {} : { snapshot }, ...account === void 0 ? {} : { account } };
|
|
36064
36073
|
} catch (error63) {
|
|
36065
36074
|
if (error63 instanceof UsageSnapshotError || error63 instanceof AccountMetadataError) {
|
|
@@ -36132,9 +36141,9 @@ function nestedMember(input2, nestedName, childStack, sticky) {
|
|
|
36132
36141
|
missing: nested.missing
|
|
36133
36142
|
};
|
|
36134
36143
|
}
|
|
36135
|
-
function readPicksFile(
|
|
36144
|
+
function readPicksFile(fs28, file2) {
|
|
36136
36145
|
const empty = { schemaVersion: SCHEMA_VERSION, picks: {} };
|
|
36137
|
-
const raw =
|
|
36146
|
+
const raw = fs28.readFileUtf8(file2);
|
|
36138
36147
|
if (raw === void 0) {
|
|
36139
36148
|
return { file: empty };
|
|
36140
36149
|
}
|
|
@@ -36147,17 +36156,17 @@ function readPicksFile(fs26, file2) {
|
|
|
36147
36156
|
const result = PicksFileSchema.safeParse(parsed);
|
|
36148
36157
|
return result.success ? { file: result.data } : { file: empty, problem: `${file2} is not a picks file this agent-shim can read` };
|
|
36149
36158
|
}
|
|
36150
|
-
function readStickyPick(
|
|
36151
|
-
const read = readPicksFile(
|
|
36159
|
+
function readStickyPick(fs28, picksFile, directory) {
|
|
36160
|
+
const read = readPicksFile(fs28, picksFile);
|
|
36152
36161
|
const entry = read.file.picks[directory];
|
|
36153
36162
|
return { ...entry === void 0 ? {} : { sticky: entry }, ...read.problem === void 0 ? {} : { problem: read.problem } };
|
|
36154
36163
|
}
|
|
36155
|
-
function recordStickyPick(
|
|
36156
|
-
const current = readPicksFile(
|
|
36164
|
+
function recordStickyPick(fs28, picksFile, directory, identity, nowMs) {
|
|
36165
|
+
const current = readPicksFile(fs28, picksFile).file.picks;
|
|
36157
36166
|
const kept = Object.entries(current).filter(([, entry]) => nowMs - Date.parse(entry.at) <= USAGE_RETENTION_MS);
|
|
36158
36167
|
const next = { schemaVersion: SCHEMA_VERSION, picks: { ...Object.fromEntries(kept), [directory]: { identity, at: new Date(nowMs).toISOString() } } };
|
|
36159
|
-
|
|
36160
|
-
|
|
36168
|
+
fs28.mkdirPrivate(import_node_path27.default.dirname(picksFile));
|
|
36169
|
+
fs28.writeFilePrivate(picksFile, `${JSON.stringify(next, null, 2)}
|
|
36161
36170
|
`);
|
|
36162
36171
|
}
|
|
36163
36172
|
var import_node_path27, PoolGraphError, SCHEMA_VERSION, PickEntrySchema, PicksFileSchema;
|
|
@@ -36274,6 +36283,104 @@ var init_realCredentialCache = __esm({
|
|
|
36274
36283
|
}
|
|
36275
36284
|
});
|
|
36276
36285
|
|
|
36286
|
+
// src/providerAliases.ts
|
|
36287
|
+
function parseAliases(file2, raw) {
|
|
36288
|
+
const parsed = ProviderAliasesSchema.safeParse(raw);
|
|
36289
|
+
if (!parsed.success) {
|
|
36290
|
+
throw new ConfigValidationError(file2, parsed.error.issues);
|
|
36291
|
+
}
|
|
36292
|
+
return parsed.data;
|
|
36293
|
+
}
|
|
36294
|
+
function readProviderAliases(paths) {
|
|
36295
|
+
return readJson(paths.providerAliasesFile, ProviderAliasesSchema) ?? {};
|
|
36296
|
+
}
|
|
36297
|
+
function loadProviderAliases(file2, port) {
|
|
36298
|
+
const raw = port.readConfigFile(file2);
|
|
36299
|
+
return raw === void 0 ? {} : parseAliases(file2, raw);
|
|
36300
|
+
}
|
|
36301
|
+
function writeProviderAliases(paths, aliases) {
|
|
36302
|
+
if (Object.keys(aliases).length === 0) {
|
|
36303
|
+
import_node_fs10.default.rmSync(paths.providerAliasesFile, { force: true });
|
|
36304
|
+
return;
|
|
36305
|
+
}
|
|
36306
|
+
writeJsonAtomic(paths.providerAliasesFile, aliases);
|
|
36307
|
+
}
|
|
36308
|
+
function canonicalProviderName(name, defined, aliases) {
|
|
36309
|
+
if (defined(name)) {
|
|
36310
|
+
return name;
|
|
36311
|
+
}
|
|
36312
|
+
return aliases()[name] ?? name;
|
|
36313
|
+
}
|
|
36314
|
+
function aliasesAfterRename(aliases, from, to2) {
|
|
36315
|
+
const next = {};
|
|
36316
|
+
for (const [alias, target] of Object.entries(aliases)) {
|
|
36317
|
+
if (alias !== to2) {
|
|
36318
|
+
next[alias] = target === from ? to2 : target;
|
|
36319
|
+
}
|
|
36320
|
+
}
|
|
36321
|
+
next[from] = to2;
|
|
36322
|
+
return next;
|
|
36323
|
+
}
|
|
36324
|
+
function aliasesOf(aliases, name) {
|
|
36325
|
+
return Object.entries(aliases).filter(([, target]) => target === name).map(([alias]) => alias).sort();
|
|
36326
|
+
}
|
|
36327
|
+
function removeProviderAlias(paths, alias) {
|
|
36328
|
+
const aliases = readProviderAliases(paths);
|
|
36329
|
+
if (!(alias in aliases)) {
|
|
36330
|
+
throw new ProviderAliasNotFoundError(alias);
|
|
36331
|
+
}
|
|
36332
|
+
writeProviderAliases(paths, Object.fromEntries(Object.entries(aliases).filter(([name]) => name !== alias)));
|
|
36333
|
+
}
|
|
36334
|
+
function aliasFindings(aliases, providerNames) {
|
|
36335
|
+
return Object.entries(aliases).map(([alias, target]) => {
|
|
36336
|
+
if (!providerNames.has(target)) {
|
|
36337
|
+
return { level: "fail", alias, message: `${alias} is recorded as a former name of ${target}, which is not a provider. Run \`agent-shim provider unalias ${alias}\`.` };
|
|
36338
|
+
}
|
|
36339
|
+
if (providerNames.has(alias)) {
|
|
36340
|
+
return { level: "warn", alias, message: `${alias} is both a provider and a recorded former name of ${target}; the provider wins. Run \`agent-shim provider unalias ${alias}\`.` };
|
|
36341
|
+
}
|
|
36342
|
+
return { level: "pass", alias, message: `${alias} is a former name of ${target}, still honoured for sessions launched under it. Run \`agent-shim provider unalias ${alias}\` once none is running.` };
|
|
36343
|
+
});
|
|
36344
|
+
}
|
|
36345
|
+
function createProviderCanonicaliser(params) {
|
|
36346
|
+
const reported = /* @__PURE__ */ new Set();
|
|
36347
|
+
return (name) => {
|
|
36348
|
+
const current = canonicalProviderName(name, params.defined, () => {
|
|
36349
|
+
try {
|
|
36350
|
+
return params.aliases();
|
|
36351
|
+
} catch (error63) {
|
|
36352
|
+
params.log(`provider aliases ignored, the aliases file is unreadable: ${error63 instanceof Error ? error63.message : String(error63)}`);
|
|
36353
|
+
return {};
|
|
36354
|
+
}
|
|
36355
|
+
});
|
|
36356
|
+
if (current !== name && !reported.has(name)) {
|
|
36357
|
+
reported.add(name);
|
|
36358
|
+
params.log(`provider ${name} is a former name of ${current}; a session launched under it is still running`);
|
|
36359
|
+
}
|
|
36360
|
+
return current;
|
|
36361
|
+
};
|
|
36362
|
+
}
|
|
36363
|
+
var import_node_fs10, ProviderAliasesSchema, ProviderAliasNotFoundError;
|
|
36364
|
+
var init_providerAliases = __esm({
|
|
36365
|
+
"src/providerAliases.ts"() {
|
|
36366
|
+
"use strict";
|
|
36367
|
+
import_node_fs10 = __toESM(require("node:fs"), 1);
|
|
36368
|
+
init_zod();
|
|
36369
|
+
init_cliError();
|
|
36370
|
+
init_load();
|
|
36371
|
+
init_store();
|
|
36372
|
+
ProviderAliasesSchema = external_exports.record(external_exports.string().min(1), external_exports.string().min(1));
|
|
36373
|
+
ProviderAliasNotFoundError = class extends CliError {
|
|
36374
|
+
constructor(alias) {
|
|
36375
|
+
super(`"${alias}" is not a former provider name. \`agent-shim provider list\` shows the ones recorded.`);
|
|
36376
|
+
this.alias = alias;
|
|
36377
|
+
this.name = "ProviderAliasNotFoundError";
|
|
36378
|
+
}
|
|
36379
|
+
alias;
|
|
36380
|
+
};
|
|
36381
|
+
}
|
|
36382
|
+
});
|
|
36383
|
+
|
|
36277
36384
|
// src/models/identity.ts
|
|
36278
36385
|
function withoutContextMarker(model) {
|
|
36279
36386
|
return model.toLowerCase().endsWith(CONTEXT_MARKER_1M) ? model.slice(0, -CONTEXT_MARKER_1M.length) : model;
|
|
@@ -36488,11 +36595,16 @@ var init_families = __esm({
|
|
|
36488
36595
|
});
|
|
36489
36596
|
|
|
36490
36597
|
// src/providersStore.ts
|
|
36598
|
+
function requireValidProviderName(name) {
|
|
36599
|
+
if (!PROVIDER_NAME_RE.test(name)) {
|
|
36600
|
+
throw new InvalidProviderNameError(name);
|
|
36601
|
+
}
|
|
36602
|
+
}
|
|
36491
36603
|
function providerJsonPath(paths, name) {
|
|
36492
36604
|
return import_node_path29.default.join(paths.providersDir, `${name}.json`);
|
|
36493
36605
|
}
|
|
36494
36606
|
function providerExists(paths, name) {
|
|
36495
|
-
return
|
|
36607
|
+
return import_node_fs11.default.existsSync(providerJsonPath(paths, name));
|
|
36496
36608
|
}
|
|
36497
36609
|
function isRecord4(value2) {
|
|
36498
36610
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
@@ -36543,10 +36655,10 @@ function parseProviderFile(filePath, raw) {
|
|
|
36543
36655
|
}
|
|
36544
36656
|
function readProvider(paths, name) {
|
|
36545
36657
|
const filePath = providerJsonPath(paths, name);
|
|
36546
|
-
if (!
|
|
36658
|
+
if (!import_node_fs11.default.existsSync(filePath)) {
|
|
36547
36659
|
return void 0;
|
|
36548
36660
|
}
|
|
36549
|
-
const raw = JSON.parse(
|
|
36661
|
+
const raw = JSON.parse(import_node_fs11.default.readFileSync(filePath, "utf8"));
|
|
36550
36662
|
return parseProviderFile(filePath, raw);
|
|
36551
36663
|
}
|
|
36552
36664
|
function loadProvider(providersDir, name, port) {
|
|
@@ -36559,7 +36671,7 @@ function reportInvalidProvider(name, message) {
|
|
|
36559
36671
|
}
|
|
36560
36672
|
function listProviders(paths, onInvalid = reportInvalidProvider) {
|
|
36561
36673
|
const names = listProviderNames(
|
|
36562
|
-
(dir) =>
|
|
36674
|
+
(dir) => import_node_fs11.default.readdirSync(dir),
|
|
36563
36675
|
paths.providersDir
|
|
36564
36676
|
);
|
|
36565
36677
|
const result = [];
|
|
@@ -36608,9 +36720,7 @@ function addProvider(paths, name, input2) {
|
|
|
36608
36720
|
if (providerExists(paths, name)) {
|
|
36609
36721
|
throw new ProviderAlreadyExistsError(name);
|
|
36610
36722
|
}
|
|
36611
|
-
|
|
36612
|
-
throw new InvalidProviderNameError(name);
|
|
36613
|
-
}
|
|
36723
|
+
requireValidProviderName(name);
|
|
36614
36724
|
const kind = input2.kind ?? "http";
|
|
36615
36725
|
if (kind === "codex" && input2.baseUrl !== void 0) {
|
|
36616
36726
|
throw new ProviderKindMismatchError("A codex provider has no base URL: the launcher points its sessions at the front-door daemon. Drop --base-url.");
|
|
@@ -36728,7 +36838,7 @@ function removeProvider(paths, name) {
|
|
|
36728
36838
|
if (!providerExists(paths, name)) {
|
|
36729
36839
|
throw new ProviderNotFoundError(name);
|
|
36730
36840
|
}
|
|
36731
|
-
|
|
36841
|
+
import_node_fs11.default.rmSync(providerJsonPath(paths, name));
|
|
36732
36842
|
}
|
|
36733
36843
|
function cascadeProviderName(cascade) {
|
|
36734
36844
|
let name;
|
|
@@ -36741,10 +36851,11 @@ function cascadeProviderName(cascade) {
|
|
|
36741
36851
|
}
|
|
36742
36852
|
function selectProvider(params) {
|
|
36743
36853
|
const cliName = params.cliProvider !== void 0 && params.cliProvider !== "" ? params.cliProvider : void 0;
|
|
36744
|
-
const
|
|
36745
|
-
if (
|
|
36854
|
+
const named = cliName ?? (params.cascade === void 0 ? void 0 : cascadeProviderName(params.cascade));
|
|
36855
|
+
if (named === void 0) {
|
|
36746
36856
|
return void 0;
|
|
36747
36857
|
}
|
|
36858
|
+
const name = canonicalProviderName(named, (candidate) => loadProvider(params.paths.providersDir, candidate, params.port) !== void 0, () => loadProviderAliases(params.paths.providerAliasesFile, params.port));
|
|
36748
36859
|
const definition = loadProvider(params.paths.providersDir, name, params.port);
|
|
36749
36860
|
if (definition === void 0) {
|
|
36750
36861
|
const known = listProviderNames(params.port.readdir, params.paths.providersDir);
|
|
@@ -36833,17 +36944,18 @@ function resolveRoutedProviderCredentials(params) {
|
|
|
36833
36944
|
}
|
|
36834
36945
|
return { ok: true, checked: [...providerNames].sort() };
|
|
36835
36946
|
}
|
|
36836
|
-
var
|
|
36947
|
+
var import_node_fs11, import_node_path29, ProviderNotFoundError, ProviderAlreadyExistsError, InvalidProviderNameError, PROVIDER_NAME_RE, LEGACY_PROVIDER_FIELDS, LEGACY_ENV_CREDENTIAL_KEYS, LEGACY_LITERAL_PLACEHOLDER, LegacyProviderFileError, ProviderKindMismatchError;
|
|
36837
36948
|
var init_providersStore = __esm({
|
|
36838
36949
|
"src/providersStore.ts"() {
|
|
36839
36950
|
"use strict";
|
|
36840
|
-
|
|
36951
|
+
import_node_fs11 = __toESM(require("node:fs"), 1);
|
|
36841
36952
|
import_node_path29 = __toESM(require("node:path"), 1);
|
|
36842
36953
|
init_load();
|
|
36843
36954
|
init_store();
|
|
36844
36955
|
init_unrecognisedKeys();
|
|
36845
36956
|
init_schema();
|
|
36846
36957
|
init_cliError();
|
|
36958
|
+
init_providerAliases();
|
|
36847
36959
|
init_credential();
|
|
36848
36960
|
init_walk();
|
|
36849
36961
|
init_families();
|
|
@@ -36921,12 +37033,12 @@ function decideSignIn(facts) {
|
|
|
36921
37033
|
function credentialsFilePath(farmRoot) {
|
|
36922
37034
|
return import_node_path30.default.join(farmRoot, CREDENTIALS_FILE);
|
|
36923
37035
|
}
|
|
36924
|
-
function identitySignIn(
|
|
37036
|
+
function identitySignIn(fs28, probe, identity) {
|
|
36925
37037
|
const probing = !identity.hasCredentialBlock;
|
|
36926
37038
|
return decideSignIn({
|
|
36927
37039
|
hasCredentialBlock: identity.hasCredentialBlock,
|
|
36928
37040
|
keychainItem: probing && probe.platform === "darwin" && probe.run !== void 0 ? keychainHasItem(probe.run, identity.farmRoot) : void 0,
|
|
36929
|
-
credentialsFile: probing &&
|
|
37041
|
+
credentialsFile: probing && fs28.lstat(credentialsFilePath(identity.farmRoot)) !== void 0,
|
|
36930
37042
|
platform: probe.platform
|
|
36931
37043
|
});
|
|
36932
37044
|
}
|
|
@@ -38170,14 +38282,14 @@ var require_util2 = __commonJS({
|
|
|
38170
38282
|
}
|
|
38171
38283
|
const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
|
|
38172
38284
|
let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
|
|
38173
|
-
let
|
|
38285
|
+
let path66 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
|
|
38174
38286
|
if (origin[origin.length - 1] === "/") {
|
|
38175
38287
|
origin = origin.slice(0, origin.length - 1);
|
|
38176
38288
|
}
|
|
38177
|
-
if (
|
|
38178
|
-
|
|
38289
|
+
if (path66 && path66[0] !== "/") {
|
|
38290
|
+
path66 = `/${path66}`;
|
|
38179
38291
|
}
|
|
38180
|
-
return new URL(`${origin}${
|
|
38292
|
+
return new URL(`${origin}${path66}`);
|
|
38181
38293
|
}
|
|
38182
38294
|
if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
|
|
38183
38295
|
throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -38998,9 +39110,9 @@ var require_diagnostics = __commonJS({
|
|
|
38998
39110
|
"undici:client:sendHeaders",
|
|
38999
39111
|
(evt) => {
|
|
39000
39112
|
const {
|
|
39001
|
-
request: { method, path:
|
|
39113
|
+
request: { method, path: path66, origin }
|
|
39002
39114
|
} = evt;
|
|
39003
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
39115
|
+
debugLog("sending request to %s %s%s", method, origin, path66);
|
|
39004
39116
|
}
|
|
39005
39117
|
);
|
|
39006
39118
|
}
|
|
@@ -39018,14 +39130,14 @@ var require_diagnostics = __commonJS({
|
|
|
39018
39130
|
"undici:request:headers",
|
|
39019
39131
|
(evt) => {
|
|
39020
39132
|
const {
|
|
39021
|
-
request: { method, path:
|
|
39133
|
+
request: { method, path: path66, origin },
|
|
39022
39134
|
response: { statusCode }
|
|
39023
39135
|
} = evt;
|
|
39024
39136
|
debugLog(
|
|
39025
39137
|
"received response to %s %s%s - HTTP %d",
|
|
39026
39138
|
method,
|
|
39027
39139
|
origin,
|
|
39028
|
-
|
|
39140
|
+
path66,
|
|
39029
39141
|
statusCode
|
|
39030
39142
|
);
|
|
39031
39143
|
}
|
|
@@ -39034,23 +39146,23 @@ var require_diagnostics = __commonJS({
|
|
|
39034
39146
|
"undici:request:trailers",
|
|
39035
39147
|
(evt) => {
|
|
39036
39148
|
const {
|
|
39037
|
-
request: { method, path:
|
|
39149
|
+
request: { method, path: path66, origin }
|
|
39038
39150
|
} = evt;
|
|
39039
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
39151
|
+
debugLog("trailers received from %s %s%s", method, origin, path66);
|
|
39040
39152
|
}
|
|
39041
39153
|
);
|
|
39042
39154
|
diagnosticsChannel.subscribe(
|
|
39043
39155
|
"undici:request:error",
|
|
39044
39156
|
(evt) => {
|
|
39045
39157
|
const {
|
|
39046
|
-
request: { method, path:
|
|
39158
|
+
request: { method, path: path66, origin },
|
|
39047
39159
|
error: error63
|
|
39048
39160
|
} = evt;
|
|
39049
39161
|
debugLog(
|
|
39050
39162
|
"request to %s %s%s errored - %s",
|
|
39051
39163
|
method,
|
|
39052
39164
|
origin,
|
|
39053
|
-
|
|
39165
|
+
path66,
|
|
39054
39166
|
error63.message
|
|
39055
39167
|
);
|
|
39056
39168
|
}
|
|
@@ -39165,7 +39277,7 @@ var require_request = __commonJS({
|
|
|
39165
39277
|
var kHandler = /* @__PURE__ */ Symbol("handler");
|
|
39166
39278
|
var Request2 = class {
|
|
39167
39279
|
constructor(origin, {
|
|
39168
|
-
path:
|
|
39280
|
+
path: path66,
|
|
39169
39281
|
method,
|
|
39170
39282
|
body,
|
|
39171
39283
|
headers,
|
|
@@ -39182,11 +39294,11 @@ var require_request = __commonJS({
|
|
|
39182
39294
|
maxRedirections,
|
|
39183
39295
|
typeOfService
|
|
39184
39296
|
}, handler) {
|
|
39185
|
-
if (typeof
|
|
39297
|
+
if (typeof path66 !== "string") {
|
|
39186
39298
|
throw new InvalidArgumentError2("path must be a string");
|
|
39187
|
-
} else if (
|
|
39299
|
+
} else if (path66[0] !== "/" && !(path66.startsWith("http://") || path66.startsWith("https://")) && method !== "CONNECT") {
|
|
39188
39300
|
throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
|
|
39189
|
-
} else if (invalidPathRegex.test(
|
|
39301
|
+
} else if (invalidPathRegex.test(path66)) {
|
|
39190
39302
|
throw new InvalidArgumentError2("invalid request path");
|
|
39191
39303
|
}
|
|
39192
39304
|
if (typeof method !== "string") {
|
|
@@ -39261,7 +39373,7 @@ var require_request = __commonJS({
|
|
|
39261
39373
|
this.completed = false;
|
|
39262
39374
|
this.aborted = false;
|
|
39263
39375
|
this.upgrade = upgrade || null;
|
|
39264
|
-
this.path = query ? serializePathWithQuery(
|
|
39376
|
+
this.path = query ? serializePathWithQuery(path66, query) : path66;
|
|
39265
39377
|
this.origin = origin;
|
|
39266
39378
|
this.protocol = getProtocolFromUrlString(origin);
|
|
39267
39379
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -44443,7 +44555,7 @@ var require_client_h1 = __commonJS({
|
|
|
44443
44555
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
44444
44556
|
}
|
|
44445
44557
|
function writeH1(client, request7) {
|
|
44446
|
-
const { method, path:
|
|
44558
|
+
const { method, path: path66, host, upgrade, blocking, reset } = request7;
|
|
44447
44559
|
let { body, headers, contentLength } = request7;
|
|
44448
44560
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
44449
44561
|
if (util2.isFormDataLike(body)) {
|
|
@@ -44521,7 +44633,7 @@ var require_client_h1 = __commonJS({
|
|
|
44521
44633
|
if (socket.setTypeOfService) {
|
|
44522
44634
|
socket.setTypeOfService(request7.typeOfService);
|
|
44523
44635
|
}
|
|
44524
|
-
let header = `${method} ${
|
|
44636
|
+
let header = `${method} ${path66} HTTP/1.1\r
|
|
44525
44637
|
`;
|
|
44526
44638
|
if (typeof host === "string") {
|
|
44527
44639
|
header += `host: ${host}\r
|
|
@@ -45200,7 +45312,7 @@ var require_client_h2 = __commonJS({
|
|
|
45200
45312
|
const headersTimeout = request7.headersTimeout ?? client[kHeadersTimeout];
|
|
45201
45313
|
const bodyTimeout = request7.bodyTimeout ?? client[kBodyTimeout];
|
|
45202
45314
|
const session = client[kHTTP2Session];
|
|
45203
|
-
const { method, path:
|
|
45315
|
+
const { method, path: path66, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
|
|
45204
45316
|
let { body } = request7;
|
|
45205
45317
|
if (upgrade != null && upgrade !== "websocket") {
|
|
45206
45318
|
util2.errorRequest(client, request7, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
@@ -45269,7 +45381,7 @@ var require_client_h2 = __commonJS({
|
|
|
45269
45381
|
}
|
|
45270
45382
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
45271
45383
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
45272
|
-
headers[HTTP2_HEADER_PATH] =
|
|
45384
|
+
headers[HTTP2_HEADER_PATH] = path66;
|
|
45273
45385
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
45274
45386
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
45275
45387
|
} else {
|
|
@@ -45311,7 +45423,7 @@ var require_client_h2 = __commonJS({
|
|
|
45311
45423
|
stream.setTimeout(headersTimeout);
|
|
45312
45424
|
return true;
|
|
45313
45425
|
}
|
|
45314
|
-
headers[HTTP2_HEADER_PATH] =
|
|
45426
|
+
headers[HTTP2_HEADER_PATH] = path66;
|
|
45315
45427
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
45316
45428
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
45317
45429
|
if (body && typeof body.read === "function") {
|
|
@@ -47663,10 +47775,10 @@ var require_proxy_agent = __commonJS({
|
|
|
47663
47775
|
};
|
|
47664
47776
|
const {
|
|
47665
47777
|
origin,
|
|
47666
|
-
path:
|
|
47778
|
+
path: path66 = "/",
|
|
47667
47779
|
headers = {}
|
|
47668
47780
|
} = opts;
|
|
47669
|
-
opts.path = origin +
|
|
47781
|
+
opts.path = origin + path66;
|
|
47670
47782
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
47671
47783
|
const { host } = new URL(origin);
|
|
47672
47784
|
headers.host = host;
|
|
@@ -49775,20 +49887,20 @@ var require_mock_utils = __commonJS({
|
|
|
49775
49887
|
}
|
|
49776
49888
|
return normalizedQp;
|
|
49777
49889
|
}
|
|
49778
|
-
function safeUrl(
|
|
49779
|
-
if (typeof
|
|
49780
|
-
return
|
|
49890
|
+
function safeUrl(path66) {
|
|
49891
|
+
if (typeof path66 !== "string") {
|
|
49892
|
+
return path66;
|
|
49781
49893
|
}
|
|
49782
|
-
const pathSegments =
|
|
49894
|
+
const pathSegments = path66.split("?", 3);
|
|
49783
49895
|
if (pathSegments.length !== 2) {
|
|
49784
|
-
return
|
|
49896
|
+
return path66;
|
|
49785
49897
|
}
|
|
49786
49898
|
const qp2 = new URLSearchParams(pathSegments.pop());
|
|
49787
49899
|
qp2.sort();
|
|
49788
49900
|
return [...pathSegments, qp2.toString()].join("?");
|
|
49789
49901
|
}
|
|
49790
|
-
function matchKey(mockDispatch2, { path:
|
|
49791
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
49902
|
+
function matchKey(mockDispatch2, { path: path66, method, body, headers }) {
|
|
49903
|
+
const pathMatch = matchValue(mockDispatch2.path, path66);
|
|
49792
49904
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
49793
49905
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
49794
49906
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -49813,8 +49925,8 @@ var require_mock_utils = __commonJS({
|
|
|
49813
49925
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
49814
49926
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
49815
49927
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
49816
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
49817
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
49928
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path66, ignoreTrailingSlash }) => {
|
|
49929
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path66)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path66), resolvedPath);
|
|
49818
49930
|
});
|
|
49819
49931
|
if (matchedMockDispatches.length === 0) {
|
|
49820
49932
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -49853,19 +49965,19 @@ var require_mock_utils = __commonJS({
|
|
|
49853
49965
|
mockDispatches.splice(index, 1);
|
|
49854
49966
|
}
|
|
49855
49967
|
}
|
|
49856
|
-
function removeTrailingSlash(
|
|
49857
|
-
while (
|
|
49858
|
-
|
|
49968
|
+
function removeTrailingSlash(path66) {
|
|
49969
|
+
while (path66.endsWith("/")) {
|
|
49970
|
+
path66 = path66.slice(0, -1);
|
|
49859
49971
|
}
|
|
49860
|
-
if (
|
|
49861
|
-
|
|
49972
|
+
if (path66.length === 0) {
|
|
49973
|
+
path66 = "/";
|
|
49862
49974
|
}
|
|
49863
|
-
return
|
|
49975
|
+
return path66;
|
|
49864
49976
|
}
|
|
49865
49977
|
function buildKey(opts) {
|
|
49866
|
-
const { path:
|
|
49978
|
+
const { path: path66, method, body, headers, query } = opts;
|
|
49867
49979
|
return {
|
|
49868
|
-
path:
|
|
49980
|
+
path: path66,
|
|
49869
49981
|
method,
|
|
49870
49982
|
body,
|
|
49871
49983
|
headers,
|
|
@@ -50555,10 +50667,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
50555
50667
|
}
|
|
50556
50668
|
format(pendingInterceptors) {
|
|
50557
50669
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
50558
|
-
({ method, path:
|
|
50670
|
+
({ method, path: path66, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
50559
50671
|
Method: method,
|
|
50560
50672
|
Origin: origin,
|
|
50561
|
-
Path:
|
|
50673
|
+
Path: path66,
|
|
50562
50674
|
"Status code": statusCode,
|
|
50563
50675
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
50564
50676
|
Invocations: timesInvoked,
|
|
@@ -50640,9 +50752,9 @@ var require_mock_agent = __commonJS({
|
|
|
50640
50752
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
50641
50753
|
const dispatchOpts = { ...opts };
|
|
50642
50754
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
50643
|
-
const [
|
|
50755
|
+
const [path66, searchParams] = dispatchOpts.path.split("?");
|
|
50644
50756
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
50645
|
-
dispatchOpts.path = `${
|
|
50757
|
+
dispatchOpts.path = `${path66}?${normalizedSearchParams}`;
|
|
50646
50758
|
}
|
|
50647
50759
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
50648
50760
|
}
|
|
@@ -51043,12 +51155,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
51043
51155
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
51044
51156
|
*/
|
|
51045
51157
|
async loadSnapshots(filePath) {
|
|
51046
|
-
const
|
|
51047
|
-
if (!
|
|
51158
|
+
const path66 = filePath || this.#snapshotPath;
|
|
51159
|
+
if (!path66) {
|
|
51048
51160
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
51049
51161
|
}
|
|
51050
51162
|
try {
|
|
51051
|
-
const data = await readFile(resolve2(
|
|
51163
|
+
const data = await readFile(resolve2(path66), "utf8");
|
|
51052
51164
|
const parsed = JSON.parse(data);
|
|
51053
51165
|
if (Array.isArray(parsed)) {
|
|
51054
51166
|
this.#snapshots.clear();
|
|
@@ -51062,7 +51174,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
51062
51174
|
if (error63.code === "ENOENT") {
|
|
51063
51175
|
this.#snapshots.clear();
|
|
51064
51176
|
} else {
|
|
51065
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
51177
|
+
throw new UndiciError(`Failed to load snapshots from ${path66}`, { cause: error63 });
|
|
51066
51178
|
}
|
|
51067
51179
|
}
|
|
51068
51180
|
}
|
|
@@ -51073,11 +51185,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
51073
51185
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
51074
51186
|
*/
|
|
51075
51187
|
async saveSnapshots(filePath) {
|
|
51076
|
-
const
|
|
51077
|
-
if (!
|
|
51188
|
+
const path66 = filePath || this.#snapshotPath;
|
|
51189
|
+
if (!path66) {
|
|
51078
51190
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
51079
51191
|
}
|
|
51080
|
-
const resolvedPath = resolve2(
|
|
51192
|
+
const resolvedPath = resolve2(path66);
|
|
51081
51193
|
await mkdir(dirname3(resolvedPath), { recursive: true });
|
|
51082
51194
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
51083
51195
|
hash: hash2,
|
|
@@ -51709,15 +51821,15 @@ var require_redirect_handler = __commonJS({
|
|
|
51709
51821
|
return;
|
|
51710
51822
|
}
|
|
51711
51823
|
const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
51712
|
-
const
|
|
51713
|
-
const redirectUrlString = `${origin}${
|
|
51824
|
+
const path66 = search ? `${pathname}${search}` : pathname;
|
|
51825
|
+
const redirectUrlString = `${origin}${path66}`;
|
|
51714
51826
|
for (const historyUrl of this.history) {
|
|
51715
51827
|
if (historyUrl.toString() === redirectUrlString) {
|
|
51716
51828
|
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.`);
|
|
51717
51829
|
}
|
|
51718
51830
|
}
|
|
51719
51831
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
51720
|
-
this.opts.path =
|
|
51832
|
+
this.opts.path = path66;
|
|
51721
51833
|
this.opts.origin = origin;
|
|
51722
51834
|
this.opts.query = null;
|
|
51723
51835
|
}
|
|
@@ -53477,10 +53589,10 @@ var require_cache_handler = __commonJS({
|
|
|
53477
53589
|
}
|
|
53478
53590
|
return locationUrl.pathname + locationUrl.search;
|
|
53479
53591
|
}
|
|
53480
|
-
function deleteCachedUri(store, cacheKey,
|
|
53592
|
+
function deleteCachedUri(store, cacheKey, path66) {
|
|
53481
53593
|
deleteCachedValue(store, {
|
|
53482
53594
|
...cacheKey,
|
|
53483
|
-
path:
|
|
53595
|
+
path: path66
|
|
53484
53596
|
});
|
|
53485
53597
|
for (let i10 = 0; i10 < util2.safeHTTPMethods.length; i10++) {
|
|
53486
53598
|
const method = util2.safeHTTPMethods[i10];
|
|
@@ -53488,7 +53600,7 @@ var require_cache_handler = __commonJS({
|
|
|
53488
53600
|
deleteCachedValue(store, {
|
|
53489
53601
|
...cacheKey,
|
|
53490
53602
|
method,
|
|
53491
|
-
path:
|
|
53603
|
+
path: path66
|
|
53492
53604
|
});
|
|
53493
53605
|
}
|
|
53494
53606
|
}
|
|
@@ -53499,9 +53611,9 @@ var require_cache_handler = __commonJS({
|
|
|
53499
53611
|
}
|
|
53500
53612
|
const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
|
|
53501
53613
|
for (let i10 = 0; i10 < values.length; i10++) {
|
|
53502
|
-
const
|
|
53503
|
-
if (
|
|
53504
|
-
deleteCachedUri(store, cacheKey,
|
|
53614
|
+
const path66 = getSameOriginPath(cacheKey, values[i10]);
|
|
53615
|
+
if (path66 !== void 0) {
|
|
53616
|
+
deleteCachedUri(store, cacheKey, path66);
|
|
53505
53617
|
}
|
|
53506
53618
|
}
|
|
53507
53619
|
}
|
|
@@ -58501,11 +58613,11 @@ var require_fetch = __commonJS({
|
|
|
58501
58613
|
function dispatch({ body }) {
|
|
58502
58614
|
const url2 = requestCurrentURL(request7);
|
|
58503
58615
|
const agent = fetchParams.controller.dispatcher;
|
|
58504
|
-
const
|
|
58616
|
+
const path66 = url2.pathname + url2.search;
|
|
58505
58617
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
58506
58618
|
return new Promise((resolve2, reject) => agent.dispatch(
|
|
58507
58619
|
{
|
|
58508
|
-
path: hasTrailingQuestionMark ? `${
|
|
58620
|
+
path: hasTrailingQuestionMark ? `${path66}?` : path66,
|
|
58509
58621
|
origin: url2.origin,
|
|
58510
58622
|
method: request7.method,
|
|
58511
58623
|
body: agent.isMockActive ? request7.body && (request7.body.source || request7.body.stream) : body,
|
|
@@ -59452,9 +59564,9 @@ var require_util5 = __commonJS({
|
|
|
59452
59564
|
}
|
|
59453
59565
|
}
|
|
59454
59566
|
}
|
|
59455
|
-
function validateCookiePath(
|
|
59456
|
-
for (let i10 = 0; i10 <
|
|
59457
|
-
const code =
|
|
59567
|
+
function validateCookiePath(path66) {
|
|
59568
|
+
for (let i10 = 0; i10 < path66.length; ++i10) {
|
|
59569
|
+
const code = path66.charCodeAt(i10);
|
|
59458
59570
|
if (code < 32 || // exclude CTLs (0-31)
|
|
59459
59571
|
code > 126 || // exclude DEL and non-ascii
|
|
59460
59572
|
code === 59) {
|
|
@@ -62802,11 +62914,11 @@ var require_undici = __commonJS({
|
|
|
62802
62914
|
if (typeof opts.path !== "string") {
|
|
62803
62915
|
throw new InvalidArgumentError2("invalid opts.path");
|
|
62804
62916
|
}
|
|
62805
|
-
let
|
|
62917
|
+
let path66 = opts.path;
|
|
62806
62918
|
if (!opts.path.startsWith("/")) {
|
|
62807
|
-
|
|
62919
|
+
path66 = `/${path66}`;
|
|
62808
62920
|
}
|
|
62809
|
-
url2 = new URL(util2.parseOrigin(url2).origin +
|
|
62921
|
+
url2 = new URL(util2.parseOrigin(url2).origin + path66);
|
|
62810
62922
|
} else {
|
|
62811
62923
|
if (!opts) {
|
|
62812
62924
|
opts = typeof url2 === "object" ? url2 : {};
|
|
@@ -63177,14 +63289,14 @@ var init_selfIdentity = __esm({
|
|
|
63177
63289
|
|
|
63178
63290
|
// src/frontdoor/trust.ts
|
|
63179
63291
|
function resolveTrustBundle(params) {
|
|
63180
|
-
const { caCertFile, bundlesDir, variable, inherited, fs:
|
|
63292
|
+
const { caCertFile, bundlesDir, variable, inherited, fs: fs28 } = params;
|
|
63181
63293
|
if (inherited === void 0 || inherited === "" || import_node_path37.default.resolve(inherited) === import_node_path37.default.resolve(caCertFile)) {
|
|
63182
63294
|
return { path: caCertFile };
|
|
63183
63295
|
}
|
|
63184
|
-
const caPem =
|
|
63296
|
+
const caPem = fs28.readFileUtf8(caCertFile);
|
|
63185
63297
|
let inheritedPem;
|
|
63186
63298
|
try {
|
|
63187
|
-
inheritedPem =
|
|
63299
|
+
inheritedPem = fs28.readFileUtf8(inherited);
|
|
63188
63300
|
} catch (error63) {
|
|
63189
63301
|
return {
|
|
63190
63302
|
path: caCertFile,
|
|
@@ -63197,9 +63309,9 @@ function resolveTrustBundle(params) {
|
|
|
63197
63309
|
const combined = `${inheritedPem.trimEnd()}
|
|
63198
63310
|
${caPem}`;
|
|
63199
63311
|
const bundle = import_node_path37.default.join(bundlesDir, `${(0, import_node_crypto12.createHash)("sha256").update(combined).digest("hex").slice(0, BUNDLE_NAME_HEX_DIGITS)}.pem`);
|
|
63200
|
-
if (!
|
|
63201
|
-
|
|
63202
|
-
|
|
63312
|
+
if (!fs28.exists(bundle)) {
|
|
63313
|
+
fs28.mkdirp(bundlesDir);
|
|
63314
|
+
fs28.writeFileAtomic(bundle, combined);
|
|
63203
63315
|
}
|
|
63204
63316
|
return { path: bundle };
|
|
63205
63317
|
}
|
|
@@ -63229,7 +63341,7 @@ function realEnsurePorts(paths, spawnDaemon) {
|
|
|
63229
63341
|
process.kill(pid, "SIGKILL");
|
|
63230
63342
|
},
|
|
63231
63343
|
// Read fresh for each probe: a replacement supervisor may have regenerated an unparseable CA, and the probe must trust exactly what the serving door's leaf chains to.
|
|
63232
|
-
verifyListener: (port) => probeFrontDoorSync(port,
|
|
63344
|
+
verifyListener: (port) => probeFrontDoorSync(port, import_node_fs14.default.readFileSync(paths.frontdoorCaCertFile, "utf8"))
|
|
63233
63345
|
};
|
|
63234
63346
|
}
|
|
63235
63347
|
function realRestartFrontDoor(paths, spawnDaemon) {
|
|
@@ -63253,11 +63365,11 @@ function realFrontDoorPort(paths, spawnDaemon) {
|
|
|
63253
63365
|
}
|
|
63254
63366
|
};
|
|
63255
63367
|
}
|
|
63256
|
-
var
|
|
63368
|
+
var import_node_fs14, realTrustBundleFs;
|
|
63257
63369
|
var init_realFrontDoorPort = __esm({
|
|
63258
63370
|
"src/frontdoor/realFrontDoorPort.ts"() {
|
|
63259
63371
|
"use strict";
|
|
63260
|
-
|
|
63372
|
+
import_node_fs14 = __toESM(require("node:fs"), 1);
|
|
63261
63373
|
init_realPorts();
|
|
63262
63374
|
init_ensure2();
|
|
63263
63375
|
init_state();
|
|
@@ -63265,10 +63377,10 @@ var init_realFrontDoorPort = __esm({
|
|
|
63265
63377
|
init_selfIdentity();
|
|
63266
63378
|
init_trust();
|
|
63267
63379
|
realTrustBundleFs = {
|
|
63268
|
-
readFileUtf8: (file2) =>
|
|
63269
|
-
exists: (file2) =>
|
|
63380
|
+
readFileUtf8: (file2) => import_node_fs14.default.readFileSync(file2, "utf8"),
|
|
63381
|
+
exists: (file2) => import_node_fs14.default.existsSync(file2),
|
|
63270
63382
|
mkdirp: (dir) => {
|
|
63271
|
-
|
|
63383
|
+
import_node_fs14.default.mkdirSync(dir, { recursive: true });
|
|
63272
63384
|
},
|
|
63273
63385
|
writeFileAtomic: (file2, contents) => {
|
|
63274
63386
|
realFarmFs.writeFilePrivate(file2, contents);
|
|
@@ -63366,20 +63478,20 @@ function lockHolder(contents) {
|
|
|
63366
63478
|
const pid = Number((contents ?? "").trim());
|
|
63367
63479
|
return Number.isInteger(pid) && pid > 0 ? pid : void 0;
|
|
63368
63480
|
}
|
|
63369
|
-
function acquireUpdateLock(
|
|
63370
|
-
const take = () =>
|
|
63481
|
+
function acquireUpdateLock(fs28, isProcessAlive, pid, lockPath) {
|
|
63482
|
+
const take = () => fs28.writeFileExclusive(lockPath, `${String(pid)}
|
|
63371
63483
|
`);
|
|
63372
63484
|
const release = () => {
|
|
63373
|
-
|
|
63485
|
+
fs28.unlink(lockPath);
|
|
63374
63486
|
};
|
|
63375
63487
|
if (take()) {
|
|
63376
63488
|
return release;
|
|
63377
63489
|
}
|
|
63378
|
-
const holder = lockHolder(
|
|
63490
|
+
const holder = lockHolder(fs28.readFileUtf8(lockPath));
|
|
63379
63491
|
if (holder !== void 0 && holder !== pid && isProcessAlive(holder)) {
|
|
63380
63492
|
throw new UpdateConflictError(`another agent-shim update (pid ${String(holder)}) is already running`);
|
|
63381
63493
|
}
|
|
63382
|
-
|
|
63494
|
+
fs28.unlink(lockPath);
|
|
63383
63495
|
if (!take()) {
|
|
63384
63496
|
throw new UpdateConflictError("another agent-shim update took the lock while it was being replaced");
|
|
63385
63497
|
}
|
|
@@ -64163,15 +64275,15 @@ function contextTokensOfTranscript(text2) {
|
|
|
64163
64275
|
}
|
|
64164
64276
|
return void 0;
|
|
64165
64277
|
}
|
|
64166
|
-
function newestTranscript(
|
|
64278
|
+
function newestTranscript(fs28, projectDir) {
|
|
64167
64279
|
let newest;
|
|
64168
64280
|
let newestMs = -Infinity;
|
|
64169
|
-
for (const name of
|
|
64281
|
+
for (const name of fs28.readdir(projectDir)) {
|
|
64170
64282
|
if (!name.endsWith(".jsonl")) {
|
|
64171
64283
|
continue;
|
|
64172
64284
|
}
|
|
64173
64285
|
const candidate = import_node_path42.default.join(projectDir, name);
|
|
64174
|
-
const stat =
|
|
64286
|
+
const stat = fs28.lstat(candidate);
|
|
64175
64287
|
if (stat?.kind === "file" && stat.mtimeMs > newestMs) {
|
|
64176
64288
|
newestMs = stat.mtimeMs;
|
|
64177
64289
|
newest = candidate;
|
|
@@ -64179,18 +64291,18 @@ function newestTranscript(fs26, projectDir) {
|
|
|
64179
64291
|
}
|
|
64180
64292
|
return newest;
|
|
64181
64293
|
}
|
|
64182
|
-
function latestConversationId(
|
|
64183
|
-
const file2 = newestTranscript(
|
|
64294
|
+
function latestConversationId(fs28, params) {
|
|
64295
|
+
const file2 = newestTranscript(fs28, import_node_path42.default.join(params.claudeHome, "projects", projectDirNameOf(params.cwd)));
|
|
64184
64296
|
return file2 === void 0 ? void 0 : import_node_path42.default.basename(file2, ".jsonl");
|
|
64185
64297
|
}
|
|
64186
|
-
function resumedContextTokens(
|
|
64298
|
+
function resumedContextTokens(fs28, params) {
|
|
64187
64299
|
const target = resumeTargetOf(params.passthrough);
|
|
64188
64300
|
if (target === void 0) {
|
|
64189
64301
|
return void 0;
|
|
64190
64302
|
}
|
|
64191
64303
|
const projectDir = import_node_path42.default.join(params.claudeHome, "projects", projectDirNameOf(params.cwd));
|
|
64192
|
-
const file2 = target.kind === "id" ? import_node_path42.default.join(projectDir, `${target.id}.jsonl`) : newestTranscript(
|
|
64193
|
-
const text2 = file2 === void 0 ? void 0 :
|
|
64304
|
+
const file2 = target.kind === "id" ? import_node_path42.default.join(projectDir, `${target.id}.jsonl`) : newestTranscript(fs28, projectDir);
|
|
64305
|
+
const text2 = file2 === void 0 ? void 0 : fs28.readFileUtf8(file2);
|
|
64194
64306
|
return text2 === void 0 ? void 0 : contextTokensOfTranscript(text2);
|
|
64195
64307
|
}
|
|
64196
64308
|
var import_node_path42;
|
|
@@ -66220,7 +66332,7 @@ function resolveIdentityCredential(identity, credential, env, port) {
|
|
|
66220
66332
|
return resolution.ok ? resolution : { ok: false, status: CREDENTIAL_UNAVAILABLE_EXIT, message: resolution.message };
|
|
66221
66333
|
}
|
|
66222
66334
|
function pickFromPool(decided, params, parsedArgv, readOnly) {
|
|
66223
|
-
const { paths, fs:
|
|
66335
|
+
const { paths, fs: fs28, proc, log } = params;
|
|
66224
66336
|
if (decided.pool === void 0) {
|
|
66225
66337
|
return { identityDecision: decided };
|
|
66226
66338
|
}
|
|
@@ -66239,7 +66351,7 @@ function pickFromPool(decided, params, parsedArgv, readOnly) {
|
|
|
66239
66351
|
selectedVia: decided.source,
|
|
66240
66352
|
pools: params.pools,
|
|
66241
66353
|
paths,
|
|
66242
|
-
fs:
|
|
66354
|
+
fs: fs28,
|
|
66243
66355
|
usageFs: farmRuntime.fs,
|
|
66244
66356
|
cwd: farmRuntime.cwd,
|
|
66245
66357
|
now: farmRuntime.now,
|
|
@@ -66262,7 +66374,7 @@ function pickFromPool(decided, params, parsedArgv, readOnly) {
|
|
|
66262
66374
|
};
|
|
66263
66375
|
}
|
|
66264
66376
|
function decideLaunch(params, readOnly) {
|
|
66265
|
-
const { paths, fs:
|
|
66377
|
+
const { paths, fs: fs28, proc, log } = params;
|
|
66266
66378
|
const { env, argv } = proc;
|
|
66267
66379
|
const parsedArgv = parseLauncherArgv(argv);
|
|
66268
66380
|
const cliOverride = buildCliOverride({
|
|
@@ -66277,7 +66389,7 @@ function decideLaunch(params, readOnly) {
|
|
|
66277
66389
|
argv0Identity: parsedArgv.identity,
|
|
66278
66390
|
directoryPinnedIdentity: params.directoryPinnedIdentity,
|
|
66279
66391
|
readActiveIdentityFile: () => {
|
|
66280
|
-
const raw =
|
|
66392
|
+
const raw = fs28.readFileUtf8(paths.activeIdentityFile);
|
|
66281
66393
|
if (raw === void 0) {
|
|
66282
66394
|
return void 0;
|
|
66283
66395
|
}
|
|
@@ -66312,7 +66424,7 @@ function decideLaunch(params, readOnly) {
|
|
|
66312
66424
|
}
|
|
66313
66425
|
let loadedIdentity;
|
|
66314
66426
|
if (identityDecision.name !== void 0) {
|
|
66315
|
-
loadedIdentity = loadIdentity(paths.identitiesDir, identityDecision.name,
|
|
66427
|
+
loadedIdentity = loadIdentity(paths.identitiesDir, identityDecision.name, fs28);
|
|
66316
66428
|
if (loadedIdentity === void 0) {
|
|
66317
66429
|
log.error(
|
|
66318
66430
|
`agent-shim: no identity named "${identityDecision.name}" (selected via ${identityDecision.source}). Run \`agent-shim identity add ${identityDecision.name}\` first.`
|
|
@@ -66327,7 +66439,7 @@ function decideLaunch(params, readOnly) {
|
|
|
66327
66439
|
identityDefaultConfigProfile: loadedIdentity?.config.defaultConfigProfile,
|
|
66328
66440
|
globalDefaultConfigProfile: params.globalDefaultConfigProfile
|
|
66329
66441
|
});
|
|
66330
|
-
if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true &&
|
|
66442
|
+
if (configProfileDecision.name !== void 0 && params.allowMissingConfigProfile !== true && fs28.readConfigFile(import_node_path44.default.join(paths.configProfilesDir, `${configProfileDecision.name}.json`)) === void 0) {
|
|
66331
66443
|
log.error(
|
|
66332
66444
|
`agent-shim: no configuration profile named "${configProfileDecision.name}" (selected via ${configProfileDecision.source}). Run \`agent-shim profile add ${configProfileDecision.name}\` first.`
|
|
66333
66445
|
);
|
|
@@ -66336,7 +66448,7 @@ function decideLaunch(params, readOnly) {
|
|
|
66336
66448
|
const farmContext = farm !== void 0 && farmIdentity !== void 0 ? { farm, identity: farmIdentity, cascade: farm.loadCascade(configProfileDecision.name, cliOverride) } : void 0;
|
|
66337
66449
|
const providerParams = {
|
|
66338
66450
|
paths,
|
|
66339
|
-
port:
|
|
66451
|
+
port: fs28,
|
|
66340
66452
|
...parsedArgv.provider === void 0 || parsedArgv.provider === false ? {} : { cliProvider: parsedArgv.provider },
|
|
66341
66453
|
...farmContext === void 0 ? {} : { cascade: farmContext.cascade }
|
|
66342
66454
|
};
|
|
@@ -66435,9 +66547,9 @@ function decideLaunch(params, readOnly) {
|
|
|
66435
66547
|
const flags = loginlessProvider === void 0 ? requestedFlags : { ...requestedFlags, remoteControl: false };
|
|
66436
66548
|
const globalModels = loadConfigFile(paths.globalConfigFile, GlobalConfigSchema, params.fs.readConfigFile)?.config.models;
|
|
66437
66549
|
const models = launchCascade !== void 0 && params.farm !== void 0 ? cascadeModels : globalModels;
|
|
66438
|
-
const listedProviders = listProviderNames(
|
|
66550
|
+
const listedProviders = listProviderNames(fs28.readdir, paths.providersDir).flatMap((name) => {
|
|
66439
66551
|
try {
|
|
66440
|
-
const definition = loadProvider(paths.providersDir, name,
|
|
66552
|
+
const definition = loadProvider(paths.providersDir, name, fs28);
|
|
66441
66553
|
return definition === void 0 ? [] : [[name, definition, parseCatalogueCache(params.fs.readFileUtf8(catalogueCachePath(paths, name)))?.models ?? []]];
|
|
66442
66554
|
} catch {
|
|
66443
66555
|
return [];
|
|
@@ -67775,10 +67887,10 @@ function Ww(e14) {
|
|
|
67775
67887
|
}
|
|
67776
67888
|
function M_() {
|
|
67777
67889
|
let e14 = "";
|
|
67778
|
-
if (typeof process < "u" && typeof process.cwd === "function" && typeof
|
|
67890
|
+
if (typeof process < "u" && typeof process.cwd === "function" && typeof import_node_fs16.realpathSync === "function") try {
|
|
67779
67891
|
let t10 = (0, import_node_process4.cwd)();
|
|
67780
67892
|
try {
|
|
67781
|
-
e14 = Ww((0,
|
|
67893
|
+
e14 = Ww((0, import_node_fs16.realpathSync)(t10));
|
|
67782
67894
|
} catch {
|
|
67783
67895
|
e14 = Ww(t10);
|
|
67784
67896
|
}
|
|
@@ -74402,11 +74514,11 @@ function hm(e14, t10, n10, r10) {
|
|
|
74402
74514
|
function EU(e14, t10) {
|
|
74403
74515
|
let n10 = e14.data;
|
|
74404
74516
|
if (n10.isSidechain === true) return null;
|
|
74405
|
-
let r10 =
|
|
74517
|
+
let r10 = fs16(n10.firstPromptLocked === true ? n10.firstPrompt : n10.commandFallback) || void 0, o = fs16(n10.customTitle) || fs16(n10.aiTitle) || void 0, s = o || fs16(n10.lastPrompt) || fs16(n10.summaryHint) || r10;
|
|
74406
74518
|
if (!s) return null;
|
|
74407
|
-
return { sessionId: e14.sessionId, summary: s, lastModified: e14.mtime, fileSize: void 0, customTitle: o, firstPrompt: r10, gitBranch:
|
|
74519
|
+
return { sessionId: e14.sessionId, summary: s, lastModified: e14.mtime, fileSize: void 0, customTitle: o, firstPrompt: r10, gitBranch: fs16(n10.gitBranch) || void 0, cwd: fs16(n10.cwd) || t10 || void 0, tag: fs16(n10.tag) || void 0, createdAt: uAe(n10.createdAt) };
|
|
74408
74520
|
}
|
|
74409
|
-
function
|
|
74521
|
+
function fs16(e14) {
|
|
74410
74522
|
return typeof e14 === "string" ? e14 : void 0;
|
|
74411
74523
|
}
|
|
74412
74524
|
function uAe(e14) {
|
|
@@ -81442,14 +81554,14 @@ async function jGe(e14, t10, n10, r10) {
|
|
|
81442
81554
|
if (d.length === 0) return [];
|
|
81443
81555
|
return iv(Buffer.from(gZ(d)), { limit: r10.limit, offset: r10.offset }, l, c10);
|
|
81444
81556
|
}
|
|
81445
|
-
var import_node_module, import_crypto, import_crypto2, import_path, import_node_fs15, import_node_process4, import_fs, import_os, import_path2, yy, import_fs2, import_promises, import_path3, import_readline, import_promises2, import_path4, import_os2, import_path5, Se, import_promises3, xe, import_promises4, import_fs3, import_promises5, import_os3, import_path6, import_promises6, import_os4, import_node_path46, import_node_os10, import_node_process5, import_path7, import_events, import_fs4, import_promises7, import_path8, import_child_process, import_util9, import_child_process2, import_fs5, import_path9, import_path10, import_crypto3, import_fs6, import_path11, import_promises8, import_path12, import_path13, import_promises9, import_path14, import_path15, import_fs7, import_promises10, import_path16, import_crypto4, import_path17, import_async_hooks, import_fs8, import_promises11, import_crypto5, import_fs9, import_promises12, import_path18, import_promises13, import_path19, import_crypto6, import_path20, import_path21, import_path22, import_path23, import_promises14, import_fs10, import_promises15, import_path24, import_util10, import_path25, import_os5, import_path26, import_path27, import_path28, import_path29, import_path30, import_net, import_os6, import_child_process3, import_fs11, import_child_process4, import_crypto7, import_promises16, import_module, import_os7, import_path31, import_url, import_events2, import_child_process5, import_fs12, import_readline2, import_string_decoder, import_fs13, import_promises17, import_os8, import_path32, import_crypto8, import_os9, import_fs14, import_path33, import_crypto9, import_fs15, import_promises18, import_path34, IZ, DZ, v_, LZ, OT, NZ, UZ, kT, X, FZ, dr, HZ, jZ, BZ, ot, st, ed, Kv, Te, Me, Oo, nd, hF, Xv, Qv, rd, LF, or, WF, ZF, sA, XF, od, sd, hg, id, Sg, Oz, fA, $z, Wz, Zz, s$, a$, d$, f$, g$, _$, E$, v$, T$, O$, I$, L$, wg, z$, j$, G$, V$, yA, SA, rH, lH, uH, _H, EH, EA, RH, TH, kH, DH, NH, zH, jH, GH, VH, ZH, JH, ej, nj, ij, cj, uj, CA, bj, Aj, wj, PT, KZ, GZ, VGe, VZ, MT, wr, jo, JZ, XZ, NT, UT, FT, zT, Bo, $T, HT, jT, BT, a4, sp, l4, c4, vt, u4, Nt, KT, d4, p4, uc, GT, m4, g4, WT, _4, y4, VT, Dn, Et, b4, C4, v4, A4, ra, x4, ip, qT, ZT, w4, O4, ro, P4, I4, D4, L4, M4, N4, U4, YT, JT, Sn, H4, Ko, j4, oo, XT, QT, G4, W4, V4, ew, Z4, Y4, tw, X4, nw, R_, rw, ow, Go, sw, iw, aw, lw, ei, aY, cw, Or, cY, uw, dw, lp, pw, cp, mY, gY, up, _Y, aa, fw, la, EY, bY, CY, vY, AY, RY, xY, TY, wY, OY, kY, PY, IY, mw, x_, gw, ca, MY, et, dp, hw, pp, zY, $Y, _w, HY, ua, yw, wt, KY, T_, Sw, WY, VY, qY, so, mp, Ew, vw, bw, YY, Cw, JY, XY, kr, QY, e9, Wo, n9, da, o9, s9, i9, a9, l9, c9, u9, d9, p9, f9, m9, g9, h9, _9, y9, S9, E9, b9, C9, v9, A9, R9, x9, T9, Qe, Aw, pa, hp, Rw, dc, k9, w_, P9, Pr, xw, I9, fa, D9, L9, _p, N9, ma, yp, z9, Tw, $9, H9, ww, Vo, Ir, pc, W9, V9, q9, Ow, Y9, Sp, J9, Ep, X9, qo, Q9, bp, kw, eJ, Pw, Iw, Dw, Lw, tJ, nJ, rJ, oJ, sJ, ti, io, iJ, Mw, Nw, Cp, aJ, Uw, Fw, ga, pr, uJ, Fe, $w, O_, k_, I_, ha, Bw, D_, qw, Vw, N_, U_, yJ, _a3, Yo, Zw, bJ, Rp, Yw, vJ, AJ, Jw, xp, Xw, Tp, Qw, kJ, ya, IJ, DJ, Sa, MJ, fc, NJ, eO, FJ, zJ, $J, tO, Ea, jJ, nO, rO, sO, iO, Vn, GJ, Ln, Jo, aO, lO, cO, wp, XJ, QJ, uO, ba, dO, pO, fO, Dr, ao, mO, Ca, gO, z_, $_, H_, j_, B_, K_, G_, W_, V_, q_, Z_, _O, Y_, J_, yO, X_, c3, Q_, ey, ty, ny, ry, oy, sy, iy, ay, ly, cy, we, SO, en, d3, Pp, vO, g3, gy, wO, S3, BO, KO, Ip, Dp, v3, GO, WO, F9e, IO, A3, hy, x3, NO, I3, Ay, Ry, D3, xy, L3, bc, xa, Ty, wy, Oy, ky, XO, Py, Iy, Dy, Ly, My, Ny, Uy, Fy, zy, nk, rk, d3e, p3e, f3e, m3e, g3e, U3, jp, jy, ik, By, Ky, lk, $3, uk, ck, G3, W3, V3, it, Y3, J3, hk, tXe, Q3, kt, We, gX, Ta, SX, mr, Yp, Jp, eS, nS, yXe, IX, DX, rS, ka, oS, Ok, kk, HX, jX, ef, bXe, Uk, Mr, wc, Fk, Pa, OXe, kXe, iS, PXe, IXe, DXe, GX, YX, JX, XX, QX, e6, t6, Yk, n6, r6, o6, s6, i6, a6, l6, c6, Vk, uS, lf, dS, Qk, eP, uf, os10, qXe, ZXe, h6, tP, df, _6, y6, S6, E6, b6, Jn, gr, nP, rP, Dc, pS, oP, gS, lP, C6, mS, lS, sP, w6, O6, dP, k6, YXe, JXe, P6, I6, pf, L6, fP, XXe, QXe, M6, SS, z6, $6, j6, bP, CP, G6, Lc, si, Z6, ES, bS, X6, Q6, e5, t5, n5, u5, r5, o5, s5, i5, a5, l5, c5, u52, d5, p5, f5, m5, g5, h5, _5, y5, S5, E5, b5, C5, v5, A5, R5, x5, T5, w5, O5, k5, P5, I5, D5, L5, M5, N5, U5, F5, z5, $5, H5, j5, B5, K5, G5, W5, V5, q5, Z5, Y5, J5, X5, Q5, e8, t8, n8, r8, o8, s8, i8, a8, l8, c8, u8, d8, CS, p8, f8, m8, g8, h8, _8, y8, S8, E8, b8, C8, v8, A8, R8, x8, T8, w8, O8, k8, P8, I8, D8, L8, M8, N8, U8, F8, z8, $8, H8, j8, B8, K8, G8, W8, V8, q8, Z8, Y8, J8, X8, Q8, e7, t7, n7, r7, o7, s7, i7, a7, l7, c7, u7, d7, p7, f7, m7, g7, h7, _7, y7, S7, E7, b7, C7, TP, v7, L6e, RP, A7, x7, kP, ff, U6e, F6e, Ua, z6e, $6e, H6e, j6e, PP, IP, vS, DP, w7, LP, O7, k7, P7, AS, RS, xS, I7, MP, NP, D7, G6e, L7, W6e, M7, N7, UP, V6e, U7, F7, z7, $7, H7, j7, B7, q6e, is, wS, Fa, K7, G7, W7, i5e, X7, Q7, HP, $P, BP, tQ, WP, VP, JP, _Q, QP, eI, xQ, Uc, DS, $a, wQ, OQ, kQ, PQ, IQ, DQ, LQ, MQ, NQ, UQ, FQ, zQ, $Q, HQ, jQ, BQ, KQ, GQ, WQ, VQ, qQ, ZQ, YQ, JQ, XQ, QQ, eee, tee, nee, ree, oee, see, iee, aee, lee, cee, uee, dee, pee, fee, mee, gee, hee, _ee, yee, See, Eee, bee, Cee, vee, Aee, Ree, xee, Tee, wee, Oee, kee, Pee, Iee, Dee, Lee, Mee, Nee, Uee, Fee, zee, $ee, Hee, jee, Bee, Kee, Gee, Wee, Vee, qee, Zee, Yee, Jee, Xee, Qee, ete, tte, nte, rte, ote, ste, ite, ate, lte, cte, ute, dte, pte, fte, mte, gte, hte, _te, yte, Ste, Ete, bte, Cte, vte, Ate, Rte, xte, Tte, wte, Ote, kte, Pte, Ite, Dte, Lte, Mte, Nte, Ute, Fte, zte, $te, Hte, jte, Bte, Kte, Gte, Wte, Vte, qte, Zte, Yte, Jte, Xte, Qte, ene, tne, nne, rne, one, sne, ine, ane, lne, cne, une, dne, pne, fne, mne, gne, hne, _ne, yne, Sne, Ene, bne, Cne, vne, Ane, Rne, xne, Tne, wne, One, kne, Pne, Ine, Dne, Lne, Mne, Nne, Une, Fne, zne, $ne, Hne, jne, Bne, Kne, Gne, Wne, Vne, qne, Zne, Yne, Jne, Xne, Qne, ere, tre, nre, rre, ore, sre, ire, are, lre, cre, ure, dre, pre, fre, mre, gre, hre, _re, yre, Sre, Ere, bre, Cre, vre, Are, Rre, xre, Tre, wre, Ore, kre, Pre, Ire, Dre, Lre, Mre, Nre, Ure, Fre, zre, $re, Hre, jre, Bre, Kre, Gre, Wre, Vre, qre, Zre, Yre, Jre, Xre, Qre, eoe, toe, noe, roe, ooe, soe, ioe, aoe, loe, coe, uoe, doe, poe, foe, moe, goe, hoe, _oe, yoe, Soe, Eoe, boe, Coe, voe, Aoe, Roe, xoe, Toe, woe, Ooe, koe, Poe, Ioe, Doe, Loe, Moe, Noe, Uoe, Foe, zoe, $oe, Hoe, joe, Boe, Koe, Goe, Woe, Voe, qoe, Zoe, Yoe, Joe, Xoe, Qoe, ese, tse, nse, rse, ose, sse, ise, ase, lse, cse, use, dse, pse, fse, mse, gse, hse, _se, yse, Sse, Ese, LS, bse, Cse, vse, Ase, Rse, xse, Tse, wse, Ose, kse, Pse, Ise, Dse, Lse, Mse, Nse, Use, Fse, zse, $se, Hse, jse, Bse, Kse, Gse, Wse, Vse, qse, Zse, Yse, Jse, Xse, Qse, eie, tie, nie, rie, oie, sie, iie, aie, lie, cie, uie, die, pie, fie, mie, gie, hie, _ie, yie, Sie, Eie, bie, Cie, vie, Aie, Rie, xie, Tie, wie, Oie, kie, Pie, Iie, Die, Lie, Mie, Nie, Uie, Fie, zie, $ie, Hie, jie, Bie, Kie, Gie, Wie, Vie, qie, Zie, Yie, Jie, Xie, Qie, eae, tae, nae, rae, oae, sae, iae, aae, lae, cae, uae, dae, pae, fae, mae, gae, hae, _ae, yae, Sae, Eae, bae, Cae, vae, Aae, Rae, xae, Tae, wae, Oae, kae, Pae, Iae, Dae, Lae, Mae, Nae, Uae, Fae, zae, $ae, Hae, jae, Bae, Kae, Gae, Wae, Vae, qae, Zae, Yae, Jae, Xae, Qae, ele, tle, nle, rle, ole, sle, ile, ale, lle, cle, ule, dle, ple, fle, mle, gle, hle, _le, yle, Sle, Ele, ble, Cle, vle, Ale, Rle, xle, Tle, wle, Ole, kle, Ple, Ile, Dle, Lle, Mle, Nle, Ule, Fle, zle, $le, Hle, jle, Ble, Kle, Gle, Wle, Vle, qle, Zle, Yle, Jle, MS, Xle, Qle, ece, tce, nce, rce, oce, sce, ice, ace, lce, cce, uce, dce, pce, fce, mce, gce, hce, _ce, yce, Sce, Ece, bce, Cce, vce, Ace, Rce, xce, Tce, wce, Oce, kce, Pce, Ice, Dce, Lce, Mce, Nce, Uce, Fce, zce, $ce, Hce, jce, Bce, Kce, Gce, Wce, Vce, qce, Zce, Yce, Jce, Xce, Qce, eue, tue, nue, rue, oue, sue, iue, aue, lue, cue, uue, due, pue, fue, mue, gue, hue, _ue, yue, Sue, Eue, bue, Cue, vue, Aue, Rue, xue, Tue, wue, Oue, kue, Pue, Iue, Due, Lue, Mue, Nue, Uue, Fue, zue, $ue, Hue, jue, Bue, Kue, Gue, Wue, Vue, que, Zue, Yue, Jue, Xue, Que, ede, tde, nde, rde, ode, sde, ide, ade, lde, cde, ude, dde, pde, fde, mde, gde, hde, _de, yde, Sde, Ede, bde, Cde, vde, Ade, Rde, xde, Tde, wde, Ode, kde, Pde, Ide, Dde, Lde, Mde, Nde, Ude, Fde, zde, $de, Hde, jde, Bde, Kde, Gde, Wde, Vde, qde, Zde, Yde, Jde, Xde, Qde, epe, tpe, npe, rpe, ope, spe, ipe, ape, lpe, cpe, upe, dpe, ppe, fpe, mpe, gpe, hpe, _pe, ype, Spe, Epe, bpe, Cpe, vpe, Ape, Rpe, xpe, Tpe, wpe, Ope, kpe, Ppe, Ipe, Dpe, Lpe, Mpe, Npe, Upe, Fpe, zpe, $pe, Hpe, jpe, Bpe, Kpe, Gpe, Wpe, Vpe, qpe, Zpe, Ype, Jpe, Xpe, Qpe, efe, tfe, nfe, rfe, ofe, sfe, ife, afe, lfe, cfe, ufe, dfe, pfe, ffe, mfe, gfe, hfe, _fe, yfe, Sfe, Efe, bfe, Cfe, vfe, Afe, Rfe, xfe, Tfe, wfe, Ofe, kfe, Pfe, Ife, Dfe, Lfe, Mfe, Nfe, Ufe, Ffe, zfe, $fe, Hfe, jfe, Bfe, Kfe, Gfe, Wfe, Vfe, qfe, Zfe, Yfe, Jfe, Xfe, Qfe, eme, tme, nme, rme, ome, sme, ime, ame, lme, cme, ume, dme, pme, fme, mme, gme, hme, _me, yme, Sme, Eme, bme, Cme, vme, Ame, Rme, xme, Tme, wme, Ome, kme, Pme, Ime, Dme, Lme, Mme, Nme, Ume, Fme, zme, $me, Hme, jme, Bme, Kme, Gme, Wme, Vme, qme, Zme, Yme, Jme, NS, Xme, Qme, ege, tge, nge, rge, oge, sge, ige, age, lge, cge, uge, dge, pge, fge, mge, gge, hge, _ge, yge, Sge, Ege, bge, Cge, vge, Age, Rge, xge, Tge, wge, Oge, kge, Pge, Ige, Dge, Lge, Mge, Nge, Uge, Fge, zge, $ge, Hge, US, jge, Bge, Kge, Gge, Wge, Vge, qge, Zge, Yge, Jge, Xge, Qge, ehe, the, nhe, rhe, ohe, she, ihe, ahe, lhe, che, uhe, dhe, phe, fhe, mhe, ghe, hhe, _he, yhe, She, Ehe, bhe, Che, vhe, Ahe, Rhe, xhe, The, whe, Ohe, khe, Phe, Ihe, Dhe, Lhe, Mhe, Nhe, FS, rI, oI, Uhe, Fhe, zhe, $he, Hhe, jhe, Bhe, Khe, Ghe, Whe, Vhe, qhe, Zhe, Yhe, Jhe, Xhe, Qhe, e_e, t_e, n_e, r_e, o_e, s_e, i_e, a_e, l_e, c_e, u_e, d_e, p_e, f_e, m_e, g_e, h_e, __e, y_e, S_e, E_e, b_e, C_e, v_e, A_e, R_e, x_e, T_e, w_e, O_e, k_e, P_e, I_e, D_e, L_e, M_e, N_e, U_e, F_e, z_e, $_e, H_e, j_e, B_e, K_e, G_e, W_e, V_e, q_e, Z_e, Y_e, J_e, Q_e, Xn, eye, F8e, tye, z8e, nye, iI, rye, oye, lI, cye, uye, dye, _ye, on, vye, Aye, dI, C7e, v7e, ho, kI, PI, Dye, Sf, Lye, jc, Mye, Nye, LI, NI, Fye, VS, zye, $ye, x7e, zI, YS, KI, GI, VI, Hye, qS, ls, Kye, Gye, oD, nE, sD, So, Yc, vn, Zye, oE, sE, iD, aD, wf, Jc, Xc, kf, Qc, Pf, eu, fi, tu, mi, lD, cD, uD, dD, pD, fD, mD, gD, hD, _D, yD, SD, ED, bD, vD, AD, cE, RD, Xye, TD, wD, OD, kD, PD, uE, ID, DD, LD, MD, FD, If, nu, zD, $D, HD, jD, BD, zt, dE, Df, pE, fE, KD, GD, WD, VD, qD, ru, ZD, YD, JD, XD, QD, eL, tL, mE, yr, He, rL, ou, Je, yE, SE, EE, fL, mL, tSe, bE, CE, vE, AE, RE, xE, TE, wE, gL, hL, _L, yL, OE, sSe, kE, PE, IE, DE, LE, ME, NE, Nf, UE, FE, zE, $E, HE, jE, BE, cSe, gE, KE, vL, Uf, GE, WE, VE, qE, ZE, YE, Ff, JE, XE, QE, eb, tb, nb, zf, AL, rb, ob, sb, TL, ab, RL, xL, $f, Hf, dSe, fSe, OL, kL, Sr, FL, ML, zL, lu, hSe, iC, aC, lC, HL, jL, cC, uC, BL, dC, KL, pC, GL, fC, mC, WL, VL, qL, ZL, gC, YL, hC, JL, XL, _C, yC, SC, EC, QL, sC, bC, CC, vC, AC, RC, xC, TC, wC, OC, tM, qf, kC, $L, rM, ASe, Fn, oM, sM, iM, aM, lM, cM, uM, dM, pM, fM, mM, gM, Be, SM, LC, ct, MC, EM, bM, CM, pEe, fEe, Yf, mEe, gEe, hEe, _Ee, yEe, SEe, EEe, bEe, CEe, vEe, AEe, REe, xEe, TEe, wEe, OEe, NC, kEe, vM, PEe, IEe, DEe, LEe, MEe, fu, AM, NEe, UEe, IC, DC, FEe, zEe, qa, TM, HEe, jEe, KEe, wM, em, mu, qEe, ZEe, JEe, OM, Qn, kM, LM, nbe, rbe, abe, lbe, cbe, rm, pbe, At, hbe, BC, BM, Zet, WM, VM, qM, ZM, Cbe, vbe, YM, Abe, Rbe, JM, xbe, Tbe, QM, Ibe, eN, Lbe, nN, Mbe, Nbe, sm, rN, iN, Fbe, aN, $be, jbe, Kbe, Gbe, yu, lN, uN, dN, Xbe, KM, Qbe, eCe, tCe, oCe, iCe, _N, yN, wN, Ytt, ON, OCe, DCe, LN, $Ce, HCe, Cu, BCe, MN, VCe, QCe, ive, uve, VN, pve, fve, _rt, gve, Sve, nv, tv, GN, tU, Fve, Hve, iU, tAe, sAe, iAe, aAe, cAe, Ie, bU, Q, vo, F, zn, fAe, ms, mAe, _m, nn, he, Xa, an, lv, cv, Si, wu, se, br, CU, Oe, gAe, hAe, _Ae, yAe, SAe, EAe, bAe, CAe, vAe, uv, AAe, RAe, xAe, TAe, wAe, OAe, vU, kAe, Ro, el, tl, ym, ku, Sm, Pu, Iu, Em, Ei, xo, bm, Fr, ft, Du, Ao, pv, Lu, To, Cm, vm, nl, Ou, Mu, Nu, bi, Uu, rl, $r, zr, gs, Fu, zu, Am, fv, Rm, $u, wot, H, Oot, kot, Pot, Iot, Dot, Lot, Mot, Not, Uot, Fot, zot, $ot, Hot, jot, xU, Bot, Kot, Got, Wot, Vot, qot, Zot, Yot, Jot, Xot, Qot, est, tst, nst, rst, ost, sst, ist, ast, FAe, zAe, gv, OU, Ss, km, Mt, kU, PU, kst, HAe, jAe, hv, $n, Hu, IU, Yt, tr, nr, Jt, Pm, DU, _v, LU, MU, yv, ju, le, Sv, NU, Pst, Ist, Im, BAe, Dm, KAe, Bu, ol, UU, GAe, WAe, VAe, qAe, ZAe, YAe, Ev, JAe, XAe, bv, Lm, QAe, eRe, Mm, tRe, Ku, Gu, nRe, Wu, sl, rRe, Vu, Nm, Um, Fm, Dst, zm, $m, Hm, FU, zU, $U, Cv, HU, qu, il, jU, oRe, jm, sRe, Bm, iRe, vv, aRe, Km, lRe, cRe, uRe, dRe, pRe, fRe, mRe, gRe, hRe, _Re, Gm, yRe, SRe, Wm, Av, Rv, xv, ERe, bRe, CRe, Tv, vRe, ARe, RRe, xRe, TRe, BU, Vm, wRe, qm, Lst, ORe, al, kRe, Mst, Zu, PRe, wv, IRe, DRe, LRe, MRe, NRe, URe, FRe, Om, zRe, $Re, HRe, Yu, Ov, jRe, BRe, KRe, GRe, WRe, VRe, qRe, ZRe, YRe, JRe, XRe, QRe, exe, txe, nxe, rxe, oxe, sxe, ll, ixe, axe, lxe, Zm, cxe, uxe, dxe, kv, pxe, Nst, Ust, Fst, zst, $st, Hst, ae, WU, qU, VU, ZU, YU, Ym, e0, fxe, mxe, Dv, Cr, gxe, Ju, d0, h0, _0, v0, A0, Sxe, Exe, Mv, Cxe, Fv, Oj, kj, PA, IA, DA, Lj, Dj, aLe, NA, FA, uLe, dd, fLe, Po, SLe, ELe, zA, bLe, xLe, TLe, wLe, OLe, kLe, $j, qj, ILe, DLe, LLe, MLe, Ce, NLe, Wg, Oi, VA, Do, Jj, Xj, Qj, eB, tB, nB, qA, ZA, jA, Bj, jLe, BLe, GLe, rB, BA, Gg, GA, WA, VLe, qLe, Kj, Hs, sB, QLe, YA, iB, uB, eMe, dB, pB, fB, mB, tMe, XA, aB, QA, gB, hB, _B, yB, jn, lMe, SB, dMe, bB, mMe, fd, RB, hMe, Rr, TB, SMe, EMe, Pl, wB, Vg, AMe, Il, RMe, xMe, qg, OB, wMe, OMe, kB, eo, Dl, Zg, DB, NMe, FB, WMe, VMe, $B, HB, jB, BB, Ml, GB, nR, WB, Jg, KB, eNe, Bs, VB, gd, Nl, Xg, tNe, YB, qB, Pi, rK, iK, pNe, hd, _d, to, yd, nh, uK, aK, _Ne, lK, cK, Sd, Ul, rh, oh, dK, CNe, pK, sh, fK, RNe, xNe, TNe, mK, wNe, ONe, ih, Ed, lr, gK, hK, yK, SK, EK, ah, bK, FNe, CK, zNe, $Ne, HNe, vK, BNe, lh, AK, RK, xK, VNe, dn, TK, wK, OK, kK, PK, QNe, eUe, IK, DK, rUe, LK, MK, NK, UK, iUe, aUe, lUe, cUe, uUe, dUe, pUe, fUe, mUe, gUe, hUe, _Ue, yUe, SUe, EUe, bUe, CUe, vUe, AUe, FK, xUe, zK, $K, wUe, HK, OUe, jK, BK, PUe, KK, IUe, DUe, LUe, GK, MUe, NUe, UUe, FUe, WK, zUe, $Ue, HUe, VK, jUe, BUe, KUe, GUe, WUe, VUe, qUe, ZUe, YUe, JUe, XUe, QUe, e0e, t0e, n0e, r0e, Xe, qK, ZK, YK, JK, a0e, l0e, uh, XK, QK, e1, n1, r1, dh, m0e, g0e, h0e, _0e, bd, o1, S0e, Fl, s1, b0e, i1, Di, a1, l1, c1, u1, d1, p1, f1, P0e, I0e, m1, D0e, g1, h1, _1, vyt, U0e, y1, Ayt, iR, F0e, z0e, $0e, Gs, zl, fh, E1, b1, H0e, j0e, B0e, K0e, mh, $l, gh, Ws, aR, hh, _h, G0e, W0e, lR, R1, x1, V0e, uR, k1, P1, I1, D1, L1, Y0e, dR, J0e, Fyt, pR, X0e, fR, mR, Q0e, zyt, eFe, gR, hR, _R, $yt, M1, yR, N1, U1, tFe, nFe, rFe, oFe, iFe, Mi, cFe, $1, Wyt, Vyt, H1, j1, B1, K1, uFe, G1, W1, V1, q1, dFe, pFe, SR, fFe, eSt, tSt, mFe, jl, Vs, gFe, Y1, hFe, _Fe, X1, Q1, eG, yFe, SFe, tG, EFe, bFe, CFe, vFe, bR, CR, RFe, xFe, vR, TFe, Eh, nSt, Cd, wFe, OFe, aSt, rG, PFe, IFe, _St, oG, sG, bSt, CSt, HFe, jFe, $St, BFe, KFe, HSt, JSt, XSt, lG, OR, VFe, YFe, uG, eze, nze, gG, vd, vh, kR, zi, sze, yG, ize, yEt, Ad, $i, bG, Kn, AEt, REt, xEt, aze, AG, wG, $R, dze, $G, pze, fze, mze, gze, hze, BR, HG, jG, fbt, yze, Sze, Eze, Gn, ji, kG, PG, NR, UR, KR, GG, Cze, vze, Rze, GR, xze, Tze, xh, WR, Oze, kze, mbt, Pze, Ize, Dze, Lze, Mze, Nze, qG, Uze, Fze, zze, $ze, ZG, Hze, IG, jze, Bze, YG, Kze, Gze, DG, Wze, Vze, JG, qze, Zze, Yze, Jze, QG, Xze, Qze, e$e, t$e, r$e, o$e, s$e, i$e, a$e, eW, nW, c$e, m$e, xd, VR, gbt, hbt, _bt, h$e, qR, Th, MR, aW, _$e, S$e, lW, E$e, b$e, C$e, v$e, A$e, x$e, w$e, O$e, k$e, P$e, I$e, N$e, ybt, FR, Sbt, U$e, MG, Td, Ebt, bbt, uW, z$e, $$e, H$e, Cbt, j$e, B$e, vbt, Abt, K$e, Rbt, Oh, kh, G$e, YR, Ph, W$e, Ih, Mbt, Nbt, Ubt, Dh, V$e, Z$e, tx, EW, Id, Fh, X$e, xCt, Q$e, eHe, ix, ax, lx, cx, zh, $h, MW, tHe, nHe, aHe, uHe, dHe, Zs, pHe, CW, vW, AW, Nh, UW, fHe, mHe, gHe, hHe, _He, yHe, SHe, EHe, pn, dx, nx, Mh, Bi, AHe, TCt, xHe, Pd, RW, THe, xW, wHe, OHe, Hh, kHe, TW, fx, Bh, Ki, KW, Gl, PHe, Kh, kW, Wl, NHe, Ld, UHe, tV, rV, jHe, XHe, cvt, tje, fV, mV, sje, aje, _V, yV, pje, zvt, $vt, gje, yje, Sje, Kvt, Gvt, eAt, RV, Eje, bje, mAt, Cje, gAt, xV, wV, OV, Js, Lje, FV, Yh, Jh, Md, Tx, zV, $V, HV, Xh, jV, cr, KV, Mo, Fje, zje, yRt, jje, Gje, Vje, sBe, YV, e22, o_, gBe, t2, s_, kx, o2, LBe, UBe, $x, Vi, R2, KBe, GBe, Dx, ZBe, k2, n_, l2, sKe, lKe, z2, bKe, RKe, ec, W2, H2, xKe, wKe, PKe, IKe, $Ke, X2, HKe, jKe, BKe, KKe, VKe, eTt, qKe, tTt, nTt, ZKe, rTt, YKe, oTt, JKe, Wx, XKe, iTt, eq, tq, QKe, nq, rq, e1e, t1e, oq, sq, n1e, r1e, aTt, lTt, c1e, Zx, cq, u1e, uq, a_, d1e, Xx, nc, S1e, c_, mq, gq, Qx, hq, _q, E1e, Sq, u_, rc, d_, b1e, bq, Uo, Cq, vq, A1e, Yd, Jd, R1e, x1e, Aq, gn, T1e, w1e, O1e, Xs, k1e, P1e, xq, Pwt, I1e, Oq, kq, Pq, D1e, L1e, Iq, M1e, N1e, nT, U1e, p_, rT, Dq, oT, iT, F1e, Uq, aT, jq, K1e, Gq, yOt, sGe, cGe, uGe, yGe;
|
|
81557
|
+
var import_node_module, import_crypto, import_crypto2, import_path, import_node_fs16, import_node_process4, import_fs, import_os, import_path2, yy, import_fs2, import_promises, import_path3, import_readline, import_promises2, import_path4, import_os2, import_path5, Se, import_promises3, xe, import_promises4, import_fs3, import_promises5, import_os3, import_path6, import_promises6, import_os4, import_node_path46, import_node_os10, import_node_process5, import_path7, import_events, import_fs4, import_promises7, import_path8, import_child_process, import_util9, import_child_process2, import_fs5, import_path9, import_path10, import_crypto3, import_fs6, import_path11, import_promises8, import_path12, import_path13, import_promises9, import_path14, import_path15, import_fs7, import_promises10, import_path16, import_crypto4, import_path17, import_async_hooks, import_fs8, import_promises11, import_crypto5, import_fs9, import_promises12, import_path18, import_promises13, import_path19, import_crypto6, import_path20, import_path21, import_path22, import_path23, import_promises14, import_fs10, import_promises15, import_path24, import_util10, import_path25, import_os5, import_path26, import_path27, import_path28, import_path29, import_path30, import_net, import_os6, import_child_process3, import_fs11, import_child_process4, import_crypto7, import_promises16, import_module, import_os7, import_path31, import_url, import_events2, import_child_process5, import_fs12, import_readline2, import_string_decoder, import_fs13, import_promises17, import_os8, import_path32, import_crypto8, import_os9, import_fs14, import_path33, import_crypto9, import_fs15, import_promises18, import_path34, IZ, DZ, v_, LZ, OT, NZ, UZ, kT, X, FZ, dr, HZ, jZ, BZ, ot, st, ed, Kv, Te, Me, Oo, nd, hF, Xv, Qv, rd, LF, or, WF, ZF, sA, XF, od, sd, hg, id, Sg, Oz, fA, $z, Wz, Zz, s$, a$, d$, f$, g$, _$, E$, v$, T$, O$, I$, L$, wg, z$, j$, G$, V$, yA, SA, rH, lH, uH, _H, EH, EA, RH, TH, kH, DH, NH, zH, jH, GH, VH, ZH, JH, ej, nj, ij, cj, uj, CA, bj, Aj, wj, PT, KZ, GZ, VGe, VZ, MT, wr, jo, JZ, XZ, NT, UT, FT, zT, Bo, $T, HT, jT, BT, a4, sp, l4, c4, vt, u4, Nt, KT, d4, p4, uc, GT, m4, g4, WT, _4, y4, VT, Dn, Et, b4, C4, v4, A4, ra, x4, ip, qT, ZT, w4, O4, ro, P4, I4, D4, L4, M4, N4, U4, YT, JT, Sn, H4, Ko, j4, oo, XT, QT, G4, W4, V4, ew, Z4, Y4, tw, X4, nw, R_, rw, ow, Go, sw, iw, aw, lw, ei, aY, cw, Or, cY, uw, dw, lp, pw, cp, mY, gY, up, _Y, aa, fw, la, EY, bY, CY, vY, AY, RY, xY, TY, wY, OY, kY, PY, IY, mw, x_, gw, ca, MY, et, dp, hw, pp, zY, $Y, _w, HY, ua, yw, wt, KY, T_, Sw, WY, VY, qY, so, mp, Ew, vw, bw, YY, Cw, JY, XY, kr, QY, e9, Wo, n9, da, o9, s9, i9, a9, l9, c9, u9, d9, p9, f9, m9, g9, h9, _9, y9, S9, E9, b9, C9, v9, A9, R9, x9, T9, Qe, Aw, pa, hp, Rw, dc, k9, w_, P9, Pr, xw, I9, fa, D9, L9, _p, N9, ma, yp, z9, Tw, $9, H9, ww, Vo, Ir, pc, W9, V9, q9, Ow, Y9, Sp, J9, Ep, X9, qo, Q9, bp, kw, eJ, Pw, Iw, Dw, Lw, tJ, nJ, rJ, oJ, sJ, ti, io, iJ, Mw, Nw, Cp, aJ, Uw, Fw, ga, pr, uJ, Fe, $w, O_, k_, I_, ha, Bw, D_, qw, Vw, N_, U_, yJ, _a3, Yo, Zw, bJ, Rp, Yw, vJ, AJ, Jw, xp, Xw, Tp, Qw, kJ, ya, IJ, DJ, Sa, MJ, fc, NJ, eO, FJ, zJ, $J, tO, Ea, jJ, nO, rO, sO, iO, Vn, GJ, Ln, Jo, aO, lO, cO, wp, XJ, QJ, uO, ba, dO, pO, fO, Dr, ao, mO, Ca, gO, z_, $_, H_, j_, B_, K_, G_, W_, V_, q_, Z_, _O, Y_, J_, yO, X_, c3, Q_, ey, ty, ny, ry, oy, sy, iy, ay, ly, cy, we, SO, en, d3, Pp, vO, g3, gy, wO, S3, BO, KO, Ip, Dp, v3, GO, WO, F9e, IO, A3, hy, x3, NO, I3, Ay, Ry, D3, xy, L3, bc, xa, Ty, wy, Oy, ky, XO, Py, Iy, Dy, Ly, My, Ny, Uy, Fy, zy, nk, rk, d3e, p3e, f3e, m3e, g3e, U3, jp, jy, ik, By, Ky, lk, $3, uk, ck, G3, W3, V3, it, Y3, J3, hk, tXe, Q3, kt, We, gX, Ta, SX, mr, Yp, Jp, eS, nS, yXe, IX, DX, rS, ka, oS, Ok, kk, HX, jX, ef, bXe, Uk, Mr, wc, Fk, Pa, OXe, kXe, iS, PXe, IXe, DXe, GX, YX, JX, XX, QX, e6, t6, Yk, n6, r6, o6, s6, i6, a6, l6, c6, Vk, uS, lf, dS, Qk, eP, uf, os10, qXe, ZXe, h6, tP, df, _6, y6, S6, E6, b6, Jn, gr, nP, rP, Dc, pS, oP, gS, lP, C6, mS, lS, sP, w6, O6, dP, k6, YXe, JXe, P6, I6, pf, L6, fP, XXe, QXe, M6, SS, z6, $6, j6, bP, CP, G6, Lc, si, Z6, ES, bS, X6, Q6, e5, t5, n5, u5, r5, o5, s5, i5, a5, l5, c5, u52, d5, p5, f5, m5, g5, h5, _5, y5, S5, E5, b5, C5, v5, A5, R5, x5, T5, w5, O5, k5, P5, I5, D5, L5, M5, N5, U5, F5, z5, $5, H5, j5, B5, K5, G5, W5, V5, q5, Z5, Y5, J5, X5, Q5, e8, t8, n8, r8, o8, s8, i8, a8, l8, c8, u8, d8, CS, p8, f8, m8, g8, h8, _8, y8, S8, E8, b8, C8, v8, A8, R8, x8, T8, w8, O8, k8, P8, I8, D8, L8, M8, N8, U8, F8, z8, $8, H8, j8, B8, K8, G8, W8, V8, q8, Z8, Y8, J8, X8, Q8, e7, t7, n7, r7, o7, s7, i7, a7, l7, c7, u7, d7, p7, f7, m7, g7, h7, _7, y7, S7, E7, b7, C7, TP, v7, L6e, RP, A7, x7, kP, ff, U6e, F6e, Ua, z6e, $6e, H6e, j6e, PP, IP, vS, DP, w7, LP, O7, k7, P7, AS, RS, xS, I7, MP, NP, D7, G6e, L7, W6e, M7, N7, UP, V6e, U7, F7, z7, $7, H7, j7, B7, q6e, is, wS, Fa, K7, G7, W7, i5e, X7, Q7, HP, $P, BP, tQ, WP, VP, JP, _Q, QP, eI, xQ, Uc, DS, $a, wQ, OQ, kQ, PQ, IQ, DQ, LQ, MQ, NQ, UQ, FQ, zQ, $Q, HQ, jQ, BQ, KQ, GQ, WQ, VQ, qQ, ZQ, YQ, JQ, XQ, QQ, eee, tee, nee, ree, oee, see, iee, aee, lee, cee, uee, dee, pee, fee, mee, gee, hee, _ee, yee, See, Eee, bee, Cee, vee, Aee, Ree, xee, Tee, wee, Oee, kee, Pee, Iee, Dee, Lee, Mee, Nee, Uee, Fee, zee, $ee, Hee, jee, Bee, Kee, Gee, Wee, Vee, qee, Zee, Yee, Jee, Xee, Qee, ete, tte, nte, rte, ote, ste, ite, ate, lte, cte, ute, dte, pte, fte, mte, gte, hte, _te, yte, Ste, Ete, bte, Cte, vte, Ate, Rte, xte, Tte, wte, Ote, kte, Pte, Ite, Dte, Lte, Mte, Nte, Ute, Fte, zte, $te, Hte, jte, Bte, Kte, Gte, Wte, Vte, qte, Zte, Yte, Jte, Xte, Qte, ene, tne, nne, rne, one, sne, ine, ane, lne, cne, une, dne, pne, fne, mne, gne, hne, _ne, yne, Sne, Ene, bne, Cne, vne, Ane, Rne, xne, Tne, wne, One, kne, Pne, Ine, Dne, Lne, Mne, Nne, Une, Fne, zne, $ne, Hne, jne, Bne, Kne, Gne, Wne, Vne, qne, Zne, Yne, Jne, Xne, Qne, ere, tre, nre, rre, ore, sre, ire, are, lre, cre, ure, dre, pre, fre, mre, gre, hre, _re, yre, Sre, Ere, bre, Cre, vre, Are, Rre, xre, Tre, wre, Ore, kre, Pre, Ire, Dre, Lre, Mre, Nre, Ure, Fre, zre, $re, Hre, jre, Bre, Kre, Gre, Wre, Vre, qre, Zre, Yre, Jre, Xre, Qre, eoe, toe, noe, roe, ooe, soe, ioe, aoe, loe, coe, uoe, doe, poe, foe, moe, goe, hoe, _oe, yoe, Soe, Eoe, boe, Coe, voe, Aoe, Roe, xoe, Toe, woe, Ooe, koe, Poe, Ioe, Doe, Loe, Moe, Noe, Uoe, Foe, zoe, $oe, Hoe, joe, Boe, Koe, Goe, Woe, Voe, qoe, Zoe, Yoe, Joe, Xoe, Qoe, ese, tse, nse, rse, ose, sse, ise, ase, lse, cse, use, dse, pse, fse, mse, gse, hse, _se, yse, Sse, Ese, LS, bse, Cse, vse, Ase, Rse, xse, Tse, wse, Ose, kse, Pse, Ise, Dse, Lse, Mse, Nse, Use, Fse, zse, $se, Hse, jse, Bse, Kse, Gse, Wse, Vse, qse, Zse, Yse, Jse, Xse, Qse, eie, tie, nie, rie, oie, sie, iie, aie, lie, cie, uie, die, pie, fie, mie, gie, hie, _ie, yie, Sie, Eie, bie, Cie, vie, Aie, Rie, xie, Tie, wie, Oie, kie, Pie, Iie, Die, Lie, Mie, Nie, Uie, Fie, zie, $ie, Hie, jie, Bie, Kie, Gie, Wie, Vie, qie, Zie, Yie, Jie, Xie, Qie, eae, tae, nae, rae, oae, sae, iae, aae, lae, cae, uae, dae, pae, fae, mae, gae, hae, _ae, yae, Sae, Eae, bae, Cae, vae, Aae, Rae, xae, Tae, wae, Oae, kae, Pae, Iae, Dae, Lae, Mae, Nae, Uae, Fae, zae, $ae, Hae, jae, Bae, Kae, Gae, Wae, Vae, qae, Zae, Yae, Jae, Xae, Qae, ele, tle, nle, rle, ole, sle, ile, ale, lle, cle, ule, dle, ple, fle, mle, gle, hle, _le, yle, Sle, Ele, ble, Cle, vle, Ale, Rle, xle, Tle, wle, Ole, kle, Ple, Ile, Dle, Lle, Mle, Nle, Ule, Fle, zle, $le, Hle, jle, Ble, Kle, Gle, Wle, Vle, qle, Zle, Yle, Jle, MS, Xle, Qle, ece, tce, nce, rce, oce, sce, ice, ace, lce, cce, uce, dce, pce, fce, mce, gce, hce, _ce, yce, Sce, Ece, bce, Cce, vce, Ace, Rce, xce, Tce, wce, Oce, kce, Pce, Ice, Dce, Lce, Mce, Nce, Uce, Fce, zce, $ce, Hce, jce, Bce, Kce, Gce, Wce, Vce, qce, Zce, Yce, Jce, Xce, Qce, eue, tue, nue, rue, oue, sue, iue, aue, lue, cue, uue, due, pue, fue, mue, gue, hue, _ue, yue, Sue, Eue, bue, Cue, vue, Aue, Rue, xue, Tue, wue, Oue, kue, Pue, Iue, Due, Lue, Mue, Nue, Uue, Fue, zue, $ue, Hue, jue, Bue, Kue, Gue, Wue, Vue, que, Zue, Yue, Jue, Xue, Que, ede, tde, nde, rde, ode, sde, ide, ade, lde, cde, ude, dde, pde, fde, mde, gde, hde, _de, yde, Sde, Ede, bde, Cde, vde, Ade, Rde, xde, Tde, wde, Ode, kde, Pde, Ide, Dde, Lde, Mde, Nde, Ude, Fde, zde, $de, Hde, jde, Bde, Kde, Gde, Wde, Vde, qde, Zde, Yde, Jde, Xde, Qde, epe, tpe, npe, rpe, ope, spe, ipe, ape, lpe, cpe, upe, dpe, ppe, fpe, mpe, gpe, hpe, _pe, ype, Spe, Epe, bpe, Cpe, vpe, Ape, Rpe, xpe, Tpe, wpe, Ope, kpe, Ppe, Ipe, Dpe, Lpe, Mpe, Npe, Upe, Fpe, zpe, $pe, Hpe, jpe, Bpe, Kpe, Gpe, Wpe, Vpe, qpe, Zpe, Ype, Jpe, Xpe, Qpe, efe, tfe, nfe, rfe, ofe, sfe, ife, afe, lfe, cfe, ufe, dfe, pfe, ffe, mfe, gfe, hfe, _fe, yfe, Sfe, Efe, bfe, Cfe, vfe, Afe, Rfe, xfe, Tfe, wfe, Ofe, kfe, Pfe, Ife, Dfe, Lfe, Mfe, Nfe, Ufe, Ffe, zfe, $fe, Hfe, jfe, Bfe, Kfe, Gfe, Wfe, Vfe, qfe, Zfe, Yfe, Jfe, Xfe, Qfe, eme, tme, nme, rme, ome, sme, ime, ame, lme, cme, ume, dme, pme, fme, mme, gme, hme, _me, yme, Sme, Eme, bme, Cme, vme, Ame, Rme, xme, Tme, wme, Ome, kme, Pme, Ime, Dme, Lme, Mme, Nme, Ume, Fme, zme, $me, Hme, jme, Bme, Kme, Gme, Wme, Vme, qme, Zme, Yme, Jme, NS, Xme, Qme, ege, tge, nge, rge, oge, sge, ige, age, lge, cge, uge, dge, pge, fge, mge, gge, hge, _ge, yge, Sge, Ege, bge, Cge, vge, Age, Rge, xge, Tge, wge, Oge, kge, Pge, Ige, Dge, Lge, Mge, Nge, Uge, Fge, zge, $ge, Hge, US, jge, Bge, Kge, Gge, Wge, Vge, qge, Zge, Yge, Jge, Xge, Qge, ehe, the, nhe, rhe, ohe, she, ihe, ahe, lhe, che, uhe, dhe, phe, fhe, mhe, ghe, hhe, _he, yhe, She, Ehe, bhe, Che, vhe, Ahe, Rhe, xhe, The, whe, Ohe, khe, Phe, Ihe, Dhe, Lhe, Mhe, Nhe, FS, rI, oI, Uhe, Fhe, zhe, $he, Hhe, jhe, Bhe, Khe, Ghe, Whe, Vhe, qhe, Zhe, Yhe, Jhe, Xhe, Qhe, e_e, t_e, n_e, r_e, o_e, s_e, i_e, a_e, l_e, c_e, u_e, d_e, p_e, f_e, m_e, g_e, h_e, __e, y_e, S_e, E_e, b_e, C_e, v_e, A_e, R_e, x_e, T_e, w_e, O_e, k_e, P_e, I_e, D_e, L_e, M_e, N_e, U_e, F_e, z_e, $_e, H_e, j_e, B_e, K_e, G_e, W_e, V_e, q_e, Z_e, Y_e, J_e, Q_e, Xn, eye, F8e, tye, z8e, nye, iI, rye, oye, lI, cye, uye, dye, _ye, on, vye, Aye, dI, C7e, v7e, ho, kI, PI, Dye, Sf, Lye, jc, Mye, Nye, LI, NI, Fye, VS, zye, $ye, x7e, zI, YS, KI, GI, VI, Hye, qS, ls, Kye, Gye, oD, nE, sD, So, Yc, vn, Zye, oE, sE, iD, aD, wf, Jc, Xc, kf, Qc, Pf, eu, fi, tu, mi, lD, cD, uD, dD, pD, fD, mD, gD, hD, _D, yD, SD, ED, bD, vD, AD, cE, RD, Xye, TD, wD, OD, kD, PD, uE, ID, DD, LD, MD, FD, If, nu, zD, $D, HD, jD, BD, zt, dE, Df, pE, fE, KD, GD, WD, VD, qD, ru, ZD, YD, JD, XD, QD, eL, tL, mE, yr, He, rL, ou, Je, yE, SE, EE, fL, mL, tSe, bE, CE, vE, AE, RE, xE, TE, wE, gL, hL, _L, yL, OE, sSe, kE, PE, IE, DE, LE, ME, NE, Nf, UE, FE, zE, $E, HE, jE, BE, cSe, gE, KE, vL, Uf, GE, WE, VE, qE, ZE, YE, Ff, JE, XE, QE, eb, tb, nb, zf, AL, rb, ob, sb, TL, ab, RL, xL, $f, Hf, dSe, fSe, OL, kL, Sr, FL, ML, zL, lu, hSe, iC, aC, lC, HL, jL, cC, uC, BL, dC, KL, pC, GL, fC, mC, WL, VL, qL, ZL, gC, YL, hC, JL, XL, _C, yC, SC, EC, QL, sC, bC, CC, vC, AC, RC, xC, TC, wC, OC, tM, qf, kC, $L, rM, ASe, Fn, oM, sM, iM, aM, lM, cM, uM, dM, pM, fM, mM, gM, Be, SM, LC, ct, MC, EM, bM, CM, pEe, fEe, Yf, mEe, gEe, hEe, _Ee, yEe, SEe, EEe, bEe, CEe, vEe, AEe, REe, xEe, TEe, wEe, OEe, NC, kEe, vM, PEe, IEe, DEe, LEe, MEe, fu, AM, NEe, UEe, IC, DC, FEe, zEe, qa, TM, HEe, jEe, KEe, wM, em, mu, qEe, ZEe, JEe, OM, Qn, kM, LM, nbe, rbe, abe, lbe, cbe, rm, pbe, At, hbe, BC, BM, Zet, WM, VM, qM, ZM, Cbe, vbe, YM, Abe, Rbe, JM, xbe, Tbe, QM, Ibe, eN, Lbe, nN, Mbe, Nbe, sm, rN, iN, Fbe, aN, $be, jbe, Kbe, Gbe, yu, lN, uN, dN, Xbe, KM, Qbe, eCe, tCe, oCe, iCe, _N, yN, wN, Ytt, ON, OCe, DCe, LN, $Ce, HCe, Cu, BCe, MN, VCe, QCe, ive, uve, VN, pve, fve, _rt, gve, Sve, nv, tv, GN, tU, Fve, Hve, iU, tAe, sAe, iAe, aAe, cAe, Ie, bU, Q, vo, F, zn, fAe, ms, mAe, _m, nn, he, Xa, an, lv, cv, Si, wu, se, br, CU, Oe, gAe, hAe, _Ae, yAe, SAe, EAe, bAe, CAe, vAe, uv, AAe, RAe, xAe, TAe, wAe, OAe, vU, kAe, Ro, el, tl, ym, ku, Sm, Pu, Iu, Em, Ei, xo, bm, Fr, ft, Du, Ao, pv, Lu, To, Cm, vm, nl, Ou, Mu, Nu, bi, Uu, rl, $r, zr, gs, Fu, zu, Am, fv, Rm, $u, wot, H, Oot, kot, Pot, Iot, Dot, Lot, Mot, Not, Uot, Fot, zot, $ot, Hot, jot, xU, Bot, Kot, Got, Wot, Vot, qot, Zot, Yot, Jot, Xot, Qot, est, tst, nst, rst, ost, sst, ist, ast, FAe, zAe, gv, OU, Ss, km, Mt, kU, PU, kst, HAe, jAe, hv, $n, Hu, IU, Yt, tr, nr, Jt, Pm, DU, _v, LU, MU, yv, ju, le, Sv, NU, Pst, Ist, Im, BAe, Dm, KAe, Bu, ol, UU, GAe, WAe, VAe, qAe, ZAe, YAe, Ev, JAe, XAe, bv, Lm, QAe, eRe, Mm, tRe, Ku, Gu, nRe, Wu, sl, rRe, Vu, Nm, Um, Fm, Dst, zm, $m, Hm, FU, zU, $U, Cv, HU, qu, il, jU, oRe, jm, sRe, Bm, iRe, vv, aRe, Km, lRe, cRe, uRe, dRe, pRe, fRe, mRe, gRe, hRe, _Re, Gm, yRe, SRe, Wm, Av, Rv, xv, ERe, bRe, CRe, Tv, vRe, ARe, RRe, xRe, TRe, BU, Vm, wRe, qm, Lst, ORe, al, kRe, Mst, Zu, PRe, wv, IRe, DRe, LRe, MRe, NRe, URe, FRe, Om, zRe, $Re, HRe, Yu, Ov, jRe, BRe, KRe, GRe, WRe, VRe, qRe, ZRe, YRe, JRe, XRe, QRe, exe, txe, nxe, rxe, oxe, sxe, ll, ixe, axe, lxe, Zm, cxe, uxe, dxe, kv, pxe, Nst, Ust, Fst, zst, $st, Hst, ae, WU, qU, VU, ZU, YU, Ym, e0, fxe, mxe, Dv, Cr, gxe, Ju, d0, h0, _0, v0, A0, Sxe, Exe, Mv, Cxe, Fv, Oj, kj, PA, IA, DA, Lj, Dj, aLe, NA, FA, uLe, dd, fLe, Po, SLe, ELe, zA, bLe, xLe, TLe, wLe, OLe, kLe, $j, qj, ILe, DLe, LLe, MLe, Ce, NLe, Wg, Oi, VA, Do, Jj, Xj, Qj, eB, tB, nB, qA, ZA, jA, Bj, jLe, BLe, GLe, rB, BA, Gg, GA, WA, VLe, qLe, Kj, Hs, sB, QLe, YA, iB, uB, eMe, dB, pB, fB, mB, tMe, XA, aB, QA, gB, hB, _B, yB, jn, lMe, SB, dMe, bB, mMe, fd, RB, hMe, Rr, TB, SMe, EMe, Pl, wB, Vg, AMe, Il, RMe, xMe, qg, OB, wMe, OMe, kB, eo, Dl, Zg, DB, NMe, FB, WMe, VMe, $B, HB, jB, BB, Ml, GB, nR, WB, Jg, KB, eNe, Bs, VB, gd, Nl, Xg, tNe, YB, qB, Pi, rK, iK, pNe, hd, _d, to, yd, nh, uK, aK, _Ne, lK, cK, Sd, Ul, rh, oh, dK, CNe, pK, sh, fK, RNe, xNe, TNe, mK, wNe, ONe, ih, Ed, lr, gK, hK, yK, SK, EK, ah, bK, FNe, CK, zNe, $Ne, HNe, vK, BNe, lh, AK, RK, xK, VNe, dn, TK, wK, OK, kK, PK, QNe, eUe, IK, DK, rUe, LK, MK, NK, UK, iUe, aUe, lUe, cUe, uUe, dUe, pUe, fUe, mUe, gUe, hUe, _Ue, yUe, SUe, EUe, bUe, CUe, vUe, AUe, FK, xUe, zK, $K, wUe, HK, OUe, jK, BK, PUe, KK, IUe, DUe, LUe, GK, MUe, NUe, UUe, FUe, WK, zUe, $Ue, HUe, VK, jUe, BUe, KUe, GUe, WUe, VUe, qUe, ZUe, YUe, JUe, XUe, QUe, e0e, t0e, n0e, r0e, Xe, qK, ZK, YK, JK, a0e, l0e, uh, XK, QK, e1, n1, r1, dh, m0e, g0e, h0e, _0e, bd, o1, S0e, Fl, s1, b0e, i1, Di, a1, l1, c1, u1, d1, p1, f1, P0e, I0e, m1, D0e, g1, h1, _1, vyt, U0e, y1, Ayt, iR, F0e, z0e, $0e, Gs, zl, fh, E1, b1, H0e, j0e, B0e, K0e, mh, $l, gh, Ws, aR, hh, _h, G0e, W0e, lR, R1, x1, V0e, uR, k1, P1, I1, D1, L1, Y0e, dR, J0e, Fyt, pR, X0e, fR, mR, Q0e, zyt, eFe, gR, hR, _R, $yt, M1, yR, N1, U1, tFe, nFe, rFe, oFe, iFe, Mi, cFe, $1, Wyt, Vyt, H1, j1, B1, K1, uFe, G1, W1, V1, q1, dFe, pFe, SR, fFe, eSt, tSt, mFe, jl, Vs, gFe, Y1, hFe, _Fe, X1, Q1, eG, yFe, SFe, tG, EFe, bFe, CFe, vFe, bR, CR, RFe, xFe, vR, TFe, Eh, nSt, Cd, wFe, OFe, aSt, rG, PFe, IFe, _St, oG, sG, bSt, CSt, HFe, jFe, $St, BFe, KFe, HSt, JSt, XSt, lG, OR, VFe, YFe, uG, eze, nze, gG, vd, vh, kR, zi, sze, yG, ize, yEt, Ad, $i, bG, Kn, AEt, REt, xEt, aze, AG, wG, $R, dze, $G, pze, fze, mze, gze, hze, BR, HG, jG, fbt, yze, Sze, Eze, Gn, ji, kG, PG, NR, UR, KR, GG, Cze, vze, Rze, GR, xze, Tze, xh, WR, Oze, kze, mbt, Pze, Ize, Dze, Lze, Mze, Nze, qG, Uze, Fze, zze, $ze, ZG, Hze, IG, jze, Bze, YG, Kze, Gze, DG, Wze, Vze, JG, qze, Zze, Yze, Jze, QG, Xze, Qze, e$e, t$e, r$e, o$e, s$e, i$e, a$e, eW, nW, c$e, m$e, xd, VR, gbt, hbt, _bt, h$e, qR, Th, MR, aW, _$e, S$e, lW, E$e, b$e, C$e, v$e, A$e, x$e, w$e, O$e, k$e, P$e, I$e, N$e, ybt, FR, Sbt, U$e, MG, Td, Ebt, bbt, uW, z$e, $$e, H$e, Cbt, j$e, B$e, vbt, Abt, K$e, Rbt, Oh, kh, G$e, YR, Ph, W$e, Ih, Mbt, Nbt, Ubt, Dh, V$e, Z$e, tx, EW, Id, Fh, X$e, xCt, Q$e, eHe, ix, ax, lx, cx, zh, $h, MW, tHe, nHe, aHe, uHe, dHe, Zs, pHe, CW, vW, AW, Nh, UW, fHe, mHe, gHe, hHe, _He, yHe, SHe, EHe, pn, dx, nx, Mh, Bi, AHe, TCt, xHe, Pd, RW, THe, xW, wHe, OHe, Hh, kHe, TW, fx, Bh, Ki, KW, Gl, PHe, Kh, kW, Wl, NHe, Ld, UHe, tV, rV, jHe, XHe, cvt, tje, fV, mV, sje, aje, _V, yV, pje, zvt, $vt, gje, yje, Sje, Kvt, Gvt, eAt, RV, Eje, bje, mAt, Cje, gAt, xV, wV, OV, Js, Lje, FV, Yh, Jh, Md, Tx, zV, $V, HV, Xh, jV, cr, KV, Mo, Fje, zje, yRt, jje, Gje, Vje, sBe, YV, e22, o_, gBe, t2, s_, kx, o2, LBe, UBe, $x, Vi, R2, KBe, GBe, Dx, ZBe, k2, n_, l2, sKe, lKe, z2, bKe, RKe, ec, W2, H2, xKe, wKe, PKe, IKe, $Ke, X2, HKe, jKe, BKe, KKe, VKe, eTt, qKe, tTt, nTt, ZKe, rTt, YKe, oTt, JKe, Wx, XKe, iTt, eq, tq, QKe, nq, rq, e1e, t1e, oq, sq, n1e, r1e, aTt, lTt, c1e, Zx, cq, u1e, uq, a_, d1e, Xx, nc, S1e, c_, mq, gq, Qx, hq, _q, E1e, Sq, u_, rc, d_, b1e, bq, Uo, Cq, vq, A1e, Yd, Jd, R1e, x1e, Aq, gn, T1e, w1e, O1e, Xs, k1e, P1e, xq, Pwt, I1e, Oq, kq, Pq, D1e, L1e, Iq, M1e, N1e, nT, U1e, p_, rT, Dq, oT, iT, F1e, Uq, aT, jq, K1e, Gq, yOt, sGe, cGe, uGe, yGe;
|
|
81446
81558
|
var init_sdk = __esm({
|
|
81447
81559
|
"node_modules/.pnpm/@anthropic-ai+claude-agent-sdk@0.3.292_@anthropic-ai+sdk@0.131.0_zod@4.6.5__@modelconte_9caa915130557974815a7ac66b010e49/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs"() {
|
|
81448
81560
|
import_node_module = require("node:module");
|
|
81449
81561
|
import_crypto = require("crypto");
|
|
81450
81562
|
import_crypto2 = require("crypto");
|
|
81451
81563
|
import_path = require("path");
|
|
81452
|
-
|
|
81564
|
+
import_node_fs16 = require("node:fs");
|
|
81453
81565
|
import_node_process4 = require("node:process");
|
|
81454
81566
|
import_fs = require("fs");
|
|
81455
81567
|
import_os = require("os");
|
|
@@ -103986,8 +104098,8 @@ var require_utils3 = __commonJS({
|
|
|
103986
104098
|
}
|
|
103987
104099
|
return ind;
|
|
103988
104100
|
}
|
|
103989
|
-
function removeDotSegments(
|
|
103990
|
-
let input2 =
|
|
104101
|
+
function removeDotSegments(path66) {
|
|
104102
|
+
let input2 = path66;
|
|
103991
104103
|
const output2 = [];
|
|
103992
104104
|
let nextSlash = -1;
|
|
103993
104105
|
let len = 0;
|
|
@@ -104396,8 +104508,8 @@ var require_schemes = __commonJS({
|
|
|
104396
104508
|
}
|
|
104397
104509
|
if (wsComponent.resourceName) {
|
|
104398
104510
|
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
104399
|
-
const
|
|
104400
|
-
wsComponent.path =
|
|
104511
|
+
const path66 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
104512
|
+
wsComponent.path = path66 && path66 !== "/" ? path66 : void 0;
|
|
104401
104513
|
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
104402
104514
|
wsComponent.resourceName = void 0;
|
|
104403
104515
|
}
|
|
@@ -107910,12 +108022,12 @@ var require_dist2 = __commonJS({
|
|
|
107910
108022
|
throw new Error(`Unknown format "${name}"`);
|
|
107911
108023
|
return f;
|
|
107912
108024
|
};
|
|
107913
|
-
function addFormats(ajv, list,
|
|
108025
|
+
function addFormats(ajv, list, fs28, exportName) {
|
|
107914
108026
|
var _a4;
|
|
107915
108027
|
var _b2;
|
|
107916
108028
|
(_a4 = (_b2 = ajv.opts.code).formats) !== null && _a4 !== void 0 ? _a4 : _b2.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
107917
108029
|
for (const f of list)
|
|
107918
|
-
ajv.addFormat(f,
|
|
108030
|
+
ajv.addFormat(f, fs28[f]);
|
|
107919
108031
|
}
|
|
107920
108032
|
module2.exports = exports2 = formatsPlugin;
|
|
107921
108033
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -107924,7 +108036,7 @@ var require_dist2 = __commonJS({
|
|
|
107924
108036
|
});
|
|
107925
108037
|
|
|
107926
108038
|
// src/cli.ts
|
|
107927
|
-
var
|
|
108039
|
+
var import_node_path65 = __toESM(require("node:path"), 1);
|
|
107928
108040
|
|
|
107929
108041
|
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
|
|
107930
108042
|
var CommanderError = class extends Error {
|
|
@@ -111037,9 +111149,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
111037
111149
|
* @param {string} [path]
|
|
111038
111150
|
* @return {(string|null|Command)}
|
|
111039
111151
|
*/
|
|
111040
|
-
executableDir(
|
|
111041
|
-
if (
|
|
111042
|
-
this._executableDir =
|
|
111152
|
+
executableDir(path66) {
|
|
111153
|
+
if (path66 === void 0) return this._executableDir;
|
|
111154
|
+
this._executableDir = path66;
|
|
111043
111155
|
return this;
|
|
111044
111156
|
}
|
|
111045
111157
|
/**
|
|
@@ -112515,19 +112627,19 @@ function writePools(paths, pools) {
|
|
|
112515
112627
|
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
|
|
112516
112628
|
}
|
|
112517
112629
|
function poolCycleOf(pools, name) {
|
|
112518
|
-
const walk2 = (current,
|
|
112630
|
+
const walk2 = (current, path66) => {
|
|
112519
112631
|
for (const entry of pools[current]?.identities ?? []) {
|
|
112520
112632
|
const nested = poolNameOf(poolMemberIdentity(entry));
|
|
112521
112633
|
if (nested === void 0) {
|
|
112522
112634
|
continue;
|
|
112523
112635
|
}
|
|
112524
112636
|
if (nested === name) {
|
|
112525
|
-
return [...
|
|
112637
|
+
return [...path66, nested];
|
|
112526
112638
|
}
|
|
112527
|
-
if (
|
|
112639
|
+
if (path66.includes(nested)) {
|
|
112528
112640
|
continue;
|
|
112529
112641
|
}
|
|
112530
|
-
const found = walk2(nested, [...
|
|
112642
|
+
const found = walk2(nested, [...path66, nested]);
|
|
112531
112643
|
if (found !== void 0) {
|
|
112532
112644
|
return found;
|
|
112533
112645
|
}
|
|
@@ -114641,7 +114753,7 @@ function registerCheckCommand(program2, deps) {
|
|
|
114641
114753
|
|
|
114642
114754
|
// src/codex/commands.ts
|
|
114643
114755
|
var import_node_crypto10 = require("node:crypto");
|
|
114644
|
-
var
|
|
114756
|
+
var import_node_fs12 = __toESM(require("node:fs"), 1);
|
|
114645
114757
|
var import_node_os6 = __toESM(require("node:os"), 1);
|
|
114646
114758
|
var import_node_path33 = __toESM(require("node:path"), 1);
|
|
114647
114759
|
init_commandDeps();
|
|
@@ -115324,7 +115436,7 @@ var PRIVATE_FILE_MODE = 384;
|
|
|
115324
115436
|
var realCodexAuthFs = {
|
|
115325
115437
|
read: (filePath) => {
|
|
115326
115438
|
try {
|
|
115327
|
-
return
|
|
115439
|
+
return import_node_fs12.default.readFileSync(filePath, "utf8");
|
|
115328
115440
|
} catch (error63) {
|
|
115329
115441
|
if (isEnoent4(error63)) {
|
|
115330
115442
|
return void 0;
|
|
@@ -115333,22 +115445,22 @@ var realCodexAuthFs = {
|
|
|
115333
115445
|
}
|
|
115334
115446
|
},
|
|
115335
115447
|
writePrivate: (filePath, contents) => {
|
|
115336
|
-
|
|
115337
|
-
|
|
115338
|
-
|
|
115448
|
+
import_node_fs12.default.mkdirSync(import_node_path33.default.dirname(filePath), { recursive: true });
|
|
115449
|
+
import_node_fs12.default.writeFileSync(filePath, contents, { encoding: "utf8", mode: PRIVATE_FILE_MODE });
|
|
115450
|
+
import_node_fs12.default.chmodSync(filePath, PRIVATE_FILE_MODE);
|
|
115339
115451
|
},
|
|
115340
115452
|
rename: (from, to2) => {
|
|
115341
|
-
|
|
115453
|
+
import_node_fs12.default.renameSync(from, to2);
|
|
115342
115454
|
}
|
|
115343
115455
|
};
|
|
115344
115456
|
function writeUsageSnapshot(log, snapshot) {
|
|
115345
115457
|
const target = codexUsageSnapshotPath();
|
|
115346
115458
|
const temp = `${target}.${String(process.pid)}.tmp`;
|
|
115347
115459
|
try {
|
|
115348
|
-
|
|
115349
|
-
|
|
115460
|
+
import_node_fs12.default.mkdirSync(import_node_path33.default.dirname(target), { recursive: true });
|
|
115461
|
+
import_node_fs12.default.writeFileSync(temp, `${JSON.stringify(snapshot, null, 2)}
|
|
115350
115462
|
`);
|
|
115351
|
-
|
|
115463
|
+
import_node_fs12.default.renameSync(temp, target);
|
|
115352
115464
|
} catch (error63) {
|
|
115353
115465
|
log(`usage snapshot write failed: ${error63 instanceof Error ? error63.message : String(error63)}`);
|
|
115354
115466
|
}
|
|
@@ -115506,20 +115618,20 @@ function registerCodexCommand(program2, deps) {
|
|
|
115506
115618
|
// src/frontdoor/commands.ts
|
|
115507
115619
|
var import_node_crypto25 = require("node:crypto");
|
|
115508
115620
|
var import_node_path54 = __toESM(require("node:path"), 1);
|
|
115509
|
-
var
|
|
115621
|
+
var import_node_fs20 = __toESM(require("node:fs"), 1);
|
|
115510
115622
|
init_commandDeps();
|
|
115511
115623
|
init_configProfilesStore();
|
|
115512
115624
|
init_schema();
|
|
115513
115625
|
init_conditions();
|
|
115514
115626
|
|
|
115515
115627
|
// src/agents/realFs.ts
|
|
115516
|
-
var
|
|
115628
|
+
var import_node_fs13 = __toESM(require("node:fs"), 1);
|
|
115517
115629
|
init_realPorts();
|
|
115518
115630
|
var realSessionFs = {
|
|
115519
115631
|
...realFarmFs,
|
|
115520
115632
|
realpath: (candidate) => {
|
|
115521
115633
|
try {
|
|
115522
|
-
return
|
|
115634
|
+
return import_node_fs13.default.realpathSync(candidate);
|
|
115523
115635
|
} catch {
|
|
115524
115636
|
return void 0;
|
|
115525
115637
|
}
|
|
@@ -115648,17 +115760,17 @@ function parseEntry2(project, entry) {
|
|
|
115648
115760
|
const base = match?.[1];
|
|
115649
115761
|
return base === void 0 ? { project, sessionId: entry, superseded: false, entry } : { project, sessionId: base, superseded: true, entry };
|
|
115650
115762
|
}
|
|
115651
|
-
function listSessions2(
|
|
115763
|
+
function listSessions2(fs28, configDir) {
|
|
115652
115764
|
const found = [];
|
|
115653
|
-
for (const project of
|
|
115765
|
+
for (const project of fs28.readdir(import_node_path34.default.join(configDir, PROJECTS_DIR))) {
|
|
115654
115766
|
const projectDir = import_node_path34.default.join(configDir, PROJECTS_DIR, project);
|
|
115655
115767
|
const entries = /* @__PURE__ */ new Set();
|
|
115656
|
-
for (const name of
|
|
115768
|
+
for (const name of fs28.readdir(projectDir)) {
|
|
115657
115769
|
if (name.endsWith(TRANSCRIPT_SUFFIX)) {
|
|
115658
115770
|
entries.add(name.slice(0, -TRANSCRIPT_SUFFIX.length));
|
|
115659
115771
|
continue;
|
|
115660
115772
|
}
|
|
115661
|
-
const children =
|
|
115773
|
+
const children = fs28.readdir(import_node_path34.default.join(projectDir, name));
|
|
115662
115774
|
if (children.includes(SUBAGENTS_DIR) || children.includes(WORKFLOWS_DIR)) {
|
|
115663
115775
|
entries.add(name);
|
|
115664
115776
|
}
|
|
@@ -115669,9 +115781,9 @@ function listSessions2(fs26, configDir) {
|
|
|
115669
115781
|
}
|
|
115670
115782
|
return found.sort((left, right) => left.project.localeCompare(right.project) || left.entry.localeCompare(right.entry));
|
|
115671
115783
|
}
|
|
115672
|
-
function locateAgents(
|
|
115784
|
+
function locateAgents(fs28, configDir, relativeDir, workflowRunId, report) {
|
|
115673
115785
|
const located = [];
|
|
115674
|
-
for (const name of listDirOrReport(
|
|
115786
|
+
for (const name of listDirOrReport(fs28, configDir, relativeDir, report)) {
|
|
115675
115787
|
if (!name.startsWith(AGENT_FILE_PREFIX) || !name.endsWith(META_SUFFIX)) {
|
|
115676
115788
|
continue;
|
|
115677
115789
|
}
|
|
@@ -115720,17 +115832,17 @@ function toNode(read, children) {
|
|
|
115720
115832
|
function describeFailure(error63) {
|
|
115721
115833
|
return error63 instanceof Error ? error63.message : String(error63);
|
|
115722
115834
|
}
|
|
115723
|
-
function readFileOrReport(
|
|
115835
|
+
function readFileOrReport(fs28, configDir, relative, report) {
|
|
115724
115836
|
try {
|
|
115725
|
-
return
|
|
115837
|
+
return fs28.readFileUtf8(import_node_path34.default.join(configDir, relative));
|
|
115726
115838
|
} catch (error63) {
|
|
115727
115839
|
report({ path: relative, reason: `could not be read: ${describeFailure(error63)}` });
|
|
115728
115840
|
return void 0;
|
|
115729
115841
|
}
|
|
115730
115842
|
}
|
|
115731
|
-
function listDirOrReport(
|
|
115843
|
+
function listDirOrReport(fs28, configDir, relative, report) {
|
|
115732
115844
|
try {
|
|
115733
|
-
return
|
|
115845
|
+
return fs28.readdir(import_node_path34.default.join(configDir, relative));
|
|
115734
115846
|
} catch (error63) {
|
|
115735
115847
|
report({ path: relative, reason: `could not be listed: ${describeFailure(error63)}` });
|
|
115736
115848
|
return [];
|
|
@@ -115753,22 +115865,22 @@ var WorkflowRunFileSchema = external_exports.object({
|
|
|
115753
115865
|
phases: external_exports.array(external_exports.object({ title: external_exports.string() })).default([]),
|
|
115754
115866
|
summary: external_exports.string().optional()
|
|
115755
115867
|
});
|
|
115756
|
-
function summariseSession(
|
|
115868
|
+
function summariseSession(fs28, configDir, ref) {
|
|
115757
115869
|
const sessionRelative = import_node_path34.default.join(PROJECTS_DIR, ref.project, ref.entry);
|
|
115758
115870
|
const subagentsRelative = import_node_path34.default.join(sessionRelative, SUBAGENTS_DIR);
|
|
115759
115871
|
const workflowsUnderSubagents = import_node_path34.default.join(subagentsRelative, WORKFLOWS_DIR);
|
|
115760
115872
|
const isMeta = (name) => name.startsWith(AGENT_FILE_PREFIX) && name.endsWith(META_SUFFIX);
|
|
115761
|
-
let agentCount =
|
|
115762
|
-
for (const runDir of
|
|
115873
|
+
let agentCount = fs28.readdir(import_node_path34.default.join(configDir, subagentsRelative)).filter(isMeta).length;
|
|
115874
|
+
for (const runDir of fs28.readdir(import_node_path34.default.join(configDir, workflowsUnderSubagents))) {
|
|
115763
115875
|
if (runDir.startsWith(WORKFLOW_RUN_PREFIX)) {
|
|
115764
|
-
agentCount +=
|
|
115876
|
+
agentCount += fs28.readdir(import_node_path34.default.join(configDir, workflowsUnderSubagents, runDir)).filter(isMeta).length;
|
|
115765
115877
|
}
|
|
115766
115878
|
}
|
|
115767
|
-
const workflowRunCount =
|
|
115768
|
-
const transcript =
|
|
115879
|
+
const workflowRunCount = fs28.readdir(import_node_path34.default.join(configDir, sessionRelative, WORKFLOWS_DIR)).filter((name) => name.startsWith(WORKFLOW_RUN_PREFIX) && name.endsWith(JSON_SUFFIX)).length;
|
|
115880
|
+
const transcript = fs28.lstat(import_node_path34.default.join(configDir, PROJECTS_DIR, ref.project, `${ref.entry}${TRANSCRIPT_SUFFIX}`));
|
|
115769
115881
|
return { ...ref, agentCount, workflowRunCount, ...transcript === void 0 ? {} : { updatedAt: new Date(transcript.mtimeMs).toISOString() } };
|
|
115770
115882
|
}
|
|
115771
|
-
function readSessionAgentTree(
|
|
115883
|
+
function readSessionAgentTree(fs28, configDir, ref, options = {}) {
|
|
115772
115884
|
const problems = [];
|
|
115773
115885
|
const report = (problem) => {
|
|
115774
115886
|
problems.push(problem);
|
|
@@ -115776,15 +115888,15 @@ function readSessionAgentTree(fs26, configDir, ref, options = {}) {
|
|
|
115776
115888
|
const sessionRelative = import_node_path34.default.join(PROJECTS_DIR, ref.project, ref.entry);
|
|
115777
115889
|
const subagentsRelative = import_node_path34.default.join(sessionRelative, SUBAGENTS_DIR);
|
|
115778
115890
|
const workflowsUnderSubagents = import_node_path34.default.join(subagentsRelative, WORKFLOWS_DIR);
|
|
115779
|
-
const located = locateAgents(
|
|
115780
|
-
for (const runDir of listDirOrReport(
|
|
115891
|
+
const located = locateAgents(fs28, configDir, subagentsRelative, void 0, report);
|
|
115892
|
+
for (const runDir of listDirOrReport(fs28, configDir, workflowsUnderSubagents, report)) {
|
|
115781
115893
|
if (runDir.startsWith(WORKFLOW_RUN_PREFIX)) {
|
|
115782
|
-
located.push(...locateAgents(
|
|
115894
|
+
located.push(...locateAgents(fs28, configDir, import_node_path34.default.join(workflowsUnderSubagents, runDir), runDir, report));
|
|
115783
115895
|
}
|
|
115784
115896
|
}
|
|
115785
115897
|
const agents = /* @__PURE__ */ new Map();
|
|
115786
115898
|
for (const candidate of located) {
|
|
115787
|
-
const text2 = readFileOrReport(
|
|
115899
|
+
const text2 = readFileOrReport(fs28, configDir, candidate.metaPath, report);
|
|
115788
115900
|
if (text2 === void 0) {
|
|
115789
115901
|
continue;
|
|
115790
115902
|
}
|
|
@@ -115796,7 +115908,7 @@ function readSessionAgentTree(fs26, configDir, ref, options = {}) {
|
|
|
115796
115908
|
agents.set(candidate.id, { located: candidate, meta: parsed.data });
|
|
115797
115909
|
}
|
|
115798
115910
|
const teamNames = [...new Set([...agents.values()].flatMap((agent) => agent.meta.teamName === void 0 ? [] : [agent.meta.teamName]))].sort();
|
|
115799
|
-
const parentOf4 = resolveParents(
|
|
115911
|
+
const parentOf4 = resolveParents(fs28, configDir, agents, report);
|
|
115800
115912
|
const childrenOf = /* @__PURE__ */ new Map();
|
|
115801
115913
|
const roots = [];
|
|
115802
115914
|
for (const id2 of agents.keys()) {
|
|
@@ -115819,12 +115931,12 @@ function readSessionAgentTree(fs26, configDir, ref, options = {}) {
|
|
|
115819
115931
|
sessionId: ref.sessionId,
|
|
115820
115932
|
superseded: ref.superseded,
|
|
115821
115933
|
agents: roots.sort().map(build),
|
|
115822
|
-
tasks: readTasks(
|
|
115823
|
-
workflowRuns: readWorkflowRuns(
|
|
115934
|
+
tasks: readTasks(fs28, configDir, ownTaskLists(ref.sessionId), [.../* @__PURE__ */ new Set([...teamNames, ...options.taskListIds ?? []])].filter((id2) => !ownTaskLists(ref.sessionId).includes(id2)), report),
|
|
115935
|
+
workflowRuns: readWorkflowRuns(fs28, configDir, import_node_path34.default.join(sessionRelative, WORKFLOWS_DIR), report),
|
|
115824
115936
|
problems
|
|
115825
115937
|
};
|
|
115826
115938
|
}
|
|
115827
|
-
function resolveParents(
|
|
115939
|
+
function resolveParents(fs28, configDir, agents, report) {
|
|
115828
115940
|
const parentOf4 = /* @__PURE__ */ new Map();
|
|
115829
115941
|
const transcriptCache = /* @__PURE__ */ new Map();
|
|
115830
115942
|
const transcriptOf = (agent) => {
|
|
@@ -115832,7 +115944,7 @@ function resolveParents(fs26, configDir, agents, report) {
|
|
|
115832
115944
|
if (cached2 !== void 0) {
|
|
115833
115945
|
return cached2;
|
|
115834
115946
|
}
|
|
115835
|
-
const text2 = readFileOrReport(
|
|
115947
|
+
const text2 = readFileOrReport(fs28, configDir, agent.located.transcriptPath, report) ?? "";
|
|
115836
115948
|
transcriptCache.set(agent.located.id, text2);
|
|
115837
115949
|
return text2;
|
|
115838
115950
|
};
|
|
@@ -115882,16 +115994,16 @@ function resolveParents(fs26, configDir, agents, report) {
|
|
|
115882
115994
|
function ownTaskLists(sessionId) {
|
|
115883
115995
|
return [sessionId, `${SHORT_SESSION_LIST_PREFIX}${sessionId.slice(0, SHORT_SESSION_ID_LENGTH)}`];
|
|
115884
115996
|
}
|
|
115885
|
-
function readTasks(
|
|
115997
|
+
function readTasks(fs28, configDir, ownLists, sharedLists, report) {
|
|
115886
115998
|
const tasks = [];
|
|
115887
115999
|
[...ownLists, ...sharedLists].forEach((scope, index) => {
|
|
115888
116000
|
const relativeDir = import_node_path34.default.join(TASKS_DIR, scope);
|
|
115889
|
-
for (const name of [...listDirOrReport(
|
|
116001
|
+
for (const name of [...listDirOrReport(fs28, configDir, relativeDir, report)].sort()) {
|
|
115890
116002
|
if (name.startsWith(".") || !name.endsWith(JSON_SUFFIX)) {
|
|
115891
116003
|
continue;
|
|
115892
116004
|
}
|
|
115893
116005
|
const relative = import_node_path34.default.join(relativeDir, name);
|
|
115894
|
-
const text2 = readFileOrReport(
|
|
116006
|
+
const text2 = readFileOrReport(fs28, configDir, relative, report);
|
|
115895
116007
|
const parsed = TaskFileSchema.safeParse(text2 === void 0 ? void 0 : parseJson3(text2));
|
|
115896
116008
|
if (parsed.success) {
|
|
115897
116009
|
tasks.push(index < ownLists.length ? parsed.data : { ...parsed.data, taskList: scope });
|
|
@@ -115902,14 +116014,14 @@ function readTasks(fs26, configDir, ownLists, sharedLists, report) {
|
|
|
115902
116014
|
});
|
|
115903
116015
|
return tasks;
|
|
115904
116016
|
}
|
|
115905
|
-
function readWorkflowRuns(
|
|
116017
|
+
function readWorkflowRuns(fs28, configDir, relativeDir, report) {
|
|
115906
116018
|
const runs = [];
|
|
115907
|
-
for (const name of [...listDirOrReport(
|
|
116019
|
+
for (const name of [...listDirOrReport(fs28, configDir, relativeDir, report)].sort()) {
|
|
115908
116020
|
if (!name.startsWith(WORKFLOW_RUN_PREFIX) || !name.endsWith(JSON_SUFFIX)) {
|
|
115909
116021
|
continue;
|
|
115910
116022
|
}
|
|
115911
116023
|
const relative = import_node_path34.default.join(relativeDir, name);
|
|
115912
|
-
const text2 = readFileOrReport(
|
|
116024
|
+
const text2 = readFileOrReport(fs28, configDir, relative, report);
|
|
115913
116025
|
const parsed = WorkflowRunFileSchema.safeParse(text2 === void 0 ? void 0 : parseJson3(text2));
|
|
115914
116026
|
if (!parsed.success) {
|
|
115915
116027
|
if (text2 !== void 0) {
|
|
@@ -115933,11 +116045,11 @@ var SessionLookupError = class extends CliError {
|
|
|
115933
116045
|
function identityConfigDir(identitiesDir, identity) {
|
|
115934
116046
|
return import_node_path35.default.join(identitiesDir, identity);
|
|
115935
116047
|
}
|
|
115936
|
-
function historyStores(
|
|
116048
|
+
function historyStores(fs28, identitiesDir, identities) {
|
|
115937
116049
|
const byRealPath = /* @__PURE__ */ new Map();
|
|
115938
116050
|
for (const identity of identities) {
|
|
115939
116051
|
const configDir = identityConfigDir(identitiesDir, identity);
|
|
115940
|
-
const real =
|
|
116052
|
+
const real = fs28.realpath(import_node_path35.default.join(configDir, "projects"));
|
|
115941
116053
|
if (real === void 0) {
|
|
115942
116054
|
continue;
|
|
115943
116055
|
}
|
|
@@ -115950,15 +116062,15 @@ function historyStores(fs26, identitiesDir, identities) {
|
|
|
115950
116062
|
}
|
|
115951
116063
|
return [...byRealPath.values()];
|
|
115952
116064
|
}
|
|
115953
|
-
function collectSessionList(
|
|
116065
|
+
function collectSessionList(fs28, identitiesDir, identities, filters) {
|
|
115954
116066
|
const names = filters.identity === void 0 ? identities : identities.filter((name) => name === filters.identity);
|
|
115955
116067
|
if (filters.identity !== void 0 && names.length === 0) {
|
|
115956
116068
|
throw new SessionLookupError(`no identity named "${filters.identity}"`);
|
|
115957
116069
|
}
|
|
115958
116070
|
const sessions = [];
|
|
115959
|
-
for (const store of historyStores(
|
|
115960
|
-
for (const ref of listSessions2(
|
|
115961
|
-
const summary = summariseSession(
|
|
116071
|
+
for (const store of historyStores(fs28, identitiesDir, names)) {
|
|
116072
|
+
for (const ref of listSessions2(fs28, store.configDir)) {
|
|
116073
|
+
const summary = summariseSession(fs28, store.configDir, ref);
|
|
115962
116074
|
if (filters.all === true || summary.agentCount > 0 || summary.workflowRunCount > 0) {
|
|
115963
116075
|
sessions.push({ ...summary, identities: store.identities });
|
|
115964
116076
|
}
|
|
@@ -115966,14 +116078,14 @@ function collectSessionList(fs26, identitiesDir, identities, filters) {
|
|
|
115966
116078
|
}
|
|
115967
116079
|
return sessions.sort((left, right) => (right.updatedAt ?? "").localeCompare(left.updatedAt ?? "") || left.sessionId.localeCompare(right.sessionId));
|
|
115968
116080
|
}
|
|
115969
|
-
function locateSession(
|
|
116081
|
+
function locateSession(fs28, identitiesDir, identities, query, onlyIdentity) {
|
|
115970
116082
|
const names = onlyIdentity === void 0 ? identities : identities.filter((name) => name === onlyIdentity);
|
|
115971
116083
|
if (onlyIdentity !== void 0 && names.length === 0) {
|
|
115972
116084
|
throw new SessionLookupError(`no identity named "${onlyIdentity}"`);
|
|
115973
116085
|
}
|
|
115974
116086
|
const matches = [];
|
|
115975
|
-
for (const store of historyStores(
|
|
115976
|
-
for (const ref of listSessions2(
|
|
116087
|
+
for (const store of historyStores(fs28, identitiesDir, names)) {
|
|
116088
|
+
for (const ref of listSessions2(fs28, store.configDir)) {
|
|
115977
116089
|
if (ref.sessionId.startsWith(query)) {
|
|
115978
116090
|
matches.push({ identities: store.identities, configDir: store.configDir, ref });
|
|
115979
116091
|
}
|
|
@@ -115990,9 +116102,9 @@ function locateSession(fs26, identitiesDir, identities, query, onlyIdentity) {
|
|
|
115990
116102
|
}
|
|
115991
116103
|
throw new SessionLookupError(`"${query}" matches ${String(candidates.length)} sessions: ${candidates.map((match) => `${match.ref.sessionId} (${match.identities.join(", ")})`).join("; ")}; give more of the id or pass --identity`);
|
|
115992
116104
|
}
|
|
115993
|
-
function showSession(
|
|
115994
|
-
const located = locateSession(
|
|
115995
|
-
return { identities: located.identities, tree: readSessionAgentTree(
|
|
116105
|
+
function showSession(fs28, identitiesDir, identities, query, onlyIdentity) {
|
|
116106
|
+
const located = locateSession(fs28, identitiesDir, identities, query, onlyIdentity);
|
|
116107
|
+
return { identities: located.identities, tree: readSessionAgentTree(fs28, located.configDir, located.ref) };
|
|
115996
116108
|
}
|
|
115997
116109
|
|
|
115998
116110
|
// src/frontdoor/commands.ts
|
|
@@ -116038,13 +116150,13 @@ function stateDirOf(paths, pool) {
|
|
|
116038
116150
|
function sessionStatePath(paths, pool, sessionId) {
|
|
116039
116151
|
return import_node_path36.default.join(stateDirOf(paths, pool), `${sessionId}.json`);
|
|
116040
116152
|
}
|
|
116041
|
-
function writeSessionState(
|
|
116042
|
-
|
|
116043
|
-
|
|
116153
|
+
function writeSessionState(fs28, paths, pool, sessionId, state) {
|
|
116154
|
+
fs28.mkdirPrivate(stateDirOf(paths, pool));
|
|
116155
|
+
fs28.writeFilePrivate(sessionStatePath(paths, pool, sessionId), `${JSON.stringify(SessionStateSchema.parse(state))}
|
|
116044
116156
|
`);
|
|
116045
116157
|
}
|
|
116046
|
-
function readSessionState(
|
|
116047
|
-
const raw =
|
|
116158
|
+
function readSessionState(fs28, paths, pool, sessionId) {
|
|
116159
|
+
const raw = fs28.readFileUtf8(sessionStatePath(paths, pool, sessionId));
|
|
116048
116160
|
if (raw === void 0) {
|
|
116049
116161
|
return void 0;
|
|
116050
116162
|
}
|
|
@@ -116055,20 +116167,20 @@ function readSessionState(fs26, paths, pool, sessionId) {
|
|
|
116055
116167
|
return void 0;
|
|
116056
116168
|
}
|
|
116057
116169
|
}
|
|
116058
|
-
function registerSupervised(
|
|
116059
|
-
|
|
116060
|
-
|
|
116170
|
+
function registerSupervised(fs28, paths, session) {
|
|
116171
|
+
fs28.mkdirPrivate(sessionsDirOf(paths, session.pool));
|
|
116172
|
+
fs28.writeFilePrivate(sessionFileOf(paths, session.pool, session.sessionId), `${JSON.stringify(SupervisedSessionSchema.parse(session))}
|
|
116061
116173
|
`);
|
|
116062
116174
|
}
|
|
116063
|
-
function unregisterSupervised(
|
|
116064
|
-
|
|
116065
|
-
|
|
116175
|
+
function unregisterSupervised(fs28, paths, pool, sessionId) {
|
|
116176
|
+
fs28.removeRecursive(sessionFileOf(paths, pool, sessionId));
|
|
116177
|
+
fs28.removeRecursive(sessionStatePath(paths, pool, sessionId));
|
|
116066
116178
|
}
|
|
116067
|
-
function liveSupervised(
|
|
116179
|
+
function liveSupervised(fs28, paths, pool, isRunning) {
|
|
116068
116180
|
const live = [];
|
|
116069
|
-
for (const name of
|
|
116181
|
+
for (const name of fs28.readdir(sessionsDirOf(paths, pool))) {
|
|
116070
116182
|
const file2 = import_node_path36.default.join(sessionsDirOf(paths, pool), name);
|
|
116071
|
-
const raw =
|
|
116183
|
+
const raw = fs28.readFileUtf8(file2);
|
|
116072
116184
|
if (raw === void 0) {
|
|
116073
116185
|
continue;
|
|
116074
116186
|
}
|
|
@@ -116076,13 +116188,13 @@ function liveSupervised(fs26, paths, pool, isRunning) {
|
|
|
116076
116188
|
try {
|
|
116077
116189
|
parsed = SupervisedSessionSchema.safeParse(JSON.parse(raw));
|
|
116078
116190
|
} catch {
|
|
116079
|
-
|
|
116191
|
+
fs28.removeRecursive(file2);
|
|
116080
116192
|
continue;
|
|
116081
116193
|
}
|
|
116082
116194
|
if (parsed.success && isRunning(parsed.data.pid)) {
|
|
116083
116195
|
live.push(parsed.data);
|
|
116084
116196
|
} else {
|
|
116085
|
-
|
|
116197
|
+
fs28.removeRecursive(file2);
|
|
116086
116198
|
}
|
|
116087
116199
|
}
|
|
116088
116200
|
return live;
|
|
@@ -116111,13 +116223,13 @@ var ModelMoveRequestSchema = external_exports.strictObject({
|
|
|
116111
116223
|
/** When the door wrote the request, so a supervisor can tell a fresh request from one left behind. */
|
|
116112
116224
|
at: external_exports.iso.datetime()
|
|
116113
116225
|
});
|
|
116114
|
-
function writeModelMove(
|
|
116115
|
-
|
|
116116
|
-
|
|
116226
|
+
function writeModelMove(fs28, paths, request7) {
|
|
116227
|
+
fs28.mkdirPrivate(paths.modelMovesDir);
|
|
116228
|
+
fs28.writeFilePrivate(import_node_path36.default.join(paths.modelMovesDir, `${request7.sessionId}.json`), `${JSON.stringify(ModelMoveRequestSchema.parse(request7))}
|
|
116117
116229
|
`);
|
|
116118
116230
|
}
|
|
116119
|
-
function readModelMove(
|
|
116120
|
-
const raw =
|
|
116231
|
+
function readModelMove(fs28, paths, sessionId) {
|
|
116232
|
+
const raw = fs28.readFileUtf8(import_node_path36.default.join(paths.modelMovesDir, `${sessionId}.json`));
|
|
116121
116233
|
if (raw === void 0) {
|
|
116122
116234
|
return void 0;
|
|
116123
116235
|
}
|
|
@@ -116127,12 +116239,12 @@ function readModelMove(fs26, paths, sessionId) {
|
|
|
116127
116239
|
return void 0;
|
|
116128
116240
|
}
|
|
116129
116241
|
}
|
|
116130
|
-
function removeModelMove(
|
|
116131
|
-
|
|
116242
|
+
function removeModelMove(fs28, paths, sessionId) {
|
|
116243
|
+
fs28.removeRecursive(import_node_path36.default.join(paths.modelMovesDir, `${sessionId}.json`));
|
|
116132
116244
|
}
|
|
116133
|
-
function supervisedSessionOf(
|
|
116134
|
-
for (const pool of
|
|
116135
|
-
const sessions = liveSupervised(
|
|
116245
|
+
function supervisedSessionOf(fs28, paths, sessionId, isRunning) {
|
|
116246
|
+
for (const pool of fs28.readdir(paths.superviseDir)) {
|
|
116247
|
+
const sessions = liveSupervised(fs28, paths, pool, isRunning);
|
|
116136
116248
|
const found = sessions.find((session) => session.sessionId === sessionId);
|
|
116137
116249
|
if (found !== void 0) {
|
|
116138
116250
|
return found;
|
|
@@ -116190,9 +116302,9 @@ function blendedPricePerMTok(prices, mix) {
|
|
|
116190
116302
|
|
|
116191
116303
|
// src/selection/targetStore.ts
|
|
116192
116304
|
var SEED_LOOKBACK_RECORDS = 500;
|
|
116193
|
-
function createTargetObservationStore(
|
|
116305
|
+
function createTargetObservationStore(fs28, paths) {
|
|
116194
116306
|
let observations = /* @__PURE__ */ new Map();
|
|
116195
|
-
const seeded = readUsageLog(
|
|
116307
|
+
const seeded = readUsageLog(fs28, paths.usageLogDir, {}).records.slice(-SEED_LOOKBACK_RECORDS);
|
|
116196
116308
|
for (const record2 of seeded) {
|
|
116197
116309
|
observations = observeRecord(observations, record2);
|
|
116198
116310
|
}
|
|
@@ -116208,7 +116320,7 @@ function createTargetObservationStore(fs26, paths) {
|
|
|
116208
116320
|
}
|
|
116209
116321
|
|
|
116210
116322
|
// src/update/commands.ts
|
|
116211
|
-
var
|
|
116323
|
+
var import_node_fs15 = __toESM(require("node:fs"), 1);
|
|
116212
116324
|
var import_node_os7 = __toESM(require("node:os"), 1);
|
|
116213
116325
|
var import_node_path39 = __toESM(require("node:path"), 1);
|
|
116214
116326
|
init_package();
|
|
@@ -116243,10 +116355,10 @@ var realUpdatePorts = {
|
|
|
116243
116355
|
}
|
|
116244
116356
|
},
|
|
116245
116357
|
fs: {
|
|
116246
|
-
realpath: (target) =>
|
|
116358
|
+
realpath: (target) => import_node_fs15.default.realpathSync(target),
|
|
116247
116359
|
readFileUtf8: (filePath) => {
|
|
116248
116360
|
try {
|
|
116249
|
-
return
|
|
116361
|
+
return import_node_fs15.default.readFileSync(filePath, "utf8");
|
|
116250
116362
|
} catch (error63) {
|
|
116251
116363
|
if (isEnoent5(error63)) {
|
|
116252
116364
|
return void 0;
|
|
@@ -116256,7 +116368,7 @@ var realUpdatePorts = {
|
|
|
116256
116368
|
},
|
|
116257
116369
|
readFileBytes: (filePath) => {
|
|
116258
116370
|
try {
|
|
116259
|
-
return new Uint8Array(
|
|
116371
|
+
return new Uint8Array(import_node_fs15.default.readFileSync(filePath));
|
|
116260
116372
|
} catch (error63) {
|
|
116261
116373
|
if (isEnoent5(error63)) {
|
|
116262
116374
|
return void 0;
|
|
@@ -116267,7 +116379,7 @@ var realUpdatePorts = {
|
|
|
116267
116379
|
readFileHead: (filePath, length) => {
|
|
116268
116380
|
let descriptor;
|
|
116269
116381
|
try {
|
|
116270
|
-
descriptor =
|
|
116382
|
+
descriptor = import_node_fs15.default.openSync(filePath, "r");
|
|
116271
116383
|
} catch (error63) {
|
|
116272
116384
|
if (isEnoent5(error63)) {
|
|
116273
116385
|
return void 0;
|
|
@@ -116276,21 +116388,21 @@ var realUpdatePorts = {
|
|
|
116276
116388
|
}
|
|
116277
116389
|
try {
|
|
116278
116390
|
const buffer2 = Buffer.alloc(length);
|
|
116279
|
-
const read =
|
|
116391
|
+
const read = import_node_fs15.default.readSync(descriptor, buffer2, 0, length, 0);
|
|
116280
116392
|
return read === 0 ? "" : buffer2.toString("latin1", 0, read);
|
|
116281
116393
|
} finally {
|
|
116282
|
-
|
|
116394
|
+
import_node_fs15.default.closeSync(descriptor);
|
|
116283
116395
|
}
|
|
116284
116396
|
},
|
|
116285
116397
|
writeFileUtf8: (filePath, contents) => {
|
|
116286
|
-
|
|
116398
|
+
import_node_fs15.default.writeFileSync(filePath, contents, "utf8");
|
|
116287
116399
|
},
|
|
116288
116400
|
writeFileBytes: (filePath, contents) => {
|
|
116289
|
-
|
|
116401
|
+
import_node_fs15.default.writeFileSync(filePath, contents);
|
|
116290
116402
|
},
|
|
116291
116403
|
writeFileExclusive: (filePath, contents) => {
|
|
116292
116404
|
try {
|
|
116293
|
-
|
|
116405
|
+
import_node_fs15.default.writeFileSync(filePath, contents, { encoding: "utf8", flag: "wx" });
|
|
116294
116406
|
return true;
|
|
116295
116407
|
} catch (error63) {
|
|
116296
116408
|
if (isErrorWithCode2(error63, "EEXIST")) {
|
|
@@ -116301,7 +116413,7 @@ var realUpdatePorts = {
|
|
|
116301
116413
|
},
|
|
116302
116414
|
unlink: (filePath) => {
|
|
116303
116415
|
try {
|
|
116304
|
-
|
|
116416
|
+
import_node_fs15.default.unlinkSync(filePath);
|
|
116305
116417
|
} catch (error63) {
|
|
116306
116418
|
if (!isEnoent5(error63)) {
|
|
116307
116419
|
throw error63;
|
|
@@ -116309,14 +116421,14 @@ var realUpdatePorts = {
|
|
|
116309
116421
|
}
|
|
116310
116422
|
},
|
|
116311
116423
|
rename: (from, to2) => {
|
|
116312
|
-
|
|
116424
|
+
import_node_fs15.default.renameSync(from, to2);
|
|
116313
116425
|
},
|
|
116314
116426
|
chmod: (filePath, mode) => {
|
|
116315
|
-
|
|
116427
|
+
import_node_fs15.default.chmodSync(filePath, mode);
|
|
116316
116428
|
},
|
|
116317
|
-
mkdtemp: () =>
|
|
116429
|
+
mkdtemp: () => import_node_fs15.default.mkdtempSync(import_node_path39.default.join(import_node_os7.default.tmpdir(), "agent-shim-update-")),
|
|
116318
116430
|
rmRecursive: (targetPath) => {
|
|
116319
|
-
|
|
116431
|
+
import_node_fs15.default.rmSync(targetPath, { recursive: true, force: true });
|
|
116320
116432
|
}
|
|
116321
116433
|
},
|
|
116322
116434
|
// Signal 0 performs the permission and existence checks without delivering anything; EPERM means the process exists but belongs to another user.
|
|
@@ -116541,6 +116653,7 @@ function createCatalogueKeeper(deps) {
|
|
|
116541
116653
|
|
|
116542
116654
|
// src/frontdoor/commands.ts
|
|
116543
116655
|
init_providerCatalogue();
|
|
116656
|
+
init_providerAliases();
|
|
116544
116657
|
init_providersStore();
|
|
116545
116658
|
|
|
116546
116659
|
// src/usage/realWindowOpener.ts
|
|
@@ -116611,8 +116724,8 @@ var StampsFileSchema = external_exports.strictObject({
|
|
|
116611
116724
|
schemaVersion: external_exports.literal(STAMPS_SCHEMA_VERSION),
|
|
116612
116725
|
handled: external_exports.record(external_exports.string().min(1), external_exports.iso.datetime())
|
|
116613
116726
|
});
|
|
116614
|
-
function readHandled(
|
|
116615
|
-
const raw =
|
|
116727
|
+
function readHandled(fs28, file2) {
|
|
116728
|
+
const raw = fs28.readFileUtf8(file2);
|
|
116616
116729
|
if (raw === void 0) {
|
|
116617
116730
|
return {};
|
|
116618
116731
|
}
|
|
@@ -116625,10 +116738,10 @@ function readHandled(fs26, file2) {
|
|
|
116625
116738
|
const result = StampsFileSchema.safeParse(parsed);
|
|
116626
116739
|
return result.success ? Object.fromEntries(Object.entries(result.data.handled).map(([key, at2]) => [key, Date.parse(at2)])) : {};
|
|
116627
116740
|
}
|
|
116628
|
-
function writeHandled(
|
|
116741
|
+
function writeHandled(fs28, file2, handled) {
|
|
116629
116742
|
const next = { schemaVersion: STAMPS_SCHEMA_VERSION, handled: Object.fromEntries(Object.entries(handled).map(([key, at2]) => [key, new Date(at2).toISOString()])) };
|
|
116630
|
-
|
|
116631
|
-
|
|
116743
|
+
fs28.mkdirPrivate(import_node_path47.default.dirname(file2));
|
|
116744
|
+
fs28.writeFilePrivate(file2, `${JSON.stringify(next, null, 2)}
|
|
116632
116745
|
`);
|
|
116633
116746
|
}
|
|
116634
116747
|
|
|
@@ -116901,6 +117014,7 @@ function createDoorPipelines(deps) {
|
|
|
116901
117014
|
admit: admitLaunch(deps.isLiveToken),
|
|
116902
117015
|
headroom: { headroomSocket: deps.headroomSocket, hopSecret: deps.hopSecret, custody: deps.custody, log: deps.log },
|
|
116903
117016
|
headroomDecision: deps.headroomDecision,
|
|
117017
|
+
canonicalProvider: deps.canonicalProvider,
|
|
116904
117018
|
now: deps.now,
|
|
116905
117019
|
log: deps.log
|
|
116906
117020
|
},
|
|
@@ -116909,6 +117023,7 @@ function createDoorPipelines(deps) {
|
|
|
116909
117023
|
responseObservers: [],
|
|
116910
117024
|
admit: admitHop(deps.hopSecret, deps.custody),
|
|
116911
117025
|
headroomDecision: deps.headroomDecision,
|
|
117026
|
+
canonicalProvider: deps.canonicalProvider,
|
|
116912
117027
|
now: deps.now,
|
|
116913
117028
|
log: deps.log
|
|
116914
117029
|
}
|
|
@@ -116916,7 +117031,7 @@ function createDoorPipelines(deps) {
|
|
|
116916
117031
|
}
|
|
116917
117032
|
|
|
116918
117033
|
// src/headroom/routingSetting.ts
|
|
116919
|
-
var
|
|
117034
|
+
var import_node_fs17 = __toESM(require("node:fs"), 1);
|
|
116920
117035
|
init_zod();
|
|
116921
117036
|
init_store();
|
|
116922
117037
|
var RoutingChoiceSchema = external_exports.strictObject({
|
|
@@ -116954,7 +117069,7 @@ function createRoutingSettingReader(paths) {
|
|
|
116954
117069
|
return () => {
|
|
116955
117070
|
let key;
|
|
116956
117071
|
try {
|
|
116957
|
-
const stat =
|
|
117072
|
+
const stat = import_node_fs17.default.statSync(paths.headroomRoutingFile);
|
|
116958
117073
|
key = `${String(stat.mtimeMs)}:${String(stat.size)}`;
|
|
116959
117074
|
} catch {
|
|
116960
117075
|
cachedKey = void 0;
|
|
@@ -117036,7 +117151,7 @@ init_capture();
|
|
|
117036
117151
|
|
|
117037
117152
|
// src/frontdoor/connect.ts
|
|
117038
117153
|
var import_node_crypto21 = require("node:crypto");
|
|
117039
|
-
var
|
|
117154
|
+
var fs18 = __toESM(require("node:fs"), 1);
|
|
117040
117155
|
|
|
117041
117156
|
// src/frontdoor/x509.ts
|
|
117042
117157
|
var import_node_crypto20 = require("node:crypto");
|
|
@@ -117397,9 +117512,9 @@ async function runFrontDoorSupervisor(idleShutdownMinutes, ports, options = {})
|
|
|
117397
117512
|
}
|
|
117398
117513
|
}
|
|
117399
117514
|
async function serveFrontDoor(idleShutdownMinutes, ports, options) {
|
|
117400
|
-
const { fs:
|
|
117515
|
+
const { fs: fs28, paths } = ports;
|
|
117401
117516
|
const servingBinary = ports.statOwnExecutable();
|
|
117402
|
-
const previous = readFrontDoorState(
|
|
117517
|
+
const previous = readFrontDoorState(fs28, paths.frontdoorStateFile);
|
|
117403
117518
|
let lastPort = previous?.lastPort;
|
|
117404
117519
|
let lastConnectPort = previous?.lastConnectPort;
|
|
117405
117520
|
let lastDirectPort = previous?.lastDirectPort;
|
|
@@ -117410,12 +117525,12 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
|
|
|
117410
117525
|
});
|
|
117411
117526
|
const fail = (message) => {
|
|
117412
117527
|
ports.closeRcStreamHub();
|
|
117413
|
-
writeFrontDoorState(
|
|
117414
|
-
|
|
117528
|
+
writeFrontDoorState(fs28, paths.frontdoorStateFile, { lastError: message, ...sticky() });
|
|
117529
|
+
fs28.removeRecursive(paths.frontdoorLockFile);
|
|
117415
117530
|
ports.log(`agent-shim frontdoor supervisor: ${message}`);
|
|
117416
117531
|
return 1;
|
|
117417
117532
|
};
|
|
117418
|
-
writeFrontDoorState(
|
|
117533
|
+
writeFrontDoorState(fs28, paths.frontdoorStateFile, { supervisorPid: ports.ownPid, ...sticky() });
|
|
117419
117534
|
const previousSticky = lastPort;
|
|
117420
117535
|
let http9;
|
|
117421
117536
|
try {
|
|
@@ -117455,16 +117570,16 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
|
|
|
117455
117570
|
ports.log(`agent-shim frontdoor supervisor: sticky direct port ${String(previousStickyDirect)} was occupied; moving to ${String(direct.port)} (headroom admits the new address once its supervisor rewrites the allowlist file)`);
|
|
117456
117571
|
}
|
|
117457
117572
|
lastDirectPort = direct.port;
|
|
117458
|
-
writeFrontDoorDirectRecord(
|
|
117459
|
-
writeFrontDoorState(
|
|
117573
|
+
writeFrontDoorDirectRecord(fs28, paths.frontdoorDirectRecordsDir, { pid: ports.ownPid, directPort: direct.port });
|
|
117574
|
+
writeFrontDoorState(fs28, paths.frontdoorStateFile, { protocol: FRONT_DOOR_PROTOCOL, supervisorPid: ports.ownPid, port: http9.port, connectPort: connect3.port, directPort: direct.port, ...sticky() });
|
|
117460
117575
|
ports.doorHealth.generation({ providerPort: http9.port, connectPort: connect3.port, directPort: direct.port });
|
|
117461
|
-
|
|
117576
|
+
fs28.removeRecursive(paths.frontdoorLockFile);
|
|
117462
117577
|
ports.log(`agent-shim frontdoor supervisor ${String(ports.ownPid)}: front door on 127.0.0.1:${String(http9.port)}, CONNECT surface on 127.0.0.1:${String(connect3.port)}`);
|
|
117463
117578
|
const watchdog = ports.startWatchdog?.();
|
|
117464
117579
|
let idleSince;
|
|
117465
117580
|
let ticks = 0;
|
|
117466
117581
|
const supersedingOwner = () => {
|
|
117467
|
-
const owner = readFrontDoorState(
|
|
117582
|
+
const owner = readFrontDoorState(fs28, paths.frontdoorStateFile)?.supervisorPid;
|
|
117468
117583
|
return owner !== void 0 && owner !== ports.ownPid && ports.isRunning(owner) ? owner : void 0;
|
|
117469
117584
|
};
|
|
117470
117585
|
let supersededBy;
|
|
@@ -117479,12 +117594,12 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
|
|
|
117479
117594
|
await connect3.close();
|
|
117480
117595
|
await http9.close();
|
|
117481
117596
|
ports.closeRcStreamHub();
|
|
117482
|
-
removeFrontDoorDirectRecord(
|
|
117597
|
+
removeFrontDoorDirectRecord(fs28, paths.frontdoorDirectRecordsDir, ports.ownPid);
|
|
117483
117598
|
};
|
|
117484
117599
|
const shutdown = async () => {
|
|
117485
117600
|
await closeServing();
|
|
117486
117601
|
if (supersedingOwner() === void 0) {
|
|
117487
|
-
writeFrontDoorState(
|
|
117602
|
+
writeFrontDoorState(fs28, paths.frontdoorStateFile, sticky());
|
|
117488
117603
|
}
|
|
117489
117604
|
return 0;
|
|
117490
117605
|
};
|
|
@@ -117495,8 +117610,8 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
|
|
|
117495
117610
|
return FRONTDOOR_SUPERVISOR_STILL_RUNNING;
|
|
117496
117611
|
}
|
|
117497
117612
|
ticks += 1;
|
|
117498
|
-
const listed = listFrontDoorSessions(
|
|
117499
|
-
const pruned = pruneDeadFrontDoorSessions(
|
|
117613
|
+
const listed = listFrontDoorSessions(fs28, paths.frontdoorSessionsDir);
|
|
117614
|
+
const pruned = pruneDeadFrontDoorSessions(fs28, paths.frontdoorSessionsDir, ports.isRunning);
|
|
117500
117615
|
ports.observeLaunchRegistry(listed, pruned);
|
|
117501
117616
|
ports.checkQuotaExpiry();
|
|
117502
117617
|
const prunedPids = new Set(pruned);
|
|
@@ -117582,8 +117697,8 @@ function parseConnectTarget(authority) {
|
|
|
117582
117697
|
}
|
|
117583
117698
|
return { host, port };
|
|
117584
117699
|
}
|
|
117585
|
-
function servedByPipeline(
|
|
117586
|
-
return
|
|
117700
|
+
function servedByPipeline(path66) {
|
|
117701
|
+
return path66?.startsWith(ROUTED_PATH_PREFIX) === true;
|
|
117587
117702
|
}
|
|
117588
117703
|
var HOP_BY_HOP_HEADERS = /* @__PURE__ */ new Set([
|
|
117589
117704
|
"connection",
|
|
@@ -117907,7 +118022,7 @@ function isEnoent6(error63) {
|
|
|
117907
118022
|
function realConnectCertStore(paths) {
|
|
117908
118023
|
const read = (file2) => {
|
|
117909
118024
|
try {
|
|
117910
|
-
return
|
|
118025
|
+
return fs18.readFileSync(file2, "utf8");
|
|
117911
118026
|
} catch (error63) {
|
|
117912
118027
|
if (isEnoent6(error63)) {
|
|
117913
118028
|
return void 0;
|
|
@@ -117922,10 +118037,10 @@ function realConnectCertStore(paths) {
|
|
|
117922
118037
|
return certPem === void 0 || keyPem2 === void 0 ? void 0 : { certPem, keyPem: keyPem2 };
|
|
117923
118038
|
},
|
|
117924
118039
|
writeCa: (ca2) => {
|
|
117925
|
-
|
|
117926
|
-
|
|
117927
|
-
|
|
117928
|
-
|
|
118040
|
+
fs18.mkdirSync(paths.frontdoorCaDir, { recursive: true });
|
|
118041
|
+
fs18.writeFileSync(paths.frontdoorCaCertFile, ca2.certPem, "utf8");
|
|
118042
|
+
fs18.writeFileSync(paths.frontdoorCaKeyFile, ca2.keyPem, { encoding: "utf8", mode: CA_KEY_FILE_MODE });
|
|
118043
|
+
fs18.chmodSync(paths.frontdoorCaKeyFile, CA_KEY_FILE_MODE);
|
|
117929
118044
|
}
|
|
117930
118045
|
};
|
|
117931
118046
|
}
|
|
@@ -118268,11 +118383,11 @@ function createRcSessionTracker(deps) {
|
|
|
118268
118383
|
};
|
|
118269
118384
|
const observeExchange = (request7) => {
|
|
118270
118385
|
const method = (request7.method ?? "").toUpperCase();
|
|
118271
|
-
const
|
|
118272
|
-
if (!
|
|
118386
|
+
const path66 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
|
|
118387
|
+
if (!path66.startsWith(RC_SESSIONS_PATH_PREFIX)) {
|
|
118273
118388
|
return void 0;
|
|
118274
118389
|
}
|
|
118275
|
-
const tail =
|
|
118390
|
+
const tail = path66.slice(RC_SESSIONS_PATH_PREFIX.length);
|
|
118276
118391
|
const facts = {
|
|
118277
118392
|
oauthAuthorization: oauthAuthorizationOf(request7.headers),
|
|
118278
118393
|
anthropicVersion: singleHeader(request7.headers, "anthropic-version"),
|
|
@@ -118641,8 +118756,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
|
|
|
118641
118756
|
function isRcReadFileEncoding(value2) {
|
|
118642
118757
|
return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value2);
|
|
118643
118758
|
}
|
|
118644
|
-
function buildRcReadFilePayload(requestId,
|
|
118645
|
-
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path:
|
|
118759
|
+
function buildRcReadFilePayload(requestId, path66, options) {
|
|
118760
|
+
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path66, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
|
|
118646
118761
|
}
|
|
118647
118762
|
function buildRcFileSuggestionsPayload(requestId, query) {
|
|
118648
118763
|
return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
|
|
@@ -118744,15 +118859,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
|
|
|
118744
118859
|
const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
|
|
118745
118860
|
return result.ok ? { ...result, requestId } : result;
|
|
118746
118861
|
}
|
|
118747
|
-
async function readRcSessionFile(deps, sessionId,
|
|
118748
|
-
if (
|
|
118862
|
+
async function readRcSessionFile(deps, sessionId, path66, options) {
|
|
118863
|
+
if (path66 === "") {
|
|
118749
118864
|
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" };
|
|
118750
118865
|
}
|
|
118751
118866
|
if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
|
|
118752
118867
|
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" };
|
|
118753
118868
|
}
|
|
118754
118869
|
const requestId = deps.newUuid();
|
|
118755
|
-
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId,
|
|
118870
|
+
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path66, options), `read ${path66} from session ${sessionId}`);
|
|
118756
118871
|
return result.ok ? { ...result, requestId } : result;
|
|
118757
118872
|
}
|
|
118758
118873
|
async function suggestRcSessionFiles(deps, sessionId, query) {
|
|
@@ -118923,11 +119038,11 @@ function createRcControlHandler(deps) {
|
|
|
118923
119038
|
path: "read-file",
|
|
118924
119039
|
read: (body) => {
|
|
118925
119040
|
const session = bodyString(body, "session");
|
|
118926
|
-
const
|
|
119041
|
+
const path66 = bodyString(body, "path");
|
|
118927
119042
|
const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
|
|
118928
119043
|
const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
|
|
118929
|
-
const refused2 = session === void 0 ||
|
|
118930
|
-
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,
|
|
119044
|
+
const refused2 = session === void 0 || path66 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
|
|
119045
|
+
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, path66, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
|
|
118931
119046
|
}
|
|
118932
119047
|
},
|
|
118933
119048
|
{
|
|
@@ -119237,9 +119352,9 @@ function requestIdOfBody(body) {
|
|
|
119237
119352
|
}
|
|
119238
119353
|
function frontDoorRcControl(transport, token) {
|
|
119239
119354
|
const headers = { authorization: `Bearer ${token}` };
|
|
119240
|
-
const listAnswerOf = async (
|
|
119355
|
+
const listAnswerOf = async (path66, what) => {
|
|
119241
119356
|
try {
|
|
119242
|
-
return await transport.request({ method: "GET", path:
|
|
119357
|
+
return await transport.request({ method: "GET", path: path66, headers });
|
|
119243
119358
|
} catch (error63) {
|
|
119244
119359
|
throw new Error(`${what}: could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}`, { cause: error63 });
|
|
119245
119360
|
}
|
|
@@ -119311,10 +119426,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
119311
119426
|
}
|
|
119312
119427
|
return pending;
|
|
119313
119428
|
};
|
|
119314
|
-
const writeOf = async (
|
|
119429
|
+
const writeOf = async (path66, body, describeFailure2) => {
|
|
119315
119430
|
let answer;
|
|
119316
119431
|
try {
|
|
119317
|
-
answer = await transport.request({ method: "POST", path:
|
|
119432
|
+
answer = await transport.request({ method: "POST", path: path66, headers: { ...headers, "content-type": "application/json" }, body });
|
|
119318
119433
|
} catch (error63) {
|
|
119319
119434
|
return { ok: false, message: `could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}` };
|
|
119320
119435
|
}
|
|
@@ -119345,10 +119460,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
119345
119460
|
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}`),
|
|
119346
119461
|
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}`),
|
|
119347
119462
|
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}`),
|
|
119348
|
-
readFile: async (sessionId,
|
|
119463
|
+
readFile: async (sessionId, path66, options) => await writeOf(
|
|
119349
119464
|
`${CONTROL_PATH_PREFIX}/read-file`,
|
|
119350
|
-
JSON.stringify({ session: sessionId, path:
|
|
119351
|
-
(status, message) => `reading ${
|
|
119465
|
+
JSON.stringify({ session: sessionId, path: path66, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
|
|
119466
|
+
(status, message) => `reading ${path66} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
|
|
119352
119467
|
),
|
|
119353
119468
|
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}`),
|
|
119354
119469
|
keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
|
|
@@ -119653,12 +119768,12 @@ function tlsFacts(options) {
|
|
|
119653
119768
|
}
|
|
119654
119769
|
function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
119655
119770
|
const agent = new ExemptTlsAgent();
|
|
119656
|
-
const post = async (
|
|
119771
|
+
const post = async (path66, headers, body) => await new Promise((resolve2, reject) => {
|
|
119657
119772
|
const options = {
|
|
119658
119773
|
host: target.host,
|
|
119659
119774
|
port: target.port,
|
|
119660
119775
|
method: "POST",
|
|
119661
|
-
path:
|
|
119776
|
+
path: path66,
|
|
119662
119777
|
// 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.
|
|
119663
119778
|
headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
|
|
119664
119779
|
agent
|
|
@@ -119723,12 +119838,12 @@ function lateRcStreamDial(resolve2) {
|
|
|
119723
119838
|
}
|
|
119724
119839
|
function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
119725
119840
|
const agent = new ExemptTlsAgent();
|
|
119726
|
-
const request7 = async (method,
|
|
119841
|
+
const request7 = async (method, path66, headers, body, signal) => await new Promise((resolve2, reject) => {
|
|
119727
119842
|
const options = {
|
|
119728
119843
|
host: target.host,
|
|
119729
119844
|
port: target.port,
|
|
119730
119845
|
method,
|
|
119731
|
-
path:
|
|
119846
|
+
path: path66,
|
|
119732
119847
|
// 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.
|
|
119733
119848
|
headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
|
|
119734
119849
|
agent,
|
|
@@ -119770,9 +119885,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
|
|
|
119770
119885
|
return { status, body: await readAll(response) };
|
|
119771
119886
|
},
|
|
119772
119887
|
openStream: async (sessionId, headers, resume, signal) => {
|
|
119773
|
-
const
|
|
119888
|
+
const path66 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
|
|
119774
119889
|
const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
|
|
119775
|
-
const { status, response } = await request7("GET",
|
|
119890
|
+
const { status, response } = await request7("GET", path66, streamHeaders, void 0, signal);
|
|
119776
119891
|
if (!isSuccessful2(status)) {
|
|
119777
119892
|
await readAll(response);
|
|
119778
119893
|
return { status, chunks: NO_CHUNKS };
|
|
@@ -119987,7 +120102,7 @@ function realConnectEffects(ports = DOOR_SOURCE_PORTS) {
|
|
|
119987
120102
|
init_claudeShim();
|
|
119988
120103
|
init_store();
|
|
119989
120104
|
init_realPorts();
|
|
119990
|
-
var
|
|
120105
|
+
var import_node_fs19 = __toESM(require("node:fs"), 1);
|
|
119991
120106
|
var import_node_path49 = __toESM(require("node:path"), 1);
|
|
119992
120107
|
init_signIn();
|
|
119993
120108
|
init_load();
|
|
@@ -120226,7 +120341,7 @@ function pushFrontDoorListeners(push, readings) {
|
|
|
120226
120341
|
}
|
|
120227
120342
|
|
|
120228
120343
|
// src/frontdoor/listenerReadings.ts
|
|
120229
|
-
var
|
|
120344
|
+
var import_node_fs18 = __toESM(require("node:fs"), 1);
|
|
120230
120345
|
init_probe();
|
|
120231
120346
|
function readFrontDoorListeners(state, supervisorAlive, probes) {
|
|
120232
120347
|
if (!supervisorAlive) {
|
|
@@ -120247,7 +120362,7 @@ function readFrontDoorListeners(state, supervisorAlive, probes) {
|
|
|
120247
120362
|
}
|
|
120248
120363
|
function realFrontDoorListenerProbes(paths) {
|
|
120249
120364
|
return {
|
|
120250
|
-
authenticateProvider: (port) => probeFrontDoorSync(port,
|
|
120365
|
+
authenticateProvider: (port) => probeFrontDoorSync(port, import_node_fs18.default.readFileSync(paths.frontdoorCaCertFile, "utf8")),
|
|
120251
120366
|
connect: probeListenerAcceptSync,
|
|
120252
120367
|
now: () => performance.now()
|
|
120253
120368
|
};
|
|
@@ -120256,6 +120371,7 @@ function realFrontDoorListenerProbes(paths) {
|
|
|
120256
120371
|
// src/doctorReport.ts
|
|
120257
120372
|
init_supervisorProcesses();
|
|
120258
120373
|
init_legacy();
|
|
120374
|
+
init_providerAliases();
|
|
120259
120375
|
init_providersStore();
|
|
120260
120376
|
init_guard();
|
|
120261
120377
|
init_identity();
|
|
@@ -120584,6 +120700,10 @@ function runDoctor(params) {
|
|
|
120584
120700
|
for (const entry of params.providers) {
|
|
120585
120701
|
pushProvider(push, entry, params.credentialCache, params.chatgptSignIn);
|
|
120586
120702
|
}
|
|
120703
|
+
const providerNames = new Set(params.providers.map((entry) => entry.name));
|
|
120704
|
+
for (const finding of aliasFindings(params.providerAliases ?? {}, providerNames)) {
|
|
120705
|
+
push("provider", finding.level, finding.message, finding.alias);
|
|
120706
|
+
}
|
|
120587
120707
|
if (params.platform !== "darwin" || params.run === void 0) {
|
|
120588
120708
|
push("keychain", "pass", "Skipped (not macOS).");
|
|
120589
120709
|
} else {
|
|
@@ -120810,7 +120930,7 @@ function formatDoctorReport(report) {
|
|
|
120810
120930
|
}
|
|
120811
120931
|
function realpathOrSelf(target) {
|
|
120812
120932
|
try {
|
|
120813
|
-
return
|
|
120933
|
+
return import_node_fs19.default.realpathSync(target);
|
|
120814
120934
|
} catch {
|
|
120815
120935
|
return target;
|
|
120816
120936
|
}
|
|
@@ -120822,18 +120942,18 @@ function servingDoorListeners(paths) {
|
|
|
120822
120942
|
}
|
|
120823
120943
|
function collectDoctorReport(params) {
|
|
120824
120944
|
const { paths } = params;
|
|
120825
|
-
const identityNames =
|
|
120945
|
+
const identityNames = import_node_fs19.default.existsSync(paths.identitiesDir) ? import_node_fs19.default.readdirSync(paths.identitiesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && isIdentityDirectoryName(entry.name)).map((entry) => entry.name).sort() : [];
|
|
120826
120946
|
const identities = identityNames.map((name) => {
|
|
120827
120947
|
const farmRoot = import_node_path49.default.join(paths.identitiesDir, name);
|
|
120828
120948
|
const identityPath = import_node_path49.default.join(farmRoot, "identity.json");
|
|
120829
|
-
return { name, path: identityPath, raw: realFsPort.readFileUtf8(identityPath), farmRoot, credentialsFilePresent:
|
|
120949
|
+
return { name, path: identityPath, raw: realFsPort.readFileUtf8(identityPath), farmRoot, credentialsFilePresent: import_node_fs19.default.existsSync(credentialsFilePath(farmRoot)) };
|
|
120830
120950
|
});
|
|
120831
|
-
const profileNames =
|
|
120951
|
+
const profileNames = import_node_fs19.default.existsSync(paths.configProfilesDir) ? import_node_fs19.default.readdirSync(paths.configProfilesDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
|
|
120832
120952
|
const configProfiles = profileNames.map((name) => {
|
|
120833
120953
|
const profilePath = import_node_path49.default.join(paths.configProfilesDir, `${name}.json`);
|
|
120834
120954
|
return { name, path: profilePath, raw: realFsPort.readFileUtf8(profilePath) };
|
|
120835
120955
|
});
|
|
120836
|
-
const providerNames =
|
|
120956
|
+
const providerNames = import_node_fs19.default.existsSync(paths.providersDir) ? import_node_fs19.default.readdirSync(paths.providersDir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".json")).map((entry) => entry.name.slice(0, -".json".length)).sort() : [];
|
|
120837
120957
|
const providers = providerNames.map((name) => {
|
|
120838
120958
|
const providerPath = import_node_path49.default.join(paths.providersDir, `${name}.json`);
|
|
120839
120959
|
return { name, path: providerPath, raw: realFsPort.readFileUtf8(providerPath) };
|
|
@@ -120873,6 +120993,7 @@ function collectDoctorReport(params) {
|
|
|
120873
120993
|
identities,
|
|
120874
120994
|
configProfiles,
|
|
120875
120995
|
providers,
|
|
120996
|
+
providerAliases: readProviderAliases(paths),
|
|
120876
120997
|
directoryRules: { path: paths.directoryRulesFile, raw: realFsPort.readFileUtf8(paths.directoryRulesFile) },
|
|
120877
120998
|
globalConfig: { path: paths.globalConfigFile, raw: realFsPort.readFileUtf8(paths.globalConfigFile) },
|
|
120878
120999
|
models: parsedModelsOf(paths),
|
|
@@ -120880,7 +121001,7 @@ function collectDoctorReport(params) {
|
|
|
120880
121001
|
categoriesLocal: { path: paths.categoriesLocalFile, raw: realFsPort.readFileUtf8(paths.categoriesLocalFile) },
|
|
120881
121002
|
activeIdentity: { path: paths.activeIdentityFile, raw: realFsPort.readFileUtf8(paths.activeIdentityFile) },
|
|
120882
121003
|
binaryDiscovery,
|
|
120883
|
-
claudeShim: { state: shimState, targetExists: shimState !== void 0 &&
|
|
121004
|
+
claudeShim: { state: shimState, targetExists: shimState !== void 0 && import_node_fs19.default.existsSync(shimState.targetPath) },
|
|
120884
121005
|
rootPath: paths.root,
|
|
120885
121006
|
pathResolution: {
|
|
120886
121007
|
ownExecutablePath,
|
|
@@ -121159,11 +121280,11 @@ function tryOrUndefined(fn2) {
|
|
|
121159
121280
|
return void 0;
|
|
121160
121281
|
}
|
|
121161
121282
|
}
|
|
121162
|
-
function pathToHttpPath(
|
|
121163
|
-
return `/${
|
|
121283
|
+
function pathToHttpPath(path66) {
|
|
121284
|
+
return `/${path66.map(safeEncodeURIComponent).join("/")}`;
|
|
121164
121285
|
}
|
|
121165
|
-
function normalizeHttpPath(
|
|
121166
|
-
const paths =
|
|
121286
|
+
function normalizeHttpPath(path66) {
|
|
121287
|
+
const paths = path66.split("/");
|
|
121167
121288
|
if (paths.at(0) === "") {
|
|
121168
121289
|
paths.shift();
|
|
121169
121290
|
}
|
|
@@ -121348,9 +121469,9 @@ function isPlainObject2(value2) {
|
|
|
121348
121469
|
function getOwn(object3, key) {
|
|
121349
121470
|
return Object.hasOwn(object3, key) ? object3[key] : void 0;
|
|
121350
121471
|
}
|
|
121351
|
-
function get(object3,
|
|
121472
|
+
function get(object3, path66) {
|
|
121352
121473
|
let current = object3;
|
|
121353
|
-
for (const key of
|
|
121474
|
+
for (const key of path66) {
|
|
121354
121475
|
if (!isTypescriptObject(current)) {
|
|
121355
121476
|
return void 0;
|
|
121356
121477
|
}
|
|
@@ -122573,7 +122694,7 @@ function resolveClientRest(rest) {
|
|
|
122573
122694
|
// rest[1] can be undefined if all fields of FriendlyClientOptions are optional
|
|
122574
122695
|
];
|
|
122575
122696
|
}
|
|
122576
|
-
function createORPCClient(link, { path:
|
|
122697
|
+
function createORPCClient(link, { path: path66 = [], ...options } = {}) {
|
|
122577
122698
|
const procedureClient = (...rest) => {
|
|
122578
122699
|
const [input2, callOptions] = resolveClientRest(rest);
|
|
122579
122700
|
const interceptors = [
|
|
@@ -122582,7 +122703,7 @@ function createORPCClient(link, { path: path65 = [], ...options } = {}) {
|
|
|
122582
122703
|
];
|
|
122583
122704
|
return intercept(
|
|
122584
122705
|
interceptors,
|
|
122585
|
-
{ ...callOptions, input: input2, path:
|
|
122706
|
+
{ ...callOptions, input: input2, path: path66 },
|
|
122586
122707
|
({ path: path210, input: input22, ...callOptions2 }) => link.call(path210, input22, callOptions2)
|
|
122587
122708
|
);
|
|
122588
122709
|
};
|
|
@@ -122596,7 +122717,7 @@ function createORPCClient(link, { path: path65 = [], ...options } = {}) {
|
|
|
122596
122717
|
if (client === void 0) {
|
|
122597
122718
|
client = createORPCClient(link, {
|
|
122598
122719
|
...options,
|
|
122599
|
-
path: [...
|
|
122720
|
+
path: [...path66, key],
|
|
122600
122721
|
scoped: options.scoped?.[key]
|
|
122601
122722
|
});
|
|
122602
122723
|
cache.set(key, client);
|
|
@@ -122618,24 +122739,24 @@ var BracketNotationSerializer = class {
|
|
|
122618
122739
|
this.internalSerialize(data, "", true, result);
|
|
122619
122740
|
return result;
|
|
122620
122741
|
}
|
|
122621
|
-
internalSerialize(data,
|
|
122742
|
+
internalSerialize(data, path66, isRoot, result) {
|
|
122622
122743
|
if (Array.isArray(data)) {
|
|
122623
122744
|
data.forEach((item, i10) => {
|
|
122624
|
-
this.internalSerialize(item, isRoot ? i10.toString() : `${
|
|
122745
|
+
this.internalSerialize(item, isRoot ? i10.toString() : `${path66}[${i10}]`, false, result);
|
|
122625
122746
|
});
|
|
122626
122747
|
} else if (isPlainObject2(data)) {
|
|
122627
122748
|
for (const key of Object.keys(data)) {
|
|
122628
|
-
this.internalSerialize(data[key], isRoot ? key : `${
|
|
122749
|
+
this.internalSerialize(data[key], isRoot ? key : `${path66}[${key}]`, false, result);
|
|
122629
122750
|
}
|
|
122630
122751
|
} else {
|
|
122631
|
-
result.push([
|
|
122752
|
+
result.push([path66, data]);
|
|
122632
122753
|
}
|
|
122633
122754
|
}
|
|
122634
122755
|
deserialize(serialized) {
|
|
122635
122756
|
const arrayPushStyles = /* @__PURE__ */ new WeakSet();
|
|
122636
122757
|
const root = new NullProtoObj();
|
|
122637
|
-
for (const [
|
|
122638
|
-
const segments = this.parsePath(
|
|
122758
|
+
for (const [path66, value2] of serialized) {
|
|
122759
|
+
const segments = this.parsePath(path66);
|
|
122639
122760
|
let currentRef = root;
|
|
122640
122761
|
let nextSegment = segments[0];
|
|
122641
122762
|
for (let i10 = 1; i10 < segments.length; i10++) {
|
|
@@ -122686,13 +122807,13 @@ var BracketNotationSerializer = class {
|
|
|
122686
122807
|
}
|
|
122687
122808
|
return result;
|
|
122688
122809
|
}
|
|
122689
|
-
parsePath(
|
|
122810
|
+
parsePath(path66) {
|
|
122690
122811
|
const segments = [];
|
|
122691
122812
|
let inBrackets = false;
|
|
122692
122813
|
let currentSegment = "";
|
|
122693
|
-
for (let i10 = 0; i10 <
|
|
122694
|
-
const char =
|
|
122695
|
-
const nextChar =
|
|
122814
|
+
for (let i10 = 0; i10 < path66.length; i10++) {
|
|
122815
|
+
const char = path66[i10];
|
|
122816
|
+
const nextChar = path66[i10 + 1];
|
|
122696
122817
|
if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[")) {
|
|
122697
122818
|
if (nextChar === void 0) {
|
|
122698
122819
|
inBrackets = false;
|
|
@@ -122708,7 +122829,7 @@ var BracketNotationSerializer = class {
|
|
|
122708
122829
|
currentSegment += char;
|
|
122709
122830
|
}
|
|
122710
122831
|
}
|
|
122711
|
-
return inBrackets || segments.length === 0 ? [
|
|
122832
|
+
return inBrackets || segments.length === 0 ? [path66] : segments;
|
|
122712
122833
|
}
|
|
122713
122834
|
};
|
|
122714
122835
|
var INTEGER_PATTERN = /^0$|^[1-9]\d*$/;
|
|
@@ -123281,11 +123402,11 @@ var OpenAPISerializer = class {
|
|
|
123281
123402
|
return json2;
|
|
123282
123403
|
}
|
|
123283
123404
|
const form = new FormData();
|
|
123284
|
-
for (const [
|
|
123405
|
+
for (const [path66, value22] of this.bracketNotation.serialize(json2)) {
|
|
123285
123406
|
if (value22 instanceof Blob) {
|
|
123286
|
-
form.append(
|
|
123407
|
+
form.append(path66, value22);
|
|
123287
123408
|
} else if (value22 !== void 0 && value22 !== null) {
|
|
123288
|
-
form.append(
|
|
123409
|
+
form.append(path66, String(value22));
|
|
123289
123410
|
}
|
|
123290
123411
|
}
|
|
123291
123412
|
return form;
|
|
@@ -123323,30 +123444,30 @@ function isBodylessMethod(method) {
|
|
|
123323
123444
|
return method === "GET" || method === "HEAD";
|
|
123324
123445
|
}
|
|
123325
123446
|
var PARAMETER_NAME_REGEX = /^[\w-]+$/;
|
|
123326
|
-
function getDynamicPathParams(
|
|
123327
|
-
if (!
|
|
123447
|
+
function getDynamicPathParams(path66) {
|
|
123448
|
+
if (!path66.includes("{")) {
|
|
123328
123449
|
return void 0;
|
|
123329
123450
|
}
|
|
123330
|
-
const len =
|
|
123451
|
+
const len = path66.length;
|
|
123331
123452
|
let params;
|
|
123332
123453
|
let index = 1;
|
|
123333
123454
|
while (index < len) {
|
|
123334
123455
|
const segmentStart = index;
|
|
123335
|
-
const slashPos =
|
|
123456
|
+
const slashPos = path66.indexOf("/", index);
|
|
123336
123457
|
const segmentEnd = slashPos === -1 ? len : slashPos;
|
|
123337
|
-
if (segmentEnd > segmentStart &&
|
|
123458
|
+
if (segmentEnd > segmentStart && path66.charCodeAt(segmentStart) === 123 && path66.charCodeAt(segmentEnd - 1) === 125) {
|
|
123338
123459
|
let parameterStart = segmentStart + 1;
|
|
123339
123460
|
let allowsSlash = false;
|
|
123340
|
-
const operator =
|
|
123461
|
+
const operator = path66.charCodeAt(parameterStart);
|
|
123341
123462
|
if (operator === 43) {
|
|
123342
123463
|
allowsSlash = true;
|
|
123343
123464
|
parameterStart++;
|
|
123344
123465
|
}
|
|
123345
|
-
const parameterName =
|
|
123466
|
+
const parameterName = path66.slice(parameterStart, segmentEnd - 1);
|
|
123346
123467
|
if (PARAMETER_NAME_REGEX.test(parameterName)) {
|
|
123347
123468
|
params ??= [];
|
|
123348
123469
|
params.push({
|
|
123349
|
-
segment:
|
|
123470
|
+
segment: path66.slice(segmentStart, segmentEnd),
|
|
123350
123471
|
startIndex: segmentStart,
|
|
123351
123472
|
parameterName,
|
|
123352
123473
|
allowsSlash
|
|
@@ -123389,8 +123510,8 @@ openapi.method = (method) => ({
|
|
|
123389
123510
|
...openapi({ method }),
|
|
123390
123511
|
name: "~openapi/method"
|
|
123391
123512
|
});
|
|
123392
|
-
openapi.path = (
|
|
123393
|
-
...openapi({ path:
|
|
123513
|
+
openapi.path = (path66) => ({
|
|
123514
|
+
...openapi({ path: path66 }),
|
|
123394
123515
|
name: "~openapi/path"
|
|
123395
123516
|
});
|
|
123396
123517
|
openapi.spec = (spec) => ({
|
|
@@ -124251,22 +124372,22 @@ function visitJsonSchemaRefs(value2, visit2, schemaLevel = true, seen = /* @__PU
|
|
|
124251
124372
|
}
|
|
124252
124373
|
}
|
|
124253
124374
|
}
|
|
124254
|
-
function mapJsonSchemaRefs(value2, map2, schemaLevel = true,
|
|
124375
|
+
function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path66 = []) {
|
|
124255
124376
|
if (!value2 || typeof value2 !== "object") {
|
|
124256
124377
|
return value2;
|
|
124257
124378
|
}
|
|
124258
124379
|
if (Array.isArray(value2)) {
|
|
124259
|
-
return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...
|
|
124380
|
+
return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path66, index]));
|
|
124260
124381
|
}
|
|
124261
124382
|
const result = {};
|
|
124262
124383
|
for (const key of Object.keys(value2)) {
|
|
124263
124384
|
const val = value2[key];
|
|
124264
124385
|
if (key === "$ref" && typeof val === "string") {
|
|
124265
|
-
setOwn(result, key, map2(val, [...
|
|
124386
|
+
setOwn(result, key, map2(val, [...path66, key]));
|
|
124266
124387
|
} else if (!schemaLevel) {
|
|
124267
|
-
setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...
|
|
124388
|
+
setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path66, key]));
|
|
124268
124389
|
} else if (JSON_SCHEMA_LOGIC_KEYWORDS.has(key) || JSON_SCHEMA_RECORD_KEYWORDS.has(key)) {
|
|
124269
|
-
setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...
|
|
124390
|
+
setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path66, key]));
|
|
124270
124391
|
} else {
|
|
124271
124392
|
setOwn(result, key, val);
|
|
124272
124393
|
}
|
|
@@ -124796,7 +124917,7 @@ function unlazy(maybeLazy) {
|
|
|
124796
124917
|
function createProcedureClient(lazyableProcedure, ...rest) {
|
|
124797
124918
|
const options = resolveMaybeOptionalOptions(rest);
|
|
124798
124919
|
return async (...[input2, callerOptions]) => {
|
|
124799
|
-
const
|
|
124920
|
+
const path66 = toArray(options.path);
|
|
124800
124921
|
const { default: procedure } = await unlazy(lazyableProcedure);
|
|
124801
124922
|
const clientContext = callerOptions?.context ?? {};
|
|
124802
124923
|
const context = await value(options.context, clientContext) ?? {};
|
|
@@ -124809,7 +124930,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
124809
124930
|
};
|
|
124810
124931
|
try {
|
|
124811
124932
|
const output2 = await runWithSpan("call_procedure", (span) => {
|
|
124812
|
-
span?.setAttribute("procedure.path",
|
|
124933
|
+
span?.setAttribute("procedure.path", path66);
|
|
124813
124934
|
return intercept(
|
|
124814
124935
|
options.interceptors,
|
|
124815
124936
|
{
|
|
@@ -124817,7 +124938,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
124817
124938
|
// input can be optional if it is undefinable
|
|
124818
124939
|
input: input2,
|
|
124819
124940
|
errors,
|
|
124820
|
-
path:
|
|
124941
|
+
path: path66,
|
|
124821
124942
|
procedure,
|
|
124822
124943
|
signal: callerOptions?.signal,
|
|
124823
124944
|
lastEventId: callerOptions?.lastEventId
|
|
@@ -125068,10 +125189,10 @@ function augmentRouter(router, options) {
|
|
|
125068
125189
|
}
|
|
125069
125190
|
return enhanced;
|
|
125070
125191
|
}
|
|
125071
|
-
function getRouter(router,
|
|
125192
|
+
function getRouter(router, path66) {
|
|
125072
125193
|
let current = router;
|
|
125073
|
-
for (let i10 = 0; i10 <
|
|
125074
|
-
const segment =
|
|
125194
|
+
for (let i10 = 0; i10 < path66.length; i10++) {
|
|
125195
|
+
const segment = path66[i10];
|
|
125075
125196
|
if (!isTypescriptObject(current)) {
|
|
125076
125197
|
return void 0;
|
|
125077
125198
|
}
|
|
@@ -125083,7 +125204,7 @@ function getRouter(router, path65) {
|
|
|
125083
125204
|
continue;
|
|
125084
125205
|
}
|
|
125085
125206
|
const lazied = current;
|
|
125086
|
-
const rest =
|
|
125207
|
+
const rest = path66.slice(i10);
|
|
125087
125208
|
return new Lazy({
|
|
125088
125209
|
...lazied["~orpc"],
|
|
125089
125210
|
async loader() {
|
|
@@ -125098,40 +125219,40 @@ function getRouter(router, path65) {
|
|
|
125098
125219
|
}
|
|
125099
125220
|
return current;
|
|
125100
125221
|
}
|
|
125101
|
-
function walkProcedureContractsSync(router, callback,
|
|
125222
|
+
function walkProcedureContractsSync(router, callback, path66 = []) {
|
|
125102
125223
|
const lazyResults = [];
|
|
125103
|
-
walkProcedureContractsSyncInternal(router, callback,
|
|
125224
|
+
walkProcedureContractsSyncInternal(router, callback, path66.slice(), lazyResults);
|
|
125104
125225
|
return lazyResults;
|
|
125105
125226
|
}
|
|
125106
|
-
function walkProcedureContractsSyncInternal(router, callback,
|
|
125227
|
+
function walkProcedureContractsSyncInternal(router, callback, path66, lazyResults) {
|
|
125107
125228
|
const hiddenContract = getHiddenRouterContract(router);
|
|
125108
125229
|
if (hiddenContract !== void 0) {
|
|
125109
125230
|
router = hiddenContract;
|
|
125110
125231
|
}
|
|
125111
125232
|
if (router instanceof ProcedureContract) {
|
|
125112
|
-
callback(router,
|
|
125233
|
+
callback(router, path66.slice());
|
|
125113
125234
|
return;
|
|
125114
125235
|
}
|
|
125115
125236
|
if (!isTypescriptObject(router)) {
|
|
125116
125237
|
return;
|
|
125117
125238
|
}
|
|
125118
125239
|
for (const [key, value2] of Object.entries(router)) {
|
|
125119
|
-
|
|
125240
|
+
path66.push(key);
|
|
125120
125241
|
if (value2 instanceof Lazy) {
|
|
125121
|
-
lazyResults.push({ router: value2, path:
|
|
125242
|
+
lazyResults.push({ router: value2, path: path66.slice() });
|
|
125122
125243
|
} else {
|
|
125123
|
-
walkProcedureContractsSyncInternal(value2, callback,
|
|
125244
|
+
walkProcedureContractsSyncInternal(value2, callback, path66, lazyResults);
|
|
125124
125245
|
}
|
|
125125
|
-
|
|
125246
|
+
path66.pop();
|
|
125126
125247
|
}
|
|
125127
125248
|
}
|
|
125128
|
-
async function walkProcedureContractsAsync(router, callback,
|
|
125249
|
+
async function walkProcedureContractsAsync(router, callback, path66 = []) {
|
|
125129
125250
|
const hiddenContract = getHiddenRouterContract(router);
|
|
125130
125251
|
if (hiddenContract !== void 0) {
|
|
125131
125252
|
router = hiddenContract;
|
|
125132
125253
|
}
|
|
125133
125254
|
if (router instanceof ProcedureContract) {
|
|
125134
|
-
await callback(router,
|
|
125255
|
+
await callback(router, path66);
|
|
125135
125256
|
return;
|
|
125136
125257
|
}
|
|
125137
125258
|
if (!isTypescriptObject(router)) {
|
|
@@ -125140,9 +125261,9 @@ async function walkProcedureContractsAsync(router, callback, path65 = []) {
|
|
|
125140
125261
|
for (const [key, value2] of Object.entries(router)) {
|
|
125141
125262
|
if (value2 instanceof Lazy) {
|
|
125142
125263
|
const { default: router2 } = await unlazy(value2);
|
|
125143
|
-
await walkProcedureContractsAsync(router2, callback, [...
|
|
125264
|
+
await walkProcedureContractsAsync(router2, callback, [...path66, key]);
|
|
125144
125265
|
} else {
|
|
125145
|
-
await walkProcedureContractsAsync(value2, callback, [...
|
|
125266
|
+
await walkProcedureContractsAsync(value2, callback, [...path66, key]);
|
|
125146
125267
|
}
|
|
125147
125268
|
}
|
|
125148
125269
|
}
|
|
@@ -125628,18 +125749,18 @@ function rewriteComponentSchemaRefs(schema, renameMap) {
|
|
|
125628
125749
|
}
|
|
125629
125750
|
var OpenAPIGeneratorError = class extends TypeError {
|
|
125630
125751
|
};
|
|
125631
|
-
function toOpenAPIPath(
|
|
125752
|
+
function toOpenAPIPath(path66, dynamicPathParams) {
|
|
125632
125753
|
if (!dynamicPathParams?.length) {
|
|
125633
|
-
return
|
|
125754
|
+
return path66;
|
|
125634
125755
|
}
|
|
125635
125756
|
let normalized = "";
|
|
125636
125757
|
let currentIndex = 0;
|
|
125637
125758
|
for (const param of dynamicPathParams) {
|
|
125638
|
-
normalized +=
|
|
125759
|
+
normalized += path66.slice(currentIndex, param.startIndex);
|
|
125639
125760
|
normalized += `{${param.parameterName}}`;
|
|
125640
125761
|
currentIndex = param.startIndex + param.segment.length;
|
|
125641
125762
|
}
|
|
125642
|
-
normalized +=
|
|
125763
|
+
normalized += path66.slice(currentIndex);
|
|
125643
125764
|
return normalized;
|
|
125644
125765
|
}
|
|
125645
125766
|
function buildRequest(ctx, operation, def, meta3, dynamicPathParams) {
|
|
@@ -126073,8 +126194,8 @@ var OpenAPIGenerator = class {
|
|
|
126073
126194
|
customErrorResponseBodySchema: options.customErrorResponseBodySchema
|
|
126074
126195
|
};
|
|
126075
126196
|
const errors = [];
|
|
126076
|
-
await walkProcedureContractsAsync(router, (contract,
|
|
126077
|
-
if (value(options.filter, contract,
|
|
126197
|
+
await walkProcedureContractsAsync(router, (contract, path66) => {
|
|
126198
|
+
if (value(options.filter, contract, path66) === false) {
|
|
126078
126199
|
return;
|
|
126079
126200
|
}
|
|
126080
126201
|
try {
|
|
@@ -126086,7 +126207,7 @@ var OpenAPIGenerator = class {
|
|
|
126086
126207
|
`QUERY operations require OpenAPI 3.2, but version "${version2}" was requested.`
|
|
126087
126208
|
);
|
|
126088
126209
|
}
|
|
126089
|
-
const postPath = meta3?.path ?? pathToHttpPath(
|
|
126210
|
+
const postPath = meta3?.path ?? pathToHttpPath(path66);
|
|
126090
126211
|
const httpPath = meta3?.prefix ? mergeHttpPath(meta3.prefix, postPath) : postPath;
|
|
126091
126212
|
const dynamicPathParams = getDynamicPathParams(httpPath);
|
|
126092
126213
|
const openApiPath = toOpenAPIPath(httpPath, dynamicPathParams);
|
|
@@ -126095,7 +126216,7 @@ var OpenAPIGenerator = class {
|
|
|
126095
126216
|
operation = meta3.spec;
|
|
126096
126217
|
} else {
|
|
126097
126218
|
operation = {
|
|
126098
|
-
operationId: meta3?.operationId ??
|
|
126219
|
+
operationId: meta3?.operationId ?? path66.join("."),
|
|
126099
126220
|
summary: meta3?.summary,
|
|
126100
126221
|
description: meta3?.description,
|
|
126101
126222
|
deprecated: meta3?.deprecated,
|
|
@@ -126115,7 +126236,7 @@ var OpenAPIGenerator = class {
|
|
|
126115
126236
|
if (!(e14 instanceof OpenAPIGeneratorError)) {
|
|
126116
126237
|
throw e14;
|
|
126117
126238
|
}
|
|
126118
|
-
errors.push(`Procedure at ${
|
|
126239
|
+
errors.push(`Procedure at ${path66.join(".") || "(root)"}: ${e14.message}`);
|
|
126119
126240
|
}
|
|
126120
126241
|
});
|
|
126121
126242
|
if (errors.length) {
|
|
@@ -126960,16 +127081,16 @@ var StandardLink = class {
|
|
|
126960
127081
|
/**
|
|
126961
127082
|
* @throws ORPCError, transport-level errors (network failures, timeouts, etc.)
|
|
126962
127083
|
*/
|
|
126963
|
-
call(
|
|
126964
|
-
return runWithSpan(`${ORPC_NAME}.${
|
|
127084
|
+
call(path66, input2, options) {
|
|
127085
|
+
return runWithSpan(`${ORPC_NAME}.${path66.join("/")}`, (span) => {
|
|
126965
127086
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
126966
|
-
span?.setAttribute("rpc.method",
|
|
127087
|
+
span?.setAttribute("rpc.method", path66.join("."));
|
|
126967
127088
|
if (getTracer() && isAsyncIteratorObject(input2)) {
|
|
126968
127089
|
input2 = override(input2, traceAsyncIterator("consume_async_iterator_object_input", input2));
|
|
126969
127090
|
} else if (getTracer() && input2 instanceof ReadableStream) {
|
|
126970
127091
|
input2 = override(input2, traceReadableStream("consume_octet_stream_input", input2));
|
|
126971
127092
|
}
|
|
126972
|
-
return intercept(this.interceptors, { ...options, path:
|
|
127093
|
+
return intercept(this.interceptors, { ...options, path: path66, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
|
|
126973
127094
|
const tracer = getTracer();
|
|
126974
127095
|
const activeSpan = tracer?.getActiveSpan() ?? span;
|
|
126975
127096
|
let request7 = await runWithSpan(
|
|
@@ -127026,18 +127147,18 @@ var RPCLinkCodec = class {
|
|
|
127026
127147
|
this.headers = options.headers ?? {};
|
|
127027
127148
|
this.serializer = options.serializer ?? new RPCSerializer();
|
|
127028
127149
|
}
|
|
127029
|
-
async encodeInput(input2,
|
|
127030
|
-
let headers = toResolvedStandardHeaders(await value(this.headers, options,
|
|
127150
|
+
async encodeInput(input2, path66, options) {
|
|
127151
|
+
let headers = toResolvedStandardHeaders(await value(this.headers, options, path66, input2));
|
|
127031
127152
|
if (options.lastEventId !== void 0) {
|
|
127032
127153
|
headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
|
|
127033
127154
|
}
|
|
127034
|
-
const expectedMethod = await value(this.expectedMethod, options,
|
|
127035
|
-
const baseUrl = await value(this.baseUrl, options,
|
|
127155
|
+
const expectedMethod = await value(this.expectedMethod, options, path66, input2);
|
|
127156
|
+
const baseUrl = await value(this.baseUrl, options, path66, input2);
|
|
127036
127157
|
const [pathname, search, hash2] = parseStandardUrl(baseUrl);
|
|
127037
|
-
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(
|
|
127158
|
+
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path66)}`;
|
|
127038
127159
|
const serialized = this.serializer.serialize(input2);
|
|
127039
127160
|
if (expectedMethod === "GET" && !(serialized instanceof Blob) && !(serialized instanceof ReadableStream) && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
|
|
127040
|
-
const maxUrlLength = await value(this.maxUrlLength, options,
|
|
127161
|
+
const maxUrlLength = await value(this.maxUrlLength, options, path66, input2);
|
|
127041
127162
|
const mergedSearch = new URLSearchParams(search);
|
|
127042
127163
|
mergedSearch.append("data", stringifyJSON(serialized) ?? "");
|
|
127043
127164
|
const url22 = `${newPathname}?${mergedSearch}${hash2 ?? ""}`;
|
|
@@ -127122,8 +127243,8 @@ var FetchLinkTransport = class {
|
|
|
127122
127243
|
this.fetch = options.fetch ?? ((url2, init) => globalThis.fetch(url2, init));
|
|
127123
127244
|
this.toFetchRequestOptions = options.toFetchRequest;
|
|
127124
127245
|
}
|
|
127125
|
-
async send(standardRequest,
|
|
127126
|
-
let origin = await value(this.origin, options,
|
|
127246
|
+
async send(standardRequest, path66, options) {
|
|
127247
|
+
let origin = await value(this.origin, options, path66);
|
|
127127
127248
|
if (origin?.endsWith("/")) {
|
|
127128
127249
|
origin = origin.slice(0, -1);
|
|
127129
127250
|
}
|
|
@@ -127143,7 +127264,7 @@ var FetchLinkTransport = class {
|
|
|
127143
127264
|
}
|
|
127144
127265
|
}
|
|
127145
127266
|
const fetch3 = this.fetch;
|
|
127146
|
-
const response = await fetch3(url2, init, options,
|
|
127267
|
+
const response = await fetch3(url2, init, options, path66);
|
|
127147
127268
|
const standardResponse = toStandardLazyResponse(response);
|
|
127148
127269
|
return standardResponse;
|
|
127149
127270
|
}
|
|
@@ -127534,14 +127655,14 @@ var StandardHandler = class {
|
|
|
127534
127655
|
span?.setAttribute("url.path", request22.url);
|
|
127535
127656
|
return { matched: false };
|
|
127536
127657
|
}
|
|
127537
|
-
const { path:
|
|
127538
|
-
span?.updateName(`${ORPC_NAME}.${
|
|
127658
|
+
const { path: path66, procedure, decodeInput } = matchedOrNot;
|
|
127659
|
+
span?.updateName(`${ORPC_NAME}.${path66.join("/")}`);
|
|
127539
127660
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
127540
|
-
span?.setAttribute("rpc.method",
|
|
127661
|
+
span?.setAttribute("rpc.method", path66.join("."));
|
|
127541
127662
|
try {
|
|
127542
127663
|
const response = await intercept(
|
|
127543
127664
|
this.interceptors,
|
|
127544
|
-
{ context: context2, prefix: prefix2, request: request22, path:
|
|
127665
|
+
{ context: context2, prefix: prefix2, request: request22, path: path66, procedure, decodeInput },
|
|
127545
127666
|
async ({ context: context3, prefix: prefix3, request: request32, path: path210, procedure: procedure2, decodeInput: decodeInput2 }) => {
|
|
127546
127667
|
step2 = "decode_input";
|
|
127547
127668
|
let input2 = await runWithSpan("decode_input", decodeInput2);
|
|
@@ -127575,7 +127696,7 @@ var StandardHandler = class {
|
|
|
127575
127696
|
message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
|
|
127576
127697
|
cause: e14
|
|
127577
127698
|
}) : toORPCError(e14);
|
|
127578
|
-
const response = await this.codec.encodeError(error63, procedure,
|
|
127699
|
+
const response = await this.codec.encodeError(error63, procedure, path66, { context: context2, prefix: prefix2 });
|
|
127579
127700
|
return { matched: true, response };
|
|
127580
127701
|
}
|
|
127581
127702
|
}
|
|
@@ -127681,7 +127802,7 @@ var RPCMatcher = class {
|
|
|
127681
127802
|
this.rootRouter = router;
|
|
127682
127803
|
this.index(router);
|
|
127683
127804
|
}
|
|
127684
|
-
index(router,
|
|
127805
|
+
index(router, path66 = []) {
|
|
127685
127806
|
const lazyResults = walkProcedureContractsSync(router, (procedure, procedurePath) => {
|
|
127686
127807
|
if (!value(this.filter, procedure, procedurePath)) {
|
|
127687
127808
|
return;
|
|
@@ -127692,7 +127813,7 @@ var RPCMatcher = class {
|
|
|
127692
127813
|
// contract-first entries have no implementation yet, resolveProcedure fills it in on demand
|
|
127693
127814
|
procedure: procedure instanceof Procedure ? procedure : void 0
|
|
127694
127815
|
});
|
|
127695
|
-
},
|
|
127816
|
+
}, path66);
|
|
127696
127817
|
for (const result of lazyResults) {
|
|
127697
127818
|
this.pendingLazyRouters.set(pathToHttpPath(result.path), result);
|
|
127698
127819
|
}
|
|
@@ -127824,10 +127945,10 @@ var RPCHandlerCodec = class {
|
|
|
127824
127945
|
}
|
|
127825
127946
|
};
|
|
127826
127947
|
}
|
|
127827
|
-
encodeOutput(output2, procedure,
|
|
127948
|
+
encodeOutput(output2, procedure, path66, options) {
|
|
127828
127949
|
return {
|
|
127829
127950
|
headers: {},
|
|
127830
|
-
status: value(this.outputStatus, output2, procedure,
|
|
127951
|
+
status: value(this.outputStatus, output2, procedure, path66, options) ?? DEFAULT_SUCCESS_STATUS,
|
|
127831
127952
|
body: this.serializer.serialize(output2)
|
|
127832
127953
|
};
|
|
127833
127954
|
}
|
|
@@ -127881,39 +128002,39 @@ function createRouter() {
|
|
|
127881
128002
|
static: new NullProtoObj2()
|
|
127882
128003
|
};
|
|
127883
128004
|
}
|
|
127884
|
-
function scanFirstGroup(
|
|
128005
|
+
function scanFirstGroup(path66) {
|
|
127885
128006
|
let i10 = 0;
|
|
127886
128007
|
let depth = 0;
|
|
127887
|
-
for (; i10 <
|
|
127888
|
-
const c10 =
|
|
128008
|
+
for (; i10 < path66.length; i10++) {
|
|
128009
|
+
const c10 = path66.charCodeAt(i10);
|
|
127889
128010
|
if (c10 === 92) i10++;
|
|
127890
128011
|
else if (c10 === 40) depth++;
|
|
127891
128012
|
else if (c10 === 41 && depth > 0) depth--;
|
|
127892
128013
|
else if (c10 === 123 && depth === 0) break;
|
|
127893
128014
|
}
|
|
127894
|
-
if (i10 >=
|
|
128015
|
+
if (i10 >= path66.length) return;
|
|
127895
128016
|
let j10 = i10 + 1;
|
|
127896
128017
|
depth = 0;
|
|
127897
|
-
for (; j10 <
|
|
127898
|
-
const c10 =
|
|
128018
|
+
for (; j10 < path66.length; j10++) {
|
|
128019
|
+
const c10 = path66.charCodeAt(j10);
|
|
127899
128020
|
if (c10 === 92) j10++;
|
|
127900
128021
|
else if (c10 === 40) depth++;
|
|
127901
128022
|
else if (c10 === 41 && depth > 0) depth--;
|
|
127902
128023
|
else if (c10 === 125 && depth === 0) break;
|
|
127903
128024
|
}
|
|
127904
|
-
if (j10 >=
|
|
127905
|
-
const mod =
|
|
128025
|
+
if (j10 >= path66.length) return;
|
|
128026
|
+
const mod = path66[j10 + 1];
|
|
127906
128027
|
const hasMod = mod === "?" || mod === "+" || mod === "*";
|
|
127907
128028
|
return [
|
|
127908
|
-
|
|
127909
|
-
|
|
127910
|
-
|
|
128029
|
+
path66.slice(0, i10),
|
|
128030
|
+
path66.slice(i10 + 1, j10),
|
|
128031
|
+
path66.slice(j10 + (hasMod ? 2 : 1)),
|
|
127911
128032
|
hasMod ? mod : void 0
|
|
127912
128033
|
];
|
|
127913
128034
|
}
|
|
127914
|
-
function expandGroupDelimiters(
|
|
127915
|
-
if (!
|
|
127916
|
-
const group = scanFirstGroup(
|
|
128035
|
+
function expandGroupDelimiters(path66) {
|
|
128036
|
+
if (!path66.includes("{")) return;
|
|
128037
|
+
const group = scanFirstGroup(path66);
|
|
127917
128038
|
if (!group) return;
|
|
127918
128039
|
const [pre2, body, suf, mod] = group;
|
|
127919
128040
|
if (!mod) return [pre2 + body + suf];
|
|
@@ -127983,9 +128104,9 @@ function replaceSegmentWildcards(segment, unnamedStart, toGroupKey = toUnnamedGr
|
|
|
127983
128104
|
}
|
|
127984
128105
|
return [replaced, nextIndex];
|
|
127985
128106
|
}
|
|
127986
|
-
function encodeEscapes(
|
|
127987
|
-
if (!
|
|
127988
|
-
return
|
|
128107
|
+
function encodeEscapes(path66) {
|
|
128108
|
+
if (!path66.includes("\\")) return path66;
|
|
128109
|
+
return path66.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
|
|
127989
128110
|
}
|
|
127990
128111
|
function segmentKey(segment) {
|
|
127991
128112
|
if (segment.startsWith("**")) return 2;
|
|
@@ -128014,22 +128135,22 @@ function expandModifiers(segments) {
|
|
|
128014
128135
|
return m10[2] === "+" ? [wc2] : [wc2, without];
|
|
128015
128136
|
}
|
|
128016
128137
|
}
|
|
128017
|
-
function normalizePath(
|
|
128018
|
-
if (!
|
|
128138
|
+
function normalizePath(path66) {
|
|
128139
|
+
if (!path66.includes("/.")) return path66;
|
|
128019
128140
|
const r10 = [];
|
|
128020
|
-
for (const s of
|
|
128141
|
+
for (const s of path66.split("/")) if (s === ".") continue;
|
|
128021
128142
|
else if (s === ".." && r10.length > 1) r10.pop();
|
|
128022
128143
|
else r10.push(s);
|
|
128023
128144
|
return r10.join("/") || "/";
|
|
128024
128145
|
}
|
|
128025
|
-
function splitPath(
|
|
128026
|
-
const s =
|
|
128146
|
+
function splitPath(path66) {
|
|
128147
|
+
const s = path66.split("/");
|
|
128027
128148
|
s.shift();
|
|
128028
128149
|
if (s[s.length - 1] === "") s.pop();
|
|
128029
128150
|
return s;
|
|
128030
128151
|
}
|
|
128031
|
-
function splitRoute(
|
|
128032
|
-
const s = splitPath(
|
|
128152
|
+
function splitRoute(path66) {
|
|
128153
|
+
const s = splitPath(path66);
|
|
128033
128154
|
while (s[s.length - 1] === "") s.pop();
|
|
128034
128155
|
return s;
|
|
128035
128156
|
}
|
|
@@ -128045,16 +128166,16 @@ function getMatchParams(segments, paramsMap) {
|
|
|
128045
128166
|
}
|
|
128046
128167
|
return params;
|
|
128047
128168
|
}
|
|
128048
|
-
function addRoute(ctx, method = "",
|
|
128169
|
+
function addRoute(ctx, method = "", path66, data) {
|
|
128049
128170
|
method = method.toUpperCase();
|
|
128050
|
-
if (
|
|
128051
|
-
const groupExpanded = expandGroupDelimiters(
|
|
128171
|
+
if (path66.charCodeAt(0) !== 47) path66 = `/${path66}`;
|
|
128172
|
+
const groupExpanded = expandGroupDelimiters(path66);
|
|
128052
128173
|
if (groupExpanded) {
|
|
128053
128174
|
for (const expandedPath of groupExpanded) addRoute(ctx, method, expandedPath, data);
|
|
128054
128175
|
return;
|
|
128055
128176
|
}
|
|
128056
|
-
|
|
128057
|
-
const segments = splitRoute(
|
|
128177
|
+
path66 = encodeEscapes(path66);
|
|
128178
|
+
const segments = splitRoute(path66);
|
|
128058
128179
|
const expanded = expandModifiers(segments);
|
|
128059
128180
|
if (expanded) {
|
|
128060
128181
|
for (const p of expanded) addRoute(ctx, method, p, data);
|
|
@@ -128145,15 +128266,15 @@ function getParamRegexp(segment, unnamedStart = 0) {
|
|
|
128145
128266
|
const regex = _s2.replace(/:([\w-]+)(?:\(([^)]*)\))?/g, (_, id2, p) => `(?<${toGroupName(id2)}>${p || "[^/]+"})`).replace(/\((?![?<])/g, () => `(?<${toUnnamedGroupKey(_i2++)}>`).replace(/\uFFFE(.)/g, (_, c10) => /[.*+?^${}()|[\]\\]/.test(c10) ? `\\${c10}` : c10);
|
|
128146
128267
|
return [new RegExp(`^${regex}$`), _i2];
|
|
128147
128268
|
}
|
|
128148
|
-
function findRoute(ctx, method = "",
|
|
128149
|
-
if (opts?.normalize)
|
|
128150
|
-
if (
|
|
128151
|
-
const staticNode = ctx.static[
|
|
128269
|
+
function findRoute(ctx, method = "", path66, opts) {
|
|
128270
|
+
if (opts?.normalize) path66 = normalizePath(path66);
|
|
128271
|
+
if (path66.charCodeAt(path66.length - 1) === 47) path66 = path66.slice(0, -1);
|
|
128272
|
+
const staticNode = ctx.static[path66];
|
|
128152
128273
|
if (staticNode && staticNode.methods) {
|
|
128153
128274
|
const staticMatch = staticNode.methods[method] || staticNode.methods[""];
|
|
128154
128275
|
if (staticMatch !== void 0) return staticMatch[0];
|
|
128155
128276
|
}
|
|
128156
|
-
const segments = splitPath(
|
|
128277
|
+
const segments = splitPath(path66);
|
|
128157
128278
|
const match = _lookupTree(ctx.root, method, segments, 0);
|
|
128158
128279
|
if (match === void 0) return;
|
|
128159
128280
|
if (opts?.params === false) return match;
|
|
@@ -128353,7 +128474,7 @@ var OpenAPIMatcher = class {
|
|
|
128353
128474
|
this.rootRouter = router;
|
|
128354
128475
|
this.index(router);
|
|
128355
128476
|
}
|
|
128356
|
-
index(router,
|
|
128477
|
+
index(router, path66 = []) {
|
|
128357
128478
|
const lazyResults = walkProcedureContractsSync(router, (contract, path210) => {
|
|
128358
128479
|
if (!value(this.filter, contract, path210)) {
|
|
128359
128480
|
return;
|
|
@@ -128368,7 +128489,7 @@ var OpenAPIMatcher = class {
|
|
|
128368
128489
|
contract,
|
|
128369
128490
|
procedure: contract instanceof Procedure ? contract : void 0
|
|
128370
128491
|
});
|
|
128371
|
-
},
|
|
128492
|
+
}, path66);
|
|
128372
128493
|
for (const result of lazyResults) {
|
|
128373
128494
|
const prefix = getOpenAPIMeta(result.router)?.prefix;
|
|
128374
128495
|
this.pendingLazyRouters.add({
|
|
@@ -128455,20 +128576,20 @@ var OpenAPIMatcher = class {
|
|
|
128455
128576
|
return entry.procedure;
|
|
128456
128577
|
}
|
|
128457
128578
|
};
|
|
128458
|
-
function toRou3Pattern(
|
|
128459
|
-
const params = getDynamicPathParams(
|
|
128579
|
+
function toRou3Pattern(path66) {
|
|
128580
|
+
const params = getDynamicPathParams(path66);
|
|
128460
128581
|
if (!params?.length) {
|
|
128461
|
-
return
|
|
128582
|
+
return path66;
|
|
128462
128583
|
}
|
|
128463
128584
|
for (let i10 = params.length - 1; i10 >= 0; i10--) {
|
|
128464
128585
|
const param = params[i10];
|
|
128465
128586
|
const pattern = param.allowsSlash ? `**:${param.parameterName}` : `:${param.parameterName}`;
|
|
128466
|
-
|
|
128587
|
+
path66 = path66.slice(0, param.startIndex) + pattern + path66.slice(param.startIndex + param.segment.length);
|
|
128467
128588
|
}
|
|
128468
|
-
return
|
|
128589
|
+
return path66;
|
|
128469
128590
|
}
|
|
128470
|
-
function toRou3PrefixMatcher(
|
|
128471
|
-
const pattern = toRou3Pattern(
|
|
128591
|
+
function toRou3PrefixMatcher(path66) {
|
|
128592
|
+
const pattern = toRou3Pattern(path66);
|
|
128472
128593
|
return routeToRegExp(pattern === "/" ? "/**" : `${pattern}/**`);
|
|
128473
128594
|
}
|
|
128474
128595
|
function decodeParams(params) {
|
|
@@ -128547,7 +128668,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
128547
128668
|
/**
|
|
128548
128669
|
* @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
|
|
128549
128670
|
*/
|
|
128550
|
-
encodeOutput(output2, procedure,
|
|
128671
|
+
encodeOutput(output2, procedure, path66) {
|
|
128551
128672
|
const meta3 = getOpenAPIMeta(procedure);
|
|
128552
128673
|
const successStatus = meta3?.successStatus ?? DEFAULT_SUCCESS_STATUS;
|
|
128553
128674
|
const outputStructure = meta3?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
|
|
@@ -128560,7 +128681,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
128560
128681
|
}
|
|
128561
128682
|
if (!isValidDetailedOutput(output2)) {
|
|
128562
128683
|
throw new TypeError(`
|
|
128563
|
-
Invalid "detailed" output structure returned by procedure (${
|
|
128684
|
+
Invalid "detailed" output structure returned by procedure (${path66.join(".")}):
|
|
128564
128685
|
\u2022 Expected an object with optional properties:
|
|
128565
128686
|
- status (number <400)
|
|
128566
128687
|
- headers (object)
|
|
@@ -129122,7 +129243,7 @@ function profileValue(name, paths) {
|
|
|
129122
129243
|
function createConfigApiRouter(deps) {
|
|
129123
129244
|
const authed = doorApiAuth(deps.expectedToken);
|
|
129124
129245
|
const { paths } = deps;
|
|
129125
|
-
const route = (
|
|
129246
|
+
const route = (path66, summary) => authed.meta(openapi({ method: "POST", path: path66, summary, tags: [CONFIG_API_TAG] }));
|
|
129126
129247
|
return {
|
|
129127
129248
|
config: {
|
|
129128
129249
|
identity: {
|
|
@@ -130471,9 +130592,11 @@ function createRoutedResponse(response, context) {
|
|
|
130471
130592
|
}
|
|
130472
130593
|
};
|
|
130473
130594
|
}
|
|
130474
|
-
async function serveRouted(
|
|
130595
|
+
async function serveRouted(incoming, deps) {
|
|
130596
|
+
const request7 = { ...incoming, url: withCanonicalProviderTarget(incoming.url, deps.canonicalProvider) };
|
|
130475
130597
|
const observed = { method: request7.method, path: pathOf(request7.url), receivedAt: deps.now(), viaHeadroom: false, thread: { lineage: void 0 }, modelChoice: { value: void 0 }, requestedModel: { value: void 0 } };
|
|
130476
|
-
const
|
|
130598
|
+
const identity = identifyRequest(request7.headers);
|
|
130599
|
+
const identified = { ...identity, session: { ...identity.session, provider: identity.session.provider === void 0 ? void 0 : deps.canonicalProvider(identity.session.provider) } };
|
|
130477
130600
|
const admission = deps.admit({ url: request7.url, headers: request7.headers, forwardable: identified.forwardableHeaders });
|
|
130478
130601
|
if (!admission.ok) {
|
|
130479
130602
|
const response2 = createRoutedResponse(request7.response, { deps, session: identified.session, route: "(unauthorized)", request: observed, servedPath: observed.path });
|
|
@@ -131117,8 +131240,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
|
|
|
131117
131240
|
request7.body.resume();
|
|
131118
131241
|
return;
|
|
131119
131242
|
}
|
|
131120
|
-
const
|
|
131121
|
-
const translated = { method: request7.method, path:
|
|
131243
|
+
const path66 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
131244
|
+
const translated = { method: request7.method, path: path66, body, signal: request7.signal };
|
|
131122
131245
|
const routed = await route(translated);
|
|
131123
131246
|
if (request7.signal.aborted) {
|
|
131124
131247
|
return;
|
|
@@ -131739,8 +131862,8 @@ function createAntigravityRouteMount(ports, upstreamBase, provider) {
|
|
|
131739
131862
|
request7.body.resume();
|
|
131740
131863
|
return;
|
|
131741
131864
|
}
|
|
131742
|
-
const
|
|
131743
|
-
const translated = { method: request7.method, path:
|
|
131865
|
+
const path66 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
131866
|
+
const translated = { method: request7.method, path: path66, body, signal: request7.signal };
|
|
131744
131867
|
const routed = await route(translated);
|
|
131745
131868
|
if (request7.signal.aborted) {
|
|
131746
131869
|
return;
|
|
@@ -131777,7 +131900,7 @@ function createPassthroughRoute(name, target) {
|
|
|
131777
131900
|
headroomUpstream: target.headroomUpstream,
|
|
131778
131901
|
serve: async (request7, response) => {
|
|
131779
131902
|
const incoming = new URL(request7.url, "http://127.0.0.1");
|
|
131780
|
-
const
|
|
131903
|
+
const path66 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
|
|
131781
131904
|
const headers = forwardableHeaders(request7.headers);
|
|
131782
131905
|
delete headers.host;
|
|
131783
131906
|
await new Promise((resolve2) => {
|
|
@@ -131785,7 +131908,7 @@ function createPassthroughRoute(name, target) {
|
|
|
131785
131908
|
host: base.hostname,
|
|
131786
131909
|
port: base.port === "" ? void 0 : Number(base.port),
|
|
131787
131910
|
method: request7.method,
|
|
131788
|
-
path: `${basePath}${
|
|
131911
|
+
path: `${basePath}${path66}${incoming.search}`,
|
|
131789
131912
|
headers,
|
|
131790
131913
|
agent
|
|
131791
131914
|
};
|
|
@@ -131957,13 +132080,13 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
131957
132080
|
}
|
|
131958
132081
|
|
|
131959
132082
|
// src/frontdoor/providerRoute.ts
|
|
131960
|
-
var isRcSelfHostPath = (
|
|
132083
|
+
var isRcSelfHostPath = (path66) => path66 === "/v1/code/sessions" || path66.startsWith("/v1/code/sessions/") || path66 === "/v1/sessions" || path66.startsWith("/v1/sessions/");
|
|
131961
132084
|
function scopeSessionProviderPath(request7) {
|
|
131962
132085
|
if (request7.session.provider === void 0) {
|
|
131963
132086
|
return request7;
|
|
131964
132087
|
}
|
|
131965
|
-
const
|
|
131966
|
-
if (!
|
|
132088
|
+
const path66 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
132089
|
+
if (!path66.startsWith("/v1/") || isRcSelfHostPath(path66)) {
|
|
131967
132090
|
return request7;
|
|
131968
132091
|
}
|
|
131969
132092
|
return { ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` };
|
|
@@ -132086,13 +132209,13 @@ function createProviderRouteResolver(deps) {
|
|
|
132086
132209
|
return route;
|
|
132087
132210
|
};
|
|
132088
132211
|
const resolve2 = (request7) => {
|
|
132089
|
-
const
|
|
132090
|
-
const scoped = parseProviderPath(
|
|
132212
|
+
const path66 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
132213
|
+
const scoped = parseProviderPath(path66);
|
|
132091
132214
|
if (scoped === void 0) {
|
|
132092
|
-
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(
|
|
132215
|
+
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path66)) {
|
|
132093
132216
|
return { ok: true, route: deps.rcSelfHostRoute };
|
|
132094
132217
|
}
|
|
132095
|
-
return
|
|
132218
|
+
return path66.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path66}` };
|
|
132096
132219
|
}
|
|
132097
132220
|
const { provider } = scoped;
|
|
132098
132221
|
let definition;
|
|
@@ -132184,8 +132307,8 @@ function createProviderRouteResolver(deps) {
|
|
|
132184
132307
|
let modelChoice;
|
|
132185
132308
|
const visited = /* @__PURE__ */ new Set();
|
|
132186
132309
|
for (; ; ) {
|
|
132187
|
-
const
|
|
132188
|
-
const scoped = parseProviderPath(
|
|
132310
|
+
const path66 = new URL(current.url, "http://127.0.0.1").pathname;
|
|
132311
|
+
const scoped = parseProviderPath(path66);
|
|
132189
132312
|
const providerName = scoped?.provider ?? current.session.provider;
|
|
132190
132313
|
if (providerName !== void 0 && visited.has(providerName)) {
|
|
132191
132314
|
return { ok: false, status: HTTP_STATUS.internalServerError, message: `provider routing cycle: ${[...visited, providerName].join(" -> ")}` };
|
|
@@ -132200,7 +132323,7 @@ function createProviderRouteResolver(deps) {
|
|
|
132200
132323
|
} catch {
|
|
132201
132324
|
routes = void 0;
|
|
132202
132325
|
}
|
|
132203
|
-
const resolvesNames = !nameResolved && !isRcSelfHostPath(
|
|
132326
|
+
const resolvesNames = !nameResolved && !isRcSelfHostPath(path66);
|
|
132204
132327
|
if (resolvesNames) {
|
|
132205
132328
|
const scan2 = await scanRequestHead(current, true);
|
|
132206
132329
|
if (scan2.replayed === void 0) {
|
|
@@ -132239,7 +132362,7 @@ function createProviderRouteResolver(deps) {
|
|
|
132239
132362
|
}
|
|
132240
132363
|
if (routed.provider !== providerName) {
|
|
132241
132364
|
const scopedPrefix = providerName === void 0 ? void 0 : `${PROVIDER_PATH_PREFIX}${encodeURIComponent(providerName)}`;
|
|
132242
|
-
const rest2 = scopedPrefix !== void 0 &&
|
|
132365
|
+
const rest2 = scopedPrefix !== void 0 && path66.startsWith(scopedPrefix) ? path66.slice(scopedPrefix.length) : path66;
|
|
132243
132366
|
const query2 = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
|
|
132244
132367
|
const carried = replay;
|
|
132245
132368
|
current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(routed.provider)}${rest2}${query2}`, body: carried.body, headers: carried.headers };
|
|
@@ -132293,7 +132416,7 @@ function createProviderRouteResolver(deps) {
|
|
|
132293
132416
|
const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
|
|
132294
132417
|
replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
|
|
132295
132418
|
}
|
|
132296
|
-
const rest = scoped === void 0 ?
|
|
132419
|
+
const rest = scoped === void 0 ? path66 : path66.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
|
|
132297
132420
|
const query = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
|
|
132298
132421
|
current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(matched.provider)}${rest}${query}`, body: replay.body, headers: replay.headers };
|
|
132299
132422
|
}
|
|
@@ -132517,8 +132640,8 @@ var SELF_HOST_SUBSCRIPTION_TYPE = "max";
|
|
|
132517
132640
|
function isRecord16(value2) {
|
|
132518
132641
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
132519
132642
|
}
|
|
132520
|
-
function readJsonObject(
|
|
132521
|
-
const raw =
|
|
132643
|
+
function readJsonObject(fs28, file2) {
|
|
132644
|
+
const raw = fs28.readFileUtf8(file2);
|
|
132522
132645
|
if (raw === void 0) {
|
|
132523
132646
|
return void 0;
|
|
132524
132647
|
}
|
|
@@ -132530,8 +132653,8 @@ function readJsonObject(fs26, file2) {
|
|
|
132530
132653
|
}
|
|
132531
132654
|
return isRecord16(parsed) ? parsed : void 0;
|
|
132532
132655
|
}
|
|
132533
|
-
function readRcSelfHostRecord(
|
|
132534
|
-
const parsed = readJsonObject(
|
|
132656
|
+
function readRcSelfHostRecord(fs28, frontdoorDir) {
|
|
132657
|
+
const parsed = readJsonObject(fs28, import_node_path52.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
|
|
132535
132658
|
if (parsed === void 0) {
|
|
132536
132659
|
return void 0;
|
|
132537
132660
|
}
|
|
@@ -132976,11 +133099,11 @@ function credentialOfJson(parsed) {
|
|
|
132976
133099
|
function sequenceNumOfJson(value2) {
|
|
132977
133100
|
return typeof value2 === "number" && Number.isInteger(value2) && value2 >= 0 ? value2 : void 0;
|
|
132978
133101
|
}
|
|
132979
|
-
function createRcCredentialStore(
|
|
132980
|
-
|
|
133102
|
+
function createRcCredentialStore(fs28, dir) {
|
|
133103
|
+
fs28.mkdirPrivate(dir);
|
|
132981
133104
|
const fileFor = (sessionId) => import_node_path53.default.join(dir, `${sessionId}.json`);
|
|
132982
133105
|
const readParsed = (sessionId) => {
|
|
132983
|
-
const raw =
|
|
133106
|
+
const raw = fs28.readFileUtf8(fileFor(sessionId));
|
|
132984
133107
|
if (raw === void 0) {
|
|
132985
133108
|
return void 0;
|
|
132986
133109
|
}
|
|
@@ -133005,7 +133128,7 @@ function createRcCredentialStore(fs26, dir) {
|
|
|
133005
133128
|
}
|
|
133006
133129
|
const cursor3 = sequenceNumOfJson(readParsed(sessionId)?.highestSequenceNum);
|
|
133007
133130
|
const record2 = { ...credential, ...cursor3 === void 0 ? {} : { highestSequenceNum: cursor3 } };
|
|
133008
|
-
|
|
133131
|
+
fs28.writeFilePrivate(fileFor(sessionId), `${JSON.stringify(record2, null, 2)}
|
|
133009
133132
|
`);
|
|
133010
133133
|
},
|
|
133011
133134
|
readCursor: (sessionId) => {
|
|
@@ -133020,14 +133143,14 @@ function createRcCredentialStore(fs26, dir) {
|
|
|
133020
133143
|
}
|
|
133021
133144
|
const credential = credentialOfJson(readParsed(sessionId));
|
|
133022
133145
|
const record2 = credential === void 0 ? { highestSequenceNum } : { ...credential, highestSequenceNum };
|
|
133023
|
-
|
|
133146
|
+
fs28.writeFilePrivate(fileFor(sessionId), `${JSON.stringify(record2, null, 2)}
|
|
133024
133147
|
`);
|
|
133025
133148
|
},
|
|
133026
133149
|
remove: (sessionId) => {
|
|
133027
133150
|
if (!isSafeSessionId(sessionId)) {
|
|
133028
133151
|
return;
|
|
133029
133152
|
}
|
|
133030
|
-
|
|
133153
|
+
fs28.removeRecursive(fileFor(sessionId));
|
|
133031
133154
|
}
|
|
133032
133155
|
};
|
|
133033
133156
|
}
|
|
@@ -135372,8 +135495,8 @@ function respawnInvocation(paths) {
|
|
|
135372
135495
|
return { ...selfInvocation(["__frontdoor-supervisor"]), env };
|
|
135373
135496
|
}
|
|
135374
135497
|
function appendLog(paths, line) {
|
|
135375
|
-
|
|
135376
|
-
|
|
135498
|
+
import_node_fs20.default.mkdirSync(paths.logsDir, { recursive: true });
|
|
135499
|
+
import_node_fs20.default.appendFileSync(paths.frontdoorLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
|
|
135377
135500
|
`);
|
|
135378
135501
|
}
|
|
135379
135502
|
function rcObservingResolver(resolve2, tracker, hub) {
|
|
@@ -135386,7 +135509,7 @@ function rcObservingResolver(resolve2, tracker, hub) {
|
|
|
135386
135509
|
}
|
|
135387
135510
|
function realStatOwnExecutable(watchPath) {
|
|
135388
135511
|
return () => {
|
|
135389
|
-
const st2 =
|
|
135512
|
+
const st2 = import_node_fs20.default.statSync(watchPath, { throwIfNoEntry: false });
|
|
135390
135513
|
return st2?.isFile() !== true ? void 0 : { dev: st2.dev, ino: st2.ino, size: st2.size, mtimeMs: st2.mtimeMs };
|
|
135391
135514
|
};
|
|
135392
135515
|
}
|
|
@@ -135592,9 +135715,15 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration) {
|
|
|
135592
135715
|
now: () => Date.now(),
|
|
135593
135716
|
log
|
|
135594
135717
|
});
|
|
135718
|
+
const canonicalProvider = createProviderCanonicaliser({
|
|
135719
|
+
defined: (name) => realFarmFs.lstat(import_node_path54.default.join(paths.providersDir, `${name}.json`)) !== void 0,
|
|
135720
|
+
aliases: () => loadProviderAliases(paths.providerAliasesFile, realFsPort),
|
|
135721
|
+
log
|
|
135722
|
+
});
|
|
135595
135723
|
const pipelines = createDoorPipelines({
|
|
135596
135724
|
resolveRoute,
|
|
135597
135725
|
isLiveToken,
|
|
135726
|
+
canonicalProvider,
|
|
135598
135727
|
responseObservers: [usageMiddleware],
|
|
135599
135728
|
now: () => Date.now(),
|
|
135600
135729
|
headroomSocket: () => headroomSocketTarget(realFarmFs, realHeadroomSocketTrust, paths),
|
|
@@ -135620,7 +135749,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration) {
|
|
|
135620
135749
|
},
|
|
135621
135750
|
isRunning: realIsProcessRunning,
|
|
135622
135751
|
// The turnover check's file identity, over the installed entry resolved once at door start: re-resolving per tick would re-run the PATH scan every second and could theoretically flip between two files, while the entry itself is fixed for as long as this door lives. The existence check prefers the agent-shim sibling only when it is really there (see watchedInstallEntry).
|
|
135623
|
-
statOwnExecutable: realStatOwnExecutable(watchedInstallEntry(realOwnExecutablePath(), (candidate) =>
|
|
135752
|
+
statOwnExecutable: realStatOwnExecutable(watchedInstallEntry(realOwnExecutablePath(), (candidate) => import_node_fs20.default.existsSync(candidate))),
|
|
135624
135753
|
startProviderListener: async (preferredPort) => {
|
|
135625
135754
|
const authority = loadCa();
|
|
135626
135755
|
const rcDial = rcSelfHost ? lateRcEventDial(rcSelfHostDialTarget) : realRcEventDial();
|
|
@@ -135895,8 +136024,8 @@ function isAntigravityPayload(payload) {
|
|
|
135895
136024
|
return typeof payload === "object" && payload !== null && "product" in payload && payload.product === "antigravity";
|
|
135896
136025
|
}
|
|
135897
136026
|
var ANTIGRAVITY_SETTINGS_SEGMENTS = [".gemini", "antigravity-cli", "settings.json"];
|
|
135898
|
-
function antigravityStacksWithDefault(
|
|
135899
|
-
const raw =
|
|
136027
|
+
function antigravityStacksWithDefault(fs28, homeDir) {
|
|
136028
|
+
const raw = fs28.readFileUtf8(import_node_path55.default.join(homeDir, ...ANTIGRAVITY_SETTINGS_SEGMENTS));
|
|
135900
136029
|
if (raw === void 0) {
|
|
135901
136030
|
return false;
|
|
135902
136031
|
}
|
|
@@ -138701,8 +138830,8 @@ function getErrorMap2() {
|
|
|
138701
138830
|
|
|
138702
138831
|
// node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/helpers/parseUtil.js
|
|
138703
138832
|
var makeIssue = (params) => {
|
|
138704
|
-
const { data, path:
|
|
138705
|
-
const fullPath = [...
|
|
138833
|
+
const { data, path: path66, errorMaps, issueData } = params;
|
|
138834
|
+
const fullPath = [...path66, ...issueData.path || []];
|
|
138706
138835
|
const fullIssue = {
|
|
138707
138836
|
...issueData,
|
|
138708
138837
|
path: fullPath
|
|
@@ -138817,11 +138946,11 @@ var errorUtil;
|
|
|
138817
138946
|
|
|
138818
138947
|
// node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/types.js
|
|
138819
138948
|
var ParseInputLazyPath = class {
|
|
138820
|
-
constructor(parent, value2,
|
|
138949
|
+
constructor(parent, value2, path66, key) {
|
|
138821
138950
|
this._cachedPath = [];
|
|
138822
138951
|
this.parent = parent;
|
|
138823
138952
|
this.data = value2;
|
|
138824
|
-
this._path =
|
|
138953
|
+
this._path = path66;
|
|
138825
138954
|
this._key = key;
|
|
138826
138955
|
}
|
|
138827
138956
|
get path() {
|
|
@@ -142384,11 +142513,11 @@ function normalizeObjectSchema(schema) {
|
|
|
142384
142513
|
}
|
|
142385
142514
|
return void 0;
|
|
142386
142515
|
}
|
|
142387
|
-
function getDotPath(
|
|
142388
|
-
if (
|
|
142516
|
+
function getDotPath(path66) {
|
|
142517
|
+
if (path66.length === 0) {
|
|
142389
142518
|
return "object root";
|
|
142390
142519
|
}
|
|
142391
|
-
return
|
|
142520
|
+
return path66.reduce((acc, seg, index) => {
|
|
142392
142521
|
if (index === 0) {
|
|
142393
142522
|
return String(seg);
|
|
142394
142523
|
}
|
|
@@ -146430,7 +146559,7 @@ async function serveMcp(mcp, transport, options = {}) {
|
|
|
146430
146559
|
}
|
|
146431
146560
|
|
|
146432
146561
|
// src/mcp/permissions.ts
|
|
146433
|
-
var
|
|
146562
|
+
var import_node_fs21 = __toESM(require("node:fs"), 1);
|
|
146434
146563
|
var import_node_path57 = __toESM(require("node:path"), 1);
|
|
146435
146564
|
init_zod();
|
|
146436
146565
|
init_store();
|
|
@@ -146447,15 +146576,15 @@ function readStoredMcpPermissions(paths) {
|
|
|
146447
146576
|
}
|
|
146448
146577
|
function writeStoredMcpPermissions(paths, permissions) {
|
|
146449
146578
|
writeJsonAtomic(paths.mcpPermissionsFile, { writes: permissions.writes, remoteControl: permissions.remoteControl, history: permissions.history });
|
|
146450
|
-
|
|
146579
|
+
import_node_fs21.default.chmodSync(paths.mcpPermissionsFile, OWNER_ONLY_MODE);
|
|
146451
146580
|
}
|
|
146452
146581
|
function effectiveMcpPermissions(flags, stored) {
|
|
146453
146582
|
return { writes: flags.writes || stored.writes, remoteControl: flags.remoteControl || stored.remoteControl, history: flags.history || stored.history };
|
|
146454
146583
|
}
|
|
146455
146584
|
function watchMcpPermissions(paths, onChange) {
|
|
146456
146585
|
const directory = import_node_path57.default.dirname(paths.mcpPermissionsFile);
|
|
146457
|
-
|
|
146458
|
-
const watcher =
|
|
146586
|
+
import_node_fs21.default.mkdirSync(directory, { recursive: true });
|
|
146587
|
+
const watcher = import_node_fs21.default.watch(directory, (_event, filename) => {
|
|
146459
146588
|
if (filename === null || filename === import_node_path57.default.basename(paths.mcpPermissionsFile)) {
|
|
146460
146589
|
onChange();
|
|
146461
146590
|
}
|
|
@@ -146769,7 +146898,7 @@ init_credential();
|
|
|
146769
146898
|
init_credentialCache();
|
|
146770
146899
|
|
|
146771
146900
|
// src/identityToken.ts
|
|
146772
|
-
var
|
|
146901
|
+
var import_node_fs22 = __toESM(require("node:fs"), 1);
|
|
146773
146902
|
var import_node_path58 = __toESM(require("node:path"), 1);
|
|
146774
146903
|
init_cliError();
|
|
146775
146904
|
var TOKEN_FILE_MODE = 384;
|
|
@@ -146787,13 +146916,13 @@ function storeIdentityToken(paths, identityName, raw) {
|
|
|
146787
146916
|
throw new UsageError("That is not a claude setup-token token (expected it to start with sk-ant-oat). Run `claude setup-token` and pass its token on standard input.");
|
|
146788
146917
|
}
|
|
146789
146918
|
const dir = identityTokenDir(paths);
|
|
146790
|
-
|
|
146791
|
-
|
|
146919
|
+
import_node_fs22.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
|
|
146920
|
+
import_node_fs22.default.chmodSync(dir, TOKEN_DIR_MODE);
|
|
146792
146921
|
const target = identityTokenPath(paths, identityName);
|
|
146793
146922
|
const temp = import_node_path58.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
|
|
146794
|
-
|
|
146923
|
+
import_node_fs22.default.writeFileSync(temp, `${token}
|
|
146795
146924
|
`, { mode: TOKEN_FILE_MODE });
|
|
146796
|
-
|
|
146925
|
+
import_node_fs22.default.renameSync(temp, target);
|
|
146797
146926
|
return target;
|
|
146798
146927
|
}
|
|
146799
146928
|
|
|
@@ -146959,7 +147088,7 @@ function registerDoctorCommand(program2, deps) {
|
|
|
146959
147088
|
}
|
|
146960
147089
|
|
|
146961
147090
|
// src/headroom/commands.ts
|
|
146962
|
-
var
|
|
147091
|
+
var import_node_fs23 = __toESM(require("node:fs"), 1);
|
|
146963
147092
|
var import_node_http5 = __toESM(require("node:http"), 1);
|
|
146964
147093
|
var import_node_path59 = __toESM(require("node:path"), 1);
|
|
146965
147094
|
var import_node_child_process9 = require("node:child_process");
|
|
@@ -147184,12 +147313,12 @@ function realSupervisorPorts(paths) {
|
|
|
147184
147313
|
readConfig: () => resolveSupervisorConfig(readGlobalConfig(paths)?.headroom ?? {}),
|
|
147185
147314
|
spawnHeadroom: (socketPath, allowlistFile, settings2) => {
|
|
147186
147315
|
const trust = resolveHeadroomTrustBundle({ caCertFile: paths.frontdoorCaCertFile, bundlesDir: paths.frontdoorCaBundlesDir, inherited: process.env[HEADROOM_CA_BUNDLE], fs: realTrustBundleFs });
|
|
147187
|
-
|
|
147316
|
+
import_node_fs23.default.mkdirSync(paths.logsDir, { recursive: true });
|
|
147188
147317
|
if (trust?.warning !== void 0) {
|
|
147189
|
-
|
|
147318
|
+
import_node_fs23.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${trust.warning}
|
|
147190
147319
|
`);
|
|
147191
147320
|
}
|
|
147192
|
-
const logFd =
|
|
147321
|
+
const logFd = import_node_fs23.default.openSync(paths.headroomLogPath, "a");
|
|
147193
147322
|
try {
|
|
147194
147323
|
const child = (0, import_node_child_process9.spawn)("headroom", headroomProxyArgs(socketPath, allowlistFile, settings2), {
|
|
147195
147324
|
detached: true,
|
|
@@ -147204,12 +147333,12 @@ function realSupervisorPorts(paths) {
|
|
|
147204
147333
|
child.once("exit", (code, signal) => {
|
|
147205
147334
|
ownedHeadroom.delete(pid);
|
|
147206
147335
|
exitedHeadroom.add(pid);
|
|
147207
|
-
|
|
147336
|
+
import_node_fs23.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} agent-shim headroom supervisor: headroom exited (${signal ?? `code ${String(code)}`})
|
|
147208
147337
|
`);
|
|
147209
147338
|
});
|
|
147210
147339
|
return pid;
|
|
147211
147340
|
} finally {
|
|
147212
|
-
|
|
147341
|
+
import_node_fs23.default.closeSync(logFd);
|
|
147213
147342
|
}
|
|
147214
147343
|
},
|
|
147215
147344
|
stopProcess: (pid) => {
|
|
@@ -147222,7 +147351,7 @@ function realSupervisorPorts(paths) {
|
|
|
147222
147351
|
now: () => Date.now()
|
|
147223
147352
|
});
|
|
147224
147353
|
if (outcome === "still-running") {
|
|
147225
|
-
|
|
147354
|
+
import_node_fs23.default.appendFileSync(
|
|
147226
147355
|
paths.headroomLogPath,
|
|
147227
147356
|
`${(/* @__PURE__ */ new Date()).toISOString()} agent-shim headroom supervisor: pid ${String(pid)} survived SIGKILL within its grace; it is stuck uninterruptibly
|
|
147228
147357
|
`
|
|
@@ -147240,10 +147369,10 @@ function realSupervisorPorts(paths) {
|
|
|
147240
147369
|
};
|
|
147241
147370
|
}
|
|
147242
147371
|
if (result.stdout !== "") {
|
|
147243
|
-
|
|
147372
|
+
import_node_fs23.default.appendFileSync(paths.headroomLogPath, result.stdout);
|
|
147244
147373
|
}
|
|
147245
147374
|
if (result.stderr !== "") {
|
|
147246
|
-
|
|
147375
|
+
import_node_fs23.default.appendFileSync(paths.headroomLogPath, result.stderr);
|
|
147247
147376
|
}
|
|
147248
147377
|
return result.status === 0 ? { ok: true } : { ok: false, error: `uv tool install exited ${String(result.status)}` };
|
|
147249
147378
|
},
|
|
@@ -147253,8 +147382,8 @@ function realSupervisorPorts(paths) {
|
|
|
147253
147382
|
},
|
|
147254
147383
|
installedCommit: readInstalledHeadroomCommit,
|
|
147255
147384
|
log: (line) => {
|
|
147256
|
-
|
|
147257
|
-
|
|
147385
|
+
import_node_fs23.default.mkdirSync(paths.logsDir, { recursive: true });
|
|
147386
|
+
import_node_fs23.default.appendFileSync(paths.headroomLogPath, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
|
|
147258
147387
|
`);
|
|
147259
147388
|
}
|
|
147260
147389
|
};
|
|
@@ -147761,12 +147890,167 @@ init_translate();
|
|
|
147761
147890
|
init_schema();
|
|
147762
147891
|
init_cliError();
|
|
147763
147892
|
init_providerCatalogue();
|
|
147764
|
-
var
|
|
147893
|
+
var import_node_fs25 = __toESM(require("node:fs"), 1);
|
|
147765
147894
|
init_credential();
|
|
147895
|
+
init_providerAliases();
|
|
147896
|
+
|
|
147897
|
+
// src/providerRename.ts
|
|
147898
|
+
var import_node_fs24 = __toESM(require("node:fs"), 1);
|
|
147899
|
+
var import_node_path62 = __toESM(require("node:path"), 1);
|
|
147900
|
+
init_schema();
|
|
147901
|
+
init_store();
|
|
147902
|
+
init_load();
|
|
147903
|
+
init_cliError();
|
|
147904
|
+
init_configProfilesStore();
|
|
147905
|
+
init_credentialCache();
|
|
147906
|
+
init_providerCatalogue();
|
|
147907
|
+
init_schema2();
|
|
147908
|
+
init_read();
|
|
147909
|
+
init_providerAliases();
|
|
147766
147910
|
init_providersStore();
|
|
147767
|
-
function
|
|
147911
|
+
function renameRef(ref, from, to2) {
|
|
147912
|
+
return ref.startsWith(`${from}/`) ? `${to2}${ref.slice(from.length)}` : ref;
|
|
147913
|
+
}
|
|
147914
|
+
function renameModelRefs(models, from, to2) {
|
|
147915
|
+
const rename = (ref) => renameRef(ref, from, to2);
|
|
147916
|
+
const renamed = { ...models };
|
|
147917
|
+
if (models.virtual !== void 0) {
|
|
147918
|
+
renamed.virtual = Object.fromEntries(Object.entries(models.virtual).map(([name, definition]) => [name, definition === null ? null : { ...definition, members: definition.members.map(rename) }]));
|
|
147919
|
+
}
|
|
147920
|
+
if (models.tiers !== void 0) {
|
|
147921
|
+
renamed.tiers = Object.fromEntries(Object.entries(models.tiers).map(([tier, ref]) => [tier, typeof ref === "string" ? rename(ref) : ref]));
|
|
147922
|
+
}
|
|
147923
|
+
if (models.prices !== void 0) {
|
|
147924
|
+
renamed.prices = Object.fromEntries(Object.entries(models.prices).map(([ref, price]) => [rename(ref), price]));
|
|
147925
|
+
}
|
|
147926
|
+
if (models.hide !== void 0) {
|
|
147927
|
+
renamed.hide = models.hide.map(rename);
|
|
147928
|
+
}
|
|
147929
|
+
if (models.show !== void 0) {
|
|
147930
|
+
renamed.show = models.show.map(rename);
|
|
147931
|
+
}
|
|
147932
|
+
if (models.same !== void 0) {
|
|
147933
|
+
renamed.same = models.same.map((group) => group.map(rename));
|
|
147934
|
+
}
|
|
147935
|
+
if (models.distinct !== void 0) {
|
|
147936
|
+
renamed.distinct = models.distinct.map(([left, right]) => [rename(left), rename(right)]);
|
|
147937
|
+
}
|
|
147938
|
+
if (models.families !== void 0) {
|
|
147939
|
+
renamed.families = Object.fromEntries(Object.entries(models.families).map(([key, settings2]) => [key, settings2?.names === void 0 ? settings2 : { ...settings2, names: settings2.names.map(rename) }]));
|
|
147940
|
+
}
|
|
147941
|
+
return renamed;
|
|
147942
|
+
}
|
|
147943
|
+
function renamedLaunch(launch, from, to2) {
|
|
147944
|
+
return launch?.provider === from ? { ...launch, provider: to2 } : void 0;
|
|
147945
|
+
}
|
|
147946
|
+
function renamedModels(models, from, to2) {
|
|
147947
|
+
const renamed = renameModelRefs(models, from, to2);
|
|
147948
|
+
return JSON.stringify(renamed) === JSON.stringify(models) ? void 0 : renamed;
|
|
147949
|
+
}
|
|
147950
|
+
function renameProvider(paths, from, to2, ports) {
|
|
147951
|
+
if (from === to2) {
|
|
147952
|
+
throw new UsageError(`"${from}" is already the provider's name.`);
|
|
147953
|
+
}
|
|
147954
|
+
requireValidProviderName(to2);
|
|
147955
|
+
if (!providerExists(paths, from)) {
|
|
147956
|
+
throw new ProviderNotFoundError(from);
|
|
147957
|
+
}
|
|
147958
|
+
if (providerExists(paths, to2)) {
|
|
147959
|
+
throw new ProviderAlreadyExistsError(to2);
|
|
147960
|
+
}
|
|
147961
|
+
const previousAliases = readProviderAliases(paths);
|
|
147962
|
+
writeProviderAliases(paths, aliasesAfterRename(previousAliases, from, to2));
|
|
147963
|
+
try {
|
|
147964
|
+
import_node_fs24.default.renameSync(providerJsonPath(paths, from), providerJsonPath(paths, to2));
|
|
147965
|
+
} catch (error63) {
|
|
147966
|
+
writeProviderAliases(paths, previousAliases);
|
|
147967
|
+
throw error63;
|
|
147968
|
+
}
|
|
147969
|
+
return { from, to: to2, updated: [...rewriteReferences(paths, from, to2), ...moveState(paths, from, to2, ports)] };
|
|
147970
|
+
}
|
|
147971
|
+
function moveState(paths, from, to2, ports) {
|
|
147972
|
+
const moved = [];
|
|
147973
|
+
for (const snapshot of listUsageSnapshots(ports.fs, paths.usageSnapshotsDir)) {
|
|
147974
|
+
const slice = snapshot.providers[from];
|
|
147975
|
+
if (slice === void 0) {
|
|
147976
|
+
continue;
|
|
147977
|
+
}
|
|
147978
|
+
const others = Object.entries(snapshot.providers).filter(([name]) => name !== from);
|
|
147979
|
+
const providers = Object.fromEntries(snapshot.providers[to2] === void 0 ? [...others, [to2, slice]] : others);
|
|
147980
|
+
ports.fs.writeFilePrivate(snapshotPath(paths.usageSnapshotsDir, snapshot.identity), `${JSON.stringify(UsageSnapshotSchema.parse({ ...snapshot, providers }), null, 2)}
|
|
147981
|
+
`);
|
|
147982
|
+
moved.push(`usage ${snapshot.identity}`);
|
|
147983
|
+
}
|
|
147984
|
+
if (import_node_fs24.default.existsSync(catalogueCachePath(paths, from))) {
|
|
147985
|
+
import_node_fs24.default.renameSync(catalogueCachePath(paths, from), catalogueCachePath(paths, to2));
|
|
147986
|
+
moved.push("catalogue");
|
|
147987
|
+
}
|
|
147988
|
+
const renamed = readProvider(paths, to2);
|
|
147989
|
+
const cache = renamed === void 0 || isRouterProvider(renamed) ? void 0 : renamed.credential.cache;
|
|
147990
|
+
if (cache !== void 0) {
|
|
147991
|
+
const store = effectiveStore(cache, ports.credentialCache.platform);
|
|
147992
|
+
const entry = ports.credentialCache.port.read(store, `provider ${from}`);
|
|
147993
|
+
if (entry !== void 0) {
|
|
147994
|
+
ports.credentialCache.port.write(store, `provider ${to2}`, entry);
|
|
147995
|
+
ports.credentialCache.port.remove(store, `provider ${from}`);
|
|
147996
|
+
moved.push("credential cache");
|
|
147997
|
+
}
|
|
147998
|
+
}
|
|
147999
|
+
return moved;
|
|
148000
|
+
}
|
|
148001
|
+
function rewriteReferences(paths, from, to2) {
|
|
148002
|
+
const rewritten = [];
|
|
148003
|
+
const global2 = readGlobalConfig(paths);
|
|
148004
|
+
if (global2 !== void 0) {
|
|
148005
|
+
const launch = renamedLaunch(global2.launch, from, to2);
|
|
148006
|
+
const models = global2.models === void 0 ? void 0 : renamedModels(global2.models, from, to2);
|
|
148007
|
+
if (launch !== void 0 || models !== void 0) {
|
|
148008
|
+
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { ...launch === void 0 ? {} : { launch }, ...models === void 0 ? {} : { models } });
|
|
148009
|
+
rewritten.push("config.json");
|
|
148010
|
+
}
|
|
148011
|
+
}
|
|
148012
|
+
for (const { name, profile } of listProfiles(paths)) {
|
|
148013
|
+
const launch = renamedLaunch(profile.launch, from, to2);
|
|
148014
|
+
const models = profile.models === void 0 ? void 0 : renamedModels(profile.models, from, to2);
|
|
148015
|
+
if (launch !== void 0 || models !== void 0) {
|
|
148016
|
+
applyPatch(import_node_path62.default.join(paths.configProfilesDir, `${name}.json`), ConfigProfileSchema, { ...launch === void 0 ? {} : { launch }, ...models === void 0 ? {} : { models } });
|
|
148017
|
+
rewritten.push(`profile ${name}`);
|
|
148018
|
+
}
|
|
148019
|
+
}
|
|
148020
|
+
const rules = readDirectoryRules(paths);
|
|
148021
|
+
const renamedRules = rules.rules.map((rule) => {
|
|
148022
|
+
const launch = renamedLaunch(rule.launch, from, to2);
|
|
148023
|
+
const models = rule.models === void 0 ? void 0 : renamedModels(rule.models, from, to2);
|
|
148024
|
+
if (launch === void 0 && models === void 0) {
|
|
148025
|
+
return rule;
|
|
148026
|
+
}
|
|
148027
|
+
rewritten.push(`rule ${rule.path}`);
|
|
148028
|
+
return { ...rule, ...launch === void 0 ? {} : { launch }, ...models === void 0 ? {} : { models } };
|
|
148029
|
+
});
|
|
148030
|
+
if (renamedRules.some((rule, index) => rule !== rules.rules[index])) {
|
|
148031
|
+
writeDirectoryRules(paths, { ...rules, rules: renamedRules });
|
|
148032
|
+
}
|
|
148033
|
+
for (const { name, provider } of listProviders(paths)) {
|
|
148034
|
+
if (isHttpProvider(provider) && provider.routes?.some((route) => route.provider === from) === true) {
|
|
148035
|
+
const next = ProviderSchema.safeParse({ ...provider, routes: provider.routes.map((route) => route.provider === from ? { ...route, provider: to2 } : route) });
|
|
148036
|
+
if (!next.success) {
|
|
148037
|
+
throw new ConfigValidationError(providerJsonPath(paths, name), next.error.issues);
|
|
148038
|
+
}
|
|
148039
|
+
writeJsonAtomic(providerJsonPath(paths, name), next.data);
|
|
148040
|
+
rewritten.push(`provider ${name} routes`);
|
|
148041
|
+
}
|
|
148042
|
+
}
|
|
148043
|
+
return rewritten;
|
|
148044
|
+
}
|
|
148045
|
+
|
|
148046
|
+
// src/providers.ts
|
|
148047
|
+
init_realCredentialCache();
|
|
148048
|
+
init_realPorts();
|
|
148049
|
+
init_providersStore();
|
|
148050
|
+
function toProviderView(name, provider, formerNames) {
|
|
147768
148051
|
return {
|
|
147769
148052
|
name,
|
|
148053
|
+
...formerNames.length === 0 ? {} : { formerNames },
|
|
147770
148054
|
kind: provider.kind ?? "http",
|
|
147771
148055
|
displayName: provider.displayName,
|
|
147772
148056
|
...isCodexProvider(provider) ? provider.codex === void 0 ? {} : { codex: provider.codex } : isAntigravityProvider(provider) ? provider.antigravity === void 0 ? {} : { antigravity: provider.antigravity } : isRouterProvider(provider) ? {} : { baseUrl: provider.baseUrl },
|
|
@@ -147953,8 +148237,9 @@ function registerProviderCommand(program2, deps) {
|
|
|
147953
148237
|
withExamples(
|
|
147954
148238
|
provider.command("list").description("List every API provider.").option("--json", "Print the providers as JSON.").action((options) => {
|
|
147955
148239
|
const entries = listProviders(paths);
|
|
148240
|
+
const aliases = readProviderAliases(paths);
|
|
147956
148241
|
if (options.json === true) {
|
|
147957
|
-
printJson(entries.map((entry) => toProviderView(entry.name, entry.provider)));
|
|
148242
|
+
printJson(entries.map((entry) => toProviderView(entry.name, entry.provider, aliasesOf(aliases, entry.name))));
|
|
147958
148243
|
return;
|
|
147959
148244
|
}
|
|
147960
148245
|
if (entries.length === 0) {
|
|
@@ -147962,7 +148247,8 @@ function registerProviderCommand(program2, deps) {
|
|
|
147962
148247
|
return;
|
|
147963
148248
|
}
|
|
147964
148249
|
for (const entry of entries) {
|
|
147965
|
-
|
|
148250
|
+
const formerly = aliasesOf(aliases, entry.name);
|
|
148251
|
+
console.log(` ${entry.name} (${entry.provider.displayName}, ${describeProviderEndpoint(entry.provider)})${formerly.length === 0 ? "" : `, formerly ${formerly.join(", ")}`}`);
|
|
147966
148252
|
}
|
|
147967
148253
|
}),
|
|
147968
148254
|
["agent-shim provider list", "agent-shim provider list --json"]
|
|
@@ -147973,11 +148259,15 @@ function registerProviderCommand(program2, deps) {
|
|
|
147973
148259
|
if (found === void 0) {
|
|
147974
148260
|
throw new ProviderNotFoundError(name);
|
|
147975
148261
|
}
|
|
148262
|
+
const formerNames = aliasesOf(readProviderAliases(paths), name);
|
|
147976
148263
|
if (options.json === true) {
|
|
147977
|
-
printJson(toProviderView(name, found));
|
|
148264
|
+
printJson(toProviderView(name, found, formerNames));
|
|
147978
148265
|
return;
|
|
147979
148266
|
}
|
|
147980
148267
|
console.log(`Provider: ${name}`);
|
|
148268
|
+
if (formerNames.length > 0) {
|
|
148269
|
+
console.log(`Former names: ${formerNames.join(", ")}`);
|
|
148270
|
+
}
|
|
147981
148271
|
console.log(`Display name: ${found.displayName}`);
|
|
147982
148272
|
console.log(`Kind: ${found.kind ?? "http"}`);
|
|
147983
148273
|
if (isCodexProvider(found)) {
|
|
@@ -148023,7 +148313,7 @@ function registerProviderCommand(program2, deps) {
|
|
|
148023
148313
|
throw new UsageError(`Provider "${name}" has no catalogue setting. Set one with \`agent-shim provider set ${name} --catalogue-tier <tier>\`.`);
|
|
148024
148314
|
}
|
|
148025
148315
|
const catalogueSetting = found.catalogue;
|
|
148026
|
-
const cache = options.refresh === true ? await refreshCatalogueForReal(paths, name, process.env) : parseCatalogueCache(
|
|
148316
|
+
const cache = options.refresh === true ? await refreshCatalogueForReal(paths, name, process.env) : parseCatalogueCache(import_node_fs25.default.existsSync(catalogueCachePath(paths, name)) ? import_node_fs25.default.readFileSync(catalogueCachePath(paths, name), "utf8") : void 0);
|
|
148027
148317
|
if (cache === void 0) {
|
|
148028
148318
|
throw new UsageError(`No catalogue has been fetched for "${name}" yet: the front door fetches it shortly after it starts, or run \`agent-shim provider models ${name} --refresh\`.`);
|
|
148029
148319
|
}
|
|
@@ -148053,6 +148343,28 @@ function registerProviderCommand(program2, deps) {
|
|
|
148053
148343
|
}),
|
|
148054
148344
|
["agent-shim provider remove z --yes"]
|
|
148055
148345
|
);
|
|
148346
|
+
withExamples(
|
|
148347
|
+
provider.command("rename <old> <new>").description("Rename a provider. Sessions already running under the old name keep being served through an alias, and configuration, usage state and the cached credential move to the new name.").option("--json", "Print the result as JSON.").action((from, to2, options) => {
|
|
148348
|
+
const report = renameProvider(paths, from, to2, { fs: realFarmFs, credentialCache: realCredentialCacheEnv(paths) });
|
|
148349
|
+
reportMutation(options.json, { action: "renamed", kind: "provider", name: to2, value: report }, () => {
|
|
148350
|
+
console.log(`Renamed provider "${from}" to "${to2}".`);
|
|
148351
|
+
for (const place of report.updated) {
|
|
148352
|
+
console.log(` updated ${place}`);
|
|
148353
|
+
}
|
|
148354
|
+
console.log(`"${from}" still resolves to "${to2}" for sessions launched under it. Once none is running, \`agent-shim provider unalias ${from}\` forgets it.`);
|
|
148355
|
+
});
|
|
148356
|
+
}),
|
|
148357
|
+
["agent-shim provider rename z zai"]
|
|
148358
|
+
);
|
|
148359
|
+
withExamples(
|
|
148360
|
+
provider.command("unalias <alias>").description("Forget a former provider name. A session still launched under it stops being served.").option("--json", "Print the result as JSON.").action((alias, options) => {
|
|
148361
|
+
removeProviderAlias(paths, alias);
|
|
148362
|
+
reportMutation(options.json, { action: "removed", kind: "provider alias", name: alias }, () => {
|
|
148363
|
+
console.log(`Forgot the former provider name "${alias}".`);
|
|
148364
|
+
});
|
|
148365
|
+
}),
|
|
148366
|
+
["agent-shim provider unalias z"]
|
|
148367
|
+
);
|
|
148056
148368
|
}
|
|
148057
148369
|
|
|
148058
148370
|
// src/models.ts
|
|
@@ -148528,7 +148840,7 @@ function registerSessionCommands(program2, deps) {
|
|
|
148528
148840
|
}
|
|
148529
148841
|
|
|
148530
148842
|
// src/usage/commands.ts
|
|
148531
|
-
var
|
|
148843
|
+
var import_node_path63 = __toESM(require("node:path"), 1);
|
|
148532
148844
|
init_commandDeps();
|
|
148533
148845
|
init_realPorts();
|
|
148534
148846
|
init_account();
|
|
@@ -148545,14 +148857,14 @@ function requireIdentity(paths, name) {
|
|
|
148545
148857
|
throw new IdentityNotFoundError(name);
|
|
148546
148858
|
}
|
|
148547
148859
|
}
|
|
148548
|
-
function collectUsageReport(
|
|
148860
|
+
function collectUsageReport(fs28, paths, filters) {
|
|
148549
148861
|
const { identity, provider, sinceMs } = filters;
|
|
148550
148862
|
if (identity !== void 0) {
|
|
148551
148863
|
requireIdentity(paths, identity);
|
|
148552
148864
|
}
|
|
148553
|
-
const log = readUsageLog(
|
|
148865
|
+
const log = readUsageLog(fs28, paths.usageLogDir, sinceMs === void 0 ? {} : { sinceMs });
|
|
148554
148866
|
const records = log.records.filter((record2) => (identity === void 0 || record2.identity === identity) && (provider === void 0 || record2.provider === provider));
|
|
148555
|
-
const snapshots = (identity === void 0 ? listUsageSnapshots(
|
|
148867
|
+
const snapshots = (identity === void 0 ? listUsageSnapshots(fs28, paths.usageSnapshotsDir) : [readUsageSnapshot(fs28, paths.usageSnapshotsDir, identity)].flatMap((snapshot) => snapshot === void 0 ? [] : [snapshot])).map((snapshot) => provider === void 0 ? snapshot : { ...snapshot, providers: Object.fromEntries(Object.entries(snapshot.providers).filter(([name]) => name === provider)) }).filter((snapshot) => Object.keys(snapshot.providers).length > 0);
|
|
148556
148868
|
return {
|
|
148557
148869
|
since: sinceMs === void 0 ? void 0 : new Date(sinceMs).toISOString(),
|
|
148558
148870
|
logDir: paths.usageLogDir,
|
|
@@ -148659,16 +148971,16 @@ function formatUsageReport(report) {
|
|
|
148659
148971
|
}
|
|
148660
148972
|
return lines;
|
|
148661
148973
|
}
|
|
148662
|
-
function collectAccounts(
|
|
148974
|
+
function collectAccounts(fs28, paths, identity, probe) {
|
|
148663
148975
|
if (identity !== void 0) {
|
|
148664
148976
|
requireIdentity(paths, identity);
|
|
148665
148977
|
}
|
|
148666
148978
|
const names = identity === void 0 ? listIdentities(paths).map((entry) => entry.name) : [identity];
|
|
148667
148979
|
return names.map((name) => ({
|
|
148668
148980
|
identity: name,
|
|
148669
|
-
account: readAccountMetadata(
|
|
148670
|
-
signIn: identitySignIn(
|
|
148671
|
-
usage: readUsageSnapshot(
|
|
148981
|
+
account: readAccountMetadata(fs28, paths.identitiesDir, name),
|
|
148982
|
+
signIn: identitySignIn(fs28, probe, { farmRoot: import_node_path63.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
|
|
148983
|
+
usage: readUsageSnapshot(fs28, paths.usageSnapshotsDir, name)
|
|
148672
148984
|
}));
|
|
148673
148985
|
}
|
|
148674
148986
|
function formatAccounts(views) {
|
|
@@ -149018,15 +149330,15 @@ function createRealCompactor(params) {
|
|
|
149018
149330
|
// src/supervise/compactionDeps.ts
|
|
149019
149331
|
var COMPACT_SLOT_STALE_MS = COMPACT_TIMEOUT_MS * 2;
|
|
149020
149332
|
function createCompactionDeps(wiring) {
|
|
149021
|
-
const { paths, fs:
|
|
149333
|
+
const { paths, fs: fs28, pool } = wiring;
|
|
149022
149334
|
return {
|
|
149023
149335
|
shouldCompact: (identity, sessionId) => {
|
|
149024
149336
|
const nowMs = wiring.now();
|
|
149025
|
-
const sessions = liveSupervised(
|
|
149337
|
+
const sessions = liveSupervised(fs28, paths, pool, wiring.isRunning).filter((session) => session.identity === identity).map((session) => ({ sessionId: session.sessionId, state: readSessionState(fs28, paths, pool, session.sessionId) }));
|
|
149026
149338
|
return decideCompaction({
|
|
149027
149339
|
atUtilisation: wiring.policy.compactAtUtilisation,
|
|
149028
|
-
snapshot: readUsageSnapshot(
|
|
149029
|
-
records: () => readUsageLog(
|
|
149340
|
+
snapshot: readUsageSnapshot(fs28, paths.usageSnapshotsDir, identity),
|
|
149341
|
+
records: () => readUsageLog(fs28, paths.usageLogDir, { sinceMs: nowMs - FIVE_HOUR_WINDOW_MS }).records.filter((record2) => record2.identity === identity),
|
|
149030
149342
|
sessions,
|
|
149031
149343
|
sessionId,
|
|
149032
149344
|
nowMs
|
|
@@ -149034,7 +149346,7 @@ function createCompactionDeps(wiring) {
|
|
|
149034
149346
|
},
|
|
149035
149347
|
acquire: (identity) => {
|
|
149036
149348
|
try {
|
|
149037
|
-
const lock = acquireIdentityLock({ identity: `compact-${identity}`, dir: superviseDirOf(paths, pool), fs:
|
|
149349
|
+
const lock = acquireIdentityLock({ identity: `compact-${identity}`, dir: superviseDirOf(paths, pool), fs: fs28, nowMs: wiring.now, pid: wiring.pid, isRunning: wiring.isRunning, sleep: wiring.sleep, maxAttempts: 1, staleAfterMs: COMPACT_SLOT_STALE_MS });
|
|
149038
149350
|
return { release: lock.release };
|
|
149039
149351
|
} catch (error63) {
|
|
149040
149352
|
if (error63 instanceof IdentityLockBusyError) {
|
|
@@ -149045,8 +149357,8 @@ function createCompactionDeps(wiring) {
|
|
|
149045
149357
|
},
|
|
149046
149358
|
compact: wiring.compact,
|
|
149047
149359
|
markCompacted: (sessionId, compacted) => {
|
|
149048
|
-
const previous = readSessionState(
|
|
149049
|
-
writeSessionState(
|
|
149360
|
+
const previous = readSessionState(fs28, paths, pool, sessionId);
|
|
149361
|
+
writeSessionState(fs28, paths, pool, sessionId, {
|
|
149050
149362
|
mark: previous?.mark ?? "idle",
|
|
149051
149363
|
...previous?.contextTokens === void 0 ? {} : { contextTokens: previous.contextTokens },
|
|
149052
149364
|
...compacted ? { compacted: true } : {},
|
|
@@ -149058,12 +149370,12 @@ function createCompactionDeps(wiring) {
|
|
|
149058
149370
|
|
|
149059
149371
|
// src/supervise/limit.ts
|
|
149060
149372
|
init_read();
|
|
149061
|
-
function quotaHitOf(
|
|
149062
|
-
const reason = refusalReason(identity, readUsageSnapshot(
|
|
149373
|
+
function quotaHitOf(fs28, paths, identity, sessionId, sinceMs, nowMs) {
|
|
149374
|
+
const reason = refusalReason(identity, readUsageSnapshot(fs28, paths.usageSnapshotsDir, identity), nowMs);
|
|
149063
149375
|
if (reason === void 0) {
|
|
149064
149376
|
return void 0;
|
|
149065
149377
|
}
|
|
149066
|
-
const { records } = readUsageLog(
|
|
149378
|
+
const { records } = readUsageLog(fs28, paths.usageLogDir, { sinceMs });
|
|
149067
149379
|
for (let index = records.length - 1; index >= 0; index -= 1) {
|
|
149068
149380
|
const record2 = records[index];
|
|
149069
149381
|
if (record2?.sessionId === sessionId && record2.identity === identity && record2.limit?.kind === "quota-exhausted") {
|
|
@@ -149074,7 +149386,7 @@ function quotaHitOf(fs26, paths, identity, sessionId, sinceMs, nowMs) {
|
|
|
149074
149386
|
}
|
|
149075
149387
|
|
|
149076
149388
|
// src/supervise/move.ts
|
|
149077
|
-
var
|
|
149389
|
+
var import_node_path64 = __toESM(require("node:path"), 1);
|
|
149078
149390
|
init_lock();
|
|
149079
149391
|
init_poolPick();
|
|
149080
149392
|
init_read();
|
|
@@ -149120,7 +149432,7 @@ function createMover(deps) {
|
|
|
149120
149432
|
if (resolution.identity === request7.from) {
|
|
149121
149433
|
return { kind: "stay", reason: `no other member of pool "${pool}" can take it` };
|
|
149122
149434
|
}
|
|
149123
|
-
const transcript =
|
|
149435
|
+
const transcript = import_node_path64.default.join(paths.identitiesDir, resolution.identity, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
|
|
149124
149436
|
if (farmFs.lstat(transcript)?.kind !== "file") {
|
|
149125
149437
|
return { kind: "stay", reason: `${resolution.identity} does not share this conversation's history, so it could not resume it` };
|
|
149126
149438
|
}
|
|
@@ -149154,13 +149466,13 @@ function createIdentityMover(deps) {
|
|
|
149154
149466
|
throw error63;
|
|
149155
149467
|
}
|
|
149156
149468
|
try {
|
|
149157
|
-
if (farmFs.readFileUtf8(
|
|
149469
|
+
if (farmFs.readFileUtf8(import_node_path64.default.join(paths.identitiesDir, request7.to, "identity.json")) === void 0) {
|
|
149158
149470
|
return { kind: "stay", reason: `no identity "${request7.to}"` };
|
|
149159
149471
|
}
|
|
149160
149472
|
if (request7.to === request7.from) {
|
|
149161
149473
|
return { kind: "stay", reason: `the model already runs under this session's identity` };
|
|
149162
149474
|
}
|
|
149163
|
-
const transcript =
|
|
149475
|
+
const transcript = import_node_path64.default.join(paths.identitiesDir, request7.to, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
|
|
149164
149476
|
if (farmFs.lstat(transcript)?.kind !== "file") {
|
|
149165
149477
|
return { kind: "stay", reason: `${request7.to} does not share this conversation's history, so it could not resume it` };
|
|
149166
149478
|
}
|
|
@@ -149183,7 +149495,7 @@ function createIdentityMover(deps) {
|
|
|
149183
149495
|
|
|
149184
149496
|
// src/supervise/realPorts.ts
|
|
149185
149497
|
var import_node_child_process10 = require("node:child_process");
|
|
149186
|
-
var
|
|
149498
|
+
var import_node_fs26 = __toESM(require("node:fs"), 1);
|
|
149187
149499
|
init_realPorts();
|
|
149188
149500
|
var realSupervisedSpawnPort = {
|
|
149189
149501
|
spawn(command, args, options) {
|
|
@@ -149229,7 +149541,7 @@ var realTimerPort = {
|
|
|
149229
149541
|
function realWatchDirectory(directory, accepts, what, log) {
|
|
149230
149542
|
return (onChange) => {
|
|
149231
149543
|
realFarmFs.mkdirPrivate(directory);
|
|
149232
|
-
const watcher =
|
|
149544
|
+
const watcher = import_node_fs26.default.watch(directory, { persistent: false }, (_event, filename) => {
|
|
149233
149545
|
if (filename === null || accepts(filename)) {
|
|
149234
149546
|
onChange();
|
|
149235
149547
|
}
|
|
@@ -149738,7 +150050,7 @@ async function runClaude(argvOverride) {
|
|
|
149738
150050
|
// src/cli.ts
|
|
149739
150051
|
async function main() {
|
|
149740
150052
|
aliasLegacyEnv(process.env);
|
|
149741
|
-
const invokedName =
|
|
150053
|
+
const invokedName = import_node_path65.default.basename(process.argv[1] ?? "agent-shim");
|
|
149742
150054
|
if (isInvokedAsClaude(invokedName)) {
|
|
149743
150055
|
await runClaude();
|
|
149744
150056
|
return;
|