@melite/estate-queue 0.2.0-alpha → 0.2.3-rc.4

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 (87) hide show
  1. package/README.md +0 -5
  2. package/lib/bench.js +30 -3
  3. package/lib/cardsCompose.d.ts +31 -0
  4. package/lib/cardsCompose.js +65 -1
  5. package/lib/cardsDangling.js +17 -7
  6. package/lib/cardsDroppable.d.ts +11 -0
  7. package/lib/cardsDroppable.js +50 -0
  8. package/lib/cardsFacts.d.ts +37 -0
  9. package/lib/cardsFacts.js +47 -1
  10. package/lib/cardsLanes.d.ts +18 -0
  11. package/lib/cardsLanes.js +2 -1
  12. package/lib/cardsRegistry.d.ts +12 -20
  13. package/lib/cardsRegistry.js +288 -96
  14. package/lib/discloseRegistry.d.ts +5 -0
  15. package/lib/discloseRegistry.js +3 -3
  16. package/lib/filmLead.js +9 -1
  17. package/lib/filmMemoryWarn.js +1 -0
  18. package/lib/flowsData.d.ts +110 -21
  19. package/lib/flowsData.js +201 -23
  20. package/lib/flowsFamilyCompose.js +1 -0
  21. package/lib/flowsParamsOverlay.d.ts +8 -1
  22. package/lib/flowsParamsOverlay.js +47 -2
  23. package/lib/flowsRegistryRows.d.ts +0 -4
  24. package/lib/flowsRegistryRows.js +177 -371
  25. package/lib/index.d.ts +0 -1
  26. package/lib/index.js +0 -4
  27. package/lib/ledgerTail.js +1 -0
  28. package/lib/loadPlane.d.ts +46 -4
  29. package/lib/loadPlane.js +109 -7
  30. package/lib/loadRegistry.js +9 -2
  31. package/lib/managePlane.d.ts +5 -0
  32. package/lib/managePlane.js +412 -51
  33. package/lib/managePreflight.js +38 -6
  34. package/lib/manageProbe.d.ts +35 -0
  35. package/lib/manageProbe.js +141 -2
  36. package/lib/manageRegistry.d.ts +10 -0
  37. package/lib/manageRegistry.js +7 -1
  38. package/lib/managerRail.js +1 -0
  39. package/lib/queueCore.js +3 -1
  40. package/lib/queueLock.js +22 -10
  41. package/lib/queueResurrect.d.ts +0 -3
  42. package/lib/queueResurrect.js +5 -3
  43. package/lib/queueRetry.d.ts +12 -10
  44. package/lib/queueRetry.js +2 -4
  45. package/lib/queueSidecar.d.ts +36 -1
  46. package/lib/queueSidecar.js +30 -2
  47. package/lib/queueSubmit.d.ts +4 -1
  48. package/lib/queueSubmit.js +28 -5
  49. package/lib/queueSweep.d.ts +38 -11
  50. package/lib/queueSweep.js +73 -16
  51. package/lib/runsChange.d.ts +5 -4
  52. package/lib/runsExecute.d.ts +16 -1
  53. package/lib/runsExecute.js +102 -50
  54. package/lib/runsGates.d.ts +11 -3
  55. package/lib/runsGates.js +12 -3
  56. package/lib/runsList.d.ts +59 -3
  57. package/lib/runsList.js +228 -36
  58. package/lib/runsRegistry.d.ts +87 -6
  59. package/lib/runsRegistry.js +664 -98
  60. package/lib/runsSourceEcho.js +9 -3
  61. package/lib/runsStart.d.ts +6 -4
  62. package/lib/runsStart.js +32 -25
  63. package/lib/runsTypes.d.ts +54 -1
  64. package/lib/runsTypes.js +82 -3
  65. package/lib/runsValidate.d.ts +1 -0
  66. package/lib/runsValidate.js +5 -0
  67. package/lib/runsValidateArms.js +48 -2
  68. package/lib/runsValidateServe.js +15 -12
  69. package/lib/runsValidateShared.d.ts +8 -10
  70. package/lib/runsValidateShared.js +41 -15
  71. package/lib/runsValidateStages.d.ts +1 -1
  72. package/lib/runsValidateStages.js +90 -50
  73. package/lib/runtimeProvision.js +10 -2
  74. package/lib/skillAuthored.d.ts +50 -0
  75. package/lib/skillAuthored.js +178 -0
  76. package/lib/skillFs.js +3 -0
  77. package/lib/skillPlane.d.ts +40 -2
  78. package/lib/skillPlane.js +63 -13
  79. package/lib/skillRegistry.d.ts +24 -1
  80. package/lib/skillRegistry.js +69 -5
  81. package/lib/skillRows.d.ts +13 -3
  82. package/lib/skillRows.js +52 -9
  83. package/lib/vocab.d.ts +29 -0
  84. package/lib/vocab.js +78 -0
  85. package/package.json +24 -14
  86. package/lib/resurrect.d.ts +0 -6
  87. package/lib/resurrect.js +0 -18
