import type { StorageEngine } from "./storage/index.js"; import { ArchiveStorage } from "./storage/index.js"; import { SyncRegistry } from "./sync/index.js"; import type { SyncConfig } from "./config.js"; import type { Task, CreateTaskInput, UpdateTaskInput, ListTasksInput, ArchivedTask } from "../types.js"; /** * Type guard to check if a task is an ArchivedTask. * ArchivedTask has archived_at field, while Task does not. */ export declare function isArchivedTask(task: Task | ArchivedTask): task is ArchivedTask; export interface TaskServiceOptions { storage?: StorageEngine | string; archiveStorage?: ArchiveStorage; syncRegistry?: SyncRegistry | null; syncConfig?: SyncConfig | null; } export interface BulkArchiveOptions { /** Archive tasks completed more than this duration ago (e.g., "30d", "12w", "6m") */ olderThan?: string; /** Archive ALL completed tasks (use with caution) */ archiveAllCompleted?: boolean; /** Task IDs to exclude from bulk archive */ exceptIds?: string[]; /** Preview what would be archived without making changes */ dryRun?: boolean; } export interface ArchiveResult { /** Archived tasks (in compacted format) */ archivedTasks: ArchivedTask[]; /** Number of root tasks archived */ rootCount: number; /** Total number of tasks archived (including descendants) */ totalCount: number; /** Original size in bytes (approximate) */ originalSize: number; /** Archived size in bytes (approximate) */ archivedSize: number; } export declare class TaskService { private storage; private archiveStorage; private syncRegistry; private syncConfig; constructor(options?: TaskServiceOptions | StorageEngine | string); /** * Get archive storage, creating a default one if not provided. */ private getArchiveStorage; /** * Sync a task to all registered integrations. * Respects auto-sync settings (on_change and max_age) for each integration. * Errors are caught and logged but don't fail the operation. */ private syncToIntegrations; /** * Get integration-specific config by service ID. */ private getIntegrationConfig; /** * Perform parallel sync to all registered integrations. */ private doSync; /** * Sync a task with a specific service and save metadata. */ private syncWithService; create(input: CreateTaskInput): Promise; update(input: UpdateTaskInput): Promise; /** * Delete a task and all its descendants. * Closes any associated remote issues (e.g., GitHub issues) before deleting. * @param id The task ID to delete * @returns The deleted task * @throws NotFoundError if the task does not exist */ delete(id: string): Promise; /** * Close remote issues for a set of tasks being deleted. * Errors are caught and logged but don't fail the delete operation. */ private closeRemoteIssues; getChildren(id: string): Promise; /** * Get the ancestors of a task, from root to immediate parent. * Returns an empty array for root-level tasks. */ getAncestors(id: string): Promise; /** * Get the nesting depth of a task. * 0 = root (epic), 1 = task under epic, 2 = subtask */ getDepth(id: string): Promise; get(id: string): Promise; /** * Get a task by ID, checking archive if not found in active tasks. * Returns Task, ArchivedTask, or null. */ getWithArchive(id: string): Promise; list(input?: ListTasksInput): Promise; /** * List archived tasks with optional query filter. */ listArchived(query?: string): ArchivedTask[]; /** * Search tasks by query, optionally including archived tasks. * @param query Search query to match against name and description/result * @param options Search options * @returns Array of active tasks and optionally archived tasks */ search(query: string, options?: { includeArchive?: boolean; }): Promise>; complete(id: string, result: string, metadata?: Task["metadata"], options?: { force?: boolean; }): Promise; /** * Mark a task as in progress (started). * @param id The task ID to start * @param options Options for starting the task * @param options.force If true, allows re-starting an already-started task * @returns The updated task * @throws NotFoundError if the task does not exist * @throws ValidationError if the task is already completed or already started (without force) */ start(id: string, options?: { force?: boolean; }): Promise; /** * Get incomplete blockers for a task. * Returns an array of tasks that are blocking this one (not yet completed). */ getIncompleteBlockers(id: string): Promise; /** * Get tasks that this task is blocking (that depend on this task). */ getBlockedTasks(id: string): Promise; getStoragePath(): string; /** * Archive a single task and all its descendants. * @param id The task ID to archive * @returns Archive result with compacted tasks and stats * @throws NotFoundError if task doesn't exist * @throws ValidationError if task can't be archived */ archive(id: string): Promise; /** * Bulk archive completed tasks based on criteria. * @param options Bulk archive options * @returns Archive result with compacted tasks and stats, or null if no tasks to archive */ bulkArchive(options: BulkArchiveOptions): Promise; /** * Execute the archive operation for collected task sets. */ private executeArchive; /** * Parse a duration string like "30d", "12w", "6m" into milliseconds. */ private parseDuration; } //# sourceMappingURL=task-service.d.ts.map