@orkestrel/capture 0.0.0-stage → 0.0.2

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.
@@ -0,0 +1,1269 @@
1
+ /**
2
+ * Keys the global brand a capture error carries, so a duplicate installation recognizes it.
3
+ *
4
+ * @remarks
5
+ * The key follows the package-and-class form, `Symbol.for('<package>.<ClassName>')`. The brand is
6
+ * a recognition marker and never proof that the class's constructor ran.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * CAPTURE_ERROR_BRAND === Symbol.for('@orkestrel/capture.CaptureError') // true
11
+ * ```
12
+ */
13
+ export declare const CAPTURE_ERROR_BRAND: unique symbol;
14
+
15
+ /**
16
+ * Lists the condition axes a capture failure carries, in the order the executable reports them.
17
+ *
18
+ * @remarks
19
+ * `USAGE` is a refused command line and exits 64; every other condition exits 1. `SELECTION`
20
+ * names a selector, variant, case, state, or portfolio the host does not declare. `HOST` names a
21
+ * wrapper, configuration, or declaration fault. `STAGE` names a runner stage that did not
22
+ * complete. `EVIDENCE` names a record, report, registry, or manifest that fails its protocol.
23
+ * `CONTAINMENT` names a path that leaves the authorized roots.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * CAPTURE_ERROR_CODES.includes('USAGE') // true
28
+ * ```
29
+ */
30
+ export declare const CAPTURE_ERROR_CODES: readonly ["USAGE", "SELECTION", "HOST", "STAGE", "EVIDENCE", "CONTAINMENT"];
31
+
32
+ /**
33
+ * Names the default lookup journal file inside a portfolio directory.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * `tmp/captures/states/${CAPTURE_LOOKUPS_FILE}` // 'tmp/captures/states/lookups.json'
38
+ * ```
39
+ */
40
+ export declare const CAPTURE_LOOKUPS_FILE = "lookups.json";
41
+
42
+ /**
43
+ * Names the default image-stamp manifest file inside a portfolio directory.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * `tmp/captures/states/${CAPTURE_MANIFEST_FILE}` // 'tmp/captures/states/manifest.json'
48
+ * ```
49
+ */
50
+ export declare const CAPTURE_MANIFEST_FILE = "manifest.json";
51
+
52
+ /**
53
+ * Holds the eight bytes every PNG file opens with.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * CAPTURE_PNG_SIGNATURE.map((byte) => byte.toString(16)).join('') // '89504e470d0a1a0a'
58
+ * ```
59
+ */
60
+ export declare const CAPTURE_PNG_SIGNATURE: readonly [137, 80, 78, 71, 13, 10, 26, 10];
61
+
62
+ /**
63
+ * Names the default accepted complete-run registry file inside a portfolio directory.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * `tmp/captures/states/${CAPTURE_REGISTRY_FILE}` // 'tmp/captures/states/registry.json'
68
+ * ```
69
+ */
70
+ export declare const CAPTURE_REGISTRY_FILE = "registry.json";
71
+
72
+ /**
73
+ * Names the file prefix of a runner request, completed by the runner's process id and `.json`.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * `${CAPTURE_REQUEST_PREFIX}-${process.pid}.json` // 'journey-selection-4242.json'
78
+ * ```
79
+ */
80
+ export declare const CAPTURE_REQUEST_PREFIX = "journey-selection";
81
+
82
+ /**
83
+ * Lists the non-current freshness classifications from highest precedence to lowest.
84
+ *
85
+ * @remarks
86
+ * `resolveCaptureStatus` reads this order to choose a frame's primary classification while the
87
+ * reading keeps every finding separately. A frame with none of these is current.
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * CAPTURE_STATUS_PRECEDENCE[0] // 'duplicate'
92
+ * ```
93
+ */
94
+ export declare const CAPTURE_STATUS_PRECEDENCE: readonly ["duplicate", "orphan", "missing", "unstamped", "stale-shared", "stale-own"];
95
+
96
+ /**
97
+ * Holds the protocol version every request, record, receipt, registry, and manifest declares.
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * CAPTURE_VERSION // 1
102
+ * ```
103
+ */
104
+ export declare const CAPTURE_VERSION = 1;
105
+
106
+ /**
107
+ * Names the journey artifact a final case wrote and the SHA-256 of its bytes.
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * const artifact: CaptureArtifact = { file: 'tmp/captures/states/runs/a/light-390.txt', digest }
112
+ * ```
113
+ */
114
+ export declare interface CaptureArtifact {
115
+ readonly file: string;
116
+ readonly digest: string;
117
+ }
118
+
119
+ /**
120
+ * Carries the owner-bearing projection of a Vitest JSON assertion.
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * const assertion: CaptureAssertion = {
125
+ * case: 'mail shows the inbox',
126
+ * owner: 'pages:mail',
127
+ * variant: 'light-390',
128
+ * eligible: true,
129
+ * states: ['inbox'],
130
+ * status: 'passed',
131
+ * duration: 812,
132
+ * }
133
+ * ```
134
+ */
135
+ export declare interface CaptureAssertion extends CaptureDeclaration {
136
+ readonly status: string;
137
+ readonly duration?: number;
138
+ }
139
+
140
+ /**
141
+ * Describes a logged viewport box a journey artifact records for pixel sampling.
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * const box: CaptureBox = { x: 0, y: 64, width: 390, height: 780 }
146
+ * ```
147
+ */
148
+ export declare interface CaptureBox {
149
+ readonly x: number;
150
+ readonly y: number;
151
+ readonly width: number;
152
+ readonly height: number;
153
+ }
154
+
155
+ /**
156
+ * Binds a successful full collection to the unchanged complete anchor and exact evidence bytes.
157
+ *
158
+ * @remarks
159
+ * This is declaration evidence, not a complete-run receipt or a per-state passing claim. Inputs
160
+ * preserve the full host pattern declaration and expansion. Even a project with no passing
161
+ * selected case can provide a validated full collection. Report and run bytes are pinned
162
+ * separately.
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * const collection: unknown = JSON.parse(text)
167
+ * if (isCaptureCollection(collection)) collection.run.digest // SHA-256 of the run record
168
+ * ```
169
+ */
170
+ export declare interface CaptureCollectionReceipt {
171
+ readonly project: string;
172
+ readonly registry: string;
173
+ readonly variant: string;
174
+ readonly inputs: CaptureDigest;
175
+ readonly run: {
176
+ readonly file: string;
177
+ readonly digest: string;
178
+ };
179
+ readonly report: {
180
+ readonly file: string;
181
+ readonly digest: string;
182
+ };
183
+ }
184
+
185
+ /**
186
+ * Preserves a collected case's full behavioral declaration.
187
+ *
188
+ * @example
189
+ * ```ts
190
+ * const declaration: CaptureDeclaration = {
191
+ * case: 'mail shows the inbox',
192
+ * owner: 'pages:mail',
193
+ * variant: 'light-390',
194
+ * eligible: true,
195
+ * states: ['inbox'],
196
+ * }
197
+ * ```
198
+ */
199
+ export declare interface CaptureDeclaration {
200
+ readonly case: string;
201
+ readonly owner: string;
202
+ readonly variant: string;
203
+ readonly eligible: boolean;
204
+ readonly states: readonly string[];
205
+ }
206
+
207
+ /**
208
+ * Identifies one required output pair and its declaring case.
209
+ *
210
+ * @example
211
+ * ```ts
212
+ * const destination: unknown = JSON.parse(text)
213
+ * if (isCaptureDestination(destination)) destination.file // 'tmp/captures/states/pages/mail--inbox.png'
214
+ * ```
215
+ */
216
+ export declare interface CaptureDestination {
217
+ readonly portfolio: string;
218
+ readonly state: string;
219
+ readonly scope: string;
220
+ readonly part: string;
221
+ readonly section?: string;
222
+ readonly variant: string;
223
+ readonly project: string;
224
+ readonly file: string;
225
+ readonly case: string;
226
+ readonly sources: CaptureSources;
227
+ }
228
+
229
+ /**
230
+ * Records declared patterns, expanded file hashes, and their combined digest.
231
+ *
232
+ * @example
233
+ * ```ts
234
+ * const digest: unknown = JSON.parse(text)
235
+ * if (isCaptureDigest(digest)) digest.patterns // readonly string[]
236
+ * ```
237
+ */
238
+ export declare interface CaptureDigest {
239
+ readonly patterns: readonly string[];
240
+ readonly files: Readonly<Record<string, string>>;
241
+ readonly digest: string;
242
+ }
243
+
244
+ /**
245
+ * Records an emitted destination and its producing case duration.
246
+ *
247
+ * @example
248
+ * ```ts
249
+ * const entry: unknown = JSON.parse(text)
250
+ * if (isCaptureEntry(entry)) entry.duration // milliseconds
251
+ * ```
252
+ */
253
+ export declare interface CaptureEntry extends CaptureDestination {
254
+ readonly duration: number;
255
+ }
256
+
257
+ /**
258
+ * Reports one capture failure under a stable condition axis.
259
+ *
260
+ * @remarks
261
+ * Every refusal the engine, the runner, and the readers raise arrives as one of these, so the
262
+ * executable branches on `code` rather than on message text: `USAGE` exits 64 and every other
263
+ * condition exits 1. Narrow a caught value with `isCaptureError` before reading `code`.
264
+ *
265
+ * @example
266
+ * ```ts
267
+ * const error = new CaptureError('Unknown variant: phone', {
268
+ * code: 'SELECTION',
269
+ * context: { variant: 'phone' },
270
+ * })
271
+ * error.code // 'SELECTION'
272
+ * error.context?.variant // 'phone'
273
+ * ```
274
+ */
275
+ export declare class CaptureError extends Error {
276
+ readonly name = "CaptureError";
277
+ readonly code: CaptureErrorCode;
278
+ readonly context: CaptureErrorContext | undefined;
279
+ /**
280
+ * Creates one classified capture failure.
281
+ *
282
+ * @param message - Human-readable description of what failed
283
+ * @param options - The condition, optional structured context, and optional cause
284
+ */
285
+ constructor(message: string, options: CaptureErrorOptions);
286
+ }
287
+
288
+ /**
289
+ * Names one condition axis a capture failure carries.
290
+ *
291
+ * @example
292
+ * ```ts
293
+ * const code: CaptureErrorCode = 'USAGE'
294
+ * ```
295
+ */
296
+ export declare type CaptureErrorCode = (typeof CAPTURE_ERROR_CODES)[number];
297
+
298
+ /**
299
+ * Carries structured facts about a capture failure beside its message.
300
+ *
301
+ * @example
302
+ * ```ts
303
+ * const context: CaptureErrorContext = { selector: 'pages:mail', variant: 'light-390' }
304
+ * ```
305
+ */
306
+ export declare type CaptureErrorContext = Readonly<Record<string, unknown>>;
307
+
308
+ /**
309
+ * Configures one capture failure's condition, optional context, and optional cause.
310
+ *
311
+ * @example
312
+ * ```ts
313
+ * const options: CaptureErrorOptions = { code: 'SELECTION', context: { selector: 'pages:mail' } }
314
+ * ```
315
+ */
316
+ export declare interface CaptureErrorOptions {
317
+ readonly code: CaptureErrorCode;
318
+ readonly context?: CaptureErrorContext;
319
+ readonly cause?: unknown;
320
+ }
321
+
322
+ /**
323
+ * Reports a frame's freshness classification and every supporting reason.
324
+ *
325
+ * @example
326
+ * ```ts
327
+ * const freshness: CaptureFreshness = {
328
+ * file: 'tmp/captures/states/pages/mail--inbox.png',
329
+ * state: 'inbox',
330
+ * variant: 'light-390',
331
+ * status: 'missing',
332
+ * reasons: ['no image at the required path'],
333
+ * }
334
+ * ```
335
+ */
336
+ export declare interface CaptureFreshness {
337
+ readonly file: string;
338
+ readonly state: string;
339
+ readonly variant: string;
340
+ readonly status: CaptureStatus;
341
+ readonly reasons: readonly string[];
342
+ }
343
+
344
+ /**
345
+ * Identifies one runner invocation's producing stage and configuration.
346
+ *
347
+ * @example
348
+ * ```ts
349
+ * const identity: CaptureIdentity = {
350
+ * id: 'run-1',
351
+ * stage: 'selected',
352
+ * pid: 4242,
353
+ * config: 'configs/app/vite.journey.config.ts',
354
+ * }
355
+ * ```
356
+ */
357
+ export declare interface CaptureIdentity {
358
+ readonly id: string;
359
+ readonly stage: string;
360
+ readonly pid: number;
361
+ readonly config: string;
362
+ }
363
+
364
+ /**
365
+ * Binds a state-to-case lookup to its registry, inputs, and passing run.
366
+ *
367
+ * @example
368
+ * ```ts
369
+ * const lookup: unknown = JSON.parse(text)
370
+ * if (isCaptureLookup(lookup)) lookup.case // the declaring case's full name
371
+ * ```
372
+ */
373
+ export declare interface CaptureLookup {
374
+ readonly registry: string;
375
+ readonly variant: string;
376
+ readonly case: string;
377
+ readonly owner: string;
378
+ readonly states: readonly string[];
379
+ readonly inputs: Readonly<Record<string, string>>;
380
+ readonly run: {
381
+ readonly file: string;
382
+ readonly digest: string;
383
+ };
384
+ }
385
+
386
+ /**
387
+ * Binds capture-free lookup publication to the exact manifest it supplements.
388
+ *
389
+ * @remarks
390
+ * A successful capture merges the journal and changes the manifest digest, retiring this journal
391
+ * logically without a second filesystem mutation in the capture transaction. The `inputs` table
392
+ * stores each distinct path-to-hash map under its digest; every lookup names that digest in its
393
+ * `inputs` field. Expanded lookup results and image manifests retain their input maps.
394
+ *
395
+ * @example
396
+ * ```ts
397
+ * const journal: CaptureLookupJournal = { version: 1, inputs: {}, lookups: [] }
398
+ * ```
399
+ */
400
+ export declare interface CaptureLookupJournal {
401
+ readonly collections?: readonly CaptureCollectionReceipt[];
402
+ readonly version: 1;
403
+ readonly manifest?: string;
404
+ readonly inputs: Readonly<Record<string, Readonly<Record<string, string>>>>;
405
+ readonly lookups: ReadonlyArray<Omit<CaptureLookup, 'inputs'> & {
406
+ readonly inputs: string;
407
+ }>;
408
+ }
409
+
410
+ /**
411
+ * Holds the registry, frame stamps, and validated case lookups in one document.
412
+ *
413
+ * @example
414
+ * ```ts
415
+ * const manifest: unknown = JSON.parse(text)
416
+ * if (isCaptureManifest(manifest)) Object.keys(manifest.entries) // stamped image keys
417
+ * ```
418
+ */
419
+ export declare interface CaptureManifest {
420
+ readonly version: number;
421
+ readonly registry: CaptureRegistry;
422
+ readonly entries: Readonly<Record<string, CaptureStamp>>;
423
+ readonly lookups: readonly CaptureLookup[];
424
+ }
425
+
426
+ /**
427
+ * Binds a complete registry reading to its report and input hashes.
428
+ *
429
+ * @example
430
+ * ```ts
431
+ * const receipt: unknown = JSON.parse(text)
432
+ * if (isCaptureReceipt(receipt)) receipt.report.digest // SHA-256 of the reporter bytes
433
+ * ```
434
+ */
435
+ export declare interface CaptureReceipt {
436
+ readonly version: number;
437
+ readonly variant: string;
438
+ readonly time: string;
439
+ readonly report: {
440
+ readonly file: string;
441
+ readonly digest: string;
442
+ };
443
+ readonly inputs: Readonly<Record<string, string>>;
444
+ readonly declarations: readonly CaptureDeclaration[];
445
+ readonly registry: readonly CaptureDestination[];
446
+ readonly complete: boolean;
447
+ }
448
+
449
+ /**
450
+ * Collects validated registry receipts and their required output pairs.
451
+ *
452
+ * @example
453
+ * ```ts
454
+ * const registry: unknown = JSON.parse(text)
455
+ * if (isCaptureRegistry(registry)) registry.digest // the registry identity
456
+ * ```
457
+ */
458
+ export declare interface CaptureRegistry {
459
+ readonly version: number;
460
+ readonly receipts: readonly CaptureReceipt[];
461
+ readonly entries: readonly CaptureDestination[];
462
+ readonly digest: string;
463
+ }
464
+
465
+ /**
466
+ * Holds validated reporter assertions without copying Vitest's unrelated wire members.
467
+ *
468
+ * @example
469
+ * ```ts
470
+ * const report: CaptureReport = readCaptureReport(parseJSON(text))
471
+ * report.assertions.length
472
+ * ```
473
+ */
474
+ export declare interface CaptureReport {
475
+ readonly start: number;
476
+ readonly end: number;
477
+ readonly assertions: readonly CaptureAssertion[];
478
+ }
479
+
480
+ /**
481
+ * Carries a runner request through Vitest's provided-context protocol.
482
+ *
483
+ * @remarks Journey selections use the selected stage; frame captures use narrow and rest stages.
484
+ * Registry refreshes retain their registry-prefixed stages. Records are keyed by id, stage, and variant.
485
+ *
486
+ * @example
487
+ * ```ts
488
+ * const request: unknown = JSON.parse(text)
489
+ * if (isCaptureRequest(request)) request.variants // readonly string[]
490
+ * ```
491
+ */
492
+ export declare interface CaptureRequest extends CaptureSelection, CaptureIdentity {
493
+ readonly version: 1;
494
+ readonly command: 'journey' | 'capture';
495
+ readonly variants: readonly string[];
496
+ readonly args: readonly string[];
497
+ }
498
+
499
+ /**
500
+ * Records collected declarations, successful observations, and emitted output separately.
501
+ *
502
+ * @example
503
+ * ```ts
504
+ * const run: unknown = JSON.parse(text)
505
+ * if (isCaptureRun(run)) run.passed // readonly string[]
506
+ * ```
507
+ */
508
+ export declare interface CaptureRun {
509
+ readonly version: number;
510
+ readonly identity?: CaptureIdentity;
511
+ readonly request?: CaptureRequest;
512
+ readonly variant: string;
513
+ readonly time: string;
514
+ readonly complete: boolean;
515
+ readonly reference: boolean;
516
+ readonly artifact?: CaptureArtifact;
517
+ readonly declarations: readonly CaptureDeclaration[];
518
+ readonly registry: readonly CaptureDestination[];
519
+ readonly passed: readonly string[];
520
+ readonly observed: readonly string[];
521
+ readonly entries: readonly CaptureEntry[];
522
+ }
523
+
524
+ /**
525
+ * Carries the selection fields a request and a parking check read.
526
+ *
527
+ * @example
528
+ * ```ts
529
+ * const selection: CaptureSelection = { selector: 'pages:mail', state: 'inbox' }
530
+ * ```
531
+ */
532
+ export declare interface CaptureSelection {
533
+ readonly selector: string;
534
+ readonly case?: string;
535
+ readonly state?: string;
536
+ }
537
+
538
+ /**
539
+ * Attributes product ownership and behavioral inputs separately.
540
+ *
541
+ * @example
542
+ * ```ts
543
+ * const sources: CaptureSources = { own: ['src/mail/**'], shared: ['src/core/**'], tests: [] }
544
+ * ```
545
+ */
546
+ export declare interface CaptureSources {
547
+ readonly own: readonly string[];
548
+ readonly shared: readonly string[];
549
+ readonly tests: readonly string[];
550
+ }
551
+
552
+ /**
553
+ * Stamps one emitted frame with execution, source, image, and registry provenance.
554
+ *
555
+ * @example
556
+ * ```ts
557
+ * const stamp: unknown = JSON.parse(text)
558
+ * if (isCaptureStamp(stamp)) stamp.image.digest // SHA-256 of the PNG bytes
559
+ * ```
560
+ */
561
+ export declare interface CaptureStamp extends CaptureEntry {
562
+ readonly identity: CaptureIdentity;
563
+ readonly time: string;
564
+ readonly commit: string;
565
+ readonly dirty: readonly string[];
566
+ readonly own: Readonly<Record<string, string>>;
567
+ readonly shared: CaptureDigest;
568
+ readonly tests: Readonly<Record<string, string>>;
569
+ readonly image: {
570
+ readonly digest: string;
571
+ readonly size: number;
572
+ readonly modified: number;
573
+ };
574
+ readonly registry: string;
575
+ }
576
+
577
+ /**
578
+ * Names the primary freshness classification of a required or discovered frame.
579
+ *
580
+ * @example
581
+ * ```ts
582
+ * const status: CaptureStatus = 'stale-own'
583
+ * ```
584
+ */
585
+ export declare type CaptureStatus = 'current' | (typeof CAPTURE_STATUS_PRECEDENCE)[number];
586
+
587
+ /**
588
+ * Extends the image manifest with independently authenticated collection evidence.
589
+ *
590
+ * @remarks Absence means no collection attestation; historical lookups supply none implicitly.
591
+ *
592
+ * @example
593
+ * ```ts
594
+ * const manifest: unknown = JSON.parse(text)
595
+ * if (isCaptureStoredManifest(manifest)) manifest.collections // readonly receipts or undefined
596
+ * ```
597
+ */
598
+ export declare interface CaptureStoredManifest extends CaptureManifest {
599
+ readonly collections?: readonly CaptureCollectionReceipt[];
600
+ }
601
+
602
+ /**
603
+ * Declares a host viewport's name and pixel geometry without inferring it from a file name.
604
+ *
605
+ * @example
606
+ * ```ts
607
+ * const viewport: CaptureViewport = { name: 'light-390', width: 390, height: 844 }
608
+ * ```
609
+ */
610
+ export declare interface CaptureViewport {
611
+ readonly name: string;
612
+ readonly width: number;
613
+ readonly height: number;
614
+ }
615
+
616
+ /**
617
+ * Identifies changed behavioral inputs and conservatively affected cases.
618
+ *
619
+ * @example
620
+ * ```ts
621
+ * const warning: CaptureWarning = { files: ['tests/setup.ts'], cases: ['mail shows the inbox'] }
622
+ * ```
623
+ */
624
+ export declare interface CaptureWarning {
625
+ readonly files: readonly string[];
626
+ readonly cases: readonly string[];
627
+ }
628
+
629
+ /**
630
+ * Names every changed, added, or removed file in hash populations.
631
+ *
632
+ * @param previous - The retained file hashes
633
+ * @param current - The observed file hashes
634
+ * @returns The sorted changed membership
635
+ *
636
+ * @example
637
+ * ```ts
638
+ * collectCaptureChanges({ 'a.ts': 'x', 'b.ts': 'y' }, { 'a.ts': 'x', 'b.ts': 'z', 'c.ts': 'w' })
639
+ * // ['b.ts', 'c.ts']
640
+ * ```
641
+ */
642
+ export declare function collectCaptureChanges(previous: Readonly<Record<string, string>>, current: Readonly<Record<string, string>>): readonly string[];
643
+
644
+ /**
645
+ * Finds repeated identities before a keyed collection could discard them.
646
+ *
647
+ * @param values - The identity population
648
+ * @param folded - If `true`, compares case-folded keys; if `false`, compares exact identities. Default: `false`
649
+ * @returns Every member whose comparison key appears more than once
650
+ *
651
+ * @example
652
+ * ```ts
653
+ * collectCaptureDuplicates(['a', 'b', 'a']) // ['a', 'a']
654
+ * collectCaptureDuplicates(['Pages', 'pages'], true) // ['Pages', 'pages']
655
+ * ```
656
+ */
657
+ export declare function collectCaptureDuplicates(values: readonly string[], folded?: boolean): readonly string[];
658
+
659
+ /**
660
+ * Serializes a complete behavioral declaration without dropping eligibility or states.
661
+ *
662
+ * @param entry - The collected declaration
663
+ * @returns The deterministic comparison representation
664
+ *
665
+ * @example
666
+ * ```ts
667
+ * describeCaptureDeclaration({ ...declaration, states: ['b', 'a'] }) ===
668
+ * describeCaptureDeclaration({ ...declaration, states: ['a', 'b'] })
669
+ * // true
670
+ * ```
671
+ */
672
+ export declare function describeCaptureDeclaration(entry: CaptureDeclaration): string;
673
+
674
+ /**
675
+ * Serializes a destination's identity and attribution in a deterministic field order.
676
+ *
677
+ * @param entry - The destination
678
+ * @returns The comparison representation, excluding image and duration readings
679
+ *
680
+ * @example
681
+ * ```ts
682
+ * describeCaptureDestination(destination) === describeCaptureDestination({ ...destination })
683
+ * // true
684
+ * ```
685
+ */
686
+ export declare function describeCaptureDestination(entry: CaptureDestination): string;
687
+
688
+ /**
689
+ * Describes a caught failure as one reportable line.
690
+ *
691
+ * @param error - The caught value, which need not be an `Error`
692
+ * @returns The error's message, or the value's string form
693
+ *
694
+ * @example
695
+ * ```ts
696
+ * describeCaptureError(new Error('Unknown variant: phone')) // 'Unknown variant: phone'
697
+ * describeCaptureError('refused') // 'refused'
698
+ * ```
699
+ */
700
+ export declare function describeCaptureError(error: unknown): string;
701
+
702
+ /**
703
+ * Serializes only the registry's execution and output identity, independent of input revisions.
704
+ *
705
+ * @param entry - The destination or inherited stamp
706
+ * @returns The identity used for relevant manifest agreement during state resolution
707
+ *
708
+ * @example
709
+ * ```ts
710
+ * describeCaptureIdentity(destination) === describeCaptureIdentity({
711
+ * ...destination,
712
+ * sources: { own: [], shared: [], tests: [] },
713
+ * })
714
+ * // true
715
+ * ```
716
+ */
717
+ export declare function describeCaptureIdentity(entry: CaptureDestination): string;
718
+
719
+ /**
720
+ * Serializes every request field, retaining the exact argv order.
721
+ *
722
+ * @param request - The transported request
723
+ * @returns The exact request comparison representation
724
+ *
725
+ * @example
726
+ * ```ts
727
+ * describeCaptureRequest(request) === describeCaptureRequest({ ...request, args: [] })
728
+ * // false when the request carried argv
729
+ * ```
730
+ */
731
+ export declare function describeCaptureRequest(request: CaptureRequest): string;
732
+
733
+ /**
734
+ * Checks whether a record names its journey artifact by portable path and SHA-256 digest.
735
+ *
736
+ * @param value - The decoded artifact reference
737
+ * @returns True if the reference has its supported shape; false otherwise
738
+ *
739
+ * @example
740
+ * ```ts
741
+ * isCaptureArtifact({ file: 'tmp/runs/a/light-390.txt', digest: 'a'.repeat(64) }) // true
742
+ * isCaptureArtifact({ file: '/abs.txt', digest: 'a'.repeat(64) }) // false
743
+ * ```
744
+ */
745
+ export declare function isCaptureArtifact(value: unknown): value is CaptureArtifact;
746
+
747
+ /**
748
+ * Checks a journey artifact's recorded sampling box.
749
+ *
750
+ * @param value - The recorded viewport box
751
+ * @returns True if its coordinates and dimensions are finite; false otherwise
752
+ *
753
+ * @example
754
+ * ```ts
755
+ * isCaptureBox({ x: 0, y: 64, width: 390, height: 780 }) // true
756
+ * isCaptureBox({ x: 0, y: 64, width: 0, height: 780 }) // false
757
+ * ```
758
+ */
759
+ export declare function isCaptureBox(value: unknown): value is CaptureBox;
760
+
761
+ /**
762
+ * Checks whether collection evidence pins complete input membership and both external artifacts.
763
+ *
764
+ * @param value - The collection receipt
765
+ * @returns True if every field has the supported shape; false otherwise
766
+ *
767
+ * @example
768
+ * ```ts
769
+ * isCaptureCollection(manifest.collections?.[0]) // true for a collection receipt
770
+ * isCaptureCollection({}) // false
771
+ * ```
772
+ */
773
+ export declare function isCaptureCollection(value: unknown): value is CaptureCollectionReceipt;
774
+
775
+ /**
776
+ * Checks whether a collected declaration preserves its full owner and state population.
777
+ *
778
+ * @param value - The declaration
779
+ * @returns True if the declaration has its supported shape; false otherwise
780
+ *
781
+ * @example
782
+ * ```ts
783
+ * isCaptureDeclaration({
784
+ * case: 'mail shows the inbox',
785
+ * owner: 'pages:mail',
786
+ * variant: 'light-390',
787
+ * eligible: true,
788
+ * states: ['inbox'],
789
+ * }) // true
790
+ * ```
791
+ */
792
+ export declare function isCaptureDeclaration(value: unknown): value is CaptureDeclaration;
793
+
794
+ /**
795
+ * Checks whether a destination supplies canonical identity and source attribution fields.
796
+ *
797
+ * @param value - The destination
798
+ * @returns True if the destination has its supported shape; false otherwise
799
+ *
800
+ * @example
801
+ * ```ts
802
+ * isCaptureDestination(JSON.parse(text)) // true for a registry destination row
803
+ * isCaptureDestination({}) // false
804
+ * ```
805
+ */
806
+ export declare function isCaptureDestination(value: unknown): value is CaptureDestination;
807
+
808
+ /**
809
+ * Checks whether a shared-source digest retains both patterns and expanded file hashes.
810
+ *
811
+ * @param value - The digest reading
812
+ * @returns True if the digest reading has its supported shape; false otherwise
813
+ *
814
+ * @example
815
+ * ```ts
816
+ * isCaptureDigest({ patterns: ['src/**'], files: {}, digest: 'a'.repeat(64) }) // true
817
+ * isCaptureDigest({ patterns: [], files: {} }) // false
818
+ * ```
819
+ */
820
+ export declare function isCaptureDigest(value: unknown): value is CaptureDigest;
821
+
822
+ /**
823
+ * Checks whether an emitted entry includes a finite nonnegative case duration.
824
+ *
825
+ * @param value - The emitted entry
826
+ * @returns True if the entry is valid; false otherwise
827
+ *
828
+ * @example
829
+ * ```ts
830
+ * isCaptureEntry({ ...destination, duration: 812 }) // true
831
+ * isCaptureEntry({ ...destination, duration: -1 }) // false
832
+ * ```
833
+ */
834
+ export declare function isCaptureEntry(value: unknown): value is CaptureEntry;
835
+
836
+ /**
837
+ * Checks whether an unknown value is a capture error.
838
+ *
839
+ * @remarks
840
+ * Recognition requires a native `Error` whose prototype is not `Error.prototype`, an own brand
841
+ * property holding the tested value itself, a declared condition code, and an object, callable, or absent
842
+ * context. It recognizes an error from another installed copy of this package, and refuses a
843
+ * look-alike with the same code and no brand, a proxy over a branded error, and a plain object
844
+ * that only carries the brand.
845
+ *
846
+ * @param value - The value to inspect
847
+ * @returns True if the value is a `CaptureError`; false otherwise
848
+ *
849
+ * @example
850
+ * ```ts
851
+ * isCaptureError(new CaptureError('Empty selection', { code: 'USAGE' })) // true
852
+ * isCaptureError(new Error('Empty selection')) // false
853
+ * ```
854
+ */
855
+ export declare function isCaptureError(value: unknown): value is CaptureError;
856
+
857
+ /**
858
+ * Checks the host's declared viewport without deriving geometry from an output name.
859
+ *
860
+ * @param value - The published viewport data
861
+ * @returns True if the named viewport has usable dimensions; false otherwise
862
+ *
863
+ * @example
864
+ * ```ts
865
+ * isCaptureGeometry({ name: 'light-390', width: 390, height: 844 }) // true
866
+ * isCaptureGeometry({ name: 'light-390', width: 0, height: 844 }) // false
867
+ * ```
868
+ */
869
+ export declare function isCaptureGeometry(value: unknown): value is CaptureViewport;
870
+
871
+ /**
872
+ * Checks whether a value is a SHA-256 hexadecimal digest.
873
+ *
874
+ * @param value - The digest
875
+ * @returns True if the digest has the expected hexadecimal width; false otherwise
876
+ *
877
+ * @example
878
+ * ```ts
879
+ * isCaptureHash('a'.repeat(64)) // true
880
+ * isCaptureHash('abc') // false
881
+ * ```
882
+ */
883
+ export declare function isCaptureHash(value: unknown): value is string;
884
+
885
+ /**
886
+ * Checks whether a file-hash map has portable keys and valid digests.
887
+ *
888
+ * @param value - The hash map
889
+ * @returns True if every key and digest is valid and no two keys differ only by case; false otherwise
890
+ *
891
+ * @example
892
+ * ```ts
893
+ * isCaptureHashes({ 'src/index.ts': 'a'.repeat(64) }) // true
894
+ * isCaptureHashes({ 'src/index.ts': 'x' }) // false
895
+ * ```
896
+ */
897
+ export declare function isCaptureHashes(value: unknown): value is Readonly<Record<string, string>>;
898
+
899
+ /**
900
+ * Checks whether an execution identity carries its required authorization fields.
901
+ *
902
+ * @param value - The identity
903
+ * @returns True if the identity is valid; false otherwise
904
+ *
905
+ * @example
906
+ * ```ts
907
+ * isCaptureIdentity({ id: 'run-1', stage: 'selected', pid: 4242, config: 'configs/journey.ts' }) // true
908
+ * isCaptureIdentity({ id: 'run-1', stage: 'selected', pid: 0, config: 'configs/journey.ts' }) // false
909
+ * ```
910
+ */
911
+ export declare function isCaptureIdentity(value: unknown): value is CaptureIdentity;
912
+
913
+ /**
914
+ * Checks whether a lookup binds a passing case to its full run record and input hashes.
915
+ *
916
+ * @param value - The lookup receipt
917
+ * @returns True if the receipt has its supported shape; false otherwise
918
+ *
919
+ * @example
920
+ * ```ts
921
+ * isCaptureLookup(JSON.parse(text)) // true for a lookup row
922
+ * isCaptureLookup(undefined) // false
923
+ * ```
924
+ */
925
+ export declare function isCaptureLookup(value: unknown): value is CaptureLookup;
926
+
927
+ /**
928
+ * Checks the separate lookup journal and its optional predecessor manifest digest.
929
+ *
930
+ * @param value - The decoded journal
931
+ * @returns True if the journal has its supported shape; false otherwise
932
+ * @remarks Input-map digests and reference existence are verified when the journal is read.
933
+ *
934
+ * @example
935
+ * ```ts
936
+ * isCaptureLookupJournal({ version: 1, inputs: {}, lookups: [] }) // true
937
+ * isCaptureLookupJournal({ version: 2, inputs: {}, lookups: [] }) // false
938
+ * ```
939
+ */
940
+ export declare function isCaptureLookupJournal(value: unknown): value is CaptureLookupJournal;
941
+
942
+ /**
943
+ * Checks whether an inherited manifest has the supported schema without discarding malformed rows.
944
+ *
945
+ * @param value - The manifest
946
+ * @returns True if every inherited member validates; false otherwise
947
+ *
948
+ * @example
949
+ * ```ts
950
+ * isCaptureManifest(JSON.parse(text)) // true for a published manifest.json
951
+ * isCaptureManifest('manifest') // false
952
+ * ```
953
+ */
954
+ export declare function isCaptureManifest(value: unknown): value is CaptureManifest;
955
+
956
+ /**
957
+ * Checks whether a serialized path stays within the portable relative-path vocabulary.
958
+ *
959
+ * @param value - The serialized file or directory path
960
+ * @returns True if every segment is portable and relative; false otherwise
961
+ *
962
+ * @example
963
+ * ```ts
964
+ * isCapturePath('tmp/captures/states/pages/mail--inbox.png') // true
965
+ * isCapturePath('../escape.png') // false
966
+ * ```
967
+ */
968
+ export declare function isCapturePath(value: unknown): value is string;
969
+
970
+ /**
971
+ * Checks whether a native glob declaration uses relative portable path segments.
972
+ *
973
+ * @param value - A source attribution pattern
974
+ * @returns True if the pattern has no path traversal or host-specific spelling; false otherwise
975
+ *
976
+ * @example
977
+ * ```ts
978
+ * isCapturePattern('src/**') // true
979
+ * isCapturePattern('src\\**') // false
980
+ * ```
981
+ */
982
+ export declare function isCapturePattern(value: unknown): value is string;
983
+
984
+ /**
985
+ * Checks whether a complete-run receipt binds the report, inputs, and declaration registry.
986
+ *
987
+ * @param value - The receipt
988
+ * @returns True if the receipt has its supported shape; false otherwise
989
+ *
990
+ * @example
991
+ * ```ts
992
+ * isCaptureReceipt(JSON.parse(text)) // true for a complete-run receipt
993
+ * isCaptureReceipt({}) // false
994
+ * ```
995
+ */
996
+ export declare function isCaptureReceipt(value: unknown): value is CaptureReceipt;
997
+
998
+ /**
999
+ * Checks whether a registry document retains its receipts and required output pairs.
1000
+ *
1001
+ * @param value - The registry document
1002
+ * @returns True if the registry has the supported shape; false otherwise
1003
+ *
1004
+ * @example
1005
+ * ```ts
1006
+ * isCaptureRegistry(JSON.parse(text)) // true for a published registry.json
1007
+ * isCaptureRegistry([]) // false
1008
+ * ```
1009
+ */
1010
+ export declare function isCaptureRegistry(value: unknown): value is CaptureRegistry;
1011
+
1012
+ /**
1013
+ * Checks whether a request has the supported version and complete execution identity.
1014
+ *
1015
+ * @param value - The transported request
1016
+ * @returns True if every request field has its protocol shape; false otherwise
1017
+ *
1018
+ * @example
1019
+ * ```ts
1020
+ * isCaptureRequest(JSON.parse(text)) // true for a well-formed runner request
1021
+ * isCaptureRequest({ version: 2 }) // false
1022
+ * ```
1023
+ */
1024
+ export declare function isCaptureRequest(value: unknown): value is CaptureRequest;
1025
+
1026
+ /**
1027
+ * Checks whether a final record preserves declarations, observations, and output separately.
1028
+ *
1029
+ * @param value - The decoded run record
1030
+ * @returns True if the record has the supported protocol shape; false otherwise
1031
+ *
1032
+ * @example
1033
+ * ```ts
1034
+ * isCaptureRun(JSON.parse(text)) // true for a final run record
1035
+ * isCaptureRun(null) // false
1036
+ * ```
1037
+ */
1038
+ export declare function isCaptureRun(value: unknown): value is CaptureRun;
1039
+
1040
+ /**
1041
+ * Checks whether a protocol identity can occupy one portable path segment.
1042
+ *
1043
+ * @param value - The identity segment
1044
+ * @returns True if the segment is safe and nonempty; false otherwise
1045
+ *
1046
+ * @example
1047
+ * ```ts
1048
+ * isCaptureSegment('light-390') // true
1049
+ * isCaptureSegment('light 390') // false
1050
+ * ```
1051
+ */
1052
+ export declare function isCaptureSegment(value: unknown): value is string;
1053
+
1054
+ /**
1055
+ * Checks whether an owner selector uses canonical colon-separated segments.
1056
+ *
1057
+ * @param value - The owner selector
1058
+ * @returns True if every owner segment is canonical; false otherwise
1059
+ *
1060
+ * @example
1061
+ * ```ts
1062
+ * isCaptureSelector('pages:mail') // true
1063
+ * isCaptureSelector('pages::mail') // false
1064
+ * ```
1065
+ */
1066
+ export declare function isCaptureSelector(value: unknown): value is string;
1067
+
1068
+ /**
1069
+ * Checks whether source attribution separates own, shared, and behavioral patterns.
1070
+ *
1071
+ * @param value - The attribution
1072
+ * @returns True if every declared pattern is valid; false otherwise
1073
+ *
1074
+ * @example
1075
+ * ```ts
1076
+ * isCaptureSources({ own: ['src/mail/**'], shared: [], tests: [] }) // true
1077
+ * isCaptureSources({ own: ['../x'], shared: [], tests: [] }) // false
1078
+ * ```
1079
+ */
1080
+ export declare function isCaptureSources(value: unknown): value is CaptureSources;
1081
+
1082
+ /**
1083
+ * Checks whether a stamp binds an emitted image to source and execution provenance.
1084
+ *
1085
+ * @param value - The stamp
1086
+ * @returns True if the stamp has its supported shape; false otherwise
1087
+ *
1088
+ * @example
1089
+ * ```ts
1090
+ * isCaptureStamp(manifest.entries['pages/mail--inbox.png']) // true for a stamped frame
1091
+ * isCaptureStamp({}) // false
1092
+ * ```
1093
+ */
1094
+ export declare function isCaptureStamp(value: unknown): value is CaptureStamp;
1095
+
1096
+ /**
1097
+ * Checks optional collection metadata without upgrading historical image evidence.
1098
+ *
1099
+ * @param value - The inherited image transaction
1100
+ * @returns True if its existing manifest and any collection receipts are valid; false otherwise
1101
+ *
1102
+ * @example
1103
+ * ```ts
1104
+ * isCaptureStoredManifest(JSON.parse(text)) // true for a manifest with or without collections
1105
+ * isCaptureStoredManifest(null) // false
1106
+ * ```
1107
+ */
1108
+ export declare function isCaptureStoredManifest(value: unknown): value is CaptureStoredManifest;
1109
+
1110
+ /**
1111
+ * Compares complete populations without erasing duplicates.
1112
+ *
1113
+ * @param left - The first population
1114
+ * @param right - The second population
1115
+ * @returns True if the sorted populations are equal; false otherwise
1116
+ *
1117
+ * @example
1118
+ * ```ts
1119
+ * matchesCaptureMembers(['b', 'a'], ['a', 'b']) // true
1120
+ * matchesCaptureMembers(['a', 'a'], ['a']) // false
1121
+ * ```
1122
+ */
1123
+ export declare function matchesCaptureMembers(left: readonly string[], right: readonly string[]): boolean;
1124
+
1125
+ /**
1126
+ * Compares an owner with an explicit selector at colon boundaries.
1127
+ *
1128
+ * @param owner - The canonical owner
1129
+ * @param selector - The requested owner or the `all` selector
1130
+ * @returns True if the owner belongs to the selection; false otherwise
1131
+ *
1132
+ * @example
1133
+ * ```ts
1134
+ * matchesCaptureSelector('pages:mail', 'pages') // true
1135
+ * matchesCaptureSelector('pages:mailbox', 'pages:mail') // false
1136
+ * ```
1137
+ */
1138
+ export declare function matchesCaptureSelector(owner: string, selector: string): boolean;
1139
+
1140
+ /**
1141
+ * Reads Git's NUL-delimited porcelain paths without treating spaces or quoted names as separators.
1142
+ *
1143
+ * @param output - The exact `status --porcelain=v1 -z` output
1144
+ * @returns Dirty repository-relative paths, including both sides of renames, sorted without repeats
1145
+ * @throws Thrown as an `EVIDENCE` capture error when a rename or copy record has no original path.
1146
+ *
1147
+ * @example
1148
+ * ```ts
1149
+ * readCaptureDirty(' M src/a.ts\0R src/b.ts\0src/c.ts\0') // ['src/a.ts', 'src/b.ts', 'src/c.ts']
1150
+ * ```
1151
+ */
1152
+ export declare function readCaptureDirty(output: string): readonly string[];
1153
+
1154
+ /**
1155
+ * Reads successful Vitest JSON output and validates every owner-bearing assertion.
1156
+ *
1157
+ * @param value - The parsed external reporter document
1158
+ * @returns A validated projection of the fields used by integrity
1159
+ * @throws Thrown as an `EVIDENCE` capture error for failed reporters, malformed assertions, or duplicate case identities.
1160
+ *
1161
+ * @example
1162
+ * ```ts
1163
+ * const report = readCaptureReport(parseJSON(text))
1164
+ * report.assertions.map((assertion) => assertion.case)
1165
+ * ```
1166
+ */
1167
+ export declare function readCaptureReport(value: unknown): CaptureReport;
1168
+
1169
+ /**
1170
+ * Refuses duplicate declarations or portable storage-key collisions before indexing.
1171
+ *
1172
+ * @param values - The complete identity population
1173
+ * @param label - The diagnostic subject
1174
+ * @param folded - If `true`, refuses case-colliding keys; if `false`, requires exact uniqueness. Default: `false`
1175
+ * @throws Thrown as an `EVIDENCE` capture error when an identity repeats.
1176
+ *
1177
+ * @example
1178
+ * ```ts
1179
+ * requireCaptureUnique(['mail', 'files'], 'owners') // returns
1180
+ * requireCaptureUnique(['mail', 'mail'], 'owners') // throws 'Duplicate owners: mail, mail'
1181
+ * ```
1182
+ */
1183
+ export declare function requireCaptureUnique(values: readonly string[], label: string, folded?: boolean): void;
1184
+
1185
+ /**
1186
+ * Builds a manifest identity independently of the physical image path.
1187
+ *
1188
+ * @param entry - The registry destination
1189
+ * @returns The scope-qualified state and output-variant key
1190
+ *
1191
+ * @example
1192
+ * ```ts
1193
+ * resolveCaptureKey({ ...destination, scope: 'pages', state: 'inbox', variant: 'light-390' })
1194
+ * // 'pages/inbox--light-390.png'
1195
+ * ```
1196
+ */
1197
+ export declare function resolveCaptureKey(entry: CaptureDestination): string;
1198
+
1199
+ /**
1200
+ * Builds the canonical owner from a destination's registry identity.
1201
+ *
1202
+ * @param entry - The destination
1203
+ * @returns The scope, part, and optional section selector
1204
+ *
1205
+ * @example
1206
+ * ```ts
1207
+ * resolveCaptureOwner({ ...destination, scope: 'pages', part: 'mail' }) // 'pages:mail'
1208
+ * ```
1209
+ */
1210
+ export declare function resolveCaptureOwner(entry: CaptureDestination): string;
1211
+
1212
+ /**
1213
+ * Chooses the primary classification while retaining all findings separately.
1214
+ *
1215
+ * @param statuses - Every classification justified by the reading
1216
+ * @returns The highest-precedence classification, or `current` when none applies
1217
+ *
1218
+ * @example
1219
+ * ```ts
1220
+ * resolveCaptureStatus(['stale-own', 'missing']) // 'missing'
1221
+ * resolveCaptureStatus([]) // 'current'
1222
+ * ```
1223
+ */
1224
+ export declare function resolveCaptureStatus(statuses: readonly CaptureStatus[]): CaptureStatus;
1225
+
1226
+ /**
1227
+ * Builds the stable case identity used to merge separate lookup receipts.
1228
+ *
1229
+ * @param lookup - The lookup identity
1230
+ * @returns The producing variant and full case key
1231
+ *
1232
+ * @example
1233
+ * ```ts
1234
+ * resolveLookupKey({ variant: 'light-390', case: 'mail shows the inbox' })
1235
+ * // '["light-390","mail shows the inbox"]'
1236
+ * ```
1237
+ */
1238
+ export declare function resolveLookupKey(lookup: Pick<CaptureLookup, 'variant' | 'case'>): string;
1239
+
1240
+ /**
1241
+ * Validates a complete receipt against full reporter declarations and eligible output coverage.
1242
+ *
1243
+ * @param receipt - The retained complete-run receipt
1244
+ * @param report - The authenticated reporter projection
1245
+ * @throws Thrown as an `EVIDENCE` capture error when the receipt omits, invents, or changes a collected declaration or output.
1246
+ *
1247
+ * @example
1248
+ * ```ts
1249
+ * validateCaptureReceipt(receipt, readCaptureReport(parseJSON(text)))
1250
+ * ```
1251
+ */
1252
+ export declare function validateCaptureReceipt(receipt: CaptureReceipt, report: CaptureReport): void;
1253
+
1254
+ /**
1255
+ * Validates declaration, reporter, observation, completeness, and output-projection agreement.
1256
+ *
1257
+ * @param run - The final record
1258
+ * @param report - The validated external reporter
1259
+ * @param project - The actual producing project name
1260
+ * @throws Thrown as an `EVIDENCE` capture error when a record differs from the actual selected results or declarations.
1261
+ *
1262
+ * @example
1263
+ * ```ts
1264
+ * validateCaptureRun(run, readCaptureReport(parseJSON(text)), 'journey:light-390')
1265
+ * ```
1266
+ */
1267
+ export declare function validateCaptureRun(run: CaptureRun, report: CaptureReport, project: string): void;
1268
+
1269
+ export { }