package/lib/index.d.ts CHANGED
@@ -6,7 +6,6 @@ export { ManageGatewayService } from "./manageRegistry.js";
6
6
  export type { QueueConfig } from "./service.js";
7
7
  export * from "./vocab.js";
8
8
  export * from "./queue.js";
9
- export { bootSweep } from "./resurrect.js";
10
9
  export declare const name = "estate-queue";
11
10
  export declare const inject: string[];
12
11
  export declare function apply(ctx: Context, config?: QueueConfig): void;
package/lib/index.js CHANGED
@@ -11,10 +11,6 @@ export { RunsRuntimeService } from "./runsRegistry.js";
11
11
  export { ManageGatewayService } from "./manageRegistry.js";
12
12
  export * from "./vocab.js";
13
13
  export * from "./queue.js";
14
- // bootSweep twins (queue.ts core impl + resurrect.ts QueueRoots
15
- // wrapper): the explicit export wins over the stars — the wrapper
16
- // is the domain seam.
17
- export { bootSweep } from "./resurrect.js";
18
14
  import { FlowsSeatService } from "./flowsData.js";
19
15
  export const name = "estate-queue";
20
16
  export const inject = ["timer"];
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;
@@ -1,7 +1,7 @@
1
1
  import { emitModifierKinds } from "@melite/comfyui-cordis";
2
2
  import type { ModelsService } from "@melite/comfyui-cordis";
3
3
  import type { CardRegistryService } from "./cardsRegistry.js";
4
- import type { FlowsSeat } from "./flowsData.js";
4
+ import type { FlowsSeat, RegistryFlow } from "./flowsData.js";
5
5
  import { toolBaseRows } from "./toolProjection.js";
6
6
  import type { FamilyModelsSeat } from "./flowsFamilyCompose.js";
7
7
  /** A card id → its package dir. The cardPackages rows are package
@@ -54,7 +54,7 @@ export declare function skillLinesForCard(repo: string, cardId: string): Array<R
54
54
 
55
55
 
56
56
 
57
- export declare function skillLinesForFamilies(repo: string, fams: readonly string[]): Array<Record<string, unknown>>;
57
+ export declare function skillLinesForFamilies(repo: string, fams: readonly string[], stateRoot?: string): Array<Record<string, unknown>>;
58
58
  export declare function flowLeafDocs(repo: string, flowName: string): Array<{
59
59
  path: string;
60
60
  text: string;
@@ -80,7 +80,49 @@ export type CardModelsSeat = Pick<ModelsService, "allDecls" | "checkModelPresent
80
80
  * presence-marked, never a run-time surprise; LLM-powered enhance
81
81
  * stays the user's ✦ door, never served here). Throws LOUD
82
82
  * on unknown ids (the door maps to 404). */
83
- export declare function loadCard(repo: string, cards: CardRegistryService, modelsSeat: CardModelsSeat | null | undefined, cardId: string): Record<string, unknown>;
83
+ export declare function loadCard(repo: string, cards: CardRegistryService, modelsSeat: CardModelsSeat | null | undefined, cardId: string, stateRoot?: string): Record<string, unknown>;
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+ export declare function flowBenchStages(row: RegistryFlow, seat: FlowsSeat): {
120
+ flow: string;
121
+ stages: Array<Record<string, unknown>>;
122
+ } | {
123
+ flow: string;
124
+ refused: string;
125
+ };
84
126
  /** Melite load for a FLOW: the leaf agents md + the registry
85
127
  * signature (the tool overlay verbatim — ONE spelling, the same
86
128
  * object validate/start enforce; null when the row declares
@@ -89,6 +131,6 @@ export declare function loadCard(repo: string, cards: CardRegistryService, model
89
131
  /** @param modelsSeat the context's models service when mounted — the
90
132
  * flow's skill lines resolve through the seat the runs doors
91
133
  * thread (the lane-seat law); the booted singleton otherwise */
