@genesislcap/foundation-ai 15.7.1 → 15.7.2-GENC-1480.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic-transport.d.ts","sourceRoot":"","sources":["../../../src/transports/anthropic-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAGV,WAAW,EACX,kBAAkB,EAGnB,MAAM,qBAAqB,CAAC;AAoJ7B,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6GD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAE7C,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,MAAM;IACtB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS;IACtC,kFAAkF;IAClF,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS;IACzC,qFAAqF;IACrF,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE;;IAX5B,sDAAsD;IAC7C,KAAK,EAAE,MAAM;IACtB;;;;OAIG;IACM,SAAS,EAAE,MAAM,GAAG,SAAS;IACtC,kFAAkF;IACzE,YAAY,EAAE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CvB,OAAO,CAAC,kBAAkB;IA0H1B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,wBAAwB;IAkBhC;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IAkC3B,OAAO,CAAC,aAAa;IA8BrB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAO;IAChD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAO;IACzD;;;;;;;;;;OAUG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAO;IACjD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAIxC;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAQ;YAEjC,IAAI;IAgBlB,OAAO,CAAC,eAAe;CAexB"}
@@ -437,6 +437,43 @@ export interface ChatToolDefinition {
437
437
  name: string;
438
438
  description: string;
439
439
  parameters: Record<string, unknown>;
440
+ /**
441
+ * Require the provider to constrain this tool's call arguments to
442
+ * {@link ChatToolDefinition.parameters} as they are generated, rather than
443
+ * merely describing the schema and hoping the model conforms. Defaults to
444
+ * `false`.
445
+ *
446
+ * **What it does per provider**
447
+ *
448
+ * - **Anthropic** — the schema is compiled into a decoding grammar, so values
449
+ * that would violate it are unreachable rather than rejected afterwards.
450
+ * - **Gemini** — a no-op. Gemini constrains function-call arguments by default
451
+ * and offers nothing to opt into.
452
+ * - **Every other transport** — irrelevant; they do not send tools.
453
+ *
454
+ * **Why you want it even though Gemini already enforces.** Without this flag
455
+ * the same tool gives *different guarantees depending on the active provider*:
456
+ * enforced on Gemini, unenforced on Anthropic. A malformed-argument bug that
457
+ * cannot occur in a Gemini-backed deployment can occur in an Anthropic-backed
458
+ * one. Setting it removes that difference rather than introducing one.
459
+ *
460
+ * **It can change whether a request is accepted — Anthropic only.** Enforced
461
+ * tools are compiled, and compilation has limits (tool count, per-tool
462
+ * property cost, an aggregate budget, and a cap on union-typed parameters).
463
+ * Unenforced tools are never compiled and cost nothing, so a large tool
464
+ * surface is only a problem for the tools that opt in. A schema that runs
465
+ * happily on Gemini can therefore fail at request time on Anthropic once
466
+ * enforced. See `docs/tool-schemas.md` for the measured limits.
467
+ *
468
+ * **Not everything in a schema can be enforced.** `type`, `enum`, `const`,
469
+ * `required`, object shape, `pattern` and `format` are; `maxLength` and
470
+ * `minLength` are accepted and silently ignored; numeric bounds and most array
471
+ * constraints are rejected outright and are stripped from the outbound schema
472
+ * with a warning. Acceptance is not enforcement — validate the rest yourself.
473
+ *
474
+ * @beta
475
+ */
476
+ enforceSchema?: boolean;
440
477
  }
441
478
  /**
442
479
  * Controls how the main chat input area behaves while an agent (or sub-agent)
@@ -1 +1 @@
1
- {"version":3,"file":"chat.types.d.ts","sourceRoot":"","sources":["../../../src/types/chat.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,QAAQ,GAChB,MAAM,GACN,WAAW,GACX,QAAQ,GACR,MAAM,GACN,cAAc,GACd,gBAAgB,GAChB,mBAAmB,CAAC;AAExB;;;;GAIG;AACH,KAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC;CAC/B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAA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AM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * A JSON Schema node. Deliberately loose — `ChatToolDefinition.parameters` is
3
+ * caller-authored JSON Schema and we adapt it rather than validate it.
4
+ */
5
+ type SchemaNode = Record<string, unknown>;
6
+ /** The outcome of adapting a schema for enforcement. */
7
+ export interface EnforcedSchema {
8
+ /** The adapted schema — safe to send. Always a fresh object. */
9
+ schema: SchemaNode;
10
+ /** JSON Pointers of keywords removed because enforcement cannot express them. */
11
+ stripped: string[];
12
+ /**
13
+ * JSON Pointers of keywords rewritten rather than removed. Currently only
14
+ * `additionalProperties: true`, which enforcement requires to be `false` — a
15
+ * *tightening*, so it is reported separately from {@link EnforcedSchema.stripped}
16
+ * (which the caller is told to validate themselves).
17
+ */
18
+ overridden: string[];
19
+ /** JSON Pointers of `oneOf`/`not` left in place, which the provider will reject. */
20
+ undroppable: string[];
21
+ }
22
+ /**
23
+ * Adapt a tool's `parameters` for Anthropic's decode-time enforcement.
24
+ *
25
+ * Two changes, both required by the provider:
26
+ *
27
+ * 1. `additionalProperties: false` on every object node. Anthropic rejects an
28
+ * enforced schema without it (`For 'object' type, 'additionalProperties' must
29
+ * be explicitly set to false`) — a closed key set is what makes the object's
30
+ * grammar finite.
31
+ * 2. Keywords that enforcement cannot express are removed. Numeric bounds and
32
+ * most array constraints are *rejected* by the provider, so leaving them in
33
+ * fails the whole request; dropping them keeps everything else enforced.
34
+ *
35
+ * `required` is deliberately untouched: a subset, an empty list, and an absent
36
+ * key are all accepted, and an omitted-but-present property is still constrained.
37
+ *
38
+ * Note what is **not** stripped: `maxLength`/`minLength` are accepted and
39
+ * silently ignored, so they survive as documentation but guarantee nothing —
40
+ * validate lengths yourself. `pattern` and `format` *are* enforced (shape only,
41
+ * in `format`'s case) and are cheaper to compile than an unconstrained string.
42
+ */
43
+ export declare function toEnforcedAnthropicSchema(parameters: SchemaNode): EnforcedSchema;
44
+ /**
45
+ * Adapt a tool's `parameters` for enforcement and log what could not be carried
46
+ * across. Thin wrapper over {@link toEnforcedAnthropicSchema} for transport use.
47
+ */
48
+ export declare function enforcedAnthropicSchema(parameters: SchemaNode, toolName: string): SchemaNode;
49
+ /**
50
+ * Translate a JSON Schema into the OpenAPI 3.0 subset Gemini's function
51
+ * declarations (and `responseSchema`) actually parse.
52
+ *
53
+ * This runs **unconditionally**, independently of any enforcement opt-in: Gemini
54
+ * constrains tool arguments by default, so the only question here is whether the
55
+ * declaration is *accepted at all*. Left untranslated, a schema with any nullable
56
+ * column is a hard `400 Unknown name "type"` before the model runs.
57
+ *
58
+ * | JSON Schema | Gemini |
59
+ * | --- | --- |
60
+ * | `{"type": ["integer","null"]}` | `{"type": "integer", "nullable": true}` |
61
+ * | `{"anyOf": [{...}, {"type":"null"}]}` | the non-null branch, `nullable: true` |
62
+ * | `{"const": "X"}` | `{"enum": ["X"]}` |
63
+ * | `additionalProperties`, `examples`, `multipleOf` | removed |
64
+ * | `$defs` / `$ref` | inlined |
65
+ * | any other `$`-prefixed keyword | removed |
66
+ *
67
+ * A type union that is not simply "T or null" (e.g. `["string","integer"]`) has
68
+ * no OpenAPI equivalent and is left alone, so the provider rejects it rather
69
+ * than us silently picking a branch.
70
+ */
71
+ export declare function toGeminiSchema(parameters: SchemaNode): SchemaNode;
72
+ export {};
73
+ //# sourceMappingURL=tool-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-schema.d.ts","sourceRoot":"","sources":["../../../src/utils/tool-schema.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAwH1C,wDAAwD;AACxD,MAAM,WAAW,cAAc;IAC7B,gEAAgE;IAChE,MAAM,EAAE,UAAU,CAAC;IACnB,iFAAiF;IACjF,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;OAKG;IACH,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,oFAAoF;IACpF,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,UAAU,GAAG,cAAc,CAiChF;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAuB5F;AAwDD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAqCjE"}
@@ -2,6 +2,7 @@ import { __awaiter } from "tslib";
2
2
  import { SUPPORTED_ANTHROPIC_MODEL_IDS, } from '../types';
