Skip to content

armgit / pibot

Public Imported from GitHub
0

Open-source, local-first AI agent team for your desktop: multi-agent group chats, computer use, browser, MCP, routines and approvals. macOS, Windows, Linux + Android. Built on pi.

580 B
Raw Blame
import { Type } from "typebox";

// OMP remaps `typebox` to a host shim that historically lacked Type.Unsafe.
// Prefer Unsafe when present (real TypeBox / fixed OMP shim); otherwise pass
// the normalized JSON Schema through as a plain object so toolWireSchema and
// validateToolArguments still treat it as JSON Schema.
export function toToolParameters(schema: Record<string, unknown>): unknown {
  return typeof (Type as { Unsafe?: (value: never) => unknown }).Unsafe === "function"
    ? (Type as { Unsafe: (value: never) => unknown }).Unsafe(schema as never)
    : schema;
}