@genesislcap/foundation-ai 15.9.1 → 15.10.0

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,MAAM,GAA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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,GAAG;IACnD,OA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,SAAS,GAAG,QAAQ,CAAC;IAC/B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -0,0 +1,80 @@
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
+ * Named as a **verb** to keep it distinct from the pure transform it wraps: this
49
+ * one logs and returns only the schema, so a caller that wants to inspect what was
50
+ * stripped or tightened wants `toEnforcedAnthropicSchema` instead. An earlier name
51
+ * differed from it by word order alone, which made the two easy to confuse on
52
+ * autocomplete despite returning different things. PR #2449 review.
53
+ */
54
+ export declare function enforceAnthropicToolSchema(parameters: SchemaNode, toolName: string): SchemaNode;
55
+ /**
56
+ * Translate a JSON Schema into the OpenAPI 3.0 subset Gemini's function
57
+ * declarations (and `responseSchema`) actually parse.
58
+ *
59
+ * This runs **unconditionally**, independently of any enforcement opt-in: Gemini
60
+ * constrains tool arguments by default, so the only question here is whether the
61
+ * declaration is *accepted at all*. Left untranslated, a schema with any nullable
62
+ * column is a hard `400 Unknown name "type"` before the model runs.
63
+ *
64
+ * | JSON Schema | Gemini |
65
+ * | --- | --- |
66
+ * | `{"type": ["integer","null"]}` | `{"type": "integer", "nullable": true}` |
67
+ * | `{"anyOf": [{...}, {"type":"null"}]}` | the non-null branch, `nullable: true` |
68
+ * | `{"const": "X"}` | `{"enum": ["X"]}` |
69
+ * | `additionalProperties`, `examples`, `multipleOf` | removed |
70
+ * | `$defs` / `$ref` | inlined, alias chains walked out |
71
+ * | a `$ref` that cannot be inlined | **kept**, so the provider rejects it |
72
+ * | any other `$`-prefixed keyword | removed |
73
+ *
74
+ * A type union that is not simply "T or null" (e.g. `["string","integer"]`) has
75
+ * no OpenAPI equivalent and is left alone, so the provider rejects it rather
76
+ * than us silently picking a branch.
77
+ */
78
+ export declare function toGeminiSchema(parameters: SchemaNode): SchemaNode;
79
+ export {};
80
+ //# 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,CA6ChF;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAuB/F;AA0ED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAsDjE"}
@@ -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 { enforceAnthropicToolSchema } 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,15 @@ 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 `enforceAnthropicToolSchema` in
312
+ // `utils/tool-schema.ts` for what it strips and what it tightens).
313
+ body.tools = options.tools.map((t) => (Object.assign({ name: t.name, description: t.description, input_schema: t.enforceSchema
314
+ ? enforceAnthropicToolSchema(t.parameters, t.name)
315
+ : t.parameters }, (t.enforceSchema ? { strict: true } : {}))));
311
316
  }
312
317
  // Map the requested tool-call mode to Anthropic's tool_choice — only
