@melite/estate-queue 0.0.0-stage → 0.1.5-pre-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 (131) hide show
  1. package/LICENSE +557 -0
  2. package/README.md +54 -2
  3. package/lib/bakeParams.d.ts +17 -0
  4. package/lib/bakeParams.js +182 -0
  5. package/lib/bench.d.ts +32 -0
  6. package/lib/bench.js +111 -0
  7. package/lib/cardsArmError.d.ts +61 -0
  8. package/lib/cardsArmError.js +57 -0
  9. package/lib/cardsCompose.d.ts +53 -0
  10. package/lib/cardsCompose.js +295 -0
  11. package/lib/cardsDangling.d.ts +16 -0
  12. package/lib/cardsDangling.js +213 -0
  13. package/lib/cardsFacts.d.ts +87 -0
  14. package/lib/cardsFacts.js +78 -0
  15. package/lib/cardsLanes.d.ts +43 -0
  16. package/lib/cardsLanes.js +178 -0
  17. package/lib/cardsRegistry.d.ts +404 -0
  18. package/lib/cardsRegistry.js +1543 -0
  19. package/lib/cardsVariant.d.ts +37 -0
  20. package/lib/cardsVariant.js +243 -0
  21. package/lib/discloseRegistry.d.ts +95 -0
  22. package/lib/discloseRegistry.js +156 -0
  23. package/lib/filmLead.d.ts +4 -0
  24. package/lib/filmLead.js +17 -0
  25. package/lib/filmMemoryWarn.d.ts +27 -0
  26. package/lib/filmMemoryWarn.js +99 -0
  27. package/lib/flowsData.d.ts +234 -0
  28. package/lib/flowsData.js +673 -0
  29. package/lib/flowsFamilyCompose.d.ts +45 -0
  30. package/lib/flowsFamilyCompose.js +191 -0
  31. package/lib/flowsParamsOverlay.d.ts +55 -0
  32. package/lib/flowsParamsOverlay.js +197 -0
  33. package/lib/flowsRegistryRows.d.ts +12 -0
  34. package/lib/flowsRegistryRows.js +520 -0
  35. package/lib/index.d.ts +47 -0
  36. package/lib/index.js +75 -0
  37. package/lib/ledgerTail.d.ts +20 -0
  38. package/lib/ledgerTail.js +123 -0
  39. package/lib/lifecycleLatch.d.ts +16 -0
  40. package/lib/lifecycleLatch.js +42 -0
  41. package/lib/loadPlane.d.ts +94 -0
  42. package/lib/loadPlane.js +570 -0
  43. package/lib/loadRegistry.d.ts +22 -0
  44. package/lib/loadRegistry.js +55 -0
  45. package/lib/manageOps.d.ts +27 -0
  46. package/lib/manageOps.js +162 -0
  47. package/lib/managePlane.d.ts +151 -0
  48. package/lib/managePlane.js +1790 -0
  49. package/lib/manageProbe.d.ts +48 -0
  50. package/lib/manageProbe.js +165 -0
  51. package/lib/manageRegistry.d.ts +66 -0
  52. package/lib/manageRegistry.js +113 -0
  53. package/lib/managerRail.d.ts +33 -0
  54. package/lib/managerRail.js +91 -0
  55. package/lib/mediaKinds.d.ts +3 -0
  56. package/lib/mediaKinds.js +2 -0
  57. package/lib/queue.d.ts +9 -0
  58. package/lib/queue.js +80 -0
  59. package/lib/queueCore.d.ts +72 -0
  60. package/lib/queueCore.js +128 -0
  61. package/lib/queueLifecycle.d.ts +2 -0
  62. package/lib/queueLifecycle.js +11 -0
  63. package/lib/queueLock.d.ts +60 -0
  64. package/lib/queueLock.js +198 -0
  65. package/lib/queueResurrect.d.ts +59 -0
  66. package/lib/queueResurrect.js +249 -0
  67. package/lib/queueRetry.d.ts +36 -0
  68. package/lib/queueRetry.js +24 -0
  69. package/lib/queueSidecar.d.ts +149 -0
  70. package/lib/queueSidecar.js +183 -0
  71. package/lib/queueSubmit.d.ts +82 -0
  72. package/lib/queueSubmit.js +191 -0
  73. package/lib/queueSweep.d.ts +30 -0
  74. package/lib/queueSweep.js +132 -0
  75. package/lib/resurrect.d.ts +6 -0
  76. package/lib/resurrect.js +18 -0
  77. package/lib/rootsManifest.d.ts +11 -0
  78. package/lib/rootsManifest.js +11 -0
  79. package/lib/runsChange.d.ts +61 -0
  80. package/lib/runsChange.js +79 -0
  81. package/lib/runsErrorCodes.d.ts +2 -0
  82. package/lib/runsErrorCodes.js +48 -0
  83. package/lib/runsExecute.d.ts +52 -0
  84. package/lib/runsExecute.js +494 -0
  85. package/lib/runsGates.d.ts +161 -0
  86. package/lib/runsGates.js +307 -0
  87. package/lib/runsList.d.ts +78 -0
  88. package/lib/runsList.js +574 -0
  89. package/lib/runsRefusalVoices.d.ts +9 -0
  90. package/lib/runsRefusalVoices.js +96 -0
  91. package/lib/runsRegistry.d.ts +351 -0
  92. package/lib/runsRegistry.js +2394 -0
  93. package/lib/runsSourceEcho.d.ts +81 -0
  94. package/lib/runsSourceEcho.js +341 -0
  95. package/lib/runsStart.d.ts +163 -0
  96. package/lib/runsStart.js +667 -0
  97. package/lib/runsTypes.d.ts +218 -0
  98. package/lib/runsTypes.js +289 -0
  99. package/lib/runsValidate.d.ts +5 -0
  100. package/lib/runsValidate.js +31 -0
  101. package/lib/runsValidateArms.d.ts +7 -0
  102. package/lib/runsValidateArms.js +339 -0
  103. package/lib/runsValidateInline.d.ts +6 -0
  104. package/lib/runsValidateInline.js +82 -0
  105. package/lib/runsValidateRefusals.d.ts +7 -0
  106. package/lib/runsValidateRefusals.js +18 -0
  107. package/lib/runsValidateServe.d.ts +15 -0
  108. package/lib/runsValidateServe.js +276 -0
  109. package/lib/runsValidateShared.d.ts +84 -0
  110. package/lib/runsValidateShared.js +88 -0
  111. package/lib/runsValidateStages.d.ts +32 -0
  112. package/lib/runsValidateStages.js +511 -0
  113. package/lib/runsValidateSweeps.d.ts +6 -0
  114. package/lib/runsValidateSweeps.js +143 -0
  115. package/lib/service.d.ts +63 -0
  116. package/lib/service.js +89 -0
  117. package/lib/skillFrontmatter.d.ts +11 -0
  118. package/lib/skillFrontmatter.js +46 -0
  119. package/lib/skillFs.d.ts +24 -0
  120. package/lib/skillFs.js +78 -0
  121. package/lib/skillPlane.d.ts +99 -0
  122. package/lib/skillPlane.js +269 -0
  123. package/lib/skillRegistry.d.ts +23 -0
  124. package/lib/skillRegistry.js +55 -0
  125. package/lib/skillRows.d.ts +127 -0
  126. package/lib/skillRows.js +468 -0
  127. package/lib/toolProjection.d.ts +30 -0
  128. package/lib/toolProjection.js +142 -0
  129. package/lib/vocab.d.ts +6 -0
  130. package/lib/vocab.js +18 -0
  131. package/package.json +48 -4
