/**
 * Prospective Memory System
 *
 * Implements goal-oriented memory for future tasks and reminders.
 * Based on MemGPT research (UC Berkeley 2023) for stateful AI agents.
 *
 * Features:
 * - Task scheduling and reminders
 * - Goal tracking with progress monitoring
 * - Contextual triggers (time, event, condition)
 * - Priority-based task ordering
 * - Automatic task cleanup
 */
import { EventEmitter } from 'events';
export type TaskPriority = 'low' | 'medium' | 'high' | 'critical';
export type TaskStatus = 'pending' | 'in_progress' | 'completed' | 'cancelled' | 'deferred';
export type TriggerType = 'time' | 'event' | 'condition' | 'manual';
export interface ProspectiveTask {
    id: string;
    title: string;
    description?: string;
    priority: TaskPriority;
    status: TaskStatus;
    trigger: TaskTrigger;
    context?: TaskContext;
    progress: number;
    subtasks?: SubTask[];
    dependencies?: string[];
    tags: string[];
    projectId?: string;
    createdAt: Date;
    updatedAt: Date;
    dueAt?: Date;
    completedAt?: Date;
    metadata?: Record<string, unknown>;
}
export interface TaskTrigger {
    type: TriggerType;
    /** For time triggers: ISO date string or cron expression */
    schedule?: string;
    /** For event triggers: event name to listen for */
    event?: string;
    /** For condition triggers: condition to evaluate */
    condition?: string;
    /** Has this trigger fired? */
    fired: boolean;
    /** Last time the trigger was checked */
    lastChecked?: Date;
}
export interface TaskContext {
    /** Files related to this task */
    files?: string[];
    /** Relevant code snippets */
    codeSnippets?: Array<{
        file: string;
        code: string;
        language: string;
    }>;
    /** User notes */
    notes?: string;
    /** Links/references */
    references?: string[];
}
export interface SubTask {
    id: string;
    title: string;
    completed: boolean;
    order: number;
}
export interface Goal {
    id: string;
    title: string;
    description?: string;
    targetDate?: Date;
    tasks: string[];
    progress: number;
    status: 'active' | 'achieved' | 'abandoned';
    milestones?: Milestone[];
    createdAt: Date;
    updatedAt: Date;
}
export interface Milestone {
    id: string;
    title: string;
    targetProgress: number;
    achieved: boolean;
    achievedAt?: Date;
}
export interface Reminder {
    id: string;
    taskId?: string;
    message: string;
    triggerAt: Date;
    recurring?: {
        interval: 'daily' | 'weekly' | 'monthly';
        count?: number;
    };
    dismissed: boolean;
    createdAt: Date;
}
export interface ProspectiveMemoryConfig {
    enabled: boolean;
    maxTasks: number;
    maxGoals: number;
    checkIntervalMs: number;
    autoCleanupDays: number;
}
export declare class ProspectiveMemory extends EventEmitter {
    private config;
    private tasks;
    private goals;
    private reminders;
    private checkIntervalId;
    private initialized;
    constructor(config?: Partial<ProspectiveMemoryConfig>);
    /**
     * Initialize the prospective memory system
     */
    initialize(): Promise<void>;
    /**
     * Create a new task
     */
    createTask(options: {
        title: string;
        description?: string;
        priority?: TaskPriority;
        trigger?: Partial<TaskTrigger>;
        context?: TaskContext;
        subtasks?: string[];
        dependencies?: string[];
        tags?: string[];
        projectId?: string;
        dueAt?: Date;
        metadata?: Record<string, unknown>;
    }): Promise<ProspectiveTask>;
    /**
     * Update a task
     */
    updateTask(id: string, updates: Partial<Omit<ProspectiveTask, 'id' | 'createdAt'>>): Promise<ProspectiveTask | null>;
    /**
     * Complete a subtask
     */
    completeSubtask(taskId: string, subtaskId: string): Promise<ProspectiveTask | null>;
    /**
     * Get tasks by filter
     */
    getTasks(filter?: {
        status?: TaskStatus | TaskStatus[];
        priority?: TaskPriority | TaskPriority[];
        projectId?: string;
        tags?: string[];
        dueBefore?: Date;
        dueAfter?: Date;
    }): ProspectiveTask[];
    /**
     * Get upcoming tasks (due within N days)
     */
    getUpcomingTasks(days?: number): ProspectiveTask[];
    /**
     * Get overdue tasks
     */
    getOverdueTasks(): ProspectiveTask[];
    /**
     * Delete a task
     */
    deleteTask(id: string): Promise<boolean>;
    /**
     * Create a new goal
     */
    createGoal(options: {
        title: string;
        description?: string;
        targetDate?: Date;
        tasks?: string[];
        milestones?: Array<{
            title: string;
            targetProgress: number;
        }>;
    }): Promise<Goal>;
    /**
     * Add task to goal
     */
    addTaskToGoal(goalId: string, taskId: string): Promise<Goal | null>;
    /**
     * Update goal progress based on tasks
     */
    private updateGoalProgress;
    /**
     * Get goals
     */
    getGoals(status?: Goal['status']): Goal[];
    /**
     * Create a reminder
     */
    createReminder(options: {
        message: string;
        triggerAt: Date;
        taskId?: string;
        recurring?: Reminder['recurring'];
    }): Promise<Reminder>;
    /**
     * Get pending reminders
     */
    getPendingReminders(): Reminder[];
    /**
     * Dismiss a reminder
     */
    dismissReminder(id: string): Promise<boolean>;
    /**
     * Calculate next trigger for recurring reminder
     */
    private calculateNextTrigger;
    /**
     * Check all triggers
     */
    private checkTriggers;
    /**
     * Fire an event (for event-based triggers)
     */
    fireEvent(eventName: string, data?: unknown): Promise<ProspectiveTask[]>;
    private loadTasks;
    private saveTask;
    private loadGoals;
    private saveGoal;
    private loadReminders;
    private saveReminder;
    /**
     * Build context for LLM with prospective information
     */
    buildContext(): string;
    /**
     * Get status display
     */
    formatStatus(): string;
    /**
     * Cleanup old completed tasks
     */
    cleanup(): Promise<number>;
    /**
     * Dispose
     */
    dispose(): void;
}
export declare function getProspectiveMemory(config?: Partial<ProspectiveMemoryConfig>): ProspectiveMemory;
export declare function initializeProspectiveMemory(config?: Partial<ProspectiveMemoryConfig>): Promise<ProspectiveMemory>;
export declare function resetProspectiveMemory(): void;
