@melite/estate-queue 0.2.2-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 (49) hide show
  1. package/lib/bench.js +30 -3
  2. package/lib/cardsCompose.js +10 -1
  3. package/lib/cardsDangling.js +17 -7
  4. package/lib/cardsDroppable.d.ts +11 -0
  5. package/lib/cardsDroppable.js +50 -0
  6. package/lib/cardsFacts.d.ts +37 -0
  7. package/lib/cardsFacts.js +47 -1
  8. package/lib/cardsLanes.d.ts +18 -0
  9. package/lib/cardsLanes.js +2 -1
  10. package/lib/cardsRegistry.d.ts +7 -18
  11. package/lib/cardsRegistry.js +128 -93
  12. package/lib/filmLead.js +9 -1
  13. package/lib/filmMemoryWarn.js +1 -0
  14. package/lib/flowsData.d.ts +33 -0
  15. package/lib/flowsData.js +45 -2
  16. package/lib/flowsFamilyCompose.js +1 -0
  17. package/lib/flowsParamsOverlay.d.ts +8 -1
  18. package/lib/flowsParamsOverlay.js +47 -2
  19. package/lib/flowsRegistryRows.js +40 -20
  20. package/lib/ledgerTail.js +1 -0
  21. package/lib/loadPlane.js +2 -0
  22. package/lib/managePlane.js +8 -2
  23. package/lib/manageProbe.js +33 -4
  24. package/lib/manageRegistry.d.ts +10 -0
  25. package/lib/manageRegistry.js +7 -1
  26. package/lib/managerRail.js +1 -0
  27. package/lib/queueCore.js +3 -1
  28. package/lib/queueLock.js +3 -0
  29. package/lib/queueResurrect.js +5 -0
  30. package/lib/queueSidecar.d.ts +24 -1
  31. package/lib/queueSidecar.js +15 -2
  32. package/lib/queueSweep.d.ts +38 -11
  33. package/lib/queueSweep.js +73 -16
  34. package/lib/runsChange.d.ts +5 -4
  35. package/lib/runsExecute.js +39 -5
  36. package/lib/runsGates.js +1 -0
  37. package/lib/runsList.js +11 -0
  38. package/lib/runsRegistry.d.ts +29 -3
  39. package/lib/runsRegistry.js +187 -8
  40. package/lib/runsSourceEcho.js +9 -3
  41. package/lib/runsTypes.d.ts +35 -0
  42. package/lib/runsTypes.js +42 -0
  43. package/lib/runsValidateArms.js +23 -2
  44. package/lib/runtimeProvision.js +10 -2
  45. package/lib/skillFs.js +3 -0
  46. package/lib/skillRows.js +10 -6
  47. package/lib/vocab.d.ts +29 -0
  48. package/lib/vocab.js +78 -0
  49. package/package.json +7 -7
package/lib/bench.js CHANGED
@@ -14,7 +14,7 @@
14
14
  // PROCESS on globalThis so the estate's re-apply churn (fresh
15
15
  // module instances every ~21s) can never reset it.
16
16
  import { readFileSync, readdirSync, statSync } from "node:fs";
17
- import { join } from "node:path";
17
+ import { dirname, join } from "node:path";
18
18
  /** The process's melite boot instant — pinned once, survives the
19
19
  * estate's re-apply churn (each re-apply re-imports modules; the
20
20
  * globalThis pin keeps ONE cutoff per process). */
@@ -41,6 +41,29 @@ export function benchDir(storageRoot) {
41
41
  // caller and the store resolve the SAME tree.
42
42
  return join(storageRoot ?? benchStorageRoot(), "drafts", "docs");
43
43
  }
44
+ /** Through-a-file probe: true when some existing prefix of `p` is a
45
+ * FILE — `p` can never resolve to a directory. The errno taxonomy
46
+ * splits by platform here (ENOTDIR on posix, ENOENT on Windows), so
47
+ * the roster catch consults this instead of trusting the code alone:
48
+ * a blocked roster is never the tolerated absence on any lane. */
49
+ function blockedByFileAncestor(p) {
50
+ let cur = p;
51
+ for (;;) {
52
+ try {
53
+ return statSync(cur).isFile();
54
+ }
55
+ catch (e) {
56
+ /* v8 ignore next 1 -- windows-only reach: inside the ENOENT climb a foreign errno (EACCES on a locked ancestor) answers "not blocked", never crashes the roster read; posix hands foreign errnos to the outer catch before this helper runs */
57
+ if (e.code !== "ENOENT")
58
+ return false;
59
+ }
60
+ const parent = dirname(cur);
61
+ /* v8 ignore next 2 -- windows-only reach: the climb exhausts at a drive/UNC root (stat of a bare drive letter throws); posix always resolves a dir before the root stop */
62
+ if (parent === cur)
63
+ return false;
64
+ cur = parent;
65
+ }
66
+ }
44
67
 
