@ljoukov/llm 3.0.12 → 3.0.13

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
@@ -474,7 +474,8 @@ type AgentFilesystemToolsOptions = {
474
474
  };
475
475
  };
476
476
  declare const codexReadFileInputSchema: z.ZodObject<{
477
- file_path: z.ZodString;
477
+ file_path: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<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
481
  }, z.core.$strict>;
package/dist/index.d.ts CHANGED
@@ -474,7 +474,8 @@ type AgentFilesystemToolsOptions = {
474
474
  };
475
475
  };
476
476
  declare const codexReadFileInputSchema: z.ZodObject<{
477
- file_path: z.ZodString;
477
+ file_path: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<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
481
  }, z.core.$strict>;
package/dist/index.js CHANGED
@@ -7883,13 +7883,52 @@ var IMAGE_MIME_BY_EXTENSION = {
7883
7883
  ".webp": "image/webp",
7884
7884
  ".gif": "image/gif"
7885
7885
  };
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
+ }
7886
7899
  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)."
7900
+ file_path: z6.preprocess(
7901
+ (value) => parseOptionalString(value),
7902
+ z6.string().min(1).optional().describe(
7903
+ "Path to the file (relative to cwd, or absolute. In sandbox mode, / maps to the sandbox root)."
7904
+ )
7905
+ ),
7906
+ path: z6.preprocess(
7907
+ (value) => parseOptionalString(value),
7908
+ z6.string().min(1).optional().describe(
7909
+ "Alias for file_path. If both file_path and path are provided they must be identical."
7910
+ )
7889
7911
  ),
7890
7912
  offset: z6.number().int().min(1).nullish().describe("The line number to start reading from. Must be 1 or greater."),
7891
7913
  limit: z6.number().int().min(1).nullish().describe("The maximum number of lines to return.")
7892
- }).strict();
7914
+ }).strict().superRefine((value, context) => {
7915
+ const filePath = value.file_path?.trim() ?? "";
7916
+ const aliasPath = value.path?.trim() ?? "";
7917
+ if (filePath.length === 0 && aliasPath.length === 0) {
7918
+ context.addIssue({
7919
+ code: z6.ZodIssueCode.custom,
7920
+ message: "read_file requires file_path (or path alias).",
7921
+ path: ["file_path"]
7922
+ });
7923
+ }
7924
+ if (filePath.length > 0 && aliasPath.length > 0 && filePath !== aliasPath) {
7925
+ context.addIssue({
7926
+ code: z6.ZodIssueCode.custom,
7927
+ message: "file_path and path must match when both are provided.",
7928
+ path: ["path"]
7929
+ });
7930
+ }
7931
+ });
7893
7932
  var codexListDirInputSchema = z6.object({
7894
7933
  dir_path: z6.string().min(1).describe(
7895
7934
  "Path to the directory to list (relative to cwd, or absolute. In sandbox mode, / maps to the sandbox root)."
@@ -8122,9 +8161,24 @@ function createGlobTool(options = {}) {
8122
8161
  execute: async (input) => globFilesGemini(input, options)
8123
8162
  });
8124
8163
  }
8164
+ function resolveCodexReadFilePath(input) {
8165
+ const filePath = parseOptionalString(input.file_path);
8166
+ if (filePath) {
8167
+ return filePath;
8168
+ }
8169
+ const aliasPath = parseOptionalString(input.path);
8170
+ if (aliasPath) {
8171
+ return aliasPath;
8172
+ }
8173
+ throw new Error("read_file requires file_path");
8174
+ }
8125
8175
  async function readFileCodex(input, options) {
8126
8176
  const runtime = resolveRuntime(options);
8127
- const filePath = resolvePathWithPolicy(input.file_path, runtime.cwd, runtime.allowOutsideCwd);
8177
+ const filePath = resolvePathWithPolicy(
8178
+ resolveCodexReadFilePath(input),
8179
+ runtime.cwd,
8180
+ runtime.allowOutsideCwd
8181
+ );
8128
8182
  await runAccessHook2(runtime, {
8129
8183
  cwd: runtime.cwd,
8130
8184
  tool: "read_file",