/** * Envelope and per-manifest validation for a `weft codegen` registry * snapshot source (fetched from a live server or vendored as `--from` * JSON). * * Split out of `codegen.ts` specifically to stay under the repository's * implementation-file-size ceiling once WFT-6's manifest validation * (reusing `core/contract`'s hostile-input `parseWorkflowRevisionManifest`) * was added — `codegen.ts` was already 460 of 500 lines before this module * existed. * * @module cli/codegen-validate */ import { type RegistryActivityEntry } from '../core/registry-snapshot.ts'; import type { CodegenWorkflowEntry } from './codegen-emit-registry.ts'; /** * Ceiling on the raw `workflows` array's length, checked before a single * element is parsed or cryptographically hashed, and on the number of * entries in `activeRevisions`, checked before a single key/value pair is * read (`activeRevisions` can never usefully point at more names than * `workflows` could ever declare, so the same ceiling applies to both). * Shared with `core/registry-snapshot.ts`'s producer-side enforcement via * {@link MAX_REGISTRY_WORKFLOW_COUNT} rather than each defining its own * number: a consumer ceiling looser than the producer's would be dead code, * and one tighter would make `weft codegen --server` reject a * legitimately-generated snapshot from a same-release server. */ export type ValidateSnapshotResult = { ok: true; value: T; } | { ok: false; error: string; }; /** The active workflow projection `weft codegen` emits from, plus the activity count for the CLI's summary line. */ export interface ActiveRegistryProjection { workflows: Record; activities: Record; } /** * Validate an untrusted registry snapshot end-to-end: the version/envelope * shape, every `workflows` manifest, and the `activeRevisions` pointer map, * projecting the result down to what `weft codegen` actually emits from. * * Surfaces a clear version-mismatch diagnostic before delegating to the * full envelope schema, since the version check is the most likely failure * when consumers vendor a snapshot from an older or newer server. */ export declare function validateRegistrySnapshot(value: unknown): Promise>;