@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.d.cts CHANGED
@@ -473,11 +473,12 @@ type AgentFilesystemToolsOptions = {
473
473
  readonly maxPatchBytes?: number;
474
474
  };
475
475
  };
476
- declare const codexReadFileInputSchema: z.ZodObject<{
477
- file_path: z.ZodString;
476
+ declare const codexReadFileInputSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
477
+ file_path: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodString>;
478
+ path: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
478
479
  offset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
479
480
  limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
480
- }, z.core.$strict>;
481
+ }, z.core.$strict>>;
481
482
  declare const codexListDirInputSchema: z.ZodObject<{
482
483
  dir_path: z.ZodString;
483
484
  offset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
package/dist/index.d.ts CHANGED
@@ -473,11 +473,12 @@ type AgentFilesystemToolsOptions = {
473
473
  readonly maxPatchBytes?: number;
474
474
  };
475
475
  };
476
- declare const codexReadFileInputSchema: z.ZodObject<{
477
- file_path: z.ZodString;
476
+ declare const codexReadFileInputSchema: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodObject<{
477
+ file_path: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodString>;
478
+ path: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
478
479
  offset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
479
480
  limit: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
480
- }, z.core.$strict>;
481
+ }, z.core.$strict>>;
481
482
  declare const codexListDirInputSchema: z.ZodObject<{
482
483
  dir_path: z.ZodString;
483
484
  offset: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
package/dist/index.js CHANGED
@@ -7883,13 +7883,61 @@ var IMAGE_MIME_BY_EXTENSION = {
7883
7883
  ".webp": "image/webp",
7884
7884
  ".gif": "image/gif"
7885
7885
  };
7886
- var codexReadFileInputSchema = z6.object({
7887
- file_path: z6.string().min(1).describe(
7888
- "Path to the file (relative to cwd, or absolute. In sandbox mode, / maps to the sandbox root)."
7889
- ),
7890
- offset: z6.number().int().min(1).nullish().describe("The line number to start reading from. Must be 1 or greater."),
7891
- limit: z6.number().int().min(1).nullish().describe("The maximum number of lines to return.")
7892
- }).strict();
7886
+ function parseOptionalString(value) {
7887
+ if (value === null || value === void 0) {
7888
+ return void 0;
7889
+ }
7890
+ if (typeof value !== "string") {
7891
+ return void 0;
7892
+ }
7893
+ const trimmed = value.trim();
7894
+ if (trimmed.length === 0) {
7895
+ return void 0;
7896
+ }
7897
+ return trimmed;
7898
+ }
7899
+ var codexReadFileInputSchema = z6.preprocess(
7900
+ (value) => {
7901
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
7902
+ return value;
7903
+ }
7904
+ const record = value;
7905
+ const filePath = parseOptionalString(record.file_path);
7906
+ const aliasPath = parseOptionalString(record.path);
7907
+ if (!filePath && aliasPath) {
7908
+ return {
7909
+ ...record,
7910
+ file_path: aliasPath
7911
+ };
7912
+ }
7913
+ return value;
7914
+ },
7915
+ z6.object({
7916
+ file_path: z6.preprocess(
7917
+ (value) => parseOptionalString(value),
7918
+ z6.string().min(1).describe(
7919
+ "Path to the file (relative to cwd, or absolute. In sandbox mode, / maps to the sandbox root)."
7920
+ )
7921
+ ),
7922
+ path: z6.preprocess(
7923
+ (value) => parseOptionalString(value),
7924
+ z6.string().min(1).optional().describe(
7925
+ "Alias for file_path. If both file_path and path are provided they must be identical."
7926
+ )
7927
+ ),
7928
+ offset: z6.number().int().min(1).nullish().describe("The line number to start reading from. Must be 1 or greater."),
7929
+ limit: z6.number().int().min(1).nullish().describe("The maximum number of lines to return.")
7930
+ }).strict().superRefine((value, context) => {
7931
+ const aliasPath = value.path?.trim() ?? "";
7932
+ if (aliasPath.length > 0 && value.file_path !== aliasPath) {
7933
+ context.addIssue({
7934
+ code: z6.ZodIssueCode.custom,
7935
+ message: "file_path and path must match when both are provided.",
7936
+ path: ["path"]
7937
+ });
7938
+ }
7939
+ })
7940
+ );
7893
7941
  var codexListDirInputSchema = z6.object({
7894
7942
  dir_path: z6.string().min(1).describe(
7895
7943
  "Path to the directory to list (relative to cwd, or absolute. In sandbox mode, / maps to the sandbox root)."
@@ -8122,9 +8170,24 @@ function createGlobTool(options = {}) {
8122
8170
  execute: async (input) => globFilesGemini(input, options)
8123
8171
  });
8124
8172
  }
8173
+ function resolveCodexReadFilePath(input) {
8174
+ const filePath = parseOptionalString(input.file_path);
8175
+ if (filePath) {
8176
+ return filePath;
8177
+ }
8178
+ const aliasPath = parseOptionalString(input.path);
8179
+ if (aliasPath) {
8180
+ return aliasPath;
8181
+ }
8182
+ throw new Error("read_file requires file_path");
8183
+ }
8125
8184
  async function readFileCodex(input, options) {
8126
8185
  const runtime = resolveRuntime(options);
8127
- const filePath = resolvePathWithPolicy(input.file_path, runtime.cwd, runtime.allowOutsideCwd);
8186
+ const filePath = resolvePathWithPolicy(
8187
+ resolveCodexReadFilePath(input),
8188
+ runtime.cwd,
8189
+ runtime.allowOutsideCwd
8190
+ );
8128
8191
  await runAccessHook2(runtime, {
8129
8192
  cwd: runtime.cwd,
8130
8193
  tool: "read_file",