@melite/estate-queue 0.1.4-alpha → 0.1.5-pre-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.
Files changed (93) hide show
  1. package/README.md +55 -0
  2. package/lib/bench.d.ts +19 -11
  3. package/lib/bench.js +47 -57
  4. package/lib/cardsArmError.d.ts +45 -2
  5. package/lib/cardsArmError.js +28 -4
  6. package/lib/cardsCompose.d.ts +13 -1
  7. package/lib/cardsCompose.js +109 -61
  8. package/lib/cardsDangling.d.ts +2 -2
  9. package/lib/cardsDangling.js +82 -37
  10. package/lib/cardsFacts.d.ts +16 -3
  11. package/lib/cardsFacts.js +14 -0
  12. package/lib/cardsLanes.d.ts +12 -2
  13. package/lib/cardsLanes.js +73 -10
  14. package/lib/cardsRegistry.d.ts +93 -5
  15. package/lib/cardsRegistry.js +323 -54
  16. package/lib/cardsVariant.d.ts +10 -1
  17. package/lib/cardsVariant.js +66 -13
  18. package/lib/discloseRegistry.d.ts +6 -5
  19. package/lib/discloseRegistry.js +11 -9
  20. package/lib/flowsData.d.ts +67 -12
  21. package/lib/flowsData.js +230 -104
  22. package/lib/flowsFamilyCompose.d.ts +5 -8
  23. package/lib/flowsFamilyCompose.js +13 -13
  24. package/lib/flowsParamsOverlay.d.ts +55 -0
  25. package/lib/flowsParamsOverlay.js +197 -0
  26. package/lib/flowsRegistryRows.d.ts +3 -1
  27. package/lib/flowsRegistryRows.js +148 -6
  28. package/lib/index.d.ts +0 -3
  29. package/lib/index.js +14 -5
  30. package/lib/lifecycleLatch.d.ts +16 -0
  31. package/lib/lifecycleLatch.js +42 -0
  32. package/lib/loadPlane.d.ts +3 -2
  33. package/lib/loadPlane.js +25 -8
  34. package/lib/loadRegistry.js +1 -1
  35. package/lib/manageOps.d.ts +8 -2
  36. package/lib/manageOps.js +26 -6
  37. package/lib/managePlane.d.ts +31 -0
  38. package/lib/managePlane.js +360 -85
  39. package/lib/manageProbe.d.ts +1 -10
  40. package/lib/manageProbe.js +18 -7
  41. package/lib/manageRegistry.d.ts +42 -4
  42. package/lib/manageRegistry.js +45 -7
  43. package/lib/mediaKinds.d.ts +1 -1
  44. package/lib/mediaKinds.js +1 -1
  45. package/lib/queue.js +14 -10
  46. package/lib/queueCore.d.ts +7 -4
  47. package/lib/queueCore.js +9 -5
  48. package/lib/queueLifecycle.d.ts +0 -24
  49. package/lib/queueLifecycle.js +9 -63
  50. package/lib/queueLock.d.ts +8 -2
  51. package/lib/queueLock.js +9 -6
  52. package/lib/queueSidecar.d.ts +4 -0
  53. package/lib/queueSidecar.js +1 -0
  54. package/lib/queueSubmit.d.ts +61 -10
  55. package/lib/queueSubmit.js +120 -46
  56. package/lib/queueSweep.js +13 -2
  57. package/lib/runsChange.d.ts +8 -0
  58. package/lib/runsChange.js +21 -5
  59. package/lib/runsErrorCodes.d.ts +1 -1
  60. package/lib/runsErrorCodes.js +33 -0
  61. package/lib/runsExecute.d.ts +26 -0
  62. package/lib/runsExecute.js +143 -5
  63. package/lib/runsGates.js +4 -3
  64. package/lib/runsList.js +13 -19
  65. package/lib/runsRefusalVoices.js +52 -0
  66. package/lib/runsRegistry.d.ts +105 -7
  67. package/lib/runsRegistry.js +744 -100
  68. package/lib/runsSourceEcho.d.ts +27 -0
  69. package/lib/runsSourceEcho.js +84 -18
  70. package/lib/runsStart.d.ts +56 -14
  71. package/lib/runsStart.js +184 -45
  72. package/lib/runsTypes.d.ts +35 -0
  73. package/lib/runsTypes.js +7 -0
  74. package/lib/runsValidateArms.js +61 -7
  75. package/lib/runsValidateServe.d.ts +2 -2
  76. package/lib/runsValidateServe.js +26 -4
  77. package/lib/runsValidateShared.d.ts +1 -1
  78. package/lib/runsValidateStages.d.ts +10 -3
  79. package/lib/runsValidateStages.js +23 -3
  80. package/lib/service.d.ts +24 -6
  81. package/lib/service.js +19 -11
  82. package/lib/skillFs.d.ts +9 -4
  83. package/lib/skillFs.js +12 -14
  84. package/lib/skillPlane.d.ts +3 -2
  85. package/lib/skillPlane.js +12 -6
  86. package/lib/skillRegistry.js +1 -1
  87. package/lib/skillRows.d.ts +4 -3
  88. package/lib/skillRows.js +14 -12
  89. package/lib/toolProjection.d.ts +1 -1
  90. package/lib/toolProjection.js +1 -1
  91. package/package.json +8 -7
  92. package/lib/runStatus.d.ts +0 -7
  93. package/lib/runStatus.js +0 -21
