/** * GitMem MCP Server Types */ export type { GitMemTier } from "../services/tier.js"; export type DataSource = "local_cache" | "supabase" | "memory"; export type CacheStatus = "hit" | "miss" | "expired" | "bypassed" | "not_applicable"; export interface ComponentPerformance { latency_ms: number; source: DataSource; cache_status: CacheStatus; network_call: boolean; } export interface PerformanceBreakdown { last_session?: ComponentPerformance; scar_search?: ComponentPerformance; decisions?: ComponentPerformance; wins?: ComponentPerformance; session_create?: ComponentPerformance; embedding?: ComponentPerformance; upsert?: ComponentPerformance; storage_write?: ComponentPerformance; } export interface PerformanceData { latency_ms: number; target_ms: number; meets_target: boolean; result_count: number; memories_surfaced?: string[]; similarity_scores?: number[]; total_latency_ms?: number; network_calls_made?: number; fully_local?: boolean; breakdown?: PerformanceBreakdown; cache_hit?: boolean; cache_age_ms?: number; search_mode?: "local" | "remote"; } export type AgentIdentity = "cli" | "desktop" | "autonomous" | "local" | "cloud" | "Unknown"; export type Project = string; export type ThreadStatus = "open" | "resolved"; export interface ThreadObject { /** Unique identifier: "t-" + 8 hex chars (e.g., "t-a1b2c3d4") */ id: string; /** Thread text description */ text: string; /** Current status */ status: ThreadStatus; /** ISO timestamp when thread was first created */ created_at: string; /** ISO timestamp when thread was last touched/referenced (Supabase-sourced) */ last_touched_at?: string; /** ISO timestamp when thread was resolved */ resolved_at?: string; /** Session ID that created this thread */ source_session?: string; /** Session ID that resolved this thread */ resolved_by_session?: string; /** Brief resolution note */ resolution_note?: string; } export type ThreadSuggestionStatus = "pending" | "promoted" | "dismissed"; export interface ThreadSuggestion { /** Unique identifier: "ts-" + 8 hex chars */ id: string; /** Suggested thread description (derived from session title) */ text: string; /** Embedding vector for dedup against future suggestions */ embedding: number[] | null; /** Session IDs that contributed to this suggestion (3+ required) */ evidence_sessions: string[]; /** Average cosine similarity across evidence sessions */ similarity_score: number; /** Current status */ status: ThreadSuggestionStatus; /** Thread ID if promoted to open thread */ promoted_thread_id?: string; /** Number of times dismissed */ dismissed_count: number; /** ISO timestamp when suggestion was first created */ created_at: string; /** ISO timestamp of last update */ updated_at: string; } export interface DetectedEnvironment { entrypoint: string | null; docker: boolean; hostname: string; agent: AgentIdentity; } export interface SessionStartParams { agent_identity?: AgentIdentity; linear_issue?: string; issue_title?: string; issue_description?: string; issue_labels?: string[]; project?: Project; /** Force overwrite of existing active session */ force?: boolean; } export interface LastSession { id: string; title: string; date: string; key_decisions: string[]; /** Used internally for PROJECT STATE extraction — not included in MCP result */ open_threads: (string | ThreadObject)[]; } export interface RelevantScar { id: string; title: string; learning_type?: string; severity: string; description: string; counter_arguments: string[]; similarity: number; why_this_matters?: string; action_protocol?: string[]; self_check_criteria?: string[]; decay_multiplier?: number; is_starter?: boolean; } export interface RecentDecision { id: string; title: string; decision: string; date: string; } export interface RecentWin { id: string; title: string; description: string; date: string; source_issue?: string; } export interface SessionStartResult { session_id: string; agent: AgentIdentity; detected_environment?: DetectedEnvironment; last_session?: LastSession | null; /** PROJECT STATE thread extracted from last session (if present) */ project_state?: string; /** Aggregated open threads across last 5 sessions (deduplicated, migrated to objects) */ open_threads?: ThreadObject[]; /** Phase 5: Suggested threads inferred from recurring session topics */ suggested_threads?: ThreadSuggestion[]; relevant_scars?: RelevantScar[]; recent_decisions?: RecentDecision[]; /** Cross-agent rapport summaries from recent sessions */ rapport_summaries?: { agent: string; summary: string; date: string; }[]; recent_wins?: RecentWin[]; performance?: PerformanceData; /** Whether this session was resumed from an existing active session */ resumed?: boolean; /** Whether this result is from a mid-session refresh (no new session created) */ refreshed?: boolean; /** Message explaining session state */ message?: string; /** Asciinema recording path for session replay (from GITMEM_RECORDING_PATH env var) */ recording_path?: string; /** Resolved .gitmem directory path — use for closing-payload.json writes */ gitmem_dir?: string; /** Closing payload schema — exact field names for closing-payload.json */ closing_payload_schema?: Record; /** Project namespace for this session */ project?: string; /** Pre-formatted display string for consistent CLI output */ display?: string; } export type CloseType = "standard" | "quick" | "autonomous" | "retroactive"; export interface ClosingReflection { what_broke: string; what_took_longer: string; do_differently: string; what_worked: string; wrong_assumption: string; scars_applied: string[]; /** Q7: What from this session should be captured as institutional memory? */ institutional_memory_items?: string; /** Q8: How did the human prefer to work this session? */ collaborative_dynamic?: string; /** Q9: What collaborative dynamic worked or didn't work? */ rapport_notes?: string; } /** * Task completion proof for standard close * * Enforces that each step in the closing protocol was actually completed. * Timestamps must be in logical order and human_response requires minimum gap. */ export interface TaskCompletion { /** ISO timestamp when 7 reflection questions were displayed to human (Task 1) */ questions_displayed_at: string; /** ISO timestamp when agent finished answering all questions (Task 2) */ reflection_completed_at: string; /** ISO timestamp when agent asked human for corrections (Task 3) */ human_asked_at: string; /** Human's response - "none", "no corrections", or actual corrections (Task 4) */ human_response: string; /** ISO timestamp when human responded (Task 4) - must be >= 3 seconds after human_asked_at */ human_response_at: string; } export interface SessionDecision { title: string; decision: string; rationale: string; alternatives_considered?: string[]; } export interface SessionCloseParams { session_id: string; close_type: CloseType; /** Task completion proof - REQUIRED for standard close */ task_completion?: TaskCompletion; closing_reflection?: ClosingReflection; human_corrections?: string; decisions?: SessionDecision[]; open_threads?: (string | ThreadObject)[]; /** Optional PROJECT STATE that auto-prepends to open_threads[0] */ project_state?: string; learnings_created?: (string | Record)[]; linear_issue?: string; ceremony_duration_ms?: number; scars_to_record?: ScarUsageEntry[]; /** Capture full conversation transcript to Supabase storage (defaults to true for CLI/DAC) */ capture_transcript?: boolean; /** Explicit transcript file path (overrides automatic detection) */ transcript_path?: string; } export interface CloseCompliance { close_type: CloseType; agent: AgentIdentity; checklist_displayed: boolean; questions_answered_by_agent: boolean; human_asked_for_corrections: boolean; learnings_stored: number; scars_applied: number; ceremony_duration_ms?: number; retroactive?: boolean; } export interface SessionCloseResult { success: boolean; session_id: string; close_compliance: CloseCompliance; validation_errors?: string[]; performance: PerformanceData; /** Pre-formatted display string for consistent CLI output */ display?: string; } export type LearningType = "scar" | "win" | "pattern" | "anti_pattern"; export type ScarSeverity = "critical" | "high" | "medium" | "low"; export interface CreateLearningParams { learning_type: LearningType; title: string; description: string; severity?: ScarSeverity; scar_type?: string; counter_arguments?: string[]; problem_context?: string; solution_approach?: string; applies_when?: string[]; domain?: string[]; keywords?: string[]; source_linear_issue?: string; project?: Project; why_this_matters?: string; action_protocol?: string[]; self_check_criteria?: string[]; } export interface CreateLearningResult { success: boolean; learning_id: string; embedding_generated: boolean; /** Error details when success=false */ errors?: string[]; display?: string; performance: PerformanceData; } export interface CreateDecisionParams { title: string; decision: string; rationale: string; alternatives_considered?: string[]; personas_involved?: string[]; docs_affected?: string[]; linear_issue?: string; session_id?: string; project?: Project; } export interface CreateDecisionResult { success: boolean; decision_id: string; display?: string; performance: PerformanceData; } export interface SurfacedScar { scar_id: string; scar_title: string; scar_severity: string; surfaced_at: string; source: "session_start" | "recall"; variant_id?: string; } export type ConfirmationDecision = "APPLYING" | "N_A" | "REFUTED"; export type ScarRelevance = "high" | "low" | "noise"; export interface ScarConfirmation { scar_id: string; scar_title: string; decision: ConfirmationDecision; evidence: string; confirmed_at: string; relevance?: ScarRelevance; } export interface ConfirmScarsParams { confirmations: Array<{ scar_id: string; decision: ConfirmationDecision; evidence: string; relevance?: ScarRelevance; }>; } export interface ConfirmScarsResult { valid: boolean; errors: string[]; confirmations: ScarConfirmation[]; missing_scars: string[]; formatted_response: string; display?: string; performance: PerformanceData; } export type ReflectionOutcome = "OBEYED" | "REFUTED"; export interface ScarReflection { scar_id: string; scar_title: string; outcome: ReflectionOutcome; evidence: string; reflected_at: string; } export interface ReflectScarsParams { reflections: Array<{ scar_id: string; outcome: ReflectionOutcome; evidence: string; }>; } export interface ReflectScarsResult { valid: boolean; errors: string[]; reflections: ScarReflection[]; missing_scars: string[]; formatted_response: string; display?: string; performance: PerformanceData; } export type ReferenceType = "explicit" | "implicit" | "acknowledged" | "refuted" | "none"; export interface RecordScarUsageParams { scar_id: string; issue_id?: string; issue_identifier?: string; session_id?: string; agent?: string; surfaced_at: string; acknowledged_at?: string; reference_type: ReferenceType; reference_context: string; execution_successful?: boolean; variant_id?: string; } export interface RecordScarUsageResult { success: boolean; usage_id: string; /** Error details when success=false */ errors?: string[]; display?: string; performance: PerformanceData; } export interface ScarUsageEntry { scar_identifier: string; issue_id?: string; issue_identifier?: string; session_id?: string; agent?: string; surfaced_at: string; acknowledged_at?: string; reference_type: ReferenceType; reference_context: string; execution_successful?: boolean; variant_id?: string; } export interface RecordScarUsageBatchParams { scars: ScarUsageEntry[]; project?: Project; } export interface RecordScarUsageBatchResult { success: boolean; usage_ids: string[]; resolved_count: number; failed_count: number; failed_identifiers?: string[]; display?: string; performance: PerformanceData; } export interface SupabaseListOptions { table: string; columns?: string; filters?: Record; limit?: number; orderBy?: { column: string; ascending?: boolean; }; } export interface SupabaseSearchOptions { query: string; tables?: string[]; match_count?: number; project?: Project; } export interface SaveTranscriptParams { session_id: string; transcript: string; format?: "json" | "markdown"; project?: Project; } export interface SaveTranscriptResult { success: boolean; transcript_path?: string; size_bytes?: number; size_kb?: number; estimated_tokens?: number; error?: string; performance: PerformanceData; } export interface GetTranscriptParams { session_id: string; } export interface GetTranscriptResult { success: boolean; transcript?: string; transcript_path?: string; size_bytes?: number; error?: string; performance: PerformanceData; } export type ObservationSeverity = "info" | "warning" | "scar_candidate"; export interface Observation { source: string; text: string; severity: ObservationSeverity; context?: string; absorbed_at?: string; } export interface SessionChild { type: "sub_agent" | "teammate"; role: string; task_description: string; scars_inherited: string[]; observations_returned: Observation[]; started_at: string; ended_at?: string; } export interface AbsorbObservationsParams { task_id?: string; observations: Observation[]; } export interface AbsorbObservationsResult { absorbed: number; scar_candidates: number; suggestions: string[]; display?: string; performance: PerformanceData; } export interface ListThreadsParams { /** Filter by status (default: "open") */ status?: ThreadStatus; /** Include recently resolved threads (default: false) */ include_resolved?: boolean; project?: Project; } export interface ListThreadsResult { threads: ThreadObject[]; total_open: number; total_resolved: number; display?: string; performance: PerformanceData; } export interface ResolveThreadParams { /** Thread ID for exact resolution (e.g., "t-a1b2c3d4") */ thread_id?: string; /** Fuzzy text match against thread descriptions */ text_match?: string; /** Brief note explaining resolution */ resolution_note?: string; } export interface ResolveThreadResult { success: boolean; resolved_thread?: ThreadObject; /** Threads that were also resolved via duplicate cascade */ also_resolved?: ThreadObject[]; error?: string; display?: string; performance: PerformanceData; } /** A single entry in the active-sessions registry */ export interface ActiveSessionEntry { session_id: string; agent: AgentIdentity; started_at: string; hostname: string; pid: number; project: Project; } /** The shape of .gitmem/active-sessions.json on disk */ export interface ActiveSessionsRegistry { sessions: ActiveSessionEntry[]; } //# sourceMappingURL=index.d.ts.map