@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/runsSourceEcho.js
CHANGED
|
@@ -42,7 +42,7 @@ import { segmentConfined, servableLeaf } from "@melite/contracts/mediaKinds";
|
|
|
42
42
|
// enums, import type for types, .ts specifiers for relative imports.
|
|
43
43
|
import { LEGACY_RUN_MEDIA_PREFIX, RUN_MEDIA_PREFIX, RUN_ID_RE } from "@melite/contracts/benchStage";
|
|
44
44
|
import { statSync } from "node:fs";
|
|
45
|
-
import { join } from "node:path";
|
|
45
|
+
import { isAbsolute, join } from "node:path";
|
|
46
46
|
/** The serving prefixes the estate owns (comfyui-upload's
|
|
47
47
|
* MEDIA/ASSET_ROUTE_PREFIX twins — detection is case-insensitive
|
|
48
48
|
* like the engine's; the sliced tail keeps its case). */
|
|
@@ -89,6 +89,7 @@ export function galleryTail(t) {
|
|
|
89
89
|
let path = null;
|
|
90
90
|
try {
|
|
91
91
|
path = new URL(t, "http://source-echo.invalid").searchParams.get("path");
|
|
92
|
+
// a string the URL parser refuses is not a well-formed gallery pointer — null falls through to the caller's absolute face where a bad pointer still refuses loud
|
|
92
93
|
}
|
|
93
94
|
catch {
|
|
94
95
|
return null;
|
|
@@ -121,7 +122,10 @@ function detectFace(t) {
|
|
|
121
122
|
const tail = galleryTail(t);
|
|
122
123
|
if (tail !== null)
|
|
123
124
|
return { face: "run", rest: tail, decoded: true };
|
|
124
|
-
|
|
125
|
+
// (isAbsolute, not startsWith("/"): a win32-absolute disk path
|
|
126
|
+
// carries a drive prefix and misfiled as prose — no "/" anywhere —
|
|
127
|
+
// so staging refused it "not a source pointer")
|
|
128
|
+
if (isAbsolute(t))
|
|
125
129
|
return { face: "abs", rest: t, decoded: false };
|
|
126
130
|
|
|
127
131
|
// `t.includes("..")` substring ban refused a LEGAL name the engine
|
|
@@ -137,6 +141,7 @@ function detectFace(t) {
|
|
|
137
141
|
let decodedHead;
|
|
138
142
|
try {
|
|
139
143
|
decodedHead = decodeURIComponent(head);
|
|
144
|
+
// a bad percent-escape means the head is not a minted run id — null sends the pointer to the caller's loud not-a-source refusal instead of a parser crash
|
|
140
145
|
}
|
|
141
146
|
catch {
|
|
142
147
|
return null;
|
|
@@ -256,6 +261,7 @@ export function parseMediaRef(ref) {
|
|
|
256
261
|
function isDir(p) {
|
|
257
262
|
try {
|
|
258
263
|
return statSync(p).isDirectory();
|
|
264
|
+
// statSync fails on a missing or unreadable path — a path that stats as nothing is not a directory, so false is the caller's exact answer
|
|
259
265
|
}
|
|
260
266
|
catch {
|
|
261
267
|
return false;
|
|
@@ -310,7 +316,7 @@ export function resolveSourceRefs(refs, roots, cwd = process.cwd(), selfRunId =
|
|
|
310
316
|
// THE CWD FALL-THROUGH (the stager's own order — a tail the
|
|
311
317
|
// trees miss still stages from the lane's cwd, so the guard
|
|
312
318
|
// honors it too; same process, same cwd, no drift).
|
|
313
|
-
if (file === "" && !parsed.url.trim()
|
|
319
|
+
if (file === "" && !isAbsolute(parsed.url.trim())) {
|
|
314
320
|
const cand = join(cwd, parsed.rel);
|
|
315
321
|
if (isFile(cand))
|
|
316
322
|
file = cand;
|
package/lib/runsStart.d.ts
CHANGED
|
@@ -46,10 +46,12 @@ export interface CompiledStage {
|
|
|
46
46
|
readonly expected: Record<string, EngineJson>;
|
|
47
47
|
readonly outputNodes: Record<string, EngineJson>;
|
|
48
48
|
readonly inputNames: Record<string, string>;
|
|
49
|
-
/** The stage DECLARED its outputs
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
49
|
+
/** The stage DECLARED its outputs (true = the outputs map or the
|
|
50
|
+
* cardIo table rode the doc — both are the doc's own tables, so
|
|
51
|
+
* the replay judge can read the channels. False = a fill supplied
|
|
52
|
+
* them from outside the doc (pre-one-table docs, whose engine-fill
|
|
53
|
+
* {default: ...} channels live nowhere the doc names). The replay
|
|
54
|
+
* judge judges only fully-declared docs. */
|
|
53
55
|
readonly outputsDeclared: boolean;
|
|
54
56
|
}
|
|
55
57
|
/** flow_inline structural compile — door-verbatim (structure via
|
package/lib/runsStart.js
CHANGED
|
@@ -22,7 +22,6 @@ import { FLOW_INLINE_TOP_VOICE, INLINE_TOP_KEYS, STAGE_KEYS, checkFlowInlineTop,
|
|
|
22
22
|
import { appendLedger, graphReceiptFoldOf, outRootFor, refusal, sidecarDoc, sidecarStageOf, variantOfBodies, writeJsonAtomic } from "./queue.js";
|
|
23
23
|
import { lifecycleInFlight } from "./lifecycleLatch.js";
|
|
24
24
|
import { toRemoteError } from "./runsRefusalVoices.js";
|
|
25
|
-
import { engineDefaultOutput } from "./runsValidateShared.js";
|
|
26
25
|
import { rootsManifest } from "./rootsManifest.js";
|
|
27
26
|
// the envelope-refusal SSOT lives in queueSubmit.ts (beside
|
|
28
27
|
// walkSubmitEnvelope, the one walker the registry delegates to) —
|
|
@@ -293,38 +292,32 @@ export function compileFlowInline(inline, knownEngines = [CARD_PLANE_ENGINE]) {
|
|
|
293
292
|
"output_nodes makes the run register without it", "invalid_request");
|
|
294
293
|
}
|
|
295
294
|
|
|
296
|
-
//
|
|
297
|
-
//
|
|
298
|
-
//
|
|
299
|
-
//
|
|
300
|
-
//
|
|
301
|
-
//
|
|
302
|
-
|
|
303
|
-
// engine gate above admits only grammatical, registered ids, so
|
|
304
|
-
// no reachable engine reads it — a grammar id the table has not
|
|
305
|
-
// learned yet refuses HERE, in the door's voice, instead of
|
|
306
|
-
// validating-refuse/start-accepting.
|
|
295
|
+
// "undeclared" — the compiler reads the stage's OWN card_io
|
|
296
|
+
// table (the card's declared output channels, carried on the
|
|
297
|
+
// row), never the engine registry (membership-only since the
|
|
298
|
+
// cure: it names no kinds). A stage with neither refuses here,
|
|
299
|
+
// in the door's voice, naming the fix — a fabricated
|
|
300
|
+
// {default: <engine kind>} once bound the retired music-native
|
|
301
|
+
|
|
307
302
|
const declaredOutputs = st["outputs"];
|
|
308
303
|
const outputsDeclared = typeof declaredOutputs === "object" && declaredOutputs !== null &&
|
|
309
304
|
!Array.isArray(declaredOutputs) &&
|
|
310
305
|
Object.keys(declaredOutputs).length > 0;
|
|
306
|
+
const rawCardIo = st["card_io"];
|
|
307
|
+
const cardIoDeclared = typeof rawCardIo === "object" && rawCardIo !== null &&
|
|
308
|
+
!Array.isArray(rawCardIo) &&
|
|
309
|
+
Object.keys(rawCardIo).length > 0;
|
|
311
310
|
let outputs;
|
|
312
311
|
if (outputsDeclared) {
|
|
313
312
|
outputs = declaredOutputs;
|
|
314
313
|
}
|
|
314
|
+
else if (cardIoDeclared) {
|
|
315
|
+
outputs = rawCardIo;
|
|
316
|
+
}
|
|
315
317
|
else {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
leg is the future-split guard, unreachable until the grammar
|
|
320
|
-
grows a table-unknown id. */
|
|
321
|
-
if (kind === undefined) {
|
|
322
|
-
return refusal(400, "flow_inline stage " + JSON.stringify(sid) + ": engine " +
|
|
323
|
-
JSON.stringify(engine) +
|
|
324
|
-
" has no default output kind — the engine table names no row for it" +
|
|
325
|
-
" (a grammar id the table has not learned yet); name it in the table", "invalid_request");
|
|
326
|
-
}
|
|
327
|
-
outputs = { default: kind };
|
|
318
|
+
return refusal(400, "flow_inline stage " + JSON.stringify(sid) + " declares no outputs and carries no card_io — " +
|
|
319
|
+
"name every produced channel on the stage (outputs={'<channel>': <Kind>}) or carry the card's " +
|
|
320
|
+
"declared cardIo table; the engine registry names engines, never their outputs", "invalid_request");
|
|
328
321
|
}
|
|
329
322
|
const expected = typeof st["expected"] === "object" && st["expected"] !== null && !Array.isArray(st["expected"])
|
|
330
323
|
? st["expected"]
|
|
@@ -380,7 +373,7 @@ export function compileFlowInline(inline, knownEngines = [CARD_PLANE_ENGINE]) {
|
|
|
380
373
|
JSON.stringify([...new Set(ghosts)].sort()) +
|
|
381
374
|
" but the stage wires no input of that name — the merge would refuse it at run time ('$name' must name a FromStage-wired input or a request initial; name it or wire it)", "invalid_request");
|
|
382
375
|
}
|
|
383
|
-
stages.push({ id: sid, engine, params, outputs, outputsDeclared, expected, outputNodes, inputNames });
|
|
376
|
+
stages.push({ id: sid, engine, params, outputs, outputsDeclared: outputsDeclared || cardIoDeclared, expected, outputNodes, inputNames });
|
|
384
377
|
}
|
|
385
378
|
return { stages };
|
|
386
379
|
}
|
|
@@ -447,6 +440,14 @@ export async function registerCompiledRun(args) {
|
|
|
447
440
|
outputs: { ...st.outputs },
|
|
448
441
|
params: { ...st.params },
|
|
449
442
|
}));
|
|
443
|
+
|
|
444
|
+
// door's bench doc read is the run's incarnation — both register
|
|
445
|
+
// arms carry the same doc they judged (benchStageIdOf), so the
|
|
446
|
+
// stamp rides the door, never a re-read. Stamped once here; every
|
|
447
|
+
// sidecar rewrite carries it (sidecarFacesOf). Absent on pre-cure
|
|
448
|
+
// benches (no epoch, no key — never guessed).
|
|
449
|
+
const benchEpochRaw = door.benchDoc?.["epoch"];
|
|
450
|
+
const benchEpoch = typeof benchEpochRaw === "string" && benchEpochRaw !== "" ? benchEpochRaw : undefined;
|
|
450
451
|
const run = {
|
|
451
452
|
runId,
|
|
452
453
|
status: "queued",
|
|
@@ -477,6 +478,9 @@ export async function registerCompiledRun(args) {
|
|
|
477
478
|
...(door.initialFileKeys !== undefined && door.initialFileKeys.length > 0
|
|
478
479
|
? { initialFileKeys: [...door.initialFileKeys] }
|
|
479
480
|
: {}),
|
|
481
|
+
// THE BENCH INCARNATION rides the row (W-3 / F3-11) — the queued
|
|
482
|
+
// sidecar stamps it, the claim/settle rewrites carry it verbatim.
|
|
483
|
+
...(benchEpoch !== undefined ? { benchEpoch } : {}),
|
|
480
484
|
};
|
|
481
485
|
run.inputNames = Object.fromEntries(compiled.stages.map((st) => [st.id, { ...st.inputNames }]));
|
|
482
486
|
if (args.warnings !== undefined && args.warnings.length > 0) {
|
|
@@ -759,6 +763,9 @@ function sidecarDocFor(run) {
|
|
|
759
763
|
testFlag: run.testFlag,
|
|
760
764
|
draftId: run.draftId,
|
|
761
765
|
pipeline: run.pipeline,
|
|
766
|
+
// THE BENCH INCARNATION rides the queued sidecar too (W-3 /
|
|
767
|
+
// F3-11 — the wand/restore and the list read disk, not memory).
|
|
768
|
+
benchEpoch: run.benchEpoch,
|
|
762
769
|
graph: run.graphRows,
|
|
763
770
|
cardSnapshot: run.cardSnapshot,
|
|
764
771
|
benchSnapshot: run.benchSnapshot,
|
package/lib/runsTypes.d.ts
CHANGED
|
@@ -86,6 +86,16 @@ export interface RunRecord {
|
|
|
86
86
|
|
|
87
87
|
|
|
88
88
|
pressKey?: string;
|
|
89
|
+
/** THE ATTRIBUTION MARKER (F3 D3-07, the 15 s bound's third
|
|
90
|
+
* burn): 'missed' when the bench-plane stamp-back died at its
|
|
91
|
+
* bound AFTER the run settled — the run row, not the wedged
|
|
92
|
+
* draft door, carries the fact so run_status and the press
|
|
93
|
+
* receipt can say "completed — NOT shown on the tab" instead of
|
|
94
|
+
* a bare done. Written by the runs attribute door (the live-run
|
|
95
|
+
* registry plane, never the bench plane that died); a landed
|
|
96
|
+
* re-stamp clears it. Absent on runs whose stamp landed (or was
|
|
97
|
+
* never owed). */
|
|
98
|
+
attribution?: string;
|
|
89
99
|
/** THE CARD SNAPSHOT (stroke 45): the exact card + body that ran
|
|
90
100
|
* ({card, params}) — the wand restores from this, never from the
|
|
91
101
|
* living bench. Stamped at registration, carried through settle
|
|
@@ -104,6 +114,14 @@ export interface RunRecord {
|
|
|
104
114
|
* at Run press ({stages, intent}) — same carry law as the card
|
|
105
115
|
* snapshot. */
|
|
106
116
|
benchSnapshot?: unknown;
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
benchEpoch?: string;
|
|
107
125
|
/** F-6(b) ADMISSION WARNINGS (stamped post-registration by the
|
|
108
126
|
* start door — the film lane's VRAM-pressure warn): served on
|
|
109
127
|
* run_status rows, never a refusal. Absent means none. */
|
|
@@ -206,7 +224,17 @@ export interface RunRecord {
|
|
|
206
224
|
}
|
|
207
225
|
/** The engine's path relative to the run dir (runRel, door-verbatim). */
|
|
208
226
|
export declare function runRel(run: RunRecord, art: string): string;
|
|
209
|
-
/**
|
|
227
|
+
/** THE THROWN-VALUE FOLD (qa8 F38): run_status once served
|
|
228
|
+
* "Error: [object Object]" for a real OOM because a plain-object
|
|
229
|
+
* throw met String(). A thrown non-Error renders by its own words —
|
|
230
|
+
* a bare string verbatim; an object's message/error string fields
|
|
231
|
+
* first, then its JSON; a circular or unserializable value folds to
|
|
232
|
+
* its key roster. The vacuous "[object Object]" can never leave this
|
|
233
|
+
* door. */
|
|
234
|
+
export declare function foldThrownValue(value: unknown): string;
|
|
235
|
+
/** "<Type>: <msg>" — the worker's terminal error text. The message
|
|
236
|
+
* half rides the thrown-value fold (F38): a thrown object reaches
|
|
237
|
+
* the run's error column as its own words. */
|
|
210
238
|
export declare function errText(err: unknown): string;
|
|
211
239
|
/** The settle persist (the R3 durable-queue mirror of registration,
|
|
212
240
|
* door-verbatim): the terminal status rewrites the run's
|
|
@@ -231,6 +259,31 @@ export declare function settlePersist(run: RunRecord, stateRoot: string): Promis
|
|
|
231
259
|
|
|
232
260
|
|
|
233
261
|
export declare function claimPersist(run: RunRecord): Promise<void>;
|
|
262
|
+
/** THE ATTRIBUTION PERSIST (F3 D3-07, the 15 s bound's third burn):
|
|
263
|
+
* the runs registry's attribute door rewrites the run's
|
|
264
|
+
* _flow.json the moment it marks a stamp-miss — the marker must
|
|
265
|
+
* survive a registry reload (the status door's disk fallback
|
|
266
|
+
* spreads this row) and outlive the wedged bench plane that
|
|
267
|
+
* dropped the stamp. Best-effort by the claim/settle law: the
|
|
268
|
+
* in-memory row is the truth, a persist failure never blocks the
|
|
269
|
+
* mark. No ledger row: the ledger carries dispositions, and the
|
|
270
|
+
* stamp's own miss voice is the press receipt's job.
|
|
271
|
+
* @param run the marked row (the caller already set
|
|
272
|
+
* run.attribution in memory).
|
|
273
|
+
* @returns when the write completed or self-swallowed its fault. */
|
|
274
|
+
export declare function attributionPersist(run: RunRecord): Promise<void>;
|
|
275
|
+
/** THE RENAME PERSIST (queue 12 Phase B): the runs registry's rename
|
|
276
|
+
* door rewrites the run's _flow.json the moment a gallery row's
|
|
277
|
+
* `label` lands — the display name must survive a registry reload
|
|
278
|
+
* (the status door's disk fallback spreads this row) and every
|
|
279
|
+
* later boot's re-read. Best-effort by the claim/settle law: the
|
|
280
|
+
* in-memory row is the truth, a persist failure never blocks the
|
|
281
|
+
* rename. The row's `name` is untouched — this write carries the
|
|
282
|
+
* patched row only because sidecarFacesOf mirrors the live stages.
|
|
283
|
+
* @param run the patched row (the caller already rewrote the gallery
|
|
284
|
+
* label in memory).
|
|
285
|
+
* @returns when the write completed or self-swallowed its fault. */
|
|
286
|
+
export declare function galleryLabelPersist(run: RunRecord): Promise<void>;
|
|
234
287
|
/** The synthesized log tail (door-verbatim port: the retired
|
|
235
288
|
* oracle's status voice, synthesized from the live row). */
|
|
236
289
|
export declare function runLogTail(obj: {
|
package/lib/runsTypes.js
CHANGED
|
@@ -43,10 +43,43 @@ function errName(err) {
|
|
|
43
43
|
}
|
|
44
44
|
return "Error";
|
|
45
45
|
}
|
|
46
|
-
/**
|
|
46
|
+
/** THE THROWN-VALUE FOLD (qa8 F38): run_status once served
|
|
47
|
+
* "Error: [object Object]" for a real OOM because a plain-object
|
|
48
|
+
* throw met String(). A thrown non-Error renders by its own words —
|
|
49
|
+
* a bare string verbatim; an object's message/error string fields
|
|
50
|
+
* first, then its JSON; a circular or unserializable value folds to
|
|
51
|
+
* its key roster. The vacuous "[object Object]" can never leave this
|
|
52
|
+
* door. */
|
|
53
|
+
export function foldThrownValue(value) {
|
|
54
|
+
if (typeof value === "string")
|
|
55
|
+
return value;
|
|
56
|
+
if (value instanceof Error)
|
|
57
|
+
return value.message;
|
|
58
|
+
if (typeof value === "object" && value !== null) {
|
|
59
|
+
const rec = value;
|
|
60
|
+
for (const key of ["message", "error", "detail", "reason"]) {
|
|
61
|
+
const v = rec[key];
|
|
62
|
+
if (typeof v === "string" && v.trim() !== "")
|
|
63
|
+
return v;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const json = JSON.stringify(value);
|
|
67
|
+
if (json !== "{}" && json !== "[]")
|
|
68
|
+
return json;
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// circular or BigInt — the key roster below still names it
|
|
72
|
+
}
|
|
73
|
+
const keys = Object.keys(rec);
|
|
74
|
+
return keys.length > 0 ? "{ " + keys.join(", ") + " }" : "{}";
|
|
75
|
+
}
|
|
76
|
+
return String(value);
|
|
77
|
+
}
|
|
78
|
+
/** "<Type>: <msg>" — the worker's terminal error text. The message
|
|
79
|
+
* half rides the thrown-value fold (F38): a thrown object reaches
|
|
80
|
+
* the run's error column as its own words. */
|
|
47
81
|
export function errText(err) {
|
|
48
|
-
|
|
49
|
-
return errName(err) + ": " + msg;
|
|
82
|
+
return errName(err) + ": " + foldThrownValue(err);
|
|
50
83
|
}
|
|
51
84
|
/** The settle persist (the R3 durable-queue mirror of registration,
|
|
52
85
|
* door-verbatim): the terminal status rewrites the run's
|
|
@@ -204,6 +237,10 @@ function sidecarFacesOf(run) {
|
|
|
204
237
|
cardSnapshot: run.cardSnapshot,
|
|
205
238
|
cardRecipe: run.cardRecipe,
|
|
206
239
|
benchSnapshot: run.benchSnapshot,
|
|
240
|
+
// THE BENCH INCARNATION rides every rewrite too (W-3 / F3-11 —
|
|
241
|
+
// a disk row keeps the incarnation it was pressed in; the claim
|
|
242
|
+
// and settle rewrites carry the queued stamp verbatim).
|
|
243
|
+
benchEpoch: run.benchEpoch,
|
|
207
244
|
// F-6(b): the admission warnings ride every rewrite too (a disk
|
|
208
245
|
// row keeps what the live row warned).
|
|
209
246
|
warnings: run.warnings,
|
|
@@ -219,6 +256,9 @@ function sidecarFacesOf(run) {
|
|
|
219
256
|
// THE REPLAY VERDICT rides every rewrite too (D11 — a disk row
|
|
220
257
|
// keeps what the executor's tap witnessed).
|
|
221
258
|
replaySuspect: run.replaySuspect,
|
|
259
|
+
// THE ATTRIBUTION MARKER rides every rewrite too (D3-07 — a
|
|
260
|
+
// disk row keeps the stamp-miss the tab never showed).
|
|
261
|
+
attribution: run.attribution,
|
|
222
262
|
};
|
|
223
263
|
}
|
|
224
264
|
|
|
@@ -245,6 +285,45 @@ export async function claimPersist(run) {
|
|
|
245
285
|
/* the sidecar must never take the claim down (settlePersist law) */
|
|
246
286
|
}
|
|
247
287
|
}
|
|
288
|
+
/** THE ATTRIBUTION PERSIST (F3 D3-07, the 15 s bound's third burn):
|
|
289
|
+
* the runs registry's attribute door rewrites the run's
|
|
290
|
+
* _flow.json the moment it marks a stamp-miss — the marker must
|
|
291
|
+
* survive a registry reload (the status door's disk fallback
|
|
292
|
+
* spreads this row) and outlive the wedged bench plane that
|
|
293
|
+
* dropped the stamp. Best-effort by the claim/settle law: the
|
|
294
|
+
* in-memory row is the truth, a persist failure never blocks the
|
|
295
|
+
* mark. No ledger row: the ledger carries dispositions, and the
|
|
296
|
+
* stamp's own miss voice is the press receipt's job.
|
|
297
|
+
* @param run the marked row (the caller already set
|
|
298
|
+
* run.attribution in memory).
|
|
299
|
+
* @returns when the write completed or self-swallowed its fault. */
|
|
300
|
+
export async function attributionPersist(run) {
|
|
301
|
+
try {
|
|
302
|
+
await writeJsonAtomic(join(run.dir, "_flow.json"), sidecarDoc(sidecarFacesOf(run)));
|
|
303
|
+
}
|
|
304
|
+
catch {
|
|
305
|
+
/* the sidecar must never take the mark down (claimPersist law) */
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
/** THE RENAME PERSIST (queue 12 Phase B): the runs registry's rename
|
|
309
|
+
* door rewrites the run's _flow.json the moment a gallery row's
|
|
310
|
+
* `label` lands — the display name must survive a registry reload
|
|
311
|
+
* (the status door's disk fallback spreads this row) and every
|
|
312
|
+
* later boot's re-read. Best-effort by the claim/settle law: the
|
|
313
|
+
* in-memory row is the truth, a persist failure never blocks the
|
|
314
|
+
* rename. The row's `name` is untouched — this write carries the
|
|
315
|
+
* patched row only because sidecarFacesOf mirrors the live stages.
|
|
316
|
+
* @param run the patched row (the caller already rewrote the gallery
|
|
317
|
+
* label in memory).
|
|
318
|
+
* @returns when the write completed or self-swallowed its fault. */
|
|
319
|
+
export async function galleryLabelPersist(run) {
|
|
320
|
+
try {
|
|
321
|
+
await writeJsonAtomic(join(run.dir, "_flow.json"), sidecarDoc(sidecarFacesOf(run)));
|
|
322
|
+
}
|
|
323
|
+
catch {
|
|
324
|
+
/* the sidecar must never take the rename down (claimPersist law) */
|
|
325
|
+
}
|
|
326
|
+
}
|
|
248
327
|
/** The synthesized log tail (door-verbatim port: the retired
|
|
249
328
|
* oracle's status voice, synthesized from the live row). */
|
|
250
329
|
export function runLogTail(obj) {
|
package/lib/runsValidate.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { FlowError } from "./runsValidateShared.js";
|
|
2
2
|
export type { CardRegistryLike, FlowsValidateAnswer } from "./runsValidateShared.js";
|
|
3
|
+
export { KIND_VOCAB } from "./runsValidateShared.js";
|
|
3
4
|
export { strictBody } from "./runsValidateStages.js";
|
|
4
5
|
export { inlineArm, serveSubject } from "./runsValidateServe.js";
|
|
5
6
|
//# sourceMappingURL=runsValidate.d.ts.map
|
package/lib/runsValidate.js
CHANGED
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
// public import surface below is UNCHANGED — existing importers keep
|
|
26
26
|
// importing these names from ./runsValidate.ts.
|
|
27
27
|
export { FlowError } from "./runsValidateShared.js";
|
|
28
|
+
|
|
29
|
+
// teaching voices DERIVE from KIND_VOCAB (melite-tools' fold refusal
|
|
30
|
+
// rode a hand copy that had already dropped `data`) — the enforcer
|
|
31
|
+
// and every voice must enumerate the same closed set.
|
|
32
|
+
export { KIND_VOCAB } from "./runsValidateShared.js";
|
|
28
33
|
export { strictBody } from "./runsValidateStages.js";
|
|
29
34
|
export { inlineArm, serveSubject } from "./runsValidateServe.js";
|
|
30
35
|
// ── the door ────────────────────────────────────────────────────
|
package/lib/runsValidateArms.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { RemoteError } from "@deepseek-ai/dsh-typert-protocol";
|
|
2
2
|
import { RUNS_ERROR_CODES } from "./runsErrorCodes.js";
|
|
3
|
+
import { refuseFamilylessHijack } from "./cardsCompose.js";
|
|
3
4
|
import { expandRegistryFlow, registryFlowToInline, registryInitialsError } from "./flowsData.js";
|
|
4
5
|
import { applyFlowParamsOverride, overlayDecls } from "./flowsParamsOverlay.js";
|
|
5
6
|
import { composeFamilyStages, liveFamilySeat } from "./flowsFamilyCompose.js";
|
|
6
7
|
import { resolveRepoRoot } from "@melite/comfyui-cordis";
|
|
7
8
|
import { inlineArm, strictBody } from "./runsValidate.js";
|
|
8
9
|
import { FLOW_ID_RE } from "./runsGates.js";
|
|
10
|
+
import { liftStageReservedForAdmission } from "./cardsFacts.js";
|
|
9
11
|
import { CardArmError } from "./cardsArmError.js";
|
|
10
12
|
import { prepareCardParams } from "./cardsCompose.js";
|
|
11
13
|
export async function validate(doc, signal, ctx) {
|
|
@@ -70,9 +72,17 @@ export async function validate(doc, signal, ctx) {
|
|
|
70
72
|
// gate gets the same first refusal from both doors, never
|
|
71
73
|
// params-voice here and stages-voice at start (or the
|
|
72
74
|
// reverse).
|
|
75
|
+
if (body["seed"] !== undefined) {
|
|
76
|
+
throw new RemoteError("runs/invalid-request", "flow " + JSON.stringify(name) + " carries a top-level " +
|
|
77
|
+
JSON.stringify("seed") + " — a {flow:} press reads card " +
|
|
78
|
+
"knobs from params, so a top-level seed reaches no stage. " +
|
|
79
|
+
"State it inside params ({seed: N}) to pin every stage " +
|
|
80
|
+
"this flow's tool overlay names; the flow's initials " +
|
|
81
|
+
"stay top-level.", { loc: "params" });
|
|
82
|
+
}
|
|
73
83
|
const overrideRaw = body["params"];
|
|
74
84
|
if (overrideRaw !== undefined) {
|
|
75
|
-
applyFlowParamsOverride(name, expanded.stages, overrideRaw, overlayDecls(ctx.cardRegistry), String(body["model"] ?? ""));
|
|
85
|
+
applyFlowParamsOverride(name, expanded.stages, overrideRaw, overlayDecls(ctx.cardRegistry), String(body["model"] ?? ""), decl.tool?.overlays ?? []);
|
|
76
86
|
}
|
|
77
87
|
// The same compile-time gate at validate (REBUILD-21).
|
|
78
88
|
const badInitial = registryInitialsError(expanded, body, {
|
|
@@ -236,10 +246,45 @@ async function composeCardStagesAtValidate(liveDoc, svc) {
|
|
|
236
246
|
? (service !== undefined ? { ...params, model: service } : { ...params })
|
|
237
247
|
: { ...params, model: mid };
|
|
238
248
|
try {
|
|
239
|
-
|
|
249
|
+
|
|
250
|
+
// this walk's body carries no `card` key (the model-door
|
|
251
|
+
// shape), so prepareCardParams cannot see the row's own card —
|
|
252
|
+
// the shared law fires HERE too, on the walk's own card name,
|
|
253
|
+
// before any phase1Card resolution folds the stated model
|
|
254
|
+
// into a stranger's lane (trim + krea-2 lived as image-gen).
|
|
255
|
+
refuseFamilylessHijack(svc, String(st["card"]), params["model"] ?? service);
|
|
256
|
+
// THE STAGE-RESERVED LIFT AT THE VALIDATE WALK (the F41
|
|
257
|
+
|
|
258
|
+
// bench write doors' PRE-MINT GATE (composeVerdictOf rides
|
|
259
|
+
// it) — the run compose lifts the stage-policy keys before
|
|
260
|
+
// ITS phase1Card (composeCardStageRow's carry), and this
|
|
261
|
+
// walk judged the raw bag, so the add door's own compose
|
|
262
|
+
// check refused the knob the run would carry. The same
|
|
263
|
+
// judged copy the write door's admission rides
|
|
264
|
+
// (liftStageReservedForAdmission): policy keys out, the
|
|
265
|
+
// row's own bag never touched, a declared reserved key still
|
|
266
|
+
// judged.
|
|
267
|
+
await svc.phase1Card(liftStageReservedForAdmission(svc.cardDecls()[String(st["card"])], body), mid);
|
|
240
268
|
}
|
|
241
269
|
catch (e) {
|
|
242
270
|
if (e instanceof CardArmError) {
|
|
271
|
+
// THE INCOMPLETE CLASS KEEPS ITS CODE (the GUI-add burn,
|
|
272
|
+
|
|
273
|
+
// into one string, so the pre-mint WRITE gate downstream
|
|
274
|
+
// read the class as a terminal refusal — and no card whose
|
|
275
|
+
// lane declares a required word the add door does not seed
|
|
276
|
+
// (tts's `text` — the GUI seeds axes only) could ever be
|
|
277
|
+
// ADDED from the cards tab. The frictionless-authoring
|
|
278
|
+
|
|
279
|
+
// not hacking the mainframe") drops the authoring-
|
|
280
|
+
// incomplete class at every write seat; the class rides the
|
|
281
|
+
// door's own throw pattern here, under the wire code the
|
|
282
|
+
// table already carries (runs/card-compose-incomplete —
|
|
283
|
+
// the client's heal-vs-carry split reads the same key).
|
|
284
|
+
// Every other refusal keeps the wall-pinned note voice.
|
|
285
|
+
if (e.code === "card_compose_incomplete") {
|
|
286
|
+
throw new RemoteError(RUNS_ERROR_CODES["card_compose_incomplete"], "stage " + JSON.stringify(String(st["id"])) + ": " + e.message, { loc: "stages" });
|
|
287
|
+
}
|
|
243
288
|
return "REFUSED stage " + JSON.stringify(String(st["id"])) + ": " + e.message;
|
|
244
289
|
}
|
|
245
290
|
throw e;
|
|
@@ -291,6 +336,7 @@ export async function modelValidateArm(body, ctx) {
|
|
|
291
336
|
let facts;
|
|
292
337
|
try {
|
|
293
338
|
facts = svc.modelFacts();
|
|
339
|
+
// a thrown model-facts read (absent or unreadable facts file) is the door's pinned degradation — the empty table reads as facts-absent, so prepare judges the catalog alone
|
|
294
340
|
}
|
|
295
341
|
catch {
|
|
296
342
|
facts = {};
|
package/lib/runsValidateServe.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// runsValidateServe.ts — the shared compile-serve tail split from
|
|
2
2
|
// runsValidate.ts (pure move, zero logic changes): branch prune, to_graph,
|
|
3
3
|
// the $channel gate, cost preview, and the inline/named serve arms.
|
|
4
|
-
import { FlowError,
|
|
4
|
+
import { FlowError, engineKnown } from "./runsValidateShared.js";
|
|
5
5
|
import { edgeRef } from "./runsValidateInline.js";
|
|
6
6
|
import { flowFromBody, kindsOk, wiresResolve } from "./runsValidateStages.js";
|
|
7
7
|
import { batchRows, sweepWorkflows } from "./runsValidateSweeps.js";
|
|
@@ -63,9 +63,9 @@ export function prunedFor(flow, body, cards) {
|
|
|
63
63
|
merged.push({ ...st, inputs: newInputs });
|
|
64
64
|
}
|
|
65
65
|
// RECONSTRUCTED — every construction validator re-runs (TS scope:
|
|
66
|
-
// wires +
|
|
66
|
+
// wires + kinds; card/tool/validators are no-ops here).
|
|
67
67
|
wiresResolve(flow.id, merged);
|
|
68
|
-
kindsOk(flow.id, merged,
|
|
68
|
+
kindsOk(flow.id, merged, cards);
|
|
69
69
|
return { flow: { id: flow.id, description: flow.description, stages: merged }, pruned: [...pruned.keys()] };
|
|
70
70
|
}
|
|
71
71
|
export function toGraph(flow) {
|
|
@@ -80,14 +80,12 @@ export function toGraph(flow) {
|
|
|
80
80
|
outputs.push({ ...o });
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
83
|
-
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
const def = engineDefaultOutput(st.engine);
|
|
90
|
-
if (def === undefined) {
|
|
83
|
+
|
|
84
|
+
// with neither refuses LOUD, in the lattice's own voice for a
|
|
85
|
+
// missed guarantee (unknown engine) or the declaration voice
|
|
86
|
+
// (a known engine names no channels). The engine registry is
|
|
87
|
+
// membership-only: it fills nothing.
|
|
88
|
+
if (!engineKnown(st.engine)) {
|
|
91
89
|
throw new FlowError("flow " +
|
|
92
90
|
JSON.stringify(flow.id) +
|
|
93
91
|
" stage " +
|
|
@@ -98,7 +96,12 @@ export function toGraph(flow) {
|
|
|
98
96
|
JSON.stringify(st.engine) +
|
|
99
97
|
" (no engine plugin declares it)");
|
|
100
98
|
}
|
|
101
|
-
|
|
99
|
+
throw new FlowError("flow " +
|
|
100
|
+
JSON.stringify(flow.id) +
|
|
101
|
+
" stage " +
|
|
102
|
+
JSON.stringify(st.id) +
|
|
103
|
+
" declares no outputs and names no card — " +
|
|
104
|
+
"add outputs={'<channel>': <Kind>} on the stage");
|
|
102
105
|
}
|
|
103
106
|
return {
|
|
104
107
|
id: st.id,
|
|
@@ -14,17 +14,15 @@ export interface CardRegistryLike {
|
|
|
14
14
|
}
|
|
15
15
|
export declare const ENGINE_TABLE: Record<string, {
|
|
16
16
|
plugin: string;
|
|
17
|
-
def: string;
|
|
18
17
|
}>;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export declare function engineDefaultOutput(engine: string): string | undefined;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export declare function engineKnown(engine: string): boolean;
|
|
28
26
|
export declare const KIND_VOCAB: readonly string[];
|
|
29
27
|
export declare const SKIP_VOCAB: readonly string[];
|
|
30
28
|
export declare const INLINE_TOP_SORTED: readonly string[];
|