/** * Society Protocol — Planner Module v1.0 (State of the Art) * * The Planner takes a high-level goal and breaks it down into a Directed Task Graph (DAG). * Features: * - Multi-provider support (OpenAI, Anthropic, Ollama, custom) * - Intelligent caching * - Fallback chains * - Streaming support * - Validation and verification */ import type { CocDagNode } from './swp.js'; export type PlannerProvider = 'openai' | 'anthropic' | 'ollama' | 'custom'; export interface PlannerConfig { provider?: PlannerProvider; apiKey?: string; openaiApiKey?: string; openaiModel?: string; openaiBaseUrl?: string; anthropicApiKey?: string; anthropicModel?: string; ollamaUrl?: string; ollamaModel?: string; customEndpoint?: string; customHeaders?: Record; temperature?: number; maxTokens?: number; timeoutMs?: number; enableCache?: boolean; cacheMaxSize?: number; fallbackChain?: PlannerProvider[]; } export interface PlanCacheEntry { goal: string; templateId?: string; dag: CocDagNode[]; timestamp: number; provider: string; confidence: number; } export interface PlanResult { dag: CocDagNode[]; provider: string; model: string; confidence: number; latencyMs: number; tokensUsed?: number; costUsd?: number; cached: boolean; reasoning?: string; } export interface ValidationResult { valid: boolean; errors: string[]; warnings: string[]; } export declare class Planner { private config; private cache; private cacheOrder; constructor(config?: PlannerConfig); /** * Generate a plan (DAG) for a goal */ generatePlan(goal: string, options?: { templateId?: string; context?: string; constraints?: string[]; preferredProvider?: PlannerProvider; }): Promise; /** * Generate plan with streaming (for real-time UI updates) */ generatePlanStreaming(goal: string, options?: { templateId?: string; context?: string; }): AsyncGenerator<{ type: 'thinking' | 'step' | 'complete' | 'error'; data?: CocDagNode; partial?: Partial; error?: string; }>; /** * Expand an existing plan with new steps (for dynamic DAG expansion) */ expandPlan(goal: string, currentDag: CocDagNode[], triggerStepId: string, expansionReason: 'uncertainty' | 'complexity' | 'feedback'): Promise; /** * Validate a DAG structure */ validateDag(dag: CocDagNode[]): ValidationResult; private tryProvider; private callOpenAI; private callAnthropic; private resolveOllamaModel; private callOllama; private callCustom; private buildSystemPrompt; private buildUserPrompt; private getCacheKey; private getCachedPlan; private cachePlan; clearCache(): void; private isProviderAvailable; private checkAcyclic; private findReachableSteps; private estimateCost; isReady(): boolean; getAvailableProviders(): PlannerProvider[]; getCacheStats(): { size: number; maxSize: number; keys: string[]; }; } //# sourceMappingURL=planner.d.ts.map