@@ -0,0 +1,404 @@
1
+ import { Service } from "@deepseek-ai/cordis";
2
+ import type { Context } from "@deepseek-ai/cordis";
3
+ import type { FactsReads } from "@melite/comfyui-cordis";
4
+ import type { CardDefinition } from '@melite/comfyui-card-kit/card-definition';
5
+ import { RUNS_ERROR_CODES } from "./runsErrorCodes.js";
6
+ export { CardArmError } from "./cardsArmError.js";
7
+ import type { CardDeclRow, ModelFactsRow } from "./cardsFacts.js";
8
+ export { selectCardVariant, stampCardOverlay, liftCardParams } from "./cardsVariant.js";
9
+ export type { VariantSelection } from "./cardsVariant.js";
10
+ export type { CardDeclRow, ModelFactsRow, VariantCellRow, ResolvedVariantRow } from "./cardsFacts.js";
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+ export declare const CARD_ENVELOPE_KEYS: readonly string[];
29
+ /** The card-lane refusal: status + the _refusal envelope shape
30
+ * (error, code, then loc/expected/got) — the door maps it through
31
+ * the local refusal path. */
32
+ /** The family's DECL face ("MOSS-SFX v2") — registryModel in a
33
+ * guard (it THROWS on unknown ids); the id is the fallback.
34
+ * Exported for the wall (both arms pin: the face serves, the
35
+ * unknown degrades to the id — never a throw into a serve). */
36
+ export declare function familyFace(fam: string): string;
37
+ /** THE OUTPUT-RESOLUTION SEAM (round-22 compose audit Q4a,
38
+ * VALIDATE-RESOLVES-OUTPUTS): phase 2's def lookup + output
39
+ * resolution with the run seat's exact voices, shared by the run
40
+ * seat (phase2Card, thrown as CardArmError) and the validate seat
41
+ * (composeValidateCard, folded to its verdict). Validate composed
42
+ * the graph and discarded it, so every phase-2 output refusal
43
+ * answered validate-green/start-refuse on the binding cards; the
44
+ * seat resolves over its phase-1 graph now — same overlaid
45
+ * params, same graph, same refusal. Cards without bindings
46
+ * resolve vacuously (the resolver returns {}), so their seats
47
+ * answer exactly as before.
48
+ * @param defs the card definitions table
49
+ * @param card the card id (prepare already admitted it)
50
+ * @param params the prepared params (the overlaid truth both doors hold)
51
+ * @param graph the composed graph
52
+ */
53
+ export declare function resolveCardOutputsOrThrow(defs: ReadonlyMap<string, Pick<CardDefinition, "id" | "flowKinds" | "flowOutputBindings">>, card: string, params: Record<string, unknown>, graph: Record<string, unknown>): {
54
+ outputs: Record<string, string>;
55
+ outputNodes: Record<string, string>;
56
+ };
57
+ export declare class CardRegistryService extends Service {
58
+ static inject: string[];
59
+ /** The primed card definitions (null until prime()). */
60
+ private defs;
61
+ /** The frozen model facts (lazy — strict load, throws LOUD). */
62
+ private facts;
63
+ /** Route address → family owner from the registry-derived facts. */
64
+ private owners;
65
+ /** Registry reads for the row derivation (primed with the models boot). */
66
+ private reads;
67
+ /** The decl projection (lazy — derived from defs + facts). */
68
+ private decls;
69
+ /** The engine's live node-definitions doc (/object_info via the
70
+ * SDK client, cached per process on the engine side; primed by
71
+ * primeObjectInfo before any compose). null = not yet primed or
72
+ * the engine is unreachable. */
73
+ private oi;
74
+ /** The doc the process singleton was last armed with (the re-arm
75
+ * guard — auditor G's row: a weight landing changes the doc
76
+ * identity, and the singleton must follow it; an unchanged doc
77
+ * re-arms nothing). null = never armed (or a boot re-prime). */
78
+ private singletonArmedOi;
79
+ /** The catalog existence set (lazy — strict load, throws LOUD). */
80
+ private mids;
81
+ constructor(ctx: Context);
82
+ /** The §23 manifest for the compose gate's dangling sweep (the
83
+ * ComposeSeat seam): one law from the queue seat — config-named
84
+ * roots, never the retired env seam (J12). */
85
+ stateRoots(): readonly string[];
86
+ /** Prime the registry (service init — replaces the retired
87
+ * primeCardRegistry()): the registry loads async (dynamic
88
+ * card-module imports) but the validate/disclosure rims are sync,
89
+ * so every boot primes and the request path projects
90
+ * synchronously. Safe to call multiple times (unconditional
91
+ * reload — mirrors the old both-boot-sites prime); re-prime
92
+ * drops the defs-derived decls (facts/mids are disk-derived and
93
+ * stay). The provider's apply primes, and both main.ts boot
94
+ * sites re-prime belt-and-braces. */
95
+ prime(): Promise<void>;
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+ private armSingletonFromDoc;
107
+ /** Test seam: drop all registry state (walls boot fresh processes;
108
+ * belt-and-braces for in-process reuse — the RunsService behavior). */
109
+ resetForTests(): void;
110
+ /** Sync read of the primed registry (the disclosure projection
111
+ * serves from the registry, and the disclosure doors are sync —
112
+ * unprimed access throws LOUD, never a fallback). */
113
+ defsSync(): Map<string, CardDefinition>;
114
+ /** The frozen model facts (strict — a missing file throws LOUD;
115
+ * the validate door keeps its absent-file degrade by catching
116
+ * this at its own call site). */
117
+ /** Sync read of the primed registry reads (unprimed access throws LOUD). */
118
+ readsSync(): FactsReads;
119
+ modelFacts(): Record<string, ModelFactsRow>;
120
+ /** The decl projection — derived from defs + the strict facts, or
121
+ * from defs + caller-supplied facts (the validate door's
122
+ * degraded read; derived fresh, never cached over foreign facts). */
123
+ cardDecls(facts?: Record<string, ModelFactsRow>): Record<string, CardDeclRow>;
124
+ /** The primed live doc (sync face for the sweeps/spec fakes).
125
+ * null = never primed, or the engine was unreachable at prime. */
126
+ objectInfo(): Record<string, unknown> | null;
127
+ /** Prime the live node-definitions doc off the engine (/object_info
128
+ * via the SDK, cached per process). Never throws: false = the
129
+ * engine is unreachable and the doc stays null (the compose gate
130
+ * refuses CLOSED on that; the serving surfaces degrade). */
131
+ primeObjectInfo(): Promise<boolean>;
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+ armWiringFromDoc(doc: Record<string, unknown> | null): void;
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+ modelMids(): Set<string>;
150
+ /** THE LANDING RE-ARM (the cards-plane batch's weight-landing row):
151
+ * every presence face (cardFamilies' present flags, admitModel's
152
+ * downloaded list) reads this.mids, and the cache froze at boot —
153
+ * a weight landed mid-process (provision_model, download_model,
154
+ * acquire_weight) served present:false until a reboot. This drops
155
+ * the cache; the NEXT read re-derives from the live scan order.
156
+ * The manage plane calls it on every model landing under a living
157
+ * process. No truth outside mids changes: facts/owners/defs are
158
+ * DECL-derived, and a landing moves files, not declarations. */
159
+ rearmWeights(): void;
160
+ /** The owning family for mid: mid itself, or the facts model whose
161
+ * variant/cell route owns mid (mirrors _route_family;
162
+ * route-id-as-model is preserved — the graph is addressed by the
163
+ * family). Reads the strict facts unless the caller passes its
164
+ * own (the validate door's degraded read). */
165
+ resolveCardFamily(mid: string, facts?: Record<string, ModelFactsRow>): string;
166
+ /** THE RESOLVED SERVE (hour-26 stroke 15, the 1:1 run law): the
167
+ * map the NEXT RUN composes from a stage row — prepareCardParams'
168
+ * stamped + lifted body (variant resolver_defaults + family
169
+ * defaults injected for absent keys, surface-filtered, envelope
170
+ * keys + variant/quant consumed), the exact input the {model:}
171
+ * door hands compose. The drafts serve carries it on the stage
172
+ * row; the form renders it UNDER the user layer — ONE resolver,
173
+ * served to the visual, never a second client-side truth. Null
174
+ * when the row names no resolvable unit (registry-less lanes and
175
+ * model-less rows fall back to the client derive). */
176
+ /** The card's boarded families WITH PRESENCE (the no-silent-drop
177
+ * law, hour 26 stroke 17: a boarded family the machine has not
178
+ * downloaded is SERVED, marked absent — never silently dropped
179
+ * from any surface). Present = the live catalog offer
180
+ * (buildCatalog's served keys, route-id-as-model). */
181
+ cardFamilies(card: string): Array<{
182
+ id: string;
183
+ present: boolean;
184
+ label: string;
185
+ }>;
186
+ /** ADMISSION (the door half of the no-silent-drop law, re-cut
187
+ * hour 26 stroke 18 per the operator: a BOARDED model is
188
+ * OFFERED — the write lands even when the weights are not yet
189
+ * downloaded; absence is a DOWNLOAD PROMPT on the surfaces, never
190
+ * a block). The model's OWNING family (resolveCardFamily —
191
+ * variant routes resolve to their family) must be BOARDED on the
192
+ * card; anything else refuses AT WRITE TIME with the card's
193
+ * board — the writer (agent or human patch) gets the error the
194
+ * moment it lands, never at run time. Model-less rows pass (they
195
+ * compose on the card's default family). */
196
+ admitStageModel(card: string, model: unknown): {
197
+ ok: true;
198
+ } | {
199
+ ok: false;
200
+ error: string;
201
+ offered: string[];
202
+ };
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+ admitStageRelations(card: string, params: Record<string, unknown>): {
222
+ ok: true;
223
+ } | {
224
+ ok: false;
225
+ error: string;
226
+ };
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+ laneMigrate(card: string, params: Record<string, unknown>, priorParams: Record<string, unknown>): Record<string, unknown>;
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+
257
+
258
+ /** The lane verdict as its sentence (the write door's and the
259
+ * validate seat's currency — the class rides only where the run
260
+ * seat needs it, via laneVerdictDetailed). */
261
+ private laneVerdict;
262
+
263
+
264
+
265
+
266
+
267
+
268
+ private laneVerdictDetailed;
269
+ /** The draft (model-less) row's verdict: the words EVERY boarded
270
+ * declaring family states, judged over the raw params — the
271
+ * intersection law (see the model-less branch above). Bounds
272
+ * intersect per field (the tightest span all families agree
273
+ * holds); relation rows bind when every family states the row
274
+ * verbatim. A card with no declaring family stays null (the
275
+ * familyless tolerance). */
276
+ private modellessDraftVerdict;
277
+ private laneVerdictCore;
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+
294
+
295
+
296
+
297
+
298
+
299
+ repairStageModel(card: string, model: string): {
300
+ model: string;
301
+ variant?: string;
302
+ } | null;
303
+ /** The seated mcp:<server> engine ids, sorted — the generic MCP
304
+ * card's LIVE board (the same census the catalog/forms folds
305
+ * serve). The same lane-read spelling runsRegistry's flow_inline
306
+ * compile uses: the implicit seat get returns undefined when no
307
+ * engines service is registered — a registry-only boot (walls,
308
+ * fixtures) folds an empty census and card 'mcp' refuses with its
309
+ * own voice, never a silent pass. */
310
+ private seatedMcpEngines;
311
+ resolveStageParams(body: Record<string, unknown>): Record<string, unknown> | null;
312
+
313
+
314
+
315
+
316
+
317
+
318
+
319
+
320
+
321
+ composeValidateCard(card: string, fam: string, params: Record<string, unknown>, mid?: string, rawBody?: Record<string, unknown>, factsArg?: Record<string, ModelFactsRow>): Promise<{
322
+ message: string;
323
+ code: keyof typeof RUNS_ERROR_CODES;
324
+ } | null>;
325
+ /** Phase 1 (run_id ""): validates shape/admission/boarding before
326
+ * registration. The $spell branch composes NO graph (the pool
327
+ * passes — the two-card-flow handoff). */
328
+ phase1Card(body: Record<string, unknown>, mid: string): Promise<Phase1Card>;
329
+ /** Phase 2 (the real run id): composes the SAME overlaid body phase
330
+ * 1 validated (submit 1294-1301 — idempotent, absent-keys-only;
331
+ * the editor's seeded stamps pass through byte-identical).
332
+ * A $spell body composes VERBATIM here (run context — the $spell
333
+ * wires into the Load* file slot; the merged path refuses a
334
+ * link-in-file-slot LOUDLY, test_two_card_flow). */
335
+ phase2Card(p1: Phase1Card, runId: string): Promise<ComposedCard>;
336
+ }
337
+ declare module "@deepseek-ai/cordis" {
338
+ interface Context {
339
+ cardRegistry: CardRegistryService;
340
+ }
341
+ }
342
+ /** The provider plugin (fiber-owned): owns the CardRegistryService
343
+ * lifetime and primes it at load, so inject-gated consumers apply
344
+ * only after the registry is primed. Manifest row
345
+ * estate-card-registry rides BEFORE every consumer (validate,
346
+ * flows-start, chrome, planes — the stroke-2b row placement rule).
347
+ * (The DSH leaf discipline — addressed code loads by address,
348
+ * never as a `cordis:` builtin.) */
349
+ /** The host row (estate naming — the gateway manifest died with
350
+ * the app; this is what the estate composition mounts). */
351
+ export declare const cardRegistryProvider: {
352
+ name: string;
353
+ inject: string[];
354
+ apply(ctx: Context): Promise<void>;
355
+ };
356
+ /** Resolve the service for request-path helpers that take it as an
357
+ * optional trailing param (the stroke-2b shape): an explicit arg
358
+ * wins. Null = the caller forgot to thread ctx.cardRegistry — a
359
+ * bug, so reads throw LOUD (a registry read without a registry is
360
+ * never an empty answer). Door listeners MUST pass
361
+ * ctx.cardRegistry (their inject declares it). */
362
+ export declare function needCardRegistry(cards: CardRegistryService | null | undefined, where: string): CardRegistryService;
363
+ export interface PreparedCard {
364
+ readonly mid: string;
365
+ readonly fam: string;
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+
374
+
375
+
376
+ readonly modelId: string;
377
+ readonly card: string;
378
+ readonly skeleton: string;
379
+ readonly decl: CardDeclRow;
380
+ readonly params: Record<string, unknown>;
381
+
382
+
383
+
384
+
385
+
386
+ readonly familyless?: boolean;
387
+ }
388
+ export interface ComposedCard {
389
+ readonly graph: Record<string, unknown>;
390
+ readonly skeleton: string;
391
+ readonly spell: {
392
+ skeleton: string;
393
+ inputs: Record<string, unknown>;
394
+ } | null;
395
+ readonly outputs: Record<string, string>;
396
+ readonly outputNodes: Record<string, string>;
397
+ }
398
+ export interface Phase1Card extends PreparedCard {
399
+ readonly spell: {
400
+ skeleton: string;
401
+ inputs: Record<string, unknown>;
402
+ } | null;
403
+ }
404
+ //# sourceMappingURL=cardsRegistry.d.ts.map