@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
package/lib/manageOps.js CHANGED
@@ -106,10 +106,19 @@ export function estateOnly(req, cfg) {
106
106
  throw new Refused(409, "byo endpoint: " + req.action + " orchestrates the estate engine — the estate never touches a user-owned ComfyUI");
107
107
  }
108
108
  // ── systemd orchestration (estate deployment — TS-native) ──────────
109
- export const COMFY_UNIT = process.env["MELITE_COMFYUI_UNIT"] ?? "melite-comfyui.service";
110
- export async function systemctl(req, verb, signal) {
109
+
110
+ // frozen before any plugin loads; it is now the manage provider's
111
+ // config field, resolved per mount.
112
+ /** Run systemctl for the estate's engine unit.
113
+ * @param req - the manage request (envelope rows).
114
+ * @param verb - the systemctl verb to run.
115
+ * @param unit - the estate deployment's systemd unit (config-pinned).
116
+ * @param signal - aborts the child and maps to the abort reason.
117
+ * @returns [status, envelope] as the manage lane's answer.
118
+ */
119
+ export async function systemctl(req, verb, unit, signal) {
111
120
  try {
112
- await execFileAsync("systemctl", ["--user", verb, COMFY_UNIT], {
121
+ await execFileAsync("systemctl", ["--user", verb, unit], {
113
122
  timeout: 30 * 1000,
114
123
  encoding: "utf8",
115
124
  signal,
@@ -120,12 +129,12 @@ export async function systemctl(req, verb, signal) {
120
129
  throw abortReason(signal);
121
130
  const value = error;
122
131
  const why = String(value.stderr ?? value.message).trim().slice(0, 200);
123
- return [500, { action: req.action, ok: false, detail: "systemctl " + verb + " " + COMFY_UNIT + " failed: " + why }];
132
+ return [500, { action: req.action, ok: false, detail: "systemctl " + verb + " " + unit + " failed: " + why }];
124
133
  }
125
134
  return [200, {
126
135
  action: req.action,
127
136
  ok: true,
128
- detail: verb + " issued for " + COMFY_UNIT,
137
+ detail: verb + " issued for " + unit,
129
138
  next_action: verb === "stop" ? "launch" : "status",
130
139
  data: { next_action: verb === "stop" ? "launch" : "status" },
131
140
  }];
@@ -133,10 +142,21 @@ export async function systemctl(req, verb, signal) {
133
142
  export function guardLifecycle(req, ctx) {
134
143
  if (req.force)
135
144
  return;
136
- const active = activeRuns();
145
+ const active = activeRuns(ctx.stateRoots);
137
146
  if (active.length > 0) {
138
147
  throw new Refused(409, "refused: " + active.length + " active run(s) (" + active.slice(0, 4).join(", ") +
139
148
  ") — stop them first (the stop door) or pass force=true");
140
149
  }
150
+
151
+ // locks — a teardown during an in-flight fetch unloaded VRAM under
152
+ // a landing fetch or failed it mid-stream. The seat's sync census
153
+ // (locks plus pre-lock mints) joins the refusal: a seat without the
154
+ // probe reads as idle (the optional-seat posture). Synchronous by
155
+ // law — the guard never awaits.
156
+ const inflight = ctx.provisioning?.inflightAcquires?.() ?? [];
157
+ if (inflight.length > 0) {
158
+ throw new Refused(409, "refused: " + inflight.length + " in-flight acquisition(s) (" + inflight.slice(0, 4).join(", ") +
159
+ ") — wait for the fetch to land (poll acquire_weight) or pass force=true", { state: "conflict", next_action: "status" });
160
+ }
141
161
  }
142
162
  //# sourceMappingURL=manageOps.js.map
@@ -22,10 +22,25 @@ export interface ManageEnvelope {
22
22
  misses?: string[];
23
23
  partial?: boolean;
24
24
  restart_required?: boolean;
25
+ retry_after_ms?: number;
25
26
  }
26
27
  export interface ManageCtx {
27
28
  /** File-anchored repo root (routing, catalog, runs scan anchor). */
28
29
  repoRoot: string;
30
+ /** The §23 cross-roots manifest (own state root first, then the
31
+ * stateRoots config extras): the runs-probe rows (restart
32
+ * guard, status) walk these trees — one law from the queue
33
+ * seat, never the retired env seam (J12). */
34
+ stateRoots: readonly string[];
35
+ /** The estate deployment's systemd unit (V7 cure: the manage
36
+ * provider's config field — systemctl/journalctl/status rows all
37
+ * read this one value, never an import-time env capture). */
38
+ comfyUnit: string;
39
+ /** The lane's provisioning posture (the manage provider's config
40
+ * field): true tells the deck the DECLARED arms run without the
41
+ * operator confirm — the raw-URL arms stay operator-gated in the
42
+ * deck's own gate regardless of this value. */
43
+ autoProvision: boolean;
29
44
  /** The endpoint config, re-read per call (fresh — never cached
30
45
  * between calls): carries the engine url the manager rail rides.
31
46
  * The bridges door passes loadEndpointConfig itself. */
@@ -66,6 +81,13 @@ export interface ManageCtx {
66
81
 
67
82
 
68
83
  objectInfo?: () => Promise<unknown>;
84
+ /** THE WEIGHT-LANDING RE-ARM (the cards-plane batch): called after
85
+ * a model lands under a living process (provision_model,
86
+ * download_model, an acquire_weight poll observing a terminal
87
+ * state) so the card registry's presence cache re-derives on its
88
+ * next read. Optional: a lane without the estate card registry
89
+ * has no presence face to re-arm. */
90
+ rearmWeights?: () => void;
69
91
  }
70
92
 
71
93
 
@@ -86,6 +108,11 @@ export interface Req {
86
108
  action: ManageAction;
87
109
  nodes: string[];
88
110
  url: string;
111
+
112
+
113
+
114
+
115
+ ref: string;
89
116
  relative_path: string;
90
117
  filename: string;
91
118
  wait: boolean | null;
@@ -99,6 +126,10 @@ export interface Req {
99
126
  target: string;
100
127
  extra_args: string[];
101
128
  force: boolean;
129
+
130
+
131
+
132
+ operator_confirmed: boolean;
102
133
  snapshot: string;
103
134
  path: string;
104
135
  data: string;