import { type NolArtifactRef, type NolModelManifest, type NolRecipeRevision } from "../../schemas/nol.js"; export interface NolCheckpointEditLimits { maxInputBytes: number; /** Aggregate unique operand artifact bytes. */ maxArtifactBytes: number; /** Entire exported directory, including its provenance receipt. */ maxOutputBytes: number; /** Conservative cumulative tensor-payload/explicit workspace reservation. * Python/Torch runtime objects, allocator/BLAS overhead and baseline process * RSS are outside this limit; it is not a process address-space guarantee. */ maxWorkingBytes: number; maxArithmeticUnits: number; maxOperations: number; maxDurationMs: number; maxProtocolBytes: number; } export interface NolCheckpointEditReceipt { schema: "omnius.nol.checkpoint-edit.v1"; exportId: string; parentModelDigest: string; recipeDigest: string; sourceModelDigests: string[]; editorSha256: string; runtime: { python: string; torch: string; safetensors: string; }; numericalPolicy: string; inferencePerformed: false; cudaUsed: false; files: Array<{ path: string; before: { sha256: string; sizeBytes: number; }; after: { sha256: string; sizeBytes: number; }; changed: boolean; representation: "copied_exact_file" | "safetensors_preserved_untouched_tensor_bytes" | "pytorch_reencoded_verified_tensor_bytes"; }>; operations: Array<{ operationId: string; operation: string; siteId: string; name: string; beforeTensorSha256: string; afterTensorSha256: string; changedElements: number; /** Difference between this worker's float64 result and its stored dtype * round trip; excludes operand decoding and native BLAS summation error. * This is not a bound against exact real arithmetic or inference behavior. */ maxAbsRoundingError: number; }>; usage: { inputBytes: number; artifactBytes: number; outputBytes: number; reservedWorkingBytes: number; arithmeticUnits: number; durationMs: number; }; } export interface NolCheckpointEditInput { pythonPath: string; editorPath?: string; expectedEditorSha256: string; model: NolModelManifest; recipe: NolRecipeRevision; checkpointRoot: string; sourceCheckpoints?: ReadonlyArray<{ model: NolModelManifest; root: string; }>; artifactRoot: string; outputDirectory: string; limits: NolCheckpointEditLimits; orthogonalityTolerance: number; signal?: AbortSignal; } /** Explicit, CPU-only persistent parameter edit. Importing this module does no * I/O and never imports Torch, allocates CUDA or instantiates a model. The final * publish uses Linux renameat2(RENAME_NOREPLACE), with no overwrite fallback. * Cancellation is observed until the atomic commit; a verified committed export * is returned successfully if cancellation arrives after that commit point. * Returned artifact references identify verified LOCAL export files; callers * must import those files into their quota-managed CAS before runtime use or * registration. This function does not register, promote or deploy a model. */ export declare function editNolCheckpoint(input: NolCheckpointEditInput): Promise<{ outputDirectory: string; model: NolModelManifest; receipt: NolCheckpointEditReceipt; receiptArtifact: NolArtifactRef; receiptPath: string; }>;