@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
@@ -11,34 +11,40 @@
11
11
  // MELITE_STATE_ROOT/output; the maker paid a refusal + ~8 forensic
12
12
  // calls to diagnose OUR two-roots lie): every run-resolving door
13
13
  // searches the roots MANIFEST in order — own state root first,
14
- // then the MELITE_STATE_ROOTS extras — the same walk the
14
+ // then the stateRoots config extras — the same walk the
15
15
  // source-echo resolver (runsSourceEcho) and the run doors use.
16
16
  // One law, one spelling: refs may carry EITHER estate prefix
17
17
  // (/v1/assets/runs/ or /melite-media/runs/ — both are first-class
18
- // run sources; the h3 card's own docs teach the assets spelling).
19
- import { statSync } from "node:fs";
18
+ // run sources; the h3 card's own docs teach the assets spelling)
19
+ // or the gallery's artifact face (/infer-gallery/artifact?path=
20
+ // — the same tail the guard and the engine stage).
21
+ import { isFile } from "./skillFs.js";
20
22
  import { join, relative, resolve, sep } from "node:path";
21
- import { resolveRepoRoot } from "@melite/comfyui-cordis";
22
- import { rootsManifest, searchedVoice } from "./rootsManifest.js";
23
- import { resolveStateRoot } from "./queueLock.js";
24
- import { ASSET_RUNS_PREFIX, MEDIA_RUNS_PREFIX } from "./runsSourceEcho.js";
23
+ import { ASSET_RUNS_PREFIX, MEDIA_RUNS_PREFIX, galleryTail } from "./runsSourceEcho.js";
24
+ import { segmentConfined } from "@melite/contracts/mediaKinds";
25
+ import { searchedVoice } from "./rootsManifest.js";
25
26
  // ── artifact-ref sweep (find_dangling_refs
26
27
  // semantics — the validate-door mirror, same roots) ──────────
27
28
  /** The one-prefix question: which estate route (if any) does this
28
29
  * string carry? Both spellings are the same trees (the media
29
- * route is the newer first-class face — runsSourceEcho's law). */
30
+ * route is the newer first-class face — runsSourceEcho's law).
31
+ * Case-insensitive like the guard's detectFace and the engine's
32
+ * estate arm (round-23 gallery audit F5): the slice rides the
33
+ * constant's LENGTH (the prefixes are ASCII), so the tail keeps
34
+ * its case for the disk walk. */
30
35
  function artifactPrefixOf(raw) {
31
- if (raw.startsWith(ASSET_RUNS_PREFIX))
36
+ const lower = raw.toLowerCase();
37
+ if (lower.startsWith(ASSET_RUNS_PREFIX.toLowerCase()))
32
38
  return ASSET_RUNS_PREFIX;
33
- if (raw.startsWith(MEDIA_RUNS_PREFIX))
39
+ if (lower.startsWith(MEDIA_RUNS_PREFIX.toLowerCase()))
34
40
  return MEDIA_RUNS_PREFIX;
35
41
  return null;
36
42
  }
37
43
  /** THE SWEEP ROOTS (§23): every manifest root's output/ and
38
44
  * test-output/ trees, own state root first, deduped. A test:true
39
45
  * run may wire a test artifact — the test trees sweep too. */
