@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.
Files changed (106) hide show
  1. package/LICENSE +561 -457
  2. package/README.md +55 -0
  3. package/lib/bench.d.ts +19 -11
  4. package/lib/bench.js +47 -57
  5. package/lib/cardsArmError.d.ts +94 -2
  6. package/lib/cardsArmError.js +34 -4
  7. package/lib/cardsCompose.d.ts +13 -1
  8. package/lib/cardsCompose.js +151 -67
  9. package/lib/cardsDangling.d.ts +2 -2
  10. package/lib/cardsDangling.js +82 -37
  11. package/lib/cardsFacts.d.ts +32 -3
  12. package/lib/cardsFacts.js +39 -1
  13. package/lib/cardsLanes.d.ts +62 -4
  14. package/lib/cardsLanes.js +407 -20
  15. package/lib/cardsLanesCopy.d.ts +21 -0
  16. package/lib/cardsLanesCopy.js +22 -0
  17. package/lib/cardsRegistry.d.ts +195 -10
  18. package/lib/cardsRegistry.js +959 -67
  19. package/lib/cardsVariant.d.ts +22 -8
  20. package/lib/cardsVariant.js +243 -52
  21. package/lib/discloseRegistry.d.ts +42 -11
  22. package/lib/discloseRegistry.js +163 -23
  23. package/lib/filmLead.js +5 -3
  24. package/lib/flowsData.d.ts +68 -13
  25. package/lib/flowsData.js +236 -107
  26. package/lib/flowsFamilyCompose.d.ts +5 -8
  27. package/lib/flowsFamilyCompose.js +25 -14
  28. package/lib/flowsParamsOverlay.d.ts +55 -0
  29. package/lib/flowsParamsOverlay.js +197 -0
  30. package/lib/flowsRegistryRows.d.ts +4 -1
  31. package/lib/flowsRegistryRows.js +325 -25
  32. package/lib/index.d.ts +1 -3
  33. package/lib/index.js +20 -5
  34. package/lib/lifecycleLatch.d.ts +16 -0
  35. package/lib/lifecycleLatch.js +42 -0
  36. package/lib/loadPlane.d.ts +3 -2
  37. package/lib/loadPlane.js +34 -8
  38. package/lib/loadRegistry.js +1 -1
  39. package/lib/manageOps.d.ts +8 -2
  40. package/lib/manageOps.js +28 -7
  41. package/lib/managePlane.d.ts +42 -1
  42. package/lib/managePlane.js +911 -101
  43. package/lib/managePreflight.d.ts +26 -0
  44. package/lib/managePreflight.js +179 -0
  45. package/lib/manageProbe.d.ts +15 -7
  46. package/lib/manageProbe.js +79 -8
  47. package/lib/manageRegistry.d.ts +42 -4
  48. package/lib/manageRegistry.js +45 -7
  49. package/lib/mediaKinds.d.ts +1 -1
  50. package/lib/mediaKinds.js +1 -1
  51. package/lib/queue.js +14 -10
  52. package/lib/queueCore.d.ts +21 -5
  53. package/lib/queueCore.js +22 -5
  54. package/lib/queueLifecycle.d.ts +0 -24
  55. package/lib/queueLifecycle.js +9 -63
  56. package/lib/queueLock.d.ts +8 -2
  57. package/lib/queueLock.js +9 -6
  58. package/lib/queueResurrect.d.ts +7 -2
  59. package/lib/queueResurrect.js +25 -6
  60. package/lib/queueSidecar.d.ts +114 -1
  61. package/lib/queueSidecar.js +178 -7
  62. package/lib/queueSubmit.d.ts +124 -10
  63. package/lib/queueSubmit.js +251 -48
  64. package/lib/queueSweep.js +13 -2
  65. package/lib/runsChange.d.ts +8 -0
  66. package/lib/runsChange.js +21 -5
  67. package/lib/runsErrorCodes.d.ts +1 -1
  68. package/lib/runsErrorCodes.js +35 -0
  69. package/lib/runsExecute.d.ts +26 -0
  70. package/lib/runsExecute.js +184 -6
  71. package/lib/runsGates.d.ts +5 -1
  72. package/lib/runsGates.js +10 -5
  73. package/lib/runsList.d.ts +43 -3
  74. package/lib/runsList.js +172 -58
  75. package/lib/runsRefusalVoices.js +101 -0
  76. package/lib/runsRegistry.d.ts +188 -12
  77. package/lib/runsRegistry.js +1233 -179
  78. package/lib/runsSourceEcho.d.ts +27 -0
  79. package/lib/runsSourceEcho.js +84 -18
  80. package/lib/runsStart.d.ts +80 -17
  81. package/lib/runsStart.js +303 -49
  82. package/lib/runsTypes.d.ts +62 -2
  83. package/lib/runsTypes.js +30 -6
  84. package/lib/runsValidateArms.js +61 -7
  85. package/lib/runsValidateServe.d.ts +2 -2
  86. package/lib/runsValidateServe.js +46 -14
  87. package/lib/runsValidateShared.d.ts +10 -1
  88. package/lib/runsValidateShared.js +14 -0
  89. package/lib/runsValidateStages.d.ts +10 -3
  90. package/lib/runsValidateStages.js +44 -12
  91. package/lib/runtimeProvision.d.ts +119 -0
  92. package/lib/runtimeProvision.js +243 -0
  93. package/lib/service.d.ts +24 -6
  94. package/lib/service.js +19 -11
  95. package/lib/skillFs.d.ts +9 -4
  96. package/lib/skillFs.js +12 -14
  97. package/lib/skillPlane.d.ts +3 -2
  98. package/lib/skillPlane.js +12 -6
  99. package/lib/skillRegistry.js +1 -1
  100. package/lib/skillRows.d.ts +4 -3
  101. package/lib/skillRows.js +21 -14
  102. package/lib/toolProjection.d.ts +1 -1
  103. package/lib/toolProjection.js +1 -1
  104. package/package.json +18 -17
  105. package/lib/runStatus.d.ts +0 -7
  106. 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,10 +1,13 @@
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;
6
6
  export declare const FIT_SEAT: RegistryFlow;
7
7
  export declare const IMAGE_UPSCALE: RegistryFlow;
8
+ export declare const VIDEO_EXTEND: RegistryFlow;
8
9
  export declare const MUSIC_NATIVE: RegistryFlow;
9
10
  export declare const CRAFT_LOOP: RegistryFlow;
11
+ export declare const CHARACTER_FACTORY: RegistryFlow;
12
+ export declare const OBJECT_FORGE: RegistryFlow;
10
13
  //# sourceMappingURL=flowsRegistryRows.d.ts.map