@melite/estate-queue 0.2.0-alpha → 0.2.2-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/README.md +0 -5
  2. package/lib/cardsCompose.d.ts +31 -0
  3. package/lib/cardsCompose.js +55 -0
  4. package/lib/cardsRegistry.d.ts +5 -2
  5. package/lib/cardsRegistry.js +160 -3
  6. package/lib/discloseRegistry.d.ts +5 -0
  7. package/lib/discloseRegistry.js +3 -3
  8. package/lib/flowsData.d.ts +77 -21
  9. package/lib/flowsData.js +156 -21
  10. package/lib/flowsRegistryRows.d.ts +0 -4
  11. package/lib/flowsRegistryRows.js +137 -351
  12. package/lib/index.d.ts +0 -1
  13. package/lib/index.js +0 -4
  14. package/lib/loadPlane.d.ts +46 -4
  15. package/lib/loadPlane.js +107 -7
  16. package/lib/loadRegistry.js +9 -2
  17. package/lib/managePlane.d.ts +5 -0
  18. package/lib/managePlane.js +404 -49
  19. package/lib/managePreflight.js +38 -6
  20. package/lib/manageProbe.d.ts +35 -0
  21. package/lib/manageProbe.js +110 -0
  22. package/lib/queueLock.js +19 -10
  23. package/lib/queueResurrect.d.ts +0 -3
  24. package/lib/queueResurrect.js +0 -3
  25. package/lib/queueRetry.d.ts +12 -10
  26. package/lib/queueRetry.js +2 -4
  27. package/lib/queueSidecar.d.ts +12 -0
  28. package/lib/queueSidecar.js +15 -0
  29. package/lib/queueSubmit.d.ts +4 -1
  30. package/lib/queueSubmit.js +28 -5
  31. package/lib/runsExecute.d.ts +16 -1
  32. package/lib/runsExecute.js +63 -45
  33. package/lib/runsGates.d.ts +11 -3
  34. package/lib/runsGates.js +11 -3
  35. package/lib/runsList.d.ts +59 -3
  36. package/lib/runsList.js +217 -36
  37. package/lib/runsRegistry.d.ts +58 -3
  38. package/lib/runsRegistry.js +479 -92
  39. package/lib/runsStart.d.ts +6 -4
  40. package/lib/runsStart.js +32 -25
  41. package/lib/runsTypes.d.ts +19 -1
  42. package/lib/runsTypes.js +40 -3
  43. package/lib/runsValidate.d.ts +1 -0
  44. package/lib/runsValidate.js +5 -0
  45. package/lib/runsValidateArms.js +25 -0
  46. package/lib/runsValidateServe.js +15 -12
  47. package/lib/runsValidateShared.d.ts +8 -10
  48. package/lib/runsValidateShared.js +41 -15
  49. package/lib/runsValidateStages.d.ts +1 -1
  50. package/lib/runsValidateStages.js +90 -50
  51. package/lib/skillAuthored.d.ts +50 -0
  52. package/lib/skillAuthored.js +178 -0
  53. package/lib/skillPlane.d.ts +40 -2
  54. package/lib/skillPlane.js +63 -13
  55. package/lib/skillRegistry.d.ts +24 -1
  56. package/lib/skillRegistry.js +69 -5
  57. package/lib/skillRows.d.ts +13 -3
  58. package/lib/skillRows.js +42 -3
  59. package/package.json +24 -14
  60. package/lib/resurrect.d.ts +0 -6
  61. package/lib/resurrect.js +0 -18
@@ -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
 
