import { Database } from "sqlite"; import { Connection } from "../../sqlite/connection.js"; export type JobStatus = "queued" | "running" | "paused" | "completed" | "failed" | "cancelled" | "partial"; export type CommandStatus = "running" | "succeeded" | "failed" | "cancelled"; export type TaskRunStatus = "queued" | "running" | "succeeded" | "failed" | "cancelled"; export interface ProjectRow { id: string; key: string; name?: string; description?: string; metadata?: Record; createdAt: string; updatedAt: string; } export interface EpicInsert { projectId: string; key: string; title: string; description: string; storyPointsTotal?: number | null; priority?: number | null; metadata?: Record; } export interface EpicRow extends EpicInsert { id: string; createdAt: string; updatedAt: string; } export interface StoryInsert { projectId: string; epicId: string; key: string; title: string; description: string; acceptanceCriteria?: string | null; storyPointsTotal?: number | null; priority?: number | null; metadata?: Record; } export interface StoryRow extends StoryInsert { id: string; createdAt: string; updatedAt: string; } export interface TaskInsert { projectId: string; epicId: string; userStoryId: string; key: string; title: string; description: string; type?: string | null; status: string; storyPoints?: number | null; priority?: number | null; assignedAgentId?: string | null; assigneeHuman?: string | null; vcsBranch?: string | null; vcsBaseBranch?: string | null; vcsLastCommitSha?: string | null; metadata?: Record; openapiVersionAtCreation?: string | null; } export interface TaskRow extends TaskInsert { id: string; createdAt: string; updatedAt: string; } export interface ProjectBacklogSummary { taskCount: number; nonNotStartedTaskCount: number; taskRunCount: number; taskQaRunCount: number; taskCommentCount: number; taskReviewCount: number; taskRevisionCount: number; taskLogCount: number; } export interface TaskDependencyInsert { taskId: string; dependsOnTaskId: string; relationType: string; } export interface TaskDependencyRow extends TaskDependencyInsert { id: string; createdAt: string; updatedAt: string; } export interface JobInsert { workspaceId: string; type: string; state: JobStatus; commandName?: string; payload?: Record; totalItems?: number | null; processedItems?: number | null; lastCheckpoint?: string | null; agentId?: string | null; agentIds?: string[] | null; } export interface JobRow extends JobInsert { id: string; createdAt: string; updatedAt: string; completedAt?: string | null; errorSummary?: string | null; } export interface CommandRunInsert { workspaceId: string; commandName: string; jobId?: string | null; agentId?: string | null; taskIds?: string[]; gitBranch?: string | null; gitBaseBranch?: string | null; startedAt: string; status: CommandStatus; spProcessed?: number | null; } export interface CommandRunRow extends CommandRunInsert { id: string; completedAt?: string | null; errorSummary?: string | null; durationSeconds?: number | null; } export interface TaskRunInsert { taskId: string; command: string; status: TaskRunStatus; jobId?: string | null; commandRunId?: string | null; agentId?: string | null; startedAt: string; finishedAt?: string | null; storyPointsAtRun?: number | null; spPerHourEffective?: number | null; gitBranch?: string | null; gitBaseBranch?: string | null; gitCommitSha?: string | null; runContext?: Record; } export interface TaskRunRow extends TaskRunInsert { id: string; } export interface TaskStatusEventInsert { taskId: string; fromStatus?: string | null; toStatus: string; timestamp: string; commandName?: string | null; jobId?: string | null; taskRunId?: string | null; agentId?: string | null; metadata?: Record | null; } export interface TaskLockRow { taskId: string; taskRunId: string; jobId?: string; acquiredAt: string; expiresAt: string; } export interface TaskQaRunInsert { taskId: string; taskRunId?: string | null; jobId?: string | null; commandRunId?: string | null; agentId?: string | null; modelName?: string | null; source: string; mode?: string | null; profileName?: string | null; runner?: string | null; rawOutcome?: string | null; recommendation?: string | null; evidenceUrl?: string | null; artifacts?: string[] | null; rawResult?: Record | null; startedAt?: string | null; finishedAt?: string | null; metadata?: Record | null; createdAt?: string; } export interface TaskQaRunRow extends TaskQaRunInsert { id: string; } export interface TokenUsageInsert { workspaceId: string; agentId?: string | null; modelName?: string | null; jobId?: string | null; commandRunId?: string | null; taskRunId?: string | null; taskId?: string | null; projectId?: string | null; epicId?: string | null; userStoryId?: string | null; commandName?: string | null; action?: string | null; invocationKind?: string | null; provider?: string | null; currency?: string | null; tokensPrompt?: number | null; tokensCompletion?: number | null; tokensTotal?: number | null; tokensCached?: number | null; tokensCacheRead?: number | null; tokensCacheWrite?: number | null; costEstimate?: number | null; durationSeconds?: number | null; durationMs?: number | null; startedAt?: string | null; finishedAt?: string | null; timestamp: string; metadata?: Record; } export interface TaskRevisionInsert { taskId: string; jobId?: string | null; commandRunId?: string | null; snapshotBefore?: Record | null; snapshotAfter?: Record | null; createdAt: string; } export interface TaskCommentInsert { taskId: string; taskRunId?: string | null; jobId?: string | null; sourceCommand: string; authorType: "agent" | "human"; authorAgentId?: string | null; category?: string | null; slug?: string | null; status?: string | null; file?: string | null; line?: number | null; pathHint?: string | null; body: string; metadata?: Record | null; createdAt: string; resolvedAt?: string | null; resolvedBy?: string | null; } export interface TaskCommentRow extends TaskCommentInsert { id: string; } export interface TaskReviewInsert { taskId: string; jobId?: string | null; agentId?: string | null; modelName?: string | null; decision: string; summary?: string | null; findingsJson?: Record | unknown[] | null; testRecommendationsJson?: string[] | null; metadata?: Record | null; createdAt: string; createdBy?: string | null; } export interface TaskReviewRow extends TaskReviewInsert { id: string; } export declare class WorkspaceRepository { private db; private connection?; private static txLocks; private workspaceKey; constructor(db: Database, connection?: Connection | undefined); static create(cwd?: string): Promise; close(): Promise; getDb(): Database; private serialize; withTransaction(fn: () => Promise): Promise; getProjectByKey(key: string): Promise; getProjectById(id: string): Promise; createProjectIfMissing(input: { key: string; name?: string; description?: string; }): Promise; insertEpics(epics: EpicInsert[], useTransaction?: boolean): Promise; insertStories(stories: StoryInsert[], useTransaction?: boolean): Promise; insertTasks(tasks: TaskInsert[], useTransaction?: boolean): Promise; updateStoryPointsTotal(storyId: string, total: number | null): Promise; updateEpicStoryPointsTotal(epicId: string, total: number | null): Promise; insertTaskDependencies(deps: TaskDependencyInsert[], useTransaction?: boolean): Promise; deleteTaskDependenciesForTask(taskId: string): Promise; deleteProjectBacklog(projectId: string, useTransaction?: boolean): Promise; updateTask(taskId: string, updates: { title?: string; description?: string | null; type?: string | null; status?: string; storyPoints?: number | null; priority?: number | null; metadata?: Record | null; assignedAgentId?: string | null; assigneeHuman?: string | null; vcsBranch?: string | null; vcsBaseBranch?: string | null; vcsLastCommitSha?: string | null; }): Promise; recordTaskStatusEvent(entry: TaskStatusEventInsert): Promise; getTaskById(taskId: string): Promise; getTaskByKey(taskKey: string): Promise; listTasksByMetadataValue(projectId: string, metadataKey: string, metadataValue: string): Promise; getTasksByIds(taskIds: string[]): Promise; listEpicKeys(projectId: string): Promise; listStoryKeys(epicId: string): Promise; listTaskKeys(userStoryId: string): Promise; getProjectBacklogSummary(projectId: string): Promise; createJob(record: JobInsert): Promise; listJobs(): Promise; getJob(id: string): Promise; updateJobState(id: string, update: Partial & { state?: JobStatus; errorSummary?: string | null; completedAt?: string | null; }): Promise; createCommandRun(record: CommandRunInsert): Promise; setCommandRunJobId(id: string, jobId: string): Promise; setCommandRunAgentId(id: string, agentId: string): Promise; setJobAgentIds(id: string, agentId: string): Promise; completeCommandRun(id: string, update: { status: CommandStatus; completedAt: string; errorSummary?: string | null; durationSeconds?: number | null; spProcessed?: number | null; }): Promise; getTasksWithRelations(taskIds: string[]): Promise>; createTaskRun(record: TaskRunInsert): Promise; getTaskLock(taskId: string): Promise; cleanupExpiredTaskLocks(nowIso?: string): Promise; releaseTaskLocksByJob(jobId: string): Promise; tryAcquireTaskLock(taskId: string, taskRunId: string, jobId?: string | null, ttlSeconds?: number): Promise<{ acquired: boolean; lock?: TaskLockRow; }>; releaseTaskLock(taskId: string, taskRunId: string): Promise; refreshTaskLock(taskId: string, taskRunId: string, ttlSeconds?: number): Promise; createTaskQaRun(record: TaskQaRunInsert): Promise; listTaskQaRuns(taskId: string): Promise; listTaskQaRunsForJob(taskIds: string[], jobId: string): Promise; insertTaskLog(entry: { taskRunId: string; sequence: number; timestamp: string; level?: string | null; source?: string | null; message?: string | null; details?: Record | null; }): Promise; updateTaskRun(id: string, update: { status?: TaskRunStatus; finishedAt?: string | null; gitBranch?: string | null; gitBaseBranch?: string | null; gitCommitSha?: string | null; storyPointsAtRun?: number | null; spPerHourEffective?: number | null; runContext?: Record | null; }): Promise; getTaskDependencies(taskIds: string[]): Promise; createTaskComment(record: TaskCommentInsert): Promise; listTaskComments(taskId: string, options?: { sourceCommands?: string[]; limit?: number; slug?: string | string[]; resolved?: boolean; }): Promise; resolveTaskComment(params: { taskId: string; slug: string; resolvedAt: string; resolvedBy?: string | null; }): Promise; reopenTaskComment(params: { taskId: string; slug: string; }): Promise; createTaskReview(record: TaskReviewInsert): Promise; getLatestTaskReview(taskId: string): Promise; recordTokenUsage(entry: TokenUsageInsert): Promise; insertTaskRevision(record: TaskRevisionInsert): Promise; getEpicByKey(projectId: string, key: string): Promise; getStoryByKey(epicId: string, key: string): Promise; getStoryByProjectAndKey(projectId: string, key: string): Promise; } //# sourceMappingURL=WorkspaceRepository.d.ts.map