@orkestrel/capture 0.0.1 → 0.0.2
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 +3 -0
- package/dist/src/core/index.cjs +2 -2
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +1 -1
- package/dist/src/core/index.d.ts +1 -1
- package/dist/src/core/index.js +3 -3
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +35 -31
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +26 -24
- package/dist/src/server/index.d.ts +26 -24
- package/dist/src/server/index.js +35 -31
- package/dist/src/server/index.js.map +1 -1
- package/package.json +14 -14
|
@@ -227,9 +227,9 @@ export declare function buildCaptureRequestRefusal(file: string, cause?: unknown
|
|
|
227
227
|
* ```
|
|
228
228
|
*/
|
|
229
229
|
export declare const CAPTURE_COMMAND_NAMES: Readonly<{
|
|
230
|
-
readonly journey:
|
|
231
|
-
readonly capture:
|
|
232
|
-
readonly stale:
|
|
230
|
+
readonly journey: 'journey';
|
|
231
|
+
readonly capture: 'frames';
|
|
232
|
+
readonly stale: 'stale';
|
|
233
233
|
}>;
|
|
234
234
|
|
|
235
235
|
/**
|
|
@@ -380,9 +380,9 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
|
|
|
380
380
|
* ```
|
|
381
381
|
*/
|
|
382
382
|
export declare const CAPTURE_DEFAULTS: Readonly<{
|
|
383
|
-
readonly config:
|
|
384
|
-
readonly requests:
|
|
385
|
-
readonly journeys:
|
|
383
|
+
readonly config: 'configs/app/vite.journey.config.ts';
|
|
384
|
+
readonly requests: 'tmp/capture';
|
|
385
|
+
readonly journeys: 'tmp/journey';
|
|
386
386
|
}>;
|
|
387
387
|
|
|
388
388
|
/**
|
|
@@ -400,8 +400,8 @@ export declare const CAPTURE_DEFAULTS: Readonly<{
|
|
|
400
400
|
* ```
|
|
401
401
|
*/
|
|
402
402
|
export declare const CAPTURE_DISCOVERY: Readonly<{
|
|
403
|
-
readonly phase:
|
|
404
|
-
readonly description:
|
|
403
|
+
readonly phase: 'discover';
|
|
404
|
+
readonly description: 'description.json';
|
|
405
405
|
readonly arguments: readonly string[];
|
|
406
406
|
readonly deadline: 60000;
|
|
407
407
|
}>;
|
|
@@ -555,8 +555,8 @@ export declare const CAPTURE_REGISTRY_STAGE = "registry";
|
|
|
555
555
|
* ```
|
|
556
556
|
*/
|
|
557
557
|
export declare const CAPTURE_REPORT_LINES: Readonly<{
|
|
558
|
-
readonly preflight:
|
|
559
|
-
readonly sheets:
|
|
558
|
+
readonly preflight: 'READER';
|
|
559
|
+
readonly sheets: 'SHEETS';
|
|
560
560
|
}>;
|
|
561
561
|
|
|
562
562
|
/**
|
|
@@ -616,10 +616,10 @@ export declare const CAPTURE_SHEET: Readonly<{
|
|
|
616
616
|
* ```
|
|
617
617
|
*/
|
|
618
618
|
export declare const CAPTURE_SHEET_FILES: Readonly<{
|
|
619
|
-
readonly prefix:
|
|
619
|
+
readonly prefix: 'sheet-';
|
|
620
620
|
readonly digits: 3;
|
|
621
|
-
readonly index:
|
|
622
|
-
readonly notes:
|
|
621
|
+
readonly index: 'index.json';
|
|
622
|
+
readonly notes: 'index.md';
|
|
623
623
|
}>;
|
|
624
624
|
|
|
625
625
|
/**
|
|
@@ -631,9 +631,9 @@ export declare const CAPTURE_SHEET_FILES: Readonly<{
|
|
|
631
631
|
* ```
|
|
632
632
|
*/
|
|
633
633
|
export declare const CAPTURE_STAGES: Readonly<{
|
|
634
|
-
readonly selected:
|
|
635
|
-
readonly first:
|
|
636
|
-
readonly rest:
|
|
634
|
+
readonly selected: 'selected';
|
|
635
|
+
readonly first: 'narrow';
|
|
636
|
+
readonly rest: 'rest';
|
|
637
637
|
}>;
|
|
638
638
|
|
|
639
639
|
/**
|
|
@@ -1840,15 +1840,15 @@ export declare interface CaptureOwnershipHost {
|
|
|
1840
1840
|
*/
|
|
1841
1841
|
export declare type CaptureParsedArguments<Options extends ParseArgsOptionsConfig> = {
|
|
1842
1842
|
readonly [Key in keyof ReturnType<typeof parseArgs<{
|
|
1843
|
-
options: Options;
|
|
1844
|
-
tokens: true;
|
|
1845
|
-
strict: true;
|
|
1846
|
-
allowPositionals: true;
|
|
1843
|
+
readonly options: Options;
|
|
1844
|
+
readonly tokens: true;
|
|
1845
|
+
readonly strict: true;
|
|
1846
|
+
readonly allowPositionals: true;
|
|
1847
1847
|
}>>]: Readonly<ReturnType<typeof parseArgs<{
|
|
1848
|
-
options: Options;
|
|
1849
|
-
tokens: true;
|
|
1850
|
-
strict: true;
|
|
1851
|
-
allowPositionals: true;
|
|
1848
|
+
readonly options: Options;
|
|
1849
|
+
readonly tokens: true;
|
|
1850
|
+
readonly strict: true;
|
|
1851
|
+
readonly allowPositionals: true;
|
|
1852
1852
|
}>>[Key]>;
|
|
1853
1853
|
};
|
|
1854
1854
|
|
|
@@ -2286,6 +2286,8 @@ export declare interface CaptureReceiptInput {
|
|
|
2286
2286
|
* place, so a registry the engine would refuse never replaces a good one. With `--variant`, the
|
|
2287
2287
|
* existing registry's receipts for the other declared variants are kept. It never widens a scoped
|
|
2288
2288
|
* run into a refresh and refuses while another runner holds a request file in the request directory.
|
|
2289
|
+
* Before any stage, it reads the inherited manifest and lookup journal and refuses an unsupported
|
|
2290
|
+
* schema with the file to inspect and repair.
|
|
2289
2291
|
*
|
|
2290
2292
|
* @example
|
|
2291
2293
|
* ```ts
|
|
@@ -227,9 +227,9 @@ export declare function buildCaptureRequestRefusal(file: string, cause?: unknown
|
|
|
227
227
|
* ```
|
|
228
228
|
*/
|
|
229
229
|
export declare const CAPTURE_COMMAND_NAMES: Readonly<{
|
|
230
|
-
readonly journey:
|
|
231
|
-
readonly capture:
|
|
232
|
-
readonly stale:
|
|
230
|
+
readonly journey: 'journey';
|
|
231
|
+
readonly capture: 'frames';
|
|
232
|
+
readonly stale: 'stale';
|
|
233
233
|
}>;
|
|
234
234
|
|
|
235
235
|
/**
|
|
@@ -380,9 +380,9 @@ export declare const CAPTURE_COMMAND_OPTIONS: Readonly<{
|
|
|
380
380
|
* ```
|
|
381
381
|
*/
|
|
382
382
|
export declare const CAPTURE_DEFAULTS: Readonly<{
|
|
383
|
-
readonly config:
|
|
384
|
-
readonly requests:
|
|
385
|
-
readonly journeys:
|
|
383
|
+
readonly config: 'configs/app/vite.journey.config.ts';
|
|
384
|
+
readonly requests: 'tmp/capture';
|
|
385
|
+
readonly journeys: 'tmp/journey';
|
|
386
386
|
}>;
|
|
387
387
|
|
|
388
388
|
/**
|
|
@@ -400,8 +400,8 @@ export declare const CAPTURE_DEFAULTS: Readonly<{
|
|
|
400
400
|
* ```
|
|
401
401
|
*/
|
|
402
402
|
export declare const CAPTURE_DISCOVERY: Readonly<{
|
|
403
|
-
readonly phase:
|
|
404
|
-
readonly description:
|
|
403
|
+
readonly phase: 'discover';
|
|
404
|
+
readonly description: 'description.json';
|
|
405
405
|
readonly arguments: readonly string[];
|
|
406
406
|
readonly deadline: 60000;
|
|
407
407
|
}>;
|
|
@@ -555,8 +555,8 @@ export declare const CAPTURE_REGISTRY_STAGE = "registry";
|
|
|
555
555
|
* ```
|
|
556
556
|
*/
|
|
557
557
|
export declare const CAPTURE_REPORT_LINES: Readonly<{
|
|
558
|
-
readonly preflight:
|
|
559
|
-
readonly sheets:
|
|
558
|
+
readonly preflight: 'READER';
|
|
559
|
+
readonly sheets: 'SHEETS';
|
|
560
560
|
}>;
|
|
561
561
|
|
|
562
562
|
/**
|
|
@@ -616,10 +616,10 @@ export declare const CAPTURE_SHEET: Readonly<{
|
|
|
616
616
|
* ```
|
|
617
617
|
*/
|
|
618
618
|
export declare const CAPTURE_SHEET_FILES: Readonly<{
|
|
619
|
-
readonly prefix:
|
|
619
|
+
readonly prefix: 'sheet-';
|
|
620
620
|
readonly digits: 3;
|
|
621
|
-
readonly index:
|
|
622
|
-
readonly notes:
|
|
621
|
+
readonly index: 'index.json';
|
|
622
|
+
readonly notes: 'index.md';
|
|
623
623
|
}>;
|
|
624
624
|
|
|
625
625
|
/**
|
|
@@ -631,9 +631,9 @@ export declare const CAPTURE_SHEET_FILES: Readonly<{
|
|
|
631
631
|
* ```
|
|
632
632
|
*/
|
|
633
633
|
export declare const CAPTURE_STAGES: Readonly<{
|
|
634
|
-
readonly selected:
|
|
635
|
-
readonly first:
|
|
636
|
-
readonly rest:
|
|
634
|
+
readonly selected: 'selected';
|
|
635
|
+
readonly first: 'narrow';
|
|
636
|
+
readonly rest: 'rest';
|
|
637
637
|
}>;
|
|
638
638
|
|
|
639
639
|
/**
|
|
@@ -1840,15 +1840,15 @@ export declare interface CaptureOwnershipHost {
|
|
|
1840
1840
|
*/
|
|
1841
1841
|
export declare type CaptureParsedArguments<Options extends ParseArgsOptionsConfig> = {
|
|
1842
1842
|
readonly [Key in keyof ReturnType<typeof parseArgs<{
|
|
1843
|
-
options: Options;
|
|
1844
|
-
tokens: true;
|
|
1845
|
-
strict: true;
|
|
1846
|
-
allowPositionals: true;
|
|
1843
|
+
readonly options: Options;
|
|
1844
|
+
readonly tokens: true;
|
|
1845
|
+
readonly strict: true;
|
|
1846
|
+
readonly allowPositionals: true;
|
|
1847
1847
|
}>>]: Readonly<ReturnType<typeof parseArgs<{
|
|
1848
|
-
options: Options;
|
|
1849
|
-
tokens: true;
|
|
1850
|
-
strict: true;
|
|
1851
|
-
allowPositionals: true;
|
|
1848
|
+
readonly options: Options;
|
|
1849
|
+
readonly tokens: true;
|
|
1850
|
+
readonly strict: true;
|
|
1851
|
+
readonly allowPositionals: true;
|
|
1852
1852
|
}>>[Key]>;
|
|
1853
1853
|
};
|
|
1854
1854
|
|
|
@@ -2286,6 +2286,8 @@ export declare interface CaptureReceiptInput {
|
|
|
2286
2286
|
* place, so a registry the engine would refuse never replaces a good one. With `--variant`, the
|
|
2287
2287
|
* existing registry's receipts for the other declared variants are kept. It never widens a scoped
|
|
2288
2288
|
* run into a refresh and refuses while another runner holds a request file in the request directory.
|
|
2289
|
+
* Before any stage, it reads the inherited manifest and lookup journal and refuses an unsupported
|
|
2290
|
+
* schema with the file to inspect and repair.
|
|
2289
2291
|
*
|
|
2290
2292
|
* @example
|
|
2291
2293
|
* ```ts
|
package/dist/src/server/index.js
CHANGED
|
@@ -1130,39 +1130,23 @@ function encodeCapturePicture(picture, compressed = true) {
|
|
|
1130
1130
|
function shrinkCapturePicture(picture, factor, limit) {
|
|
1131
1131
|
const width = Math.max(1, Math.ceil(picture.width / factor));
|
|
1132
1132
|
const height = Math.min(Math.max(1, Math.ceil(picture.height / factor)), limit);
|
|
1133
|
-
const
|
|
1134
|
-
const sums = new Float64Array(width * 3);
|
|
1135
|
-
for (let y = 0; y < height; y += 1) {
|
|
1136
|
-
sums.fill(0);
|
|
1137
|
-
const rows = Math.min(factor, picture.height - y * factor);
|
|
1138
|
-
for (let row = 0; row < rows; row += 1) {
|
|
1139
|
-
let source = (y * factor + row) * picture.width * 3;
|
|
1140
|
-
for (let x = 0; x < width; x += 1) {
|
|
1141
|
-
const columns = Math.min(factor, picture.width - x * factor);
|
|
1142
|
-
let red = 0;
|
|
1143
|
-
let green = 0;
|
|
1144
|
-
let blue = 0;
|
|
1145
|
-
for (let column = 0; column < columns; column += 1) {
|
|
1146
|
-
red += picture.pixels[source] ?? 0;
|
|
1147
|
-
green += picture.pixels[source + 1] ?? 0;
|
|
1148
|
-
blue += picture.pixels[source + 2] ?? 0;
|
|
1149
|
-
source += 3;
|
|
1150
|
-
}
|
|
1151
|
-
const target = x * 3;
|
|
1152
|
-
sums[target] = (sums[target] ?? 0) + red;
|
|
1153
|
-
sums[target + 1] = (sums[target + 1] ?? 0) + green;
|
|
1154
|
-
sums[target + 2] = (sums[target + 2] ?? 0) + blue;
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
for (let x = 0; x < width; x += 1) {
|
|
1158
|
-
const count = rows * Math.min(factor, picture.width - x * factor);
|
|
1159
|
-
for (let channel = 0; channel < 3; channel += 1) pixels[(y * width + x) * 3 + channel] = Math.round((sums[x * 3 + channel] ?? 0) / count);
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1133
|
+
const span = Array.from({ length: Math.ceil(Math.min(factor, Math.max(picture.width, picture.height))) }, (_, index) => index);
|
|
1162
1134
|
return {
|
|
1163
1135
|
width,
|
|
1164
1136
|
height,
|
|
1165
|
-
pixels
|
|
1137
|
+
pixels: Uint8Array.from({ length: width * height * 3 }, (_, index) => {
|
|
1138
|
+
const channel = index % 3;
|
|
1139
|
+
const x = Math.floor(index / 3) % width;
|
|
1140
|
+
const y = Math.floor(index / 3 / width);
|
|
1141
|
+
const rows = Math.min(factor, picture.height - y * factor);
|
|
1142
|
+
const columns = Math.min(factor, picture.width - x * factor);
|
|
1143
|
+
const sum = span.reduce((total, row) => {
|
|
1144
|
+
if (row >= rows) return total;
|
|
1145
|
+
const start = (y * factor + row) * picture.width * 3 + x * Math.ceil(factor) * 3 + channel;
|
|
1146
|
+
return span.reduce((block, column) => column >= columns ? block : block + (picture.pixels[start + column * 3] ?? 0), total);
|
|
1147
|
+
}, 0);
|
|
1148
|
+
return Math.round(sum / (rows * columns));
|
|
1149
|
+
})
|
|
1166
1150
|
};
|
|
1167
1151
|
}
|
|
1168
1152
|
/**
|
|
@@ -4084,6 +4068,8 @@ var CapturePreflight = class {
|
|
|
4084
4068
|
* place, so a registry the engine would refuse never replaces a good one. With `--variant`, the
|
|
4085
4069
|
* existing registry's receipts for the other declared variants are kept. It never widens a scoped
|
|
4086
4070
|
* run into a refresh and refuses while another runner holds a request file in the request directory.
|
|
4071
|
+
* Before any stage, it reads the inherited manifest and lookup journal and refuses an unsupported
|
|
4072
|
+
* schema with the file to inspect and repair.
|
|
4087
4073
|
*
|
|
4088
4074
|
* @example
|
|
4089
4075
|
* ```ts
|
|
@@ -4157,10 +4143,12 @@ var CaptureRegistrar = class {
|
|
|
4157
4143
|
});
|
|
4158
4144
|
const target = `${resolveCaptureRelative(root, primary.directory)}/${CAPTURE_REGISTRY_FILE}`;
|
|
4159
4145
|
const candidate = `${target}.${invocation.id}.candidate`;
|
|
4146
|
+
const options = buildCaptureIntegrityOptions(root, primary);
|
|
4160
4147
|
const integrity = new CaptureIntegrity({
|
|
4161
|
-
...
|
|
4148
|
+
...options,
|
|
4162
4149
|
registry: candidate
|
|
4163
4150
|
});
|
|
4151
|
+
this.#inherit(options);
|
|
4164
4152
|
const holders = invocation.holders();
|
|
4165
4153
|
if (holders.length > 0) throw new CaptureError(`Another runner holds this workspace (process ${holders.join(", ")}); the registry refresh starts only while no runner is mid-stage`, {
|
|
4166
4154
|
code: "STAGE",
|
|
@@ -4196,6 +4184,22 @@ var CaptureRegistrar = class {
|
|
|
4196
4184
|
})}\n`);
|
|
4197
4185
|
return CAPTURE_EXIT.passed;
|
|
4198
4186
|
}
|
|
4187
|
+
#inherit(options) {
|
|
4188
|
+
for (const [file, guard] of [[options.manifest, isCaptureStoredManifest], [options.lookups, isCaptureLookupJournal]]) {
|
|
4189
|
+
const path = resolve(options.root, file);
|
|
4190
|
+
try {
|
|
4191
|
+
requireCaptureContained(options.root, path);
|
|
4192
|
+
if (!existsSync(path)) continue;
|
|
4193
|
+
if (!guard(parseJSON(readFileSync(path, "utf8")))) throw new CaptureError("Invalid inherited evidence schema", { code: "EVIDENCE" });
|
|
4194
|
+
} catch (error) {
|
|
4195
|
+
throw new CaptureError(`Cannot refresh the registry with inherited evidence at ${JSON.stringify(file)}: ${describeCaptureError(error)}; inspect and repair this file before retrying`, {
|
|
4196
|
+
code: "EVIDENCE",
|
|
4197
|
+
cause: error,
|
|
4198
|
+
context: { file }
|
|
4199
|
+
});
|
|
4200
|
+
}
|
|
4201
|
+
}
|
|
4202
|
+
}
|
|
4199
4203
|
async #stage(invocation, parsed, projects, primary, variant) {
|
|
4200
4204
|
const { root } = this.#options;
|
|
4201
4205
|
const project = projects.find((candidate) => candidate.variant === variant);
|