claude-use 11.65.0 → 11.65.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +569 -512
- package/dist/index.cjs +210 -118
- package/dist/index.mjs +203 -112
- package/dist/types/index.d.ts +39 -2
- 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, path72) {
|
|
322
|
+
if (!path72)
|
|
323
323
|
return obj;
|
|
324
|
-
return
|
|
324
|
+
return path72.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(path72, 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(path72);
|
|
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, path72 = []) => {
|
|
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 }, [...path72, ...issue2.path]));
|
|
1112
1112
|
} else if (issue2.code === "invalid_key") {
|
|
1113
|
-
processError({ issues: issue2.issues }, [...
|
|
1113
|
+
processError({ issues: issue2.issues }, [...path72, ...issue2.path]);
|
|
1114
1114
|
} else if (issue2.code === "invalid_element") {
|
|
1115
|
-
processError({ issues: issue2.issues }, [...
|
|
1115
|
+
processError({ issues: issue2.issues }, [...path72, ...issue2.path]);
|
|
1116
1116
|
} else {
|
|
1117
|
-
const fullpath = [...
|
|
1117
|
+
const fullpath = [...path72, ...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, path72 = []) => {
|
|
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 }, [...path72, ...issue2.path]));
|
|
1161
1161
|
} else if (issue2.code === "invalid_key") {
|
|
1162
|
-
processError({ issues: issue2.issues }, [...
|
|
1162
|
+
processError({ issues: issue2.issues }, [...path72, ...issue2.path]);
|
|
1163
1163
|
} else if (issue2.code === "invalid_element") {
|
|
1164
|
-
processError({ issues: issue2.issues }, [...
|
|
1164
|
+
processError({ issues: issue2.issues }, [...path72, ...issue2.path]);
|
|
1165
1165
|
} else {
|
|
1166
|
-
const fullpath = [...
|
|
1166
|
+
const fullpath = [...path72, ...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 path72 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1206
|
+
for (const seg of path72) {
|
|
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 path72 = ref.slice(1).split("/").filter(Boolean);
|
|
19203
|
+
if (path72.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 (path72[0] === defsKey) {
|
|
19208
|
+
const key = path72[1] === void 0 ? void 0 : decodeJSONPointerSegment(path72[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 path72 = require("path");
|
|
23716
23716
|
var os14 = require("os");
|
|
23717
23717
|
var homedir = os14.homedir();
|
|
23718
23718
|
var tmpdir = os14.tmpdir();
|
|
23719
23719
|
var { env } = process;
|
|
23720
23720
|
var macos = (name) => {
|
|
23721
|
-
const library =
|
|
23721
|
+
const library = path72.join(homedir, "Library");
|
|
23722
23722
|
return {
|
|
23723
|
-
data:
|
|
23724
|
-
config:
|
|
23725
|
-
cache:
|
|
23726
|
-
log:
|
|
23727
|
-
temp:
|
|
23723
|
+
data: path72.join(library, "Application Support", name),
|
|
23724
|
+
config: path72.join(library, "Preferences", name),
|
|
23725
|
+
cache: path72.join(library, "Caches", name),
|
|
23726
|
+
log: path72.join(library, "Logs", name),
|
|
23727
|
+
temp: path72.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 || path72.join(homedir, "AppData", "Roaming");
|
|
23732
|
+
const localAppData = env.LOCALAPPDATA || path72.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: path72.join(localAppData, name, "Data"),
|
|
23736
|
+
config: path72.join(appData, name, "Config"),
|
|
23737
|
+
cache: path72.join(localAppData, name, "Cache"),
|
|
23738
|
+
log: path72.join(localAppData, name, "Log"),
|
|
23739
|
+
temp: path72.join(tmpdir, name)
|
|
23740
23740
|
};
|
|
23741
23741
|
};
|
|
23742
23742
|
var linux = (name) => {
|
|
23743
|
-
const username =
|
|
23743
|
+
const username = path72.basename(homedir);
|
|
23744
23744
|
return {
|
|
23745
|
-
data:
|
|
23746
|
-
config:
|
|
23747
|
-
cache:
|
|
23745
|
+
data: path72.join(env.XDG_DATA_HOME || path72.join(homedir, ".local", "share"), name),
|
|
23746
|
+
config: path72.join(env.XDG_CONFIG_HOME || path72.join(homedir, ".config"), name),
|
|
23747
|
+
cache: path72.join(env.XDG_CACHE_HOME || path72.join(homedir, ".cache"), name),
|
|
23748
23748
|
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
23749
|
-
log:
|
|
23750
|
-
temp:
|
|
23749
|
+
log: path72.join(env.XDG_STATE_HOME || path72.join(homedir, ".local", "state"), name),
|
|
23750
|
+
temp: path72.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, path72) {
|
|
23819
|
+
if (typeof path72 === "string" && Object.prototype.hasOwnProperty.call(source, path72)) {
|
|
23820
|
+
return source[path72];
|
|
23821
23821
|
}
|
|
23822
|
-
const parsedPath = typeof
|
|
23822
|
+
const parsedPath = typeof path72 === "string" ? path72.split(".") : path72;
|
|
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(path72) {
|
|
23846
23846
|
try {
|
|
23847
|
-
const stat = await fs_1.promises.stat(
|
|
23847
|
+
const stat = await fs_1.promises.stat(path72);
|
|
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(path72) {
|
|
23858
23858
|
try {
|
|
23859
|
-
const stat = fs_1.default.statSync(
|
|
23859
|
+
const stat = fs_1.default.statSync(path72);
|
|
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((path72, i10) => `${i10 + 1}. ${path72}`).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(path72) {
|
|
24146
24146
|
try {
|
|
24147
|
-
await promises_1.default.stat(
|
|
24147
|
+
await promises_1.default.stat(path72);
|
|
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(path72) {
|
|
24308
24308
|
try {
|
|
24309
|
-
fs_1.default.statSync(
|
|
24309
|
+
fs_1.default.statSync(path72);
|
|
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((path72) => path72.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: path72, keys }) => `${path72.length === 0 ? "" : `${path72.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: path72, values } of ignored) {
|
|
24586
24586
|
let holder = restored;
|
|
24587
|
-
for (const step2 of
|
|
24587
|
+
for (const step2 of path72) {
|
|
24588
24588
|
holder = isRecord(holder) ? holder[step2] : void 0;
|
|
24589
24589
|
}
|
|
24590
24590
|
if (isRecord(holder)) {
|
|
@@ -28386,28 +28386,38 @@ function recordOf(details) {
|
|
|
28386
28386
|
}
|
|
28387
28387
|
function writeFrontDoorSession(fs31, sessionsDir, session) {
|
|
28388
28388
|
fs31.mkdirPrivate(sessionsDir);
|
|
28389
|
-
fs31.writeFilePrivate(import_node_path6.default.join(sessionsDir,
|
|
28389
|
+
fs31.writeFilePrivate(import_node_path6.default.join(sessionsDir, sessionRecordName(session.pid)), `${JSON.stringify(session, null, 2)}
|
|
28390
28390
|
`);
|
|
28391
28391
|
}
|
|
28392
|
+
function sessionRecordName(pid) {
|
|
28393
|
+
return `${String(pid)}.json`;
|
|
28394
|
+
}
|
|
28395
|
+
function isSessionRecordName(name) {
|
|
28396
|
+
return name.endsWith(".json");
|
|
28397
|
+
}
|
|
28398
|
+
function summaryOf(session) {
|
|
28399
|
+
return { pid: session.pid, startedAt: session.startedAt, ...session.supervisorPid === void 0 ? {} : { supervisorPid: session.supervisorPid } };
|
|
28400
|
+
}
|
|
28401
|
+
function readFrontDoorSessionRecord(fs31, sessionsDir, name) {
|
|
28402
|
+
try {
|
|
28403
|
+
const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(fs31.readFileUtf8(import_node_path6.default.join(sessionsDir, name)) ?? ""));
|
|
28404
|
+
return parsed.success ? parsed.data : void 0;
|
|
28405
|
+
} catch {
|
|
28406
|
+
return void 0;
|
|
28407
|
+
}
|
|
28408
|
+
}
|
|
28392
28409
|
function listFrontDoorSessions(fs31, sessionsDir) {
|
|
28393
28410
|
const sessions = [];
|
|
28394
28411
|
for (const name of fs31.readdir(sessionsDir)) {
|
|
28395
|
-
|
|
28396
|
-
|
|
28397
|
-
|
|
28398
|
-
try {
|
|
28399
|
-
const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(fs31.readFileUtf8(import_node_path6.default.join(sessionsDir, name)) ?? ""));
|
|
28400
|
-
if (parsed.success) {
|
|
28401
|
-
sessions.push({ pid: parsed.data.pid, startedAt: parsed.data.startedAt, ...parsed.data.supervisorPid === void 0 ? {} : { supervisorPid: parsed.data.supervisorPid } });
|
|
28402
|
-
}
|
|
28403
|
-
} catch {
|
|
28404
|
-
continue;
|
|
28412
|
+
const record2 = isSessionRecordName(name) ? readFrontDoorSessionRecord(fs31, sessionsDir, name) : void 0;
|
|
28413
|
+
if (record2 !== void 0) {
|
|
28414
|
+
sessions.push(summaryOf(record2));
|
|
28405
28415
|
}
|
|
28406
28416
|
}
|
|
28407
28417
|
return sessions.sort((a10, b) => a10.pid - b.pid);
|
|
28408
28418
|
}
|
|
28409
28419
|
function removeFrontDoorSession(fs31, sessionsDir, pid) {
|
|
28410
|
-
fs31.removeRecursive(import_node_path6.default.join(sessionsDir,
|
|
28420
|
+
fs31.removeRecursive(import_node_path6.default.join(sessionsDir, sessionRecordName(pid)));
|
|
28411
28421
|
}
|
|
28412
28422
|
function pruneDeadFrontDoorSessions(fs31, sessionsDir, listed, isRunning) {
|
|
28413
28423
|
const removed = [];
|
|
@@ -28419,39 +28429,6 @@ function pruneDeadFrontDoorSessions(fs31, sessionsDir, listed, isRunning) {
|
|
|
28419
28429
|
}
|
|
28420
28430
|
return removed;
|
|
28421
28431
|
}
|
|
28422
|
-
function liveSessionTokens(fs31, sessionsDir) {
|
|
28423
|
-
const tokens = /* @__PURE__ */ new Set();
|
|
28424
|
-
for (const name of fs31.readdir(sessionsDir)) {
|
|
28425
|
-
if (!name.endsWith(".json")) {
|
|
28426
|
-
continue;
|
|
28427
|
-
}
|
|
28428
|
-
try {
|
|
28429
|
-
const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(fs31.readFileUtf8(import_node_path6.default.join(sessionsDir, name)) ?? ""));
|
|
28430
|
-
if (parsed.success) {
|
|
28431
|
-
tokens.add(parsed.data.token);
|
|
28432
|
-
}
|
|
28433
|
-
} catch {
|
|
28434
|
-
continue;
|
|
28435
|
-
}
|
|
28436
|
-
}
|
|
28437
|
-
return tokens;
|
|
28438
|
-
}
|
|
28439
|
-
function readFrontDoorSessionModels(fs31, sessionsDir, sessionId) {
|
|
28440
|
-
for (const name of fs31.readdir(sessionsDir)) {
|
|
28441
|
-
if (!name.endsWith(".json")) {
|
|
28442
|
-
continue;
|
|
28443
|
-
}
|
|
28444
|
-
try {
|
|
28445
|
-
const parsed = FrontDoorSessionSchema.safeParse(JSON.parse(fs31.readFileUtf8(import_node_path6.default.join(sessionsDir, name)) ?? ""));
|
|
28446
|
-
if (parsed.success && parsed.data.sessionId === sessionId) {
|
|
28447
|
-
return parsed.data.models;
|
|
28448
|
-
}
|
|
28449
|
-
} catch {
|
|
28450
|
-
continue;
|
|
28451
|
-
}
|
|
28452
|
-
}
|
|
28453
|
-
return void 0;
|
|
28454
|
-
}
|
|
28455
28432
|
var import_node_path6, FRONT_DOOR_PROTOCOL, FRONT_DOOR_HANDOVER_PROTOCOL, FrontDoorSessionSchema, FrontDoorStateSchema, MAX_TCP_PORT, FrontDoorDirectRecordSchema, RECORD_TEMPORARY_FILE;
|
|
28456
28433
|
var init_state = __esm({
|
|
28457
28434
|
"src/frontdoor/state.ts"() {
|
|
@@ -30915,8 +30892,8 @@ var require_utils = __commonJS({
|
|
|
30915
30892
|
}
|
|
30916
30893
|
return output2;
|
|
30917
30894
|
};
|
|
30918
|
-
exports2.basename = (
|
|
30919
|
-
const segs =
|
|
30895
|
+
exports2.basename = (path72, { windows } = {}) => {
|
|
30896
|
+
const segs = path72.split(windows ? /[\\/]/ : "/");
|
|
30920
30897
|
const last = segs[segs.length - 1];
|
|
30921
30898
|
if (last === "") {
|
|
30922
30899
|
return segs[segs.length - 2];
|
|
@@ -32696,9 +32673,9 @@ var init_identity = __esm({
|
|
|
32696
32673
|
});
|
|
32697
32674
|
|
|
32698
32675
|
// src/statusline/keys.ts
|
|
32699
|
-
function valueAt(source,
|
|
32676
|
+
function valueAt(source, path72) {
|
|
32700
32677
|
let current = source;
|
|
32701
|
-
for (const part of
|
|
32678
|
+
for (const part of path72) {
|
|
32702
32679
|
if (!isPlainObject2(current)) {
|
|
32703
32680
|
return void 0;
|
|
32704
32681
|
}
|
|
@@ -32706,10 +32683,10 @@ function valueAt(source, path71) {
|
|
|
32706
32683
|
}
|
|
32707
32684
|
return current;
|
|
32708
32685
|
}
|
|
32709
|
-
function keyOf(
|
|
32686
|
+
function keyOf(path72, declared) {
|
|
32710
32687
|
const optional2 = declared instanceof external_exports.ZodOptional;
|
|
32711
32688
|
const leaf = optional2 ? declared.unwrap() : declared;
|
|
32712
|
-
const common = { path:
|
|
32689
|
+
const common = { path: path72.join("."), description: declared.description ?? "", defaultValue: valueAt(STATUSLINE_DEFAULTS, path72), optional: optional2 };
|
|
32713
32690
|
if (leaf instanceof external_exports.ZodNumber) {
|
|
32714
32691
|
return { ...common, kind: "integer", choices: [] };
|
|
32715
32692
|
}
|
|
@@ -32734,7 +32711,7 @@ function keyOf(path71, declared) {
|
|
|
32734
32711
|
if (leaf instanceof external_exports.ZodArray && leaf.element instanceof external_exports.ZodString) {
|
|
32735
32712
|
return { ...common, kind: "textList", choices: [] };
|
|
32736
32713
|
}
|
|
32737
|
-
throw new TypeError(`statusline setting ${
|
|
32714
|
+
throw new TypeError(`statusline setting ${path72.join(".")} has a kind the key listing does not describe`);
|
|
32738
32715
|
}
|
|
32739
32716
|
function walk(shape, prefix) {
|
|
32740
32717
|
return Object.entries(shape).flatMap(([name, schema]) => schema instanceof external_exports.ZodObject ? walk(schema.shape, [...prefix, name]) : [keyOf([...prefix, name], schema)]);
|
|
@@ -32758,14 +32735,14 @@ var init_keys = __esm({
|
|
|
32758
32735
|
});
|
|
32759
32736
|
|
|
32760
32737
|
// src/statusline/change.ts
|
|
32761
|
-
function keyNamed(
|
|
32762
|
-
const found = statuslineKeys().find((key) => key.path ===
|
|
32738
|
+
function keyNamed(path72) {
|
|
32739
|
+
const found = statuslineKeys().find((key) => key.path === path72);
|
|
32763
32740
|
if (found === void 0) {
|
|
32764
|
-
throw new UsageError(`"${
|
|
32741
|
+
throw new UsageError(`"${path72}" is not a statusline setting; \`agent-shim statusline keys\` lists them.`);
|
|
32765
32742
|
}
|
|
32766
32743
|
return found;
|
|
32767
32744
|
}
|
|
32768
|
-
function textListOf(
|
|
32745
|
+
function textListOf(path72, raw) {
|
|
32769
32746
|
if (raw === "") {
|
|
32770
32747
|
return [];
|
|
32771
32748
|
}
|
|
@@ -32773,10 +32750,10 @@ function textListOf(path71, raw) {
|
|
|
32773
32750
|
try {
|
|
32774
32751
|
parsed = JSON.parse(raw);
|
|
32775
32752
|
} catch {
|
|
32776
|
-
throw new UsageError(`${
|
|
32753
|
+
throw new UsageError(`${path72}: "${raw}" is not a JSON array of strings such as ["git","describe"].`);
|
|
32777
32754
|
}
|
|
32778
32755
|
if (!Array.isArray(parsed) || parsed.some((item) => typeof item !== "string")) {
|
|
32779
|
-
throw new UsageError(`${
|
|
32756
|
+
throw new UsageError(`${path72}: "${raw}" is not a JSON array of strings such as ["git","describe"].`);
|
|
32780
32757
|
}
|
|
32781
32758
|
return parsed;
|
|
32782
32759
|
}
|
|
@@ -32785,42 +32762,42 @@ function parseStatuslineAssignment(text5) {
|
|
|
32785
32762
|
if (split < 1) {
|
|
32786
32763
|
throw new UsageError(`"${text5}" is not <setting>=<value>.`);
|
|
32787
32764
|
}
|
|
32788
|
-
const
|
|
32765
|
+
const path72 = text5.slice(0, split);
|
|
32789
32766
|
const raw = text5.slice(split + 1);
|
|
32790
|
-
const key = keyNamed(
|
|
32767
|
+
const key = keyNamed(path72);
|
|
32791
32768
|
if (key.optional && raw === UNSET_WORD) {
|
|
32792
|
-
return { path:
|
|
32769
|
+
return { path: path72, value: null };
|
|
32793
32770
|
}
|
|
32794
32771
|
switch (key.kind) {
|
|
32795
32772
|
case "integer": {
|
|
32796
32773
|
const number6 = Number(raw);
|
|
32797
32774
|
if (raw.trim() === "" || !Number.isFinite(number6)) {
|
|
32798
|
-
throw new UsageError(`${
|
|
32775
|
+
throw new UsageError(`${path72}: "${raw}" is not a number.`);
|
|
32799
32776
|
}
|
|
32800
|
-
return { path:
|
|
32777
|
+
return { path: path72, value: number6 };
|
|
32801
32778
|
}
|
|
32802
32779
|
case "boolean":
|
|
32803
32780
|
if (raw !== "true" && raw !== "false") {
|
|
32804
|
-
throw new UsageError(`${
|
|
32781
|
+
throw new UsageError(`${path72}: "${raw}" is not true or false.`);
|
|
32805
32782
|
}
|
|
32806
|
-
return { path:
|
|
32783
|
+
return { path: path72, value: raw === "true" };
|
|
32807
32784
|
case "text":
|
|
32808
32785
|
case "choice":
|
|
32809
|
-
return { path:
|
|
32786
|
+
return { path: path72, value: raw };
|
|
32810
32787
|
case "colour":
|
|
32811
|
-
return { path:
|
|
32788
|
+
return { path: path72, value: /^\d+$/.test(raw) ? Number(raw) : raw };
|
|
32812
32789
|
case "list":
|
|
32813
|
-
return { path:
|
|
32790
|
+
return { path: path72, value: raw === "" ? [] : raw.split(",") };
|
|
32814
32791
|
case "groups":
|
|
32815
|
-
return { path:
|
|
32792
|
+
return { path: path72, value: raw === "" ? [] : raw.split(";").map((group) => group.split(",")) };
|
|
32816
32793
|
case "textList":
|
|
32817
|
-
return { path:
|
|
32794
|
+
return { path: path72, value: textListOf(path72, raw) };
|
|
32818
32795
|
default:
|
|
32819
32796
|
return key.kind;
|
|
32820
32797
|
}
|
|
32821
32798
|
}
|
|
32822
|
-
function setAt(target,
|
|
32823
|
-
const [head, ...rest] =
|
|
32799
|
+
function setAt(target, path72, value2) {
|
|
32800
|
+
const [head, ...rest] = path72;
|
|
32824
32801
|
if (head === void 0) {
|
|
32825
32802
|
return;
|
|
32826
32803
|
}
|
|
@@ -32833,8 +32810,8 @@ function setAt(target, path71, value2) {
|
|
|
32833
32810
|
target[head] = next;
|
|
32834
32811
|
setAt(next, rest, value2);
|
|
32835
32812
|
}
|
|
32836
|
-
function removeAt(target,
|
|
32837
|
-
const [head, ...rest] =
|
|
32813
|
+
function removeAt(target, path72) {
|
|
32814
|
+
const [head, ...rest] = path72;
|
|
32838
32815
|
if (head === void 0) {
|
|
32839
32816
|
return;
|
|
32840
32817
|
}
|
|
@@ -32852,13 +32829,13 @@ function removeAt(target, path71) {
|
|
|
32852
32829
|
}
|
|
32853
32830
|
function applyStatuslineChange(existing, change) {
|
|
32854
32831
|
const draft = structuredClone(existing ?? {});
|
|
32855
|
-
for (const [
|
|
32856
|
-
keyNamed(
|
|
32857
|
-
setAt(draft,
|
|
32832
|
+
for (const [path72, value2] of Object.entries(change.set ?? {})) {
|
|
32833
|
+
keyNamed(path72);
|
|
32834
|
+
setAt(draft, path72.split("."), value2);
|
|
32858
32835
|
}
|
|
32859
|
-
for (const
|
|
32860
|
-
keyNamed(
|
|
32861
|
-
removeAt(draft,
|
|
32836
|
+
for (const path72 of change.unset ?? []) {
|
|
32837
|
+
keyNamed(path72);
|
|
32838
|
+
removeAt(draft, path72.split("."));
|
|
32862
32839
|
}
|
|
32863
32840
|
const result = StatuslineSchema.safeParse(draft);
|
|
32864
32841
|
if (!result.success) {
|
|
@@ -36348,11 +36325,11 @@ function identifyRequest(headers) {
|
|
|
36348
36325
|
function directOrigin2(port) {
|
|
36349
36326
|
return `http://127.0.0.1:${String(port)}`;
|
|
36350
36327
|
}
|
|
36351
|
-
function parseProviderPath(
|
|
36352
|
-
if (!
|
|
36328
|
+
function parseProviderPath(path72) {
|
|
36329
|
+
if (!path72.startsWith(PROVIDER_PATH_PREFIX)) {
|
|
36353
36330
|
return void 0;
|
|
36354
36331
|
}
|
|
36355
|
-
const tail =
|
|
36332
|
+
const tail = path72.slice(PROVIDER_PATH_PREFIX.length);
|
|
36356
36333
|
const slash = tail.indexOf("/");
|
|
36357
36334
|
if (slash <= 0) {
|
|
36358
36335
|
return void 0;
|
|
@@ -36579,9 +36556,10 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
|
|
|
36579
36556
|
return FRONTDOOR_SUPERVISOR_STILL_RUNNING;
|
|
36580
36557
|
}
|
|
36581
36558
|
ticks += 1;
|
|
36582
|
-
const listed =
|
|
36559
|
+
const listed = ports.registry.rescan();
|
|
36583
36560
|
const running = await ports.runningAmong(listed.map((session) => session.pid));
|
|
36584
36561
|
const pruned = pruneDeadFrontDoorSessions(fs31, paths.frontdoorSessionsDir, listed, (pid) => running.has(pid));
|
|
36562
|
+
ports.registry.forget(pruned);
|
|
36585
36563
|
ports.observeLaunchRegistry(listed, pruned);
|
|
36586
36564
|
ports.checkQuotaExpiry();
|
|
36587
36565
|
const prunedPids = new Set(pruned);
|
|
@@ -36652,8 +36630,8 @@ function parseConnectTarget(authority) {
|
|
|
36652
36630
|
}
|
|
36653
36631
|
return { host, port };
|
|
36654
36632
|
}
|
|
36655
|
-
function servedByPipeline(
|
|
36656
|
-
return
|
|
36633
|
+
function servedByPipeline(path72) {
|
|
36634
|
+
return path72?.startsWith(ROUTED_PATH_PREFIX) === true;
|
|
36657
36635
|
}
|
|
36658
36636
|
function forwardableHeaders(headers) {
|
|
36659
36637
|
const connectionTokens = new Set(
|
|
@@ -37145,7 +37123,7 @@ var init_package = __esm({
|
|
|
37145
37123
|
"package.json"() {
|
|
37146
37124
|
package_default = {
|
|
37147
37125
|
name: "claude-use",
|
|
37148
|
-
version: "11.65.
|
|
37126
|
+
version: "11.65.1",
|
|
37149
37127
|
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.",
|
|
37150
37128
|
license: "MIT",
|
|
37151
37129
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -37668,12 +37646,12 @@ function decoderFor(encoding) {
|
|
|
37668
37646
|
return void 0;
|
|
37669
37647
|
}
|
|
37670
37648
|
}
|
|
37671
|
-
function destinationOf(
|
|
37672
|
-
const scoped = parseProviderPath(
|
|
37649
|
+
function destinationOf(path72, sessionProvider) {
|
|
37650
|
+
const scoped = parseProviderPath(path72);
|
|
37673
37651
|
if (scoped !== void 0) {
|
|
37674
37652
|
return { provider: scoped.provider, endpoint: scoped.rest };
|
|
37675
37653
|
}
|
|
37676
|
-
return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint:
|
|
37654
|
+
return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint: path72 };
|
|
37677
37655
|
}
|
|
37678
37656
|
function modelChoiceOf(event, servedModel, provider) {
|
|
37679
37657
|
if (event.modelChoice !== void 0) return event.modelChoice;
|
|
@@ -40696,14 +40674,14 @@ var require_util2 = __commonJS({
|
|
|
40696
40674
|
}
|
|
40697
40675
|
const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
|
|
40698
40676
|
let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
|
|
40699
|
-
let
|
|
40677
|
+
let path72 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
|
|
40700
40678
|
if (origin[origin.length - 1] === "/") {
|
|
40701
40679
|
origin = origin.slice(0, origin.length - 1);
|
|
40702
40680
|
}
|
|
40703
|
-
if (
|
|
40704
|
-
|
|
40681
|
+
if (path72 && path72[0] !== "/") {
|
|
40682
|
+
path72 = `/${path72}`;
|
|
40705
40683
|
}
|
|
40706
|
-
return new URL(`${origin}${
|
|
40684
|
+
return new URL(`${origin}${path72}`);
|
|
40707
40685
|
}
|
|
40708
40686
|
if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
|
|
40709
40687
|
throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -41524,9 +41502,9 @@ var require_diagnostics = __commonJS({
|
|
|
41524
41502
|
"undici:client:sendHeaders",
|
|
41525
41503
|
(evt) => {
|
|
41526
41504
|
const {
|
|
41527
|
-
request: { method, path:
|
|
41505
|
+
request: { method, path: path72, origin }
|
|
41528
41506
|
} = evt;
|
|
41529
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
41507
|
+
debugLog("sending request to %s %s%s", method, origin, path72);
|
|
41530
41508
|
}
|
|
41531
41509
|
);
|
|
41532
41510
|
}
|
|
@@ -41544,14 +41522,14 @@ var require_diagnostics = __commonJS({
|
|
|
41544
41522
|
"undici:request:headers",
|
|
41545
41523
|
(evt) => {
|
|
41546
41524
|
const {
|
|
41547
|
-
request: { method, path:
|
|
41525
|
+
request: { method, path: path72, origin },
|
|
41548
41526
|
response: { statusCode }
|
|
41549
41527
|
} = evt;
|
|
41550
41528
|
debugLog(
|
|
41551
41529
|
"received response to %s %s%s - HTTP %d",
|
|
41552
41530
|
method,
|
|
41553
41531
|
origin,
|
|
41554
|
-
|
|
41532
|
+
path72,
|
|
41555
41533
|
statusCode
|
|
41556
41534
|
);
|
|
41557
41535
|
}
|
|
@@ -41560,23 +41538,23 @@ var require_diagnostics = __commonJS({
|
|
|
41560
41538
|
"undici:request:trailers",
|
|
41561
41539
|
(evt) => {
|
|
41562
41540
|
const {
|
|
41563
|
-
request: { method, path:
|
|
41541
|
+
request: { method, path: path72, origin }
|
|
41564
41542
|
} = evt;
|
|
41565
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
41543
|
+
debugLog("trailers received from %s %s%s", method, origin, path72);
|
|
41566
41544
|
}
|
|
41567
41545
|
);
|
|
41568
41546
|
diagnosticsChannel.subscribe(
|
|
41569
41547
|
"undici:request:error",
|
|
41570
41548
|
(evt) => {
|
|
41571
41549
|
const {
|
|
41572
|
-
request: { method, path:
|
|
41550
|
+
request: { method, path: path72, origin },
|
|
41573
41551
|
error: error63
|
|
41574
41552
|
} = evt;
|
|
41575
41553
|
debugLog(
|
|
41576
41554
|
"request to %s %s%s errored - %s",
|
|
41577
41555
|
method,
|
|
41578
41556
|
origin,
|
|
41579
|
-
|
|
41557
|
+
path72,
|
|
41580
41558
|
error63.message
|
|
41581
41559
|
);
|
|
41582
41560
|
}
|
|
@@ -41691,7 +41669,7 @@ var require_request = __commonJS({
|
|
|
41691
41669
|
var kHandler = /* @__PURE__ */ Symbol("handler");
|
|
41692
41670
|
var Request2 = class {
|
|
41693
41671
|
constructor(origin, {
|
|
41694
|
-
path:
|
|
41672
|
+
path: path72,
|
|
41695
41673
|
method,
|
|
41696
41674
|
body,
|
|
41697
41675
|
headers,
|
|
@@ -41708,11 +41686,11 @@ var require_request = __commonJS({
|
|
|
41708
41686
|
maxRedirections,
|
|
41709
41687
|
typeOfService
|
|
41710
41688
|
}, handler) {
|
|
41711
|
-
if (typeof
|
|
41689
|
+
if (typeof path72 !== "string") {
|
|
41712
41690
|
throw new InvalidArgumentError2("path must be a string");
|
|
41713
|
-
} else if (
|
|
41691
|
+
} else if (path72[0] !== "/" && !(path72.startsWith("http://") || path72.startsWith("https://")) && method !== "CONNECT") {
|
|
41714
41692
|
throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
|
|
41715
|
-
} else if (invalidPathRegex.test(
|
|
41693
|
+
} else if (invalidPathRegex.test(path72)) {
|
|
41716
41694
|
throw new InvalidArgumentError2("invalid request path");
|
|
41717
41695
|
}
|
|
41718
41696
|
if (typeof method !== "string") {
|
|
@@ -41787,7 +41765,7 @@ var require_request = __commonJS({
|
|
|
41787
41765
|
this.completed = false;
|
|
41788
41766
|
this.aborted = false;
|
|
41789
41767
|
this.upgrade = upgrade || null;
|
|
41790
|
-
this.path = query ? serializePathWithQuery(
|
|
41768
|
+
this.path = query ? serializePathWithQuery(path72, query) : path72;
|
|
41791
41769
|
this.origin = origin;
|
|
41792
41770
|
this.protocol = getProtocolFromUrlString(origin);
|
|
41793
41771
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -46969,7 +46947,7 @@ var require_client_h1 = __commonJS({
|
|
|
46969
46947
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
46970
46948
|
}
|
|
46971
46949
|
function writeH1(client, request7) {
|
|
46972
|
-
const { method, path:
|
|
46950
|
+
const { method, path: path72, host, upgrade, blocking, reset } = request7;
|
|
46973
46951
|
let { body, headers, contentLength } = request7;
|
|
46974
46952
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
46975
46953
|
if (util2.isFormDataLike(body)) {
|
|
@@ -47047,7 +47025,7 @@ var require_client_h1 = __commonJS({
|
|
|
47047
47025
|
if (socket.setTypeOfService) {
|
|
47048
47026
|
socket.setTypeOfService(request7.typeOfService);
|
|
47049
47027
|
}
|
|
47050
|
-
let header = `${method} ${
|
|
47028
|
+
let header = `${method} ${path72} HTTP/1.1\r
|
|
47051
47029
|
`;
|
|
47052
47030
|
if (typeof host === "string") {
|
|
47053
47031
|
header += `host: ${host}\r
|
|
@@ -47726,7 +47704,7 @@ var require_client_h2 = __commonJS({
|
|
|
47726
47704
|
const headersTimeout = request7.headersTimeout ?? client[kHeadersTimeout];
|
|
47727
47705
|
const bodyTimeout = request7.bodyTimeout ?? client[kBodyTimeout];
|
|
47728
47706
|
const session = client[kHTTP2Session];
|
|
47729
|
-
const { method, path:
|
|
47707
|
+
const { method, path: path72, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
|
|
47730
47708
|
let { body } = request7;
|
|
47731
47709
|
if (upgrade != null && upgrade !== "websocket") {
|
|
47732
47710
|
util2.errorRequest(client, request7, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
@@ -47795,7 +47773,7 @@ var require_client_h2 = __commonJS({
|
|
|
47795
47773
|
}
|
|
47796
47774
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
47797
47775
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
47798
|
-
headers[HTTP2_HEADER_PATH] =
|
|
47776
|
+
headers[HTTP2_HEADER_PATH] = path72;
|
|
47799
47777
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
47800
47778
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
47801
47779
|
} else {
|
|
@@ -47837,7 +47815,7 @@ var require_client_h2 = __commonJS({
|
|
|
47837
47815
|
stream.setTimeout(headersTimeout);
|
|
47838
47816
|
return true;
|
|
47839
47817
|
}
|
|
47840
|
-
headers[HTTP2_HEADER_PATH] =
|
|
47818
|
+
headers[HTTP2_HEADER_PATH] = path72;
|
|
47841
47819
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
47842
47820
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
47843
47821
|
if (body && typeof body.read === "function") {
|
|
@@ -50189,10 +50167,10 @@ var require_proxy_agent = __commonJS({
|
|
|
50189
50167
|
};
|
|
50190
50168
|
const {
|
|
50191
50169
|
origin,
|
|
50192
|
-
path:
|
|
50170
|
+
path: path72 = "/",
|
|
50193
50171
|
headers = {}
|
|
50194
50172
|
} = opts;
|
|
50195
|
-
opts.path = origin +
|
|
50173
|
+
opts.path = origin + path72;
|
|
50196
50174
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
50197
50175
|
const { host } = new URL(origin);
|
|
50198
50176
|
headers.host = host;
|
|
@@ -52301,20 +52279,20 @@ var require_mock_utils = __commonJS({
|
|
|
52301
52279
|
}
|
|
52302
52280
|
return normalizedQp;
|
|
52303
52281
|
}
|
|
52304
|
-
function safeUrl(
|
|
52305
|
-
if (typeof
|
|
52306
|
-
return
|
|
52282
|
+
function safeUrl(path72) {
|
|
52283
|
+
if (typeof path72 !== "string") {
|
|
52284
|
+
return path72;
|
|
52307
52285
|
}
|
|
52308
|
-
const pathSegments =
|
|
52286
|
+
const pathSegments = path72.split("?", 3);
|
|
52309
52287
|
if (pathSegments.length !== 2) {
|
|
52310
|
-
return
|
|
52288
|
+
return path72;
|
|
52311
52289
|
}
|
|
52312
52290
|
const qp2 = new URLSearchParams(pathSegments.pop());
|
|
52313
52291
|
qp2.sort();
|
|
52314
52292
|
return [...pathSegments, qp2.toString()].join("?");
|
|
52315
52293
|
}
|
|
52316
|
-
function matchKey(mockDispatch2, { path:
|
|
52317
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
52294
|
+
function matchKey(mockDispatch2, { path: path72, method, body, headers }) {
|
|
52295
|
+
const pathMatch = matchValue(mockDispatch2.path, path72);
|
|
52318
52296
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
52319
52297
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
52320
52298
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -52339,8 +52317,8 @@ var require_mock_utils = __commonJS({
|
|
|
52339
52317
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
52340
52318
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
52341
52319
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
52342
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
52343
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
52320
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path72, ignoreTrailingSlash }) => {
|
|
52321
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path72)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path72), resolvedPath);
|
|
52344
52322
|
});
|
|
52345
52323
|
if (matchedMockDispatches.length === 0) {
|
|
52346
52324
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -52379,19 +52357,19 @@ var require_mock_utils = __commonJS({
|
|
|
52379
52357
|
mockDispatches.splice(index, 1);
|
|
52380
52358
|
}
|
|
52381
52359
|
}
|
|
52382
|
-
function removeTrailingSlash(
|
|
52383
|
-
while (
|
|
52384
|
-
|
|
52360
|
+
function removeTrailingSlash(path72) {
|
|
52361
|
+
while (path72.endsWith("/")) {
|
|
52362
|
+
path72 = path72.slice(0, -1);
|
|
52385
52363
|
}
|
|
52386
|
-
if (
|
|
52387
|
-
|
|
52364
|
+
if (path72.length === 0) {
|
|
52365
|
+
path72 = "/";
|
|
52388
52366
|
}
|
|
52389
|
-
return
|
|
52367
|
+
return path72;
|
|
52390
52368
|
}
|
|
52391
52369
|
function buildKey(opts) {
|
|
52392
|
-
const { path:
|
|
52370
|
+
const { path: path72, method, body, headers, query } = opts;
|
|
52393
52371
|
return {
|
|
52394
|
-
path:
|
|
52372
|
+
path: path72,
|
|
52395
52373
|
method,
|
|
52396
52374
|
body,
|
|
52397
52375
|
headers,
|
|
@@ -53081,10 +53059,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
53081
53059
|
}
|
|
53082
53060
|
format(pendingInterceptors) {
|
|
53083
53061
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
53084
|
-
({ method, path:
|
|
53062
|
+
({ method, path: path72, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
53085
53063
|
Method: method,
|
|
53086
53064
|
Origin: origin,
|
|
53087
|
-
Path:
|
|
53065
|
+
Path: path72,
|
|
53088
53066
|
"Status code": statusCode,
|
|
53089
53067
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
53090
53068
|
Invocations: timesInvoked,
|
|
@@ -53166,9 +53144,9 @@ var require_mock_agent = __commonJS({
|
|
|
53166
53144
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
53167
53145
|
const dispatchOpts = { ...opts };
|
|
53168
53146
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
53169
|
-
const [
|
|
53147
|
+
const [path72, searchParams] = dispatchOpts.path.split("?");
|
|
53170
53148
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
53171
|
-
dispatchOpts.path = `${
|
|
53149
|
+
dispatchOpts.path = `${path72}?${normalizedSearchParams}`;
|
|
53172
53150
|
}
|
|
53173
53151
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
53174
53152
|
}
|
|
@@ -53569,12 +53547,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
53569
53547
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
53570
53548
|
*/
|
|
53571
53549
|
async loadSnapshots(filePath) {
|
|
53572
|
-
const
|
|
53573
|
-
if (!
|
|
53550
|
+
const path72 = filePath || this.#snapshotPath;
|
|
53551
|
+
if (!path72) {
|
|
53574
53552
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
53575
53553
|
}
|
|
53576
53554
|
try {
|
|
53577
|
-
const data = await readFile(resolve2(
|
|
53555
|
+
const data = await readFile(resolve2(path72), "utf8");
|
|
53578
53556
|
const parsed = JSON.parse(data);
|
|
53579
53557
|
if (Array.isArray(parsed)) {
|
|
53580
53558
|
this.#snapshots.clear();
|
|
@@ -53588,7 +53566,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
53588
53566
|
if (error63.code === "ENOENT") {
|
|
53589
53567
|
this.#snapshots.clear();
|
|
53590
53568
|
} else {
|
|
53591
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
53569
|
+
throw new UndiciError(`Failed to load snapshots from ${path72}`, { cause: error63 });
|
|
53592
53570
|
}
|
|
53593
53571
|
}
|
|
53594
53572
|
}
|
|
@@ -53599,11 +53577,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
53599
53577
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
53600
53578
|
*/
|
|
53601
53579
|
async saveSnapshots(filePath) {
|
|
53602
|
-
const
|
|
53603
|
-
if (!
|
|
53580
|
+
const path72 = filePath || this.#snapshotPath;
|
|
53581
|
+
if (!path72) {
|
|
53604
53582
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
53605
53583
|
}
|
|
53606
|
-
const resolvedPath = resolve2(
|
|
53584
|
+
const resolvedPath = resolve2(path72);
|
|
53607
53585
|
await mkdir(dirname3(resolvedPath), { recursive: true });
|
|
53608
53586
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
53609
53587
|
hash: hash2,
|
|
@@ -54235,15 +54213,15 @@ var require_redirect_handler = __commonJS({
|
|
|
54235
54213
|
return;
|
|
54236
54214
|
}
|
|
54237
54215
|
const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
54238
|
-
const
|
|
54239
|
-
const redirectUrlString = `${origin}${
|
|
54216
|
+
const path72 = search ? `${pathname}${search}` : pathname;
|
|
54217
|
+
const redirectUrlString = `${origin}${path72}`;
|
|
54240
54218
|
for (const historyUrl of this.history) {
|
|
54241
54219
|
if (historyUrl.toString() === redirectUrlString) {
|
|
54242
54220
|
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.`);
|
|
54243
54221
|
}
|
|
54244
54222
|
}
|
|
54245
54223
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
54246
|
-
this.opts.path =
|
|
54224
|
+
this.opts.path = path72;
|
|
54247
54225
|
this.opts.origin = origin;
|
|
54248
54226
|
this.opts.query = null;
|
|
54249
54227
|
}
|
|
@@ -56003,10 +55981,10 @@ var require_cache_handler = __commonJS({
|
|
|
56003
55981
|
}
|
|
56004
55982
|
return locationUrl.pathname + locationUrl.search;
|
|
56005
55983
|
}
|
|
56006
|
-
function deleteCachedUri(store, cacheKey,
|
|
55984
|
+
function deleteCachedUri(store, cacheKey, path72) {
|
|
56007
55985
|
deleteCachedValue(store, {
|
|
56008
55986
|
...cacheKey,
|
|
56009
|
-
path:
|
|
55987
|
+
path: path72
|
|
56010
55988
|
});
|
|
56011
55989
|
for (let i10 = 0; i10 < util2.safeHTTPMethods.length; i10++) {
|
|
56012
55990
|
const method = util2.safeHTTPMethods[i10];
|
|
@@ -56014,7 +55992,7 @@ var require_cache_handler = __commonJS({
|
|
|
56014
55992
|
deleteCachedValue(store, {
|
|
56015
55993
|
...cacheKey,
|
|
56016
55994
|
method,
|
|
56017
|
-
path:
|
|
55995
|
+
path: path72
|
|
56018
55996
|
});
|
|
56019
55997
|
}
|
|
56020
55998
|
}
|
|
@@ -56025,9 +56003,9 @@ var require_cache_handler = __commonJS({
|
|
|
56025
56003
|
}
|
|
56026
56004
|
const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
|
|
56027
56005
|
for (let i10 = 0; i10 < values.length; i10++) {
|
|
56028
|
-
const
|
|
56029
|
-
if (
|
|
56030
|
-
deleteCachedUri(store, cacheKey,
|
|
56006
|
+
const path72 = getSameOriginPath(cacheKey, values[i10]);
|
|
56007
|
+
if (path72 !== void 0) {
|
|
56008
|
+
deleteCachedUri(store, cacheKey, path72);
|
|
56031
56009
|
}
|
|
56032
56010
|
}
|
|
56033
56011
|
}
|
|
@@ -61027,11 +61005,11 @@ var require_fetch = __commonJS({
|
|
|
61027
61005
|
function dispatch({ body }) {
|
|
61028
61006
|
const url2 = requestCurrentURL(request7);
|
|
61029
61007
|
const agent = fetchParams.controller.dispatcher;
|
|
61030
|
-
const
|
|
61008
|
+
const path72 = url2.pathname + url2.search;
|
|
61031
61009
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
61032
61010
|
return new Promise((resolve2, reject) => agent.dispatch(
|
|
61033
61011
|
{
|
|
61034
|
-
path: hasTrailingQuestionMark ? `${
|
|
61012
|
+
path: hasTrailingQuestionMark ? `${path72}?` : path72,
|
|
61035
61013
|
origin: url2.origin,
|
|
61036
61014
|
method: request7.method,
|
|
61037
61015
|
body: agent.isMockActive ? request7.body && (request7.body.source || request7.body.stream) : body,
|
|
@@ -61978,9 +61956,9 @@ var require_util5 = __commonJS({
|
|
|
61978
61956
|
}
|
|
61979
61957
|
}
|
|
61980
61958
|
}
|
|
61981
|
-
function validateCookiePath(
|
|
61982
|
-
for (let i10 = 0; i10 <
|
|
61983
|
-
const code =
|
|
61959
|
+
function validateCookiePath(path72) {
|
|
61960
|
+
for (let i10 = 0; i10 < path72.length; ++i10) {
|
|
61961
|
+
const code = path72.charCodeAt(i10);
|
|
61984
61962
|
if (code < 32 || // exclude CTLs (0-31)
|
|
61985
61963
|
code > 126 || // exclude DEL and non-ascii
|
|
61986
61964
|
code === 59) {
|
|
@@ -65328,11 +65306,11 @@ var require_undici = __commonJS({
|
|
|
65328
65306
|
if (typeof opts.path !== "string") {
|
|
65329
65307
|
throw new InvalidArgumentError2("invalid opts.path");
|
|
65330
65308
|
}
|
|
65331
|
-
let
|
|
65309
|
+
let path72 = opts.path;
|
|
65332
65310
|
if (!opts.path.startsWith("/")) {
|
|
65333
|
-
|
|
65311
|
+
path72 = `/${path72}`;
|
|
65334
65312
|
}
|
|
65335
|
-
url2 = new URL(util2.parseOrigin(url2).origin +
|
|
65313
|
+
url2 = new URL(util2.parseOrigin(url2).origin + path72);
|
|
65336
65314
|
} else {
|
|
65337
65315
|
if (!opts) {
|
|
65338
65316
|
opts = typeof url2 === "object" ? url2 : {};
|
|
@@ -106707,8 +106685,8 @@ var require_utils3 = __commonJS({
|
|
|
106707
106685
|
}
|
|
106708
106686
|
return ind;
|
|
106709
106687
|
}
|
|
106710
|
-
function removeDotSegments(
|
|
106711
|
-
let input2 =
|
|
106688
|
+
function removeDotSegments(path72) {
|
|
106689
|
+
let input2 = path72;
|
|
106712
106690
|
const output2 = [];
|
|
106713
106691
|
let nextSlash = -1;
|
|
106714
106692
|
let len = 0;
|
|
@@ -107117,8 +107095,8 @@ var require_schemes = __commonJS({
|
|
|
107117
107095
|
}
|
|
107118
107096
|
if (wsComponent.resourceName) {
|
|
107119
107097
|
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
107120
|
-
const
|
|
107121
|
-
wsComponent.path =
|
|
107098
|
+
const path72 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
107099
|
+
wsComponent.path = path72 && path72 !== "/" ? path72 : void 0;
|
|
107122
107100
|
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
107123
107101
|
wsComponent.resourceName = void 0;
|
|
107124
107102
|
}
|
|
@@ -110645,7 +110623,7 @@ var require_dist2 = __commonJS({
|
|
|
110645
110623
|
});
|
|
110646
110624
|
|
|
110647
110625
|
// src/cli.ts
|
|
110648
|
-
var
|
|
110626
|
+
var import_node_path71 = __toESM(require("node:path"), 1);
|
|
110649
110627
|
|
|
110650
110628
|
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
|
|
110651
110629
|
var CommanderError = class extends Error {
|
|
@@ -113758,9 +113736,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
113758
113736
|
* @param {string} [path]
|
|
113759
113737
|
* @return {(string|null|Command)}
|
|
113760
113738
|
*/
|
|
113761
|
-
executableDir(
|
|
113762
|
-
if (
|
|
113763
|
-
this._executableDir =
|
|
113739
|
+
executableDir(path72) {
|
|
113740
|
+
if (path72 === void 0) return this._executableDir;
|
|
113741
|
+
this._executableDir = path72;
|
|
113764
113742
|
return this;
|
|
113765
113743
|
}
|
|
113766
113744
|
/**
|
|
@@ -115236,19 +115214,19 @@ function writePools(paths, pools) {
|
|
|
115236
115214
|
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
|
|
115237
115215
|
}
|
|
115238
115216
|
function poolCycleOf(pools, name) {
|
|
115239
|
-
const walk3 = (current,
|
|
115217
|
+
const walk3 = (current, path72) => {
|
|
115240
115218
|
for (const entry of pools[current]?.identities ?? []) {
|
|
115241
115219
|
const nested = poolNameOf(poolMemberIdentity(entry));
|
|
115242
115220
|
if (nested === void 0) {
|
|
115243
115221
|
continue;
|
|
115244
115222
|
}
|
|
115245
115223
|
if (nested === name) {
|
|
115246
|
-
return [...
|
|
115224
|
+
return [...path72, nested];
|
|
115247
115225
|
}
|
|
115248
|
-
if (
|
|
115226
|
+
if (path72.includes(nested)) {
|
|
115249
115227
|
continue;
|
|
115250
115228
|
}
|
|
115251
|
-
const found = walk3(nested, [...
|
|
115229
|
+
const found = walk3(nested, [...path72, nested]);
|
|
115252
115230
|
if (found !== void 0) {
|
|
115253
115231
|
return found;
|
|
115254
115232
|
}
|
|
@@ -116449,7 +116427,7 @@ function statuslineChangeOf(options) {
|
|
|
116449
116427
|
return void 0;
|
|
116450
116428
|
}
|
|
116451
116429
|
const assignments = (options.statusline ?? []).map(parseStatuslineAssignment);
|
|
116452
|
-
return { set: Object.fromEntries(assignments.map(({ path:
|
|
116430
|
+
return { set: Object.fromEntries(assignments.map(({ path: path72, value: value2 }) => [path72, value2])), unset: options.unsetStatusline ?? [] };
|
|
116453
116431
|
}
|
|
116454
116432
|
function registerProfileCommand(program2, deps) {
|
|
116455
116433
|
const { paths } = deps;
|
|
@@ -118240,7 +118218,7 @@ function registerCodexCommand(program2, deps) {
|
|
|
118240
118218
|
|
|
118241
118219
|
// src/frontdoor/commands.ts
|
|
118242
118220
|
var import_node_crypto25 = require("node:crypto");
|
|
118243
|
-
var
|
|
118221
|
+
var import_node_path54 = __toESM(require("node:path"), 1);
|
|
118244
118222
|
var import_node_fs22 = __toESM(require("node:fs"), 1);
|
|
118245
118223
|
init_commandDeps();
|
|
118246
118224
|
init_configProfilesStore();
|
|
@@ -119773,7 +119751,6 @@ function createHeadroomDecision(setting) {
|
|
|
119773
119751
|
}
|
|
119774
119752
|
|
|
119775
119753
|
// src/frontdoor/commands.ts
|
|
119776
|
-
init_capability();
|
|
119777
119754
|
init_capture();
|
|
119778
119755
|
init_connect();
|
|
119779
119756
|
|
|
@@ -120116,11 +120093,11 @@ function createRcSessionTracker(deps) {
|
|
|
120116
120093
|
};
|
|
120117
120094
|
const observeExchange = (request7) => {
|
|
120118
120095
|
const method = (request7.method ?? "").toUpperCase();
|
|
120119
|
-
const
|
|
120120
|
-
if (!
|
|
120096
|
+
const path72 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
|
|
120097
|
+
if (!path72.startsWith(RC_SESSIONS_PATH_PREFIX)) {
|
|
120121
120098
|
return void 0;
|
|
120122
120099
|
}
|
|
120123
|
-
const tail =
|
|
120100
|
+
const tail = path72.slice(RC_SESSIONS_PATH_PREFIX.length);
|
|
120124
120101
|
const facts = {
|
|
120125
120102
|
oauthAuthorization: oauthAuthorizationOf(request7.headers),
|
|
120126
120103
|
anthropicVersion: singleHeader(request7.headers, "anthropic-version"),
|
|
@@ -120237,7 +120214,7 @@ function createRcSessionTracker(deps) {
|
|
|
120237
120214
|
}
|
|
120238
120215
|
};
|
|
120239
120216
|
};
|
|
120240
|
-
const
|
|
120217
|
+
const summaryOf2 = ({ id: id2, createdAt, lastSeenAt }) => ({ id: id2, createdAt, lastSeenAt });
|
|
120241
120218
|
const pendingSummaryOf = ({ sessionId, requestId, type: type2, summary, observedAt: observedAt2 }) => ({ sessionId, requestId, type: type2, summary, observedAt: observedAt2 });
|
|
120242
120219
|
const sortedEntries = () => [...entries.values()].sort((left, right) => left.createdAt - right.createdAt || (left.id < right.id ? -1 : 1));
|
|
120243
120220
|
const pendingSorted = (entry) => [...entry.pending.values()].sort((left, right) => left.observedAt - right.observedAt || (left.requestId < right.requestId ? -1 : 1)).map(pendingSummaryOf);
|
|
@@ -120245,11 +120222,11 @@ function createRcSessionTracker(deps) {
|
|
|
120245
120222
|
observeExchange,
|
|
120246
120223
|
list: () => {
|
|
120247
120224
|
sweep();
|
|
120248
|
-
return sortedEntries().map(
|
|
120225
|
+
return sortedEntries().map(summaryOf2);
|
|
120249
120226
|
},
|
|
120250
120227
|
statusOf: (sessionId) => {
|
|
120251
120228
|
sweep();
|
|
120252
|
-
return sortedEntries().filter((entry) => sessionId === void 0 || entry.id === sessionId).map((entry) => ({ ...
|
|
120229
|
+
return sortedEntries().filter((entry) => sessionId === void 0 || entry.id === sessionId).map((entry) => ({ ...summaryOf2(entry), workerState: entry.workerState, workerIdleSeconds: entry.workerIdleSeconds, pending: pendingSorted(entry) }));
|
|
120253
120230
|
},
|
|
120254
120231
|
pendingOf: (sessionId) => {
|
|
120255
120232
|
sweep();
|
|
@@ -120489,8 +120466,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
|
|
|
120489
120466
|
function isRcReadFileEncoding(value2) {
|
|
120490
120467
|
return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value2);
|
|
120491
120468
|
}
|
|
120492
|
-
function buildRcReadFilePayload(requestId,
|
|
120493
|
-
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path:
|
|
120469
|
+
function buildRcReadFilePayload(requestId, path72, options) {
|
|
120470
|
+
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path72, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
|
|
120494
120471
|
}
|
|
120495
120472
|
function buildRcFileSuggestionsPayload(requestId, query) {
|
|
120496
120473
|
return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
|
|
@@ -120592,15 +120569,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
|
|
|
120592
120569
|
const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
|
|
120593
120570
|
return result.ok ? { ...result, requestId } : result;
|
|
120594
120571
|
}
|
|
120595
|
-
async function readRcSessionFile(deps, sessionId,
|
|
120596
|
-
if (
|
|
120572
|
+
async function readRcSessionFile(deps, sessionId, path72, options) {
|
|
120573
|
+
if (path72 === "") {
|
|
120597
120574
|
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" };
|
|
120598
120575
|
}
|
|
120599
120576
|
if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
|
|
120600
120577
|
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" };
|
|
120601
120578
|
}
|
|
120602
120579
|
const requestId = deps.newUuid();
|
|
120603
|
-
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId,
|
|
120580
|
+
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path72, options), `read ${path72} from session ${sessionId}`);
|
|
120604
120581
|
return result.ok ? { ...result, requestId } : result;
|
|
120605
120582
|
}
|
|
120606
120583
|
async function suggestRcSessionFiles(deps, sessionId, query) {
|
|
@@ -120772,11 +120749,11 @@ function createRcControlHandler(deps) {
|
|
|
120772
120749
|
path: "read-file",
|
|
120773
120750
|
read: (body) => {
|
|
120774
120751
|
const session = bodyString(body, "session");
|
|
120775
|
-
const
|
|
120752
|
+
const path72 = bodyString(body, "path");
|
|
120776
120753
|
const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
|
|
120777
120754
|
const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
|
|
120778
|
-
const refused2 = session === void 0 ||
|
|
120779
|
-
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,
|
|
120755
|
+
const refused2 = session === void 0 || path72 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
|
|
120756
|
+
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, path72, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
|
|
120780
120757
|
}
|
|
120781
120758
|
},
|
|
120782
120759
|
{
|
|
@@ -121086,9 +121063,9 @@ function requestIdOfBody(body) {
|
|
|
121086
121063
|
}
|
|
121087
121064
|
function frontDoorRcControl(transport, token) {
|
|
121088
121065
|
const headers = { authorization: `Bearer ${token}` };
|
|
121089
|
-
const listAnswerOf = async (
|
|
121066
|
+
const listAnswerOf = async (path72, what) => {
|
|
121090
121067
|
try {
|
|
121091
|
-
return await transport.request({ method: "GET", path:
|
|
121068
|
+
return await transport.request({ method: "GET", path: path72, headers });
|
|
121092
121069
|
} catch (error63) {
|
|
121093
121070
|
throw new Error(`${what}: could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}`, { cause: error63 });
|
|
121094
121071
|
}
|
|
@@ -121160,10 +121137,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
121160
121137
|
}
|
|
121161
121138
|
return pending;
|
|
121162
121139
|
};
|
|
121163
|
-
const writeOf = async (
|
|
121140
|
+
const writeOf = async (path72, body, describeFailure2) => {
|
|
121164
121141
|
let answer;
|
|
121165
121142
|
try {
|
|
121166
|
-
answer = await transport.request({ method: "POST", path:
|
|
121143
|
+
answer = await transport.request({ method: "POST", path: path72, headers: { ...headers, "content-type": "application/json" }, body });
|
|
121167
121144
|
} catch (error63) {
|
|
121168
121145
|
return { ok: false, message: `could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}` };
|
|
121169
121146
|
}
|
|
@@ -121194,10 +121171,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
121194
121171
|
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}`),
|
|
121195
121172
|
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}`),
|
|
121196
121173
|
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}`),
|
|
121197
|
-
readFile: async (sessionId,
|
|
121174
|
+
readFile: async (sessionId, path72, options) => await writeOf(
|
|
121198
121175
|
`${CONTROL_PATH_PREFIX}/read-file`,
|
|
121199
|
-
JSON.stringify({ session: sessionId, path:
|
|
121200
|
-
(status, message) => `reading ${
|
|
121176
|
+
JSON.stringify({ session: sessionId, path: path72, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
|
|
121177
|
+
(status, message) => `reading ${path72} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
|
|
121201
121178
|
),
|
|
121202
121179
|
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}`),
|
|
121203
121180
|
keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
|
|
@@ -121584,12 +121561,12 @@ function tlsFacts(options) {
|
|
|
121584
121561
|
}
|
|
121585
121562
|
function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
121586
121563
|
const agent = new ExemptTlsAgent();
|
|
121587
|
-
const post = async (
|
|
121564
|
+
const post = async (path72, headers, body) => await new Promise((resolve2, reject) => {
|
|
121588
121565
|
const options = {
|
|
121589
121566
|
host: target.host,
|
|
121590
121567
|
port: target.port,
|
|
121591
121568
|
method: "POST",
|
|
121592
|
-
path:
|
|
121569
|
+
path: path72,
|
|
121593
121570
|
// 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.
|
|
121594
121571
|
headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
|
|
121595
121572
|
agent
|
|
@@ -121654,12 +121631,12 @@ function lateRcStreamDial(resolve2) {
|
|
|
121654
121631
|
}
|
|
121655
121632
|
function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
121656
121633
|
const agent = new ExemptTlsAgent();
|
|
121657
|
-
const request7 = async (method,
|
|
121634
|
+
const request7 = async (method, path72, headers, body, signal) => await new Promise((resolve2, reject) => {
|
|
121658
121635
|
const options = {
|
|
121659
121636
|
host: target.host,
|
|
121660
121637
|
port: target.port,
|
|
121661
121638
|
method,
|
|
121662
|
-
path:
|
|
121639
|
+
path: path72,
|
|
121663
121640
|
// 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.
|
|
121664
121641
|
headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
|
|
121665
121642
|
agent,
|
|
@@ -121701,9 +121678,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
|
|
|
121701
121678
|
return { status, body: await readAll(response) };
|
|
121702
121679
|
},
|
|
121703
121680
|
openStream: async (sessionId, headers, resume, signal) => {
|
|
121704
|
-
const
|
|
121681
|
+
const path72 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
|
|
121705
121682
|
const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
|
|
121706
|
-
const { status, response } = await request7("GET",
|
|
121683
|
+
const { status, response } = await request7("GET", path72, streamHeaders, void 0, signal);
|
|
121707
121684
|
if (!isSuccessful2(status)) {
|
|
121708
121685
|
await readAll(response);
|
|
121709
121686
|
return { status, chunks: NO_CHUNKS };
|
|
@@ -123137,11 +123114,11 @@ function tryOrUndefined(fn2) {
|
|
|
123137
123114
|
return void 0;
|
|
123138
123115
|
}
|
|
123139
123116
|
}
|
|
123140
|
-
function pathToHttpPath(
|
|
123141
|
-
return `/${
|
|
123117
|
+
function pathToHttpPath(path72) {
|
|
123118
|
+
return `/${path72.map(safeEncodeURIComponent).join("/")}`;
|
|
123142
123119
|
}
|
|
123143
|
-
function normalizeHttpPath(
|
|
123144
|
-
const paths =
|
|
123120
|
+
function normalizeHttpPath(path72) {
|
|
123121
|
+
const paths = path72.split("/");
|
|
123145
123122
|
if (paths.at(0) === "") {
|
|
123146
123123
|
paths.shift();
|
|
123147
123124
|
}
|
|
@@ -123326,9 +123303,9 @@ function isPlainObject3(value2) {
|
|
|
123326
123303
|
function getOwn(object3, key) {
|
|
123327
123304
|
return Object.hasOwn(object3, key) ? object3[key] : void 0;
|
|
123328
123305
|
}
|
|
123329
|
-
function get(object3,
|
|
123306
|
+
function get(object3, path72) {
|
|
123330
123307
|
let current = object3;
|
|
123331
|
-
for (const key of
|
|
123308
|
+
for (const key of path72) {
|
|
123332
123309
|
if (!isTypescriptObject(current)) {
|
|
123333
123310
|
return void 0;
|
|
123334
123311
|
}
|
|
@@ -124551,7 +124528,7 @@ function resolveClientRest(rest) {
|
|
|
124551
124528
|
// rest[1] can be undefined if all fields of FriendlyClientOptions are optional
|
|
124552
124529
|
];
|
|
124553
124530
|
}
|
|
124554
|
-
function createORPCClient(link, { path:
|
|
124531
|
+
function createORPCClient(link, { path: path72 = [], ...options } = {}) {
|
|
124555
124532
|
const procedureClient = (...rest) => {
|
|
124556
124533
|
const [input2, callOptions] = resolveClientRest(rest);
|
|
124557
124534
|
const interceptors = [
|
|
@@ -124560,7 +124537,7 @@ function createORPCClient(link, { path: path71 = [], ...options } = {}) {
|
|
|
124560
124537
|
];
|
|
124561
124538
|
return intercept(
|
|
124562
124539
|
interceptors,
|
|
124563
|
-
{ ...callOptions, input: input2, path:
|
|
124540
|
+
{ ...callOptions, input: input2, path: path72 },
|
|
124564
124541
|
({ path: path210, input: input22, ...callOptions2 }) => link.call(path210, input22, callOptions2)
|
|
124565
124542
|
);
|
|
124566
124543
|
};
|
|
@@ -124574,7 +124551,7 @@ function createORPCClient(link, { path: path71 = [], ...options } = {}) {
|
|
|
124574
124551
|
if (client === void 0) {
|
|
124575
124552
|
client = createORPCClient(link, {
|
|
124576
124553
|
...options,
|
|
124577
|
-
path: [...
|
|
124554
|
+
path: [...path72, key],
|
|
124578
124555
|
scoped: options.scoped?.[key]
|
|
124579
124556
|
});
|
|
124580
124557
|
cache.set(key, client);
|
|
@@ -124596,24 +124573,24 @@ var BracketNotationSerializer = class {
|
|
|
124596
124573
|
this.internalSerialize(data, "", true, result);
|
|
124597
124574
|
return result;
|
|
124598
124575
|
}
|
|
124599
|
-
internalSerialize(data,
|
|
124576
|
+
internalSerialize(data, path72, isRoot, result) {
|
|
124600
124577
|
if (Array.isArray(data)) {
|
|
124601
124578
|
data.forEach((item, i10) => {
|
|
124602
|
-
this.internalSerialize(item, isRoot ? i10.toString() : `${
|
|
124579
|
+
this.internalSerialize(item, isRoot ? i10.toString() : `${path72}[${i10}]`, false, result);
|
|
124603
124580
|
});
|
|
124604
124581
|
} else if (isPlainObject3(data)) {
|
|
124605
124582
|
for (const key of Object.keys(data)) {
|
|
124606
|
-
this.internalSerialize(data[key], isRoot ? key : `${
|
|
124583
|
+
this.internalSerialize(data[key], isRoot ? key : `${path72}[${key}]`, false, result);
|
|
124607
124584
|
}
|
|
124608
124585
|
} else {
|
|
124609
|
-
result.push([
|
|
124586
|
+
result.push([path72, data]);
|
|
124610
124587
|
}
|
|
124611
124588
|
}
|
|
124612
124589
|
deserialize(serialized) {
|
|
124613
124590
|
const arrayPushStyles = /* @__PURE__ */ new WeakSet();
|
|
124614
124591
|
const root = new NullProtoObj();
|
|
124615
|
-
for (const [
|
|
124616
|
-
const segments = this.parsePath(
|
|
124592
|
+
for (const [path72, value2] of serialized) {
|
|
124593
|
+
const segments = this.parsePath(path72);
|
|
124617
124594
|
let currentRef = root;
|
|
124618
124595
|
let nextSegment = segments[0];
|
|
124619
124596
|
for (let i10 = 1; i10 < segments.length; i10++) {
|
|
@@ -124664,13 +124641,13 @@ var BracketNotationSerializer = class {
|
|
|
124664
124641
|
}
|
|
124665
124642
|
return result;
|
|
124666
124643
|
}
|
|
124667
|
-
parsePath(
|
|
124644
|
+
parsePath(path72) {
|
|
124668
124645
|
const segments = [];
|
|
124669
124646
|
let inBrackets = false;
|
|
124670
124647
|
let currentSegment = "";
|
|
124671
|
-
for (let i10 = 0; i10 <
|
|
124672
|
-
const char =
|
|
124673
|
-
const nextChar =
|
|
124648
|
+
for (let i10 = 0; i10 < path72.length; i10++) {
|
|
124649
|
+
const char = path72[i10];
|
|
124650
|
+
const nextChar = path72[i10 + 1];
|
|
124674
124651
|
if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[")) {
|
|
124675
124652
|
if (nextChar === void 0) {
|
|
124676
124653
|
inBrackets = false;
|
|
@@ -124686,7 +124663,7 @@ var BracketNotationSerializer = class {
|
|
|
124686
124663
|
currentSegment += char;
|
|
124687
124664
|
}
|
|
124688
124665
|
}
|
|
124689
|
-
return inBrackets || segments.length === 0 ? [
|
|
124666
|
+
return inBrackets || segments.length === 0 ? [path72] : segments;
|
|
124690
124667
|
}
|
|
124691
124668
|
};
|
|
124692
124669
|
var INTEGER_PATTERN = /^0$|^[1-9]\d*$/;
|
|
@@ -125259,11 +125236,11 @@ var OpenAPISerializer = class {
|
|
|
125259
125236
|
return json2;
|
|
125260
125237
|
}
|
|
125261
125238
|
const form = new FormData();
|
|
125262
|
-
for (const [
|
|
125239
|
+
for (const [path72, value22] of this.bracketNotation.serialize(json2)) {
|
|
125263
125240
|
if (value22 instanceof Blob) {
|
|
125264
|
-
form.append(
|
|
125241
|
+
form.append(path72, value22);
|
|
125265
125242
|
} else if (value22 !== void 0 && value22 !== null) {
|
|
125266
|
-
form.append(
|
|
125243
|
+
form.append(path72, String(value22));
|
|
125267
125244
|
}
|
|
125268
125245
|
}
|
|
125269
125246
|
return form;
|
|
@@ -125301,30 +125278,30 @@ function isBodylessMethod(method) {
|
|
|
125301
125278
|
return method === "GET" || method === "HEAD";
|
|
125302
125279
|
}
|
|
125303
125280
|
var PARAMETER_NAME_REGEX = /^[\w-]+$/;
|
|
125304
|
-
function getDynamicPathParams(
|
|
125305
|
-
if (!
|
|
125281
|
+
function getDynamicPathParams(path72) {
|
|
125282
|
+
if (!path72.includes("{")) {
|
|
125306
125283
|
return void 0;
|
|
125307
125284
|
}
|
|
125308
|
-
const len =
|
|
125285
|
+
const len = path72.length;
|
|
125309
125286
|
let params;
|
|
125310
125287
|
let index = 1;
|
|
125311
125288
|
while (index < len) {
|
|
125312
125289
|
const segmentStart = index;
|
|
125313
|
-
const slashPos =
|
|
125290
|
+
const slashPos = path72.indexOf("/", index);
|
|
125314
125291
|
const segmentEnd = slashPos === -1 ? len : slashPos;
|
|
125315
|
-
if (segmentEnd > segmentStart &&
|
|
125292
|
+
if (segmentEnd > segmentStart && path72.charCodeAt(segmentStart) === 123 && path72.charCodeAt(segmentEnd - 1) === 125) {
|
|
125316
125293
|
let parameterStart = segmentStart + 1;
|
|
125317
125294
|
let allowsSlash = false;
|
|
125318
|
-
const operator =
|
|
125295
|
+
const operator = path72.charCodeAt(parameterStart);
|
|
125319
125296
|
if (operator === 43) {
|
|
125320
125297
|
allowsSlash = true;
|
|
125321
125298
|
parameterStart++;
|
|
125322
125299
|
}
|
|
125323
|
-
const parameterName =
|
|
125300
|
+
const parameterName = path72.slice(parameterStart, segmentEnd - 1);
|
|
125324
125301
|
if (PARAMETER_NAME_REGEX.test(parameterName)) {
|
|
125325
125302
|
params ??= [];
|
|
125326
125303
|
params.push({
|
|
125327
|
-
segment:
|
|
125304
|
+
segment: path72.slice(segmentStart, segmentEnd),
|
|
125328
125305
|
startIndex: segmentStart,
|
|
125329
125306
|
parameterName,
|
|
125330
125307
|
allowsSlash
|
|
@@ -125367,8 +125344,8 @@ openapi.method = (method) => ({
|
|
|
125367
125344
|
...openapi({ method }),
|
|
125368
125345
|
name: "~openapi/method"
|
|
125369
125346
|
});
|
|
125370
|
-
openapi.path = (
|
|
125371
|
-
...openapi({ path:
|
|
125347
|
+
openapi.path = (path72) => ({
|
|
125348
|
+
...openapi({ path: path72 }),
|
|
125372
125349
|
name: "~openapi/path"
|
|
125373
125350
|
});
|
|
125374
125351
|
openapi.spec = (spec) => ({
|
|
@@ -126229,22 +126206,22 @@ function visitJsonSchemaRefs(value2, visit2, schemaLevel = true, seen = /* @__PU
|
|
|
126229
126206
|
}
|
|
126230
126207
|
}
|
|
126231
126208
|
}
|
|
126232
|
-
function mapJsonSchemaRefs(value2, map2, schemaLevel = true,
|
|
126209
|
+
function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path72 = []) {
|
|
126233
126210
|
if (!value2 || typeof value2 !== "object") {
|
|
126234
126211
|
return value2;
|
|
126235
126212
|
}
|
|
126236
126213
|
if (Array.isArray(value2)) {
|
|
126237
|
-
return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...
|
|
126214
|
+
return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path72, index]));
|
|
126238
126215
|
}
|
|
126239
126216
|
const result = {};
|
|
126240
126217
|
for (const key of Object.keys(value2)) {
|
|
126241
126218
|
const val = value2[key];
|
|
126242
126219
|
if (key === "$ref" && typeof val === "string") {
|
|
126243
|
-
setOwn(result, key, map2(val, [...
|
|
126220
|
+
setOwn(result, key, map2(val, [...path72, key]));
|
|
126244
126221
|
} else if (!schemaLevel) {
|
|
126245
|
-
setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...
|
|
126222
|
+
setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path72, key]));
|
|
126246
126223
|
} else if (JSON_SCHEMA_LOGIC_KEYWORDS.has(key) || JSON_SCHEMA_RECORD_KEYWORDS.has(key)) {
|
|
126247
|
-
setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...
|
|
126224
|
+
setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path72, key]));
|
|
126248
126225
|
} else {
|
|
126249
126226
|
setOwn(result, key, val);
|
|
126250
126227
|
}
|
|
@@ -126774,7 +126751,7 @@ function unlazy(maybeLazy) {
|
|
|
126774
126751
|
function createProcedureClient(lazyableProcedure, ...rest) {
|
|
126775
126752
|
const options = resolveMaybeOptionalOptions(rest);
|
|
126776
126753
|
return async (...[input2, callerOptions]) => {
|
|
126777
|
-
const
|
|
126754
|
+
const path72 = toArray(options.path);
|
|
126778
126755
|
const { default: procedure } = await unlazy(lazyableProcedure);
|
|
126779
126756
|
const clientContext = callerOptions?.context ?? {};
|
|
126780
126757
|
const context = await value(options.context, clientContext) ?? {};
|
|
@@ -126787,7 +126764,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
126787
126764
|
};
|
|
126788
126765
|
try {
|
|
126789
126766
|
const output2 = await runWithSpan("call_procedure", (span) => {
|
|
126790
|
-
span?.setAttribute("procedure.path",
|
|
126767
|
+
span?.setAttribute("procedure.path", path72);
|
|
126791
126768
|
return intercept(
|
|
126792
126769
|
options.interceptors,
|
|
126793
126770
|
{
|
|
@@ -126795,7 +126772,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
126795
126772
|
// input can be optional if it is undefinable
|
|
126796
126773
|
input: input2,
|
|
126797
126774
|
errors,
|
|
126798
|
-
path:
|
|
126775
|
+
path: path72,
|
|
126799
126776
|
procedure,
|
|
126800
126777
|
signal: callerOptions?.signal,
|
|
126801
126778
|
lastEventId: callerOptions?.lastEventId
|
|
@@ -127046,10 +127023,10 @@ function augmentRouter(router, options) {
|
|
|
127046
127023
|
}
|
|
127047
127024
|
return enhanced;
|
|
127048
127025
|
}
|
|
127049
|
-
function getRouter(router,
|
|
127026
|
+
function getRouter(router, path72) {
|
|
127050
127027
|
let current = router;
|
|
127051
|
-
for (let i10 = 0; i10 <
|
|
127052
|
-
const segment =
|
|
127028
|
+
for (let i10 = 0; i10 < path72.length; i10++) {
|
|
127029
|
+
const segment = path72[i10];
|
|
127053
127030
|
if (!isTypescriptObject(current)) {
|
|
127054
127031
|
return void 0;
|
|
127055
127032
|
}
|
|
@@ -127061,7 +127038,7 @@ function getRouter(router, path71) {
|
|
|
127061
127038
|
continue;
|
|
127062
127039
|
}
|
|
127063
127040
|
const lazied = current;
|
|
127064
|
-
const rest =
|
|
127041
|
+
const rest = path72.slice(i10);
|
|
127065
127042
|
return new Lazy({
|
|
127066
127043
|
...lazied["~orpc"],
|
|
127067
127044
|
async loader() {
|
|
@@ -127076,40 +127053,40 @@ function getRouter(router, path71) {
|
|
|
127076
127053
|
}
|
|
127077
127054
|
return current;
|
|
127078
127055
|
}
|
|
127079
|
-
function walkProcedureContractsSync(router, callback,
|
|
127056
|
+
function walkProcedureContractsSync(router, callback, path72 = []) {
|
|
127080
127057
|
const lazyResults = [];
|
|
127081
|
-
walkProcedureContractsSyncInternal(router, callback,
|
|
127058
|
+
walkProcedureContractsSyncInternal(router, callback, path72.slice(), lazyResults);
|
|
127082
127059
|
return lazyResults;
|
|
127083
127060
|
}
|
|
127084
|
-
function walkProcedureContractsSyncInternal(router, callback,
|
|
127061
|
+
function walkProcedureContractsSyncInternal(router, callback, path72, lazyResults) {
|
|
127085
127062
|
const hiddenContract = getHiddenRouterContract(router);
|
|
127086
127063
|
if (hiddenContract !== void 0) {
|
|
127087
127064
|
router = hiddenContract;
|
|
127088
127065
|
}
|
|
127089
127066
|
if (router instanceof ProcedureContract) {
|
|
127090
|
-
callback(router,
|
|
127067
|
+
callback(router, path72.slice());
|
|
127091
127068
|
return;
|
|
127092
127069
|
}
|
|
127093
127070
|
if (!isTypescriptObject(router)) {
|
|
127094
127071
|
return;
|
|
127095
127072
|
}
|
|
127096
127073
|
for (const [key, value2] of Object.entries(router)) {
|
|
127097
|
-
|
|
127074
|
+
path72.push(key);
|
|
127098
127075
|
if (value2 instanceof Lazy) {
|
|
127099
|
-
lazyResults.push({ router: value2, path:
|
|
127076
|
+
lazyResults.push({ router: value2, path: path72.slice() });
|
|
127100
127077
|
} else {
|
|
127101
|
-
walkProcedureContractsSyncInternal(value2, callback,
|
|
127078
|
+
walkProcedureContractsSyncInternal(value2, callback, path72, lazyResults);
|
|
127102
127079
|
}
|
|
127103
|
-
|
|
127080
|
+
path72.pop();
|
|
127104
127081
|
}
|
|
127105
127082
|
}
|
|
127106
|
-
async function walkProcedureContractsAsync(router, callback,
|
|
127083
|
+
async function walkProcedureContractsAsync(router, callback, path72 = []) {
|
|
127107
127084
|
const hiddenContract = getHiddenRouterContract(router);
|
|
127108
127085
|
if (hiddenContract !== void 0) {
|
|
127109
127086
|
router = hiddenContract;
|
|
127110
127087
|
}
|
|
127111
127088
|
if (router instanceof ProcedureContract) {
|
|
127112
|
-
await callback(router,
|
|
127089
|
+
await callback(router, path72);
|
|
127113
127090
|
return;
|
|
127114
127091
|
}
|
|
127115
127092
|
if (!isTypescriptObject(router)) {
|
|
@@ -127118,9 +127095,9 @@ async function walkProcedureContractsAsync(router, callback, path71 = []) {
|
|
|
127118
127095
|
for (const [key, value2] of Object.entries(router)) {
|
|
127119
127096
|
if (value2 instanceof Lazy) {
|
|
127120
127097
|
const { default: router2 } = await unlazy(value2);
|
|
127121
|
-
await walkProcedureContractsAsync(router2, callback, [...
|
|
127098
|
+
await walkProcedureContractsAsync(router2, callback, [...path72, key]);
|
|
127122
127099
|
} else {
|
|
127123
|
-
await walkProcedureContractsAsync(value2, callback, [...
|
|
127100
|
+
await walkProcedureContractsAsync(value2, callback, [...path72, key]);
|
|
127124
127101
|
}
|
|
127125
127102
|
}
|
|
127126
127103
|
}
|
|
@@ -127606,18 +127583,18 @@ function rewriteComponentSchemaRefs(schema, renameMap) {
|
|
|
127606
127583
|
}
|
|
127607
127584
|
var OpenAPIGeneratorError = class extends TypeError {
|
|
127608
127585
|
};
|
|
127609
|
-
function toOpenAPIPath(
|
|
127586
|
+
function toOpenAPIPath(path72, dynamicPathParams) {
|
|
127610
127587
|
if (!dynamicPathParams?.length) {
|
|
127611
|
-
return
|
|
127588
|
+
return path72;
|
|
127612
127589
|
}
|
|
127613
127590
|
let normalized = "";
|
|
127614
127591
|
let currentIndex = 0;
|
|
127615
127592
|
for (const param of dynamicPathParams) {
|
|
127616
|
-
normalized +=
|
|
127593
|
+
normalized += path72.slice(currentIndex, param.startIndex);
|
|
127617
127594
|
normalized += `{${param.parameterName}}`;
|
|
127618
127595
|
currentIndex = param.startIndex + param.segment.length;
|
|
127619
127596
|
}
|
|
127620
|
-
normalized +=
|
|
127597
|
+
normalized += path72.slice(currentIndex);
|
|
127621
127598
|
return normalized;
|
|
127622
127599
|
}
|
|
127623
127600
|
function buildRequest(ctx, operation, def, meta3, dynamicPathParams) {
|
|
@@ -128051,8 +128028,8 @@ var OpenAPIGenerator = class {
|
|
|
128051
128028
|
customErrorResponseBodySchema: options.customErrorResponseBodySchema
|
|
128052
128029
|
};
|
|
128053
128030
|
const errors = [];
|
|
128054
|
-
await walkProcedureContractsAsync(router, (contract,
|
|
128055
|
-
if (value(options.filter, contract,
|
|
128031
|
+
await walkProcedureContractsAsync(router, (contract, path72) => {
|
|
128032
|
+
if (value(options.filter, contract, path72) === false) {
|
|
128056
128033
|
return;
|
|
128057
128034
|
}
|
|
128058
128035
|
try {
|
|
@@ -128064,7 +128041,7 @@ var OpenAPIGenerator = class {
|
|
|
128064
128041
|
`QUERY operations require OpenAPI 3.2, but version "${version2}" was requested.`
|
|
128065
128042
|
);
|
|
128066
128043
|
}
|
|
128067
|
-
const postPath = meta3?.path ?? pathToHttpPath(
|
|
128044
|
+
const postPath = meta3?.path ?? pathToHttpPath(path72);
|
|
128068
128045
|
const httpPath = meta3?.prefix ? mergeHttpPath(meta3.prefix, postPath) : postPath;
|
|
128069
128046
|
const dynamicPathParams = getDynamicPathParams(httpPath);
|
|
128070
128047
|
const openApiPath = toOpenAPIPath(httpPath, dynamicPathParams);
|
|
@@ -128073,7 +128050,7 @@ var OpenAPIGenerator = class {
|
|
|
128073
128050
|
operation = meta3.spec;
|
|
128074
128051
|
} else {
|
|
128075
128052
|
operation = {
|
|
128076
|
-
operationId: meta3?.operationId ??
|
|
128053
|
+
operationId: meta3?.operationId ?? path72.join("."),
|
|
128077
128054
|
summary: meta3?.summary,
|
|
128078
128055
|
description: meta3?.description,
|
|
128079
128056
|
deprecated: meta3?.deprecated,
|
|
@@ -128093,7 +128070,7 @@ var OpenAPIGenerator = class {
|
|
|
128093
128070
|
if (!(e14 instanceof OpenAPIGeneratorError)) {
|
|
128094
128071
|
throw e14;
|
|
128095
128072
|
}
|
|
128096
|
-
errors.push(`Procedure at ${
|
|
128073
|
+
errors.push(`Procedure at ${path72.join(".") || "(root)"}: ${e14.message}`);
|
|
128097
128074
|
}
|
|
128098
128075
|
});
|
|
128099
128076
|
if (errors.length) {
|
|
@@ -128940,16 +128917,16 @@ var StandardLink = class {
|
|
|
128940
128917
|
/**
|
|
128941
128918
|
* @throws ORPCError, transport-level errors (network failures, timeouts, etc.)
|
|
128942
128919
|
*/
|
|
128943
|
-
call(
|
|
128944
|
-
return runWithSpan(`${ORPC_NAME}.${
|
|
128920
|
+
call(path72, input2, options) {
|
|
128921
|
+
return runWithSpan(`${ORPC_NAME}.${path72.join("/")}`, (span) => {
|
|
128945
128922
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
128946
|
-
span?.setAttribute("rpc.method",
|
|
128923
|
+
span?.setAttribute("rpc.method", path72.join("."));
|
|
128947
128924
|
if (getTracer() && isAsyncIteratorObject(input2)) {
|
|
128948
128925
|
input2 = override(input2, traceAsyncIterator("consume_async_iterator_object_input", input2));
|
|
128949
128926
|
} else if (getTracer() && input2 instanceof ReadableStream) {
|
|
128950
128927
|
input2 = override(input2, traceReadableStream("consume_octet_stream_input", input2));
|
|
128951
128928
|
}
|
|
128952
|
-
return intercept(this.interceptors, { ...options, path:
|
|
128929
|
+
return intercept(this.interceptors, { ...options, path: path72, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
|
|
128953
128930
|
const tracer = getTracer();
|
|
128954
128931
|
const activeSpan = tracer?.getActiveSpan() ?? span;
|
|
128955
128932
|
let request7 = await runWithSpan(
|
|
@@ -129006,18 +128983,18 @@ var RPCLinkCodec = class {
|
|
|
129006
128983
|
this.headers = options.headers ?? {};
|
|
129007
128984
|
this.serializer = options.serializer ?? new RPCSerializer();
|
|
129008
128985
|
}
|
|
129009
|
-
async encodeInput(input2,
|
|
129010
|
-
let headers = toResolvedStandardHeaders(await value(this.headers, options,
|
|
128986
|
+
async encodeInput(input2, path72, options) {
|
|
128987
|
+
let headers = toResolvedStandardHeaders(await value(this.headers, options, path72, input2));
|
|
129011
128988
|
if (options.lastEventId !== void 0) {
|
|
129012
128989
|
headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
|
|
129013
128990
|
}
|
|
129014
|
-
const expectedMethod = await value(this.expectedMethod, options,
|
|
129015
|
-
const baseUrl = await value(this.baseUrl, options,
|
|
128991
|
+
const expectedMethod = await value(this.expectedMethod, options, path72, input2);
|
|
128992
|
+
const baseUrl = await value(this.baseUrl, options, path72, input2);
|
|
129016
128993
|
const [pathname, search, hash2] = parseStandardUrl(baseUrl);
|
|
129017
|
-
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(
|
|
128994
|
+
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path72)}`;
|
|
129018
128995
|
const serialized = this.serializer.serialize(input2);
|
|
129019
128996
|
if (expectedMethod === "GET" && !(serialized instanceof Blob) && !(serialized instanceof ReadableStream) && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
|
|
129020
|
-
const maxUrlLength = await value(this.maxUrlLength, options,
|
|
128997
|
+
const maxUrlLength = await value(this.maxUrlLength, options, path72, input2);
|
|
129021
128998
|
const mergedSearch = new URLSearchParams(search);
|
|
129022
128999
|
mergedSearch.append("data", stringifyJSON(serialized) ?? "");
|
|
129023
129000
|
const url22 = `${newPathname}?${mergedSearch}${hash2 ?? ""}`;
|
|
@@ -129102,8 +129079,8 @@ var FetchLinkTransport = class {
|
|
|
129102
129079
|
this.fetch = options.fetch ?? ((url2, init) => globalThis.fetch(url2, init));
|
|
129103
129080
|
this.toFetchRequestOptions = options.toFetchRequest;
|
|
129104
129081
|
}
|
|
129105
|
-
async send(standardRequest,
|
|
129106
|
-
let origin = await value(this.origin, options,
|
|
129082
|
+
async send(standardRequest, path72, options) {
|
|
129083
|
+
let origin = await value(this.origin, options, path72);
|
|
129107
129084
|
if (origin?.endsWith("/")) {
|
|
129108
129085
|
origin = origin.slice(0, -1);
|
|
129109
129086
|
}
|
|
@@ -129123,7 +129100,7 @@ var FetchLinkTransport = class {
|
|
|
129123
129100
|
}
|
|
129124
129101
|
}
|
|
129125
129102
|
const fetch3 = this.fetch;
|
|
129126
|
-
const response = await fetch3(url2, init, options,
|
|
129103
|
+
const response = await fetch3(url2, init, options, path72);
|
|
129127
129104
|
const standardResponse = toStandardLazyResponse(response);
|
|
129128
129105
|
return standardResponse;
|
|
129129
129106
|
}
|
|
@@ -129514,14 +129491,14 @@ var StandardHandler = class {
|
|
|
129514
129491
|
span?.setAttribute("url.path", request22.url);
|
|
129515
129492
|
return { matched: false };
|
|
129516
129493
|
}
|
|
129517
|
-
const { path:
|
|
129518
|
-
span?.updateName(`${ORPC_NAME}.${
|
|
129494
|
+
const { path: path72, procedure, decodeInput } = matchedOrNot;
|
|
129495
|
+
span?.updateName(`${ORPC_NAME}.${path72.join("/")}`);
|
|
129519
129496
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
129520
|
-
span?.setAttribute("rpc.method",
|
|
129497
|
+
span?.setAttribute("rpc.method", path72.join("."));
|
|
129521
129498
|
try {
|
|
129522
129499
|
const response = await intercept(
|
|
129523
129500
|
this.interceptors,
|
|
129524
|
-
{ context: context2, prefix: prefix2, request: request22, path:
|
|
129501
|
+
{ context: context2, prefix: prefix2, request: request22, path: path72, procedure, decodeInput },
|
|
129525
129502
|
async ({ context: context3, prefix: prefix3, request: request32, path: path210, procedure: procedure2, decodeInput: decodeInput2 }) => {
|
|
129526
129503
|
step2 = "decode_input";
|
|
129527
129504
|
let input2 = await runWithSpan("decode_input", decodeInput2);
|
|
@@ -129555,7 +129532,7 @@ var StandardHandler = class {
|
|
|
129555
129532
|
message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
|
|
129556
129533
|
cause: e14
|
|
129557
129534
|
}) : toORPCError(e14);
|
|
129558
|
-
const response = await this.codec.encodeError(error63, procedure,
|
|
129535
|
+
const response = await this.codec.encodeError(error63, procedure, path72, { context: context2, prefix: prefix2 });
|
|
129559
129536
|
return { matched: true, response };
|
|
129560
129537
|
}
|
|
129561
129538
|
}
|
|
@@ -129661,7 +129638,7 @@ var RPCMatcher = class {
|
|
|
129661
129638
|
this.rootRouter = router;
|
|
129662
129639
|
this.index(router);
|
|
129663
129640
|
}
|
|
129664
|
-
index(router,
|
|
129641
|
+
index(router, path72 = []) {
|
|
129665
129642
|
const lazyResults = walkProcedureContractsSync(router, (procedure, procedurePath) => {
|
|
129666
129643
|
if (!value(this.filter, procedure, procedurePath)) {
|
|
129667
129644
|
return;
|
|
@@ -129672,7 +129649,7 @@ var RPCMatcher = class {
|
|
|
129672
129649
|
// contract-first entries have no implementation yet, resolveProcedure fills it in on demand
|
|
129673
129650
|
procedure: procedure instanceof Procedure ? procedure : void 0
|
|
129674
129651
|
});
|
|
129675
|
-
},
|
|
129652
|
+
}, path72);
|
|
129676
129653
|
for (const result of lazyResults) {
|
|
129677
129654
|
this.pendingLazyRouters.set(pathToHttpPath(result.path), result);
|
|
129678
129655
|
}
|
|
@@ -129804,10 +129781,10 @@ var RPCHandlerCodec = class {
|
|
|
129804
129781
|
}
|
|
129805
129782
|
};
|
|
129806
129783
|
}
|
|
129807
|
-
encodeOutput(output2, procedure,
|
|
129784
|
+
encodeOutput(output2, procedure, path72, options) {
|
|
129808
129785
|
return {
|
|
129809
129786
|
headers: {},
|
|
129810
|
-
status: value(this.outputStatus, output2, procedure,
|
|
129787
|
+
status: value(this.outputStatus, output2, procedure, path72, options) ?? DEFAULT_SUCCESS_STATUS,
|
|
129811
129788
|
body: this.serializer.serialize(output2)
|
|
129812
129789
|
};
|
|
129813
129790
|
}
|
|
@@ -129861,39 +129838,39 @@ function createRouter() {
|
|
|
129861
129838
|
static: new NullProtoObj2()
|
|
129862
129839
|
};
|
|
129863
129840
|
}
|
|
129864
|
-
function scanFirstGroup(
|
|
129841
|
+
function scanFirstGroup(path72) {
|
|
129865
129842
|
let i10 = 0;
|
|
129866
129843
|
let depth = 0;
|
|
129867
|
-
for (; i10 <
|
|
129868
|
-
const c10 =
|
|
129844
|
+
for (; i10 < path72.length; i10++) {
|
|
129845
|
+
const c10 = path72.charCodeAt(i10);
|
|
129869
129846
|
if (c10 === 92) i10++;
|
|
129870
129847
|
else if (c10 === 40) depth++;
|
|
129871
129848
|
else if (c10 === 41 && depth > 0) depth--;
|
|
129872
129849
|
else if (c10 === 123 && depth === 0) break;
|
|
129873
129850
|
}
|
|
129874
|
-
if (i10 >=
|
|
129851
|
+
if (i10 >= path72.length) return;
|
|
129875
129852
|
let j10 = i10 + 1;
|
|
129876
129853
|
depth = 0;
|
|
129877
|
-
for (; j10 <
|
|
129878
|
-
const c10 =
|
|
129854
|
+
for (; j10 < path72.length; j10++) {
|
|
129855
|
+
const c10 = path72.charCodeAt(j10);
|
|
129879
129856
|
if (c10 === 92) j10++;
|
|
129880
129857
|
else if (c10 === 40) depth++;
|
|
129881
129858
|
else if (c10 === 41 && depth > 0) depth--;
|
|
129882
129859
|
else if (c10 === 125 && depth === 0) break;
|
|
129883
129860
|
}
|
|
129884
|
-
if (j10 >=
|
|
129885
|
-
const mod =
|
|
129861
|
+
if (j10 >= path72.length) return;
|
|
129862
|
+
const mod = path72[j10 + 1];
|
|
129886
129863
|
const hasMod = mod === "?" || mod === "+" || mod === "*";
|
|
129887
129864
|
return [
|
|
129888
|
-
|
|
129889
|
-
|
|
129890
|
-
|
|
129865
|
+
path72.slice(0, i10),
|
|
129866
|
+
path72.slice(i10 + 1, j10),
|
|
129867
|
+
path72.slice(j10 + (hasMod ? 2 : 1)),
|
|
129891
129868
|
hasMod ? mod : void 0
|
|
129892
129869
|
];
|
|
129893
129870
|
}
|
|
129894
|
-
function expandGroupDelimiters(
|
|
129895
|
-
if (!
|
|
129896
|
-
const group = scanFirstGroup(
|
|
129871
|
+
function expandGroupDelimiters(path72) {
|
|
129872
|
+
if (!path72.includes("{")) return;
|
|
129873
|
+
const group = scanFirstGroup(path72);
|
|
129897
129874
|
if (!group) return;
|
|
129898
129875
|
const [pre2, body, suf, mod] = group;
|
|
129899
129876
|
if (!mod) return [pre2 + body + suf];
|
|
@@ -129963,9 +129940,9 @@ function replaceSegmentWildcards(segment, unnamedStart, toGroupKey = toUnnamedGr
|
|
|
129963
129940
|
}
|
|
129964
129941
|
return [replaced, nextIndex];
|
|
129965
129942
|
}
|
|
129966
|
-
function encodeEscapes(
|
|
129967
|
-
if (!
|
|
129968
|
-
return
|
|
129943
|
+
function encodeEscapes(path72) {
|
|
129944
|
+
if (!path72.includes("\\")) return path72;
|
|
129945
|
+
return path72.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
|
|
129969
129946
|
}
|
|
129970
129947
|
function segmentKey(segment) {
|
|
129971
129948
|
if (segment.startsWith("**")) return 2;
|
|
@@ -129994,22 +129971,22 @@ function expandModifiers(segments) {
|
|
|
129994
129971
|
return m10[2] === "+" ? [wc2] : [wc2, without];
|
|
129995
129972
|
}
|
|
129996
129973
|
}
|
|
129997
|
-
function normalizePath(
|
|
129998
|
-
if (!
|
|
129974
|
+
function normalizePath(path72) {
|
|
129975
|
+
if (!path72.includes("/.")) return path72;
|
|
129999
129976
|
const r10 = [];
|
|
130000
|
-
for (const s of
|
|
129977
|
+
for (const s of path72.split("/")) if (s === ".") continue;
|
|
130001
129978
|
else if (s === ".." && r10.length > 1) r10.pop();
|
|
130002
129979
|
else r10.push(s);
|
|
130003
129980
|
return r10.join("/") || "/";
|
|
130004
129981
|
}
|
|
130005
|
-
function splitPath(
|
|
130006
|
-
const s =
|
|
129982
|
+
function splitPath(path72) {
|
|
129983
|
+
const s = path72.split("/");
|
|
130007
129984
|
s.shift();
|
|
130008
129985
|
if (s[s.length - 1] === "") s.pop();
|
|
130009
129986
|
return s;
|
|
130010
129987
|
}
|
|
130011
|
-
function splitRoute(
|
|
130012
|
-
const s = splitPath(
|
|
129988
|
+
function splitRoute(path72) {
|
|
129989
|
+
const s = splitPath(path72);
|
|
130013
129990
|
while (s[s.length - 1] === "") s.pop();
|
|
130014
129991
|
return s;
|
|
130015
129992
|
}
|
|
@@ -130025,16 +130002,16 @@ function getMatchParams(segments, paramsMap) {
|
|
|
130025
130002
|
}
|
|
130026
130003
|
return params;
|
|
130027
130004
|
}
|
|
130028
|
-
function addRoute(ctx, method = "",
|
|
130005
|
+
function addRoute(ctx, method = "", path72, data) {
|
|
130029
130006
|
method = method.toUpperCase();
|
|
130030
|
-
if (
|
|
130031
|
-
const groupExpanded = expandGroupDelimiters(
|
|
130007
|
+
if (path72.charCodeAt(0) !== 47) path72 = `/${path72}`;
|
|
130008
|
+
const groupExpanded = expandGroupDelimiters(path72);
|
|
130032
130009
|
if (groupExpanded) {
|
|
130033
130010
|
for (const expandedPath of groupExpanded) addRoute(ctx, method, expandedPath, data);
|
|
130034
130011
|
return;
|
|
130035
130012
|
}
|
|
130036
|
-
|
|
130037
|
-
const segments = splitRoute(
|
|
130013
|
+
path72 = encodeEscapes(path72);
|
|
130014
|
+
const segments = splitRoute(path72);
|
|
130038
130015
|
const expanded = expandModifiers(segments);
|
|
130039
130016
|
if (expanded) {
|
|
130040
130017
|
for (const p of expanded) addRoute(ctx, method, p, data);
|
|
@@ -130125,15 +130102,15 @@ function getParamRegexp(segment, unnamedStart = 0) {
|
|
|
130125
130102
|
const regex2 = _s2.replace(/:([\w-]+)(?:\(([^)]*)\))?/g, (_, id2, p) => `(?<${toGroupName(id2)}>${p || "[^/]+"})`).replace(/\((?![?<])/g, () => `(?<${toUnnamedGroupKey(_i2++)}>`).replace(/\uFFFE(.)/g, (_, c10) => /[.*+?^${}()|[\]\\]/.test(c10) ? `\\${c10}` : c10);
|
|
130126
130103
|
return [new RegExp(`^${regex2}$`), _i2];
|
|
130127
130104
|
}
|
|
130128
|
-
function findRoute(ctx, method = "",
|
|
130129
|
-
if (opts?.normalize)
|
|
130130
|
-
if (
|
|
130131
|
-
const staticNode = ctx.static[
|
|
130105
|
+
function findRoute(ctx, method = "", path72, opts) {
|
|
130106
|
+
if (opts?.normalize) path72 = normalizePath(path72);
|
|
130107
|
+
if (path72.charCodeAt(path72.length - 1) === 47) path72 = path72.slice(0, -1);
|
|
130108
|
+
const staticNode = ctx.static[path72];
|
|
130132
130109
|
if (staticNode && staticNode.methods) {
|
|
130133
130110
|
const staticMatch = staticNode.methods[method] || staticNode.methods[""];
|
|
130134
130111
|
if (staticMatch !== void 0) return staticMatch[0];
|
|
130135
130112
|
}
|
|
130136
|
-
const segments = splitPath(
|
|
130113
|
+
const segments = splitPath(path72);
|
|
130137
130114
|
const match = _lookupTree(ctx.root, method, segments, 0);
|
|
130138
130115
|
if (match === void 0) return;
|
|
130139
130116
|
if (opts?.params === false) return match;
|
|
@@ -130333,7 +130310,7 @@ var OpenAPIMatcher = class {
|
|
|
130333
130310
|
this.rootRouter = router;
|
|
130334
130311
|
this.index(router);
|
|
130335
130312
|
}
|
|
130336
|
-
index(router,
|
|
130313
|
+
index(router, path72 = []) {
|
|
130337
130314
|
const lazyResults = walkProcedureContractsSync(router, (contract, path210) => {
|
|
130338
130315
|
if (!value(this.filter, contract, path210)) {
|
|
130339
130316
|
return;
|
|
@@ -130348,7 +130325,7 @@ var OpenAPIMatcher = class {
|
|
|
130348
130325
|
contract,
|
|
130349
130326
|
procedure: contract instanceof Procedure ? contract : void 0
|
|
130350
130327
|
});
|
|
130351
|
-
},
|
|
130328
|
+
}, path72);
|
|
130352
130329
|
for (const result of lazyResults) {
|
|
130353
130330
|
const prefix = getOpenAPIMeta(result.router)?.prefix;
|
|
130354
130331
|
this.pendingLazyRouters.add({
|
|
@@ -130435,20 +130412,20 @@ var OpenAPIMatcher = class {
|
|
|
130435
130412
|
return entry.procedure;
|
|
130436
130413
|
}
|
|
130437
130414
|
};
|
|
130438
|
-
function toRou3Pattern(
|
|
130439
|
-
const params = getDynamicPathParams(
|
|
130415
|
+
function toRou3Pattern(path72) {
|
|
130416
|
+
const params = getDynamicPathParams(path72);
|
|
130440
130417
|
if (!params?.length) {
|
|
130441
|
-
return
|
|
130418
|
+
return path72;
|
|
130442
130419
|
}
|
|
130443
130420
|
for (let i10 = params.length - 1; i10 >= 0; i10--) {
|
|
130444
130421
|
const param = params[i10];
|
|
130445
130422
|
const pattern = param.allowsSlash ? `**:${param.parameterName}` : `:${param.parameterName}`;
|
|
130446
|
-
|
|
130423
|
+
path72 = path72.slice(0, param.startIndex) + pattern + path72.slice(param.startIndex + param.segment.length);
|
|
130447
130424
|
}
|
|
130448
|
-
return
|
|
130425
|
+
return path72;
|
|
130449
130426
|
}
|
|
130450
|
-
function toRou3PrefixMatcher(
|
|
130451
|
-
const pattern = toRou3Pattern(
|
|
130427
|
+
function toRou3PrefixMatcher(path72) {
|
|
130428
|
+
const pattern = toRou3Pattern(path72);
|
|
130452
130429
|
return routeToRegExp(pattern === "/" ? "/**" : `${pattern}/**`);
|
|
130453
130430
|
}
|
|
130454
130431
|
function decodeParams(params) {
|
|
@@ -130527,7 +130504,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
130527
130504
|
/**
|
|
130528
130505
|
* @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
|
|
130529
130506
|
*/
|
|
130530
|
-
encodeOutput(output2, procedure,
|
|
130507
|
+
encodeOutput(output2, procedure, path72) {
|
|
130531
130508
|
const meta3 = getOpenAPIMeta(procedure);
|
|
130532
130509
|
const successStatus = meta3?.successStatus ?? DEFAULT_SUCCESS_STATUS;
|
|
130533
130510
|
const outputStructure = meta3?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
|
|
@@ -130540,7 +130517,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
130540
130517
|
}
|
|
130541
130518
|
if (!isValidDetailedOutput(output2)) {
|
|
130542
130519
|
throw new TypeError(`
|
|
130543
|
-
Invalid "detailed" output structure returned by procedure (${
|
|
130520
|
+
Invalid "detailed" output structure returned by procedure (${path72.join(".")}):
|
|
130544
130521
|
\u2022 Expected an object with optional properties:
|
|
130545
130522
|
- status (number <400)
|
|
130546
130523
|
- headers (object)
|
|
@@ -131116,7 +131093,7 @@ function profileValue(name, paths) {
|
|
|
131116
131093
|
function createConfigApiRouter(deps) {
|
|
131117
131094
|
const authed = doorApiAuth(deps.expectedToken);
|
|
131118
131095
|
const { paths } = deps;
|
|
131119
|
-
const route = (
|
|
131096
|
+
const route = (path72, summary) => authed.meta(openapi({ method: "POST", path: path72, summary, tags: [CONFIG_API_TAG] }));
|
|
131120
131097
|
return {
|
|
131121
131098
|
config: {
|
|
131122
131099
|
identity: {
|
|
@@ -131885,6 +131862,83 @@ function createQuotaExpiringPublisher(hub, deps) {
|
|
|
131885
131862
|
};
|
|
131886
131863
|
}
|
|
131887
131864
|
|
|
131865
|
+
// src/frontdoor/liveSessionRegistry.ts
|
|
131866
|
+
var import_node_path50 = __toESM(require("node:path"), 1);
|
|
131867
|
+
init_capability();
|
|
131868
|
+
init_state();
|
|
131869
|
+
function sameStat(recorded, current) {
|
|
131870
|
+
return recorded?.mtimeMs === current.mtimeMs && recorded.sizeBytes === current.sizeBytes;
|
|
131871
|
+
}
|
|
131872
|
+
function createLiveSessionRegistry(ports) {
|
|
131873
|
+
const { fs: fs31, sessionsDir } = ports;
|
|
131874
|
+
const known = /* @__PURE__ */ new Map();
|
|
131875
|
+
let tokens = /* @__PURE__ */ new Set();
|
|
131876
|
+
let bySessionId = /* @__PURE__ */ new Map();
|
|
131877
|
+
const recordNames = () => fs31.readdir(sessionsDir).filter(isSessionRecordName);
|
|
131878
|
+
const rebuildIndexes = () => {
|
|
131879
|
+
const records = [...known.values()].flatMap(({ record: record2 }) => record2 === void 0 ? [] : [record2]);
|
|
131880
|
+
tokens = new Set(records.map((record2) => record2.token));
|
|
131881
|
+
bySessionId = new Map(records.flatMap((record2) => record2.sessionId === void 0 ? [] : [[record2.sessionId, record2]]));
|
|
131882
|
+
};
|
|
131883
|
+
const load = (name, stat) => {
|
|
131884
|
+
known.set(name, { stat: { mtimeMs: stat.mtimeMs, sizeBytes: stat.sizeBytes }, record: readFrontDoorSessionRecord(fs31, sessionsDir, name) });
|
|
131885
|
+
};
|
|
131886
|
+
const statOf = (name) => fs31.lstat(import_node_path50.default.join(sessionsDir, name));
|
|
131887
|
+
const reconcile = () => {
|
|
131888
|
+
const names = new Set(recordNames());
|
|
131889
|
+
let changed = false;
|
|
131890
|
+
for (const name of known.keys()) {
|
|
131891
|
+
if (!names.has(name)) {
|
|
131892
|
+
known.delete(name);
|
|
131893
|
+
changed = true;
|
|
131894
|
+
}
|
|
131895
|
+
}
|
|
131896
|
+
for (const name of names) {
|
|
131897
|
+
const held = known.get(name);
|
|
131898
|
+
const stat = statOf(name);
|
|
131899
|
+
if (stat === void 0) {
|
|
131900
|
+
changed = known.delete(name) || changed;
|
|
131901
|
+
} else if (!sameStat(held?.stat, stat)) {
|
|
131902
|
+
load(name, stat);
|
|
131903
|
+
changed = true;
|
|
131904
|
+
}
|
|
131905
|
+
}
|
|
131906
|
+
if (changed) {
|
|
131907
|
+
rebuildIndexes();
|
|
131908
|
+
}
|
|
131909
|
+
return changed;
|
|
131910
|
+
};
|
|
131911
|
+
return {
|
|
131912
|
+
admits: (token) => {
|
|
131913
|
+
if (isLiveCapability(token, tokens)) {
|
|
131914
|
+
return true;
|
|
131915
|
+
}
|
|
131916
|
+
return reconcile() && isLiveCapability(token, tokens);
|
|
131917
|
+
},
|
|
131918
|
+
modelsOf: (sessionId) => {
|
|
131919
|
+
const held = bySessionId.get(sessionId) ?? (reconcile() ? bySessionId.get(sessionId) : void 0);
|
|
131920
|
+
return held?.models;
|
|
131921
|
+
},
|
|
131922
|
+
rescan: () => {
|
|
131923
|
+
known.clear();
|
|
131924
|
+
for (const name of recordNames()) {
|
|
131925
|
+
const stat = statOf(name);
|
|
131926
|
+
if (stat !== void 0) {
|
|
131927
|
+
load(name, stat);
|
|
131928
|
+
}
|
|
131929
|
+
}
|
|
131930
|
+
rebuildIndexes();
|
|
131931
|
+
return [...known.values()].flatMap(({ record: record2 }) => record2 === void 0 ? [] : [summaryOf(record2)]).sort((a10, b) => a10.pid - b.pid);
|
|
131932
|
+
},
|
|
131933
|
+
forget: (pids) => {
|
|
131934
|
+
for (const pid of pids) {
|
|
131935
|
+
known.delete(sessionRecordName(pid));
|
|
131936
|
+
}
|
|
131937
|
+
rebuildIndexes();
|
|
131938
|
+
}
|
|
131939
|
+
};
|
|
131940
|
+
}
|
|
131941
|
+
|
|
131888
131942
|
// src/frontdoor/launchEvents.ts
|
|
131889
131943
|
function createLaunchEventPublisher(hub, now) {
|
|
131890
131944
|
const publisher = hub.publisher(LAUNCH_EVENT_SOURCE);
|
|
@@ -133144,8 +133198,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
|
|
|
133144
133198
|
request7.body.resume();
|
|
133145
133199
|
return;
|
|
133146
133200
|
}
|
|
133147
|
-
const
|
|
133148
|
-
const translated = { method: request7.method, path:
|
|
133201
|
+
const path72 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
133202
|
+
const translated = { method: request7.method, path: path72, body, signal: request7.signal };
|
|
133149
133203
|
const routed = await route(translated);
|
|
133150
133204
|
if (request7.signal.aborted) {
|
|
133151
133205
|
return;
|
|
@@ -133766,8 +133820,8 @@ function createAntigravityRouteMount(ports, upstreamBase, provider) {
|
|
|
133766
133820
|
request7.body.resume();
|
|
133767
133821
|
return;
|
|
133768
133822
|
}
|
|
133769
|
-
const
|
|
133770
|
-
const translated = { method: request7.method, path:
|
|
133823
|
+
const path72 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
133824
|
+
const translated = { method: request7.method, path: path72, body, signal: request7.signal };
|
|
133771
133825
|
const routed = await route(translated);
|
|
133772
133826
|
if (request7.signal.aborted) {
|
|
133773
133827
|
return;
|
|
@@ -133808,7 +133862,7 @@ function createPassthroughRoute(name, target) {
|
|
|
133808
133862
|
headroomUpstream: target.headroomUpstream,
|
|
133809
133863
|
serve: async (request7, response) => {
|
|
133810
133864
|
const incoming = new URL(request7.url, "http://127.0.0.1");
|
|
133811
|
-
const
|
|
133865
|
+
const path72 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
|
|
133812
133866
|
const headers = forwardableHeaders(request7.headers);
|
|
133813
133867
|
delete headers.host;
|
|
133814
133868
|
await new Promise((resolve2) => {
|
|
@@ -133816,7 +133870,7 @@ function createPassthroughRoute(name, target) {
|
|
|
133816
133870
|
host: base.hostname,
|
|
133817
133871
|
port: base.port === "" ? void 0 : Number(base.port),
|
|
133818
133872
|
method: request7.method,
|
|
133819
|
-
path: `${basePath}${
|
|
133873
|
+
path: `${basePath}${path72}${incoming.search}`,
|
|
133820
133874
|
headers,
|
|
133821
133875
|
agent
|
|
133822
133876
|
};
|
|
@@ -133988,13 +134042,13 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
133988
134042
|
}
|
|
133989
134043
|
|
|
133990
134044
|
// src/frontdoor/providerRoute.ts
|
|
133991
|
-
var isRcSelfHostPath = (
|
|
134045
|
+
var isRcSelfHostPath = (path72) => path72 === "/v1/code/sessions" || path72.startsWith("/v1/code/sessions/") || path72 === "/v1/sessions" || path72.startsWith("/v1/sessions/");
|
|
133992
134046
|
function scopeSessionProviderPath(request7) {
|
|
133993
134047
|
if (request7.session.provider === void 0) {
|
|
133994
134048
|
return request7;
|
|
133995
134049
|
}
|
|
133996
|
-
const
|
|
133997
|
-
if (!
|
|
134050
|
+
const path72 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
134051
|
+
if (!path72.startsWith("/v1/") || isRcSelfHostPath(path72)) {
|
|
133998
134052
|
return request7;
|
|
133999
134053
|
}
|
|
134000
134054
|
return { ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` };
|
|
@@ -134118,13 +134172,13 @@ function createProviderRouteResolver(deps) {
|
|
|
134118
134172
|
return route;
|
|
134119
134173
|
};
|
|
134120
134174
|
const resolve2 = (request7) => {
|
|
134121
|
-
const
|
|
134122
|
-
const scoped = parseProviderPath(
|
|
134175
|
+
const path72 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
134176
|
+
const scoped = parseProviderPath(path72);
|
|
134123
134177
|
if (scoped === void 0) {
|
|
134124
|
-
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(
|
|
134178
|
+
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path72)) {
|
|
134125
134179
|
return { ok: true, route: deps.rcSelfHostRoute };
|
|
134126
134180
|
}
|
|
134127
|
-
return
|
|
134181
|
+
return path72.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path72}` };
|
|
134128
134182
|
}
|
|
134129
134183
|
const { provider } = scoped;
|
|
134130
134184
|
let definition;
|
|
@@ -134219,8 +134273,8 @@ function createProviderRouteResolver(deps) {
|
|
|
134219
134273
|
let modelChoice;
|
|
134220
134274
|
const visited = /* @__PURE__ */ new Set();
|
|
134221
134275
|
for (; ; ) {
|
|
134222
|
-
const
|
|
134223
|
-
const scoped = parseProviderPath(
|
|
134276
|
+
const path72 = new URL(current.url, "http://127.0.0.1").pathname;
|
|
134277
|
+
const scoped = parseProviderPath(path72);
|
|
134224
134278
|
const providerName = scoped?.provider ?? current.session.provider;
|
|
134225
134279
|
if (providerName !== void 0 && visited.has(providerName)) {
|
|
134226
134280
|
return { ok: false, status: HTTP_STATUS.internalServerError, message: `provider routing cycle: ${[...visited, providerName].join(" -> ")}` };
|
|
@@ -134235,7 +134289,7 @@ function createProviderRouteResolver(deps) {
|
|
|
134235
134289
|
} catch {
|
|
134236
134290
|
routes = void 0;
|
|
134237
134291
|
}
|
|
134238
|
-
const resolvesNames = !nameResolved && !isRcSelfHostPath(
|
|
134292
|
+
const resolvesNames = !nameResolved && !isRcSelfHostPath(path72);
|
|
134239
134293
|
if (resolvesNames) {
|
|
134240
134294
|
const scan2 = await scanRequestHead(current, true);
|
|
134241
134295
|
if (scan2.replayed === void 0) {
|
|
@@ -134274,7 +134328,7 @@ function createProviderRouteResolver(deps) {
|
|
|
134274
134328
|
}
|
|
134275
134329
|
if (routed.provider !== providerName) {
|
|
134276
134330
|
const scopedPrefix = providerName === void 0 ? void 0 : `${PROVIDER_PATH_PREFIX}${encodeURIComponent(providerName)}`;
|
|
134277
|
-
const rest2 = scopedPrefix !== void 0 &&
|
|
134331
|
+
const rest2 = scopedPrefix !== void 0 && path72.startsWith(scopedPrefix) ? path72.slice(scopedPrefix.length) : path72;
|
|
134278
134332
|
const query2 = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
|
|
134279
134333
|
const carried = replay;
|
|
134280
134334
|
current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(routed.provider)}${rest2}${query2}`, body: carried.body, headers: carried.headers };
|
|
@@ -134328,7 +134382,7 @@ function createProviderRouteResolver(deps) {
|
|
|
134328
134382
|
const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
|
|
134329
134383
|
replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
|
|
134330
134384
|
}
|
|
134331
|
-
const rest = scoped === void 0 ?
|
|
134385
|
+
const rest = scoped === void 0 ? path72 : path72.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
|
|
134332
134386
|
const query = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
|
|
134333
134387
|
current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(matched.provider)}${rest}${query}`, body: replay.body, headers: replay.headers };
|
|
134334
134388
|
}
|
|
@@ -134365,7 +134419,7 @@ init_ensure2();
|
|
|
134365
134419
|
var import_node_child_process8 = require("node:child_process");
|
|
134366
134420
|
var import_node_fs21 = __toESM(require("node:fs"), 1);
|
|
134367
134421
|
var import_node_net4 = __toESM(require("node:net"), 1);
|
|
134368
|
-
var
|
|
134422
|
+
var import_node_path51 = __toESM(require("node:path"), 1);
|
|
134369
134423
|
|
|
134370
134424
|
// src/frontdoor/handover.ts
|
|
134371
134425
|
init_zod();
|
|
@@ -134451,7 +134505,7 @@ function predecessorOver(channel, isListeningSocket) {
|
|
|
134451
134505
|
|
|
134452
134506
|
// src/frontdoor/realHandover.ts
|
|
134453
134507
|
function spawnSuccessorDoor(paths, invocation) {
|
|
134454
|
-
import_node_fs21.default.mkdirSync(
|
|
134508
|
+
import_node_fs21.default.mkdirSync(import_node_path51.default.dirname(paths.frontdoorLogPath), { recursive: true });
|
|
134455
134509
|
const logFd = import_node_fs21.default.openSync(paths.frontdoorLogPath, "a");
|
|
134456
134510
|
let child;
|
|
134457
134511
|
try {
|
|
@@ -134635,7 +134689,7 @@ function createRcLiveUsage(deps) {
|
|
|
134635
134689
|
}
|
|
134636
134690
|
|
|
134637
134691
|
// src/frontdoor/rcSelfHostMint.ts
|
|
134638
|
-
var
|
|
134692
|
+
var import_node_path52 = __toESM(require("node:path"), 1);
|
|
134639
134693
|
init_account();
|
|
134640
134694
|
|
|
134641
134695
|
// src/frontdoor/rcSelfHostLocal.ts
|
|
@@ -134765,7 +134819,7 @@ function readJsonObject(fs31, file2) {
|
|
|
134765
134819
|
return isRecord16(parsed) ? parsed : void 0;
|
|
134766
134820
|
}
|
|
134767
134821
|
function readRcSelfHostRecord(fs31, frontdoorDir) {
|
|
134768
|
-
const parsed = readJsonObject(fs31,
|
|
134822
|
+
const parsed = readJsonObject(fs31, import_node_path52.default.join(frontdoorDir, RC_SELF_HOST_RECORD_DIR, RC_SELF_HOST_RECORD_FILE));
|
|
134769
134823
|
if (parsed === void 0) {
|
|
134770
134824
|
return void 0;
|
|
134771
134825
|
}
|
|
@@ -134779,11 +134833,11 @@ function mintRcSelfHostCredential(deps) {
|
|
|
134779
134833
|
if (!isIdentityName(deps.identity)) {
|
|
134780
134834
|
throw new Error(`"${deps.identity}" is not a valid identity name.`);
|
|
134781
134835
|
}
|
|
134782
|
-
const identityDir =
|
|
134783
|
-
const credentialsFile =
|
|
134784
|
-
const claudeJsonFile =
|
|
134785
|
-
const recordDir =
|
|
134786
|
-
const recordFile =
|
|
134836
|
+
const identityDir = import_node_path52.default.join(deps.identitiesDir, deps.identity);
|
|
134837
|
+
const credentialsFile = import_node_path52.default.join(identityDir, CREDENTIALS_FILE2);
|
|
134838
|
+
const claudeJsonFile = import_node_path52.default.join(identityDir, CLAUDE_JSON2);
|
|
134839
|
+
const recordDir = import_node_path52.default.join(deps.frontdoorDir, RC_SELF_HOST_RECORD_DIR);
|
|
134840
|
+
const recordFile = import_node_path52.default.join(recordDir, RC_SELF_HOST_RECORD_FILE);
|
|
134787
134841
|
const previousRecord = readRcSelfHostRecord(deps.fs, deps.frontdoorDir);
|
|
134788
134842
|
const existingCredentials = readJsonObject(deps.fs, credentialsFile);
|
|
134789
134843
|
const existingOauth = isRecord16(existingCredentials?.claudeAiOauth) ? existingCredentials.claudeAiOauth : void 0;
|
|
@@ -134799,7 +134853,7 @@ function mintRcSelfHostCredential(deps) {
|
|
|
134799
134853
|
const organizationUuid = deps.newUuid();
|
|
134800
134854
|
const accountUuid = deps.newUuid();
|
|
134801
134855
|
const mintedAt = new Date(deps.now()).toISOString();
|
|
134802
|
-
deps.fs.mkdirPrivate(
|
|
134856
|
+
deps.fs.mkdirPrivate(import_node_path52.default.dirname(credentialsFile));
|
|
134803
134857
|
deps.fs.writeFilePrivate(credentialsFile, `${JSON.stringify({ ...existingCredentials, claudeAiOauth: { accessToken, refreshToken, expiresAt: null, scopes: [...RC_SELF_HOST_SCOPE_LIST], subscriptionType: SELF_HOST_SUBSCRIPTION_TYPE, rateLimitTier: null } }, null, 2)}
|
|
134804
134858
|
`);
|
|
134805
134859
|
const claudeJson = readJsonObject(deps.fs, claudeJsonFile) ?? {};
|
|
@@ -135186,7 +135240,7 @@ function registerRcCommand(frontdoor, paths) {
|
|
|
135186
135240
|
}
|
|
135187
135241
|
|
|
135188
135242
|
// src/frontdoor/rcCredentialStore.ts
|
|
135189
|
-
var
|
|
135243
|
+
var import_node_path53 = __toESM(require("node:path"), 1);
|
|
135190
135244
|
function isSafeSessionId(sessionId) {
|
|
135191
135245
|
return /^[A-Za-z0-9_-]+$/.test(sessionId);
|
|
135192
135246
|
}
|
|
@@ -135212,7 +135266,7 @@ function sequenceNumOfJson(value2) {
|
|
|
135212
135266
|
}
|
|
135213
135267
|
function createRcCredentialStore(fs31, dir) {
|
|
135214
135268
|
fs31.mkdirPrivate(dir);
|
|
135215
|
-
const fileFor = (sessionId) =>
|
|
135269
|
+
const fileFor = (sessionId) => import_node_path53.default.join(dir, `${sessionId}.json`);
|
|
135216
135270
|
const readParsed = (sessionId) => {
|
|
135217
135271
|
const raw = fs31.readFileUtf8(fileFor(sessionId));
|
|
135218
135272
|
if (raw === void 0) {
|
|
@@ -137771,11 +137825,12 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, lifecycle, track
|
|
|
137771
137825
|
const observations = createTargetObservationStore(realFarmFs, paths);
|
|
137772
137826
|
const routingSnapshots = /* @__PURE__ */ new Map();
|
|
137773
137827
|
const rcControlToken = lifecycle.predecessor === void 0 ? (0, import_node_crypto25.randomUUID)() : inheritedControlToken(paths);
|
|
137828
|
+
const sessionRegistry = createLiveSessionRegistry({ fs: realFarmFs, sessionsDir: paths.frontdoorSessionsDir });
|
|
137774
137829
|
const resolveRoute = rcObservingResolver(
|
|
137775
137830
|
createProviderRouteResolver({
|
|
137776
137831
|
// Read live so a models-block edit reaches the next request without a door restart.
|
|
137777
137832
|
// The block this session launched with when its directory, profile or committed file added definitions of its own; otherwise the global block, read live so an edit applies to the next request with no relaunch.
|
|
137778
|
-
models: (session) => (session.sessionId === void 0 ? void 0 :
|
|
137833
|
+
models: (session) => (session.sessionId === void 0 ? void 0 : sessionRegistry.modelsOf(session.sessionId)) ?? readModels(paths),
|
|
137779
137834
|
targets: () => targetRefs(paths),
|
|
137780
137835
|
fs: realFsPort,
|
|
137781
137836
|
providersDir: paths.providersDir,
|
|
@@ -137799,7 +137854,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, lifecycle, track
|
|
|
137799
137854
|
rcTracker,
|
|
137800
137855
|
rcHub
|
|
137801
137856
|
);
|
|
137802
|
-
const isLiveToken = (token) =>
|
|
137857
|
+
const isLiveToken = (token) => sessionRegistry.admits(token);
|
|
137803
137858
|
const usageStore = createUsageStore({
|
|
137804
137859
|
fs: realFarmFs,
|
|
137805
137860
|
paths,
|
|
@@ -137943,6 +137998,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, lifecycle, track
|
|
|
137943
137998
|
return {
|
|
137944
137999
|
fs: realFarmFs,
|
|
137945
138000
|
paths,
|
|
138001
|
+
registry: sessionRegistry,
|
|
137946
138002
|
ownPid: process.pid,
|
|
137947
138003
|
now: () => Date.now(),
|
|
137948
138004
|
sleep: async (ms2) => {
|
|
@@ -138068,7 +138124,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, lifecycle, track
|
|
|
138068
138124
|
const leafFor = createLeafCache(loadCa(), () => /* @__PURE__ */ new Date());
|
|
138069
138125
|
const capture = captureFromEnv(process.env, paths.logsDir);
|
|
138070
138126
|
if (capture !== void 0) {
|
|
138071
|
-
log(`capture enabled, recording CONNECT targets and piped exchanges to ${
|
|
138127
|
+
log(`capture enabled, recording CONNECT targets and piped exchanges to ${import_node_path54.default.join(paths.logsDir, "frontdoor-capture.jsonl")}`);
|
|
138072
138128
|
}
|
|
138073
138129
|
if (rcSelfHostSurface !== void 0) {
|
|
138074
138130
|
log("self-hosted Remote Control surface on: the door serves the CCR session family itself, and its own client-half dials its own transparent surface");
|
|
@@ -138123,6 +138179,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, lifecycle, track
|
|
|
138123
138179
|
drain: async () => {
|
|
138124
138180
|
if (transparentCapability !== void 0) {
|
|
138125
138181
|
removeFrontDoorSession(realFarmFs, paths.frontdoorSessionsDir, process.pid);
|
|
138182
|
+
sessionRegistry.forget([process.pid]);
|
|
138126
138183
|
}
|
|
138127
138184
|
await server.drain();
|
|
138128
138185
|
rcSelfHostSurface?.close();
|
|
@@ -138157,7 +138214,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, lifecycle, track
|
|
|
138157
138214
|
cooldownStepMs: DOOR_STALL_BOUND_MS,
|
|
138158
138215
|
cooldownCapMs: DOOR_RESPAWN_COOLDOWN_CAP_MS,
|
|
138159
138216
|
startLockFile: paths.frontdoorLockFile,
|
|
138160
|
-
...process.platform === "darwin" ? { nativeSample: { command: MACOS_SAMPLER, args: ["{pid}", "{seconds}", "-file", "{file}"], directory:
|
|
138217
|
+
...process.platform === "darwin" ? { nativeSample: { command: MACOS_SAMPLER, args: ["{pid}", "{seconds}", "-file", "{file}"], directory: import_node_path54.default.join(import_node_path54.default.dirname(paths.frontdoorLogPath), "stall-samples"), seconds: Math.max(1, Math.ceil(DOOR_WATCHDOG_CHECK_MS / MS_PER_SECOND16)), overheadMs: PROBE_TIMEOUT_MS, keep: DOOR_RESPAWN_MAX_GENERATIONS + 1 } } : {}
|
|
138161
138218
|
}),
|
|
138162
138219
|
// The launch lifecycle publisher over the same backbone the typed API serves: the tick's registry facts go in here, and the door's own register, prune and end moments come out as source-tagged events.
|
|
138163
138220
|
observeLaunchRegistry: createLaunchEventPublisher(doorEvents, () => Date.now()).observe,
|
|
@@ -138271,7 +138328,7 @@ function registerFrontDoorCommand(program2, deps) {
|
|
|
138271
138328
|
// src/statusline/commands.ts
|
|
138272
138329
|
var import_node_child_process9 = require("node:child_process");
|
|
138273
138330
|
var import_node_os13 = __toESM(require("node:os"), 1);
|
|
138274
|
-
var
|
|
138331
|
+
var import_node_path62 = __toESM(require("node:path"), 1);
|
|
138275
138332
|
init_commandDeps();
|
|
138276
138333
|
init_statusline();
|
|
138277
138334
|
init_providersStore();
|
|
@@ -138280,13 +138337,13 @@ init_account();
|
|
|
138280
138337
|
init_read();
|
|
138281
138338
|
|
|
138282
138339
|
// src/statusline/client.ts
|
|
138283
|
-
var
|
|
138340
|
+
var import_node_path55 = __toESM(require("node:path"), 1);
|
|
138284
138341
|
function isAntigravityPayload(payload) {
|
|
138285
138342
|
return typeof payload === "object" && payload !== null && "product" in payload && payload.product === "antigravity";
|
|
138286
138343
|
}
|
|
138287
138344
|
var ANTIGRAVITY_SETTINGS_SEGMENTS = [".gemini", "antigravity-cli", "settings.json"];
|
|
138288
138345
|
function antigravityStacksWithDefault(fs31, homeDir) {
|
|
138289
|
-
const raw = fs31.readFileUtf8(
|
|
138346
|
+
const raw = fs31.readFileUtf8(import_node_path55.default.join(homeDir, ...ANTIGRAVITY_SETTINGS_SEGMENTS));
|
|
138290
138347
|
if (raw === void 0) {
|
|
138291
138348
|
return false;
|
|
138292
138349
|
}
|
|
@@ -138716,7 +138773,7 @@ function viewOf(payload) {
|
|
|
138716
138773
|
init_blockingSpawn();
|
|
138717
138774
|
var import_node_fs23 = __toESM(require("node:fs"), 1);
|
|
138718
138775
|
var import_node_os12 = __toESM(require("node:os"), 1);
|
|
138719
|
-
var
|
|
138776
|
+
var import_node_path56 = __toESM(require("node:path"), 1);
|
|
138720
138777
|
|
|
138721
138778
|
// src/statusline/memoryUse.ts
|
|
138722
138779
|
var BYTES_PER_KIBIBYTE = 1024;
|
|
@@ -138784,7 +138841,7 @@ function sweepStaleRunDirectories(root) {
|
|
|
138784
138841
|
return;
|
|
138785
138842
|
}
|
|
138786
138843
|
for (const name of names.filter((entry) => entry.startsWith(RUN_DIRECTORY_PREFIX))) {
|
|
138787
|
-
const directory =
|
|
138844
|
+
const directory = import_node_path56.default.join(root, name);
|
|
138788
138845
|
try {
|
|
138789
138846
|
if (Date.now() - import_node_fs23.default.lstatSync(directory).mtimeMs > STALE_RUN_DIRECTORY_MS) {
|
|
138790
138847
|
discard(directory);
|
|
@@ -138810,8 +138867,8 @@ function runWithOutputInFile(runRoot, file2, args, cwd) {
|
|
|
138810
138867
|
try {
|
|
138811
138868
|
sweepStaleRunDirectories(runRoot);
|
|
138812
138869
|
import_node_fs23.default.mkdirSync(runRoot, { recursive: true, mode: STATE_DIRECTORY_MODE });
|
|
138813
|
-
directory = import_node_fs23.default.mkdtempSync(
|
|
138814
|
-
const descriptor = import_node_fs23.default.openSync(
|
|
138870
|
+
directory = import_node_fs23.default.mkdtempSync(import_node_path56.default.join(runRoot, RUN_DIRECTORY_PREFIX));
|
|
138871
|
+
const descriptor = import_node_fs23.default.openSync(import_node_path56.default.join(directory, "stdout"), "wx+", RUN_FILE_MODE);
|
|
138815
138872
|
try {
|
|
138816
138873
|
const limited = process.platform === "win32" ? { command: file2, args } : fileSizeLimitedCommand("/bin/sh", file2, args);
|
|
138817
138874
|
const result = spawnSyncBlocking("a statusline command", limited.command, limited.args, { cwd, timeout: RUN_TIMEOUT_MS, killSignal: "SIGKILL", stdio: ["ignore", descriptor, "ignore"], windowsHide: true });
|
|
@@ -138877,7 +138934,7 @@ function realStatuslinePorts(env, stateDirectory) {
|
|
|
138877
138934
|
return void 0;
|
|
138878
138935
|
}
|
|
138879
138936
|
},
|
|
138880
|
-
run: (file2, args, cwd, options) => runProgram(
|
|
138937
|
+
run: (file2, args, cwd, options) => runProgram(import_node_path56.default.join(stateDirectory, RUN_DIRECTORY), file2, args, cwd, options),
|
|
138881
138938
|
entryKind: (target) => {
|
|
138882
138939
|
try {
|
|
138883
138940
|
return import_node_fs23.default.lstatSync(target).isDirectory() ? "directory" : "other";
|
|
@@ -138907,9 +138964,9 @@ function realStatuslinePorts(env, stateDirectory) {
|
|
|
138907
138964
|
}
|
|
138908
138965
|
},
|
|
138909
138966
|
writeText: (target, text5) => {
|
|
138910
|
-
const temporary =
|
|
138967
|
+
const temporary = import_node_path56.default.join(import_node_path56.default.dirname(target), `.${import_node_path56.default.basename(target)}.${String(process.pid)}.tmp`);
|
|
138911
138968
|
try {
|
|
138912
|
-
import_node_fs23.default.mkdirSync(
|
|
138969
|
+
import_node_fs23.default.mkdirSync(import_node_path56.default.dirname(target), { recursive: true, mode: STATE_DIRECTORY_MODE });
|
|
138913
138970
|
import_node_fs23.default.writeFileSync(temporary, text5, { mode: STATE_FILE_MODE });
|
|
138914
138971
|
import_node_fs23.default.renameSync(temporary, target);
|
|
138915
138972
|
} catch {
|
|
@@ -139261,7 +139318,7 @@ function extraSegment({ settings: settings2, payload, ports }) {
|
|
|
139261
139318
|
}
|
|
139262
139319
|
|
|
139263
139320
|
// src/statusline/dailyLedger.ts
|
|
139264
|
-
var
|
|
139321
|
+
var import_node_path57 = __toESM(require("node:path"), 1);
|
|
139265
139322
|
init_zod();
|
|
139266
139323
|
init_schema2();
|
|
139267
139324
|
var DAILY_LEDGER_DIRECTORY = "daily-cost";
|
|
@@ -139305,19 +139362,19 @@ function advance(existing, carried, cost, nowMs) {
|
|
|
139305
139362
|
return { entry: existing, changed: false };
|
|
139306
139363
|
}
|
|
139307
139364
|
function recordDailySpend(ports, nowMs, sessionId, cost) {
|
|
139308
|
-
const root =
|
|
139365
|
+
const root = import_node_path57.default.join(ports.stateDirectory, DAILY_LEDGER_DIRECTORY);
|
|
139309
139366
|
const today = localDay(nowMs);
|
|
139310
139367
|
const days = (ports.listDirectory(root) ?? []).filter((name) => DAY_NAME.test(name));
|
|
139311
139368
|
const previous = days.filter((day) => day < today).sort().at(-1);
|
|
139312
139369
|
for (const day of days) {
|
|
139313
139370
|
if (day < today && day !== previous) {
|
|
139314
|
-
ports.removePath(
|
|
139371
|
+
ports.removePath(import_node_path57.default.join(root, day));
|
|
139315
139372
|
}
|
|
139316
139373
|
}
|
|
139317
|
-
const todayDirectory =
|
|
139374
|
+
const todayDirectory = import_node_path57.default.join(root, today);
|
|
139318
139375
|
if (sessionId !== void 0 && cost !== void 0 && CLIENT_SESSION_ID_PATTERN.test(sessionId)) {
|
|
139319
|
-
const file2 =
|
|
139320
|
-
const carried = previous === void 0 ? void 0 : parseEntry3(ports.readText(
|
|
139376
|
+
const file2 = import_node_path57.default.join(todayDirectory, `${sessionId}.json`);
|
|
139377
|
+
const carried = previous === void 0 ? void 0 : parseEntry3(ports.readText(import_node_path57.default.join(root, previous, `${sessionId}.json`)));
|
|
139321
139378
|
const next = advance(parseEntry3(ports.readText(file2)), carried, cost, nowMs);
|
|
139322
139379
|
if (next?.changed === true) {
|
|
139323
139380
|
ports.writeText(file2, `${JSON.stringify(next.entry)}
|
|
@@ -139325,7 +139382,7 @@ function recordDailySpend(ports, nowMs, sessionId, cost) {
|
|
|
139325
139382
|
}
|
|
139326
139383
|
}
|
|
139327
139384
|
const entries = (ports.listDirectory(todayDirectory) ?? []).filter((name) => ENTRY_FILE.test(name)).flatMap((name) => {
|
|
139328
|
-
const entry = parseEntry3(ports.readText(
|
|
139385
|
+
const entry = parseEntry3(ports.readText(import_node_path57.default.join(todayDirectory, name)));
|
|
139329
139386
|
return entry === void 0 ? [] : [entry];
|
|
139330
139387
|
});
|
|
139331
139388
|
return entries.length === 0 ? void 0 : entries.reduce((sum2, entry) => sum2 + (entry.totalUsd - entry.baselineUsd), 0);
|
|
@@ -139602,7 +139659,7 @@ function modelSegment(context) {
|
|
|
139602
139659
|
}
|
|
139603
139660
|
|
|
139604
139661
|
// src/statusline/elements/header/outputStyle.ts
|
|
139605
|
-
var
|
|
139662
|
+
var import_node_path58 = __toESM(require("node:path"), 1);
|
|
139606
139663
|
init_zod();
|
|
139607
139664
|
var SettingsFileSchema = external_exports.looseObject({ outputStyle: external_exports.string().optional().catch(void 0) });
|
|
139608
139665
|
function outputStyleIn(file2, readText2) {
|
|
@@ -139622,12 +139679,12 @@ function outputStyleIn(file2, readText2) {
|
|
|
139622
139679
|
}
|
|
139623
139680
|
function outputStyleSegment({ payload, ports, t: t10 }) {
|
|
139624
139681
|
const pinned = ports.env.CLAUDE_CONFIG_DIR;
|
|
139625
|
-
const configDirectory = pinned === void 0 || pinned === "" ?
|
|
139682
|
+
const configDirectory = pinned === void 0 || pinned === "" ? import_node_path58.default.join(ports.homeDirectory, ".claude") : pinned;
|
|
139626
139683
|
const projectDirectory = payload.cwd ?? payload.workspace?.current_dir;
|
|
139627
139684
|
const files = [
|
|
139628
|
-
|
|
139629
|
-
|
|
139630
|
-
...projectDirectory === void 0 ? [] : [
|
|
139685
|
+
import_node_path58.default.join(configDirectory, "settings.json"),
|
|
139686
|
+
import_node_path58.default.join(configDirectory, "settings.local.json"),
|
|
139687
|
+
...projectDirectory === void 0 ? [] : [import_node_path58.default.join(projectDirectory, ".claude", "settings.json"), import_node_path58.default.join(projectDirectory, ".claude", "settings.local.json")]
|
|
139631
139688
|
];
|
|
139632
139689
|
const style = files.map((file2) => outputStyleIn(file2, ports.readText)).findLast((name) => name !== void 0);
|
|
139633
139690
|
return style === void 0 ? void 0 : t10("outputStyle.name", { name: style });
|
|
@@ -139717,13 +139774,13 @@ init_zod();
|
|
|
139717
139774
|
|
|
139718
139775
|
// src/statusline/cacheFile.ts
|
|
139719
139776
|
var import_node_crypto26 = require("node:crypto");
|
|
139720
|
-
var
|
|
139777
|
+
var import_node_path59 = __toESM(require("node:path"), 1);
|
|
139721
139778
|
var SESSION_CACHE_DIRECTORY = "session";
|
|
139722
139779
|
function cacheDirectory(ports) {
|
|
139723
|
-
return
|
|
139780
|
+
return import_node_path59.default.join(ports.stateDirectory, SESSION_CACHE_DIRECTORY);
|
|
139724
139781
|
}
|
|
139725
139782
|
function cacheFileFor(ports, kind, transcriptPath) {
|
|
139726
|
-
return
|
|
139783
|
+
return import_node_path59.default.join(cacheDirectory(ports), `${kind}-${(0, import_node_crypto26.createHash)("sha256").update(transcriptPath).digest("hex")}.json`);
|
|
139727
139784
|
}
|
|
139728
139785
|
var RETENTION_DAYS = 30;
|
|
139729
139786
|
var HOURS_PER_DAY10 = 24;
|
|
@@ -139738,7 +139795,7 @@ function pruneCache(ports, cutoffMs) {
|
|
|
139738
139795
|
return;
|
|
139739
139796
|
}
|
|
139740
139797
|
for (const name of names) {
|
|
139741
|
-
const file2 =
|
|
139798
|
+
const file2 = import_node_path59.default.join(directory, name);
|
|
139742
139799
|
const modifiedAtMs = ports.modifiedAtMs(file2);
|
|
139743
139800
|
if (modifiedAtMs !== void 0 && modifiedAtMs < cutoffMs) {
|
|
139744
139801
|
ports.removePath(file2);
|
|
@@ -139893,15 +139950,15 @@ function parseNumstat(output2) {
|
|
|
139893
139950
|
if (addedText === void 0 || deletedText === void 0 || pathText === void 0) {
|
|
139894
139951
|
continue;
|
|
139895
139952
|
}
|
|
139896
|
-
const
|
|
139953
|
+
const path72 = pathText === "" ? fields[index + 2] : pathText;
|
|
139897
139954
|
if (pathText === "") {
|
|
139898
139955
|
index += 2;
|
|
139899
139956
|
}
|
|
139900
139957
|
const lines = { added: Number(addedText), deleted: Number(deletedText) };
|
|
139901
|
-
if (
|
|
139958
|
+
if (path72 !== void 0 && Number.isInteger(lines.added) && Number.isInteger(lines.deleted)) {
|
|
139902
139959
|
added += lines.added;
|
|
139903
139960
|
deleted += lines.deleted;
|
|
139904
|
-
byPath.set(
|
|
139961
|
+
byPath.set(path72, lines);
|
|
139905
139962
|
}
|
|
139906
139963
|
}
|
|
139907
139964
|
return { total: { added, deleted }, byPath };
|
|
@@ -139957,7 +140014,7 @@ function readGitStatus(ports, cwd, query) {
|
|
|
139957
140014
|
}
|
|
139958
140015
|
|
|
139959
140016
|
// src/statusline/vcs/jj.ts
|
|
139960
|
-
var
|
|
140017
|
+
var import_node_path60 = __toESM(require("node:path"), 1);
|
|
139961
140018
|
var JJ2 = "jj";
|
|
139962
140019
|
var MAX_WALK_DEPTH = 64;
|
|
139963
140020
|
var MAX_LABEL_CODE_POINTS = 64;
|
|
@@ -139970,13 +140027,13 @@ function isJjRepository(ports, cwd) {
|
|
|
139970
140027
|
return false;
|
|
139971
140028
|
}
|
|
139972
140029
|
for (let depth = 0; depth < MAX_WALK_DEPTH; depth += 1) {
|
|
139973
|
-
if (ports.entryKind(
|
|
140030
|
+
if (ports.entryKind(import_node_path60.default.join(directory, ".jj")) === "directory") {
|
|
139974
140031
|
return true;
|
|
139975
140032
|
}
|
|
139976
|
-
if (ports.entryKind(
|
|
140033
|
+
if (ports.entryKind(import_node_path60.default.join(directory, ".git")) !== void 0) {
|
|
139977
140034
|
return false;
|
|
139978
140035
|
}
|
|
139979
|
-
const parent =
|
|
140036
|
+
const parent = import_node_path60.default.dirname(directory);
|
|
139980
140037
|
if (parent === directory) {
|
|
139981
140038
|
return false;
|
|
139982
140039
|
}
|
|
@@ -140439,7 +140496,7 @@ function gitFilesRow(context) {
|
|
|
140439
140496
|
}
|
|
140440
140497
|
|
|
140441
140498
|
// src/statusline/configCounts.ts
|
|
140442
|
-
var
|
|
140499
|
+
var import_node_path61 = __toESM(require("node:path"), 1);
|
|
140443
140500
|
init_zod();
|
|
140444
140501
|
var nameList = external_exports.array(external_exports.unknown()).catch([]).transform((items) => items.filter((item) => typeof item === "string"));
|
|
140445
140502
|
var ConfigFileSchema = external_exports.looseObject({
|
|
@@ -140513,7 +140570,7 @@ function countRules(ports, root) {
|
|
|
140513
140570
|
break;
|
|
140514
140571
|
}
|
|
140515
140572
|
entries += 1;
|
|
140516
|
-
const entry =
|
|
140573
|
+
const entry = import_node_path61.default.join(real, name);
|
|
140517
140574
|
const kind = followedKind(ports, entry);
|
|
140518
140575
|
if (kind === "directory") {
|
|
140519
140576
|
count2 += walk3(entry);
|
|
@@ -140530,33 +140587,33 @@ function countRules(ports, root) {
|
|
|
140530
140587
|
return walk3(root);
|
|
140531
140588
|
}
|
|
140532
140589
|
function sameLocation(ports, left, right) {
|
|
140533
|
-
return (ports.realPath(left) ??
|
|
140590
|
+
return (ports.realPath(left) ?? import_node_path61.default.resolve(left)) === (ports.realPath(right) ?? import_node_path61.default.resolve(right));
|
|
140534
140591
|
}
|
|
140535
140592
|
function configDirectoryOf(ports) {
|
|
140536
140593
|
const pinned = ports.env.CLAUDE_CONFIG_DIR;
|
|
140537
|
-
return pinned === void 0 || pinned === "" ?
|
|
140594
|
+
return pinned === void 0 || pinned === "" ? import_node_path61.default.join(ports.homeDirectory, ".claude") : pinned;
|
|
140538
140595
|
}
|
|
140539
140596
|
function countConfiguration(ports, projectDirectory) {
|
|
140540
140597
|
const userDirectory = configDirectoryOf(ports);
|
|
140541
|
-
const userSettings = readConfigFile(ports,
|
|
140542
|
-
const globalFile = ports.env.CLAUDE_CONFIG_DIR === void 0 || ports.env.CLAUDE_CONFIG_DIR === "" ?
|
|
140598
|
+
const userSettings = readConfigFile(ports, import_node_path61.default.join(userDirectory, "settings.json"));
|
|
140599
|
+
const globalFile = ports.env.CLAUDE_CONFIG_DIR === void 0 || ports.env.CLAUDE_CONFIG_DIR === "" ? import_node_path61.default.join(ports.homeDirectory, ".claude.json") : import_node_path61.default.join(userDirectory, ".claude.json");
|
|
140543
140600
|
const global2 = readConfigFile(ports, globalFile);
|
|
140544
140601
|
const userServers = /* @__PURE__ */ new Set([...namesOf(userSettings), ...namesOf(global2)]);
|
|
140545
140602
|
removeNames(userServers, global2?.disabledMcpServers);
|
|
140546
140603
|
const projectServers = /* @__PURE__ */ new Set();
|
|
140547
|
-
let claudeMd = isFile(ports,
|
|
140548
|
-
let rules = countRules(ports,
|
|
140604
|
+
let claudeMd = isFile(ports, import_node_path61.default.join(userDirectory, "CLAUDE.md")) ? 1 : 0;
|
|
140605
|
+
let rules = countRules(ports, import_node_path61.default.join(userDirectory, "rules"));
|
|
140549
140606
|
let hookEvents = hookEventsOf(userSettings);
|
|
140550
140607
|
if (projectDirectory !== void 0) {
|
|
140551
|
-
const projectClaude =
|
|
140608
|
+
const projectClaude = import_node_path61.default.join(projectDirectory, ".claude");
|
|
140552
140609
|
const projectIsUser = sameLocation(ports, projectClaude, userDirectory);
|
|
140553
|
-
const claudeMdFiles = [
|
|
140610
|
+
const claudeMdFiles = [import_node_path61.default.join(projectDirectory, "CLAUDE.md"), import_node_path61.default.join(projectDirectory, "CLAUDE.local.md"), import_node_path61.default.join(projectClaude, "CLAUDE.local.md"), ...projectIsUser ? [] : [import_node_path61.default.join(projectClaude, "CLAUDE.md")]];
|
|
140554
140611
|
claudeMd += claudeMdFiles.filter((file2) => isFile(ports, file2)).length;
|
|
140555
|
-
const mcpJson = namesOf(readConfigFile(ports,
|
|
140612
|
+
const mcpJson = namesOf(readConfigFile(ports, import_node_path61.default.join(projectDirectory, ".mcp.json")));
|
|
140556
140613
|
if (!projectIsUser) {
|
|
140557
|
-
rules += countRules(ports,
|
|
140558
|
-
const settings2 = readConfigFile(ports,
|
|
140559
|
-
const local = readConfigFile(ports,
|
|
140614
|
+
rules += countRules(ports, import_node_path61.default.join(projectClaude, "rules"));
|
|
140615
|
+
const settings2 = readConfigFile(ports, import_node_path61.default.join(projectClaude, "settings.json"));
|
|
140616
|
+
const local = readConfigFile(ports, import_node_path61.default.join(projectClaude, "settings.local.json"));
|
|
140560
140617
|
hookEvents += hookEventsOf(settings2) + hookEventsOf(local);
|
|
140561
140618
|
for (const name of [...namesOf(settings2), ...namesOf(local)]) {
|
|
140562
140619
|
projectServers.add(name);
|
|
@@ -140858,11 +140915,11 @@ function targetText(tool, columns) {
|
|
|
140858
140915
|
if (!FILE_TOOLS.includes(tool.name)) {
|
|
140859
140916
|
return truncateWithEllipsis(target, room, ELLIPSIS);
|
|
140860
140917
|
}
|
|
140861
|
-
const
|
|
140862
|
-
if (visibleLength(
|
|
140863
|
-
return
|
|
140918
|
+
const path72 = target.replaceAll("\\", "/");
|
|
140919
|
+
if (visibleLength(path72) <= room) {
|
|
140920
|
+
return path72;
|
|
140864
140921
|
}
|
|
140865
|
-
const file2 =
|
|
140922
|
+
const file2 = path72.split("/").pop() ?? path72;
|
|
140866
140923
|
return visibleLength(DIRECTORY_ELLIPSIS) + visibleLength(file2) > room ? truncateWithEllipsis(file2, room, FILE_ELLIPSIS) : `${DIRECTORY_ELLIPSIS}${file2}`;
|
|
140867
140924
|
}
|
|
140868
140925
|
function finishedByKind(tools) {
|
|
@@ -142426,7 +142483,7 @@ function registerStatuslineCommand(program2, deps) {
|
|
|
142426
142483
|
} else {
|
|
142427
142484
|
const configDir = process.env.CLAUDE_CONFIG_DIR;
|
|
142428
142485
|
try {
|
|
142429
|
-
account = readAccountMetadataFile(realFarmFs, configDir === void 0 || configDir === "" ?
|
|
142486
|
+
account = readAccountMetadataFile(realFarmFs, configDir === void 0 || configDir === "" ? import_node_path62.default.join(import_node_os13.default.homedir(), ".claude.json") : import_node_path62.default.join(configDir, ".claude.json"));
|
|
142430
142487
|
} catch {
|
|
142431
142488
|
account = void 0;
|
|
142432
142489
|
}
|
|
@@ -144528,8 +144585,8 @@ function getErrorMap2() {
|
|
|
144528
144585
|
|
|
144529
144586
|
// node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/helpers/parseUtil.js
|
|
144530
144587
|
var makeIssue = (params) => {
|
|
144531
|
-
const { data, path:
|
|
144532
|
-
const fullPath = [...
|
|
144588
|
+
const { data, path: path72, errorMaps, issueData } = params;
|
|
144589
|
+
const fullPath = [...path72, ...issueData.path || []];
|
|
144533
144590
|
const fullIssue = {
|
|
144534
144591
|
...issueData,
|
|
144535
144592
|
path: fullPath
|
|
@@ -144644,11 +144701,11 @@ var errorUtil;
|
|
|
144644
144701
|
|
|
144645
144702
|
// node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/types.js
|
|
144646
144703
|
var ParseInputLazyPath = class {
|
|
144647
|
-
constructor(parent, value2,
|
|
144704
|
+
constructor(parent, value2, path72, key) {
|
|
144648
144705
|
this._cachedPath = [];
|
|
144649
144706
|
this.parent = parent;
|
|
144650
144707
|
this.data = value2;
|
|
144651
|
-
this._path =
|
|
144708
|
+
this._path = path72;
|
|
144652
144709
|
this._key = key;
|
|
144653
144710
|
}
|
|
144654
144711
|
get path() {
|
|
@@ -148211,11 +148268,11 @@ function normalizeObjectSchema(schema) {
|
|
|
148211
148268
|
}
|
|
148212
148269
|
return void 0;
|
|
148213
148270
|
}
|
|
148214
|
-
function getDotPath(
|
|
148215
|
-
if (
|
|
148271
|
+
function getDotPath(path72) {
|
|
148272
|
+
if (path72.length === 0) {
|
|
148216
148273
|
return "object root";
|
|
148217
148274
|
}
|
|
148218
|
-
return
|
|
148275
|
+
return path72.reduce((acc, seg, index) => {
|
|
148219
148276
|
if (index === 0) {
|
|
148220
148277
|
return String(seg);
|
|
148221
148278
|
}
|
|
@@ -152258,7 +152315,7 @@ async function serveMcp(mcp, transport, options = {}) {
|
|
|
152258
152315
|
|
|
152259
152316
|
// src/mcp/permissions.ts
|
|
152260
152317
|
var import_node_fs24 = __toESM(require("node:fs"), 1);
|
|
152261
|
-
var
|
|
152318
|
+
var import_node_path63 = __toESM(require("node:path"), 1);
|
|
152262
152319
|
init_zod();
|
|
152263
152320
|
init_store();
|
|
152264
152321
|
var StoredMcpPermissionsSchema = external_exports.strictObject({
|
|
@@ -152280,10 +152337,10 @@ function effectiveMcpPermissions(flags, stored2) {
|
|
|
152280
152337
|
return { writes: flags.writes || stored2.writes, remoteControl: flags.remoteControl || stored2.remoteControl, history: flags.history || stored2.history };
|
|
152281
152338
|
}
|
|
152282
152339
|
function watchMcpPermissions(paths, onChange) {
|
|
152283
|
-
const directory =
|
|
152340
|
+
const directory = import_node_path63.default.dirname(paths.mcpPermissionsFile);
|
|
152284
152341
|
import_node_fs24.default.mkdirSync(directory, { recursive: true });
|
|
152285
152342
|
const watcher = import_node_fs24.default.watch(directory, (_event, filename) => {
|
|
152286
|
-
if (filename === null || filename ===
|
|
152343
|
+
if (filename === null || filename === import_node_path63.default.basename(paths.mcpPermissionsFile)) {
|
|
152287
152344
|
onChange();
|
|
152288
152345
|
}
|
|
152289
152346
|
});
|
|
@@ -152596,16 +152653,16 @@ init_credentialCache();
|
|
|
152596
152653
|
|
|
152597
152654
|
// src/identityToken.ts
|
|
152598
152655
|
var import_node_fs25 = __toESM(require("node:fs"), 1);
|
|
152599
|
-
var
|
|
152656
|
+
var import_node_path64 = __toESM(require("node:path"), 1);
|
|
152600
152657
|
init_cliError();
|
|
152601
152658
|
var TOKEN_FILE_MODE = 384;
|
|
152602
152659
|
var TOKEN_DIR_MODE = 448;
|
|
152603
152660
|
var OAUTH_TOKEN_RE = /^sk-ant-oat\d+-[A-Za-z0-9_-]+$/;
|
|
152604
152661
|
function identityTokenDir(paths) {
|
|
152605
|
-
return
|
|
152662
|
+
return import_node_path64.default.join(paths.root, "credentials");
|
|
152606
152663
|
}
|
|
152607
152664
|
function identityTokenPath(paths, identityName) {
|
|
152608
|
-
return
|
|
152665
|
+
return import_node_path64.default.join(identityTokenDir(paths), `${identityName}.token`);
|
|
152609
152666
|
}
|
|
152610
152667
|
function storeIdentityToken(paths, identityName, raw) {
|
|
152611
152668
|
const token = raw.trim();
|
|
@@ -152616,7 +152673,7 @@ function storeIdentityToken(paths, identityName, raw) {
|
|
|
152616
152673
|
import_node_fs25.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
|
|
152617
152674
|
import_node_fs25.default.chmodSync(dir, TOKEN_DIR_MODE);
|
|
152618
152675
|
const target = identityTokenPath(paths, identityName);
|
|
152619
|
-
const temp =
|
|
152676
|
+
const temp = import_node_path64.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
|
|
152620
152677
|
import_node_fs25.default.writeFileSync(temp, `${token}
|
|
152621
152678
|
`, { mode: TOKEN_FILE_MODE });
|
|
152622
152679
|
import_node_fs25.default.renameSync(temp, target);
|
|
@@ -152788,7 +152845,7 @@ function registerDoctorCommand(program2, deps) {
|
|
|
152788
152845
|
// src/headroom/commands.ts
|
|
152789
152846
|
var import_node_fs26 = __toESM(require("node:fs"), 1);
|
|
152790
152847
|
var import_node_http5 = __toESM(require("node:http"), 1);
|
|
152791
|
-
var
|
|
152848
|
+
var import_node_path65 = __toESM(require("node:path"), 1);
|
|
152792
152849
|
var import_node_child_process10 = require("node:child_process");
|
|
152793
152850
|
init_commandDeps();
|
|
152794
152851
|
init_configProfilesStore();
|
|
@@ -152979,12 +153036,12 @@ function readInstalledHeadroomCommit() {
|
|
|
152979
153036
|
if (toolDir.status !== 0) {
|
|
152980
153037
|
return void 0;
|
|
152981
153038
|
}
|
|
152982
|
-
const libDir =
|
|
153039
|
+
const libDir = import_node_path65.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
|
|
152983
153040
|
for (const python of realFarmFs.readdir(libDir)) {
|
|
152984
|
-
const sitePackages =
|
|
153041
|
+
const sitePackages = import_node_path65.default.join(libDir, python, "site-packages");
|
|
152985
153042
|
for (const entry of realFarmFs.readdir(sitePackages)) {
|
|
152986
153043
|
if (entry.startsWith("headroom_ai-") && entry.endsWith(".dist-info")) {
|
|
152987
|
-
const directUrl = realFarmFs.readFileUtf8(
|
|
153044
|
+
const directUrl = realFarmFs.readFileUtf8(import_node_path65.default.join(sitePackages, entry, "direct_url.json"));
|
|
152988
153045
|
return directUrl === void 0 ? void 0 : parseInstalledCommit(directUrl);
|
|
152989
153046
|
}
|
|
152990
153047
|
}
|
|
@@ -153240,7 +153297,7 @@ async function refreshCatalogueForReal(paths, name, env) {
|
|
|
153240
153297
|
init_realPorts();
|
|
153241
153298
|
|
|
153242
153299
|
// src/usage/realJobRunner.ts
|
|
153243
|
-
var
|
|
153300
|
+
var import_node_path66 = __toESM(require("node:path"), 1);
|
|
153244
153301
|
init_conditions();
|
|
153245
153302
|
init_identityClaude();
|
|
153246
153303
|
var JOB_LAUNCH_FLAGS = ["--no-headroom", "--no-remote-control", "--track-usage"];
|
|
@@ -153253,7 +153310,7 @@ ${outcome.trimEnd()}
|
|
|
153253
153310
|
}
|
|
153254
153311
|
function createRealJobRunner(params) {
|
|
153255
153312
|
return async (name, identity, job) => {
|
|
153256
|
-
const logFile =
|
|
153313
|
+
const logFile = import_node_path66.default.join(params.paths.jobLogsDir, `${name}.log`);
|
|
153257
153314
|
const append = (outcome) => {
|
|
153258
153315
|
params.fs.mkdirPrivate(params.paths.jobLogsDir);
|
|
153259
153316
|
params.fs.appendFilePrivate(logFile, logEntry(name, identity, params.now(), outcome));
|
|
@@ -153310,7 +153367,7 @@ function registerHeadlessCommands(program2, deps) {
|
|
|
153310
153367
|
}
|
|
153311
153368
|
|
|
153312
153369
|
// src/jobs.ts
|
|
153313
|
-
var
|
|
153370
|
+
var import_node_path67 = __toESM(require("node:path"), 1);
|
|
153314
153371
|
init_commandDeps();
|
|
153315
153372
|
init_cliError();
|
|
153316
153373
|
init_schema();
|
|
@@ -153335,7 +153392,7 @@ function jobOf(options) {
|
|
|
153335
153392
|
target: options.identity === void 0 ? { pool: options.pool ?? "" } : { identity: options.identity },
|
|
153336
153393
|
trigger: options.at === void 0 ? { beforeReset: options.beforeReset ?? "fiveHour", lead: options.lead ?? "" } : { at: options.at },
|
|
153337
153394
|
prompt: options.prompt,
|
|
153338
|
-
cwd:
|
|
153395
|
+
cwd: import_node_path67.default.resolve(options.cwd ?? process.cwd()),
|
|
153339
153396
|
timeout: options.timeout,
|
|
153340
153397
|
...options.model === void 0 ? {} : { model: options.model },
|
|
153341
153398
|
...options.allowedTool === void 0 ? {} : { allowedTools: options.allowedTool }
|
|
@@ -153408,7 +153465,7 @@ function registerJobCommand(program2, deps) {
|
|
|
153408
153465
|
console.log(`Allowed tools: ${entry.allowedTools.join(", ")}`);
|
|
153409
153466
|
}
|
|
153410
153467
|
console.log(`Prompt: ${entry.prompt}`);
|
|
153411
|
-
console.log(`Results: ${
|
|
153468
|
+
console.log(`Results: ${import_node_path67.default.join(paths.jobLogsDir, `${name}.log`)}`);
|
|
153412
153469
|
}),
|
|
153413
153470
|
["agent-shim job show digest"]
|
|
153414
153471
|
);
|
|
@@ -153431,7 +153488,7 @@ function registerJobCommand(program2, deps) {
|
|
|
153431
153488
|
throw new UsageError(`No member of the job's pool can be picked right now.`);
|
|
153432
153489
|
}
|
|
153433
153490
|
await createRealJobRunner({ paths, spawnDaemon: spawnDetachedSupervisor, fs: realFarmFs, now: () => /* @__PURE__ */ new Date() })(name, identity, entry);
|
|
153434
|
-
console.log(`Ran job "${name}" as ${identity}; the result is in ${
|
|
153491
|
+
console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path67.default.join(paths.jobLogsDir, `${name}.log`)}.`);
|
|
153435
153492
|
}),
|
|
153436
153493
|
["agent-shim job run digest"]
|
|
153437
153494
|
);
|
|
@@ -153595,7 +153652,7 @@ init_providerAliases();
|
|
|
153595
153652
|
|
|
153596
153653
|
// src/providerRename.ts
|
|
153597
153654
|
var import_node_fs27 = __toESM(require("node:fs"), 1);
|
|
153598
|
-
var
|
|
153655
|
+
var import_node_path68 = __toESM(require("node:path"), 1);
|
|
153599
153656
|
init_schema();
|
|
153600
153657
|
init_store();
|
|
153601
153658
|
init_load();
|
|
@@ -153713,7 +153770,7 @@ function rewriteReferences(paths, from, to2) {
|
|
|
153713
153770
|
const launch = renamedLaunch(profile.launch, from, to2);
|
|
153714
153771
|
const models = profile.models === void 0 ? void 0 : renamedModels(profile.models, from, to2);
|
|
153715
153772
|
if (launch !== void 0 || models !== void 0) {
|
|
153716
|
-
applyPatch(
|
|
153773
|
+
applyPatch(import_node_path68.default.join(paths.configProfilesDir, `${name}.json`), ConfigProfileSchema, { ...launch === void 0 ? {} : { launch }, ...models === void 0 ? {} : { models } });
|
|
153717
153774
|
rewritten.push(`profile ${name}`);
|
|
153718
153775
|
}
|
|
153719
153776
|
}
|
|
@@ -154540,7 +154597,7 @@ function registerSessionCommands(program2, deps) {
|
|
|
154540
154597
|
}
|
|
154541
154598
|
|
|
154542
154599
|
// src/usage/commands.ts
|
|
154543
|
-
var
|
|
154600
|
+
var import_node_path69 = __toESM(require("node:path"), 1);
|
|
154544
154601
|
init_commandDeps();
|
|
154545
154602
|
init_realPorts();
|
|
154546
154603
|
init_account();
|
|
@@ -154679,7 +154736,7 @@ function collectAccounts(fs31, paths, identity, probe) {
|
|
|
154679
154736
|
return names.map((name) => ({
|
|
154680
154737
|
identity: name,
|
|
154681
154738
|
account: readAccountMetadata(fs31, paths.identitiesDir, name),
|
|
154682
|
-
signIn: identitySignIn(fs31, probe, { farmRoot:
|
|
154739
|
+
signIn: identitySignIn(fs31, probe, { farmRoot: import_node_path69.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
|
|
154683
154740
|
usage: readUsageSnapshot(fs31, paths.usageSnapshotsDir, name)
|
|
154684
154741
|
}));
|
|
154685
154742
|
}
|
|
@@ -155086,7 +155143,7 @@ function quotaHitOf(fs31, paths, identity, sessionId, sinceMs, nowMs) {
|
|
|
155086
155143
|
}
|
|
155087
155144
|
|
|
155088
155145
|
// src/supervise/move.ts
|
|
155089
|
-
var
|
|
155146
|
+
var import_node_path70 = __toESM(require("node:path"), 1);
|
|
155090
155147
|
init_lock();
|
|
155091
155148
|
init_poolPick();
|
|
155092
155149
|
init_read();
|
|
@@ -155132,7 +155189,7 @@ function createMover(deps) {
|
|
|
155132
155189
|
if (resolution.identity === request7.from) {
|
|
155133
155190
|
return { kind: "stay", reason: `no other member of pool "${pool}" can take it` };
|
|
155134
155191
|
}
|
|
155135
|
-
const transcript =
|
|
155192
|
+
const transcript = import_node_path70.default.join(paths.identitiesDir, resolution.identity, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
|
|
155136
155193
|
if (farmFs.lstat(transcript)?.kind !== "file") {
|
|
155137
155194
|
return { kind: "stay", reason: `${resolution.identity} does not share this conversation's history, so it could not resume it` };
|
|
155138
155195
|
}
|
|
@@ -155166,13 +155223,13 @@ function createIdentityMover(deps) {
|
|
|
155166
155223
|
throw error63;
|
|
155167
155224
|
}
|
|
155168
155225
|
try {
|
|
155169
|
-
if (farmFs.readFileUtf8(
|
|
155226
|
+
if (farmFs.readFileUtf8(import_node_path70.default.join(paths.identitiesDir, request7.to, "identity.json")) === void 0) {
|
|
155170
155227
|
return { kind: "stay", reason: `no identity "${request7.to}"` };
|
|
155171
155228
|
}
|
|
155172
155229
|
if (request7.to === request7.from) {
|
|
155173
155230
|
return { kind: "stay", reason: `the model already runs under this session's identity` };
|
|
155174
155231
|
}
|
|
155175
|
-
const transcript =
|
|
155232
|
+
const transcript = import_node_path70.default.join(paths.identitiesDir, request7.to, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
|
|
155176
155233
|
if (farmFs.lstat(transcript)?.kind !== "file") {
|
|
155177
155234
|
return { kind: "stay", reason: `${request7.to} does not share this conversation's history, so it could not resume it` };
|
|
155178
155235
|
}
|
|
@@ -155751,7 +155808,7 @@ async function runClaude(argvOverride) {
|
|
|
155751
155808
|
// src/cli.ts
|
|
155752
155809
|
async function main() {
|
|
155753
155810
|
aliasLegacyEnv(process.env);
|
|
155754
|
-
const invokedName =
|
|
155811
|
+
const invokedName = import_node_path71.default.basename(process.argv[1] ?? "agent-shim");
|
|
155755
155812
|
if (isInvokedAsClaude(invokedName)) {
|
|
155756
155813
|
await runClaude();
|
|
155757
155814
|
return;
|