/** * OpenCode Provider Service — piggyback on session.prompt for structured output. * * Pattern sourced from tickernelz/opencode-mem. * Instead of requiring separate API keys for auto-capture, uses the connected * OpenCode provider (the same one the user uses for chat). OpenCode owns auth, * token refresh, and provider routing — no extra API configuration needed. * * Key design: * - Uses `client.session.prompt()` for LLM calls (no separate API keys) * - Simplified schema validation (not Zod — keeps bundle size small) * - 0-risk: every method catches errors and returns null * - Graceful degradation when client is unavailable */ export interface GenerateStructedParams { systemPrompt: string; userPrompt: string; /** Expected fields in the response (simplified schema: just field names for validation) */ expectedFields?: string[]; } /** * Service that uses the connected OpenCode provider for LLM calls. * No extra API keys needed — piggybacks on the user's existing provider. */ export declare class OpenCodeProviderService { private client; constructor(client: any); /** * Ask the LLM to extract structured information via session.prompt. * Uses the connected OpenCode provider — no separate API configuration. * * @returns Parsed JSON object, or null on any failure (0-risk) */ generateStructured = Record>(params: GenerateStructedParams): Promise; /** * Check if the provider is available. * Makes a lightweight LLM call to verify connectivity. * 0-risk: returns false on any failure. */ isAvailable(): Promise; /** * Capture and structure session content using the OpenCode provider. * Returns structured memory content suitable for vector memory storage. * * @param sessionContext - Raw session text to structure * @returns Structured memory content, or null on failure */ captureStructuredMemory(sessionContext: string): Promise; /** * Extract JSON from response text, handling markdown code blocks. */ private parseJSON; }