/** * ThinkHive SDK v3.0 - Runs API * * Run-centric API for creating and managing runs (the atomic unit in v3) */ import type { RunOptions, RunResponse, CustomerContextSnapshot, ConversationMessage, RunOutcome } from '../core/types'; /** * List runs query options */ export interface ListRunsOptions { agentId?: string; ticketId?: string; customerAccountId?: string; outcome?: RunOutcome; startedAfter?: string | Date; startedBefore?: string | Date; limit?: number; offset?: number; } /** * Run stats response */ export interface RunStats { agentId: string; period: { from: string; to: string; }; totalRuns: number; outcomeBreakdown: Record; avgDurationMs: number; linkedTickets: number; unlinkedRuns: number; } /** * Runs API client for v3 run-centric operations */ export declare const runs: { /** * Create a new run * * @example * ```typescript * const run = await runs.create({ * agentId: 'agent_123', * conversationMessages: [ * { role: 'user', content: 'Help me with my order' }, * { role: 'assistant', content: 'I can help with that...' }, * ], * outcome: 'resolved', * customerContext: { * arr: 50000, * healthScore: 85, * segment: 'enterprise', * }, * }); * ``` */ create(options: RunOptions): Promise; /** * Get a run by ID * * @example * ```typescript * const run = await runs.get('run_abc123'); * ``` */ get(runId: string): Promise; /** * List runs with filters * * @example * ```typescript * const { items, hasMore } = await runs.list({ * agentId: 'agent_123', * outcome: 'failed', * limit: 20, * }); * ``` */ list(options?: ListRunsOptions): Promise<{ items: RunResponse[]; limit: number; offset: number; hasMore: boolean; }>; /** * Update a run * * @example * ```typescript * await runs.update('run_abc123', { * outcome: 'resolved', * outcomeReason: 'Customer confirmed issue resolved', * }); * ``` */ update(runId: string, updates: Partial>): Promise; /** * Delete a run * * @example * ```typescript * await runs.delete('run_abc123'); * ``` */ delete(runId: string): Promise; /** * Create multiple runs in batch * * @example * ```typescript * const { created, failed } = await runs.batch([ * { agentId: 'agent_1', conversationMessages: [...] }, * { agentId: 'agent_1', conversationMessages: [...] }, * ]); * ``` */ batch(runsData: RunOptions[]): Promise<{ created: RunResponse[]; failed: Array<{ index: number; error: string; }>; }>; /** * Get run statistics for an agent * * @example * ```typescript * const stats = await runs.stats('agent_123', { * from: '2024-01-01', * to: '2024-01-31', * }); * ``` */ stats(agentId: string, options?: { from?: string | Date; to?: string | Date; }): Promise; /** * Get traces for a run * * @example * ```typescript * const traces = await runs.getTraces('run_abc123'); * ``` */ getTraces(runId: string): Promise; /** * Add a trace to a run * * @example * ```typescript * await runs.addTrace('run_abc123', { * spans: [...], * timestamp: new Date().toISOString(), * }); * ``` */ addTrace(runId: string, traceData: { spans?: unknown[]; timestamp?: string; metadata?: Record; }): Promise<{ traceId: string; }>; }; /** * Create a run with customer context snapshot * * @example * ```typescript * const run = await createRunWithContext({ * agentId: 'agent_123', * conversationMessages: [...], * customerContext: { * arr: 100000, * healthScore: 92, * }, * }); * ``` */ export declare function createRunWithContext(options: RunOptions & { customerContext: CustomerContextSnapshot; }): Promise; /** * Convert conversation messages to OpenAI format */ export declare function toOpenAIMessages(messages: ConversationMessage[]): Array<{ role: string; content: string; }>; /** * Convert OpenAI format messages to ThinkHive format */ export declare function fromOpenAIMessages(messages: Array<{ role: string; content: string; }>): ConversationMessage[];