veryfront 0.1.973 → 0.1.974
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/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-tool-compat.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/provider-tool-compat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,6DAA6D;AAC7D,MAAM,MAAM,0BAA0B,GAClC,WAAW,GACX,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,SAAS,CAAC;AAEd,qDAAqD;AACrD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,0BAA0B,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,gDAAgD;AAChD,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AA2BD,oCAAoC;AACpC,wBAAgB,sBAAsB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAsB1E;AAeD,oDAAoD;AACpD,wBAAgB,iCAAiC,CAC/C,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,OAAO,GAAE,yBAA8B,GACtC,MAAM,EAAE,CAsBV;AAED,+CAA+C;AAC/C,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,OAAO,GAAE,yBAA8B,GACtC,cAAc,EAAE,CAclB;
|
|
1
|
+
{"version":3,"file":"provider-tool-compat.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/provider-tool-compat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,6DAA6D;AAC7D,MAAM,MAAM,0BAA0B,GAClC,WAAW,GACX,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,SAAS,CAAC;AAEd,qDAAqD;AACrD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,0BAA0B,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,gDAAgD;AAChD,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AA2BD,oCAAoC;AACpC,wBAAgB,sBAAsB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,mBAAmB,CAsB1E;AAeD,oDAAoD;AACpD,wBAAgB,iCAAiC,CAC/C,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,OAAO,GAAE,yBAA8B,GACtC,MAAM,EAAE,CAsBV;AAED,+CAA+C;AAC/C,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,OAAO,GAAE,yBAA8B,GACtC,cAAc,EAAE,CAclB;AA6MD;;;;GAIG;AACH,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAa/E;AAED,6CAA6C;AAC7C,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,UAAU,EAClB,OAAO,GAAE,IAAI,CAAC,yBAAyB,EAAE,OAAO,CAAM,GACrD,UAAU,CAeZ"}
|
|
@@ -34,8 +34,8 @@ export function getProviderToolProfile(model) {
|
|
|
34
34
|
if (provider === "anthropic") {
|
|
35
35
|
return { provider: "anthropic", sanitizeSchema: true };
|
|
36
36
|
}
|
|
37
|
-
if (provider === "moonshot") {
|
|
38
|
-
return { provider: "moonshot", sanitizeSchema:
|
|
37
|
+
if (provider === "moonshot" || provider === "moonshotai") {
|
|
38
|
+
return { provider: "moonshot", sanitizeSchema: true };
|
|
39
39
|
}
|
|
40
40
|
return { provider: "unknown", sanitizeSchema: false };
|
|
41
41
|
}
|
|
@@ -227,6 +227,34 @@ function sanitizeGoogleSchemaValue(value) {
|
|
|
227
227
|
}
|
|
228
228
|
return sanitized;
|
|
229
229
|
}
|
|
230
|
+
function sanitizeMoonshotSchemaValue(value) {
|
|
231
|
+
if (Array.isArray(value)) {
|
|
232
|
+
return value.map((item) => sanitizeMoonshotSchemaValue(item));
|
|
233
|
+
}
|
|
234
|
+
if (!isPlainRecord(value)) {
|
|
235
|
+
return value;
|
|
236
|
+
}
|
|
237
|
+
const sanitized = {};
|
|
238
|
+
for (const [key, child] of Object.entries(value)) {
|
|
239
|
+
if (key === "$ref" && typeof child === "string") {
|
|
240
|
+
sanitized.$ref = child.replace(/^#\/definitions\//, "#/$defs/");
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
if (key === "definitions") {
|
|
244
|
+
sanitized.$defs = sanitizeMoonshotSchemaValue(child);
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
if (key === "properties" && isPlainRecord(child)) {
|
|
248
|
+
sanitized.properties = Object.fromEntries(Object.entries(child).map(([propertyName, propertySchema]) => [
|
|
249
|
+
propertyName,
|
|
250
|
+
sanitizeMoonshotSchemaValue(propertySchema),
|
|
251
|
+
]));
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
sanitized[key] = sanitizeMoonshotSchemaValue(child);
|
|
255
|
+
}
|
|
256
|
+
return sanitized;
|
|
257
|
+
}
|
|
230
258
|
/**
|
|
231
259
|
* Normalize a provider tool input schema so every function tool has a
|
|
232
260
|
* provider-safe JSON Schema object at the root. Remote/MCP tools can omit the
|
|
@@ -253,5 +281,8 @@ export function sanitizeProviderToolSchema(schema, options = {}) {
|
|
|
253
281
|
if (profile.provider === "google") {
|
|
254
282
|
return sanitizeGoogleSchemaValue(propertyKeySafeSchema);
|
|
255
283
|
}
|
|
284
|
+
if (profile.provider === "moonshot") {
|
|
285
|
+
return sanitizeMoonshotSchemaValue(propertyKeySafeSchema);
|
|
286
|
+
}
|
|
256
287
|
return propertyKeySafeSchema;
|
|
257
288
|
}
|