@orkestrel/capture 0.0.8 → 0.0.10

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.
@@ -1,23 +1,32 @@
1
+ import type { CAPTURE_VERSION } from '@orkestrel/capture';
1
2
  import type { CaptureCollectionReceipt } from '@orkestrel/capture';
2
3
  import type { CaptureDeclaration } from '@orkestrel/capture';
3
4
  import type { CaptureDestination } from '@orkestrel/capture';
4
5
  import type { CaptureDigest } from '@orkestrel/capture';
5
6
  import { CaptureError } from '@orkestrel/capture';
7
+ import type { CaptureErrorCode } from '@orkestrel/capture';
8
+ import type { CaptureExpandedManifest } from '@orkestrel/capture';
6
9
  import type { CaptureFreshness } from '@orkestrel/capture';
7
10
  import type { CaptureLookup } from '@orkestrel/capture';
8
11
  import type { CaptureLookupJournal } from '@orkestrel/capture';
12
+ import type { CaptureManifestDocument } from '@orkestrel/capture';
13
+ import type { CapturePortfolioRoot } from '@orkestrel/capture';
14
+ import type { CaptureProvided } from '@orkestrel/capture';
9
15
  import type { CaptureReceipt } from '@orkestrel/capture';
10
16
  import type { CaptureRegistry } from '@orkestrel/capture';
11
17
  import type { CaptureRequest } from '@orkestrel/capture';
12
18
  import type { CaptureRun } from '@orkestrel/capture';
13
19
  import type { CaptureSelection } from '@orkestrel/capture';
20
+ import type { CaptureSources } from '@orkestrel/capture';
14
21
  import type { CaptureStamp } from '@orkestrel/capture';
15
- import type { CaptureStoredManifest } from '@orkestrel/capture';
22
+ import type { CaptureStatus } from '@orkestrel/capture';
16
23
  import type { CaptureViewport } from '@orkestrel/capture';
17
24
  import type { CaptureWarning } from '@orkestrel/capture';
18
25
  import type { DuplexInterface } from '@orkestrel/process';
19
26
  import type { parseArgs } from 'node:util';
20
27
  import type { ParseArgsOptionsConfig } from 'node:util';
28
+ import type { ProgressPluginInterface } from '@orkestrel/test/server';
29
+ import type { ProgressRun } from '@orkestrel/test/server';
21
30
 
22
31
  /**
23
32
  * Answers the runner's discovery request from the wrapper, before the wrapper does any other work.
@@ -58,7 +67,7 @@ export declare function answerCaptureDiscovery(options: CaptureDiscoveryOptions)
58
67
  * spaces and quotes. An exact case adds `-t` with the anchored pattern for that case and the
59
68
  * final case, so the final case still writes the run record.
60
69
  *
61
- * @param options - The entry, wrapper, report, projects, tag filter, and optional exact case and mode
70
+ * @param options - The entry, wrapper, report and progress files, projects, tag filter, bail switch, and optional exact case and mode
62
71
  * @returns The arguments after the Node executable
63
72
  *
64
73
  * @example
@@ -67,6 +76,7 @@ export declare function answerCaptureDiscovery(options: CaptureDiscoveryOptions)
67
76
  * entry: '/repo/node_modules/vitest/vitest.mjs',
68
77
  * config: '/repo/vite.journey.config.ts',
69
78
  * report: '/repo/tmp/units/runs/a/journey-selected.json',
79
+ * progress: '/repo/tmp/units/runs/a/selected.progress.jsonl',
70
80
  * projects: ['journey:light-390'],
71
81
  * filter: 'owner:pages:mail',
72
82
  * final: 'closes the run',
@@ -118,13 +128,7 @@ export declare function buildCaptureDigest(patterns: readonly string[], files: R
118
128
  * export default (await answerCaptureDiscovery(options)) ? buildCaptureDiscoveryConfig() : config
119
129
  * ```
120
130
  */
121
- export declare function buildCaptureDiscoveryConfig(): {
122
- readonly test: {
123
- readonly include: string[];
124
- readonly passWithNoTests: boolean;
125
- readonly watch: boolean;
126
- };
127
- };
131
+ export declare function buildCaptureDiscoveryConfig(): CaptureDiscoveryConfig;
128
132
 
129
133
  /**
130
134
  * Builds the tag expression that selects an owner population, and its capture tags for frames.
@@ -178,11 +182,54 @@ export declare function buildCaptureIntegrityOptions(root: string, project: Capt
178
182
  *
179
183
  * @example
180
184
  * ```ts
181
- * buildCaptureLookupJournal([], []).inputs // {}
185
+ * buildCaptureLookupJournal([], []).populations // {}
182
186
  * ```
183
187
  */
184
188
  export declare function buildCaptureLookupJournal(lookups: readonly CaptureLookup[], collections: readonly CaptureCollectionReceipt[], manifest?: string): CaptureLookupJournal;
185
189
 
190
+ /**
191
+ * Stores each distinct file map of an expanded manifest once, in a table keyed by the map's digest.
192
+ *
193
+ * @param manifest - The expanded manifest the engine publishes
194
+ * @returns The document whose stamps, lookups, and collections name their maps by table key
195
+ *
196
+ * @example
197
+ * ```ts
198
+ * const document = buildCaptureManifestDocument(manifest)
199
+ * Object.keys(document.populations) // one digest per distinct shared or input map
200
+ * ```
201
+ */
202
+ export declare function buildCaptureManifestDocument(manifest: CaptureExpandedManifest): CaptureManifestDocument;
203
+
204
+ /**
205
+ * Builds the values capture merges into one variant's Vitest project.
206
+ *
207
+ * @param options - The wrapper's declarations
208
+ * @param variant - The variant the project produces
209
+ * @param provided - The variant's frame directory, run record path, capture switch, and runner request
210
+ * @returns The owner tags, the provided values, and the `readCaptureFrames` browser command over the directory
211
+ *
212
+ * @example
213
+ * ```ts
214
+ * buildCaptureOverride(options, variant, { directory, record, capture: true }).test.provide.record
215
+ * // 'tmp/captures/states/runs/run-1/selected/light-390.json'
216
+ * ```
217
+ */
218
+ export declare function buildCaptureOverride(options: Omit<CaptureWrapperOptions<unknown>, 'url' | 'project'>, variant: CaptureViewport, provided: Pick<CaptureProvided, 'directory' | 'record' | 'capture' | 'request'>): CaptureWrapperOverride;
219
+
220
+ /**
221
+ * Builds the report a preflight prints and a contact-sheet index carries from one preflight result.
222
+ *
223
+ * @param result - The judged selection
224
+ * @returns The selection, freshness, mixed observations, issues, identical groups, image sizes, and `acceptance: false`
225
+ *
226
+ * @example
227
+ * ```ts
228
+ * buildCaptureReaderReport(await preflight.check()).acceptance // false
229
+ * ```
230
+ */
231
+ export declare function buildCaptureReaderReport(result: CapturePreflightResult): CaptureReaderReport;
232
+
186
233
  /**
187
234
  * Imports complete receipts only after their actual exits and exact report bytes validate.
188
235
  *
@@ -214,6 +261,53 @@ export declare function buildCaptureRegistry(inputs: readonly CaptureReceiptInpu
214
261
  */
215
262
  export declare function buildCaptureRequestRefusal(file: string, cause?: unknown): CaptureError;
216
263
 
264
+ /**
265
+ * Builds a document's population table from the memo its table keys were computed through.
266
+ *
267
+ * @param memo - The memo `computeCaptureTableKey` filled for one document build
268
+ * @returns Each distinct ordered map under its digest, in the order the build first met it
269
+ *
270
+ * @example
271
+ * ```ts
272
+ * const memo = new Map()
273
+ * const key = computeCaptureTableKey({ 'src/a.ts': 'f'.repeat(64) }, memo)
274
+ * buildCaptureTable(memo)[key] // { 'src/a.ts': 'ffff…' }
275
+ * ```
276
+ */
277
+ export declare function buildCaptureTable(memo: ReadonlyMap<Readonly<Record<string, string>>, CaptureDigest>): Readonly<Record<string, Readonly<Record<string, string>>>>;
278
+
279
+ /**
280
+ * Builds a journey wrapper's Vitest configuration as plain data, answering discovery first.
281
+ *
282
+ * @remarks
283
+ * Call it inside the wrapper's own `defineConfig` callback, before any other work: capture imports
284
+ * neither Vite nor Vitest, so the result is data the wrapper returns. The wrapper path is `url`
285
+ * relative to the working directory, which is the workspace root for every child the runner
286
+ * spawns. During a discovery request it describes each variant's project as `{ name, tags,
287
+ * provide }`, with the name the host's `project` chose, and returns `buildCaptureDiscoveryConfig()`.
288
+ * Otherwise it reads the runner's request, provides each project the values `CaptureProvided`
289
+ * declares except `standalone`, and registers the browser command `readCaptureFrames`, which lists the frames under
290
+ * the provided directory. With the capture variable unset, each variant writes to its own scratch
291
+ * sibling of the evidence root, emptied first. The result's root `plugins` holds one
292
+ * `createProgressPlugin()`, so a stage the runner passes `--outputFile.progress` writes its
293
+ * progress file.
294
+ *
295
+ * @param options - The wrapper path, variants, owners, stage and final names, evidence root, inputs, sources, portfolios, and project builder
296
+ * @returns The discovery configuration while discovery runs, and otherwise the progress plugin and one project per variant
297
+ * @throws Thrown as a `HOST` capture error, before any directory work, for a `url` that is no
298
+ * `file:` URL, an evidence root that is not a portable relative path, or a variant name that is no
299
+ * capture segment, and later for an invalid owner or a runner request that fails its checks; and as
300
+ * a `CONTAINMENT` capture error for a wrapper or scratch path outside the workspace.
301
+ *
302
+ * @example
303
+ * ```ts
304
+ * export default defineConfig(({ mode }) =>
305
+ * buildCaptureWrapper({ ...declarations, url: import.meta.url, project: (variant, override) => appJourney(variant, mode, override) }),
306
+ * )
307
+ * ```
308
+ */
309
+ export declare function buildCaptureWrapper<TProject>(options: CaptureWrapperOptions<TProject>): Promise<CaptureWrapperConfig<TProject> | CaptureDiscoveryConfig>;
310
+
217
311
  /**
218
312
  * Names the executable subcommand each runner command answers to.
219
313
  *
@@ -235,6 +329,9 @@ export declare const CAPTURE_COMMAND_NAMES: Readonly<{
235
329
  /**
236
330
  * Defines each command's frozen options for Node's standard argument parser.
237
331
  *
332
+ * @remarks A boolean option whose default is `true` reads only its `--no-` form, which sets it to
333
+ * `false`; `bail` is the one such option.
334
+ *
238
335
  * @example
239
336
  * ```ts
240
337
  * CAPTURE_COMMAND_OPTIONS.journey.variant.multiple // true
@@ -258,6 +355,10 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
258
355
  plan: Readonly<{
259
356
  type: "boolean";
260
357
  }>;
358
+ bail: Readonly<{
359
+ type: "boolean";
360
+ default: true;
361
+ }>;
261
362
  mode: Readonly<{
262
363
  type: "string";
263
364
  }>;
@@ -282,6 +383,10 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
282
383
  plan: Readonly<{
283
384
  type: "boolean";
284
385
  }>;
386
+ bail: Readonly<{
387
+ type: "boolean";
388
+ default: true;
389
+ }>;
285
390
  mode: Readonly<{
286
391
  type: "string";
287
392
  }>;
@@ -372,10 +477,15 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
372
477
  config: Readonly<{
373
478
  type: "string";
374
479
  }>;
480
+ bail: Readonly<{
481
+ type: "boolean";
482
+ default: true;
483
+ }>;
375
484
  mode: Readonly<{
376
485
  type: "string";
377
486
  }>;
378
487
  }>;
488
+ readonly progress: Readonly<{}>;
379
489
  }>;
380
490
 
381
491
  /**
@@ -494,23 +604,22 @@ export declare const CAPTURE_OWNER_BACKOFF = 10;
494
604
  */
