/** * pi-task - Task Store (SQLite-backed Kanban) * * Pure data layer. No framework dependencies. * Uses sql.js (WebAssembly SQLite) for cross-runtime compatibility. * Works in both Node.js and Bun environments. */ import { type Database as SqlJsDatabase } from "sql.js"; export type TaskStatus = "backlog" | "needs-assignment" | "in-progress" | "needs-review" | "blocked" | "done"; export type TaskPriority = "low" | "medium" | "high" | "critical"; export interface Task { id: string; title: string; description: string; status: TaskStatus; priority: TaskPriority; assignee?: string; sessionId: string; parentId?: string; tags: string[]; createdAt: number; updatedAt: number; completedAt?: number; metadata: Record; } export interface TaskComment { id: string; taskId: string; author: string; content: string; timestamp: number; } export interface TaskHistoryEntry { id: string; taskId: string; fromStatus: string | null; toStatus: string; changedBy: string; timestamp: number; note: string; } export declare const TASK_COLUMNS: { id: TaskStatus; label: string; emoji: string; }[]; /** * Initialize the task database. * Call with custom path for testing, or omit for default. * Must be called before any other operations. */ export declare function initDatabase(dbPath?: string): Promise; /** * Synchronous init for cases where sql.js is already loaded. * Prefer async initDatabase() when possible. */ export declare function initDatabaseSync(sqlJsModule: any, dbPath?: string): SqlJsDatabase; /** * Close the database connection and save. */ export declare function closeDatabase(): void; /** * Check if the database is initialized. */ export declare function isInitialized(): boolean; /** * Create a new task. */ export declare function createTask(title: string, description?: string, options?: Partial>, sessionId?: string): Task; /** * Get a task by ID (exact match or prefix). */ export declare function getTask(id: string): Task | null; /** * Update task status. Records history. */ export declare function updateTaskStatus(id: string, newStatus: TaskStatus, note?: string, changedBy?: string): boolean; /** * Assign a task. Moves to in-progress if in backlog/needs-assignment. */ export declare function assignTask(id: string, assignee: string, changedBy?: string): boolean; /** * Add a comment to a task. */ export declare function addComment(taskId: string, content: string, author?: string): boolean; /** * Get comments for a task. */ export declare function getComments(taskId: string): TaskComment[]; /** * List tasks with optional filters. */ export declare function listTasks(filter?: { status?: TaskStatus; sessionId?: string; assignee?: string; }): Task[]; /** * Get full kanban board. */ export declare function getBoard(): Record; /** * Delete a task. */ export declare function deleteTask(id: string): boolean; /** * Get task history. */ export declare function getTaskHistory(taskId: string): TaskHistoryEntry[];