@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.
- package/LICENSE +557 -0
- package/README.md +54 -2
- package/lib/bakeParams.d.ts +17 -0
- package/lib/bakeParams.js +182 -0
- package/lib/bench.d.ts +32 -0
- package/lib/bench.js +111 -0
- package/lib/cardsArmError.d.ts +61 -0
- package/lib/cardsArmError.js +57 -0
- package/lib/cardsCompose.d.ts +53 -0
- package/lib/cardsCompose.js +295 -0
- package/lib/cardsDangling.d.ts +16 -0
- package/lib/cardsDangling.js +213 -0
- package/lib/cardsFacts.d.ts +87 -0
- package/lib/cardsFacts.js +78 -0
- package/lib/cardsLanes.d.ts +43 -0
- package/lib/cardsLanes.js +178 -0
- package/lib/cardsRegistry.d.ts +404 -0
- package/lib/cardsRegistry.js +1543 -0
- package/lib/cardsVariant.d.ts +37 -0
- package/lib/cardsVariant.js +243 -0
- package/lib/discloseRegistry.d.ts +95 -0
- package/lib/discloseRegistry.js +156 -0
- package/lib/filmLead.d.ts +4 -0
- package/lib/filmLead.js +17 -0
- package/lib/filmMemoryWarn.d.ts +27 -0
- package/lib/filmMemoryWarn.js +99 -0
- package/lib/flowsData.d.ts +234 -0
- package/lib/flowsData.js +673 -0
- package/lib/flowsFamilyCompose.d.ts +45 -0
- package/lib/flowsFamilyCompose.js +191 -0
- package/lib/flowsParamsOverlay.d.ts +55 -0
- package/lib/flowsParamsOverlay.js +197 -0
- package/lib/flowsRegistryRows.d.ts +12 -0
- package/lib/flowsRegistryRows.js +520 -0
- package/lib/index.d.ts +47 -0
- package/lib/index.js +75 -0
- package/lib/ledgerTail.d.ts +20 -0
- package/lib/ledgerTail.js +123 -0
- package/lib/lifecycleLatch.d.ts +16 -0
- package/lib/lifecycleLatch.js +42 -0
- package/lib/loadPlane.d.ts +94 -0
- package/lib/loadPlane.js +570 -0
- package/lib/loadRegistry.d.ts +22 -0
- package/lib/loadRegistry.js +55 -0
- package/lib/manageOps.d.ts +27 -0
- package/lib/manageOps.js +162 -0
- package/lib/managePlane.d.ts +151 -0
- package/lib/managePlane.js +1790 -0
- package/lib/manageProbe.d.ts +48 -0
- package/lib/manageProbe.js +165 -0
- package/lib/manageRegistry.d.ts +66 -0
- package/lib/manageRegistry.js +113 -0
- package/lib/managerRail.d.ts +33 -0
- package/lib/managerRail.js +91 -0
- package/lib/mediaKinds.d.ts +3 -0
- package/lib/mediaKinds.js +2 -0
- package/lib/queue.d.ts +9 -0
- package/lib/queue.js +80 -0
- package/lib/queueCore.d.ts +72 -0
- package/lib/queueCore.js +128 -0
- package/lib/queueLifecycle.d.ts +2 -0
- package/lib/queueLifecycle.js +11 -0
- package/lib/queueLock.d.ts +60 -0
- package/lib/queueLock.js +198 -0
- package/lib/queueResurrect.d.ts +59 -0
- package/lib/queueResurrect.js +249 -0
- package/lib/queueRetry.d.ts +36 -0
- package/lib/queueRetry.js +24 -0
- package/lib/queueSidecar.d.ts +149 -0
- package/lib/queueSidecar.js +183 -0
- package/lib/queueSubmit.d.ts +82 -0
- package/lib/queueSubmit.js +191 -0
- package/lib/queueSweep.d.ts +30 -0
- package/lib/queueSweep.js +132 -0
- package/lib/resurrect.d.ts +6 -0
- package/lib/resurrect.js +18 -0
- package/lib/rootsManifest.d.ts +11 -0
- package/lib/rootsManifest.js +11 -0
- package/lib/runsChange.d.ts +61 -0
- package/lib/runsChange.js +79 -0
- package/lib/runsErrorCodes.d.ts +2 -0
- package/lib/runsErrorCodes.js +48 -0
- package/lib/runsExecute.d.ts +52 -0
- package/lib/runsExecute.js +494 -0
- package/lib/runsGates.d.ts +161 -0
- package/lib/runsGates.js +307 -0
- package/lib/runsList.d.ts +78 -0
- package/lib/runsList.js +574 -0
- package/lib/runsRefusalVoices.d.ts +9 -0
- package/lib/runsRefusalVoices.js +96 -0
- package/lib/runsRegistry.d.ts +351 -0
- package/lib/runsRegistry.js +2394 -0
- package/lib/runsSourceEcho.d.ts +81 -0
- package/lib/runsSourceEcho.js +341 -0
- package/lib/runsStart.d.ts +163 -0
- package/lib/runsStart.js +667 -0
- package/lib/runsTypes.d.ts +218 -0
- package/lib/runsTypes.js +289 -0
- package/lib/runsValidate.d.ts +5 -0
- package/lib/runsValidate.js +31 -0
- package/lib/runsValidateArms.d.ts +7 -0
- package/lib/runsValidateArms.js +339 -0
- package/lib/runsValidateInline.d.ts +6 -0
- package/lib/runsValidateInline.js +82 -0
- package/lib/runsValidateRefusals.d.ts +7 -0
- package/lib/runsValidateRefusals.js +18 -0
- package/lib/runsValidateServe.d.ts +15 -0
- package/lib/runsValidateServe.js +276 -0
- package/lib/runsValidateShared.d.ts +84 -0
- package/lib/runsValidateShared.js +88 -0
- package/lib/runsValidateStages.d.ts +32 -0
- package/lib/runsValidateStages.js +511 -0
- package/lib/runsValidateSweeps.d.ts +6 -0
- package/lib/runsValidateSweeps.js +143 -0
- package/lib/service.d.ts +63 -0
- package/lib/service.js +89 -0
- package/lib/skillFrontmatter.d.ts +11 -0
- package/lib/skillFrontmatter.js +46 -0
- package/lib/skillFs.d.ts +24 -0
- package/lib/skillFs.js +78 -0
- package/lib/skillPlane.d.ts +99 -0
- package/lib/skillPlane.js +269 -0
- package/lib/skillRegistry.d.ts +23 -0
- package/lib/skillRegistry.js +55 -0
- package/lib/skillRows.d.ts +127 -0
- package/lib/skillRows.js +468 -0
- package/lib/toolProjection.d.ts +30 -0
- package/lib/toolProjection.js +142 -0
- package/lib/vocab.d.ts +6 -0
- package/lib/vocab.js +18 -0
- package/package.json +48 -4
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import type { EngineJson } from "@melite/comfyui-cordis";
|
|
2
|
+
import type { GraphRow } from "./queue.js";
|
|
3
|
+
import type { RunId } from "./queueCore.js";
|
|
4
|
+
/** Stage statuses — the run worker's vocabulary (inherited from the retired oracle). */
|
|
5
|
+
export type RunStatus = "queued" | "running" | "completed" | "failed" | "stopped" | "stopping";
|
|
6
|
+
/** The run-status vocabulary as a runtime set — the type's twin, for
|
|
7
|
+
* durable-boundary reads that judge an on-disk row's status (the
|
|
8
|
+
* type alone cannot answer "is this sidecar's status one of
|
|
9
|
+
* ours"). */
|
|
10
|
+
export declare const RUN_STATUSES: ReadonlySet<string>;
|
|
11
|
+
/** One stage row — key order mirrors submit's literal. */
|
|
12
|
+
export interface RunStageRow {
|
|
13
|
+
id: string;
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
benchStageId?: string;
|
|
21
|
+
name: string;
|
|
22
|
+
index: number;
|
|
23
|
+
status: string;
|
|
24
|
+
/** The stage's engine id ('comfyui' | 'mcp:<server>', stroke 53) —
|
|
25
|
+
* stamped at registration from the compiled stage; the worker
|
|
26
|
+
* dispatches by it. Legacy rows (pre-seam sidecars) carry none,
|
|
27
|
+
* which reads as 'comfyui' (the only engine that ever was). */
|
|
28
|
+
engine?: string;
|
|
29
|
+
outputs: Record<string, EngineJson>;
|
|
30
|
+
expected: Record<string, EngineJson>;
|
|
31
|
+
[key: string]: EngineJson | string | number | undefined;
|
|
32
|
+
}
|
|
33
|
+
/** One registry run. Extends the queue's minimal row so the SAME
|
|
34
|
+
* object rides QueueCore's FIFO (one object, one voice — the
|
|
35
|
+
* door's RunsService held one map; the queue's core is that map
|
|
36
|
+
* now). */
|
|
37
|
+
export interface RunRecord {
|
|
38
|
+
runId: RunId;
|
|
39
|
+
status: RunStatus;
|
|
40
|
+
stages: RunStageRow[];
|
|
41
|
+
skippedStages: string[];
|
|
42
|
+
artifacts: string[];
|
|
43
|
+
error: string;
|
|
44
|
+
draftId: string;
|
|
45
|
+
dir: string;
|
|
46
|
+
testFlag: boolean;
|
|
47
|
+
stopFlag: boolean;
|
|
48
|
+
params: Record<string, EngineJson>[];
|
|
49
|
+
outputNodes: Record<string, EngineJson>[];
|
|
50
|
+
/** The run's request initials: the start body's values for the
|
|
51
|
+
* flow's declared initial validators, gate-validated at the door
|
|
52
|
+
* and threaded to the engine merge so `$spell` params resolve.
|
|
53
|
+
* Empty for runs whose flow declares no initials and for a
|
|
54
|
+
* failed resurrect's floor row. */
|
|
55
|
+
initials: Record<string, EngineJson>;
|
|
56
|
+
/** The FILE-kind subset of initials' keys (photo | glb — the
|
|
57
|
+
* kinds whose values must exist on disk), stamped beside
|
|
58
|
+
* initials so the claim-time re-probe knows which entries to
|
|
59
|
+
* re-judge without re-deriving kinds (the stageFams ledger
|
|
60
|
+
* law: the row carries the judgment's input, not a new
|
|
61
|
+
* lookup). Absent = nothing to re-probe (no file initials, a
|
|
62
|
+
* card run, or a floor row). */
|
|
63
|
+
initialFileKeys?: string[];
|
|
64
|
+
/** The settle persist (R3 mirror): registration stamps these so
|
|
65
|
+
* settle can rewrite the sidecar + ledger row. createdAt is
|
|
66
|
+
* epoch seconds. */
|
|
67
|
+
createdAt: number;
|
|
68
|
+
pipeline: string;
|
|
69
|
+
graphRows: GraphRow[];
|
|
70
|
+
/** Per-stage input names (the rim): stage-input -> "stage.output"
|
|
71
|
+
* / "__initial__.name". Stamped at registration. */
|
|
72
|
+
inputNames?: Record<string, Record<string, string>>;
|
|
73
|
+
/** The card door's id (stamped at registration; inline runs leave
|
|
74
|
+
* it absent — never a guessed card). */
|
|
75
|
+
cardId?: string;
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
pressKey?: string;
|
|
82
|
+
/** THE CARD SNAPSHOT (stroke 45): the exact card + body that ran
|
|
83
|
+
* ({card, params}) — the wand restores from this, never from the
|
|
84
|
+
* living bench. Stamped at registration, carried through settle
|
|
85
|
+
* (the settle rewrite must not wipe it). */
|
|
86
|
+
cardSnapshot?: unknown;
|
|
87
|
+
/** THE BENCH SNAPSHOT (stroke 45d): the full workflow as it stood
|
|
88
|
+
* at Run press ({stages, intent}) — same carry law as the card
|
|
89
|
+
* snapshot. */
|
|
90
|
+
benchSnapshot?: unknown;
|
|
91
|
+
/** F-6(b) ADMISSION WARNINGS (stamped post-registration by the
|
|
92
|
+
* start door — the film lane's VRAM-pressure warn): served on
|
|
93
|
+
* run_status rows, never a refusal. Absent means none. */
|
|
94
|
+
warnings?: string[];
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
replaySuspect?: boolean;
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
fam?: string;
|
|
106
|
+
/** The flow arm's {stageId: fam} ledger (the claim-time presence
|
|
107
|
+
* re-probe reads it beside fam). */
|
|
108
|
+
stageFams?: Record<string, string>;
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
exportName?: string;
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
exportPath?: string;
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
variant?: string;
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
loudness?: {
|
|
144
|
+
loudness_lufs: number;
|
|
145
|
+
peak_db: number;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
voiceFreshness?: {
|
|
154
|
+
reused_existing: boolean;
|
|
155
|
+
voice_file: string;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
composeEcho?: {
|
|
164
|
+
seam: string;
|
|
165
|
+
calls: number;
|
|
166
|
+
benchRev: number | null;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
sourceEcho?: {
|
|
176
|
+
refs: Array<{
|
|
177
|
+
url: string;
|
|
178
|
+
file: string;
|
|
179
|
+
}>;
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/** The engine's path relative to the run dir (runRel, door-verbatim). */
|
|
183
|
+
export declare function runRel(run: RunRecord, art: string): string;
|
|
184
|
+
/** "<Type>: <msg>" — the worker's terminal error text. */
|
|
185
|
+
export declare function errText(err: unknown): string;
|
|
186
|
+
/** The settle persist (the R3 durable-queue mirror of registration,
|
|
187
|
+
* door-verbatim): the terminal status rewrites the run's
|
|
188
|
+
* _flow.json sidecar (the restart authority) and appends the
|
|
189
|
+
* terminal ledger row. Best-effort by law — a persist failure
|
|
190
|
+
* never unmakes the run's truth in memory. */
|
|
191
|
+
export declare function settlePersist(run: RunRecord, stateRoot: string): Promise<void>;
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
export declare function claimPersist(run: RunRecord): Promise<void>;
|
|
209
|
+
/** The synthesized log tail (door-verbatim port: the retired
|
|
210
|
+
* oracle's status voice, synthesized from the live row). */
|
|
211
|
+
export declare function runLogTail(obj: {
|
|
212
|
+
status?: unknown;
|
|
213
|
+
queue_position?: unknown;
|
|
214
|
+
error?: unknown;
|
|
215
|
+
stages?: unknown;
|
|
216
|
+
artifacts?: unknown;
|
|
217
|
+
}): string;
|
|
218
|
+
//# sourceMappingURL=runsTypes.d.ts.map
|
package/lib/runsTypes.js
ADDED
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
// runsTypes.ts — the live-run record + the pure tail helpers,
|
|
2
|
+
// re-homed VERBATIM from the dead flowsRun door (gateway kill,
|
|
3
|
+
// REBUILD-6). Types + pure functions only: no Context, no I/O
|
|
4
|
+
// beyond the settle persist (best-effort by the door's own law).
|
|
5
|
+
//
|
|
6
|
+
// DIVERGENCE-BY-ORDER (the kill): the door stamped stage url/gallery
|
|
7
|
+
// with ASSET_URL_PREFIX + "/v1/assets/runs/<run>/<rel>" — an HTTP
|
|
8
|
+
// face that died with the app. The remote reports the run-RELATIVE
|
|
9
|
+
// artifact name instead (no prefix, no port). The web callers
|
|
10
|
+
// (mask-studio/gallery) migrate when their stroke lands; the
|
|
11
|
+
// artifacts[] rows keep the engine's paths.
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { appendLedger, writeJsonAtomic, sidecarDoc, sidecarStageOf, variantOfBodies, } from "./queue.js";
|
|
14
|
+
/** The run-status vocabulary as a runtime set — the type's twin, for
|
|
15
|
+
* durable-boundary reads that judge an on-disk row's status (the
|
|
16
|
+
* type alone cannot answer "is this sidecar's status one of
|
|
17
|
+
* ours"). */
|
|
18
|
+
export const RUN_STATUSES = new Set([
|
|
19
|
+
"queued",
|
|
20
|
+
"running",
|
|
21
|
+
"completed",
|
|
22
|
+
"failed",
|
|
23
|
+
"stopped",
|
|
24
|
+
"stopping",
|
|
25
|
+
]);
|
|
26
|
+
/** The engine's path relative to the run dir (runRel, door-verbatim). */
|
|
27
|
+
export function runRel(run, art) {
|
|
28
|
+
if (art === run.dir)
|
|
29
|
+
return basenameSafe(art);
|
|
30
|
+
const prefix = run.dir + "/";
|
|
31
|
+
if (art.startsWith(prefix))
|
|
32
|
+
return art.slice(prefix.length);
|
|
33
|
+
const base = basenameSafe(art);
|
|
34
|
+
return base === "" || base === "." ? basenameSafe(art) : base;
|
|
35
|
+
}
|
|
36
|
+
function basenameSafe(p) {
|
|
37
|
+
const i = Math.max(p.lastIndexOf("/"), p.lastIndexOf("\\"));
|
|
38
|
+
return i < 0 ? p : p.slice(i + 1);
|
|
39
|
+
}
|
|
40
|
+
function errName(err) {
|
|
41
|
+
if (err instanceof Error && typeof err.name === "string" && err.name !== "") {
|
|
42
|
+
return err.name;
|
|
43
|
+
}
|
|
44
|
+
return "Error";
|
|
45
|
+
}
|
|
46
|
+
/** "<Type>: <msg>" — the worker's terminal error text. */
|
|
47
|
+
export function errText(err) {
|
|
48
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
49
|
+
return errName(err) + ": " + msg;
|
|
50
|
+
}
|
|
51
|
+
/** The settle persist (the R3 durable-queue mirror of registration,
|
|
52
|
+
* door-verbatim): the terminal status rewrites the run's
|
|
53
|
+
* _flow.json sidecar (the restart authority) and appends the
|
|
54
|
+
* terminal ledger row. Best-effort by law — a persist failure
|
|
55
|
+
* never unmakes the run's truth in memory. */
|
|
56
|
+
export async function settlePersist(run, stateRoot) {
|
|
57
|
+
// THE EXPORT-NAME STAMP (023's self-critique #4/#6): a
|
|
58
|
+
// design/export lane's voice_name rides the submitted body — lift
|
|
59
|
+
// the first non-empty one onto the row so the receipt names the
|
|
60
|
+
// mint (the preview flac carries the design sample; the .qvoice
|
|
61
|
+
// is the deliverable and rides no artifact list). The compiled
|
|
62
|
+
// stage params are engine-shaped (the compose may consume card
|
|
63
|
+
// keys into the workflow — 024 proved voice_name missing there),
|
|
64
|
+
// so the card snapshot (the exact submitted body) is the fallback.
|
|
65
|
+
let exportName;
|
|
66
|
+
const bodies = [...run.params];
|
|
67
|
+
const snap = run.cardSnapshot;
|
|
68
|
+
if (snap !== undefined && snap !== null && typeof snap === "object")
|
|
69
|
+
bodies.push(snap.params);
|
|
70
|
+
for (const p of bodies) {
|
|
71
|
+
if (p === null || typeof p !== "object" || Array.isArray(p))
|
|
72
|
+
continue;
|
|
73
|
+
const v = p["voice_name"];
|
|
74
|
+
if (typeof v === "string" && v.trim() !== "") {
|
|
75
|
+
exportName = v.trim();
|
|
76
|
+
run.exportName = exportName;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// THE VARIANT STAMP (commission 033's self-critique #5): the
|
|
81
|
+
// lane rides the same bodies as the export name (run.params
|
|
82
|
+
// first, the card snapshot's exact submitted body as fallback —
|
|
83
|
+
// the compose may consume card keys into engine-shaped params).
|
|
84
|
+
// Stamped on the row (registration may already hold it; settle
|
|
85
|
+
// re-lifts with the registration stamp as fallback — the row in
|
|
86
|
+
// memory is the truth either way).
|
|
87
|
+
const variant = variantOfBodies(bodies) ?? run.variant;
|
|
88
|
+
if (variant !== undefined)
|
|
89
|
+
run.variant = variant;
|
|
90
|
+
// THE EXPORT-PATH STAMP: lift the engine-reported mint path off
|
|
91
|
+
// the stage result_outputs (set at execute time from the history
|
|
92
|
+
// ui — qvoicePathsOf). Stamped only when the engine actually
|
|
93
|
+
// minted one (a load lane mints nothing).
|
|
94
|
+
let exportPath;
|
|
95
|
+
for (const st of run.stages) {
|
|
96
|
+
const ro = st["result_outputs"];
|
|
97
|
+
if (ro === null || typeof ro !== "object" || Array.isArray(ro))
|
|
98
|
+
continue;
|
|
99
|
+
const v = ro["qvoice_path"];
|
|
100
|
+
if (typeof v === "string" && v.trim() !== "") {
|
|
101
|
+
exportPath = v.trim();
|
|
102
|
+
run.exportPath = exportPath;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// reading and the voice-mint receipt off the stage result_outputs
|
|
108
|
+
// — same law as the export path (the engine's harvest carries
|
|
109
|
+
// them; the run row serves them). First coherent pair wins.
|
|
110
|
+
for (const st of run.stages) {
|
|
111
|
+
const ro = st["result_outputs"];
|
|
112
|
+
if (ro === null || typeof ro !== "object" || Array.isArray(ro))
|
|
113
|
+
continue;
|
|
114
|
+
const rec = ro;
|
|
115
|
+
if (run.loudness === undefined) {
|
|
116
|
+
const loud = rec["loudness"];
|
|
117
|
+
if (loud !== null && typeof loud === "object" && !Array.isArray(loud)) {
|
|
118
|
+
const l = loud["loudness_lufs"];
|
|
119
|
+
const pk = loud["peak_db"];
|
|
120
|
+
if (typeof l === "number" && Number.isFinite(l) && typeof pk === "number" && Number.isFinite(pk)) {
|
|
121
|
+
run.loudness = { loudness_lufs: l, peak_db: pk };
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (run.voiceFreshness === undefined) {
|
|
126
|
+
const fresh = rec["voice_freshness"];
|
|
127
|
+
if (fresh !== null && typeof fresh === "object" && !Array.isArray(fresh)) {
|
|
128
|
+
const reused = fresh["reused_existing"];
|
|
129
|
+
const file = fresh["voice_file"];
|
|
130
|
+
if (typeof reused === "boolean" && typeof file === "string" && file.trim() !== "") {
|
|
131
|
+
run.voiceFreshness = { reused_existing: reused, voice_file: file.trim() };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
await writeJsonAtomic(join(run.dir, "_flow.json"), sidecarDoc({
|
|
138
|
+
...sidecarFacesOf(run),
|
|
139
|
+
exportName,
|
|
140
|
+
exportPath,
|
|
141
|
+
variant,
|
|
142
|
+
loudness: run.loudness,
|
|
143
|
+
voiceFreshness: run.voiceFreshness,
|
|
144
|
+
replaySuspect: run.replaySuspect,
|
|
145
|
+
}));
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
/* the sidecar must never take the settle down */
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
appendLedger(stateRoot, "run." + run.status, {
|
|
152
|
+
run_id: run.runId,
|
|
153
|
+
error: run.error,
|
|
154
|
+
// THE VARIANT RIDES THE TERMINAL ROW TOO (033 #5): the
|
|
155
|
+
// queued row named it at birth; the terminal row names it at
|
|
156
|
+
// rest — one grep tells design from performing, state to state.
|
|
157
|
+
...(variant !== undefined ? { variant } : {}),
|
|
158
|
+
// THE REPLAY VERDICT RIDES IT TOO (D11): one grep tells a
|
|
159
|
+
// replayed film from an executed one, state to state.
|
|
160
|
+
...(run.replaySuspect === true ? { replay_suspect: true } : {}),
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
/* nor the ledger row */
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** The row's own sidecar faces — the base every sidecar writer
|
|
171
|
+
* shares. The settle rewrite adds the lifted stamps (export name,
|
|
172
|
+
* path, variant, loudness, freshness — read off COMPLETED
|
|
173
|
+
* outputs); the claim write has nothing lifted yet and carries
|
|
174
|
+
* exactly these. */
|
|
175
|
+
function sidecarFacesOf(run) {
|
|
176
|
+
return {
|
|
177
|
+
runId: run.runId,
|
|
178
|
+
status: run.status,
|
|
179
|
+
error: run.error,
|
|
180
|
+
stages: run.stages.map((st) => sidecarStageOf(st)),
|
|
181
|
+
skippedStages: [...run.skippedStages],
|
|
182
|
+
artifacts: [...run.artifacts],
|
|
183
|
+
createdAt: run.createdAt,
|
|
184
|
+
testFlag: run.testFlag,
|
|
185
|
+
draftId: run.draftId,
|
|
186
|
+
pipeline: run.pipeline,
|
|
187
|
+
graph: run.graphRows,
|
|
188
|
+
// THE SNAPSHOT CARRY (stroke 48 fix): every sidecar rewrite
|
|
189
|
+
// re-renders the document from the row — the snapshots stamped
|
|
190
|
+
// at registration ride along, never wiped.
|
|
191
|
+
cardSnapshot: run.cardSnapshot,
|
|
192
|
+
benchSnapshot: run.benchSnapshot,
|
|
193
|
+
// F-6(b): the admission warnings ride every rewrite too (a disk
|
|
194
|
+
// row keeps what the live row warned).
|
|
195
|
+
warnings: run.warnings,
|
|
196
|
+
// THE COMPOSE ECHO rides every rewrite too (a disk row keeps
|
|
197
|
+
// what the engine received at start).
|
|
198
|
+
composeEcho: run.composeEcho,
|
|
199
|
+
// THE SOURCE ECHO rides every rewrite too (a disk row keeps the
|
|
200
|
+
// files that created the run).
|
|
201
|
+
sourceEcho: run.sourceEcho,
|
|
202
|
+
// THE REPLAY VERDICT rides every rewrite too (D11 — a disk row
|
|
203
|
+
// keeps what the executor's tap witnessed).
|
|
204
|
+
replaySuspect: run.replaySuspect,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
export async function claimPersist(run) {
|
|
224
|
+
try {
|
|
225
|
+
await writeJsonAtomic(join(run.dir, "_flow.json"), sidecarDoc(sidecarFacesOf(run)));
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
/* the sidecar must never take the claim down (settlePersist law) */
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/** The synthesized log tail (door-verbatim port: the retired
|
|
232
|
+
* oracle's status voice, synthesized from the live row). */
|
|
233
|
+
export function runLogTail(obj) {
|
|
234
|
+
const lines = [];
|
|
235
|
+
const status = String(obj.status ?? "?");
|
|
236
|
+
const qp = obj.queue_position;
|
|
237
|
+
let head = "run: " + status;
|
|
238
|
+
if (status === "queued" && typeof qp === "number" && qp > 0) {
|
|
239
|
+
head += " (queue position " + qp + ")";
|
|
240
|
+
}
|
|
241
|
+
if (obj.error)
|
|
242
|
+
head += " — " + String(obj.error).slice(0, 300);
|
|
243
|
+
lines.push(head);
|
|
244
|
+
const stages = obj.stages;
|
|
245
|
+
if (Array.isArray(stages)) {
|
|
246
|
+
for (const st of stages) {
|
|
247
|
+
if (typeof st !== "object" || st === null || Array.isArray(st))
|
|
248
|
+
continue;
|
|
249
|
+
const name = String(st["name"] ?? st["id"] ?? "stage");
|
|
250
|
+
let line = name + ": " + String(st["status"] ?? "?");
|
|
251
|
+
const p = st["progress"];
|
|
252
|
+
if (typeof p === "object" && p !== null && !Array.isArray(p) &&
|
|
253
|
+
p["max"]) {
|
|
254
|
+
line +=
|
|
255
|
+
" — " +
|
|
256
|
+
String(p["value"]) +
|
|
257
|
+
"/" +
|
|
258
|
+
String(p["max"]);
|
|
259
|
+
}
|
|
260
|
+
const a = st["activity"];
|
|
261
|
+
if (typeof a === "object" && a !== null && !Array.isArray(a)) {
|
|
262
|
+
const rec = a;
|
|
263
|
+
const ph = String(rec["phase"] ?? "");
|
|
264
|
+
const msg = rec["message"] ?? rec["node_class"];
|
|
265
|
+
line += " [" + ph + (msg ? ": " + String(msg) : "") + "]";
|
|
266
|
+
}
|
|
267
|
+
if (st["error"])
|
|
268
|
+
line += "\n error: " + String(st["error"]).slice(0, 300);
|
|
269
|
+
lines.push(line);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
const arts = obj.artifacts;
|
|
273
|
+
if (Array.isArray(arts) && arts.length > 0) {
|
|
274
|
+
const names = [];
|
|
275
|
+
for (const a of arts.slice(0, 6)) {
|
|
276
|
+
const v = typeof a === "object" && a !== null && !Array.isArray(a)
|
|
277
|
+
? (a["url"] ??
|
|
278
|
+
a["name"])
|
|
279
|
+
: a;
|
|
280
|
+
const s = String(v ?? "").split("/").pop();
|
|
281
|
+
if (s !== "")
|
|
282
|
+
names.push(s);
|
|
283
|
+
}
|
|
284
|
+
if (names.length > 0)
|
|
285
|
+
lines.push("artifacts: " + names.join(", "));
|
|
286
|
+
}
|
|
287
|
+
return lines.join("\n");
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=runsTypes.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { FlowError } from "./runsValidateShared.js";
|
|
2
|
+
export type { CardRegistryLike, FlowsValidateAnswer } from "./runsValidateShared.js";
|
|
3
|
+
export { strictBody } from "./runsValidateStages.js";
|
|
4
|
+
export { inlineArm, serveSubject } from "./runsValidateServe.js";
|
|
5
|
+
//# sourceMappingURL=runsValidate.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// runsValidate.ts — the flows VALIDATE surface (REBUILD-8,
|
|
2
|
+
// gateway kill): the dead validate door's PURE half (the
|
|
3
|
+
// flow.py compile pipeline — flowFromBody → compileFlow → the
|
|
4
|
+
// workflow pin sweep → the batch envelope → cost_preview)
|
|
5
|
+
// re-homed verbatim as the registry's `validate` business arm.
|
|
6
|
+
// Second move: the door's bodies unchanged, line cites riding
|
|
7
|
+
// along. The door's answers become RemoteError folds at the
|
|
8
|
+
// REGISTRY seam (never here): flow_compile/workflow_pin refuse
|
|
9
|
+
// with the door's payload voices, the 200 serves the door's row.
|
|
10
|
+
//
|
|
11
|
+
// NOT PORTED THIS STROKE (their own strokes, ledgered):
|
|
12
|
+
// - the {model} arm (card compose — the cards remote stroke);
|
|
13
|
+
// a body carrying {model:} refuses the preview refusal.
|
|
14
|
+
// - the {flow} arm (the named-flow registry — the flows stroke);
|
|
15
|
+
// same preview law.
|
|
16
|
+
// - the card gate's registry (cards=null → a card= stage refuses
|
|
17
|
+
// LOUD — the cardRegistry stroke slots the defs in) and the
|
|
18
|
+
// object_info pin (cards=null → the pin sweep sees 0 pinned
|
|
19
|
+
// classes, exactly as the door served on an unpinned estate —
|
|
20
|
+
// the engine seat's objectInfo rides the engine stroke).
|
|
21
|
+
// The tools' bench validate (wires/kinds/$channels/inputs — the
|
|
22
|
+
// pure compile) is fully served.
|
|
23
|
+
// Facade kept by the runsValidate split: every validator body moved to
|
|
24
|
+
// domain seams in this directory (pure move, zero logic changes). The
|
|
25
|
+
// public import surface below is UNCHANGED — existing importers keep
|
|
26
|
+
// importing these names from ./runsValidate.ts.
|
|
27
|
+
export { FlowError } from "./runsValidateShared.js";
|
|
28
|
+
export { strictBody } from "./runsValidateStages.js";
|
|
29
|
+
export { inlineArm, serveSubject } from "./runsValidateServe.js";
|
|
30
|
+
// ── the door ────────────────────────────────────────────────────
|
|
31
|
+
//# sourceMappingURL=runsValidate.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
2
|
+
import type { FlowsValidateAnswer } from "./runsValidate.js";
|
|
3
|
+
export declare function validate(doc: unknown, signal: AbortSignal, ctx: Context): Promise<Record<string, unknown>>;
|
|
4
|
+
/** Map a CardArmError onto the refusal envelope (door-verbatim:
|
|
5
|
+
* the error verbatim + code + loc/expected/got only when set). */
|
|
6
|
+
export declare function modelValidateArm(body: Record<string, unknown>, ctx: Context): Promise<FlowsValidateAnswer>;
|
|
7
|
+
//# sourceMappingURL=runsValidateArms.d.ts.map
|