import type { PortableBlueprint } from '../types/portable-blueprint.js'; import { PORTABLE_BLUEPRINT_SCHEMA_VERSION } from '../types/portable-blueprint.js'; import type { DataContract } from '../types/data-contract.js'; import type { BlueprintVariance } from '../types/blueprint.js'; import type { BlueprintSource } from '../types/blueprint-source.js'; import type { ToolCatalogShape } from './blueprint-stamp.js'; export type { PortableBlueprint }; export { PORTABLE_BLUEPRINT_SCHEMA_VERSION }; /** The fields needed to mint a {@link PortableBlueprint} (keys are derived). */ export interface PortableBlueprintSource { readonly contract: DataContract; readonly componentCode: string; readonly variance: BlueprintVariance; /** Provenance of `componentCode` — travels with the artifact. */ readonly source: BlueprintSource; /** * Intent prose for semantic (Tier-2) matching at the import side. * Optional: artifacts exported before this field existed (and rows * without one) still import — importers fall back to their own * intent derivation. */ readonly intent?: string; } /** * Rejection message for schemaVersion-1 artifacts. v1 records predate * required provenance, and a blueprint pool is a cache — re-exporting * regenerates the records with full provenance, so there is no * migration shim. */ export declare const PORTABLE_BLUEPRINT_V1_REJECTION = "re-export the pool: PortableBlueprint schemaVersion 2 requires complete provenance"; /** * Result of {@link fromPortableBlueprint} — the validating narrower at * the artifact trust boundary (JSON bytes → typed record). * * Rejection policy at the call sites: pool loaders SKIP a rejected * record with a log line (a rejected seed entry is just a cold-gen); * explicit single-artifact import paths hard-error with `reason`. * Coercing a rejected record into the typed shape is banned. */ export type PortableBlueprintImportResult = { readonly ok: true; /** Canonical rebuild of the validated record (stray keys dropped). */ readonly record: PortableBlueprint; /** True if the shipped contractHash/variantKey differed from the recompute. */ readonly keyMismatch: boolean; } | { readonly ok: false; readonly reason: string; }; /** Options for {@link toPortableBlueprint}. */ export interface ToPortableBlueprintOpts { /** * Tool-identity catalog used to canonicalize the contract at export * time. When provided, its hash is stamped as * `toolIdentityCatalogHash` so importers can detect catalog drift * (same intent → different key). When omitted — the offline-export * case, where no runtime catalog exists — the stamp is left absent * and importers fall back to recomputing keys against their own * catalog. */ readonly catalog?: ToolCatalogShape; } export declare function toPortableBlueprint(src: PortableBlueprintSource, opts?: ToPortableBlueprintOpts): PortableBlueprint; /** * Validate one artifact record (parsed JSON, untrusted) into a typed * {@link PortableBlueprint}. Shipped keys are advisory — they are * recomputed here and a divergence is surfaced as `keyMismatch`, never * silently trusted. */ export declare function fromPortableBlueprint(record: unknown): PortableBlueprintImportResult; //# sourceMappingURL=portable-blueprint.d.ts.map