@melite/estate-queue 0.1.5-pre-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.
Files changed (61) hide show
  1. package/LICENSE +561 -457
  2. package/lib/cardsArmError.d.ts +52 -3
  3. package/lib/cardsArmError.js +7 -1
  4. package/lib/cardsCompose.js +43 -7
  5. package/lib/cardsFacts.d.ts +16 -0
  6. package/lib/cardsFacts.js +25 -1
  7. package/lib/cardsLanes.d.ts +51 -3
  8. package/lib/cardsLanes.js +337 -13
  9. package/lib/cardsLanesCopy.d.ts +21 -0
  10. package/lib/cardsLanesCopy.js +22 -0
  11. package/lib/cardsRegistry.d.ts +102 -5
  12. package/lib/cardsRegistry.js +668 -45
  13. package/lib/cardsVariant.d.ts +12 -7
  14. package/lib/cardsVariant.js +196 -58
  15. package/lib/discloseRegistry.d.ts +36 -6
  16. package/lib/discloseRegistry.js +153 -15
  17. package/lib/filmLead.js +5 -3
  18. package/lib/flowsData.d.ts +1 -1
  19. package/lib/flowsData.js +7 -4
  20. package/lib/flowsFamilyCompose.js +12 -1
  21. package/lib/flowsRegistryRows.d.ts +1 -0
  22. package/lib/flowsRegistryRows.js +193 -35
  23. package/lib/index.d.ts +1 -0
  24. package/lib/index.js +6 -0
  25. package/lib/loadPlane.js +9 -0
  26. package/lib/manageOps.js +2 -1
  27. package/lib/managePlane.d.ts +11 -1
  28. package/lib/managePlane.js +559 -24
  29. package/lib/managePreflight.d.ts +26 -0
  30. package/lib/managePreflight.js +179 -0
  31. package/lib/manageProbe.d.ts +17 -0
  32. package/lib/manageProbe.js +61 -1
  33. package/lib/queueCore.d.ts +14 -1
  34. package/lib/queueCore.js +13 -0
  35. package/lib/queueResurrect.d.ts +7 -2
  36. package/lib/queueResurrect.js +25 -6
  37. package/lib/queueSidecar.d.ts +110 -1
  38. package/lib/queueSidecar.js +177 -7
  39. package/lib/queueSubmit.d.ts +67 -4
  40. package/lib/queueSubmit.js +133 -4
  41. package/lib/runsErrorCodes.js +5 -3
  42. package/lib/runsExecute.js +44 -4
  43. package/lib/runsGates.d.ts +5 -1
  44. package/lib/runsGates.js +6 -2
  45. package/lib/runsList.d.ts +43 -3
  46. package/lib/runsList.js +159 -39
  47. package/lib/runsRefusalVoices.js +50 -1
  48. package/lib/runsRegistry.d.ts +84 -6
  49. package/lib/runsRegistry.js +515 -105
  50. package/lib/runsStart.d.ts +24 -3
  51. package/lib/runsStart.js +128 -13
  52. package/lib/runsTypes.d.ts +27 -2
  53. package/lib/runsTypes.js +23 -6
  54. package/lib/runsValidateServe.js +20 -10
  55. package/lib/runsValidateShared.d.ts +9 -0
  56. package/lib/runsValidateShared.js +14 -0
  57. package/lib/runsValidateStages.js +21 -9
  58. package/lib/runtimeProvision.d.ts +119 -0
  59. package/lib/runtimeProvision.js +243 -0
  60. package/lib/skillRows.js +7 -2
  61. package/package.json +18 -18
@@ -4,6 +4,25 @@ import { RUNS_ERROR_CODES } from "./runsErrorCodes.js";
4
4
 
5
5
 
6
6
 
