@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.
- package/README.md +0 -5
- package/lib/bench.js +30 -3
- package/lib/cardsCompose.d.ts +31 -0
- package/lib/cardsCompose.js +65 -1
- package/lib/cardsDangling.js +17 -7
- package/lib/cardsDroppable.d.ts +11 -0
- package/lib/cardsDroppable.js +50 -0
- package/lib/cardsFacts.d.ts +37 -0
- package/lib/cardsFacts.js +47 -1
- package/lib/cardsLanes.d.ts +18 -0
- package/lib/cardsLanes.js +2 -1
- package/lib/cardsRegistry.d.ts +12 -20
- package/lib/cardsRegistry.js +288 -96
- package/lib/discloseRegistry.d.ts +5 -0
- package/lib/discloseRegistry.js +3 -3
- package/lib/filmLead.js +9 -1
- package/lib/filmMemoryWarn.js +1 -0
- package/lib/flowsData.d.ts +110 -21
- package/lib/flowsData.js +201 -23
- package/lib/flowsFamilyCompose.js +1 -0
- package/lib/flowsParamsOverlay.d.ts +8 -1
- package/lib/flowsParamsOverlay.js +47 -2
- package/lib/flowsRegistryRows.d.ts +0 -4
- package/lib/flowsRegistryRows.js +177 -371
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -4
- package/lib/ledgerTail.js +1 -0
- package/lib/loadPlane.d.ts +46 -4
- package/lib/loadPlane.js +109 -7
- package/lib/loadRegistry.js +9 -2
- package/lib/managePlane.d.ts +5 -0
- package/lib/managePlane.js +412 -51
- package/lib/managePreflight.js +38 -6
- package/lib/manageProbe.d.ts +35 -0
- package/lib/manageProbe.js +141 -2
- package/lib/manageRegistry.d.ts +10 -0
- package/lib/manageRegistry.js +7 -1
- package/lib/managerRail.js +1 -0
- package/lib/queueCore.js +3 -1
- package/lib/queueLock.js +22 -10
- package/lib/queueResurrect.d.ts +0 -3
- package/lib/queueResurrect.js +5 -3
- package/lib/queueRetry.d.ts +12 -10
- package/lib/queueRetry.js +2 -4
- package/lib/queueSidecar.d.ts +36 -1
- package/lib/queueSidecar.js +30 -2
- package/lib/queueSubmit.d.ts +4 -1
- package/lib/queueSubmit.js +28 -5
- package/lib/queueSweep.d.ts +38 -11
- package/lib/queueSweep.js +73 -16
- package/lib/runsChange.d.ts +5 -4
- package/lib/runsExecute.d.ts +16 -1
- package/lib/runsExecute.js +102 -50
- package/lib/runsGates.d.ts +11 -3
- package/lib/runsGates.js +12 -3
- package/lib/runsList.d.ts +59 -3
- package/lib/runsList.js +228 -36
- package/lib/runsRegistry.d.ts +87 -6
- package/lib/runsRegistry.js +664 -98
- package/lib/runsSourceEcho.js +9 -3
- package/lib/runsStart.d.ts +6 -4
- package/lib/runsStart.js +32 -25
- package/lib/runsTypes.d.ts +54 -1
- package/lib/runsTypes.js +82 -3
- package/lib/runsValidate.d.ts +1 -0
- package/lib/runsValidate.js +5 -0
- package/lib/runsValidateArms.js +48 -2
- package/lib/runsValidateServe.js +15 -12
- package/lib/runsValidateShared.d.ts +8 -10
- package/lib/runsValidateShared.js +41 -15
- package/lib/runsValidateStages.d.ts +1 -1
- package/lib/runsValidateStages.js +90 -50
- package/lib/runtimeProvision.js +10 -2
- package/lib/skillAuthored.d.ts +50 -0
- package/lib/skillAuthored.js +178 -0
- package/lib/skillFs.js +3 -0
- package/lib/skillPlane.d.ts +40 -2
- package/lib/skillPlane.js +63 -13
- package/lib/skillRegistry.d.ts +24 -1
- package/lib/skillRegistry.js +69 -5
- package/lib/skillRows.d.ts +13 -3
- package/lib/skillRows.js +52 -9
- package/lib/vocab.d.ts +29 -0
- package/lib/vocab.js +78 -0
- package/package.json +24 -14
- package/lib/resurrect.d.ts +0 -6
- package/lib/resurrect.js +0 -18
package/lib/flowsData.d.ts
CHANGED
|
@@ -43,17 +43,31 @@ export interface RegistryStage {
|
|
|
43
43
|
} | null;
|
|
44
44
|
readonly fromFlow: RegistryFromFlow | null;
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
|
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
|
|
67
|
-
* required + overlays)
|
|
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,8 +104,59 @@ 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>;
|
|
142
|
+
/** The {"initial": key} edge builder — a stage input bound to an
|
|
143
|
+
* operator-supplied initial.
|
|
144
|
+
* @param key the initial's declared name
|
|
145
|
+
* @returns the initial edge */
|
|
92
146
|
export declare function initial(key: string): RegistryInitialEdge;
|
|
147
|
+
/** The {"stage": id, "output": name} edge builder — a stage input
|
|
148
|
+
* bound to an earlier stage's output.
|
|
149
|
+
* @param stage the source stage's id
|
|
150
|
+
* @param output the source output's name
|
|
151
|
+
* @returns the stage edge */
|
|
93
152
|
export declare function fromStage(stage: string, output: string): RegistryStageEdge;
|
|
153
|
+
/** The authoring builder for a self-contained stage row: optional
|
|
154
|
+
* fields fill their empty defaults (card/family/action "", the
|
|
155
|
+
* records {}, skipWhen null); the row must name exactly one
|
|
156
|
+
* composing plane (refuseRawWorkflowShape judges it at registration).
|
|
157
|
+
* @param row the declared fields (id, engine, card/family/action,
|
|
158
|
+
* description, inputs, expected/outputs/cardIo, params, skipWhen)
|
|
159
|
+
* @returns the RegistryStage row */
|
|
94
160
|
export declare function plainStage(row: {
|
|
95
161
|
readonly id: string;
|
|
96
162
|
readonly engine: string;
|
|
@@ -108,6 +174,15 @@ export declare function plainStage(row: {
|
|
|
108
174
|
readonly when: string;
|
|
109
175
|
} | null;
|
|
110
176
|
}): RegistryStage;
|
|
177
|
+
/** The from_flow link builder: a stage copied from the named flow's
|
|
178
|
+
* stage at expansion time (id and inputs overridden there); the
|
|
179
|
+
* engine/card/description fields ride empty until the link resolves,
|
|
180
|
+
* and the source may register later than this row.
|
|
181
|
+
* @param flow the source flow's id
|
|
182
|
+
* @param stage the source stage's id
|
|
183
|
+
* @param id this row's own stage id
|
|
184
|
+
* @param inputs the row's winning input edges
|
|
185
|
+
* @returns the linked RegistryStage row */
|
|
111
186
|
export declare function linkedStage(flow: string, stage: string, id: string, inputs: Record<string, RegistryEdge>): RegistryStage;
|
|
112
187
|
import { Service } from "@deepseek-ai/cordis";
|
|
113
188
|
import type { Context } from "@deepseek-ai/cordis";
|
|
@@ -166,6 +241,14 @@ export declare class FlowsSeatService extends Service implements FlowsSeat {
|
|
|
166
241
|
|
|
167
242
|
|
|
168
243
|
export declare function refuseRawWorkflowShape(flowId: string, st: RegistryStage): void;
|
|
244
|
+
/** Expand a declaration into servable form: self-contained stages pass
|
|
245
|
+
* the raw-workflow gate and detach into fresh containers; linked
|
|
246
|
+
* stages resolve against the LIVE seat (source flow and stage must
|
|
247
|
+
* exist, single-hop only) and copy the source row under this row's id
|
|
248
|
+
* and inputs. A dangling link refuses loud, naming the flow and stage.
|
|
249
|
+
* @param flow the declaration to expand
|
|
250
|
+
* @param seat the live FlowsSeat the links resolve against
|
|
251
|
+
* @returns the flow with every stage expanded */
|
|
169
252
|
export declare function expandRegistryFlow(flow: RegistryFlow, seat: FlowsSeat): RegistryFlow;
|
|
170
253
|
|
|
171
254
|
|
|
@@ -198,19 +281,25 @@ export declare function initialFileCandidates(raw: string, roots: InitialsRoots)
|
|
|
198
281
|
* passes (absent initials ride — the $channel/branch arms own
|
|
199
282
|
* them). Runs BEFORE any run registers, on both doors. */
|
|
200
283
|
export declare function registryInitialsError(flow: RegistryFlow, body: Record<string, unknown>, roots: InitialsRoots): string | null;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
export declare function normalizedInitialValue(key: string, kind: RegistryInitialKind, value: unknown): ExtractedInitial | null;
|
|
214
303
|
/** The request initials a body carries for a flow's declared
|
|
215
304
|
* validators, normalized per {@link normalizedInitialValue}:
|
|
216
305
|
* declared keys, present values only; absent stays absent (the
|
|
@@ -225,7 +314,7 @@ export declare function normalizedInitialValue(key: string, kind: RegistryInitia
|
|
|
225
314
|
* @param body the request body
|
|
226
315
|
* @returns the normalized initials record, or a refusal string */
|
|
227
316
|
export declare function extractRequestInitials(flow: RegistryFlow, body: Record<string, unknown>): {
|
|
228
|
-
initials: Record<string,
|
|
317
|
+
initials: Record<string, ExtractedInitial>;
|
|
229
318
|
} | {
|
|
230
319
|
refusal: string;
|
|
231
320
|
};
|
package/lib/flowsData.js
CHANGED
|
@@ -18,17 +18,100 @@
|
|
|
18
18
|
//
|
|
19
19
|
// Erasable-syntax TS only (node --experimental-strip-types).
|
|
20
20
|
import { isFile } from "./skillFs.js";
|
|
21
|
+
import { assertNever } from "@deepseek-ai/dsh-util-values";
|
|
21
22
|
import { CARD_PLANE_ENGINE, LEGACY_RUN_MEDIA_PREFIX, RUN_MEDIA_PREFIX } from "@melite/contracts/benchStage";
|
|
22
|
-
import { join, resolve } from "node:path";
|
|
23
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
23
24
|
import { mediaVocab } from "./mediaKinds.js";
|
|
24
25
|
import { validateBakeParams } from "./bakeParams.js";
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
export function flowInitialKeys(flow) {
|
|
38
|
+
const required = flow.requiredInitials ?? [];
|
|
39
|
+
const optional = Object.keys(flow.initialValidators).filter((k) => !required.includes(k));
|
|
40
|
+
return [...required, ...optional];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
export function initialKindGloss(kind) {
|
|
59
|
+
switch (kind) {
|
|
60
|
+
case "bake_params":
|
|
61
|
+
return "the preset dialect doc {dialect: 'authored'|'estimated', phenotype: number[11 authored|6 estimated], local_changes?: {morph: number} (authored) | scale: number[139] (estimated)} — send the doc as a JSON OBJECT, never a hand-typed string";
|
|
62
|
+
case "photo":
|
|
63
|
+
case "video":
|
|
64
|
+
case "glb":
|
|
65
|
+
return "file path (or {path})";
|
|
66
|
+
case "text":
|
|
67
|
+
return "bare name";
|
|
68
|
+
case "brief":
|
|
69
|
+
return "non-empty prose";
|
|
70
|
+
case "number":
|
|
71
|
+
return "finite JSON number";
|
|
72
|
+
case "json":
|
|
73
|
+
return "JSON object (or its string spelling)";
|
|
74
|
+
default:
|
|
75
|
+
// the closed-union law: a new kind joining RegistryInitialKind
|
|
76
|
+
// compiles red HERE, never silently vanishes the gloss
|
|
77
|
+
return assertNever(kind, "flowsData.initialKindGloss");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** A flow's initial keys → glosses, the same derivation order the
|
|
81
|
+
* validators hold (the bundle's initials record rides both so the
|
|
82
|
+
* open face renders kinds and shapes from one truth).
|
|
83
|
+
* @param flow the registry row
|
|
84
|
+
* @returns the gloss per declared initial key */
|
|
85
|
+
export function flowInitialGlosses(flow) {
|
|
86
|
+
const out = {};
|
|
87
|
+
for (const [key, kind] of Object.entries(flow.initialValidators)) {
|
|
88
|
+
out[key] = initialKindGloss(kind);
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
25
92
|
// ── shared builders ─────────────────────────────────────────────
|
|
93
|
+
/** The {"initial": key} edge builder — a stage input bound to an
|
|
94
|
+
* operator-supplied initial.
|
|
95
|
+
* @param key the initial's declared name
|
|
96
|
+
* @returns the initial edge */
|
|
26
97
|
export function initial(key) {
|
|
27
98
|
return { initial: key };
|
|
28
99
|
}
|
|
100
|
+
/** The {"stage": id, "output": name} edge builder — a stage input
|
|
101
|
+
* bound to an earlier stage's output.
|
|
102
|
+
* @param stage the source stage's id
|
|
103
|
+
* @param output the source output's name
|
|
104
|
+
* @returns the stage edge */
|
|
29
105
|
export function fromStage(stage, output) {
|
|
30
106
|
return { stage, output };
|
|
31
107
|
}
|
|
108
|
+
/** The authoring builder for a self-contained stage row: optional
|
|
109
|
+
* fields fill their empty defaults (card/family/action "", the
|
|
110
|
+
* records {}, skipWhen null); the row must name exactly one
|
|
111
|
+
* composing plane (refuseRawWorkflowShape judges it at registration).
|
|
112
|
+
* @param row the declared fields (id, engine, card/family/action,
|
|
113
|
+
* description, inputs, expected/outputs/cardIo, params, skipWhen)
|
|
114
|
+
* @returns the RegistryStage row */
|
|
32
115
|
export function plainStage(row) {
|
|
33
116
|
return {
|
|
34
117
|
id: row.id,
|
|
@@ -46,6 +129,15 @@ export function plainStage(row) {
|
|
|
46
129
|
fromFlow: null,
|
|
47
130
|
};
|
|
48
131
|
}
|
|
132
|
+
/** The from_flow link builder: a stage copied from the named flow's
|
|
133
|
+
* stage at expansion time (id and inputs overridden there); the
|
|
134
|
+
* engine/card/description fields ride empty until the link resolves,
|
|
135
|
+
* and the source may register later than this row.
|
|
136
|
+
* @param flow the source flow's id
|
|
137
|
+
* @param stage the source stage's id
|
|
138
|
+
* @param id this row's own stage id
|
|
139
|
+
* @param inputs the row's winning input edges
|
|
140
|
+
* @returns the linked RegistryStage row */
|
|
49
141
|
export function linkedStage(flow, stage, id, inputs) {
|
|
50
142
|
return {
|
|
51
143
|
id,
|
|
@@ -81,19 +173,15 @@ export function linkedStage(flow, stage, id, inputs) {
|
|
|
81
173
|
* (default unlimited), inputs (the plus-box list). The stage
|
|
82
174
|
* params carry those fields at DRIVE time; the registry row is
|
|
83
175
|
* the template + the agent leaf. */
|
|
84
|
-
import {
|
|
176
|
+
import { ANNY_HMR_ESTIMATOR, ANNY_PARAMS, CHARACTER_FACTORY, FIT_SEAT, IMAGE_UPSCALE, CRAFT_LOOP, OBJECT_FORGE, } from "./flowsRegistryRows.js";
|
|
85
177
|
import { Service } from "@deepseek-ai/cordis";
|
|
86
178
|
const REGISTRY = {
|
|
87
179
|
"craft-loop": CRAFT_LOOP,
|
|
88
180
|
"anny-hmr-estimator": ANNY_HMR_ESTIMATOR,
|
|
89
|
-
"body-to-somax": BODY_TO_SOMAX,
|
|
90
181
|
"character-factory": CHARACTER_FACTORY,
|
|
91
182
|
"anny-params": ANNY_PARAMS,
|
|
92
|
-
"audio-native-tts": AUDIO_NATIVE_TTS,
|
|
93
|
-
"extend-video": VIDEO_EXTEND,
|
|
94
183
|
"fit-seat": FIT_SEAT,
|
|
95
184
|
"image-upscale": IMAGE_UPSCALE,
|
|
96
|
-
"music-native": MUSIC_NATIVE,
|
|
97
185
|
"object-forge": OBJECT_FORGE,
|
|
98
186
|
};
|
|
99
187
|
/** A pure read-only seat over the boot seed (REGISTRY verbatim, no
|
|
@@ -271,6 +359,14 @@ function detachStage(st) {
|
|
|
271
359
|
skipWhen: structuredClone(st.skipWhen),
|
|
272
360
|
};
|
|
273
361
|
}
|
|
362
|
+
/** Expand a declaration into servable form: self-contained stages pass
|
|
363
|
+
* the raw-workflow gate and detach into fresh containers; linked
|
|
364
|
+
* stages resolve against the LIVE seat (source flow and stage must
|
|
365
|
+
* exist, single-hop only) and copy the source row under this row's id
|
|
366
|
+
* and inputs. A dangling link refuses loud, naming the flow and stage.
|
|
367
|
+
* @param flow the declaration to expand
|
|
368
|
+
* @param seat the live FlowsSeat the links resolve against
|
|
369
|
+
* @returns the flow with every stage expanded */
|
|
274
370
|
export function expandRegistryFlow(flow, seat) {
|
|
275
371
|
const stages = flow.stages.map((st) => {
|
|
276
372
|
if (st.fromFlow === null) {
|
|
@@ -388,8 +484,9 @@ function checkFileInitial(key, kind, value, roots) {
|
|
|
388
484
|
: "";
|
|
389
485
|
// The vocab is TYPED DATA now (mediaKinds.ts, REBUILD-7) — no
|
|
390
486
|
// repo-anchored kindsPath read survives the re-home. The video
|
|
391
|
-
// kind rides the same vocab's video list (
|
|
392
|
-
//
|
|
487
|
+
// kind rides the same vocab's video list (a prior-clip initial —
|
|
488
|
+
// mp4/webm/mkv/mov/m4v/avi; born on the retired extend-video
|
|
489
|
+
// wrapper).
|
|
393
490
|
const kinds = mediaVocab();
|
|
394
491
|
const allowed = kind === "photo" ? kinds.image : kind === "video" ? kinds.video : kinds.model;
|
|
395
492
|
if (!allowed.includes(ext)) {
|
|
@@ -458,7 +555,11 @@ export function initialFileCandidates(raw, roots) {
|
|
|
458
555
|
cands.push(join(root, rel));
|
|
459
556
|
}
|
|
460
557
|
}
|
|
461
|
-
else if (raw
|
|
558
|
+
else if (isAbsolute(raw)) {
|
|
559
|
+
// (isAbsolute, not startsWith("/"): a native absolute path
|
|
560
|
+
// carries backslashes on win32 and fell into the relative
|
|
561
|
+
// branch — resolve()d twice into a doubled candidate. On posix
|
|
562
|
+
// the two spellings coincide.)
|
|
462
563
|
cands.push(raw);
|
|
463
564
|
}
|
|
464
565
|
else {
|
|
@@ -505,6 +606,50 @@ export function registryInitialsError(flow, body, roots) {
|
|
|
505
606
|
}
|
|
506
607
|
continue;
|
|
507
608
|
}
|
|
609
|
+
// A BRIEF initial is PROSE (F58, the craft-loop binding): the
|
|
610
|
+
// brief is data a critique loop reads — no file door ever opens
|
|
611
|
+
// it, so the path law that guards names would mis-refuse honest
|
|
612
|
+
// prose ("a 3/4 view poster"). The door judges emptiness only;
|
|
613
|
+
// length and sense are the critic's problem.
|
|
614
|
+
if (kind === "brief") {
|
|
615
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
616
|
+
return "initial " + JSON.stringify(key) +
|
|
617
|
+
" must be a non-empty brief (got " + (typeof value) + ")";
|
|
618
|
+
}
|
|
619
|
+
continue;
|
|
620
|
+
}
|
|
621
|
+
// A NUMBER initial is a finite JSON number (F58): digit-strings
|
|
622
|
+
// REFUSE — the caller sent JSON, and a silent fold would mask the
|
|
623
|
+
// caller's shape bug until the engine's own numeric gate refused
|
|
624
|
+
// it with a stranger's voice.
|
|
625
|
+
if (kind === "number") {
|
|
626
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
627
|
+
return "initial " + JSON.stringify(key) +
|
|
628
|
+
" must be a finite number (got " + (typeof value) + " — send JSON numbers, not strings)";
|
|
629
|
+
}
|
|
630
|
+
continue;
|
|
631
|
+
}
|
|
632
|
+
// A JSON initial is an object or its JSON-string spelling (F58):
|
|
633
|
+
// the door judges parseability + objectness only — the consuming
|
|
634
|
+
// engine's gate owns the inner shape (craft's command row:
|
|
635
|
+
// {engine, params}, refused by the engine's own LOUD voice).
|
|
636
|
+
if (kind === "json") {
|
|
637
|
+
let v = value;
|
|
638
|
+
if (typeof v === "string") {
|
|
639
|
+
try {
|
|
640
|
+
v = JSON.parse(v);
|
|
641
|
+
}
|
|
642
|
+
catch {
|
|
643
|
+
return "initial " + JSON.stringify(key) +
|
|
644
|
+
" is a JSON string that does not parse";
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
if (typeof v !== "object" || v === null || Array.isArray(v)) {
|
|
648
|
+
return "initial " + JSON.stringify(key) +
|
|
649
|
+
" must be a JSON object or its string spelling (got " + (typeof value) + ")";
|
|
650
|
+
}
|
|
651
|
+
continue;
|
|
652
|
+
}
|
|
508
653
|
const err = checkFileInitial(key, kind, value, roots);
|
|
509
654
|
if (err !== null)
|
|
510
655
|
return err;
|
|
@@ -526,18 +671,24 @@ export function registryInitialsError(flow, body, roots) {
|
|
|
526
671
|
}
|
|
527
672
|
return null;
|
|
528
673
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
|
|
541
692
|
export function normalizedInitialValue(key, kind, value) {
|
|
542
693
|
// A TEXT initial is a BARE NAME: nothing unwraps it and nothing
|
|
543
694
|
// path-shaped reaches it, so the {path: …} arm below never runs
|
|
@@ -546,6 +697,27 @@ export function normalizedInitialValue(key, kind, value) {
|
|
|
546
697
|
// first — this arm makes the extractor honest on its own.)
|
|
547
698
|
if (kind === "text")
|
|
548
699
|
return typeof value === "string" ? value : null;
|
|
700
|
+
if (kind === "brief")
|
|
701
|
+
return typeof value === "string" && value.trim() !== "" ? value : null;
|
|
702
|
+
if (kind === "number")
|
|
703
|
+
return typeof value === "number" && Number.isFinite(value) ? value : null;
|
|
704
|
+
if (kind === "json") {
|
|
705
|
+
if (typeof value === "string") {
|
|
706
|
+
try {
|
|
707
|
+
const parsed = JSON.parse(value);
|
|
708
|
+
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)
|
|
709
|
+
? parsed
|
|
710
|
+
: null;
|
|
711
|
+
// an unparseable JSON string throws SyntaxError — null fails loud at the door, a shape the gate would have refused
|
|
712
|
+
}
|
|
713
|
+
catch {
|
|
714
|
+
return null;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
return typeof value === "object" && value !== null && !Array.isArray(value)
|
|
718
|
+
? value
|
|
719
|
+
: null;
|
|
720
|
+
}
|
|
549
721
|
if (typeof value === "string")
|
|
550
722
|
return value;
|
|
551
723
|
if (kind === "bake_params") {
|
|
@@ -588,8 +760,14 @@ export function extractRequestInitials(flow, body) {
|
|
|
588
760
|
(typeof value) + ")"
|
|
589
761
|
: kind === "text"
|
|
590
762
|
? " must be a bare name (got " + (typeof value) + ")"
|
|
591
|
-
:
|
|
592
|
-
(typeof value) + ")"
|
|
763
|
+
: kind === "brief"
|
|
764
|
+
? " must be a non-empty brief (got " + (typeof value) + ")"
|
|
765
|
+
: kind === "number"
|
|
766
|
+
? " must be a finite number (got " + (typeof value) + " — send JSON numbers, not strings)"
|
|
767
|
+
: kind === "json"
|
|
768
|
+
? " must be a JSON object or its string spelling (got " + (typeof value) + ")"
|
|
769
|
+
: " must be a file path string or {path: ...} (got " +
|
|
770
|
+
(typeof value) + ")"),
|
|
593
771
|
};
|
|
594
772
|
}
|
|
595
773
|
initials[key] = normalized;
|
|
@@ -33,6 +33,7 @@ export function liveFamilySeat(modelsSeat) {
|
|
|
33
33
|
try {
|
|
34
34
|
const decls = modelsService().allDecls();
|
|
35
35
|
return { decls, state: decls.length === 0 ? "bare" : "seated" };
|
|
36
|
+
// an unbooted context throws on the singleton read — "absent" is the seat's answer, and a family stage refuses loud on it inside composeOne
|
|
36
37
|
}
|
|
37
38
|
catch {
|
|
38
39
|
return { decls: [], state: "absent" };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CardRegistryService } from "./cardsRegistry.js";
|
|
2
|
+
import type { RegistryToolOverlay } from "./flowsData.js";
|
|
2
3
|
/**
|
|
3
4
|
* The overlay's mod-fold scoping decision (round-22 compose audit
|
|
4
5
|
* Q3a): which family scopes the absorbed mod surface for a stage's
|
|
@@ -50,6 +51,12 @@ export declare function overlayDecls(cardRegistry: Pick<CardRegistryService, "ca
|
|
|
50
51
|
* @param fam the request's family seat (`body.model`, "" when the
|
|
51
52
|
* request names none) — scopes the absorbed mod surface to the
|
|
52
53
|
* owning atom, the same fold compose and variant judge with
|
|
54
|
+
* @param toolOverlays the flow row's declared tool overlays — a
|
|
55
|
+
* verbatim (choices-null) overlay pins its flat param on EVERY
|
|
56
|
+
* listed stage (image-upscale's twin make+polish seed), the
|
|
57
|
+
* declared semantic the generic single-target scan would refuse
|
|
58
|
+
* as ambiguous. Choices-mapped overlays fall through to the
|
|
59
|
+
* generic scan (today's law, unchanged).
|
|
53
60
|
*/
|
|
54
|
-
export declare function applyFlowParamsOverride(flowName: string, stages: ReadonlyArray<unknown>, overrideRaw: unknown, decls: ReturnType<CardRegistryService["cardDecls"]>, fam: string): void;
|
|
61
|
+
export declare function applyFlowParamsOverride(flowName: string, stages: ReadonlyArray<unknown>, overrideRaw: unknown, decls: ReturnType<CardRegistryService["cardDecls"]>, fam: string, toolOverlays?: readonly RegistryToolOverlay[]): void;
|
|
55
62
|
//# sourceMappingURL=flowsParamsOverlay.d.ts.map
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { RemoteError } from "@deepseek-ai/dsh-typert-protocol";
|
|
5
5
|
import { owningAtom, theService } from "@melite/comfyui-cordis";
|
|
6
6
|
import { cardAdmits } from "./cardsCompose.js";
|
|
7
|
+
import { ESTATE_NAMING_ROW } from "@melite/contracts/formSpec";
|
|
7
8
|
/**
|
|
8
9
|
* The overlay's mod-fold scoping decision (round-22 compose audit
|
|
9
10
|
* Q3a): which family scopes the absorbed mod surface for a stage's
|
|
@@ -67,8 +68,14 @@ export function overlayDecls(cardRegistry) {
|
|
|
67
68
|
* @param fam the request's family seat (`body.model`, "" when the
|
|
68
69
|
* request names none) — scopes the absorbed mod surface to the
|
|
69
70
|
* owning atom, the same fold compose and variant judge with
|
|
71
|
+
* @param toolOverlays the flow row's declared tool overlays — a
|
|
72
|
+
* verbatim (choices-null) overlay pins its flat param on EVERY
|
|
73
|
+
* listed stage (image-upscale's twin make+polish seed), the
|
|
74
|
+
* declared semantic the generic single-target scan would refuse
|
|
75
|
+
* as ambiguous. Choices-mapped overlays fall through to the
|
|
76
|
+
* generic scan (today's law, unchanged).
|
|
70
77
|
*/
|
|
71
|
-
export function applyFlowParamsOverride(flowName, stages, overrideRaw, decls, fam) {
|
|
78
|
+
export function applyFlowParamsOverride(flowName, stages, overrideRaw, decls, fam, toolOverlays = []) {
|
|
72
79
|
if (typeof overrideRaw !== "object" || overrideRaw === null || Array.isArray(overrideRaw)) {
|
|
73
80
|
throw new RemoteError("runs/invalid-request", "flow params must be an object ({key: value} or {stage_id: {key: value}}), got " +
|
|
74
81
|
JSON.stringify(overrideRaw), { loc: "params" });
|
|
@@ -117,7 +124,11 @@ export function applyFlowParamsOverride(flowName, stages, overrideRaw, decls, fa
|
|
|
117
124
|
};
|
|
118
125
|
const admitsParam = (row, key) => {
|
|
119
126
|
const card = typeof row["card"] === "string" ? row["card"] : "";
|
|
120
|
-
|
|
127
|
+
// THE ESTATE NAMING ROW (queue 12): compose's admission door
|
|
128
|
+
// sanctions it estate-wide (the faces teach it on every card
|
|
129
|
+
// declaring none of its own); validate over-admitting into that
|
|
130
|
+
// door is this overlay's own law.
|
|
131
|
+
return key === ESTATE_NAMING_ROW.name || cardAdmits(decls[card], modNamesOf(card), key);
|
|
121
132
|
};
|
|
122
133
|
// THE FAMILY ROWS TAKE NO PARAMS (round-23 audit Q2): a family
|
|
123
134
|
// stage carries card "" (the either/or row contract), so no decl
|
|
@@ -172,6 +183,40 @@ export function applyFlowParamsOverride(flowName, stages, overrideRaw, decls, fa
|
|
|
172
183
|
}
|
|
173
184
|
continue;
|
|
174
185
|
}
|
|
186
|
+
|
|
187
|
+
// reproduce): a verbatim tool overlay pins its flat param on
|
|
188
|
+
// every listed stage BEFORE the single-target scan runs, so a
|
|
189
|
+
// declared twin (image-upscale's seed → make + polish) stamps
|
|
190
|
+
// both and the stated seed reaches both samplers. The admission
|
|
191
|
+
// scan below never sees the key (consumed here); a listed stage
|
|
192
|
+
// that admits nothing, or a stage id the row does not name, is a
|
|
193
|
+
// broken declaration and refuses LOUD — never a silent half-pin.
|
|
194
|
+
const twins = toolOverlays.filter((o) => o.param === key && o.choices === null);
|
|
195
|
+
if (twins.length > 0) {
|
|
196
|
+
for (const o of twins) {
|
|
197
|
+
const target = stageRows.find((r) => r["id"] === o.stage);
|
|
198
|
+
if (target === undefined) {
|
|
199
|
+
throw new RemoteError("runs/invalid-request", "flow " + flowName + " declares a seed overlay on stage " +
|
|
200
|
+
JSON.stringify(o.stage) + " — no such stage " +
|
|
201
|
+
"(stages: " + stageRows.map((r) => JSON.stringify(r["id"])).join(", ") + ")", { loc: "params" });
|
|
202
|
+
}
|
|
203
|
+
if (!admitsParam(target, key)) {
|
|
204
|
+
throw new RemoteError("runs/invalid-request", "card " + JSON.stringify(target["card"]) +
|
|
205
|
+
" does not admit param " + JSON.stringify(key) +
|
|
206
|
+
" — the flow's declared overlay names it anyway (admitted: " +
|
|
207
|
+
JSON.stringify(admitOf(target)) + ")", { loc: "params" });
|
|
208
|
+
}
|
|
209
|
+
let at = paramsOf(target);
|
|
210
|
+
for (const seg of o.path.slice(0, -1)) {
|
|
211
|
+
if (typeof at[seg] !== "object" || at[seg] === null || Array.isArray(at[seg])) {
|
|
212
|
+
at[seg] = {};
|
|
213
|
+
}
|
|
214
|
+
at = at[seg];
|
|
215
|
+
}
|
|
216
|
+
at[o.path[o.path.length - 1]] = value;
|
|
217
|
+
}
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
175
220
|
// THE FLAT SHAPE: exactly one admitting stage, or refuse.
|
|
176
221
|
const targets = stageRows.filter((r) => admitsParam(r, key));
|
|
177
222
|
if (targets.length === 0) {
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { RegistryFlow } from "./flowsData.js";
|
|
2
2
|
export declare const ANNY_HMR_ESTIMATOR: RegistryFlow;
|
|
3
3
|
export declare const ANNY_PARAMS: RegistryFlow;
|
|
4
|
-
export declare const AUDIO_NATIVE_TTS: RegistryFlow;
|
|
5
|
-
export declare const BODY_TO_SOMAX: RegistryFlow;
|
|
6
4
|
export declare const FIT_SEAT: RegistryFlow;
|
|
7
5
|
export declare const IMAGE_UPSCALE: RegistryFlow;
|
|
8
|
-
export declare const VIDEO_EXTEND: RegistryFlow;
|
|
9
|
-
export declare const MUSIC_NATIVE: RegistryFlow;
|
|
10
6
|
export declare const CRAFT_LOOP: RegistryFlow;
|
|
11
7
|
export declare const CHARACTER_FACTORY: RegistryFlow;
|
|
12
8
|
export declare const OBJECT_FORGE: RegistryFlow;
|