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