@openclaw/ai 2026.11.3 → 2026.11.5-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -8
- package/dist/.source-module-urls/fe058cc430242ce2ab0dfbcbe153e240a52cf9c3072c3dc0a73e5f956b6ba49b.json +1 -0
- package/dist/anthropic-DEKgalVg.mjs +182 -0
- package/dist/{anthropic-payload-policy-C0ki72BT.d.mts → anthropic-payload-policy-CXCJ5Pmj.d.mts} +21 -4
- package/dist/{anthropic-stream-reducer-yWDb5Cct.mjs → anthropic-stream-lifecycle-DF2qVvg1.mjs} +845 -649
- package/dist/{anthropic-tool-projection-C2-d1eZ3.d.mts → anthropic-tool-projection-D5DyrL6C.d.mts} +6 -7
- package/dist/{anthropic-tool-projection-DZOKfAmL.mjs → anthropic-tool-projection-dGRfr4iT.mjs} +22 -32
- package/dist/{api-registry-gDt0faai.d.mts → api-registry-DY2MLUyg.d.mts} +2 -2
- package/dist/assistant-output-CD4kY9gu.mjs +16 -0
- package/dist/{azure-openai-responses-BvvXzZbi.mjs → azure-openai-responses-DbQV5RTx.mjs} +47 -53
- package/dist/{cloudflare-Dttf8jKq.mjs → cloudflare-BJ2_Xabx.mjs} +1 -1
- package/dist/{credential-redaction-XvsPf7Yi.d.mts → credential-redaction-DrgndwTJ.d.mts} +5 -3
- package/dist/{deferred-event-buffer-DAvyP7qA.mjs → deferred-event-buffer-tIGkTkTm.mjs} +1 -2
- package/dist/{diagnostics-v7oVEW59.mjs → diagnostics-CloVGQiK.mjs} +27 -20
- package/dist/{diagnostics-DzrF1h4J.mjs → diagnostics-o1PrVNQb.mjs} +11 -4
- package/dist/diagnostics.d.mts +6 -7
- package/dist/diagnostics.mjs +4 -4
- package/dist/{env-api-keys-Xd8dm_aV.mjs → env-api-keys-BuHc86ya.mjs} +1 -26
- package/dist/event-stream-B4ZcSvsu.d.mts +1 -0
- package/dist/{event-stream-CzpE1g_o.d.mts → event-stream-BYmtRe8-.d.mts} +1 -1
- package/dist/event-stream.d.mts +2 -2
- package/dist/event-stream.mjs +1 -2
- package/dist/expect-lbe3Hgrh.mjs +8 -0
- package/dist/{github-copilot-request-facts-F-EmvkpW.mjs → github-copilot-request-facts-BZ_EMo7X.mjs} +1 -1
- package/dist/{google-Cpi_cLKZ.mjs → google-B1g82bn4.mjs} +7 -8
- package/dist/{google-interactions-CGINbsjO.mjs → google-interactions-Ckr0Z99Z.mjs} +243 -269
- package/dist/{google-messages-DQMgG5yG.mjs → google-messages-A-9d3y5V.mjs} +52 -18
- package/dist/{google-provider-stream-BHd0cST9.mjs → google-provider-stream-CNVh4gpm.mjs} +19 -11
- package/dist/{google-shared-vtag8bj5.mjs → google-shared-WNM86ZcW.mjs} +72 -42
- package/dist/{google-vertex-eKoUnW7N.mjs → google-vertex-CXjleC6g.mjs} +3 -3
- package/dist/{google-video-slots-D8tPH8wX.mjs → google-video-slots-Bxt-OXO8.mjs} +1 -1
- package/dist/{host-CWt55nnF.mjs → host-DX7ORpeH.mjs} +46 -39
- package/dist/{host-jJOffdlW.d.mts → host-ccbwPC3A.d.mts} +17 -9
- package/dist/{host-policy-Dm7PM6AD.mjs → host-policy-jCZebuXx.mjs} +2 -2
- package/dist/index-Bczt0MnO.d.mts +17 -0
- package/dist/index.d.mts +8 -7
- package/dist/index.mjs +9 -7
- package/dist/internal/anthropic.d.mts +21 -26
- package/dist/internal/anthropic.mjs +6 -6
- package/dist/internal/google-model-family.mjs +1 -1
- package/dist/internal/google.d.mts +15 -0
- package/dist/internal/google.mjs +1 -0
- package/dist/internal/model-request-body.d.mts +37 -0
- package/dist/internal/model-request-body.mjs +106 -0
- package/dist/internal/openai-completions-compat.d.mts +1 -1
- package/dist/internal/openai-completions-compat.mjs +1 -1
- package/dist/internal/openai-responses-payload-policy.d.mts +2 -2
- package/dist/internal/openai-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.d.mts +14 -12
- package/dist/internal/openai.mjs +11 -10
- package/dist/internal/reasoning-tag-text-partitioner.d.mts +26 -0
- package/dist/{reasoning-tag-text-partitioner-CU9A4Lg8.mjs → internal/reasoning-tag-text-partitioner.mjs} +313 -111
- package/dist/internal/retry-after.d.mts +2 -2
- package/dist/internal/retry-after.mjs +96 -32
- package/dist/internal/runtime.d.mts +15 -41
- package/dist/internal/runtime.mjs +9 -10
- package/dist/internal/shared.d.mts +21 -25
- package/dist/internal/shared.mjs +9 -98
- package/dist/internal/tool-schema.d.mts +10 -10
- package/dist/internal/tool-schema.mjs +4 -4
- package/dist/{llm-request-activity-CfMuh5cC.mjs → llm-request-activity-DzaHoRAU.mjs} +2 -2
- package/dist/mistral-CjHkvsqR.mjs +3741 -0
- package/dist/{openai.LICENSE → mistral.LICENSE} +1 -1
- package/dist/{model-transport-url-BrsjjdjR.d.mts → model-transport-url-BdksnBqu.d.mts} +6 -8
- package/dist/{number-coercion-37gmNkuA.mjs → number-coercion-C7HsBgUL.mjs} +7 -2
- package/dist/observe-async-iterator-AlARO5wS.d.mts +178 -0
- package/dist/observe-async-iterator-DgmegcZR.mjs +181 -0
- package/dist/{openai-chatgpt-responses-BZa3SySh.mjs → openai-chatgpt-responses-CwS5JP7A.mjs} +61 -80
- package/dist/{openai-completions-compat-CBvb2eld.d.mts → openai-completions-compat-CJ-NsDzg.d.mts} +12 -6
- package/dist/{openai-completions-compat-bNQXF1y9.mjs → openai-completions-compat-CstlTQuF.mjs} +74 -50
- package/dist/{openai-completions-CCZ_UHCk.mjs → openai-completions-sj4S-RXQ.mjs} +5 -5
- package/dist/openai-completions-transport-BDAIA0_P.mjs +3406 -0
- package/dist/{openai-prompt-cache-DgjD-UL5.d.mts → openai-prompt-cache-BZGaIWYh.d.mts} +4 -4
- package/dist/{openai-prompt-cache-B9AvdoEo.mjs → openai-prompt-cache-CgDoFhO0.mjs} +5 -4
- package/dist/{openai-responses-compaction-replay-_sUXtcwU.d.mts → openai-responses-compaction-replay-CNHk6k53.d.mts} +4 -4
- package/dist/{openai-responses-contracts-B1nkeLL6.d.mts → openai-responses-contracts-BXMcvO7F.d.mts} +4 -10
- package/dist/{openai-responses-contracts-B5mGAbR6.mjs → openai-responses-contracts-xU-n9AJJ.mjs} +36 -37
- package/dist/{openai-responses-endpoint-CfKR6N5f.mjs → openai-responses-endpoint-DCkURKS0.mjs} +55 -8
- package/dist/openai-responses-ev_c6oTy.mjs +89 -0
- package/dist/{openai-responses-payload-policy-BzM52TTH.d.mts → openai-responses-payload-policy-DyE30gdD.d.mts} +7 -7
- package/dist/{openai-responses-request-lifecycle-CTqHc02t.mjs → openai-responses-request-lifecycle-BuOs0mwI.mjs} +12 -26
- package/dist/{openai-responses-shared-wx9v1MCn.mjs → openai-responses-shared-BmRQnUPP.mjs} +633 -1493
- package/dist/{openai-responses-terminal-usage-CpVjkqn-.d.mts → openai-responses-terminal-usage-D7IhRA6i.d.mts} +9 -3
- package/dist/{openai-tool-schema-BTEU2xmN.mjs → openai-tool-schema-CsoYgnWy.mjs} +97 -122
- package/dist/otel-Buswj0Mf.mjs +766 -0
- package/dist/{overflow-OF3PgPbw.mjs → overflow-CpApyjG2.mjs} +1 -1
- package/dist/{positive-integer-Bb4Evc7L.mjs → positive-integer-DiqE5vNi.mjs} +2 -3
- package/dist/{prompt-cache-stability-D_MeCQFI.mjs → prompt-cache-stability-w-ICeyOI.mjs} +1 -1
- package/dist/{provider-error-qtZD2inE.mjs → provider-error-DD-fo4Rz.mjs} +71 -234
- package/dist/{provider-options-DAzsyi49.d.mts → provider-options-Mo8NM5d1.d.mts} +16 -5
- package/dist/{provider-replay-context-4vxI7p4V.mjs → provider-replay-context-xyU7-CiT.mjs} +2 -2
- package/dist/provider-transcript-transform-DtaxNcC1.mjs +32 -0
- package/dist/{provider-transport-turn-state-D_GjPJHe.mjs → provider-transport-turn-state-BIS8maBK.mjs} +4 -4
- package/dist/{provider-types-CWl4VXvE.d.mts → provider-types-B1e98js5.d.mts} +3 -3
- package/dist/provider-types.d.mts +7 -6
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +26 -29
- package/dist/{record-coerce-CNDovvft.mjs → record-coerce-BQaoiN3r.mjs} +4 -1
- package/dist/request-headers-DO4Mqhw1.mjs +10 -0
- package/dist/{required-api-key-D088S4Cd.mjs → required-api-key-2zZTkmsi.mjs} +1 -1
- package/dist/{retry-after-BrmTv0jL.d.mts → retry-after-DnHBlFS2.d.mts} +21 -1
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/{sanitize-unicode-ZqVLLEKC.d.mts → sanitize-unicode-BISmUlUv.d.mts} +2 -2
- package/dist/{simple-options-xJkqrG_E.mjs → simple-options-tLSeECry.mjs} +108 -82
- package/dist/src-BUsVkrNt.mjs +105 -0
- package/dist/{src-CyA0zJnt.mjs → src-CQ7nH2mL.mjs} +4 -7
- package/dist/stable-stringify-CchQEmeA.mjs +84 -0
- package/dist/{stream-C4YDqhFj.mjs → stream-DrtAWu7c.mjs} +2 -6
- package/dist/{stream-first-event-timeout-D_TfJHRJ.mjs → stream-first-event-timeout-B7RcufAV.mjs} +16 -13
- package/dist/{string-coerce-Cj8sqWHx.mjs → string-coerce-BCuWMIrk.mjs} +1 -1
- package/dist/string-normalization-B8TDDBX_.mjs +32 -0
- package/dist/telemetry-CvK1yQg7.mjs +582 -0
- package/dist/{tool-schema-json-projection-B1sTYwfH.mjs → tool-schema-json-projection-BQpiJlXJ.mjs} +53 -69
- package/dist/{transport-stream-shared-lhgkTOz3.mjs → transport-stream-shared-D2uFMhMc.mjs} +177 -93
- package/dist/{transport-stream-shared-8ru8eX4s.d.mts → transport-stream-shared-D3IAU4jn.d.mts} +29 -15
- package/dist/{transport-utils-DwOpuTjL.mjs → transport-utils-Da_39MYi.mjs} +23 -38
- package/dist/transports.d.mts +42 -39
- package/dist/transports.mjs +215 -296
- package/dist/{types-CVYzKrMl.d.mts → types-BVdTf0YV.d.mts} +38 -3
- package/dist/types-Cb3-5WM9.d.mts +1 -0
- package/dist/{types-BXd0kI8-.mjs → types-OVEWUaDh.mjs} +3 -1
- package/dist/types.d.mts +7 -6
- package/dist/types.mjs +7 -5
- package/dist/{validation-9FSkE8T-.mjs → validation-DGXqfvkj.mjs} +45 -27
- package/dist/{validation-BQ5u20Ru.d.mts → validation-QmyD0E5A.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -2
- package/package.json +40 -6
- package/dist/anthropic-lueA8LUg.mjs +0 -221
- package/dist/assistant-output-BnQm3fov.mjs +0 -47
- package/dist/event-stream-CDpFza-M.d.mts +0 -1
- package/dist/index-DSprYWaz.d.mts +0 -185
- package/dist/mistral-CQ7aoWg2.mjs +0 -512
- package/dist/model-request-body-BD5vy4rP.d.mts +0 -17
- package/dist/openai-CiRi-nVE.mjs +0 -20077
- package/dist/openai-completions-transport-DFvSBbUT.mjs +0 -10881
- package/dist/openai-responses-DQsZKUoI.mjs +0 -87
- package/dist/rolldown-runtime-B4iAMlE-.mjs +0 -35
- package/dist/types-CBJthzJX.d.mts +0 -1
- package/dist/ws.LICENSE +0 -20
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./types-
|
|
1
|
+
import { a as AssistantMessage, at as StreamOptions, gt as Usage, nt as StopReason } from "./types-BVdTf0YV.mjs";
|
|
2
|
+
import "./types-Cb3-5WM9.mjs";
|
|
3
3
|
import OpenAI from "openai";
|
|
4
4
|
//#region packages/ai/src/providers/openai-responses-terminal-usage.d.ts
|
|
5
5
|
/** A known output ceiling can resume sampling after admitted tools have settled. */
|
|
@@ -12,6 +12,10 @@ type ResponsesTerminalUsagePayload = {
|
|
|
12
12
|
input_tokens_details?: {
|
|
13
13
|
cached_tokens?: number | null;
|
|
14
14
|
cache_write_tokens?: number | null;
|
|
15
|
+
cache_write_tokens_details?: {
|
|
16
|
+
ttl_30m_tokens?: number | null;
|
|
17
|
+
ttl_12h_tokens?: number | null;
|
|
18
|
+
} | null;
|
|
15
19
|
} | null;
|
|
16
20
|
output_tokens_details?: {
|
|
17
21
|
reasoning_tokens?: number | null;
|
|
@@ -27,6 +31,8 @@ type ResponsesTerminalUsagePayload = {
|
|
|
27
31
|
* short of what the buckets actually price.
|
|
28
32
|
*/
|
|
29
33
|
declare function mapResponsesTerminalUsage(usage: ResponsesTerminalUsagePayload | undefined | null): Pick<Usage, "input" | "output" | "cacheRead" | "cacheWrite" | "contextUsage" | "totalTokens"> | undefined;
|
|
34
|
+
/** Apply lifetime pricing after base model pricing, before service-tier adjustments. */
|
|
35
|
+
declare function applyResponsesCacheWritePricing(usage: Usage, reported: ResponsesTerminalUsagePayload | undefined | null, promptCacheTtl?: StreamOptions["promptCacheTtl"]): void;
|
|
30
36
|
/** Reasoning tokens are reported by the agent path only; the package path does not track them. */
|
|
31
37
|
declare function readResponsesReasoningTokens(usage: ResponsesTerminalUsagePayload | undefined | null): number | undefined;
|
|
32
38
|
/**
|
|
@@ -44,4 +50,4 @@ declare function resolveResponsesTerminalStopReason(params: {
|
|
|
44
50
|
errorMessage?: string;
|
|
45
51
|
};
|
|
46
52
|
//#endregion
|
|
47
|
-
export {
|
|
53
|
+
export { readResponsesReasoningTokens as a, mapResponsesTerminalUsage as i, applyResponsesCacheWritePricing as n, resolveResponsesTerminalStopReason as o, isResponsesOutputLimitToolCallError as r, ResponsesTerminalUsagePayload as t };
|
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
import { o as isRecord } from "./record-coerce-
|
|
2
|
-
import { r as parseLocalSchemaRefPointer } from "./validation-
|
|
3
|
-
import { r as normalizeLowercaseStringOrEmpty } from "./string-coerce-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { o as isRecord, s as isStringArray } from "./record-coerce-BQaoiN3r.mjs";
|
|
2
|
+
import { r as parseLocalSchemaRefPointer } from "./validation-DGXqfvkj.mjs";
|
|
3
|
+
import { r as normalizeLowercaseStringOrEmpty } from "./string-coerce-BCuWMIrk.mjs";
|
|
4
|
+
import { i as uniqueValues, n as normalizeStringEntries, t as filterStringEntries } from "./string-normalization-B8TDDBX_.mjs";
|
|
5
|
+
import { _ as SCHEMA_ARRAY_KEYS, a as SCHEMA_LITERAL_KEYS, b as SCHEMA_OBJECT_KEYS, c as extendSchemaDefs, f as inheritToolSchemaTruncation, g as wasToolSchemaTruncated, h as truncateToolSchemaDepth, i as publishRuntimeToolInputSchema, l as inlineLocalToolSchemaRefs, o as canPreserveRootSchemaRefs, p as reportToolSchemaTruncation, s as copySchemaMeta$1, t as getPublishedRuntimeToolInputSchema, u as setOwnSchemaProperty, v as SCHEMA_MAP_KEYS, x as walkSchemaValue, y as SCHEMA_NESTED_KEYS } from "./tool-schema-json-projection-BQpiJlXJ.mjs";
|
|
6
6
|
//#region packages/ai/src/providers/openai-function-tool.ts
|
|
7
|
-
|
|
8
|
-
const MAX_DESCRIPTOR_VARIANTS = 8;
|
|
9
|
-
/** Reuse wire descriptors only when their parameter owner published immutable JSON. */
|
|
10
|
-
function prepareOpenAIFunctionTool(name, description, parameters, strict) {
|
|
11
|
-
const published = getPublishedRuntimeToolInputSchema(parameters);
|
|
12
|
-
const variants = published ? preparedTools.get(parameters) : void 0;
|
|
13
|
-
const cached = variants?.find(({ responses }) => responses.name === name && responses.description === description && responses.strict === strict);
|
|
14
|
-
if (cached) return cached;
|
|
7
|
+
function prepareOpenAIFunctionTool(name, description, parameters, strict, mutableParameters = false) {
|
|
15
8
|
const descriptor = {
|
|
16
9
|
name,
|
|
17
10
|
description,
|
|
18
|
-
parameters,
|
|
11
|
+
parameters: mutableParameters && getPublishedRuntimeToolInputSchema(parameters) ? structuredClone(parameters) : parameters,
|
|
19
12
|
...strict !== void 0 ? { strict } : {}
|
|
20
13
|
};
|
|
21
|
-
|
|
14
|
+
return {
|
|
22
15
|
responses: {
|
|
23
16
|
type: "function",
|
|
24
17
|
...descriptor
|
|
@@ -28,14 +21,6 @@ function prepareOpenAIFunctionTool(name, description, parameters, strict) {
|
|
|
28
21
|
function: descriptor
|
|
29
22
|
}
|
|
30
23
|
};
|
|
31
|
-
if (published) {
|
|
32
|
-
Object.freeze(descriptor);
|
|
33
|
-
Object.freeze(result.responses);
|
|
34
|
-
Object.freeze(result.completions);
|
|
35
|
-
Object.freeze(result);
|
|
36
|
-
preparedTools.set(parameters, [result, ...variants ?? []].slice(0, MAX_DESCRIPTOR_VARIANTS));
|
|
37
|
-
}
|
|
38
|
-
return result;
|
|
39
24
|
}
|
|
40
25
|
//#endregion
|
|
41
26
|
//#region packages/ai/src/providers/clean-for-gemini.ts
|
|
@@ -72,12 +57,6 @@ function copySchemaMeta(from, to) {
|
|
|
72
57
|
for (const key of SCHEMA_META_KEYS) if (key in from && from[key] !== void 0) to[key] = from[key];
|
|
73
58
|
return to;
|
|
74
59
|
}
|
|
75
|
-
function cleanGeminiEnumValues(value) {
|
|
76
|
-
if (!Array.isArray(value)) return;
|
|
77
|
-
const values = value.filter((entry) => typeof entry === "string" || typeof entry === "boolean" || typeof entry === "number" && Number.isFinite(entry)).map(String);
|
|
78
|
-
const unique = [...new Set(values)];
|
|
79
|
-
return unique.length > 0 ? unique : void 0;
|
|
80
|
-
}
|
|
81
60
|
function tryFlattenLiteralAnyOf(variants) {
|
|
82
61
|
if (variants.length === 0) return null;
|
|
83
62
|
const allValues = [];
|
|
@@ -107,41 +86,12 @@ function isNullSchema(variant) {
|
|
|
107
86
|
const typeValue = variant.type;
|
|
108
87
|
return typeValue === "null" || Array.isArray(typeValue) && typeValue.length === 1 && typeValue[0] === "null";
|
|
109
88
|
}
|
|
110
|
-
function extendSchemaDefs(defs, schema) {
|
|
111
|
-
const defsEntry = isRecord(schema.$defs) ? schema.$defs : void 0;
|
|
112
|
-
const legacyDefsEntry = isRecord(schema.definitions) ? schema.definitions : void 0;
|
|
113
|
-
if (!defsEntry && !legacyDefsEntry) return defs;
|
|
114
|
-
const next = new Map(defs);
|
|
115
|
-
for (const entry of [defsEntry, legacyDefsEntry]) for (const [key, value] of Object.entries(entry ?? {})) next.set(key, value);
|
|
116
|
-
return next;
|
|
117
|
-
}
|
|
118
89
|
function tryResolveLocalRef(ref, defs) {
|
|
119
90
|
if (!defs) return;
|
|
120
91
|
const tokens = parseLocalSchemaRefPointer(ref);
|
|
121
92
|
const [table, name] = tokens ?? [];
|
|
122
93
|
if (tokens?.length !== 2 || table !== "$defs" && table !== "definitions" || !name) return;
|
|
123
|
-
return defs.get(name);
|
|
124
|
-
}
|
|
125
|
-
function simplifyUnionVariants(params) {
|
|
126
|
-
const { obj, variants } = params;
|
|
127
|
-
const nonNullVariants = variants.filter((variant) => !isNullSchema(variant));
|
|
128
|
-
const stripped = nonNullVariants.length !== variants.length;
|
|
129
|
-
const flattened = tryFlattenLiteralAnyOf(nonNullVariants);
|
|
130
|
-
if (flattened) return {
|
|
131
|
-
kind: "simplified",
|
|
132
|
-
value: copySchemaMeta(obj, flattened)
|
|
133
|
-
};
|
|
134
|
-
if (stripped && nonNullVariants.length === 1) {
|
|
135
|
-
const lone = nonNullVariants[0];
|
|
136
|
-
return {
|
|
137
|
-
kind: "simplified",
|
|
138
|
-
value: isRecord(lone) ? copySchemaMeta(obj, { ...lone }) : lone
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
return {
|
|
142
|
-
kind: "variants",
|
|
143
|
-
value: stripped ? nonNullVariants : variants
|
|
144
|
-
};
|
|
94
|
+
return defs[table].get(name);
|
|
145
95
|
}
|
|
146
96
|
function sanitizeRequiredFields(schema) {
|
|
147
97
|
if (!Array.isArray(schema.required)) return schema;
|
|
@@ -155,14 +105,14 @@ function sanitizeRequiredFields(schema) {
|
|
|
155
105
|
else delete schema.required;
|
|
156
106
|
return schema;
|
|
157
107
|
}
|
|
158
|
-
function
|
|
108
|
+
function cleanSchemaForGeminiWithDefs(schema, defs, refStack, budget, depth = 0) {
|
|
159
109
|
if (depth > 128) {
|
|
160
110
|
budget.truncated = true;
|
|
161
111
|
return {};
|
|
162
112
|
}
|
|
163
|
-
return
|
|
113
|
+
return walkSchemaValue(schema, (obj) => {
|
|
164
114
|
const nextDefs = extendSchemaDefs(defs, obj);
|
|
165
|
-
const visit = (value) => cleanSchemaForGeminiWithDefs(value, nextDefs, refStack,
|
|
115
|
+
const visit = (value) => cleanSchemaForGeminiWithDefs(value, nextDefs, refStack, budget, depth + 1);
|
|
166
116
|
const refValue = typeof obj.$ref === "string" ? obj.$ref : void 0;
|
|
167
117
|
if (refValue) {
|
|
168
118
|
if (refStack?.has(refValue)) return {};
|
|
@@ -170,7 +120,7 @@ function* cleanSchemaForGeminiWithDefs(schema, defs, refStack, ancestors, budget
|
|
|
170
120
|
if (resolved) {
|
|
171
121
|
const nextRefStack = new Set(refStack);
|
|
172
122
|
nextRefStack.add(refValue);
|
|
173
|
-
const cleaned =
|
|
123
|
+
const cleaned = cleanSchemaForGeminiWithDefs(resolved, nextDefs, nextRefStack, budget, depth + 1);
|
|
174
124
|
if (!cleaned || typeof cleaned !== "object" || Array.isArray(cleaned)) return cleaned;
|
|
175
125
|
return copySchemaMeta(obj, { ...cleaned });
|
|
176
126
|
}
|
|
@@ -179,46 +129,49 @@ function* cleanSchemaForGeminiWithDefs(schema, defs, refStack, ancestors, budget
|
|
|
179
129
|
const unions = {};
|
|
180
130
|
for (const key of ["anyOf", "oneOf"]) {
|
|
181
131
|
const variants = obj[key];
|
|
182
|
-
if (Array.isArray(variants))
|
|
183
|
-
const cleaned = [];
|
|
184
|
-
yield walkSchemaArray(variants, visit, cleaned);
|
|
185
|
-
unions[key] = cleaned;
|
|
186
|
-
}
|
|
132
|
+
if (Array.isArray(variants)) unions[key] = variants.map(visit);
|
|
187
133
|
}
|
|
188
134
|
for (const key of ["anyOf", "oneOf"]) {
|
|
189
135
|
const variants = unions[key];
|
|
190
136
|
if (variants) {
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (
|
|
196
|
-
|
|
137
|
+
const nonNullVariants = variants.filter((variant) => !isNullSchema(variant));
|
|
138
|
+
const stripped = nonNullVariants.length !== variants.length;
|
|
139
|
+
const flattened = tryFlattenLiteralAnyOf(nonNullVariants);
|
|
140
|
+
if (flattened) return copySchemaMeta(obj, flattened);
|
|
141
|
+
if (stripped && nonNullVariants.length === 1) {
|
|
142
|
+
const lone = nonNullVariants[0];
|
|
143
|
+
return isRecord(lone) ? copySchemaMeta(obj, { ...lone }) : lone;
|
|
144
|
+
}
|
|
145
|
+
unions[key] = stripped ? nonNullVariants : variants;
|
|
197
146
|
}
|
|
198
147
|
}
|
|
199
148
|
const cleaned = {};
|
|
200
149
|
for (const [key, value] of Object.entries(obj)) {
|
|
201
150
|
if (GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS.has(key)) continue;
|
|
202
151
|
if (key === "const" || key === "enum") {
|
|
203
|
-
const
|
|
204
|
-
if (
|
|
152
|
+
const enumInput = key === "const" ? [value] : value;
|
|
153
|
+
if (Array.isArray(enumInput)) {
|
|
154
|
+
const values = enumInput.filter((entry) => typeof entry === "string" || typeof entry === "boolean" || typeof entry === "number" && Number.isFinite(entry)).map(String);
|
|
155
|
+
const unique = [...new Set(values)];
|
|
156
|
+
if (unique.length > 0) cleaned.enum = unique;
|
|
157
|
+
}
|
|
205
158
|
continue;
|
|
206
159
|
}
|
|
207
160
|
if (key === "required" && Array.isArray(value) && value.length === 0) continue;
|
|
208
161
|
if (key === "type" && (unions.anyOf || unions.oneOf)) continue;
|
|
209
|
-
if (key === "type" &&
|
|
210
|
-
const
|
|
211
|
-
cleaned.type =
|
|
162
|
+
if (key === "type" && isStringArray(value)) {
|
|
163
|
+
const type = value.find((entry) => entry !== "null");
|
|
164
|
+
if (type) cleaned.type = type;
|
|
212
165
|
continue;
|
|
213
166
|
}
|
|
214
167
|
if (key === "properties") {
|
|
215
168
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
216
169
|
const entries = Object.entries(value);
|
|
217
|
-
for (const entry of entries) entry[1] =
|
|
170
|
+
for (const entry of entries) entry[1] = visit(entry[1]);
|
|
218
171
|
cleaned[key] = Object.fromEntries(entries);
|
|
219
172
|
} else cleaned[key] = {};
|
|
220
|
-
} else if ((key === "items" || key === "allOf") && Array.isArray(value)) cleaned[key] =
|
|
221
|
-
else if (key === "items" && value && typeof value === "object") cleaned[key] =
|
|
173
|
+
} else if ((key === "items" || key === "allOf") && Array.isArray(value)) cleaned[key] = value.map(visit);
|
|
174
|
+
else if (key === "items" && value && typeof value === "object") cleaned[key] = visit(value);
|
|
222
175
|
else if ((key === "anyOf" || key === "oneOf") && Array.isArray(value)) cleaned[key] = unions[key];
|
|
223
176
|
else cleaned[key] = value;
|
|
224
177
|
}
|
|
@@ -231,7 +184,7 @@ function* cleanSchemaForGeminiWithDefs(schema, defs, refStack, ancestors, budget
|
|
|
231
184
|
}
|
|
232
185
|
/**
|
|
233
186
|
* Last-resort flattening for anyOf/oneOf arrays that could not be simplified
|
|
234
|
-
* by
|
|
187
|
+
* by the initial union pass. Picks a representative type so the schema is
|
|
235
188
|
* accepted by Google's restricted JSON Schema validation.
|
|
236
189
|
*/
|
|
237
190
|
function flattenUnionFallback(obj, variants) {
|
|
@@ -245,7 +198,7 @@ function flattenUnionFallback(obj, variants) {
|
|
|
245
198
|
function cleanSchemaForGemini(schema, toolName) {
|
|
246
199
|
const budget = { truncated: false };
|
|
247
200
|
const boundedSchema = truncateToolSchemaDepth(schema, toolName);
|
|
248
|
-
const normalized =
|
|
201
|
+
const normalized = cleanSchemaForGeminiWithDefs(boundedSchema, void 0, void 0, budget);
|
|
249
202
|
if (budget.truncated) reportToolSchemaTruncation(schema, toolName);
|
|
250
203
|
return inheritToolSchemaTruncation(boundedSchema, normalized, budget.truncated);
|
|
251
204
|
}
|
|
@@ -314,18 +267,18 @@ function findLlamacppGbnfSchemaViolations(schema, path) {
|
|
|
314
267
|
}
|
|
315
268
|
//#endregion
|
|
316
269
|
//#region packages/ai/src/providers/schema-keyword-strip.ts
|
|
317
|
-
function
|
|
318
|
-
const visit = (value) => stripSchemaKeywords(value, unsupportedKeywords
|
|
319
|
-
return
|
|
270
|
+
function stripSchemaKeywords(schema, unsupportedKeywords) {
|
|
271
|
+
const visit = (value) => stripSchemaKeywords(value, unsupportedKeywords);
|
|
272
|
+
return walkSchemaValue(schema, (obj) => {
|
|
320
273
|
const cleaned = {};
|
|
321
274
|
for (const [key, value] of Object.entries(obj)) {
|
|
322
275
|
if (unsupportedKeywords.has(key)) continue;
|
|
323
276
|
if (SCHEMA_MAP_KEYS.has(key) && value && typeof value === "object" && !Array.isArray(value)) {
|
|
324
277
|
const entries = Object.entries(value);
|
|
325
|
-
for (const entry of entries) entry[1] =
|
|
278
|
+
for (const entry of entries) if (key !== "dependencies" || !Array.isArray(entry[1])) entry[1] = visit(entry[1]);
|
|
326
279
|
cleaned[key] = Object.fromEntries(entries);
|
|
327
|
-
} else if (SCHEMA_ARRAY_KEYS.has(key) && Array.isArray(value)) cleaned[key] =
|
|
328
|
-
else if (SCHEMA_OBJECT_KEYS.has(key) && value && typeof value === "object") cleaned[key] =
|
|
280
|
+
} else if (SCHEMA_ARRAY_KEYS.has(key) && Array.isArray(value)) cleaned[key] = value.map(visit);
|
|
281
|
+
else if (SCHEMA_OBJECT_KEYS.has(key) && value && typeof value === "object") cleaned[key] = visit(value);
|
|
329
282
|
else cleaned[key] = value;
|
|
330
283
|
}
|
|
331
284
|
return cleaned;
|
|
@@ -334,11 +287,16 @@ function* stripSchemaKeywords(schema, unsupportedKeywords, ancestors) {
|
|
|
334
287
|
/** Remove schema keywords unsupported by a target provider/tool surface. */
|
|
335
288
|
function stripUnsupportedSchemaKeywords(schema, unsupportedKeywords) {
|
|
336
289
|
const bounded = truncateToolSchemaDepth(schema);
|
|
337
|
-
return inheritToolSchemaTruncation(bounded,
|
|
290
|
+
return inheritToolSchemaTruncation(bounded, stripSchemaKeywords(bounded, unsupportedKeywords));
|
|
338
291
|
}
|
|
339
292
|
//#endregion
|
|
340
293
|
//#region packages/ai/src/providers/tool-schema-normalization-cache.ts
|
|
341
294
|
let preparedSchemas;
|
|
295
|
+
/** Request preparation already detached and depth-bounded these schemas. */
|
|
296
|
+
function isPreparedToolSchemaNormalization(schema) {
|
|
297
|
+
return schema !== null && typeof schema === "object" && preparedSchemas?.has(schema) === true;
|
|
298
|
+
}
|
|
299
|
+
const MAX_CACHE_ENTRIES_PER_SCHEMA = 8;
|
|
342
300
|
/** Only synchronous conversion owns these fresh projections; no facts survive its return. */
|
|
343
301
|
function withPreparedToolSchemaNormalization(schemas, convert) {
|
|
344
302
|
const previous = preparedSchemas;
|
|
@@ -349,7 +307,7 @@ function withPreparedToolSchemaNormalization(schemas, convert) {
|
|
|
349
307
|
preparedSchemas = previous;
|
|
350
308
|
}
|
|
351
309
|
}
|
|
352
|
-
function createBoundedSchemaCache(
|
|
310
|
+
function createBoundedSchemaCache() {
|
|
353
311
|
const schemas = /* @__PURE__ */ new WeakMap();
|
|
354
312
|
return {
|
|
355
313
|
get(source, key) {
|
|
@@ -360,15 +318,15 @@ function createBoundedSchemaCache(maxEntries) {
|
|
|
360
318
|
schemas.set(source, [{
|
|
361
319
|
key,
|
|
362
320
|
value
|
|
363
|
-
}, ...entries.filter((entry) => entry.key !== key)].slice(0,
|
|
321
|
+
}, ...entries.filter((entry) => entry.key !== key)].slice(0, MAX_CACHE_ENTRIES_PER_SCHEMA));
|
|
364
322
|
return value;
|
|
365
323
|
}
|
|
366
324
|
};
|
|
367
325
|
}
|
|
368
326
|
/** Prepared variants cannot evict direct callers' identity-preserving cache entries. */
|
|
369
|
-
function createToolSchemaNormalizationCache(
|
|
370
|
-
const directCache = createBoundedSchemaCache(
|
|
371
|
-
const preparedCache = createBoundedSchemaCache(
|
|
327
|
+
function createToolSchemaNormalizationCache() {
|
|
328
|
+
const directCache = createBoundedSchemaCache();
|
|
329
|
+
const preparedCache = createBoundedSchemaCache();
|
|
372
330
|
return {
|
|
373
331
|
get(source, key) {
|
|
374
332
|
const prepared = preparedSchemas?.get(source);
|
|
@@ -441,6 +399,7 @@ function inferUnionBranchType(schema) {
|
|
|
441
399
|
]) if (keywords.some((key) => key in schema)) types.add(type);
|
|
442
400
|
return types.size === 1 ? types.values().next().value : void 0;
|
|
443
401
|
}
|
|
402
|
+
const publishedNormalizations = createToolSchemaNormalizationCache();
|
|
444
403
|
function normalizeToolSchemaRecursive(schema, profile, depth = 0, inferBranchType = false) {
|
|
445
404
|
const mapProfile = profile === "strict-map" ? "strict" : profile === "compat-map" ? "compat" : profile === "openapi-map" ? "openapi" : profile === "moonshot-map" ? "moonshot" : void 0;
|
|
446
405
|
if (Array.isArray(schema)) {
|
|
@@ -560,9 +519,16 @@ function normalizeToolSchemaRecursive(schema, profile, depth = 0, inferBranchTyp
|
|
|
560
519
|
}
|
|
561
520
|
return changed ? normalized : schema;
|
|
562
521
|
}
|
|
563
|
-
function normalizeToolSchema(schema, profile) {
|
|
564
|
-
const
|
|
565
|
-
|
|
522
|
+
function normalizeToolSchema(schema, profile, toolName) {
|
|
523
|
+
const source = schema && typeof schema === "object" && getPublishedRuntimeToolInputSchema(schema) ? schema : void 0;
|
|
524
|
+
if (source) {
|
|
525
|
+
if (wasToolSchemaTruncated(source)) reportToolSchemaTruncation(source, toolName);
|
|
526
|
+
const cached = publishedNormalizations.get(source, profile);
|
|
527
|
+
if (cached !== void 0) return cached;
|
|
528
|
+
}
|
|
529
|
+
const bounded = source ?? truncateToolSchemaDepth(schema, toolName);
|
|
530
|
+
const normalized = inheritToolSchemaTruncation(bounded, normalizeToolSchemaRecursive(bounded, profile));
|
|
531
|
+
return source ? publishedNormalizations.remember(source, profile, normalized) : normalized;
|
|
566
532
|
}
|
|
567
533
|
//#endregion
|
|
568
534
|
//#region packages/ai/src/providers/agent-tools-parameter-schema.ts
|
|
@@ -589,10 +555,7 @@ function resolveUnsupportedToolSchemaKeywords(modelOrCompat) {
|
|
|
589
555
|
function shouldOmitEmptyArrayItems(modelOrCompat) {
|
|
590
556
|
return extractToolSchemaModelCompat(modelOrCompat)?.omitEmptyArrayItems === true;
|
|
591
557
|
}
|
|
592
|
-
const toolParameterSchemaCache = createToolSchemaNormalizationCache(
|
|
593
|
-
function isGeminiModelId(modelId) {
|
|
594
|
-
return /(?:^|[/:])gemini(?:$|[-/:.])/.test(modelId);
|
|
595
|
-
}
|
|
558
|
+
const toolParameterSchemaCache = createToolSchemaNormalizationCache();
|
|
596
559
|
function extractEnumValues(schema, requireAllVariants = false) {
|
|
597
560
|
if (!schema || typeof schema !== "object") return;
|
|
598
561
|
const record = schema;
|
|
@@ -636,11 +599,11 @@ function mergePropertySchemas(existing, incoming, allowUnconstrainedString) {
|
|
|
636
599
|
]) if (!(key in merged) && key in record) merged[key] = record[key];
|
|
637
600
|
}
|
|
638
601
|
if (allowUnconstrainedString) {
|
|
639
|
-
if (existingEnum
|
|
602
|
+
if (isStringArray(existingEnum) && isUnconstrainedStringSchema(incoming)) return {
|
|
640
603
|
...incoming,
|
|
641
604
|
...merged
|
|
642
605
|
};
|
|
643
|
-
if (incomingEnum
|
|
606
|
+
if (isStringArray(incomingEnum) && isUnconstrainedStringSchema(existing)) return {
|
|
644
607
|
...existing,
|
|
645
608
|
...merged
|
|
646
609
|
};
|
|
@@ -696,9 +659,9 @@ function normalizeArraySchemaItems(schema, mode) {
|
|
|
696
659
|
}
|
|
697
660
|
/** Return a provider-compatible JSON schema for a model-facing tool. */
|
|
698
661
|
function normalizeToolParameterSchema(schema, options) {
|
|
699
|
-
const
|
|
700
|
-
const boundedSchema =
|
|
701
|
-
if (
|
|
662
|
+
const prepared = getPublishedRuntimeToolInputSchema(schema) || isPreparedToolSchemaNormalization(schema);
|
|
663
|
+
const boundedSchema = prepared ? schema : truncateToolSchemaDepth(schema, options?.toolName);
|
|
664
|
+
if (prepared && wasToolSchemaTruncated(schema)) reportToolSchemaTruncation(schema, options?.toolName);
|
|
702
665
|
const normalizedProvider = normalizeLowercaseStringOrEmpty(options?.modelProvider);
|
|
703
666
|
const normalizedModelId = normalizeLowercaseStringOrEmpty(options?.modelId);
|
|
704
667
|
const normalizedToolSchemaProfile = normalizeLowercaseStringOrEmpty(options?.modelCompat?.toolSchemaProfile);
|
|
@@ -719,7 +682,7 @@ function normalizeToolParameterSchema(schema, options) {
|
|
|
719
682
|
return cached;
|
|
720
683
|
}
|
|
721
684
|
}
|
|
722
|
-
const isGeminiProvider = normalizedProvider.includes("google") || normalizedProvider.includes("gemini") ||
|
|
685
|
+
const isGeminiProvider = normalizedProvider.includes("google") || normalizedProvider.includes("gemini") || /(?:^|[/:])gemini(?:$|[-/:.])/.test(normalizedModelId) || normalizedToolSchemaProfile === "gemini";
|
|
723
686
|
const isAnthropicProvider = normalizedProvider.includes("anthropic");
|
|
724
687
|
const isLlamacppGbnfProfile = normalizedToolSchemaProfile === "llamacpp";
|
|
725
688
|
const inlinedSchema = normalizeToolSchema(normalizedProvider === "openai" && !isGeminiProvider && !isLlamacppGbnfProfile && ![
|
|
@@ -780,13 +743,13 @@ function normalizeToolParameterSchema(schema, options) {
|
|
|
780
743
|
}
|
|
781
744
|
}
|
|
782
745
|
for (const [key, alternatives] of propertyAlternatives) {
|
|
783
|
-
const allowUnconstrainedString = !Object.hasOwn(rootProperties, key) && alternatives.every((alternative) => isUnconstrainedStringSchema(alternative) || extractEnumValues(alternative, true)
|
|
746
|
+
const allowUnconstrainedString = !Object.hasOwn(rootProperties, key) && alternatives.every((alternative) => isUnconstrainedStringSchema(alternative) || isStringArray(extractEnumValues(alternative, true)));
|
|
784
747
|
let merged = Object.hasOwn(mergedProperties, key) ? mergedProperties[key] : void 0;
|
|
785
748
|
for (const alternative of alternatives) merged = mergePropertySchemas(merged, alternative, allowUnconstrainedString);
|
|
786
749
|
setOwnSchemaProperty(mergedProperties, key, merged);
|
|
787
750
|
}
|
|
788
|
-
const baseRequired =
|
|
789
|
-
const mergedRequired = baseRequired
|
|
751
|
+
const baseRequired = filterStringEntries(schemaRecord.required);
|
|
752
|
+
const mergedRequired = baseRequired.length > 0 ? baseRequired : objectVariants > 0 ? Array.from(requiredCounts.entries()).filter(([, count]) => count === objectVariants).map(([key]) => key) : void 0;
|
|
790
753
|
return applyProviderCleaning({
|
|
791
754
|
type: "object",
|
|
792
755
|
...typeof schemaRecord.title === "string" ? { title: schemaRecord.title } : {},
|
|
@@ -799,8 +762,23 @@ function normalizeToolParameterSchema(schema, options) {
|
|
|
799
762
|
//#endregion
|
|
800
763
|
//#region packages/ai/src/providers/openai-tool-schema-compat.ts
|
|
801
764
|
/** Repairs recoverable OpenAI tool-schema shapes before canonical normalization. */
|
|
802
|
-
function normalizeOpenAIStrictCompatSchema(schema) {
|
|
803
|
-
return normalizeToolSchema(schema, "compat");
|
|
765
|
+
function normalizeOpenAIStrictCompatSchema(schema, toolName) {
|
|
766
|
+
return normalizeToolSchema(schema, "compat", toolName);
|
|
767
|
+
}
|
|
768
|
+
/** Finds nested open dictionaries whose keys compatibility normalization closes. */
|
|
769
|
+
function findCompatClosedObjectPaths(schema, path) {
|
|
770
|
+
return collectCompatClosedObjectPaths(truncateToolSchemaDepth(schema), path);
|
|
771
|
+
}
|
|
772
|
+
function collectCompatClosedObjectPaths(schema, path, nested = false) {
|
|
773
|
+
if (Array.isArray(schema)) return schema.flatMap((entry, index) => collectCompatClosedObjectPaths(entry, `${path}[${index}]`, true));
|
|
774
|
+
if (!isRecord(schema)) return [];
|
|
775
|
+
const violations = nested && schema.type === "object" && !("additionalProperties" in schema) && (!isRecord(schema.patternProperties) || Object.keys(schema.patternProperties).length === 0) && (!("properties" in schema) || isRecord(schema.properties) && Object.keys(schema.properties).length === 0) ? [path] : [];
|
|
776
|
+
for (const key of SCHEMA_MAP_KEYS) {
|
|
777
|
+
const map = schema[key];
|
|
778
|
+
if (isRecord(map)) for (const [name, child] of Object.entries(map)) violations.push(...collectCompatClosedObjectPaths(child, `${path}.${key}.${name}`, true));
|
|
779
|
+
}
|
|
780
|
+
for (const key of SCHEMA_NESTED_KEYS) violations.push(...collectCompatClosedObjectPaths(schema[key], `${path}.${key}`, true));
|
|
781
|
+
return violations;
|
|
804
782
|
}
|
|
805
783
|
/**
|
|
806
784
|
* Returns whether a regex pattern contains a lookahead or lookbehind group.
|
|
@@ -860,26 +838,23 @@ function collectStrictSchemaViolations(schema, path, options) {
|
|
|
860
838
|
}
|
|
861
839
|
//#endregion
|
|
862
840
|
//#region packages/ai/src/providers/openai-tool-schema.ts
|
|
863
|
-
const strictOpenAISchemaCache = createToolSchemaNormalizationCache(
|
|
841
|
+
const strictOpenAISchemaCache = createToolSchemaNormalizationCache();
|
|
864
842
|
const publishedStrictCompatibility = /* @__PURE__ */ new WeakMap();
|
|
865
843
|
function resolveToolSchemaModelCompat(compat) {
|
|
866
844
|
if (!compat) return;
|
|
867
|
-
const unsupportedToolSchemaKeywords =
|
|
845
|
+
const unsupportedToolSchemaKeywords = filterStringEntries(compat.unsupportedToolSchemaKeywords);
|
|
868
846
|
if (unsupportedToolSchemaKeywords.length === 0 && compat.omitEmptyArrayItems !== true) return;
|
|
869
847
|
return {
|
|
870
848
|
...unsupportedToolSchemaKeywords.length > 0 ? { unsupportedToolSchemaKeywords } : {},
|
|
871
849
|
...compat.omitEmptyArrayItems === true ? { omitEmptyArrayItems: true } : {}
|
|
872
850
|
};
|
|
873
851
|
}
|
|
874
|
-
function resolveStrictOpenAISchemaCacheKey(modelCompat) {
|
|
875
|
-
const compat = resolveToolSchemaModelCompat(modelCompat);
|
|
876
|
-
return JSON.stringify([[...compat?.unsupportedToolSchemaKeywords ?? []].toSorted(), shouldOmitEmptyArrayItems(compat)]);
|
|
877
|
-
}
|
|
878
852
|
/** Normalizes a tool parameter schema into the OpenAI strict JSON-schema subset. */
|
|
879
853
|
function normalizeStrictOpenAIJsonSchema(schema, modelCompat) {
|
|
880
854
|
const schemaInput = schema ?? {};
|
|
881
855
|
const cacheable = typeof schemaInput === "object";
|
|
882
|
-
const
|
|
856
|
+
const cacheCompat = cacheable ? resolveToolSchemaModelCompat(modelCompat) : void 0;
|
|
857
|
+
const cacheKey = cacheable ? JSON.stringify([[...cacheCompat?.unsupportedToolSchemaKeywords ?? []].toSorted(), shouldOmitEmptyArrayItems(cacheCompat)]) : "";
|
|
883
858
|
if (cacheable) {
|
|
884
859
|
const cached = strictOpenAISchemaCache.get(schemaInput, cacheKey);
|
|
885
860
|
if (cached !== void 0) return cached;
|
|
@@ -924,4 +899,4 @@ function resolveOpenAIProjectedToolsStrictToolFlag(projection, strict) {
|
|
|
924
899
|
return projection.tools.every((tool) => isStrictOpenAIJsonSchemaCompatible(tool.parameters));
|
|
925
900
|
}
|
|
926
901
|
//#endregion
|
|
927
|
-
export {
|
|
902
|
+
export { cleanSchemaForLlamacppGbnf as _, resolveOpenAIProjectedToolsStrictToolFlag as a, cleanSchemaForGemini as b, normalizeOpenAIStrictCompatSchema as c, resolveUnsupportedToolSchemaKeywords as d, shouldOmitEmptyArrayItems as f, LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD as g, stripUnsupportedSchemaKeywords as h, normalizeStrictOpenAIJsonSchema as i, extractToolSchemaModelCompat as l, withPreparedToolSchemaNormalization as m, isStrictOpenAIJsonSchemaCompatible as n, findCompatClosedObjectPaths as o, normalizeToolSchema as p, normalizeOpenAIStrictToolParameters as r, findOpenAIStrictSchemaViolations as s, findOpenAIStrictToolProjectionDiagnostics as t, normalizeToolParameterSchema as u, findLlamacppGbnfSchemaViolations as v, prepareOpenAIFunctionTool as x, GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS as y };
|