export declare const TASK_RUN_SCHEMA_VERSION: 2; export type TaskOutcome = "verified" | "completed" | "failed" | "aborted"; export type VerificationStatus = "passed" | "failed" | "not-run" | "unknown"; export type TaskCategory = "bug-fix" | "feature" | "refactor" | "test-repair" | "dependency" | "review" | "documentation" | "investigation" | "other"; export type FileOperationKind = "read" | "create" | "create-or-update" | "edit" | "delete" | "unknown-mutation"; export type SkillActivation = "loaded" | "inferred" | "explicit"; export interface SkillCheckpointDeclaration { id: string; description?: string; tool?: string; commandPattern?: string; filePattern?: string; required?: boolean; } export interface SkillCheckpointResult { id: string; description?: string; status: "followed" | "deviated"; evidence?: string; } export interface SkillSnapshot { name: string; filePath: string; contentHash?: string; activation: SkillActivation; checkpoints: SkillCheckpointResult[]; checkpointDeclarations?: SkillCheckpointDeclaration[]; } export interface FileOperation { path: string; operation: FileOperationKind; toolCallId: string; succeeded: boolean; } export interface ToolTrace { id: string; name: string; startedAt: string; finishedAt?: string; durationMs?: number; input: unknown; outputPreview?: string; isError: boolean; errorFingerprint?: string; } export type ValidationKind = "test" | "typecheck" | "lint" | "build" | "verify" | "other"; export interface ValidationTrace { toolCallId: string; kind: ValidationKind; command: string; passed: boolean; timestamp: string; durationMs?: number; summary?: string; failureReasons?: string[]; } export interface UserRevision { timestamp: string; text: string; delivery: "new-prompt" | "steer" | "follow-up"; correction: boolean; } export interface TaskRunDraft { schemaVersion: typeof TASK_RUN_SCHEMA_VERSION; id: string; sessionFile?: string; cwd: string; objective: string; category: TaskCategory; revisions: UserRevision[]; startedAt: string; turns: number; tools: ToolTrace[]; files: FileOperation[]; validations: ValidationTrace[]; skills: SkillSnapshot[]; contextHash?: string; assistantError?: string; aborted: boolean; } export interface WorkflowMetrics { durationMs: number; turns: number; toolCalls: number; failedToolCalls: number; readCalls: number; mutationCalls: number; validationCalls: number; passedValidations: number; failedValidations: number; /** Failed validation attempts beyond the first one in the longest consecutive streak. */ repeatedValidationFailures: number; /** Failed validation attempts followed by at least one source mutation before the next validation. */ validationRepairCycles: number; /** Successful mutations beyond the first mutation of each file. */ repeatedMutationCalls: number; /** Repair mutations made before that file was re-read after a failed validation. */ uninspectedRepairMutations: number; timeToFirstMutationMs?: number; repeatedErrorCount: number; uniqueFilesRead: number; uniqueFilesMutated: number; userCorrections: number; skillCheckpointCoverage?: number; } export type FindingKind = "exploration" | "edit-quality" | "error-recovery" | "rework" | "blind-edit" | "verification" | "tool-reliability" | "goal-understanding" | "skill-adherence"; export interface ReviewFinding { kind: FindingKind; severity: "info" | "warning"; title: string; evidence: string; recommendation: string; } export interface SkillCandidate { kind: FindingKind; trigger: string; instruction: string; evidence: string; } export interface TaskReview { summary: string; findings: ReviewFinding[]; skillCandidates: SkillCandidate[]; } export interface TaskRun extends TaskRunDraft { session?: SessionRunIdentity; settledAt: string; outcome: TaskOutcome; verificationStatus: VerificationStatus; metrics: WorkflowMetrics; review: TaskReview; } export interface SessionRunIdentity { /** Stable local identity derived from the Pi session filename. */ id: string; /** Short display label that does not expose the full session path. */ label: string; runIndex: number; totalRuns: number; } export interface BottleneckAggregate { kind: FindingKind; count: number; affectedRunIds: string[]; } export interface CategoryAggregate { category: TaskCategory; count: number; verified: number; averageDurationMs: number; } export interface SkillVersionAggregate { name: string; contentHash?: string; runs: number; explicitRuns: number; verifiedRuns: number; checkpointCoverage?: number; } export interface WorkflowInsights { totalRuns: number; totalSessions: number; verifiedRuns: number; verificationRate: number; averageDurationMs: number; averageToolCalls: number; userCorrectionRate: number; repeatedErrorRuns: number; unverifiedMutationRuns: number; bottlenecks: BottleneckAggregate[]; categories: CategoryAggregate[]; skillVersions: SkillVersionAggregate[]; skillCandidates: AggregatedSkillCandidate[]; } export interface AggregatedSkillCandidate { kind: FindingKind; trigger: string; instruction: string; occurrences: number; evidenceRunIds: string[]; }