/** * Minimal `@sinclair/typebox` runtime compatibility shim, backed by Zod. * * Historically the coding agent injected the real `@sinclair/typebox` (~5MB * dependency) into extensions, hooks, custom tools, and custom commands so * they could author parameter schemas as `Type.Object({ name: Type.String() })`. * Internally everything already runs through Zod (`wire.ts`, `validation.ts`); * the only reason TypeBox remained was extension-author compat. * * This module replaces that injection with a tiny façade whose `Type` builders * return Zod schemas. Output is indistinguishable from hand-written Zod inside * the agent pipeline: * * - `isZodSchema()` keys off the Zod `_zod` marker that every schema carries. * - `zodToWireSchema()` emits the same draft 2020-12 JSON Schema providers expect * from TypeBox-authored tools (defaulted fields treated as optional, etc.). * * The surface intentionally covers only the common TypeBox builders. Plugins * that reached for niche TypeBox-only APIs (`TypeCompiler`, the global * `TypeRegistry`, custom `Symbol(TypeBox.Kind)` introspection) must vendor * `@sinclair/typebox` directly in their own package. */ import { type ZodArray, type ZodEnum, type ZodObject, type ZodOptional, type ZodRawShape, type ZodType, z } from "zod/v4"; export type TSchema = ZodType; export type Static = z.infer; export type TAny = ZodType; export type TUnknown = ZodType; export type TNever = ZodType; export type TNull = ZodType; export type TString = z.ZodString; export type TNumber = z.ZodNumber; export type TInteger = z.ZodNumber; export type TBoolean = z.ZodBoolean; export type TLiteral = z.ZodLiteral; export type TArray = ZodArray; export type TObject

= ZodObject

; export type TOptional = ZodOptional; export type TUnion<_T extends readonly ZodType[] = readonly ZodType[]> = ZodType; export type TEnum = ZodEnum<{ [K in T[number] as `${K}`]: K; }>; export type TRecord<_K extends ZodType, _V extends ZodType> = ZodType; interface Meta { title?: string; description?: string; default?: unknown; examples?: unknown[]; [key: string]: unknown; } interface StringOpts extends Meta { minLength?: number; maxLength?: number; pattern?: string; format?: string; } interface NumberOpts extends Meta { minimum?: number; maximum?: number; exclusiveMinimum?: number; exclusiveMaximum?: number; multipleOf?: number; } interface ArrayOpts extends Meta { minItems?: number; maxItems?: number; uniqueItems?: boolean; } interface ObjectOpts extends Meta { /** * TypeBox default: extra keys are preserved. Set `false` to reject unknowns, * `true` to allow any, or a schema to validate them. */ additionalProperties?: boolean | ZodType; } declare function tString(opts?: StringOpts): ZodType; declare function tNumber(opts?: NumberOpts): ZodType; declare function tInteger(opts?: NumberOpts): ZodType; declare function tBoolean(opts?: Meta): ZodType; declare function tNull(opts?: Meta): ZodType; declare function tAny(opts?: Meta): ZodType; declare function tUnknown(opts?: Meta): ZodType; declare function tNever(opts?: Meta): ZodType; declare function tLiteral(value: V, opts?: Meta): ZodType; declare function tUnion(schemas: T, opts?: Meta): ZodType; declare function tIntersect(schemas: readonly ZodType[], opts?: Meta): ZodType; declare function tEnum | readonly (string | number)[]>(values: T, opts?: Meta): ZodType; declare function tArray(item: E, opts?: ArrayOpts): ZodType; declare function tTuple(items: readonly ZodType[], opts?: Meta): ZodType; declare function tObject

(properties: P, opts?: ObjectOpts): ZodObject

; declare function tRecord(key: ZodType, value: V, opts?: Meta): ZodType; declare function tOptional(schema: E, _opts?: Meta): ZodOptional; declare function tNullable(schema: E, opts?: Meta): ZodType; declare function tReadonly(schema: E): E; declare function tPartial

(obj: ZodObject

): ZodObject

; declare function tRequired

(obj: ZodObject

): ZodObject

; declare function tPick

(obj: ZodObject

, keys: readonly K[]): ZodObject>; declare function tOmit

(obj: ZodObject

, keys: readonly K[]): ZodObject>; declare function tComposite(objects: readonly ZodObject[], opts?: Meta): ZodObject; export declare const Type: { readonly String: typeof tString; readonly Number: typeof tNumber; readonly Integer: typeof tInteger; readonly Boolean: typeof tBoolean; readonly Null: typeof tNull; readonly Any: typeof tAny; readonly Unknown: typeof tUnknown; readonly Never: typeof tNever; readonly Literal: typeof tLiteral; readonly Union: typeof tUnion; readonly Intersect: typeof tIntersect; readonly Enum: typeof tEnum; readonly Array: typeof tArray; readonly Tuple: typeof tTuple; readonly Object: typeof tObject; readonly Record: typeof tRecord; readonly Optional: typeof tOptional; readonly Nullable: typeof tNullable; readonly Readonly: typeof tReadonly; readonly Partial: typeof tPartial; readonly Required: typeof tRequired; readonly Pick: typeof tPick; readonly Omit: typeof tOmit; readonly Composite: typeof tComposite; }; export type TypeBuilder = typeof Type; /** Default namespace export so `import * as typebox from "./typebox"` still resolves the `Type` key. */ declare const _default: { Type: { readonly String: typeof tString; readonly Number: typeof tNumber; readonly Integer: typeof tInteger; readonly Boolean: typeof tBoolean; readonly Null: typeof tNull; readonly Any: typeof tAny; readonly Unknown: typeof tUnknown; readonly Never: typeof tNever; readonly Literal: typeof tLiteral; readonly Union: typeof tUnion; readonly Intersect: typeof tIntersect; readonly Enum: typeof tEnum; readonly Array: typeof tArray; readonly Tuple: typeof tTuple; readonly Object: typeof tObject; readonly Record: typeof tRecord; readonly Optional: typeof tOptional; readonly Nullable: typeof tNullable; readonly Readonly: typeof tReadonly; readonly Partial: typeof tPartial; readonly Required: typeof tRequired; readonly Pick: typeof tPick; readonly Omit: typeof tOmit; readonly Composite: typeof tComposite; }; }; export default _default;