495
605
  export declare const CAPTURE_OWNER_FILE = ".capture-owner";
496
606
 
497
- /**
498
- * Names the tag prefix that marks a case's owner path and each ancestor of it.
499
- *
607
+ /** Bounds a synchronous ownership retry sequence in milliseconds, including host contention.
500
608
  * @example
501
609
  * ```ts
502
- * `${CAPTURE_OWNER_PREFIX}pages:mail` // 'owner:pages:mail'
610
+ * CAPTURE_OWNER_TIMEOUT // 1000
503
611
  * ```
504
612
  */
505
- export declare const CAPTURE_OWNER_PREFIX = "owner:";
613
+ export declare const CAPTURE_OWNER_TIMEOUT = 1000;
506
614
 
507
- /** Bounds a synchronous ownership retry sequence in milliseconds, including host contention.
615
+ /**
616
+ * Holds the largest process id a POSIX or Windows host can assign, the signed 32-bit maximum.
508
617
  * @example
509
618
  * ```ts
510
- * CAPTURE_OWNER_TIMEOUT // 1000
619
+ * CAPTURE_PID_LIMIT // 2147483647
511
620
  * ```
512
621
  */
513
- export declare const CAPTURE_OWNER_TIMEOUT = 1000;
622
+ export declare const CAPTURE_PID_LIMIT = 2147483647;
514
623
 
515
624
  /**
516
625
  * Bounds decoded image memory, row metadata, and PNG input bytes independently of untrusted headers.
@@ -532,6 +641,34 @@ export declare const CAPTURE_PNG_LIMITS: Readonly<{
532
641
  readonly bytes: number;
533
642
  }>;
534
643
 
644
+ /**
645
+ * Names the ending of the progress file each stage writes beneath its invocation's run directory.
646
+ *
647
+ * @remarks The stage's name precedes it, so `selected` writes `selected.progress.jsonl`.
648
+ *
649
+ * @example
650
+ * ```ts
651
+ * `tmp/capture/${CAPTURE_RUNS_DIRECTORY}/a/selected${CAPTURE_PROGRESS_SUFFIX}`
652
+ * ```
653
+ */
654
+ export declare const CAPTURE_PROGRESS_SUFFIX = ".progress.jsonl";
655
+
656
+ /**
657
+ * Names the command that clears each refusal condition, or none where no command clears it.
658
+ *
659
+ * @remarks
660
+ * `registry` is the complete-registry refresh, and `journey` is the selected owner's journey, which
661
+ * refreshes its state lookups. A runner prints the command on stdout after the report line it
662
+ * follows, ahead of the refusal on stderr, and on stderr after the refusal when no report line
663
+ * precedes it; a condition with no command prints none.
664
+ *
665
+ * @example
666
+ * ```ts
667
+ * CAPTURE_RECOVERIES.REGISTRY // 'registry'
668
+ * ```
669
+ */
670
+ export declare const CAPTURE_RECOVERIES: Readonly<Record<CaptureErrorCode, 'registry' | 'journey' | undefined>>;
671
+
535
672
  /**
536
673
  * Caps each refusal population so hostile records cannot flood a terminal or agent context.
537
674
  * @example
@@ -651,6 +788,20 @@ export declare const CAPTURE_STAGES: Readonly<{
651
788
  readonly rest: 'rest';
652
789
  }>;
653
790
 
791
+ /**
792
+ * Names the command that clears each freshness classification, or none where no command clears it.
793
+ *
794
+ * @remarks
795
+ * `capture` is a frames run over the read selection. A `duplicate` or an `orphan` names a registry
796
+ * or a file that no frames run changes, and a `current` frame needs nothing.
797
+ *
798
+ * @example
799
+ * ```ts
800
+ * CAPTURE_STATUS_RECOVERIES['stale-own'] // 'capture'
801
+ * ```
802
+ */
803
+ export declare const CAPTURE_STATUS_RECOVERIES: Readonly<Record<CaptureStatus, 'capture' | undefined>>;
804
+
654
805
  /**
655
806
  * Names the executable's subcommands in the order its usage text lists them.
656
807
  *
@@ -703,15 +854,34 @@ export declare const CAPTURE_USAGE: string;
703
854
  */
704
855
  export declare const CAPTURE_VITEST_ENTRY = "node_modules/vitest/vitest.mjs";
705
856
 
857
+ /**
858
+ * Names the prefixes a journey wrapper derives its own paths from.
859
+ *
860
+ * @remarks `scratch` precedes the variant in the sibling of the evidence root a run without frame
861
+ * capture writes to, and `direct` precedes the random identity of a run no runner started.
862
+ *
863
+ * @example
864
+ * ```ts
865
+ * `tmp/captures/${CAPTURE_WRAPPER_PREFIXES.scratch}light-390` // 'tmp/captures/no-capture-light-390'
866
+ * ```
867
+ */
868
+ export declare const CAPTURE_WRAPPER_PREFIXES: Readonly<{
869
+ readonly scratch: 'no-capture-';
870
+ readonly direct: 'direct-';
871
+ }>;
872
+
706
873
  /**
707
874
  * Configures the Vitest argument list one stage spawns with.
708
875
  *
709
876
  * @remarks
710
877
  * `entry` is the absolute Vitest entry and `config` the absolute wrapper path. `report` is the
711
- * absolute JSON reporter path and `projects` the Vitest project labels the stage runs. `filter`
712
- * is the tag expression. An exact `case` adds the anchored name pattern for that case and the
713
- * `final` case, so the final case still writes the run record. A `mode` adds Vitest's `--mode`
714
- * flag to discovery and execution children.
878
+ * absolute JSON reporter path and `progress` the absolute progress file path, which the stage
879
+ * passes as `--outputFile.progress` for a progress reporter to write. `projects` are the Vitest
880
+ * project labels the stage runs. `filter` is the tag expression. An exact `case` adds the anchored
881
+ * name pattern for that case and the `final` case, so the final case still writes the run record.
882
+ * A `mode` adds Vitest's `--mode` flag to discovery and execution children. If `bail` is `true`,
883
+ * the stage passes `--bail=1` and stops at its first failed case; if `false`, it passes no bail
884
+ * flag and runs every selected case. Default: `true`.
715
885
  *
716
886
  * @example
717
887
  * ```ts
@@ -719,6 +889,7 @@ export declare const CAPTURE_VITEST_ENTRY = "node_modules/vitest/vitest.mjs";
719
889
  * entry: '/repo/node_modules/vitest/vitest.mjs',
720
890
  * config: '/repo/configs/vite.journey.config.ts',
721
891
  * report: '/repo/tmp/units/runs/a/journey-selected.json',
892
+ * progress: '/repo/tmp/units/runs/a/selected.progress.jsonl',
722
893
  * projects: ['journey:light-390'],
723
894
  * filter: 'owner:pages:mail',
724
895
  * final: 'closes the run',
@@ -729,8 +900,10 @@ export declare interface CaptureArgumentsOptions {
729
900
  readonly entry: string;
730
901
  readonly config: string;
731
902
  readonly report: string;
903
+ readonly progress: string;
904
+ readonly bail?: boolean;
732
905
  readonly projects: readonly string[];
733
- readonly filter: string;
906
+ readonly filter?: string;
734
907
  readonly case?: string;
735
908
  readonly final: string;
736
909
  readonly mode?: string;
@@ -869,9 +1042,10 @@ export declare type CaptureChildTerminationHandler = (child: DuplexInterface) =>
869
1042
  *
870
1043
  * @remarks
871
1044
  * The executable's whole behaviour: it reads the subcommand, hands the rest of the command line to
872
- * the runner, the registry refresh, the preflight, or the contact sheets, and turns a refused
873
- * usage into exit 64 and any other capture refusal into exit 1, writing the refusal to its error
874
- * writer. An error that is not a capture refusal propagates.
1045
+ * the runner, the registry refresh, the preflight, or the contact sheets, or prints the progress of
1046
+ * the stage that ran last, and turns a refused usage into exit 64 and any other capture refusal
1047
+ * into exit 1, writing the refusal to its error writer. An error that is not a capture refusal
1048
+ * propagates.
875
1049
  *
876
1050
  * @example
877
1051
  * ```ts
@@ -1033,6 +1207,24 @@ export declare class CaptureDiscovery implements CaptureDiscoveryInterface {
1033
1207
  describe(): Promise<CaptureHostDescription>;
1034
1208
  }
1035
1209
 
1210
+ /**
1211
+ * Describes the empty Node configuration a wrapper returns after it has answered a discovery request.
1212
+ *
1213
+ * @remarks `include` is a mutable list because Vitest's `test.include` option declares one.
1214
+ *
1215
+ * @example
1216
+ * ```ts
1217
+ * const config: CaptureDiscoveryConfig = { test: { include: [], passWithNoTests: true, watch: false } }
1218
+ * ```
1219
+ */
1220
+ export declare interface CaptureDiscoveryConfig {
1221
+ readonly test: {
1222
+ readonly include: string[];
1223
+ readonly passWithNoTests: boolean;
1224
+ readonly watch: boolean;
1225
+ };
1226
+ }
1227
+
1036
1228
  /**
1037
1229
  * Reads a consumer's wrapper by running its installed Vitest in discovery mode.
1038
1230
  *
@@ -1097,7 +1289,7 @@ export declare interface CaptureDiscoveryOptions {
1097
1289
  * @example
1098
1290
  * ```ts
1099
1291
  * const request: CaptureDiscoveryRequest = {
1100
- * version: 1,
1292
+ * version: 2,
1101
1293
  * phase: 'discover',
1102
1294
  * id: 'run-1',
1103
1295
  * nonce: 'a1b2',
@@ -1108,7 +1300,7 @@ export declare interface CaptureDiscoveryOptions {
1108
1300
  * ```
1109
1301
  */
