import { type ExecuteRequest, type HostAllocationIntent, type HostAllocationPlan, type TaskAttempt, type TaskRequest, type WorkspaceIdentity } from "./schema.ts"; import { type AllocationReconciliation, type HostAllocationKind, type HostAllocationResult, type HostCleanupKind, type HostRuntime, type InFlightTaskCandidateInspector, type OperationContext, type TextTaskContext, type TransientLaunchHandle, type VerifiedLaunch, type WorkerResult } from "./runner.ts"; export interface HostProcessOptions { cwd: string; signal: AbortSignal; timeoutMs: number; } export type HostProcessRunner = (command: string, args: string[], options: HostProcessOptions) => Promise<{ code: number; stdout: string; stderr: string; killed?: boolean; }>; export interface HerdrHostRuntimeOptions { inspectInFlightTaskCandidate: InFlightTaskCandidateInspector["inspectInFlightTaskCandidate"]; runProcess?: HostProcessRunner; killProcess?: (pid: number, signal: NodeJS.Signals) => void; delay?: (milliseconds: number, signal: AbortSignal) => Promise; now?: () => number; randomId?: () => string; env?: NodeJS.ProcessEnv; leaseDirectory?: string; lsofCommand?: string; } export declare function workspaceLabel(attempt: Pick): string; export declare class HerdrHostRuntime implements HostRuntime { private readonly inspectInFlightCandidate; private readonly execute; private readonly herdr; private readonly kill; private readonly delay; private readonly now; private readonly randomId; private readonly env; private readonly leaseDirectory; private readonly lsofCommand; constructor(options: HerdrHostRuntimeOptions); /** Fail-closed Herdr caller/capability gate. This method creates no state or host resource. */ preflightHost(input: { root: string; }, context: OperationContext): Promise; planHostAllocation(input: { readonly requestId: ExecuteRequest["id"]; readonly goal: ExecuteRequest["goal"]; kind: HostAllocationKind; task: TaskRequest; attempt: TaskAttempt; }, context: OperationContext): Promise; allocateHost(input: { requestId: ExecuteRequest["id"]; intent: HostAllocationIntent; task: TaskRequest; attempt: TaskAttempt; acquireLaunch?: () => Promise>; }, context: OperationContext): Promise; reconcileHostAllocation(input: { requestId: ExecuteRequest["id"]; intent: HostAllocationIntent; task: TaskRequest; attempt: TaskAttempt; }, context: OperationContext): Promise>; runWorker(input: { readonly goal: ExecuteRequest["goal"]; readonly contexts: readonly TextTaskContext[]; task: TaskRequest; attempt: TaskAttempt; workerId: string; kind: "initial" | "correction" | "followup"; preCandidate: WorkspaceIdentity; failure?: string; instruction?: string; }, context: OperationContext): Promise; terminateWorker(input: { task: TaskRequest; attempt: TaskAttempt; workerId: string; candidate: WorkspaceIdentity; }, context: OperationContext): Promise<{ outcome: "terminated"; } | { outcome: "unknown"; failure: string; }>; reconcileWorkerTermination(input: { task: TaskRequest; attempt: TaskAttempt; workerId: string; candidate: WorkspaceIdentity; }, context: OperationContext): Promise<{ outcome: "terminated" | "active"; } | { outcome: "unknown"; failure: string; }>; cleanupHost(input: { requestId: ExecuteRequest["id"]; kind: HostCleanupKind; task: TaskRequest; attempt: TaskAttempt; }, context: OperationContext): Promise<{ outcome: "completed" | "absent"; } | { outcome: "blocked"; failure: string; }>; private allocateWorkspace; private allocateWorkerTab; private allocateAgent; private reconcileDeliveredPrompt; private candidateResult; private isExpectedCandidate; private waitForSettledAgent; private waitForAgentLifecycle; private diagnostic; private assertStartableAgentPane; private createPrivateLease; private removeLeaseArtifacts; private assertPrivateLeaseDirectories; private assertLeasePath; private assertPrivateLease; private scanLease; private signalExactHolders; private listTabs; private listAgents; private listPanes; private waitForStableWorkspacePanes; private getTab; private paneAbsent; private workspaceAbsent; private assertWorkspaceEvidence; private repositoryIdentity; private assertRepositoryIdentity; private processOptions; private childContext; private callTimeout; private contextInterrupted; }