@orkestrel/capture 0.0.12 → 0.0.14

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.
@@ -44,7 +44,7 @@ var CAPTURE_RECOVERIES = Object.freeze({
44
44
  *
45
45
  * @example
46
46
  * ```ts
47
- * CAPTURE_STATUS_RECOVERIES['stale-own'] // 'capture'
47
+ * CAPTURE_STATUS_RECOVERIES['stale'] // 'capture'
48
48
  * ```
49
49
  */
50
50
  var CAPTURE_STATUS_RECOVERIES = Object.freeze({
@@ -53,8 +53,8 @@ var CAPTURE_STATUS_RECOVERIES = Object.freeze({
53
53
  orphan: void 0,
54
54
  missing: "capture",
55
55
  unstamped: "capture",
56
- "stale-shared": "capture",
57
- "stale-own": "capture"
56
+ drifted: "capture",
57
+ stale: "capture"
58
58
  });
59
59
  /**
60
60
  * Names the executable subcommand each runner command answers to.
@@ -104,9 +104,9 @@ var CAPTURE_OWNER_FILE = ".capture-owner";
104
104
  * CAPTURE_PID_LIMIT // 2147483647
105
105
  * ```
106
106
  */
107
- var CAPTURE_PID_LIMIT = 2147483647;
107
+ var CAPTURE_PID_LIMIT = 0x7fffffff;
108
108
  /**
109
- * Caps each refusal population so hostile records cannot flood a terminal or agent context.
109
+ * Caps each refusal population so untrusted records cannot flood a terminal or agent context.
110
110
  * @example
111
111
  * ```ts
112
112
  * CAPTURE_REFUSAL_LIMIT // 16
@@ -652,7 +652,7 @@ function resolveCapturePhysical(path) {
652
652
  * Validates a physical destination against a physical root before any read or write.
653
653
  *
654
654
  * @returns The physical destination, including its missing suffix
655
- * @throws Thrown when the destination or an existing ancestor escapes the root.
655
+ * @throws Thrown when the destination or an existing ancestor resolves outside the root.
656
656
  * @example
657
657
  * ```ts
658
658
  * requireCaptureContained('/workspace', '/workspace/tmp/new') // '/workspace/tmp/new'
@@ -1330,7 +1330,7 @@ function predictCaptureByte(left, up, corner) {
1330
1330
  */
1331
1331
  function readCaptureChunks(bytes, offset = 8) {
1332
1332
  requireCaptureImageSize(bytes.length);
1333
- const positions = scanCaptureChunks(bytes, offset, Infinity);
1333
+ const positions = scanCaptureChunks(bytes, offset, 1e400);
1334
1334
  const types = positions.map((position) => bytes.readUInt32BE(position + 4));
1335
1335
  const header = Buffer.from("IHDR", "latin1").readUInt32BE(0);
1336
1336
  const palette = Buffer.from("PLTE", "latin1").readUInt32BE(0);
@@ -1653,7 +1653,7 @@ function encodeCapturePicture(picture, compressed = true) {
1653
1653
  */
1654
1654
  function sumCaptureRow(pixels, start, columns) {
1655
1655
  if (columns > 8) {
1656
- if (columns === Infinity) throw new CaptureError("Capture sum columns must be a finite sample count, not Infinity", { code: "EVIDENCE" });
1656
+ if (columns === 1e400) throw new CaptureError("Capture sum columns must be a finite sample count, not Infinity", { code: "EVIDENCE" });
1657
1657
  const half = Math.ceil(columns / 2);
1658
1658
  return sumCaptureRow(pixels, start, half) + sumCaptureRow(pixels, start + half * 3, columns - half);
1659
1659
  }
@@ -1688,7 +1688,7 @@ function sumCaptureRow(pixels, start, columns) {
1688
1688
  */
1689
1689
  function sumCaptureBlock(picture, top, left, row, rows, columns) {
1690
1690
  if (rows > 2) {
1691
- if (rows === Infinity) throw new CaptureError("Capture sum rows must be a finite row count, not Infinity", { code: "EVIDENCE" });
1691
+ if (rows === 1e400) throw new CaptureError("Capture sum rows must be a finite row count, not Infinity", { code: "EVIDENCE" });
1692
1692
  const half = Math.ceil(rows / 2);
1693
1693
  return sumCaptureBlock(picture, top, left, row, half, columns) + sumCaptureBlock(picture, top, left, row + half, rows - half, columns);
1694
1694
  }
@@ -1881,16 +1881,16 @@ function splitCaptureSheets(rows, size, gap) {
1881
1881
  *
1882
1882
  * @example
1883
1883
  * ```ts
1884
- * readCaptureRequestOwner('journey-selection-4242.json') // 4242
1885
- * readCaptureRequestOwner('journey-selection-4242.json.tmp') // 4242
1886
- * readCaptureRequestOwner('journey-selection.json') // undefined
1887
- * readCaptureRequestOwner('journey-selection-4294967296.json') // undefined
1884
+ * readCaptureRequestOwner('selection-4242.json') // 4242
1885
+ * readCaptureRequestOwner('selection-4242.json.tmp') // 4242
1886
+ * readCaptureRequestOwner('selection.json') // undefined
1887
+ * readCaptureRequestOwner('selection-4294967296.json') // undefined
1888
1888
  * ```
1889
1889
  */
1890
1890
  function readCaptureRequestOwner(name) {
1891
1891
  const match = new RegExp(`^${CAPTURE_REQUEST_PREFIX}-(\\d+)\\.json(?:\\.tmp)?$`, "u").exec(name);
1892
1892
  const pid = Number(match?.[1]);
1893
- return isSafeInteger(pid) && pid > 0 && pid <= 2147483647 ? pid : void 0;
1893
+ return isSafeInteger(pid) && pid > 0 && pid <= 0x7fffffff ? pid : void 0;
1894
1894
  }
1895
1895
  /**
1896
1896
  * Describes the request holders that keep a workspace busy, naming apart those the host could not inspect.
@@ -2494,8 +2494,8 @@ function describeCaptureSelectorFault(selector, selectors) {
2494
2494
  *
2495
2495
  * @example
2496
2496
  * ```ts
2497
- * buildCaptureRequestRefusal('/repo/tmp/units/journey-selection-4242.json').message
2498
- * // 'Invalid journey selection request: /repo/tmp/units/journey-selection-4242.json'
2497
+ * buildCaptureRequestRefusal('/repo/tmp/units/selection-4242.json').message
2498
+ * // 'Invalid journey selection request: /repo/tmp/units/selection-4242.json'
2499
2499
  * ```
2500
2500
  */
2501
2501
  function buildCaptureRequestRefusal(file, cause) {
@@ -2844,7 +2844,7 @@ function resolveCaptureRequests(directory) {
2844
2844
  return resolve(directory ?? process.env["CAPTURE_REQUESTS"] ?? CAPTURE_DEFAULTS.requests);
2845
2845
  }
2846
2846
  /**
2847
- * Builds the empty Node configuration a wrapper returns once it has answered a discovery request.
2847
+ * Builds the empty Node configuration a wrapper returns after it has answered a discovery request.
2848
2848
  *
2849
2849
  * @remarks
2850
2850
  * It carries no project, no setup file, and no include pattern, so Vitest collects no test, starts
@@ -2925,7 +2925,7 @@ function readCaptureDescription(value, expected) {
2925
2925
  * process may answer again if Vitest loads its configuration twice.
2926
2926
  *
2927
2927
  * @param options - The parent id, the process arguments, the request directory, the wrapper path, and the wrapper's `test.projects`
2928
- * @returns True once the description is written; false when the request is no discovery request
2928
+ * @returns True after the description is written; false when the request is no discovery request
2929
2929
  * @throws Thrown as a `HOST` capture error for a discovery request that fails any check or a
2930
2930
  * replayed answer. It does not judge the projects: the runner reads and refuses a malformed one.
2931
2931
  *
@@ -3328,7 +3328,7 @@ function readCaptureInputs(root, patterns, hash = computeCaptureHash, read) {
3328
3328
  }));
3329
3329
  }
3330
3330
  /**
3331
- * Writes one JSON document atomically, so a reader sees the old bytes or the new and never a part.
3331
+ * Writes one JSON document atomically, so a reader sees either the prior bytes or the replacement and never a part.
3332
3332
  *
3333
3333
  * @remarks
3334
3334
  * The document is written to a unique temporary sibling, flushed, and renamed over the target. The
@@ -3498,7 +3498,7 @@ var CaptureIntegrity = class {
3498
3498
  * Binds the engine to an explicit workspace and host portfolio mapping.
3499
3499
  *
3500
3500
  * @param options - The workspace, evidence paths, authorized physical roots, and optional file hash
3501
- * @throws Thrown when the root is not absolute, a path escapes the root, or a portfolio is invalid.
3501
+ * @throws Thrown when the root is not absolute, a path resolves outside the root, or a portfolio is invalid.
3502
3502
  */
3503
3503
  constructor(options) {
3504
3504
  if (!isAbsolute(options.root)) throw new CaptureError("Integrity root must be absolute", { code: "HOST" });
@@ -3872,11 +3872,11 @@ var CaptureIntegrity = class {
3872
3872
  reason: "Image digest, size, or modification time differs"
3873
3873
  });
3874
3874
  if (!matchesCaptureMembers(stamp.sources.shared, entry.sources.shared) || shared.digest !== stamp.shared.digest) findings.push({
3875
- status: "stale-shared",
3875
+ status: "drifted",
3876
3876
  reason: "Shared source patterns, membership, or hashes changed"
3877
3877
  });
3878
3878
  if (!matchesCaptureMembers(stamp.sources.own, entry.sources.own) || collectCaptureChanges(stamp.own, own.files).length > 0 || entry.sources.own.some((pattern) => !Object.keys(own.files).some((file) => matchesGlob(file, pattern)))) findings.push({
3879
- status: "stale-own",
3879
+ status: "stale",
3880
3880
  reason: "Own source patterns, membership, or hashes changed"
3881
3881
  });
3882
3882
  if (stamp.case !== entry.case || stamp.project !== entry.project || stamp.portfolio !== entry.portfolio) findings.push({
@@ -4830,7 +4830,7 @@ var CaptureInvocation = class {
4830
4830
  * reads the host's wrapper through a `CaptureDiscovery`, the consumer's own Vitest in discovery
4831
4831
  * mode, and reads its projects the way the runner does: it names no portfolio, owner, variant, or
4832
4832
  * path the wrapper does not declare, and it imports neither Vite nor Vitest. It
4833
- * judges each frame by the artifact the frame's own stamp names, never by a variant's latest file.
4833
+ * judges each frame by the artifact the frame's own stamp names, never by a variant's most recent file.
4834
4834
  * Rules that belong to one product, such as a page-title check or a pixel comparison, live in a
4835
4835
  * host module named by the `checks` option. The reader loads that module through the runtime's own
4836
4836
  * module loader by its file URL, reads its `CAPTURE_CHECKS` export, a list of readers from a frame to
@@ -5865,8 +5865,8 @@ var CaptureRunner = class {
5865
5865
  * @remarks
5866
5866
  * Sheets remain preflight artifacts, never assembled-portfolio acceptance. The class reads the
5867
5867
  * selection through `CapturePreflight`, so it judges the same population the preflight does and
5868
- * keeps its refusals. It writes the sheets, an index of every cell, and a notes document into a new
5869
- * directory that is contained in the workspace, has an existing parent, and lies outside every
5868
+ * keeps its refusals. It writes the sheets, an index of every cell, and a notes document into an
5869
+ * output directory that is contained in the workspace, has an existing parent, and lies outside every
5870
5870
  * selected capture directory. A frame whose image cannot be read shows as a red mark with no source
5871
5871
  * size, and its index cell carries the freshness the engine classified, `missing` for an absent file.
5872
5872
  *
@@ -5881,7 +5881,7 @@ var CaptureSheets = class {
5881
5881
  #stdout;
5882
5882
  #stderr;
5883
5883
  /**
5884
- * Binds a read selection and a new output directory.
5884
+ * Binds a read selection and an output directory.
5885
5885
  *
5886
5886
  * @param options - The explicit host, selection, and sheet destination
5887
5887
  */
@@ -6132,8 +6132,8 @@ var CaptureCLI = class {
6132
6132
  * Creates the integrity engine bound to an explicit workspace and host portfolio mapping.
6133
6133
  *
6134
6134
  * @param options - The workspace, evidence paths, authorized physical roots, and optional file hash
6135
- * @returns A new engine that stamps stages, reads declarations, checks freshness, and resolves states
6136
- * @throws Thrown when the root is not absolute, a path escapes the root, or a portfolio is invalid.
6135
+ * @returns An engine that stamps stages, reads declarations, checks freshness, and resolves states
6136
+ * @throws Thrown when the root is not absolute, a path resolves outside the root, or a portfolio is invalid.
6137
6137
  *
6138
6138
  * @example
6139
6139
  * ```ts
@@ -6155,7 +6155,7 @@ function createCaptureIntegrity(options) {
6155
6155
  * Creates the runner that drives owner-selected journeys for one command line.
6156
6156
  *
6157
6157
  * @param options - The command, the workspace, the wrapper default, the request directory, the command line, and optional output and engine seams
6158
- * @returns A new runner whose `execute` runs the command and returns its exit status
6158
+ * @returns A runner whose `execute` runs the command and returns its exit status
6159
6159
  *
6160
6160
  * @example
6161
6161
  * ```ts
@@ -6176,7 +6176,7 @@ function createCaptureRunner(options) {
6176
6176
  * Creates the preflight that judges the selected frames' freshness, mixed observations, and coverage.
6177
6177
  *
6178
6178
  * @param options - The workspace, the wrapper, the selection, the journey artifact directory, and optional checks module and output seams
6179
- * @returns A new preflight whose `execute` prints its report and returns the exit status
6179
+ * @returns A preflight whose `execute` prints its report and returns the exit status
6180
6180
  *
6181
6181
  * @example
6182
6182
  * ```ts
@@ -6195,8 +6195,8 @@ function createCapturePreflight(options) {
6195
6195
  /**
6196
6196
  * Creates the contact-sheet writer for the selected frames.
6197
6197
  *
6198
- * @param options - The reader options that select the frames and the new directory that receives the sheets
6199
- * @returns A new writer whose `execute` writes the sheets and returns the exit status
6198
+ * @param options - The reader options that select the frames and the output directory that receives the sheets
6199
+ * @returns A writer whose `execute` writes the sheets and returns the exit status
6200
6200
  *
6201
6201
  * @example
6202
6202
  * ```ts
@@ -6211,7 +6211,7 @@ function createCaptureSheets(options) {
6211
6211
  * Creates the discovery that reads a consumer's wrapper through the consumer's own Vitest.
6212
6212
  *
6213
6213
  * @param options - The workspace, the absolute wrapper path, the invocation that owns the child, and the optional mode and deadline
6214
- * @returns A new discovery whose `describe` publishes the request and returns the wrapper's host description
6214
+ * @returns A discovery whose `describe` publishes the request and returns the wrapper's host description
6215
6215
  *
6216
6216
  * @example
6217
6217
  * ```ts
@@ -6226,7 +6226,7 @@ function createCaptureDiscovery(options) {
6226
6226
  * Creates the registry refresh that runs each producing variant's complete journey and publishes the registry.
6227
6227
  *
6228
6228
  * @param options - The workspace, the wrapper default, the request directory, the command line, and optional output seams
6229
- * @returns A new refresh whose `execute` publishes `registry.json` and returns the exit status
6229
+ * @returns A refresh whose `execute` publishes `registry.json` and returns the exit status
6230
6230
  *
6231
6231
  * @example
6232
6232
  * ```ts
@@ -6246,7 +6246,7 @@ function createCaptureRegistrar(options) {
6246
6246
  * Creates the executable's command dispatcher over a workspace and injected writers.
6247
6247
  *
6248
6248
  * @param options - The workspace and the report and diagnostic writers; default: the working directory and the process streams
6249
- * @returns A new dispatcher whose `execute` runs one command line and returns its exit code
6249
+ * @returns A dispatcher whose `execute` runs one command line and returns its exit code
6250
6250
  *
6251
6251
  * @example
6252
6252
  * ```ts