claude-use 11.53.0 → 11.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +918 -600
- package/dist/index.cjs +52 -10
- package/dist/index.mjs +53 -11
- package/dist/types/index.d.ts +840 -0
- 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")
|
|
@@ -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 = {
|
|
@@ -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
|
}
|
|
@@ -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)) {
|
|
@@ -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,12 +25063,12 @@ function resolveStatusline(settings2) {
|
|
|
25063
25063
|
}
|
|
25064
25064
|
return resolved;
|
|
25065
25065
|
}
|
|
25066
|
-
var STATUSLINE_HEADER_SEGMENTS, STATUSLINE_ROWS, STATUSLINE_COLOUR_NAMES, DEFAULT_HEADER_SEGMENTS, DEFAULT_ROWS, STATUSLINE_PATH_LEVELS, MAX_PERCENT, MAX_STATUSLINE_PALETTE_INDEX, MAX_STATUSLINE_LABEL_CHARS, MAX_BAR_CELLS, LABEL_RE2, colourValue, GRAPHEMES, barCharacter, labelText, wholePercent, SHAPES, StatuslineSchema, ResolvedStatuslineSchema, STATUSLINE_DEFAULTS, STATUSLINE_ENV;
|
|
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", "project", "vcs"];
|
|
25071
|
+
STATUSLINE_HEADER_SEGMENTS = ["model", "provider", "route", "account", "identity", "headroom", "project", "vcs", "effort", "advisor", "version", "outputStyle"];
|
|
25072
25072
|
STATUSLINE_ROWS = ["context", "quota", "addedDirs", "gitFiles"];
|
|
25073
25073
|
STATUSLINE_COLOUR_NAMES = [
|
|
25074
25074
|
"default",
|
|
@@ -25097,17 +25097,39 @@ var init_statusline = __esm({
|
|
|
25097
25097
|
MAX_STATUSLINE_PALETTE_INDEX = 255;
|
|
25098
25098
|
MAX_STATUSLINE_LABEL_CHARS = 12;
|
|
25099
25099
|
MAX_BAR_CELLS = 40;
|
|
25100
|
+
MAX_ACCOUNT_USER_CHARS = 254;
|
|
25101
|
+
MAX_DISPLAY_TEXT_CHARS = 80;
|
|
25100
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;
|
|
25101
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")]);
|
|
25102
25105
|
GRAPHEMES = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
25103
25106
|
barCharacter = external_exports.string().refine(isSingleVisibleGrapheme, "must be a single visible character");
|
|
25104
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");
|
|
25105
25109
|
wholePercent = external_exports.number().int().min(1).max(MAX_PERCENT);
|
|
25106
25110
|
SHAPES = {
|
|
25107
25111
|
layout: {
|
|
25108
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."),
|
|
25109
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.")
|
|
25110
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
|
+
},
|
|
25111
25133
|
bands: {
|
|
25112
25134
|
warnAt: wholePercent.describe("The whole percentage of use at which a bar turns yellow; it must be below criticalAt."),
|
|
25113
25135
|
criticalAt: wholePercent.describe("The whole percentage of use at which a bar turns red.")
|
|
@@ -25155,6 +25177,11 @@ var init_statusline = __esm({
|
|
|
25155
25177
|
};
|
|
25156
25178
|
StatuslineSchema = external_exports.strictObject({
|
|
25157
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(),
|
|
25158
25185
|
bands: external_exports.strictObject(SHAPES.bands).partial().optional(),
|
|
25159
25186
|
labels: external_exports.strictObject(SHAPES.labels).partial().optional(),
|
|
25160
25187
|
bar: external_exports.strictObject(SHAPES.bar).partial().optional(),
|
|
@@ -25165,6 +25192,11 @@ var init_statusline = __esm({
|
|
|
25165
25192
|
});
|
|
25166
25193
|
ResolvedStatuslineSchema = external_exports.strictObject({
|
|
25167
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),
|
|
25168
25200
|
bands: external_exports.strictObject(SHAPES.bands),
|
|
25169
25201
|
labels: external_exports.strictObject(SHAPES.labels),
|
|
25170
25202
|
bar: external_exports.strictObject(SHAPES.bar),
|
|
@@ -25175,6 +25207,11 @@ var init_statusline = __esm({
|
|
|
25175
25207
|
});
|
|
25176
25208
|
STATUSLINE_DEFAULTS = {
|
|
25177
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: "" },
|
|
25178
25215
|
bands: { warnAt: 70, criticalAt: 90 },
|
|
25179
25216
|
labels: { fiveHour: "5h", sevenDay: "Wk" },
|
|
25180
25217
|
bar: { width: 10, filled: "\u2588", empty: "\u2591" },
|
|
@@ -28281,8 +28318,8 @@ function redactHeaders(headers) {
|
|
|
28281
28318
|
}
|
|
28282
28319
|
return result;
|
|
28283
28320
|
}
|
|
28284
|
-
function redactText(
|
|
28285
|
-
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);
|
|
28286
28323
|
}
|
|
28287
28324
|
function redactJsonValue(value2) {
|
|
28288
28325
|
if (typeof value2 === "string") {
|
|
@@ -28297,12 +28334,12 @@ function redactJsonValue(value2) {
|
|
|
28297
28334
|
return value2;
|
|
28298
28335
|
}
|
|
28299
28336
|
function redactBody(chunk2) {
|
|
28300
|
-
const
|
|
28337
|
+
const text4 = chunk2.toString("utf8");
|
|
28301
28338
|
try {
|
|
28302
|
-
const parsed = JSON.parse(
|
|
28339
|
+
const parsed = JSON.parse(text4);
|
|
28303
28340
|
return JSON.stringify(redactJsonValue(parsed));
|
|
28304
28341
|
} catch {
|
|
28305
|
-
return redactText(
|
|
28342
|
+
return redactText(text4);
|
|
28306
28343
|
}
|
|
28307
28344
|
}
|
|
28308
28345
|
function captureFromEnv(env, logsDir) {
|
|
@@ -28337,8 +28374,8 @@ function createFileCapture(file2, now = () => /* @__PURE__ */ new Date()) {
|
|
|
28337
28374
|
}
|
|
28338
28375
|
const excerpt2 = chunk2.subarray(0, Math.min(CHUNK_LOG_CAP_BYTES, budget));
|
|
28339
28376
|
stored[direction] += excerpt2.length;
|
|
28340
|
-
const
|
|
28341
|
-
const faithful = Buffer.from(
|
|
28377
|
+
const text4 = excerpt2.toString("utf8");
|
|
28378
|
+
const faithful = Buffer.from(text4, "utf8").equals(excerpt2);
|
|
28342
28379
|
append({
|
|
28343
28380
|
kind: "stream-chunk",
|
|
28344
28381
|
id: id2,
|
|
@@ -28347,7 +28384,7 @@ function createFileCapture(file2, now = () => /* @__PURE__ */ new Date()) {
|
|
|
28347
28384
|
bytes: chunk2.length,
|
|
28348
28385
|
stored: excerpt2.length,
|
|
28349
28386
|
truncated: excerpt2.length < chunk2.length,
|
|
28350
|
-
...faithful ? { body: redactText(
|
|
28387
|
+
...faithful ? { body: redactText(text4) } : { b64: excerpt2.toString("base64") }
|
|
28351
28388
|
});
|
|
28352
28389
|
},
|
|
28353
28390
|
onEnd: () => {
|
|
@@ -29031,8 +29068,8 @@ var init_report = __esm({
|
|
|
29031
29068
|
});
|
|
29032
29069
|
|
|
29033
29070
|
// src/logStyle.ts
|
|
29034
|
-
function styledDiagnostic(style, colour,
|
|
29035
|
-
return
|
|
29071
|
+
function styledDiagnostic(style, colour, text4) {
|
|
29072
|
+
return text4.split("\n").map((line, index) => {
|
|
29036
29073
|
const lead = index === 0 ? DIAGNOSTIC_LEAD.exec(line) : null;
|
|
29037
29074
|
if (lead === null) {
|
|
29038
29075
|
return style([colour], line);
|
|
@@ -29060,7 +29097,7 @@ function createLogPort(sinks, styleFor) {
|
|
|
29060
29097
|
};
|
|
29061
29098
|
}
|
|
29062
29099
|
function styleTextFor(stream) {
|
|
29063
|
-
return (formats,
|
|
29100
|
+
return (formats, text4) => (0, import_node_util3.styleText)([...formats], text4, { stream });
|
|
29064
29101
|
}
|
|
29065
29102
|
var import_node_util3, DIAGNOSTIC_LEAD;
|
|
29066
29103
|
var init_logStyle = __esm({
|
|
@@ -29092,6 +29129,7 @@ function realIsProcessAlive(pid) {
|
|
|
29092
29129
|
}
|
|
29093
29130
|
}
|
|
29094
29131
|
function realIsProcessZombie(pid) {
|
|
29132
|
+
refuseToBlockInRole("a synchronous process-table read");
|
|
29095
29133
|
const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "stat=", "-p", String(pid)], { encoding: "utf8" });
|
|
29096
29134
|
return result.status === 0 && result.stdout.trim().startsWith("Z");
|
|
29097
29135
|
}
|
|
@@ -29099,6 +29137,7 @@ function realIsProcessRunning(pid) {
|
|
|
29099
29137
|
return realIsProcessAlive(pid) && !realIsProcessZombie(pid);
|
|
29100
29138
|
}
|
|
29101
29139
|
function realIsFrontDoorSupervisor(pid) {
|
|
29140
|
+
refuseToBlockInRole("a synchronous process-table read");
|
|
29102
29141
|
const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "pid=,command=", "-p", String(pid)], { encoding: "utf8" });
|
|
29103
29142
|
return result.status === 0 && parseFrontDoorSupervisorPids(result.stdout).includes(pid);
|
|
29104
29143
|
}
|
|
@@ -29147,15 +29186,39 @@ function realReadFileTail(filePath, fromByte, maxBytes) {
|
|
|
29147
29186
|
}
|
|
29148
29187
|
}
|
|
29149
29188
|
function realProcessCommandLine(pid) {
|
|
29189
|
+
refuseToBlockInRole("a synchronous process-table read");
|
|
29150
29190
|
const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "command=", "-p", String(pid)], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
|
|
29151
29191
|
return result.status === 0 ? result.stdout.trim() : void 0;
|
|
29152
29192
|
}
|
|
29153
29193
|
function realFrontDoorLiveness(pids) {
|
|
29194
|
+
refuseToBlockInRole("a synchronous process-table read");
|
|
29154
29195
|
return frontDoorLivenessOf(pids, (asked) => {
|
|
29155
29196
|
const result = (0, import_node_child_process2.spawnSync)("ps", ["-o", "pid=,stat=,command=", "-p", asked.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS });
|
|
29156
29197
|
return { status: result.status, stdout: result.stdout, stderr: result.stderr, ...result.error === void 0 ? {} : { error: result.error } };
|
|
29157
29198
|
});
|
|
29158
29199
|
}
|
|
29200
|
+
async function readProcessStates(pids) {
|
|
29201
|
+
return await new Promise((resolve2) => {
|
|
29202
|
+
(0, import_node_child_process2.execFile)("ps", ["-o", "pid=,stat=", "-p", pids.map(String).join(",")], { encoding: "utf8", timeout: PS_TIMEOUT_MS }, (_error, stdout2) => {
|
|
29203
|
+
const states = /* @__PURE__ */ new Map();
|
|
29204
|
+
for (const line of stdout2.split("\n")) {
|
|
29205
|
+
const [pidText, stat] = line.trim().split(/\s+/);
|
|
29206
|
+
if (stat !== void 0) {
|
|
29207
|
+
states.set(Number(pidText), stat);
|
|
29208
|
+
}
|
|
29209
|
+
}
|
|
29210
|
+
resolve2(states);
|
|
29211
|
+
});
|
|
29212
|
+
});
|
|
29213
|
+
}
|
|
29214
|
+
async function realRunningAmong(pids) {
|
|
29215
|
+
const existing = pids.filter(realIsProcessAlive);
|
|
29216
|
+
if (existing.length === 0) {
|
|
29217
|
+
return /* @__PURE__ */ new Set();
|
|
29218
|
+
}
|
|
29219
|
+
const states = await readProcessStates(existing);
|
|
29220
|
+
return new Set(existing.filter((pid) => states.get(pid)?.startsWith("Z") !== true));
|
|
29221
|
+
}
|
|
29159
29222
|
function expandHome(filePath) {
|
|
29160
29223
|
return filePath.startsWith("~/") ? import_node_path9.default.join(import_node_os2.default.homedir(), filePath.slice(1)) : filePath;
|
|
29161
29224
|
}
|
|
@@ -30204,8 +30267,8 @@ var require_utils = __commonJS({
|
|
|
30204
30267
|
}
|
|
30205
30268
|
return output2;
|
|
30206
30269
|
};
|
|
30207
|
-
exports2.basename = (
|
|
30208
|
-
const segs =
|
|
30270
|
+
exports2.basename = (path68, { windows } = {}) => {
|
|
30271
|
+
const segs = path68.split(windows ? /[\\/]/ : "/");
|
|
30209
30272
|
const last = segs[segs.length - 1];
|
|
30210
30273
|
if (last === "") {
|
|
30211
30274
|
return segs[segs.length - 2];
|
|
@@ -31970,9 +32033,9 @@ var init_identity = __esm({
|
|
|
31970
32033
|
});
|
|
31971
32034
|
|
|
31972
32035
|
// src/statusline/keys.ts
|
|
31973
|
-
function valueAt(source,
|
|
32036
|
+
function valueAt(source, path68) {
|
|
31974
32037
|
let current = source;
|
|
31975
|
-
for (const part of
|
|
32038
|
+
for (const part of path68) {
|
|
31976
32039
|
if (!isPlainObject2(current)) {
|
|
31977
32040
|
return void 0;
|
|
31978
32041
|
}
|
|
@@ -31980,8 +32043,8 @@ function valueAt(source, path67) {
|
|
|
31980
32043
|
}
|
|
31981
32044
|
return current;
|
|
31982
32045
|
}
|
|
31983
|
-
function keyOf(
|
|
31984
|
-
const common = { path:
|
|
32046
|
+
function keyOf(path68, leaf) {
|
|
32047
|
+
const common = { path: path68.join("."), description: leaf.description ?? "", defaultValue: valueAt(STATUSLINE_DEFAULTS, path68) };
|
|
31985
32048
|
if (leaf instanceof external_exports.ZodNumber) {
|
|
31986
32049
|
return { ...common, kind: "integer", choices: [] };
|
|
31987
32050
|
}
|
|
@@ -32000,7 +32063,7 @@ function keyOf(path67, leaf) {
|
|
|
32000
32063
|
if (leaf instanceof external_exports.ZodArray && leaf.element instanceof external_exports.ZodEnum) {
|
|
32001
32064
|
return { ...common, kind: "list", choices: Object.values(leaf.element.enum).map(String) };
|
|
32002
32065
|
}
|
|
32003
|
-
throw new TypeError(`statusline setting ${
|
|
32066
|
+
throw new TypeError(`statusline setting ${path68.join(".")} has a kind the key listing does not describe`);
|
|
32004
32067
|
}
|
|
32005
32068
|
function walk(shape, prefix) {
|
|
32006
32069
|
return Object.entries(shape).flatMap(([name, schema]) => schema instanceof external_exports.ZodObject ? walk(schema.shape, [...prefix, name]) : [keyOf([...prefix, name], schema)]);
|
|
@@ -32024,47 +32087,47 @@ var init_keys = __esm({
|
|
|
32024
32087
|
});
|
|
32025
32088
|
|
|
32026
32089
|
// src/statusline/change.ts
|
|
32027
|
-
function keyNamed(
|
|
32028
|
-
const found = statuslineKeys().find((key) => key.path ===
|
|
32090
|
+
function keyNamed(path68) {
|
|
32091
|
+
const found = statuslineKeys().find((key) => key.path === path68);
|
|
32029
32092
|
if (found === void 0) {
|
|
32030
|
-
throw new UsageError(`"${
|
|
32093
|
+
throw new UsageError(`"${path68}" is not a statusline setting; \`agent-shim statusline keys\` lists them.`);
|
|
32031
32094
|
}
|
|
32032
32095
|
return found;
|
|
32033
32096
|
}
|
|
32034
|
-
function parseStatuslineAssignment(
|
|
32035
|
-
const split =
|
|
32097
|
+
function parseStatuslineAssignment(text4) {
|
|
32098
|
+
const split = text4.indexOf("=");
|
|
32036
32099
|
if (split < 1) {
|
|
32037
|
-
throw new UsageError(`"${
|
|
32100
|
+
throw new UsageError(`"${text4}" is not <setting>=<value>.`);
|
|
32038
32101
|
}
|
|
32039
|
-
const
|
|
32040
|
-
const raw =
|
|
32041
|
-
const key = keyNamed(
|
|
32102
|
+
const path68 = text4.slice(0, split);
|
|
32103
|
+
const raw = text4.slice(split + 1);
|
|
32104
|
+
const key = keyNamed(path68);
|
|
32042
32105
|
switch (key.kind) {
|
|
32043
32106
|
case "integer": {
|
|
32044
32107
|
const number5 = Number(raw);
|
|
32045
32108
|
if (raw.trim() === "" || !Number.isFinite(number5)) {
|
|
32046
|
-
throw new UsageError(`${
|
|
32109
|
+
throw new UsageError(`${path68}: "${raw}" is not a number.`);
|
|
32047
32110
|
}
|
|
32048
|
-
return { path:
|
|
32111
|
+
return { path: path68, value: number5 };
|
|
32049
32112
|
}
|
|
32050
32113
|
case "boolean":
|
|
32051
32114
|
if (raw !== "true" && raw !== "false") {
|
|
32052
|
-
throw new UsageError(`${
|
|
32115
|
+
throw new UsageError(`${path68}: "${raw}" is not true or false.`);
|
|
32053
32116
|
}
|
|
32054
|
-
return { path:
|
|
32117
|
+
return { path: path68, value: raw === "true" };
|
|
32055
32118
|
case "text":
|
|
32056
32119
|
case "choice":
|
|
32057
|
-
return { path:
|
|
32120
|
+
return { path: path68, value: raw };
|
|
32058
32121
|
case "colour":
|
|
32059
|
-
return { path:
|
|
32122
|
+
return { path: path68, value: /^\d+$/.test(raw) ? Number(raw) : raw };
|
|
32060
32123
|
case "list":
|
|
32061
|
-
return { path:
|
|
32124
|
+
return { path: path68, value: raw === "" ? [] : raw.split(",") };
|
|
32062
32125
|
default:
|
|
32063
32126
|
return key.kind;
|
|
32064
32127
|
}
|
|
32065
32128
|
}
|
|
32066
|
-
function setAt(target,
|
|
32067
|
-
const [head, ...rest] =
|
|
32129
|
+
function setAt(target, path68, value2) {
|
|
32130
|
+
const [head, ...rest] = path68;
|
|
32068
32131
|
if (head === void 0) {
|
|
32069
32132
|
return;
|
|
32070
32133
|
}
|
|
@@ -32077,8 +32140,8 @@ function setAt(target, path67, value2) {
|
|
|
32077
32140
|
target[head] = next;
|
|
32078
32141
|
setAt(next, rest, value2);
|
|
32079
32142
|
}
|
|
32080
|
-
function removeAt(target,
|
|
32081
|
-
const [head, ...rest] =
|
|
32143
|
+
function removeAt(target, path68) {
|
|
32144
|
+
const [head, ...rest] = path68;
|
|
32082
32145
|
if (head === void 0) {
|
|
32083
32146
|
return;
|
|
32084
32147
|
}
|
|
@@ -32096,13 +32159,13 @@ function removeAt(target, path67) {
|
|
|
32096
32159
|
}
|
|
32097
32160
|
function applyStatuslineChange(existing, change) {
|
|
32098
32161
|
const draft = structuredClone(existing ?? {});
|
|
32099
|
-
for (const [
|
|
32100
|
-
keyNamed(
|
|
32101
|
-
setAt(draft,
|
|
32162
|
+
for (const [path68, value2] of Object.entries(change.set ?? {})) {
|
|
32163
|
+
keyNamed(path68);
|
|
32164
|
+
setAt(draft, path68.split("."), value2);
|
|
32102
32165
|
}
|
|
32103
|
-
for (const
|
|
32104
|
-
keyNamed(
|
|
32105
|
-
removeAt(draft,
|
|
32166
|
+
for (const path68 of change.unset ?? []) {
|
|
32167
|
+
keyNamed(path68);
|
|
32168
|
+
removeAt(draft, path68.split("."));
|
|
32106
32169
|
}
|
|
32107
32170
|
const result = StatuslineSchema.safeParse(draft);
|
|
32108
32171
|
if (!result.success) {
|
|
@@ -35161,7 +35224,7 @@ function keyUsageExtension(bits) {
|
|
|
35161
35224
|
}
|
|
35162
35225
|
function ipv6Groups(address) {
|
|
35163
35226
|
const [head = "", tail] = address.split("::");
|
|
35164
|
-
const split = (
|
|
35227
|
+
const split = (text4) => text4 === "" ? [] : text4.split(":");
|
|
35165
35228
|
const expand = (groups) => groups.flatMap((group) => {
|
|
35166
35229
|
if (!import_node_net.default.isIPv4(group)) {
|
|
35167
35230
|
return [Number.parseInt(group, HEX_RADIX)];
|
|
@@ -35495,11 +35558,11 @@ function identifyRequest(headers) {
|
|
|
35495
35558
|
function directOrigin2(port) {
|
|
35496
35559
|
return `http://127.0.0.1:${String(port)}`;
|
|
35497
35560
|
}
|
|
35498
|
-
function parseProviderPath(
|
|
35499
|
-
if (!
|
|
35561
|
+
function parseProviderPath(path68) {
|
|
35562
|
+
if (!path68.startsWith(PROVIDER_PATH_PREFIX)) {
|
|
35500
35563
|
return void 0;
|
|
35501
35564
|
}
|
|
35502
|
-
const tail =
|
|
35565
|
+
const tail = path68.slice(PROVIDER_PATH_PREFIX.length);
|
|
35503
35566
|
const slash = tail.indexOf("/");
|
|
35504
35567
|
if (slash <= 0) {
|
|
35505
35568
|
return void 0;
|
|
@@ -35637,9 +35700,9 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
|
|
|
35637
35700
|
const watchdog = ports.startWatchdog?.();
|
|
35638
35701
|
let idleSince;
|
|
35639
35702
|
let ticks = 0;
|
|
35640
|
-
const supersedingOwner = () => {
|
|
35703
|
+
const supersedingOwner = async () => {
|
|
35641
35704
|
const owner = readFrontDoorState(fs30, paths.frontdoorStateFile)?.supervisorPid;
|
|
35642
|
-
return owner !== void 0 && owner !== ports.ownPid && ports.
|
|
35705
|
+
return owner !== void 0 && owner !== ports.ownPid && (await ports.runningAmong([owner])).has(owner) ? owner : void 0;
|
|
35643
35706
|
};
|
|
35644
35707
|
let supersededBy;
|
|
35645
35708
|
let served;
|
|
@@ -35664,7 +35727,7 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
|
|
|
35664
35727
|
watchdog?.stop();
|
|
35665
35728
|
ports.stopBackgroundWork?.();
|
|
35666
35729
|
const drained = [direct.drain(), connect3.drain(), http9.drain()];
|
|
35667
|
-
if (supersedingOwner() === void 0) {
|
|
35730
|
+
if (await supersedingOwner() === void 0) {
|
|
35668
35731
|
writeFrontDoorState(fs30, paths.frontdoorStateFile, sticky());
|
|
35669
35732
|
}
|
|
35670
35733
|
markFrontDoorDraining(fs30, paths.frontdoorDrainingDir, ports.ownPid);
|
|
@@ -35685,7 +35748,7 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
|
|
|
35685
35748
|
};
|
|
35686
35749
|
const shutdown = async () => {
|
|
35687
35750
|
await closeServing();
|
|
35688
|
-
if (supersedingOwner() === void 0) {
|
|
35751
|
+
if (await supersedingOwner() === void 0) {
|
|
35689
35752
|
writeFrontDoorState(fs30, paths.frontdoorStateFile, sticky());
|
|
35690
35753
|
}
|
|
35691
35754
|
return 0;
|
|
@@ -35701,13 +35764,14 @@ async function serveFrontDoor(idleShutdownMinutes, ports, options) {
|
|
|
35701
35764
|
}
|
|
35702
35765
|
ticks += 1;
|
|
35703
35766
|
const listed = listFrontDoorSessions(fs30, paths.frontdoorSessionsDir);
|
|
35704
|
-
const
|
|
35767
|
+
const running = await ports.runningAmong(listed.map((session) => session.pid));
|
|
35768
|
+
const pruned = pruneDeadFrontDoorSessions(fs30, paths.frontdoorSessionsDir, (pid) => running.has(pid));
|
|
35705
35769
|
ports.observeLaunchRegistry(listed, pruned);
|
|
35706
35770
|
ports.checkQuotaExpiry();
|
|
35707
35771
|
const prunedPids = new Set(pruned);
|
|
35708
35772
|
const live = listed.filter((session) => !prunedPids.has(session.pid));
|
|
35709
35773
|
if (supersededBy === void 0) {
|
|
35710
|
-
supersededBy = supersedingOwner();
|
|
35774
|
+
supersededBy = await supersedingOwner();
|
|
35711
35775
|
if (supersededBy !== void 0) {
|
|
35712
35776
|
ports.log(`agent-shim frontdoor supervisor ${String(ports.ownPid)}: supervisor ${String(supersededBy)} now owns the front door; taking no new sessions and exiting once the sessions this door serves have ended`);
|
|
35713
35777
|
ports.doorHealth.superseded(supersededBy);
|
|
@@ -35772,8 +35836,8 @@ function parseConnectTarget(authority) {
|
|
|
35772
35836
|
}
|
|
35773
35837
|
return { host, port };
|
|
35774
35838
|
}
|
|
35775
|
-
function servedByPipeline(
|
|
35776
|
-
return
|
|
35839
|
+
function servedByPipeline(path68) {
|
|
35840
|
+
return path68?.startsWith(ROUTED_PATH_PREFIX) === true;
|
|
35777
35841
|
}
|
|
35778
35842
|
function forwardableHeaders(headers) {
|
|
35779
35843
|
const connectionTokens = new Set(
|
|
@@ -36251,7 +36315,7 @@ var init_package = __esm({
|
|
|
36251
36315
|
"package.json"() {
|
|
36252
36316
|
package_default = {
|
|
36253
36317
|
name: "claude-use",
|
|
36254
|
-
version: "11.
|
|
36318
|
+
version: "11.54.1",
|
|
36255
36319
|
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.",
|
|
36256
36320
|
license: "MIT",
|
|
36257
36321
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -36515,9 +36579,9 @@ function errorInfo(raw) {
|
|
|
36515
36579
|
function isObject3(value2) {
|
|
36516
36580
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
36517
36581
|
}
|
|
36518
|
-
function parseJson2(
|
|
36582
|
+
function parseJson2(text4) {
|
|
36519
36583
|
try {
|
|
36520
|
-
const parsed = JSON.parse(
|
|
36584
|
+
const parsed = JSON.parse(text4);
|
|
36521
36585
|
return parsed;
|
|
36522
36586
|
} catch {
|
|
36523
36587
|
return void 0;
|
|
@@ -36565,26 +36629,26 @@ function createSseScanner() {
|
|
|
36565
36629
|
return void 0;
|
|
36566
36630
|
};
|
|
36567
36631
|
const completeLine = (complete) => {
|
|
36568
|
-
const
|
|
36569
|
-
if (
|
|
36632
|
+
const text4 = complete.endsWith("\r") ? complete.slice(0, -1) : complete;
|
|
36633
|
+
if (text4 === "") {
|
|
36570
36634
|
dispatch();
|
|
36571
36635
|
return;
|
|
36572
36636
|
}
|
|
36573
|
-
if (
|
|
36574
|
-
eventName =
|
|
36637
|
+
if (text4.startsWith("event:")) {
|
|
36638
|
+
eventName = text4.slice("event:".length).trim();
|
|
36575
36639
|
return;
|
|
36576
36640
|
}
|
|
36577
|
-
if (
|
|
36578
|
-
const value2 =
|
|
36641
|
+
if (text4.startsWith("data:")) {
|
|
36642
|
+
const value2 = text4.slice("data:".length);
|
|
36579
36643
|
data.push(value2.startsWith(" ") ? value2.slice(1) : value2);
|
|
36580
36644
|
}
|
|
36581
36645
|
};
|
|
36582
36646
|
return {
|
|
36583
|
-
push: (
|
|
36647
|
+
push: (text4) => {
|
|
36584
36648
|
let start = 0;
|
|
36585
36649
|
for (; ; ) {
|
|
36586
|
-
const newline =
|
|
36587
|
-
const piece = newline === -1 ?
|
|
36650
|
+
const newline = text4.indexOf("\n", start);
|
|
36651
|
+
const piece = newline === -1 ? text4.slice(start) : text4.slice(start, newline);
|
|
36588
36652
|
if (!skipping) {
|
|
36589
36653
|
line += piece;
|
|
36590
36654
|
if (worthKeeping(line) === false) {
|
|
@@ -36698,8 +36762,8 @@ function createJsonScanner() {
|
|
|
36698
36762
|
}
|
|
36699
36763
|
};
|
|
36700
36764
|
return {
|
|
36701
|
-
push: (
|
|
36702
|
-
for (const char of
|
|
36765
|
+
push: (text4) => {
|
|
36766
|
+
for (const char of text4) {
|
|
36703
36767
|
step2(char);
|
|
36704
36768
|
}
|
|
36705
36769
|
},
|
|
@@ -36773,12 +36837,12 @@ function decoderFor(encoding) {
|
|
|
36773
36837
|
return void 0;
|
|
36774
36838
|
}
|
|
36775
36839
|
}
|
|
36776
|
-
function destinationOf(
|
|
36777
|
-
const scoped = parseProviderPath(
|
|
36840
|
+
function destinationOf(path68, sessionProvider) {
|
|
36841
|
+
const scoped = parseProviderPath(path68);
|
|
36778
36842
|
if (scoped !== void 0) {
|
|
36779
36843
|
return { provider: scoped.provider, endpoint: scoped.rest };
|
|
36780
36844
|
}
|
|
36781
|
-
return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint:
|
|
36845
|
+
return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint: path68 };
|
|
36782
36846
|
}
|
|
36783
36847
|
function modelChoiceOf(event, servedModel, provider) {
|
|
36784
36848
|
if (event.modelChoice !== void 0) return event.modelChoice;
|
|
@@ -36826,13 +36890,13 @@ function createUsageMiddleware(deps) {
|
|
|
36826
36890
|
const scanner = scannerFor(event.headers);
|
|
36827
36891
|
const decoder = scanner === void 0 ? null : decoderFor(headerValue(event.headers, "content-encoding"));
|
|
36828
36892
|
let scanning = scanner !== void 0 && decoder !== void 0;
|
|
36829
|
-
const
|
|
36893
|
+
const text4 = new TextDecoder();
|
|
36830
36894
|
const feed = (bytes, final) => {
|
|
36831
36895
|
if (!scanning || scanner === void 0) {
|
|
36832
36896
|
return;
|
|
36833
36897
|
}
|
|
36834
36898
|
try {
|
|
36835
|
-
scanner.push(
|
|
36899
|
+
scanner.push(text4.decode(bytes, { stream: !final }));
|
|
36836
36900
|
} catch (error63) {
|
|
36837
36901
|
scanning = false;
|
|
36838
36902
|
deps.log(`usage: body scan failed for ${event.route}: ${error63 instanceof Error ? error63.message : String(error63)}`);
|
|
@@ -38007,9 +38071,9 @@ function buildFamilies(refs, models) {
|
|
|
38007
38071
|
const groups = [];
|
|
38008
38072
|
for (const ref of refs) {
|
|
38009
38073
|
const pinnedKey = Object.entries(settingsByKey).find(([, settings2]) => pinnedTo(settings2, ref))?.[0];
|
|
38010
|
-
const
|
|
38011
|
-
if (
|
|
38012
|
-
|
|
38074
|
+
const joined3 = groups.find((group) => pinnedKey === void 0 ? group.refs.some((first) => sameModel(first, ref, assertions)) : group.key === pinnedKey);
|
|
38075
|
+
if (joined3 !== void 0) {
|
|
38076
|
+
joined3.refs.push(ref);
|
|
38013
38077
|
} else {
|
|
38014
38078
|
groups.push({ key: pinnedKey ?? familyKeyOf(modelOf(ref)), refs: [ref] });
|
|
38015
38079
|
}
|
|
@@ -39748,14 +39812,14 @@ var require_util2 = __commonJS({
|
|
|
39748
39812
|
}
|
|
39749
39813
|
const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
|
|
39750
39814
|
let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
|
|
39751
|
-
let
|
|
39815
|
+
let path68 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
|
|
39752
39816
|
if (origin[origin.length - 1] === "/") {
|
|
39753
39817
|
origin = origin.slice(0, origin.length - 1);
|
|
39754
39818
|
}
|
|
39755
|
-
if (
|
|
39756
|
-
|
|
39819
|
+
if (path68 && path68[0] !== "/") {
|
|
39820
|
+
path68 = `/${path68}`;
|
|
39757
39821
|
}
|
|
39758
|
-
return new URL(`${origin}${
|
|
39822
|
+
return new URL(`${origin}${path68}`);
|
|
39759
39823
|
}
|
|
39760
39824
|
if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
|
|
39761
39825
|
throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -40576,9 +40640,9 @@ var require_diagnostics = __commonJS({
|
|
|
40576
40640
|
"undici:client:sendHeaders",
|
|
40577
40641
|
(evt) => {
|
|
40578
40642
|
const {
|
|
40579
|
-
request: { method, path:
|
|
40643
|
+
request: { method, path: path68, origin }
|
|
40580
40644
|
} = evt;
|
|
40581
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
40645
|
+
debugLog("sending request to %s %s%s", method, origin, path68);
|
|
40582
40646
|
}
|
|
40583
40647
|
);
|
|
40584
40648
|
}
|
|
@@ -40596,14 +40660,14 @@ var require_diagnostics = __commonJS({
|
|
|
40596
40660
|
"undici:request:headers",
|
|
40597
40661
|
(evt) => {
|
|
40598
40662
|
const {
|
|
40599
|
-
request: { method, path:
|
|
40663
|
+
request: { method, path: path68, origin },
|
|
40600
40664
|
response: { statusCode }
|
|
40601
40665
|
} = evt;
|
|
40602
40666
|
debugLog(
|
|
40603
40667
|
"received response to %s %s%s - HTTP %d",
|
|
40604
40668
|
method,
|
|
40605
40669
|
origin,
|
|
40606
|
-
|
|
40670
|
+
path68,
|
|
40607
40671
|
statusCode
|
|
40608
40672
|
);
|
|
40609
40673
|
}
|
|
@@ -40612,23 +40676,23 @@ var require_diagnostics = __commonJS({
|
|
|
40612
40676
|
"undici:request:trailers",
|
|
40613
40677
|
(evt) => {
|
|
40614
40678
|
const {
|
|
40615
|
-
request: { method, path:
|
|
40679
|
+
request: { method, path: path68, origin }
|
|
40616
40680
|
} = evt;
|
|
40617
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
40681
|
+
debugLog("trailers received from %s %s%s", method, origin, path68);
|
|
40618
40682
|
}
|
|
40619
40683
|
);
|
|
40620
40684
|
diagnosticsChannel.subscribe(
|
|
40621
40685
|
"undici:request:error",
|
|
40622
40686
|
(evt) => {
|
|
40623
40687
|
const {
|
|
40624
|
-
request: { method, path:
|
|
40688
|
+
request: { method, path: path68, origin },
|
|
40625
40689
|
error: error63
|
|
40626
40690
|
} = evt;
|
|
40627
40691
|
debugLog(
|
|
40628
40692
|
"request to %s %s%s errored - %s",
|
|
40629
40693
|
method,
|
|
40630
40694
|
origin,
|
|
40631
|
-
|
|
40695
|
+
path68,
|
|
40632
40696
|
error63.message
|
|
40633
40697
|
);
|
|
40634
40698
|
}
|
|
@@ -40743,7 +40807,7 @@ var require_request = __commonJS({
|
|
|
40743
40807
|
var kHandler = /* @__PURE__ */ Symbol("handler");
|
|
40744
40808
|
var Request2 = class {
|
|
40745
40809
|
constructor(origin, {
|
|
40746
|
-
path:
|
|
40810
|
+
path: path68,
|
|
40747
40811
|
method,
|
|
40748
40812
|
body,
|
|
40749
40813
|
headers,
|
|
@@ -40760,11 +40824,11 @@ var require_request = __commonJS({
|
|
|
40760
40824
|
maxRedirections,
|
|
40761
40825
|
typeOfService
|
|
40762
40826
|
}, handler) {
|
|
40763
|
-
if (typeof
|
|
40827
|
+
if (typeof path68 !== "string") {
|
|
40764
40828
|
throw new InvalidArgumentError2("path must be a string");
|
|
40765
|
-
} else if (
|
|
40829
|
+
} else if (path68[0] !== "/" && !(path68.startsWith("http://") || path68.startsWith("https://")) && method !== "CONNECT") {
|
|
40766
40830
|
throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
|
|
40767
|
-
} else if (invalidPathRegex.test(
|
|
40831
|
+
} else if (invalidPathRegex.test(path68)) {
|
|
40768
40832
|
throw new InvalidArgumentError2("invalid request path");
|
|
40769
40833
|
}
|
|
40770
40834
|
if (typeof method !== "string") {
|
|
@@ -40839,7 +40903,7 @@ var require_request = __commonJS({
|
|
|
40839
40903
|
this.completed = false;
|
|
40840
40904
|
this.aborted = false;
|
|
40841
40905
|
this.upgrade = upgrade || null;
|
|
40842
|
-
this.path = query ? serializePathWithQuery(
|
|
40906
|
+
this.path = query ? serializePathWithQuery(path68, query) : path68;
|
|
40843
40907
|
this.origin = origin;
|
|
40844
40908
|
this.protocol = getProtocolFromUrlString(origin);
|
|
40845
40909
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -46021,7 +46085,7 @@ var require_client_h1 = __commonJS({
|
|
|
46021
46085
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
46022
46086
|
}
|
|
46023
46087
|
function writeH1(client, request7) {
|
|
46024
|
-
const { method, path:
|
|
46088
|
+
const { method, path: path68, host, upgrade, blocking, reset } = request7;
|
|
46025
46089
|
let { body, headers, contentLength } = request7;
|
|
46026
46090
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
46027
46091
|
if (util2.isFormDataLike(body)) {
|
|
@@ -46099,7 +46163,7 @@ var require_client_h1 = __commonJS({
|
|
|
46099
46163
|
if (socket.setTypeOfService) {
|
|
46100
46164
|
socket.setTypeOfService(request7.typeOfService);
|
|
46101
46165
|
}
|
|
46102
|
-
let header = `${method} ${
|
|
46166
|
+
let header = `${method} ${path68} HTTP/1.1\r
|
|
46103
46167
|
`;
|
|
46104
46168
|
if (typeof host === "string") {
|
|
46105
46169
|
header += `host: ${host}\r
|
|
@@ -46778,7 +46842,7 @@ var require_client_h2 = __commonJS({
|
|
|
46778
46842
|
const headersTimeout = request7.headersTimeout ?? client[kHeadersTimeout];
|
|
46779
46843
|
const bodyTimeout = request7.bodyTimeout ?? client[kBodyTimeout];
|
|
46780
46844
|
const session = client[kHTTP2Session];
|
|
46781
|
-
const { method, path:
|
|
46845
|
+
const { method, path: path68, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
|
|
46782
46846
|
let { body } = request7;
|
|
46783
46847
|
if (upgrade != null && upgrade !== "websocket") {
|
|
46784
46848
|
util2.errorRequest(client, request7, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
@@ -46847,7 +46911,7 @@ var require_client_h2 = __commonJS({
|
|
|
46847
46911
|
}
|
|
46848
46912
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
46849
46913
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
46850
|
-
headers[HTTP2_HEADER_PATH] =
|
|
46914
|
+
headers[HTTP2_HEADER_PATH] = path68;
|
|
46851
46915
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
46852
46916
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
46853
46917
|
} else {
|
|
@@ -46889,7 +46953,7 @@ var require_client_h2 = __commonJS({
|
|
|
46889
46953
|
stream.setTimeout(headersTimeout);
|
|
46890
46954
|
return true;
|
|
46891
46955
|
}
|
|
46892
|
-
headers[HTTP2_HEADER_PATH] =
|
|
46956
|
+
headers[HTTP2_HEADER_PATH] = path68;
|
|
46893
46957
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
46894
46958
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
46895
46959
|
if (body && typeof body.read === "function") {
|
|
@@ -49241,10 +49305,10 @@ var require_proxy_agent = __commonJS({
|
|
|
49241
49305
|
};
|
|
49242
49306
|
const {
|
|
49243
49307
|
origin,
|
|
49244
|
-
path:
|
|
49308
|
+
path: path68 = "/",
|
|
49245
49309
|
headers = {}
|
|
49246
49310
|
} = opts;
|
|
49247
|
-
opts.path = origin +
|
|
49311
|
+
opts.path = origin + path68;
|
|
49248
49312
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
49249
49313
|
const { host } = new URL(origin);
|
|
49250
49314
|
headers.host = host;
|
|
@@ -51353,20 +51417,20 @@ var require_mock_utils = __commonJS({
|
|
|
51353
51417
|
}
|
|
51354
51418
|
return normalizedQp;
|
|
51355
51419
|
}
|
|
51356
|
-
function safeUrl(
|
|
51357
|
-
if (typeof
|
|
51358
|
-
return
|
|
51420
|
+
function safeUrl(path68) {
|
|
51421
|
+
if (typeof path68 !== "string") {
|
|
51422
|
+
return path68;
|
|
51359
51423
|
}
|
|
51360
|
-
const pathSegments =
|
|
51424
|
+
const pathSegments = path68.split("?", 3);
|
|
51361
51425
|
if (pathSegments.length !== 2) {
|
|
51362
|
-
return
|
|
51426
|
+
return path68;
|
|
51363
51427
|
}
|
|
51364
51428
|
const qp2 = new URLSearchParams(pathSegments.pop());
|
|
51365
51429
|
qp2.sort();
|
|
51366
51430
|
return [...pathSegments, qp2.toString()].join("?");
|
|
51367
51431
|
}
|
|
51368
|
-
function matchKey(mockDispatch2, { path:
|
|
51369
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
51432
|
+
function matchKey(mockDispatch2, { path: path68, method, body, headers }) {
|
|
51433
|
+
const pathMatch = matchValue(mockDispatch2.path, path68);
|
|
51370
51434
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
51371
51435
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
51372
51436
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -51391,8 +51455,8 @@ var require_mock_utils = __commonJS({
|
|
|
51391
51455
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
51392
51456
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
51393
51457
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
51394
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
51395
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
51458
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path68, ignoreTrailingSlash }) => {
|
|
51459
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path68)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path68), resolvedPath);
|
|
51396
51460
|
});
|
|
51397
51461
|
if (matchedMockDispatches.length === 0) {
|
|
51398
51462
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -51431,19 +51495,19 @@ var require_mock_utils = __commonJS({
|
|
|
51431
51495
|
mockDispatches.splice(index, 1);
|
|
51432
51496
|
}
|
|
51433
51497
|
}
|
|
51434
|
-
function removeTrailingSlash(
|
|
51435
|
-
while (
|
|
51436
|
-
|
|
51498
|
+
function removeTrailingSlash(path68) {
|
|
51499
|
+
while (path68.endsWith("/")) {
|
|
51500
|
+
path68 = path68.slice(0, -1);
|
|
51437
51501
|
}
|
|
51438
|
-
if (
|
|
51439
|
-
|
|
51502
|
+
if (path68.length === 0) {
|
|
51503
|
+
path68 = "/";
|
|
51440
51504
|
}
|
|
51441
|
-
return
|
|
51505
|
+
return path68;
|
|
51442
51506
|
}
|
|
51443
51507
|
function buildKey(opts) {
|
|
51444
|
-
const { path:
|
|
51508
|
+
const { path: path68, method, body, headers, query } = opts;
|
|
51445
51509
|
return {
|
|
51446
|
-
path:
|
|
51510
|
+
path: path68,
|
|
51447
51511
|
method,
|
|
51448
51512
|
body,
|
|
51449
51513
|
headers,
|
|
@@ -52133,10 +52197,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
52133
52197
|
}
|
|
52134
52198
|
format(pendingInterceptors) {
|
|
52135
52199
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
52136
|
-
({ method, path:
|
|
52200
|
+
({ method, path: path68, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
52137
52201
|
Method: method,
|
|
52138
52202
|
Origin: origin,
|
|
52139
|
-
Path:
|
|
52203
|
+
Path: path68,
|
|
52140
52204
|
"Status code": statusCode,
|
|
52141
52205
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
52142
52206
|
Invocations: timesInvoked,
|
|
@@ -52218,9 +52282,9 @@ var require_mock_agent = __commonJS({
|
|
|
52218
52282
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
52219
52283
|
const dispatchOpts = { ...opts };
|
|
52220
52284
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
52221
|
-
const [
|
|
52285
|
+
const [path68, searchParams] = dispatchOpts.path.split("?");
|
|
52222
52286
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
52223
|
-
dispatchOpts.path = `${
|
|
52287
|
+
dispatchOpts.path = `${path68}?${normalizedSearchParams}`;
|
|
52224
52288
|
}
|
|
52225
52289
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
52226
52290
|
}
|
|
@@ -52621,12 +52685,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
52621
52685
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
52622
52686
|
*/
|
|
52623
52687
|
async loadSnapshots(filePath) {
|
|
52624
|
-
const
|
|
52625
|
-
if (!
|
|
52688
|
+
const path68 = filePath || this.#snapshotPath;
|
|
52689
|
+
if (!path68) {
|
|
52626
52690
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
52627
52691
|
}
|
|
52628
52692
|
try {
|
|
52629
|
-
const data = await readFile(resolve2(
|
|
52693
|
+
const data = await readFile(resolve2(path68), "utf8");
|
|
52630
52694
|
const parsed = JSON.parse(data);
|
|
52631
52695
|
if (Array.isArray(parsed)) {
|
|
52632
52696
|
this.#snapshots.clear();
|
|
@@ -52640,7 +52704,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
52640
52704
|
if (error63.code === "ENOENT") {
|
|
52641
52705
|
this.#snapshots.clear();
|
|
52642
52706
|
} else {
|
|
52643
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
52707
|
+
throw new UndiciError(`Failed to load snapshots from ${path68}`, { cause: error63 });
|
|
52644
52708
|
}
|
|
52645
52709
|
}
|
|
52646
52710
|
}
|
|
@@ -52651,11 +52715,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
52651
52715
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
52652
52716
|
*/
|
|
52653
52717
|
async saveSnapshots(filePath) {
|
|
52654
|
-
const
|
|
52655
|
-
if (!
|
|
52718
|
+
const path68 = filePath || this.#snapshotPath;
|
|
52719
|
+
if (!path68) {
|
|
52656
52720
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
52657
52721
|
}
|
|
52658
|
-
const resolvedPath = resolve2(
|
|
52722
|
+
const resolvedPath = resolve2(path68);
|
|
52659
52723
|
await mkdir(dirname3(resolvedPath), { recursive: true });
|
|
52660
52724
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
52661
52725
|
hash: hash2,
|
|
@@ -53287,15 +53351,15 @@ var require_redirect_handler = __commonJS({
|
|
|
53287
53351
|
return;
|
|
53288
53352
|
}
|
|
53289
53353
|
const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
53290
|
-
const
|
|
53291
|
-
const redirectUrlString = `${origin}${
|
|
53354
|
+
const path68 = search ? `${pathname}${search}` : pathname;
|
|
53355
|
+
const redirectUrlString = `${origin}${path68}`;
|
|
53292
53356
|
for (const historyUrl of this.history) {
|
|
53293
53357
|
if (historyUrl.toString() === redirectUrlString) {
|
|
53294
53358
|
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.`);
|
|
53295
53359
|
}
|
|
53296
53360
|
}
|
|
53297
53361
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
53298
|
-
this.opts.path =
|
|
53362
|
+
this.opts.path = path68;
|
|
53299
53363
|
this.opts.origin = origin;
|
|
53300
53364
|
this.opts.query = null;
|
|
53301
53365
|
}
|
|
@@ -55055,10 +55119,10 @@ var require_cache_handler = __commonJS({
|
|
|
55055
55119
|
}
|
|
55056
55120
|
return locationUrl.pathname + locationUrl.search;
|
|
55057
55121
|
}
|
|
55058
|
-
function deleteCachedUri(store, cacheKey,
|
|
55122
|
+
function deleteCachedUri(store, cacheKey, path68) {
|
|
55059
55123
|
deleteCachedValue(store, {
|
|
55060
55124
|
...cacheKey,
|
|
55061
|
-
path:
|
|
55125
|
+
path: path68
|
|
55062
55126
|
});
|
|
55063
55127
|
for (let i10 = 0; i10 < util2.safeHTTPMethods.length; i10++) {
|
|
55064
55128
|
const method = util2.safeHTTPMethods[i10];
|
|
@@ -55066,7 +55130,7 @@ var require_cache_handler = __commonJS({
|
|
|
55066
55130
|
deleteCachedValue(store, {
|
|
55067
55131
|
...cacheKey,
|
|
55068
55132
|
method,
|
|
55069
|
-
path:
|
|
55133
|
+
path: path68
|
|
55070
55134
|
});
|
|
55071
55135
|
}
|
|
55072
55136
|
}
|
|
@@ -55077,9 +55141,9 @@ var require_cache_handler = __commonJS({
|
|
|
55077
55141
|
}
|
|
55078
55142
|
const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
|
|
55079
55143
|
for (let i10 = 0; i10 < values.length; i10++) {
|
|
55080
|
-
const
|
|
55081
|
-
if (
|
|
55082
|
-
deleteCachedUri(store, cacheKey,
|
|
55144
|
+
const path68 = getSameOriginPath(cacheKey, values[i10]);
|
|
55145
|
+
if (path68 !== void 0) {
|
|
55146
|
+
deleteCachedUri(store, cacheKey, path68);
|
|
55083
55147
|
}
|
|
55084
55148
|
}
|
|
55085
55149
|
}
|
|
@@ -60079,11 +60143,11 @@ var require_fetch = __commonJS({
|
|
|
60079
60143
|
function dispatch({ body }) {
|
|
60080
60144
|
const url2 = requestCurrentURL(request7);
|
|
60081
60145
|
const agent = fetchParams.controller.dispatcher;
|
|
60082
|
-
const
|
|
60146
|
+
const path68 = url2.pathname + url2.search;
|
|
60083
60147
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
60084
60148
|
return new Promise((resolve2, reject) => agent.dispatch(
|
|
60085
60149
|
{
|
|
60086
|
-
path: hasTrailingQuestionMark ? `${
|
|
60150
|
+
path: hasTrailingQuestionMark ? `${path68}?` : path68,
|
|
60087
60151
|
origin: url2.origin,
|
|
60088
60152
|
method: request7.method,
|
|
60089
60153
|
body: agent.isMockActive ? request7.body && (request7.body.source || request7.body.stream) : body,
|
|
@@ -61030,9 +61094,9 @@ var require_util5 = __commonJS({
|
|
|
61030
61094
|
}
|
|
61031
61095
|
}
|
|
61032
61096
|
}
|
|
61033
|
-
function validateCookiePath(
|
|
61034
|
-
for (let i10 = 0; i10 <
|
|
61035
|
-
const code =
|
|
61097
|
+
function validateCookiePath(path68) {
|
|
61098
|
+
for (let i10 = 0; i10 < path68.length; ++i10) {
|
|
61099
|
+
const code = path68.charCodeAt(i10);
|
|
61036
61100
|
if (code < 32 || // exclude CTLs (0-31)
|
|
61037
61101
|
code > 126 || // exclude DEL and non-ascii
|
|
61038
61102
|
code === 59) {
|
|
@@ -64380,11 +64444,11 @@ var require_undici = __commonJS({
|
|
|
64380
64444
|
if (typeof opts.path !== "string") {
|
|
64381
64445
|
throw new InvalidArgumentError2("invalid opts.path");
|
|
64382
64446
|
}
|
|
64383
|
-
let
|
|
64447
|
+
let path68 = opts.path;
|
|
64384
64448
|
if (!opts.path.startsWith("/")) {
|
|
64385
|
-
|
|
64449
|
+
path68 = `/${path68}`;
|
|
64386
64450
|
}
|
|
64387
|
-
url2 = new URL(util2.parseOrigin(url2).origin +
|
|
64451
|
+
url2 = new URL(util2.parseOrigin(url2).origin + path68);
|
|
64388
64452
|
} else {
|
|
64389
64453
|
if (!opts) {
|
|
64390
64454
|
opts = typeof url2 === "object" ? url2 : {};
|
|
@@ -65796,8 +65860,8 @@ function countOf(usage, key) {
|
|
|
65796
65860
|
const value2 = key in usage ? Reflect.get(usage, key) : void 0;
|
|
65797
65861
|
return typeof value2 === "number" && Number.isFinite(value2) && value2 >= 0 ? value2 : 0;
|
|
65798
65862
|
}
|
|
65799
|
-
function contextTokensOfTranscript(
|
|
65800
|
-
const lines =
|
|
65863
|
+
function contextTokensOfTranscript(text4) {
|
|
65864
|
+
const lines = text4.split("\n");
|
|
65801
65865
|
for (let index = lines.length - 1; index >= 0; index -= 1) {
|
|
65802
65866
|
const line = lines[index];
|
|
65803
65867
|
if (line === void 0 || line === "") {
|
|
@@ -65848,8 +65912,8 @@ function resumedContextTokens(fs30, params) {
|
|
|
65848
65912
|
}
|
|
65849
65913
|
const projectDir = import_node_path43.default.join(params.claudeHome, "projects", projectDirNameOf(params.cwd));
|
|
65850
65914
|
const file2 = target.kind === "id" ? import_node_path43.default.join(projectDir, `${target.id}.jsonl`) : newestTranscript(fs30, projectDir);
|
|
65851
|
-
const
|
|
65852
|
-
return
|
|
65915
|
+
const text4 = file2 === void 0 ? void 0 : fs30.readFileUtf8(file2);
|
|
65916
|
+
return text4 === void 0 ? void 0 : contextTokensOfTranscript(text4);
|
|
65853
65917
|
}
|
|
65854
65918
|
var import_node_path43;
|
|
65855
65919
|
var init_resumeContext = __esm({
|
|
@@ -66112,8 +66176,8 @@ function farmRow(links, builtDirectories, adopted) {
|
|
|
66112
66176
|
const parts = [counted(links, "link", "links"), counted(builtDirectories, "built directory", "built directories"), ...adopted === 0 ? [] : [`${String(adopted)} adopted`]];
|
|
66113
66177
|
return { label: "farm", value: "resynced", detail: parts.join(", ") };
|
|
66114
66178
|
}
|
|
66115
|
-
function noteRow(
|
|
66116
|
-
return { label: "note", value:
|
|
66179
|
+
function noteRow(text4) {
|
|
66180
|
+
return { label: "note", value: text4 };
|
|
66117
66181
|
}
|
|
66118
66182
|
var init_launchReport = __esm({
|
|
66119
66183
|
"src/launcher/launchReport.ts"() {
|
|
@@ -66890,9 +66954,9 @@ function flattenToolResult(content) {
|
|
|
66890
66954
|
}
|
|
66891
66955
|
return content.map((block2) => isTextBlock(block2) ? block2.text : NON_TEXT_TOOL_RESULT).join("\n");
|
|
66892
66956
|
}
|
|
66893
|
-
function systemReminder(
|
|
66957
|
+
function systemReminder(text4) {
|
|
66894
66958
|
return `<system-reminder>
|
|
66895
|
-
${
|
|
66959
|
+
${text4}
|
|
66896
66960
|
</system-reminder>`;
|
|
66897
66961
|
}
|
|
66898
66962
|
function turnBlocks(message) {
|
|
@@ -67129,9 +67193,9 @@ function flattenToolResult2(content) {
|
|
|
67129
67193
|
}
|
|
67130
67194
|
return content.map((block2) => isTextBlock(block2) ? block2.text : NON_TEXT_TOOL_RESULT2).join("\n");
|
|
67131
67195
|
}
|
|
67132
|
-
function systemReminder2(
|
|
67196
|
+
function systemReminder2(text4) {
|
|
67133
67197
|
return `<system-reminder>
|
|
67134
|
-
${
|
|
67198
|
+
${text4}
|
|
67135
67199
|
</system-reminder>`;
|
|
67136
67200
|
}
|
|
67137
67201
|
function turnBlocks2(message) {
|
|
@@ -67256,12 +67320,12 @@ var init_translate2 = __esm({
|
|
|
67256
67320
|
function catalogueCachePath(paths, name) {
|
|
67257
67321
|
return import_node_path44.default.join(paths.catalogueDir, `${name}.json`);
|
|
67258
67322
|
}
|
|
67259
|
-
function parseCatalogueCache(
|
|
67260
|
-
if (
|
|
67323
|
+
function parseCatalogueCache(text4) {
|
|
67324
|
+
if (text4 === void 0) {
|
|
67261
67325
|
return void 0;
|
|
67262
67326
|
}
|
|
67263
67327
|
try {
|
|
67264
|
-
const parsed = CatalogueCacheSchema.safeParse(JSON.parse(
|
|
67328
|
+
const parsed = CatalogueCacheSchema.safeParse(JSON.parse(text4));
|
|
67265
67329
|
return parsed.success ? parsed.data : void 0;
|
|
67266
67330
|
} catch {
|
|
67267
67331
|
return void 0;
|
|
@@ -67466,8 +67530,8 @@ function addSameGroup(paths, refs) {
|
|
|
67466
67530
|
const current = readModels(paths) ?? {};
|
|
67467
67531
|
const overlapping = (current.same ?? []).filter((group) => group.some((ref) => refs.includes(ref)));
|
|
67468
67532
|
const rest = (current.same ?? []).filter((group) => !overlapping.includes(group));
|
|
67469
|
-
const
|
|
67470
|
-
writeModels(paths, stripEmpty({ ...current, same: [...rest,
|
|
67533
|
+
const joined3 = [.../* @__PURE__ */ new Set([...overlapping.flat(), ...refs])];
|
|
67534
|
+
writeModels(paths, stripEmpty({ ...current, same: [...rest, joined3] }));
|
|
67471
67535
|
}
|
|
67472
67536
|
function addDistinctPair(paths, left, right) {
|
|
67473
67537
|
const current = readModels(paths) ?? {};
|
|
@@ -105648,8 +105712,8 @@ var require_utils3 = __commonJS({
|
|
|
105648
105712
|
}
|
|
105649
105713
|
return ind;
|
|
105650
105714
|
}
|
|
105651
|
-
function removeDotSegments(
|
|
105652
|
-
let input2 =
|
|
105715
|
+
function removeDotSegments(path68) {
|
|
105716
|
+
let input2 = path68;
|
|
105653
105717
|
const output2 = [];
|
|
105654
105718
|
let nextSlash = -1;
|
|
105655
105719
|
let len = 0;
|
|
@@ -106058,8 +106122,8 @@ var require_schemes = __commonJS({
|
|
|
106058
106122
|
}
|
|
106059
106123
|
if (wsComponent.resourceName) {
|
|
106060
106124
|
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
106061
|
-
const
|
|
106062
|
-
wsComponent.path =
|
|
106125
|
+
const path68 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
106126
|
+
wsComponent.path = path68 && path68 !== "/" ? path68 : void 0;
|
|
106063
106127
|
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
106064
106128
|
wsComponent.resourceName = void 0;
|
|
106065
106129
|
}
|
|
@@ -107011,7 +107075,7 @@ var require_core2 = __commonJS({
|
|
|
107011
107075
|
errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
107012
107076
|
if (!errors || errors.length === 0)
|
|
107013
107077
|
return "No errors";
|
|
107014
|
-
return errors.map((e14) => `${dataVar}${e14.instancePath} ${e14.message}`).reduce((
|
|
107078
|
+
return errors.map((e14) => `${dataVar}${e14.instancePath} ${e14.message}`).reduce((text4, msg) => text4 + separator + msg);
|
|
107015
107079
|
}
|
|
107016
107080
|
$dataMetaSchema(metaSchema, keywordsJsonPointers) {
|
|
107017
107081
|
const rules = this.RULES.all;
|
|
@@ -109586,7 +109650,7 @@ var require_dist2 = __commonJS({
|
|
|
109586
109650
|
});
|
|
109587
109651
|
|
|
109588
109652
|
// src/cli.ts
|
|
109589
|
-
var
|
|
109653
|
+
var import_node_path67 = __toESM(require("node:path"), 1);
|
|
109590
109654
|
|
|
109591
109655
|
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
|
|
109592
109656
|
var CommanderError = class extends Error {
|
|
@@ -112699,9 +112763,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
112699
112763
|
* @param {string} [path]
|
|
112700
112764
|
* @return {(string|null|Command)}
|
|
112701
112765
|
*/
|
|
112702
|
-
executableDir(
|
|
112703
|
-
if (
|
|
112704
|
-
this._executableDir =
|
|
112766
|
+
executableDir(path68) {
|
|
112767
|
+
if (path68 === void 0) return this._executableDir;
|
|
112768
|
+
this._executableDir = path68;
|
|
112705
112769
|
return this;
|
|
112706
112770
|
}
|
|
112707
112771
|
/**
|
|
@@ -112718,9 +112782,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
112718
112782
|
helpWidth: context.helpWidth,
|
|
112719
112783
|
outputHasColors: context.hasColors
|
|
112720
112784
|
});
|
|
112721
|
-
const
|
|
112722
|
-
if (context.hasColors) return
|
|
112723
|
-
return this._outputConfiguration.stripColor(
|
|
112785
|
+
const text4 = helper.formatHelp(this, helper);
|
|
112786
|
+
if (context.hasColors) return text4;
|
|
112787
|
+
return this._outputConfiguration.stripColor(text4);
|
|
112724
112788
|
}
|
|
112725
112789
|
/**
|
|
112726
112790
|
* @typedef HelpContext
|
|
@@ -112880,7 +112944,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
112880
112944
|
* @param {(string | Function)} text - string to add, or a function returning a string
|
|
112881
112945
|
* @return {Command} `this` command for chaining
|
|
112882
112946
|
*/
|
|
112883
|
-
addHelpText(position,
|
|
112947
|
+
addHelpText(position, text4) {
|
|
112884
112948
|
const allowedValues = ["beforeAll", "before", "after", "afterAll"];
|
|
112885
112949
|
if (!allowedValues.includes(position)) {
|
|
112886
112950
|
throw new Error(`Unexpected value for position to addHelpText.
|
|
@@ -112889,10 +112953,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
112889
112953
|
const helpEvent = `${position}Help`;
|
|
112890
112954
|
this.on(helpEvent, (context) => {
|
|
112891
112955
|
let helpStr;
|
|
112892
|
-
if (typeof
|
|
112893
|
-
helpStr =
|
|
112956
|
+
if (typeof text4 === "function") {
|
|
112957
|
+
helpStr = text4({ error: context.error, command: context.command });
|
|
112894
112958
|
} else {
|
|
112895
|
-
helpStr =
|
|
112959
|
+
helpStr = text4;
|
|
112896
112960
|
}
|
|
112897
112961
|
if (helpStr) {
|
|
112898
112962
|
context.write(`${helpStr}
|
|
@@ -114177,19 +114241,19 @@ function writePools(paths, pools) {
|
|
|
114177
114241
|
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
|
|
114178
114242
|
}
|
|
114179
114243
|
function poolCycleOf(pools, name) {
|
|
114180
|
-
const walk3 = (current,
|
|
114244
|
+
const walk3 = (current, path68) => {
|
|
114181
114245
|
for (const entry of pools[current]?.identities ?? []) {
|
|
114182
114246
|
const nested = poolNameOf(poolMemberIdentity(entry));
|
|
114183
114247
|
if (nested === void 0) {
|
|
114184
114248
|
continue;
|
|
114185
114249
|
}
|
|
114186
114250
|
if (nested === name) {
|
|
114187
|
-
return [...
|
|
114251
|
+
return [...path68, nested];
|
|
114188
114252
|
}
|
|
114189
|
-
if (
|
|
114253
|
+
if (path68.includes(nested)) {
|
|
114190
114254
|
continue;
|
|
114191
114255
|
}
|
|
114192
|
-
const found = walk3(nested, [...
|
|
114256
|
+
const found = walk3(nested, [...path68, nested]);
|
|
114193
114257
|
if (found !== void 0) {
|
|
114194
114258
|
return found;
|
|
114195
114259
|
}
|
|
@@ -115390,7 +115454,7 @@ function statuslineChangeOf(options) {
|
|
|
115390
115454
|
return void 0;
|
|
115391
115455
|
}
|
|
115392
115456
|
const assignments = (options.statusline ?? []).map(parseStatuslineAssignment);
|
|
115393
|
-
return { set: Object.fromEntries(assignments.map(({ path:
|
|
115457
|
+
return { set: Object.fromEntries(assignments.map(({ path: path68, value: value2 }) => [path68, value2])), unset: options.unsetStatusline ?? [] };
|
|
115394
115458
|
}
|
|
115395
115459
|
function registerProfileCommand(program2, deps) {
|
|
115396
115460
|
const { paths } = deps;
|
|
@@ -117412,9 +117476,9 @@ function listDirOrReport(fs30, configDir, relative, report) {
|
|
|
117412
117476
|
return [];
|
|
117413
117477
|
}
|
|
117414
117478
|
}
|
|
117415
|
-
function parseJson3(
|
|
117479
|
+
function parseJson3(text4) {
|
|
117416
117480
|
try {
|
|
117417
|
-
const value2 = JSON.parse(
|
|
117481
|
+
const value2 = JSON.parse(text4);
|
|
117418
117482
|
return value2;
|
|
117419
117483
|
} catch {
|
|
117420
117484
|
return void 0;
|
|
@@ -117460,11 +117524,11 @@ function readSessionAgentTree(fs30, configDir, ref, options = {}) {
|
|
|
117460
117524
|
}
|
|
117461
117525
|
const agents = /* @__PURE__ */ new Map();
|
|
117462
117526
|
for (const candidate of located) {
|
|
117463
|
-
const
|
|
117464
|
-
if (
|
|
117527
|
+
const text4 = readFileOrReport(fs30, configDir, candidate.metaPath, report);
|
|
117528
|
+
if (text4 === void 0) {
|
|
117465
117529
|
continue;
|
|
117466
117530
|
}
|
|
117467
|
-
const parsed = AgentMetaSchema.safeParse(parseJson3(
|
|
117531
|
+
const parsed = AgentMetaSchema.safeParse(parseJson3(text4));
|
|
117468
117532
|
if (!parsed.success) {
|
|
117469
117533
|
report({ path: candidate.metaPath, reason: "meta file is not a JSON object with an agentType" });
|
|
117470
117534
|
continue;
|
|
@@ -117508,9 +117572,9 @@ function resolveParents(fs30, configDir, agents, report) {
|
|
|
117508
117572
|
if (cached2 !== void 0) {
|
|
117509
117573
|
return cached2;
|
|
117510
117574
|
}
|
|
117511
|
-
const
|
|
117512
|
-
transcriptCache.set(agent.located.id,
|
|
117513
|
-
return
|
|
117575
|
+
const text4 = readFileOrReport(fs30, configDir, agent.located.transcriptPath, report) ?? "";
|
|
117576
|
+
transcriptCache.set(agent.located.id, text4);
|
|
117577
|
+
return text4;
|
|
117514
117578
|
};
|
|
117515
117579
|
const wouldCycle = (child, parent) => {
|
|
117516
117580
|
for (let cursor3 = parent; cursor3 !== void 0; cursor3 = parentOf4.get(cursor3)) {
|
|
@@ -117567,11 +117631,11 @@ function readTasks(fs30, configDir, ownLists, sharedLists, report) {
|
|
|
117567
117631
|
continue;
|
|
117568
117632
|
}
|
|
117569
117633
|
const relative = import_node_path35.default.join(relativeDir, name);
|
|
117570
|
-
const
|
|
117571
|
-
const parsed = TaskFileSchema.safeParse(
|
|
117634
|
+
const text4 = readFileOrReport(fs30, configDir, relative, report);
|
|
117635
|
+
const parsed = TaskFileSchema.safeParse(text4 === void 0 ? void 0 : parseJson3(text4));
|
|
117572
117636
|
if (parsed.success) {
|
|
117573
117637
|
tasks.push(index < ownLists.length ? parsed.data : { ...parsed.data, taskList: scope });
|
|
117574
|
-
} else if (
|
|
117638
|
+
} else if (text4 !== void 0) {
|
|
117575
117639
|
report({ path: relative, reason: "task file is not a task" });
|
|
117576
117640
|
}
|
|
117577
117641
|
}
|
|
@@ -117585,10 +117649,10 @@ function readWorkflowRuns(fs30, configDir, relativeDir, report) {
|
|
|
117585
117649
|
continue;
|
|
117586
117650
|
}
|
|
117587
117651
|
const relative = import_node_path35.default.join(relativeDir, name);
|
|
117588
|
-
const
|
|
117589
|
-
const parsed = WorkflowRunFileSchema.safeParse(
|
|
117652
|
+
const text4 = readFileOrReport(fs30, configDir, relative, report);
|
|
117653
|
+
const parsed = WorkflowRunFileSchema.safeParse(text4 === void 0 ? void 0 : parseJson3(text4));
|
|
117590
117654
|
if (!parsed.success) {
|
|
117591
|
-
if (
|
|
117655
|
+
if (text4 !== void 0) {
|
|
117592
117656
|
report({ path: relative, reason: "workflow run file is not a run record" });
|
|
117593
117657
|
}
|
|
117594
117658
|
continue;
|
|
@@ -118951,8 +119015,8 @@ function finiteNumber(record2, field) {
|
|
|
118951
119015
|
const value2 = record2 === void 0 ? void 0 : record2[field];
|
|
118952
119016
|
return typeof value2 === "number" && Number.isFinite(value2) ? value2 : void 0;
|
|
118953
119017
|
}
|
|
118954
|
-
function excerpt(
|
|
118955
|
-
return
|
|
119018
|
+
function excerpt(text4) {
|
|
119019
|
+
return text4.length <= RC_PENDING_SUMMARY_EXCERPT_CHARS ? text4 : `${text4.slice(0, RC_PENDING_SUMMARY_EXCERPT_CHARS)}...`;
|
|
118956
119020
|
}
|
|
118957
119021
|
function payloadEventsOf(body) {
|
|
118958
119022
|
const parsed = parseJsonObject(body);
|
|
@@ -119057,11 +119121,11 @@ function createRcSessionTracker(deps) {
|
|
|
119057
119121
|
};
|
|
119058
119122
|
const observeExchange = (request7) => {
|
|
119059
119123
|
const method = (request7.method ?? "").toUpperCase();
|
|
119060
|
-
const
|
|
119061
|
-
if (!
|
|
119124
|
+
const path68 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
|
|
119125
|
+
if (!path68.startsWith(RC_SESSIONS_PATH_PREFIX)) {
|
|
119062
119126
|
return void 0;
|
|
119063
119127
|
}
|
|
119064
|
-
const tail =
|
|
119128
|
+
const tail = path68.slice(RC_SESSIONS_PATH_PREFIX.length);
|
|
119065
119129
|
const facts = {
|
|
119066
119130
|
oauthAuthorization: oauthAuthorizationOf(request7.headers),
|
|
119067
119131
|
anthropicVersion: singleHeader(request7.headers, "anthropic-version"),
|
|
@@ -119082,8 +119146,8 @@ function createRcSessionTracker(deps) {
|
|
|
119082
119146
|
if (!accepted2 || buffered2 >= RC_CREATE_RESPONSE_CAP_BYTES) {
|
|
119083
119147
|
return;
|
|
119084
119148
|
}
|
|
119085
|
-
const
|
|
119086
|
-
body = body +
|
|
119149
|
+
const text4 = Buffer.from(chunk2).toString("utf8");
|
|
119150
|
+
body = body + text4.slice(0, RC_CREATE_RESPONSE_CAP_BYTES - buffered2);
|
|
119087
119151
|
buffered2 = body.length;
|
|
119088
119152
|
},
|
|
119089
119153
|
onEnd: () => {
|
|
@@ -119301,13 +119365,13 @@ function teeRoutedResponse(response, observer, onSettled) {
|
|
|
119301
119365
|
}
|
|
119302
119366
|
|
|
119303
119367
|
// src/frontdoor/rcWrites.ts
|
|
119304
|
-
function buildRcUserMessagePayload(uuid3, sessionId,
|
|
119368
|
+
function buildRcUserMessagePayload(uuid3, sessionId, text4) {
|
|
119305
119369
|
return {
|
|
119306
119370
|
type: "user",
|
|
119307
119371
|
uuid: uuid3,
|
|
119308
119372
|
session_id: sessionId,
|
|
119309
119373
|
parent_tool_use_id: null,
|
|
119310
|
-
message: { role: "user", content:
|
|
119374
|
+
message: { role: "user", content: text4 }
|
|
119311
119375
|
};
|
|
119312
119376
|
}
|
|
119313
119377
|
function buildRcEventWriteBody(payload) {
|
|
@@ -119372,7 +119436,7 @@ function rcWriteHeaders(credential) {
|
|
|
119372
119436
|
}
|
|
119373
119437
|
return headers;
|
|
119374
119438
|
}
|
|
119375
|
-
async function injectRcUserMessage(deps, sessionId,
|
|
119439
|
+
async function injectRcUserMessage(deps, sessionId, text4) {
|
|
119376
119440
|
const credential = deps.credentialOf(sessionId);
|
|
119377
119441
|
if (credential === void 0) {
|
|
119378
119442
|
return { ok: false, message: rcSessionNotObservedMessage(sessionId) };
|
|
@@ -119380,7 +119444,7 @@ async function injectRcUserMessage(deps, sessionId, text3) {
|
|
|
119380
119444
|
if (credential.authorization === void 0) {
|
|
119381
119445
|
return noOAuthCredentialResult(sessionId);
|
|
119382
119446
|
}
|
|
119383
|
-
const body = JSON.stringify(buildRcEventWriteBody(buildRcUserMessagePayload(deps.newUuid(), sessionId,
|
|
119447
|
+
const body = JSON.stringify(buildRcEventWriteBody(buildRcUserMessagePayload(deps.newUuid(), sessionId, text4)));
|
|
119384
119448
|
let answer;
|
|
119385
119449
|
try {
|
|
119386
119450
|
answer = await deps.dial.writeEvents(sessionId, rcWriteHeaders(credential), body);
|
|
@@ -119430,8 +119494,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
|
|
|
119430
119494
|
function isRcReadFileEncoding(value2) {
|
|
119431
119495
|
return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value2);
|
|
119432
119496
|
}
|
|
119433
|
-
function buildRcReadFilePayload(requestId,
|
|
119434
|
-
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path:
|
|
119497
|
+
function buildRcReadFilePayload(requestId, path68, options) {
|
|
119498
|
+
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path68, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
|
|
119435
119499
|
}
|
|
119436
119500
|
function buildRcFileSuggestionsPayload(requestId, query) {
|
|
119437
119501
|
return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
|
|
@@ -119533,15 +119597,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
|
|
|
119533
119597
|
const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
|
|
119534
119598
|
return result.ok ? { ...result, requestId } : result;
|
|
119535
119599
|
}
|
|
119536
|
-
async function readRcSessionFile(deps, sessionId,
|
|
119537
|
-
if (
|
|
119600
|
+
async function readRcSessionFile(deps, sessionId, path68, options) {
|
|
119601
|
+
if (path68 === "") {
|
|
119538
119602
|
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" };
|
|
119539
119603
|
}
|
|
119540
119604
|
if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
|
|
119541
119605
|
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" };
|
|
119542
119606
|
}
|
|
119543
119607
|
const requestId = deps.newUuid();
|
|
119544
|
-
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId,
|
|
119608
|
+
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path68, options), `read ${path68} from session ${sessionId}`);
|
|
119545
119609
|
return result.ok ? { ...result, requestId } : result;
|
|
119546
119610
|
}
|
|
119547
119611
|
async function suggestRcSessionFiles(deps, sessionId, query) {
|
|
@@ -119603,9 +119667,9 @@ var RC_PERMISSION_MODE_LIST = RC_PERMISSION_MODES.join(", ");
|
|
|
119603
119667
|
var CONTROL_PATH_PREFIX = "/__agent-shim/rc";
|
|
119604
119668
|
var CONTROL_BODY_CAP_BYTES = 10485760;
|
|
119605
119669
|
function answerJson(response, status, body) {
|
|
119606
|
-
const
|
|
119607
|
-
response.writeHead(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(
|
|
119608
|
-
response.end(
|
|
119670
|
+
const text4 = JSON.stringify(body);
|
|
119671
|
+
response.writeHead(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(text4, "utf8")) });
|
|
119672
|
+
response.end(text4);
|
|
119609
119673
|
}
|
|
119610
119674
|
function isJsonObject(value2) {
|
|
119611
119675
|
return typeof value2 === "object" && value2 !== null && !Array.isArray(value2);
|
|
@@ -119712,11 +119776,11 @@ function createRcControlHandler(deps) {
|
|
|
119712
119776
|
path: "read-file",
|
|
119713
119777
|
read: (body) => {
|
|
119714
119778
|
const session = bodyString(body, "session");
|
|
119715
|
-
const
|
|
119779
|
+
const path68 = bodyString(body, "path");
|
|
119716
119780
|
const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
|
|
119717
119781
|
const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
|
|
119718
|
-
const refused2 = session === void 0 ||
|
|
119719
|
-
return refused2 ? { error: `the read-file body must be JSON naming a non-empty session id and path, maxBytes only as a positive whole number or absent, and an encoding the SDK's own type permits (${RC_READ_FILE_ENCODINGS.join(", ")}) or none` } : { session, run: async () => await deps.readFile(session,
|
|
119782
|
+
const refused2 = session === void 0 || path68 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
|
|
119783
|
+
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 } }) };
|
|
119720
119784
|
}
|
|
119721
119785
|
},
|
|
119722
119786
|
{
|
|
@@ -119854,12 +119918,12 @@ function createRcControlHandler(deps) {
|
|
|
119854
119918
|
answerJson(response, HTTP_STATUS.badRequest, { error: "the answer body must be JSON naming a non-empty session id, request id, and an approve boolean" });
|
|
119855
119919
|
return;
|
|
119856
119920
|
}
|
|
119857
|
-
const
|
|
119858
|
-
if (parsed.approve &&
|
|
119921
|
+
const text4 = "text" in parsed && typeof parsed.text === "string" ? parsed.text : void 0;
|
|
119922
|
+
if (parsed.approve && text4 !== void 0 && text4 !== "") {
|
|
119859
119923
|
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" });
|
|
119860
119924
|
return;
|
|
119861
119925
|
}
|
|
119862
|
-
const result = await deps.answer(parsed.session, parsed.request, { approve: parsed.approve, message: parsed.approve ? void 0 :
|
|
119926
|
+
const result = await deps.answer(parsed.session, parsed.request, { approve: parsed.approve, message: parsed.approve ? void 0 : text4 });
|
|
119863
119927
|
if (result.ok) {
|
|
119864
119928
|
answerJson(response, HTTP_STATUS.ok, { session: parsed.session, request: parsed.request, sequenceNums: result.sequenceNums });
|
|
119865
119929
|
return;
|
|
@@ -120026,9 +120090,9 @@ function requestIdOfBody(body) {
|
|
|
120026
120090
|
}
|
|
120027
120091
|
function frontDoorRcControl(transport, token) {
|
|
120028
120092
|
const headers = { authorization: `Bearer ${token}` };
|
|
120029
|
-
const listAnswerOf = async (
|
|
120093
|
+
const listAnswerOf = async (path68, what) => {
|
|
120030
120094
|
try {
|
|
120031
|
-
return await transport.request({ method: "GET", path:
|
|
120095
|
+
return await transport.request({ method: "GET", path: path68, headers });
|
|
120032
120096
|
} catch (error63) {
|
|
120033
120097
|
throw new Error(`${what}: could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}`, { cause: error63 });
|
|
120034
120098
|
}
|
|
@@ -120100,10 +120164,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
120100
120164
|
}
|
|
120101
120165
|
return pending;
|
|
120102
120166
|
};
|
|
120103
|
-
const writeOf = async (
|
|
120167
|
+
const writeOf = async (path68, body, describeFailure2) => {
|
|
120104
120168
|
let answer;
|
|
120105
120169
|
try {
|
|
120106
|
-
answer = await transport.request({ method: "POST", path:
|
|
120170
|
+
answer = await transport.request({ method: "POST", path: path68, headers: { ...headers, "content-type": "application/json" }, body });
|
|
120107
120171
|
} catch (error63) {
|
|
120108
120172
|
return { ok: false, message: `could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}` };
|
|
120109
120173
|
}
|
|
@@ -120122,7 +120186,7 @@ function frontDoorRcControl(transport, token) {
|
|
|
120122
120186
|
listSessions: async () => sessionsOf(await listAnswerOf(`${CONTROL_PATH_PREFIX}/sessions`, "listing the door's Remote Control sessions"), "listing the door's Remote Control sessions"),
|
|
120123
120187
|
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"),
|
|
120124
120188
|
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"),
|
|
120125
|
-
sendPrompt: async (sessionId,
|
|
120189
|
+
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}`),
|
|
120126
120190
|
answerRequest: async (sessionId, requestId, decision) => await writeOf(
|
|
120127
120191
|
`${CONTROL_PATH_PREFIX}/answer`,
|
|
120128
120192
|
JSON.stringify({ session: sessionId, request: requestId, approve: decision.approve, ...decision.approve || decision.message === void 0 ? {} : { text: decision.message } }),
|
|
@@ -120134,10 +120198,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
120134
120198
|
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}`),
|
|
120135
120199
|
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}`),
|
|
120136
120200
|
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}`),
|
|
120137
|
-
readFile: async (sessionId,
|
|
120201
|
+
readFile: async (sessionId, path68, options) => await writeOf(
|
|
120138
120202
|
`${CONTROL_PATH_PREFIX}/read-file`,
|
|
120139
|
-
JSON.stringify({ session: sessionId, path:
|
|
120140
|
-
(status, message) => `reading ${
|
|
120203
|
+
JSON.stringify({ session: sessionId, path: path68, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
|
|
120204
|
+
(status, message) => `reading ${path68} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
|
|
120141
120205
|
),
|
|
120142
120206
|
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}`),
|
|
120143
120207
|
keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
|
|
@@ -120450,12 +120514,12 @@ function tlsFacts(options) {
|
|
|
120450
120514
|
}
|
|
120451
120515
|
function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
120452
120516
|
const agent = new ExemptTlsAgent();
|
|
120453
|
-
const post = async (
|
|
120517
|
+
const post = async (path68, headers, body) => await new Promise((resolve2, reject) => {
|
|
120454
120518
|
const options = {
|
|
120455
120519
|
host: target.host,
|
|
120456
120520
|
port: target.port,
|
|
120457
120521
|
method: "POST",
|
|
120458
|
-
path:
|
|
120522
|
+
path: path68,
|
|
120459
120523
|
// 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.
|
|
120460
120524
|
headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
|
|
120461
120525
|
agent
|
|
@@ -120520,12 +120584,12 @@ function lateRcStreamDial(resolve2) {
|
|
|
120520
120584
|
}
|
|
120521
120585
|
function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
120522
120586
|
const agent = new ExemptTlsAgent();
|
|
120523
|
-
const request7 = async (method,
|
|
120587
|
+
const request7 = async (method, path68, headers, body, signal) => await new Promise((resolve2, reject) => {
|
|
120524
120588
|
const options = {
|
|
120525
120589
|
host: target.host,
|
|
120526
120590
|
port: target.port,
|
|
120527
120591
|
method,
|
|
120528
|
-
path:
|
|
120592
|
+
path: path68,
|
|
120529
120593
|
// 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.
|
|
120530
120594
|
headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
|
|
120531
120595
|
agent,
|
|
@@ -120567,9 +120631,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
|
|
|
120567
120631
|
return { status, body: await readAll(response) };
|
|
120568
120632
|
},
|
|
120569
120633
|
openStream: async (sessionId, headers, resume, signal) => {
|
|
120570
|
-
const
|
|
120634
|
+
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)}`;
|
|
120571
120635
|
const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
|
|
120572
|
-
const { status, response } = await request7("GET",
|
|
120636
|
+
const { status, response } = await request7("GET", path68, streamHeaders, void 0, signal);
|
|
120573
120637
|
if (!isSuccessful2(status)) {
|
|
120574
120638
|
await readAll(response);
|
|
120575
120639
|
return { status, chunks: NO_CHUNKS };
|
|
@@ -121835,11 +121899,11 @@ var AsyncIteratorClass = class {
|
|
|
121835
121899
|
return this;
|
|
121836
121900
|
}
|
|
121837
121901
|
};
|
|
121838
|
-
function parseEmptyableJSON(
|
|
121839
|
-
if (!
|
|
121902
|
+
function parseEmptyableJSON(text4) {
|
|
121903
|
+
if (!text4) {
|
|
121840
121904
|
return void 0;
|
|
121841
121905
|
}
|
|
121842
|
-
return JSON.parse(
|
|
121906
|
+
return JSON.parse(text4);
|
|
121843
121907
|
}
|
|
121844
121908
|
function stringifyJSON(value2) {
|
|
121845
121909
|
return JSON.stringify(value2);
|
|
@@ -121970,11 +122034,11 @@ function tryOrUndefined(fn2) {
|
|
|
121970
122034
|
return void 0;
|
|
121971
122035
|
}
|
|
121972
122036
|
}
|
|
121973
|
-
function pathToHttpPath(
|
|
121974
|
-
return `/${
|
|
122037
|
+
function pathToHttpPath(path68) {
|
|
122038
|
+
return `/${path68.map(safeEncodeURIComponent).join("/")}`;
|
|
121975
122039
|
}
|
|
121976
|
-
function normalizeHttpPath(
|
|
121977
|
-
const paths =
|
|
122040
|
+
function normalizeHttpPath(path68) {
|
|
122041
|
+
const paths = path68.split("/");
|
|
121978
122042
|
if (paths.at(0) === "") {
|
|
121979
122043
|
paths.shift();
|
|
121980
122044
|
}
|
|
@@ -122159,9 +122223,9 @@ function isPlainObject3(value2) {
|
|
|
122159
122223
|
function getOwn(object3, key) {
|
|
122160
122224
|
return Object.hasOwn(object3, key) ? object3[key] : void 0;
|
|
122161
122225
|
}
|
|
122162
|
-
function get(object3,
|
|
122226
|
+
function get(object3, path68) {
|
|
122163
122227
|
let current = object3;
|
|
122164
|
-
for (const key of
|
|
122228
|
+
for (const key of path68) {
|
|
122165
122229
|
if (!isTypescriptObject(current)) {
|
|
122166
122230
|
return void 0;
|
|
122167
122231
|
}
|
|
@@ -122890,8 +122954,8 @@ function createORPCErrorFromMalformedResponse(options) {
|
|
|
122890
122954
|
}
|
|
122891
122955
|
var INFERRED_MESSAGE_MIN_LENGTH = 1;
|
|
122892
122956
|
var INFERRED_MESSAGE_MAX_LENGTH = 256;
|
|
122893
|
-
function isInferableMessage(
|
|
122894
|
-
return
|
|
122957
|
+
function isInferableMessage(text4) {
|
|
122958
|
+
return text4.length >= INFERRED_MESSAGE_MIN_LENGTH && text4.length <= INFERRED_MESSAGE_MAX_LENGTH;
|
|
122895
122959
|
}
|
|
122896
122960
|
function inferMalformedResponseMessage(response) {
|
|
122897
122961
|
if (typeof response.body === "string" && isInferableMessage(response.body)) {
|
|
@@ -123384,7 +123448,7 @@ function resolveClientRest(rest) {
|
|
|
123384
123448
|
// rest[1] can be undefined if all fields of FriendlyClientOptions are optional
|
|
123385
123449
|
];
|
|
123386
123450
|
}
|
|
123387
|
-
function createORPCClient(link, { path:
|
|
123451
|
+
function createORPCClient(link, { path: path68 = [], ...options } = {}) {
|
|
123388
123452
|
const procedureClient = (...rest) => {
|
|
123389
123453
|
const [input2, callOptions] = resolveClientRest(rest);
|
|
123390
123454
|
const interceptors = [
|
|
@@ -123393,7 +123457,7 @@ function createORPCClient(link, { path: path67 = [], ...options } = {}) {
|
|
|
123393
123457
|
];
|
|
123394
123458
|
return intercept(
|
|
123395
123459
|
interceptors,
|
|
123396
|
-
{ ...callOptions, input: input2, path:
|
|
123460
|
+
{ ...callOptions, input: input2, path: path68 },
|
|
123397
123461
|
({ path: path210, input: input22, ...callOptions2 }) => link.call(path210, input22, callOptions2)
|
|
123398
123462
|
);
|
|
123399
123463
|
};
|
|
@@ -123407,7 +123471,7 @@ function createORPCClient(link, { path: path67 = [], ...options } = {}) {
|
|
|
123407
123471
|
if (client === void 0) {
|
|
123408
123472
|
client = createORPCClient(link, {
|
|
123409
123473
|
...options,
|
|
123410
|
-
path: [...
|
|
123474
|
+
path: [...path68, key],
|
|
123411
123475
|
scoped: options.scoped?.[key]
|
|
123412
123476
|
});
|
|
123413
123477
|
cache.set(key, client);
|
|
@@ -123429,24 +123493,24 @@ var BracketNotationSerializer = class {
|
|
|
123429
123493
|
this.internalSerialize(data, "", true, result);
|
|
123430
123494
|
return result;
|
|
123431
123495
|
}
|
|
123432
|
-
internalSerialize(data,
|
|
123496
|
+
internalSerialize(data, path68, isRoot, result) {
|
|
123433
123497
|
if (Array.isArray(data)) {
|
|
123434
123498
|
data.forEach((item, i10) => {
|
|
123435
|
-
this.internalSerialize(item, isRoot ? i10.toString() : `${
|
|
123499
|
+
this.internalSerialize(item, isRoot ? i10.toString() : `${path68}[${i10}]`, false, result);
|
|
123436
123500
|
});
|
|
123437
123501
|
} else if (isPlainObject3(data)) {
|
|
123438
123502
|
for (const key of Object.keys(data)) {
|
|
123439
|
-
this.internalSerialize(data[key], isRoot ? key : `${
|
|
123503
|
+
this.internalSerialize(data[key], isRoot ? key : `${path68}[${key}]`, false, result);
|
|
123440
123504
|
}
|
|
123441
123505
|
} else {
|
|
123442
|
-
result.push([
|
|
123506
|
+
result.push([path68, data]);
|
|
123443
123507
|
}
|
|
123444
123508
|
}
|
|
123445
123509
|
deserialize(serialized) {
|
|
123446
123510
|
const arrayPushStyles = /* @__PURE__ */ new WeakSet();
|
|
123447
123511
|
const root = new NullProtoObj();
|
|
123448
|
-
for (const [
|
|
123449
|
-
const segments = this.parsePath(
|
|
123512
|
+
for (const [path68, value2] of serialized) {
|
|
123513
|
+
const segments = this.parsePath(path68);
|
|
123450
123514
|
let currentRef = root;
|
|
123451
123515
|
let nextSegment = segments[0];
|
|
123452
123516
|
for (let i10 = 1; i10 < segments.length; i10++) {
|
|
@@ -123497,13 +123561,13 @@ var BracketNotationSerializer = class {
|
|
|
123497
123561
|
}
|
|
123498
123562
|
return result;
|
|
123499
123563
|
}
|
|
123500
|
-
parsePath(
|
|
123564
|
+
parsePath(path68) {
|
|
123501
123565
|
const segments = [];
|
|
123502
123566
|
let inBrackets = false;
|
|
123503
123567
|
let currentSegment = "";
|
|
123504
|
-
for (let i10 = 0; i10 <
|
|
123505
|
-
const char =
|
|
123506
|
-
const nextChar =
|
|
123568
|
+
for (let i10 = 0; i10 < path68.length; i10++) {
|
|
123569
|
+
const char = path68[i10];
|
|
123570
|
+
const nextChar = path68[i10 + 1];
|
|
123507
123571
|
if (inBrackets && char === "]" && (nextChar === void 0 || nextChar === "[")) {
|
|
123508
123572
|
if (nextChar === void 0) {
|
|
123509
123573
|
inBrackets = false;
|
|
@@ -123519,7 +123583,7 @@ var BracketNotationSerializer = class {
|
|
|
123519
123583
|
currentSegment += char;
|
|
123520
123584
|
}
|
|
123521
123585
|
}
|
|
123522
|
-
return inBrackets || segments.length === 0 ? [
|
|
123586
|
+
return inBrackets || segments.length === 0 ? [path68] : segments;
|
|
123523
123587
|
}
|
|
123524
123588
|
};
|
|
123525
123589
|
var INTEGER_PATTERN = /^0$|^[1-9]\d*$/;
|
|
@@ -124092,11 +124156,11 @@ var OpenAPISerializer = class {
|
|
|
124092
124156
|
return json2;
|
|
124093
124157
|
}
|
|
124094
124158
|
const form = new FormData();
|
|
124095
|
-
for (const [
|
|
124159
|
+
for (const [path68, value22] of this.bracketNotation.serialize(json2)) {
|
|
124096
124160
|
if (value22 instanceof Blob) {
|
|
124097
|
-
form.append(
|
|
124161
|
+
form.append(path68, value22);
|
|
124098
124162
|
} else if (value22 !== void 0 && value22 !== null) {
|
|
124099
|
-
form.append(
|
|
124163
|
+
form.append(path68, String(value22));
|
|
124100
124164
|
}
|
|
124101
124165
|
}
|
|
124102
124166
|
return form;
|
|
@@ -124134,30 +124198,30 @@ function isBodylessMethod(method) {
|
|
|
124134
124198
|
return method === "GET" || method === "HEAD";
|
|
124135
124199
|
}
|
|
124136
124200
|
var PARAMETER_NAME_REGEX = /^[\w-]+$/;
|
|
124137
|
-
function getDynamicPathParams(
|
|
124138
|
-
if (!
|
|
124201
|
+
function getDynamicPathParams(path68) {
|
|
124202
|
+
if (!path68.includes("{")) {
|
|
124139
124203
|
return void 0;
|
|
124140
124204
|
}
|
|
124141
|
-
const len =
|
|
124205
|
+
const len = path68.length;
|
|
124142
124206
|
let params;
|
|
124143
124207
|
let index = 1;
|
|
124144
124208
|
while (index < len) {
|
|
124145
124209
|
const segmentStart = index;
|
|
124146
|
-
const slashPos =
|
|
124210
|
+
const slashPos = path68.indexOf("/", index);
|
|
124147
124211
|
const segmentEnd = slashPos === -1 ? len : slashPos;
|
|
124148
|
-
if (segmentEnd > segmentStart &&
|
|
124212
|
+
if (segmentEnd > segmentStart && path68.charCodeAt(segmentStart) === 123 && path68.charCodeAt(segmentEnd - 1) === 125) {
|
|
124149
124213
|
let parameterStart = segmentStart + 1;
|
|
124150
124214
|
let allowsSlash = false;
|
|
124151
|
-
const operator =
|
|
124215
|
+
const operator = path68.charCodeAt(parameterStart);
|
|
124152
124216
|
if (operator === 43) {
|
|
124153
124217
|
allowsSlash = true;
|
|
124154
124218
|
parameterStart++;
|
|
124155
124219
|
}
|
|
124156
|
-
const parameterName =
|
|
124220
|
+
const parameterName = path68.slice(parameterStart, segmentEnd - 1);
|
|
124157
124221
|
if (PARAMETER_NAME_REGEX.test(parameterName)) {
|
|
124158
124222
|
params ??= [];
|
|
124159
124223
|
params.push({
|
|
124160
|
-
segment:
|
|
124224
|
+
segment: path68.slice(segmentStart, segmentEnd),
|
|
124161
124225
|
startIndex: segmentStart,
|
|
124162
124226
|
parameterName,
|
|
124163
124227
|
allowsSlash
|
|
@@ -124200,8 +124264,8 @@ openapi.method = (method) => ({
|
|
|
124200
124264
|
...openapi({ method }),
|
|
124201
124265
|
name: "~openapi/method"
|
|
124202
124266
|
});
|
|
124203
|
-
openapi.path = (
|
|
124204
|
-
...openapi({ path:
|
|
124267
|
+
openapi.path = (path68) => ({
|
|
124268
|
+
...openapi({ path: path68 }),
|
|
124205
124269
|
name: "~openapi/path"
|
|
124206
124270
|
});
|
|
124207
124271
|
openapi.spec = (spec) => ({
|
|
@@ -125062,22 +125126,22 @@ function visitJsonSchemaRefs(value2, visit2, schemaLevel = true, seen = /* @__PU
|
|
|
125062
125126
|
}
|
|
125063
125127
|
}
|
|
125064
125128
|
}
|
|
125065
|
-
function mapJsonSchemaRefs(value2, map2, schemaLevel = true,
|
|
125129
|
+
function mapJsonSchemaRefs(value2, map2, schemaLevel = true, path68 = []) {
|
|
125066
125130
|
if (!value2 || typeof value2 !== "object") {
|
|
125067
125131
|
return value2;
|
|
125068
125132
|
}
|
|
125069
125133
|
if (Array.isArray(value2)) {
|
|
125070
|
-
return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...
|
|
125134
|
+
return value2.map((item, index) => mapJsonSchemaRefs(item, map2, schemaLevel, [...path68, index]));
|
|
125071
125135
|
}
|
|
125072
125136
|
const result = {};
|
|
125073
125137
|
for (const key of Object.keys(value2)) {
|
|
125074
125138
|
const val = value2[key];
|
|
125075
125139
|
if (key === "$ref" && typeof val === "string") {
|
|
125076
|
-
setOwn(result, key, map2(val, [...
|
|
125140
|
+
setOwn(result, key, map2(val, [...path68, key]));
|
|
125077
125141
|
} else if (!schemaLevel) {
|
|
125078
|
-
setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...
|
|
125142
|
+
setOwn(result, key, mapJsonSchemaRefs(val, map2, true, [...path68, key]));
|
|
125079
125143
|
} else if (JSON_SCHEMA_LOGIC_KEYWORDS.has(key) || JSON_SCHEMA_RECORD_KEYWORDS.has(key)) {
|
|
125080
|
-
setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...
|
|
125144
|
+
setOwn(result, key, mapJsonSchemaRefs(val, map2, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path68, key]));
|
|
125081
125145
|
} else {
|
|
125082
125146
|
setOwn(result, key, val);
|
|
125083
125147
|
}
|
|
@@ -125607,7 +125671,7 @@ function unlazy(maybeLazy) {
|
|
|
125607
125671
|
function createProcedureClient(lazyableProcedure, ...rest) {
|
|
125608
125672
|
const options = resolveMaybeOptionalOptions(rest);
|
|
125609
125673
|
return async (...[input2, callerOptions]) => {
|
|
125610
|
-
const
|
|
125674
|
+
const path68 = toArray(options.path);
|
|
125611
125675
|
const { default: procedure } = await unlazy(lazyableProcedure);
|
|
125612
125676
|
const clientContext = callerOptions?.context ?? {};
|
|
125613
125677
|
const context = await value(options.context, clientContext) ?? {};
|
|
@@ -125620,7 +125684,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
125620
125684
|
};
|
|
125621
125685
|
try {
|
|
125622
125686
|
const output2 = await runWithSpan("call_procedure", (span) => {
|
|
125623
|
-
span?.setAttribute("procedure.path",
|
|
125687
|
+
span?.setAttribute("procedure.path", path68);
|
|
125624
125688
|
return intercept(
|
|
125625
125689
|
options.interceptors,
|
|
125626
125690
|
{
|
|
@@ -125628,7 +125692,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
125628
125692
|
// input can be optional if it is undefinable
|
|
125629
125693
|
input: input2,
|
|
125630
125694
|
errors,
|
|
125631
|
-
path:
|
|
125695
|
+
path: path68,
|
|
125632
125696
|
procedure,
|
|
125633
125697
|
signal: callerOptions?.signal,
|
|
125634
125698
|
lastEventId: callerOptions?.lastEventId
|
|
@@ -125879,10 +125943,10 @@ function augmentRouter(router, options) {
|
|
|
125879
125943
|
}
|
|
125880
125944
|
return enhanced;
|
|
125881
125945
|
}
|
|
125882
|
-
function getRouter(router,
|
|
125946
|
+
function getRouter(router, path68) {
|
|
125883
125947
|
let current = router;
|
|
125884
|
-
for (let i10 = 0; i10 <
|
|
125885
|
-
const segment =
|
|
125948
|
+
for (let i10 = 0; i10 < path68.length; i10++) {
|
|
125949
|
+
const segment = path68[i10];
|
|
125886
125950
|
if (!isTypescriptObject(current)) {
|
|
125887
125951
|
return void 0;
|
|
125888
125952
|
}
|
|
@@ -125894,7 +125958,7 @@ function getRouter(router, path67) {
|
|
|
125894
125958
|
continue;
|
|
125895
125959
|
}
|
|
125896
125960
|
const lazied = current;
|
|
125897
|
-
const rest =
|
|
125961
|
+
const rest = path68.slice(i10);
|
|
125898
125962
|
return new Lazy({
|
|
125899
125963
|
...lazied["~orpc"],
|
|
125900
125964
|
async loader() {
|
|
@@ -125909,40 +125973,40 @@ function getRouter(router, path67) {
|
|
|
125909
125973
|
}
|
|
125910
125974
|
return current;
|
|
125911
125975
|
}
|
|
125912
|
-
function walkProcedureContractsSync(router, callback,
|
|
125976
|
+
function walkProcedureContractsSync(router, callback, path68 = []) {
|
|
125913
125977
|
const lazyResults = [];
|
|
125914
|
-
walkProcedureContractsSyncInternal(router, callback,
|
|
125978
|
+
walkProcedureContractsSyncInternal(router, callback, path68.slice(), lazyResults);
|
|
125915
125979
|
return lazyResults;
|
|
125916
125980
|
}
|
|
125917
|
-
function walkProcedureContractsSyncInternal(router, callback,
|
|
125981
|
+
function walkProcedureContractsSyncInternal(router, callback, path68, lazyResults) {
|
|
125918
125982
|
const hiddenContract = getHiddenRouterContract(router);
|
|
125919
125983
|
if (hiddenContract !== void 0) {
|
|
125920
125984
|
router = hiddenContract;
|
|
125921
125985
|
}
|
|
125922
125986
|
if (router instanceof ProcedureContract) {
|
|
125923
|
-
callback(router,
|
|
125987
|
+
callback(router, path68.slice());
|
|
125924
125988
|
return;
|
|
125925
125989
|
}
|
|
125926
125990
|
if (!isTypescriptObject(router)) {
|
|
125927
125991
|
return;
|
|
125928
125992
|
}
|
|
125929
125993
|
for (const [key, value2] of Object.entries(router)) {
|
|
125930
|
-
|
|
125994
|
+
path68.push(key);
|
|
125931
125995
|
if (value2 instanceof Lazy) {
|
|
125932
|
-
lazyResults.push({ router: value2, path:
|
|
125996
|
+
lazyResults.push({ router: value2, path: path68.slice() });
|
|
125933
125997
|
} else {
|
|
125934
|
-
walkProcedureContractsSyncInternal(value2, callback,
|
|
125998
|
+
walkProcedureContractsSyncInternal(value2, callback, path68, lazyResults);
|
|
125935
125999
|
}
|
|
125936
|
-
|
|
126000
|
+
path68.pop();
|
|
125937
126001
|
}
|
|
125938
126002
|
}
|
|
125939
|
-
async function walkProcedureContractsAsync(router, callback,
|
|
126003
|
+
async function walkProcedureContractsAsync(router, callback, path68 = []) {
|
|
125940
126004
|
const hiddenContract = getHiddenRouterContract(router);
|
|
125941
126005
|
if (hiddenContract !== void 0) {
|
|
125942
126006
|
router = hiddenContract;
|
|
125943
126007
|
}
|
|
125944
126008
|
if (router instanceof ProcedureContract) {
|
|
125945
|
-
await callback(router,
|
|
126009
|
+
await callback(router, path68);
|
|
125946
126010
|
return;
|
|
125947
126011
|
}
|
|
125948
126012
|
if (!isTypescriptObject(router)) {
|
|
@@ -125951,9 +126015,9 @@ async function walkProcedureContractsAsync(router, callback, path67 = []) {
|
|
|
125951
126015
|
for (const [key, value2] of Object.entries(router)) {
|
|
125952
126016
|
if (value2 instanceof Lazy) {
|
|
125953
126017
|
const { default: router2 } = await unlazy(value2);
|
|
125954
|
-
await walkProcedureContractsAsync(router2, callback, [...
|
|
126018
|
+
await walkProcedureContractsAsync(router2, callback, [...path68, key]);
|
|
125955
126019
|
} else {
|
|
125956
|
-
await walkProcedureContractsAsync(value2, callback, [...
|
|
126020
|
+
await walkProcedureContractsAsync(value2, callback, [...path68, key]);
|
|
125957
126021
|
}
|
|
125958
126022
|
}
|
|
125959
126023
|
}
|
|
@@ -126439,18 +126503,18 @@ function rewriteComponentSchemaRefs(schema, renameMap) {
|
|
|
126439
126503
|
}
|
|
126440
126504
|
var OpenAPIGeneratorError = class extends TypeError {
|
|
126441
126505
|
};
|
|
126442
|
-
function toOpenAPIPath(
|
|
126506
|
+
function toOpenAPIPath(path68, dynamicPathParams) {
|
|
126443
126507
|
if (!dynamicPathParams?.length) {
|
|
126444
|
-
return
|
|
126508
|
+
return path68;
|
|
126445
126509
|
}
|
|
126446
126510
|
let normalized = "";
|
|
126447
126511
|
let currentIndex = 0;
|
|
126448
126512
|
for (const param of dynamicPathParams) {
|
|
126449
|
-
normalized +=
|
|
126513
|
+
normalized += path68.slice(currentIndex, param.startIndex);
|
|
126450
126514
|
normalized += `{${param.parameterName}}`;
|
|
126451
126515
|
currentIndex = param.startIndex + param.segment.length;
|
|
126452
126516
|
}
|
|
126453
|
-
normalized +=
|
|
126517
|
+
normalized += path68.slice(currentIndex);
|
|
126454
126518
|
return normalized;
|
|
126455
126519
|
}
|
|
126456
126520
|
function buildRequest(ctx, operation, def, meta3, dynamicPathParams) {
|
|
@@ -126884,8 +126948,8 @@ var OpenAPIGenerator = class {
|
|
|
126884
126948
|
customErrorResponseBodySchema: options.customErrorResponseBodySchema
|
|
126885
126949
|
};
|
|
126886
126950
|
const errors = [];
|
|
126887
|
-
await walkProcedureContractsAsync(router, (contract,
|
|
126888
|
-
if (value(options.filter, contract,
|
|
126951
|
+
await walkProcedureContractsAsync(router, (contract, path68) => {
|
|
126952
|
+
if (value(options.filter, contract, path68) === false) {
|
|
126889
126953
|
return;
|
|
126890
126954
|
}
|
|
126891
126955
|
try {
|
|
@@ -126897,7 +126961,7 @@ var OpenAPIGenerator = class {
|
|
|
126897
126961
|
`QUERY operations require OpenAPI 3.2, but version "${version2}" was requested.`
|
|
126898
126962
|
);
|
|
126899
126963
|
}
|
|
126900
|
-
const postPath = meta3?.path ?? pathToHttpPath(
|
|
126964
|
+
const postPath = meta3?.path ?? pathToHttpPath(path68);
|
|
126901
126965
|
const httpPath = meta3?.prefix ? mergeHttpPath(meta3.prefix, postPath) : postPath;
|
|
126902
126966
|
const dynamicPathParams = getDynamicPathParams(httpPath);
|
|
126903
126967
|
const openApiPath = toOpenAPIPath(httpPath, dynamicPathParams);
|
|
@@ -126906,7 +126970,7 @@ var OpenAPIGenerator = class {
|
|
|
126906
126970
|
operation = meta3.spec;
|
|
126907
126971
|
} else {
|
|
126908
126972
|
operation = {
|
|
126909
|
-
operationId: meta3?.operationId ??
|
|
126973
|
+
operationId: meta3?.operationId ?? path68.join("."),
|
|
126910
126974
|
summary: meta3?.summary,
|
|
126911
126975
|
description: meta3?.description,
|
|
126912
126976
|
deprecated: meta3?.deprecated,
|
|
@@ -126926,7 +126990,7 @@ var OpenAPIGenerator = class {
|
|
|
126926
126990
|
if (!(e14 instanceof OpenAPIGeneratorError)) {
|
|
126927
126991
|
throw e14;
|
|
126928
126992
|
}
|
|
126929
|
-
errors.push(`Procedure at ${
|
|
126993
|
+
errors.push(`Procedure at ${path68.join(".") || "(root)"}: ${e14.message}`);
|
|
126930
126994
|
}
|
|
126931
126995
|
});
|
|
126932
126996
|
if (errors.length) {
|
|
@@ -127628,15 +127692,15 @@ async function toStandardBody(re, options) {
|
|
|
127628
127692
|
throw new TypeError("Failed to read body: body stream already read");
|
|
127629
127693
|
}
|
|
127630
127694
|
if (hint === "json") {
|
|
127631
|
-
const
|
|
127632
|
-
return parseEmptyableJSON(
|
|
127695
|
+
const text4 = await re.text();
|
|
127696
|
+
return parseEmptyableJSON(text4);
|
|
127633
127697
|
}
|
|
127634
127698
|
if (hint === "form-data") {
|
|
127635
127699
|
return await re.formData();
|
|
127636
127700
|
}
|
|
127637
127701
|
if (hint === "url-search-params") {
|
|
127638
|
-
const
|
|
127639
|
-
return new URLSearchParams(
|
|
127702
|
+
const text4 = await re.text();
|
|
127703
|
+
return new URLSearchParams(text4);
|
|
127640
127704
|
}
|
|
127641
127705
|
if (hint === "event-stream") {
|
|
127642
127706
|
return toAsyncIteratorObject(re.body);
|
|
@@ -127773,16 +127837,16 @@ var StandardLink = class {
|
|
|
127773
127837
|
/**
|
|
127774
127838
|
* @throws ORPCError, transport-level errors (network failures, timeouts, etc.)
|
|
127775
127839
|
*/
|
|
127776
|
-
call(
|
|
127777
|
-
return runWithSpan(`${ORPC_NAME}.${
|
|
127840
|
+
call(path68, input2, options) {
|
|
127841
|
+
return runWithSpan(`${ORPC_NAME}.${path68.join("/")}`, (span) => {
|
|
127778
127842
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
127779
|
-
span?.setAttribute("rpc.method",
|
|
127843
|
+
span?.setAttribute("rpc.method", path68.join("."));
|
|
127780
127844
|
if (getTracer() && isAsyncIteratorObject(input2)) {
|
|
127781
127845
|
input2 = override(input2, traceAsyncIterator("consume_async_iterator_object_input", input2));
|
|
127782
127846
|
} else if (getTracer() && input2 instanceof ReadableStream) {
|
|
127783
127847
|
input2 = override(input2, traceReadableStream("consume_octet_stream_input", input2));
|
|
127784
127848
|
}
|
|
127785
|
-
return intercept(this.interceptors, { ...options, path:
|
|
127849
|
+
return intercept(this.interceptors, { ...options, path: path68, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
|
|
127786
127850
|
const tracer = getTracer();
|
|
127787
127851
|
const activeSpan = tracer?.getActiveSpan() ?? span;
|
|
127788
127852
|
let request7 = await runWithSpan(
|
|
@@ -127839,18 +127903,18 @@ var RPCLinkCodec = class {
|
|
|
127839
127903
|
this.headers = options.headers ?? {};
|
|
127840
127904
|
this.serializer = options.serializer ?? new RPCSerializer();
|
|
127841
127905
|
}
|
|
127842
|
-
async encodeInput(input2,
|
|
127843
|
-
let headers = toResolvedStandardHeaders(await value(this.headers, options,
|
|
127906
|
+
async encodeInput(input2, path68, options) {
|
|
127907
|
+
let headers = toResolvedStandardHeaders(await value(this.headers, options, path68, input2));
|
|
127844
127908
|
if (options.lastEventId !== void 0) {
|
|
127845
127909
|
headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
|
|
127846
127910
|
}
|
|
127847
|
-
const expectedMethod = await value(this.expectedMethod, options,
|
|
127848
|
-
const baseUrl = await value(this.baseUrl, options,
|
|
127911
|
+
const expectedMethod = await value(this.expectedMethod, options, path68, input2);
|
|
127912
|
+
const baseUrl = await value(this.baseUrl, options, path68, input2);
|
|
127849
127913
|
const [pathname, search, hash2] = parseStandardUrl(baseUrl);
|
|
127850
|
-
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(
|
|
127914
|
+
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path68)}`;
|
|
127851
127915
|
const serialized = this.serializer.serialize(input2);
|
|
127852
127916
|
if (expectedMethod === "GET" && !(serialized instanceof Blob) && !(serialized instanceof ReadableStream) && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
|
|
127853
|
-
const maxUrlLength = await value(this.maxUrlLength, options,
|
|
127917
|
+
const maxUrlLength = await value(this.maxUrlLength, options, path68, input2);
|
|
127854
127918
|
const mergedSearch = new URLSearchParams(search);
|
|
127855
127919
|
mergedSearch.append("data", stringifyJSON(serialized) ?? "");
|
|
127856
127920
|
const url22 = `${newPathname}?${mergedSearch}${hash2 ?? ""}`;
|
|
@@ -127935,8 +127999,8 @@ var FetchLinkTransport = class {
|
|
|
127935
127999
|
this.fetch = options.fetch ?? ((url2, init) => globalThis.fetch(url2, init));
|
|
127936
128000
|
this.toFetchRequestOptions = options.toFetchRequest;
|
|
127937
128001
|
}
|
|
127938
|
-
async send(standardRequest,
|
|
127939
|
-
let origin = await value(this.origin, options,
|
|
128002
|
+
async send(standardRequest, path68, options) {
|
|
128003
|
+
let origin = await value(this.origin, options, path68);
|
|
127940
128004
|
if (origin?.endsWith("/")) {
|
|
127941
128005
|
origin = origin.slice(0, -1);
|
|
127942
128006
|
}
|
|
@@ -127956,7 +128020,7 @@ var FetchLinkTransport = class {
|
|
|
127956
128020
|
}
|
|
127957
128021
|
}
|
|
127958
128022
|
const fetch3 = this.fetch;
|
|
127959
|
-
const response = await fetch3(url2, init, options,
|
|
128023
|
+
const response = await fetch3(url2, init, options, path68);
|
|
127960
128024
|
const standardResponse = toStandardLazyResponse(response);
|
|
127961
128025
|
return standardResponse;
|
|
127962
128026
|
}
|
|
@@ -128112,16 +128176,16 @@ async function toStandardBody2(req, options = {}) {
|
|
|
128112
128176
|
throw new TypeError("Failed to read body: body stream already read or destroyed");
|
|
128113
128177
|
}
|
|
128114
128178
|
if (hint === "json") {
|
|
128115
|
-
const
|
|
128116
|
-
return parseEmptyableJSON(
|
|
128179
|
+
const text4 = await _streamToString(req);
|
|
128180
|
+
return parseEmptyableJSON(text4);
|
|
128117
128181
|
}
|
|
128118
128182
|
const contentType = req.headers["content-type"];
|
|
128119
128183
|
if (hint === "form-data") {
|
|
128120
128184
|
return _streamToFormData(req, contentType);
|
|
128121
128185
|
}
|
|
128122
128186
|
if (hint === "url-search-params") {
|
|
128123
|
-
const
|
|
128124
|
-
return new URLSearchParams(
|
|
128187
|
+
const text4 = await _streamToString(req);
|
|
128188
|
+
return new URLSearchParams(text4);
|
|
128125
128189
|
}
|
|
128126
128190
|
if (hint === "event-stream") {
|
|
128127
128191
|
return toAsyncIteratorObject2(req);
|
|
@@ -128347,14 +128411,14 @@ var StandardHandler = class {
|
|
|
128347
128411
|
span?.setAttribute("url.path", request22.url);
|
|
128348
128412
|
return { matched: false };
|
|
128349
128413
|
}
|
|
128350
|
-
const { path:
|
|
128351
|
-
span?.updateName(`${ORPC_NAME}.${
|
|
128414
|
+
const { path: path68, procedure, decodeInput } = matchedOrNot;
|
|
128415
|
+
span?.updateName(`${ORPC_NAME}.${path68.join("/")}`);
|
|
128352
128416
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
128353
|
-
span?.setAttribute("rpc.method",
|
|
128417
|
+
span?.setAttribute("rpc.method", path68.join("."));
|
|
128354
128418
|
try {
|
|
128355
128419
|
const response = await intercept(
|
|
128356
128420
|
this.interceptors,
|
|
128357
|
-
{ context: context2, prefix: prefix2, request: request22, path:
|
|
128421
|
+
{ context: context2, prefix: prefix2, request: request22, path: path68, procedure, decodeInput },
|
|
128358
128422
|
async ({ context: context3, prefix: prefix3, request: request32, path: path210, procedure: procedure2, decodeInput: decodeInput2 }) => {
|
|
128359
128423
|
step2 = "decode_input";
|
|
128360
128424
|
let input2 = await runWithSpan("decode_input", decodeInput2);
|
|
@@ -128388,7 +128452,7 @@ var StandardHandler = class {
|
|
|
128388
128452
|
message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
|
|
128389
128453
|
cause: e14
|
|
128390
128454
|
}) : toORPCError(e14);
|
|
128391
|
-
const response = await this.codec.encodeError(error63, procedure,
|
|
128455
|
+
const response = await this.codec.encodeError(error63, procedure, path68, { context: context2, prefix: prefix2 });
|
|
128392
128456
|
return { matched: true, response };
|
|
128393
128457
|
}
|
|
128394
128458
|
}
|
|
@@ -128494,7 +128558,7 @@ var RPCMatcher = class {
|
|
|
128494
128558
|
this.rootRouter = router;
|
|
128495
128559
|
this.index(router);
|
|
128496
128560
|
}
|
|
128497
|
-
index(router,
|
|
128561
|
+
index(router, path68 = []) {
|
|
128498
128562
|
const lazyResults = walkProcedureContractsSync(router, (procedure, procedurePath) => {
|
|
128499
128563
|
if (!value(this.filter, procedure, procedurePath)) {
|
|
128500
128564
|
return;
|
|
@@ -128505,7 +128569,7 @@ var RPCMatcher = class {
|
|
|
128505
128569
|
// contract-first entries have no implementation yet, resolveProcedure fills it in on demand
|
|
128506
128570
|
procedure: procedure instanceof Procedure ? procedure : void 0
|
|
128507
128571
|
});
|
|
128508
|
-
},
|
|
128572
|
+
}, path68);
|
|
128509
128573
|
for (const result of lazyResults) {
|
|
128510
128574
|
this.pendingLazyRouters.set(pathToHttpPath(result.path), result);
|
|
128511
128575
|
}
|
|
@@ -128637,10 +128701,10 @@ var RPCHandlerCodec = class {
|
|
|
128637
128701
|
}
|
|
128638
128702
|
};
|
|
128639
128703
|
}
|
|
128640
|
-
encodeOutput(output2, procedure,
|
|
128704
|
+
encodeOutput(output2, procedure, path68, options) {
|
|
128641
128705
|
return {
|
|
128642
128706
|
headers: {},
|
|
128643
|
-
status: value(this.outputStatus, output2, procedure,
|
|
128707
|
+
status: value(this.outputStatus, output2, procedure, path68, options) ?? DEFAULT_SUCCESS_STATUS,
|
|
128644
128708
|
body: this.serializer.serialize(output2)
|
|
128645
128709
|
};
|
|
128646
128710
|
}
|
|
@@ -128694,39 +128758,39 @@ function createRouter() {
|
|
|
128694
128758
|
static: new NullProtoObj2()
|
|
128695
128759
|
};
|
|
128696
128760
|
}
|
|
128697
|
-
function scanFirstGroup(
|
|
128761
|
+
function scanFirstGroup(path68) {
|
|
128698
128762
|
let i10 = 0;
|
|
128699
128763
|
let depth = 0;
|
|
128700
|
-
for (; i10 <
|
|
128701
|
-
const c10 =
|
|
128764
|
+
for (; i10 < path68.length; i10++) {
|
|
128765
|
+
const c10 = path68.charCodeAt(i10);
|
|
128702
128766
|
if (c10 === 92) i10++;
|
|
128703
128767
|
else if (c10 === 40) depth++;
|
|
128704
128768
|
else if (c10 === 41 && depth > 0) depth--;
|
|
128705
128769
|
else if (c10 === 123 && depth === 0) break;
|
|
128706
128770
|
}
|
|
128707
|
-
if (i10 >=
|
|
128771
|
+
if (i10 >= path68.length) return;
|
|
128708
128772
|
let j10 = i10 + 1;
|
|
128709
128773
|
depth = 0;
|
|
128710
|
-
for (; j10 <
|
|
128711
|
-
const c10 =
|
|
128774
|
+
for (; j10 < path68.length; j10++) {
|
|
128775
|
+
const c10 = path68.charCodeAt(j10);
|
|
128712
128776
|
if (c10 === 92) j10++;
|
|
128713
128777
|
else if (c10 === 40) depth++;
|
|
128714
128778
|
else if (c10 === 41 && depth > 0) depth--;
|
|
128715
128779
|
else if (c10 === 125 && depth === 0) break;
|
|
128716
128780
|
}
|
|
128717
|
-
if (j10 >=
|
|
128718
|
-
const mod =
|
|
128781
|
+
if (j10 >= path68.length) return;
|
|
128782
|
+
const mod = path68[j10 + 1];
|
|
128719
128783
|
const hasMod = mod === "?" || mod === "+" || mod === "*";
|
|
128720
128784
|
return [
|
|
128721
|
-
|
|
128722
|
-
|
|
128723
|
-
|
|
128785
|
+
path68.slice(0, i10),
|
|
128786
|
+
path68.slice(i10 + 1, j10),
|
|
128787
|
+
path68.slice(j10 + (hasMod ? 2 : 1)),
|
|
128724
128788
|
hasMod ? mod : void 0
|
|
128725
128789
|
];
|
|
128726
128790
|
}
|
|
128727
|
-
function expandGroupDelimiters(
|
|
128728
|
-
if (!
|
|
128729
|
-
const group = scanFirstGroup(
|
|
128791
|
+
function expandGroupDelimiters(path68) {
|
|
128792
|
+
if (!path68.includes("{")) return;
|
|
128793
|
+
const group = scanFirstGroup(path68);
|
|
128730
128794
|
if (!group) return;
|
|
128731
128795
|
const [pre2, body, suf, mod] = group;
|
|
128732
128796
|
if (!mod) return [pre2 + body + suf];
|
|
@@ -128796,9 +128860,9 @@ function replaceSegmentWildcards(segment, unnamedStart, toGroupKey = toUnnamedGr
|
|
|
128796
128860
|
}
|
|
128797
128861
|
return [replaced, nextIndex];
|
|
128798
128862
|
}
|
|
128799
|
-
function encodeEscapes(
|
|
128800
|
-
if (!
|
|
128801
|
-
return
|
|
128863
|
+
function encodeEscapes(path68) {
|
|
128864
|
+
if (!path68.includes("\\")) return path68;
|
|
128865
|
+
return path68.replace(/\\([:(){}])/g, (_, c10) => "\uFFFD" + "ABCDE"[":(){}".indexOf(c10)]);
|
|
128802
128866
|
}
|
|
128803
128867
|
function segmentKey(segment) {
|
|
128804
128868
|
if (segment.startsWith("**")) return 2;
|
|
@@ -128827,22 +128891,22 @@ function expandModifiers(segments) {
|
|
|
128827
128891
|
return m10[2] === "+" ? [wc2] : [wc2, without];
|
|
128828
128892
|
}
|
|
128829
128893
|
}
|
|
128830
|
-
function normalizePath(
|
|
128831
|
-
if (!
|
|
128894
|
+
function normalizePath(path68) {
|
|
128895
|
+
if (!path68.includes("/.")) return path68;
|
|
128832
128896
|
const r10 = [];
|
|
128833
|
-
for (const s of
|
|
128897
|
+
for (const s of path68.split("/")) if (s === ".") continue;
|
|
128834
128898
|
else if (s === ".." && r10.length > 1) r10.pop();
|
|
128835
128899
|
else r10.push(s);
|
|
128836
128900
|
return r10.join("/") || "/";
|
|
128837
128901
|
}
|
|
128838
|
-
function splitPath(
|
|
128839
|
-
const s =
|
|
128902
|
+
function splitPath(path68) {
|
|
128903
|
+
const s = path68.split("/");
|
|
128840
128904
|
s.shift();
|
|
128841
128905
|
if (s[s.length - 1] === "") s.pop();
|
|
128842
128906
|
return s;
|
|
128843
128907
|
}
|
|
128844
|
-
function splitRoute(
|
|
128845
|
-
const s = splitPath(
|
|
128908
|
+
function splitRoute(path68) {
|
|
128909
|
+
const s = splitPath(path68);
|
|
128846
128910
|
while (s[s.length - 1] === "") s.pop();
|
|
128847
128911
|
return s;
|
|
128848
128912
|
}
|
|
@@ -128858,16 +128922,16 @@ function getMatchParams(segments, paramsMap) {
|
|
|
128858
128922
|
}
|
|
128859
128923
|
return params;
|
|
128860
128924
|
}
|
|
128861
|
-
function addRoute(ctx, method = "",
|
|
128925
|
+
function addRoute(ctx, method = "", path68, data) {
|
|
128862
128926
|
method = method.toUpperCase();
|
|
128863
|
-
if (
|
|
128864
|
-
const groupExpanded = expandGroupDelimiters(
|
|
128927
|
+
if (path68.charCodeAt(0) !== 47) path68 = `/${path68}`;
|
|
128928
|
+
const groupExpanded = expandGroupDelimiters(path68);
|
|
128865
128929
|
if (groupExpanded) {
|
|
128866
128930
|
for (const expandedPath of groupExpanded) addRoute(ctx, method, expandedPath, data);
|
|
128867
128931
|
return;
|
|
128868
128932
|
}
|
|
128869
|
-
|
|
128870
|
-
const segments = splitRoute(
|
|
128933
|
+
path68 = encodeEscapes(path68);
|
|
128934
|
+
const segments = splitRoute(path68);
|
|
128871
128935
|
const expanded = expandModifiers(segments);
|
|
128872
128936
|
if (expanded) {
|
|
128873
128937
|
for (const p of expanded) addRoute(ctx, method, p, data);
|
|
@@ -128958,15 +129022,15 @@ function getParamRegexp(segment, unnamedStart = 0) {
|
|
|
128958
129022
|
const regex = _s2.replace(/:([\w-]+)(?:\(([^)]*)\))?/g, (_, id2, p) => `(?<${toGroupName(id2)}>${p || "[^/]+"})`).replace(/\((?![?<])/g, () => `(?<${toUnnamedGroupKey(_i2++)}>`).replace(/\uFFFE(.)/g, (_, c10) => /[.*+?^${}()|[\]\\]/.test(c10) ? `\\${c10}` : c10);
|
|
128959
129023
|
return [new RegExp(`^${regex}$`), _i2];
|
|
128960
129024
|
}
|
|
128961
|
-
function findRoute(ctx, method = "",
|
|
128962
|
-
if (opts?.normalize)
|
|
128963
|
-
if (
|
|
128964
|
-
const staticNode = ctx.static[
|
|
129025
|
+
function findRoute(ctx, method = "", path68, opts) {
|
|
129026
|
+
if (opts?.normalize) path68 = normalizePath(path68);
|
|
129027
|
+
if (path68.charCodeAt(path68.length - 1) === 47) path68 = path68.slice(0, -1);
|
|
129028
|
+
const staticNode = ctx.static[path68];
|
|
128965
129029
|
if (staticNode && staticNode.methods) {
|
|
128966
129030
|
const staticMatch = staticNode.methods[method] || staticNode.methods[""];
|
|
128967
129031
|
if (staticMatch !== void 0) return staticMatch[0];
|
|
128968
129032
|
}
|
|
128969
|
-
const segments = splitPath(
|
|
129033
|
+
const segments = splitPath(path68);
|
|
128970
129034
|
const match = _lookupTree(ctx.root, method, segments, 0);
|
|
128971
129035
|
if (match === void 0) return;
|
|
128972
129036
|
if (opts?.params === false) return match;
|
|
@@ -129166,7 +129230,7 @@ var OpenAPIMatcher = class {
|
|
|
129166
129230
|
this.rootRouter = router;
|
|
129167
129231
|
this.index(router);
|
|
129168
129232
|
}
|
|
129169
|
-
index(router,
|
|
129233
|
+
index(router, path68 = []) {
|
|
129170
129234
|
const lazyResults = walkProcedureContractsSync(router, (contract, path210) => {
|
|
129171
129235
|
if (!value(this.filter, contract, path210)) {
|
|
129172
129236
|
return;
|
|
@@ -129181,7 +129245,7 @@ var OpenAPIMatcher = class {
|
|
|
129181
129245
|
contract,
|
|
129182
129246
|
procedure: contract instanceof Procedure ? contract : void 0
|
|
129183
129247
|
});
|
|
129184
|
-
},
|
|
129248
|
+
}, path68);
|
|
129185
129249
|
for (const result of lazyResults) {
|
|
129186
129250
|
const prefix = getOpenAPIMeta(result.router)?.prefix;
|
|
129187
129251
|
this.pendingLazyRouters.add({
|
|
@@ -129268,20 +129332,20 @@ var OpenAPIMatcher = class {
|
|
|
129268
129332
|
return entry.procedure;
|
|
129269
129333
|
}
|
|
129270
129334
|
};
|
|
129271
|
-
function toRou3Pattern(
|
|
129272
|
-
const params = getDynamicPathParams(
|
|
129335
|
+
function toRou3Pattern(path68) {
|
|
129336
|
+
const params = getDynamicPathParams(path68);
|
|
129273
129337
|
if (!params?.length) {
|
|
129274
|
-
return
|
|
129338
|
+
return path68;
|
|
129275
129339
|
}
|
|
129276
129340
|
for (let i10 = params.length - 1; i10 >= 0; i10--) {
|
|
129277
129341
|
const param = params[i10];
|
|
129278
129342
|
const pattern = param.allowsSlash ? `**:${param.parameterName}` : `:${param.parameterName}`;
|
|
129279
|
-
|
|
129343
|
+
path68 = path68.slice(0, param.startIndex) + pattern + path68.slice(param.startIndex + param.segment.length);
|
|
129280
129344
|
}
|
|
129281
|
-
return
|
|
129345
|
+
return path68;
|
|
129282
129346
|
}
|
|
129283
|
-
function toRou3PrefixMatcher(
|
|
129284
|
-
const pattern = toRou3Pattern(
|
|
129347
|
+
function toRou3PrefixMatcher(path68) {
|
|
129348
|
+
const pattern = toRou3Pattern(path68);
|
|
129285
129349
|
return routeToRegExp(pattern === "/" ? "/**" : `${pattern}/**`);
|
|
129286
129350
|
}
|
|
129287
129351
|
function decodeParams(params) {
|
|
@@ -129360,7 +129424,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
129360
129424
|
/**
|
|
129361
129425
|
* @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
|
|
129362
129426
|
*/
|
|
129363
|
-
encodeOutput(output2, procedure,
|
|
129427
|
+
encodeOutput(output2, procedure, path68) {
|
|
129364
129428
|
const meta3 = getOpenAPIMeta(procedure);
|
|
129365
129429
|
const successStatus = meta3?.successStatus ?? DEFAULT_SUCCESS_STATUS;
|
|
129366
129430
|
const outputStructure = meta3?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
|
|
@@ -129373,7 +129437,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
129373
129437
|
}
|
|
129374
129438
|
if (!isValidDetailedOutput(output2)) {
|
|
129375
129439
|
throw new TypeError(`
|
|
129376
|
-
Invalid "detailed" output structure returned by procedure (${
|
|
129440
|
+
Invalid "detailed" output structure returned by procedure (${path68.join(".")}):
|
|
129377
129441
|
\u2022 Expected an object with optional properties:
|
|
129378
129442
|
- status (number <400)
|
|
129379
129443
|
- headers (object)
|
|
@@ -129941,7 +130005,7 @@ function profileValue(name, paths) {
|
|
|
129941
130005
|
function createConfigApiRouter(deps) {
|
|
129942
130006
|
const authed = doorApiAuth(deps.expectedToken);
|
|
129943
130007
|
const { paths } = deps;
|
|
129944
|
-
const route = (
|
|
130008
|
+
const route = (path68, summary) => authed.meta(openapi({ method: "POST", path: path68, summary, tags: [CONFIG_API_TAG] }));
|
|
129945
130009
|
return {
|
|
129946
130010
|
config: {
|
|
129947
130011
|
identity: {
|
|
@@ -130903,16 +130967,16 @@ function walk2(body, hashing, parentAfter) {
|
|
|
130903
130967
|
continue;
|
|
130904
130968
|
}
|
|
130905
130969
|
const isKey = kind === STRING && depth >= 1 && expectKey[depth - 1] === true;
|
|
130906
|
-
const
|
|
130907
|
-
if (isKey &&
|
|
130970
|
+
const text4 = isKey ? body.toString("latin1", start, end) : void 0;
|
|
130971
|
+
if (isKey && text4 === CACHE_MARKER_KEY) {
|
|
130908
130972
|
skipNextValue = true;
|
|
130909
130973
|
continue;
|
|
130910
130974
|
}
|
|
130911
130975
|
if (depth === 1 && isKey) {
|
|
130912
|
-
topKey =
|
|
130976
|
+
topKey = text4;
|
|
130913
130977
|
}
|
|
130914
130978
|
const closesMessages = kind === CLOSE && inMessages && depth === MESSAGES_ARRAY_DEPTH;
|
|
130915
|
-
if (hashing && !closesMessages && !(depth === 1 && isKey && !THREAD_MEMBER_KEYS.has(
|
|
130979
|
+
if (hashing && !closesMessages && !(depth === 1 && isKey && !THREAD_MEMBER_KEYS.has(text4 ?? ""))) {
|
|
130916
130980
|
const target = inMessages ? messages : depth >= 1 && topKey !== void 0 && THREAD_MEMBER_KEYS.has(topKey) ? thread : void 0;
|
|
130917
130981
|
if (target !== void 0) {
|
|
130918
130982
|
target.update(body.subarray(start, end));
|
|
@@ -131882,8 +131946,8 @@ function createCodexRoute(ports) {
|
|
|
131882
131946
|
if (!parsed.success) {
|
|
131883
131947
|
return errorResponse(HTTP_STATUS.badRequest, "not a count_tokens request");
|
|
131884
131948
|
}
|
|
131885
|
-
const
|
|
131886
|
-
return { status: HTTP_STATUS.ok, headers: { "Content-Type": "application/json" }, body: JSON.stringify({ input_tokens: Math.ceil(
|
|
131949
|
+
const text4 = JSON.stringify({ system: parsed.data.system, messages: parsed.data.messages, tools: parsed.data.tools });
|
|
131950
|
+
return { status: HTTP_STATUS.ok, headers: { "Content-Type": "application/json" }, body: JSON.stringify({ input_tokens: Math.ceil(text4.length / CHARS_PER_TOKEN) }) };
|
|
131887
131951
|
};
|
|
131888
131952
|
return async (request7) => {
|
|
131889
131953
|
if (request7.method === "GET" && request7.path === "/healthz") {
|
|
@@ -131966,8 +132030,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
|
|
|
131966
132030
|
request7.body.resume();
|
|
131967
132031
|
return;
|
|
131968
132032
|
}
|
|
131969
|
-
const
|
|
131970
|
-
const translated = { method: request7.method, path:
|
|
132033
|
+
const path68 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
132034
|
+
const translated = { method: request7.method, path: path68, body, signal: request7.signal };
|
|
131971
132035
|
const routed = await route(translated);
|
|
131972
132036
|
if (request7.signal.aborted) {
|
|
131973
132037
|
return;
|
|
@@ -132588,8 +132652,8 @@ function createAntigravityRouteMount(ports, upstreamBase, provider) {
|
|
|
132588
132652
|
request7.body.resume();
|
|
132589
132653
|
return;
|
|
132590
132654
|
}
|
|
132591
|
-
const
|
|
132592
|
-
const translated = { method: request7.method, path:
|
|
132655
|
+
const path68 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
132656
|
+
const translated = { method: request7.method, path: path68, body, signal: request7.signal };
|
|
132593
132657
|
const routed = await route(translated);
|
|
132594
132658
|
if (request7.signal.aborted) {
|
|
132595
132659
|
return;
|
|
@@ -132630,7 +132694,7 @@ function createPassthroughRoute(name, target) {
|
|
|
132630
132694
|
headroomUpstream: target.headroomUpstream,
|
|
132631
132695
|
serve: async (request7, response) => {
|
|
132632
132696
|
const incoming = new URL(request7.url, "http://127.0.0.1");
|
|
132633
|
-
const
|
|
132697
|
+
const path68 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
|
|
132634
132698
|
const headers = forwardableHeaders(request7.headers);
|
|
132635
132699
|
delete headers.host;
|
|
132636
132700
|
await new Promise((resolve2) => {
|
|
@@ -132638,7 +132702,7 @@ function createPassthroughRoute(name, target) {
|
|
|
132638
132702
|
host: base.hostname,
|
|
132639
132703
|
port: base.port === "" ? void 0 : Number(base.port),
|
|
132640
132704
|
method: request7.method,
|
|
132641
|
-
path: `${basePath}${
|
|
132705
|
+
path: `${basePath}${path68}${incoming.search}`,
|
|
132642
132706
|
headers,
|
|
132643
132707
|
agent
|
|
132644
132708
|
};
|
|
@@ -132744,28 +132808,28 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
132744
132808
|
const body = request7.body;
|
|
132745
132809
|
const head = [];
|
|
132746
132810
|
let seen = 0;
|
|
132747
|
-
let
|
|
132811
|
+
let text4 = "";
|
|
132748
132812
|
let decided = false;
|
|
132749
132813
|
let ended = false;
|
|
132750
132814
|
let error63;
|
|
132751
132815
|
const replay = new import_node_stream2.PassThrough();
|
|
132752
|
-
const modelIn = () => /"model"\s*:\s*"([^"]+)"/.exec(
|
|
132816
|
+
const modelIn = () => /"model"\s*:\s*"([^"]+)"/.exec(text4)?.[1];
|
|
132753
132817
|
const settled = new Promise((resolve2) => {
|
|
132754
132818
|
const settle2 = () => {
|
|
132755
132819
|
const model = modelIn();
|
|
132756
|
-
const hasImage = /"type"\s*:\s*"image"/.test(
|
|
132820
|
+
const hasImage = /"type"\s*:\s*"image"/.test(text4);
|
|
132757
132821
|
for (const chunk2 of head) {
|
|
132758
132822
|
replay.write(chunk2);
|
|
132759
132823
|
}
|
|
132760
|
-
const maxTokens = /"max_tokens"\s*:\s*([0-9]+)/.exec(
|
|
132824
|
+
const maxTokens = /"max_tokens"\s*:\s*([0-9]+)/.exec(text4)?.[1];
|
|
132761
132825
|
resolve2({
|
|
132762
132826
|
...model === void 0 ? {} : { model },
|
|
132763
132827
|
hasImage,
|
|
132764
|
-
toolsPresent: /"tools"\s*:\s*\[\s*\{/.test(
|
|
132765
|
-
thinking: /"thinking"\s*:\s*\{\s*"type"\s*:\s*"enabled"/.test(
|
|
132828
|
+
toolsPresent: /"tools"\s*:\s*\[\s*\{/.test(text4),
|
|
132829
|
+
thinking: /"thinking"\s*:\s*\{\s*"type"\s*:\s*"enabled"/.test(text4),
|
|
132766
132830
|
...maxTokens === void 0 ? {} : { maxTokens: Number(maxTokens) },
|
|
132767
132831
|
isCountTokens: request7.url.includes("/v1/messages/count_tokens"),
|
|
132768
|
-
...wholeBody ? { whole: true, text:
|
|
132832
|
+
...wholeBody ? { whole: true, text: text4 } : {},
|
|
132769
132833
|
replayed: { ...request7, body: replay }
|
|
132770
132834
|
});
|
|
132771
132835
|
};
|
|
@@ -132781,7 +132845,7 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
132781
132845
|
}
|
|
132782
132846
|
head.push(chunk2);
|
|
132783
132847
|
seen += chunk2.length;
|
|
132784
|
-
|
|
132848
|
+
text4 += chunk2.toString("utf8");
|
|
132785
132849
|
if (!wholeBody && (modelIn() !== void 0 || seen >= REQUEST_SCAN_CAP_BYTES)) {
|
|
132786
132850
|
decided = true;
|
|
132787
132851
|
settle2();
|
|
@@ -132810,13 +132874,13 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
132810
132874
|
}
|
|
132811
132875
|
|
|
132812
132876
|
// src/frontdoor/providerRoute.ts
|
|
132813
|
-
var isRcSelfHostPath = (
|
|
132877
|
+
var isRcSelfHostPath = (path68) => path68 === "/v1/code/sessions" || path68.startsWith("/v1/code/sessions/") || path68 === "/v1/sessions" || path68.startsWith("/v1/sessions/");
|
|
132814
132878
|
function scopeSessionProviderPath(request7) {
|
|
132815
132879
|
if (request7.session.provider === void 0) {
|
|
132816
132880
|
return request7;
|
|
132817
132881
|
}
|
|
132818
|
-
const
|
|
132819
|
-
if (!
|
|
132882
|
+
const path68 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
132883
|
+
if (!path68.startsWith("/v1/") || isRcSelfHostPath(path68)) {
|
|
132820
132884
|
return request7;
|
|
132821
132885
|
}
|
|
132822
132886
|
return { ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` };
|
|
@@ -132939,13 +133003,13 @@ function createProviderRouteResolver(deps) {
|
|
|
132939
133003
|
return route;
|
|
132940
133004
|
};
|
|
132941
133005
|
const resolve2 = (request7) => {
|
|
132942
|
-
const
|
|
132943
|
-
const scoped = parseProviderPath(
|
|
133006
|
+
const path68 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
133007
|
+
const scoped = parseProviderPath(path68);
|
|
132944
133008
|
if (scoped === void 0) {
|
|
132945
|
-
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(
|
|
133009
|
+
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path68)) {
|
|
132946
133010
|
return { ok: true, route: deps.rcSelfHostRoute };
|
|
132947
133011
|
}
|
|
132948
|
-
return
|
|
133012
|
+
return path68.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path68}` };
|
|
132949
133013
|
}
|
|
132950
133014
|
const { provider } = scoped;
|
|
132951
133015
|
let definition;
|
|
@@ -133037,8 +133101,8 @@ function createProviderRouteResolver(deps) {
|
|
|
133037
133101
|
let modelChoice;
|
|
133038
133102
|
const visited = /* @__PURE__ */ new Set();
|
|
133039
133103
|
for (; ; ) {
|
|
133040
|
-
const
|
|
133041
|
-
const scoped = parseProviderPath(
|
|
133104
|
+
const path68 = new URL(current.url, "http://127.0.0.1").pathname;
|
|
133105
|
+
const scoped = parseProviderPath(path68);
|
|
133042
133106
|
const providerName = scoped?.provider ?? current.session.provider;
|
|
133043
133107
|
if (providerName !== void 0 && visited.has(providerName)) {
|
|
133044
133108
|
return { ok: false, status: HTTP_STATUS.internalServerError, message: `provider routing cycle: ${[...visited, providerName].join(" -> ")}` };
|
|
@@ -133053,7 +133117,7 @@ function createProviderRouteResolver(deps) {
|
|
|
133053
133117
|
} catch {
|
|
133054
133118
|
routes = void 0;
|
|
133055
133119
|
}
|
|
133056
|
-
const resolvesNames = !nameResolved && !isRcSelfHostPath(
|
|
133120
|
+
const resolvesNames = !nameResolved && !isRcSelfHostPath(path68);
|
|
133057
133121
|
if (resolvesNames) {
|
|
133058
133122
|
const scan2 = await scanRequestHead(current, true);
|
|
133059
133123
|
if (scan2.replayed === void 0) {
|
|
@@ -133092,7 +133156,7 @@ function createProviderRouteResolver(deps) {
|
|
|
133092
133156
|
}
|
|
133093
133157
|
if (routed.provider !== providerName) {
|
|
133094
133158
|
const scopedPrefix = providerName === void 0 ? void 0 : `${PROVIDER_PATH_PREFIX}${encodeURIComponent(providerName)}`;
|
|
133095
|
-
const rest2 = scopedPrefix !== void 0 &&
|
|
133159
|
+
const rest2 = scopedPrefix !== void 0 && path68.startsWith(scopedPrefix) ? path68.slice(scopedPrefix.length) : path68;
|
|
133096
133160
|
const query2 = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
|
|
133097
133161
|
const carried = replay;
|
|
133098
133162
|
current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(routed.provider)}${rest2}${query2}`, body: carried.body, headers: carried.headers };
|
|
@@ -133146,7 +133210,7 @@ function createProviderRouteResolver(deps) {
|
|
|
133146
133210
|
const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
|
|
133147
133211
|
replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
|
|
133148
133212
|
}
|
|
133149
|
-
const rest = scoped === void 0 ?
|
|
133213
|
+
const rest = scoped === void 0 ? path68 : path68.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
|
|
133150
133214
|
const query = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
|
|
133151
133215
|
current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(matched.provider)}${rest}${query}`, body: replay.body, headers: replay.headers };
|
|
133152
133216
|
}
|
|
@@ -133284,9 +133348,9 @@ function growthBookFeatures() {
|
|
|
133284
133348
|
};
|
|
133285
133349
|
}
|
|
133286
133350
|
var answerServerJson = (response, status, body) => {
|
|
133287
|
-
const
|
|
133288
|
-
response.writeHead(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(
|
|
133289
|
-
response.end(
|
|
133351
|
+
const text4 = JSON.stringify(body);
|
|
133352
|
+
response.writeHead(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(text4, "utf8")) });
|
|
133353
|
+
response.end(text4);
|
|
133290
133354
|
};
|
|
133291
133355
|
function createRcSelfHostLocal(deps) {
|
|
133292
133356
|
return {
|
|
@@ -133497,8 +133561,8 @@ function formatRcPendingList(pending) {
|
|
|
133497
133561
|
}
|
|
133498
133562
|
return pending.map((request7) => `${request7.sessionId} ${request7.requestId} ${request7.type}${request7.summary === "" ? "" : ` ${request7.summary}`} observed ${new Date(request7.observedAt).toISOString()}`);
|
|
133499
133563
|
}
|
|
133500
|
-
function eventExcerpt(
|
|
133501
|
-
return
|
|
133564
|
+
function eventExcerpt(text4) {
|
|
133565
|
+
return text4.length <= RC_PENDING_SUMMARY_EXCERPT_CHARS ? text4 : `${text4.slice(0, RC_PENDING_SUMMARY_EXCERPT_CHARS)}...`;
|
|
133502
133566
|
}
|
|
133503
133567
|
var PERCENT_SCALE = 100;
|
|
133504
133568
|
var MS_PER_SECOND14 = 1e3;
|
|
@@ -135197,9 +135261,9 @@ data: ${JSON.stringify(envelope)}
|
|
|
135197
135261
|
};
|
|
135198
135262
|
const sessionRow = (session) => ({ id: session.id, title: session.title, created_at: new Date(session.createdAt).toISOString(), status: "active", conversation_id: session.conversation.id });
|
|
135199
135263
|
const answerJson2 = async (response, status, body, extraHeaders = {}) => {
|
|
135200
|
-
const
|
|
135201
|
-
response.start(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(
|
|
135202
|
-
await response.write(
|
|
135264
|
+
const text4 = JSON.stringify(body);
|
|
135265
|
+
response.start(status, { "content-type": "application/json", "content-length": String(Buffer.byteLength(text4, "utf8")), ...extraHeaders });
|
|
135266
|
+
await response.write(text4);
|
|
135203
135267
|
response.end();
|
|
135204
135268
|
};
|
|
135205
135269
|
const noCredential = async (response) => {
|
|
@@ -135601,8 +135665,8 @@ function createSseParser() {
|
|
|
135601
135665
|
let dataLines = [];
|
|
135602
135666
|
let seenAnyText = false;
|
|
135603
135667
|
return {
|
|
135604
|
-
write: (
|
|
135605
|
-
let incoming =
|
|
135668
|
+
write: (text4) => {
|
|
135669
|
+
let incoming = text4;
|
|
135606
135670
|
if (!seenAnyText) {
|
|
135607
135671
|
seenAnyText = true;
|
|
135608
135672
|
incoming = incoming.charCodeAt(0) === SSE_BYTE_ORDER_MARK ? incoming.slice(1) : incoming;
|
|
@@ -136489,12 +136553,13 @@ function realFrontDoorSupervisorPorts(paths, respawnGeneration, retire, trackTun
|
|
|
136489
136553
|
});
|
|
136490
136554
|
},
|
|
136491
136555
|
isRunning: realIsProcessRunning,
|
|
136556
|
+
runningAmong: realRunningAmong,
|
|
136492
136557
|
// The turnover check's file identity, over the installed entry resolved once at door start: re-resolving per tick would re-run the PATH scan every second and could theoretically flip between two files, while the entry itself is fixed for as long as this door lives. The existence check prefers the agent-shim sibling only when it is really there (see watchedInstallEntry).
|
|
136493
136558
|
statOwnExecutable: realStatOwnExecutable(watchedInstallEntry(realOwnExecutablePath(), (candidate) => import_node_fs21.default.existsSync(candidate))),
|
|
136494
136559
|
startProviderListener: async (preferredPort) => {
|
|
136495
136560
|
const authority = loadCa();
|
|
136496
136561
|
const rcDial = rcSelfHost ? lateRcEventDial(rcSelfHostDialTarget) : realRcEventDial();
|
|
136497
|
-
const rcInject = async (sessionId,
|
|
136562
|
+
const rcInject = async (sessionId, text4) => await injectRcUserMessage({ credentialOf: rcTracker.credentialOf, noteSequenceNums: rcTracker.noteSequenceNums, dial: rcDial, newUuid: import_node_crypto25.randomUUID }, sessionId, text4);
|
|
136498
136563
|
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);
|
|
136499
136564
|
const rcControlRequestDeps = { credentialOf: rcTracker.credentialOf, noteSequenceNums: rcTracker.noteSequenceNums, dial: rcDial, newUuid: import_node_crypto25.randomUUID };
|
|
136500
136565
|
const rcInterrupt = async (sessionId) => await interruptRcSession(rcControlRequestDeps, sessionId);
|
|
@@ -136763,7 +136828,7 @@ function registerFrontDoorCommand(program2, deps) {
|
|
|
136763
136828
|
exit: deps.exit,
|
|
136764
136829
|
facts: () => ({
|
|
136765
136830
|
tunnels: openTunnels(),
|
|
136766
|
-
liveSessions: listFrontDoorSessions(realFarmFs, paths.frontdoorSessionsDir).filter((session) => session.pid !== ownPid &&
|
|
136831
|
+
liveSessions: listFrontDoorSessions(realFarmFs, paths.frontdoorSessionsDir).filter((session) => session.pid !== ownPid && realIsProcessAlive(session.pid)).length,
|
|
136767
136832
|
protocol: FRONT_DOOR_PROTOCOL,
|
|
136768
136833
|
uptimeSeconds: Math.round(process.uptime())
|
|
136769
136834
|
})
|
|
@@ -136780,7 +136845,7 @@ function registerFrontDoorCommand(program2, deps) {
|
|
|
136780
136845
|
// src/statusline/commands.ts
|
|
136781
136846
|
var import_node_child_process8 = require("node:child_process");
|
|
136782
136847
|
var import_node_os13 = __toESM(require("node:os"), 1);
|
|
136783
|
-
var
|
|
136848
|
+
var import_node_path58 = __toESM(require("node:path"), 1);
|
|
136784
136849
|
init_commandDeps();
|
|
136785
136850
|
init_statusline();
|
|
136786
136851
|
init_providersStore();
|
|
@@ -137107,6 +137172,10 @@ var ClientPayloadSchema = external_exports.looseObject({
|
|
|
137107
137172
|
session_id: text2,
|
|
137108
137173
|
transcript_path: text2,
|
|
137109
137174
|
cwd: text2,
|
|
137175
|
+
/** The Claude Code release the session runs. */
|
|
137176
|
+
version: text2,
|
|
137177
|
+
/** The reasoning effort: a level name, or an object carrying one in `level` (Claude Code 2.1.115 and later). */
|
|
137178
|
+
effort: external_exports.union([external_exports.string(), external_exports.looseObject({ level: text2 })]).optional().catch(void 0),
|
|
137110
137179
|
workspace: external_exports.looseObject({
|
|
137111
137180
|
current_dir: text2,
|
|
137112
137181
|
project_dir: text2,
|
|
@@ -137155,9 +137224,24 @@ function realStatuslinePorts(env) {
|
|
|
137155
137224
|
return {
|
|
137156
137225
|
env,
|
|
137157
137226
|
homeDirectory: import_node_os12.default.homedir(),
|
|
137158
|
-
readText: (
|
|
137227
|
+
readText: (path68) => {
|
|
137159
137228
|
try {
|
|
137160
|
-
return import_node_fs22.default.readFileSync(
|
|
137229
|
+
return import_node_fs22.default.readFileSync(path68, "utf8");
|
|
137230
|
+
} catch {
|
|
137231
|
+
return void 0;
|
|
137232
|
+
}
|
|
137233
|
+
},
|
|
137234
|
+
readRange: (file2, start, length) => {
|
|
137235
|
+
try {
|
|
137236
|
+
const descriptor = import_node_fs22.default.openSync(file2, "r");
|
|
137237
|
+
try {
|
|
137238
|
+
const { size } = import_node_fs22.default.fstatSync(descriptor);
|
|
137239
|
+
const buffer2 = Buffer.alloc(Math.max(0, Math.min(length, size - start)));
|
|
137240
|
+
const read = import_node_fs22.default.readSync(descriptor, buffer2, 0, buffer2.length, start);
|
|
137241
|
+
return { size, bytes: buffer2.subarray(0, read) };
|
|
137242
|
+
} finally {
|
|
137243
|
+
import_node_fs22.default.closeSync(descriptor);
|
|
137244
|
+
}
|
|
137161
137245
|
} catch {
|
|
137162
137246
|
return void 0;
|
|
137163
137247
|
}
|
|
@@ -137169,23 +137253,23 @@ function realStatuslinePorts(env) {
|
|
|
137169
137253
|
return void 0;
|
|
137170
137254
|
}
|
|
137171
137255
|
},
|
|
137172
|
-
entryKind: (
|
|
137256
|
+
entryKind: (path68) => {
|
|
137173
137257
|
try {
|
|
137174
|
-
return import_node_fs22.default.lstatSync(
|
|
137258
|
+
return import_node_fs22.default.lstatSync(path68).isDirectory() ? "directory" : "other";
|
|
137175
137259
|
} catch {
|
|
137176
137260
|
return void 0;
|
|
137177
137261
|
}
|
|
137178
137262
|
},
|
|
137179
|
-
realPath: (
|
|
137263
|
+
realPath: (path68) => {
|
|
137180
137264
|
try {
|
|
137181
|
-
return import_node_fs22.default.realpathSync(
|
|
137265
|
+
return import_node_fs22.default.realpathSync(path68);
|
|
137182
137266
|
} catch {
|
|
137183
137267
|
return void 0;
|
|
137184
137268
|
}
|
|
137185
137269
|
},
|
|
137186
|
-
modifiedAtMs: (
|
|
137270
|
+
modifiedAtMs: (path68) => {
|
|
137187
137271
|
try {
|
|
137188
|
-
return import_node_fs22.default.statSync(
|
|
137272
|
+
return import_node_fs22.default.statSync(path68).mtimeMs;
|
|
137189
137273
|
} catch {
|
|
137190
137274
|
return void 0;
|
|
137191
137275
|
}
|
|
@@ -137200,8 +137284,8 @@ init_statusline();
|
|
|
137200
137284
|
var ESCAPE_CHAR_CODE = 27;
|
|
137201
137285
|
var ESCAPE = String.fromCharCode(ESCAPE_CHAR_CODE);
|
|
137202
137286
|
var ANSI_REGEX = new RegExp(`${ESCAPE}\\[[0-9;]*[a-zA-Z]`, "g");
|
|
137203
|
-
function visibleLength(
|
|
137204
|
-
return
|
|
137287
|
+
function visibleLength(text4) {
|
|
137288
|
+
return text4.replace(ANSI_REGEX, "").length;
|
|
137205
137289
|
}
|
|
137206
137290
|
|
|
137207
137291
|
// src/statusline/barGrid.ts
|
|
@@ -137230,8 +137314,8 @@ function measureGrid(rows, separatorLength, baseBarCells) {
|
|
|
137230
137314
|
const fixed = [...prefixWidths, ...suffixWidths].reduce((total, width) => total + width, 0) + columns * (baseBarCells + BRACKET_COLUMNS);
|
|
137231
137315
|
return { rows, columns, prefixWidths, suffixWidths, baseWidth: fixed + separatorLength * (columns - 1) };
|
|
137232
137316
|
}
|
|
137233
|
-
function padTo(
|
|
137234
|
-
return
|
|
137317
|
+
function padTo(text4, width) {
|
|
137318
|
+
return text4 + " ".repeat(Math.max(0, width - visibleLength(text4)));
|
|
137235
137319
|
}
|
|
137236
137320
|
function renderGrid(grid, maxWidth, separator, baseBarCells) {
|
|
137237
137321
|
const separatorLength = visibleLength(separator);
|
|
@@ -137274,6 +137358,12 @@ function layoutBarGrid(groups, maxWidth, separator, baseBarCells) {
|
|
|
137274
137358
|
return renderGrid(layoutFor(1), maxWidth, separator, baseBarCells);
|
|
137275
137359
|
}
|
|
137276
137360
|
|
|
137361
|
+
// src/statusline/graphemes.ts
|
|
137362
|
+
var SEGMENTER = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
137363
|
+
function graphemesOf(text4) {
|
|
137364
|
+
return Array.from(SEGMENTER.segment(text4), (part) => part.segment);
|
|
137365
|
+
}
|
|
137366
|
+
|
|
137277
137367
|
// src/statusline/elements/header/account.ts
|
|
137278
137368
|
function tierSuffixOf(tier) {
|
|
137279
137369
|
const match = /_(\d+x)$/i.exec(tier ?? "");
|
|
@@ -137323,14 +137413,79 @@ function planLabelOf(tier) {
|
|
|
137323
137413
|
}
|
|
137324
137414
|
return cleaned;
|
|
137325
137415
|
}
|
|
137326
|
-
function
|
|
137416
|
+
function truncatedUser(email3, length) {
|
|
137417
|
+
const characters = graphemesOf(email3);
|
|
137418
|
+
return length === 0 || characters.length <= length ? email3 : `${characters.slice(0, length).join("")}\u2026`;
|
|
137419
|
+
}
|
|
137420
|
+
function accountSegment({ summary, settings: settings2 }) {
|
|
137327
137421
|
const loginPlan = summary.provider === void 0 ? summary.loginPlan ?? accountPlanLabel(summary) : void 0;
|
|
137328
137422
|
const loginOrgName = summary.loginOrganizationType === "claude_team" || summary.loginOrganizationType === "claude_enterprise" ? summary.loginOrganizationName : void 0;
|
|
137329
|
-
const
|
|
137330
|
-
|
|
137331
|
-
|
|
137423
|
+
const available = {
|
|
137424
|
+
user: summary.loginAccountEmail === void 0 ? void 0 : truncatedUser(summary.loginAccountEmail, settings2.account.userLength),
|
|
137425
|
+
organisation: loginOrgName,
|
|
137426
|
+
plan: loginPlan
|
|
137427
|
+
};
|
|
137428
|
+
const namesLogin = summary.loginAccountEmail !== void 0 && summary.loginAccountEmail !== summary.providerAccountEmail || summary.provider === void 0;
|
|
137429
|
+
const shown = settings2.account.parts.map((part) => available[part]).filter((part) => part !== void 0);
|
|
137430
|
+
return namesLogin && shown.length > 0 ? shown.join(" \xB7 ") : void 0;
|
|
137431
|
+
}
|
|
137432
|
+
|
|
137433
|
+
// src/statusline/sanitise.ts
|
|
137434
|
+
init_statusline();
|
|
137435
|
+
var BELL = "\\u0007";
|
|
137436
|
+
var ESCAPE_SEQUENCES = new RegExp([`${ESCAPE}\\[[0-?]*[ -/]*[@-~]`, `${ESCAPE}\\][^${BELL}${ESCAPE}]*(?:${BELL}|${ESCAPE}\\\\)`, `${ESCAPE}[@-Z\\\\-_]`].join("|"), "g");
|
|
137437
|
+
var CONTROL_AND_BIDI = /[\p{Cc}---]/gu;
|
|
137438
|
+
function sanitiseDisplayText(text4) {
|
|
137439
|
+
return text4.replace(ESCAPE_SEQUENCES, "").replace(CONTROL_AND_BIDI, "");
|
|
137440
|
+
}
|
|
137441
|
+
function boundedDisplayText(text4) {
|
|
137442
|
+
return graphemesOf(sanitiseDisplayText(text4).trim()).slice(0, MAX_DISPLAY_TEXT_CHARS).join("").trim();
|
|
137443
|
+
}
|
|
137444
|
+
|
|
137445
|
+
// src/statusline/elements/header/advisor.ts
|
|
137446
|
+
var MODEL_ID = /^(?:claude-)?(?:(\d{1,2})(?:-(\d{1,2}))?-)?(opus|sonnet|haiku)(?:-(\d{1,2})(?:-(\d{1,2}))?)?(?:-\d{8})?$/i;
|
|
137447
|
+
function prettifyModelId(id2) {
|
|
137448
|
+
const match = MODEL_ID.exec(id2);
|
|
137449
|
+
if (match === null) {
|
|
137450
|
+
return id2.replace(/^claude-/i, "");
|
|
137451
|
+
}
|
|
137452
|
+
const [, leadingMajor, leadingMinor, family = "", trailingMajor, trailingMinor] = match;
|
|
137453
|
+
const major = leadingMajor ?? trailingMajor;
|
|
137454
|
+
const minor = leadingMajor === void 0 ? trailingMinor : leadingMinor;
|
|
137455
|
+
const version2 = major === void 0 ? "" : ` ${major}${minor === void 0 ? "" : `.${minor}`}`;
|
|
137456
|
+
return `${family.charAt(0).toUpperCase()}${family.slice(1).toLowerCase()}${version2}`;
|
|
137457
|
+
}
|
|
137458
|
+
function advisorSegment({ settings: settings2, transcriptIdentity }) {
|
|
137459
|
+
if (settings2.advisor.override !== "") {
|
|
137460
|
+
return `Advisor: ${settings2.advisor.override}`;
|
|
137461
|
+
}
|
|
137462
|
+
const recorded = transcriptIdentity().advisor;
|
|
137463
|
+
const advisor = recorded === void 0 ? "" : boundedDisplayText(prettifyModelId(recorded));
|
|
137464
|
+
return advisor === "" ? void 0 : `Advisor: ${advisor}`;
|
|
137465
|
+
}
|
|
137466
|
+
|
|
137467
|
+
// src/statusline/elements/header/effort.ts
|
|
137468
|
+
var EFFORT_SYMBOLS = /* @__PURE__ */ new Map([
|
|
137469
|
+
["low", "\u25CB"],
|
|
137470
|
+
["medium", "\u25D4"],
|
|
137471
|
+
["high", "\u25D1"],
|
|
137472
|
+
["xhigh", "\u25D5"],
|
|
137473
|
+
["max", "\u25CF"]
|
|
137474
|
+
]);
|
|
137475
|
+
function effortLevelOf(effort) {
|
|
137476
|
+
const level = boundedDisplayText((typeof effort === "string" ? effort : effort?.level) ?? "").toLowerCase();
|
|
137477
|
+
return level === "" ? void 0 : level;
|
|
137478
|
+
}
|
|
137479
|
+
function formatEffort(level, format) {
|
|
137480
|
+
const symbol3 = EFFORT_SYMBOLS.get(level);
|
|
137481
|
+
if (symbol3 === void 0 || format === "text") {
|
|
137482
|
+
return level;
|
|
137332
137483
|
}
|
|
137333
|
-
return
|
|
137484
|
+
return format === "symbol" ? symbol3 : `${symbol3} ${level}`;
|
|
137485
|
+
}
|
|
137486
|
+
function effortSegment({ payload, settings: settings2 }) {
|
|
137487
|
+
const level = effortLevelOf(payload.effort);
|
|
137488
|
+
return level === void 0 ? void 0 : formatEffort(level, settings2.effort.format);
|
|
137334
137489
|
}
|
|
137335
137490
|
|
|
137336
137491
|
// src/statusline/palette.ts
|
|
@@ -137382,9 +137537,9 @@ function createPalette(colours, enabled) {
|
|
|
137382
137537
|
};
|
|
137383
137538
|
return {
|
|
137384
137539
|
ansi,
|
|
137385
|
-
paint: (role,
|
|
137540
|
+
paint: (role, text4) => {
|
|
137386
137541
|
const start = ansi(role);
|
|
137387
|
-
return start === "" ?
|
|
137542
|
+
return start === "" ? text4 : `${start}${text4}${RESET}`;
|
|
137388
137543
|
}
|
|
137389
137544
|
};
|
|
137390
137545
|
}
|
|
@@ -137399,8 +137554,8 @@ var TEN = 10;
|
|
|
137399
137554
|
var TWENTY = 20;
|
|
137400
137555
|
var FULL_PERCENT3 = 100;
|
|
137401
137556
|
var ONE_PERCENT = 1;
|
|
137402
|
-
function withColor(color,
|
|
137403
|
-
return color === "" ?
|
|
137557
|
+
function withColor(color, text4) {
|
|
137558
|
+
return color === "" ? text4 : `${color}${text4}${RESET}`;
|
|
137404
137559
|
}
|
|
137405
137560
|
function statusColor(fraction, isUsedMetric, style) {
|
|
137406
137561
|
const yellowAt = style.bands.warnAt / FULL_PERCENT3;
|
|
@@ -137495,18 +137650,72 @@ function identitySegment({ summary }) {
|
|
|
137495
137650
|
function choiceNamesProvider(summary) {
|
|
137496
137651
|
return summary.modelChoice !== void 0 && (summary.modelChoice.providers.length > 1 || summary.routedTarget !== void 0);
|
|
137497
137652
|
}
|
|
137498
|
-
|
|
137499
|
-
|
|
137500
|
-
const
|
|
137501
|
-
return
|
|
137653
|
+
var CLAUDE_MODEL_ID_PREFIXES = ["claude-", "anthropic."];
|
|
137654
|
+
function isClaudeModelId(id2) {
|
|
137655
|
+
const lower = id2.toLowerCase();
|
|
137656
|
+
return CLAUDE_MODEL_ID_PREFIXES.some((prefix) => lower.startsWith(prefix));
|
|
137657
|
+
}
|
|
137658
|
+
function formatModelName(name, format) {
|
|
137659
|
+
if (format === "full") {
|
|
137660
|
+
return name;
|
|
137661
|
+
}
|
|
137662
|
+
const withoutContext = name.replace(/\s*\([^)]*\bcontext\b[^)]*\)/i, "").trim();
|
|
137663
|
+
return format === "short" ? withoutContext.replace(/^Claude\s+/i, "") : withoutContext;
|
|
137664
|
+
}
|
|
137665
|
+
function modelNameOf({ view, settings: settings2, transcriptIdentity }) {
|
|
137666
|
+
if (settings2.model.override !== "") {
|
|
137667
|
+
return { name: settings2.model.override, isServed: false };
|
|
137668
|
+
}
|
|
137669
|
+
if (settings2.model.source !== "client") {
|
|
137670
|
+
const served = transcriptIdentity().model;
|
|
137671
|
+
if (served !== void 0 && (settings2.model.source === "transcript" || !isClaudeModelId(served))) {
|
|
137672
|
+
return { name: formatModelName(served, settings2.model.format), isServed: true };
|
|
137673
|
+
}
|
|
137674
|
+
}
|
|
137675
|
+
return view.modelDisplayName === void 0 || view.modelDisplayName === "" ? void 0 : { name: formatModelName(view.modelDisplayName, settings2.model.format), isServed: false };
|
|
137676
|
+
}
|
|
137677
|
+
function modelSegment(context) {
|
|
137678
|
+
const { summary } = context;
|
|
137679
|
+
const model = modelNameOf(context);
|
|
137680
|
+
if (model === void 0 || model.name === "") {
|
|
137681
|
+
return void 0;
|
|
137682
|
+
}
|
|
137683
|
+
if (summary.modelChoice === void 0 || model.isServed) {
|
|
137684
|
+
return model.name;
|
|
137685
|
+
}
|
|
137686
|
+
return `${model.name} -> ${choiceNamesProvider(summary) ? `${summary.modelChoice.provider}/${summary.modelChoice.served}` : summary.modelChoice.served}`;
|
|
137502
137687
|
}
|
|
137503
137688
|
|
|
137504
|
-
// src/statusline/
|
|
137505
|
-
var
|
|
137506
|
-
|
|
137507
|
-
var
|
|
137508
|
-
function
|
|
137509
|
-
|
|
137689
|
+
// src/statusline/elements/header/outputStyle.ts
|
|
137690
|
+
var import_node_path56 = __toESM(require("node:path"), 1);
|
|
137691
|
+
init_zod();
|
|
137692
|
+
var SettingsFileSchema = external_exports.looseObject({ outputStyle: external_exports.string().optional().catch(void 0) });
|
|
137693
|
+
function outputStyleIn(file2, readText) {
|
|
137694
|
+
const text4 = readText(file2);
|
|
137695
|
+
if (text4 === void 0) {
|
|
137696
|
+
return void 0;
|
|
137697
|
+
}
|
|
137698
|
+
let parsed;
|
|
137699
|
+
try {
|
|
137700
|
+
parsed = JSON.parse(text4);
|
|
137701
|
+
} catch {
|
|
137702
|
+
return void 0;
|
|
137703
|
+
}
|
|
137704
|
+
const settings2 = SettingsFileSchema.safeParse(parsed);
|
|
137705
|
+
const style = settings2.success ? boundedDisplayText(settings2.data.outputStyle ?? "") : "";
|
|
137706
|
+
return style === "" ? void 0 : style;
|
|
137707
|
+
}
|
|
137708
|
+
function outputStyleSegment({ payload, ports }) {
|
|
137709
|
+
const pinned = ports.env.CLAUDE_CONFIG_DIR;
|
|
137710
|
+
const configDirectory = pinned === void 0 || pinned === "" ? import_node_path56.default.join(ports.homeDirectory, ".claude") : pinned;
|
|
137711
|
+
const projectDirectory = payload.cwd ?? payload.workspace?.current_dir;
|
|
137712
|
+
const files = [
|
|
137713
|
+
import_node_path56.default.join(configDirectory, "settings.json"),
|
|
137714
|
+
import_node_path56.default.join(configDirectory, "settings.local.json"),
|
|
137715
|
+
...projectDirectory === void 0 ? [] : [import_node_path56.default.join(projectDirectory, ".claude", "settings.json"), import_node_path56.default.join(projectDirectory, ".claude", "settings.local.json")]
|
|
137716
|
+
];
|
|
137717
|
+
const style = files.map((file2) => outputStyleIn(file2, ports.readText)).findLast((name) => name !== void 0);
|
|
137718
|
+
return style === void 0 ? void 0 : `style: ${style}`;
|
|
137510
137719
|
}
|
|
137511
137720
|
|
|
137512
137721
|
// src/statusline/projectPath.ts
|
|
@@ -137527,8 +137736,8 @@ function formatProjectPath(cwd, levels) {
|
|
|
137527
137736
|
return segments.length > 0 ? `//${segments.join("/")}` : "//";
|
|
137528
137737
|
}
|
|
137529
137738
|
if (DRIVE_PREFIX.test(safe)) {
|
|
137530
|
-
const
|
|
137531
|
-
return segments.length === 1 ? `${
|
|
137739
|
+
const joined3 = segments.join("/");
|
|
137740
|
+
return segments.length === 1 ? `${joined3}/` : joined3;
|
|
137532
137741
|
}
|
|
137533
137742
|
if (SEPARATOR_AT_START.test(safe)) {
|
|
137534
137743
|
return segments.length > 0 ? `/${segments.join("/")}` : "/";
|
|
@@ -137553,7 +137762,7 @@ function workingDirectoryOf(payload) {
|
|
|
137553
137762
|
function inlineAddedDirs({ payload, palette }) {
|
|
137554
137763
|
const { names, more } = addedDirNames(payload.workspace?.added_dirs);
|
|
137555
137764
|
const drawn = [...names.map((name) => `+${name}`), ...more > 0 ? [`+${String(more)} more`] : []];
|
|
137556
|
-
return drawn.length === 0 ? void 0 : drawn.map((
|
|
137765
|
+
return drawn.length === 0 ? void 0 : drawn.map((text4) => palette.paint("label", text4)).join(" ");
|
|
137557
137766
|
}
|
|
137558
137767
|
function projectSegment(context) {
|
|
137559
137768
|
const { payload, settings: settings2 } = context;
|
|
@@ -137563,12 +137772,13 @@ function projectSegment(context) {
|
|
|
137563
137772
|
}
|
|
137564
137773
|
|
|
137565
137774
|
// src/statusline/elements/header/provider.ts
|
|
137566
|
-
function providerSegment({ summary }) {
|
|
137567
|
-
|
|
137775
|
+
function providerSegment({ summary, settings: settings2 }) {
|
|
137776
|
+
const label2 = settings2.provider.name === "" ? summary.provider : settings2.provider.name;
|
|
137777
|
+
if (label2 === void 0) {
|
|
137568
137778
|
return void 0;
|
|
137569
137779
|
}
|
|
137570
137780
|
const account = [summary.providerAccountEmail, summary.providerPlan].filter((part) => part !== void 0);
|
|
137571
|
-
return account.length > 0 ? `${
|
|
137781
|
+
return account.length > 0 ? `${label2} \xB7 ${account.join(" \xB7 ")}` : label2;
|
|
137572
137782
|
}
|
|
137573
137783
|
|
|
137574
137784
|
// src/statusline/elements/header/route.ts
|
|
@@ -137576,6 +137786,12 @@ function routeSegment({ summary }) {
|
|
|
137576
137786
|
return summary.routedTarget !== void 0 && !choiceNamesProvider(summary) ? `via ${summary.routedTarget}` : void 0;
|
|
137577
137787
|
}
|
|
137578
137788
|
|
|
137789
|
+
// src/statusline/elements/header/version.ts
|
|
137790
|
+
function versionSegment({ payload }) {
|
|
137791
|
+
const version2 = boundedDisplayText(payload.version ?? "");
|
|
137792
|
+
return version2 === "" ? void 0 : `CC v${version2}`;
|
|
137793
|
+
}
|
|
137794
|
+
|
|
137579
137795
|
// src/statusline/vcs/git.ts
|
|
137580
137796
|
var GIT = "git";
|
|
137581
137797
|
var NUL = "\0";
|
|
@@ -137652,15 +137868,15 @@ function parseNumstat(output2) {
|
|
|
137652
137868
|
if (addedText === void 0 || deletedText === void 0 || pathText === void 0) {
|
|
137653
137869
|
continue;
|
|
137654
137870
|
}
|
|
137655
|
-
const
|
|
137871
|
+
const path68 = pathText === "" ? fields[index + 2] : pathText;
|
|
137656
137872
|
if (pathText === "") {
|
|
137657
137873
|
index += 2;
|
|
137658
137874
|
}
|
|
137659
137875
|
const lines = { added: Number(addedText), deleted: Number(deletedText) };
|
|
137660
|
-
if (
|
|
137876
|
+
if (path68 !== void 0 && Number.isInteger(lines.added) && Number.isInteger(lines.deleted)) {
|
|
137661
137877
|
added += lines.added;
|
|
137662
137878
|
deleted += lines.deleted;
|
|
137663
|
-
byPath.set(
|
|
137879
|
+
byPath.set(path68, lines);
|
|
137664
137880
|
}
|
|
137665
137881
|
}
|
|
137666
137882
|
return { total: { added, deleted }, byPath };
|
|
@@ -137715,7 +137931,7 @@ function readGitStatus(ports, cwd, query) {
|
|
|
137715
137931
|
}
|
|
137716
137932
|
|
|
137717
137933
|
// src/statusline/vcs/jj.ts
|
|
137718
|
-
var
|
|
137934
|
+
var import_node_path57 = __toESM(require("node:path"), 1);
|
|
137719
137935
|
var JJ2 = "jj";
|
|
137720
137936
|
var MAX_WALK_DEPTH = 64;
|
|
137721
137937
|
var MAX_LABEL_CODE_POINTS = 64;
|
|
@@ -137728,13 +137944,13 @@ function isJjRepository(ports, cwd) {
|
|
|
137728
137944
|
return false;
|
|
137729
137945
|
}
|
|
137730
137946
|
for (let depth = 0; depth < MAX_WALK_DEPTH; depth += 1) {
|
|
137731
|
-
if (ports.entryKind(
|
|
137947
|
+
if (ports.entryKind(import_node_path57.default.join(directory, ".jj")) === "directory") {
|
|
137732
137948
|
return true;
|
|
137733
137949
|
}
|
|
137734
|
-
if (ports.entryKind(
|
|
137950
|
+
if (ports.entryKind(import_node_path57.default.join(directory, ".git")) !== void 0) {
|
|
137735
137951
|
return false;
|
|
137736
137952
|
}
|
|
137737
|
-
const parent =
|
|
137953
|
+
const parent = import_node_path57.default.dirname(directory);
|
|
137738
137954
|
if (parent === directory) {
|
|
137739
137955
|
return false;
|
|
137740
137956
|
}
|
|
@@ -137752,8 +137968,8 @@ var TEMPLATE = [
|
|
|
137752
137968
|
'if(self.conflict(), "1", "0")'
|
|
137753
137969
|
].join(" ++ ");
|
|
137754
137970
|
var ARGS = ["--ignore-working-copy", "--at-operation=@", "--no-pager", "log", "-r", "@", "--no-graph", "--color", "never", "-T", TEMPLATE];
|
|
137755
|
-
function label(
|
|
137756
|
-
const clean = sanitiseDisplayText(
|
|
137971
|
+
function label(text4) {
|
|
137972
|
+
const clean = sanitiseDisplayText(text4).trim();
|
|
137757
137973
|
return clean === "" ? void 0 : Array.from(clean).slice(0, MAX_LABEL_CODE_POINTS).join("");
|
|
137758
137974
|
}
|
|
137759
137975
|
function parse4(output2) {
|
|
@@ -137813,12 +138029,12 @@ function vcsStatusOf(context) {
|
|
|
137813
138029
|
|
|
137814
138030
|
// src/statusline/elements/header/vcs.ts
|
|
137815
138031
|
function aheadText(ahead, { settings: settings2, palette }) {
|
|
137816
|
-
const
|
|
138032
|
+
const text4 = `\u2191${String(ahead)}`;
|
|
137817
138033
|
const { pushCriticalAt, pushWarnAt } = settings2.git;
|
|
137818
138034
|
if (pushCriticalAt > 0 && ahead >= pushCriticalAt) {
|
|
137819
|
-
return palette.paint("critical",
|
|
138035
|
+
return palette.paint("critical", text4);
|
|
137820
138036
|
}
|
|
137821
|
-
return pushWarnAt > 0 && ahead >= pushWarnAt ? palette.paint("warning",
|
|
138037
|
+
return pushWarnAt > 0 && ahead >= pushWarnAt ? palette.paint("warning", text4) : palette.paint("gitBranch", text4);
|
|
137822
138038
|
}
|
|
137823
138039
|
function vcsSegment(context) {
|
|
137824
138040
|
const status = vcsStatusOf(context);
|
|
@@ -137856,7 +138072,7 @@ function addedDirsRow({ payload, settings: settings2, palette }) {
|
|
|
137856
138072
|
if (settings2.project.addedDirsLayout !== "row" || names.length === 0) {
|
|
137857
138073
|
return { kind: "text", lines: [] };
|
|
137858
138074
|
}
|
|
137859
|
-
const drawn = [...names, ...more > 0 ? [`+${String(more)} more`] : []].map((
|
|
138075
|
+
const drawn = [...names, ...more > 0 ? [`+${String(more)} more`] : []].map((text4) => palette.paint("label", text4));
|
|
137860
138076
|
return { kind: "text", lines: [`${palette.paint("label", "Added dirs:")} ${drawn.join(palette.paint("label", ", "))}`] };
|
|
137861
138077
|
}
|
|
137862
138078
|
|
|
@@ -137968,10 +138184,14 @@ var HEADER_ROLES = {
|
|
|
137968
138184
|
identity: "label",
|
|
137969
138185
|
headroom: "label",
|
|
137970
138186
|
project: "project",
|
|
137971
|
-
vcs: "git"
|
|
138187
|
+
vcs: "git",
|
|
138188
|
+
effort: "model",
|
|
138189
|
+
advisor: "label",
|
|
138190
|
+
version: "label",
|
|
138191
|
+
outputStyle: "label"
|
|
137972
138192
|
};
|
|
137973
138193
|
var ELEMENTS = {
|
|
137974
|
-
header: { model: modelSegment, provider: providerSegment, route: routeSegment, account: accountSegment, identity: identitySegment, headroom: headroomSegment, project: projectSegment, vcs: vcsSegment },
|
|
138194
|
+
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 },
|
|
137975
138195
|
rows: { context: contextRow, quota: quotaRow, addedDirs: addedDirsRow, gitFiles: gitFilesRow }
|
|
137976
138196
|
};
|
|
137977
138197
|
|
|
@@ -137993,7 +138213,7 @@ function justify(texts, maxWidth, separator) {
|
|
|
137993
138213
|
return texts.join(separator);
|
|
137994
138214
|
}
|
|
137995
138215
|
const separatorLength = visibleLength(separator);
|
|
137996
|
-
const total = texts.reduce((sum,
|
|
138216
|
+
const total = texts.reduce((sum, text4) => sum + visibleLength(text4), 0) + separatorLength * (texts.length - 1);
|
|
137997
138217
|
const spare = maxWidth - total;
|
|
137998
138218
|
if (spare <= 0) {
|
|
137999
138219
|
return texts.join(separator);
|
|
@@ -138002,7 +138222,7 @@ function justify(texts, maxWidth, separator) {
|
|
|
138002
138222
|
const extraPerGap = Math.floor(spare / gaps);
|
|
138003
138223
|
let remainder = spare % gaps;
|
|
138004
138224
|
const parts = [];
|
|
138005
|
-
texts.forEach((
|
|
138225
|
+
texts.forEach((text4, index) => {
|
|
138006
138226
|
if (index > 0) {
|
|
138007
138227
|
const extra = extraPerGap + (remainder > 0 ? 1 : 0);
|
|
138008
138228
|
if (remainder > 0) {
|
|
@@ -138011,7 +138231,7 @@ function justify(texts, maxWidth, separator) {
|
|
|
138011
138231
|
const left = Math.floor(extra / 2);
|
|
138012
138232
|
parts.push(`${" ".repeat(left + 1)}|${" ".repeat(extra - left + 1)}`);
|
|
138013
138233
|
}
|
|
138014
|
-
parts.push(
|
|
138234
|
+
parts.push(text4);
|
|
138015
138235
|
});
|
|
138016
138236
|
return parts.join("");
|
|
138017
138237
|
}
|
|
@@ -138020,15 +138240,15 @@ function layoutHeader(texts, maxWidth, separator) {
|
|
|
138020
138240
|
const lines = [];
|
|
138021
138241
|
let current = [];
|
|
138022
138242
|
let currentWidth = 0;
|
|
138023
|
-
for (const
|
|
138024
|
-
const width = visibleLength(
|
|
138243
|
+
for (const text4 of texts) {
|
|
138244
|
+
const width = visibleLength(text4);
|
|
138025
138245
|
const added = current.length === 0 ? width : width + separatorLength;
|
|
138026
138246
|
if (current.length > 0 && currentWidth + added > maxWidth) {
|
|
138027
138247
|
lines.push(current);
|
|
138028
|
-
current = [
|
|
138248
|
+
current = [text4];
|
|
138029
138249
|
currentWidth = width;
|
|
138030
138250
|
} else {
|
|
138031
|
-
current.push(
|
|
138251
|
+
current.push(text4);
|
|
138032
138252
|
currentWidth += added;
|
|
138033
138253
|
}
|
|
138034
138254
|
}
|
|
@@ -138038,9 +138258,106 @@ function layoutHeader(texts, maxWidth, separator) {
|
|
|
138038
138258
|
return lines.map((line) => justify(line, maxWidth, separator)).join("\n");
|
|
138039
138259
|
}
|
|
138040
138260
|
|
|
138261
|
+
// src/statusline/identityTranscript.ts
|
|
138262
|
+
init_zod();
|
|
138263
|
+
var TRANSCRIPT_CHUNK_BYTES = 65536;
|
|
138264
|
+
var MAX_TRANSCRIPT_SCAN_BYTES = 4194304;
|
|
138265
|
+
var NOT_FOUND = { model: void 0, advisor: void 0 };
|
|
138266
|
+
var SYNTHETIC_MODEL = "<synthetic>";
|
|
138267
|
+
var NEWLINE = 10;
|
|
138268
|
+
var text3 = external_exports.string().optional().catch(void 0);
|
|
138269
|
+
var RecordSchema = external_exports.looseObject({
|
|
138270
|
+
type: text3,
|
|
138271
|
+
advisorModel: text3,
|
|
138272
|
+
message: external_exports.looseObject({ model: text3 }).optional().catch(void 0)
|
|
138273
|
+
});
|
|
138274
|
+
var ASSISTANT_TYPE = /"type"\s*:\s*"assistant"/;
|
|
138275
|
+
function identityOfLine(line) {
|
|
138276
|
+
if (!ASSISTANT_TYPE.test(line)) {
|
|
138277
|
+
return void 0;
|
|
138278
|
+
}
|
|
138279
|
+
let parsed;
|
|
138280
|
+
try {
|
|
138281
|
+
parsed = JSON.parse(line);
|
|
138282
|
+
} catch {
|
|
138283
|
+
return void 0;
|
|
138284
|
+
}
|
|
138285
|
+
const record2 = RecordSchema.safeParse(parsed);
|
|
138286
|
+
if (!record2.success || record2.data.type !== "assistant") {
|
|
138287
|
+
return void 0;
|
|
138288
|
+
}
|
|
138289
|
+
const model = boundedDisplayText(record2.data.message?.model ?? "");
|
|
138290
|
+
if (model === "" || model === SYNTHETIC_MODEL) {
|
|
138291
|
+
return void 0;
|
|
138292
|
+
}
|
|
138293
|
+
const advisor = boundedDisplayText(record2.data.advisorModel ?? "");
|
|
138294
|
+
return { model, advisor: advisor === "" ? void 0 : advisor };
|
|
138295
|
+
}
|
|
138296
|
+
function joined2(pieces) {
|
|
138297
|
+
const whole = new Uint8Array(pieces.reduce((total, piece) => total + piece.length, 0));
|
|
138298
|
+
let at2 = 0;
|
|
138299
|
+
for (const piece of pieces) {
|
|
138300
|
+
whole.set(piece, at2);
|
|
138301
|
+
at2 += piece.length;
|
|
138302
|
+
}
|
|
138303
|
+
return whole;
|
|
138304
|
+
}
|
|
138305
|
+
var EMPTY_LINE = new Uint8Array();
|
|
138306
|
+
function splitAtNewlines(bytes) {
|
|
138307
|
+
const firstBreak = bytes.indexOf(NEWLINE);
|
|
138308
|
+
if (firstBreak === -1) {
|
|
138309
|
+
return { head: bytes, rest: [] };
|
|
138310
|
+
}
|
|
138311
|
+
const rest = [];
|
|
138312
|
+
let from = firstBreak + 1;
|
|
138313
|
+
for (let at2 = bytes.indexOf(NEWLINE, from); at2 !== -1; at2 = bytes.indexOf(NEWLINE, from)) {
|
|
138314
|
+
rest.push(bytes.subarray(from, at2));
|
|
138315
|
+
from = at2 + 1;
|
|
138316
|
+
}
|
|
138317
|
+
rest.push(bytes.subarray(from));
|
|
138318
|
+
return { head: bytes.subarray(0, firstBreak), rest };
|
|
138319
|
+
}
|
|
138320
|
+
function readTranscriptIdentity(ports, transcriptPath) {
|
|
138321
|
+
const size = ports.readRange(transcriptPath, 0, 0)?.size;
|
|
138322
|
+
if (size === void 0) {
|
|
138323
|
+
return NOT_FOUND;
|
|
138324
|
+
}
|
|
138325
|
+
let carry = [];
|
|
138326
|
+
const decoder = new TextDecoder();
|
|
138327
|
+
const floor = Math.max(0, size - MAX_TRANSCRIPT_SCAN_BYTES);
|
|
138328
|
+
for (let end = size; end > floor; end = Math.max(floor, end - TRANSCRIPT_CHUNK_BYTES)) {
|
|
138329
|
+
const start = Math.max(floor, end - TRANSCRIPT_CHUNK_BYTES);
|
|
138330
|
+
const chunk2 = ports.readRange(transcriptPath, start, end - start);
|
|
138331
|
+
if (chunk2 === void 0) {
|
|
138332
|
+
return NOT_FOUND;
|
|
138333
|
+
}
|
|
138334
|
+
const { head, rest } = splitAtNewlines(chunk2.bytes);
|
|
138335
|
+
if (rest.length === 0) {
|
|
138336
|
+
carry = [head, ...carry];
|
|
138337
|
+
continue;
|
|
138338
|
+
}
|
|
138339
|
+
const [tail = EMPTY_LINE, ...older] = rest.toReversed();
|
|
138340
|
+
for (const line of [joined2([tail, ...carry]), ...older]) {
|
|
138341
|
+
const found = identityOfLine(decoder.decode(line));
|
|
138342
|
+
if (found !== void 0) {
|
|
138343
|
+
return found;
|
|
138344
|
+
}
|
|
138345
|
+
}
|
|
138346
|
+
carry = [head];
|
|
138347
|
+
}
|
|
138348
|
+
return floor === 0 ? identityOfLine(decoder.decode(joined2(carry))) ?? NOT_FOUND : NOT_FOUND;
|
|
138349
|
+
}
|
|
138350
|
+
|
|
138041
138351
|
// src/statusline/render.ts
|
|
138042
138352
|
var RESERVED_COLUMNS = 4;
|
|
138043
138353
|
var SEPARATOR2 = " | ";
|
|
138354
|
+
function once2(read) {
|
|
138355
|
+
let kept;
|
|
138356
|
+
return () => {
|
|
138357
|
+
kept ??= { value: read() };
|
|
138358
|
+
return kept.value;
|
|
138359
|
+
};
|
|
138360
|
+
}
|
|
138044
138361
|
function renderStatuslineBlock(input2) {
|
|
138045
138362
|
const { terminalWidth, settings: settings2 = STATUSLINE_DEFAULTS, elements = ELEMENTS } = input2;
|
|
138046
138363
|
const context = {
|
|
@@ -138051,11 +138368,12 @@ function renderStatuslineBlock(input2) {
|
|
|
138051
138368
|
terminalWidth,
|
|
138052
138369
|
settings: settings2,
|
|
138053
138370
|
palette: createPalette(settings2.colours, colourEnabled(input2.ports.env)),
|
|
138054
|
-
ports: input2.ports
|
|
138371
|
+
ports: input2.ports,
|
|
138372
|
+
transcriptIdentity: once2(() => input2.payload.transcript_path === void 0 ? { model: void 0, advisor: void 0 } : readTranscriptIdentity(input2.ports, input2.payload.transcript_path))
|
|
138055
138373
|
};
|
|
138056
138374
|
const parts = settings2.layout.header.flatMap((name) => {
|
|
138057
|
-
const
|
|
138058
|
-
return
|
|
138375
|
+
const text4 = elements.header[name](context);
|
|
138376
|
+
return text4 === void 0 ? [] : { name, text: context.palette.paint(HEADER_ROLES[name], text4) };
|
|
138059
138377
|
});
|
|
138060
138378
|
const header = headerUnits(parts, settings2.git.branchOverflow);
|
|
138061
138379
|
const width = Math.max(TWENTY, terminalWidth - RESERVED_COLUMNS);
|
|
@@ -138137,7 +138455,7 @@ function registerStatuslineCommand(program2, deps) {
|
|
|
138137
138455
|
} else {
|
|
138138
138456
|
const configDir = process.env.CLAUDE_CONFIG_DIR;
|
|
138139
138457
|
try {
|
|
138140
|
-
account = readAccountMetadataFile(realFarmFs, configDir === void 0 || configDir === "" ?
|
|
138458
|
+
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"));
|
|
138141
138459
|
} catch {
|
|
138142
138460
|
account = void 0;
|
|
138143
138461
|
}
|
|
@@ -140234,8 +140552,8 @@ function getErrorMap2() {
|
|
|
140234
140552
|
|
|
140235
140553
|
// node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/helpers/parseUtil.js
|
|
140236
140554
|
var makeIssue = (params) => {
|
|
140237
|
-
const { data, path:
|
|
140238
|
-
const fullPath = [...
|
|
140555
|
+
const { data, path: path68, errorMaps, issueData } = params;
|
|
140556
|
+
const fullPath = [...path68, ...issueData.path || []];
|
|
140239
140557
|
const fullIssue = {
|
|
140240
140558
|
...issueData,
|
|
140241
140559
|
path: fullPath
|
|
@@ -140350,11 +140668,11 @@ var errorUtil;
|
|
|
140350
140668
|
|
|
140351
140669
|
// node_modules/.pnpm/zod@4.6.5/node_modules/zod/v3/types.js
|
|
140352
140670
|
var ParseInputLazyPath = class {
|
|
140353
|
-
constructor(parent, value2,
|
|
140671
|
+
constructor(parent, value2, path68, key) {
|
|
140354
140672
|
this._cachedPath = [];
|
|
140355
140673
|
this.parent = parent;
|
|
140356
140674
|
this.data = value2;
|
|
140357
|
-
this._path =
|
|
140675
|
+
this._path = path68;
|
|
140358
140676
|
this._key = key;
|
|
140359
140677
|
}
|
|
140360
140678
|
get path() {
|
|
@@ -143917,11 +144235,11 @@ function normalizeObjectSchema(schema) {
|
|
|
143917
144235
|
}
|
|
143918
144236
|
return void 0;
|
|
143919
144237
|
}
|
|
143920
|
-
function getDotPath(
|
|
143921
|
-
if (
|
|
144238
|
+
function getDotPath(path68) {
|
|
144239
|
+
if (path68.length === 0) {
|
|
143922
144240
|
return "object root";
|
|
143923
144241
|
}
|
|
143924
|
-
return
|
|
144242
|
+
return path68.reduce((acc, seg, index) => {
|
|
143925
144243
|
if (index === 0) {
|
|
143926
144244
|
return String(seg);
|
|
143927
144245
|
}
|
|
@@ -147964,7 +148282,7 @@ async function serveMcp(mcp, transport, options = {}) {
|
|
|
147964
148282
|
|
|
147965
148283
|
// src/mcp/permissions.ts
|
|
147966
148284
|
var import_node_fs23 = __toESM(require("node:fs"), 1);
|
|
147967
|
-
var
|
|
148285
|
+
var import_node_path59 = __toESM(require("node:path"), 1);
|
|
147968
148286
|
init_zod();
|
|
147969
148287
|
init_store();
|
|
147970
148288
|
var StoredMcpPermissionsSchema = external_exports.strictObject({
|
|
@@ -147986,10 +148304,10 @@ function effectiveMcpPermissions(flags, stored) {
|
|
|
147986
148304
|
return { writes: flags.writes || stored.writes, remoteControl: flags.remoteControl || stored.remoteControl, history: flags.history || stored.history };
|
|
147987
148305
|
}
|
|
147988
148306
|
function watchMcpPermissions(paths, onChange) {
|
|
147989
|
-
const directory =
|
|
148307
|
+
const directory = import_node_path59.default.dirname(paths.mcpPermissionsFile);
|
|
147990
148308
|
import_node_fs23.default.mkdirSync(directory, { recursive: true });
|
|
147991
148309
|
const watcher = import_node_fs23.default.watch(directory, (_event, filename) => {
|
|
147992
|
-
if (filename === null || filename ===
|
|
148310
|
+
if (filename === null || filename === import_node_path59.default.basename(paths.mcpPermissionsFile)) {
|
|
147993
148311
|
onChange();
|
|
147994
148312
|
}
|
|
147995
148313
|
});
|
|
@@ -148154,9 +148472,9 @@ init_cliError();
|
|
|
148154
148472
|
init_argv();
|
|
148155
148473
|
init_legacy();
|
|
148156
148474
|
var COMPLETION_SHELLS = ["bash", "zsh", "fish"];
|
|
148157
|
-
function firstSentence(
|
|
148158
|
-
const end =
|
|
148159
|
-
return end === -1 ?
|
|
148475
|
+
function firstSentence(text4) {
|
|
148476
|
+
const end = text4.search(/\.(\s|$)/);
|
|
148477
|
+
return end === -1 ? text4 : text4.slice(0, end);
|
|
148160
148478
|
}
|
|
148161
148479
|
function collectNodes(program2) {
|
|
148162
148480
|
const help = new Help();
|
|
@@ -148177,11 +148495,11 @@ function collectNodes(program2) {
|
|
|
148177
148495
|
visit2(program2, "root");
|
|
148178
148496
|
return nodes;
|
|
148179
148497
|
}
|
|
148180
|
-
function singleQuote(
|
|
148181
|
-
return `'${
|
|
148498
|
+
function singleQuote(text4) {
|
|
148499
|
+
return `'${text4.replaceAll("'", `'\\''`)}'`;
|
|
148182
148500
|
}
|
|
148183
|
-
function fishQuote(
|
|
148184
|
-
return `'${
|
|
148501
|
+
function fishQuote(text4) {
|
|
148502
|
+
return `'${text4.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
|
|
148185
148503
|
}
|
|
148186
148504
|
function transitionArms(nodes, indent) {
|
|
148187
148505
|
return nodes.flatMap((node2) => [...node2.children].map(([name, child]) => `${indent}${singleQuote(`${node2.id}:${name}`)}) node=${singleQuote(child)} ;;`)).join("\n");
|
|
@@ -148303,16 +148621,16 @@ init_credentialCache();
|
|
|
148303
148621
|
|
|
148304
148622
|
// src/identityToken.ts
|
|
148305
148623
|
var import_node_fs24 = __toESM(require("node:fs"), 1);
|
|
148306
|
-
var
|
|
148624
|
+
var import_node_path60 = __toESM(require("node:path"), 1);
|
|
148307
148625
|
init_cliError();
|
|
148308
148626
|
var TOKEN_FILE_MODE = 384;
|
|
148309
148627
|
var TOKEN_DIR_MODE = 448;
|
|
148310
148628
|
var OAUTH_TOKEN_RE = /^sk-ant-oat\d+-[A-Za-z0-9_-]+$/;
|
|
148311
148629
|
function identityTokenDir(paths) {
|
|
148312
|
-
return
|
|
148630
|
+
return import_node_path60.default.join(paths.root, "credentials");
|
|
148313
148631
|
}
|
|
148314
148632
|
function identityTokenPath(paths, identityName) {
|
|
148315
|
-
return
|
|
148633
|
+
return import_node_path60.default.join(identityTokenDir(paths), `${identityName}.token`);
|
|
148316
148634
|
}
|
|
148317
148635
|
function storeIdentityToken(paths, identityName, raw) {
|
|
148318
148636
|
const token = raw.trim();
|
|
@@ -148323,7 +148641,7 @@ function storeIdentityToken(paths, identityName, raw) {
|
|
|
148323
148641
|
import_node_fs24.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
|
|
148324
148642
|
import_node_fs24.default.chmodSync(dir, TOKEN_DIR_MODE);
|
|
148325
148643
|
const target = identityTokenPath(paths, identityName);
|
|
148326
|
-
const temp =
|
|
148644
|
+
const temp = import_node_path60.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
|
|
148327
148645
|
import_node_fs24.default.writeFileSync(temp, `${token}
|
|
148328
148646
|
`, { mode: TOKEN_FILE_MODE });
|
|
148329
148647
|
import_node_fs24.default.renameSync(temp, target);
|
|
@@ -148494,7 +148812,7 @@ function registerDoctorCommand(program2, deps) {
|
|
|
148494
148812
|
// src/headroom/commands.ts
|
|
148495
148813
|
var import_node_fs25 = __toESM(require("node:fs"), 1);
|
|
148496
148814
|
var import_node_http5 = __toESM(require("node:http"), 1);
|
|
148497
|
-
var
|
|
148815
|
+
var import_node_path61 = __toESM(require("node:path"), 1);
|
|
148498
148816
|
var import_node_child_process10 = require("node:child_process");
|
|
148499
148817
|
init_commandDeps();
|
|
148500
148818
|
init_configProfilesStore();
|
|
@@ -148684,12 +149002,12 @@ function readInstalledHeadroomCommit() {
|
|
|
148684
149002
|
if (toolDir.status !== 0) {
|
|
148685
149003
|
return void 0;
|
|
148686
149004
|
}
|
|
148687
|
-
const libDir =
|
|
149005
|
+
const libDir = import_node_path61.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
|
|
148688
149006
|
for (const python of realFarmFs.readdir(libDir)) {
|
|
148689
|
-
const sitePackages =
|
|
149007
|
+
const sitePackages = import_node_path61.default.join(libDir, python, "site-packages");
|
|
148690
149008
|
for (const entry of realFarmFs.readdir(sitePackages)) {
|
|
148691
149009
|
if (entry.startsWith("headroom_ai-") && entry.endsWith(".dist-info")) {
|
|
148692
|
-
const directUrl = realFarmFs.readFileUtf8(
|
|
149010
|
+
const directUrl = realFarmFs.readFileUtf8(import_node_path61.default.join(sitePackages, entry, "direct_url.json"));
|
|
148693
149011
|
return directUrl === void 0 ? void 0 : parseInstalledCommit(directUrl);
|
|
148694
149012
|
}
|
|
148695
149013
|
}
|
|
@@ -148920,9 +149238,9 @@ init_providersStore();
|
|
|
148920
149238
|
init_realPorts();
|
|
148921
149239
|
var realCatalogueFetch = async (url2, headers, timeoutMs) => {
|
|
148922
149240
|
const response = await fetch(url2, { headers: { ...headers }, signal: AbortSignal.timeout(timeoutMs) });
|
|
148923
|
-
const
|
|
149241
|
+
const text4 = await response.text();
|
|
148924
149242
|
try {
|
|
148925
|
-
const body = JSON.parse(
|
|
149243
|
+
const body = JSON.parse(text4);
|
|
148926
149244
|
return { status: response.status, body };
|
|
148927
149245
|
} catch {
|
|
148928
149246
|
return { status: response.status, body: void 0 };
|
|
@@ -148945,7 +149263,7 @@ async function refreshCatalogueForReal(paths, name, env) {
|
|
|
148945
149263
|
init_realPorts();
|
|
148946
149264
|
|
|
148947
149265
|
// src/usage/realJobRunner.ts
|
|
148948
|
-
var
|
|
149266
|
+
var import_node_path62 = __toESM(require("node:path"), 1);
|
|
148949
149267
|
init_conditions();
|
|
148950
149268
|
init_identityClaude();
|
|
148951
149269
|
var JOB_LAUNCH_FLAGS = ["--no-headroom", "--no-remote-control", "--track-usage"];
|
|
@@ -148958,7 +149276,7 @@ ${outcome.trimEnd()}
|
|
|
148958
149276
|
}
|
|
148959
149277
|
function createRealJobRunner(params) {
|
|
148960
149278
|
return async (name, identity, job) => {
|
|
148961
|
-
const logFile =
|
|
149279
|
+
const logFile = import_node_path62.default.join(params.paths.jobLogsDir, `${name}.log`);
|
|
148962
149280
|
const append = (outcome) => {
|
|
148963
149281
|
params.fs.mkdirPrivate(params.paths.jobLogsDir);
|
|
148964
149282
|
params.fs.appendFilePrivate(logFile, logEntry(name, identity, params.now(), outcome));
|
|
@@ -149015,7 +149333,7 @@ function registerHeadlessCommands(program2, deps) {
|
|
|
149015
149333
|
}
|
|
149016
149334
|
|
|
149017
149335
|
// src/jobs.ts
|
|
149018
|
-
var
|
|
149336
|
+
var import_node_path63 = __toESM(require("node:path"), 1);
|
|
149019
149337
|
init_commandDeps();
|
|
149020
149338
|
init_cliError();
|
|
149021
149339
|
init_schema();
|
|
@@ -149040,7 +149358,7 @@ function jobOf(options) {
|
|
|
149040
149358
|
target: options.identity === void 0 ? { pool: options.pool ?? "" } : { identity: options.identity },
|
|
149041
149359
|
trigger: options.at === void 0 ? { beforeReset: options.beforeReset ?? "fiveHour", lead: options.lead ?? "" } : { at: options.at },
|
|
149042
149360
|
prompt: options.prompt,
|
|
149043
|
-
cwd:
|
|
149361
|
+
cwd: import_node_path63.default.resolve(options.cwd ?? process.cwd()),
|
|
149044
149362
|
timeout: options.timeout,
|
|
149045
149363
|
...options.model === void 0 ? {} : { model: options.model },
|
|
149046
149364
|
...options.allowedTool === void 0 ? {} : { allowedTools: options.allowedTool }
|
|
@@ -149113,7 +149431,7 @@ function registerJobCommand(program2, deps) {
|
|
|
149113
149431
|
console.log(`Allowed tools: ${entry.allowedTools.join(", ")}`);
|
|
149114
149432
|
}
|
|
149115
149433
|
console.log(`Prompt: ${entry.prompt}`);
|
|
149116
|
-
console.log(`Results: ${
|
|
149434
|
+
console.log(`Results: ${import_node_path63.default.join(paths.jobLogsDir, `${name}.log`)}`);
|
|
149117
149435
|
}),
|
|
149118
149436
|
["agent-shim job show digest"]
|
|
149119
149437
|
);
|
|
@@ -149136,7 +149454,7 @@ function registerJobCommand(program2, deps) {
|
|
|
149136
149454
|
throw new UsageError(`No member of the job's pool can be picked right now.`);
|
|
149137
149455
|
}
|
|
149138
149456
|
await createRealJobRunner({ paths, spawnDaemon: spawnDetachedSupervisor, fs: realFarmFs, now: () => /* @__PURE__ */ new Date() })(name, identity, entry);
|
|
149139
|
-
console.log(`Ran job "${name}" as ${identity}; the result is in ${
|
|
149457
|
+
console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path63.default.join(paths.jobLogsDir, `${name}.log`)}.`);
|
|
149140
149458
|
}),
|
|
149141
149459
|
["agent-shim job run digest"]
|
|
149142
149460
|
);
|
|
@@ -149300,7 +149618,7 @@ init_providerAliases();
|
|
|
149300
149618
|
|
|
149301
149619
|
// src/providerRename.ts
|
|
149302
149620
|
var import_node_fs26 = __toESM(require("node:fs"), 1);
|
|
149303
|
-
var
|
|
149621
|
+
var import_node_path64 = __toESM(require("node:path"), 1);
|
|
149304
149622
|
init_schema();
|
|
149305
149623
|
init_store();
|
|
149306
149624
|
init_load();
|
|
@@ -149417,7 +149735,7 @@ function rewriteReferences(paths, from, to2) {
|
|
|
149417
149735
|
const launch = renamedLaunch(profile.launch, from, to2);
|
|
149418
149736
|
const models = profile.models === void 0 ? void 0 : renamedModels(profile.models, from, to2);
|
|
149419
149737
|
if (launch !== void 0 || models !== void 0) {
|
|
149420
|
-
applyPatch(
|
|
149738
|
+
applyPatch(import_node_path64.default.join(paths.configProfilesDir, `${name}.json`), ConfigProfileSchema, { ...launch === void 0 ? {} : { launch }, ...models === void 0 ? {} : { models } });
|
|
149421
149739
|
rewritten.push(`profile ${name}`);
|
|
149422
149740
|
}
|
|
149423
149741
|
}
|
|
@@ -150244,7 +150562,7 @@ function registerSessionCommands(program2, deps) {
|
|
|
150244
150562
|
}
|
|
150245
150563
|
|
|
150246
150564
|
// src/usage/commands.ts
|
|
150247
|
-
var
|
|
150565
|
+
var import_node_path65 = __toESM(require("node:path"), 1);
|
|
150248
150566
|
init_commandDeps();
|
|
150249
150567
|
init_realPorts();
|
|
150250
150568
|
init_account();
|
|
@@ -150383,7 +150701,7 @@ function collectAccounts(fs30, paths, identity, probe) {
|
|
|
150383
150701
|
return names.map((name) => ({
|
|
150384
150702
|
identity: name,
|
|
150385
150703
|
account: readAccountMetadata(fs30, paths.identitiesDir, name),
|
|
150386
|
-
signIn: identitySignIn(fs30, probe, { farmRoot:
|
|
150704
|
+
signIn: identitySignIn(fs30, probe, { farmRoot: import_node_path65.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
|
|
150387
150705
|
usage: readUsageSnapshot(fs30, paths.usageSnapshotsDir, name)
|
|
150388
150706
|
}));
|
|
150389
150707
|
}
|
|
@@ -150720,8 +151038,8 @@ function createRealCompactor(params) {
|
|
|
150720
151038
|
sizes = boundarySizes(message);
|
|
150721
151039
|
}
|
|
150722
151040
|
if (message.type === "result") {
|
|
150723
|
-
const
|
|
150724
|
-
return sizes === void 0 ? { kind: "unchanged", reason:
|
|
151041
|
+
const text4 = successfulResult(message);
|
|
151042
|
+
return sizes === void 0 ? { kind: "unchanged", reason: text4 === "" ? "nothing was compacted" : text4 } : { kind: "compacted", ...sizes };
|
|
150725
151043
|
}
|
|
150726
151044
|
}
|
|
150727
151045
|
throw new Error("the compaction ended without a result");
|
|
@@ -150790,7 +151108,7 @@ function quotaHitOf(fs30, paths, identity, sessionId, sinceMs, nowMs) {
|
|
|
150790
151108
|
}
|
|
150791
151109
|
|
|
150792
151110
|
// src/supervise/move.ts
|
|
150793
|
-
var
|
|
151111
|
+
var import_node_path66 = __toESM(require("node:path"), 1);
|
|
150794
151112
|
init_lock();
|
|
150795
151113
|
init_poolPick();
|
|
150796
151114
|
init_read();
|
|
@@ -150836,7 +151154,7 @@ function createMover(deps) {
|
|
|
150836
151154
|
if (resolution.identity === request7.from) {
|
|
150837
151155
|
return { kind: "stay", reason: `no other member of pool "${pool}" can take it` };
|
|
150838
151156
|
}
|
|
150839
|
-
const transcript =
|
|
151157
|
+
const transcript = import_node_path66.default.join(paths.identitiesDir, resolution.identity, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
|
|
150840
151158
|
if (farmFs.lstat(transcript)?.kind !== "file") {
|
|
150841
151159
|
return { kind: "stay", reason: `${resolution.identity} does not share this conversation's history, so it could not resume it` };
|
|
150842
151160
|
}
|
|
@@ -150870,13 +151188,13 @@ function createIdentityMover(deps) {
|
|
|
150870
151188
|
throw error63;
|
|
150871
151189
|
}
|
|
150872
151190
|
try {
|
|
150873
|
-
if (farmFs.readFileUtf8(
|
|
151191
|
+
if (farmFs.readFileUtf8(import_node_path66.default.join(paths.identitiesDir, request7.to, "identity.json")) === void 0) {
|
|
150874
151192
|
return { kind: "stay", reason: `no identity "${request7.to}"` };
|
|
150875
151193
|
}
|
|
150876
151194
|
if (request7.to === request7.from) {
|
|
150877
151195
|
return { kind: "stay", reason: `the model already runs under this session's identity` };
|
|
150878
151196
|
}
|
|
150879
|
-
const transcript =
|
|
151197
|
+
const transcript = import_node_path66.default.join(paths.identitiesDir, request7.to, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
|
|
150880
151198
|
if (farmFs.lstat(transcript)?.kind !== "file") {
|
|
150881
151199
|
return { kind: "stay", reason: `${request7.to} does not share this conversation's history, so it could not resume it` };
|
|
150882
151200
|
}
|
|
@@ -151454,7 +151772,7 @@ async function runClaude(argvOverride) {
|
|
|
151454
151772
|
// src/cli.ts
|
|
151455
151773
|
async function main() {
|
|
151456
151774
|
aliasLegacyEnv(process.env);
|
|
151457
|
-
const invokedName =
|
|
151775
|
+
const invokedName = import_node_path67.default.basename(process.argv[1] ?? "agent-shim");
|
|
151458
151776
|
if (isInvokedAsClaude(invokedName)) {
|
|
151459
151777
|
await runClaude();
|
|
151460
151778
|
return;
|