UNPKG

memtask

Version:

Memory and task management MCP Server with Goal-Task-Memory architecture

146 lines (145 loc) 3.8 kB
import { Task, CreateTaskArgs, UpdateTaskArgs, GetTaskStatusArgs, ListTasksArgs, DeleteTaskArgs, SearchTaskArgs } from './types'; import { CacheService } from './cache'; /** * Task Manager Class * * Combines the functionality of TaskService and TaskStorage into a single class, * simplifies the architecture, reduces layers and dependencies. */ export declare class TaskManager { private storagePath; private cache; private console; /** * Constructor * @param storagePath Storage path * @param cacheService Unified cache service instance * @param console Console for logging (optional) */ constructor(storagePath: string, cacheService: CacheService<string, Task>, console?: Console); /** * Initialize */ initialize(): Promise<void>; /** * Get next sequential task ID */ private getNextTaskId; /** * Create task * @param args Create task parameters */ createTask(args: CreateTaskArgs): Promise<Task>; /** * Update task * @param args Update task parameters */ updateTask(args: UpdateTaskArgs): Promise<Task | null>; /** * Get task status * @param args Get task status parameters */ getTaskStatus(args: GetTaskStatusArgs): Promise<Task | null>; /** * List tasks * @param args List tasks parameters */ listTasks(args?: ListTasksArgs): Promise<Task[]>; /** * Delete task * @param args Delete task parameters */ deleteTask(args: DeleteTaskArgs): Promise<boolean>; /** * Search tasks * @param args Search parameters */ searchTask(args: SearchTaskArgs): Promise<Array<{ task: Task; similarity: number; }>>; /** * Calculate simple similarity score */ private calculateSimpleSimilarity; /** * Add progress note * @param id Task ID * @param note Progress note */ addProgressNote(id: string, note: string): Promise<boolean>; /** * Update task status * @param id Task ID * @param status New status */ updateStatus(id: string, status: 'todo' | 'in_progress' | 'completed' | 'cancelled'): Promise<boolean>; /** * Get overdue tasks */ getOverdueTasks(): Promise<Task[]>; /** * Get tasks by linked memory * @param memoryId Memory ID */ getTasksByLinkedMemory(memoryId: string): Promise<Task[]>; /** * Batch get tasks * @param ids Array of task IDs */ batchGetTasks(ids: string[]): Promise<Task[]>; /** * Validate task dependencies * @param dependsOn Array of task IDs */ private validateDependencies; /** * Get tasks that are ready to execute (dependencies satisfied) */ getExecutableTasks(): Promise<Task[]>; /** * Check if a task can be executed (all dependencies completed) * @param task Task to check */ private canTaskExecute; /** * Get tasks ordered by numeric ID */ getTasksInOrder(): Promise<Task[]>; /** * Get cache statistics */ getCacheStats(): import("./types").CacheStats; /** * Save task * @param id Task ID * @param task Task object */ private save; /** * Load task * @param id Task ID */ private load; /** * Delete task * @param id Task ID */ private delete; /** * List all tasks */ private list; /** * Sort tasks by priority * @param tasks Tasks to sort * @param highFirst Whether high priority comes first */ private sortByPriority; /** * Sort tasks by due date * @param tasks Tasks to sort * @param ascending Whether to sort in ascending order */ private sortByDueDate; }