claude-use 11.69.0 → 11.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +788 -607
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +4 -4
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -319,10 +319,10 @@ function mergeDefs(...defs) {
|
|
|
319
319
|
function cloneDef(schema) {
|
|
320
320
|
return mergeDefs(schema._zod.def);
|
|
321
321
|
}
|
|
322
|
-
function getElementAtPath(obj,
|
|
323
|
-
if (!
|
|
322
|
+
function getElementAtPath(obj, path73) {
|
|
323
|
+
if (!path73)
|
|
324
324
|
return obj;
|
|
325
|
-
return
|
|
325
|
+
return path73.reduce((acc, key) => acc?.[key], obj);
|
|
326
326
|
}
|
|
327
327
|
function promiseAllObject(promisesObj) {
|
|
328
328
|
const keys = Object.keys(promisesObj);
|
|
@@ -581,11 +581,11 @@ function explicitlyAborted(x, startIndex = 0) {
|
|
|
581
581
|
}
|
|
582
582
|
return false;
|
|
583
583
|
}
|
|
584
|
-
function prefixIssues(
|
|
584
|
+
function prefixIssues(path73, issues) {
|
|
585
585
|
return issues.map((iss) => {
|
|
586
586
|
var _a4;
|
|
587
587
|
(_a4 = iss).path ?? (_a4.path = []);
|
|
588
|
-
iss.path.unshift(
|
|
588
|
+
iss.path.unshift(path73);
|
|
589
589
|
return iss;
|
|
590
590
|
});
|
|
591
591
|
}
|
|
@@ -1118,16 +1118,16 @@ function flattenError(error63, mapper = (issue2) => issue2.message) {
|
|
|
1118
1118
|
}
|
|
1119
1119
|
function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
1120
1120
|
const fieldErrors = { _errors: [] };
|
|
1121
|
-
const processError = (error64,
|
|
1121
|
+
const processError = (error64, path73 = []) => {
|
|
1122
1122
|
for (const issue2 of error64.issues) {
|
|
1123
1123
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1124
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1124
|
+
issue2.errors.map((issues) => processError({ issues }, [...path73, ...issue2.path]));
|
|
1125
1125
|
} else if (issue2.code === "invalid_key") {
|
|
1126
|
-
processError({ issues: issue2.issues }, [...
|
|
1126
|
+
processError({ issues: issue2.issues }, [...path73, ...issue2.path]);
|
|
1127
1127
|
} else if (issue2.code === "invalid_element") {
|
|
1128
|
-
processError({ issues: issue2.issues }, [...
|
|
1128
|
+
processError({ issues: issue2.issues }, [...path73, ...issue2.path]);
|
|
1129
1129
|
} else {
|
|
1130
|
-
const fullpath = [...
|
|
1130
|
+
const fullpath = [...path73, ...issue2.path];
|
|
1131
1131
|
if (fullpath.length === 0) {
|
|
1132
1132
|
fieldErrors._errors.push(mapper(issue2));
|
|
1133
1133
|
} else {
|
|
@@ -1166,17 +1166,17 @@ function formatError(error63, mapper = (issue2) => issue2.message) {
|
|
|
1166
1166
|
}
|
|
1167
1167
|
function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
1168
1168
|
const result = { errors: [] };
|
|
1169
|
-
const processError = (error64,
|
|
1169
|
+
const processError = (error64, path73 = []) => {
|
|
1170
1170
|
var _a4;
|
|
1171
1171
|
for (const issue2 of error64.issues) {
|
|
1172
1172
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
1173
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
1173
|
+
issue2.errors.map((issues) => processError({ issues }, [...path73, ...issue2.path]));
|
|
1174
1174
|
} else if (issue2.code === "invalid_key") {
|
|
1175
|
-
processError({ issues: issue2.issues }, [...
|
|
1175
|
+
processError({ issues: issue2.issues }, [...path73, ...issue2.path]);
|
|
1176
1176
|
} else if (issue2.code === "invalid_element") {
|
|
1177
|
-
processError({ issues: issue2.issues }, [...
|
|
1177
|
+
processError({ issues: issue2.issues }, [...path73, ...issue2.path]);
|
|
1178
1178
|
} else {
|
|
1179
|
-
const fullpath = [...
|
|
1179
|
+
const fullpath = [...path73, ...issue2.path];
|
|
1180
1180
|
if (fullpath.length === 0) {
|
|
1181
1181
|
result.errors.push(mapper(issue2));
|
|
1182
1182
|
continue;
|
|
@@ -1215,8 +1215,8 @@ function treeifyError(error63, mapper = (issue2) => issue2.message) {
|
|
|
1215
1215
|
}
|
|
1216
1216
|
function toDotPath(_path) {
|
|
1217
1217
|
const segs = [];
|
|
1218
|
-
const
|
|
1219
|
-
for (const seg of
|
|
1218
|
+
const path73 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
1219
|
+
for (const seg of path73) {
|
|
1220
1220
|
if (typeof seg === "number")
|
|
1221
1221
|
segs.push(`[${seg}]`);
|
|
1222
1222
|
else if (typeof seg === "symbol")
|
|
@@ -19248,13 +19248,13 @@ function resolveRef(ref, ctx) {
|
|
|
19248
19248
|
if (!ref.startsWith("#")) {
|
|
19249
19249
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
19250
19250
|
}
|
|
19251
|
-
const
|
|
19252
|
-
if (
|
|
19251
|
+
const path73 = ref.slice(1).split("/").filter(Boolean);
|
|
19252
|
+
if (path73.length === 0) {
|
|
19253
19253
|
return ctx.rootSchema;
|
|
19254
19254
|
}
|
|
19255
19255
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
19256
|
-
if (
|
|
19257
|
-
const key =
|
|
19256
|
+
if (path73[0] === defsKey) {
|
|
19257
|
+
const key = path73[1] === void 0 ? void 0 : decodeJSONPointerSegment(path73[1]);
|
|
19258
19258
|
if (!key || !ctx.defs[key]) {
|
|
19259
19259
|
throw new Error(`Reference not found: ${ref}`);
|
|
19260
19260
|
}
|
|
@@ -20551,7 +20551,7 @@ var init_commandDeps = __esm({
|
|
|
20551
20551
|
var require_common = __commonJS({
|
|
20552
20552
|
"node_modules/.pnpm/js-yaml@4.3.2/node_modules/js-yaml/lib/common.js"(exports2, module2) {
|
|
20553
20553
|
"use strict";
|
|
20554
|
-
function
|
|
20554
|
+
function isNothing2(subject) {
|
|
20555
20555
|
return typeof subject === "undefined" || subject === null;
|
|
20556
20556
|
}
|
|
20557
20557
|
function isObject5(subject) {
|
|
@@ -20559,7 +20559,7 @@ var require_common = __commonJS({
|
|
|
20559
20559
|
}
|
|
20560
20560
|
function toArray2(sequence2) {
|
|
20561
20561
|
if (Array.isArray(sequence2)) return sequence2;
|
|
20562
|
-
else if (
|
|
20562
|
+
else if (isNothing2(sequence2)) return [];
|
|
20563
20563
|
return [sequence2];
|
|
20564
20564
|
}
|
|
20565
20565
|
function extend2(target, source) {
|
|
@@ -20582,7 +20582,7 @@ var require_common = __commonJS({
|
|
|
20582
20582
|
function isNegativeZero(number6) {
|
|
20583
20583
|
return number6 === 0 && Number.NEGATIVE_INFINITY === 1 / number6;
|
|
20584
20584
|
}
|
|
20585
|
-
module2.exports.isNothing =
|
|
20585
|
+
module2.exports.isNothing = isNothing2;
|
|
20586
20586
|
module2.exports.isObject = isObject5;
|
|
20587
20587
|
module2.exports.toArray = toArray2;
|
|
20588
20588
|
module2.exports.repeat = repeat;
|
|
@@ -23761,42 +23761,42 @@ var require_defaults = __commonJS({
|
|
|
23761
23761
|
var require_env_paths = __commonJS({
|
|
23762
23762
|
"node_modules/.pnpm/env-paths@2.2.1/node_modules/env-paths/index.js"(exports2, module2) {
|
|
23763
23763
|
"use strict";
|
|
23764
|
-
var
|
|
23764
|
+
var path73 = require("path");
|
|
23765
23765
|
var os14 = require("os");
|
|
23766
23766
|
var homedir = os14.homedir();
|
|
23767
23767
|
var tmpdir = os14.tmpdir();
|
|
23768
23768
|
var { env } = process;
|
|
23769
23769
|
var macos = (name) => {
|
|
23770
|
-
const library =
|
|
23770
|
+
const library = path73.join(homedir, "Library");
|
|
23771
23771
|
return {
|
|
23772
|
-
data:
|
|
23773
|
-
config:
|
|
23774
|
-
cache:
|
|
23775
|
-
log:
|
|
23776
|
-
temp:
|
|
23772
|
+
data: path73.join(library, "Application Support", name),
|
|
23773
|
+
config: path73.join(library, "Preferences", name),
|
|
23774
|
+
cache: path73.join(library, "Caches", name),
|
|
23775
|
+
log: path73.join(library, "Logs", name),
|
|
23776
|
+
temp: path73.join(tmpdir, name)
|
|
23777
23777
|
};
|
|
23778
23778
|
};
|
|
23779
23779
|
var windows = (name) => {
|
|
23780
|
-
const appData = env.APPDATA ||
|
|
23781
|
-
const localAppData = env.LOCALAPPDATA ||
|
|
23780
|
+
const appData = env.APPDATA || path73.join(homedir, "AppData", "Roaming");
|
|
23781
|
+
const localAppData = env.LOCALAPPDATA || path73.join(homedir, "AppData", "Local");
|
|
23782
23782
|
return {
|
|
23783
23783
|
// Data/config/cache/log are invented by me as Windows isn't opinionated about this
|
|
23784
|
-
data:
|
|
23785
|
-
config:
|
|
23786
|
-
cache:
|
|
23787
|
-
log:
|
|
23788
|
-
temp:
|
|
23784
|
+
data: path73.join(localAppData, name, "Data"),
|
|
23785
|
+
config: path73.join(appData, name, "Config"),
|
|
23786
|
+
cache: path73.join(localAppData, name, "Cache"),
|
|
23787
|
+
log: path73.join(localAppData, name, "Log"),
|
|
23788
|
+
temp: path73.join(tmpdir, name)
|
|
23789
23789
|
};
|
|
23790
23790
|
};
|
|
23791
23791
|
var linux = (name) => {
|
|
23792
|
-
const username =
|
|
23792
|
+
const username = path73.basename(homedir);
|
|
23793
23793
|
return {
|
|
23794
|
-
data:
|
|
23795
|
-
config:
|
|
23796
|
-
cache:
|
|
23794
|
+
data: path73.join(env.XDG_DATA_HOME || path73.join(homedir, ".local", "share"), name),
|
|
23795
|
+
config: path73.join(env.XDG_CONFIG_HOME || path73.join(homedir, ".config"), name),
|
|
23796
|
+
cache: path73.join(env.XDG_CACHE_HOME || path73.join(homedir, ".cache"), name),
|
|
23797
23797
|
// https://wiki.debian.org/XDGBaseDirectorySpecification#state
|
|
23798
|
-
log:
|
|
23799
|
-
temp:
|
|
23798
|
+
log: path73.join(env.XDG_STATE_HOME || path73.join(homedir, ".local", "state"), name),
|
|
23799
|
+
temp: path73.join(tmpdir, username, name)
|
|
23800
23800
|
};
|
|
23801
23801
|
};
|
|
23802
23802
|
var envPaths = (name, options) => {
|
|
@@ -23864,11 +23864,11 @@ var require_util = __commonJS({
|
|
|
23864
23864
|
return result;
|
|
23865
23865
|
}
|
|
23866
23866
|
exports2.emplace = emplace;
|
|
23867
|
-
function getPropertyByPath(source,
|
|
23868
|
-
if (typeof
|
|
23869
|
-
return source[
|
|
23867
|
+
function getPropertyByPath(source, path73) {
|
|
23868
|
+
if (typeof path73 === "string" && Object.prototype.hasOwnProperty.call(source, path73)) {
|
|
23869
|
+
return source[path73];
|
|
23870
23870
|
}
|
|
23871
|
-
const parsedPath = typeof
|
|
23871
|
+
const parsedPath = typeof path73 === "string" ? path73.split(".") : path73;
|
|
23872
23872
|
return parsedPath.reduce((previous, key) => {
|
|
23873
23873
|
if (previous === void 0) {
|
|
23874
23874
|
return previous;
|
|
@@ -23891,9 +23891,9 @@ var require_util = __commonJS({
|
|
|
23891
23891
|
return Object.fromEntries(Object.entries(options).filter(([, value2]) => value2 !== void 0));
|
|
23892
23892
|
}
|
|
23893
23893
|
exports2.removeUndefinedValuesFromObject = removeUndefinedValuesFromObject;
|
|
23894
|
-
async function isDirectory(
|
|
23894
|
+
async function isDirectory(path73) {
|
|
23895
23895
|
try {
|
|
23896
|
-
const stat = await fs_1.promises.stat(
|
|
23896
|
+
const stat = await fs_1.promises.stat(path73);
|
|
23897
23897
|
return stat.isDirectory();
|
|
23898
23898
|
} catch (e14) {
|
|
23899
23899
|
if (e14.code === "ENOENT") {
|
|
@@ -23903,9 +23903,9 @@ var require_util = __commonJS({
|
|
|
23903
23903
|
}
|
|
23904
23904
|
}
|
|
23905
23905
|
exports2.isDirectory = isDirectory;
|
|
23906
|
-
function isDirectorySync(
|
|
23906
|
+
function isDirectorySync(path73) {
|
|
23907
23907
|
try {
|
|
23908
|
-
const stat = fs_1.default.statSync(
|
|
23908
|
+
const stat = fs_1.default.statSync(path73);
|
|
23909
23909
|
return stat.isDirectory();
|
|
23910
23910
|
} catch (e14) {
|
|
23911
23911
|
if (e14.code === "ENOENT") {
|
|
@@ -24003,7 +24003,7 @@ var require_ExplorerBase = __commonJS({
|
|
|
24003
24003
|
const idx = importStack.indexOf(fullPath);
|
|
24004
24004
|
if (idx !== -1) {
|
|
24005
24005
|
throw new Error(`Circular import detected:
|
|
24006
|
-
${[...importStack, fullPath].map((
|
|
24006
|
+
${[...importStack, fullPath].map((path73, i10) => `${i10 + 1}. ${path73}`).join("\n")} (same as ${idx + 1}.)`);
|
|
24007
24007
|
}
|
|
24008
24008
|
}
|
|
24009
24009
|
}
|
|
@@ -24191,9 +24191,9 @@ var require_Explorer = __commonJS({
|
|
|
24191
24191
|
throw error63;
|
|
24192
24192
|
}
|
|
24193
24193
|
}
|
|
24194
|
-
async #fileExists(
|
|
24194
|
+
async #fileExists(path73) {
|
|
24195
24195
|
try {
|
|
24196
|
-
await promises_1.default.stat(
|
|
24196
|
+
await promises_1.default.stat(path73);
|
|
24197
24197
|
return true;
|
|
24198
24198
|
} catch (e14) {
|
|
24199
24199
|
return false;
|
|
@@ -24353,9 +24353,9 @@ var require_ExplorerSync = __commonJS({
|
|
|
24353
24353
|
throw error63;
|
|
24354
24354
|
}
|
|
24355
24355
|
}
|
|
24356
|
-
#fileExists(
|
|
24356
|
+
#fileExists(path73) {
|
|
24357
24357
|
try {
|
|
24358
|
-
fs_1.default.statSync(
|
|
24358
|
+
fs_1.default.statSync(path73);
|
|
24359
24359
|
return true;
|
|
24360
24360
|
} catch (e14) {
|
|
24361
24361
|
return false;
|
|
@@ -24479,7 +24479,7 @@ var require_dist = __commonJS({
|
|
|
24479
24479
|
};
|
|
24480
24480
|
}
|
|
24481
24481
|
function getResolvedSearchPlaces(moduleName, toolDefinedSearchPlaces, userConfiguredOptions) {
|
|
24482
|
-
const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((
|
|
24482
|
+
const userConfiguredSearchPlaces = userConfiguredOptions.searchPlaces?.map((path73) => path73.replace("{name}", moduleName));
|
|
24483
24483
|
if (userConfiguredOptions.mergeSearchPlaces) {
|
|
24484
24484
|
return [...userConfiguredSearchPlaces ?? [], ...toolDefinedSearchPlaces];
|
|
24485
24485
|
}
|
|
@@ -24609,7 +24609,7 @@ function parseIgnoringUnrecognisedKeys(schema, raw) {
|
|
|
24609
24609
|
return second.success ? { success: true, data: second.data, ignored } : { success: false, issues: second.error.issues };
|
|
24610
24610
|
}
|
|
24611
24611
|
function describeIgnoredKeys(filePath, ignored) {
|
|
24612
|
-
const places = ignored.map(({ path:
|
|
24612
|
+
const places = ignored.map(({ path: path73, keys }) => `${path73.length === 0 ? "" : `${path73.map(String).join(".")}.`}${keys.join(", ")}`);
|
|
24613
24613
|
return `${filePath} has settings this version of agent-shim does not know and ignores: ${places.join("; ")}. A newer release may read them.`;
|
|
24614
24614
|
}
|
|
24615
24615
|
function noteIgnoredKeys(filePath, ignored) {
|
|
@@ -24630,10 +24630,10 @@ function restoreIgnoredKeys(filePath, value2) {
|
|
|
24630
24630
|
if (ignored === void 0) {
|
|
24631
24631
|
return value2;
|
|
24632
24632
|
}
|
|
24633
|
-
const
|
|
24634
|
-
for (const { path:
|
|
24635
|
-
let holder =
|
|
24636
|
-
for (const step2 of
|
|
24633
|
+
const restored2 = structuredClone(value2);
|
|
24634
|
+
for (const { path: path73, values } of ignored) {
|
|
24635
|
+
let holder = restored2;
|
|
24636
|
+
for (const step2 of path73) {
|
|
24637
24637
|
holder = isRecord(holder) ? holder[step2] : void 0;
|
|
24638
24638
|
}
|
|
24639
24639
|
if (isRecord(holder)) {
|
|
@@ -24642,7 +24642,7 @@ function restoreIgnoredKeys(filePath, value2) {
|
|
|
24642
24642
|
}
|
|
24643
24643
|
}
|
|
24644
24644
|
}
|
|
24645
|
-
return
|
|
24645
|
+
return restored2;
|
|
24646
24646
|
}
|
|
24647
24647
|
var warned, ignoredByFile;
|
|
24648
24648
|
var init_unrecognisedKeys = __esm({
|
|
@@ -25681,10 +25681,10 @@ var init_statusline = __esm({
|
|
|
25681
25681
|
breakdownAt: wholePercent.optional().describe(
|
|
25682
25682
|
"The whole percentage of the context window from which the token breakdown appears, with context.breakdown set to critical; while it is unset the breakdown appears from context.criticalAt. The percentage is rounded to a whole number before it is compared with this, as claude-hud rounds it, so a reading within half a point below counts as at it. It need not relate to context.warnAt or context.criticalAt, since it decides when a piece of information is shown and not a colour, so it may sit below, at or above either."
|
|
25683
25683
|
),
|
|
25684
|
-
autoCompactWindow: external_exports.number().int().positive().optional().describe("A window in tokens to measure the context against instead of the model's, matching the figure /context gives once Claude Code compacts before the window is full. While it is set, the row draws nothing
|
|
25685
|
-
estimate: external_exports.enum(STATUSLINE_CONTEXT_ESTIMATES).describe(`What to draw when the client reports no percentage of the window in use (a negative one counts as none), or reports 0 while tokens are already held (which is how a client says it has not worked it out yet): never (nothing is estimated: a percentage reported from 0 to 100 is drawn as it is, one above 100 as 100, and a negative or missing one draws nothing), raw (the tokens held over the window), or buffered (that, plus the ${String(AUTOCOMPACT_RESERVE_FRACTION * MAX_PERCENT)}% of the window Claude Code reserves for compaction, rising from nothing at ${String(AUTOCOMPACT_RESERVE_RAMP_START * MAX_PERCENT)}% of the window held to the whole reserve at ${String(AUTOCOMPACT_RESERVE_RAMP_END * MAX_PERCENT)}%).`),
|
|
25684
|
+
autoCompactWindow: external_exports.number().int().positive().optional().describe("A window in tokens to measure the context against instead of the model's, matching the figure /context gives once Claude Code compacts before the window is full. While it is set, the row draws nothing from a frame whose tokens held (total_input_tokens) are absent (missing, or not a finite number of 0 or more), since without them there is nothing to measure against it, and measures a frame reporting 0 as 0% (a frame reporting no use may first be given the session's last good frame, its tokens held included); while it is unset the model's own window is used."),
|
|
25685
|
+
estimate: external_exports.enum(STATUSLINE_CONTEXT_ESTIMATES).describe(`What to draw when the client reports no percentage of the window in use (a negative one counts as none), or reports 0 while tokens are already held (which is how a client says it has not worked it out yet): never (nothing is estimated: a percentage reported from 0 to 100 is drawn as it is, one above 100 as 100, and a negative or missing one draws nothing), raw (the tokens held over the window), or buffered (that, plus the ${String(AUTOCOMPACT_RESERVE_FRACTION * MAX_PERCENT)}% of the window Claude Code reserves for compaction, rising from nothing at ${String(AUTOCOMPACT_RESERVE_RAMP_START * MAX_PERCENT)}% of the window held to the whole reserve at ${String(AUTOCOMPACT_RESERVE_RAMP_END * MAX_PERCENT)}%). This applies to the frame the row draws: a frame reporting no use may first be given the session's last good frame or the percentage its newest compaction left.`),
|
|
25686
25686
|
breakdown: external_exports.enum(["never", "critical"]).describe(
|
|
25687
|
-
"Whether to add the input and cache tokens of the last request to the context row: critical adds them once the percentage the row draws (the one the
|
|
25687
|
+
"Whether to add the input and cache tokens of the last request to the context row: critical adds them once the percentage the row draws (for the frame it draws, which context.estimate describes: the one the frame reports, or the estimate context.estimate makes, or, with context.autoCompactWindow set, the tokens held over that window), rounded to a whole number, reaches the breakdown threshold, which is context.breakdownAt, or context.criticalAt while that is unset, and never leaves them off. With no percentage to draw the row draws nothing, and the breakdown is of the last request the frame the row draws reports, so a frame given the session's last good frame draws, for instance, that frame's, and there is none to add while the frame drawn reports no last request."
|
|
25688
25688
|
)
|
|
25689
25689
|
},
|
|
25690
25690
|
customLine: {
|
|
@@ -31145,8 +31145,8 @@ var require_utils = __commonJS({
|
|
|
31145
31145
|
}
|
|
31146
31146
|
return output2;
|
|
31147
31147
|
};
|
|
31148
|
-
exports2.basename = (
|
|
31149
|
-
const segs =
|
|
31148
|
+
exports2.basename = (path73, { windows } = {}) => {
|
|
31149
|
+
const segs = path73.split(windows ? /[\\/]/ : "/");
|
|
31150
31150
|
const last = segs[segs.length - 1];
|
|
31151
31151
|
if (last === "") {
|
|
31152
31152
|
return segs[segs.length - 2];
|
|
@@ -32926,9 +32926,9 @@ var init_identity = __esm({
|
|
|
32926
32926
|
});
|
|
32927
32927
|
|
|
32928
32928
|
// src/statusline/keys.ts
|
|
32929
|
-
function valueAt(source,
|
|
32929
|
+
function valueAt(source, path73) {
|
|
32930
32930
|
let current = source;
|
|
32931
|
-
for (const part of
|
|
32931
|
+
for (const part of path73) {
|
|
32932
32932
|
if (!isPlainObject2(current)) {
|
|
32933
32933
|
return void 0;
|
|
32934
32934
|
}
|
|
@@ -32936,14 +32936,14 @@ function valueAt(source, path72) {
|
|
|
32936
32936
|
}
|
|
32937
32937
|
return current;
|
|
32938
32938
|
}
|
|
32939
|
-
function acceptsNull(
|
|
32940
|
-
const layer =
|
|
32939
|
+
function acceptsNull(path73) {
|
|
32940
|
+
const layer = path73.reduceRight((inner, part) => ({ [part]: inner }), null);
|
|
32941
32941
|
return StatuslineSchema.safeParse(layer).success;
|
|
32942
32942
|
}
|
|
32943
|
-
function keyOf(
|
|
32943
|
+
function keyOf(path73, declared) {
|
|
32944
32944
|
const optional2 = declared instanceof external_exports.ZodOptional;
|
|
32945
32945
|
const leaf = optional2 ? declared.unwrap() : declared;
|
|
32946
|
-
const common = { path:
|
|
32946
|
+
const common = { path: path73.join("."), description: declared.description ?? "", defaultValue: valueAt(STATUSLINE_DEFAULTS, path73), optional: optional2, unsettable: acceptsNull(path73) };
|
|
32947
32947
|
if (leaf instanceof external_exports.ZodNumber) {
|
|
32948
32948
|
return { ...common, kind: "integer", choices: [] };
|
|
32949
32949
|
}
|
|
@@ -32968,7 +32968,7 @@ function keyOf(path72, declared) {
|
|
|
32968
32968
|
if (leaf instanceof external_exports.ZodArray && leaf.element instanceof external_exports.ZodString) {
|
|
32969
32969
|
return { ...common, kind: "textList", choices: [] };
|
|
32970
32970
|
}
|
|
32971
|
-
throw new TypeError(`statusline setting ${
|
|
32971
|
+
throw new TypeError(`statusline setting ${path73.join(".")} has a kind the key listing does not describe`);
|
|
32972
32972
|
}
|
|
32973
32973
|
function walk(shape, prefix) {
|
|
32974
32974
|
return Object.entries(shape).flatMap(([name, schema]) => schema instanceof external_exports.ZodObject ? walk(schema.shape, [...prefix, name]) : [keyOf([...prefix, name], schema)]);
|
|
@@ -32999,14 +32999,14 @@ var init_keys = __esm({
|
|
|
32999
32999
|
});
|
|
33000
33000
|
|
|
33001
33001
|
// src/statusline/change.ts
|
|
33002
|
-
function keyNamed(
|
|
33003
|
-
const found = statuslineKeys().find((key) => key.path ===
|
|
33002
|
+
function keyNamed(path73) {
|
|
33003
|
+
const found = statuslineKeys().find((key) => key.path === path73);
|
|
33004
33004
|
if (found === void 0) {
|
|
33005
|
-
throw new UsageError(`"${
|
|
33005
|
+
throw new UsageError(`"${path73}" is not a statusline setting; \`agent-shim statusline keys\` lists them.`);
|
|
33006
33006
|
}
|
|
33007
33007
|
return found;
|
|
33008
33008
|
}
|
|
33009
|
-
function textListOf(
|
|
33009
|
+
function textListOf(path73, raw) {
|
|
33010
33010
|
if (raw === "") {
|
|
33011
33011
|
return [];
|
|
33012
33012
|
}
|
|
@@ -33014,10 +33014,10 @@ function textListOf(path72, raw) {
|
|
|
33014
33014
|
try {
|
|
33015
33015
|
parsed = JSON.parse(raw);
|
|
33016
33016
|
} catch {
|
|
33017
|
-
throw new UsageError(`${
|
|
33017
|
+
throw new UsageError(`${path73}: "${raw}" is not a JSON array of strings such as ["git","describe"].`);
|
|
33018
33018
|
}
|
|
33019
33019
|
if (!Array.isArray(parsed) || parsed.some((item) => typeof item !== "string")) {
|
|
33020
|
-
throw new UsageError(`${
|
|
33020
|
+
throw new UsageError(`${path73}: "${raw}" is not a JSON array of strings such as ["git","describe"].`);
|
|
33021
33021
|
}
|
|
33022
33022
|
return parsed;
|
|
33023
33023
|
}
|
|
@@ -33026,42 +33026,42 @@ function parseStatuslineAssignment(text5) {
|
|
|
33026
33026
|
if (split < 1) {
|
|
33027
33027
|
throw new UsageError(`"${text5}" is not <setting>=<value>.`);
|
|
33028
33028
|
}
|
|
33029
|
-
const
|
|
33029
|
+
const path73 = text5.slice(0, split);
|
|
33030
33030
|
const raw = text5.slice(split + 1);
|
|
33031
|
-
const key = keyNamed(
|
|
33031
|
+
const key = keyNamed(path73);
|
|
33032
33032
|
if (key.unsettable && raw === UNSET_WORD) {
|
|
33033
|
-
return { path:
|
|
33033
|
+
return { path: path73, value: null };
|
|
33034
33034
|
}
|
|
33035
33035
|
switch (key.kind) {
|
|
33036
33036
|
case "integer": {
|
|
33037
33037
|
const number6 = Number(raw);
|
|
33038
33038
|
if (raw.trim() === "" || !Number.isFinite(number6)) {
|
|
33039
|
-
throw new UsageError(`${
|
|
33039
|
+
throw new UsageError(`${path73}: "${raw}" is not a number.`);
|
|
33040
33040
|
}
|
|
33041
|
-
return { path:
|
|
33041
|
+
return { path: path73, value: number6 };
|
|
33042
33042
|
}
|
|
33043
33043
|
case "boolean":
|
|
33044
33044
|
if (raw !== "true" && raw !== "false") {
|
|
33045
|
-
throw new UsageError(`${
|
|
33045
|
+
throw new UsageError(`${path73}: "${raw}" is not true or false.`);
|
|
33046
33046
|
}
|
|
33047
|
-
return { path:
|
|
33047
|
+
return { path: path73, value: raw === "true" };
|
|
33048
33048
|
case "text":
|
|
33049
33049
|
case "choice":
|
|
33050
|
-
return { path:
|
|
33050
|
+
return { path: path73, value: raw };
|
|
33051
33051
|
case "colour":
|
|
33052
|
-
return { path:
|
|
33052
|
+
return { path: path73, value: /^\d+$/.test(raw) ? Number(raw) : raw };
|
|
33053
33053
|
case "list":
|
|
33054
|
-
return { path:
|
|
33054
|
+
return { path: path73, value: raw === "" ? [] : raw.split(",") };
|
|
33055
33055
|
case "groups":
|
|
33056
|
-
return { path:
|
|
33056
|
+
return { path: path73, value: raw === "" ? [] : raw.split(";").map((group) => group.split(",")) };
|
|
33057
33057
|
case "textList":
|
|
33058
|
-
return { path:
|
|
33058
|
+
return { path: path73, value: textListOf(path73, raw) };
|
|
33059
33059
|
default:
|
|
33060
33060
|
return key.kind;
|
|
33061
33061
|
}
|
|
33062
33062
|
}
|
|
33063
|
-
function setAt(target,
|
|
33064
|
-
const [head, ...rest] =
|
|
33063
|
+
function setAt(target, path73, value2) {
|
|
33064
|
+
const [head, ...rest] = path73;
|
|
33065
33065
|
if (head === void 0) {
|
|
33066
33066
|
return;
|
|
33067
33067
|
}
|
|
@@ -33074,8 +33074,8 @@ function setAt(target, path72, value2) {
|
|
|
33074
33074
|
target[head] = next;
|
|
33075
33075
|
setAt(next, rest, value2);
|
|
33076
33076
|
}
|
|
33077
|
-
function removeAt(target,
|
|
33078
|
-
const [head, ...rest] =
|
|
33077
|
+
function removeAt(target, path73) {
|
|
33078
|
+
const [head, ...rest] = path73;
|
|
33079
33079
|
if (head === void 0) {
|
|
33080
33080
|
return;
|
|
33081
33081
|
}
|
|
@@ -33093,13 +33093,13 @@ function removeAt(target, path72) {
|
|
|
33093
33093
|
}
|
|
33094
33094
|
function applyStatuslineChange(existing, change) {
|
|
33095
33095
|
const draft = structuredClone(existing ?? {});
|
|
33096
|
-
for (const [
|
|
33097
|
-
keyNamed(
|
|
33098
|
-
setAt(draft,
|
|
33096
|
+
for (const [path73, value2] of Object.entries(change.set ?? {})) {
|
|
33097
|
+
keyNamed(path73);
|
|
33098
|
+
setAt(draft, path73.split("."), value2);
|
|
33099
33099
|
}
|
|
33100
|
-
for (const
|
|
33101
|
-
keyNamed(
|
|
33102
|
-
removeAt(draft,
|
|
33100
|
+
for (const path73 of change.unset ?? []) {
|
|
33101
|
+
keyNamed(path73);
|
|
33102
|
+
removeAt(draft, path73.split("."));
|
|
33103
33103
|
}
|
|
33104
33104
|
const result = StatuslineSchema.safeParse(draft);
|
|
33105
33105
|
if (!result.success) {
|
|
@@ -36589,11 +36589,11 @@ function identifyRequest(headers) {
|
|
|
36589
36589
|
function directOrigin2(port) {
|
|
36590
36590
|
return `http://127.0.0.1:${String(port)}`;
|
|
36591
36591
|
}
|
|
36592
|
-
function parseProviderPath(
|
|
36593
|
-
if (!
|
|
36592
|
+
function parseProviderPath(path73) {
|
|
36593
|
+
if (!path73.startsWith(PROVIDER_PATH_PREFIX)) {
|
|
36594
36594
|
return void 0;
|
|
36595
36595
|
}
|
|
36596
|
-
const tail =
|
|
36596
|
+
const tail = path73.slice(PROVIDER_PATH_PREFIX.length);
|
|
36597
36597
|
const slash = tail.indexOf("/");
|
|
36598
36598
|
if (slash <= 0) {
|
|
36599
36599
|
return void 0;
|
|
@@ -36894,8 +36894,8 @@ function parseConnectTarget(authority) {
|
|
|
36894
36894
|
}
|
|
36895
36895
|
return { host, port };
|
|
36896
36896
|
}
|
|
36897
|
-
function servedByPipeline(
|
|
36898
|
-
return
|
|
36897
|
+
function servedByPipeline(path73) {
|
|
36898
|
+
return path73?.startsWith(ROUTED_PATH_PREFIX) === true;
|
|
36899
36899
|
}
|
|
36900
36900
|
function forwardableHeaders(headers) {
|
|
36901
36901
|
const connectionTokens = new Set(
|
|
@@ -37387,7 +37387,7 @@ var init_package = __esm({
|
|
|
37387
37387
|
"package.json"() {
|
|
37388
37388
|
package_default = {
|
|
37389
37389
|
name: "claude-use",
|
|
37390
|
-
version: "11.
|
|
37390
|
+
version: "11.70.0",
|
|
37391
37391
|
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.",
|
|
37392
37392
|
license: "MIT",
|
|
37393
37393
|
author: "Joseph Mearman <joseph@mearman.co.uk>",
|
|
@@ -37910,12 +37910,12 @@ function decoderFor(encoding) {
|
|
|
37910
37910
|
return void 0;
|
|
37911
37911
|
}
|
|
37912
37912
|
}
|
|
37913
|
-
function destinationOf(
|
|
37914
|
-
const scoped = parseProviderPath(
|
|
37913
|
+
function destinationOf(path73, sessionProvider) {
|
|
37914
|
+
const scoped = parseProviderPath(path73);
|
|
37915
37915
|
if (scoped !== void 0) {
|
|
37916
37916
|
return { provider: scoped.provider, endpoint: scoped.rest };
|
|
37917
37917
|
}
|
|
37918
|
-
return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint:
|
|
37918
|
+
return { provider: sessionProvider ?? ANTHROPIC_PROVIDER, endpoint: path73 };
|
|
37919
37919
|
}
|
|
37920
37920
|
function modelChoiceOf(event, servedModel, provider) {
|
|
37921
37921
|
if (event.modelChoice !== void 0) return event.modelChoice;
|
|
@@ -40939,14 +40939,14 @@ var require_util2 = __commonJS({
|
|
|
40939
40939
|
}
|
|
40940
40940
|
const port = url2.port != null ? url2.port : url2.protocol === "https:" ? 443 : 80;
|
|
40941
40941
|
let origin = url2.origin != null ? url2.origin : `${url2.protocol || ""}//${url2.hostname || ""}:${port}`;
|
|
40942
|
-
let
|
|
40942
|
+
let path73 = url2.path != null ? url2.path : `${url2.pathname || ""}${url2.search || ""}`;
|
|
40943
40943
|
if (origin[origin.length - 1] === "/") {
|
|
40944
40944
|
origin = origin.slice(0, origin.length - 1);
|
|
40945
40945
|
}
|
|
40946
|
-
if (
|
|
40947
|
-
|
|
40946
|
+
if (path73 && path73[0] !== "/") {
|
|
40947
|
+
path73 = `/${path73}`;
|
|
40948
40948
|
}
|
|
40949
|
-
return new URL(`${origin}${
|
|
40949
|
+
return new URL(`${origin}${path73}`);
|
|
40950
40950
|
}
|
|
40951
40951
|
if (!isHttpOrHttpsPrefixed(url2.origin || url2.protocol)) {
|
|
40952
40952
|
throw new InvalidArgumentError2("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -41767,9 +41767,9 @@ var require_diagnostics = __commonJS({
|
|
|
41767
41767
|
"undici:client:sendHeaders",
|
|
41768
41768
|
(evt) => {
|
|
41769
41769
|
const {
|
|
41770
|
-
request: { method, path:
|
|
41770
|
+
request: { method, path: path73, origin }
|
|
41771
41771
|
} = evt;
|
|
41772
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
41772
|
+
debugLog("sending request to %s %s%s", method, origin, path73);
|
|
41773
41773
|
}
|
|
41774
41774
|
);
|
|
41775
41775
|
}
|
|
@@ -41787,14 +41787,14 @@ var require_diagnostics = __commonJS({
|
|
|
41787
41787
|
"undici:request:headers",
|
|
41788
41788
|
(evt) => {
|
|
41789
41789
|
const {
|
|
41790
|
-
request: { method, path:
|
|
41790
|
+
request: { method, path: path73, origin },
|
|
41791
41791
|
response: { statusCode }
|
|
41792
41792
|
} = evt;
|
|
41793
41793
|
debugLog(
|
|
41794
41794
|
"received response to %s %s%s - HTTP %d",
|
|
41795
41795
|
method,
|
|
41796
41796
|
origin,
|
|
41797
|
-
|
|
41797
|
+
path73,
|
|
41798
41798
|
statusCode
|
|
41799
41799
|
);
|
|
41800
41800
|
}
|
|
@@ -41803,23 +41803,23 @@ var require_diagnostics = __commonJS({
|
|
|
41803
41803
|
"undici:request:trailers",
|
|
41804
41804
|
(evt) => {
|
|
41805
41805
|
const {
|
|
41806
|
-
request: { method, path:
|
|
41806
|
+
request: { method, path: path73, origin }
|
|
41807
41807
|
} = evt;
|
|
41808
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
41808
|
+
debugLog("trailers received from %s %s%s", method, origin, path73);
|
|
41809
41809
|
}
|
|
41810
41810
|
);
|
|
41811
41811
|
diagnosticsChannel.subscribe(
|
|
41812
41812
|
"undici:request:error",
|
|
41813
41813
|
(evt) => {
|
|
41814
41814
|
const {
|
|
41815
|
-
request: { method, path:
|
|
41815
|
+
request: { method, path: path73, origin },
|
|
41816
41816
|
error: error63
|
|
41817
41817
|
} = evt;
|
|
41818
41818
|
debugLog(
|
|
41819
41819
|
"request to %s %s%s errored - %s",
|
|
41820
41820
|
method,
|
|
41821
41821
|
origin,
|
|
41822
|
-
|
|
41822
|
+
path73,
|
|
41823
41823
|
error63.message
|
|
41824
41824
|
);
|
|
41825
41825
|
}
|
|
@@ -41934,7 +41934,7 @@ var require_request = __commonJS({
|
|
|
41934
41934
|
var kHandler = /* @__PURE__ */ Symbol("handler");
|
|
41935
41935
|
var Request2 = class {
|
|
41936
41936
|
constructor(origin, {
|
|
41937
|
-
path:
|
|
41937
|
+
path: path73,
|
|
41938
41938
|
method,
|
|
41939
41939
|
body,
|
|
41940
41940
|
headers,
|
|
@@ -41951,11 +41951,11 @@ var require_request = __commonJS({
|
|
|
41951
41951
|
maxRedirections,
|
|
41952
41952
|
typeOfService
|
|
41953
41953
|
}, handler) {
|
|
41954
|
-
if (typeof
|
|
41954
|
+
if (typeof path73 !== "string") {
|
|
41955
41955
|
throw new InvalidArgumentError2("path must be a string");
|
|
41956
|
-
} else if (
|
|
41956
|
+
} else if (path73[0] !== "/" && !(path73.startsWith("http://") || path73.startsWith("https://")) && method !== "CONNECT") {
|
|
41957
41957
|
throw new InvalidArgumentError2("path must be an absolute URL or start with a slash");
|
|
41958
|
-
} else if (invalidPathRegex.test(
|
|
41958
|
+
} else if (invalidPathRegex.test(path73)) {
|
|
41959
41959
|
throw new InvalidArgumentError2("invalid request path");
|
|
41960
41960
|
}
|
|
41961
41961
|
if (typeof method !== "string") {
|
|
@@ -42030,7 +42030,7 @@ var require_request = __commonJS({
|
|
|
42030
42030
|
this.completed = false;
|
|
42031
42031
|
this.aborted = false;
|
|
42032
42032
|
this.upgrade = upgrade || null;
|
|
42033
|
-
this.path = query ? serializePathWithQuery(
|
|
42033
|
+
this.path = query ? serializePathWithQuery(path73, query) : path73;
|
|
42034
42034
|
this.origin = origin;
|
|
42035
42035
|
this.protocol = getProtocolFromUrlString(origin);
|
|
42036
42036
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" : idempotent;
|
|
@@ -47255,7 +47255,7 @@ var require_client_h1 = __commonJS({
|
|
|
47255
47255
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
47256
47256
|
}
|
|
47257
47257
|
function writeH1(client, request7) {
|
|
47258
|
-
const { method, path:
|
|
47258
|
+
const { method, path: path73, host, upgrade, blocking, reset } = request7;
|
|
47259
47259
|
let { body, headers, contentLength } = request7;
|
|
47260
47260
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
47261
47261
|
if (util2.isFormDataLike(body)) {
|
|
@@ -47333,7 +47333,7 @@ var require_client_h1 = __commonJS({
|
|
|
47333
47333
|
if (socket.setTypeOfService) {
|
|
47334
47334
|
socket.setTypeOfService(request7.typeOfService);
|
|
47335
47335
|
}
|
|
47336
|
-
let header = `${method} ${
|
|
47336
|
+
let header = `${method} ${path73} HTTP/1.1\r
|
|
47337
47337
|
`;
|
|
47338
47338
|
if (typeof host === "string") {
|
|
47339
47339
|
header += `host: ${host}\r
|
|
@@ -48010,7 +48010,7 @@ var require_client_h2 = __commonJS({
|
|
|
48010
48010
|
const headersTimeout = request7.headersTimeout ?? client[kHeadersTimeout];
|
|
48011
48011
|
const bodyTimeout = request7.bodyTimeout ?? client[kBodyTimeout];
|
|
48012
48012
|
const session = client[kHTTP2Session];
|
|
48013
|
-
const { method, path:
|
|
48013
|
+
const { method, path: path73, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request7;
|
|
48014
48014
|
let { body } = request7;
|
|
48015
48015
|
if (upgrade != null && upgrade !== "websocket") {
|
|
48016
48016
|
util2.errorRequest(client, request7, new InvalidArgumentError2(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
@@ -48079,7 +48079,7 @@ var require_client_h2 = __commonJS({
|
|
|
48079
48079
|
}
|
|
48080
48080
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
48081
48081
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
48082
|
-
headers[HTTP2_HEADER_PATH] =
|
|
48082
|
+
headers[HTTP2_HEADER_PATH] = path73;
|
|
48083
48083
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
48084
48084
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
48085
48085
|
} else {
|
|
@@ -48131,7 +48131,7 @@ var require_client_h2 = __commonJS({
|
|
|
48131
48131
|
stream.setTimeout(headersTimeout);
|
|
48132
48132
|
return true;
|
|
48133
48133
|
}
|
|
48134
|
-
headers[HTTP2_HEADER_PATH] =
|
|
48134
|
+
headers[HTTP2_HEADER_PATH] = path73;
|
|
48135
48135
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
48136
48136
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH";
|
|
48137
48137
|
if (body && typeof body.read === "function") {
|
|
@@ -50487,10 +50487,10 @@ var require_proxy_agent = __commonJS({
|
|
|
50487
50487
|
};
|
|
50488
50488
|
const {
|
|
50489
50489
|
origin,
|
|
50490
|
-
path:
|
|
50490
|
+
path: path73 = "/",
|
|
50491
50491
|
headers = {}
|
|
50492
50492
|
} = opts;
|
|
50493
|
-
opts.path = origin +
|
|
50493
|
+
opts.path = origin + path73;
|
|
50494
50494
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
50495
50495
|
const { host } = new URL(origin);
|
|
50496
50496
|
headers.host = host;
|
|
@@ -52650,20 +52650,20 @@ var require_mock_utils = __commonJS({
|
|
|
52650
52650
|
}
|
|
52651
52651
|
return normalizedQp;
|
|
52652
52652
|
}
|
|
52653
|
-
function safeUrl(
|
|
52654
|
-
if (typeof
|
|
52655
|
-
return
|
|
52653
|
+
function safeUrl(path73) {
|
|
52654
|
+
if (typeof path73 !== "string") {
|
|
52655
|
+
return path73;
|
|
52656
52656
|
}
|
|
52657
|
-
const pathSegments =
|
|
52657
|
+
const pathSegments = path73.split("?", 3);
|
|
52658
52658
|
if (pathSegments.length !== 2) {
|
|
52659
|
-
return
|
|
52659
|
+
return path73;
|
|
52660
52660
|
}
|
|
52661
52661
|
const qp2 = new URLSearchParams(pathSegments.pop());
|
|
52662
52662
|
qp2.sort();
|
|
52663
52663
|
return [...pathSegments, qp2.toString()].join("?");
|
|
52664
52664
|
}
|
|
52665
|
-
function matchKey(mockDispatch2, { path:
|
|
52666
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
52665
|
+
function matchKey(mockDispatch2, { path: path73, method, body, headers }) {
|
|
52666
|
+
const pathMatch = matchValue(mockDispatch2.path, path73);
|
|
52667
52667
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
52668
52668
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
52669
52669
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -52688,8 +52688,8 @@ var require_mock_utils = __commonJS({
|
|
|
52688
52688
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
52689
52689
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
52690
52690
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
52691
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
52692
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
52691
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path73, ignoreTrailingSlash }) => {
|
|
52692
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path73)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path73), resolvedPath);
|
|
52693
52693
|
});
|
|
52694
52694
|
if (matchedMockDispatches.length === 0) {
|
|
52695
52695
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -52728,19 +52728,19 @@ var require_mock_utils = __commonJS({
|
|
|
52728
52728
|
mockDispatches.splice(index, 1);
|
|
52729
52729
|
}
|
|
52730
52730
|
}
|
|
52731
|
-
function removeTrailingSlash(
|
|
52732
|
-
while (
|
|
52733
|
-
|
|
52731
|
+
function removeTrailingSlash(path73) {
|
|
52732
|
+
while (path73.endsWith("/")) {
|
|
52733
|
+
path73 = path73.slice(0, -1);
|
|
52734
52734
|
}
|
|
52735
|
-
if (
|
|
52736
|
-
|
|
52735
|
+
if (path73.length === 0) {
|
|
52736
|
+
path73 = "/";
|
|
52737
52737
|
}
|
|
52738
|
-
return
|
|
52738
|
+
return path73;
|
|
52739
52739
|
}
|
|
52740
52740
|
function buildKey(opts) {
|
|
52741
|
-
const { path:
|
|
52741
|
+
const { path: path73, method, body, headers, query } = opts;
|
|
52742
52742
|
return {
|
|
52743
|
-
path:
|
|
52743
|
+
path: path73,
|
|
52744
52744
|
method,
|
|
52745
52745
|
body,
|
|
52746
52746
|
headers,
|
|
@@ -53430,10 +53430,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
53430
53430
|
}
|
|
53431
53431
|
format(pendingInterceptors) {
|
|
53432
53432
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
53433
|
-
({ method, path:
|
|
53433
|
+
({ method, path: path73, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
53434
53434
|
Method: method,
|
|
53435
53435
|
Origin: origin,
|
|
53436
|
-
Path:
|
|
53436
|
+
Path: path73,
|
|
53437
53437
|
"Status code": statusCode,
|
|
53438
53438
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
53439
53439
|
Invocations: timesInvoked,
|
|
@@ -53515,9 +53515,9 @@ var require_mock_agent = __commonJS({
|
|
|
53515
53515
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
53516
53516
|
const dispatchOpts = { ...opts };
|
|
53517
53517
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
53518
|
-
const [
|
|
53518
|
+
const [path73, searchParams] = dispatchOpts.path.split("?");
|
|
53519
53519
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
53520
|
-
dispatchOpts.path = `${
|
|
53520
|
+
dispatchOpts.path = `${path73}?${normalizedSearchParams}`;
|
|
53521
53521
|
}
|
|
53522
53522
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
53523
53523
|
}
|
|
@@ -53918,12 +53918,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
53918
53918
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
53919
53919
|
*/
|
|
53920
53920
|
async loadSnapshots(filePath) {
|
|
53921
|
-
const
|
|
53922
|
-
if (!
|
|
53921
|
+
const path73 = filePath || this.#snapshotPath;
|
|
53922
|
+
if (!path73) {
|
|
53923
53923
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
53924
53924
|
}
|
|
53925
53925
|
try {
|
|
53926
|
-
const data = await readFile(resolve3(
|
|
53926
|
+
const data = await readFile(resolve3(path73), "utf8");
|
|
53927
53927
|
const parsed = JSON.parse(data);
|
|
53928
53928
|
if (Array.isArray(parsed)) {
|
|
53929
53929
|
this.#snapshots.clear();
|
|
@@ -53937,7 +53937,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
53937
53937
|
if (error63.code === "ENOENT") {
|
|
53938
53938
|
this.#snapshots.clear();
|
|
53939
53939
|
} else {
|
|
53940
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
53940
|
+
throw new UndiciError(`Failed to load snapshots from ${path73}`, { cause: error63 });
|
|
53941
53941
|
}
|
|
53942
53942
|
}
|
|
53943
53943
|
}
|
|
@@ -53948,11 +53948,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
53948
53948
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
53949
53949
|
*/
|
|
53950
53950
|
async saveSnapshots(filePath) {
|
|
53951
|
-
const
|
|
53952
|
-
if (!
|
|
53951
|
+
const path73 = filePath || this.#snapshotPath;
|
|
53952
|
+
if (!path73) {
|
|
53953
53953
|
throw new InvalidArgumentError2("Snapshot path is required");
|
|
53954
53954
|
}
|
|
53955
|
-
const resolvedPath = resolve3(
|
|
53955
|
+
const resolvedPath = resolve3(path73);
|
|
53956
53956
|
await mkdir(dirname3(resolvedPath), { recursive: true });
|
|
53957
53957
|
const data = Array.from(this.#snapshots.entries()).map(([hash2, snapshot]) => ({
|
|
53958
53958
|
hash: hash2,
|
|
@@ -54589,15 +54589,15 @@ var require_redirect_handler = __commonJS({
|
|
|
54589
54589
|
}
|
|
54590
54590
|
this.history[kRedirectCacheControl].push(headers["cache-control"]);
|
|
54591
54591
|
const { origin, pathname, search } = util2.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
54592
|
-
const
|
|
54593
|
-
const redirectUrlString = `${origin}${
|
|
54592
|
+
const path73 = search ? `${pathname}${search}` : pathname;
|
|
54593
|
+
const redirectUrlString = `${origin}${path73}`;
|
|
54594
54594
|
for (const historyUrl of this.history) {
|
|
54595
54595
|
if (historyUrl.toString() === redirectUrlString) {
|
|
54596
54596
|
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.`);
|
|
54597
54597
|
}
|
|
54598
54598
|
}
|
|
54599
54599
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, statusCode === 303, this.opts.origin !== origin);
|
|
54600
|
-
this.opts.path =
|
|
54600
|
+
this.opts.path = path73;
|
|
54601
54601
|
this.opts.origin = origin;
|
|
54602
54602
|
this.opts.query = null;
|
|
54603
54603
|
}
|
|
@@ -56365,10 +56365,10 @@ var require_cache_handler = __commonJS({
|
|
|
56365
56365
|
}
|
|
56366
56366
|
return locationUrl.pathname + locationUrl.search;
|
|
56367
56367
|
}
|
|
56368
|
-
function deleteCachedUri(store, cacheKey,
|
|
56368
|
+
function deleteCachedUri(store, cacheKey, path73) {
|
|
56369
56369
|
deleteCachedValue(store, {
|
|
56370
56370
|
...cacheKey,
|
|
56371
|
-
path:
|
|
56371
|
+
path: path73
|
|
56372
56372
|
});
|
|
56373
56373
|
for (let i10 = 0; i10 < util2.safeHTTPMethods.length; i10++) {
|
|
56374
56374
|
const method = util2.safeHTTPMethods[i10];
|
|
@@ -56376,7 +56376,7 @@ var require_cache_handler = __commonJS({
|
|
|
56376
56376
|
deleteCachedValue(store, {
|
|
56377
56377
|
...cacheKey,
|
|
56378
56378
|
method,
|
|
56379
|
-
path:
|
|
56379
|
+
path: path73
|
|
56380
56380
|
});
|
|
56381
56381
|
}
|
|
56382
56382
|
}
|
|
@@ -56387,9 +56387,9 @@ var require_cache_handler = __commonJS({
|
|
|
56387
56387
|
}
|
|
56388
56388
|
const values = Array.isArray(headerValue2) ? headerValue2 : [headerValue2];
|
|
56389
56389
|
for (let i10 = 0; i10 < values.length; i10++) {
|
|
56390
|
-
const
|
|
56391
|
-
if (
|
|
56392
|
-
deleteCachedUri(store, cacheKey,
|
|
56390
|
+
const path73 = getSameOriginPath(cacheKey, values[i10]);
|
|
56391
|
+
if (path73 !== void 0) {
|
|
56392
|
+
deleteCachedUri(store, cacheKey, path73);
|
|
56393
56393
|
}
|
|
56394
56394
|
}
|
|
56395
56395
|
}
|
|
@@ -61600,11 +61600,11 @@ var require_fetch = __commonJS({
|
|
|
61600
61600
|
function dispatch({ body }) {
|
|
61601
61601
|
const url2 = requestCurrentURL(request7);
|
|
61602
61602
|
const agent = fetchParams.controller.dispatcher;
|
|
61603
|
-
const
|
|
61603
|
+
const path73 = url2.pathname + url2.search;
|
|
61604
61604
|
const hasTrailingQuestionMark = url2.search.length === 0 && url2.href[url2.href.length - url2.hash.length - 1] === "?";
|
|
61605
61605
|
return new Promise((resolve3, reject) => agent.dispatch(
|
|
61606
61606
|
{
|
|
61607
|
-
path: hasTrailingQuestionMark ? `${
|
|
61607
|
+
path: hasTrailingQuestionMark ? `${path73}?` : path73,
|
|
61608
61608
|
origin: url2.origin,
|
|
61609
61609
|
method: request7.method,
|
|
61610
61610
|
body: agent.isMockActive ? request7.body && (request7.body.source || request7.body.stream) : body,
|
|
@@ -62551,9 +62551,9 @@ var require_util5 = __commonJS({
|
|
|
62551
62551
|
}
|
|
62552
62552
|
}
|
|
62553
62553
|
}
|
|
62554
|
-
function validateCookiePath(
|
|
62555
|
-
for (let i10 = 0; i10 <
|
|
62556
|
-
const code =
|
|
62554
|
+
function validateCookiePath(path73) {
|
|
62555
|
+
for (let i10 = 0; i10 < path73.length; ++i10) {
|
|
62556
|
+
const code = path73.charCodeAt(i10);
|
|
62557
62557
|
if (code < 32 || // exclude CTLs (0-31)
|
|
62558
62558
|
code > 126 || // exclude DEL and non-ascii
|
|
62559
62559
|
code === 59) {
|
|
@@ -65989,11 +65989,11 @@ var require_undici = __commonJS({
|
|
|
65989
65989
|
if (typeof opts.path !== "string") {
|
|
65990
65990
|
throw new InvalidArgumentError2("invalid opts.path");
|
|
65991
65991
|
}
|
|
65992
|
-
let
|
|
65992
|
+
let path73 = opts.path;
|
|
65993
65993
|
if (!opts.path.startsWith("/")) {
|
|
65994
|
-
|
|
65994
|
+
path73 = `/${path73}`;
|
|
65995
65995
|
}
|
|
65996
|
-
url2 = new URL(util2.parseOrigin(url2).origin +
|
|
65996
|
+
url2 = new URL(util2.parseOrigin(url2).origin + path73);
|
|
65997
65997
|
} else {
|
|
65998
65998
|
if (!opts) {
|
|
65999
65999
|
opts = typeof url2 === "object" ? url2 : {};
|
|
@@ -107549,8 +107549,8 @@ var require_utils3 = __commonJS({
|
|
|
107549
107549
|
}
|
|
107550
107550
|
return ind;
|
|
107551
107551
|
}
|
|
107552
|
-
function removeDotSegments(
|
|
107553
|
-
let input2 =
|
|
107552
|
+
function removeDotSegments(path73) {
|
|
107553
|
+
let input2 = path73;
|
|
107554
107554
|
const output2 = [];
|
|
107555
107555
|
let nextSlash = -1;
|
|
107556
107556
|
let len = 0;
|
|
@@ -107624,11 +107624,11 @@ var require_utils3 = __commonJS({
|
|
|
107624
107624
|
}
|
|
107625
107625
|
return output2.join("");
|
|
107626
107626
|
}
|
|
107627
|
-
function removeDotSegmentsRelative(
|
|
107628
|
-
if (
|
|
107629
|
-
return removeDotSegments(
|
|
107627
|
+
function removeDotSegmentsRelative(path73) {
|
|
107628
|
+
if (path73 === "" || path73[0] === "/") {
|
|
107629
|
+
return removeDotSegments(path73);
|
|
107630
107630
|
}
|
|
107631
|
-
const segments =
|
|
107631
|
+
const segments = path73.split("/");
|
|
107632
107632
|
const last = segments.length - 1;
|
|
107633
107633
|
const output2 = [];
|
|
107634
107634
|
let trailingDirectory = false;
|
|
@@ -107991,8 +107991,8 @@ var require_schemes = __commonJS({
|
|
|
107991
107991
|
}
|
|
107992
107992
|
if (wsComponent.resourceName) {
|
|
107993
107993
|
const queryIndex = wsComponent.resourceName.indexOf("?");
|
|
107994
|
-
const
|
|
107995
|
-
wsComponent.path =
|
|
107994
|
+
const path73 = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
|
|
107995
|
+
wsComponent.path = path73 && path73 !== "/" ? path73 : void 0;
|
|
107996
107996
|
wsComponent.query = queryIndex === -1 ? void 0 : wsComponent.resourceName.slice(queryIndex + 1);
|
|
107997
107997
|
wsComponent.resourceName = void 0;
|
|
107998
107998
|
}
|
|
@@ -111543,7 +111543,7 @@ var require_dist2 = __commonJS({
|
|
|
111543
111543
|
});
|
|
111544
111544
|
|
|
111545
111545
|
// src/cli.ts
|
|
111546
|
-
var
|
|
111546
|
+
var import_node_path72 = __toESM(require("node:path"), 1);
|
|
111547
111547
|
|
|
111548
111548
|
// node_modules/.pnpm/commander@15.0.0/node_modules/commander/lib/error.js
|
|
111549
111549
|
var CommanderError = class extends Error {
|
|
@@ -114656,9 +114656,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
114656
114656
|
* @param {string} [path]
|
|
114657
114657
|
* @return {(string|null|Command)}
|
|
114658
114658
|
*/
|
|
114659
|
-
executableDir(
|
|
114660
|
-
if (
|
|
114661
|
-
this._executableDir =
|
|
114659
|
+
executableDir(path73) {
|
|
114660
|
+
if (path73 === void 0) return this._executableDir;
|
|
114661
|
+
this._executableDir = path73;
|
|
114662
114662
|
return this;
|
|
114663
114663
|
}
|
|
114664
114664
|
/**
|
|
@@ -116134,19 +116134,19 @@ function writePools(paths, pools) {
|
|
|
116134
116134
|
applyPatch(paths.globalConfigFile, GlobalConfigSchema, { pools }, { defaults: {} });
|
|
116135
116135
|
}
|
|
116136
116136
|
function poolCycleOf(pools, name) {
|
|
116137
|
-
const walk3 = (current,
|
|
116137
|
+
const walk3 = (current, path73) => {
|
|
116138
116138
|
for (const entry of pools[current]?.identities ?? []) {
|
|
116139
116139
|
const nested = poolNameOf(poolMemberIdentity(entry));
|
|
116140
116140
|
if (nested === void 0) {
|
|
116141
116141
|
continue;
|
|
116142
116142
|
}
|
|
116143
116143
|
if (nested === name) {
|
|
116144
|
-
return [...
|
|
116144
|
+
return [...path73, nested];
|
|
116145
116145
|
}
|
|
116146
|
-
if (
|
|
116146
|
+
if (path73.includes(nested)) {
|
|
116147
116147
|
continue;
|
|
116148
116148
|
}
|
|
116149
|
-
const found = walk3(nested, [...
|
|
116149
|
+
const found = walk3(nested, [...path73, nested]);
|
|
116150
116150
|
if (found !== void 0) {
|
|
116151
116151
|
return found;
|
|
116152
116152
|
}
|
|
@@ -117347,7 +117347,7 @@ function statuslineChangeOf(options) {
|
|
|
117347
117347
|
return void 0;
|
|
117348
117348
|
}
|
|
117349
117349
|
const assignments = (options.statusline ?? []).map(parseStatuslineAssignment);
|
|
117350
|
-
return { set: Object.fromEntries(assignments.map(({ path:
|
|
117350
|
+
return { set: Object.fromEntries(assignments.map(({ path: path73, value: value2 }) => [path73, value2])), unset: options.unsetStatusline ?? [] };
|
|
117351
117351
|
}
|
|
117352
117352
|
function registerProfileCommand(program2, deps) {
|
|
117353
117353
|
const { paths } = deps;
|
|
@@ -120551,16 +120551,16 @@ function createCredentialCustody(randomId) {
|
|
|
120551
120551
|
};
|
|
120552
120552
|
}
|
|
120553
120553
|
function restoreCredentials(headers, credentials) {
|
|
120554
|
-
const
|
|
120554
|
+
const restored2 = {};
|
|
120555
120555
|
for (const [name, value2] of Object.entries(headers)) {
|
|
120556
120556
|
if (value2 !== void 0 && !CREDENTIAL_HEADERS.includes(name.toLowerCase())) {
|
|
120557
|
-
|
|
120557
|
+
restored2[name] = value2;
|
|
120558
120558
|
}
|
|
120559
120559
|
}
|
|
120560
120560
|
for (const [name, value2] of Object.entries(credentials)) {
|
|
120561
|
-
|
|
120561
|
+
restored2[name] = typeof value2 === "string" ? value2 : [...value2];
|
|
120562
120562
|
}
|
|
120563
|
-
return
|
|
120563
|
+
return restored2;
|
|
120564
120564
|
}
|
|
120565
120565
|
|
|
120566
120566
|
// src/frontdoor/assembly.ts
|
|
@@ -121075,11 +121075,11 @@ function createRcSessionTracker(deps) {
|
|
|
121075
121075
|
};
|
|
121076
121076
|
const observeExchange = (request7) => {
|
|
121077
121077
|
const method = (request7.method ?? "").toUpperCase();
|
|
121078
|
-
const
|
|
121079
|
-
if (!
|
|
121078
|
+
const path73 = new URL(request7.url ?? "/", "http://127.0.0.1").pathname;
|
|
121079
|
+
if (!path73.startsWith(RC_SESSIONS_PATH_PREFIX)) {
|
|
121080
121080
|
return void 0;
|
|
121081
121081
|
}
|
|
121082
|
-
const tail =
|
|
121082
|
+
const tail = path73.slice(RC_SESSIONS_PATH_PREFIX.length);
|
|
121083
121083
|
const facts = {
|
|
121084
121084
|
oauthAuthorization: oauthAuthorizationOf(request7.headers),
|
|
121085
121085
|
anthropicVersion: singleHeader(request7.headers, "anthropic-version"),
|
|
@@ -121448,8 +121448,8 @@ var RC_READ_FILE_ENCODINGS = ["utf-8", "base64"];
|
|
|
121448
121448
|
function isRcReadFileEncoding(value2) {
|
|
121449
121449
|
return RC_READ_FILE_ENCODINGS.some((encoding) => encoding === value2);
|
|
121450
121450
|
}
|
|
121451
|
-
function buildRcReadFilePayload(requestId,
|
|
121452
|
-
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path:
|
|
121451
|
+
function buildRcReadFilePayload(requestId, path73, options) {
|
|
121452
|
+
return buildRcControlRequestPayload(requestId, { subtype: "read_file", path: path73, ...options?.maxBytes === void 0 ? {} : { max_bytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } });
|
|
121453
121453
|
}
|
|
121454
121454
|
function buildRcFileSuggestionsPayload(requestId, query) {
|
|
121455
121455
|
return buildRcControlRequestPayload(requestId, { subtype: "file_suggestions", query });
|
|
@@ -121551,15 +121551,15 @@ async function getRcSessionContextUsage(deps, sessionId, detail) {
|
|
|
121551
121551
|
const result = await deliverRcClientPayload(deps, sessionId, buildRcGetContextUsagePayload(requestId, detail), `request the context usage of session ${sessionId}`);
|
|
121552
121552
|
return result.ok ? { ...result, requestId } : result;
|
|
121553
121553
|
}
|
|
121554
|
-
async function readRcSessionFile(deps, sessionId,
|
|
121555
|
-
if (
|
|
121554
|
+
async function readRcSessionFile(deps, sessionId, path73, options) {
|
|
121555
|
+
if (path73 === "") {
|
|
121556
121556
|
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" };
|
|
121557
121557
|
}
|
|
121558
121558
|
if (options?.maxBytes !== void 0 && (!Number.isInteger(options.maxBytes) || options.maxBytes <= 0)) {
|
|
121559
121559
|
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" };
|
|
121560
121560
|
}
|
|
121561
121561
|
const requestId = deps.newUuid();
|
|
121562
|
-
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId,
|
|
121562
|
+
const result = await deliverRcClientPayload(deps, sessionId, buildRcReadFilePayload(requestId, path73, options), `read ${path73} from session ${sessionId}`);
|
|
121563
121563
|
return result.ok ? { ...result, requestId } : result;
|
|
121564
121564
|
}
|
|
121565
121565
|
async function suggestRcSessionFiles(deps, sessionId, query) {
|
|
@@ -121731,11 +121731,11 @@ function createRcControlHandler(deps) {
|
|
|
121731
121731
|
path: "read-file",
|
|
121732
121732
|
read: (body) => {
|
|
121733
121733
|
const session = bodyString(body, "session");
|
|
121734
|
-
const
|
|
121734
|
+
const path73 = bodyString(body, "path");
|
|
121735
121735
|
const maxBytes = "maxBytes" in body ? bodyPositiveInteger(body, "maxBytes") : void 0;
|
|
121736
121736
|
const encoding = "encoding" in body && isRcReadFileEncoding(body.encoding) ? body.encoding : void 0;
|
|
121737
|
-
const refused2 = session === void 0 ||
|
|
121738
|
-
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,
|
|
121737
|
+
const refused2 = session === void 0 || path73 === void 0 || "maxBytes" in body && maxBytes === void 0 || "encoding" in body && encoding === void 0;
|
|
121738
|
+
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, path73, { ...maxBytes === void 0 ? {} : { maxBytes }, ...encoding === void 0 ? {} : { encoding } }) };
|
|
121739
121739
|
}
|
|
121740
121740
|
},
|
|
121741
121741
|
{
|
|
@@ -122045,9 +122045,9 @@ function requestIdOfBody(body) {
|
|
|
122045
122045
|
}
|
|
122046
122046
|
function frontDoorRcControl(transport, token) {
|
|
122047
122047
|
const headers = { authorization: `Bearer ${token}` };
|
|
122048
|
-
const listAnswerOf = async (
|
|
122048
|
+
const listAnswerOf = async (path73, what) => {
|
|
122049
122049
|
try {
|
|
122050
|
-
return await transport.request({ method: "GET", path:
|
|
122050
|
+
return await transport.request({ method: "GET", path: path73, headers });
|
|
122051
122051
|
} catch (error63) {
|
|
122052
122052
|
throw new Error(`${what}: could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}`, { cause: error63 });
|
|
122053
122053
|
}
|
|
@@ -122119,10 +122119,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
122119
122119
|
}
|
|
122120
122120
|
return pending;
|
|
122121
122121
|
};
|
|
122122
|
-
const writeOf = async (
|
|
122122
|
+
const writeOf = async (path73, body, describeFailure2) => {
|
|
122123
122123
|
let answer;
|
|
122124
122124
|
try {
|
|
122125
|
-
answer = await transport.request({ method: "POST", path:
|
|
122125
|
+
answer = await transport.request({ method: "POST", path: path73, headers: { ...headers, "content-type": "application/json" }, body });
|
|
122126
122126
|
} catch (error63) {
|
|
122127
122127
|
return { ok: false, message: `could not reach the front door's control listener: ${error63 instanceof Error ? error63.message : String(error63)}` };
|
|
122128
122128
|
}
|
|
@@ -122153,10 +122153,10 @@ function frontDoorRcControl(transport, token) {
|
|
|
122153
122153
|
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}`),
|
|
122154
122154
|
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}`),
|
|
122155
122155
|
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}`),
|
|
122156
|
-
readFile: async (sessionId,
|
|
122156
|
+
readFile: async (sessionId, path73, options) => await writeOf(
|
|
122157
122157
|
`${CONTROL_PATH_PREFIX}/read-file`,
|
|
122158
|
-
JSON.stringify({ session: sessionId, path:
|
|
122159
|
-
(status, message) => `reading ${
|
|
122158
|
+
JSON.stringify({ session: sessionId, path: path73, ...options?.maxBytes === void 0 ? {} : { maxBytes: options.maxBytes }, ...options?.encoding === void 0 ? {} : { encoding: options.encoding } }),
|
|
122159
|
+
(status, message) => `reading ${path73} from ${sessionId} failed (HTTP ${String(status)}): ${message}`
|
|
122160
122160
|
),
|
|
122161
122161
|
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}`),
|
|
122162
122162
|
keepAlive: async (sessionId) => await writeOf(`${CONTROL_PATH_PREFIX}/keep-alive`, JSON.stringify({ session: sessionId }), (status, message) => `keeping ${sessionId} alive failed (HTTP ${String(status)}): ${message}`),
|
|
@@ -122543,12 +122543,12 @@ function tlsFacts(options) {
|
|
|
122543
122543
|
}
|
|
122544
122544
|
function realRcEventDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
122545
122545
|
const agent = new ExemptTlsAgent();
|
|
122546
|
-
const post = async (
|
|
122546
|
+
const post = async (path73, headers, body) => await new Promise((resolve3, reject) => {
|
|
122547
122547
|
const options = {
|
|
122548
122548
|
host: target.host,
|
|
122549
122549
|
port: target.port,
|
|
122550
122550
|
method: "POST",
|
|
122551
|
-
path:
|
|
122551
|
+
path: path73,
|
|
122552
122552
|
// 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.
|
|
122553
122553
|
headers: { ...headers, host: target.servername ?? target.host, "content-length": String(Buffer.byteLength(body, "utf8")) },
|
|
122554
122554
|
agent
|
|
@@ -122613,12 +122613,12 @@ function lateRcStreamDial(resolve3) {
|
|
|
122613
122613
|
}
|
|
122614
122614
|
function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_PORT }) {
|
|
122615
122615
|
const agent = new ExemptTlsAgent();
|
|
122616
|
-
const request7 = async (method,
|
|
122616
|
+
const request7 = async (method, path73, headers, body, signal) => await new Promise((resolve3, reject) => {
|
|
122617
122617
|
const options = {
|
|
122618
122618
|
host: target.host,
|
|
122619
122619
|
port: target.port,
|
|
122620
122620
|
method,
|
|
122621
|
-
path:
|
|
122621
|
+
path: path73,
|
|
122622
122622
|
// 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.
|
|
122623
122623
|
headers: { ...headers, host: target.servername ?? target.host, ...body === void 0 ? {} : { "content-length": String(Buffer.byteLength(body, "utf8")) } },
|
|
122624
122624
|
agent,
|
|
@@ -122660,9 +122660,9 @@ function realRcStreamDial(target = { host: CONNECT_INTERCEPT_HOST, port: HTTPS_P
|
|
|
122660
122660
|
return { status, body: await readAll(response) };
|
|
122661
122661
|
},
|
|
122662
122662
|
openStream: async (sessionId, headers, resume, signal) => {
|
|
122663
|
-
const
|
|
122663
|
+
const path73 = resume === void 0 ? `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream` : `/v1/code/sessions/${encodeURIComponent(sessionId)}/events/stream?from_sequence_num=${String(resume.fromSequenceNum)}`;
|
|
122664
122664
|
const streamHeaders = resume === void 0 ? headers : { ...headers, "last-event-id": String(resume.fromSequenceNum) };
|
|
122665
|
-
const { status, response } = await request7("GET",
|
|
122665
|
+
const { status, response } = await request7("GET", path73, streamHeaders, void 0, signal);
|
|
122666
122666
|
if (!isSuccessful2(status)) {
|
|
122667
122667
|
await readAll(response);
|
|
122668
122668
|
return { status, chunks: NO_CHUNKS };
|
|
@@ -124096,11 +124096,11 @@ function tryOrUndefined(fn2) {
|
|
|
124096
124096
|
return void 0;
|
|
124097
124097
|
}
|
|
124098
124098
|
}
|
|
124099
|
-
function pathToHttpPath(
|
|
124100
|
-
return `/${
|
|
124099
|
+
function pathToHttpPath(path73) {
|
|
124100
|
+
return `/${path73.map(safeEncodeURIComponent).join("/")}`;
|
|
124101
124101
|
}
|
|
124102
|
-
function normalizeHttpPath(
|
|
124103
|
-
const paths =
|
|
124102
|
+
function normalizeHttpPath(path73) {
|
|
124103
|
+
const paths = path73.split("/");
|
|
124104
124104
|
if (paths.at(0) === "") {
|
|
124105
124105
|
paths.shift();
|
|
124106
124106
|
}
|
|
@@ -124285,9 +124285,9 @@ function isPlainObject3(value2) {
|
|
|
124285
124285
|
function getOwn(object3, key) {
|
|
124286
124286
|
return Object.hasOwn(object3, key) ? object3[key] : void 0;
|
|
124287
124287
|
}
|
|
124288
|
-
function get(object3,
|
|
124288
|
+
function get(object3, path73) {
|
|
124289
124289
|
let current = object3;
|
|
124290
|
-
for (const key of
|
|
124290
|
+
for (const key of path73) {
|
|
124291
124291
|
if (!isTypescriptObject(current)) {
|
|
124292
124292
|
return void 0;
|
|
124293
124293
|
}
|
|
@@ -125510,7 +125510,7 @@ function resolveClientRest(rest) {
|
|
|
125510
125510
|
// rest[1] can be undefined if all fields of FriendlyClientOptions are optional
|
|
125511
125511
|
];
|
|
125512
125512
|
}
|
|
125513
|
-
function createORPCClient(link, { path:
|
|
125513
|
+
function createORPCClient(link, { path: path73 = [], ...options } = {}) {
|
|
125514
125514
|
const procedureClient = (...rest) => {
|
|
125515
125515
|
const [input2, callOptions] = resolveClientRest(rest);
|
|
125516
125516
|
const interceptors = [
|
|
@@ -125519,7 +125519,7 @@ function createORPCClient(link, { path: path72 = [], ...options } = {}) {
|
|
|
125519
125519
|
];
|
|
125520
125520
|
return intercept(
|
|
125521
125521
|
interceptors,
|
|
125522
|
-
{ ...callOptions, input: input2, path:
|
|
125522
|
+
{ ...callOptions, input: input2, path: path73 },
|
|
125523
125523
|
({ path: path210, input: input22, ...callOptions2 }) => link.call(path210, input22, callOptions2)
|
|
125524
125524
|
);
|
|
125525
125525
|
};
|
|
@@ -125533,7 +125533,7 @@ function createORPCClient(link, { path: path72 = [], ...options } = {}) {
|
|
|
125533
125533
|
if (client === void 0) {
|
|
125534
125534
|
client = createORPCClient(link, {
|
|
125535
125535
|
...options,
|
|
125536
|
-
path: [...
|
|
125536
|
+
path: [...path73, key],
|
|
125537
125537
|
scoped: options.scoped?.[key]
|
|
125538
125538
|
});
|
|
125539
125539
|
cache.set(key, client);
|
|
@@ -125555,25 +125555,25 @@ var BracketNotationSerializer = class {
|
|
|
125555
125555
|
this.internalSerialize(data, "", true, result);
|
|
125556
125556
|
return result;
|
|
125557
125557
|
}
|
|
125558
|
-
internalSerialize(data,
|
|
125558
|
+
internalSerialize(data, path73, isRoot, result) {
|
|
125559
125559
|
if (Array.isArray(data)) {
|
|
125560
125560
|
data.forEach((item, i10) => {
|
|
125561
|
-
this.internalSerialize(item, isRoot ? i10.toString() : `${
|
|
125561
|
+
this.internalSerialize(item, isRoot ? i10.toString() : `${path73}[${i10}]`, false, result);
|
|
125562
125562
|
});
|
|
125563
125563
|
} else if (isPlainObject3(data)) {
|
|
125564
125564
|
for (const key of Object.keys(data)) {
|
|
125565
|
-
this.internalSerialize(data[key], isRoot ? key : `${
|
|
125565
|
+
this.internalSerialize(data[key], isRoot ? key : `${path73}[${key}]`, false, result);
|
|
125566
125566
|
}
|
|
125567
125567
|
} else {
|
|
125568
|
-
result.push([
|
|
125568
|
+
result.push([path73, data]);
|
|
125569
125569
|
}
|
|
125570
125570
|
}
|
|
125571
125571
|
deserialize(serialized) {
|
|
125572
125572
|
let arrayPushStyles;
|
|
125573
125573
|
const root = new NullProtoObj();
|
|
125574
125574
|
let emptySlotsLeft = this.maxDeserializingEmptySlots;
|
|
125575
|
-
for (const [
|
|
125576
|
-
const segments = this.parsePath(
|
|
125575
|
+
for (const [path73, value2] of serialized) {
|
|
125576
|
+
const segments = this.parsePath(path73);
|
|
125577
125577
|
let currentRef = root;
|
|
125578
125578
|
let nextSegment = segments[0];
|
|
125579
125579
|
for (let i10 = 1; i10 < segments.length; i10++) {
|
|
@@ -125633,20 +125633,20 @@ var BracketNotationSerializer = class {
|
|
|
125633
125633
|
}
|
|
125634
125634
|
return result;
|
|
125635
125635
|
}
|
|
125636
|
-
parsePath(
|
|
125637
|
-
const start =
|
|
125638
|
-
if (start === -1 ||
|
|
125639
|
-
return [
|
|
125636
|
+
parsePath(path73) {
|
|
125637
|
+
const start = path73.indexOf("[");
|
|
125638
|
+
if (start === -1 || path73[path73.length - 1] !== "]") {
|
|
125639
|
+
return [path73];
|
|
125640
125640
|
}
|
|
125641
|
-
const segments = [
|
|
125641
|
+
const segments = [path73.slice(0, start)];
|
|
125642
125642
|
let from = start + 1;
|
|
125643
|
-
let to2 =
|
|
125643
|
+
let to2 = path73.indexOf("][", from);
|
|
125644
125644
|
while (to2 !== -1) {
|
|
125645
|
-
segments.push(
|
|
125645
|
+
segments.push(path73.slice(from, to2));
|
|
125646
125646
|
from = to2 + 2;
|
|
125647
|
-
to2 =
|
|
125647
|
+
to2 = path73.indexOf("][", from);
|
|
125648
125648
|
}
|
|
125649
|
-
segments.push(
|
|
125649
|
+
segments.push(path73.slice(from, -1));
|
|
125650
125650
|
return segments;
|
|
125651
125651
|
}
|
|
125652
125652
|
};
|
|
@@ -126244,11 +126244,11 @@ var OpenAPISerializer = class {
|
|
|
126244
126244
|
return json2;
|
|
126245
126245
|
}
|
|
126246
126246
|
const form = new FormData();
|
|
126247
|
-
for (const [
|
|
126247
|
+
for (const [path73, value22] of this.bracketNotation.serialize(json2)) {
|
|
126248
126248
|
if (value22 instanceof Blob) {
|
|
126249
|
-
form.append(
|
|
126249
|
+
form.append(path73, value22);
|
|
126250
126250
|
} else if (value22 !== void 0 && value22 !== null) {
|
|
126251
|
-
form.append(
|
|
126251
|
+
form.append(path73, String(value22));
|
|
126252
126252
|
}
|
|
126253
126253
|
}
|
|
126254
126254
|
return form;
|
|
@@ -126286,30 +126286,30 @@ function isBodylessMethod(method) {
|
|
|
126286
126286
|
return method === "GET" || method === "HEAD";
|
|
126287
126287
|
}
|
|
126288
126288
|
var PARAMETER_NAME_REGEX = /^[\w-]+$/;
|
|
126289
|
-
function getDynamicPathParams(
|
|
126290
|
-
if (!
|
|
126289
|
+
function getDynamicPathParams(path73) {
|
|
126290
|
+
if (!path73.includes("{")) {
|
|
126291
126291
|
return void 0;
|
|
126292
126292
|
}
|
|
126293
|
-
const len =
|
|
126293
|
+
const len = path73.length;
|
|
126294
126294
|
let params;
|
|
126295
126295
|
let index = 1;
|
|
126296
126296
|
while (index < len) {
|
|
126297
126297
|
const segmentStart = index;
|
|
126298
|
-
const slashPos =
|
|
126298
|
+
const slashPos = path73.indexOf("/", index);
|
|
126299
126299
|
const segmentEnd = slashPos === -1 ? len : slashPos;
|
|
126300
|
-
if (segmentEnd > segmentStart &&
|
|
126300
|
+
if (segmentEnd > segmentStart && path73.charCodeAt(segmentStart) === 123 && path73.charCodeAt(segmentEnd - 1) === 125) {
|
|
126301
126301
|
let parameterStart = segmentStart + 1;
|
|
126302
126302
|
let allowsSlash = false;
|
|
126303
|
-
const operator =
|
|
126303
|
+
const operator = path73.charCodeAt(parameterStart);
|
|
126304
126304
|
if (operator === 43) {
|
|
126305
126305
|
allowsSlash = true;
|
|
126306
126306
|
parameterStart++;
|
|
126307
126307
|
}
|
|
126308
|
-
const parameterName =
|
|
126308
|
+
const parameterName = path73.slice(parameterStart, segmentEnd - 1);
|
|
126309
126309
|
if (PARAMETER_NAME_REGEX.test(parameterName)) {
|
|
126310
126310
|
params ??= [];
|
|
126311
126311
|
params.push({
|
|
126312
|
-
segment:
|
|
126312
|
+
segment: path73.slice(segmentStart, segmentEnd),
|
|
126313
126313
|
startIndex: segmentStart,
|
|
126314
126314
|
parameterName,
|
|
126315
126315
|
allowsSlash
|
|
@@ -126352,8 +126352,8 @@ openapi.method = (method) => ({
|
|
|
126352
126352
|
...openapi({ method }),
|
|
126353
126353
|
name: "~openapi/method"
|
|
126354
126354
|
});
|
|
126355
|
-
openapi.path = (
|
|
126356
|
-
...openapi({ path:
|
|
126355
|
+
openapi.path = (path73) => ({
|
|
126356
|
+
...openapi({ path: path73 }),
|
|
126357
126357
|
name: "~openapi/path"
|
|
126358
126358
|
});
|
|
126359
126359
|
openapi.spec = (spec) => ({
|
|
@@ -127272,22 +127272,22 @@ function visitJsonSchemaRefs(value2, visit2, schemaLevel = true, seen = /* @__PU
|
|
|
127272
127272
|
}
|
|
127273
127273
|
}
|
|
127274
127274
|
}
|
|
127275
|
-
function mapJsonSchemaRefs(value2, map3, schemaLevel = true,
|
|
127275
|
+
function mapJsonSchemaRefs(value2, map3, schemaLevel = true, path73 = []) {
|
|
127276
127276
|
if (!value2 || typeof value2 !== "object") {
|
|
127277
127277
|
return value2;
|
|
127278
127278
|
}
|
|
127279
127279
|
if (Array.isArray(value2)) {
|
|
127280
|
-
return value2.map((item, index) => mapJsonSchemaRefs(item, map3, schemaLevel, [...
|
|
127280
|
+
return value2.map((item, index) => mapJsonSchemaRefs(item, map3, schemaLevel, [...path73, index]));
|
|
127281
127281
|
}
|
|
127282
127282
|
const result = {};
|
|
127283
127283
|
for (const key of Object.keys(value2)) {
|
|
127284
127284
|
const val = value2[key];
|
|
127285
127285
|
if (key === "$ref" && typeof val === "string") {
|
|
127286
|
-
setOwn(result, key, map3(val, [...
|
|
127286
|
+
setOwn(result, key, map3(val, [...path73, key]));
|
|
127287
127287
|
} else if (!schemaLevel) {
|
|
127288
|
-
setOwn(result, key, mapJsonSchemaRefs(val, map3, true, [...
|
|
127288
|
+
setOwn(result, key, mapJsonSchemaRefs(val, map3, true, [...path73, key]));
|
|
127289
127289
|
} else if (JSON_SCHEMA_LOGIC_KEYWORDS.has(key) || JSON_SCHEMA_RECORD_KEYWORDS.has(key)) {
|
|
127290
|
-
setOwn(result, key, mapJsonSchemaRefs(val, map3, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...
|
|
127290
|
+
setOwn(result, key, mapJsonSchemaRefs(val, map3, !JSON_SCHEMA_RECORD_KEYWORDS.has(key), [...path73, key]));
|
|
127291
127291
|
} else {
|
|
127292
127292
|
setOwn(result, key, val);
|
|
127293
127293
|
}
|
|
@@ -127817,7 +127817,7 @@ function unlazy(maybeLazy) {
|
|
|
127817
127817
|
function createProcedureClient(lazyableProcedure, ...rest) {
|
|
127818
127818
|
const options = resolveMaybeOptionalOptions(rest);
|
|
127819
127819
|
return async (...[input2, callerOptions]) => {
|
|
127820
|
-
const
|
|
127820
|
+
const path73 = toArray(options.path);
|
|
127821
127821
|
const { default: procedure } = await unlazy(lazyableProcedure);
|
|
127822
127822
|
const clientContext = callerOptions?.context ?? {};
|
|
127823
127823
|
const context = await value(options.context, clientContext) ?? {};
|
|
@@ -127830,7 +127830,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
127830
127830
|
};
|
|
127831
127831
|
try {
|
|
127832
127832
|
const output2 = await runWithSpan("call_procedure", (span) => {
|
|
127833
|
-
span?.setAttribute("procedure.path",
|
|
127833
|
+
span?.setAttribute("procedure.path", path73);
|
|
127834
127834
|
return intercept(
|
|
127835
127835
|
options.interceptors,
|
|
127836
127836
|
{
|
|
@@ -127838,7 +127838,7 @@ function createProcedureClient(lazyableProcedure, ...rest) {
|
|
|
127838
127838
|
// input can be optional if it is undefinable
|
|
127839
127839
|
input: input2,
|
|
127840
127840
|
errors,
|
|
127841
|
-
path:
|
|
127841
|
+
path: path73,
|
|
127842
127842
|
procedure,
|
|
127843
127843
|
signal: callerOptions?.signal,
|
|
127844
127844
|
lastEventId: callerOptions?.lastEventId
|
|
@@ -128089,10 +128089,10 @@ function augmentRouter(router, options) {
|
|
|
128089
128089
|
}
|
|
128090
128090
|
return enhanced;
|
|
128091
128091
|
}
|
|
128092
|
-
function getRouter(router,
|
|
128092
|
+
function getRouter(router, path73) {
|
|
128093
128093
|
let current = router;
|
|
128094
|
-
for (let i10 = 0; i10 <
|
|
128095
|
-
const segment =
|
|
128094
|
+
for (let i10 = 0; i10 < path73.length; i10++) {
|
|
128095
|
+
const segment = path73[i10];
|
|
128096
128096
|
if (!isTypescriptObject(current)) {
|
|
128097
128097
|
return void 0;
|
|
128098
128098
|
}
|
|
@@ -128104,7 +128104,7 @@ function getRouter(router, path72) {
|
|
|
128104
128104
|
continue;
|
|
128105
128105
|
}
|
|
128106
128106
|
const lazied = current;
|
|
128107
|
-
const rest =
|
|
128107
|
+
const rest = path73.slice(i10);
|
|
128108
128108
|
return new Lazy({
|
|
128109
128109
|
...lazied["~orpc"],
|
|
128110
128110
|
async loader() {
|
|
@@ -128119,40 +128119,40 @@ function getRouter(router, path72) {
|
|
|
128119
128119
|
}
|
|
128120
128120
|
return current;
|
|
128121
128121
|
}
|
|
128122
|
-
function walkProcedureContractsSync(router, callback,
|
|
128122
|
+
function walkProcedureContractsSync(router, callback, path73 = []) {
|
|
128123
128123
|
const lazyResults = [];
|
|
128124
|
-
walkProcedureContractsSyncInternal(router, callback,
|
|
128124
|
+
walkProcedureContractsSyncInternal(router, callback, path73.slice(), lazyResults);
|
|
128125
128125
|
return lazyResults;
|
|
128126
128126
|
}
|
|
128127
|
-
function walkProcedureContractsSyncInternal(router, callback,
|
|
128127
|
+
function walkProcedureContractsSyncInternal(router, callback, path73, lazyResults) {
|
|
128128
128128
|
const hiddenContract = getHiddenRouterContract(router);
|
|
128129
128129
|
if (hiddenContract !== void 0) {
|
|
128130
128130
|
router = hiddenContract;
|
|
128131
128131
|
}
|
|
128132
128132
|
if (router instanceof ProcedureContract) {
|
|
128133
|
-
callback(router,
|
|
128133
|
+
callback(router, path73.slice());
|
|
128134
128134
|
return;
|
|
128135
128135
|
}
|
|
128136
128136
|
if (!isTypescriptObject(router)) {
|
|
128137
128137
|
return;
|
|
128138
128138
|
}
|
|
128139
128139
|
for (const [key, value2] of Object.entries(router)) {
|
|
128140
|
-
|
|
128140
|
+
path73.push(key);
|
|
128141
128141
|
if (value2 instanceof Lazy) {
|
|
128142
|
-
lazyResults.push({ router: value2, path:
|
|
128142
|
+
lazyResults.push({ router: value2, path: path73.slice() });
|
|
128143
128143
|
} else {
|
|
128144
|
-
walkProcedureContractsSyncInternal(value2, callback,
|
|
128144
|
+
walkProcedureContractsSyncInternal(value2, callback, path73, lazyResults);
|
|
128145
128145
|
}
|
|
128146
|
-
|
|
128146
|
+
path73.pop();
|
|
128147
128147
|
}
|
|
128148
128148
|
}
|
|
128149
|
-
async function walkProcedureContractsAsync(router, callback,
|
|
128149
|
+
async function walkProcedureContractsAsync(router, callback, path73 = []) {
|
|
128150
128150
|
const hiddenContract = getHiddenRouterContract(router);
|
|
128151
128151
|
if (hiddenContract !== void 0) {
|
|
128152
128152
|
router = hiddenContract;
|
|
128153
128153
|
}
|
|
128154
128154
|
if (router instanceof ProcedureContract) {
|
|
128155
|
-
await callback(router,
|
|
128155
|
+
await callback(router, path73);
|
|
128156
128156
|
return;
|
|
128157
128157
|
}
|
|
128158
128158
|
if (!isTypescriptObject(router)) {
|
|
@@ -128161,9 +128161,9 @@ async function walkProcedureContractsAsync(router, callback, path72 = []) {
|
|
|
128161
128161
|
for (const [key, value2] of Object.entries(router)) {
|
|
128162
128162
|
if (value2 instanceof Lazy) {
|
|
128163
128163
|
const { default: router2 } = await unlazy(value2);
|
|
128164
|
-
await walkProcedureContractsAsync(router2, callback, [...
|
|
128164
|
+
await walkProcedureContractsAsync(router2, callback, [...path73, key]);
|
|
128165
128165
|
} else {
|
|
128166
|
-
await walkProcedureContractsAsync(value2, callback, [...
|
|
128166
|
+
await walkProcedureContractsAsync(value2, callback, [...path73, key]);
|
|
128167
128167
|
}
|
|
128168
128168
|
}
|
|
128169
128169
|
}
|
|
@@ -128649,18 +128649,18 @@ function rewriteComponentSchemaRefs(schema, renameMap) {
|
|
|
128649
128649
|
}
|
|
128650
128650
|
var OpenAPIGeneratorError = class extends TypeError {
|
|
128651
128651
|
};
|
|
128652
|
-
function toOpenAPIPath(
|
|
128652
|
+
function toOpenAPIPath(path73, dynamicPathParams) {
|
|
128653
128653
|
if (!dynamicPathParams?.length) {
|
|
128654
|
-
return
|
|
128654
|
+
return path73;
|
|
128655
128655
|
}
|
|
128656
128656
|
let normalized = "";
|
|
128657
128657
|
let currentIndex = 0;
|
|
128658
128658
|
for (const param of dynamicPathParams) {
|
|
128659
|
-
normalized +=
|
|
128659
|
+
normalized += path73.slice(currentIndex, param.startIndex);
|
|
128660
128660
|
normalized += `{${param.parameterName}}`;
|
|
128661
128661
|
currentIndex = param.startIndex + param.segment.length;
|
|
128662
128662
|
}
|
|
128663
|
-
normalized +=
|
|
128663
|
+
normalized += path73.slice(currentIndex);
|
|
128664
128664
|
return normalized;
|
|
128665
128665
|
}
|
|
128666
128666
|
function buildRequest(ctx, operation, def, meta3, dynamicPathParams) {
|
|
@@ -129117,8 +129117,8 @@ var OpenAPIGenerator = class {
|
|
|
129117
129117
|
customErrorResponseBodySchema: options.customErrorResponseBodySchema
|
|
129118
129118
|
};
|
|
129119
129119
|
const errors = [];
|
|
129120
|
-
await walkProcedureContractsAsync(router, (contract,
|
|
129121
|
-
if (value(options.filter, contract,
|
|
129120
|
+
await walkProcedureContractsAsync(router, (contract, path73) => {
|
|
129121
|
+
if (value(options.filter, contract, path73) === false) {
|
|
129122
129122
|
return;
|
|
129123
129123
|
}
|
|
129124
129124
|
try {
|
|
@@ -129130,7 +129130,7 @@ var OpenAPIGenerator = class {
|
|
|
129130
129130
|
`QUERY operations require OpenAPI 3.2, but version "${version2}" was requested.`
|
|
129131
129131
|
);
|
|
129132
129132
|
}
|
|
129133
|
-
const postPath = meta3?.path ?? pathToHttpPath(
|
|
129133
|
+
const postPath = meta3?.path ?? pathToHttpPath(path73);
|
|
129134
129134
|
const httpPath = meta3?.prefix ? mergeHttpPath(meta3.prefix, postPath) : postPath;
|
|
129135
129135
|
const dynamicPathParams = getDynamicPathParams(httpPath);
|
|
129136
129136
|
const openApiPath = toOpenAPIPath(httpPath, dynamicPathParams);
|
|
@@ -129139,7 +129139,7 @@ var OpenAPIGenerator = class {
|
|
|
129139
129139
|
operation = meta3.spec;
|
|
129140
129140
|
} else {
|
|
129141
129141
|
operation = {
|
|
129142
|
-
operationId: meta3?.operationId ??
|
|
129142
|
+
operationId: meta3?.operationId ?? path73.join("."),
|
|
129143
129143
|
summary: meta3?.summary,
|
|
129144
129144
|
description: meta3?.description,
|
|
129145
129145
|
deprecated: meta3?.deprecated,
|
|
@@ -129159,7 +129159,7 @@ var OpenAPIGenerator = class {
|
|
|
129159
129159
|
if (!(e14 instanceof OpenAPIGeneratorError)) {
|
|
129160
129160
|
throw e14;
|
|
129161
129161
|
}
|
|
129162
|
-
errors.push(`Procedure at ${
|
|
129162
|
+
errors.push(`Procedure at ${path73.join(".") || "(root)"}: ${e14.message}`);
|
|
129163
129163
|
}
|
|
129164
129164
|
});
|
|
129165
129165
|
if (errors.length) {
|
|
@@ -130006,16 +130006,16 @@ var StandardLink = class {
|
|
|
130006
130006
|
/**
|
|
130007
130007
|
* @throws ORPCError, transport-level errors (network failures, timeouts, etc.)
|
|
130008
130008
|
*/
|
|
130009
|
-
call(
|
|
130010
|
-
return runWithSpan(`${ORPC_NAME}.${
|
|
130009
|
+
call(path73, input2, options) {
|
|
130010
|
+
return runWithSpan(`${ORPC_NAME}.${path73.join("/")}`, (span) => {
|
|
130011
130011
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
130012
|
-
span?.setAttribute("rpc.method",
|
|
130012
|
+
span?.setAttribute("rpc.method", path73.join("."));
|
|
130013
130013
|
if (getTracer() && isAsyncIteratorObject(input2)) {
|
|
130014
130014
|
input2 = override(input2, traceAsyncIterator("consume_async_iterator_object_input", input2));
|
|
130015
130015
|
} else if (getTracer() && input2 instanceof ReadableStream) {
|
|
130016
130016
|
input2 = override(input2, traceReadableStream("consume_octet_stream_input", input2));
|
|
130017
130017
|
}
|
|
130018
|
-
return intercept(this.interceptors, { ...options, path:
|
|
130018
|
+
return intercept(this.interceptors, { ...options, path: path73, input: input2 }, async ({ path: path210, input: input22, ...options2 }) => {
|
|
130019
130019
|
const tracer = getTracer();
|
|
130020
130020
|
const activeSpan = tracer?.getActiveSpan() ?? span;
|
|
130021
130021
|
let request7 = await runWithSpan(
|
|
@@ -130072,18 +130072,18 @@ var RPCLinkCodec = class {
|
|
|
130072
130072
|
this.headers = options.headers ?? {};
|
|
130073
130073
|
this.serializer = options.serializer ?? new RPCSerializer();
|
|
130074
130074
|
}
|
|
130075
|
-
async encodeInput(input2,
|
|
130076
|
-
let headers = toResolvedStandardHeaders(await value(this.headers, options,
|
|
130075
|
+
async encodeInput(input2, path73, options) {
|
|
130076
|
+
let headers = toResolvedStandardHeaders(await value(this.headers, options, path73, input2));
|
|
130077
130077
|
if (options.lastEventId !== void 0) {
|
|
130078
130078
|
headers = mergeStandardHeaders(headers, { "last-event-id": options.lastEventId });
|
|
130079
130079
|
}
|
|
130080
|
-
const expectedMethod = await value(this.expectedMethod, options,
|
|
130081
|
-
const baseUrl = await value(this.baseUrl, options,
|
|
130080
|
+
const expectedMethod = await value(this.expectedMethod, options, path73, input2);
|
|
130081
|
+
const baseUrl = await value(this.baseUrl, options, path73, input2);
|
|
130082
130082
|
const [pathname, search, hash2] = parseStandardUrl(baseUrl);
|
|
130083
|
-
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(
|
|
130083
|
+
const newPathname = `${pathname.replace(END_SLASH_REGEX, "")}${pathToHttpPath(path73)}`;
|
|
130084
130084
|
const serialized = this.serializer.serialize(input2);
|
|
130085
130085
|
if (expectedMethod === "GET" && !(serialized instanceof Blob) && !(serialized instanceof ReadableStream) && !(serialized instanceof FormData) && !isAsyncIteratorObject(serialized)) {
|
|
130086
|
-
const maxUrlLength = await value(this.maxUrlLength, options,
|
|
130086
|
+
const maxUrlLength = await value(this.maxUrlLength, options, path73, input2);
|
|
130087
130087
|
const mergedSearch = new URLSearchParams(search);
|
|
130088
130088
|
mergedSearch.append("data", stringifyJSON(serialized) ?? "");
|
|
130089
130089
|
const url22 = `${newPathname}?${mergedSearch}${hash2 ?? ""}`;
|
|
@@ -130168,8 +130168,8 @@ var FetchLinkTransport = class {
|
|
|
130168
130168
|
this.fetch = options.fetch ?? ((url2, init) => globalThis.fetch(url2, init));
|
|
130169
130169
|
this.toFetchRequestOptions = options.toFetchRequest;
|
|
130170
130170
|
}
|
|
130171
|
-
async send(standardRequest,
|
|
130172
|
-
let origin = await value(this.origin, options,
|
|
130171
|
+
async send(standardRequest, path73, options) {
|
|
130172
|
+
let origin = await value(this.origin, options, path73);
|
|
130173
130173
|
if (origin?.endsWith("/")) {
|
|
130174
130174
|
origin = origin.slice(0, -1);
|
|
130175
130175
|
}
|
|
@@ -130189,7 +130189,7 @@ var FetchLinkTransport = class {
|
|
|
130189
130189
|
}
|
|
130190
130190
|
}
|
|
130191
130191
|
const fetch3 = this.fetch;
|
|
130192
|
-
const response = await fetch3(url2, init, options,
|
|
130192
|
+
const response = await fetch3(url2, init, options, path73);
|
|
130193
130193
|
const standardResponse = toStandardLazyResponse(response);
|
|
130194
130194
|
return standardResponse;
|
|
130195
130195
|
}
|
|
@@ -130580,14 +130580,14 @@ var StandardHandler = class {
|
|
|
130580
130580
|
span?.setAttribute("url.path", request22.url);
|
|
130581
130581
|
return { matched: false };
|
|
130582
130582
|
}
|
|
130583
|
-
const { path:
|
|
130584
|
-
span?.updateName(`${ORPC_NAME}.${
|
|
130583
|
+
const { path: path73, procedure, decodeInput } = matchedOrNot;
|
|
130584
|
+
span?.updateName(`${ORPC_NAME}.${path73.join("/")}`);
|
|
130585
130585
|
span?.setAttribute("rpc.system", ORPC_NAME);
|
|
130586
|
-
span?.setAttribute("rpc.method",
|
|
130586
|
+
span?.setAttribute("rpc.method", path73.join("."));
|
|
130587
130587
|
try {
|
|
130588
130588
|
const response = await intercept(
|
|
130589
130589
|
this.interceptors,
|
|
130590
|
-
{ context: context2, prefix: prefix2, request: request22, path:
|
|
130590
|
+
{ context: context2, prefix: prefix2, request: request22, path: path73, procedure, decodeInput },
|
|
130591
130591
|
async ({ context: context3, prefix: prefix3, request: request32, path: path210, procedure: procedure2, decodeInput: decodeInput2 }) => {
|
|
130592
130592
|
step2 = "decode_input";
|
|
130593
130593
|
let input2 = await runWithSpan("decode_input", decodeInput2);
|
|
@@ -130621,7 +130621,7 @@ var StandardHandler = class {
|
|
|
130621
130621
|
message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
|
|
130622
130622
|
cause: e14
|
|
130623
130623
|
}) : toORPCError(e14);
|
|
130624
|
-
const response = await this.codec.encodeError(error63, procedure,
|
|
130624
|
+
const response = await this.codec.encodeError(error63, procedure, path73, { context: context2, prefix: prefix2 });
|
|
130625
130625
|
return { matched: true, response };
|
|
130626
130626
|
}
|
|
130627
130627
|
}
|
|
@@ -130728,7 +130728,7 @@ var RPCMatcher = class {
|
|
|
130728
130728
|
this.rootRouter = router;
|
|
130729
130729
|
this.index(router);
|
|
130730
130730
|
}
|
|
130731
|
-
index(router,
|
|
130731
|
+
index(router, path73 = []) {
|
|
130732
130732
|
const lazyResults = walkProcedureContractsSync(router, (procedure, procedurePath) => {
|
|
130733
130733
|
if (!value(this.filter, procedure, procedurePath)) {
|
|
130734
130734
|
return;
|
|
@@ -130739,7 +130739,7 @@ var RPCMatcher = class {
|
|
|
130739
130739
|
// contract-first entries have no implementation yet, resolveProcedure fills it in on demand
|
|
130740
130740
|
procedure: procedure instanceof Procedure ? procedure : void 0
|
|
130741
130741
|
});
|
|
130742
|
-
},
|
|
130742
|
+
}, path73);
|
|
130743
130743
|
for (const result of lazyResults) {
|
|
130744
130744
|
this.pendingLazyRouters.set(pathToHttpPath(result.path), result);
|
|
130745
130745
|
}
|
|
@@ -130871,10 +130871,10 @@ var RPCHandlerCodec = class {
|
|
|
130871
130871
|
}
|
|
130872
130872
|
};
|
|
130873
130873
|
}
|
|
130874
|
-
encodeOutput(output2, procedure,
|
|
130874
|
+
encodeOutput(output2, procedure, path73, options) {
|
|
130875
130875
|
return {
|
|
130876
130876
|
headers: {},
|
|
130877
|
-
status: value(this.outputStatus, output2, procedure,
|
|
130877
|
+
status: value(this.outputStatus, output2, procedure, path73, options) ?? DEFAULT_SUCCESS_STATUS,
|
|
130878
130878
|
body: this.serializer.serialize(output2)
|
|
130879
130879
|
};
|
|
130880
130880
|
}
|
|
@@ -130950,19 +130950,19 @@ function matchesZero(m10) {
|
|
|
130950
130950
|
const last = m10.paramsMap[m10.paramsMap.length - 1];
|
|
130951
130951
|
return last[2] || !!last[3] && !last[5];
|
|
130952
130952
|
}
|
|
130953
|
-
function normalizePath(
|
|
130954
|
-
if (!
|
|
130953
|
+
function normalizePath(path73) {
|
|
130954
|
+
if (!path73.includes("/.")) return path73;
|
|
130955
130955
|
const r10 = [];
|
|
130956
130956
|
let s = "";
|
|
130957
|
-
for (s of
|
|
130957
|
+
for (s of path73.split("/")) if (s === ".") continue;
|
|
130958
130958
|
else if (s === "..") {
|
|
130959
130959
|
if (r10.length > 1) r10.pop();
|
|
130960
130960
|
} else r10.push(s);
|
|
130961
130961
|
if (s === "." || s === "..") r10.push("");
|
|
130962
130962
|
return r10.join("/") || "/";
|
|
130963
130963
|
}
|
|
130964
|
-
function splitPath(
|
|
130965
|
-
const s =
|
|
130964
|
+
function splitPath(path73) {
|
|
130965
|
+
const s = path73.split("/");
|
|
130966
130966
|
s.shift();
|
|
130967
130967
|
return s;
|
|
130968
130968
|
}
|
|
@@ -131005,9 +131005,9 @@ function getMatchParams(segments, paramsMap, suffix, slash) {
|
|
|
131005
131005
|
}
|
|
131006
131006
|
return params;
|
|
131007
131007
|
}
|
|
131008
|
-
function encodeEscapes(
|
|
131009
|
-
if (!
|
|
131010
|
-
return
|
|
131008
|
+
function encodeEscapes(path73) {
|
|
131009
|
+
if (!path73.includes("\\")) return path73;
|
|
131010
|
+
return path73.replace(/\\([:(){}\\])/g, (_, c10) => "\uFFFD" + ESCAPABLE.indexOf(c10));
|
|
131011
131011
|
}
|
|
131012
131012
|
function decodeEscapes(segment, prefix) {
|
|
131013
131013
|
return segment.replace(/\uFFFD([0-5])/g, (_, i10) => prefix + ESCAPABLE[i10]);
|
|
@@ -131044,11 +131044,11 @@ function classSetOp(s) {
|
|
|
131044
131044
|
}))) ;
|
|
131045
131045
|
return found;
|
|
131046
131046
|
}
|
|
131047
|
-
function starGroups(
|
|
131048
|
-
if (!
|
|
131047
|
+
function starGroups(path73) {
|
|
131048
|
+
if (!path73.includes("(.*)")) return [path73];
|
|
131049
131049
|
let count2 = 0;
|
|
131050
131050
|
let unnamed;
|
|
131051
|
-
return [
|
|
131051
|
+
return [path73.replace(/\\[\s\S]|(:[A-Za-z_]\w*)?\((?!\?)(\.\*\)(?!\*))?/g, (m10, name, star, at2) => {
|
|
131052
131052
|
if (m10[0] === "\\" || !star) {
|
|
131053
131053
|
if (m10[0] === "(") count2++;
|
|
131054
131054
|
return m10;
|
|
@@ -131057,25 +131057,25 @@ function starGroups(path72) {
|
|
|
131057
131057
|
const k10 = count2;
|
|
131058
131058
|
unnamed = (index) => index === k10 ? name.slice(1) : index > k10 ? index - 1 : index;
|
|
131059
131059
|
} else count2++;
|
|
131060
|
-
return /(^|[^\\])(\\\\)*([)*}?]|:[A-Za-z_]\w*)\{?$/.test(
|
|
131060
|
+
return /(^|[^\\])(\\\\)*([)*}?]|:[A-Za-z_]\w*)\{?$/.test(path73.slice(0, at2)) ? "\uFFFF*" : "*";
|
|
131061
131061
|
}), unnamed];
|
|
131062
131062
|
}
|
|
131063
|
-
function absolutePattern(
|
|
131064
|
-
return /^[/{]/.test(
|
|
131063
|
+
function absolutePattern(path73) {
|
|
131064
|
+
return /^[/{]/.test(path73) ? path73 : `/${path73}`;
|
|
131065
131065
|
}
|
|
131066
|
-
function dotSegments(
|
|
131067
|
-
if (!DOT_SEGMENT.test(
|
|
131068
|
-
const s =
|
|
131066
|
+
function dotSegments(path73) {
|
|
131067
|
+
if (!DOT_SEGMENT.test(path73)) return path73;
|
|
131068
|
+
const s = path73.split("/");
|
|
131069
131069
|
const out = [s[0]];
|
|
131070
131070
|
let dot = false;
|
|
131071
131071
|
for (let i10 = 1; i10 < s.length; i10++) {
|
|
131072
131072
|
const m10 = /^(?:\.|%2e)(\.|%2e)?$/i.exec(s[i10]);
|
|
131073
131073
|
if (m10) {
|
|
131074
|
-
if (m10[1] && (out.length > 1 || out[0]) && !isText(out.pop())) invalidSyntax(DOT_SEGMENT_NEXT_TO,
|
|
131074
|
+
if (m10[1] && (out.length > 1 || out[0]) && !isText(out.pop())) invalidSyntax(DOT_SEGMENT_NEXT_TO, path73);
|
|
131075
131075
|
dot = true;
|
|
131076
131076
|
continue;
|
|
131077
131077
|
}
|
|
131078
|
-
if (dot && /^[:*(]/.test(s[i10])) invalidSyntax(DOT_SEGMENT_NEXT_TO,
|
|
131078
|
+
if (dot && /^[:*(]/.test(s[i10])) invalidSyntax(DOT_SEGMENT_NEXT_TO, path73);
|
|
131079
131079
|
out.push(s[i10]);
|
|
131080
131080
|
dot = false;
|
|
131081
131081
|
}
|
|
@@ -131142,17 +131142,17 @@ function splitStar(segments, input2) {
|
|
|
131142
131142
|
function oneCatchAll(input2) {
|
|
131143
131143
|
throw new Error(`rou3: a route can have only one \`*\`, \`**\`, \`:name+\` or \`:name*\` (${input2})`);
|
|
131144
131144
|
}
|
|
131145
|
-
function splitRoute(
|
|
131146
|
-
const s = splitPath(
|
|
131145
|
+
function splitRoute(path73) {
|
|
131146
|
+
const s = splitPath(path73);
|
|
131147
131147
|
while (s[s.length - 1] === "") s.pop();
|
|
131148
|
-
if (
|
|
131148
|
+
if (path73.includes("**")) {
|
|
131149
131149
|
for (let i10 = 0; i10 < s.length; i10++) if (/^\*\*[^:{}]/.test(s[i10])) s.splice(i10, 1, ...s[i10][2] === "*" ? ["**", s[i10].slice(2)] : [s[i10].slice(1)]);
|
|
131150
131150
|
}
|
|
131151
131151
|
return s;
|
|
131152
131152
|
}
|
|
131153
|
-
function expandedRouteId(
|
|
131154
|
-
if (
|
|
131155
|
-
return "/" + splitRoute(encodeEscapes(
|
|
131153
|
+
function expandedRouteId(path73) {
|
|
131154
|
+
if (path73.charCodeAt(0) !== 47) return `{${expandedRouteId(`/${path73}`)}`;
|
|
131155
|
+
return "/" + splitRoute(encodeEscapes(path73)).map((segment) => {
|
|
131156
131156
|
const key = segmentKey(segment);
|
|
131157
131157
|
return typeof key === "string" ? key : segment;
|
|
131158
131158
|
}).join("/");
|
|
@@ -131174,40 +131174,40 @@ function segmentWildcards(segment) {
|
|
|
131174
131174
|
}
|
|
131175
131175
|
return at2;
|
|
131176
131176
|
}
|
|
131177
|
-
function scanFirstGroup(
|
|
131177
|
+
function scanFirstGroup(path73) {
|
|
131178
131178
|
let i10 = 0;
|
|
131179
131179
|
let depth = 0;
|
|
131180
|
-
for (; i10 <
|
|
131181
|
-
const c10 =
|
|
131180
|
+
for (; i10 < path73.length; i10++) {
|
|
131181
|
+
const c10 = path73.charCodeAt(i10);
|
|
131182
131182
|
if (c10 === 92) i10++;
|
|
131183
131183
|
else if (c10 === 40) depth++;
|
|
131184
131184
|
else if (c10 === 41 && depth > 0) depth--;
|
|
131185
131185
|
else if (c10 === 123 && depth === 0) break;
|
|
131186
131186
|
}
|
|
131187
|
-
if (i10 >=
|
|
131187
|
+
if (i10 >= path73.length) return;
|
|
131188
131188
|
let j10 = i10 + 1;
|
|
131189
131189
|
depth = 0;
|
|
131190
|
-
for (; j10 <
|
|
131191
|
-
const c10 =
|
|
131190
|
+
for (; j10 < path73.length; j10++) {
|
|
131191
|
+
const c10 = path73.charCodeAt(j10);
|
|
131192
131192
|
if (c10 === 92) j10++;
|
|
131193
131193
|
else if (c10 === 40) depth++;
|
|
131194
131194
|
else if (c10 === 41 && depth > 0) depth--;
|
|
131195
131195
|
else if (c10 === 125 && depth === 0) break;
|
|
131196
131196
|
}
|
|
131197
|
-
if (j10 >=
|
|
131198
|
-
const mod =
|
|
131197
|
+
if (j10 >= path73.length) return;
|
|
131198
|
+
const mod = path73[j10 + 1];
|
|
131199
131199
|
const hasMod = mod === "?" || mod === "+" || mod === "*";
|
|
131200
131200
|
return [
|
|
131201
|
-
|
|
131202
|
-
|
|
131203
|
-
|
|
131201
|
+
path73.slice(0, i10),
|
|
131202
|
+
path73.slice(i10 + 1, j10).replace(NAME_CHAR, "\\$&"),
|
|
131203
|
+
path73.slice(j10 + (hasMod ? 2 : 1)).replace(NAME_CHAR, "\\$&"),
|
|
131204
131204
|
hasMod ? mod : void 0
|
|
131205
131205
|
];
|
|
131206
131206
|
}
|
|
131207
131207
|
var NAME_CHAR = /^[\w$\x80-]/;
|
|
131208
|
-
function expandGroupDelimiters(
|
|
131209
|
-
if (!
|
|
131210
|
-
const group = scanFirstGroup(
|
|
131208
|
+
function expandGroupDelimiters(path73, input2 = path73) {
|
|
131209
|
+
if (!path73.includes("{")) return;
|
|
131210
|
+
const group = scanFirstGroup(path73);
|
|
131211
131211
|
if (!group) return;
|
|
131212
131212
|
const [pre2, body, suf, mod] = group;
|
|
131213
131213
|
if (mod === "+" || mod === "*") invalidSyntax(`unsupported \`{}${mod}\``, input2);
|
|
@@ -131309,43 +131309,43 @@ function linearRegExp(regexp) {
|
|
|
131309
131309
|
return source === regexp.source ? regexp : new RegExp(`^${head}${source.slice(1)}`);
|
|
131310
131310
|
}
|
|
131311
131311
|
var upTo = (L, back) => L.replace(/^\\/, "").length < 2 ? `[^/${L}]*` : back ? `(?:[^/](?<!${L}))*` : `(?:(?!${L})[^/])*`;
|
|
131312
|
-
function addRoute(ctx, method = "",
|
|
131312
|
+
function addRoute(ctx, method = "", path73, data) {
|
|
131313
131313
|
method = method.toUpperCase();
|
|
131314
|
-
|
|
131315
|
-
checkConstraints(
|
|
131316
|
-
const resolved = dotSegments(
|
|
131314
|
+
path73 = absolutePattern(path73);
|
|
131315
|
+
checkConstraints(path73);
|
|
131316
|
+
const resolved = dotSegments(path73);
|
|
131317
131317
|
const [route, unnamed] = starGroups(resolved);
|
|
131318
131318
|
variants = void 0;
|
|
131319
|
-
_add(ctx, method, route, data, unnamed && expandedRouteId(resolved),
|
|
131319
|
+
_add(ctx, method, route, data, unnamed && expandedRouteId(resolved), path73, unnamed);
|
|
131320
131320
|
}
|
|
131321
131321
|
var variants;
|
|
131322
|
-
function _add(ctx, method,
|
|
131323
|
-
const groupExpanded = expandGroupDelimiters(
|
|
131322
|
+
function _add(ctx, method, path73, data, route, input2 = path73, unnamed = same) {
|
|
131323
|
+
const groupExpanded = expandGroupDelimiters(path73, input2);
|
|
131324
131324
|
if (groupExpanded) {
|
|
131325
131325
|
if (groupExpanded[1] !== void 0) {
|
|
131326
|
-
route ??= expandedRouteId(
|
|
131326
|
+
route ??= expandedRouteId(path73);
|
|
131327
131327
|
variants ??= {};
|
|
131328
131328
|
}
|
|
131329
131329
|
_add(ctx, method, groupExpanded[0], data, route, input2, unnamed);
|
|
131330
|
-
if (groupExpanded[1] !== void 0) _add(ctx, method, groupExpanded[1], data, route, input2, /[*(]/.test(
|
|
131330
|
+
if (groupExpanded[1] !== void 0) _add(ctx, method, groupExpanded[1], data, route, input2, /[*(]/.test(path73) ? skipGroup(path73, input2, unnamed) : unnamed);
|
|
131331
131331
|
return 0;
|
|
131332
131332
|
}
|
|
131333
|
-
|
|
131334
|
-
const segments = splitRoute(
|
|
131333
|
+
path73 = encodeEscapes(path73);
|
|
131334
|
+
const segments = splitRoute(path73);
|
|
131335
131335
|
const expanded = expandModifiers(segments, input2);
|
|
131336
131336
|
if (expanded) {
|
|
131337
|
-
route ??= expandedRouteId(
|
|
131337
|
+
route ??= expandedRouteId(path73);
|
|
131338
131338
|
variants ??= {};
|
|
131339
131339
|
let count2 = 0;
|
|
131340
131340
|
for (const p of expanded) count2 = _add(ctx, method, p, data, route, input2, unnamed);
|
|
131341
131341
|
return count2;
|
|
131342
131342
|
}
|
|
131343
|
-
const star =
|
|
131343
|
+
const star = path73.includes("*");
|
|
131344
131344
|
const split = star ? splitStar(segments, input2) : void 0;
|
|
131345
131345
|
if (split) {
|
|
131346
131346
|
const [routes, join4, head] = split;
|
|
131347
131347
|
if (routes.length > 1) {
|
|
131348
|
-
route ??= expandedRouteId(
|
|
131348
|
+
route ??= expandedRouteId(path73);
|
|
131349
131349
|
variants ??= {};
|
|
131350
131350
|
}
|
|
131351
131351
|
let count2 = 0;
|
|
@@ -131465,8 +131465,8 @@ function _insert(ctx, method, segments, data, route, input2, unnamed, star, join
|
|
|
131465
131465
|
return _unnamedParamIndex;
|
|
131466
131466
|
}
|
|
131467
131467
|
var same = (index) => index;
|
|
131468
|
-
function skipGroup(
|
|
131469
|
-
const [pre2, body] = scanFirstGroup(
|
|
131468
|
+
function skipGroup(path73, input2, unnamed = same) {
|
|
131469
|
+
const [pre2, body] = scanFirstGroup(path73);
|
|
131470
131470
|
if (!/[*(]/.test(body) && !pre2.endsWith("*")) return unnamed;
|
|
131471
131471
|
const count2 = (p) => _add(createRouter(), "", p, void 0, void 0, input2);
|
|
131472
131472
|
const before = count2(pre2);
|
|
@@ -131528,11 +131528,11 @@ function kindAt(m10, n10, p) {
|
|
|
131528
131528
|
} else if ((suffix && index > suffix[0] ? index - suffix[0] - 1 + end : index) === p) return typeof name === "string" || plain ? 0 : 2;
|
|
131529
131529
|
return 3;
|
|
131530
131530
|
}
|
|
131531
|
-
function findAllRoutes(ctx, method = "",
|
|
131532
|
-
if (opts?.normalize)
|
|
131533
|
-
const slash =
|
|
131534
|
-
if (slash)
|
|
131535
|
-
const segments = splitPath(
|
|
131531
|
+
function findAllRoutes(ctx, method = "", path73, opts) {
|
|
131532
|
+
if (opts?.normalize) path73 = normalizePath(path73);
|
|
131533
|
+
const slash = path73.charCodeAt(path73.length - 1) === 47;
|
|
131534
|
+
if (slash) path73 = path73.slice(0, -1);
|
|
131535
|
+
const segments = splitPath(path73);
|
|
131536
131536
|
const matches2 = _findRanked(ctx, method, segments);
|
|
131537
131537
|
let seen;
|
|
131538
131538
|
for (let i10 = matches2.length - 1; i10 >= 0; i10--) {
|
|
@@ -131589,16 +131589,16 @@ function pushSorted(matches2, match, reverse) {
|
|
|
131589
131589
|
}).sort((a10, b) => a10[1] - b[1]).map((e14) => e14[0]);
|
|
131590
131590
|
for (const m10 of match) matches2.push(m10);
|
|
131591
131591
|
}
|
|
131592
|
-
function findRoute(ctx, method = "",
|
|
131593
|
-
if (opts?.normalize)
|
|
131594
|
-
const slash =
|
|
131595
|
-
if (slash)
|
|
131596
|
-
const staticNode = ctx.static[
|
|
131592
|
+
function findRoute(ctx, method = "", path73, opts) {
|
|
131593
|
+
if (opts?.normalize) path73 = normalizePath(path73);
|
|
131594
|
+
const slash = path73.charCodeAt(path73.length - 1) === 47;
|
|
131595
|
+
if (slash) path73 = path73.slice(0, -1);
|
|
131596
|
+
const staticNode = ctx.static[path73];
|
|
131597
131597
|
if (staticNode && staticNode.methods) {
|
|
131598
131598
|
const staticMatch = staticNode.methods[method] || staticNode.methods[""];
|
|
131599
131599
|
if (staticMatch !== void 0) return { data: staticMatch[0].data };
|
|
131600
131600
|
}
|
|
131601
|
-
const segments = splitPath(
|
|
131601
|
+
const segments = splitPath(path73);
|
|
131602
131602
|
let match;
|
|
131603
131603
|
if (segments.includes("") || ctx.root.hasSuffix && hasSuffixMatch(ctx.root, method, segments, 0)) {
|
|
131604
131604
|
const matches2 = _findRanked(ctx, method, segments, true);
|
|
@@ -131894,8 +131894,8 @@ var STAR_SEGMENT = "*/";
|
|
|
131894
131894
|
function routeToRegExp(route = "/") {
|
|
131895
131895
|
route = absolutePattern(route);
|
|
131896
131896
|
addRoute(createRouter(), "", route);
|
|
131897
|
-
const [
|
|
131898
|
-
return new RegExp(determinize(toRegExp(
|
|
131897
|
+
const [path73, unnamed] = starGroups(dotSegments(route));
|
|
131898
|
+
return new RegExp(determinize(toRegExp(path73, route, unnamed).source));
|
|
131899
131899
|
}
|
|
131900
131900
|
function toRegExp(route, input2, unnamed) {
|
|
131901
131901
|
const inlineOptional = inlineOptionalGroup(route, input2, unnamed);
|
|
@@ -132252,7 +132252,7 @@ var OpenAPIMatcher = class {
|
|
|
132252
132252
|
this.rootRouter = router;
|
|
132253
132253
|
this.index(router);
|
|
132254
132254
|
}
|
|
132255
|
-
index(router,
|
|
132255
|
+
index(router, path73 = []) {
|
|
132256
132256
|
const routes = [];
|
|
132257
132257
|
const lazyResults = walkProcedureContractsSync(router, (contract, path210) => {
|
|
132258
132258
|
if (!value(this.filter, contract, path210)) {
|
|
@@ -132273,7 +132273,7 @@ var OpenAPIMatcher = class {
|
|
|
132273
132273
|
...route
|
|
132274
132274
|
}
|
|
132275
132275
|
});
|
|
132276
|
-
},
|
|
132276
|
+
}, path73);
|
|
132277
132277
|
const pendingLazyRouters = lazyResults.map((result) => {
|
|
132278
132278
|
const prefix = getOpenAPIMeta(result.router)?.prefix;
|
|
132279
132279
|
return {
|
|
@@ -132373,10 +132373,10 @@ var OpenAPIMatcher = class {
|
|
|
132373
132373
|
return entry.procedure;
|
|
132374
132374
|
}
|
|
132375
132375
|
};
|
|
132376
|
-
function toRou3Route(
|
|
132377
|
-
const dynamicParams = getDynamicPathParams(
|
|
132376
|
+
function toRou3Route(path73) {
|
|
132377
|
+
const dynamicParams = getDynamicPathParams(path73);
|
|
132378
132378
|
if (!dynamicParams) {
|
|
132379
|
-
return { pattern: toRou3Literal(
|
|
132379
|
+
return { pattern: toRou3Literal(path73) };
|
|
132380
132380
|
}
|
|
132381
132381
|
let pattern = "";
|
|
132382
132382
|
let literalStart = 0;
|
|
@@ -132385,11 +132385,11 @@ function toRou3Route(path72) {
|
|
|
132385
132385
|
for (const param of dynamicParams) {
|
|
132386
132386
|
const key = `p${params.length}`;
|
|
132387
132387
|
params.push([key, param.parameterName]);
|
|
132388
|
-
pattern += toRou3Literal(
|
|
132388
|
+
pattern += toRou3Literal(path73.slice(literalStart, param.startIndex));
|
|
132389
132389
|
literalStart = param.startIndex + param.segment.length;
|
|
132390
132390
|
if (param.allowsSlash) {
|
|
132391
132391
|
if (catchAllKey !== void 0) {
|
|
132392
|
-
throw new TypeError(`OpenAPI path "${
|
|
132392
|
+
throw new TypeError(`OpenAPI path "${path73}" has more than one catch-all param ({+name}), but only one is supported per path.`);
|
|
132393
132393
|
}
|
|
132394
132394
|
catchAllKey = key;
|
|
132395
132395
|
pattern += `:${key}(.*)`;
|
|
@@ -132397,7 +132397,7 @@ function toRou3Route(path72) {
|
|
|
132397
132397
|
pattern += `:${key}`;
|
|
132398
132398
|
}
|
|
132399
132399
|
}
|
|
132400
|
-
pattern += toRou3Literal(
|
|
132400
|
+
pattern += toRou3Literal(path73.slice(literalStart));
|
|
132401
132401
|
return { pattern, params, catchAllKey };
|
|
132402
132402
|
}
|
|
132403
132403
|
var ROU3_SYNTAX_REGEX = /[\\:*?+(){}]|(?<![^/])\.(?=\.?(?:\/|$))/g;
|
|
@@ -132405,8 +132405,8 @@ function toRou3Literal(text5) {
|
|
|
132405
132405
|
const normalized = NORMALIZABLE_PATHNAME_REGEX2.test(text5) ? normalizeRou3Path(text5) : text5;
|
|
132406
132406
|
return normalized.replace(ROU3_SYNTAX_REGEX, "\\$&");
|
|
132407
132407
|
}
|
|
132408
|
-
function normalizeRou3Path(
|
|
132409
|
-
return
|
|
132408
|
+
function normalizeRou3Path(path73) {
|
|
132409
|
+
return path73.split("/").map((segment) => safeDecodeURIComponent(segment).replace(ROU3_ENCODED_SEGMENT_TEXT_REGEX, safeEncodeURIComponent)).join("/");
|
|
132410
132410
|
}
|
|
132411
132411
|
function toRou3PrefixMatcher(prefix) {
|
|
132412
132412
|
const catchAll = getDynamicPathParams(prefix)?.find((param) => param.allowsSlash);
|
|
@@ -132496,7 +132496,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
132496
132496
|
/**
|
|
132497
132497
|
* @throws {TypeError} If `outputStructure` is "detailed" and the output doesn't match the expected structure.
|
|
132498
132498
|
*/
|
|
132499
|
-
encodeOutput(output2, procedure,
|
|
132499
|
+
encodeOutput(output2, procedure, path73) {
|
|
132500
132500
|
const meta3 = getOpenAPIMeta(procedure);
|
|
132501
132501
|
const successStatus = meta3?.successStatus ?? DEFAULT_SUCCESS_STATUS;
|
|
132502
132502
|
const outputStructure = meta3?.outputStructure ?? DEFAULT_OPENAPI_OUTPUT_STRUCTURE;
|
|
@@ -132509,7 +132509,7 @@ var OpenAPIHandlerCodecCore = class {
|
|
|
132509
132509
|
}
|
|
132510
132510
|
if (!isValidDetailedOutput(output2)) {
|
|
132511
132511
|
throw new TypeError(`
|
|
132512
|
-
Invalid "detailed" output structure returned by procedure (${
|
|
132512
|
+
Invalid "detailed" output structure returned by procedure (${path73.join(".")}):
|
|
132513
132513
|
\u2022 Expected an object with optional properties:
|
|
132514
132514
|
- status (number <400)
|
|
132515
132515
|
- headers (object)
|
|
@@ -133085,7 +133085,7 @@ function profileValue(name, paths) {
|
|
|
133085
133085
|
function createConfigApiRouter(deps) {
|
|
133086
133086
|
const authed = doorApiAuth(deps.expectedToken);
|
|
133087
133087
|
const { paths } = deps;
|
|
133088
|
-
const route = (
|
|
133088
|
+
const route = (path73, summary) => authed.meta(openapi({ method: "POST", path: path73, summary, tags: [CONFIG_API_TAG] }));
|
|
133089
133089
|
return {
|
|
133090
133090
|
config: {
|
|
133091
133091
|
identity: {
|
|
@@ -135190,8 +135190,8 @@ function createCodexRouteMount(ports, upstreamBase, provider) {
|
|
|
135190
135190
|
request7.body.resume();
|
|
135191
135191
|
return;
|
|
135192
135192
|
}
|
|
135193
|
-
const
|
|
135194
|
-
const translated = { method: request7.method, path:
|
|
135193
|
+
const path73 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
135194
|
+
const translated = { method: request7.method, path: path73, body, signal: request7.signal };
|
|
135195
135195
|
const routed = await route(translated);
|
|
135196
135196
|
if (request7.signal.aborted) {
|
|
135197
135197
|
return;
|
|
@@ -135812,8 +135812,8 @@ function createAntigravityRouteMount(ports, upstreamBase, provider) {
|
|
|
135812
135812
|
request7.body.resume();
|
|
135813
135813
|
return;
|
|
135814
135814
|
}
|
|
135815
|
-
const
|
|
135816
|
-
const translated = { method: request7.method, path:
|
|
135815
|
+
const path73 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
135816
|
+
const translated = { method: request7.method, path: path73, body, signal: request7.signal };
|
|
135817
135817
|
const routed = await route(translated);
|
|
135818
135818
|
if (request7.signal.aborted) {
|
|
135819
135819
|
return;
|
|
@@ -135857,7 +135857,7 @@ function createPassthroughRoute(name, target) {
|
|
|
135857
135857
|
headroomUpstream: target.headroomUpstream,
|
|
135858
135858
|
serve: async (request7, response) => {
|
|
135859
135859
|
const incoming = new URL(request7.url, "http://127.0.0.1");
|
|
135860
|
-
const
|
|
135860
|
+
const path73 = target.stripPrefix !== void 0 && incoming.pathname.startsWith(target.stripPrefix) ? incoming.pathname.slice(target.stripPrefix.length) : incoming.pathname;
|
|
135861
135861
|
const headers = forwardableHeaders(request7.headers);
|
|
135862
135862
|
delete headers.host;
|
|
135863
135863
|
await new Promise((resolve3) => {
|
|
@@ -135865,7 +135865,7 @@ function createPassthroughRoute(name, target) {
|
|
|
135865
135865
|
host: base.hostname,
|
|
135866
135866
|
port: base.port === "" ? void 0 : Number(base.port),
|
|
135867
135867
|
method: request7.method,
|
|
135868
|
-
path: `${basePath}${
|
|
135868
|
+
path: `${basePath}${path73}${incoming.search}`,
|
|
135869
135869
|
headers,
|
|
135870
135870
|
agent
|
|
135871
135871
|
};
|
|
@@ -136071,13 +136071,13 @@ async function scanRequestHead(request7, wholeBody = false) {
|
|
|
136071
136071
|
}
|
|
136072
136072
|
|
|
136073
136073
|
// src/frontdoor/providerRoute.ts
|
|
136074
|
-
var isRcSelfHostPath = (
|
|
136074
|
+
var isRcSelfHostPath = (path73) => path73 === "/v1/code/sessions" || path73.startsWith("/v1/code/sessions/") || path73 === "/v1/sessions" || path73.startsWith("/v1/sessions/");
|
|
136075
136075
|
function scopeSessionProviderPath(request7) {
|
|
136076
136076
|
if (request7.session.provider === void 0) {
|
|
136077
136077
|
return request7;
|
|
136078
136078
|
}
|
|
136079
|
-
const
|
|
136080
|
-
if (!
|
|
136079
|
+
const path73 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
136080
|
+
if (!path73.startsWith("/v1/") || isRcSelfHostPath(path73)) {
|
|
136081
136081
|
return request7;
|
|
136082
136082
|
}
|
|
136083
136083
|
return { ...request7, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(request7.session.provider)}${request7.url}` };
|
|
@@ -136201,13 +136201,13 @@ function createProviderRouteResolver(deps) {
|
|
|
136201
136201
|
return route;
|
|
136202
136202
|
};
|
|
136203
136203
|
const resolve3 = (request7) => {
|
|
136204
|
-
const
|
|
136205
|
-
const scoped = parseProviderPath(
|
|
136204
|
+
const path73 = new URL(request7.url, "http://127.0.0.1").pathname;
|
|
136205
|
+
const scoped = parseProviderPath(path73);
|
|
136206
136206
|
if (scoped === void 0) {
|
|
136207
|
-
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(
|
|
136207
|
+
if (deps.rcSelfHostRoute !== void 0 && isRcSelfHostPath(path73)) {
|
|
136208
136208
|
return { ok: true, route: deps.rcSelfHostRoute };
|
|
136209
136209
|
}
|
|
136210
|
-
return
|
|
136210
|
+
return path73.startsWith("/v1/") ? { ok: true, route: oauthRoute } : { ok: false, status: HTTP_STATUS.notFound, message: `no such endpoint: ${path73}` };
|
|
136211
136211
|
}
|
|
136212
136212
|
const { provider } = scoped;
|
|
136213
136213
|
let definition;
|
|
@@ -136302,8 +136302,8 @@ function createProviderRouteResolver(deps) {
|
|
|
136302
136302
|
let modelChoice;
|
|
136303
136303
|
const visited = /* @__PURE__ */ new Set();
|
|
136304
136304
|
for (; ; ) {
|
|
136305
|
-
const
|
|
136306
|
-
const scoped = parseProviderPath(
|
|
136305
|
+
const path73 = new URL(current.url, "http://127.0.0.1").pathname;
|
|
136306
|
+
const scoped = parseProviderPath(path73);
|
|
136307
136307
|
const providerName = scoped?.provider ?? current.session.provider;
|
|
136308
136308
|
if (providerName !== void 0 && visited.has(providerName)) {
|
|
136309
136309
|
return { ok: false, status: HTTP_STATUS.internalServerError, message: `provider routing cycle: ${[...visited, providerName].join(" -> ")}` };
|
|
@@ -136318,7 +136318,7 @@ function createProviderRouteResolver(deps) {
|
|
|
136318
136318
|
} catch {
|
|
136319
136319
|
routes = void 0;
|
|
136320
136320
|
}
|
|
136321
|
-
const resolvesNames = !nameResolved && !isRcSelfHostPath(
|
|
136321
|
+
const resolvesNames = !nameResolved && !isRcSelfHostPath(path73);
|
|
136322
136322
|
if (resolvesNames) {
|
|
136323
136323
|
const scan2 = await scanRequestHead(current, true);
|
|
136324
136324
|
if (scan2.replayed === void 0) {
|
|
@@ -136357,7 +136357,7 @@ function createProviderRouteResolver(deps) {
|
|
|
136357
136357
|
}
|
|
136358
136358
|
if (routed.provider !== providerName) {
|
|
136359
136359
|
const scopedPrefix = providerName === void 0 ? void 0 : `${PROVIDER_PATH_PREFIX}${encodeURIComponent(providerName)}`;
|
|
136360
|
-
const rest2 = scopedPrefix !== void 0 &&
|
|
136360
|
+
const rest2 = scopedPrefix !== void 0 && path73.startsWith(scopedPrefix) ? path73.slice(scopedPrefix.length) : path73;
|
|
136361
136361
|
const query2 = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
|
|
136362
136362
|
const carried = replay;
|
|
136363
136363
|
current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(routed.provider)}${rest2}${query2}`, body: carried.body, headers: carried.headers };
|
|
@@ -136411,7 +136411,7 @@ function createProviderRouteResolver(deps) {
|
|
|
136411
136411
|
const headers = Object.fromEntries(Object.entries(replay.headers).filter(([name]) => name.toLowerCase() !== "content-length"));
|
|
136412
136412
|
replay = { ...replay, headers, body: import_node_stream3.Readable.from([Buffer.from(rewritten, "utf8")]) };
|
|
136413
136413
|
}
|
|
136414
|
-
const rest = scoped === void 0 ?
|
|
136414
|
+
const rest = scoped === void 0 ? path73 : path73.slice(`${PROVIDER_PATH_PREFIX}${encodeURIComponent(scoped.provider)}`.length);
|
|
136415
136415
|
const query = current.url.includes("?") ? current.url.slice(current.url.indexOf("?")) : "";
|
|
136416
136416
|
current = { ...current, url: `${PROVIDER_PATH_PREFIX}${encodeURIComponent(matched.provider)}${rest}${query}`, body: replay.body, headers: replay.headers };
|
|
136417
136417
|
}
|
|
@@ -140380,7 +140380,7 @@ function registerFrontDoorCommand(program2, deps) {
|
|
|
140380
140380
|
// src/statusline/commands.ts
|
|
140381
140381
|
var import_node_child_process9 = require("node:child_process");
|
|
140382
140382
|
var import_node_os13 = __toESM(require("node:os"), 1);
|
|
140383
|
-
var
|
|
140383
|
+
var import_node_path63 = __toESM(require("node:path"), 1);
|
|
140384
140384
|
init_commandDeps();
|
|
140385
140385
|
init_load();
|
|
140386
140386
|
init_statusline();
|
|
@@ -141152,12 +141152,17 @@ function nonBlank(value2) {
|
|
|
141152
141152
|
function viewOf(payload) {
|
|
141153
141153
|
return {
|
|
141154
141154
|
clientModelName: nonBlank(payload.model?.display_name) ?? nonBlank(payload.model?.id),
|
|
141155
|
-
|
|
141156
|
-
|
|
141157
|
-
|
|
141158
|
-
|
|
141159
|
-
|
|
141160
|
-
|
|
141155
|
+
...contextViewOf(payload.context_window),
|
|
141156
|
+
cacheHitRatio: payload.prompt_cache?.hit_ratio
|
|
141157
|
+
};
|
|
141158
|
+
}
|
|
141159
|
+
function contextViewOf(frame) {
|
|
141160
|
+
return {
|
|
141161
|
+
contextUsedPercentage: reportedPercent(frame?.used_percentage),
|
|
141162
|
+
contextTotalTokens: nonNegative(frame?.total_input_tokens),
|
|
141163
|
+
contextWindowTokens: frame?.context_window_size,
|
|
141164
|
+
cacheReadTokens: frame?.current_usage?.cache_read_input_tokens,
|
|
141165
|
+
freshInputTokens: frame?.current_usage?.input_tokens
|
|
141161
141166
|
};
|
|
141162
141167
|
}
|
|
141163
141168
|
|
|
@@ -141339,7 +141344,11 @@ function realStatuslinePorts(env, stateDirectory, runTimeoutMs = RUN_TIMEOUT_MS)
|
|
|
141339
141344
|
run: (file2, args, cwd, options) => runProgram(import_node_path56.default.join(stateDirectory, RUN_DIRECTORY), runTimeoutMs, file2, args, cwd, options),
|
|
141340
141345
|
entryKind: (target) => {
|
|
141341
141346
|
try {
|
|
141342
|
-
|
|
141347
|
+
const stats = import_node_fs23.default.lstatSync(target);
|
|
141348
|
+
if (stats.isDirectory()) {
|
|
141349
|
+
return "directory";
|
|
141350
|
+
}
|
|
141351
|
+
return stats.isFile() ? "file" : "other";
|
|
141343
141352
|
} catch {
|
|
141344
141353
|
return void 0;
|
|
141345
141354
|
}
|
|
@@ -141358,6 +141367,15 @@ function realStatuslinePorts(env, stateDirectory, runTimeoutMs = RUN_TIMEOUT_MS)
|
|
|
141358
141367
|
return void 0;
|
|
141359
141368
|
}
|
|
141360
141369
|
},
|
|
141370
|
+
fileSize: (target) => {
|
|
141371
|
+
try {
|
|
141372
|
+
const stats = import_node_fs23.default.statSync(target);
|
|
141373
|
+
return stats.isFile() ? stats.size : void 0;
|
|
141374
|
+
} catch {
|
|
141375
|
+
return void 0;
|
|
141376
|
+
}
|
|
141377
|
+
},
|
|
141378
|
+
absolutePath: (target) => import_node_path56.default.resolve(target),
|
|
141361
141379
|
listDirectory: (target) => {
|
|
141362
141380
|
try {
|
|
141363
141381
|
return import_node_fs23.default.readdirSync(target);
|
|
@@ -141682,14 +141700,76 @@ function extraSegment({ settings: settings2, payload, ports }) {
|
|
|
141682
141700
|
}
|
|
141683
141701
|
|
|
141684
141702
|
// src/statusline/dailyLedger.ts
|
|
141685
|
-
var
|
|
141703
|
+
var import_node_path58 = __toESM(require("node:path"), 1);
|
|
141686
141704
|
init_zod();
|
|
141687
141705
|
init_schema2();
|
|
141688
|
-
|
|
141706
|
+
|
|
141707
|
+
// src/statusline/cacheFile.ts
|
|
141708
|
+
var import_node_crypto26 = require("node:crypto");
|
|
141709
|
+
var import_node_path57 = __toESM(require("node:path"), 1);
|
|
141710
|
+
var SESSION_CACHE_DIRECTORY = "session";
|
|
141711
|
+
function cacheDirectory(ports) {
|
|
141712
|
+
return import_node_path57.default.join(ports.stateDirectory, SESSION_CACHE_DIRECTORY);
|
|
141713
|
+
}
|
|
141714
|
+
function cacheFileFor(ports, kind, transcriptPath) {
|
|
141715
|
+
return import_node_path57.default.join(cacheDirectory(ports), `${kind}-${(0, import_node_crypto26.createHash)("sha256").update(transcriptPath).digest("hex")}.json`);
|
|
141716
|
+
}
|
|
141717
|
+
function transcriptKeyOf(ports, transcriptPath) {
|
|
141718
|
+
const trimmed = transcriptPath.trim();
|
|
141719
|
+
return trimmed === "" ? void 0 : ports.absolutePath(trimmed);
|
|
141720
|
+
}
|
|
141721
|
+
var RETENTION_DAYS = 30;
|
|
141689
141722
|
var HOURS_PER_DAY8 = 24;
|
|
141723
|
+
var MINUTES_PER_HOUR5 = 60;
|
|
141724
|
+
var SECONDS_PER_MINUTE3 = 60;
|
|
141725
|
+
var MS_PER_SECOND19 = 1e3;
|
|
141726
|
+
var CACHE_RETENTION_MS = RETENTION_DAYS * HOURS_PER_DAY8 * MINUTES_PER_HOUR5 * SECONDS_PER_MINUTE3 * MS_PER_SECOND19;
|
|
141727
|
+
function pruneCache(ports, cutoffMs) {
|
|
141728
|
+
const directory = cacheDirectory(ports);
|
|
141729
|
+
const names = ports.listDirectory(directory);
|
|
141730
|
+
if (names === void 0) {
|
|
141731
|
+
return;
|
|
141732
|
+
}
|
|
141733
|
+
for (const name of names) {
|
|
141734
|
+
const file2 = import_node_path57.default.join(directory, name);
|
|
141735
|
+
const modifiedAtMs = ports.modifiedAtMs(file2);
|
|
141736
|
+
if (modifiedAtMs !== void 0 && modifiedAtMs < cutoffMs) {
|
|
141737
|
+
ports.removePath(file2);
|
|
141738
|
+
}
|
|
141739
|
+
}
|
|
141740
|
+
}
|
|
141741
|
+
function readStateText(ports, file2) {
|
|
141742
|
+
return ports.fileSize(file2) === void 0 ? void 0 : ports.readText(file2);
|
|
141743
|
+
}
|
|
141744
|
+
function loadCache(ports, file2, schema) {
|
|
141745
|
+
const text5 = readStateText(ports, file2);
|
|
141746
|
+
if (text5 === void 0) {
|
|
141747
|
+
return void 0;
|
|
141748
|
+
}
|
|
141749
|
+
let parsed;
|
|
141750
|
+
try {
|
|
141751
|
+
parsed = JSON.parse(text5);
|
|
141752
|
+
} catch {
|
|
141753
|
+
return void 0;
|
|
141754
|
+
}
|
|
141755
|
+
const result = schema.safeParse(parsed);
|
|
141756
|
+
return result.success ? result.data : void 0;
|
|
141757
|
+
}
|
|
141758
|
+
function saveCache(ports, file2, value2, nowMs) {
|
|
141759
|
+
const isNew = ports.entryKind(file2) !== "file";
|
|
141760
|
+
ports.writeText(file2, JSON.stringify(value2));
|
|
141761
|
+
if (isNew) {
|
|
141762
|
+
pruneCache(ports, nowMs - CACHE_RETENTION_MS);
|
|
141763
|
+
}
|
|
141764
|
+
return isNew;
|
|
141765
|
+
}
|
|
141766
|
+
|
|
141767
|
+
// src/statusline/dailyLedger.ts
|
|
141768
|
+
var DAILY_LEDGER_DIRECTORY = "daily-cost";
|
|
141769
|
+
var HOURS_PER_DAY9 = 24;
|
|
141690
141770
|
var MS_PER_HOUR5 = 36e5;
|
|
141691
|
-
var SESSION_MAX_AGE_MS =
|
|
141692
|
-
var LAST_SEEN_REFRESH_MS = SESSION_MAX_AGE_MS /
|
|
141771
|
+
var SESSION_MAX_AGE_MS = HOURS_PER_DAY9 * MS_PER_HOUR5;
|
|
141772
|
+
var LAST_SEEN_REFRESH_MS = SESSION_MAX_AGE_MS / HOURS_PER_DAY9;
|
|
141693
141773
|
var ENTRY_FILE = new RegExp(`^${CLIENT_SESSION_ID_PATTERN.source.slice(1, -1)}\\.json$`);
|
|
141694
141774
|
var DAY_NAME = /^\d{4}-\d{2}-\d{2}$/;
|
|
141695
141775
|
var usd = external_exports.number().nonnegative();
|
|
@@ -141726,27 +141806,27 @@ function advance(existing, carried, cost, nowMs) {
|
|
|
141726
141806
|
return { entry: existing, changed: false };
|
|
141727
141807
|
}
|
|
141728
141808
|
function recordDailySpend(ports, nowMs, sessionId, cost) {
|
|
141729
|
-
const root =
|
|
141809
|
+
const root = import_node_path58.default.join(ports.stateDirectory, DAILY_LEDGER_DIRECTORY);
|
|
141730
141810
|
const today = localDay(nowMs);
|
|
141731
141811
|
const days = (ports.listDirectory(root) ?? []).filter((name) => DAY_NAME.test(name));
|
|
141732
141812
|
const previous = days.filter((day) => day < today).sort().at(-1);
|
|
141733
141813
|
for (const day of days) {
|
|
141734
141814
|
if (day < today && day !== previous) {
|
|
141735
|
-
ports.removePath(
|
|
141815
|
+
ports.removePath(import_node_path58.default.join(root, day));
|
|
141736
141816
|
}
|
|
141737
141817
|
}
|
|
141738
|
-
const todayDirectory =
|
|
141818
|
+
const todayDirectory = import_node_path58.default.join(root, today);
|
|
141739
141819
|
if (sessionId !== void 0 && cost !== void 0 && CLIENT_SESSION_ID_PATTERN.test(sessionId)) {
|
|
141740
|
-
const file2 =
|
|
141741
|
-
const carried = previous === void 0 ? void 0 : parseEntry3(ports.
|
|
141742
|
-
const next = advance(parseEntry3(ports
|
|
141820
|
+
const file2 = import_node_path58.default.join(todayDirectory, `${sessionId}.json`);
|
|
141821
|
+
const carried = previous === void 0 ? void 0 : parseEntry3(readStateText(ports, import_node_path58.default.join(root, previous, `${sessionId}.json`)));
|
|
141822
|
+
const next = advance(parseEntry3(readStateText(ports, file2)), carried, cost, nowMs);
|
|
141743
141823
|
if (next?.changed === true) {
|
|
141744
141824
|
ports.writeText(file2, `${JSON.stringify(next.entry)}
|
|
141745
141825
|
`);
|
|
141746
141826
|
}
|
|
141747
141827
|
}
|
|
141748
141828
|
const entries = (ports.listDirectory(todayDirectory) ?? []).filter((name) => ENTRY_FILE.test(name)).flatMap((name) => {
|
|
141749
|
-
const entry = parseEntry3(ports.
|
|
141829
|
+
const entry = parseEntry3(readStateText(ports, import_node_path58.default.join(todayDirectory, name)));
|
|
141750
141830
|
return entry === void 0 ? [] : [entry];
|
|
141751
141831
|
});
|
|
141752
141832
|
return entries.length === 0 ? void 0 : entries.reduce((sum2, entry) => sum2 + (entry.totalUsd - entry.baselineUsd), 0);
|
|
@@ -141766,33 +141846,33 @@ function dailyCostSegment(context) {
|
|
|
141766
141846
|
}
|
|
141767
141847
|
|
|
141768
141848
|
// src/statusline/elements/sessionFormat.ts
|
|
141769
|
-
var
|
|
141770
|
-
var
|
|
141771
|
-
var
|
|
141772
|
-
var
|
|
141849
|
+
var MS_PER_SECOND20 = 1e3;
|
|
141850
|
+
var SECONDS_PER_MINUTE4 = 60;
|
|
141851
|
+
var MINUTES_PER_HOUR6 = 60;
|
|
141852
|
+
var HOURS_PER_DAY10 = 24;
|
|
141773
141853
|
function formatElapsed(ms2) {
|
|
141774
|
-
const minutes = Math.floor(ms2 / (
|
|
141854
|
+
const minutes = Math.floor(ms2 / (MS_PER_SECOND20 * SECONDS_PER_MINUTE4));
|
|
141775
141855
|
if (minutes < 1) {
|
|
141776
141856
|
return "<1m";
|
|
141777
141857
|
}
|
|
141778
|
-
if (minutes <
|
|
141858
|
+
if (minutes < MINUTES_PER_HOUR6) {
|
|
141779
141859
|
return `${String(minutes)}m`;
|
|
141780
141860
|
}
|
|
141781
|
-
return `${String(Math.floor(minutes /
|
|
141861
|
+
return `${String(Math.floor(minutes / MINUTES_PER_HOUR6))}h ${String(minutes % MINUTES_PER_HOUR6)}m`;
|
|
141782
141862
|
}
|
|
141783
141863
|
function formatSpan(ms2) {
|
|
141784
|
-
if (ms2 <
|
|
141864
|
+
if (ms2 < MS_PER_SECOND20) {
|
|
141785
141865
|
return "<1s";
|
|
141786
141866
|
}
|
|
141787
|
-
const seconds = Math.floor(ms2 /
|
|
141788
|
-
if (seconds <
|
|
141867
|
+
const seconds = Math.floor(ms2 / MS_PER_SECOND20);
|
|
141868
|
+
if (seconds < SECONDS_PER_MINUTE4) {
|
|
141789
141869
|
return `${String(seconds)}s`;
|
|
141790
141870
|
}
|
|
141791
|
-
const minutes = Math.floor(seconds /
|
|
141792
|
-
if (minutes <
|
|
141793
|
-
return `${String(minutes)}m ${String(seconds %
|
|
141871
|
+
const minutes = Math.floor(seconds / SECONDS_PER_MINUTE4);
|
|
141872
|
+
if (minutes < MINUTES_PER_HOUR6) {
|
|
141873
|
+
return `${String(minutes)}m ${String(seconds % SECONDS_PER_MINUTE4)}s`;
|
|
141794
141874
|
}
|
|
141795
|
-
return `${String(Math.floor(minutes /
|
|
141875
|
+
return `${String(Math.floor(minutes / MINUTES_PER_HOUR6))}h ${String(minutes % MINUTES_PER_HOUR6)}m`;
|
|
141796
141876
|
}
|
|
141797
141877
|
function twoUnits(larger2, smaller, largerUnit, smallerUnit) {
|
|
141798
141878
|
return smaller > 0 ? `${String(larger2)}${largerUnit} ${String(smaller)}${smallerUnit}` : `${String(larger2)}${largerUnit}`;
|
|
@@ -141801,19 +141881,19 @@ function formatAgo(ms2, t10) {
|
|
|
141801
141881
|
if (ms2 < 0) {
|
|
141802
141882
|
return t10("time.justNow");
|
|
141803
141883
|
}
|
|
141804
|
-
const seconds = Math.floor(ms2 /
|
|
141805
|
-
if (seconds <
|
|
141884
|
+
const seconds = Math.floor(ms2 / MS_PER_SECOND20);
|
|
141885
|
+
if (seconds < SECONDS_PER_MINUTE4) {
|
|
141806
141886
|
return t10("time.ago", { value: `${String(seconds)}s` });
|
|
141807
141887
|
}
|
|
141808
|
-
const minutes = Math.floor(seconds /
|
|
141809
|
-
if (minutes <
|
|
141888
|
+
const minutes = Math.floor(seconds / SECONDS_PER_MINUTE4);
|
|
141889
|
+
if (minutes < MINUTES_PER_HOUR6) {
|
|
141810
141890
|
return t10("time.ago", { value: `${String(minutes)}m` });
|
|
141811
141891
|
}
|
|
141812
|
-
const hours = Math.floor(minutes /
|
|
141813
|
-
if (hours <
|
|
141814
|
-
return t10("time.ago", { value: twoUnits(hours, minutes %
|
|
141892
|
+
const hours = Math.floor(minutes / MINUTES_PER_HOUR6);
|
|
141893
|
+
if (hours < HOURS_PER_DAY10) {
|
|
141894
|
+
return t10("time.ago", { value: twoUnits(hours, minutes % MINUTES_PER_HOUR6, "h", "m") });
|
|
141815
141895
|
}
|
|
141816
|
-
return t10("time.ago", { value: twoUnits(Math.floor(hours /
|
|
141896
|
+
return t10("time.ago", { value: twoUnits(Math.floor(hours / HOURS_PER_DAY10), hours % HOURS_PER_DAY10, "d", "h") });
|
|
141817
141897
|
}
|
|
141818
141898
|
|
|
141819
141899
|
// src/statusline/elements/header/duration.ts
|
|
@@ -141964,7 +142044,7 @@ function modelName(context) {
|
|
|
141964
142044
|
}
|
|
141965
142045
|
|
|
141966
142046
|
// src/statusline/elements/header/outputStyle.ts
|
|
141967
|
-
var
|
|
142047
|
+
var import_node_path59 = __toESM(require("node:path"), 1);
|
|
141968
142048
|
init_zod();
|
|
141969
142049
|
var SettingsFileSchema = external_exports.looseObject({ outputStyle: external_exports.string().optional().catch(void 0) });
|
|
141970
142050
|
function outputStyleIn(file2, readText2) {
|
|
@@ -141984,12 +142064,12 @@ function outputStyleIn(file2, readText2) {
|
|
|
141984
142064
|
}
|
|
141985
142065
|
function outputStyleSegment({ payload, ports, t: t10 }) {
|
|
141986
142066
|
const pinned = ports.env.CLAUDE_CONFIG_DIR;
|
|
141987
|
-
const configDirectory = pinned === void 0 || pinned === "" ?
|
|
142067
|
+
const configDirectory = pinned === void 0 || pinned === "" ? import_node_path59.default.join(ports.homeDirectory, ".claude") : pinned;
|
|
141988
142068
|
const projectDirectory = payload.cwd ?? payload.workspace?.current_dir;
|
|
141989
142069
|
const files = [
|
|
141990
|
-
|
|
141991
|
-
|
|
141992
|
-
...projectDirectory === void 0 ? [] : [
|
|
142070
|
+
import_node_path59.default.join(configDirectory, "settings.json"),
|
|
142071
|
+
import_node_path59.default.join(configDirectory, "settings.local.json"),
|
|
142072
|
+
...projectDirectory === void 0 ? [] : [import_node_path59.default.join(projectDirectory, ".claude", "settings.json"), import_node_path59.default.join(projectDirectory, ".claude", "settings.local.json")]
|
|
141993
142073
|
];
|
|
141994
142074
|
const style = files.map((file2) => outputStyleIn(file2, ports.readText)).findLast((name) => name !== void 0);
|
|
141995
142075
|
return style === void 0 ? void 0 : t10("outputStyle.name", { name: style });
|
|
@@ -142076,60 +142156,6 @@ function sessionNameSegment(context) {
|
|
|
142076
142156
|
|
|
142077
142157
|
// src/statusline/speed.ts
|
|
142078
142158
|
init_zod();
|
|
142079
|
-
|
|
142080
|
-
// src/statusline/cacheFile.ts
|
|
142081
|
-
var import_node_crypto26 = require("node:crypto");
|
|
142082
|
-
var import_node_path59 = __toESM(require("node:path"), 1);
|
|
142083
|
-
var SESSION_CACHE_DIRECTORY = "session";
|
|
142084
|
-
function cacheDirectory(ports) {
|
|
142085
|
-
return import_node_path59.default.join(ports.stateDirectory, SESSION_CACHE_DIRECTORY);
|
|
142086
|
-
}
|
|
142087
|
-
function cacheFileFor(ports, kind, transcriptPath) {
|
|
142088
|
-
return import_node_path59.default.join(cacheDirectory(ports), `${kind}-${(0, import_node_crypto26.createHash)("sha256").update(transcriptPath).digest("hex")}.json`);
|
|
142089
|
-
}
|
|
142090
|
-
var RETENTION_DAYS = 30;
|
|
142091
|
-
var HOURS_PER_DAY10 = 24;
|
|
142092
|
-
var MINUTES_PER_HOUR6 = 60;
|
|
142093
|
-
var SECONDS_PER_MINUTE4 = 60;
|
|
142094
|
-
var MS_PER_SECOND20 = 1e3;
|
|
142095
|
-
var CACHE_RETENTION_MS = RETENTION_DAYS * HOURS_PER_DAY10 * MINUTES_PER_HOUR6 * SECONDS_PER_MINUTE4 * MS_PER_SECOND20;
|
|
142096
|
-
function pruneCache(ports, cutoffMs) {
|
|
142097
|
-
const directory = cacheDirectory(ports);
|
|
142098
|
-
const names = ports.listDirectory(directory);
|
|
142099
|
-
if (names === void 0) {
|
|
142100
|
-
return;
|
|
142101
|
-
}
|
|
142102
|
-
for (const name of names) {
|
|
142103
|
-
const file2 = import_node_path59.default.join(directory, name);
|
|
142104
|
-
const modifiedAtMs = ports.modifiedAtMs(file2);
|
|
142105
|
-
if (modifiedAtMs !== void 0 && modifiedAtMs < cutoffMs) {
|
|
142106
|
-
ports.removePath(file2);
|
|
142107
|
-
}
|
|
142108
|
-
}
|
|
142109
|
-
}
|
|
142110
|
-
function loadCache(ports, file2, schema) {
|
|
142111
|
-
const text5 = ports.readText(file2);
|
|
142112
|
-
if (text5 === void 0) {
|
|
142113
|
-
return void 0;
|
|
142114
|
-
}
|
|
142115
|
-
let parsed;
|
|
142116
|
-
try {
|
|
142117
|
-
parsed = JSON.parse(text5);
|
|
142118
|
-
} catch {
|
|
142119
|
-
return void 0;
|
|
142120
|
-
}
|
|
142121
|
-
const result = schema.safeParse(parsed);
|
|
142122
|
-
return result.success ? result.data : void 0;
|
|
142123
|
-
}
|
|
142124
|
-
function saveCache(ports, file2, value2, nowMs) {
|
|
142125
|
-
const isNew = ports.entryKind(file2) === void 0;
|
|
142126
|
-
ports.writeText(file2, JSON.stringify(value2));
|
|
142127
|
-
if (isNew) {
|
|
142128
|
-
pruneCache(ports, nowMs - CACHE_RETENTION_MS);
|
|
142129
|
-
}
|
|
142130
|
-
}
|
|
142131
|
-
|
|
142132
|
-
// src/statusline/speed.ts
|
|
142133
142159
|
var SPEED_WINDOW_MS = 2e3;
|
|
142134
142160
|
var MIN_SPEED_GAP_MS = 500;
|
|
142135
142161
|
var TRANSCRIPT_BYTES_PER_TOKEN = 4;
|
|
@@ -142161,8 +142187,8 @@ function speedBetween(previous, current) {
|
|
|
142161
142187
|
}
|
|
142162
142188
|
function trackSpeed(ports, transcriptPath, current) {
|
|
142163
142189
|
const file2 = cacheFileFor(ports, CACHE_KIND, transcriptPath);
|
|
142164
|
-
const { tokensPerSecond, remember:
|
|
142165
|
-
if (
|
|
142190
|
+
const { tokensPerSecond, remember: remember3 } = speedBetween(loadCache(ports, file2, SpeedSampleSchema), current);
|
|
142191
|
+
if (remember3) {
|
|
142166
142192
|
saveCache(ports, file2, current, current.at);
|
|
142167
142193
|
}
|
|
142168
142194
|
return tokensPerSecond;
|
|
@@ -142171,11 +142197,15 @@ function trackSpeed(ports, transcriptPath, current) {
|
|
|
142171
142197
|
// src/statusline/elements/header/speed.ts
|
|
142172
142198
|
function speedSegment(context) {
|
|
142173
142199
|
const transcriptPath = context.payload.transcript_path;
|
|
142174
|
-
if (transcriptPath === void 0
|
|
142200
|
+
if (transcriptPath === void 0) {
|
|
142175
142201
|
return void 0;
|
|
142176
142202
|
}
|
|
142177
|
-
const
|
|
142178
|
-
|
|
142203
|
+
const key = transcriptKeyOf(context.ports, transcriptPath);
|
|
142204
|
+
if (key === void 0) {
|
|
142205
|
+
return void 0;
|
|
142206
|
+
}
|
|
142207
|
+
const outputTokens = context.contextFrame()?.current_usage?.output_tokens;
|
|
142208
|
+
const tokensPerSecond = trackSpeed(context.ports, key, { at: context.nowMs, outputTokens, transcriptBytes: outputTokens === void 0 ? context.ports.fileSize(transcriptPath.trim()) : void 0 });
|
|
142179
142209
|
return tokensPerSecond === void 0 ? void 0 : context.t("speed.rate", { rate: tokensPerSecond.toFixed(1) });
|
|
142180
142210
|
}
|
|
142181
142211
|
|
|
@@ -142255,15 +142285,15 @@ function parseNumstat(output2) {
|
|
|
142255
142285
|
if (addedText === void 0 || deletedText === void 0 || pathText === void 0) {
|
|
142256
142286
|
continue;
|
|
142257
142287
|
}
|
|
142258
|
-
const
|
|
142288
|
+
const path73 = pathText === "" ? fields[index + 2] : pathText;
|
|
142259
142289
|
if (pathText === "") {
|
|
142260
142290
|
index += 2;
|
|
142261
142291
|
}
|
|
142262
142292
|
const lines = { added: Number(addedText), deleted: Number(deletedText) };
|
|
142263
|
-
if (
|
|
142293
|
+
if (path73 !== void 0 && Number.isInteger(lines.added) && Number.isInteger(lines.deleted)) {
|
|
142264
142294
|
added += lines.added;
|
|
142265
142295
|
deleted += lines.deleted;
|
|
142266
|
-
byPath.set(
|
|
142296
|
+
byPath.set(path73, lines);
|
|
142267
142297
|
}
|
|
142268
142298
|
}
|
|
142269
142299
|
return { total: { added, deleted }, byPath };
|
|
@@ -142596,6 +142626,119 @@ function compactionsRow(context) {
|
|
|
142596
142626
|
// src/statusline/elements/rows/context.ts
|
|
142597
142627
|
init_statusline();
|
|
142598
142628
|
|
|
142629
|
+
// src/statusline/contextFrame.ts
|
|
142630
|
+
var import_node_path61 = __toESM(require("node:path"), 1);
|
|
142631
|
+
init_zod();
|
|
142632
|
+
var CACHE_KIND2 = "context";
|
|
142633
|
+
var CONTEXT_WRITE_INTERVAL_MS = 3e3;
|
|
142634
|
+
var RECORD_MAX_AGE_DAYS = 7;
|
|
142635
|
+
var HOURS_PER_DAY11 = 24;
|
|
142636
|
+
var MINUTES_PER_HOUR7 = 60;
|
|
142637
|
+
var SECONDS_PER_MINUTE5 = 60;
|
|
142638
|
+
var MS_PER_SECOND22 = 1e3;
|
|
142639
|
+
var CONTEXT_RECORD_MAX_AGE_MS = RECORD_MAX_AGE_DAYS * HOURS_PER_DAY11 * MINUTES_PER_HOUR7 * SECONDS_PER_MINUTE5 * MS_PER_SECOND22;
|
|
142640
|
+
var MAX_CONTEXT_RECORDS = 100;
|
|
142641
|
+
var UsageSchema = external_exports.strictObject({
|
|
142642
|
+
input_tokens: external_exports.number().optional(),
|
|
142643
|
+
output_tokens: external_exports.number().optional(),
|
|
142644
|
+
cache_creation_input_tokens: external_exports.number().optional(),
|
|
142645
|
+
cache_read_input_tokens: external_exports.number().optional()
|
|
142646
|
+
});
|
|
142647
|
+
var ContextRecordSchema = external_exports.strictObject({
|
|
142648
|
+
/** When the record was last written, a restored frame written back included: the record's age is measured from it. */
|
|
142649
|
+
savedAtMs: external_exports.number(),
|
|
142650
|
+
/** When the reading behind the frame the record keeps was taken: the refresh that drew it from the client's own report, or the compaction it was drawn from (that compaction's own time). A restored frame written back keeps the time of the frame it restores, so the compaction guard compares a compaction with the time of the reading itself. */
|
|
142651
|
+
observedAtMs: external_exports.number(),
|
|
142652
|
+
usedPercentage: external_exports.number(),
|
|
142653
|
+
totalInputTokens: external_exports.number().optional(),
|
|
142654
|
+
windowTokens: external_exports.number().optional(),
|
|
142655
|
+
currentUsage: UsageSchema.optional()
|
|
142656
|
+
});
|
|
142657
|
+
function isNothing(value2) {
|
|
142658
|
+
return value2 === void 0 || value2 === 0;
|
|
142659
|
+
}
|
|
142660
|
+
function isSuspiciousZero(frame) {
|
|
142661
|
+
const usage = frame.current_usage;
|
|
142662
|
+
const usageEmpty = usage === void 0 || isNothing(usage.input_tokens) && isNothing(usage.output_tokens) && isNothing(usage.cache_creation_input_tokens) && isNothing(usage.cache_read_input_tokens);
|
|
142663
|
+
return isNothing(frame.used_percentage) && usageEmpty;
|
|
142664
|
+
}
|
|
142665
|
+
function goodPercentOf(frame) {
|
|
142666
|
+
const { context_window_size: windowTokens, used_percentage: usedPercentage } = frame;
|
|
142667
|
+
return windowTokens !== void 0 && windowTokens > 0 && usedPercentage !== void 0 && usedPercentage > 0 ? usedPercentage : void 0;
|
|
142668
|
+
}
|
|
142669
|
+
function afterCompaction(frame, compaction) {
|
|
142670
|
+
const { postTokens } = compaction;
|
|
142671
|
+
const windowTokens = frame.context_window_size;
|
|
142672
|
+
if (postTokens === void 0 || postTokens <= 0 || windowTokens === void 0 || windowTokens <= 0) {
|
|
142673
|
+
return frame;
|
|
142674
|
+
}
|
|
142675
|
+
return { ...frame, used_percentage: Math.min(FULL_PERCENT3, postTokens / windowTokens * FULL_PERCENT3) };
|
|
142676
|
+
}
|
|
142677
|
+
function restored(frame, record2) {
|
|
142678
|
+
return { ...frame, used_percentage: record2.usedPercentage, total_input_tokens: record2.totalInputTokens, current_usage: record2.currentUsage, context_window_size: frame.context_window_size ?? record2.windowTokens };
|
|
142679
|
+
}
|
|
142680
|
+
function recordOf2(frame, usedPercentage, observedAtMs, nowMs) {
|
|
142681
|
+
const usage = frame.current_usage;
|
|
142682
|
+
return {
|
|
142683
|
+
savedAtMs: nowMs,
|
|
142684
|
+
observedAtMs,
|
|
142685
|
+
usedPercentage,
|
|
142686
|
+
totalInputTokens: frame.total_input_tokens,
|
|
142687
|
+
windowTokens: frame.context_window_size,
|
|
142688
|
+
currentUsage: usage === void 0 ? void 0 : { input_tokens: usage.input_tokens, output_tokens: usage.output_tokens, cache_creation_input_tokens: usage.cache_creation_input_tokens, cache_read_input_tokens: usage.cache_read_input_tokens }
|
|
142689
|
+
};
|
|
142690
|
+
}
|
|
142691
|
+
function capRecords(ports, directory) {
|
|
142692
|
+
const names = ports.listDirectory(directory);
|
|
142693
|
+
if (names === void 0) {
|
|
142694
|
+
return;
|
|
142695
|
+
}
|
|
142696
|
+
const records = names.filter((name) => name.startsWith(`${CACHE_KIND2}-`) && name.endsWith(".json")).flatMap((name) => {
|
|
142697
|
+
const file2 = import_node_path61.default.join(directory, name);
|
|
142698
|
+
const modifiedAtMs = ports.entryKind(file2) === "file" ? ports.modifiedAtMs(file2) : void 0;
|
|
142699
|
+
return modifiedAtMs === void 0 ? [] : [{ file: file2, modifiedAtMs }];
|
|
142700
|
+
}).sort((left, right) => left.modifiedAtMs - right.modifiedAtMs);
|
|
142701
|
+
for (const { file: file2 } of records.slice(0, Math.max(0, records.length - MAX_CONTEXT_RECORDS))) {
|
|
142702
|
+
ports.removePath(file2);
|
|
142703
|
+
}
|
|
142704
|
+
}
|
|
142705
|
+
function remember(ports, file2, frame, usedPercentage, observedAtMs, nowMs) {
|
|
142706
|
+
const modifiedAtMs = ports.modifiedAtMs(file2);
|
|
142707
|
+
if (modifiedAtMs !== void 0 && nowMs - modifiedAtMs < CONTEXT_WRITE_INTERVAL_MS) {
|
|
142708
|
+
return;
|
|
142709
|
+
}
|
|
142710
|
+
if (saveCache(ports, file2, recordOf2(frame, usedPercentage, observedAtMs, nowMs), nowMs)) {
|
|
142711
|
+
capRecords(ports, import_node_path61.default.dirname(file2));
|
|
142712
|
+
}
|
|
142713
|
+
}
|
|
142714
|
+
function contextFrameOf(input2) {
|
|
142715
|
+
const { ports, transcriptPath, frame, nowMs } = input2;
|
|
142716
|
+
const key = transcriptPath === void 0 ? void 0 : transcriptKeyOf(ports, transcriptPath);
|
|
142717
|
+
if (frame === void 0 || key === void 0) {
|
|
142718
|
+
return frame;
|
|
142719
|
+
}
|
|
142720
|
+
const file2 = cacheFileFor(ports, CACHE_KIND2, key);
|
|
142721
|
+
let drawn = frame;
|
|
142722
|
+
let observedAtMs = nowMs;
|
|
142723
|
+
if (isSuspiciousZero(frame) && !input2.drawsPercent) {
|
|
142724
|
+
const loaded = loadCache(ports, file2, ContextRecordSchema);
|
|
142725
|
+
const record2 = loaded !== void 0 && nowMs - loaded.savedAtMs <= CONTEXT_RECORD_MAX_AGE_MS ? loaded : void 0;
|
|
142726
|
+
const compaction = input2.compaction();
|
|
142727
|
+
if (compaction !== void 0 && (record2 === void 0 || compaction.atMs > record2.observedAtMs)) {
|
|
142728
|
+
drawn = afterCompaction(frame, compaction);
|
|
142729
|
+
observedAtMs = compaction.atMs;
|
|
142730
|
+
} else if (record2 !== void 0) {
|
|
142731
|
+
drawn = restored(frame, record2);
|
|
142732
|
+
observedAtMs = record2.observedAtMs;
|
|
142733
|
+
}
|
|
142734
|
+
}
|
|
142735
|
+
const goodPercent = goodPercentOf(drawn);
|
|
142736
|
+
if (goodPercent !== void 0) {
|
|
142737
|
+
remember(ports, file2, drawn, goodPercent, observedAtMs, nowMs);
|
|
142738
|
+
}
|
|
142739
|
+
return drawn;
|
|
142740
|
+
}
|
|
142741
|
+
|
|
142599
142742
|
// src/statusline/elements/context.ts
|
|
142600
142743
|
function barStyleOf({ settings: settings2, palette }, okRole) {
|
|
142601
142744
|
return { bands: settings2.bands, palette, okRole, gradient: settings2.bar.gradient, filled: settings2.bar.filled, empty: settings2.bar.empty };
|
|
@@ -142621,6 +142764,10 @@ function windowTokensOf({ settings: settings2, view }) {
|
|
|
142621
142764
|
return settings2.context.autoCompactWindow ?? view.contextWindowTokens;
|
|
142622
142765
|
}
|
|
142623
142766
|
var ROUNDING_HALF_POINT = 0.5;
|
|
142767
|
+
var WINDOW_PERCENT_DECIMALS = 1;
|
|
142768
|
+
function writtenWindowPercent(percent2) {
|
|
142769
|
+
return percent2.toFixed(WINDOW_PERCENT_DECIMALS);
|
|
142770
|
+
}
|
|
142624
142771
|
function bufferedPercent(tokens, windowTokens) {
|
|
142625
142772
|
const held = tokens / windowTokens;
|
|
142626
142773
|
const ramp = Math.max(0, Math.min(1, (held - AUTOCOMPACT_RESERVE_RAMP_START) / (AUTOCOMPACT_RESERVE_RAMP_END - AUTOCOMPACT_RESERVE_RAMP_START)));
|
|
@@ -142641,15 +142788,27 @@ function usedPercentOf(context) {
|
|
|
142641
142788
|
function estimateOf(kind, tokens, windowTokens) {
|
|
142642
142789
|
return kind === "buffered" ? bufferedPercent(tokens, windowTokens) : Math.min(FULL_PERCENT3, tokens / windowTokens * FULL_PERCENT3);
|
|
142643
142790
|
}
|
|
142644
|
-
function breakdownText(
|
|
142645
|
-
const usage =
|
|
142791
|
+
function breakdownText(frame, t10) {
|
|
142792
|
+
const usage = frame?.current_usage;
|
|
142646
142793
|
if (usage === void 0) {
|
|
142647
142794
|
return void 0;
|
|
142648
142795
|
}
|
|
142649
142796
|
const cached2 = (usage.cache_creation_input_tokens ?? 0) + (usage.cache_read_input_tokens ?? 0);
|
|
142650
142797
|
return ` (${t10("context.breakdown", { input: formatTokens(usage.input_tokens ?? 0), cached: formatTokens(cached2) })})`;
|
|
142651
142798
|
}
|
|
142652
|
-
function
|
|
142799
|
+
function drawnContextFrameOf(context) {
|
|
142800
|
+
const { payload } = context;
|
|
142801
|
+
const percent2 = usedPercentOf(context);
|
|
142802
|
+
const drawsPercent = percent2 !== void 0 && Number(writtenWindowPercent(percent2)) > 0;
|
|
142803
|
+
return contextFrameOf({ ports: context.ports, transcriptPath: payload.transcript_path, frame: payload.context_window, drawsPercent, nowMs: context.nowMs, compaction: () => context.transcript()?.session.lastCompaction });
|
|
142804
|
+
}
|
|
142805
|
+
function drawnContextOf(input2) {
|
|
142806
|
+
const { payload } = input2;
|
|
142807
|
+
const frame = input2.contextFrame();
|
|
142808
|
+
return { context: frame === payload.context_window ? input2 : { ...input2, view: { ...input2.view, ...contextViewOf(frame) } }, frame };
|
|
142809
|
+
}
|
|
142810
|
+
function contextRow(input2) {
|
|
142811
|
+
const { context, frame } = drawnContextOf(input2);
|
|
142653
142812
|
const { view, palette, settings: settings2 } = context;
|
|
142654
142813
|
const percent2 = usedPercentOf(context);
|
|
142655
142814
|
if (percent2 === void 0) {
|
|
@@ -142663,7 +142822,7 @@ function contextRow(context) {
|
|
|
142663
142822
|
const windowTokens = windowTokensOf(context);
|
|
142664
142823
|
const tokens = view.contextTotalTokens;
|
|
142665
142824
|
const heldAgainstWindow = tokens === void 0 || windowTokens === void 0 ? void 0 : `${formatTokens(tokens)}/${formatTokens(windowTokens)}`;
|
|
142666
|
-
const percentText = withColor(color, `${percent2
|
|
142825
|
+
const percentText = withColor(color, `${writtenWindowPercent(percent2)}%`);
|
|
142667
142826
|
const beforeBar = [];
|
|
142668
142827
|
const afterBar = [];
|
|
142669
142828
|
switch (settings2.context.value) {
|
|
@@ -142684,12 +142843,12 @@ function contextRow(context) {
|
|
|
142684
142843
|
break;
|
|
142685
142844
|
}
|
|
142686
142845
|
case "remaining":
|
|
142687
|
-
afterBar.push(withColor(color, `${Math.max(0, FULL_PERCENT3 - percent2)
|
|
142846
|
+
afterBar.push(withColor(color, `${writtenWindowPercent(Math.max(0, FULL_PERCENT3 - percent2))}%`));
|
|
142688
142847
|
break;
|
|
142689
142848
|
default:
|
|
142690
142849
|
return settings2.context.value;
|
|
142691
142850
|
}
|
|
142692
|
-
const high = settings2.context.breakdown === "critical" && Math.round(percent2) >= contextBreakdownAt(settings2) ? breakdownText(context) : void 0;
|
|
142851
|
+
const high = settings2.context.breakdown === "critical" && Math.round(percent2) >= contextBreakdownAt(settings2) ? breakdownText(frame, context.t) : void 0;
|
|
142693
142852
|
if (settings2.context.bar === "hidden" && afterBar.length === 0) {
|
|
142694
142853
|
return { kind: "text", lines: [] };
|
|
142695
142854
|
}
|
|
@@ -142736,7 +142895,7 @@ function gitFilesRow(context) {
|
|
|
142736
142895
|
}
|
|
142737
142896
|
|
|
142738
142897
|
// src/statusline/configCounts.ts
|
|
142739
|
-
var
|
|
142898
|
+
var import_node_path62 = __toESM(require("node:path"), 1);
|
|
142740
142899
|
init_zod();
|
|
142741
142900
|
var nameList = external_exports.array(external_exports.unknown()).catch([]).transform((items) => items.filter((item) => typeof item === "string"));
|
|
142742
142901
|
var ConfigFileSchema = external_exports.looseObject({
|
|
@@ -142787,7 +142946,8 @@ function followedKind(ports, target) {
|
|
|
142787
142946
|
return real === void 0 ? void 0 : ports.entryKind(real);
|
|
142788
142947
|
}
|
|
142789
142948
|
function isFile(ports, file2) {
|
|
142790
|
-
|
|
142949
|
+
const kind = followedKind(ports, file2);
|
|
142950
|
+
return kind !== void 0 && kind !== "directory";
|
|
142791
142951
|
}
|
|
142792
142952
|
function countRules(ports, root) {
|
|
142793
142953
|
const visited = /* @__PURE__ */ new Set();
|
|
@@ -142810,11 +142970,11 @@ function countRules(ports, root) {
|
|
|
142810
142970
|
break;
|
|
142811
142971
|
}
|
|
142812
142972
|
entries += 1;
|
|
142813
|
-
const entry =
|
|
142973
|
+
const entry = import_node_path62.default.join(real, name);
|
|
142814
142974
|
const kind = followedKind(ports, entry);
|
|
142815
142975
|
if (kind === "directory") {
|
|
142816
142976
|
count2 += walk3(entry);
|
|
142817
|
-
} else if (kind === "
|
|
142977
|
+
} else if (kind === "file" && name.endsWith(".md")) {
|
|
142818
142978
|
const target = ports.realPath(entry);
|
|
142819
142979
|
if (target !== void 0 && !visited.has(target)) {
|
|
142820
142980
|
visited.add(target);
|
|
@@ -142827,33 +142987,33 @@ function countRules(ports, root) {
|
|
|
142827
142987
|
return walk3(root);
|
|
142828
142988
|
}
|
|
142829
142989
|
function sameLocation(ports, left, right) {
|
|
142830
|
-
return (ports.realPath(left) ??
|
|
142990
|
+
return (ports.realPath(left) ?? import_node_path62.default.resolve(left)) === (ports.realPath(right) ?? import_node_path62.default.resolve(right));
|
|
142831
142991
|
}
|
|
142832
142992
|
function configDirectoryOf(ports) {
|
|
142833
142993
|
const pinned = ports.env.CLAUDE_CONFIG_DIR;
|
|
142834
|
-
return pinned === void 0 || pinned === "" ?
|
|
142994
|
+
return pinned === void 0 || pinned === "" ? import_node_path62.default.join(ports.homeDirectory, ".claude") : pinned;
|
|
142835
142995
|
}
|
|
142836
142996
|
function countConfiguration(ports, projectDirectory) {
|
|
142837
142997
|
const userDirectory = configDirectoryOf(ports);
|
|
142838
|
-
const userSettings = readConfigFile(ports,
|
|
142839
|
-
const globalFile = ports.env.CLAUDE_CONFIG_DIR === void 0 || ports.env.CLAUDE_CONFIG_DIR === "" ?
|
|
142998
|
+
const userSettings = readConfigFile(ports, import_node_path62.default.join(userDirectory, "settings.json"));
|
|
142999
|
+
const globalFile = ports.env.CLAUDE_CONFIG_DIR === void 0 || ports.env.CLAUDE_CONFIG_DIR === "" ? import_node_path62.default.join(ports.homeDirectory, ".claude.json") : import_node_path62.default.join(userDirectory, ".claude.json");
|
|
142840
143000
|
const global2 = readConfigFile(ports, globalFile);
|
|
142841
143001
|
const userServers = /* @__PURE__ */ new Set([...namesOf(userSettings), ...namesOf(global2)]);
|
|
142842
143002
|
removeNames(userServers, global2?.disabledMcpServers);
|
|
142843
143003
|
const projectServers = /* @__PURE__ */ new Set();
|
|
142844
|
-
let claudeMd = isFile(ports,
|
|
142845
|
-
let rules = countRules(ports,
|
|
143004
|
+
let claudeMd = isFile(ports, import_node_path62.default.join(userDirectory, "CLAUDE.md")) ? 1 : 0;
|
|
143005
|
+
let rules = countRules(ports, import_node_path62.default.join(userDirectory, "rules"));
|
|
142846
143006
|
let hookEvents = hookEventsOf(userSettings);
|
|
142847
143007
|
if (projectDirectory !== void 0) {
|
|
142848
|
-
const projectClaude =
|
|
143008
|
+
const projectClaude = import_node_path62.default.join(projectDirectory, ".claude");
|
|
142849
143009
|
const projectIsUser = sameLocation(ports, projectClaude, userDirectory);
|
|
142850
|
-
const claudeMdFiles = [
|
|
143010
|
+
const claudeMdFiles = [import_node_path62.default.join(projectDirectory, "CLAUDE.md"), import_node_path62.default.join(projectDirectory, "CLAUDE.local.md"), import_node_path62.default.join(projectClaude, "CLAUDE.local.md"), ...projectIsUser ? [] : [import_node_path62.default.join(projectClaude, "CLAUDE.md")]];
|
|
142851
143011
|
claudeMd += claudeMdFiles.filter((file2) => isFile(ports, file2)).length;
|
|
142852
|
-
const mcpJson = namesOf(readConfigFile(ports,
|
|
143012
|
+
const mcpJson = namesOf(readConfigFile(ports, import_node_path62.default.join(projectDirectory, ".mcp.json")));
|
|
142853
143013
|
if (!projectIsUser) {
|
|
142854
|
-
rules += countRules(ports,
|
|
142855
|
-
const settings2 = readConfigFile(ports,
|
|
142856
|
-
const local = readConfigFile(ports,
|
|
143014
|
+
rules += countRules(ports, import_node_path62.default.join(projectClaude, "rules"));
|
|
143015
|
+
const settings2 = readConfigFile(ports, import_node_path62.default.join(projectClaude, "settings.json"));
|
|
143016
|
+
const local = readConfigFile(ports, import_node_path62.default.join(projectClaude, "settings.local.json"));
|
|
142857
143017
|
hookEvents += hookEventsOf(settings2) + hookEventsOf(local);
|
|
142858
143018
|
for (const name of [...namesOf(settings2), ...namesOf(local)]) {
|
|
142859
143019
|
projectServers.add(name);
|
|
@@ -142952,7 +143112,7 @@ function formatWallClock(atMs, nowMs, clock, settings2) {
|
|
|
142952
143112
|
}
|
|
142953
143113
|
|
|
142954
143114
|
// src/statusline/elements/rows/promptCache.ts
|
|
142955
|
-
var
|
|
143115
|
+
var MS_PER_SECOND23 = 1e3;
|
|
142956
143116
|
var MIN_WARNING_SECONDS = 60;
|
|
142957
143117
|
var WARNING_FRACTION_DENOMINATOR = 5;
|
|
142958
143118
|
function warningSecondsOf(ttlSeconds) {
|
|
@@ -142965,13 +143125,13 @@ function promptCacheRow(context) {
|
|
|
142965
143125
|
}
|
|
142966
143126
|
const { palette, nowMs, settings: settings2, t: t10 } = context;
|
|
142967
143127
|
const ttlSeconds = cache.ttlSeconds ?? settings2.promptCache.ttlSeconds;
|
|
142968
|
-
const expiresAtMs = cache.anchorAtMs + ttlSeconds *
|
|
143128
|
+
const expiresAtMs = cache.anchorAtMs + ttlSeconds * MS_PER_SECOND23;
|
|
142969
143129
|
const remainingMs = expiresAtMs - nowMs;
|
|
142970
143130
|
const name = palette.paint("label", t10("promptCache.label"));
|
|
142971
143131
|
if (remainingMs <= 0) {
|
|
142972
143132
|
return { kind: "text", lines: [`${name} ${palette.paint("label", `\u23F1 ${t10("promptCache.expired")}`)}`] };
|
|
142973
143133
|
}
|
|
142974
|
-
const role = remainingMs <= warningSecondsOf(ttlSeconds) *
|
|
143134
|
+
const role = remainingMs <= warningSecondsOf(ttlSeconds) * MS_PER_SECOND23 ? "warning" : "context";
|
|
142975
143135
|
return { kind: "text", lines: [`${name} ${palette.paint(role, `\u23F1 ${t10("promptCache.until", { time: formatWallClock(expiresAtMs, nowMs, context.ports.clock, settings2.clock) })}`)}`] };
|
|
142976
143136
|
}
|
|
142977
143137
|
|
|
@@ -143169,11 +143329,11 @@ function targetText(tool, columns) {
|
|
|
143169
143329
|
if (!FILE_TOOLS.includes(tool.name)) {
|
|
143170
143330
|
return truncateWithEllipsis(target, room, ELLIPSIS);
|
|
143171
143331
|
}
|
|
143172
|
-
const
|
|
143173
|
-
if (visibleLength(
|
|
143174
|
-
return
|
|
143332
|
+
const path73 = target.replaceAll("\\", "/");
|
|
143333
|
+
if (visibleLength(path73) <= room) {
|
|
143334
|
+
return path73;
|
|
143175
143335
|
}
|
|
143176
|
-
const file2 =
|
|
143336
|
+
const file2 = path73.split("/").pop() ?? path73;
|
|
143177
143337
|
return visibleLength(DIRECTORY_ELLIPSIS) + visibleLength(file2) > room ? truncateWithEllipsis(file2, room, FILE_ELLIPSIS) : `${DIRECTORY_ELLIPSIS}${file2}`;
|
|
143178
143338
|
}
|
|
143179
143339
|
function finishedByKind(tools) {
|
|
@@ -143215,10 +143375,11 @@ function toolsRow(context) {
|
|
|
143215
143375
|
|
|
143216
143376
|
// src/statusline/transcript/tokens.ts
|
|
143217
143377
|
init_zod();
|
|
143218
|
-
var tokenCount = external_exports.number().
|
|
143378
|
+
var tokenCount = external_exports.number().nonnegative().refine(Number.isInteger);
|
|
143379
|
+
var totalCount = tokenCount.or(external_exports.null().transform(() => Number.POSITIVE_INFINITY));
|
|
143219
143380
|
var SessionTokensSchema = external_exports.strictObject({ inputTokens: tokenCount, outputTokens: tokenCount, cacheCreationTokens: tokenCount, cacheReadTokens: tokenCount });
|
|
143220
143381
|
var TokenStateSchema = external_exports.strictObject({
|
|
143221
|
-
totals:
|
|
143382
|
+
totals: external_exports.strictObject({ inputTokens: totalCount, outputTokens: totalCount, cacheCreationTokens: totalCount, cacheReadTokens: totalCount }),
|
|
143222
143383
|
open: external_exports.strictObject({ key: external_exports.string(), usage: SessionTokensSchema }).optional()
|
|
143223
143384
|
});
|
|
143224
143385
|
var NO_TOKENS = { inputTokens: 0, outputTokens: 0, cacheCreationTokens: 0, cacheReadTokens: 0 };
|
|
@@ -143885,6 +144046,8 @@ var TranscriptRecordSchema = external_exports.looseObject({
|
|
|
143885
144046
|
/** The task a `TaskCreate` made, whose identifier the client assigns and only the result carries. */
|
|
143886
144047
|
task: external_exports.looseObject({ id: external_exports.union([external_exports.string(), external_exports.number()]).optional().catch(void 0) }).optional().catch(void 0)
|
|
143887
144048
|
}).optional().catch(void 0),
|
|
144049
|
+
/** What a `compact_boundary` record says of its compaction: the tokens the context held once it was done, where the client records them. */
|
|
144050
|
+
compactMetadata: external_exports.looseObject({ postTokens: count }).optional().catch(void 0),
|
|
143888
144051
|
/** Shared by the records one API request produced. */
|
|
143889
144052
|
requestId: text4,
|
|
143890
144053
|
message: external_exports.looseObject({
|
|
@@ -143962,10 +144125,10 @@ var MAX_OLDER_SHARE = 0.5;
|
|
|
143962
144125
|
var MAX_REMEMBERED_CALLS = callsRemembered(CALL_DIGEST_CHARS);
|
|
143963
144126
|
var MAX_SKIPPED_CALLS = callsSkippedAtMost(CALL_DIGEST_CHARS);
|
|
143964
144127
|
var MAX_COUNTED_NAMES = namesCounted(CALL_DIGEST_CHARS);
|
|
143965
|
-
var
|
|
143966
|
-
var
|
|
143967
|
-
var
|
|
143968
|
-
var
|
|
144128
|
+
var MS_PER_SECOND24 = 1e3;
|
|
144129
|
+
var SECONDS_PER_MINUTE6 = 60;
|
|
144130
|
+
var MINUTES_PER_HOUR8 = 60;
|
|
144131
|
+
var HOURS_PER_DAY12 = 24;
|
|
143969
144132
|
var BASH_DEFAULT_TIMEOUT_MS = 12e4;
|
|
143970
144133
|
var BASH_MAX_TIMEOUT_MS = 6e5;
|
|
143971
144134
|
function timeoutFromEnv(env, name, fallback) {
|
|
@@ -143975,7 +144138,7 @@ function timeoutFromEnv(env, name, fallback) {
|
|
|
143975
144138
|
function bashLiveLimitMs(env) {
|
|
143976
144139
|
return Math.max(timeoutFromEnv(env, "BASH_DEFAULT_TIMEOUT_MS", BASH_DEFAULT_TIMEOUT_MS), timeoutFromEnv(env, "BASH_MAX_TIMEOUT_MS", BASH_MAX_TIMEOUT_MS));
|
|
143977
144140
|
}
|
|
143978
|
-
var MAX_LIVE_AGENT_MS =
|
|
144141
|
+
var MAX_LIVE_AGENT_MS = HOURS_PER_DAY12 * MINUTES_PER_HOUR8 * SECONDS_PER_MINUTE6 * MS_PER_SECOND24;
|
|
143979
144142
|
var AGENT_TOOLS = ["Task", "Agent"];
|
|
143980
144143
|
var TODO_WRITE_TOOL = "TodoWrite";
|
|
143981
144144
|
var TASK_CREATE_TOOL = "TaskCreate";
|
|
@@ -144178,7 +144341,7 @@ function isRemembered(state, id2, atMs) {
|
|
|
144178
144341
|
function beyondFloor(entries, floorMs) {
|
|
144179
144342
|
return entries.filter((entry) => floorMs === void 0 || Number.parseInt(timeKeyOfEntry(entry), CALL_TIME_RADIX) > floorMs);
|
|
144180
144343
|
}
|
|
144181
|
-
function
|
|
144344
|
+
function remember2(state, id2, atMs) {
|
|
144182
144345
|
const all2 = [...state.rememberedCalls, `${digestOf(id2)}${timeKeyOf(atMs)}`];
|
|
144183
144346
|
const kept = all2.slice(-MAX_REMEMBERED_CALLS);
|
|
144184
144347
|
const [forgotten] = all2.slice(0, -MAX_REMEMBERED_CALLS);
|
|
@@ -144300,7 +144463,7 @@ function foldActivityLatest(state, record2) {
|
|
|
144300
144463
|
const resultCount = content.filter((block2) => block2.type === "tool_result").length;
|
|
144301
144464
|
for (const block2 of content) {
|
|
144302
144465
|
if (record2.type === "assistant" && block2.type === "tool_use" && block2.id !== void 0 && block2.name !== void 0 && !isRemembered(next, block2.id, atMs)) {
|
|
144303
|
-
next = foldToolUse(
|
|
144466
|
+
next = foldToolUse(remember2(next, block2.id, atMs), { id: block2.id, name: block2.name, input: block2.input }, atMs);
|
|
144304
144467
|
} else if (record2.type === "user" && block2.type === "tool_result" && block2.tool_use_id !== void 0) {
|
|
144305
144468
|
const outcome = resultCount === 1 ? record2.toolUseResult : void 0;
|
|
144306
144469
|
const taskId = createdTaskId(block2.content, outcome);
|
|
@@ -144414,8 +144577,14 @@ var CumulativeStateSchema = external_exports.strictObject({
|
|
|
144414
144577
|
startUnknown: external_exports.literal(true).optional(),
|
|
144415
144578
|
compactions: external_exports.number().int().nonnegative()
|
|
144416
144579
|
});
|
|
144580
|
+
var CompactionSchema = external_exports.strictObject({
|
|
144581
|
+
atMs: external_exports.number(),
|
|
144582
|
+
postTokens: external_exports.number().nonnegative().refine((tokens) => Number.isInteger(tokens)).optional()
|
|
144583
|
+
});
|
|
144417
144584
|
var LatestStateSchema = external_exports.strictObject({
|
|
144418
144585
|
lastAssistantAtMs: external_exports.number().optional(),
|
|
144586
|
+
/** The compaction with the latest timestamp, as claude-hud picks it among boundaries stamped with a date string: a boundary stamped no later than the one held does not replace it, and one is counted, as on the compactions row, only when its timestamp is a string `Date.parse` reads as a date. claude-hud counts a boundary whose timestamp is truthy and which `new Date` reads as a valid date, whatever its type, so the two differ only on a timestamp that is truthy, is not a string and that `new Date` reads as a valid date, which Claude Code never writes (see the parity document's kept differences). */
|
|
144587
|
+
compaction: CompactionSchema.optional(),
|
|
144419
144588
|
customTitle: external_exports.string().optional(),
|
|
144420
144589
|
slug: external_exports.string().optional(),
|
|
144421
144590
|
aiTitle: external_exports.string().optional(),
|
|
@@ -144473,6 +144642,9 @@ function foldCumulative(state, record2) {
|
|
|
144473
144642
|
}
|
|
144474
144643
|
return next;
|
|
144475
144644
|
}
|
|
144645
|
+
function laterCompaction(held, met) {
|
|
144646
|
+
return held === void 0 || met !== void 0 && met.atMs > held.atMs ? met : held;
|
|
144647
|
+
}
|
|
144476
144648
|
function foldLatest(state, record2) {
|
|
144477
144649
|
const atMs = recordTimeMs(record2);
|
|
144478
144650
|
const next = { ...state };
|
|
@@ -144486,6 +144658,10 @@ function foldLatest(state, record2) {
|
|
|
144486
144658
|
if (record2.type === "assistant" && atMs !== void 0) {
|
|
144487
144659
|
next.lastAssistantAtMs = atMs;
|
|
144488
144660
|
}
|
|
144661
|
+
if (record2.type === "system" && record2.subtype === "compact_boundary" && atMs !== void 0) {
|
|
144662
|
+
const postTokens = record2.compactMetadata?.postTokens;
|
|
144663
|
+
next.compaction = laterCompaction(state.compaction, { atMs, ...postTokens === void 0 ? {} : { postTokens: Math.trunc(postTokens) } });
|
|
144664
|
+
}
|
|
144489
144665
|
if (record2.isSidechain !== true) {
|
|
144490
144666
|
next.cache = foldPromptCache(state.cache, record2, atMs);
|
|
144491
144667
|
}
|
|
@@ -144507,6 +144683,7 @@ function sessionFactsOf(state, newer) {
|
|
|
144507
144683
|
startedAtMs: cumulative.startedAtMs,
|
|
144508
144684
|
lastResponseAtMs: latest.lastAssistantAtMs,
|
|
144509
144685
|
compactions: cumulative.compactions,
|
|
144686
|
+
lastCompaction: laterCompaction(state.latest.compaction, newer?.compaction),
|
|
144510
144687
|
promptCache: anchorAtMs === void 0 ? void 0 : { anchorAtMs, ttlSeconds: cache.ttlSeconds }
|
|
144511
144688
|
};
|
|
144512
144689
|
}
|
|
@@ -144515,8 +144692,8 @@ function sessionFactsOf(state, newer) {
|
|
|
144515
144692
|
var MAX_TRANSCRIPT_READ_BYTES = 4194304;
|
|
144516
144693
|
var FINGERPRINT_BYTES = 4096;
|
|
144517
144694
|
var NEWLINE2 = 10;
|
|
144518
|
-
var
|
|
144519
|
-
var CACHE_VERSION =
|
|
144695
|
+
var CACHE_KIND3 = "transcript";
|
|
144696
|
+
var CACHE_VERSION = 9;
|
|
144520
144697
|
var TranscriptCacheSchema = external_exports.strictObject({
|
|
144521
144698
|
version: external_exports.literal(CACHE_VERSION),
|
|
144522
144699
|
/** A digest of the transcript's first line when this was written: another file at the same path has another one. */
|
|
@@ -144580,7 +144757,7 @@ function advance2(cache, window, reachedEnd) {
|
|
|
144580
144757
|
return { version: cache.version, fingerprint: cache.fingerprint, offset: offset + consumed, complete: cache.complete, session: folded, tokens, activity };
|
|
144581
144758
|
}
|
|
144582
144759
|
function readTranscript(ports, transcriptPath, nowMs) {
|
|
144583
|
-
const file2 = cacheFileFor(ports,
|
|
144760
|
+
const file2 = cacheFileFor(ports, CACHE_KIND3, transcriptPath);
|
|
144584
144761
|
const loaded = loadCache(ports, file2, TranscriptCacheSchema);
|
|
144585
144762
|
const head = loaded === void 0 ? void 0 : ports.readRange(transcriptPath, 0, FINGERPRINT_BYTES);
|
|
144586
144763
|
const cached2 = loaded !== void 0 && head !== void 0 && head.size >= loaded.offset && fingerprintOf(head.bytes) === loaded.fingerprint ? loaded : void 0;
|
|
@@ -144622,11 +144799,7 @@ function foldNewer(from, bytes, offset) {
|
|
|
144622
144799
|
return { offset: offset + consumed, state, activity };
|
|
144623
144800
|
}
|
|
144624
144801
|
|
|
144625
|
-
// src/statusline/
|
|
144626
|
-
var RESERVED_COLUMNS = 4;
|
|
144627
|
-
function lineWidthOf(terminalColumns) {
|
|
144628
|
-
return Math.max(MIN_STATUSLINE_COLUMNS, terminalColumns - RESERVED_COLUMNS);
|
|
144629
|
-
}
|
|
144802
|
+
// src/statusline/once.ts
|
|
144630
144803
|
function once2(read) {
|
|
144631
144804
|
let kept;
|
|
144632
144805
|
return () => {
|
|
@@ -144634,6 +144807,12 @@ function once2(read) {
|
|
|
144634
144807
|
return kept.value;
|
|
144635
144808
|
};
|
|
144636
144809
|
}
|
|
144810
|
+
|
|
144811
|
+
// src/statusline/render.ts
|
|
144812
|
+
var RESERVED_COLUMNS = 4;
|
|
144813
|
+
function lineWidthOf(terminalColumns) {
|
|
144814
|
+
return Math.max(MIN_STATUSLINE_COLUMNS, terminalColumns - RESERVED_COLUMNS);
|
|
144815
|
+
}
|
|
144637
144816
|
var RULE_CHARACTER = "\u2500";
|
|
144638
144817
|
function ruleLine(headerLines, width, palette) {
|
|
144639
144818
|
const widest = Math.max(MIN_STATUSLINE_COLUMNS, ...headerLines.map(visibleLength));
|
|
@@ -144663,7 +144842,8 @@ function renderStatuslineBlock(input2) {
|
|
|
144663
144842
|
transcript: once2(() => {
|
|
144664
144843
|
const transcriptPath = input2.payload.transcript_path;
|
|
144665
144844
|
return transcriptPath === void 0 || transcriptPath === "" ? void 0 : readTranscript(input2.ports, transcriptPath, input2.nowMs);
|
|
144666
|
-
})
|
|
144845
|
+
}),
|
|
144846
|
+
contextFrame: once2(() => drawnContextFrameOf(context))
|
|
144667
144847
|
};
|
|
144668
144848
|
const parts = settings2.layout.header.flatMap((name) => {
|
|
144669
144849
|
const text5 = elements.header[name](context);
|
|
@@ -144672,6 +144852,7 @@ function renderStatuslineBlock(input2) {
|
|
|
144672
144852
|
const header = headerUnits(parts, settings2.git.branchOverflow);
|
|
144673
144853
|
const drawn = settings2.layout.rows.map((name) => ({ name, output: elements.rows[name](context) }));
|
|
144674
144854
|
const body = settings2.layout.mode === "compact" ? packLines([...header, ...compactUnits(drawn, settings2.bar.width)], width, SEPARATOR3).map((line) => line.join(SEPARATOR3)) : expandedLines(header, drawn, width, context.palette, settings2);
|
|
144855
|
+
context.contextFrame();
|
|
144675
144856
|
const custom2 = customLineOf(context);
|
|
144676
144857
|
if (custom2 === void 0) {
|
|
144677
144858
|
return body.join("\n");
|
|
@@ -144782,7 +144963,7 @@ function registerStatuslineCommand(program2, deps) {
|
|
|
144782
144963
|
} else {
|
|
144783
144964
|
const configDir = process.env.CLAUDE_CONFIG_DIR;
|
|
144784
144965
|
try {
|
|
144785
|
-
account = readAccountMetadataFile(realFarmFs, configDir === void 0 || configDir === "" ?
|
|
144966
|
+
account = readAccountMetadataFile(realFarmFs, configDir === void 0 || configDir === "" ? import_node_path63.default.join(import_node_os13.default.homedir(), ".claude.json") : import_node_path63.default.join(configDir, ".claude.json"));
|
|
144786
144967
|
} catch {
|
|
144787
144968
|
account = void 0;
|
|
144788
144969
|
}
|
|
@@ -146888,8 +147069,8 @@ function getErrorMap2() {
|
|
|
146888
147069
|
|
|
146889
147070
|
// node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/helpers/parseUtil.js
|
|
146890
147071
|
var makeIssue = (params) => {
|
|
146891
|
-
const { data, path:
|
|
146892
|
-
const fullPath = [...
|
|
147072
|
+
const { data, path: path73, errorMaps, issueData } = params;
|
|
147073
|
+
const fullPath = [...path73, ...issueData.path || []];
|
|
146893
147074
|
const fullIssue = {
|
|
146894
147075
|
...issueData,
|
|
146895
147076
|
path: fullPath
|
|
@@ -147004,11 +147185,11 @@ var errorUtil;
|
|
|
147004
147185
|
|
|
147005
147186
|
// node_modules/.pnpm/zod@4.6.7/node_modules/zod/v3/types.js
|
|
147006
147187
|
var ParseInputLazyPath = class {
|
|
147007
|
-
constructor(parent, value2,
|
|
147188
|
+
constructor(parent, value2, path73, key) {
|
|
147008
147189
|
this._cachedPath = [];
|
|
147009
147190
|
this.parent = parent;
|
|
147010
147191
|
this.data = value2;
|
|
147011
|
-
this._path =
|
|
147192
|
+
this._path = path73;
|
|
147012
147193
|
this._key = key;
|
|
147013
147194
|
}
|
|
147014
147195
|
get path() {
|
|
@@ -150571,11 +150752,11 @@ function normalizeObjectSchema(schema) {
|
|
|
150571
150752
|
}
|
|
150572
150753
|
return void 0;
|
|
150573
150754
|
}
|
|
150574
|
-
function getDotPath(
|
|
150575
|
-
if (
|
|
150755
|
+
function getDotPath(path73) {
|
|
150756
|
+
if (path73.length === 0) {
|
|
150576
150757
|
return "object root";
|
|
150577
150758
|
}
|
|
150578
|
-
return
|
|
150759
|
+
return path73.reduce((acc, seg, index) => {
|
|
150579
150760
|
if (index === 0) {
|
|
150580
150761
|
return String(seg);
|
|
150581
150762
|
}
|
|
@@ -154618,7 +154799,7 @@ async function serveMcp(mcp, transport, options = {}) {
|
|
|
154618
154799
|
|
|
154619
154800
|
// src/mcp/permissions.ts
|
|
154620
154801
|
var import_node_fs24 = __toESM(require("node:fs"), 1);
|
|
154621
|
-
var
|
|
154802
|
+
var import_node_path64 = __toESM(require("node:path"), 1);
|
|
154622
154803
|
init_zod();
|
|
154623
154804
|
init_store();
|
|
154624
154805
|
var StoredMcpPermissionsSchema = external_exports.strictObject({
|
|
@@ -154640,10 +154821,10 @@ function effectiveMcpPermissions(flags, stored2) {
|
|
|
154640
154821
|
return { writes: flags.writes || stored2.writes, remoteControl: flags.remoteControl || stored2.remoteControl, history: flags.history || stored2.history };
|
|
154641
154822
|
}
|
|
154642
154823
|
function watchMcpPermissions(paths, onChange) {
|
|
154643
|
-
const directory =
|
|
154824
|
+
const directory = import_node_path64.default.dirname(paths.mcpPermissionsFile);
|
|
154644
154825
|
import_node_fs24.default.mkdirSync(directory, { recursive: true });
|
|
154645
154826
|
const watcher = import_node_fs24.default.watch(directory, (_event, filename) => {
|
|
154646
|
-
if (filename === null || filename ===
|
|
154827
|
+
if (filename === null || filename === import_node_path64.default.basename(paths.mcpPermissionsFile)) {
|
|
154647
154828
|
onChange();
|
|
154648
154829
|
}
|
|
154649
154830
|
});
|
|
@@ -154956,16 +155137,16 @@ init_credentialCache();
|
|
|
154956
155137
|
|
|
154957
155138
|
// src/identityToken.ts
|
|
154958
155139
|
var import_node_fs25 = __toESM(require("node:fs"), 1);
|
|
154959
|
-
var
|
|
155140
|
+
var import_node_path65 = __toESM(require("node:path"), 1);
|
|
154960
155141
|
init_cliError();
|
|
154961
155142
|
var TOKEN_FILE_MODE = 384;
|
|
154962
155143
|
var TOKEN_DIR_MODE = 448;
|
|
154963
155144
|
var OAUTH_TOKEN_RE = /^sk-ant-oat\d+-[A-Za-z0-9_-]+$/;
|
|
154964
155145
|
function identityTokenDir(paths) {
|
|
154965
|
-
return
|
|
155146
|
+
return import_node_path65.default.join(paths.root, "credentials");
|
|
154966
155147
|
}
|
|
154967
155148
|
function identityTokenPath(paths, identityName) {
|
|
154968
|
-
return
|
|
155149
|
+
return import_node_path65.default.join(identityTokenDir(paths), `${identityName}.token`);
|
|
154969
155150
|
}
|
|
154970
155151
|
function storeIdentityToken(paths, identityName, raw) {
|
|
154971
155152
|
const token = raw.trim();
|
|
@@ -154976,7 +155157,7 @@ function storeIdentityToken(paths, identityName, raw) {
|
|
|
154976
155157
|
import_node_fs25.default.mkdirSync(dir, { recursive: true, mode: TOKEN_DIR_MODE });
|
|
154977
155158
|
import_node_fs25.default.chmodSync(dir, TOKEN_DIR_MODE);
|
|
154978
155159
|
const target = identityTokenPath(paths, identityName);
|
|
154979
|
-
const temp =
|
|
155160
|
+
const temp = import_node_path65.default.join(dir, `.${identityName}.${String(process.pid)}.tmp`);
|
|
154980
155161
|
import_node_fs25.default.writeFileSync(temp, `${token}
|
|
154981
155162
|
`, { mode: TOKEN_FILE_MODE });
|
|
154982
155163
|
import_node_fs25.default.renameSync(temp, target);
|
|
@@ -155148,7 +155329,7 @@ function registerDoctorCommand(program2, deps) {
|
|
|
155148
155329
|
// src/headroom/commands.ts
|
|
155149
155330
|
var import_node_fs26 = __toESM(require("node:fs"), 1);
|
|
155150
155331
|
var import_node_http5 = __toESM(require("node:http"), 1);
|
|
155151
|
-
var
|
|
155332
|
+
var import_node_path66 = __toESM(require("node:path"), 1);
|
|
155152
155333
|
var import_node_child_process10 = require("node:child_process");
|
|
155153
155334
|
init_commandDeps();
|
|
155154
155335
|
init_configProfilesStore();
|
|
@@ -155358,12 +155539,12 @@ function readInstalledHeadroomCommit() {
|
|
|
155358
155539
|
if (toolDir.status !== 0) {
|
|
155359
155540
|
return void 0;
|
|
155360
155541
|
}
|
|
155361
|
-
const libDir =
|
|
155542
|
+
const libDir = import_node_path66.default.join(toolDir.stdout.trim(), HEADROOM_TOOL_NAME, "lib");
|
|
155362
155543
|
for (const python of realFarmFs.readdir(libDir)) {
|
|
155363
|
-
const sitePackages =
|
|
155544
|
+
const sitePackages = import_node_path66.default.join(libDir, python, "site-packages");
|
|
155364
155545
|
for (const entry of realFarmFs.readdir(sitePackages)) {
|
|
155365
155546
|
if (entry.startsWith("headroom_ai-") && entry.endsWith(".dist-info")) {
|
|
155366
|
-
const directUrl = realFarmFs.readFileUtf8(
|
|
155547
|
+
const directUrl = realFarmFs.readFileUtf8(import_node_path66.default.join(sitePackages, entry, "direct_url.json"));
|
|
155367
155548
|
return directUrl === void 0 ? void 0 : parseInstalledCommit(directUrl);
|
|
155368
155549
|
}
|
|
155369
155550
|
}
|
|
@@ -155620,7 +155801,7 @@ async function refreshCatalogueForReal(paths, name, env) {
|
|
|
155620
155801
|
init_realPorts();
|
|
155621
155802
|
|
|
155622
155803
|
// src/usage/realJobRunner.ts
|
|
155623
|
-
var
|
|
155804
|
+
var import_node_path67 = __toESM(require("node:path"), 1);
|
|
155624
155805
|
init_conditions();
|
|
155625
155806
|
init_identityClaude();
|
|
155626
155807
|
var JOB_LAUNCH_FLAGS = ["--no-headroom", "--no-remote-control", "--track-usage"];
|
|
@@ -155633,7 +155814,7 @@ ${outcome.trimEnd()}
|
|
|
155633
155814
|
}
|
|
155634
155815
|
function createRealJobRunner(params) {
|
|
155635
155816
|
return async (name, identity, job) => {
|
|
155636
|
-
const logFile =
|
|
155817
|
+
const logFile = import_node_path67.default.join(params.paths.jobLogsDir, `${name}.log`);
|
|
155637
155818
|
const append = (outcome) => {
|
|
155638
155819
|
params.fs.mkdirPrivate(params.paths.jobLogsDir);
|
|
155639
155820
|
params.fs.appendFilePrivate(logFile, logEntry(name, identity, params.now(), outcome));
|
|
@@ -155690,7 +155871,7 @@ function registerHeadlessCommands(program2, deps) {
|
|
|
155690
155871
|
}
|
|
155691
155872
|
|
|
155692
155873
|
// src/jobs.ts
|
|
155693
|
-
var
|
|
155874
|
+
var import_node_path68 = __toESM(require("node:path"), 1);
|
|
155694
155875
|
init_commandDeps();
|
|
155695
155876
|
init_cliError();
|
|
155696
155877
|
init_schema();
|
|
@@ -155715,7 +155896,7 @@ function jobOf(options) {
|
|
|
155715
155896
|
target: options.identity === void 0 ? { pool: options.pool ?? "" } : { identity: options.identity },
|
|
155716
155897
|
trigger: options.at === void 0 ? { beforeReset: options.beforeReset ?? "fiveHour", lead: options.lead ?? "" } : { at: options.at },
|
|
155717
155898
|
prompt: options.prompt,
|
|
155718
|
-
cwd:
|
|
155899
|
+
cwd: import_node_path68.default.resolve(options.cwd ?? process.cwd()),
|
|
155719
155900
|
timeout: options.timeout,
|
|
155720
155901
|
...options.model === void 0 ? {} : { model: options.model },
|
|
155721
155902
|
...options.allowedTool === void 0 ? {} : { allowedTools: options.allowedTool }
|
|
@@ -155788,7 +155969,7 @@ function registerJobCommand(program2, deps) {
|
|
|
155788
155969
|
console.log(`Allowed tools: ${entry.allowedTools.join(", ")}`);
|
|
155789
155970
|
}
|
|
155790
155971
|
console.log(`Prompt: ${entry.prompt}`);
|
|
155791
|
-
console.log(`Results: ${
|
|
155972
|
+
console.log(`Results: ${import_node_path68.default.join(paths.jobLogsDir, `${name}.log`)}`);
|
|
155792
155973
|
}),
|
|
155793
155974
|
["agent-shim job show digest"]
|
|
155794
155975
|
);
|
|
@@ -155811,7 +155992,7 @@ function registerJobCommand(program2, deps) {
|
|
|
155811
155992
|
throw new UsageError(`No member of the job's pool can be picked right now.`);
|
|
155812
155993
|
}
|
|
155813
155994
|
await createRealJobRunner({ paths, spawnDaemon: spawnDetachedSupervisor, fs: realFarmFs, now: () => /* @__PURE__ */ new Date() })(name, identity, entry);
|
|
155814
|
-
console.log(`Ran job "${name}" as ${identity}; the result is in ${
|
|
155995
|
+
console.log(`Ran job "${name}" as ${identity}; the result is in ${import_node_path68.default.join(paths.jobLogsDir, `${name}.log`)}.`);
|
|
155815
155996
|
}),
|
|
155816
155997
|
["agent-shim job run digest"]
|
|
155817
155998
|
);
|
|
@@ -155975,7 +156156,7 @@ init_providerAliases();
|
|
|
155975
156156
|
|
|
155976
156157
|
// src/providerRename.ts
|
|
155977
156158
|
var import_node_fs27 = __toESM(require("node:fs"), 1);
|
|
155978
|
-
var
|
|
156159
|
+
var import_node_path69 = __toESM(require("node:path"), 1);
|
|
155979
156160
|
init_schema();
|
|
155980
156161
|
init_store();
|
|
155981
156162
|
init_load();
|
|
@@ -156093,7 +156274,7 @@ function rewriteReferences(paths, from, to2) {
|
|
|
156093
156274
|
const launch = renamedLaunch(profile.launch, from, to2);
|
|
156094
156275
|
const models = profile.models === void 0 ? void 0 : renamedModels(profile.models, from, to2);
|
|
156095
156276
|
if (launch !== void 0 || models !== void 0) {
|
|
156096
|
-
applyPatch(
|
|
156277
|
+
applyPatch(import_node_path69.default.join(paths.configProfilesDir, `${name}.json`), ConfigProfileSchema, { ...launch === void 0 ? {} : { launch }, ...models === void 0 ? {} : { models } });
|
|
156097
156278
|
rewritten.push(`profile ${name}`);
|
|
156098
156279
|
}
|
|
156099
156280
|
}
|
|
@@ -156920,7 +157101,7 @@ function registerSessionCommands(program2, deps) {
|
|
|
156920
157101
|
}
|
|
156921
157102
|
|
|
156922
157103
|
// src/usage/commands.ts
|
|
156923
|
-
var
|
|
157104
|
+
var import_node_path70 = __toESM(require("node:path"), 1);
|
|
156924
157105
|
init_commandDeps();
|
|
156925
157106
|
init_realPorts();
|
|
156926
157107
|
init_account();
|
|
@@ -157059,7 +157240,7 @@ function collectAccounts(fs31, paths, identity, probe) {
|
|
|
157059
157240
|
return names.map((name) => ({
|
|
157060
157241
|
identity: name,
|
|
157061
157242
|
account: readAccountMetadata(fs31, paths.identitiesDir, name),
|
|
157062
|
-
signIn: identitySignIn(fs31, probe, { farmRoot:
|
|
157243
|
+
signIn: identitySignIn(fs31, probe, { farmRoot: import_node_path70.default.join(paths.identitiesDir, name), hasCredentialBlock: readIdentity(paths, name)?.credential !== void 0 }),
|
|
157063
157244
|
usage: readUsageSnapshot(fs31, paths.usageSnapshotsDir, name)
|
|
157064
157245
|
}));
|
|
157065
157246
|
}
|
|
@@ -157467,7 +157648,7 @@ function quotaHitOf(fs31, paths, identity, sessionId, sinceMs, nowMs) {
|
|
|
157467
157648
|
}
|
|
157468
157649
|
|
|
157469
157650
|
// src/supervise/move.ts
|
|
157470
|
-
var
|
|
157651
|
+
var import_node_path71 = __toESM(require("node:path"), 1);
|
|
157471
157652
|
init_lock();
|
|
157472
157653
|
init_poolPick();
|
|
157473
157654
|
init_read();
|
|
@@ -157513,7 +157694,7 @@ function createMover(deps) {
|
|
|
157513
157694
|
if (resolution.identity === request7.from) {
|
|
157514
157695
|
return { kind: "stay", reason: `no other member of pool "${pool}" can take it` };
|
|
157515
157696
|
}
|
|
157516
|
-
const transcript =
|
|
157697
|
+
const transcript = import_node_path71.default.join(paths.identitiesDir, resolution.identity, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
|
|
157517
157698
|
if (farmFs.lstat(transcript)?.kind !== "file") {
|
|
157518
157699
|
return { kind: "stay", reason: `${resolution.identity} does not share this conversation's history, so it could not resume it` };
|
|
157519
157700
|
}
|
|
@@ -157547,13 +157728,13 @@ function createIdentityMover(deps) {
|
|
|
157547
157728
|
throw error63;
|
|
157548
157729
|
}
|
|
157549
157730
|
try {
|
|
157550
|
-
if (farmFs.readFileUtf8(
|
|
157731
|
+
if (farmFs.readFileUtf8(import_node_path71.default.join(paths.identitiesDir, request7.to, "identity.json")) === void 0) {
|
|
157551
157732
|
return { kind: "stay", reason: `no identity "${request7.to}"` };
|
|
157552
157733
|
}
|
|
157553
157734
|
if (request7.to === request7.from) {
|
|
157554
157735
|
return { kind: "stay", reason: `the model already runs under this session's identity` };
|
|
157555
157736
|
}
|
|
157556
|
-
const transcript =
|
|
157737
|
+
const transcript = import_node_path71.default.join(paths.identitiesDir, request7.to, "projects", projectDirNameOf(deps.cwd), `${request7.sessionId}.jsonl`);
|
|
157557
157738
|
if (farmFs.lstat(transcript)?.kind !== "file") {
|
|
157558
157739
|
return { kind: "stay", reason: `${request7.to} does not share this conversation's history, so it could not resume it` };
|
|
157559
157740
|
}
|
|
@@ -158135,7 +158316,7 @@ async function runClaude(argvOverride) {
|
|
|
158135
158316
|
// src/cli.ts
|
|
158136
158317
|
async function main() {
|
|
158137
158318
|
aliasLegacyEnv(process.env);
|
|
158138
|
-
const invokedName =
|
|
158319
|
+
const invokedName = import_node_path72.default.basename(process.argv[1] ?? "agent-shim");
|
|
158139
158320
|
if (isInvokedAsClaude(invokedName)) {
|
|
158140
158321
|
await runClaude();
|
|
158141
158322
|
return;
|