import type { BuildOutputContract, BuildValidationKind, CompiledBuildPlan } from "./buildPlan.js"; import { type ArtifactReference, type GraphExecutionState } from "./scheduler.js"; export type BuildDispatchBlockCode = "checkout-trust-required" | "concurrency-limit" | "graph-step-limit" | "human-integration-required" | "parallel-write-disabled" | "resource-conflict" | "shared-workspace-busy" | "worktree-not-owned" | (string & {}); export interface BuildDispatchPolicy { now: string; unattended: boolean; allowParallelWrites: boolean; trustRepositoryCheckout: boolean; worktreeOwnerships: readonly Readonly[]; } export interface BuildWorktreeOwnershipProof { schemaVersion: 1; intentId: string; runId: string; nodeId: string; planVersion: number; planHash: string; baseSha: string; reconciled: true; cleanupStatus: "active"; } export interface BuildDispatchNode { nodeId: string; handler: "inspect" | "design" | "implement" | "validate"; workspace: "shared" | "isolated-worktree"; toolPolicy: "read-only" | "declared-writes" | "reviewed-validation"; timeoutMs: number; idempotencyKey: string; worktreeOwnershipId?: string; targetWorktreeNodeId?: string; } export interface BuildDispatchBlock { nodeId: string; code: BuildDispatchBlockCode; } export interface BuildDispatchPlan { dispatch: readonly Readonly[]; blocked: readonly Readonly[]; humanIntegrationNodeId?: string; } export interface BuildOutputObservation { contractId: string; validation: BuildValidationKind; artifact: ArtifactReference; } export interface BuildArtifactInspection { exists: boolean; sha256: string; sizeBytes: number; structured?: { validatorRef: string; valid: boolean; }; reviewedCommand?: { validatorRef: string; approved: boolean; exitCode: number; evidenceSha256: string; }; } export interface BuildWorkspaceInspection { schemaVersion: 1; ownership: Readonly; changedPaths: readonly string[]; stagedPaths: readonly string[]; } export interface BuildOutputValidationAdapter { /** Trusted runtime boundary: inspect bytes and execute only the pre-reviewed validator reference. */ inspect(input: Readonly<{ runId: string; planHash: string; nodeId: string; contract: Readonly; artifact: Readonly; }>): unknown; /** Trusted runtime boundary: reconcile Git and inspect the target worktree after validators run. */ inspectWorkspace?(input: Readonly<{ runId: string; planVersion: number; planHash: string; nodeId: string; targetWorktreeNodeId: string; declaredWriteSet: readonly string[]; }>): unknown; } /** * Select one deterministic dispatch batch without mutating scheduler authority. * Model/tool invocation and worktree creation remain separate guarded effects. */ export declare function planBuildDispatch(compiled: Readonly, state: Readonly, policyValue: Readonly): BuildDispatchPlan; /** * Convert already-inspected validator evidence to scheduler artifact refs. * This function never infers success from file existence or model prose. */ export declare function validateBuildNodeOutputs(compiled: Readonly, state: Readonly, nodeId: string, observationsValue: readonly Readonly[], adapter: Readonly): readonly Readonly[];