import { type NolArtifactRef, type NolModelManifest, type NolRecipeRevision } from "../../schemas/nol.js"; import type { NolCheckpointEditLimits } from "./checkpoint-edits.js"; /** These cumulative reservations bound explicit arrays/work, not total process * RSS, Python/NumPy/BLAS overhead or the OS's file cache. */ export interface NolGgufEditLimits extends NolCheckpointEditLimits { maxMetadataBytes: number; maxTensors: number; maxKeyValues: number; maxArrayElements: number; } export interface NolGgufEditorRuntime { schema: "omnius.nol.gguf-editor-runtime.v1"; runtimeDigest: string; pythonVersion: string; pythonExecutable: { sha256: string; sizeBytes: number; }; packages: Array<{ name: string; version: string; files: Array<{ path: string; sha256: string; sizeBytes: number; }>; }>; dependencyLock: { sha256: string; sizeBytes: number; }; } export interface NolGgufInventory { schema: "omnius.nol.gguf-inventory.v1"; checkpoint: { sha256: string; sizeBytes: number; }; version: 3; alignment: number; metadataSha256: string; tensors: Array<{ name: string; shape: number[]; qtype: string; sizeBytes: number; dataOffset: number; }>; officialReaderVerified: true; modelLoaded: false; cudaUsed: false; runtimeDigest: string; } export interface NolGgufEditorHost { pythonPath: string; editorPath: string; expectedEditorSha256: string; dependencyLockPath: string; limits: NolGgufEditLimits; signal?: AbortSignal; } export interface NolGgufEncodingPolicy { target: "f16" | "q8_0"; maxAbsError: number; maxRelativeL2Error: number; } export interface NolGgufEditInput extends NolGgufEditorHost { /** Trusted host hook only, never parsed from a request/recipe. Invoked after * the child close promise settles and before its unpublished stage is removed. * The owner must pre-reserve any durable diagnostic publication allowance. */ onFailureDiagnostic?: (diagnostic: NolGgufProcessFailureDiagnostic) => Promise; runtime: NolGgufEditorRuntime; model: NolModelManifest; recipe: NolRecipeRevision; checkpointRoot: string; sourceCheckpoints?: ReadonlyArray<{ model: NolModelManifest; root: string; }>; artifactRoot: string; outputDirectory: string; orthogonalityTolerance: number; encoding: NolGgufEncodingPolicy; } export interface NolGgufProcessFailureDiagnostic { schema: "omnius.nol.gguf-process-failure.v1"; message: string; exitCode: number | null; signal: NodeJS.Signals | null; captureLimitBytes: number; stageCleanupPending: true; childCloseAwaited: true; streamCompleteness: "process_capture" | "unknown_beyond_process_capture_limit"; stdout: { base64: string; availableBytes: number; retainedBytes: number; availableSha256: string; truncatedFromAvailable: boolean; }; stderr: { base64: string; availableBytes: number; retainedBytes: number; availableSha256: string; truncatedFromAvailable: boolean; }; } export interface NolGgufEditReceipt { schema: "omnius.nol.gguf-checkpoint-edit.v1"; exportId: string; editorSha256: string; runtimePath: string; runtimeArtifact: NolArtifactRef; parentModelDigest: string; recipeDigest: string; sourceModelDigests: string[]; runtimeDigest: string; numericalPolicy: string; equivalence: "approximate_transfer_needs_native_validation"; neutralPolicy: string; allNeutral: boolean; encoding: NolGgufEncodingPolicy; operations: Array<{ operationId: string; operation: string; siteId: string; name: string; operatorOrder: number; evaluationOrder: number; changedReferenceElements: number; beforeReferenceSha256: string; afterReferenceSha256: string; referencePrecision: "float64"; storageEncodePerformed: false; }>; tensors: Array<{ name: string; from: string; to: string; neutral: boolean; beforeTensorSha256: string; afterTensorSha256: string; maxAbsError: number; relativeL2Error: number; }>; unchangedTensors: Array<{ name: string; sha256: string; }>; metadataSha256: string; officialReaderVerified: true; files: Array<{ path: string; role: string; before: { sha256: string; sizeBytes: number; }; after: { sha256: string; sizeBytes: number; }; }>; inferencePerformed: false; cudaUsed: false; nativeRuntimeImported: false; usage: { inputBytes: number; artifactBytes: number; outputBytes: number; reservedWorkingBytes: number; arithmeticUnits: number; durationMs: number; }; } /** CPU package inspection only; no GNE/Torch/native model runtime imports. */ export declare function inspectNolGgufRuntime(input: NolGgufEditorHost): Promise; /** Full-file identity and bounded format geometry using both independent * admission scanner and official gguf0.19 reader. No tensor dequantization. */ export declare function inspectNolGgufCheckpoint(input: NolGgufEditorHost & { checkpointPath: string; runtime: NolGgufEditorRuntime; }): Promise; /** Inert offline export, never runtime registration/promotion. All actual * changes are approximate transfers until separately validated by native gates. * Local output refs must be imported into the host quota-managed CAS by caller. */ export declare function editNolGgufCheckpoint(input: NolGgufEditInput): Promise<{ outputDirectory: string; model: NolModelManifest; receipt: NolGgufEditReceipt; receiptArtifact: NolArtifactRef; receiptPath: string; }>;