@@ -0,0 +1,197 @@
1
+ // flowsParamsOverlay.ts — the flow params overlay, the one law both
2
+ // doors ride (cut out of runsRegistry so the validate door can ride
3
+ // it without a runsRegistry cycle; round-21 flows audit F1).
4
+ import { RemoteError } from "@deepseek-ai/dsh-typert-protocol";
5
+ import { owningAtom, theService } from "@melite/comfyui-cordis";
6
+ import { cardAdmits } from "./cardsCompose.js";
7
+ /**
8
+ * The overlay's mod-fold scoping decision (round-22 compose audit
9
+ * Q3a): which family scopes the absorbed mod surface for a stage's
10
+ * card. The request's model seat wins outright; with no seat, the
11
+ * card's sole boarded family scopes it; a multi-family card with no
12
+ * seat stays unscoped ("" — the union, compose's own selector to
13
+ * refuse). Pure so the walls can pin the routing; the route→atom map
14
+ * itself rides the engine-fiber fold (`owningAtom`, never booted in
15
+ * the test fiber).
16
+ *
17
+ * @param boarded the card decl's boarded families
18
+ * @param fam the request's family seat ("" when none)
19
+ * @returns the scoping family, "" for unscoped
20
+ */
21
+ export function overlayAtomFor(boarded, fam) {
22
+ if (fam !== "")
23
+ return fam;
24
+ return boarded.length === 1 ? boarded[0] : "";
25
+ }
26
+ /**
27
+ * The decls read both doors ride (round-22 compose audit Q5b,
28
+ * FLOW-DOOR-DEGRADE-OR-MAP): the registry's cardDecls() is a STRICT
29
+ * read — a missing model-facts.json throws raw (a 500 past the flow
30
+ * doors, where the {model:} door degrades by policy), because both
31
+ * overlay call sites sat outside any RemoteError mapping. The read
32
+ * rides this one mapping so both doors voice the same
33
+ * runs/invalid-request naming the missing file — never a raw
34
+ * escape, never two voices.
35
+ *
36
+ * @param cardRegistry the context's card registry seat
37
+ * @returns the declared rows, as cardDecls() serves them
38
+ * @throws runs/invalid-request (loc "params") when the strict read throws
39
+ */
40
+ export function overlayDecls(cardRegistry) {
41
+ try {
42
+ return cardRegistry.cardDecls();
43
+ }
44
+ catch (e) {
45
+ throw new RemoteError("runs/invalid-request", "flow params overlay cannot read the card declarations — " +
46
+ (e instanceof Error ? e.message : String(e)), { loc: "params" });
47
+ }
48
+ }
49
+ /** THE FLOW PARAMS OVERLAY — the one law both doors ride (round-21
50
+ * flows audit F1): the request's `params` overlays the expansion's
51
+ * fresh rows. A primitive value targets the single stage whose card
52
+ * admits the key (zero: unknown-key refusal; several: ambiguous —
53
+ * the operator names the stage); an object value targets one stage
54
+ * by id, every key admitted by that stage's card. Admission reads
55
+ * the SHARED surface (knobs ∪ absorbed mod fields ∪ admits — audit
56
+ * J-E2), and every refusal is runs/invalid-request BEFORE either
57
+ * door proceeds: validate answering green while start refused 400
58
+ * was the F1 divergence. Mutates the rows in place (the expansion's
59
+ * own containers — flowsData's TEMPLATE DETACH keeps the registry's
60
+ * rows shared and untouched); the stage list is copied, never the
61
+ * rows.
62
+ *
63
+ * @param flowName the flow id, named in every refusal
64
+ * @param stages the expansion's stage rows (mutated in place)
65
+ * @param overrideRaw the request body's raw `params` value
66
+ * @param decls the card registry's declared rows (the admission read)
67
+ * @param fam the request's family seat (`body.model`, "" when the
68
+ * request names none) — scopes the absorbed mod surface to the
69
+ * owning atom, the same fold compose and variant judge with
70
+ */
71
+ export function applyFlowParamsOverride(flowName, stages, overrideRaw, decls, fam) {
72
+ if (typeof overrideRaw !== "object" || overrideRaw === null || Array.isArray(overrideRaw)) {
73
+ throw new RemoteError("runs/invalid-request", "flow params must be an object ({key: value} or {stage_id: {key: value}}), got " +
74
+ JSON.stringify(overrideRaw), { loc: "params" });
75
+ }
76
+ const override = overrideRaw;
77
+ const stageRows = [...stages];
78
+ const paramsOf = (row) => {
79
+ if (typeof row["params"] !== "object" || row["params"] === null || Array.isArray(row["params"])) {
80
+ row["params"] = {};
81
+ }
82
+ return row["params"];
83
+ };
84
+ // THE SHARED ADMISSION SURFACE (audit J-E2): the override door
85
+ // judges with the SAME predicate compose's admission gate judges
86
+ // with — knobs ∪ absorbed mod fields ∪ admits (wildcard rows
87
+ // included), the mod fold scoped to the row's owning atom
88
+ // (OVERLAY-ATOM-FOLD, round-22 compose audit Q3a: an unfiltered
89
+ // fold admitted a family A mod key on a run at family B — the
90
+ // overlay greened what compose refuses, two refusals for one body).
91
+ // The atom resolves from the request's model seat, falling back to
92
+ // the card's sole boarded family; a multi-family card with no seat
93
+ // keeps the union (compose resolves its own selector there, and the
94
+ // door cannot know it — the residual over-admission is compose's
95
+ // own to refuse, at the same 400 class).
96
+ const modNamesOf = (card) => {
97
+ const names = new Set();
98
+ try {
99
+ // The routing is pure (the walls pin it); the route→atom map
100
+ // rides the booted models service — "" stays unscoped.
101
+ const scoped = overlayAtomFor(decls[card]?.boarded ?? [], fam);
102
+ const envelopeAtom = scoped === "" ? "" : owningAtom(scoped);
103
+ for (const a of theService().cardModFields(card)) {
104
+ if (envelopeAtom !== "" && !a.families.includes(envelopeAtom))
105
+ continue;
106
+ for (const n of Object.keys(a.fields.dict ?? {}))
107
+ names.add(n);
108
+ }
109
+ }
110
+ catch (modFoldError) {
111
+ // modFoldError: card defs not booted in this fiber — the
112
+ // mod surface is empty here; the knobs+admits rows still
113
+ // gate (the door can only over-admit into compose's own
114
+ // refusal, never under-admit what compose takes).
115
+ }
116
+ return names;
117
+ };
118
+ const admitsParam = (row, key) => {
119
+ const card = typeof row["card"] === "string" ? row["card"] : "";
120
+ return cardAdmits(decls[card], modNamesOf(card), key);
121
+ };
122
+ // THE FAMILY ROWS TAKE NO PARAMS (round-23 audit Q2): a family
123
+ // stage carries card "" (the either/or row contract), so no decl
124
+ // admits anything for it and the generic voice indicted a card ""
125
+ // the request never spelled. The verb's own params are not
126
+ // per-press tunable (every live family flow declares tool: null),
127
+ // so the honest answer is a named refusal, not a dead admission
128
+ // path.
129
+ const familyRows = stageRows.filter((r) => r["card"] === "" &&
130
+ typeof r["family"] === "string" && r["family"] !== "");
131
+ const familyTag = () => familyRows
132
+ .map((r) => JSON.stringify(r["id"]) + " (" + JSON.stringify(r["family"]) + "." + JSON.stringify(r["action"] ?? "") + ")")
133
+ .join(", ");
134
+ // the refusal message names the SHARED surface (knobs ride it
135
+ // since J-E2 — the admits row alone would understate it)
136
+ const admitOf = (row) => {
137
+ const card = typeof row["card"] === "string" ? row["card"] : "";
138
+ const decl = decls[card];
139
+ return [
140
+ ...new Set([
141
+ ...(decl?.schemaNames ?? []),
142
+ ...modNamesOf(card),
143
+ ...(decl?.admits ?? []),
144
+ ]),
145
+ ];
146
+ };
147
+ for (const [key, value] of Object.entries(override)) {
148
+ if (typeof value === "object" && value !== null && !Array.isArray(value)) {
149
+ // THE STAGE-TARGETED SHAPE: the key names a stage, the
150
+ // object rides that stage's params verbatim-overlaid.
151
+ const target = stageRows.find((r) => r["id"] === key);
152
+ if (target === undefined) {
153
+ throw new RemoteError("runs/invalid-request", "flow params stage " + JSON.stringify(key) +
154
+ " names no stage of flow " + flowName +
155
+ " (stages: " + stageRows.map((r) => JSON.stringify(r["id"])).join(", ") + ")", { loc: "params" });
156
+ }
157
+ if (target["card"] === "" &&
158
+ typeof target["family"] === "string" && target["family"] !== "") {
159
+ throw new RemoteError("runs/invalid-request", "stage " + JSON.stringify(key) + " of flow " + flowName +
160
+ " is a family stage (" + JSON.stringify(target["family"]) + "." +
161
+ JSON.stringify(target["action"] ?? "") + ") — family stages take " +
162
+ "initials, not params; drop the key", { loc: "params" });
163
+ }
164
+ const admits = admitOf(target);
165
+ for (const [pk, pv] of Object.entries(value)) {
166
+ if (!admitsParam(target, pk)) {
167
+ throw new RemoteError("runs/invalid-request", "card " + JSON.stringify(target["card"]) +
168
+ " does not admit param " + JSON.stringify(pk) +
169
+ " (admitted: " + JSON.stringify(admits) + ")", { loc: "params" });
170
+ }
171
+ paramsOf(target)[pk] = pv;
172
+ }
173
+ continue;
174
+ }
175
+ // THE FLAT SHAPE: exactly one admitting stage, or refuse.
176
+ const targets = stageRows.filter((r) => admitsParam(r, key));
177
+ if (targets.length === 0) {
178
+ if (familyRows.length > 0) {
179
+ throw new RemoteError("runs/invalid-request", "no stage of flow " + flowName + " admits param " + JSON.stringify(key) +
180
+ " — its family stage" + (familyRows.length > 1 ? "s" : "") + " " + familyTag() +
181
+ " take" + (familyRows.length > 1 ? "" : "s") + " initials, not params", { loc: "params" });
182
+ }
183
+ throw new RemoteError("runs/invalid-request", "no stage of flow " + flowName + " admits param " + JSON.stringify(key) +
184
+ " — a flat params value needs exactly one admitting stage; " +
185
+ "target a stage with {stage_id: {" + key + ": …}} or drop the key", { loc: "params" });
186
+ }
187
+ if (targets.length > 1) {
188
+ throw new RemoteError("runs/invalid-request", "param " + JSON.stringify(key) + " is admitted by " + targets.length +
189
+ " stages of flow " + flowName + " (" +
190
+ targets.map((r) => JSON.stringify(r["id"])).join(", ") +
191
+ ") — ambiguous; target one stage with {stage_id: {" + key + ": …}}", { loc: "params" });
192
+ }
193
+ const row = targets[0];
194
+ paramsOf(row)[key] = value;
195
+ }
196
+ }
197
+ //# sourceMappingURL=flowsParamsOverlay.js.map
@@ -1,5 +1,5 @@
1
1
  import type { RegistryFlow } from "./flowsData.js";
