@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/cardsRegistry.js
CHANGED
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
// Erasable-syntax TS only (node --experimental-strip-types): no
|
|
69
69
|
// enums, import type for types, .ts specifiers for relative imports.
|
|
70
70
|
import { Service } from "@deepseek-ai/cordis";
|
|
71
|
+
import { readFileSync, statSync } from "node:fs";
|
|
71
72
|
// CROSS-COPY LAW (the estate's documented topology): the engine
|
|
72
73
|
// package resolves the REGISTRY cordis instance; this package's
|
|
73
74
|
// "@deepseek-ai/cordis" is the vendor instance. The service TYPE
|
|
@@ -78,13 +79,17 @@ import { Service } from "@deepseek-ai/cordis";
|
|
|
78
79
|
* package (the registry-keyed instance ComfyUIService mounts on),
|
|
79
80
|
* imported through the engine's public surface like every other
|
|
80
81
|
* engine dep. No deep path, no runtime-only dodge. */
|
|
81
|
-
import { bootModels, cardDefsNow, ComposeRefusal, getModel, liveScanOrder, loadCardDefs, loadFacts, registryIds, registryModel, resolveCardFlowOutputs, theService } from "@melite/comfyui-cordis";
|
|
82
|
+
import { bootModels, cardDefsNow, ComposeRefusal, getModel, liveScanOrder, loadCardDefs, loadFacts, owningAtom, registryIds, registryModel, resolveCardFlowOutputs, resolveRepoRoot, theService } from "@melite/comfyui-cordis";
|
|
83
|
+
import { foldLegacyAliases } from '@melite/comfyui-card-kit';
|
|
84
|
+
import { probeMedia } from '@melite/contracts/media-probe';
|
|
82
85
|
import { DOOR_KEYS } from "./runsGates.js";
|
|
86
|
+
import { resolveSourceRefs } from "./runsSourceEcho.js";
|
|
83
87
|
import { CardArmError, EnvelopeRefusal, phaseRefusalCode } from "./cardsArmError.js";
|
|
84
88
|
export { CardArmError } from "./cardsArmError.js";
|
|
85
|
-
import { factsPath, deriveDecls } from "./cardsFacts.js";
|
|
89
|
+
import { cardAdmits, factsPath, deriveDecls, familyLanesOf } from "./cardsFacts.js";
|
|
86
90
|
import { WIRE_STAGE_KEYS } from "@melite/contracts/benchStage";
|
|
87
|
-
import {
|
|
91
|
+
import { reseatDeadKeys } from "@melite/contracts/familyLane";
|
|
92
|
+
import { dropAuthoringIncomplete, isUnstatedRequiredVoice, judgeDeliverableSize, judgeLaneBounds, judgeLaneRelations, judgeLaneSurface, laneBoundsOf, laneStaleCarry, laneSurfaceOf, laneTogetherClosure, RELATION_WORDS } from "@melite/contracts/laneRelations";
|
|
88
93
|
import { lanePresenceRefusal } from "./cardsLanes.js";
|
|
89
94
|
import { selectCardVariant, liftCardParams } from "./cardsVariant.js";
|
|
90
95
|
// the extracted planes re-export through the registry's public
|
|
@@ -130,6 +135,21 @@ export const CARD_ENVELOPE_KEYS = [
|
|
|
130
135
|
// the whole suite stayed green (the contract-depth red,
|
|
131
136
|
|
|
132
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",
|
|
133
153
|
// the bench row's own non-wire coordinates (benchStage's stage row
|
|
134
154
|
// carries these beside the wire keys; they select, they never ride)
|
|
135
155
|
"author",
|
|
@@ -215,11 +235,296 @@ export function familyFace(fam) {
|
|
|
215
235
|
* the sentence stem (isUnstatedRequiredVoice — the one spelling).
|
|
216
236
|
* Named — the run seat's refusal code and the write door's filter
|
|
217
237
|
* spell the same class through it. */
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
function stampClipGeometry(body, admits) {
|
|
259
|
+
const clip = body["clip"];
|
|
260
|
+
if (typeof clip !== "string" || clip === "")
|
|
261
|
+
return;
|
|
262
|
+
// UNSTATED has two spellings: an ABSENT key (the GUI wire omits
|
|
263
|
+
|
|
264
|
+
// width/height at all, run-9e6585c227c8) and an explicit 0 (the
|
|
265
|
+
// form's stated default). Both mean "the user owns no geometry";
|
|
266
|
+
// either stamps. A stated non-zero number is the user's — never
|
|
267
|
+
// touched.
|
|
268
|
+
const w = body["width"];
|
|
269
|
+
const h = body["height"];
|
|
270
|
+
const unstated = (v) => v === undefined || v === 0;
|
|
271
|
+
if (typeof w !== "number" && w !== undefined)
|
|
272
|
+
return;
|
|
273
|
+
if (typeof h !== "number" && h !== undefined)
|
|
274
|
+
return;
|
|
275
|
+
if (!unstated(w) && !unstated(h))
|
|
276
|
+
return;
|
|
277
|
+
if (!admits("width") && !admits("height"))
|
|
278
|
+
return;
|
|
279
|
+
const abs = clip.startsWith("/")
|
|
280
|
+
? clip
|
|
281
|
+
: resolveRepoRoot() + "/" + clip.replace(/^\/+/, "");
|
|
282
|
+
let bytes;
|
|
283
|
+
try {
|
|
284
|
+
const st = statSync(abs);
|
|
285
|
+
if (!st.isFile())
|
|
286
|
+
return;
|
|
287
|
+
bytes = new Uint8Array(readFileSync(abs));
|
|
288
|
+
}
|
|
289
|
+
catch {
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
let probed;
|
|
293
|
+
try {
|
|
294
|
+
probed = probeMedia(bytes);
|
|
295
|
+
}
|
|
296
|
+
catch {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const stream = probed.streams.find((s) => s.width !== undefined && s.height !== undefined);
|
|
300
|
+
if (stream === undefined)
|
|
301
|
+
return;
|
|
302
|
+
if (unstated(w) && admits("width"))
|
|
303
|
+
body["width"] = stream.width;
|
|
304
|
+
if (unstated(h) && admits("height"))
|
|
305
|
+
body["height"] = stream.height;
|
|
306
|
+
}
|
|
307
|
+
/** The h3 bags whose second pass CARRIES the source clip's
|
|
308
|
+
* soundtrack (each composes a VHS [frames, audio] load and feeds
|
|
309
|
+
* the sound VAE — replace swaps the cast, repair cleans it, extend
|
|
310
|
+
* continues it, refine upscales it; the reshoot bag is absent on
|
|
311
|
+
* purpose, its card states the soundtrack does not carry over). */
|
|
312
|
+
const H3_SOUND_CARRYING_BAGS = ["replace", "repair", "extend", "refine"];
|
|
313
|
+
/** Resolve a bag source to a readable file: absolute, repo-relative
|
|
314
|
+
* (the compose's own staged-leaf posture), else the estate input
|
|
315
|
+
* index by basename. */
|
|
316
|
+
function bagSourceBytes(leaf) {
|
|
317
|
+
const candidates = [];
|
|
318
|
+
if (leaf.startsWith("/"))
|
|
319
|
+
candidates.push(leaf);
|
|
320
|
+
candidates.push(resolveRepoRoot() + "/" + leaf.replace(/^\/+/, ""));
|
|
321
|
+
const base = leaf.split("/").pop() ?? "";
|
|
322
|
+
if (base !== "")
|
|
323
|
+
candidates.push(resolveRepoRoot() + "/data/input/" + base);
|
|
324
|
+
for (const abs of candidates) {
|
|
325
|
+
try {
|
|
326
|
+
const st = statSync(abs);
|
|
327
|
+
if (!st.isFile())
|
|
328
|
+
continue;
|
|
329
|
+
return new Uint8Array(readFileSync(abs));
|
|
330
|
+
}
|
|
331
|
+
catch {
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
/** Resolve a probe source through the estate's OWN roots first (the
|
|
340
|
+
* runs trees a prior stage's render left behind — runsSourceEcho's
|
|
341
|
+
* resolver, the run door's own vocabulary: run-tails land in
|
|
342
|
+
* `<root>/output/<runId>/<rel>`, absolutes verbatim), then the
|
|
343
|
+
* compose spellings. A produced clip is the bench's actual posture
|
|
344
|
+
* (the rev-122 burn's 7.5 s film): the three compose candidates
|
|
345
|
+
* never saw it, and the window probes silently went deaf. A source
|
|
346
|
+
* that resolves nowhere answers null — the belt, never an invented
|
|
347
|
+
* refusal. */
|
|
348
|
+
function bagSourceBytesViaRoots(leaf, roots) {
|
|
349
|
+
try {
|
|
350
|
+
for (const row of resolveSourceRefs([leaf], roots)) {
|
|
351
|
+
const st = statSync(row.file);
|
|
352
|
+
if (!st.isFile())
|
|
353
|
+
continue;
|
|
354
|
+
return new Uint8Array(readFileSync(row.file));
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
catch {
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
}
|
|
362
|
+
return bagSourceBytes(leaf);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
function refuseSilentSource(card, params) {
|
|
373
|
+
if (card !== "h3-timeline")
|
|
374
|
+
return;
|
|
375
|
+
for (const lane of H3_SOUND_CARRYING_BAGS) {
|
|
376
|
+
const bag = params[lane];
|
|
377
|
+
if (!Array.isArray(bag) || bag.length === 0)
|
|
378
|
+
continue;
|
|
379
|
+
for (const entry of bag) {
|
|
380
|
+
if (entry === null || typeof entry !== "object" || Array.isArray(entry))
|
|
381
|
+
continue;
|
|
382
|
+
const leaf = entry["source_clip"];
|
|
383
|
+
if (typeof leaf !== "string" || leaf.trim() === "")
|
|
384
|
+
continue;
|
|
385
|
+
const bytes = bagSourceBytes(leaf.trim());
|
|
386
|
+
if (bytes === null)
|
|
387
|
+
continue;
|
|
388
|
+
let probed;
|
|
389
|
+
try {
|
|
390
|
+
probed = probeMedia(bytes);
|
|
391
|
+
}
|
|
392
|
+
catch {
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
if (probed.streams.some((stream) => stream.codec_type === "audio" || stream.sample_rate !== undefined))
|
|
396
|
+
continue;
|
|
397
|
+
throw new CardArmError(400, `the ${lane} pass carries the source clip's soundtrack, and "${leaf.trim()}" has no audio track ` +
|
|
398
|
+
`(probed ${probed.streams.length} stream(s), none audio) — add a track, or pick a source that has one; ` +
|
|
399
|
+
`a silent source dies mid-render inside the video loader`, "invalid_request");
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
function refuseRefineWindowPastClip(card, params, roots) {
|
|
414
|
+
if (card !== "h3-timeline")
|
|
415
|
+
return;
|
|
416
|
+
const bag = params["refine"];
|
|
417
|
+
if (!Array.isArray(bag))
|
|
418
|
+
return;
|
|
419
|
+
for (const entry of bag) {
|
|
420
|
+
if (entry === null || typeof entry !== "object" || Array.isArray(entry))
|
|
421
|
+
continue;
|
|
422
|
+
const rec = entry;
|
|
423
|
+
const leaf = typeof rec["source_clip"] === "string" ? rec["source_clip"].trim() : "";
|
|
424
|
+
if (leaf === "")
|
|
425
|
+
continue;
|
|
426
|
+
const rawStart = rec["start_seconds"];
|
|
427
|
+
const start = typeof rawStart === "number" && Number.isFinite(rawStart) ? rawStart : 0;
|
|
428
|
+
if (!(start > 0))
|
|
429
|
+
continue;
|
|
430
|
+
const bytes = bagSourceBytesViaRoots(leaf, roots);
|
|
431
|
+
if (bytes === null)
|
|
432
|
+
continue;
|
|
433
|
+
let probed;
|
|
434
|
+
try {
|
|
435
|
+
probed = probeMedia(bytes);
|
|
436
|
+
}
|
|
437
|
+
catch {
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
440
|
+
const video = probed.streams.find((stream) => stream.codec_type === "video");
|
|
441
|
+
const frames = video?.frames ?? (probed.duration_s !== undefined ? Math.round(probed.duration_s * 24) : undefined);
|
|
442
|
+
if (frames === undefined || frames <= 0)
|
|
443
|
+
continue;
|
|
444
|
+
const skip = Math.round(start * 24);
|
|
445
|
+
if (skip < frames)
|
|
446
|
+
continue;
|
|
447
|
+
const clipEndS = (frames / 24).toFixed(2);
|
|
448
|
+
throw new CardArmError(400, `the refine window starts at ${start}s (skip ${skip} frames at the film clock) but "${leaf}" carries ` +
|
|
449
|
+
`${frames} frame(s)${probed.duration_s !== undefined ? ` (${probed.duration_s}s)` : ""} — the loader's ` +
|
|
450
|
+
`skip_first_frames runs past the clip's end and the engine dies in the buffer arithmetic; start the ` +
|
|
451
|
+
`window inside the clip (start_seconds < ${clipEndS}s) or refine the longer source`, "invalid_request");
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
function refuseTrimStartPastClip(card, params, roots) {
|
|
469
|
+
if (card !== "trim")
|
|
470
|
+
return;
|
|
471
|
+
const leaf = typeof params["clip"] === "string" ? params["clip"].trim() : "";
|
|
472
|
+
if (leaf === "")
|
|
473
|
+
return;
|
|
474
|
+
const rawStart = params["start_seconds"];
|
|
475
|
+
const start = typeof rawStart === "number" && Number.isFinite(rawStart) ? rawStart : 0;
|
|
476
|
+
if (!(start > 0))
|
|
477
|
+
return;
|
|
478
|
+
const bytes = bagSourceBytesViaRoots(leaf, roots);
|
|
479
|
+
if (bytes === null)
|
|
480
|
+
return;
|
|
481
|
+
let probed;
|
|
482
|
+
try {
|
|
483
|
+
probed = probeMedia(bytes);
|
|
484
|
+
}
|
|
485
|
+
catch {
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
const video = probed.streams.find((stream) => stream.codec_type === "video");
|
|
489
|
+
const frames = video?.frames ?? (probed.duration_s !== undefined ? Math.round(probed.duration_s * 24) : undefined);
|
|
490
|
+
if (frames === undefined || frames <= 0)
|
|
491
|
+
return;
|
|
492
|
+
const skip = Math.round(start * 24);
|
|
493
|
+
if (skip < frames)
|
|
494
|
+
return;
|
|
495
|
+
const clipEndS = (frames / 24).toFixed(2);
|
|
496
|
+
throw new CardArmError(400, `the trim window starts at ${start}s (skip ${skip} frames at the trim card's 24 fps) but "${leaf}" carries ` +
|
|
497
|
+
`${frames} frame(s)${probed.duration_s !== undefined ? ` (${probed.duration_s}s)` : ""} — the loader's ` +
|
|
498
|
+
`skip_first_frames runs past the clip's last frame and the run composes an empty clip; trim inside the ` +
|
|
499
|
+
`clip (start_seconds < ${clipEndS}s) — end_seconds beyond the last frame stays the loader's own clamp`, "invalid_request");
|
|
500
|
+
}
|
|
501
|
+
/** The card-scope seat for the clip-geometry stamp: resolves the
|
|
502
|
+
* card the run addresses — the family route's famRow.card, or the
|
|
503
|
+
* familyless id itself — mirroring prepareCardParams's two arms,
|
|
504
|
+
* then answers admission's own predicate for a key. An
|
|
505
|
+
* unresolvable card admits nothing (the stamp no-ops; prepare's
|
|
506
|
+
* own refusal owns that voice). */
|
|
507
|
+
function clipGeometryAdmits(deps, mid) {
|
|
508
|
+
const facts = deps.modelFacts();
|
|
509
|
+
const resolves = mid in facts || deps.resolveCardFamily(mid, facts) in facts || deps.modelMids().has(mid);
|
|
510
|
+
const fam = deps.resolveCardFamily(mid, facts);
|
|
511
|
+
const famRow = facts[fam];
|
|
512
|
+
const card = resolves && famRow !== undefined ? famRow.card : mid;
|
|
513
|
+
const decls = deps.cardDecls(facts);
|
|
514
|
+
const decl = decls[card];
|
|
515
|
+
return (key) => cardAdmits(decl, new Set(), key);
|
|
516
|
+
}
|
|
218
517
|
function isUnstatedRequiredWord(message) {
|
|
219
518
|
return isUnstatedRequiredVoice(message);
|
|
220
519
|
}
|
|
221
520
|
function incompleteDraftViolations(violations) {
|
|
222
|
-
|
|
521
|
+
|
|
522
|
+
// drop itself is ONE spelling in the contracts judge
|
|
523
|
+
// (dropAuthoringIncomplete); the form's inline gate calls the same
|
|
524
|
+
// function, so the class can never drift between the two
|
|
525
|
+
// transports (attempt 12 was exactly that drift: the door
|
|
526
|
+
// filtered, the form's copy didn't, and the keystroke refused).
|
|
527
|
+
return dropAuthoringIncomplete(violations);
|
|
223
528
|
}
|
|
224
529
|
/** THE OUTPUT-RESOLUTION SEAM (round-22 compose audit Q4a,
|
|
225
530
|
* VALIDATE-RESOLVES-OUTPUTS): phase 2's def lookup + output
|
|
@@ -259,12 +564,78 @@ export function resolveCardOutputsOrThrow(defs, card, params, graph) {
|
|
|
259
564
|
throw new CardArmError(400, `flow-output: ${card}: ${why}`, "card_compose");
|
|
260
565
|
}
|
|
261
566
|
}
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
export const FAMILY_RESEAT_CARVE = [];
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
function familyLawOfCard(def) {
|
|
590
|
+
for (const family of def.boarded) {
|
|
591
|
+
const law = getModel(family).familyLaw;
|
|
592
|
+
if (law !== undefined)
|
|
593
|
+
return law;
|
|
594
|
+
}
|
|
595
|
+
return undefined;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
export function familyLawDrift(laws) {
|
|
614
|
+
const drift = [];
|
|
615
|
+
for (const [family, law] of laws) {
|
|
616
|
+
const lanes = new Set(law.lanes.map((l) => l.lane));
|
|
617
|
+
if (law.lanes.length === 0)
|
|
618
|
+
drift.push(`${family}: no lanes declared`);
|
|
619
|
+
const orphan = Object.keys(law.deadKeys).filter((l) => !lanes.has(l));
|
|
620
|
+
if (orphan.length > 0)
|
|
621
|
+
drift.push(`${family}: deadKeys names undeclared lanes ${JSON.stringify(orphan)}`);
|
|
622
|
+
for (const [lane, keys] of Object.entries(law.deadKeys)) {
|
|
623
|
+
if (lanes.has(lane) && keys.length > 0) {
|
|
624
|
+
drift.push(`${family}: lane ${lane} declares dead keys ${JSON.stringify(keys)} — no lane dead letter may ship (cure the renderer or gate the shape)`);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
return drift;
|
|
629
|
+
}
|
|
262
630
|
export class CardRegistryService extends Service {
|
|
263
631
|
static inject = ["queue"];
|
|
264
632
|
/** The primed card definitions (null until prime()). */
|
|
265
633
|
defs = null;
|
|
266
634
|
/** The frozen model facts (lazy — strict load, throws LOUD). */
|
|
267
635
|
facts = null;
|
|
636
|
+
/** When the facts cache primed (HMR audit 009 F2 — the staleness
|
|
637
|
+
* signal's own clock; null until the first modelFacts()). */
|
|
638
|
+
factsPrimedAt = null;
|
|
268
639
|
/** Route address → family owner from the registry-derived facts. */
|
|
269
640
|
owners = {};
|
|
270
641
|
/** Registry reads for the row derivation (primed with the models boot). */
|
|
@@ -304,9 +675,58 @@ export class CardRegistryService extends Service {
|
|
|
304
675
|
async prime() {
|
|
305
676
|
this.defs = await loadCardDefs();
|
|
306
677
|
this.decls = null;
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
// derived family rides the lane declaration (familyLaw data)
|
|
681
|
+
// and the registry's ONE seat settles the strand through the
|
|
682
|
+
// shared spelling. prime() reds on ANY card declaring the face:
|
|
683
|
+
// the carve can never silently refill. THE DECLARATION JUDGE:
|
|
684
|
+
// every familyLaw is validated at boot — deadKeys naming a lane
|
|
685
|
+
// the lanes array does not declare reds HERE, before any live
|
|
686
|
+
// write, so a mistyped lane id can never silently no-op the
|
|
687
|
+
// drop (a law nobody can hit is a lie the estate refuses to
|
|
688
|
+
// serve).
|
|
689
|
+
// the face is DELETED from the type — read the runtime extra
|
|
690
|
+
// property through the cast so the judge keeps its teeth on a
|
|
691
|
+
// def that silently grows one back (the wall's own spelling).
|
|
692
|
+
const carved = [...this.defs.entries()]
|
|
693
|
+
.filter(([, def]) => def.reseatFamily !== undefined)
|
|
694
|
+
.map(([id]) => id)
|
|
695
|
+
.sort();
|
|
696
|
+
if (carved.length > 0) {
|
|
697
|
+
throw new Error("family-reseat carve violated: cards declaring reseatFamily " +
|
|
698
|
+
JSON.stringify(carved) +
|
|
699
|
+
". The per-card reseat face is DEAD (the one-seat migration, 2026-11-12): " +
|
|
700
|
+
"the derived family rides the MODEL DECL (ModelDecl.familyLaw) and " +
|
|
701
|
+
"the registry's ONE seat (reseatStageFamily) settles the strand through " +
|
|
702
|
+
"@melite/contracts familyLane.ts. Grow the declaration, never another face.");
|
|
703
|
+
}
|
|
307
704
|
// the models boot feeds the row derivation (facts.ts renders
|
|
308
705
|
// rows through these reads — one spelling, no frozen matrix).
|
|
706
|
+
// THE DECLARATION JUDGE rides AFTER the boot (getModel is
|
|
707
|
+
// strict without it): every declared familyLaw — a card's
|
|
708
|
+
// boarded families, deduped — must name at least one lane, and
|
|
709
|
+
// every deadKeys lane must be a lane the lanes array declares.
|
|
710
|
+
// A drop keyed to a lane nobody derives never fires — a law the
|
|
711
|
+
// estate refuses to serve, red HERE at boot, before any live
|
|
712
|
+
// write.
|
|
309
713
|
await bootModels();
|
|
714
|
+
const laws = new Map();
|
|
715
|
+
for (const def of this.defs.values()) {
|
|
716
|
+
for (const family of def.boarded) {
|
|
717
|
+
if (laws.has(family))
|
|
718
|
+
continue;
|
|
719
|
+
const law = getModel(family).familyLaw;
|
|
720
|
+
if (law !== undefined)
|
|
721
|
+
laws.set(family, law);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
const badLaw = familyLawDrift(laws);
|
|
725
|
+
if (badLaw.length > 0) {
|
|
726
|
+
throw new Error("family-law declaration violated: " + badLaw.join("; ") +
|
|
727
|
+
". Every deadKeys lane must be a lane the lanes array declares — " +
|
|
728
|
+
"a drop keyed to a lane nobody derives never fires.");
|
|
729
|
+
}
|
|
310
730
|
this.reads = { getModel, registryIds, registryModel };
|
|
311
731
|
this.facts = null;
|
|
312
732
|
this.owners = {};
|
|
@@ -407,8 +827,29 @@ export class CardRegistryService extends Service {
|
|
|
407
827
|
const doc = loadFacts(factsPath(), this.readsSync());
|
|
408
828
|
this.facts = doc.models;
|
|
409
829
|
this.owners = { ...doc.owners };
|
|
830
|
+
this.factsPrimedAt = new Date();
|
|
410
831
|
return this.facts;
|
|
411
832
|
}
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
factsStaleness() {
|
|
843
|
+
const path = factsPath();
|
|
844
|
+
const mtime = statSync(path).mtime;
|
|
845
|
+
const primed = this.factsPrimedAt;
|
|
846
|
+
return {
|
|
847
|
+
primed_at: primed?.toISOString() ?? null,
|
|
848
|
+
source: path,
|
|
849
|
+
source_mtime: mtime.toISOString(),
|
|
850
|
+
stale: primed !== null && mtime.getTime() > primed.getTime(),
|
|
851
|
+
};
|
|
852
|
+
}
|
|
412
853
|
/** The decl projection — derived from defs + the strict facts, or
|
|
413
854
|
* from defs + caller-supplied facts (the validate door's
|
|
414
855
|
* degraded read; derived fresh, never cached over foreign facts). */
|
|
@@ -436,13 +877,22 @@ export class CardRegistryService extends Service {
|
|
|
436
877
|
objectInfo() {
|
|
437
878
|
return this.oi;
|
|
438
879
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
async primeObjectInfo(boundMs = 60_000) {
|
|
444
894
|
try {
|
|
445
|
-
this.oi = await liveObjectInfo(resolveEngineBaseUrl());
|
|
895
|
+
this.oi = await liveObjectInfo(resolveEngineBaseUrl(), undefined, boundMs);
|
|
446
896
|
this.armWiringFromDoc(this.oi);
|
|
447
897
|
this.armSingletonFromDoc(this.oi);
|
|
448
898
|
return true;
|
|
@@ -547,11 +997,14 @@ export class CardRegistryService extends Service {
|
|
|
547
997
|
// mids — the lens arms never fire through this path.)
|
|
548
998
|
for (const [fam, row] of Object.entries(table)) {
|
|
549
999
|
for (const v of row.variants ?? []) {
|
|
550
|
-
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
|
|
551
1003
|
if (v.route === mid)
|
|
552
1004
|
return fam;
|
|
553
1005
|
for (const c of v.cells ?? []) {
|
|
554
|
-
/* v8 ignore next
|
|
1006
|
+
/* v8 ignore next -- same census: a cell route is a route,
|
|
1007
|
+
* and no route lives outside mids — never fires. */
|
|
555
1008
|
if (c.route === mid)
|
|
556
1009
|
return fam;
|
|
557
1010
|
}
|
|
@@ -689,8 +1142,9 @@ export class CardRegistryService extends Service {
|
|
|
689
1142
|
const boarded = def.boarded;
|
|
690
1143
|
// THE CARD-UNIT ALIAS (the minted-model regression kill,
|
|
691
1144
|
|
|
692
|
-
// key — the GUI's Run press names the
|
|
693
|
-
//
|
|
1145
|
+
// NOTHING is its own routing key — the GUI's Run press names the
|
|
1146
|
+
// card id (stage-run maps defaultFamilyForCard's null to the card
|
|
1147
|
+
// id explicitly), the compose seam lanes it on
|
|
694
1148
|
// modelId==='' (cardsCompose's familyless arm), and this
|
|
695
1149
|
|
|
696
1150
|
// 'mask' is not offered by card 'mask'", boards: none) — every
|
|
@@ -763,6 +1217,54 @@ export class CardRegistryService extends Service {
|
|
|
763
1217
|
|
|
764
1218
|
|
|
765
1219
|
|
|
1220
|
+
admitStageFamily(card, params) {
|
|
1221
|
+
const def = this.defsSync().get(card);
|
|
1222
|
+
if (def === undefined || def.admitFamily === undefined)
|
|
1223
|
+
return { ok: true };
|
|
1224
|
+
return def.admitFamily(params);
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
|
|
1241
|
+
|
|
1242
|
+
|
|
1243
|
+
|
|
1244
|
+
reseatStageFamily(card, params, priorParams) {
|
|
1245
|
+
const def = this.defsSync().get(card);
|
|
1246
|
+
if (def === undefined)
|
|
1247
|
+
return null;
|
|
1248
|
+
const law = familyLawOfCard(def);
|
|
1249
|
+
if (law === undefined)
|
|
1250
|
+
return null;
|
|
1251
|
+
return reseatDeadKeys(law, params, priorParams);
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
|
|
1267
|
+
|
|
766
1268
|
|
|
767
1269
|
|
|
768
1270
|
|
|
@@ -770,60 +1272,223 @@ export class CardRegistryService extends Service {
|
|
|
770
1272
|
|
|
771
1273
|
|
|
772
1274
|
laneMigrate(card, params, priorParams) {
|
|
773
|
-
// one seat's tolerance
|
|
774
|
-
//
|
|
775
|
-
//
|
|
1275
|
+
// one seat's tolerance on the NEXT view: a selection/prepare
|
|
1276
|
+
// fault there is the ADMISSION's voice, never this seat's — an
|
|
1277
|
+
// unresolvable next state passes through untouched and refuses
|
|
776
1278
|
// (or tolerates) exactly as it did before this seat existed.
|
|
777
1279
|
let prepNext;
|
|
778
|
-
let prepPrior;
|
|
779
1280
|
try {
|
|
780
1281
|
const midNext = params["model"];
|
|
781
|
-
const midPrior = priorParams["model"];
|
|
782
1282
|
if (typeof midNext !== "string" || midNext === "")
|
|
783
1283
|
return params;
|
|
784
|
-
if (typeof midPrior !== "string" || midPrior === "")
|
|
785
|
-
return params;
|
|
786
1284
|
prepNext = prepareCardParams(this, params, midNext, "admission");
|
|
787
|
-
prepPrior = prepareCardParams(this, priorParams, midPrior, "admission");
|
|
788
1285
|
}
|
|
789
1286
|
catch {
|
|
790
1287
|
return params;
|
|
791
1288
|
}
|
|
792
1289
|
const facts = this.modelFacts();
|
|
1290
|
+
|
|
1291
|
+
// wedge): a stage whose family is spec-implied never states
|
|
1292
|
+
// `model`, so no prior lane resolves — the old seat returned
|
|
1293
|
+
// here and the write refused downstream (the variant's
|
|
1294
|
+
// declared surface names nothing the prior lane's words
|
|
1295
|
+
// explain). The carry is still identifiable without the prior
|
|
1296
|
+
// lane (any member SOME lane declares that the next lane does
|
|
1297
|
+
// not take), so the seat continues to the union fallback
|
|
1298
|
+
// below; a member NO lane declares stays authored and still
|
|
1299
|
+
// refuses.
|
|
1300
|
+
// THE KNOWN-BUT-HIDDEN PRIOR (the 2511 soft-retire,
|
|
1301
|
+
|
|
1302
|
+
// know but no dropdown offers throws the hidden-address
|
|
1303
|
+
// refusal out of prepareCardParams — standing aside would
|
|
1304
|
+
// strand the switch (stale 2511-only carry survives and
|
|
1305
|
+
// refuses downstream: the stuck-switch injury this seat
|
|
1306
|
+
// exists to prevent). The prior lane's words stay DECLARED,
|
|
1307
|
+
// so the seat falls through to the same union fallback: a
|
|
1308
|
+
// union member the next lane does not take drops, a member of
|
|
1309
|
+
// nothing stays authored and still refuses. A prior whose
|
|
1310
|
+
// family the facts do not know at all (a card-addressed
|
|
1311
|
+
// Run-press prior, a fully retired mid) is the tolerance
|
|
1312
|
+
// law's own shape — the seat stands aside exactly as before.
|
|
1313
|
+
let prepPrior = null;
|
|
1314
|
+
try {
|
|
1315
|
+
const midPrior = priorParams["model"];
|
|
1316
|
+
if (typeof midPrior === "string" && midPrior !== "") {
|
|
1317
|
+
prepPrior = prepareCardParams(this, priorParams, midPrior, "admission");
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
catch {
|
|
1321
|
+
const midPrior = priorParams["model"];
|
|
1322
|
+
if (typeof midPrior !== "string" || midPrior === "" || facts[midPrior] === undefined)
|
|
1323
|
+
return params;
|
|
1324
|
+
}
|
|
793
1325
|
const famNext = facts[prepNext.fam];
|
|
794
|
-
|
|
795
|
-
if (famNext === undefined || famPrior === undefined)
|
|
1326
|
+
if (famNext === undefined)
|
|
796
1327
|
return params;
|
|
1328
|
+
const famPrior = prepPrior !== null ? facts[prepPrior.fam] : undefined;
|
|
1329
|
+
const cellOf = (fam, sel) =>
|
|
1330
|
+
// THE CELL IS PART OF THE LANE (the size-at-quant reshape,
|
|
1331
|
+
|
|
1332
|
+
// when the two cells' surfaces differ — a cell change with a
|
|
1333
|
+
// stale member is a MIGRATION, never a refusal.
|
|
1334
|
+
fam.variants.find((v) => v.id === sel.variantId)?.cells.find((c) => c.quant === sel.quant)?.params;
|
|
1335
|
+
// THE UNION PREV (the model-less prior's surface): every member
|
|
1336
|
+
// any lane declares (family ∪ variant ∪ cell, the same cascade
|
|
1337
|
+
// laneSurfaceOf reads). A member of the union that the next
|
|
1338
|
+
// lane does not take is stale carry from SOMEWHERE — the write
|
|
1339
|
+
// drops it and lands. A member of nothing is authored state and
|
|
1340
|
+
// survives to refuse.
|
|
1341
|
+
const unionPrevSurface = () => {
|
|
1342
|
+
const acc = new Set();
|
|
1343
|
+
for (const f of Object.values(facts)) {
|
|
1344
|
+
for (const n of f.params ?? [])
|
|
1345
|
+
acc.add(n);
|
|
1346
|
+
for (const v of f.variants) {
|
|
1347
|
+
for (const n of v.params ?? [])
|
|
1348
|
+
acc.add(n);
|
|
1349
|
+
for (const c of v.cells) {
|
|
1350
|
+
for (const n of c.params ?? [])
|
|
1351
|
+
acc.add(n);
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
return [...acc];
|
|
1356
|
+
};
|
|
797
1357
|
let selNext;
|
|
798
|
-
let selPrior;
|
|
1358
|
+
let selPrior = null;
|
|
1359
|
+
let prevSurface;
|
|
799
1360
|
try {
|
|
800
|
-
selNext = selectCardVariant(prepNext.mid, famNext, params, "admission");
|
|
801
|
-
|
|
1361
|
+
selNext = selectCardVariant(prepNext.mid, famNext, params, "admission", familyLanesOf(prepNext.decl.boarded), prepNext.fam);
|
|
1362
|
+
if (prepPrior === null) {
|
|
1363
|
+
prevSurface = unionPrevSurface();
|
|
1364
|
+
}
|
|
1365
|
+
else {
|
|
1366
|
+
// A resolved prior whose family the facts do not know is the
|
|
1367
|
+
// tolerance law's own shape (a card-addressed Run-press
|
|
1368
|
+
// prior, a retired mid): the union would misread its words
|
|
1369
|
+
// as some other lane's, so the seat stands aside exactly as
|
|
1370
|
+
// it always did.
|
|
1371
|
+
if (famPrior === undefined)
|
|
1372
|
+
return params;
|
|
1373
|
+
const priorSel = selectCardVariant(prepPrior.mid, famPrior, priorParams, "admission", familyLanesOf(prepPrior.decl.boarded), prepPrior.fam);
|
|
1374
|
+
selPrior = priorSel;
|
|
1375
|
+
prevSurface = laneSurfaceOf(famPrior.params, famPrior.variants.find((v) => v.id === priorSel.variantId)?.params, cellOf(famPrior, priorSel));
|
|
1376
|
+
}
|
|
802
1377
|
}
|
|
803
1378
|
catch {
|
|
804
1379
|
return params;
|
|
805
1380
|
}
|
|
806
1381
|
// same lane, no migration — a same-lane patch judges exactly as
|
|
807
1382
|
// it always did (an off-surface member stated ON the lane it
|
|
808
|
-
// was authored on refuses; this seat never softens that).
|
|
809
|
-
//
|
|
810
|
-
|
|
811
|
-
//
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
1383
|
+
// was authored on refuses; this seat never softens that). A
|
|
1384
|
+
// model-less prior is never the same lane: the next lane
|
|
1385
|
+
// resolves, the prior cannot equal it, so the seat always
|
|
1386
|
+
// continues to the union below.
|
|
1387
|
+
if (selPrior !== null &&
|
|
1388
|
+
prepPrior !== null &&
|
|
1389
|
+
prepNext.fam === prepPrior.fam &&
|
|
815
1390
|
selNext.variantId === selPrior.variantId &&
|
|
816
1391
|
selNext.quant === selPrior.quant) {
|
|
817
1392
|
return params;
|
|
818
1393
|
}
|
|
819
|
-
const cellOf = (fam, sel) => fam.variants.find((v) => v.id === sel.variantId)?.cells.find((c) => c.quant === sel.quant)?.params;
|
|
820
|
-
const prevSurface = laneSurfaceOf(famPrior.params, famPrior.variants.find((v) => v.id === selPrior.variantId)?.params, cellOf(famPrior, selPrior));
|
|
821
1394
|
const nextSurface = laneSurfaceOf(famNext.params, famNext.variants.find((v) => v.id === selNext.variantId)?.params, cellOf(famNext, selNext));
|
|
822
|
-
|
|
823
|
-
|
|
1395
|
+
|
|
1396
|
+
// the stale rule judges what each side TAKES — the lane surface
|
|
1397
|
+
// PLUS that side's absorbed mod fold. Deliberately NOT the
|
|
1398
|
+
// card's static words (schemaNames/admits): the lane door judges
|
|
1399
|
+
// the variant surface, so a static-carried member the next lane
|
|
1400
|
+
// does not take still refuses downstream (the 2511 pair ride the
|
|
1401
|
+
// image-edit schema AND the 2511 surface — on the 21 lane the
|
|
1402
|
+
// surface is what fires). A mod rider the prior fold absorbed
|
|
1403
|
+
// but the next does not take is stale carry exactly like a
|
|
1404
|
+
// departed surface member (the image-gen `loras` write refusal);
|
|
1405
|
+
// a rider neither fold absorbs is authored state and still
|
|
1406
|
+
// refuses downstream. The fold reads theService: it throws in
|
|
1407
|
+
// the test fiber (never booted there), so the fold bodies ride
|
|
1408
|
+
// the v8-ignored precedent of cardsCompose's own admission —
|
|
1409
|
+
// the rule itself stays wallable with literal sets at
|
|
1410
|
+
// laneStaleCarry, which takes the sets as plain arrays.
|
|
1411
|
+
const takenOf = (surface, atom) => {
|
|
1412
|
+
// No surfaceless model family ships in facts (the legacy
|
|
1413
|
+
// truth has no live rows) — the null arm is the lane judge's
|
|
1414
|
+
// own "declares nothing, judges nothing", exercised with
|
|
1415
|
+
// literal sets at laneStaleCarry's wall.
|
|
1416
|
+
/* v8 ignore next */
|
|
1417
|
+
if (surface === null)
|
|
1418
|
+
return null;
|
|
1419
|
+
const taken = new Set(surface);
|
|
1420
|
+
|
|
1421
|
+
// the old text claimed theService() never boots in the test
|
|
1422
|
+
// fiber — FALSE since loadCardDefs sets the globalThis cell at
|
|
1423
|
+
// prime(); the fold CONTRIBUTES here (voice_name et al). The
|
|
1424
|
+
// v8-ignore regions dropped with the lie: this code executes
|
|
1425
|
+
// under the booted registry and owes its coverage.)
|
|
1426
|
+
try {
|
|
1427
|
+
if (atom === null) {
|
|
1428
|
+
// model-less prior: the generous prev — every pack field
|
|
1429
|
+
// the card absorbs anywhere (a rider absorbed SOMEWHERE is
|
|
1430
|
+
// prior carry, never authored; the next side still judges).
|
|
1431
|
+
for (const pack of theService().cardModFields(card)) {
|
|
1432
|
+
for (const n of Object.keys(pack.fields.dict ?? {}))
|
|
1433
|
+
taken.add(n);
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
else {
|
|
1437
|
+
for (const pack of theService().cardModFields(card)) {
|
|
1438
|
+
if (!pack.families.includes(atom))
|
|
1439
|
+
continue;
|
|
1440
|
+
for (const n of Object.keys(pack.fields.dict ?? {}))
|
|
1441
|
+
taken.add(n);
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
catch (modFoldFault) {
|
|
1446
|
+
// modFoldFault: card defs genuinely absent (a bare fiber
|
|
1447
|
+
// without prime()) — the absorbed surface is empty here;
|
|
1448
|
+
// surfaces + statics judge.
|
|
1449
|
+
}
|
|
1450
|
+
return [...taken];
|
|
1451
|
+
};
|
|
1452
|
+
const stale = laneStaleCarry(takenOf(prevSurface, prepPrior !== null ? owningAtom(prepPrior.fam) : null), takenOf(nextSurface, owningAtom(prepNext.fam)), params);
|
|
1453
|
+
// THE ORPHANED HALF (the export-pair wedge, voicedesign →
|
|
1454
|
+
// customvoice carrying a named export): a together-group is
|
|
1455
|
+
// all-or-none at the admission this seat migrates toward — one
|
|
1456
|
+
// member dropped as stale while a stated sibling survives (kept
|
|
1457
|
+
// because the next lane's absorbed fold takes it) GUARANTEES
|
|
1458
|
+
// the downstream refusal ("state all or none"). The relations'
|
|
1459
|
+
// own cure is "or drop both": a stale member takes its
|
|
1460
|
+
// together-group with it. Groups read from the TARGET lane's
|
|
1461
|
+
// judged relations (family + resolved variant — the same rows
|
|
1462
|
+
// the admission judges), never the prior's; a sibling already
|
|
1463
|
+
// blank is not carried state and stays put.
|
|
1464
|
+
|
|
1465
|
+
// fixpoint verb — a single pass strands transitively-dropped
|
|
1466
|
+
// siblings when overlapping groups declare in the wrong order;
|
|
1467
|
+
// the seat and the pure wall now share one spelling.
|
|
1468
|
+
const staleSet = laneTogetherClosure([famNext.relations, famNext.variants.find((v) => v.id === selNext.variantId)?.relations], new Set(stale), params);
|
|
1469
|
+
|
|
1470
|
+
// law's family-seam proof): stale carry is what the STORED ROW
|
|
1471
|
+
// held — the doc's own past, droppable on a lane it leaves. A
|
|
1472
|
+
// member the merged view holds ONLY because THIS patch states
|
|
1473
|
+
// it is AUTHORED — the writer's present act; this seat never
|
|
1474
|
+
// launders it. It stands and the admission judges it exactly as
|
|
1475
|
+
// the a priori law promises ("a member no prior lane declared
|
|
1476
|
+
// is authored state and still refuses"). Before this line the
|
|
1477
|
+
// union fallback read the merged view alone, so a freshly
|
|
1478
|
+
// authored off-lane key (h3's sr_switch on a t4r arrival over a
|
|
1479
|
+
// bare seeded stage) classified as "carry from SOMEWHERE" and
|
|
1480
|
+
// silently vanished — the write landed a state the author never
|
|
1481
|
+
// sent, and the family judge never saw the poison. Both patch
|
|
1482
|
+
// verbs ride this seat, so both doors answer identically.
|
|
1483
|
+
const carry = [];
|
|
1484
|
+
for (const name of staleSet) {
|
|
1485
|
+
if (Object.prototype.hasOwnProperty.call(priorParams, name))
|
|
1486
|
+
carry.push(name);
|
|
1487
|
+
}
|
|
1488
|
+
if (carry.length === 0)
|
|
824
1489
|
return params;
|
|
825
1490
|
const cleaned = { ...params };
|
|
826
|
-
for (const name of
|
|
1491
|
+
for (const name of carry)
|
|
827
1492
|
delete cleaned[name];
|
|
828
1493
|
return cleaned;
|
|
829
1494
|
}
|
|
@@ -1015,6 +1680,27 @@ export class CardRegistryService extends Service {
|
|
|
1015
1680
|
// states the composing family admits.
|
|
1016
1681
|
return this.modellessDraftVerdict(card, params, admitIncomplete, factsArg); // null when no family agrees on any word
|
|
1017
1682
|
}
|
|
1683
|
+
// THE EMPTY-SELECTION LAW, FIRST-CLASS (the no-default-voice
|
|
1684
|
+
|
|
1685
|
+
// to no voice, instead of VIVIAN"): the stated-empty refusal used
|
|
1686
|
+
// to ride an incidental ghost — the family's vivian default
|
|
1687
|
+
// stamped onto a resolved recipe lane refused first, and the
|
|
1688
|
+
// catch clause below only converted that arm error. With the
|
|
1689
|
+
// default gone the ghost never rides, so the law states itself
|
|
1690
|
+
// HERE, in the run door's own voice, before prepare: a stated
|
|
1691
|
+
// EMPTY variant/quant/model is not a selection, it is an
|
|
1692
|
+
// authoring surface's unchosen control written as a value — the
|
|
1693
|
+
// parity law's false admit if this seat passed it to a run door
|
|
1694
|
+
// that refuses the same state. An ABSENT axis still passes
|
|
1695
|
+
// (compose defaults it).
|
|
1696
|
+
for (const axis of ["model", "variant", "quant"]) {
|
|
1697
|
+
if (params[axis] === "") {
|
|
1698
|
+
return {
|
|
1699
|
+
message: `unknown ${axis} "" for model ${JSON.stringify(mid)} — a stated empty selection is not a choice (pick one, or remove the key and let compose default it)`,
|
|
1700
|
+
incomplete: false,
|
|
1701
|
+
};
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1018
1704
|
let prep;
|
|
1019
1705
|
try {
|
|
1020
1706
|
prep = prepareCardParams(this, params, mid, "admission", factsArg);
|
|
@@ -1078,7 +1764,7 @@ export class CardRegistryService extends Service {
|
|
|
1078
1764
|
// legacy families exactly the nothing they had.
|
|
1079
1765
|
let sel;
|
|
1080
1766
|
try {
|
|
1081
|
-
sel = selectCardVariant(mid, famRow, params, "admission");
|
|
1767
|
+
sel = selectCardVariant(mid, famRow, params, "admission", familyLanesOf(prep.decl.boarded), prep.fam);
|
|
1082
1768
|
}
|
|
1083
1769
|
catch {
|
|
1084
1770
|
/* v8 ignore next -- prepareCardParams already ran the SAME
|
|
@@ -1131,8 +1817,33 @@ export class CardRegistryService extends Service {
|
|
|
1131
1817
|
// THE INCOMPLETE-DRAFT LAW rides the family arm too (see the
|
|
1132
1818
|
// helper): the unstated required word is the run door's voice —
|
|
1133
1819
|
// so the filter applies ONLY when the WRITE seat is asking.
|
|
1820
|
+
// THE DOCUMENT PLANE IS NOT A KNOB LANE (slice 1, the keyframe
|
|
1821
|
+
// bus): the card's own studio.writes rows (calls, audio_clips,
|
|
1822
|
+
// keyframes) are document state the timeline contract validators
|
|
1823
|
+
// own — they ride EVERY lane by design, so the lane-surface judge
|
|
1824
|
+
// must not read them as knobs that "fire nothing". The exemption
|
|
1825
|
+
// is the DECL's own writes list (never a literal), the same
|
|
1826
|
+
// derivable class the ONE SEAT wall reads.
|
|
1827
|
+
const documentPlane = new Set((famRow.studio?.writes ?? []).map(String));
|
|
1828
|
+
const knobFields = prep.decl.schemaNames.filter((n) => !documentPlane.has(n));
|
|
1829
|
+
|
|
1830
|
+
// the edit lanes SURFACE the deliverable pair (width/height
|
|
1831
|
+
// beside the card's match_input_resolution toggle — the pair
|
|
1832
|
+
// sizes the render: the lane derives the encoder budget from
|
|
1833
|
+
// w·h and mounts the exact w×h empty latent, no ImageScale
|
|
1834
|
+
// tail), so the surface judge sanctions the pair like any knob
|
|
1835
|
+
// — and the SHARED size law judges its VALUES
|
|
1836
|
+
// (judgeDeliverableSize — the same spelling the firing gate
|
|
1837
|
+
// throws and every build() throws, so the bench and the engine
|
|
1838
|
+
// can never disagree). ON + stated refuses with the flip in the
|
|
1839
|
+
// voice; OFF + neither passes (the flip-then-type identity);
|
|
1840
|
+
// OFF + half/non-integer/<16 refuses field-named. The toggle's
|
|
1841
|
+
// presence in the served schema IS the law's declaration
|
|
1842
|
+
// (today only the image-edit card serves it).
|
|
1843
|
+
const servesDeliverableSwitch = knobFields.includes("match_input_resolution");
|
|
1134
1844
|
const judgedFam = [
|
|
1135
|
-
...judgeLaneSurface(surface,
|
|
1845
|
+
...judgeLaneSurface(surface, knobFields, prep.params),
|
|
1846
|
+
...(servesDeliverableSwitch ? judgeDeliverableSize(prep.params) : []),
|
|
1136
1847
|
...judgeLaneRelations(relations, prep.params),
|
|
1137
1848
|
...judgeLaneBounds(bounds, prep.params),
|
|
1138
1849
|
];
|
|
@@ -1251,7 +1962,19 @@ export class CardRegistryService extends Service {
|
|
|
1251
1962
|
if (typeof mid !== "string" || mid === "")
|
|
1252
1963
|
return null;
|
|
1253
1964
|
try {
|
|
1254
|
-
|
|
1965
|
+
const prep = prepareCardParams(this, body, mid, "serve");
|
|
1966
|
+
|
|
1967
|
+
// user have different input parameters"): the compose lanes
|
|
1968
|
+
// merge a card's legacyAliases engine-side, so a row carrying
|
|
1969
|
+
// image1/image_name RUNS with the image — but serving the
|
|
1970
|
+
// params verbatim left the canonical seat (input_images /
|
|
1971
|
+
// image) EMPTY on the drill's form and the user stared at a
|
|
1972
|
+
// BLANK input for an image the agent had attached. The serve
|
|
1973
|
+
// is the 1:1 law (the map the NEXT RUN composes): the same
|
|
1974
|
+
// fold the lane performs, served — one spelling on every
|
|
1975
|
+
// face, the stored doc untouched.
|
|
1976
|
+
const kinds = this.defsSync().get(prep.card)?.flowKinds;
|
|
1977
|
+
return foldLegacyAliases(kinds, prep.params);
|
|
1255
1978
|
}
|
|
1256
1979
|
catch {
|
|
1257
1980
|
return null;
|
|
@@ -1379,9 +2102,28 @@ export class CardRegistryService extends Service {
|
|
|
1379
2102
|
// body. Same gate, same voice — validate predicts start on
|
|
1380
2103
|
// weights, not just on shape.
|
|
1381
2104
|
if (prep.familyless !== true) {
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
2105
|
+
// THE VARIANT-LANE PRESENCE LAW (h¹ remainder): the probe rides
|
|
2106
|
+
// the RESOLVED lane inputs — the body's stated variant over the
|
|
2107
|
+
// address's own row (the same derivation the compose stamps).
|
|
2108
|
+
|
|
2109
|
+
// lanePresenceRefusal THROWS its miss — phase1Card's pinned
|
|
2110
|
+
// contract ("the refusal is a THROW, never a value"), so the
|
|
2111
|
+
// `miss !== null` arm this seat wrote was dead code, and the
|
|
2112
|
+
// raw CardArmError escaped to the door's failEstate, which
|
|
2113
|
+
// mints 502 for every non-RemoteError throw: a missing weight
|
|
2114
|
+
// at /v1/flows/validate answered Bad Gateway (krea-2,
|
|
2115
|
+
// flux-klein — the combination sweep's live red) while the
|
|
2116
|
+
// same miss at phase1 answered its lawful 400. The fold
|
|
2117
|
+
// answers the miss as THIS seat's verdict, same voice, same
|
|
2118
|
+
// code — walled by lane-presence-validate-fold.spec.
|
|
2119
|
+
try {
|
|
2120
|
+
lanePresenceRefusal(prep.fam, prep.params, prep.modelId);
|
|
2121
|
+
}
|
|
2122
|
+
catch (e) {
|
|
2123
|
+
if (e instanceof CardArmError)
|
|
2124
|
+
return { message: e.message, code: e.code };
|
|
2125
|
+
throw e;
|
|
2126
|
+
}
|
|
1385
2127
|
}
|
|
1386
2128
|
try {
|
|
1387
2129
|
const graph = await composeOnce(this, prep.card, prep.modelId, prep.params, "", "1");
|
|
@@ -1405,7 +2147,42 @@ export class CardRegistryService extends Service {
|
|
|
1405
2147
|
* registration. The $spell branch composes NO graph (the pool
|
|
1406
2148
|
* passes — the two-card-flow handoff). */
|
|
1407
2149
|
async phase1Card(body, mid) {
|
|
2150
|
+
|
|
2151
|
+
// "width and height are defaulting to zero for viggle… it needs
|
|
2152
|
+
// to follow what image edit does and default to the input size
|
|
2153
|
+
// of the video"): a body carrying a `clip` param AND
|
|
2154
|
+
// width/height knobs riding the family's 0 default (the
|
|
2155
|
+
// follow-the-clip convention) gets the clip's OWN geometry
|
|
2156
|
+
// stamped into the body BEFORE any resolution or judge runs —
|
|
2157
|
+
// prepareCardParams, the lane verdict, the ledger and the graph
|
|
2158
|
+
// all read real numbers, never a zero that reads broken. Both
|
|
2159
|
+
// stated = the user owns the geometry; a probe miss (an
|
|
2160
|
+
// unreadable file or an unrecognized container, webm today)
|
|
2161
|
+
// leaves the 0s riding — the engine's own follow-the-clip
|
|
2162
|
+
// contract still renders (receipts run-be048a52385d mp4 →
|
|
2163
|
+
// 928×1344, run-9c267ef6c8fd webm → 928×1344). CARD-SCOPED
|
|
2164
|
+
// since the track-card burn (fix 7): a card that declares no
|
|
2165
|
+
// size knobs gets no stamped keys — the stamp may not invent
|
|
2166
|
+
// params admission will refuse.
|
|
2167
|
+
stampClipGeometry(body, clipGeometryAdmits(this, mid));
|
|
1408
2168
|
const prep = prepareCardParams(this, body, mid, "1");
|
|
2169
|
+
// THE SILENT-SOURCE REFUSAL (F26): an armed sound-carrying bag's
|
|
2170
|
+
// source must carry audio — refused here, zero GPU, with the lane
|
|
2171
|
+
// and the file named (the run door's own envelope walk, so the
|
|
2172
|
+
// validate seat hears the same sentence).
|
|
2173
|
+
refuseSilentSource(prep.card, prep.params);
|
|
2174
|
+
// THE REFINE WINDOW RANGE REFUSAL (F36): a window whose
|
|
2175
|
+
// start_seconds runs past its own source clip refuses here,
|
|
2176
|
+
// zero GPU, with the clip and the probed length named. The
|
|
2177
|
+
// source resolves through the estate's own roots first — a
|
|
2178
|
+
// produced clip (a prior stage's output) is a real posture,
|
|
2179
|
+
// not a probe deaf spot (F3-08).
|
|
2180
|
+
refuseRefineWindowPastClip(prep.card, prep.params, this.stateRoots());
|
|
2181
|
+
// THE TRIM START RANGE REFUSAL (F3-08): a trim whose start lands
|
|
2182
|
+
// past the source's last frame refuses here too — same belt,
|
|
2183
|
+
// zero GPU, the trim card's own 24 fps contract, the same
|
|
2184
|
+
// estate-roots resolution.
|
|
2185
|
+
refuseTrimStartPastClip(prep.card, prep.params, this.stateRoots());
|
|
1409
2186
|
// THE BOARD CHECK RIDES THE RUN SEAT TOO (the behavioural
|
|
1410
2187
|
// re-check's BYPASS 1: the bench refused an unoffered model
|
|
1411
2188
|
// address, but `validate` with the SAME address composed the
|
|
@@ -1467,7 +2244,10 @@ export class CardRegistryService extends Service {
|
|
|
1467
2244
|
// lanes, and the card's own pins gate loud at the engine's load
|
|
1468
2245
|
// (the YOLO/SAM2 checkpoints refuse hard when absent).
|
|
1469
2246
|
if (prep.familyless !== true) {
|
|
1470
|
-
|
|
2247
|
+
// THE VARIANT-LANE PRESENCE LAW (h¹ remainder): same derivation
|
|
2248
|
+
// as validate's seat — the switch refuses LOUD at the gate, never
|
|
2249
|
+
// at the engine's validation.
|
|
2250
|
+
lanePresenceRefusal(prep.fam, prep.params, prep.modelId);
|
|
1471
2251
|
}
|
|
1472
2252
|
const spells = prep.decl.spells;
|
|
1473
2253
|
const pool = {};
|