@12ui/design 0.2.36 → 0.2.38
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/SKILL.md +1 -1
- package/dist/branch-client.d.ts +12 -0
- package/dist/branch-client.d.ts.map +1 -1
- package/dist/branch-client.js.map +1 -1
- package/dist/branch-completion.d.ts.map +1 -1
- package/dist/branch-completion.js +1 -0
- package/dist/branch-completion.js.map +1 -1
- package/dist/branch-execution-types.d.ts +3 -0
- package/dist/branch-execution-types.d.ts.map +1 -1
- package/dist/branch-execution.d.ts.map +1 -1
- package/dist/branch-execution.js +13 -0
- package/dist/branch-execution.js.map +1 -1
- package/dist/branch-identity.d.ts +1 -1
- package/dist/branch-identity.js +1 -1
- package/dist/branch-plan.d.ts +3 -1
- package/dist/branch-plan.d.ts.map +1 -1
- package/dist/branch-plan.js +2 -0
- package/dist/branch-plan.js.map +1 -1
- package/dist/branch-run-record.d.ts +18 -0
- package/dist/branch-run-record.d.ts.map +1 -1
- package/dist/branch-run-record.js.map +1 -1
- package/dist/branch-winner.d.ts.map +1 -1
- package/dist/branch-winner.js +7 -0
- package/dist/branch-winner.js.map +1 -1
- package/dist/cli-branch-command.d.ts.map +1 -1
- package/dist/cli-branch-command.js +61 -7
- package/dist/cli-branch-command.js.map +1 -1
- package/dist/cli-help/design.d.ts +1 -1
- package/dist/cli-help/design.d.ts.map +1 -1
- package/dist/cli-help/design.js +1 -0
- package/dist/cli-help/design.js.map +1 -1
- package/dist/cli-help/index.d.ts +1 -1
- package/dist/cli-prototype-command.d.ts +3 -2
- package/dist/cli-prototype-command.d.ts.map +1 -1
- package/dist/cli-prototype-command.js +9 -3
- package/dist/cli-prototype-command.js.map +1 -1
- package/dist/cli-review-command.js +2 -2
- package/dist/cli-review-command.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/prototype-branch-contract.d.ts +67 -0
- package/dist/prototype-branch-contract.d.ts.map +1 -0
- package/dist/prototype-branch-contract.js +403 -0
- package/dist/prototype-branch-contract.js.map +1 -0
- package/dist/prototype-poststep.d.ts +27 -0
- package/dist/prototype-poststep.d.ts.map +1 -0
- package/dist/prototype-poststep.js +97 -0
- package/dist/prototype-poststep.js.map +1 -0
- package/dist/prototype-run-record.d.ts +92 -0
- package/dist/prototype-run-record.d.ts.map +1 -0
- package/dist/prototype-run-record.js +236 -0
- package/dist/prototype-run-record.js.map +1 -0
- package/dist/prototype-runner.d.ts +13 -1
- package/dist/prototype-runner.d.ts.map +1 -1
- package/dist/prototype-runner.js +79 -20
- package/dist/prototype-runner.js.map +1 -1
- package/open-design.json +2 -2
- package/package.json +1 -1
- package/prototype-kit/analyze.mjs +48 -6
- package/prototype-kit/build.mjs +249 -65
- package/prototype-kit/inventory.mjs +290 -2
- package/prototype-kit/lib/holding-composition.mjs +67 -0
- package/prototype-kit/lib/nav-active-state.mjs +67 -0
- package/prototype-kit/lib/review-framing.mjs +72 -0
- package/prototype-kit/lib/runtime-check.mjs +361 -28
- package/prototype-kit/lib/shell-consistency.mjs +68 -0
- package/prototype-kit/lib/shell-stitching.mjs +221 -0
- package/prototype-kit/runtime/proto.css +8 -3
- package/prototype-kit/tests/README.md +4 -1
- package/prototype-kit/tests/adversarial-runtime.mjs +85 -2
- package/prototype-kit/tests/fixtures/holding-runtime/PROVENANCE.md +22 -0
- package/prototype-kit/tests/fixtures/holding-runtime/band-ownership-fire.html +10 -0
- package/prototype-kit/tests/fixtures/holding-runtime/band-ownership-silent.html +10 -0
- package/prototype-kit/tests/fixtures/holding-runtime/declared-width-fire.html +11 -0
- package/prototype-kit/tests/fixtures/holding-runtime/declared-width-silent.html +11 -0
- package/prototype-kit/tests/fixtures/holding-runtime/ground-registration-mismatch-fire.html +5 -0
- package/prototype-kit/tests/fixtures/holding-runtime/ground-registration-mismatch-silent.html +5 -0
- package/prototype-kit/tests/fixtures/holding-runtime/holding-contrast-fire.html +5 -0
- package/prototype-kit/tests/fixtures/holding-runtime/holding-contrast-silent.html +5 -0
- package/prototype-kit/tests/fixtures/holding-runtime/positioned-ground-fire.html +5 -0
- package/prototype-kit/tests/fixtures/holding-runtime/positioned-ground-silent.html +5 -0
- package/prototype-kit/tests/fixtures/holding-runtime/shell-geometry-fire.html +5 -0
- package/prototype-kit/tests/fixtures/holding-runtime/shell-geometry-silent.html +5 -0
- package/prototype-kit/tests/fixtures/holding-runtime/shell-intersection-fire.html +5 -0
- package/prototype-kit/tests/fixtures/holding-runtime/shell-intersection-silent.html +5 -0
- package/prototype-kit/tests/fixtures/runtime/history.html +1 -1
- package/prototype-kit/tests/fixtures/shell-nav-runtime/PROVENANCE.md +6 -0
- package/prototype-kit/tests/fixtures/shell-nav-runtime/active-fire.html +3 -0
- package/prototype-kit/tests/fixtures/shell-nav-runtime/proto-manifest.json +20 -0
- package/prototype-kit/tests/fixtures/shell-nav-runtime/shell-fire.html +3 -0
- package/prototype-kit/tests/fixtures/shell-nav-runtime/shell-silent.html +3 -0
- package/prototype-kit/tests/fixtures/shell-nav-runtime/unlinked-silent.html +3 -0
- package/prototype-kit/tests/fixtures/three-shell/pages/p0-home.html +3 -3
- package/prototype-kit/tests/fixtures/three-shell/pages/p1-reports.html +3 -3
- package/prototype-kit/tests/lib/run-process.mjs +8 -2
- package/prototype-kit/tests/offline-check.mjs +143 -0
- package/prototype-kit/tests/population-sweep.mjs +26 -7
- package/prototype-kit/tests/rules-check.mjs +80 -0
- package/prototype-kit/verify-runtime.mjs +5 -1
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { readdir, readFile, stat } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { BRANCH_COMPLETION_FILENAME, BRANCH_PAGES_DIRECTORY, BRANCH_PLAN_FILENAME, } from './branch-run-record.js';
|
|
5
|
+
import { PROTOTYPE_SOURCES_DIRECTORY } from './prototype-source.js';
|
|
6
|
+
const isRecord = (value) => (typeof value === 'object' && value !== null && !Array.isArray(value));
|
|
7
|
+
const errorCode = (error) => {
|
|
8
|
+
const code = error.code;
|
|
9
|
+
return typeof code === 'string' ? code : 'UNKNOWN';
|
|
10
|
+
};
|
|
11
|
+
const readBytes = async (file) => {
|
|
12
|
+
try {
|
|
13
|
+
return { bytes: await readFile(file) };
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
return { error: errorCode(error) };
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const componentDigest = (value) => ('bytes' in value
|
|
20
|
+
? createHash('sha256').update(value.bytes).digest('hex')
|
|
21
|
+
: `error:${value.error}`);
|
|
22
|
+
const existingSourceDirectory = async (branchDir) => {
|
|
23
|
+
const overlay = path.join(branchDir, PROTOTYPE_SOURCES_DIRECTORY);
|
|
24
|
+
try {
|
|
25
|
+
await stat(path.join(overlay, BRANCH_PLAN_FILENAME));
|
|
26
|
+
return overlay;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (errorCode(error) === 'ENOENT')
|
|
30
|
+
return branchDir;
|
|
31
|
+
// A present but unreadable overlay is input evidence, not permission to
|
|
32
|
+
// silently switch back to an older plan in the branch root.
|
|
33
|
+
return overlay;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const readInputSnapshot = async (args) => {
|
|
37
|
+
const branchDir = path.resolve(args.branchDir);
|
|
38
|
+
const sourceDir = args.sourceDir
|
|
39
|
+
? path.resolve(args.sourceDir)
|
|
40
|
+
: await existingSourceDirectory(branchDir);
|
|
41
|
+
const pagesDir = path.join(sourceDir, BRANCH_PAGES_DIRECTORY);
|
|
42
|
+
const [plan, completion] = await Promise.all([
|
|
43
|
+
readBytes(path.join(sourceDir, BRANCH_PLAN_FILENAME)),
|
|
44
|
+
readBytes(path.join(branchDir, BRANCH_COMPLETION_FILENAME)),
|
|
45
|
+
]);
|
|
46
|
+
let pagesError;
|
|
47
|
+
let entries = [];
|
|
48
|
+
try {
|
|
49
|
+
entries = await readdir(pagesDir, { withFileTypes: true });
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
pagesError = errorCode(error);
|
|
53
|
+
}
|
|
54
|
+
const htmlEntries = entries
|
|
55
|
+
.filter((entry) => entry.name.endsWith('.html'))
|
|
56
|
+
.sort((left, right) => left.name.localeCompare(right.name));
|
|
57
|
+
const invalidHtmlEntries = htmlEntries
|
|
58
|
+
.filter((entry) => !entry.isFile())
|
|
59
|
+
.map((entry) => entry.name);
|
|
60
|
+
const html = await Promise.all(htmlEntries
|
|
61
|
+
.filter((entry) => entry.isFile())
|
|
62
|
+
.map(async (entry) => ({
|
|
63
|
+
file: entry.name,
|
|
64
|
+
read: await readBytes(path.join(pagesDir, entry.name)),
|
|
65
|
+
})));
|
|
66
|
+
const digestManifest = {
|
|
67
|
+
plan: componentDigest(plan),
|
|
68
|
+
completion: componentDigest(completion),
|
|
69
|
+
pages: pagesError ? `error:${pagesError}` : 'readable',
|
|
70
|
+
invalidHtmlEntries,
|
|
71
|
+
html: html.map((entry) => [entry.file, componentDigest(entry.read)]),
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
plan,
|
|
75
|
+
completion,
|
|
76
|
+
html,
|
|
77
|
+
...(pagesError ? { pagesError } : {}),
|
|
78
|
+
invalidHtmlEntries,
|
|
79
|
+
inputDigest: createHash('sha256')
|
|
80
|
+
.update(JSON.stringify(digestManifest))
|
|
81
|
+
.digest('hex'),
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
const parseJson = (input) => {
|
|
85
|
+
if (!('bytes' in input))
|
|
86
|
+
return undefined;
|
|
87
|
+
try {
|
|
88
|
+
return JSON.parse(input.bytes.toString('utf8'));
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const recordRunId = (value) => (isRecord(value) && typeof value.runId === 'string' ? value.runId : '');
|
|
95
|
+
const routeIdPattern = /^[a-z0-9][a-z0-9-]*$/u;
|
|
96
|
+
const readPlannedRoutes = (plan, issues) => {
|
|
97
|
+
if (!Array.isArray(plan.pages)) {
|
|
98
|
+
issues.push('branch.plan.json pages is not an array');
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
if (plan.packagePages !== undefined
|
|
102
|
+
&& plan.packagePages !== null
|
|
103
|
+
&& !Array.isArray(plan.packagePages)) {
|
|
104
|
+
issues.push('branch.plan.json packagePages is not an array');
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
const selected = Array.isArray(plan.packagePages) && plan.packagePages.length > 0
|
|
108
|
+
? plan.packagePages
|
|
109
|
+
: plan.pages;
|
|
110
|
+
const routes = [];
|
|
111
|
+
const ids = new Set();
|
|
112
|
+
selected.forEach((value, index) => {
|
|
113
|
+
if (!isRecord(value)) {
|
|
114
|
+
issues.push(`planned route ${index} is not an object`);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const id = typeof value.id === 'string' ? value.id : '';
|
|
118
|
+
const title = typeof value.title === 'string' ? value.title : '';
|
|
119
|
+
if (!routeIdPattern.test(id))
|
|
120
|
+
issues.push(`planned route ${index} has invalid id`);
|
|
121
|
+
if (!title.trim())
|
|
122
|
+
issues.push(`planned route ${id || index} has no exact title`);
|
|
123
|
+
if (typeof value.startsFromWinner !== 'boolean') {
|
|
124
|
+
issues.push(`planned route ${id || index} has no startsFromWinner fact`);
|
|
125
|
+
}
|
|
126
|
+
if (ids.has(id))
|
|
127
|
+
issues.push(`planned route id is duplicated: ${id}`);
|
|
128
|
+
ids.add(id);
|
|
129
|
+
routes.push({
|
|
130
|
+
id,
|
|
131
|
+
title,
|
|
132
|
+
startsFromWinner: value.startsFromWinner === true,
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
if (routes.length === 0)
|
|
136
|
+
issues.push('branch plan has no prototype routes');
|
|
137
|
+
return routes;
|
|
138
|
+
};
|
|
139
|
+
const readCompletionRoutes = (completion, issues) => {
|
|
140
|
+
if (!Array.isArray(completion.pages)) {
|
|
141
|
+
issues.push('branch.complete.json pages is not an array');
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
const routes = [];
|
|
145
|
+
const ids = new Set();
|
|
146
|
+
completion.pages.forEach((value, index) => {
|
|
147
|
+
if (!isRecord(value)) {
|
|
148
|
+
issues.push(`completion route ${index} is not an object`);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const id = typeof value.id === 'string' ? value.id : '';
|
|
152
|
+
const title = typeof value.title === 'string' ? value.title : '';
|
|
153
|
+
if (!routeIdPattern.test(id))
|
|
154
|
+
issues.push(`completion route ${index} has invalid id`);
|
|
155
|
+
if (!title.trim())
|
|
156
|
+
issues.push(`completion route ${id || index} has no exact title`);
|
|
157
|
+
if (typeof value.startsFromWinner !== 'boolean') {
|
|
158
|
+
issues.push(`completion route ${id || index} has no startsFromWinner fact`);
|
|
159
|
+
}
|
|
160
|
+
if (ids.has(id))
|
|
161
|
+
issues.push(`completion route id is duplicated: ${id}`);
|
|
162
|
+
ids.add(id);
|
|
163
|
+
const conversion = value.conversion;
|
|
164
|
+
if (conversion !== undefined && !isRecord(conversion)) {
|
|
165
|
+
issues.push(`completion route ${id || index} conversion is not an object`);
|
|
166
|
+
}
|
|
167
|
+
const conversionStatus = isRecord(conversion) && typeof conversion.status === 'string'
|
|
168
|
+
? conversion.status
|
|
169
|
+
: undefined;
|
|
170
|
+
const outFile = isRecord(conversion) && typeof conversion.outFile === 'string'
|
|
171
|
+
? conversion.outFile
|
|
172
|
+
: undefined;
|
|
173
|
+
routes.push({
|
|
174
|
+
id,
|
|
175
|
+
title,
|
|
176
|
+
startsFromWinner: value.startsFromWinner === true,
|
|
177
|
+
...(conversionStatus ? { conversionStatus } : {}),
|
|
178
|
+
...(outFile ? { outFile } : {}),
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
return routes;
|
|
182
|
+
};
|
|
183
|
+
const holdingFile = (id) => {
|
|
184
|
+
const slug = id
|
|
185
|
+
.toLowerCase()
|
|
186
|
+
.replace(/[^a-z0-9]+/gu, '-')
|
|
187
|
+
.replace(/^-+|-+$/gu, '');
|
|
188
|
+
return `holding-${slug}.html`;
|
|
189
|
+
};
|
|
190
|
+
const skipContract = (args) => ({
|
|
191
|
+
mode: 'skip',
|
|
192
|
+
inputDigest: args.snapshot.inputDigest,
|
|
193
|
+
runId: args.runId,
|
|
194
|
+
reason: args.noSurvivors
|
|
195
|
+
? 'prototype_navigation_no_survivors'
|
|
196
|
+
: 'prototype_navigation_unreconciled',
|
|
197
|
+
detail: args.detail,
|
|
198
|
+
});
|
|
199
|
+
/**
|
|
200
|
+
* Resolve the immutable branch records and exported HTML into the navigation
|
|
201
|
+
* contract consumed by prototype assembly. This function reads only: it never
|
|
202
|
+
* repairs, copies, or guesses around contradictory durable evidence.
|
|
203
|
+
*/
|
|
204
|
+
export const resolvePrototypeBranchContract = async (args) => {
|
|
205
|
+
const snapshot = await readInputSnapshot(args);
|
|
206
|
+
const planValue = parseJson(snapshot.plan);
|
|
207
|
+
const completionValue = parseJson(snapshot.completion);
|
|
208
|
+
const planRunId = recordRunId(planValue);
|
|
209
|
+
const completionRunId = recordRunId(completionValue);
|
|
210
|
+
const runId = completionRunId || planRunId;
|
|
211
|
+
const issues = [];
|
|
212
|
+
if (!('bytes' in snapshot.plan)) {
|
|
213
|
+
issues.push(`branch.plan.json is unreadable (${snapshot.plan.error})`);
|
|
214
|
+
}
|
|
215
|
+
else if (!isRecord(planValue)) {
|
|
216
|
+
issues.push('branch.plan.json is not a JSON object');
|
|
217
|
+
}
|
|
218
|
+
if (!('bytes' in snapshot.completion)) {
|
|
219
|
+
issues.push(`branch.complete.json is unreadable (${snapshot.completion.error})`);
|
|
220
|
+
}
|
|
221
|
+
else if (!isRecord(completionValue)) {
|
|
222
|
+
issues.push('branch.complete.json is not a JSON object');
|
|
223
|
+
}
|
|
224
|
+
if (snapshot.pagesError)
|
|
225
|
+
issues.push(`pages directory is unreadable (${snapshot.pagesError})`);
|
|
226
|
+
snapshot.invalidHtmlEntries.forEach((file) => {
|
|
227
|
+
issues.push(`HTML input is not a regular file: ${file}`);
|
|
228
|
+
});
|
|
229
|
+
snapshot.html.forEach((entry) => {
|
|
230
|
+
if (!('bytes' in entry.read))
|
|
231
|
+
issues.push(`HTML input is unreadable: ${entry.file} (${entry.read.error})`);
|
|
232
|
+
});
|
|
233
|
+
if (!planRunId)
|
|
234
|
+
issues.push('branch.plan.json has no runId');
|
|
235
|
+
if (!completionRunId)
|
|
236
|
+
issues.push('branch.complete.json has no runId');
|
|
237
|
+
if (planRunId && completionRunId && planRunId !== completionRunId) {
|
|
238
|
+
issues.push(`runId differs between plan and completion: ${planRunId} != ${completionRunId}`);
|
|
239
|
+
}
|
|
240
|
+
if (!isRecord(planValue) || !isRecord(completionValue)) {
|
|
241
|
+
return skipContract({ snapshot, runId, detail: issues.join('; ') });
|
|
242
|
+
}
|
|
243
|
+
const planned = readPlannedRoutes(planValue, issues);
|
|
244
|
+
const completed = readCompletionRoutes(completionValue, issues);
|
|
245
|
+
const completionById = new Map(completed.map((route) => [route.id, route]));
|
|
246
|
+
const plannedIds = new Set(planned.map((route) => route.id));
|
|
247
|
+
const htmlById = new Map(snapshot.html.map((entry) => [
|
|
248
|
+
entry.file.slice(0, -'.html'.length),
|
|
249
|
+
entry,
|
|
250
|
+
]));
|
|
251
|
+
for (const route of planned) {
|
|
252
|
+
const completedRoute = completionById.get(route.id);
|
|
253
|
+
if (!completedRoute) {
|
|
254
|
+
issues.push(`planned route is absent from completion: ${route.id}`);
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
if (completedRoute.title !== route.title) {
|
|
258
|
+
issues.push(`route title differs for ${route.id}`);
|
|
259
|
+
}
|
|
260
|
+
if (completedRoute.startsFromWinner !== route.startsFromWinner) {
|
|
261
|
+
issues.push(`startsFromWinner differs for ${route.id}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
for (const route of completed) {
|
|
265
|
+
if (!plannedIds.has(route.id))
|
|
266
|
+
issues.push(`completion has unplanned route: ${route.id}`);
|
|
267
|
+
}
|
|
268
|
+
for (const id of htmlById.keys()) {
|
|
269
|
+
if (!plannedIds.has(id))
|
|
270
|
+
issues.push(`pages directory has unplanned HTML route: ${id}`);
|
|
271
|
+
}
|
|
272
|
+
const winnerRoutes = planned.filter((route) => route.startsFromWinner);
|
|
273
|
+
if (winnerRoutes.length !== 1) {
|
|
274
|
+
issues.push(`branch plan has ${winnerRoutes.length} startsFromWinner routes; expected 1`);
|
|
275
|
+
}
|
|
276
|
+
const realRoutes = [];
|
|
277
|
+
const missingRoutes = [];
|
|
278
|
+
const partialRoutes = [];
|
|
279
|
+
for (const route of planned) {
|
|
280
|
+
const completedRoute = completionById.get(route.id);
|
|
281
|
+
if (!completedRoute)
|
|
282
|
+
continue;
|
|
283
|
+
const expectedFile = `${route.id}.html`;
|
|
284
|
+
const actual = htmlById.has(route.id);
|
|
285
|
+
const status = completedRoute.conversionStatus;
|
|
286
|
+
const hasOutFile = completedRoute.outFile !== undefined;
|
|
287
|
+
const partial = status === 'partial' || status === 'accepted-partial';
|
|
288
|
+
const full = status === 'succeeded';
|
|
289
|
+
if (hasOutFile && path.basename(completedRoute.outFile) !== expectedFile) {
|
|
290
|
+
issues.push(`completion outFile does not match route ${route.id}: ${path.basename(completedRoute.outFile)}`);
|
|
291
|
+
}
|
|
292
|
+
if (full && !hasOutFile)
|
|
293
|
+
issues.push(`succeeded route has no outFile: ${route.id}`);
|
|
294
|
+
if (!full && !partial && hasOutFile) {
|
|
295
|
+
issues.push(`non-surviving route has an outFile: ${route.id} (${status ?? 'missing status'})`);
|
|
296
|
+
}
|
|
297
|
+
if (hasOutFile !== actual) {
|
|
298
|
+
issues.push(`completion outFile and pages directory disagree for ${route.id}`);
|
|
299
|
+
}
|
|
300
|
+
if (actual && !full && !partial) {
|
|
301
|
+
issues.push(`HTML route has no succeeded or partial completion: ${route.id}`);
|
|
302
|
+
}
|
|
303
|
+
if (status !== undefined && !full && !partial && status !== 'failed' && status !== 'skipped') {
|
|
304
|
+
issues.push(`completion route has unknown status: ${route.id} (${status})`);
|
|
305
|
+
}
|
|
306
|
+
if (actual && hasOutFile && (full || partial)) {
|
|
307
|
+
const real = {
|
|
308
|
+
id: route.id,
|
|
309
|
+
title: route.title,
|
|
310
|
+
file: expectedFile,
|
|
311
|
+
status: partial ? status : 'succeeded',
|
|
312
|
+
};
|
|
313
|
+
realRoutes.push(real);
|
|
314
|
+
if (partial)
|
|
315
|
+
partialRoutes.push(real);
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
const file = holdingFile(route.id);
|
|
319
|
+
missingRoutes.push({ id: route.id, title: route.title, holding: file, file });
|
|
320
|
+
}
|
|
321
|
+
if (issues.length > 0) {
|
|
322
|
+
return skipContract({ snapshot, runId, detail: issues.join('; ') });
|
|
323
|
+
}
|
|
324
|
+
const terminalStatus = completionValue.status;
|
|
325
|
+
const winner = winnerRoutes[0];
|
|
326
|
+
const winnerReal = realRoutes.find((route) => route.id === winner.id);
|
|
327
|
+
const entry = winnerReal
|
|
328
|
+
? { kind: 'real', id: winner.id, title: winner.title, file: winnerReal.file }
|
|
329
|
+
: {
|
|
330
|
+
kind: 'holding',
|
|
331
|
+
id: winner.id,
|
|
332
|
+
title: winner.title,
|
|
333
|
+
file: holdingFile(winner.id),
|
|
334
|
+
};
|
|
335
|
+
if (terminalStatus === 'succeeded') {
|
|
336
|
+
const allFull = realRoutes.length === planned.length
|
|
337
|
+
&& partialRoutes.length === 0
|
|
338
|
+
&& missingRoutes.length === 0;
|
|
339
|
+
if (!allFull || entry.kind !== 'real') {
|
|
340
|
+
return skipContract({
|
|
341
|
+
snapshot,
|
|
342
|
+
runId,
|
|
343
|
+
detail: 'succeeded completion does not contain every planned route as full HTML',
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
return {
|
|
347
|
+
mode: 'complete',
|
|
348
|
+
inputDigest: snapshot.inputDigest,
|
|
349
|
+
runId,
|
|
350
|
+
routes: realRoutes,
|
|
351
|
+
entry,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
if (terminalStatus !== 'partial' && terminalStatus !== 'failed') {
|
|
355
|
+
return skipContract({
|
|
356
|
+
snapshot,
|
|
357
|
+
runId,
|
|
358
|
+
detail: `branch completion is not terminal: ${String(terminalStatus)}`,
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
if (realRoutes.length === 0) {
|
|
362
|
+
return skipContract({
|
|
363
|
+
snapshot,
|
|
364
|
+
runId,
|
|
365
|
+
noSurvivors: true,
|
|
366
|
+
detail: `terminal ${terminalStatus} branch has no surviving HTML route`,
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
const terminalClass = completionValue.terminalClass;
|
|
370
|
+
const winnerPageFailed = completionValue.winnerPageFailed;
|
|
371
|
+
if (terminalClass !== undefined && typeof terminalClass !== 'string') {
|
|
372
|
+
return skipContract({
|
|
373
|
+
snapshot,
|
|
374
|
+
runId,
|
|
375
|
+
detail: 'branch completion terminalClass is not a string',
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
if (winnerPageFailed !== undefined && typeof winnerPageFailed !== 'boolean') {
|
|
379
|
+
return skipContract({
|
|
380
|
+
snapshot,
|
|
381
|
+
runId,
|
|
382
|
+
detail: 'branch completion winnerPageFailed is not a boolean',
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
return {
|
|
386
|
+
mode: 'review',
|
|
387
|
+
inputDigest: snapshot.inputDigest,
|
|
388
|
+
runId,
|
|
389
|
+
review: {
|
|
390
|
+
terminalStatus,
|
|
391
|
+
...(typeof terminalClass === 'string' ? { terminalClass } : {}),
|
|
392
|
+
...(typeof winnerPageFailed === 'boolean' ? { winnerPageFailed } : {}),
|
|
393
|
+
expectedPageCount: planned.length,
|
|
394
|
+
availablePageCount: realRoutes.length,
|
|
395
|
+
expectedRoutes: planned.map((route) => route.id),
|
|
396
|
+
realRoutes,
|
|
397
|
+
missingRoutes,
|
|
398
|
+
partialRoutes,
|
|
399
|
+
entry,
|
|
400
|
+
},
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
//# sourceMappingURL=prototype-branch-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-branch-contract.js","sourceRoot":"","sources":["../src/prototype-branch-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAsFpE,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAoC,EAAE,CAAC,CACrE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CACrE,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,KAAc,EAAU,EAAE;IAC3C,MAAM,IAAI,GAAI,KAA+B,CAAC,IAAI,CAAC;IACnD,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AACrD,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,KAAK,EAAE,IAAY,EAAuB,EAAE;IAC5D,IAAI,CAAC;QACH,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IACzC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,C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a,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/D,GAAG,CAAC,OAAO,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACtE,iBAAiB,EAAE,OAAO,CAAC,MAAM;YACjC,kBAAkB,EAAE,UAAU,CAAC,MAAM;YACrC,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;YAChD,UAAU;YACV,aAAa;YACb,aAAa;YACb,KAAK;SACN;KACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TwelveUiPrototypeLabelClient } from './prototype-label-client.js';
|
|
2
|
+
import { runPrototypePipeline, type PrototypeRunResult } from './prototype-runner.js';
|
|
3
|
+
export type PrototypeSkippedResult = {
|
|
4
|
+
branchDir: string;
|
|
5
|
+
skipped: true;
|
|
6
|
+
statusPath: string;
|
|
7
|
+
reason: 'prototype_navigation_unreconciled' | 'prototype_navigation_no_survivors';
|
|
8
|
+
detail: string;
|
|
9
|
+
};
|
|
10
|
+
export type PrototypePoststepResult = PrototypeRunResult | PrototypeSkippedResult;
|
|
11
|
+
export declare const isPrototypeSkippedResult: (value: PrototypePoststepResult) => value is PrototypeSkippedResult;
|
|
12
|
+
/**
|
|
13
|
+
* Owns the independently resumable derived-artifact step. The core branch
|
|
14
|
+
* sentinel is never reopened: a completed branch either adopts its settled
|
|
15
|
+
* prototype fact, retries this step alone, or settles a deterministic skip.
|
|
16
|
+
*/
|
|
17
|
+
export declare const runPrototypePoststep: (args: {
|
|
18
|
+
branchDir: string;
|
|
19
|
+
resume?: boolean;
|
|
20
|
+
environment?: NodeJS.ProcessEnv;
|
|
21
|
+
homeDirectory?: string;
|
|
22
|
+
labelClient?: TwelveUiPrototypeLabelClient;
|
|
23
|
+
platform?: NodeJS.Platform;
|
|
24
|
+
signal?: AbortSignal;
|
|
25
|
+
run?: typeof runPrototypePipeline;
|
|
26
|
+
}) => Promise<PrototypePoststepResult>;
|
|
27
|
+
//# sourceMappingURL=prototype-poststep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-poststep.d.ts","sourceRoot":"","sources":["../src/prototype-poststep.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAEhF,OAAO,EAGL,oBAAoB,EACpB,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAS/B,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,IAAI,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,mCAAmC,GAAG,mCAAmC,CAAC;IAClF,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,GAAG,sBAAsB,CAAC;AAElF,eAAO,MAAM,wBAAwB,GACnC,OAAO,uBAAuB,KAC7B,KAAK,IAAI,sBAAsE,CAAC;AAwCnF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAU,MAAM;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,4BAA4B,CAAC;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,oBAAoB,CAAC;CACnC,KAAG,OAAO,CAAC,uBAAuB,CAkElC,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { resolvePrototypeBranchContract } from './prototype-branch-contract.js';
|
|
4
|
+
import { PROTOTYPE_DIRECTORY, PROTOTYPE_MANIFEST_FILENAME, runPrototypePipeline, } from './prototype-runner.js';
|
|
5
|
+
import { prototypeStatusPath, resolvePrototypeRunRecord, skipPrototypeRunRecord, startPrototypeRunRecord, } from './prototype-run-record.js';
|
|
6
|
+
import { prototypeSourceDirectory } from './prototype-source.js';
|
|
7
|
+
export const isPrototypeSkippedResult = (value) => 'skipped' in value && value.skipped === true;
|
|
8
|
+
const existingPrototypeResult = async (args) => {
|
|
9
|
+
const manifest = JSON.parse(await readFile(args.manifestPath, 'utf8'));
|
|
10
|
+
const number = (value) => (typeof value === 'number' && Number.isFinite(value) ? value : 0);
|
|
11
|
+
return {
|
|
12
|
+
branchDir: args.branchDir,
|
|
13
|
+
outputDir: path.dirname(args.manifestPath),
|
|
14
|
+
manifestPath: args.manifestPath,
|
|
15
|
+
stages: [],
|
|
16
|
+
screenCount: number(manifest.input?.semanticViewportSections),
|
|
17
|
+
labeledScreenCount: number(manifest.labels?.labeledScreens),
|
|
18
|
+
labelCostMicros: number(manifest.labels?.costMicros),
|
|
19
|
+
warnings: Array.isArray(manifest.warnings)
|
|
20
|
+
? manifest.warnings.filter((warning) => typeof warning === 'string')
|
|
21
|
+
: [],
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const skippedResult = (args) => ({
|
|
25
|
+
branchDir: args.branchDir,
|
|
26
|
+
skipped: true,
|
|
27
|
+
statusPath: prototypeStatusPath(args.branchDir),
|
|
28
|
+
reason: args.reason,
|
|
29
|
+
detail: args.detail,
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* Owns the independently resumable derived-artifact step. The core branch
|
|
33
|
+
* sentinel is never reopened: a completed branch either adopts its settled
|
|
34
|
+
* prototype fact, retries this step alone, or settles a deterministic skip.
|
|
35
|
+
*/
|
|
36
|
+
export const runPrototypePoststep = async (args) => {
|
|
37
|
+
const branchDir = path.resolve(args.branchDir);
|
|
38
|
+
const sourceDir = await prototypeSourceDirectory(branchDir);
|
|
39
|
+
const contract = await resolvePrototypeBranchContract({ branchDir, sourceDir });
|
|
40
|
+
const legacyManifestPath = path.join(branchDir, PROTOTYPE_DIRECTORY, PROTOTYPE_MANIFEST_FILENAME);
|
|
41
|
+
if (args.resume) {
|
|
42
|
+
const resolution = await resolvePrototypeRunRecord({
|
|
43
|
+
branchDir,
|
|
44
|
+
inputDigest: contract.inputDigest,
|
|
45
|
+
legacyManifestPath,
|
|
46
|
+
});
|
|
47
|
+
if (resolution.action === 'settled') {
|
|
48
|
+
if (resolution.reason === 'skipped' && resolution.record?.status === 'skipped') {
|
|
49
|
+
return skippedResult({
|
|
50
|
+
branchDir,
|
|
51
|
+
reason: resolution.record.reason,
|
|
52
|
+
detail: resolution.record.detail ?? 'Prototype generation was deterministically skipped.',
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (resolution.manifestPath) {
|
|
56
|
+
try {
|
|
57
|
+
return await existingPrototypeResult({
|
|
58
|
+
branchDir,
|
|
59
|
+
manifestPath: resolution.manifestPath,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// A path alone is not a valid manifest fact. Rebuild only this local
|
|
64
|
+
// post-step; the core branch completion remains untouched.
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (contract.mode === 'skip') {
|
|
70
|
+
const running = await startPrototypeRunRecord({
|
|
71
|
+
branchDir,
|
|
72
|
+
runId: contract.runId || 'unresolved',
|
|
73
|
+
inputDigest: contract.inputDigest,
|
|
74
|
+
});
|
|
75
|
+
await skipPrototypeRunRecord({
|
|
76
|
+
branchDir,
|
|
77
|
+
running,
|
|
78
|
+
reason: contract.reason,
|
|
79
|
+
detail: contract.detail,
|
|
80
|
+
});
|
|
81
|
+
return skippedResult({
|
|
82
|
+
branchDir,
|
|
83
|
+
reason: contract.reason,
|
|
84
|
+
detail: contract.detail,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return (args.run ?? runPrototypePipeline)({
|
|
88
|
+
branchDir,
|
|
89
|
+
contract,
|
|
90
|
+
...(args.environment ? { environment: args.environment } : {}),
|
|
91
|
+
...(args.homeDirectory ? { homeDirectory: args.homeDirectory } : {}),
|
|
92
|
+
...(args.labelClient ? { labelClient: args.labelClient } : {}),
|
|
93
|
+
...(args.platform ? { platform: args.platform } : {}),
|
|
94
|
+
...(args.signal ? { signal: args.signal } : {}),
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=prototype-poststep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prototype-poststep.js","sourceRoot":"","sources":["../src/prototype-poststep.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,oBAAoB,GAErB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAYjE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,KAA8B,EACG,EAAE,CAAC,SAAS,IAAI,KAAK,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI,CAAC;AAEnF,MAAM,uBAAuB,GAAG,KAAK,EAAE,IAGtC,EAA+B,EAAE;IAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAIpE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,CAAC,WAAW;SAClC,CAAC,CAAC;QACH,MAAM,sBAAsB,CAAC;YAC3B,SAAS;YACT,OAAO;YACP,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,CAAC,CAAC;QACH,OAAO,aAAa,CAAC;YACnB,SAAS;YACT,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,oBAAoB,CAAC,CAAC;QACxC,SAAS;QACT,QAAQ;QACR,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACpE,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChD,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The prototype post-step is deliberately recorded separately from the branch
|
|
3
|
+
* run. A branch can be settled while this optional derived artifact is still
|
|
4
|
+
* running, failed, or ready to retry.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PROTOTYPE_STATUS_FILENAME = "prototype.status.json";
|
|
7
|
+
type PrototypeRunRecordBase = {
|
|
8
|
+
version: 1;
|
|
9
|
+
runId: string;
|
|
10
|
+
inputDigest: string;
|
|
11
|
+
attempt: number;
|
|
12
|
+
startedAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
};
|
|
15
|
+
export type PrototypeRunError = {
|
|
16
|
+
name: string;
|
|
17
|
+
message: string;
|
|
18
|
+
stack?: string;
|
|
19
|
+
};
|
|
20
|
+
export type PrototypeRunningRunRecord = PrototypeRunRecordBase & {
|
|
21
|
+
status: 'running';
|
|
22
|
+
};
|
|
23
|
+
export type PrototypeSucceededRunRecord = PrototypeRunRecordBase & {
|
|
24
|
+
status: 'succeeded';
|
|
25
|
+
manifestPath: string;
|
|
26
|
+
};
|
|
27
|
+
export type PrototypeFailedRunRecord = PrototypeRunRecordBase & {
|
|
28
|
+
status: 'failed';
|
|
29
|
+
error: PrototypeRunError;
|
|
30
|
+
};
|
|
31
|
+
export type PrototypeSkippedRunRecord = PrototypeRunRecordBase & {
|
|
32
|
+
status: 'skipped';
|
|
33
|
+
reason: string;
|
|
34
|
+
detail?: string;
|
|
35
|
+
};
|
|
36
|
+
export type PrototypeRunRecord = PrototypeRunningRunRecord | PrototypeSucceededRunRecord | PrototypeFailedRunRecord | PrototypeSkippedRunRecord;
|
|
37
|
+
export type PrototypeRunResolution = {
|
|
38
|
+
action: 'retry';
|
|
39
|
+
reason: 'missing' | 'input-changed' | 'running' | 'failed' | 'manifest-missing';
|
|
40
|
+
record?: PrototypeRunRecord;
|
|
41
|
+
} | {
|
|
42
|
+
action: 'settled';
|
|
43
|
+
reason: 'legacy-manifest' | 'succeeded' | 'skipped';
|
|
44
|
+
adoptable: boolean;
|
|
45
|
+
manifestPath?: string;
|
|
46
|
+
record?: PrototypeRunRecord;
|
|
47
|
+
};
|
|
48
|
+
export declare const prototypeStatusPath: (branchDir: string) => string;
|
|
49
|
+
export declare const readPrototypeRunRecord: (branchDir: string) => Promise<PrototypeRunRecord | undefined>;
|
|
50
|
+
/**
|
|
51
|
+
* A synced temporary inode is renamed over the destination, then the parent
|
|
52
|
+
* directory is synced. Readers therefore see the previous whole record or the
|
|
53
|
+
* next whole record, and the rename survives a process or machine interruption.
|
|
54
|
+
*/
|
|
55
|
+
export declare const writePrototypeRunRecord: (branchDir: string, record: PrototypeRunRecord) => Promise<void>;
|
|
56
|
+
export declare const startPrototypeRunRecord: (args: {
|
|
57
|
+
branchDir: string;
|
|
58
|
+
runId: string;
|
|
59
|
+
inputDigest: string;
|
|
60
|
+
now?: () => Date;
|
|
61
|
+
}) => Promise<PrototypeRunningRunRecord>;
|
|
62
|
+
export declare const succeedPrototypeRunRecord: (args: {
|
|
63
|
+
branchDir: string;
|
|
64
|
+
running: PrototypeRunningRunRecord;
|
|
65
|
+
manifestPath: string;
|
|
66
|
+
now?: () => Date;
|
|
67
|
+
}) => Promise<PrototypeSucceededRunRecord>;
|
|
68
|
+
export declare const failPrototypeRunRecord: (args: {
|
|
69
|
+
branchDir: string;
|
|
70
|
+
running: PrototypeRunningRunRecord;
|
|
71
|
+
error: unknown;
|
|
72
|
+
now?: () => Date;
|
|
73
|
+
}) => Promise<PrototypeFailedRunRecord>;
|
|
74
|
+
export declare const skipPrototypeRunRecord: (args: {
|
|
75
|
+
branchDir: string;
|
|
76
|
+
running: PrototypeRunningRunRecord;
|
|
77
|
+
reason: string;
|
|
78
|
+
detail?: string;
|
|
79
|
+
now?: () => Date;
|
|
80
|
+
}) => Promise<PrototypeSkippedRunRecord>;
|
|
81
|
+
/**
|
|
82
|
+
* Decide whether a caller can adopt a settled prototype or must run it again.
|
|
83
|
+
* A legacy manifest remains adoptable only while no sidecar exists; once a
|
|
84
|
+
* sidecar exists, its digest and status are authoritative.
|
|
85
|
+
*/
|
|
86
|
+
export declare const resolvePrototypeRunRecord: (args: {
|
|
87
|
+
branchDir: string;
|
|
88
|
+
inputDigest: string;
|
|
89
|
+
legacyManifestPath: string;
|
|
90
|
+
}) => Promise<PrototypeRunResolution>;
|
|
91
|
+
export {};
|
|
92
|
+
//# sourceMappingURL=prototype-run-record.d.ts.map
|