@jaypie/llm 1.2.40 → 1.2.41

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.
@@ -34,6 +34,12 @@ export declare class OperateLoop {
34
34
  private createContext;
35
35
  private buildInitialRequest;
36
36
  private executeOneTurn;
37
+ /**
38
+ * Backfill declared array fields when a `format` is supplied. A declared
39
+ * `format` is a schema contract: an empty array field should surface as `[]`
40
+ * rather than be dropped by a provider/model that omits empty lists.
41
+ */
42
+ private applyFormatArrayDefaults;
37
43
  /**
38
44
  * Sync the current input state from the updated provider request.
39
45
  * This is necessary because appendToolResult modifies the provider-specific request,
@@ -0,0 +1,17 @@
1
+ import { z } from "zod/v4";
2
+ import { JsonObject, NaturalSchema } from "@jaypie/types";
3
+ type Format = JsonObject | NaturalSchema | z.ZodType;
4
+ /**
5
+ * Ensure every array field declared in `format` is present in `content` as an
6
+ * array. A declared `format` is a schema contract: an empty list should surface
7
+ * as `[]`, not be dropped from the response. Some providers/models omit empty
8
+ * array fields entirely, leaving consumers to read `.length` on `undefined`.
9
+ *
10
+ * Only mutates a (cloned) structured object; strings and non-objects pass
11
+ * through untouched.
12
+ */
13
+ export declare function fillFormatArrays({ content, format, }: {
14
+ content: JsonObject;
15
+ format: Format;
16
+ }): JsonObject;
17
+ export {};
@@ -1,5 +1,6 @@
1
1
  export * from "./determineModelProvider.js";
2
2
  export * from "./extractReasoning.js";
3
+ export * from "./fillFormatArrays.js";
3
4
  export * from "./formatOperateInput.js";
4
5
  export * from "./formatOperateMessage.js";
5
6
  export * from "./jsonSchemaToOpenApi3.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaypie/llm",
3
- "version": "1.2.40",
3
+ "version": "1.2.41",
4
4
  "description": "Large language model utilities",
5
5
  "repository": {
6
6
  "type": "git",