export declare const PLUGIN_TYPES: readonly ["summarizer", "search", "storage", "runtime", "platform", "memory"]; export type PluginType = typeof PLUGIN_TYPES[number]; export declare const OBSERVATION_TYPES: readonly ["code", "error", "log", "test", "commit", "decision", "context"]; export type ObservationType = typeof OBSERVATION_TYPES[number]; export interface PluginConfig { [key: string]: unknown; } export interface Plugin { name: string; version: string; type: PluginType; init(config: PluginConfig): Promise; destroy(): Promise; } export declare function isPlugin(obj: unknown): obj is Plugin; export interface ObservationMetadata { source: string; file_path?: string; language?: string; tokens_original: number; tokens_summarized: number; privacy_level: 'public' | 'private' | 'redacted'; session_id?: string; correlation_id?: string; files_modified?: string[]; importance_score?: number; significance_flags?: string[]; entities?: string[]; } export interface Observation { id: string; type: ObservationType; content: string; summary?: string; content_hash?: string; metadata: ObservationMetadata; embeddings?: Float32Array; indexed_at: number; } export interface TruncationResult { content: string; tier: 1 | 2 | 3 | 4; original_length: number; truncated_length: number; } export type OverflowStrategy = 'aggressive_truncation' | 'warn' | 'hard_stop'; export interface BudgetConfig { session_limit: number; overflow_strategy: OverflowStrategy; agent_limits?: Record; } export interface BudgetStatus { used: number; limit: number; percentage: number; strategy: OverflowStrategy; throttled: boolean; blocked: boolean; signal?: string; } export type KnowledgeCategory = 'pattern' | 'decision' | 'error' | 'api' | 'component' | 'answer' | 'summary'; export type SourceType = 'explicit' | 'inferred' | 'observed'; export interface KnowledgeEntry { id: string; category: KnowledgeCategory; title: string; content: string; tags: string[]; shareable: boolean; relevance_score: number; access_count: number; created_at: number; last_accessed: number; archived: boolean; source_type: SourceType; } export interface ContradictionWarning { id: string; title: string; content: string; similarity_reason: string; source_type?: SourceType; authority_existing: number; authority_new: number; suggested_action: 'keep_existing' | 'replace' | 'merge'; explanation?: string; suggested_merge?: string; } export declare const ENTITY_TYPES: readonly ["file", "module", "pattern", "decision", "bug", "person", "library", "service", "api", "config"]; export type EntityType = typeof ENTITY_TYPES[number]; export declare const RELATIONSHIP_TYPES: readonly ["uses", "depends-on", "fixed-by", "contradicts", "supersedes", "implements", "tests", "documents", "mentions"]; export type RelationshipType = typeof RELATIONSHIP_TYPES[number]; export interface Entity { id: string; name: string; entity_type: EntityType; metadata: Record; knowledge_id?: string; created_at: number; updated_at: number; } export interface Relationship { id: string; from_entity: string; to_entity: string; relationship_type: RelationshipType; weight: number; metadata: Record; created_at: number; } export interface GraphResult { entities: Entity[]; relationships: Relationship[]; } export interface AgentInfo { id: string; name: string; session_id: string; pid: number; started_at: number; last_heartbeat: number; status: 'active' | 'idle' | 'stopped'; current_task: string; files_claimed: string[]; } export type EventPriority = 1 | 2 | 3 | 4; export interface ContextEvent { id: string; session_id: string; event_type: string; priority: EventPriority; agent?: string; data: Record; context_bytes: number; timestamp: number; } export interface SessionSnapshot { session_id: string; snapshot: string; created_at: number; } export interface Statement { run(...params: unknown[]): { changes: number; lastInsertRowid: number | bigint; }; get(...params: unknown[]): unknown; all(...params: unknown[]): unknown[]; } export interface StoragePlugin extends Plugin { type: 'storage'; open(dbPath: string): Promise; exec(sql: string, params?: unknown[]): void; prepare(sql: string): Statement; close(): Promise; readonly supportsJSON: boolean; readonly supportsFTS5: boolean; } export interface SummaryResult { summary: string; tokens_original: number; tokens_summarized: number; savings_pct: number; content_type: string; } export interface SummarizeOpts { max_length?: number; include_metadata?: boolean; } export interface SummarizerPlugin extends Plugin { type: 'summarizer'; contentTypes: string[]; detect(content: string): boolean; summarize(content: string, opts: SummarizeOpts): Promise; /** Priority ordering (lower = checked first). Built-ins use 100-900. Plugins: 50 (before) or 950 (after). */ priority?: number; } export interface SearchResult { id: string; title: string; snippet: string; relevance_score: number; type: ObservationType; timestamp: number; access_count?: number; } export interface SearchOpts { limit?: number; type_filter?: ObservationType[]; type_boosts?: Partial>; from?: number; to?: number; /** Reference date for resolving relative temporal queries ("10 days ago"). ISO string or timestamp. */ referenceDate?: string | number; } export interface SearchPlugin extends Plugin { type: 'search'; strategy: 'bm25' | 'trigram' | 'vector' | 'levenshtein'; priority: number; search(query: string, opts: SearchOpts): Promise; shouldFallback(results: SearchResult[]): boolean; } export interface SearchIntent { keywords: string[]; type_boosts: Partial>; intent_type: 'causal' | 'lookup' | 'temporal' | 'recommendation' | 'general'; } export interface SearchOrchestrator { classify(query: string): SearchIntent; execute(query: string, opts: SearchOpts): Promise; } export interface ExecOpts { timeout?: number; memory_limit?: number; env?: Record; stdin?: string; } export interface ExecResult { stdout: string; stderr: string; exit_code: number; duration_ms: number; truncated: boolean; } export interface RuntimePlugin extends Plugin { type: 'runtime'; language: string; extensions: string[]; detect(): Promise; execute(code: string, opts: ExecOpts): Promise; } export interface HookConfig { type: 'subprocess' | 'direct_mcp'; hook_script?: string; settings_path?: string; } export interface MCPServerConfig { port: number; transport: 'stdio' | 'http'; } export interface ToolNameMap { [generic: string]: string; } export interface PlatformAdapter extends Plugin { type: 'platform'; platform: string; detectPlatform(): boolean; getHookFormat(): HookConfig; getToolNames(): ToolNameMap; wrapMCPServer(): MCPServerConfig; } export interface TokenEconomics { session_id: string; observations_stored: number; total_content_bytes: number; total_summary_bytes: number; searches_performed: number; discovery_tokens: number; stored_tokens: number; tokens_saved: number; savings_percentage: number; } export interface SessionContext { session_id: string; platform: string; started_at: number; } export interface SessionChain { chain_id: string; session_id: string; parent_session: string | null; project_path: string; created_at: number; handoff_reason: 'auto' | 'manual' | 'compaction' | 'session_end'; summary: string | null; token_estimate: number; } export interface HandoffResult { continuation_prompt: string; chain_id: string; snapshot_id: string; token_estimate: TokenEstimate; } export interface TokenEstimate { used: number; limit: number; percentage: number; } export interface SessionContinuityConfig { enabled: boolean; auto_restore_threshold_hours: number; light_restore_threshold_hours: number; snapshot_max_bytes: number; recovery_injection_max_bytes: number; recovery_cooldown_minutes: number; } export interface TokenEstimationConfig { model_context_limit: number; bytes_per_token: number; system_prompt_tokens: number; tool_definitions_tokens: number; per_message_overhead: number; } export interface SearchWeights { bm25?: number; trigram?: number; levenshtein?: number; vector?: number; } export declare const DEFAULT_SEARCH_WEIGHTS: Required; export interface GlobalKnowledgeStoreConfig { enabled?: boolean; auto_suggest?: boolean; } export interface ProactiveInjectionConfig { enabled?: boolean; max_injections_per_minute?: number; file_cooldown_seconds?: number; relevance_threshold?: number; max_injection_chars?: number; inject_on?: string[]; } export interface AutoPromoteConfig { enabled?: boolean; session_threshold?: number; notify?: boolean; } export interface AICurationConfig { enabled?: boolean; provider?: 'auto' | 'ollama' | 'openrouter' | 'claude'; model?: string; endpoint?: string; } export interface ContextMemConfig { storage: string; plugins: { summarizers: string[]; search: string[]; runtimes: string[]; custom?: string[]; external_summarizers?: Record; }; privacy: { strip_tags: boolean; redact_patterns: string[]; disabled_detectors?: string[]; }; token_economics: boolean; lifecycle: { ttl_days: number; max_db_size_mb: number; max_observations: number; cleanup_schedule: 'on_startup' | 'hourly' | 'manual'; preserve_types: ObservationType[]; }; search_weights?: SearchWeights; global_knowledge?: GlobalKnowledgeStoreConfig; proactive_injection?: ProactiveInjectionConfig; session_continuity?: SessionContinuityConfig; auto_promote?: AutoPromoteConfig; ai_curation?: AICurationConfig; token_estimation?: TokenEstimationConfig; vault?: { enabled?: boolean; dir?: string; synthesis?: boolean; }; port: number; api_port: number; db_path: string; execute_enabled: boolean; } export declare const DEFAULT_CONFIG: ContextMemConfig; export declare const ERROR_CATEGORIES: readonly ["embedder", "entity", "topic", "summarizer", "pipeline", "dreamer", "knowledge-graph", "knowledge-base", "storage", "search", "llm", "privacy", "hook", "dashboard", "mcp", "config", "migration", "lifecycle", "synthesis", "other"]; export type ErrorCategory = typeof ERROR_CATEGORIES[number]; export type ErrorSeverity = 'info' | 'warn' | 'error' | 'critical'; export interface ErrorLogEntry { id: number; timestamp: number; severity: ErrorSeverity; category: ErrorCategory; message: string; message_hash: string; context_json?: string; stack?: string; occurrences: number; first_seen: number; last_seen: number; } export interface ErrorLogSummary { category: ErrorCategory; message: string; severity: ErrorSeverity; count: number; first_seen: number; last_seen: number; } //# sourceMappingURL=types.d.ts.map