313
318
  // 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,333 @@
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
+ //
147
+ // `type` may be an ARRAY containing `'object'` (a nullable object), which has
148
+ // to close exactly like the scalar spelling. Testing `properties` alone is not
149
+ // enough: a *property-less* `{type: ['object','null']}` would slip through and
150
+ // then differ from `{type: 'object'}` in what it admits, purely because it is
151
+ // nullable.
152
+ const isObjectNode = node.type === 'object' ||
153
+ (Array.isArray(node.type) && node.type.includes('object')) ||
154
+ isPlainObject(node.properties);
155
+ if (isObjectNode) {
156
+ if (node.additionalProperties !== false) {
157
+ if (node.additionalProperties !== undefined) {
158
+ overridden.push(`${path}/additionalProperties`);
159
+ }
160
+ node.additionalProperties = false;
161
+ }
162
+ }
163
+ return node;
164
+ });
165
+ return { schema, stripped, overridden, undroppable };
166
+ }
167
+ /**
168
+ * Adapt a tool's `parameters` for enforcement and log what could not be carried
169
+ * across. Thin wrapper over {@link toEnforcedAnthropicSchema} for transport use.
170
+ *
171
+ * Named as a **verb** to keep it distinct from the pure transform it wraps: this
172
+ * one logs and returns only the schema, so a caller that wants to inspect what was
173
+ * stripped or tightened wants `toEnforcedAnthropicSchema` instead. An earlier name
174
+ * differed from it by word order alone, which made the two easy to confuse on
175
+ * autocomplete despite returning different things. PR #2449 review.
176
+ */
177
+ export function enforceAnthropicToolSchema(parameters, toolName) {
178
+ const { schema, stripped, overridden, undroppable } = toEnforcedAnthropicSchema(parameters);
179
+ if (stripped.length) {
180
+ logger.warn(`AnthropicTransport: tool "${toolName}" requested schema enforcement; these keywords cannot ` +
181
+ `be enforced and were removed — validate them yourself: ${stripped.join(', ')}`);
182
+ }
183
+ if (overridden.length) {
184
+ logger.warn(`AnthropicTransport: tool "${toolName}" requested schema enforcement, which requires closed ` +
185
+ `objects; \`additionalProperties\` was set to false at: ${overridden.join(', ')}. The tool ` +
186
+ `now accepts fewer inputs than its schema declared.`);
187
+ }
188
+ if (undroppable.length) {
189
+ logger.warn(`AnthropicTransport: tool "${toolName}" uses schema keywords enforcement cannot express ` +
190
+ `(${undroppable.join(', ')}). They cannot be removed without changing the schema's meaning, ` +
191
+ `so the request will be rejected. Rewrite them or drop enforceSchema for this tool.`);
192
+ }
193
+ return schema;
194
+ }
195
+ // ── Gemini: dialect translation (F7) ─────────────────────────────────────────
196
+ /**
197
+ * Keywords Gemini's function-declaration schema has no field for. They are
198
+ * unknown-field parse errors, not unsupported features, so they must be removed
199
+ * whatever the caller wrote. Measured against `gemini-3.5-flash`.
200
+ */
201
+ const GEMINI_UNSUPPORTED_KEYWORDS = [
202
+ 'additionalProperties',
203
+ 'examples',
204
+ 'multipleOf',
205
+ 'patternProperties',
206
+ // Both spellings of the definitions block. `$defs` would also fall to the
207
+ // `$`-prefix sweep below, but the draft-07 spelling has no `$` and would
208
+ // otherwise survive inlining and 400 the request — so list the pair together.
209
+ '$defs',
210
+ 'definitions',
211
+ ];
212
+ /** Resolve a local JSON Pointer (`#/$defs/Name`) against the document root. */
213
+ function resolvePointer(root, ref) {
214
+ if (!ref.startsWith('#/'))
215
+ return undefined;
216
+ let current = root;
217
+ for (const segment of ref.slice(2).split('/')) {
218
+ if (!isPlainObject(current))
219
+ return undefined;
220
+ current = current[segment.replace(/~1/g, '/').replace(/~0/g, '~')];
221
+ }
222
+ return isPlainObject(current) ? current : undefined;
223
+ }
224
+ /**
225
+ * Inline every local `$ref` against the root's `$defs`/`definitions`, because
226
+ * Gemini has no field for either.
227
+ *
228
+ * A `$ref` that cannot be inlined — a cycle, a typo'd pointer, or an external
229
+ * (non-`#/…`) one — is left in place and collected in `unresolved`. It then
230
+ * survives to the wire on purpose: `toGeminiSchema` exempts `$ref` from its
231
+ * `$`-prefix sweep, so Gemini rejects the declaration instead of accepting a node
232
+ * that constrains nothing. The collected pointers are logged, so the developer
233
+ * reads which ref is at fault rather than decoding a provider error about a field
234
+ * they never wrote.
235
+ */
236
+ function inlineRefs(root, node, seen, unresolved) {
237
+ // Substitute *before* descending, so refs nested inside a resolved target are
238
+ // themselves resolved. `seen` carries down that branch only, so the same
239
+ // definition may legitimately appear twice in sibling positions.
240
+ //
241
+ // Loops rather than substituting once, because a target may ITSELF be a `$ref`
242
+ // (an alias chain `A → B → C`). Stopping after one hop leaves a trailing `$ref`
243
+ // that the sweep then deletes, collapsing the property to `{}` — the silent case
244
+ // described above. Every hop joins `visited`, so a chain that turns back on
245
+ // itself terminates instead of expanding forever.
246
+ let current = node;
247
+ let visited = seen;
248
+ let ref = typeof current.$ref === 'string' ? current.$ref : undefined;
249
+ while (ref && !visited.has(ref)) {
250
+ const target = resolvePointer(root, ref);
251
+ if (!target)
252
+ break;
253
+ const { $ref: _dropped } = current, siblings = __rest(current, ["$ref"]);
254
+ current = Object.assign(Object.assign({}, cloneValue(target)), siblings);
255
+ visited = new Set([...visited, ref]);
256
+ ref = typeof current.$ref === 'string' ? current.$ref : undefined;
257
+ }
258
+ if (typeof current.$ref === 'string')
259
+ unresolved.push(current.$ref);
260
+ return mapChildSchemas(current, (child) => inlineRefs(root, child, visited, unresolved), '');
261
+ }
262
+ /**
263
+ * Translate a JSON Schema into the OpenAPI 3.0 subset Gemini's function
264
+ * declarations (and `responseSchema`) actually parse.
265
+ *
266
+ * This runs **unconditionally**, independently of any enforcement opt-in: Gemini
267
+ * constrains tool arguments by default, so the only question here is whether the
268
+ * declaration is *accepted at all*. Left untranslated, a schema with any nullable
269
+ * column is a hard `400 Unknown name "type"` before the model runs.
270
+ *
271
+ * | JSON Schema | Gemini |
272
+ * | --- | --- |
273
+ * | `{"type": ["integer","null"]}` | `{"type": "integer", "nullable": true}` |
274
+ * | `{"anyOf": [{...}, {"type":"null"}]}` | the non-null branch, `nullable: true` |
275
+ * | `{"const": "X"}` | `{"enum": ["X"]}` |
276
+ * | `additionalProperties`, `examples`, `multipleOf` | removed |
277
+ * | `$defs` / `$ref` | inlined, alias chains walked out |
278
+ * | a `$ref` that cannot be inlined | **kept**, so the provider rejects it |
279
+ * | any other `$`-prefixed keyword | removed |
280
+ *
281
+ * A type union that is not simply "T or null" (e.g. `["string","integer"]`) has
282
+ * no OpenAPI equivalent and is left alone, so the provider rejects it rather
283
+ * than us silently picking a branch.
284
+ */
285
+ export function toGeminiSchema(parameters) {
286
+ const unresolved = [];
287
+ const inlined = inlineRefs(parameters, parameters, new Set(), unresolved);
288
+ if (unresolved.length) {
289
+ logger.warn(`GeminiTransport: these \`$ref\` pointers could not be inlined — a cycle, a typo, or an ` +
290
+ `external ref: ${[...new Set(unresolved)].join(', ')}. They are left in the schema, so ` +
291
+ `Gemini will reject this declaration; that is deliberate, because dropping them would ` +
292
+ `send a node that constrains nothing.`);
293
+ }
294
+ const translated = mapSchema(inlined, (node) => {
295
+ // `type: [T, "null"]` → `type: T, nullable: true`
296
+ if (Array.isArray(node.type)) {
297
+ const types = node.type.filter((t) => t !== 'null');
298
+ if (types.length === 1 && node.type.length !== types.length) {
299
+ node.type = types[0];
300
+ node.nullable = true;
301
+ }
302
+ }
303
+ // `anyOf: [X, {type:"null"}]` → X with `nullable: true`
304
+ if (Array.isArray(node.anyOf)) {
305
+ const branches = node.anyOf.filter(isPlainObject);
306
+ const nonNull = branches.filter((b) => b.type !== 'null');
307
+ if (branches.length === 2 && nonNull.length === 1) {
308
+ const { anyOf: _dropped } = node, siblings = __rest(node, ["anyOf"]);
309
+ return Object.assign(Object.assign(Object.assign({}, nonNull[0]), siblings), { nullable: true });
310
+ }
311
+ }
312
+ if ('const' in node) {
313
+ node.enum = [node.const];
314
+ delete node.const;
315
+ }
316
+ for (const keyword of GEMINI_UNSUPPORTED_KEYWORDS)
317
+ delete node[keyword];
318
+ // Anything else `$`-prefixed (`$schema`, `$comment`, `$id`) is an unknown field
319
+ // to Gemini and is dropped. `$ref` is deliberately EXEMPT: one that survives
320
+ // inlining is a cycle, a typo, or an external pointer, and deleting it would
321
+ // leave `{}` — a node Gemini accepts and does not constrain, which is the
322
+ // silent widening this whole module exists to avoid. Left in place, the
323
+ // declaration is rejected outright. Same choice as the genuine multi-type union
324
+ // above: a schema that cannot be translated faithfully must fail rather than
325
+ // quietly admit anything. PR #2449 review.
326
+ for (const key of Object.keys(node)) {
327
+ if (key.startsWith('$') && key !== '$ref')
328
+ delete node[key];
329
+ }
330
+ return node;
331
+ });
332
+ return translated;
333
+ }
@@ -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,383 @@
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, following alias chains (`A → B → C`) to the end |
101
+ | a `$ref` that cannot be inlined | 400 unknown field | **leave it in place** — see below |
102
+ | `$comment`, `$id`, `$schema` | 400 unknown field | strip |
103
+
104
+ A `$ref` survives the translation only when it cannot be resolved at all: a cycle, a typo'd
105
+ pointer, or an external (non-`#/…`) one. That is deliberate. Stripping it — as the other
106
+ `$`-prefixed keywords are stripped — would leave `{}` in its place, and `{}` is a schema Gemini
107
+ accepts and does not constrain, so a tool that asked for a constrained argument would silently get
108
+ an unconstrained one. Leaving the `$ref` in trades a silent hole for the 400 in the row above, and
109
+ the transport logs which pointer is at fault so the provider error does not have to be decoded.
110
+
111
+ Accepted and passed through: `enum`, `format`, `minLength`, `maxLength`, `pattern`, `minimum`,
112
+ `maximum`, `minItems`, `oneOf`, `anyOf`, `default`, `title`, `description`, `nullable`.
113
+
114
+ A type union that is not simply "T or null" (e.g. `["string","integer"]`) has no OpenAPI
115
+ equivalent and is left alone, so the provider rejects it rather than the transport silently
116
+ picking a branch.
117
+
118
+ **The same translation applies to `ChatRequestOptions.responseSchema`**, which reaches Gemini
119
+ through the identical `Schema` type and rejects type unions and `additionalProperties` in exactly
120
+ the same way.
121
+
122
+ ---
123
+
124
+ ## Layer 2 — Envelope
125
+
126
+ The model is running. The question is whether a parseable tool call comes back.
127
+
128
+ ### Gemini
129
+
130
+ Expected:
131
+
132
+ ```jsonc
133
+ {"candidates":[{"content":{"parts":[
134
+ {"functionCall":{"name":"save_contact","args":{"name":"Ada","tier":"PREMIUM","score":91}}}]},
135
+ "finishReason":"STOP"}]}
136
+ ```
137
+
138
+ What sometimes arrives instead:
139
+
140
+ ```jsonc
141
+ {"candidates":[{
142
+ "finishReason":"MALFORMED_FUNCTION_CALL",
143
+ "finishMessage":"print(default_api.save_contact(name = \"Ada\", tier = \"PREMIUM\", score = 91))"
144
+ }]}
145
+ ```
146
+
147
+ No `parts` at all — the whole call is in `finishMessage` as text. Note what is *in* that text:
148
+ `tier` is `"PREMIUM"`, `score` is an integer. **The arguments are correct.** The schema constraint
149
+ held; the serialisation step is what failed. This is why layers 2 and 3 are genuinely independent,
150
+ and why enforcement is no defence against this failure mode.
151
+
152
+ `repairMalformedFunctionCall` (`transports/gemini-malformed-call.ts`) anchors on `default_api.`,
153
+ parses the keyword arguments back out, and hands the transport a normal structured call. It is
154
+ fail-closed: any ambiguity returns `null`, the transport throws `MalformedFunctionCallError`, and
155
+ the caller decides whether to retry.
156
+
157
+ This correlates with forced tool use (`toolChoice: 'required'` or a named tool), which can make
158
+ the model batch several calls into one expression — exactly what the parser refuses. A forced
159
+ single-tool turn is the lowest-risk shape.
160
+
161
+ ### Anthropic
162
+
163
+ No equivalent failure mode. A tool call is a first-class content block, so there is no
164
+ text-to-structure conversion step to fail.
165
+
166
+ ---
167
+
168
+ ## Layer 3 — Payload
169
+
170
+ A well-formed call is being emitted. The only question is whether the argument *values* conform.
171
+
172
+ **Test this adversarially** — instruct the model to violate the schema and inspect what comes
173
+ back. Never infer enforcement from a successful request, and run the negative control: a
174
+ conforming answer only proves enforcement if the same model violates the schema when enforcement
175
+ is off.
176
+
177
+ ### Without enforcement (Anthropic default)
178
+
179
+ Prompted with *"use tier `LEGACY` for grandfathered accounts, and `"n/a"` when the score is
180
+ unknown"*, the model complies:
181
+
182
+ ```jsonc
183
+ "input": {"name":"Ada","tier":"LEGACY","score":"n/a"}
184
+ ```
185
+
186
+ Well-formed JSON, structurally a valid tool call, wrong against the schema. Nothing rejects it.
187
+
188
+ ### With enforcement
189
+
190
+ `enforceSchema: true` compiles the schema into a decoding grammar, so the tokens for `"LEGACY"`
191
+ are unreachable at that position and `score` admits integer digits or `null` and nothing else.
192
+ The model does not "decide to comply" — the alternative is not in the sample space.
193
+
194
+ ### Gemini — enforced, always
195
+
196
+ Constrained decoding is Gemini's default. `enforceSchema` is a no-op there.
197
+
198
+ ### What enforcement constrains, and what it does not
199
+
200
+ | Behaviour | Keywords |
201
+ | --- | --- |
202
+ | **Enforced** | `type`, `enum`, `const`, `required`, object shape, `pattern`, `format` (shape only) |
203
+ | **Accepted, silently ignored** | `maxLength`, `minLength`, `default`, `examples` |
204
+ | **Rejected, droppable** | `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, `multipleOf`, `maxItems`, `uniqueItems`, `minProperties`, `maxProperties`, `minItems` > 1 |
205
+ | **Rejected, not droppable** | `oneOf`, `not` |
206
+ | **Accepted** | `allOf`, `$defs` / `$ref`, `anyOf`, `minItems` of 0 or 1 |
207
+
208
+ Three things worth internalising:
209
+
210
+ **`pattern` and `format` are enforced, and they are *cheaper* than an unconstrained string.** An
211
+ earlier version of this document had them in the ignored row. `format` enforces **shape, not
212
+ semantics** — `format: 'date-time'` reliably produces a well-formed timestamp, and just as
213
+ reliably produced `2023-02-30T12:00:00Z`, a date that does not exist. Calendar validity is a
214
+ validator's job.
215
+
216
+ **`maxLength` guarantees nothing.** Re-tested at bounds 3, 5, 10, 20 and 40 against a
217
+ 62-character literal; all five returned the full 62 characters. It survives in the outbound schema
218
+ as documentation only.
219
+
220
+ **`oneOf` and `not` cannot be stripped.** Deleting `oneOf` leaves `{}`, which matches anything —
221
+ so the transport leaves them in place and warns, letting the request fail loudly rather than
222
+ silently enforcing a weaker schema than the caller wrote. Everything in the droppable row *is*
223
+ removed, with a warning naming each keyword and its JSON Pointer.
224
+
225
+ ---
226
+
227
+ ## Using `enforceSchema`
228
+
229
+ ```ts
230
+ const tool: ChatToolDefinition = { name, description, parameters, enforceSchema: true };
231
+ ```
232
+
233
+ The flag expresses intent — *constrain this tool's arguments to its declared schema* — and each
234
+ transport decides what that means. Provider mechanisms (`strict`, `additionalProperties`,
235
+ `nullable`) never appear in caller-facing types.
236
+
237
+ **It is per-tool, and the provider's compilation is per-tool to match.** Marking one tool does not
238
+ pull the rest of the `tools` array into compilation, and the budgets below count only enforced
239
+ tools. A request carrying one enforced tool alongside 100 unenforced ones with 400 union
240
+ parameters between them is accepted; 17 union parameters *inside enforced tools* is not. So
241
+ enforcing the single tool that matters inside a large surface is both expressible and cheap.
242
+
243
+ **It is off by default,** because enabling it changes which requests are *accepted*, not just how
244
+ the model behaves.
245
+
246
+ **Without it, the two vendors give different guarantees for the same schema** — enforced on
247
+ Gemini, unenforced on Anthropic. Setting it removes a vendor difference rather than introducing
248
+ one.
249
+
250
+ ### The five limits
251
+
252
+ All are inert unless a tool is enforced, and all count enforced tools only.
253
+
254
+ | # | Limit | Value | Scope |
255
+ | --- | --- | --- | --- |
256
+ | **1** | Enforced tools per request | **20** — the API names it explicitly | Per request |
257
+ | **2** | Top-level property *cost* on one tool's schema | Weighted by kind; unconstrained strings fail at **15** | Per enforced tool |
258
+ | **3** | Aggregate property budget | **65** columns in the nested shape; kind-independent | Summed over enforced tools |
259
+ | **4** | Union-typed parameters | **16** — counted **anywhere**, including nested | Summed over enforced tools |
260
+ | **5** | Optional parameters | Own budget (`"too many optional parameters (25)"`), and ruinous well below it | Per enforced tool |
261
+
262
+ **Limit 2 is a cost, not a count.** 14 unconstrained strings pass and 15 fail — but 40
263
+ 20-member enums pass, as do booleans, integers and numbers. Roughly: enum and scalar kinds are
264
+ ~free, `pattern`/`format` strings are moderate, unconstrained strings are expensive. Mixtures
265
+ share the budget, so 14 plain strings alongside 26 `pattern` strings *fails* despite having
266
+ exactly 14 unconstrained strings. **There is no reliable per-kind count to check.**
267
+
268
+ **Limit 2 applies to the top-level object only, and nesting removes it.** 20 flat properties
269
+ fail; the same 20 one level down inside `{ rows: [ … ] }` pass, and that shape reaches 65 before
270
+ limit 3 stops it. A schema generator that flattens nested objects into the top level converts
271
+ working schemas into 400s.
272
+
273
+ **Limit 4 counts both spellings** — `{"type":["integer","null"]}` and `{"anyOf":[…]}` — and counts
274
+ parameters, not tools: 20 union properties inside one enforced tool hits the same wall as 20
275
+ enforced tools with one each.
276
+
277
+ **Limit 5 has no safe workaround.** Expressing a nullable column as *optional* rather than
278
+ `type: [T,"null"]` swaps one budget for a worse-behaved one. There is no third way to say "this
279
+ column may have no value" that the compiler treats more cheaply.
280
+
281
+ ### Two mechanisms, and how to tell which one you hit
282
+
283
+ This is the most useful diagnostic in this document. The limits are not one system:
284
+
285
+ | | Fails in | Which limits | Behaviour |
286
+ | --- | --- | --- | --- |
287
+ | **Count precheck** | **< 1 s** | 1, 3, 4, and 5 above its threshold | Deterministic, cheap, nothing is compiled |
288
+ | **Real compilation** | **10–100 s** | 2, the optional ramp, nesting depth | Can 400, 503, or hang past any client timeout |
289
+
290
+ A sub-second 400 means a precheck counted you out — kind and content are irrelevant, which is why
291
+ limit 3 is exactly 65 columns for every property kind. A slow response of any kind means you are
292
+ compiling and the outcome is not guaranteed.
293
+
294
+ This also explains why the same payload can fail differently on different attempts: schemas near a
295
+ *precheck* boundary fail crisply every time, while schemas near a *compile* boundary land either
296
+ side of a timeout depending on load. Nesting past depth ~25 times out with
297
+ `Grammar compilation timed out.`; past ~30 it stops returning a typed error at all.
298
+
299
+ ### What can be checked before sending
300
+
301
+ Only limits **1** (enforced tools ≤ 20) and **4** (union parameters ≤ 16, counted recursively) are
302
+ exact and safely checkable client-side. Limits 2, 3 and 5 are cost-based or kind-weighted; treat
303
+ them as regions to stay clear of, and surface the provider's error with the enforced tool named
304
+ rather than trying to predict them.
305
+
306
+ ### Compilation is cached — but only on success
307
+
308
+ | | Cached? |
309
+ | --- | --- |
310
+ | A schema that compiles | Yes, ~24 h. First request pays; later identical requests are ~30× faster |
311
+ | A schema that fails | **No.** Every retry pays the full cost again |
312
+
313
+ So a rejected schema that took 40 s to reject will take 40 s again, and a retry policy with
314
+ backoff simply multiplies the wait before delivering the same deterministic error. Do not retry
315
+ compilation failures.
316
+
317
+ **Property kind does not change the ceiling, but it changes compile time several-fold.** At the
318
+ same 64 columns: unconstrained strings **64.6 s**, 20-member enums **9.0 s**. At 60 columns: plain
319
+ 37.6 s, `pattern` 13.9 s, `format` 15.9 s, integer 8.6 s, enum 6.7 s.
320
+
321
+ Practical consequence for anyone generating schemas: **emit the narrowest type the source model
322
+ supports** — `integer`/`number` rather than `string`, `enum` for enumerations, `format` for
323
+ timestamps. Not because it widens anything (it does not), but because each distinct schema pays
324
+ its cold compile once, and with one schema per table that multiplies across a project.
325
+
326
+ ### Model support
327
+
328
+ No model gating is applied. Every model in `SUPPORTED_ANTHROPIC_MODEL_IDS` accepts `strict` and
329
+ enforces it, including `claude-opus-4-7` and `claude-sonnet-4-6`, which Anthropic's own reference
330
+ documentation lists as unsupported. No model was observed to accept the field and ignore it.
331
+
332
+ ### Interaction with prompt caching
333
+
334
+ `strict` and `additionalProperties` are part of the serialised tool definitions, which render
335
+ first in the request. Because the flag lives on the definition rather than the request, it is
336
+ exactly as byte-stable as the tool surface itself — a static definition never toggles, and
337
+ toggling it invalidates any cached prefix covering the tools block (`CachePolicy` scopes
338
+ `'tools'`, `'prompt'`, `'history'`).
339
+
340
+ ---
341
+
342
+ ## Summary
343
+
344
+ | | Anthropic | Gemini |
345
+ | --- | --- | --- |
346
+ | Accepts JSON Schema type unions | Yes | No — translated to `nullable` by the transport |
347
+ | Accepts `additionalProperties` | Yes (**required** when enforcing) | No — stripped by the transport |
348
+ | Enforces argument values | Per tool, via `enforceSchema` | Always |
349
+ | Enforcement scope | Only the tools that opt in | Whole declaration |
350
+ | Compilation limits | Five, enforced tools only | None (no unions to count) |
351
+ | Envelope can fail | No | Yes (`MALFORMED_FUNCTION_CALL`) |
352
+
353
+ The two providers are asymmetric in a way that is easy to get backwards: **Anthropic accepts the
354
+ broader schema dialect but only enforces the tools that ask; Gemini needs the narrower dialect but
355
+ always enforces what it accepts.**
356
+
357
+ ---
358
+
359
+ ## Provenance and shelf life
360
+
361
+ Established by direct API calls on 2026-08-06 and 2026-08-07 against `claude-opus-4-8`,
362
+ `claude-sonnet-5`, `claude-haiku-4-5-20251001`, `claude-opus-4-7`, `claude-sonnet-4-6` and
363
+ `gemini-3.5-flash`, over roughly ten rounds of measurement between two independent investigators
364
+ who repeatedly disagreed. Several conclusions here are the *second or third* answer to their
365
+ question; the reasoning is preserved in the GENC-1480 handoff document if you need to know why a
366
+ particular claim is worded the way it is.
367
+
368
+ Everything about behaviour was proved adversarially — the prompt demanded a schema violation and
369
+ the returned arguments were inspected — with a negative control where a conforming answer could
370
+ otherwise have been the model simply being well-behaved.
371
+
372
+ **The traps that caught us, worth avoiding on a re-measure:**
373
+
374
+ - **Acceptance is not enforcement.** A schema containing `maxLength` returns 200 and ignores it.
375
+ - **When a rule says "X does not count", test with X present in bulk.** Two separate pre-flight
376
+ rules were proposed and retracted because they were validated only against the cheapest kind.
377
+ - **One clean error is not evidence of determinism.** Several shapes returned a typed 400 on one
378
+ run and hung on the next.
379
+ - **Record latency on every probe, including failures.** It is what distinguishes a count precheck
380
+ from a compilation, and status codes alone make the two look identical.
381
+
382
+ The limits, the accepted/ignored/rejected split, and the compile-time figures are all
383
+ 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.9.1",
4
+ "version": "15.10.0",
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.9.1",
56
- "@genesislcap/genx": "15.9.1",
57
- "@genesislcap/rollup-builder": "15.9.1",
58
- "@genesislcap/ts-builder": "15.9.1",
59
- "@genesislcap/uvu-playwright-builder": "15.9.1",
60
- "@genesislcap/vite-builder": "15.9.1",
61
- "@genesislcap/webpack-builder": "15.9.1"
55
+ "@genesislcap/foundation-testing": "15.10.0",
56
+ "@genesislcap/genx": "15.10.0",
57
+ "@genesislcap/rollup-builder": "15.10.0",
58
+ "@genesislcap/ts-builder": "15.10.0",
59
+ "@genesislcap/uvu-playwright-builder": "15.10.0",
60
+ "@genesislcap/vite-builder": "15.10.0",
61
+ "@genesislcap/webpack-builder": "15.10.0"
62
62
  },
63
63
  "dependencies": {
64
- "@genesislcap/foundation-logger": "15.9.1",
65
- "@genesislcap/foundation-utils": "15.9.1",
64
+ "@genesislcap/foundation-logger": "15.10.0",
65
+ "@genesislcap/foundation-utils": "15.10.0",
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": "ebb65f317242acb27f8df7bd88c709f9482e5fe3"
76
+ "gitHead": "83fc356fb2a585ea66bc15458dbd176c8247c68f"
77
77
  }