@ljoukov/llm 3.0.12 → 3.0.14
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/index.cjs +71 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +71 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7996,13 +7996,61 @@ var IMAGE_MIME_BY_EXTENSION = {
|
|
|
7996
7996
|
".webp": "image/webp",
|
|
7997
7997
|
".gif": "image/gif"
|
|
7998
7998
|
};
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
}
|
|
7999
|
+
function parseOptionalString(value) {
|
|
8000
|
+
if (value === null || value === void 0) {
|
|
8001
|
+
return void 0;
|
|
8002
|
+
}
|
|
8003
|
+
if (typeof value !== "string") {
|
|
8004
|
+
return void 0;
|
|
8005
|
+
}
|
|
8006
|
+
const trimmed = value.trim();
|
|
8007
|
+
if (trimmed.length === 0) {
|
|
8008
|
+
return void 0;
|
|
8009
|
+
}
|
|
8010
|
+
return trimmed;
|
|
8011
|
+
}
|
|
8012
|
+
var codexReadFileInputSchema = import_zod6.z.preprocess(
|
|
8013
|
+
(value) => {
|
|
8014
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
8015
|
+
return value;
|
|
8016
|
+
}
|
|
8017
|
+
const record = value;
|
|
8018
|
+
const filePath = parseOptionalString(record.file_path);
|
|
8019
|
+
const aliasPath = parseOptionalString(record.path);
|
|
8020
|
+
if (!filePath && aliasPath) {
|
|
8021
|
+
return {
|
|
8022
|
+
...record,
|
|
8023
|
+
file_path: aliasPath
|
|
8024
|
+
};
|
|
8025
|
+
}
|
|
8026
|
+
return value;
|
|
8027
|
+
},
|
|
8028
|
+
import_zod6.z.object({
|
|
8029
|
+
file_path: import_zod6.z.preprocess(
|
|
8030
|
+
(value) => parseOptionalString(value),
|
|
8031
|
+
import_zod6.z.string().min(1).describe(
|
|
8032
|
+
"Path to the file (relative to cwd, or absolute. In sandbox mode, / maps to the sandbox root)."
|
|
8033
|
+
)
|
|
8034
|
+
),
|
|
8035
|
+
path: import_zod6.z.preprocess(
|
|
8036
|
+
(value) => parseOptionalString(value),
|
|
8037
|
+
import_zod6.z.string().min(1).optional().describe(
|
|
8038
|
+
"Alias for file_path. If both file_path and path are provided they must be identical."
|
|
8039
|
+
)
|
|
8040
|
+
),
|
|
8041
|
+
offset: import_zod6.z.number().int().min(1).nullish().describe("The line number to start reading from. Must be 1 or greater."),
|
|
8042
|
+
limit: import_zod6.z.number().int().min(1).nullish().describe("The maximum number of lines to return.")
|
|
8043
|
+
}).strict().superRefine((value, context) => {
|
|
8044
|
+
const aliasPath = value.path?.trim() ?? "";
|
|
8045
|
+
if (aliasPath.length > 0 && value.file_path !== aliasPath) {
|
|
8046
|
+
context.addIssue({
|
|
8047
|
+
code: import_zod6.z.ZodIssueCode.custom,
|
|
8048
|
+
message: "file_path and path must match when both are provided.",
|
|
8049
|
+
path: ["path"]
|
|
8050
|
+
});
|
|
8051
|
+
}
|
|
8052
|
+
})
|
|
8053
|
+
);
|
|
8006
8054
|
var codexListDirInputSchema = import_zod6.z.object({
|
|
8007
8055
|
dir_path: import_zod6.z.string().min(1).describe(
|
|
8008
8056
|
"Path to the directory to list (relative to cwd, or absolute. In sandbox mode, / maps to the sandbox root)."
|
|
@@ -8235,9 +8283,24 @@ function createGlobTool(options = {}) {
|
|
|
8235
8283
|
execute: async (input) => globFilesGemini(input, options)
|
|
8236
8284
|
});
|
|
8237
8285
|
}
|
|
8286
|
+
function resolveCodexReadFilePath(input) {
|
|
8287
|
+
const filePath = parseOptionalString(input.file_path);
|
|
8288
|
+
if (filePath) {
|
|
8289
|
+
return filePath;
|
|
8290
|
+
}
|
|
8291
|
+
const aliasPath = parseOptionalString(input.path);
|
|
8292
|
+
if (aliasPath) {
|
|
8293
|
+
return aliasPath;
|
|
8294
|
+
}
|
|
8295
|
+
throw new Error("read_file requires file_path");
|
|
8296
|
+
}
|
|
8238
8297
|
async function readFileCodex(input, options) {
|
|
8239
8298
|
const runtime = resolveRuntime(options);
|
|
8240
|
-
const filePath = resolvePathWithPolicy(
|
|
8299
|
+
const filePath = resolvePathWithPolicy(
|
|
8300
|
+
resolveCodexReadFilePath(input),
|
|
8301
|
+
runtime.cwd,
|
|
8302
|
+
runtime.allowOutsideCwd
|
|
8303
|
+
);
|
|
8241
8304
|
await runAccessHook2(runtime, {
|
|
8242
8305
|
cwd: runtime.cwd,
|
|
8243
8306
|
tool: "read_file",
|