1110
1302
  export declare interface CaptureDiscoveryRequest {
1111
- readonly version: 1;
1303
+ readonly version: typeof CAPTURE_VERSION;
1112
1304
  readonly phase: 'discover';
1113
1305
  readonly id: string;
1114
1306
  readonly nonce: string;
@@ -1151,7 +1343,7 @@ export declare interface CaptureDiscoveryRunOptions {
1151
1343
  export declare interface CaptureEvidence {
1152
1344
  readonly registry: CaptureRegistry;
1153
1345
  readonly collections: readonly CaptureCollectionReceipt[];
1154
- readonly manifest?: CaptureStoredManifest;
1346
+ readonly manifest?: CaptureExpandedManifest;
1155
1347
  readonly lookups: readonly CaptureLookup[];
1156
1348
  readonly runs: readonly CaptureRunEvidence[];
1157
1349
  }
@@ -1228,6 +1420,22 @@ export declare interface CaptureFileSnapshot {
1228
1420
  */
1229
1421
  export declare type CaptureHashHandler = (bytes: Uint8Array) => string;
1230
1422
 
1423
+ /**
1424
+ * Describes another process that holds a request file in the request directory.
1425
+ *
1426
+ * @remarks `inspected` is `true` when the host read the process as running, and `false` when the
1427
+ * host could not read its state.
1428
+ *
1429
+ * @example
1430
+ * ```ts
1431
+ * const holder: CaptureHolder = { pid: 4242, inspected: true }
1432
+ * ```
1433
+ */
1434
+ export declare interface CaptureHolder {
1435
+ readonly pid: number;
1436
+ readonly inspected: boolean;
1437
+ }
1438
+
1231
1439
  /**
1232
1440
  * Carries the description a wrapper writes back to the runner that discovered it.
1233
1441
  *
@@ -1239,7 +1447,7 @@ export declare type CaptureHashHandler = (bytes: Uint8Array) => string;
1239
1447
  * @example
1240
1448
  * ```ts
1241
1449
  * const description: CaptureHostDescription = {
1242
- * version: 1,
1450
+ * version: 2,
1243
1451
  * id: 'run-1',
1244
1452
  * nonce: 'a1b2',
1245
1453
  * config: 'configs/vite.journey.config.ts',
@@ -1250,7 +1458,7 @@ export declare type CaptureHashHandler = (bytes: Uint8Array) => string;
1250
1458
  * ```
1251
1459
  */
1252
1460
  export declare interface CaptureHostDescription {
1253
- readonly version: 1;
1461
+ readonly version: typeof CAPTURE_VERSION;
1254
1462
  readonly id: string;
1255
1463
  readonly nonce: string;
1256
1464
  readonly config: string;
@@ -1390,8 +1598,9 @@ export declare class CaptureIntegrity implements CaptureIntegrityInterface {
1390
1598
  *
1391
1599
  * @param options - The original selector, producing variants, state, and optional exact case
1392
1600
  * @returns The agreed declaring case, output mappings, and validated lookup receipts
1393
- * @throws Thrown when evidence is missing, stale, ambiguous, or disagrees with the selection;
1394
- * the message names the explicit refresh command.
1601
+ * @throws Thrown when evidence is missing, stale, ambiguous, or disagrees with the selection; a
1602
+ * refusal of the requested state names the owner's journey refresh, and a fault in the evidence
1603
+ * read keeps its own message.
1395
1604
  *
1396
1605
  * @example
1397
1606
  * ```ts
@@ -1571,7 +1780,7 @@ export declare class CaptureInvocation implements CaptureInvocationInterface {
1571
1780
  attach(): void;
1572
1781
  release(): Promise<void>;
1573
1782
  prepare(): void;
1574
- holders(): readonly number[];
1783
+ holders(): readonly CaptureHolder[];
1575
1784
  publish(request: CaptureRequest | CaptureDiscoveryRequest): void;
1576
1785
  retract(): void;
1577
1786
  launched(log: string): boolean;
@@ -1631,14 +1840,16 @@ export declare interface CaptureInvocationInterface {
1631
1840
  /**
1632
1841
  * Lists the other live processes that hold a request file in the request directory.
1633
1842
  *
1634
- * @returns The distinct holder process ids in directory order, excluding this invocation's own lease
1843
+ * @returns One holder per distinct process id in directory order, excluding this invocation's own
1844
+ * lease and every process the host reads as ended; a process whose state cannot be read stays
1845
+ * listed with `inspected` set to `false`
1635
1846
  *
1636
1847
  * @example
1637
1848
  * ```ts
1638
1849
  * invocation.holders() // [] when no other runner is mid-stage
1639
1850
  * ```
1640
1851
  */
1641
- holders(): readonly number[];
1852
+ holders(): readonly CaptureHolder[];
1642
1853
  /**
1643
1854
  * Writes the stage or discovery request atomically, so no reader sees a partial file.
1644
1855
  *
@@ -1834,7 +2045,7 @@ export declare interface CaptureOwnership {
1834
2045
  /** Supplies the filesystem and liveness boundary for ownership arbitration.
1835
2046
  * @example
1836
2047
  * ```ts
1837
- * const host: Partial<CaptureOwnershipHost> = { alive: (pid) => readCaptureRunning(pid) }
2048
+ * const host: Partial<CaptureOwnershipHost> = { alive: (pid) => inspectProcess(pid) }
1838
2049
  * ```
1839
2050
  */
1840
2051
  export declare interface CaptureOwnershipHost {
@@ -1844,7 +2055,8 @@ export declare interface CaptureOwnershipHost {
1844
2055
  readonly write: (file: string, text: string) => void;
1845
2056
  readonly link: (source: string, target: string) => void;
1846
2057
  readonly remove: (file: string) => void;
1847
- readonly alive: (pid: number) => boolean;
2058
+ /** Reports whether a process exists; `undefined` when the host cannot tell keeps every claim it holds. */
2059
+ readonly alive: (pid: number) => boolean | undefined;
1848
2060
  }
1849
2061
 
1850
2062
  /**
@@ -1861,11 +2073,13 @@ export declare type CaptureParsedArguments<Options extends ParseArgsOptionsConfi
1861
2073
  readonly tokens: true;
1862
2074
  readonly strict: true;
1863
2075
  readonly allowPositionals: true;
2076
+ readonly allowNegative: true;
1864
2077
  }>>]: Readonly<ReturnType<typeof parseArgs<{
1865
2078
  readonly options: Options;
1866
2079
  readonly tokens: true;
1867
2080
  readonly strict: true;
1868
2081
  readonly allowPositionals: true;
2082
+ readonly allowNegative: true;
1869
2083
  }>>[Key]>;
1870
2084
  };
1871
2085
 
@@ -1895,20 +2109,6 @@ export declare interface CapturePngLimits {
1895
2109
  readonly bytes: number;
1896
2110
  }
1897
2111
 
1898
- /**
1899
- * Supplies a host-authorized physical portfolio root without repeating its states or variants.
1900
- *
1901
- * @example
1902
- * ```ts
1903
- * const root: CapturePortfolioRoot = { portfolio: 'states', directory: 'tmp/captures/states', scoped: true }
1904
- * ```
1905
- */
1906
- export declare interface CapturePortfolioRoot {
1907
- readonly portfolio: string;
1908
- readonly directory: string;
1909
- readonly scoped: boolean;
1910
- }
1911
-
1912
2112
  /**
1913
2113
  * Reads the selected population's frames and reports their freshness, mixed observations, and coverage.
1914
2114
  *
@@ -2067,6 +2267,30 @@ export declare interface CaptureProducer extends CaptureViewport {
2067
2267
  readonly project: string;
2068
2268
  }
2069
2269
 
2270
+ /**
2271
+ * Carries the progress file of the stage that ran last in a workspace, and every run it holds.
2272
+ *
2273
+ * @remarks `file` is workspace-relative and slash-separated. `runs` holds one reading per writing
2274
+ * process, and is empty while the stage has not written a complete line. A run with no `end` line
2275
+ * whose writer has ended reads as `interrupted`, with no running case and no estimate.
2276
+ * `uninspected` lists the process id of each run with no `end` line whose writer the host could not
2277
+ * inspect: that run keeps the `live` state its file records, and whether it still runs is unknown.
2278
+ *
2279
+ * @example
2280
+ * ```ts
2281
+ * const progress: CaptureProgress = {
2282
+ * file: 'tmp/capture/runs/a/selected.progress.jsonl',
2283
+ * runs: [],
2284
+ * uninspected: [],
2285
+ * }
2286
+ * ```
2287
+ */
2288
+ export declare interface CaptureProgress {
2289
+ readonly file: string;
2290
+ readonly runs: readonly ProgressRun[];
2291
+ readonly uninspected: readonly number[];
2292
+ }
2293
+
2070
2294
  /**
2071
2295
  * Preserves the wrapper's host declarations, including optional uniform scopes, for consumers.
2072
2296
  *
@@ -2117,6 +2341,22 @@ export declare interface CaptureProject {
2117
2341
  readonly standalone: readonly CapturePortfolioRoot[];
2118
2342
  }
2119
2343
 
2344
+ /**
2345
+ * Builds one variant's Vitest project from the host's own defaults and capture's override.
2346
+ *
2347
+ * @remarks The host names the project and merges `override` into it last, so capture's tags,
2348
+ * provided values, and browser command reach the project. The runner reads the project name the
2349
+ * host chose.
2350
+ *
2351
+ * @example
2352
+ * ```ts
2353
+ * const project: CaptureProjectHandler<UserWorkspaceConfig> = (variant, override) => ({
2354
+ * test: { ...override.test, name: `journey:${variant.name}` },
2355
+ * })
2356
+ * ```
2357
+ */
2358
+ export declare type CaptureProjectHandler<TProject> = (variant: CaptureViewport, override: CaptureWrapperOverride) => TProject;
2359
+
2120
2360
  /**
2121
2361
  * Reports validated project evidence, retaining empty successful selections explicitly.
2122
2362
  *
@@ -2225,6 +2465,34 @@ export declare interface CaptureReaderOptions {
2225
2465
  readonly stderr?: CaptureWriteHandler;
2226
2466
  }
2227
2467
 
2468
+ /**
2469
+ * Holds the report a preflight prints on its `READER` line and a contact-sheet index carries.
2470
+ *
2471
+ * @remarks
2472
+ * `identical` groups the files whose bytes are identical, and `sizes` gives each readable image's
2473
+ * decoded dimensions and its file size in bytes. `acceptance` is always `false`: the report is
2474
+ * iteration evidence and never assembled-portfolio acceptance.
2475
+ *
2476
+ * @example
2477
+ * ```ts
2478
+ * const report: CaptureReaderReport = buildCaptureReaderReport(await preflight.check())
2479
+ * ```
2480
+ */
2481
+ export declare interface CaptureReaderReport {
2482
+ readonly selection: CaptureReadResult;
2483
+ readonly freshness: CaptureCheckResult;
2484
+ readonly mixed: readonly string[];
2485
+ readonly issues: readonly string[];
2486
+ readonly identical: ReadonlyArray<readonly string[]>;
2487
+ readonly sizes: ReadonlyArray<{
2488
+ readonly file: string;
2489
+ readonly width: number;
2490
+ readonly height: number;
2491
+ readonly bytes: number;
2492
+ }>;
2493
+ readonly acceptance: false;
2494
+ }
2495
+
2228
2496
  /**
2229
2497
  * Returns a reader's authenticated selection, uniform scopes, and engine for pixel classification.
2230
2498
  *
@@ -2299,14 +2567,16 @@ export declare interface CaptureReceiptInput {
2299
2567
  * requires, so it cannot stamp through the integrity engine. It reads the wrapper through the same
2300
2568
  * discovery the runner uses, takes the same invocation entity, request file, and Vitest child, and runs
2301
2569
  * every selected producing variant in one stage, one child that receives each variant's project, with
2302
- * the `all` selector and no capture variable. It reads the stage's reporter once and each variant's
2570
+ * the `all` selector and no capture variable. The stage passes no tag filter, so it runs the whole
2571
+ * suite, which stands in for the consumer's complete test run. It reads the stage's reporter once and each variant's
2303
2572
  * final record, takes each project's input population before and after, and builds one receipt per
2304
2573
  * variant, all naming the one reporter, through `buildCaptureRegistry`. The registry is written to a
2305
2574
  * candidate beside its target, read back through the integrity engine, and only then renamed into
2306
2575
  * place, so a registry the engine would refuse never replaces a good one. With `--variant`, the
2307
2576
  * existing registry's receipts for the other declared variants are kept. It never widens a scoped
2308
2577
  * run into a refresh and refuses while another runner holds a request file in the request directory.
2309
- * Before any stage, it reads the inherited manifest and lookup journal and refuses an unsupported
2578
+ * Before any stage, it reads the inherited manifest and lookup journal: it refuses a document of
2579
+ * another version with that refusal's own removal and refresh commands alone, and an unsupported
2310
2580
  * schema with the file to inspect and repair.
2311
2581
  *
2312
2582
  * @example
@@ -2389,6 +2659,7 @@ export declare interface CaptureRegistrarOptions {
2389
2659
  * Carries the parsed registry command line: the wrapper, the variants to refresh, and the mode.
2390
2660
  *
2391
2661
  * @remarks `config` is absolute. An empty `variants` list refreshes every declared producing variant.
2662
+ * `bail` is `false` when the command line carries `--no-bail`, and absent otherwise.
2392
2663
  *
2393
2664
  * @example
2394
2665
  * ```ts
@@ -2399,6 +2670,7 @@ export declare interface CaptureRegistryArguments {
2399
2670
  readonly config: string;
2400
2671
  readonly variants: readonly string[];
2401
2672
  readonly mode?: string;
2673
+ readonly bail?: boolean;
2402
2674
  }
2403
2675
 
2404
2676
  /**
@@ -2497,6 +2769,9 @@ export declare class CaptureRunner implements CaptureRunnerInterface {
2497
2769
  * Carries parsed runner arguments, including an optional wrapper mode, while leaving omitted
2498
2770
  * selectors available to the usage diagnostic.
2499
2771
  *
2772
+ * @remarks `bail` is `false` when the command line carries `--no-bail`, and absent otherwise, which
2773
+ * keeps the stage's default first-failure stop.
2774
+ *
2500
2775
  * @example
2501
2776
  * ```ts
2502
2777
  * const parsed: CaptureRunnerArguments = { config: '/repo/configs/vite.journey.config.ts', variants: [] }
@@ -2506,6 +2781,7 @@ export declare interface CaptureRunnerArguments {
2506
2781
  readonly selector?: string;
2507
2782
  readonly changed?: string;
2508
2783
  readonly plan?: boolean;
2784
+ readonly bail?: boolean;
2509
2785
  readonly config: string;
2510
2786
  readonly mode?: string;
2511
2787
  readonly variants: readonly string[];
@@ -2582,7 +2858,8 @@ export declare interface CaptureRunnerOptions {
2582
2858
  * wrapper path, and `final` the full name of the case that closes a variant's run. `filter` is
2583
2859
  * the tag expression. `case` and `state` appear only when the command line named them, and `case`
2584
2860
  * holds the resolved declaring case once a state selects one. `command` is the request command
2585
- * every stage records. `mode` selects the wrapper's Vitest mode when present.
2861
+ * every stage records. `mode` selects the wrapper's Vitest mode when present. A `false` `bail`
2862
+ * runs every selected case after a failure.
2586
2863
  *
2587
2864
  * @example
2588
2865
  * ```ts
@@ -2608,6 +2885,7 @@ export declare interface CaptureRunPlan {
2608
2885
  readonly directory: string;
2609
2886
  readonly config: string;
2610
2887
  readonly mode?: string;
2888
+ readonly bail?: boolean;
2611
2889
  }
2612
2890
 
2613
2891
  /**
@@ -2650,6 +2928,36 @@ export declare interface CaptureSheetGroup {
2650
2928
  readonly picture: CapturePicture;
2651
2929
  }
2652
2930
 
2931
+ /**
2932
+ * Holds a contact-sheet run's `index.json` document, which its `SHEETS` line also prints.
2933
+ *
2934
+ * @remarks
2935
+ * It carries every member of the preflight report beside `sheets`, which lists each written sheet
2936
+ * with its size and its rows of groups. A cell keeps every member of its sheet cell except the
2937
+ * picture, and `displayed` gives the size of the shrunk picture the sheet shows.
2938
+ *
2939
+ * @example
2940
+ * ```ts
2941
+ * const index: CaptureSheetIndex = { ...buildCaptureReaderReport(result), sheets: [] }
2942
+ * ```
2943
+ */
2944
+ export declare interface CaptureSheetIndex extends CaptureReaderReport {
2945
+ readonly sheets: ReadonlyArray<{
2946
+ readonly file: string;
2947
+ readonly width: number;
2948
+ readonly height: number;
2949
+ readonly rows: ReadonlyArray<ReadonlyArray<{
2950
+ readonly identity: string;
2951
+ readonly cells: ReadonlyArray<Omit<CaptureSheetCell, 'picture'> & {
2952
+ readonly displayed: {
2953
+ readonly width: number;
2954
+ readonly height: number;
2955
+ };
2956
+ }>;
2957
+ }>>;
2958
+ }>;
2959
+ }
2960
+
2653
2961
  /**
2654
2962
  * Carries a contact-sheet output request separately from the population selection.
2655
2963
  *
@@ -2698,8 +3006,8 @@ export declare interface CaptureSheetRow {
2698
3006
  * selection through `CapturePreflight`, so it judges the same population the preflight does and
2699
3007
  * keeps its refusals. It writes the sheets, an index of every cell, and a notes document into a new
2700
3008
  * directory that is contained in the workspace, has an existing parent, and lies outside every
2701
- * selected capture directory. A frame whose image cannot be read shows as a red mark and is indexed
2702
- * as `missing`.
3009
+ * selected capture directory. A frame whose image cannot be read shows as a red mark with no source
3010
+ * size, and its index cell carries the freshness the engine classified, `missing` for an absent file.
2703
3011
  *
2704
3012
  * @example
2705
3013
  * ```ts
@@ -2895,6 +3203,99 @@ export declare interface CaptureStaleOptions extends CaptureReadOptions {
2895
3203
  */
2896
3204
  export declare type CaptureTerminationHandler = () => Promise<boolean>;
2897
3205
 
3206
+ /**
3207
+ * Describes the Vitest configuration a journey wrapper returns for an execution child.
3208
+ *
3209
+ * @remarks `plugins` holds one progress plugin and `projects` one project per variant. Both lists
3210
+ * are mutable because Vitest's `plugins` and `test.projects` options declare mutable lists.
3211
+ *
3212
+ * @example
3213
+ * ```ts
3214
+ * const config: CaptureWrapperConfig<UserWorkspaceConfig> = {
3215
+ * plugins: [createProgressPlugin()],
3216
+ * test: { projects: [project] },
3217
+ * }
3218
+ * ```
3219
+ */
3220
+ export declare interface CaptureWrapperConfig<TProject> {
3221
+ readonly plugins: ProgressPluginInterface[];
3222
+ readonly test: {
3223
+ readonly projects: TProject[];
3224
+ };
3225
+ }
3226
+
3227
+ /**
3228
+ * Configures the journey wrapper `buildCaptureWrapper` assembles.
3229
+ *
3230
+ * @remarks
3231
+ * `url` is the wrapper module's own `import.meta.url`. `variants` declares the producing
3232
+ * viewports in host order, `owners` every canonical owner path, `first` the narrow-stage variant,
3233
+ * and `final` the case that writes each run record. `directory` is the workspace-relative evidence
3234
+ * root. `inputs` lists the integrity input patterns, `sources` the shared and test source patterns
3235
+ * the suite attributes to every destination, `portfolios` the primary portfolio roots, and
3236
+ * `uniform` the owner selectors the preflight judges for mixed observations. `project` builds each
3237
+ * variant's project from capture's override.
3238
+ *
3239
+ * @example
3240
+ * ```ts
3241
+ * const options: CaptureWrapperOptions<UserWorkspaceConfig> = {
3242
+ * url: import.meta.url,
3243
+ * variants: [{ name: 'light-390', width: 390, height: 844 }],
3244
+ * owners: ['pages:mail'],
3245
+ * first: 'light-390',
3246
+ * final: 'closes the run',
3247
+ * directory: 'tmp/captures/states',
3248
+ * inputs: ['src/**'],
3249
+ * sources: { shared: ['src/core/**'], tests: ['tests/**'] },
3250
+ * portfolios: [{ portfolio: 'states', directory: 'tmp/captures/states', scoped: true }],
3251
+ * project: (variant, override) => ({ test: { ...override.test, name: `journey:${variant.name}` } }),
3252
+ * }
3253
+ * ```
3254
+ */
3255
+ export declare interface CaptureWrapperOptions<TProject> {
3256
+ readonly url: string;
3257
+ readonly variants: readonly CaptureViewport[];
3258
+ readonly owners: readonly string[];
3259
+ readonly first: string;
3260
+ readonly final: string;
3261
+ readonly directory: string;
3262
+ readonly inputs: readonly string[];
3263
+ readonly sources: Pick<CaptureSources, 'shared' | 'tests'>;
3264
+ readonly portfolios: readonly CapturePortfolioRoot[];
3265
+ readonly uniform?: readonly string[];
3266
+ readonly project: CaptureProjectHandler<TProject>;
3267
+ }
3268
+
3269
+ /**
3270
+ * Describes the values capture merges into each variant's Vitest project.
3271
+ *
3272
+ * @remarks
3273
+ * `tags` declares every owner tag, `provide` carries the values the runner and the suite read, and
3274
+ * `browser.commands` registers `readCaptureFrames`, which lists the frames under the project's
3275
+ * provided directory. The lists are mutable because Vitest's `test.tags` option declares one, and
3276
+ * the command record is an object type so it assigns to Vitest's command record.
3277
+ *
3278
+ * @example
3279
+ * ```ts
3280
+ * const override: CaptureWrapperOverride = {
3281
+ * test: { tags: [{ name: 'owner:pages' }], provide, browser: { commands: { readCaptureFrames } } },
3282
+ * }
3283
+ * ```
3284
+ */
3285
+ export declare interface CaptureWrapperOverride {
3286
+ readonly test: {
3287
+ readonly tags: Array<{
3288
+ readonly name: string;
3289
+ }>;
3290
+ readonly provide: CaptureProvided;
3291
+ readonly browser: {
3292
+ readonly commands: {
3293
+ readonly readCaptureFrames: () => readonly string[];
3294
+ };
3295
+ };
3296
+ };
3297
+ }
3298
+
2898
3299
  /**
2899
3300
  * Writes one chunk of runner output to the stream the host chooses.
2900
3301
  *
@@ -2934,6 +3335,31 @@ export declare function collectCaptureErrors(file: string, text: string): readon
2934
3335
  */
2935
3336
  export declare function collectCaptureIdentical(images: readonly CaptureImageResult[]): ReadonlyArray<readonly string[]>;
2936
3337
 
3338
+ /**
3339
+ * Collects the owner selectors the projects' owner tags declare, once each, in tag order.
3340
+ *
3341
+ * @param projects - The discovered host projects
3342
+ * @returns Each tagged owner selector, ancestors included where the wrapper tags them
3343
+ * @example
3344
+ * ```ts
3345
+ * collectCaptureOwners(projects) // ['pages', 'pages:mail'] for owner:pages and owner:pages:mail tags
3346
+ * ```
3347
+ */
3348
+ export declare function collectCaptureOwners(projects: readonly CaptureProject[]): readonly string[];
3349
+
3350
+ /**
3351
+ * Collects the variants that produce each destination across the registry receipts and the lookup runs.
3352
+ *
3353
+ * @param evidence - The accepted registry and the authenticated lookup runs
3354
+ * @returns Each destination description mapped to its distinct producing variants, in first-seen order
3355
+ *
3356
+ * @example
3357
+ * ```ts
3358
+ * collectCaptureProducers({ registry, runs: [] }).get(describeCaptureDestination(destination)) // ['light-390']
3359
+ * ```
3360
+ */
3361
+ export declare function collectCaptureProducers(evidence: Pick<CaptureEvidence, 'registry' | 'runs'>): ReadonlyMap<string, readonly string[]>;
3362
+
2937
3363
  /**
2938
3364
  * Composes pictures on the contact-sheet gray background.
2939
3365
  *
@@ -2941,7 +3367,10 @@ export declare function collectCaptureIdentical(images: readonly CaptureImageRes
2941
3367
  * @param vertical - If `true`, stacks rows; if `false`, places cells side by side
2942
3368
  * @param gap - The space between source pictures. Default: 6.
2943
3369
  * @returns A separately owned composite
2944
- * @throws Thrown for an empty picture selection.
3370
+ * @throws Thrown for an empty picture selection, with the `USAGE` condition.
3371
+ * @throws Thrown with the `EVIDENCE` condition when a width, a height, or the gap is not a whole
3372
+ * number from 0 to `CAPTURE_PNG_LIMITS.side`, or when the composite exceeds that side or the
3373
+ * `CAPTURE_PNG_LIMITS.pixels` budget.
2945
3374
  *
2946
3375
  * @example
2947
3376
  * ```ts
@@ -2950,6 +3379,22 @@ export declare function collectCaptureIdentical(images: readonly CaptureImageRes
2950
3379
  */
2951
3380
  export declare function composeCapturePictures(pictures: readonly CapturePicture[], vertical: boolean, gap?: number): CapturePicture;
2952
3381
 
3382
+ /**
3383
+ * Computes the width and height of the composite that `composeCapturePictures` builds from
3384
+ * pictures of these sizes.
3385
+ *
3386
+ * @param pictures - The ordered source sizes
3387
+ * @param vertical - If `true`, stacks them; if `false`, places them side by side
3388
+ * @param gap - The space between source pictures. Default: 6.
3389
+ * @returns The composite's width and height, each 0 for no pictures
3390
+ *
3391
+ * @example
3392
+ * ```ts
3393
+ * computeCaptureComposite([{ width: 4, height: 2 }, { width: 3, height: 5 }], false) // { width: 13, height: 5 }
3394
+ * ```
3395
+ */
3396
+ export declare function computeCaptureComposite(pictures: ReadonlyArray<Pick<CapturePicture, 'width' | 'height'>>, vertical: boolean, gap?: number): Pick<CapturePicture, 'width' | 'height'>;
3397
+
2953
3398
  /**
2954
3399
  * Hashes exact source or image bytes with SHA-256.
2955
3400
  *
@@ -2963,6 +3408,44 @@ export declare function composeCapturePictures(pictures: readonly CapturePicture
2963
3408
  */
2964
3409
  export declare function computeCaptureHash(bytes: string | Uint8Array): string;
2965
3410
 
3411
+ /**
3412
+ * Computes the key under which a pattern list's matched subset of one input population is memoized.
3413
+ *
3414
+ * @remarks
3415
+ * The key joins the population's digest with the sorted patterns, so a list in any order over one
3416
+ * population shares a key, and one population never answers for another.
3417
+ *
3418
+ * @param inputs - The digested input population the patterns match against
3419
+ * @param patterns - The native glob patterns, in any order
3420
+ * @returns The memo key of the population and the pattern list
3421
+ *
3422
+ * @example
3423
+ * ```ts
3424
+ * const inputs = buildCaptureDigest(['src/**'], { 'src/a.ts': 'f'.repeat(64) })
3425
+ * computeCaptureMatchKey(inputs, ['src/*.ts', 'src/*.md']) === computeCaptureMatchKey(inputs, ['src/*.md', 'src/*.ts']) // true
3426
+ * ```
3427
+ */
3428
+ export declare function computeCaptureMatchKey(inputs: CaptureDigest, patterns: readonly string[]): string;
3429
+
3430
+ /**
3431
+ * Computes the table key of a file map, the digest from `buildCaptureDigest([], files)`, once per map.
3432
+ *
3433
+ * @remarks
3434
+ * The memo belongs to one document build: it holds each map by identity beside its ordered,
3435
+ * digested population, so equal maps from different objects share one key.
3436
+ *
3437
+ * @param files - The path-to-hash map a document stores once
3438
+ * @param memo - The build's memo from each map to its ordered, digested population
3439
+ * @returns The digest that names the map in the document's population table
3440
+ *
3441
+ * @example
3442
+ * ```ts
3443
+ * const memo = new Map()
3444
+ * computeCaptureTableKey({ 'src/a.ts': 'f'.repeat(64) }, memo).length // 64
3445
+ * ```
3446
+ */
3447
+ export declare function computeCaptureTableKey(files: Readonly<Record<string, string>>, memo: Map<Readonly<Record<string, string>>, CaptureDigest>): string;
3448
+
2966
3449
  /**
2967
3450
  * Computes the registry identity from its authenticated receipts and exact output population.
2968
3451
  *
@@ -2971,7 +3454,7 @@ export declare function computeCaptureHash(bytes: string | Uint8Array): string;
2971
3454
  *
2972
3455
  * @example
2973
3456
  * ```ts
2974
- * computeRegistryDigest({ version: 1, receipts: [], entries: [] }).length // 64
3457
+ * computeRegistryDigest({ version: 2, receipts: [], entries: [] }).length // 64
2975
3458
  * ```
2976
3459
  */
2977
3460
  export declare function computeRegistryDigest(registry: Pick<CaptureRegistry, 'version' | 'receipts' | 'entries'>): string;
@@ -3116,6 +3599,22 @@ export declare function createCaptureSheets(options: CaptureSheetOptions): Captu
3116
3599
  */
3117
3600
  export declare function decodeCapturePicture(bytes: Buffer): CapturePicture;
3118
3601
 
3602
+ /**
3603
+ * Describes the PNG chunk whose header sits at an offset by its type, offset, and length.
3604
+ *
3605
+ * @remarks The type is untrusted file bytes, so it is JSON-encoded and length-capped.
3606
+ *
3607
+ * @param bytes - The complete PNG
3608
+ * @param position - The offset of the chunk header, with its 8 header bytes inside `bytes`
3609
+ * @returns The chunk's description for a refusal
3610
+ *
3611
+ * @example
3612
+ * ```ts
3613
+ * describeCaptureChunk(encodeCapturePicture(picture), 8) // '"IHDR" at offset 8 with length 13'
3614
+ * ```
3615
+ */
3616
+ export declare function describeCaptureChunk(bytes: Buffer, position: number): string;
3617
+
3119
3618
  /**
3120
3619
  * Describes a refusal with its key path, bounded preview, correction, and member differences.
3121
3620
  *
@@ -3126,6 +3625,21 @@ export declare function decodeCapturePicture(bytes: Buffer): CapturePicture;
3126
3625
  */
3127
3626
  export declare function describeCaptureFault(path: string, value: unknown, expected: string, candidates?: readonly string[], required?: readonly string[], allowed?: readonly string[]): string;
3128
3627
 
3628
+ /**
3629
+ * Describes the request holders that keep a workspace busy, naming apart those the host could not inspect.
3630
+ *
3631
+ * @param holders - The holders `CaptureInvocationInterface.holders` lists
3632
+ * @param directory - The workspace-relative request directory that holds their request files
3633
+ * @returns The running holders' sentence, then the uninspected holders' sentence with its correction
3634
+ *
3635
+ * @example
3636
+ * ```ts
3637
+ * describeCaptureHolders([{ pid: 4242, inspected: true }], 'tmp/capture')
3638
+ * // 'Another runner holds this workspace (process 4242)'
3639
+ * ```
3640
+ */
3641
+ export declare function describeCaptureHolders(holders: readonly CaptureHolder[], directory: string): string;
3642
+
3129
3643
  /**
3130
3644
  * Describes a bounded member population and the number omitted from its preview.
3131
3645
  * @example
@@ -3199,7 +3713,8 @@ export declare function encodeCaptureChunk(name: string, data: Buffer): Buffer;
3199
3713
  * @param picture - The complete RGB pixel buffer
3200
3714
  * @param compressed - If `true`, compresses scanlines; if `false`, stores them in the deflate stream. Default: `true`.
3201
3715
  * @returns A PNG file
3202
- * @throws Thrown when dimensions and pixel length disagree.
3716
+ * @throws Thrown when a dimension is not a whole number of at least 1, or when the pixel length is
3717
+ * not `width * height * 3`.
3203
3718
  *
3204
3719
  * @example
3205
3720
  * ```ts
@@ -3234,11 +3749,30 @@ export declare function encodeCaptureWord(value: number): Buffer;
3234
3749
  */
3235
3750
  export declare function escapeCapturePattern(text: string): string;
3236
3751
 
3752
+ /**
3753
+ * Filters an input population's paths that match any listed pattern.
3754
+ *
3755
+ * @remarks
3756
+ * Each path is matched with the `matchesGlob` function from `node:path`.
3757
+ *
3758
+ * @param inputs - The digested input population whose paths are matched
3759
+ * @param patterns - The native glob patterns
3760
+ * @returns The population's paths that match at least one pattern, in population order
3761
+ *
3762
+ * @example
3763
+ * ```ts
3764
+ * const inputs = buildCaptureDigest(['src/**'], { 'src/a.ts': 'f'.repeat(64), 'src/b.md': 'e'.repeat(64) })
3765
+ * filterCaptureInputs(inputs, ['src/*.ts']) // Set { 'src/a.ts' }
3766
+ * ```
3767
+ */
3768
+ export declare function filterCaptureInputs(inputs: CaptureDigest, patterns: readonly string[]): ReadonlySet<string>;
3769
+
3237
3770
  /**
3238
3771
  * Inflates a PNG's compressed stream, refusing one that is corrupt or longer than declared.
3239
3772
  *
3240
3773
  * @param data - The concatenated data-chunk payloads
3241
- * @param length - The inflated length the header's dimensions declare
3774
+ * @param length - The inflated length the header's dimensions declare, a whole number from 1 to
3775
+ * `Number.MAX_SAFE_INTEGER`; any other value gives an unspecified result that might throw
3242
3776
  * @returns The inflated scanlines
3243
3777
  * @throws Thrown when the stream is not valid deflate data or inflates past `length`.
3244
3778
  *
@@ -3259,6 +3793,20 @@ export declare function inflateCaptureStream(data: Buffer, length: number): Buff
3259
3793
  */
3260
3794
  export declare function matchesCaptureFile(previous: CaptureFileSnapshot, current: CaptureFileSnapshot | undefined): boolean;
3261
3795
 
3796
+ /**
3797
+ * Checks whether a picture size fits `CAPTURE_PNG_LIMITS`, per side and in pixels.
3798
+ *
3799
+ * @param picture - The size to check
3800
+ * @returns True if neither side passes `CAPTURE_PNG_LIMITS.side` and the area does not pass
3801
+ * `CAPTURE_PNG_LIMITS.pixels`; false otherwise
3802
+ *
3803
+ * @example
3804
+ * ```ts
3805
+ * matchesCaptureLimits({ width: 13040, height: 1636 }) // false
3806
+ * ```
3807
+ */
3808
+ export declare function matchesCaptureLimits(picture: Pick<CapturePicture, 'width' | 'height'>): boolean;
3809
+
3262
3810
  /**
3263
3811
  * Checks whether bytes open with the eight-byte PNG signature.
3264
3812
  *
@@ -3283,6 +3831,24 @@ export declare function matchesCaptureSignature(bytes: Uint8Array): boolean;
3283
3831
  */
3284
3832
  export declare function matchesCaptureTransient(error: unknown, platform?: NodeJS.Platform): boolean;
3285
3833
 
3834
+ /**
3835
+ * Checks whether an error is the refusal `requireCaptureVersion` throws for another document version.
3836
+ *
3837
+ * @remarks
3838
+ * A caller that adds its own recovery to a refusal passes this one through unchanged, because it
3839
+ * already names the removal and the refresh.
3840
+ *
3841
+ * @param error - The caught value
3842
+ * @returns True if it is an `EVIDENCE` capture error whose context carries a file and a numeric version; false otherwise
3843
+ *
3844
+ * @example
3845
+ * ```ts
3846
+ * matchesCaptureVersionRefusal(captureError(() => requireCaptureVersion({ version: 1 }, 'Registry', file, [file]))) // true
3847
+ * matchesCaptureVersionRefusal(new Error('Invalid')) // false
3848
+ * ```
3849
+ */
3850
+ export declare function matchesCaptureVersionRefusal(error: unknown): boolean;
3851
+
3286
3852
  /**
3287
3853
  * Merges unique lookup populations with incoming identities replacing inherited ones.
3288
3854
  *
@@ -3336,7 +3902,8 @@ export declare function readCaptureAncestor(path: string): string;
3336
3902
  *
3337
3903
  * @remarks
3338
3904
  * `--state` belongs to `capture` and `stale`, and `--portfolio` to `stale`. Journey and capture
3339
- * accept `--changed <ref>` instead of a selector, with optional valueless `--plan`. Every other
3905
+ * accept `--changed <ref>` instead of a selector, with optional valueless `--plan`, and valueless
3906
+ * `--no-bail`, which sets `bail` to `false`. Every other
3340
3907
  * flag takes one nonempty value, either separated or in equals form, and only `--variant` repeats.
3341
3908
  * A value beginning with a dash requires equals form. A bare invocation leaves its selector absent
3342
3909
  * so the caller can print usage with the declared selectors.
@@ -3363,7 +3930,10 @@ export declare function readCaptureArguments(argv: readonly string[], command: C
3363
3930
  * @param bytes - The complete PNG
3364
3931
  * @param offset - The next chunk header. Default: 8.
3365
3932
  * @returns Ordered compressed-data chunks
3366
- * @throws Thrown for truncated chunks, bad checksums, or a missing closing chunk.
3933
+ * @throws Thrown for bytes over the file budget; a truncated chunk, which a file with no closing
3934
+ * chunk also meets; a bad checksum; a closing chunk that is not empty and last; an IHDR chunk
3935
+ * anywhere but offset 8; a critical chunk other than IHDR, PLTE, IDAT, and IEND; or IDAT chunks
3936
+ * that are not consecutive.
3367
3937
  *
3368
3938
  * @example
3369
3939
  * ```ts
@@ -3413,6 +3983,27 @@ export declare function readCaptureDescription(value: unknown, expected: Capture
3413
3983
  */
3414
3984
  export declare function readCaptureEntry(value: unknown): CaptureHostEntry;
3415
3985
 
3986
+ /**
3987
+ * Lists the frames a portfolio directory holds, as paths relative to it, in sorted order.
3988
+ *
3989
+ * @remarks
3990
+ * A frame is a `.png` file at the directory's top level or directly inside one of the scope
3991
+ * directories. The run records directory holds no frame, and every other directory is unknown. A
3992
+ * missing directory, or one removed between the listing and its read, holds no frame.
3993
+ *
3994
+ * @param directory - The absolute portfolio directory
3995
+ * @param scopes - The scope directories the owners declare, each an owner path's first segment
3996
+ * @returns Each frame's slash-separated path relative to the directory
3997
+ * @throws Thrown as an `EVIDENCE` capture error for a frame beneath the run records, an unknown
3998
+ * directory, a directory inside a scope, or a directory the host refuses to read.
3999
+ *
4000
+ * @example
4001
+ * ```ts
4002
+ * readCaptureFrames('/repo/tmp/captures/states', ['pages']) // ['pages/inbox--light-390.png']
4003
+ * ```
4004
+ */
4005
+ export declare function readCaptureFrames(directory: string, scopes: readonly string[]): readonly string[];
4006
+
3416
4007
  /**
3417
4008
  * Reads an image only after its opened file's size is inside the compressed-byte budget.
3418
4009
  * @throws Thrown when the file is oversized, unreadable, or changes size during the read.
@@ -3446,23 +4037,77 @@ export declare function readCaptureImage(file: string): Buffer;
3446
4037
  */
3447
4038
  export declare function readCaptureInputs(root: string, patterns: readonly string[], hash?: CaptureHashHandler, read?: CaptureInputHandler): Readonly<Record<string, string>>;
3448
4039
 
4040
+ /**
4041
+ * Lists a directory through a reader, answering an empty list for a missing directory.
4042
+ *
4043
+ * @param directory - The absolute directory to list
4044
+ * @param list - Reads the directory's entries, such as `readdirSync` with its options
4045
+ * @returns The entries the reader returned, or none when the directory is missing
4046
+ * @throws Thrown as an `EVIDENCE` capture error naming the directory for any other failure to read it.
4047
+ *
4048
+ * @example
4049
+ * ```ts
4050
+ * readCaptureListing('/repo/tmp/captures/states/pages', (path) => readdirSync(path)) // ['inbox--light-390.png']
4051
+ * ```
4052
+ */
4053
+ export declare function readCaptureListing<TEntry>(directory: string, list: (path: string) => readonly TEntry[]): readonly TEntry[];
4054
+
4055
+ /**
4056
+ * Admits a decoded lookup journal, checking its declared version before its schema.
4057
+ *
4058
+ * @param value - The decoded journal file
4059
+ * @param file - The journal path each refusal names
4060
+ * @returns The journal, whose table digests `readCaptureLookups` verifies
4061
+ * @throws Thrown with the removal and the refresh commands when the journal declares another
4062
+ * protocol version, and thrown naming the file when its schema is invalid.
4063
+ *
4064
+ * @example
4065
+ * ```ts
4066
+ * readCaptureLookupJournal(JSON.parse(text), 'tmp/captures/states/lookups.json').lookups.length
4067
+ * ```
4068
+ */
4069
+ export declare function readCaptureLookupJournal(value: unknown, file: string): CaptureLookupJournal;
4070
+
3449
4071
  /**
3450
4072
  * Resolves journal lookup references after verifying each stored input population's digest.
3451
4073
  *
3452
4074
  * @param journal - A structurally validated lookup journal
4075
+ * @param file - The journal path each refusal names
3453
4076
  * @returns Every expanded lookup in its stored order, sharing the verified input maps
3454
- * @throws Thrown when an input digest differs from its map or a lookup names an unknown digest.
4077
+ * @throws Thrown when a population does not hash to its key or a lookup names an unknown key.
4078
+ *
4079
+ * @example
4080
+ * ```ts
4081
+ * readCaptureLookups(buildCaptureLookupJournal([], []), 'tmp/captures/states/lookups.json') // []
4082
+ * ```
4083
+ */
4084
+ export declare function readCaptureLookups(journal: CaptureLookupJournal, file: string): readonly CaptureLookup[];
4085
+
4086
+ /**
4087
+ * Admits a stored manifest and expands every table reference into the file map it names.
4088
+ *
4089
+ * @param value - The decoded manifest file
4090
+ * @param file - The manifest path each refusal names
4091
+ * @returns The expanded manifest, whose references to one key share one verified map
4092
+ * @throws Thrown with the removal and the refresh commands when the document declares another
4093
+ * protocol version, and thrown when its schema is invalid, a table map does not hash to its key,
4094
+ * or a reference names no table key.
3455
4095
  *
3456
4096
  * @example
3457
4097
  * ```ts
3458
- * readCaptureLookups(buildCaptureLookupJournal([], [])) // []
4098
+ * const manifest = readCaptureManifest(JSON.parse(text), 'tmp/captures/states/manifest.json')
4099
+ * manifest.lookups[0]?.inputs // the expanded input map
3459
4100
  * ```
3460
4101
  */
3461
- export declare function readCaptureLookups(journal: CaptureLookupJournal): readonly CaptureLookup[];
4102
+ export declare function readCaptureManifest(value: unknown, file: string): CaptureExpandedManifest;
3462
4103
 
3463
4104
  /**
3464
4105
  * Parses standard option tokens and refuses empty values, terminators, and repeated single options.
3465
4106
  *
4107
+ * @remarks A boolean option whose default is `true` reads its `--no-` form as `false` and refuses
4108
+ * its positive form, so `--no-bail` is the one spelling of `bail`; the `--no-` form of any other
4109
+ * option is refused as unknown. An option and its `--no-` form repeat each other.
4110
+ *
3466
4111
  * @param argv - The arguments after the subcommand
3467
4112
  * @param options - The command's frozen Node option definitions
3468
4113
  * @param usage - The command syntax appended to every parser refusal
@@ -3470,6 +4115,7 @@ export declare function readCaptureLookups(journal: CaptureLookupJournal): reado
3470
4115
  * @example
3471
4116
  * ```ts
3472
4117
  * readCaptureOptions(['--case=-draft'], CAPTURE_COMMAND_OPTIONS.journey, 'Usage: capture journey <selector>').values.case // '-draft'
4118
+ * readCaptureOptions(['--no-bail'], CAPTURE_COMMAND_OPTIONS.journey, 'Usage: capture journey <selector>').values.bail // false
3473
4119
  * ```
3474
4120
  */
3475
4121
  export declare function readCaptureOptions<Options extends ParseArgsOptionsConfig>(argv: readonly string[], options: Options, usage: string): CaptureParsedArguments<Options>;
@@ -3490,6 +4136,33 @@ export declare function readCaptureOptions<Options extends ParseArgsOptionsConfi
3490
4136
  */
3491
4137
  export declare function readCapturePortfolios(value: unknown, subject: string): readonly CapturePortfolioRoot[];
3492
4138
 
4139
+ /**
4140
+ * Reads the progress file of the stage that is running, or that ran last, in a workspace.
4141
+ *
4142
+ * @remarks
4143
+ * The file is the most recently modified `<stage>.progress.jsonl` beneath the request directory's
4144
+ * run directories. The progress file is an observation of the run and never evidence. A partial
4145
+ * last line, which the reporter can still be appending, is not read, so a file with no complete
4146
+ * line holds no run. For each run with no `end` line, `alive` reads the process id its `init` line
4147
+ * records: a writer that has ended turns the run `interrupted`, measured to the time of its last
4148
+ * line, and a writer the host cannot inspect, or an id that is not a positive safe integer, lists
4149
+ * the run's id in `uninspected`.
4150
+ *
4151
+ * @param root - The absolute workspace path
4152
+ * @param requests - The workspace-relative request directory
4153
+ * @param now - The wall-clock time of the reading, in milliseconds since the Unix epoch. Default: `Date.now()`
4154
+ * @param alive - Reads whether a writer process exists, or `undefined` when the host cannot tell. Default: `inspectProcess` from `@orkestrel/process/server`
4155
+ * @returns The workspace-relative file, one reading per process that wrote it, and the writers the host could not inspect
4156
+ * @throws Thrown as a `STAGE` capture error when no stage has written a progress file, or when the
4157
+ * file cannot be read or holds a complete line that is not a progress event.
4158
+ *
4159
+ * @example
4160
+ * ```ts
4161
+ * readCaptureProgress('/repo', 'tmp/capture').runs[0]?.state // 'live' while the stage runs
4162
+ * ```
4163
+ */
4164
+ export declare function readCaptureProgress(root: string, requests: string, now?: number, alive?: (pid: number) => boolean | undefined): CaptureProgress;
4165
+
3493
4166
  /**
3494
4167
  * Reads one wrapper project's host declarations from its Vitest test configuration.
3495
4168
  *
@@ -3558,8 +4231,9 @@ export declare function readCaptureReaderArguments(argv: readonly string[], root
3558
4231
  *
3559
4232
  * @remarks
3560
4233
  * The command takes no selector: it refreshes every producing variant the wrapper declares, or the
3561
- * variants named by repeated `--variant` flags. Every flag takes one value, and only `--variant`
3562
- * repeats. `--mode` is forwarded to the wrapper's Vitest process unread.
4234
+ * variants named by repeated `--variant` flags. Every flag but valueless `--no-bail` takes one
4235
+ * value, and only `--variant` repeats. `--mode` is forwarded to the wrapper's Vitest process
4236
+ * unread, and `--no-bail` sets `bail` to `false`.
3563
4237
  *
3564
4238
  * @param argv - The arguments after the subcommand
3565
4239
  * @param root - The absolute workspace path the wrapper path resolves against
@@ -3610,42 +4284,42 @@ export declare function readCaptureRequest(options: CaptureRequestOptions): Capt
3610
4284
  * Reads the process id that a request file, or its temporary sibling, names.
3611
4285
  *
3612
4286
  * @param name - A file name from the request directory
3613
- * @returns The positive process id the name carries, or `undefined` for any other name
4287
+ * @returns The process id the name carries, from 1 to `CAPTURE_PID_LIMIT`, or `undefined` for any
4288
+ * other name
3614
4289
  *
3615
4290
  * @example
3616
4291
  * ```ts
3617
4292
  * readCaptureRequestOwner('journey-selection-4242.json') // 4242
3618
4293
  * readCaptureRequestOwner('journey-selection-4242.json.tmp') // 4242
3619
4294
  * readCaptureRequestOwner('journey-selection.json') // undefined
4295
+ * readCaptureRequestOwner('journey-selection-4294967296.json') // undefined
3620
4296
  * ```
3621
4297
  */
3622
4298
  export declare function readCaptureRequestOwner(name: string): number | undefined;
3623
4299
 
3624
4300
  /**
3625
- * Checks whether a process with this id is running, counting one the caller may not signal.
3626
- *
3627
- * @remarks
3628
- * A zero signal tests existence without sending one. A refusal for permission still proves the
3629
- * process exists, so only a missing process reads as not running.
3630
- *
3631
- * @param pid - The process id
3632
- * @returns True if the process exists; false otherwise
3633
- *
4301
+ * Reads the installed workspace Vitest's exact title separator, refusing unsupported majors.
3634
4302
  * @example
3635
4303
  * ```ts
3636
- * readCaptureRunning(process.pid) // true
4304
+ * readCaptureSeparator('/workspace/node_modules/vitest/vitest.mjs') // ' > ' on Vitest 5
3637
4305
  * ```
3638
4306
  */
3639
- export declare function readCaptureRunning(pid: number): boolean;
4307
+ export declare function readCaptureSeparator(entry: string): string;
3640
4308
 
3641
4309
  /**
3642
- * Reads the installed workspace Vitest's exact title separator, refusing unsupported majors.
4310
+ * Reads a document's population table after verifying that each map hashes to the key it is stored under.
4311
+ *
4312
+ * @param table - The stored table from each digest to its path-to-hash map
4313
+ * @param subject - The document and its path, which open the refusal message
4314
+ * @returns Each verified map by its digest
4315
+ * @throws Thrown when a stored map does not hash to its key.
4316
+ *
3643
4317
  * @example
3644
4318
  * ```ts
3645
- * readCaptureSeparator('/workspace/node_modules/vitest/vitest.mjs') // ' ' on Vitest 4
4319
+ * readCaptureTable({}, 'Manifest at tmp/captures/states/manifest.json').size // 0
3646
4320
  * ```
3647
4321
  */
3648
- export declare function readCaptureSeparator(entry: string): string;
4322
+ export declare function readCaptureTable(table: Readonly<Record<string, Readonly<Record<string, string>>>>, subject: string): ReadonlyMap<string, Readonly<Record<string, string>>>;
3649
4323
 
3650
4324
  /**
3651
4325
  * Reads original title segments from the accepted registry's authenticated JSON reporter files.
@@ -3653,6 +4327,10 @@ export declare function readCaptureSeparator(entry: string): string;
3653
4327
  * @param file - The accepted registry path
3654
4328
  * @param selector - The optional owner selector that bounds the case candidates
3655
4329
  * @returns Exact case names mapped to their original title segments within the selected owners
4330
+ * @throws Thrown with the removal of the registry and the manifest and lookup journal beside it,
4331
+ * and the refresh commands, when the registry declares another protocol version; thrown as a
4332
+ * `REGISTRY` capture error when the registry or a reporter it names is absent, unreadable, or fails
4333
+ * authentication.
3656
4334
  * @example
3657
4335
  * ```ts
3658
4336
  * const titles = readCaptureTitles('/workspace', '/workspace/tmp/captures/states/registry.json')
@@ -3690,8 +4368,13 @@ export declare function readCaptureViewport(test: unknown): CaptureViewport;
3690
4368
  /**
3691
4369
  * Renders an exact owner command with the selected variants and filters in host shell syntax.
3692
4370
  *
4371
+ * @remarks
4372
+ * A flag is rendered only when the rendered command's `CAPTURE_COMMAND_OPTIONS` entry declares it,
4373
+ * so a journey drops `--state`, a registry refresh drops `--case`, and only `stale` keeps
4374
+ * `--portfolio`. `--changed` and `--plan` are never rendered.
4375
+ *
3693
4376
  * @param command - The request command, translated to its executable name, or the registry command
3694
- * @param parsed - The parsed flags; changed and plan flags are deliberately replaced by the owner
4377
+ * @param parsed - The parsed flags, a `false` bail rendered as `--no-bail`; changed and plan flags are deliberately replaced by the owner
3695
4378
  * @param selector - The explicit owner or all selector; omitted for a registry refresh
3696
4379
  * @param root - The workspace that makes the wrapper path relative
3697
4380
  * @returns The command ready to copy into the host shell
@@ -3703,6 +4386,21 @@ export declare function readCaptureViewport(test: unknown): CaptureViewport;
3703
4386
  */
3704
4387
  export declare function renderCaptureCommand(command: CaptureCommand | 'registry', parsed: CaptureRunnerArguments, selector: string | undefined, root: string): string;
3705
4388
 
4389
+ /**
4390
+ * Renders a progress reading as the text `capture progress` prints.
4391
+ *
4392
+ * @param progress - The reading `readCaptureProgress` returns
4393
+ * @returns The file line, then each run as `renderProgress` from `@orkestrel/test/server` renders it,
4394
+ * followed by an unknown-state line for each run whose writer the host could not inspect
4395
+ *
4396
+ * @example
4397
+ * ```ts
4398
+ * renderCaptureProgress({ file: 'tmp/capture/runs/a/selected.progress.jsonl', runs: [], uninspected: [] })
4399
+ * // 'progress tmp/capture/runs/a/selected.progress.jsonl\nNo run has written a complete progress line yet'
4400
+ * ```
4401
+ */
4402
+ export declare function renderCaptureProgress(progress: CaptureProgress): string;
4403
+
3706
4404
  /** Validates a supplied path argument before work and classifies an outside value as usage.
3707
4405
  * @param root - The repository root
3708
4406
  * @param path - The supplied path resolved against the root
@@ -3736,6 +4434,21 @@ export declare function requireCaptureContained(root: string, path: string): str
3736
4434
  */
3737
4435
  export declare function requireCaptureImageSize(size: number): void;
3738
4436
 
4437
+ /**
4438
+ * Returns the one variant that produces a destination, refusing a destination with none or several.
4439
+ *
4440
+ * @param destination - The destination whose producer is read
4441
+ * @param producers - The map `collectCaptureProducers` returns
4442
+ * @returns The destination's unique producing variant
4443
+ * @throws Thrown as an `EVIDENCE` capture error when no variant or more than one produces the destination.
4444
+ *
4445
+ * @example
4446
+ * ```ts
4447
+ * requireCaptureProducer(destination, collectCaptureProducers({ registry, runs: [] })) // 'light-390'
4448
+ * ```
4449
+ */
4450
+ export declare function requireCaptureProducer(destination: CaptureDestination, producers: ReadonlyMap<string, readonly string[]>): string;
4451
+
3739
4452
  /**
3740
4453
  * Refuses a wrapper project set whose members repeat or disagree on a host declaration.
3741
4454
  *
@@ -3766,6 +4479,45 @@ export declare function requireCaptureProjects(projects: readonly CaptureProject
3766
4479
  */
3767
4480
  export declare function requireCaptureSelection(selector: string, variants: readonly string[], projects: readonly CaptureProject[], outputs?: readonly string[], portfolio?: string): void;
3768
4481
 
4482
+ /**
4483
+ * Returns the verified map a table key names, refusing a key the table does not hold.
4484
+ *
4485
+ * @param table - The verified table `readCaptureTable` returns
4486
+ * @param key - The digest a stored member names
4487
+ * @param subject - The document and its path, which open the refusal message
4488
+ * @param field - The referencing field the refusal message names
4489
+ * @returns The file map stored under the key
4490
+ * @throws Thrown when the table holds no map under the key.
4491
+ *
4492
+ * @example
4493
+ * ```ts
4494
+ * requireCaptureTableEntry(new Map([[key, files]]), key, 'Manifest at manifest.json', 'inputs') === files // true
4495
+ * ```
4496
+ */
4497
+ export declare function requireCaptureTableEntry(table: ReadonlyMap<string, Readonly<Record<string, string>>>, key: string, subject: string, field: string): Readonly<Record<string, string>>;
4498
+
4499
+ /**
4500
+ * Refuses a document that declares a numeric version other than `CAPTURE_VERSION`, naming what to remove and the refresh commands.
4501
+ *
4502
+ * @remarks
4503
+ * A document with no numeric version passes, so the schema check that follows names that fault.
4504
+ * No document of another version is converted.
4505
+ *
4506
+ * @param value - The decoded document
4507
+ * @param subject - The document kind that opens the refusal, such as `Registry`
4508
+ * @param file - The document path the refusal names
4509
+ * @param removal - The paths, or the phrases naming them, to remove before the refresh
4510
+ * @throws Thrown as an `EVIDENCE` capture error whose context carries `file` and `version` when the
4511
+ * document declares another numeric version.
4512
+ *
4513
+ * @example
4514
+ * ```ts
4515
+ * requireCaptureVersion({ version: 1 }, 'Registry', 'registry.json', ['registry.json'])
4516
+ * // throws: Registry version 1 at registry.json is not version 2, … Remove registry.json, then refresh explicitly with: capture registry, then capture frames all
4517
+ * ```
4518
+ */
4519
+ export declare function requireCaptureVersion(value: unknown, subject: string, file: string, removal: readonly string[]): void;
4520
+
3769
4521
  /**
3770
4522
  * Maps usage refusals to exit 64 and every other failure to exit 1.
3771
4523
  *
@@ -3786,6 +4538,26 @@ export declare function resolveCaptureExit(error: unknown): number;
3786
4538
  */
3787
4539
  export declare function resolveCapturePhysical(path: string): string;
3788
4540
 
4541
+ /**
4542
+ * Classifies a failure raised while reading the accepted registry as the registry condition.
4543
+ *
4544
+ * @remarks
4545
+ * The complete-registry refresh clears every such failure but a document of another version, whose
4546
+ * refusal names its own removal and refresh.
4547
+ *
4548
+ * @param error - The value a registry read threw
4549
+ * @returns A `REGISTRY` capture error with the same message and the original as its cause, for a
4550
+ * value that is not a capture error or is an `EVIDENCE` capture error other than a version refusal;
4551
+ * otherwise the value itself
4552
+ *
4553
+ * @example
4554
+ * ```ts
4555
+ * resolveCaptureRegistryFault(new CaptureError('Invalid accepted registry schema or digest', { code: 'EVIDENCE' })) // a REGISTRY capture error
4556
+ * resolveCaptureRegistryFault(new CaptureError('Unknown portfolio: x', { code: 'SELECTION' })) // the same error
4557
+ * ```
4558
+ */
4559
+ export declare function resolveCaptureRegistryFault(error: unknown): unknown;
4560
+
3789
4561
  /**
3790
4562
  * Resolves a path to the slash-separated form the evidence documents store, relative to a root.
3791
4563
  *
@@ -3849,6 +4621,26 @@ export declare function resolveCaptureSheetIdentity(entry: CaptureDestination):
3849
4621
  */
3850
4622
  export declare function resolveCaptureStages(variants: readonly string[], first: string, command: CaptureRequest['command']): readonly CaptureStagePlan[];
3851
4623
 
4624
+ /**
4625
+ * Picks the standalone portfolio root a selection names by its selector or its portfolio.
4626
+ *
4627
+ * @remarks
4628
+ * A standalone root has no stamping route and no registry refresh, so a selection reads it only
4629
+ * when it names the root's portfolio. Every other selection reads the primary directory.
4630
+ *
4631
+ * @param roots - The wrapper's standalone roots
4632
+ * @param selector - The selected owner selector
4633
+ * @param portfolio - The selected portfolio, when the selection names one
4634
+ * @returns The named standalone root, or `undefined` for a primary selection
4635
+ * @example
4636
+ * ```ts
4637
+ * const vue = { portfolio: 'vue', directory: 'tmp/captures/vue', scoped: false }
4638
+ * resolveCaptureStandalone([vue], 'vue:home') // vue
4639
+ * resolveCaptureStandalone([vue], 'pages:mail') // undefined
4640
+ * ```
4641
+ */
4642
+ export declare function resolveCaptureStandalone(roots: readonly CapturePortfolioRoot[], selector: string, portfolio?: string): CapturePortfolioRoot | undefined;
4643
+
3852
4644
  /**
3853
4645
  * Resolves selected producing variants in declaration order and requires their projects.
3854
4646
  *
@@ -3882,6 +4674,27 @@ export declare function resolveCaptureVariants(selected: readonly string[], proj
3882
4674
  */
3883
4675
  export declare function resolveCaptureWrapperProject(input: unknown, mode?: string): Promise<unknown>;
3884
4676
 
4677
+ /**
4678
+ * Walks a PNG's checked chunks from one header and returns each header's offset, up to the closing chunk.
4679
+ *
4680
+ * @remarks
4681
+ * The walk reads at most `count` chunks, and never more than the bytes can hold, so an infinite or
4682
+ * very large count ends at the closing chunk or at a refusal. Each level halves the count, so the
4683
+ * call depth grows with the logarithm of the chunks the bytes can hold.
4684
+ *
4685
+ * @param bytes - The complete PNG
4686
+ * @param position - The offset of the first chunk header to read
4687
+ * @param count - The most chunks to read
4688
+ * @returns The offset of each chunk header read, in order
4689
+ * @throws Thrown for a truncated chunk, a bad checksum, or a closing chunk that is not empty and last.
4690
+ *
4691
+ * @example
4692
+ * ```ts
4693
+ * scanCaptureChunks(encodeCapturePicture({ width: 1, height: 1, pixels: Uint8Array.from([1, 2, 3]) }), 8, Infinity) // [8, 33, 57]
4694
+ * ```
4695
+ */
4696
+ export declare function scanCaptureChunks(bytes: Buffer, position: number, count: number): readonly number[];
4697
+
3885
4698
  /**
3886
4699
  * Reports a portfolio, owner, and viewport whose frames mix cropped, viewport-sized, and page-sized images.
3887
4700
  *
@@ -3917,8 +4730,10 @@ export declare function settleCaptureShutdown(retract: CaptureRetractionHandler,
3917
4730
  * Scales a picture with an exact area average and clips its displayed height.
3918
4731
  *
3919
4732
  * @param picture - The source RGB picture
3920
- * @param factor - The integer reduction factor
3921
- * @param limit - The maximum displayed height
4733
+ * @param factor - The reduction factor, a whole number of at least 1; any other value gives an
4734
+ * unspecified result that might throw
4735
+ * @param limit - The maximum displayed height, a whole number of at least 1; any other value gives
4736
+ * an unspecified result that might throw
3922
4737
  * @returns A separately owned scaled picture
3923
4738
  *
3924
4739
  * @example
@@ -3938,6 +4753,82 @@ export declare function shrinkCapturePicture(picture: CapturePicture, factor: nu
3938
4753
  */
3939
4754
  export declare function splitCapturePages<T>(entries: readonly T[], size: number): ReadonlyArray<readonly T[]>;
3940
4755
 
4756
+ /**
4757
+ * Splits contact-sheet rows into consecutive pages of at most `size` rows whose stacked composite
4758
+ * fits `CAPTURE_PNG_LIMITS`.
4759
+ *
4760
+ * @remarks
4761
+ * A page takes each next row while it holds fewer than `size` rows and the stacked composite,
4762
+ * with `gap` between rows, still fits; otherwise the row opens the next page.
4763
+ *
4764
+ * @param rows - The ordered rows, each with its composite width and height
4765
+ * @param size - The most rows a page holds, a whole number of at least 1; any other value gives an
4766
+ * unspecified result that might throw
4767
+ * @param gap - The space between stacked rows
4768
+ * @returns The pages, in order
4769
+ * @throws Thrown with the `USAGE` condition when one row alone does not fit `CAPTURE_PNG_LIMITS`,
4770
+ * naming its composite, the limits, and the narrower `--variant` selection that recovers.
4771
+ *
4772
+ * @example
4773
+ * ```ts
4774
+ * splitCaptureSheets([{ width: 13040, height: 400 }, { width: 13040, height: 400 }], 4, 12).length // 1
4775
+ * ```
4776
+ */
4777
+ export declare function splitCaptureSheets<T extends Pick<CapturePicture, 'width' | 'height'>>(rows: readonly T[], size: number, gap: number): ReadonlyArray<readonly T[]>;
4778
+
4779
+ /**
4780
+ * Sums one channel of a picture over a block of source rows.
4781
+ *
4782
+ * @remarks
4783
+ * Source row `top + row` starts its block at `(top + row) * picture.width * 3 + left`, and each row
4784
+ * contributes `columns` samples through `sumCaptureRow`. The caller bounds the block: the call reads
4785
+ * `rows × columns` samples, inside the bytes or not, so a row count that is not above 0 sums nothing
4786
+ * and a fractional row count reads its ceiling. For whole-number arguments, the sum equals the
4787
+ * direct sum of those samples where every number the call computes from its arguments is a safe
4788
+ * integer, each row number, each intermediate sum and product of a row start, and each sample index
4789
+ * among them.
4790
+ *
4791
+ * @param picture - The source RGB picture
4792
+ * @param top - The block's first source row
4793
+ * @param left - The byte offset of the block's first sample inside a row, its channel included
4794
+ * @param row - The first row to sum, counted from `top`
4795
+ * @param rows - The number of rows to sum
4796
+ * @param columns - The number of samples to sum in each row
4797
+ * @returns The block's sum
4798
+ * @throws Thrown as an `EVIDENCE` capture error when `rows` is `Infinity`, or when `columns` is
4799
+ * `Infinity` and the block reads a row.
4800
+ *
4801
+ * @example
4802
+ * ```ts
4803
+ * sumCaptureBlock({ width: 2, height: 2, pixels: Uint8Array.from([1, 0, 0, 2, 0, 0, 3, 0, 0, 4, 0, 0]) }, 0, 0, 0, 2, 2) // 10
4804
+ * ```
4805
+ */
4806
+ export declare function sumCaptureBlock(picture: CapturePicture, top: number, left: number, row: number, rows: number, columns: number): number;
4807
+
4808
+ /**
4809
+ * Sums a run of samples three bytes apart, one channel of consecutive RGB pixels.
4810
+ *
4811
+ * @remarks
4812
+ * The caller bounds the run: the call reads one sample per column, inside the bytes or not, so a
4813
+ * count that is not above 0 sums nothing and a fractional count reads its ceiling. Each sample reads
4814
+ * `pixels[index] ?? 0` at the index the call computes, so an index outside the bytes, a fractional
4815
+ * index, or a `NaN` index reads 0. For whole-number arguments, the sum equals the direct sum of
4816
+ * those samples where every number the call computes from its arguments is a safe integer, each
4817
+ * sample index among them.
4818
+ *
4819
+ * @param pixels - The source RGB bytes
4820
+ * @param start - The index of the first sample
4821
+ * @param columns - The number of samples to sum
4822
+ * @returns The sum, reading an index outside the bytes or a fractional index as 0
4823
+ * @throws Thrown as an `EVIDENCE` capture error when `columns` is `Infinity`.
4824
+ *
4825
+ * @example
4826
+ * ```ts
4827
+ * sumCaptureRow(Uint8Array.from([1, 0, 0, 2, 0, 0, 3]), 0, 3) // 6
4828
+ * ```
4829
+ */
4830
+ export declare function sumCaptureRow(pixels: Uint8Array, start: number, columns: number): number;
4831
+
3941
4832
  /**
3942
4833
  * Reconstructs one filtered PNG scanline from its filter byte and the row above.
3943
4834
  *