7
+
8
+
9
+
10
+
11
+
12
+
13
+ export interface LaneMissRow {
14
+ /** The lane slot key (text_encoder, vae, …). */
15
+ readonly slot: string;
16
+ /** The declared file name that has no store copy. */
17
+ readonly name: string;
18
+ /** The model folders the presence probe checked, in order. */
19
+ readonly folders: readonly string[];
20
+ /** The DECL provision's declared size in bytes, when the family
21
+ * fetches the file itself (a pack-borne file declares none). */
22
+ readonly sizeBytes?: number;
23
+ /** The provision URL when the family declares one for the file. */
24
+ readonly fetchUrl?: string;
25
+ }
7
26
  export interface LaneInputMiss {
8
27
  /** The model family id whose lane_inputs declared the row. */
9
28
  readonly family: string;
@@ -15,8 +34,34 @@ export interface LaneInputMiss {
15
34
  readonly folders: readonly string[];
16
35
  /** The provision URL when the family declares one for the file. */
17
36
  readonly fetchUrl?: string;
18
- /** The artifact class the popup's action keys on. */
19
- readonly kind: "model" | "extension";
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+ readonly missingAll?: readonly LaneMissRow[];
45
+ /** The artifact class the popup's action keys on. "runtime" is
46
+ * the tool-runtime leg (E2-2 Piece A): the slot is the consuming
47
+ * param, missing is the runtime name, folders are the checked
48
+ * engine-tree paths, and there is no fetchUrl (the provision is
49
+ * a command the banner voices from the prose, never a URL). */
50
+ readonly kind: "model" | "extension" | "runtime";
51
+ }
52
+ /** THE IN-FLIGHT ACQUISITION ROW (ERRORS.md k2, NEVER-RUN-ON-
53
+ * INCOMPLETE): the structured truth a lane-presence miss carries when
54
+ * the missing file is LANDING right now — the popup keys its face on
55
+ * these fields, never on prose, and the fresh-fetch hint is absent by
56
+ * law (a fetch already runs; offering another re-pops the loop). */
57
+ export interface AcquireInFlightDetails {
58
+ readonly acquire_in_flight: true;
59
+ /** The live acquire's operation id (the poll key). */
60
+ readonly operation_id: string;
61
+ /** Real landed bytes at the refusal moment. */
62
+ readonly bytes: number;
63
+ /** The DECL's declared total (0 when no row declares one). */
64
+ readonly total: number;
20
65
  }
21
66
  export declare class CardArmError extends Error {
22
67
  readonly status: number;
@@ -32,7 +77,11 @@ export declare class CardArmError extends Error {
32
77
  /** The structured lane-miss evidence — set only by the
33
78
  * lane_input_missing throw site (cardsLanes.lanePresenceMiss). */
34
79
  readonly lane?: LaneInputMiss;
35
- constructor(status: number, message: string, code: keyof typeof RUNS_ERROR_CODES, loc?: string, expected?: string, got?: string, lane?: LaneInputMiss);
80
+ /** The structured in-flight-acquisition evidence — set only by the
81
+ * lane_input_missing throw site's in-flight arm, beside (never
82
+ * instead of) the lane miss itself. */
83
+ readonly details?: AcquireInFlightDetails;
84
+ constructor(status: number, message: string, code: keyof typeof RUNS_ERROR_CODES, loc?: string, expected?: string, got?: string, lane?: LaneInputMiss, details?: AcquireInFlightDetails);
36
85
  }
37
86
  /** The variant rail's own refusal (sampler_envelope) — a subclass
38
87
  * so the WRITE seat can tell a DECL-own word from a selection
@@ -12,7 +12,11 @@ export class CardArmError extends Error {
12
12
  /** The structured lane-miss evidence — set only by the
13
13
  * lane_input_missing throw site (cardsLanes.lanePresenceMiss). */
14
14
  lane;
15
- constructor(status, message, code, loc, expected, got, lane) {
15
+ /** The structured in-flight-acquisition evidence — set only by the
16
+ * lane_input_missing throw site's in-flight arm, beside (never
17
+ * instead of) the lane miss itself. */
18
+ details;
19
+ constructor(status, message, code, loc, expected, got, lane, details) {
16
20
  super(message);
17
21
  this.status = status;
18
22
  this.code = code;
@@ -24,6 +28,8 @@ export class CardArmError extends Error {
24
28
  this.got = got;
25
29
  if (lane !== undefined)
26
30
  this.lane = lane;
31
+ if (details !== undefined)
32
+ this.details = details;
27
33
  }
28
34
  }
29
35
  /** The variant rail's own refusal (sampler_envelope) — a subclass
@@ -3,7 +3,7 @@
3
3
  // 2-6) and the in-process compose (steps 7-9). Explicit seat
4
4
  // deps; no Service state beyond the accessors the seat passes.
5
5
  import { ComfyUIService, resolveEngineBaseUrl, composeCards, ComposeRefusal, checkModelPresent, owningAtom } from "@melite/comfyui-cordis";
6
- import { cardAdmits } from "./cardsFacts.js";
6
+ import { cardAdmits, familyLanesOf } from "./cardsFacts.js";
7
7
  export { cardAdmits };
8
8
  import { EngineContext, composeModPlane, loadFacts, theService } from "@melite/comfyui-cordis";
9
9
  import { CardArmError, phaseRefusal } from "./cardsArmError.js";
@@ -146,6 +146,7 @@ export function admissionRefusal(deps, card, fam, lifted, phase, facts) {
146
146
  // turn on `qvoice_save` — the pack rides fields, never its own
147
147
  // key). Pack → its family-scoped field names, same fold.
148
148
  const packFields = new Map();
149
+ const fieldOwners = new Map();
149
150
 
150
151
 
151
152
 
@@ -168,6 +169,29 @@ export function admissionRefusal(deps, card, fam, lifted, phase, facts) {
168
169
  if (!packFields.has(a.pack))
169
170
  packFields.set(a.pack, names);
170
171
  }
172
+ // THE MOD-FIELD OWNERSHIP ROSTER (the tts dossier's B4 cure,
173
+
174
+ // shared door): the fold above scopes mod fields to THIS run's
175
+ // atom, so a key that is a REGISTERED mod field of a DIFFERENT
176
+ // family refused as bare 'unknown' — an agent holding the
177
+ // field burned a probe turn learning which family owns it.
178
+ // Collect every row's ownership UNFILTERED; the refusal below
179
+ // names the owning family and the params.model cure for
180
+ // exactly the keys the envelope-scoped fold did not admit.
181
+ for (const a of theService().cardModFields(card)) {
182
+ const fams = a.families.filter((f) => f !== envelopeAtom);
183
+ if (fams.length === 0)
184
+ continue;
185
+ for (const n of Object.keys(a.fields.dict ?? {})) {
186
+ const row = fieldOwners.get(n);
187
+ if (row === undefined)
188
+ fieldOwners.set(n, { pack: a.pack, families: [...fams] });
189
+ else
190
+ for (const f of fams)
191
+ if (!row.families.includes(f))
192
+ row.families.push(f);
193
+ }
194
+ }
171
195
  /* v8 ignore stop */
172
196
  }
173
197
  catch (modFoldError) {
@@ -181,9 +205,21 @@ export function admissionRefusal(deps, card, fam, lifted, phase, facts) {
181
205
  const hints = unknown
182
206
  .filter((k) => packFields.has(k))
183
207
  .map((k) => " '" + k + "' is the '" + k + "' mod pack — it takes no key of its own; its fields ride flat top-level: " + packFields.get(k).join(", "));
208
+ // THE MOD-FIELD FAMILY HINT (B4): a refused key owned by
209
+ // ANOTHER family's mod pack names that family and the one
210
+ // write that reaches it — never a bare 'unknown'.
211
+ const fieldHints = unknown
212
+ .filter((k) => !packFields.has(k) && fieldOwners.has(k))
213
+ .map((k) => {
214
+ const o = fieldOwners.get(k);
215
+ return " '" + k + "' is the '" + o.pack + "' mod field of " +
216
+ o.families.map((f) => "family '" + f + "'").join(" / ") +
217
+ " — state params.model on that family's lane to ride it";
218
+ });
184
219
  throw phaseRefusal(phase, "compose-door: unknown param(s) on the " + card + " card: " + unknown.join(", ") +
185
220
  " (admission is the declared surface — knobs + contract admits; see the card's TS definition)" +
186
- (hints.length > 0 ? " Mod-pack keys:" + hints.join(";") : ""));
221
+ (hints.length > 0 ? " Mod-pack keys:" + hints.join(";") : "") +
222
+ (fieldHints.length > 0 ? " Mod-field families:" + fieldHints.join(";") : ""));
187
223
  }
188
224
  }
189
225
  /** Resolve + sweep + select + overlay + lift (steps 2-6):
@@ -218,10 +254,10 @@ export function prepareCardParams(deps, body, mid, phase, factsArg) {
218
254
  const resolves = mid in facts || deps.resolveCardFamily(mid, facts) in facts || deps.modelMids().has(mid);
219
255
  if (!resolves) {
220
256
 
221
- // Run-press law, the operator's wall): the bench's Run press
222
- // addresses a family-less card by its OWN id — runCardStage's
223
- // documented fallback, defaultFamilyForCard returning the
224
- // card id when no family stands behind the card. The {model:}
257
+
258
+ // the bench's Run press addresses a family-less card by its OWN
259
+ // id — stage-run maps defaultFamilyForCard's null to the card
260
+ // id explicitly (never a writer `?? cardId` mint). The {model:}
225
261
  // door therefore COMPOSES the card the press names (the GUI's
226
262
  // shape is the contract), params verbatim: no family row, so
227
263
  // no variant selection and no model-defaults overlay — the
@@ -266,7 +302,7 @@ export function prepareCardParams(deps, body, mid, phase, factsArg) {
266
302
  throw new CardArmError(400, "card_compose phase " + phase + ": unknown card " + JSON.stringify(famRow.card) +
267
303
  " (no registered card definition for the card model " + JSON.stringify(mid) + " names)", "card_compose");
268
304
  }
269
- const sel = selectCardVariant(mid, famRow, body, phase);
305
+ const sel = selectCardVariant(mid, famRow, body, phase, familyLanesOf(decl.boarded), fam);
270
306
  const stamped = stampCardOverlay(body, famRow, decl, sel, phase, fam);
271
307
  return {
272
308
  mid,
@@ -61,6 +61,13 @@ export interface ModelFactsRow {
61
61
  min?: number;
62
62
  max?: number;
63
63
  }>>;
64
+
65
+
66
+
67
+ readonly required_defaults?: readonly {
68
+ readonly name: string;
69
+ readonly class: "user" | "variant" | "mod";
70
+ }[];
64
71
  /** The assembly-studio declaration (hand-owned model-facts.json
65
72
  * carries it; the projection unions its writes into admits). */
66
73
  readonly studio?: {
@@ -74,6 +81,15 @@ export interface CardDeclRow {
74
81
  readonly admits: readonly string[];
75
82
  readonly spells: readonly string[];
76
83
  }
84
+ /** The window-family lanes a card's boarded families derive — the
85
+ * vocabulary an agent confuses for a variant (the transcript's
86
+ * step-8 burn: variant 't4r' read "unknown variant"). Reads the
87
+ * DECLs' served familyLaw, never a copy; undefined when no boarded
88
+ * family declares a law (legacy families get the plain voice).
89
+ *
90
+ * @param boarded the card's boarded family ids.
91
+ * @returns the union of their declared lane ids, or undefined. */
92
+ export declare function familyLanesOf(boarded: readonly string[] | undefined): readonly string[] | undefined;
77
93
  export declare function factsPath(): string;
78
94
  export declare function deriveDecls(defs: Map<string, CardDefinition>, facts: Record<string, ModelFactsRow>): Record<string, CardDeclRow>;
79
95
  /** THE SHARED ADMISSION PREDICATE (audit J-E2): knobs ∪ absorbed
package/lib/cardsFacts.js CHANGED
@@ -3,7 +3,31 @@
3
3
  // facts/decl plane owns model-facts.json reads and the pure
4
4
  // defs+facts->rows derivation. No Service state — module truth.
5
5
  import { join } from "node:path";
6
- import { resolveRepoRoot } from "@melite/comfyui-cordis";
6
+ import { getModel, resolveRepoRoot } from "@melite/comfyui-cordis";
7
+ /** The window-family lanes a card's boarded families derive — the
8
+ * vocabulary an agent confuses for a variant (the transcript's
9
+ * step-8 burn: variant 't4r' read "unknown variant"). Reads the
10
+ * DECLs' served familyLaw, never a copy; undefined when no boarded
11
+ * family declares a law (legacy families get the plain voice).
12
+ *
13
+ * @param boarded the card's boarded family ids.
14
+ * @returns the union of their declared lane ids, or undefined. */
15
+ export function familyLanesOf(boarded) {
16
+ const lanes = [];
17
+ for (const fam of boarded ?? []) {
18
+ let law;
19
+ try {
20
+ law = getModel(fam).familyLaw;
21
+ }
22
+ catch {
23
+ continue;
24
+ }
25
+ for (const row of law?.lanes ?? [])
26
+ if (!lanes.includes(row.lane))
27
+ lanes.push(row.lane);
28
+ }
29
+ return lanes.length > 0 ? lanes : undefined;
30
+ }
7
31
  export function factsPath() {
8
32
 
9
33
  // cordis package): the compose plane lives in
@@ -31,13 +31,61 @@ export declare function lanePackFolders(): readonly string[];
31
31
 
32
32
 
33
33
 
34
- export declare function lanePresenceRefusal(fam: string): CardArmError | null;
34
+ export declare function lanePresenceRefusal(fam: string, body?: Record<string, unknown>, mid?: string): CardArmError | null;
35
35
 
36
36
 
37
37
 
38
38
 
39
39
  type LaneCheck = (folder: string, name: string) => string | null;
40
- export declare function laneFilesStatus(decl: Pick<ModelDecl, "lane_inputs" | "provisions" | "lane_homes">, check?: LaneCheck): boolean | null;
41
- export declare function lanePresenceMiss(fam: string): CardArmError | null;
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;
42
90
  export {};
43
91
  //# sourceMappingURL=cardsLanes.d.ts.map