@orkestrel/capture 0.0.12 → 0.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -948,7 +948,7 @@ function readCaptureReport(value) {
948
948
  requireCaptureUnique(assertions.map(resolveLookupKey), "reporter case identities");
949
949
  return {
950
950
  start: files.reduce((start, file) => Math.min(start, file.start), value.startTime),
951
- end: files.reduce((end, file) => Math.max(end, file.end), -Infinity),
951
+ end: files.reduce((end, file) => Math.max(end, file.end), -1e400),
952
952
  assertions
953
953
  };
954
954
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["holds","isError","INTRINSICS","isObject","isFunction","holds","isRecord","arrayOf","isSafeInteger","isString","isFiniteNumber","isObject","isError","isRecord","isFiniteNumber","arrayOf","isString","preview"],"sources":["../../../src/core/constants.ts","../../../src/core/errors.ts","../../../src/core/validators.ts","../../../src/core/helpers.ts"],"sourcesContent":["/**\n * Lists the condition axes a capture failure carries, in the order the executable reports them.\n *\n * @remarks\n * `USAGE` is a refused command line and exits 64; every other condition exits 1. `SELECTION`\n * names a selector, variant, case, state, or portfolio the host does not declare. `HOST` names a\n * wrapper, configuration, or declaration fault. `STAGE` names a runner stage that did not\n * complete. `EVIDENCE` names a record, report, journal, or manifest that fails its protocol, and a\n * document of another version. `REGISTRY` names an accepted registry that is absent, fails\n * authentication, or lags the declarations. `LOOKUP` names a state lookup that is absent or stale.\n * `CONTAINMENT` names a path that leaves the authorized roots.\n *\n * @example\n * ```ts\n * CAPTURE_ERROR_CODES.includes('USAGE') // true\n * ```\n */\nexport const CAPTURE_ERROR_CODES = Object.freeze([\n\t'USAGE',\n\t'SELECTION',\n\t'HOST',\n\t'STAGE',\n\t'EVIDENCE',\n\t'REGISTRY',\n\t'LOOKUP',\n\t'CONTAINMENT',\n] as const)\n\n/**\n * Keys the global brand a capture error carries, so a duplicate installation recognizes it.\n *\n * @remarks\n * The key follows the package-and-class form, `Symbol.for('<package>.<ClassName>')`. The brand is\n * a recognition marker and never proof that the class's constructor ran.\n *\n * @example\n * ```ts\n * CAPTURE_ERROR_BRAND === Symbol.for('@orkestrel/capture.CaptureError') // true\n * ```\n */\nexport const CAPTURE_ERROR_BRAND = Symbol.for('@orkestrel/capture.CaptureError')\n\n/**\n * Lists the non-current freshness classifications from highest precedence to lowest.\n *\n * @remarks\n * `resolveCaptureStatus` reads this order to choose a frame's primary classification while the\n * reading keeps every finding separately. A frame with none of these is current.\n *\n * @example\n * ```ts\n * CAPTURE_STATUS_PRECEDENCE[0] // 'duplicate'\n * ```\n */\nexport const CAPTURE_STATUS_PRECEDENCE = Object.freeze([\n\t'duplicate',\n\t'orphan',\n\t'missing',\n\t'unstamped',\n\t'stale-shared',\n\t'stale-own',\n] as const)\n\n/**\n * Names the file prefix of a runner request, completed by the runner's process id and `.json`.\n *\n * @example\n * ```ts\n * `${CAPTURE_REQUEST_PREFIX}-${process.pid}.json` // 'journey-selection-4242.json'\n * ```\n */\nexport const CAPTURE_REQUEST_PREFIX = 'journey-selection'\n\n/**\n * Holds the protocol version every request, record, receipt, registry, and manifest declares.\n *\n * @example\n * ```ts\n * CAPTURE_VERSION // 2\n * ```\n */\nexport const CAPTURE_VERSION = 2\n\n/**\n * Holds the eight bytes every PNG file opens with.\n *\n * @example\n * ```ts\n * CAPTURE_PNG_SIGNATURE.map((byte) => byte.toString(16)).join('') // '89504e470d0a1a0a'\n * ```\n */\nexport const CAPTURE_PNG_SIGNATURE = Object.freeze([137, 80, 78, 71, 13, 10, 26, 10] as const)\n\n/**\n * Names the default accepted complete-run registry file inside a portfolio directory.\n *\n * @example\n * ```ts\n * `tmp/captures/states/${CAPTURE_REGISTRY_FILE}` // 'tmp/captures/states/registry.json'\n * ```\n */\nexport const CAPTURE_REGISTRY_FILE = 'registry.json'\n\n/**\n * Names the default image-stamp manifest file inside a portfolio directory.\n *\n * @example\n * ```ts\n * `tmp/captures/states/${CAPTURE_MANIFEST_FILE}` // 'tmp/captures/states/manifest.json'\n * ```\n */\nexport const CAPTURE_MANIFEST_FILE = 'manifest.json'\n\n/**\n * Names the default lookup journal file inside a portfolio directory.\n *\n * @example\n * ```ts\n * `tmp/captures/states/${CAPTURE_LOOKUPS_FILE}` // 'tmp/captures/states/lookups.json'\n * ```\n */\nexport const CAPTURE_LOOKUPS_FILE = 'lookups.json'\n\n/**\n * Names the tag prefix that marks a case's owner path and each ancestor of it.\n *\n * @example\n * ```ts\n * `${CAPTURE_OWNER_PREFIX}pages:mail` // 'owner:pages:mail'\n * ```\n */\nexport const CAPTURE_OWNER_PREFIX = 'owner:'\n\n/**\n * Names the journey artifact line prefixes that bind a run record and each case that ran.\n *\n * @remarks\n * The preflight reader requires the line `record=<record path>` and one `case-ran=<full name>`\n * line for each stamping case.\n *\n * @example\n * ```ts\n * `${CAPTURE_ARTIFACT_PREFIXES.case}mail opens the inbox` // 'case-ran=mail opens the inbox'\n * ```\n */\nexport const CAPTURE_ARTIFACT_PREFIXES = Object.freeze({\n\trecord: 'record=',\n\tcase: 'case-ran=',\n} as const)\n","import type { CaptureErrorCode, CaptureErrorContext, CaptureErrorOptions } from './types.js'\nimport { holds, INTRINSICS, isError, isFunction, isObject } from '@orkestrel/contract'\nimport { CAPTURE_ERROR_BRAND, CAPTURE_ERROR_CODES } from './constants.js'\n\n/**\n * Reports one capture failure under a stable condition axis.\n *\n * @remarks\n * Every refusal the engine, the runner, and the readers raise arrives as one of these, so the\n * executable branches on `code` rather than on message text: `USAGE` exits 64 and every other\n * condition exits 1. Narrow a caught value with `isCaptureError` before reading `code`.\n *\n * @example\n * ```ts\n * const error = new CaptureError('Unknown variant: phone', {\n * \tcode: 'SELECTION',\n * \tcontext: { variant: 'phone' },\n * })\n * error.code // 'SELECTION'\n * error.context?.variant // 'phone'\n * ```\n */\nexport class CaptureError extends Error {\n\toverride readonly name = 'CaptureError'\n\treadonly code: CaptureErrorCode\n\treadonly context: CaptureErrorContext | undefined\n\n\t/**\n\t * Creates one classified capture failure.\n\t *\n\t * @param message - Human-readable description of what failed\n\t * @param options - The condition, optional structured context, and optional cause\n\t */\n\tconstructor(message: string, options: CaptureErrorOptions) {\n\t\tsuper(message, 'cause' in options ? { cause: options.cause } : undefined)\n\t\t// A transparent proxy forwards its target's identity and fails the guard's comparison.\n\t\tObject.defineProperty(this, CAPTURE_ERROR_BRAND, { value: this })\n\t\tthis.code = options.code\n\t\tthis.context = options.context\n\t}\n}\n\n/**\n * Checks whether an unknown value is a capture error.\n *\n * @remarks\n * Recognition requires a native `Error` whose prototype is not `Error.prototype`, an own brand\n * property holding the tested value itself, a declared condition code, and an object, callable, or absent\n * context. It recognizes an error from another installed copy of this package, and refuses a\n * look-alike with the same code and no brand, a proxy over a branded error, and a plain object\n * that only carries the brand.\n *\n * @param value - The value to inspect\n * @returns True if the value is a `CaptureError`; false otherwise\n *\n * @example\n * ```ts\n * isCaptureError(new CaptureError('Empty selection', { code: 'USAGE' })) // true\n * isCaptureError(new Error('Empty selection')) // false\n * ```\n */\nexport function isCaptureError(value: unknown): value is CaptureError {\n\treturn holds(() => {\n\t\tif (!isError(value) || INTRINSICS.prototype(value) === INTRINSICS.error.prototype) return false\n\t\tif (INTRINSICS.describe(value, CAPTURE_ERROR_BRAND)?.value !== value) return false\n\t\tconst code: unknown = INTRINSICS.reflect.read(value, 'code')\n\t\tconst context: unknown = INTRINSICS.reflect.read(value, 'context')\n\t\treturn (\n\t\t\tCAPTURE_ERROR_CODES.some((declared) => declared === code) &&\n\t\t\t(context === undefined || isObject(context) || isFunction(context))\n\t\t)\n\t})\n}\n","import type {\n\tCaptureArtifact,\n\tCaptureBox,\n\tCaptureCollectionReceipt,\n\tCaptureDeclaration,\n\tCaptureDestination,\n\tCaptureDigest,\n\tCaptureDigestReference,\n\tCaptureEntry,\n\tCaptureExpandedManifest,\n\tCaptureIdentity,\n\tCaptureLookup,\n\tCaptureLookupJournal,\n\tCaptureManifest,\n\tCaptureManifestDocument,\n\tCaptureReceipt,\n\tCaptureRegistry,\n\tCaptureRequest,\n\tCaptureRun,\n\tCaptureSources,\n\tCaptureStamp,\n\tCaptureViewport,\n} from './types.js'\nimport {\n\tarrayOf,\n\tholds,\n\tisFiniteNumber,\n\tisObject,\n\tisRecord,\n\tisSafeInteger,\n\tisString,\n} from '@orkestrel/contract'\nimport { CAPTURE_VERSION } from './constants.js'\n\n/**\n * Checks whether a serialized path stays within the portable relative-path vocabulary.\n *\n * @param value - The serialized file or directory path\n * @returns True if every segment is portable and relative; false otherwise\n *\n * @example\n * ```ts\n * isCapturePath('tmp/captures/states/pages/mail--inbox.png') // true\n * isCapturePath('../escape.png') // false\n * ```\n */\nexport function isCapturePath(value: unknown): value is string {\n\treturn (\n\t\ttypeof value === 'string' &&\n\t\tvalue.length > 0 &&\n\t\t[...value].every((character) => character.charCodeAt(0) > 0x1f) &&\n\t\tvalue\n\t\t\t.split('/')\n\t\t\t.every(\n\t\t\t\t(segment) =>\n\t\t\t\t\tsegment !== '' &&\n\t\t\t\t\tsegment !== '.' &&\n\t\t\t\t\tsegment !== '..' &&\n\t\t\t\t\t!/[<>:\"\\\\|?*]/u.test(segment) &&\n\t\t\t\t\t!/[. ]$/u.test(segment) &&\n\t\t\t\t\t!/^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³])(?:\\.|$)/iu.test(segment),\n\t\t\t)\n\t)\n}\n\n/**\n * Checks whether a native glob declaration uses relative portable path segments.\n *\n * @param value - A source attribution pattern\n * @returns True if the pattern has no path traversal or host-specific spelling; false otherwise\n *\n * @example\n * ```ts\n * isCapturePattern('src/**') // true\n * isCapturePattern('src\\\\**') // false\n * ```\n */\nexport function isCapturePattern(value: unknown): value is string {\n\treturn (\n\t\ttypeof value === 'string' &&\n\t\tvalue.length > 0 &&\n\t\t[...value].every((character) => character.charCodeAt(0) > 0x1f) &&\n\t\tvalue\n\t\t\t.split('/')\n\t\t\t.every(\n\t\t\t\t(segment) =>\n\t\t\t\t\tsegment !== '' &&\n\t\t\t\t\tsegment !== '.' &&\n\t\t\t\t\tsegment !== '..' &&\n\t\t\t\t\t!/[<>:\"\\\\|]/u.test(segment) &&\n\t\t\t\t\t!/[. ]$/u.test(segment) &&\n\t\t\t\t\t!/^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³])(?:\\.|$)/iu.test(segment),\n\t\t\t)\n\t)\n}\n\n/**\n * Checks whether a protocol identity can occupy one portable path segment.\n *\n * @param value - The identity segment\n * @returns True if the segment is safe and nonempty; false otherwise\n *\n * @example\n * ```ts\n * isCaptureSegment('light-390') // true\n * isCaptureSegment('light 390') // false\n * ```\n */\nexport function isCaptureSegment(value: unknown): value is string {\n\treturn isCapturePath(value) && /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/u.test(value)\n}\n\n/**\n * Checks whether an owner selector uses canonical colon-separated segments.\n *\n * @param value - The owner selector\n * @returns True if every owner segment is canonical; false otherwise\n *\n * @example\n * ```ts\n * isCaptureSelector('pages:mail') // true\n * isCaptureSelector('pages::mail') // false\n * ```\n */\nexport function isCaptureSelector(value: unknown): value is string {\n\treturn typeof value === 'string' && value.split(':').every(isCaptureSegment)\n}\n\n/**\n * Checks whether a value is a SHA-256 hexadecimal digest.\n *\n * @param value - The digest\n * @returns True if the digest has the expected hexadecimal width; false otherwise\n *\n * @example\n * ```ts\n * isCaptureHash('a'.repeat(64)) // true\n * isCaptureHash('abc') // false\n * ```\n */\nexport function isCaptureHash(value: unknown): value is string {\n\treturn typeof value === 'string' && /^[a-f0-9]{64}$/u.test(value)\n}\n\n/**\n * Checks whether a file-hash map has portable keys and valid digests.\n *\n * @param value - The hash map\n * @returns True if every key and digest is valid and no two keys differ only by case; false otherwise\n *\n * @example\n * ```ts\n * isCaptureHashes({ 'src/index.ts': 'a'.repeat(64) }) // true\n * isCaptureHashes({ 'src/index.ts': 'x' }) // false\n * ```\n */\nexport function isCaptureHashes(value: unknown): value is Readonly<Record<string, string>> {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tObject.entries(value).every(\n\t\t\t\t([file, digest]) => isCapturePath(file) && isCaptureHash(digest),\n\t\t\t) &&\n\t\t\tnew Set(Object.keys(value).map((file) => file.toLowerCase())).size ===\n\t\t\t\tObject.keys(value).length,\n\t)\n}\n\n/**\n * Checks whether source attribution separates own, shared, and behavioral patterns.\n *\n * @param value - The attribution\n * @returns True if every declared pattern is valid; false otherwise\n *\n * @example\n * ```ts\n * isCaptureSources({ own: ['src/mail/**'], shared: [], tests: [] }) // true\n * isCaptureSources({ own: ['../x'], shared: [], tests: [] }) // false\n * ```\n */\nexport function isCaptureSources(value: unknown): value is CaptureSources {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tarrayOf(isCapturePattern)(value.own) &&\n\t\t\tarrayOf(isCapturePattern)(value.shared) &&\n\t\t\tarrayOf(isCapturePattern)(value.tests),\n\t)\n}\n\n/**\n * Checks whether an execution identity carries its required authorization fields.\n *\n * @param value - The identity\n * @returns True if the identity is valid; false otherwise\n *\n * @example\n * ```ts\n * isCaptureIdentity({ id: 'run-1', stage: 'selected', pid: 4242, config: 'configs/journey.ts' }) // true\n * isCaptureIdentity({ id: 'run-1', stage: 'selected', pid: 0, config: 'configs/journey.ts' }) // false\n * ```\n */\nexport function isCaptureIdentity(value: unknown): value is CaptureIdentity {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisCaptureSegment(value.id) &&\n\t\t\tisCaptureSegment(value.stage) &&\n\t\t\ttypeof value.pid === 'number' &&\n\t\t\tisSafeInteger(value.pid) &&\n\t\t\tvalue.pid > 0 &&\n\t\t\tisCapturePath(value.config),\n\t)\n}\n\n/**\n * Checks whether a request has the supported version and complete execution identity.\n *\n * @param value - The transported request\n * @returns True if every request field has its protocol shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureRequest(JSON.parse(text)) // true for a well-formed runner request\n * isCaptureRequest({ version: 1 }) // false\n * ```\n */\nexport function isCaptureRequest(value: unknown): value is CaptureRequest {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisCaptureIdentity(value) &&\n\t\t\tvalue.version === CAPTURE_VERSION &&\n\t\t\t(value.command === 'journey' || value.command === 'capture') &&\n\t\t\t(value.mode === undefined || (typeof value.mode === 'string' && value.mode.trim() !== '')) &&\n\t\t\tisCaptureSelector(value.selector) &&\n\t\t\tarrayOf(isCaptureSegment)(value.variants) &&\n\t\t\tvalue.variants.length > 0 &&\n\t\t\tarrayOf(isString)(value.args) &&\n\t\t\t(value.case === undefined || (typeof value.case === 'string' && value.case.trim() !== '')) &&\n\t\t\t(value.state === undefined || (value.command === 'capture' && isCaptureSegment(value.state))),\n\t)\n}\n\n/**\n * Checks whether a collected declaration preserves its full owner and state population.\n *\n * @param value - The declaration\n * @returns True if the declaration has its supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureDeclaration({\n * \tcase: 'mail shows the inbox',\n * \towner: 'pages:mail',\n * \tvariant: 'light-390',\n * \teligible: true,\n * \tstates: ['inbox'],\n * }) // true\n * ```\n */\nexport function isCaptureDeclaration(value: unknown): value is CaptureDeclaration {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\ttypeof value.case === 'string' &&\n\t\t\tvalue.case.trim() !== '' &&\n\t\t\tisCaptureSelector(value.owner) &&\n\t\t\tisCaptureSegment(value.variant) &&\n\t\t\ttypeof value.eligible === 'boolean' &&\n\t\t\tarrayOf(isCaptureSegment)(value.states),\n\t)\n}\n\n/**\n * Checks whether a destination supplies canonical identity and source attribution fields.\n *\n * @param value - The destination\n * @returns True if the destination has its supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureDestination(JSON.parse(text)) // true for a registry destination row\n * isCaptureDestination({}) // false\n * ```\n */\nexport function isCaptureDestination(value: unknown): value is CaptureDestination {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisCaptureSegment(value.portfolio) &&\n\t\t\tisCaptureSegment(value.state) &&\n\t\t\tisCaptureSegment(value.scope) &&\n\t\t\tisCaptureSegment(value.part) &&\n\t\t\t(value.section === undefined || isCaptureSegment(value.section)) &&\n\t\t\tisCaptureSegment(value.variant) &&\n\t\t\ttypeof value.project === 'string' &&\n\t\t\tvalue.project !== '' &&\n\t\t\tisCapturePath(value.file) &&\n\t\t\ttypeof value.case === 'string' &&\n\t\t\tvalue.case.trim() !== '' &&\n\t\t\tisCaptureSources(value.sources),\n\t)\n}\n\n/**\n * Checks whether an emitted entry includes a finite nonnegative case duration.\n *\n * @param value - The emitted entry\n * @returns True if the entry is valid; false otherwise\n *\n * @example\n * ```ts\n * isCaptureEntry({ ...destination, duration: 812 }) // true\n * isCaptureEntry({ ...destination, duration: -1 }) // false\n * ```\n */\nexport function isCaptureEntry(value: unknown): value is CaptureEntry {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisCaptureDestination(value) &&\n\t\t\tisFiniteNumber(value.duration) &&\n\t\t\tvalue.duration >= 0,\n\t)\n}\n\n/**\n * Checks whether a record names its journey artifact by portable path and SHA-256 digest.\n *\n * @param value - The decoded artifact reference\n * @returns True if the reference has its supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureArtifact({ file: 'tmp/runs/a/light-390.txt', digest: 'a'.repeat(64) }) // true\n * isCaptureArtifact({ file: '/abs.txt', digest: 'a'.repeat(64) }) // false\n * ```\n */\nexport function isCaptureArtifact(value: unknown): value is CaptureArtifact {\n\treturn holds(() => isRecord(value) && isCapturePath(value.file) && isCaptureHash(value.digest))\n}\n\n/**\n * Checks whether a final record preserves declarations, observations, and output separately.\n *\n * @param value - The decoded run record\n * @returns True if the record has the supported protocol shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureRun(JSON.parse(text)) // true for a final run record\n * isCaptureRun(null) // false\n * ```\n */\nexport function isCaptureRun(value: unknown): value is CaptureRun {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tvalue.version === CAPTURE_VERSION &&\n\t\t\tisCaptureSegment(value.variant) &&\n\t\t\ttypeof value.time === 'string' &&\n\t\t\tNumber.isFinite(Date.parse(value.time)) &&\n\t\t\ttypeof value.complete === 'boolean' &&\n\t\t\ttypeof value.reference === 'boolean' &&\n\t\t\tarrayOf(isCaptureDeclaration)(value.declarations) &&\n\t\t\tarrayOf(isCaptureDestination)(value.registry) &&\n\t\t\tarrayOf(isString)(value.passed) &&\n\t\t\tarrayOf(isCaptureSegment)(value.observed) &&\n\t\t\tarrayOf(isCaptureEntry)(value.entries) &&\n\t\t\t(value.artifact === undefined || isCaptureArtifact(value.artifact)) &&\n\t\t\t((value.identity === undefined && value.request === undefined) ||\n\t\t\t\t(isCaptureIdentity(value.identity) && isCaptureRequest(value.request))),\n\t)\n}\n\n/**\n * Checks whether a shared-source digest retains both patterns and expanded file hashes.\n *\n * @param value - The digest reading\n * @returns True if the digest reading has its supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureDigest({ patterns: ['src/**'], files: {}, digest: 'a'.repeat(64) }) // true\n * isCaptureDigest({ patterns: [], files: {} }) // false\n * ```\n */\nexport function isCaptureDigest(value: unknown): value is CaptureDigest {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tarrayOf(isCapturePattern)(value.patterns) &&\n\t\t\tisCaptureHashes(value.files) &&\n\t\t\tisCaptureHash(value.digest),\n\t)\n}\n\n/**\n * Checks whether a complete-run receipt binds the report, inputs, and declaration registry.\n *\n * @param value - The receipt\n * @returns True if the receipt has its supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureReceipt(JSON.parse(text)) // true for a complete-run receipt\n * isCaptureReceipt({}) // false\n * ```\n */\nexport function isCaptureReceipt(value: unknown): value is CaptureReceipt {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tvalue.version === CAPTURE_VERSION &&\n\t\t\tisCaptureSegment(value.variant) &&\n\t\t\ttypeof value.time === 'string' &&\n\t\t\tNumber.isFinite(Date.parse(value.time)) &&\n\t\t\tisRecord(value.report) &&\n\t\t\tisCapturePath(value.report.file) &&\n\t\t\tisCaptureHash(value.report.digest) &&\n\t\t\tisCaptureHashes(value.inputs) &&\n\t\t\tarrayOf(isCaptureDeclaration)(value.declarations) &&\n\t\t\tarrayOf(isCaptureDestination)(value.registry) &&\n\t\t\ttypeof value.complete === 'boolean',\n\t)\n}\n\n/**\n * Checks whether a registry document retains its receipts and required output pairs.\n *\n * @param value - The registry document\n * @returns True if the registry has the supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureRegistry(JSON.parse(text)) // true for a published registry.json\n * isCaptureRegistry([]) // false\n * ```\n */\nexport function isCaptureRegistry(value: unknown): value is CaptureRegistry {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tvalue.version === CAPTURE_VERSION &&\n\t\t\tarrayOf(isCaptureReceipt)(value.receipts) &&\n\t\t\tarrayOf(isCaptureDestination)(value.entries) &&\n\t\t\tisCaptureHash(value.digest),\n\t)\n}\n\n/**\n * Checks whether a lookup binds a passing case to its full run record and input hashes.\n *\n * @param value - The lookup receipt\n * @returns True if the receipt has its supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureLookup(JSON.parse(text)) // true for a lookup row\n * isCaptureLookup(undefined) // false\n * ```\n */\nexport function isCaptureLookup(value: unknown): value is CaptureLookup {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisCaptureHash(value.registry) &&\n\t\t\tisCaptureSegment(value.variant) &&\n\t\t\ttypeof value.case === 'string' &&\n\t\t\tvalue.case.trim() !== '' &&\n\t\t\tisCaptureSelector(value.owner) &&\n\t\t\tarrayOf(isCaptureSegment)(value.states) &&\n\t\t\tisCaptureHashes(value.inputs) &&\n\t\t\tisRecord(value.run) &&\n\t\t\tisCapturePath(value.run.file) &&\n\t\t\tisCaptureHash(value.run.digest),\n\t)\n}\n\n/**\n * Checks the separate lookup journal and its optional predecessor manifest digest.\n *\n * @param value - The decoded journal\n * @returns True if the journal has its supported shape; false otherwise\n * @remarks Input-map digests and reference existence are verified when the journal is read.\n *\n * @example\n * ```ts\n * isCaptureLookupJournal({ version: 2, populations: {}, lookups: [] }) // true\n * isCaptureLookupJournal({ version: 1, populations: {}, lookups: [] }) // false\n * ```\n */\nexport function isCaptureLookupJournal(value: unknown): value is CaptureLookupJournal {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\t(value.collections === undefined || arrayOf(isCaptureCollection)(value.collections)) &&\n\t\t\tvalue.version === CAPTURE_VERSION &&\n\t\t\t(value.manifest === undefined || isCaptureHash(value.manifest)) &&\n\t\t\tisRecord(value.populations) &&\n\t\t\tObject.entries(value.populations).every(\n\t\t\t\t([digest, inputs]) => isCaptureHash(digest) && isCaptureHashes(inputs),\n\t\t\t) &&\n\t\t\tarrayOf(\n\t\t\t\t(entry) =>\n\t\t\t\t\tisRecord(entry) &&\n\t\t\t\t\tisCaptureHash(entry.inputs) &&\n\t\t\t\t\tisCaptureLookup({ ...entry, inputs: {} }),\n\t\t\t)(value.lookups),\n\t)\n}\n\n/**\n * Checks whether a stamp binds an emitted image to source and execution provenance.\n *\n * @param value - The stamp\n * @returns True if the stamp has its supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureStamp(manifest.entries['pages/mail--inbox.png']) // true for a stamped frame\n * isCaptureStamp({}) // false\n * ```\n */\nexport function isCaptureStamp(value: unknown): value is CaptureStamp {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisCaptureEntry(value) &&\n\t\t\tisCaptureIdentity(value.identity) &&\n\t\t\ttypeof value.time === 'string' &&\n\t\t\tNumber.isFinite(Date.parse(value.time)) &&\n\t\t\ttypeof value.commit === 'string' &&\n\t\t\t/^[a-f0-9]{40,64}$/u.test(value.commit) &&\n\t\t\tarrayOf(isCapturePath)(value.dirty) &&\n\t\t\tisCaptureHashes(value.own) &&\n\t\t\tisCaptureDigest(value.shared) &&\n\t\t\tisCaptureHashes(value.tests) &&\n\t\t\tisCaptureHash(value.registry) &&\n\t\t\tisRecord(value.image) &&\n\t\t\tisCaptureHash(value.image.digest) &&\n\t\t\tisFiniteNumber(value.image.size) &&\n\t\t\tisSafeInteger(value.image.size) &&\n\t\t\tvalue.image.size > 0 &&\n\t\t\tisFiniteNumber(value.image.modified) &&\n\t\t\tvalue.image.modified >= 0,\n\t)\n}\n\n/**\n * Checks whether an expanded manifest has the supported schema without discarding malformed rows.\n *\n * @param value - The manifest\n * @returns True if every inherited member validates; false otherwise\n *\n * @example\n * ```ts\n * isCaptureManifest(readCaptureManifest(JSON.parse(text), file)) // true for an expanded manifest.json\n * isCaptureManifest('manifest') // false\n * ```\n */\nexport function isCaptureManifest(value: unknown): value is CaptureManifest {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tvalue.version === CAPTURE_VERSION &&\n\t\t\tisCaptureRegistry(value.registry) &&\n\t\t\tisRecord(value.entries) &&\n\t\t\tObject.entries(value.entries).every(\n\t\t\t\t([key, stamp]) => isCapturePath(key) && isCaptureStamp(stamp),\n\t\t\t) &&\n\t\t\tarrayOf(isCaptureLookup)(value.lookups),\n\t)\n}\n\n/**\n * Checks whether collection evidence pins complete input membership and both external artifacts.\n *\n * @param value - The collection receipt\n * @returns True if every field has the supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureCollection(manifest.collections?.[0]) // true for a collection receipt\n * isCaptureCollection({}) // false\n * ```\n */\nexport function isCaptureCollection(value: unknown): value is CaptureCollectionReceipt {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisCaptureHash(value.registry) &&\n\t\t\tisCaptureSegment(value.variant) &&\n\t\t\ttypeof value.project === 'string' &&\n\t\t\tvalue.project.trim() !== '' &&\n\t\t\tisCaptureDigest(value.inputs) &&\n\t\t\tisRecord(value.run) &&\n\t\t\tisCapturePath(value.run.file) &&\n\t\t\tisCaptureHash(value.run.digest) &&\n\t\t\tisRecord(value.report) &&\n\t\t\tisCapturePath(value.report.file) &&\n\t\t\tisCaptureHash(value.report.digest),\n\t)\n}\n\n/**\n * Checks whether an expanded manifest and its optional collection receipts have the supported schema.\n *\n * @param value - The expanded manifest\n * @returns True if the manifest and any collection receipts are valid; false otherwise\n *\n * @example\n * ```ts\n * isCaptureExpandedManifest(readCaptureManifest(JSON.parse(text), file)) // true with or without collections\n * isCaptureExpandedManifest(null) // false\n * ```\n */\nexport function isCaptureExpandedManifest(value: unknown): value is CaptureExpandedManifest {\n\treturn holds(\n\t\t() =>\n\t\t\tisCaptureManifest(value) &&\n\t\t\tisRecord(value) &&\n\t\t\t(value.collections === undefined || arrayOf(isCaptureCollection)(value.collections)),\n\t)\n}\n\n/**\n * Checks whether a digest names its file map by a table key beside its patterns and combined digest.\n *\n * @param value - The stored digest reference\n * @returns True if the patterns are valid and both digests are SHA-256 hexadecimal; false otherwise\n *\n * @example\n * ```ts\n * isCaptureDigestReference({ patterns: ['src/**'], files: 'a'.repeat(64), digest: 'b'.repeat(64) }) // true\n * isCaptureDigestReference({ patterns: ['src/**'], files: {}, digest: 'b'.repeat(64) }) // false\n * ```\n */\nexport function isCaptureDigestReference(value: unknown): value is CaptureDigestReference {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tarrayOf(isCapturePattern)(value.patterns) &&\n\t\t\tisCaptureHash(value.files) &&\n\t\t\tisCaptureHash(value.digest),\n\t)\n}\n\n/**\n * Checks whether a stored manifest holds its population table and every member that names a table key.\n *\n * @param value - The decoded manifest file\n * @returns True if the version, table, registry, stamps, lookups, and collections are valid; false otherwise\n * @remarks Table digests and reference existence are verified when the document is read.\n *\n * @example\n * ```ts\n * isCaptureManifestDocument(JSON.parse(text)) // true for a written manifest.json\n * isCaptureManifestDocument({ version: 1, populations: {}, entries: {}, lookups: [] }) // false\n * ```\n */\nexport function isCaptureManifestDocument(value: unknown): value is CaptureManifestDocument {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\t// The population table and the lookup references follow the journal's table rule.\n\t\t\tisCaptureLookupJournal({\n\t\t\t\tversion: value.version,\n\t\t\t\tpopulations: value.populations,\n\t\t\t\tlookups: value.lookups,\n\t\t\t}) &&\n\t\t\tisCaptureRegistry(value.registry) &&\n\t\t\tisRecord(value.entries) &&\n\t\t\tObject.entries(value.entries).every(\n\t\t\t\t([key, stamp]) =>\n\t\t\t\t\tisCapturePath(key) &&\n\t\t\t\t\tisRecord(stamp) &&\n\t\t\t\t\tisCaptureDigestReference(stamp.shared) &&\n\t\t\t\t\tisCaptureStamp({ ...stamp, shared: { ...stamp.shared, files: {} } }),\n\t\t\t) &&\n\t\t\t(value.collections === undefined ||\n\t\t\t\tarrayOf(\n\t\t\t\t\t(entry) =>\n\t\t\t\t\t\tisRecord(entry) &&\n\t\t\t\t\t\tisCaptureDigestReference(entry.inputs) &&\n\t\t\t\t\t\tisCaptureCollection({ ...entry, inputs: { ...entry.inputs, files: {} } }),\n\t\t\t\t)(value.collections)),\n\t)\n}\n\n/**\n * Checks the host's declared viewport without deriving geometry from an output name.\n *\n * @param value - The published viewport data\n * @returns True if the named viewport has usable dimensions; false otherwise\n *\n * @example\n * ```ts\n * isCaptureGeometry({ name: 'light-390', width: 390, height: 844 }) // true\n * isCaptureGeometry({ name: 'light-390', width: 0, height: 844 }) // false\n * ```\n */\nexport function isCaptureGeometry(value: unknown): value is CaptureViewport {\n\treturn holds(\n\t\t() =>\n\t\t\tisObject(value) &&\n\t\t\t'name' in value &&\n\t\t\tisCaptureSegment(value.name) &&\n\t\t\t'width' in value &&\n\t\t\tisFiniteNumber(value.width) &&\n\t\t\tvalue.width > 0 &&\n\t\t\t'height' in value &&\n\t\t\tisFiniteNumber(value.height) &&\n\t\t\tvalue.height > 0,\n\t)\n}\n\n/**\n * Checks a journey artifact's recorded sampling box.\n *\n * @param value - The recorded viewport box\n * @returns True if its coordinates and dimensions are finite; false otherwise\n *\n * @example\n * ```ts\n * isCaptureBox({ x: 0, y: 64, width: 390, height: 780 }) // true\n * isCaptureBox({ x: 0, y: 64, width: 0, height: 780 }) // false\n * ```\n */\nexport function isCaptureBox(value: unknown): value is CaptureBox {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisFiniteNumber(value.x) &&\n\t\t\tisFiniteNumber(value.y) &&\n\t\t\tisFiniteNumber(value.width) &&\n\t\t\tvalue.width > 0 &&\n\t\t\tisFiniteNumber(value.height) &&\n\t\t\tvalue.height > 0,\n\t)\n}\n","import type {\n\tCaptureArtifactLines,\n\tCaptureAssertion,\n\tCaptureCase,\n\tCaptureDeclaration,\n\tCaptureDestination,\n\tCaptureDestinationOptions,\n\tCaptureEntry,\n\tCaptureLookup,\n\tCaptureReceipt,\n\tCaptureReport,\n\tCaptureRequest,\n\tCaptureRules,\n\tCaptureRun,\n\tCaptureRunOptions,\n\tCaptureSelection,\n\tCaptureStatus,\n\tCaptureTask,\n\tCaptureTestInput,\n\tCaptureTestOptions,\n} from './types.js'\nimport { arrayOf, isError, isFiniteNumber, isRecord, isString, preview } from '@orkestrel/contract'\nimport {\n\tCAPTURE_ARTIFACT_PREFIXES,\n\tCAPTURE_OWNER_PREFIX,\n\tCAPTURE_STATUS_PRECEDENCE,\n\tCAPTURE_VERSION,\n} from './constants.js'\nimport { CaptureError } from './errors.js'\nimport { isCaptureDeclaration, isCapturePath, isCaptureSelector } from './validators.js'\n\n/**\n * Describes a caught failure as one reportable line.\n *\n * @param error - The caught value, which need not be an `Error`\n * @returns The error's message, or the value's string form\n *\n * @example\n * ```ts\n * describeCaptureError(new Error('Unknown variant: phone')) // 'Unknown variant: phone'\n * describeCaptureError('refused') // 'refused'\n * ```\n */\nexport function describeCaptureError(error: unknown): string {\n\treturn isError(error) ? error.message : String(error)\n}\n\n/**\n * Finds repeated identities before a keyed collection could discard them.\n *\n * @param values - The identity population\n * @param folded - If `true`, compares case-folded keys; if `false`, compares exact identities. Default: `false`\n * @returns Every member whose comparison key appears more than once\n *\n * @example\n * ```ts\n * collectCaptureDuplicates(['a', 'b', 'a']) // ['a', 'a']\n * collectCaptureDuplicates(['Pages', 'pages'], true) // ['Pages', 'pages']\n * ```\n */\nexport function collectCaptureDuplicates(\n\tvalues: readonly string[],\n\tfolded = false,\n): readonly string[] {\n\tconst keys = values.map((value) => (folded ? value.toLowerCase() : value))\n\treturn values.filter(\n\t\t(_value, index) => keys.indexOf(keys[index] ?? '') !== keys.lastIndexOf(keys[index] ?? ''),\n\t)\n}\n\n/**\n * Refuses duplicate declarations or portable storage-key collisions before indexing.\n *\n * @param values - The complete identity population\n * @param label - The diagnostic subject\n * @param folded - If `true`, refuses case-colliding keys; if `false`, requires exact uniqueness. Default: `false`\n * @throws Thrown as an `EVIDENCE` capture error when an identity repeats.\n *\n * @example\n * ```ts\n * requireCaptureUnique(['mail', 'files'], 'owners') // returns\n * requireCaptureUnique(['mail', 'mail'], 'owners') // throws 'Duplicate owners: mail, mail'\n * ```\n */\nexport function requireCaptureUnique(\n\tvalues: readonly string[],\n\tlabel: string,\n\tfolded = false,\n): void {\n\tconst duplicates = collectCaptureDuplicates(values, folded)\n\tif (duplicates.length > 0)\n\t\tthrow new CaptureError(`Duplicate ${label}: ${duplicates.join(', ')}`, {\n\t\t\tcode: 'EVIDENCE',\n\t\t\tcontext: { label, duplicates },\n\t\t})\n}\n\n/**\n * Compares complete populations without erasing duplicates.\n *\n * @param left - The first population\n * @param right - The second population\n * @returns True if the sorted populations are equal; false otherwise\n *\n * @example\n * ```ts\n * matchesCaptureMembers(['b', 'a'], ['a', 'b']) // true\n * matchesCaptureMembers(['a', 'a'], ['a']) // false\n * ```\n */\nexport function matchesCaptureMembers(left: readonly string[], right: readonly string[]): boolean {\n\tconst ordered = right.toSorted()\n\treturn (\n\t\tleft.length === right.length &&\n\t\tleft.toSorted().every((entry, index) => entry === ordered[index])\n\t)\n}\n\n/**\n * Compares an owner with an explicit selector at colon boundaries.\n *\n * @param owner - The canonical owner\n * @param selector - The requested owner or the `all` selector\n * @returns True if the owner belongs to the selection; false otherwise\n *\n * @example\n * ```ts\n * matchesCaptureSelector('pages:mail', 'pages') // true\n * matchesCaptureSelector('pages:mailbox', 'pages:mail') // false\n * ```\n */\nexport function matchesCaptureSelector(owner: string, selector: string): boolean {\n\treturn selector === 'all' || owner === selector || owner.startsWith(`${selector}:`)\n}\n\n/**\n * Builds the canonical owner from a destination's registry identity.\n *\n * @param entry - The destination\n * @returns The scope, part, and optional section selector\n *\n * @example\n * ```ts\n * resolveCaptureOwner({ ...destination, scope: 'pages', part: 'mail' }) // 'pages:mail'\n * ```\n */\nexport function resolveCaptureOwner(entry: CaptureDestination): string {\n\treturn [entry.scope, entry.part, ...(entry.section === undefined ? [] : [entry.section])].join(\n\t\t':',\n\t)\n}\n\n/**\n * Builds a manifest identity independently of the physical image path.\n *\n * @param entry - The registry destination\n * @returns The scope-qualified state and output-variant key\n *\n * @example\n * ```ts\n * resolveCaptureKey({ ...destination, scope: 'pages', state: 'inbox', variant: 'light-390' })\n * // 'pages/inbox--light-390.png'\n * ```\n */\nexport function resolveCaptureKey(entry: CaptureDestination): string {\n\treturn `${entry.scope}/${entry.state}--${entry.variant}.png`\n}\n\n/**\n * Serializes a destination's identity and attribution in a deterministic field order.\n *\n * @param entry - The destination\n * @returns The comparison representation, excluding image and duration readings\n *\n * @example\n * ```ts\n * describeCaptureDestination(destination) === describeCaptureDestination({ ...destination })\n * // true\n * ```\n */\nexport function describeCaptureDestination(entry: CaptureDestination): string {\n\treturn JSON.stringify([\n\t\tentry.portfolio,\n\t\tentry.state,\n\t\tentry.scope,\n\t\tentry.part,\n\t\tentry.section,\n\t\tentry.variant,\n\t\tentry.project,\n\t\tentry.file,\n\t\tentry.case,\n\t\tentry.sources.own.toSorted(),\n\t\tentry.sources.shared.toSorted(),\n\t\tentry.sources.tests.toSorted(),\n\t])\n}\n\n/**\n * Serializes only the registry's execution and output identity, independent of input revisions.\n *\n * @param entry - The destination or inherited stamp\n * @returns The identity used for relevant manifest agreement during state resolution\n *\n * @example\n * ```ts\n * describeCaptureIdentity(destination) === describeCaptureIdentity({\n * \t...destination,\n * \tsources: { own: [], shared: [], tests: [] },\n * })\n * // true\n * ```\n */\nexport function describeCaptureIdentity(entry: CaptureDestination): string {\n\treturn JSON.stringify([\n\t\tentry.portfolio,\n\t\tentry.state,\n\t\tentry.scope,\n\t\tentry.part,\n\t\tentry.section,\n\t\tentry.variant,\n\t\tentry.project,\n\t\tentry.file,\n\t\tentry.case,\n\t])\n}\n\n/**\n * Serializes a complete behavioral declaration without dropping eligibility or states.\n *\n * @param entry - The collected declaration\n * @returns The deterministic comparison representation\n *\n * @example\n * ```ts\n * describeCaptureDeclaration({ ...declaration, states: ['b', 'a'] }) ===\n * \tdescribeCaptureDeclaration({ ...declaration, states: ['a', 'b'] })\n * // true\n * ```\n */\nexport function describeCaptureDeclaration(entry: CaptureDeclaration): string {\n\treturn JSON.stringify([\n\t\tentry.case,\n\t\tentry.owner,\n\t\tentry.variant,\n\t\tentry.eligible,\n\t\tentry.states.toSorted(),\n\t])\n}\n\n/**\n * Serializes every request field, retaining the exact argv order.\n *\n * @param request - The transported request\n * @returns The exact request comparison representation\n *\n * @example\n * ```ts\n * describeCaptureRequest(request) === describeCaptureRequest({ ...request, args: [] })\n * // false when the request carried argv\n * ```\n */\nexport function describeCaptureRequest(request: CaptureRequest): string {\n\treturn JSON.stringify([\n\t\trequest.version,\n\t\trequest.id,\n\t\trequest.stage,\n\t\trequest.pid,\n\t\trequest.config,\n\t\trequest.command,\n\t\trequest.mode,\n\t\trequest.selector,\n\t\trequest.case,\n\t\trequest.state,\n\t\trequest.variants,\n\t\trequest.args,\n\t])\n}\n\n/**\n * Names every changed, added, or removed file in hash populations.\n *\n * @param previous - The retained file hashes\n * @param current - The observed file hashes\n * @returns The sorted changed membership\n *\n * @example\n * ```ts\n * collectCaptureChanges({ 'a.ts': 'x', 'b.ts': 'y' }, { 'a.ts': 'x', 'b.ts': 'z', 'c.ts': 'w' })\n * // ['b.ts', 'c.ts']\n * ```\n */\nexport function collectCaptureChanges(\n\tprevious: Readonly<Record<string, string>>,\n\tcurrent: Readonly<Record<string, string>>,\n): readonly string[] {\n\treturn [...new Set([...Object.keys(previous), ...Object.keys(current)])]\n\t\t.filter((file) => previous[file] !== current[file])\n\t\t.toSorted()\n}\n\n/**\n * Builds the stable case identity used to merge separate lookup receipts.\n *\n * @param lookup - The lookup identity\n * @returns The producing variant and full case key\n *\n * @example\n * ```ts\n * resolveLookupKey({ variant: 'light-390', case: 'mail shows the inbox' })\n * // '[\"light-390\",\"mail shows the inbox\"]'\n * ```\n */\nexport function resolveLookupKey(lookup: Pick<CaptureLookup, 'variant' | 'case'>): string {\n\treturn JSON.stringify([lookup.variant, lookup.case])\n}\n\n/**\n * Reads successful Vitest JSON output and validates every owner-bearing assertion.\n *\n * @param value - The parsed external reporter document\n * @returns A validated projection of the fields used by integrity\n * @throws Thrown as an `EVIDENCE` capture error for failed reporters, malformed assertions, or duplicate case identities.\n *\n * @example\n * ```ts\n * const report = readCaptureReport(parseJSON(text))\n * report.assertions.map((assertion) => assertion.case)\n * ```\n */\nexport function readCaptureReport(value: unknown): CaptureReport {\n\tif (\n\t\t!isRecord(value) ||\n\t\tvalue.success !== true ||\n\t\tvalue.numFailedTests !== 0 ||\n\t\tvalue.numFailedTestSuites !== 0 ||\n\t\t!isFiniteNumber(value.startTime) ||\n\t\t!arrayOf(isRecord)(value.testResults) ||\n\t\tvalue.testResults.length === 0\n\t)\n\t\tthrow new CaptureError('Invalid or unsuccessful Vitest JSON report', { code: 'EVIDENCE' })\n\tconst files = value.testResults.map((file) => {\n\t\tif (\n\t\t\tfile.status !== 'passed' ||\n\t\t\t!isFiniteNumber(file.startTime) ||\n\t\t\t!isFiniteNumber(file.endTime) ||\n\t\t\tfile.endTime < file.startTime ||\n\t\t\t!arrayOf(isRecord)(file.assertionResults)\n\t\t)\n\t\t\tthrow new CaptureError('Invalid Vitest file report', { code: 'EVIDENCE' })\n\t\treturn { start: file.startTime, end: file.endTime, assertions: file.assertionResults }\n\t})\n\tconst assertions: readonly CaptureAssertion[] = files.flatMap((file) =>\n\t\tfile.assertions.flatMap((assertion) => {\n\t\t\tif (!isRecord(assertion.meta))\n\t\t\t\tthrow new CaptureError('Invalid Vitest assertion metadata', { code: 'EVIDENCE' })\n\t\t\tif (assertion.meta.owner === undefined) return []\n\t\t\tconst declaration = {\n\t\t\t\tcase: assertion.fullName,\n\t\t\t\towner: assertion.meta.owner,\n\t\t\t\tvariant: assertion.meta.variant,\n\t\t\t\teligible: assertion.meta.eligible === undefined ? true : assertion.meta.eligible,\n\t\t\t\tstates: assertion.meta.states === undefined ? [] : assertion.meta.states,\n\t\t\t}\n\t\t\tif (\n\t\t\t\t!isCaptureDeclaration(declaration) ||\n\t\t\t\t!isString(assertion.status) ||\n\t\t\t\t(assertion.duration !== undefined &&\n\t\t\t\t\tassertion.duration !== null &&\n\t\t\t\t\t(!isFiniteNumber(assertion.duration) || assertion.duration < 0))\n\t\t\t)\n\t\t\t\tthrow new CaptureError('Invalid owner-bearing Vitest assertion', { code: 'EVIDENCE' })\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\t...declaration,\n\t\t\t\t\tstatus: assertion.status,\n\t\t\t\t\t...(typeof assertion.duration === 'number' ? { duration: assertion.duration } : {}),\n\t\t\t\t},\n\t\t\t]\n\t\t}),\n\t)\n\trequireCaptureUnique(assertions.map(resolveLookupKey), 'reporter case identities')\n\treturn {\n\t\tstart: files.reduce((start, file) => Math.min(start, file.start), value.startTime),\n\t\tend: files.reduce((end, file) => Math.max(end, file.end), -Infinity),\n\t\tassertions,\n\t}\n}\n\n/**\n * Validates declaration, reporter, observation, completeness, and output-projection agreement.\n *\n * @param run - The final record\n * @param report - The validated external reporter\n * @param project - The actual producing project name\n * @throws Thrown as an `EVIDENCE` capture error when a record differs from the actual selected results or declarations.\n *\n * @example\n * ```ts\n * validateCaptureRun(run, readCaptureReport(parseJSON(text)), 'journey:light-390')\n * ```\n */\nexport function validateCaptureRun(run: CaptureRun, report: CaptureReport, project: string): void {\n\tconst assertions = report.assertions.filter((entry) => entry.variant === run.variant)\n\trequireCaptureUnique(\n\t\trun.declarations.map((entry) => entry.case),\n\t\t'declaring cases',\n\t)\n\trequireCaptureUnique(\n\t\trun.declarations.flatMap((entry) => entry.states),\n\t\t'declared states',\n\t\ttrue,\n\t)\n\trequireCaptureUnique(run.registry.map(resolveCaptureKey), 'registry identities', true)\n\trequireCaptureUnique(\n\t\trun.registry.map((entry) => entry.file),\n\t\t'registry paths',\n\t\ttrue,\n\t)\n\trequireCaptureUnique(run.entries.map(resolveCaptureKey), 'emitted identities', true)\n\trequireCaptureUnique(run.passed, 'passed cases')\n\trequireCaptureUnique(run.observed, 'observed states', true)\n\tif (\n\t\t!matchesCaptureMembers(\n\t\t\trun.declarations.map(describeCaptureDeclaration),\n\t\t\tassertions.map(describeCaptureDeclaration),\n\t\t)\n\t)\n\t\tthrow new CaptureError('Run declarations differ from full reporter declarations', {\n\t\t\tcode: 'EVIDENCE',\n\t\t})\n\tconst eligible = run.declarations.filter((entry) => entry.eligible)\n\tconst passed = assertions.filter((entry) => entry.eligible && entry.status === 'passed')\n\tif (\n\t\t!matchesCaptureMembers(\n\t\t\trun.passed,\n\t\t\tpassed.map((entry) => entry.case),\n\t\t)\n\t)\n\t\tthrow new CaptureError('Run passed cases differ from reporter results', { code: 'EVIDENCE' })\n\tif (\n\t\t!matchesCaptureMembers(\n\t\t\trun.observed,\n\t\t\tpassed.flatMap((entry) => entry.states),\n\t\t)\n\t)\n\t\tthrow new CaptureError('Run observations differ from full passed declarations', {\n\t\t\tcode: 'EVIDENCE',\n\t\t})\n\tif (run.complete !== (eligible.length > 0 && eligible.length === passed.length))\n\t\tthrow new CaptureError('Run completeness differs from eligible results', { code: 'EVIDENCE' })\n\tfor (const declaration of eligible) {\n\t\tconst destinations = run.registry.filter((entry) => entry.case === declaration.case)\n\t\tif (\n\t\t\t!matchesCaptureMembers(\n\t\t\t\tdestinations.map((entry) => entry.state),\n\t\t\t\tdeclaration.states,\n\t\t\t) ||\n\t\t\tdestinations.some(\n\t\t\t\t(entry) =>\n\t\t\t\t\tentry.project !== project ||\n\t\t\t\t\t!matchesCaptureSelector(resolveCaptureOwner(entry), declaration.owner),\n\t\t\t)\n\t\t)\n\t\t\tthrow new CaptureError(`Registry differs from eligible declaration: ${declaration.case}`, {\n\t\t\t\tcode: 'EVIDENCE',\n\t\t\t})\n\t}\n\tif (\n\t\trun.registry.some((entry) => !eligible.some((declaration) => declaration.case === entry.case))\n\t)\n\t\tthrow new CaptureError('Registry contains an ineligible or undeclared case', {\n\t\t\tcode: 'EVIDENCE',\n\t\t})\n\tconst reference = run.registry.filter((entry) => entry.section === entry.state)\n\tif (\n\t\trun.reference !==\n\t\t(reference.length > 0 && reference.every((entry) => run.passed.includes(entry.case)))\n\t)\n\t\tthrow new CaptureError('Reference completeness differs from declaring section results', {\n\t\t\tcode: 'EVIDENCE',\n\t\t})\n\tconst request = run.request\n\tif (request !== undefined) {\n\t\tif (\n\t\t\trun.identity === undefined ||\n\t\t\trun.identity.id !== request.id ||\n\t\t\trun.identity.stage !== request.stage ||\n\t\t\trun.identity.pid !== request.pid ||\n\t\t\trun.identity.config !== request.config ||\n\t\t\t!request.variants.includes(run.variant)\n\t\t)\n\t\t\tthrow new CaptureError('Run identity differs from its request', { code: 'EVIDENCE' })\n\t\tconst selected = eligible.filter(\n\t\t\t(entry) =>\n\t\t\t\tmatchesCaptureSelector(entry.owner, request.selector) &&\n\t\t\t\t(request.case === undefined || entry.case === request.case) &&\n\t\t\t\t(request.command === 'journey' || entry.states.length > 0),\n\t\t)\n\t\tif (\n\t\t\t!matchesCaptureMembers(\n\t\t\t\tselected.map((entry) => entry.case),\n\t\t\t\trun.passed,\n\t\t\t)\n\t\t)\n\t\t\tthrow new CaptureError('Selected full case names differ from passed results', {\n\t\t\t\tcode: 'EVIDENCE',\n\t\t\t})\n\t\tif (\n\t\t\trequest.state !== undefined &&\n\t\t\tselected.some((entry) => !entry.states.includes(request.state ?? ''))\n\t\t)\n\t\t\tthrow new CaptureError('Requested state differs from its selected declaring case', {\n\t\t\t\tcode: 'EVIDENCE',\n\t\t\t})\n\t}\n\tconst expected =\n\t\trequest?.command === 'journey' || (request === undefined && run.entries.length === 0)\n\t\t\t? []\n\t\t\t: run.registry.filter(\n\t\t\t\t\t(entry) =>\n\t\t\t\t\t\trun.passed.includes(entry.case) &&\n\t\t\t\t\t\t(request?.state === undefined || entry.state === request.state),\n\t\t\t\t)\n\tif (\n\t\t!matchesCaptureMembers(\n\t\t\trun.entries.map(describeCaptureDestination),\n\t\t\texpected.map(describeCaptureDestination),\n\t\t)\n\t)\n\t\tthrow new CaptureError('Emitted entries differ from exact requested projection', {\n\t\t\tcode: 'EVIDENCE',\n\t\t})\n\tfor (const entry of run.entries) {\n\t\tif (passed.find((assertion) => assertion.case === entry.case)?.duration !== entry.duration)\n\t\t\tthrow new CaptureError(`Emitted duration differs from its producing case: ${entry.case}`, {\n\t\t\t\tcode: 'EVIDENCE',\n\t\t\t})\n\t}\n}\n\n/**\n * Chooses the primary classification while retaining all findings separately.\n *\n * @param statuses - Every classification justified by the reading\n * @returns The highest-precedence classification, or `current` when none applies\n *\n * @example\n * ```ts\n * resolveCaptureStatus(['stale-own', 'missing']) // 'missing'\n * resolveCaptureStatus([]) // 'current'\n * ```\n */\nexport function resolveCaptureStatus(statuses: readonly CaptureStatus[]): CaptureStatus {\n\treturn CAPTURE_STATUS_PRECEDENCE.find((status) => statuses.includes(status)) ?? 'current'\n}\n\n/**\n * Reads Git's NUL-delimited porcelain paths without treating spaces or quoted names as separators.\n *\n * @param output - The exact `status --porcelain=v1 -z` output\n * @returns Dirty repository-relative paths, including both sides of renames, sorted without repeats\n * @throws Thrown as an `EVIDENCE` capture error when a rename or copy record has no original path.\n *\n * @example\n * ```ts\n * readCaptureDirty(' M src/a.ts\\0R src/b.ts\\0src/c.ts\\0') // ['src/a.ts', 'src/b.ts', 'src/c.ts']\n * ```\n */\nexport function readCaptureDirty(output: string): readonly string[] {\n\t// A rename or copy record is followed by its original path as a bare record, so whether a record\n\t// is an original depends on the record before it, and the result carries that in its accumulator.\n\tconst result = output\n\t\t.split('\\0')\n\t\t.filter((record) => record !== '')\n\t\t.reduce<{ readonly paths: readonly string[]; readonly pending: boolean }>(\n\t\t\t(state, record) =>\n\t\t\t\tstate.pending\n\t\t\t\t\t? { paths: [...state.paths, record], pending: false }\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tpaths: [...state.paths, record.slice(3)],\n\t\t\t\t\t\t\tpending: /[RC]/u.test(record.slice(0, 2)),\n\t\t\t\t\t\t},\n\t\t\t{ paths: [], pending: false },\n\t\t)\n\tif (result.pending)\n\t\tthrow new CaptureError('Incomplete Git rename provenance', { code: 'EVIDENCE' })\n\treturn [...new Set(result.paths)].toSorted()\n}\n\n/**\n * Validates a complete receipt against full reporter declarations and eligible output coverage.\n *\n * @param receipt - The retained complete-run receipt\n * @param report - The authenticated reporter projection\n * @throws Thrown as an `EVIDENCE` capture error when the receipt omits, invents, or changes a collected declaration or output.\n *\n * @example\n * ```ts\n * validateCaptureReceipt(receipt, readCaptureReport(parseJSON(text)))\n * ```\n */\nexport function validateCaptureReceipt(receipt: CaptureReceipt, report: CaptureReport): void {\n\tconst assertions = report.assertions.filter((entry) => entry.variant === receipt.variant)\n\tif (\n\t\t!receipt.complete ||\n\t\t!matchesCaptureMembers(\n\t\t\tassertions.map(describeCaptureDeclaration),\n\t\t\treceipt.declarations.map(describeCaptureDeclaration),\n\t\t) ||\n\t\t!assertions.some((entry) => entry.eligible) ||\n\t\tassertions.some((entry) => entry.eligible && entry.status !== 'passed')\n\t)\n\t\tthrow new CaptureError('Registry receipt does not prove complete eligible behavior', {\n\t\t\tcode: 'EVIDENCE',\n\t\t})\n\tconst eligible = receipt.declarations.filter((entry) => entry.eligible)\n\tfor (const declaration of eligible) {\n\t\trequireCaptureUnique(declaration.states, 'states within a declaration', true)\n\t\tconst entries = receipt.registry.filter((entry) => entry.case === declaration.case)\n\t\tif (\n\t\t\t!matchesCaptureMembers(\n\t\t\t\tentries.map((entry) => entry.state),\n\t\t\t\tdeclaration.states,\n\t\t\t) ||\n\t\t\tentries.some(\n\t\t\t\t(entry) => !matchesCaptureSelector(resolveCaptureOwner(entry), declaration.owner),\n\t\t\t)\n\t\t)\n\t\t\tthrow new CaptureError('Registry receipt destination coverage differs from declarations', {\n\t\t\t\tcode: 'EVIDENCE',\n\t\t\t})\n\t}\n\tif (\n\t\treceipt.registry.some(\n\t\t\t(entry) => !eligible.some((declaration) => declaration.case === entry.case),\n\t\t) ||\n\t\tnew Set(receipt.registry.map((entry) => entry.project)).size > 1\n\t)\n\t\tthrow new CaptureError(\n\t\t\t'Registry receipt contains an undeclared output or mixes producing projects',\n\t\t\t{ code: 'EVIDENCE' },\n\t\t)\n}\n\n/**\n * Expands an owner path into its prefixes, from its scope through the owner itself.\n *\n * @param owner - A canonical owner path\n * @returns Each colon-bounded prefix, shortest first\n *\n * @example\n * ```ts\n * collectCaptureAncestors('pages:mail:inbox') // ['pages', 'pages:mail', 'pages:mail:inbox']\n * ```\n */\nexport function collectCaptureAncestors(owner: string): readonly string[] {\n\treturn owner.split(':').map((_part, index, parts) => parts.slice(0, index + 1).join(':'))\n}\n\n/**\n * Builds the owner and capture tags a wrapper declares for its owner population.\n *\n * @param owners - Every canonical owner path the host declares\n * @returns The unique `owner:` tag of each owner and ancestor, and each owner's scope and part tags\n * @throws Thrown as a `HOST` capture error naming each owner that is not a canonical selector.\n *\n * @example\n * ```ts\n * buildCaptureTags(['pages:mail'])\n * // ['owner:pages', 'owner:pages:mail', 'pages', 'pages:mail']\n * ```\n */\nexport function buildCaptureTags(owners: readonly string[]): readonly string[] {\n\tconst invalid = owners.filter((owner) => !isCaptureSelector(owner))\n\tif (invalid.length > 0)\n\t\tthrow new CaptureError(\n\t\t\t`Invalid capture owners: ${invalid.map((owner) => preview(owner)).join(', ')}; expected colon-separated portable segments such as \"pages:mail\"`,\n\t\t\t{ code: 'HOST', context: { owners: invalid } },\n\t\t)\n\treturn [\n\t\t...new Set(\n\t\t\towners.flatMap((owner) => [\n\t\t\t\t...collectCaptureAncestors(owner).map((path) => `${CAPTURE_OWNER_PREFIX}${path}`),\n\t\t\t\t...collectCaptureAncestors(owner).slice(0, 2),\n\t\t\t]),\n\t\t),\n\t]\n}\n\n/**\n * Builds the Vitest test options of one capture case from its declaration.\n *\n * @param input - The case's owner, states, producing variant, and harness values\n * @param rules - The host's owners and part resolver\n * @returns The derived tags, the capture metadata, and the optional timeout\n * @throws Thrown as a `HOST` capture error for an undeclared owner or tag, tags beside an owner, capture tags with no states, or a state whose part is undeclared or outside the owner.\n *\n * @example\n * ```ts\n * buildCaptureTest({ owner: 'pages:mail', states: ['inbox'], variant: 'light-390' }, rules).tags\n * // ['owner:pages', 'owner:pages:mail', 'pages', 'pages:mail']\n * ```\n */\nexport function buildCaptureTest(input: CaptureTestInput, rules: CaptureRules): CaptureTestOptions {\n\tconst declared = buildCaptureTags(rules.owners)\n\tconst owner = input.owner\n\tif (owner !== undefined && !declared.includes(`${CAPTURE_OWNER_PREFIX}${owner}`))\n\t\tthrow new CaptureError(\n\t\t\t`Unknown capture owner: ${preview(owner)}; expected a declared owner path or one of its ancestors`,\n\t\t\t{ code: 'HOST', context: { owner } },\n\t\t)\n\tif (owner !== undefined && input.tags !== undefined)\n\t\tthrow new CaptureError(\n\t\t\t`Capture case owned by ${owner} derives its tags from its owner and states; remove its tags`,\n\t\t\t{ code: 'HOST', context: { owner } },\n\t\t)\n\tconst unknown = (input.tags ?? []).filter((tag) => !declared.includes(tag))\n\tif (unknown.length > 0)\n\t\tthrow new CaptureError(\n\t\t\t`Unknown capture tags: ${unknown.map((tag) => preview(tag)).join(', ')}; expected tags the owners declare`,\n\t\t\t{ code: 'HOST', context: { tags: unknown } },\n\t\t)\n\tif (\n\t\tinput.states === undefined &&\n\t\t(input.tags ?? []).some((tag) => !tag.startsWith(CAPTURE_OWNER_PREFIX))\n\t)\n\t\tthrow new CaptureError(\n\t\t\t'Capture case names capture tags but declares no states; declare its states, an empty list included',\n\t\t\t{ code: 'HOST' },\n\t\t)\n\tconst parts = (input.states ?? []).map((state) => {\n\t\tconst part = rules.part(state)\n\t\tif (!declared.includes(`${CAPTURE_OWNER_PREFIX}${part}`))\n\t\t\tthrow new CaptureError(\n\t\t\t\t`Capture state ${state} resolves to an undeclared owner: ${preview(part)}`,\n\t\t\t\t{ code: 'HOST', context: { state, part } },\n\t\t\t)\n\t\tif (owner !== undefined && !matchesCaptureSelector(part, owner))\n\t\t\tthrow new CaptureError(\n\t\t\t\t`Capture state ${state} belongs to ${part}, outside owner ${owner}; split the case by owner`,\n\t\t\t\t{ code: 'HOST', context: { state, part, owner } },\n\t\t\t)\n\t\treturn part\n\t})\n\treturn {\n\t\ttags: [\n\t\t\t...new Set([\n\t\t\t\t...(input.owner === undefined\n\t\t\t\t\t? (input.tags ?? [])\n\t\t\t\t\t: collectCaptureAncestors(input.owner).map((path) => `${CAPTURE_OWNER_PREFIX}${path}`)),\n\t\t\t\t...parts.flatMap((part) => collectCaptureAncestors(part).slice(0, 2)),\n\t\t\t]),\n\t\t],\n\t\tmeta: {\n\t\t\t...(input.owner === undefined ? {} : { owner: input.owner }),\n\t\t\t...(input.states === undefined ? {} : { states: [...input.states] }),\n\t\t\tvariant: input.variant,\n\t\t\t...(input.eligible === undefined ? {} : { eligible: input.eligible }),\n\t\t},\n\t\t...(input.timeout === undefined ? {} : { timeout: input.timeout }),\n\t}\n}\n\n/**\n * Collects every leaf case under a task, keeping cases a runner filter excluded and their results.\n *\n * @param task - A Vitest file, suite, or test task\n * @param ancestors - The titles of the suites that enclose the task, excluding the file name. Default: none\n * @returns Each case with its suite titles and own title joined by spaces, as the Vitest JSON reporter names it\n *\n * @example\n * ```ts\n * collectCaptureCases({ name: 'mail', mode: 'run', meta: {}, tasks: [inbox] })[0]?.name\n * // 'mail opens the inbox'\n * ```\n */\nexport function collectCaptureCases(\n\ttask: CaptureTask,\n\tancestors: readonly string[] = [],\n): readonly CaptureCase[] {\n\tconst names = task.filepath === undefined ? [...ancestors, task.name] : ancestors\n\tif (task.tasks !== undefined)\n\t\treturn task.tasks.flatMap((child) => collectCaptureCases(child, names))\n\treturn [\n\t\t{\n\t\t\tname: names.join(' '),\n\t\t\tmode: task.mode,\n\t\t\ttags: [...(task.tags ?? [])],\n\t\t\tmeta: {\n\t\t\t\t...(task.meta.owner === undefined ? {} : { owner: task.meta.owner }),\n\t\t\t\t...(task.meta.states === undefined ? {} : { states: [...task.meta.states] }),\n\t\t\t\t...(task.meta.variant === undefined ? {} : { variant: task.meta.variant }),\n\t\t\t\t...(task.meta.eligible === undefined ? {} : { eligible: task.meta.eligible }),\n\t\t\t},\n\t\t\t...(task.result === undefined\n\t\t\t\t? {}\n\t\t\t\t: {\n\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\tstate: task.result.state,\n\t\t\t\t\t\t\t...(task.result.duration === undefined ? {} : { duration: task.result.duration }),\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t},\n\t]\n}\n\n/**\n * Refuses a selection whose cases place states owned outside the selected owner.\n *\n * @param cases - Every collected case, including cases a runner filter excluded\n * @param rules - The host's owners and part resolver\n * @param selection - The runner's selection, absent when no runner is the parent\n * @throws Thrown as a `SELECTION` capture error for an undeclared selector, and as a `HOST` capture error naming each case that places a selected state from outside the selected owner.\n *\n * @example\n * ```ts\n * requireCaptureCases(cases, rules, { selector: 'pages:mail' }) // returns when no case is parked\n * ```\n */\nexport function requireCaptureCases(\n\tcases: readonly CaptureCase[],\n\trules: CaptureRules,\n\tselection?: CaptureSelection,\n): void {\n\tif (selection === undefined || selection.selector === 'all') return\n\tconst { selector } = selection\n\tif (!buildCaptureTags(rules.owners).includes(`${CAPTURE_OWNER_PREFIX}${selector}`))\n\t\tthrow new CaptureError(\n\t\t\t`Unknown capture selector: ${preview(selector)}; expected all or a declared owner path`,\n\t\t\t{ code: 'SELECTION', context: { selector } },\n\t\t)\n\tconst parked = cases\n\t\t.filter((entry) => selection.case === undefined || entry.name === selection.case)\n\t\t.flatMap((entry) => {\n\t\t\tconst owner = entry.meta.owner\n\t\t\tif (owner === undefined || matchesCaptureSelector(owner, selector)) return []\n\t\t\tconst states = (entry.meta.states ?? []).filter((state) =>\n\t\t\t\tmatchesCaptureSelector(rules.part(state), selector),\n\t\t\t)\n\t\t\treturn states.length > 0\n\t\t\t\t? [`${entry.name}: owner ${owner}; foreign states ${states.join(', ')}`]\n\t\t\t\t: []\n\t\t})\n\tif (parked.length > 0)\n\t\tthrow new CaptureError(\n\t\t\t`Capture selection ${selector} is parked; split each case so its states stay inside its owner:\\n${parked.join('\\n')}`,\n\t\t\t{ code: 'HOST', context: { selector, parked } },\n\t\t)\n}\n\n/**\n * Builds the required output pair of each state an eligible owner-bearing case declares.\n *\n * @param cases - Every collected case, including cases a runner filter excluded\n * @param rules - The host's part and source resolvers\n * @param options - The producing project and the portfolio mapping of each state\n * @returns One destination per declared state, in case and state order\n * @throws Thrown as a `HOST` capture error when a state has no single mapping or resolves outside its case's owner or the scope, part, and optional section form.\n *\n * @example\n * ```ts\n * buildCaptureDestinations(cases, rules, { project: 'journey:light-390', portfolios })[0]?.file\n * // 'tmp/captures/states/pages/inbox--light-390.png'\n * ```\n */\nexport function buildCaptureDestinations(\n\tcases: readonly CaptureCase[],\n\trules: CaptureRules,\n\toptions: CaptureDestinationOptions,\n): readonly CaptureDestination[] {\n\treturn cases.flatMap((entry) => {\n\t\tconst declared = entry.meta.owner\n\t\tif (declared === undefined || entry.meta.eligible === false) return []\n\t\treturn (entry.meta.states ?? []).map((state): CaptureDestination => {\n\t\t\tconst mappings = options.portfolios.filter((portfolio) => portfolio.states.includes(state))\n\t\t\tconst [mapping] = mappings\n\t\t\tif (mapping === undefined || mappings.length > 1)\n\t\t\t\tthrow new CaptureError(\n\t\t\t\t\t`Capture state ${state} needs exactly one portfolio mapping; mapped by: ${mappings.map((candidate) => preview(candidate.portfolio)).join(', ') || 'none'}`,\n\t\t\t\t\t{ code: 'HOST', context: { state } },\n\t\t\t\t)\n\t\t\tconst owner = rules.part(state)\n\t\t\tif (!matchesCaptureSelector(owner, declared))\n\t\t\t\tthrow new CaptureError(\n\t\t\t\t\t`Capture state ${state} belongs to ${owner}, outside owner ${declared} of ${entry.name}`,\n\t\t\t\t\t{ code: 'HOST', context: { state, owner, declared } },\n\t\t\t\t)\n\t\t\tconst [scope, part, section, ...rest] = owner.split(':')\n\t\t\tif (scope === undefined || part === undefined || rest.length > 0)\n\t\t\t\tthrow new CaptureError(\n\t\t\t\t\t`Capture state ${state} resolves to ${preview(owner)}; expected scope:part or scope:part:section`,\n\t\t\t\t\t{ code: 'HOST', context: { state, owner } },\n\t\t\t\t)\n\t\t\treturn {\n\t\t\t\tportfolio: mapping.portfolio,\n\t\t\t\tstate,\n\t\t\t\tscope,\n\t\t\t\tpart,\n\t\t\t\t...(section === undefined ? {} : { section }),\n\t\t\t\tvariant: mapping.variant,\n\t\t\t\tproject: options.project,\n\t\t\t\tfile: `${mapping.directory}/${mapping.scoped ? `${scope}/` : ''}${state}--${mapping.variant}.png`,\n\t\t\t\tcase: entry.name,\n\t\t\t\tsources: rules.sources(owner),\n\t\t\t}\n\t\t})\n\t})\n}\n\n/**\n * Builds a run record from collected cases, the run's destinations, and its observed and emitted states.\n *\n * @param options - The cases, registry, observed states, emitted state-to-path pairs, and execution context\n * @returns The final record, without the journey artifact the caller binds after rendering it\n * @throws Thrown as a `HOST` capture error for an owner-bearing case with no variant, and as an `EVIDENCE` capture error for an emitted state with no destination, a path other than its destination's file, or a producing case with no measured duration.\n *\n * @example\n * ```ts\n * const run = buildCaptureRun({ cases, registry, observed, emitted, variant: 'light-390', time })\n * validateCaptureRun(run, readCaptureReport(parseJSON(text)), 'journey:light-390')\n * ```\n */\nexport function buildCaptureRun(options: CaptureRunOptions): CaptureRun {\n\tconst declarations = options.cases.flatMap((entry): readonly CaptureDeclaration[] => {\n\t\tconst { owner, variant } = entry.meta\n\t\tif (owner === undefined) return []\n\t\tif (variant === undefined)\n\t\t\tthrow new CaptureError(`Owner-bearing case declares no variant: ${entry.name}`, {\n\t\t\t\tcode: 'HOST',\n\t\t\t})\n\t\treturn [\n\t\t\t{\n\t\t\t\tcase: entry.name,\n\t\t\t\towner,\n\t\t\t\tvariant,\n\t\t\t\teligible: entry.meta.eligible !== false,\n\t\t\t\tstates: [...(entry.meta.states ?? [])],\n\t\t\t},\n\t\t]\n\t})\n\tconst passed = declarations\n\t\t.filter(\n\t\t\t(declaration) =>\n\t\t\t\tdeclaration.eligible &&\n\t\t\t\toptions.cases.some(\n\t\t\t\t\t(entry) => entry.name === declaration.case && entry.result?.state === 'pass',\n\t\t\t\t),\n\t\t)\n\t\t.map((declaration) => declaration.case)\n\tconst entries = options.emitted.map(([state, path]): CaptureEntry => {\n\t\tconst destination = options.registry.find((entry) => entry.state === state)\n\t\tif (destination === undefined)\n\t\t\tthrow new CaptureError(`Emitted state has no registry destination: ${preview(state)}`, {\n\t\t\t\tcode: 'EVIDENCE',\n\t\t\t\tcontext: { state },\n\t\t\t})\n\t\tconst written = path.replaceAll('\\\\', '/')\n\t\tif (written !== destination.file && !written.endsWith(`/${destination.file}`))\n\t\t\tthrow new CaptureError(\n\t\t\t\t`Emitted state ${state} was written at ${preview(path)}, not at its destination ${destination.file}`,\n\t\t\t\t{ code: 'EVIDENCE', context: { state, path, file: destination.file } },\n\t\t\t)\n\t\tconst duration = options.cases.find((entry) => entry.name === destination.case)?.result\n\t\t\t?.duration\n\t\tif (duration === undefined)\n\t\t\tthrow new CaptureError(`Emitting case has no measured duration: ${destination.case}`, {\n\t\t\t\tcode: 'EVIDENCE',\n\t\t\t\tcontext: { state, case: destination.case },\n\t\t\t})\n\t\treturn { ...destination, duration }\n\t})\n\tconst eligible = declarations.filter((declaration) => declaration.eligible)\n\tconst reference = options.registry.filter((entry) => entry.section === entry.state)\n\tconst request = options.request\n\treturn {\n\t\tversion: CAPTURE_VERSION,\n\t\t...(request === undefined\n\t\t\t? {}\n\t\t\t: {\n\t\t\t\t\tidentity: {\n\t\t\t\t\t\tid: request.id,\n\t\t\t\t\t\tstage: request.stage,\n\t\t\t\t\t\tpid: request.pid,\n\t\t\t\t\t\tconfig: request.config,\n\t\t\t\t\t},\n\t\t\t\t\trequest,\n\t\t\t\t}),\n\t\tvariant: options.variant,\n\t\ttime: options.time,\n\t\tcomplete: eligible.length > 0 && eligible.every((entry) => passed.includes(entry.case)),\n\t\treference: reference.length > 0 && reference.every((entry) => passed.includes(entry.case)),\n\t\tdeclarations,\n\t\tregistry: [...options.registry],\n\t\tpassed,\n\t\tobserved: [...options.observed],\n\t\tentries,\n\t}\n}\n\n/**\n * Renders the journey artifact lines that bind a run record and each case that passed in it.\n *\n * @param record - The run record's portable path\n * @param run - The run whose passed cases the artifact names\n * @returns The `record=` line, then one `case-ran=` line per passed case, without line endings\n * @throws Thrown as an `EVIDENCE` capture error for a record path that is not portable or a case name that holds a line break.\n *\n * @example\n * ```ts\n * renderCaptureArtifact('tmp/captures/states/runs/run-1/selected/light-390.json', {\n * \tpassed: ['mail opens the inbox'],\n * })\n * // ['record=tmp/captures/states/runs/run-1/selected/light-390.json', 'case-ran=mail opens the inbox']\n * ```\n */\nexport function renderCaptureArtifact(\n\trecord: string,\n\trun: Pick<CaptureRun, 'passed'>,\n): readonly string[] {\n\tif (!isCapturePath(record))\n\t\tthrow new CaptureError(\n\t\t\t`Artifact record path is not a portable relative path: ${preview(record)}`,\n\t\t\t{ code: 'EVIDENCE', context: { record } },\n\t\t)\n\tconst broken = run.passed.filter((name) => /[\\r\\n]/u.test(name))\n\tif (broken.length > 0)\n\t\tthrow new CaptureError(\n\t\t\t`Artifact cannot carry case names with line breaks: ${broken.map((name) => preview(name)).join(', ')}`,\n\t\t\t{ code: 'EVIDENCE', context: { cases: broken } },\n\t\t)\n\treturn [\n\t\t`${CAPTURE_ARTIFACT_PREFIXES.record}${record}`,\n\t\t...run.passed.map((name) => `${CAPTURE_ARTIFACT_PREFIXES.case}${name}`),\n\t]\n}\n\n/**\n * Reads the record bindings and the ran cases from a journey artifact's text.\n *\n * @param text - The artifact text, with LF or CRLF line endings\n * @returns The path of each `record=` line and the full name of each `case-ran=` line, in text order\n *\n * @example\n * ```ts\n * readCaptureArtifact('# light-390\\r\\nrecord=tmp/run.json\\r\\ncase-ran=mail opens the inbox\\r\\n')\n * // { records: ['tmp/run.json'], cases: ['mail opens the inbox'] }\n * ```\n */\nexport function readCaptureArtifact(text: string): CaptureArtifactLines {\n\tconst lines = text.split(/\\r\\n|\\n/u)\n\treturn {\n\t\trecords: lines\n\t\t\t.filter((line) => line.startsWith(CAPTURE_ARTIFACT_PREFIXES.record))\n\t\t\t.map((line) => line.slice(CAPTURE_ARTIFACT_PREFIXES.record.length)),\n\t\tcases: lines\n\t\t\t.filter((line) => line.startsWith(CAPTURE_ARTIFACT_PREFIXES.case))\n\t\t\t.map((line) => line.slice(CAPTURE_ARTIFACT_PREFIXES.case.length)),\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiBA,IAAa,sBAAsB,OAAO,OAAO;CAChD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAU;;;;;;;;;;;;;AAcV,IAAa,sBAAsB,OAAO,IAAI,iCAAiC;;;;;;;;;;;;;AAc/E,IAAa,4BAA4B,OAAO,OAAO;CACtD;CACA;CACA;CACA;CACA;CACA;AACD,CAAU;;;;;;;;;AAUV,IAAa,yBAAyB;;;;;;;;;AAUtC,IAAa,kBAAkB;;;;;;;;;AAU/B,IAAa,wBAAwB,OAAO,OAAO;CAAC;CAAK;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;AAAE,CAAU;;;;;;;;;AAU7F,IAAa,wBAAwB;;;;;;;;;AAUrC,IAAa,wBAAwB;;;;;;;;;AAUrC,IAAa,uBAAuB;;;;;;;;;AAUpC,IAAa,uBAAuB;;;;;;;;;;;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,UAAU,OAAO,SAAS,MAAM,IAAI,CAAC;EACzF;EACA,UAAU,CAAC,GAAG,QAAQ,QAAQ;EAC9B;EACA,UAAU,CAAC,GAAG,QAAQ,QAAQ;EAC9B;CACD;AACD;;;;;;;;;;;;;;;;;AAkBA,SAAgB,sBACf,QACA,KACoB;CACpB,IAAI,CAAC,cAAc,MAAM,GACxB,MAAM,IAAI,aACT,0DAAA,GAAyDA,oBAAAA,QAAAA,CAAQ,MAAM,KACvE;EAAE,MAAM;EAAY,SAAS,EAAE,OAAO;CAAE,CACzC;CACD,MAAM,SAAS,IAAI,OAAO,QAAQ,SAAS,UAAU,KAAK,IAAI,CAAC;CAC/D,IAAI,OAAO,SAAS,GACnB,MAAM,IAAI,aACT,sDAAsD,OAAO,KAAK,UAAA,GAASA,oBAAAA,QAAAA,CAAQ,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,KACnG;EAAE,MAAM;EAAY,SAAS,EAAE,OAAO,OAAO;CAAE,CAChD;CACD,OAAO,CACN,GAAG,0BAA0B,SAAS,UACtC,GAAG,IAAI,OAAO,KAAK,SAAS,GAAG,0BAA0B,OAAO,MAAM,CACvE;AACD;;;;;;;;;;;;;AAcA,SAAgB,oBAAoB,MAAoC;CACvE,MAAM,QAAQ,KAAK,MAAM,UAAU;CACnC,OAAO;EACN,SAAS,MACP,QAAQ,SAAS,KAAK,WAAW,0BAA0B,MAAM,CAAC,CAAC,CACnE,KAAK,SAAS,KAAK,MAAM,0BAA0B,OAAO,MAAM,CAAC;EACnE,OAAO,MACL,QAAQ,SAAS,KAAK,WAAW,0BAA0B,IAAI,CAAC,CAAC,CACjE,KAAK,SAAS,KAAK,MAAM,0BAA0B,KAAK,MAAM,CAAC;CAClE;AACD"}
1
+ {"version":3,"file":"index.cjs","names":["holds","isError","INTRINSICS","isObject","isFunction","holds","isRecord","arrayOf","isSafeInteger","isString","isFiniteNumber","isObject","isError","isRecord","isFiniteNumber","arrayOf","isString","preview"],"sources":["../../../src/core/constants.ts","../../../src/core/errors.ts","../../../src/core/validators.ts","../../../src/core/helpers.ts"],"sourcesContent":["/**\n * Lists the condition axes a capture failure carries, in the order the executable reports them.\n *\n * @remarks\n * `USAGE` is a refused command line and exits 64; every other condition exits 1. `SELECTION`\n * names a selector, variant, case, state, or portfolio the host does not declare. `HOST` names a\n * wrapper, configuration, or declaration fault. `STAGE` names a runner stage that did not\n * complete. `EVIDENCE` names a record, report, journal, or manifest that fails its protocol, and a\n * document of another version. `REGISTRY` names an accepted registry that is absent, fails\n * authentication, or lags the declarations. `LOOKUP` names a state lookup that is absent or stale.\n * `CONTAINMENT` names a path that leaves the authorized roots.\n *\n * @example\n * ```ts\n * CAPTURE_ERROR_CODES.includes('USAGE') // true\n * ```\n */\nexport const CAPTURE_ERROR_CODES = Object.freeze([\n\t'USAGE',\n\t'SELECTION',\n\t'HOST',\n\t'STAGE',\n\t'EVIDENCE',\n\t'REGISTRY',\n\t'LOOKUP',\n\t'CONTAINMENT',\n] as const)\n\n/**\n * Keys the global brand a capture error carries, so a duplicate installation recognizes it.\n *\n * @remarks\n * The key follows the package-and-class form, `Symbol.for('<package>.<ClassName>')`. The brand is\n * a recognition marker and never proof that the class's constructor ran.\n *\n * @example\n * ```ts\n * CAPTURE_ERROR_BRAND === Symbol.for('@orkestrel/capture.CaptureError') // true\n * ```\n */\nexport const CAPTURE_ERROR_BRAND = Symbol.for('@orkestrel/capture.CaptureError')\n\n/**\n * Lists the non-current freshness classifications from highest precedence to lowest.\n *\n * @remarks\n * `resolveCaptureStatus` reads this order to choose a frame's primary classification while the\n * reading keeps every finding separately. A frame with none of these is current.\n *\n * @example\n * ```ts\n * CAPTURE_STATUS_PRECEDENCE[0] // 'duplicate'\n * ```\n */\nexport const CAPTURE_STATUS_PRECEDENCE = Object.freeze([\n\t'duplicate',\n\t'orphan',\n\t'missing',\n\t'unstamped',\n\t'stale-shared',\n\t'stale-own',\n] as const)\n\n/**\n * Names the file prefix of a runner request, completed by the runner's process id and `.json`.\n *\n * @example\n * ```ts\n * `${CAPTURE_REQUEST_PREFIX}-${process.pid}.json` // 'journey-selection-4242.json'\n * ```\n */\nexport const CAPTURE_REQUEST_PREFIX = 'journey-selection'\n\n/**\n * Holds the protocol version every request, record, receipt, registry, and manifest declares.\n *\n * @example\n * ```ts\n * CAPTURE_VERSION // 2\n * ```\n */\nexport const CAPTURE_VERSION = 2\n\n/**\n * Holds the eight bytes every PNG file opens with.\n *\n * @example\n * ```ts\n * CAPTURE_PNG_SIGNATURE.map((byte) => byte.toString(16)).join('') // '89504e470d0a1a0a'\n * ```\n */\nexport const CAPTURE_PNG_SIGNATURE = Object.freeze([137, 80, 78, 71, 13, 10, 26, 10] as const)\n\n/**\n * Names the default accepted complete-run registry file inside a portfolio directory.\n *\n * @example\n * ```ts\n * `tmp/captures/states/${CAPTURE_REGISTRY_FILE}` // 'tmp/captures/states/registry.json'\n * ```\n */\nexport const CAPTURE_REGISTRY_FILE = 'registry.json'\n\n/**\n * Names the default image-stamp manifest file inside a portfolio directory.\n *\n * @example\n * ```ts\n * `tmp/captures/states/${CAPTURE_MANIFEST_FILE}` // 'tmp/captures/states/manifest.json'\n * ```\n */\nexport const CAPTURE_MANIFEST_FILE = 'manifest.json'\n\n/**\n * Names the default lookup journal file inside a portfolio directory.\n *\n * @example\n * ```ts\n * `tmp/captures/states/${CAPTURE_LOOKUPS_FILE}` // 'tmp/captures/states/lookups.json'\n * ```\n */\nexport const CAPTURE_LOOKUPS_FILE = 'lookups.json'\n\n/**\n * Names the tag prefix that marks a case's owner path and each ancestor of it.\n *\n * @example\n * ```ts\n * `${CAPTURE_OWNER_PREFIX}pages:mail` // 'owner:pages:mail'\n * ```\n */\nexport const CAPTURE_OWNER_PREFIX = 'owner:'\n\n/**\n * Names the journey artifact line prefixes that bind a run record and each case that ran.\n *\n * @remarks\n * The preflight reader requires the line `record=<record path>` and one `case-ran=<full name>`\n * line for each stamping case.\n *\n * @example\n * ```ts\n * `${CAPTURE_ARTIFACT_PREFIXES.case}mail opens the inbox` // 'case-ran=mail opens the inbox'\n * ```\n */\nexport const CAPTURE_ARTIFACT_PREFIXES = Object.freeze({\n\trecord: 'record=',\n\tcase: 'case-ran=',\n} as const)\n","import type { CaptureErrorCode, CaptureErrorContext, CaptureErrorOptions } from './types.js'\nimport { holds, INTRINSICS, isError, isFunction, isObject } from '@orkestrel/contract'\nimport { CAPTURE_ERROR_BRAND, CAPTURE_ERROR_CODES } from './constants.js'\n\n/**\n * Reports one capture failure under a stable condition axis.\n *\n * @remarks\n * Every refusal the engine, the runner, and the readers raise arrives as one of these, so the\n * executable branches on `code` rather than on message text: `USAGE` exits 64 and every other\n * condition exits 1. Narrow a caught value with `isCaptureError` before reading `code`.\n *\n * @example\n * ```ts\n * const error = new CaptureError('Unknown variant: phone', {\n * \tcode: 'SELECTION',\n * \tcontext: { variant: 'phone' },\n * })\n * error.code // 'SELECTION'\n * error.context?.variant // 'phone'\n * ```\n */\nexport class CaptureError extends Error {\n\toverride readonly name = 'CaptureError'\n\treadonly code: CaptureErrorCode\n\treadonly context: CaptureErrorContext | undefined\n\n\t/**\n\t * Creates one classified capture failure.\n\t *\n\t * @param message - Human-readable description of what failed\n\t * @param options - The condition, optional structured context, and optional cause\n\t */\n\tconstructor(message: string, options: CaptureErrorOptions) {\n\t\tsuper(message, 'cause' in options ? { cause: options.cause } : undefined)\n\t\t// A transparent proxy forwards its target's identity and fails the guard's comparison.\n\t\tObject.defineProperty(this, CAPTURE_ERROR_BRAND, { value: this })\n\t\tthis.code = options.code\n\t\tthis.context = options.context\n\t}\n}\n\n/**\n * Checks whether an unknown value is a capture error.\n *\n * @remarks\n * Recognition requires a native `Error` whose prototype is not `Error.prototype`, an own brand\n * property holding the tested value itself, a declared condition code, and an object, callable, or absent\n * context. It recognizes an error from another installed copy of this package, and refuses a\n * look-alike with the same code and no brand, a proxy over a branded error, and a plain object\n * that only carries the brand.\n *\n * @param value - The value to inspect\n * @returns True if the value is a `CaptureError`; false otherwise\n *\n * @example\n * ```ts\n * isCaptureError(new CaptureError('Empty selection', { code: 'USAGE' })) // true\n * isCaptureError(new Error('Empty selection')) // false\n * ```\n */\nexport function isCaptureError(value: unknown): value is CaptureError {\n\treturn holds(() => {\n\t\tif (!isError(value) || INTRINSICS.prototype(value) === INTRINSICS.error.prototype) return false\n\t\tif (INTRINSICS.describe(value, CAPTURE_ERROR_BRAND)?.value !== value) return false\n\t\tconst code: unknown = INTRINSICS.reflect.read(value, 'code')\n\t\tconst context: unknown = INTRINSICS.reflect.read(value, 'context')\n\t\treturn (\n\t\t\tCAPTURE_ERROR_CODES.some((declared) => declared === code) &&\n\t\t\t(context === undefined || isObject(context) || isFunction(context))\n\t\t)\n\t})\n}\n","import type {\n\tCaptureArtifact,\n\tCaptureBox,\n\tCaptureCollectionReceipt,\n\tCaptureDeclaration,\n\tCaptureDestination,\n\tCaptureDigest,\n\tCaptureDigestReference,\n\tCaptureEntry,\n\tCaptureExpandedManifest,\n\tCaptureIdentity,\n\tCaptureLookup,\n\tCaptureLookupJournal,\n\tCaptureManifest,\n\tCaptureManifestDocument,\n\tCaptureReceipt,\n\tCaptureRegistry,\n\tCaptureRequest,\n\tCaptureRun,\n\tCaptureSources,\n\tCaptureStamp,\n\tCaptureViewport,\n} from './types.js'\nimport {\n\tarrayOf,\n\tholds,\n\tisFiniteNumber,\n\tisObject,\n\tisRecord,\n\tisSafeInteger,\n\tisString,\n} from '@orkestrel/contract'\nimport { CAPTURE_VERSION } from './constants.js'\n\n/**\n * Checks whether a serialized path stays within the portable relative-path vocabulary.\n *\n * @param value - The serialized file or directory path\n * @returns True if every segment is portable and relative; false otherwise\n *\n * @example\n * ```ts\n * isCapturePath('tmp/captures/states/pages/mail--inbox.png') // true\n * isCapturePath('../escape.png') // false\n * ```\n */\nexport function isCapturePath(value: unknown): value is string {\n\treturn (\n\t\ttypeof value === 'string' &&\n\t\tvalue.length > 0 &&\n\t\t[...value].every((character) => character.charCodeAt(0) > 0x1f) &&\n\t\tvalue\n\t\t\t.split('/')\n\t\t\t.every(\n\t\t\t\t(segment) =>\n\t\t\t\t\tsegment !== '' &&\n\t\t\t\t\tsegment !== '.' &&\n\t\t\t\t\tsegment !== '..' &&\n\t\t\t\t\t!/[<>:\"\\\\|?*]/u.test(segment) &&\n\t\t\t\t\t!/[. ]$/u.test(segment) &&\n\t\t\t\t\t!/^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³])(?:\\.|$)/iu.test(segment),\n\t\t\t)\n\t)\n}\n\n/**\n * Checks whether a native glob declaration uses relative portable path segments.\n *\n * @param value - A source attribution pattern\n * @returns True if the pattern has no path traversal or host-specific spelling; false otherwise\n *\n * @example\n * ```ts\n * isCapturePattern('src/**') // true\n * isCapturePattern('src\\\\**') // false\n * ```\n */\nexport function isCapturePattern(value: unknown): value is string {\n\treturn (\n\t\ttypeof value === 'string' &&\n\t\tvalue.length > 0 &&\n\t\t[...value].every((character) => character.charCodeAt(0) > 0x1f) &&\n\t\tvalue\n\t\t\t.split('/')\n\t\t\t.every(\n\t\t\t\t(segment) =>\n\t\t\t\t\tsegment !== '' &&\n\t\t\t\t\tsegment !== '.' &&\n\t\t\t\t\tsegment !== '..' &&\n\t\t\t\t\t!/[<>:\"\\\\|]/u.test(segment) &&\n\t\t\t\t\t!/[. ]$/u.test(segment) &&\n\t\t\t\t\t!/^(?:con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³])(?:\\.|$)/iu.test(segment),\n\t\t\t)\n\t)\n}\n\n/**\n * Checks whether a protocol identity can occupy one portable path segment.\n *\n * @param value - The identity segment\n * @returns True if the segment is safe and nonempty; false otherwise\n *\n * @example\n * ```ts\n * isCaptureSegment('light-390') // true\n * isCaptureSegment('light 390') // false\n * ```\n */\nexport function isCaptureSegment(value: unknown): value is string {\n\treturn isCapturePath(value) && /^[a-zA-Z0-9][a-zA-Z0-9_-]*$/u.test(value)\n}\n\n/**\n * Checks whether an owner selector uses canonical colon-separated segments.\n *\n * @param value - The owner selector\n * @returns True if every owner segment is canonical; false otherwise\n *\n * @example\n * ```ts\n * isCaptureSelector('pages:mail') // true\n * isCaptureSelector('pages::mail') // false\n * ```\n */\nexport function isCaptureSelector(value: unknown): value is string {\n\treturn typeof value === 'string' && value.split(':').every(isCaptureSegment)\n}\n\n/**\n * Checks whether a value is a SHA-256 hexadecimal digest.\n *\n * @param value - The digest\n * @returns True if the digest has the expected hexadecimal width; false otherwise\n *\n * @example\n * ```ts\n * isCaptureHash('a'.repeat(64)) // true\n * isCaptureHash('abc') // false\n * ```\n */\nexport function isCaptureHash(value: unknown): value is string {\n\treturn typeof value === 'string' && /^[a-f0-9]{64}$/u.test(value)\n}\n\n/**\n * Checks whether a file-hash map has portable keys and valid digests.\n *\n * @param value - The hash map\n * @returns True if every key and digest is valid and no two keys differ only by case; false otherwise\n *\n * @example\n * ```ts\n * isCaptureHashes({ 'src/index.ts': 'a'.repeat(64) }) // true\n * isCaptureHashes({ 'src/index.ts': 'x' }) // false\n * ```\n */\nexport function isCaptureHashes(value: unknown): value is Readonly<Record<string, string>> {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tObject.entries(value).every(\n\t\t\t\t([file, digest]) => isCapturePath(file) && isCaptureHash(digest),\n\t\t\t) &&\n\t\t\tnew Set(Object.keys(value).map((file) => file.toLowerCase())).size ===\n\t\t\t\tObject.keys(value).length,\n\t)\n}\n\n/**\n * Checks whether source attribution separates own, shared, and behavioral patterns.\n *\n * @param value - The attribution\n * @returns True if every declared pattern is valid; false otherwise\n *\n * @example\n * ```ts\n * isCaptureSources({ own: ['src/mail/**'], shared: [], tests: [] }) // true\n * isCaptureSources({ own: ['../x'], shared: [], tests: [] }) // false\n * ```\n */\nexport function isCaptureSources(value: unknown): value is CaptureSources {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tarrayOf(isCapturePattern)(value.own) &&\n\t\t\tarrayOf(isCapturePattern)(value.shared) &&\n\t\t\tarrayOf(isCapturePattern)(value.tests),\n\t)\n}\n\n/**\n * Checks whether an execution identity carries its required authorization fields.\n *\n * @param value - The identity\n * @returns True if the identity is valid; false otherwise\n *\n * @example\n * ```ts\n * isCaptureIdentity({ id: 'run-1', stage: 'selected', pid: 4242, config: 'configs/journey.ts' }) // true\n * isCaptureIdentity({ id: 'run-1', stage: 'selected', pid: 0, config: 'configs/journey.ts' }) // false\n * ```\n */\nexport function isCaptureIdentity(value: unknown): value is CaptureIdentity {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisCaptureSegment(value.id) &&\n\t\t\tisCaptureSegment(value.stage) &&\n\t\t\ttypeof value.pid === 'number' &&\n\t\t\tisSafeInteger(value.pid) &&\n\t\t\tvalue.pid > 0 &&\n\t\t\tisCapturePath(value.config),\n\t)\n}\n\n/**\n * Checks whether a request has the supported version and complete execution identity.\n *\n * @param value - The transported request\n * @returns True if every request field has its protocol shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureRequest(JSON.parse(text)) // true for a well-formed runner request\n * isCaptureRequest({ version: 1 }) // false\n * ```\n */\nexport function isCaptureRequest(value: unknown): value is CaptureRequest {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisCaptureIdentity(value) &&\n\t\t\tvalue.version === CAPTURE_VERSION &&\n\t\t\t(value.command === 'journey' || value.command === 'capture') &&\n\t\t\t(value.mode === undefined || (typeof value.mode === 'string' && value.mode.trim() !== '')) &&\n\t\t\tisCaptureSelector(value.selector) &&\n\t\t\tarrayOf(isCaptureSegment)(value.variants) &&\n\t\t\tvalue.variants.length > 0 &&\n\t\t\tarrayOf(isString)(value.args) &&\n\t\t\t(value.case === undefined || (typeof value.case === 'string' && value.case.trim() !== '')) &&\n\t\t\t(value.state === undefined || (value.command === 'capture' && isCaptureSegment(value.state))),\n\t)\n}\n\n/**\n * Checks whether a collected declaration preserves its full owner and state population.\n *\n * @param value - The declaration\n * @returns True if the declaration has its supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureDeclaration({\n * \tcase: 'mail shows the inbox',\n * \towner: 'pages:mail',\n * \tvariant: 'light-390',\n * \teligible: true,\n * \tstates: ['inbox'],\n * }) // true\n * ```\n */\nexport function isCaptureDeclaration(value: unknown): value is CaptureDeclaration {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\ttypeof value.case === 'string' &&\n\t\t\tvalue.case.trim() !== '' &&\n\t\t\tisCaptureSelector(value.owner) &&\n\t\t\tisCaptureSegment(value.variant) &&\n\t\t\ttypeof value.eligible === 'boolean' &&\n\t\t\tarrayOf(isCaptureSegment)(value.states),\n\t)\n}\n\n/**\n * Checks whether a destination supplies canonical identity and source attribution fields.\n *\n * @param value - The destination\n * @returns True if the destination has its supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureDestination(JSON.parse(text)) // true for a registry destination row\n * isCaptureDestination({}) // false\n * ```\n */\nexport function isCaptureDestination(value: unknown): value is CaptureDestination {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisCaptureSegment(value.portfolio) &&\n\t\t\tisCaptureSegment(value.state) &&\n\t\t\tisCaptureSegment(value.scope) &&\n\t\t\tisCaptureSegment(value.part) &&\n\t\t\t(value.section === undefined || isCaptureSegment(value.section)) &&\n\t\t\tisCaptureSegment(value.variant) &&\n\t\t\ttypeof value.project === 'string' &&\n\t\t\tvalue.project !== '' &&\n\t\t\tisCapturePath(value.file) &&\n\t\t\ttypeof value.case === 'string' &&\n\t\t\tvalue.case.trim() !== '' &&\n\t\t\tisCaptureSources(value.sources),\n\t)\n}\n\n/**\n * Checks whether an emitted entry includes a finite nonnegative case duration.\n *\n * @param value - The emitted entry\n * @returns True if the entry is valid; false otherwise\n *\n * @example\n * ```ts\n * isCaptureEntry({ ...destination, duration: 812 }) // true\n * isCaptureEntry({ ...destination, duration: -1 }) // false\n * ```\n */\nexport function isCaptureEntry(value: unknown): value is CaptureEntry {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisCaptureDestination(value) &&\n\t\t\tisFiniteNumber(value.duration) &&\n\t\t\tvalue.duration >= 0,\n\t)\n}\n\n/**\n * Checks whether a record names its journey artifact by portable path and SHA-256 digest.\n *\n * @param value - The decoded artifact reference\n * @returns True if the reference has its supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureArtifact({ file: 'tmp/runs/a/light-390.txt', digest: 'a'.repeat(64) }) // true\n * isCaptureArtifact({ file: '/abs.txt', digest: 'a'.repeat(64) }) // false\n * ```\n */\nexport function isCaptureArtifact(value: unknown): value is CaptureArtifact {\n\treturn holds(() => isRecord(value) && isCapturePath(value.file) && isCaptureHash(value.digest))\n}\n\n/**\n * Checks whether a final record preserves declarations, observations, and output separately.\n *\n * @param value - The decoded run record\n * @returns True if the record has the supported protocol shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureRun(JSON.parse(text)) // true for a final run record\n * isCaptureRun(null) // false\n * ```\n */\nexport function isCaptureRun(value: unknown): value is CaptureRun {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tvalue.version === CAPTURE_VERSION &&\n\t\t\tisCaptureSegment(value.variant) &&\n\t\t\ttypeof value.time === 'string' &&\n\t\t\tNumber.isFinite(Date.parse(value.time)) &&\n\t\t\ttypeof value.complete === 'boolean' &&\n\t\t\ttypeof value.reference === 'boolean' &&\n\t\t\tarrayOf(isCaptureDeclaration)(value.declarations) &&\n\t\t\tarrayOf(isCaptureDestination)(value.registry) &&\n\t\t\tarrayOf(isString)(value.passed) &&\n\t\t\tarrayOf(isCaptureSegment)(value.observed) &&\n\t\t\tarrayOf(isCaptureEntry)(value.entries) &&\n\t\t\t(value.artifact === undefined || isCaptureArtifact(value.artifact)) &&\n\t\t\t((value.identity === undefined && value.request === undefined) ||\n\t\t\t\t(isCaptureIdentity(value.identity) && isCaptureRequest(value.request))),\n\t)\n}\n\n/**\n * Checks whether a shared-source digest retains both patterns and expanded file hashes.\n *\n * @param value - The digest reading\n * @returns True if the digest reading has its supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureDigest({ patterns: ['src/**'], files: {}, digest: 'a'.repeat(64) }) // true\n * isCaptureDigest({ patterns: [], files: {} }) // false\n * ```\n */\nexport function isCaptureDigest(value: unknown): value is CaptureDigest {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tarrayOf(isCapturePattern)(value.patterns) &&\n\t\t\tisCaptureHashes(value.files) &&\n\t\t\tisCaptureHash(value.digest),\n\t)\n}\n\n/**\n * Checks whether a complete-run receipt binds the report, inputs, and declaration registry.\n *\n * @param value - The receipt\n * @returns True if the receipt has its supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureReceipt(JSON.parse(text)) // true for a complete-run receipt\n * isCaptureReceipt({}) // false\n * ```\n */\nexport function isCaptureReceipt(value: unknown): value is CaptureReceipt {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tvalue.version === CAPTURE_VERSION &&\n\t\t\tisCaptureSegment(value.variant) &&\n\t\t\ttypeof value.time === 'string' &&\n\t\t\tNumber.isFinite(Date.parse(value.time)) &&\n\t\t\tisRecord(value.report) &&\n\t\t\tisCapturePath(value.report.file) &&\n\t\t\tisCaptureHash(value.report.digest) &&\n\t\t\tisCaptureHashes(value.inputs) &&\n\t\t\tarrayOf(isCaptureDeclaration)(value.declarations) &&\n\t\t\tarrayOf(isCaptureDestination)(value.registry) &&\n\t\t\ttypeof value.complete === 'boolean',\n\t)\n}\n\n/**\n * Checks whether a registry document retains its receipts and required output pairs.\n *\n * @param value - The registry document\n * @returns True if the registry has the supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureRegistry(JSON.parse(text)) // true for a published registry.json\n * isCaptureRegistry([]) // false\n * ```\n */\nexport function isCaptureRegistry(value: unknown): value is CaptureRegistry {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tvalue.version === CAPTURE_VERSION &&\n\t\t\tarrayOf(isCaptureReceipt)(value.receipts) &&\n\t\t\tarrayOf(isCaptureDestination)(value.entries) &&\n\t\t\tisCaptureHash(value.digest),\n\t)\n}\n\n/**\n * Checks whether a lookup binds a passing case to its full run record and input hashes.\n *\n * @param value - The lookup receipt\n * @returns True if the receipt has its supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureLookup(JSON.parse(text)) // true for a lookup row\n * isCaptureLookup(undefined) // false\n * ```\n */\nexport function isCaptureLookup(value: unknown): value is CaptureLookup {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisCaptureHash(value.registry) &&\n\t\t\tisCaptureSegment(value.variant) &&\n\t\t\ttypeof value.case === 'string' &&\n\t\t\tvalue.case.trim() !== '' &&\n\t\t\tisCaptureSelector(value.owner) &&\n\t\t\tarrayOf(isCaptureSegment)(value.states) &&\n\t\t\tisCaptureHashes(value.inputs) &&\n\t\t\tisRecord(value.run) &&\n\t\t\tisCapturePath(value.run.file) &&\n\t\t\tisCaptureHash(value.run.digest),\n\t)\n}\n\n/**\n * Checks the separate lookup journal and its optional predecessor manifest digest.\n *\n * @param value - The decoded journal\n * @returns True if the journal has its supported shape; false otherwise\n * @remarks Input-map digests and reference existence are verified when the journal is read.\n *\n * @example\n * ```ts\n * isCaptureLookupJournal({ version: 2, populations: {}, lookups: [] }) // true\n * isCaptureLookupJournal({ version: 1, populations: {}, lookups: [] }) // false\n * ```\n */\nexport function isCaptureLookupJournal(value: unknown): value is CaptureLookupJournal {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\t(value.collections === undefined || arrayOf(isCaptureCollection)(value.collections)) &&\n\t\t\tvalue.version === CAPTURE_VERSION &&\n\t\t\t(value.manifest === undefined || isCaptureHash(value.manifest)) &&\n\t\t\tisRecord(value.populations) &&\n\t\t\tObject.entries(value.populations).every(\n\t\t\t\t([digest, inputs]) => isCaptureHash(digest) && isCaptureHashes(inputs),\n\t\t\t) &&\n\t\t\tarrayOf(\n\t\t\t\t(entry) =>\n\t\t\t\t\tisRecord(entry) &&\n\t\t\t\t\tisCaptureHash(entry.inputs) &&\n\t\t\t\t\tisCaptureLookup({ ...entry, inputs: {} }),\n\t\t\t)(value.lookups),\n\t)\n}\n\n/**\n * Checks whether a stamp binds an emitted image to source and execution provenance.\n *\n * @param value - The stamp\n * @returns True if the stamp has its supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureStamp(manifest.entries['pages/mail--inbox.png']) // true for a stamped frame\n * isCaptureStamp({}) // false\n * ```\n */\nexport function isCaptureStamp(value: unknown): value is CaptureStamp {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisCaptureEntry(value) &&\n\t\t\tisCaptureIdentity(value.identity) &&\n\t\t\ttypeof value.time === 'string' &&\n\t\t\tNumber.isFinite(Date.parse(value.time)) &&\n\t\t\ttypeof value.commit === 'string' &&\n\t\t\t/^[a-f0-9]{40,64}$/u.test(value.commit) &&\n\t\t\tarrayOf(isCapturePath)(value.dirty) &&\n\t\t\tisCaptureHashes(value.own) &&\n\t\t\tisCaptureDigest(value.shared) &&\n\t\t\tisCaptureHashes(value.tests) &&\n\t\t\tisCaptureHash(value.registry) &&\n\t\t\tisRecord(value.image) &&\n\t\t\tisCaptureHash(value.image.digest) &&\n\t\t\tisFiniteNumber(value.image.size) &&\n\t\t\tisSafeInteger(value.image.size) &&\n\t\t\tvalue.image.size > 0 &&\n\t\t\tisFiniteNumber(value.image.modified) &&\n\t\t\tvalue.image.modified >= 0,\n\t)\n}\n\n/**\n * Checks whether an expanded manifest has the supported schema without discarding malformed rows.\n *\n * @param value - The manifest\n * @returns True if every inherited member validates; false otherwise\n *\n * @example\n * ```ts\n * isCaptureManifest(readCaptureManifest(JSON.parse(text), file)) // true for an expanded manifest.json\n * isCaptureManifest('manifest') // false\n * ```\n */\nexport function isCaptureManifest(value: unknown): value is CaptureManifest {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tvalue.version === CAPTURE_VERSION &&\n\t\t\tisCaptureRegistry(value.registry) &&\n\t\t\tisRecord(value.entries) &&\n\t\t\tObject.entries(value.entries).every(\n\t\t\t\t([key, stamp]) => isCapturePath(key) && isCaptureStamp(stamp),\n\t\t\t) &&\n\t\t\tarrayOf(isCaptureLookup)(value.lookups),\n\t)\n}\n\n/**\n * Checks whether collection evidence pins complete input membership and both external artifacts.\n *\n * @param value - The collection receipt\n * @returns True if every field has the supported shape; false otherwise\n *\n * @example\n * ```ts\n * isCaptureCollection(manifest.collections?.[0]) // true for a collection receipt\n * isCaptureCollection({}) // false\n * ```\n */\nexport function isCaptureCollection(value: unknown): value is CaptureCollectionReceipt {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisCaptureHash(value.registry) &&\n\t\t\tisCaptureSegment(value.variant) &&\n\t\t\ttypeof value.project === 'string' &&\n\t\t\tvalue.project.trim() !== '' &&\n\t\t\tisCaptureDigest(value.inputs) &&\n\t\t\tisRecord(value.run) &&\n\t\t\tisCapturePath(value.run.file) &&\n\t\t\tisCaptureHash(value.run.digest) &&\n\t\t\tisRecord(value.report) &&\n\t\t\tisCapturePath(value.report.file) &&\n\t\t\tisCaptureHash(value.report.digest),\n\t)\n}\n\n/**\n * Checks whether an expanded manifest and its optional collection receipts have the supported schema.\n *\n * @param value - The expanded manifest\n * @returns True if the manifest and any collection receipts are valid; false otherwise\n *\n * @example\n * ```ts\n * isCaptureExpandedManifest(readCaptureManifest(JSON.parse(text), file)) // true with or without collections\n * isCaptureExpandedManifest(null) // false\n * ```\n */\nexport function isCaptureExpandedManifest(value: unknown): value is CaptureExpandedManifest {\n\treturn holds(\n\t\t() =>\n\t\t\tisCaptureManifest(value) &&\n\t\t\tisRecord(value) &&\n\t\t\t(value.collections === undefined || arrayOf(isCaptureCollection)(value.collections)),\n\t)\n}\n\n/**\n * Checks whether a digest names its file map by a table key beside its patterns and combined digest.\n *\n * @param value - The stored digest reference\n * @returns True if the patterns are valid and both digests are SHA-256 hexadecimal; false otherwise\n *\n * @example\n * ```ts\n * isCaptureDigestReference({ patterns: ['src/**'], files: 'a'.repeat(64), digest: 'b'.repeat(64) }) // true\n * isCaptureDigestReference({ patterns: ['src/**'], files: {}, digest: 'b'.repeat(64) }) // false\n * ```\n */\nexport function isCaptureDigestReference(value: unknown): value is CaptureDigestReference {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tarrayOf(isCapturePattern)(value.patterns) &&\n\t\t\tisCaptureHash(value.files) &&\n\t\t\tisCaptureHash(value.digest),\n\t)\n}\n\n/**\n * Checks whether a stored manifest holds its population table and every member that names a table key.\n *\n * @param value - The decoded manifest file\n * @returns True if the version, table, registry, stamps, lookups, and collections are valid; false otherwise\n * @remarks Table digests and reference existence are verified when the document is read.\n *\n * @example\n * ```ts\n * isCaptureManifestDocument(JSON.parse(text)) // true for a written manifest.json\n * isCaptureManifestDocument({ version: 1, populations: {}, entries: {}, lookups: [] }) // false\n * ```\n */\nexport function isCaptureManifestDocument(value: unknown): value is CaptureManifestDocument {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\t// The population table and the lookup references follow the journal's table rule.\n\t\t\tisCaptureLookupJournal({\n\t\t\t\tversion: value.version,\n\t\t\t\tpopulations: value.populations,\n\t\t\t\tlookups: value.lookups,\n\t\t\t}) &&\n\t\t\tisCaptureRegistry(value.registry) &&\n\t\t\tisRecord(value.entries) &&\n\t\t\tObject.entries(value.entries).every(\n\t\t\t\t([key, stamp]) =>\n\t\t\t\t\tisCapturePath(key) &&\n\t\t\t\t\tisRecord(stamp) &&\n\t\t\t\t\tisCaptureDigestReference(stamp.shared) &&\n\t\t\t\t\tisCaptureStamp({ ...stamp, shared: { ...stamp.shared, files: {} } }),\n\t\t\t) &&\n\t\t\t(value.collections === undefined ||\n\t\t\t\tarrayOf(\n\t\t\t\t\t(entry) =>\n\t\t\t\t\t\tisRecord(entry) &&\n\t\t\t\t\t\tisCaptureDigestReference(entry.inputs) &&\n\t\t\t\t\t\tisCaptureCollection({ ...entry, inputs: { ...entry.inputs, files: {} } }),\n\t\t\t\t)(value.collections)),\n\t)\n}\n\n/**\n * Checks the host's declared viewport without deriving geometry from an output name.\n *\n * @param value - The published viewport data\n * @returns True if the named viewport has usable dimensions; false otherwise\n *\n * @example\n * ```ts\n * isCaptureGeometry({ name: 'light-390', width: 390, height: 844 }) // true\n * isCaptureGeometry({ name: 'light-390', width: 0, height: 844 }) // false\n * ```\n */\nexport function isCaptureGeometry(value: unknown): value is CaptureViewport {\n\treturn holds(\n\t\t() =>\n\t\t\tisObject(value) &&\n\t\t\t'name' in value &&\n\t\t\tisCaptureSegment(value.name) &&\n\t\t\t'width' in value &&\n\t\t\tisFiniteNumber(value.width) &&\n\t\t\tvalue.width > 0 &&\n\t\t\t'height' in value &&\n\t\t\tisFiniteNumber(value.height) &&\n\t\t\tvalue.height > 0,\n\t)\n}\n\n/**\n * Checks a journey artifact's recorded sampling box.\n *\n * @param value - The recorded viewport box\n * @returns True if its coordinates and dimensions are finite; false otherwise\n *\n * @example\n * ```ts\n * isCaptureBox({ x: 0, y: 64, width: 390, height: 780 }) // true\n * isCaptureBox({ x: 0, y: 64, width: 0, height: 780 }) // false\n * ```\n */\nexport function isCaptureBox(value: unknown): value is CaptureBox {\n\treturn holds(\n\t\t() =>\n\t\t\tisRecord(value) &&\n\t\t\tisFiniteNumber(value.x) &&\n\t\t\tisFiniteNumber(value.y) &&\n\t\t\tisFiniteNumber(value.width) &&\n\t\t\tvalue.width > 0 &&\n\t\t\tisFiniteNumber(value.height) &&\n\t\t\tvalue.height > 0,\n\t)\n}\n","import type {\n\tCaptureArtifactLines,\n\tCaptureAssertion,\n\tCaptureCase,\n\tCaptureDeclaration,\n\tCaptureDestination,\n\tCaptureDestinationOptions,\n\tCaptureEntry,\n\tCaptureLookup,\n\tCaptureReceipt,\n\tCaptureReport,\n\tCaptureRequest,\n\tCaptureRules,\n\tCaptureRun,\n\tCaptureRunOptions,\n\tCaptureSelection,\n\tCaptureStatus,\n\tCaptureTask,\n\tCaptureTestInput,\n\tCaptureTestOptions,\n} from './types.js'\nimport { arrayOf, isError, isFiniteNumber, isRecord, isString, preview } from '@orkestrel/contract'\nimport {\n\tCAPTURE_ARTIFACT_PREFIXES,\n\tCAPTURE_OWNER_PREFIX,\n\tCAPTURE_STATUS_PRECEDENCE,\n\tCAPTURE_VERSION,\n} from './constants.js'\nimport { CaptureError } from './errors.js'\nimport { isCaptureDeclaration, isCapturePath, isCaptureSelector } from './validators.js'\n\n/**\n * Describes a caught failure as one reportable line.\n *\n * @param error - The caught value, which need not be an `Error`\n * @returns The error's message, or the value's string form\n *\n * @example\n * ```ts\n * describeCaptureError(new Error('Unknown variant: phone')) // 'Unknown variant: phone'\n * describeCaptureError('refused') // 'refused'\n * ```\n */\nexport function describeCaptureError(error: unknown): string {\n\treturn isError(error) ? error.message : String(error)\n}\n\n/**\n * Finds repeated identities before a keyed collection could discard them.\n *\n * @param values - The identity population\n * @param folded - If `true`, compares case-folded keys; if `false`, compares exact identities. Default: `false`\n * @returns Every member whose comparison key appears more than once\n *\n * @example\n * ```ts\n * collectCaptureDuplicates(['a', 'b', 'a']) // ['a', 'a']\n * collectCaptureDuplicates(['Pages', 'pages'], true) // ['Pages', 'pages']\n * ```\n */\nexport function collectCaptureDuplicates(\n\tvalues: readonly string[],\n\tfolded = false,\n): readonly string[] {\n\tconst keys = values.map((value) => (folded ? value.toLowerCase() : value))\n\treturn values.filter(\n\t\t(_value, index) => keys.indexOf(keys[index] ?? '') !== keys.lastIndexOf(keys[index] ?? ''),\n\t)\n}\n\n/**\n * Refuses duplicate declarations or portable storage-key collisions before indexing.\n *\n * @param values - The complete identity population\n * @param label - The diagnostic subject\n * @param folded - If `true`, refuses case-colliding keys; if `false`, requires exact uniqueness. Default: `false`\n * @throws Thrown as an `EVIDENCE` capture error when an identity repeats.\n *\n * @example\n * ```ts\n * requireCaptureUnique(['mail', 'files'], 'owners') // returns\n * requireCaptureUnique(['mail', 'mail'], 'owners') // throws 'Duplicate owners: mail, mail'\n * ```\n */\nexport function requireCaptureUnique(\n\tvalues: readonly string[],\n\tlabel: string,\n\tfolded = false,\n): void {\n\tconst duplicates = collectCaptureDuplicates(values, folded)\n\tif (duplicates.length > 0)\n\t\tthrow new CaptureError(`Duplicate ${label}: ${duplicates.join(', ')}`, {\n\t\t\tcode: 'EVIDENCE',\n\t\t\tcontext: { label, duplicates },\n\t\t})\n}\n\n/**\n * Compares complete populations without erasing duplicates.\n *\n * @param left - The first population\n * @param right - The second population\n * @returns True if the sorted populations are equal; false otherwise\n *\n * @example\n * ```ts\n * matchesCaptureMembers(['b', 'a'], ['a', 'b']) // true\n * matchesCaptureMembers(['a', 'a'], ['a']) // false\n * ```\n */\nexport function matchesCaptureMembers(left: readonly string[], right: readonly string[]): boolean {\n\tconst ordered = right.toSorted()\n\treturn (\n\t\tleft.length === right.length &&\n\t\tleft.toSorted().every((entry, index) => entry === ordered[index])\n\t)\n}\n\n/**\n * Compares an owner with an explicit selector at colon boundaries.\n *\n * @param owner - The canonical owner\n * @param selector - The requested owner or the `all` selector\n * @returns True if the owner belongs to the selection; false otherwise\n *\n * @example\n * ```ts\n * matchesCaptureSelector('pages:mail', 'pages') // true\n * matchesCaptureSelector('pages:mailbox', 'pages:mail') // false\n * ```\n */\nexport function matchesCaptureSelector(owner: string, selector: string): boolean {\n\treturn selector === 'all' || owner === selector || owner.startsWith(`${selector}:`)\n}\n\n/**\n * Builds the canonical owner from a destination's registry identity.\n *\n * @param entry - The destination\n * @returns The scope, part, and optional section selector\n *\n * @example\n * ```ts\n * resolveCaptureOwner({ ...destination, scope: 'pages', part: 'mail' }) // 'pages:mail'\n * ```\n */\nexport function resolveCaptureOwner(entry: CaptureDestination): string {\n\treturn [entry.scope, entry.part, ...(entry.section === undefined ? [] : [entry.section])].join(\n\t\t':',\n\t)\n}\n\n/**\n * Builds a manifest identity independently of the physical image path.\n *\n * @param entry - The registry destination\n * @returns The scope-qualified state and output-variant key\n *\n * @example\n * ```ts\n * resolveCaptureKey({ ...destination, scope: 'pages', state: 'inbox', variant: 'light-390' })\n * // 'pages/inbox--light-390.png'\n * ```\n */\nexport function resolveCaptureKey(entry: CaptureDestination): string {\n\treturn `${entry.scope}/${entry.state}--${entry.variant}.png`\n}\n\n/**\n * Serializes a destination's identity and attribution in a deterministic field order.\n *\n * @param entry - The destination\n * @returns The comparison representation, excluding image and duration readings\n *\n * @example\n * ```ts\n * describeCaptureDestination(destination) === describeCaptureDestination({ ...destination })\n * // true\n * ```\n */\nexport function describeCaptureDestination(entry: CaptureDestination): string {\n\treturn JSON.stringify([\n\t\tentry.portfolio,\n\t\tentry.state,\n\t\tentry.scope,\n\t\tentry.part,\n\t\tentry.section,\n\t\tentry.variant,\n\t\tentry.project,\n\t\tentry.file,\n\t\tentry.case,\n\t\tentry.sources.own.toSorted(),\n\t\tentry.sources.shared.toSorted(),\n\t\tentry.sources.tests.toSorted(),\n\t])\n}\n\n/**\n * Serializes only the registry's execution and output identity, independent of input revisions.\n *\n * @param entry - The destination or inherited stamp\n * @returns The identity used for relevant manifest agreement during state resolution\n *\n * @example\n * ```ts\n * describeCaptureIdentity(destination) === describeCaptureIdentity({\n * \t...destination,\n * \tsources: { own: [], shared: [], tests: [] },\n * })\n * // true\n * ```\n */\nexport function describeCaptureIdentity(entry: CaptureDestination): string {\n\treturn JSON.stringify([\n\t\tentry.portfolio,\n\t\tentry.state,\n\t\tentry.scope,\n\t\tentry.part,\n\t\tentry.section,\n\t\tentry.variant,\n\t\tentry.project,\n\t\tentry.file,\n\t\tentry.case,\n\t])\n}\n\n/**\n * Serializes a complete behavioral declaration without dropping eligibility or states.\n *\n * @param entry - The collected declaration\n * @returns The deterministic comparison representation\n *\n * @example\n * ```ts\n * describeCaptureDeclaration({ ...declaration, states: ['b', 'a'] }) ===\n * \tdescribeCaptureDeclaration({ ...declaration, states: ['a', 'b'] })\n * // true\n * ```\n */\nexport function describeCaptureDeclaration(entry: CaptureDeclaration): string {\n\treturn JSON.stringify([\n\t\tentry.case,\n\t\tentry.owner,\n\t\tentry.variant,\n\t\tentry.eligible,\n\t\tentry.states.toSorted(),\n\t])\n}\n\n/**\n * Serializes every request field, retaining the exact argv order.\n *\n * @param request - The transported request\n * @returns The exact request comparison representation\n *\n * @example\n * ```ts\n * describeCaptureRequest(request) === describeCaptureRequest({ ...request, args: [] })\n * // false when the request carried argv\n * ```\n */\nexport function describeCaptureRequest(request: CaptureRequest): string {\n\treturn JSON.stringify([\n\t\trequest.version,\n\t\trequest.id,\n\t\trequest.stage,\n\t\trequest.pid,\n\t\trequest.config,\n\t\trequest.command,\n\t\trequest.mode,\n\t\trequest.selector,\n\t\trequest.case,\n\t\trequest.state,\n\t\trequest.variants,\n\t\trequest.args,\n\t])\n}\n\n/**\n * Names every changed, added, or removed file in hash populations.\n *\n * @param previous - The retained file hashes\n * @param current - The observed file hashes\n * @returns The sorted changed membership\n *\n * @example\n * ```ts\n * collectCaptureChanges({ 'a.ts': 'x', 'b.ts': 'y' }, { 'a.ts': 'x', 'b.ts': 'z', 'c.ts': 'w' })\n * // ['b.ts', 'c.ts']\n * ```\n */\nexport function collectCaptureChanges(\n\tprevious: Readonly<Record<string, string>>,\n\tcurrent: Readonly<Record<string, string>>,\n): readonly string[] {\n\treturn [...new Set([...Object.keys(previous), ...Object.keys(current)])]\n\t\t.filter((file) => previous[file] !== current[file])\n\t\t.toSorted()\n}\n\n/**\n * Builds the stable case identity used to merge separate lookup receipts.\n *\n * @param lookup - The lookup identity\n * @returns The producing variant and full case key\n *\n * @example\n * ```ts\n * resolveLookupKey({ variant: 'light-390', case: 'mail shows the inbox' })\n * // '[\"light-390\",\"mail shows the inbox\"]'\n * ```\n */\nexport function resolveLookupKey(lookup: Pick<CaptureLookup, 'variant' | 'case'>): string {\n\treturn JSON.stringify([lookup.variant, lookup.case])\n}\n\n/**\n * Reads successful Vitest JSON output and validates every owner-bearing assertion.\n *\n * @param value - The parsed external reporter document\n * @returns A validated projection of the fields used by integrity\n * @throws Thrown as an `EVIDENCE` capture error for failed reporters, malformed assertions, or duplicate case identities.\n *\n * @example\n * ```ts\n * const report = readCaptureReport(parseJSON(text))\n * report.assertions.map((assertion) => assertion.case)\n * ```\n */\nexport function readCaptureReport(value: unknown): CaptureReport {\n\tif (\n\t\t!isRecord(value) ||\n\t\tvalue.success !== true ||\n\t\tvalue.numFailedTests !== 0 ||\n\t\tvalue.numFailedTestSuites !== 0 ||\n\t\t!isFiniteNumber(value.startTime) ||\n\t\t!arrayOf(isRecord)(value.testResults) ||\n\t\tvalue.testResults.length === 0\n\t)\n\t\tthrow new CaptureError('Invalid or unsuccessful Vitest JSON report', { code: 'EVIDENCE' })\n\tconst files = value.testResults.map((file) => {\n\t\tif (\n\t\t\tfile.status !== 'passed' ||\n\t\t\t!isFiniteNumber(file.startTime) ||\n\t\t\t!isFiniteNumber(file.endTime) ||\n\t\t\tfile.endTime < file.startTime ||\n\t\t\t!arrayOf(isRecord)(file.assertionResults)\n\t\t)\n\t\t\tthrow new CaptureError('Invalid Vitest file report', { code: 'EVIDENCE' })\n\t\treturn { start: file.startTime, end: file.endTime, assertions: file.assertionResults }\n\t})\n\tconst assertions: readonly CaptureAssertion[] = files.flatMap((file) =>\n\t\tfile.assertions.flatMap((assertion) => {\n\t\t\tif (!isRecord(assertion.meta))\n\t\t\t\tthrow new CaptureError('Invalid Vitest assertion metadata', { code: 'EVIDENCE' })\n\t\t\tif (assertion.meta.owner === undefined) return []\n\t\t\tconst declaration = {\n\t\t\t\tcase: assertion.fullName,\n\t\t\t\towner: assertion.meta.owner,\n\t\t\t\tvariant: assertion.meta.variant,\n\t\t\t\teligible: assertion.meta.eligible === undefined ? true : assertion.meta.eligible,\n\t\t\t\tstates: assertion.meta.states === undefined ? [] : assertion.meta.states,\n\t\t\t}\n\t\t\tif (\n\t\t\t\t!isCaptureDeclaration(declaration) ||\n\t\t\t\t!isString(assertion.status) ||\n\t\t\t\t(assertion.duration !== undefined &&\n\t\t\t\t\tassertion.duration !== null &&\n\t\t\t\t\t(!isFiniteNumber(assertion.duration) || assertion.duration < 0))\n\t\t\t)\n\t\t\t\tthrow new CaptureError('Invalid owner-bearing Vitest assertion', { code: 'EVIDENCE' })\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\t...declaration,\n\t\t\t\t\tstatus: assertion.status,\n\t\t\t\t\t...(typeof assertion.duration === 'number' ? { duration: assertion.duration } : {}),\n\t\t\t\t},\n\t\t\t]\n\t\t}),\n\t)\n\trequireCaptureUnique(assertions.map(resolveLookupKey), 'reporter case identities')\n\treturn {\n\t\tstart: files.reduce((start, file) => Math.min(start, file.start), value.startTime),\n\t\tend: files.reduce((end, file) => Math.max(end, file.end), -Infinity),\n\t\tassertions,\n\t}\n}\n\n/**\n * Validates declaration, reporter, observation, completeness, and output-projection agreement.\n *\n * @param run - The final record\n * @param report - The validated external reporter\n * @param project - The actual producing project name\n * @throws Thrown as an `EVIDENCE` capture error when a record differs from the actual selected results or declarations.\n *\n * @example\n * ```ts\n * validateCaptureRun(run, readCaptureReport(parseJSON(text)), 'journey:light-390')\n * ```\n */\nexport function validateCaptureRun(run: CaptureRun, report: CaptureReport, project: string): void {\n\tconst assertions = report.assertions.filter((entry) => entry.variant === run.variant)\n\trequireCaptureUnique(\n\t\trun.declarations.map((entry) => entry.case),\n\t\t'declaring cases',\n\t)\n\trequireCaptureUnique(\n\t\trun.declarations.flatMap((entry) => entry.states),\n\t\t'declared states',\n\t\ttrue,\n\t)\n\trequireCaptureUnique(run.registry.map(resolveCaptureKey), 'registry identities', true)\n\trequireCaptureUnique(\n\t\trun.registry.map((entry) => entry.file),\n\t\t'registry paths',\n\t\ttrue,\n\t)\n\trequireCaptureUnique(run.entries.map(resolveCaptureKey), 'emitted identities', true)\n\trequireCaptureUnique(run.passed, 'passed cases')\n\trequireCaptureUnique(run.observed, 'observed states', true)\n\tif (\n\t\t!matchesCaptureMembers(\n\t\t\trun.declarations.map(describeCaptureDeclaration),\n\t\t\tassertions.map(describeCaptureDeclaration),\n\t\t)\n\t)\n\t\tthrow new CaptureError('Run declarations differ from full reporter declarations', {\n\t\t\tcode: 'EVIDENCE',\n\t\t})\n\tconst eligible = run.declarations.filter((entry) => entry.eligible)\n\tconst passed = assertions.filter((entry) => entry.eligible && entry.status === 'passed')\n\tif (\n\t\t!matchesCaptureMembers(\n\t\t\trun.passed,\n\t\t\tpassed.map((entry) => entry.case),\n\t\t)\n\t)\n\t\tthrow new CaptureError('Run passed cases differ from reporter results', { code: 'EVIDENCE' })\n\tif (\n\t\t!matchesCaptureMembers(\n\t\t\trun.observed,\n\t\t\tpassed.flatMap((entry) => entry.states),\n\t\t)\n\t)\n\t\tthrow new CaptureError('Run observations differ from full passed declarations', {\n\t\t\tcode: 'EVIDENCE',\n\t\t})\n\tif (run.complete !== (eligible.length > 0 && eligible.length === passed.length))\n\t\tthrow new CaptureError('Run completeness differs from eligible results', { code: 'EVIDENCE' })\n\tfor (const declaration of eligible) {\n\t\tconst destinations = run.registry.filter((entry) => entry.case === declaration.case)\n\t\tif (\n\t\t\t!matchesCaptureMembers(\n\t\t\t\tdestinations.map((entry) => entry.state),\n\t\t\t\tdeclaration.states,\n\t\t\t) ||\n\t\t\tdestinations.some(\n\t\t\t\t(entry) =>\n\t\t\t\t\tentry.project !== project ||\n\t\t\t\t\t!matchesCaptureSelector(resolveCaptureOwner(entry), declaration.owner),\n\t\t\t)\n\t\t)\n\t\t\tthrow new CaptureError(`Registry differs from eligible declaration: ${declaration.case}`, {\n\t\t\t\tcode: 'EVIDENCE',\n\t\t\t})\n\t}\n\tif (\n\t\trun.registry.some((entry) => !eligible.some((declaration) => declaration.case === entry.case))\n\t)\n\t\tthrow new CaptureError('Registry contains an ineligible or undeclared case', {\n\t\t\tcode: 'EVIDENCE',\n\t\t})\n\tconst reference = run.registry.filter((entry) => entry.section === entry.state)\n\tif (\n\t\trun.reference !==\n\t\t(reference.length > 0 && reference.every((entry) => run.passed.includes(entry.case)))\n\t)\n\t\tthrow new CaptureError('Reference completeness differs from declaring section results', {\n\t\t\tcode: 'EVIDENCE',\n\t\t})\n\tconst request = run.request\n\tif (request !== undefined) {\n\t\tif (\n\t\t\trun.identity === undefined ||\n\t\t\trun.identity.id !== request.id ||\n\t\t\trun.identity.stage !== request.stage ||\n\t\t\trun.identity.pid !== request.pid ||\n\t\t\trun.identity.config !== request.config ||\n\t\t\t!request.variants.includes(run.variant)\n\t\t)\n\t\t\tthrow new CaptureError('Run identity differs from its request', { code: 'EVIDENCE' })\n\t\tconst selected = eligible.filter(\n\t\t\t(entry) =>\n\t\t\t\tmatchesCaptureSelector(entry.owner, request.selector) &&\n\t\t\t\t(request.case === undefined || entry.case === request.case) &&\n\t\t\t\t(request.command === 'journey' || entry.states.length > 0),\n\t\t)\n\t\tif (\n\t\t\t!matchesCaptureMembers(\n\t\t\t\tselected.map((entry) => entry.case),\n\t\t\t\trun.passed,\n\t\t\t)\n\t\t)\n\t\t\tthrow new CaptureError('Selected full case names differ from passed results', {\n\t\t\t\tcode: 'EVIDENCE',\n\t\t\t})\n\t\tif (\n\t\t\trequest.state !== undefined &&\n\t\t\tselected.some((entry) => !entry.states.includes(request.state ?? ''))\n\t\t)\n\t\t\tthrow new CaptureError('Requested state differs from its selected declaring case', {\n\t\t\t\tcode: 'EVIDENCE',\n\t\t\t})\n\t}\n\tconst expected =\n\t\trequest?.command === 'journey' || (request === undefined && run.entries.length === 0)\n\t\t\t? []\n\t\t\t: run.registry.filter(\n\t\t\t\t\t(entry) =>\n\t\t\t\t\t\trun.passed.includes(entry.case) &&\n\t\t\t\t\t\t(request?.state === undefined || entry.state === request.state),\n\t\t\t\t)\n\tif (\n\t\t!matchesCaptureMembers(\n\t\t\trun.entries.map(describeCaptureDestination),\n\t\t\texpected.map(describeCaptureDestination),\n\t\t)\n\t)\n\t\tthrow new CaptureError('Emitted entries differ from exact requested projection', {\n\t\t\tcode: 'EVIDENCE',\n\t\t})\n\tfor (const entry of run.entries) {\n\t\tif (passed.find((assertion) => assertion.case === entry.case)?.duration !== entry.duration)\n\t\t\tthrow new CaptureError(`Emitted duration differs from its producing case: ${entry.case}`, {\n\t\t\t\tcode: 'EVIDENCE',\n\t\t\t})\n\t}\n}\n\n/**\n * Chooses the primary classification while retaining all findings separately.\n *\n * @param statuses - Every classification justified by the reading\n * @returns The highest-precedence classification, or `current` when none applies\n *\n * @example\n * ```ts\n * resolveCaptureStatus(['stale-own', 'missing']) // 'missing'\n * resolveCaptureStatus([]) // 'current'\n * ```\n */\nexport function resolveCaptureStatus(statuses: readonly CaptureStatus[]): CaptureStatus {\n\treturn CAPTURE_STATUS_PRECEDENCE.find((status) => statuses.includes(status)) ?? 'current'\n}\n\n/**\n * Reads Git's NUL-delimited porcelain paths without treating spaces or quoted names as separators.\n *\n * @param output - The exact `status --porcelain=v1 -z` output\n * @returns Dirty repository-relative paths, including both sides of renames, sorted without repeats\n * @throws Thrown as an `EVIDENCE` capture error when a rename or copy record has no original path.\n *\n * @example\n * ```ts\n * readCaptureDirty(' M src/a.ts\\0R src/b.ts\\0src/c.ts\\0') // ['src/a.ts', 'src/b.ts', 'src/c.ts']\n * ```\n */\nexport function readCaptureDirty(output: string): readonly string[] {\n\t// A rename or copy record is followed by its original path as a bare record, so whether a record\n\t// is an original depends on the record before it, and the result carries that in its accumulator.\n\tconst result = output\n\t\t.split('\\0')\n\t\t.filter((record) => record !== '')\n\t\t.reduce<{ readonly paths: readonly string[]; readonly pending: boolean }>(\n\t\t\t(state, record) =>\n\t\t\t\tstate.pending\n\t\t\t\t\t? { paths: [...state.paths, record], pending: false }\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tpaths: [...state.paths, record.slice(3)],\n\t\t\t\t\t\t\tpending: /[RC]/u.test(record.slice(0, 2)),\n\t\t\t\t\t\t},\n\t\t\t{ paths: [], pending: false },\n\t\t)\n\tif (result.pending)\n\t\tthrow new CaptureError('Incomplete Git rename provenance', { code: 'EVIDENCE' })\n\treturn [...new Set(result.paths)].toSorted()\n}\n\n/**\n * Validates a complete receipt against full reporter declarations and eligible output coverage.\n *\n * @param receipt - The retained complete-run receipt\n * @param report - The authenticated reporter projection\n * @throws Thrown as an `EVIDENCE` capture error when the receipt omits, invents, or changes a collected declaration or output.\n *\n * @example\n * ```ts\n * validateCaptureReceipt(receipt, readCaptureReport(parseJSON(text)))\n * ```\n */\nexport function validateCaptureReceipt(receipt: CaptureReceipt, report: CaptureReport): void {\n\tconst assertions = report.assertions.filter((entry) => entry.variant === receipt.variant)\n\tif (\n\t\t!receipt.complete ||\n\t\t!matchesCaptureMembers(\n\t\t\tassertions.map(describeCaptureDeclaration),\n\t\t\treceipt.declarations.map(describeCaptureDeclaration),\n\t\t) ||\n\t\t!assertions.some((entry) => entry.eligible) ||\n\t\tassertions.some((entry) => entry.eligible && entry.status !== 'passed')\n\t)\n\t\tthrow new CaptureError('Registry receipt does not prove complete eligible behavior', {\n\t\t\tcode: 'EVIDENCE',\n\t\t})\n\tconst eligible = receipt.declarations.filter((entry) => entry.eligible)\n\tfor (const declaration of eligible) {\n\t\trequireCaptureUnique(declaration.states, 'states within a declaration', true)\n\t\tconst entries = receipt.registry.filter((entry) => entry.case === declaration.case)\n\t\tif (\n\t\t\t!matchesCaptureMembers(\n\t\t\t\tentries.map((entry) => entry.state),\n\t\t\t\tdeclaration.states,\n\t\t\t) ||\n\t\t\tentries.some(\n\t\t\t\t(entry) => !matchesCaptureSelector(resolveCaptureOwner(entry), declaration.owner),\n\t\t\t)\n\t\t)\n\t\t\tthrow new CaptureError('Registry receipt destination coverage differs from declarations', {\n\t\t\t\tcode: 'EVIDENCE',\n\t\t\t})\n\t}\n\tif (\n\t\treceipt.registry.some(\n\t\t\t(entry) => !eligible.some((declaration) => declaration.case === entry.case),\n\t\t) ||\n\t\tnew Set(receipt.registry.map((entry) => entry.project)).size > 1\n\t)\n\t\tthrow new CaptureError(\n\t\t\t'Registry receipt contains an undeclared output or mixes producing projects',\n\t\t\t{ code: 'EVIDENCE' },\n\t\t)\n}\n\n/**\n * Expands an owner path into its prefixes, from its scope through the owner itself.\n *\n * @param owner - A canonical owner path\n * @returns Each colon-bounded prefix, shortest first\n *\n * @example\n * ```ts\n * collectCaptureAncestors('pages:mail:inbox') // ['pages', 'pages:mail', 'pages:mail:inbox']\n * ```\n */\nexport function collectCaptureAncestors(owner: string): readonly string[] {\n\treturn owner.split(':').map((_part, index, parts) => parts.slice(0, index + 1).join(':'))\n}\n\n/**\n * Builds the owner and capture tags a wrapper declares for its owner population.\n *\n * @param owners - Every canonical owner path the host declares\n * @returns The unique `owner:` tag of each owner and ancestor, and each owner's scope and part tags\n * @throws Thrown as a `HOST` capture error naming each owner that is not a canonical selector.\n *\n * @example\n * ```ts\n * buildCaptureTags(['pages:mail'])\n * // ['owner:pages', 'owner:pages:mail', 'pages', 'pages:mail']\n * ```\n */\nexport function buildCaptureTags(owners: readonly string[]): readonly string[] {\n\tconst invalid = owners.filter((owner) => !isCaptureSelector(owner))\n\tif (invalid.length > 0)\n\t\tthrow new CaptureError(\n\t\t\t`Invalid capture owners: ${invalid.map((owner) => preview(owner)).join(', ')}; expected colon-separated portable segments such as \"pages:mail\"`,\n\t\t\t{ code: 'HOST', context: { owners: invalid } },\n\t\t)\n\treturn [\n\t\t...new Set(\n\t\t\towners.flatMap((owner) => [\n\t\t\t\t...collectCaptureAncestors(owner).map((path) => `${CAPTURE_OWNER_PREFIX}${path}`),\n\t\t\t\t...collectCaptureAncestors(owner).slice(0, 2),\n\t\t\t]),\n\t\t),\n\t]\n}\n\n/**\n * Builds the Vitest test options of one capture case from its declaration.\n *\n * @param input - The case's owner, states, producing variant, and harness values\n * @param rules - The host's owners and part resolver\n * @returns The derived tags, the capture metadata, and the optional timeout\n * @throws Thrown as a `HOST` capture error for an undeclared owner or tag, tags beside an owner, capture tags with no states, or a state whose part is undeclared or outside the owner.\n *\n * @example\n * ```ts\n * buildCaptureTest({ owner: 'pages:mail', states: ['inbox'], variant: 'light-390' }, rules).tags\n * // ['owner:pages', 'owner:pages:mail', 'pages', 'pages:mail']\n * ```\n */\nexport function buildCaptureTest(input: CaptureTestInput, rules: CaptureRules): CaptureTestOptions {\n\tconst declared = buildCaptureTags(rules.owners)\n\tconst owner = input.owner\n\tif (owner !== undefined && !declared.includes(`${CAPTURE_OWNER_PREFIX}${owner}`))\n\t\tthrow new CaptureError(\n\t\t\t`Unknown capture owner: ${preview(owner)}; expected a declared owner path or one of its ancestors`,\n\t\t\t{ code: 'HOST', context: { owner } },\n\t\t)\n\tif (owner !== undefined && input.tags !== undefined)\n\t\tthrow new CaptureError(\n\t\t\t`Capture case owned by ${owner} derives its tags from its owner and states; remove its tags`,\n\t\t\t{ code: 'HOST', context: { owner } },\n\t\t)\n\tconst unknown = (input.tags ?? []).filter((tag) => !declared.includes(tag))\n\tif (unknown.length > 0)\n\t\tthrow new CaptureError(\n\t\t\t`Unknown capture tags: ${unknown.map((tag) => preview(tag)).join(', ')}; expected tags the owners declare`,\n\t\t\t{ code: 'HOST', context: { tags: unknown } },\n\t\t)\n\tif (\n\t\tinput.states === undefined &&\n\t\t(input.tags ?? []).some((tag) => !tag.startsWith(CAPTURE_OWNER_PREFIX))\n\t)\n\t\tthrow new CaptureError(\n\t\t\t'Capture case names capture tags but declares no states; declare its states, an empty list included',\n\t\t\t{ code: 'HOST' },\n\t\t)\n\tconst parts = (input.states ?? []).map((state) => {\n\t\tconst part = rules.part(state)\n\t\tif (!declared.includes(`${CAPTURE_OWNER_PREFIX}${part}`))\n\t\t\tthrow new CaptureError(\n\t\t\t\t`Capture state ${state} resolves to an undeclared owner: ${preview(part)}`,\n\t\t\t\t{ code: 'HOST', context: { state, part } },\n\t\t\t)\n\t\tif (owner !== undefined && !matchesCaptureSelector(part, owner))\n\t\t\tthrow new CaptureError(\n\t\t\t\t`Capture state ${state} belongs to ${part}, outside owner ${owner}; split the case by owner`,\n\t\t\t\t{ code: 'HOST', context: { state, part, owner } },\n\t\t\t)\n\t\treturn part\n\t})\n\treturn {\n\t\ttags: [\n\t\t\t...new Set([\n\t\t\t\t...(input.owner === undefined\n\t\t\t\t\t? (input.tags ?? [])\n\t\t\t\t\t: collectCaptureAncestors(input.owner).map((path) => `${CAPTURE_OWNER_PREFIX}${path}`)),\n\t\t\t\t...parts.flatMap((part) => collectCaptureAncestors(part).slice(0, 2)),\n\t\t\t]),\n\t\t],\n\t\tmeta: {\n\t\t\t...(input.owner === undefined ? {} : { owner: input.owner }),\n\t\t\t...(input.states === undefined ? {} : { states: [...input.states] }),\n\t\t\tvariant: input.variant,\n\t\t\t...(input.eligible === undefined ? {} : { eligible: input.eligible }),\n\t\t},\n\t\t...(input.timeout === undefined ? {} : { timeout: input.timeout }),\n\t}\n}\n\n/**\n * Collects every leaf case under a task, keeping cases a runner filter excluded and their results.\n *\n * @param task - A Vitest file, suite, or test task\n * @param ancestors - The titles of the suites that enclose the task, excluding the file name. Default: none\n * @returns Each case with its suite titles and own title joined by spaces, as the Vitest JSON reporter names it\n *\n * @example\n * ```ts\n * collectCaptureCases({ name: 'mail', mode: 'run', meta: {}, tasks: [inbox] })[0]?.name\n * // 'mail opens the inbox'\n * ```\n */\nexport function collectCaptureCases(\n\ttask: CaptureTask,\n\tancestors: readonly string[] = [],\n): readonly CaptureCase[] {\n\tconst names = task.filepath === undefined ? [...ancestors, task.name] : ancestors\n\tif (task.tasks !== undefined)\n\t\treturn task.tasks.flatMap((child) => collectCaptureCases(child, names))\n\treturn [\n\t\t{\n\t\t\tname: names.join(' '),\n\t\t\tmode: task.mode,\n\t\t\ttags: [...(task.tags ?? [])],\n\t\t\tmeta: {\n\t\t\t\t...(task.meta.owner === undefined ? {} : { owner: task.meta.owner }),\n\t\t\t\t...(task.meta.states === undefined ? {} : { states: [...task.meta.states] }),\n\t\t\t\t...(task.meta.variant === undefined ? {} : { variant: task.meta.variant }),\n\t\t\t\t...(task.meta.eligible === undefined ? {} : { eligible: task.meta.eligible }),\n\t\t\t},\n\t\t\t...(task.result === undefined\n\t\t\t\t? {}\n\t\t\t\t: {\n\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\tstate: task.result.state,\n\t\t\t\t\t\t\t...(task.result.duration === undefined ? {} : { duration: task.result.duration }),\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t},\n\t]\n}\n\n/**\n * Refuses a selection whose cases place states owned outside the selected owner.\n *\n * @param cases - Every collected case, including cases a runner filter excluded\n * @param rules - The host's owners and part resolver\n * @param selection - The runner's selection, absent when no runner is the parent\n * @throws Thrown as a `SELECTION` capture error for an undeclared selector, and as a `HOST` capture error naming each case that places a selected state from outside the selected owner.\n *\n * @example\n * ```ts\n * requireCaptureCases(cases, rules, { selector: 'pages:mail' }) // returns when no case is parked\n * ```\n */\nexport function requireCaptureCases(\n\tcases: readonly CaptureCase[],\n\trules: CaptureRules,\n\tselection?: CaptureSelection,\n): void {\n\tif (selection === undefined || selection.selector === 'all') return\n\tconst { selector } = selection\n\tif (!buildCaptureTags(rules.owners).includes(`${CAPTURE_OWNER_PREFIX}${selector}`))\n\t\tthrow new CaptureError(\n\t\t\t`Unknown capture selector: ${preview(selector)}; expected all or a declared owner path`,\n\t\t\t{ code: 'SELECTION', context: { selector } },\n\t\t)\n\tconst parked = cases\n\t\t.filter((entry) => selection.case === undefined || entry.name === selection.case)\n\t\t.flatMap((entry) => {\n\t\t\tconst owner = entry.meta.owner\n\t\t\tif (owner === undefined || matchesCaptureSelector(owner, selector)) return []\n\t\t\tconst states = (entry.meta.states ?? []).filter((state) =>\n\t\t\t\tmatchesCaptureSelector(rules.part(state), selector),\n\t\t\t)\n\t\t\treturn states.length > 0\n\t\t\t\t? [`${entry.name}: owner ${owner}; foreign states ${states.join(', ')}`]\n\t\t\t\t: []\n\t\t})\n\tif (parked.length > 0)\n\t\tthrow new CaptureError(\n\t\t\t`Capture selection ${selector} is parked; split each case so its states stay inside its owner:\\n${parked.join('\\n')}`,\n\t\t\t{ code: 'HOST', context: { selector, parked } },\n\t\t)\n}\n\n/**\n * Builds the required output pair of each state an eligible owner-bearing case declares.\n *\n * @param cases - Every collected case, including cases a runner filter excluded\n * @param rules - The host's part and source resolvers\n * @param options - The producing project and the portfolio mapping of each state\n * @returns One destination per declared state, in case and state order\n * @throws Thrown as a `HOST` capture error when a state has no single mapping or resolves outside its case's owner or the scope, part, and optional section form.\n *\n * @example\n * ```ts\n * buildCaptureDestinations(cases, rules, { project: 'journey:light-390', portfolios })[0]?.file\n * // 'tmp/captures/states/pages/inbox--light-390.png'\n * ```\n */\nexport function buildCaptureDestinations(\n\tcases: readonly CaptureCase[],\n\trules: CaptureRules,\n\toptions: CaptureDestinationOptions,\n): readonly CaptureDestination[] {\n\treturn cases.flatMap((entry) => {\n\t\tconst declared = entry.meta.owner\n\t\tif (declared === undefined || entry.meta.eligible === false) return []\n\t\treturn (entry.meta.states ?? []).map((state): CaptureDestination => {\n\t\t\tconst mappings = options.portfolios.filter((portfolio) => portfolio.states.includes(state))\n\t\t\tconst [mapping] = mappings\n\t\t\tif (mapping === undefined || mappings.length > 1)\n\t\t\t\tthrow new CaptureError(\n\t\t\t\t\t`Capture state ${state} needs exactly one portfolio mapping; mapped by: ${mappings.map((candidate) => preview(candidate.portfolio)).join(', ') || 'none'}`,\n\t\t\t\t\t{ code: 'HOST', context: { state } },\n\t\t\t\t)\n\t\t\tconst owner = rules.part(state)\n\t\t\tif (!matchesCaptureSelector(owner, declared))\n\t\t\t\tthrow new CaptureError(\n\t\t\t\t\t`Capture state ${state} belongs to ${owner}, outside owner ${declared} of ${entry.name}`,\n\t\t\t\t\t{ code: 'HOST', context: { state, owner, declared } },\n\t\t\t\t)\n\t\t\tconst [scope, part, section, ...rest] = owner.split(':')\n\t\t\tif (scope === undefined || part === undefined || rest.length > 0)\n\t\t\t\tthrow new CaptureError(\n\t\t\t\t\t`Capture state ${state} resolves to ${preview(owner)}; expected scope:part or scope:part:section`,\n\t\t\t\t\t{ code: 'HOST', context: { state, owner } },\n\t\t\t\t)\n\t\t\treturn {\n\t\t\t\tportfolio: mapping.portfolio,\n\t\t\t\tstate,\n\t\t\t\tscope,\n\t\t\t\tpart,\n\t\t\t\t...(section === undefined ? {} : { section }),\n\t\t\t\tvariant: mapping.variant,\n\t\t\t\tproject: options.project,\n\t\t\t\tfile: `${mapping.directory}/${mapping.scoped ? `${scope}/` : ''}${state}--${mapping.variant}.png`,\n\t\t\t\tcase: entry.name,\n\t\t\t\tsources: rules.sources(owner),\n\t\t\t}\n\t\t})\n\t})\n}\n\n/**\n * Builds a run record from collected cases, the run's destinations, and its observed and emitted states.\n *\n * @param options - The cases, registry, observed states, emitted state-to-path pairs, and execution context\n * @returns The final record, without the journey artifact the caller binds after rendering it\n * @throws Thrown as a `HOST` capture error for an owner-bearing case with no variant, and as an `EVIDENCE` capture error for an emitted state with no destination, a path other than its destination's file, or a producing case with no measured duration.\n *\n * @example\n * ```ts\n * const run = buildCaptureRun({ cases, registry, observed, emitted, variant: 'light-390', time })\n * validateCaptureRun(run, readCaptureReport(parseJSON(text)), 'journey:light-390')\n * ```\n */\nexport function buildCaptureRun(options: CaptureRunOptions): CaptureRun {\n\tconst declarations = options.cases.flatMap((entry): readonly CaptureDeclaration[] => {\n\t\tconst { owner, variant } = entry.meta\n\t\tif (owner === undefined) return []\n\t\tif (variant === undefined)\n\t\t\tthrow new CaptureError(`Owner-bearing case declares no variant: ${entry.name}`, {\n\t\t\t\tcode: 'HOST',\n\t\t\t})\n\t\treturn [\n\t\t\t{\n\t\t\t\tcase: entry.name,\n\t\t\t\towner,\n\t\t\t\tvariant,\n\t\t\t\teligible: entry.meta.eligible !== false,\n\t\t\t\tstates: [...(entry.meta.states ?? [])],\n\t\t\t},\n\t\t]\n\t})\n\tconst passed = declarations\n\t\t.filter(\n\t\t\t(declaration) =>\n\t\t\t\tdeclaration.eligible &&\n\t\t\t\toptions.cases.some(\n\t\t\t\t\t(entry) => entry.name === declaration.case && entry.result?.state === 'pass',\n\t\t\t\t),\n\t\t)\n\t\t.map((declaration) => declaration.case)\n\tconst entries = options.emitted.map(([state, path]): CaptureEntry => {\n\t\tconst destination = options.registry.find((entry) => entry.state === state)\n\t\tif (destination === undefined)\n\t\t\tthrow new CaptureError(`Emitted state has no registry destination: ${preview(state)}`, {\n\t\t\t\tcode: 'EVIDENCE',\n\t\t\t\tcontext: { state },\n\t\t\t})\n\t\tconst written = path.replaceAll('\\\\', '/')\n\t\tif (written !== destination.file && !written.endsWith(`/${destination.file}`))\n\t\t\tthrow new CaptureError(\n\t\t\t\t`Emitted state ${state} was written at ${preview(path)}, not at its destination ${destination.file}`,\n\t\t\t\t{ code: 'EVIDENCE', context: { state, path, file: destination.file } },\n\t\t\t)\n\t\tconst duration = options.cases.find((entry) => entry.name === destination.case)?.result\n\t\t\t?.duration\n\t\tif (duration === undefined)\n\t\t\tthrow new CaptureError(`Emitting case has no measured duration: ${destination.case}`, {\n\t\t\t\tcode: 'EVIDENCE',\n\t\t\t\tcontext: { state, case: destination.case },\n\t\t\t})\n\t\treturn { ...destination, duration }\n\t})\n\tconst eligible = declarations.filter((declaration) => declaration.eligible)\n\tconst reference = options.registry.filter((entry) => entry.section === entry.state)\n\tconst request = options.request\n\treturn {\n\t\tversion: CAPTURE_VERSION,\n\t\t...(request === undefined\n\t\t\t? {}\n\t\t\t: {\n\t\t\t\t\tidentity: {\n\t\t\t\t\t\tid: request.id,\n\t\t\t\t\t\tstage: request.stage,\n\t\t\t\t\t\tpid: request.pid,\n\t\t\t\t\t\tconfig: request.config,\n\t\t\t\t\t},\n\t\t\t\t\trequest,\n\t\t\t\t}),\n\t\tvariant: options.variant,\n\t\ttime: options.time,\n\t\tcomplete: eligible.length > 0 && eligible.every((entry) => passed.includes(entry.case)),\n\t\treference: reference.length > 0 && reference.every((entry) => passed.includes(entry.case)),\n\t\tdeclarations,\n\t\tregistry: [...options.registry],\n\t\tpassed,\n\t\tobserved: [...options.observed],\n\t\tentries,\n\t}\n}\n\n/**\n * Renders the journey artifact lines that bind a run record and each case that passed in it.\n *\n * @param record - The run record's portable path\n * @param run - The run whose passed cases the artifact names\n * @returns The `record=` line, then one `case-ran=` line per passed case, without line endings\n * @throws Thrown as an `EVIDENCE` capture error for a record path that is not portable or a case name that holds a line break.\n *\n * @example\n * ```ts\n * renderCaptureArtifact('tmp/captures/states/runs/run-1/selected/light-390.json', {\n * \tpassed: ['mail opens the inbox'],\n * })\n * // ['record=tmp/captures/states/runs/run-1/selected/light-390.json', 'case-ran=mail opens the inbox']\n * ```\n */\nexport function renderCaptureArtifact(\n\trecord: string,\n\trun: Pick<CaptureRun, 'passed'>,\n): readonly string[] {\n\tif (!isCapturePath(record))\n\t\tthrow new CaptureError(\n\t\t\t`Artifact record path is not a portable relative path: ${preview(record)}`,\n\t\t\t{ code: 'EVIDENCE', context: { record } },\n\t\t)\n\tconst broken = run.passed.filter((name) => /[\\r\\n]/u.test(name))\n\tif (broken.length > 0)\n\t\tthrow new CaptureError(\n\t\t\t`Artifact cannot carry case names with line breaks: ${broken.map((name) => preview(name)).join(', ')}`,\n\t\t\t{ code: 'EVIDENCE', context: { cases: broken } },\n\t\t)\n\treturn [\n\t\t`${CAPTURE_ARTIFACT_PREFIXES.record}${record}`,\n\t\t...run.passed.map((name) => `${CAPTURE_ARTIFACT_PREFIXES.case}${name}`),\n\t]\n}\n\n/**\n * Reads the record bindings and the ran cases from a journey artifact's text.\n *\n * @param text - The artifact text, with LF or CRLF line endings\n * @returns The path of each `record=` line and the full name of each `case-ran=` line, in text order\n *\n * @example\n * ```ts\n * readCaptureArtifact('# light-390\\r\\nrecord=tmp/run.json\\r\\ncase-ran=mail opens the inbox\\r\\n')\n * // { records: ['tmp/run.json'], cases: ['mail opens the inbox'] }\n * ```\n */\nexport function readCaptureArtifact(text: string): CaptureArtifactLines {\n\tconst lines = text.split(/\\r\\n|\\n/u)\n\treturn {\n\t\trecords: lines\n\t\t\t.filter((line) => line.startsWith(CAPTURE_ARTIFACT_PREFIXES.record))\n\t\t\t.map((line) => line.slice(CAPTURE_ARTIFACT_PREFIXES.record.length)),\n\t\tcases: lines\n\t\t\t.filter((line) => line.startsWith(CAPTURE_ARTIFACT_PREFIXES.case))\n\t\t\t.map((line) => line.slice(CAPTURE_ARTIFACT_PREFIXES.case.length)),\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiBA,IAAa,sBAAsB,OAAO,OAAO;CAChD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAU;;;;;;;;;;;;;AAcV,IAAa,sBAAsB,OAAO,IAAI,iCAAiC;;;;;;;;;;;;;AAc/E,IAAa,4BAA4B,OAAO,OAAO;CACtD;CACA;CACA;CACA;CACA;CACA;AACD,CAAU;;;;;;;;;AAUV,IAAa,yBAAyB;;;;;;;;;AAUtC,IAAa,kBAAkB;;;;;;;;;AAU/B,IAAa,wBAAwB,OAAO,OAAO;CAAC;CAAK;CAAI;CAAI;CAAI;CAAI;CAAI;CAAI;AAAE,CAAU;;;;;;;;;AAU7F,IAAa,wBAAwB;;;;;;;;;AAUrC,IAAa,wBAAwB;;;;;;;;;AAUrC,IAAa,uBAAuB;;;;;;;;;AAUpC,IAAa,uBAAuB;;;;;;;;;;;;;AAcpC,IAAa,4BAA4B,OAAO,OAAO;CACtD,QAAQ;CACR,MAAM;AACP,CAAU;;;;;;;;;;;;;;;;;;;;AC9HV,IAAa,eAAb,cAAkC,MAAM;CACrB,OAAO;CAChB;CACA;;;;;;;CAQT,YAAY,SAAiB,SAA8B;EAC1D,MAAM,SAAS,WAAW,UAAU,EAAE,OAAO,QAAQ,MAAM,IAAI,KAAA,CAAS;EAExE,OAAO,eAAe,MAAM,qBAAqB,EAAE,OAAO,KAAK,CAAC;EAChE,KAAK,OAAO,QAAQ;EACpB,KAAK,UAAU,QAAQ;CACxB;AACD;;;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,eAAe,OAAuC;CACrE,QAAA,GAAOA,oBAAAA,MAAAA,OAAY;EAClB,IAAI,EAAA,GAACC,oBAAAA,QAAAA,CAAQ,KAAK,KAAKC,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AC,CAAC,KAAK,IAAI,KACnG;EAAE,MAAM;EAAY,SAAS,EAAE,OAAO,OAAO;CAAE,CAChD;CACD,OAAO,CACN,GAAG,0BAA0B,SAAS,UACtC,GAAG,IAAI,OAAO,KAAK,SAAS,GAAG,0BAA0B,OAAO,MAAM,CACvE;AACD;;;;;;;;;;;;;AAcA,SAAgB,oBAAoB,MAAoC;CACvE,MAAM,QAAQ,KAAK,MAAM,UAAU;CACnC,OAAO;EACN,SAAS,MACP,QAAQ,SAAS,KAAK,WAAW,0BAA0B,MAAM,CAAC,CAAC,CACnE,KAAK,SAAS,KAAK,MAAM,0BAA0B,OAAO,MAAM,CAAC;EACnE,OAAO,MACL,QAAQ,SAAS,KAAK,WAAW,0BAA0B,IAAI,CAAC,CAAC,CACjE,KAAK,SAAS,KAAK,MAAM,0BAA0B,KAAK,MAAM,CAAC;CAClE;AACD"}
@@ -947,7 +947,7 @@ function readCaptureReport(value) {
947
947
  requireCaptureUnique(assertions.map(resolveLookupKey), "reporter case identities");
948
948
  return {
949
949
  start: files.reduce((start, file) => Math.min(start, file.start), value.startTime),
950
- end: files.reduce((end, file) => Math.max(end, file.end), -Infinity),
950
+ end: files.reduce((end, file) => Math.max(end, file.end), -1e400),
951
951
  assertions
952
952
  };
953
953
  }