import type { NodeKeyPair } from '@forgezero/runtime/identity'; import { type DeploymentManager, type DeploymentResult } from './deployment'; import type { AgentOperationTelemetry } from './telemetry-runtime'; import { type DeploymentAgentClaim } from '@forgezero/access/deployment-agent-claim'; /** Public V3 native wire contract; never widen this locally. */ export type RemoteDeploymentClaim = DeploymentAgentClaim; export interface DeploymentPullOptions { apiUrl: string; nodeKey: string; keys: NodeKeyPair; manager?: DeploymentManager; /** Automatic computes construct one manager from the server-owned source coordinates. */ managerFor?: (claim: RemoteDeploymentClaim) => DeploymentManager; fetch?: (input: URL, init: RequestInit) => Promise; intervalMs?: number; /** Concurrent claim workers. Same-key execution still serializes in the manager queue. */ parallelism?: number; requestTimeoutMs?: number; completionAttempts?: number; sleep?: (ms: number) => Promise; now?: () => number; renewRetryMs?: number; setTimer?: (callback: () => void, ms: number) => unknown; clearTimer?: (handle: unknown) => void; onEvent?: (event: string, detail?: unknown) => void; telemetry?: AgentOperationTelemetry; /** Fail-closed desired-state gate. False means do not contact the claim route. */ canClaim?: () => boolean; } export type PullResult = { status: 'idle'; } | { status: 'deployed'; claim: RemoteDeploymentClaim; result: DeploymentResult; } | { status: 'failed'; claim: RemoteDeploymentClaim; reason: string; }; /** Claim at most one job and await its exact deployment result before reporting. */ export declare function pullDeploymentOnce(options: DeploymentPullOptions): Promise; /** * Bounded outbound intake for the deployment manager. * * Claim workers may receive different pipeline keys concurrently. Managers * still own execution ordering: a single pipeline key is serial even when two * of its claims were fetched by different workers. */ export declare function startDeploymentPull(options: DeploymentPullOptions): { stop(): Promise; pause(): Promise; resume(): void; /** Trigger an immediate bounded check after a fresh signed intake directive. */ wake(): void; readonly active: boolean; };