claude-use 11.52.1 → 11.54.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 +1402 -653
- package/dist/index.cjs +87 -11
- package/dist/index.mjs +87 -11
- package/dist/types/index.d.ts +2910 -28
- 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, path68) {
|
|
322
|
+
if (!path68)
|
|
323
323
|
return obj;
|
|
324
|
-
return
|
|
324
|
+
return path68.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(path68, 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(path68);
|
|
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, path68 = []) => {
|
|
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 }, [...path68, ...issue2.path]));
|
|
1112
1112
|
} else if (issue2.code === "invalid_key") {
|
|
1113
|
-
processError({ issues: issue2.issues }, [...
|
|
1113
|
+
processError({ issues: issue2.issues }, [...path68, ...issue2.path]);
|
|
1114
1114
|
} else if (issue2.code === "invalid_element") {
|
|
1115
|
-
processError({ issues: issue2.issues }, [...
|
|
1115
|
+
processError({ issues: issue2.issues }, [...path68, ...issue2.path]);
|
|
1116
1116
|
} else {
|
|
1117
|
-
const fullpath = [...
|
|
1117
|
+
const fullpath = [...path68, ...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, path68 = []) => {
|
|
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 }, [...path68, ...issue2.path]));
|
|
1161
1161
|
} else if (issue2.code === "invalid_key") {
|
|
1162
|
-
processError({ issues: issue2.issues }, [...
|
|
1162
|
+
processError({ issues: issue2.issues }, [...path68, ...issue2.path]);
|
|
1163
1163
|
} else if (issue2.code === "invalid_element") {
|
|
1164
|
-
processError({ issues: issue2.issues }, [...
|
|
1164
|
+
processError({ issues: issue2.issues }, [...path68, ...issue2.path]);
|
|
1165
1165
|
} else {
|
|
1166
|
-
const fullpath = [...
|
|
1166
|
+
const fullpath = [...path68, ...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 path68 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1206
|
+
for (const seg of path68) {
|
|
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
|
};
|
|
@@ -9041,8 +9041,8 @@ var capitalizeFirstCharacter, error33;
|
|
|
9041
9041
|
var init_lt = __esm({
|
|
9042
9042
|
"node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/lt.js"() {
|
|
9043
9043
|
init_util();
|
|
9044
|
-
capitalizeFirstCharacter = (
|
|
9045
|
-
return
|
|
9044
|
+
capitalizeFirstCharacter = (text4) => {
|
|
9045
|
+
return text4.charAt(0).toUpperCase() + text4.slice(1);
|
|
9046
9046
|
};
|
|
9047
9047
|
error33 = () => {
|
|
9048
9048
|
const Sizable = {
|
|
@@ -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 path68 = ref.slice(1).split("/").filter(Boolean);
|
|
19203
|
+
if (path68.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 (path68[0] === defsKey) {
|
|
19208
|
+
const key = path68[1] === void 0 ? void 0 : decodeJSONPointerSegment(path68[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 path68 = 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 = path68.join(homedir, "Library");
|
|
23722
23722
|
return {
|
|
23723
|
-
data:
|
|
23724
|
-
config:
|
|
23725
|
-
cache:
|
|
23726
|
-
log:
|
|
23727
|
-
temp:
|
|
23723
|
+
data: path68.join(library, "Application Support", name),
|
|
23724
|
+
config: path68.join(library, "Preferences", name),
|
|
23725
|
+
cache: path68.join(library, "Caches", name),
|
|
23726
|
+
log: path68.join(library, "Logs", name),
|
|
23727
|
+
temp: path68.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 || path68.join(homedir, "AppData", "Roaming");
|
|
23732
|
+
const localAppData = env.LOCALAPPDATA || path68.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: path68.join(localAppData, name, "Data"),
|
|
23736
|
+
config: path68.join(appData, name, "Config"),
|
|
23737
|
+
cache: path68.join(localAppData, name, "Cache"),
|
|
23738
|
+
log: path68.join(localAppData, name, "Log"),
|
|
23739
|
+
temp: path68.join(tmpdir, name)
|
|
23740
23740
|
};
|
|
23741
23741
|
};
|
|
23742
23742
|
var linux = (name) => {
|
|
23743
|
-
const username =
|
|
23743
|
+
const username = path68.basename(homedir);
|
|
23744
23744
|
return {
|
|
23745
|
-
data:
|
|
23746
|
-
config:
|
|
23747
|
-
cache:
|
|
23745
|
+
data: path68.join(env.XDG_DATA_HOME || path68.join(homedir, ".local", "share"), name),
|
|
23746
|
+
config: path68.join(env.XDG_CONFIG_HOME || path68.join(homedir, ".config"), name),
|
|
23747
|
+
cache: path68.join(env.XDG_CACHE_HOME || path68.join(homedir, ".cache"), name),
|
|
23748
23748
|
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
23749
|
-
log:
|
|
23750
|
-
temp:
|
|
23749
|
+
log: path68.join(env.XDG_STATE_HOME || path68.join(homedir, ".local", "state"), name),
|
|
23750
|
+
temp: path68.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, path68) {
|
|
23819
|
+
if (typeof path68 === "string" && Object.prototype.hasOwnProperty.call(source, path68)) {
|
|
23820
|
+
return source[path68];
|
|
23821
23821
|
}
|
|
23822
|
-
const parsedPath = typeof
|
|
23822
|
+
const parsedPath = typeof path68 === "string" ? path68.split(".") : path68;
|
|
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(path68) {
|
|
23846
23846
|
try {
|
|
23847
|
-
const stat = await fs_1.promises.stat(
|
|
23847
|
+
const stat = await fs_1.promises.stat(path68);
|
|
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(path68) {
|
|
23858
23858
|
try {
|
|
23859
|
-
const stat = fs_1.default.statSync(
|
|
23859
|
+
const stat = fs_1.default.statSync(path68);
|
|
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((path68, i10) => `${i10 + 1}. ${path68}`).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(path68) {
|
|
24146
24146
|
try {
|
|
24147
|
-
await promises_1.default.stat(
|
|
24147
|
+
await promises_1.default.stat(path68);
|
|
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(path68) {
|
|
24308
24308
|
try {
|
|
24309
|
-
fs_1.default.statSync(
|
|
24309
|
+
fs_1.default.statSync(path68);
|
|
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((path68) => path68.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: path68, keys }) => `${path68.length === 0 ? "" : `${path68.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: path68, values } of ignored) {
|
|
24586
24586
|
let holder = restored;
|
|
24587
|
-
for (const step2 of
|
|
24587
|
+
for (const step2 of path68) {
|
|
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);
|
|
@@ -25038,10 +25038,10 @@ var init_proxyBypass = __esm({
|
|
|
25038
25038
|
|
|
25039
25039
|
// src/config/statusline.ts
|
|
25040
25040
|
function distinctList(member) {
|
|
25041
|
-
return external_exports.array(member).refine((items) => new Set(items).size === items.length, "must not repeat
|
|
25041
|
+
return external_exports.array(member).refine((items) => new Set(items).size === items.length, "must not repeat an entry");
|
|
25042
25042
|
}
|
|
25043
|
-
function isSingleVisibleGrapheme(
|
|
25044
|
-
return [...GRAPHEMES.segment(
|
|
25043
|
+
function isSingleVisibleGrapheme(text4) {
|
|
25044
|
+
return [...GRAPHEMES.segment(text4)].length === 1 && !/[\p{C}\p{Z}]/u.test(text4);
|
|
25045
25045
|
}
|
|
25046
25046
|
function isPlainObject2(value2) {
|
|
25047
25047
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
@@ -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, MAX_ACCOUNT_USER_CHARS, MAX_DISPLAY_TEXT_CHARS, LABEL_RE2, OPTIONAL_LABEL_RE, colourValue, GRAPHEMES, barCharacter, labelText, overrideText, 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", "effort", "advisor", "version", "outputStyle"];
|
|
25072
|
+
STATUSLINE_ROWS = ["context", "quota", "addedDirs", "gitFiles"];
|
|
25073
25073
|
STATUSLINE_COLOUR_NAMES = [
|
|
25074
25074
|
"default",
|
|
25075
25075
|
"dim",
|
|
@@ -25090,21 +25090,46 @@ 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;
|
|
25096
25099
|
MAX_BAR_CELLS = 40;
|
|
25100
|
+
MAX_ACCOUNT_USER_CHARS = 254;
|
|
25101
|
+
MAX_DISPLAY_TEXT_CHARS = 80;
|
|
25097
25102
|
LABEL_RE2 = /^[^\p{C}\p{Z}]+(?: [^\p{C}\p{Z}]+)*$/u;
|
|
25103
|
+
OPTIONAL_LABEL_RE = /^(?:[^\p{C}\p{Z}]+(?: [^\p{C}\p{Z}]+)*)?$/u;
|
|
25098
25104
|
colourValue = external_exports.union([external_exports.enum(STATUSLINE_COLOUR_NAMES), external_exports.number().int().min(0).max(MAX_STATUSLINE_PALETTE_INDEX), external_exports.string().regex(/^#[0-9a-fA-F]{6}$/, "must be a colour name, a palette index from 0 to 255 or #rrggbb")]);
|
|
25099
25105
|
GRAPHEMES = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
25100
25106
|
barCharacter = external_exports.string().refine(isSingleVisibleGrapheme, "must be a single visible character");
|
|
25101
25107
|
labelText = external_exports.string().max(MAX_STATUSLINE_LABEL_CHARS).regex(LABEL_RE2, "must be visible text without control characters");
|
|
25108
|
+
overrideText = external_exports.string().max(MAX_DISPLAY_TEXT_CHARS).regex(OPTIONAL_LABEL_RE, "must be visible text without control characters");
|
|
25102
25109
|
wholePercent = external_exports.number().int().min(1).max(MAX_PERCENT);
|
|
25103
25110
|
SHAPES = {
|
|
25104
25111
|
layout: {
|
|
25105
25112
|
header: distinctList(external_exports.enum(STATUSLINE_HEADER_SEGMENTS)).describe("The header segments to draw, in drawing order; a segment left out is hidden, and an empty list hides the header."),
|
|
25106
25113
|
rows: distinctList(external_exports.enum(STATUSLINE_ROWS)).describe("The rows to draw below the header, in drawing order; a row left out is hidden, and an empty list hides every row.")
|
|
25107
25114
|
},
|
|
25115
|
+
model: {
|
|
25116
|
+
format: external_exports.enum(["full", "compact", "short"]).describe("How the model's name is written: full is the name as the client gives it, compact drops a context-window suffix such as (1M context), and short also drops a leading Claude."),
|
|
25117
|
+
override: overrideText.describe("A name to show in place of the client's own model name, whatever model is running; empty shows the model's own name. A dynamic mode's served model still follows it."),
|
|
25118
|
+
source: external_exports.enum(["client", "transcript", "auto"]).describe("Where the model's name comes from: client is the name the client reports, transcript is the model the session's last reply came from (what a proxy actually served), and auto uses the transcript's model only when it is not a Claude model, which is what a proxy redirect looks like.")
|
|
25119
|
+
},
|
|
25120
|
+
provider: {
|
|
25121
|
+
name: overrideText.describe("A label to show in place of the launch's provider name, or on its own when the launch has no provider; empty shows the provider's own name.")
|
|
25122
|
+
},
|
|
25123
|
+
account: {
|
|
25124
|
+
parts: distinctList(external_exports.enum(["user", "organisation", "plan"])).describe("What the account segment says about the login account, in drawing order: the account's email address, its organisation (shown for team and enterprise accounts) and its plan. A part left out is hidden, and an empty list hides the segment."),
|
|
25125
|
+
userLength: external_exports.number().int().min(0).max(MAX_ACCOUNT_USER_CHARS).describe("The most characters of the account's email address to show, with an ellipsis after a cut one; 0 shows all of it.")
|
|
25126
|
+
},
|
|
25127
|
+
effort: {
|
|
25128
|
+
format: external_exports.enum(["full", "symbol", "text"]).describe("How the reasoning effort is written: full is a symbol and the level (a filled circle that grows with the level, then the name), symbol is the symbol alone, and text is the level's name alone. A level with no symbol is always written as its name.")
|
|
25129
|
+
},
|
|
25130
|
+
advisor: {
|
|
25131
|
+
override: overrideText.describe("A name to show for the advisor model in place of the one the session's transcript records; empty shows the transcript's, prettified.")
|
|
25132
|
+
},
|
|
25108
25133
|
bands: {
|
|
25109
25134
|
warnAt: wholePercent.describe("The whole percentage of use at which a bar turns yellow; it must be below criticalAt."),
|
|
25110
25135
|
criticalAt: wholePercent.describe("The whole percentage of use at which a bar turns red.")
|
|
@@ -25126,25 +25151,67 @@ var init_statusline = __esm({
|
|
|
25126
25151
|
critical: colourValue.describe("The colour of a bar at or above bands.criticalAt, and of a cache hit share that is nearly nothing."),
|
|
25127
25152
|
model: colourValue.describe("The colour of the model and provider segments."),
|
|
25128
25153
|
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.")
|
|
25154
|
+
empty: colourValue.describe("The colour of the unused part of a bar."),
|
|
25155
|
+
project: colourValue.describe("The colour of the project path segment."),
|
|
25156
|
+
git: colourValue.describe("The colour of the version control segment's wrapper text (`git:(` and `)`)."),
|
|
25157
|
+
gitBranch: colourValue.describe("The colour of the branch or bookmark and its ahead, behind and dirty markers.")
|
|
25158
|
+
},
|
|
25159
|
+
project: {
|
|
25160
|
+
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."),
|
|
25161
|
+
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.")
|
|
25162
|
+
},
|
|
25163
|
+
git: {
|
|
25164
|
+
enabled: external_exports.boolean().describe("Whether the vcs segment and the gitFiles row read the working directory's git status."),
|
|
25165
|
+
showDirty: external_exports.boolean().describe("Whether the branch is followed by * when the working tree has uncommitted changes."),
|
|
25166
|
+
showAheadBehind: external_exports.boolean().describe("Whether the branch is followed by the commits ahead of (up-arrow) and behind (down-arrow) its upstream."),
|
|
25167
|
+
showLineDiff: external_exports.boolean().describe("Whether the segment shows the total lines added and removed against HEAD, as [+a -d]."),
|
|
25168
|
+
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."),
|
|
25169
|
+
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."),
|
|
25170
|
+
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.")
|
|
25171
|
+
},
|
|
25172
|
+
jj: {
|
|
25173
|
+
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."),
|
|
25174
|
+
showDirty: external_exports.boolean().describe("Whether the bookmark or change id is followed by * when the working-copy commit differs from its parent."),
|
|
25175
|
+
showConflicts: external_exports.boolean().describe("Whether the segment shows !conflict when the working-copy commit has an unresolved conflict.")
|
|
25130
25176
|
}
|
|
25131
25177
|
};
|
|
25132
25178
|
StatuslineSchema = external_exports.strictObject({
|
|
25133
25179
|
layout: external_exports.strictObject(SHAPES.layout).partial().optional(),
|
|
25180
|
+
model: external_exports.strictObject(SHAPES.model).partial().optional(),
|
|
25181
|
+
provider: external_exports.strictObject(SHAPES.provider).partial().optional(),
|
|
25182
|
+
account: external_exports.strictObject(SHAPES.account).partial().optional(),
|
|
25183
|
+
effort: external_exports.strictObject(SHAPES.effort).partial().optional(),
|
|
25184
|
+
advisor: external_exports.strictObject(SHAPES.advisor).partial().optional(),
|
|
25134
25185
|
bands: external_exports.strictObject(SHAPES.bands).partial().optional(),
|
|
25135
25186
|
labels: external_exports.strictObject(SHAPES.labels).partial().optional(),
|
|
25136
25187
|
bar: external_exports.strictObject(SHAPES.bar).partial().optional(),
|
|
25137
|
-
colours: external_exports.strictObject(SHAPES.colours).partial().optional()
|
|
25188
|
+
colours: external_exports.strictObject(SHAPES.colours).partial().optional(),
|
|
25189
|
+
project: external_exports.strictObject(SHAPES.project).partial().optional(),
|
|
25190
|
+
git: external_exports.strictObject(SHAPES.git).partial().optional(),
|
|
25191
|
+
jj: external_exports.strictObject(SHAPES.jj).partial().optional()
|
|
25138
25192
|
});
|
|
25139
25193
|
ResolvedStatuslineSchema = external_exports.strictObject({
|
|
25140
25194
|
layout: external_exports.strictObject(SHAPES.layout),
|
|
25195
|
+
model: external_exports.strictObject(SHAPES.model),
|
|
25196
|
+
provider: external_exports.strictObject(SHAPES.provider),
|
|
25197
|
+
account: external_exports.strictObject(SHAPES.account),
|
|
25198
|
+
effort: external_exports.strictObject(SHAPES.effort),
|
|
25199
|
+
advisor: external_exports.strictObject(SHAPES.advisor),
|
|
25141
25200
|
bands: external_exports.strictObject(SHAPES.bands),
|
|
25142
25201
|
labels: external_exports.strictObject(SHAPES.labels),
|
|
25143
25202
|
bar: external_exports.strictObject(SHAPES.bar),
|
|
25144
|
-
colours: external_exports.strictObject(SHAPES.colours)
|
|
25203
|
+
colours: external_exports.strictObject(SHAPES.colours),
|
|
25204
|
+
project: external_exports.strictObject(SHAPES.project),
|
|
25205
|
+
git: external_exports.strictObject(SHAPES.git),
|
|
25206
|
+
jj: external_exports.strictObject(SHAPES.jj)
|
|
25145
25207
|
});
|
|
25146
25208
|
STATUSLINE_DEFAULTS = {
|
|
25147
|
-
layout: { header: [...
|
|
25209
|
+
layout: { header: [...DEFAULT_HEADER_SEGMENTS], rows: [...DEFAULT_ROWS] },
|
|
25210
|
+
model: { format: "full", override: "", source: "client" },
|
|
25211
|
+
provider: { name: "" },
|
|
25212
|
+
account: { parts: ["user", "organisation", "plan"], userLength: 0 },
|
|
25213
|
+
effort: { format: "full" },
|
|
25214
|
+
advisor: { override: "" },
|
|
25148
25215
|
bands: { warnAt: 70, criticalAt: 90 },
|
|
25149
25216
|
labels: { fiveHour: "5h", sevenDay: "Wk" },
|
|
25150
25217
|
bar: { width: 10, filled: "\u2588", empty: "\u2591" },
|
|
@@ -25156,8 +25223,14 @@ var init_statusline = __esm({
|
|
|
25156
25223
|
critical: "red",
|
|
25157
25224
|
model: "default",
|
|
25158
25225
|
label: "default",
|
|
25159
|
-
empty: "brightBlack"
|
|
25160
|
-
|
|
25226
|
+
empty: "brightBlack",
|
|
25227
|
+
project: "yellow",
|
|
25228
|
+
git: "magenta",
|
|
25229
|
+
gitBranch: "cyan"
|
|
25230
|
+
},
|
|
25231
|
+
project: { pathLevels: "1", addedDirsLayout: "inline" },
|
|
25232
|
+
git: { enabled: true, showDirty: true, showAheadBehind: false, showLineDiff: false, branchOverflow: "truncate", pushWarnAt: 0, pushCriticalAt: 0 },
|
|
25233
|
+
jj: { enabled: false, showDirty: true, showConflicts: true }
|
|
25161
25234
|
};
|
|
25162
25235
|
STATUSLINE_ENV = "AGENT_SHIM_STATUSLINE";
|
|
25163
25236
|
}
|
|
@@ -28245,8 +28318,8 @@ function redactHeaders(headers) {
|
|
|
28245
28318
|
}
|
|
28246
28319
|
return result;
|
|
28247
28320
|
}
|
|
28248
|
-
function redactText(
|
|
28249
|
-
return SECRET_BODY_PATTERNS.reduce((accumulated, { pattern, replacement }) => accumulated.replace(pattern, replacement),
|
|
28321
|
+
function redactText(text4) {
|
|
28322
|
+
return SECRET_BODY_PATTERNS.reduce((accumulated, { pattern, replacement }) => accumulated.replace(pattern, replacement), text4);
|
|
28250
28323
|
}
|
|
28251
28324
|
function redactJsonValue(value2) {
|
|
28252
28325
|
if (typeof value2 === "string") {
|
|
@@ -28261,12 +28334,12 @@ function redactJsonValue(value2) {
|
|
|
28261
28334
|
return value2;
|
|
28262
28335
|
}
|
|
28263
28336
|
function redactBody(chunk2) {
|
|
28264
|
-
const
|
|
28337
|
+
const text4 = chunk2.toString("utf8");
|
|
28265
28338
|
try {
|
|
28266
|
-
const parsed = JSON.parse(
|
|
28339
|
+
const parsed = JSON.parse(text4);
|
|
28267
28340
|
return JSON.stringify(redactJsonValue(parsed));
|
|
28268
28341
|
} catch {
|
|
28269
|
-
return redactText(
|
|
28342
|
+
return redactText(text4);
|
|
28270
28343
|
}
|
|
28271
28344
|
}
|
|
28272
28345
|
function captureFromEnv(env, logsDir) {
|
|
@@ -28301,8 +28374,8 @@ function createFileCapture(file2, now = () => /* @__PURE__ */ new Date()) {
|
|
|
28301
28374
|
}
|
|
28302
28375
|
const excerpt2 = chunk2.subarray(0, Math.min(CHUNK_LOG_CAP_BYTES, budget));
|
|
28303
28376
|
stored[direction] += excerpt2.length;
|
|
28304
|
-
const
|
|
28305
|
-
const faithful = Buffer.from(
|
|
28377
|
+
const text4 = excerpt2.toString("utf8");
|
|
28378
|
+
const faithful = Buffer.from(text4, "utf8").equals(excerpt2);
|
|
28306
28379
|
append({
|
|
28307
28380
|
kind: "stream-chunk",
|
|
28308
28381
|
id: id2,
|
|
@@ -28311,7 +28384,7 @@ function createFileCapture(file2, now = () => /* @__PURE__ */ new Date()) {
|
|
|
28311
28384
|
bytes: chunk2.length,
|
|
28312
28385
|
stored: excerpt2.length,
|
|
28313
28386
|
truncated: excerpt2.length < chunk2.length,
|
|
28314
|
-
...faithful ? { body: redactText(
|
|
28387
|
+
...faithful ? { body: redactText(text4) } : { b64: excerpt2.toString("base64") }
|
|
28315
28388
|
});
|
|
28316
28389
|
},
|
|
28317
28390
|
onEnd: () => {
|
|
@@ -28387,21 +28460,21 @@ function headroomSocketPath(paths, supervisorPid) {
|
|
|
28387
28460
|
function platformRefusal(platform) {
|
|
28388
28461
|
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
28462
|
}
|
|
28390
|
-
function ownerOnlyRefusal(
|
|
28463
|
+
function ownerOnlyRefusal(label2, target, stat, expected, uid) {
|
|
28391
28464
|
if (stat === void 0) {
|
|
28392
|
-
return `the headroom ${
|
|
28465
|
+
return `the headroom ${label2} ${target} does not exist`;
|
|
28393
28466
|
}
|
|
28394
28467
|
if (stat.kind === "symlink") {
|
|
28395
|
-
return `the headroom ${
|
|
28468
|
+
return `the headroom ${label2} ${target} is a symlink; it must be the real ${KIND_NAMES[expected]}`;
|
|
28396
28469
|
}
|
|
28397
28470
|
if (stat.kind !== expected) {
|
|
28398
|
-
return `the headroom ${
|
|
28471
|
+
return `the headroom ${label2} ${target} is not a ${KIND_NAMES[expected]}`;
|
|
28399
28472
|
}
|
|
28400
28473
|
if (stat.uid !== uid) {
|
|
28401
|
-
return `the headroom ${
|
|
28474
|
+
return `the headroom ${label2} ${target} is owned by uid ${String(stat.uid)}, not by this user (uid ${String(uid)})`;
|
|
28402
28475
|
}
|
|
28403
28476
|
if ((stat.mode & GROUP_OR_OTHER_BITS) !== 0) {
|
|
28404
|
-
return `the headroom ${
|
|
28477
|
+
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
28478
|
}
|
|
28406
28479
|
return void 0;
|
|
28407
28480
|
}
|
|
@@ -28995,8 +29068,8 @@ var init_report = __esm({
|
|
|
28995
29068
|
});
|
|
28996
29069
|
|
|
28997
29070
|
// src/logStyle.ts
|
|
28998
|
-
function styledDiagnostic(style, colour,
|
|
28999
|
-
return
|
|
29071
|
+
function styledDiagnostic(style, colour, text4) {
|
|
29072
|
+
return text4.split("\n").map((line, index) => {
|
|
29000
29073
|
const lead = index === 0 ? DIAGNOSTIC_LEAD.exec(line) : null;
|
|
29001
29074
|
if (lead === null) {
|
|
29002
29075
|
return style([colour], line);
|
|
@@ -29024,7 +29097,7 @@ function createLogPort(sinks, styleFor) {
|
|
|
29024
29097
|
};
|
|
29025
29098
|
}
|
|
29026
29099
|
function styleTextFor(stream) {
|
|
29027
|
-
return (formats,
|
|
29100
|
+
return (formats, text4) => (0, import_node_util3.styleText)([...formats], text4, { stream });
|
|
29028
29101
|
}
|
|
29029
29102
|
var import_node_util3, DIAGNOSTIC_LEAD;
|
|
29030
29103
|
var init_logStyle = __esm({
|
|
@@ -30168,8 +30241,8 @@ var require_utils = __commonJS({
|
|
|
30168
30241
|
}
|
|
30169
30242
|
return output2;
|
|
30170
30243
|
};
|
|
30171
|
-
exports2.basename = (
|
|
30172
|
-
const segs =
|
|
30244
|
+
exports2.basename = (path68, { windows } = {}) => {
|
|
30245
|
+
const segs = path68.split(windows ? /[\\/]/ : "/");
|
|
30173
30246
|
const last = segs[segs.length - 1];
|
|
30174
30247
|
if (last === "") {
|
|
30175
30248
|
return segs[segs.length - 2];
|
|
@@ -30770,7 +30843,7 @@ var require_parse = __commonJS({
|
|
|
30770
30843
|
}
|
|
30771
30844
|
return { risky: false };
|
|
30772
30845
|
};
|
|
30773
|
-
var
|
|
30846
|
+
var parse5 = (input2, options) => {
|
|
30774
30847
|
if (typeof input2 !== "string") {
|
|
30775
30848
|
throw new TypeError("Expected a string");
|
|
30776
30849
|
}
|
|
@@ -30940,7 +31013,7 @@ var require_parse = __commonJS({
|
|
|
30940
31013
|
output2 = token.close = `)$))${extglobStar}`;
|
|
30941
31014
|
}
|
|
30942
31015
|
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
30943
|
-
const expression =
|
|
31016
|
+
const expression = parse5(rest, { ...options, fastpaths: false }).output;
|
|
30944
31017
|
output2 = token.close = `)${expression})${extglobStar})`;
|
|
30945
31018
|
}
|
|
30946
31019
|
if (token.prev.type === "bos") {
|
|
@@ -31463,7 +31536,7 @@ var require_parse = __commonJS({
|
|
|
31463
31536
|
}
|
|
31464
31537
|
return state;
|
|
31465
31538
|
};
|
|
31466
|
-
|
|
31539
|
+
parse5.fastpaths = (input2, options) => {
|
|
31467
31540
|
const opts = { ...options };
|
|
31468
31541
|
const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
31469
31542
|
const len = input2.length;
|
|
@@ -31528,7 +31601,7 @@ var require_parse = __commonJS({
|
|
|
31528
31601
|
}
|
|
31529
31602
|
return source;
|
|
31530
31603
|
};
|
|
31531
|
-
module2.exports =
|
|
31604
|
+
module2.exports = parse5;
|
|
31532
31605
|
}
|
|
31533
31606
|
});
|
|
31534
31607
|
|
|
@@ -31537,7 +31610,7 @@ var require_picomatch = __commonJS({
|
|
|
31537
31610
|
"node_modules/.pnpm/picomatch@4.0.7/node_modules/picomatch/lib/picomatch.js"(exports2, module2) {
|
|
31538
31611
|
"use strict";
|
|
31539
31612
|
var scan = require_scan();
|
|
31540
|
-
var
|
|
31613
|
+
var parse5 = require_parse();
|
|
31541
31614
|
var utils = require_utils();
|
|
31542
31615
|
var constants2 = require_constants();
|
|
31543
31616
|
var isObject5 = (val) => val && typeof val === "object" && !Array.isArray(val);
|
|
@@ -31625,7 +31698,7 @@ var require_picomatch = __commonJS({
|
|
|
31625
31698
|
picomatch4.isMatch = (str, patterns, options) => picomatch4(patterns, options)(str);
|
|
31626
31699
|
picomatch4.parse = (pattern, options) => {
|
|
31627
31700
|
if (Array.isArray(pattern)) return pattern.map((p) => picomatch4.parse(p, options));
|
|
31628
|
-
return
|
|
31701
|
+
return parse5(pattern, { ...options, fastpaths: false });
|
|
31629
31702
|
};
|
|
31630
31703
|
picomatch4.scan = (input2, options) => scan(input2, options);
|
|
31631
31704
|
picomatch4.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
@@ -31651,10 +31724,10 @@ var require_picomatch = __commonJS({
|
|
|
31651
31724
|
}
|
|
31652
31725
|
let parsed = { negated: false, fastpaths: true };
|
|
31653
31726
|
if (options.fastpaths !== false && (input2[0] === "." || input2[0] === "*")) {
|
|
31654
|
-
parsed.output =
|
|
31727
|
+
parsed.output = parse5.fastpaths(input2, options);
|
|
31655
31728
|
}
|
|
31656
31729
|
if (!parsed.output) {
|
|
31657
|
-
parsed =
|
|
31730
|
+
parsed = parse5(input2, options);
|
|
31658
31731
|
}
|
|
31659
31732
|
return picomatch4.compileRe(parsed, options, returnOutput, returnState);
|
|
31660
31733
|
};
|
|
@@ -31934,9 +32007,9 @@ var init_identity = __esm({
|
|
|
31934
32007
|
});
|
|
31935
32008
|
|
|
31936
32009
|
// src/statusline/keys.ts
|
|
31937
|
-
function valueAt(source,
|
|
32010
|
+
function valueAt(source, path68) {
|
|
31938
32011
|
let current = source;
|
|
31939
|
-
for (const part of
|
|
32012
|
+
for (const part of path68) {
|
|
31940
32013
|
if (!isPlainObject2(current)) {
|
|
31941
32014
|
return void 0;
|
|
31942
32015
|
}
|
|
@@ -31944,11 +32017,14 @@ function valueAt(source, path66) {
|
|
|
31944
32017
|
}
|
|
31945
32018
|
return current;
|
|
31946
32019
|
}
|
|
31947
|
-
function keyOf(
|
|
31948
|
-
const common = { path:
|
|
32020
|
+
function keyOf(path68, leaf) {
|
|
32021
|
+
const common = { path: path68.join("."), description: leaf.description ?? "", defaultValue: valueAt(STATUSLINE_DEFAULTS, path68) };
|
|
31949
32022
|
if (leaf instanceof external_exports.ZodNumber) {
|
|
31950
32023
|
return { ...common, kind: "integer", choices: [] };
|
|
31951
32024
|
}
|
|
32025
|
+
if (leaf instanceof external_exports.ZodBoolean) {
|
|
32026
|
+
return { ...common, kind: "boolean", choices: [] };
|
|
32027
|
+
}
|
|
31952
32028
|
if (leaf instanceof external_exports.ZodString) {
|
|
31953
32029
|
return { ...common, kind: "text", choices: [] };
|
|
31954
32030
|
}
|
|
@@ -31961,7 +32037,7 @@ function keyOf(path66, leaf) {
|
|
|
31961
32037
|
if (leaf instanceof external_exports.ZodArray && leaf.element instanceof external_exports.ZodEnum) {
|
|
31962
32038
|
return { ...common, kind: "list", choices: Object.values(leaf.element.enum).map(String) };
|
|
31963
32039
|
}
|
|
31964
|
-
throw new TypeError(`statusline setting ${
|
|
32040
|
+
throw new TypeError(`statusline setting ${path68.join(".")} has a kind the key listing does not describe`);
|
|
31965
32041
|
}
|
|
31966
32042
|
function walk(shape, prefix) {
|
|
31967
32043
|
return Object.entries(shape).flatMap(([name, schema]) => schema instanceof external_exports.ZodObject ? walk(schema.shape, [...prefix, name]) : [keyOf([...prefix, name], schema)]);
|
|
@@ -31985,42 +32061,47 @@ var init_keys = __esm({
|
|
|
31985
32061
|
});
|
|
31986
32062
|
|
|
31987
32063
|
// src/statusline/change.ts
|
|
31988
|
-
function keyNamed(
|
|
31989
|
-
const found = statuslineKeys().find((key) => key.path ===
|
|
32064
|
+
function keyNamed(path68) {
|
|
32065
|
+
const found = statuslineKeys().find((key) => key.path === path68);
|
|
31990
32066
|
if (found === void 0) {
|
|
31991
|
-
throw new UsageError(`"${
|
|
32067
|
+
throw new UsageError(`"${path68}" is not a statusline setting; \`agent-shim statusline keys\` lists them.`);
|
|
31992
32068
|
}
|
|
31993
32069
|
return found;
|
|
31994
32070
|
}
|
|
31995
|
-
function parseStatuslineAssignment(
|
|
31996
|
-
const split =
|
|
32071
|
+
function parseStatuslineAssignment(text4) {
|
|
32072
|
+
const split = text4.indexOf("=");
|
|
31997
32073
|
if (split < 1) {
|
|
31998
|
-
throw new UsageError(`"${
|
|
32074
|
+
throw new UsageError(`"${text4}" is not <setting>=<value>.`);
|
|
31999
32075
|
}
|
|
32000
|
-
const
|
|
32001
|
-
const raw =
|
|
32002
|
-
const key = keyNamed(
|
|
32076
|
+
const path68 = text4.slice(0, split);
|
|
32077
|
+
const raw = text4.slice(split + 1);
|
|
32078
|
+
const key = keyNamed(path68);
|
|
32003
32079
|
switch (key.kind) {
|
|
32004
32080
|
case "integer": {
|
|
32005
32081
|
const number5 = Number(raw);
|
|
32006
32082
|
if (raw.trim() === "" || !Number.isFinite(number5)) {
|
|
32007
|
-
throw new UsageError(`${
|
|
32083
|
+
throw new UsageError(`${path68}: "${raw}" is not a number.`);
|
|
32008
32084
|
}
|
|
32009
|
-
return { path:
|
|
32085
|
+
return { path: path68, value: number5 };
|
|
32010
32086
|
}
|
|
32087
|
+
case "boolean":
|
|
32088
|
+
if (raw !== "true" && raw !== "false") {
|
|
32089
|
+
throw new UsageError(`${path68}: "${raw}" is not true or false.`);
|
|
32090
|
+
}
|
|
32091
|
+
return { path: path68, value: raw === "true" };
|
|
32011
32092
|
case "text":
|
|
32012
32093
|
case "choice":
|
|
32013
|
-
return { path:
|
|
32094
|
+
return { path: path68, value: raw };
|
|
32014
32095
|
case "colour":
|
|
32015
|
-
return { path:
|
|
32096
|
+
return { path: path68, value: /^\d+$/.test(raw) ? Number(raw) : raw };
|
|
32016
32097
|
case "list":
|
|
32017
|
-
return { path:
|
|
32098
|
+
return { path: path68, value: raw === "" ? [] : raw.split(",") };
|
|
32018
32099
|
default:
|
|
32019
32100
|
return key.kind;
|
|
32020
32101
|
}
|
|
32021
32102
|
}
|
|
32022
|
-
function setAt(target,
|
|
32023
|
-
const [head, ...rest] =
|
|
32103
|
+
function setAt(target, path68, value2) {
|
|
32104
|
+
const [head, ...rest] = path68;
|
|
32024
32105
|
if (head === void 0) {
|
|
32025
32106
|
return;
|
|
32026
32107
|
}
|
|
@@ -32033,8 +32114,8 @@ function setAt(target, path66, value2) {
|
|
|
32033
32114
|
target[head] = next;
|
|
32034
32115
|
setAt(next, rest, value2);
|
|
32035
32116
|
}
|
|
32036
|
-
function removeAt(target,
|
|
32037
|
-
const [head, ...rest] =
|
|
32117
|
+
function removeAt(target, path68) {
|
|
32118
|
+
const [head, ...rest] = path68;
|
|
32038
32119
|
if (head === void 0) {
|
|
32039
32120
|
return;
|
|
32040
32121
|
}
|
|
@@ -32052,13 +32133,13 @@ function removeAt(target, path66) {
|
|
|
32052
32133
|
}
|
|
32053
32134
|
function applyStatuslineChange(existing, change) {
|
|
32054
32135
|
const draft = structuredClone(existing ?? {});
|
|
32055
|
-
for (const [
|
|
32056
|
-
keyNamed(
|
|
32057
|
-
setAt(draft,
|
|
32136
|
+
for (const [path68, value2] of Object.entries(change.set ?? {})) {
|
|
32137
|
+
keyNamed(path68);
|
|
32138
|
+
setAt(draft, path68.split("."), value2);
|
|
32058
32139
|
}
|
|
32059
|
-
for (const
|
|
32060
|
-
keyNamed(
|
|
32061
|
-
removeAt(draft,
|
|
32140
|
+
for (const path68 of change.unset ?? []) {
|
|
32141
|
+
keyNamed(path68);
|
|
32142
|
+
removeAt(draft, path68.split("."));
|
|
32062
32143
|
}
|
|
32063
32144
|
const result = StatuslineSchema.safeParse(draft);
|
|
32064
32145
|
if (!result.success) {
|
|
@@ -35117,7 +35198,7 @@ function keyUsageExtension(bits) {
|
|
|
35117
35198
|
}
|
|
35118
35199
|
function ipv6Groups(address) {
|
|
35119
35200
|
const [head = "", tail] = address.split("::");
|
|
35120
|
-
const split = (
|
|
35201
|
+
const split = (text4) => text4 === "" ? [] : text4.split(":");
|
|
35121
35202
|
const expand = (groups) => groups.flatMap((group) => {
|
|
35122
35203
|
if (!import_node_net.default.isIPv4(group)) {
|
|
35123
35204
|
return [Number.parseInt(group, HEX_RADIX)];
|
|
@@ -35182,11 +35263,11 @@ function subjectNameOf(certificateDer) {
|
|
|
35182
35263
|
}
|
|
35183
35264
|
return Buffer.from(certificateDer.subarray(subject.start, subject.end));
|
|
35184
35265
|
}
|
|
35185
|
-
function toPem(
|
|
35266
|
+
function toPem(label2, der) {
|
|
35186
35267
|
const body = Buffer.from(der).toString("base64").match(/.{1,64}/g) ?? [];
|
|
35187
|
-
return `-----BEGIN ${
|
|
35268
|
+
return `-----BEGIN ${label2}-----
|
|
35188
35269
|
${body.join("\n")}
|
|
35189
|
-
-----END ${
|
|
35270
|
+
-----END ${label2}-----
|
|
35190
35271
|
`;
|
|
35191
35272
|
}
|
|
35192
35273
|
function randomSerial() {
|
|
@@ -35451,11 +35532,11 @@ function identifyRequest(headers) {
|
|
|
35451
35532
|
function directOrigin2(port) {
|
|
35452
35533
|
return `http://127.0.0.1:${String(port)}`;
|
|
35453
35534
|
}
|
|
35454
|
-
function parseProviderPath(
|
|
35455
|
-
if (!
|
|
35535
|
+
function parseProviderPath(path68) {
|
|
35536
|
+
if (!path68.startsWith(PROVIDER_PATH_PREFIX)) {
|
|
35456
35537
|
return void 0;
|
|
35457
35538
|
}
|
|
35458
|
-
const tail =
|
|
35539
|
+
const tail = path68.slice(PROVIDER_PATH_PREFIX.length);
|
|
35459
35540
|
const slash = tail.indexOf("/");
|
|
35460
35541
|
if (slash <= 0) {
|
|
35461
35542
|
return void 0;
|
|
@@ -35728,8 +35809,8 @@ function parseConnectTarget(authority) {
|
|
|
35728
35809
|
}
|
|
35729
35810
|
return { host, port };
|
|
35730
35811
|
}
|
|
35731
|
-
function servedByPipeline(
|
|
35732
|
-
return
|
|
35812
|
+
function servedByPipeline(path68) {
|
|
35813
|
+
return path68?.startsWith(ROUTED_PATH_PREFIX) === true;
|
|
35733
35814
|
}
|
|
35734
35815
|
function forwardableHeaders(headers) {
|
|
35735
35816
|
const connectionTokens = new Set(
|
|
@@ -36207,7 +36288,7 @@ var init_package = __esm({
|
|
|
36207
36288
|
"package.json"() {
|
|
36208
36289
|
package_default = {
|
|
36209
36290
|
name: "claude-use",
|
|
36210
|
-
version: "11.
|
|
36291
|
+
version: "11.54.0",
|
|
36211
36292
|
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
36293
|
license: "MIT",
|
|
36213
36294
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -36471,9 +36552,9 @@ function errorInfo(raw) {
|
|
|
36471
36552
|
function isObject3(value2) {
|
|
36472
36553
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
36473
36554
|
}
|
|
36474
|
-
function parseJson2(
|
|
36555
|
+
function parseJson2(text4) {
|
|
36475
36556
|
try {
|
|
36476
|
-
const parsed = JSON.parse(
|
|
36557
|
+
const parsed = JSON.parse(text4);
|
|
36477
36558
|
return parsed;
|
|
36478
36559
|
} catch {
|
|
36479
36560
|
return void 0;
|
|
@@ -36521,26 +36602,26 @@ function createSseScanner() {
|
|
|
36521
36602
|
return void 0;
|
|
36522
36603
|
};
|
|
36523
36604
|
const completeLine = (complete) => {
|
|
36524
|
-
const
|
|
36525
|
-
if (
|
|
36605
|
+
const text4 = complete.endsWith("\r") ? complete.slice(0, -1) : complete;
|
|
36606
|
+
if (text4 === "") {
|
|
36526
36607
|
dispatch();
|
|
36527
36608
|
return;
|
|
36528
36609
|
}
|
|
36529
|
-
if (
|
|
36530
|
-
eventName =
|
|
36610
|
+
if (text4.startsWith("event:")) {
|
|
36611
|
+
eventName = text4.slice("event:".length).trim();
|
|
36531
36612
|
return;
|
|
36532
36613
|
}
|
|
36533
|
-
if (
|
|
36534
|
-
const value2 =
|
|
36614
|
+
if (text4.startsWith("data:")) {
|
|
36615
|
+
const value2 = text4.slice("data:".length);
|
|
36535
36616
|
data.push(value2.startsWith(" ") ? value2.slice(1) : value2);
|
|
36536
36617
|
}
|
|
36537
36618
|
};
|
|
36538
36619
|
return {
|
|
36539
|
-
push: (
|
|
36620
|
+
push: (text4) => {
|
|
36540
36621
|
let start = 0;
|
|
36541
36622
|
for (; ; ) {
|
|
36542
|
-
const newline =
|
|
36543
|
-
const piece = newline === -1 ?
|
|
36623
|
+
const newline = text4.indexOf("\n", start);
|
|
36624
|
+
const piece = newline === -1 ? text4.slice(start) : text4.slice(start, newline);
|
|
36544
36625
|
if (!skipping) {
|
|
36545
36626
|
line += piece;
|
|
36546
36627
|
if (worthKeeping(line) === false) {
|
|
@@ -36654,8 +36735,8 @@ function createJsonScanner() {
|
|
|
36654
36735
|
}
|
|
36655
36736
|
};
|
|
36656
36737
|
return {
|
|
36657
|
-
push: (
|
|
36658
|
-
for (const char of
|
|
36738
|
+
push: (text4) => {
|
|
36739
|
+
for (const char of text4) {
|
|
36659
36740
|
step2(char);
|
|
36660
36741
|
}
|
|
36661
36742
|
},
|
|
@@ -36729,12 +36810,12 @@ function decoderFor(encoding) {
|
|
|
36729
36810
|
return void 0;
|
|
36730
36811
|
}
|
|
36731
36812
|
}
|
|
36732
|
-
function destinationOf(
|
|
36733
|
-
const scoped = parseProviderPath(
|
|
36813
|
+
function destinationOf(path68, sessionProvider) {
|
|
36814
|
+
const scoped = parseProviderPath(path68);
|
|
36734
36815
|
if (scoped !== void 0) {
|
|
36735
36816
|
return { provider: scoped.provider, endpoint: scoped.rest };
|
|
36736
36817
|
}
|
|
36737
|
-
return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint:
|
|
36818
|
+
return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint: path68 };
|
|
36738
36819
|
}
|
|
36739
36820
|
function modelChoiceOf(event, servedModel, provider) {
|
|
36740
36821
|
if (event.modelChoice !== void 0) return event.modelChoice;
|
|
@@ -36782,13 +36863,13 @@ function createUsageMiddleware(deps) {
|
|
|
36782
36863
|
const scanner = scannerFor(event.headers);
|
|
36783
36864
|
const decoder = scanner === void 0 ? null : decoderFor(headerValue(event.headers, "content-encoding"));
|
|
36784
36865
|
let scanning = scanner !== void 0 && decoder !== void 0;
|
|
36785
|
-
const
|
|
36866
|
+
const text4 = new TextDecoder();
|
|
36786
36867
|
const feed = (bytes, final) => {
|
|
36787
36868
|
if (!scanning || scanner === void 0) {
|
|
36788
36869
|
return;
|
|
36789
36870
|
}
|
|
36790
36871
|
try {
|
|
36791
|
-
scanner.push(
|
|
36872
|
+
scanner.push(text4.decode(bytes, { stream: !final }));
|
|
36792
36873
|
} catch (error63) {
|
|
36793
36874
|
scanning = false;
|
|
36794
36875
|
deps.log(`usage: body scan failed for ${event.route}: ${error63 instanceof Error ? error63.message : String(error63)}`);
|
|
@@ -36968,13 +37049,13 @@ function windowRatio(records) {
|
|
|
36968
37049
|
function percent(fraction) {
|
|
36969
37050
|
return `${String(Math.round(fraction * PERCENT))}%`;
|
|
36970
37051
|
}
|
|
36971
|
-
function describeWindow(
|
|
37052
|
+
function describeWindow(label2, window, effective, nowMs) {
|
|
36972
37053
|
if (effective.reset) {
|
|
36973
|
-
return `${
|
|
37054
|
+
return `${label2} window has reset`;
|
|
36974
37055
|
}
|
|
36975
37056
|
const used = effective.utilization === void 0 ? "usage unknown" : `${percent(effective.utilization)} used`;
|
|
36976
37057
|
const resets = effective.resetsAtMs === void 0 ? "" : `, resets in ${formatAge(effective.resetsAtMs - nowMs)}`;
|
|
36977
|
-
return `${
|
|
37058
|
+
return `${label2} ${used}${resets}${window.status === "allowed_warning" ? " (nearly used)" : ""}`;
|
|
36978
37059
|
}
|
|
36979
37060
|
function capacityOf(plan) {
|
|
36980
37061
|
return plan.kind === "subscription" ? plan.capacity : 1;
|
|
@@ -37963,9 +38044,9 @@ function buildFamilies(refs, models) {
|
|
|
37963
38044
|
const groups = [];
|
|
37964
38045
|
for (const ref of refs) {
|
|
37965
38046
|
const pinnedKey = Object.entries(settingsByKey).find(([, settings2]) => pinnedTo(settings2, ref))?.[0];
|
|
37966
|
-
const
|
|
37967
|
-
if (
|
|
37968
|
-
|
|
38047
|
+
const joined3 = groups.find((group) => pinnedKey === void 0 ? group.refs.some((first) => sameModel(first, ref, assertions)) : group.key === pinnedKey);
|
|
38048
|
+
if (joined3 !== void 0) {
|
|
38049
|
+
joined3.refs.push(ref);
|
|
37969
38050
|
} else {
|
|
37970
38051
|
groups.push({ key: pinnedKey ?? familyKeyOf(modelOf(ref)), refs: [ref] });
|
|
37971
38052
|
}
|
|
@@ -39704,14 +39785,14 @@ var require_util2 = __commonJS({
|
|
|
39704
39785
|
}
|
|
39705
39786
|
const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
|
|
39706
39787
|
let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
|
|
39707
|
-
let
|
|
39788
|
+
let path68 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
|
|
39708
39789
|
if (origin[origin.length - 1] === "/") {
|
|
39709
39790
|
origin = origin.slice(0, origin.length - 1);
|
|
39710
39791
|
}
|
|
39711
|
-
if (
|
|
39712
|
-
|
|
39792
|
+
if (path68 && path68[0] !== "/") {
|
|
39793
|
+
path68 = `/${path68}`;
|
|
39713
39794
|
}
|
|
39714
|
-
return new URL(`${origin}${
|
|
39795
|
+
return new URL(`${origin}${path68}`);
|
|
39715
39796
|
}
|
|
39716
39797
|
if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
|
|
39717
39798
|
throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -40532,9 +40613,9 @@ var require_diagnostics = __commonJS({
|
|
|
40532
40613
|
"undici:client:sendHeaders",
|
|
40533
40614
|
(evt) => {
|
|
40534
40615
|
const {
|
|
40535
|
-
request: { method, path:
|
|
40616
|
+
request: { method, path: path68, origin }
|
|
40536
40617
|
} = evt;
|
|
40537
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
40618
|
+
debugLog("sending request to %s %s%s", method, origin, path68);
|
|
40538
40619
|
}
|
|
40539
40620
|
);
|
|
40540
40621
|
}
|
|
@@ -40552,14 +40633,14 @@ var require_diagnostics = __commonJS({
|
|
|
40552
40633
|
"undici:request:headers",
|
|
40553
40634
|
(evt) => {
|
|
40554
40635
|
const {
|
|
40555
|
-
request: { method, path:
|
|
40636
|
+
request: { method, path: path68, origin },
|
|
40556
40637
|
response: { statusCode }
|
|
40557
40638
|
} = evt;
|
|
40558
40639
|
debugLog(
|
|
40559
40640
|
"received response to %s %s%s - HTTP %d",
|
|
40560
40641
|
method,
|
|
40561
40642
|
origin,
|
|
40562
|
-
|
|
40643
|
+
path68,
|
|
40563
40644
|
statusCode
|
|
40564
40645
|
);
|
|
40565
40646
|
}
|
|
@@ -40568,23 +40649,23 @@ var require_diagnostics = __commonJS({
|
|
|
40568
40649
|
"undici:request:trailers",
|
|
40569
40650
|
(evt) => {
|
|
40570
40651
|
const {
|
|
40571
|
-
request: { method, path:
|
|
40652
|
+
request: { method, path: path68, origin }
|
|
40572
40653
|
} = evt;
|
|
40573
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
40654
|
+
debugLog("trailers received from %s %s%s", method, origin, path68);
|
|
40574
40655
|
}
|
|
40575
40656
|
);
|
|
40576
40657
|
diagnosticsChannel.subscribe(
|
|
40577
40658
|
"undici:request:error",
|
|
40578
40659
|
(evt) => {
|
|
40579
40660
|
const {
|
|
40580
|
-
request: { method, path:
|
|
40661
|
+
request: { method, path: path68, origin },
|
|
40581
40662
|
error: error63
|
|
40582
40663
|
} = evt;
|
|
40583
40664
|
debugLog(
|
|
40584
40665
|
"request to %s %s%s errored - %s",
|
|
40585
40666
|
method,
|
|
40586
40667
|
origin,
|
|
40587
|
-
|
|
40668
|
+
path68,
|
|
40588
40669
|
error63.message
|
|
40589
40670
|
);
|
|
40590
40671
|
}
|
|
@@ -40699,7 +40780,7 @@ var require_request = __commonJS({
|
|
|
40699
40780
|
var kHandler = /* @__PURE__ */ Symbol("handler");
|
|
40700
40781
|
var Request2 = class {
|
|
40701
40782
|
constructor(origin, {
|
|
40702
|
-
path:
|
|
40783
|
+
path: path68,
|
|
40703
40784
|
method,
|
|
40704
40785
|
body,
|
|
40705
40786
|
headers,
|
|
@@ -40716,11 +40797,11 @@ var require_request = __commonJS({
|
|
|
40716
40797
|
maxRedirections,
|
|
40717
40798
|
typeOfService
|
|
40718
40799
|
}, handler) {
|
|
40719
|
-
if (typeof
|
|
40800
|
+
if (typeof path68 !== "string") {
|
|
40720
40801
|
throw new InvalidArgumentError2("path must be a string");
|
|
40721
|
-
} else if (
|
|
40802
|
+
} else if (path68[0] !== "/" && !(path68.startsWith("http://") || path68.startsWith("https://")) && method !== "CONNECT") {
|
|
40722
40803
|
throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
|
|
40723
|
-
} else if (invalidPathRegex.test(
|
|
40804
|
+
} else if (invalidPathRegex.test(path68)) {
|
|
40724
40805
|
throw new InvalidArgumentError2("invalid request path");
|
|
40725
40806
|
}
|
|
40726
40807
|
if (typeof method !== "string") {
|
|
@@ -40795,7 +40876,7 @@ var require_request = __commonJS({
|
|
|
40795
40876
|
this.completed = false;
|
|
40796
40877
|
this.aborted = false;
|
|
40797
40878
|
this.upgrade = upgrade || null;
|
|
40798
|
-
this.path = query ? serializePathWithQuery(
|
|
40879
|
+
this.path = query ? serializePathWithQuery(path68, query) : path68;
|
|
40799
40880
|
this.origin = origin;
|
|
40800
40881
|
this.protocol = getProtocolFromUrlString(origin);
|
|
40801
40882
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -45977,7 +46058,7 @@ var require_client_h1 = __commonJS({
|
|
|
45977
46058
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
45978
46059
|
}
|
|
45979
46060
|
function writeH1(client, request7) {
|
|
45980
|
-
const { method, path:
|
|
46061
|
+
const { method, path: path68, host, upgrade, blocking, reset } = request7;
|
|
45981
46062
|
let { body, headers, contentLength } = request7;
|
|
45982
46063
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
45983
46064
|
if (util2.isFormDataLike(body)) {
|
|
@@ -46055,7 +46136,7 @@ var require_client_h1 = __commonJS({
|
|
|
46055
46136
|
if (socket.setTypeOfService) {
|
|
46056
46137
|
socket.setTypeOfService(request7.typeOfService);
|
|
46057
46138
|
}
|
|
46058
|
-
let header = `${method} ${
|
|
46139
|
+
let header = `${method} ${path68} HTTP/1.1\r
|
|
46059
46140
|
`;
|
|
46060
46141
|
if (typeof host === "string") {
|
|
46061
46142
|
header += `host: ${host}\r
|
|
@@ -46734,7 +46815,7 @@ var require_client_h2 = __commonJS({
|
|
|
46734
46815
|
const headersTimeout = request7.headersTimeout ?? client[kHeadersTimeout];
|
|
46735
46816
|
const bodyTimeout = request7.bodyTimeout ?? client[kBodyTimeout];
|
|
46736
46817
|
const session = client[kHTTP2Session];
|
|
46737
|
-
const { method, path:
|
|
46818
|
+
const { method, path: path68, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
|
|
46738
46819
|
let { body } = request7;
|
|
46739
46820
|
if (upgrade != null && upgrade !== "websocket") {
|
|
46740
46821
|
util2.errorRequest(client, request7, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
@@ -46803,7 +46884,7 @@ var require_client_h2 = __commonJS({
|
|
|
46803
46884
|
}
|
|
46804
46885
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
46805
46886
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
46806
|
-
headers[HTTP2_HEADER_PATH] =
|
|
46887
|
+
headers[HTTP2_HEADER_PATH] = path68;
|
|
46807
46888
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
46808
46889
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
46809
46890
|
} else {
|
|
@@ -46845,7 +46926,7 @@ var require_client_h2 = __commonJS({
|
|
|
46845
46926
|
stream.setTimeout(headersTimeout);
|
|
46846
46927
|
return true;
|
|
46847
46928
|
}
|
|
46848
|
-
headers[HTTP2_HEADER_PATH] =
|
|
46929
|
+
headers[HTTP2_HEADER_PATH] = path68;
|
|
46849
46930
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
46850
46931
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
46851
46932
|
if (body && typeof body.read === "function") {
|
|
@@ -49197,10 +49278,10 @@ var require_proxy_agent = __commonJS({
|
|
|
49197
49278
|
};
|
|
49198
49279
|
const {
|
|
49199
49280
|
origin,
|
|
49200
|
-
path:
|
|
49281
|
+
path: path68 = "/",
|
|
49201
49282
|
headers = {}
|
|
49202
49283
|
} = opts;
|
|
49203
|
-
opts.path = origin +
|
|
49284
|
+
opts.path = origin + path68;
|
|
49204
49285
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
49205
49286
|
const { host } = new URL(origin);
|
|
49206
49287
|
headers.host = host;
|
|
@@ -51309,20 +51390,20 @@ var require_mock_utils = __commonJS({
|
|
|
51309
51390
|
}
|
|
51310
51391
|
return normalizedQp;
|
|
51311
51392
|
}
|
|
51312
|
-
function safeUrl(
|
|
51313
|
-
if (typeof
|
|
51314
|
-
return
|
|
51393
|
+
function safeUrl(path68) {
|
|
51394
|
+
if (typeof path68 !== "string") {
|
|
51395
|
+
return path68;
|
|
51315
51396
|
}
|
|
51316
|
-
const pathSegments =
|
|
51397
|
+
const pathSegments = path68.split("?", 3);
|
|
51317
51398
|
if (pathSegments.length !== 2) {
|
|
51318
|
-
return
|
|
51399
|
+
return path68;
|
|
51319
51400
|
}
|
|
51320
51401
|
const qp2 = new URLSearchParams(pathSegments.pop());
|
|
51321
51402
|
qp2.sort();
|
|
51322
51403
|
return [...pathSegments, qp2.toString()].join("?");
|
|
51323
51404
|
}
|
|
51324
|
-
function matchKey(mockDispatch2, { path:
|
|
51325
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
51405
|
+
function matchKey(mockDispatch2, { path: path68, method, body, headers }) {
|
|
51406
|
+
const pathMatch = matchValue(mockDispatch2.path, path68);
|
|
51326
51407
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
51327
51408
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
51328
51409
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -51347,8 +51428,8 @@ var require_mock_utils = __commonJS({
|
|
|
51347
51428
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
51348
51429
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
51349
51430
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
51350
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
51351
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
51431
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path68, ignoreTrailingSlash }) => {
|
|
51432
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path68)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path68), resolvedPath);
|
|
51352
51433
|
});
|
|
51353
51434
|
if (matchedMockDispatches.length === 0) {
|
|
51354
51435
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -51387,19 +51468,19 @@ var require_mock_utils = __commonJS({
|
|
|
51387
51468
|
mockDispatches.splice(index, 1);
|
|
51388
51469
|
}
|
|
51389
51470
|
}
|
|
51390
|
-
function removeTrailingSlash(
|
|
51391
|
-
while (
|
|
51392
|
-
|
|
51471
|
+
function removeTrailingSlash(path68) {
|
|
51472
|
+
while (path68.endsWith("/")) {
|
|
51473
|
+
path68 = path68.slice(0, -1);
|
|
51393
51474
|
}
|
|
51394
|
-
if (
|
|
51395
|
-
|
|
51475
|
+
if (path68.length === 0) {
|
|
51476
|
+
path68 = "/";
|
|
51396
51477
|
}
|
|
51397
|
-
return
|
|
51478
|
+
return path68;
|
|
51398
51479
|
}
|
|
51399
51480
|
function buildKey(opts) {
|
|
51400
|
-
const { path:
|
|
51481
|
+
const { path: path68, method, body, headers, query } = opts;
|
|
51401
51482
|
return {
|
|
51402
|
-
path:
|
|
51483
|
+
path: path68,
|
|
51403
51484
|
method,
|
|
51404
51485
|
body,
|
|
51405
51486
|
headers,
|
|
@@ -52089,10 +52170,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
52089
52170
|
}
|
|
52090
52171
|
format(pendingInterceptors) {
|
|
52091
52172
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
52092
|
-
({ method, path:
|
|
52173
|
+
({ method, path: path68, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
52093
52174
|
Method: method,
|
|
52094
52175
|
Origin: origin,
|
|
52095
|
-
Path:
|
|
52176
|
+
Path: path68,
|
|
52096
52177
|
"Status code": statusCode,
|
|
52097
52178
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
52098
52179
|
Invocations: timesInvoked,
|
|
@@ -52174,9 +52255,9 @@ var require_mock_agent = __commonJS({
|
|
|
52174
52255
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
52175
52256
|
const dispatchOpts = { ...opts };
|
|
52176
52257
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
52177
|
-
const [
|
|
52258
|
+
const [path68, searchParams] = dispatchOpts.path.split("?");
|
|
52178
52259
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
52179
|
-
dispatchOpts.path = `${
|
|
52260
|
+
dispatchOpts.path = `${path68}?${normalizedSearchParams}`;
|
|
52180
52261
|
}
|
|
52181
52262
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
52182
52263
|
}
|
|
@@ -52577,12 +52658,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
52577
52658
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
52578
52659
|
*/
|
|
52579
52660
|
async loadSnapshots(filePath) {
|
|
52580
|
-
const
|
|
52581
|
-
if (!
|
|
52661
|
+
const path68 = filePath || this.#snapshotPath;
|
|
52662
|
+
if (!path68) {
|
|
52582
52663
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
52583
52664
|
}
|
|
52584
52665
|
try {
|
|
52585
|
-
const data = await readFile(resolve2(
|
|
52666
|
+
const data = await readFile(resolve2(path68), "utf8");
|
|
52586
52667
|
const parsed = JSON.parse(data);
|
|
52587
52668
|
if (Array.isArray(parsed)) {
|
|
52588
52669
|
this.#snapshots.clear();
|
|
@@ -52596,7 +52677,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
52596
52677
|
if (error63.code === "ENOENT") {
|
|
52597
52678
|
this.#snapshots.clear();
|
|
52598
52679
|
} else {
|
|
52599
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
52680
|
+
throw new UndiciError(`Failed to load snapshots from ${path68}`, { cause: error63 });
|
|
52600
52681
|
}
|
|
52601
52682
|
}
|
|
52602
52683
|
}
|
|
@@ -52607,11 +52688,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
52607
52688
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
52608
52689
|
*/
|
|
52609
52690
|
async saveSnapshots(filePath) {
|
|
52610
|
-
const
|
|
52611
|
-
if (!
|
|
52691
|
+
const path68 = filePath || this.#snapshotPath;
|
|
52692
|
+
if (!path68) {
|
|
52612
52693
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
52613
52694
|
}
|
|
52614
|
-
const resolvedPath = resolve2(
|
|
52695
|
+
const resolvedPath = resolve2(path68);
|
|
52615
52696
|
await mkdir(dirname3(resolvedPath), { recursive: true });
|
|
52616
52697
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
52617
52698
|
hash: hash2,
|
|
@@ -53243,15 +53324,15 @@ var require_redirect_handler = __commonJS({
|
|
|
53243
53324
|
return;
|
|
53244
53325
|
}
|
|
53245
53326
|
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}${
|
|
53327
|
+
const path68 = search ? `${pathname}${search}` : pathname;
|
|
53328
|
+
const redirectUrlString = `${origin}${path68}`;
|
|
53248
53329
|
for (const historyUrl of this.history) {
|
|
53249
53330
|
if (historyUrl.toString() === redirectUrlString) {
|
|
53250
53331
|
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
53332
|
}
|
|
53252
53333
|
}
|
|
53253
53334
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
53254
|
-
this.opts.path =
|
|
53335
|
+
this.opts.path = path68;
|
|
53255
53336
|
this.opts.origin = origin;
|
|
53256
53337
|
this.opts.query = null;
|
|
53257
53338
|
}
|
|
@@ -55011,10 +55092,10 @@ var require_cache_handler = __commonJS({
|
|
|
55011
55092
|
}
|
|
55012
55093
|
return locationUrl.pathname + locationUrl.search;
|
|
55013
55094
|
}
|
|
55014
|
-
function deleteCachedUri(store, cacheKey,
|
|
55095
|
+
function deleteCachedUri(store, cacheKey, path68) {
|
|
55015
55096
|
deleteCachedValue(store, {
|
|
55016
55097
|
...cacheKey,
|
|
55017
|
-
path:
|
|
55098
|
+
path: path68
|
|
55018
55099
|
});
|
|
55019
55100
|
for (let i10 = 0; i10 < util2.safeHTTPMethods.length; i10++) {
|
|
55020
55101
|
const method = util2.safeHTTPMethods[i10];
|
|
@@ -55022,7 +55103,7 @@ var require_cache_handler = __commonJS({
|
|
|
55022
55103
|
deleteCachedValue(store, {
|
|
55023
55104
|
...cacheKey,
|
|
55024
55105
|
method,
|
|
55025
|
-
path:
|
|
55106
|
+
path: path68
|
|
55026
55107
|
});
|
|
55027
55108
|
}
|
|
55028
55109
|
}
|
|
@@ -55033,9 +55114,9 @@ var require_cache_handler = __commonJS({
|
|
|
55033
55114
|
}
|
|
55034
55115
|
const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
|
|
55035
55116
|
for (let i10 = 0; i10 < values.length; i10++) {
|
|
55036
|
-
const
|
|
55037
|
-
if (
|
|
55038
|
-
deleteCachedUri(store, cacheKey,
|
|
55117
|
+
const path68 = getSameOriginPath(cacheKey, values[i10]);
|
|
55118
|
+
if (path68 !== void 0) {
|
|
55119
|
+
deleteCachedUri(store, cacheKey, path68);
|
|
55039
55120
|
}
|
|
55040
55121
|
}
|
|
55041
55122
|
}
|
|
@@ -60035,11 +60116,11 @@ var require_fetch = __commonJS({
|
|
|
60035
60116
|
function dispatch({ body }) {
|
|
60036
60117
|
const url2 = requestCurrentURL(request7);
|
|
60037
60118
|
const agent = fetchParams.controller.dispatcher;
|
|
60038
|
-
const
|
|
60119
|
+
const path68 = url2.pathname + url2.search;
|
|
60039
60120
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
60040
60121
|
return new Promise((resolve2, reject) => agent.dispatch(
|
|
60041
60122
|
{
|
|
60042
|
-
path: hasTrailingQuestionMark ? `${
|
|
60123
|
+
path: hasTrailingQuestionMark ? `${path68}?` : path68,
|
|
60043
60124
|
origin: url2.origin,
|
|
60044
60125
|
method: request7.method,
|
|
60045
60126
|
body: agent.isMockActive ? request7.body && (request7.body.source || request7.body.stream) : body,
|
|
@@ -60986,9 +61067,9 @@ var require_util5 = __commonJS({
|
|
|
60986
61067
|
}
|
|
60987
61068
|
}
|
|
60988
61069
|
}
|
|
60989
|
-
function validateCookiePath(
|
|
60990
|
-
for (let i10 = 0; i10 <
|
|
60991
|
-
const code =
|
|
61070
|
+
function validateCookiePath(path68) {
|
|
61071
|
+
for (let i10 = 0; i10 < path68.length; ++i10) {
|
|
61072
|
+
const code = path68.charCodeAt(i10);
|
|
60992
61073
|
if (code < 32 || // exclude CTLs (0-31)
|
|
60993
61074
|
code > 126 || // exclude DEL and non-ascii
|
|
60994
61075
|
code === 59) {
|
|
@@ -64336,11 +64417,11 @@ var require_undici = __commonJS({
|
|
|
64336
64417
|
if (typeof opts.path !== "string") {
|
|
64337
64418
|
throw new InvalidArgumentError2("invalid opts.path");
|
|
64338
64419
|
}
|
|
64339
|
-
let
|
|
64420
|
+
let path68 = opts.path;
|
|
64340
64421
|
if (!opts.path.startsWith("/")) {
|
|
64341
|
-
|
|
64422
|
+
path68 = `/${path68}`;
|
|
64342
64423
|
}
|
|
64343
|
-
url2 = new URL(util2.parseOrigin(url2).origin +
|
|
64424
|
+
url2 = new URL(util2.parseOrigin(url2).origin + path68);
|
|
64344
64425
|
} else {
|
|
64345
64426
|
if (!opts) {
|
|
64346
64427
|
opts = typeof url2 === "object" ? url2 : {};
|
|
@@ -64881,15 +64962,15 @@ var init_realFrontDoorPort = __esm({
|
|
|
64881
64962
|
|
|
64882
64963
|
// src/update/update.ts
|
|
64883
64964
|
function compareVersions3(left, right) {
|
|
64884
|
-
const
|
|
64965
|
+
const parse5 = (version2) => {
|
|
64885
64966
|
const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version2);
|
|
64886
64967
|
if (match === null) {
|
|
64887
64968
|
throw new Error(`not a plain release version: ${version2}`);
|
|
64888
64969
|
}
|
|
64889
64970
|
return [Number(match[1]), Number(match[2]), Number(match[3])];
|
|
64890
64971
|
};
|
|
64891
|
-
const leftParts =
|
|
64892
|
-
const rightParts =
|
|
64972
|
+
const leftParts = parse5(left);
|
|
64973
|
+
const rightParts = parse5(right);
|
|
64893
64974
|
return leftParts.map((part, index) => part - (rightParts[index] ?? 0)).find((difference) => difference !== 0) ?? 0;
|
|
64894
64975
|
}
|
|
64895
64976
|
function releaseTagFromUrl(url2) {
|
|
@@ -65441,9 +65522,9 @@ function toEntries(pairs) {
|
|
|
65441
65522
|
}
|
|
65442
65523
|
return pairs;
|
|
65443
65524
|
}
|
|
65444
|
-
function parseOverride(source, raw,
|
|
65525
|
+
function parseOverride(source, raw, parse5) {
|
|
65445
65526
|
try {
|
|
65446
|
-
return
|
|
65527
|
+
return parse5(raw);
|
|
65447
65528
|
} catch (error63) {
|
|
65448
65529
|
if (error63 instanceof Error && !(error63 instanceof CliError)) {
|
|
65449
65530
|
throw new UsageError(`Invalid ${source} value "${raw}": ${error63.message}.`);
|
|
@@ -65752,8 +65833,8 @@ function countOf(usage, key) {
|
|
|
65752
65833
|
const value2 = key in usage ? Reflect.get(usage, key) : void 0;
|
|
65753
65834
|
return typeof value2 === "number" && Number.isFinite(value2) && value2 >= 0 ? value2 : 0;
|
|
65754
65835
|
}
|
|
65755
|
-
function contextTokensOfTranscript(
|
|
65756
|
-
const lines =
|
|
65836
|
+
function contextTokensOfTranscript(text4) {
|
|
65837
|
+
const lines = text4.split("\n");
|
|
65757
65838
|
for (let index = lines.length - 1; index >= 0; index -= 1) {
|
|
65758
65839
|
const line = lines[index];
|
|
65759
65840
|
if (line === void 0 || line === "") {
|
|
@@ -65804,8 +65885,8 @@ function resumedContextTokens(fs30, params) {
|
|
|
65804
65885
|
}
|
|
65805
65886
|
const projectDir = import_node_path43.default.join(params.claudeHome, "projects", projectDirNameOf(params.cwd));
|
|
65806
65887
|
const file2 = target.kind === "id" ? import_node_path43.default.join(projectDir, `${target.id}.jsonl`) : newestTranscript(fs30, projectDir);
|
|
65807
|
-
const
|
|
65808
|
-
return
|
|
65888
|
+
const text4 = file2 === void 0 ? void 0 : fs30.readFileUtf8(file2);
|
|
65889
|
+
return text4 === void 0 ? void 0 : contextTokensOfTranscript(text4);
|
|
65809
65890
|
}
|
|
65810
65891
|
var import_node_path43;
|
|
65811
65892
|
var init_resumeContext = __esm({
|
|
@@ -66068,8 +66149,8 @@ function farmRow(links, builtDirectories, adopted) {
|
|
|
66068
66149
|
const parts = [counted(links, "link", "links"), counted(builtDirectories, "built directory", "built directories"), ...adopted === 0 ? [] : [`${String(adopted)} adopted`]];
|
|
66069
66150
|
return { label: "farm", value: "resynced", detail: parts.join(", ") };
|
|
66070
66151
|
}
|
|
66071
|
-
function noteRow(
|
|
66072
|
-
return { label: "note", value:
|
|
66152
|
+
function noteRow(text4) {
|
|
66153
|
+
return { label: "note", value: text4 };
|
|
66073
66154
|
}
|
|
66074
66155
|
var init_launchReport = __esm({
|
|
66075
66156
|
"src/launcher/launchReport.ts"() {
|
|
@@ -66376,9 +66457,9 @@ function findBucket(quota, keys) {
|
|
|
66376
66457
|
return void 0;
|
|
66377
66458
|
}
|
|
66378
66459
|
function antigravityFamilyBuckets(quota) {
|
|
66379
|
-
return QUOTA_FAMILY_WINDOWS.flatMap(({ label, keys }) => {
|
|
66460
|
+
return QUOTA_FAMILY_WINDOWS.flatMap(({ label: label2, keys }) => {
|
|
66380
66461
|
const bucket = findBucket(quota, keys);
|
|
66381
|
-
return bucket === void 0 ? [] : [{ label, bucket }];
|
|
66462
|
+
return bucket === void 0 ? [] : [{ label: label2, bucket }];
|
|
66382
66463
|
});
|
|
66383
66464
|
}
|
|
66384
66465
|
function selectAntigravityBuckets(quota, model) {
|
|
@@ -66846,9 +66927,9 @@ function flattenToolResult(content) {
|
|
|
66846
66927
|
}
|
|
66847
66928
|
return content.map((block2) => isTextBlock(block2) ? block2.text : NON_TEXT_TOOL_RESULT).join("\n");
|
|
66848
66929
|
}
|
|
66849
|
-
function systemReminder(
|
|
66930
|
+
function systemReminder(text4) {
|
|
66850
66931
|
return `<system-reminder>
|
|
66851
|
-
${
|
|
66932
|
+
${text4}
|
|
66852
66933
|
</system-reminder>`;
|
|
66853
66934
|
}
|
|
66854
66935
|
function turnBlocks(message) {
|
|
@@ -67085,9 +67166,9 @@ function flattenToolResult2(content) {
|
|
|
67085
67166
|
}
|
|
67086
67167
|
return content.map((block2) => isTextBlock(block2) ? block2.text : NON_TEXT_TOOL_RESULT2).join("\n");
|
|
67087
67168
|
}
|
|
67088
|
-
function systemReminder2(
|
|
67169
|
+
function systemReminder2(text4) {
|
|
67089
67170
|
return `<system-reminder>
|
|
67090
|
-
${
|
|
67171
|
+
${text4}
|
|
67091
67172
|
</system-reminder>`;
|
|
67092
67173
|
}
|
|
67093
67174
|
function turnBlocks2(message) {
|
|
@@ -67212,12 +67293,12 @@ var init_translate2 = __esm({
|
|
|
67212
67293
|
function catalogueCachePath(paths, name) {
|
|
67213
67294
|
return import_node_path44.default.join(paths.catalogueDir, `${name}.json`);
|
|
67214
67295
|
}
|
|
67215
|
-
function parseCatalogueCache(
|
|
67216
|
-
if (
|
|
67296
|
+
function parseCatalogueCache(text4) {
|
|
67297
|
+
if (text4 === void 0) {
|
|
67217
67298
|
return void 0;
|
|
67218
67299
|
}
|
|
67219
67300
|
try {
|
|
67220
|
-
const parsed = CatalogueCacheSchema.safeParse(JSON.parse(
|
|
67301
|
+
const parsed = CatalogueCacheSchema.safeParse(JSON.parse(text4));
|
|
67221
67302
|
return parsed.success ? parsed.data : void 0;
|
|
67222
67303
|
} catch {
|
|
67223
67304
|
return void 0;
|
|
@@ -67243,8 +67324,8 @@ function modelOf2(entry) {
|
|
|
67243
67324
|
if (!isRecord9(entry) || typeof entry.id !== "string" || entry.id.trim() === "") {
|
|
67244
67325
|
return void 0;
|
|
67245
67326
|
}
|
|
67246
|
-
const
|
|
67247
|
-
const name =
|
|
67327
|
+
const label2 = typeof entry.display_name === "string" ? entry.display_name : typeof entry.name === "string" ? entry.name : void 0;
|
|
67328
|
+
const name = label2?.trim();
|
|
67248
67329
|
return name === void 0 || name === "" ? { id: entry.id.trim() } : { id: entry.id.trim(), name };
|
|
67249
67330
|
}
|
|
67250
67331
|
function parseCatalogueBody(body) {
|
|
@@ -67422,8 +67503,8 @@ function addSameGroup(paths, refs) {
|
|
|
67422
67503
|
const current = readModels(paths) ?? {};
|
|
67423
67504
|
const overlapping = (current.same ?? []).filter((group) => group.some((ref) => refs.includes(ref)));
|
|
67424
67505
|
const rest = (current.same ?? []).filter((group) => !overlapping.includes(group));
|
|
67425
|
-
const
|
|
67426
|
-
writeModels(paths, stripEmpty({ ...current, same: [...rest,
|
|
67506
|
+
const joined3 = [.../* @__PURE__ */ new Set([...overlapping.flat(), ...refs])];
|
|
67507
|
+
writeModels(paths, stripEmpty({ ...current, same: [...rest, joined3] }));
|
|
67427
67508
|
}
|
|
67428
67509
|
function addDistinctPair(paths, left, right) {
|
|
67429
67510
|
const current = readModels(paths) ?? {};
|
|
@@ -102794,9 +102875,9 @@ var require_codegen = __commonJS({
|
|
|
102794
102875
|
}
|
|
102795
102876
|
};
|
|
102796
102877
|
var Label = class extends Node {
|
|
102797
|
-
constructor(
|
|
102878
|
+
constructor(label2) {
|
|
102798
102879
|
super();
|
|
102799
|
-
this.label =
|
|
102880
|
+
this.label = label2;
|
|
102800
102881
|
this.names = {};
|
|
102801
102882
|
}
|
|
102802
102883
|
render({ _n }) {
|
|
@@ -102804,14 +102885,14 @@ var require_codegen = __commonJS({
|
|
|
102804
102885
|
}
|
|
102805
102886
|
};
|
|
102806
102887
|
var Break = class extends Node {
|
|
102807
|
-
constructor(
|
|
102888
|
+
constructor(label2) {
|
|
102808
102889
|
super();
|
|
102809
|
-
this.label =
|
|
102890
|
+
this.label = label2;
|
|
102810
102891
|
this.names = {};
|
|
102811
102892
|
}
|
|
102812
102893
|
render({ _n }) {
|
|
102813
|
-
const
|
|
102814
|
-
return `break${
|
|
102894
|
+
const label2 = this.label ? ` ${this.label}` : "";
|
|
102895
|
+
return `break${label2};` + _n;
|
|
102815
102896
|
}
|
|
102816
102897
|
};
|
|
102817
102898
|
var Throw = class extends Node {
|
|
@@ -103223,12 +103304,12 @@ var require_codegen = __commonJS({
|
|
|
103223
103304
|
return this._endBlockNode(For);
|
|
103224
103305
|
}
|
|
103225
103306
|
// `label` statement
|
|
103226
|
-
label(
|
|
103227
|
-
return this._leafNode(new Label(
|
|
103307
|
+
label(label2) {
|
|
103308
|
+
return this._leafNode(new Label(label2));
|
|
103228
103309
|
}
|
|
103229
103310
|
// `break` statement
|
|
103230
|
-
break(
|
|
103231
|
-
return this._leafNode(new Break(
|
|
103311
|
+
break(label2) {
|
|
103312
|
+
return this._leafNode(new Break(label2));
|
|
103232
103313
|
}
|
|
103233
103314
|
// `return` statement
|
|
103234
103315
|
return(value2) {
|
|
@@ -105604,8 +105685,8 @@ var require_utils3 = __commonJS({
|
|
|
105604
105685
|
}
|
|
105605
105686
|
return ind;
|
|
105606
105687
|
}
|
|
105607
|
-
function removeDotSegments(
|
|
105608
|
-
let input2 =
|
|
105688
|
+
function removeDotSegments(path68) {
|
|
105689
|
+
let input2 = path68;
|
|
105609
105690
|
const output2 = [];
|
|
105610
105691
|
let nextSlash = -1;
|
|
105611
105692
|
let len = 0;
|
|
@@ -106014,8 +106095,8 @@ var require_schemes = __commonJS({
|
|
|
106014
106095
|
}
|
|
106015
106096
|
if (wsComponent.resourceName) {
|
|
106016
106097
|
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
106017
|
-
const
|
|
106018
|
-
wsComponent.path =
|
|
106098
|
+
const path68 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
106099
|
+
wsComponent.path = path68 && path68 !== "/" ? path68 : void 0;
|
|
106019
106100
|
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
106020
106101
|
wsComponent.resourceName = void 0;
|
|
106021
106102
|
}
|
|
@@ -106179,7 +106260,7 @@ var require_fast_uri = __commonJS({
|
|
|
106179
106260
|
normalizeString(uri, options);
|
|
106180
106261
|
} else if (typeof uri === "object") {
|
|
106181
106262
|
uri = /** @type {T} */
|
|
106182
|
-
|
|
106263
|
+
parse5(serialize(uri, options), options);
|
|
106183
106264
|
}
|
|
106184
106265
|
return uri;
|
|
106185
106266
|
}
|
|
@@ -106219,8 +106300,8 @@ var require_fast_uri = __commonJS({
|
|
|
106219
106300
|
function resolveComponent(base, relative, options, skipNormalization) {
|
|
106220
106301
|
const target = {};
|
|
106221
106302
|
if (!skipNormalization) {
|
|
106222
|
-
base =
|
|
106223
|
-
relative =
|
|
106303
|
+
base = parse5(serialize(base, options), options);
|
|
106304
|
+
relative = parse5(serialize(relative, options), options);
|
|
106224
106305
|
}
|
|
106225
106306
|
options = options || {};
|
|
106226
106307
|
if (!options.tolerant && relative.scheme) {
|
|
@@ -106519,7 +106600,7 @@ var require_fast_uri = __commonJS({
|
|
|
106519
106600
|
}
|
|
106520
106601
|
return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
|
|
106521
106602
|
}
|
|
106522
|
-
function
|
|
106603
|
+
function parse5(uri, opts) {
|
|
106523
106604
|
return parseWithStatus(uri, opts).parsed;
|
|
106524
106605
|
}
|
|
106525
106606
|
function normalizeString(uri, opts) {
|
|
@@ -106556,7 +106637,7 @@ var require_fast_uri = __commonJS({
|
|
|
106556
106637
|
resolveComponent,
|
|
106557
106638
|
equal,
|
|
106558
106639
|
serialize,
|
|
106559
|
-
parse:
|
|
106640
|
+
parse: parse5
|
|
106560
106641
|
};
|
|
106561
106642
|
module2.exports = fastUri;
|
|
106562
106643
|
module2.exports.default = fastUri;
|
|
@@ -106967,7 +107048,7 @@ var require_core2 = __commonJS({
|
|
|
106967
107048
|
errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
106968
107049
|
if (!errors || errors.length === 0)
|
|
106969
107050
|
return "No errors";
|
|
106970
|
-
return errors.map((e14) => `${dataVar}${e14.instancePath} ${e14.message}`).reduce((
|
|
107051
|
+
return errors.map((e14) => `${dataVar}${e14.instancePath} ${e14.message}`).reduce((text4, msg) => text4 + separator + msg);
|
|
106971
107052
|
}
|
|
106972
107053
|
$dataMetaSchema(metaSchema, keywordsJsonPointers) {
|
|
106973
107054
|
const rules = this.RULES.all;
|
|
@@ -109542,7 +109623,7 @@ var require_dist2 = __commonJS({
|
|
|
109542
109623
|
});
|
|
109543
109624
|
|
|
109544
109625
|
// src/cli.ts
|
|
109545
|
-
var
|
|
109626
|
+
var import_node_path67 = __toESM(require("node:path"), 1);
|
|
109546
109627
|
|
|
109547
109628
|
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
|
|
109548
109629
|
var CommanderError = class extends Error {
|
|
@@ -112655,9 +112736,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
112655
112736
|
* @param {string} [path]
|
|
112656
112737
|
* @return {(string|null|Command)}
|
|
112657
112738
|
*/
|
|
112658
|
-
executableDir(
|
|
112659
|
-
if (
|
|
112660
|
-
this._executableDir =
|
|
112739
|
+
executableDir(path68) {
|
|
112740
|
+
if (path68 === void 0) return this._executableDir;
|
|
112741
|
+
this._executableDir = path68;
|
|
112661
112742
|
return this;
|
|
112662
112743
|
}
|
|
112663
112744
|
/**
|
|
@@ -112674,9 +112755,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
112674
112755
|
helpWidth: context.helpWidth,
|
|
112675
112756
|
outputHasColors: context.hasColors
|
|
112676
112757
|
});
|
|
112677
|
-
const
|
|
112678
|
-
if (context.hasColors) return
|
|
112679
|
-
return this._outputConfiguration.stripColor(
|
|
112758
|
+
const text4 = helper.formatHelp(this, helper);
|
|
112759
|
+
if (context.hasColors) return text4;
|
|
112760
|
+
return this._outputConfiguration.stripColor(text4);
|
|
112680
112761
|
}
|
|
112681
112762
|
/**
|
|
112682
112763
|
* @typedef HelpContext
|
|
@@ -112836,7 +112917,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
112836
112917
|
* @param {(string | Function)} text - string to add, or a function returning a string
|
|
112837
112918
|
* @return {Command} `this` command for chaining
|
|
112838
112919
|
*/
|
|
112839
|
-
addHelpText(position,
|
|
112920
|
+
addHelpText(position, text4) {
|
|
112840
112921
|
const allowedValues = ["beforeAll", "before", "after", "afterAll"];
|
|
112841
112922
|
if (!allowedValues.includes(position)) {
|
|
112842
112923
|
throw new Error(`Unexpected value for position to addHelpText.
|
|
@@ -112845,10 +112926,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
112845
112926
|
const helpEvent = `${position}Help`;
|
|
112846
112927
|
this.on(helpEvent, (context) => {
|
|
112847
112928
|
let helpStr;
|
|
112848
|
-
if (typeof
|
|
112849
|
-
helpStr =
|
|
112929
|
+
if (typeof text4 === "function") {
|
|
112930
|
+
helpStr = text4({ error: context.error, command: context.command });
|
|
112850
112931
|
} else {
|
|
112851
|
-
helpStr =
|
|
112932
|
+
helpStr = text4;
|
|
112852
112933
|
}
|
|
112853
112934
|
if (helpStr) {
|
|
112854
112935
|
context.write(`${helpStr}
|
|
@@ -114133,19 +114214,19 @@ function writePools(paths, pools) {
|
|
|
114133
114214
|
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
|
|
114134
114215
|
}
|
|
114135
114216
|
function poolCycleOf(pools, name) {
|
|
114136
|
-
const walk3 = (current,
|
|
114217
|
+
const walk3 = (current, path68) => {
|
|
114137
114218
|
for (const entry of pools[current]?.identities ?? []) {
|
|
114138
114219
|
const nested = poolNameOf(poolMemberIdentity(entry));
|
|
114139
114220
|
if (nested === void 0) {
|
|
114140
114221
|
continue;
|
|
114141
114222
|
}
|
|
114142
114223
|
if (nested === name) {
|
|
114143
|
-
return [...
|
|
114224
|
+
return [...path68, nested];
|
|
114144
114225
|
}
|
|
114145
|
-
if (
|
|
114226
|
+
if (path68.includes(nested)) {
|
|
114146
114227
|
continue;
|
|
114147
114228
|
}
|
|
114148
|
-
const found = walk3(nested, [...
|
|
114229
|
+
const found = walk3(nested, [...path68, nested]);
|
|
114149
114230
|
if (found !== void 0) {
|
|
114150
114231
|
return found;
|
|
114151
114232
|
}
|
|
@@ -115213,9 +115294,9 @@ function machineTimeZone() {
|
|
|
115213
115294
|
// src/cli/parsers.ts
|
|
115214
115295
|
init_conditions();
|
|
115215
115296
|
init_pairs();
|
|
115216
|
-
function asInvalidArgument(
|
|
115297
|
+
function asInvalidArgument(parse5) {
|
|
115217
115298
|
try {
|
|
115218
|
-
return
|
|
115299
|
+
return parse5();
|
|
115219
115300
|
} catch (error63) {
|
|
115220
115301
|
if (error63 instanceof Error && !(error63 instanceof InvalidArgumentError)) {
|
|
115221
115302
|
throw new InvalidArgumentError(error63.message);
|
|
@@ -115346,7 +115427,7 @@ function statuslineChangeOf(options) {
|
|
|
115346
115427
|
return void 0;
|
|
115347
115428
|
}
|
|
115348
115429
|
const assignments = (options.statusline ?? []).map(parseStatuslineAssignment);
|
|
115349
|
-
return { set: Object.fromEntries(assignments.map(({ path:
|
|
115430
|
+
return { set: Object.fromEntries(assignments.map(({ path: path68, value: value2 }) => [path68, value2])), unset: options.unsetStatusline ?? [] };
|
|
115350
115431
|
}
|
|
115351
115432
|
function registerProfileCommand(program2, deps) {
|
|
115352
115433
|
const { paths } = deps;
|
|
@@ -115449,13 +115530,13 @@ function registerProfileCommand(program2, deps) {
|
|
|
115449
115530
|
console.log(`Description: ${found.description}`);
|
|
115450
115531
|
}
|
|
115451
115532
|
console.log(`Extends: ${found.extends === void 0 || found.extends.length === 0 ? "(nothing)" : found.extends.join(", ")}`);
|
|
115452
|
-
for (const [
|
|
115533
|
+
for (const [label2, value2] of [
|
|
115453
115534
|
["Categories", found.categories],
|
|
115454
115535
|
["Entries", found.entries],
|
|
115455
115536
|
["Launch", found.launch]
|
|
115456
115537
|
]) {
|
|
115457
115538
|
const pairs = value2 === void 0 ? [] : Object.entries(value2);
|
|
115458
|
-
console.log(`${
|
|
115539
|
+
console.log(`${label2}: ${pairs.length === 0 ? "(none)" : pairs.map(([key, setting]) => `${key}=${JSON.stringify(setting)}`).join(", ")}`);
|
|
115459
115540
|
}
|
|
115460
115541
|
}),
|
|
115461
115542
|
["agent-shim profile show client-acme", "agent-shim profile show client-acme --json"]
|
|
@@ -117368,9 +117449,9 @@ function listDirOrReport(fs30, configDir, relative, report) {
|
|
|
117368
117449
|
return [];
|
|
117369
117450
|
}
|
|
117370
117451
|
}
|
|
117371
|
-
function parseJson3(
|
|
117452
|
+
function parseJson3(text4) {
|
|
117372
117453
|
try {
|
|
117373
|
-
const value2 = JSON.parse(
|
|
117454
|
+
const value2 = JSON.parse(text4);
|
|
117374
117455
|
return value2;
|
|
117375
117456
|
} catch {
|
|
117376
117457
|
return void 0;
|
|
@@ -117416,11 +117497,11 @@ function readSessionAgentTree(fs30, configDir, ref, options = {}) {
|
|
|
117416
117497
|
}
|
|
117417
117498
|
const agents = /* @__PURE__ */ new Map();
|
|
117418
117499
|
for (const candidate of located) {
|
|
117419
|
-
const
|
|
117420
|
-
if (
|
|
117500
|
+
const text4 = readFileOrReport(fs30, configDir, candidate.metaPath, report);
|
|
117501
|
+
if (text4 === void 0) {
|
|
117421
117502
|
continue;
|
|
117422
117503
|
}
|
|
117423
|
-
const parsed = AgentMetaSchema.safeParse(parseJson3(
|
|
117504
|
+
const parsed = AgentMetaSchema.safeParse(parseJson3(text4));
|
|
117424
117505
|
if (!parsed.success) {
|
|
117425
117506
|
report({ path: candidate.metaPath, reason: "meta file is not a JSON object with an agentType" });
|
|
117426
117507
|
continue;
|
|
@@ -117464,9 +117545,9 @@ function resolveParents(fs30, configDir, agents, report) {
|
|
|
117464
117545
|
if (cached2 !== void 0) {
|
|
117465
117546
|
return cached2;
|
|
117466
117547
|
}
|
|
117467
|
-
const
|
|
117468
|
-
transcriptCache.set(agent.located.id,
|
|
117469
|
-
return
|
|
117548
|
+
const text4 = readFileOrReport(fs30, configDir, agent.located.transcriptPath, report) ?? "";
|
|
117549
|
+
transcriptCache.set(agent.located.id, text4);
|
|
117550
|
+
return text4;
|
|
117470
117551
|
};
|
|
117471
117552
|
const wouldCycle = (child, parent) => {
|
|
117472
117553
|
for (let cursor3 = parent; cursor3 !== void 0; cursor3 = parentOf4.get(cursor3)) {
|
|
@@ -117523,11 +117604,11 @@ function readTasks(fs30, configDir, ownLists, sharedLists, report) {
|
|
|
117523
117604
|
continue;
|
|
117524
117605
|
}
|
|
117525
117606
|
const relative = import_node_path35.default.join(relativeDir, name);
|
|
117526
|
-
const
|
|
117527
|
-
const parsed = TaskFileSchema.safeParse(
|
|
117607
|
+
const text4 = readFileOrReport(fs30, configDir, relative, report);
|
|
117608
|
+
const parsed = TaskFileSchema.safeParse(text4 === void 0 ? void 0 : parseJson3(text4));
|
|
117528
117609
|
if (parsed.success) {
|
|
117529
117610
|
tasks.push(index < ownLists.length ? parsed.data : { ...parsed.data, taskList: scope });
|
|
117530
|
-
} else if (
|
|
117611
|
+
} else if (text4 !== void 0) {
|
|
117531
117612
|
report({ path: relative, reason: "task file is not a task" });
|
|
117532
117613
|
}
|
|
117533
117614
|
}
|
|
@@ -117541,10 +117622,10 @@ function readWorkflowRuns(fs30, configDir, relativeDir, report) {
|
|
|
117541
117622
|
continue;
|
|
117542
117623
|
}
|
|
117543
117624
|
const relative = import_node_path35.default.join(relativeDir, name);
|
|
117544
|
-
const
|
|
117545
|
-
const parsed = WorkflowRunFileSchema.safeParse(
|
|
117625
|
+
const text4 = readFileOrReport(fs30, configDir, relative, report);
|
|
117626
|
+
const parsed = WorkflowRunFileSchema.safeParse(text4 === void 0 ? void 0 : parseJson3(text4));
|
|
117546
117627
|
if (!parsed.success) {
|
|
117547
|
-
if (
|
|
117628
|
+
if (text4 !== void 0) {
|
|
117548
117629
|
report({ path: relative, reason: "workflow run file is not a run record" });
|
|
117549
117630
|
}
|
|
117550
117631
|
continue;
|
|
@@ -118907,8 +118988,8 @@ function finiteNumber(record2, field) {
|
|
|
118907
118988
|
const value2 = record2 === void 0 ? void 0 : record2[field];
|
|
118908
118989
|
return typeof value2 === "number" && Number.isFinite(value2) ? value2 : void 0;
|
|
118909
118990
|
}
|
|
118910
|
-
function excerpt(
|
|
118911
|
-
return
|
|
118991
|
+
function excerpt(text4) {
|
|
118992
|
+
return text4.length <= RC_PENDING_SUMMARY_EXCERPT_CHARS ? text4 : `${text4.slice(0, RC_PENDING_SUMMARY_EXCERPT_CHARS)}...`;
|
|
118912
118993
|
}
|
|
118913
118994
|
function payloadEventsOf(body) {
|
|
118914
118995
|
const parsed = parseJsonObject(body);
|
|
@@ -119013,11 +119094,11 @@ function createRcSessionTracker(deps) {
|
|
|
119013
119094
|
};
|
|
119014
119095
|
const observeExchange = (request7) => {
|
|
119015
119096
|
const method = (request7.method ?? "").toUpperCase();
|
|
119016
|
-
const
|
|
119017
|
-
if (!
|
|
119097
|
+
const path68 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
|
|
119098
|
+
if (!path68.startsWith(RC_SESSIONS_PATH_PREFIX)) {
|
|
119018
119099
|
return void 0;
|
|
119019
119100
|
}
|
|
119020
|
-
const tail =
|
|
119101
|
+
const tail = path68.slice(RC_SESSIONS_PATH_PREFIX.length);
|
|
119021
119102
|
const facts = {
|
|
119022
119103
|
oauthAuthorization: oauthAuthorizationOf(request7.headers),
|
|
119023
119104
|
anthropicVersion: singleHeader(request7.headers, "anthropic-version"),
|
|
@@ -119038,8 +119119,8 @@ function createRcSessionTracker(deps) {
|
|
|
119038
119119
|
if (!accepted2 || buffered2 >= RC_CREATE_RESPONSE_CAP_BYTES) {
|
|
119039
119120
|
return;
|
|
119040
119121
|
}
|
|
119041
|
-
const
|
|
119042
|
-
body = body +
|
|
119122
|
+
const text4 = Buffer.from(chunk2).toString("utf8");
|
|
119123
|
+
body = body + text4.slice(0, RC_CREATE_RESPONSE_CAP_BYTES - buffered2);
|
|
119043
119124
|
buffered2 = body.length;
|
|
119044
119125
|
},
|
|
119045
119126
|
onEnd: () => {
|
|
@@ -119257,13 +119338,13 @@ function teeRoutedResponse(response, observer, onSettled) {
|
|
|
119257
119338
|
}
|
|
119258
119339
|
|
|
119259
119340
|
// src/frontdoor/rcWrites.ts
|
|
119260
|
-
function buildRcUserMessagePayload(uuid3, sessionId,
|
|
119341
|
+
function buildRcUserMessagePayload(uuid3, sessionId, text4) {
|
|
119261
119342
|
return {
|
|
119262
119343
|
type: "user",
|
|
119263
119344
|
uuid: uuid3,
|
|
119264
119345
|
session_id: sessionId,
|
|
119265
119346
|
parent_tool_use_id: null,
|
|
119266
|
-
message: { role: "user", content:
|
|
119347
|
+
message: { role: "user", content: text4 }
|
|
119267
119348
|
};
|
|
119268
119349
|
}
|
|
119269
119350
|
function buildRcEventWriteBody(payload) {
|
|
@@ -119328,7 +119409,7 @@ function rcWriteHeaders(credential) {
|
|
|
119328
119409
|
}
|
|
119329
119410
|
return headers;
|
|
119330
119411
|
}
|
|
119331
|
-
async function injectRcUserMessage(deps, sessionId,
|
|
119412
|
+
async function injectRcUserMessage(deps, sessionId, text4) {
|
|
119332
119413
|
const credential = deps.credentialOf(sessionId);
|
|
119333
119414
|
if (credential === void 0) {
|
|
119334
119415
|
return { ok: false, message: rcSessionNotObservedMessage(sessionId) };
|
|
@@ -119336,7 +119417,7 @@ async function injectRcUserMessage(deps, sessionId, text3) {
|
|
|
119336
119417
|
if (credential.authorization === void 0) {
|
|
119337
119418
|
return noOAuthCredentialResult(sessionId);
|
|
119338
119419
|
}
|
|
119339
|
-
const body = JSON.stringify(buildRcEventWriteBody(buildRcUserMessagePayload(deps.newUuid(), sessionId,
|
|
119420
|
+
const body = JSON.stringify(buildRcEventWriteBody(buildRcUserMessagePayload(deps.newUuid(), sessionId, text4)));
|
|
119340
119421
|
let answer;
|
|
119341
119422
|
try {
|
|
119342
119423
|
answer = await deps.dial.writeEvents(sessionId, rcWriteHeaders(credential), body);
|
|
@@ -119386,8 +119467,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
|
|
|
119386
119467
|
function isRcReadFileEncoding(value2) {
|
|
119387
119468
|
return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value2);
|
|
119388
119469
|
}
|
|
119389
|
-
function buildRcReadFilePayload(requestId,
|
|
119390
|
-
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path:
|
|
119470
|
+
function buildRcReadFilePayload(requestId, path68, options) {
|
|
119471
|
+
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path68, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
|
|
119391
119472
|
}
|
|
119392
119473
|
function buildRcFileSuggestionsPayload(requestId, query) {
|
|
119393
119474
|
return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
|
|
@@ -119489,15 +119570,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
|
|
|
119489
119570
|
const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
|
|
119490
119571
|
return result.ok ? { ...result, requestId } : result;
|
|
119491
119572
|
}
|
|
119492
|
-
async function readRcSessionFile(deps, sessionId,
|
|
119493
|
-
if (
|
|
119573
|
+
async function readRcSessionFile(deps, sessionId, path68, options) {
|
|
119574
|
+
if (path68 === "") {
|
|
119494
119575
|
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
119576
|
}
|
|
119496
119577
|
if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
|
|
119497
119578
|
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
119579
|
}
|
|
119499
119580
|
const requestId = deps.newUuid();
|
|
119500
|
-
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId,
|
|
119581
|
+
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path68, options), `read ${path68} from session ${sessionId}`);
|
|
119501
119582
|
return result.ok ? { ...result, requestId } : result;
|
|
119502
119583
|
}
|
|
119503
119584
|
async function suggestRcSessionFiles(deps, sessionId, query) {
|
|
@@ -119559,9 +119640,9 @@ var RC_PERMISSION_MODE_LIST = RC_PERMISSION_MODES.join(", ");
|
|
|
119559
119640
|
var CONTROL_PATH_PREFIX = "/__agent-shim/rc";
|
|
119560
119641
|
var CONTROL_BODY_CAP_BYTES = 10485760;
|
|
119561
119642
|
function answerJson(response, status, body) {
|
|
119562
|
-
const
|
|
119563
|
-
response.writeHead(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(
|
|
119564
|
-
response.end(
|
|
119643
|
+
const text4 = JSON.stringify(body);
|
|
119644
|
+
response.writeHead(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(text4, "utf8")) });
|
|
119645
|
+
response.end(text4);
|
|
119565
119646
|
}
|
|
119566
119647
|
function isJsonObject(value2) {
|
|
119567
119648
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
@@ -119668,11 +119749,11 @@ function createRcControlHandler(deps) {
|
|
|
119668
119749
|
path: "read-file",
|
|
119669
119750
|
read: (body) => {
|
|
119670
119751
|
const session = bodyString(body, "session");
|
|
119671
|
-
const
|
|
119752
|
+
const path68 = bodyString(body, "path");
|
|
119672
119753
|
const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
|
|
119673
119754
|
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,
|
|
119755
|
+
const refused2 = session === void 0 || path68 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
|
|
119756
|
+
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, path68, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
|
|
119676
119757
|
}
|
|
119677
119758
|
},
|
|
119678
119759
|
{
|
|
@@ -119810,12 +119891,12 @@ function createRcControlHandler(deps) {
|
|
|
119810
119891
|
answerJson(response, HTTP_STATUS.badRequest, { error: "the answer body must be JSON naming a non-empty session id, request id, and an approve boolean" });
|
|
119811
119892
|
return;
|
|
119812
119893
|
}
|
|
119813
|
-
const
|
|
119814
|
-
if (parsed.approve &&
|
|
119894
|
+
const text4 = "text" in parsed && typeof parsed.text === "string" ? parsed.text : void 0;
|
|
119895
|
+
if (parsed.approve && text4 !== void 0 && text4 !== "") {
|
|
119815
119896
|
answerJson(response, HTTP_STATUS.badRequest, { error: "an approval carries no text (the protocol's allow result has no message field); text is the denial message" });
|
|
119816
119897
|
return;
|
|
119817
119898
|
}
|
|
119818
|
-
const result = await deps.answer(parsed.session, parsed.request, { approve: parsed.approve, message: parsed.approve ? void 0 :
|
|
119899
|
+
const result = await deps.answer(parsed.session, parsed.request, { approve: parsed.approve, message: parsed.approve ? void 0 : text4 });
|
|
119819
119900
|
if (result.ok) {
|
|
119820
119901
|
answerJson(response, HTTP_STATUS.ok, { session: parsed.session, request: parsed.request, sequenceNums: result.sequenceNums });
|
|
119821
119902
|
return;
|
|
@@ -119982,9 +120063,9 @@ function requestIdOfBody(body) {
|
|
|
119982
120063
|
}
|
|
119983
120064
|
function frontDoorRcControl(transport, token) {
|
|
119984
120065
|
const headers = { authorization: `Bearer ${token}` };
|
|
119985
|
-
const listAnswerOf = async (
|
|
120066
|
+
const listAnswerOf = async (path68, what) => {
|
|
119986
120067
|
try {
|
|
119987
|
-
return await transport.request({ method: "GET", path:
|
|
120068
|
+
return await transport.request({ method: "GET", path: path68, headers });
|
|
119988
120069
|
} catch (error63) {
|
|
119989
120070
|
throw new Error(`${what}: could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}`, { cause: error63 });
|
|
119990
120071
|
}
|
|
@@ -120056,10 +120137,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
120056
120137
|
}
|
|
120057
120138
|
return pending;
|
|
120058
120139
|
};
|
|
120059
|
-
const writeOf = async (
|
|
120140
|
+
const writeOf = async (path68, body, describeFailure2) => {
|
|
120060
120141
|
let answer;
|
|
120061
120142
|
try {
|
|
120062
|
-
answer = await transport.request({ method: "POST", path:
|
|
120143
|
+
answer = await transport.request({ method: "POST", path: path68, headers: { ...headers, "content-type": "application/json" }, body });
|
|
120063
120144
|
} catch (error63) {
|
|
120064
120145
|
return { ok: false, message: `could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}` };
|
|
120065
120146
|
}
|
|
@@ -120078,7 +120159,7 @@ function frontDoorRcControl(transport, token) {
|
|
|
120078
120159
|
listSessions: async () => sessionsOf(await listAnswerOf(`${CONTROL_PATH_PREFIX}/sessions`, "listing the door's Remote Control sessions"), "listing the door's Remote Control sessions"),
|
|
120079
120160
|
statusOf: async (sessionId) => statusesOf(await listAnswerOf(`${CONTROL_PATH_PREFIX}/status${sessionQuery(sessionId)}`, "reading the door's Remote Control session status"), "reading the door's Remote Control session status"),
|
|
120080
120161
|
pendingOf: async (sessionId) => pendingOfAnswer(await listAnswerOf(`${CONTROL_PATH_PREFIX}/pending${sessionQuery(sessionId)}`, "listing the door's pending Remote Control control requests"), "listing the door's pending Remote Control control requests"),
|
|
120081
|
-
sendPrompt: async (sessionId,
|
|
120162
|
+
sendPrompt: async (sessionId, text4) => await writeOf(`${CONTROL_PATH_PREFIX}/inject`, JSON.stringify({ session: sessionId, text: text4 }), (status, message) => `injecting into ${sessionId} failed (HTTP ${String(status)}): ${message}`),
|
|
120082
120163
|
answerRequest: async (sessionId, requestId, decision) => await writeOf(
|
|
120083
120164
|
`${CONTROL_PATH_PREFIX}/answer`,
|
|
120084
120165
|
JSON.stringify({ session: sessionId, request: requestId, approve: decision.approve, ...decision.approve || decision.message === void 0 ? {} : { text: decision.message } }),
|
|
@@ -120090,10 +120171,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
120090
120171
|
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
120172
|
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
120173
|
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,
|
|
120174
|
+
readFile: async (sessionId, path68, options) => await writeOf(
|
|
120094
120175
|
`${CONTROL_PATH_PREFIX}/read-file`,
|
|
120095
|
-
JSON.stringify({ session: sessionId, path:
|
|
120096
|
-
(status, message) => `reading ${
|
|
120176
|
+
JSON.stringify({ session: sessionId, path: path68, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
|
|
120177
|
+
(status, message) => `reading ${path68} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
|
|
120097
120178
|
),
|
|
120098
120179
|
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
120180
|
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 +120487,12 @@ function tlsFacts(options) {
|
|
|
120406
120487
|
}
|
|
120407
120488
|
function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
120408
120489
|
const agent = new ExemptTlsAgent();
|
|
120409
|
-
const post = async (
|
|
120490
|
+
const post = async (path68, headers, body) => await new Promise((resolve2, reject) => {
|
|
120410
120491
|
const options = {
|
|
120411
120492
|
host: target.host,
|
|
120412
120493
|
port: target.port,
|
|
120413
120494
|
method: "POST",
|
|
120414
|
-
path:
|
|
120495
|
+
path: path68,
|
|
120415
120496
|
// 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
120497
|
headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
|
|
120417
120498
|
agent
|
|
@@ -120476,12 +120557,12 @@ function lateRcStreamDial(resolve2) {
|
|
|
120476
120557
|
}
|
|
120477
120558
|
function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
120478
120559
|
const agent = new ExemptTlsAgent();
|
|
120479
|
-
const request7 = async (method,
|
|
120560
|
+
const request7 = async (method, path68, headers, body, signal) => await new Promise((resolve2, reject) => {
|
|
120480
120561
|
const options = {
|
|
120481
120562
|
host: target.host,
|
|
120482
120563
|
port: target.port,
|
|
120483
120564
|
method,
|
|
120484
|
-
path:
|
|
120565
|
+
path: path68,
|
|
120485
120566
|
// 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
120567
|
headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
|
|
120487
120568
|
agent,
|
|
@@ -120523,9 +120604,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
|
|
|
120523
120604
|
return { status, body: await readAll(response) };
|
|
120524
120605
|
},
|
|
120525
120606
|
openStream: async (sessionId, headers, resume, signal) => {
|
|
120526
|
-
const
|
|
120607
|
+
const path68 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
|
|
120527
120608
|
const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
|
|
120528
|
-
const { status, response } = await request7("GET",
|
|
120609
|
+
const { status, response } = await request7("GET", path68, streamHeaders, void 0, signal);
|
|
120529
120610
|
if (!isSuccessful2(status)) {
|
|
120530
120611
|
await readAll(response);
|
|
120531
120612
|
return { status, chunks: NO_CHUNKS };
|
|
@@ -121791,11 +121872,11 @@ var AsyncIteratorClass = class {
|
|
|
121791
121872
|
return this;
|
|
121792
121873
|
}
|
|
121793
121874
|
};
|
|
121794
|
-
function parseEmptyableJSON(
|
|
121795
|
-
if (!
|
|
121875
|
+
function parseEmptyableJSON(text4) {
|
|
121876
|
+
if (!text4) {
|
|
121796
121877
|
return void 0;
|
|
121797
121878
|
}
|
|
121798
|
-
return JSON.parse(
|
|
121879
|
+
return JSON.parse(text4);
|
|
121799
121880
|
}
|
|
121800
121881
|
function stringifyJSON(value2) {
|
|
121801
121882
|
return JSON.stringify(value2);
|
|
@@ -121926,11 +122007,11 @@ function tryOrUndefined(fn2) {
|
|
|
121926
122007
|
return void 0;
|
|
121927
122008
|
}
|
|
121928
122009
|
}
|
|
121929
|
-
function pathToHttpPath(
|
|
121930
|
-
return `/${
|
|
122010
|
+
function pathToHttpPath(path68) {
|
|
122011
|
+
return `/${path68.map(safeEncodeURIComponent).join("/")}`;
|
|
121931
122012
|
}
|
|
121932
|
-
function normalizeHttpPath(
|
|
121933
|
-
const paths =
|
|
122013
|
+
function normalizeHttpPath(path68) {
|
|
122014
|
+
const paths = path68.split("/");
|
|
121934
122015
|
if (paths.at(0) === "") {
|
|
121935
122016
|
paths.shift();
|
|
121936
122017
|
}
|
|
@@ -122115,9 +122196,9 @@ function isPlainObject3(value2) {
|
|
|
122115
122196
|
function getOwn(object3, key) {
|
|
122116
122197
|
return Object.hasOwn(object3, key) ? object3[key] : void 0;
|
|
122117
122198
|
}
|
|
122118
|
-
function get(object3,
|
|
122199
|
+
function get(object3, path68) {
|
|
122119
122200
|
let current = object3;
|
|
122120
|
-
for (const key of
|
|
122201
|
+
for (const key of path68) {
|
|
122121
122202
|
if (!isTypescriptObject(current)) {
|
|
122122
122203
|
return void 0;
|
|
122123
122204
|
}
|
|
@@ -122846,8 +122927,8 @@ function createORPCErrorFromMalformedResponse(options) {
|
|
|
122846
122927
|
}
|
|
122847
122928
|
var INFERRED_MESSAGE_MIN_LENGTH = 1;
|
|
122848
122929
|
var INFERRED_MESSAGE_MAX_LENGTH = 256;
|
|
122849
|
-
function isInferableMessage(
|
|
122850
|
-
return
|
|
122930
|
+
function isInferableMessage(text4) {
|
|
122931
|
+
return text4.length >= INFERRED_MESSAGE_MIN_LENGTH && text4.length <= INFERRED_MESSAGE_MAX_LENGTH;
|
|
122851
122932
|
}
|
|
122852
122933
|
function inferMalformedResponseMessage(response) {
|
|
122853
122934
|
if (typeof response.body === "string" && isInferableMessage(response.body)) {
|
|
@@ -123340,7 +123421,7 @@ function resolveClientRest(rest) {
|
|
|
123340
123421
|
// rest[1] can be undefined if all fields of FriendlyClientOptions are optional
|
|
123341
123422
|
];
|
|
123342
123423
|
}
|
|
123343
|
-
function createORPCClient(link, { path:
|
|
123424
|
+
function createORPCClient(link, { path: path68 = [], ...options } = {}) {
|
|
123344
123425
|
const procedureClient = (...rest) => {
|
|
123345
123426
|
const [input2, callOptions] = resolveClientRest(rest);
|
|
123346
123427
|
const interceptors = [
|
|
@@ -123349,7 +123430,7 @@ function createORPCClient(link, { path: path66 = [], ...options } = {}) {
|
|
|
123349
123430
|
];
|
|
123350
123431
|
return intercept(
|
|
123351
123432
|
interceptors,
|
|
123352
|
-
{ ...callOptions, input: input2, path:
|
|
123433
|
+
{ ...callOptions, input: input2, path: path68 },
|
|
123353
123434
|
({ path: path210, input: input22, ...callOptions2 }) => link.call(path210, input22, callOptions2)
|
|
123354
123435
|
);
|
|
123355
123436
|
};
|
|
@@ -123363,7 +123444,7 @@ function createORPCClient(link, { path: path66 = [], ...options } = {}) {
|
|
|
123363
123444
|
if (client === void 0) {
|
|
123364
123445
|
client = createORPCClient(link, {
|
|
123365
123446
|
...options,
|
|
123366
|
-
path: [...
|
|
123447
|
+
path: [...path68, key],
|
|
123367
123448
|
scoped: options.scoped?.[key]
|
|
123368
123449
|
});
|
|
123369
123450
|
cache.set(key, client);
|
|
@@ -123385,24 +123466,24 @@ var BracketNotationSerializer = class {
|
|
|
123385
123466
|
this.internalSerialize(data, "", true, result);
|
|
123386
123467
|
return result;
|
|
123387
123468
|
}
|
|
123388
|
-
internalSerialize(data,
|
|
123469
|
+
internalSerialize(data, path68, isRoot, result) {
|
|
123389
123470
|
if (Array.isArray(data)) {
|
|
123390
123471
|
data.forEach((item, i10) => {
|
|
123391
|
-
this.internalSerialize(item, isRoot ? i10.toString() : `${
|
|
123472
|
+
this.internalSerialize(item, isRoot ? i10.toString() : `${path68}[${i10}]`, false, result);
|
|
123392
123473
|
});
|
|
123393
123474
|
} else if (isPlainObject3(data)) {
|
|
123394
123475
|
for (const key of Object.keys(data)) {
|
|
123395
|
-
this.internalSerialize(data[key], isRoot ? key : `${
|
|
123476
|
+
this.internalSerialize(data[key], isRoot ? key : `${path68}[${key}]`, false, result);
|
|
123396
123477
|
}
|
|
123397
123478
|
} else {
|
|
123398
|
-
result.push([
|
|
123479
|
+
result.push([path68, data]);
|
|
123399
123480
|
}
|
|
123400
123481
|
}
|
|
123401
123482
|
deserialize(serialized) {
|
|
123402
123483
|
const arrayPushStyles = /* @__PURE__ */ new WeakSet();
|
|
123403
123484
|
const root = new NullProtoObj();
|
|
123404
|
-
for (const [
|
|
123405
|
-
const segments = this.parsePath(
|
|
123485
|
+
for (const [path68, value2] of serialized) {
|
|
123486
|
+
const segments = this.parsePath(path68);
|
|
123406
123487
|
let currentRef = root;
|
|
123407
123488
|
let nextSegment = segments[0];
|
|
123408
123489
|
for (let i10 = 1; i10 < segments.length; i10++) {
|
|
@@ -123453,13 +123534,13 @@ var BracketNotationSerializer = class {
|
|
|
123453
123534
|
}
|
|
123454
123535
|
return result;
|
|
123455
123536
|
}
|
|
123456
|
-
parsePath(
|
|
123537
|
+
parsePath(path68) {
|
|
123457
123538
|
const segments = [];
|
|
123458
123539
|
let inBrackets = false;
|
|
123459
123540
|
let currentSegment = "";
|
|
123460
|
-
for (let i10 = 0; i10 <
|
|
123461
|
-
const char =
|
|
123462
|
-
const nextChar =
|
|
123541
|
+
for (let i10 = 0; i10 < path68.length; i10++) {
|
|
123542
|
+
const char = path68[i10];
|
|
123543
|
+
const nextChar = path68[i10 + 1];
|
|
123463
123544
|
if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[")) {
|
|
123464
123545
|
if (nextChar === void 0) {
|
|
123465
123546
|
inBrackets = false;
|
|
@@ -123475,7 +123556,7 @@ var BracketNotationSerializer = class {
|
|
|
123475
123556
|
currentSegment += char;
|
|
123476
123557
|
}
|
|
123477
123558
|
}
|
|
123478
|
-
return inBrackets || segments.length === 0 ? [
|
|
123559
|
+
return inBrackets || segments.length === 0 ? [path68] : segments;
|
|
123479
123560
|
}
|
|
123480
123561
|
};
|
|
123481
123562
|
var INTEGER_PATTERN = /^0$|^[1-9]\d*$/;
|
|
@@ -124048,11 +124129,11 @@ var OpenAPISerializer = class {
|
|
|
124048
124129
|
return json2;
|
|
124049
124130
|
}
|
|
124050
124131
|
const form = new FormData();
|
|
124051
|
-
for (const [
|
|
124132
|
+
for (const [path68, value22] of this.bracketNotation.serialize(json2)) {
|
|
124052
124133
|
if (value22 instanceof Blob) {
|
|
124053
|
-
form.append(
|
|
124134
|
+
form.append(path68, value22);
|
|
124054
124135
|
} else if (value22 !== void 0 && value22 !== null) {
|
|
124055
|
-
form.append(
|
|
124136
|
+
form.append(path68, String(value22));
|
|
124056
124137
|
}
|
|
124057
124138
|
}
|
|
124058
124139
|
return form;
|
|
@@ -124090,30 +124171,30 @@ function isBodylessMethod(method) {
|
|
|
124090
124171
|
return method === "GET" || method === "HEAD";
|
|
124091
124172
|
}
|
|
124092
124173
|
var PARAMETER_NAME_REGEX = /^[\w-]+$/;
|
|
124093
|
-
function getDynamicPathParams(
|
|
124094
|
-
if (!
|
|
124174
|
+
function getDynamicPathParams(path68) {
|
|
124175
|
+
if (!path68.includes("{")) {
|
|
124095
124176
|
return void 0;
|
|
124096
124177
|
}
|
|
124097
|
-
const len =
|
|
124178
|
+
const len = path68.length;
|
|
124098
124179
|
let params;
|
|
124099
124180
|
let index = 1;
|
|
124100
124181
|
while (index < len) {
|
|
124101
124182
|
const segmentStart = index;
|
|
124102
|
-
const slashPos =
|
|
124183
|
+
const slashPos = path68.indexOf("/", index);
|
|
124103
124184
|
const segmentEnd = slashPos === -1 ? len : slashPos;
|
|
124104
|
-
if (segmentEnd > segmentStart &&
|
|
124185
|
+
if (segmentEnd > segmentStart && path68.charCodeAt(segmentStart) === 123 && path68.charCodeAt(segmentEnd - 1) === 125) {
|
|
124105
124186
|
let parameterStart = segmentStart + 1;
|
|
124106
124187
|
let allowsSlash = false;
|
|
124107
|
-
const operator =
|
|
124188
|
+
const operator = path68.charCodeAt(parameterStart);
|
|
124108
124189
|
if (operator === 43) {
|
|
124109
124190
|
allowsSlash = true;
|
|
124110
124191
|
parameterStart++;
|
|
124111
124192
|
}
|
|
124112
|
-
const parameterName =
|
|
124193
|
+
const parameterName = path68.slice(parameterStart, segmentEnd - 1);
|
|
124113
124194
|
if (PARAMETER_NAME_REGEX.test(parameterName)) {
|
|
124114
124195
|
params ??= [];
|
|
124115
124196
|
params.push({
|
|
124116
|
-
segment:
|
|
124197
|
+
segment: path68.slice(segmentStart, segmentEnd),
|
|
124117
124198
|
startIndex: segmentStart,
|
|
124118
124199
|
parameterName,
|
|
124119
124200
|
allowsSlash
|
|
@@ -124156,8 +124237,8 @@ openapi.method = (method) => ({
|
|
|
124156
124237
|
...openapi({ method }),
|
|
124157
124238
|
name: "~openapi/method"
|
|
124158
124239
|
});
|
|
124159
|
-
openapi.path = (
|
|
124160
|
-
...openapi({ path:
|
|
124240
|
+
openapi.path = (path68) => ({
|
|
124241
|
+
...openapi({ path: path68 }),
|
|
124161
124242
|
name: "~openapi/path"
|
|
124162
124243
|
});
|
|
124163
124244
|
openapi.spec = (spec) => ({
|
|
@@ -125018,22 +125099,22 @@ function visitJsonSchemaRefs(value2, visit2, schemaLevel = true, seen = /* @__PU
|
|
|
125018
125099
|
}
|
|
125019
125100
|
}
|
|
125020
125101
|
}
|
|
125021
|
-
function mapJsonSchemaRefs(value2, map2, schemaLevel = true,
|
|
125102
|
+
function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path68 = []) {
|
|
125022
125103
|
if (!value2 || typeof value2 !== "object") {
|
|
125023
125104
|
return value2;
|
|
125024
125105
|
}
|
|
125025
125106
|
if (Array.isArray(value2)) {
|
|
125026
|
-
return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...
|
|
125107
|
+
return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path68, index]));
|
|
125027
125108
|
}
|
|
125028
125109
|
const result = {};
|
|
125029
125110
|
for (const key of Object.keys(value2)) {
|
|
125030
125111
|
const val = value2[key];
|
|
125031
125112
|
if (key === "$ref" && typeof val === "string") {
|
|
125032
|
-
setOwn(result, key, map2(val, [...
|
|
125113
|
+
setOwn(result, key, map2(val, [...path68, key]));
|
|
125033
125114
|
} else if (!schemaLevel) {
|
|
125034
|
-
setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...
|
|
125115
|
+
setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path68, key]));
|
|
125035
125116
|
} 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), [...
|
|
125117
|
+
setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path68, key]));
|
|
125037
125118
|
} else {
|
|
125038
125119
|
setOwn(result, key, val);
|
|
125039
125120
|
}
|
|
@@ -125563,7 +125644,7 @@ function unlazy(maybeLazy) {
|
|
|
125563
125644
|
function createProcedureClient(lazyableProcedure, ...rest) {
|
|
125564
125645
|
const options = resolveMaybeOptionalOptions(rest);
|
|
125565
125646
|
return async (...[input2, callerOptions]) => {
|
|
125566
|
-
const
|
|
125647
|
+
const path68 = toArray(options.path);
|
|
125567
125648
|
const { default: procedure } = await unlazy(lazyableProcedure);
|
|
125568
125649
|
const clientContext = callerOptions?.context ?? {};
|
|
125569
125650
|
const context = await value(options.context, clientContext) ?? {};
|
|
@@ -125576,7 +125657,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
125576
125657
|
};
|
|
125577
125658
|
try {
|
|
125578
125659
|
const output2 = await runWithSpan("call_procedure", (span) => {
|
|
125579
|
-
span?.setAttribute("procedure.path",
|
|
125660
|
+
span?.setAttribute("procedure.path", path68);
|
|
125580
125661
|
return intercept(
|
|
125581
125662
|
options.interceptors,
|
|
125582
125663
|
{
|
|
@@ -125584,7 +125665,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
125584
125665
|
// input can be optional if it is undefinable
|
|
125585
125666
|
input: input2,
|
|
125586
125667
|
errors,
|
|
125587
|
-
path:
|
|
125668
|
+
path: path68,
|
|
125588
125669
|
procedure,
|
|
125589
125670
|
signal: callerOptions?.signal,
|
|
125590
125671
|
lastEventId: callerOptions?.lastEventId
|
|
@@ -125835,10 +125916,10 @@ function augmentRouter(router, options) {
|
|
|
125835
125916
|
}
|
|
125836
125917
|
return enhanced;
|
|
125837
125918
|
}
|
|
125838
|
-
function getRouter(router,
|
|
125919
|
+
function getRouter(router, path68) {
|
|
125839
125920
|
let current = router;
|
|
125840
|
-
for (let i10 = 0; i10 <
|
|
125841
|
-
const segment =
|
|
125921
|
+
for (let i10 = 0; i10 < path68.length; i10++) {
|
|
125922
|
+
const segment = path68[i10];
|
|
125842
125923
|
if (!isTypescriptObject(current)) {
|
|
125843
125924
|
return void 0;
|
|
125844
125925
|
}
|
|
@@ -125850,7 +125931,7 @@ function getRouter(router, path66) {
|
|
|
125850
125931
|
continue;
|
|
125851
125932
|
}
|
|
125852
125933
|
const lazied = current;
|
|
125853
|
-
const rest =
|
|
125934
|
+
const rest = path68.slice(i10);
|
|
125854
125935
|
return new Lazy({
|
|
125855
125936
|
...lazied["~orpc"],
|
|
125856
125937
|
async loader() {
|
|
@@ -125865,40 +125946,40 @@ function getRouter(router, path66) {
|
|
|
125865
125946
|
}
|
|
125866
125947
|
return current;
|
|
125867
125948
|
}
|
|
125868
|
-
function walkProcedureContractsSync(router, callback,
|
|
125949
|
+
function walkProcedureContractsSync(router, callback, path68 = []) {
|
|
125869
125950
|
const lazyResults = [];
|
|
125870
|
-
walkProcedureContractsSyncInternal(router, callback,
|
|
125951
|
+
walkProcedureContractsSyncInternal(router, callback, path68.slice(), lazyResults);
|
|
125871
125952
|
return lazyResults;
|
|
125872
125953
|
}
|
|
125873
|
-
function walkProcedureContractsSyncInternal(router, callback,
|
|
125954
|
+
function walkProcedureContractsSyncInternal(router, callback, path68, lazyResults) {
|
|
125874
125955
|
const hiddenContract = getHiddenRouterContract(router);
|
|
125875
125956
|
if (hiddenContract !== void 0) {
|
|
125876
125957
|
router = hiddenContract;
|
|
125877
125958
|
}
|
|
125878
125959
|
if (router instanceof ProcedureContract) {
|
|
125879
|
-
callback(router,
|
|
125960
|
+
callback(router, path68.slice());
|
|
125880
125961
|
return;
|
|
125881
125962
|
}
|
|
125882
125963
|
if (!isTypescriptObject(router)) {
|
|
125883
125964
|
return;
|
|
125884
125965
|
}
|
|
125885
125966
|
for (const [key, value2] of Object.entries(router)) {
|
|
125886
|
-
|
|
125967
|
+
path68.push(key);
|
|
125887
125968
|
if (value2 instanceof Lazy) {
|
|
125888
|
-
lazyResults.push({ router: value2, path:
|
|
125969
|
+
lazyResults.push({ router: value2, path: path68.slice() });
|
|
125889
125970
|
} else {
|
|
125890
|
-
walkProcedureContractsSyncInternal(value2, callback,
|
|
125971
|
+
walkProcedureContractsSyncInternal(value2, callback, path68, lazyResults);
|
|
125891
125972
|
}
|
|
125892
|
-
|
|
125973
|
+
path68.pop();
|
|
125893
125974
|
}
|
|
125894
125975
|
}
|
|
125895
|
-
async function walkProcedureContractsAsync(router, callback,
|
|
125976
|
+
async function walkProcedureContractsAsync(router, callback, path68 = []) {
|
|
125896
125977
|
const hiddenContract = getHiddenRouterContract(router);
|
|
125897
125978
|
if (hiddenContract !== void 0) {
|
|
125898
125979
|
router = hiddenContract;
|
|
125899
125980
|
}
|
|
125900
125981
|
if (router instanceof ProcedureContract) {
|
|
125901
|
-
await callback(router,
|
|
125982
|
+
await callback(router, path68);
|
|
125902
125983
|
return;
|
|
125903
125984
|
}
|
|
125904
125985
|
if (!isTypescriptObject(router)) {
|
|
@@ -125907,9 +125988,9 @@ async function walkProcedureContractsAsync(router, callback, path66 = []) {
|
|
|
125907
125988
|
for (const [key, value2] of Object.entries(router)) {
|
|
125908
125989
|
if (value2 instanceof Lazy) {
|
|
125909
125990
|
const { default: router2 } = await unlazy(value2);
|
|
125910
|
-
await walkProcedureContractsAsync(router2, callback, [...
|
|
125991
|
+
await walkProcedureContractsAsync(router2, callback, [...path68, key]);
|
|
125911
125992
|
} else {
|
|
125912
|
-
await walkProcedureContractsAsync(value2, callback, [...
|
|
125993
|
+
await walkProcedureContractsAsync(value2, callback, [...path68, key]);
|
|
125913
125994
|
}
|
|
125914
125995
|
}
|
|
125915
125996
|
}
|
|
@@ -126395,18 +126476,18 @@ function rewriteComponentSchemaRefs(schema, renameMap) {
|
|
|
126395
126476
|
}
|
|
126396
126477
|
var OpenAPIGeneratorError = class extends TypeError {
|
|
126397
126478
|
};
|
|
126398
|
-
function toOpenAPIPath(
|
|
126479
|
+
function toOpenAPIPath(path68, dynamicPathParams) {
|
|
126399
126480
|
if (!dynamicPathParams?.length) {
|
|
126400
|
-
return
|
|
126481
|
+
return path68;
|
|
126401
126482
|
}
|
|
126402
126483
|
let normalized = "";
|
|
126403
126484
|
let currentIndex = 0;
|
|
126404
126485
|
for (const param of dynamicPathParams) {
|
|
126405
|
-
normalized +=
|
|
126486
|
+
normalized += path68.slice(currentIndex, param.startIndex);
|
|
126406
126487
|
normalized += `{${param.parameterName}}`;
|
|
126407
126488
|
currentIndex = param.startIndex + param.segment.length;
|
|
126408
126489
|
}
|
|
126409
|
-
normalized +=
|
|
126490
|
+
normalized += path68.slice(currentIndex);
|
|
126410
126491
|
return normalized;
|
|
126411
126492
|
}
|
|
126412
126493
|
function buildRequest(ctx, operation, def, meta3, dynamicPathParams) {
|
|
@@ -126840,8 +126921,8 @@ var OpenAPIGenerator = class {
|
|
|
126840
126921
|
customErrorResponseBodySchema: options.customErrorResponseBodySchema
|
|
126841
126922
|
};
|
|
126842
126923
|
const errors = [];
|
|
126843
|
-
await walkProcedureContractsAsync(router, (contract,
|
|
126844
|
-
if (value(options.filter, contract,
|
|
126924
|
+
await walkProcedureContractsAsync(router, (contract, path68) => {
|
|
126925
|
+
if (value(options.filter, contract, path68) === false) {
|
|
126845
126926
|
return;
|
|
126846
126927
|
}
|
|
126847
126928
|
try {
|
|
@@ -126853,7 +126934,7 @@ var OpenAPIGenerator = class {
|
|
|
126853
126934
|
`QUERY operations require OpenAPI 3.2, but version "${version2}" was requested.`
|
|
126854
126935
|
);
|
|
126855
126936
|
}
|
|
126856
|
-
const postPath = meta3?.path ?? pathToHttpPath(
|
|
126937
|
+
const postPath = meta3?.path ?? pathToHttpPath(path68);
|
|
126857
126938
|
const httpPath = meta3?.prefix ? mergeHttpPath(meta3.prefix, postPath) : postPath;
|
|
126858
126939
|
const dynamicPathParams = getDynamicPathParams(httpPath);
|
|
126859
126940
|
const openApiPath = toOpenAPIPath(httpPath, dynamicPathParams);
|
|
@@ -126862,7 +126943,7 @@ var OpenAPIGenerator = class {
|
|
|
126862
126943
|
operation = meta3.spec;
|
|
126863
126944
|
} else {
|
|
126864
126945
|
operation = {
|
|
126865
|
-
operationId: meta3?.operationId ??
|
|
126946
|
+
operationId: meta3?.operationId ?? path68.join("."),
|
|
126866
126947
|
summary: meta3?.summary,
|
|
126867
126948
|
description: meta3?.description,
|
|
126868
126949
|
deprecated: meta3?.deprecated,
|
|
@@ -126882,7 +126963,7 @@ var OpenAPIGenerator = class {
|
|
|
126882
126963
|
if (!(e14 instanceof OpenAPIGeneratorError)) {
|
|
126883
126964
|
throw e14;
|
|
126884
126965
|
}
|
|
126885
|
-
errors.push(`Procedure at ${
|
|
126966
|
+
errors.push(`Procedure at ${path68.join(".") || "(root)"}: ${e14.message}`);
|
|
126886
126967
|
}
|
|
126887
126968
|
});
|
|
126888
126969
|
if (errors.length) {
|
|
@@ -127584,15 +127665,15 @@ async function toStandardBody(re, options) {
|
|
|
127584
127665
|
throw new TypeError("Failed to read body: body stream already read");
|
|
127585
127666
|
}
|
|
127586
127667
|
if (hint === "json") {
|
|
127587
|
-
const
|
|
127588
|
-
return parseEmptyableJSON(
|
|
127668
|
+
const text4 = await re.text();
|
|
127669
|
+
return parseEmptyableJSON(text4);
|
|
127589
127670
|
}
|
|
127590
127671
|
if (hint === "form-data") {
|
|
127591
127672
|
return await re.formData();
|
|
127592
127673
|
}
|
|
127593
127674
|
if (hint === "url-search-params") {
|
|
127594
|
-
const
|
|
127595
|
-
return new URLSearchParams(
|
|
127675
|
+
const text4 = await re.text();
|
|
127676
|
+
return new URLSearchParams(text4);
|
|
127596
127677
|
}
|
|
127597
127678
|
if (hint === "event-stream") {
|
|
127598
127679
|
return toAsyncIteratorObject(re.body);
|
|
@@ -127729,16 +127810,16 @@ var StandardLink = class {
|
|
|
127729
127810
|
/**
|
|
127730
127811
|
* @throws ORPCError, transport-level errors (network failures, timeouts, etc.)
|
|
127731
127812
|
*/
|
|
127732
|
-
call(
|
|
127733
|
-
return runWithSpan(`${ORPC_NAME}.${
|
|
127813
|
+
call(path68, input2, options) {
|
|
127814
|
+
return runWithSpan(`${ORPC_NAME}.${path68.join("/")}`, (span) => {
|
|
127734
127815
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
127735
|
-
span?.setAttribute("rpc.method",
|
|
127816
|
+
span?.setAttribute("rpc.method", path68.join("."));
|
|
127736
127817
|
if (getTracer() && isAsyncIteratorObject(input2)) {
|
|
127737
127818
|
input2 = override(input2, traceAsyncIterator("consume_async_iterator_object_input", input2));
|
|
127738
127819
|
} else if (getTracer() && input2 instanceof ReadableStream) {
|
|
127739
127820
|
input2 = override(input2, traceReadableStream("consume_octet_stream_input", input2));
|
|
127740
127821
|
}
|
|
127741
|
-
return intercept(this.interceptors, { ...options, path:
|
|
127822
|
+
return intercept(this.interceptors, { ...options, path: path68, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
|
|
127742
127823
|
const tracer = getTracer();
|
|
127743
127824
|
const activeSpan = tracer?.getActiveSpan() ?? span;
|
|
127744
127825
|
let request7 = await runWithSpan(
|
|
@@ -127795,18 +127876,18 @@ var RPCLinkCodec = class {
|
|
|
127795
127876
|
this.headers = options.headers ?? {};
|
|
127796
127877
|
this.serializer = options.serializer ?? new RPCSerializer();
|
|
127797
127878
|
}
|
|
127798
|
-
async encodeInput(input2,
|
|
127799
|
-
let headers = toResolvedStandardHeaders(await value(this.headers, options,
|
|
127879
|
+
async encodeInput(input2, path68, options) {
|
|
127880
|
+
let headers = toResolvedStandardHeaders(await value(this.headers, options, path68, input2));
|
|
127800
127881
|
if (options.lastEventId !== void 0) {
|
|
127801
127882
|
headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
|
|
127802
127883
|
}
|
|
127803
|
-
const expectedMethod = await value(this.expectedMethod, options,
|
|
127804
|
-
const baseUrl = await value(this.baseUrl, options,
|
|
127884
|
+
const expectedMethod = await value(this.expectedMethod, options, path68, input2);
|
|
127885
|
+
const baseUrl = await value(this.baseUrl, options, path68, input2);
|
|
127805
127886
|
const [pathname, search, hash2] = parseStandardUrl(baseUrl);
|
|
127806
|
-
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(
|
|
127887
|
+
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path68)}`;
|
|
127807
127888
|
const serialized = this.serializer.serialize(input2);
|
|
127808
127889
|
if (expectedMethod === "GET" && !(serialized instanceof Blob) && !(serialized instanceof ReadableStream) && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
|
|
127809
|
-
const maxUrlLength = await value(this.maxUrlLength, options,
|
|
127890
|
+
const maxUrlLength = await value(this.maxUrlLength, options, path68, input2);
|
|
127810
127891
|
const mergedSearch = new URLSearchParams(search);
|
|
127811
127892
|
mergedSearch.append("data", stringifyJSON(serialized) ?? "");
|
|
127812
127893
|
const url22 = `${newPathname}?${mergedSearch}${hash2 ?? ""}`;
|
|
@@ -127891,8 +127972,8 @@ var FetchLinkTransport = class {
|
|
|
127891
127972
|
this.fetch = options.fetch ?? ((url2, init) => globalThis.fetch(url2, init));
|
|
127892
127973
|
this.toFetchRequestOptions = options.toFetchRequest;
|
|
127893
127974
|
}
|
|
127894
|
-
async send(standardRequest,
|
|
127895
|
-
let origin = await value(this.origin, options,
|
|
127975
|
+
async send(standardRequest, path68, options) {
|
|
127976
|
+
let origin = await value(this.origin, options, path68);
|
|
127896
127977
|
if (origin?.endsWith("/")) {
|
|
127897
127978
|
origin = origin.slice(0, -1);
|
|
127898
127979
|
}
|
|
@@ -127912,7 +127993,7 @@ var FetchLinkTransport = class {
|
|
|
127912
127993
|
}
|
|
127913
127994
|
}
|
|
127914
127995
|
const fetch3 = this.fetch;
|
|
127915
|
-
const response = await fetch3(url2, init, options,
|
|
127996
|
+
const response = await fetch3(url2, init, options, path68);
|
|
127916
127997
|
const standardResponse = toStandardLazyResponse(response);
|
|
127917
127998
|
return standardResponse;
|
|
127918
127999
|
}
|
|
@@ -128068,16 +128149,16 @@ async function toStandardBody2(req, options = {}) {
|
|
|
128068
128149
|
throw new TypeError("Failed to read body: body stream already read or destroyed");
|
|
128069
128150
|
}
|
|
128070
128151
|
if (hint === "json") {
|
|
128071
|
-
const
|
|
128072
|
-
return parseEmptyableJSON(
|
|
128152
|
+
const text4 = await _streamToString(req);
|
|
128153
|
+
return parseEmptyableJSON(text4);
|
|
128073
128154
|
}
|
|
128074
128155
|
const contentType = req.headers["content-type"];
|
|
128075
128156
|
if (hint === "form-data") {
|
|
128076
128157
|
return _streamToFormData(req, contentType);
|
|
128077
128158
|
}
|
|
128078
128159
|
if (hint === "url-search-params") {
|
|
128079
|
-
const
|
|
128080
|
-
return new URLSearchParams(
|
|
128160
|
+
const text4 = await _streamToString(req);
|
|
128161
|
+
return new URLSearchParams(text4);
|
|
128081
128162
|
}
|
|
128082
128163
|
if (hint === "event-stream") {
|
|
128083
128164
|
return toAsyncIteratorObject2(req);
|
|
@@ -128303,14 +128384,14 @@ var StandardHandler = class {
|
|
|
128303
128384
|
span?.setAttribute("url.path", request22.url);
|
|
128304
128385
|
return { matched: false };
|
|
128305
128386
|
}
|
|
128306
|
-
const { path:
|
|
128307
|
-
span?.updateName(`${ORPC_NAME}.${
|
|
128387
|
+
const { path: path68, procedure, decodeInput } = matchedOrNot;
|
|
128388
|
+
span?.updateName(`${ORPC_NAME}.${path68.join("/")}`);
|
|
128308
128389
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
128309
|
-
span?.setAttribute("rpc.method",
|
|
128390
|
+
span?.setAttribute("rpc.method", path68.join("."));
|
|
128310
128391
|
try {
|
|
128311
128392
|
const response = await intercept(
|
|
128312
128393
|
this.interceptors,
|
|
128313
|
-
{ context: context2, prefix: prefix2, request: request22, path:
|
|
128394
|
+
{ context: context2, prefix: prefix2, request: request22, path: path68, procedure, decodeInput },
|
|
128314
128395
|
async ({ context: context3, prefix: prefix3, request: request32, path: path210, procedure: procedure2, decodeInput: decodeInput2 }) => {
|
|
128315
128396
|
step2 = "decode_input";
|
|
128316
128397
|
let input2 = await runWithSpan("decode_input", decodeInput2);
|
|
@@ -128344,7 +128425,7 @@ var StandardHandler = class {
|
|
|
128344
128425
|
message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
|
|
128345
128426
|
cause: e14
|
|
128346
128427
|
}) : toORPCError(e14);
|
|
128347
|
-
const response = await this.codec.encodeError(error63, procedure,
|
|
128428
|
+
const response = await this.codec.encodeError(error63, procedure, path68, { context: context2, prefix: prefix2 });
|
|
128348
128429
|
return { matched: true, response };
|
|
128349
128430
|
}
|
|
128350
128431
|
}
|
|
@@ -128450,7 +128531,7 @@ var RPCMatcher = class {
|
|
|
128450
128531
|
this.rootRouter = router;
|
|
128451
128532
|
this.index(router);
|
|
128452
128533
|
}
|
|
128453
|
-
index(router,
|
|
128534
|
+
index(router, path68 = []) {
|
|
128454
128535
|
const lazyResults = walkProcedureContractsSync(router, (procedure, procedurePath) => {
|
|
128455
128536
|
if (!value(this.filter, procedure, procedurePath)) {
|
|
128456
128537
|
return;
|
|
@@ -128461,7 +128542,7 @@ var RPCMatcher = class {
|
|
|
128461
128542
|
// contract-first entries have no implementation yet, resolveProcedure fills it in on demand
|
|
128462
128543
|
procedure: procedure instanceof Procedure ? procedure : void 0
|
|
128463
128544
|
});
|
|
128464
|
-
},
|
|
128545
|
+
}, path68);
|
|
128465
128546
|
for (const result of lazyResults) {
|
|
128466
128547
|
this.pendingLazyRouters.set(pathToHttpPath(result.path), result);
|
|
128467
128548
|
}
|
|
@@ -128593,10 +128674,10 @@ var RPCHandlerCodec = class {
|
|
|
128593
128674
|
}
|
|
128594
128675
|
};
|
|
128595
128676
|
}
|
|
128596
|
-
encodeOutput(output2, procedure,
|
|
128677
|
+
encodeOutput(output2, procedure, path68, options) {
|
|
128597
128678
|
return {
|
|
128598
128679
|
headers: {},
|
|
128599
|
-
status: value(this.outputStatus, output2, procedure,
|
|
128680
|
+
status: value(this.outputStatus, output2, procedure, path68, options) ?? DEFAULT_SUCCESS_STATUS,
|
|
128600
128681
|
body: this.serializer.serialize(output2)
|
|
128601
128682
|
};
|
|
128602
128683
|
}
|
|
@@ -128650,39 +128731,39 @@ function createRouter() {
|
|
|
128650
128731
|
static: new NullProtoObj2()
|
|
128651
128732
|
};
|
|
128652
128733
|
}
|
|
128653
|
-
function scanFirstGroup(
|
|
128734
|
+
function scanFirstGroup(path68) {
|
|
128654
128735
|
let i10 = 0;
|
|
128655
128736
|
let depth = 0;
|
|
128656
|
-
for (; i10 <
|
|
128657
|
-
const c10 =
|
|
128737
|
+
for (; i10 < path68.length; i10++) {
|
|
128738
|
+
const c10 = path68.charCodeAt(i10);
|
|
128658
128739
|
if (c10 === 92) i10++;
|
|
128659
128740
|
else if (c10 === 40) depth++;
|
|
128660
128741
|
else if (c10 === 41 && depth > 0) depth--;
|
|
128661
128742
|
else if (c10 === 123 && depth === 0) break;
|
|
128662
128743
|
}
|
|
128663
|
-
if (i10 >=
|
|
128744
|
+
if (i10 >= path68.length) return;
|
|
128664
128745
|
let j10 = i10 + 1;
|
|
128665
128746
|
depth = 0;
|
|
128666
|
-
for (; j10 <
|
|
128667
|
-
const c10 =
|
|
128747
|
+
for (; j10 < path68.length; j10++) {
|
|
128748
|
+
const c10 = path68.charCodeAt(j10);
|
|
128668
128749
|
if (c10 === 92) j10++;
|
|
128669
128750
|
else if (c10 === 40) depth++;
|
|
128670
128751
|
else if (c10 === 41 && depth > 0) depth--;
|
|
128671
128752
|
else if (c10 === 125 && depth === 0) break;
|
|
128672
128753
|
}
|
|
128673
|
-
if (j10 >=
|
|
128674
|
-
const mod =
|
|
128754
|
+
if (j10 >= path68.length) return;
|
|
128755
|
+
const mod = path68[j10 + 1];
|
|
128675
128756
|
const hasMod = mod === "?" || mod === "+" || mod === "*";
|
|
128676
128757
|
return [
|
|
128677
|
-
|
|
128678
|
-
|
|
128679
|
-
|
|
128758
|
+
path68.slice(0, i10),
|
|
128759
|
+
path68.slice(i10 + 1, j10),
|
|
128760
|
+
path68.slice(j10 + (hasMod ? 2 : 1)),
|
|
128680
128761
|
hasMod ? mod : void 0
|
|
128681
128762
|
];
|
|
128682
128763
|
}
|
|
128683
|
-
function expandGroupDelimiters(
|
|
128684
|
-
if (!
|
|
128685
|
-
const group = scanFirstGroup(
|
|
128764
|
+
function expandGroupDelimiters(path68) {
|
|
128765
|
+
if (!path68.includes("{")) return;
|
|
128766
|
+
const group = scanFirstGroup(path68);
|
|
128686
128767
|
if (!group) return;
|
|
128687
128768
|
const [pre2, body, suf, mod] = group;
|
|
128688
128769
|
if (!mod) return [pre2 + body + suf];
|
|
@@ -128752,9 +128833,9 @@ function replaceSegmentWildcards(segment, unnamedStart, toGroupKey = toUnnamedGr
|
|
|
128752
128833
|
}
|
|
128753
128834
|
return [replaced, nextIndex];
|
|
128754
128835
|
}
|
|
128755
|
-
function encodeEscapes(
|
|
128756
|
-
if (!
|
|
128757
|
-
return
|
|
128836
|
+
function encodeEscapes(path68) {
|
|
128837
|
+
if (!path68.includes("\\")) return path68;
|
|
128838
|
+
return path68.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
|
|
128758
128839
|
}
|
|
128759
128840
|
function segmentKey(segment) {
|
|
128760
128841
|
if (segment.startsWith("**")) return 2;
|
|
@@ -128783,22 +128864,22 @@ function expandModifiers(segments) {
|
|
|
128783
128864
|
return m10[2] === "+" ? [wc2] : [wc2, without];
|
|
128784
128865
|
}
|
|
128785
128866
|
}
|
|
128786
|
-
function normalizePath(
|
|
128787
|
-
if (!
|
|
128867
|
+
function normalizePath(path68) {
|
|
128868
|
+
if (!path68.includes("/.")) return path68;
|
|
128788
128869
|
const r10 = [];
|
|
128789
|
-
for (const s of
|
|
128870
|
+
for (const s of path68.split("/")) if (s === ".") continue;
|
|
128790
128871
|
else if (s === ".." && r10.length > 1) r10.pop();
|
|
128791
128872
|
else r10.push(s);
|
|
128792
128873
|
return r10.join("/") || "/";
|
|
128793
128874
|
}
|
|
128794
|
-
function splitPath(
|
|
128795
|
-
const s =
|
|
128875
|
+
function splitPath(path68) {
|
|
128876
|
+
const s = path68.split("/");
|
|
128796
128877
|
s.shift();
|
|
128797
128878
|
if (s[s.length - 1] === "") s.pop();
|
|
128798
128879
|
return s;
|
|
128799
128880
|
}
|
|
128800
|
-
function splitRoute(
|
|
128801
|
-
const s = splitPath(
|
|
128881
|
+
function splitRoute(path68) {
|
|
128882
|
+
const s = splitPath(path68);
|
|
128802
128883
|
while (s[s.length - 1] === "") s.pop();
|
|
128803
128884
|
return s;
|
|
128804
128885
|
}
|
|
@@ -128814,16 +128895,16 @@ function getMatchParams(segments, paramsMap) {
|
|
|
128814
128895
|
}
|
|
128815
128896
|
return params;
|
|
128816
128897
|
}
|
|
128817
|
-
function addRoute(ctx, method = "",
|
|
128898
|
+
function addRoute(ctx, method = "", path68, data) {
|
|
128818
128899
|
method = method.toUpperCase();
|
|
128819
|
-
if (
|
|
128820
|
-
const groupExpanded = expandGroupDelimiters(
|
|
128900
|
+
if (path68.charCodeAt(0) !== 47) path68 = `/${path68}`;
|
|
128901
|
+
const groupExpanded = expandGroupDelimiters(path68);
|
|
128821
128902
|
if (groupExpanded) {
|
|
128822
128903
|
for (const expandedPath of groupExpanded) addRoute(ctx, method, expandedPath, data);
|
|
128823
128904
|
return;
|
|
128824
128905
|
}
|
|
128825
|
-
|
|
128826
|
-
const segments = splitRoute(
|
|
128906
|
+
path68 = encodeEscapes(path68);
|
|
128907
|
+
const segments = splitRoute(path68);
|
|
128827
128908
|
const expanded = expandModifiers(segments);
|
|
128828
128909
|
if (expanded) {
|
|
128829
128910
|
for (const p of expanded) addRoute(ctx, method, p, data);
|
|
@@ -128914,15 +128995,15 @@ function getParamRegexp(segment, unnamedStart = 0) {
|
|
|
128914
128995
|
const regex = _s2.replace(/:([\w-]+)(?:\(([^)]*)\))?/g, (_, id2, p) => `(?<${toGroupName(id2)}>${p || "[^/]+"})`).replace(/\((?![?<])/g, () => `(?<${toUnnamedGroupKey(_i2++)}>`).replace(/\uFFFE(.)/g, (_, c10) => /[.*+?^${}()|[\]\\]/.test(c10) ? `\\${c10}` : c10);
|
|
128915
128996
|
return [new RegExp(`^${regex}$`), _i2];
|
|
128916
128997
|
}
|
|
128917
|
-
function findRoute(ctx, method = "",
|
|
128918
|
-
if (opts?.normalize)
|
|
128919
|
-
if (
|
|
128920
|
-
const staticNode = ctx.static[
|
|
128998
|
+
function findRoute(ctx, method = "", path68, opts) {
|
|
128999
|
+
if (opts?.normalize) path68 = normalizePath(path68);
|
|
129000
|
+
if (path68.charCodeAt(path68.length - 1) === 47) path68 = path68.slice(0, -1);
|
|
129001
|
+
const staticNode = ctx.static[path68];
|
|
128921
129002
|
if (staticNode && staticNode.methods) {
|
|
128922
129003
|
const staticMatch = staticNode.methods[method] || staticNode.methods[""];
|
|
128923
129004
|
if (staticMatch !== void 0) return staticMatch[0];
|
|
128924
129005
|
}
|
|
128925
|
-
const segments = splitPath(
|
|
129006
|
+
const segments = splitPath(path68);
|
|
128926
129007
|
const match = _lookupTree(ctx.root, method, segments, 0);
|
|
128927
129008
|
if (match === void 0) return;
|
|
128928
129009
|
if (opts?.params === false) return match;
|
|
@@ -129122,7 +129203,7 @@ var OpenAPIMatcher = class {
|
|
|
129122
129203
|
this.rootRouter = router;
|
|
129123
129204
|
this.index(router);
|
|
129124
129205
|
}
|
|
129125
|
-
index(router,
|
|
129206
|
+
index(router, path68 = []) {
|
|
129126
129207
|
const lazyResults = walkProcedureContractsSync(router, (contract, path210) => {
|
|
129127
129208
|
if (!value(this.filter, contract, path210)) {
|
|
129128
129209
|
return;
|
|
@@ -129137,7 +129218,7 @@ var OpenAPIMatcher = class {
|
|
|
129137
129218
|
contract,
|
|
129138
129219
|
procedure: contract instanceof Procedure ? contract : void 0
|
|
129139
129220
|
});
|
|
129140
|
-
},
|
|
129221
|
+
}, path68);
|
|
129141
129222
|
for (const result of lazyResults) {
|
|
129142
129223
|
const prefix = getOpenAPIMeta(result.router)?.prefix;
|
|
129143
129224
|
this.pendingLazyRouters.add({
|
|
@@ -129224,20 +129305,20 @@ var OpenAPIMatcher = class {
|
|
|
129224
129305
|
return entry.procedure;
|
|
129225
129306
|
}
|
|
129226
129307
|
};
|
|
129227
|
-
function toRou3Pattern(
|
|
129228
|
-
const params = getDynamicPathParams(
|
|
129308
|
+
function toRou3Pattern(path68) {
|
|
129309
|
+
const params = getDynamicPathParams(path68);
|
|
129229
129310
|
if (!params?.length) {
|
|
129230
|
-
return
|
|
129311
|
+
return path68;
|
|
129231
129312
|
}
|
|
129232
129313
|
for (let i10 = params.length - 1; i10 >= 0; i10--) {
|
|
129233
129314
|
const param = params[i10];
|
|
129234
129315
|
const pattern = param.allowsSlash ? `**:${param.parameterName}` : `:${param.parameterName}`;
|
|
129235
|
-
|
|
129316
|
+
path68 = path68.slice(0, param.startIndex) + pattern + path68.slice(param.startIndex + param.segment.length);
|
|
129236
129317
|
}
|
|
129237
|
-
return
|
|
129318
|
+
return path68;
|
|
129238
129319
|
}
|
|
129239
|
-
function toRou3PrefixMatcher(
|
|
129240
|
-
const pattern = toRou3Pattern(
|
|
129320
|
+
function toRou3PrefixMatcher(path68) {
|
|
129321
|
+
const pattern = toRou3Pattern(path68);
|
|
129241
129322
|
return routeToRegExp(pattern === "/" ? "/**" : `${pattern}/**`);
|
|
129242
129323
|
}
|
|
129243
129324
|
function decodeParams(params) {
|
|
@@ -129316,7 +129397,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
129316
129397
|
/**
|
|
129317
129398
|
* @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
|
|
129318
129399
|
*/
|
|
129319
|
-
encodeOutput(output2, procedure,
|
|
129400
|
+
encodeOutput(output2, procedure, path68) {
|
|
129320
129401
|
const meta3 = getOpenAPIMeta(procedure);
|
|
129321
129402
|
const successStatus = meta3?.successStatus ?? DEFAULT_SUCCESS_STATUS;
|
|
129322
129403
|
const outputStructure = meta3?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
|
|
@@ -129329,7 +129410,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
129329
129410
|
}
|
|
129330
129411
|
if (!isValidDetailedOutput(output2)) {
|
|
129331
129412
|
throw new TypeError(`
|
|
129332
|
-
Invalid "detailed" output structure returned by procedure (${
|
|
129413
|
+
Invalid "detailed" output structure returned by procedure (${path68.join(".")}):
|
|
129333
129414
|
\u2022 Expected an object with optional properties:
|
|
129334
129415
|
- status (number <400)
|
|
129335
129416
|
- headers (object)
|
|
@@ -129897,7 +129978,7 @@ function profileValue(name, paths) {
|
|
|
129897
129978
|
function createConfigApiRouter(deps) {
|
|
129898
129979
|
const authed = doorApiAuth(deps.expectedToken);
|
|
129899
129980
|
const { paths } = deps;
|
|
129900
|
-
const route = (
|
|
129981
|
+
const route = (path68, summary) => authed.meta(openapi({ method: "POST", path: path68, summary, tags: [CONFIG_API_TAG] }));
|
|
129901
129982
|
return {
|
|
129902
129983
|
config: {
|
|
129903
129984
|
identity: {
|
|
@@ -130859,16 +130940,16 @@ function walk2(body, hashing, parentAfter) {
|
|
|
130859
130940
|
continue;
|
|
130860
130941
|
}
|
|
130861
130942
|
const isKey = kind === STRING && depth >= 1 && expectKey[depth - 1] === true;
|
|
130862
|
-
const
|
|
130863
|
-
if (isKey &&
|
|
130943
|
+
const text4 = isKey ? body.toString("latin1", start, end) : void 0;
|
|
130944
|
+
if (isKey && text4 === CACHE_MARKER_KEY) {
|
|
130864
130945
|
skipNextValue = true;
|
|
130865
130946
|
continue;
|
|
130866
130947
|
}
|
|
130867
130948
|
if (depth === 1 && isKey) {
|
|
130868
|
-
topKey =
|
|
130949
|
+
topKey = text4;
|
|
130869
130950
|
}
|
|
130870
130951
|
const closesMessages = kind === CLOSE && inMessages && depth === MESSAGES_ARRAY_DEPTH;
|
|
130871
|
-
if (hashing && !closesMessages && !(depth === 1 && isKey && !THREAD_MEMBER_KEYS.has(
|
|
130952
|
+
if (hashing && !closesMessages && !(depth === 1 && isKey && !THREAD_MEMBER_KEYS.has(text4 ?? ""))) {
|
|
130872
130953
|
const target = inMessages ? messages : depth >= 1 && topKey !== void 0 && THREAD_MEMBER_KEYS.has(topKey) ? thread : void 0;
|
|
130873
130954
|
if (target !== void 0) {
|
|
130874
130955
|
target.update(body.subarray(start, end));
|
|
@@ -131838,8 +131919,8 @@ function createCodexRoute(ports) {
|
|
|
131838
131919
|
if (!parsed.success) {
|
|
131839
131920
|
return errorResponse(HTTP_STATUS.badRequest, "not a count_tokens request");
|
|
131840
131921
|
}
|
|
131841
|
-
const
|
|
131842
|
-
return { status: HTTP_STATUS.ok, headers: { "Content-Type": "application/json" }, body: JSON.stringify({ input_tokens: Math.ceil(
|
|
131922
|
+
const text4 = JSON.stringify({ system: parsed.data.system, messages: parsed.data.messages, tools: parsed.data.tools });
|
|
131923
|
+
return { status: HTTP_STATUS.ok, headers: { "Content-Type": "application/json" }, body: JSON.stringify({ input_tokens: Math.ceil(text4.length / CHARS_PER_TOKEN) }) };
|
|
131843
131924
|
};
|
|
131844
131925
|
return async (request7) => {
|
|
131845
131926
|
if (request7.method === "GET" && request7.path === "/healthz") {
|
|
@@ -131922,8 +132003,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
|
|
|
131922
132003
|
request7.body.resume();
|
|
131923
132004
|
return;
|
|
131924
132005
|
}
|
|
131925
|
-
const
|
|
131926
|
-
const translated = { method: request7.method, path:
|
|
132006
|
+
const path68 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
132007
|
+
const translated = { method: request7.method, path: path68, body, signal: request7.signal };
|
|
131927
132008
|
const routed = await route(translated);
|
|
131928
132009
|
if (request7.signal.aborted) {
|
|
131929
132010
|
return;
|
|
@@ -132544,8 +132625,8 @@ function createAntigravityRouteMount(ports, upstreamBase, provider) {
|
|
|
132544
132625
|
request7.body.resume();
|
|
132545
132626
|
return;
|
|
132546
132627
|
}
|
|
132547
|
-
const
|
|
132548
|
-
const translated = { method: request7.method, path:
|
|
132628
|
+
const path68 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
132629
|
+
const translated = { method: request7.method, path: path68, body, signal: request7.signal };
|
|
132549
132630
|
const routed = await route(translated);
|
|
132550
132631
|
if (request7.signal.aborted) {
|
|
132551
132632
|
return;
|
|
@@ -132586,7 +132667,7 @@ function createPassthroughRoute(name, target) {
|
|
|
132586
132667
|
headroomUpstream: target.headroomUpstream,
|
|
132587
132668
|
serve: async (request7, response) => {
|
|
132588
132669
|
const incoming = new URL(request7.url, "http://127.0.0.1");
|
|
132589
|
-
const
|
|
132670
|
+
const path68 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
|
|
132590
132671
|
const headers = forwardableHeaders(request7.headers);
|
|
132591
132672
|
delete headers.host;
|
|
132592
132673
|
await new Promise((resolve2) => {
|
|
@@ -132594,7 +132675,7 @@ function createPassthroughRoute(name, target) {
|
|
|
132594
132675
|
host: base.hostname,
|
|
132595
132676
|
port: base.port === "" ? void 0 : Number(base.port),
|
|
132596
132677
|
method: request7.method,
|
|
132597
|
-
path: `${basePath}${
|
|
132678
|
+
path: `${basePath}${path68}${incoming.search}`,
|
|
132598
132679
|
headers,
|
|
132599
132680
|
agent
|
|
132600
132681
|
};
|
|
@@ -132700,28 +132781,28 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
132700
132781
|
const body = request7.body;
|
|
132701
132782
|
const head = [];
|
|
132702
132783
|
let seen = 0;
|
|
132703
|
-
let
|
|
132784
|
+
let text4 = "";
|
|
132704
132785
|
let decided = false;
|
|
132705
132786
|
let ended = false;
|
|
132706
132787
|
let error63;
|
|
132707
132788
|
const replay = new import_node_stream2.PassThrough();
|
|
132708
|
-
const modelIn = () => /"model"\s*:\s*"([^"]+)"/.exec(
|
|
132789
|
+
const modelIn = () => /"model"\s*:\s*"([^"]+)"/.exec(text4)?.[1];
|
|
132709
132790
|
const settled = new Promise((resolve2) => {
|
|
132710
132791
|
const settle2 = () => {
|
|
132711
132792
|
const model = modelIn();
|
|
132712
|
-
const hasImage = /"type"\s*:\s*"image"/.test(
|
|
132793
|
+
const hasImage = /"type"\s*:\s*"image"/.test(text4);
|
|
132713
132794
|
for (const chunk2 of head) {
|
|
132714
132795
|
replay.write(chunk2);
|
|
132715
132796
|
}
|
|
132716
|
-
const maxTokens = /"max_tokens"\s*:\s*([0-9]+)/.exec(
|
|
132797
|
+
const maxTokens = /"max_tokens"\s*:\s*([0-9]+)/.exec(text4)?.[1];
|
|
132717
132798
|
resolve2({
|
|
132718
132799
|
...model === void 0 ? {} : { model },
|
|
132719
132800
|
hasImage,
|
|
132720
|
-
toolsPresent: /"tools"\s*:\s*\[\s*\{/.test(
|
|
132721
|
-
thinking: /"thinking"\s*:\s*\{\s*"type"\s*:\s*"enabled"/.test(
|
|
132801
|
+
toolsPresent: /"tools"\s*:\s*\[\s*\{/.test(text4),
|
|
132802
|
+
thinking: /"thinking"\s*:\s*\{\s*"type"\s*:\s*"enabled"/.test(text4),
|
|
132722
132803
|
...maxTokens === void 0 ? {} : { maxTokens: Number(maxTokens) },
|
|
132723
132804
|
isCountTokens: request7.url.includes("/v1/messages/count_tokens"),
|
|
132724
|
-
...wholeBody ? { whole: true, text:
|
|
132805
|
+
...wholeBody ? { whole: true, text: text4 } : {},
|
|
132725
132806
|
replayed: { ...request7, body: replay }
|
|
132726
132807
|
});
|
|
132727
132808
|
};
|
|
@@ -132737,7 +132818,7 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
132737
132818
|
}
|
|
132738
132819
|
head.push(chunk2);
|
|
132739
132820
|
seen += chunk2.length;
|
|
132740
|
-
|
|
132821
|
+
text4 += chunk2.toString("utf8");
|
|
132741
132822
|
if (!wholeBody && (modelIn() !== void 0 || seen >= REQUEST_SCAN_CAP_BYTES)) {
|
|
132742
132823
|
decided = true;
|
|
132743
132824
|
settle2();
|
|
@@ -132766,13 +132847,13 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
132766
132847
|
}
|
|
132767
132848
|
|
|
132768
132849
|
// src/frontdoor/providerRoute.ts
|
|
132769
|
-
var isRcSelfHostPath = (
|
|
132850
|
+
var isRcSelfHostPath = (path68) => path68 === "/v1/code/sessions" || path68.startsWith("/v1/code/sessions/") || path68 === "/v1/sessions" || path68.startsWith("/v1/sessions/");
|
|
132770
132851
|
function scopeSessionProviderPath(request7) {
|
|
132771
132852
|
if (request7.session.provider === void 0) {
|
|
132772
132853
|
return request7;
|
|
132773
132854
|
}
|
|
132774
|
-
const
|
|
132775
|
-
if (!
|
|
132855
|
+
const path68 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
132856
|
+
if (!path68.startsWith("/v1/") || isRcSelfHostPath(path68)) {
|
|
132776
132857
|
return request7;
|
|
132777
132858
|
}
|
|
132778
132859
|
return { ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` };
|
|
@@ -132895,13 +132976,13 @@ function createProviderRouteResolver(deps) {
|
|
|
132895
132976
|
return route;
|
|
132896
132977
|
};
|
|
132897
132978
|
const resolve2 = (request7) => {
|
|
132898
|
-
const
|
|
132899
|
-
const scoped = parseProviderPath(
|
|
132979
|
+
const path68 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
132980
|
+
const scoped = parseProviderPath(path68);
|
|
132900
132981
|
if (scoped === void 0) {
|
|
132901
|
-
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(
|
|
132982
|
+
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path68)) {
|
|
132902
132983
|
return { ok: true, route: deps.rcSelfHostRoute };
|
|
132903
132984
|
}
|
|
132904
|
-
return
|
|
132985
|
+
return path68.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path68}` };
|
|
132905
132986
|
}
|
|
132906
132987
|
const { provider } = scoped;
|
|
132907
132988
|
let definition;
|
|
@@ -132993,8 +133074,8 @@ function createProviderRouteResolver(deps) {
|
|
|
132993
133074
|
let modelChoice;
|
|
132994
133075
|
const visited = /* @__PURE__ */ new Set();
|
|
132995
133076
|
for (; ; ) {
|
|
132996
|
-
const
|
|
132997
|
-
const scoped = parseProviderPath(
|
|
133077
|
+
const path68 = new URL(current.url, "http://127.0.0.1").pathname;
|
|
133078
|
+
const scoped = parseProviderPath(path68);
|
|
132998
133079
|
const providerName = scoped?.provider ?? current.session.provider;
|
|
132999
133080
|
if (providerName !== void 0 && visited.has(providerName)) {
|
|
133000
133081
|
return { ok: false, status: HTTP_STATUS.internalServerError, message: `provider routing cycle: ${[...visited, providerName].join(" -> ")}` };
|
|
@@ -133009,7 +133090,7 @@ function createProviderRouteResolver(deps) {
|
|
|
133009
133090
|
} catch {
|
|
133010
133091
|
routes = void 0;
|
|
133011
133092
|
}
|
|
133012
|
-
const resolvesNames = !nameResolved && !isRcSelfHostPath(
|
|
133093
|
+
const resolvesNames = !nameResolved && !isRcSelfHostPath(path68);
|
|
133013
133094
|
if (resolvesNames) {
|
|
133014
133095
|
const scan2 = await scanRequestHead(current, true);
|
|
133015
133096
|
if (scan2.replayed === void 0) {
|
|
@@ -133048,7 +133129,7 @@ function createProviderRouteResolver(deps) {
|
|
|
133048
133129
|
}
|
|
133049
133130
|
if (routed.provider !== providerName) {
|
|
133050
133131
|
const scopedPrefix = providerName === void 0 ? void 0 : `${PROVIDER_PATH_PREFIX}${encodeURIComponent(providerName)}`;
|
|
133051
|
-
const rest2 = scopedPrefix !== void 0 &&
|
|
133132
|
+
const rest2 = scopedPrefix !== void 0 && path68.startsWith(scopedPrefix) ? path68.slice(scopedPrefix.length) : path68;
|
|
133052
133133
|
const query2 = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
|
|
133053
133134
|
const carried = replay;
|
|
133054
133135
|
current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(routed.provider)}${rest2}${query2}`, body: carried.body, headers: carried.headers };
|
|
@@ -133102,7 +133183,7 @@ function createProviderRouteResolver(deps) {
|
|
|
133102
133183
|
const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
|
|
133103
133184
|
replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
|
|
133104
133185
|
}
|
|
133105
|
-
const rest = scoped === void 0 ?
|
|
133186
|
+
const rest = scoped === void 0 ? path68 : path68.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
|
|
133106
133187
|
const query = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
|
|
133107
133188
|
current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(matched.provider)}${rest}${query}`, body: replay.body, headers: replay.headers };
|
|
133108
133189
|
}
|
|
@@ -133240,9 +133321,9 @@ function growthBookFeatures() {
|
|
|
133240
133321
|
};
|
|
133241
133322
|
}
|
|
133242
133323
|
var answerServerJson = (response, status, body) => {
|
|
133243
|
-
const
|
|
133244
|
-
response.writeHead(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(
|
|
133245
|
-
response.end(
|
|
133324
|
+
const text4 = JSON.stringify(body);
|
|
133325
|
+
response.writeHead(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(text4, "utf8")) });
|
|
133326
|
+
response.end(text4);
|
|
133246
133327
|
};
|
|
133247
133328
|
function createRcSelfHostLocal(deps) {
|
|
133248
133329
|
return {
|
|
@@ -133453,8 +133534,8 @@ function formatRcPendingList(pending) {
|
|
|
133453
133534
|
}
|
|
133454
133535
|
return pending.map((request7) => `${request7.sessionId} ${request7.requestId} ${request7.type}${request7.summary === "" ? "" : ` ${request7.summary}`} observed ${new Date(request7.observedAt).toISOString()}`);
|
|
133455
133536
|
}
|
|
133456
|
-
function eventExcerpt(
|
|
133457
|
-
return
|
|
133537
|
+
function eventExcerpt(text4) {
|
|
133538
|
+
return text4.length <= RC_PENDING_SUMMARY_EXCERPT_CHARS ? text4 : `${text4.slice(0, RC_PENDING_SUMMARY_EXCERPT_CHARS)}...`;
|
|
133458
133539
|
}
|
|
133459
133540
|
var PERCENT_SCALE = 100;
|
|
133460
133541
|
var MS_PER_SECOND14 = 1e3;
|
|
@@ -135153,9 +135234,9 @@ data: ${JSON.stringify(envelope)}
|
|
|
135153
135234
|
};
|
|
135154
135235
|
const sessionRow = (session) => ({ id: session.id, title: session.title, created_at: new Date(session.createdAt).toISOString(), status: "active", conversation_id: session.conversation.id });
|
|
135155
135236
|
const answerJson2 = async (response, status, body, extraHeaders = {}) => {
|
|
135156
|
-
const
|
|
135157
|
-
response.start(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(
|
|
135158
|
-
await response.write(
|
|
135237
|
+
const text4 = JSON.stringify(body);
|
|
135238
|
+
response.start(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(text4, "utf8")), ...extraHeaders });
|
|
135239
|
+
await response.write(text4);
|
|
135159
135240
|
response.end();
|
|
135160
135241
|
};
|
|
135161
135242
|
const noCredential = async (response) => {
|
|
@@ -135557,8 +135638,8 @@ function createSseParser() {
|
|
|
135557
135638
|
let dataLines = [];
|
|
135558
135639
|
let seenAnyText = false;
|
|
135559
135640
|
return {
|
|
135560
|
-
write: (
|
|
135561
|
-
let incoming =
|
|
135641
|
+
write: (text4) => {
|
|
135642
|
+
let incoming = text4;
|
|
135562
135643
|
if (!seenAnyText) {
|
|
135563
135644
|
seenAnyText = true;
|
|
135564
135645
|
incoming = incoming.charCodeAt(0) === SSE_BYTE_ORDER_MARK ? incoming.slice(1) : incoming;
|
|
@@ -136450,7 +136531,7 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, retire, trackTun
|
|
|
136450
136531
|
startProviderListener: async (preferredPort) => {
|
|
136451
136532
|
const authority = loadCa();
|
|
136452
136533
|
const rcDial = rcSelfHost ? lateRcEventDial(rcSelfHostDialTarget) : realRcEventDial();
|
|
136453
|
-
const rcInject = async (sessionId,
|
|
136534
|
+
const rcInject = async (sessionId, text4) => await injectRcUserMessage({ credentialOf: rcTracker.credentialOf, noteSequenceNums: rcTracker.noteSequenceNums, dial: rcDial, newUuid: import_node_crypto25.randomUUID }, sessionId, text4);
|
|
136454
136535
|
const rcAnswer = async (sessionId, requestId, decision) => await answerRcControlRequest({ credentialOf: rcTracker.credentialOf, pendingOf: (id2) => rcTracker.pendingOf(id2), completePending: rcTracker.completePending, noteSequenceNums: rcTracker.noteSequenceNums, dial: rcDial }, sessionId, requestId, decision);
|
|
136455
136536
|
const rcControlRequestDeps = { credentialOf: rcTracker.credentialOf, noteSequenceNums: rcTracker.noteSequenceNums, dial: rcDial, newUuid: import_node_crypto25.randomUUID };
|
|
136456
136537
|
const rcInterrupt = async (sessionId) => await interruptRcSession(rcControlRequestDeps, sessionId);
|
|
@@ -136736,7 +136817,7 @@ function registerFrontDoorCommand(program2, deps) {
|
|
|
136736
136817
|
// src/statusline/commands.ts
|
|
136737
136818
|
var import_node_child_process8 = require("node:child_process");
|
|
136738
136819
|
var import_node_os13 = __toESM(require("node:os"), 1);
|
|
136739
|
-
var
|
|
136820
|
+
var import_node_path58 = __toESM(require("node:path"), 1);
|
|
136740
136821
|
init_commandDeps();
|
|
136741
136822
|
init_statusline();
|
|
136742
136823
|
init_providersStore();
|
|
@@ -136948,9 +137029,9 @@ function antigravityWindowsOf(payload, nowMs) {
|
|
|
136948
137029
|
return { fiveHourUsed: five.used, fiveHourResetAt: five.resetAt, sevenDayUsed: seven.used, sevenDayResetAt: seven.resetAt };
|
|
136949
137030
|
}
|
|
136950
137031
|
function quotaFamiliesOf(buckets, nowMs) {
|
|
136951
|
-
return antigravityFamilyBuckets(buckets).flatMap(({ label, bucket }) => {
|
|
137032
|
+
return antigravityFamilyBuckets(buckets).flatMap(({ label: label2, bucket }) => {
|
|
136952
137033
|
const { used, resetAt } = bucketView(bucket, nowMs);
|
|
136953
|
-
return used === void 0 ? [] : [{ measures:
|
|
137034
|
+
return used === void 0 ? [] : [{ measures: label2, utilization: used / FULL_PERCENT2, resetsAt: resetAt }];
|
|
136954
137035
|
});
|
|
136955
137036
|
}
|
|
136956
137037
|
function enrichStatuslinePayload(params) {
|
|
@@ -137063,6 +137144,10 @@ var ClientPayloadSchema = external_exports.looseObject({
|
|
|
137063
137144
|
session_id: text2,
|
|
137064
137145
|
transcript_path: text2,
|
|
137065
137146
|
cwd: text2,
|
|
137147
|
+
/** The Claude Code release the session runs. */
|
|
137148
|
+
version: text2,
|
|
137149
|
+
/** The reasoning effort: a level name, or an object carrying one in `level` (Claude Code 2.1.115 and later). */
|
|
137150
|
+
effort: external_exports.union([external_exports.string(), external_exports.looseObject({ level: text2 })]).optional().catch(void 0),
|
|
137066
137151
|
workspace: external_exports.looseObject({
|
|
137067
137152
|
current_dir: text2,
|
|
137068
137153
|
project_dir: text2,
|
|
@@ -137111,16 +137196,52 @@ function realStatuslinePorts(env) {
|
|
|
137111
137196
|
return {
|
|
137112
137197
|
env,
|
|
137113
137198
|
homeDirectory: import_node_os12.default.homedir(),
|
|
137114
|
-
readText: (
|
|
137199
|
+
readText: (path68) => {
|
|
137200
|
+
try {
|
|
137201
|
+
return import_node_fs22.default.readFileSync(path68, "utf8");
|
|
137202
|
+
} catch {
|
|
137203
|
+
return void 0;
|
|
137204
|
+
}
|
|
137205
|
+
},
|
|
137206
|
+
readRange: (file2, start, length) => {
|
|
137115
137207
|
try {
|
|
137116
|
-
|
|
137208
|
+
const descriptor = import_node_fs22.default.openSync(file2, "r");
|
|
137209
|
+
try {
|
|
137210
|
+
const { size } = import_node_fs22.default.fstatSync(descriptor);
|
|
137211
|
+
const buffer2 = Buffer.alloc(Math.max(0, Math.min(length, size - start)));
|
|
137212
|
+
const read = import_node_fs22.default.readSync(descriptor, buffer2, 0, buffer2.length, start);
|
|
137213
|
+
return { size, bytes: buffer2.subarray(0, read) };
|
|
137214
|
+
} finally {
|
|
137215
|
+
import_node_fs22.default.closeSync(descriptor);
|
|
137216
|
+
}
|
|
137117
137217
|
} catch {
|
|
137118
137218
|
return void 0;
|
|
137119
137219
|
}
|
|
137120
137220
|
},
|
|
137121
137221
|
run: (file2, args, cwd) => {
|
|
137122
137222
|
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"] });
|
|
137223
|
+
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 });
|
|
137224
|
+
} catch {
|
|
137225
|
+
return void 0;
|
|
137226
|
+
}
|
|
137227
|
+
},
|
|
137228
|
+
entryKind: (path68) => {
|
|
137229
|
+
try {
|
|
137230
|
+
return import_node_fs22.default.lstatSync(path68).isDirectory() ? "directory" : "other";
|
|
137231
|
+
} catch {
|
|
137232
|
+
return void 0;
|
|
137233
|
+
}
|
|
137234
|
+
},
|
|
137235
|
+
realPath: (path68) => {
|
|
137236
|
+
try {
|
|
137237
|
+
return import_node_fs22.default.realpathSync(path68);
|
|
137238
|
+
} catch {
|
|
137239
|
+
return void 0;
|
|
137240
|
+
}
|
|
137241
|
+
},
|
|
137242
|
+
modifiedAtMs: (path68) => {
|
|
137243
|
+
try {
|
|
137244
|
+
return import_node_fs22.default.statSync(path68).mtimeMs;
|
|
137124
137245
|
} catch {
|
|
137125
137246
|
return void 0;
|
|
137126
137247
|
}
|
|
@@ -137135,8 +137256,8 @@ init_statusline();
|
|
|
137135
137256
|
var ESCAPE_CHAR_CODE = 27;
|
|
137136
137257
|
var ESCAPE = String.fromCharCode(ESCAPE_CHAR_CODE);
|
|
137137
137258
|
var ANSI_REGEX = new RegExp(`${ESCAPE}\\[[0-9;]*[a-zA-Z]`, "g");
|
|
137138
|
-
function visibleLength(
|
|
137139
|
-
return
|
|
137259
|
+
function visibleLength(text4) {
|
|
137260
|
+
return text4.replace(ANSI_REGEX, "").length;
|
|
137140
137261
|
}
|
|
137141
137262
|
|
|
137142
137263
|
// src/statusline/barGrid.ts
|
|
@@ -137165,8 +137286,8 @@ function measureGrid(rows, separatorLength, baseBarCells) {
|
|
|
137165
137286
|
const fixed = [...prefixWidths, ...suffixWidths].reduce((total, width) => total + width, 0) + columns * (baseBarCells + BRACKET_COLUMNS);
|
|
137166
137287
|
return { rows, columns, prefixWidths, suffixWidths, baseWidth: fixed + separatorLength * (columns - 1) };
|
|
137167
137288
|
}
|
|
137168
|
-
function padTo(
|
|
137169
|
-
return
|
|
137289
|
+
function padTo(text4, width) {
|
|
137290
|
+
return text4 + " ".repeat(Math.max(0, width - visibleLength(text4)));
|
|
137170
137291
|
}
|
|
137171
137292
|
function renderGrid(grid, maxWidth, separator, baseBarCells) {
|
|
137172
137293
|
const separatorLength = visibleLength(separator);
|
|
@@ -137209,6 +137330,12 @@ function layoutBarGrid(groups, maxWidth, separator, baseBarCells) {
|
|
|
137209
137330
|
return renderGrid(layoutFor(1), maxWidth, separator, baseBarCells);
|
|
137210
137331
|
}
|
|
137211
137332
|
|
|
137333
|
+
// src/statusline/graphemes.ts
|
|
137334
|
+
var SEGMENTER = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
137335
|
+
function graphemesOf(text4) {
|
|
137336
|
+
return Array.from(SEGMENTER.segment(text4), (part) => part.segment);
|
|
137337
|
+
}
|
|
137338
|
+
|
|
137212
137339
|
// src/statusline/elements/header/account.ts
|
|
137213
137340
|
function tierSuffixOf(tier) {
|
|
137214
137341
|
const match = /_(\d+x)$/i.exec(tier ?? "");
|
|
@@ -137258,14 +137385,79 @@ function planLabelOf(tier) {
|
|
|
137258
137385
|
}
|
|
137259
137386
|
return cleaned;
|
|
137260
137387
|
}
|
|
137261
|
-
function
|
|
137388
|
+
function truncatedUser(email3, length) {
|
|
137389
|
+
const characters = graphemesOf(email3);
|
|
137390
|
+
return length === 0 || characters.length <= length ? email3 : `${characters.slice(0, length).join("")}\u2026`;
|
|
137391
|
+
}
|
|
137392
|
+
function accountSegment({ summary, settings: settings2 }) {
|
|
137262
137393
|
const loginPlan = summary.provider === void 0 ? summary.loginPlan ?? accountPlanLabel(summary) : void 0;
|
|
137263
137394
|
const loginOrgName = summary.loginOrganizationType === "claude_team" || summary.loginOrganizationType === "claude_enterprise" ? summary.loginOrganizationName : void 0;
|
|
137264
|
-
const
|
|
137265
|
-
|
|
137266
|
-
|
|
137395
|
+
const available = {
|
|
137396
|
+
user: summary.loginAccountEmail === void 0 ? void 0 : truncatedUser(summary.loginAccountEmail, settings2.account.userLength),
|
|
137397
|
+
organisation: loginOrgName,
|
|
137398
|
+
plan: loginPlan
|
|
137399
|
+
};
|
|
137400
|
+
const namesLogin = summary.loginAccountEmail !== void 0 && summary.loginAccountEmail !== summary.providerAccountEmail || summary.provider === void 0;
|
|
137401
|
+
const shown = settings2.account.parts.map((part) => available[part]).filter((part) => part !== void 0);
|
|
137402
|
+
return namesLogin && shown.length > 0 ? shown.join(" \xB7 ") : void 0;
|
|
137403
|
+
}
|
|
137404
|
+
|
|
137405
|
+
// src/statusline/sanitise.ts
|
|
137406
|
+
init_statusline();
|
|
137407
|
+
var BELL = "\\u0007";
|
|
137408
|
+
var ESCAPE_SEQUENCES = new RegExp([`${ESCAPE}\\[[0-?]*[ -/]*[@-~]`, `${ESCAPE}\\][^${BELL}${ESCAPE}]*(?:${BELL}|${ESCAPE}\\\\)`, `${ESCAPE}[@-Z\\\\-_]`].join("|"), "g");
|
|
137409
|
+
var CONTROL_AND_BIDI = /[\p{Cc}---]/gu;
|
|
137410
|
+
function sanitiseDisplayText(text4) {
|
|
137411
|
+
return text4.replace(ESCAPE_SEQUENCES, "").replace(CONTROL_AND_BIDI, "");
|
|
137412
|
+
}
|
|
137413
|
+
function boundedDisplayText(text4) {
|
|
137414
|
+
return graphemesOf(sanitiseDisplayText(text4).trim()).slice(0, MAX_DISPLAY_TEXT_CHARS).join("").trim();
|
|
137415
|
+
}
|
|
137416
|
+
|
|
137417
|
+
// src/statusline/elements/header/advisor.ts
|
|
137418
|
+
var MODEL_ID = /^(?:claude-)?(?:(\d{1,2})(?:-(\d{1,2}))?-)?(opus|sonnet|haiku)(?:-(\d{1,2})(?:-(\d{1,2}))?)?(?:-\d{8})?$/i;
|
|
137419
|
+
function prettifyModelId(id2) {
|
|
137420
|
+
const match = MODEL_ID.exec(id2);
|
|
137421
|
+
if (match === null) {
|
|
137422
|
+
return id2.replace(/^claude-/i, "");
|
|
137423
|
+
}
|
|
137424
|
+
const [, leadingMajor, leadingMinor, family = "", trailingMajor, trailingMinor] = match;
|
|
137425
|
+
const major = leadingMajor ?? trailingMajor;
|
|
137426
|
+
const minor = leadingMajor === void 0 ? trailingMinor : leadingMinor;
|
|
137427
|
+
const version2 = major === void 0 ? "" : ` ${major}${minor === void 0 ? "" : `.${minor}`}`;
|
|
137428
|
+
return `${family.charAt(0).toUpperCase()}${family.slice(1).toLowerCase()}${version2}`;
|
|
137429
|
+
}
|
|
137430
|
+
function advisorSegment({ settings: settings2, transcriptIdentity }) {
|
|
137431
|
+
if (settings2.advisor.override !== "") {
|
|
137432
|
+
return `Advisor: ${settings2.advisor.override}`;
|
|
137433
|
+
}
|
|
137434
|
+
const recorded = transcriptIdentity().advisor;
|
|
137435
|
+
const advisor = recorded === void 0 ? "" : boundedDisplayText(prettifyModelId(recorded));
|
|
137436
|
+
return advisor === "" ? void 0 : `Advisor: ${advisor}`;
|
|
137437
|
+
}
|
|
137438
|
+
|
|
137439
|
+
// src/statusline/elements/header/effort.ts
|
|
137440
|
+
var EFFORT_SYMBOLS = /* @__PURE__ */ new Map([
|
|
137441
|
+
["low", "\u25CB"],
|
|
137442
|
+
["medium", "\u25D4"],
|
|
137443
|
+
["high", "\u25D1"],
|
|
137444
|
+
["xhigh", "\u25D5"],
|
|
137445
|
+
["max", "\u25CF"]
|
|
137446
|
+
]);
|
|
137447
|
+
function effortLevelOf(effort) {
|
|
137448
|
+
const level = boundedDisplayText((typeof effort === "string" ? effort : effort?.level) ?? "").toLowerCase();
|
|
137449
|
+
return level === "" ? void 0 : level;
|
|
137450
|
+
}
|
|
137451
|
+
function formatEffort(level, format) {
|
|
137452
|
+
const symbol3 = EFFORT_SYMBOLS.get(level);
|
|
137453
|
+
if (symbol3 === void 0 || format === "text") {
|
|
137454
|
+
return level;
|
|
137267
137455
|
}
|
|
137268
|
-
return
|
|
137456
|
+
return format === "symbol" ? symbol3 : `${symbol3} ${level}`;
|
|
137457
|
+
}
|
|
137458
|
+
function effortSegment({ payload, settings: settings2 }) {
|
|
137459
|
+
const level = effortLevelOf(payload.effort);
|
|
137460
|
+
return level === void 0 ? void 0 : formatEffort(level, settings2.effort.format);
|
|
137269
137461
|
}
|
|
137270
137462
|
|
|
137271
137463
|
// src/statusline/palette.ts
|
|
@@ -137317,9 +137509,9 @@ function createPalette(colours, enabled) {
|
|
|
137317
137509
|
};
|
|
137318
137510
|
return {
|
|
137319
137511
|
ansi,
|
|
137320
|
-
paint: (role,
|
|
137512
|
+
paint: (role, text4) => {
|
|
137321
137513
|
const start = ansi(role);
|
|
137322
|
-
return start === "" ?
|
|
137514
|
+
return start === "" ? text4 : `${start}${text4}${RESET}`;
|
|
137323
137515
|
}
|
|
137324
137516
|
};
|
|
137325
137517
|
}
|
|
@@ -137334,8 +137526,8 @@ var TEN = 10;
|
|
|
137334
137526
|
var TWENTY = 20;
|
|
137335
137527
|
var FULL_PERCENT3 = 100;
|
|
137336
137528
|
var ONE_PERCENT = 1;
|
|
137337
|
-
function withColor(color,
|
|
137338
|
-
return color === "" ?
|
|
137529
|
+
function withColor(color, text4) {
|
|
137530
|
+
return color === "" ? text4 : `${color}${text4}${RESET}`;
|
|
137339
137531
|
}
|
|
137340
137532
|
function statusColor(fraction, isUsedMetric, style) {
|
|
137341
137533
|
const yellowAt = style.bands.warnAt / FULL_PERCENT3;
|
|
@@ -137430,19 +137622,135 @@ function identitySegment({ summary }) {
|
|
|
137430
137622
|
function choiceNamesProvider(summary) {
|
|
137431
137623
|
return summary.modelChoice !== void 0 && (summary.modelChoice.providers.length > 1 || summary.routedTarget !== void 0);
|
|
137432
137624
|
}
|
|
137433
|
-
|
|
137434
|
-
|
|
137435
|
-
const
|
|
137436
|
-
return
|
|
137625
|
+
var CLAUDE_MODEL_ID_PREFIXES = ["claude-", "anthropic."];
|
|
137626
|
+
function isClaudeModelId(id2) {
|
|
137627
|
+
const lower = id2.toLowerCase();
|
|
137628
|
+
return CLAUDE_MODEL_ID_PREFIXES.some((prefix) => lower.startsWith(prefix));
|
|
137629
|
+
}
|
|
137630
|
+
function formatModelName(name, format) {
|
|
137631
|
+
if (format === "full") {
|
|
137632
|
+
return name;
|
|
137633
|
+
}
|
|
137634
|
+
const withoutContext = name.replace(/\s*\([^)]*\bcontext\b[^)]*\)/i, "").trim();
|
|
137635
|
+
return format === "short" ? withoutContext.replace(/^Claude\s+/i, "") : withoutContext;
|
|
137636
|
+
}
|
|
137637
|
+
function modelNameOf({ view, settings: settings2, transcriptIdentity }) {
|
|
137638
|
+
if (settings2.model.override !== "") {
|
|
137639
|
+
return { name: settings2.model.override, isServed: false };
|
|
137640
|
+
}
|
|
137641
|
+
if (settings2.model.source !== "client") {
|
|
137642
|
+
const served = transcriptIdentity().model;
|
|
137643
|
+
if (served !== void 0 && (settings2.model.source === "transcript" || !isClaudeModelId(served))) {
|
|
137644
|
+
return { name: formatModelName(served, settings2.model.format), isServed: true };
|
|
137645
|
+
}
|
|
137646
|
+
}
|
|
137647
|
+
return view.modelDisplayName === void 0 || view.modelDisplayName === "" ? void 0 : { name: formatModelName(view.modelDisplayName, settings2.model.format), isServed: false };
|
|
137648
|
+
}
|
|
137649
|
+
function modelSegment(context) {
|
|
137650
|
+
const { summary } = context;
|
|
137651
|
+
const model = modelNameOf(context);
|
|
137652
|
+
if (model === void 0 || model.name === "") {
|
|
137653
|
+
return void 0;
|
|
137654
|
+
}
|
|
137655
|
+
if (summary.modelChoice === void 0 || model.isServed) {
|
|
137656
|
+
return model.name;
|
|
137657
|
+
}
|
|
137658
|
+
return `${model.name} -> ${choiceNamesProvider(summary) ? `${summary.modelChoice.provider}/${summary.modelChoice.served}` : summary.modelChoice.served}`;
|
|
137659
|
+
}
|
|
137660
|
+
|
|
137661
|
+
// src/statusline/elements/header/outputStyle.ts
|
|
137662
|
+
var import_node_path56 = __toESM(require("node:path"), 1);
|
|
137663
|
+
init_zod();
|
|
137664
|
+
var SettingsFileSchema = external_exports.looseObject({ outputStyle: external_exports.string().optional().catch(void 0) });
|
|
137665
|
+
function outputStyleIn(file2, readText) {
|
|
137666
|
+
const text4 = readText(file2);
|
|
137667
|
+
if (text4 === void 0) {
|
|
137668
|
+
return void 0;
|
|
137669
|
+
}
|
|
137670
|
+
let parsed;
|
|
137671
|
+
try {
|
|
137672
|
+
parsed = JSON.parse(text4);
|
|
137673
|
+
} catch {
|
|
137674
|
+
return void 0;
|
|
137675
|
+
}
|
|
137676
|
+
const settings2 = SettingsFileSchema.safeParse(parsed);
|
|
137677
|
+
const style = settings2.success ? boundedDisplayText(settings2.data.outputStyle ?? "") : "";
|
|
137678
|
+
return style === "" ? void 0 : style;
|
|
137679
|
+
}
|
|
137680
|
+
function outputStyleSegment({ payload, ports }) {
|
|
137681
|
+
const pinned = ports.env.CLAUDE_CONFIG_DIR;
|
|
137682
|
+
const configDirectory = pinned === void 0 || pinned === "" ? import_node_path56.default.join(ports.homeDirectory, ".claude") : pinned;
|
|
137683
|
+
const projectDirectory = payload.cwd ?? payload.workspace?.current_dir;
|
|
137684
|
+
const files = [
|
|
137685
|
+
import_node_path56.default.join(configDirectory, "settings.json"),
|
|
137686
|
+
import_node_path56.default.join(configDirectory, "settings.local.json"),
|
|
137687
|
+
...projectDirectory === void 0 ? [] : [import_node_path56.default.join(projectDirectory, ".claude", "settings.json"), import_node_path56.default.join(projectDirectory, ".claude", "settings.local.json")]
|
|
137688
|
+
];
|
|
137689
|
+
const style = files.map((file2) => outputStyleIn(file2, ports.readText)).findLast((name) => name !== void 0);
|
|
137690
|
+
return style === void 0 ? void 0 : `style: ${style}`;
|
|
137691
|
+
}
|
|
137692
|
+
|
|
137693
|
+
// src/statusline/projectPath.ts
|
|
137694
|
+
var SEPARATORS = /[/\\]/;
|
|
137695
|
+
var SEPARATOR_AT_START = /^[/\\]/;
|
|
137696
|
+
var UNC_PREFIX = /^[/\\]{2}/;
|
|
137697
|
+
var DRIVE_PREFIX = /^[A-Za-z]:[/\\]/;
|
|
137698
|
+
var MAX_ADDED_DIRS_SHOWN = 5;
|
|
137699
|
+
var MAX_ADDED_DIR_NAME_CHARS = 24;
|
|
137700
|
+
function formatProjectPath(cwd, levels) {
|
|
137701
|
+
const safe = sanitiseDisplayText(cwd);
|
|
137702
|
+
const segments = safe.split(SEPARATORS).filter((segment) => segment !== "");
|
|
137703
|
+
if (levels !== "full") {
|
|
137704
|
+
const shown = segments.slice(-Number(levels)).join("/");
|
|
137705
|
+
return shown !== "" ? shown : SEPARATOR_AT_START.test(safe) ? "/" : safe;
|
|
137706
|
+
}
|
|
137707
|
+
if (UNC_PREFIX.test(safe)) {
|
|
137708
|
+
return segments.length > 0 ? `//${segments.join("/")}` : "//";
|
|
137709
|
+
}
|
|
137710
|
+
if (DRIVE_PREFIX.test(safe)) {
|
|
137711
|
+
const joined3 = segments.join("/");
|
|
137712
|
+
return segments.length === 1 ? `${joined3}/` : joined3;
|
|
137713
|
+
}
|
|
137714
|
+
if (SEPARATOR_AT_START.test(safe)) {
|
|
137715
|
+
return segments.length > 0 ? `/${segments.join("/")}` : "/";
|
|
137716
|
+
}
|
|
137717
|
+
return segments.join("/") || safe;
|
|
137718
|
+
}
|
|
137719
|
+
function basenameOf(dir) {
|
|
137720
|
+
const segments = dir.split(SEPARATORS).filter((segment) => segment !== "");
|
|
137721
|
+
return segments.at(-1) ?? dir;
|
|
137722
|
+
}
|
|
137723
|
+
function addedDirNames(dirs) {
|
|
137724
|
+
const all2 = (dirs ?? []).map((dir) => sanitiseDisplayText(basenameOf(dir))).filter((name) => name !== "");
|
|
137725
|
+
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`);
|
|
137726
|
+
return { names, more: all2.length - names.length };
|
|
137727
|
+
}
|
|
137728
|
+
function workingDirectoryOf(payload) {
|
|
137729
|
+
const cwd = payload.cwd ?? payload.workspace?.current_dir;
|
|
137730
|
+
return cwd === void 0 || cwd === "" ? void 0 : cwd;
|
|
137731
|
+
}
|
|
137732
|
+
|
|
137733
|
+
// src/statusline/elements/header/project.ts
|
|
137734
|
+
function inlineAddedDirs({ payload, palette }) {
|
|
137735
|
+
const { names, more } = addedDirNames(payload.workspace?.added_dirs);
|
|
137736
|
+
const drawn = [...names.map((name) => `+${name}`), ...more > 0 ? [`+${String(more)} more`] : []];
|
|
137737
|
+
return drawn.length === 0 ? void 0 : drawn.map((text4) => palette.paint("label", text4)).join(" ");
|
|
137738
|
+
}
|
|
137739
|
+
function projectSegment(context) {
|
|
137740
|
+
const { payload, settings: settings2 } = context;
|
|
137741
|
+
const cwd = workingDirectoryOf(payload);
|
|
137742
|
+
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);
|
|
137743
|
+
return parts.length === 0 ? void 0 : parts.join(" ");
|
|
137437
137744
|
}
|
|
137438
137745
|
|
|
137439
137746
|
// src/statusline/elements/header/provider.ts
|
|
137440
|
-
function providerSegment({ summary }) {
|
|
137441
|
-
|
|
137747
|
+
function providerSegment({ summary, settings: settings2 }) {
|
|
137748
|
+
const label2 = settings2.provider.name === "" ? summary.provider : settings2.provider.name;
|
|
137749
|
+
if (label2 === void 0) {
|
|
137442
137750
|
return void 0;
|
|
137443
137751
|
}
|
|
137444
137752
|
const account = [summary.providerAccountEmail, summary.providerPlan].filter((part) => part !== void 0);
|
|
137445
|
-
return account.length > 0 ? `${
|
|
137753
|
+
return account.length > 0 ? `${label2} \xB7 ${account.join(" \xB7 ")}` : label2;
|
|
137446
137754
|
}
|
|
137447
137755
|
|
|
137448
137756
|
// src/statusline/elements/header/route.ts
|
|
@@ -137450,6 +137758,296 @@ function routeSegment({ summary }) {
|
|
|
137450
137758
|
return summary.routedTarget !== void 0 && !choiceNamesProvider(summary) ? `via ${summary.routedTarget}` : void 0;
|
|
137451
137759
|
}
|
|
137452
137760
|
|
|
137761
|
+
// src/statusline/elements/header/version.ts
|
|
137762
|
+
function versionSegment({ payload }) {
|
|
137763
|
+
const version2 = boundedDisplayText(payload.version ?? "");
|
|
137764
|
+
return version2 === "" ? void 0 : `CC v${version2}`;
|
|
137765
|
+
}
|
|
137766
|
+
|
|
137767
|
+
// src/statusline/vcs/git.ts
|
|
137768
|
+
var GIT = "git";
|
|
137769
|
+
var NUL = "\0";
|
|
137770
|
+
var BRANCH_AHEAD_BEHIND = /^# branch\.ab \+(\d+) -(\d+)$/;
|
|
137771
|
+
var DETACHED_ABBREV = "HEAD";
|
|
137772
|
+
var DETACHED_HEAD = "(detached)";
|
|
137773
|
+
var NO_COMMIT_YET = "(initial)";
|
|
137774
|
+
var ORDINARY_LEADING_FIELDS = 8;
|
|
137775
|
+
var RENAMED_LEADING_FIELDS = 9;
|
|
137776
|
+
var UNMERGED_LEADING_FIELDS = 10;
|
|
137777
|
+
function kindOfCode(code) {
|
|
137778
|
+
const index = code.charAt(0);
|
|
137779
|
+
const workTree = code.charAt(1);
|
|
137780
|
+
if (index === "A") {
|
|
137781
|
+
return "added";
|
|
137782
|
+
}
|
|
137783
|
+
if (index === "D" || workTree === "D") {
|
|
137784
|
+
return "deleted";
|
|
137785
|
+
}
|
|
137786
|
+
if (index === "M" || workTree === "M" || index === "R" || index === "C") {
|
|
137787
|
+
return "modified";
|
|
137788
|
+
}
|
|
137789
|
+
return void 0;
|
|
137790
|
+
}
|
|
137791
|
+
function parseStatus(output2) {
|
|
137792
|
+
const fields = output2.split(NUL);
|
|
137793
|
+
let head;
|
|
137794
|
+
let noCommitYet = false;
|
|
137795
|
+
let ahead = 0;
|
|
137796
|
+
let behind = 0;
|
|
137797
|
+
let dirty = false;
|
|
137798
|
+
let untracked = 0;
|
|
137799
|
+
const tracked = [];
|
|
137800
|
+
for (let index = 0; index < fields.length; index += 1) {
|
|
137801
|
+
const field = fields[index] ?? "";
|
|
137802
|
+
if (field === "") {
|
|
137803
|
+
continue;
|
|
137804
|
+
}
|
|
137805
|
+
if (field.startsWith("# branch.head ")) {
|
|
137806
|
+
head = field.slice("# branch.head ".length);
|
|
137807
|
+
} else if (field.startsWith("# branch.oid ")) {
|
|
137808
|
+
noCommitYet = field.slice("# branch.oid ".length) === NO_COMMIT_YET;
|
|
137809
|
+
} else if (field.startsWith("# branch.ab ")) {
|
|
137810
|
+
const counts = BRANCH_AHEAD_BEHIND.exec(field);
|
|
137811
|
+
ahead = Number(counts?.[1] ?? 0);
|
|
137812
|
+
behind = Number(counts?.[2] ?? 0);
|
|
137813
|
+
} else if (!field.startsWith("# ")) {
|
|
137814
|
+
dirty = true;
|
|
137815
|
+
const parts = field.split(" ");
|
|
137816
|
+
const code = parts[1] ?? "";
|
|
137817
|
+
if (field.startsWith("? ")) {
|
|
137818
|
+
untracked += 1;
|
|
137819
|
+
} else if (field.startsWith("1 ") || field.startsWith("2 ") || field.startsWith("u ")) {
|
|
137820
|
+
const leading = field.startsWith("1 ") ? ORDINARY_LEADING_FIELDS : field.startsWith("2 ") ? RENAMED_LEADING_FIELDS : UNMERGED_LEADING_FIELDS;
|
|
137821
|
+
const kind = kindOfCode(code);
|
|
137822
|
+
if (kind !== void 0) {
|
|
137823
|
+
tracked.push({ path: parts.slice(leading).join(" "), kind });
|
|
137824
|
+
}
|
|
137825
|
+
if (field.startsWith("2 ")) {
|
|
137826
|
+
index += 1;
|
|
137827
|
+
}
|
|
137828
|
+
}
|
|
137829
|
+
}
|
|
137830
|
+
}
|
|
137831
|
+
return { head, noCommitYet, ahead, behind, dirty, tracked, untracked };
|
|
137832
|
+
}
|
|
137833
|
+
function parseNumstat(output2) {
|
|
137834
|
+
const fields = output2.split(NUL);
|
|
137835
|
+
const byPath = /* @__PURE__ */ new Map();
|
|
137836
|
+
let added = 0;
|
|
137837
|
+
let deleted = 0;
|
|
137838
|
+
for (let index = 0; index < fields.length; index += 1) {
|
|
137839
|
+
const [addedText, deletedText, pathText] = (fields[index] ?? "").split(" ");
|
|
137840
|
+
if (addedText === void 0 || deletedText === void 0 || pathText === void 0) {
|
|
137841
|
+
continue;
|
|
137842
|
+
}
|
|
137843
|
+
const path68 = pathText === "" ? fields[index + 2] : pathText;
|
|
137844
|
+
if (pathText === "") {
|
|
137845
|
+
index += 2;
|
|
137846
|
+
}
|
|
137847
|
+
const lines = { added: Number(addedText), deleted: Number(deletedText) };
|
|
137848
|
+
if (path68 !== void 0 && Number.isInteger(lines.added) && Number.isInteger(lines.deleted)) {
|
|
137849
|
+
added += lines.added;
|
|
137850
|
+
deleted += lines.deleted;
|
|
137851
|
+
byPath.set(path68, lines);
|
|
137852
|
+
}
|
|
137853
|
+
}
|
|
137854
|
+
return { total: { added, deleted }, byPath };
|
|
137855
|
+
}
|
|
137856
|
+
function detachedName(ports, cwd) {
|
|
137857
|
+
const tag = ports.run(GIT, ["describe", "--tags", "--exact-match", "HEAD"], cwd)?.trim();
|
|
137858
|
+
if (tag !== void 0 && tag !== "") {
|
|
137859
|
+
return tag;
|
|
137860
|
+
}
|
|
137861
|
+
const commit = ports.run(GIT, ["rev-parse", "--short", "HEAD"], cwd)?.trim();
|
|
137862
|
+
return commit === void 0 || commit === "" ? void 0 : `detached:${commit}`;
|
|
137863
|
+
}
|
|
137864
|
+
function byRecency(ports, cwd, files) {
|
|
137865
|
+
const root = ports.run(GIT, ["rev-parse", "--show-toplevel"], cwd)?.trim();
|
|
137866
|
+
if (root === void 0 || root === "") {
|
|
137867
|
+
return files;
|
|
137868
|
+
}
|
|
137869
|
+
const modified = new Map(files.map((file2) => [file2.path, ports.modifiedAtMs(`${root}/${file2.path}`) ?? 0]));
|
|
137870
|
+
return [...files].sort((left, right) => (modified.get(right.path) ?? 0) - (modified.get(left.path) ?? 0));
|
|
137871
|
+
}
|
|
137872
|
+
function readGitStatus(ports, cwd, query) {
|
|
137873
|
+
if (!query.workingTree) {
|
|
137874
|
+
const abbreviated = ports.run(GIT, ["rev-parse", "--abbrev-ref", "HEAD"], cwd)?.trim();
|
|
137875
|
+
const branch2 = abbreviated === DETACHED_ABBREV ? detachedName(ports, cwd) : abbreviated;
|
|
137876
|
+
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 };
|
|
137877
|
+
}
|
|
137878
|
+
const output2 = ports.run(GIT, ["--no-optional-locks", "status", "--porcelain=v2", "--branch", "-z"], cwd);
|
|
137879
|
+
if (output2 === void 0) {
|
|
137880
|
+
return void 0;
|
|
137881
|
+
}
|
|
137882
|
+
const status = parseStatus(output2);
|
|
137883
|
+
const branch = status.head === DETACHED_HEAD ? detachedName(ports, cwd) : status.head;
|
|
137884
|
+
if (status.noCommitYet || branch === void 0 || branch === "") {
|
|
137885
|
+
return void 0;
|
|
137886
|
+
}
|
|
137887
|
+
const numstat = query.lineDiff && status.dirty ? ports.run(GIT, ["--no-optional-locks", "diff", "--numstat", "-z", "HEAD"], cwd) : void 0;
|
|
137888
|
+
const lines = numstat === void 0 ? void 0 : parseNumstat(numstat);
|
|
137889
|
+
const tracked = query.files && status.tracked.length > 0 ? byRecency(ports, cwd, status.tracked) : status.tracked;
|
|
137890
|
+
return {
|
|
137891
|
+
kind: "git",
|
|
137892
|
+
branch: sanitiseDisplayText(branch),
|
|
137893
|
+
dirty: status.dirty,
|
|
137894
|
+
conflict: false,
|
|
137895
|
+
ahead: status.ahead,
|
|
137896
|
+
behind: status.behind,
|
|
137897
|
+
lineDiff: lines?.total,
|
|
137898
|
+
files: query.files ? {
|
|
137899
|
+
tracked: tracked.map((file2) => ({ basename: sanitiseDisplayText(file2.path.split("/").at(-1) ?? file2.path), kind: file2.kind, lines: lines?.byPath.get(file2.path) })),
|
|
137900
|
+
untracked: status.untracked
|
|
137901
|
+
} : void 0
|
|
137902
|
+
};
|
|
137903
|
+
}
|
|
137904
|
+
|
|
137905
|
+
// src/statusline/vcs/jj.ts
|
|
137906
|
+
var import_node_path57 = __toESM(require("node:path"), 1);
|
|
137907
|
+
var JJ2 = "jj";
|
|
137908
|
+
var MAX_WALK_DEPTH = 64;
|
|
137909
|
+
var MAX_LABEL_CODE_POINTS = 64;
|
|
137910
|
+
var FIELD_SEPARATOR = "";
|
|
137911
|
+
var BOOKMARK_SEPARATOR = "";
|
|
137912
|
+
var FIELD_COUNT = 4;
|
|
137913
|
+
function isJjRepository(ports, cwd) {
|
|
137914
|
+
let directory = ports.realPath(cwd);
|
|
137915
|
+
if (directory === void 0 || ports.entryKind(directory) !== "directory") {
|
|
137916
|
+
return false;
|
|
137917
|
+
}
|
|
137918
|
+
for (let depth = 0; depth < MAX_WALK_DEPTH; depth += 1) {
|
|
137919
|
+
if (ports.entryKind(import_node_path57.default.join(directory, ".jj")) === "directory") {
|
|
137920
|
+
return true;
|
|
137921
|
+
}
|
|
137922
|
+
if (ports.entryKind(import_node_path57.default.join(directory, ".git")) !== void 0) {
|
|
137923
|
+
return false;
|
|
137924
|
+
}
|
|
137925
|
+
const parent = import_node_path57.default.dirname(directory);
|
|
137926
|
+
if (parent === directory) {
|
|
137927
|
+
return false;
|
|
137928
|
+
}
|
|
137929
|
+
directory = parent;
|
|
137930
|
+
}
|
|
137931
|
+
return false;
|
|
137932
|
+
}
|
|
137933
|
+
var TEMPLATE = [
|
|
137934
|
+
"change_id.shortest(8)",
|
|
137935
|
+
'"\\x1f"',
|
|
137936
|
+
'self.local_bookmarks().map(|bookmark| bookmark.name()).join("\\x1e")',
|
|
137937
|
+
'"\\x1f"',
|
|
137938
|
+
'if(self.empty(), "0", "1")',
|
|
137939
|
+
'"\\x1f"',
|
|
137940
|
+
'if(self.conflict(), "1", "0")'
|
|
137941
|
+
].join(" ++ ");
|
|
137942
|
+
var ARGS = ["--ignore-working-copy", "--at-operation=@", "--no-pager", "log", "-r", "@", "--no-graph", "--color", "never", "-T", TEMPLATE];
|
|
137943
|
+
function label(text4) {
|
|
137944
|
+
const clean = sanitiseDisplayText(text4).trim();
|
|
137945
|
+
return clean === "" ? void 0 : Array.from(clean).slice(0, MAX_LABEL_CODE_POINTS).join("");
|
|
137946
|
+
}
|
|
137947
|
+
function parse4(output2) {
|
|
137948
|
+
const line = output2.replace(/\r?\n$/, "");
|
|
137949
|
+
if (line.includes("\n") || line.includes("\r")) {
|
|
137950
|
+
return void 0;
|
|
137951
|
+
}
|
|
137952
|
+
const fields = line.split(FIELD_SEPARATOR);
|
|
137953
|
+
if (fields.length !== FIELD_COUNT) {
|
|
137954
|
+
return void 0;
|
|
137955
|
+
}
|
|
137956
|
+
const [changeId, bookmarksText, dirtyFlag, conflictFlag] = fields;
|
|
137957
|
+
if (changeId === void 0 || bookmarksText === void 0 || dirtyFlag !== "0" && dirtyFlag !== "1" || conflictFlag !== "0" && conflictFlag !== "1") {
|
|
137958
|
+
return void 0;
|
|
137959
|
+
}
|
|
137960
|
+
const bookmarks = bookmarksText === "" ? [] : bookmarksText.split(BOOKMARK_SEPARATOR);
|
|
137961
|
+
if (bookmarks.some((bookmark) => bookmark === "")) {
|
|
137962
|
+
return void 0;
|
|
137963
|
+
}
|
|
137964
|
+
const branch = label(bookmarks[0] ?? changeId);
|
|
137965
|
+
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 };
|
|
137966
|
+
}
|
|
137967
|
+
function readJjStatus(ports, cwd) {
|
|
137968
|
+
const directory = ports.realPath(cwd);
|
|
137969
|
+
if (directory === void 0) {
|
|
137970
|
+
return void 0;
|
|
137971
|
+
}
|
|
137972
|
+
const output2 = ports.run(JJ2, ARGS, directory);
|
|
137973
|
+
return output2 === void 0 ? void 0 : parse4(output2);
|
|
137974
|
+
}
|
|
137975
|
+
|
|
137976
|
+
// src/statusline/vcs/status.ts
|
|
137977
|
+
var READ = /* @__PURE__ */ new WeakMap();
|
|
137978
|
+
function gitQueryOf({ settings: settings2 }) {
|
|
137979
|
+
const files = settings2.layout.rows.includes("gitFiles");
|
|
137980
|
+
const lineDiff = settings2.git.showLineDiff || files;
|
|
137981
|
+
return { workingTree: settings2.git.showDirty || settings2.git.showAheadBehind || files || lineDiff, files, lineDiff };
|
|
137982
|
+
}
|
|
137983
|
+
function vcsStatusOf(context) {
|
|
137984
|
+
if (READ.has(context)) {
|
|
137985
|
+
return READ.get(context);
|
|
137986
|
+
}
|
|
137987
|
+
const { settings: settings2, ports, payload } = context;
|
|
137988
|
+
const cwd = workingDirectoryOf(payload);
|
|
137989
|
+
let status;
|
|
137990
|
+
if (cwd !== void 0) {
|
|
137991
|
+
if (settings2.jj.enabled && isJjRepository(ports, cwd)) {
|
|
137992
|
+
status = readJjStatus(ports, cwd);
|
|
137993
|
+
}
|
|
137994
|
+
if (status === void 0 && settings2.git.enabled) {
|
|
137995
|
+
status = readGitStatus(ports, cwd, gitQueryOf(context));
|
|
137996
|
+
}
|
|
137997
|
+
}
|
|
137998
|
+
READ.set(context, status);
|
|
137999
|
+
return status;
|
|
138000
|
+
}
|
|
138001
|
+
|
|
138002
|
+
// src/statusline/elements/header/vcs.ts
|
|
138003
|
+
function aheadText(ahead, { settings: settings2, palette }) {
|
|
138004
|
+
const text4 = `\u2191${String(ahead)}`;
|
|
138005
|
+
const { pushCriticalAt, pushWarnAt } = settings2.git;
|
|
138006
|
+
if (pushCriticalAt > 0 && ahead >= pushCriticalAt) {
|
|
138007
|
+
return palette.paint("critical", text4);
|
|
138008
|
+
}
|
|
138009
|
+
return pushWarnAt > 0 && ahead >= pushWarnAt ? palette.paint("warning", text4) : palette.paint("gitBranch", text4);
|
|
138010
|
+
}
|
|
138011
|
+
function vcsSegment(context) {
|
|
138012
|
+
const status = vcsStatusOf(context);
|
|
138013
|
+
if (status === void 0) {
|
|
138014
|
+
return void 0;
|
|
138015
|
+
}
|
|
138016
|
+
const { settings: settings2, palette } = context;
|
|
138017
|
+
const isGit = status.kind === "git";
|
|
138018
|
+
const showDirty = isGit ? settings2.git.showDirty : settings2.jj.showDirty;
|
|
138019
|
+
const inner = [palette.paint("gitBranch", status.branch + (showDirty && status.dirty ? "*" : ""))];
|
|
138020
|
+
if (isGit && settings2.git.showAheadBehind) {
|
|
138021
|
+
if (status.ahead > 0) {
|
|
138022
|
+
inner.push(aheadText(status.ahead, context));
|
|
138023
|
+
}
|
|
138024
|
+
if (status.behind > 0) {
|
|
138025
|
+
inner.push(palette.paint("gitBranch", `\u2193${String(status.behind)}`));
|
|
138026
|
+
}
|
|
138027
|
+
}
|
|
138028
|
+
if (isGit && settings2.git.showLineDiff && status.lineDiff !== void 0) {
|
|
138029
|
+
const { added, deleted } = status.lineDiff;
|
|
138030
|
+
const counts = [...added > 0 ? [palette.paint("context", `+${String(added)}`)] : [], ...deleted > 0 ? [palette.paint("critical", `-${String(deleted)}`)] : []];
|
|
138031
|
+
if (counts.length > 0) {
|
|
138032
|
+
inner.push(`[${counts.join(" ")}]`);
|
|
138033
|
+
}
|
|
138034
|
+
}
|
|
138035
|
+
if (!isGit && settings2.jj.showConflicts && status.conflict) {
|
|
138036
|
+
inner.push(palette.paint("critical", "!conflict"));
|
|
138037
|
+
}
|
|
138038
|
+
return `${status.kind}:(${inner.join(" ")}${palette.paint("git", ")")}`;
|
|
138039
|
+
}
|
|
138040
|
+
|
|
138041
|
+
// src/statusline/elements/rows/addedDirs.ts
|
|
138042
|
+
function addedDirsRow({ payload, settings: settings2, palette }) {
|
|
138043
|
+
const { names, more } = addedDirNames(payload.workspace?.added_dirs);
|
|
138044
|
+
if (settings2.project.addedDirsLayout !== "row" || names.length === 0) {
|
|
138045
|
+
return { kind: "text", lines: [] };
|
|
138046
|
+
}
|
|
138047
|
+
const drawn = [...names, ...more > 0 ? [`+${String(more)} more`] : []].map((text4) => palette.paint("label", text4));
|
|
138048
|
+
return { kind: "text", lines: [`${palette.paint("label", "Added dirs:")} ${drawn.join(palette.paint("label", ", "))}`] };
|
|
138049
|
+
}
|
|
138050
|
+
|
|
137453
138051
|
// src/statusline/elements/context.ts
|
|
137454
138052
|
function barStyleOf({ settings: settings2, palette }, okRole) {
|
|
137455
138053
|
return { bands: settings2.bands, palette, okRole, filled: settings2.bar.filled, empty: settings2.bar.empty };
|
|
@@ -137486,15 +138084,48 @@ function contextRow(context) {
|
|
|
137486
138084
|
return { kind: "bars", cells };
|
|
137487
138085
|
}
|
|
137488
138086
|
|
|
138087
|
+
// src/statusline/elements/rows/gitFiles.ts
|
|
138088
|
+
var MAX_FILES_SHOWN = 6;
|
|
138089
|
+
var MIN_COLUMNS = 60;
|
|
138090
|
+
var KIND_MARKS = {
|
|
138091
|
+
added: { mark: "+", role: "context" },
|
|
138092
|
+
deleted: { mark: "-", role: "critical" },
|
|
138093
|
+
modified: { mark: "~", role: "warning" }
|
|
138094
|
+
};
|
|
138095
|
+
function gitFilesRow(context) {
|
|
138096
|
+
const { palette, terminalWidth } = context;
|
|
138097
|
+
const none = { kind: "text", lines: [] };
|
|
138098
|
+
const files = terminalWidth < MIN_COLUMNS ? void 0 : vcsStatusOf(context)?.files;
|
|
138099
|
+
if (files === void 0 || files.tracked.length === 0 && files.untracked === 0) {
|
|
138100
|
+
return none;
|
|
138101
|
+
}
|
|
138102
|
+
const shown = files.tracked.slice(0, MAX_FILES_SHOWN);
|
|
138103
|
+
const entries = shown.map((file2) => {
|
|
138104
|
+
const { mark, role } = KIND_MARKS[file2.kind];
|
|
138105
|
+
const lines = file2.lines;
|
|
138106
|
+
const counts = lines === void 0 ? [] : [...lines.added > 0 ? [palette.paint("context", `+${String(lines.added)}`)] : [], ...lines.deleted > 0 ? [palette.paint("critical", `-${String(lines.deleted)}`)] : []];
|
|
138107
|
+
const diff = counts.length === 0 ? "" : `${palette.paint("label", "(")}${counts.join(" ")}${palette.paint("label", ")")}`;
|
|
138108
|
+
return `${palette.paint(role, mark)}${palette.paint(role, file2.basename)}${diff}`;
|
|
138109
|
+
});
|
|
138110
|
+
const overflow = files.tracked.length - shown.length;
|
|
138111
|
+
if (overflow > 0) {
|
|
138112
|
+
entries.push(palette.paint("label", `+${String(overflow)} more`));
|
|
138113
|
+
}
|
|
138114
|
+
if (files.untracked > 0) {
|
|
138115
|
+
entries.push(palette.paint("label", `?${String(files.untracked)}`));
|
|
138116
|
+
}
|
|
138117
|
+
return { kind: "text", lines: [entries.join(" ")] };
|
|
138118
|
+
}
|
|
138119
|
+
|
|
137489
138120
|
// src/statusline/elements/rows/quota.ts
|
|
137490
138121
|
function quotaRow(context) {
|
|
137491
138122
|
const { summary, nowMs, settings: settings2, palette } = context;
|
|
137492
138123
|
const style = barStyleOf(context, "usage");
|
|
137493
138124
|
const cells = [];
|
|
137494
|
-
const drawWindow = (
|
|
138125
|
+
const drawWindow = (label2, fraction, resetsAt) => {
|
|
137495
138126
|
const clamped = Math.max(0, Math.min(1, fraction));
|
|
137496
138127
|
const color = statusColor(clamped, true, style);
|
|
137497
|
-
cells.push(barCell(palette.paint("label", `${
|
|
138128
|
+
cells.push(barCell(palette.paint("label", `${label2} `), ` ${withColor(color, `${(fraction * FULL_PERCENT3).toFixed(1)}%`)} (${formatDuration(secondsUntil(resetsAt, nowMs))})`, clamped, style));
|
|
137498
138129
|
};
|
|
137499
138130
|
if (summary.quotaFamilies.length > 0) {
|
|
137500
138131
|
for (const window of summary.quotaFamilies) {
|
|
@@ -137523,20 +138154,38 @@ var HEADER_ROLES = {
|
|
|
137523
138154
|
route: "label",
|
|
137524
138155
|
account: "label",
|
|
137525
138156
|
identity: "label",
|
|
137526
|
-
headroom: "label"
|
|
138157
|
+
headroom: "label",
|
|
138158
|
+
project: "project",
|
|
138159
|
+
vcs: "git",
|
|
138160
|
+
effort: "model",
|
|
138161
|
+
advisor: "label",
|
|
138162
|
+
version: "label",
|
|
138163
|
+
outputStyle: "label"
|
|
137527
138164
|
};
|
|
137528
138165
|
var ELEMENTS = {
|
|
137529
|
-
header: { model: modelSegment, provider: providerSegment, route: routeSegment, account: accountSegment, identity: identitySegment, headroom: headroomSegment },
|
|
137530
|
-
rows: { context: contextRow, quota: quotaRow }
|
|
138166
|
+
header: { model: modelSegment, provider: providerSegment, route: routeSegment, account: accountSegment, identity: identitySegment, headroom: headroomSegment, project: projectSegment, vcs: vcsSegment, effort: effortSegment, advisor: advisorSegment, version: versionSegment, outputStyle: outputStyleSegment },
|
|
138167
|
+
rows: { context: contextRow, quota: quotaRow, addedDirs: addedDirsRow, gitFiles: gitFilesRow }
|
|
137531
138168
|
};
|
|
137532
138169
|
|
|
137533
138170
|
// src/statusline/headerLayout.ts
|
|
138171
|
+
function headerUnits(parts, overflow) {
|
|
138172
|
+
const units = [];
|
|
138173
|
+
parts.forEach((part, index) => {
|
|
138174
|
+
const before = parts[index - 1];
|
|
138175
|
+
if (overflow === "truncate" && part.name === "vcs" && before?.name === "project") {
|
|
138176
|
+
units[units.length - 1] = `${units.at(-1) ?? ""} ${part.text}`;
|
|
138177
|
+
} else {
|
|
138178
|
+
units.push(part.text);
|
|
138179
|
+
}
|
|
138180
|
+
});
|
|
138181
|
+
return units;
|
|
138182
|
+
}
|
|
137534
138183
|
function justify(texts, maxWidth, separator) {
|
|
137535
138184
|
if (texts.length < 2) {
|
|
137536
138185
|
return texts.join(separator);
|
|
137537
138186
|
}
|
|
137538
138187
|
const separatorLength = visibleLength(separator);
|
|
137539
|
-
const total = texts.reduce((sum,
|
|
138188
|
+
const total = texts.reduce((sum, text4) => sum + visibleLength(text4), 0) + separatorLength * (texts.length - 1);
|
|
137540
138189
|
const spare = maxWidth - total;
|
|
137541
138190
|
if (spare <= 0) {
|
|
137542
138191
|
return texts.join(separator);
|
|
@@ -137545,7 +138194,7 @@ function justify(texts, maxWidth, separator) {
|
|
|
137545
138194
|
const extraPerGap = Math.floor(spare / gaps);
|
|
137546
138195
|
let remainder = spare % gaps;
|
|
137547
138196
|
const parts = [];
|
|
137548
|
-
texts.forEach((
|
|
138197
|
+
texts.forEach((text4, index) => {
|
|
137549
138198
|
if (index > 0) {
|
|
137550
138199
|
const extra = extraPerGap + (remainder > 0 ? 1 : 0);
|
|
137551
138200
|
if (remainder > 0) {
|
|
@@ -137554,7 +138203,7 @@ function justify(texts, maxWidth, separator) {
|
|
|
137554
138203
|
const left = Math.floor(extra / 2);
|
|
137555
138204
|
parts.push(`${" ".repeat(left + 1)}|${" ".repeat(extra - left + 1)}`);
|
|
137556
138205
|
}
|
|
137557
|
-
parts.push(
|
|
138206
|
+
parts.push(text4);
|
|
137558
138207
|
});
|
|
137559
138208
|
return parts.join("");
|
|
137560
138209
|
}
|
|
@@ -137563,15 +138212,15 @@ function layoutHeader(texts, maxWidth, separator) {
|
|
|
137563
138212
|
const lines = [];
|
|
137564
138213
|
let current = [];
|
|
137565
138214
|
let currentWidth = 0;
|
|
137566
|
-
for (const
|
|
137567
|
-
const width = visibleLength(
|
|
138215
|
+
for (const text4 of texts) {
|
|
138216
|
+
const width = visibleLength(text4);
|
|
137568
138217
|
const added = current.length === 0 ? width : width + separatorLength;
|
|
137569
138218
|
if (current.length > 0 && currentWidth + added > maxWidth) {
|
|
137570
138219
|
lines.push(current);
|
|
137571
|
-
current = [
|
|
138220
|
+
current = [text4];
|
|
137572
138221
|
currentWidth = width;
|
|
137573
138222
|
} else {
|
|
137574
|
-
current.push(
|
|
138223
|
+
current.push(text4);
|
|
137575
138224
|
currentWidth += added;
|
|
137576
138225
|
}
|
|
137577
138226
|
}
|
|
@@ -137581,9 +138230,106 @@ function layoutHeader(texts, maxWidth, separator) {
|
|
|
137581
138230
|
return lines.map((line) => justify(line, maxWidth, separator)).join("\n");
|
|
137582
138231
|
}
|
|
137583
138232
|
|
|
138233
|
+
// src/statusline/identityTranscript.ts
|
|
138234
|
+
init_zod();
|
|
138235
|
+
var TRANSCRIPT_CHUNK_BYTES = 65536;
|
|
138236
|
+
var MAX_TRANSCRIPT_SCAN_BYTES = 4194304;
|
|
138237
|
+
var NOT_FOUND = { model: void 0, advisor: void 0 };
|
|
138238
|
+
var SYNTHETIC_MODEL = "<synthetic>";
|
|
138239
|
+
var NEWLINE = 10;
|
|
138240
|
+
var text3 = external_exports.string().optional().catch(void 0);
|
|
138241
|
+
var RecordSchema = external_exports.looseObject({
|
|
138242
|
+
type: text3,
|
|
138243
|
+
advisorModel: text3,
|
|
138244
|
+
message: external_exports.looseObject({ model: text3 }).optional().catch(void 0)
|
|
138245
|
+
});
|
|
138246
|
+
var ASSISTANT_TYPE = /"type"\s*:\s*"assistant"/;
|
|
138247
|
+
function identityOfLine(line) {
|
|
138248
|
+
if (!ASSISTANT_TYPE.test(line)) {
|
|
138249
|
+
return void 0;
|
|
138250
|
+
}
|
|
138251
|
+
let parsed;
|
|
138252
|
+
try {
|
|
138253
|
+
parsed = JSON.parse(line);
|
|
138254
|
+
} catch {
|
|
138255
|
+
return void 0;
|
|
138256
|
+
}
|
|
138257
|
+
const record2 = RecordSchema.safeParse(parsed);
|
|
138258
|
+
if (!record2.success || record2.data.type !== "assistant") {
|
|
138259
|
+
return void 0;
|
|
138260
|
+
}
|
|
138261
|
+
const model = boundedDisplayText(record2.data.message?.model ?? "");
|
|
138262
|
+
if (model === "" || model === SYNTHETIC_MODEL) {
|
|
138263
|
+
return void 0;
|
|
138264
|
+
}
|
|
138265
|
+
const advisor = boundedDisplayText(record2.data.advisorModel ?? "");
|
|
138266
|
+
return { model, advisor: advisor === "" ? void 0 : advisor };
|
|
138267
|
+
}
|
|
138268
|
+
function joined2(pieces) {
|
|
138269
|
+
const whole = new Uint8Array(pieces.reduce((total, piece) => total + piece.length, 0));
|
|
138270
|
+
let at2 = 0;
|
|
138271
|
+
for (const piece of pieces) {
|
|
138272
|
+
whole.set(piece, at2);
|
|
138273
|
+
at2 += piece.length;
|
|
138274
|
+
}
|
|
138275
|
+
return whole;
|
|
138276
|
+
}
|
|
138277
|
+
var EMPTY_LINE = new Uint8Array();
|
|
138278
|
+
function splitAtNewlines(bytes) {
|
|
138279
|
+
const firstBreak = bytes.indexOf(NEWLINE);
|
|
138280
|
+
if (firstBreak === -1) {
|
|
138281
|
+
return { head: bytes, rest: [] };
|
|
138282
|
+
}
|
|
138283
|
+
const rest = [];
|
|
138284
|
+
let from = firstBreak + 1;
|
|
138285
|
+
for (let at2 = bytes.indexOf(NEWLINE, from); at2 !== -1; at2 = bytes.indexOf(NEWLINE, from)) {
|
|
138286
|
+
rest.push(bytes.subarray(from, at2));
|
|
138287
|
+
from = at2 + 1;
|
|
138288
|
+
}
|
|
138289
|
+
rest.push(bytes.subarray(from));
|
|
138290
|
+
return { head: bytes.subarray(0, firstBreak), rest };
|
|
138291
|
+
}
|
|
138292
|
+
function readTranscriptIdentity(ports, transcriptPath) {
|
|
138293
|
+
const size = ports.readRange(transcriptPath, 0, 0)?.size;
|
|
138294
|
+
if (size === void 0) {
|
|
138295
|
+
return NOT_FOUND;
|
|
138296
|
+
}
|
|
138297
|
+
let carry = [];
|
|
138298
|
+
const decoder = new TextDecoder();
|
|
138299
|
+
const floor = Math.max(0, size - MAX_TRANSCRIPT_SCAN_BYTES);
|
|
138300
|
+
for (let end = size; end > floor; end = Math.max(floor, end - TRANSCRIPT_CHUNK_BYTES)) {
|
|
138301
|
+
const start = Math.max(floor, end - TRANSCRIPT_CHUNK_BYTES);
|
|
138302
|
+
const chunk2 = ports.readRange(transcriptPath, start, end - start);
|
|
138303
|
+
if (chunk2 === void 0) {
|
|
138304
|
+
return NOT_FOUND;
|
|
138305
|
+
}
|
|
138306
|
+
const { head, rest } = splitAtNewlines(chunk2.bytes);
|
|
138307
|
+
if (rest.length === 0) {
|
|
138308
|
+
carry = [head, ...carry];
|
|
138309
|
+
continue;
|
|
138310
|
+
}
|
|
138311
|
+
const [tail = EMPTY_LINE, ...older] = rest.toReversed();
|
|
138312
|
+
for (const line of [joined2([tail, ...carry]), ...older]) {
|
|
138313
|
+
const found = identityOfLine(decoder.decode(line));
|
|
138314
|
+
if (found !== void 0) {
|
|
138315
|
+
return found;
|
|
138316
|
+
}
|
|
138317
|
+
}
|
|
138318
|
+
carry = [head];
|
|
138319
|
+
}
|
|
138320
|
+
return floor === 0 ? identityOfLine(decoder.decode(joined2(carry))) ?? NOT_FOUND : NOT_FOUND;
|
|
138321
|
+
}
|
|
138322
|
+
|
|
137584
138323
|
// src/statusline/render.ts
|
|
137585
138324
|
var RESERVED_COLUMNS = 4;
|
|
137586
138325
|
var SEPARATOR2 = " | ";
|
|
138326
|
+
function once2(read) {
|
|
138327
|
+
let kept;
|
|
138328
|
+
return () => {
|
|
138329
|
+
kept ??= { value: read() };
|
|
138330
|
+
return kept.value;
|
|
138331
|
+
};
|
|
138332
|
+
}
|
|
137587
138333
|
function renderStatuslineBlock(input2) {
|
|
137588
138334
|
const { terminalWidth, settings: settings2 = STATUSLINE_DEFAULTS, elements = ELEMENTS } = input2;
|
|
137589
138335
|
const context = {
|
|
@@ -137591,14 +138337,17 @@ function renderStatuslineBlock(input2) {
|
|
|
137591
138337
|
view: input2.view,
|
|
137592
138338
|
payload: input2.payload,
|
|
137593
138339
|
nowMs: input2.nowMs,
|
|
138340
|
+
terminalWidth,
|
|
137594
138341
|
settings: settings2,
|
|
137595
138342
|
palette: createPalette(settings2.colours, colourEnabled(input2.ports.env)),
|
|
137596
|
-
ports: input2.ports
|
|
138343
|
+
ports: input2.ports,
|
|
138344
|
+
transcriptIdentity: once2(() => input2.payload.transcript_path === void 0 ? { model: void 0, advisor: void 0 } : readTranscriptIdentity(input2.ports, input2.payload.transcript_path))
|
|
137597
138345
|
};
|
|
137598
|
-
const
|
|
137599
|
-
const
|
|
137600
|
-
return
|
|
138346
|
+
const parts = settings2.layout.header.flatMap((name) => {
|
|
138347
|
+
const text4 = elements.header[name](context);
|
|
138348
|
+
return text4 === void 0 ? [] : { name, text: context.palette.paint(HEADER_ROLES[name], text4) };
|
|
137601
138349
|
});
|
|
138350
|
+
const header = headerUnits(parts, settings2.git.branchOverflow);
|
|
137602
138351
|
const width = Math.max(TWENTY, terminalWidth - RESERVED_COLUMNS);
|
|
137603
138352
|
const lines = [];
|
|
137604
138353
|
if (header.length > 0) {
|
|
@@ -137678,7 +138427,7 @@ function registerStatuslineCommand(program2, deps) {
|
|
|
137678
138427
|
} else {
|
|
137679
138428
|
const configDir = process.env.CLAUDE_CONFIG_DIR;
|
|
137680
138429
|
try {
|
|
137681
|
-
account = readAccountMetadataFile(realFarmFs, configDir === void 0 || configDir === "" ?
|
|
138430
|
+
account = readAccountMetadataFile(realFarmFs, configDir === void 0 || configDir === "" ? import_node_path58.default.join(import_node_os13.default.homedir(), ".claude.json") : import_node_path58.default.join(configDir, ".claude.json"));
|
|
137682
138431
|
} catch {
|
|
137683
138432
|
account = void 0;
|
|
137684
138433
|
}
|
|
@@ -139775,8 +140524,8 @@ function getErrorMap2() {
|
|
|
139775
140524
|
|
|
139776
140525
|
// node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/helpers/parseUtil.js
|
|
139777
140526
|
var makeIssue = (params) => {
|
|
139778
|
-
const { data, path:
|
|
139779
|
-
const fullPath = [...
|
|
140527
|
+
const { data, path: path68, errorMaps, issueData } = params;
|
|
140528
|
+
const fullPath = [...path68, ...issueData.path || []];
|
|
139780
140529
|
const fullIssue = {
|
|
139781
140530
|
...issueData,
|
|
139782
140531
|
path: fullPath
|
|
@@ -139891,11 +140640,11 @@ var errorUtil;
|
|
|
139891
140640
|
|
|
139892
140641
|
// node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/types.js
|
|
139893
140642
|
var ParseInputLazyPath = class {
|
|
139894
|
-
constructor(parent, value2,
|
|
140643
|
+
constructor(parent, value2, path68, key) {
|
|
139895
140644
|
this._cachedPath = [];
|
|
139896
140645
|
this.parent = parent;
|
|
139897
140646
|
this.data = value2;
|
|
139898
|
-
this._path =
|
|
140647
|
+
this._path = path68;
|
|
139899
140648
|
this._key = key;
|
|
139900
140649
|
}
|
|
139901
140650
|
get path() {
|
|
@@ -143458,11 +144207,11 @@ function normalizeObjectSchema(schema) {
|
|
|
143458
144207
|
}
|
|
143459
144208
|
return void 0;
|
|
143460
144209
|
}
|
|
143461
|
-
function getDotPath(
|
|
143462
|
-
if (
|
|
144210
|
+
function getDotPath(path68) {
|
|
144211
|
+
if (path68.length === 0) {
|
|
143463
144212
|
return "object root";
|
|
143464
144213
|
}
|
|
143465
|
-
return
|
|
144214
|
+
return path68.reduce((acc, seg, index) => {
|
|
143466
144215
|
if (index === 0) {
|
|
143467
144216
|
return String(seg);
|
|
143468
144217
|
}
|
|
@@ -147505,7 +148254,7 @@ async function serveMcp(mcp, transport, options = {}) {
|
|
|
147505
148254
|
|
|
147506
148255
|
// src/mcp/permissions.ts
|
|
147507
148256
|
var import_node_fs23 = __toESM(require("node:fs"), 1);
|
|
147508
|
-
var
|
|
148257
|
+
var import_node_path59 = __toESM(require("node:path"), 1);
|
|
147509
148258
|
init_zod();
|
|
147510
148259
|
init_store();
|
|
147511
148260
|
var StoredMcpPermissionsSchema = external_exports.strictObject({
|
|
@@ -147527,10 +148276,10 @@ function effectiveMcpPermissions(flags, stored) {
|
|
|
147527
148276
|
return { writes: flags.writes || stored.writes, remoteControl: flags.remoteControl || stored.remoteControl, history: flags.history || stored.history };
|
|
147528
148277
|
}
|
|
147529
148278
|
function watchMcpPermissions(paths, onChange) {
|
|
147530
|
-
const directory =
|
|
148279
|
+
const directory = import_node_path59.default.dirname(paths.mcpPermissionsFile);
|
|
147531
148280
|
import_node_fs23.default.mkdirSync(directory, { recursive: true });
|
|
147532
148281
|
const watcher = import_node_fs23.default.watch(directory, (_event, filename) => {
|
|
147533
|
-
if (filename === null || filename ===
|
|
148282
|
+
if (filename === null || filename === import_node_path59.default.basename(paths.mcpPermissionsFile)) {
|
|
147534
148283
|
onChange();
|
|
147535
148284
|
}
|
|
147536
148285
|
});
|
|
@@ -147695,9 +148444,9 @@ init_cliError();
|
|
|
147695
148444
|
init_argv();
|
|
147696
148445
|
init_legacy();
|
|
147697
148446
|
var COMPLETION_SHELLS = ["bash", "zsh", "fish"];
|
|
147698
|
-
function firstSentence(
|
|
147699
|
-
const end =
|
|
147700
|
-
return end === -1 ?
|
|
148447
|
+
function firstSentence(text4) {
|
|
148448
|
+
const end = text4.search(/\.(\s|$)/);
|
|
148449
|
+
return end === -1 ? text4 : text4.slice(0, end);
|
|
147701
148450
|
}
|
|
147702
148451
|
function collectNodes(program2) {
|
|
147703
148452
|
const help = new Help();
|
|
@@ -147718,11 +148467,11 @@ function collectNodes(program2) {
|
|
|
147718
148467
|
visit2(program2, "root");
|
|
147719
148468
|
return nodes;
|
|
147720
148469
|
}
|
|
147721
|
-
function singleQuote(
|
|
147722
|
-
return `'${
|
|
148470
|
+
function singleQuote(text4) {
|
|
148471
|
+
return `'${text4.replaceAll("'", `'\\''`)}'`;
|
|
147723
148472
|
}
|
|
147724
|
-
function fishQuote(
|
|
147725
|
-
return `'${
|
|
148473
|
+
function fishQuote(text4) {
|
|
148474
|
+
return `'${text4.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
|
|
147726
148475
|
}
|
|
147727
148476
|
function transitionArms(nodes, indent) {
|
|
147728
148477
|
return nodes.flatMap((node2) => [...node2.children].map(([name, child]) => `${indent}${singleQuote(`${node2.id}:${name}`)}) node=${singleQuote(child)} ;;`)).join("\n");
|
|
@@ -147844,16 +148593,16 @@ init_credentialCache();
|
|
|
147844
148593
|
|
|
147845
148594
|
// src/identityToken.ts
|
|
147846
148595
|
var import_node_fs24 = __toESM(require("node:fs"), 1);
|
|
147847
|
-
var
|
|
148596
|
+
var import_node_path60 = __toESM(require("node:path"), 1);
|
|
147848
148597
|
init_cliError();
|
|
147849
148598
|
var TOKEN_FILE_MODE = 384;
|
|
147850
148599
|
var TOKEN_DIR_MODE = 448;
|
|
147851
148600
|
var OAUTH_TOKEN_RE = /^sk-ant-oat\d+-[A-Za-z0-9_-]+$/;
|
|
147852
148601
|
function identityTokenDir(paths) {
|
|
147853
|
-
return
|
|
148602
|
+
return import_node_path60.default.join(paths.root, "credentials");
|
|
147854
148603
|
}
|
|
147855
148604
|
function identityTokenPath(paths, identityName) {
|
|
147856
|
-
return
|
|
148605
|
+
return import_node_path60.default.join(identityTokenDir(paths), `${identityName}.token`);
|
|
147857
148606
|
}
|
|
147858
148607
|
function storeIdentityToken(paths, identityName, raw) {
|
|
147859
148608
|
const token = raw.trim();
|
|
@@ -147864,7 +148613,7 @@ function storeIdentityToken(paths, identityName, raw) {
|
|
|
147864
148613
|
import_node_fs24.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
|
|
147865
148614
|
import_node_fs24.default.chmodSync(dir, TOKEN_DIR_MODE);
|
|
147866
148615
|
const target = identityTokenPath(paths, identityName);
|
|
147867
|
-
const temp =
|
|
148616
|
+
const temp = import_node_path60.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
|
|
147868
148617
|
import_node_fs24.default.writeFileSync(temp, `${token}
|
|
147869
148618
|
`, { mode: TOKEN_FILE_MODE });
|
|
147870
148619
|
import_node_fs24.default.renameSync(temp, target);
|
|
@@ -148035,7 +148784,7 @@ function registerDoctorCommand(program2, deps) {
|
|
|
148035
148784
|
// src/headroom/commands.ts
|
|
148036
148785
|
var import_node_fs25 = __toESM(require("node:fs"), 1);
|
|
148037
148786
|
var import_node_http5 = __toESM(require("node:http"), 1);
|
|
148038
|
-
var
|
|
148787
|
+
var import_node_path61 = __toESM(require("node:path"), 1);
|
|
148039
148788
|
var import_node_child_process10 = require("node:child_process");
|
|
148040
148789
|
init_commandDeps();
|
|
148041
148790
|
init_configProfilesStore();
|
|
@@ -148225,12 +148974,12 @@ function readInstalledHeadroomCommit() {
|
|
|
148225
148974
|
if (toolDir.status !== 0) {
|
|
148226
148975
|
return void 0;
|
|
148227
148976
|
}
|
|
148228
|
-
const libDir =
|
|
148977
|
+
const libDir = import_node_path61.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
|
|
148229
148978
|
for (const python of realFarmFs.readdir(libDir)) {
|
|
148230
|
-
const sitePackages =
|
|
148979
|
+
const sitePackages = import_node_path61.default.join(libDir, python, "site-packages");
|
|
148231
148980
|
for (const entry of realFarmFs.readdir(sitePackages)) {
|
|
148232
148981
|
if (entry.startsWith("headroom_ai-") && entry.endsWith(".dist-info")) {
|
|
148233
|
-
const directUrl = realFarmFs.readFileUtf8(
|
|
148982
|
+
const directUrl = realFarmFs.readFileUtf8(import_node_path61.default.join(sitePackages, entry, "direct_url.json"));
|
|
148234
148983
|
return directUrl === void 0 ? void 0 : parseInstalledCommit(directUrl);
|
|
148235
148984
|
}
|
|
148236
148985
|
}
|
|
@@ -148461,9 +149210,9 @@ init_providersStore();
|
|
|
148461
149210
|
init_realPorts();
|
|
148462
149211
|
var realCatalogueFetch = async (url2, headers, timeoutMs) => {
|
|
148463
149212
|
const response = await fetch(url2, { headers: { ...headers }, signal: AbortSignal.timeout(timeoutMs) });
|
|
148464
|
-
const
|
|
149213
|
+
const text4 = await response.text();
|
|
148465
149214
|
try {
|
|
148466
|
-
const body = JSON.parse(
|
|
149215
|
+
const body = JSON.parse(text4);
|
|
148467
149216
|
return { status: response.status, body };
|
|
148468
149217
|
} catch {
|
|
148469
149218
|
return { status: response.status, body: void 0 };
|
|
@@ -148486,7 +149235,7 @@ async function refreshCatalogueForReal(paths, name, env) {
|
|
|
148486
149235
|
init_realPorts();
|
|
148487
149236
|
|
|
148488
149237
|
// src/usage/realJobRunner.ts
|
|
148489
|
-
var
|
|
149238
|
+
var import_node_path62 = __toESM(require("node:path"), 1);
|
|
148490
149239
|
init_conditions();
|
|
148491
149240
|
init_identityClaude();
|
|
148492
149241
|
var JOB_LAUNCH_FLAGS = ["--no-headroom", "--no-remote-control", "--track-usage"];
|
|
@@ -148499,7 +149248,7 @@ ${outcome.trimEnd()}
|
|
|
148499
149248
|
}
|
|
148500
149249
|
function createRealJobRunner(params) {
|
|
148501
149250
|
return async (name, identity, job) => {
|
|
148502
|
-
const logFile =
|
|
149251
|
+
const logFile = import_node_path62.default.join(params.paths.jobLogsDir, `${name}.log`);
|
|
148503
149252
|
const append = (outcome) => {
|
|
148504
149253
|
params.fs.mkdirPrivate(params.paths.jobLogsDir);
|
|
148505
149254
|
params.fs.appendFilePrivate(logFile, logEntry(name, identity, params.now(), outcome));
|
|
@@ -148556,7 +149305,7 @@ function registerHeadlessCommands(program2, deps) {
|
|
|
148556
149305
|
}
|
|
148557
149306
|
|
|
148558
149307
|
// src/jobs.ts
|
|
148559
|
-
var
|
|
149308
|
+
var import_node_path63 = __toESM(require("node:path"), 1);
|
|
148560
149309
|
init_commandDeps();
|
|
148561
149310
|
init_cliError();
|
|
148562
149311
|
init_schema();
|
|
@@ -148581,7 +149330,7 @@ function jobOf(options) {
|
|
|
148581
149330
|
target: options.identity === void 0 ? { pool: options.pool ?? "" } : { identity: options.identity },
|
|
148582
149331
|
trigger: options.at === void 0 ? { beforeReset: options.beforeReset ?? "fiveHour", lead: options.lead ?? "" } : { at: options.at },
|
|
148583
149332
|
prompt: options.prompt,
|
|
148584
|
-
cwd:
|
|
149333
|
+
cwd: import_node_path63.default.resolve(options.cwd ?? process.cwd()),
|
|
148585
149334
|
timeout: options.timeout,
|
|
148586
149335
|
...options.model === void 0 ? {} : { model: options.model },
|
|
148587
149336
|
...options.allowedTool === void 0 ? {} : { allowedTools: options.allowedTool }
|
|
@@ -148654,7 +149403,7 @@ function registerJobCommand(program2, deps) {
|
|
|
148654
149403
|
console.log(`Allowed tools: ${entry.allowedTools.join(", ")}`);
|
|
148655
149404
|
}
|
|
148656
149405
|
console.log(`Prompt: ${entry.prompt}`);
|
|
148657
|
-
console.log(`Results: ${
|
|
149406
|
+
console.log(`Results: ${import_node_path63.default.join(paths.jobLogsDir, `${name}.log`)}`);
|
|
148658
149407
|
}),
|
|
148659
149408
|
["agent-shim job show digest"]
|
|
148660
149409
|
);
|
|
@@ -148677,7 +149426,7 @@ function registerJobCommand(program2, deps) {
|
|
|
148677
149426
|
throw new UsageError(`No member of the job's pool can be picked right now.`);
|
|
148678
149427
|
}
|
|
148679
149428
|
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 ${
|
|
149429
|
+
console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path63.default.join(paths.jobLogsDir, `${name}.log`)}.`);
|
|
148681
149430
|
}),
|
|
148682
149431
|
["agent-shim job run digest"]
|
|
148683
149432
|
);
|
|
@@ -148841,7 +149590,7 @@ init_providerAliases();
|
|
|
148841
149590
|
|
|
148842
149591
|
// src/providerRename.ts
|
|
148843
149592
|
var import_node_fs26 = __toESM(require("node:fs"), 1);
|
|
148844
|
-
var
|
|
149593
|
+
var import_node_path64 = __toESM(require("node:path"), 1);
|
|
148845
149594
|
init_schema();
|
|
148846
149595
|
init_store();
|
|
148847
149596
|
init_load();
|
|
@@ -148958,7 +149707,7 @@ function rewriteReferences(paths, from, to2) {
|
|
|
148958
149707
|
const launch = renamedLaunch(profile.launch, from, to2);
|
|
148959
149708
|
const models = profile.models === void 0 ? void 0 : renamedModels(profile.models, from, to2);
|
|
148960
149709
|
if (launch !== void 0 || models !== void 0) {
|
|
148961
|
-
applyPatch(
|
|
149710
|
+
applyPatch(import_node_path64.default.join(paths.configProfilesDir, `${name}.json`), ConfigProfileSchema, { ...launch === void 0 ? {} : { launch }, ...models === void 0 ? {} : { models } });
|
|
148962
149711
|
rewritten.push(`profile ${name}`);
|
|
148963
149712
|
}
|
|
148964
149713
|
}
|
|
@@ -149727,9 +150476,9 @@ function formatSessionList(sessions) {
|
|
|
149727
150476
|
}
|
|
149728
150477
|
function formatNode(node2, depth) {
|
|
149729
150478
|
const indent = " ".repeat(depth);
|
|
149730
|
-
const
|
|
150479
|
+
const label2 = node2.description ?? node2.name ?? "";
|
|
149731
150480
|
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}${
|
|
150481
|
+
const line = `${indent}- [${node2.kind}] ${node2.agentType} ${node2.id}${label2 === "" ? "" : ` ${label2}`}${extras.length === 0 ? "" : ` (${extras.join(", ")})`}`;
|
|
149733
150482
|
return [line, ...node2.children.flatMap((child) => formatNode(child, depth + 1))];
|
|
149734
150483
|
}
|
|
149735
150484
|
function formatSessionTree(identities, tree) {
|
|
@@ -149785,7 +150534,7 @@ function registerSessionCommands(program2, deps) {
|
|
|
149785
150534
|
}
|
|
149786
150535
|
|
|
149787
150536
|
// src/usage/commands.ts
|
|
149788
|
-
var
|
|
150537
|
+
var import_node_path65 = __toESM(require("node:path"), 1);
|
|
149789
150538
|
init_commandDeps();
|
|
149790
150539
|
init_realPorts();
|
|
149791
150540
|
init_account();
|
|
@@ -149820,13 +150569,13 @@ function collectUsageReport(fs30, paths, filters) {
|
|
|
149820
150569
|
}
|
|
149821
150570
|
var PERCENT5 = 100;
|
|
149822
150571
|
var DECIMAL_RADIX = 10;
|
|
149823
|
-
function formatWindow(
|
|
150572
|
+
function formatWindow(label2, window) {
|
|
149824
150573
|
if (window === void 0) {
|
|
149825
150574
|
return void 0;
|
|
149826
150575
|
}
|
|
149827
150576
|
const used = window.utilization === void 0 ? "usage unknown" : `${String(Math.round(window.utilization * PERCENT5))}% used`;
|
|
149828
150577
|
const grace = window.graceUtilization === void 0 ? "" : `, in grace, ${String(Math.round(window.graceUtilization * PERCENT5))}% of the allowance used`;
|
|
149829
|
-
return `${
|
|
150578
|
+
return `${label2} ${used}${grace}${window.resetsAt === void 0 ? "" : `, resets ${window.resetsAt}`}${window.status === void 0 ? "" : ` (${window.status})`}`;
|
|
149830
150579
|
}
|
|
149831
150580
|
function formatMoney(minor, currency) {
|
|
149832
150581
|
const format = new Intl.NumberFormat("en-GB", { style: "currency", currency });
|
|
@@ -149924,7 +150673,7 @@ function collectAccounts(fs30, paths, identity, probe) {
|
|
|
149924
150673
|
return names.map((name) => ({
|
|
149925
150674
|
identity: name,
|
|
149926
150675
|
account: readAccountMetadata(fs30, paths.identitiesDir, name),
|
|
149927
|
-
signIn: identitySignIn(fs30, probe, { farmRoot:
|
|
150676
|
+
signIn: identitySignIn(fs30, probe, { farmRoot: import_node_path65.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
|
|
149928
150677
|
usage: readUsageSnapshot(fs30, paths.usageSnapshotsDir, name)
|
|
149929
150678
|
}));
|
|
149930
150679
|
}
|
|
@@ -150261,8 +151010,8 @@ function createRealCompactor(params) {
|
|
|
150261
151010
|
sizes = boundarySizes(message);
|
|
150262
151011
|
}
|
|
150263
151012
|
if (message.type === "result") {
|
|
150264
|
-
const
|
|
150265
|
-
return sizes === void 0 ? { kind: "unchanged", reason:
|
|
151013
|
+
const text4 = successfulResult(message);
|
|
151014
|
+
return sizes === void 0 ? { kind: "unchanged", reason: text4 === "" ? "nothing was compacted" : text4 } : { kind: "compacted", ...sizes };
|
|
150266
151015
|
}
|
|
150267
151016
|
}
|
|
150268
151017
|
throw new Error("the compaction ended without a result");
|
|
@@ -150331,7 +151080,7 @@ function quotaHitOf(fs30, paths, identity, sessionId, sinceMs, nowMs) {
|
|
|
150331
151080
|
}
|
|
150332
151081
|
|
|
150333
151082
|
// src/supervise/move.ts
|
|
150334
|
-
var
|
|
151083
|
+
var import_node_path66 = __toESM(require("node:path"), 1);
|
|
150335
151084
|
init_lock();
|
|
150336
151085
|
init_poolPick();
|
|
150337
151086
|
init_read();
|
|
@@ -150377,7 +151126,7 @@ function createMover(deps) {
|
|
|
150377
151126
|
if (resolution.identity === request7.from) {
|
|
150378
151127
|
return { kind: "stay", reason: `no other member of pool "${pool}" can take it` };
|
|
150379
151128
|
}
|
|
150380
|
-
const transcript =
|
|
151129
|
+
const transcript = import_node_path66.default.join(paths.identitiesDir, resolution.identity, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
|
|
150381
151130
|
if (farmFs.lstat(transcript)?.kind !== "file") {
|
|
150382
151131
|
return { kind: "stay", reason: `${resolution.identity} does not share this conversation's history, so it could not resume it` };
|
|
150383
151132
|
}
|
|
@@ -150411,13 +151160,13 @@ function createIdentityMover(deps) {
|
|
|
150411
151160
|
throw error63;
|
|
150412
151161
|
}
|
|
150413
151162
|
try {
|
|
150414
|
-
if (farmFs.readFileUtf8(
|
|
151163
|
+
if (farmFs.readFileUtf8(import_node_path66.default.join(paths.identitiesDir, request7.to, "identity.json")) === void 0) {
|
|
150415
151164
|
return { kind: "stay", reason: `no identity "${request7.to}"` };
|
|
150416
151165
|
}
|
|
150417
151166
|
if (request7.to === request7.from) {
|
|
150418
151167
|
return { kind: "stay", reason: `the model already runs under this session's identity` };
|
|
150419
151168
|
}
|
|
150420
|
-
const transcript =
|
|
151169
|
+
const transcript = import_node_path66.default.join(paths.identitiesDir, request7.to, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
|
|
150421
151170
|
if (farmFs.lstat(transcript)?.kind !== "file") {
|
|
150422
151171
|
return { kind: "stay", reason: `${request7.to} does not share this conversation's history, so it could not resume it` };
|
|
150423
151172
|
}
|
|
@@ -150995,7 +151744,7 @@ async function runClaude(argvOverride) {
|
|
|
150995
151744
|
// src/cli.ts
|
|
150996
151745
|
async function main() {
|
|
150997
151746
|
aliasLegacyEnv(process.env);
|
|
150998
|
-
const invokedName =
|
|
151747
|
+
const invokedName = import_node_path67.default.basename(process.argv[1] ?? "agent-shim");
|
|
150999
151748
|
if (isInvokedAsClaude(invokedName)) {
|
|
151000
151749
|
await runClaude();
|
|
151001
151750
|
return;
|