3
3
  import { logger } from '../utils/logger';
4
4
  import { scaleTemperature } from '../utils/temperature';
5
+ import { enforcedAnthropicSchema } from '../utils/tool-schema';
5
6
  import { VENDOR_LABELS } from './budget-exhausted-error';
6
7
  import { postWithRetry } from './post-with-retry';
7
8
  const ANTHROPIC_DIRECT_URL = 'https://api.anthropic.com/v1/messages';
@@ -303,11 +304,14 @@ export class AnthropicTransport {
303
304
  if (options === null || options === void 0 ? void 0 : options.systemPrompt)
304
305
  body.system = options.systemPrompt;
305
306
  if ((_a = options === null || options === void 0 ? void 0 : options.tools) === null || _a === void 0 ? void 0 : _a.length) {
306
- body.tools = options.tools.map((t) => ({
307
- name: t.name,
308
- description: t.description,
309
- input_schema: t.parameters,
310
- }));
307
+ // `enforceSchema` is a per-tool opt-in, and the provider compiles per tool:
308
+ // an unenforced tool is never compiled and costs nothing against the
309
+ // compilation limits, so marking one tool in a large surface is legitimate.
310
+ // Enforcement additionally requires `additionalProperties: false` on every
311
+ // object node, which the adapter adds (see `toolSchema` for what it strips).
312
+ body.tools = options.tools.map((t) => (Object.assign({ name: t.name, description: t.description, input_schema: t.enforceSchema
313
+ ? enforcedAnthropicSchema(t.parameters, t.name)
314
+ : t.parameters }, (t.enforceSchema ? { strict: true } : {}))));
311
315
  }
312
316
  // Map the requested tool-call mode to Anthropic's tool_choice — only
313
317
  // meaningful when tools exist. `'required'`/`{ tool }` force a tool call so
@@ -2,6 +2,7 @@ import { __awaiter } from "tslib";
2
2
  import { SUPPORTED_GEMINI_MODEL_IDS, } from '../types';
3
3
  import { logger } from '../utils/logger';
4
4
  import { scaleTemperature } from '../utils/temperature';
5
+ import { toGeminiSchema } from '../utils/tool-schema';
5
6
  import { ResponseTruncatedError } from './anthropic-transport';
6
7
  import { VENDOR_LABELS } from './budget-exhausted-error';
7
8
  import { repairMalformedFunctionCall } from './gemini-malformed-call';
@@ -221,13 +222,18 @@ export class GeminiTransport {
221
222
  if (options === null || options === void 0 ? void 0 : options.tailContext) {
222
223
  contents.push({ role: 'user', parts: [{ text: options.tailContext }] });
223
224
  }
225
+ // Gemini's function declarations are an OpenAPI 3.0 subset, not JSON Schema,
226
+ // so the canonical dialect is translated on the way out. This is unconditional
227
+ // and unrelated to `ChatToolDefinition.enforceSchema`: Gemini already
228
+ // constrains arguments by default, and the only question here is whether the
229
+ // declaration parses at all. Untranslated, any nullable column is a hard 400.
224
230
  const tools = ((_a = options === null || options === void 0 ? void 0 : options.tools) === null || _a === void 0 ? void 0 : _a.length)
225
231
  ? [
226
232
  {
227
233
  functionDeclarations: options.tools.map((t) => ({
228
234
  name: t.name,
229
235
  description: t.description,
230
- parameters: t.parameters,
236
+ parameters: toGeminiSchema(t.parameters),
231
237
  })),
232
238
  },
233
239
  ]
@@ -270,7 +276,9 @@ export class GeminiTransport {
270
276
  tools,
271
277
  systemInstruction,
272
278
  toolConfig,
273
- generationConfig }, (applyResponseSchema ? { responseSchema: options.responseSchema } : {})), options === null || options === void 0 ? void 0 : options.signal);
279
+ generationConfig }, (applyResponseSchema
280
+ ? { responseSchema: toGeminiSchema(options.responseSchema) }
281
+ : {})), options === null || options === void 0 ? void 0 : options.signal);
274
282
  return this.fromGeminiResponse(response, offeredToolNames);
275
283
  });
276
284
  }
