@orkestrel/capture 0.0.8 → 0.0.9

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.
@@ -6,11 +6,14 @@ import { CaptureError } from '@orkestrel/capture';
6
6
  import type { CaptureFreshness } from '@orkestrel/capture';
7
7
  import type { CaptureLookup } from '@orkestrel/capture';
8
8
  import type { CaptureLookupJournal } from '@orkestrel/capture';
9
+ import type { CapturePortfolioRoot } from '@orkestrel/capture';
10
+ import type { CaptureProvided } from '@orkestrel/capture';
9
11
  import type { CaptureReceipt } from '@orkestrel/capture';
10
12
  import type { CaptureRegistry } from '@orkestrel/capture';
11
13
  import type { CaptureRequest } from '@orkestrel/capture';
12
14
  import type { CaptureRun } from '@orkestrel/capture';
13
15
  import type { CaptureSelection } from '@orkestrel/capture';
16
+ import type { CaptureSources } from '@orkestrel/capture';
14
17
  import type { CaptureStamp } from '@orkestrel/capture';
15
18
  import type { CaptureStoredManifest } from '@orkestrel/capture';
16
19
  import type { CaptureViewport } from '@orkestrel/capture';
@@ -18,6 +21,8 @@ import type { CaptureWarning } from '@orkestrel/capture';
18
21
  import type { DuplexInterface } from '@orkestrel/process';
19
22
  import type { parseArgs } from 'node:util';
20
23
  import type { ParseArgsOptionsConfig } from 'node:util';
24
+ import type { ProgressPluginInterface } from '@orkestrel/test/server';
25
+ import type { ProgressRun } from '@orkestrel/test/server';
21
26
 
22
27
  /**
23
28
  * Answers the runner's discovery request from the wrapper, before the wrapper does any other work.
@@ -58,7 +63,7 @@ export declare function answerCaptureDiscovery(options: CaptureDiscoveryOptions)
58
63
  * spaces and quotes. An exact case adds `-t` with the anchored pattern for that case and the
59
64
  * final case, so the final case still writes the run record.
60
65
  *
61
- * @param options - The entry, wrapper, report, projects, tag filter, and optional exact case and mode
66
+ * @param options - The entry, wrapper, report and progress files, projects, tag filter, bail switch, and optional exact case and mode
62
67
  * @returns The arguments after the Node executable
63
68
  *
64
69
  * @example
@@ -67,6 +72,7 @@ export declare function answerCaptureDiscovery(options: CaptureDiscoveryOptions)
67
72
  * entry: '/repo/node_modules/vitest/vitest.mjs',
68
73
  * config: '/repo/vite.journey.config.ts',
69
74
  * report: '/repo/tmp/units/runs/a/journey-selected.json',
75
+ * progress: '/repo/tmp/units/runs/a/selected.progress.jsonl',
70
76
  * projects: ['journey:light-390'],
71
77
  * filter: 'owner:pages:mail',
72
78
  * final: 'closes the run',
@@ -118,13 +124,7 @@ export declare function buildCaptureDigest(patterns: readonly string[], files: R
118
124
  * export default (await answerCaptureDiscovery(options)) ? buildCaptureDiscoveryConfig() : config
119
125
  * ```
120
126
  */
121
- export declare function buildCaptureDiscoveryConfig(): {
122
- readonly test: {
123
- readonly include: string[];
124
- readonly passWithNoTests: boolean;
125
- readonly watch: boolean;
126
- };
127
- };
127
+ export declare function buildCaptureDiscoveryConfig(): CaptureDiscoveryConfig;
128
128
 
129
129
  /**
130
130
  * Builds the tag expression that selects an owner population, and its capture tags for frames.
@@ -183,6 +183,22 @@ export declare function buildCaptureIntegrityOptions(root: string, project: Capt
183
183
  */
184
184
  export declare function buildCaptureLookupJournal(lookups: readonly CaptureLookup[], collections: readonly CaptureCollectionReceipt[], manifest?: string): CaptureLookupJournal;
185
185
 
186
+ /**
187
+ * Builds the values capture merges into one variant's Vitest project.
188
+ *
189
+ * @param options - The wrapper's declarations
190
+ * @param variant - The variant the project produces
191
+ * @param provided - The variant's frame directory, run record path, capture switch, and runner request
192
+ * @returns The owner tags, the provided values, and the `readCaptureFrames` browser command over the directory
193
+ *
194
+ * @example
195
+ * ```ts
196
+ * buildCaptureOverride(options, variant, { directory, record, capture: true }).test.provide.record
197
+ * // 'tmp/captures/states/runs/run-1/selected/light-390.json'
198
+ * ```
199
+ */
200
+ export declare function buildCaptureOverride(options: Omit<CaptureWrapperOptions<unknown>, 'url' | 'project'>, variant: CaptureViewport, provided: Pick<CaptureProvided, 'directory' | 'record' | 'capture' | 'request'>): CaptureWrapperOverride;
201
+
186
202
  /**
187
203
  * Imports complete receipts only after their actual exits and exact report bytes validate.
188
204
  *
@@ -214,6 +230,38 @@ export declare function buildCaptureRegistry(inputs: readonly CaptureReceiptInpu
214
230
  */
215
231
  export declare function buildCaptureRequestRefusal(file: string, cause?: unknown): CaptureError;
216
232
 
