import type { ChildProcessWithoutNullStreams } from "node:child_process"; import { type NolArtifactRef, type NolBackendCapabilities, type NolRuntimeBinding } from "../_types/schemas/nol.js"; import { type NolOwnedWorkerOptions, type NolWorkerAction, type NolWorkerExit, type NolWorkerLimits } from "../_types/execution/nol/worker-protocol.js"; import type { NolComputeAdapter, NolComputeContext, NolComputeSettlement, NolComputeTrialOutput, NolComputeTrialRequest, NolFrozenExperiment, NolFrozenExperimentInput, NolPreparedControl } from "../_types/orchestrator/nol/coordinator.js"; import { NolCudaLease, type NolCudaPlacement } from "./cuda-lease.js"; import { type NolOrphanProbeInput, type NolOrphanProbeResult } from "./orphan-custody.js"; type Operation = "NEURON_ADD" | "NEURON_GAIN" | "RESIDUAL_ADD"; type Dtype = "float32" | "float16" | "bfloat16"; type JsonObject = Record; /** Deliberately narrow initial adapter admission. The worker implements further * operations, but this adapter does not issue capabilities for unverified glue. * Gain is dimensionless; edited positions describe input computations. */ export declare function buildNolTransformersCapabilities(input: { binding: NolRuntimeBinding; workerSha256: string; dtype?: Dtype; operations?: readonly Operation[]; }): NolBackendCapabilities; /** Injectable seams exercise host custody/wire logic in CPU tests; they are not * scientific or GPU-placement evidence. Production uses the real implementations. */ export interface NolTransformersWorker { readonly pid: number | null; readonly closed: Promise; start(signal?: AbortSignal): Promise; request(action: NolWorkerAction, payload: unknown, options?: { signal?: AbortSignal; timeoutMs?: number; }): Promise; retire(reason?: unknown): void; } export interface NolTransformersLease { assertCurrent(): void; assertReady(): void; environment(base?: NodeJS.ProcessEnv): NodeJS.ProcessEnv; attach(child: ChildProcessWithoutNullStreams): void; loaded(): Promise; stop(): void; settle(): Promise; } export interface NolTransformersAdapterOptions { pythonPath: string; workerPath: string; workerSha256: string; checkpointRoot: string; artifactRoot: string; dependencyLockPath: string; /** Full, previously inspected native/package/source hashes, not package versions alone. */ runtimeBuild: JsonObject; dtype?: Dtype; loadLimits: { maxInputTokens: number; maxOutputTokens: number; maxTensorBytes: number; maxWorkingBytes: number; maxMultiplyAdds: number; }; workerLimits: NolWorkerLimits; gpu: { gpuUuid: string; requestedMiB: number; expectedDurationSeconds: number; }; artifacts: { readBytes(ref: NolArtifactRef, signal?: AbortSignal): Promise; }; /** Mandatory host-facing gate: awaited after actual PID/UUID verification and * before confirm_placement/tokenize/generate. Throwing fences further work. */ onPlacementConfirmed(placement: NolCudaPlacement, proof: NolArtifactRef, signal: AbortSignal): Promise; notice?: (message: string) => void; createWorker?: (options: NolOwnedWorkerOptions) => NolTransformersWorker; acquireLease?: (options: Parameters[0]) => Promise; /** Host telemetry seam for CPU transport tests; production queries nvidia-smi. */ readDriverVersion?: (gpuUuid: string) => Promise; /** CPU fixtures inject read-only telemetry. Fresh production instances use * the bounded broker/proc/CUDA absence probe, never an assumed empty host. */ probeOrphanCustody?: (input: NolOrphanProbeInput) => Promise; } /** Explicit per-job Transformers adapter. Import/construction does no I/O, process * spawning, broker discovery, CUDA allocation, tokenization or model loading. */ export declare class NolTransformersAdapter implements NolComputeAdapter { private active; private readonly localNoCudaPreparations; private readonly unsettledOrphans; private orphanRecovery; private readonly options; constructor(options: NolTransformersAdapterOptions); private validated; private recipe; private bytes; private vector; verifyInterventions(input: NolFrozenExperimentInput, context: NolComputeContext): Promise; private sparseAdds; private controlOperation; private randomized; private randomAdd; private randomSparseAdds; private controlProof; private randomRecipe; prepareControls(input: NolFrozenExperimentInput, context: NolComputeContext): Promise; verifyControls(input: NolFrozenExperiment, context: NolComputeContext): Promise; preflight(input: NolFrozenExperiment, context: NolComputeContext): Promise; private assert; private start; private owned; private trial; countPromptTokens(request: NolComputeTrialRequest): Promise; private resetFacts; reset(input: { binding: NolRuntimeBinding; context: NolComputeContext; }): Promise; executeTrial(request: NolComputeTrialRequest): Promise; settle(input: Parameters[0] & { signal?: AbortSignal; }): Promise; private recoverOrphan; private finish; } export {};