@silupanda/schema-bridge 0.2.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 +750 -0
- package/dist/__tests__/anthropic.test.d.ts +2 -0
- package/dist/__tests__/anthropic.test.d.ts.map +1 -0
- package/dist/__tests__/anthropic.test.js +183 -0
- package/dist/__tests__/anthropic.test.js.map +1 -0
- package/dist/__tests__/gemini.test.d.ts +2 -0
- package/dist/__tests__/gemini.test.d.ts.map +1 -0
- package/dist/__tests__/gemini.test.js +177 -0
- package/dist/__tests__/gemini.test.js.map +1 -0
- package/dist/__tests__/integration.test.d.ts +2 -0
- package/dist/__tests__/integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration.test.js +513 -0
- package/dist/__tests__/integration.test.js.map +1 -0
- package/dist/__tests__/normalizer.test.d.ts +2 -0
- package/dist/__tests__/normalizer.test.d.ts.map +1 -0
- package/dist/__tests__/normalizer.test.js +349 -0
- package/dist/__tests__/normalizer.test.js.map +1 -0
- package/dist/__tests__/openai.test.d.ts +2 -0
- package/dist/__tests__/openai.test.d.ts.map +1 -0
- package/dist/__tests__/openai.test.js +473 -0
- package/dist/__tests__/openai.test.js.map +1 -0
- package/dist/__tests__/providers.test.d.ts +2 -0
- package/dist/__tests__/providers.test.d.ts.map +1 -0
- package/dist/__tests__/providers.test.js +187 -0
- package/dist/__tests__/providers.test.js.map +1 -0
- package/dist/__tests__/tool.test.d.ts +2 -0
- package/dist/__tests__/tool.test.d.ts.map +1 -0
- package/dist/__tests__/tool.test.js +212 -0
- package/dist/__tests__/tool.test.js.map +1 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +81 -0
- package/dist/index.js.map +1 -0
- package/dist/normalizer.d.ts +24 -0
- package/dist/normalizer.d.ts.map +1 -0
- package/dist/normalizer.js +263 -0
- package/dist/normalizer.js.map +1 -0
- package/dist/providers/anthropic.d.ts +7 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +109 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/cohere.d.ts +8 -0
- package/dist/providers/cohere.d.ts.map +1 -0
- package/dist/providers/cohere.js +63 -0
- package/dist/providers/cohere.js.map +1 -0
- package/dist/providers/gemini.d.ts +10 -0
- package/dist/providers/gemini.d.ts.map +1 -0
- package/dist/providers/gemini.js +160 -0
- package/dist/providers/gemini.js.map +1 -0
- package/dist/providers/index.d.ts +17 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +51 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/mcp.d.ts +8 -0
- package/dist/providers/mcp.d.ts.map +1 -0
- package/dist/providers/mcp.js +18 -0
- package/dist/providers/mcp.js.map +1 -0
- package/dist/providers/ollama.d.ts +8 -0
- package/dist/providers/ollama.d.ts.map +1 -0
- package/dist/providers/ollama.js +63 -0
- package/dist/providers/ollama.js.map +1 -0
- package/dist/providers/openai.d.ts +10 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +309 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/tool.d.ts +19 -0
- package/dist/tool.d.ts.map +1 -0
- package/dist/tool.js +120 -0
- package/dist/tool.js.map +1 -0
- package/dist/types.d.ts +143 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +32 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertToOpenAI = convertToOpenAI;
|
|
4
|
+
exports.wrapOpenAIResponseFormat = wrapOpenAIResponseFormat;
|
|
5
|
+
const normalizer_1 = require("../normalizer");
|
|
6
|
+
/**
|
|
7
|
+
* Keywords that OpenAI strict mode does not support.
|
|
8
|
+
*/
|
|
9
|
+
const UNSUPPORTED_KEYWORDS = [
|
|
10
|
+
'minimum', 'maximum', 'exclusiveMinimum', 'exclusiveMaximum',
|
|
11
|
+
'multipleOf', 'minLength', 'maxLength', 'minItems', 'maxItems',
|
|
12
|
+
'pattern', 'format', 'default', 'examples', '$comment',
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* Convert a JSON Schema to OpenAI's structured output format.
|
|
16
|
+
*/
|
|
17
|
+
function convertToOpenAI(schema, options) {
|
|
18
|
+
const strict = options?.strict !== false;
|
|
19
|
+
const transformations = [];
|
|
20
|
+
const warnings = [];
|
|
21
|
+
let result = (0, normalizer_1.deepClone)(schema);
|
|
22
|
+
if (strict) {
|
|
23
|
+
// Inject additionalProperties: false on all objects
|
|
24
|
+
result = injectAdditionalProperties(result, '$', transformations);
|
|
25
|
+
// Expand required to include all properties; make optional fields nullable
|
|
26
|
+
result = expandRequired(result, '$', transformations);
|
|
27
|
+
// Remove unsupported keywords
|
|
28
|
+
result = removeUnsupportedKeywords(result, '$', transformations, warnings, options);
|
|
29
|
+
// Simplify composition keywords
|
|
30
|
+
result = simplifyComposition(result, '$', transformations, warnings);
|
|
31
|
+
}
|
|
32
|
+
return { schema: result, transformations, warnings };
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Wrap a converted schema in OpenAI's response_format envelope.
|
|
36
|
+
*/
|
|
37
|
+
function wrapOpenAIResponseFormat(schema, name, strict = true) {
|
|
38
|
+
return {
|
|
39
|
+
type: 'json_schema',
|
|
40
|
+
json_schema: {
|
|
41
|
+
name,
|
|
42
|
+
schema,
|
|
43
|
+
strict,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function injectAdditionalProperties(node, path, transformations) {
|
|
48
|
+
const result = { ...node };
|
|
49
|
+
const isObject = result.type === 'object' || result.properties !== undefined;
|
|
50
|
+
if (isObject) {
|
|
51
|
+
if (result.additionalProperties === undefined || result.additionalProperties === true) {
|
|
52
|
+
const prev = result.additionalProperties;
|
|
53
|
+
result.additionalProperties = false;
|
|
54
|
+
transformations.push({
|
|
55
|
+
type: 'ADDITIONAL_PROPERTIES_INJECTED',
|
|
56
|
+
path,
|
|
57
|
+
message: `Set additionalProperties to false (was ${prev === undefined ? 'undefined' : 'true'})`,
|
|
58
|
+
lossy: false,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else if (typeof result.additionalProperties === 'object') {
|
|
62
|
+
result.additionalProperties = false;
|
|
63
|
+
transformations.push({
|
|
64
|
+
type: 'ADDITIONAL_PROPERTIES_INJECTED',
|
|
65
|
+
path,
|
|
66
|
+
message: 'Replaced additionalProperties schema with false (lossy)',
|
|
67
|
+
lossy: true,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (result.properties) {
|
|
72
|
+
const newProps = {};
|
|
73
|
+
for (const [key, prop] of Object.entries(result.properties)) {
|
|
74
|
+
newProps[key] = injectAdditionalProperties(prop, `${path}.properties.${key}`, transformations);
|
|
75
|
+
}
|
|
76
|
+
result.properties = newProps;
|
|
77
|
+
}
|
|
78
|
+
if (result.items && !Array.isArray(result.items)) {
|
|
79
|
+
result.items = injectAdditionalProperties(result.items, `${path}.items`, transformations);
|
|
80
|
+
}
|
|
81
|
+
if (result.anyOf) {
|
|
82
|
+
result.anyOf = result.anyOf.map((s, i) => injectAdditionalProperties(s, `${path}.anyOf[${i}]`, transformations));
|
|
83
|
+
}
|
|
84
|
+
if (result.oneOf) {
|
|
85
|
+
result.oneOf = result.oneOf.map((s, i) => injectAdditionalProperties(s, `${path}.oneOf[${i}]`, transformations));
|
|
86
|
+
}
|
|
87
|
+
if (result.allOf) {
|
|
88
|
+
result.allOf = result.allOf.map((s, i) => injectAdditionalProperties(s, `${path}.allOf[${i}]`, transformations));
|
|
89
|
+
}
|
|
90
|
+
if (result.$defs) {
|
|
91
|
+
const newDefs = {};
|
|
92
|
+
for (const [key, def] of Object.entries(result.$defs)) {
|
|
93
|
+
newDefs[key] = injectAdditionalProperties(def, `${path}.$defs.${key}`, transformations);
|
|
94
|
+
}
|
|
95
|
+
result.$defs = newDefs;
|
|
96
|
+
}
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
function expandRequired(node, path, transformations) {
|
|
100
|
+
const result = { ...node };
|
|
101
|
+
if (result.properties) {
|
|
102
|
+
const required = new Set(result.required || []);
|
|
103
|
+
const newProps = {};
|
|
104
|
+
for (const [key, prop] of Object.entries(result.properties)) {
|
|
105
|
+
let processed = expandRequired(prop, `${path}.properties.${key}`, transformations);
|
|
106
|
+
if (!required.has(key)) {
|
|
107
|
+
required.add(key);
|
|
108
|
+
processed = makeNullable(processed);
|
|
109
|
+
transformations.push({
|
|
110
|
+
type: 'REQUIRED_EXPANDED',
|
|
111
|
+
path: `${path}.properties.${key}`,
|
|
112
|
+
message: `Added "${key}" to required array and made nullable`,
|
|
113
|
+
lossy: false,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
newProps[key] = processed;
|
|
117
|
+
}
|
|
118
|
+
result.properties = newProps;
|
|
119
|
+
result.required = Array.from(required);
|
|
120
|
+
}
|
|
121
|
+
if (result.items && !Array.isArray(result.items)) {
|
|
122
|
+
result.items = expandRequired(result.items, `${path}.items`, transformations);
|
|
123
|
+
}
|
|
124
|
+
if (result.anyOf) {
|
|
125
|
+
result.anyOf = result.anyOf.map((s, i) => expandRequired(s, `${path}.anyOf[${i}]`, transformations));
|
|
126
|
+
}
|
|
127
|
+
if (result.$defs) {
|
|
128
|
+
const newDefs = {};
|
|
129
|
+
for (const [key, def] of Object.entries(result.$defs)) {
|
|
130
|
+
newDefs[key] = expandRequired(def, `${path}.$defs.${key}`, transformations);
|
|
131
|
+
}
|
|
132
|
+
result.$defs = newDefs;
|
|
133
|
+
}
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
function makeNullable(schema) {
|
|
137
|
+
const result = { ...schema };
|
|
138
|
+
// Already nullable
|
|
139
|
+
if (Array.isArray(result.type) && result.type.includes('null')) {
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
if (result.anyOf) {
|
|
143
|
+
// Check if already has null option
|
|
144
|
+
const hasNull = result.anyOf.some(s => s.type === 'null');
|
|
145
|
+
if (!hasNull) {
|
|
146
|
+
result.anyOf = [...result.anyOf, { type: 'null' }];
|
|
147
|
+
}
|
|
148
|
+
return result;
|
|
149
|
+
}
|
|
150
|
+
if (result.oneOf) {
|
|
151
|
+
const hasNull = result.oneOf.some(s => s.type === 'null');
|
|
152
|
+
if (!hasNull) {
|
|
153
|
+
result.oneOf = [...result.oneOf, { type: 'null' }];
|
|
154
|
+
}
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
if (typeof result.type === 'string') {
|
|
158
|
+
result.type = [result.type, 'null'];
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
if (Array.isArray(result.type)) {
|
|
162
|
+
if (!result.type.includes('null')) {
|
|
163
|
+
result.type = [...result.type, 'null'];
|
|
164
|
+
}
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
167
|
+
// No type specified, wrap in anyOf with null
|
|
168
|
+
return {
|
|
169
|
+
anyOf: [result, { type: 'null' }],
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function removeUnsupportedKeywords(node, path, transformations, warnings, options) {
|
|
173
|
+
const result = { ...node };
|
|
174
|
+
const promote = options?.promoteConstraintsToDescription ?? false;
|
|
175
|
+
for (const keyword of UNSUPPORTED_KEYWORDS) {
|
|
176
|
+
if (keyword in result) {
|
|
177
|
+
const value = result[keyword];
|
|
178
|
+
if (promote && keyword !== '$comment' && keyword !== 'examples') {
|
|
179
|
+
const constraint = `${keyword}: ${JSON.stringify(value)}`;
|
|
180
|
+
result.description = result.description
|
|
181
|
+
? `${result.description} (${constraint})`
|
|
182
|
+
: `(${constraint})`;
|
|
183
|
+
}
|
|
184
|
+
delete result[keyword];
|
|
185
|
+
transformations.push({
|
|
186
|
+
type: 'KEYWORD_REMOVED',
|
|
187
|
+
path,
|
|
188
|
+
message: `Removed unsupported keyword "${keyword}" (value: ${JSON.stringify(value)})`,
|
|
189
|
+
lossy: true,
|
|
190
|
+
});
|
|
191
|
+
warnings.push(`Removed "${keyword}" at ${path} — OpenAI strict mode does not support this keyword`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (result.properties) {
|
|
195
|
+
const newProps = {};
|
|
196
|
+
for (const [key, prop] of Object.entries(result.properties)) {
|
|
197
|
+
newProps[key] = removeUnsupportedKeywords(prop, `${path}.properties.${key}`, transformations, warnings, options);
|
|
198
|
+
}
|
|
199
|
+
result.properties = newProps;
|
|
200
|
+
}
|
|
201
|
+
if (result.items && !Array.isArray(result.items)) {
|
|
202
|
+
result.items = removeUnsupportedKeywords(result.items, `${path}.items`, transformations, warnings, options);
|
|
203
|
+
}
|
|
204
|
+
if (result.anyOf) {
|
|
205
|
+
result.anyOf = result.anyOf.map((s, i) => removeUnsupportedKeywords(s, `${path}.anyOf[${i}]`, transformations, warnings, options));
|
|
206
|
+
}
|
|
207
|
+
if (result.oneOf) {
|
|
208
|
+
result.oneOf = result.oneOf.map((s, i) => removeUnsupportedKeywords(s, `${path}.oneOf[${i}]`, transformations, warnings, options));
|
|
209
|
+
}
|
|
210
|
+
if (result.allOf) {
|
|
211
|
+
result.allOf = result.allOf.map((s, i) => removeUnsupportedKeywords(s, `${path}.allOf[${i}]`, transformations, warnings, options));
|
|
212
|
+
}
|
|
213
|
+
if (result.$defs) {
|
|
214
|
+
const newDefs = {};
|
|
215
|
+
for (const [key, def] of Object.entries(result.$defs)) {
|
|
216
|
+
newDefs[key] = removeUnsupportedKeywords(def, `${path}.$defs.${key}`, transformations, warnings, options);
|
|
217
|
+
}
|
|
218
|
+
result.$defs = newDefs;
|
|
219
|
+
}
|
|
220
|
+
return result;
|
|
221
|
+
}
|
|
222
|
+
function simplifyComposition(node, path, transformations, warnings) {
|
|
223
|
+
let result = { ...node };
|
|
224
|
+
// Simplify allOf by merging
|
|
225
|
+
if (result.allOf && result.allOf.length > 0) {
|
|
226
|
+
let merged = {};
|
|
227
|
+
for (const sub of result.allOf) {
|
|
228
|
+
merged = mergeSchemas(merged, sub);
|
|
229
|
+
}
|
|
230
|
+
// Copy merged properties to result
|
|
231
|
+
const { allOf: _, ...rest } = result;
|
|
232
|
+
result = { ...rest, ...merged };
|
|
233
|
+
transformations.push({
|
|
234
|
+
type: 'COMPOSITION_SIMPLIFIED',
|
|
235
|
+
path,
|
|
236
|
+
message: 'Merged allOf schemas into single schema',
|
|
237
|
+
lossy: false,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
// Convert oneOf to anyOf
|
|
241
|
+
if (result.oneOf) {
|
|
242
|
+
result.anyOf = result.oneOf;
|
|
243
|
+
delete result.oneOf;
|
|
244
|
+
transformations.push({
|
|
245
|
+
type: 'COMPOSITION_SIMPLIFIED',
|
|
246
|
+
path,
|
|
247
|
+
message: 'Converted oneOf to anyOf',
|
|
248
|
+
lossy: false,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
// Remove not
|
|
252
|
+
if (result.not) {
|
|
253
|
+
delete result.not;
|
|
254
|
+
transformations.push({
|
|
255
|
+
type: 'COMPOSITION_SIMPLIFIED',
|
|
256
|
+
path,
|
|
257
|
+
message: 'Removed "not" keyword (not supported)',
|
|
258
|
+
lossy: true,
|
|
259
|
+
});
|
|
260
|
+
warnings.push(`Removed "not" at ${path} — cannot be represented in OpenAI strict mode`);
|
|
261
|
+
}
|
|
262
|
+
// Recurse
|
|
263
|
+
if (result.properties) {
|
|
264
|
+
const newProps = {};
|
|
265
|
+
for (const [key, prop] of Object.entries(result.properties)) {
|
|
266
|
+
newProps[key] = simplifyComposition(prop, `${path}.properties.${key}`, transformations, warnings);
|
|
267
|
+
}
|
|
268
|
+
result.properties = newProps;
|
|
269
|
+
}
|
|
270
|
+
if (result.items && !Array.isArray(result.items)) {
|
|
271
|
+
result.items = simplifyComposition(result.items, `${path}.items`, transformations, warnings);
|
|
272
|
+
}
|
|
273
|
+
if (result.anyOf) {
|
|
274
|
+
result.anyOf = result.anyOf.map((s, i) => simplifyComposition(s, `${path}.anyOf[${i}]`, transformations, warnings));
|
|
275
|
+
}
|
|
276
|
+
if (result.$defs) {
|
|
277
|
+
const newDefs = {};
|
|
278
|
+
for (const [key, def] of Object.entries(result.$defs)) {
|
|
279
|
+
newDefs[key] = simplifyComposition(def, `${path}.$defs.${key}`, transformations, warnings);
|
|
280
|
+
}
|
|
281
|
+
result.$defs = newDefs;
|
|
282
|
+
}
|
|
283
|
+
return result;
|
|
284
|
+
}
|
|
285
|
+
function mergeSchemas(a, b) {
|
|
286
|
+
const result = { ...a };
|
|
287
|
+
if (b.type)
|
|
288
|
+
result.type = b.type;
|
|
289
|
+
if (b.description)
|
|
290
|
+
result.description = b.description;
|
|
291
|
+
if (b.properties) {
|
|
292
|
+
result.properties = { ...(result.properties || {}), ...b.properties };
|
|
293
|
+
}
|
|
294
|
+
if (b.required) {
|
|
295
|
+
const reqSet = new Set([...(result.required || []), ...b.required]);
|
|
296
|
+
result.required = Array.from(reqSet);
|
|
297
|
+
}
|
|
298
|
+
if (b.additionalProperties !== undefined) {
|
|
299
|
+
result.additionalProperties = b.additionalProperties;
|
|
300
|
+
}
|
|
301
|
+
// Copy other keys from b that aren't in result
|
|
302
|
+
for (const key of Object.keys(b)) {
|
|
303
|
+
if (!(key in result)) {
|
|
304
|
+
result[key] = b[key];
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return result;
|
|
308
|
+
}
|
|
309
|
+
//# sourceMappingURL=openai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/providers/openai.ts"],"names":[],"mappings":";;AAeA,0CAqBC;AAKD,4DAaC;AArDD,8CAA0C;AAE1C;;GAEG;AACH,MAAM,oBAAoB,GAAG;IAC3B,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,kBAAkB;IAC5D,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,UAA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AAC;IACvC,CAAC;IAED,IAAI,CAAC,CAAC,oBAAoB,KAAK,SAAS,EAAE,CAAC;QACzC,MAAM,CAAC,oBAAoB,GAAG,CAAC,CAAC,oBAAoB,CAAC;IACvD,CAAC;IAED,+CAA+C;IAC/C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACjC,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC;YACpB,MAAkC,CAAC,GAAG,CAAC,GAAI,CAA6B,CAAC,GAAG,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/tool.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Provider, ConvertOptions, ToolDefinitionInput, ToolDefinition, TransformationRecord } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Create a provider-specific tool definition from a generic tool definition.
|
|
4
|
+
*/
|
|
5
|
+
export declare function createTool(tool: ToolDefinitionInput, provider: Provider, options?: ConvertOptions): {
|
|
6
|
+
tool: ToolDefinition;
|
|
7
|
+
transformations: TransformationRecord[];
|
|
8
|
+
warnings: string[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Create tool definitions for multiple tools for a specific provider.
|
|
12
|
+
* For Gemini, wraps all tools in a single functionDeclarations object.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createTools(tools: ToolDefinitionInput[], provider: Provider, options?: ConvertOptions): {
|
|
15
|
+
tools: ToolDefinition[];
|
|
16
|
+
transformations: TransformationRecord[][];
|
|
17
|
+
warnings: string[][];
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,QAAQ,EACR,cAAc,EACd,mBAAmB,EACnB,cAAc,EAQd,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAIjB;;GAEG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,mBAAmB,EACzB,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,cAAc,GACvB;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,eAAe,EAAE,oBAAoB,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAyCvF;AAwED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,mBAAmB,EAAE,EAC5B,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,cAAc,GACvB;IAAE,KAAK,EAAE,cAAc,EAAE,CAAC;IAAC,eAAe,EAAE,oBAAoB,EAAE,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAA;CAAE,CAkB9F"}
|
package/dist/tool.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTool = createTool;
|
|
4
|
+
exports.createTools = createTools;
|
|
5
|
+
const providers_1 = require("./providers");
|
|
6
|
+
const normalizer_1 = require("./normalizer");
|
|
7
|
+
/**
|
|
8
|
+
* Create a provider-specific tool definition from a generic tool definition.
|
|
9
|
+
*/
|
|
10
|
+
function createTool(tool, provider, options) {
|
|
11
|
+
// Validate tool name
|
|
12
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(tool.name)) {
|
|
13
|
+
throw new TypeError(`Invalid tool name "${tool.name}": must contain only alphanumeric characters, underscores, and hyphens`);
|
|
14
|
+
}
|
|
15
|
+
const converter = (0, providers_1.getConverter)(provider);
|
|
16
|
+
// Normalize and resolve refs first for providers that need inlining
|
|
17
|
+
let inputSchema = (0, normalizer_1.normalize)(tool.schema);
|
|
18
|
+
const allTransformations = [];
|
|
19
|
+
const allWarnings = [];
|
|
20
|
+
// For providers with limited $ref support, inline refs
|
|
21
|
+
const preserveRefs = provider === 'openai' || provider === 'anthropic' || provider === 'mcp' || provider === 'gemini';
|
|
22
|
+
const { schema: resolvedSchema, transformations: refTransforms } = (0, normalizer_1.resolveRefs)(inputSchema, {
|
|
23
|
+
maxRecursionDepth: options?.maxRecursionDepth,
|
|
24
|
+
preserveRefs,
|
|
25
|
+
});
|
|
26
|
+
inputSchema = resolvedSchema;
|
|
27
|
+
allTransformations.push(...refTransforms);
|
|
28
|
+
// Apply provider-specific conversion
|
|
29
|
+
const { schema: convertedSchema, transformations, warnings } = converter(inputSchema, options);
|
|
30
|
+
allTransformations.push(...transformations);
|
|
31
|
+
allWarnings.push(...warnings);
|
|
32
|
+
// Build provider-specific tool envelope
|
|
33
|
+
const toolDef = buildToolEnvelope(tool, convertedSchema, provider, options);
|
|
34
|
+
// Handle output schema for MCP
|
|
35
|
+
if (provider === 'mcp' && tool.outputSchema) {
|
|
36
|
+
const outNormalized = (0, normalizer_1.normalize)(tool.outputSchema);
|
|
37
|
+
const { schema: outResolved } = (0, normalizer_1.resolveRefs)(outNormalized, { preserveRefs: true });
|
|
38
|
+
const { schema: outConverted } = converter(outResolved, options);
|
|
39
|
+
toolDef.outputSchema = outConverted;
|
|
40
|
+
}
|
|
41
|
+
return { tool: toolDef, transformations: allTransformations, warnings: allWarnings };
|
|
42
|
+
}
|
|
43
|
+
function buildToolEnvelope(tool, schema, provider, options) {
|
|
44
|
+
const strict = options?.strict !== false;
|
|
45
|
+
switch (provider) {
|
|
46
|
+
case 'openai':
|
|
47
|
+
return {
|
|
48
|
+
type: 'function',
|
|
49
|
+
function: {
|
|
50
|
+
name: tool.name,
|
|
51
|
+
description: tool.description,
|
|
52
|
+
parameters: schema,
|
|
53
|
+
strict,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
case 'anthropic':
|
|
57
|
+
return {
|
|
58
|
+
name: tool.name,
|
|
59
|
+
description: tool.description,
|
|
60
|
+
input_schema: schema,
|
|
61
|
+
};
|
|
62
|
+
case 'gemini':
|
|
63
|
+
return {
|
|
64
|
+
name: tool.name,
|
|
65
|
+
description: tool.description,
|
|
66
|
+
parameters: schema,
|
|
67
|
+
};
|
|
68
|
+
case 'cohere':
|
|
69
|
+
return {
|
|
70
|
+
type: 'function',
|
|
71
|
+
function: {
|
|
72
|
+
name: tool.name,
|
|
73
|
+
description: tool.description,
|
|
74
|
+
parameters: schema,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
case 'mcp':
|
|
78
|
+
return {
|
|
79
|
+
name: tool.name,
|
|
80
|
+
description: tool.description,
|
|
81
|
+
inputSchema: schema,
|
|
82
|
+
};
|
|
83
|
+
case 'ollama':
|
|
84
|
+
return {
|
|
85
|
+
name: tool.name,
|
|
86
|
+
description: tool.description,
|
|
87
|
+
format: schema,
|
|
88
|
+
};
|
|
89
|
+
case 'vercel-ai':
|
|
90
|
+
return {
|
|
91
|
+
name: tool.name,
|
|
92
|
+
description: tool.description,
|
|
93
|
+
parameters: schema,
|
|
94
|
+
};
|
|
95
|
+
default:
|
|
96
|
+
throw new Error(`Unsupported provider for tool definition: "${provider}"`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create tool definitions for multiple tools for a specific provider.
|
|
101
|
+
* For Gemini, wraps all tools in a single functionDeclarations object.
|
|
102
|
+
*/
|
|
103
|
+
function createTools(tools, provider, options) {
|
|
104
|
+
const results = tools.map(tool => createTool(tool, provider, options));
|
|
105
|
+
if (provider === 'gemini') {
|
|
106
|
+
// Wrap in functionDeclarations array
|
|
107
|
+
const declarations = results.map(r => r.tool);
|
|
108
|
+
return {
|
|
109
|
+
tools: [{ functionDeclarations: declarations }],
|
|
110
|
+
transformations: results.map(r => r.transformations),
|
|
111
|
+
warnings: results.map(r => r.warnings),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
tools: results.map(r => r.tool),
|
|
116
|
+
transformations: results.map(r => r.transformations),
|
|
117
|
+
warnings: results.map(r => r.warnings),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=tool.js.map
|
package/dist/tool.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":";;AAqBA,gCA6CC;AA4ED,kCAsBC;AArJD,2CAA2C;AAC3C,6CAAsD;AAEtD;;GAEG;AACH,SAAgB,UAAU,CACxB,IAAyB,EACzB,QAAkB,EAClB,OAAwB;IAExB,qBAAqB;IACrB,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,SAAS,CACjB,sBAAsB,IAAI,CAAC,IAAI,wEAAwE,CACxG,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,GAAG,IAAA,wBAAY,EAAC,QAAQ,CAAC,CAAC;IAEzC,oEAAoE;IACpE,IAAI,WAAW,GAAG,IAAA,sBAAS,EAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,kBAAkB,GAA2B,EAAE,CAAC;IACtD,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,uDAAuD;IACvD,MAAM,YAAY,GAAG,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,WAAW,IAAI,QAAQ,KAAK,KAAK,IAAI,QAAQ,KAAK,QAAQ,CAAC;IACtH,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,IAAA,wBAAW,EAAC,WAAW,EAAE;QAC1F,iBAAiB,EAAE,OAAO,EAAE,iBAAiB;QAC7C,YAAY;KACb,CAAC,CAAC;IACH,WAAW,GAAG,cAAc,CAAC;IAC7B,kBAAkB,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;IAE1C,qCAAqC;IACrC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE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AAY,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAA4B,CAAC,CAAC;QACtE,OAAO;YACL,KAAK,EAAE,CAAC,EAAE,oBAAoB,EAAE,YAAY,EAA+B,CAAC;YAC5E,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC;YACpD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;SACvC,CAAC;IACJ,CAAC;IAED,OAAO;QACL,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAC/B,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC;QACpD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;KACvC,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supported LLM provider names.
|
|
3
|
+
*/
|
|
4
|
+
export type Provider = 'openai' | 'anthropic' | 'gemini' | 'cohere' | 'mcp' | 'vercel-ai' | 'ollama';
|
|
5
|
+
/**
|
|
6
|
+
* Recursive JSON Schema type supporting draft-07 and draft-2020-12 keywords.
|
|
7
|
+
*/
|
|
8
|
+
export interface JSONSchema {
|
|
9
|
+
type?: string | string[];
|
|
10
|
+
properties?: Record<string, JSONSchema>;
|
|
11
|
+
required?: string[];
|
|
12
|
+
items?: JSONSchema | JSONSchema[];
|
|
13
|
+
prefixItems?: JSONSchema[];
|
|
14
|
+
additionalProperties?: boolean | JSONSchema;
|
|
15
|
+
enum?: unknown[];
|
|
16
|
+
const?: unknown;
|
|
17
|
+
anyOf?: JSONSchema[];
|
|
18
|
+
oneOf?: JSONSchema[];
|
|
19
|
+
allOf?: JSONSchema[];
|
|
20
|
+
not?: JSONSchema;
|
|
21
|
+
$ref?: string;
|
|
22
|
+
$defs?: Record<string, JSONSchema>;
|
|
23
|
+
definitions?: Record<string, JSONSchema>;
|
|
24
|
+
$schema?: string;
|
|
25
|
+
$comment?: string;
|
|
26
|
+
title?: string;
|
|
27
|
+
description?: string;
|
|
28
|
+
default?: unknown;
|
|
29
|
+
examples?: unknown[];
|
|
30
|
+
format?: string;
|
|
31
|
+
pattern?: string;
|
|
32
|
+
minimum?: number;
|
|
33
|
+
maximum?: number;
|
|
34
|
+
exclusiveMinimum?: number;
|
|
35
|
+
exclusiveMaximum?: number;
|
|
36
|
+
multipleOf?: number;
|
|
37
|
+
minLength?: number;
|
|
38
|
+
maxLength?: number;
|
|
39
|
+
minItems?: number;
|
|
40
|
+
maxItems?: number;
|
|
41
|
+
nullable?: boolean;
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Options for the convert function.
|
|
46
|
+
*/
|
|
47
|
+
export interface ConvertOptions {
|
|
48
|
+
/** Schema name (used in OpenAI response_format envelope). */
|
|
49
|
+
name?: string;
|
|
50
|
+
/** Schema description. */
|
|
51
|
+
description?: string;
|
|
52
|
+
/** Enable strict mode for providers that support it (default: true for OpenAI). */
|
|
53
|
+
strict?: boolean;
|
|
54
|
+
/** Append removed constraints to description fields. */
|
|
55
|
+
promoteConstraintsToDescription?: boolean;
|
|
56
|
+
/** Maximum recursion depth for inlining recursive $ref (default: 5). */
|
|
57
|
+
maxRecursionDepth?: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Result of converting a schema for a provider.
|
|
61
|
+
*/
|
|
62
|
+
export interface ProviderSchema {
|
|
63
|
+
/** The transformed schema in the provider's expected format. */
|
|
64
|
+
schema: JSONSchema;
|
|
65
|
+
/** Transformations applied during conversion. */
|
|
66
|
+
transformations: TransformationRecord[];
|
|
67
|
+
/** Warnings about lossy conversions. */
|
|
68
|
+
warnings: string[];
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A record of a single transformation applied during conversion.
|
|
72
|
+
*/
|
|
73
|
+
export interface TransformationRecord {
|
|
74
|
+
/** Type of transformation. */
|
|
75
|
+
type: TransformationType;
|
|
76
|
+
/** JSON path where the transformation was applied. */
|
|
77
|
+
path: string;
|
|
78
|
+
/** Human-readable description. */
|
|
79
|
+
message: string;
|
|
80
|
+
/** Whether the transformation is lossy. */
|
|
81
|
+
lossy: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Types of transformations that can be applied.
|
|
85
|
+
*/
|
|
86
|
+
export type TransformationType = 'REF_INLINED' | 'ADDITIONAL_PROPERTIES_INJECTED' | 'REQUIRED_EXPANDED' | 'FIELD_MADE_NULLABLE' | 'KEYWORD_REMOVED' | 'COMPOSITION_SIMPLIFIED' | 'DEFAULT_REMOVED' | 'RECURSIVE_SCHEMA_TRUNCATED';
|
|
87
|
+
/**
|
|
88
|
+
* Tool definition input (provider-agnostic).
|
|
89
|
+
*/
|
|
90
|
+
export interface ToolDefinitionInput {
|
|
91
|
+
name: string;
|
|
92
|
+
description: string;
|
|
93
|
+
schema: JSONSchema;
|
|
94
|
+
outputSchema?: JSONSchema;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Provider-specific tool definition output.
|
|
98
|
+
*/
|
|
99
|
+
export type ToolDefinition = OpenAIToolDefinition | AnthropicToolDefinition | GeminiToolDefinition | CohereToolDefinition | MCPToolDefinition | OllamaToolDefinition | GenericToolDefinition;
|
|
100
|
+
export interface OpenAIToolDefinition {
|
|
101
|
+
type: 'function';
|
|
102
|
+
function: {
|
|
103
|
+
name: string;
|
|
104
|
+
description: string;
|
|
105
|
+
parameters: JSONSchema;
|
|
106
|
+
strict?: boolean;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
export interface AnthropicToolDefinition {
|
|
110
|
+
name: string;
|
|
111
|
+
description: string;
|
|
112
|
+
input_schema: JSONSchema;
|
|
113
|
+
}
|
|
114
|
+
export interface GeminiToolDefinition {
|
|
115
|
+
name: string;
|
|
116
|
+
description: string;
|
|
117
|
+
parameters: JSONSchema;
|
|
118
|
+
}
|
|
119
|
+
export interface CohereToolDefinition {
|
|
120
|
+
type: 'function';
|
|
121
|
+
function: {
|
|
122
|
+
name: string;
|
|
123
|
+
description: string;
|
|
124
|
+
parameters: JSONSchema;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export interface MCPToolDefinition {
|
|
128
|
+
name: string;
|
|
129
|
+
description: string;
|
|
130
|
+
inputSchema: JSONSchema;
|
|
131
|
+
outputSchema?: JSONSchema;
|
|
132
|
+
}
|
|
133
|
+
export interface OllamaToolDefinition {
|
|
134
|
+
name: string;
|
|
135
|
+
description: string;
|
|
136
|
+
format: JSONSchema;
|
|
137
|
+
}
|
|
138
|
+
export interface GenericToolDefinition {
|
|
139
|
+
name: string;
|
|
140
|
+
description: string;
|
|
141
|
+
parameters: JSONSchema;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAChB,QAAQ,GACR,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,KAAK,GACL,WAAW,GACX,QAAQ,CAAC;AAEb;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,GAAG,UAAU,EAAE,CAAC;IAClC,WAAW,CAAC,EAAE,UAAU,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R,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,UAAU,CAAC;QACvB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,UAAU,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;QACpB,UAAU,EAAE,UAAU,CAAC;KACxB,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,UAAU,CAAC;IACxB,YAAY,CAAC,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;CACxB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|