233
+ /**
234
+ * Builds a journey wrapper's Vitest configuration as plain data, answering discovery first.
235
+ *
236
+ * @remarks
237
+ * Call it inside the wrapper's own `defineConfig` callback, before any other work: capture imports
238
+ * neither Vite nor Vitest, so the result is data the wrapper returns. The wrapper path is `url`
239
+ * relative to the working directory, which is the workspace root for every child the runner
240
+ * spawns. During a discovery request it describes each variant's project as `{ name, tags,
241
+ * provide }`, with the name the host's `project` chose, and returns `buildCaptureDiscoveryConfig()`.
242
+ * Otherwise it reads the runner's request, provides each project the values `CaptureProvided`
243
+ * declares except `standalone`, and registers the browser command `readCaptureFrames`, which lists the frames under
244
+ * the provided directory. With the capture variable unset, each variant writes to its own scratch
245
+ * sibling of the evidence root, emptied first. The result's root `plugins` holds one
246
+ * `createProgressPlugin()`, so a stage the runner passes `--outputFile.progress` writes its
247
+ * progress file.
248
+ *
249
+ * @param options - The wrapper path, variants, owners, stage and final names, evidence root, inputs, sources, portfolios, and project builder
250
+ * @returns The discovery configuration while discovery runs, and otherwise the progress plugin and one project per variant
251
+ * @throws Thrown as a `HOST` capture error, before any directory work, for a `url` that is no
252
+ * `file:` URL, an evidence root that is not a portable relative path, or a variant name that is no
253
+ * capture segment, and later for an invalid owner or a runner request that fails its checks; and as
254
+ * a `CONTAINMENT` capture error for a wrapper or scratch path outside the workspace.
255
+ *
256
+ * @example
257
+ * ```ts
258
+ * export default defineConfig(({ mode }) =>
259
+ * buildCaptureWrapper({ ...declarations, url: import.meta.url, project: (variant, override) => appJourney(variant, mode, override) }),
260
+ * )
261
+ * ```
262
+ */
263
+ export declare function buildCaptureWrapper<TProject>(options: CaptureWrapperOptions<TProject>): Promise<CaptureWrapperConfig<TProject> | CaptureDiscoveryConfig>;
264
+
217
265
  /**
218
266
  * Names the executable subcommand each runner command answers to.
219
267
  *
@@ -235,6 +283,9 @@ export declare const CAPTURE_COMMAND_NAMES: Readonly<{
235
283
  /**
236
284
  * Defines each command's frozen options for Node's standard argument parser.
237
285
  *
286
+ * @remarks A boolean option whose default is `true` reads only its `--no-` form, which sets it to
287
+ * `false`; `bail` is the one such option.
288
+ *
238
289
  * @example
239
290
  * ```ts
240
291
  * CAPTURE_COMMAND_OPTIONS.journey.variant.multiple // true
@@ -258,6 +309,10 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
258
309
  plan: Readonly<{
259
310
  type: "boolean";
260
311
  }>;
312
+ bail: Readonly<{
313
+ type: "boolean";
314
+ default: true;
315
+ }>;
261
316
  mode: Readonly<{
262
317
  type: "string";
263
318
  }>;
@@ -282,6 +337,10 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
282
337
  plan: Readonly<{
283
338
  type: "boolean";
284
339
  }>;
340
+ bail: Readonly<{
341
+ type: "boolean";
342
+ default: true;
343
+ }>;
285
344
  mode: Readonly<{
286
345
  type: "string";
287
346
  }>;
@@ -372,10 +431,15 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
372
431
  config: Readonly<{
373
432
  type: "string";
374
433
  }>;
434
+ bail: Readonly<{
435
+ type: "boolean";
436
+ default: true;
437
+ }>;
375
438
  mode: Readonly<{
376
439
  type: "string";
377
440
  }>;
378
441
  }>;
442
+ readonly progress: Readonly<{}>;
379
443
  }>;
380
444
 
381
445
  /**
@@ -494,23 +558,22 @@ export declare const CAPTURE_OWNER_BACKOFF = 10;
494
558
  */
495
559
  export declare const CAPTURE_OWNER_FILE = ".capture-owner";
496
560
 
497
- /**
498
- * Names the tag prefix that marks a case's owner path and each ancestor of it.
499
- *
561
+ /** Bounds a synchronous ownership retry sequence in milliseconds, including host contention.
500
562
  * @example
501
563
  * ```ts
502
- * `${CAPTURE_OWNER_PREFIX}pages:mail` // 'owner:pages:mail'
564
+ * CAPTURE_OWNER_TIMEOUT // 1000
503
565
  * ```
504
566
  */
505
- export declare const CAPTURE_OWNER_PREFIX = "owner:";
567
+ export declare const CAPTURE_OWNER_TIMEOUT = 1000;
506
568
 
507
- /** Bounds a synchronous ownership retry sequence in milliseconds, including host contention.
569
+ /**
570
+ * Holds the largest process id a POSIX or Windows host can assign, the signed 32-bit maximum.
508
571
  * @example
509
572
  * ```ts
510
- * CAPTURE_OWNER_TIMEOUT // 1000
573
+ * CAPTURE_PID_LIMIT // 2147483647
511
574
  * ```
512
575
  */
513
- export declare const CAPTURE_OWNER_TIMEOUT = 1000;
576
+ export declare const CAPTURE_PID_LIMIT = 2147483647;
514
577
 
515
578
  /**
516
579
  * Bounds decoded image memory, row metadata, and PNG input bytes independently of untrusted headers.
@@ -532,6 +595,18 @@ export declare const CAPTURE_PNG_LIMITS: Readonly<{
532
595
  readonly bytes: number;
533
596
  }>;
534
597
 
598
+ /**
599
+ * Names the ending of the progress file each stage writes beneath its invocation's run directory.
600
+ *
601
+ * @remarks The stage's name precedes it, so `selected` writes `selected.progress.jsonl`.
602
+ *
603
+ * @example
604
+ * ```ts
605
+ * `tmp/capture/${CAPTURE_RUNS_DIRECTORY}/a/selected${CAPTURE_PROGRESS_SUFFIX}`
606
+ * ```
607
+ */
608
+ export declare const CAPTURE_PROGRESS_SUFFIX = ".progress.jsonl";
609
+
535
610
  /**
536
611
  * Caps each refusal population so hostile records cannot flood a terminal or agent context.
537
612
  * @example
@@ -703,15 +778,34 @@ export declare const CAPTURE_USAGE: string;
703
778
  */
704
779
  export declare const CAPTURE_VITEST_ENTRY = "node_modules/vitest/vitest.mjs";
705
780
 
