@melite/estate-queue 0.2.2-alpha → 0.3.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 (52) hide show
  1. package/lib/bakeParams.d.ts +2 -1
  2. package/lib/bench.js +30 -3
  3. package/lib/cardsCompose.js +10 -1
  4. package/lib/cardsDangling.js +17 -7
  5. package/lib/cardsDroppable.d.ts +11 -0
  6. package/lib/cardsDroppable.js +50 -0
  7. package/lib/cardsFacts.d.ts +37 -0
  8. package/lib/cardsFacts.js +47 -1
  9. package/lib/cardsLanes.d.ts +18 -0
  10. package/lib/cardsLanes.js +2 -1
  11. package/lib/cardsRegistry.d.ts +7 -18
  12. package/lib/cardsRegistry.js +132 -93
  13. package/lib/filmLead.js +9 -1
  14. package/lib/filmMemoryWarn.js +1 -0
  15. package/lib/flowsData.d.ts +33 -0
  16. package/lib/flowsData.js +45 -2
  17. package/lib/flowsFamilyCompose.js +1 -0
  18. package/lib/flowsParamsOverlay.d.ts +8 -1
  19. package/lib/flowsParamsOverlay.js +47 -2
  20. package/lib/flowsRegistryRows.js +40 -20
  21. package/lib/ledgerTail.js +1 -0
  22. package/lib/loadPlane.js +2 -0
  23. package/lib/managePlane.js +53 -12
  24. package/lib/manageProbe.js +33 -4
  25. package/lib/manageRegistry.d.ts +10 -0
  26. package/lib/manageRegistry.js +7 -1
  27. package/lib/managerRail.js +1 -0
  28. package/lib/queueCore.js +3 -1
  29. package/lib/queueLock.js +3 -0
  30. package/lib/queueResurrect.js +5 -0
  31. package/lib/queueSidecar.d.ts +43 -3
  32. package/lib/queueSidecar.js +33 -4
  33. package/lib/queueSweep.d.ts +38 -11
  34. package/lib/queueSweep.js +73 -16
  35. package/lib/runsChange.d.ts +5 -4
  36. package/lib/runsExecute.js +98 -5
  37. package/lib/runsGates.js +1 -0
  38. package/lib/runsList.js +11 -0
  39. package/lib/runsRegistry.d.ts +29 -3
  40. package/lib/runsRegistry.js +187 -8
  41. package/lib/runsSourceEcho.d.ts +2 -1
  42. package/lib/runsSourceEcho.js +9 -3
  43. package/lib/runsTypes.d.ts +46 -0
  44. package/lib/runsTypes.js +44 -0
  45. package/lib/runsValidateArms.js +23 -2
  46. package/lib/runsValidateStages.js +18 -1
  47. package/lib/runtimeProvision.js +10 -2
  48. package/lib/skillFs.js +3 -0
  49. package/lib/skillRows.js +10 -6
  50. package/lib/vocab.d.ts +44 -0
  51. package/lib/vocab.js +96 -0
  52. package/package.json +15 -15
@@ -18,17 +18,22 @@ export const ANNY_HMR_ESTIMATOR = {
18
18
  id: "estimate",
19
19
  engine: CARD_PLANE_ENGINE,
20
20
  // the estimator engine of the same verb — family DECL owns
21
- // the nodes (SAM 3D Body → grounded anny), person_index FIXED
22
- // at the loudest detection (the verb's chip owns the picker)
21
+ // the nodes (SAM 3D Body → grounded anny). The person picker
22
+ // rides the person_index INITIAL (required: its $spell rides
23
+ // the composed graph on every press, and the merge resolves
24
+ // it against the run's initials — the door teaches an absent
25
+ // one BEFORE the run registers; the verb's chip owns the
26
+ // pick, the flow owns the lane).
23
27
  family: "anny",
24
28
  action: "estimate_photo",
25
29
  description: "SAM 3D Body estimator → grounded anny GLB",
26
- inputs: { photo: initial("photo") },
27
- expected: { photo: "image" },
28
- params: { photo: "$photo" },
30
+ inputs: { photo: initial("photo"), person_index: initial("person_index") },
31
+ expected: { photo: "image", person_index: "num" },
32
+ params: { photo: "$photo", person_index: "$person_index" },
29
33
  }),
30
34
  ],
31
- initialValidators: { photo: "photo" },
35
+ initialValidators: { photo: "photo", person_index: "number" },
36
+ requiredInitials: ["photo", "person_index"],
32
37
  tool: null,
33
38
  skillRefs: [],
34
39
  };
