rig-review 1.18.0 → 2.1.0
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 -3
- package/docs/DESIGN.md +3 -3
- package/docs/REVIEW_PACKAGE.md +10 -4
- package/docs/STABILITY.md +54 -6
- package/docs/WORKFLOWS.md +162 -38
- package/package.json +2 -1
- package/skills/rig-review/SKILL.md +61 -4
- package/src/build.ts +2 -2
- package/src/cli.ts +57 -2
- package/src/compare-server.ts +48 -10
- package/src/front.ts +1 -1
- package/src/job-api.ts +20 -2
- package/src/job-cli.ts +2 -1
- package/src/job-contract.ts +30 -18
- package/src/job-front.ts +28 -11
- package/src/job-host.ts +4 -0
- package/src/job-session.ts +34 -14
- package/src/job-source.ts +134 -19
- package/src/job-store.ts +21 -3
- package/src/open-workspace-contract.ts +60 -0
- package/src/open-workspace-launch.ts +103 -0
- package/src/open-workspace-state.ts +125 -0
- package/src/open-workspace-worker.ts +33 -0
- package/src/open-workspace.ts +292 -0
- package/src/open.ts +20 -7
- package/src/server.ts +51 -10
- package/web/catalog-en.ts +62 -0
- package/web/catalog-ko.ts +62 -0
- package/web/compare.ts +2 -0
- package/web/main.ts +2 -0
- package/web/owner-workspace.css +14 -0
- package/web/owner-workspace.html +5 -0
- package/web/owner-workspace.ts +124 -0
- package/web/workspace-visibility.ts +21 -0
|
@@ -10,9 +10,65 @@ compatibility: Requires Bun 1.3.0 or later on PATH. The canonical npm package is
|
|
|
10
10
|
Use this to hand separated parts, a rig or a post to a person for inspection,
|
|
11
11
|
or to read back their submitted review.
|
|
12
12
|
|
|
13
|
+
## Open one owner workspace
|
|
14
|
+
|
|
15
|
+
For folder inspections, use **N rigs → one invocation, one owner link**.
|
|
16
|
+
`open` hosts designated targets in one loopback listener-owning process.
|
|
17
|
+
`--animation` supplies the default clip; `--animation-for <index> <name>` overrides
|
|
18
|
+
one 1-based target position. This opens nine rigs with `walk` for `dirB` and
|
|
19
|
+
`idle` for the others.
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
rig-review open dirA dirB dirC dirD dirE dirF dirG dirH dirI \
|
|
23
|
+
--animation idle --animation-for 2 walk --view-only
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Invalid/out-of-range indices and duplicate overrides refuse with
|
|
27
|
+
`OPEN_OPTION_INVALID`. Common typed options retain their per-target validation.
|
|
28
|
+
Single-primary-target `--compare` requires `--reference`; batch compare is refused.
|
|
29
|
+
Compatible repeated calls also register into the same owner list.
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
rig-review open dirA --animation idle --view-only
|
|
33
|
+
rig-review open dirB --animation walk --view-only
|
|
34
|
+
rig-review feedback dirA --animation idle --format json
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Both launchers exit 0 with the same root owner URL and capability within one
|
|
38
|
+
host incarnation, adding no listener or per-rig worker. A consumer opened N rigs
|
|
39
|
+
with N sequential `open` calls. Prefer one batch when the targets are known.
|
|
40
|
+
Give the person the private owner link and one what-to-look-at line.
|
|
41
|
+
View-only entries are labelled **Inspection only**, without semantic acts or
|
|
42
|
+
pending approvals. Existing feedback semantics apply per target. Retain each
|
|
43
|
+
target's original feedback lookup arguments, inspection state, source-bound
|
|
44
|
+
draft and verbatim reviewer words.
|
|
45
|
+
|
|
46
|
+
The workspace admits 32 targets and lazily retains selected frames under that
|
|
47
|
+
same application bound. Target 33 refuses atomically with
|
|
48
|
+
`WORKSPACE_TARGET_LIMIT`. The limit supplies no hardware performance guarantee.
|
|
49
|
+
Reuse requires matching UID, installation, runtime and fingerprint. Restart
|
|
50
|
+
rotates host and target secrets, so run `open` again for a new owner link. Its
|
|
51
|
+
nonsecret `?workspace=<incarnation>` query forces a new document in an existing
|
|
52
|
+
tab; same-host repeated opens retain the identical URL.
|
|
53
|
+
Changed sources become unavailable without rebinding their feedback.
|
|
54
|
+
|
|
55
|
+
The workspace defaults to port 4318, overridden by `RIG_REVIEW_FRONT_PORT`.
|
|
56
|
+
An occupied port refuses `FRONT_PORT_BUSY`; choose an explicit port or use the
|
|
57
|
+
single-target separate-server path
|
|
58
|
+
`rig-review open dirA --direct --animation idle --view-only`.
|
|
59
|
+
Leave existing workers under their owner's control. Follow
|
|
60
|
+
[workspace lifecycle and restart](https://github.com/rig-c/review/blob/main/docs/WORKFLOWS.md#workspace-lifecycle-and-restart)
|
|
61
|
+
for host reuse, live unresponsive PID refusal and aggregate shutdown behavior.
|
|
62
|
+
|
|
63
|
+
Plain foreground multi-target invocation and the embedded semantic-job hub remain
|
|
64
|
+
pending. Core's `rigc review` passes arguments through unchanged. Follow the
|
|
65
|
+
current active-cycle contract below for semantic jobs and trusted callbacks.
|
|
66
|
+
Keep imagery, questions and approvals in the Review UI, using supported commands
|
|
67
|
+
and APIs. Agents never construct internal Review state or human acts.
|
|
68
|
+
|
|
13
69
|
## Active cycle standing live-job contract
|
|
14
70
|
|
|
15
|
-
For the active Create and Parts cycle, the authoritative contract is `src/job-contract.ts` (`JOB_API_SCHEMA` set to `rig-review/job-api@
|
|
71
|
+
For the active Create and Parts cycle, the authoritative contract is `src/job-contract.ts` (`JOB_API_SCHEMA` set to `rig-review/job-api@2`, `JOB_ACT_SCHEMA` set to `rig-review/act@2`, [Review #484](https://github.com/rig-c/review/issues/484)), backed by the implemented backend session/store (`src/job-session.ts`, `src/job-source.ts`, `src/job-act.ts`, `src/job-api.ts`), standing loopback job front and browser window runtime (`src/job-front.ts`, `web/job-session.ts`), and `rig-review session` CLI (`src/entry.ts`, `src/job-cli.ts`). The public installed managed-host entry is `@rig-c/review/job-host` with frozen exports in [Public API stability](https://github.com/rig-c/review/blob/main/docs/STABILITY.md#managed-owner-host), and Create's production publication reader and writer-owned sibling `fetch-act` readback remain pending [Create #184](https://github.com/rig-c/create/issues/184) (publishing a Create root containing `project.json` without a host `readPublished` callback refuses `JOB_SOURCE_UNRETAINABLE` with `CREATE_PUBLICATION_CONTRACT_UNAVAILABLE`). Do not invent public export names, producer scene fields or unimplemented flags, and never expose capabilities in reports or logs. See [Live job contract](https://github.com/rig-c/review/blob/main/docs/REVIEW_PACKAGE.md#live-job-contract) and [Standing live job workflow](https://github.com/rig-c/review/blob/main/docs/WORKFLOWS.md#standing-live-job-workflow).
|
|
16
72
|
|
|
17
73
|
Exact CLI namespace (`src/entry.ts`, `src/job-cli.ts`; `publish`, `ask`, `next`, `close` also accept optional `--request-id <id>`):
|
|
18
74
|
|
|
@@ -52,8 +108,8 @@ rig-review session close http://127.0.0.1:<port>/jobs/<job-id> \
|
|
|
52
108
|
- **Explicit producer-held freeze and explicit close.** Every `publish` carries an explicit producer-held freeze (`freeze.kind` set to `'producer-held'`, `holdId`, `record` as `JobFileIdentity` or `null` for a declared non-Create root) held until acknowledgment as a caller obligation. Review validates retained bytes, detects a moved record and commits local generation CAS. No watched-root or automatic-close guarantee exists, and only explicit `close` ends an active job.
|
|
53
109
|
- **Exact displayed source, cursor replay and draft retention.** `next` (`after` cursor and bounded abortable `waitMs` that never consumes an act) replays complete durable `JobEvent` items (`published`, `pending`, `act`, `closed`). The daemon derives `JobSourceBinding` from validated retained bytes and the page-scoped `displayedNonce` receipt rather than browser-supplied hashes. When a new publication replaces or updates the displayed source, old local drafts remain retained for their original source binding and are flagged without rebinding onto the new publication.
|
|
54
110
|
- **Five enabled act kinds and two reserved disabled kinds.** Enabled kinds are `interview-picks`, `checkpoint`, `parts-verdict`, `review-verdict` and `signoff`. Reserved kinds `described-correction` (awaiting the joint [Create #182](https://github.com/rig-c/create/issues/182) context allowlist) and `mesh-edit` (awaiting the joint [Parts #1159](https://github.com/rig-c/parts/issues/1159) freeze) stay disabled (`JOB_ACT_KIND_DISABLED`) and cannot be asked or submitted.
|
|
55
|
-
- **Checkpoints, signoffs, plan steps and parts PNGs.** Finalized `checkpoint` acts carry `outcome` `'pass'` or `'fail'` only (`'pending'` stays in the UI draft), require `words` as a string preserved verbatim including empty or whitespace-only text, copy `planStepId` from the validated ask on the daemon while the browser sends `checkpointId`, `outcome` and `words` only, and leave stage derivation to Create (only `'pass'` is eligible for Create's checkpoint sign-off writer). Finalized `signoff` acts carry `decision` `'approved'` only with required `words` preserved verbatim including empty or whitespace-only text, remain separate from verdicts and Create stage transitions, and require `source.plan` with exact displayed step IDs and hashes published by [Create #184](https://github.com/rig-c/create/issues/184) (without Review recomputing `stepHash`) on `plan-approved`, `rigging-interview` and `post-interview`.
|
|
56
|
-
- **No agent file carriage, writer-owned sibling fetch and public host seam.** Agents never build, parse, reshape or carry Review session, picks, verdict or applied-record storage files. [Create #182](https://github.com/rig-c/create/issues/182) and [Create #184](https://github.com/rig-c/create/issues/184) own direct writer publication and `fetch-act` reads using a private writer-owned sibling binding outside `project.json` (`writer-owned-sibling-fetch-capability`, pending Create #184 production reader/writer integration) that is never tracked in version control or unstaged project output, dies at explicit `close` and receives a new grant on each job incarnation. In the public managed-host startup seam (`startJobHost` from `@rig-c/review/job-host`, frozen in [Public API stability](https://github.com/rig-c/review/blob/main/docs/STABILITY.md#managed-owner-host)), hook-bearing host callers declare `readerId` and `
|
|
111
|
+
- **Checkpoints, signoffs, plan steps and parts PNGs.** Finalized `checkpoint` acts carry `outcome` `'pass'` or `'fail'` only (`'pending'` stays in the UI draft), require `words` as a string preserved verbatim including empty or whitespace-only text, copy `planStepId` from the validated ask on the daemon while the browser sends `checkpointId`, `outcome` and `words` only, and leave stage derivation to Create (only `'pass'` is eligible for Create's checkpoint sign-off writer). Finalized `signoff` acts carry `decision` `'approved'` only with required `words` preserved verbatim including empty or whitespace-only text, remain separate from verdicts and Create stage transitions, and require `source.plan` with exact displayed step IDs and hashes published by [Create #184](https://github.com/rig-c/create/issues/184) (without Review recomputing `stepHash`) on `plan-approved`, `rigging-interview` and `post-interview`. C4 binds the exact public `partsFileReferences(dir)` array from `@rig-c/parts/src/parts.ts`, whose contract is frozen at Parts 2.25.0. The trusted host resolves an installed version in `JOB_PARTS_ENUMERATOR_RANGE` (`>=2.25.0 <3.0.0`), supplies its actual version and official callback through `partsEnumerator`, and declares `partsEnumeratorId`. `JobPartsIdentity.enumeratorVersion` carries that actual version. Manifest paths are work-root-relative and image paths are relative to the manifest directory. Each image carries `path`, bounded-string `role` and raw-byte `sha256`. Review compares the claimed array positionally with the official array, preserving its role/order/duplicate semantics. Upstream roles include `part`, `alternate`, `depth`, `painting` and `figure_mask`. Review bounds shape and paths, refuses traversal/symlinks, decodes PNGs and hashes retained bytes. Missing references refuse with row, role and path, including a missing sibling figure mask when a render copy exists. Unreferenced extras stay outside this parts identity. Composite source hashes use `rig-review-job-source/2`. Create #184 production reader/projection and official-hook wiring remain pending.
|
|
112
|
+
- **No agent file carriage, writer-owned sibling fetch and public host seam.** Agents never build, parse, reshape or carry Review session, picks, verdict or applied-record storage files. [Create #182](https://github.com/rig-c/create/issues/182) and [Create #184](https://github.com/rig-c/create/issues/184) own direct writer publication and `fetch-act` reads using a private writer-owned sibling binding outside `project.json` (`writer-owned-sibling-fetch-capability`, pending Create #184 production reader/writer integration) that is never tracked in version control or unstaged project output, dies at explicit `close` and receives a new grant on each job incarnation. In the public managed-host startup seam (`startJobHost` from `@rig-c/review/job-host`, frozen in [Public API stability](https://github.com/rig-c/review/blob/main/docs/STABILITY.md#managed-owner-host)), hook-bearing host callers declare `readerId`, `bindingId` and `partsEnumeratorId`; equality plus API/act schemas and actual enumerator version govern authenticated active-listener reuse and missing or mismatched IDs refuse by name (`JOB_HOST_OPTION_ID_INVALID`, `JOB_HOST_REUSE_MISMATCH`) with no function hashes. Future mesh acts will be fetched by Create and passed in process to Parts' public exported API owned by [Parts #1159](https://github.com/rig-c/parts/issues/1159) without Parts reading Review or Create storage, while standalone `--delta` remains legacy outside this cycle.
|
|
57
113
|
- **Direction metadata vs playback.** Direction carriage in `#484` is metadata-only (`source.direction` and `direction-review`) and is distinct from [Review #482](https://github.com/rig-c/review/issues/482) preview and [Review #483](https://github.com/rig-c/review/issues/483) actual plated take playback, while [Review #373](https://github.com/rig-c/review/issues/373) stays parked.
|
|
58
114
|
|
|
59
115
|
## What an agent drives vs. what the person drives
|
|
@@ -63,7 +119,8 @@ The one-shot CLI file-handoff instructions in this section and in Correction rea
|
|
|
63
119
|
Use the installed CLI. For compiled packages, run `rig-review check <package>`
|
|
64
120
|
before handoff to validate the package and read its source SHA-256. Use managed
|
|
65
121
|
`rig-review open` for joined inspection and embedded saves. Give the reviewer
|
|
66
|
-
its URL from stdout privately and keep the
|
|
122
|
+
its URL from stdout privately and keep the original per-target feedback lookup
|
|
123
|
+
arguments. The direct-server path also prints a copyable feedback command on stderr.
|
|
67
124
|
The stage buttons navigate within that source binding.
|
|
68
125
|
|
|
69
126
|
1. **Parts + mesh.** Open the recorded Create draft's compiled check directory.
|
package/src/build.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { fileURLToPath } from 'node:url';
|
|
2
2
|
export const appRoot=fileURLToPath(new URL('..',import.meta.url));
|
|
3
|
-
export async function buildWeb(mode:'single'|'compare'|'parts'|'interview'='single'):Promise<Blob> {
|
|
4
|
-
const result=await Bun.build({entrypoints:[appRoot+(mode==='compare'?'web/compare.ts':mode==='parts'?'web/parts.ts':mode==='interview'?'web/interview.ts':'web/main.ts')],target:'browser',format:'esm',minify:false});
|
|
3
|
+
export async function buildWeb(mode:'single'|'compare'|'parts'|'interview'|'workspace'='single'):Promise<Blob> {
|
|
4
|
+
const result=await Bun.build({entrypoints:[appRoot+(mode==='workspace'?'web/owner-workspace.ts':mode==='compare'?'web/compare.ts':mode==='parts'?'web/parts.ts':mode==='interview'?'web/interview.ts':'web/main.ts')],target:'browser',format:'esm',minify:false});
|
|
5
5
|
if(!result.success)throw new Error(result.logs.map(v=>v.message).join('\n'));
|
|
6
6
|
const output=result.outputs.find(v=>v.path.endsWith('.js'));if(!output)throw new Error('frontend bundle: JavaScript output missing');return output;
|
|
7
7
|
}
|
package/src/cli.ts
CHANGED
|
@@ -25,7 +25,7 @@ import { readCompareSession } from './compare-session.ts';
|
|
|
25
25
|
import { exportReviewStrip, exportCompareStrip, stripJson, writeStripOutput, validateStripOutput } from './strip-export.ts';
|
|
26
26
|
import type { StripInterval, StripRequest } from './strip.ts';
|
|
27
27
|
const handoffUsage='[--config <path> [--parts <dir>] [--source <png> --full <dir> [--head <dir>]] [--keypoints <file>]]';
|
|
28
|
-
const usage='Usage: rig-review open <dir> [--reference <video>] [--compare <dir>] [--animation <name>] [--control] [--direct] [--view-only] [--project <create-root> (--project-version <rig> [--post-version <post>] | --project-draft <id> [--parts-verdict-dir <dir>]) --picks-dir <dir>] '+handoffUsage+'\n --config declares the producer handoff (wins over the review.json "producer" block and discovery of config.json, rig/config.json, ../config.json beside an opened out/); feedback and control take the same flags; --view-only opens without a producer handoff.\n open is managed by default: one
|
|
28
|
+
const usage='Usage: rig-review open <dir> [<dir> ...] [--animation-for <index> <name>] [--reference <video>] [--compare <dir>] [--animation <name>] [--control] [--direct] [--view-only] [--project <create-root> (--project-version <rig> [--post-version <post>] | --project-draft <id> [--parts-verdict-dir <dir>]) --picks-dir <dir>] '+handoffUsage+'\n --config declares the producer handoff (wins over the review.json "producer" block and discovery of config.json, rig/config.json, ../config.json beside an opened out/); feedback and control take the same flags; --view-only opens without a producer handoff.\n open is managed by default: one owner workspace at 127.0.0.1:4318 (RIG_REVIEW_FRONT_PORT overrides) hosts targets in one process; --animation applies to all targets, --animation-for overrides one 1-based target, and --direct keeps a separate single-target worker.\n rig-review control <dir> [--reference <video>] [--compare <dir>] [--animation <name>] '+handoffUsage+' [--project <create-root> --project-version <rig> --picks-dir <dir> [--post-version <post>]] [--page <id> --expected-revision <n> --command <JSON> --wait-ms <n>]\n rig-review feedback <dir> [--reference <video>] [--compare <dir>] [--animation <name>] '+handoffUsage+' [--project <create-root> --project-version <rig> --picks-dir <dir> [--post-version <post>]] [--format json|issue] [--correction <item id>]\n Usage: bun run review -- <review.json|output-directory> [--port 4317] [--checkpoint ID] [--view-only]\n bun run check -- <review.json|output-directory>\n bun run feedback -- <review.json|output-directory>\n bun run review -- compare <a> <b> --reference <video> --animation <name> [--port 4317]\n bun run check -- compare <a> <b> --reference <video> --animation <name>\n bun run feedback -- compare <a> <b> --reference <video> --animation <name>\n rig-review parts <build root | parts dir | review package> [--rig <file>] [--mesh-report <file>] [--check <file>] [--verdict <file>] [--painting <png>] [--format json|issue] [--correction <item id> --parts-file <inventory> [--part-note <part>]] [--port <n>]\n rig-review interview <create-root> --picks-dir <project-relative directory> [--port <n>]\n rig-review --version';
|
|
29
29
|
async function stripCommand(args:string[],options:{stateDir?:string}){
|
|
30
30
|
const compare=args[0]==='compare';if(compare)args.shift();const a=args.shift(),b=compare?args.shift():undefined;if(!a||compare&&!b)throw new Error('strip: expected package input(s)');
|
|
31
31
|
let reference:string|undefined,referenceVideo:string|undefined,animation:string|undefined,basis:'a'|'b'|undefined,range:string|undefined,output:string|undefined,jsonOnly=false,all=false;
|
|
@@ -70,6 +70,50 @@ export function parseOpenInputs(args:string[]):OpenInputs {
|
|
|
70
70
|
if(result.compare!==undefined&&handoffFlags(result))throw new Error('OPEN_OPTION_INVALID --config: compare takes no producer handoff; open one package with --config');
|
|
71
71
|
return result;
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
/** Common open options apply to every operand; indexed animation values override the common default. */
|
|
75
|
+
export function parseOpenTargets(args: readonly string[]): OpenInputs[] {
|
|
76
|
+
const inputs: string[] = [];
|
|
77
|
+
const common: string[] = [];
|
|
78
|
+
const animations = new Map<number, string>();
|
|
79
|
+
const booleanFlags = ['--control', '--direct', '--view-only'];
|
|
80
|
+
const valueFlags = ['--reference', '--compare', '--animation', ...projectFlags, ...HANDOFF_FLAGS.map(flag => '--' + flag)];
|
|
81
|
+
for (let index = 0; index < args.length; index++) {
|
|
82
|
+
const flag = args[index]!;
|
|
83
|
+
if (flag === '--animation-for') {
|
|
84
|
+
const target = args[++index], animation = args[++index];
|
|
85
|
+
if (target === undefined || !/^[1-9]\d*$/.test(target) || !Number.isSafeInteger(Number(target)) || animation === undefined || animation === '') {
|
|
86
|
+
throw new Error('OPEN_OPTION_INVALID --animation-for: expected a positive target index and animation name');
|
|
87
|
+
}
|
|
88
|
+
const targetIndex = Number(target);
|
|
89
|
+
if (animations.has(targetIndex)) throw new Error(`OPEN_OPTION_INVALID --animation-for: duplicate target index ${target}`);
|
|
90
|
+
animations.set(targetIndex, animation);
|
|
91
|
+
} else if (booleanFlags.includes(flag)) {
|
|
92
|
+
common.push(flag);
|
|
93
|
+
} else if (valueFlags.includes(flag)) {
|
|
94
|
+
const value = args[++index];
|
|
95
|
+
if (value === undefined || value === '') throw new Error(`OPEN_OPTION_INVALID ${flag}: Missing value for ${flag}`);
|
|
96
|
+
common.push(flag, value);
|
|
97
|
+
} else if (flag.startsWith('--')) {
|
|
98
|
+
throw new Error(`OPEN_OPTION_INVALID ${flag}: Unknown open option ${flag}`);
|
|
99
|
+
} else {
|
|
100
|
+
inputs.push(flag);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (inputs.length === 0) throw new Error(usage);
|
|
104
|
+
for (const target of animations.keys()) {
|
|
105
|
+
if (target > inputs.length) throw new Error(`OPEN_OPTION_INVALID --animation-for: target index ${target} exceeds ${inputs.length} input(s)`);
|
|
106
|
+
}
|
|
107
|
+
const targets = inputs.map(input => parseOpenInputs([input, ...common]));
|
|
108
|
+
if (targets.length > 1 && targets.some(target => target.compare !== undefined)) {
|
|
109
|
+
throw new Error('OPEN_OPTION_INVALID --compare: multi-target open requires exactly one primary input for comparison');
|
|
110
|
+
}
|
|
111
|
+
if (targets.length > 1 && targets.some(target => target.direct)) {
|
|
112
|
+
throw new Error('OPEN_OPTION_INVALID --direct: multi-target open requires the managed owner workspace');
|
|
113
|
+
}
|
|
114
|
+
for (const [index, animation] of animations) targets[index - 1]!.animation = animation;
|
|
115
|
+
return targets;
|
|
116
|
+
}
|
|
73
117
|
async function controlCommand(args:string[],stateDir?:string){
|
|
74
118
|
const input=args.shift();if(!input||input==='--help'||input==='-h'){console.log(usage);return;}
|
|
75
119
|
const inputs:OpenInputs={input},options:Parameters<typeof controlReview>[1]={stateDir},seen=new Set<string>(),projectOptions:string[]=[];
|
|
@@ -117,6 +161,8 @@ function commandHelpRequested(args:readonly string[],command:'open'|'review'|'ch
|
|
|
117
161
|
const handoff=HANDOFF_FLAGS.map(f=>'--'+f),flags=command==='open'?['--reference','--compare','--animation',...projectFlags,...handoff]:compare?['--reference','--animation','--port']:['--port','--checkpoint','--reference','--compare','--animation',...handoff,...(command==='feedback'?projectFlags:[])];
|
|
118
162
|
for(let i=compare?3:1;i<args.length;){
|
|
119
163
|
const flag=args[i];if(flag==='--help'||flag==='-h')return true;
|
|
164
|
+
if(command==='open'&&flag==='--animation-for'){i+=3;continue;}
|
|
165
|
+
if(command==='open'&&!flag?.startsWith('--')){i++;continue;}
|
|
120
166
|
if((command==='open'&&(flag==='--control'||flag==='--direct'||flag==='--view-only'))||(command==='review'&&flag==='--view-only')){i++;continue;}if(!flags.includes(flag!))return false;i+=2;
|
|
121
167
|
}
|
|
122
168
|
return false;
|
|
@@ -152,7 +198,16 @@ export async function main(args:string[],options:{stateDir?:string}={}){
|
|
|
152
198
|
options={stateDir:options.stateDir??defaultStateDir()};if(args[0]==='--')args.shift();
|
|
153
199
|
if(args[0]==='--version'||args[0]==='-v'){console.log((JSON.parse(await readFile(new URL('../package.json',import.meta.url),'utf8')) as {version:string}).version);return;}
|
|
154
200
|
if(args[0]==='control')return controlCommand(args.slice(1),options.stateDir);
|
|
155
|
-
if(args[0]==='open'){const openArgs=args.slice(1);if(commandHelpRequested(openArgs,'open')){console.log(usage);return;}const
|
|
201
|
+
if(args[0]==='open'){const openArgs=args.slice(1);if(commandHelpRequested(openArgs,'open')){console.log(usage);return;}const targets=parseOpenTargets(openArgs);
|
|
202
|
+
if(!targets[0]?.direct){
|
|
203
|
+
const {openWorkspace}=await import('./open-workspace-launch.ts');
|
|
204
|
+
const result=await openWorkspace(targets,options);
|
|
205
|
+
console.log(result.url);
|
|
206
|
+
for(const target of result.prepared){if(target.build)console.error(buildOpenDiagnostic(target.build));if(target.package.selection)console.error(animationDiagnostic(target.package.selection));}
|
|
207
|
+
console.error(`Review workspace ${result.reused?'reused':'started'}; ${targets.length} target(s). Retrieve feedback using the original input designation.`);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const inputs=targets[0]!;const result=await openReview(inputs,options);// Launcher contract (README): stdout is the URL line alone; stderr is diagnostic, control notice, retrieval, in that order.
|
|
156
211
|
console.log(result.url);if(result.build)console.error(buildOpenDiagnostic(result.build));if(result.selection)console.error(animationDiagnostic(result.selection));if(inputs.control)console.error('Inspection control enabled; query the current connected page with rig-review control and the same inputs.');console.error(`Review ${result.reused?'reused':'started'}; feedback: rig-review feedback ${[result.inputs.input,...(result.inputs.compare?['--compare',result.inputs.compare]:[]),...(result.inputs.reference?['--reference',result.inputs.reference]:[]),...(result.inputs.animation?['--animation',result.inputs.animation]:[]),...handoffWords(result.inputs),...projectWords(result.inputs)].map(shellWord).join(' ')}`);return;}
|
|
157
212
|
if(args[0]==='parts')return partsCommand(args.slice(1));
|
|
158
213
|
if(args[0]==='interview')return (await import('./interview-server.ts')).interviewCommand(args.slice(1));
|
package/src/compare-server.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { createRequirementsCheck } from './requirements-run.ts';
|
|
|
20
20
|
import { REQUIREMENTS_LIMIT, RequirementsError } from './requirements.ts';
|
|
21
21
|
import { createEnvironmentCheck, ENVIRONMENT_CHECK_LIMIT, EnvironmentCheckError } from './environment-check.ts';
|
|
22
22
|
import { renderCompareHtml } from './compare-html.ts';
|
|
23
|
-
import { createLiveLifecycle, LIVE_PATH, type LiveExitInfo, type UpgradableServer } from './live-lifecycle.ts';
|
|
23
|
+
import { createLiveLifecycle, LIVE_PATH, type LiveExitInfo, type LiveLifecycle, type UpgradableServer } from './live-lifecycle.ts';
|
|
24
24
|
|
|
25
25
|
const headers={'X-Content-Type-Options':'nosniff','Cache-Control':'no-store','Content-Security-Policy':"default-src 'none'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' blob: data:; media-src 'self'; frame-src 'self'; connect-src 'self'; font-src 'self'; base-uri 'none'; frame-ancestors 'none'; form-action 'none'",'Referrer-Policy':'no-referrer'};
|
|
26
26
|
const MALFORMED=new Set(['REBUILD_REQUEST_INVALID','DENSITY_STRIP_REQUEST_INVALID','DENSITY_STRIP_FIELD','MESH_PATCH_SCOPE','EDIT_PATCH_INVALID','EDIT_PATCH_OP_UNKNOWN','EDIT_PATCH_POINTER_INVALID','EDIT_PATCH_CMD_UNKNOWN','EDIT_PATCH_ARG_UNKNOWN','BONES_OP_OUT_OF_SCOPE','RETARGET_REQUEST_INVALID']);
|
|
@@ -43,9 +43,32 @@ function serveAsset(req:Request,path:string):Response{
|
|
|
43
43
|
return new Response(req.method==='HEAD'?null:file,{headers:{...assetHeaders,'Content-Length':String(size)}});
|
|
44
44
|
}
|
|
45
45
|
/** `capability` (open workers and foreground CLI serving) gates every non-GET request; tests may omit it. */
|
|
46
|
-
export
|
|
46
|
+
export interface CompareServerOptions {
|
|
47
|
+
port?: number;
|
|
48
|
+
stateDir?: string;
|
|
49
|
+
open?: OpenIdentity;
|
|
50
|
+
activity?: () => void;
|
|
51
|
+
control?: ControlIdentity;
|
|
52
|
+
capability?: string;
|
|
53
|
+
cwd?: string;
|
|
54
|
+
stripConcurrency?: number;
|
|
55
|
+
graceMs?: number;
|
|
56
|
+
unopenedTimeoutMs?: number;
|
|
57
|
+
exitOnClose?: boolean;
|
|
58
|
+
onClose?: (info: LiveExitInfo) => void | Promise<void>;
|
|
59
|
+
log?: (line: string) => void;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface CompareRequestContextOptions extends CompareServerOptions {
|
|
63
|
+
lifecycle?: LiveLifecycle;
|
|
64
|
+
bundle?: Blob;
|
|
65
|
+
stopServer?: () => void | Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Comparison-scoped routes without a listener. An injected lifecycle belongs to its caller. */
|
|
69
|
+
export async function createCompareRequestContext(p: ComparePackage, options: CompareRequestContextOptions = {}) {
|
|
47
70
|
const stageParts=stagePartsRoutes({a:p.a,b:p.b});
|
|
48
|
-
const bundle=await buildWeb('compare');
|
|
71
|
+
const bundle=options.bundle??await buildWeb('compare');
|
|
49
72
|
const frames=referenceFrameIndex(p.referencePath,p.response.binding.reference.sha256,p.response.sourceHash);
|
|
50
73
|
const stateDir=options.stateDir??process.env.RIG_REVIEW_STATE_DIR??join(homedir(),'.local','state','rig-c-review');
|
|
51
74
|
const makeSideTools=(side:'a'|'b',pkg:ReviewPackage)=>{
|
|
@@ -59,16 +82,17 @@ export async function startCompareServer(p:ComparePackage,options:{port?:number;
|
|
|
59
82
|
};
|
|
60
83
|
const sideTools={a:makeSideTools('a',p.a),b:makeSideTools('b',p.b)};
|
|
61
84
|
const control=options.control?createControlServer({identity:options.control,sourceHash:p.response.sourceHash,mode:'compare',unchanged:()=>assertCompareUnchanged(p),activity:options.activity}):null;
|
|
62
|
-
|
|
63
|
-
const
|
|
85
|
+
const busy=()=>sideTools.a.busy()||sideTools.b.busy();
|
|
86
|
+
const ownsLifecycle=options.lifecycle===undefined;
|
|
87
|
+
const live=options.lifecycle??createLiveLifecycle({
|
|
64
88
|
label:'review compare',
|
|
65
89
|
graceMs:options.graceMs,
|
|
66
90
|
unopenedTimeoutMs:options.unopenedTimeoutMs,
|
|
67
91
|
exitOnClose:options.exitOnClose,
|
|
68
92
|
onClose:options.onClose,
|
|
69
93
|
log:options.log,
|
|
70
|
-
busy
|
|
71
|
-
stopServer:
|
|
94
|
+
busy,
|
|
95
|
+
stopServer:options.stopServer,
|
|
72
96
|
});
|
|
73
97
|
const handle=async(req:Request,port:number|undefined,srv:UpgradableServer):Promise<Response|undefined>=>{try{
|
|
74
98
|
const url=new URL(req.url),origin=`http://127.0.0.1:${port}`;
|
|
@@ -174,8 +198,22 @@ export async function startCompareServer(p:ComparePackage,options:{port?:number;
|
|
|
174
198
|
return json({error:'Not found'},404);
|
|
175
199
|
} finally { live.onRequestEnd(url.pathname); }
|
|
176
200
|
}catch(e){const message=e instanceof Error?e.message:'Request failed';return json({error:message},message.includes('inputs changed')?409:400);}};
|
|
177
|
-
|
|
201
|
+
return {
|
|
202
|
+
live,
|
|
203
|
+
busy,
|
|
204
|
+
async handle(req: Request, port: number | undefined, srv: UpgradableServer): Promise<Response | undefined> {
|
|
205
|
+
const response=await handle(req,port,srv);
|
|
206
|
+
return response?stampOpen(req,response,options.open):undefined;
|
|
207
|
+
},
|
|
208
|
+
stop() { if(ownsLifecycle)live.stop(); },
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export async function startCompareServer(p: ComparePackage, options: CompareServerOptions = {}) {
|
|
213
|
+
let rawStop:((closeActiveConnections?:boolean)=>void)|null=null;
|
|
214
|
+
const context=await createCompareRequestContext(p,{...options,stopServer:()=>{rawStop?.(true);}});
|
|
215
|
+
const server=Bun.serve({hostname:'127.0.0.1',port:options.port??4317,websocket:context.live.websocket,async fetch(req,srv){return await context.handle(req,srv.port,srv) as Response;}});
|
|
178
216
|
rawStop=server.stop.bind(server);
|
|
179
|
-
server.stop=((closeActiveConnections?:boolean)=>{
|
|
180
|
-
return Object.assign(server,{live});
|
|
217
|
+
server.stop=((closeActiveConnections?:boolean)=>{context.stop();return rawStop!(closeActiveConnections);}) as typeof server.stop;
|
|
218
|
+
return Object.assign(server,{live:context.live});
|
|
181
219
|
}
|
package/src/front.ts
CHANGED
|
@@ -90,7 +90,7 @@ export function frontRoute(mode:'single'|'compare',method:string,path:string):Ro
|
|
|
90
90
|
if(/^\/api\/environment-check\/[a-f0-9]{64}$/.test(toolPath))return read?get:null;
|
|
91
91
|
return null;
|
|
92
92
|
}
|
|
93
|
-
async function boundedBody(req:Request,limit:number,timeoutMs=10000):Promise<ArrayBuffer>{
|
|
93
|
+
export async function boundedBody(req:Request,limit:number,timeoutMs=10000):Promise<ArrayBuffer>{
|
|
94
94
|
if(!/^application\/json(?:\s*;|$)/i.test(req.headers.get('content-type')??''))throw new Error('FRONT_JSON_REQUIRED');
|
|
95
95
|
const declared=req.headers.get('content-length');if(declared!==null&&(!/^\d+$/.test(declared)||Number(declared)>limit))throw new Error('FRONT_BODY_LIMIT');
|
|
96
96
|
if(!req.body)throw new Error('FRONT_JSON_REQUIRED');const reader=req.body.getReader();let timer:ReturnType<typeof setTimeout>|undefined;
|
package/src/job-api.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash, timingSafeEqual } from 'node:crypto';
|
|
2
2
|
import {
|
|
3
|
-
JOB_API_SCHEMA, JOB_ENABLED_ACT_KINDS, JOB_RESERVED_ACT_KINDS,
|
|
3
|
+
JOB_API_SCHEMA, JOB_PARTS_ENUMERATOR_RANGE, JOB_ENABLED_ACT_KINDS, JOB_RESERVED_ACT_KINDS,
|
|
4
4
|
type JobAgentRequest, type JobDisplayAcknowledgment, type JobFetchActRequest,
|
|
5
5
|
type JobHostPorts, type JobResult, type JobSelector, type JobSubject,
|
|
6
6
|
} from './job-contract.ts';
|
|
@@ -123,12 +123,30 @@ export function parseJobSubject(value: unknown): JobSubject {
|
|
|
123
123
|
throw new JobError('JOB_ASK_INVALID');
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
/** Preserve the installed version while enforcing the jointly accepted range. */
|
|
127
|
+
export function jobPartsEnumeratorVersion(value: unknown): string {
|
|
128
|
+
const bounded = typeof value === 'string' && value.length > 0 && value.length <= 128 &&
|
|
129
|
+
!/[\x00-\x20\x7f]/.test(value);
|
|
130
|
+
if (!bounded || !Bun.semver.satisfies(value, JOB_PARTS_ENUMERATOR_RANGE)) {
|
|
131
|
+
const received = bounded ? JSON.stringify(value) : '<missing-or-invalid>';
|
|
132
|
+
throw new JobError('JOB_SOURCE_UNRETAINABLE',
|
|
133
|
+
`PARTS_ENUMERATOR_VERSION_MISMATCH range="${JOB_PARTS_ENUMERATOR_RANGE}" received=${received}`);
|
|
134
|
+
}
|
|
135
|
+
return value;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function assertJobApiSchema(value: unknown): void {
|
|
139
|
+
if (value !== JOB_API_SCHEMA) {
|
|
140
|
+
throw new JobError('JOB_REQUEST_INVALID', 'JOB_API_SCHEMA_MISMATCH');
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
126
144
|
export function parseJobRequest(value: unknown): JobAgentRequest | JobFetchActRequest {
|
|
127
145
|
const item = jobObject(value, [
|
|
128
146
|
'schema', 'jobId', 'requestId', 'verb', 'expectedGeneration', 'idempotencyKey',
|
|
129
147
|
'result', 'freeze', 'publicationId', 'subject', 'after', 'waitMs', 'reason', 'actId',
|
|
130
148
|
]);
|
|
131
|
-
|
|
149
|
+
assertJobApiSchema(item.schema);
|
|
132
150
|
const base = { schema: JOB_API_SCHEMA, jobId: jobId(item.jobId), requestId: jobId(item.requestId) };
|
|
133
151
|
if (item.verb === 'next') {
|
|
134
152
|
jobObject(item, ['schema', 'jobId', 'requestId', 'verb', 'after', 'waitMs']);
|
package/src/job-cli.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
2
|
import { JOB_API_SCHEMA, type JobAgentRequest } from './job-contract.ts';
|
|
3
|
-
import { jobFailure, parseJobRequest } from './job-api.ts';
|
|
3
|
+
import { assertJobApiSchema, jobFailure, parseJobRequest } from './job-api.ts';
|
|
4
4
|
import { JobError } from './job-store.ts';
|
|
5
5
|
|
|
6
6
|
export interface JobCLIOptions {
|
|
@@ -108,6 +108,7 @@ export async function jobCommand(args: readonly string[], options: JobCLIOptions
|
|
|
108
108
|
let value: unknown;
|
|
109
109
|
try { value = JSON.parse(new TextDecoder('utf-8', { fatal: true }).decode(bytes)); }
|
|
110
110
|
catch { throw new JobError('JOB_REQUEST_INVALID'); }
|
|
111
|
+
assertJobApiSchema(value !== null && typeof value === 'object' ? (value as { schema?: unknown }).schema : undefined);
|
|
111
112
|
write(JSON.stringify(value));
|
|
112
113
|
if (!response.ok) process.exitCode = 1;
|
|
113
114
|
}
|
package/src/job-contract.ts
CHANGED
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
* Only explicit close ends an active job. Direction carriage is metadata-only.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
export const JOB_API_SCHEMA = 'rig-review/job-api@
|
|
15
|
-
export const JOB_ACT_SCHEMA = 'rig-review/act@
|
|
14
|
+
export const JOB_API_SCHEMA = 'rig-review/job-api@2' as const;
|
|
15
|
+
export const JOB_ACT_SCHEMA = 'rig-review/act@2' as const;
|
|
16
|
+
export const JOB_PARTS_ENUMERATOR_RANGE = '>=2.25.0 <3.0.0' as const;
|
|
16
17
|
|
|
17
18
|
export const JOB_ENABLED_ACT_KINDS = [
|
|
18
19
|
'interview-picks',
|
|
@@ -76,30 +77,41 @@ export interface JobPlanIdentity {
|
|
|
76
77
|
readonly steps: readonly JobPlanStepIdentity[];
|
|
77
78
|
}
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
export type
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
|
|
80
|
+
/** Literal work-root-relative manifest path, validated at runtime. */
|
|
81
|
+
export type JobPartsManifestPath = string;
|
|
82
|
+
/** Literal path relative to the bound manifest directory. */
|
|
83
|
+
export type JobPartImagePath = string;
|
|
84
|
+
/** Bounded string only. Parts owns role membership, order and duplicate rules. */
|
|
85
|
+
export type JobPartsRole = string;
|
|
86
|
+
|
|
87
|
+
export interface JobPartsFileReference {
|
|
88
|
+
readonly path: JobPartImagePath;
|
|
89
|
+
readonly role: JobPartsRole;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Trusted host wires the official partsFileReferences export from its actual
|
|
93
|
+
* installed @rig-c/parts/src/parts.ts and checks that installation's version.
|
|
94
|
+
* A version claim alone does not authenticate a substituted callback.
|
|
95
|
+
*/
|
|
96
|
+
export interface JobPartsEnumerator {
|
|
97
|
+
readonly version: string;
|
|
98
|
+
readonly enumerate: (dir: string) => readonly JobPartsFileReference[];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** Exact official enumeration, preserved positionally with roles and raw-byte
|
|
102
|
+
* hashes. Manifest provenance is work-root-relative. Image paths are relative
|
|
103
|
+
* to its directory. enumeratorVersion is the actual installed Parts version
|
|
104
|
+
* within JOB_PARTS_ENUMERATOR_RANGE. Unreferenced extras are outside identity.
|
|
95
105
|
*/
|
|
96
106
|
export interface JobPartsIdentity {
|
|
107
|
+
readonly enumeratorVersion: string;
|
|
97
108
|
readonly manifest: {
|
|
98
109
|
readonly path: JobPartsManifestPath;
|
|
99
110
|
readonly sha256: JobSha256;
|
|
100
111
|
};
|
|
101
112
|
readonly images: readonly {
|
|
102
113
|
readonly path: JobPartImagePath;
|
|
114
|
+
readonly role: JobPartsRole;
|
|
103
115
|
readonly sha256: JobSha256;
|
|
104
116
|
}[];
|
|
105
117
|
}
|
package/src/job-front.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Disjoint live-job routes. The backend receives the original authenticated Request. */
|
|
2
|
-
import type
|
|
2
|
+
import { JOB_API_SCHEMA, JOB_ACT_SCHEMA, type JobErrorCode, type JobHostPorts, type JobResult } from './job-contract.ts';
|
|
3
3
|
import { createJobHostPorts } from './job-api.ts';
|
|
4
4
|
import { JobSession } from './job-session.ts';
|
|
5
5
|
import type { JobWorkerOptions } from './job-worker.ts';
|
|
@@ -276,6 +276,10 @@ function retainedPublicationRoutes(session: JobSession) {
|
|
|
276
276
|
|
|
277
277
|
interface JobHostRecord {
|
|
278
278
|
schema: 'rig-review-job-host/1';
|
|
279
|
+
apiSchema: typeof JOB_API_SCHEMA;
|
|
280
|
+
actSchema: typeof JOB_ACT_SCHEMA;
|
|
281
|
+
partsEnumeratorId: string | null;
|
|
282
|
+
partsEnumeratorVersion: string | null;
|
|
279
283
|
jobId: string;
|
|
280
284
|
origin: string;
|
|
281
285
|
fingerprint: string;
|
|
@@ -289,9 +293,11 @@ interface JobHostRecord {
|
|
|
289
293
|
export interface JobHostOptions extends JobWorkerOptions {
|
|
290
294
|
readonly readerId?: string;
|
|
291
295
|
readonly bindingId?: string;
|
|
296
|
+
readonly partsEnumeratorId?: string;
|
|
292
297
|
}
|
|
293
298
|
|
|
294
|
-
type JobHostOptionName = 'readPublished' | 'installWriterBinding'
|
|
299
|
+
type JobHostOptionName = 'readPublished' | 'installWriterBinding' | 'partsEnumerator' |
|
|
300
|
+
'partsEnumeratorVersion' | 'apiSchema' | 'actSchema';
|
|
295
301
|
|
|
296
302
|
class JobHostOptionError extends Error {
|
|
297
303
|
constructor(
|
|
@@ -329,6 +335,8 @@ export async function startJobHost(options: JobHostOptions): Promise<JobOwnerHos
|
|
|
329
335
|
const startup = {...options};
|
|
330
336
|
const readerId = declaredHostId('readPublished', startup.readPublished, startup.readerId);
|
|
331
337
|
const bindingId = declaredHostId('installWriterBinding', startup.installWriterBinding, startup.bindingId);
|
|
338
|
+
const partsEnumeratorId = declaredHostId('partsEnumerator', startup.partsEnumerator?.enumerate, startup.partsEnumeratorId);
|
|
339
|
+
const partsEnumeratorVersion = startup.partsEnumerator?.version ?? null;
|
|
332
340
|
const session = new JobSession(startup);
|
|
333
341
|
async function installBinding(origin: string): Promise<void> {
|
|
334
342
|
try {await startup.installWriterBinding?.({...session.writerGrant(), origin});}
|
|
@@ -339,6 +347,20 @@ export async function startJobHost(options: JobHostOptions): Promise<JobOwnerHos
|
|
|
339
347
|
await mkdir(control, {recursive: true, mode: 0o700}).catch(error => {session.dispose(); throw error;});
|
|
340
348
|
const recordPath = join(control, session.jobId + '.json');
|
|
341
349
|
let previousPort = 0;
|
|
350
|
+
function compatible(record: JobHostRecord): void {
|
|
351
|
+
for (const [option, actual, requested] of [
|
|
352
|
+
['readPublished', record.readerId, readerId],
|
|
353
|
+
['installWriterBinding', record.bindingId, bindingId],
|
|
354
|
+
['partsEnumerator', record.partsEnumeratorId, partsEnumeratorId],
|
|
355
|
+
['partsEnumeratorVersion', record.partsEnumeratorVersion, partsEnumeratorVersion],
|
|
356
|
+
['apiSchema', record.apiSchema, JOB_API_SCHEMA],
|
|
357
|
+
['actSchema', record.actSchema, JOB_ACT_SCHEMA],
|
|
358
|
+
] as const) {
|
|
359
|
+
if (actual !== requested) {
|
|
360
|
+
throw new JobHostOptionError('JOB_HOST_REUSE_MISMATCH', option, actual, requested);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
342
364
|
const reuse = async (): Promise<JobHostRecord | null> => {
|
|
343
365
|
try {
|
|
344
366
|
const info = await lstat(recordPath);
|
|
@@ -356,14 +378,8 @@ export async function startJobHost(options: JobHostOptions): Promise<JobOwnerHos
|
|
|
356
378
|
if (!response?.ok) {void response?.body?.cancel(); return null;}
|
|
357
379
|
const value = await response.json() as JobHostRecord;
|
|
358
380
|
if (value.schema !== row.schema || value.jobId !== row.jobId || value.fingerprint !== row.fingerprint) return null;
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
['installWriterBinding', value.bindingId, bindingId],
|
|
362
|
-
] as const) {
|
|
363
|
-
if (actual !== requested) {
|
|
364
|
-
throw new JobHostOptionError('JOB_HOST_REUSE_MISMATCH', option, actual, requested);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
381
|
+
compatible(row);
|
|
382
|
+
compatible(value);
|
|
367
383
|
return row;
|
|
368
384
|
} catch (error) {
|
|
369
385
|
if ((error as NodeJS.ErrnoException).code === 'ENOENT') return null;
|
|
@@ -403,7 +419,8 @@ export async function startJobHost(options: JobHostOptions): Promise<JobOwnerHos
|
|
|
403
419
|
},
|
|
404
420
|
});
|
|
405
421
|
const origin = `http://127.0.0.1:${server.port}`;
|
|
406
|
-
const record: JobHostRecord = {schema: 'rig-review-job-host/1',
|
|
422
|
+
const record: JobHostRecord = {schema: 'rig-review-job-host/1', apiSchema: JOB_API_SCHEMA, actSchema: JOB_ACT_SCHEMA,
|
|
423
|
+
partsEnumeratorId, partsEnumeratorVersion, jobId: session.jobId, origin,
|
|
407
424
|
fingerprint: startup.fingerprint, pid: process.pid, readerId, bindingId};
|
|
408
425
|
ports = createJobHostPorts(session, origin);
|
|
409
426
|
front = createJobFront({origin, ports, resource: jobWindowResources(),
|
package/src/job-host.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type {JobPublicationReader, JobPublishedContext} from './job-source.ts';
|
|
|
7
7
|
export {
|
|
8
8
|
JOB_API_SCHEMA,
|
|
9
9
|
JOB_ACT_SCHEMA,
|
|
10
|
+
JOB_PARTS_ENUMERATOR_RANGE,
|
|
10
11
|
JOB_ENABLED_ACT_KINDS,
|
|
11
12
|
JOB_RESERVED_ACT_KINDS,
|
|
12
13
|
JOB_PLAN_BOUND_SIGNOFF_STAGES,
|
|
@@ -29,6 +30,9 @@ export type {
|
|
|
29
30
|
JobPartsManifestPath,
|
|
30
31
|
JobPartImagePath,
|
|
31
32
|
JobPartsIdentity,
|
|
33
|
+
JobPartsRole,
|
|
34
|
+
JobPartsFileReference,
|
|
35
|
+
JobPartsEnumerator,
|
|
32
36
|
JobSelector,
|
|
33
37
|
JobSourceBinding,
|
|
34
38
|
JobReviewerBinding,
|