@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
package/README.md CHANGED
@@ -1,8 +1,3 @@
1
- ---
2
- description: The estate's run core as Cordis services — serial queue, live-run registry, manage and flows seats, the skill plane, and the runs gate vocabulary.
3
- kind: package-library
4
- ---
5
-
6
1
  # @melite/estate-queue
7
2
 
8
3
  `@melite/estate-queue` is the run-queue core of the estate: the serial-GPU
@@ -11,6 +11,20 @@ export interface ComposeSeat {
11
11
  primeObjectInfo(): Promise<boolean>;
12
12
  readsSync(): FactsReads;
13
13
  resolveCardFamily(mid: string, facts?: Record<string, import("./cardsFacts.js").ModelFactsRow>): string;
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+ admitStageFamily?(card: string, params: Record<string, unknown>): {
23
+ ok: true;
24
+ } | {
25
+ ok: false;
26
+ error: string;
27
+ };
14
28
  /** The §23 cross-roots manifest (the queue seat's stateRoots —
15
29
  * the dangling sweep's trees; J12: config-named, never env). */
16
30
  stateRoots(): readonly string[];
@@ -35,6 +49,23 @@ export declare function composeOnce(deps: ComposeSeat, card: string, fam: string
35
49
 
36
50
 
37
51
  export declare function admissionRefusal(deps: ComposeSeat, card: string, fam: string, lifted: Record<string, unknown>, phase: string, facts?: Record<string, ModelFactsRow>): void;
52
+
53
+
54
+
55
+
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+ export declare function refuseFamilylessHijack(deps: ComposeSeat, card: string, seat: unknown, facts?: Record<string, ModelFactsRow>): void;
38
69
  /** Resolve + sweep + select + overlay + lift (steps 2-6):
39
70
  * everything before compose. Throws CardArmError (the door maps
40
71
  * it to the refusal envelope). `phase` stamps the phase-N voice
@@ -222,6 +222,34 @@ export function admissionRefusal(deps, card, fam, lifted, phase, facts) {
222
222
  (fieldHints.length > 0 ? " Mod-field families:" + fieldHints.join(";") : ""));
223
223
  }
224
224
  }
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+ export function refuseFamilylessHijack(deps, card, seat, facts) {
242
+ if (card === "")
243
+ return;
244
+ const decl = deps.cardDecls(facts)[card];
245
+ if (decl === undefined || decl.boarded.length > 0)
246
+ return;
247
+ if (typeof seat !== "string" || seat === "" || seat === card)
248
+ return;
249
+ throw new CardArmError(400, "card " + JSON.stringify(card) + " declares no model family (a family-less tool card — it composes by its own id), so the stated model " +
250
+ JSON.stringify(seat) + " is a lane hijack: the row would compose " +
251
+ JSON.stringify(seat) + "'s card instead and this card's params would be judged by a stranger's admission. Drop the model key — the card's own surface owns every default.", "invalid_request");
252
+ }
225
253
  /** Resolve + sweep + select + overlay + lift (steps 2-6):
226
254
  * everything before compose. Throws CardArmError (the door maps
227
255
  * it to the refusal envelope). `phase` stamps the phase-N voice
@@ -251,6 +279,20 @@ export function prepareCardParams(deps, body, mid, phase, factsArg) {
251
279
  if (!FLOW_ID_RE.test(mid)) {
252
280
  throw new CardArmError(400, "model id " + JSON.stringify(mid) + " is not a legal identifier", "invalid_request");
253
281
  }
282
+
283
+ // add_stage misrouted into the krea-2/turbo image lane demanding a
284
+ // prompt. The family-less tool card never reached its own surface"):
285
+ // a stage row that names a REGISTERED family-less card (boarded: [])
286
+ // composes by its own id — the card-unit arm below. But `mid` folds a
287
+ // stated params.model/service FIRST, so trim + model 'krea-2' resolved
288
+ // KREA's family and composed the image-gen card instead (live receipt:
289
+ // /v1/flows/validate answered "unknown param(s) on the image-gen card:
290
+ // clip, end_seconds, start_seconds" — the trim params judged by a
291
+ // stranger's admission, and with prompt-shaped params the row would
292
+ // have validated GREEN as a krea image). ONE LAW, TWO SEATS: the
293
+ // validate walk's own phase1Card call carries no `card` key in its
294
+ // body, so the helper is exported and called there too.
295
+ refuseFamilylessHijack(deps, typeof body["card"] === "string" ? body["card"] : "", body["model"] ?? body["service"], facts);
254
296
  const resolves = mid in facts || deps.resolveCardFamily(mid, facts) in facts || deps.modelMids().has(mid);
255
297
  if (!resolves) {
256
298
 
@@ -303,6 +345,19 @@ export function prepareCardParams(deps, body, mid, phase, factsArg) {
303
345
  " (no registered card definition for the card model " + JSON.stringify(mid) + " names)", "card_compose");
304
346
  }
305
347
  const sel = selectCardVariant(mid, famRow, body, phase, familyLanesOf(decl.boarded), fam);
348
+
349
+ // SAYING ONE BENCH. BUT THAT IS *never* TRUE"; RETIRED as a
350
+
351
+ // the RENDERER, not by a refusal — renderH3Window now hoists
352
+ // the post chain above the family branch, so every finish key
353
+ // fires on every lane and h3-timeline declares no admission
354
+ // face. The seat still runs when a card declares one, on the
355
+ // RAW lifted body (pre-stamp), so a genuine family clause keeps
356
+ // one voice across write, serve and compose.
357
+ const famVerdict = deps.admitStageFamily?.(famRow.card, liftCardParams(body));
358
+ if (famVerdict !== undefined && !famVerdict.ok) {
359
+ throw new CardArmError(400, famVerdict.error, "invalid_request");
360
+ }
306
361
  const stamped = stampCardOverlay(body, famRow, decl, sel, phase, fam);
307
362
  return {
308
363
  mid,
@@ -78,6 +78,11 @@ export declare const FAMILY_RESEAT_CARVE: readonly string[];
78
78
 
79
79
 
80
80
 
81
+
82
+
83
+
84
+
85
+
81
86
  export declare function familyLawDrift(laws: ReadonlyMap<string, FamilyLaw>): string[];
82
87
  export declare class CardRegistryService extends Service {
83
88
  static inject: string[];
@@ -291,8 +296,6 @@ export declare class CardRegistryService extends Service {
291
296
 
292
297
 
293
298
 
294
-
295
-
296
299
  admitStageFamily(card: string, params: Record<string, unknown>): {
297
300
  ok: true;
298
301
  } | {
@@ -80,8 +80,10 @@ import { readFileSync, statSync } from "node:fs";
80
80
  * imported through the engine's public surface like every other
81
81
  * engine dep. No deep path, no runtime-only dodge. */
82
82
  import { bootModels, cardDefsNow, ComposeRefusal, getModel, liveScanOrder, loadCardDefs, loadFacts, owningAtom, registryIds, registryModel, resolveCardFlowOutputs, resolveRepoRoot, theService } from "@melite/comfyui-cordis";
83
+ import { foldLegacyAliases } from '@melite/comfyui-card-kit';
83
84
  import { probeMedia } from '@melite/contracts/media-probe';
84
85
  import { DOOR_KEYS } from "./runsGates.js";
86
+ import { resolveSourceRefs } from "./runsSourceEcho.js";
85
87
  import { CardArmError, EnvelopeRefusal, phaseRefusalCode } from "./cardsArmError.js";
86
88
  export { CardArmError } from "./cardsArmError.js";
87
89
  import { cardAdmits, factsPath, deriveDecls, familyLanesOf } from "./cardsFacts.js";
@@ -334,6 +336,31 @@ function bagSourceBytes(leaf) {
334
336
  }
335
337
  return null;
336
338
  }
339
+ /** Resolve a probe source through the estate's OWN roots first (the
340
+ * runs trees a prior stage's render left behind — runsSourceEcho's
341
+ * resolver, the run door's own vocabulary: run-tails land in
342
+ * `<root>/output/<runId>/<rel>`, absolutes verbatim), then the
343
+ * compose spellings. A produced clip is the bench's actual posture
344
+ * (the rev-122 burn's 7.5 s film): the three compose candidates
345
+ * never saw it, and the window probes silently went deaf. A source
346
+ * that resolves nowhere answers null — the belt, never an invented
347
+ * refusal. */
348
+ function bagSourceBytesViaRoots(leaf, roots) {
349
+ try {
350
+ for (const row of resolveSourceRefs([leaf], roots)) {
351
+ const st = statSync(row.file);
352
+ if (!st.isFile())
353
+ continue;
354
+ return new Uint8Array(readFileSync(row.file));
355
+ }
356
+ }
357
+ catch {
358
+
359
+
360
+
361
+ }
362
+ return bagSourceBytes(leaf);
363
+ }
337
364
 
338
365
 
339
366
 
@@ -373,6 +400,104 @@ function refuseSilentSource(card, params) {
373
400
  }
374
401
  }
