@melite/estate-queue 0.2.2-alpha → 0.2.3-rc.4
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/lib/bench.js +30 -3
- package/lib/cardsCompose.js +10 -1
- package/lib/cardsDangling.js +17 -7
- package/lib/cardsDroppable.d.ts +11 -0
- package/lib/cardsDroppable.js +50 -0
- package/lib/cardsFacts.d.ts +37 -0
- package/lib/cardsFacts.js +47 -1
- package/lib/cardsLanes.d.ts +18 -0
- package/lib/cardsLanes.js +2 -1
- package/lib/cardsRegistry.d.ts +7 -18
- package/lib/cardsRegistry.js +128 -93
- package/lib/filmLead.js +9 -1
- package/lib/filmMemoryWarn.js +1 -0
- package/lib/flowsData.d.ts +33 -0
- package/lib/flowsData.js +45 -2
- package/lib/flowsFamilyCompose.js +1 -0
- package/lib/flowsParamsOverlay.d.ts +8 -1
- package/lib/flowsParamsOverlay.js +47 -2
- package/lib/flowsRegistryRows.js +40 -20
- package/lib/ledgerTail.js +1 -0
- package/lib/loadPlane.js +2 -0
- package/lib/managePlane.js +8 -2
- package/lib/manageProbe.js +33 -4
- package/lib/manageRegistry.d.ts +10 -0
- package/lib/manageRegistry.js +7 -1
- package/lib/managerRail.js +1 -0
- package/lib/queueCore.js +3 -1
- package/lib/queueLock.js +3 -0
- package/lib/queueResurrect.js +5 -0
- package/lib/queueSidecar.d.ts +24 -1
- package/lib/queueSidecar.js +15 -2
- package/lib/queueSweep.d.ts +38 -11
- package/lib/queueSweep.js +73 -16
- package/lib/runsChange.d.ts +5 -4
- package/lib/runsExecute.js +39 -5
- package/lib/runsGates.js +1 -0
- package/lib/runsList.js +11 -0
- package/lib/runsRegistry.d.ts +29 -3
- package/lib/runsRegistry.js +187 -8
- package/lib/runsSourceEcho.js +9 -3
- package/lib/runsTypes.d.ts +35 -0
- package/lib/runsTypes.js +42 -0
- package/lib/runsValidateArms.js +23 -2
- package/lib/runtimeProvision.js +10 -2
- package/lib/skillFs.js +3 -0
- package/lib/skillRows.js +10 -6
- package/lib/vocab.d.ts +29 -0
- package/lib/vocab.js +78 -0
- package/package.json +7 -7
package/lib/cardsRegistry.js
CHANGED
|
@@ -82,12 +82,10 @@ import { readFileSync, statSync } from "node:fs";
|
|
|
82
82
|
import { bootModels, cardDefsNow, ComposeRefusal, getModel, liveScanOrder, loadCardDefs, loadFacts, owningAtom, registryIds, registryModel, resolveCardFlowOutputs, resolveRepoRoot, theService } from "@melite/comfyui-cordis";
|
|
83
83
|
import { foldLegacyAliases } from '@melite/comfyui-card-kit';
|
|
84
84
|
import { probeMedia } from '@melite/contracts/media-probe';
|
|
85
|
-
import { DOOR_KEYS } from "./runsGates.js";
|
|
86
85
|
import { resolveSourceRefs } from "./runsSourceEcho.js";
|
|
87
86
|
import { CardArmError, EnvelopeRefusal, phaseRefusalCode } from "./cardsArmError.js";
|
|
88
87
|
export { CardArmError } from "./cardsArmError.js";
|
|
89
|
-
import { cardAdmits, factsPath, deriveDecls, familyLanesOf } from "./cardsFacts.js";
|
|
90
|
-
import { WIRE_STAGE_KEYS } from "@melite/contracts/benchStage";
|
|
88
|
+
import { cardAdmits, factsPath, deriveDecls, familyLanesOf, liftStageReservedForAdmission } from "./cardsFacts.js";
|
|
91
89
|
import { reseatDeadKeys } from "@melite/contracts/familyLane";
|
|
92
90
|
import { dropAuthoringIncomplete, isUnstatedRequiredVoice, judgeDeliverableSize, judgeLaneBounds, judgeLaneRelations, judgeLaneSurface, laneBoundsOf, laneStaleCarry, laneSurfaceOf, laneTogetherClosure, RELATION_WORDS } from "@melite/contracts/laneRelations";
|
|
93
91
|
import { lanePresenceRefusal } from "./cardsLanes.js";
|
|
@@ -97,72 +95,13 @@ import { selectCardVariant, liftCardParams } from "./cardsVariant.js";
|
|
|
97
95
|
export { selectCardVariant, stampCardOverlay, liftCardParams } from "./cardsVariant.js";
|
|
98
96
|
import { deriveWiringDoc, liveObjectInfo, resolveEngineBaseUrl } from "@melite/comfyui-cordis";
|
|
99
97
|
import { admissionRefusal, composeOnce, liftStanza, prepareCardParams } from "./cardsCompose.js";
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
export const CARD_ENVELOPE_KEYS = [
|
|
118
|
-
...DOOR_KEYS,
|
|
119
|
-
// …every wire coordinate EXCEPT `params` — and the exception is the
|
|
120
|
-
// load-bearing one. `params` is the row's knob CONTAINER: the run
|
|
121
|
-
// body's `{model, params:{…}}` stanza is what liftCardParams
|
|
122
|
-
// unwraps (the stanza law, benchStage's own), and filtering the
|
|
123
|
-
// container BEFORE that unwrap would drop every knob a caller sent
|
|
124
|
-
// — the first cut of this list did exactly that and turned every
|
|
125
|
-
// run into "this lane requires 'prompt'". A coordinate selects the
|
|
126
|
-
// graph; the knobs ride inside `params`, never as a key of it.
|
|
127
|
-
...WIRE_STAGE_KEYS.filter((k) => k !== "params"),
|
|
128
|
-
"draft_id",
|
|
129
|
-
"test",
|
|
130
|
-
"service",
|
|
131
|
-
// press_key is the submit door's retry-dedup coordinate
|
|
132
|
-
// (queueSubmit names ONE press across retries) — door
|
|
133
|
-
// vocabulary, never a card knob. It rode unregistered and the
|
|
134
|
-
// live Run press refused "unknown param(s) … press_key" while
|
|
135
|
-
// the whole suite stayed green (the contract-depth red,
|
|
136
|
-
|
|
137
|
-
"press_key",
|
|
138
|
-
// bench_stage_id is the SINGLE-CARD press's bench identity (the
|
|
139
|
-
|
|
140
|
-
// vocabulary — the card never sees it as a knob, and the composed
|
|
141
|
-
// stage stamps it (runsRegistry's card arm) so the run sidecar's
|
|
142
|
-
// digest names the row the operator pressed, which is what the
|
|
143
|
-
// bench read's `last_run` binds to. Unregistered, it would land in
|
|
144
|
-
// every card's params as an unknown knob and refuse the press.
|
|
145
|
-
"bench_stage_id",
|
|
146
|
-
// seeds is the submit door's seed-sweep coordinate (friction #9,
|
|
147
|
-
|
|
148
|
-
// door vocabulary consumed before any card composes, never a card
|
|
149
|
-
// knob. The per-run body carries the SEAT's `seed` (a real knob,
|
|
150
|
-
// deliberately NOT on this list — liftCardParams must carry it
|
|
151
|
-
// into the card's params); the sweep key itself rides the envelope.
|
|
152
|
-
"seeds",
|
|
153
|
-
// the bench row's own non-wire coordinates (benchStage's stage row
|
|
154
|
-
// carries these beside the wire keys; they select, they never ride)
|
|
155
|
-
"author",
|
|
156
|
-
"rev",
|
|
157
|
-
"stage",
|
|
158
|
-
"title",
|
|
159
|
-
"inputOutputs",
|
|
160
|
-
"result",
|
|
161
|
-
"runStatus",
|
|
162
|
-
"expect_rev",
|
|
163
|
-
"provenance",
|
|
164
|
-
"capability",
|
|
165
|
-
];
|
|
98
|
+
/** The card-envelope keys: SELECT the graph, never ride it —
|
|
99
|
+
* re-exported from the vocabulary's own home (vocab.ts) so the
|
|
100
|
+
* compose door and the graph receipt's scope gate read the ONE
|
|
101
|
+
* list (D-11: envelope keys are never knobs; the receipt never
|
|
102
|
+
* judges them). The list's derivation law and its reasons live
|
|
103
|
+
* beside the list. */
|
|
104
|
+
export { CARD_ENVELOPE_KEYS } from "./vocab.js";
|
|
166
105
|
/** The card-lane refusal: status + the _refusal envelope shape
|
|
167
106
|
* (error, code, then loc/expected/got) — the door maps it through
|
|
168
107
|
* the local refusal path. */
|
|
@@ -287,6 +226,7 @@ function stampClipGeometry(body, admits) {
|
|
|
287
226
|
bytes = new Uint8Array(readFileSync(abs));
|
|
288
227
|
}
|
|
289
228
|
catch {
|
|
229
|
+
// a missing or unreadable clip file throws at the stat/read — no bytes means no geometry stamp, never a refusal (the engine's follow-the-clip contract is the belt)
|
|
290
230
|
return;
|
|
291
231
|
}
|
|
292
232
|
let probed;
|
|
@@ -294,6 +234,7 @@ function stampClipGeometry(body, admits) {
|
|
|
294
234
|
probed = probeMedia(bytes);
|
|
295
235
|
}
|
|
296
236
|
catch {
|
|
237
|
+
// an unreadable or unrecognized container throws in the probe — the stamp skips and the engine's follow-the-clip contract is the belt
|
|
297
238
|
return;
|
|
298
239
|
}
|
|
299
240
|
const stream = probed.streams.find((s) => s.width !== undefined && s.height !== undefined);
|
|
@@ -308,8 +249,20 @@ function stampClipGeometry(body, admits) {
|
|
|
308
249
|
* soundtrack (each composes a VHS [frames, audio] load and feeds
|
|
309
250
|
* the sound VAE — replace swaps the cast, repair cleans it, extend
|
|
310
251
|
* continues it, refine upscales it; the reshoot bag is absent on
|
|
311
|
-
* purpose, its card states the soundtrack does not carry over).
|
|
312
|
-
|
|
252
|
+
* purpose, its card states the soundtrack does not carry over).
|
|
253
|
+
* THE COLLAPSE: `edit` is the live door and its masked lanes carry
|
|
254
|
+
* the source soundtrack too; the five legacy spellings stay listed
|
|
255
|
+
* because a pre-collapse doc still arms them (each resolves to the
|
|
256
|
+
* same edit cell). The upscale posture is absent like the old
|
|
257
|
+
* upscale bag: it resumes a prior run, never the source's sound. */
|
|
258
|
+
const H3_SOUND_CARRYING_BAGS = ["replace", "repair", "extend", "refine", "edit"];
|
|
259
|
+
/** An edit entry stating a chain_run composes the upscale posture
|
|
260
|
+
* (the prior run's checkpointed scenes resumed) and reads no source
|
|
261
|
+
* clip; the belt never speaks for it. */
|
|
262
|
+
function resumesPriorRun(entry) {
|
|
263
|
+
const chain = entry["chain_run"];
|
|
264
|
+
return typeof chain === "string" && chain.trim() !== "";
|
|
265
|
+
}
|
|
313
266
|
/** Resolve a bag source to a readable file: absolute, repo-relative
|
|
314
267
|
* (the compose's own staged-leaf posture), else the estate input
|
|
315
268
|
* index by basename. */
|
|
@@ -379,7 +332,10 @@ function refuseSilentSource(card, params) {
|
|
|
379
332
|
for (const entry of bag) {
|
|
380
333
|
if (entry === null || typeof entry !== "object" || Array.isArray(entry))
|
|
381
334
|
continue;
|
|
382
|
-
const
|
|
335
|
+
const row = entry;
|
|
336
|
+
if (lane === "edit" && resumesPriorRun(row))
|
|
337
|
+
continue;
|
|
338
|
+
const leaf = row["source_clip"];
|
|
383
339
|
if (typeof leaf !== "string" || leaf.trim() === "")
|
|
384
340
|
continue;
|
|
385
341
|
const bytes = bagSourceBytes(leaf.trim());
|
|
@@ -388,6 +344,7 @@ function refuseSilentSource(card, params) {
|
|
|
388
344
|
let probed;
|
|
389
345
|
try {
|
|
390
346
|
probed = probeMedia(bytes);
|
|
347
|
+
// a container the probe cannot read throws — without a positive no-audio reading this door never refuses, and the engine's own belt owns the clip
|
|
391
348
|
}
|
|
392
349
|
catch {
|
|
393
350
|
continue;
|
|
@@ -410,6 +367,71 @@ function refuseSilentSource(card, params) {
|
|
|
410
367
|
|
|
411
368
|
|
|
412
369
|
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
function stampH3SourceFrames(card, params, roots) {
|
|
375
|
+
if (card !== "h3-timeline")
|
|
376
|
+
return;
|
|
377
|
+
for (const lane of H3_SOUND_CARRYING_BAGS) {
|
|
378
|
+
const bag = params[lane];
|
|
379
|
+
if (!Array.isArray(bag) || bag.length === 0)
|
|
380
|
+
continue;
|
|
381
|
+
let cloned = null;
|
|
382
|
+
for (let i = 0; i < bag.length; i++) {
|
|
383
|
+
const row = bag[i];
|
|
384
|
+
if (row === null || typeof row !== "object" || Array.isArray(row))
|
|
385
|
+
continue;
|
|
386
|
+
const rec = row;
|
|
387
|
+
if (resumesPriorRun(rec))
|
|
388
|
+
continue;
|
|
389
|
+
const leaf = typeof rec["source_clip"] === "string" ? rec["source_clip"].trim() : "";
|
|
390
|
+
if (leaf === "")
|
|
391
|
+
continue;
|
|
392
|
+
const frames = probeSourceFrames(leaf, roots);
|
|
393
|
+
if (frames === null)
|
|
394
|
+
continue;
|
|
395
|
+
if (cloned === null)
|
|
396
|
+
cloned = bag.slice();
|
|
397
|
+
cloned[i] = { ...rec, __source_frames: frames };
|
|
398
|
+
}
|
|
399
|
+
if (cloned !== null)
|
|
400
|
+
params[lane] = cloned;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
/** Probe a bag source's true frame count at the film clock: the
|
|
404
|
+
* video stream's stts sample count, else duration × 24 (the F36
|
|
405
|
+
* refusal's own spelling). Null = unresolvable or unreadable —
|
|
406
|
+
* never an invented length. */
|
|
407
|
+
function probeSourceFrames(leaf, roots) {
|
|
408
|
+
const bytes = bagSourceBytesViaRoots(leaf, roots);
|
|
409
|
+
if (bytes === null)
|
|
410
|
+
return null;
|
|
411
|
+
let probed;
|
|
412
|
+
try {
|
|
413
|
+
probed = probeMedia(bytes);
|
|
414
|
+
// an unreadable source throws in the probe — frames stay null and the caller stamps nothing rather than an invented length
|
|
415
|
+
}
|
|
416
|
+
catch {
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
const video = probed.streams.find((stream) => stream.codec_type === "video");
|
|
420
|
+
const frames = video?.frames ?? (probed.duration_s !== undefined ? Math.round(probed.duration_s * 24) : undefined);
|
|
421
|
+
if (frames === undefined || frames <= 0)
|
|
422
|
+
return null;
|
|
423
|
+
return frames;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
|
|
413
435
|
function refuseRefineWindowPastClip(card, params, roots) {
|
|
414
436
|
if (card !== "h3-timeline")
|
|
415
437
|
return;
|
|
@@ -433,6 +455,7 @@ function refuseRefineWindowPastClip(card, params, roots) {
|
|
|
433
455
|
let probed;
|
|
434
456
|
try {
|
|
435
457
|
probed = probeMedia(bytes);
|
|
458
|
+
// a clip the probe cannot read throws — no positive frame count means this door never refuses, and the engine's own belt keeps the clip
|
|
436
459
|
}
|
|
437
460
|
catch {
|
|
438
461
|
continue;
|
|
@@ -481,6 +504,7 @@ function refuseTrimStartPastClip(card, params, roots) {
|
|
|
481
504
|
let probed;
|
|
482
505
|
try {
|
|
483
506
|
probed = probeMedia(bytes);
|
|
507
|
+
// a clip the probe cannot read throws — no positive frame count means this door never refuses, and the engine's own belt keeps the clip
|
|
484
508
|
}
|
|
485
509
|
catch {
|
|
486
510
|
return;
|
|
@@ -1197,9 +1221,24 @@ export class CardRegistryService extends Service {
|
|
|
1197
1221
|
|
|
1198
1222
|
|
|
1199
1223
|
admitStageRelations(card, params) {
|
|
1224
|
+
// THE STAGE-RESERVED LIFT AT THE WRITE DOOR (the F41 re-press
|
|
1225
|
+
|
|
1226
|
+
// the STAGE row, never the card surface — this door judged them
|
|
1227
|
+
// as undeclared card params and refused, so a knob the run
|
|
1228
|
+
// compose lifts (runsRegistry THE STAGE-RESERVED CARRY) could be
|
|
1229
|
+
// composed but never AUTHORED: every bench write door (add,
|
|
1230
|
+
// add-stages, patch, load) funnels here, and the live trellis
|
|
1231
|
+
// re-press died at each with the unknown-param refusal. The same
|
|
1232
|
+
// shared predicate the run carry rides (cardsFacts
|
|
1233
|
+
// liftStageReservedForAdmission / stageReservedKeyLifts) lifts
|
|
1234
|
+
// the policy keys out of the judged view — the STORED row keeps
|
|
1235
|
+
// its bag verbatim (the store is its truth home; only the judged
|
|
1236
|
+
// copy sheds them), and a declared reserved key (a card's own
|
|
1237
|
+
// output_name) stays judged.
|
|
1238
|
+
const judged = liftStageReservedForAdmission(this.cardDecls()[card], params);
|
|
1200
1239
|
// THE WRITE DOOR'S OWN CALL passes admitIncomplete — the ONLY
|
|
1201
1240
|
// seat that admits an unstated required word (the law above).
|
|
1202
|
-
const verdict = this.laneVerdict(card,
|
|
1241
|
+
const verdict = this.laneVerdict(card, judged, true);
|
|
1203
1242
|
return verdict === null ? { ok: true } : { ok: false, error: verdict };
|
|
1204
1243
|
}
|
|
1205
1244
|
|
|
@@ -1413,7 +1452,9 @@ export class CardRegistryService extends Service {
|
|
|
1413
1452
|
// truth has no live rows) — the null arm is the lane judge's
|
|
1414
1453
|
// own "declares nothing, judges nothing", exercised with
|
|
1415
1454
|
// literal sets at laneStaleCarry's wall.
|
|
1416
|
-
/* v8 ignore next
|
|
1455
|
+
/* v8 ignore next -- no live facts row ships surface: null;
|
|
1456
|
+
the arm is wallable only through laneStaleCarry's literal
|
|
1457
|
+
sets, which v8 does not count into this file's coverage. */
|
|
1417
1458
|
if (surface === null)
|
|
1418
1459
|
return null;
|
|
1419
1460
|
const taken = new Set(surface);
|
|
@@ -1715,26 +1756,13 @@ export class CardRegistryService extends Service {
|
|
|
1715
1756
|
// write seat, in the same voice the run door speaks.
|
|
1716
1757
|
if (e instanceof EnvelopeRefusal)
|
|
1717
1758
|
return { message: e.message, incomplete: false };
|
|
1759
|
+
// THE EMPTY-SELECTION LAW lives FIRST-CLASS above the prepare
|
|
1718
1760
|
|
|
1719
|
-
//
|
|
1720
|
-
//
|
|
1721
|
-
|
|
1722
|
-
//
|
|
1723
|
-
//
|
|
1724
|
-
// false admit the parity law forbids (the envelope GAP-1
|
|
1725
|
-
// shape, one axis over). Refuse HERE, in the run door's own
|
|
1726
|
-
// voice — one spelling, both seats. A stated WRONG selection
|
|
1727
|
-
// still passes (the tolerance below: repairable, the run
|
|
1728
|
-
// names it); an ABSENT one still passes (compose defaults
|
|
1729
|
-
// it). The form's own half of the law: seedAxisValues omits
|
|
1730
|
-
// an empty axis key (card-base/src/spec.ts) so the GUI never
|
|
1731
|
-
// authors the empty string in the first place.
|
|
1732
|
-
if (e instanceof CardArmError &&
|
|
1733
|
-
(params["variant"] === "" || params["quant"] === "" || params["model"] === "")) {
|
|
1734
|
-
return { message: e.message, incomplete: false };
|
|
1735
|
-
}
|
|
1736
|
-
// selection/dangling failures keep the run door's voice —
|
|
1737
|
-
// this seat judges only the DECL's own words
|
|
1761
|
+
// variant/quant/model never reaches this catch — the loop
|
|
1762
|
+
// refuses it before prepare runs, so the conversion arm this
|
|
1763
|
+
|
|
1764
|
+
// WRONG selection keeps the run door's voice — this seat
|
|
1765
|
+
// judges only the DECL's own words.
|
|
1738
1766
|
return null;
|
|
1739
1767
|
}
|
|
1740
1768
|
// THE UNDECLARED-KEY GATE, family side (a key no card declares
|
|
@@ -1975,6 +2003,7 @@ export class CardRegistryService extends Service {
|
|
|
1975
2003
|
// face, the stored doc untouched.
|
|
1976
2004
|
const kinds = this.defsSync().get(prep.card)?.flowKinds;
|
|
1977
2005
|
return foldLegacyAliases(kinds, prep.params);
|
|
2006
|
+
// an unservable body throws CardArmError from prepareCardParams — null lets the stage ride un-resolved (the serve is display-only) and the run door owns the refusal
|
|
1978
2007
|
}
|
|
1979
2008
|
catch {
|
|
1980
2009
|
return null;
|
|
@@ -2171,6 +2200,12 @@ export class CardRegistryService extends Service {
|
|
|
2171
2200
|
// and the file named (the run door's own envelope walk, so the
|
|
2172
2201
|
// validate seat hears the same sentence).
|
|
2173
2202
|
refuseSilentSource(prep.card, prep.params);
|
|
2203
|
+
// THE PROBED-LENGTH STAMP (defect board D-5): the same walk's
|
|
2204
|
+
// positive face — a locally readable source's TRUE frame count
|
|
2205
|
+
// rides the compose copy so the render judges the film, never
|
|
2206
|
+
// the blind clip_seconds plan slice (the 56 f clip's refine 2x
|
|
2207
|
+
// press refused "a 144 f window" before this stamp).
|
|
2208
|
+
stampH3SourceFrames(prep.card, prep.params, this.stateRoots());
|
|
2174
2209
|
// THE REFINE WINDOW RANGE REFUSAL (F36): a window whose
|
|
2175
2210
|
// start_seconds runs past its own source clip refuses here,
|
|
2176
2211
|
// zero GPU, with the clip and the probed length named. The
|
package/lib/filmLead.js
CHANGED
|
@@ -10,7 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
const ENGINE_FILM_RE = /(?:^|[/_])h3_t4_film(?:_[a-z0-9][a-z0-9-]*)?_\d+_\.mp4$/;
|
|
14
22
|
/** The engine-composed film's name among a stage's artifacts, if
|
|
15
23
|
* any — presentation order only, never composition. */
|
|
16
24
|
export function engineFilmName(names) {
|
package/lib/filmMemoryWarn.js
CHANGED
|
@@ -88,6 +88,7 @@ export async function fetchEngineMem(baseUrl, fetchFn = globalThis.fetch, timeou
|
|
|
88
88
|
if (typeof free !== 'number' || typeof total !== 'number')
|
|
89
89
|
return null;
|
|
90
90
|
return { vramFree: free, vramTotal: total };
|
|
91
|
+
// an unreachable engine or an unparseable stats body has no reading — null is the caller's documented skip
|
|
91
92
|
}
|
|
92
93
|
catch {
|
|
93
94
|
return null;
|
package/lib/flowsData.d.ts
CHANGED
|
@@ -139,8 +139,24 @@ export declare function initialKindGloss(kind: RegistryInitialKind): string;
|
|
|
139
139
|
* @param flow the registry row
|
|
140
140
|
* @returns the gloss per declared initial key */
|
|
141
141
|
export declare function flowInitialGlosses(flow: RegistryFlow): Record<string, string>;
|
|
142
|
+
/** The {"initial": key} edge builder — a stage input bound to an
|
|
143
|
+
* operator-supplied initial.
|
|
144
|
+
* @param key the initial's declared name
|
|
145
|
+
* @returns the initial edge */
|
|
142
146
|
export declare function initial(key: string): RegistryInitialEdge;
|
|
147
|
+
/** The {"stage": id, "output": name} edge builder — a stage input
|
|
148
|
+
* bound to an earlier stage's output.
|
|
149
|
+
* @param stage the source stage's id
|
|
150
|
+
* @param output the source output's name
|
|
151
|
+
* @returns the stage edge */
|
|
143
152
|
export declare function fromStage(stage: string, output: string): RegistryStageEdge;
|
|
153
|
+
/** The authoring builder for a self-contained stage row: optional
|
|
154
|
+
* fields fill their empty defaults (card/family/action "", the
|
|
155
|
+
* records {}, skipWhen null); the row must name exactly one
|
|
156
|
+
* composing plane (refuseRawWorkflowShape judges it at registration).
|
|
157
|
+
* @param row the declared fields (id, engine, card/family/action,
|
|
158
|
+
* description, inputs, expected/outputs/cardIo, params, skipWhen)
|
|
159
|
+
* @returns the RegistryStage row */
|
|
144
160
|
export declare function plainStage(row: {
|
|
145
161
|
readonly id: string;
|
|
146
162
|
readonly engine: string;
|
|
@@ -158,6 +174,15 @@ export declare function plainStage(row: {
|
|
|
158
174
|
readonly when: string;
|
|
159
175
|
} | null;
|
|
160
176
|
}): RegistryStage;
|
|
177
|
+
/** The from_flow link builder: a stage copied from the named flow's
|
|
178
|
+
* stage at expansion time (id and inputs overridden there); the
|
|
179
|
+
* engine/card/description fields ride empty until the link resolves,
|
|
180
|
+
* and the source may register later than this row.
|
|
181
|
+
* @param flow the source flow's id
|
|
182
|
+
* @param stage the source stage's id
|
|
183
|
+
* @param id this row's own stage id
|
|
184
|
+
* @param inputs the row's winning input edges
|
|
185
|
+
* @returns the linked RegistryStage row */
|
|
161
186
|
export declare function linkedStage(flow: string, stage: string, id: string, inputs: Record<string, RegistryEdge>): RegistryStage;
|
|
162
187
|
import { Service } from "@deepseek-ai/cordis";
|
|
163
188
|
import type { Context } from "@deepseek-ai/cordis";
|
|
@@ -216,6 +241,14 @@ export declare class FlowsSeatService extends Service implements FlowsSeat {
|
|
|
216
241
|
|
|
217
242
|
|
|
218
243
|
export declare function refuseRawWorkflowShape(flowId: string, st: RegistryStage): void;
|
|
244
|
+
/** Expand a declaration into servable form: self-contained stages pass
|
|
245
|
+
* the raw-workflow gate and detach into fresh containers; linked
|
|
246
|
+
* stages resolve against the LIVE seat (source flow and stage must
|
|
247
|
+
* exist, single-hop only) and copy the source row under this row's id
|
|
248
|
+
* and inputs. A dangling link refuses loud, naming the flow and stage.
|
|
249
|
+
* @param flow the declaration to expand
|
|
250
|
+
* @param seat the live FlowsSeat the links resolve against
|
|
251
|
+
* @returns the flow with every stage expanded */
|
|
219
252
|
export declare function expandRegistryFlow(flow: RegistryFlow, seat: FlowsSeat): RegistryFlow;
|
|
220
253
|
|
|
221
254
|
|
package/lib/flowsData.js
CHANGED
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
//
|
|
19
19
|
// Erasable-syntax TS only (node --experimental-strip-types).
|
|
20
20
|
import { isFile } from "./skillFs.js";
|
|
21
|
+
import { assertNever } from "@deepseek-ai/dsh-util-values";
|
|
21
22
|
import { CARD_PLANE_ENGINE, LEGACY_RUN_MEDIA_PREFIX, RUN_MEDIA_PREFIX } from "@melite/contracts/benchStage";
|
|
22
|
-
import { join, resolve } from "node:path";
|
|
23
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
23
24
|
import { mediaVocab } from "./mediaKinds.js";
|
|
24
25
|
import { validateBakeParams } from "./bakeParams.js";
|
|
25
26
|
|
|
@@ -70,6 +71,10 @@ export function initialKindGloss(kind) {
|
|
|
70
71
|
return "finite JSON number";
|
|
71
72
|
case "json":
|
|
72
73
|
return "JSON object (or its string spelling)";
|
|
74
|
+
default:
|
|
75
|
+
// the closed-union law: a new kind joining RegistryInitialKind
|
|
76
|
+
// compiles red HERE, never silently vanishes the gloss
|
|
77
|
+
return assertNever(kind, "flowsData.initialKindGloss");
|
|
73
78
|
}
|
|
74
79
|
}
|
|
75
80
|
/** A flow's initial keys → glosses, the same derivation order the
|
|
@@ -85,12 +90,28 @@ export function flowInitialGlosses(flow) {
|
|
|
85
90
|
return out;
|
|
86
91
|
}
|
|
87
92
|
// ── shared builders ─────────────────────────────────────────────
|
|
93
|
+
/** The {"initial": key} edge builder — a stage input bound to an
|
|
94
|
+
* operator-supplied initial.
|
|
95
|
+
* @param key the initial's declared name
|
|
96
|
+
* @returns the initial edge */
|
|
88
97
|
export function initial(key) {
|
|
89
98
|
return { initial: key };
|
|
90
99
|
}
|
|
100
|
+
/** The {"stage": id, "output": name} edge builder — a stage input
|
|
101
|
+
* bound to an earlier stage's output.
|
|
102
|
+
* @param stage the source stage's id
|
|
103
|
+
* @param output the source output's name
|
|
104
|
+
* @returns the stage edge */
|
|
91
105
|
export function fromStage(stage, output) {
|
|
92
106
|
return { stage, output };
|
|
93
107
|
}
|
|
108
|
+
/** The authoring builder for a self-contained stage row: optional
|
|
109
|
+
* fields fill their empty defaults (card/family/action "", the
|
|
110
|
+
* records {}, skipWhen null); the row must name exactly one
|
|
111
|
+
* composing plane (refuseRawWorkflowShape judges it at registration).
|
|
112
|
+
* @param row the declared fields (id, engine, card/family/action,
|
|
113
|
+
* description, inputs, expected/outputs/cardIo, params, skipWhen)
|
|
114
|
+
* @returns the RegistryStage row */
|
|
94
115
|
export function plainStage(row) {
|
|
95
116
|
return {
|
|
96
117
|
id: row.id,
|
|
@@ -108,6 +129,15 @@ export function plainStage(row) {
|
|
|
108
129
|
fromFlow: null,
|
|
109
130
|
};
|
|
110
131
|
}
|
|
132
|
+
/** The from_flow link builder: a stage copied from the named flow's
|
|
133
|
+
* stage at expansion time (id and inputs overridden there); the
|
|
134
|
+
* engine/card/description fields ride empty until the link resolves,
|
|
135
|
+
* and the source may register later than this row.
|
|
136
|
+
* @param flow the source flow's id
|
|
137
|
+
* @param stage the source stage's id
|
|
138
|
+
* @param id this row's own stage id
|
|
139
|
+
* @param inputs the row's winning input edges
|
|
140
|
+
* @returns the linked RegistryStage row */
|
|
111
141
|
export function linkedStage(flow, stage, id, inputs) {
|
|
112
142
|
return {
|
|
113
143
|
id,
|
|
@@ -329,6 +359,14 @@ function detachStage(st) {
|
|
|
329
359
|
skipWhen: structuredClone(st.skipWhen),
|
|
330
360
|
};
|
|
331
361
|
}
|
|
362
|
+
/** Expand a declaration into servable form: self-contained stages pass
|
|
363
|
+
* the raw-workflow gate and detach into fresh containers; linked
|
|
364
|
+
* stages resolve against the LIVE seat (source flow and stage must
|
|
365
|
+
* exist, single-hop only) and copy the source row under this row's id
|
|
366
|
+
* and inputs. A dangling link refuses loud, naming the flow and stage.
|
|
367
|
+
* @param flow the declaration to expand
|
|
368
|
+
* @param seat the live FlowsSeat the links resolve against
|
|
369
|
+
* @returns the flow with every stage expanded */
|
|
332
370
|
export function expandRegistryFlow(flow, seat) {
|
|
333
371
|
const stages = flow.stages.map((st) => {
|
|
334
372
|
if (st.fromFlow === null) {
|
|
@@ -517,7 +555,11 @@ export function initialFileCandidates(raw, roots) {
|
|
|
517
555
|
cands.push(join(root, rel));
|
|
518
556
|
}
|
|
519
557
|
}
|
|
520
|
-
else if (raw
|
|
558
|
+
else if (isAbsolute(raw)) {
|
|
559
|
+
// (isAbsolute, not startsWith("/"): a native absolute path
|
|
560
|
+
// carries backslashes on win32 and fell into the relative
|
|
561
|
+
// branch — resolve()d twice into a doubled candidate. On posix
|
|
562
|
+
// the two spellings coincide.)
|
|
521
563
|
cands.push(raw);
|
|
522
564
|
}
|
|
523
565
|
else {
|
|
@@ -666,6 +708,7 @@ export function normalizedInitialValue(key, kind, value) {
|
|
|
666
708
|
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)
|
|
667
709
|
? parsed
|
|
668
710
|
: null;
|
|
711
|
+
// an unparseable JSON string throws SyntaxError — null fails loud at the door, a shape the gate would have refused
|
|
669
712
|
}
|
|
670
713
|
catch {
|
|
671
714
|
return null;
|
|
@@ -33,6 +33,7 @@ export function liveFamilySeat(modelsSeat) {
|
|
|
33
33
|
try {
|
|
34
34
|
const decls = modelsService().allDecls();
|
|
35
35
|
return { decls, state: decls.length === 0 ? "bare" : "seated" };
|
|
36
|
+
// an unbooted context throws on the singleton read — "absent" is the seat's answer, and a family stage refuses loud on it inside composeOne
|
|
36
37
|
}
|
|
37
38
|
catch {
|
|
38
39
|
return { decls: [], state: "absent" };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CardRegistryService } from "./cardsRegistry.js";
|
|
2
|
+
import type { RegistryToolOverlay } from "./flowsData.js";
|
|
2
3
|
/**
|
|
3
4
|
* The overlay's mod-fold scoping decision (round-22 compose audit
|
|
4
5
|
* Q3a): which family scopes the absorbed mod surface for a stage's
|
|
@@ -50,6 +51,12 @@ export declare function overlayDecls(cardRegistry: Pick<CardRegistryService, "ca
|
|
|
50
51
|
* @param fam the request's family seat (`body.model`, "" when the
|
|
51
52
|
* request names none) — scopes the absorbed mod surface to the
|
|
52
53
|
* owning atom, the same fold compose and variant judge with
|
|
54
|
+
* @param toolOverlays the flow row's declared tool overlays — a
|
|
55
|
+
* verbatim (choices-null) overlay pins its flat param on EVERY
|
|
56
|
+
* listed stage (image-upscale's twin make+polish seed), the
|
|
57
|
+
* declared semantic the generic single-target scan would refuse
|
|
58
|
+
* as ambiguous. Choices-mapped overlays fall through to the
|
|
59
|
+
* generic scan (today's law, unchanged).
|
|
53
60
|
*/
|
|
54
|
-
export declare function applyFlowParamsOverride(flowName: string, stages: ReadonlyArray<unknown>, overrideRaw: unknown, decls: ReturnType<CardRegistryService["cardDecls"]>, fam: string): void;
|
|
61
|
+
export declare function applyFlowParamsOverride(flowName: string, stages: ReadonlyArray<unknown>, overrideRaw: unknown, decls: ReturnType<CardRegistryService["cardDecls"]>, fam: string, toolOverlays?: readonly RegistryToolOverlay[]): void;
|
|
55
62
|
//# sourceMappingURL=flowsParamsOverlay.d.ts.map
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { RemoteError } from "@deepseek-ai/dsh-typert-protocol";
|
|
5
5
|
import { owningAtom, theService } from "@melite/comfyui-cordis";
|
|
6
6
|
import { cardAdmits } from "./cardsCompose.js";
|
|
7
|
+
import { ESTATE_NAMING_ROW } from "@melite/contracts/formSpec";
|
|
7
8
|
/**
|
|
8
9
|
* The overlay's mod-fold scoping decision (round-22 compose audit
|
|
9
10
|
* Q3a): which family scopes the absorbed mod surface for a stage's
|
|
@@ -67,8 +68,14 @@ export function overlayDecls(cardRegistry) {
|
|
|
67
68
|
* @param fam the request's family seat (`body.model`, "" when the
|
|
68
69
|
* request names none) — scopes the absorbed mod surface to the
|
|
69
70
|
* owning atom, the same fold compose and variant judge with
|
|
71
|
+
* @param toolOverlays the flow row's declared tool overlays — a
|
|
72
|
+
* verbatim (choices-null) overlay pins its flat param on EVERY
|
|
73
|
+
* listed stage (image-upscale's twin make+polish seed), the
|
|
74
|
+
* declared semantic the generic single-target scan would refuse
|
|
75
|
+
* as ambiguous. Choices-mapped overlays fall through to the
|
|
76
|
+
* generic scan (today's law, unchanged).
|
|
70
77
|
*/
|
|
71
|
-
export function applyFlowParamsOverride(flowName, stages, overrideRaw, decls, fam) {
|
|
78
|
+
export function applyFlowParamsOverride(flowName, stages, overrideRaw, decls, fam, toolOverlays = []) {
|
|
72
79
|
if (typeof overrideRaw !== "object" || overrideRaw === null || Array.isArray(overrideRaw)) {
|
|
73
80
|
throw new RemoteError("runs/invalid-request", "flow params must be an object ({key: value} or {stage_id: {key: value}}), got " +
|
|
74
81
|
JSON.stringify(overrideRaw), { loc: "params" });
|
|
@@ -117,7 +124,11 @@ export function applyFlowParamsOverride(flowName, stages, overrideRaw, decls, fa
|
|
|
117
124
|
};
|
|
118
125
|
const admitsParam = (row, key) => {
|
|
119
126
|
const card = typeof row["card"] === "string" ? row["card"] : "";
|
|
120
|
-
|
|
127
|
+
// THE ESTATE NAMING ROW (queue 12): compose's admission door
|
|
128
|
+
// sanctions it estate-wide (the faces teach it on every card
|
|
129
|
+
// declaring none of its own); validate over-admitting into that
|
|
130
|
+
// door is this overlay's own law.
|
|
131
|
+
return key === ESTATE_NAMING_ROW.name || cardAdmits(decls[card], modNamesOf(card), key);
|
|
121
132
|
};
|
|
122
133
|
// THE FAMILY ROWS TAKE NO PARAMS (round-23 audit Q2): a family
|
|
123
134
|
// stage carries card "" (the either/or row contract), so no decl
|
|
@@ -172,6 +183,40 @@ export function applyFlowParamsOverride(flowName, stages, overrideRaw, decls, fa
|
|
|
172
183
|
}
|
|
173
184
|
continue;
|
|
174
185
|
}
|
|
186
|
+
|
|
187
|
+
// reproduce): a verbatim tool overlay pins its flat param on
|
|
188
|
+
// every listed stage BEFORE the single-target scan runs, so a
|
|
189
|
+
// declared twin (image-upscale's seed → make + polish) stamps
|
|
190
|
+
// both and the stated seed reaches both samplers. The admission
|
|
191
|
+
// scan below never sees the key (consumed here); a listed stage
|
|
192
|
+
// that admits nothing, or a stage id the row does not name, is a
|
|
193
|
+
// broken declaration and refuses LOUD — never a silent half-pin.
|
|
194
|
+
const twins = toolOverlays.filter((o) => o.param === key && o.choices === null);
|
|
195
|
+
if (twins.length > 0) {
|
|
196
|
+
for (const o of twins) {
|
|
197
|
+
const target = stageRows.find((r) => r["id"] === o.stage);
|
|
198
|
+
if (target === undefined) {
|
|
199
|
+
throw new RemoteError("runs/invalid-request", "flow " + flowName + " declares a seed overlay on stage " +
|
|
200
|
+
JSON.stringify(o.stage) + " — no such stage " +
|
|
201
|
+
"(stages: " + stageRows.map((r) => JSON.stringify(r["id"])).join(", ") + ")", { loc: "params" });
|
|
202
|
+
}
|
|
203
|
+
if (!admitsParam(target, key)) {
|
|
204
|
+
throw new RemoteError("runs/invalid-request", "card " + JSON.stringify(target["card"]) +
|
|
205
|
+
" does not admit param " + JSON.stringify(key) +
|
|
206
|
+
" — the flow's declared overlay names it anyway (admitted: " +
|
|
207
|
+
JSON.stringify(admitOf(target)) + ")", { loc: "params" });
|
|
208
|
+
}
|
|
209
|
+
let at = paramsOf(target);
|
|
210
|
+
for (const seg of o.path.slice(0, -1)) {
|
|
211
|
+
if (typeof at[seg] !== "object" || at[seg] === null || Array.isArray(at[seg])) {
|
|
212
|
+
at[seg] = {};
|
|
213
|
+
}
|
|
214
|
+
at = at[seg];
|
|
215
|
+
}
|
|
216
|
+
at[o.path[o.path.length - 1]] = value;
|
|
217
|
+
}
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
175
220
|
// THE FLAT SHAPE: exactly one admitting stage, or refuse.
|
|
176
221
|
const targets = stageRows.filter((r) => admitsParam(r, key));
|
|
177
222
|
if (targets.length === 0) {
|