40
- export function sweepOutputRoots() {
41
- const roots = rootsManifest(resolveStateRoot(resolveRepoRoot()));
46
+ export function sweepOutputRoots(stateRoots) {
47
+ const roots = [...stateRoots];
42
48
  const out = [];
43
49
  const seen = new Set();
44
50
  for (const root of roots) {
@@ -57,17 +63,54 @@ export function resolveArtifactFile(ref, outRoot) {
57
63
  const raw = String(ref).trim();
58
64
  if (raw === "")
59
65
  throw new Error("empty artifact ref (nothing to resolve)");
60
- if (raw.includes(".."))
61
- throw new Error("artifact ref refuses traversal: " + JSON.stringify(raw));
62
66
  const prefix = artifactPrefixOf(raw);
67
+ // THE GALLERY FACE (round-23 gallery audit F5): the compose gate
68
+ // never learned the gallery's artifact URLs — a dead gallery ref
69
+ // passed the sweep and refused only at the start door. The tail
70
+ // rides the guard's own parse (runsSourceEcho's galleryTail — one
71
+ // decode, route boundary, twinning the server), never a retype.
72
+ const gallery = prefix === null ? galleryTail(raw) : null;
63
73
  let cand;
64
- if (prefix !== null) {
65
- const rel = raw.slice(prefix.length);
66
- if (rel === "" || rel.endsWith("/") || !rel.includes("/")) {
74
+ if (prefix !== null || gallery !== null) {
75
+ const encoded = prefix !== null ? raw.slice(prefix.length) : gallery;
76
+ const segs = encoded.split("/");
77
+ // the shape law (the old malformed voices, kept verbatim): too
78
+ // few segments, a leading empty (a ?path=/run/x tail), or a
79
+ // trailing slash. A MIDDLE empty rides to the segment law
80
+ // below — the guard refuses it as traversal, and the sweep
81
+ // twins the verdict (it once join-normalized it away).
82
+ if (segs.length < 2 || segs[0] === "" || segs[segs.length - 1] === "") {
67
83
  throw new Error("malformed artifact URL (want <prefix><run_id>/<file> with prefix " +
68
- ASSET_RUNS_PREFIX + " or " + MEDIA_RUNS_PREFIX + "): " + JSON.stringify(raw));
84
+ ASSET_RUNS_PREFIX + " or " + MEDIA_RUNS_PREFIX + " or " +
85
+ "the gallery face /infer-gallery/artifact?path=<run_id>/<file>): " + JSON.stringify(raw));
69
86
  }
70
- cand = join(outRoot, rel);
87
+ const rel = [];
88
+ for (const seg of segs) {
89
+ // PER-SEGMENT DECODE (round-23 gallery audit F3's sweep twin):
90
+ // the media route mints per-segment escapes — resolving the
91
+ // literal `out%201.png` looked up a file that never exists
92
+ // and dangled a LIVE ref at compose. The gallery tail arrives
93
+ // decoded exactly once already (the URL parser's doing) —
94
+ // decoding again corrupts a legal `%` in a filename, so the
95
+ // segment walk confines it but never decodes it again.
96
+ // THE SEGMENT LAW (round-23 gallery audit F2/F4's sweep twin):
97
+ // traversal is a property of SEGMENTS — the old whole-string
98
+ // `..` ban refused the engine's legal `still..frame.png`.
99
+ let dec = seg;
100
+ if (prefix !== null) {
101
+ try {
102
+ dec = decodeURIComponent(seg);
103
+ }
104
+ catch {
105
+ throw new Error("malformed artifact URL (bad percent-escape): " + JSON.stringify(raw));
106
+ }
107
+ }
108
+ if (!segmentConfined(dec)) {
109
+ throw new Error("artifact ref refuses traversal: " + JSON.stringify(raw));
110
+ }
111
+ rel.push(dec);
112
+ }
113
+ cand = join(outRoot, rel.join("/"));
71
114
  }
72
115
  else if (raw.includes("/") && !raw.startsWith("/")) {
73
116
  cand = join(outRoot, raw);
@@ -90,19 +133,12 @@ export function resolveArtifactFile(ref, outRoot) {
90
133
  if (relToRoot === ".." || relToRoot.startsWith(".." + sep)) {
91
134
  throw new Error("artifact ref escapes the output root: " + JSON.stringify(raw));
92
135
  }
93
- let isFile = false;
94
- try {
95
- isFile = statSync(absCand).isFile();
96
- }
97
- catch {
98
- isFile = false;
99
- }
100
- if (!isFile) {
136
+ if (!isFile(absCand)) {
101
137
  // The run id rides the ref's own first segment for every
102
- // prefix-URL and runs-relative shape; an absolute path carries
103
- // no run, so "?" names that absence.
104
- const run = prefix !== null || (raw.includes("/") && !raw.startsWith("/"))
105
- ? raw.slice(prefix !== null ? prefix.length : 0).split("/", 2)[0] // split yields >= 1
138
+ // prefix-URL, gallery-URL and runs-relative shape; an absolute
139
+ // path carries no run, so "?" names that absence.
140
+ const run = prefix !== null || gallery !== null || (raw.includes("/") && !raw.startsWith("/"))
141
+ ? (prefix !== null ? raw.slice(prefix.length) : gallery !== null ? gallery : raw).split("/", 2)[0] // split yields >= 1
106
142
  : "?";
107
143
  throw new Error("artifact not found on disk: " + JSON.stringify(raw) + " (looked up " + absCand + ") — the " +
108
144
  "upstream run may have been pruned, or the ref was never an output of run " + run);
@@ -126,7 +162,7 @@ export function refLocations(body) {
126
162
  stack.push({ node: node[i], path: path + "[" + i + "]" });
127
163
  }
128
164
  }
129
- else if (typeof node === "string" && artifactPrefixOf(node) !== null) {
165
+ else if (typeof node === "string" && (artifactPrefixOf(node) !== null || galleryTail(node) !== null)) {
130
166
  out.push({ location: path, ref: node });
131
167
  }
132
168
  }
@@ -134,8 +170,8 @@ export function refLocations(body) {
134
170
  }
135
171
  /** The shared sweep body: every dangling (location, ref, why) in refLocations' DFS order, each miss quoting the PRIMARY root lookup (resolveArtifactFile above) + every searched tree (the NAME-THE-ROOT law, §23). */
136
172
  /** Receipt transcript-034 step 18: the old voice named ONE tree and read like a pruned run. */
137
- function scanRefs(body) {
138
- const roots = sweepOutputRoots();
173
+ function scanRefs(body, stateRoots) {
174
+ const roots = sweepOutputRoots(stateRoots);
139
175
  const dangling = [];
140
176
  for (const { location, ref } of refLocations(body)) {
141
177
  let live = false;
@@ -152,7 +188,16 @@ function scanRefs(body) {
152
188
  }
153
189
  }
154
190
  if (!live) {
155
- dangling.push([location, ref, primaryErr.message + " " + searchedVoice(roots)]);
191
+
192
+ // here as a raw TypeError — the sweep fails closed with a
193
+ // named reason instead of 500ing the door.
194
+ dangling.push([
195
+ location,
196
+ ref,
197
+ primaryErr !== null
198
+ ? primaryErr.message + " " + searchedVoice(roots)
199
+ : "no sweep roots configured" + " " + searchedVoice(roots),
200
+ ]);
156
201
  }
157
202
  }
158
203
  return dangling;
@@ -162,7 +207,7 @@ function scanRefs(body) {
162
207
  * live under ANY swept tree (§23 — the manifest walk, own root
163
208
  * first; a miss names every searched tree so a two-roots box
164
209
  * stays debuggable). */
165
- export function findCardDangling(body) {
166
- return scanRefs(body)[0] ?? null;
210
+ export function findCardDangling(body, stateRoots) {
211
+ return scanRefs(body, stateRoots)[0] ?? null;
167
212
  }
168
213
  //# sourceMappingURL=cardsDangling.js.map
@@ -1,11 +1,16 @@
1
- import type { CardDefinition } from "@melite/comfyui-cordis";
1
+ import type { CardDefinition } from "@melite/comfyui-card-kit/card-definition";
2
2
  import type { LaneRelations, SamplerEnvelope } from "@melite/contracts/laneRelations";
3
3
  export interface VariantCellRow {
4
4
  readonly quant: string;
5
5
  readonly route: string;
6
6
  readonly hide_from_dropdown?: boolean;
7
+
8
+
9
+
10
+
11
+ readonly params?: readonly string[];
7
12
  }
8
- export interface VariantRow {
13
+ export interface ResolvedVariantRow {
9
14
  readonly id: string;
10
15
  readonly group: string;
11
16
  readonly hide_from_dropdown?: boolean;
@@ -40,7 +45,7 @@ export interface VariantRow {
40
45
  export interface ModelFactsRow {
41
46
  readonly card: string;
42
47
  readonly defaults: Record<string, unknown>;
43
- readonly variants: VariantRow[];
48
+ readonly variants: ResolvedVariantRow[];
44
49
 
45
50
 
46
51
 
@@ -71,4 +76,12 @@ export interface CardDeclRow {
71
76
  }
72
77
  export declare function factsPath(): string;
73
78
  export declare function deriveDecls(defs: Map<string, CardDefinition>, facts: Record<string, ModelFactsRow>): Record<string, CardDeclRow>;
79
+ /** THE SHARED ADMISSION PREDICATE (audit J-E2): knobs ∪ absorbed
80
+ * mod fields ∪ contract admits (a `prefix*` admit row admits every
81
+ * key under the prefix). ONE surface for the admission seats —
82
+ * compose's admission gate, start's params-override door, and the
83
+ * variant stamp gate (audit Y-S2) — or the seats disagree about
84
+ * what a card admits. Lives on the leaf: every consumer already
85
+ * imports these row types, no seat-to-seat cycle. */
86
+ export declare function cardAdmits(decl: CardDeclRow | undefined, modNames: ReadonlySet<string>, key: string): boolean;
74
87
  //# sourceMappingURL=cardsFacts.d.ts.map
package/lib/cardsFacts.js CHANGED
@@ -61,4 +61,18 @@ export function deriveDecls(defs, facts) {
61
61
  }
62
62
  return out;
63
63
  }
64
+ /** THE SHARED ADMISSION PREDICATE (audit J-E2): knobs ∪ absorbed
65
+ * mod fields ∪ contract admits (a `prefix*` admit row admits every
66
+ * key under the prefix). ONE surface for the admission seats —
67
+ * compose's admission gate, start's params-override door, and the
68
+ * variant stamp gate (audit Y-S2) — or the seats disagree about
69
+ * what a card admits. Lives on the leaf: every consumer already
70
+ * imports these row types, no seat-to-seat cycle. */
71
+ export function cardAdmits(decl, modNames, key) {
72
+ if (decl === undefined)
73
+ return false;
74
+ return (decl.schemaNames.includes(key) ||
75
+ modNames.has(key) ||
76
+ decl.admits.some((a) => a === key || (a.endsWith("*") && key.startsWith(a.slice(0, -1)))));
77
+ }
64
78
  //# sourceMappingURL=cardsFacts.js.map
@@ -1,5 +1,15 @@
1
- import type { ModelDecl } from "@melite/comfyui-cordis";
1
+ import type { ModelDecl } from "@melite/comfyui-card-kit/model-contract";
2
2
  import { CardArmError } from "./cardsArmError.js";
3
+ /** lane_inputs keys that name FILES the stock loaders read, mapped
4
+ * to their ComfyUI folder sets (text_encoders folds legacy clip;
5
+ * unet folds diffusion_models; loras is the LoraLoaderModelOnly
6
+ * root — a family's default-bag distill rides it). Keys absent here
7
+ * are declaration-only — model_path/texture_vae ride pack-specific
8
+ * loaders whose folders the estate cannot name without inventing a
9
+ * mapping; those slots are judged through the DECL's own
10
+ * `lane_homes` row (the declared-home loop below), which replaces
11
+ * this map and the pack union for its slot. */
12
+ export declare const LANE_FOLDERS: Readonly<Record<string, readonly string[]>>;
3
13
  /** The endpoint's pack categories (extra_model_folders keys) — the
4
14
  * custom-node weight homes (SEEDVR2, anny, …). A lane file may
5
15
  * legally live in a pack the stock map doesn't name (seedvr2's
@@ -27,7 +37,7 @@ export declare function lanePresenceRefusal(fam: string): CardArmError | null;
27
37
 
28
38
 
29
39
  type LaneCheck = (folder: string, name: string) => string | null;
30
- export declare function laneFilesStatus(decl: Pick<ModelDecl, "lane_inputs">, check?: LaneCheck): boolean | null;
40
+ export declare function laneFilesStatus(decl: Pick<ModelDecl, "lane_inputs" | "provisions" | "lane_homes">, check?: LaneCheck): boolean | null;
31
41
  export declare function lanePresenceMiss(fam: string): CardArmError | null;
32
42
  export {};
33
43
  //# sourceMappingURL=cardsLanes.d.ts.map
package/lib/cardsLanes.js CHANGED
@@ -11,22 +11,29 @@ import { CardArmError } from "./cardsArmError.js";
11
11
  // (checkModelPresent) but nothing in the run path consulted it —
12
12
  // Img Gen worked because its weights happened to be on disk, Img
13
13
  // Edit died at ComfyUI validation with the reason swallowed by the
14
- // UI. Presence is now ENFORCED at phase-1 for EVERY card run, one
15
- // gate, one voice — the refusal names the family, the lane key,
16
- // the missing file, the folders checked, and the provision URL
17
- // when the family declares one (the fetch hint).
14
+ // UI. Presence is now ENFORCED at phase-1 for every FAMILY-BACKED
15
+ // card run (familyless units and declaration-only lane keys —
16
+ // keys outside the map below — are excluded on purpose, see the
17
+ // LANE_FOLDERS note), one gate, one voice — the refusal names the
18
+ // family, the lane key, the missing file, the folders checked, and
19
+ // the provision URL when the family declares one (the fetch hint).
18
20
  /** lane_inputs keys that name FILES the stock loaders read, mapped
19
21
  * to their ComfyUI folder sets (text_encoders folds legacy clip;
20
- * unet folds diffusion_models). Keys absent here are declaration-
21
- * only — model_path/texture_vae ride pack-specific loaders whose
22
- * folders the estate cannot name without inventing a mapping. */
23
- const LANE_FOLDERS = {
22
+ * unet folds diffusion_models; loras is the LoraLoaderModelOnly
23
+ * root — a family's default-bag distill rides it). Keys absent here
24
+ * are declaration-only — model_path/texture_vae ride pack-specific
25
+ * loaders whose folders the estate cannot name without inventing a
26
+ * mapping; those slots are judged through the DECL's own
27
+ * `lane_homes` row (the declared-home loop below), which replaces
28
+ * this map and the pack union for its slot. */
29
+ export const LANE_FOLDERS = {
24
30
  text_encoder: ["text_encoders", "clip"],
25
31
  vae: ["vae"],
26
32
  unet: ["unet", "diffusion_models"],
27
33
  checkpoint: ["checkpoints"],
28
34
  clip_vision: ["clip_vision"],
29
35
  background_removal: ["background_removal"],
36
+ loras: ["loras"],
30
37
  };
31
38
  /** The endpoint's pack categories (extra_model_folders keys) — the
32
39
  * custom-node weight homes (SEEDVR2, anny, …). A lane file may
@@ -74,8 +81,21 @@ export function lanePresenceRefusal(fam) {
74
81
  throw miss;
75
82
  return null;
76
83
  }
84
+ /** The store spellings one declared home probes for one lane
85
+ * value. The value may carry a loader-side subpath
86
+ * ("qwen3-tts/hf/Qwen3-TTS-…-Base" under the qwen3_tts key) or be
87
+ * a bare name ("sam_vit_b_01ec64.pth" under sams) — both spellings
88
+ * ride findModelPresent's exact join, so both are probed. */
89
+ function homeProbes(home, name) {
90
+ const probes = [[home, name]];
91
+ const cut = name.lastIndexOf("/");
92
+ if (cut > 0)
93
+ probes.push([home + "/" + name.slice(0, cut), name.slice(cut + 1)]);
94
+ return probes;
95
+ }
77
96
  function firstLaneMiss(decl, check) {
78
97
  const li = (decl.lane_inputs ?? {});
98
+ const homes = (decl.lane_homes ?? {});
79
99
  const packs = lanePackFolders();
80
100
  for (const [key, stock] of Object.entries(LANE_FOLDERS)) {
81
101
  const raw = li[key];
@@ -86,15 +106,46 @@ function firstLaneMiss(decl, check) {
86
106
  ...stock,
87
107
  ...packs.filter((p) => !stock.includes(p)),
88
108
  ];
109
+
110
+ // lands where its own row says — loras land in loras/h3, not the
111
+ // stock root — so the row's folder is the last folder probed and
112
+ // the refusal names it. One truth: the provision row owns the
113
+ // file's home; no second subfolder mapping lives here.
114
+ const prov = (decl.provisions ?? []).find((p) => p.name === name);
115
+ if (prov !== undefined && !folders.includes(prov.folder))
116
+ folders.push(prov.folder);
89
117
  if (folders.some((folder) => check(folder, name) !== null))
90
118
  continue;
91
119
  return { key, name, folders };
92
120
  }
121
+
122
+ // model_path/texture_vae name files whose loader is pack-specific
123
+ // — the estate cannot name their folders without inventing a map,
124
+ // so the DECL does (lane_homes). The declared home replaces the
125
+ // stock map AND the pack union (the pack keys are a guess for a
126
+ // pack-specific loader; the DECL is the family's own statement);
127
+ // the provision-folder leg still rides when the family fetches
128
+ // the file itself.
129
+ for (const [key, home] of Object.entries(homes)) {
130
+ const raw = li[key];
131
+ const name = typeof raw === "string" ? raw.trim() : "";
132
+ if (name === "")
133
+ continue;
134
+ const probes = homeProbes(home, name);
135
+ const prov = (decl.provisions ?? []).find((p) => p.name === name.split("/").pop());
136
+ if (prov !== undefined && !probes.some(([f, n]) => f === prov.folder && n === name)) {
137
+ probes.push([prov.folder, name]);
138
+ }
139
+ if (probes.some(([folder, probeName]) => check(folder, probeName) !== null))
140
+ continue;
141
+ return { key, name, folders: probes.map(([f, n]) => f + " × " + n) };
142
+ }
93
143
  return null;
94
144
  }
95
145
  export function laneFilesStatus(decl, check = (folder, name) => checkModelPresent("models/" + folder, name)) {
96
146
  const li = (decl.lane_inputs ?? {});
97
- const hasRows = Object.keys(LANE_FOLDERS).some((key) => {
147
+ const homes = (decl.lane_homes ?? {});
148
+ const hasRows = [...Object.keys(LANE_FOLDERS), ...Object.keys(homes)].some((key) => {
98
149
  const raw = li[key];
99
150
  return typeof raw === "string" && raw.trim() !== "";
100
151
  });
@@ -110,6 +161,18 @@ export function lanePresenceMiss(fam) {
110
161
  const prov = (decl.provisions ?? []).find((p) => p.name === miss.name);
111
162
  return new CardArmError(400, "lane presence: family '" + fam + "' declares " + miss.key + " '" + miss.name +
112
163
  "' but no store copy exists (folders checked: " + miss.folders.join(", ") + ")" +
113
- (prov !== undefined ? " — fetch it: " + prov.url : ""), "lane_input_missing");
164
+ (prov !== undefined ? " — fetch it: " + prov.url : ""), "lane_input_missing", undefined, undefined, undefined,
165
+
166
+ // details carry the same facts the prose carries, so the
167
+ // client's missing-model popup keys its download action on
168
+ // fields, never on parsing this message.
169
+ {
170
+ family: fam,
171
+ slot: miss.key,
172
+ missing: miss.name,
173
+ folders: miss.folders,
174
+ ...(prov !== undefined ? { fetchUrl: prov.url } : {}),
175
+ kind: "model",
176
+ });
114
177
  }
115
178
  //# sourceMappingURL=cardsLanes.js.map
@@ -1,11 +1,13 @@
1
1
  import { Service } from "@deepseek-ai/cordis";
2
2
  import type { Context } from "@deepseek-ai/cordis";
3
- import type { CardDefinition, FactsReads } from "@melite/comfyui-cordis";
3
+ import type { FactsReads } from "@melite/comfyui-cordis";
4
+ import type { CardDefinition } from '@melite/comfyui-card-kit/card-definition';
5
+ import { RUNS_ERROR_CODES } from "./runsErrorCodes.js";
4
6
  export { CardArmError } from "./cardsArmError.js";
5
7
  import type { CardDeclRow, ModelFactsRow } from "./cardsFacts.js";
6
8
  export { selectCardVariant, stampCardOverlay, liftCardParams } from "./cardsVariant.js";
7
9
  export type { VariantSelection } from "./cardsVariant.js";
8
- export type { CardDeclRow, ModelFactsRow, VariantCellRow, VariantRow } from "./cardsFacts.js";
10
+ export type { CardDeclRow, ModelFactsRow, VariantCellRow, ResolvedVariantRow } from "./cardsFacts.js";
9
11
 
10
12
 
11
13
 
@@ -32,7 +34,28 @@ export declare const CARD_ENVELOPE_KEYS: readonly string[];
32
34
  * Exported for the wall (both arms pin: the face serves, the
33
35
  * unknown degrades to the id — never a throw into a serve). */
34
36
  export declare function familyFace(fam: string): string;
37
+ /** THE OUTPUT-RESOLUTION SEAM (round-22 compose audit Q4a,
38
+ * VALIDATE-RESOLVES-OUTPUTS): phase 2's def lookup + output
39
+ * resolution with the run seat's exact voices, shared by the run
40
+ * seat (phase2Card, thrown as CardArmError) and the validate seat
41
+ * (composeValidateCard, folded to its verdict). Validate composed
42
+ * the graph and discarded it, so every phase-2 output refusal
43
+ * answered validate-green/start-refuse on the binding cards; the
44
+ * seat resolves over its phase-1 graph now — same overlaid
45
+ * params, same graph, same refusal. Cards without bindings
46
+ * resolve vacuously (the resolver returns {}), so their seats
47
+ * answer exactly as before.
48
+ * @param defs the card definitions table
49
+ * @param card the card id (prepare already admitted it)
50
+ * @param params the prepared params (the overlaid truth both doors hold)
51
+ * @param graph the composed graph
52
+ */
53
+ export declare function resolveCardOutputsOrThrow(defs: ReadonlyMap<string, Pick<CardDefinition, "id" | "flowKinds" | "flowOutputBindings">>, card: string, params: Record<string, unknown>, graph: Record<string, unknown>): {
54
+ outputs: Record<string, string>;
55
+ outputNodes: Record<string, string>;
56
+ };
35
57
  export declare class CardRegistryService extends Service {
58
+ static inject: string[];
36
59
  /** The primed card definitions (null until prime()). */
37
60
  private defs;
38
61
  /** The frozen model facts (lazy — strict load, throws LOUD). */
@@ -48,9 +71,18 @@ export declare class CardRegistryService extends Service {
48
71
  * primeObjectInfo before any compose). null = not yet primed or
49
72
  * the engine is unreachable. */
50
73
  private oi;
74
+ /** The doc the process singleton was last armed with (the re-arm
75
+ * guard — auditor G's row: a weight landing changes the doc
76
+ * identity, and the singleton must follow it; an unchanged doc
77
+ * re-arms nothing). null = never armed (or a boot re-prime). */
78
+ private singletonArmedOi;
51
79
  /** The catalog existence set (lazy — strict load, throws LOUD). */
52
80
  private mids;
53
81
  constructor(ctx: Context);
82
+ /** The §23 manifest for the compose gate's dangling sweep (the
83
+ * ComposeSeat seam): one law from the queue seat — config-named
84
+ * roots, never the retired env seam (J12). */
85
+ stateRoots(): readonly string[];
54
86
  /** Prime the registry (service init — replaces the retired
55
87
  * primeCardRegistry()): the registry loads async (dynamic
56
88
  * card-module imports) but the validate/disclosure rims are sync,
@@ -61,6 +93,17 @@ export declare class CardRegistryService extends Service {
61
93
  * stay). The provider's apply primes, and both main.ts boot
62
94
  * sites re-prime belt-and-braces. */
63
95
  prime(): Promise<void>;
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+ private armSingletonFromDoc;
64
107
  /** Test seam: drop all registry state (walls boot fresh processes;
65
108
  * belt-and-braces for in-process reuse — the RunsService behavior). */
66
109
  resetForTests(): void;
@@ -104,6 +147,16 @@ export declare class CardRegistryService extends Service {
104
147
 
105
148
 
106
149
  modelMids(): Set<string>;
150
+ /** THE LANDING RE-ARM (the cards-plane batch's weight-landing row):
151
+ * every presence face (cardFamilies' present flags, admitModel's
152
+ * downloaded list) reads this.mids, and the cache froze at boot —
153
+ * a weight landed mid-process (provision_model, download_model,
154
+ * acquire_weight) served present:false until a reboot. This drops
155
+ * the cache; the NEXT read re-derives from the live scan order.
156
+ * The manage plane calls it on every model landing under a living
157
+ * process. No truth outside mids changes: facts/owners/defs are
158
+ * DECL-derived, and a landing moves files, not declarations. */
159
+ rearmWeights(): void;
107
160
  /** The owning family for mid: mid itself, or the facts model whose
108
161
  * variant/cell route owns mid (mirrors _route_family;
109
162
  * route-id-as-model is preserved — the graph is addressed by the
@@ -180,6 +233,39 @@ export declare class CardRegistryService extends Service {
180
233
 
181
234
 
182
235
 
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+ laneMigrate(card: string, params: Record<string, unknown>, priorParams: Record<string, unknown>): Record<string, unknown>;
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+ /** The lane verdict as its sentence (the write door's and the
259
+ * validate seat's currency — the class rides only where the run
260
+ * seat needs it, via laneVerdictDetailed). */
261
+ private laneVerdict;
262
+
263
+
264
+
265
+
266
+
267
+
268
+ private laneVerdictDetailed;
183
269
  /** The draft (model-less) row's verdict: the words EVERY boarded
184
270
  * declaring family states, judged over the raw params — the
185
271
  * intersection law (see the model-less branch above). Bounds
@@ -188,7 +274,7 @@ export declare class CardRegistryService extends Service {
188
274
  * verbatim. A card with no declaring family stays null (the
189
275
  * familyless tolerance). */
190
276
  private modellessDraftVerdict;
191
- private laneVerdict;
277
+ private laneVerdictCore;
192
278
 
193
279
 
194
280
 
@@ -231,9 +317,10 @@ export declare class CardRegistryService extends Service {
231
317
 
232
318
 
233
319
 
234
- composeValidateCard(card: string, fam: string, params: Record<string, unknown>, mid?: string, rawBody?: Record<string, unknown>): Promise<{
320
+
321
+ composeValidateCard(card: string, fam: string, params: Record<string, unknown>, mid?: string, rawBody?: Record<string, unknown>, factsArg?: Record<string, ModelFactsRow>): Promise<{
235
322
  message: string;
236
- code: string;
323
+ code: keyof typeof RUNS_ERROR_CODES;
237
324
  } | null>;
238
325
  /** Phase 1 (run_id ""): validates shape/admission/boarding before
239
326
  * registration. The $spell branch composes NO graph (the pool
@@ -263,6 +350,7 @@ declare module "@deepseek-ai/cordis" {
263
350
  * the app; this is what the estate composition mounts). */
264
351
  export declare const cardRegistryProvider: {
265
352
  name: string;
353
+ inject: string[];
266
354
  apply(ctx: Context): Promise<void>;
267
355
  };
268
356
  /** Resolve the service for request-path helpers that take it as an