375
402
  }
403
+
404
+
405
+
406
+
407
+
408
+
409
+
410
+
411
+
412
+
413
+ function refuseRefineWindowPastClip(card, params, roots) {
414
+ if (card !== "h3-timeline")
415
+ return;
416
+ const bag = params["refine"];
417
+ if (!Array.isArray(bag))
418
+ return;
419
+ for (const entry of bag) {
420
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry))
421
+ continue;
422
+ const rec = entry;
423
+ const leaf = typeof rec["source_clip"] === "string" ? rec["source_clip"].trim() : "";
424
+ if (leaf === "")
425
+ continue;
426
+ const rawStart = rec["start_seconds"];
427
+ const start = typeof rawStart === "number" && Number.isFinite(rawStart) ? rawStart : 0;
428
+ if (!(start > 0))
429
+ continue;
430
+ const bytes = bagSourceBytesViaRoots(leaf, roots);
431
+ if (bytes === null)
432
+ continue;
433
+ let probed;
434
+ try {
435
+ probed = probeMedia(bytes);
436
+ }
437
+ catch {
438
+ continue;
439
+ }
440
+ const video = probed.streams.find((stream) => stream.codec_type === "video");
441
+ const frames = video?.frames ?? (probed.duration_s !== undefined ? Math.round(probed.duration_s * 24) : undefined);
442
+ if (frames === undefined || frames <= 0)
443
+ continue;
444
+ const skip = Math.round(start * 24);
445
+ if (skip < frames)
446
+ continue;
447
+ const clipEndS = (frames / 24).toFixed(2);
448
+ throw new CardArmError(400, `the refine window starts at ${start}s (skip ${skip} frames at the film clock) but "${leaf}" carries ` +
449
+ `${frames} frame(s)${probed.duration_s !== undefined ? ` (${probed.duration_s}s)` : ""} — the loader's ` +
450
+ `skip_first_frames runs past the clip's end and the engine dies in the buffer arithmetic; start the ` +
451
+ `window inside the clip (start_seconds < ${clipEndS}s) or refine the longer source`, "invalid_request");
452
+ }
453
+ }
454
+
455
+
456
+
457
+
458
+
459
+
460
+
461
+
462
+
463
+
464
+
465
+
466
+
467
+
468
+ function refuseTrimStartPastClip(card, params, roots) {
469
+ if (card !== "trim")
470
+ return;
471
+ const leaf = typeof params["clip"] === "string" ? params["clip"].trim() : "";
472
+ if (leaf === "")
473
+ return;
474
+ const rawStart = params["start_seconds"];
475
+ const start = typeof rawStart === "number" && Number.isFinite(rawStart) ? rawStart : 0;
476
+ if (!(start > 0))
477
+ return;
478
+ const bytes = bagSourceBytesViaRoots(leaf, roots);
479
+ if (bytes === null)
480
+ return;
481
+ let probed;
482
+ try {
483
+ probed = probeMedia(bytes);
484
+ }
485
+ catch {
486
+ return;
487
+ }
488
+ const video = probed.streams.find((stream) => stream.codec_type === "video");
489
+ const frames = video?.frames ?? (probed.duration_s !== undefined ? Math.round(probed.duration_s * 24) : undefined);
490
+ if (frames === undefined || frames <= 0)
491
+ return;
492
+ const skip = Math.round(start * 24);
493
+ if (skip < frames)
494
+ return;
495
+ const clipEndS = (frames / 24).toFixed(2);
496
+ throw new CardArmError(400, `the trim window starts at ${start}s (skip ${skip} frames at the trim card's 24 fps) but "${leaf}" carries ` +
497
+ `${frames} frame(s)${probed.duration_s !== undefined ? ` (${probed.duration_s}s)` : ""} — the loader's ` +
498
+ `skip_first_frames runs past the clip's last frame and the run composes an empty clip; trim inside the ` +
499
+ `clip (start_seconds < ${clipEndS}s) — end_seconds beyond the last frame stays the loader's own clamp`, "invalid_request");
500
+ }
376
501
  /** The card-scope seat for the clip-geometry stamp: resolves the
377
502
  * card the run addresses — the family route's famRow.card, or the
378
503
  * familyless id itself — mirroring prepareCardParams's two arms,
@@ -480,6 +605,11 @@ function familyLawOfCard(def) {
480
605
 
481
606
 
482
607
 
608
+
609
+
610
+
611
+
612
+
483
613
  export function familyLawDrift(laws) {
484
614
  const drift = [];
485
615
  for (const [family, law] of laws) {
@@ -489,6 +619,11 @@ export function familyLawDrift(laws) {
489
619
  const orphan = Object.keys(law.deadKeys).filter((l) => !lanes.has(l));
490
620
  if (orphan.length > 0)
491
621
  drift.push(`${family}: deadKeys names undeclared lanes ${JSON.stringify(orphan)}`);
622
+ for (const [lane, keys] of Object.entries(law.deadKeys)) {
623
+ if (lanes.has(lane) && keys.length > 0) {
624
+ drift.push(`${family}: lane ${lane} declares dead keys ${JSON.stringify(keys)} — no lane dead letter may ship (cure the renderer or gate the shape)`);
625
+ }
626
+ }
492
627
  }
493
628
  return drift;
494
629
  }
@@ -1082,8 +1217,6 @@ export class CardRegistryService extends Service {
1082
1217
 
1083
1218
 
1084
1219
 
1085
-
1086
-
1087
1220
  admitStageFamily(card, params) {
1088
1221
  const def = this.defsSync().get(card);
1089
1222
  if (def === undefined || def.admitFamily === undefined)
@@ -1829,7 +1962,19 @@ export class CardRegistryService extends Service {
1829
1962
  if (typeof mid !== "string" || mid === "")
1830
1963
  return null;
1831
1964
  try {
1832
- return prepareCardParams(this, body, mid, "serve").params;
1965
+ const prep = prepareCardParams(this, body, mid, "serve");
1966
+
1967
+ // user have different input parameters"): the compose lanes
1968
+ // merge a card's legacyAliases engine-side, so a row carrying
1969
+ // image1/image_name RUNS with the image — but serving the
1970
+ // params verbatim left the canonical seat (input_images /
1971
+ // image) EMPTY on the drill's form and the user stared at a
1972
+ // BLANK input for an image the agent had attached. The serve
1973
+ // is the 1:1 law (the map the NEXT RUN composes): the same
1974
+ // fold the lane performs, served — one spelling on every
1975
+ // face, the stored doc untouched.
1976
+ const kinds = this.defsSync().get(prep.card)?.flowKinds;
1977
+ return foldLegacyAliases(kinds, prep.params);
1833
1978
  }
1834
1979
  catch {
1835
1980
  return null;
@@ -2026,6 +2171,18 @@ export class CardRegistryService extends Service {
2026
2171
  // and the file named (the run door's own envelope walk, so the
2027
2172
  // validate seat hears the same sentence).
2028
2173
  refuseSilentSource(prep.card, prep.params);
2174
+ // THE REFINE WINDOW RANGE REFUSAL (F36): a window whose
2175
+ // start_seconds runs past its own source clip refuses here,
2176
+ // zero GPU, with the clip and the probed length named. The
2177
+ // source resolves through the estate's own roots first — a
2178
+ // produced clip (a prior stage's output) is a real posture,
2179
+ // not a probe deaf spot (F3-08).
2180
+ refuseRefineWindowPastClip(prep.card, prep.params, this.stateRoots());
2181
+ // THE TRIM START RANGE REFUSAL (F3-08): a trim whose start lands
2182
+ // past the source's last frame refuses here too — same belt,
2183
+ // zero GPU, the trim card's own 24 fps contract, the same
2184
+ // estate-roots resolution.
2185
+ refuseTrimStartPastClip(prep.card, prep.params, this.stateRoots());
2029
2186
  // THE BOARD CHECK RIDES THE RUN SEAT TOO (the behavioural
2030
2187
  // re-check's BYPASS 1: the bench refused an unoffered model
2031
2188
  // address, but `validate` with the SAME address composed the
@@ -25,6 +25,11 @@ export interface FlowSummary {
25
25
  readonly description: string;
26
26
  readonly stages: number;
27
27
  readonly skillRefs: readonly string[];
28
+
29
+
30
+
31
+
32
+ readonly initials: readonly string[];
28
33
  }
29
34
  /** The search surface a card def offers (the def itself satisfies
30
35
  * this — structural, no import of the engine service). boarded is
@@ -20,7 +20,7 @@ import { readFileSync } from "node:fs";
20
20
  import { join } from "node:path";
21
21
  import { Service } from "@deepseek-ai/cordis";
22
22
  import { resolveRepoRoot } from "@melite/comfyui-cordis";
23
- import { seedFlowsSeat } from "./flowsData.js";
23
+ import { flowInitialKeys, seedFlowsSeat } from "./flowsData.js";
24
24
  /** The words a user sentence carries but no card owns — articles,
25
25
  * pronouns, auxiliaries and request verbs. Ignored for scoring (the
26
26
  * full-sentence miss was the transcript's first call: "Make an image
@@ -41,7 +41,7 @@ const MODALITY_WORDS = {
41
41
  animation: "video", animate: "video", film: "video",
42
42
  audio: "audio", sound: "audio", sounds: "audio", music: "audio", voice: "audio",
43
43
  speech: "audio", talk: "audio", talking: "audio",
44
- mesh: "mesh", "3d": "mesh", blender: "mesh",
44
+ mesh: "mesh", "3d": "mesh",
45
45
  };
46
46
  /** Request verbs → the OPERATION tag they mean. A card declares its
47
47
  * operations in tags (generate/edit/upscale); the user's verb is the
@@ -184,7 +184,7 @@ export function flowSummaryRows(repo, flowsSeat) {
184
184
  catch {
185
185
  // no leaf — the registry row stands alone
186
186
  }
187
- out.push({ name, title, description: flow.description, stages: flow.stages.length, skillRefs: flow.skillRefs });
187
+ out.push({ name, title, description: flow.description, stages: flow.stages.length, skillRefs: flow.skillRefs, initials: flowInitialKeys(flow) });
188
188
  }
189
189
  return out;
190
190
  }
@@ -43,17 +43,31 @@ export interface RegistryStage {
43
43
  } | null;
44
44
  readonly fromFlow: RegistryFromFlow | null;
45
45
  }
46
- /** The compile-time initial kinds (flow.initial_validators). */
47
- export type RegistryInitialKind = "photo" | "video" | "glb" | "bake_params" | "text";
48
- /** One headless-tool overlay (FlowToolOverlay: tool param -> the
49
- * stage doc path it stamps, with the value choices map). */
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+ export type RegistryInitialKind = "photo" | "video" | "glb" | "bake_params" | "text" | "brief" | "number" | "json";
57
+ /** The extracted initial value (F58): strings for the name/file
58
+ * kinds, NUMBERS for number, OBJECTS for json — the run row's
59
+ * initials record is EngineJson-shaped, so the typed values ride to
60
+ * the engine merge unchanged. */
61
+ export type ExtractedInitial = string | number | Record<string, unknown>;
62
+ /** One flow-tool overlay (FlowToolOverlay: the run door's param ->
63
+ * the stage doc path it stamps, with the value choices map). */
50
64
  export interface RegistryToolOverlay {
51
65
  readonly param: string;
52
66
  readonly stage: string;
53
67
  readonly path: readonly string[];
54
68
  readonly choices: Record<string, string> | null;
55
69
  }
