import type { NativeChildrenContract } from './native-children-contract.js'; import type { NativeChildrenInspection } from './native-children.js'; import { type NativeVerifierAcceptanceResult } from './native-verifier-protocol.js'; export declare function assertCommit(value: string, label: string): void; export declare const NATIVE_SUPERVISOR_SCHEMA: "comet.native.supervisor.v2"; export declare const NATIVE_MAX_SUPERVISOR_BUILDER_FAILURES = 3; export type NativeSupervisorChildStatus = 'pending' | 'ready' | 'active' | 'verified' | 'integrated' | 'archived' | 'blocked' | 'needs-reverify'; export interface NativeSupervisorVerificationEvidence { summary: string; checks: string[]; acceptance?: NativeVerifierAcceptanceResult[]; receiptRef?: string; execution?: NativeSupervisorTask; } export interface NativeSupervisorIntegrationCheck { name: string; status: 'passed' | 'failed' | 'incomplete'; reason?: string | null; receiptRef?: string; } export interface NativeSupervisorCheckExecutionState { id: string; name: string; status: 'planned' | 'running' | 'passed' | 'failed' | 'interrupted'; repeatable: boolean; executionCount: number; argvDisplay: string[]; cwdRef: string; exitCode: number | null; signal: NodeJS.Signals | null; timedOut: boolean; durationMs: number; startedAt: string | null; completedAt: string | null; logRef: string | null; } export interface NativeSupervisorTask { role: 'builder' | 'verifier'; child: string; projectRoot: string; baseCommit: string; runId: string; acceptance?: Array<{ id: string; source: string; text: string; }>; contractHash?: string; verificationBoundary?: 'child-scope-parent-reverifies-all'; checksReason?: 'not-run' | 'running' | 'completed'; checkExecution?: { operationId: string; key: string; status: 'running' | 'completed' | 'interrupted'; ownerPid: number; ownerIdentity?: string; activeProcess?: null | { status: 'starting'; checkId: string; } | { status: 'running'; checkId: string; pid: number; identity?: string; }; startedAt: string; expiresAt?: string; receiptRef?: string; machineId?: string; inputFingerprint?: string; checkStates?: NativeSupervisorCheckExecutionState[]; }; } export interface NativeSupervisorEvent { kind: 'task-dispatched' | 'task-reconnected' | 'task-cancelled' | 'task-blocked' | 'builder-result' | 'verifier-result' | 'child-integrated' | 'child-verified' | 'integration-head-reconciled' | 'target-refreshed' | 'delivery-reconciled'; child: string | null; runId: string | null; summary: string; at: string; } export interface NativeSupervisorChildState { name: string; summary: string | null; dependsOn: string[]; status: NativeSupervisorChildStatus; baseCommit: string | null; candidateCommit: string | null; verifiedCommit: string | null; integrationCommit: string | null; verification: NativeSupervisorVerificationEvidence | null; checks: NativeSupervisorIntegrationCheck[]; blocker: string | null; /** Last known Child worktree; retained after a task completes for recovery/status. */ projectRoot?: string | null; task: NativeSupervisorTask | null; acceptanceScope?: Array<{ id: string; source: string; text: string; }>; contractHash?: string; /** Consecutive Builder failures for this child since its last candidate. */ builderFailureCount?: number; } export interface NativeSupervisorState { schema: typeof NATIVE_SUPERVISOR_SCHEMA; stateVersion: number; parent: string; integration: { branch: string; worktree: string; targetBranch: string; targetCommit: string; headCommit: string; checkExecution?: NonNullable & { child: string; candidateCommit: string; integrationCommit: string; checks?: NativeSupervisorIntegrationCheck[]; error?: string; }; }; children: NativeSupervisorChildState[]; history: NativeSupervisorEvent[]; finalVerification: { status: 'pending' | 'passed' | 'failed' | 'incomplete'; summary: string | null; layers?: { childVerification: 'complete' | 'incomplete'; parentIntegration: 'complete' | 'incomplete'; parentChecks: string[]; notRerun: string[]; incomplete: string[]; }; }; } export declare function cloneState(state: NativeSupervisorState): NativeSupervisorState; export declare function recordEvent(state: NativeSupervisorState, event: Omit): void; export declare function assertChildDependenciesIntegrated(state: NativeSupervisorState, child: NativeSupervisorChildState): void; /** * Single source of truth for the dependency gate: whether every declared * dependency of a child is integrated. Both the state derivation after a * confirmed contract change and the dispatch-time assertion read this, so the * derivation can never produce a `ready` child the dispatcher would reject. * Integrated and archived statuses are immutable during reconciliation, which * keeps a single pass over the child list correct. */ export declare function supervisorDependenciesIntegrated(dependsOn: readonly string[], children: readonly NativeSupervisorChildState[]): boolean; export declare function stableSupervisorIntegrationOrder(state: NativeSupervisorState): NativeSupervisorChildState[]; export declare function createNativeSupervisorState(options: { parent: string; targetBranch: string; targetCommit: string; integrationBranch: string; integrationWorktree: string; contract: NativeChildrenContract; }): NativeSupervisorState; export declare function supervisorAcceptanceScope(contract: NativeChildrenContract, name: string): { id: string; source: string; text: string; }[]; export declare function reconcileNativeSupervisorState(options: { state: NativeSupervisorState; contract: NativeChildrenContract; }): NativeSupervisorState; export declare function markNativeSupervisorChildVerified(state: NativeSupervisorState, options: { name: string; baseCommit: string; verifiedCommit: string; evidence: NativeSupervisorVerificationEvidence; }): NativeSupervisorState; /** Build return instructions from current task facts, including the latest receipt. */ export declare function projectNativeSupervisorTask(task: NativeSupervisorTask, parent: string, controlProjectRoot: string): { controlProjectRoot: string; returnAction: { cwd: string; commandArgs: string[]; inputOptions: { name: string; exclusiveGroup: string; template: { candidateCommit: string; child: string; runId: string; kind: string; } | { reason: string; child: string; runId: string; kind: string; } | { retry_check_ids?: string[] | undefined; checks: { id: string; name: string; executable: string; argv: never[]; cwdRef: string; timeoutMs: number; repeatable: boolean; }[]; materials: never[]; child: string; runId: string; kind: string; } | { verdict: string; evidence: { summary: string; checks: never[]; acceptance: { id: string; result: string; reason: string; }[]; receiptRef: string | null; }; child: string; runId: string; kind: string; }; }[]; }; role: "builder" | "verifier"; child: string; projectRoot: string; baseCommit: string; runId: string; acceptance?: Array<{ id: string; source: string; text: string; }>; contractHash?: string; verificationBoundary?: "child-scope-parent-reverifies-all"; checksReason?: "not-run" | "running" | "completed"; checkExecution?: { operationId: string; key: string; status: "running" | "completed" | "interrupted"; ownerPid: number; ownerIdentity?: string; activeProcess?: null | { status: "starting"; checkId: string; } | { status: "running"; checkId: string; pid: number; identity?: string; }; startedAt: string; expiresAt?: string; receiptRef?: string; machineId?: string; inputFingerprint?: string; checkStates?: NativeSupervisorCheckExecutionState[]; }; }; export declare function createNativeSupervisorTask(state: NativeSupervisorState, options: Omit): { state: NativeSupervisorState; task: NativeSupervisorTask; }; export declare function reconnectNativeSupervisorTask(state: NativeSupervisorState, options: { child: string; runId: string; }): NativeSupervisorTask; /** Reconnect a task and return the auditable state transition for persistence. */ export declare function reconnectNativeSupervisorTaskWithState(state: NativeSupervisorState, options: { child: string; runId: string; }): { state: NativeSupervisorState; task: NativeSupervisorTask; }; export declare function cancelNativeSupervisorTask(state: NativeSupervisorState, options: { child: string; runId: string; reason: string; }): NativeSupervisorState; export declare function blockNativeSupervisorTask(state: NativeSupervisorState, options: { child: string; runId: string; reason: string; }): NativeSupervisorState; export declare function applyNativeSupervisorBuilderResult(state: NativeSupervisorState, options: { child: string; runId: string; candidateCommit: string; }): NativeSupervisorState; export declare function applyNativeSupervisorVerifierResult(state: NativeSupervisorState, options: { child: string; runId: string; verdict: 'pass' | 'fail' | 'blocked'; evidence: NativeSupervisorVerificationEvidence; }): NativeSupervisorState; export declare function retryNativeSupervisorBuilder(state: NativeSupervisorState, options: { child: string; expectedStateVersion: number; }): NativeSupervisorState; export declare function integrateNativeSupervisorChild(state: NativeSupervisorState, options: { name: string; integrationCommit: string; checks: NativeSupervisorIntegrationCheck[]; }): NativeSupervisorState; export declare function projectNativeSupervisorChildren(state: NativeSupervisorState): NativeChildrenInspection; //# sourceMappingURL=native-supervisor-model.d.ts.map