/** * blob.ts — BLOB session management + LLM planning. * The BLOB is an organic, conversational graph that grows in real-time. * The LLM analyzes user prompts and decides how to grow the graph. */ export interface BlobSession { id: string; name: string; description?: string; createdAt: string; updatedAt: string; enabled: boolean; autonomous: boolean; autonomousIntervalMs?: number; lastAutonomousRun?: string; chatPrompt?: string; plannerPrompt?: string; nodeCount: number; edgeCount: number; messageCount: number; totalTokens: number; } export interface BlobPlanRequest { sessionId: string; userMessage: string; /** Existing branch topics for reuse detection */ existingBranches: Array<{ id: string; topic: string; stepIds: string[]; }>; /** Known concepts from knowledge graph */ knownConcepts: string[]; /** Recent conversation context */ recentMessages: Array<{ role: string; content: string; }>; } export interface BlobPlan { branches: Array<{ topic: string; steps: Array<{ type: string; label: string; prompt: string; model?: string; tools?: string[]; }>; }>; reuseBranches: Array<{ branchNodeId: string; forkAtStepId?: string; newSteps?: Array<{ type: string; label: string; prompt: string; }>; }>; memoryUpdates: Array<{ concept: string; facts: string[]; }>; directResponse?: string; } export declare function listBlobSessions(): BlobSession[]; export declare function createBlobSession(name: string, description?: string): BlobSession; export declare function updateBlobSession(id: string, patch: Partial): BlobSession | null; export declare function deleteBlobSession(id: string): boolean; export declare function saveBlobGraph(sessionId: string, data: unknown): void; export declare function loadBlobGraph(sessionId: string): unknown; export interface KnowledgeEntry { id: string; concept: string; facts: string[]; relatedConcepts: string[]; sourceSessionIds: string[]; sourceNodeIds: string[]; createdAt: string; updatedAt: string; accessCount: number; } export declare function loadKnowledge(): KnowledgeEntry[]; export declare function upsertKnowledge(concept: string, facts: string[], sessionId: string, nodeId: string): KnowledgeEntry; export declare function updateKnowledgeEntry(id: string, patch: Partial): KnowledgeEntry | null; export declare function deleteKnowledgeEntry(id: string): boolean; export declare function searchKnowledge(query: string): KnowledgeEntry[]; export declare function linkConcepts(id1: string, id2: string): void; export declare function startAutonomousEngine(): void; export declare function stopAutonomousEngine(): void; /** Get pending autonomous plan for a session (if any) */ export declare function getAutonomousPlan(sessionId: string): unknown | null; export declare function buildExtractionPrompt(stepOutput: string, existingConcepts: string[]): string; export declare function buildPlanningPrompt(req: BlobPlanRequest, mcpServers?: string[]): string; /** Find knowledge entries relevant to a query using keyword matching + BFS graph traversal */ export declare function findRelevantKnowledge(query: string, allKnowledge: KnowledgeEntry[]): KnowledgeEntry[];