@@ -0,0 +1,287 @@
1
+ import { __rest } from "tslib";
2
+ import { logger } from './logger';
3
+ /** Keys whose value is a *map* of name → schema. */
4
+ const SCHEMA_MAP_KEYS = ['properties', 'patternProperties', '$defs', 'definitions'];
5
+ /** Keys whose value is an *array* of schemas. */
6
+ const SCHEMA_LIST_KEYS = ['anyOf', 'oneOf', 'allOf', 'prefixItems'];
7
+ /** Keys whose value is a single schema (or, for `items`, optionally a tuple of them). */
8
+ const SCHEMA_VALUE_KEYS = [
9
+ 'items',
10
+ 'not',
11
+ 'additionalProperties',
12
+ 'propertyNames',
13
+ 'contains',
14
+ ];
15
+ const isPlainObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
16
+ /** Structural deep clone for JSON-Schema-shaped values (JSON-serialisable by definition). */
17
+ function cloneValue(value) {
18
+ if (Array.isArray(value))
19
+ return value.map(cloneValue);
20
+ if (isPlainObject(value)) {
21
+ const out = {};
22
+ for (const [k, v] of Object.entries(value))
23
+ out[k] = cloneValue(v);
24
+ return out;
25
+ }
26
+ return value;
27
+ }
28
+ /**
29
+ * Deep-clone `node`, recursing into every nested schema and applying `transform`
30
+ * to each node bottom-up. `path` is a JSON Pointer, passed to `transform` so it
31
+ * can report *where* a change was made.
32
+ *
33
+ * **Never mutates the input.** Tool definitions are routinely module-level
34
+ * constants shared across every turn, so in-place adaptation would corrupt them
35
+ * for all subsequent requests.
36
+ *
37
+ * Recursion is keyword-directed rather than structural: only the keys above hold
38
+ * schemas. A blind walk would descend into `enum` (an array of *values*),
39
+ * `required` (an array of *names*), or `type` (which may be an array of type
40
+ * names) and corrupt them.
41
+ */
42
+ function mapChildSchemas(node, visit, path) {
43
+ const out = {};
44
+ for (const [key, value] of Object.entries(node)) {
45
+ const here = `${path}/${key}`;
46
+ if (SCHEMA_MAP_KEYS.includes(key) && isPlainObject(value)) {
47
+ out[key] = Object.fromEntries(Object.entries(value).map(([name, child]) => [
48
+ name,
49
+ isPlainObject(child) ? visit(child, `${here}/${name}`) : cloneValue(child),
50
+ ]));
51
+ }
52
+ else if (SCHEMA_LIST_KEYS.includes(key) && Array.isArray(value)) {
53
+ out[key] = value.map((child, i) => isPlainObject(child) ? visit(child, `${here}/${i}`) : cloneValue(child));
54
+ }
55
+ else if (SCHEMA_VALUE_KEYS.includes(key)) {
56
+ if (isPlainObject(value))
57
+ out[key] = visit(value, here);
58
+ else if (Array.isArray(value))
59
+ // Legacy tuple form of `items`.
60
+ out[key] = value.map((child, i) => isPlainObject(child) ? visit(child, `${here}/${i}`) : cloneValue(child));
61
+ else
62
+ out[key] = cloneValue(value);
63
+ }
64
+ else {
65
+ out[key] = cloneValue(value);
66
+ }
67
+ }
68
+ return out;
69
+ }
70
+ function mapSchema(node, transform, path = '') {
71
+ return transform(mapChildSchemas(node, (child, childPath) => mapSchema(child, transform, childPath), path), path);
72
+ }
73
+ // ── Anthropic: enforcement (F6) ──────────────────────────────────────────────
74
+ /**
75
+ * Keywords Anthropic rejects outright when a tool is compiled for enforcement,
76
+ * and which can be dropped without changing what the rest of the schema means.
77
+ * Measured against `claude-opus-4-8` — see `docs/tool-schemas.md`.
78
+ *
79
+ * `minItems` is absent because it is only rejected above 1; it is handled below.
80
+ */
81
+ const UNENFORCEABLE_KEYWORDS = [
82
+ 'minimum',
83
+ 'maximum',
84
+ 'exclusiveMinimum',
85
+ 'exclusiveMaximum',
86
+ 'multipleOf',
87
+ 'maxItems',
88
+ 'uniqueItems',
89
+ 'minProperties',
90
+ 'maxProperties',
91
+ ];
92
+ /**
93
+ * Keywords Anthropic rejects that **cannot** be dropped, because removing them
94
+ * would leave a node that means something entirely different (`oneOf` and `not`
95
+ * carry the node's whole meaning; deleting `oneOf` leaves `{}`, which matches
96
+ * anything).
97
+ *
98
+ * These are deliberately left in place so the request fails loudly rather than
99
+ * silently enforcing a weaker schema than the caller wrote.
100
+ */
101
+ const UNDROPPABLE_KEYWORDS = ['oneOf', 'not'];
102
+ /**
103
+ * Adapt a tool's `parameters` for Anthropic's decode-time enforcement.
104
+ *
105
+ * Two changes, both required by the provider:
106
+ *
107
+ * 1. `additionalProperties: false` on every object node. Anthropic rejects an
108
+ * enforced schema without it (`For 'object' type, 'additionalProperties' must
109
+ * be explicitly set to false`) — a closed key set is what makes the object's
110
+ * grammar finite.
111
+ * 2. Keywords that enforcement cannot express are removed. Numeric bounds and
112
+ * most array constraints are *rejected* by the provider, so leaving them in
113
+ * fails the whole request; dropping them keeps everything else enforced.
114
+ *
115
+ * `required` is deliberately untouched: a subset, an empty list, and an absent
116
+ * key are all accepted, and an omitted-but-present property is still constrained.
117
+ *
118
+ * Note what is **not** stripped: `maxLength`/`minLength` are accepted and
119
+ * silently ignored, so they survive as documentation but guarantee nothing —
120
+ * validate lengths yourself. `pattern` and `format` *are* enforced (shape only,
121
+ * in `format`'s case) and are cheaper to compile than an unconstrained string.
122
+ */
123
+ export function toEnforcedAnthropicSchema(parameters) {
124
+ const stripped = [];
125
+ const overridden = [];
126
+ const undroppable = [];
127
+ const schema = mapSchema(parameters, (node, path) => {
128
+ for (const keyword of UNENFORCEABLE_KEYWORDS) {
129
+ if (keyword in node) {
130
+ delete node[keyword];
131
+ stripped.push(`${path}/${keyword}`);
132
+ }
133
+ }
134
+ // Only values other than 0 and 1 are rejected.
135
+ if (typeof node.minItems === 'number' && node.minItems > 1) {
136
+ delete node.minItems;
137
+ stripped.push(`${path}/minItems`);
138
+ }
139
+ for (const keyword of UNDROPPABLE_KEYWORDS) {
140
+ if (keyword in node)
141
+ undroppable.push(`${path}/${keyword}`);
142
+ }
143
+ // An object node must be closed. `additionalProperties: true` is a direct
144
+ // contradiction of the caller's own enforcement request, so it is overridden
145
+ // rather than honoured — but loudly, since it changes what the schema admits.
146
+ if (node.type === 'object' || isPlainObject(node.properties)) {
147
+ if (node.additionalProperties !== false) {
148
+ if (node.additionalProperties !== undefined)
149
+ overridden.push(`${path}/additionalProperties`);
150
+ node.additionalProperties = false;
151
+ }
152
+ }
153
+ return node;
154
+ });
155
+ return { schema, stripped, overridden, undroppable };
156
+ }
157
+ /**
158
+ * Adapt a tool's `parameters` for enforcement and log what could not be carried
159
+ * across. Thin wrapper over {@link toEnforcedAnthropicSchema} for transport use.
160
+ */
161
+ export function enforcedAnthropicSchema(parameters, toolName) {
162
+ const { schema, stripped, overridden, undroppable } = toEnforcedAnthropicSchema(parameters);
163
+ if (stripped.length) {
164
+ logger.warn(`AnthropicTransport: tool "${toolName}" requested schema enforcement; these keywords cannot ` +
165
+ `be enforced and were removed — validate them yourself: ${stripped.join(', ')}`);
166
+ }
167
+ if (overridden.length) {
168
+ logger.warn(`AnthropicTransport: tool "${toolName}" requested schema enforcement, which requires closed ` +
169
+ `objects; \`additionalProperties\` was set to false at: ${overridden.join(', ')}. The tool ` +
170
+ `now accepts fewer inputs than its schema declared.`);
171
+ }
172
+ if (undroppable.length) {
173
+ logger.warn(`AnthropicTransport: tool "${toolName}" uses schema keywords enforcement cannot express ` +
174
+ `(${undroppable.join(', ')}). They cannot be removed without changing the schema's meaning, ` +
175
+ `so the request will be rejected. Rewrite them or drop enforceSchema for this tool.`);
176
+ }
177
+ return schema;
178
+ }
179
+ // ── Gemini: dialect translation (F7) ─────────────────────────────────────────
180
+ /**
181
+ * Keywords Gemini's function-declaration schema has no field for. They are
182
+ * unknown-field parse errors, not unsupported features, so they must be removed
183
+ * whatever the caller wrote. Measured against `gemini-3.5-flash`.
184
+ */
185
+ const GEMINI_UNSUPPORTED_KEYWORDS = [
186
+ 'additionalProperties',
187
+ 'examples',
188
+ 'multipleOf',
189
+ 'patternProperties',
190
+ // Both spellings of the definitions block. `$defs` would also fall to the
191
+ // `$`-prefix sweep below, but the draft-07 spelling has no `$` and would
192
+ // otherwise survive inlining and 400 the request — so list the pair together.
193
+ '$defs',
194
+ 'definitions',
195
+ ];
196
+ /** Resolve a local JSON Pointer (`#/$defs/Name`) against the document root. */
197
+ function resolvePointer(root, ref) {
198
+ if (!ref.startsWith('#/'))
199
+ return undefined;
200
+ let current = root;
201
+ for (const segment of ref.slice(2).split('/')) {
202
+ if (!isPlainObject(current))
203
+ return undefined;
204
+ current = current[segment.replace(/~1/g, '/').replace(/~0/g, '~')];
205
+ }
206
+ return isPlainObject(current) ? current : undefined;
207
+ }
208
+ /**
209
+ * Inline every local `$ref` against the root's `$defs`/`definitions`, because
210
+ * Gemini has no field for either. Cyclic references cannot be inlined at all —
211
+ * the `seen` set breaks the cycle and leaves the `$ref` in place, so the request
212
+ * fails loudly rather than expanding forever.
213
+ */
214
+ function inlineRefs(root, node, seen) {
215
+ // Substitute *before* descending, so refs nested inside a resolved target are
216
+ // themselves resolved. `seen` carries down that branch only, so the same
217
+ // definition may legitimately appear twice in sibling positions.
218
+ let current = node;
219
+ let visited = seen;
220
+ const ref = typeof current.$ref === 'string' ? current.$ref : undefined;
221
+ if (ref && !visited.has(ref)) {
222
+ const target = resolvePointer(root, ref);
223
+ if (target) {
224
+ const { $ref: _dropped } = current, siblings = __rest(current, ["$ref"]);
225
+ current = Object.assign(Object.assign({}, cloneValue(target)), siblings);
226
+ visited = new Set([...visited, ref]);
227
+ }
228
+ }
229
+ return mapChildSchemas(current, (child) => inlineRefs(root, child, visited), '');
230
+ }
231
+ /**
232
+ * Translate a JSON Schema into the OpenAPI 3.0 subset Gemini's function
233
+ * declarations (and `responseSchema`) actually parse.
234
+ *
235
+ * This runs **unconditionally**, independently of any enforcement opt-in: Gemini
236
+ * constrains tool arguments by default, so the only question here is whether the
237
+ * declaration is *accepted at all*. Left untranslated, a schema with any nullable
238
+ * column is a hard `400 Unknown name "type"` before the model runs.
239
+ *
240
+ * | JSON Schema | Gemini |
241
+ * | --- | --- |
242
+ * | `{"type": ["integer","null"]}` | `{"type": "integer", "nullable": true}` |
243
+ * | `{"anyOf": [{...}, {"type":"null"}]}` | the non-null branch, `nullable: true` |
244
+ * | `{"const": "X"}` | `{"enum": ["X"]}` |
245
+ * | `additionalProperties`, `examples`, `multipleOf` | removed |
246
+ * | `$defs` / `$ref` | inlined |
247
+ * | any other `$`-prefixed keyword | removed |
248
+ *
249
+ * A type union that is not simply "T or null" (e.g. `["string","integer"]`) has
250
+ * no OpenAPI equivalent and is left alone, so the provider rejects it rather
251
+ * than us silently picking a branch.
252
+ */
253
+ export function toGeminiSchema(parameters) {
254
+ const inlined = inlineRefs(parameters, parameters, new Set());
255
+ const translated = mapSchema(inlined, (node) => {
256
+ // `type: [T, "null"]` → `type: T, nullable: true`
257
+ if (Array.isArray(node.type)) {
258
+ const types = node.type.filter((t) => t !== 'null');
259
+ if (types.length === 1 && node.type.length !== types.length) {
260
+ node.type = types[0];
261
+ node.nullable = true;
262
+ }
263
+ }
264
+ // `anyOf: [X, {type:"null"}]` → X with `nullable: true`
265
+ if (Array.isArray(node.anyOf)) {
266
+ const branches = node.anyOf.filter(isPlainObject);
267
+ const nonNull = branches.filter((b) => b.type !== 'null');
268
+ if (branches.length === 2 && nonNull.length === 1) {
269
+ const { anyOf: _dropped } = node, siblings = __rest(node, ["anyOf"]);
270
+ return Object.assign(Object.assign(Object.assign({}, nonNull[0]), siblings), { nullable: true });
271
+ }
272
+ }
273
+ if ('const' in node) {
274
+ node.enum = [node.const];
275
+ delete node.const;
276
+ }
277
+ for (const keyword of GEMINI_UNSUPPORTED_KEYWORDS)
278
+ delete node[keyword];
279
+ // `$defs`/`$ref` are handled by inlining above; anything else `$`-prefixed
280
+ // (`$schema`, `$comment`, `$id`) is an unknown field to Gemini.
281
+ for (const key of Object.keys(node))
282
+ if (key.startsWith('$'))
283
+ delete node[key];
284
+ return node;
285
+ });
286
+ return translated;
287
+ }
@@ -5349,6 +5349,33 @@
5349
5349
  "endIndex": 2
