@rig-c/review 1.16.7 → 1.17.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 +2 -1
- package/docs/DESIGN.md +11 -0
- package/docs/REVIEW_PACKAGE.md +53 -0
- package/docs/WORKFLOWS.md +52 -0
- package/package.json +7 -7
- package/skills/rig-review/SKILL.md +50 -0
- package/src/entry.ts +59 -0
- package/src/job-act.ts +164 -0
- package/src/job-api.ts +275 -0
- package/src/job-cli.ts +120 -0
- package/src/job-contract.ts +521 -0
- package/src/job-front.ts +443 -0
- package/src/job-session.ts +352 -0
- package/src/job-source.ts +291 -0
- package/src/job-store.ts +163 -0
- package/src/job-worker.ts +56 -0
- package/web/catalog-en.ts +66 -0
- package/web/catalog-ko.ts +66 -0
- package/web/job-session.ts +1623 -0
- package/web/parts.ts +28 -19
- package/web/scene-plates.ts +95 -0
- package/web/stage-nav.ts +28 -7
- package/web/styles.css +27 -2
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Review #484 contract freeze candidate for Lane B, Create #182 and Parts #1159.
|
|
3
|
+
* People submit through the UI. Agents use publish, ask, next and close.
|
|
4
|
+
* Public values contain semantic data and original source provenance. Private
|
|
5
|
+
* session, picks, verdict, applied-record and snapshot formats stay behind ports.
|
|
6
|
+
*
|
|
7
|
+
* Publication requires an explicit producer-held freeze until acknowledgment.
|
|
8
|
+
* Review validates retained bytes, detects a moved record and commits local CAS.
|
|
9
|
+
* The freeze assertion is a caller obligation, not a lock Review can impose on
|
|
10
|
+
* independent writers. No watched-root or automatic-close guarantee is offered.
|
|
11
|
+
* Only explicit close ends an active job. Direction carriage is metadata-only.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export const JOB_API_SCHEMA = 'rig-review/job-api@1' as const;
|
|
15
|
+
export const JOB_ACT_SCHEMA = 'rig-review/act@1' as const;
|
|
16
|
+
|
|
17
|
+
export const JOB_ENABLED_ACT_KINDS = [
|
|
18
|
+
'interview-picks',
|
|
19
|
+
'checkpoint',
|
|
20
|
+
'parts-verdict',
|
|
21
|
+
'review-verdict',
|
|
22
|
+
'signoff',
|
|
23
|
+
] as const;
|
|
24
|
+
|
|
25
|
+
export const JOB_RESERVED_ACT_KINDS = ['described-correction', 'mesh-edit'] as const;
|
|
26
|
+
export type JobEnabledActKind = typeof JOB_ENABLED_ACT_KINDS[number];
|
|
27
|
+
export type JobReservedActKind = typeof JOB_RESERVED_ACT_KINDS[number];
|
|
28
|
+
export type JobActKind = JobEnabledActKind | JobReservedActKind;
|
|
29
|
+
|
|
30
|
+
export const JOB_PLAN_BOUND_SIGNOFF_STAGES = [
|
|
31
|
+
'plan-approved',
|
|
32
|
+
'rigging-interview',
|
|
33
|
+
'post-interview',
|
|
34
|
+
] as const;
|
|
35
|
+
|
|
36
|
+
/** Reserved kinds have no accepted value shape and cannot be asked or submitted.
|
|
37
|
+
* Described correction awaits the joint Create #182 context allowlist.
|
|
38
|
+
* Mesh edit awaits the joint Parts #1159 freeze. Proposal 6ff03ec9 discusses
|
|
39
|
+
* slot/attachment/skin identity, setup basis, vertex/triangle/hull counts and
|
|
40
|
+
* at most 300 closed move/add/remove/edge/unedge operations in crop pixels.
|
|
41
|
+
* The exact attachment bytes behind source.hash and the canonical payload
|
|
42
|
+
* digest replacing delta_sha256 are UNRESOLVED. This contract defines neither.
|
|
43
|
+
* A future submitted mesh act must carry human UI authority, time, exact rig
|
|
44
|
+
* revision/source and recomputable provenance. Drafts are never consumer acts.
|
|
45
|
+
*/
|
|
46
|
+
export const JOB_CONSUMER_AUTH_MODE = 'writer-owned-sibling-fetch-capability' as const;
|
|
47
|
+
|
|
48
|
+
/** Hex digests, opaque IDs/cursors and timestamps require runtime validation.
|
|
49
|
+
* SHA-256 is 64 lowercase hex digits. Generations are nonnegative safe integers.
|
|
50
|
+
* Original input paths are literal project/package-relative provenance only.
|
|
51
|
+
* No public field names a Review state directory or stored document.
|
|
52
|
+
*/
|
|
53
|
+
export type JobSha256 = string;
|
|
54
|
+
export type JobId = string;
|
|
55
|
+
export type JobPublicationId = string;
|
|
56
|
+
export type JobAskId = string;
|
|
57
|
+
export type JobActId = string;
|
|
58
|
+
export type JobCursor = string;
|
|
59
|
+
|
|
60
|
+
export interface JobFileIdentity {
|
|
61
|
+
readonly path: string;
|
|
62
|
+
readonly sha256: JobSha256;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** IDs and existing step hashes published by Create #184 for the displayed plan.
|
|
66
|
+
* Review retains these values without importing or computing Create's internal
|
|
67
|
+
* stepHash. Create validates them with its existing writer. No plan revision
|
|
68
|
+
* hash or additional revision gate exists in this contract.
|
|
69
|
+
*/
|
|
70
|
+
export interface JobPlanStepIdentity {
|
|
71
|
+
readonly id: string;
|
|
72
|
+
readonly hash: JobSha256;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface JobPlanIdentity {
|
|
76
|
+
readonly steps: readonly JobPlanStepIdentity[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export type JobPartsManifestPath = 'parts.json' | `${string}/parts.json`;
|
|
80
|
+
export type JobPartImagePath =
|
|
81
|
+
| `parts/${string}.png`
|
|
82
|
+
| `${string}/parts/${string}.png`
|
|
83
|
+
| 'painting_in_rig.png'
|
|
84
|
+
| `${string}/painting_in_rig.png`;
|
|
85
|
+
|
|
86
|
+
/** Exact parts.json and EVERY manifest-referenced PNG, across part, alternate,
|
|
87
|
+
* depth and painting roles. Create #184 publishes the authoritative set using
|
|
88
|
+
* Parts' public reference enumerator, pending Parts #1163. Its export name and
|
|
89
|
+
* reader resolution rules belong to Parts. Review verifies the published paths
|
|
90
|
+
* and bytes without duplicating those field rules. Paths use original project
|
|
91
|
+
* provenance. Images are unique and lexically ordered in this public projection.
|
|
92
|
+
* Missing or changed referenced bytes invalidate the binding. Unreferenced stale
|
|
93
|
+
* extras are excluded and do not cause refusal. The manifest and complete
|
|
94
|
+
* referenced set enter sourceHash. No new parts filename or migration is added.
|
|
95
|
+
*/
|
|
96
|
+
export interface JobPartsIdentity {
|
|
97
|
+
readonly manifest: {
|
|
98
|
+
readonly path: JobPartsManifestPath;
|
|
99
|
+
readonly sha256: JobSha256;
|
|
100
|
+
};
|
|
101
|
+
readonly images: readonly {
|
|
102
|
+
readonly path: JobPartImagePath;
|
|
103
|
+
readonly sha256: JobSha256;
|
|
104
|
+
}[];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export type JobSelector =
|
|
108
|
+
| { readonly kind: 'draft'; readonly id: string }
|
|
109
|
+
| { readonly kind: 'rig'; readonly version: number }
|
|
110
|
+
| { readonly kind: 'post'; readonly version: number; readonly rigVersion: number };
|
|
111
|
+
|
|
112
|
+
/** Nulls are required explicit values. The daemon derives the binding from
|
|
113
|
+
* validated retained bytes and the actual displayed publication. Clients never
|
|
114
|
+
* provide trusted source hashes or transfer old approval onto a new binding.
|
|
115
|
+
*/
|
|
116
|
+
export interface JobSourceBinding {
|
|
117
|
+
readonly sourceHash: JobSha256;
|
|
118
|
+
readonly projectHash: JobSha256 | null;
|
|
119
|
+
readonly package: { readonly id: string; readonly revision: string };
|
|
120
|
+
readonly selector: JobSelector | null;
|
|
121
|
+
readonly model: JobFileIdentity | null;
|
|
122
|
+
readonly direction: JobFileIdentity | null;
|
|
123
|
+
readonly optionSet: { readonly id: string; readonly sha256: JobSha256 } | null;
|
|
124
|
+
readonly appliedResult: { readonly id: string; readonly modelHash: JobSha256 } | null;
|
|
125
|
+
readonly plan: JobPlanIdentity | null;
|
|
126
|
+
readonly parts: JobPartsIdentity | null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Trusted host bootstrap declares who the window was opened for. The UI cannot
|
|
130
|
+
* type or override this binding. It is not keyboard-user authentication. Create
|
|
131
|
+
* maps role to its existing by authority and preserves the declared identity.
|
|
132
|
+
*/
|
|
133
|
+
export interface JobReviewerBinding {
|
|
134
|
+
readonly id: string;
|
|
135
|
+
readonly role: 'owner' | 'delegate';
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface JobHumanAuthority {
|
|
139
|
+
readonly actor: 'human';
|
|
140
|
+
readonly channel: 'review-ui';
|
|
141
|
+
readonly reviewer: JobReviewerBinding;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export type JobVerdict = 'pending' | 'approved' | 'changes-requested';
|
|
145
|
+
export type JobPartOutcome = 'pending' | 'clean' | 'flagged';
|
|
146
|
+
export type JobReviewStage = 'rig-review' | 'direction-review';
|
|
147
|
+
|
|
148
|
+
export interface JobActValues {
|
|
149
|
+
readonly 'interview-picks': {
|
|
150
|
+
readonly questionId: string;
|
|
151
|
+
readonly selections: readonly {
|
|
152
|
+
readonly itemId: string;
|
|
153
|
+
readonly optionId: string;
|
|
154
|
+
readonly otherText: string | null;
|
|
155
|
+
}[];
|
|
156
|
+
readonly note: string;
|
|
157
|
+
};
|
|
158
|
+
readonly checkpoint: {
|
|
159
|
+
readonly checkpointId: string;
|
|
160
|
+
readonly planStepId: string;
|
|
161
|
+
/** Pending stays in the UI draft and never produces a finalized act.
|
|
162
|
+
* Only pass is eligible for Create's checkpoint sign-off writer. Fail is
|
|
163
|
+
* feedback or a named consumer refusal and never an approval write.
|
|
164
|
+
*/
|
|
165
|
+
readonly outcome: 'pass' | 'fail';
|
|
166
|
+
/** Required string, preserved verbatim including empty or whitespace-only
|
|
167
|
+
* words, matching Create's existing writer. This adds no UI action.
|
|
168
|
+
*/
|
|
169
|
+
readonly words: string;
|
|
170
|
+
};
|
|
171
|
+
readonly 'parts-verdict': {
|
|
172
|
+
readonly verdict: JobVerdict;
|
|
173
|
+
readonly parts: readonly {
|
|
174
|
+
readonly partId: string;
|
|
175
|
+
readonly part: { readonly outcome: JobPartOutcome; readonly note: string };
|
|
176
|
+
readonly mesh: { readonly outcome: JobPartOutcome; readonly note: string };
|
|
177
|
+
}[];
|
|
178
|
+
readonly words: string;
|
|
179
|
+
};
|
|
180
|
+
readonly 'review-verdict': {
|
|
181
|
+
readonly stage: JobReviewStage;
|
|
182
|
+
readonly verdict: JobVerdict;
|
|
183
|
+
readonly words: string;
|
|
184
|
+
};
|
|
185
|
+
readonly signoff: {
|
|
186
|
+
/** An explicitly declared Create stage. Validation belongs to its writer. */
|
|
187
|
+
readonly stage: string;
|
|
188
|
+
/** Changes requested are a verdict. These three approval stages require
|
|
189
|
+
* source.plan with exact displayed IDs/hashes at runtime, plan-approved,
|
|
190
|
+
* rigging-interview and post-interview. Other stages keep plan nullable
|
|
191
|
+
* where appropriate. Create validates through its existing steps/step_hashes
|
|
192
|
+
* logic. No new owner approval or revision-hash gate is introduced.
|
|
193
|
+
*/
|
|
194
|
+
readonly decision: 'approved';
|
|
195
|
+
/** Required string. Empty and whitespace-only words remain valid verbatim. */
|
|
196
|
+
readonly words: string;
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** The daemon copies checkpoint planStepId from the validated ask. The browser
|
|
201
|
+
* supplies checkpoint ID, outcome and words only. Create derives execution
|
|
202
|
+
* stage from its authoritative step phase/order. Review never stamps a stage.
|
|
203
|
+
*/
|
|
204
|
+
export type JobUIActValues = Omit<JobActValues, 'checkpoint'> & {
|
|
205
|
+
readonly checkpoint: Omit<JobActValues['checkpoint'], 'planStepId'>;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export interface JobActSources {
|
|
209
|
+
readonly 'interview-picks': JobSourceBinding & {
|
|
210
|
+
readonly optionSet: NonNullable<JobSourceBinding['optionSet']>;
|
|
211
|
+
};
|
|
212
|
+
readonly checkpoint: JobSourceBinding & { readonly plan: JobPlanIdentity };
|
|
213
|
+
readonly 'parts-verdict': JobSourceBinding & {
|
|
214
|
+
readonly projectHash: JobSha256;
|
|
215
|
+
readonly selector: Extract<JobSelector, { kind: 'draft' }>;
|
|
216
|
+
readonly parts: JobPartsIdentity;
|
|
217
|
+
};
|
|
218
|
+
readonly 'review-verdict': JobSourceBinding & {
|
|
219
|
+
readonly selector: Extract<JobSelector, { kind: 'rig' | 'post' }>;
|
|
220
|
+
readonly model: JobFileIdentity;
|
|
221
|
+
};
|
|
222
|
+
readonly signoff: JobSourceBinding;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/** Immutable, finalized explicit UI submissions only. All human text and ordered
|
|
226
|
+
* selections are preserved verbatim. A verdict, a signoff and a Create stage
|
|
227
|
+
* transition are separate writes. This union grants no transition authority.
|
|
228
|
+
* Review-verdict stage/selector/direction consistency is checked at runtime.
|
|
229
|
+
* Checkpoint stage is derived by Create. Plan-bound signoff requirements apply
|
|
230
|
+
* to every stage in JOB_PLAN_BOUND_SIGNOFF_STAGES before act creation.
|
|
231
|
+
*/
|
|
232
|
+
export type JobAct = {
|
|
233
|
+
[Kind in JobEnabledActKind]: {
|
|
234
|
+
readonly schema: typeof JOB_ACT_SCHEMA;
|
|
235
|
+
readonly actId: JobActId;
|
|
236
|
+
readonly jobId: JobId;
|
|
237
|
+
readonly askId: JobAskId;
|
|
238
|
+
readonly publicationId: JobPublicationId;
|
|
239
|
+
readonly kind: Kind;
|
|
240
|
+
readonly authority: JobHumanAuthority;
|
|
241
|
+
readonly at: string;
|
|
242
|
+
readonly source: JobActSources[Kind];
|
|
243
|
+
readonly value: JobActValues[Kind];
|
|
244
|
+
};
|
|
245
|
+
}[JobEnabledActKind];
|
|
246
|
+
|
|
247
|
+
export type JobSubject =
|
|
248
|
+
| { readonly kind: 'interview-picks'; readonly questionId: string; readonly setId: string }
|
|
249
|
+
| {
|
|
250
|
+
readonly kind: 'checkpoint';
|
|
251
|
+
/** The Create plan step ID by default. */
|
|
252
|
+
readonly checkpointId: string;
|
|
253
|
+
/** Required when the displayed Review checkpoint ID differs. The mapping
|
|
254
|
+
* must match Create #184's published binding. Never infer an alias or trust
|
|
255
|
+
* a browser-supplied mapping. Finalized acts always name the resolved ID.
|
|
256
|
+
*/
|
|
257
|
+
readonly planStepId?: string;
|
|
258
|
+
}
|
|
259
|
+
| { readonly kind: 'parts-verdict'; readonly draftId: string }
|
|
260
|
+
| { readonly kind: 'review-verdict'; readonly stage: JobReviewStage }
|
|
261
|
+
| { readonly kind: 'signoff'; readonly stage: string };
|
|
262
|
+
|
|
263
|
+
export interface JobPendingAsk {
|
|
264
|
+
readonly askId: JobAskId;
|
|
265
|
+
readonly publicationId: JobPublicationId;
|
|
266
|
+
readonly subject: JobSubject;
|
|
267
|
+
readonly source: JobSourceBinding;
|
|
268
|
+
readonly status: 'pending' | 'answered' | 'superseded';
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export interface JobPublication {
|
|
272
|
+
readonly publicationId: JobPublicationId;
|
|
273
|
+
readonly instanceKey: JobSha256;
|
|
274
|
+
readonly generation: number;
|
|
275
|
+
readonly source: JobSourceBinding;
|
|
276
|
+
readonly label: string;
|
|
277
|
+
readonly previousPublicationId: JobPublicationId | null;
|
|
278
|
+
readonly visual: { readonly status: 'available' } | {
|
|
279
|
+
readonly status: 'unavailable';
|
|
280
|
+
readonly code: string;
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export interface JobStatus {
|
|
285
|
+
readonly jobId: JobId;
|
|
286
|
+
readonly generation: number;
|
|
287
|
+
readonly status: 'active' | 'closed';
|
|
288
|
+
readonly publication: JobPublication | null;
|
|
289
|
+
readonly pending: readonly JobPendingAsk[];
|
|
290
|
+
readonly cursor: JobCursor | null;
|
|
291
|
+
readonly enabledActKinds: readonly JobEnabledActKind[];
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
interface JobRequestBase {
|
|
295
|
+
readonly schema: typeof JOB_API_SCHEMA;
|
|
296
|
+
readonly jobId: JobId;
|
|
297
|
+
readonly requestId: string;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
interface JobMutation extends JobRequestBase {
|
|
301
|
+
readonly expectedGeneration: number;
|
|
302
|
+
readonly idempotencyKey: string;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface JobPublishRequest extends JobMutation {
|
|
306
|
+
readonly verb: 'publish';
|
|
307
|
+
readonly result: {
|
|
308
|
+
/** Root-relative result designated by the producer, never a command. */
|
|
309
|
+
readonly path: string;
|
|
310
|
+
readonly selector: JobSelector | null;
|
|
311
|
+
};
|
|
312
|
+
readonly freeze: {
|
|
313
|
+
readonly kind: 'producer-held';
|
|
314
|
+
readonly holdId: string;
|
|
315
|
+
/** Exact record used for selection, or null for a declared non-Create root. */
|
|
316
|
+
readonly record: JobFileIdentity | null;
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
export interface JobAskRequest extends JobMutation {
|
|
321
|
+
readonly verb: 'ask';
|
|
322
|
+
readonly publicationId: JobPublicationId;
|
|
323
|
+
readonly subject: JobSubject;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export interface JobNextRequest extends JobRequestBase {
|
|
327
|
+
readonly verb: 'next';
|
|
328
|
+
readonly after: JobCursor | null;
|
|
329
|
+
/** Bounded by the daemon. Waiting is abortable and never consumes an act. */
|
|
330
|
+
readonly waitMs: number;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface JobCloseRequest extends JobMutation {
|
|
334
|
+
readonly verb: 'close';
|
|
335
|
+
readonly reason: string;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export type JobAgentRequest =
|
|
339
|
+
| JobPublishRequest
|
|
340
|
+
| JobAskRequest
|
|
341
|
+
| JobNextRequest
|
|
342
|
+
| JobCloseRequest;
|
|
343
|
+
|
|
344
|
+
/** Consumer fetch is a separate read-only transport, never a human-act writer. */
|
|
345
|
+
export interface JobFetchActRequest extends JobRequestBase {
|
|
346
|
+
readonly verb: 'fetch-act';
|
|
347
|
+
readonly actId: JobActId;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export const JOB_ERROR_CODES = [
|
|
351
|
+
'JOB_REQUEST_INVALID',
|
|
352
|
+
'JOB_BODY_LIMIT',
|
|
353
|
+
'JOB_LOOPBACK_REQUIRED',
|
|
354
|
+
'JOB_SAME_ORIGIN_REQUIRED',
|
|
355
|
+
'JOB_CAPABILITY_REQUIRED',
|
|
356
|
+
'JOB_AUTHORITY_REFUSED',
|
|
357
|
+
'JOB_UNKNOWN',
|
|
358
|
+
'JOB_CLOSED',
|
|
359
|
+
'JOB_GENERATION_STALE',
|
|
360
|
+
'JOB_IDEMPOTENCY_CONFLICT',
|
|
361
|
+
'JOB_FREEZE_REQUIRED',
|
|
362
|
+
'JOB_RECORD_INCOMPLETE',
|
|
363
|
+
'JOB_RECORD_MOVED',
|
|
364
|
+
'JOB_SOURCE_MISMATCH',
|
|
365
|
+
'JOB_SOURCE_UNRETAINABLE',
|
|
366
|
+
'JOB_ROOT_REPLACED',
|
|
367
|
+
'JOB_PUBLICATION_UNKNOWN',
|
|
368
|
+
'JOB_ASK_INVALID',
|
|
369
|
+
'JOB_ASK_SUPERSEDED',
|
|
370
|
+
'JOB_ACT_UNKNOWN',
|
|
371
|
+
'JOB_ACT_INVALID',
|
|
372
|
+
'JOB_ACT_KIND_DISABLED',
|
|
373
|
+
'JOB_ACT_SOURCE_STALE',
|
|
374
|
+
'JOB_DISPLAY_MISMATCH',
|
|
375
|
+
'JOB_CURSOR_INVALID',
|
|
376
|
+
'JOB_STORAGE_FAILED',
|
|
377
|
+
'JOB_AGENT_ISOLATION_HOLE',
|
|
378
|
+
] as const;
|
|
379
|
+
export type JobErrorCode = typeof JOB_ERROR_CODES[number];
|
|
380
|
+
|
|
381
|
+
export interface JobFailure {
|
|
382
|
+
readonly ok: false;
|
|
383
|
+
readonly error: {
|
|
384
|
+
readonly code: JobErrorCode;
|
|
385
|
+
/** Safe bounded detail only. No arbitrary worker text or private paths. */
|
|
386
|
+
readonly message: string;
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export type JobResult<Value> = { readonly ok: true; readonly value: Value } | JobFailure;
|
|
391
|
+
|
|
392
|
+
export type JobEvent = {
|
|
393
|
+
readonly cursor: JobCursor;
|
|
394
|
+
readonly jobId: JobId;
|
|
395
|
+
readonly generation: number;
|
|
396
|
+
} & (
|
|
397
|
+
| { readonly type: 'published'; readonly publication: JobPublication }
|
|
398
|
+
| { readonly type: 'pending'; readonly ask: JobPendingAsk }
|
|
399
|
+
| { readonly type: 'act'; readonly act: JobAct }
|
|
400
|
+
| { readonly type: 'closed'; readonly reason: string }
|
|
401
|
+
);
|
|
402
|
+
|
|
403
|
+
export interface JobNextValue {
|
|
404
|
+
readonly events: readonly JobEvent[];
|
|
405
|
+
readonly cursor: JobCursor | null;
|
|
406
|
+
readonly status: 'events' | 'timeout' | 'closed';
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export interface JobResponseValues {
|
|
410
|
+
readonly publish: JobPublication;
|
|
411
|
+
readonly ask: JobPendingAsk;
|
|
412
|
+
readonly next: JobNextValue;
|
|
413
|
+
readonly close: { readonly status: 'closed'; readonly cursor: JobCursor | null };
|
|
414
|
+
readonly 'fetch-act': JobAct;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export type JobApiResponse = {
|
|
418
|
+
[Verb in keyof JobResponseValues]: {
|
|
419
|
+
readonly schema: typeof JOB_API_SCHEMA;
|
|
420
|
+
readonly verb: Verb;
|
|
421
|
+
readonly jobId: JobId;
|
|
422
|
+
readonly requestId: string;
|
|
423
|
+
readonly generation: number;
|
|
424
|
+
} & JobResult<JobResponseValues[Verb]>;
|
|
425
|
+
}[keyof JobResponseValues];
|
|
426
|
+
|
|
427
|
+
/** UI-only payload. Neither authority nor source is accepted from the browser.
|
|
428
|
+
* The daemon authenticates the actual Request and derives both from the nonce.
|
|
429
|
+
* Retrying submissionId returns the same immutable act. Changed payload refuses.
|
|
430
|
+
*/
|
|
431
|
+
export type JobUISubmission = {
|
|
432
|
+
[Kind in JobEnabledActKind]: {
|
|
433
|
+
readonly publicationId: JobPublicationId;
|
|
434
|
+
readonly askId: JobAskId;
|
|
435
|
+
readonly pageId: string;
|
|
436
|
+
readonly displayedNonce: string;
|
|
437
|
+
readonly expectedGeneration: number;
|
|
438
|
+
readonly submissionId: string;
|
|
439
|
+
readonly kind: Kind;
|
|
440
|
+
readonly value: JobUIActValues[Kind];
|
|
441
|
+
};
|
|
442
|
+
}[JobEnabledActKind];
|
|
443
|
+
|
|
444
|
+
export interface JobDisplayAcknowledgment {
|
|
445
|
+
readonly publicationId: JobPublicationId;
|
|
446
|
+
readonly pageId: string;
|
|
447
|
+
readonly sourceHash: JobSha256;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
export interface JobDisplayReceipt {
|
|
451
|
+
readonly publicationId: JobPublicationId;
|
|
452
|
+
readonly pageId: string;
|
|
453
|
+
/** Page-scoped UI secret, never returned by the agent/consumer API. */
|
|
454
|
+
readonly displayedNonce: string;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export interface JobDisplayPublication {
|
|
458
|
+
readonly publication: JobPublication;
|
|
459
|
+
/** Same-origin routes pinned to this publication and instance. No current alias. */
|
|
460
|
+
readonly routes: {
|
|
461
|
+
readonly entry: string;
|
|
462
|
+
readonly apiBase: string;
|
|
463
|
+
readonly assetsBase: string;
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/** Trusted host ports for Lane B. Raw Requests preserve real Origin, capability,
|
|
468
|
+
* size and abort context. A TypeScript value is never authentication evidence.
|
|
469
|
+
* handleJobApi accepts agent verbs and consumer fetch only. The host wires UI
|
|
470
|
+
* methods on separate closed same-origin routes, unavailable to agent tokens.
|
|
471
|
+
* Subscriptions abort cleanly and replay only complete durable events.
|
|
472
|
+
*/
|
|
473
|
+
export interface JobHostPorts {
|
|
474
|
+
handleJobApi(request: Request): Promise<Response>;
|
|
475
|
+
subscribeJob(input: {
|
|
476
|
+
readonly jobId: JobId;
|
|
477
|
+
readonly after: JobCursor | null;
|
|
478
|
+
readonly signal: AbortSignal;
|
|
479
|
+
}): AsyncIterable<JobEvent>;
|
|
480
|
+
readPublication(jobId: JobId, publicationId: JobPublicationId): Promise<JobResult<JobDisplayPublication>>;
|
|
481
|
+
commitUIAct(jobId: JobId, request: Request): Promise<JobResult<JobAct>>;
|
|
482
|
+
ackDisplayed(jobId: JobId, request: Request): Promise<JobResult<JobDisplayReceipt>>;
|
|
483
|
+
jobLiveness(jobId: JobId): Promise<JobResult<{
|
|
484
|
+
readonly active: boolean;
|
|
485
|
+
readonly busy: boolean;
|
|
486
|
+
}>>;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/** HQ-approved honest-agent-shortcut model. Create #184 owns creation and path
|
|
490
|
+
* of a private writer-owned sibling binding outside project.json. Its versioned
|
|
491
|
+
* record carries only the semantic job locator. The binding is never tracked,
|
|
492
|
+
* present in unstaged project output, or shipped in templates/public examples/
|
|
493
|
+
* fixtures. The writer reads its own binding. Agents never construct or carry it.
|
|
494
|
+
* Actual separate-UID isolation remains required for Review's distinct state
|
|
495
|
+
* unreadability test. No same-user forger-resistance claim is made here.
|
|
496
|
+
*
|
|
497
|
+
* The binding's random per-job bearer capability grants finalized act fetch
|
|
498
|
+
* only, via exact loopback routes and Authorization. No next/status response
|
|
499
|
+
* returns it. Human metadata alone never authenticates a fetch. The capability
|
|
500
|
+
* dies at explicit close. Old project history cannot restore it. A new job
|
|
501
|
+
* incarnation has a new grant. Invalid grants refuse by capability/authority
|
|
502
|
+
* name and closed-job fetch refuses JOB_CLOSED. No self-service grant API exists.
|
|
503
|
+
*
|
|
504
|
+
* Create fetches a future mesh act, then passes its typed value IN PROCESS to
|
|
505
|
+
* Parts' public exported API owned by Parts #1159. Parts reads neither Review
|
|
506
|
+
* nor Create storage and takes no Create-project argument for that API. No active
|
|
507
|
+
* rig-parts grant/audience is introduced. Standalone --delta remains legacy
|
|
508
|
+
* outside this cycle. Mesh-edit stays reserved until its separate joint freeze.
|
|
509
|
+
*
|
|
510
|
+
* Consumer writers deduplicate actId before current-source checks, then validate
|
|
511
|
+
* each new source and atomically commit writer result plus replay identity.
|
|
512
|
+
* Replay returns the existing record. A new stale act refuses before mutation.
|
|
513
|
+
* Verdict, sign-off and stage transition remain three separate consumer writes.
|
|
514
|
+
*/
|
|
515
|
+
export interface JobConsumerGrant {
|
|
516
|
+
readonly mode: typeof JOB_CONSUMER_AUTH_MODE;
|
|
517
|
+
readonly jobId: JobId;
|
|
518
|
+
readonly operation: 'fetch-act';
|
|
519
|
+
readonly actKinds: readonly JobEnabledActKind[];
|
|
520
|
+
readonly lifetime: 'until-explicit-close';
|
|
521
|
+
}
|