45
68
 
46
69
 
@@ -80,8 +103,12 @@ export function benchPicksSync(storageRoot) {
80
103
  // the roster dir may not exist yet (first bench, nothing
81
104
  // persisted) or may be unreadable — both mean "no picks to
82
105
  // list", the function's own empty answer, never a crash of a
83
- // census/read path that must degrade to nothing
84
- if (error.code !== "ENOENT") {
106
+ // census/read path that must degrade to nothing.
107
+ // ENOENT taxonomy split (windows-portability): a through-a-FILE
108
+ // roster path reports ENOENT on Windows (ENOTDIR on posix) — a
109
+ // blocked roster is never the tolerated absence on any lane.
110
+ const code = error.code;
111
+ if (code !== "ENOENT" || blockedByFileAncestor(dir)) {
85
112
  console.error("[benchPicksSync] roster read failed:", error);
86
113
  }
87
114
  return [];
@@ -4,6 +4,7 @@
4
4
  // deps; no Service state beyond the accessors the seat passes.
5
5
  import { ComfyUIService, resolveEngineBaseUrl, composeCards, ComposeRefusal, checkModelPresent, owningAtom } from "@melite/comfyui-cordis";
6
6
  import { cardAdmits, familyLanesOf } from "./cardsFacts.js";
7
+ import { ESTATE_NAMING_ROW } from "@melite/contracts/formSpec";
7
8
  export { cardAdmits };
8
9
  import { EngineContext, composeModPlane, loadFacts, theService } from "@melite/comfyui-cordis";
9
10
  import { CardArmError, phaseRefusal } from "./cardsArmError.js";
@@ -199,7 +200,15 @@ export function admissionRefusal(deps, card, fam, lifted, phase, facts) {
199
200
  // surface is empty here; the knobs+admits rows still gate
200
201
  // (compose's own admission gate re-judges with the fold).
201
202
  }
202
- const admitted = (key) => cardAdmits(decl, modNames, key);
203
+ // THE ESTATE NAMING ROW'S ADMISSION (queue 12's ONE SEAT law): the
204
+ // faces teach the row on every card declaring none of its own (the
205
+ // UI naming seat + the agent params_schema property, one spelling
206
+ // ESTATE_NAMING_ROW), and the stage plane already carries the key —
207
+ // STAGE_RESERVED_PARAMS lifts it beside the graph, the settle mints
208
+ // the gallery labels from it. A face that teaches a knob this door
209
+ // refuses is the no-cheat lie; the declared row (h3's slug) already
210
+ // admits through schemaNames — this arm serves every OTHER card.
211
+ const admitted = (key) => key === ESTATE_NAMING_ROW.name || cardAdmits(decl, modNames, key);
203
212
  const unknown = Object.keys(lifted).filter((k) => !admitted(k)).sort();
204
213
  if (unknown.length > 0) {
205
214
  const hints = unknown
@@ -19,7 +19,7 @@
19
19
  // or the gallery's artifact face (/infer-gallery/artifact?path=
20
20
  // — the same tail the guard and the engine stage).
21
21
  import { isFile } from "./skillFs.js";
22
- import { join, relative, resolve, sep } from "node:path";
22
+ import { isAbsolute, join, relative, resolve, sep } from "node:path";
23
23
  import { ASSET_RUNS_PREFIX, MEDIA_RUNS_PREFIX, galleryTail } from "./runsSourceEcho.js";
24
24
  import { segmentConfined } from "@melite/contracts/mediaKinds";
25
25
  import { searchedVoice } from "./rootsManifest.js";
@@ -112,12 +112,17 @@ export function resolveArtifactFile(ref, outRoot) {
112
112
  }
113
113
  cand = join(outRoot, rel.join("/"));
114
114
  }
115
- else if (raw.includes("/") && !raw.startsWith("/")) {
116
- cand = join(outRoot, raw);
117
- }
118
- else if (raw.startsWith("/")) {
115
+ else if (isAbsolute(raw)) {
116
+ // isAbsolute, not startsWith("/"): a Windows-harvested ref is
117
+ // drive-rooted — the posix-only gate misfiled it as a bare name
118
+
119
+ // candidate on either platform; the runs-relative face below
120
+ // keeps its wire spelling.
119
121
  cand = raw;
120
122
  }
123
+ else if (raw.includes("/")) {
124
+ cand = join(outRoot, raw);
125
+ }
121
126
  else {
122
127
  throw new Error("artifact ref is a bare " +
123
128
  JSON.stringify(raw) +
@@ -130,14 +135,19 @@ export function resolveArtifactFile(ref, outRoot) {
130
135
  const absCand = resolve(cand);
131
136
  const absRoot = resolve(outRoot);
132
137
  const relToRoot = relative(absRoot, absCand);
133
- if (relToRoot === ".." || relToRoot.startsWith(".." + sep)) {
138
+ // isAbsolute(relToRoot): relative() cannot cross a Windows drive —
139
+ // a candidate on another drive comes back ABSOLUTE, and the old
140
+ // ".."-only test passed it as inside (the drive-join cure,
141
+
142
+ // added disjunct is inert there.
143
+ if (isAbsolute(relToRoot) || relToRoot === ".." || relToRoot.startsWith(".." + sep)) {
134
144
  throw new Error("artifact ref escapes the output root: " + JSON.stringify(raw));
135
145
  }
136
146
  if (!isFile(absCand)) {
137
147
  // The run id rides the ref's own first segment for every
138
148
  // prefix-URL, gallery-URL and runs-relative shape; an absolute
139
149
  // path carries no run, so "?" names that absence.
140
- const run = prefix !== null || gallery !== null || (raw.includes("/") && !raw.startsWith("/"))
150
+ const run = prefix !== null || gallery !== null || (raw.includes("/") && !isAbsolute(raw))
141
151
  ? (prefix !== null ? raw.slice(prefix.length) : gallery !== null ? gallery : raw).split("/", 2)[0] // split yields >= 1
142
152
  : "?";
143
153
  throw new Error("artifact not found on disk: " + JSON.stringify(raw) + " (looked up " + absCand + ") — the " +
@@ -0,0 +1,11 @@
1
+ export declare const CARD_DROPPABLE: Readonly<Record<string, Readonly<Record<string, string>>>>;
2
+ /** The unjustified drops: receipt dropped[] keys NOT declared for
3
+ * the card — the exact keys the wall reds on. Empty = every drop
4
+ * carries a declared reason.
5
+ * @param pair the receipt (any GraphReceiptPair-shaped row — the
6
+ * run fold or a per-stage row)
7
+ * @param card the card id the registry serves */
8
+ export declare function unjustifiedDropped(pair: {
9
+ readonly dropped: readonly string[];
10
+ }, card: string): string[];
11
+ //# sourceMappingURL=cardsDroppable.d.ts.map
@@ -0,0 +1,50 @@
1
+ // cardsDroppable.ts — THE DROPPED-KNOB ALLOWABILITY LAW (F3-04,
2
+
3
+ // `dropped:["mode"]` — a declared param fell out of compilation,
4
+ // receipted but judged by nothing).
5
+ //
6
+ // THE LAW: a doc scalar the compose drops is a receipt FACT (verdict
7
+ // "partial", the key named) — but a knob that falls out of
8
+ // compilation UNDECLARED is exactly the silent-drop class the
9
+ // receipt exists to police. Every card that knowingly drops a
10
+ // scalar declares it here, WITH THE REASON it can never ride the
11
+ // graph; the receipt wall reds any served receipt whose dropped[]
12
+ // holds a key outside its card's declared set. The declaration is
13
+ // the ALLOWLIST, never the receipt: an undeclared drop is a finding
14
+ // (a wall red or an operator's watch), not a compose refusal — the
15
+ // compose gate owns refusals (queueSidecar's own law).
16
+ //
17
+ // SEAT: beside the receipt's estate home, keyed by the card id the
18
+ // registry serves (defsSync) — the wall sweeps every entry against
19
+ // the card's own schema dict, so a declaration for a card that does
20
+ // not exist, or a knob the card does not serve, reds (D1: the
21
+ // declaration can never drift off the served surface).
22
+ export const CARD_DROPPABLE = {
23
+ // RIG-P0-15 (friction3): mode:"auto" dropped, nodes:2 — harmless
24
+ // ONLY because mode is the lane router, not a knob the graph
25
+ // reads: compose selects the auto/copy LANE by it (card.ts
26
+ // `when: mode === 'auto'` / `!== 'auto'`), so no graph input ever
27
+ // spells it. Declared so the receipt's partial verdict carries its
28
+ // reason instead of reading as a fall-out-of-compilation.
29
+ rig: {
30
+ mode: "the lane router: compose selects the auto/copy lane by it (visible_when/when), never a graph scalar — no node input spells it",
31
+ },
32
+ // The receipt wall's ARM-e control (the real music door): the
33
+ // admitted body carries model but no graph input spells the bare
34
+ // family id — the routing residue, named there and here, never
35
+ // hidden.
36
+ music: {
37
+ model: "the routing residue: the admitted body carries the family id but no graph input spells the bare id (the receipt wall's ARM-e control names it)",
38
+ },
39
+ };
40
+ /** The unjustified drops: receipt dropped[] keys NOT declared for
41
+ * the card — the exact keys the wall reds on. Empty = every drop
42
+ * carries a declared reason.
43
+ * @param pair the receipt (any GraphReceiptPair-shaped row — the
44
+ * run fold or a per-stage row)
45
+ * @param card the card id the registry serves */
46
+ export function unjustifiedDropped(pair, card) {
47
+ const declared = CARD_DROPPABLE[card] ?? {};
48
+ return pair.dropped.filter((k) => !(k in declared));
49
+ }
50
+ //# sourceMappingURL=cardsDroppable.js.map
@@ -100,4 +100,41 @@ export declare function deriveDecls(defs: Map<string, CardDefinition>, facts: Re
100
100
  * what a card admits. Lives on the leaf: every consumer already
101
101
  * imports these row types, no seat-to-seat cycle. */
102
102
  export declare function cardAdmits(decl: CardDeclRow | undefined, modNames: ReadonlySet<string>, key: string): boolean;
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ export declare function stageReservedKeyLifts(decl: CardDeclRow | undefined, key: string): boolean;
124
+ /** THE JUDGED COPY a compose/admission seat hands its card walk when
125
+ * the row carries stage-reserved policy keys (stageReservedKeyLifts
126
+ * above): the reserved set lifts OUT, everything else rides verbatim.
127
+ * The stored row is NEVER this copy's business — the store is its
128
+ * own truth home; only the judged view sheds the policy keys. The
129
+ * seats: the write door's admission (cardsRegistry
130
+ * admitStageRelations) and the validate walk's phase1Card call
131
+ * (runsValidateArms — the pre-mint compose gate's dry walk, the
132
+ * bench add door's second judge). The run compose's own carry
133
+ * (runsRegistry composeCardStageRow) splits its bags on the same
134
+ * predicate.
135
+ * @param decl the card's DECL projection (undefined lifts all
136
+ * reserved keys — no card admits a policy key by default).
137
+ * @param params the row's params bag.
138
+ * @returns the judged copy (never the caller's record). */
139
+ export declare function liftStageReservedForAdmission(decl: CardDeclRow | undefined, params: Record<string, unknown>): Record<string, unknown>;
103
140
  //# sourceMappingURL=cardsFacts.d.ts.map
package/lib/cardsFacts.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // facts/decl plane owns model-facts.json reads and the pure
4
4
  // defs+facts->rows derivation. No Service state — module truth.
5
5
  import { join } from "node:path";
6
- import { getModel, resolveRepoRoot } from "@melite/comfyui-cordis";
6
+ import { getModel, resolveRepoRoot, STAGE_RESERVED_PARAMS } from "@melite/comfyui-cordis";
7
7
  /** The window-family lanes a card's boarded families derive — the
8
8
  * vocabulary an agent confuses for a variant (the transcript's
9
9
  * step-8 burn: variant 't4r' read "unknown variant"). Reads the
@@ -99,4 +99,50 @@ export function cardAdmits(decl, modNames, key) {
99
99
  modNames.has(key) ||
100
100
  decl.admits.some((a) => a === key || (a.endsWith("*") && key.startsWith(a.slice(0, -1)))));
101
101
  }
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+ export function stageReservedKeyLifts(decl, key) {
123
+ return STAGE_RESERVED_PARAMS.includes(key) && !cardAdmits(decl, new Set(), key);
124
+ }
125
+ /** THE JUDGED COPY a compose/admission seat hands its card walk when
126
+ * the row carries stage-reserved policy keys (stageReservedKeyLifts
127
+ * above): the reserved set lifts OUT, everything else rides verbatim.
128
+ * The stored row is NEVER this copy's business — the store is its
129
+ * own truth home; only the judged view sheds the policy keys. The
130
+ * seats: the write door's admission (cardsRegistry
131
+ * admitStageRelations) and the validate walk's phase1Card call
132
+ * (runsValidateArms — the pre-mint compose gate's dry walk, the
133
+ * bench add door's second judge). The run compose's own carry
134
+ * (runsRegistry composeCardStageRow) splits its bags on the same
135
+ * predicate.
136
+ * @param decl the card's DECL projection (undefined lifts all
137
+ * reserved keys — no card admits a policy key by default).
138
+ * @param params the row's params bag.
139
+ * @returns the judged copy (never the caller's record). */
140
+ export function liftStageReservedForAdmission(decl, params) {
141
+ const judged = { ...params };
142
+ for (const k of Object.keys(judged)) {
143
+ if (stageReservedKeyLifts(decl, k))
144
+ delete judged[k];
145
+ }
146
+ return judged;
147
+ }
102
148
  //# sourceMappingURL=cardsFacts.js.map
@@ -37,6 +37,24 @@ export declare function lanePresenceRefusal(fam: string, body?: Record<string, u
37
37
 
38
38
 
39
39
  type LaneCheck = (folder: string, name: string) => string | null;
40
+ type LaneMiss = {
41
+ readonly key: string;
42
+ readonly name: string;
43
+ readonly folders: readonly string[];
44
+ };
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+ export declare function laneMisses(decl: Pick<ModelDecl, "lane_inputs" | "provisions" | "snapshot_provisions" | "lane_homes">, check: LaneCheck, variantRow?: {
54
+ lane_inputs?: Record<string, unknown>;
55
+ }, cellRow?: {
56
+ lane_inputs?: Record<string, unknown>;
57
+ }): LaneMiss[];
40
58
  export declare function laneFilesStatus(decl: Pick<ModelDecl, "lane_inputs" | "provisions" | "snapshot_provisions" | "lane_homes">, check?: LaneCheck): boolean | null;
41
59
 
42
60
 
package/lib/cardsLanes.js CHANGED
@@ -51,6 +51,7 @@ export function lanePackFolders() {
51
51
  let cfg;
52
52
  try {
53
53
  cfg = loadEndpointConfig();
54
+ // a missing or malformed config file throws — the read yields no pack folders and the stock lane sets stand alone
54
55
  }
55
56
  catch {
56
57
  return [];
@@ -105,7 +106,7 @@ function homeProbes(home, name) {
105
106
 
106
107
 
107
108
 
108
- function laneMisses(decl, check, variantRow, cellRow) {
109
+ export function laneMisses(decl, check, variantRow, cellRow) {
109
110
  // THE VARIANT-LANE PRESENCE LAW (h¹ remainder — the one-parameter
110
111
  // switch): the probe judges the RESOLVED lane inputs — the family's
111
112
  // rows under the STATED variant's per-key override (the same merge
@@ -9,24 +9,13 @@ import { type FamilyLaw } from "@melite/contracts/familyLane";
9
9
  export { selectCardVariant, stampCardOverlay, liftCardParams } from "./cardsVariant.js";
10
10
  export type { VariantSelection } from "./cardsVariant.js";
11
11
  export type { CardDeclRow, ModelFactsRow, VariantCellRow, ResolvedVariantRow } from "./cardsFacts.js";
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
- export declare const CARD_ENVELOPE_KEYS: readonly string[];
12
+ /** The card-envelope keys: SELECT the graph, never ride it —
13
+ * re-exported from the vocabulary's own home (vocab.ts) so the
14
+ * compose door and the graph receipt's scope gate read the ONE
15
+ * list (D-11: envelope keys are never knobs; the receipt never
16
+ * judges them). The list's derivation law and its reasons live
17
+ * beside the list. */
18
+ export { CARD_ENVELOPE_KEYS } from "./vocab.js";
30
19
  /** The card-lane refusal: status + the _refusal envelope shape
31
20
  * (error, code, then loc/expected/got) — the door maps it through
32
21
  * the local refusal path. */