import { type RuntimeRecord } from "../domain/records.js"; import { type GoalArtifactReference, type GoalArtifactStore } from "./artifact-store.js"; export type GoalState = "active" | "parked" | "completed"; export type GoalParkReason = "native-goal-mismatch" | "stale-native-snapshot" | "predicate-failed" | "ultragoal-mismatch"; type NativeRef = GoalArtifactReference & { readonly kind: "native-goal-snapshot"; }; type TeamRef = GoalArtifactReference & { readonly kind: "team-checkpoint"; }; type UltragoalRef = GoalArtifactReference & { readonly kind: "ultragoal-checkpoint"; }; type RegressionRef = GoalArtifactReference & { readonly kind: "regression-request"; }; export type GoalPayload = { goal_id: string; objective: string; repository_scope: string; queue_scope: string; stopping_condition: string; runtime_horizon: "until-empty" | "12h" | "24h"; budget_profile: "subscription-only"; policy_profile: "default"; creation_nonce: string; created_at: string; updated_at: string; native_snapshot: NativeRef | null; team_checkpoint: TeamRef | null; ultragoal_checkpoint: UltragoalRef | null; regression_request: RegressionRef | null; park_reason: GoalParkReason | null; } & Record; export type GoalRecord = RuntimeRecord; export interface GoalAuthority { read(goalId: string): Readonly; } export interface GoalPlanGate { readonly goal_id: string; readonly goal_version: number; readonly goal_state: "active"; readonly objective_sha256: string; readonly stopping_condition_sha256: string; readonly goal_record_path: string; } export interface CreateGoalInput { readonly objective: string; readonly stoppingCondition: string; readonly repositoryScope: string; readonly queueScope?: string; readonly runtimeHorizon?: "until-empty" | "12h" | "24h"; readonly budgetProfile?: "subscription-only"; readonly policyProfile?: "default"; readonly creationNonce?: string; readonly leaderId: string; readonly createdAt: string; } export interface CreateGoalOperationResult { readonly status: "created" | "replayed"; readonly goal: Readonly; } export type GoalEvidenceOperationResult = { readonly status: "attached" | "completed"; readonly goal: Readonly; readonly artifact: GoalArtifactReference; } | { readonly status: "parked"; readonly goal: Readonly; readonly regression: RegressionRef; }; export declare function createGoalAuthority(options: { recordsRoot: string; locksRoot: string; artifactStore: GoalArtifactStore; packageRoot?: string; }): GoalAuthority; export declare function assertGoalAuthority(value: unknown): asserts value is GoalAuthority; export declare function createGoal(authority: GoalAuthority, input: CreateGoalInput): Readonly; export declare function createGoalWithReplay(authority: GoalAuthority, input: CreateGoalInput): CreateGoalOperationResult; export declare function readGoal(authority: GoalAuthority, goalId: string): Readonly; export declare function issueActiveGoalPlanGate(authority: GoalAuthority, goalId: string): GoalPlanGate; export declare function assertGoalPlanGate(value: unknown): asserts value is GoalPlanGate; export declare function assertFreshGoalPlanGate(gate: GoalPlanGate): void; export declare function recordNativeGoalSnapshot(options: { authority: GoalAuthority; goalId: string; snapshot: unknown; observedAt: string; }): GoalEvidenceOperationResult; export declare function recordTeamCheckpoint(options: { authority: GoalAuthority; goalId: string; teamState: unknown; }): GoalEvidenceOperationResult; export declare function recordBrokenGoalPredicate(options: { authority: GoalAuthority; goalId: string; predicateId: string; expectedSha256: string; actualSha256: string; observedAt: string; }): GoalEvidenceOperationResult; export declare function checkpointUltragoal(options: { authority: GoalAuthority; goalId: string; leaderId: string; nativeSnapshot: GoalArtifactReference; teamCheckpoint: GoalArtifactReference; checkpointedAt: string; }): GoalEvidenceOperationResult; export {};