5350
5350
  }
5351
5351
  },
5352
+ {
5353
+ "kind": "PropertySignature",
5354
+ "canonicalReference": "@genesislcap/foundation-ai!ChatToolDefinition#enforceSchema:member",
5355
+ "docComment": "/**\n * Require the provider to constrain this tool's call arguments to {@link ChatToolDefinition.parameters} as they are generated, rather than merely describing the schema and hoping the model conforms. Defaults to `false`.\n *\n * **What it does per provider**\n *\n * - **Anthropic** — the schema is compiled into a decoding grammar, so values that would violate it are unreachable rather than rejected afterwards. - **Gemini** — a no-op. Gemini constrains function-call arguments by default and offers nothing to opt into. - **Every other transport** — irrelevant; they do not send tools.\n *\n * **Why you want it even though Gemini already enforces.** Without this flag the same tool gives *different guarantees depending on the active provider*: enforced on Gemini, unenforced on Anthropic. A malformed-argument bug that cannot occur in a Gemini-backed deployment can occur in an Anthropic-backed one. Setting it removes that difference rather than introducing one.\n *\n * **It can change whether a request is accepted — Anthropic only.** Enforced tools are compiled, and compilation has limits (tool count, per-tool property cost, an aggregate budget, and a cap on union-typed parameters). Unenforced tools are never compiled and cost nothing, so a large tool surface is only a problem for the tools that opt in. A schema that runs happily on Gemini can therefore fail at request time on Anthropic once enforced. See `docs/tool-schemas.md` for the measured limits.\n *\n * **Not everything in a schema can be enforced.** `type`, `enum`, `const`, `required`, object shape, `pattern` and `format` are; `maxLength` and `minLength` are accepted and silently ignored; numeric bounds and most array constraints are rejected outright and are stripped from the outbound schema with a warning. Acceptance is not enforcement — validate the rest yourself.\n *\n * @beta\n */\n",
5356
+ "excerptTokens": [
5357
+ {
5358
+ "kind": "Content",
5359
+ "text": "enforceSchema?: "
5360
+ },
5361
+ {
5362
+ "kind": "Content",
5363
+ "text": "boolean"
5364
+ },
5365
+ {
5366
+ "kind": "Content",
5367
+ "text": ";"
5368
+ }
5369
+ ],
5370
+ "isReadonly": false,
5371
+ "isOptional": true,
5372
+ "releaseTag": "Beta",
5373
+ "name": "enforceSchema",
5374
+ "propertyTypeTokenRange": {
5375
+ "startIndex": 1,
5376
+ "endIndex": 2
5377
+ }
5378
+ },
5352
5379
  {
5353
5380
  "kind": "PropertySignature",
5354
5381
  "canonicalReference": "@genesislcap/foundation-ai!ChatToolDefinition#name:member",
@@ -1274,6 +1274,43 @@ export declare interface ChatToolDefinition {
1274
1274
  name: string;
1275
1275
  description: string;
1276
1276
  parameters: Record<string, unknown>;
1277
+ /**
1278
+ * Require the provider to constrain this tool's call arguments to
1279
+ * {@link ChatToolDefinition.parameters} as they are generated, rather than
1280
+ * merely describing the schema and hoping the model conforms. Defaults to
1281
+ * `false`.
1282
+ *
1283
+ * **What it does per provider**
1284
+ *
1285
+ * - **Anthropic** — the schema is compiled into a decoding grammar, so values
1286
+ * that would violate it are unreachable rather than rejected afterwards.
1287
+ * - **Gemini** — a no-op. Gemini constrains function-call arguments by default
1288
+ * and offers nothing to opt into.
1289
+ * - **Every other transport** — irrelevant; they do not send tools.
1290
+ *
1291
+ * **Why you want it even though Gemini already enforces.** Without this flag
1292
+ * the same tool gives *different guarantees depending on the active provider*:
1293
+ * enforced on Gemini, unenforced on Anthropic. A malformed-argument bug that
1294
+ * cannot occur in a Gemini-backed deployment can occur in an Anthropic-backed
1295
+ * one. Setting it removes that difference rather than introducing one.
1296
+ *
1297
+ * **It can change whether a request is accepted — Anthropic only.** Enforced
1298
+ * tools are compiled, and compilation has limits (tool count, per-tool
1299
+ * property cost, an aggregate budget, and a cap on union-typed parameters).
1300
+ * Unenforced tools are never compiled and cost nothing, so a large tool
1301
+ * surface is only a problem for the tools that opt in. A schema that runs
1302
+ * happily on Gemini can therefore fail at request time on Anthropic once
1303
+ * enforced. See `docs/tool-schemas.md` for the measured limits.
1304
+ *
1305
+ * **Not everything in a schema can be enforced.** `type`, `enum`, `const`,
1306
+ * `required`, object shape, `pattern` and `format` are; `maxLength` and
1307
+ * `minLength` are accepted and silently ignored; numeric bounds and most array
1308
+ * constraints are rejected outright and are stripped from the outbound schema
1309
+ * with a warning. Acceptance is not enforcement — validate the rest yourself.
1310
+ *
1311
+ * @beta
1312
+ */
1313
+ enforceSchema?: boolean;
1277
1314
  }
1278
1315
 
1279
1316
  /**
@@ -1,2 +1,7 @@
1
1
  *.md -diff
2
2
  *.md linguist-generated
3
+
4
+ # Hand-authored docs live here alongside the generated API report. Exempt them from
5
+ # the rules above so they show diffs in review and count as real source.
6
+ tool-schemas.md diff
7
+ tool-schemas.md -linguist-generated
@@ -0,0 +1,375 @@
1
+ # Tool schemas across providers
2
+
3
+ `ChatToolDefinition.parameters` is a JSON Schema describing a tool's arguments. What each
4
+ provider does with that schema differs in ways that are easy to conflate, so this document
5
+ separates them into three independent layers and records what is true at each.
6
+
7
+ Read this before changing how tool definitions are constructed in a transport, before setting
8
+ `enforceSchema` on a wide schema, or before assuming that a schema which is *accepted* is also
9
+ *enforced*.
10
+
11
+ ---
12
+
13
+ ## The three layers
14
+
15
+ A tool schema passes through three gates. They are sequential — each can only fail if the one
16
+ before it passed — and they fail in different places, at different times, with different
17
+ recovery.
18
+
19
+ | Layer | Question | Fails as | Guaranteed? |
20
+ | --- | --- | --- | --- |
21
+ | **1. Declaration** | Will the provider accept this schema at request time? | HTTP 400 before the model runs | Yes — the transport adapts the schema to its provider's dialect |
22
+ | **2. Envelope** | Will the model emit a parseable tool call at all? | `MALFORMED_FUNCTION_CALL` (Gemini only) | No |
23
+ | **3. Payload** | Given a parseable call, do the arguments match the schema? | Nothing — bad values reach the handler | Per-tool on Anthropic (`enforceSchema`); inherent on Gemini |
24
+
25
+ The worked example below uses one small tool:
26
+
27
+ ```ts
28
+ const saveContact: ChatToolDefinition = {
29
+ name: 'save_contact',
30
+ description: 'Persist a contact record.',
31
+ enforceSchema: true,
32
+ parameters: {
33
+ type: 'object',
34
+ properties: {
35
+ name: { type: 'string' },
36
+ tier: { type: 'string', enum: ['STANDARD', 'PREMIUM'] },
37
+ score: { type: ['integer', 'null'] },
38
+ },
39
+ required: ['name', 'tier', 'score'],
40
+ },
41
+ };
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Layer 1 — Declaration
47
+
48
+ This happens during request construction, before the model is involved.
49
+
50
+ **The canonical dialect for `ChatToolDefinition.parameters` is JSON Schema.** Each transport
51
+ adapts it to whatever its provider's API actually parses (`utils/tool-schema.ts`). Callers write
52
+ one dialect and do not branch on provider.
53
+
54
+ ### Anthropic
55
+
56
+ `input_schema` accepts JSON Schema, including type unions, so an unenforced tool goes out
57
+ essentially as written. For a tool with `enforceSchema: true` the transport sets `strict: true`
58
+ and adds `additionalProperties: false` to **every** object node, recursively:
59
+
60
+ ```jsonc
61
+ { "name": "save_contact", "description": "...",
62
+ "strict": true,
63
+ "input_schema": { "type": "object", "additionalProperties": false,
64
+ "properties": { … },
65
+ "required": ["name","tier","score"] } }
66
+ ```
67
+
68
+ `additionalProperties: false` is mandatory, not cosmetic. Omitting it on any object node fails
69
+ the request outright:
70
+
71
+ ```
72
+ 400 tools.0.custom: For 'object' type, 'additionalProperties' must be explicitly set to false
73
+ ```
74
+
75
+ A closed key set is what makes the object's grammar finite. If a caller explicitly sets
76
+ `additionalProperties: true` the transport overrides it to `false` and warns — an open object is
77
+ a direct contradiction of the caller's own enforcement request.
78
+
79
+ **`required` is deliberately untouched.** A subset, an empty list, and an absent key are all
80
+ accepted. A property omitted from `required` may be omitted by the model, but if the model emits
81
+ it the value is still constrained.
82
+
83
+ ### Gemini
84
+
85
+ Gemini's function declarations are **not** JSON Schema. They are an OpenAPI 3.0 `Schema` subset
86
+ backed by a protobuf message, so anything outside that message is an unknown-field parse error
87
+ rather than an unsupported feature — a **hard reject before the model runs**, with layers 2 and 3
88
+ never reached.
89
+
90
+ The transport therefore translates unconditionally, independently of `enforceSchema`:
91
+
92
+ | JSON Schema (canonical) | Gemini | Transport action |
93
+ | --- | --- | --- |
94
+ | `{"type": ["integer","null"]}` | 400 `Unknown name "type"` | rewrite to `{"type":"integer","nullable":true}` |
95
+ | `{"anyOf":[{…},{"type":"null"}]}` | accepted | rewrite to `nullable: true` for consistency |
96
+ | `additionalProperties` | 400 unknown field | strip |
97
+ | `const: "X"` | 400 unknown field | rewrite to `enum: ["X"]` |
98
+ | `examples` | 400 unknown field | strip |
99
+ | `multipleOf` | 400 unknown field | strip |
100
+ | `$defs` / `$ref` | 400 unknown field | inline the reference |
101
+ | `$comment`, `$id`, `$schema` | 400 unknown field | strip |
102
+
103
+ Accepted and passed through: `enum`, `format`, `minLength`, `maxLength`, `pattern`, `minimum`,
104
+ `maximum`, `minItems`, `oneOf`, `anyOf`, `default`, `title`, `description`, `nullable`.
105
+
106
+ A type union that is not simply "T or null" (e.g. `["string","integer"]`) has no OpenAPI
107
+ equivalent and is left alone, so the provider rejects it rather than the transport silently
108
+ picking a branch.
109
+
110
+ **The same translation applies to `ChatRequestOptions.responseSchema`**, which reaches Gemini
111
+ through the identical `Schema` type and rejects type unions and `additionalProperties` in exactly
112
+ the same way.
113
+
114
+ ---
115
+
116
+ ## Layer 2 — Envelope
117
+
118
+ The model is running. The question is whether a parseable tool call comes back.
119
+
120
+ ### Gemini
121
+
122
+ Expected:
123
+
124
+ ```jsonc
125
+ {"candidates":[{"content":{"parts":[
126
+ {"functionCall":{"name":"save_contact","args":{"name":"Ada","tier":"PREMIUM","score":91}}}]},
127
+ "finishReason":"STOP"}]}
128
+ ```
129
+
130
+ What sometimes arrives instead:
131
+
132
+ ```jsonc
133
+ {"candidates":[{
134
+ "finishReason":"MALFORMED_FUNCTION_CALL",
135
+ "finishMessage":"print(default_api.save_contact(name = \"Ada\", tier = \"PREMIUM\", score = 91))"
136
+ }]}
137
+ ```
138
+
139
+ No `parts` at all — the whole call is in `finishMessage` as text. Note what is *in* that text:
140
+ `tier` is `"PREMIUM"`, `score` is an integer. **The arguments are correct.** The schema constraint
141
+ held; the serialisation step is what failed. This is why layers 2 and 3 are genuinely independent,
142
+ and why enforcement is no defence against this failure mode.
143
+
144
+ `repairMalformedFunctionCall` (`transports/gemini-malformed-call.ts`) anchors on `default_api.`,
145
+ parses the keyword arguments back out, and hands the transport a normal structured call. It is
146
+ fail-closed: any ambiguity returns `null`, the transport throws `MalformedFunctionCallError`, and
147
+ the caller decides whether to retry.
148
+
149
+ This correlates with forced tool use (`toolChoice: 'required'` or a named tool), which can make
150
+ the model batch several calls into one expression — exactly what the parser refuses. A forced
151
+ single-tool turn is the lowest-risk shape.
152
+
153
+ ### Anthropic
154
+
155
+ No equivalent failure mode. A tool call is a first-class content block, so there is no
156
+ text-to-structure conversion step to fail.
157
+
158
+ ---
159
+
160
+ ## Layer 3 — Payload
161
+
162
+ A well-formed call is being emitted. The only question is whether the argument *values* conform.
163
+
164
+ **Test this adversarially** — instruct the model to violate the schema and inspect what comes
165
+ back. Never infer enforcement from a successful request, and run the negative control: a
166
+ conforming answer only proves enforcement if the same model violates the schema when enforcement
167
+ is off.
168
+
169
+ ### Without enforcement (Anthropic default)
170
+
171
+ Prompted with *"use tier `LEGACY` for grandfathered accounts, and `"n/a"` when the score is
172
+ unknown"*, the model complies:
173
+
174
+ ```jsonc
175
+ "input": {"name":"Ada","tier":"LEGACY","score":"n/a"}
176
+ ```
177
+
178
+ Well-formed JSON, structurally a valid tool call, wrong against the schema. Nothing rejects it.
179
+
180
+ ### With enforcement
181
+
182
+ `enforceSchema: true` compiles the schema into a decoding grammar, so the tokens for `"LEGACY"`
183
+ are unreachable at that position and `score` admits integer digits or `null` and nothing else.
184
+ The model does not "decide to comply" — the alternative is not in the sample space.
185
+
186
+ ### Gemini — enforced, always
187
+
188
+ Constrained decoding is Gemini's default. `enforceSchema` is a no-op there.
189
+
190
+ ### What enforcement constrains, and what it does not
191
+
192
+ | Behaviour | Keywords |
193
+ | --- | --- |
194
+ | **Enforced** | `type`, `enum`, `const`, `required`, object shape, `pattern`, `format` (shape only) |
195
+ | **Accepted, silently ignored** | `maxLength`, `minLength`, `default`, `examples` |
196
+ | **Rejected, droppable** | `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, `multipleOf`, `maxItems`, `uniqueItems`, `minProperties`, `maxProperties`, `minItems` > 1 |
197
+ | **Rejected, not droppable** | `oneOf`, `not` |
198
+ | **Accepted** | `allOf`, `$defs` / `$ref`, `anyOf`, `minItems` of 0 or 1 |
199
+
200
+ Three things worth internalising:
201
+
202
+ **`pattern` and `format` are enforced, and they are *cheaper* than an unconstrained string.** An
203
+ earlier version of this document had them in the ignored row. `format` enforces **shape, not
204
+ semantics** — `format: 'date-time'` reliably produces a well-formed timestamp, and just as
205
+ reliably produced `2023-02-30T12:00:00Z`, a date that does not exist. Calendar validity is a
206
+ validator's job.
207
+
208
+ **`maxLength` guarantees nothing.** Re-tested at bounds 3, 5, 10, 20 and 40 against a
209
+ 62-character literal; all five returned the full 62 characters. It survives in the outbound schema
210
+ as documentation only.
211
+
212
+ **`oneOf` and `not` cannot be stripped.** Deleting `oneOf` leaves `{}`, which matches anything —
213
+ so the transport leaves them in place and warns, letting the request fail loudly rather than
214
+ silently enforcing a weaker schema than the caller wrote. Everything in the droppable row *is*
215
+ removed, with a warning naming each keyword and its JSON Pointer.
216
+
217
+ ---
218
+
219
+ ## Using `enforceSchema`
220
+
221
+ ```ts
222
+ const tool: ChatToolDefinition = { name, description, parameters, enforceSchema: true };
223
+ ```
224
+
225
+ The flag expresses intent — *constrain this tool's arguments to its declared schema* — and each
226
+ transport decides what that means. Provider mechanisms (`strict`, `additionalProperties`,
227
+ `nullable`) never appear in caller-facing types.
228
+
229
+ **It is per-tool, and the provider's compilation is per-tool to match.** Marking one tool does not
230
+ pull the rest of the `tools` array into compilation, and the budgets below count only enforced
231
+ tools. A request carrying one enforced tool alongside 100 unenforced ones with 400 union
232
+ parameters between them is accepted; 17 union parameters *inside enforced tools* is not. So
233
+ enforcing the single tool that matters inside a large surface is both expressible and cheap.
234
+
235
+ **It is off by default,** because enabling it changes which requests are *accepted*, not just how
236
+ the model behaves.
237
+
238
+ **Without it, the two vendors give different guarantees for the same schema** — enforced on
239
+ Gemini, unenforced on Anthropic. Setting it removes a vendor difference rather than introducing
240
+ one.
241
+
242
+ ### The five limits
243
+
244
+ All are inert unless a tool is enforced, and all count enforced tools only.
245
+
246
+ | # | Limit | Value | Scope |
247
+ | --- | --- | --- | --- |
248
+ | **1** | Enforced tools per request | **20** — the API names it explicitly | Per request |
249
+ | **2** | Top-level property *cost* on one tool's schema | Weighted by kind; unconstrained strings fail at **15** | Per enforced tool |
250
+ | **3** | Aggregate property budget | **65** columns in the nested shape; kind-independent | Summed over enforced tools |
251
+ | **4** | Union-typed parameters | **16** — counted **anywhere**, including nested | Summed over enforced tools |
252
+ | **5** | Optional parameters | Own budget (`"too many optional parameters (25)"`), and ruinous well below it | Per enforced tool |
253
+
254
+ **Limit 2 is a cost, not a count.** 14 unconstrained strings pass and 15 fail — but 40
255
+ 20-member enums pass, as do booleans, integers and numbers. Roughly: enum and scalar kinds are
256
+ ~free, `pattern`/`format` strings are moderate, unconstrained strings are expensive. Mixtures
257
+ share the budget, so 14 plain strings alongside 26 `pattern` strings *fails* despite having
258
+ exactly 14 unconstrained strings. **There is no reliable per-kind count to check.**
259
+
260
+ **Limit 2 applies to the top-level object only, and nesting removes it.** 20 flat properties
261
+ fail; the same 20 one level down inside `{ rows: [ … ] }` pass, and that shape reaches 65 before
262
+ limit 3 stops it. A schema generator that flattens nested objects into the top level converts
263
+ working schemas into 400s.
264
+
265
+ **Limit 4 counts both spellings** — `{"type":["integer","null"]}` and `{"anyOf":[…]}` — and counts
266
+ parameters, not tools: 20 union properties inside one enforced tool hits the same wall as 20
267
+ enforced tools with one each.
268
+
269
+ **Limit 5 has no safe workaround.** Expressing a nullable column as *optional* rather than
270
+ `type: [T,"null"]` swaps one budget for a worse-behaved one. There is no third way to say "this
271
+ column may have no value" that the compiler treats more cheaply.
272
+
273
+ ### Two mechanisms, and how to tell which one you hit
274
+
275
+ This is the most useful diagnostic in this document. The limits are not one system:
276
+
277
+ | | Fails in | Which limits | Behaviour |
278
+ | --- | --- | --- | --- |
279
+ | **Count precheck** | **< 1 s** | 1, 3, 4, and 5 above its threshold | Deterministic, cheap, nothing is compiled |
280
+ | **Real compilation** | **10–100 s** | 2, the optional ramp, nesting depth | Can 400, 503, or hang past any client timeout |
281
+
282
+ A sub-second 400 means a precheck counted you out — kind and content are irrelevant, which is why
283
+ limit 3 is exactly 65 columns for every property kind. A slow response of any kind means you are
284
+ compiling and the outcome is not guaranteed.
285
+
286
+ This also explains why the same payload can fail differently on different attempts: schemas near a
287
+ *precheck* boundary fail crisply every time, while schemas near a *compile* boundary land either
288
+ side of a timeout depending on load. Nesting past depth ~25 times out with
289
+ `Grammar compilation timed out.`; past ~30 it stops returning a typed error at all.
290
+
291
+ ### What can be checked before sending
292
+
293
+ Only limits **1** (enforced tools ≤ 20) and **4** (union parameters ≤ 16, counted recursively) are
294
+ exact and safely checkable client-side. Limits 2, 3 and 5 are cost-based or kind-weighted; treat
295
+ them as regions to stay clear of, and surface the provider's error with the enforced tool named
296
+ rather than trying to predict them.
297
+
298
+ ### Compilation is cached — but only on success
299
+
300
+ | | Cached? |
301
+ | --- | --- |
302
+ | A schema that compiles | Yes, ~24 h. First request pays; later identical requests are ~30× faster |
303
+ | A schema that fails | **No.** Every retry pays the full cost again |
304
+
305
+ So a rejected schema that took 40 s to reject will take 40 s again, and a retry policy with
306
+ backoff simply multiplies the wait before delivering the same deterministic error. Do not retry
307
+ compilation failures.
308
+
309
+ **Property kind does not change the ceiling, but it changes compile time several-fold.** At the
310
+ same 64 columns: unconstrained strings **64.6 s**, 20-member enums **9.0 s**. At 60 columns: plain
311
+ 37.6 s, `pattern` 13.9 s, `format` 15.9 s, integer 8.6 s, enum 6.7 s.
312
+
313
+ Practical consequence for anyone generating schemas: **emit the narrowest type the source model
314
+ supports** — `integer`/`number` rather than `string`, `enum` for enumerations, `format` for
315
+ timestamps. Not because it widens anything (it does not), but because each distinct schema pays
316
+ its cold compile once, and with one schema per table that multiplies across a project.
317
+
318
+ ### Model support
319
+
320
+ No model gating is applied. Every model in `SUPPORTED_ANTHROPIC_MODEL_IDS` accepts `strict` and
321
+ enforces it, including `claude-opus-4-7` and `claude-sonnet-4-6`, which Anthropic's own reference
322
+ documentation lists as unsupported. No model was observed to accept the field and ignore it.
323
+
324
+ ### Interaction with prompt caching
325
+
326
+ `strict` and `additionalProperties` are part of the serialised tool definitions, which render
327
+ first in the request. Because the flag lives on the definition rather than the request, it is
328
+ exactly as byte-stable as the tool surface itself — a static definition never toggles, and
329
+ toggling it invalidates any cached prefix covering the tools block (`CachePolicy` scopes
330
+ `'tools'`, `'prompt'`, `'history'`).
331
+
332
+ ---
333
+
334
+ ## Summary
335
+
336
+ | | Anthropic | Gemini |
337
+ | --- | --- | --- |
338
+ | Accepts JSON Schema type unions | Yes | No — translated to `nullable` by the transport |
339
+ | Accepts `additionalProperties` | Yes (**required** when enforcing) | No — stripped by the transport |
340
+ | Enforces argument values | Per tool, via `enforceSchema` | Always |
341
+ | Enforcement scope | Only the tools that opt in | Whole declaration |
342
+ | Compilation limits | Five, enforced tools only | None (no unions to count) |
343
+ | Envelope can fail | No | Yes (`MALFORMED_FUNCTION_CALL`) |
344
+
345
+ The two providers are asymmetric in a way that is easy to get backwards: **Anthropic accepts the
346
+ broader schema dialect but only enforces the tools that ask; Gemini needs the narrower dialect but
347
+ always enforces what it accepts.**
348
+
349
+ ---
350
+
351
+ ## Provenance and shelf life
352
+
353
+ Established by direct API calls on 2026-08-06 and 2026-08-07 against `claude-opus-4-8`,
354
+ `claude-sonnet-5`, `claude-haiku-4-5-20251001`, `claude-opus-4-7`, `claude-sonnet-4-6` and
355
+ `gemini-3.5-flash`, over roughly ten rounds of measurement between two independent investigators
356
+ who repeatedly disagreed. Several conclusions here are the *second or third* answer to their
357
+ question; the reasoning is preserved in the GENC-1480 handoff document if you need to know why a
358
+ particular claim is worded the way it is.
359
+
360
+ Everything about behaviour was proved adversarially — the prompt demanded a schema violation and
361
+ the returned arguments were inspected — with a negative control where a conforming answer could
362
+ otherwise have been the model simply being well-behaved.
363
+
364
+ **The traps that caught us, worth avoiding on a re-measure:**
365
+
366
+ - **Acceptance is not enforcement.** A schema containing `maxLength` returns 200 and ignores it.
367
+ - **When a rule says "X does not count", test with X present in bulk.** Two separate pre-flight
368
+ rules were proposed and retracted because they were validated only against the cheapest kind.
369
+ - **One clean error is not evidence of determinism.** Several shapes returned a typed 400 on one
370
+ run and hung on the next.
371
+ - **Record latency on every probe, including failures.** It is what distinguishes a count precheck
372
+ from a compilation, and status codes alone make the two look identical.
373
+
374
+ The limits, the accepted/ignored/rejected split, and the compile-time figures are all
375
+ undocumented provider behaviour. Expect drift; re-measure before relying on a threshold.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-ai",
3
3
  "description": "Genesis Foundation AI - Provider-agnostic AI configuration and shared utilities",
4
- "version": "15.7.1",
4
+ "version": "15.7.2-GENC-1480.1",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -52,17 +52,17 @@
52
52
  }
53
53
  },
54
54
  "devDependencies": {
55
- "@genesislcap/foundation-testing": "15.7.1",
56
- "@genesislcap/genx": "15.7.1",
57
- "@genesislcap/rollup-builder": "15.7.1",
58
- "@genesislcap/ts-builder": "15.7.1",
59
- "@genesislcap/uvu-playwright-builder": "15.7.1",
60
- "@genesislcap/vite-builder": "15.7.1",
61
- "@genesislcap/webpack-builder": "15.7.1"
55
+ "@genesislcap/foundation-testing": "15.7.2-GENC-1480.1",
56
+ "@genesislcap/genx": "15.7.2-GENC-1480.1",
57
+ "@genesislcap/rollup-builder": "15.7.2-GENC-1480.1",
58
+ "@genesislcap/ts-builder": "15.7.2-GENC-1480.1",
59
+ "@genesislcap/uvu-playwright-builder": "15.7.2-GENC-1480.1",
60
+ "@genesislcap/vite-builder": "15.7.2-GENC-1480.1",
61
+ "@genesislcap/webpack-builder": "15.7.2-GENC-1480.1"
62
62
  },
63
63
  "dependencies": {
64
- "@genesislcap/foundation-logger": "15.7.1",
65
- "@genesislcap/foundation-utils": "15.7.1",
64
+ "@genesislcap/foundation-logger": "15.7.2-GENC-1480.1",
65
+ "@genesislcap/foundation-utils": "15.7.2-GENC-1480.1",
66
66
  "@microsoft/fast-foundation": "2.50.0"
67
67
  },
68
68
  "repository": {
@@ -73,5 +73,5 @@
73
73
  "publishConfig": {
74
74
  "access": "public"
75
75
  },
76
- "gitHead": "2bc407997245523510a9c890dd09df353c5987d5"
76
+ "gitHead": "8076322e67aa4818cda643f5a61e611eea715abb"
77
77
  }