/** * AI Module Types * * Type definitions for AI tool integrations. * * @module ai/types */ import type { EntityJSON, DatabaseJSON, AuthJSON, ManifestJSON } from '../json/types'; import type { ValidationResult } from '../validation'; import type { GeneratedFile } from '../template/types'; /** * Tool parameter definition */ export interface ToolParameter { type: 'string' | 'number' | 'boolean' | 'object' | 'array'; description: string; required?: boolean; enum?: string[]; properties?: Record; items?: ToolParameter; } /** * JSON Schema property (for tool schemas) */ export interface SchemaProperty { type: string; description: string; enum?: string[]; items?: SchemaProperty; additionalProperties?: boolean; } /** * Tool definition (framework-agnostic) */ export interface ToolDefinition { name: string; description: string; parameters: Record; required?: string[]; } /** * Result of a tool execution */ export interface ToolResult { success: boolean; message?: string; data?: unknown; errors?: Array<{ code: string; message: string; suggestion?: string; }>; } /** * Add entity parameters */ export interface AddEntityParams { name: string; fields: Record; relations?: Record; behaviors?: { timestamps?: boolean; softDelete?: boolean; audit?: boolean; }; protected?: boolean | 'write' | 'all'; } /** * Update entity parameters */ export interface UpdateEntityParams { name: string; fields?: Record; relations?: Record; behaviors?: { timestamps?: boolean; softDelete?: boolean; audit?: boolean; }; protected?: boolean | 'write' | 'all'; } /** * Remove entity parameters */ export interface RemoveEntityParams { name: string; } /** * Set database parameters */ export interface SetDatabaseParams { type: 'sqlite' | 'postgres' | 'mysql'; file?: string; url?: string; } /** * Set auth parameters */ export interface SetAuthParams { enabled: boolean; providers?: ('credentials' | 'google' | 'github' | 'discord')[]; sessionStrategy?: 'jwt' | 'database'; } /** * ManifestBuilder interface for tracking state across tool calls */ export interface ManifestBuilder { readonly entities: EntityJSON[]; readonly database: DatabaseJSON | undefined; readonly auth: AuthJSON | undefined; addEntity(params: AddEntityParams): ToolResult; updateEntity(params: UpdateEntityParams): ToolResult; removeEntity(params: RemoveEntityParams): ToolResult; setDatabase(params: SetDatabaseParams): ToolResult; setAuth(params: SetAuthParams): ToolResult; toManifest(): ManifestJSON; validate(): ValidationResult; generate(): Promise<{ files: GeneratedFile[]; success: boolean; errors?: string[]; }>; reset(): void; } /** * OpenAI function calling format */ export interface OpenAITool { type: 'function'; function: { name: string; description: string; parameters: { type: 'object'; properties: Record; required?: string[]; }; }; } /** * Anthropic tool use format */ export interface AnthropicTool { name: string; description: string; input_schema: { type: 'object'; properties: Record; required?: string[]; }; } /** * Vercel AI SDK tool format */ export interface VercelAITool { description: string; parameters: { type: 'object'; properties: Record; required?: string[]; }; execute: (params: unknown) => Promise; } //# sourceMappingURL=types.d.ts.map