56
- /** One headless-tool property (FlowToolProperty). */
70
+ /** One flow-tool property (FlowToolProperty). */
57
71
  export interface RegistryToolProperty {
58
72
  readonly ptype: string;
59
73
  readonly description: string;
@@ -63,8 +77,9 @@ export interface RegistryToolProperty {
63
77
  readonly maximum: number | null;
64
78
  readonly enum: readonly string[] | null;
65
79
  }
66
- /** The headless surface (FlowTool: name + version + schema +
67
- * required + overlays). Absent (null) on flows with no tool=. */
80
+ /** The flow-tool surface (FlowTool: name + version + schema +
81
+ * required + overlays) — the run door's face for a registry flow.
82
+ * Absent (null) on flows with no tool=. */
68
83
  export interface RegistryTool {
69
84
  readonly name: string;
70
85
  readonly version: number;
@@ -89,6 +104,41 @@ export interface RegistryFlow {
89
104
  readonly tool: RegistryTool | null;
90
105
  readonly skillRefs: readonly string[];
91
106
  }
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ export declare function flowInitialKeys(flow: RegistryFlow): readonly string[];
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+ export declare function initialKindGloss(kind: RegistryInitialKind): string;
136
+ /** A flow's initial keys → glosses, the same derivation order the
137
+ * validators hold (the bundle's initials record rides both so the
138
+ * open face renders kinds and shapes from one truth).
139
+ * @param flow the registry row
140
+ * @returns the gloss per declared initial key */
141
+ export declare function flowInitialGlosses(flow: RegistryFlow): Record<string, string>;
92
142
  export declare function initial(key: string): RegistryInitialEdge;
93
143
  export declare function fromStage(stage: string, output: string): RegistryStageEdge;
94
144
  export declare function plainStage(row: {
@@ -198,19 +248,25 @@ export declare function initialFileCandidates(raw: string, roots: InitialsRoots)
198
248
  * passes (absent initials ride — the $channel/branch arms own
199
249
  * them). Runs BEFORE any run registers, on both doors. */
200
250
  export declare function registryInitialsError(flow: RegistryFlow, body: Record<string, unknown>, roots: InitialsRoots): string | null;
201
- /** The initial VALUE one gate-blessed body entry carries, in the
202
- * string form the engine merge links a $spell against: file
203
- * initials give their path ({path: …} unwraps — the two spellings
204
- * the gate blesses), bake_params gives its params_json string
205
- * (objects stringify — the dialect the belt validates). Null
206
- * refuses a shape the gate would have refused, so a mangled
207
- * durable body fails loud at the door instead of shipping an
208
- * "[object Object]" literal to the engine.
209
- * @param key the initial's declared name, for the refusal voice
210
- * @param kind the declared validator kind
211
- * @param value the raw body entry
212
- * @returns the normalized string, or null when the shape is neither */
213
- export declare function normalizedInitialValue(key: string, kind: RegistryInitialKind, value: unknown): string | null;
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+ export declare function normalizedInitialValue(key: string, kind: RegistryInitialKind, value: unknown): ExtractedInitial | null;
214
270
  /** The request initials a body carries for a flow's declared
215
271
  * validators, normalized per {@link normalizedInitialValue}:
216
272
  * declared keys, present values only; absent stays absent (the
@@ -225,7 +281,7 @@ export declare function normalizedInitialValue(key: string, kind: RegistryInitia
225
281
  * @param body the request body
226
282
  * @returns the normalized initials record, or a refusal string */
227
283
  export declare function extractRequestInitials(flow: RegistryFlow, body: Record<string, unknown>): {
228
- initials: Record<string, string>;
284
+ initials: Record<string, ExtractedInitial>;
229
285
  } | {
230
286
  refusal: string;
231
287
  };