92
- export declare function loadFlow(repo: string, flowName: string, modelsSeat?: FamilyModelsSeat | null, flowsSeat?: FlowsSeat | null): Record<string, unknown>;
134
+ export declare function loadFlow(repo: string, flowName: string, modelsSeat?: FamilyModelsSeat | null, flowsSeat?: FlowsSeat | null, stateRoot?: string): Record<string, unknown>;
93
135
  /** First-non-blank query value (the catalogs qFirst shape). */
94
136
  //# sourceMappingURL=loadPlane.d.ts.map
package/lib/loadPlane.js CHANGED
@@ -13,7 +13,7 @@ import { join } from "node:path";
13
13
  import { cardPackages, emitModifierKinds, emitParamsSchema, getModel, modelsService, theService } from "@melite/comfyui-cordis";
14
14
  import { semanticModelEntries } from "@melite/comfyui-card-kit/semanticModelKnob";
15
15
  import { laneContractsFor } from "@melite/contracts/laneRelations";
16
- import { seedFlowsSeat } from "./flowsData.js";
16
+ import { flowInitialKeys, flowInitialGlosses, seedFlowsSeat, expandRegistryFlow } from "./flowsData.js";
17
17
  import { toolBaseRows } from "./toolProjection.js";
18
18
  import { modelRows, cardRows, engineDirs, wireSkill, findSkill } from "./skillPlane.js";
19
19
  import { laneFilesStatus } from "./cardsLanes.js";
