@melite/estate-queue 0.0.0-stage → 0.1.4-alpha
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/LICENSE +557 -0
- package/lib/bakeParams.d.ts +17 -0
- package/lib/bakeParams.js +182 -0
- package/lib/bench.d.ts +24 -0
- package/lib/bench.js +121 -0
- package/lib/cardsArmError.d.ts +18 -0
- package/lib/cardsArmError.js +33 -0
- package/lib/cardsCompose.d.ts +41 -0
- package/lib/cardsCompose.js +247 -0
- package/lib/cardsDangling.d.ts +16 -0
- package/lib/cardsDangling.js +168 -0
- package/lib/cardsFacts.d.ts +74 -0
- package/lib/cardsFacts.js +64 -0
- package/lib/cardsLanes.d.ts +33 -0
- package/lib/cardsLanes.js +115 -0
- package/lib/cardsRegistry.d.ts +316 -0
- package/lib/cardsRegistry.js +1274 -0
- package/lib/cardsVariant.d.ts +28 -0
- package/lib/cardsVariant.js +190 -0
- package/lib/discloseRegistry.d.ts +94 -0
- package/lib/discloseRegistry.js +154 -0
- package/lib/filmLead.d.ts +4 -0
- package/lib/filmLead.js +17 -0
- package/lib/filmMemoryWarn.d.ts +27 -0
- package/lib/filmMemoryWarn.js +99 -0
- package/lib/flowsData.d.ts +179 -0
- package/lib/flowsData.js +547 -0
- package/lib/flowsFamilyCompose.d.ts +48 -0
- package/lib/flowsFamilyCompose.js +191 -0
- package/lib/flowsRegistryRows.d.ts +10 -0
- package/lib/flowsRegistryRows.js +378 -0
- package/lib/index.d.ts +50 -0
- package/lib/index.js +66 -0
- package/lib/ledgerTail.d.ts +20 -0
- package/lib/ledgerTail.js +123 -0
- package/lib/loadPlane.d.ts +93 -0
- package/lib/loadPlane.js +553 -0
- package/lib/loadRegistry.d.ts +22 -0
- package/lib/loadRegistry.js +55 -0
- package/lib/manageOps.d.ts +21 -0
- package/lib/manageOps.js +142 -0
- package/lib/managePlane.d.ts +120 -0
- package/lib/managePlane.js +1515 -0
- package/lib/manageProbe.d.ts +57 -0
- package/lib/manageProbe.js +154 -0
- package/lib/manageRegistry.d.ts +28 -0
- package/lib/manageRegistry.js +75 -0
- package/lib/managerRail.d.ts +33 -0
- package/lib/managerRail.js +91 -0
- package/lib/mediaKinds.d.ts +3 -0
- package/lib/mediaKinds.js +2 -0
- package/lib/queue.d.ts +9 -0
- package/lib/queue.js +76 -0
- package/lib/queueCore.d.ts +69 -0
- package/lib/queueCore.js +124 -0
- package/lib/queueLifecycle.d.ts +26 -0
- package/lib/queueLifecycle.js +65 -0
- package/lib/queueLock.d.ts +54 -0
- package/lib/queueLock.js +195 -0
- package/lib/queueResurrect.d.ts +59 -0
- package/lib/queueResurrect.js +249 -0
- package/lib/queueRetry.d.ts +36 -0
- package/lib/queueRetry.js +24 -0
- package/lib/queueSidecar.d.ts +145 -0
- package/lib/queueSidecar.js +182 -0
- package/lib/queueSubmit.d.ts +31 -0
- package/lib/queueSubmit.js +117 -0
- package/lib/queueSweep.d.ts +30 -0
- package/lib/queueSweep.js +121 -0
- package/lib/resurrect.d.ts +6 -0
- package/lib/resurrect.js +18 -0
- package/lib/rootsManifest.d.ts +11 -0
- package/lib/rootsManifest.js +11 -0
- package/lib/runStatus.d.ts +7 -0
- package/lib/runStatus.js +21 -0
- package/lib/runsChange.d.ts +53 -0
- package/lib/runsChange.js +63 -0
- package/lib/runsErrorCodes.d.ts +2 -0
- package/lib/runsErrorCodes.js +15 -0
- package/lib/runsExecute.d.ts +26 -0
- package/lib/runsExecute.js +356 -0
- package/lib/runsGates.d.ts +161 -0
- package/lib/runsGates.js +306 -0
- package/lib/runsList.d.ts +78 -0
- package/lib/runsList.js +580 -0
- package/lib/runsRefusalVoices.d.ts +9 -0
- package/lib/runsRefusalVoices.js +44 -0
- package/lib/runsRegistry.d.ts +253 -0
- package/lib/runsRegistry.js +1750 -0
- package/lib/runsSourceEcho.d.ts +54 -0
- package/lib/runsSourceEcho.js +275 -0
- package/lib/runsStart.d.ts +121 -0
- package/lib/runsStart.js +528 -0
- package/lib/runsTypes.d.ts +183 -0
- package/lib/runsTypes.js +282 -0
- package/lib/runsValidate.d.ts +5 -0
- package/lib/runsValidate.js +31 -0
- package/lib/runsValidateArms.d.ts +7 -0
- package/lib/runsValidateArms.js +285 -0
- package/lib/runsValidateInline.d.ts +6 -0
- package/lib/runsValidateInline.js +82 -0
- package/lib/runsValidateRefusals.d.ts +7 -0
- package/lib/runsValidateRefusals.js +18 -0
- package/lib/runsValidateServe.d.ts +15 -0
- package/lib/runsValidateServe.js +254 -0
- package/lib/runsValidateShared.d.ts +84 -0
- package/lib/runsValidateShared.js +88 -0
- package/lib/runsValidateStages.d.ts +25 -0
- package/lib/runsValidateStages.js +491 -0
- package/lib/runsValidateSweeps.d.ts +6 -0
- package/lib/runsValidateSweeps.js +143 -0
- package/lib/service.d.ts +45 -0
- package/lib/service.js +81 -0
- package/lib/skillFrontmatter.d.ts +11 -0
- package/lib/skillFrontmatter.js +46 -0
- package/lib/skillFs.d.ts +19 -0
- package/lib/skillFs.js +80 -0
- package/lib/skillPlane.d.ts +98 -0
- package/lib/skillPlane.js +263 -0
- package/lib/skillRegistry.d.ts +23 -0
- package/lib/skillRegistry.js +55 -0
- package/lib/skillRows.d.ts +126 -0
- package/lib/skillRows.js +466 -0
- package/lib/toolProjection.d.ts +30 -0
- package/lib/toolProjection.js +142 -0
- package/lib/vocab.d.ts +6 -0
- package/lib/vocab.js +18 -0
- package/package.json +47 -4
- package/README.md +0 -3
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { CARD_PLANE_ENGINE } from "@melite/contracts/benchStage";
|
|
2
|
+
import { loadCardDefs, needComfyUI, spliceWorkflow } from "@melite/comfyui-cordis";
|
|
3
|
+
import { errText, runRel } from "./runsTypes.js";
|
|
4
|
+
import { notifyRunChanged } from "./runsChange.js";
|
|
5
|
+
import { engineFilmName } from "./filmLead.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
export function declaredPrimaryFirst(names, stem) {
|
|
22
|
+
if (stem === undefined || stem === "")
|
|
23
|
+
return names;
|
|
24
|
+
const token = new RegExp("(^|_)" + stem.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "(_[0-9]|\\.|$)");
|
|
25
|
+
const hero = names.find((n) => {
|
|
26
|
+
const base = n.slice(n.lastIndexOf("/") + 1);
|
|
27
|
+
return token.test(base);
|
|
28
|
+
});
|
|
29
|
+
if (hero === undefined)
|
|
30
|
+
return names;
|
|
31
|
+
return [hero, ...names.filter((n) => n !== hero)];
|
|
32
|
+
}
|
|
33
|
+
/** One run through the merged path (door-verbatim: stages ->
|
|
34
|
+
* running + merged:true, splice rows, ONE executeFlow submit,
|
|
35
|
+
* per-stage harvest + result_outputs, the stop-gated terminal
|
|
36
|
+
* mapping, the settle persist). */
|
|
37
|
+
export async function runOne(run, ctx, settle) {
|
|
38
|
+
run.status = "running";
|
|
39
|
+
for (const stage of run.stages) {
|
|
40
|
+
stage["status"] = "running";
|
|
41
|
+
stage["merged"] = true;
|
|
42
|
+
}
|
|
43
|
+
const inputNames = run.inputNames ?? {};
|
|
44
|
+
// THE ENGINE-GENERICS DISPATCH (stroke 53): the 'engines' seat
|
|
45
|
+
// governs when mounted — the executor owns graph surgery
|
|
46
|
+
// (splice inside the adapter), the tap, and the merged submit.
|
|
47
|
+
// Seat-less boots (fixtures, walls) keep the pre-seam direct
|
|
48
|
+
// path byte-for-byte. Runs stay single-engine today: the
|
|
49
|
+
// single-stage gateway constraint means one run names one
|
|
50
|
+
// engine; mixed-engine grouping arrives with the MCP executor.
|
|
51
|
+
const enginesSeat = ctx.get("engines");
|
|
52
|
+
let seatExecutor = null;
|
|
53
|
+
if (enginesSeat !== undefined &&
|
|
54
|
+
typeof enginesSeat.resolve === "function") {
|
|
55
|
+
// resolve() throws LOUD on an unknown id (the contract's
|
|
56
|
+
// miswire voice) — INSIDE the splice-catch scope so the run
|
|
57
|
+
// settles failed and the pump SURVIVES: outside it, the throw
|
|
58
|
+
// escaped runOne with activeId still held, and every future
|
|
59
|
+
// tryDequeue returned null — all inference bricked until
|
|
60
|
+
// restart (audit R1, stroke 82).
|
|
61
|
+
try {
|
|
62
|
+
seatExecutor = enginesSeat.resolve(runEngine(run)).executor;
|
|
63
|
+
}
|
|
64
|
+
catch (exc) {
|
|
65
|
+
const text = errText(exc);
|
|
66
|
+
for (const stage of run.stages) {
|
|
67
|
+
// (every stage reads running — runOne stamps them before
|
|
68
|
+
// the engine call, so this fence never filters.)
|
|
69
|
+
/* v8 ignore next */
|
|
70
|
+
if (stage["status"] === "running") {
|
|
71
|
+
stage["status"] = "failed";
|
|
72
|
+
stage["error"] = text;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
run.status = "failed";
|
|
76
|
+
run.error = text;
|
|
77
|
+
await settle(run);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
let rows;
|
|
82
|
+
try {
|
|
83
|
+
rows = seatExecutor !== null ? [] : run.stages.map((stage, i) => ({
|
|
84
|
+
stageId: stage.id,
|
|
85
|
+
card: typeof stage["card"] === "string" && stage["card"] !== ""
|
|
86
|
+
? stage["card"]
|
|
87
|
+
: typeof run.cardId === "string" && run.cardId !== ""
|
|
88
|
+
? run.cardId
|
|
89
|
+
: undefined,
|
|
90
|
+
workflow: spliceWorkflow(run.params[i]),
|
|
91
|
+
outputs: { ...stage.outputs },
|
|
92
|
+
outputNodes: { ...run.outputNodes[i] },
|
|
93
|
+
params: { ...run.params[i] },
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
catch (exc) {
|
|
97
|
+
// splice refusal pre-submit: the run fails with the
|
|
98
|
+
// planner's text (the per-stage fallback loop is later
|
|
99
|
+
// scope).
|
|
100
|
+
const text = errText(exc);
|
|
101
|
+
for (const stage of run.stages) {
|
|
102
|
+
// (every stage reads running — runOne stamps them just
|
|
103
|
+
// above, so the fence never filters.)
|
|
104
|
+
/* v8 ignore next */
|
|
105
|
+
if (stage["status"] === "running") {
|
|
106
|
+
stage["status"] = "failed";
|
|
107
|
+
stage["error"] = text;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
run.status = "failed";
|
|
111
|
+
run.error = text;
|
|
112
|
+
await settle(run);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
// call is a wall someone remembered to build, not the schema
|
|
118
|
+
// system). The rows are BUILT here, in the run seat, before any
|
|
119
|
+
// engine action — so the doc-walk judges HERE, in the same
|
|
120
|
+
// fence as the splice refusal above: every stage's graph names
|
|
121
|
+
// only class_types and inputs the engine's own /object_info
|
|
122
|
+
// declares, in the run's voice, before the first wire moves.
|
|
123
|
+
// (The merge that follows namespaces ids and resolves $spells
|
|
124
|
+
// into link VALUES — it adds no names, so the rows' name
|
|
125
|
+
// surface is the engine's.) The judge is the wiring service's
|
|
126
|
+
// own wall — ONE owner (wiringWall.ts), the same walk the
|
|
127
|
+
// card-compose seat has always had, now at the seat every path
|
|
128
|
+
// (start, restore, queue replay) already walks. NO SEAT-BRANCH
|
|
129
|
+
// GATE (the audit's finding: the first cut walked only when
|
|
130
|
+
// seatExecutor was null, and production ALWAYS takes the seat
|
|
131
|
+
// path — the wall was dead on the lane).
|
|
132
|
+
//
|
|
133
|
+
// AND THE CLAIM WAS FALSE UNTIL NOW (the coverage audit's HIGH
|
|
134
|
+
// finding, proven live by two independent probes: seat-mounted +
|
|
135
|
+
// armed doc + a graph naming an undeclared class_type → the run
|
|
136
|
+
// COMPLETED and the engine was submitted). `rows` is `[]` on the
|
|
137
|
+
// seat path, so this loop iterated ZERO times in production while
|
|
138
|
+
// the comment above claimed "the rows walk on BOTH paths here".
|
|
139
|
+
// The adapter's post-splice walk caught the poison anyway, which
|
|
140
|
+
// is why nobody saw it — but the run seat's own voice (naming the
|
|
141
|
+
// STAGE, before the engine is ever touched) never fired on the
|
|
142
|
+
// lane, and a composition without the adapter would submit poison
|
|
143
|
+
// with the suite green.
|
|
144
|
+
//
|
|
145
|
+
// The fence therefore judges ONE GRAPH per stage on BOTH paths:
|
|
146
|
+
// the spliced rows where the seat path already built them, and
|
|
147
|
+
// the SEAT path's own splice of the stage params HERE — because
|
|
148
|
+
// the compiled params are the ENVELOPE {workflow, output_nodes},
|
|
149
|
+
// not the graph. The first cut walked the envelope raw and every
|
|
150
|
+
// object-valued param became a PHANTOM NODE: an armed doc
|
|
151
|
+
// refused every seat-path run as "card 'flow' built node
|
|
152
|
+
// 'workflow' with no class_type — the graph is not addressable"
|
|
153
|
+
|
|
154
|
+
// refused by a wall judging its own envelope). The same cut
|
|
155
|
+
// named the card from a stage row that carries none, falling
|
|
156
|
+
// back to the invented 'flow'. The walk now names the REAL
|
|
157
|
+
// card: the stage's own card when stamped, the record's cardId
|
|
158
|
+
// (registration's own law: stamped for card runs, absent for
|
|
159
|
+
// inline — never a guess), the stage id last.
|
|
160
|
+
// Unarmed (no wiring service in the composition): the wall
|
|
161
|
+
// stands down — the standing law.
|
|
162
|
+
const wiring = ctx.get("comfyuiWiring");
|
|
163
|
+
// UNARMED, THE WHOLE FENCE STANDS DOWN — splice included (the
|
|
164
|
+
|
|
165
|
+
// wall's own stand-down, so a lane whose /object_info fetch
|
|
166
|
+
// failed — wall disarmed, judgment forbidden — still refused
|
|
167
|
+
// runs with the SPLICE's compose voice. A/B: an unarmed
|
|
168
|
+
// mcp:blender run completed before the cut and failed after,
|
|
169
|
+
// the executor never called. armed() mirrors the wall's own
|
|
170
|
+
// doc-null stand-down; assert() re-checks it inside.)
|
|
171
|
+
if (wiring !== undefined && wiring.armed()) {
|
|
172
|
+
for (let i = 0; i < run.stages.length; i++) {
|
|
173
|
+
const stage = run.stages[i];
|
|
174
|
+
// THE WALK IS A COMFY-GRAPH LAW: the stage's OWN engine token
|
|
175
|
+
// is the discriminator (runEngine's rule, per stage). Absent
|
|
176
|
+
// or card-plane → the compiled params are the comfy envelope;
|
|
177
|
+
// anything else is a foreign lane (mcp/craft/agent) whose tool
|
|
178
|
+
// params are NOT a graph — its seats own its voices, and this
|
|
179
|
+
// wall never judges it, armed or not.
|
|
180
|
+
const eng = stage["engine"];
|
|
181
|
+
if (rows.length === 0 &&
|
|
182
|
+
typeof eng === "string" &&
|
|
183
|
+
eng !== "" &&
|
|
184
|
+
eng !== CARD_PLANE_ENGINE) {
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
try {
|
|
188
|
+
const graph = rows.length > 0
|
|
189
|
+
? rows[i].workflow
|
|
190
|
+
: spliceWorkflow((run.params[i] ?? {}));
|
|
191
|
+
wiring.assert(String(stage["card"] ?? run.cardId ?? stage.id), graph);
|
|
192
|
+
}
|
|
193
|
+
catch (exc) {
|
|
194
|
+
const text = errText(exc);
|
|
195
|
+
for (const st of run.stages) {
|
|
196
|
+
// (same fence as the splice-catch above — every stage is
|
|
197
|
+
// still running when this splice reports.)
|
|
198
|
+
/* v8 ignore next */
|
|
199
|
+
if (st["status"] === "running") {
|
|
200
|
+
st["status"] = "failed";
|
|
201
|
+
st["error"] = text;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
run.status = "failed";
|
|
205
|
+
run.error = text;
|
|
206
|
+
await settle(run);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
|
|
213
|
+
// the comfyui progress webhooks like before"): the engine
|
|
214
|
+
// drains its tap into this callback; the merged submit mints
|
|
215
|
+
// ONE prompt, so every stage row shares the same live fold
|
|
216
|
+
// (status serves stages VERBATIM — the poll rides the
|
|
217
|
+
// existing door, no new wire verb). Hoisted for both paths.
|
|
218
|
+
const report = (updates) => {
|
|
219
|
+
const act = updates["activity"];
|
|
220
|
+
const prog = updates["progress"];
|
|
221
|
+
const pRec = typeof prog === "object" && prog !== null && !Array.isArray(prog)
|
|
222
|
+
? prog
|
|
223
|
+
: null;
|
|
224
|
+
for (const stage of run.stages) {
|
|
225
|
+
if (typeof act === "string" && act !== "")
|
|
226
|
+
stage["activity"] = act;
|
|
227
|
+
if (pRec !== null &&
|
|
228
|
+
typeof pRec["value"] === "number" &&
|
|
229
|
+
typeof pRec["max"] === "number") {
|
|
230
|
+
stage["progress"] = { value: pRec["value"], max: pRec["max"] };
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
const shouldStop = () => run.stopFlag;
|
|
235
|
+
let result;
|
|
236
|
+
if (seatExecutor !== null) {
|
|
237
|
+
// The seat path: engine-agnostic rows — the adapter splices
|
|
238
|
+
// (its splice refusal lands in this same catch: the run
|
|
239
|
+
// fails with the planner's text, stages failed, settled).
|
|
240
|
+
const genericRows = run.stages.map((stage, i) => ({
|
|
241
|
+
stageId: stage.id,
|
|
242
|
+
// the card label for the adapter's walk voice — the
|
|
243
|
+
// SAME preference chain the estate fence above uses
|
|
244
|
+
// (stage's own card, then the run's, then the stage id
|
|
245
|
+
// for flow stages that never had one)
|
|
246
|
+
card: typeof stage["card"] === "string" && stage["card"] !== ""
|
|
247
|
+
? stage["card"]
|
|
248
|
+
: typeof run.cardId === "string" && run.cardId !== ""
|
|
249
|
+
? run.cardId
|
|
250
|
+
: undefined,
|
|
251
|
+
outputs: { ...stage.outputs },
|
|
252
|
+
params: { ...run.params[i] },
|
|
253
|
+
}));
|
|
254
|
+
const outcome = await seatExecutor.executeStages(genericRows, run.dir, inputNames, { shouldStop, report },
|
|
255
|
+
// The run's request initials ride every engine submit: the
|
|
256
|
+
// gate-blessed values the start door extracted for this
|
|
257
|
+
// flow's declared initials, so `$spell` params resolve at
|
|
258
|
+
// the engine's merge. Engines whose param dialect has no
|
|
259
|
+
// `$spells` ignore the record.
|
|
260
|
+
run.initials);
|
|
261
|
+
result = {
|
|
262
|
+
stages: Object.fromEntries(outcome.stages.map((s) => [
|
|
263
|
+
s.stageId,
|
|
264
|
+
{ outputs: s.outputs, artifacts: [...s.artifacts] },
|
|
265
|
+
])),
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
const engine = needComfyUI(ctx, "runsRemote worker");
|
|
270
|
+
const nodeCount = rows.reduce((n, r) => n + Object.keys(r.workflow).length, 0);
|
|
271
|
+
for (const stage of run.stages) {
|
|
272
|
+
stage["activity"] =
|
|
273
|
+
"merged submit (" + rows.length + " stages, " + nodeCount + " nodes)";
|
|
274
|
+
}
|
|
275
|
+
// Same law as the seat path above: the run's request initials
|
|
276
|
+
// resolve the `$spells` at this merge.
|
|
277
|
+
result = await engine.executeFlow(rows, run.dir, inputNames, run.initials, {
|
|
278
|
+
shouldStop,
|
|
279
|
+
report,
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
for (const stage of run.stages) {
|
|
283
|
+
const row = result.stages[stage.id] ?? { outputs: {}, artifacts: [] };
|
|
284
|
+
const arts = row.artifacts.filter((a) => a !== "");
|
|
285
|
+
run.artifacts.push(...arts);
|
|
286
|
+
notifyRunChanged(run.runId);
|
|
287
|
+
if (arts.length > 0) {
|
|
288
|
+
// DIVERGENCE-BY-ORDER: run-relative names, no /v1 prefix
|
|
289
|
+
// (the asset HTTP face died with the app).
|
|
290
|
+
let names = arts.map((a) => runRel(run, a));
|
|
291
|
+
|
|
292
|
+
// when the disk-stitch valve died): when the engine
|
|
293
|
+
// composed the film (h3_t4_film), presentation order is the
|
|
294
|
+
// harness's only job — film first, windows after. No mux,
|
|
295
|
+
// no mix, never a shell ffmpeg: composition belongs to the
|
|
296
|
+
// engine (the film-assemble stage's model-free workflow).
|
|
297
|
+
const semanticNames = new Set(Object.values(row.outputs)
|
|
298
|
+
.filter((value) => typeof value === 'string' && value !== '')
|
|
299
|
+
.map((value) => runRel(run, value)));
|
|
300
|
+
const semantic = names.find((name) => semanticNames.has(name));
|
|
301
|
+
if (semantic !== undefined) {
|
|
302
|
+
names = [semantic, ...names.filter((name) => name !== semantic)];
|
|
303
|
+
}
|
|
304
|
+
const engineFilm = engineFilmName(names);
|
|
305
|
+
if (engineFilm !== null && names[0] !== engineFilm) {
|
|
306
|
+
names = [engineFilm, ...names.filter((name) => name !== engineFilm)];
|
|
307
|
+
}
|
|
308
|
+
const stem = run.cardId !== undefined
|
|
309
|
+
? (await loadCardDefs()).get(run.cardId)?.primaryFile
|
|
310
|
+
: undefined;
|
|
311
|
+
names = declaredPrimaryFirst(names, stem);
|
|
312
|
+
|
|
313
|
+
// provenance law: every artifact traces to a composition
|
|
314
|
+
// of cards — no harness ffmpeg ever owned the film. The
|
|
315
|
+
// film is assembled IN-GRAPH (the film-assemble stage's
|
|
316
|
+
// model-free workflow: MeliteLoadVideo + the Melite audio
|
|
317
|
+
// chain + CreateVideo/SaveVideo h3_t4_film); the harness's
|
|
318
|
+
// only job here is presentation order.)
|
|
319
|
+
stage["url"] = names[0];
|
|
320
|
+
stage["gallery"] = names.map((n) => ({ name: n }));
|
|
321
|
+
}
|
|
322
|
+
stage["result_outputs"] = { ...row.outputs };
|
|
323
|
+
stage["status"] = "completed";
|
|
324
|
+
delete stage["progress"];
|
|
325
|
+
delete stage["activity"];
|
|
326
|
+
}
|
|
327
|
+
run.status = run.stopFlag ? "stopped" : "completed";
|
|
328
|
+
await settle(run);
|
|
329
|
+
}
|
|
330
|
+
catch (exc) {
|
|
331
|
+
const text = errText(exc);
|
|
332
|
+
const stopped = run.stopFlag && text.toLowerCase().includes("stop");
|
|
333
|
+
for (const stage of run.stages) {
|
|
334
|
+
// (same fence as the splice-catch above — every stage is
|
|
335
|
+
// still running here.)
|
|
336
|
+
/* v8 ignore next */
|
|
337
|
+
if (stage["status"] === "running") {
|
|
338
|
+
stage["status"] = stopped ? "stopped" : "failed";
|
|
339
|
+
stage["error"] = text;
|
|
340
|
+
}
|
|
341
|
+
delete stage["progress"];
|
|
342
|
+
delete stage["activity"];
|
|
343
|
+
}
|
|
344
|
+
run.status = stopped ? "stopped" : "failed";
|
|
345
|
+
if (!stopped)
|
|
346
|
+
run.error = text;
|
|
347
|
+
await settle(run);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
export function runEngine(run) {
|
|
351
|
+
const first = run.stages[0];
|
|
352
|
+
const engine = first?.["engine"];
|
|
353
|
+
// the card plane engine is the contract value (one owner per token)
|
|
354
|
+
return typeof engine === "string" && engine !== "" ? engine : CARD_PLANE_ENGINE;
|
|
355
|
+
}
|
|
356
|
+
//# sourceMappingURL=runsExecute.js.map
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
export { RETIRED_RUNNER_KNOBS, RETIRED_CARRY_KEYS, DOOR_KEYS } from "./vocab.js";
|
|
2
|
+
import { STAGE_PATCH_KEYS } from "@melite/contracts/benchStage";
|
|
3
|
+
export { STAGE_PATCH_KEYS };
|
|
4
|
+
/** flow_inline top-level keys (the served shape). */
|
|
5
|
+
export declare const INLINE_TOP_KEYS: readonly string[];
|
|
6
|
+
/** flow_inline stage keys (extra=forbid at the door) — the
|
|
7
|
+
* CONTRACT'S list now (benchStage.ts WIRE_STAGE_KEYS): the agent's
|
|
8
|
+
* bench projection needs the same rule to build a wire row, and two
|
|
9
|
+
* copies of a door's key list is how a reader and a writer drift. */
|
|
10
|
+
export declare const STAGE_KEYS: readonly string[];
|
|
11
|
+
/** Stage/flow identifier shape. */
|
|
12
|
+
export declare const FLOW_ID_RE: RegExp;
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/** Draft id shape (DRAFT_ID_RE in @melite/estate-drafts spec.ts): 1..96 chars of [A-Za-z0-9_-]. */
|
|
17
|
+
export { DRAFT_ID_RE };
|
|
18
|
+
/** The strict-wire outcome: decoded text, or the exact 400 shape. */
|
|
19
|
+
export type StrictWire = {
|
|
20
|
+
text: string;
|
|
21
|
+
} | {
|
|
22
|
+
status: number;
|
|
23
|
+
payload: Record<string, unknown>;
|
|
24
|
+
};
|
|
25
|
+
/** Decode one strict body: "" decodes as {} (body.decode() or
|
|
26
|
+
* "{}"). The TEXT embeds the host parser's message — walls assert
|
|
27
|
+
* status + code + prefix, never bytes. */
|
|
28
|
+
export declare function decodeStrictBody(body: Uint8Array): StrictWire;
|
|
29
|
+
/** The strict JSON body parse — mirrors route() 4335-4340. Owned
|
|
30
|
+
* here; doors/uploads.ts re-exports it (wall-pinned address). */
|
|
31
|
+
export declare function parseStrictJson(body: Uint8Array): {
|
|
32
|
+
doc: unknown;
|
|
33
|
+
} | {
|
|
34
|
+
status: number;
|
|
35
|
+
payload: Record<string, unknown>;
|
|
36
|
+
};
|
|
37
|
+
/** Estate record check: a plain-prototype mapping, never an array,
|
|
38
|
+
* never null, never a class instance. */
|
|
39
|
+
export declare function isRecord(v: unknown): v is Record<string, unknown>;
|
|
40
|
+
/** typeof v === "string" (absent/null/non-strings refuse). */
|
|
41
|
+
export declare function isStringField(v: unknown): v is string;
|
|
42
|
+
/** typeof v === "boolean" — strict: 0/1/"true" refuse (gate). */
|
|
43
|
+
export declare function isBoolField(v: unknown): v is boolean;
|
|
44
|
+
/** typeof v === "number" — pure-JSON domain only. */
|
|
45
|
+
export declare function isNumberField(v: unknown): v is number;
|
|
46
|
+
/** Array.isArray — the closed-list shape gate. */
|
|
47
|
+
export declare function isListField(v: unknown): v is unknown[];
|
|
48
|
+
/** Dict gate: the estate isRecord FIRST (class-instance exclusion), then the
|
|
49
|
+
* schema (intent declaration — the guard carries the invariant). */
|
|
50
|
+
export declare function isDictField(v: unknown): v is Record<string, unknown>;
|
|
51
|
+
import { draftIdOk, DRAFT_ID_RE } from "@melite/estate-drafts";
|
|
52
|
+
export { draftIdOk };
|
|
53
|
+
/** The strict-body offense lists for one body. */
|
|
54
|
+
export interface StrictBodyOffense {
|
|
55
|
+
readonly bad: string[];
|
|
56
|
+
readonly carry: string[];
|
|
57
|
+
}
|
|
58
|
+
/** Split one body's keys into retired-knob vs pipe-carry offenses. */
|
|
59
|
+
export declare function checkStrictBody(body: Record<string, unknown>): StrictBodyOffense;
|
|
60
|
+
/** The uploads-body structure verdict. */
|
|
61
|
+
export type UploadsStructure = {
|
|
62
|
+
kind: "ok";
|
|
63
|
+
filename: string;
|
|
64
|
+
dataUrl: string;
|
|
65
|
+
} | {
|
|
66
|
+
kind: "not-object";
|
|
67
|
+
} | {
|
|
68
|
+
kind: "bad-filename";
|
|
69
|
+
} | {
|
|
70
|
+
kind: "bad-data";
|
|
71
|
+
};
|
|
72
|
+
/** Structure-gate one uploads doc (content rules stay in the door). */
|
|
73
|
+
export declare function checkUploadsStructure(doc: unknown): UploadsStructure;
|
|
74
|
+
/** Static verdict→voice table for the uploads door (every arm is
|
|
75
|
+
* fully static — the door does one lookup, no if-chain). */
|
|
76
|
+
export declare const UPLOADS_VOICE: Record<Exclude<UploadsStructure["kind"], "ok">, string>;
|
|
77
|
+
/** The start-envelope structure verdict. */
|
|
78
|
+
export type FlowsStartEnvelope = {
|
|
79
|
+
kind: "ok";
|
|
80
|
+
body: Record<string, unknown>;
|
|
81
|
+
testFlag: boolean;
|
|
82
|
+
} | {
|
|
83
|
+
kind: "not-object";
|
|
84
|
+
doc: unknown;
|
|
85
|
+
} | {
|
|
86
|
+
kind: "bad-test";
|
|
87
|
+
testFlag: unknown;
|
|
88
|
+
} | {
|
|
89
|
+
kind: "missing-draft";
|
|
90
|
+
} | {
|
|
91
|
+
kind: "malformed-draft";
|
|
92
|
+
draftId: string;
|
|
93
|
+
};
|
|
94
|
+
/** Structure-gate one start doc (draft lookup stays in the door). */
|
|
95
|
+
export declare function checkFlowsStartEnvelope(doc: unknown): FlowsStartEnvelope;
|
|
96
|
+
/** The flow_inline top-structure verdict. */
|
|
97
|
+
export type FlowInlineTop = {
|
|
98
|
+
kind: "ok";
|
|
99
|
+
rec: Record<string, unknown>;
|
|
100
|
+
} | {
|
|
101
|
+
kind: "not-object";
|
|
102
|
+
} | {
|
|
103
|
+
kind: "unknown-keys";
|
|
104
|
+
dead: string[];
|
|
105
|
+
} | {
|
|
106
|
+
kind: "missing-id-stages";
|
|
107
|
+
keys: string[];
|
|
108
|
+
} | {
|
|
109
|
+
kind: "bad-stages";
|
|
110
|
+
};
|
|
111
|
+
/** Structure-gate one flow_inline value. */
|
|
112
|
+
export declare function checkFlowInlineTop(inline: unknown): FlowInlineTop;
|
|
113
|
+
/** Static verdict→voice table for the flow_inline top gate (the
|
|
114
|
+
* two fully static arms — unknown-keys and missing-id-stages
|
|
115
|
+
* interpolate request values, so their mapping stays in the
|
|
116
|
+
* door). */
|
|
117
|
+
export declare const FLOW_INLINE_TOP_VOICE: Record<"not-object" | "bad-stages", string>;
|
|
118
|
+
/** One flow_inline stage's door-level structure verdict. */
|
|
119
|
+
export type FlowStageCheck = {
|
|
120
|
+
kind: "ok";
|
|
121
|
+
st: Record<string, unknown>;
|
|
122
|
+
} | {
|
|
123
|
+
kind: "not-object";
|
|
124
|
+
} | {
|
|
125
|
+
kind: "unknown-fields";
|
|
126
|
+
st: Record<string, unknown>;
|
|
127
|
+
extras: string[];
|
|
128
|
+
} | {
|
|
129
|
+
kind: "bad-id";
|
|
130
|
+
st: Record<string, unknown>;
|
|
131
|
+
};
|
|
132
|
+
/** Structure-gate one stage row (id legality via FLOW_ID_RE). */
|
|
133
|
+
export declare function checkFlowStage(st: unknown): FlowStageCheck;
|
|
134
|
+
/** The stage-patch structure verdict. */
|
|
135
|
+
export type DraftPatchCheck = {
|
|
136
|
+
kind: "ok";
|
|
137
|
+
patch: Record<string, unknown>;
|
|
138
|
+
} | {
|
|
139
|
+
kind: "not-object";
|
|
140
|
+
} | {
|
|
141
|
+
kind: "unknown-keys";
|
|
142
|
+
unknown: string[];
|
|
143
|
+
} | {
|
|
144
|
+
kind: "bad-result";
|
|
145
|
+
} | {
|
|
146
|
+
kind: "bad-runStatus";
|
|
147
|
+
} | {
|
|
148
|
+
kind: "bad-params";
|
|
149
|
+
} | {
|
|
150
|
+
kind: "bad-inputs";
|
|
151
|
+
} | {
|
|
152
|
+
kind: "bad-inputOutputs";
|
|
153
|
+
};
|
|
154
|
+
/** Structure-gate one stage patch value. */
|
|
155
|
+
export declare function checkDraftPatch(patch: unknown): DraftPatchCheck;
|
|
156
|
+
/** Static verdict→voice table for the stage-patch gate (every arm
|
|
157
|
+
* but unknown-keys is fully static — the door does one lookup for
|
|
158
|
+
* those; unknown-keys interpolates the request keys, so its
|
|
159
|
+
* mapping stays in the door). */
|
|
160
|
+
export declare const DRAFT_PATCH_VOICE: Record<Exclude<DraftPatchCheck["kind"], "ok" | "unknown-keys">, string>;
|
|
161
|
+
//# sourceMappingURL=runsGates.d.ts.map
|