@@ -377,7 +381,7 @@ export function skillLineForRef(repo, ref, modelsSeat, flowsSeat) {
377
381
  * presence-marked, never a run-time surprise; LLM-powered enhance
378
382
  * stays the user's ✦ door, never served here). Throws LOUD
379
383
  * on unknown ids (the door maps to 404). */
380
- export function loadCard(repo, cards, modelsSeat, cardId) {
384
+ export function loadCard(repo, cards, modelsSeat, cardId, stateRoot) {
381
385
  // ADMISSION BEFORE THE DEPENDENCY (the flow arm's own order at
382
386
  // loadFlow: the referent first, the seat that serves it second).
383
387
  // Reading the models seat first made an unknown card answer in the
@@ -455,7 +459,7 @@ export function loadCard(repo, cards, modelsSeat, cardId) {
455
459
 
456
460
  // the boarded families' model skills ride the same bundle —
457
461
  // no second hunt before compose.
458
- ...skillLinesForFamilies(repo, def.boarded),
462
+ ...skillLinesForFamilies(repo, def.boarded, stateRoot),
459
463
  ],
460
464
  model_hints: hints,
461
465
  pack_hints,
@@ -472,6 +476,74 @@ export function loadCard(repo, cards, modelsSeat, cardId) {
472
476
  bundle["digest"] = bundleDigest(bundle);
473
477
  return bundle;
474
478
  }
479
+
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
+ export function flowBenchStages(row, seat) {
515
+ for (const st of row.stages) {
516
+ if (st.skipWhen !== null) {
517
+ return {
518
+ flow: row.id,
519
+ 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)",
520
+ };
521
+ }
522
+ if (st.card === "") {
523
+ const plane = st.family !== ""
524
+ ? "the family plane (family '" + st.family + "' action '" + st.action + "' — the DECL composes its nodes at expansion)"
525
+ : "an engine verb (" + st.engine + " — the runs door drives it directly)";
526
+ return {
527
+ flow: row.id,
528
+ refused: "stage '" + st.id + "' composes on " + plane + " and has no card seat to land as (the {flow} door runs it)",
529
+ };
530
+ }
531
+ }
532
+ const expanded = expandRegistryFlow(row, seat);
533
+ const benchIdOf = new Map(expanded.stages.map((st, i) => [st.id, "s_" + String(i)]));
534
+ const stages = expanded.stages.map((st, i) => ({
535
+ id: "s_" + String(i),
536
+ card: st.card,
537
+ engine: st.engine,
538
+ description: st.description,
539
+ params: structuredClone(st.params),
540
+ inputs: Object.fromEntries(Object.entries(st.inputs).map(([chan, edge]) => "initial" in edge
541
+ ? [chan, { initial: edge.initial }]
542
+ : [chan, { stage: benchIdOf.get(edge.stage) ?? edge.stage, output: edge.output }])),
543
+ outputs: structuredClone(st.outputs),
544
+ }));
545
+ return { flow: row.id, stages };
546
+ }
475
547
  /** Melite load for a FLOW: the leaf agents md + the registry
476
548
  * signature (the tool overlay verbatim — ONE spelling, the same
477
549
  * object validate/start enforce; null when the row declares
@@ -480,7 +552,7 @@ export function loadCard(repo, cards, modelsSeat, cardId) {
480
552
  /** @param modelsSeat the context's models service when mounted — the
481
553
  * flow's skill lines resolve through the seat the runs doors
482
554
  * thread (the lane-seat law); the booted singleton otherwise */
483
- export function loadFlow(repo, flowName, modelsSeat, flowsSeat) {
555
+ export function loadFlow(repo, flowName, modelsSeat, flowsSeat, stateRoot) {
484
556
  const row = (flowsSeat ?? seedFlowsSeat()).get(flowName);
485
557
  if (row === undefined)
486
558
  throw new Error(`disclose: unknown flow '${flowName}'`);
@@ -517,7 +589,7 @@ export function loadFlow(repo, flowName, modelsSeat, flowsSeat) {
517
589
  }
518
590
  };
519
591
  const pushFamilyLines = (fam) => {
520
- for (const line of skillLinesForFamilies(repo, [fam])) {
592
+ for (const line of skillLinesForFamilies(repo, [fam], stateRoot)) {
521
593
  const id = String(line.id);
522
594
  if (id === "" || seen.has(id))
523
595
  continue;
@@ -567,11 +639,39 @@ export function loadFlow(repo, flowName, modelsSeat, flowsSeat) {
567
639
  required: row.tool.required,
568
640
  overlays: row.tool.overlays,
569
641
  },
642
+ // THE INITIAL SEATS NAMED AT THE TOP (F57, the leaf-naming law:
643
+ // leaves and bundles name their initial keys, never teach them
644
+ // through seam errors): the validators (key → kind) plus the
645
+ // required roster, derived from the row — the spell-stem seats
646
+ // ($photo→photo) an open reads BEFORE the first press. The
647
+ // GLOSSES (the anny-params typed-array seat) carry each kind's
648
+ // shape one level deeper: bake_params names the dialect doc and
649
+ // its OBJECT spelling, so the 139-float estimated transport is
650
+ // taught, never hand-typed as a string.
651
+ initials: {
652
+ validators: { ...row.initialValidators },
653
+ required: row.requiredInitials?.slice() ?? [],
654
+ keys: flowInitialKeys(row),
655
+ glosses: flowInitialGlosses(row),
656
+ },
570
657
  agents: flowLeafDocs(repo, flowName),
571
658
  stages,
572
659
  refs: row.skillRefs.slice(),
573
660
  skills,
574
661
  };
662
+ // THE FLOW COMES OUT AS CARDS (flows-are-compositions slice C): a
663
+ // card-stage flow serves its bench rows on the bundle — ONE
664
+ // materialization body (the same expansion the {flow} door
665
+ // composes), landable as a single write by melite_construct load
666
+ // (agent mode) or the run door's press (the delegated boot).
667
+ // Absent = the
668
+ // flow's stages hold no card seats (family action / engine verb /
669
+ // skip_when) and it keeps the run-door face — the slim `stages`
670
+ // list above still names every stage and its plane.
671
+ const materialized = flowBenchStages(row, flowsSeat ?? seedFlowsSeat());
672
+ if (!("refused" in materialized)) {
673
+ bundle["bench_stages"] = materialized.stages;
674
+ }
575
675
  bundle["digest"] = bundleDigest(bundle);
576
676
  return bundle;
577
677
  }
@@ -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