@@ -257,7 +257,7 @@ export function skillLinesForCard(repo, cardId) {
257
257
 
258
258
 
259
259
 
260
- export function skillLinesForFamilies(repo, fams) {
260
+ export function skillLinesForFamilies(repo, fams, stateRoot) {
261
261
  const out = [];
262
262
  const seen = new Set();
263
263
 
@@ -269,7 +269,11 @@ export function skillLinesForFamilies(repo, fams) {
269
269
  for (const engine of engines) {
270
270
  let rows;
271
271
  try {
272
- rows = modelRows(engine);
272
+ // THE AUTHORED PLANE rides the same walk the write door landed
273
+ // in (skillAuthored): a skill the agent authored is discoverable
274
+ // from melite_load exactly as a tracked one — without the root
275
+ // the walk is the tracked tree alone (the opt-in law).
276
+ rows = modelRows(engine, stateRoot);
273
277
  }
274
278
  catch (e) {
275
279
 
@@ -312,6 +316,7 @@ export function flowLeafDocs(repo, flowName) {
312
316
  let entries;
313
317
  try {
314
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
315
320
  }
316
321
  catch {
317
322
  return;
@@ -377,7 +382,7 @@ export function skillLineForRef(repo, ref, modelsSeat, flowsSeat) {
377
382
  * presence-marked, never a run-time surprise; LLM-powered enhance
378
383
  * stays the user's ✦ door, never served here). Throws LOUD
379
384
  * on unknown ids (the door maps to 404). */
380
- export function loadCard(repo, cards, modelsSeat, cardId) {
385
+ export function loadCard(repo, cards, modelsSeat, cardId, stateRoot) {
381
386
  // ADMISSION BEFORE THE DEPENDENCY (the flow arm's own order at
382
387
  // loadFlow: the referent first, the seat that serves it second).
383
388
  // Reading the models seat first made an unknown card answer in the
@@ -413,6 +418,7 @@ export function loadCard(repo, cards, modelsSeat, cardId) {
413
418
  try {
414
419
  const rows = models.resolveCatalogArtifact(fam, "", "", repo);
415
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
416
422
  }
417
423
  catch {
418
424
  present = false;
@@ -455,7 +461,7 @@ export function loadCard(repo, cards, modelsSeat, cardId) {
455
461
 
456
462
  // the boarded families' model skills ride the same bundle —
457
463
  // no second hunt before compose.
458
- ...skillLinesForFamilies(repo, def.boarded),
464
+ ...skillLinesForFamilies(repo, def.boarded, stateRoot),
459
465
  ],
460
466
  model_hints: hints,
461
467
  pack_hints,
@@ -472,6 +478,74 @@ export function loadCard(repo, cards, modelsSeat, cardId) {
472
478
  bundle["digest"] = bundleDigest(bundle);
473
479
  return bundle;
474
480
  }
481
+
482
+
483
+
484
+
485
+
486
+
487
+
488
+
489
+
490
+
491
+
492
+
493
+
494
+
495
+
496
+
497
+
498
+
499
+
500
+
501
+
502
+
503
+
504
+
505
+
506
+
507
+
508
+
509
+
510
+
511
+
512
+
513
+
514
+
515
+
516
+ export function flowBenchStages(row, seat) {
517
+ for (const st of row.stages) {
518
+ if (st.skipWhen !== null) {
519
+ return {
520
+ flow: row.id,
521
+ refused: "stage '" + st.id + "' carries skip_when — the bench holds static card rows, never a run-conditioned stage count (the {flow} door owns the skip law)",
522
+ };
523
+ }
524
+ if (st.card === "") {
525
+ const plane = st.family !== ""
526
+ ? "the family plane (family '" + st.family + "' action '" + st.action + "' — the DECL composes its nodes at expansion)"
527
+ : "an engine verb (" + st.engine + " — the runs door drives it directly)";
528
+ return {
529
+ flow: row.id,
530
+ refused: "stage '" + st.id + "' composes on " + plane + " and has no card seat to land as (the {flow} door runs it)",
531
+ };
532
+ }
533
+ }
534
+ const expanded = expandRegistryFlow(row, seat);
535
+ const benchIdOf = new Map(expanded.stages.map((st, i) => [st.id, "s_" + String(i)]));
536
+ const stages = expanded.stages.map((st, i) => ({
537
+ id: "s_" + String(i),
538
+ card: st.card,
539
+ engine: st.engine,
540
+ description: st.description,
541
+ params: structuredClone(st.params),
542
+ inputs: Object.fromEntries(Object.entries(st.inputs).map(([chan, edge]) => "initial" in edge
543
+ ? [chan, { initial: edge.initial }]
544
+ : [chan, { stage: benchIdOf.get(edge.stage) ?? edge.stage, output: edge.output }])),
545
+ outputs: structuredClone(st.outputs),
546
+ }));
547
+ return { flow: row.id, stages };
548
+ }
475
549
  /** Melite load for a FLOW: the leaf agents md + the registry
476
550
  * signature (the tool overlay verbatim — ONE spelling, the same
477
551
  * object validate/start enforce; null when the row declares
@@ -480,7 +554,7 @@ export function loadCard(repo, cards, modelsSeat, cardId) {
480
554
  /** @param modelsSeat the context's models service when mounted — the
481
555
  * flow's skill lines resolve through the seat the runs doors
482
556
  * thread (the lane-seat law); the booted singleton otherwise */
483
- export function loadFlow(repo, flowName, modelsSeat, flowsSeat) {
557
+ export function loadFlow(repo, flowName, modelsSeat, flowsSeat, stateRoot) {
484
558
  const row = (flowsSeat ?? seedFlowsSeat()).get(flowName);
485
559
  if (row === undefined)
486
560
  throw new Error(`disclose: unknown flow '${flowName}'`);
@@ -517,7 +591,7 @@ export function loadFlow(repo, flowName, modelsSeat, flowsSeat) {
517
591
  }
518
592
  };
519
593
  const pushFamilyLines = (fam) => {
520
- for (const line of skillLinesForFamilies(repo, [fam])) {
594
+ for (const line of skillLinesForFamilies(repo, [fam], stateRoot)) {
521
595
  const id = String(line.id);
522
596
  if (id === "" || seen.has(id))
523
597
  continue;
@@ -567,11 +641,39 @@ export function loadFlow(repo, flowName, modelsSeat, flowsSeat) {
567
641
  required: row.tool.required,
568
642
  overlays: row.tool.overlays,
569
643
  },
644
+ // THE INITIAL SEATS NAMED AT THE TOP (F57, the leaf-naming law:
645
+ // leaves and bundles name their initial keys, never teach them
646
+ // through seam errors): the validators (key → kind) plus the
647
+ // required roster, derived from the row — the spell-stem seats
648
+ // ($photo→photo) an open reads BEFORE the first press. The
649
+ // GLOSSES (the anny-params typed-array seat) carry each kind's
650
+ // shape one level deeper: bake_params names the dialect doc and
651
+ // its OBJECT spelling, so the 139-float estimated transport is
652
+ // taught, never hand-typed as a string.
653
+ initials: {
654
+ validators: { ...row.initialValidators },
655
+ required: row.requiredInitials?.slice() ?? [],
656
+ keys: flowInitialKeys(row),
657
+ glosses: flowInitialGlosses(row),
658
+ },
570
659
  agents: flowLeafDocs(repo, flowName),
571
660
  stages,
572
661
  refs: row.skillRefs.slice(),
573
662
  skills,
574
663
  };
664
+ // THE FLOW COMES OUT AS CARDS (flows-are-compositions slice C): a
665
+ // card-stage flow serves its bench rows on the bundle — ONE
666
+ // materialization body (the same expansion the {flow} door
667
+ // composes), landable as a single write by melite_construct load
668
+ // (agent mode) or the run door's press (the delegated boot).
669
+ // Absent = the
670
+ // flow's stages hold no card seats (family action / engine verb /
671
+ // skip_when) and it keeps the run-door face — the slim `stages`
672
+ // list above still names every stage and its plane.
673
+ const materialized = flowBenchStages(row, flowsSeat ?? seedFlowsSeat());
674
+ if (!("refused" in materialized)) {
675
+ bundle["bench_stages"] = materialized.stages;
676
+ }
575
677
  bundle["digest"] = bundleDigest(bundle);
576
678
  return bundle;
577
679
  }
@@ -24,6 +24,13 @@ export class LoadResolverService extends Service {
24
24
  throw new Error("load needs name (discover it first)");
25
25
  }
26
26
  const repo = resolveRepoRoot();
27
+ // THE AUTHORED SKILL PLANE'S READER: the same state root the write
28
+ // door (melite_skill_write) and the skill read walk ride — a
29
+ // skill the agent authored is disclosed by melite_load exactly as
30
+
31
+ // not see it). Absent queue seat = the tracked tree alone.
32
+ const queue = this.ctx.get("queue");
33
+ const stateRoot = queue?.stateRoot;
27
34
  if (inferenceType === "flow") {
28
35
  // The flow bundle composes from the LANES seat (the lane-seat
29
36
  // law, audit finding 4): the same read the runs doors thread, so
@@ -31,7 +38,7 @@ export class LoadResolverService extends Service {
31
38
  // is the injector API (an unmounted seat reads undefined and the
32
39
  // plane degrades to the booted singleton).
33
40
  return {
34
- bundle: loadFlow(repo, name, this.ctx.get("models"), this.ctx.get("meliteFlows")),
41
+ bundle: loadFlow(repo, name, this.ctx.get("models"), this.ctx.get("meliteFlows"), stateRoot),
35
42
  };
36
43
  }
37
44
  // The card arm reads the LANE's seat for the same reason the flow
@@ -40,7 +47,7 @@ export class LoadResolverService extends Service {
40
47
  // singleton — on a cold boot the singleton's own read can refuse
41
48
  // "models service not booted" while this lane is fully seated.
42
49
  return {
43
- bundle: loadCard(repo, this.ctx.cardRegistry, this.ctx.get("models"), name),
50
+ bundle: loadCard(repo, this.ctx.cardRegistry, this.ctx.get("models"), name, stateRoot),
44
51
  };
45
52
  }
46
53
  }
@@ -143,6 +143,11 @@ export interface Req {
143
143
 
144
144
 
145
145
 
146
+ default_strength: number;
147
+
148
+
149
+
150
+
146
151
  sha256: string;
147
152
  /** THE ACQUIRE-WEIGHT POLL KEY (F9 run-press acquisition): the
148
153
  * tracker's poll carries ONLY this — the start carries the model