export type UltragoalStatus = "active" | "awaiting_gate" | "complete"; export type StoryStatus = "pending" | "in_progress" | "complete" | "failed" | "superseded"; export interface UltragoalCriterion { id: string; text: string; evidence: UltragoalEvidence[]; } export interface UltragoalEvidence { id: string; criterionId: string; kind: "file" | "note"; summary: string; path?: string; sha256: string; planRevision: number; recordedAt: string; } export interface UltragoalStory { id: string; title: string; objective: string; status: StoryStatus; attempts: number; criteria: UltragoalCriterion[]; startedAt?: string; completedAt?: string; supersededBy?: string[]; resolver?: { role: "verifier" | "code-reviewer" | "architect"; gateRevision: number; }; } export interface UltragoalGateSummary { status: "passed" | "blocked"; planRevision: number; artifactPath: string; recordedAt: string; } interface UltragoalOperation { fingerprint: string; revision: number; } export interface UltragoalManifest { schemaVersion: 1; planId: string; sessionId: string; sessionKey: string; goalGeneration?: string; objective: string; status: UltragoalStatus; revision: number; activeStoryId: string | null; source: { kind: "objective" | "ralplan"; sha256: string; snapshotPath: string; originalPath?: string; }; stories: UltragoalStory[]; lastGate?: UltragoalGateSummary; operations: Record; lastLedgerHash: string | null; createdAt: string; updatedAt: string; } export interface StoryInput { title: string; objective: string; criteria?: string[]; } export interface CreateUltragoalInput { cwd: string; sessionId: string; operationId: string; objective: string; goalGeneration?: string; stories?: StoryInput[]; planFile?: string; } export interface UltragoalMutationInput { cwd: string; sessionId: string; operationId: string; } export interface AttachEvidenceInput extends UltragoalMutationInput { storyId: string; criterionId: string; summary: string; file?: string; } export type SteeringKind = "add" | "split" | "reorder" | "revise" | "annotate" | "supersede"; export interface SteerUltragoalInput extends UltragoalMutationInput { kind: SteeringKind; evidence: string; rationale: string; targetStoryId?: string; stories?: StoryInput[]; pendingOrder?: string[]; title?: string; objective?: string; criteria?: string[]; } export interface UltragoalPaths { root: string; directory: string; sessionKey: string; manifest: string; brief: string; ledger: string; lock: string; pending: string; evidenceDirectory: string; gateDirectory: string; } export interface GateRoleResult { role: "verifier" | "code-reviewer" | "architect"; verdict: "PASS" | "BLOCK" | "INCONCLUSIVE"; planRevision: number; summary: string; outputPath: string; outputSha256: string; exitCode: number; timedOut: boolean; overflowed: boolean; } export interface UltragoalGateResult { schemaVersion: 1; status: "passed" | "blocked"; planRevision: number; roles: GateRoleResult[]; createdAt: string; artifactPath: string; } export declare class UltragoalError extends Error { readonly code: string; constructor(code: string, message: string); } export declare function ultragoalPaths(cwd: string, rawSessionId: string): UltragoalPaths; export declare function readUltragoal(cwd: string, rawSessionId: string): UltragoalManifest; export declare function createUltragoal(input: CreateUltragoalInput): UltragoalManifest; export declare function startNextUltragoalStory(input: UltragoalMutationInput): UltragoalManifest; export declare function attachUltragoalEvidence(input: AttachEvidenceInput): UltragoalManifest; export declare function checkpointUltragoalStory(input: UltragoalMutationInput & { storyId: string; }): UltragoalManifest; export declare function steerUltragoal(input: SteerUltragoalInput): UltragoalManifest; export declare function applyUltragoalGate(input: UltragoalMutationInput & { gate: UltragoalGateResult; }): UltragoalManifest; export {};