/** Observation types matching claude-mem's schema */ export type ObservationType = "decision" | "bugfix" | "feature" | "refactor" | "discovery" | "change"; /** Full observation record stored in the database */ export interface Observation { id: string; sessionId: string; scope?: "project" | "user"; type: ObservationType; title: string; subtitle: string; facts: string[]; narrative: string; concepts: string[]; filesRead: string[]; filesModified: string[]; rawToolOutput: string; toolName: string; createdAt: string; tokenCount: number; discoveryTokens: number; importance: number; revisionOf?: string | null; deletedAt?: string | null; supersededBy?: string | null; supersededAt?: string | null; } /** Lightweight index entry for progressive disclosure */ export interface ObservationIndex { id: string; sessionId: string; type: ObservationType; title: string; tokenCount: number; discoveryTokens: number; createdAt: string; importance: number; } /** An active or completed coding session. */ export interface Session { id: string; projectPath: string; startedAt: string; endedAt: string | null; status: "active" | "idle" | "completed"; observationCount: number; summaryId: string | null; } /** AI-generated summary of a coding session. */ export interface SessionSummary { id: string; sessionId: string; summary: string; keyDecisions: string[]; filesModified: string[]; concepts: string[]; createdAt: string; tokenCount: number; request?: string; investigated?: string; learned?: string; completed?: string; nextSteps?: string; } /** A pending tool output awaiting AI compression. */ export interface PendingMessage { id: string; sessionId: string; toolName: string; toolOutput: string; callId: string; createdAt: string; status: "pending" | "processing" | "completed" | "failed"; retryCount: number; error: string | null; } /** Queued work item for the background processor. */ export type QueueItem = { type: "compress"; pendingMessageId: string; sessionId: string; toolName: string; toolOutput: string; callId: string; } | { type: "summarize"; sessionId: string; }; /** Full configuration for the open-mem plugin. */ export interface OpenMemConfig { dbPath: string; provider: string; apiKey: string | undefined; model: string; maxTokensPerCompression: number; compressionEnabled: boolean; contextInjectionEnabled: boolean; maxContextTokens: number; batchSize: number; batchIntervalMs: number; ignoredTools: string[]; minOutputLength: number; maxIndexEntries: number; sensitivePatterns: string[]; retentionDays: number; maxDatabaseSizeMb: number; logLevel: "debug" | "info" | "warn" | "error"; contextShowTokenCosts: boolean; contextObservationTypes: ObservationType[] | "all"; contextFullObservationCount: number; maxObservations: number; contextShowLastSummary: boolean; rateLimitingEnabled: boolean; folderContextEnabled: boolean; folderContextMaxDepth: number; folderContextMode: "dispersed" | "single"; folderContextFilename: string; daemonEnabled: boolean; dashboardEnabled: boolean; dashboardPort: number; platformOpenCodeEnabled?: boolean; platformClaudeCodeEnabled?: boolean; platformCursorEnabled?: boolean; mcpProtocolVersion?: string; mcpSupportedProtocolVersions?: string[]; embeddingDimension?: number; conflictResolutionEnabled: boolean; conflictSimilarityBandLow: number; conflictSimilarityBandHigh: number; userMemoryEnabled: boolean; userMemoryDbPath: string; userMemoryMaxContextTokens: number; rerankingEnabled: boolean; rerankingMaxCandidates: number; entityExtractionEnabled: boolean; fallbackProviders?: string[]; mode?: string; } /** OpenCode plugin input shape */ export interface PluginInput { client: unknown; project: string; directory: string; worktree: string; serverUrl: string; $: unknown; } /** OpenCode hook definitions */ export interface Hooks { "tool.execute.after"?: (input: { tool: string; sessionID: string; callID: string; }, output: { title: string; output: string; metadata: Record; }) => Promise; "chat.message"?: (input: { sessionID: string; agent?: string; model?: string | { providerID: string; modelID: string; }; messageID?: string; variant?: string; }, output: { message: unknown; parts: unknown[]; }) => Promise; "experimental.chat.system.transform"?: (input: { sessionID?: string; model: string; }, output: { system: string[]; }) => Promise; "experimental.session.compacting"?: (input: { sessionID: string; }, output: { context: string[]; prompt?: string; }) => Promise; event?: (input: { event: OpenCodeEvent; }) => Promise; tool?: Record; } /** An event emitted by OpenCode (e.g. tool execution, session lifecycle). */ export interface OpenCodeEvent { type: string; properties: Record; } /** Schema for a custom tool exposed to the AI agent. */ export interface ToolDefinition { description: string; args: Record; execute: (args: Record, context: ToolContext) => Promise; } /** Runtime context passed to a tool's execute function. */ export interface ToolContext { sessionID: string; abort: AbortSignal; messageID?: string; agent?: string; directory?: string; worktree?: string; metadata?: (input: { title?: string; metadata?: Record; }) => void; ask?: (input: unknown) => Promise; } /** Plugin type — entry point for OpenCode plugins */ export type Plugin = (input: PluginInput) => Promise; /** FTS5 search query parameters with optional filters. */ export interface SearchQuery { query: string; sessionId?: string; type?: ObservationType; limit?: number; offset?: number; projectPath?: string; importanceMin?: number; importanceMax?: number; createdAfter?: string; createdBefore?: string; concepts?: string[]; files?: string[]; } /** A search result pairing an observation with its relevance rank. */ export interface SearchResult { observation: Observation; rank: number; snippet: string; source?: "project" | "user"; rankingSource?: RankingSignalSource; explain?: { strategy?: "filter-only" | "semantic" | "hybrid"; matchedBy: Array<"fts" | "vector" | "graph" | "user-memory" | "concept-filter" | "file-filter">; ftsRank?: number; vectorDistance?: number; vectorSimilarity?: number; rrfScore?: number; signals?: SearchExplainSignal[]; lineage?: SearchLineageRef; }; } /** A session with its summary and observation count for timeline display. */ export interface TimelineEntry { session: Session; summary: SessionSummary | null; observationCount: number; } /** Source that contributed to a search result's ranking. */ export type RankingSignalSource = "fts" | "vector" | "graph" | "user-memory"; /** A single explainability signal describing why a result was ranked. */ export interface SearchExplainSignal { source: RankingSignalSource; score?: number; label?: string; } /** Reference to a lineage chain for a search result observation. */ export interface SearchLineageRef { rootId: string; depth: number; } /** Describes the diff between two observation revisions. */ export interface RevisionDiff { fromId: string; toId: string; summary: string; changedFields: Array<{ field: "title" | "subtitle" | "narrative" | "type" | "facts" | "concepts" | "filesRead" | "filesModified" | "importance"; before: unknown; after: unknown; }>; } /** Runtime status of a platform adapter. */ export interface AdapterStatus { name: string; version: string; enabled: boolean; capabilities: Record; } /** A single config audit event tracking a configuration change. */ export interface ConfigAuditEvent { id: string; timestamp: string; patch: Record; previousValues: Record; source: "api" | "mode" | "rollback" | "rollback-failed"; } /** A single maintenance operation result. */ export interface MaintenanceHistoryItem { id: string; timestamp: string; action: string; dryRun: boolean; result: Record; } /** Workflow mode configuration loaded from JSON files. */ export interface ModeConfig { id: string; extends?: string; locale?: string; name: string; description: string; observationTypes: string[]; conceptVocabulary: string[]; entityTypes: string[]; relationshipTypes: string[]; promptOverrides?: Record; } //# sourceMappingURL=types.d.ts.map