@@ -101,8 +106,8 @@ export const FIT_SEAT = {
101
106
  export const IMAGE_UPSCALE = {
102
107
  id: "image-upscale",
103
108
  description: "Prompt → image → 1080p SeedVR2 upscale, one card per stroke (the first " +
104
- "two-card flow: image-gen + upscale-tools card= stages; image_model picks " +
105
- "the generator). RUNS on the {flow:} door (2026-10-04: the VALIDATE-ONLY " +
109
+ "two-card flow: image-gen + upscale-tools card= stages; the make stage " +
110
+ "FIXES the generator at krea-2 — no model seat exists on this row). RUNS on the {flow:} door (2026-10-04: the VALIDATE-ONLY " +
106
111
  "stamp is GONE — both card stages compose through the card plane and " +
107
112
  "submit as one merged run); the {model:} door drives a single card.",
108
113
  stages: [
@@ -152,18 +157,18 @@ export const IMAGE_UPSCALE = {
152
157
  name: "image_upscale",
153
158
  version: 1,
154
159
  description: "Generate an image from a prompt and upscale it to 1080p in one call " +
155
- "(krea-2 or z-image generator, SeedVR2 upscale always on). One POST runs " +
160
+ "(krea-2 generator, FIXED by the row's make stage — no image_model " +
161
+ "seat exists and one stated anywhere is a dead letter (audit " +
162
+ "2026-11-14 FL-7); SeedVR2 upscale always on). One POST runs " +
156
163
  "the whole flow.",
157
164
  properties: {
158
- image_model: {
159
- ptype: "string",
160
- description: "the generator family (no default: pick one)",
161
- default: null,
162
- hasDefault: false,
163
- minimum: null,
164
- maximum: null,
165
- enum: ["krea-2", "z-image"],
166
- },
165
+
166
+ // face: the runtime reads it nowhere — the make stage pins
167
+ // model "krea-2" and cardAdmission has no image-gen seat for
168
+ // the key, so a stated value refused or dead-lettered. Re-seat
169
+ // it only by wiring a real admission seat (an initial that
170
+ // overrides the make stage's model), never by re-publishing
171
+ // the knob.
167
172
  prompt: {
168
173
  ptype: "string",
169
174
  description: "what to generate (up to 4000 chars)",
@@ -412,11 +417,26 @@ export const OBJECT_FORGE = {
412
417
  engine: CARD_PLANE_ENGINE,
413
418
  card: "img-to-mesh",
414
419
  description: "Image → textured mesh via the img-to-mesh card (trellis2-native, " +
415
- "no pack; repair knobs ride the card's own defaults)",
420
+ "no pack; the lift stamps the high recipe's own knobs — the " +
421
+ "same stamps every UI birth carries, Recipe default high)",
416
422
  inputs: { concept: fromStage("concept", "image") },
417
423
  expected: { concept: "image" },
418
424
  cardIo: { mesh: "mesh" },
419
- params: { model: "trellis2-native", input_image: "$concept" },
425
+
426
+ // birth lands stamped with the declared default Recipe "high"
427
+ // (resolution 1536, remesh 1024, 1M faces — wire_defaults,
428
+ // applied client-side at birth only), while a bare {flow:}
429
+ // press composed at the family floor (1024) — the same lift
430
+ // produced different meshes by door. The stamps below are the
431
+ // high row's wire_defaults verbatim, and 1536 is the official
432
+ // template's own upsample default
433
+ // (3d_pixal3d_trellis2_image_to_model.json [94]). Compose
434
+ // never applies recipe wire_defaults server-side; the stage's
435
+ // own params are the flow plane's one seat.
436
+ params: {
437
+ model: "trellis2-native", input_image: "$concept",
438
+ resolution: "1536", remesh_resolution: 1024, decimate_faces: 1000000,
439
+ },
420
440
  }),
421
441
  ],
422
442
  initialValidators: { prompt: "text" },
package/lib/ledgerTail.js CHANGED
@@ -68,6 +68,7 @@ const parseTail = (lines) => {
68
68
  for (const e of lines) {
69
69
  try {
70
70
  out.push(JSON.parse(e));
71
+ // an unparseable journal line throws SyntaxError — the tail keeps unparseables in its last-N window and they parse-skip at the end, never surfacing as entries
71
72
  }
72
73
  catch {
73
74
  continue;
package/lib/loadPlane.js CHANGED
@@ -316,6 +316,7 @@ export function flowLeafDocs(repo, flowName) {
316
316
  let entries;
317
317
  try {
318
318
  entries = readdirSync(dir, { withFileTypes: true });
319
+ // a missing or unreadable directory throws ENOENT — the walk simply contributes no doc files, never refusing the bundle
319
320
  }
320
321
  catch {
321
322
  return;
@@ -417,6 +418,7 @@ export function loadCard(repo, cards, modelsSeat, cardId, stateRoot) {
417
418
  try {
418
419
  const rows = models.resolveCatalogArtifact(fam, "", "", repo);
419
420
  present = rows.length > 0 && rows.every((row) => models.checkModelPresent(row.relative_path, row.name, repo) !== null);
421
+ // a family with no resolvable catalog artifact throws — presence stays false, which is what the served hint reports; the run door owns the loud refusal
420
422
  }
421
423
  catch {
422
424
  present = false;
@@ -16,7 +16,7 @@ import { closeSync, fstatSync, openSync, readFileSync, readSync, statSync } from
16
16
  import { dirname, join } from "node:path";
17
17
  import { resolveRuntimeProvision, nodeRuntimeFs, runtimeEnvView, engineOutputDir, engineRootOf, sentinelHit } from "./runtimeProvision.js";
18
18
  import { loadShippedExtensionManifest } from "@melite/comfyui-cordis/provisioning-manifest";
19
- import { ComfyError, endpointConfigPath, invalidateObjectInfo, liveObjectInfo, loadEndpointConfig, resolveEngineBaseUrl, } from "@melite/comfyui-cordis";
19
+ import { ComfyError, endpointConfigPath, invalidateObjectInfo, liveObjectInfo, loadEndpointConfig, resolveEngineBaseUrl, sdkClient, } from "@melite/comfyui-cordis";
20
20
  import { writeJsonAtomic } from "./queueLock.js";
21
21
  import { installUserLora, installUserLoraBytes, loraNamesFromObjectInfo, readUserLoraRows, refmodNamesFromObjectInfo, resolveEngineLorasDir, seatUserLoraRow, unboardedRows, userLorasPath, validateUserLoraRow, } from "@melite/comfyui-cordis/user-loras";
22
22
  import { rearmLoraFlavors } from "@melite/comfyui-cordis";
@@ -718,6 +718,31 @@ function appLogPort(ctx) {
718
718
  function appLogPath(ctx, port) {
719
719
  return join(ctx.repoRoot, "data", "runtime", "comfyui", "user", "comfyui_" + port + ".log");
720
720
  }
721
+
722
+
723
+
724
+
725
+
726
+
727
+
728
+
729
+
730
+
731
+ async function unitAppLogPath(ctx) {
732
+ try {
733
+ const out = await execFileAsync("systemctl", ["--user", "cat", ctx.comfyUnit], {
734
+ timeout: 5 * 1000,
735
+ encoding: "utf8",
736
+ });
737
+ const m = /^StandardOutput=(?:append:|file:)(\S+)/m.exec(out.stdout);
738
+ return m === null ? null : m[1];
739
+ }
740
+ catch {
741
+ /* no systemctl, no bus, no unit — the canonical derivation
742
+ * owns the answer (and its absent verdict names both seats) */
743
+ return null;
744
+ }
745
+ }
721
746
  /** THE FRESH BOUND: an app log within the hour, or written since the
722
747
  * last known engine boot (the estate's restart receipt), may be the
723
748
  * live application log. Anything older predates the current engine —
@@ -746,20 +771,23 @@ function tailLines(path, max) {
746
771
  closeSync(fd);
747
772
  }
748
773
  }
749
- /** The app-log liveness stamp: stat the derivable path, judge fresh
774
+ /** The app-log liveness stamp: stat the resolved path, judge fresh
750
775
  * against the boot receipt, and when fresh serve its tail. Absent,
751
- * stale, and underivable are HONEST WORDS — never invented lines. */
752
- function appLogRow(ctx, port, tail) {
753
- if (port === null) {
776
+ * stale, and underivable are HONEST WORDS — never invented lines.
777
+ * @param path the RESOLVED application-log path (the unit's own
778
+ * StandardOutput directive first — the deployment's truth — then
779
+ * the canonical derivation; null when neither seat produced one). */
780
+ function appLogRow(ctx, path, tail) {
781
+ if (path === null) {
754
782
  return {
755
783
  known: false,
756
784
  verdict: "unknown",
757
- note: "no app log known — " + (ctx.endpoint()["provision"] === "managed"
758
- ? "the endpoint config carries no engine port to derive the path from"
759
- : "a byo endpoint's engine tree is user-owned; the estate paths only its managed deployment"),
785
+ note: "no app log known — neither the unit's StandardOutput directive nor " +
786
+ (ctx.endpoint()["provision"] === "managed"
787
+ ? "the endpoint config's port-derived runtime path named one"
788
+ : "a byo endpoint's user-owned engine tree named one (the estate paths only its managed deployment)"),
760
789
  };
761
790
  }
762
- const path = appLogPath(ctx, port);
763
791
  let mtimeMs;
764
792
  try {
765
793
  mtimeMs = statSync(path).mtimeMs;
@@ -769,7 +797,7 @@ function appLogRow(ctx, port, tail) {
769
797
  known: false,
770
798
  verdict: "absent",
771
799
  path,
772
- note: "no engine application log on disk — the unit's stdout capture never wrote one at this path; the journal tail is systemd's harness capture (restarts/exits/oom), never application output",
800
+ note: "no engine application log at " + path + " — neither the unit's StandardOutput directive nor the canonical runtime path produced a file; the journal tail is systemd's harness capture (restarts/exits/oom), never application output",
773
801
  };
774
802
  }
775
803
  const ageSeconds = Math.max(0, Math.round((Date.now() - mtimeMs) / 1000));
@@ -837,7 +865,14 @@ async function hLogs(req, ctx) {
837
865
  const lines = stdout.split("\n").filter((ln) => ln !== "");
838
866
  const wrapper = wrapperLineCount(lines, ctx.comfyUnit);
839
867
  const oom = countOomLines(lines);
840
- const appLog = appLogRow(ctx, appLogPort(ctx), tail);
868
+ // THE DISCOVERY CHAIN (A2): the unit's own StandardOutput first
869
+ // (the hand-seated deployment's truth), the canonical derivation
870
+ // second (the estate-provisioned shape) — MANAGED only: a byo
871
+ // endpoint's engine tree is user-owned and the estate's unit does
872
+ // not own it (the logs-truth law, unchanged).
873
+ const port = appLogPort(ctx);
874
+ const unitPath = port !== null ? await unitAppLogPath(ctx) : null;
875
+ const appLog = appLogRow(ctx, unitPath ?? (port !== null ? appLogPath(ctx, port) : null), tail);
841
876
  const data = {
842
877
  source: {
843
878
  kind: "journal",
@@ -1340,6 +1375,7 @@ async function hLoraFetch(req, ctx) {
1340
1375
  let inComboNow = false;
1341
1376
  try {
1342
1377
  inComboNow = loraNamesFromObjectInfo(await objectInfoDoc(ctx, railMs(req))).includes(comboName);
1378
+ // the engine's deadline refusal is advisory here — a folded false reads as "not yet in the combo read", and the landed lora plus the restart voice below are untouched
1343
1379
  }
1344
1380
  catch {
1345
1381
  inComboNow = false;
@@ -2133,7 +2169,11 @@ async function hEndpointSet(req, ctx) {
2133
2169
  const dl = deadlineOf(ctx.signal, 5000, "ENDPOINT_SET_PROBE");
2134
2170
  let stats;
2135
2171
  try {
2136
- const r = await fetch(url + "/system_stats", { signal: dl.signal });
2172
+
2173
+ // the endpoint-set probe rides fetchApi — the same engine-read
2174
+ // spelling as the health gate and the manage probes, never a
2175
+ // parallel fetch beside the estate's declared client law.
2176
+ const r = await sdkClient(url).fetchApi("/system_stats", { signal: dl.signal });
2137
2177
  if (!r.ok)
2138
2178
  throw new Error("HTTP " + String(r.status));
2139
2179
  stats = (await r.json());
@@ -2545,6 +2585,7 @@ async function objectInfoDoc(ctx, boundMs) {
2545
2585
  if (ctx.objectInfo !== undefined) {
2546
2586
  try {
2547
2587
  return await ctx.objectInfo();
2588
+ // a failed lane-carried objectInfo read means the engine did not answer — the null-doc contract folds to not-visible, never a throw across the sidebar
2548
2589
  }
2549
2590
  catch {
2550
2591
  return null;
@@ -6,6 +6,7 @@ import { promisify } from "node:util";
6
6
  import { readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
7
7
  import { join } from "node:path";
8
8
  import { sweepOutputRoots } from "./cardsDangling.js";
9
+ import { sdkClient } from "@melite/comfyui-cordis";
9
10
  import { deadline } from "@deepseek-ai/dsh-timeout";
10
11
  const execFileAsync = promisify(execFile);
11
12
  // ── runs / security / probe (TS-native) ────────────────────────────
@@ -141,6 +142,7 @@ export function managerSecurity(repoRoot) {
141
142
  let text;
142
143
  try {
143
144
  text = readFileSync(ini, "utf-8");
145
+ // an absent or unreadable candidate ini pins nothing — the loop falls through to the legacy layout and the final "unpinned" answer is the truth
144
146
  }
145
147
  catch {
146
148
  continue;
@@ -177,7 +179,11 @@ export async function engineQueueView(mctx) {
177
179
  return null;
178
180
  const dl = deadline(mctx.signal, 5000, "MANAGE_PROBE");
179
181
  try {
180
- const r = await fetch(url + "/queue", { signal: dl.signal });
182
+
183
+ // engine reads ride sdkClient().fetchApi — never a parallel
184
+ // hand-rolled fetch spelling beside the estate's declared
185
+ // client law (comfyui-transport.ts owns fetch + endpoints).
186
+ const r = await sdkClient(url).fetchApi("/queue", { signal: dl.signal });
181
187
  const q = (await r.json());
182
188
  const running = q["queue_running"];
183
189
  const pending = q["queue_pending"];
@@ -207,7 +213,10 @@ export async function probeEndpoint(mctx) {
207
213
  return { reachable: false, reason: "no url in endpoint config" };
208
214
  const dl = deadline(mctx.signal, 5000, "MANAGE_PROBE");
209
215
  try {
210
- const r = await fetch(url + "/system_stats", { signal: dl.signal });
216
+ // THE SDK SEAT OWNS THE WIRE (A1): the /system_stats health read
217
+ // rides the same fetchApi spelling the execute seat's health
218
+ // gate uses — ONE wire spelling for engine reads tree-wide.
219
+ const r = await sdkClient(url).fetchApi("/system_stats", { signal: dl.signal });
211
220
  const stats = (await r.json());
212
221
  const sysinfo = (stats["system"] ?? {});
213
222
  const devices = (stats["devices"] ?? []).slice(0, 4).map((d) => ({
@@ -326,10 +335,30 @@ export async function engineUnitCensus(mctx) {
326
335
  const degraded = (Number.isFinite(restarts) && restarts >= DEGRADE_RESTART_FLOOR)
327
336
  || (Number.isFinite(exitStatus) && exitStatus === KILL_SIGNAL)
328
337
  || (oomKills !== undefined && oomKills > 0);
329
- if (degraded)
338
+ if (degraded) {
330
339
  row.verdict = "degraded";
340
+
341
+ // laws that fired and what they mean — a bare "degraded" left
342
+ // the reader to cross-join restarts/exit/oom themselves (the
343
+ // burn: "still degraded: restarts 3, oom-kill 4 while serving").
344
+ // Kernel oom evidence adds the memory-pressure reading and the
345
+ // maker's lever: smaller windows (the refine design window is
346
+ // 2.33 s = 56 f — the operator's OOM ruling).
347
+ const causes = [];
348
+ if (Number.isFinite(restarts) && restarts >= DEGRADE_RESTART_FLOOR)
349
+ causes.push("the restart loop (>= " + DEGRADE_RESTART_FLOOR + ")");
350
+ if (Number.isFinite(exitStatus) && exitStatus === KILL_SIGNAL)
351
+ causes.push("a SIGKILL last exit");
352
+ const oom = oomKills !== undefined && oomKills > 0;
353
+ if (oom)
354
+ causes.push("kernel oom evidence");
355
+ row.note = "degraded by " + causes.join(" and ")
356
+ + (oom
357
+ ? " — the engine died under memory pressure and systemd restarted it; the maker's lever is smaller windows (the refine design window is 2.33 s = 56 f)"
358
+ : " — systemd restarted the engine; read the journal tail for the death cause");
359
+ }
331
360
  if (journalNote !== undefined)
332
- row.note = journalNote;
361
+ row.note = row.note === undefined ? journalNote : row.note + " (" + journalNote + ")";
333
362
  return row;
334
363
  }
335
364
  //# sourceMappingURL=manageProbe.js.map
@@ -28,14 +28,22 @@ export interface ManageConfig {
28
28
 
29
29
 
30
30
  autoProvision?: boolean;
31
+
32
+
33
+
34
+
35
+
36
+ userLorasPath?: string;
31
37
  }
32
38
  /** The validator twin of {@link ManageConfig}. */
33
39
  export declare const ManageConfig: Schema<Schemastery.ObjectS<NoInfer<{
34
40
  comfyUnit: Schema<string, string, "defined">;
35
41
  autoProvision: Schema<boolean, boolean, "defined">;
42
+ userLorasPath: Schema<string, string, "defined">;
36
43
  }>>, Schemastery.ObjectT<NoInfer<{
37
44
  comfyUnit: Schema<string, string, "defined">;
38
45
  autoProvision: Schema<boolean, boolean, "defined">;
46
+ userLorasPath: Schema<string, string, "defined">;
39
47
  }>>, "plain">;
40
48
  export declare class ManageGatewayService extends Service {
41
49
  static inject: string[];
@@ -57,9 +65,11 @@ export declare const manageProvider: {
57
65
  Config: Schema<Schemastery.ObjectS<NoInfer<{
58
66
  comfyUnit: Schema<string, string, "defined">;
59
67
  autoProvision: Schema<boolean, boolean, "defined">;
68
+ userLorasPath: Schema<string, string, "defined">;
60
69
  }>>, Schemastery.ObjectT<NoInfer<{
61
70
  comfyUnit: Schema<string, string, "defined">;
62
71
  autoProvision: Schema<boolean, boolean, "defined">;
72
+ userLorasPath: Schema<string, string, "defined">;
63
73
  }>>, "plain">;
64
74
  apply(ctx: Context, config?: ManageConfig): void;
65
75
  };
@@ -13,13 +13,14 @@
13
13
  // Erasable-syntax TS only (node --experimental-strip-types).
14
14
  import { Service } from "@deepseek-ai/cordis";
15
15
  import Schema from "@deepseek-ai/schemastery";
16
- import { loadEndpointConfig, resolveRepoRoot, modelsService } from "@melite/comfyui-cordis";
16
+ import { loadEndpointConfig, resolveRepoRoot, modelsService, setUserLorasPath } from "@melite/comfyui-cordis";
17
17
  import { RemoteError } from "@deepseek-ai/dsh-typert-protocol";
18
18
  import { dispatchManage } from "./managePlane.js";
19
19
  /** The validator twin of {@link ManageConfig}. */
20
20
  export const ManageConfig = Schema.object({
21
21
  comfyUnit: Schema.string().default("melite-comfyui.service"),
22
22
  autoProvision: Schema.boolean().default(false),
23
+ userLorasPath: Schema.string().default(""),
23
24
  });
24
25
  export class ManageGatewayService extends Service {
25
26
 
@@ -98,6 +99,11 @@ export const manageProvider = {
98
99
  inject: ["timer", "queue"],
99
100
  Config: ManageConfig,
100
101
  apply(ctx, config = {}) {
102
+ // The rows-file pin lands BEFORE the service exists: every
103
+ // manage-plane read (lora_list's rows_path, the hot drop-in)
104
+ // resolves through userLorasPath()'s one spelling, so the
105
+ // config field must win from the first read, never after.
106
+ setUserLorasPath(config.userLorasPath ?? "");
101
107
  new ManageGatewayService(ctx, config);
102
108
  },
103
109
  };
@@ -58,6 +58,7 @@ async function call(base, path, opts) {
58
58
  return null;
59
59
  try {
60
60
  return JSON.parse(text);
61
+ // a non-JSON body is the vendor's own plain text — folding to raw text hands the caller the vendor's words instead of a parse refusal
61
62
  }
62
63
  catch {
63
64
  return text;
package/lib/queueCore.js CHANGED
@@ -42,7 +42,9 @@ export class QueueCore {
42
42
  continue;
43
43
  run.status = "running";
44
44
  this.activeId = runId;
45
- notifyRunChanged(runId);
45
+ // the ROW's own branded id feeds the bus (the order array is
46
+ // the wire-facing FIFO of bare strings — the brand rides rows)
47
+ notifyRunChanged(run.runId);
46
48
  return run;
47
49
  }
48
50
  return null;
package/lib/queueLock.js CHANGED
@@ -113,6 +113,7 @@ export function acquireLock(stateRoot, pid = process.pid, nowS = Math.floor(Date
113
113
  let holder = "";
114
114
  try {
115
115
  holder = readFileSync(lockPath, "utf8").trim();
116
+ // an unreadable lock file is the dead-or-garbage case — holder "" falls through to the steal path that already owns it
116
117
  }
117
118
  catch {
118
119
  holder = "";
@@ -146,6 +147,7 @@ export function releaseLock(stateRoot, pid = process.pid) {
146
147
  let holder = "";
147
148
  try {
148
149
  holder = readFileSync(lockPath, "utf8").trim();
150
+ // an absent or unreadable lock file frees nothing this pid can prove it owns — false is the honest not-released
149
151
  }
150
152
  catch {
151
153
  return false;
@@ -154,6 +156,7 @@ export function releaseLock(stateRoot, pid = process.pid) {
154
156
  return false;
155
157
  try {
156
158
  unlinkSync(lockPath);
159
+ // a refused unlink leaves the lock on disk — false reports still-held instead of a phantom release
157
160
  }
158
161
  catch {
159
162
  return false;
@@ -156,6 +156,7 @@ export function durableRecordUsable(sidecarText, requestText, draftExists) {
156
156
  // here would orphan records resurrect saves).
157
157
  try {
158
158
  JSON.parse(requestText);
159
+ // an unparseable _request.json cannot rebuild the run — false orphans the record instead of admitting an unresurrectable row
159
160
  }
160
161
  catch {
161
162
  return false;
@@ -171,6 +172,7 @@ export function durableRecordUsable(sidecarText, requestText, draftExists) {
171
172
  sidecarList(rec["stages"]);
172
173
  sidecarList(rec["skipped_stages"]);
173
174
  artifactStrings(rec["artifacts"]);
175
+ // a non-listable stages/skipped/artifacts field means the record cannot replay — false is the same not-resurrectable answer the replay road would force
174
176
  }
175
177
  catch {
176
178
  return false;
@@ -182,6 +184,7 @@ export function durableRecordUsable(sidecarText, requestText, draftExists) {
182
184
  export function planResurrect(stateRoot, readSidecar = (runId) => {
183
185
  try {
184
186
  return readFileSync(join(stateRoot, "output", runId, "_flow.json"), "utf8");
187
+ // an absent or unreadable sidecar answers null — the plan orphans the run for the reconcile surface instead of dropping it
185
188
  }
186
189
  catch {
187
190
  return null;
@@ -189,6 +192,7 @@ export function planResurrect(stateRoot, readSidecar = (runId) => {
189
192
  }, readRequest = (runId) => {
190
193
  try {
191
194
  return readFileSync(join(stateRoot, "output", runId, "_request.json"), "utf8");
195
+ // an absent or unreadable _request.json answers null — usable goes false and the run orphans, never a throw
192
196
  }
193
197
  catch {
194
198
  return null;
@@ -204,6 +208,7 @@ export function planResurrect(stateRoot, readSidecar = (runId) => {
204
208
  let names;
205
209
  try {
206
210
  names = readdirSync(outRoot);
211
+ // an absent output root means no run was ever written — an empty plan (no order, no orphans) is the whole answer
207
212
  }
208
213
  catch {
209
214
  return { order: [], orphans: [] };
@@ -22,8 +22,12 @@ export interface SidecarStage {
22
22
  readonly status: string;
23
23
  readonly engine?: string;
24
24
  readonly url?: string;
25
+ /** A gallery row's file `name` is the media-route key; `label`
26
+ * (queue 12's output_name mint at settle) is the display name a
27
+ * face reads — absent when the run spelled no output_name. */
25
28
  readonly gallery?: Array<{
26
29
  name: string;
30
+ label?: string;
27
31
  }>;
28
32
  readonly result_outputs?: Record<string, unknown>;
29
33
 
@@ -61,6 +65,20 @@ export declare function sidecarStageOf(stage: {
61
65
 
62
66
 
63
67
 
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
64
82
 
65
83
 
66
84
 
@@ -77,7 +95,18 @@ export interface GraphReceiptPair {
77
95
  readonly carried: readonly string[];
78
96
  /** The judged keys NOT found in the graph, sorted — the honesty face. */
79
97
  readonly dropped: readonly string[];
80
- readonly verdict: "complete" | "partial";
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+ readonly resolved?: readonly string[];
109
+ readonly verdict: "complete" | "params_unbound";
81
110
  /** THE BAKE'S RECORD (study §7 item 2, the run voice): present
82
111
  * iff the composed graph bakes or loads a refmod mod — read off
83
112
  * the graph's own nodes (the extract/loader inputs VERBATIM),
@@ -137,8 +166,8 @@ export declare function graphReceiptOf(params: Record<string, unknown>, composed
137
166
  * inside the run-level `graph_receipt`). */
138
167
  export declare function graphReceiptStageOf(stage: string, pair: GraphReceiptPair): GraphReceiptStageRow;
139
168
  /** Fold per-stage rows into the run-level receipt (nodes SUM —
140
- * the run's graph key space; populated/carried/dropped the
141
- * sorted union; verdict `complete` iff every stage is). */
169
+ * the run's graph key space; populated/carried/dropped/resolved
170
+ * the sorted union; verdict `complete` iff every stage is). */
142
171
  export declare function graphReceiptFoldOf(rows: readonly GraphReceiptStageRow[], promptId?: string): GraphReceipt;
143
172
 
144
173
 
@@ -240,6 +269,17 @@ export declare function sidecarDoc(args: {
240
269
 
241
270
 
242
271
  replaySuspect?: boolean;
272
+
273
+
274
+
275
+
276
+ attribution?: string;
277
+
278
+
279
+
280
+
281
+
282
+ engineRetryCount?: number;
243
283
  }): Record<string, unknown>;
244
284
  /** The door name the run started with (_pipeline_of 2111-2119:
245
285
  * exactly one of flow | flow_inline | model — the sidecar's
@@ -1,3 +1,4 @@
1
+ import { CARD_ENVELOPE_KEYS, SELECTOR_KEYS } from "./vocab.js";
1
2
  export function sidecarStageOf(stage) {
2
3
  const out = {
3
4
  id: stage.id,
@@ -14,6 +15,10 @@ export function sidecarStageOf(stage) {
14
15
  if (typeof stage.url === 'string')
15
16
  out.url = stage.url;
16
17
  if (Array.isArray(stage.gallery)) {
18
+ // THE LABEL CARRY (queue 12): a gallery row may carry a display
19
+ // `label` (the output_name mint at settle) beside its file `name`
20
+ // — the name is the media-route key, the label is what faces
21
+ // read. Both ride the sidecar so a restored row renders labeled.
17
22
  const gallery = stage.gallery.filter((entry) => typeof entry === 'object' && entry !== null && !Array.isArray(entry)
18
23
  && typeof entry.name === 'string'
19
24
  && entry.name !== '');
@@ -121,7 +126,17 @@ export function graphReceiptOf(params, composed) {
121
126
  const populated = [];
122
127
  const found = [];
123
128
  const missed = [];
129
+ const resolved = [];
124
130
  for (const [key, value] of Object.entries(params)) {
131
+ if (CARD_ENVELOPE_KEYS.includes(key))
132
+ continue;
133
+ // B4 (promgen handoff): selector coordinates name their own
134
+ // roster — never judged as knobs (the variant door consumed
135
+ // them; see SELECTOR_KEYS' doc for the burn's shape)
136
+ if (SELECTOR_KEYS.includes(key)) {
137
+ resolved.push(key);
138
+ continue;
139
+ }
125
140
  const scalar = receiptScalarOf(value);
126
141
  if (scalar === undefined)
127
142
  continue;
@@ -131,12 +146,16 @@ export function graphReceiptOf(params, composed) {
131
146
  populated.sort();
132
147
  found.sort();
133
148
  missed.sort();
149
+ resolved.sort();
134
150
  return {
135
151
  nodes,
136
152
  populated,
137
153
  carried: found,
138
154
  dropped: missed,
139
- verdict: missed.length === 0 ? "complete" : "partial",
155
+ ...(resolved.length > 0 ? { resolved } : {}),
156
+ // the verdict names its plane (D-11): not integration
157
+ // vocabulary — populated params whose literal never rode
158
+ verdict: missed.length === 0 ? "complete" : "params_unbound",
140
159
  ...(bake !== undefined ? { bake } : {}),
141
160
  };
142
161
  }
@@ -149,13 +168,14 @@ export function graphReceiptStageOf(stage, pair) {
149
168
  populated: [...pair.populated],
150
169
  carried: [...pair.carried],
151
170
  dropped: [...pair.dropped],
171
+ ...(pair.resolved !== undefined ? { resolved: [...pair.resolved] } : {}),
152
172
  verdict: pair.verdict,
153
173
  ...(pair.bake !== undefined ? { bake: pair.bake } : {}),
154
174
  };
155
175
  }
156
176
  /** Fold per-stage rows into the run-level receipt (nodes SUM —
157
- * the run's graph key space; populated/carried/dropped the
158
- * sorted union; verdict `complete` iff every stage is). */
177
+ * the run's graph key space; populated/carried/dropped/resolved
178
+ * the sorted union; verdict `complete` iff every stage is). */
159
179
  export function graphReceiptFoldOf(rows, promptId) {
160
180
  const union = (pick) => {
161
181
  const s = new Set();
@@ -171,12 +191,14 @@ export function graphReceiptFoldOf(rows, promptId) {
171
191
  if (r.verdict !== "complete")
172
192
  complete = false;
173
193
  }
194
+ const resolved = union((r) => r.resolved ?? []);
174
195
  return {
175
196
  nodes,
176
197
  populated: union((r) => r.populated),
177
198
  carried: union((r) => r.carried),
178
199
  dropped: union((r) => r.dropped),
179
- verdict: complete ? "complete" : "partial",
200
+ ...(resolved.length > 0 ? { resolved } : {}),
201
+ verdict: complete ? "complete" : "params_unbound",
180
202
  stages: rows.map((r) => graphReceiptStageOf(r.stage, r)),
181
203
  // THE BAKE rides the fold: the first stage that carries one
182
204
  // (the card run's single stage; a multi-stage flow receipts the
@@ -265,6 +287,13 @@ export function sidecarDoc(args) {
265
287
  ...(args.loudness !== undefined ? { loudness: args.loudness } : {}),
266
288
  ...(args.voiceFreshness !== undefined ? { voice_freshness: args.voiceFreshness } : {}),
267
289
  ...(args.replaySuspect === true ? { replay_suspect: true } : {}),
290
+ // THE ATTRIBUTION MARKER (D3-07): rides the identity prefix —
291
+ // the list row's 8191-byte window must reach it so a missed
292
+ // stamp is visible even when the payload before it is bulky.
293
+ ...(args.attribution !== undefined && args.attribution !== "" ? { attribution: args.attribution } : {}),
294
+ // THE COLD-LOAD RETRY LEDGER (A1) — same optional-key law: the
295
+ // count rides only once spent.
296
+ ...(args.engineRetryCount !== undefined ? { engine_retry_count: args.engineRetryCount } : {}),
268
297
  error: args.error !== "" ? JSON.stringify(args.error).slice(0, 20000) : "",
269
298
  stages: args.stages,
270
299
  skipped_stages: [...args.skippedStages],