/** * Store provider abstraction layer. * * Defines the StoreProvider interface backed by SQLite (ADR-006). * CLI and dispatch engine use StoreProvider for all data access. * * @epic T4454 * @task W1-T6 */ import type { Session, Task, TaskStatus, TaskType } from '@cleocode/contracts'; import type { TaskCurrentResult, TaskStartResult, TaskWorkHistoryEntry } from '../task-work/index.js'; import type { AddTaskOptions, AddTaskResult } from '../tasks/add.js'; import type { AnalysisResult } from '../tasks/analyze.js'; import type { ArchiveTasksOptions, ArchiveTasksResult } from '../tasks/archive.js'; import type { CompleteTaskOptions, CompleteTaskResult } from '../tasks/complete.js'; import type { DeleteTaskOptions, DeleteTaskResult } from '../tasks/delete.js'; import type { FindTasksOptions, FindTasksResult } from '../tasks/find.js'; import type { ListTasksOptions, ListTasksResult } from '../tasks/list.js'; import type { UpdateTaskOptions, UpdateTaskResult } from '../tasks/update.js'; export type { AddTaskOptions, AddTaskResult, AnalysisResult, ArchiveTasksOptions, ArchiveTasksResult, CompleteTaskOptions, CompleteTaskResult, DeleteTaskOptions, DeleteTaskResult, FindTasksOptions, FindTasksResult, ListTasksOptions, ListTasksResult, TaskCurrentResult, TaskStartResult, TaskWorkHistoryEntry, UpdateTaskOptions, UpdateTaskResult, }; /** * Store engine type. SQLite is the only supported engine (ADR-006). * @task T4647 */ export type StoreEngine = 'sqlite'; /** Common task filter options. */ export interface TaskFilters { status?: TaskStatus; parentId?: string | null; type?: TaskType; phase?: string; limit?: number; } /** Common session filter options. */ export interface SessionFilters { active?: boolean; limit?: number; } /** * Store provider interface. * Backed by SQLite (ADR-006 canonical storage). */ export interface StoreProvider { readonly engine: StoreEngine; createTask(task: Task): Promise; getTask(taskId: string): Promise; updateTask(taskId: string, updates: Partial): Promise; deleteTask(taskId: string): Promise; listTasks(filters?: TaskFilters): Promise; findTasks(query: string, limit?: number): Promise; archiveTask(taskId: string, reason?: string): Promise; createSession(session: Session): Promise; getSession(sessionId: string): Promise; updateSession(sessionId: string, updates: Partial): Promise; listSessions(filters?: SessionFilters): Promise; endSession(sessionId: string, note?: string): Promise; startTaskOnSession(sessionId: string, taskId: string): Promise; getCurrentTaskForSession(sessionId: string): Promise<{ taskId: string | null; since: string | null; }>; stopTaskOnSession(sessionId: string): Promise; close(): Promise; /** Add a task with full validation, ID generation, and logging. */ addTask(options: AddTaskOptions): Promise; /** Complete a task with dependency checks and optional auto-completion. */ completeTask(options: CompleteTaskOptions): Promise; /** Update a task with rich options (addLabels, removeDepends, etc.). */ richUpdateTask(options: UpdateTaskOptions): Promise; /** Show a task by ID (throws CleoError if not found). */ showTask(taskId: string): Promise; /** Delete a task with force/cascade options. */ richDeleteTask(options: DeleteTaskOptions): Promise; /** Find tasks with fuzzy/ID/exact search and filtering. */ richFindTasks(options: FindTasksOptions): Promise; /** List tasks with full filtering and pagination. */ richListTasks(options: ListTasksOptions): Promise; /** Archive tasks in batch with filtering options. */ richArchiveTasks(options: ArchiveTasksOptions): Promise; /** Start a new session with scope, auto-start, etc. */ startSession(options: { name: string; scope: string; autoStart?: boolean; startTask?: string; agent?: string; }): Promise; /** End a session, optionally by ID with a note. */ richEndSession(options?: { sessionId?: string; note?: string; }): Promise; /** Get the current active session status. */ sessionStatus(): Promise; /** Resume a previously ended session. */ resumeSession(sessionId: string): Promise; /** List sessions with status/limit filters. */ richListSessions(options?: { status?: string; limit?: number; }): Promise; /** Garbage collect old sessions. */ gcSessions(maxAgeHours?: number): Promise<{ orphaned: string[]; removed: string[]; }>; /** Show current task work state. */ currentTask(): Promise; /** Start working on a task by ID. */ startTask(taskId: string): Promise; /** Stop working on the current task. */ stopTask(): Promise<{ previousTask: string | null; }>; /** Get task work history. */ getWorkHistory(): Promise; /** List all labels with task counts. */ listLabels(): Promise; }>>; /** Show tasks with a specific label. */ showLabelTasks(label: string): Promise>; /** Get detailed label statistics. */ getLabelStats(): Promise>; /** Suggest related tasks based on shared attributes. */ suggestRelated(taskId: string, opts?: { threshold?: number; }): Promise>; /** Add a relationship between two tasks. */ addRelation(from: string, to: string, type: string, reason: string): Promise>; /** Discover related tasks using various methods. */ discoverRelated(taskId: string): Promise>; /** List existing relations for a task. */ listRelations(taskId: string): Promise>; /** Analyze task priority with leverage scoring. */ analyzeTaskPriority(opts?: { autoStart?: boolean; }): Promise; } /** * Create a store provider. Always creates SQLite provider (ADR-006). * @task T4647 */ export declare function createStoreProvider(_engine?: StoreEngine, cwd?: string): Promise; //# sourceMappingURL=provider.d.ts.map