@melite/estate-queue 0.1.5-pre-alpha → 0.2.2-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 +561 -457
- package/README.md +0 -5
- package/lib/cardsArmError.d.ts +52 -3
- package/lib/cardsArmError.js +7 -1
- package/lib/cardsCompose.d.ts +31 -0
- package/lib/cardsCompose.js +98 -7
- package/lib/cardsFacts.d.ts +16 -0
- package/lib/cardsFacts.js +25 -1
- package/lib/cardsLanes.d.ts +51 -3
- package/lib/cardsLanes.js +337 -13
- package/lib/cardsLanesCopy.d.ts +21 -0
- package/lib/cardsLanesCopy.js +22 -0
- package/lib/cardsRegistry.d.ts +105 -5
- package/lib/cardsRegistry.js +826 -46
- package/lib/cardsVariant.d.ts +12 -7
- package/lib/cardsVariant.js +196 -58
- package/lib/discloseRegistry.d.ts +41 -6
- package/lib/discloseRegistry.js +155 -17
- package/lib/filmLead.js +5 -3
- package/lib/flowsData.d.ts +77 -21
- package/lib/flowsData.js +159 -21
- package/lib/flowsFamilyCompose.js +12 -1
- package/lib/flowsRegistryRows.d.ts +0 -3
- package/lib/flowsRegistryRows.js +166 -222
- package/lib/index.d.ts +1 -1
- package/lib/index.js +6 -4
- package/lib/loadPlane.d.ts +46 -4
- package/lib/loadPlane.js +116 -7
- package/lib/loadRegistry.js +9 -2
- package/lib/manageOps.js +2 -1
- package/lib/managePlane.d.ts +16 -1
- package/lib/managePlane.js +955 -65
- package/lib/managePreflight.d.ts +26 -0
- package/lib/managePreflight.js +211 -0
- package/lib/manageProbe.d.ts +52 -0
- package/lib/manageProbe.js +171 -1
- package/lib/queueCore.d.ts +14 -1
- package/lib/queueCore.js +13 -0
- package/lib/queueLock.js +19 -10
- package/lib/queueResurrect.d.ts +7 -5
- package/lib/queueResurrect.js +25 -9
- package/lib/queueRetry.d.ts +12 -10
- package/lib/queueRetry.js +2 -4
- package/lib/queueSidecar.d.ts +122 -1
- package/lib/queueSidecar.js +192 -7
- package/lib/queueSubmit.d.ts +70 -4
- package/lib/queueSubmit.js +159 -7
- package/lib/runsErrorCodes.js +5 -3
- package/lib/runsExecute.d.ts +16 -1
- package/lib/runsExecute.js +97 -39
- package/lib/runsGates.d.ts +16 -4
- package/lib/runsGates.js +17 -5
- package/lib/runsList.d.ts +100 -4
- package/lib/runsList.js +364 -63
- package/lib/runsRefusalVoices.js +50 -1
- package/lib/runsRegistry.d.ts +142 -9
- package/lib/runsRegistry.js +960 -163
- package/lib/runsStart.d.ts +30 -7
- package/lib/runsStart.js +136 -14
- package/lib/runsTypes.d.ts +46 -3
- package/lib/runsTypes.js +63 -9
- package/lib/runsValidate.d.ts +1 -0
- package/lib/runsValidate.js +5 -0
- package/lib/runsValidateArms.js +25 -0
- package/lib/runsValidateServe.js +25 -12
- package/lib/runsValidateShared.d.ts +8 -1
- package/lib/runsValidateShared.js +44 -4
- package/lib/runsValidateStages.d.ts +1 -1
- package/lib/runsValidateStages.js +107 -55
- package/lib/runtimeProvision.d.ts +119 -0
- package/lib/runtimeProvision.js +243 -0
- package/lib/skillAuthored.d.ts +50 -0
- package/lib/skillAuthored.js +178 -0
- package/lib/skillPlane.d.ts +40 -2
- package/lib/skillPlane.js +63 -13
- package/lib/skillRegistry.d.ts +24 -1
- package/lib/skillRegistry.js +69 -5
- package/lib/skillRows.d.ts +13 -3
- package/lib/skillRows.js +49 -5
- package/package.json +33 -23
- package/lib/resurrect.d.ts +0 -6
- package/lib/resurrect.js +0 -18
package/lib/runsStart.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type DraftId } from "@melite/contracts/benchStage";
|
|
1
2
|
import type { EngineJson } from "@melite/comfyui-cordis";
|
|
2
3
|
import type { FlowStageRow } from "./runsValidateShared.js";
|
|
3
|
-
import type { QueueRefusal } from "./queue.js";
|
|
4
|
+
import type { GraphReceiptStageRow, QueueRefusal } from "./queue.js";
|
|
4
5
|
export { envelopeRefusal, unknownDraftRefusal } from "./queueSubmit.js";
|
|
5
6
|
import type { RunId } from "./queueCore.js";
|
|
6
7
|
import type { RunRecord } from "./runsTypes.js";
|
|
@@ -45,10 +46,12 @@ export interface CompiledStage {
|
|
|
45
46
|
readonly expected: Record<string, EngineJson>;
|
|
46
47
|
readonly outputNodes: Record<string, EngineJson>;
|
|
47
48
|
readonly inputNames: Record<string, string>;
|
|
48
|
-
/** The stage DECLARED its outputs
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
49
|
+
/** The stage DECLARED its outputs (true = the outputs map or the
|
|
50
|
+
* cardIo table rode the doc — both are the doc's own tables, so
|
|
51
|
+
* the replay judge can read the channels. False = a fill supplied
|
|
52
|
+
* them from outside the doc (pre-one-table docs, whose engine-fill
|
|
53
|
+
* {default: ...} channels live nowhere the doc names). The replay
|
|
54
|
+
* judge judges only fully-declared docs. */
|
|
52
55
|
readonly outputsDeclared: boolean;
|
|
53
56
|
}
|
|
54
57
|
/** flow_inline structural compile — door-verbatim (structure via
|
|
@@ -86,14 +89,17 @@ export declare function registerCompiledRun(args: {
|
|
|
86
89
|
stages: CompiledStage[];
|
|
87
90
|
};
|
|
88
91
|
testFlag: boolean;
|
|
89
|
-
|
|
92
|
+
/** The start body's own execute ceiling (the F8 burn; absent = the
|
|
93
|
+
* queue config decides). */
|
|
94
|
+
executeCeilMs?: number;
|
|
95
|
+
draftId: DraftId;
|
|
90
96
|
stateRoot: string;
|
|
91
97
|
enqueue: (row: {
|
|
92
98
|
runId: RunId;
|
|
93
99
|
status: string;
|
|
94
100
|
error: string;
|
|
95
101
|
createdAt: number;
|
|
96
|
-
draftId:
|
|
102
|
+
draftId: DraftId;
|
|
97
103
|
testFlag: boolean;
|
|
98
104
|
stopFlag: boolean;
|
|
99
105
|
}) => number;
|
|
@@ -132,6 +138,14 @@ export declare function registerCompiledRun(args: {
|
|
|
132
138
|
* stamped and pipeline still rides the door. */
|
|
133
139
|
cardId?: string;
|
|
134
140
|
requestBody: Record<string, unknown>;
|
|
141
|
+
/** THE ADMITTED RECIPE (the F27 cure): the card doc the door
|
|
142
|
+
* admitted — envelope lifted, stanza unwrapped by the one lift —
|
|
143
|
+
* stamped beside the raw request echo so restore pastes what
|
|
144
|
+
* RAN, never a later draft edit. Absent on inline runs. */
|
|
145
|
+
cardRecipe?: {
|
|
146
|
+
card: string;
|
|
147
|
+
params: Record<string, unknown>;
|
|
148
|
+
};
|
|
135
149
|
/** The flow arms' request initials (the start body's values for
|
|
136
150
|
* the flow's declared initial validators, extracted after the
|
|
137
151
|
* compile-time gate passed): threaded to the engine merge so
|
|
@@ -155,6 +169,15 @@ export declare function registerCompiledRun(args: {
|
|
|
155
169
|
/** The flow arm's {stageId: fam} ledger for the same probe (the
|
|
156
170
|
* stage rows stay schema-clean). */
|
|
157
171
|
stageFams?: Record<string, string>;
|
|
172
|
+
/** THE GRAPH-RECEIPT LEDGER (the silent UI-drop purge's P1):
|
|
173
|
+
* the per-stage queue-time doc→graph evidence rows, keyed by
|
|
174
|
+
* stage id. The flow/bench arms fill it through
|
|
175
|
+
* composeCardStageRow's receiptsOut; the card arm stamps its
|
|
176
|
+
* own single-stage row. Stamped on the run as the folded
|
|
177
|
+
* run-level receipt (per-stage rows inside), beside
|
|
178
|
+
* compose_echo — card-composed runs ride it; inline runs carry
|
|
179
|
+
* none (nothing composed). */
|
|
180
|
+
graphReceipts?: Record<string, GraphReceiptStageRow>;
|
|
158
181
|
};
|
|
159
182
|
}): Promise<{
|
|
160
183
|
run: RunRecord;
|
package/lib/runsStart.js
CHANGED
|
@@ -19,10 +19,9 @@ import { join } from "node:path";
|
|
|
19
19
|
import { FlowError } from "./runsValidateShared.js";
|
|
20
20
|
import { AGENT_ENGINE_ID, CRAFT_ENGINE_ID, COMFYUI_ENGINE_ID, engineIdOk, } from "@melite/engine-contract";
|
|
21
21
|
import { FLOW_INLINE_TOP_VOICE, INLINE_TOP_KEYS, STAGE_KEYS, checkFlowInlineTop, checkFlowStage, } from "./runsGates.js";
|
|
22
|
-
import { appendLedger, outRootFor, refusal, sidecarDoc, sidecarStageOf, variantOfBodies, writeJsonAtomic } from "./queue.js";
|
|
22
|
+
import { appendLedger, graphReceiptFoldOf, outRootFor, refusal, sidecarDoc, sidecarStageOf, variantOfBodies, writeJsonAtomic } from "./queue.js";
|
|
23
23
|
import { lifecycleInFlight } from "./lifecycleLatch.js";
|
|
24
24
|
import { toRemoteError } from "./runsRefusalVoices.js";
|
|
25
|
-
import { ENGINE_TABLE } from "./runsValidateShared.js";
|
|
26
25
|
import { rootsManifest } from "./rootsManifest.js";
|
|
27
26
|
// the envelope-refusal SSOT lives in queueSubmit.ts (beside
|
|
28
27
|
// walkSubmitEnvelope, the one walker the registry delegates to) —
|
|
@@ -184,7 +183,12 @@ export function compileFlowInline(inline, knownEngines = [CARD_PLANE_ENGINE]) {
|
|
|
184
183
|
" (extra=forbid at the door)", "invalid_request");
|
|
185
184
|
}
|
|
186
185
|
if (checked.kind === "bad-id") {
|
|
187
|
-
|
|
186
|
+
// (purge §7 P7 F-2 — the absence voice): a MISSING id must not
|
|
187
|
+
// render as an invented empty string (present-but-empty). Only
|
|
188
|
+
// the absent leg substitutes; an illegal-but-present id rides
|
|
189
|
+
// verbatim. Walled at
|
|
190
|
+
// tests/walls/ts/suites/run-door-single-resolve.spec.ts F-2.
|
|
191
|
+
const sid = String(checked.st["id"] ?? "<absent>");
|
|
188
192
|
return refusal(400, "stage id " + JSON.stringify(sid) + " is not a legal identifier", "invalid_request");
|
|
189
193
|
}
|
|
190
194
|
const st = checked.st;
|
|
@@ -274,19 +278,47 @@ export function compileFlowInline(inline, knownEngines = [CARD_PLANE_ENGINE]) {
|
|
|
274
278
|
const params = typeof st["params"] === "object" && st["params"] !== null && !Array.isArray(st["params"])
|
|
275
279
|
? st["params"]
|
|
276
280
|
: {};
|
|
281
|
+
// THE NESTED CONTAINER rides the same law (P7 B2): params is the
|
|
282
|
+
// stage's own object, but params.output_nodes is the
|
|
283
|
+
// artifact-binding surface — a malformed value is refused here,
|
|
284
|
+
// not dropped into {}. Absent stays legal (the fill below).
|
|
285
|
+
const rawNodes = params["output_nodes"];
|
|
286
|
+
if (rawNodes !== undefined &&
|
|
287
|
+
(typeof rawNodes !== "object" || rawNodes === null || Array.isArray(rawNodes))) {
|
|
288
|
+
return refusal(400, "flow_inline stage " + JSON.stringify(sid) + ": params.output_nodes" +
|
|
289
|
+
" must be an object (got " +
|
|
290
|
+
(rawNodes === null ? "null" : Array.isArray(rawNodes) ? "array" : typeof rawNodes) +
|
|
291
|
+
"); a shape that cannot be read is refused here, not dropped — a dropped " +
|
|
292
|
+
"output_nodes makes the run register without it", "invalid_request");
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// "undeclared" — the compiler reads the stage's OWN card_io
|
|
296
|
+
// table (the card's declared output channels, carried on the
|
|
297
|
+
// row), never the engine registry (membership-only since the
|
|
298
|
+
// cure: it names no kinds). A stage with neither refuses here,
|
|
299
|
+
// in the door's voice, naming the fix — a fabricated
|
|
300
|
+
// {default: <engine kind>} once bound the retired music-native
|
|
277
301
|
|
|
278
|
-
// validate's lattice treats an EMPTY outputs map as stageless
|
|
279
|
-
// and judges the stage by the engine's table def (craft->image,
|
|
280
|
-
// agent->text); start's flat "image" bound a different kind than
|
|
281
|
-
// the lattice judged. One fill law, both doors: empty-or-absent
|
|
282
|
-
// outputs take the table's default channel.
|
|
283
302
|
const declaredOutputs = st["outputs"];
|
|
284
303
|
const outputsDeclared = typeof declaredOutputs === "object" && declaredOutputs !== null &&
|
|
285
304
|
!Array.isArray(declaredOutputs) &&
|
|
286
305
|
Object.keys(declaredOutputs).length > 0;
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
306
|
+
const rawCardIo = st["card_io"];
|
|
307
|
+
const cardIoDeclared = typeof rawCardIo === "object" && rawCardIo !== null &&
|
|
308
|
+
!Array.isArray(rawCardIo) &&
|
|
309
|
+
Object.keys(rawCardIo).length > 0;
|
|
310
|
+
let outputs;
|
|
311
|
+
if (outputsDeclared) {
|
|
312
|
+
outputs = declaredOutputs;
|
|
313
|
+
}
|
|
314
|
+
else if (cardIoDeclared) {
|
|
315
|
+
outputs = rawCardIo;
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
return refusal(400, "flow_inline stage " + JSON.stringify(sid) + " declares no outputs and carries no card_io — " +
|
|
319
|
+
"name every produced channel on the stage (outputs={'<channel>': <Kind>}) or carry the card's " +
|
|
320
|
+
"declared cardIo table; the engine registry names engines, never their outputs", "invalid_request");
|
|
321
|
+
}
|
|
290
322
|
const expected = typeof st["expected"] === "object" && st["expected"] !== null && !Array.isArray(st["expected"])
|
|
291
323
|
? st["expected"]
|
|
292
324
|
: {};
|
|
@@ -341,7 +373,7 @@ export function compileFlowInline(inline, knownEngines = [CARD_PLANE_ENGINE]) {
|
|
|
341
373
|
JSON.stringify([...new Set(ghosts)].sort()) +
|
|
342
374
|
" but the stage wires no input of that name — the merge would refuse it at run time ('$name' must name a FromStage-wired input or a request initial; name it or wire it)", "invalid_request");
|
|
343
375
|
}
|
|
344
|
-
stages.push({ id: sid, engine, params, outputs, outputsDeclared, expected, outputNodes, inputNames });
|
|
376
|
+
stages.push({ id: sid, engine, params, outputs, outputsDeclared: outputsDeclared || cardIoDeclared, expected, outputNodes, inputNames });
|
|
345
377
|
}
|
|
346
378
|
return { stages };
|
|
347
379
|
}
|
|
@@ -370,7 +402,7 @@ export function selectSubmitDoor(body, opts = {}) {
|
|
|
370
402
|
* (the remote) enqueues it on the queue core + kicks the pump.
|
|
371
403
|
* Returns the row and its queue position. */
|
|
372
404
|
export async function registerCompiledRun(args) {
|
|
373
|
-
const { compiled, testFlag, draftId, stateRoot, enqueue, door } = args;
|
|
405
|
+
const { compiled, testFlag, executeCeilMs, draftId, stateRoot, enqueue, door } = args;
|
|
374
406
|
// THE ONE RUN ID (see the type above): the caller's. There is no
|
|
375
407
|
// second producer here, and there cannot be one without failing the
|
|
376
408
|
// compiler.
|
|
@@ -408,6 +440,14 @@ export async function registerCompiledRun(args) {
|
|
|
408
440
|
outputs: { ...st.outputs },
|
|
409
441
|
params: { ...st.params },
|
|
410
442
|
}));
|
|
443
|
+
|
|
444
|
+
// door's bench doc read is the run's incarnation — both register
|
|
445
|
+
// arms carry the same doc they judged (benchStageIdOf), so the
|
|
446
|
+
// stamp rides the door, never a re-read. Stamped once here; every
|
|
447
|
+
// sidecar rewrite carries it (sidecarFacesOf). Absent on pre-cure
|
|
448
|
+
// benches (no epoch, no key — never guessed).
|
|
449
|
+
const benchEpochRaw = door.benchDoc?.["epoch"];
|
|
450
|
+
const benchEpoch = typeof benchEpochRaw === "string" && benchEpochRaw !== "" ? benchEpochRaw : undefined;
|
|
411
451
|
const run = {
|
|
412
452
|
runId,
|
|
413
453
|
status: "queued",
|
|
@@ -427,6 +467,7 @@ export async function registerCompiledRun(args) {
|
|
|
427
467
|
draftId,
|
|
428
468
|
dir,
|
|
429
469
|
testFlag,
|
|
470
|
+
executeCeilMs,
|
|
430
471
|
stopFlag: false,
|
|
431
472
|
params: compiled.stages.map((st) => ({ ...st.params })),
|
|
432
473
|
createdAt,
|
|
@@ -437,6 +478,9 @@ export async function registerCompiledRun(args) {
|
|
|
437
478
|
...(door.initialFileKeys !== undefined && door.initialFileKeys.length > 0
|
|
438
479
|
? { initialFileKeys: [...door.initialFileKeys] }
|
|
439
480
|
: {}),
|
|
481
|
+
// THE BENCH INCARNATION rides the row (W-3 / F3-11) — the queued
|
|
482
|
+
// sidecar stamps it, the claim/settle rewrites carry it verbatim.
|
|
483
|
+
...(benchEpoch !== undefined ? { benchEpoch } : {}),
|
|
440
484
|
};
|
|
441
485
|
run.inputNames = Object.fromEntries(compiled.stages.map((st) => [st.id, { ...st.inputNames }]));
|
|
442
486
|
if (args.warnings !== undefined && args.warnings.length > 0) {
|
|
@@ -481,12 +525,38 @@ export async function registerCompiledRun(args) {
|
|
|
481
525
|
card: door.cardId,
|
|
482
526
|
params: door.requestBody,
|
|
483
527
|
};
|
|
528
|
+
if (door.cardRecipe !== undefined)
|
|
529
|
+
run.cardRecipe = door.cardRecipe;
|
|
484
530
|
}
|
|
485
531
|
if (door.benchDoc !== undefined) {
|
|
486
532
|
const benchStages = Array.isArray(door.benchDoc["stages"])
|
|
487
533
|
? door.benchDoc["stages"]
|
|
488
534
|
: undefined;
|
|
489
|
-
if (benchStages
|
|
535
|
+
if (benchStages === undefined &&
|
|
536
|
+
"stages" in door.benchDoc &&
|
|
537
|
+
door.benchDoc["stages"] !== undefined) {
|
|
538
|
+
// THE MALFORMED-STAGES VOICE (P7 B3): a benchDoc carrying a
|
|
539
|
+
// stages key that is not a stage list skipped the whole
|
|
540
|
+
// snapshot with NO voice — restore then reconstructed from
|
|
541
|
+
// the LIVE bench, unvoiced. The read-failure path warns
|
|
542
|
+
// (runsRegistry N-S3); the malformed leg rides the same
|
|
543
|
+
// shape: what was skipped and what restore falls back to.
|
|
544
|
+
// Absent/empty stages keep their pinned silence (an empty
|
|
545
|
+
// bench stamps nothing; a rev-only doc carries no list) — and
|
|
546
|
+
// a present-but-undefined stages reads as absent: the door's
|
|
547
|
+
// coercion spread materializes `stages: undefined` for a
|
|
548
|
+
// stages-less draft, and JSON drops that key on the sidecar
|
|
549
|
+
// anyway, so voicing it would warn every stages-less bench
|
|
550
|
+
// run for the spread's own artifact.
|
|
551
|
+
const rawStages = door.benchDoc["stages"];
|
|
552
|
+
run.warnings = [
|
|
553
|
+
...(run.warnings ?? []),
|
|
554
|
+
"bench snapshot: bench stages is not a usable stage list (got " +
|
|
555
|
+
(rawStages === null ? "null" : Array.isArray(rawStages) ? "array" : typeof rawStages) +
|
|
556
|
+
") — only the card snapshot rode; restore reconstructs from the live bench",
|
|
557
|
+
];
|
|
558
|
+
}
|
|
559
|
+
else if (benchStages !== undefined && benchStages.length > 0) {
|
|
490
560
|
|
|
491
561
|
// finding): card-mode runs MINT their bench (the CARD BIRTH
|
|
492
562
|
// law wants a doc-backed draft) while a studio user HAND-
|
|
@@ -584,6 +654,30 @@ export async function registerCompiledRun(args) {
|
|
|
584
654
|
run.variant = regVariant;
|
|
585
655
|
console.log(`[variant] run=${runId} draft=${draftId} variant=${regVariant}`);
|
|
586
656
|
}
|
|
657
|
+
// THE GRAPH-RECEIPT STAMP (the silent UI-drop purge's P1 — the
|
|
658
|
+
// seated cure): the per-stage rows the compose ledgers folded into
|
|
659
|
+
// the run-level receipt — "which stated scalars did the composed
|
|
660
|
+
// graphs actually carry" — beside compose_echo: the run record +
|
|
661
|
+
// the console + the queued ledger row. EVIDENCE, never a refusal:
|
|
662
|
+
// a dropped key is a receipt fact (the P0 census consumes it).
|
|
663
|
+
// Card-composed runs ride it; inline runs carry no rows (nothing
|
|
664
|
+
// composed) and stamp nothing. Rows fold in COMPILED stage order
|
|
665
|
+
// (registration order, never ledger key order).
|
|
666
|
+
if (door.graphReceipts !== undefined && Object.keys(door.graphReceipts).length > 0) {
|
|
667
|
+
const rows = [];
|
|
668
|
+
for (const st of compiled.stages) {
|
|
669
|
+
const row = door.graphReceipts[st.id];
|
|
670
|
+
if (row !== undefined)
|
|
671
|
+
rows.push(row);
|
|
672
|
+
}
|
|
673
|
+
if (rows.length > 0) {
|
|
674
|
+
run.graphReceipt = graphReceiptFoldOf(rows);
|
|
675
|
+
const receipt = run.graphReceipt;
|
|
676
|
+
console.log(`[graph-receipt] run=${runId} draft=${draftId} stages=${rows.length} nodes=${receipt.nodes} ` +
|
|
677
|
+
`carried=${receipt.carried.length} dropped=${receipt.dropped.length} verdict=${receipt.verdict}` +
|
|
678
|
+
(receipt.dropped.length > 0 ? ` dropped=[${receipt.dropped.join(",")}]` : ""));
|
|
679
|
+
}
|
|
680
|
+
}
|
|
587
681
|
await writeJsonAtomic(join(dir, "_request.json"), requestBody);
|
|
588
682
|
await writeJsonAtomic(join(dir, "_flow.json"), sidecarDocFor(run));
|
|
589
683
|
|
|
@@ -618,6 +712,18 @@ export async function registerCompiledRun(args) {
|
|
|
618
712
|
calls: echoCalls.length,
|
|
619
713
|
bench_rev: benchRev,
|
|
620
714
|
sources: sources.length,
|
|
715
|
+
// THE GRAPH-RECEIPT RIDES THE QUEUED ROW TOO (the [graph-receipt]
|
|
716
|
+
// console line's durable twin — compact triad, the full receipt
|
|
717
|
+
// lives on the sidecar).
|
|
718
|
+
...(run.graphReceipt !== undefined
|
|
719
|
+
? {
|
|
720
|
+
graph_receipt: {
|
|
721
|
+
nodes: run.graphReceipt.nodes,
|
|
722
|
+
verdict: run.graphReceipt.verdict,
|
|
723
|
+
dropped: [...run.graphReceipt.dropped],
|
|
724
|
+
},
|
|
725
|
+
}
|
|
726
|
+
: {}),
|
|
621
727
|
});
|
|
622
728
|
}
|
|
623
729
|
else {
|
|
@@ -627,6 +733,16 @@ export async function registerCompiledRun(args) {
|
|
|
627
733
|
pipeline: run.pipeline,
|
|
628
734
|
...(regVariant !== undefined ? { variant: regVariant } : {}),
|
|
629
735
|
sources: sources.length,
|
|
736
|
+
// THE GRAPH-RECEIPT RIDES THE QUEUED ROW TOO (same law).
|
|
737
|
+
...(run.graphReceipt !== undefined
|
|
738
|
+
? {
|
|
739
|
+
graph_receipt: {
|
|
740
|
+
nodes: run.graphReceipt.nodes,
|
|
741
|
+
verdict: run.graphReceipt.verdict,
|
|
742
|
+
dropped: [...run.graphReceipt.dropped],
|
|
743
|
+
},
|
|
744
|
+
}
|
|
745
|
+
: {}),
|
|
630
746
|
});
|
|
631
747
|
}
|
|
632
748
|
const queuePosition = enqueue(run);
|
|
@@ -647,6 +763,9 @@ function sidecarDocFor(run) {
|
|
|
647
763
|
testFlag: run.testFlag,
|
|
648
764
|
draftId: run.draftId,
|
|
649
765
|
pipeline: run.pipeline,
|
|
766
|
+
// THE BENCH INCARNATION rides the queued sidecar too (W-3 /
|
|
767
|
+
// F3-11 — the wand/restore and the list read disk, not memory).
|
|
768
|
+
benchEpoch: run.benchEpoch,
|
|
650
769
|
graph: run.graphRows,
|
|
651
770
|
cardSnapshot: run.cardSnapshot,
|
|
652
771
|
benchSnapshot: run.benchSnapshot,
|
|
@@ -656,6 +775,9 @@ function sidecarDocFor(run) {
|
|
|
656
775
|
// THE COMPOSE ECHO: what the engine received rides the queued
|
|
657
776
|
// sidecar too (the wand/restore reads disk, not memory).
|
|
658
777
|
composeEcho: run.composeEcho,
|
|
778
|
+
// THE GRAPH RECEIPT: the queue-time doc→graph evidence rides the
|
|
779
|
+
// queued sidecar too (same law — no card-composed run, no key).
|
|
780
|
+
graphReceipt: run.graphReceipt,
|
|
659
781
|
// THE SOURCE ECHO: the files that created the run ride the
|
|
660
782
|
// queued sidecar too.
|
|
661
783
|
sourceEcho: run.sourceEcho,
|
package/lib/runsTypes.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { EngineJson } from "@melite/comfyui-cordis";
|
|
2
|
-
import type {
|
|
2
|
+
import type { DraftId } from "@melite/contracts/benchStage";
|
|
3
|
+
import type { GraphReceipt, GraphRow } from "./queue.js";
|
|
3
4
|
import type { RunId } from "./queueCore.js";
|
|
4
5
|
/** Stage statuses — the run worker's vocabulary (inherited from the retired oracle). */
|
|
5
6
|
export type RunStatus = "queued" | "running" | "completed" | "failed" | "stopped" | "stopping";
|
|
@@ -41,7 +42,7 @@ export interface RunRecord {
|
|
|
41
42
|
skippedStages: string[];
|
|
42
43
|
artifacts: string[];
|
|
43
44
|
error: string;
|
|
44
|
-
draftId:
|
|
45
|
+
draftId: DraftId;
|
|
45
46
|
dir: string;
|
|
46
47
|
testFlag: boolean;
|
|
47
48
|
stopFlag: boolean;
|
|
@@ -53,6 +54,12 @@ export interface RunRecord {
|
|
|
53
54
|
* Empty for runs whose flow declares no initials and for a
|
|
54
55
|
* failed resurrect's floor row. */
|
|
55
56
|
initials: Record<string, EngineJson>;
|
|
57
|
+
/** THE PER-RUN EXECUTE CEILING (the F8 burn): the start body's own
|
|
58
|
+
* `execute_ceil_ms` overrides the queue config for THIS run —
|
|
59
|
+
* `<= 0` disables the fuse (a whole-film window loop outlasts the
|
|
60
|
+
* deployment default; a 30-min kill stranded finished windows
|
|
61
|
+
* engine-side). Absent = the queue config's value. */
|
|
62
|
+
executeCeilMs?: number;
|
|
56
63
|
/** The FILE-kind subset of initials' keys (photo | glb — the
|
|
57
64
|
* kinds whose values must exist on disk), stamped beside
|
|
58
65
|
* initials so the claim-time re-probe knows which entries to
|
|
@@ -84,10 +91,27 @@ export interface RunRecord {
|
|
|
84
91
|
* living bench. Stamped at registration, carried through settle
|
|
85
92
|
* (the settle rewrite must not wipe it). */
|
|
86
93
|
cardSnapshot?: unknown;
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
cardRecipe?: {
|
|
100
|
+
card: string;
|
|
101
|
+
params: Record<string, unknown>;
|
|
102
|
+
};
|
|
87
103
|
/** THE BENCH SNAPSHOT (stroke 45d): the full workflow as it stood
|
|
88
104
|
* at Run press ({stages, intent}) — same carry law as the card
|
|
89
105
|
* snapshot. */
|
|
90
106
|
benchSnapshot?: unknown;
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
benchEpoch?: string;
|
|
91
115
|
/** F-6(b) ADMISSION WARNINGS (stamped post-registration by the
|
|
92
116
|
* start door — the film lane's VRAM-pressure warn): served on
|
|
93
117
|
* run_status rows, never a refusal. Absent means none. */
|
|
@@ -165,6 +189,15 @@ export interface RunRecord {
|
|
|
165
189
|
calls: number;
|
|
166
190
|
benchRev: number | null;
|
|
167
191
|
};
|
|
192
|
+
/** THE SERVED-GRAPH RECEIPT (the silent UI-drop purge's P1):
|
|
193
|
+
* the queue-time doc→graph evidence — which doc scalars the
|
|
194
|
+
* composed graph carries, which it dropped, per stage. Stamped
|
|
195
|
+
* at registration; the claim and settle sidecar rewrites carry
|
|
196
|
+
* it; the execute outcome fold stamps the engine's prompt_id.
|
|
197
|
+
* Card-composed runs stamp a rollup; inline runs stamp nothing
|
|
198
|
+
* (the receipt judges the card compose, never the verbatim
|
|
199
|
+
* inline envelope). */
|
|
200
|
+
graphReceipt?: GraphReceipt;
|
|
168
201
|
|
|
169
202
|
|
|
170
203
|
|
|
@@ -181,7 +214,17 @@ export interface RunRecord {
|
|
|
181
214
|
}
|
|
182
215
|
/** The engine's path relative to the run dir (runRel, door-verbatim). */
|
|
183
216
|
export declare function runRel(run: RunRecord, art: string): string;
|
|
184
|
-
/**
|
|
217
|
+
/** THE THROWN-VALUE FOLD (qa8 F38): run_status once served
|
|
218
|
+
* "Error: [object Object]" for a real OOM because a plain-object
|
|
219
|
+
* throw met String(). A thrown non-Error renders by its own words —
|
|
220
|
+
* a bare string verbatim; an object's message/error string fields
|
|
221
|
+
* first, then its JSON; a circular or unserializable value folds to
|
|
222
|
+
* its key roster. The vacuous "[object Object]" can never leave this
|
|
223
|
+
* door. */
|
|
224
|
+
export declare function foldThrownValue(value: unknown): string;
|
|
225
|
+
/** "<Type>: <msg>" — the worker's terminal error text. The message
|
|
226
|
+
* half rides the thrown-value fold (F38): a thrown object reaches
|
|
227
|
+
* the run's error column as its own words. */
|
|
185
228
|
export declare function errText(err: unknown): string;
|
|
186
229
|
/** The settle persist (the R3 durable-queue mirror of registration,
|
|
187
230
|
* door-verbatim): the terminal status rewrites the run's
|
package/lib/runsTypes.js
CHANGED
|
@@ -43,10 +43,43 @@ function errName(err) {
|
|
|
43
43
|
}
|
|
44
44
|
return "Error";
|
|
45
45
|
}
|
|
46
|
-
/**
|
|
46
|
+
/** THE THROWN-VALUE FOLD (qa8 F38): run_status once served
|
|
47
|
+
* "Error: [object Object]" for a real OOM because a plain-object
|
|
48
|
+
* throw met String(). A thrown non-Error renders by its own words —
|
|
49
|
+
* a bare string verbatim; an object's message/error string fields
|
|
50
|
+
* first, then its JSON; a circular or unserializable value folds to
|
|
51
|
+
* its key roster. The vacuous "[object Object]" can never leave this
|
|
52
|
+
* door. */
|
|
53
|
+
export function foldThrownValue(value) {
|
|
54
|
+
if (typeof value === "string")
|
|
55
|
+
return value;
|
|
56
|
+
if (value instanceof Error)
|
|
57
|
+
return value.message;
|
|
58
|
+
if (typeof value === "object" && value !== null) {
|
|
59
|
+
const rec = value;
|
|
60
|
+
for (const key of ["message", "error", "detail", "reason"]) {
|
|
61
|
+
const v = rec[key];
|
|
62
|
+
if (typeof v === "string" && v.trim() !== "")
|
|
63
|
+
return v;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const json = JSON.stringify(value);
|
|
67
|
+
if (json !== "{}" && json !== "[]")
|
|
68
|
+
return json;
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// circular or BigInt — the key roster below still names it
|
|
72
|
+
}
|
|
73
|
+
const keys = Object.keys(rec);
|
|
74
|
+
return keys.length > 0 ? "{ " + keys.join(", ") + " }" : "{}";
|
|
75
|
+
}
|
|
76
|
+
return String(value);
|
|
77
|
+
}
|
|
78
|
+
/** "<Type>: <msg>" — the worker's terminal error text. The message
|
|
79
|
+
* half rides the thrown-value fold (F38): a thrown object reaches
|
|
80
|
+
* the run's error column as its own words. */
|
|
47
81
|
export function errText(err) {
|
|
48
|
-
|
|
49
|
-
return errName(err) + ": " + msg;
|
|
82
|
+
return errName(err) + ": " + foldThrownValue(err);
|
|
50
83
|
}
|
|
51
84
|
/** The settle persist (the R3 durable-queue mirror of registration,
|
|
52
85
|
* door-verbatim): the terminal status rewrites the run's
|
|
@@ -56,12 +89,14 @@ export function errText(err) {
|
|
|
56
89
|
export async function settlePersist(run, stateRoot) {
|
|
57
90
|
// THE EXPORT-NAME STAMP (023's self-critique #4/#6): a
|
|
58
91
|
// design/export lane's voice_name rides the submitted body — lift
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
//
|
|
92
|
+
// THE EXPORT-NAME STAMP (023's self-critique #4/#6, re-stated
|
|
93
|
+
|
|
94
|
+
// Design mod's popup states the save name; unstated runs mint
|
|
95
|
+
// it): a stated voice_name wins here; the mint-named file lifts
|
|
96
|
+
// below. The params loop also keeps pre-refinement runs replayed
|
|
97
|
+
// through this settle honest (their snapshots carry whatever the
|
|
98
|
+
// door admitted at their time; a replay must not lose its
|
|
99
|
+
// receipt).
|
|
65
100
|
let exportName;
|
|
66
101
|
const bodies = [...run.params];
|
|
67
102
|
const snap = run.cardSnapshot;
|
|
@@ -103,6 +138,17 @@ export async function settlePersist(run, stateRoot) {
|
|
|
103
138
|
break;
|
|
104
139
|
}
|
|
105
140
|
}
|
|
141
|
+
// THE MINT NAMES ITSELF (the qvoice boolean law, operator
|
|
142
|
+
|
|
143
|
+
// the minted file's stem (voice-<runId>.qvoice → voice-<runId>).
|
|
144
|
+
if (exportName === undefined && exportPath !== undefined) {
|
|
145
|
+
const base = exportPath.split("/").pop() ?? "";
|
|
146
|
+
const stem = base.endsWith(".qvoice") ? base.slice(0, -".qvoice".length) : base;
|
|
147
|
+
if (stem !== "") {
|
|
148
|
+
exportName = stem;
|
|
149
|
+
run.exportName = exportName;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
106
152
|
|
|
107
153
|
// reading and the voice-mint receipt off the stage result_outputs
|
|
108
154
|
// — same law as the export path (the engine's harvest carries
|
|
@@ -189,13 +235,21 @@ function sidecarFacesOf(run) {
|
|
|
189
235
|
// re-renders the document from the row — the snapshots stamped
|
|
190
236
|
// at registration ride along, never wiped.
|
|
191
237
|
cardSnapshot: run.cardSnapshot,
|
|
238
|
+
cardRecipe: run.cardRecipe,
|
|
192
239
|
benchSnapshot: run.benchSnapshot,
|
|
240
|
+
// THE BENCH INCARNATION rides every rewrite too (W-3 / F3-11 —
|
|
241
|
+
// a disk row keeps the incarnation it was pressed in; the claim
|
|
242
|
+
// and settle rewrites carry the queued stamp verbatim).
|
|
243
|
+
benchEpoch: run.benchEpoch,
|
|
193
244
|
// F-6(b): the admission warnings ride every rewrite too (a disk
|
|
194
245
|
// row keeps what the live row warned).
|
|
195
246
|
warnings: run.warnings,
|
|
196
247
|
// THE COMPOSE ECHO rides every rewrite too (a disk row keeps
|
|
197
248
|
// what the engine received at start).
|
|
198
249
|
composeEcho: run.composeEcho,
|
|
250
|
+
// THE SERVED-GRAPH RECEIPT rides every rewrite too (a disk row
|
|
251
|
+
// keeps the queue-time evidence — ordered beside the echo).
|
|
252
|
+
graphReceipt: run.graphReceipt,
|
|
199
253
|
// THE SOURCE ECHO rides every rewrite too (a disk row keeps the
|
|
200
254
|
// files that created the run).
|
|
201
255
|
sourceEcho: run.sourceEcho,
|
package/lib/runsValidate.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { FlowError } from "./runsValidateShared.js";
|
|
2
2
|
export type { CardRegistryLike, FlowsValidateAnswer } from "./runsValidateShared.js";
|
|
3
|
+
export { KIND_VOCAB } from "./runsValidateShared.js";
|
|
3
4
|
export { strictBody } from "./runsValidateStages.js";
|
|
4
5
|
export { inlineArm, serveSubject } from "./runsValidateServe.js";
|
|
5
6
|
//# sourceMappingURL=runsValidate.d.ts.map
|
package/lib/runsValidate.js
CHANGED
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
// public import surface below is UNCHANGED — existing importers keep
|
|
26
26
|
// importing these names from ./runsValidate.ts.
|
|
27
27
|
export { FlowError } from "./runsValidateShared.js";
|
|
28
|
+
|
|
29
|
+
// teaching voices DERIVE from KIND_VOCAB (melite-tools' fold refusal
|
|
30
|
+
// rode a hand copy that had already dropped `data`) — the enforcer
|
|
31
|
+
// and every voice must enumerate the same closed set.
|
|
32
|
+
export { KIND_VOCAB } from "./runsValidateShared.js";
|
|
28
33
|
export { strictBody } from "./runsValidateStages.js";
|
|
29
34
|
export { inlineArm, serveSubject } from "./runsValidateServe.js";
|
|
30
35
|
// ── the door ────────────────────────────────────────────────────
|
package/lib/runsValidateArms.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RemoteError } from "@deepseek-ai/dsh-typert-protocol";
|
|
2
2
|
import { RUNS_ERROR_CODES } from "./runsErrorCodes.js";
|
|
3
|
+
import { refuseFamilylessHijack } from "./cardsCompose.js";
|
|
3
4
|
import { expandRegistryFlow, registryFlowToInline, registryInitialsError } from "./flowsData.js";
|
|
4
5
|
import { applyFlowParamsOverride, overlayDecls } from "./flowsParamsOverlay.js";
|
|
5
6
|
import { composeFamilyStages, liveFamilySeat } from "./flowsFamilyCompose.js";
|
|
@@ -236,10 +237,34 @@ async function composeCardStagesAtValidate(liveDoc, svc) {
|
|
|
236
237
|
? (service !== undefined ? { ...params, model: service } : { ...params })
|
|
237
238
|
: { ...params, model: mid };
|
|
238
239
|
try {
|
|
240
|
+
|
|
241
|
+
// this walk's body carries no `card` key (the model-door
|
|
242
|
+
// shape), so prepareCardParams cannot see the row's own card —
|
|
243
|
+
// the shared law fires HERE too, on the walk's own card name,
|
|
244
|
+
// before any phase1Card resolution folds the stated model
|
|
245
|
+
// into a stranger's lane (trim + krea-2 lived as image-gen).
|
|
246
|
+
refuseFamilylessHijack(svc, String(st["card"]), params["model"] ?? service);
|
|
239
247
|
await svc.phase1Card(body, mid);
|
|
240
248
|
}
|
|
241
249
|
catch (e) {
|
|
242
250
|
if (e instanceof CardArmError) {
|
|
251
|
+
// THE INCOMPLETE CLASS KEEPS ITS CODE (the GUI-add burn,
|
|
252
|
+
|
|
253
|
+
// into one string, so the pre-mint WRITE gate downstream
|
|
254
|
+
// read the class as a terminal refusal — and no card whose
|
|
255
|
+
// lane declares a required word the add door does not seed
|
|
256
|
+
// (tts's `text` — the GUI seeds axes only) could ever be
|
|
257
|
+
// ADDED from the cards tab. The frictionless-authoring
|
|
258
|
+
|
|
259
|
+
// not hacking the mainframe") drops the authoring-
|
|
260
|
+
// incomplete class at every write seat; the class rides the
|
|
261
|
+
// door's own throw pattern here, under the wire code the
|
|
262
|
+
// table already carries (runs/card-compose-incomplete —
|
|
263
|
+
// the client's heal-vs-carry split reads the same key).
|
|
264
|
+
// Every other refusal keeps the wall-pinned note voice.
|
|
265
|
+
if (e.code === "card_compose_incomplete") {
|
|
266
|
+
throw new RemoteError(RUNS_ERROR_CODES["card_compose_incomplete"], "stage " + JSON.stringify(String(st["id"])) + ": " + e.message, { loc: "stages" });
|
|
267
|
+
}
|
|
243
268
|
return "REFUSED stage " + JSON.stringify(String(st["id"])) + ": " + e.message;
|
|
244
269
|
}
|
|
245
270
|
throw e;
|
package/lib/runsValidateServe.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// runsValidateServe.ts — the shared compile-serve tail split from
|
|
2
2
|
// runsValidate.ts (pure move, zero logic changes): branch prune, to_graph,
|
|
3
3
|
// the $channel gate, cost preview, and the inline/named serve arms.
|
|
4
|
-
import {
|
|
5
|
-
import { ENGINE_TABLE, FlowError } from "./runsValidateShared.js";
|
|
4
|
+
import { FlowError, engineKnown } from "./runsValidateShared.js";
|
|
6
5
|
import { edgeRef } from "./runsValidateInline.js";
|
|
7
6
|
import { flowFromBody, kindsOk, wiresResolve } from "./runsValidateStages.js";
|
|
8
7
|
import { batchRows, sweepWorkflows } from "./runsValidateSweeps.js";
|
|
@@ -64,9 +63,9 @@ export function prunedFor(flow, body, cards) {
|
|
|
64
63
|
merged.push({ ...st, inputs: newInputs });
|
|
65
64
|
}
|
|
66
65
|
// RECONSTRUCTED — every construction validator re-runs (TS scope:
|
|
67
|
-
// wires +
|
|
66
|
+
// wires + kinds; card/tool/validators are no-ops here).
|
|
68
67
|
wiresResolve(flow.id, merged);
|
|
69
|
-
kindsOk(flow.id, merged,
|
|
68
|
+
kindsOk(flow.id, merged, cards);
|
|
70
69
|
return { flow: { id: flow.id, description: flow.description, stages: merged }, pruned: [...pruned.keys()] };
|
|
71
70
|
}
|
|
72
71
|
export function toGraph(flow) {
|
|
@@ -81,14 +80,28 @@ export function toGraph(flow) {
|
|
|
81
80
|
outputs.push({ ...o });
|
|
82
81
|
}
|
|
83
82
|
else {
|
|
84
|
-
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
83
|
+
|
|
84
|
+
// with neither refuses LOUD, in the lattice's own voice for a
|
|
85
|
+
// missed guarantee (unknown engine) or the declaration voice
|
|
86
|
+
// (a known engine names no channels). The engine registry is
|
|
87
|
+
// membership-only: it fills nothing.
|
|
88
|
+
if (!engineKnown(st.engine)) {
|
|
89
|
+
throw new FlowError("flow " +
|
|
90
|
+
JSON.stringify(flow.id) +
|
|
91
|
+
" stage " +
|
|
92
|
+
JSON.stringify(st.id) +
|
|
93
|
+
": engine " +
|
|
94
|
+
JSON.stringify(st.engine) +
|
|
95
|
+
" — no engine plugin for type " +
|
|
96
|
+
JSON.stringify(st.engine) +
|
|
97
|
+
" (no engine plugin declares it)");
|
|
98
|
+
}
|
|
99
|
+
throw new FlowError("flow " +
|
|
100
|
+
JSON.stringify(flow.id) +
|
|
101
|
+
" stage " +
|
|
102
|
+
JSON.stringify(st.id) +
|
|
103
|
+
" declares no outputs and names no card — " +
|
|
104
|
+
"add outputs={'<channel>': <Kind>} on the stage");
|
|
92
105
|
}
|
|
93
106
|
return {
|
|
94
107
|
id: st.id,
|