781
+ /**
782
+ * Names the prefixes a journey wrapper derives its own paths from.
783
+ *
784
+ * @remarks `scratch` precedes the variant in the sibling of the evidence root a run without frame
785
+ * capture writes to, and `direct` precedes the random identity of a run no runner started.
786
+ *
787
+ * @example
788
+ * ```ts
789
+ * `tmp/captures/${CAPTURE_WRAPPER_PREFIXES.scratch}light-390` // 'tmp/captures/no-capture-light-390'
790
+ * ```
791
+ */
792
+ export declare const CAPTURE_WRAPPER_PREFIXES: Readonly<{
793
+ readonly scratch: 'no-capture-';
794
+ readonly direct: 'direct-';
795
+ }>;
796
+
706
797
  /**
707
798
  * Configures the Vitest argument list one stage spawns with.
708
799
  *
709
800
  * @remarks
710
801
  * `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.
802
+ * absolute JSON reporter path and `progress` the absolute progress file path, which the stage
803
+ * passes as `--outputFile.progress` for a progress reporter to write. `projects` are the Vitest
804
+ * project labels the stage runs. `filter` is the tag expression. An exact `case` adds the anchored
805
+ * name pattern for that case and the `final` case, so the final case still writes the run record.
806
+ * A `mode` adds Vitest's `--mode` flag to discovery and execution children. If `bail` is `true`,
807
+ * the stage passes `--bail=1` and stops at its first failed case; if `false`, it passes no bail
808
+ * flag and runs every selected case. Default: `true`.
715
809
  *
716
810
  * @example
717
811
  * ```ts
@@ -719,6 +813,7 @@ export declare const CAPTURE_VITEST_ENTRY = "node_modules/vitest/vitest.mjs";
719
813
  * entry: '/repo/node_modules/vitest/vitest.mjs',
720
814
  * config: '/repo/configs/vite.journey.config.ts',
721
815
  * report: '/repo/tmp/units/runs/a/journey-selected.json',
816
+ * progress: '/repo/tmp/units/runs/a/selected.progress.jsonl',
722
817
  * projects: ['journey:light-390'],
723
818
  * filter: 'owner:pages:mail',
724
819
  * final: 'closes the run',
@@ -729,8 +824,10 @@ export declare interface CaptureArgumentsOptions {
729
824
  readonly entry: string;
730
825
  readonly config: string;
731
826
  readonly report: string;
827
+ readonly progress: string;
828
+ readonly bail?: boolean;
732
829
  readonly projects: readonly string[];
733
- readonly filter: string;
830
+ readonly filter?: string;
734
831
  readonly case?: string;
735
832
  readonly final: string;
736
833
  readonly mode?: string;
@@ -869,9 +966,10 @@ export declare type CaptureChildTerminationHandler = (child: DuplexInterface) =>
869
966
  *
870
967
  * @remarks
871
968
  * 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.
969
+ * the runner, the registry refresh, the preflight, or the contact sheets, or prints the progress of
970
+ * the stage that ran last, and turns a refused usage into exit 64 and any other capture refusal
971
+ * into exit 1, writing the refusal to its error writer. An error that is not a capture refusal
972
+ * propagates.
875
973
  *
876
974
  * @example
877
975
  * ```ts
@@ -1033,6 +1131,24 @@ export declare class CaptureDiscovery implements CaptureDiscoveryInterface {
1033
1131
  describe(): Promise<CaptureHostDescription>;
1034
1132
  }
1035
1133
 
1134
+ /**
1135
+ * Describes the empty Node configuration a wrapper returns after it has answered a discovery request.
1136
+ *
1137
+ * @remarks `include` is a mutable list because Vitest's `test.include` option declares one.
1138
+ *
1139
+ * @example
1140
+ * ```ts
1141
+ * const config: CaptureDiscoveryConfig = { test: { include: [], passWithNoTests: true, watch: false } }
1142
+ * ```
1143
+ */
1144
+ export declare interface CaptureDiscoveryConfig {
1145
+ readonly test: {
1146
+ readonly include: string[];
1147
+ readonly passWithNoTests: boolean;
1148
+ readonly watch: boolean;
1149
+ };
1150
+ }
1151
+
1036
1152
  /**
1037
1153
  * Reads a consumer's wrapper by running its installed Vitest in discovery mode.
1038
1154
  *
@@ -1228,6 +1344,22 @@ export declare interface CaptureFileSnapshot {
1228
1344
  */
1229
1345
  export declare type CaptureHashHandler = (bytes: Uint8Array) => string;
1230
1346
 
1347
+ /**
1348
+ * Describes another process that holds a request file in the request directory.
1349
+ *
1350
+ * @remarks `inspected` is `true` when the host read the process as running, and `false` when the
1351
+ * host could not read its state.
1352
+ *
1353
+ * @example
1354
+ * ```ts
1355
+ * const holder: CaptureHolder = { pid: 4242, inspected: true }
1356
+ * ```
1357
+ */
1358
+ export declare interface CaptureHolder {
1359
+ readonly pid: number;
1360
+ readonly inspected: boolean;
1361
+ }
1362
+
1231
1363
  /**
1232
1364
  * Carries the description a wrapper writes back to the runner that discovered it.
1233
1365
  *
@@ -1571,7 +1703,7 @@ export declare class CaptureInvocation implements CaptureInvocationInterface {
1571
1703
  attach(): void;
1572
1704
  release(): Promise<void>;
1573
1705
  prepare(): void;
1574
- holders(): readonly number[];
1706
+ holders(): readonly CaptureHolder[];
1575
1707
  publish(request: CaptureRequest | CaptureDiscoveryRequest): void;
1576
1708
  retract(): void;
1577
1709
  launched(log: string): boolean;
@@ -1631,14 +1763,16 @@ export declare interface CaptureInvocationInterface {
1631
1763
  /**
1632
1764
  * Lists the other live processes that hold a request file in the request directory.
1633
1765
  *
1634
- * @returns The distinct holder process ids in directory order, excluding this invocation's own lease
1766
+ * @returns One holder per distinct process id in directory order, excluding this invocation's own
1767
+ * lease and every process the host reads as ended; a process whose state cannot be read stays
1768
+ * listed with `inspected` set to `false`
1635
1769
  *
1636
1770
  * @example
1637
1771
  * ```ts
1638
1772
  * invocation.holders() // [] when no other runner is mid-stage
1639
1773
  * ```
1640
1774
  */
