@melite/estate-queue 0.1.4-alpha → 0.2.0-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 +55 -0
- package/lib/bench.d.ts +19 -11
- package/lib/bench.js +47 -57
- package/lib/cardsArmError.d.ts +94 -2
- package/lib/cardsArmError.js +34 -4
- package/lib/cardsCompose.d.ts +13 -1
- package/lib/cardsCompose.js +151 -67
- package/lib/cardsDangling.d.ts +2 -2
- package/lib/cardsDangling.js +82 -37
- package/lib/cardsFacts.d.ts +32 -3
- package/lib/cardsFacts.js +39 -1
- package/lib/cardsLanes.d.ts +62 -4
- package/lib/cardsLanes.js +407 -20
- package/lib/cardsLanesCopy.d.ts +21 -0
- package/lib/cardsLanesCopy.js +22 -0
- package/lib/cardsRegistry.d.ts +195 -10
- package/lib/cardsRegistry.js +959 -67
- package/lib/cardsVariant.d.ts +22 -8
- package/lib/cardsVariant.js +243 -52
- package/lib/discloseRegistry.d.ts +42 -11
- package/lib/discloseRegistry.js +163 -23
- package/lib/filmLead.js +5 -3
- package/lib/flowsData.d.ts +68 -13
- package/lib/flowsData.js +236 -107
- package/lib/flowsFamilyCompose.d.ts +5 -8
- package/lib/flowsFamilyCompose.js +25 -14
- package/lib/flowsParamsOverlay.d.ts +55 -0
- package/lib/flowsParamsOverlay.js +197 -0
- package/lib/flowsRegistryRows.d.ts +4 -1
- package/lib/flowsRegistryRows.js +325 -25
- package/lib/index.d.ts +1 -3
- package/lib/index.js +20 -5
- package/lib/lifecycleLatch.d.ts +16 -0
- package/lib/lifecycleLatch.js +42 -0
- package/lib/loadPlane.d.ts +3 -2
- package/lib/loadPlane.js +34 -8
- package/lib/loadRegistry.js +1 -1
- package/lib/manageOps.d.ts +8 -2
- package/lib/manageOps.js +28 -7
- package/lib/managePlane.d.ts +42 -1
- package/lib/managePlane.js +911 -101
- package/lib/managePreflight.d.ts +26 -0
- package/lib/managePreflight.js +179 -0
- package/lib/manageProbe.d.ts +15 -7
- package/lib/manageProbe.js +79 -8
- package/lib/manageRegistry.d.ts +42 -4
- package/lib/manageRegistry.js +45 -7
- package/lib/mediaKinds.d.ts +1 -1
- package/lib/mediaKinds.js +1 -1
- package/lib/queue.js +14 -10
- package/lib/queueCore.d.ts +21 -5
- package/lib/queueCore.js +22 -5
- package/lib/queueLifecycle.d.ts +0 -24
- package/lib/queueLifecycle.js +9 -63
- package/lib/queueLock.d.ts +8 -2
- package/lib/queueLock.js +9 -6
- package/lib/queueResurrect.d.ts +7 -2
- package/lib/queueResurrect.js +25 -6
- package/lib/queueSidecar.d.ts +114 -1
- package/lib/queueSidecar.js +178 -7
- package/lib/queueSubmit.d.ts +124 -10
- package/lib/queueSubmit.js +251 -48
- package/lib/queueSweep.js +13 -2
- package/lib/runsChange.d.ts +8 -0
- package/lib/runsChange.js +21 -5
- package/lib/runsErrorCodes.d.ts +1 -1
- package/lib/runsErrorCodes.js +35 -0
- package/lib/runsExecute.d.ts +26 -0
- package/lib/runsExecute.js +184 -6
- package/lib/runsGates.d.ts +5 -1
- package/lib/runsGates.js +10 -5
- package/lib/runsList.d.ts +43 -3
- package/lib/runsList.js +172 -58
- package/lib/runsRefusalVoices.js +101 -0
- package/lib/runsRegistry.d.ts +188 -12
- package/lib/runsRegistry.js +1233 -179
- package/lib/runsSourceEcho.d.ts +27 -0
- package/lib/runsSourceEcho.js +84 -18
- package/lib/runsStart.d.ts +80 -17
- package/lib/runsStart.js +303 -49
- package/lib/runsTypes.d.ts +62 -2
- package/lib/runsTypes.js +30 -6
- package/lib/runsValidateArms.js +61 -7
- package/lib/runsValidateServe.d.ts +2 -2
- package/lib/runsValidateServe.js +46 -14
- package/lib/runsValidateShared.d.ts +10 -1
- package/lib/runsValidateShared.js +14 -0
- package/lib/runsValidateStages.d.ts +10 -3
- package/lib/runsValidateStages.js +44 -12
- package/lib/runtimeProvision.d.ts +119 -0
- package/lib/runtimeProvision.js +243 -0
- package/lib/service.d.ts +24 -6
- package/lib/service.js +19 -11
- package/lib/skillFs.d.ts +9 -4
- package/lib/skillFs.js +12 -14
- package/lib/skillPlane.d.ts +3 -2
- package/lib/skillPlane.js +12 -6
- package/lib/skillRegistry.js +1 -1
- package/lib/skillRows.d.ts +4 -3
- package/lib/skillRows.js +21 -14
- package/lib/toolProjection.d.ts +1 -1
- package/lib/toolProjection.js +1 -1
- package/package.json +18 -17
- package/lib/runStatus.d.ts +0 -7
- package/lib/runStatus.js +0 -21
package/lib/cardsLanes.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import type { ModelDecl } from "@melite/comfyui-
|
|
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
|
|
@@ -21,13 +31,61 @@ export declare function lanePackFolders(): readonly string[];
|
|
|
21
31
|
|
|
22
32
|
|
|
23
33
|
|
|
24
|
-
export declare function lanePresenceRefusal(fam: string): CardArmError | null;
|
|
34
|
+
export declare function lanePresenceRefusal(fam: string, body?: Record<string, unknown>, mid?: string): CardArmError | null;
|
|
25
35
|
|
|
26
36
|
|
|
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;
|
|
31
|
-
|
|
40
|
+
export declare function laneFilesStatus(decl: Pick<ModelDecl, "lane_inputs" | "provisions" | "snapshot_provisions" | "lane_homes">, check?: LaneCheck): boolean | null;
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
export declare function statedCellRow(variant: ModelDecl["variants"][number] | undefined, body: Record<string, unknown> | undefined, mid: string | undefined): ModelDecl["variants"][number]["cells"][number] | undefined;
|
|
54
|
+
/** A resolved fetch anchor for one lane miss: the URL the operator
|
|
55
|
+
* can download the weight from, plus the declared size when the
|
|
56
|
+
* channel states one. */
|
|
57
|
+
export interface LaneFetchAnchor {
|
|
58
|
+
readonly url: string;
|
|
59
|
+
readonly sizeBytes?: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
/** The seat rows the anchor resolver reads: the stated variant row
|
|
84
|
+
* (never carries an artifact) and the stated cell row (the artifact
|
|
85
|
+
* carrier) — the same indexed shapes statedVariantRow/statedCellRow
|
|
86
|
+
* return. */
|
|
87
|
+
export type LaneFetchSeat = ModelDecl["variants"][number] | ModelDecl["variants"][number]["cells"][number] | undefined;
|
|
88
|
+
export declare function laneFetchAnchor(decl: Pick<ModelDecl, "provisions" | "snapshot_provisions" | "variants">, seats: ReadonlyArray<LaneFetchSeat>, name: string): LaneFetchAnchor | undefined;
|
|
89
|
+
export declare function lanePresenceMiss(fam: string, body?: Record<string, unknown>, mid?: string): CardArmError | null;
|
|
32
90
|
export {};
|
|
33
91
|
//# sourceMappingURL=cardsLanes.d.ts.map
|
package/lib/cardsLanes.js
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
// Extracted from cardsRegistry: which families have a live lane on
|
|
3
3
|
// disk (the packs the compose arm refuses without).
|
|
4
4
|
import { checkModelPresent, getModel, loadEndpointConfig } from "@melite/comfyui-cordis";
|
|
5
|
+
import { LIVE_ACQUIRE_STATES, provisioningSeat } from "@melite/estate-provisioning";
|
|
6
|
+
import { resolveCellRow } from "@melite/contracts/laneRelations";
|
|
7
|
+
import { engineOutputDir, engineRootOf, resolveRuntimeHome, runtimeEnvView, sentinelHit } from "./runtimeProvision.js";
|
|
8
|
+
import { hashPhaseWordOf, laneVoice } from "./cardsLanesCopy.js";
|
|
5
9
|
import { CardArmError } from "./cardsArmError.js";
|
|
6
10
|
|
|
7
11
|
// The operator's alarm: "If Img Gen works and Img Edit doesn't,
|
|
@@ -11,22 +15,29 @@ import { CardArmError } from "./cardsArmError.js";
|
|
|
11
15
|
// (checkModelPresent) but nothing in the run path consulted it —
|
|
12
16
|
// Img Gen worked because its weights happened to be on disk, Img
|
|
13
17
|
// Edit died at ComfyUI validation with the reason swallowed by the
|
|
14
|
-
// UI. Presence is now ENFORCED at phase-1 for
|
|
15
|
-
//
|
|
16
|
-
// the
|
|
17
|
-
//
|
|
18
|
+
// UI. Presence is now ENFORCED at phase-1 for every FAMILY-BACKED
|
|
19
|
+
// card run (familyless units and declaration-only lane keys —
|
|
20
|
+
// keys outside the map below — are excluded on purpose, see the
|
|
21
|
+
// LANE_FOLDERS note), one gate, one voice — the refusal names the
|
|
22
|
+
// family, the lane key, the missing file, the folders checked, and
|
|
23
|
+
// the provision URL when the family declares one (the fetch hint).
|
|
18
24
|
/** lane_inputs keys that name FILES the stock loaders read, mapped
|
|
19
25
|
* to their ComfyUI folder sets (text_encoders folds legacy clip;
|
|
20
|
-
* unet folds diffusion_models
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
|
|
26
|
+
* unet folds diffusion_models; loras is the LoraLoaderModelOnly
|
|
27
|
+
* root — a family's default-bag distill rides it). Keys absent here
|
|
28
|
+
* are declaration-only — model_path/texture_vae ride pack-specific
|
|
29
|
+
* loaders whose folders the estate cannot name without inventing a
|
|
30
|
+
* mapping; those slots are judged through the DECL's own
|
|
31
|
+
* `lane_homes` row (the declared-home loop below), which replaces
|
|
32
|
+
* this map and the pack union for its slot. */
|
|
33
|
+
export const LANE_FOLDERS = {
|
|
24
34
|
text_encoder: ["text_encoders", "clip"],
|
|
25
35
|
vae: ["vae"],
|
|
26
36
|
unet: ["unet", "diffusion_models"],
|
|
27
37
|
checkpoint: ["checkpoints"],
|
|
28
38
|
clip_vision: ["clip_vision"],
|
|
29
39
|
background_removal: ["background_removal"],
|
|
40
|
+
loras: ["loras"],
|
|
30
41
|
};
|
|
31
42
|
/** The endpoint's pack categories (extra_model_folders keys) — the
|
|
32
43
|
* custom-node weight homes (SEEDVR2, anny, …). A lane file may
|
|
@@ -62,21 +73,66 @@ export function lanePackFolders() {
|
|
|
62
73
|
|
|
63
74
|
|
|
64
75
|
|
|
65
|
-
export function lanePresenceRefusal(fam) {
|
|
76
|
+
export function lanePresenceRefusal(fam, body, mid) {
|
|
66
77
|
const sandbox = process.env["INFERENCE_TEST_SANDBOX"] ?? "";
|
|
67
78
|
const envPath = process.env["COMFYUI_ENDPOINT_CONFIG"] ?? "";
|
|
68
79
|
if (sandbox !== "" && envPath === "")
|
|
69
80
|
return null;
|
|
70
81
|
// the refusal is a THROW, never a value (phase1Card's pinned
|
|
71
82
|
// contract — no return-value arm there)
|
|
72
|
-
const miss = lanePresenceMiss(fam);
|
|
83
|
+
const miss = lanePresenceMiss(fam, body, mid);
|
|
73
84
|
if (miss !== null)
|
|
74
85
|
throw miss;
|
|
75
86
|
return null;
|
|
76
87
|
}
|
|
77
|
-
|
|
78
|
-
|
|
88
|
+
/** The store spellings one declared home probes for one lane
|
|
89
|
+
* value. The value may carry a loader-side subpath
|
|
90
|
+
* ("qwen3-tts/hf/Qwen3-TTS-…-Base" under the qwen3_tts key) or be
|
|
91
|
+
* a bare name ("sam_vit_b_01ec64.pth" under sams) — both spellings
|
|
92
|
+
* ride findModelPresent's exact join, so both are probed. */
|
|
93
|
+
function homeProbes(home, name) {
|
|
94
|
+
const probes = [[home, name]];
|
|
95
|
+
const cut = name.lastIndexOf("/");
|
|
96
|
+
if (cut > 0)
|
|
97
|
+
probes.push([home + "/" + name.slice(0, cut), name.slice(cut + 1)]);
|
|
98
|
+
return probes;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
function laneMisses(decl, check, variantRow, cellRow) {
|
|
109
|
+
// THE VARIANT-LANE PRESENCE LAW (h¹ remainder — the one-parameter
|
|
110
|
+
// switch): the probe judges the RESOLVED lane inputs — the family's
|
|
111
|
+
// rows under the STATED variant's per-key override (the same merge
|
|
112
|
+
// the compose stamps; a variant that does not override a key leaves
|
|
113
|
+
// the family's row gating). A family-only probe green-lit a variant
|
|
114
|
+
// whose own file never existed (the Singularity burn: the family's
|
|
115
|
+
// timeline unet present, the override's 20 GB never fetched).
|
|
116
|
+
const li = {
|
|
117
|
+
...(decl.lane_inputs ?? {}),
|
|
118
|
+
...(variantRow?.lane_inputs ?? {}),
|
|
119
|
+
|
|
120
|
+
// the STATED cell's rows fold in last — the same per-key
|
|
121
|
+
// precedence the compose stamps (the derived route read folds
|
|
122
|
+
// atom → variant → CELL, comfyui-cordis service.ts getModel) and
|
|
123
|
+
// the client mirror's resolvedLaneSurface rides (the ONE
|
|
124
|
+
// RESOLVER's coordinate, never a second spelling). A family whose
|
|
125
|
+
// weight tiers live only at variants[].cells (qwen-img-21 /
|
|
126
|
+
// qwen-img-edit-21's bf16+turbo unets, qwen3-tts's per-size
|
|
127
|
+
// model_path) gated the DEFAULT tier's files for every stated
|
|
128
|
+
// coordinate — the burn: a missing stated-cell weight sailed the
|
|
129
|
+
// presence gate straight into the engine's validation.
|
|
130
|
+
...(cellRow?.lane_inputs ?? {}),
|
|
131
|
+
};
|
|
132
|
+
const homes = (decl.lane_homes ?? {});
|
|
79
133
|
const packs = lanePackFolders();
|
|
134
|
+
const misses = [];
|
|
135
|
+
const seen = new Set();
|
|
80
136
|
for (const [key, stock] of Object.entries(LANE_FOLDERS)) {
|
|
81
137
|
const raw = li[key];
|
|
82
138
|
const name = typeof raw === "string" ? raw.trim() : "";
|
|
@@ -86,15 +142,75 @@ function firstLaneMiss(decl, check) {
|
|
|
86
142
|
...stock,
|
|
87
143
|
...packs.filter((p) => !stock.includes(p)),
|
|
88
144
|
];
|
|
145
|
+
|
|
146
|
+
// lands where its own row says — loras land in loras/h3, not the
|
|
147
|
+
// stock root — so the row's folder is the last folder probed and
|
|
148
|
+
// the refusal names it. One truth: the provision row owns the
|
|
149
|
+
// file's home; no second subfolder mapping lives here.
|
|
150
|
+
const prov = (decl.provisions ?? []).find((p) => p.name === name);
|
|
151
|
+
if (prov !== undefined && !folders.includes(prov.folder))
|
|
152
|
+
folders.push(prov.folder);
|
|
89
153
|
if (folders.some((folder) => check(folder, name) !== null))
|
|
90
154
|
continue;
|
|
91
|
-
|
|
155
|
+
const dedupe = key + " " + name;
|
|
156
|
+
if (!seen.has(dedupe)) {
|
|
157
|
+
seen.add(dedupe);
|
|
158
|
+
misses.push({ key, name, folders });
|
|
159
|
+
}
|
|
92
160
|
}
|
|
93
|
-
|
|
161
|
+
|
|
162
|
+
// model_path/texture_vae name files whose loader is pack-specific
|
|
163
|
+
// — the estate cannot name their folders without inventing a map,
|
|
164
|
+
// so the DECL does (lane_homes). The declared home replaces the
|
|
165
|
+
// stock map AND the pack union (the pack keys are a guess for a
|
|
166
|
+
// pack-specific loader; the DECL is the family's own statement);
|
|
167
|
+
// the provision-folder leg still rides when the family fetches
|
|
168
|
+
// the file itself.
|
|
169
|
+
for (const [key, home] of Object.entries(homes)) {
|
|
170
|
+
const raw = li[key];
|
|
171
|
+
const name = typeof raw === "string" ? raw.trim() : "";
|
|
172
|
+
if (name === "")
|
|
173
|
+
continue;
|
|
174
|
+
const probes = homeProbes(home, name);
|
|
175
|
+
const prov = (decl.provisions ?? []).find((p) => p.name === name.split("/").pop());
|
|
176
|
+
if (prov !== undefined && !probes.some(([f, n]) => f === prov.folder && n === name)) {
|
|
177
|
+
probes.push([prov.folder, name]);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// a loader-side subpath ("qwen3-tts/hf/…-Base" — the C++ load
|
|
181
|
+
// gate reads it relative to the AUDIO pack root, transcript-014)
|
|
182
|
+
// double-joins under its lane_homes key (the qwen3_tts extras
|
|
183
|
+
// map already descends into audio/qwen3-tts/hf), so the home
|
|
184
|
+
// probes can never hit a present tree. The snapshot row owns
|
|
185
|
+
// the placement truth (folder + bare name — the same anchor
|
|
186
|
+
// probe the provisioning plane's presence rides), so it probes
|
|
187
|
+
// as its own (folder, name) pair, never re-suffixed.
|
|
188
|
+
const base = name.split("/").pop() ?? name;
|
|
189
|
+
const snap = (decl.snapshot_provisions ?? []).find((s) => s.name === base && typeof s.folder === "string" && s.folder !== "");
|
|
190
|
+
if (snap !== undefined &&
|
|
191
|
+
!probes.some(([f, n]) => f === snap.folder && (n === name || n === snap.name))) {
|
|
192
|
+
probes.push([snap.folder, snap.name]);
|
|
193
|
+
}
|
|
194
|
+
if (probes.some(([folder, probeName]) => check(folder, probeName) !== null))
|
|
195
|
+
continue;
|
|
196
|
+
const dedupe = key + " " + name;
|
|
197
|
+
if (!seen.has(dedupe)) {
|
|
198
|
+
seen.add(dedupe);
|
|
199
|
+
misses.push({ key, name, folders: probes.map(([f, n]) => f + " × " + n) });
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return misses;
|
|
203
|
+
}
|
|
204
|
+
/** The first miss — the presence boolean's own leg (laneFilesStatus)
|
|
205
|
+
* and the refusal's LEAD row. The whole list rides beside it
|
|
206
|
+
* (laneMisses → the refusal's missingAll). */
|
|
207
|
+
function firstLaneMiss(decl, check, variantRow) {
|
|
208
|
+
return laneMisses(decl, check, variantRow)[0] ?? null;
|
|
94
209
|
}
|
|
95
210
|
export function laneFilesStatus(decl, check = (folder, name) => checkModelPresent("models/" + folder, name)) {
|
|
96
211
|
const li = (decl.lane_inputs ?? {});
|
|
97
|
-
const
|
|
212
|
+
const homes = (decl.lane_homes ?? {});
|
|
213
|
+
const hasRows = [...Object.keys(LANE_FOLDERS), ...Object.keys(homes)].some((key) => {
|
|
98
214
|
const raw = li[key];
|
|
99
215
|
return typeof raw === "string" && raw.trim() !== "";
|
|
100
216
|
});
|
|
@@ -102,14 +218,285 @@ export function laneFilesStatus(decl, check = (folder, name) => checkModelPresen
|
|
|
102
218
|
return null;
|
|
103
219
|
return firstLaneMiss(decl, check) === null;
|
|
104
220
|
}
|
|
105
|
-
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
function runtimeLegMiss(decl, fam, body) {
|
|
243
|
+
const rt = decl.runtime;
|
|
244
|
+
if (rt === undefined)
|
|
245
|
+
return null;
|
|
246
|
+
const stated = body?.[rt.consuming_param];
|
|
247
|
+
if (typeof stated !== "string" || stated.trim() === "")
|
|
248
|
+
return null;
|
|
249
|
+
const root = engineRootOf();
|
|
250
|
+
if (root === null)
|
|
251
|
+
return null;
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
// walk-up — a deliberately stated path is right far more often
|
|
255
|
+
// than a blind walk is. The known split (an override valid in the
|
|
256
|
+
// LANE's env but absent from the ENGINE's own env) then passes the
|
|
257
|
+
// gate and burns at the engine — but that burn is FACED (the
|
|
258
|
+
// post-hoc runtime banner voices the same provision + env, and the
|
|
259
|
+
// provision_runtime verb answers it), never silent. The alternative
|
|
260
|
+
// (distrusting a stated-valid path) would false-refuse managed
|
|
261
|
+
// deployments whose override points outside any walk-up tree —
|
|
262
|
+
// blocking good work is worse than facing a bad run.
|
|
263
|
+
const override = runtimeEnvView(rt.env);
|
|
264
|
+
if (override.value !== "") {
|
|
265
|
+
if (rt.sentinel.every((s) => sentinelHit(override.value, s)))
|
|
266
|
+
return null;
|
|
267
|
+
return runtimeRefusal(fam, rt, [override.value]);
|
|
268
|
+
}
|
|
269
|
+
const start = engineOutputDir(root);
|
|
270
|
+
const home = resolveRuntimeHome(start, rt);
|
|
271
|
+
if (home !== null)
|
|
272
|
+
return null;
|
|
273
|
+
return runtimeRefusal(fam, rt, [start]);
|
|
274
|
+
}
|
|
275
|
+
/** The press-time runtime refusal: the engine-voiced sentence the
|
|
276
|
+
* E2 parser anchors on (run-rescue-core.ts THE RUNTIME-MISS
|
|
277
|
+
* VOICE) — `<name> runtime not found at <path>. Provision it:
|
|
278
|
+
* <cmd>. Or point <ENV> at an existing runtime.` — plus the
|
|
279
|
+
* lanes.env hatch. Deliberately NOT the "lane presence:" prefix:
|
|
280
|
+
* that voice is the model leg's anchor (weight extensions), and
|
|
281
|
+
* this sentence must fall through to the runtime arm, never be
|
|
282
|
+
* claimed by it. */
|
|
283
|
+
function runtimeRefusal(fam, rt, checked) {
|
|
284
|
+
return new CardArmError(400, "family '" + fam + "' declares runtime '" + rt.name + "' (" + rt.consuming_param + " stated) but no " +
|
|
285
|
+
"provisioned copy exists — " + rt.name + " runtime not found at " + checked[0] + ". Provision it: " +
|
|
286
|
+
rt.command + ". Or point " + rt.env + " at an existing runtime. If " + rt.env + " is set for the " +
|
|
287
|
+
"engine but the lane cannot see it, export it in lanes.env and restart the lane. (walk-up from " +
|
|
288
|
+
checked[0] + " for " + rt.rel.join("/") + " found no copy holding " + rt.sentinel.join(", ") + ")", "lane_input_missing", undefined, undefined, undefined, {
|
|
289
|
+
family: fam,
|
|
290
|
+
slot: rt.consuming_param,
|
|
291
|
+
missing: rt.name,
|
|
292
|
+
folders: [...checked],
|
|
293
|
+
kind: "runtime",
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
/** THE IN-FLIGHT READ (the run gate's seat query — the provisioning
|
|
297
|
+
* service's operation read, wired through the process seat the way
|
|
298
|
+
* the models seat's namespace arms the models table): the LIVE
|
|
299
|
+
* acquire row for one family, null when no seat is mounted in this
|
|
300
|
+
* process, no acquisition runs for the family, or the row already
|
|
301
|
+
* settled (a settled row is the rescue verbs' story — the idle miss's
|
|
302
|
+
* own voice stands for it, and its fresh-fetch hint is then true).
|
|
303
|
+
* The read keys the family ref the acquire door itself starts
|
|
304
|
+
* (owner family, no variant/quant), so the gate sees exactly the
|
|
305
|
+
* operation the manage seat's Download press minted. */
|
|
306
|
+
function acquireInFlight(fam) {
|
|
307
|
+
const progress = provisioningSeat()?.progressOfRef({ kind: "model", owner: "family", id: fam }) ?? null;
|
|
308
|
+
if (progress === null)
|
|
309
|
+
return null;
|
|
310
|
+
return LIVE_ACQUIRE_STATES.has(progress.state) ? progress : null;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
function inFlightFraction(progress) {
|
|
320
|
+
const fraction = progress.total <= 0
|
|
321
|
+
? "total undeclared"
|
|
322
|
+
: String(Math.floor((progress.bytes * 100) / progress.total)) + "%";
|
|
323
|
+
return laneVoice.inFlightFraction({ fraction, phaseWord: hashPhaseWordOf(progress) });
|
|
324
|
+
}
|
|
325
|
+
/** THE STATED VARIANT'S ROW (the same derivation the compose
|
|
326
|
+
* stamps, over the DECL's own rows — the facts fold drops
|
|
327
|
+
* lane_inputs): a stated body.variant wins (id match), else the
|
|
328
|
+
* ADDRESS's own row (route/id/cell-route/resolver model — a bare
|
|
329
|
+
* route pick composes that route's defaults), else undefined (the
|
|
330
|
+
* family default: no override, the family rows gate alone). */
|
|
331
|
+
function statedVariantRow(decl, body, mid) {
|
|
332
|
+
const variants = decl.variants ?? [];
|
|
333
|
+
const stated = typeof body?.["variant"] === "string" && body["variant"].trim() !== ""
|
|
334
|
+
? body["variant"].trim()
|
|
335
|
+
: "";
|
|
336
|
+
if (stated !== "") {
|
|
337
|
+
const row = variants.find((v) => v.id === stated || v.route === stated);
|
|
338
|
+
if (row !== undefined)
|
|
339
|
+
return row;
|
|
340
|
+
}
|
|
341
|
+
if (mid === undefined || mid === "")
|
|
342
|
+
return undefined;
|
|
343
|
+
return variants.find((v) => v.route === mid || v.id === mid
|
|
344
|
+
|| (v.cells ?? []).some((c) => c.route === mid)
|
|
345
|
+
|| v.resolver_defaults?.["model"] === mid);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
export function statedCellRow(variant, body, mid) {
|
|
360
|
+
if (variant === undefined)
|
|
361
|
+
return undefined;
|
|
362
|
+
const raw = body?.["quant"];
|
|
363
|
+
const stated = typeof raw === "string" && raw !== "native" ? raw : null;
|
|
364
|
+
// the explicit cell type: the resolver's generic erases to its
|
|
365
|
+
// constraint (ResolverCellRow) — the runtime row IS the DECL cell
|
|
366
|
+
const res = resolveCellRow(variant, stated, mid ?? "", "offered");
|
|
367
|
+
return res.status === "resolved" ? (res.cell ?? undefined) : undefined;
|
|
368
|
+
}
|
|
369
|
+
export function laneFetchAnchor(decl, seats, name) {
|
|
370
|
+
// 1. the family's own provisions row — the loaded-identity rule
|
|
371
|
+
// (full name or basename, the registration law's spelling)
|
|
372
|
+
const base = name.split("/").pop() ?? name;
|
|
373
|
+
const prov = (decl.provisions ?? []).find((p) => p.name === name || p.name === base);
|
|
374
|
+
if (prov !== undefined) {
|
|
375
|
+
return { url: prov.url, ...(prov.size_bytes !== undefined ? { sizeBytes: prov.size_bytes } : {}) };
|
|
376
|
+
}
|
|
377
|
+
// 2. the stated cell/variant artifact — the source_url's basename is
|
|
378
|
+
// the lane file's name (the cell's own spelling, krea-2/qwen law);
|
|
379
|
+
// only the cell row declares an artifact member
|
|
380
|
+
for (const seat of seats) {
|
|
381
|
+
if (seat === undefined || !("artifact" in seat))
|
|
382
|
+
continue;
|
|
383
|
+
const artifact = seat.artifact;
|
|
384
|
+
const url = artifact?.source_url;
|
|
385
|
+
if (typeof url === "string" && url.length > 0 && (url.split("/").pop() ?? "") === base) {
|
|
386
|
+
const size = artifact?.size_bytes;
|
|
387
|
+
return { url, ...(typeof size === "number" ? { sizeBytes: size } : {}) };
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
// 2.5 THE FAMILY-WIDE ARTIFACT FALLBACK (the shared-weight law): a
|
|
391
|
+
// weight many coordinates ride (the family default unet under a
|
|
392
|
+
// lora variant) declares its channel ONCE — on the OWNING cell's
|
|
393
|
+
// artifact row. The basename is the file identity: any cell's
|
|
394
|
+
// artifact with that basename is a true URL for the missing
|
|
395
|
+
// weight, exactly what the provisioner fetches. Refusing to say
|
|
396
|
+
// it (the seat-only lookup) is the kroma class wearing a
|
|
397
|
+
// different coat — a URL exists, the press reports a bare miss.
|
|
398
|
+
for (const variant of decl.variants ?? []) {
|
|
399
|
+
for (const cell of variant.cells) {
|
|
400
|
+
const url = cell.artifact?.source_url;
|
|
401
|
+
if (typeof url === "string" && url.length > 0 && (url.split("/").pop() ?? "") === base) {
|
|
402
|
+
const size = cell.artifact?.size_bytes;
|
|
403
|
+
return { url, ...(typeof size === "number" ? { sizeBytes: size } : {}) };
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
// 3. the snapshot tree — the repo link anchors the fetch AT ITS
|
|
408
|
+
|
|
409
|
+
// omitted the pin — the fetcher's coordinate is the tree, not the
|
|
410
|
+
// moving default branch; the refusal names repo@revision)
|
|
411
|
+
const snap = (decl.snapshot_provisions ?? []).find((s) => s.name === base);
|
|
412
|
+
if (snap !== undefined) {
|
|
413
|
+
return { url: "https://huggingface.co/" + snap.repo_id + "/tree/" + snap.revision };
|
|
414
|
+
}
|
|
415
|
+
return undefined;
|
|
416
|
+
}
|
|
417
|
+
export function lanePresenceMiss(fam, body, mid) {
|
|
106
418
|
const decl = getModel(fam);
|
|
107
|
-
const
|
|
419
|
+
const check = (folder, name) => checkModelPresent("models/" + folder, name);
|
|
420
|
+
const variantRow = statedVariantRow(decl, body, mid);
|
|
421
|
+
const cellRow = statedCellRow(variantRow, body, mid);
|
|
422
|
+
const misses = laneMisses(decl, check, variantRow, cellRow);
|
|
423
|
+
const miss = misses[0] ?? null;
|
|
108
424
|
if (miss === null)
|
|
109
|
-
return
|
|
110
|
-
|
|
425
|
+
return runtimeLegMiss(decl, fam, body);
|
|
426
|
+
// THE IN-FLIGHT LEG (ERRORS.md k2 — NEVER-RUN-ON-INCOMPLETE): a
|
|
427
|
+
// miss whose file is landing RIGHT NOW is not the idle story. The
|
|
428
|
+
// refusal voices the acquisition (the operation and its live
|
|
429
|
+
// fraction, real landed bytes over the DECL total), carries the
|
|
430
|
+
// structured row beside the lane miss, and DROPS the fresh-fetch
|
|
431
|
+
// hint — "fetch it: <url>" while a fetch runs is what re-pops the
|
|
432
|
+
// download loop the burn names.
|
|
433
|
+
const inFlight = acquireInFlight(fam);
|
|
434
|
+
if (inFlight !== null) {
|
|
435
|
+
return new CardArmError(400, "lane presence: family '" + fam + "' declares " + miss.key + " '" + miss.name +
|
|
436
|
+
"' — acquisition in flight (" + inFlightFraction(inFlight) + "): operation " +
|
|
437
|
+
inFlight.operationId + ", " + String(inFlight.bytes) + "/" + String(inFlight.total) +
|
|
438
|
+
" bytes landed — the run refuses until the weight is on the store", "lane_input_missing", undefined, undefined, undefined,
|
|
439
|
+
// the lane miss stands WITHOUT its fetchUrl (no fresh-fetch
|
|
440
|
+
// hint): the popup keys its face on fields and finds no
|
|
441
|
+
// download offer to double-press
|
|
442
|
+
{
|
|
443
|
+
family: fam,
|
|
444
|
+
slot: miss.key,
|
|
445
|
+
missing: miss.name,
|
|
446
|
+
folders: miss.folders,
|
|
447
|
+
kind: "model",
|
|
448
|
+
}, {
|
|
449
|
+
acquire_in_flight: true,
|
|
450
|
+
operation_id: inFlight.operationId,
|
|
451
|
+
bytes: inFlight.bytes,
|
|
452
|
+
total: inFlight.total,
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
// THE ONE-FACE LIST (the sequential-missing-weight-reveal cure,
|
|
456
|
+
|
|
457
|
+
// anchor byte-exact; the WHOLE miss list rides after it (prose)
|
|
458
|
+
// and inside the structured row (missingAll) — the operator learns
|
|
459
|
+
// of the vae in the refusal that names the text encoder, with the
|
|
460
|
+
// DECL's declared size per file, never one wedged run later.
|
|
461
|
+
|
|
462
|
+
// row's anchor resolves through laneFetchAnchor — the cascade's
|
|
463
|
+
// own channels (provisions, the stated cell/variant artifact, the
|
|
464
|
+
// snapshot repo), NEVER provisions alone. The wall
|
|
465
|
+
// (variant-linkability ARM 4) walks this exact builder over an
|
|
466
|
+
// empty store and reds any declared weight the door cannot anchor.
|
|
467
|
+
const rows = misses.map((m) => {
|
|
468
|
+
const anchor = laneFetchAnchor(decl, [variantRow, cellRow], m.name);
|
|
469
|
+
return {
|
|
470
|
+
slot: m.key,
|
|
471
|
+
name: m.name,
|
|
472
|
+
folders: m.folders,
|
|
473
|
+
...(anchor?.sizeBytes !== undefined ? { sizeBytes: anchor.sizeBytes } : {}),
|
|
474
|
+
...(anchor !== undefined ? { fetchUrl: anchor.url } : {}),
|
|
475
|
+
};
|
|
476
|
+
});
|
|
477
|
+
const listVoice = misses.length > 1
|
|
478
|
+
? "; the run declares " + String(misses.length) + " missing files — " +
|
|
479
|
+
misses.map((m) => {
|
|
480
|
+
const anchor = laneFetchAnchor(decl, [variantRow, cellRow], m.name);
|
|
481
|
+
return m.key + " '" + m.name + "'" + (anchor !== undefined ? " — fetch it: " + anchor.url : "");
|
|
482
|
+
}).join("; ")
|
|
483
|
+
: "";
|
|
111
484
|
return new CardArmError(400, "lane presence: family '" + fam + "' declares " + miss.key + " '" + miss.name +
|
|
112
485
|
"' but no store copy exists (folders checked: " + miss.folders.join(", ") + ")" +
|
|
113
|
-
(
|
|
486
|
+
(rows[0]?.fetchUrl !== undefined ? " — fetch it: " + rows[0].fetchUrl : "") +
|
|
487
|
+
listVoice, "lane_input_missing", undefined, undefined, undefined,
|
|
488
|
+
|
|
489
|
+
// details carry the same facts the prose carries, so the
|
|
490
|
+
// client's missing-model popup keys its download action on
|
|
491
|
+
// fields, never on parsing this message.
|
|
492
|
+
{
|
|
493
|
+
family: fam,
|
|
494
|
+
slot: miss.key,
|
|
495
|
+
missing: miss.name,
|
|
496
|
+
folders: miss.folders,
|
|
497
|
+
...(rows[0]?.fetchUrl !== undefined ? { fetchUrl: rows[0].fetchUrl } : {}),
|
|
498
|
+
...(rows.length > 1 ? { missingAll: rows } : {}),
|
|
499
|
+
kind: "model",
|
|
500
|
+
});
|
|
114
501
|
}
|
|
115
502
|
//# sourceMappingURL=cardsLanes.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { WeightAcquireProgress } from "@melite/estate-provisioning";
|
|
2
|
+
export declare const laneVoice: {
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
hashingWord: string;
|
|
8
|
+
/** The live fraction's composition: the fraction itself, joined
|
|
9
|
+
* with the live phase word when one is named — never a bare
|
|
10
|
+
* frozen percent mid-hash. */
|
|
11
|
+
inFlightFraction: (p: {
|
|
12
|
+
fraction: string;
|
|
13
|
+
phaseWord?: string;
|
|
14
|
+
}) => string;
|
|
15
|
+
};
|
|
16
|
+
/** The row's hash-phase word, undefined when the row is not hashing:
|
|
17
|
+
* the live phase names the hash ('verify', or a present file's
|
|
18
|
+
* 'recheck'), and — on rows seeded before the phase law — the state
|
|
19
|
+
* word 'verifying' says it alone. */
|
|
20
|
+
export declare function hashPhaseWordOf(progress: WeightAcquireProgress): string | undefined;
|
|
21
|
+
//# sourceMappingURL=cardsLanesCopy.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const laneVoice = {
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
hashingWord: "hashing",
|
|
7
|
+
/** The live fraction's composition: the fraction itself, joined
|
|
8
|
+
* with the live phase word when one is named — never a bare
|
|
9
|
+
* frozen percent mid-hash. */
|
|
10
|
+
inFlightFraction: (p) => p.phaseWord === undefined ? p.fraction : p.fraction + " · " + p.phaseWord,
|
|
11
|
+
};
|
|
12
|
+
/** The row's hash-phase word, undefined when the row is not hashing:
|
|
13
|
+
* the live phase names the hash ('verify', or a present file's
|
|
14
|
+
* 'recheck'), and — on rows seeded before the phase law — the state
|
|
15
|
+
* word 'verifying' says it alone. */
|
|
16
|
+
export function hashPhaseWordOf(progress) {
|
|
17
|
+
const hashing = progress.phase === "verify"
|
|
18
|
+
|| progress.phase === "recheck"
|
|
19
|
+
|| progress.state === "verifying";
|
|
20
|
+
return hashing ? laneVoice.hashingWord : undefined;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=cardsLanesCopy.js.map
|