2
- export declare const ANNY_HMR_COMMERCIAL: RegistryFlow;
2
+ export declare const ANNY_HMR_ESTIMATOR: RegistryFlow;
3
3
  export declare const ANNY_PARAMS: RegistryFlow;
4
4
  export declare const AUDIO_NATIVE_TTS: RegistryFlow;
5
5
  export declare const BODY_TO_SOMAX: RegistryFlow;
@@ -7,4 +7,6 @@ export declare const FIT_SEAT: RegistryFlow;
7
7
  export declare const IMAGE_UPSCALE: RegistryFlow;
8
8
  export declare const MUSIC_NATIVE: RegistryFlow;
9
9
  export declare const CRAFT_LOOP: RegistryFlow;
10
+ export declare const CHARACTER_FACTORY: RegistryFlow;
11
+ export declare const OBJECT_FORGE: RegistryFlow;
10
12
  //# sourceMappingURL=flowsRegistryRows.d.ts.map
@@ -4,9 +4,9 @@
4
4
  // types, the helpers, and the assembled REGISTRY.
5
5
  import { CARD_PLANE_ENGINE } from '@melite/contracts/benchStage';
6
6
  import { plainStage, initial, fromStage } from "./flowsData.js";
7
- export const ANNY_HMR_COMMERCIAL = {
8
- id: "anny-hmr-commercial",
9
- description: "The commercial photo→Anny chain: " +
7
+ export const ANNY_HMR_ESTIMATOR = {
8
+ id: "anny-hmr-estimator",
9
+ description: "The estimator photo→Anny chain: " +
10
10
  "SAM 3D Body → MHR → SOMA → anny — every link license-cleared for sale " +
11
11
  "(SAM License operator-accepted; the rest Apache 2.0). Emits a grounded " +
12
12
  "bind-pose body GLB + anny phenotype/local-change params.",
@@ -14,12 +14,12 @@ export const ANNY_HMR_COMMERCIAL = {
14
14
  plainStage({
15
15
  id: "estimate",
16
16
  engine: CARD_PLANE_ENGINE,
17
- // the commercial engine of the same verb — family DECL owns
17
+ // the estimator engine of the same verb — family DECL owns
18
18
  // the nodes (SAM 3D Body → grounded anny), person_index FIXED
19
19
  // at the loudest detection (the verb's chip owns the picker)
20
20
  family: "anny",
21
- action: "estimate_commercial",
22
- description: "SAM 3D Body commercial chain → grounded anny GLB",
21
+ action: "estimate_photo",
22
+ description: "SAM 3D Body estimator → grounded anny GLB",
23
23
  inputs: { photo: initial("photo") },
24
24
  expected: { photo: "image" },
25
25
  params: { photo: "$photo" },
@@ -375,4 +375,146 @@ export const CRAFT_LOOP = {
375
375
  tool: null,
376
376
  skillRefs: [],
377
377
  };
378
+ export const CHARACTER_FACTORY = {
379
+ id: "character-factory",
380
+ description: "Photo → clothed character → rigged → animated (the AssetFurnace-shape " +
381
+ "chain, estate-native): img-to-mesh lift with the repair knobs ON, rig " +
382
+ "auto (SOMA-77, BODY_TO_SOMAX's lane chained), kimodo text→motion " +
383
+ "skinned onto the rigged mesh (somax bake in-graph). Multi-stage: " +
384
+ "serves at validate (start refuses multi-stage); agents drive the " +
385
+ "stages through the queue door, one card at a time — see " +
386
+ "flows/character-factory/agents/AGENT.md. Creature motion rides the " +
387
+ "MOTION phase instead (unimate dataset clip → rig copy bridge, " +
388
+ "game-profile MCPs) — documented in the leaf, never a registry " +
389
+ "stage (unimate is an MCP, not melite).",
390
+ stages: [
391
+ plainStage({
392
+ id: "lift",
393
+ engine: CARD_PLANE_ENGINE,
394
+ card: "img-to-mesh",
395
+ description: "Photo → textured mesh via the img-to-mesh card (repair knobs ON)",
396
+ inputs: { photo: initial("photo") },
397
+
398
+ expected: { photo: "image" },
399
+ outputs: { mesh: "mesh" },
400
+ cardIo: { mesh: "mesh" },
401
+ params: { model: "pixal3d", input_image: "$photo" },
402
+ }),
403
+ plainStage({
404
+ id: "rig",
405
+ engine: CARD_PLANE_ENGINE,
406
+ card: "rig",
407
+ description: "SOMA-77 auto-rig via the rig card (BODY_TO_SOMAX's lane, chained)",
408
+ inputs: { mesh: fromStage("lift", "mesh") },
409
+ expected: { mesh: "mesh" },
410
+ outputs: { body: "mesh" },
411
+ cardIo: { body: "mesh" },
412
+ // no model pin (BODY_TO_SOMAX's law): mode auto selects the
413
+ // gem_soma family; the card's own contract owns the default
414
+ params: { mesh_glb: "$mesh", mode: "auto", preserve_texture: true },
415
+ }),
416
+ plainStage({
417
+ id: "motion",
418
+ engine: CARD_PLANE_ENGINE,
419
+ card: "motion",
420
+ description: "Kimodo text→motion skinned onto the rigged mesh (somax bake in-graph)",
421
+ inputs: { prompt: initial("prompt"), preview: fromStage("rig", "body") },
422
+ expected: { prompt: "text", preview: "mesh" },
423
+ // the card's two native channels ride verbatim (no rename: the
424
+ // flowOutputBindings bind motion_npz + animated_glb by name)
425
+ outputs: { motion_npz: "data", animated_glb: "mesh" },
426
+ cardIo: { motion_npz: "data", animated_glb: "mesh" },
427
+ params: { model: "kimodo", prompt: "$prompt", preview_glb: "$preview" },
428
+ }),
429
+ ],
430
+ initialValidators: { photo: "photo", prompt: "text" },
431
+ requiredInitials: ["photo", "prompt"],
432
+ tool: null,
433
+ skillRefs: [],
434
+ };
435
+
436
+ // the quad-remesh card and its vendored pack left with the pack the
437
+ // owner removed from the system — object-forge is the lift's tri
438
+ // mesh today.
439
+ export const OBJECT_FORGE = {
440
+ id: "object-forge",
441
+ description: "Prompt → concept render → textured mesh, one card per stage " +
442
+ "(image-gen + img-to-mesh; both card=, so the {flow:} door submits " +
443
+ "one merged run — image-upscale's 2026-10-04 shape). Emits the " +
444
+ "lift's textured tri mesh.",
445
+ stages: [
446
+ plainStage({
447
+ id: "concept",
448
+ engine: CARD_PLANE_ENGINE,
449
+ card: "image-gen",
450
+ description: "Concept render via the image-gen card (z-image default)",
451
+ inputs: { prompt: initial("prompt") },
452
+
453
+ expected: { prompt: "text" },
454
+ cardIo: { image: "image" },
455
+ params: { model: "z-image", prompt: "$prompt" },
456
+ }),
457
+ plainStage({
458
+ id: "lift",
459
+ engine: CARD_PLANE_ENGINE,
460
+ card: "img-to-mesh",
461
+ description: "Image → textured mesh via the img-to-mesh card (trellis2-native, " +
462
+ "no pack; repair knobs ride the card's own defaults)",
463
+ inputs: { concept: fromStage("concept", "image") },
464
+ expected: { concept: "image" },
465
+ cardIo: { mesh: "mesh" },
466
+ params: { model: "trellis2-native", input_image: "$concept" },
467
+ }),
468
+ ],
469
+ initialValidators: { prompt: "text" },
470
+ tool: {
471
+ name: "object_forge",
472
+ version: 1,
473
+ description: "Generate a game-ready 3D object from one prompt line: concept render " +
474
+ "(z-image), image-to-mesh lift (trellis2-native), quad remesh to game " +
475
+ "topology. One POST runs the whole flow and returns both meshes.",
476
+ properties: {
477
+ prompt: {
478
+ ptype: "string",
479
+ description: "the object — one clear subject; a plain background reads best",
480
+ default: null,
481
+ hasDefault: false,
482
+ minimum: null,
483
+ maximum: null,
484
+ enum: null,
485
+ },
486
+ target_quads: {
487
+ ptype: "integer",
488
+ description: "quad budget for the remesh stage",
489
+ default: 50000,
490
+ hasDefault: true,
491
+ minimum: 0,
492
+ maximum: 200000,
493
+ enum: null,
494
+ },
495
+ image_model: {
496
+ ptype: "string",
497
+ description: "the concept generator family",
498
+ default: "z-image",
499
+ hasDefault: true,
500
+ minimum: null,
501
+ maximum: null,
502
+ enum: ["z-image", "krea-2"],
503
+ },
504
+ },
505
+ required: ["prompt"],
506
+ overlays: [
507
+ {
508
+ param: "image_model",
509
+ stage: "concept",
510
+ path: ["model"],
511
+ choices: { "z-image": "z-image", "krea-2": "krea-2" },
512
+ },
513
+ { param: "target_quads", stage: "remesh", path: ["target_quads"], choices: null },
514
+ ],
515
+ },
516
+ // ref would resolve null (the loadPlane null arm, never fired
517
+ // before this row); its craft lives in the leaf skill instead.
518
+ skillRefs: ["card:image-gen", "card:img-to-mesh", "model:z-image:prompt-enhance"],
519
+ };
378
520
  //# sourceMappingURL=flowsRegistryRows.js.map
package/lib/index.d.ts CHANGED
@@ -6,7 +6,6 @@ export { ManageGatewayService } from "./manageRegistry.js";
6
6
  export type { QueueConfig } from "./service.js";
7
7
  export * from "./vocab.js";
8
8
  export * from "./queue.js";
9
- export * from "./runStatus.js";
10
9
  export { bootSweep } from "./resurrect.js";
11
10
  export declare const name = "estate-queue";
12
11
  export declare const inject: string[];
@@ -16,8 +15,6 @@ export default plugin;
16
15
  export * from "./runsGates.js";
17
16
  export { findSkill, disclosureRoot } from "./skillPlane.js";
18
17
  export type { FamilyModelsSeat } from "./flowsFamilyCompose.js";
19
- export { benchPicks, benchFingerprint, benchBootMs, benchDir } from "./bench.js";
20
- export type { StagePick } from "./bench.js";
21
18
  export * from "./runsList.js";
22
19
  export * from "./mediaKinds.js";
23
20
  export * from "./runsTypes.js";
package/lib/index.js CHANGED
@@ -11,14 +11,21 @@ export { RunsRuntimeService } from "./runsRegistry.js";
11
11
  export { ManageGatewayService } from "./manageRegistry.js";
12
12
  export * from "./vocab.js";
13
13
  export * from "./queue.js";
14
- export * from "./runStatus.js";
15
14
  // bootSweep twins (queue.ts core impl + resurrect.ts QueueRoots
16
15
  // wrapper): the explicit export wins over the stars — the wrapper
17
16
  // is the domain seam.
18
17
  export { bootSweep } from "./resurrect.js";
18
+ import { FlowsSeatService } from "./flowsData.js";
19
19
  export const name = "estate-queue";
20
20
  export const inject = ["timer"];
21
21
  export function apply(ctx, config = {}) {
22
+
23
+ // registry's live table is service instance state, its seed rows
24
+ // fiber-owned (ctx.effect in the constructor — the models
25
+ // registerFamily precedent). Every later row reads it through
26
+ // ctx.get("meliteFlows"); the queue itself needs no inject for a
27
+ // same-row service it never property-reads.
28
+ new FlowsSeatService(ctx);
22
29
  new QueueService(ctx, config);
23
30
  }
24
31
  const plugin = { name, inject, apply };
@@ -28,10 +35,12 @@ export * from "./runsGates.js";
28
35
  // the agent engine's spawn-injection reader rides these over the
29
36
  // SAME storage melite_load serves (never a second skill tree).
30
37
  export { findSkill, disclosureRoot } from "./skillPlane.js";
31
- // THE LIVE BENCH (the selection's only source — the catalog law):
32
- // every selection-serving surface reads through these, never its
33
- // own glob (drift between readers is how stale docs leak back).
34
- export { benchPicks, benchFingerprint, benchBootMs, benchDir } from "./bench.js";
38
+ // THE LIVE BENCH (the selection's only source — the catalog law)
39
+ // stays PACKAGE-INTERNAL since the dry-sweep's J18: the only live
40
+ // reader is skillPlane's buildSkillIndex (benchPicksSync, direct
41
+ // src import); the index face's re-exports had zero external
42
+ // importers, and the async twin + fingerprint rode no consumer at
43
+ // all. The spec pins the law through direct src imports.
35
44
  export * from "./runsList.js";
36
45
  export * from "./mediaKinds.js";
37
46
  export * from "./runsTypes.js";
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Hold the latch for one door; the door releases it in its own finally.
3
+ * Holds nest under the same action name and across names; a release
4
+ * only retires its own hold.
5
+ * @param action the destructive action in flight (the door's own name)
6
+ * @returns the door's release closure, idempotent for its own hold
7
+ */
8
+ export declare function holdLifecycle(action: string): () => void;
9
+ /**
10
+ * The earliest action whose teardown is in flight, or null — read by
11
+ * the run press before its press reserve and record mint, and re-read
12
+ * by the press after its last await (runsStart's enqueue gate).
13
+ * @returns the held action name, or null when no teardown is in flight
14
+ */
15
+ export declare function lifecycleInFlight(): string | null;
16
+ //# sourceMappingURL=lifecycleLatch.d.ts.map
@@ -0,0 +1,42 @@
1
+
2
+ //
3
+ // The guard half (guardLifecycle in manageOps.ts) refuses a teardown
4
+ // when runs are already live, but five of the six destructive doors
5
+ // await on the vendor call as their first act — a run born during
6
+ // that await tears mid-render (round-19 F1: sidecar says running
7
+ // while its engine reboots). The latch is the reservation half: a
8
+ // guarded door holds it across its destructive section and the run
9
+ // press (RunsRegistry.start) refuses while it names an action.
10
+ // Doors overlap (the manage dispatch is unserialized): one slot would
11
+ // let the first finisher's release clear the other's live hold. Each
12
+ // holder counts under its own action name; the read names the earliest
13
+ // holder (Map insertion order).
14
+ const holders = new Map();
15
+ /**
16
+ * Hold the latch for one door; the door releases it in its own finally.
17
+ * Holds nest under the same action name and across names; a release
18
+ * only retires its own hold.
19
+ * @param action the destructive action in flight (the door's own name)
20
+ * @returns the door's release closure, idempotent for its own hold
21
+ */
22
+ export function holdLifecycle(action) {
23
+ holders.set(action, (holders.get(action) ?? 0) + 1);
24
+ return () => {
25
+ const left = (holders.get(action) ?? 1) - 1;
26
+ if (left <= 0)
27
+ holders.delete(action);
28
+ else
29
+ holders.set(action, left);
30
+ };
31
+ }
32
+ /**
33
+ * The earliest action whose teardown is in flight, or null — read by
34
+ * the run press before its press reserve and record mint, and re-read
35
+ * by the press after its last await (runsStart's enqueue gate).
36
+ * @returns the held action name, or null when no teardown is in flight
37
+ */
38
+ export function lifecycleInFlight() {
39
+ const first = holders.keys().next();
40
+ return first.done ? null : first.value;
41
+ }
42
+ //# sourceMappingURL=lifecycleLatch.js.map
@@ -1,6 +1,7 @@
1
1
  import { emitModifierKinds } from "@melite/comfyui-cordis";
2
2
  import type { ModelsService } from "@melite/comfyui-cordis";
3
3
  import type { CardRegistryService } from "./cardsRegistry.js";
4
+ import type { FlowsSeat } from "./flowsData.js";
4
5
  import { toolBaseRows } from "./toolProjection.js";
5
6
  import type { FamilyModelsSeat } from "./flowsFamilyCompose.js";
6
7
  /** A card id → its package dir. The cardPackages rows are package
@@ -63,7 +64,7 @@ export declare function flowLeafDocs(repo: string, flowName: string): Array<{
63
64
  * Dangling refs line null — visible drift, never a refusal. */
64
65
  /** @param modelsSeat the context's models service when mounted (the
65
66
  * same seat-threading law the runs doors ride) */
66
- export declare function skillLineForRef(repo: string, ref: string, modelsSeat?: FamilyModelsSeat | null): Record<string, unknown>;
67
+ export declare function skillLineForRef(repo: string, ref: string, modelsSeat?: FamilyModelsSeat | null, flowsSeat?: FlowsSeat | null): Record<string, unknown>;
67
68
  /** The lane's models seat as the CARD arm reads it: the four
68
69
  * disclosure methods (family rows, path/file presence, catalog
69
70
  * artifacts). ModelsService satisfies it structurally; ctx.get
@@ -88,6 +89,6 @@ export declare function loadCard(repo: string, cards: CardRegistryService, model
88
89
  /** @param modelsSeat the context's models service when mounted — the
89
90
  * flow's skill lines resolve through the seat the runs doors
90
91
  * thread (the lane-seat law); the booted singleton otherwise */
91
- export declare function loadFlow(repo: string, flowName: string, modelsSeat?: FamilyModelsSeat | null): Record<string, unknown>;
92
+ export declare function loadFlow(repo: string, flowName: string, modelsSeat?: FamilyModelsSeat | null, flowsSeat?: FlowsSeat | null): Record<string, unknown>;
92
93
  /** First-non-blank query value (the catalogs qFirst shape). */
93
94
  //# sourceMappingURL=loadPlane.d.ts.map
package/lib/loadPlane.js CHANGED
@@ -11,9 +11,9 @@ import { createHash } from "node:crypto";
11
11
  import { existsSync, readdirSync, readFileSync } from "node:fs";
12
12
  import { join } from "node:path";
13
13
  import { cardPackages, emitModifierKinds, emitParamsSchema, getModel, modelsService, theService } from "@melite/comfyui-cordis";
14
- import { semanticModelEntries } from "@melite/comfyui-cordis/semanticModelKnob";
14
+ import { semanticModelEntries } from "@melite/comfyui-card-kit/semanticModelKnob";
15
15
  import { laneContractsFor } from "@melite/contracts/laneRelations";
16
- import { getRegistryFlow } from "./flowsData.js";
16
+ import { seedFlowsSeat } from "./flowsData.js";
17
17
  import { toolBaseRows } from "./toolProjection.js";
18
18
  import { modelRows, cardRows, engineDirs, wireSkill, findSkill } from "./skillPlane.js";
19
19
  import { laneFilesStatus } from "./cardsLanes.js";
@@ -38,6 +38,7 @@ export function resolveCardPackageDir(repo, cardId) {
38
38
  throw new Error(`disclose: no packages tier under '${repo}'`);
39
39
  }
40
40
  const hits = [];
41
+ let named = 0;
41
42
  for (const row of cardPackages) {
42
43
  // (every cardPackages row carries the @melite/ prefix — the bare arm never fires;
43
44
  // studio cards' rows point at the CARD subpath ('.../card') — strip it: the
@@ -45,6 +46,7 @@ export function resolveCardPackageDir(repo, cardId) {
45
46
  const tail = (row.startsWith("@melite/") ? row.slice("@melite/".length) : /* v8 ignore next */ row).replace(/\/card$/, "");
46
47
  if (!tail.endsWith("-" + cardId))
47
48
  continue;
49
+ named++;
48
50
  for (const dom of domains) {
49
51
  if (!tail.startsWith(dom + "-"))
50
52
  continue;
@@ -57,8 +59,23 @@ export function resolveCardPackageDir(repo, cardId) {
57
59
  hits.push(dir);
58
60
  }
59
61
  }
60
- if (hits.length === 0)
61
- throw new Error(`disclose: unknown card '${cardId}'`);
62
+ if (hits.length === 0) {
63
+ if (named === 0)
64
+ throw new Error(`disclose: unknown card '${cardId}'`);
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+ throw new Error(`disclose: card '${cardId}' is registered but no source dir serves under '${repo}' ` +
76
+ `(the load door reads packages/<genre>/<card>/src/card.ts from the repo tree; ` +
77
+ `an install tree ships no card sources — pin MELITE_REPO_ROOT to the estate checkout)`);
78
+ }
62
79
 
63
80
 
64
81
  if (hits.length > 1)
@@ -340,9 +357,9 @@ export function flowLeafDocs(repo, flowName) {
340
357
  * Dangling refs line null — visible drift, never a refusal. */
341
358
  /** @param modelsSeat the context's models service when mounted (the
342
359
  * same seat-threading law the runs doors ride) */
343
- export function skillLineForRef(repo, ref, modelsSeat) {
360
+ export function skillLineForRef(repo, ref, modelsSeat, flowsSeat) {
344
361
  try {
345
- const found = findSkill(repo, ref, modelsSeat);
362
+ const found = findSkill(repo, ref, modelsSeat, flowsSeat);
346
363
  if (found !== null)
347
364
  return { ref, line: wireSkill(found.row) };
348
365
  }
@@ -454,8 +471,8 @@ export function loadCard(repo, cards, modelsSeat, cardId) {
454
471
  /** @param modelsSeat the context's models service when mounted — the
455
472
  * flow's skill lines resolve through the seat the runs doors
456
473
  * thread (the lane-seat law); the booted singleton otherwise */
457
- export function loadFlow(repo, flowName, modelsSeat) {
458
- const row = getRegistryFlow(flowName);
474
+ export function loadFlow(repo, flowName, modelsSeat, flowsSeat) {
475
+ const row = (flowsSeat ?? seedFlowsSeat()).get(flowName);
459
476
  if (row === undefined)
460
477
  throw new Error(`disclose: unknown flow '${flowName}'`);
461
478
  const stages = row.stages.map((s) => ({
@@ -31,7 +31,7 @@ export class LoadResolverService extends Service {
31
31
  // is the injector API (an unmounted seat reads undefined and the
32
32
  // plane degrades to the booted singleton).
33
33
  return {
34
- bundle: loadFlow(repo, name, this.ctx.get("models")),
34
+ bundle: loadFlow(repo, name, this.ctx.get("models"), this.ctx.get("meliteFlows")),
35
35
  };
36
36
  }
37
37
  // The card arm reads the LANE's seat for the same reason the flow
@@ -15,7 +15,13 @@ export declare function awaitQueueDrained(ctx: ManageCtx, req: Req): Promise<Rec
15
15
  /** BYO guard: estate-orchestration legs (systemd, workspace reads)
16
16
  * never touch a user-owned ComfyUI. */
17
17
  export declare function estateOnly(req: Req, cfg: Record<string, unknown>): void;
18
- export declare const COMFY_UNIT: string;
19
- export declare function systemctl(req: Req, verb: "start" | "stop", signal?: AbortSignal): Promise<[number, ManageEnvelope]>;
18
+ /** Run systemctl for the estate's engine unit.
19
+ * @param req - the manage request (envelope rows).
20
+ * @param verb - the systemctl verb to run.
21
+ * @param unit - the estate deployment's systemd unit (config-pinned).
22
+ * @param signal - aborts the child and maps to the abort reason.
23
+ * @returns [status, envelope] as the manage lane's answer.
24
+ */
25
+ export declare function systemctl(req: Req, verb: "start" | "stop", unit: string, signal?: AbortSignal): Promise<[number, ManageEnvelope]>;
20
26
  export declare function guardLifecycle(req: Req, ctx: ManageCtx): void;
21
27
  //# sourceMappingURL=manageOps.d.ts.map