claude-use 11.52.1 → 11.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +943 -484
- package/dist/index.cjs +49 -10
- package/dist/index.mjs +49 -10
- package/dist/types/index.d.ts +2064 -18
- 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, path67) {
|
|
322
|
+
if (!path67)
|
|
323
323
|
return obj;
|
|
324
|
-
return
|
|
324
|
+
return path67.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(path67, 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(path67);
|
|
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, path67 = []) => {
|
|
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 }, [...path67, ...issue2.path]));
|
|
1112
1112
|
} else if (issue2.code === "invalid_key") {
|
|
1113
|
-
processError({ issues: issue2.issues }, [...
|
|
1113
|
+
processError({ issues: issue2.issues }, [...path67, ...issue2.path]);
|
|
1114
1114
|
} else if (issue2.code === "invalid_element") {
|
|
1115
|
-
processError({ issues: issue2.issues }, [...
|
|
1115
|
+
processError({ issues: issue2.issues }, [...path67, ...issue2.path]);
|
|
1116
1116
|
} else {
|
|
1117
|
-
const fullpath = [...
|
|
1117
|
+
const fullpath = [...path67, ...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, path67 = []) => {
|
|
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 }, [...path67, ...issue2.path]));
|
|
1161
1161
|
} else if (issue2.code === "invalid_key") {
|
|
1162
|
-
processError({ issues: issue2.issues }, [...
|
|
1162
|
+
processError({ issues: issue2.issues }, [...path67, ...issue2.path]);
|
|
1163
1163
|
} else if (issue2.code === "invalid_element") {
|
|
1164
|
-
processError({ issues: issue2.issues }, [...
|
|
1164
|
+
processError({ issues: issue2.issues }, [...path67, ...issue2.path]);
|
|
1165
1165
|
} else {
|
|
1166
|
-
const fullpath = [...
|
|
1166
|
+
const fullpath = [...path67, ...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 path67 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1206
|
+
for (const seg of path67) {
|
|
1207
1207
|
if (typeof seg === "number")
|
|
1208
1208
|
segs.push(`[${seg}]`);
|
|
1209
1209
|
else if (typeof seg === "symbol")
|
|
@@ -1385,18 +1385,18 @@ var init_parse = __esm({
|
|
|
1385
1385
|
return result.issues.length === 0;
|
|
1386
1386
|
};
|
|
1387
1387
|
_encode = (_Err) => {
|
|
1388
|
-
const
|
|
1388
|
+
const parse5 = _parse(_Err);
|
|
1389
1389
|
const fn2 = (schema, value2, _ctx, _params) => {
|
|
1390
1390
|
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
1391
|
-
return
|
|
1391
|
+
return parse5(schema, value2, ctx, finalizeParams(fn2, _params));
|
|
1392
1392
|
};
|
|
1393
1393
|
return fn2;
|
|
1394
1394
|
};
|
|
1395
1395
|
encode = /* @__PURE__ */ _encode($ZodRealError);
|
|
1396
1396
|
_decode = (_Err) => {
|
|
1397
|
-
const
|
|
1397
|
+
const parse5 = _parse(_Err);
|
|
1398
1398
|
const fn2 = (schema, value2, _ctx, _params) => {
|
|
1399
|
-
return
|
|
1399
|
+
return parse5(schema, value2, _ctx, finalizeParams(fn2, _params));
|
|
1400
1400
|
};
|
|
1401
1401
|
return fn2;
|
|
1402
1402
|
};
|
|
@@ -13188,9 +13188,9 @@ function codePointLengthVar(doc, ctx, accessor, inDoubt) {
|
|
|
13188
13188
|
doc.write(`const ${v} = typeof ${accessor} === "string" && ${inDoubt} ? ${cpLen}(${accessor}) : ${accessor}.length;`);
|
|
13189
13189
|
return v;
|
|
13190
13190
|
}
|
|
13191
|
-
function numericOperand(value2,
|
|
13191
|
+
function numericOperand(value2, label2) {
|
|
13192
13192
|
if (typeof value2 !== "number" || !Number.isFinite(value2)) {
|
|
13193
|
-
throw new ZodCompileUnsupportedError(`${
|
|
13193
|
+
throw new ZodCompileUnsupportedError(`${label2} bound of type ${typeof value2}`);
|
|
13194
13194
|
}
|
|
13195
13195
|
return `${value2}`;
|
|
13196
13196
|
}
|
|
@@ -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 path67 = ref.slice(1).split("/").filter(Boolean);
|
|
19203
|
+
if (path67.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 (path67[0] === defsKey) {
|
|
19208
|
+
const key = path67[1] === void 0 ? void 0 : decodeJSONPointerSegment(path67[1]);
|
|
19209
19209
|
if (!key || !ctx.defs[key]) {
|
|
19210
19210
|
throw new Error(`Reference not found: ${ref}`);
|
|
19211
19211
|
}
|
|
@@ -22880,22 +22880,22 @@ var require_dumper = __commonJS({
|
|
|
22880
22880
|
var CHAR_LEFT_CURLY_BRACKET = 123;
|
|
22881
22881
|
var CHAR_VERTICAL_LINE = 124;
|
|
22882
22882
|
var CHAR_RIGHT_CURLY_BRACKET = 125;
|
|
22883
|
-
var
|
|
22884
|
-
|
|
22885
|
-
|
|
22886
|
-
|
|
22887
|
-
|
|
22888
|
-
|
|
22889
|
-
|
|
22890
|
-
|
|
22891
|
-
|
|
22892
|
-
|
|
22893
|
-
|
|
22894
|
-
|
|
22895
|
-
|
|
22896
|
-
|
|
22897
|
-
|
|
22898
|
-
|
|
22883
|
+
var ESCAPE_SEQUENCES2 = {};
|
|
22884
|
+
ESCAPE_SEQUENCES2[0] = "\\0";
|
|
22885
|
+
ESCAPE_SEQUENCES2[7] = "\\a";
|
|
22886
|
+
ESCAPE_SEQUENCES2[8] = "\\b";
|
|
22887
|
+
ESCAPE_SEQUENCES2[9] = "\\t";
|
|
22888
|
+
ESCAPE_SEQUENCES2[10] = "\\n";
|
|
22889
|
+
ESCAPE_SEQUENCES2[11] = "\\v";
|
|
22890
|
+
ESCAPE_SEQUENCES2[12] = "\\f";
|
|
22891
|
+
ESCAPE_SEQUENCES2[13] = "\\r";
|
|
22892
|
+
ESCAPE_SEQUENCES2[27] = "\\e";
|
|
22893
|
+
ESCAPE_SEQUENCES2[34] = '\\"';
|
|
22894
|
+
ESCAPE_SEQUENCES2[92] = "\\\\";
|
|
22895
|
+
ESCAPE_SEQUENCES2[133] = "\\N";
|
|
22896
|
+
ESCAPE_SEQUENCES2[160] = "\\_";
|
|
22897
|
+
ESCAPE_SEQUENCES2[8232] = "\\L";
|
|
22898
|
+
ESCAPE_SEQUENCES2[8233] = "\\P";
|
|
22899
22899
|
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
22900
22900
|
"y",
|
|
22901
22901
|
"Y",
|
|
@@ -23214,7 +23214,7 @@ var require_dumper = __commonJS({
|
|
|
23214
23214
|
let char = 0;
|
|
23215
23215
|
for (let i10 = 0; i10 < string4.length; char >= 65536 ? i10 += 2 : i10++) {
|
|
23216
23216
|
char = codePointAt(string4, i10);
|
|
23217
|
-
const escapeSeq =
|
|
23217
|
+
const escapeSeq = ESCAPE_SEQUENCES2[char];
|
|
23218
23218
|
if (!escapeSeq && isPrintable(char)) {
|
|
23219
23219
|
result += string4[i10];
|
|
23220
23220
|
if (char >= 65536) result += string4[i10 + 1];
|
|
@@ -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 path67 = 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 = path67.join(homedir, "Library");
|
|
23722
23722
|
return {
|
|
23723
|
-
data:
|
|
23724
|
-
config:
|
|
23725
|
-
cache:
|
|
23726
|
-
log:
|
|
23727
|
-
temp:
|
|
23723
|
+
data: path67.join(library, "Application Support", name),
|
|
23724
|
+
config: path67.join(library, "Preferences", name),
|
|
23725
|
+
cache: path67.join(library, "Caches", name),
|
|
23726
|
+
log: path67.join(library, "Logs", name),
|
|
23727
|
+
temp: path67.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 || path67.join(homedir, "AppData", "Roaming");
|
|
23732
|
+
const localAppData = env.LOCALAPPDATA || path67.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: path67.join(localAppData, name, "Data"),
|
|
23736
|
+
config: path67.join(appData, name, "Config"),
|
|
23737
|
+
cache: path67.join(localAppData, name, "Cache"),
|
|
23738
|
+
log: path67.join(localAppData, name, "Log"),
|
|
23739
|
+
temp: path67.join(tmpdir, name)
|
|
23740
23740
|
};
|
|
23741
23741
|
};
|
|
23742
23742
|
var linux = (name) => {
|
|
23743
|
-
const username =
|
|
23743
|
+
const username = path67.basename(homedir);
|
|
23744
23744
|
return {
|
|
23745
|
-
data:
|
|
23746
|
-
config:
|
|
23747
|
-
cache:
|
|
23745
|
+
data: path67.join(env.XDG_DATA_HOME || path67.join(homedir, ".local", "share"), name),
|
|
23746
|
+
config: path67.join(env.XDG_CONFIG_HOME || path67.join(homedir, ".config"), name),
|
|
23747
|
+
cache: path67.join(env.XDG_CACHE_HOME || path67.join(homedir, ".cache"), name),
|
|
23748
23748
|
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
23749
|
-
log:
|
|
23750
|
-
temp:
|
|
23749
|
+
log: path67.join(env.XDG_STATE_HOME || path67.join(homedir, ".local", "state"), name),
|
|
23750
|
+
temp: path67.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, path67) {
|
|
23819
|
+
if (typeof path67 === "string" && Object.prototype.hasOwnProperty.call(source, path67)) {
|
|
23820
|
+
return source[path67];
|
|
23821
23821
|
}
|
|
23822
|
-
const parsedPath = typeof
|
|
23822
|
+
const parsedPath = typeof path67 === "string" ? path67.split(".") : path67;
|
|
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(path67) {
|
|
23846
23846
|
try {
|
|
23847
|
-
const stat = await fs_1.promises.stat(
|
|
23847
|
+
const stat = await fs_1.promises.stat(path67);
|
|
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(path67) {
|
|
23858
23858
|
try {
|
|
23859
|
-
const stat = fs_1.default.statSync(
|
|
23859
|
+
const stat = fs_1.default.statSync(path67);
|
|
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((path67, i10) => `${i10 + 1}. ${path67}`).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(path67) {
|
|
24146
24146
|
try {
|
|
24147
|
-
await promises_1.default.stat(
|
|
24147
|
+
await promises_1.default.stat(path67);
|
|
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(path67) {
|
|
24308
24308
|
try {
|
|
24309
|
-
fs_1.default.statSync(
|
|
24309
|
+
fs_1.default.statSync(path67);
|
|
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((path67) => path67.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: path67, keys }) => `${path67.length === 0 ? "" : `${path67.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: path67, values } of ignored) {
|
|
24586
24586
|
let holder = restored;
|
|
24587
|
-
for (const step2 of
|
|
24587
|
+
for (const step2 of path67) {
|
|
24588
24588
|
holder = isRecord(holder) ? holder[step2] : void 0;
|
|
24589
24589
|
}
|
|
24590
24590
|
if (isRecord(holder)) {
|
|
@@ -24997,7 +24997,7 @@ var init_supervisorProcesses = __esm({
|
|
|
24997
24997
|
// src/config/proxyBypass.ts
|
|
24998
24998
|
function isDnsName(name) {
|
|
24999
24999
|
const labels = name.split(".");
|
|
25000
|
-
return name.length <= MAX_NAME_LENGTH && labels.every((
|
|
25000
|
+
return name.length <= MAX_NAME_LENGTH && labels.every((label2) => label2.length <= MAX_LABEL_LENGTH && LABEL_RE.test(label2)) && !DIGITS_RE.test(labels.at(-1) ?? "");
|
|
25001
25001
|
}
|
|
25002
25002
|
function isIpv4(host) {
|
|
25003
25003
|
return IPV4_RE.test(host) && host.split(".").every((octet) => Number(octet) <= MAX_OCTET);
|
|
@@ -25063,13 +25063,13 @@ function resolveStatusline(settings2) {
|
|
|
25063
25063
|
}
|
|
25064
25064
|
return resolved;
|
|
25065
25065
|
}
|
|
25066
|
-
var STATUSLINE_HEADER_SEGMENTS, STATUSLINE_ROWS, STATUSLINE_COLOUR_NAMES, MAX_PERCENT, MAX_STATUSLINE_PALETTE_INDEX, MAX_STATUSLINE_LABEL_CHARS, MAX_BAR_CELLS, LABEL_RE2, colourValue, GRAPHEMES, barCharacter, labelText, wholePercent, SHAPES, StatuslineSchema, ResolvedStatuslineSchema, STATUSLINE_DEFAULTS, STATUSLINE_ENV;
|
|
25066
|
+
var STATUSLINE_HEADER_SEGMENTS, STATUSLINE_ROWS, STATUSLINE_COLOUR_NAMES, DEFAULT_HEADER_SEGMENTS, DEFAULT_ROWS, STATUSLINE_PATH_LEVELS, MAX_PERCENT, MAX_STATUSLINE_PALETTE_INDEX, MAX_STATUSLINE_LABEL_CHARS, MAX_BAR_CELLS, LABEL_RE2, colourValue, GRAPHEMES, barCharacter, labelText, wholePercent, SHAPES, StatuslineSchema, ResolvedStatuslineSchema, STATUSLINE_DEFAULTS, STATUSLINE_ENV;
|
|
25067
25067
|
var init_statusline = __esm({
|
|
25068
25068
|
"src/config/statusline.ts"() {
|
|
25069
25069
|
"use strict";
|
|
25070
25070
|
init_zod();
|
|
25071
|
-
STATUSLINE_HEADER_SEGMENTS = ["model", "provider", "route", "account", "identity", "headroom"];
|
|
25072
|
-
STATUSLINE_ROWS = ["context", "quota"];
|
|
25071
|
+
STATUSLINE_HEADER_SEGMENTS = ["model", "provider", "route", "account", "identity", "headroom", "project", "vcs"];
|
|
25072
|
+
STATUSLINE_ROWS = ["context", "quota", "addedDirs", "gitFiles"];
|
|
25073
25073
|
STATUSLINE_COLOUR_NAMES = [
|
|
25074
25074
|
"default",
|
|
25075
25075
|
"dim",
|
|
@@ -25090,6 +25090,9 @@ var init_statusline = __esm({
|
|
|
25090
25090
|
"brightCyan",
|
|
25091
25091
|
"brightWhite"
|
|
25092
25092
|
];
|
|
25093
|
+
DEFAULT_HEADER_SEGMENTS = ["model", "provider", "route", "account", "identity", "headroom"];
|
|
25094
|
+
DEFAULT_ROWS = ["context", "quota"];
|
|
25095
|
+
STATUSLINE_PATH_LEVELS = ["1", "2", "3", "full"];
|
|
25093
25096
|
MAX_PERCENT = 100;
|
|
25094
25097
|
MAX_STATUSLINE_PALETTE_INDEX = 255;
|
|
25095
25098
|
MAX_STATUSLINE_LABEL_CHARS = 12;
|
|
@@ -25126,7 +25129,28 @@ var init_statusline = __esm({
|
|
|
25126
25129
|
critical: colourValue.describe("The colour of a bar at or above bands.criticalAt, and of a cache hit share that is nearly nothing."),
|
|
25127
25130
|
model: colourValue.describe("The colour of the model and provider segments."),
|
|
25128
25131
|
label: colourValue.describe("The colour of labels and secondary text: row labels, and the route, account, identity and headroom segments."),
|
|
25129
|
-
empty: colourValue.describe("The colour of the unused part of a bar.")
|
|
25132
|
+
empty: colourValue.describe("The colour of the unused part of a bar."),
|
|
25133
|
+
project: colourValue.describe("The colour of the project path segment."),
|
|
25134
|
+
git: colourValue.describe("The colour of the version control segment's wrapper text (`git:(` and `)`)."),
|
|
25135
|
+
gitBranch: colourValue.describe("The colour of the branch or bookmark and its ahead, behind and dirty markers.")
|
|
25136
|
+
},
|
|
25137
|
+
project: {
|
|
25138
|
+
pathLevels: external_exports.enum(STATUSLINE_PATH_LEVELS).describe("How many trailing directories of the working directory the project segment shows: 1, 2 or 3, or full for the whole absolute path."),
|
|
25139
|
+
addedDirsLayout: external_exports.enum(["inline", "row"]).describe("Where the directories added to the session are drawn: inline, as +name after the project path in the project segment, or row, as an Added dirs line when layout.rows lists addedDirs.")
|
|
25140
|
+
},
|
|
25141
|
+
git: {
|
|
25142
|
+
enabled: external_exports.boolean().describe("Whether the vcs segment and the gitFiles row read the working directory's git status."),
|
|
25143
|
+
showDirty: external_exports.boolean().describe("Whether the branch is followed by * when the working tree has uncommitted changes."),
|
|
25144
|
+
showAheadBehind: external_exports.boolean().describe("Whether the branch is followed by the commits ahead of (up-arrow) and behind (down-arrow) its upstream."),
|
|
25145
|
+
showLineDiff: external_exports.boolean().describe("Whether the segment shows the total lines added and removed against HEAD, as [+a -d]."),
|
|
25146
|
+
branchOverflow: external_exports.enum(["truncate", "wrap"]).describe("How the vcs segment sits beside the project segment when they are listed next to each other: truncate keeps them as one unit the client cuts off at the terminal's edge, and wrap lets the line break between them."),
|
|
25147
|
+
pushWarnAt: external_exports.number().int().min(0).describe("The count of unpushed commits at which the ahead marker takes colours.warning; 0 turns it off."),
|
|
25148
|
+
pushCriticalAt: external_exports.number().int().min(0).describe("The count of unpushed commits at which the ahead marker takes colours.critical; 0 turns it off.")
|
|
25149
|
+
},
|
|
25150
|
+
jj: {
|
|
25151
|
+
enabled: external_exports.boolean().describe("Whether the vcs segment reads a Jujutsu repository's status, instead of git's, when the working directory is inside one."),
|
|
25152
|
+
showDirty: external_exports.boolean().describe("Whether the bookmark or change id is followed by * when the working-copy commit differs from its parent."),
|
|
25153
|
+
showConflicts: external_exports.boolean().describe("Whether the segment shows !conflict when the working-copy commit has an unresolved conflict.")
|
|
25130
25154
|
}
|
|
25131
25155
|
};
|
|
25132
25156
|
StatuslineSchema = external_exports.strictObject({
|
|
@@ -25134,17 +25158,23 @@ var init_statusline = __esm({
|
|
|
25134
25158
|
bands: external_exports.strictObject(SHAPES.bands).partial().optional(),
|
|
25135
25159
|
labels: external_exports.strictObject(SHAPES.labels).partial().optional(),
|
|
25136
25160
|
bar: external_exports.strictObject(SHAPES.bar).partial().optional(),
|
|
25137
|
-
colours: external_exports.strictObject(SHAPES.colours).partial().optional()
|
|
25161
|
+
colours: external_exports.strictObject(SHAPES.colours).partial().optional(),
|
|
25162
|
+
project: external_exports.strictObject(SHAPES.project).partial().optional(),
|
|
25163
|
+
git: external_exports.strictObject(SHAPES.git).partial().optional(),
|
|
25164
|
+
jj: external_exports.strictObject(SHAPES.jj).partial().optional()
|
|
25138
25165
|
});
|
|
25139
25166
|
ResolvedStatuslineSchema = external_exports.strictObject({
|
|
25140
25167
|
layout: external_exports.strictObject(SHAPES.layout),
|
|
25141
25168
|
bands: external_exports.strictObject(SHAPES.bands),
|
|
25142
25169
|
labels: external_exports.strictObject(SHAPES.labels),
|
|
25143
25170
|
bar: external_exports.strictObject(SHAPES.bar),
|
|
25144
|
-
colours: external_exports.strictObject(SHAPES.colours)
|
|
25171
|
+
colours: external_exports.strictObject(SHAPES.colours),
|
|
25172
|
+
project: external_exports.strictObject(SHAPES.project),
|
|
25173
|
+
git: external_exports.strictObject(SHAPES.git),
|
|
25174
|
+
jj: external_exports.strictObject(SHAPES.jj)
|
|
25145
25175
|
});
|
|
25146
25176
|
STATUSLINE_DEFAULTS = {
|
|
25147
|
-
layout: { header: [...
|
|
25177
|
+
layout: { header: [...DEFAULT_HEADER_SEGMENTS], rows: [...DEFAULT_ROWS] },
|
|
25148
25178
|
bands: { warnAt: 70, criticalAt: 90 },
|
|
25149
25179
|
labels: { fiveHour: "5h", sevenDay: "Wk" },
|
|
25150
25180
|
bar: { width: 10, filled: "\u2588", empty: "\u2591" },
|
|
@@ -25156,8 +25186,14 @@ var init_statusline = __esm({
|
|
|
25156
25186
|
critical: "red",
|
|
25157
25187
|
model: "default",
|
|
25158
25188
|
label: "default",
|
|
25159
|
-
empty: "brightBlack"
|
|
25160
|
-
|
|
25189
|
+
empty: "brightBlack",
|
|
25190
|
+
project: "yellow",
|
|
25191
|
+
git: "magenta",
|
|
25192
|
+
gitBranch: "cyan"
|
|
25193
|
+
},
|
|
25194
|
+
project: { pathLevels: "1", addedDirsLayout: "inline" },
|
|
25195
|
+
git: { enabled: true, showDirty: true, showAheadBehind: false, showLineDiff: false, branchOverflow: "truncate", pushWarnAt: 0, pushCriticalAt: 0 },
|
|
25196
|
+
jj: { enabled: false, showDirty: true, showConflicts: true }
|
|
25161
25197
|
};
|
|
25162
25198
|
STATUSLINE_ENV = "AGENT_SHIM_STATUSLINE";
|
|
25163
25199
|
}
|
|
@@ -28387,21 +28423,21 @@ function headroomSocketPath(paths, supervisorPid) {
|
|
|
28387
28423
|
function platformRefusal(platform) {
|
|
28388
28424
|
return PLATFORMS_WITHOUT_UNIX_SOCKETS.includes(platform) ? `headroom routing needs a unix domain socket, which headroom cannot serve on ${platform}; agent-shim never falls back to a TCP port for this hop` : void 0;
|
|
28389
28425
|
}
|
|
28390
|
-
function ownerOnlyRefusal(
|
|
28426
|
+
function ownerOnlyRefusal(label2, target, stat, expected, uid) {
|
|
28391
28427
|
if (stat === void 0) {
|
|
28392
|
-
return `the headroom ${
|
|
28428
|
+
return `the headroom ${label2} ${target} does not exist`;
|
|
28393
28429
|
}
|
|
28394
28430
|
if (stat.kind === "symlink") {
|
|
28395
|
-
return `the headroom ${
|
|
28431
|
+
return `the headroom ${label2} ${target} is a symlink; it must be the real ${KIND_NAMES[expected]}`;
|
|
28396
28432
|
}
|
|
28397
28433
|
if (stat.kind !== expected) {
|
|
28398
|
-
return `the headroom ${
|
|
28434
|
+
return `the headroom ${label2} ${target} is not a ${KIND_NAMES[expected]}`;
|
|
28399
28435
|
}
|
|
28400
28436
|
if (stat.uid !== uid) {
|
|
28401
|
-
return `the headroom ${
|
|
28437
|
+
return `the headroom ${label2} ${target} is owned by uid ${String(stat.uid)}, not by this user (uid ${String(uid)})`;
|
|
28402
28438
|
}
|
|
28403
28439
|
if ((stat.mode & GROUP_OR_OTHER_BITS) !== 0) {
|
|
28404
|
-
return `the headroom ${
|
|
28440
|
+
return `the headroom ${label2} ${target} has mode ${stat.mode.toString(OCTAL_RADIX).padStart(MODE_DIGITS, "0")}, which lets other users reach it; it must be accessible to its owner only`;
|
|
28405
28441
|
}
|
|
28406
28442
|
return void 0;
|
|
28407
28443
|
}
|
|
@@ -30168,8 +30204,8 @@ var require_utils = __commonJS({
|
|
|
30168
30204
|
}
|
|
30169
30205
|
return output2;
|
|
30170
30206
|
};
|
|
30171
|
-
exports2.basename = (
|
|
30172
|
-
const segs =
|
|
30207
|
+
exports2.basename = (path67, { windows } = {}) => {
|
|
30208
|
+
const segs = path67.split(windows ? /[\\/]/ : "/");
|
|
30173
30209
|
const last = segs[segs.length - 1];
|
|
30174
30210
|
if (last === "") {
|
|
30175
30211
|
return segs[segs.length - 2];
|
|
@@ -30770,7 +30806,7 @@ var require_parse = __commonJS({
|
|
|
30770
30806
|
}
|
|
30771
30807
|
return { risky: false };
|
|
30772
30808
|
};
|
|
30773
|
-
var
|
|
30809
|
+
var parse5 = (input2, options) => {
|
|
30774
30810
|
if (typeof input2 !== "string") {
|
|
30775
30811
|
throw new TypeError("Expected a string");
|
|
30776
30812
|
}
|
|
@@ -30940,7 +30976,7 @@ var require_parse = __commonJS({
|
|
|
30940
30976
|
output2 = token.close = `)$))${extglobStar}`;
|
|
30941
30977
|
}
|
|
30942
30978
|
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
30943
|
-
const expression =
|
|
30979
|
+
const expression = parse5(rest, { ...options, fastpaths: false }).output;
|
|
30944
30980
|
output2 = token.close = `)${expression})${extglobStar})`;
|
|
30945
30981
|
}
|
|
30946
30982
|
if (token.prev.type === "bos") {
|
|
@@ -31463,7 +31499,7 @@ var require_parse = __commonJS({
|
|
|
31463
31499
|
}
|
|
31464
31500
|
return state;
|
|
31465
31501
|
};
|
|
31466
|
-
|
|
31502
|
+
parse5.fastpaths = (input2, options) => {
|
|
31467
31503
|
const opts = { ...options };
|
|
31468
31504
|
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
31469
31505
|
const len = input2.length;
|
|
@@ -31528,7 +31564,7 @@ var require_parse = __commonJS({
|
|
|
31528
31564
|
}
|
|
31529
31565
|
return source;
|
|
31530
31566
|
};
|
|
31531
|
-
module2.exports =
|
|
31567
|
+
module2.exports = parse5;
|
|
31532
31568
|
}
|
|
31533
31569
|
});
|
|
31534
31570
|
|
|
@@ -31537,7 +31573,7 @@ var require_picomatch = __commonJS({
|
|
|
31537
31573
|
"node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
|
|
31538
31574
|
"use strict";
|
|
31539
31575
|
var scan = require_scan();
|
|
31540
|
-
var
|
|
31576
|
+
var parse5 = require_parse();
|
|
31541
31577
|
var utils = require_utils();
|
|
31542
31578
|
var constants2 = require_constants();
|
|
31543
31579
|
var isObject5 = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
@@ -31625,7 +31661,7 @@ var require_picomatch = __commonJS({
|
|
|
31625
31661
|
picomatch4.isMatch = (str, patterns, options) => picomatch4(patterns, options)(str);
|
|
31626
31662
|
picomatch4.parse = (pattern, options) => {
|
|
31627
31663
|
if (Array.isArray(pattern)) return pattern.map((p) => picomatch4.parse(p, options));
|
|
31628
|
-
return
|
|
31664
|
+
return parse5(pattern, { ...options, fastpaths: false });
|
|
31629
31665
|
};
|
|
31630
31666
|
picomatch4.scan = (input2, options) => scan(input2, options);
|
|
31631
31667
|
picomatch4.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
@@ -31651,10 +31687,10 @@ var require_picomatch = __commonJS({
|
|
|
31651
31687
|
}
|
|
31652
31688
|
let parsed = { negated: false, fastpaths: true };
|
|
31653
31689
|
if (options.fastpaths !== false && (input2[0] === "." || input2[0] === "*")) {
|
|
31654
|
-
parsed.output =
|
|
31690
|
+
parsed.output = parse5.fastpaths(input2, options);
|
|
31655
31691
|
}
|
|
31656
31692
|
if (!parsed.output) {
|
|
31657
|
-
parsed =
|
|
31693
|
+
parsed = parse5(input2, options);
|
|
31658
31694
|
}
|
|
31659
31695
|
return picomatch4.compileRe(parsed, options, returnOutput, returnState);
|
|
31660
31696
|
};
|
|
@@ -31934,9 +31970,9 @@ var init_identity = __esm({
|
|
|
31934
31970
|
});
|
|
31935
31971
|
|
|
31936
31972
|
// src/statusline/keys.ts
|
|
31937
|
-
function valueAt(source,
|
|
31973
|
+
function valueAt(source, path67) {
|
|
31938
31974
|
let current = source;
|
|
31939
|
-
for (const part of
|
|
31975
|
+
for (const part of path67) {
|
|
31940
31976
|
if (!isPlainObject2(current)) {
|
|
31941
31977
|
return void 0;
|
|
31942
31978
|
}
|
|
@@ -31944,11 +31980,14 @@ function valueAt(source, path66) {
|
|
|
31944
31980
|
}
|
|
31945
31981
|
return current;
|
|
31946
31982
|
}
|
|
31947
|
-
function keyOf(
|
|
31948
|
-
const common = { path:
|
|
31983
|
+
function keyOf(path67, leaf) {
|
|
31984
|
+
const common = { path: path67.join("."), description: leaf.description ?? "", defaultValue: valueAt(STATUSLINE_DEFAULTS, path67) };
|
|
31949
31985
|
if (leaf instanceof external_exports.ZodNumber) {
|
|
31950
31986
|
return { ...common, kind: "integer", choices: [] };
|
|
31951
31987
|
}
|
|
31988
|
+
if (leaf instanceof external_exports.ZodBoolean) {
|
|
31989
|
+
return { ...common, kind: "boolean", choices: [] };
|
|
31990
|
+
}
|
|
31952
31991
|
if (leaf instanceof external_exports.ZodString) {
|
|
31953
31992
|
return { ...common, kind: "text", choices: [] };
|
|
31954
31993
|
}
|
|
@@ -31961,7 +32000,7 @@ function keyOf(path66, leaf) {
|
|
|
31961
32000
|
if (leaf instanceof external_exports.ZodArray && leaf.element instanceof external_exports.ZodEnum) {
|
|
31962
32001
|
return { ...common, kind: "list", choices: Object.values(leaf.element.enum).map(String) };
|
|
31963
32002
|
}
|
|
31964
|
-
throw new TypeError(`statusline setting ${
|
|
32003
|
+
throw new TypeError(`statusline setting ${path67.join(".")} has a kind the key listing does not describe`);
|
|
31965
32004
|
}
|
|
31966
32005
|
function walk(shape, prefix) {
|
|
31967
32006
|
return Object.entries(shape).flatMap(([name, schema]) => schema instanceof external_exports.ZodObject ? walk(schema.shape, [...prefix, name]) : [keyOf([...prefix, name], schema)]);
|
|
@@ -31985,10 +32024,10 @@ var init_keys = __esm({
|
|
|
31985
32024
|
});
|
|
31986
32025
|
|
|
31987
32026
|
// src/statusline/change.ts
|
|
31988
|
-
function keyNamed(
|
|
31989
|
-
const found = statuslineKeys().find((key) => key.path ===
|
|
32027
|
+
function keyNamed(path67) {
|
|
32028
|
+
const found = statuslineKeys().find((key) => key.path === path67);
|
|
31990
32029
|
if (found === void 0) {
|
|
31991
|
-
throw new UsageError(`"${
|
|
32030
|
+
throw new UsageError(`"${path67}" is not a statusline setting; \`agent-shim statusline keys\` lists them.`);
|
|
31992
32031
|
}
|
|
31993
32032
|
return found;
|
|
31994
32033
|
}
|
|
@@ -31997,30 +32036,35 @@ function parseStatuslineAssignment(text3) {
|
|
|
31997
32036
|
if (split < 1) {
|
|
31998
32037
|
throw new UsageError(`"${text3}" is not <setting>=<value>.`);
|
|
31999
32038
|
}
|
|
32000
|
-
const
|
|
32039
|
+
const path67 = text3.slice(0, split);
|
|
32001
32040
|
const raw = text3.slice(split + 1);
|
|
32002
|
-
const key = keyNamed(
|
|
32041
|
+
const key = keyNamed(path67);
|
|
32003
32042
|
switch (key.kind) {
|
|
32004
32043
|
case "integer": {
|
|
32005
32044
|
const number5 = Number(raw);
|
|
32006
32045
|
if (raw.trim() === "" || !Number.isFinite(number5)) {
|
|
32007
|
-
throw new UsageError(`${
|
|
32046
|
+
throw new UsageError(`${path67}: "${raw}" is not a number.`);
|
|
32008
32047
|
}
|
|
32009
|
-
return { path:
|
|
32048
|
+
return { path: path67, value: number5 };
|
|
32010
32049
|
}
|
|
32050
|
+
case "boolean":
|
|
32051
|
+
if (raw !== "true" && raw !== "false") {
|
|
32052
|
+
throw new UsageError(`${path67}: "${raw}" is not true or false.`);
|
|
32053
|
+
}
|
|
32054
|
+
return { path: path67, value: raw === "true" };
|
|
32011
32055
|
case "text":
|
|
32012
32056
|
case "choice":
|
|
32013
|
-
return { path:
|
|
32057
|
+
return { path: path67, value: raw };
|
|
32014
32058
|
case "colour":
|
|
32015
|
-
return { path:
|
|
32059
|
+
return { path: path67, value: /^\d+$/.test(raw) ? Number(raw) : raw };
|
|
32016
32060
|
case "list":
|
|
32017
|
-
return { path:
|
|
32061
|
+
return { path: path67, value: raw === "" ? [] : raw.split(",") };
|
|
32018
32062
|
default:
|
|
32019
32063
|
return key.kind;
|
|
32020
32064
|
}
|
|
32021
32065
|
}
|
|
32022
|
-
function setAt(target,
|
|
32023
|
-
const [head, ...rest] =
|
|
32066
|
+
function setAt(target, path67, value2) {
|
|
32067
|
+
const [head, ...rest] = path67;
|
|
32024
32068
|
if (head === void 0) {
|
|
32025
32069
|
return;
|
|
32026
32070
|
}
|
|
@@ -32033,8 +32077,8 @@ function setAt(target, path66, value2) {
|
|
|
32033
32077
|
target[head] = next;
|
|
32034
32078
|
setAt(next, rest, value2);
|
|
32035
32079
|
}
|
|
32036
|
-
function removeAt(target,
|
|
32037
|
-
const [head, ...rest] =
|
|
32080
|
+
function removeAt(target, path67) {
|
|
32081
|
+
const [head, ...rest] = path67;
|
|
32038
32082
|
if (head === void 0) {
|
|
32039
32083
|
return;
|
|
32040
32084
|
}
|
|
@@ -32052,13 +32096,13 @@ function removeAt(target, path66) {
|
|
|
32052
32096
|
}
|
|
32053
32097
|
function applyStatuslineChange(existing, change) {
|
|
32054
32098
|
const draft = structuredClone(existing ?? {});
|
|
32055
|
-
for (const [
|
|
32056
|
-
keyNamed(
|
|
32057
|
-
setAt(draft,
|
|
32099
|
+
for (const [path67, value2] of Object.entries(change.set ?? {})) {
|
|
32100
|
+
keyNamed(path67);
|
|
32101
|
+
setAt(draft, path67.split("."), value2);
|
|
32058
32102
|
}
|
|
32059
|
-
for (const
|
|
32060
|
-
keyNamed(
|
|
32061
|
-
removeAt(draft,
|
|
32103
|
+
for (const path67 of change.unset ?? []) {
|
|
32104
|
+
keyNamed(path67);
|
|
32105
|
+
removeAt(draft, path67.split("."));
|
|
32062
32106
|
}
|
|
32063
32107
|
const result = StatuslineSchema.safeParse(draft);
|
|
32064
32108
|
if (!result.success) {
|
|
@@ -35182,11 +35226,11 @@ function subjectNameOf(certificateDer) {
|
|
|
35182
35226
|
}
|
|
35183
35227
|
return Buffer.from(certificateDer.subarray(subject.start, subject.end));
|
|
35184
35228
|
}
|
|
35185
|
-
function toPem(
|
|
35229
|
+
function toPem(label2, der) {
|
|
35186
35230
|
const body = Buffer.from(der).toString("base64").match(/.{1,64}/g) ?? [];
|
|
35187
|
-
return `-----BEGIN ${
|
|
35231
|
+
return `-----BEGIN ${label2}-----
|
|
35188
35232
|
${body.join("\n")}
|
|
35189
|
-
-----END ${
|
|
35233
|
+
-----END ${label2}-----
|
|
35190
35234
|
`;
|
|
35191
35235
|
}
|
|
35192
35236
|
function randomSerial() {
|
|
@@ -35451,11 +35495,11 @@ function identifyRequest(headers) {
|
|
|
35451
35495
|
function directOrigin2(port) {
|
|
35452
35496
|
return `http://127.0.0.1:${String(port)}`;
|
|
35453
35497
|
}
|
|
35454
|
-
function parseProviderPath(
|
|
35455
|
-
if (!
|
|
35498
|
+
function parseProviderPath(path67) {
|
|
35499
|
+
if (!path67.startsWith(PROVIDER_PATH_PREFIX)) {
|
|
35456
35500
|
return void 0;
|
|
35457
35501
|
}
|
|
35458
|
-
const tail =
|
|
35502
|
+
const tail = path67.slice(PROVIDER_PATH_PREFIX.length);
|
|
35459
35503
|
const slash = tail.indexOf("/");
|
|
35460
35504
|
if (slash <= 0) {
|
|
35461
35505
|
return void 0;
|
|
@@ -35728,8 +35772,8 @@ function parseConnectTarget(authority) {
|
|
|
35728
35772
|
}
|
|
35729
35773
|
return { host, port };
|
|
35730
35774
|
}
|
|
35731
|
-
function servedByPipeline(
|
|
35732
|
-
return
|
|
35775
|
+
function servedByPipeline(path67) {
|
|
35776
|
+
return path67?.startsWith(ROUTED_PATH_PREFIX) === true;
|
|
35733
35777
|
}
|
|
35734
35778
|
function forwardableHeaders(headers) {
|
|
35735
35779
|
const connectionTokens = new Set(
|
|
@@ -36207,7 +36251,7 @@ var init_package = __esm({
|
|
|
36207
36251
|
"package.json"() {
|
|
36208
36252
|
package_default = {
|
|
36209
36253
|
name: "claude-use",
|
|
36210
|
-
version: "11.
|
|
36254
|
+
version: "11.53.0",
|
|
36211
36255
|
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.",
|
|
36212
36256
|
license: "MIT",
|
|
36213
36257
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -36729,12 +36773,12 @@ function decoderFor(encoding) {
|
|
|
36729
36773
|
return void 0;
|
|
36730
36774
|
}
|
|
36731
36775
|
}
|
|
36732
|
-
function destinationOf(
|
|
36733
|
-
const scoped = parseProviderPath(
|
|
36776
|
+
function destinationOf(path67, sessionProvider) {
|
|
36777
|
+
const scoped = parseProviderPath(path67);
|
|
36734
36778
|
if (scoped !== void 0) {
|
|
36735
36779
|
return { provider: scoped.provider, endpoint: scoped.rest };
|
|
36736
36780
|
}
|
|
36737
|
-
return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint:
|
|
36781
|
+
return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint: path67 };
|
|
36738
36782
|
}
|
|
36739
36783
|
function modelChoiceOf(event, servedModel, provider) {
|
|
36740
36784
|
if (event.modelChoice !== void 0) return event.modelChoice;
|
|
@@ -36968,13 +37012,13 @@ function windowRatio(records) {
|
|
|
36968
37012
|
function percent(fraction) {
|
|
36969
37013
|
return `${String(Math.round(fraction * PERCENT))}%`;
|
|
36970
37014
|
}
|
|
36971
|
-
function describeWindow(
|
|
37015
|
+
function describeWindow(label2, window, effective, nowMs) {
|
|
36972
37016
|
if (effective.reset) {
|
|
36973
|
-
return `${
|
|
37017
|
+
return `${label2} window has reset`;
|
|
36974
37018
|
}
|
|
36975
37019
|
const used = effective.utilization === void 0 ? "usage unknown" : `${percent(effective.utilization)} used`;
|
|
36976
37020
|
const resets = effective.resetsAtMs === void 0 ? "" : `, resets in ${formatAge(effective.resetsAtMs - nowMs)}`;
|
|
36977
|
-
return `${
|
|
37021
|
+
return `${label2} ${used}${resets}${window.status === "allowed_warning" ? " (nearly used)" : ""}`;
|
|
36978
37022
|
}
|
|
36979
37023
|
function capacityOf(plan) {
|
|
36980
37024
|
return plan.kind === "subscription" ? plan.capacity : 1;
|
|
@@ -39704,14 +39748,14 @@ var require_util2 = __commonJS({
|
|
|
39704
39748
|
}
|
|
39705
39749
|
const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
|
|
39706
39750
|
let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
|
|
39707
|
-
let
|
|
39751
|
+
let path67 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
|
|
39708
39752
|
if (origin[origin.length - 1] === "/") {
|
|
39709
39753
|
origin = origin.slice(0, origin.length - 1);
|
|
39710
39754
|
}
|
|
39711
|
-
if (
|
|
39712
|
-
|
|
39755
|
+
if (path67 && path67[0] !== "/") {
|
|
39756
|
+
path67 = `/${path67}`;
|
|
39713
39757
|
}
|
|
39714
|
-
return new URL(`${origin}${
|
|
39758
|
+
return new URL(`${origin}${path67}`);
|
|
39715
39759
|
}
|
|
39716
39760
|
if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
|
|
39717
39761
|
throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -40532,9 +40576,9 @@ var require_diagnostics = __commonJS({
|
|
|
40532
40576
|
"undici:client:sendHeaders",
|
|
40533
40577
|
(evt) => {
|
|
40534
40578
|
const {
|
|
40535
|
-
request: { method, path:
|
|
40579
|
+
request: { method, path: path67, origin }
|
|
40536
40580
|
} = evt;
|
|
40537
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
40581
|
+
debugLog("sending request to %s %s%s", method, origin, path67);
|
|
40538
40582
|
}
|
|
40539
40583
|
);
|
|
40540
40584
|
}
|
|
@@ -40552,14 +40596,14 @@ var require_diagnostics = __commonJS({
|
|
|
40552
40596
|
"undici:request:headers",
|
|
40553
40597
|
(evt) => {
|
|
40554
40598
|
const {
|
|
40555
|
-
request: { method, path:
|
|
40599
|
+
request: { method, path: path67, origin },
|
|
40556
40600
|
response: { statusCode }
|
|
40557
40601
|
} = evt;
|
|
40558
40602
|
debugLog(
|
|
40559
40603
|
"received response to %s %s%s - HTTP %d",
|
|
40560
40604
|
method,
|
|
40561
40605
|
origin,
|
|
40562
|
-
|
|
40606
|
+
path67,
|
|
40563
40607
|
statusCode
|
|
40564
40608
|
);
|
|
40565
40609
|
}
|
|
@@ -40568,23 +40612,23 @@ var require_diagnostics = __commonJS({
|
|
|
40568
40612
|
"undici:request:trailers",
|
|
40569
40613
|
(evt) => {
|
|
40570
40614
|
const {
|
|
40571
|
-
request: { method, path:
|
|
40615
|
+
request: { method, path: path67, origin }
|
|
40572
40616
|
} = evt;
|
|
40573
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
40617
|
+
debugLog("trailers received from %s %s%s", method, origin, path67);
|
|
40574
40618
|
}
|
|
40575
40619
|
);
|
|
40576
40620
|
diagnosticsChannel.subscribe(
|
|
40577
40621
|
"undici:request:error",
|
|
40578
40622
|
(evt) => {
|
|
40579
40623
|
const {
|
|
40580
|
-
request: { method, path:
|
|
40624
|
+
request: { method, path: path67, origin },
|
|
40581
40625
|
error: error63
|
|
40582
40626
|
} = evt;
|
|
40583
40627
|
debugLog(
|
|
40584
40628
|
"request to %s %s%s errored - %s",
|
|
40585
40629
|
method,
|
|
40586
40630
|
origin,
|
|
40587
|
-
|
|
40631
|
+
path67,
|
|
40588
40632
|
error63.message
|
|
40589
40633
|
);
|
|
40590
40634
|
}
|
|
@@ -40699,7 +40743,7 @@ var require_request = __commonJS({
|
|
|
40699
40743
|
var kHandler = /* @__PURE__ */ Symbol("handler");
|
|
40700
40744
|
var Request2 = class {
|
|
40701
40745
|
constructor(origin, {
|
|
40702
|
-
path:
|
|
40746
|
+
path: path67,
|
|
40703
40747
|
method,
|
|
40704
40748
|
body,
|
|
40705
40749
|
headers,
|
|
@@ -40716,11 +40760,11 @@ var require_request = __commonJS({
|
|
|
40716
40760
|
maxRedirections,
|
|
40717
40761
|
typeOfService
|
|
40718
40762
|
}, handler) {
|
|
40719
|
-
if (typeof
|
|
40763
|
+
if (typeof path67 !== "string") {
|
|
40720
40764
|
throw new InvalidArgumentError2("path must be a string");
|
|
40721
|
-
} else if (
|
|
40765
|
+
} else if (path67[0] !== "/" && !(path67.startsWith("http://") || path67.startsWith("https://")) && method !== "CONNECT") {
|
|
40722
40766
|
throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
|
|
40723
|
-
} else if (invalidPathRegex.test(
|
|
40767
|
+
} else if (invalidPathRegex.test(path67)) {
|
|
40724
40768
|
throw new InvalidArgumentError2("invalid request path");
|
|
40725
40769
|
}
|
|
40726
40770
|
if (typeof method !== "string") {
|
|
@@ -40795,7 +40839,7 @@ var require_request = __commonJS({
|
|
|
40795
40839
|
this.completed = false;
|
|
40796
40840
|
this.aborted = false;
|
|
40797
40841
|
this.upgrade = upgrade || null;
|
|
40798
|
-
this.path = query ? serializePathWithQuery(
|
|
40842
|
+
this.path = query ? serializePathWithQuery(path67, query) : path67;
|
|
40799
40843
|
this.origin = origin;
|
|
40800
40844
|
this.protocol = getProtocolFromUrlString(origin);
|
|
40801
40845
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -45977,7 +46021,7 @@ var require_client_h1 = __commonJS({
|
|
|
45977
46021
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
45978
46022
|
}
|
|
45979
46023
|
function writeH1(client, request7) {
|
|
45980
|
-
const { method, path:
|
|
46024
|
+
const { method, path: path67, host, upgrade, blocking, reset } = request7;
|
|
45981
46025
|
let { body, headers, contentLength } = request7;
|
|
45982
46026
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
45983
46027
|
if (util2.isFormDataLike(body)) {
|
|
@@ -46055,7 +46099,7 @@ var require_client_h1 = __commonJS({
|
|
|
46055
46099
|
if (socket.setTypeOfService) {
|
|
46056
46100
|
socket.setTypeOfService(request7.typeOfService);
|
|
46057
46101
|
}
|
|
46058
|
-
let header = `${method} ${
|
|
46102
|
+
let header = `${method} ${path67} HTTP/1.1\r
|
|
46059
46103
|
`;
|
|
46060
46104
|
if (typeof host === "string") {
|
|
46061
46105
|
header += `host: ${host}\r
|
|
@@ -46734,7 +46778,7 @@ var require_client_h2 = __commonJS({
|
|
|
46734
46778
|
const headersTimeout = request7.headersTimeout ?? client[kHeadersTimeout];
|
|
46735
46779
|
const bodyTimeout = request7.bodyTimeout ?? client[kBodyTimeout];
|
|
46736
46780
|
const session = client[kHTTP2Session];
|
|
46737
|
-
const { method, path:
|
|
46781
|
+
const { method, path: path67, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
|
|
46738
46782
|
let { body } = request7;
|
|
46739
46783
|
if (upgrade != null && upgrade !== "websocket") {
|
|
46740
46784
|
util2.errorRequest(client, request7, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
@@ -46803,7 +46847,7 @@ var require_client_h2 = __commonJS({
|
|
|
46803
46847
|
}
|
|
46804
46848
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
46805
46849
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
46806
|
-
headers[HTTP2_HEADER_PATH] =
|
|
46850
|
+
headers[HTTP2_HEADER_PATH] = path67;
|
|
46807
46851
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
46808
46852
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
46809
46853
|
} else {
|
|
@@ -46845,7 +46889,7 @@ var require_client_h2 = __commonJS({
|
|
|
46845
46889
|
stream.setTimeout(headersTimeout);
|
|
46846
46890
|
return true;
|
|
46847
46891
|
}
|
|
46848
|
-
headers[HTTP2_HEADER_PATH] =
|
|
46892
|
+
headers[HTTP2_HEADER_PATH] = path67;
|
|
46849
46893
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
46850
46894
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
46851
46895
|
if (body && typeof body.read === "function") {
|
|
@@ -49197,10 +49241,10 @@ var require_proxy_agent = __commonJS({
|
|
|
49197
49241
|
};
|
|
49198
49242
|
const {
|
|
49199
49243
|
origin,
|
|
49200
|
-
path:
|
|
49244
|
+
path: path67 = "/",
|
|
49201
49245
|
headers = {}
|
|
49202
49246
|
} = opts;
|
|
49203
|
-
opts.path = origin +
|
|
49247
|
+
opts.path = origin + path67;
|
|
49204
49248
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
49205
49249
|
const { host } = new URL(origin);
|
|
49206
49250
|
headers.host = host;
|
|
@@ -51309,20 +51353,20 @@ var require_mock_utils = __commonJS({
|
|
|
51309
51353
|
}
|
|
51310
51354
|
return normalizedQp;
|
|
51311
51355
|
}
|
|
51312
|
-
function safeUrl(
|
|
51313
|
-
if (typeof
|
|
51314
|
-
return
|
|
51356
|
+
function safeUrl(path67) {
|
|
51357
|
+
if (typeof path67 !== "string") {
|
|
51358
|
+
return path67;
|
|
51315
51359
|
}
|
|
51316
|
-
const pathSegments =
|
|
51360
|
+
const pathSegments = path67.split("?", 3);
|
|
51317
51361
|
if (pathSegments.length !== 2) {
|
|
51318
|
-
return
|
|
51362
|
+
return path67;
|
|
51319
51363
|
}
|
|
51320
51364
|
const qp2 = new URLSearchParams(pathSegments.pop());
|
|
51321
51365
|
qp2.sort();
|
|
51322
51366
|
return [...pathSegments, qp2.toString()].join("?");
|
|
51323
51367
|
}
|
|
51324
|
-
function matchKey(mockDispatch2, { path:
|
|
51325
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
51368
|
+
function matchKey(mockDispatch2, { path: path67, method, body, headers }) {
|
|
51369
|
+
const pathMatch = matchValue(mockDispatch2.path, path67);
|
|
51326
51370
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
51327
51371
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
51328
51372
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -51347,8 +51391,8 @@ var require_mock_utils = __commonJS({
|
|
|
51347
51391
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
51348
51392
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
51349
51393
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
51350
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
51351
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
51394
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path67, ignoreTrailingSlash }) => {
|
|
51395
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path67)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path67), resolvedPath);
|
|
51352
51396
|
});
|
|
51353
51397
|
if (matchedMockDispatches.length === 0) {
|
|
51354
51398
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -51387,19 +51431,19 @@ var require_mock_utils = __commonJS({
|
|
|
51387
51431
|
mockDispatches.splice(index, 1);
|
|
51388
51432
|
}
|
|
51389
51433
|
}
|
|
51390
|
-
function removeTrailingSlash(
|
|
51391
|
-
while (
|
|
51392
|
-
|
|
51434
|
+
function removeTrailingSlash(path67) {
|
|
51435
|
+
while (path67.endsWith("/")) {
|
|
51436
|
+
path67 = path67.slice(0, -1);
|
|
51393
51437
|
}
|
|
51394
|
-
if (
|
|
51395
|
-
|
|
51438
|
+
if (path67.length === 0) {
|
|
51439
|
+
path67 = "/";
|
|
51396
51440
|
}
|
|
51397
|
-
return
|
|
51441
|
+
return path67;
|
|
51398
51442
|
}
|
|
51399
51443
|
function buildKey(opts) {
|
|
51400
|
-
const { path:
|
|
51444
|
+
const { path: path67, method, body, headers, query } = opts;
|
|
51401
51445
|
return {
|
|
51402
|
-
path:
|
|
51446
|
+
path: path67,
|
|
51403
51447
|
method,
|
|
51404
51448
|
body,
|
|
51405
51449
|
headers,
|
|
@@ -52089,10 +52133,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
52089
52133
|
}
|
|
52090
52134
|
format(pendingInterceptors) {
|
|
52091
52135
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
52092
|
-
({ method, path:
|
|
52136
|
+
({ method, path: path67, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
52093
52137
|
Method: method,
|
|
52094
52138
|
Origin: origin,
|
|
52095
|
-
Path:
|
|
52139
|
+
Path: path67,
|
|
52096
52140
|
"Status code": statusCode,
|
|
52097
52141
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
52098
52142
|
Invocations: timesInvoked,
|
|
@@ -52174,9 +52218,9 @@ var require_mock_agent = __commonJS({
|
|
|
52174
52218
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
52175
52219
|
const dispatchOpts = { ...opts };
|
|
52176
52220
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
52177
|
-
const [
|
|
52221
|
+
const [path67, searchParams] = dispatchOpts.path.split("?");
|
|
52178
52222
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
52179
|
-
dispatchOpts.path = `${
|
|
52223
|
+
dispatchOpts.path = `${path67}?${normalizedSearchParams}`;
|
|
52180
52224
|
}
|
|
52181
52225
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
52182
52226
|
}
|
|
@@ -52577,12 +52621,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
52577
52621
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
52578
52622
|
*/
|
|
52579
52623
|
async loadSnapshots(filePath) {
|
|
52580
|
-
const
|
|
52581
|
-
if (!
|
|
52624
|
+
const path67 = filePath || this.#snapshotPath;
|
|
52625
|
+
if (!path67) {
|
|
52582
52626
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
52583
52627
|
}
|
|
52584
52628
|
try {
|
|
52585
|
-
const data = await readFile(resolve2(
|
|
52629
|
+
const data = await readFile(resolve2(path67), "utf8");
|
|
52586
52630
|
const parsed = JSON.parse(data);
|
|
52587
52631
|
if (Array.isArray(parsed)) {
|
|
52588
52632
|
this.#snapshots.clear();
|
|
@@ -52596,7 +52640,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
52596
52640
|
if (error63.code === "ENOENT") {
|
|
52597
52641
|
this.#snapshots.clear();
|
|
52598
52642
|
} else {
|
|
52599
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
52643
|
+
throw new UndiciError(`Failed to load snapshots from ${path67}`, { cause: error63 });
|
|
52600
52644
|
}
|
|
52601
52645
|
}
|
|
52602
52646
|
}
|
|
@@ -52607,11 +52651,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
52607
52651
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
52608
52652
|
*/
|
|
52609
52653
|
async saveSnapshots(filePath) {
|
|
52610
|
-
const
|
|
52611
|
-
if (!
|
|
52654
|
+
const path67 = filePath || this.#snapshotPath;
|
|
52655
|
+
if (!path67) {
|
|
52612
52656
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
52613
52657
|
}
|
|
52614
|
-
const resolvedPath = resolve2(
|
|
52658
|
+
const resolvedPath = resolve2(path67);
|
|
52615
52659
|
await mkdir(dirname3(resolvedPath), { recursive: true });
|
|
52616
52660
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
52617
52661
|
hash: hash2,
|
|
@@ -53243,15 +53287,15 @@ var require_redirect_handler = __commonJS({
|
|
|
53243
53287
|
return;
|
|
53244
53288
|
}
|
|
53245
53289
|
const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
53246
|
-
const
|
|
53247
|
-
const redirectUrlString = `${origin}${
|
|
53290
|
+
const path67 = search ? `${pathname}${search}` : pathname;
|
|
53291
|
+
const redirectUrlString = `${origin}${path67}`;
|
|
53248
53292
|
for (const historyUrl of this.history) {
|
|
53249
53293
|
if (historyUrl.toString() === redirectUrlString) {
|
|
53250
53294
|
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.`);
|
|
53251
53295
|
}
|
|
53252
53296
|
}
|
|
53253
53297
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
53254
|
-
this.opts.path =
|
|
53298
|
+
this.opts.path = path67;
|
|
53255
53299
|
this.opts.origin = origin;
|
|
53256
53300
|
this.opts.query = null;
|
|
53257
53301
|
}
|
|
@@ -55011,10 +55055,10 @@ var require_cache_handler = __commonJS({
|
|
|
55011
55055
|
}
|
|
55012
55056
|
return locationUrl.pathname + locationUrl.search;
|
|
55013
55057
|
}
|
|
55014
|
-
function deleteCachedUri(store, cacheKey,
|
|
55058
|
+
function deleteCachedUri(store, cacheKey, path67) {
|
|
55015
55059
|
deleteCachedValue(store, {
|
|
55016
55060
|
...cacheKey,
|
|
55017
|
-
path:
|
|
55061
|
+
path: path67
|
|
55018
55062
|
});
|
|
55019
55063
|
for (let i10 = 0; i10 < util2.safeHTTPMethods.length; i10++) {
|
|
55020
55064
|
const method = util2.safeHTTPMethods[i10];
|
|
@@ -55022,7 +55066,7 @@ var require_cache_handler = __commonJS({
|
|
|
55022
55066
|
deleteCachedValue(store, {
|
|
55023
55067
|
...cacheKey,
|
|
55024
55068
|
method,
|
|
55025
|
-
path:
|
|
55069
|
+
path: path67
|
|
55026
55070
|
});
|
|
55027
55071
|
}
|
|
55028
55072
|
}
|
|
@@ -55033,9 +55077,9 @@ var require_cache_handler = __commonJS({
|
|
|
55033
55077
|
}
|
|
55034
55078
|
const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
|
|
55035
55079
|
for (let i10 = 0; i10 < values.length; i10++) {
|
|
55036
|
-
const
|
|
55037
|
-
if (
|
|
55038
|
-
deleteCachedUri(store, cacheKey,
|
|
55080
|
+
const path67 = getSameOriginPath(cacheKey, values[i10]);
|
|
55081
|
+
if (path67 !== void 0) {
|
|
55082
|
+
deleteCachedUri(store, cacheKey, path67);
|
|
55039
55083
|
}
|
|
55040
55084
|
}
|
|
55041
55085
|
}
|
|
@@ -60035,11 +60079,11 @@ var require_fetch = __commonJS({
|
|
|
60035
60079
|
function dispatch({ body }) {
|
|
60036
60080
|
const url2 = requestCurrentURL(request7);
|
|
60037
60081
|
const agent = fetchParams.controller.dispatcher;
|
|
60038
|
-
const
|
|
60082
|
+
const path67 = url2.pathname + url2.search;
|
|
60039
60083
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
60040
60084
|
return new Promise((resolve2, reject) => agent.dispatch(
|
|
60041
60085
|
{
|
|
60042
|
-
path: hasTrailingQuestionMark ? `${
|
|
60086
|
+
path: hasTrailingQuestionMark ? `${path67}?` : path67,
|
|
60043
60087
|
origin: url2.origin,
|
|
60044
60088
|
method: request7.method,
|
|
60045
60089
|
body: agent.isMockActive ? request7.body && (request7.body.source || request7.body.stream) : body,
|
|
@@ -60986,9 +61030,9 @@ var require_util5 = __commonJS({
|
|
|
60986
61030
|
}
|
|
60987
61031
|
}
|
|
60988
61032
|
}
|
|
60989
|
-
function validateCookiePath(
|
|
60990
|
-
for (let i10 = 0; i10 <
|
|
60991
|
-
const code =
|
|
61033
|
+
function validateCookiePath(path67) {
|
|
61034
|
+
for (let i10 = 0; i10 < path67.length; ++i10) {
|
|
61035
|
+
const code = path67.charCodeAt(i10);
|
|
60992
61036
|
if (code < 32 || // exclude CTLs (0-31)
|
|
60993
61037
|
code > 126 || // exclude DEL and non-ascii
|
|
60994
61038
|
code === 59) {
|
|
@@ -64336,11 +64380,11 @@ var require_undici = __commonJS({
|
|
|
64336
64380
|
if (typeof opts.path !== "string") {
|
|
64337
64381
|
throw new InvalidArgumentError2("invalid opts.path");
|
|
64338
64382
|
}
|
|
64339
|
-
let
|
|
64383
|
+
let path67 = opts.path;
|
|
64340
64384
|
if (!opts.path.startsWith("/")) {
|
|
64341
|
-
|
|
64385
|
+
path67 = `/${path67}`;
|
|
64342
64386
|
}
|
|
64343
|
-
url2 = new URL(util2.parseOrigin(url2).origin +
|
|
64387
|
+
url2 = new URL(util2.parseOrigin(url2).origin + path67);
|
|
64344
64388
|
} else {
|
|
64345
64389
|
if (!opts) {
|
|
64346
64390
|
opts = typeof url2 === "object" ? url2 : {};
|
|
@@ -64881,15 +64925,15 @@ var init_realFrontDoorPort = __esm({
|
|
|
64881
64925
|
|
|
64882
64926
|
// src/update/update.ts
|
|
64883
64927
|
function compareVersions3(left, right) {
|
|
64884
|
-
const
|
|
64928
|
+
const parse5 = (version2) => {
|
|
64885
64929
|
const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version2);
|
|
64886
64930
|
if (match === null) {
|
|
64887
64931
|
throw new Error(`not a plain release version: ${version2}`);
|
|
64888
64932
|
}
|
|
64889
64933
|
return [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
64890
64934
|
};
|
|
64891
|
-
const leftParts =
|
|
64892
|
-
const rightParts =
|
|
64935
|
+
const leftParts = parse5(left);
|
|
64936
|
+
const rightParts = parse5(right);
|
|
64893
64937
|
return leftParts.map((part, index) => part - (rightParts[index] ?? 0)).find((difference) => difference !== 0) ?? 0;
|
|
64894
64938
|
}
|
|
64895
64939
|
function releaseTagFromUrl(url2) {
|
|
@@ -65441,9 +65485,9 @@ function toEntries(pairs) {
|
|
|
65441
65485
|
}
|
|
65442
65486
|
return pairs;
|
|
65443
65487
|
}
|
|
65444
|
-
function parseOverride(source, raw,
|
|
65488
|
+
function parseOverride(source, raw, parse5) {
|
|
65445
65489
|
try {
|
|
65446
|
-
return
|
|
65490
|
+
return parse5(raw);
|
|
65447
65491
|
} catch (error63) {
|
|
65448
65492
|
if (error63 instanceof Error && !(error63 instanceof CliError)) {
|
|
65449
65493
|
throw new UsageError(`Invalid ${source} value "${raw}": ${error63.message}.`);
|
|
@@ -66376,9 +66420,9 @@ function findBucket(quota, keys) {
|
|
|
66376
66420
|
return void 0;
|
|
66377
66421
|
}
|
|
66378
66422
|
function antigravityFamilyBuckets(quota) {
|
|
66379
|
-
return QUOTA_FAMILY_WINDOWS.flatMap(({ label, keys }) => {
|
|
66423
|
+
return QUOTA_FAMILY_WINDOWS.flatMap(({ label: label2, keys }) => {
|
|
66380
66424
|
const bucket = findBucket(quota, keys);
|
|
66381
|
-
return bucket === void 0 ? [] : [{ label, bucket }];
|
|
66425
|
+
return bucket === void 0 ? [] : [{ label: label2, bucket }];
|
|
66382
66426
|
});
|
|
66383
66427
|
}
|
|
66384
66428
|
function selectAntigravityBuckets(quota, model) {
|
|
@@ -67243,8 +67287,8 @@ function modelOf2(entry) {
|
|
|
67243
67287
|
if (!isRecord9(entry) || typeof entry.id !== "string" || entry.id.trim() === "") {
|
|
67244
67288
|
return void 0;
|
|
67245
67289
|
}
|
|
67246
|
-
const
|
|
67247
|
-
const name =
|
|
67290
|
+
const label2 = typeof entry.display_name === "string" ? entry.display_name : typeof entry.name === "string" ? entry.name : void 0;
|
|
67291
|
+
const name = label2?.trim();
|
|
67248
67292
|
return name === void 0 || name === "" ? { id: entry.id.trim() } : { id: entry.id.trim(), name };
|
|
67249
67293
|
}
|
|
67250
67294
|
function parseCatalogueBody(body) {
|
|
@@ -102794,9 +102838,9 @@ var require_codegen = __commonJS({
|
|
|
102794
102838
|
}
|
|
102795
102839
|
};
|
|
102796
102840
|
var Label = class extends Node {
|
|
102797
|
-
constructor(
|
|
102841
|
+
constructor(label2) {
|
|
102798
102842
|
super();
|
|
102799
|
-
this.label =
|
|
102843
|
+
this.label = label2;
|
|
102800
102844
|
this.names = {};
|
|
102801
102845
|
}
|
|
102802
102846
|
render({ _n }) {
|
|
@@ -102804,14 +102848,14 @@ var require_codegen = __commonJS({
|
|
|
102804
102848
|
}
|
|
102805
102849
|
};
|
|
102806
102850
|
var Break = class extends Node {
|
|
102807
|
-
constructor(
|
|
102851
|
+
constructor(label2) {
|
|
102808
102852
|
super();
|
|
102809
|
-
this.label =
|
|
102853
|
+
this.label = label2;
|
|
102810
102854
|
this.names = {};
|
|
102811
102855
|
}
|
|
102812
102856
|
render({ _n }) {
|
|
102813
|
-
const
|
|
102814
|
-
return `break${
|
|
102857
|
+
const label2 = this.label ? ` ${this.label}` : "";
|
|
102858
|
+
return `break${label2};` + _n;
|
|
102815
102859
|
}
|
|
102816
102860
|
};
|
|
102817
102861
|
var Throw = class extends Node {
|
|
@@ -103223,12 +103267,12 @@ var require_codegen = __commonJS({
|
|
|
103223
103267
|
return this._endBlockNode(For);
|
|
103224
103268
|
}
|
|
103225
103269
|
// `label` statement
|
|
103226
|
-
label(
|
|
103227
|
-
return this._leafNode(new Label(
|
|
103270
|
+
label(label2) {
|
|
103271
|
+
return this._leafNode(new Label(label2));
|
|
103228
103272
|
}
|
|
103229
103273
|
// `break` statement
|
|
103230
|
-
break(
|
|
103231
|
-
return this._leafNode(new Break(
|
|
103274
|
+
break(label2) {
|
|
103275
|
+
return this._leafNode(new Break(label2));
|
|
103232
103276
|
}
|
|
103233
103277
|
// `return` statement
|
|
103234
103278
|
return(value2) {
|
|
@@ -105604,8 +105648,8 @@ var require_utils3 = __commonJS({
|
|
|
105604
105648
|
}
|
|
105605
105649
|
return ind;
|
|
105606
105650
|
}
|
|
105607
|
-
function removeDotSegments(
|
|
105608
|
-
let input2 =
|
|
105651
|
+
function removeDotSegments(path67) {
|
|
105652
|
+
let input2 = path67;
|
|
105609
105653
|
const output2 = [];
|
|
105610
105654
|
let nextSlash = -1;
|
|
105611
105655
|
let len = 0;
|
|
@@ -106014,8 +106058,8 @@ var require_schemes = __commonJS({
|
|
|
106014
106058
|
}
|
|
106015
106059
|
if (wsComponent.resourceName) {
|
|
106016
106060
|
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
106017
|
-
const
|
|
106018
|
-
wsComponent.path =
|
|
106061
|
+
const path67 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
106062
|
+
wsComponent.path = path67 && path67 !== "/" ? path67 : void 0;
|
|
106019
106063
|
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
106020
106064
|
wsComponent.resourceName = void 0;
|
|
106021
106065
|
}
|
|
@@ -106179,7 +106223,7 @@ var require_fast_uri = __commonJS({
|
|
|
106179
106223
|
normalizeString(uri, options);
|
|
106180
106224
|
} else if (typeof uri === "object") {
|
|
106181
106225
|
uri = /** @type {T} */
|
|
106182
|
-
|
|
106226
|
+
parse5(serialize(uri, options), options);
|
|
106183
106227
|
}
|
|
106184
106228
|
return uri;
|
|
106185
106229
|
}
|
|
@@ -106219,8 +106263,8 @@ var require_fast_uri = __commonJS({
|
|
|
106219
106263
|
function resolveComponent(base, relative, options, skipNormalization) {
|
|
106220
106264
|
const target = {};
|
|
106221
106265
|
if (!skipNormalization) {
|
|
106222
|
-
base =
|
|
106223
|
-
relative =
|
|
106266
|
+
base = parse5(serialize(base, options), options);
|
|
106267
|
+
relative = parse5(serialize(relative, options), options);
|
|
106224
106268
|
}
|
|
106225
106269
|
options = options || {};
|
|
106226
106270
|
if (!options.tolerant && relative.scheme) {
|
|
@@ -106519,7 +106563,7 @@ var require_fast_uri = __commonJS({
|
|
|
106519
106563
|
}
|
|
106520
106564
|
return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
|
|
106521
106565
|
}
|
|
106522
|
-
function
|
|
106566
|
+
function parse5(uri, opts) {
|
|
106523
106567
|
return parseWithStatus(uri, opts).parsed;
|
|
106524
106568
|
}
|
|
106525
106569
|
function normalizeString(uri, opts) {
|
|
@@ -106556,7 +106600,7 @@ var require_fast_uri = __commonJS({
|
|
|
106556
106600
|
resolveComponent,
|
|
106557
106601
|
equal,
|
|
106558
106602
|
serialize,
|
|
106559
|
-
parse:
|
|
106603
|
+
parse: parse5
|
|
106560
106604
|
};
|
|
106561
106605
|
module2.exports = fastUri;
|
|
106562
106606
|
module2.exports.default = fastUri;
|
|
@@ -109542,7 +109586,7 @@ var require_dist2 = __commonJS({
|
|
|
109542
109586
|
});
|
|
109543
109587
|
|
|
109544
109588
|
// src/cli.ts
|
|
109545
|
-
var
|
|
109589
|
+
var import_node_path66 = __toESM(require("node:path"), 1);
|
|
109546
109590
|
|
|
109547
109591
|
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
|
|
109548
109592
|
var CommanderError = class extends Error {
|
|
@@ -112655,9 +112699,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
112655
112699
|
* @param {string} [path]
|
|
112656
112700
|
* @return {(string|null|Command)}
|
|
112657
112701
|
*/
|
|
112658
|
-
executableDir(
|
|
112659
|
-
if (
|
|
112660
|
-
this._executableDir =
|
|
112702
|
+
executableDir(path67) {
|
|
112703
|
+
if (path67 === void 0) return this._executableDir;
|
|
112704
|
+
this._executableDir = path67;
|
|
112661
112705
|
return this;
|
|
112662
112706
|
}
|
|
112663
112707
|
/**
|
|
@@ -114133,19 +114177,19 @@ function writePools(paths, pools) {
|
|
|
114133
114177
|
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
|
|
114134
114178
|
}
|
|
114135
114179
|
function poolCycleOf(pools, name) {
|
|
114136
|
-
const walk3 = (current,
|
|
114180
|
+
const walk3 = (current, path67) => {
|
|
114137
114181
|
for (const entry of pools[current]?.identities ?? []) {
|
|
114138
114182
|
const nested = poolNameOf(poolMemberIdentity(entry));
|
|
114139
114183
|
if (nested === void 0) {
|
|
114140
114184
|
continue;
|
|
114141
114185
|
}
|
|
114142
114186
|
if (nested === name) {
|
|
114143
|
-
return [...
|
|
114187
|
+
return [...path67, nested];
|
|
114144
114188
|
}
|
|
114145
|
-
if (
|
|
114189
|
+
if (path67.includes(nested)) {
|
|
114146
114190
|
continue;
|
|
114147
114191
|
}
|
|
114148
|
-
const found = walk3(nested, [...
|
|
114192
|
+
const found = walk3(nested, [...path67, nested]);
|
|
114149
114193
|
if (found !== void 0) {
|
|
114150
114194
|
return found;
|
|
114151
114195
|
}
|
|
@@ -115213,9 +115257,9 @@ function machineTimeZone() {
|
|
|
115213
115257
|
// src/cli/parsers.ts
|
|
115214
115258
|
init_conditions();
|
|
115215
115259
|
init_pairs();
|
|
115216
|
-
function asInvalidArgument(
|
|
115260
|
+
function asInvalidArgument(parse5) {
|
|
115217
115261
|
try {
|
|
115218
|
-
return
|
|
115262
|
+
return parse5();
|
|
115219
115263
|
} catch (error63) {
|
|
115220
115264
|
if (error63 instanceof Error && !(error63 instanceof InvalidArgumentError)) {
|
|
115221
115265
|
throw new InvalidArgumentError(error63.message);
|
|
@@ -115346,7 +115390,7 @@ function statuslineChangeOf(options) {
|
|
|
115346
115390
|
return void 0;
|
|
115347
115391
|
}
|
|
115348
115392
|
const assignments = (options.statusline ?? []).map(parseStatuslineAssignment);
|
|
115349
|
-
return { set: Object.fromEntries(assignments.map(({ path:
|
|
115393
|
+
return { set: Object.fromEntries(assignments.map(({ path: path67, value: value2 }) => [path67, value2])), unset: options.unsetStatusline ?? [] };
|
|
115350
115394
|
}
|
|
115351
115395
|
function registerProfileCommand(program2, deps) {
|
|
115352
115396
|
const { paths } = deps;
|
|
@@ -115449,13 +115493,13 @@ function registerProfileCommand(program2, deps) {
|
|
|
115449
115493
|
console.log(`Description: ${found.description}`);
|
|
115450
115494
|
}
|
|
115451
115495
|
console.log(`Extends: ${found.extends === void 0 || found.extends.length === 0 ? "(nothing)" : found.extends.join(", ")}`);
|
|
115452
|
-
for (const [
|
|
115496
|
+
for (const [label2, value2] of [
|
|
115453
115497
|
["Categories", found.categories],
|
|
115454
115498
|
["Entries", found.entries],
|
|
115455
115499
|
["Launch", found.launch]
|
|
115456
115500
|
]) {
|
|
115457
115501
|
const pairs = value2 === void 0 ? [] : Object.entries(value2);
|
|
115458
|
-
console.log(`${
|
|
115502
|
+
console.log(`${label2}: ${pairs.length === 0 ? "(none)" : pairs.map(([key, setting]) => `${key}=${JSON.stringify(setting)}`).join(", ")}`);
|
|
115459
115503
|
}
|
|
115460
115504
|
}),
|
|
115461
115505
|
["agent-shim profile show client-acme", "agent-shim profile show client-acme --json"]
|
|
@@ -119013,11 +119057,11 @@ function createRcSessionTracker(deps) {
|
|
|
119013
119057
|
};
|
|
119014
119058
|
const observeExchange = (request7) => {
|
|
119015
119059
|
const method = (request7.method ?? "").toUpperCase();
|
|
119016
|
-
const
|
|
119017
|
-
if (!
|
|
119060
|
+
const path67 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
|
|
119061
|
+
if (!path67.startsWith(RC_SESSIONS_PATH_PREFIX)) {
|
|
119018
119062
|
return void 0;
|
|
119019
119063
|
}
|
|
119020
|
-
const tail =
|
|
119064
|
+
const tail = path67.slice(RC_SESSIONS_PATH_PREFIX.length);
|
|
119021
119065
|
const facts = {
|
|
119022
119066
|
oauthAuthorization: oauthAuthorizationOf(request7.headers),
|
|
119023
119067
|
anthropicVersion: singleHeader(request7.headers, "anthropic-version"),
|
|
@@ -119386,8 +119430,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
|
|
|
119386
119430
|
function isRcReadFileEncoding(value2) {
|
|
119387
119431
|
return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value2);
|
|
119388
119432
|
}
|
|
119389
|
-
function buildRcReadFilePayload(requestId,
|
|
119390
|
-
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path:
|
|
119433
|
+
function buildRcReadFilePayload(requestId, path67, options) {
|
|
119434
|
+
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path67, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
|
|
119391
119435
|
}
|
|
119392
119436
|
function buildRcFileSuggestionsPayload(requestId, query) {
|
|
119393
119437
|
return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
|
|
@@ -119489,15 +119533,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
|
|
|
119489
119533
|
const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
|
|
119490
119534
|
return result.ok ? { ...result, requestId } : result;
|
|
119491
119535
|
}
|
|
119492
|
-
async function readRcSessionFile(deps, sessionId,
|
|
119493
|
-
if (
|
|
119536
|
+
async function readRcSessionFile(deps, sessionId, path67, options) {
|
|
119537
|
+
if (path67 === "") {
|
|
119494
119538
|
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" };
|
|
119495
119539
|
}
|
|
119496
119540
|
if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
|
|
119497
119541
|
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" };
|
|
119498
119542
|
}
|
|
119499
119543
|
const requestId = deps.newUuid();
|
|
119500
|
-
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId,
|
|
119544
|
+
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path67, options), `read ${path67} from session ${sessionId}`);
|
|
119501
119545
|
return result.ok ? { ...result, requestId } : result;
|
|
119502
119546
|
}
|
|
119503
119547
|
async function suggestRcSessionFiles(deps, sessionId, query) {
|
|
@@ -119668,11 +119712,11 @@ function createRcControlHandler(deps) {
|
|
|
119668
119712
|
path: "read-file",
|
|
119669
119713
|
read: (body) => {
|
|
119670
119714
|
const session = bodyString(body, "session");
|
|
119671
|
-
const
|
|
119715
|
+
const path67 = bodyString(body, "path");
|
|
119672
119716
|
const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
|
|
119673
119717
|
const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
|
|
119674
|
-
const refused2 = session === void 0 ||
|
|
119675
|
-
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,
|
|
119718
|
+
const refused2 = session === void 0 || path67 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
|
|
119719
|
+
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, path67, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
|
|
119676
119720
|
}
|
|
119677
119721
|
},
|
|
119678
119722
|
{
|
|
@@ -119982,9 +120026,9 @@ function requestIdOfBody(body) {
|
|
|
119982
120026
|
}
|
|
119983
120027
|
function frontDoorRcControl(transport, token) {
|
|
119984
120028
|
const headers = { authorization: `Bearer ${token}` };
|
|
119985
|
-
const listAnswerOf = async (
|
|
120029
|
+
const listAnswerOf = async (path67, what) => {
|
|
119986
120030
|
try {
|
|
119987
|
-
return await transport.request({ method: "GET", path:
|
|
120031
|
+
return await transport.request({ method: "GET", path: path67, headers });
|
|
119988
120032
|
} catch (error63) {
|
|
119989
120033
|
throw new Error(`${what}: could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}`, { cause: error63 });
|
|
119990
120034
|
}
|
|
@@ -120056,10 +120100,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
120056
120100
|
}
|
|
120057
120101
|
return pending;
|
|
120058
120102
|
};
|
|
120059
|
-
const writeOf = async (
|
|
120103
|
+
const writeOf = async (path67, body, describeFailure2) => {
|
|
120060
120104
|
let answer;
|
|
120061
120105
|
try {
|
|
120062
|
-
answer = await transport.request({ method: "POST", path:
|
|
120106
|
+
answer = await transport.request({ method: "POST", path: path67, headers: { ...headers, "content-type": "application/json" }, body });
|
|
120063
120107
|
} catch (error63) {
|
|
120064
120108
|
return { ok: false, message: `could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}` };
|
|
120065
120109
|
}
|
|
@@ -120090,10 +120134,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
120090
120134
|
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}`),
|
|
120091
120135
|
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}`),
|
|
120092
120136
|
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}`),
|
|
120093
|
-
readFile: async (sessionId,
|
|
120137
|
+
readFile: async (sessionId, path67, options) => await writeOf(
|
|
120094
120138
|
`${CONTROL_PATH_PREFIX}/read-file`,
|
|
120095
|
-
JSON.stringify({ session: sessionId, path:
|
|
120096
|
-
(status, message) => `reading ${
|
|
120139
|
+
JSON.stringify({ session: sessionId, path: path67, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
|
|
120140
|
+
(status, message) => `reading ${path67} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
|
|
120097
120141
|
),
|
|
120098
120142
|
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}`),
|
|
120099
120143
|
keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
|
|
@@ -120406,12 +120450,12 @@ function tlsFacts(options) {
|
|
|
120406
120450
|
}
|
|
120407
120451
|
function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
120408
120452
|
const agent = new ExemptTlsAgent();
|
|
120409
|
-
const post = async (
|
|
120453
|
+
const post = async (path67, headers, body) => await new Promise((resolve2, reject) => {
|
|
120410
120454
|
const options = {
|
|
120411
120455
|
host: target.host,
|
|
120412
120456
|
port: target.port,
|
|
120413
120457
|
method: "POST",
|
|
120414
|
-
path:
|
|
120458
|
+
path: path67,
|
|
120415
120459
|
// 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.
|
|
120416
120460
|
headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
|
|
120417
120461
|
agent
|
|
@@ -120476,12 +120520,12 @@ function lateRcStreamDial(resolve2) {
|
|
|
120476
120520
|
}
|
|
120477
120521
|
function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
120478
120522
|
const agent = new ExemptTlsAgent();
|
|
120479
|
-
const request7 = async (method,
|
|
120523
|
+
const request7 = async (method, path67, headers, body, signal) => await new Promise((resolve2, reject) => {
|
|
120480
120524
|
const options = {
|
|
120481
120525
|
host: target.host,
|
|
120482
120526
|
port: target.port,
|
|
120483
120527
|
method,
|
|
120484
|
-
path:
|
|
120528
|
+
path: path67,
|
|
120485
120529
|
// 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.
|
|
120486
120530
|
headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
|
|
120487
120531
|
agent,
|
|
@@ -120523,9 +120567,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
|
|
|
120523
120567
|
return { status, body: await readAll(response) };
|
|
120524
120568
|
},
|
|
120525
120569
|
openStream: async (sessionId, headers, resume, signal) => {
|
|
120526
|
-
const
|
|
120570
|
+
const path67 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
|
|
120527
120571
|
const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
|
|
120528
|
-
const { status, response } = await request7("GET",
|
|
120572
|
+
const { status, response } = await request7("GET", path67, streamHeaders, void 0, signal);
|
|
120529
120573
|
if (!isSuccessful2(status)) {
|
|
120530
120574
|
await readAll(response);
|
|
120531
120575
|
return { status, chunks: NO_CHUNKS };
|
|
@@ -121926,11 +121970,11 @@ function tryOrUndefined(fn2) {
|
|
|
121926
121970
|
return void 0;
|
|
121927
121971
|
}
|
|
121928
121972
|
}
|
|
121929
|
-
function pathToHttpPath(
|
|
121930
|
-
return `/${
|
|
121973
|
+
function pathToHttpPath(path67) {
|
|
121974
|
+
return `/${path67.map(safeEncodeURIComponent).join("/")}`;
|
|
121931
121975
|
}
|
|
121932
|
-
function normalizeHttpPath(
|
|
121933
|
-
const paths =
|
|
121976
|
+
function normalizeHttpPath(path67) {
|
|
121977
|
+
const paths = path67.split("/");
|
|
121934
121978
|
if (paths.at(0) === "") {
|
|
121935
121979
|
paths.shift();
|
|
121936
121980
|
}
|
|
@@ -122115,9 +122159,9 @@ function isPlainObject3(value2) {
|
|
|
122115
122159
|
function getOwn(object3, key) {
|
|
122116
122160
|
return Object.hasOwn(object3, key) ? object3[key] : void 0;
|
|
122117
122161
|
}
|
|
122118
|
-
function get(object3,
|
|
122162
|
+
function get(object3, path67) {
|
|
122119
122163
|
let current = object3;
|
|
122120
|
-
for (const key of
|
|
122164
|
+
for (const key of path67) {
|
|
122121
122165
|
if (!isTypescriptObject(current)) {
|
|
122122
122166
|
return void 0;
|
|
122123
122167
|
}
|
|
@@ -123340,7 +123384,7 @@ function resolveClientRest(rest) {
|
|
|
123340
123384
|
// rest[1] can be undefined if all fields of FriendlyClientOptions are optional
|
|
123341
123385
|
];
|
|
123342
123386
|
}
|
|
123343
|
-
function createORPCClient(link, { path:
|
|
123387
|
+
function createORPCClient(link, { path: path67 = [], ...options } = {}) {
|
|
123344
123388
|
const procedureClient = (...rest) => {
|
|
123345
123389
|
const [input2, callOptions] = resolveClientRest(rest);
|
|
123346
123390
|
const interceptors = [
|
|
@@ -123349,7 +123393,7 @@ function createORPCClient(link, { path: path66 = [], ...options } = {}) {
|
|
|
123349
123393
|
];
|
|
123350
123394
|
return intercept(
|
|
123351
123395
|
interceptors,
|
|
123352
|
-
{ ...callOptions, input: input2, path:
|
|
123396
|
+
{ ...callOptions, input: input2, path: path67 },
|
|
123353
123397
|
({ path: path210, input: input22, ...callOptions2 }) => link.call(path210, input22, callOptions2)
|
|
123354
123398
|
);
|
|
123355
123399
|
};
|
|
@@ -123363,7 +123407,7 @@ function createORPCClient(link, { path: path66 = [], ...options } = {}) {
|
|
|
123363
123407
|
if (client === void 0) {
|
|
123364
123408
|
client = createORPCClient(link, {
|
|
123365
123409
|
...options,
|
|
123366
|
-
path: [...
|
|
123410
|
+
path: [...path67, key],
|
|
123367
123411
|
scoped: options.scoped?.[key]
|
|
123368
123412
|
});
|
|
123369
123413
|
cache.set(key, client);
|
|
@@ -123385,24 +123429,24 @@ var BracketNotationSerializer = class {
|
|
|
123385
123429
|
this.internalSerialize(data, "", true, result);
|
|
123386
123430
|
return result;
|
|
123387
123431
|
}
|
|
123388
|
-
internalSerialize(data,
|
|
123432
|
+
internalSerialize(data, path67, isRoot, result) {
|
|
123389
123433
|
if (Array.isArray(data)) {
|
|
123390
123434
|
data.forEach((item, i10) => {
|
|
123391
|
-
this.internalSerialize(item, isRoot ? i10.toString() : `${
|
|
123435
|
+
this.internalSerialize(item, isRoot ? i10.toString() : `${path67}[${i10}]`, false, result);
|
|
123392
123436
|
});
|
|
123393
123437
|
} else if (isPlainObject3(data)) {
|
|
123394
123438
|
for (const key of Object.keys(data)) {
|
|
123395
|
-
this.internalSerialize(data[key], isRoot ? key : `${
|
|
123439
|
+
this.internalSerialize(data[key], isRoot ? key : `${path67}[${key}]`, false, result);
|
|
123396
123440
|
}
|
|
123397
123441
|
} else {
|
|
123398
|
-
result.push([
|
|
123442
|
+
result.push([path67, data]);
|
|
123399
123443
|
}
|
|
123400
123444
|
}
|
|
123401
123445
|
deserialize(serialized) {
|
|
123402
123446
|
const arrayPushStyles = /* @__PURE__ */ new WeakSet();
|
|
123403
123447
|
const root = new NullProtoObj();
|
|
123404
|
-
for (const [
|
|
123405
|
-
const segments = this.parsePath(
|
|
123448
|
+
for (const [path67, value2] of serialized) {
|
|
123449
|
+
const segments = this.parsePath(path67);
|
|
123406
123450
|
let currentRef = root;
|
|
123407
123451
|
let nextSegment = segments[0];
|
|
123408
123452
|
for (let i10 = 1; i10 < segments.length; i10++) {
|
|
@@ -123453,13 +123497,13 @@ var BracketNotationSerializer = class {
|
|
|
123453
123497
|
}
|
|
123454
123498
|
return result;
|
|
123455
123499
|
}
|
|
123456
|
-
parsePath(
|
|
123500
|
+
parsePath(path67) {
|
|
123457
123501
|
const segments = [];
|
|
123458
123502
|
let inBrackets = false;
|
|
123459
123503
|
let currentSegment = "";
|
|
123460
|
-
for (let i10 = 0; i10 <
|
|
123461
|
-
const char =
|
|
123462
|
-
const nextChar =
|
|
123504
|
+
for (let i10 = 0; i10 < path67.length; i10++) {
|
|
123505
|
+
const char = path67[i10];
|
|
123506
|
+
const nextChar = path67[i10 + 1];
|
|
123463
123507
|
if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[")) {
|
|
123464
123508
|
if (nextChar === void 0) {
|
|
123465
123509
|
inBrackets = false;
|
|
@@ -123475,7 +123519,7 @@ var BracketNotationSerializer = class {
|
|
|
123475
123519
|
currentSegment += char;
|
|
123476
123520
|
}
|
|
123477
123521
|
}
|
|
123478
|
-
return inBrackets || segments.length === 0 ? [
|
|
123522
|
+
return inBrackets || segments.length === 0 ? [path67] : segments;
|
|
123479
123523
|
}
|
|
123480
123524
|
};
|
|
123481
123525
|
var INTEGER_PATTERN = /^0$|^[1-9]\d*$/;
|
|
@@ -124048,11 +124092,11 @@ var OpenAPISerializer = class {
|
|
|
124048
124092
|
return json2;
|
|
124049
124093
|
}
|
|
124050
124094
|
const form = new FormData();
|
|
124051
|
-
for (const [
|
|
124095
|
+
for (const [path67, value22] of this.bracketNotation.serialize(json2)) {
|
|
124052
124096
|
if (value22 instanceof Blob) {
|
|
124053
|
-
form.append(
|
|
124097
|
+
form.append(path67, value22);
|
|
124054
124098
|
} else if (value22 !== void 0 && value22 !== null) {
|
|
124055
|
-
form.append(
|
|
124099
|
+
form.append(path67, String(value22));
|
|
124056
124100
|
}
|
|
124057
124101
|
}
|
|
124058
124102
|
return form;
|
|
@@ -124090,30 +124134,30 @@ function isBodylessMethod(method) {
|
|
|
124090
124134
|
return method === "GET" || method === "HEAD";
|
|
124091
124135
|
}
|
|
124092
124136
|
var PARAMETER_NAME_REGEX = /^[\w-]+$/;
|
|
124093
|
-
function getDynamicPathParams(
|
|
124094
|
-
if (!
|
|
124137
|
+
function getDynamicPathParams(path67) {
|
|
124138
|
+
if (!path67.includes("{")) {
|
|
124095
124139
|
return void 0;
|
|
124096
124140
|
}
|
|
124097
|
-
const len =
|
|
124141
|
+
const len = path67.length;
|
|
124098
124142
|
let params;
|
|
124099
124143
|
let index = 1;
|
|
124100
124144
|
while (index < len) {
|
|
124101
124145
|
const segmentStart = index;
|
|
124102
|
-
const slashPos =
|
|
124146
|
+
const slashPos = path67.indexOf("/", index);
|
|
124103
124147
|
const segmentEnd = slashPos === -1 ? len : slashPos;
|
|
124104
|
-
if (segmentEnd > segmentStart &&
|
|
124148
|
+
if (segmentEnd > segmentStart && path67.charCodeAt(segmentStart) === 123 && path67.charCodeAt(segmentEnd - 1) === 125) {
|
|
124105
124149
|
let parameterStart = segmentStart + 1;
|
|
124106
124150
|
let allowsSlash = false;
|
|
124107
|
-
const operator =
|
|
124151
|
+
const operator = path67.charCodeAt(parameterStart);
|
|
124108
124152
|
if (operator === 43) {
|
|
124109
124153
|
allowsSlash = true;
|
|
124110
124154
|
parameterStart++;
|
|
124111
124155
|
}
|
|
124112
|
-
const parameterName =
|
|
124156
|
+
const parameterName = path67.slice(parameterStart, segmentEnd - 1);
|
|
124113
124157
|
if (PARAMETER_NAME_REGEX.test(parameterName)) {
|
|
124114
124158
|
params ??= [];
|
|
124115
124159
|
params.push({
|
|
124116
|
-
segment:
|
|
124160
|
+
segment: path67.slice(segmentStart, segmentEnd),
|
|
124117
124161
|
startIndex: segmentStart,
|
|
124118
124162
|
parameterName,
|
|
124119
124163
|
allowsSlash
|
|
@@ -124156,8 +124200,8 @@ openapi.method = (method) => ({
|
|
|
124156
124200
|
...openapi({ method }),
|
|
124157
124201
|
name: "~openapi/method"
|
|
124158
124202
|
});
|
|
124159
|
-
openapi.path = (
|
|
124160
|
-
...openapi({ path:
|
|
124203
|
+
openapi.path = (path67) => ({
|
|
124204
|
+
...openapi({ path: path67 }),
|
|
124161
124205
|
name: "~openapi/path"
|
|
124162
124206
|
});
|
|
124163
124207
|
openapi.spec = (spec) => ({
|
|
@@ -125018,22 +125062,22 @@ function visitJsonSchemaRefs(value2, visit2, schemaLevel = true, seen = /* @__PU
|
|
|
125018
125062
|
}
|
|
125019
125063
|
}
|
|
125020
125064
|
}
|
|
125021
|
-
function mapJsonSchemaRefs(value2, map2, schemaLevel = true,
|
|
125065
|
+
function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path67 = []) {
|
|
125022
125066
|
if (!value2 || typeof value2 !== "object") {
|
|
125023
125067
|
return value2;
|
|
125024
125068
|
}
|
|
125025
125069
|
if (Array.isArray(value2)) {
|
|
125026
|
-
return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...
|
|
125070
|
+
return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path67, index]));
|
|
125027
125071
|
}
|
|
125028
125072
|
const result = {};
|
|
125029
125073
|
for (const key of Object.keys(value2)) {
|
|
125030
125074
|
const val = value2[key];
|
|
125031
125075
|
if (key === "$ref" && typeof val === "string") {
|
|
125032
|
-
setOwn(result, key, map2(val, [...
|
|
125076
|
+
setOwn(result, key, map2(val, [...path67, key]));
|
|
125033
125077
|
} else if (!schemaLevel) {
|
|
125034
|
-
setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...
|
|
125078
|
+
setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path67, key]));
|
|
125035
125079
|
} else if (JSON_SCHEMA_LOGIC_KEYWORDS.has(key) || JSON_SCHEMA_RECORD_KEYWORDS.has(key)) {
|
|
125036
|
-
setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...
|
|
125080
|
+
setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path67, key]));
|
|
125037
125081
|
} else {
|
|
125038
125082
|
setOwn(result, key, val);
|
|
125039
125083
|
}
|
|
@@ -125563,7 +125607,7 @@ function unlazy(maybeLazy) {
|
|
|
125563
125607
|
function createProcedureClient(lazyableProcedure, ...rest) {
|
|
125564
125608
|
const options = resolveMaybeOptionalOptions(rest);
|
|
125565
125609
|
return async (...[input2, callerOptions]) => {
|
|
125566
|
-
const
|
|
125610
|
+
const path67 = toArray(options.path);
|
|
125567
125611
|
const { default: procedure } = await unlazy(lazyableProcedure);
|
|
125568
125612
|
const clientContext = callerOptions?.context ?? {};
|
|
125569
125613
|
const context = await value(options.context, clientContext) ?? {};
|
|
@@ -125576,7 +125620,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
125576
125620
|
};
|
|
125577
125621
|
try {
|
|
125578
125622
|
const output2 = await runWithSpan("call_procedure", (span) => {
|
|
125579
|
-
span?.setAttribute("procedure.path",
|
|
125623
|
+
span?.setAttribute("procedure.path", path67);
|
|
125580
125624
|
return intercept(
|
|
125581
125625
|
options.interceptors,
|
|
125582
125626
|
{
|
|
@@ -125584,7 +125628,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
125584
125628
|
// input can be optional if it is undefinable
|
|
125585
125629
|
input: input2,
|
|
125586
125630
|
errors,
|
|
125587
|
-
path:
|
|
125631
|
+
path: path67,
|
|
125588
125632
|
procedure,
|
|
125589
125633
|
signal: callerOptions?.signal,
|
|
125590
125634
|
lastEventId: callerOptions?.lastEventId
|
|
@@ -125835,10 +125879,10 @@ function augmentRouter(router, options) {
|
|
|
125835
125879
|
}
|
|
125836
125880
|
return enhanced;
|
|
125837
125881
|
}
|
|
125838
|
-
function getRouter(router,
|
|
125882
|
+
function getRouter(router, path67) {
|
|
125839
125883
|
let current = router;
|
|
125840
|
-
for (let i10 = 0; i10 <
|
|
125841
|
-
const segment =
|
|
125884
|
+
for (let i10 = 0; i10 < path67.length; i10++) {
|
|
125885
|
+
const segment = path67[i10];
|
|
125842
125886
|
if (!isTypescriptObject(current)) {
|
|
125843
125887
|
return void 0;
|
|
125844
125888
|
}
|
|
@@ -125850,7 +125894,7 @@ function getRouter(router, path66) {
|
|
|
125850
125894
|
continue;
|
|
125851
125895
|
}
|
|
125852
125896
|
const lazied = current;
|
|
125853
|
-
const rest =
|
|
125897
|
+
const rest = path67.slice(i10);
|
|
125854
125898
|
return new Lazy({
|
|
125855
125899
|
...lazied["~orpc"],
|
|
125856
125900
|
async loader() {
|
|
@@ -125865,40 +125909,40 @@ function getRouter(router, path66) {
|
|
|
125865
125909
|
}
|
|
125866
125910
|
return current;
|
|
125867
125911
|
}
|
|
125868
|
-
function walkProcedureContractsSync(router, callback,
|
|
125912
|
+
function walkProcedureContractsSync(router, callback, path67 = []) {
|
|
125869
125913
|
const lazyResults = [];
|
|
125870
|
-
walkProcedureContractsSyncInternal(router, callback,
|
|
125914
|
+
walkProcedureContractsSyncInternal(router, callback, path67.slice(), lazyResults);
|
|
125871
125915
|
return lazyResults;
|
|
125872
125916
|
}
|
|
125873
|
-
function walkProcedureContractsSyncInternal(router, callback,
|
|
125917
|
+
function walkProcedureContractsSyncInternal(router, callback, path67, lazyResults) {
|
|
125874
125918
|
const hiddenContract = getHiddenRouterContract(router);
|
|
125875
125919
|
if (hiddenContract !== void 0) {
|
|
125876
125920
|
router = hiddenContract;
|
|
125877
125921
|
}
|
|
125878
125922
|
if (router instanceof ProcedureContract) {
|
|
125879
|
-
callback(router,
|
|
125923
|
+
callback(router, path67.slice());
|
|
125880
125924
|
return;
|
|
125881
125925
|
}
|
|
125882
125926
|
if (!isTypescriptObject(router)) {
|
|
125883
125927
|
return;
|
|
125884
125928
|
}
|
|
125885
125929
|
for (const [key, value2] of Object.entries(router)) {
|
|
125886
|
-
|
|
125930
|
+
path67.push(key);
|
|
125887
125931
|
if (value2 instanceof Lazy) {
|
|
125888
|
-
lazyResults.push({ router: value2, path:
|
|
125932
|
+
lazyResults.push({ router: value2, path: path67.slice() });
|
|
125889
125933
|
} else {
|
|
125890
|
-
walkProcedureContractsSyncInternal(value2, callback,
|
|
125934
|
+
walkProcedureContractsSyncInternal(value2, callback, path67, lazyResults);
|
|
125891
125935
|
}
|
|
125892
|
-
|
|
125936
|
+
path67.pop();
|
|
125893
125937
|
}
|
|
125894
125938
|
}
|
|
125895
|
-
async function walkProcedureContractsAsync(router, callback,
|
|
125939
|
+
async function walkProcedureContractsAsync(router, callback, path67 = []) {
|
|
125896
125940
|
const hiddenContract = getHiddenRouterContract(router);
|
|
125897
125941
|
if (hiddenContract !== void 0) {
|
|
125898
125942
|
router = hiddenContract;
|
|
125899
125943
|
}
|
|
125900
125944
|
if (router instanceof ProcedureContract) {
|
|
125901
|
-
await callback(router,
|
|
125945
|
+
await callback(router, path67);
|
|
125902
125946
|
return;
|
|
125903
125947
|
}
|
|
125904
125948
|
if (!isTypescriptObject(router)) {
|
|
@@ -125907,9 +125951,9 @@ async function walkProcedureContractsAsync(router, callback, path66 = []) {
|
|
|
125907
125951
|
for (const [key, value2] of Object.entries(router)) {
|
|
125908
125952
|
if (value2 instanceof Lazy) {
|
|
125909
125953
|
const { default: router2 } = await unlazy(value2);
|
|
125910
|
-
await walkProcedureContractsAsync(router2, callback, [...
|
|
125954
|
+
await walkProcedureContractsAsync(router2, callback, [...path67, key]);
|
|
125911
125955
|
} else {
|
|
125912
|
-
await walkProcedureContractsAsync(value2, callback, [...
|
|
125956
|
+
await walkProcedureContractsAsync(value2, callback, [...path67, key]);
|
|
125913
125957
|
}
|
|
125914
125958
|
}
|
|
125915
125959
|
}
|
|
@@ -126395,18 +126439,18 @@ function rewriteComponentSchemaRefs(schema, renameMap) {
|
|
|
126395
126439
|
}
|
|
126396
126440
|
var OpenAPIGeneratorError = class extends TypeError {
|
|
126397
126441
|
};
|
|
126398
|
-
function toOpenAPIPath(
|
|
126442
|
+
function toOpenAPIPath(path67, dynamicPathParams) {
|
|
126399
126443
|
if (!dynamicPathParams?.length) {
|
|
126400
|
-
return
|
|
126444
|
+
return path67;
|
|
126401
126445
|
}
|
|
126402
126446
|
let normalized = "";
|
|
126403
126447
|
let currentIndex = 0;
|
|
126404
126448
|
for (const param of dynamicPathParams) {
|
|
126405
|
-
normalized +=
|
|
126449
|
+
normalized += path67.slice(currentIndex, param.startIndex);
|
|
126406
126450
|
normalized += `{${param.parameterName}}`;
|
|
126407
126451
|
currentIndex = param.startIndex + param.segment.length;
|
|
126408
126452
|
}
|
|
126409
|
-
normalized +=
|
|
126453
|
+
normalized += path67.slice(currentIndex);
|
|
126410
126454
|
return normalized;
|
|
126411
126455
|
}
|
|
126412
126456
|
function buildRequest(ctx, operation, def, meta3, dynamicPathParams) {
|
|
@@ -126840,8 +126884,8 @@ var OpenAPIGenerator = class {
|
|
|
126840
126884
|
customErrorResponseBodySchema: options.customErrorResponseBodySchema
|
|
126841
126885
|
};
|
|
126842
126886
|
const errors = [];
|
|
126843
|
-
await walkProcedureContractsAsync(router, (contract,
|
|
126844
|
-
if (value(options.filter, contract,
|
|
126887
|
+
await walkProcedureContractsAsync(router, (contract, path67) => {
|
|
126888
|
+
if (value(options.filter, contract, path67) === false) {
|
|
126845
126889
|
return;
|
|
126846
126890
|
}
|
|
126847
126891
|
try {
|
|
@@ -126853,7 +126897,7 @@ var OpenAPIGenerator = class {
|
|
|
126853
126897
|
`QUERY operations require OpenAPI 3.2, but version "${version2}" was requested.`
|
|
126854
126898
|
);
|
|
126855
126899
|
}
|
|
126856
|
-
const postPath = meta3?.path ?? pathToHttpPath(
|
|
126900
|
+
const postPath = meta3?.path ?? pathToHttpPath(path67);
|
|
126857
126901
|
const httpPath = meta3?.prefix ? mergeHttpPath(meta3.prefix, postPath) : postPath;
|
|
126858
126902
|
const dynamicPathParams = getDynamicPathParams(httpPath);
|
|
126859
126903
|
const openApiPath = toOpenAPIPath(httpPath, dynamicPathParams);
|
|
@@ -126862,7 +126906,7 @@ var OpenAPIGenerator = class {
|
|
|
126862
126906
|
operation = meta3.spec;
|
|
126863
126907
|
} else {
|
|
126864
126908
|
operation = {
|
|
126865
|
-
operationId: meta3?.operationId ??
|
|
126909
|
+
operationId: meta3?.operationId ?? path67.join("."),
|
|
126866
126910
|
summary: meta3?.summary,
|
|
126867
126911
|
description: meta3?.description,
|
|
126868
126912
|
deprecated: meta3?.deprecated,
|
|
@@ -126882,7 +126926,7 @@ var OpenAPIGenerator = class {
|
|
|
126882
126926
|
if (!(e14 instanceof OpenAPIGeneratorError)) {
|
|
126883
126927
|
throw e14;
|
|
126884
126928
|
}
|
|
126885
|
-
errors.push(`Procedure at ${
|
|
126929
|
+
errors.push(`Procedure at ${path67.join(".") || "(root)"}: ${e14.message}`);
|
|
126886
126930
|
}
|
|
126887
126931
|
});
|
|
126888
126932
|
if (errors.length) {
|
|
@@ -127729,16 +127773,16 @@ var StandardLink = class {
|
|
|
127729
127773
|
/**
|
|
127730
127774
|
* @throws ORPCError, transport-level errors (network failures, timeouts, etc.)
|
|
127731
127775
|
*/
|
|
127732
|
-
call(
|
|
127733
|
-
return runWithSpan(`${ORPC_NAME}.${
|
|
127776
|
+
call(path67, input2, options) {
|
|
127777
|
+
return runWithSpan(`${ORPC_NAME}.${path67.join("/")}`, (span) => {
|
|
127734
127778
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
127735
|
-
span?.setAttribute("rpc.method",
|
|
127779
|
+
span?.setAttribute("rpc.method", path67.join("."));
|
|
127736
127780
|
if (getTracer() && isAsyncIteratorObject(input2)) {
|
|
127737
127781
|
input2 = override(input2, traceAsyncIterator("consume_async_iterator_object_input", input2));
|
|
127738
127782
|
} else if (getTracer() && input2 instanceof ReadableStream) {
|
|
127739
127783
|
input2 = override(input2, traceReadableStream("consume_octet_stream_input", input2));
|
|
127740
127784
|
}
|
|
127741
|
-
return intercept(this.interceptors, { ...options, path:
|
|
127785
|
+
return intercept(this.interceptors, { ...options, path: path67, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
|
|
127742
127786
|
const tracer = getTracer();
|
|
127743
127787
|
const activeSpan = tracer?.getActiveSpan() ?? span;
|
|
127744
127788
|
let request7 = await runWithSpan(
|
|
@@ -127795,18 +127839,18 @@ var RPCLinkCodec = class {
|
|
|
127795
127839
|
this.headers = options.headers ?? {};
|
|
127796
127840
|
this.serializer = options.serializer ?? new RPCSerializer();
|
|
127797
127841
|
}
|
|
127798
|
-
async encodeInput(input2,
|
|
127799
|
-
let headers = toResolvedStandardHeaders(await value(this.headers, options,
|
|
127842
|
+
async encodeInput(input2, path67, options) {
|
|
127843
|
+
let headers = toResolvedStandardHeaders(await value(this.headers, options, path67, input2));
|
|
127800
127844
|
if (options.lastEventId !== void 0) {
|
|
127801
127845
|
headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
|
|
127802
127846
|
}
|
|
127803
|
-
const expectedMethod = await value(this.expectedMethod, options,
|
|
127804
|
-
const baseUrl = await value(this.baseUrl, options,
|
|
127847
|
+
const expectedMethod = await value(this.expectedMethod, options, path67, input2);
|
|
127848
|
+
const baseUrl = await value(this.baseUrl, options, path67, input2);
|
|
127805
127849
|
const [pathname, search, hash2] = parseStandardUrl(baseUrl);
|
|
127806
|
-
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(
|
|
127850
|
+
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path67)}`;
|
|
127807
127851
|
const serialized = this.serializer.serialize(input2);
|
|
127808
127852
|
if (expectedMethod === "GET" && !(serialized instanceof Blob) && !(serialized instanceof ReadableStream) && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
|
|
127809
|
-
const maxUrlLength = await value(this.maxUrlLength, options,
|
|
127853
|
+
const maxUrlLength = await value(this.maxUrlLength, options, path67, input2);
|
|
127810
127854
|
const mergedSearch = new URLSearchParams(search);
|
|
127811
127855
|
mergedSearch.append("data", stringifyJSON(serialized) ?? "");
|
|
127812
127856
|
const url22 = `${newPathname}?${mergedSearch}${hash2 ?? ""}`;
|
|
@@ -127891,8 +127935,8 @@ var FetchLinkTransport = class {
|
|
|
127891
127935
|
this.fetch = options.fetch ?? ((url2, init) => globalThis.fetch(url2, init));
|
|
127892
127936
|
this.toFetchRequestOptions = options.toFetchRequest;
|
|
127893
127937
|
}
|
|
127894
|
-
async send(standardRequest,
|
|
127895
|
-
let origin = await value(this.origin, options,
|
|
127938
|
+
async send(standardRequest, path67, options) {
|
|
127939
|
+
let origin = await value(this.origin, options, path67);
|
|
127896
127940
|
if (origin?.endsWith("/")) {
|
|
127897
127941
|
origin = origin.slice(0, -1);
|
|
127898
127942
|
}
|
|
@@ -127912,7 +127956,7 @@ var FetchLinkTransport = class {
|
|
|
127912
127956
|
}
|
|
127913
127957
|
}
|
|
127914
127958
|
const fetch3 = this.fetch;
|
|
127915
|
-
const response = await fetch3(url2, init, options,
|
|
127959
|
+
const response = await fetch3(url2, init, options, path67);
|
|
127916
127960
|
const standardResponse = toStandardLazyResponse(response);
|
|
127917
127961
|
return standardResponse;
|
|
127918
127962
|
}
|
|
@@ -128303,14 +128347,14 @@ var StandardHandler = class {
|
|
|
128303
128347
|
span?.setAttribute("url.path", request22.url);
|
|
128304
128348
|
return { matched: false };
|
|
128305
128349
|
}
|
|
128306
|
-
const { path:
|
|
128307
|
-
span?.updateName(`${ORPC_NAME}.${
|
|
128350
|
+
const { path: path67, procedure, decodeInput } = matchedOrNot;
|
|
128351
|
+
span?.updateName(`${ORPC_NAME}.${path67.join("/")}`);
|
|
128308
128352
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
128309
|
-
span?.setAttribute("rpc.method",
|
|
128353
|
+
span?.setAttribute("rpc.method", path67.join("."));
|
|
128310
128354
|
try {
|
|
128311
128355
|
const response = await intercept(
|
|
128312
128356
|
this.interceptors,
|
|
128313
|
-
{ context: context2, prefix: prefix2, request: request22, path:
|
|
128357
|
+
{ context: context2, prefix: prefix2, request: request22, path: path67, procedure, decodeInput },
|
|
128314
128358
|
async ({ context: context3, prefix: prefix3, request: request32, path: path210, procedure: procedure2, decodeInput: decodeInput2 }) => {
|
|
128315
128359
|
step2 = "decode_input";
|
|
128316
128360
|
let input2 = await runWithSpan("decode_input", decodeInput2);
|
|
@@ -128344,7 +128388,7 @@ var StandardHandler = class {
|
|
|
128344
128388
|
message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
|
|
128345
128389
|
cause: e14
|
|
128346
128390
|
}) : toORPCError(e14);
|
|
128347
|
-
const response = await this.codec.encodeError(error63, procedure,
|
|
128391
|
+
const response = await this.codec.encodeError(error63, procedure, path67, { context: context2, prefix: prefix2 });
|
|
128348
128392
|
return { matched: true, response };
|
|
128349
128393
|
}
|
|
128350
128394
|
}
|
|
@@ -128450,7 +128494,7 @@ var RPCMatcher = class {
|
|
|
128450
128494
|
this.rootRouter = router;
|
|
128451
128495
|
this.index(router);
|
|
128452
128496
|
}
|
|
128453
|
-
index(router,
|
|
128497
|
+
index(router, path67 = []) {
|
|
128454
128498
|
const lazyResults = walkProcedureContractsSync(router, (procedure, procedurePath) => {
|
|
128455
128499
|
if (!value(this.filter, procedure, procedurePath)) {
|
|
128456
128500
|
return;
|
|
@@ -128461,7 +128505,7 @@ var RPCMatcher = class {
|
|
|
128461
128505
|
// contract-first entries have no implementation yet, resolveProcedure fills it in on demand
|
|
128462
128506
|
procedure: procedure instanceof Procedure ? procedure : void 0
|
|
128463
128507
|
});
|
|
128464
|
-
},
|
|
128508
|
+
}, path67);
|
|
128465
128509
|
for (const result of lazyResults) {
|
|
128466
128510
|
this.pendingLazyRouters.set(pathToHttpPath(result.path), result);
|
|
128467
128511
|
}
|
|
@@ -128593,10 +128637,10 @@ var RPCHandlerCodec = class {
|
|
|
128593
128637
|
}
|
|
128594
128638
|
};
|
|
128595
128639
|
}
|
|
128596
|
-
encodeOutput(output2, procedure,
|
|
128640
|
+
encodeOutput(output2, procedure, path67, options) {
|
|
128597
128641
|
return {
|
|
128598
128642
|
headers: {},
|
|
128599
|
-
status: value(this.outputStatus, output2, procedure,
|
|
128643
|
+
status: value(this.outputStatus, output2, procedure, path67, options) ?? DEFAULT_SUCCESS_STATUS,
|
|
128600
128644
|
body: this.serializer.serialize(output2)
|
|
128601
128645
|
};
|
|
128602
128646
|
}
|
|
@@ -128650,39 +128694,39 @@ function createRouter() {
|
|
|
128650
128694
|
static: new NullProtoObj2()
|
|
128651
128695
|
};
|
|
128652
128696
|
}
|
|
128653
|
-
function scanFirstGroup(
|
|
128697
|
+
function scanFirstGroup(path67) {
|
|
128654
128698
|
let i10 = 0;
|
|
128655
128699
|
let depth = 0;
|
|
128656
|
-
for (; i10 <
|
|
128657
|
-
const c10 =
|
|
128700
|
+
for (; i10 < path67.length; i10++) {
|
|
128701
|
+
const c10 = path67.charCodeAt(i10);
|
|
128658
128702
|
if (c10 === 92) i10++;
|
|
128659
128703
|
else if (c10 === 40) depth++;
|
|
128660
128704
|
else if (c10 === 41 && depth > 0) depth--;
|
|
128661
128705
|
else if (c10 === 123 && depth === 0) break;
|
|
128662
128706
|
}
|
|
128663
|
-
if (i10 >=
|
|
128707
|
+
if (i10 >= path67.length) return;
|
|
128664
128708
|
let j10 = i10 + 1;
|
|
128665
128709
|
depth = 0;
|
|
128666
|
-
for (; j10 <
|
|
128667
|
-
const c10 =
|
|
128710
|
+
for (; j10 < path67.length; j10++) {
|
|
128711
|
+
const c10 = path67.charCodeAt(j10);
|
|
128668
128712
|
if (c10 === 92) j10++;
|
|
128669
128713
|
else if (c10 === 40) depth++;
|
|
128670
128714
|
else if (c10 === 41 && depth > 0) depth--;
|
|
128671
128715
|
else if (c10 === 125 && depth === 0) break;
|
|
128672
128716
|
}
|
|
128673
|
-
if (j10 >=
|
|
128674
|
-
const mod =
|
|
128717
|
+
if (j10 >= path67.length) return;
|
|
128718
|
+
const mod = path67[j10 + 1];
|
|
128675
128719
|
const hasMod = mod === "?" || mod === "+" || mod === "*";
|
|
128676
128720
|
return [
|
|
128677
|
-
|
|
128678
|
-
|
|
128679
|
-
|
|
128721
|
+
path67.slice(0, i10),
|
|
128722
|
+
path67.slice(i10 + 1, j10),
|
|
128723
|
+
path67.slice(j10 + (hasMod ? 2 : 1)),
|
|
128680
128724
|
hasMod ? mod : void 0
|
|
128681
128725
|
];
|
|
128682
128726
|
}
|
|
128683
|
-
function expandGroupDelimiters(
|
|
128684
|
-
if (!
|
|
128685
|
-
const group = scanFirstGroup(
|
|
128727
|
+
function expandGroupDelimiters(path67) {
|
|
128728
|
+
if (!path67.includes("{")) return;
|
|
128729
|
+
const group = scanFirstGroup(path67);
|
|
128686
128730
|
if (!group) return;
|
|
128687
128731
|
const [pre2, body, suf, mod] = group;
|
|
128688
128732
|
if (!mod) return [pre2 + body + suf];
|
|
@@ -128752,9 +128796,9 @@ function replaceSegmentWildcards(segment, unnamedStart, toGroupKey = toUnnamedGr
|
|
|
128752
128796
|
}
|
|
128753
128797
|
return [replaced, nextIndex];
|
|
128754
128798
|
}
|
|
128755
|
-
function encodeEscapes(
|
|
128756
|
-
if (!
|
|
128757
|
-
return
|
|
128799
|
+
function encodeEscapes(path67) {
|
|
128800
|
+
if (!path67.includes("\\")) return path67;
|
|
128801
|
+
return path67.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
|
|
128758
128802
|
}
|
|
128759
128803
|
function segmentKey(segment) {
|
|
128760
128804
|
if (segment.startsWith("**")) return 2;
|
|
@@ -128783,22 +128827,22 @@ function expandModifiers(segments) {
|
|
|
128783
128827
|
return m10[2] === "+" ? [wc2] : [wc2, without];
|
|
128784
128828
|
}
|
|
128785
128829
|
}
|
|
128786
|
-
function normalizePath(
|
|
128787
|
-
if (!
|
|
128830
|
+
function normalizePath(path67) {
|
|
128831
|
+
if (!path67.includes("/.")) return path67;
|
|
128788
128832
|
const r10 = [];
|
|
128789
|
-
for (const s of
|
|
128833
|
+
for (const s of path67.split("/")) if (s === ".") continue;
|
|
128790
128834
|
else if (s === ".." && r10.length > 1) r10.pop();
|
|
128791
128835
|
else r10.push(s);
|
|
128792
128836
|
return r10.join("/") || "/";
|
|
128793
128837
|
}
|
|
128794
|
-
function splitPath(
|
|
128795
|
-
const s =
|
|
128838
|
+
function splitPath(path67) {
|
|
128839
|
+
const s = path67.split("/");
|
|
128796
128840
|
s.shift();
|
|
128797
128841
|
if (s[s.length - 1] === "") s.pop();
|
|
128798
128842
|
return s;
|
|
128799
128843
|
}
|
|
128800
|
-
function splitRoute(
|
|
128801
|
-
const s = splitPath(
|
|
128844
|
+
function splitRoute(path67) {
|
|
128845
|
+
const s = splitPath(path67);
|
|
128802
128846
|
while (s[s.length - 1] === "") s.pop();
|
|
128803
128847
|
return s;
|
|
128804
128848
|
}
|
|
@@ -128814,16 +128858,16 @@ function getMatchParams(segments, paramsMap) {
|
|
|
128814
128858
|
}
|
|
128815
128859
|
return params;
|
|
128816
128860
|
}
|
|
128817
|
-
function addRoute(ctx, method = "",
|
|
128861
|
+
function addRoute(ctx, method = "", path67, data) {
|
|
128818
128862
|
method = method.toUpperCase();
|
|
128819
|
-
if (
|
|
128820
|
-
const groupExpanded = expandGroupDelimiters(
|
|
128863
|
+
if (path67.charCodeAt(0) !== 47) path67 = `/${path67}`;
|
|
128864
|
+
const groupExpanded = expandGroupDelimiters(path67);
|
|
128821
128865
|
if (groupExpanded) {
|
|
128822
128866
|
for (const expandedPath of groupExpanded) addRoute(ctx, method, expandedPath, data);
|
|
128823
128867
|
return;
|
|
128824
128868
|
}
|
|
128825
|
-
|
|
128826
|
-
const segments = splitRoute(
|
|
128869
|
+
path67 = encodeEscapes(path67);
|
|
128870
|
+
const segments = splitRoute(path67);
|
|
128827
128871
|
const expanded = expandModifiers(segments);
|
|
128828
128872
|
if (expanded) {
|
|
128829
128873
|
for (const p of expanded) addRoute(ctx, method, p, data);
|
|
@@ -128914,15 +128958,15 @@ function getParamRegexp(segment, unnamedStart = 0) {
|
|
|
128914
128958
|
const regex = _s2.replace(/:([\w-]+)(?:\(([^)]*)\))?/g, (_, id2, p) => `(?<${toGroupName(id2)}>${p || "[^/]+"})`).replace(/\((?![?<])/g, () => `(?<${toUnnamedGroupKey(_i2++)}>`).replace(/\uFFFE(.)/g, (_, c10) => /[.*+?^${}()|[\]\\]/.test(c10) ? `\\${c10}` : c10);
|
|
128915
128959
|
return [new RegExp(`^${regex}$`), _i2];
|
|
128916
128960
|
}
|
|
128917
|
-
function findRoute(ctx, method = "",
|
|
128918
|
-
if (opts?.normalize)
|
|
128919
|
-
if (
|
|
128920
|
-
const staticNode = ctx.static[
|
|
128961
|
+
function findRoute(ctx, method = "", path67, opts) {
|
|
128962
|
+
if (opts?.normalize) path67 = normalizePath(path67);
|
|
128963
|
+
if (path67.charCodeAt(path67.length - 1) === 47) path67 = path67.slice(0, -1);
|
|
128964
|
+
const staticNode = ctx.static[path67];
|
|
128921
128965
|
if (staticNode && staticNode.methods) {
|
|
128922
128966
|
const staticMatch = staticNode.methods[method] || staticNode.methods[""];
|
|
128923
128967
|
if (staticMatch !== void 0) return staticMatch[0];
|
|
128924
128968
|
}
|
|
128925
|
-
const segments = splitPath(
|
|
128969
|
+
const segments = splitPath(path67);
|
|
128926
128970
|
const match = _lookupTree(ctx.root, method, segments, 0);
|
|
128927
128971
|
if (match === void 0) return;
|
|
128928
128972
|
if (opts?.params === false) return match;
|
|
@@ -129122,7 +129166,7 @@ var OpenAPIMatcher = class {
|
|
|
129122
129166
|
this.rootRouter = router;
|
|
129123
129167
|
this.index(router);
|
|
129124
129168
|
}
|
|
129125
|
-
index(router,
|
|
129169
|
+
index(router, path67 = []) {
|
|
129126
129170
|
const lazyResults = walkProcedureContractsSync(router, (contract, path210) => {
|
|
129127
129171
|
if (!value(this.filter, contract, path210)) {
|
|
129128
129172
|
return;
|
|
@@ -129137,7 +129181,7 @@ var OpenAPIMatcher = class {
|
|
|
129137
129181
|
contract,
|
|
129138
129182
|
procedure: contract instanceof Procedure ? contract : void 0
|
|
129139
129183
|
});
|
|
129140
|
-
},
|
|
129184
|
+
}, path67);
|
|
129141
129185
|
for (const result of lazyResults) {
|
|
129142
129186
|
const prefix = getOpenAPIMeta(result.router)?.prefix;
|
|
129143
129187
|
this.pendingLazyRouters.add({
|
|
@@ -129224,20 +129268,20 @@ var OpenAPIMatcher = class {
|
|
|
129224
129268
|
return entry.procedure;
|
|
129225
129269
|
}
|
|
129226
129270
|
};
|
|
129227
|
-
function toRou3Pattern(
|
|
129228
|
-
const params = getDynamicPathParams(
|
|
129271
|
+
function toRou3Pattern(path67) {
|
|
129272
|
+
const params = getDynamicPathParams(path67);
|
|
129229
129273
|
if (!params?.length) {
|
|
129230
|
-
return
|
|
129274
|
+
return path67;
|
|
129231
129275
|
}
|
|
129232
129276
|
for (let i10 = params.length - 1; i10 >= 0; i10--) {
|
|
129233
129277
|
const param = params[i10];
|
|
129234
129278
|
const pattern = param.allowsSlash ? `**:${param.parameterName}` : `:${param.parameterName}`;
|
|
129235
|
-
|
|
129279
|
+
path67 = path67.slice(0, param.startIndex) + pattern + path67.slice(param.startIndex + param.segment.length);
|
|
129236
129280
|
}
|
|
129237
|
-
return
|
|
129281
|
+
return path67;
|
|
129238
129282
|
}
|
|
129239
|
-
function toRou3PrefixMatcher(
|
|
129240
|
-
const pattern = toRou3Pattern(
|
|
129283
|
+
function toRou3PrefixMatcher(path67) {
|
|
129284
|
+
const pattern = toRou3Pattern(path67);
|
|
129241
129285
|
return routeToRegExp(pattern === "/" ? "/**" : `${pattern}/**`);
|
|
129242
129286
|
}
|
|
129243
129287
|
function decodeParams(params) {
|
|
@@ -129316,7 +129360,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
129316
129360
|
/**
|
|
129317
129361
|
* @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
|
|
129318
129362
|
*/
|
|
129319
|
-
encodeOutput(output2, procedure,
|
|
129363
|
+
encodeOutput(output2, procedure, path67) {
|
|
129320
129364
|
const meta3 = getOpenAPIMeta(procedure);
|
|
129321
129365
|
const successStatus = meta3?.successStatus ?? DEFAULT_SUCCESS_STATUS;
|
|
129322
129366
|
const outputStructure = meta3?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
|
|
@@ -129329,7 +129373,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
129329
129373
|
}
|
|
129330
129374
|
if (!isValidDetailedOutput(output2)) {
|
|
129331
129375
|
throw new TypeError(`
|
|
129332
|
-
Invalid "detailed" output structure returned by procedure (${
|
|
129376
|
+
Invalid "detailed" output structure returned by procedure (${path67.join(".")}):
|
|
129333
129377
|
\u2022 Expected an object with optional properties:
|
|
129334
129378
|
- status (number <400)
|
|
129335
129379
|
- headers (object)
|
|
@@ -129897,7 +129941,7 @@ function profileValue(name, paths) {
|
|
|
129897
129941
|
function createConfigApiRouter(deps) {
|
|
129898
129942
|
const authed = doorApiAuth(deps.expectedToken);
|
|
129899
129943
|
const { paths } = deps;
|
|
129900
|
-
const route = (
|
|
129944
|
+
const route = (path67, summary) => authed.meta(openapi({ method: "POST", path: path67, summary, tags: [CONFIG_API_TAG] }));
|
|
129901
129945
|
return {
|
|
129902
129946
|
config: {
|
|
129903
129947
|
identity: {
|
|
@@ -131922,8 +131966,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
|
|
|
131922
131966
|
request7.body.resume();
|
|
131923
131967
|
return;
|
|
131924
131968
|
}
|
|
131925
|
-
const
|
|
131926
|
-
const translated = { method: request7.method, path:
|
|
131969
|
+
const path67 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
131970
|
+
const translated = { method: request7.method, path: path67, body, signal: request7.signal };
|
|
131927
131971
|
const routed = await route(translated);
|
|
131928
131972
|
if (request7.signal.aborted) {
|
|
131929
131973
|
return;
|
|
@@ -132544,8 +132588,8 @@ function createAntigravityRouteMount(ports, upstreamBase, provider) {
|
|
|
132544
132588
|
request7.body.resume();
|
|
132545
132589
|
return;
|
|
132546
132590
|
}
|
|
132547
|
-
const
|
|
132548
|
-
const translated = { method: request7.method, path:
|
|
132591
|
+
const path67 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
132592
|
+
const translated = { method: request7.method, path: path67, body, signal: request7.signal };
|
|
132549
132593
|
const routed = await route(translated);
|
|
132550
132594
|
if (request7.signal.aborted) {
|
|
132551
132595
|
return;
|
|
@@ -132586,7 +132630,7 @@ function createPassthroughRoute(name, target) {
|
|
|
132586
132630
|
headroomUpstream: target.headroomUpstream,
|
|
132587
132631
|
serve: async (request7, response) => {
|
|
132588
132632
|
const incoming = new URL(request7.url, "http://127.0.0.1");
|
|
132589
|
-
const
|
|
132633
|
+
const path67 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
|
|
132590
132634
|
const headers = forwardableHeaders(request7.headers);
|
|
132591
132635
|
delete headers.host;
|
|
132592
132636
|
await new Promise((resolve2) => {
|
|
@@ -132594,7 +132638,7 @@ function createPassthroughRoute(name, target) {
|
|
|
132594
132638
|
host: base.hostname,
|
|
132595
132639
|
port: base.port === "" ? void 0 : Number(base.port),
|
|
132596
132640
|
method: request7.method,
|
|
132597
|
-
path: `${basePath}${
|
|
132641
|
+
path: `${basePath}${path67}${incoming.search}`,
|
|
132598
132642
|
headers,
|
|
132599
132643
|
agent
|
|
132600
132644
|
};
|
|
@@ -132766,13 +132810,13 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
132766
132810
|
}
|
|
132767
132811
|
|
|
132768
132812
|
// src/frontdoor/providerRoute.ts
|
|
132769
|
-
var isRcSelfHostPath = (
|
|
132813
|
+
var isRcSelfHostPath = (path67) => path67 === "/v1/code/sessions" || path67.startsWith("/v1/code/sessions/") || path67 === "/v1/sessions" || path67.startsWith("/v1/sessions/");
|
|
132770
132814
|
function scopeSessionProviderPath(request7) {
|
|
132771
132815
|
if (request7.session.provider === void 0) {
|
|
132772
132816
|
return request7;
|
|
132773
132817
|
}
|
|
132774
|
-
const
|
|
132775
|
-
if (!
|
|
132818
|
+
const path67 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
132819
|
+
if (!path67.startsWith("/v1/") || isRcSelfHostPath(path67)) {
|
|
132776
132820
|
return request7;
|
|
132777
132821
|
}
|
|
132778
132822
|
return { ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` };
|
|
@@ -132895,13 +132939,13 @@ function createProviderRouteResolver(deps) {
|
|
|
132895
132939
|
return route;
|
|
132896
132940
|
};
|
|
132897
132941
|
const resolve2 = (request7) => {
|
|
132898
|
-
const
|
|
132899
|
-
const scoped = parseProviderPath(
|
|
132942
|
+
const path67 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
132943
|
+
const scoped = parseProviderPath(path67);
|
|
132900
132944
|
if (scoped === void 0) {
|
|
132901
|
-
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(
|
|
132945
|
+
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path67)) {
|
|
132902
132946
|
return { ok: true, route: deps.rcSelfHostRoute };
|
|
132903
132947
|
}
|
|
132904
|
-
return
|
|
132948
|
+
return path67.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path67}` };
|
|
132905
132949
|
}
|
|
132906
132950
|
const { provider } = scoped;
|
|
132907
132951
|
let definition;
|
|
@@ -132993,8 +133037,8 @@ function createProviderRouteResolver(deps) {
|
|
|
132993
133037
|
let modelChoice;
|
|
132994
133038
|
const visited = /* @__PURE__ */ new Set();
|
|
132995
133039
|
for (; ; ) {
|
|
132996
|
-
const
|
|
132997
|
-
const scoped = parseProviderPath(
|
|
133040
|
+
const path67 = new URL(current.url, "http://127.0.0.1").pathname;
|
|
133041
|
+
const scoped = parseProviderPath(path67);
|
|
132998
133042
|
const providerName = scoped?.provider ?? current.session.provider;
|
|
132999
133043
|
if (providerName !== void 0 && visited.has(providerName)) {
|
|
133000
133044
|
return { ok: false, status: HTTP_STATUS.internalServerError, message: `provider routing cycle: ${[...visited, providerName].join(" -> ")}` };
|
|
@@ -133009,7 +133053,7 @@ function createProviderRouteResolver(deps) {
|
|
|
133009
133053
|
} catch {
|
|
133010
133054
|
routes = void 0;
|
|
133011
133055
|
}
|
|
133012
|
-
const resolvesNames = !nameResolved && !isRcSelfHostPath(
|
|
133056
|
+
const resolvesNames = !nameResolved && !isRcSelfHostPath(path67);
|
|
133013
133057
|
if (resolvesNames) {
|
|
133014
133058
|
const scan2 = await scanRequestHead(current, true);
|
|
133015
133059
|
if (scan2.replayed === void 0) {
|
|
@@ -133048,7 +133092,7 @@ function createProviderRouteResolver(deps) {
|
|
|
133048
133092
|
}
|
|
133049
133093
|
if (routed.provider !== providerName) {
|
|
133050
133094
|
const scopedPrefix = providerName === void 0 ? void 0 : `${PROVIDER_PATH_PREFIX}${encodeURIComponent(providerName)}`;
|
|
133051
|
-
const rest2 = scopedPrefix !== void 0 &&
|
|
133095
|
+
const rest2 = scopedPrefix !== void 0 && path67.startsWith(scopedPrefix) ? path67.slice(scopedPrefix.length) : path67;
|
|
133052
133096
|
const query2 = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
|
|
133053
133097
|
const carried = replay;
|
|
133054
133098
|
current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(routed.provider)}${rest2}${query2}`, body: carried.body, headers: carried.headers };
|
|
@@ -133102,7 +133146,7 @@ function createProviderRouteResolver(deps) {
|
|
|
133102
133146
|
const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
|
|
133103
133147
|
replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
|
|
133104
133148
|
}
|
|
133105
|
-
const rest = scoped === void 0 ?
|
|
133149
|
+
const rest = scoped === void 0 ? path67 : path67.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
|
|
133106
133150
|
const query = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
|
|
133107
133151
|
current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(matched.provider)}${rest}${query}`, body: replay.body, headers: replay.headers };
|
|
133108
133152
|
}
|
|
@@ -136736,7 +136780,7 @@ function registerFrontDoorCommand(program2, deps) {
|
|
|
136736
136780
|
// src/statusline/commands.ts
|
|
136737
136781
|
var import_node_child_process8 = require("node:child_process");
|
|
136738
136782
|
var import_node_os13 = __toESM(require("node:os"), 1);
|
|
136739
|
-
var
|
|
136783
|
+
var import_node_path57 = __toESM(require("node:path"), 1);
|
|
136740
136784
|
init_commandDeps();
|
|
136741
136785
|
init_statusline();
|
|
136742
136786
|
init_providersStore();
|
|
@@ -136948,9 +136992,9 @@ function antigravityWindowsOf(payload, nowMs) {
|
|
|
136948
136992
|
return { fiveHourUsed: five.used, fiveHourResetAt: five.resetAt, sevenDayUsed: seven.used, sevenDayResetAt: seven.resetAt };
|
|
136949
136993
|
}
|
|
136950
136994
|
function quotaFamiliesOf(buckets, nowMs) {
|
|
136951
|
-
return antigravityFamilyBuckets(buckets).flatMap(({ label, bucket }) => {
|
|
136995
|
+
return antigravityFamilyBuckets(buckets).flatMap(({ label: label2, bucket }) => {
|
|
136952
136996
|
const { used, resetAt } = bucketView(bucket, nowMs);
|
|
136953
|
-
return used === void 0 ? [] : [{ measures:
|
|
136997
|
+
return used === void 0 ? [] : [{ measures: label2, utilization: used / FULL_PERCENT2, resetsAt: resetAt }];
|
|
136954
136998
|
});
|
|
136955
136999
|
}
|
|
136956
137000
|
function enrichStatuslinePayload(params) {
|
|
@@ -137111,16 +137155,37 @@ function realStatuslinePorts(env) {
|
|
|
137111
137155
|
return {
|
|
137112
137156
|
env,
|
|
137113
137157
|
homeDirectory: import_node_os12.default.homedir(),
|
|
137114
|
-
readText: (
|
|
137158
|
+
readText: (path67) => {
|
|
137115
137159
|
try {
|
|
137116
|
-
return import_node_fs22.default.readFileSync(
|
|
137160
|
+
return import_node_fs22.default.readFileSync(path67, "utf8");
|
|
137117
137161
|
} catch {
|
|
137118
137162
|
return void 0;
|
|
137119
137163
|
}
|
|
137120
137164
|
},
|
|
137121
137165
|
run: (file2, args, cwd) => {
|
|
137122
137166
|
try {
|
|
137123
|
-
return (0, import_node_child_process7.execFileSync)(file2, [...args], { cwd, encoding: "utf8", timeout: RUN_TIMEOUT_MS, maxBuffer: RUN_MAX_BUFFER_BYTES, stdio: ["ignore", "pipe", "ignore"] });
|
|
137167
|
+
return (0, import_node_child_process7.execFileSync)(file2, [...args], { cwd, encoding: "utf8", timeout: RUN_TIMEOUT_MS, maxBuffer: RUN_MAX_BUFFER_BYTES, stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
|
|
137168
|
+
} catch {
|
|
137169
|
+
return void 0;
|
|
137170
|
+
}
|
|
137171
|
+
},
|
|
137172
|
+
entryKind: (path67) => {
|
|
137173
|
+
try {
|
|
137174
|
+
return import_node_fs22.default.lstatSync(path67).isDirectory() ? "directory" : "other";
|
|
137175
|
+
} catch {
|
|
137176
|
+
return void 0;
|
|
137177
|
+
}
|
|
137178
|
+
},
|
|
137179
|
+
realPath: (path67) => {
|
|
137180
|
+
try {
|
|
137181
|
+
return import_node_fs22.default.realpathSync(path67);
|
|
137182
|
+
} catch {
|
|
137183
|
+
return void 0;
|
|
137184
|
+
}
|
|
137185
|
+
},
|
|
137186
|
+
modifiedAtMs: (path67) => {
|
|
137187
|
+
try {
|
|
137188
|
+
return import_node_fs22.default.statSync(path67).mtimeMs;
|
|
137124
137189
|
} catch {
|
|
137125
137190
|
return void 0;
|
|
137126
137191
|
}
|
|
@@ -137436,6 +137501,67 @@ function modelSegment({ summary, view }) {
|
|
|
137436
137501
|
return segment !== void 0 && segment !== "" ? segment : void 0;
|
|
137437
137502
|
}
|
|
137438
137503
|
|
|
137504
|
+
// src/statusline/sanitise.ts
|
|
137505
|
+
var BELL = "\\u0007";
|
|
137506
|
+
var ESCAPE_SEQUENCES = new RegExp([`${ESCAPE}\\[[0-?]*[ -/]*[@-~]`, `${ESCAPE}\\][^${BELL}${ESCAPE}]*(?:${BELL}|${ESCAPE}\\\\)`, `${ESCAPE}[@-Z\\\\-_]`].join("|"), "g");
|
|
137507
|
+
var CONTROL_AND_BIDI = /[\p{Cc}---]/gu;
|
|
137508
|
+
function sanitiseDisplayText(text3) {
|
|
137509
|
+
return text3.replace(ESCAPE_SEQUENCES, "").replace(CONTROL_AND_BIDI, "");
|
|
137510
|
+
}
|
|
137511
|
+
|
|
137512
|
+
// src/statusline/projectPath.ts
|
|
137513
|
+
var SEPARATORS = /[/\\]/;
|
|
137514
|
+
var SEPARATOR_AT_START = /^[/\\]/;
|
|
137515
|
+
var UNC_PREFIX = /^[/\\]{2}/;
|
|
137516
|
+
var DRIVE_PREFIX = /^[A-Za-z]:[/\\]/;
|
|
137517
|
+
var MAX_ADDED_DIRS_SHOWN = 5;
|
|
137518
|
+
var MAX_ADDED_DIR_NAME_CHARS = 24;
|
|
137519
|
+
function formatProjectPath(cwd, levels) {
|
|
137520
|
+
const safe = sanitiseDisplayText(cwd);
|
|
137521
|
+
const segments = safe.split(SEPARATORS).filter((segment) => segment !== "");
|
|
137522
|
+
if (levels !== "full") {
|
|
137523
|
+
const shown = segments.slice(-Number(levels)).join("/");
|
|
137524
|
+
return shown !== "" ? shown : SEPARATOR_AT_START.test(safe) ? "/" : safe;
|
|
137525
|
+
}
|
|
137526
|
+
if (UNC_PREFIX.test(safe)) {
|
|
137527
|
+
return segments.length > 0 ? `//${segments.join("/")}` : "//";
|
|
137528
|
+
}
|
|
137529
|
+
if (DRIVE_PREFIX.test(safe)) {
|
|
137530
|
+
const joined2 = segments.join("/");
|
|
137531
|
+
return segments.length === 1 ? `${joined2}/` : joined2;
|
|
137532
|
+
}
|
|
137533
|
+
if (SEPARATOR_AT_START.test(safe)) {
|
|
137534
|
+
return segments.length > 0 ? `/${segments.join("/")}` : "/";
|
|
137535
|
+
}
|
|
137536
|
+
return segments.join("/") || safe;
|
|
137537
|
+
}
|
|
137538
|
+
function basenameOf(dir) {
|
|
137539
|
+
const segments = dir.split(SEPARATORS).filter((segment) => segment !== "");
|
|
137540
|
+
return segments.at(-1) ?? dir;
|
|
137541
|
+
}
|
|
137542
|
+
function addedDirNames(dirs) {
|
|
137543
|
+
const all2 = (dirs ?? []).map((dir) => sanitiseDisplayText(basenameOf(dir))).filter((name) => name !== "");
|
|
137544
|
+
const names = all2.slice(0, MAX_ADDED_DIRS_SHOWN).map((name) => name.length <= MAX_ADDED_DIR_NAME_CHARS ? name : `${name.slice(0, MAX_ADDED_DIR_NAME_CHARS - 1)}\u2026`);
|
|
137545
|
+
return { names, more: all2.length - names.length };
|
|
137546
|
+
}
|
|
137547
|
+
function workingDirectoryOf(payload) {
|
|
137548
|
+
const cwd = payload.cwd ?? payload.workspace?.current_dir;
|
|
137549
|
+
return cwd === void 0 || cwd === "" ? void 0 : cwd;
|
|
137550
|
+
}
|
|
137551
|
+
|
|
137552
|
+
// src/statusline/elements/header/project.ts
|
|
137553
|
+
function inlineAddedDirs({ payload, palette }) {
|
|
137554
|
+
const { names, more } = addedDirNames(payload.workspace?.added_dirs);
|
|
137555
|
+
const drawn = [...names.map((name) => `+${name}`), ...more > 0 ? [`+${String(more)} more`] : []];
|
|
137556
|
+
return drawn.length === 0 ? void 0 : drawn.map((text3) => palette.paint("label", text3)).join(" ");
|
|
137557
|
+
}
|
|
137558
|
+
function projectSegment(context) {
|
|
137559
|
+
const { payload, settings: settings2 } = context;
|
|
137560
|
+
const cwd = workingDirectoryOf(payload);
|
|
137561
|
+
const parts = [cwd === void 0 ? void 0 : formatProjectPath(cwd, settings2.project.pathLevels), settings2.project.addedDirsLayout === "inline" ? inlineAddedDirs(context) : void 0].filter((part) => part !== void 0);
|
|
137562
|
+
return parts.length === 0 ? void 0 : parts.join(" ");
|
|
137563
|
+
}
|
|
137564
|
+
|
|
137439
137565
|
// src/statusline/elements/header/provider.ts
|
|
137440
137566
|
function providerSegment({ summary }) {
|
|
137441
137567
|
if (summary.provider === void 0) {
|
|
@@ -137450,6 +137576,290 @@ function routeSegment({ summary }) {
|
|
|
137450
137576
|
return summary.routedTarget !== void 0 && !choiceNamesProvider(summary) ? `via ${summary.routedTarget}` : void 0;
|
|
137451
137577
|
}
|
|
137452
137578
|
|
|
137579
|
+
// src/statusline/vcs/git.ts
|
|
137580
|
+
var GIT = "git";
|
|
137581
|
+
var NUL = "\0";
|
|
137582
|
+
var BRANCH_AHEAD_BEHIND = /^# branch\.ab \+(\d+) -(\d+)$/;
|
|
137583
|
+
var DETACHED_ABBREV = "HEAD";
|
|
137584
|
+
var DETACHED_HEAD = "(detached)";
|
|
137585
|
+
var NO_COMMIT_YET = "(initial)";
|
|
137586
|
+
var ORDINARY_LEADING_FIELDS = 8;
|
|
137587
|
+
var RENAMED_LEADING_FIELDS = 9;
|
|
137588
|
+
var UNMERGED_LEADING_FIELDS = 10;
|
|
137589
|
+
function kindOfCode(code) {
|
|
137590
|
+
const index = code.charAt(0);
|
|
137591
|
+
const workTree = code.charAt(1);
|
|
137592
|
+
if (index === "A") {
|
|
137593
|
+
return "added";
|
|
137594
|
+
}
|
|
137595
|
+
if (index === "D" || workTree === "D") {
|
|
137596
|
+
return "deleted";
|
|
137597
|
+
}
|
|
137598
|
+
if (index === "M" || workTree === "M" || index === "R" || index === "C") {
|
|
137599
|
+
return "modified";
|
|
137600
|
+
}
|
|
137601
|
+
return void 0;
|
|
137602
|
+
}
|
|
137603
|
+
function parseStatus(output2) {
|
|
137604
|
+
const fields = output2.split(NUL);
|
|
137605
|
+
let head;
|
|
137606
|
+
let noCommitYet = false;
|
|
137607
|
+
let ahead = 0;
|
|
137608
|
+
let behind = 0;
|
|
137609
|
+
let dirty = false;
|
|
137610
|
+
let untracked = 0;
|
|
137611
|
+
const tracked = [];
|
|
137612
|
+
for (let index = 0; index < fields.length; index += 1) {
|
|
137613
|
+
const field = fields[index] ?? "";
|
|
137614
|
+
if (field === "") {
|
|
137615
|
+
continue;
|
|
137616
|
+
}
|
|
137617
|
+
if (field.startsWith("# branch.head ")) {
|
|
137618
|
+
head = field.slice("# branch.head ".length);
|
|
137619
|
+
} else if (field.startsWith("# branch.oid ")) {
|
|
137620
|
+
noCommitYet = field.slice("# branch.oid ".length) === NO_COMMIT_YET;
|
|
137621
|
+
} else if (field.startsWith("# branch.ab ")) {
|
|
137622
|
+
const counts = BRANCH_AHEAD_BEHIND.exec(field);
|
|
137623
|
+
ahead = Number(counts?.[1] ?? 0);
|
|
137624
|
+
behind = Number(counts?.[2] ?? 0);
|
|
137625
|
+
} else if (!field.startsWith("# ")) {
|
|
137626
|
+
dirty = true;
|
|
137627
|
+
const parts = field.split(" ");
|
|
137628
|
+
const code = parts[1] ?? "";
|
|
137629
|
+
if (field.startsWith("? ")) {
|
|
137630
|
+
untracked += 1;
|
|
137631
|
+
} else if (field.startsWith("1 ") || field.startsWith("2 ") || field.startsWith("u ")) {
|
|
137632
|
+
const leading = field.startsWith("1 ") ? ORDINARY_LEADING_FIELDS : field.startsWith("2 ") ? RENAMED_LEADING_FIELDS : UNMERGED_LEADING_FIELDS;
|
|
137633
|
+
const kind = kindOfCode(code);
|
|
137634
|
+
if (kind !== void 0) {
|
|
137635
|
+
tracked.push({ path: parts.slice(leading).join(" "), kind });
|
|
137636
|
+
}
|
|
137637
|
+
if (field.startsWith("2 ")) {
|
|
137638
|
+
index += 1;
|
|
137639
|
+
}
|
|
137640
|
+
}
|
|
137641
|
+
}
|
|
137642
|
+
}
|
|
137643
|
+
return { head, noCommitYet, ahead, behind, dirty, tracked, untracked };
|
|
137644
|
+
}
|
|
137645
|
+
function parseNumstat(output2) {
|
|
137646
|
+
const fields = output2.split(NUL);
|
|
137647
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
137648
|
+
let added = 0;
|
|
137649
|
+
let deleted = 0;
|
|
137650
|
+
for (let index = 0; index < fields.length; index += 1) {
|
|
137651
|
+
const [addedText, deletedText, pathText] = (fields[index] ?? "").split(" ");
|
|
137652
|
+
if (addedText === void 0 || deletedText === void 0 || pathText === void 0) {
|
|
137653
|
+
continue;
|
|
137654
|
+
}
|
|
137655
|
+
const path67 = pathText === "" ? fields[index + 2] : pathText;
|
|
137656
|
+
if (pathText === "") {
|
|
137657
|
+
index += 2;
|
|
137658
|
+
}
|
|
137659
|
+
const lines = { added: Number(addedText), deleted: Number(deletedText) };
|
|
137660
|
+
if (path67 !== void 0 && Number.isInteger(lines.added) && Number.isInteger(lines.deleted)) {
|
|
137661
|
+
added += lines.added;
|
|
137662
|
+
deleted += lines.deleted;
|
|
137663
|
+
byPath.set(path67, lines);
|
|
137664
|
+
}
|
|
137665
|
+
}
|
|
137666
|
+
return { total: { added, deleted }, byPath };
|
|
137667
|
+
}
|
|
137668
|
+
function detachedName(ports, cwd) {
|
|
137669
|
+
const tag = ports.run(GIT, ["describe", "--tags", "--exact-match", "HEAD"], cwd)?.trim();
|
|
137670
|
+
if (tag !== void 0 && tag !== "") {
|
|
137671
|
+
return tag;
|
|
137672
|
+
}
|
|
137673
|
+
const commit = ports.run(GIT, ["rev-parse", "--short", "HEAD"], cwd)?.trim();
|
|
137674
|
+
return commit === void 0 || commit === "" ? void 0 : `detached:${commit}`;
|
|
137675
|
+
}
|
|
137676
|
+
function byRecency(ports, cwd, files) {
|
|
137677
|
+
const root = ports.run(GIT, ["rev-parse", "--show-toplevel"], cwd)?.trim();
|
|
137678
|
+
if (root === void 0 || root === "") {
|
|
137679
|
+
return files;
|
|
137680
|
+
}
|
|
137681
|
+
const modified = new Map(files.map((file2) => [file2.path, ports.modifiedAtMs(`${root}/${file2.path}`) ?? 0]));
|
|
137682
|
+
return [...files].sort((left, right) => (modified.get(right.path) ?? 0) - (modified.get(left.path) ?? 0));
|
|
137683
|
+
}
|
|
137684
|
+
function readGitStatus(ports, cwd, query) {
|
|
137685
|
+
if (!query.workingTree) {
|
|
137686
|
+
const abbreviated = ports.run(GIT, ["rev-parse", "--abbrev-ref", "HEAD"], cwd)?.trim();
|
|
137687
|
+
const branch2 = abbreviated === DETACHED_ABBREV ? detachedName(ports, cwd) : abbreviated;
|
|
137688
|
+
return branch2 === void 0 || branch2 === "" ? void 0 : { kind: "git", branch: sanitiseDisplayText(branch2), dirty: false, conflict: false, ahead: 0, behind: 0, lineDiff: void 0, files: void 0 };
|
|
137689
|
+
}
|
|
137690
|
+
const output2 = ports.run(GIT, ["--no-optional-locks", "status", "--porcelain=v2", "--branch", "-z"], cwd);
|
|
137691
|
+
if (output2 === void 0) {
|
|
137692
|
+
return void 0;
|
|
137693
|
+
}
|
|
137694
|
+
const status = parseStatus(output2);
|
|
137695
|
+
const branch = status.head === DETACHED_HEAD ? detachedName(ports, cwd) : status.head;
|
|
137696
|
+
if (status.noCommitYet || branch === void 0 || branch === "") {
|
|
137697
|
+
return void 0;
|
|
137698
|
+
}
|
|
137699
|
+
const numstat = query.lineDiff && status.dirty ? ports.run(GIT, ["--no-optional-locks", "diff", "--numstat", "-z", "HEAD"], cwd) : void 0;
|
|
137700
|
+
const lines = numstat === void 0 ? void 0 : parseNumstat(numstat);
|
|
137701
|
+
const tracked = query.files && status.tracked.length > 0 ? byRecency(ports, cwd, status.tracked) : status.tracked;
|
|
137702
|
+
return {
|
|
137703
|
+
kind: "git",
|
|
137704
|
+
branch: sanitiseDisplayText(branch),
|
|
137705
|
+
dirty: status.dirty,
|
|
137706
|
+
conflict: false,
|
|
137707
|
+
ahead: status.ahead,
|
|
137708
|
+
behind: status.behind,
|
|
137709
|
+
lineDiff: lines?.total,
|
|
137710
|
+
files: query.files ? {
|
|
137711
|
+
tracked: tracked.map((file2) => ({ basename: sanitiseDisplayText(file2.path.split("/").at(-1) ?? file2.path), kind: file2.kind, lines: lines?.byPath.get(file2.path) })),
|
|
137712
|
+
untracked: status.untracked
|
|
137713
|
+
} : void 0
|
|
137714
|
+
};
|
|
137715
|
+
}
|
|
137716
|
+
|
|
137717
|
+
// src/statusline/vcs/jj.ts
|
|
137718
|
+
var import_node_path56 = __toESM(require("node:path"), 1);
|
|
137719
|
+
var JJ2 = "jj";
|
|
137720
|
+
var MAX_WALK_DEPTH = 64;
|
|
137721
|
+
var MAX_LABEL_CODE_POINTS = 64;
|
|
137722
|
+
var FIELD_SEPARATOR = "";
|
|
137723
|
+
var BOOKMARK_SEPARATOR = "";
|
|
137724
|
+
var FIELD_COUNT = 4;
|
|
137725
|
+
function isJjRepository(ports, cwd) {
|
|
137726
|
+
let directory = ports.realPath(cwd);
|
|
137727
|
+
if (directory === void 0 || ports.entryKind(directory) !== "directory") {
|
|
137728
|
+
return false;
|
|
137729
|
+
}
|
|
137730
|
+
for (let depth = 0; depth < MAX_WALK_DEPTH; depth += 1) {
|
|
137731
|
+
if (ports.entryKind(import_node_path56.default.join(directory, ".jj")) === "directory") {
|
|
137732
|
+
return true;
|
|
137733
|
+
}
|
|
137734
|
+
if (ports.entryKind(import_node_path56.default.join(directory, ".git")) !== void 0) {
|
|
137735
|
+
return false;
|
|
137736
|
+
}
|
|
137737
|
+
const parent = import_node_path56.default.dirname(directory);
|
|
137738
|
+
if (parent === directory) {
|
|
137739
|
+
return false;
|
|
137740
|
+
}
|
|
137741
|
+
directory = parent;
|
|
137742
|
+
}
|
|
137743
|
+
return false;
|
|
137744
|
+
}
|
|
137745
|
+
var TEMPLATE = [
|
|
137746
|
+
"change_id.shortest(8)",
|
|
137747
|
+
'"\\x1f"',
|
|
137748
|
+
'self.local_bookmarks().map(|bookmark| bookmark.name()).join("\\x1e")',
|
|
137749
|
+
'"\\x1f"',
|
|
137750
|
+
'if(self.empty(), "0", "1")',
|
|
137751
|
+
'"\\x1f"',
|
|
137752
|
+
'if(self.conflict(), "1", "0")'
|
|
137753
|
+
].join(" ++ ");
|
|
137754
|
+
var ARGS = ["--ignore-working-copy", "--at-operation=@", "--no-pager", "log", "-r", "@", "--no-graph", "--color", "never", "-T", TEMPLATE];
|
|
137755
|
+
function label(text3) {
|
|
137756
|
+
const clean = sanitiseDisplayText(text3).trim();
|
|
137757
|
+
return clean === "" ? void 0 : Array.from(clean).slice(0, MAX_LABEL_CODE_POINTS).join("");
|
|
137758
|
+
}
|
|
137759
|
+
function parse4(output2) {
|
|
137760
|
+
const line = output2.replace(/\r?\n$/, "");
|
|
137761
|
+
if (line.includes("\n") || line.includes("\r")) {
|
|
137762
|
+
return void 0;
|
|
137763
|
+
}
|
|
137764
|
+
const fields = line.split(FIELD_SEPARATOR);
|
|
137765
|
+
if (fields.length !== FIELD_COUNT) {
|
|
137766
|
+
return void 0;
|
|
137767
|
+
}
|
|
137768
|
+
const [changeId, bookmarksText, dirtyFlag, conflictFlag] = fields;
|
|
137769
|
+
if (changeId === void 0 || bookmarksText === void 0 || dirtyFlag !== "0" && dirtyFlag !== "1" || conflictFlag !== "0" && conflictFlag !== "1") {
|
|
137770
|
+
return void 0;
|
|
137771
|
+
}
|
|
137772
|
+
const bookmarks = bookmarksText === "" ? [] : bookmarksText.split(BOOKMARK_SEPARATOR);
|
|
137773
|
+
if (bookmarks.some((bookmark) => bookmark === "")) {
|
|
137774
|
+
return void 0;
|
|
137775
|
+
}
|
|
137776
|
+
const branch = label(bookmarks[0] ?? changeId);
|
|
137777
|
+
return branch === void 0 ? void 0 : { kind: "jj", branch, dirty: dirtyFlag === "1", conflict: conflictFlag === "1", ahead: 0, behind: 0, lineDiff: void 0, files: void 0 };
|
|
137778
|
+
}
|
|
137779
|
+
function readJjStatus(ports, cwd) {
|
|
137780
|
+
const directory = ports.realPath(cwd);
|
|
137781
|
+
if (directory === void 0) {
|
|
137782
|
+
return void 0;
|
|
137783
|
+
}
|
|
137784
|
+
const output2 = ports.run(JJ2, ARGS, directory);
|
|
137785
|
+
return output2 === void 0 ? void 0 : parse4(output2);
|
|
137786
|
+
}
|
|
137787
|
+
|
|
137788
|
+
// src/statusline/vcs/status.ts
|
|
137789
|
+
var READ = /* @__PURE__ */ new WeakMap();
|
|
137790
|
+
function gitQueryOf({ settings: settings2 }) {
|
|
137791
|
+
const files = settings2.layout.rows.includes("gitFiles");
|
|
137792
|
+
const lineDiff = settings2.git.showLineDiff || files;
|
|
137793
|
+
return { workingTree: settings2.git.showDirty || settings2.git.showAheadBehind || files || lineDiff, files, lineDiff };
|
|
137794
|
+
}
|
|
137795
|
+
function vcsStatusOf(context) {
|
|
137796
|
+
if (READ.has(context)) {
|
|
137797
|
+
return READ.get(context);
|
|
137798
|
+
}
|
|
137799
|
+
const { settings: settings2, ports, payload } = context;
|
|
137800
|
+
const cwd = workingDirectoryOf(payload);
|
|
137801
|
+
let status;
|
|
137802
|
+
if (cwd !== void 0) {
|
|
137803
|
+
if (settings2.jj.enabled && isJjRepository(ports, cwd)) {
|
|
137804
|
+
status = readJjStatus(ports, cwd);
|
|
137805
|
+
}
|
|
137806
|
+
if (status === void 0 && settings2.git.enabled) {
|
|
137807
|
+
status = readGitStatus(ports, cwd, gitQueryOf(context));
|
|
137808
|
+
}
|
|
137809
|
+
}
|
|
137810
|
+
READ.set(context, status);
|
|
137811
|
+
return status;
|
|
137812
|
+
}
|
|
137813
|
+
|
|
137814
|
+
// src/statusline/elements/header/vcs.ts
|
|
137815
|
+
function aheadText(ahead, { settings: settings2, palette }) {
|
|
137816
|
+
const text3 = `\u2191${String(ahead)}`;
|
|
137817
|
+
const { pushCriticalAt, pushWarnAt } = settings2.git;
|
|
137818
|
+
if (pushCriticalAt > 0 && ahead >= pushCriticalAt) {
|
|
137819
|
+
return palette.paint("critical", text3);
|
|
137820
|
+
}
|
|
137821
|
+
return pushWarnAt > 0 && ahead >= pushWarnAt ? palette.paint("warning", text3) : palette.paint("gitBranch", text3);
|
|
137822
|
+
}
|
|
137823
|
+
function vcsSegment(context) {
|
|
137824
|
+
const status = vcsStatusOf(context);
|
|
137825
|
+
if (status === void 0) {
|
|
137826
|
+
return void 0;
|
|
137827
|
+
}
|
|
137828
|
+
const { settings: settings2, palette } = context;
|
|
137829
|
+
const isGit = status.kind === "git";
|
|
137830
|
+
const showDirty = isGit ? settings2.git.showDirty : settings2.jj.showDirty;
|
|
137831
|
+
const inner = [palette.paint("gitBranch", status.branch + (showDirty && status.dirty ? "*" : ""))];
|
|
137832
|
+
if (isGit && settings2.git.showAheadBehind) {
|
|
137833
|
+
if (status.ahead > 0) {
|
|
137834
|
+
inner.push(aheadText(status.ahead, context));
|
|
137835
|
+
}
|
|
137836
|
+
if (status.behind > 0) {
|
|
137837
|
+
inner.push(palette.paint("gitBranch", `\u2193${String(status.behind)}`));
|
|
137838
|
+
}
|
|
137839
|
+
}
|
|
137840
|
+
if (isGit && settings2.git.showLineDiff && status.lineDiff !== void 0) {
|
|
137841
|
+
const { added, deleted } = status.lineDiff;
|
|
137842
|
+
const counts = [...added > 0 ? [palette.paint("context", `+${String(added)}`)] : [], ...deleted > 0 ? [palette.paint("critical", `-${String(deleted)}`)] : []];
|
|
137843
|
+
if (counts.length > 0) {
|
|
137844
|
+
inner.push(`[${counts.join(" ")}]`);
|
|
137845
|
+
}
|
|
137846
|
+
}
|
|
137847
|
+
if (!isGit && settings2.jj.showConflicts && status.conflict) {
|
|
137848
|
+
inner.push(palette.paint("critical", "!conflict"));
|
|
137849
|
+
}
|
|
137850
|
+
return `${status.kind}:(${inner.join(" ")}${palette.paint("git", ")")}`;
|
|
137851
|
+
}
|
|
137852
|
+
|
|
137853
|
+
// src/statusline/elements/rows/addedDirs.ts
|
|
137854
|
+
function addedDirsRow({ payload, settings: settings2, palette }) {
|
|
137855
|
+
const { names, more } = addedDirNames(payload.workspace?.added_dirs);
|
|
137856
|
+
if (settings2.project.addedDirsLayout !== "row" || names.length === 0) {
|
|
137857
|
+
return { kind: "text", lines: [] };
|
|
137858
|
+
}
|
|
137859
|
+
const drawn = [...names, ...more > 0 ? [`+${String(more)} more`] : []].map((text3) => palette.paint("label", text3));
|
|
137860
|
+
return { kind: "text", lines: [`${palette.paint("label", "Added dirs:")} ${drawn.join(palette.paint("label", ", "))}`] };
|
|
137861
|
+
}
|
|
137862
|
+
|
|
137453
137863
|
// src/statusline/elements/context.ts
|
|
137454
137864
|
function barStyleOf({ settings: settings2, palette }, okRole) {
|
|
137455
137865
|
return { bands: settings2.bands, palette, okRole, filled: settings2.bar.filled, empty: settings2.bar.empty };
|
|
@@ -137486,15 +137896,48 @@ function contextRow(context) {
|
|
|
137486
137896
|
return { kind: "bars", cells };
|
|
137487
137897
|
}
|
|
137488
137898
|
|
|
137899
|
+
// src/statusline/elements/rows/gitFiles.ts
|
|
137900
|
+
var MAX_FILES_SHOWN = 6;
|
|
137901
|
+
var MIN_COLUMNS = 60;
|
|
137902
|
+
var KIND_MARKS = {
|
|
137903
|
+
added: { mark: "+", role: "context" },
|
|
137904
|
+
deleted: { mark: "-", role: "critical" },
|
|
137905
|
+
modified: { mark: "~", role: "warning" }
|
|
137906
|
+
};
|
|
137907
|
+
function gitFilesRow(context) {
|
|
137908
|
+
const { palette, terminalWidth } = context;
|
|
137909
|
+
const none = { kind: "text", lines: [] };
|
|
137910
|
+
const files = terminalWidth < MIN_COLUMNS ? void 0 : vcsStatusOf(context)?.files;
|
|
137911
|
+
if (files === void 0 || files.tracked.length === 0 && files.untracked === 0) {
|
|
137912
|
+
return none;
|
|
137913
|
+
}
|
|
137914
|
+
const shown = files.tracked.slice(0, MAX_FILES_SHOWN);
|
|
137915
|
+
const entries = shown.map((file2) => {
|
|
137916
|
+
const { mark, role } = KIND_MARKS[file2.kind];
|
|
137917
|
+
const lines = file2.lines;
|
|
137918
|
+
const counts = lines === void 0 ? [] : [...lines.added > 0 ? [palette.paint("context", `+${String(lines.added)}`)] : [], ...lines.deleted > 0 ? [palette.paint("critical", `-${String(lines.deleted)}`)] : []];
|
|
137919
|
+
const diff = counts.length === 0 ? "" : `${palette.paint("label", "(")}${counts.join(" ")}${palette.paint("label", ")")}`;
|
|
137920
|
+
return `${palette.paint(role, mark)}${palette.paint(role, file2.basename)}${diff}`;
|
|
137921
|
+
});
|
|
137922
|
+
const overflow = files.tracked.length - shown.length;
|
|
137923
|
+
if (overflow > 0) {
|
|
137924
|
+
entries.push(palette.paint("label", `+${String(overflow)} more`));
|
|
137925
|
+
}
|
|
137926
|
+
if (files.untracked > 0) {
|
|
137927
|
+
entries.push(palette.paint("label", `?${String(files.untracked)}`));
|
|
137928
|
+
}
|
|
137929
|
+
return { kind: "text", lines: [entries.join(" ")] };
|
|
137930
|
+
}
|
|
137931
|
+
|
|
137489
137932
|
// src/statusline/elements/rows/quota.ts
|
|
137490
137933
|
function quotaRow(context) {
|
|
137491
137934
|
const { summary, nowMs, settings: settings2, palette } = context;
|
|
137492
137935
|
const style = barStyleOf(context, "usage");
|
|
137493
137936
|
const cells = [];
|
|
137494
|
-
const drawWindow = (
|
|
137937
|
+
const drawWindow = (label2, fraction, resetsAt) => {
|
|
137495
137938
|
const clamped = Math.max(0, Math.min(1, fraction));
|
|
137496
137939
|
const color = statusColor(clamped, true, style);
|
|
137497
|
-
cells.push(barCell(palette.paint("label", `${
|
|
137940
|
+
cells.push(barCell(palette.paint("label", `${label2} `), ` ${withColor(color, `${(fraction * FULL_PERCENT3).toFixed(1)}%`)} (${formatDuration(secondsUntil(resetsAt, nowMs))})`, clamped, style));
|
|
137498
137941
|
};
|
|
137499
137942
|
if (summary.quotaFamilies.length > 0) {
|
|
137500
137943
|
for (const window of summary.quotaFamilies) {
|
|
@@ -137523,14 +137966,28 @@ var HEADER_ROLES = {
|
|
|
137523
137966
|
route: "label",
|
|
137524
137967
|
account: "label",
|
|
137525
137968
|
identity: "label",
|
|
137526
|
-
headroom: "label"
|
|
137969
|
+
headroom: "label",
|
|
137970
|
+
project: "project",
|
|
137971
|
+
vcs: "git"
|
|
137527
137972
|
};
|
|
137528
137973
|
var ELEMENTS = {
|
|
137529
|
-
header: { model: modelSegment, provider: providerSegment, route: routeSegment, account: accountSegment, identity: identitySegment, headroom: headroomSegment },
|
|
137530
|
-
rows: { context: contextRow, quota: quotaRow }
|
|
137974
|
+
header: { model: modelSegment, provider: providerSegment, route: routeSegment, account: accountSegment, identity: identitySegment, headroom: headroomSegment, project: projectSegment, vcs: vcsSegment },
|
|
137975
|
+
rows: { context: contextRow, quota: quotaRow, addedDirs: addedDirsRow, gitFiles: gitFilesRow }
|
|
137531
137976
|
};
|
|
137532
137977
|
|
|
137533
137978
|
// src/statusline/headerLayout.ts
|
|
137979
|
+
function headerUnits(parts, overflow) {
|
|
137980
|
+
const units = [];
|
|
137981
|
+
parts.forEach((part, index) => {
|
|
137982
|
+
const before = parts[index - 1];
|
|
137983
|
+
if (overflow === "truncate" && part.name === "vcs" && before?.name === "project") {
|
|
137984
|
+
units[units.length - 1] = `${units.at(-1) ?? ""} ${part.text}`;
|
|
137985
|
+
} else {
|
|
137986
|
+
units.push(part.text);
|
|
137987
|
+
}
|
|
137988
|
+
});
|
|
137989
|
+
return units;
|
|
137990
|
+
}
|
|
137534
137991
|
function justify(texts, maxWidth, separator) {
|
|
137535
137992
|
if (texts.length < 2) {
|
|
137536
137993
|
return texts.join(separator);
|
|
@@ -137591,14 +138048,16 @@ function renderStatuslineBlock(input2) {
|
|
|
137591
138048
|
view: input2.view,
|
|
137592
138049
|
payload: input2.payload,
|
|
137593
138050
|
nowMs: input2.nowMs,
|
|
138051
|
+
terminalWidth,
|
|
137594
138052
|
settings: settings2,
|
|
137595
138053
|
palette: createPalette(settings2.colours, colourEnabled(input2.ports.env)),
|
|
137596
138054
|
ports: input2.ports
|
|
137597
138055
|
};
|
|
137598
|
-
const
|
|
138056
|
+
const parts = settings2.layout.header.flatMap((name) => {
|
|
137599
138057
|
const text3 = elements.header[name](context);
|
|
137600
|
-
return text3 === void 0 ? [] : context.palette.paint(HEADER_ROLES[name], text3);
|
|
138058
|
+
return text3 === void 0 ? [] : { name, text: context.palette.paint(HEADER_ROLES[name], text3) };
|
|
137601
138059
|
});
|
|
138060
|
+
const header = headerUnits(parts, settings2.git.branchOverflow);
|
|
137602
138061
|
const width = Math.max(TWENTY, terminalWidth - RESERVED_COLUMNS);
|
|
137603
138062
|
const lines = [];
|
|
137604
138063
|
if (header.length > 0) {
|
|
@@ -137678,7 +138137,7 @@ function registerStatuslineCommand(program2, deps) {
|
|
|
137678
138137
|
} else {
|
|
137679
138138
|
const configDir = process.env.CLAUDE_CONFIG_DIR;
|
|
137680
138139
|
try {
|
|
137681
|
-
account = readAccountMetadataFile(realFarmFs, configDir === void 0 || configDir === "" ?
|
|
138140
|
+
account = readAccountMetadataFile(realFarmFs, configDir === void 0 || configDir === "" ? import_node_path57.default.join(import_node_os13.default.homedir(), ".claude.json") : import_node_path57.default.join(configDir, ".claude.json"));
|
|
137682
138141
|
} catch {
|
|
137683
138142
|
account = void 0;
|
|
137684
138143
|
}
|
|
@@ -139775,8 +140234,8 @@ function getErrorMap2() {
|
|
|
139775
140234
|
|
|
139776
140235
|
// node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/helpers/parseUtil.js
|
|
139777
140236
|
var makeIssue = (params) => {
|
|
139778
|
-
const { data, path:
|
|
139779
|
-
const fullPath = [...
|
|
140237
|
+
const { data, path: path67, errorMaps, issueData } = params;
|
|
140238
|
+
const fullPath = [...path67, ...issueData.path || []];
|
|
139780
140239
|
const fullIssue = {
|
|
139781
140240
|
...issueData,
|
|
139782
140241
|
path: fullPath
|
|
@@ -139891,11 +140350,11 @@ var errorUtil;
|
|
|
139891
140350
|
|
|
139892
140351
|
// node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/types.js
|
|
139893
140352
|
var ParseInputLazyPath = class {
|
|
139894
|
-
constructor(parent, value2,
|
|
140353
|
+
constructor(parent, value2, path67, key) {
|
|
139895
140354
|
this._cachedPath = [];
|
|
139896
140355
|
this.parent = parent;
|
|
139897
140356
|
this.data = value2;
|
|
139898
|
-
this._path =
|
|
140357
|
+
this._path = path67;
|
|
139899
140358
|
this._key = key;
|
|
139900
140359
|
}
|
|
139901
140360
|
get path() {
|
|
@@ -143458,11 +143917,11 @@ function normalizeObjectSchema(schema) {
|
|
|
143458
143917
|
}
|
|
143459
143918
|
return void 0;
|
|
143460
143919
|
}
|
|
143461
|
-
function getDotPath(
|
|
143462
|
-
if (
|
|
143920
|
+
function getDotPath(path67) {
|
|
143921
|
+
if (path67.length === 0) {
|
|
143463
143922
|
return "object root";
|
|
143464
143923
|
}
|
|
143465
|
-
return
|
|
143924
|
+
return path67.reduce((acc, seg, index) => {
|
|
143466
143925
|
if (index === 0) {
|
|
143467
143926
|
return String(seg);
|
|
143468
143927
|
}
|
|
@@ -147505,7 +147964,7 @@ async function serveMcp(mcp, transport, options = {}) {
|
|
|
147505
147964
|
|
|
147506
147965
|
// src/mcp/permissions.ts
|
|
147507
147966
|
var import_node_fs23 = __toESM(require("node:fs"), 1);
|
|
147508
|
-
var
|
|
147967
|
+
var import_node_path58 = __toESM(require("node:path"), 1);
|
|
147509
147968
|
init_zod();
|
|
147510
147969
|
init_store();
|
|
147511
147970
|
var StoredMcpPermissionsSchema = external_exports.strictObject({
|
|
@@ -147527,10 +147986,10 @@ function effectiveMcpPermissions(flags, stored) {
|
|
|
147527
147986
|
return { writes: flags.writes || stored.writes, remoteControl: flags.remoteControl || stored.remoteControl, history: flags.history || stored.history };
|
|
147528
147987
|
}
|
|
147529
147988
|
function watchMcpPermissions(paths, onChange) {
|
|
147530
|
-
const directory =
|
|
147989
|
+
const directory = import_node_path58.default.dirname(paths.mcpPermissionsFile);
|
|
147531
147990
|
import_node_fs23.default.mkdirSync(directory, { recursive: true });
|
|
147532
147991
|
const watcher = import_node_fs23.default.watch(directory, (_event, filename) => {
|
|
147533
|
-
if (filename === null || filename ===
|
|
147992
|
+
if (filename === null || filename === import_node_path58.default.basename(paths.mcpPermissionsFile)) {
|
|
147534
147993
|
onChange();
|
|
147535
147994
|
}
|
|
147536
147995
|
});
|
|
@@ -147844,16 +148303,16 @@ init_credentialCache();
|
|
|
147844
148303
|
|
|
147845
148304
|
// src/identityToken.ts
|
|
147846
148305
|
var import_node_fs24 = __toESM(require("node:fs"), 1);
|
|
147847
|
-
var
|
|
148306
|
+
var import_node_path59 = __toESM(require("node:path"), 1);
|
|
147848
148307
|
init_cliError();
|
|
147849
148308
|
var TOKEN_FILE_MODE = 384;
|
|
147850
148309
|
var TOKEN_DIR_MODE = 448;
|
|
147851
148310
|
var OAUTH_TOKEN_RE = /^sk-ant-oat\d+-[A-Za-z0-9_-]+$/;
|
|
147852
148311
|
function identityTokenDir(paths) {
|
|
147853
|
-
return
|
|
148312
|
+
return import_node_path59.default.join(paths.root, "credentials");
|
|
147854
148313
|
}
|
|
147855
148314
|
function identityTokenPath(paths, identityName) {
|
|
147856
|
-
return
|
|
148315
|
+
return import_node_path59.default.join(identityTokenDir(paths), `${identityName}.token`);
|
|
147857
148316
|
}
|
|
147858
148317
|
function storeIdentityToken(paths, identityName, raw) {
|
|
147859
148318
|
const token = raw.trim();
|
|
@@ -147864,7 +148323,7 @@ function storeIdentityToken(paths, identityName, raw) {
|
|
|
147864
148323
|
import_node_fs24.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
|
|
147865
148324
|
import_node_fs24.default.chmodSync(dir, TOKEN_DIR_MODE);
|
|
147866
148325
|
const target = identityTokenPath(paths, identityName);
|
|
147867
|
-
const temp =
|
|
148326
|
+
const temp = import_node_path59.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
|
|
147868
148327
|
import_node_fs24.default.writeFileSync(temp, `${token}
|
|
147869
148328
|
`, { mode: TOKEN_FILE_MODE });
|
|
147870
148329
|
import_node_fs24.default.renameSync(temp, target);
|
|
@@ -148035,7 +148494,7 @@ function registerDoctorCommand(program2, deps) {
|
|
|
148035
148494
|
// src/headroom/commands.ts
|
|
148036
148495
|
var import_node_fs25 = __toESM(require("node:fs"), 1);
|
|
148037
148496
|
var import_node_http5 = __toESM(require("node:http"), 1);
|
|
148038
|
-
var
|
|
148497
|
+
var import_node_path60 = __toESM(require("node:path"), 1);
|
|
148039
148498
|
var import_node_child_process10 = require("node:child_process");
|
|
148040
148499
|
init_commandDeps();
|
|
148041
148500
|
init_configProfilesStore();
|
|
@@ -148225,12 +148684,12 @@ function readInstalledHeadroomCommit() {
|
|
|
148225
148684
|
if (toolDir.status !== 0) {
|
|
148226
148685
|
return void 0;
|
|
148227
148686
|
}
|
|
148228
|
-
const libDir =
|
|
148687
|
+
const libDir = import_node_path60.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
|
|
148229
148688
|
for (const python of realFarmFs.readdir(libDir)) {
|
|
148230
|
-
const sitePackages =
|
|
148689
|
+
const sitePackages = import_node_path60.default.join(libDir, python, "site-packages");
|
|
148231
148690
|
for (const entry of realFarmFs.readdir(sitePackages)) {
|
|
148232
148691
|
if (entry.startsWith("headroom_ai-") && entry.endsWith(".dist-info")) {
|
|
148233
|
-
const directUrl = realFarmFs.readFileUtf8(
|
|
148692
|
+
const directUrl = realFarmFs.readFileUtf8(import_node_path60.default.join(sitePackages, entry, "direct_url.json"));
|
|
148234
148693
|
return directUrl === void 0 ? void 0 : parseInstalledCommit(directUrl);
|
|
148235
148694
|
}
|
|
148236
148695
|
}
|
|
@@ -148486,7 +148945,7 @@ async function refreshCatalogueForReal(paths, name, env) {
|
|
|
148486
148945
|
init_realPorts();
|
|
148487
148946
|
|
|
148488
148947
|
// src/usage/realJobRunner.ts
|
|
148489
|
-
var
|
|
148948
|
+
var import_node_path61 = __toESM(require("node:path"), 1);
|
|
148490
148949
|
init_conditions();
|
|
148491
148950
|
init_identityClaude();
|
|
148492
148951
|
var JOB_LAUNCH_FLAGS = ["--no-headroom", "--no-remote-control", "--track-usage"];
|
|
@@ -148499,7 +148958,7 @@ ${outcome.trimEnd()}
|
|
|
148499
148958
|
}
|
|
148500
148959
|
function createRealJobRunner(params) {
|
|
148501
148960
|
return async (name, identity, job) => {
|
|
148502
|
-
const logFile =
|
|
148961
|
+
const logFile = import_node_path61.default.join(params.paths.jobLogsDir, `${name}.log`);
|
|
148503
148962
|
const append = (outcome) => {
|
|
148504
148963
|
params.fs.mkdirPrivate(params.paths.jobLogsDir);
|
|
148505
148964
|
params.fs.appendFilePrivate(logFile, logEntry(name, identity, params.now(), outcome));
|
|
@@ -148556,7 +149015,7 @@ function registerHeadlessCommands(program2, deps) {
|
|
|
148556
149015
|
}
|
|
148557
149016
|
|
|
148558
149017
|
// src/jobs.ts
|
|
148559
|
-
var
|
|
149018
|
+
var import_node_path62 = __toESM(require("node:path"), 1);
|
|
148560
149019
|
init_commandDeps();
|
|
148561
149020
|
init_cliError();
|
|
148562
149021
|
init_schema();
|
|
@@ -148581,7 +149040,7 @@ function jobOf(options) {
|
|
|
148581
149040
|
target: options.identity === void 0 ? { pool: options.pool ?? "" } : { identity: options.identity },
|
|
148582
149041
|
trigger: options.at === void 0 ? { beforeReset: options.beforeReset ?? "fiveHour", lead: options.lead ?? "" } : { at: options.at },
|
|
148583
149042
|
prompt: options.prompt,
|
|
148584
|
-
cwd:
|
|
149043
|
+
cwd: import_node_path62.default.resolve(options.cwd ?? process.cwd()),
|
|
148585
149044
|
timeout: options.timeout,
|
|
148586
149045
|
...options.model === void 0 ? {} : { model: options.model },
|
|
148587
149046
|
...options.allowedTool === void 0 ? {} : { allowedTools: options.allowedTool }
|
|
@@ -148654,7 +149113,7 @@ function registerJobCommand(program2, deps) {
|
|
|
148654
149113
|
console.log(`Allowed tools: ${entry.allowedTools.join(", ")}`);
|
|
148655
149114
|
}
|
|
148656
149115
|
console.log(`Prompt: ${entry.prompt}`);
|
|
148657
|
-
console.log(`Results: ${
|
|
149116
|
+
console.log(`Results: ${import_node_path62.default.join(paths.jobLogsDir, `${name}.log`)}`);
|
|
148658
149117
|
}),
|
|
148659
149118
|
["agent-shim job show digest"]
|
|
148660
149119
|
);
|
|
@@ -148677,7 +149136,7 @@ function registerJobCommand(program2, deps) {
|
|
|
148677
149136
|
throw new UsageError(`No member of the job's pool can be picked right now.`);
|
|
148678
149137
|
}
|
|
148679
149138
|
await createRealJobRunner({ paths, spawnDaemon: spawnDetachedSupervisor, fs: realFarmFs, now: () => /* @__PURE__ */ new Date() })(name, identity, entry);
|
|
148680
|
-
console.log(`Ran job "${name}" as ${identity}; the result is in ${
|
|
149139
|
+
console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path62.default.join(paths.jobLogsDir, `${name}.log`)}.`);
|
|
148681
149140
|
}),
|
|
148682
149141
|
["agent-shim job run digest"]
|
|
148683
149142
|
);
|
|
@@ -148841,7 +149300,7 @@ init_providerAliases();
|
|
|
148841
149300
|
|
|
148842
149301
|
// src/providerRename.ts
|
|
148843
149302
|
var import_node_fs26 = __toESM(require("node:fs"), 1);
|
|
148844
|
-
var
|
|
149303
|
+
var import_node_path63 = __toESM(require("node:path"), 1);
|
|
148845
149304
|
init_schema();
|
|
148846
149305
|
init_store();
|
|
148847
149306
|
init_load();
|
|
@@ -148958,7 +149417,7 @@ function rewriteReferences(paths, from, to2) {
|
|
|
148958
149417
|
const launch = renamedLaunch(profile.launch, from, to2);
|
|
148959
149418
|
const models = profile.models === void 0 ? void 0 : renamedModels(profile.models, from, to2);
|
|
148960
149419
|
if (launch !== void 0 || models !== void 0) {
|
|
148961
|
-
applyPatch(
|
|
149420
|
+
applyPatch(import_node_path63.default.join(paths.configProfilesDir, `${name}.json`), ConfigProfileSchema, { ...launch === void 0 ? {} : { launch }, ...models === void 0 ? {} : { models } });
|
|
148962
149421
|
rewritten.push(`profile ${name}`);
|
|
148963
149422
|
}
|
|
148964
149423
|
}
|
|
@@ -149727,9 +150186,9 @@ function formatSessionList(sessions) {
|
|
|
149727
150186
|
}
|
|
149728
150187
|
function formatNode(node2, depth) {
|
|
149729
150188
|
const indent = " ".repeat(depth);
|
|
149730
|
-
const
|
|
150189
|
+
const label2 = node2.description ?? node2.name ?? "";
|
|
149731
150190
|
const extras = [node2.background === true ? "background" : void 0, node2.workflowRunId, node2.workflowPhase, node2.teamName, node2.stoppedByUser === true ? "stopped" : void 0].filter((value2) => value2 !== void 0);
|
|
149732
|
-
const line = `${indent}- [${node2.kind}] ${node2.agentType} ${node2.id}${
|
|
150191
|
+
const line = `${indent}- [${node2.kind}] ${node2.agentType} ${node2.id}${label2 === "" ? "" : ` ${label2}`}${extras.length === 0 ? "" : ` (${extras.join(", ")})`}`;
|
|
149733
150192
|
return [line, ...node2.children.flatMap((child) => formatNode(child, depth + 1))];
|
|
149734
150193
|
}
|
|
149735
150194
|
function formatSessionTree(identities, tree) {
|
|
@@ -149785,7 +150244,7 @@ function registerSessionCommands(program2, deps) {
|
|
|
149785
150244
|
}
|
|
149786
150245
|
|
|
149787
150246
|
// src/usage/commands.ts
|
|
149788
|
-
var
|
|
150247
|
+
var import_node_path64 = __toESM(require("node:path"), 1);
|
|
149789
150248
|
init_commandDeps();
|
|
149790
150249
|
init_realPorts();
|
|
149791
150250
|
init_account();
|
|
@@ -149820,13 +150279,13 @@ function collectUsageReport(fs30, paths, filters) {
|
|
|
149820
150279
|
}
|
|
149821
150280
|
var PERCENT5 = 100;
|
|
149822
150281
|
var DECIMAL_RADIX = 10;
|
|
149823
|
-
function formatWindow(
|
|
150282
|
+
function formatWindow(label2, window) {
|
|
149824
150283
|
if (window === void 0) {
|
|
149825
150284
|
return void 0;
|
|
149826
150285
|
}
|
|
149827
150286
|
const used = window.utilization === void 0 ? "usage unknown" : `${String(Math.round(window.utilization * PERCENT5))}% used`;
|
|
149828
150287
|
const grace = window.graceUtilization === void 0 ? "" : `, in grace, ${String(Math.round(window.graceUtilization * PERCENT5))}% of the allowance used`;
|
|
149829
|
-
return `${
|
|
150288
|
+
return `${label2} ${used}${grace}${window.resetsAt === void 0 ? "" : `, resets ${window.resetsAt}`}${window.status === void 0 ? "" : ` (${window.status})`}`;
|
|
149830
150289
|
}
|
|
149831
150290
|
function formatMoney(minor, currency) {
|
|
149832
150291
|
const format = new Intl.NumberFormat("en-GB", { style: "currency", currency });
|
|
@@ -149924,7 +150383,7 @@ function collectAccounts(fs30, paths, identity, probe) {
|
|
|
149924
150383
|
return names.map((name) => ({
|
|
149925
150384
|
identity: name,
|
|
149926
150385
|
account: readAccountMetadata(fs30, paths.identitiesDir, name),
|
|
149927
|
-
signIn: identitySignIn(fs30, probe, { farmRoot:
|
|
150386
|
+
signIn: identitySignIn(fs30, probe, { farmRoot: import_node_path64.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
|
|
149928
150387
|
usage: readUsageSnapshot(fs30, paths.usageSnapshotsDir, name)
|
|
149929
150388
|
}));
|
|
149930
150389
|
}
|
|
@@ -150331,7 +150790,7 @@ function quotaHitOf(fs30, paths, identity, sessionId, sinceMs, nowMs) {
|
|
|
150331
150790
|
}
|
|
150332
150791
|
|
|
150333
150792
|
// src/supervise/move.ts
|
|
150334
|
-
var
|
|
150793
|
+
var import_node_path65 = __toESM(require("node:path"), 1);
|
|
150335
150794
|
init_lock();
|
|
150336
150795
|
init_poolPick();
|
|
150337
150796
|
init_read();
|
|
@@ -150377,7 +150836,7 @@ function createMover(deps) {
|
|
|
150377
150836
|
if (resolution.identity === request7.from) {
|
|
150378
150837
|
return { kind: "stay", reason: `no other member of pool "${pool}" can take it` };
|
|
150379
150838
|
}
|
|
150380
|
-
const transcript =
|
|
150839
|
+
const transcript = import_node_path65.default.join(paths.identitiesDir, resolution.identity, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
|
|
150381
150840
|
if (farmFs.lstat(transcript)?.kind !== "file") {
|
|
150382
150841
|
return { kind: "stay", reason: `${resolution.identity} does not share this conversation's history, so it could not resume it` };
|
|
150383
150842
|
}
|
|
@@ -150411,13 +150870,13 @@ function createIdentityMover(deps) {
|
|
|
150411
150870
|
throw error63;
|
|
150412
150871
|
}
|
|
150413
150872
|
try {
|
|
150414
|
-
if (farmFs.readFileUtf8(
|
|
150873
|
+
if (farmFs.readFileUtf8(import_node_path65.default.join(paths.identitiesDir, request7.to, "identity.json")) === void 0) {
|
|
150415
150874
|
return { kind: "stay", reason: `no identity "${request7.to}"` };
|
|
150416
150875
|
}
|
|
150417
150876
|
if (request7.to === request7.from) {
|
|
150418
150877
|
return { kind: "stay", reason: `the model already runs under this session's identity` };
|
|
150419
150878
|
}
|
|
150420
|
-
const transcript =
|
|
150879
|
+
const transcript = import_node_path65.default.join(paths.identitiesDir, request7.to, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
|
|
150421
150880
|
if (farmFs.lstat(transcript)?.kind !== "file") {
|
|
150422
150881
|
return { kind: "stay", reason: `${request7.to} does not share this conversation's history, so it could not resume it` };
|
|
150423
150882
|
}
|
|
@@ -150995,7 +151454,7 @@ async function runClaude(argvOverride) {
|
|
|
150995
151454
|
// src/cli.ts
|
|
150996
151455
|
async function main() {
|
|
150997
151456
|
aliasLegacyEnv(process.env);
|
|
150998
|
-
const invokedName =
|
|
151457
|
+
const invokedName = import_node_path66.default.basename(process.argv[1] ?? "agent-shim");
|
|
150999
151458
|
if (isInvokedAsClaude(invokedName)) {
|
|
151000
151459
|
await runClaude();
|
|
151001
151460
|
return;
|