import { z } from "zod"; import type { AgentProfile, Project } from "./config.js"; import type { WorkExecution } from "./work/schema.js"; export interface Issue { id: string; number: number; title: string; body: string; url: string; labels: string[]; open: boolean; } export interface ChangeRequest { id: number; url: string; head: string; } export interface ReviewRequest extends Issue { change: ChangeRequest; base: string; start: string; sourceBranch: string; targetBranch: string; draft: boolean; fork: boolean; } export type RunSubject = (Issue & { kind: "issue"; }) | LocalSubject | (ReviewRequest & { kind: "change-request"; }); export interface LocalSubject { kind: "local"; id: string; title: string; body: string; } export declare function subjectReference(subject: RunSubject): string; export declare class StaleReviewError extends Error { constructor(); } export declare function isStaleReviewError(error: unknown): error is Error; export declare function currentExecutionId(run: RunRecord): string; export declare const maxPublicationDescriptionLength = 60000; export declare const publicationSchema: z.ZodObject<{ commitMessage: z.ZodString; title: z.ZodString; description: z.ZodString; }, z.core.$strict>; export type Publication = z.infer; export declare const reviewPrioritySchema: z.ZodEnum<{ P0: "P0"; P1: "P1"; P2: "P2"; P3: "P3"; }>; export type ReviewPriority = z.infer; export declare const implementationSchema: z.ZodObject<{ summary: z.ZodString; validation: z.ZodArray; details: z.ZodString; }, z.core.$strict>>; limitations: z.ZodArray; }, z.core.$strict>; export type ImplementationReport = z.infer; export interface Readiness { draft: boolean; reasons: string[]; } export interface ReviewRound { round: number; snapshot: Snapshot; validation: ValidationResult[]; validationStatus: "skipped" | "passed" | "failed"; agentReport?: ImplementationReport; review: Review; readiness: Readiness; } export declare const reviewSchema: z.ZodObject<{ complete: z.ZodBoolean; limitations: z.ZodArray; summary: z.ZodString; findings: z.ZodArray>; path: z.ZodDefault>; line: z.ZodDefault>; }, z.core.$strict>>; }, z.core.$strict>; export type Review = z.input; export interface ReviewPositions { inline: Array<{ body: string; path: string; oldPath: string; line: number; }>; summaryFindings: string[]; } export interface ValidationResult { command: string; args: string[]; exitCode: number; log: string; startedAt: string; finishedAt: string; } export interface Snapshot { branch: string; head: string; fingerprint: string; paths: string[]; files: Record; } export interface ContributionCandidate { provider: string; beforeFiles: Record; afterFiles: Record; } export interface Workspace { check(project: Project): Promise; prepareReview(project: Project, request: ReviewRequest, signal?: AbortSignal): Promise; prepare(project: Project, branch: string, signal?: AbortSignal): Promise; inspect(project: Project): Promise; verify(project: Project, expected: Snapshot): Promise; commit(project: Project, expected: Snapshot, publication: Publication, runId: string, signal?: AbortSignal): Promise; push(project: Project, branch: string, head: string, signal?: AbortSignal): Promise; release(project: Project): Promise; } export interface HostingAdapter { listApprovalComments?(number: number): Promise>; identity: string; preflight?(): Promise; listChanges(labels: string[]): Promise; getChange(number: number): Promise; listIssues(labels: string[]): Promise; getIssue(number: number): Promise; /** Issue writes publish a human-confirmed Work contract and nothing else. */ createIssue?(input: { title: string; body: string; }): Promise; updateIssueBody?(number: number, body: string): Promise; /** Issues updated since `since` whose body contains `text`, open or closed. */ findIssues?(input: { text: string; since: string; }): Promise; findChange(branch: string): Promise; createChange(input: { branch: string; base: string; head: string; issue: Issue | LocalSubject; publication: Publication; runId: string; draft: boolean; }): Promise; head(change: ChangeRequest): Promise; publishReview(input: { change: ChangeRequest; head: string; review: Review; runId: string; positions: ReviewPositions; reviewTarget?: { request: ReviewRequest; labels: string[]; }; }): Promise; } export interface AgentInvocation { environment?: NodeJS.ProcessEnv; permissionMode?: "read-only" | "workspace-write"; inspectionBase?: string; id: string; runId: string; step: string; cwd: string; prompt: string; profile: AgentProfile; outputSchema?: Record; processFile?: string; resumeSessionId?: string; signal: AbortSignal; timeoutMs?: number; session: (id: string) => Promise; event: (event: unknown) => Promise; } export interface EffectiveProfile { provider: string; model: string; reasoningEffort: string; context: AgentProfile["context"] | "unknown"; contextWindowTokens: number | "unknown"; } export interface AgentAdapter { validate(profile: AgentProfile, signal?: AbortSignal): Promise; invoke(invocation: AgentInvocation): Promise; } export type Outcome = "queued" | "running" | "completed" | "failed" | "blocked" | "cancelled" | "no-change" | "ineligible" | "superseded"; export interface ExecutionRecord { /** DBOS workflow identity; review retries retain their original publication marker. */ id: string; recoveryOf?: string; startStep?: number; reusedSteps?: string[]; fingerprint: string; recoverySupported: boolean; createdAt: string; startedAt?: string; finishedAt?: string; outcome: Outcome; phase: string; failedStep?: number; error?: string; } export interface RunRecord { work?: WorkExecution; id: string; projectId: string; checkout: string; taskKey: string; attempt: number; retryOf?: string; subject: RunSubject; validationProfile?: string; outcome: Outcome; phase: string; createdAt: string; updatedAt: string; branch: string; base?: string; head?: string; snapshot?: Snapshot; validation?: ValidationResult[]; validationStatus?: "skipped" | "passed" | "failed"; publication?: Publication; agentReport?: ImplementationReport; reviewRounds?: ReviewRound[]; readiness?: Readiness; contributionCandidates?: ContributionCandidate[]; contributingProviders?: string[]; change?: ChangeRequest; review?: Review; reviewHead?: string; reviewPublicationId?: string; error?: string; failedStep?: number; stageLogs?: Array<{ executionId: string; step: string; path: string; }>; executions?: ExecutionRecord[]; } export declare class BlockedError extends Error { constructor(message: string); } export declare function isBlockedError(error: unknown): error is BlockedError;