@orkestrel/capture 0.0.0-stage → 0.0.1

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,3951 @@
1
+ import type { CaptureCollectionReceipt } from '@orkestrel/capture';
2
+ import type { CaptureDeclaration } from '@orkestrel/capture';
3
+ import type { CaptureDestination } from '@orkestrel/capture';
4
+ import type { CaptureDigest } from '@orkestrel/capture';
5
+ import { CaptureError } from '@orkestrel/capture';
6
+ import type { CaptureFreshness } from '@orkestrel/capture';
7
+ import type { CaptureLookup } from '@orkestrel/capture';
8
+ import type { CaptureLookupJournal } from '@orkestrel/capture';
9
+ import type { CaptureReceipt } from '@orkestrel/capture';
10
+ import type { CaptureRegistry } from '@orkestrel/capture';
11
+ import type { CaptureRequest } from '@orkestrel/capture';
12
+ import type { CaptureRun } from '@orkestrel/capture';
13
+ import type { CaptureSelection } from '@orkestrel/capture';
14
+ import type { CaptureStamp } from '@orkestrel/capture';
15
+ import type { CaptureStoredManifest } from '@orkestrel/capture';
16
+ import type { CaptureViewport } from '@orkestrel/capture';
17
+ import type { CaptureWarning } from '@orkestrel/capture';
18
+ import type { parseArgs } from 'node:util';
19
+ import type { ParseArgsOptionsConfig } from 'node:util';
20
+ import type { SessionInterface } from '@orkestrel/process';
21
+
22
+ /**
23
+ * Answers the runner's discovery request from the wrapper, before the wrapper does any other work.
24
+ *
25
+ * @remarks
26
+ * The wrapper calls it once, ahead of anything that sets up a browser, initializes an output
27
+ * directory, or collects a test, and returns `buildCaptureDiscoveryConfig()` when it answered. It
28
+ * reads only the request file its parent process wrote and answers `false` when there is none, or
29
+ * when the file is no discovery request, so an execution child falls through to `readCaptureRequest`.
30
+ * A discovery request is accepted only from its own parent with the exact arguments it recorded, the
31
+ * wrapper path it names, and an identity and challenge that are portable segments. The wrapper
32
+ * describes every project from its own declarations and writes one description, atomically, to the
33
+ * invocation directory; a second answer from another process is refused as a replay, while the same
34
+ * process may answer again if Vitest loads its configuration twice.
35
+ *
36
+ * @param options - The parent id, the process arguments, the request directory, the wrapper path, and the wrapper's `test.projects`
37
+ * @returns True once the description is written; false when the request is no discovery request
38
+ * @throws Thrown as a `HOST` capture error for a discovery request that fails any check or a
39
+ * replayed answer. It does not judge the projects: the runner reads and refuses a malformed one.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const answered = await answerCaptureDiscovery({
44
+ * ppid: process.ppid,
45
+ * argv: process.argv.slice(1),
46
+ * config: 'configs/vite.journey.config.ts',
47
+ * projects,
48
+ * })
49
+ * ```
50
+ */
51
+ export declare function answerCaptureDiscovery(options: CaptureDiscoveryOptions): Promise<boolean>;
52
+
53
+ /**
54
+ * Builds the exact Node argument array that spawns one Vitest stage.
55
+ *
56
+ * @remarks
57
+ * Each value is its own array element, so no shell quoting applies and a case name keeps its
58
+ * spaces and quotes. An exact case adds `-t` with the anchored pattern for that case and the
59
+ * final case, so the final case still writes the run record.
60
+ *
61
+ * @param options - The entry, wrapper, report, projects, tag filter, and optional exact case and mode
62
+ * @returns The arguments after the Node executable
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const args = buildCaptureArguments({
67
+ * entry: '/repo/node_modules/vitest/vitest.mjs',
68
+ * config: '/repo/vite.journey.config.ts',
69
+ * report: '/repo/tmp/units/runs/a/journey-selected.json',
70
+ * projects: ['journey:light-390'],
71
+ * filter: 'owner:pages:mail',
72
+ * final: 'closes the run',
73
+ * })
74
+ * args.includes('--bail=1') // true
75
+ * ```
76
+ */
77
+ export declare function buildCaptureArguments(options: CaptureArgumentsOptions): readonly string[];
78
+
79
+ /**
80
+ * Classifies changed paths through accepted patterns and reduces owners by ancestry.
81
+ *
82
+ * @param paths - Git paths, including removed paths that no longer exist
83
+ * @param entries - The authenticated accepted registry destinations
84
+ * @returns Sorted path classifications and sorted minimal owners; shared patterns take precedence
85
+ * @example
86
+ * ```ts
87
+ * buildCaptureChangePlan(['README.md'], []).changes
88
+ * // [{ path: 'README.md', classification: 'outside', owners: [] }]
89
+ * ```
90
+ */
91
+ export declare function buildCaptureChangePlan(paths: readonly string[], entries: readonly CaptureDestination[]): CaptureChangePlan;
92
+
93
+ /**
94
+ * Computes the digest of both pattern declarations and expanded path and hash membership.
95
+ *
96
+ * @param patterns - The supplied native glob patterns
97
+ * @param files - The expanded file hashes
98
+ * @returns A deterministic digest retaining the original evidence populations
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * buildCaptureDigest(['src/**'], { 'src/a.ts': 'f'.repeat(64) }).patterns // ['src/**']
103
+ * ```
104
+ */
105
+ export declare function buildCaptureDigest(patterns: readonly string[], files: Readonly<Record<string, string>>): CaptureDigest;
106
+
107
+ /**
108
+ * Builds the empty Node configuration a wrapper returns once it has answered a discovery request.
109
+ *
110
+ * @remarks
111
+ * It carries no project, no setup file, and no include pattern, so Vitest collects no test, starts
112
+ * no browser, and initializes no output for a discovery child.
113
+ *
114
+ * @returns A fresh configuration object
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * export default (await answerCaptureDiscovery(options)) ? buildCaptureDiscoveryConfig() : config
119
+ * ```
120
+ */
121
+ export declare function buildCaptureDiscoveryConfig(): {
122
+ readonly test: {
123
+ readonly include: string[];
124
+ readonly passWithNoTests: boolean;
125
+ readonly watch: boolean;
126
+ };
127
+ };
128
+
129
+ /**
130
+ * Builds the tag expression that selects an owner population, and its capture tags for frames.
131
+ *
132
+ * @remarks
133
+ * A journey selects `owner:<selector>`. A capture intersects that with the capture tag the
134
+ * selector names, which is its scope and part: the first two segments. The `all` selector unions
135
+ * every declared scope. Colons stay part of a tag name.
136
+ *
137
+ * @param command - The runner command
138
+ * @param selector - The requested owner path or `all`
139
+ * @param selectors - Every owner path the wrapper declares, without the `owner:` prefix
140
+ * @returns The expression for `--tags-filter`
141
+ *
142
+ * @example
143
+ * ```ts
144
+ * buildCaptureFilter('journey', 'pages:mail', ['pages', 'pages:mail']) // 'owner:pages:mail'
145
+ * buildCaptureFilter('capture', 'pages:mail', ['pages', 'pages:mail']) // 'owner:pages:mail && pages:mail'
146
+ * ```
147
+ */
148
+ export declare function buildCaptureFilter(command: CaptureCommand, selector: string, selectors: readonly string[]): string;
149
+
150
+ /**
151
+ * Derives the integrity engine's options from a wrapper project's host declarations.
152
+ *
153
+ * @remarks
154
+ * Without `standalone` the engine reads the project's primary directory and every portfolio root the
155
+ * project authorizes. With one, the engine reads that root alone, keeping its registry, manifest, and
156
+ * lookups beside its own directory.
157
+ *
158
+ * @param root - The absolute workspace path
159
+ * @param project - The wrapper project whose declarations the engine adopts
160
+ * @param standalone - The standalone root to read through, when a selection names one
161
+ * @returns The options the engine is constructed with
162
+ * @throws Thrown as a `HOST` capture error when the directory leaves the repository.
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * buildCaptureIntegrityOptions(root, project).manifest // 'tmp/captures/states/manifest.json'
167
+ * ```
168
+ */
169
+ export declare function buildCaptureIntegrityOptions(root: string, project: CaptureProject, standalone?: CapturePortfolioRoot): CaptureIntegrityOptions;
170
+
171
+ /**
172
+ * Stores each distinct lookup input population once in a manifest-bound journal.
173
+ *
174
+ * @param lookups - The expanded passing case evidence to publish
175
+ * @param collections - The independently authenticated collection receipts
176
+ * @param manifest - The predecessor manifest digest, absent before the first capture
177
+ * @returns The journal with content-addressed input maps and ordered lookup references
178
+ *
179
+ * @example
180
+ * ```ts
181
+ * buildCaptureLookupJournal([], []).inputs // {}
182
+ * ```
183
+ */
184
+ export declare function buildCaptureLookupJournal(lookups: readonly CaptureLookup[], collections: readonly CaptureCollectionReceipt[], manifest?: string): CaptureLookupJournal;
185
+
186
+ /**
187
+ * Imports complete receipts only after their actual exits and exact report bytes validate.
188
+ *
189
+ * @param inputs - Verifier-owned reporter bytes, receipt declarations, and process outcomes
190
+ * @returns The registry document to publish through the verifier's owned evidence path
191
+ * @throws Thrown for caps, signals, unsuccessful exits, altered reports, or incomplete coverage.
192
+ * @remarks This pure importer starts no process and changes no retained receipt or manifest.
193
+ *
194
+ * @example
195
+ * ```ts
196
+ * const registry = buildCaptureRegistry([{ receipt, report: text, outcome: { code: 0, signal: null }, capped: false }])
197
+ * registry.digest.length // 64
198
+ * ```
199
+ */
200
+ export declare function buildCaptureRegistry(inputs: readonly CaptureReceiptInput[]): CaptureRegistry;
201
+
202
+ /**
203
+ * Builds the refusal a wrapper raises for a request file it cannot accept as its parent's.
204
+ *
205
+ * @param file - The absolute request path, named in the message
206
+ * @param cause - The underlying failure, when there is one
207
+ * @returns A `HOST` capture error naming the file
208
+ *
209
+ * @example
210
+ * ```ts
211
+ * buildCaptureRequestRefusal('/repo/tmp/units/journey-selection-4242.json').message
212
+ * // 'Invalid journey selection request: /repo/tmp/units/journey-selection-4242.json'
213
+ * ```
214
+ */
215
+ export declare function buildCaptureRequestRefusal(file: string, cause?: unknown): CaptureError;
216
+
217
+ /**
218
+ * Names the executable subcommand each runner command answers to.
219
+ *
220
+ * @remarks
221
+ * The frame-placing command is `capture` in the request protocol and `frames` on the command line,
222
+ * because `capture capture` would stutter. The usage text prints the command-line name.
223
+ *
224
+ * @example
225
+ * ```ts
226
+ * CAPTURE_COMMAND_NAMES.capture // 'frames'
227
+ * ```
228
+ */
229
+ export declare const CAPTURE_COMMAND_NAMES: Readonly<{
230
+ readonly journey: "journey";
231
+ readonly capture: "frames";
232
+ readonly stale: "stale";
233
+ }>;
234
+
235
+ /**
236
+ * Defines each command's frozen options for Node's standard argument parser.
237
+ *
238
+ * @example
239
+ * ```ts
240
+ * CAPTURE_COMMAND_OPTIONS.journey.variant.multiple // true
241
+ * ```
242
+ */
243
+ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
244
+ readonly journey: Readonly<{
245
+ config: Readonly<{
246
+ type: "string";
247
+ }>;
248
+ variant: Readonly<{
249
+ type: "string";
250
+ multiple: true;
251
+ }>;
252
+ case: Readonly<{
253
+ type: "string";
254
+ }>;
255
+ changed: Readonly<{
256
+ type: "string";
257
+ }>;
258
+ plan: Readonly<{
259
+ type: "boolean";
260
+ }>;
261
+ }>;
262
+ readonly capture: Readonly<{
263
+ config: Readonly<{
264
+ type: "string";
265
+ }>;
266
+ variant: Readonly<{
267
+ type: "string";
268
+ multiple: true;
269
+ }>;
270
+ case: Readonly<{
271
+ type: "string";
272
+ }>;
273
+ state: Readonly<{
274
+ type: "string";
275
+ }>;
276
+ changed: Readonly<{
277
+ type: "string";
278
+ }>;
279
+ plan: Readonly<{
280
+ type: "boolean";
281
+ }>;
282
+ }>;
283
+ readonly stale: Readonly<{
284
+ config: Readonly<{
285
+ type: "string";
286
+ }>;
287
+ variant: Readonly<{
288
+ type: "string";
289
+ multiple: true;
290
+ }>;
291
+ case: Readonly<{
292
+ type: "string";
293
+ }>;
294
+ state: Readonly<{
295
+ type: "string";
296
+ }>;
297
+ portfolio: Readonly<{
298
+ type: "string";
299
+ }>;
300
+ }>;
301
+ readonly preflight: Readonly<{
302
+ variant: Readonly<{
303
+ type: "string";
304
+ multiple: true;
305
+ }>;
306
+ state: Readonly<{
307
+ type: "string";
308
+ }>;
309
+ case: Readonly<{
310
+ type: "string";
311
+ }>;
312
+ portfolio: Readonly<{
313
+ type: "string";
314
+ }>;
315
+ config: Readonly<{
316
+ type: "string";
317
+ }>;
318
+ journeys: Readonly<{
319
+ type: "string";
320
+ }>;
321
+ checks: Readonly<{
322
+ type: "string";
323
+ }>;
324
+ }>;
325
+ readonly sheets: Readonly<{
326
+ variant: Readonly<{
327
+ type: "string";
328
+ multiple: true;
329
+ }>;
330
+ state: Readonly<{
331
+ type: "string";
332
+ }>;
333
+ case: Readonly<{
334
+ type: "string";
335
+ }>;
336
+ portfolio: Readonly<{
337
+ type: "string";
338
+ }>;
339
+ config: Readonly<{
340
+ type: "string";
341
+ }>;
342
+ journeys: Readonly<{
343
+ type: "string";
344
+ }>;
345
+ checks: Readonly<{
346
+ type: "string";
347
+ }>;
348
+ output: Readonly<{
349
+ type: "string";
350
+ }>;
351
+ }>;
352
+ readonly registry: Readonly<{
353
+ variant: Readonly<{
354
+ type: "string";
355
+ multiple: true;
356
+ }>;
357
+ config: Readonly<{
358
+ type: "string";
359
+ }>;
360
+ mode: Readonly<{
361
+ type: "string";
362
+ }>;
363
+ }>;
364
+ }>;
365
+
366
+ /**
367
+ * Holds the repository-relative paths the executable falls back to when the command line names none.
368
+ *
369
+ * @remarks
370
+ * `config` is the journey wrapper a scaffold-born browser application carries, `requests` is the
371
+ * one default directory the runner publishes its request file to, and `journeys` is the directory
372
+ * of journey artifacts the readers read. The runner hands the directory it uses to every child in
373
+ * `CAPTURE_REQUESTS`, and `readCaptureRequest` and `answerCaptureDiscovery` read it from there when
374
+ * the wrapper names none, so a wrapper never repeats this value. `--config` replaces the wrapper
375
+ * and `--journeys` the artifacts.
376
+ *
377
+ * @example
378
+ * ```ts
379
+ * CAPTURE_DEFAULTS.config // 'configs/app/vite.journey.config.ts'
380
+ * ```
381
+ */
382
+ export declare const CAPTURE_DEFAULTS: Readonly<{
383
+ readonly config: "configs/app/vite.journey.config.ts";
384
+ readonly requests: "tmp/capture";
385
+ readonly journeys: "tmp/journey";
386
+ }>;
387
+
388
+ /**
389
+ * Holds the discovery exchange's fixed names and bound.
390
+ *
391
+ * @remarks
392
+ * `phase` is the value that marks a request as a discovery request, `description` is the file the
393
+ * wrapper writes inside the invocation directory, `arguments` are the Vitest arguments that list the
394
+ * configuration's test files without collecting a test, `deadline` is the longest, in milliseconds,
395
+ * the discovery child may run.
396
+ *
397
+ * @example
398
+ * ```ts
399
+ * CAPTURE_DISCOVERY.phase // 'discover'
400
+ * ```
401
+ */
402
+ export declare const CAPTURE_DISCOVERY: Readonly<{
403
+ readonly phase: "discover";
404
+ readonly description: "description.json";
405
+ readonly arguments: readonly string[];
406
+ readonly deadline: 60000;
407
+ }>;
408
+
409
+ /**
410
+ * Holds the exit status each runner outcome maps to.
411
+ *
412
+ * @remarks `passed` is every stage green with work run, `failed` is a failed stage or an empty
413
+ * workload, and `usage` is a refused command line or selection.
414
+ *
415
+ * @example
416
+ * ```ts
417
+ * CAPTURE_EXIT.usage // 64
418
+ * ```
419
+ */
420
+ export declare const CAPTURE_EXIT: Readonly<{
421
+ readonly passed: 0;
422
+ readonly failed: 1;
423
+ readonly usage: 64;
424
+ }>;
425
+
426
+ /**
427
+ * Names the environment variable that turns frame capture on for a Vitest child.
428
+ *
429
+ * @example
430
+ * ```ts
431
+ * process.env[CAPTURE_FLAG] = CAPTURE_FLAG_VALUE
432
+ * ```
433
+ */
434
+ export declare const CAPTURE_FLAG = "CAPTURE";
435
+
436
+ /**
437
+ * Holds the one value of the capture variable that turns frame capture on.
438
+ *
439
+ * @example
440
+ * ```ts
441
+ * CAPTURE_FLAG_VALUE // '1'
442
+ * ```
443
+ */
444
+ export declare const CAPTURE_FLAG_VALUE = "1";
445
+
446
+ /**
447
+ * Bounds external diagnostic text while retaining the number of omitted characters.
448
+ * @example
449
+ * ```ts
450
+ * CAPTURE_MESSAGE_LIMIT // 1024
451
+ * ```
452
+ */
453
+ export declare const CAPTURE_MESSAGE_LIMIT = 1024;
454
+
455
+ /**
456
+ * Holds the byte count under which an image is too small to be a real frame.
457
+ *
458
+ * @example
459
+ * ```ts
460
+ * bytes.length < CAPTURE_MINIMUM_IMAGE // true for a blank placeholder
461
+ * ```
462
+ */
463
+ export declare const CAPTURE_MINIMUM_IMAGE = 4000;
464
+
465
+ /** Yields between ownership probes in milliseconds so filesystem contention can settle.
466
+ * @example
467
+ * ```ts
468
+ * CAPTURE_OWNER_BACKOFF // 10
469
+ * ```
470
+ */
471
+ export declare const CAPTURE_OWNER_BACKOFF = 10;
472
+
473
+ /**
474
+ * Names the exclusive workspace invocation marker.
475
+ * @example
476
+ * ```ts
477
+ * CAPTURE_OWNER_FILE // '.capture-owner'
478
+ * ```
479
+ */
480
+ export declare const CAPTURE_OWNER_FILE = ".capture-owner";
481
+
482
+ /**
483
+ * Names the tag prefix that marks a case's owner path and each ancestor of it.
484
+ *
485
+ * @example
486
+ * ```ts
487
+ * `${CAPTURE_OWNER_PREFIX}pages:mail` // 'owner:pages:mail'
488
+ * ```
489
+ */
490
+ export declare const CAPTURE_OWNER_PREFIX = "owner:";
491
+
492
+ /** Bounds a synchronous ownership retry sequence in milliseconds, including host contention.
493
+ * @example
494
+ * ```ts
495
+ * CAPTURE_OWNER_TIMEOUT // 1000
496
+ * ```
497
+ */
498
+ export declare const CAPTURE_OWNER_TIMEOUT = 1000;
499
+
500
+ /**
501
+ * Bounds decoded image memory, row metadata, and PNG input bytes independently of untrusted headers.
502
+ *
503
+ * @remarks The pixel budget admits the fleet's 2880 × 6000 and 1170 × 15000 Chromium full-page
504
+ * frames with 19.5% margin over 17,550,000 pixels. The byte budget adds 20% to the largest RGBA
505
+ * scanlines for deflate overhead, chunk framing, and metadata, before any read or compressed copy.
506
+ * A valid 1 × 1 PNG padded to the derived byte boundary peaked at 171 MiB process RSS.
507
+ * Isolated Windows Node runs on 2026-10-28 measured the fixture peaks noted beside each bound;
508
+ * these measurements are not a universal process RSS ceiling.
509
+ * @example
510
+ * ```ts
511
+ * CAPTURE_PNG_LIMITS.pixels // 20971520
512
+ * ```
513
+ */
514
+ export declare const CAPTURE_PNG_LIMITS: Readonly<{
515
+ readonly pixels: number;
516
+ readonly side: 131072;
517
+ readonly bytes: number;
518
+ }>;
519
+
520
+ /**
521
+ * Caps each refusal population so hostile records cannot flood a terminal or agent context.
522
+ * @example
523
+ * ```ts
524
+ * CAPTURE_REFUSAL_LIMIT // 16
525
+ * ```
526
+ */
527
+ export declare const CAPTURE_REFUSAL_LIMIT = 16;
528
+
529
+ /**
530
+ * Names the first word of the line the registry refresh prints, followed by its JSON summary.
531
+ *
532
+ * @example
533
+ * ```ts
534
+ * `${CAPTURE_REGISTRY_LINE} ${JSON.stringify(summary)}\n`
535
+ * ```
536
+ */
537
+ export declare const CAPTURE_REGISTRY_LINE = "REGISTRY";
538
+
539
+ /**
540
+ * Names the stage each producing variant's complete journey runs in, ahead of the variant's name.
541
+ *
542
+ * @example
543
+ * ```ts
544
+ * `${CAPTURE_REGISTRY_STAGE}-light-390` // 'registry-light-390'
545
+ * ```
546
+ */
547
+ export declare const CAPTURE_REGISTRY_STAGE = "registry";
548
+
549
+ /**
550
+ * Names the first word of the line a reader prints, followed by its JSON report.
551
+ *
552
+ * @example
553
+ * ```ts
554
+ * `${CAPTURE_REPORT_LINES.preflight} ${JSON.stringify(report)}\n`
555
+ * ```
556
+ */
557
+ export declare const CAPTURE_REPORT_LINES: Readonly<{
558
+ readonly preflight: "READER";
559
+ readonly sheets: "SHEETS";
560
+ }>;
561
+
562
+ /**
563
+ * Names the environment variable that carries the absolute request directory to a Vitest child.
564
+ *
565
+ * @remarks
566
+ * The runner sets it on every child it spawns, the discovery child included. A wrapper that names no
567
+ * request directory reads it, so the runner and the wrapper agree without a repeated constant.
568
+ *
569
+ * @example
570
+ * ```ts
571
+ * process.env[CAPTURE_REQUESTS_FLAG] // '/repo/tmp/capture' inside a runner's child
572
+ * ```
573
+ */
574
+ export declare const CAPTURE_REQUESTS_FLAG = "CAPTURE_REQUESTS";
575
+
576
+ /**
577
+ * Names the directory beneath a portfolio or request directory that holds one invocation's records.
578
+ *
579
+ * @example
580
+ * ```ts
581
+ * `tmp/captures/states/${CAPTURE_RUNS_DIRECTORY}/a/narrow/light-390.json`
582
+ * ```
583
+ */
584
+ export declare const CAPTURE_RUNS_DIRECTORY = "runs";
585
+
586
+ /**
587
+ * Holds the contact-sheet geometry: how wide a cell shrinks toward, how tall it may grow, the mark
588
+ * that stands in for an unreadable image, the gap between neighbors, and how many cells, rows, and
589
+ * pairs a row and a sheet hold.
590
+ *
591
+ * @example
592
+ * ```ts
593
+ * CAPTURE_SHEET.cell // 320
594
+ * ```
595
+ */
596
+ export declare const CAPTURE_SHEET: Readonly<{
597
+ readonly cell: 320;
598
+ readonly limit: 400;
599
+ readonly mark: Readonly<{
600
+ width: 160;
601
+ height: 20;
602
+ present: 220;
603
+ absent: 20;
604
+ }>;
605
+ readonly gap: 12;
606
+ readonly pairs: 2;
607
+ readonly rows: 4;
608
+ }>;
609
+
610
+ /**
611
+ * Names the contact-sheet files: the sheet prefix and digits, and the two index documents.
612
+ *
613
+ * @example
614
+ * ```ts
615
+ * `${CAPTURE_SHEET_FILES.prefix}001.png` // 'sheet-001.png'
616
+ * ```
617
+ */
618
+ export declare const CAPTURE_SHEET_FILES: Readonly<{
619
+ readonly prefix: "sheet-";
620
+ readonly digits: 3;
621
+ readonly index: "index.json";
622
+ readonly notes: "index.md";
623
+ }>;
624
+
625
+ /**
626
+ * Names the selected journey stage and the narrow and remaining frame stages.
627
+ *
628
+ * @example
629
+ * ```ts
630
+ * CAPTURE_STAGES.first // 'narrow'
631
+ * ```
632
+ */
633
+ export declare const CAPTURE_STAGES: Readonly<{
634
+ readonly selected: "selected";
635
+ readonly first: "narrow";
636
+ readonly rest: "rest";
637
+ }>;
638
+
639
+ /**
640
+ * Names the executable's subcommands in the order its usage text lists them.
641
+ *
642
+ * @remarks
643
+ * `frames` runs the `capture` request command, so `capture capture` never stutters. The other
644
+ * names are their own commands.
645
+ *
646
+ * @example
647
+ * ```ts
648
+ * CAPTURE_SUBCOMMANDS.includes('registry') // true
649
+ * ```
650
+ */
651
+ export declare const CAPTURE_SUBCOMMANDS: readonly string[];
652
+
653
+ /** Names the create-only child record beneath an invocation's run directory.
654
+ * @example
655
+ * ```ts
656
+ * CAPTURE_SURVIVORS_FILE // 'survivors.json'
657
+ * ```
658
+ */
659
+ export declare const CAPTURE_SURVIVORS_FILE = "survivors.json";
660
+
661
+ /**
662
+ * Lists the words a tag name can never be, because a tag filter reads them as operators.
663
+ *
664
+ * @example
665
+ * ```ts
666
+ * CAPTURE_TAG_OPERATORS.includes('and') // true
667
+ * ```
668
+ */
669
+ export declare const CAPTURE_TAG_OPERATORS: readonly string[];
670
+
671
+ /**
672
+ * Holds the usage text the executable prints when it is given no subcommand or an unknown one.
673
+ *
674
+ * @example
675
+ * ```ts
676
+ * CAPTURE_USAGE.split('\n')[0] // 'Usage: capture <command> [arguments]'
677
+ * ```
678
+ */
679
+ export declare const CAPTURE_USAGE: string;
680
+
681
+ /**
682
+ * Names the repository-relative path of the Vitest entry the runner spawns through Node.
683
+ *
684
+ * @example
685
+ * ```ts
686
+ * resolve(root, CAPTURE_VITEST_ENTRY)
687
+ * ```
688
+ */
689
+ export declare const CAPTURE_VITEST_ENTRY = "node_modules/vitest/vitest.mjs";
690
+
691
+ /**
692
+ * Configures the Vitest argument list one stage spawns with.
693
+ *
694
+ * @remarks
695
+ * `entry` is the absolute Vitest entry and `config` the absolute wrapper path. `report` is the
696
+ * absolute JSON reporter path and `projects` the Vitest project labels the stage runs. `filter`
697
+ * is the tag expression. An exact `case` adds the anchored name pattern for that case and the
698
+ * `final` case, so the final case still writes the run record. A `mode` adds Vitest's `--mode`
699
+ * flag, which the registry command forwards so a wrapper can select another registry.
700
+ *
701
+ * @example
702
+ * ```ts
703
+ * const options: CaptureArgumentsOptions = {
704
+ * entry: '/repo/node_modules/vitest/vitest.mjs',
705
+ * config: '/repo/configs/vite.journey.config.ts',
706
+ * report: '/repo/tmp/units/runs/a/journey-selected.json',
707
+ * projects: ['journey:light-390'],
708
+ * filter: 'owner:pages:mail',
709
+ * final: 'closes the run',
710
+ * }
711
+ * ```
712
+ */
713
+ export declare interface CaptureArgumentsOptions {
714
+ readonly entry: string;
715
+ readonly config: string;
716
+ readonly report: string;
717
+ readonly projects: readonly string[];
718
+ readonly filter: string;
719
+ readonly case?: string;
720
+ readonly final: string;
721
+ readonly mode?: string;
722
+ /** Original reporter title segments keyed by its space-joined full name. */
723
+ readonly titles?: Readonly<Record<string, readonly string[]>>;
724
+ }
725
+
726
+ /**
727
+ * Carries a judged run record and the verified text of the journey artifact it names.
728
+ *
729
+ * @example
730
+ * ```ts
731
+ * const result: CaptureArtifactResult = { record, run, file, text }
732
+ * ```
733
+ */
734
+ export declare interface CaptureArtifactResult {
735
+ readonly record: string;
736
+ readonly run: CaptureRun;
737
+ readonly file: string;
738
+ readonly text: string;
739
+ }
740
+
741
+ /**
742
+ * Classifies one changed Git path against accepted source attribution.
743
+ *
744
+ * @remarks Shared and test patterns take precedence over ownership; shared owners name every destination owner.
745
+ * @example
746
+ * ```ts
747
+ * const change: CaptureChange = { path: 'src/mail/view.ts', classification: 'own', owners: ['pages:mail'] }
748
+ * ```
749
+ */
750
+ export declare interface CaptureChange {
751
+ readonly path: string;
752
+ readonly classification: 'own' | 'shared' | 'outside';
753
+ readonly owners: readonly string[];
754
+ }
755
+
756
+ /**
757
+ * Holds changed paths and the stable owner selection reduced by ancestry.
758
+ *
759
+ * @example
760
+ * ```ts
761
+ * const plan: CaptureChangePlan = { changes: [], owners: [] }
762
+ * ```
763
+ */
764
+ export declare interface CaptureChangePlan {
765
+ readonly changes: readonly CaptureChange[];
766
+ readonly owners: readonly string[];
767
+ }
768
+
769
+ /**
770
+ * Carries one judged frame to a host check: its destination, its decoded pixels, and its artifact.
771
+ *
772
+ * @remarks
773
+ * `picture` is `undefined` when the frame's image could not be read, and `artifact` is `undefined`
774
+ * when no verified journey artifact covers the frame. A check that needs either decides what an
775
+ * absent one means; the reader already reports an unreadable image and an uncovered record.
776
+ *
777
+ * @example
778
+ * ```ts
779
+ * const frame: CaptureCheckFrame = { entry, picture, artifact: undefined }
780
+ * ```
781
+ */
782
+ export declare interface CaptureCheckFrame {
783
+ readonly entry: CaptureDestination;
784
+ readonly picture: CapturePicture | undefined;
785
+ readonly artifact: CaptureArtifactResult | undefined;
786
+ }
787
+
788
+ /**
789
+ * Reads one judged frame against a host rule and returns the issues it finds, none when it passes.
790
+ *
791
+ * @example
792
+ * ```ts
793
+ * const check: CaptureCheckHandler = (frame) => (frame.picture.width < 100 ? ['frame is too narrow'] : [])
794
+ * ```
795
+ */
796
+ export declare type CaptureCheckHandler = (frame: CaptureCheckFrame) => readonly string[];
797
+
798
+ /**
799
+ * Selects required output pairs and attributable extras for a freshness reading.
800
+ *
801
+ * @remarks
802
+ * `variants` names output variants, including auxiliary outputs when explicitly selected.
803
+ * `portfolio`, when supplied, restricts the instance's authorized portfolio population. Empty or
804
+ * unknown selectors, variants, portfolios, cases, and states refuse. A scoped reading includes
805
+ * only selected required pairs and attributable extras, and a whole-primary-portfolio reading
806
+ * also reports legacy flat PNGs as orphans.
807
+ *
808
+ * @example
809
+ * ```ts
810
+ * const options: CaptureCheckOptions = { selector: 'pages:mail', variants: ['light-390'] }
811
+ * ```
812
+ */
813
+ export declare interface CaptureCheckOptions extends CaptureSelection {
814
+ readonly variants: readonly string[];
815
+ readonly portfolio?: string;
816
+ }
817
+
818
+ /**
819
+ * Reports the exact judged population, every mismatch reason, and conservative test warnings.
820
+ *
821
+ * @remarks
822
+ * `required` supplies canonical selected paths to preflight and contact-sheet consumers.
823
+ * `entries` includes physical extras and uses duplicate, orphan, missing, unstamped,
824
+ * stale-shared, stale-own, current precedence. Changed test inputs produce warnings and
825
+ * invalidate dependent lookups without changing a frame's pixel classification. `duration` is the
826
+ * measured `performance.now` wall in milliseconds for this selection. The executable derives exit
827
+ * 1 from any noncurrent entry, exit 0 otherwise, and exit 64 from invalid usage or schema.
828
+ * Missing required registry evidence never produces success.
829
+ *
830
+ * @example
831
+ * ```ts
832
+ * const result = await integrity.check({ selector: 'pages:mail' })
833
+ * result.entries.every((entry) => entry.status === 'current')
834
+ * ```
835
+ */
836
+ export declare interface CaptureCheckResult {
837
+ readonly required: readonly CaptureDestination[];
838
+ readonly entries: readonly CaptureFreshness[];
839
+ readonly warnings: readonly CaptureWarning[];
840
+ readonly duration: number;
841
+ }
842
+
843
+ /**
844
+ * Terminates one supervised child and reports whether its exit was confirmed.
845
+ * @example
846
+ * ```ts
847
+ * const terminate: CaptureChildTerminationHandler = (child) => child.stop()
848
+ * ```
849
+ */
850
+ export declare type CaptureChildTerminationHandler = (child: SessionInterface) => Promise<boolean>;
851
+
852
+ /**
853
+ * Dispatches capture commands and maps usage and evidence refusals to their exit codes.
854
+ *
855
+ * @remarks
856
+ * The executable's whole behaviour: it reads the subcommand, hands the rest of the command line to
857
+ * the runner, the registry refresh, the preflight, or the contact sheets, and turns a refused
858
+ * usage into exit 64 and any other capture refusal into exit 1, writing the refusal to its error
859
+ * writer. An error that is not a capture refusal propagates.
860
+ *
861
+ * @example
862
+ * ```ts
863
+ * const exit = await new CaptureCLI().execute(['journey', 'pages:mail'])
864
+ * ```
865
+ */
866
+ export declare class CaptureCLI implements CaptureCLIInterface {
867
+ #private;
868
+ /** Creates the executable with the working directory and process writers as defaults. */
869
+ constructor(options?: CaptureCLIOptions);
870
+ /**
871
+ * Executes one command line and returns its exit code after every child has settled.
872
+ *
873
+ * @param args - The arguments following the executable name
874
+ * @returns 0 for passed work, 1 for failed evidence, or 64 for refused usage
875
+ * @example
876
+ * ```ts
877
+ * await new CaptureCLI().execute([]) // 64, with usage written to stderr
878
+ * ```
879
+ */
880
+ execute(args: readonly string[]): Promise<number>;
881
+ }
882
+
883
+ /**
884
+ * Runs capture command lines through injected output writers.
885
+ *
886
+ * @example
887
+ * ```ts
888
+ * const cli: CaptureCLIInterface = createCaptureCLI()
889
+ * const exit = await cli.execute(['journey', 'pages:mail'])
890
+ * ```
891
+ */
892
+ export declare interface CaptureCLIInterface {
893
+ /** Returns 0 for passed work, 1 for failed evidence, or 64 for refused usage. */
894
+ execute(argv: readonly string[]): Promise<number>;
895
+ }
896
+
897
+ /**
898
+ * Configures the executable's workspace and its report and diagnostic writers.
899
+ *
900
+ * @remarks
901
+ * `root` defaults to the working directory; `stdout` and `stderr` default to the process streams.
902
+ *
903
+ * @example
904
+ * ```ts
905
+ * const options: CaptureCLIOptions = { root: process.cwd(), stdout: (text) => process.stdout.write(text) }
906
+ * ```
907
+ */
908
+ export declare interface CaptureCLIOptions {
909
+ readonly root?: string;
910
+ readonly stdout?: CaptureWriteHandler;
911
+ readonly stderr?: CaptureWriteHandler;
912
+ }
913
+
914
+ /**
915
+ * Carries the authenticated external record beside its collection receipt.
916
+ *
917
+ * @example
918
+ * ```ts
919
+ * const evidence: CaptureCollectionEvidence = { file: snapshot, run, receipt }
920
+ * ```
921
+ */
922
+ export declare interface CaptureCollectionEvidence extends CaptureRunEvidence {
923
+ readonly receipt: CaptureCollectionReceipt;
924
+ }
925
+
926
+ /**
927
+ * Names one command the runner executes: a journey, a frame capture, or a stale reading.
928
+ *
929
+ * @example
930
+ * ```ts
931
+ * const command: CaptureCommand = 'stale'
932
+ * ```
933
+ */
934
+ export declare type CaptureCommand = CaptureRequest['command'] | 'stale';
935
+
936
+ /**
937
+ * Records one selected image's real bytes, geometry, and canonical destination.
938
+ *
939
+ * @example
940
+ * ```ts
941
+ * const result: CaptureDecodedImage = { entry, picture, digest, size: 2048 }
942
+ * ```
943
+ */
944
+ export declare interface CaptureDecodedImage {
945
+ readonly entry: CaptureDestination;
946
+ readonly picture: CapturePicture;
947
+ readonly digest: string;
948
+ readonly size: number;
949
+ }
950
+
951
+ /**
952
+ * Names what a description must echo for the runner to accept it.
953
+ *
954
+ * @remarks
955
+ * `id`, `nonce`, and `config` are the request's own. `parent` is the runner's process id and `pid`
956
+ * the discovery child's, which the runner read from the spawn.
957
+ *
958
+ * @example
959
+ * ```ts
960
+ * const expected: CaptureDescriptionExpectation = {
961
+ * id: 'run-1',
962
+ * nonce: 'a1b2',
963
+ * config: 'configs/vite.journey.config.ts',
964
+ * parent: process.pid,
965
+ * pid: 4343,
966
+ * }
967
+ * ```
968
+ */
969
+ export declare interface CaptureDescriptionExpectation {
970
+ readonly id: string;
971
+ readonly nonce: string;
972
+ readonly config: string;
973
+ readonly parent: number;
974
+ readonly pid: number | undefined;
975
+ }
976
+
977
+ /**
978
+ * Carries one physical-directory ancestry while enumerating logical portfolio paths.
979
+ *
980
+ * @example
981
+ * ```ts
982
+ * const result: CaptureDirectoryResult = { directory: 'tmp/captures/states/pages', ancestors: [] }
983
+ * ```
984
+ */
985
+ export declare interface CaptureDirectoryResult {
986
+ readonly directory: string;
987
+ readonly ancestors: readonly string[];
988
+ }
989
+
990
+ /**
991
+ * Reads a consumer's wrapper by running the consumer's installed Vitest in discovery mode.
992
+ *
993
+ * @remarks
994
+ * The runner never loads the wrapper itself, so it imports neither Vite nor Vitest. It publishes an
995
+ * atomic request with the `discover` phase, spawns the consumer's own Vitest entry through Node as
996
+ * `list --filesOnly --config <wrapper> --configLoader runner`, and reads back the description the
997
+ * wrapper writes when it calls `answerCaptureDiscovery`. The child is bounded by a deadline and
998
+ * recorded by the invocation, so an interrupt ends it with the rest of its tree. The description is
999
+ * accepted only after the child exited zero and every echo in it matches this exchange: the
1000
+ * invocation, the challenge, the wrapper, this process as the wrapper's parent, and the spawned
1001
+ * child as its writer. A wrapper that never answers, answers another exchange, or answers twice
1002
+ * from different processes is refused.
1003
+ *
1004
+ * @example
1005
+ * ```ts
1006
+ * const discovery = new CaptureDiscovery({ root: process.cwd(), config, invocation })
1007
+ * const { projects } = await discovery.describe()
1008
+ * ```
1009
+ */
1010
+ export declare class CaptureDiscovery implements CaptureDiscoveryInterface {
1011
+ #private;
1012
+ /**
1013
+ * Binds the workspace, the wrapper, and the invocation that owns the child.
1014
+ *
1015
+ * @param options - The workspace, the absolute wrapper path, the invocation, and the optional mode and deadline
1016
+ */
1017
+ constructor(options: CaptureDiscoveryRunOptions);
1018
+ describe(): Promise<CaptureHostDescription>;
1019
+ }
1020
+
1021
+ /**
1022
+ * Reads a consumer's wrapper by running its installed Vitest in discovery mode.
1023
+ *
1024
+ * @example
1025
+ * ```ts
1026
+ * const discovery: CaptureDiscoveryInterface = createCaptureDiscovery(options)
1027
+ * ```
1028
+ */
1029
+ export declare interface CaptureDiscoveryInterface {
1030
+ /**
1031
+ * Publishes the discovery request, runs the wrapper's Vitest as a bounded child, and reads back its description.
1032
+ *
1033
+ * @returns The validated host description, accepted only after the exchange and the child's exit both succeeded
1034
+ * @throws Thrown as a `USAGE` capture error for a wrapper outside the workspace, and as a `HOST`
1035
+ * capture error for a missing Vitest, a failed or expired child, and a missing, replayed,
1036
+ * mismatched, or malformed description. Interruption and lost child observation throw `STAGE`.
1037
+ *
1038
+ * @example
1039
+ * ```ts
1040
+ * const { projects } = await discovery.describe()
1041
+ * ```
1042
+ */
1043
+ describe(): Promise<CaptureHostDescription>;
1044
+ }
1045
+
1046
+ /**
1047
+ * Configures how a wrapper answers the runner's discovery request.
1048
+ *
1049
+ * @remarks
1050
+ * `ppid`, `argv`, `directory`, and `config` are the ones `CaptureRequestOptions` names. `projects`
1051
+ * is the wrapper's own `test.projects` list, each entry an inline project, a promise of one, or a
1052
+ * factory, which the answer resolves the way Vitest does.
1053
+ *
1054
+ * @example
1055
+ * ```ts
1056
+ * const options: CaptureDiscoveryOptions = {
1057
+ * ppid: process.ppid,
1058
+ * argv: process.argv.slice(1),
1059
+ * config: 'configs/vite.journey.config.ts',
1060
+ * projects,
1061
+ * }
1062
+ * ```
1063
+ */
1064
+ export declare interface CaptureDiscoveryOptions {
1065
+ readonly ppid: number;
1066
+ readonly argv: readonly string[];
1067
+ readonly directory?: string;
1068
+ readonly config: string;
1069
+ readonly projects: readonly unknown[];
1070
+ }
1071
+
1072
+ /**
1073
+ * Carries the request the runner publishes for the discovery child that reads its wrapper.
1074
+ *
1075
+ * @remarks
1076
+ * `phase` is always `discover`, which is what tells a wrapper this is no execution request. `nonce`
1077
+ * is the challenge the wrapper must echo in its answer, `pid` the runner's process id, `config` the
1078
+ * repository-relative wrapper path, and `args` the exact arguments the discovery child was spawned
1079
+ * with. The file has the name and location of an execution request, so one lease covers both.
1080
+ *
1081
+ * @example
1082
+ * ```ts
1083
+ * const request: CaptureDiscoveryRequest = {
1084
+ * version: 1,
1085
+ * phase: 'discover',
1086
+ * id: 'run-1',
1087
+ * nonce: 'a1b2',
1088
+ * config: 'configs/vite.journey.config.ts',
1089
+ * pid: 4242,
1090
+ * args: ['/repo/node_modules/vitest/vitest.mjs', 'list', '--filesOnly'],
1091
+ * }
1092
+ * ```
1093
+ */
1094
+ export declare interface CaptureDiscoveryRequest {
1095
+ readonly version: 1;
1096
+ readonly phase: 'discover';
1097
+ readonly id: string;
1098
+ readonly nonce: string;
1099
+ readonly config: string;
1100
+ readonly pid: number;
1101
+ readonly args: readonly string[];
1102
+ }
1103
+
1104
+ /**
1105
+ * Configures one discovery: the workspace, the wrapper, the invocation that owns the child, and its bounds.
1106
+ *
1107
+ * @remarks
1108
+ * `root` is the absolute workspace path and `config` the absolute wrapper path. `invocation` owns
1109
+ * the request file, the child, and its interruption. `mode` is Vitest's `--mode` value when the
1110
+ * command forwards one. `deadline` bounds the child in milliseconds; default:
1111
+ * `CAPTURE_DISCOVERY.deadline`.
1112
+ *
1113
+ * @example
1114
+ * ```ts
1115
+ * const options: CaptureDiscoveryRunOptions = { root: process.cwd(), config, invocation }
1116
+ * ```
1117
+ */
1118
+ export declare interface CaptureDiscoveryRunOptions {
1119
+ readonly root: string;
1120
+ readonly config: string;
1121
+ readonly invocation: CaptureInvocationInterface;
1122
+ readonly mode?: string;
1123
+ readonly deadline?: number;
1124
+ }
1125
+
1126
+ /**
1127
+ * Carries accepted registry anchors and separately persisted passing run evidence.
1128
+ *
1129
+ * @example
1130
+ * ```ts
1131
+ * const evidence: CaptureEvidence = { registry, collections: [], lookups: [], runs: [] }
1132
+ * ```
1133
+ */
1134
+ export declare interface CaptureEvidence {
1135
+ readonly registry: CaptureRegistry;
1136
+ readonly collections: readonly CaptureCollectionReceipt[];
1137
+ readonly manifest?: CaptureStoredManifest;
1138
+ readonly lookups: readonly CaptureLookup[];
1139
+ readonly runs: readonly CaptureRunEvidence[];
1140
+ }
1141
+
1142
+ /**
1143
+ * Executes the runner's child after the engine captures its input snapshot.
1144
+ *
1145
+ * @returns The real child close outcome after its output streams close.
1146
+ * @remarks
1147
+ * The runner retains argv, environment, request-file, log, process, and interruption ownership.
1148
+ * This callback starts no alternate runner and is invoked at most once. Throwing, interruption,
1149
+ * a signal, or a nonzero exit prevents any evidence commit.
1150
+ *
1151
+ * @example
1152
+ * ```ts
1153
+ * const execute: CaptureExecutionHandler = async () => ({ code: 0, signal: null })
1154
+ * ```
1155
+ */
1156
+ export declare type CaptureExecutionHandler = () => Promise<CaptureExecutionResult>;
1157
+
1158
+ /**
1159
+ * Carries the supervised child outcome without treating a signal as a successful exit.
1160
+ *
1161
+ * @remarks
1162
+ * The null values mirror the native child outcome. `signal` carries the fleet's signal string.
1163
+ * `pid` is the id of the child the runner spawned, when it spawned one, and `expired` is present
1164
+ * and `true` only when the runner ended
1165
+ * the child because its deadline passed. Observation cutoffs and writer failures throw instead of
1166
+ * returning an outcome that could authorize evidence.
1167
+ *
1168
+ * @example
1169
+ * ```ts
1170
+ * const result: CaptureExecutionResult = { code: 0, signal: null }
1171
+ * ```
1172
+ */
1173
+ export declare interface CaptureExecutionResult {
1174
+ readonly code: number | null;
1175
+ readonly signal: string | null;
1176
+ readonly pid?: number;
1177
+ readonly expired?: boolean;
1178
+ }
1179
+
1180
+ /**
1181
+ * Records one physical file's bytes and native modification readings at a stage boundary.
1182
+ *
1183
+ * @remarks
1184
+ * `file` is repository-relative and `changed` is the native ctime in milliseconds. Missing files
1185
+ * have no row, and duplicate or case-colliding paths refuse before indexing. These readings
1186
+ * accompany execution identity and record validation; they do not independently authorize a
1187
+ * frame stamp.
1188
+ *
1189
+ * @example
1190
+ * ```ts
1191
+ * const snapshot: CaptureFileSnapshot = {
1192
+ * file: 'tmp/captures/states/pages/mail--inbox.png',
1193
+ * image: { digest, size: 2048, modified: 1730000000000 },
1194
+ * changed: 1730000000000,
1195
+ * }
1196
+ * ```
1197
+ */
1198
+ export declare interface CaptureFileSnapshot {
1199
+ readonly file: string;
1200
+ readonly image: CaptureStamp['image'];
1201
+ readonly changed: number;
1202
+ }
1203
+
1204
+ /**
1205
+ * Digests the exact bytes of one file reading and returns the lowercase hexadecimal digest.
1206
+ *
1207
+ * @example
1208
+ * ```ts
1209
+ * const hash: CaptureHashHandler = (bytes) => computeCaptureHash(bytes)
1210
+ * ```
1211
+ */
1212
+ export declare type CaptureHashHandler = (bytes: Uint8Array) => string;
1213
+
1214
+ /**
1215
+ * Carries the description a wrapper writes back to the runner that discovered it.
1216
+ *
1217
+ * @remarks
1218
+ * `id`, `nonce`, and `config` echo the request. `parent` is the runner's process id the wrapper read
1219
+ * as its own parent and `pid` the wrapper process's own id, so the runner can tie the answer to the
1220
+ * child it spawned. `projects` lists one entry per wrapper project in declaration order.
1221
+ *
1222
+ * @example
1223
+ * ```ts
1224
+ * const description: CaptureHostDescription = {
1225
+ * version: 1,
1226
+ * id: 'run-1',
1227
+ * nonce: 'a1b2',
1228
+ * config: 'configs/vite.journey.config.ts',
1229
+ * parent: 4242,
1230
+ * pid: 4343,
1231
+ * projects: [{ project }],
1232
+ * }
1233
+ * ```
1234
+ */
1235
+ export declare interface CaptureHostDescription {
1236
+ readonly version: 1;
1237
+ readonly id: string;
1238
+ readonly nonce: string;
1239
+ readonly config: string;
1240
+ readonly parent: number;
1241
+ readonly pid: number;
1242
+ readonly projects: readonly CaptureHostEntry[];
1243
+ }
1244
+
1245
+ /**
1246
+ * Describes one wrapper project to the runner: its host declarations and, when it has one, its viewport.
1247
+ *
1248
+ * @remarks
1249
+ * The viewport is the geometry of the project's producing variant. A runner command needs none; a
1250
+ * reader refuses a project that declares none.
1251
+ *
1252
+ * @example
1253
+ * ```ts
1254
+ * const entry: CaptureHostEntry = { project, viewport: { name: 'light-390', width: 390, height: 844 } }
1255
+ * ```
1256
+ */
1257
+ export declare interface CaptureHostEntry {
1258
+ readonly project: CaptureProject;
1259
+ readonly viewport?: CaptureViewport;
1260
+ }
1261
+
1262
+ /**
1263
+ * Retains source geometry and a bounded sheet thumbnail after a full frame has been judged.
1264
+ * @example
1265
+ * ```ts
1266
+ * const result: CaptureImageResult = { entry, picture: { width: 2880, height: 6000 }, thumbnail, digest, size: 2048 }
1267
+ * ```
1268
+ */
1269
+ export declare interface CaptureImageResult extends Omit<CaptureDecodedImage, 'picture'> {
1270
+ readonly picture: Pick<CapturePicture, 'width' | 'height'>;
1271
+ readonly thumbnail: CapturePicture;
1272
+ }
1273
+
1274
+ /**
1275
+ * Reads a contained input through an owning operation's file snapshot memo.
1276
+ *
1277
+ * @returns The input digest, or undefined if the file vanished before its snapshot
1278
+ * @example
1279
+ * ```ts
1280
+ * const read: CaptureInputHandler = (file) => snapshots.get(file)?.image.digest
1281
+ * ```
1282
+ */
1283
+ export declare type CaptureInputHandler = (file: string) => string | undefined;
1284
+
1285
+ /**
1286
+ * Validates capture transactions, freshness, and state lookup against real filesystem evidence.
1287
+ *
1288
+ * @remarks
1289
+ * The host supplies every product path, portfolio mapping, and source population; the engine
1290
+ * infers none of them from a name. Construct it through `createCaptureIntegrity`, or directly
1291
+ * with the same options.
1292
+ *
1293
+ * @example
1294
+ * ```ts
1295
+ * const integrity = new CaptureIntegrity({
1296
+ * root: process.cwd(),
1297
+ * directory: 'tmp/captures/states',
1298
+ * inputs: ['src/**'],
1299
+ * registry: 'tmp/captures/states/registry.json',
1300
+ * manifest: 'tmp/captures/states/manifest.json',
1301
+ * lookups: 'tmp/captures/states/lookups.json',
1302
+ * portfolios: [{ portfolio: 'states', directory: 'tmp/captures/states', scoped: true }],
1303
+ * })
1304
+ * ```
1305
+ */
1306
+ export declare class CaptureIntegrity implements CaptureIntegrityInterface {
1307
+ #private;
1308
+ /**
1309
+ * Binds the engine to an explicit workspace and host portfolio mapping.
1310
+ *
1311
+ * @param options - The workspace, evidence paths, authorized physical roots, and optional file hash
1312
+ * @throws Thrown when the root is not absolute, a path escapes the root, or a portfolio is invalid.
1313
+ */
1314
+ constructor(options: CaptureIntegrityOptions);
1315
+ /**
1316
+ * Classifies changes since a Git merge-base through the accepted registry.
1317
+ *
1318
+ * @param ref - The Git ref whose merge-base with HEAD bounds tracked changes; HEAD selects uncommitted work
1319
+ * @returns Every tracked or untracked changed path and the reduced owner selection
1320
+ * @throws Thrown when Git refuses the ref or the accepted registry cannot be authenticated.
1321
+ * @example
1322
+ * ```ts
1323
+ * const plan = integrity.changed('HEAD')
1324
+ * ```
1325
+ */
1326
+ changed(ref: string): CaptureChangePlan;
1327
+ /**
1328
+ * Validates an executed stage before atomically publishing its authorized evidence.
1329
+ *
1330
+ * @param options - The exact stage and the runner-owned child execution callback
1331
+ * @returns The committed stage evidence after every selected sibling validates
1332
+ * @throws Thrown when execution, identity, records, reporter results, paths, inputs, registry
1333
+ * evidence, projection, or atomic publication fails. Precommit failures preserve prior
1334
+ * manifest bytes, and journey requests publish no image stamps.
1335
+ *
1336
+ * @example
1337
+ * ```ts
1338
+ * const result = await integrity.stamp(stage)
1339
+ * ```
1340
+ */
1341
+ stamp(options: CaptureStageOptions): Promise<CaptureStageResult>;
1342
+ /**
1343
+ * Reads current full-collection evidence and selects exact declaration destinations.
1344
+ *
1345
+ * @param options - The explicit selection; omitted variants derive from authenticated mappings
1346
+ * @returns The accepted registry identity and exactly selected destinations
1347
+ * @throws Thrown with explicit preparation when declarations lack current authenticated evidence.
1348
+ *
1349
+ * @example
1350
+ * ```ts
1351
+ * const { entries } = await integrity.read({ selector: 'pages:mail' })
1352
+ * ```
1353
+ */
1354
+ read(options: CaptureReadOptions): Promise<CaptureReadResult>;
1355
+ /**
1356
+ * Checks the explicitly selected output population without changing evidence or images.
1357
+ *
1358
+ * @param selection - The selected owners, optional output variants, state, and portfolio, and
1359
+ * the wrapper's declared producing variants. Default variants: every output variant of the
1360
+ * selected registry destinations.
1361
+ * @returns Freshness classifications and warnings for the selected population
1362
+ * @throws Thrown when required evidence, schema, containment, or selection is invalid, or when
1363
+ * variants are omitted and a declared producing variant has no registry evidence.
1364
+ *
1365
+ * @example
1366
+ * ```ts
1367
+ * const result = await integrity.check({ selector: 'pages:mail' })
1368
+ * ```
1369
+ */
1370
+ check(selection: CaptureStaleOptions): Promise<CaptureCheckResult>;
1371
+ /**
1372
+ * Resolves an explicitly requested state through fresh registry and passing case evidence.
1373
+ *
1374
+ * @param options - The original selector, producing variants, state, and optional exact case
1375
+ * @returns The agreed declaring case, output mappings, and validated lookup receipts
1376
+ * @throws Thrown when evidence is missing, stale, ambiguous, or disagrees with the selection;
1377
+ * the message names the explicit refresh command.
1378
+ *
1379
+ * @example
1380
+ * ```ts
1381
+ * const { case: name } = await integrity.lookup({ selector: 'pages:mail', state: 'inbox', variants: ['light-390'] })
1382
+ * ```
1383
+ */
1384
+ lookup(options: CaptureLookupOptions): Promise<CaptureLookupResult>;
1385
+ }
1386
+
1387
+ /**
1388
+ * Creates the integrity engine the runner reads and stamps through, from the options it derives.
1389
+ *
1390
+ * @remarks The default constructs the package's own engine.
1391
+ *
1392
+ * @example
1393
+ * ```ts
1394
+ * const handler: CaptureIntegrityHandler = (options) => createCaptureIntegrity(options)
1395
+ * ```
1396
+ */
1397
+ export declare type CaptureIntegrityHandler = (options: CaptureIntegrityOptions) => CaptureIntegrityInterface;
1398
+
1399
+ /**
1400
+ * Defines the shared stage transaction, freshness reading, and state resolution engine.
1401
+ *
1402
+ * @example
1403
+ * ```ts
1404
+ * const integrity: CaptureIntegrityInterface = createCaptureIntegrity(options)
1405
+ * ```
1406
+ */
1407
+ export declare interface CaptureIntegrityInterface {
1408
+ /**
1409
+ * Classifies changes since a Git merge-base through the accepted registry.
1410
+ *
1411
+ * @param ref - The Git ref whose merge-base with HEAD bounds tracked changes; HEAD selects uncommitted work
1412
+ * @returns Every tracked or untracked changed path and the reduced owner selection
1413
+ * @throws Thrown when Git refuses the ref or the accepted registry cannot be authenticated.
1414
+ * @example
1415
+ * ```ts
1416
+ * const plan = integrity.changed('HEAD')
1417
+ * ```
1418
+ */
1419
+ changed(ref: string): CaptureChangePlan;
1420
+ /**
1421
+ * Reads current full-collection evidence and selects exact declaration destinations.
1422
+ *
1423
+ * @param options - The explicit selection; omitted variants derive from authenticated mappings
1424
+ * @returns The accepted registry identity and exactly selected destinations
1425
+ * @throws Thrown with explicit preparation when declarations lack current authenticated evidence.
1426
+ *
1427
+ * @example
1428
+ * ```ts
1429
+ * const { entries } = await integrity.read({ selector: 'pages:mail' })
1430
+ * ```
1431
+ */
1432
+ read(options: CaptureReadOptions): Promise<CaptureReadResult>;
1433
+ /**
1434
+ * Validates an executed stage before atomically publishing its authorized evidence.
1435
+ *
1436
+ * @param options - The exact stage and the runner-owned child execution callback
1437
+ * @returns The committed stage evidence after every selected sibling validates
1438
+ * @throws Thrown when execution, identity, records, reporter results, paths, inputs, registry
1439
+ * evidence, projection, or atomic publication fails. Precommit failures preserve prior
1440
+ * manifest bytes, and journey requests publish no image stamps.
1441
+ *
1442
+ * @example
1443
+ * ```ts
1444
+ * const result = await integrity.stamp(stage)
1445
+ * ```
1446
+ */
1447
+ stamp(options: CaptureStageOptions): Promise<CaptureStageResult>;
1448
+ /**
1449
+ * Checks the explicitly selected output population without changing evidence or images.
1450
+ *
1451
+ * @param selection - The selected owners, optional output variants, state, and portfolio, and
1452
+ * the wrapper's declared producing variants. Default variants: every output variant of the
1453
+ * selected registry destinations.
1454
+ * @returns Freshness classifications and warnings for the selected population
1455
+ * @throws Thrown when required evidence, schema, containment, or selection is invalid, or when
1456
+ * variants are omitted and a declared producing variant has no registry evidence.
1457
+ *
1458
+ * @example
1459
+ * ```ts
1460
+ * const result = await integrity.check({ selector: 'pages:mail' })
1461
+ * ```
1462
+ */
1463
+ check(selection: CaptureStaleOptions): Promise<CaptureCheckResult>;
1464
+ /**
1465
+ * Resolves an explicitly requested state through fresh registry and passing case evidence.
1466
+ *
1467
+ * @param options - The original selector, producing variants, state, and optional exact case
1468
+ * @returns The agreed declaring case, output mappings, and validated lookup receipts
1469
+ * @throws Thrown when evidence is missing, stale, ambiguous, or disagrees with the selection.
1470
+ *
1471
+ * @example
1472
+ * ```ts
1473
+ * const { case: name } = await integrity.lookup({ selector: 'pages:mail', state: 'inbox', variants: ['light-390'] })
1474
+ * ```
1475
+ */
1476
+ lookup(options: CaptureLookupOptions): Promise<CaptureLookupResult>;
1477
+ }
1478
+
1479
+ /**
1480
+ * Configures the engine's workspace and separate evidence documents.
1481
+ *
1482
+ * @remarks
1483
+ * `root` is the absolute workspace path. Every other path is repository-relative and
1484
+ * slash-separated. `directory` is the primary portfolio root and owns its run records.
1485
+ * `manifest` holds image stamps, `registry` holds the accepted complete-run registry, and
1486
+ * `lookups` holds a lookup journal bound to its predecessor manifest digest. A journey replaces
1487
+ * that journal after retaining unaffected receipts but cannot write the manifest. `portfolios`
1488
+ * authorizes physical image roots and scoped filename layouts the host supplies, including
1489
+ * auxiliary portfolios. `inputs` holds the native patterns for the complete bounded host input
1490
+ * population, including lookup membership. `hash` digests the bytes of every file reading.
1491
+ * Default: `computeCaptureHash`. The engine infers no portfolio, owner, source pattern, or
1492
+ * application path from a product name.
1493
+ *
1494
+ * @example
1495
+ * ```ts
1496
+ * const options: CaptureIntegrityOptions = {
1497
+ * root: process.cwd(),
1498
+ * directory: 'tmp/captures/states',
1499
+ * inputs: ['src/**'],
1500
+ * registry: 'tmp/captures/states/registry.json',
1501
+ * manifest: 'tmp/captures/states/manifest.json',
1502
+ * lookups: 'tmp/captures/states/lookups.json',
1503
+ * portfolios: [{ portfolio: 'states', directory: 'tmp/captures/states', scoped: true }],
1504
+ * }
1505
+ * ```
1506
+ */
1507
+ export declare interface CaptureIntegrityOptions {
1508
+ readonly inputs: readonly string[];
1509
+ readonly root: string;
1510
+ readonly directory: string;
1511
+ readonly manifest: string;
1512
+ readonly registry: string;
1513
+ readonly lookups: string;
1514
+ readonly portfolios: readonly CapturePortfolioRoot[];
1515
+ readonly hash?: CaptureHashHandler;
1516
+ }
1517
+
1518
+ /**
1519
+ * Owns one runner invocation's identity, request file, children, and interruption.
1520
+ *
1521
+ * @remarks
1522
+ * The runner creates one for discovery and each changed owner, so the abort controller, session
1523
+ * registry, and spawn log belong to an invocation. Interruption derives from the controller's
1524
+ * signal. Sessions end the Windows process tree, or signal the POSIX group with SIGTERM and then
1525
+ * SIGKILL after a 250 ms grace. A linked timeout ends discovery without interrupting the invocation.
1526
+ * Raw stdout is decoded across chunk boundaries and flushed at termination. A writer failure or
1527
+ * an observation cutoff refuses the stage rather than accepting incomplete evidence.
1528
+ *
1529
+ * @example
1530
+ * ```ts
1531
+ * const invocation = new CaptureInvocation({
1532
+ * command: 'journey',
1533
+ * root: process.cwd(),
1534
+ * requests: 'tmp/units',
1535
+ * stdout: (text) => process.stdout.write(text),
1536
+ * stderr: (text) => process.stderr.write(text),
1537
+ * })
1538
+ * invocation.attach()
1539
+ * ```
1540
+ */
1541
+ export declare class CaptureInvocation implements CaptureInvocationInterface {
1542
+ #private;
1543
+ /**
1544
+ * Creates the invocation entity for one runner call.
1545
+ *
1546
+ * @param options - The command, the workspace, the request directory, and the output writers
1547
+ */
1548
+ constructor(options: CaptureInvocationOptions);
1549
+ get id(): string;
1550
+ get request(): string;
1551
+ get directory(): string;
1552
+ get signal(): AbortSignal;
1553
+ get interrupted(): boolean;
1554
+ attach(): void;
1555
+ release(): Promise<void>;
1556
+ prepare(): void;
1557
+ holders(): readonly number[];
1558
+ publish(request: CaptureRequest | CaptureDiscoveryRequest): void;
1559
+ retract(): void;
1560
+ launched(log: string): boolean;
1561
+ spawn(args: readonly string[], log: string, capture: boolean, deadline?: number): Promise<CaptureExecutionResult>;
1562
+ }
1563
+
1564
+ /**
1565
+ * Owns one runner invocation's identity, request file, children, and interruption.
1566
+ *
1567
+ * @example
1568
+ * ```ts
1569
+ * const invocation: CaptureInvocationInterface = new CaptureInvocation(options)
1570
+ * ```
1571
+ */
1572
+ export declare interface CaptureInvocationInterface {
1573
+ /** Holds the invocation identity, which names its report directory and its request records. */
1574
+ readonly id: string;
1575
+ /** Holds the absolute path of the request file this process names. */
1576
+ readonly request: string;
1577
+ /** Holds the absolute directory that holds this invocation's reports and logs. */
1578
+ readonly directory: string;
1579
+ /** Holds the signal that aborts when the invocation is interrupted. */
1580
+ readonly signal: AbortSignal;
1581
+ /** Holds whether an interrupt has arrived. */
1582
+ readonly interrupted: boolean;
1583
+ /**
1584
+ * Installs the interrupt handler on the process.
1585
+ *
1586
+ * @example
1587
+ * ```ts
1588
+ * invocation.attach()
1589
+ * ```
1590
+ */
1591
+ attach(): void;
1592
+ /**
1593
+ * Releases confirmed ownership and removes interrupt handlers even when shutdown fails.
1594
+ *
1595
+ * @returns Nothing once the children are gone and the handler is removed
1596
+ *
1597
+ * @example
1598
+ * ```ts
1599
+ * await invocation.release()
1600
+ * ```
1601
+ */
1602
+ release(): Promise<void>;
1603
+ /**
1604
+ * Claims invocation ownership, refuses an existing marker, and removes temporary claims and requests from dead processes.
1605
+ *
1606
+ * @remarks A request file under a live process id is never touched, this process's own included.
1607
+ *
1608
+ * @example
1609
+ * ```ts
1610
+ * invocation.prepare()
1611
+ * ```
1612
+ */
1613
+ prepare(): void;
1614
+ /**
1615
+ * Lists the other live processes that hold a request file in the request directory.
1616
+ *
1617
+ * @returns The distinct holder process ids in directory order, excluding this invocation's own lease
1618
+ *
1619
+ * @example
1620
+ * ```ts
1621
+ * invocation.holders() // [] when no other runner is mid-stage
1622
+ * ```
1623
+ */
1624
+ holders(): readonly number[];
1625
+ /**
1626
+ * Writes the stage or discovery request atomically, so no reader sees a partial file.
1627
+ *
1628
+ * @param request - The stage request, or the discovery request that precedes the stages
1629
+ *
1630
+ * @example
1631
+ * ```ts
1632
+ * invocation.publish(request)
1633
+ * ```
1634
+ */
1635
+ publish(request: CaptureRequest | CaptureDiscoveryRequest): void;
1636
+ /**
1637
+ * Removes this process's request file and its temporary sibling.
1638
+ *
1639
+ * @example
1640
+ * ```ts
1641
+ * invocation.retract()
1642
+ * ```
1643
+ */
1644
+ retract(): void;
1645
+ /**
1646
+ * Reports whether a child with this log path has been spawned by this invocation.
1647
+ *
1648
+ * @param log - The absolute log path the spawn was given
1649
+ * @returns True if the spawn began; false otherwise
1650
+ *
1651
+ * @example
1652
+ * ```ts
1653
+ * invocation.launched(log) // false before the spawn
1654
+ * ```
1655
+ */
1656
+ launched(log: string): boolean;
1657
+ /**
1658
+ * Spawns the Vitest child and tees its output to the host streams and the log.
1659
+ *
1660
+ * @param args - The Node argument array, starting with the Vitest entry
1661
+ * @param log - The absolute path of the file that receives the child's output
1662
+ * @param capture - If `true`, sets the capture variable in the child; if `false`, removes it
1663
+ * @param deadline - Milliseconds after which the runner ends the child's process tree; default: unbounded
1664
+ * @returns The drained child outcome, its process id, and whether the deadline ended it
1665
+ * @throws Thrown as a `STAGE` capture error for a pre-aborted invocation, a child observation
1666
+ * cutoff, or a writer, log, or child fault.
1667
+ *
1668
+ * @example
1669
+ * ```ts
1670
+ * const { code } = await invocation.spawn(args, log, true)
1671
+ * ```
1672
+ */
1673
+ spawn(args: readonly string[], log: string, capture: boolean, deadline?: number): Promise<CaptureExecutionResult>;
1674
+ }
1675
+
1676
+ /**
1677
+ * Configures one runner invocation's identity, workspace, and output.
1678
+ *
1679
+ * @remarks
1680
+ * `root` is the absolute workspace path. `requests` is the repository-relative directory that
1681
+ * holds the request file and the invocation's reports and logs. `stdout` and `stderr` receive the
1682
+ * runner's own lines and each child's output.
1683
+ *
1684
+ * @example
1685
+ * ```ts
1686
+ * const options: CaptureInvocationOptions = {
1687
+ * command: 'journey',
1688
+ * root: process.cwd(),
1689
+ * requests: 'tmp/units',
1690
+ * stdout: (text) => process.stdout.write(text),
1691
+ * stderr: (text) => process.stderr.write(text),
1692
+ * }
1693
+ * ```
1694
+ */
1695
+ export declare interface CaptureInvocationOptions {
1696
+ readonly command: CaptureCommand;
1697
+ readonly root: string;
1698
+ readonly requests: string;
1699
+ readonly stdout: CaptureWriteHandler;
1700
+ readonly stderr: CaptureWriteHandler;
1701
+ /** Overrides child termination; false keeps ownership and reports the child's pid. */
1702
+ readonly terminate?: CaptureChildTerminationHandler;
1703
+ /** Supplies host ownership operations; omitted members use the local filesystem and process probe. */
1704
+ readonly ownership?: Partial<CaptureOwnershipHost>;
1705
+ }
1706
+
1707
+ /**
1708
+ * Pairs a judged frame with its verified artifact, when one was read, and its coverage issues.
1709
+ *
1710
+ * @example
1711
+ * ```ts
1712
+ * const frame: CaptureJudgedFrame = { entry, artifact: undefined, issues: [] }
1713
+ * ```
1714
+ */
1715
+ export declare interface CaptureJudgedFrame {
1716
+ readonly entry: CaptureDestination;
1717
+ readonly artifact: CaptureArtifactResult | undefined;
1718
+ readonly issues: readonly string[];
1719
+ }
1720
+
1721
+ /**
1722
+ * Names the run record a judged frame's stamp points at and the case that stamped it.
1723
+ *
1724
+ * @example
1725
+ * ```ts
1726
+ * const judged: CaptureJudgedRecord = { record: 'tmp/captures/states/runs/a/narrow/light-390.json', case: 'mail shows the inbox' }
1727
+ * ```
1728
+ */
1729
+ export declare interface CaptureJudgedRecord {
1730
+ readonly record: string;
1731
+ readonly case: string;
1732
+ }
1733
+
1734
+ /**
1735
+ * Requests a state-to-case resolution before the runner starts any selected project.
1736
+ *
1737
+ * @remarks
1738
+ * `variants` names producing journey variants, retaining the caller's exact selection. Registry
1739
+ * mappings determine output variants, and suffix substitution is forbidden. An explicit `case`
1740
+ * must equal the resolved full declaring name. Missing or stale evidence refuses with the
1741
+ * explicit capture-free owner or exact-case refresh command. Resolving a state starts no
1742
+ * process, repairs no evidence, and widens no selection.
1743
+ *
1744
+ * @example
1745
+ * ```ts
1746
+ * const options: CaptureLookupOptions = { selector: 'pages:mail', state: 'inbox', variants: ['light-390'] }
1747
+ * ```
1748
+ */
1749
+ export declare interface CaptureLookupOptions extends CaptureSelection {
1750
+ readonly state: string;
1751
+ readonly variants: readonly string[];
1752
+ readonly portfolio?: string;
1753
+ }
1754
+
1755
+ /**
1756
+ * Resolves one declaring case and its actual output pairs with their passing evidence.
1757
+ *
1758
+ * @remarks
1759
+ * `case` must agree across applicable requested producing variants, and ambiguity refuses.
1760
+ * `entries` retains each output variant and producing project without replacing the requested
1761
+ * variant list. Inapplicable projects remain in the runner's selected stage. Every entry must
1762
+ * agree with the selector, registry, lookup, and any relevant manifest stamp. An empty
1763
+ * applicable population refuses.
1764
+ *
1765
+ * @example
1766
+ * ```ts
1767
+ * const result = await integrity.lookup(options)
1768
+ * result.case // the declaring case's full name
1769
+ * ```
1770
+ */
1771
+ export declare interface CaptureLookupResult {
1772
+ readonly case: string;
1773
+ readonly entries: readonly CaptureDestination[];
1774
+ readonly lookups: readonly CaptureLookup[];
1775
+ }
1776
+
1777
+ /**
1778
+ * Carries one project's owner-bearing passed work count from a finished stage.
1779
+ *
1780
+ * @example
1781
+ * ```ts
1782
+ * const outcome: CaptureOutcome = { project: 'journey:light-390', variant: 'light-390', count: 3 }
1783
+ * ```
1784
+ */
1785
+ export declare interface CaptureOutcome {
1786
+ readonly project: string;
1787
+ readonly variant: string;
1788
+ readonly count: number;
1789
+ }
1790
+
1791
+ /**
1792
+ * Records one changed owner's exit and whether an execution child started.
1793
+ *
1794
+ * @example
1795
+ * ```ts
1796
+ * const outcome: CaptureOwnerOutcome = { owner: 'pages:mail', code: 0, ran: true }
1797
+ * ```
1798
+ */
1799
+ export declare interface CaptureOwnerOutcome {
1800
+ readonly owner: string;
1801
+ readonly code: number;
1802
+ readonly ran: boolean;
1803
+ }
1804
+
1805
+ /**
1806
+ * Identifies the process and invocation that own a request directory.
1807
+ * @example
1808
+ * ```ts
1809
+ * const owner: CaptureOwnership = { pid: process.pid, id: 'capture-run' }
1810
+ * ```
1811
+ */
1812
+ export declare interface CaptureOwnership {
1813
+ readonly pid: number;
1814
+ readonly id: string;
1815
+ }
1816
+
1817
+ /** Supplies the filesystem and liveness boundary for ownership arbitration.
1818
+ * @example
1819
+ * ```ts
1820
+ * const host: Partial<CaptureOwnershipHost> = { alive: (pid) => readCaptureRunning(pid) }
1821
+ * ```
1822
+ */
1823
+ export declare interface CaptureOwnershipHost {
1824
+ readonly platform: NodeJS.Platform;
1825
+ readonly read: (file: string) => string;
1826
+ /** Writes a temporary claim or survivor record exclusively with flag wx. */
1827
+ readonly write: (file: string, text: string) => void;
1828
+ readonly link: (source: string, target: string) => void;
1829
+ readonly remove: (file: string) => void;
1830
+ readonly alive: (pid: number) => boolean;
1831
+ }
1832
+
1833
+ /**
1834
+ * Carries the typed values and tokens of a strictly parsed capture command line.
1835
+ *
1836
+ * @example
1837
+ * ```ts
1838
+ * const parsed: CaptureParsedArguments<typeof CAPTURE_COMMAND_OPTIONS.journey> = readCaptureOptions(argv, CAPTURE_COMMAND_OPTIONS.journey, usage)
1839
+ * ```
1840
+ */
1841
+ export declare type CaptureParsedArguments<Options extends ParseArgsOptionsConfig> = {
1842
+ readonly [Key in keyof ReturnType<typeof parseArgs<{
1843
+ options: Options;
1844
+ tokens: true;
1845
+ strict: true;
1846
+ allowPositionals: true;
1847
+ }>>]: Readonly<ReturnType<typeof parseArgs<{
1848
+ options: Options;
1849
+ tokens: true;
1850
+ strict: true;
1851
+ allowPositionals: true;
1852
+ }>>[Key]>;
1853
+ };
1854
+
1855
+ /**
1856
+ * Carries a decoded RGB image for the image checks and the contact sheets.
1857
+ *
1858
+ * @example
1859
+ * ```ts
1860
+ * const picture: CapturePicture = { width: 1, height: 1, pixels: Uint8Array.from([255, 255, 255]) }
1861
+ * ```
1862
+ */
1863
+ export declare interface CapturePicture {
1864
+ readonly width: number;
1865
+ readonly height: number;
1866
+ readonly pixels: Uint8Array;
1867
+ }
1868
+
1869
+ /** Bounds a PNG's decoded pixels, side length, and encoded bytes.
1870
+ * @example
1871
+ * ```ts
1872
+ * const limits: CapturePngLimits = { pixels: 100, side: 10, bytes: 492 }
1873
+ * ```
1874
+ */
1875
+ export declare interface CapturePngLimits {
1876
+ readonly pixels: number;
1877
+ readonly side: number;
1878
+ readonly bytes: number;
1879
+ }
1880
+
1881
+ /**
1882
+ * Supplies a host-authorized physical portfolio root without repeating its states or variants.
1883
+ *
1884
+ * @example
1885
+ * ```ts
1886
+ * const root: CapturePortfolioRoot = { portfolio: 'states', directory: 'tmp/captures/states', scoped: true }
1887
+ * ```
1888
+ */
1889
+ export declare interface CapturePortfolioRoot {
1890
+ readonly portfolio: string;
1891
+ readonly directory: string;
1892
+ readonly scoped: boolean;
1893
+ }
1894
+
1895
+ /**
1896
+ * Reads the selected population's frames and reports their freshness, mixed observations, and coverage.
1897
+ *
1898
+ * @remarks
1899
+ * A successful preflight is iteration evidence and never assembled-portfolio acceptance. The reader
1900
+ * reads the host's wrapper through a `CaptureDiscovery`, the consumer's own Vitest in discovery
1901
+ * mode, and reads its projects the way the runner does: it names no portfolio, owner, variant, or
1902
+ * path the wrapper does not declare, and it imports neither Vite nor Vitest. It
1903
+ * judges each frame by the artifact the frame's own stamp names, never by a variant's latest file.
1904
+ * Rules that belong to one product, such as a page-title check or a pixel comparison, live in a
1905
+ * host module named by the `checks` option. The reader loads that module through the runtime's own
1906
+ * module loader by its file URL, reads its `CAPTURE_CHECKS` export, a list of readers from a frame to
1907
+ * its findings, and appends every finding to the report.
1908
+ * The wrapper's optional `uniform` owner selectors restrict only mixed observations;
1909
+ * absence judges every scope, and an empty list judges none.
1910
+ *
1911
+ * @example
1912
+ * ```ts
1913
+ * const preflight = new CapturePreflight({
1914
+ * root: process.cwd(),
1915
+ * config: `${process.cwd()}/configs/app/vite.journey.config.ts`,
1916
+ * selection: { selector: 'pages:mail' },
1917
+ * journeys: `${process.cwd()}/tmp/journey`,
1918
+ * })
1919
+ * const exit = await preflight.execute()
1920
+ * ```
1921
+ */
1922
+ export declare class CapturePreflight implements CapturePreflightInterface {
1923
+ #private;
1924
+ /**
1925
+ * Binds one explicit workspace, wrapper, and selection.
1926
+ *
1927
+ * @param options - The host configuration and the exact requested bounds
1928
+ */
1929
+ constructor(options: CaptureReaderOptions);
1930
+ /**
1931
+ * Reads the authenticated selection, uniform scopes, and the host's declared viewports.
1932
+ *
1933
+ * @returns The engine, the selected destinations, the viewports, the uniform scopes, and the primary run directory
1934
+ * @throws Thrown when the wrapper, the registry, or the selection is invalid.
1935
+ *
1936
+ * @example
1937
+ * ```ts
1938
+ * const { population } = await preflight.read()
1939
+ * ```
1940
+ */
1941
+ read(): Promise<CaptureReaderSelection>;
1942
+ /**
1943
+ * Judges every selected frame and returns the mixed observations, freshness, images, and issues.
1944
+ *
1945
+ * @returns The preflight result without upgrading any freshness classification
1946
+ * @throws Thrown when the selection or an artifact cannot be read.
1947
+ *
1948
+ * @example
1949
+ * ```ts
1950
+ * const result = await preflight.check()
1951
+ * ```
1952
+ */
1953
+ check(): Promise<CapturePreflightResult>;
1954
+ /**
1955
+ * Executes the check and prints its report.
1956
+ *
1957
+ * @returns Exit 0 for current frames without defects, 1 for any defect, or 64 for refused usage
1958
+ *
1959
+ * @example
1960
+ * ```ts
1961
+ * const exit = await preflight.execute() // 0
1962
+ * ```
1963
+ */
1964
+ execute(): Promise<number>;
1965
+ }
1966
+
1967
+ /**
1968
+ * Reads the selected population's frames and reports their freshness, mixed observations, and coverage.
1969
+ *
1970
+ * @example
1971
+ * ```ts
1972
+ * const preflight: CapturePreflightInterface = createCapturePreflight(reader)
1973
+ * ```
1974
+ */
1975
+ export declare interface CapturePreflightInterface {
1976
+ /**
1977
+ * Reads the authenticated selection, uniform scopes, and the host's declared viewports.
1978
+ *
1979
+ * @returns The engine, the selected destinations, the viewports, the uniform scopes, and the primary run directory
1980
+ * @throws Thrown when the wrapper, the registry, or the selection is invalid.
1981
+ *
1982
+ * @example
1983
+ * ```ts
1984
+ * const { population } = await preflight.read()
1985
+ * ```
1986
+ */
1987
+ read(): Promise<CaptureReaderSelection>;
1988
+ /**
1989
+ * Judges every selected frame and returns the mixed observations, freshness, images, and issues.
1990
+ *
1991
+ * @returns The preflight result without upgrading any freshness classification
1992
+ * @throws Thrown when the selection or an artifact cannot be read.
1993
+ *
1994
+ * @example
1995
+ * ```ts
1996
+ * const result = await preflight.check()
1997
+ * ```
1998
+ */
1999
+ check(): Promise<CapturePreflightResult>;
2000
+ /**
2001
+ * Executes the check and prints its report.
2002
+ *
2003
+ * @returns Exit 0 for current frames without defects, 1 for any defect, or 64 for refused usage
2004
+ *
2005
+ * @example
2006
+ * ```ts
2007
+ * const exit = await preflight.execute() // 0
2008
+ * ```
2009
+ */
2010
+ execute(): Promise<number>;
2011
+ }
2012
+
2013
+ /**
2014
+ * Reports selected image checks without upgrading their engine freshness classifications.
2015
+ *
2016
+ * @remarks
2017
+ * `mixed` reports dimension mixtures without inferring intended or actual capture mode.
2018
+ * `directory` names the host's primary run directory, which holds the stamped run records.
2019
+ *
2020
+ * @example
2021
+ * ```ts
2022
+ * const result = await preflight.check()
2023
+ * result.issues // readonly string[]
2024
+ * ```
2025
+ */
2026
+ export declare interface CapturePreflightResult {
2027
+ readonly mixed: readonly string[];
2028
+ readonly variants: readonly CaptureProducer[];
2029
+ readonly directory: string;
2030
+ readonly selection: CaptureReadResult;
2031
+ readonly freshness: CaptureCheckResult;
2032
+ readonly images: readonly CaptureImageResult[];
2033
+ readonly issues: readonly string[];
2034
+ }
2035
+
2036
+ /**
2037
+ * Declares the viewport one wrapper project produces beside the project's own name.
2038
+ *
2039
+ * @remarks
2040
+ * `project` is the Vitest project label, which a destination names as its producer. The geometry
2041
+ * is the viewport the wrapper declares for that project's producing variant, never one derived from
2042
+ * an output name.
2043
+ *
2044
+ * @example
2045
+ * ```ts
2046
+ * const producer: CaptureProducer = { project: 'journey:light-390', name: 'light-390', width: 390, height: 844 }
2047
+ * ```
2048
+ */
2049
+ export declare interface CaptureProducer extends CaptureViewport {
2050
+ readonly project: string;
2051
+ }
2052
+
2053
+ /**
2054
+ * Preserves the wrapper's host declarations, including optional uniform scopes, for consumers.
2055
+ *
2056
+ * @remarks
2057
+ * `name` is the Vitest project label the runner passes to `--project`, `variant` is the one
2058
+ * producing variant that project runs, and `variants` lists every variant the wrapper declares.
2059
+ * `directory` is the absolute primary portfolio root and `record` the run record template.
2060
+ * `inputs` bounds attribution. `final` is the full name of the case that closes a variant's
2061
+ * run, `first` is the variant a frame capture stages alone before the rest, and `portfolios`
2062
+ * authorizes every physical root a selector may reach through the primary registry. `standalone`
2063
+ * lists the roots that keep their own registry, manifest, and lookups beside their directory and
2064
+ * have no stamping route; a selector or `--portfolio` that names one reads through that root
2065
+ * alone. The runner validates uniqueness, tag syntax, references, and containment of every one
2066
+ * of them. `uniform` optionally lists unique valid owner selectors whose frames the preflight
2067
+ * judges for mixed observations. Default: every scope. An empty list judges none. Every project must
2068
+ * agree on the declaration, including its absence; order does not matter. Uniform scopes never
2069
+ * restrict freshness, coverage, or host checks.
2070
+ *
2071
+ * @example
2072
+ * ```ts
2073
+ * const project: CaptureProject = {
2074
+ * name: 'journey:light-390',
2075
+ * variant: 'light-390',
2076
+ * tags: ['owner:pages:mail'],
2077
+ * variants: ['light-390'],
2078
+ * directory: `${process.cwd()}/tmp/captures/states`,
2079
+ * record: 'tmp/captures/states/runs/a/light-390.json',
2080
+ * inputs: ['src/**'],
2081
+ * final: 'showcase journeys places every registered state and writes the variant artifact',
2082
+ * first: 'light-390',
2083
+ * portfolios: [{ portfolio: 'states', directory: 'tmp/captures/states', scoped: true }],
2084
+ * standalone: [],
2085
+ * }
2086
+ * ```
2087
+ */
2088
+ export declare interface CaptureProject {
2089
+ readonly name: string;
2090
+ readonly variant: string;
2091
+ readonly tags: readonly string[];
2092
+ readonly variants: readonly string[];
2093
+ readonly directory: string;
2094
+ readonly record: string;
2095
+ readonly inputs: readonly string[];
2096
+ readonly final: string;
2097
+ readonly first: string;
2098
+ readonly uniform?: readonly string[];
2099
+ readonly portfolios: readonly CapturePortfolioRoot[];
2100
+ readonly standalone: readonly CapturePortfolioRoot[];
2101
+ }
2102
+
2103
+ /**
2104
+ * Reports validated project evidence, retaining empty successful selections explicitly.
2105
+ *
2106
+ * @example
2107
+ * ```ts
2108
+ * const result: CaptureProjectResult = {
2109
+ * project: 'journey:light-390',
2110
+ * variant: 'light-390',
2111
+ * record: { file: 'tmp/captures/states/runs/a/narrow/light-390.json', digest },
2112
+ * declarations: [],
2113
+ * passed: [],
2114
+ * }
2115
+ * ```
2116
+ */
2117
+ export declare interface CaptureProjectResult {
2118
+ readonly project: string;
2119
+ readonly variant: string;
2120
+ readonly record: {
2121
+ readonly file: string;
2122
+ readonly digest: string;
2123
+ };
2124
+ readonly declarations: readonly CaptureDeclaration[];
2125
+ readonly passed: readonly string[];
2126
+ }
2127
+
2128
+ /**
2129
+ * Preserves one project's declared patterns and sorted expansion before execution.
2130
+ *
2131
+ * @example
2132
+ * ```ts
2133
+ * const snapshot: CaptureProjectSnapshot = { project: 'journey:light-390', inputs: digest }
2134
+ * ```
2135
+ */
2136
+ export declare interface CaptureProjectSnapshot {
2137
+ readonly project: string;
2138
+ readonly inputs: CaptureDigest;
2139
+ }
2140
+
2141
+ /**
2142
+ * Carries parsed reader arguments and an optional contact-sheet output directory.
2143
+ *
2144
+ * @example
2145
+ * ```ts
2146
+ * const command: CaptureReaderCommand = { reader, output: '/repo/tmp/sheets' }
2147
+ * ```
2148
+ */
2149
+ export declare interface CaptureReaderCommand {
2150
+ readonly reader: CaptureReaderOptions;
2151
+ readonly output?: string;
2152
+ }
2153
+
2154
+ /**
2155
+ * Supplies the wrapper path, the journey artifact directory, and the request directory a reader command line falls back to.
2156
+ *
2157
+ * @remarks
2158
+ * All are repository-relative; the command line's `--config` and `--journeys` replace the first two.
2159
+ * An omitted `requests` is `CAPTURE_DEFAULTS.requests`.
2160
+ *
2161
+ * @example
2162
+ * ```ts
2163
+ * const defaults: CaptureReaderDefaults = { config: 'configs/app/vite.journey.config.ts', journeys: 'tmp/journey' }
2164
+ * ```
2165
+ */
2166
+ export declare interface CaptureReaderDefaults {
2167
+ readonly config: string;
2168
+ readonly journeys: string;
2169
+ readonly requests?: string;
2170
+ }
2171
+
2172
+ /**
2173
+ * Configures a read-only capture consumer using the wrapper's host declarations.
2174
+ *
2175
+ * @remarks
2176
+ * `root` is the absolute workspace and `config` the absolute wrapper path. `selection` bounds the
2177
+ * population, and `journeys` is the absolute directory of journey artifacts. `checks`, when
2178
+ * supplied, is the path of a module, absolute or relative to `root`, that exports the host's
2179
+ * `CAPTURE_CHECKS` list of frame readers. The reader loads it through the runtime's own module
2180
+ * loader by the module's file URL, so a TypeScript module needs a Node that strips types.
2181
+ * `requests` is the repository-relative directory that holds the discovery request; default:
2182
+ * `CAPTURE_DEFAULTS.requests`.
2183
+ * `deadline` bounds the discovery child in milliseconds; default: `CAPTURE_DISCOVERY.deadline`.
2184
+ * `stdout` receives the report line and `stderr` each refusal; default: the process streams.
2185
+ *
2186
+ * @example
2187
+ * ```ts
2188
+ * const reader: CaptureReaderOptions = {
2189
+ * root: process.cwd(),
2190
+ * config: `${process.cwd()}/configs/app/vite.journey.config.ts`,
2191
+ * selection: { selector: 'pages:mail' },
2192
+ * journeys: `${process.cwd()}/tmp/journey`,
2193
+ * checks: 'tests/setupCapture.ts',
2194
+ * }
2195
+ * ```
2196
+ */
2197
+ export declare interface CaptureReaderOptions {
2198
+ readonly root: string;
2199
+ readonly config: string;
2200
+ readonly selection: CaptureReadOptions;
2201
+ readonly journeys: string;
2202
+ readonly checks?: string;
2203
+ readonly requests?: string;
2204
+ readonly deadline?: number;
2205
+ readonly stdout?: CaptureWriteHandler;
2206
+ readonly stderr?: CaptureWriteHandler;
2207
+ }
2208
+
2209
+ /**
2210
+ * Returns a reader's authenticated selection, uniform scopes, and engine for pixel classification.
2211
+ *
2212
+ * @remarks
2213
+ * `directory` is the host's primary run directory, which holds the stamped run records. `uniform`
2214
+ * preserves the wrapper's uniform scopes for mixed observations only. Default: every scope. An
2215
+ * empty list judges none, while the authenticated selection retains every frame for the other checks.
2216
+ *
2217
+ * @example
2218
+ * ```ts
2219
+ * const { population, variants } = await preflight.read()
2220
+ * ```
2221
+ */
2222
+ export declare interface CaptureReaderSelection {
2223
+ readonly integrity: CaptureIntegrityInterface;
2224
+ readonly population: CaptureReadResult;
2225
+ readonly variants: readonly CaptureProducer[];
2226
+ readonly directory: string;
2227
+ readonly uniform?: readonly string[];
2228
+ }
2229
+
2230
+ /**
2231
+ * Selects a declaration population without requiring current images or passing state lookups.
2232
+ *
2233
+ * @remarks
2234
+ * Omitted variants derive from authenticated output mappings, and an explicit empty list
2235
+ * refuses. Every supplied selector, state, case, portfolio, and output variant remains a bound.
2236
+ *
2237
+ * @example
2238
+ * ```ts
2239
+ * const options: CaptureReadOptions = { selector: 'pages:mail', variants: ['light-390'] }
2240
+ * ```
2241
+ */
2242
+ export declare interface CaptureReadOptions extends CaptureSelection {
2243
+ readonly variants?: readonly string[];
2244
+ readonly portfolio?: string;
2245
+ }
2246
+
2247
+ /**
2248
+ * Returns the exact current declaration destinations and their complete-anchor identity.
2249
+ *
2250
+ * @example
2251
+ * ```ts
2252
+ * const { registry, entries } = await integrity.read({ selector: 'pages:mail' })
2253
+ * ```
2254
+ */
2255
+ export declare interface CaptureReadResult {
2256
+ readonly registry: string;
2257
+ readonly entries: readonly CaptureDestination[];
2258
+ }
2259
+
2260
+ /**
2261
+ * Supplies a verifier's actual process outcome and exact reporter bytes for registry import.
2262
+ *
2263
+ * @example
2264
+ * ```ts
2265
+ * const input: CaptureReceiptInput = { receipt, report: text, outcome: { code: 0, signal: null }, capped: false }
2266
+ * ```
2267
+ */
2268
+ export declare interface CaptureReceiptInput {
2269
+ readonly receipt: CaptureReceipt;
2270
+ readonly report: string;
2271
+ readonly outcome: CaptureExecutionResult;
2272
+ readonly capped: boolean;
2273
+ }
2274
+
2275
+ /**
2276
+ * Refreshes the accepted registry from one complete capture-free journey per producing variant.
2277
+ *
2278
+ * @remarks
2279
+ * The refresh is the one route that bootstraps or replaces the registry the stage transaction
2280
+ * requires, so it cannot stamp through the integrity engine. It reads the wrapper through the same
2281
+ * discovery the runner uses, takes the same invocation entity, request file, and Vitest child, and runs
2282
+ * each producing variant as a stage of its own with the `all` selector and no capture variable. It
2283
+ * reads each stage's reporter and final record, takes the project's input population before and
2284
+ * after, and builds the receipts through `buildCaptureRegistry`. The registry is written to a
2285
+ * candidate beside its target, read back through the integrity engine, and only then renamed into
2286
+ * place, so a registry the engine would refuse never replaces a good one. With `--variant`, the
2287
+ * existing registry's receipts for the other declared variants are kept. It never widens a scoped
2288
+ * run into a refresh and refuses while another runner holds a request file in the request directory.
2289
+ *
2290
+ * @example
2291
+ * ```ts
2292
+ * const registrar = new CaptureRegistrar({
2293
+ * root: process.cwd(),
2294
+ * config: 'configs/app/vite.journey.config.ts',
2295
+ * requests: 'tmp/capture',
2296
+ * argv: [],
2297
+ * })
2298
+ * const exit = await registrar.execute()
2299
+ * ```
2300
+ */
2301
+ export declare class CaptureRegistrar implements CaptureRegistrarInterface {
2302
+ #private;
2303
+ /**
2304
+ * Binds the workspace, the wrapper default, the request directory, and the command line.
2305
+ *
2306
+ * @param options - The workspace, the wrapper default, the request directory, the command line, and optional output writers
2307
+ */
2308
+ constructor(options: CaptureRegistrarOptions);
2309
+ execute(): Promise<number>;
2310
+ }
2311
+
2312
+ /**
2313
+ * Refreshes the accepted registry from one complete capture-free journey per producing variant.
2314
+ *
2315
+ * @example
2316
+ * ```ts
2317
+ * const registrar: CaptureRegistrarInterface = createCaptureRegistrar(options)
2318
+ * const exit = await registrar.execute()
2319
+ * ```
2320
+ */
2321
+ export declare interface CaptureRegistrarInterface {
2322
+ /**
2323
+ * Runs each producing variant's complete journey, imports the receipts, and publishes the registry.
2324
+ *
2325
+ * @returns Exit 0 for a published registry, 1 for a refused, failed, or interrupted refresh, or 64 for refused usage
2326
+ *
2327
+ * @example
2328
+ * ```ts
2329
+ * const exit = await registrar.execute() // 0
2330
+ * ```
2331
+ */
2332
+ execute(): Promise<number>;
2333
+ }
2334
+
2335
+ /**
2336
+ * Configures one registry refresh: its workspace, wrapper default, request directory, and command line.
2337
+ *
2338
+ * @remarks
2339
+ * `root` is the absolute workspace path. `config` is the repository-relative wrapper default, used
2340
+ * when the command line names no `--config`. `requests` is the repository-relative directory that
2341
+ * holds the request file the wrapper reads back. `argv` is the command line after the subcommand.
2342
+ * `stdout` and `stderr` receive the refresh's own lines and each child's output; default: the
2343
+ * process streams. `deadline` bounds the discovery child in milliseconds; default:
2344
+ * `CAPTURE_DISCOVERY.deadline`.
2345
+ *
2346
+ * @example
2347
+ * ```ts
2348
+ * const options: CaptureRegistrarOptions = {
2349
+ * root: process.cwd(),
2350
+ * config: 'configs/app/vite.journey.config.ts',
2351
+ * requests: 'tmp/capture',
2352
+ * argv: ['--variant', 'light-390'],
2353
+ * }
2354
+ * ```
2355
+ */
2356
+ export declare interface CaptureRegistrarOptions {
2357
+ readonly root: string;
2358
+ readonly config: string;
2359
+ readonly requests: string;
2360
+ readonly argv: readonly string[];
2361
+ readonly stdout?: CaptureWriteHandler;
2362
+ readonly stderr?: CaptureWriteHandler;
2363
+ readonly deadline?: number;
2364
+ }
2365
+
2366
+ /**
2367
+ * Carries the parsed registry command line: the wrapper, the variants to refresh, and the mode.
2368
+ *
2369
+ * @remarks `config` is absolute. An empty `variants` list refreshes every declared producing variant.
2370
+ *
2371
+ * @example
2372
+ * ```ts
2373
+ * const parsed: CaptureRegistryArguments = { config: '/repo/configs/vite.journey.config.ts', variants: [] }
2374
+ * ```
2375
+ */
2376
+ export declare interface CaptureRegistryArguments {
2377
+ readonly config: string;
2378
+ readonly variants: readonly string[];
2379
+ readonly mode?: string;
2380
+ }
2381
+
2382
+ /**
2383
+ * Configures how a wrapper reads the runner's request for its own Vitest process.
2384
+ *
2385
+ * @remarks
2386
+ * `ppid` is the wrapper process's parent id, which names the request file the runner wrote.
2387
+ * `argv` is the wrapper process's own arguments after its executable, which the request records
2388
+ * exactly. `directory` is the directory that holds request files, absolute or relative to the
2389
+ * working directory. The runner names the directory it publishes to in the child's environment, so
2390
+ * a wrapper that omits `directory` reads the runner's own and never has to repeat it; a wrapper
2391
+ * that names one declares it, and it must be the runner's. With neither, the directory is
2392
+ * `CAPTURE_DEFAULTS.requests`. `config` is the repository-relative, slash-separated path of the
2393
+ * wrapper the request must name. `owners` lists every owner path the wrapper declares and
2394
+ * `variants` every variant name it declares.
2395
+ *
2396
+ * @example
2397
+ * ```ts
2398
+ * const options: CaptureRequestOptions = {
2399
+ * ppid: process.ppid,
2400
+ * argv: process.argv.slice(1),
2401
+ * config: 'configs/vite.journey.config.ts',
2402
+ * owners: ['pages:mail'],
2403
+ * variants: ['light-390'],
2404
+ * }
2405
+ * ```
2406
+ */
2407
+ export declare interface CaptureRequestOptions {
2408
+ readonly ppid: number;
2409
+ readonly argv: readonly string[];
2410
+ readonly directory?: string;
2411
+ readonly config: string;
2412
+ readonly owners: readonly string[];
2413
+ readonly variants: readonly string[];
2414
+ }
2415
+
2416
+ /**
2417
+ * Removes one invocation's published request during shutdown.
2418
+ *
2419
+ * @example
2420
+ * ```ts
2421
+ * const retract: CaptureRetractionHandler = () => invocation.retract()
2422
+ * ```
2423
+ */
2424
+ export declare type CaptureRetractionHandler = () => void;
2425
+
2426
+ /**
2427
+ * Binds a decoded run record to the physical file whose digest authenticated it.
2428
+ *
2429
+ * @example
2430
+ * ```ts
2431
+ * const evidence: CaptureRunEvidence = { file: snapshot, run }
2432
+ * ```
2433
+ */
2434
+ export declare interface CaptureRunEvidence {
2435
+ readonly file: CaptureFileSnapshot;
2436
+ readonly run: CaptureRun;
2437
+ }
2438
+
2439
+ /**
2440
+ * Drives selected owners through one journey stage or staged frame captures.
2441
+ *
2442
+ * @remarks
2443
+ * The wrapper and the installed Vitest supply the registry and the execution protocol, and the
2444
+ * wrapper's provided values supply every name the runner uses: the variants, the first-stage
2445
+ * variant, the final case, and the portfolio roots. The runner never loads the wrapper itself: a
2446
+ * `CaptureDiscovery` runs the consumer's installed Vitest in discovery mode and reads back the host
2447
+ * description the wrapper writes, so the runner imports neither Vite nor Vitest. It creates one
2448
+ * discovery invocation per `execute` call and a separate invocation per changed owner, and holds
2449
+ * none of that call's state itself.
2450
+ *
2451
+ * @example
2452
+ * ```ts
2453
+ * const runner = new CaptureRunner({
2454
+ * command: 'journey',
2455
+ * root: process.cwd(),
2456
+ * config: 'configs/app/vite.journey.config.ts',
2457
+ * requests: 'tmp/units',
2458
+ * argv: ['pages:mail', '--variant', 'light-390'],
2459
+ * })
2460
+ * const exit = await runner.execute()
2461
+ * ```
2462
+ */
2463
+ export declare class CaptureRunner implements CaptureRunnerInterface {
2464
+ #private;
2465
+ /**
2466
+ * Binds the command, the workspace, and the command line.
2467
+ *
2468
+ * @param options - The command, the workspace, the wrapper default, the request directory, and the command line
2469
+ */
2470
+ constructor(options: CaptureRunnerOptions);
2471
+ execute(): Promise<number>;
2472
+ }
2473
+
2474
+ /**
2475
+ * Carries parsed runner arguments while leaving omitted selectors available to the usage diagnostic.
2476
+ *
2477
+ * @example
2478
+ * ```ts
2479
+ * const parsed: CaptureRunnerArguments = { config: '/repo/configs/vite.journey.config.ts', variants: [] }
2480
+ * ```
2481
+ */
2482
+ export declare interface CaptureRunnerArguments {
2483
+ readonly selector?: string;
2484
+ readonly changed?: string;
2485
+ readonly plan?: boolean;
2486
+ readonly config: string;
2487
+ readonly variants: readonly string[];
2488
+ readonly case?: string;
2489
+ readonly state?: string;
2490
+ readonly portfolio?: string;
2491
+ }
2492
+
2493
+ /**
2494
+ * Drives selected owners through one journey stage or staged frame captures.
2495
+ *
2496
+ * @example
2497
+ * ```ts
2498
+ * const runner: CaptureRunnerInterface = createCaptureRunner(options)
2499
+ * const exit = await runner.execute()
2500
+ * ```
2501
+ */
2502
+ export declare interface CaptureRunnerInterface {
2503
+ /**
2504
+ * Executes the command line without widening its owner or variant selection.
2505
+ *
2506
+ * @returns Exit 0 for passed work, 1 for failure or no work, or 64 for refused usage
2507
+ *
2508
+ * @example
2509
+ * ```ts
2510
+ * const exit = await runner.execute() // 0
2511
+ * ```
2512
+ */
2513
+ execute(): Promise<number>;
2514
+ }
2515
+
2516
+ /**
2517
+ * Configures one runner invocation: its command, its workspace, and the command line it reads.
2518
+ *
2519
+ * @remarks
2520
+ * `root` is the absolute workspace path. `config` is the repository-relative wrapper default,
2521
+ * used when the command line names no `--config`. `requests` is the repository-relative
2522
+ * directory that holds the runner's request file. The runner hands it to every child it spawns in
2523
+ * the `CAPTURE_REQUESTS` variable, so a wrapper that names no directory of its own reads the same
2524
+ * one. `argv` is the command line after the entry name. `stdout` and `stderr` receive the
2525
+ * runner's own lines and each child's output; default: the process streams. `integrity` creates
2526
+ * the engine from the options the runner derives from the wrapper; default: the package's own
2527
+ * engine. `deadline` bounds the discovery child in milliseconds; default:
2528
+ * `CAPTURE_DISCOVERY.deadline`.
2529
+ *
2530
+ * @example
2531
+ * ```ts
2532
+ * const options: CaptureRunnerOptions = {
2533
+ * command: 'journey',
2534
+ * root: process.cwd(),
2535
+ * config: 'configs/app/vite.journey.config.ts',
2536
+ * requests: 'tmp/units',
2537
+ * argv: ['pages:mail', '--variant', 'light-390'],
2538
+ * }
2539
+ * ```
2540
+ */
2541
+ export declare interface CaptureRunnerOptions {
2542
+ readonly command: CaptureCommand;
2543
+ readonly root: string;
2544
+ readonly config: string;
2545
+ readonly requests: string;
2546
+ readonly argv: readonly string[];
2547
+ readonly stdout?: CaptureWriteHandler;
2548
+ readonly stderr?: CaptureWriteHandler;
2549
+ readonly integrity?: CaptureIntegrityHandler;
2550
+ readonly deadline?: number;
2551
+ }
2552
+
2553
+ /**
2554
+ * Carries everything every stage of one invocation shares.
2555
+ *
2556
+ * @remarks
2557
+ * `directory` is the repository-relative primary portfolio root, `config` the repository-relative
2558
+ * wrapper path, and `final` the full name of the case that closes a variant's run. `filter` is
2559
+ * the tag expression. `case` and `state` appear only when the command line named them, and `case`
2560
+ * holds the resolved declaring case once a state selects one. `command` is the request command
2561
+ * every stage records.
2562
+ *
2563
+ * @example
2564
+ * ```ts
2565
+ * const plan: CaptureRunPlan = {
2566
+ * command: 'journey',
2567
+ * projects: [project],
2568
+ * selector: 'pages:mail',
2569
+ * filter: 'owner:pages:mail',
2570
+ * final: 'closes the run',
2571
+ * directory: 'tmp/captures/states',
2572
+ * config: 'configs/vite.journey.config.ts',
2573
+ * }
2574
+ * ```
2575
+ */
2576
+ export declare interface CaptureRunPlan {
2577
+ readonly command: CaptureRequest['command'];
2578
+ readonly projects: readonly CaptureProject[];
2579
+ readonly selector: string;
2580
+ readonly filter: string;
2581
+ readonly case?: string;
2582
+ readonly state?: string;
2583
+ readonly final: string;
2584
+ readonly directory: string;
2585
+ readonly config: string;
2586
+ }
2587
+
2588
+ /**
2589
+ * Holds one contact-sheet cell: a frame's destination, its shrunk picture, and what the sheet reports about it.
2590
+ *
2591
+ * @remarks
2592
+ * `source` is the decoded image's size, `undefined` when the image could not be read, and `factor`
2593
+ * is the whole-number reduction applied. `clipped` is true when the shrunk picture was cut at the
2594
+ * sheet's height limit.
2595
+ *
2596
+ * @example
2597
+ * ```ts
2598
+ * const cell: CaptureSheetCell = { entry, picture, source: undefined, factor: 1, clipped: false, freshness: undefined }
2599
+ * ```
2600
+ */
2601
+ export declare interface CaptureSheetCell {
2602
+ readonly entry: CaptureDestination;
2603
+ readonly picture: CapturePicture;
2604
+ readonly source: {
2605
+ readonly width: number;
2606
+ readonly height: number;
2607
+ readonly bytes: number;
2608
+ } | undefined;
2609
+ readonly factor: number;
2610
+ readonly clipped: boolean;
2611
+ readonly freshness: CaptureFreshness | undefined;
2612
+ }
2613
+
2614
+ /**
2615
+ * Holds the cells of one portfolio, owner, and state side by side as one composite picture.
2616
+ *
2617
+ * @example
2618
+ * ```ts
2619
+ * const group: CaptureSheetGroup = { identity: '["states","pages:mail","mail-screen"]', cells: [], picture }
2620
+ * ```
2621
+ */
2622
+ export declare interface CaptureSheetGroup {
2623
+ readonly identity: string;
2624
+ readonly cells: readonly CaptureSheetCell[];
2625
+ readonly picture: CapturePicture;
2626
+ }
2627
+
2628
+ /**
2629
+ * Carries a contact-sheet output request separately from the population selection.
2630
+ *
2631
+ * @example
2632
+ * ```ts
2633
+ * const options: CaptureSheetOptions = { reader, output: '/repo/tmp/sheets' }
2634
+ * ```
2635
+ */
2636
+ export declare interface CaptureSheetOptions {
2637
+ readonly reader: CaptureReaderOptions;
2638
+ readonly output: string;
2639
+ }
2640
+
2641
+ /**
2642
+ * Holds one written sheet: its file name, the rows it stacks, and the composite picture.
2643
+ *
2644
+ * @example
2645
+ * ```ts
2646
+ * const page: CaptureSheetPage = { file: 'sheet-001.png', rows: [], picture }
2647
+ * ```
2648
+ */
2649
+ export declare interface CaptureSheetPage {
2650
+ readonly file: string;
2651
+ readonly rows: readonly CaptureSheetRow[];
2652
+ readonly picture: CapturePicture;
2653
+ }
2654
+
2655
+ /**
2656
+ * Holds a pair of groups side by side as one composite picture.
2657
+ *
2658
+ * @example
2659
+ * ```ts
2660
+ * const row: CaptureSheetRow = { groups: [], picture }
2661
+ * ```
2662
+ */
2663
+ export declare interface CaptureSheetRow {
2664
+ readonly groups: readonly CaptureSheetGroup[];
2665
+ readonly picture: CapturePicture;
2666
+ }
2667
+
2668
+ /**
2669
+ * Composes exactly the authenticated sparse state and output pairs for iteration review.
2670
+ *
2671
+ * @remarks
2672
+ * Sheets remain preflight artifacts, never assembled-portfolio acceptance. The class reads the
2673
+ * selection through `CapturePreflight`, so it judges the same population the preflight does and
2674
+ * keeps its refusals. It writes the sheets, an index of every cell, and a notes document into a new
2675
+ * directory that is contained in the workspace, has an existing parent, and lies outside every
2676
+ * selected capture directory. A frame whose image cannot be read shows as a red mark and is indexed
2677
+ * as `missing`.
2678
+ *
2679
+ * @example
2680
+ * ```ts
2681
+ * const sheets = new CaptureSheets({ reader, output: `${process.cwd()}/tmp/sheets` })
2682
+ * const exit = await sheets.execute()
2683
+ * ```
2684
+ */
2685
+ export declare class CaptureSheets implements CaptureSheetsInterface {
2686
+ #private;
2687
+ /**
2688
+ * Binds a read selection and a new output directory.
2689
+ *
2690
+ * @param options - The explicit host, selection, and sheet destination
2691
+ */
2692
+ constructor(options: CaptureSheetOptions);
2693
+ /**
2694
+ * Reads selected physical images, writes complete indexed sheets, and retains all refusals.
2695
+ *
2696
+ * @returns Exit 0 for current selected images without preflight defects, 1 for any defect or containment refusal, or 64 for refused usage
2697
+ *
2698
+ * @example
2699
+ * ```ts
2700
+ * const exit = await sheets.execute() // 0
2701
+ * ```
2702
+ */
2703
+ execute(): Promise<number>;
2704
+ }
2705
+
2706
+ /**
2707
+ * Composes exactly the authenticated sparse state and output pairs for iteration review.
2708
+ *
2709
+ * @remarks Sheets remain preflight artifacts, never assembled-portfolio acceptance.
2710
+ *
2711
+ * @example
2712
+ * ```ts
2713
+ * const sheets: CaptureSheetsInterface = createCaptureSheets(options)
2714
+ * ```
2715
+ */
2716
+ export declare interface CaptureSheetsInterface {
2717
+ /**
2718
+ * Reads selected physical images, writes complete indexed sheets, and retains all refusals.
2719
+ *
2720
+ * @returns Exit 0 for current selected images without preflight defects, 1 for any defect or containment refusal, or 64 for refused usage
2721
+ *
2722
+ * @example
2723
+ * ```ts
2724
+ * const exit = await sheets.execute() // 0
2725
+ * ```
2726
+ */
2727
+ execute(): Promise<number>;
2728
+ }
2729
+
2730
+ /**
2731
+ * Holds a stage boundary's input populations and existing output identities.
2732
+ *
2733
+ * @remarks
2734
+ * `time` is epoch milliseconds for comparing physical file timestamps; monotonic operation
2735
+ * durations use `performance.now` separately. Snapshots are engine-owned readings, never a
2736
+ * caller-supplied substitute for taking the pre-execution snapshot.
2737
+ *
2738
+ * @example
2739
+ * ```ts
2740
+ * const snapshot: CaptureSnapshot = { time: Date.now(), projects: [], files: [] }
2741
+ * ```
2742
+ */
2743
+ export declare interface CaptureSnapshot {
2744
+ readonly time: number;
2745
+ readonly projects: readonly CaptureProjectSnapshot[];
2746
+ readonly files: readonly CaptureFileSnapshot[];
2747
+ }
2748
+
2749
+ /**
2750
+ * Binds a stage transaction to its exact request, projects, reporter, and process boundary.
2751
+ *
2752
+ * @remarks
2753
+ * `report` is the invocation-specific repository-relative Vitest JSON reporter path. Before
2754
+ * `execute`, the engine validates paths and snapshots each project's expanded input membership
2755
+ * and bytes, existing image identities, records, and reporter. After successful execution, it
2756
+ * validates every selected record and reporter result, including empty records, before
2757
+ * committing any member. Attributed paths outside a project's initial population refuse, and so
2758
+ * do changed attributed bytes or membership. `signal` propagates runner interruption and is
2759
+ * checked before execution and commit. A capture commits one manifest replacement. A journey
2760
+ * requires empty image entries and publishes passing lookups and full-collection receipts in its
2761
+ * separate journal, leaving manifest bytes unchanged.
2762
+ *
2763
+ * @example
2764
+ * ```ts
2765
+ * const options: CaptureStageOptions = {
2766
+ * request,
2767
+ * projects: [project],
2768
+ * report: 'tmp/captures/states/runs/a/journey-selected.json',
2769
+ * execute: async () => ({ code: 0, signal: null }),
2770
+ * }
2771
+ * ```
2772
+ */
2773
+ export declare interface CaptureStageOptions {
2774
+ readonly request: CaptureRequest;
2775
+ readonly projects: readonly CaptureStageProject[];
2776
+ readonly report: string;
2777
+ readonly execute: CaptureExecutionHandler;
2778
+ readonly signal?: AbortSignal;
2779
+ }
2780
+
2781
+ /**
2782
+ * Names one planned stage and the variants it runs in one Vitest process.
2783
+ *
2784
+ * @example
2785
+ * ```ts
2786
+ * const stage: CaptureStagePlan = { name: 'selected', variants: ['light-390', 'dark-390'] }
2787
+ * ```
2788
+ */
2789
+ export declare interface CaptureStagePlan {
2790
+ readonly name: 'selected' | 'narrow' | 'rest';
2791
+ readonly variants: readonly string[];
2792
+ }
2793
+
2794
+ /**
2795
+ * Supplies one selected project's expected final record and bounded input population.
2796
+ *
2797
+ * @remarks
2798
+ * `name` is the actual Vitest project name and `variant` is its producing variant, which can
2799
+ * differ from a destination's output variant. `record` is the repository-relative path bound to
2800
+ * the active request, never a raw direct-run substitute. `inputs` comes from that project's
2801
+ * wrapper provide and bounds attribution even on a first capture. Every requested variant
2802
+ * requires a project and a final record, including projects whose selected owner population is
2803
+ * inapplicable.
2804
+ *
2805
+ * @example
2806
+ * ```ts
2807
+ * const project: CaptureStageProject = {
2808
+ * name: 'journey:light-390',
2809
+ * variant: 'light-390',
2810
+ * record: 'tmp/captures/states/runs/a/narrow/light-390.json',
2811
+ * inputs: ['src/**'],
2812
+ * }
2813
+ * ```
2814
+ */
2815
+ export declare interface CaptureStageProject {
2816
+ readonly name: string;
2817
+ readonly variant: string;
2818
+ readonly record: string;
2819
+ readonly inputs: readonly string[];
2820
+ }
2821
+
2822
+ /**
2823
+ * Reports the successful stage's committed stamps and validated lookup evidence.
2824
+ *
2825
+ * @remarks
2826
+ * `entries` contains only this stage's image stamps and is empty for a journey. `lookups`
2827
+ * contains this stage's passing case evidence. A partial stage never replaces the last-complete
2828
+ * registry, and refreshed lookups require full collected-declaration equality with that
2829
+ * registry. `duration` is `performance.now` milliseconds spent validating and committing after
2830
+ * child completion, excluding child execution. Failed or interrupted stages reject instead of
2831
+ * returning a partial success result.
2832
+ *
2833
+ * @example
2834
+ * ```ts
2835
+ * const result = await integrity.stamp(options)
2836
+ * result.entries.length // image stamps committed by this stage
2837
+ * ```
2838
+ */
2839
+ export declare interface CaptureStageResult {
2840
+ readonly request: CaptureRequest;
2841
+ readonly projects: readonly CaptureProjectResult[];
2842
+ readonly entries: readonly CaptureStamp[];
2843
+ readonly lookups: readonly CaptureLookup[];
2844
+ readonly duration: number;
2845
+ }
2846
+
2847
+ /**
2848
+ * Selects a freshness population and names the producing variants the host wrapper declares.
2849
+ *
2850
+ * @remarks
2851
+ * `declared` applies only when `variants` is omitted: each declared producing variant needs
2852
+ * full-collection evidence in the registry, so a missing refresh refuses instead of reading as
2853
+ * nothing to check. Auxiliary output variants stay judged through their destinations alone.
2854
+ *
2855
+ * @example
2856
+ * ```ts
2857
+ * const options: CaptureStaleOptions = { selector: 'pages:mail', declared: ['light-390', 'dark-1280'] }
2858
+ * ```
2859
+ */
2860
+ export declare interface CaptureStaleOptions extends CaptureReadOptions {
2861
+ readonly declared?: readonly string[];
2862
+ }
2863
+
2864
+ /**
2865
+ * Begins one independent child termination only after request removal has been attempted.
2866
+ * @example
2867
+ * ```ts
2868
+ * const terminate: CaptureTerminationHandler = () => child.stop()
2869
+ * ```
2870
+ */
2871
+ export declare type CaptureTerminationHandler = () => Promise<boolean>;
2872
+
2873
+ /**
2874
+ * Writes one chunk of runner output to the stream the host chooses.
2875
+ *
2876
+ * @remarks The default writers are `process.stdout` and `process.stderr`.
2877
+ *
2878
+ * @example
2879
+ * ```ts
2880
+ * const write: CaptureWriteHandler = (text) => process.stdout.write(text)
2881
+ * ```
2882
+ */
2883
+ export declare type CaptureWriteHandler = (text: string) => unknown;
2884
+
2885
+ /**
2886
+ * Finds the journey artifact lines that report an uncaught, unhandled, or logged error.
2887
+ *
2888
+ * @param file - The artifact's repository-relative path, which prefixes each finding
2889
+ * @param text - The artifact's text
2890
+ * @returns One finding per matching line
2891
+ *
2892
+ * @example
2893
+ * ```ts
2894
+ * collectCaptureErrors('tmp/journey/light-390.txt', 'ok\nUncaught TypeError') // ['tmp/journey/light-390.txt: Uncaught TypeError']
2895
+ * ```
2896
+ */
2897
+ export declare function collectCaptureErrors(file: string, text: string): readonly string[];
2898
+
2899
+ /**
2900
+ * Groups the selected images whose bytes are identical.
2901
+ *
2902
+ * @param images - The selected images, decoded
2903
+ * @returns One list of files per digest shared by more than one image
2904
+ *
2905
+ * @example
2906
+ * ```ts
2907
+ * collectCaptureIdentical(images) // [['tmp/captures/a.png', 'tmp/captures/b.png']]
2908
+ * ```
2909
+ */
2910
+ export declare function collectCaptureIdentical(images: readonly CaptureImageResult[]): ReadonlyArray<readonly string[]>;
2911
+
2912
+ /**
2913
+ * Composes pictures on the contact-sheet gray background.
2914
+ *
2915
+ * @param pictures - The ordered source cells or rows
2916
+ * @param vertical - If `true`, stacks rows; if `false`, places cells side by side
2917
+ * @param gap - The space between source pictures. Default: 6.
2918
+ * @returns A separately owned composite
2919
+ * @throws Thrown for an empty picture selection.
2920
+ *
2921
+ * @example
2922
+ * ```ts
2923
+ * composeCapturePictures([picture, picture], false).width // picture.width * 2 + 6
2924
+ * ```
2925
+ */
2926
+ export declare function composeCapturePictures(pictures: readonly CapturePicture[], vertical: boolean, gap?: number): CapturePicture;
2927
+
2928
+ /**
2929
+ * Hashes exact source or image bytes with SHA-256.
2930
+ *
2931
+ * @param bytes - The bytes, or the explicitly encoded UTF-8 text
2932
+ * @returns The lowercase hexadecimal digest
2933
+ *
2934
+ * @example
2935
+ * ```ts
2936
+ * computeCaptureHash('') // 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
2937
+ * ```
2938
+ */
2939
+ export declare function computeCaptureHash(bytes: string | Uint8Array): string;
2940
+
2941
+ /**
2942
+ * Computes the registry identity from its authenticated receipts and exact output population.
2943
+ *
2944
+ * @param registry - The registry fields before its digest is attached
2945
+ * @returns The deterministic SHA-256 registry identity
2946
+ *
2947
+ * @example
2948
+ * ```ts
2949
+ * computeRegistryDigest({ version: 1, receipts: [], entries: [] }).length // 64
2950
+ * ```
2951
+ */
2952
+ export declare function computeRegistryDigest(registry: Pick<CaptureRegistry, 'version' | 'receipts' | 'entries'>): string;
2953
+
2954
+ /**
2955
+ * Creates the executable's command dispatcher over a workspace and injected writers.
2956
+ *
2957
+ * @param options - The workspace and the report and diagnostic writers; default: the working directory and the process streams
2958
+ * @returns A new dispatcher whose `execute` runs one command line and returns its exit code
2959
+ *
2960
+ * @example
2961
+ * ```ts
2962
+ * const exit = await createCaptureCLI().execute(['journey', 'pages:mail']) // 0 when the journey passed
2963
+ * ```
2964
+ */
2965
+ export declare function createCaptureCLI(options?: CaptureCLIOptions): CaptureCLIInterface;
2966
+
2967
+ /**
2968
+ * Creates the discovery that reads a consumer's wrapper through the consumer's own Vitest.
2969
+ *
2970
+ * @param options - The workspace, the absolute wrapper path, the invocation that owns the child, and the optional mode and deadline
2971
+ * @returns A new discovery whose `describe` publishes the request and returns the wrapper's host description
2972
+ *
2973
+ * @example
2974
+ * ```ts
2975
+ * const discovery = createCaptureDiscovery({ root: process.cwd(), config, invocation })
2976
+ * const { projects } = await discovery.describe()
2977
+ * ```
2978
+ */
2979
+ export declare function createCaptureDiscovery(options: CaptureDiscoveryRunOptions): CaptureDiscoveryInterface;
2980
+
2981
+ /**
2982
+ * Creates the integrity engine bound to an explicit workspace and host portfolio mapping.
2983
+ *
2984
+ * @param options - The workspace, evidence paths, authorized physical roots, and optional file hash
2985
+ * @returns A new engine that stamps stages, reads declarations, checks freshness, and resolves states
2986
+ * @throws Thrown when the root is not absolute, a path escapes the root, or a portfolio is invalid.
2987
+ *
2988
+ * @example
2989
+ * ```ts
2990
+ * const integrity = createCaptureIntegrity({
2991
+ * root: process.cwd(),
2992
+ * directory: 'tmp/captures/states',
2993
+ * inputs: ['src/**'],
2994
+ * registry: 'tmp/captures/states/registry.json',
2995
+ * manifest: 'tmp/captures/states/manifest.json',
2996
+ * lookups: 'tmp/captures/states/lookups.json',
2997
+ * portfolios: [{ portfolio: 'states', directory: 'tmp/captures/states', scoped: true }],
2998
+ * })
2999
+ * ```
3000
+ */
3001
+ export declare function createCaptureIntegrity(options: CaptureIntegrityOptions): CaptureIntegrityInterface;
3002
+
3003
+ /**
3004
+ * Creates the preflight that judges the selected frames' freshness, mixed observations, and coverage.
3005
+ *
3006
+ * @param options - The workspace, the wrapper, the selection, the journey artifact directory, and optional checks module and output seams
3007
+ * @returns A new preflight whose `execute` prints its report and returns the exit status
3008
+ *
3009
+ * @example
3010
+ * ```ts
3011
+ * const preflight = createCapturePreflight({
3012
+ * root: process.cwd(),
3013
+ * config: `${process.cwd()}/configs/app/vite.journey.config.ts`,
3014
+ * selection: { selector: 'pages:mail' },
3015
+ * journeys: `${process.cwd()}/tmp/journey`,
3016
+ * })
3017
+ * const exit = await preflight.execute() // 0 when every selected frame is current and sound
3018
+ * ```
3019
+ */
3020
+ export declare function createCapturePreflight(options: CaptureReaderOptions): CapturePreflightInterface;
3021
+
3022
+ /**
3023
+ * Creates the registry refresh that runs each producing variant's complete journey and publishes the registry.
3024
+ *
3025
+ * @param options - The workspace, the wrapper default, the request directory, the command line, and optional output seams
3026
+ * @returns A new refresh whose `execute` publishes `registry.json` and returns the exit status
3027
+ *
3028
+ * @example
3029
+ * ```ts
3030
+ * const registrar = createCaptureRegistrar({
3031
+ * root: process.cwd(),
3032
+ * config: 'configs/app/vite.journey.config.ts',
3033
+ * requests: 'tmp/capture',
3034
+ * argv: ['--variant', 'light-390'],
3035
+ * })
3036
+ * const exit = await registrar.execute() // 0 when the registry was published
3037
+ * ```
3038
+ */
3039
+ export declare function createCaptureRegistrar(options: CaptureRegistrarOptions): CaptureRegistrarInterface;
3040
+
3041
+ /**
3042
+ * Creates the runner that drives owner-selected journeys for one command line.
3043
+ *
3044
+ * @param options - The command, the workspace, the wrapper default, the request directory, the command line, and optional output and engine seams
3045
+ * @returns A new runner whose `execute` runs the command and returns its exit status
3046
+ *
3047
+ * @example
3048
+ * ```ts
3049
+ * const runner = createCaptureRunner({
3050
+ * command: 'journey',
3051
+ * root: process.cwd(),
3052
+ * config: 'configs/app/vite.journey.config.ts',
3053
+ * requests: 'tmp/units',
3054
+ * argv: ['pages:mail', '--variant', 'light-390'],
3055
+ * })
3056
+ * const exit = await runner.execute() // 0 when every stage passed
3057
+ * ```
3058
+ */
3059
+ export declare function createCaptureRunner(options: CaptureRunnerOptions): CaptureRunnerInterface;
3060
+
3061
+ /**
3062
+ * Creates the contact-sheet writer for the selected frames.
3063
+ *
3064
+ * @param options - The reader options that select the frames and the new directory that receives the sheets
3065
+ * @returns A new writer whose `execute` writes the sheets and returns the exit status
3066
+ *
3067
+ * @example
3068
+ * ```ts
3069
+ * const sheets = createCaptureSheets({ reader, output: `${process.cwd()}/tmp/sheets` })
3070
+ * const exit = await sheets.execute() // 0 when every selected frame is current and sound
3071
+ * ```
3072
+ */
3073
+ export declare function createCaptureSheets(options: CaptureSheetOptions): CaptureSheetsInterface;
3074
+
3075
+ /**
3076
+ * Decodes the eight-bit, non-interlaced PNGs the capture readers consume.
3077
+ *
3078
+ * @remarks
3079
+ * It reads grayscale, grayscale with alpha, RGB, and RGBA, the colour types an encoder writes for a
3080
+ * browser capture. A grayscale sample fills all three channels, and an alpha channel is dropped.
3081
+ * Indexed colour, other bit depths, and interlacing are refused.
3082
+ *
3083
+ * @param bytes - The exact physical image bytes
3084
+ * @returns Image dimensions and RGB pixels
3085
+ * @throws Thrown for unsupported, malformed, or truncated images.
3086
+ *
3087
+ * @example
3088
+ * ```ts
3089
+ * decodeCapturePicture(encodeCapturePicture({ width: 1, height: 1, pixels: Uint8Array.from([1, 2, 3]) })).pixels // Uint8Array [1, 2, 3]
3090
+ * ```
3091
+ */
3092
+ export declare function decodeCapturePicture(bytes: Buffer): CapturePicture;
3093
+
3094
+ /**
3095
+ * Describes a refusal with its key path, bounded preview, correction, and member differences.
3096
+ *
3097
+ * @example
3098
+ * ```ts
3099
+ * describeCaptureFault('--variant[0]', 'bad/name', 'a portable segment')
3100
+ * ```
3101
+ */
3102
+ export declare function describeCaptureFault(path: string, value: unknown, expected: string, candidates?: readonly string[], required?: readonly string[], allowed?: readonly string[]): string;
3103
+
3104
+ /**
3105
+ * Describes a bounded member population and the number omitted from its preview.
3106
+ * @example
3107
+ * ```ts
3108
+ * describeCaptureMembers(['wide', 'phone']) // '["wide","phone"]'
3109
+ * ```
3110
+ */
3111
+ export declare function describeCaptureMembers(members: readonly string[]): string;
3112
+
3113
+ /**
3114
+ * Caps external diagnostic text and names the number of omitted characters.
3115
+ * @example
3116
+ * ```ts
3117
+ * describeCaptureOutput('short diagnostic') // 'short diagnostic'
3118
+ * ```
3119
+ */
3120
+ export declare function describeCaptureOutput(output: string): string;
3121
+
3122
+ /**
3123
+ * Describes a project's portfolio roots as comparable lines, primary roots apart from standalone ones.
3124
+ *
3125
+ * @param project - The project whose roots to describe
3126
+ * @returns One line per root, naming its kind, portfolio, directory, and scoping
3127
+ *
3128
+ * @example
3129
+ * ```ts
3130
+ * describeCapturePortfolios({
3131
+ * portfolios: [{ portfolio: 'states', directory: 'tmp/captures/states', scoped: true }],
3132
+ * standalone: [],
3133
+ * }) // ['primary states tmp/captures/states true']
3134
+ * ```
3135
+ */
3136
+ export declare function describeCapturePortfolios(project: Pick<CaptureProject, 'portfolios' | 'standalone'>): readonly string[];
3137
+
3138
+ /**
3139
+ * Describes why a selector names nothing the wrapper declares, naming the first unknown segment.
3140
+ *
3141
+ * @remarks
3142
+ * The depth of a segment decides its label: the first segment is a scope and every deeper one an
3143
+ * owner. `all` and every declared owner path, ancestors included, name something.
3144
+ *
3145
+ * @param selector - The requested owner path or `all`
3146
+ * @param selectors - Every owner path the wrapper declares, ancestors included
3147
+ * @returns The refusal text, or `undefined` when the selector names a declared population
3148
+ *
3149
+ * @example
3150
+ * ```ts
3151
+ * describeCaptureSelectorFault('pages:mail', ['pages', 'pages:mail']) // undefined
3152
+ * describeCaptureSelectorFault('pages:none', ['pages', 'pages:mail'])?.includes('selector: received "pages:none"') // true
3153
+ * ```
3154
+ */
3155
+ export declare function describeCaptureSelectorFault(selector: string, selectors: readonly string[]): string | undefined;
3156
+
3157
+ /**
3158
+ * Encodes one checked PNG chunk for contact-sheet output.
3159
+ *
3160
+ * @param name - The four-byte chunk name
3161
+ * @param data - The chunk payload
3162
+ * @returns Header, payload, and checksum bytes
3163
+ *
3164
+ * @example
3165
+ * ```ts
3166
+ * encodeCaptureChunk('IEND', Buffer.alloc(0)).length // 12
3167
+ * ```
3168
+ */
3169
+ export declare function encodeCaptureChunk(name: string, data: Buffer): Buffer;
3170
+
3171
+ /**
3172
+ * Encodes an RGB picture using the contact-sheet writer's native PNG format.
3173
+ *
3174
+ * @param picture - The complete RGB pixel buffer
3175
+ * @param compressed - If `true`, compresses scanlines; if `false`, stores them in the deflate stream. Default: `true`.
3176
+ * @returns A PNG file
3177
+ * @throws Thrown when dimensions and pixel length disagree.
3178
+ *
3179
+ * @example
3180
+ * ```ts
3181
+ * encodeCapturePicture({ width: 1, height: 1, pixels: Uint8Array.from([1, 2, 3]) }).subarray(1, 4).toString() // 'PNG'
3182
+ * ```
3183
+ */
3184
+ export declare function encodeCapturePicture(picture: CapturePicture, compressed?: boolean): Buffer;
3185
+
3186
+ /**
3187
+ * Encodes an unsigned 32-bit integer as four big-endian bytes.
3188
+ *
3189
+ * @param value - An integer from 0 through 4294967295
3190
+ * @returns The four bytes, most significant first
3191
+ *
3192
+ * @example
3193
+ * ```ts
3194
+ * encodeCaptureWord(258) // Buffer <00 00 01 02>
3195
+ * ```
3196
+ */
3197
+ export declare function encodeCaptureWord(value: number): Buffer;
3198
+
3199
+ /**
3200
+ * Escapes every regular-expression metacharacter so a case name matches only itself.
3201
+ *
3202
+ * @param text - The literal text
3203
+ * @returns The text with each metacharacter backslash-quoted
3204
+ *
3205
+ * @example
3206
+ * ```ts
3207
+ * escapeCapturePattern('renders (a.b) + c') // 'renders \\(a\\.b\\) \\+ c'
3208
+ * ```
3209
+ */
3210
+ export declare function escapeCapturePattern(text: string): string;
3211
+
3212
+ /**
3213
+ * Inflates a PNG's compressed stream, refusing one that is corrupt or longer than declared.
3214
+ *
3215
+ * @param data - The concatenated data-chunk payloads
3216
+ * @param length - The inflated length the header's dimensions declare
3217
+ * @returns The inflated scanlines
3218
+ * @throws Thrown when the stream is not valid deflate data or inflates past `length`.
3219
+ *
3220
+ * @example
3221
+ * ```ts
3222
+ * inflateCaptureStream(deflateSync(Buffer.from([1, 2, 3])), 3) // Buffer <01 02 03>
3223
+ * ```
3224
+ */
3225
+ export declare function inflateCaptureStream(data: Buffer, length: number): Buffer;
3226
+
3227
+ /**
3228
+ * Compares file content, size, modification time, and change time across two snapshots.
3229
+ *
3230
+ * @example
3231
+ * ```ts
3232
+ * matchesCaptureFile(previous, undefined) // false
3233
+ * ```
3234
+ */
3235
+ export declare function matchesCaptureFile(previous: CaptureFileSnapshot, current: CaptureFileSnapshot | undefined): boolean;
3236
+
3237
+ /**
3238
+ * Checks whether bytes open with the eight-byte PNG signature.
3239
+ *
3240
+ * @param bytes - The leading bytes of a file
3241
+ * @returns True if the first eight bytes equal the signature; false otherwise
3242
+ *
3243
+ * @example
3244
+ * ```ts
3245
+ * matchesCaptureSignature(Uint8Array.from([137, 80, 78, 71, 13, 10, 26, 10])) // true
3246
+ * ```
3247
+ */
3248
+ export declare function matchesCaptureSignature(bytes: Uint8Array): boolean;
3249
+
3250
+ /** Recognizes filesystem contention codes that ownership arbitration can retry.
3251
+ * @param error - The host operation's refusal
3252
+ * @param platform - The host contract; Windows permission errors can reflect handles without delete sharing
3253
+ * @returns Whether the error names temporary ownership contention
3254
+ * @example
3255
+ * ```ts
3256
+ * matchesCaptureTransient(Object.assign(new Error('busy'), { code: 'EBUSY' })) // true
3257
+ * ```
3258
+ */
3259
+ export declare function matchesCaptureTransient(error: unknown, platform?: NodeJS.Platform): boolean;
3260
+
3261
+ /**
3262
+ * Merges unique lookup populations with incoming identities replacing inherited ones.
3263
+ *
3264
+ * @example
3265
+ * ```ts
3266
+ * mergeCaptureLookups([lookup], [lookup]) // [lookup]
3267
+ * ```
3268
+ */
3269
+ export declare function mergeCaptureLookups(previous: readonly CaptureLookup[], lookups: readonly CaptureLookup[]): readonly CaptureLookup[];
3270
+
3271
+ /**
3272
+ * Normalizes a host path to forward slashes.
3273
+ *
3274
+ * @param path - A host path
3275
+ * @returns The same path with every backslash replaced by a slash
3276
+ *
3277
+ * @example
3278
+ * ```ts
3279
+ * normalizeSlashes('tmp\\captures\\a.png') // 'tmp/captures/a.png'
3280
+ * ```
3281
+ */
3282
+ export declare function normalizeSlashes(path: string): string;
3283
+
3284
+ /**
3285
+ * Computes the PNG Paeth predictor used by both image readers.
3286
+ *
3287
+ * @param left - The reconstructed left byte
3288
+ * @param up - The reconstructed byte above
3289
+ * @param corner - The reconstructed upper-left byte
3290
+ * @returns The closest neighbor to the linear estimate
3291
+ *
3292
+ * @example
3293
+ * ```ts
3294
+ * predictCaptureByte(10, 20, 10) // 20
3295
+ * ```
3296
+ */
3297
+ export declare function predictCaptureByte(left: number, up: number, corner: number): number;
3298
+
3299
+ /**
3300
+ * Finds the nearest existing path without following a dangling link.
3301
+ *
3302
+ * @example
3303
+ * ```ts
3304
+ * readCaptureAncestor('/workspace/missing/file') // '/workspace'
3305
+ * ```
3306
+ */
3307
+ export declare function readCaptureAncestor(path: string): string;
3308
+
3309
+ /**
3310
+ * Reads the runner's command line into one selector, its flags, and the resolved wrapper path.
3311
+ *
3312
+ * @remarks
3313
+ * `--state` belongs to `capture` and `stale`, and `--portfolio` to `stale`. Journey and capture
3314
+ * accept `--changed <ref>` instead of a selector, with optional valueless `--plan`. Every other
3315
+ * flag takes one nonempty value, either separated or in equals form, and only `--variant` repeats.
3316
+ * A value beginning with a dash requires equals form. A bare invocation leaves its selector absent
3317
+ * so the caller can print usage with the declared selectors.
3318
+ *
3319
+ * @param argv - The arguments after the entry name
3320
+ * @param command - The runner command the flags belong to
3321
+ * @param root - The absolute workspace path the wrapper path resolves against
3322
+ * @param fallback - The repository-relative wrapper path used when `--config` is absent
3323
+ * @returns The parsed arguments with an absolute wrapper path
3324
+ * @throws Thrown as a `USAGE` capture error for an unknown, repeated, misplaced, or valueless flag, a
3325
+ * second selector, a repeated or invalid variant, an invalid state, or an empty case.
3326
+ *
3327
+ * @example
3328
+ * ```ts
3329
+ * readCaptureArguments(['pages:mail', '--variant', 'light-390'], 'journey', '/repo', 'vite.journey.config.ts')
3330
+ * // { selector: 'pages:mail', config: '/repo/vite.journey.config.ts', variants: ['light-390'] }
3331
+ * ```
3332
+ */
3333
+ export declare function readCaptureArguments(argv: readonly string[], command: CaptureCommand, root: string, fallback: string): CaptureRunnerArguments;
3334
+
3335
+ /**
3336
+ * Reads PNG compressed-data chunks while refusing truncated or corrupt image bytes.
3337
+ *
3338
+ * @param bytes - The complete PNG
3339
+ * @param offset - The next chunk header. Default: 8.
3340
+ * @returns Ordered compressed-data chunks
3341
+ * @throws Thrown for truncated chunks, bad checksums, or a missing closing chunk.
3342
+ *
3343
+ * @example
3344
+ * ```ts
3345
+ * readCaptureChunks(encodeCapturePicture(picture)).length // 1
3346
+ * ```
3347
+ */
3348
+ export declare function readCaptureChunks(bytes: Buffer, offset?: number): readonly Buffer[];
3349
+
3350
+ /**
3351
+ * Accepts the description a wrapper wrote only when it answers this exchange and no other.
3352
+ *
3353
+ * @remarks
3354
+ * Every echo must match: the invocation, the challenge, the wrapper path, the runner as the
3355
+ * wrapper's parent, and the child the runner spawned as the writer. Each project then passes the same
3356
+ * reader the wrapper's own declarations pass through, and the list may not be empty.
3357
+ *
3358
+ * @param value - The parsed description file
3359
+ * @param expected - What the request and the spawn establish
3360
+ * @returns The validated description
3361
+ * @throws Thrown as a `HOST` capture error naming the first echo that differs, a malformed
3362
+ * document, an empty project list, or a malformed project.
3363
+ *
3364
+ * @example
3365
+ * ```ts
3366
+ * const description = readCaptureDescription(parseJSON(text), expected)
3367
+ * ```
3368
+ */
3369
+ export declare function readCaptureDescription(value: unknown, expected: CaptureDescriptionExpectation): CaptureHostDescription;
3370
+
3371
+ /**
3372
+ * Reads one wrapper project, as the description file holds it, into its host declarations and viewport.
3373
+ *
3374
+ * @remarks
3375
+ * The viewport is read when the project declares geometry for its producing variant and is absent
3376
+ * otherwise, because a runner command needs none and only a reader refuses its absence.
3377
+ *
3378
+ * @param value - The resolved project as plain data
3379
+ * @returns The validated project and, when it declares one, its producing viewport
3380
+ * @throws Thrown as a `HOST` capture error when the project is a path or a non-record, or when its
3381
+ * declarations are malformed.
3382
+ *
3383
+ * @example
3384
+ * ```ts
3385
+ * const { project } = readCaptureEntry({ test: { name: 'journey:light-390', provide } })
3386
+ * project.variant // 'light-390'
3387
+ * ```
3388
+ */
3389
+ export declare function readCaptureEntry(value: unknown): CaptureHostEntry;
3390
+
3391
+ /**
3392
+ * Reads an image only after its opened file's size is inside the compressed-byte budget.
3393
+ * @throws Thrown when the file is oversized, unreadable, or changes size during the read.
3394
+ * @example
3395
+ * ```ts
3396
+ * const bytes = readCaptureImage('/workspace/tmp/captures/mail.png')
3397
+ * ```
3398
+ */
3399
+ export declare function readCaptureImage(file: string): Buffer;
3400
+
3401
+ /**
3402
+ * Reads the bounded input population a project declares, as file paths and content hashes.
3403
+ *
3404
+ * @remarks
3405
+ * The expansion is the one the integrity engine takes: the native glob over the patterns, regular
3406
+ * files only, sorted, each path contained in the workspace. A pattern that matches nothing
3407
+ * contributes no file.
3408
+ *
3409
+ * @param root - The absolute workspace path
3410
+ * @param patterns - The project's native input patterns
3411
+ * @param hash - Digests each file's exact bytes. Default: `computeCaptureHash`
3412
+ * @param read - Reads a contained input through the owning operation's snapshot memo, when supplied
3413
+ * @returns The workspace-relative path of every matched file and its digest
3414
+ * @throws Thrown as a `CONTAINMENT` capture error for a matched path the evidence cannot hold, and as
3415
+ * an `EVIDENCE` capture error for a path that matches under two spellings.
3416
+ *
3417
+ * @example
3418
+ * ```ts
3419
+ * readCaptureInputs(process.cwd(), ['src/**']) // { 'src/a.ts': '3f2a…' }
3420
+ * ```
3421
+ */
3422
+ export declare function readCaptureInputs(root: string, patterns: readonly string[], hash?: CaptureHashHandler, read?: CaptureInputHandler): Readonly<Record<string, string>>;
3423
+
3424
+ /**
3425
+ * Resolves journal lookup references after verifying each stored input population's digest.
3426
+ *
3427
+ * @param journal - A structurally validated lookup journal
3428
+ * @returns Every expanded lookup in its stored order, sharing the verified input maps
3429
+ * @throws Thrown when an input digest differs from its map or a lookup names an unknown digest.
3430
+ *
3431
+ * @example
3432
+ * ```ts
3433
+ * readCaptureLookups(buildCaptureLookupJournal([], [])) // []
3434
+ * ```
3435
+ */
3436
+ export declare function readCaptureLookups(journal: CaptureLookupJournal): readonly CaptureLookup[];
3437
+
3438
+ /**
3439
+ * Parses standard option tokens and refuses empty values, terminators, and repeated single options.
3440
+ *
3441
+ * @param argv - The arguments after the subcommand
3442
+ * @param options - The command's frozen Node option definitions
3443
+ * @param usage - The command syntax appended to every parser refusal
3444
+ * @returns Typed values, positionals, and the tokens that supplied them
3445
+ * @example
3446
+ * ```ts
3447
+ * readCaptureOptions(['--case=-draft'], CAPTURE_COMMAND_OPTIONS.journey, 'Usage: capture journey <selector>').values.case // '-draft'
3448
+ * ```
3449
+ */
3450
+ export declare function readCaptureOptions<Options extends ParseArgsOptionsConfig>(argv: readonly string[], options: Options, usage: string): CaptureParsedArguments<Options>;
3451
+
3452
+ /**
3453
+ * Reads the physical portfolio roots a wrapper declares and refuses a malformed or repeated root.
3454
+ *
3455
+ * @param value - The wrapper's declaration, expected to be a list of roots
3456
+ * @param subject - The name of the declaration in a refusal
3457
+ * @returns The validated roots in declaration order
3458
+ * @throws Thrown as a `HOST` capture error when the declaration is not a list or a root is malformed, and
3459
+ * as an `EVIDENCE` capture error when a portfolio name repeats, case-folded.
3460
+ *
3461
+ * @example
3462
+ * ```ts
3463
+ * readCapturePortfolios([{ portfolio: 'states', directory: 'tmp/captures/states', scoped: true }], 'portfolios')
3464
+ * ```
3465
+ */
3466
+ export declare function readCapturePortfolios(value: unknown, subject: string): readonly CapturePortfolioRoot[];
3467
+
3468
+ /**
3469
+ * Reads one wrapper project's host declarations from its Vitest test configuration.
3470
+ *
3471
+ * @remarks
3472
+ * The label is the project's `name` or its `label` member. Tags must not contain whitespace or a
3473
+ * tag-filter operator, and a variant must be a portable identity. The project's own `variant` must
3474
+ * be one of the declared `variants`, and so must the `first` stage variant. Portfolio roots and
3475
+ * the final case are required, and standalone roots default to none. `uniform` is an optional
3476
+ * list of unique valid owner selectors for the preflight's frame scan. Default: every scope.
3477
+ * An empty list judges none; the declaration never narrows the other readings.
3478
+ *
3479
+ * @param test - The project's `test` configuration, or any value the wrapper supplied in its place
3480
+ * @returns The validated project declaration
3481
+ * @throws Thrown as a `HOST` capture error when a declaration is missing or malformed.
3482
+ *
3483
+ * @example
3484
+ * ```ts
3485
+ * const project = readCaptureProject({
3486
+ * name: 'journey:light-390',
3487
+ * tags: [{ name: 'owner:pages:mail' }],
3488
+ * provide: {
3489
+ * variant: 'light-390',
3490
+ * variants: [{ name: 'light-390' }],
3491
+ * directory: '/repo/tmp/captures/states',
3492
+ * record: 'tmp/captures/states/runs/a/light-390.json',
3493
+ * inputs: ['src/**'],
3494
+ * final: 'closes the run',
3495
+ * first: 'light-390',
3496
+ * portfolios: [{ portfolio: 'states', directory: 'tmp/captures/states', scoped: true }],
3497
+ * },
3498
+ * })
3499
+ * project.variant // 'light-390'
3500
+ * ```
3501
+ */
3502
+ export declare function readCaptureProject(test: unknown): CaptureProject;
3503
+
3504
+ /**
3505
+ * Reads a reader's command line into its selection, its flags, and the resolved paths.
3506
+ *
3507
+ * @remarks
3508
+ * The first argument is the selector and every flag after it takes one nonempty value, separated
3509
+ * or in equals form. Only `--variant` repeats. `--output` belongs to sheets; the preflight option
3510
+ * table refuses it before discovery. The wrapper, the journey artifact directory, and the checks module
3511
+ * resolve against `root`; `defaults` supplies the first two when the command line names neither.
3512
+ *
3513
+ * @param argv - The arguments after the entry name
3514
+ * @param root - The absolute workspace path the paths resolve against
3515
+ * @param defaults - The repository-relative wrapper and journey artifact directory to fall back to
3516
+ * @param command - The reader command whose option table applies. Default: `sheets`
3517
+ * @returns The reader options and the optional contact-sheet directory
3518
+ * @throws Thrown as a `USAGE` capture error for an absent selector, an unknown, repeated, or
3519
+ * valueless flag.
3520
+ *
3521
+ * @example
3522
+ * ```ts
3523
+ * readCaptureReaderArguments(['pages:mail', '--variant', 'light-390'], '/repo', {
3524
+ * config: 'configs/vite.journey.config.ts',
3525
+ * journeys: 'tmp/journey',
3526
+ * }).reader.selection // { selector: 'pages:mail', variants: ['light-390'] }
3527
+ * ```
3528
+ */
3529
+ export declare function readCaptureReaderArguments(argv: readonly string[], root: string, defaults: CaptureReaderDefaults, command?: 'preflight' | 'sheets'): CaptureReaderCommand;
3530
+
3531
+ /**
3532
+ * Reads the registry command line into the wrapper path, the variants to refresh, and the mode.
3533
+ *
3534
+ * @remarks
3535
+ * The command takes no selector: it refreshes every producing variant the wrapper declares, or the
3536
+ * variants named by repeated `--variant` flags. Every flag takes one value, and only `--variant`
3537
+ * repeats. `--mode` is forwarded to the wrapper's Vitest process unread.
3538
+ *
3539
+ * @param argv - The arguments after the subcommand
3540
+ * @param root - The absolute workspace path the wrapper path resolves against
3541
+ * @param fallback - The repository-relative wrapper path used when `--config` is absent
3542
+ * @returns The parsed arguments with an absolute wrapper path
3543
+ * @throws Thrown as a `USAGE` capture error for a positional argument, an unknown, repeated, or
3544
+ * valueless flag, or a repeated or invalid variant.
3545
+ *
3546
+ * @example
3547
+ * ```ts
3548
+ * readCaptureRegistryArguments(['--variant', 'light-390'], '/repo', 'vite.journey.config.ts')
3549
+ * // { config: '/repo/vite.journey.config.ts', variants: ['light-390'] }
3550
+ * ```
3551
+ */
3552
+ export declare function readCaptureRegistryArguments(argv: readonly string[], root: string, fallback: string): CaptureRegistryArguments;
3553
+
3554
+ /**
3555
+ * Reads and validates the request the runner wrote for the wrapper process that is its child.
3556
+ *
3557
+ * @remarks
3558
+ * Only the file named by `ppid` is read, so a request a stopped runner left never reaches a run
3559
+ * that has no runner parent. Every refusal names its cause: a file that does not parse, a record
3560
+ * whose `pid` differs from the parent's, arguments that differ from the process's own, an
3561
+ * unsupported version, an identity that is not a portable segment, a wrapper path that is not
3562
+ * `config`, a state on a command that cannot carry one, and a command, selector, variant list, or
3563
+ * case the wrapper does not declare.
3564
+ *
3565
+ * @param options - The parent id, the process arguments, the request directory, and the wrapper's declarations
3566
+ * @returns The validated request, or `undefined` when the parent wrote none
3567
+ * @throws Thrown as a `HOST` capture error when a request exists and fails any check.
3568
+ *
3569
+ * @example
3570
+ * ```ts
3571
+ * const request = readCaptureRequest({
3572
+ * ppid: process.ppid,
3573
+ * argv: process.argv.slice(1),
3574
+ * directory: '/repo/tmp/units',
3575
+ * config: 'configs/vite.journey.config.ts',
3576
+ * owners: ['pages:mail'],
3577
+ * variants: ['light-390'],
3578
+ * })
3579
+ * request?.selector // 'pages:mail', or undefined when no runner is the parent
3580
+ * ```
3581
+ */
3582
+ export declare function readCaptureRequest(options: CaptureRequestOptions): CaptureRequest | undefined;
3583
+
3584
+ /**
3585
+ * Reads the process id that a request file, or its temporary sibling, names.
3586
+ *
3587
+ * @param name - A file name from the request directory
3588
+ * @returns The positive process id the name carries, or `undefined` for any other name
3589
+ *
3590
+ * @example
3591
+ * ```ts
3592
+ * readCaptureRequestOwner('journey-selection-4242.json') // 4242
3593
+ * readCaptureRequestOwner('journey-selection-4242.json.tmp') // 4242
3594
+ * readCaptureRequestOwner('journey-selection.json') // undefined
3595
+ * ```
3596
+ */
3597
+ export declare function readCaptureRequestOwner(name: string): number | undefined;
3598
+
3599
+ /**
3600
+ * Checks whether a process with this id is running, counting one the caller may not signal.
3601
+ *
3602
+ * @remarks
3603
+ * A zero signal tests existence without sending one. A refusal for permission still proves the
3604
+ * process exists, so only a missing process reads as not running.
3605
+ *
3606
+ * @param pid - The process id
3607
+ * @returns True if the process exists; false otherwise
3608
+ *
3609
+ * @example
3610
+ * ```ts
3611
+ * readCaptureRunning(process.pid) // true
3612
+ * ```
3613
+ */
3614
+ export declare function readCaptureRunning(pid: number): boolean;
3615
+
3616
+ /**
3617
+ * Reads the installed workspace Vitest's exact title separator, refusing unsupported majors.
3618
+ * @example
3619
+ * ```ts
3620
+ * readCaptureSeparator('/workspace/node_modules/vitest/vitest.mjs') // ' ' on Vitest 4
3621
+ * ```
3622
+ */
3623
+ export declare function readCaptureSeparator(entry: string): string;
3624
+
3625
+ /**
3626
+ * Reads original title segments from the accepted registry's authenticated JSON reporter files.
3627
+ * @param root - The repository root that contains the registry and its reporters
3628
+ * @param file - The accepted registry path
3629
+ * @param selector - The optional owner selector that bounds the case candidates
3630
+ * @returns Exact case names mapped to their original title segments within the selected owners
3631
+ * @example
3632
+ * ```ts
3633
+ * const titles = readCaptureTitles('/workspace', '/workspace/tmp/captures/states/registry.json')
3634
+ * ```
3635
+ */
3636
+ export declare function readCaptureTitles(root: string, file: string, selector?: string): Readonly<Record<string, readonly string[]>>;
3637
+
3638
+ /**
3639
+ * Reads output variant candidates without authenticating or accepting registry evidence.
3640
+ * @remarks Missing, unreadable, or malformed registries supply no candidate hints; the integrity engine still authenticates every accepted read.
3641
+ * @example
3642
+ * ```ts
3643
+ * readCaptureVariants('/workspace', '/workspace/tmp/captures/states/registry.json') // [] when absent
3644
+ * ```
3645
+ */
3646
+ export declare function readCaptureVariants(root: string, file: string): readonly string[];
3647
+
3648
+ /**
3649
+ * Reads the viewport a wrapper project's producing variant declares.
3650
+ *
3651
+ * @param test - The project's `test` configuration, or any value the wrapper supplied in its place
3652
+ * @returns The producing variant's name and pixel geometry
3653
+ * @throws Thrown as a `HOST` capture error when the project declares no variant geometry or its
3654
+ * producing variant has none.
3655
+ *
3656
+ * @example
3657
+ * ```ts
3658
+ * readCaptureViewport({
3659
+ * provide: { variant: 'light-390', variants: [{ name: 'light-390', width: 390, height: 844 }] },
3660
+ * }) // { name: 'light-390', width: 390, height: 844 }
3661
+ * ```
3662
+ */
3663
+ export declare function readCaptureViewport(test: unknown): CaptureViewport;
3664
+
3665
+ /**
3666
+ * Renders an exact owner command with the selected variants and filters in host shell syntax.
3667
+ *
3668
+ * @param command - The request command, translated to its executable name, or the registry command
3669
+ * @param parsed - The parsed flags; changed and plan flags are deliberately replaced by the owner
3670
+ * @param selector - The explicit owner or all selector; omitted for a registry refresh
3671
+ * @param root - The workspace that makes the wrapper path relative
3672
+ * @returns The command ready to copy into the host shell
3673
+ * @example
3674
+ * ```ts
3675
+ * renderCaptureCommand('journey', { config: '/repo/journey.ts', variants: [] }, 'pages:mail', '/repo')
3676
+ * // 'capture journey pages:mail --config journey.ts'
3677
+ * ```
3678
+ */
3679
+ export declare function renderCaptureCommand(command: CaptureCommand | 'registry', parsed: CaptureRunnerArguments, selector: string | undefined, root: string): string;
3680
+
3681
+ /** Validates a supplied path argument before work and classifies an outside value as usage.
3682
+ * @param root - The repository root
3683
+ * @param path - The supplied path resolved against the root
3684
+ * @param flag - The command line flag that supplied the path
3685
+ * @returns The contained physical path
3686
+ * @example
3687
+ * ```ts
3688
+ * requireCaptureArgument('/workspace', '/workspace/checks.ts', '--checks')
3689
+ * ```
3690
+ */
3691
+ export declare function requireCaptureArgument(root: string, path: string, flag: string): string;
3692
+
3693
+ /**
3694
+ * Validates a physical destination against a physical root before any read or write.
3695
+ *
3696
+ * @returns The physical destination, including its missing suffix
3697
+ * @throws Thrown when the destination or an existing ancestor escapes the root.
3698
+ * @example
3699
+ * ```ts
3700
+ * requireCaptureContained('/workspace', '/workspace/tmp/new') // '/workspace/tmp/new'
3701
+ * ```
3702
+ */
3703
+ export declare function requireCaptureContained(root: string, path: string): string;
3704
+
3705
+ /**
3706
+ * Refuses compressed image bytes before file reads or chunk-buffer allocation.
3707
+ * @example
3708
+ * ```ts
3709
+ * requireCaptureImageSize(4096) // undefined
3710
+ * ```
3711
+ */
3712
+ export declare function requireCaptureImageSize(size: number): void;
3713
+
3714
+ /**
3715
+ * Refuses a wrapper project set whose members repeat or disagree on a host declaration.
3716
+ *
3717
+ * @remarks
3718
+ * Project labels are unique and so is each project's own variant, case-folded. Every project must
3719
+ * declare the same primary directory, inputs, variants, first-stage variant, final case, and
3720
+ * portfolio roots, because the runner builds one engine for the whole set. Uniform declarations
3721
+ * must also agree as populations, with absence distinct from an empty list.
3722
+ *
3723
+ * @param projects - The wrapper's projects
3724
+ * @returns The first project, whose declarations every other project matches
3725
+ * @throws Thrown as a `HOST` capture error when the set is empty or its members disagree, and as an
3726
+ * `EVIDENCE` capture error when a label or variant repeats.
3727
+ *
3728
+ * @example
3729
+ * ```ts
3730
+ * requireCaptureProjects([project]) // project
3731
+ * ```
3732
+ */
3733
+ export declare function requireCaptureProjects(projects: readonly CaptureProject[]): CaptureProject;
3734
+
3735
+ /**
3736
+ * Refuses unknown command selections from the wrapper before authenticating disk evidence.
3737
+ * @example
3738
+ * ```ts
3739
+ * requireCaptureSelection('all', [], projects) // undefined for declared wrapper projects
3740
+ * ```
3741
+ */
3742
+ export declare function requireCaptureSelection(selector: string, variants: readonly string[], projects: readonly CaptureProject[], outputs?: readonly string[], portfolio?: string): void;
3743
+
3744
+ /**
3745
+ * Maps usage refusals to exit 64 and every other failure to exit 1.
3746
+ *
3747
+ * @example
3748
+ * ```ts
3749
+ * resolveCaptureExit(new CaptureError('Invalid flag', { code: 'USAGE' })) // 64
3750
+ * ```
3751
+ */
3752
+ export declare function resolveCaptureExit(error: unknown): number;
3753
+
3754
+ /**
3755
+ * Resolves an existing path or its nearest existing ancestor to its physical destination.
3756
+ *
3757
+ * @example
3758
+ * ```ts
3759
+ * resolveCapturePhysical('/workspace/alias/new') // '/workspace/target/new'
3760
+ * ```
3761
+ */
3762
+ export declare function resolveCapturePhysical(path: string): string;
3763
+
3764
+ /**
3765
+ * Resolves a path to the slash-separated form the evidence documents store, relative to a root.
3766
+ *
3767
+ * @param root - The absolute workspace path
3768
+ * @param target - The absolute or workspace-relative path
3769
+ * @returns The path relative to the root, with every backslash replaced by a slash
3770
+ *
3771
+ * @example
3772
+ * ```ts
3773
+ * resolveCaptureRelative(process.cwd(), resolve('tmp', 'units')) // 'tmp/units'
3774
+ * ```
3775
+ */
3776
+ export declare function resolveCaptureRelative(root: string, target: string): string;
3777
+
3778
+ /**
3779
+ * Resolves the directory that holds the runner's request files for the process that reads them.
3780
+ *
3781
+ * @remarks
3782
+ * A directory the wrapper names wins. Otherwise the directory the runner handed this child in
3783
+ * `CAPTURE_REQUESTS` applies, and a process the runner did not start reads `CAPTURE_DEFAULTS.requests`
3784
+ * beneath its working directory. The one default therefore lives here and in the executable, and a
3785
+ * consumer never has to repeat it.
3786
+ *
3787
+ * @param directory - The directory the wrapper declares, when it declares one
3788
+ * @returns The absolute directory
3789
+ *
3790
+ * @example
3791
+ * ```ts
3792
+ * resolveCaptureRequests('/repo/tmp/units') // '/repo/tmp/units'
3793
+ * ```
3794
+ */
3795
+ export declare function resolveCaptureRequests(directory?: string): string;
3796
+
3797
+ /**
3798
+ * Names a sheet group by portfolio, owner, and state independently of its output variant.
3799
+ *
3800
+ * @example
3801
+ * ```ts
3802
+ * resolveCaptureSheetIdentity(entry) // '["states","pages:mail","mail-screen"]'
3803
+ * ```
3804
+ */
3805
+ export declare function resolveCaptureSheetIdentity(entry: CaptureDestination): string;
3806
+
3807
+ /**
3808
+ * Plans one selected journey stage or narrow and remaining frame stages.
3809
+ *
3810
+ * @remarks
3811
+ * Journeys run every selected variant together. Frame captures stage the first variant alone and
3812
+ * the remaining variants together. Empty stages are dropped and no unselected variant is added.
3813
+ *
3814
+ * @param variants - The selected variants in declaration order
3815
+ * @param first - The variant the wrapper stages alone first
3816
+ * @param command - The journey or capture command whose stage contract applies
3817
+ * @returns The non-empty stages in run order
3818
+ *
3819
+ * @example
3820
+ * ```ts
3821
+ * resolveCaptureStages(['wide', 'compact'], 'compact', 'capture')
3822
+ * // [{ name: 'narrow', variants: ['compact'] }, { name: 'rest', variants: ['wide'] }]
3823
+ * ```
3824
+ */
3825
+ export declare function resolveCaptureStages(variants: readonly string[], first: string, command: CaptureRequest['command']): readonly CaptureStagePlan[];
3826
+
3827
+ /**
3828
+ * Resolves selected producing variants in declaration order and requires their projects.
3829
+ *
3830
+ * @param selected - Explicit variants, or an empty list for every declared variant
3831
+ * @param projects - The discovered host projects
3832
+ * @returns The declared variants the selection includes
3833
+ * @throws Thrown as USAGE for an unknown variant or HOST for missing variant projects.
3834
+ * @example
3835
+ * ```ts
3836
+ * const variants = resolveCaptureVariants(['light-390'], projects)
3837
+ * // ['light-390'] when the wrapper declares its project
3838
+ * ```
3839
+ */
3840
+ export declare function resolveCaptureVariants(selected: readonly string[], projects: readonly CaptureProject[]): readonly string[];
3841
+
3842
+ /**
3843
+ * Resolves one entry of a wrapper's project list to the project it declares.
3844
+ *
3845
+ * @remarks
3846
+ * A factory entry is called with the serve command and the test mode, as Vitest calls it, and a
3847
+ * promise is awaited. The result is the project as plain data, not yet judged: the runner reads
3848
+ * and validates it, so one reader owns every refusal.
3849
+ *
3850
+ * @param input - The entry as the wrapper declared it: an inline project, a promise of one, or a factory
3851
+ * @returns The resolved project, whatever it holds
3852
+ *
3853
+ * @example
3854
+ * ```ts
3855
+ * const project = await resolveCaptureWrapperProject(wrapper.test.projects[0])
3856
+ * ```
3857
+ */
3858
+ export declare function resolveCaptureWrapperProject(input: unknown): Promise<unknown>;
3859
+
3860
+ /**
3861
+ * Reports a portfolio, owner, and viewport whose frames mix cropped, viewport-sized, and page-sized images.
3862
+ *
3863
+ * @remarks
3864
+ * Only a frame at its own producing variant counts, so an auxiliary output variant never joins its
3865
+ * producer's group. A frame narrower than its viewport reads `crop`, one as tall as the viewport
3866
+ * reads `viewport`, and any other reads `page`. The observation names the mixture without inferring
3867
+ * which framing was intended.
3868
+ *
3869
+ * @param images - The selected images, decoded
3870
+ * @param producers - The wrapper's producing viewports
3871
+ * @returns One observation per group that holds more than one kind
3872
+ *
3873
+ * @example
3874
+ * ```ts
3875
+ * scanCaptureFrames(images, producers) // ['Mixed framing: states/pages:mail@390: page, viewport']
3876
+ * ```
3877
+ */
3878
+ export declare function scanCaptureFrames(images: readonly CaptureImageResult[], producers: readonly CaptureProducer[]): readonly string[];
3879
+
3880
+ /**
3881
+ * Settles independent request removal and child termination without hiding either failure.
3882
+ *
3883
+ * @returns Every removal, termination, or unconfirmed-exit failure
3884
+ * @example
3885
+ * ```ts
3886
+ * await settleCaptureShutdown(() => invocation.retract(), [() => child.stop()]) // []
3887
+ * ```
3888
+ */
3889
+ export declare function settleCaptureShutdown(retract: CaptureRetractionHandler, terminations: readonly CaptureTerminationHandler[]): Promise<readonly unknown[]>;
3890
+
3891
+ /**
3892
+ * Scales a picture with an exact area average and clips its displayed height.
3893
+ *
3894
+ * @param picture - The source RGB picture
3895
+ * @param factor - The integer reduction factor
3896
+ * @param limit - The maximum displayed height
3897
+ * @returns A separately owned scaled picture
3898
+ *
3899
+ * @example
3900
+ * ```ts
3901
+ * shrinkCapturePicture({ width: 2, height: 2, pixels: new Uint8Array(12) }, 2, 8).width // 1
3902
+ * ```
3903
+ */
3904
+ export declare function shrinkCapturePicture(picture: CapturePicture, factor: number, limit: number): CapturePicture;
3905
+
3906
+ /**
3907
+ * Splits a list into consecutive pages with at most the requested size.
3908
+ *
3909
+ * @example
3910
+ * ```ts
3911
+ * splitCapturePages([1, 2, 3], 2) // [[1, 2], [3]]
3912
+ * ```
3913
+ */
3914
+ export declare function splitCapturePages<T>(entries: readonly T[], size: number): ReadonlyArray<readonly T[]>;
3915
+
3916
+ /**
3917
+ * Reconstructs one filtered PNG scanline from its filter byte and the row above.
3918
+ *
3919
+ * @param filter - The scanline's filter type, from 0 through 4
3920
+ * @param line - The filtered bytes of the row, without the filter byte
3921
+ * @param above - The reconstructed row above, or `undefined` for the first row
3922
+ * @param channels - The number of bytes in one pixel
3923
+ * @returns The reconstructed row
3924
+ *
3925
+ * @example
3926
+ * ```ts
3927
+ * unfilterCaptureRow(1, Uint8Array.from([1, 1, 1, 1]), undefined, 1) // Uint8Array [1, 2, 3, 4]
3928
+ * ```
3929
+ */
3930
+ export declare function unfilterCaptureRow(filter: number, line: Uint8Array, above: Uint8Array | undefined, channels: number): Uint8Array;
3931
+
3932
+ /**
3933
+ * Writes one JSON document atomically, so a reader sees the old bytes or the new and never a part.
3934
+ *
3935
+ * @remarks
3936
+ * The document is written to a unique temporary sibling, flushed, and renamed over the target. The
3937
+ * signal is checked after the flush and before the rename, and the temporary file never outlives the
3938
+ * call.
3939
+ *
3940
+ * @param path - The absolute target path, whose directory is created when missing
3941
+ * @param value - The value to serialize
3942
+ * @param signal - Aborts the write before the rename when it fires
3943
+ *
3944
+ * @example
3945
+ * ```ts
3946
+ * writeCaptureDocument('/repo/tmp/captures/states/registry.json', registry)
3947
+ * ```
3948
+ */
3949
+ export declare function writeCaptureDocument(path: string, value: unknown, signal?: AbortSignal): void;
3950
+
3951
+ export { }