1641
- holders(): readonly number[];
1775
+ holders(): readonly CaptureHolder[];
1642
1776
  /**
1643
1777
  * Writes the stage or discovery request atomically, so no reader sees a partial file.
1644
1778
  *
@@ -1834,7 +1968,7 @@ export declare interface CaptureOwnership {
1834
1968
  /** Supplies the filesystem and liveness boundary for ownership arbitration.
1835
1969
  * @example
1836
1970
  * ```ts
1837
- * const host: Partial<CaptureOwnershipHost> = { alive: (pid) => readCaptureRunning(pid) }
1971
+ * const host: Partial<CaptureOwnershipHost> = { alive: (pid) => inspectProcess(pid) }
1838
1972
  * ```
1839
1973
  */
1840
1974
  export declare interface CaptureOwnershipHost {
@@ -1844,7 +1978,8 @@ export declare interface CaptureOwnershipHost {
1844
1978
  readonly write: (file: string, text: string) => void;
1845
1979
  readonly link: (source: string, target: string) => void;
1846
1980
  readonly remove: (file: string) => void;
1847
- readonly alive: (pid: number) => boolean;
1981
+ /** Reports whether a process exists; `undefined` when the host cannot tell keeps every claim it holds. */
1982
+ readonly alive: (pid: number) => boolean | undefined;
1848
1983
  }
1849
1984
 
1850
1985
  /**
@@ -1861,11 +1996,13 @@ export declare type CaptureParsedArguments<Options extends ParseArgsOptionsConfi
1861
1996
  readonly tokens: true;
1862
1997
  readonly strict: true;
1863
1998
  readonly allowPositionals: true;
1999
+ readonly allowNegative: true;
1864
2000
  }>>]: Readonly<ReturnType<typeof parseArgs<{
1865
2001
  readonly options: Options;
1866
2002
  readonly tokens: true;
1867
2003
  readonly strict: true;
1868
2004
  readonly allowPositionals: true;
2005
+ readonly allowNegative: true;
1869
2006
  }>>[Key]>;
1870
2007
  };
1871
2008
 
@@ -1895,20 +2032,6 @@ export declare interface CapturePngLimits {
1895
2032
  readonly bytes: number;
1896
2033
  }
1897
2034
 
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
2035
  /**
1913
2036
  * Reads the selected population's frames and reports their freshness, mixed observations, and coverage.
1914
2037
  *
@@ -2067,6 +2190,30 @@ export declare interface CaptureProducer extends CaptureViewport {
2067
2190
  readonly project: string;
2068
2191
  }
2069
2192
 
2193
+ /**
2194
+ * Carries the progress file of the stage that ran last in a workspace, and every run it holds.
2195
+ *
2196
+ * @remarks `file` is workspace-relative and slash-separated. `runs` holds one reading per writing
2197
+ * process, and is empty while the stage has not written a complete line. A run with no `end` line
2198
+ * whose writer has ended reads as `interrupted`, with no running case and no estimate.
2199
+ * `uninspected` lists the process id of each run with no `end` line whose writer the host could not
2200
+ * inspect: that run keeps the `live` state its file records, and whether it still runs is unknown.
2201
+ *
2202
+ * @example
2203
+ * ```ts
2204
+ * const progress: CaptureProgress = {
2205
+ * file: 'tmp/capture/runs/a/selected.progress.jsonl',
2206
+ * runs: [],
2207
+ * uninspected: [],
2208
+ * }
2209
+ * ```
2210
+ */
2211
+ export declare interface CaptureProgress {
2212
+ readonly file: string;
2213
+ readonly runs: readonly ProgressRun[];
2214
+ readonly uninspected: readonly number[];
2215
+ }
2216
+
2070
2217
  /**
2071
2218
  * Preserves the wrapper's host declarations, including optional uniform scopes, for consumers.
2072
2219
  *
@@ -2117,6 +2264,22 @@ export declare interface CaptureProject {
2117
2264
  readonly standalone: readonly CapturePortfolioRoot[];
2118
2265
  }
2119
2266
 
2267
+ /**
2268
+ * Builds one variant's Vitest project from the host's own defaults and capture's override.
2269
+ *
2270
+ * @remarks The host names the project and merges `override` into it last, so capture's tags,
2271
+ * provided values, and browser command reach the project. The runner reads the project name the
2272
+ * host chose.
2273
+ *
2274
+ * @example
2275
+ * ```ts
2276
+ * const project: CaptureProjectHandler<UserWorkspaceConfig> = (variant, override) => ({
2277
+ * test: { ...override.test, name: `journey:${variant.name}` },
2278
+ * })
2279
+ * ```
2280
+ */
2281
+ export declare type CaptureProjectHandler<TProject> = (variant: CaptureViewport, override: CaptureWrapperOverride) => TProject;
2282
+
2120
2283
  /**
2121
2284
  * Reports validated project evidence, retaining empty successful selections explicitly.
2122
2285
  *
@@ -2299,7 +2462,8 @@ export declare interface CaptureReceiptInput {
2299
2462
  * requires, so it cannot stamp through the integrity engine. It reads the wrapper through the same
2300
2463
  * discovery the runner uses, takes the same invocation entity, request file, and Vitest child, and runs
2301
2464
  * 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
2465
+ * the `all` selector and no capture variable. The stage passes no tag filter, so it runs the whole
2466
+ * suite, which stands in for the consumer's complete test run. It reads the stage's reporter once and each variant's
2303
2467
  * final record, takes each project's input population before and after, and builds one receipt per
2304
2468
  * variant, all naming the one reporter, through `buildCaptureRegistry`. The registry is written to a
2305
2469
  * candidate beside its target, read back through the integrity engine, and only then renamed into
@@ -2389,6 +2553,7 @@ export declare interface CaptureRegistrarOptions {
2389
2553
  * Carries the parsed registry command line: the wrapper, the variants to refresh, and the mode.
2390
2554
  *
2391
2555
  * @remarks `config` is absolute. An empty `variants` list refreshes every declared producing variant.
2556
+ * `bail` is `false` when the command line carries `--no-bail`, and absent otherwise.
2392
2557
  *
2393
2558
  * @example
2394
2559
  * ```ts
@@ -2399,6 +2564,7 @@ export declare interface CaptureRegistryArguments {
2399
2564
  readonly config: string;
2400
2565
  readonly variants: readonly string[];
2401
2566
  readonly mode?: string;
2567
+ readonly bail?: boolean;
2402
2568
  }
2403
2569
 
2404
2570
  /**
@@ -2497,6 +2663,9 @@ export declare class CaptureRunner implements CaptureRunnerInterface {
2497
2663
  * Carries parsed runner arguments, including an optional wrapper mode, while leaving omitted
2498
2664
  * selectors available to the usage diagnostic.
2499
2665
  *
2666
+ * @remarks `bail` is `false` when the command line carries `--no-bail`, and absent otherwise, which
2667
+ * keeps the stage's default first-failure stop.
2668
+ *
2500
2669
  * @example
2501
2670
  * ```ts
2502
2671
  * const parsed: CaptureRunnerArguments = { config: '/repo/configs/vite.journey.config.ts', variants: [] }
@@ -2506,6 +2675,7 @@ export declare interface CaptureRunnerArguments {
2506
2675
  readonly selector?: string;
2507
2676
  readonly changed?: string;
2508
2677
  readonly plan?: boolean;
2678
+ readonly bail?: boolean;
2509
2679
  readonly config: string;
2510
2680
  readonly mode?: string;
2511
2681
  readonly variants: readonly string[];
@@ -2582,7 +2752,8 @@ export declare interface CaptureRunnerOptions {
2582
2752
  * wrapper path, and `final` the full name of the case that closes a variant's run. `filter` is
2583
2753
  * the tag expression. `case` and `state` appear only when the command line named them, and `case`
2584
2754
  * 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.
2755
+ * every stage records. `mode` selects the wrapper's Vitest mode when present. A `false` `bail`
2756
+ * runs every selected case after a failure.
2586
2757
  *
2587
2758
  * @example
2588
2759
  * ```ts
@@ -2608,6 +2779,7 @@ export declare interface CaptureRunPlan {
2608
2779
  readonly directory: string;
2609
2780
  readonly config: string;
2610
2781
  readonly mode?: string;
2782
+ readonly bail?: boolean;
2611
2783
  }
2612
2784
 
2613
2785
  /**
@@ -2895,6 +3067,99 @@ export declare interface CaptureStaleOptions extends CaptureReadOptions {
2895
3067
  */
2896
3068
  export declare type CaptureTerminationHandler = () => Promise<boolean>;
2897
3069
 
3070
+ /**
3071
+ * Describes the Vitest configuration a journey wrapper returns for an execution child.
3072
+ *
3073
+ * @remarks `plugins` holds one progress plugin and `projects` one project per variant. Both lists
3074
+ * are mutable because Vitest's `plugins` and `test.projects` options declare mutable lists.
3075
+ *
3076
+ * @example
3077
+ * ```ts
3078
+ * const config: CaptureWrapperConfig<UserWorkspaceConfig> = {
3079
+ * plugins: [createProgressPlugin()],
3080
+ * test: { projects: [project] },
3081
+ * }
3082
+ * ```
3083
+ */
3084
+ export declare interface CaptureWrapperConfig<TProject> {
3085
+ readonly plugins: ProgressPluginInterface[];
3086
+ readonly test: {
3087
+ readonly projects: TProject[];
3088
+ };
3089
+ }
3090
+
3091
+ /**
3092
+ * Configures the journey wrapper `buildCaptureWrapper` assembles.
3093
+ *
3094
+ * @remarks
3095
+ * `url` is the wrapper module's own `import.meta.url`. `variants` declares the producing
3096
+ * viewports in host order, `owners` every canonical owner path, `first` the narrow-stage variant,
3097
+ * and `final` the case that writes each run record. `directory` is the workspace-relative evidence
3098
+ * root. `inputs` lists the integrity input patterns, `sources` the shared and test source patterns
3099
+ * the suite attributes to every destination, `portfolios` the primary portfolio roots, and
3100
+ * `uniform` the owner selectors the preflight judges for mixed observations. `project` builds each
3101
+ * variant's project from capture's override.
3102
+ *
3103
+ * @example
3104
+ * ```ts
3105
+ * const options: CaptureWrapperOptions<UserWorkspaceConfig> = {
3106
+ * url: import.meta.url,
3107
+ * variants: [{ name: 'light-390', width: 390, height: 844 }],
3108
+ * owners: ['pages:mail'],
3109
+ * first: 'light-390',
3110
+ * final: 'closes the run',
3111
+ * directory: 'tmp/captures/states',
3112
+ * inputs: ['src/**'],
3113
+ * sources: { shared: ['src/core/**'], tests: ['tests/**'] },
3114
+ * portfolios: [{ portfolio: 'states', directory: 'tmp/captures/states', scoped: true }],
3115
+ * project: (variant, override) => ({ test: { ...override.test, name: `journey:${variant.name}` } }),
3116
+ * }
3117
+ * ```
3118
+ */
3119
+ export declare interface CaptureWrapperOptions<TProject> {
3120
+ readonly url: string;
3121
+ readonly variants: readonly CaptureViewport[];
3122
+ readonly owners: readonly string[];
3123
+ readonly first: string;
3124
+ readonly final: string;
3125
+ readonly directory: string;
3126
+ readonly inputs: readonly string[];
3127
+ readonly sources: Pick<CaptureSources, 'shared' | 'tests'>;
3128
+ readonly portfolios: readonly CapturePortfolioRoot[];
3129
+ readonly uniform?: readonly string[];
3130
+ readonly project: CaptureProjectHandler<TProject>;
3131
+ }
3132
+
3133
+ /**
3134
+ * Describes the values capture merges into each variant's Vitest project.
3135
+ *
3136
+ * @remarks
3137
+ * `tags` declares every owner tag, `provide` carries the values the runner and the suite read, and
3138
+ * `browser.commands` registers `readCaptureFrames`, which lists the frames under the project's
3139
+ * provided directory. The lists are mutable because Vitest's `test.tags` option declares one, and
3140
+ * the command record is an object type so it assigns to Vitest's command record.
3141
+ *
3142
+ * @example
3143
+ * ```ts
3144
+ * const override: CaptureWrapperOverride = {
3145
+ * test: { tags: [{ name: 'owner:pages' }], provide, browser: { commands: { readCaptureFrames } } },
3146
+ * }
3147
+ * ```
3148
+ */
3149
+ export declare interface CaptureWrapperOverride {
3150
+ readonly test: {
3151
+ readonly tags: Array<{
3152
+ readonly name: string;
3153
+ }>;
3154
+ readonly provide: CaptureProvided;
3155
+ readonly browser: {
3156
+ readonly commands: {
3157
+ readonly readCaptureFrames: () => readonly string[];
3158
+ };
3159
+ };
3160
+ };
3161
+ }
3162
+
2898
3163
  /**
2899
3164
  * Writes one chunk of runner output to the stream the host chooses.
2900
3165
  *
@@ -2941,7 +3206,10 @@ export declare function collectCaptureIdentical(images: readonly CaptureImageRes
2941
3206
  * @param vertical - If `true`, stacks rows; if `false`, places cells side by side
2942
3207
  * @param gap - The space between source pictures. Default: 6.
2943
3208
  * @returns A separately owned composite
2944
- * @throws Thrown for an empty picture selection.
3209
+ * @throws Thrown for an empty picture selection, with the `USAGE` condition.
3210
+ * @throws Thrown with the `EVIDENCE` condition when a width, a height, or the gap is not a whole
3211
+ * number from 0 to `CAPTURE_PNG_LIMITS.side`, or when the composite exceeds that side or the
3212
+ * `CAPTURE_PNG_LIMITS.pixels` budget.
2945
3213
  *
2946
3214
  * @example
2947
3215
  * ```ts
@@ -2963,6 +3231,25 @@ export declare function composeCapturePictures(pictures: readonly CapturePicture
2963
3231
  */
2964
3232
  export declare function computeCaptureHash(bytes: string | Uint8Array): string;
2965
3233
 
3234
+ /**
3235
+ * Computes the key under which a pattern list's matched subset of one input population is memoized.
3236
+ *
3237
+ * @remarks
3238
+ * The key joins the population's digest with the sorted patterns, so a list in any order over one
3239
+ * population shares a key, and one population never answers for another.
3240
+ *
3241
+ * @param inputs - The digested input population the patterns match against
3242
+ * @param patterns - The native glob patterns, in any order
3243
+ * @returns The memo key of the population and the pattern list
3244
+ *
3245
+ * @example
3246
+ * ```ts
3247
+ * const inputs = buildCaptureDigest(['src/**'], { 'src/a.ts': 'f'.repeat(64) })
3248
+ * computeCaptureMatchKey(inputs, ['src/*.ts', 'src/*.md']) === computeCaptureMatchKey(inputs, ['src/*.md', 'src/*.ts']) // true
3249
+ * ```
3250
+ */
3251
+ export declare function computeCaptureMatchKey(inputs: CaptureDigest, patterns: readonly string[]): string;
3252
+
2966
3253
  /**
2967
3254
  * Computes the registry identity from its authenticated receipts and exact output population.
2968
3255
  *
@@ -3126,6 +3413,21 @@ export declare function decodeCapturePicture(bytes: Buffer): CapturePicture;
3126
3413
  */
3127
3414
  export declare function describeCaptureFault(path: string, value: unknown, expected: string, candidates?: readonly string[], required?: readonly string[], allowed?: readonly string[]): string;
3128
3415
 
3416
+ /**
3417
+ * Describes the request holders that keep a workspace busy, naming apart those the host could not inspect.
3418
+ *
3419
+ * @param holders - The holders `CaptureInvocationInterface.holders` lists
3420
+ * @param directory - The workspace-relative request directory that holds their request files
3421
+ * @returns The running holders' sentence, then the uninspected holders' sentence with its correction
3422
+ *
3423
+ * @example
3424
+ * ```ts
3425
+ * describeCaptureHolders([{ pid: 4242, inspected: true }], 'tmp/capture')
3426
+ * // 'Another runner holds this workspace (process 4242)'
3427
+ * ```
3428
+ */
3429
+ export declare function describeCaptureHolders(holders: readonly CaptureHolder[], directory: string): string;
3430
+
3129
3431
  /**
3130
3432
  * Describes a bounded member population and the number omitted from its preview.
3131
3433
  * @example
@@ -3234,6 +3536,24 @@ export declare function encodeCaptureWord(value: number): Buffer;
3234
3536
  */
3235
3537
  export declare function escapeCapturePattern(text: string): string;
3236
3538
 
3539
+ /**
3540
+ * Filters an input population's paths that match any listed pattern.
3541
+ *
3542
+ * @remarks
3543
+ * Each path is matched with the `matchesGlob` function from `node:path`.
3544
+ *
3545
+ * @param inputs - The digested input population whose paths are matched
3546
+ * @param patterns - The native glob patterns
3547
+ * @returns The population's paths that match at least one pattern, in population order
3548
+ *
3549
+ * @example
3550
+ * ```ts
3551
+ * const inputs = buildCaptureDigest(['src/**'], { 'src/a.ts': 'f'.repeat(64), 'src/b.md': 'e'.repeat(64) })
3552
+ * filterCaptureInputs(inputs, ['src/*.ts']) // Set { 'src/a.ts' }
3553
+ * ```
3554
+ */
3555
+ export declare function filterCaptureInputs(inputs: CaptureDigest, patterns: readonly string[]): ReadonlySet<string>;
3556
+
3237
3557
  /**
3238
3558
  * Inflates a PNG's compressed stream, refusing one that is corrupt or longer than declared.
3239
3559
  *
@@ -3336,7 +3656,8 @@ export declare function readCaptureAncestor(path: string): string;
3336
3656
  *
3337
3657
  * @remarks
3338
3658
  * `--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
3659
+ * accept `--changed <ref>` instead of a selector, with optional valueless `--plan`, and valueless
3660
+ * `--no-bail`, which sets `bail` to `false`. Every other
3340
3661
  * flag takes one nonempty value, either separated or in equals form, and only `--variant` repeats.
3341
3662
  * A value beginning with a dash requires equals form. A bare invocation leaves its selector absent
3342
3663
  * so the caller can print usage with the declared selectors.
@@ -3413,6 +3734,27 @@ export declare function readCaptureDescription(value: unknown, expected: Capture
3413
3734
  */
3414
3735
  export declare function readCaptureEntry(value: unknown): CaptureHostEntry;
3415
3736
 
3737
+ /**
3738
+ * Lists the frames a portfolio directory holds, as paths relative to it, in sorted order.
3739
+ *
3740
+ * @remarks
3741
+ * A frame is a `.png` file at the directory's top level or directly inside one of the scope
3742
+ * directories. The run records directory holds no frame, and every other directory is unknown. A
3743
+ * missing directory, or one removed between the listing and its read, holds no frame.
3744
+ *
3745
+ * @param directory - The absolute portfolio directory
3746
+ * @param scopes - The scope directories the owners declare, each an owner path's first segment
3747
+ * @returns Each frame's slash-separated path relative to the directory
3748
+ * @throws Thrown as an `EVIDENCE` capture error for a frame beneath the run records, an unknown
3749
+ * directory, a directory inside a scope, or a directory the host refuses to read.
3750
+ *
3751
+ * @example
3752
+ * ```ts
3753
+ * readCaptureFrames('/repo/tmp/captures/states', ['pages']) // ['pages/inbox--light-390.png']
3754
+ * ```
3755
+ */
3756
+ export declare function readCaptureFrames(directory: string, scopes: readonly string[]): readonly string[];
3757
+
3416
3758
  /**
3417
3759
  * Reads an image only after its opened file's size is inside the compressed-byte budget.
3418
3760
  * @throws Thrown when the file is oversized, unreadable, or changes size during the read.
@@ -3446,6 +3788,21 @@ export declare function readCaptureImage(file: string): Buffer;
3446
3788
  */
3447
3789
  export declare function readCaptureInputs(root: string, patterns: readonly string[], hash?: CaptureHashHandler, read?: CaptureInputHandler): Readonly<Record<string, string>>;
3448
3790
 
3791
+ /**
3792
+ * Lists a directory through a reader, answering an empty list for a missing directory.
3793
+ *
3794
+ * @param directory - The absolute directory to list
3795
+ * @param list - Reads the directory's entries, such as `readdirSync` with its options
3796
+ * @returns The entries the reader returned, or none when the directory is missing
3797
+ * @throws Thrown as an `EVIDENCE` capture error naming the directory for any other failure to read it.
3798
+ *
3799
+ * @example
3800
+ * ```ts
3801
+ * readCaptureListing('/repo/tmp/captures/states/pages', (path) => readdirSync(path)) // ['inbox--light-390.png']
3802
+ * ```
3803
+ */
3804
+ export declare function readCaptureListing<TEntry>(directory: string, list: (path: string) => readonly TEntry[]): readonly TEntry[];
3805
+
3449
3806
  /**
3450
3807
  * Resolves journal lookup references after verifying each stored input population's digest.
3451
3808
  *
@@ -3463,6 +3820,10 @@ export declare function readCaptureLookups(journal: CaptureLookupJournal): reado
3463
3820
  /**
3464
3821
  * Parses standard option tokens and refuses empty values, terminators, and repeated single options.
3465
3822
  *
3823
+ * @remarks A boolean option whose default is `true` reads its `--no-` form as `false` and refuses
3824
+ * its positive form, so `--no-bail` is the one spelling of `bail`; the `--no-` form of any other
3825
+ * option is refused as unknown. An option and its `--no-` form repeat each other.
3826
+ *
3466
3827
  * @param argv - The arguments after the subcommand
3467
3828
  * @param options - The command's frozen Node option definitions
3468
3829
  * @param usage - The command syntax appended to every parser refusal
@@ -3470,6 +3831,7 @@ export declare function readCaptureLookups(journal: CaptureLookupJournal): reado
3470
3831
  * @example
3471
3832
  * ```ts
3472
3833
  * readCaptureOptions(['--case=-draft'], CAPTURE_COMMAND_OPTIONS.journey, 'Usage: capture journey <selector>').values.case // '-draft'
3834
+ * readCaptureOptions(['--no-bail'], CAPTURE_COMMAND_OPTIONS.journey, 'Usage: capture journey <selector>').values.bail // false
3473
3835
  * ```
3474
3836
  */
3475
3837
  export declare function readCaptureOptions<Options extends ParseArgsOptionsConfig>(argv: readonly string[], options: Options, usage: string): CaptureParsedArguments<Options>;
@@ -3490,6 +3852,33 @@ export declare function readCaptureOptions<Options extends ParseArgsOptionsConfi
3490
3852
  */
3491
3853
  export declare function readCapturePortfolios(value: unknown, subject: string): readonly CapturePortfolioRoot[];
3492
3854
 
3855
+ /**
3856
+ * Reads the progress file of the stage that is running, or that ran last, in a workspace.
3857
+ *
3858
+ * @remarks
3859
+ * The file is the most recently modified `<stage>.progress.jsonl` beneath the request directory's
3860
+ * run directories. The progress file is an observation of the run and never evidence. A partial
3861
+ * last line, which the reporter can still be appending, is not read, so a file with no complete
3862
+ * line holds no run. For each run with no `end` line, `alive` reads the process id its `init` line
3863
+ * records: a writer that has ended turns the run `interrupted`, measured to the time of its last
3864
+ * line, and a writer the host cannot inspect, or an id that is not a positive safe integer, lists
3865
+ * the run's id in `uninspected`.
3866
+ *
3867
+ * @param root - The absolute workspace path
3868
+ * @param requests - The workspace-relative request directory
3869
+ * @param now - The wall-clock time of the reading, in milliseconds since the Unix epoch. Default: `Date.now()`
3870
+ * @param alive - Reads whether a writer process exists, or `undefined` when the host cannot tell. Default: `inspectProcess` from `@orkestrel/process/server`
3871
+ * @returns The workspace-relative file, one reading per process that wrote it, and the writers the host could not inspect
3872
+ * @throws Thrown as a `STAGE` capture error when no stage has written a progress file, or when the
3873
+ * file cannot be read or holds a complete line that is not a progress event.
3874
+ *
3875
+ * @example
3876
+ * ```ts
3877
+ * readCaptureProgress('/repo', 'tmp/capture').runs[0]?.state // 'live' while the stage runs
3878
+ * ```
3879
+ */
3880
+ export declare function readCaptureProgress(root: string, requests: string, now?: number, alive?: (pid: number) => boolean | undefined): CaptureProgress;
3881
+
3493
3882
  /**
3494
3883
  * Reads one wrapper project's host declarations from its Vitest test configuration.
3495
3884
  *
@@ -3558,8 +3947,9 @@ export declare function readCaptureReaderArguments(argv: readonly string[], root
3558
3947
  *
3559
3948
  * @remarks
3560
3949
  * 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.
3950
+ * variants named by repeated `--variant` flags. Every flag but valueless `--no-bail` takes one
3951
+ * value, and only `--variant` repeats. `--mode` is forwarded to the wrapper's Vitest process
3952
+ * unread, and `--no-bail` sets `bail` to `false`.
3563
3953
  *
3564
3954
  * @param argv - The arguments after the subcommand
3565
3955
  * @param root - The absolute workspace path the wrapper path resolves against
@@ -3610,39 +4000,24 @@ export declare function readCaptureRequest(options: CaptureRequestOptions): Capt
3610
4000
  * Reads the process id that a request file, or its temporary sibling, names.
3611
4001
  *
3612
4002
  * @param name - A file name from the request directory
3613
- * @returns The positive process id the name carries, or `undefined` for any other name
4003
+ * @returns The process id the name carries, from 1 to `CAPTURE_PID_LIMIT`, or `undefined` for any
4004
+ * other name
3614
4005
  *
3615
4006
  * @example
3616
4007
  * ```ts
3617
4008
  * readCaptureRequestOwner('journey-selection-4242.json') // 4242
3618
4009
  * readCaptureRequestOwner('journey-selection-4242.json.tmp') // 4242
3619
4010
  * readCaptureRequestOwner('journey-selection.json') // undefined
4011
+ * readCaptureRequestOwner('journey-selection-4294967296.json') // undefined
3620
4012
  * ```
3621
4013
  */
3622
4014
  export declare function readCaptureRequestOwner(name: string): number | undefined;
3623
4015
 
3624
- /**
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
- *
3634
- * @example
3635
- * ```ts
3636
- * readCaptureRunning(process.pid) // true
3637
- * ```
3638
- */
3639
- export declare function readCaptureRunning(pid: number): boolean;
3640
-
3641
4016
  /**
3642
4017
  * Reads the installed workspace Vitest's exact title separator, refusing unsupported majors.
3643
4018
  * @example
3644
4019
  * ```ts
3645
- * readCaptureSeparator('/workspace/node_modules/vitest/vitest.mjs') // ' ' on Vitest 4
4020
+ * readCaptureSeparator('/workspace/node_modules/vitest/vitest.mjs') // ' > ' on Vitest 5
3646
4021
  * ```
3647
4022
  */
3648
4023
  export declare function readCaptureSeparator(entry: string): string;
@@ -3691,7 +4066,7 @@ export declare function readCaptureViewport(test: unknown): CaptureViewport;
3691
4066
  * Renders an exact owner command with the selected variants and filters in host shell syntax.
3692
4067
  *
3693
4068
  * @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
4069
+ * @param parsed - The parsed flags, a `false` bail rendered as `--no-bail` on every command but `stale`; changed and plan flags are deliberately replaced by the owner
3695
4070
  * @param selector - The explicit owner or all selector; omitted for a registry refresh
3696
4071
  * @param root - The workspace that makes the wrapper path relative
3697
4072
  * @returns The command ready to copy into the host shell
@@ -3703,6 +4078,21 @@ export declare function readCaptureViewport(test: unknown): CaptureViewport;
3703
4078
  */
3704
4079
  export declare function renderCaptureCommand(command: CaptureCommand | 'registry', parsed: CaptureRunnerArguments, selector: string | undefined, root: string): string;
3705
4080
 
4081
+ /**
4082
+ * Renders a progress reading as the text `capture progress` prints.
4083
+ *
4084
+ * @param progress - The reading `readCaptureProgress` returns
4085
+ * @returns The file line, then each run as `renderProgress` from `@orkestrel/test/server` renders it,
4086
+ * followed by an unknown-state line for each run whose writer the host could not inspect
4087
+ *
4088
+ * @example
4089
+ * ```ts
4090
+ * renderCaptureProgress({ file: 'tmp/capture/runs/a/selected.progress.jsonl', runs: [], uninspected: [] })
4091
+ * // 'progress tmp/capture/runs/a/selected.progress.jsonl\nNo run has written a complete progress line yet'
4092
+ * ```
4093
+ */
4094
+ export declare function renderCaptureProgress(progress: CaptureProgress): string;
4095
+
3706
4096
  /** Validates a supplied path argument before work and classifies an outside value as usage.
3707
4097
  * @param root - The repository root
3708
4098
  * @param path - The supplied path resolved against the root