mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 01:01:42 +00:00
Fix NodeJS compat
This commit is contained in:
parent
e2d23a5abb
commit
197259c88a
19 changed files with 110 additions and 99 deletions
|
|
@ -1,5 +1,10 @@
|
|||
import Ajv from "ajv";
|
||||
import addFormats from "ajv-formats";
|
||||
import AjvModule from "ajv";
|
||||
import addFormatsModule from "ajv-formats";
|
||||
|
||||
// Handle both default and named exports
|
||||
const Ajv = (AjvModule as any).default || AjvModule;
|
||||
const addFormats = (addFormatsModule as any).default || addFormatsModule;
|
||||
|
||||
import type { Tool, ToolCall } from "./types.js";
|
||||
|
||||
// Create a singleton AJV instance with formats
|
||||
|
|
@ -25,7 +30,7 @@ export function validateToolArguments(tool: Tool, toolCall: ToolCall): any {
|
|||
// Format validation errors nicely
|
||||
const errors =
|
||||
validate.errors
|
||||
?.map((err) => {
|
||||
?.map((err: any) => {
|
||||
const path = err.instancePath ? err.instancePath.substring(1) : err.params.missingProperty || "root";
|
||||
return ` - ${path}: ${err.message}`;
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue