@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,182 @@
|
|
|
1
|
+
// bakeParams.ts — the AnnyBakeParams serve belt: params_json
|
|
2
|
+
// preset-dialect validation rides the initial_validators gate
|
|
3
|
+
// (bake_params initials refuse BEFORE any run registers).
|
|
4
|
+
// TS-native: the estate voice,
|
|
5
|
+
// renders, and the PyNum literal-holder are deleted.
|
|
6
|
+
//
|
|
7
|
+
// Erasable-syntax TS only (node --experimental-strip-types).
|
|
8
|
+
export function vErr(loc, msg, input) {
|
|
9
|
+
return { loc, msg, input };
|
|
10
|
+
}
|
|
11
|
+
/** The validation-error render: one "path: message" line per
|
|
12
|
+
* failure (model name heads model-level errors). */
|
|
13
|
+
export function renderErrors(model, errs) {
|
|
14
|
+
const lines = [];
|
|
15
|
+
for (const e of errs) {
|
|
16
|
+
const loc = e.loc.map(String).join(".");
|
|
17
|
+
lines.push((loc === "" ? model : loc) + ": " + e.msg);
|
|
18
|
+
}
|
|
19
|
+
return lines.join("\n");
|
|
20
|
+
}
|
|
21
|
+
/** Strict float slot: finite numbers ride; anything else errors. */
|
|
22
|
+
function parseFloatLax(v, loc, errs) {
|
|
23
|
+
if (typeof v === "number") {
|
|
24
|
+
if (!Number.isFinite(v)) {
|
|
25
|
+
errs.push(vErr(loc, "Input should be a valid number", v));
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return v;
|
|
29
|
+
}
|
|
30
|
+
errs.push(vErr(loc, "Input should be a valid number", v));
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
function isPlainObject(v) {
|
|
34
|
+
if (typeof v !== "object" || v === null || Array.isArray(v))
|
|
35
|
+
return false;
|
|
36
|
+
const proto = Object.getPrototypeOf(v);
|
|
37
|
+
return proto === Object.prototype;
|
|
38
|
+
}
|
|
39
|
+
/** Required-field fetch (missing -> Field required on the parent). */
|
|
40
|
+
function reqField(v, key, loc, errs) {
|
|
41
|
+
if (!(key in v) || v[key] === undefined) {
|
|
42
|
+
errs.push(vErr([...loc, key], "Field required", v));
|
|
43
|
+
return { found: false, value: undefined };
|
|
44
|
+
}
|
|
45
|
+
return { found: true, value: v[key] };
|
|
46
|
+
}
|
|
47
|
+
/** Extra-key sweep (definition-order fields first, extras last in
|
|
48
|
+
* input order.) */
|
|
49
|
+
function extraSweep(v, known, loc, errs) {
|
|
50
|
+
for (const k of Object.keys(v)) {
|
|
51
|
+
if (!known.has(k)) {
|
|
52
|
+
errs.push(vErr([...loc, k], "Extra inputs are not permitted", v[k]));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function validFloatTuple(v, loc, errs) {
|
|
57
|
+
if (!Array.isArray(v)) {
|
|
58
|
+
errs.push(vErr(loc, "value must be an array", v));
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
const items = [...v];
|
|
62
|
+
const nums = [];
|
|
63
|
+
let bad = false;
|
|
64
|
+
for (let i = 0; i < items.length; i++) {
|
|
65
|
+
const n = parseFloatLax(items[i], [...loc, i], errs);
|
|
66
|
+
if (n === null)
|
|
67
|
+
bad = true;
|
|
68
|
+
else
|
|
69
|
+
nums.push(n);
|
|
70
|
+
}
|
|
71
|
+
return bad ? null : { items, nums };
|
|
72
|
+
}
|
|
73
|
+
/** Validate a served params_json through the AnnyBakeParams shape
|
|
74
|
+
* (the serve-side belt). Failures render with the wire string as
|
|
75
|
+
* input, not the parsed doc.
|
|
76
|
+
* Returns the failure text, or null. */
|
|
77
|
+
export function validateBakeParams(s) {
|
|
78
|
+
let doc;
|
|
79
|
+
try {
|
|
80
|
+
doc = JSON.parse(s);
|
|
81
|
+
}
|
|
82
|
+
catch (exc) {
|
|
83
|
+
const msg = exc instanceof Error
|
|
84
|
+
? exc.message
|
|
85
|
+
:
|
|
86
|
+
|
|
87
|
+
String(exc);
|
|
88
|
+
return renderErrors("AnnyBakeParams", [
|
|
89
|
+
vErr([], "params_json is not JSON: " + msg, s),
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
92
|
+
if (!isPlainObject(doc)) {
|
|
93
|
+
return renderErrors("AnnyBakeParams", [
|
|
94
|
+
vErr([], "params_json must be a JSON object, got " + (typeof doc), s),
|
|
95
|
+
]);
|
|
96
|
+
}
|
|
97
|
+
const errs = [];
|
|
98
|
+
let dialect = "";
|
|
99
|
+
const rd = reqField(doc, "dialect", [], errs);
|
|
100
|
+
if (!rd.found)
|
|
101
|
+
dialect = "";
|
|
102
|
+
else if (rd.value !== "authored" && rd.value !== "estimated") {
|
|
103
|
+
errs.push(vErr([], "Input should be 'authored' or 'estimated'", rd.value));
|
|
104
|
+
}
|
|
105
|
+
else
|
|
106
|
+
dialect = rd.value;
|
|
107
|
+
let phenotype = null;
|
|
108
|
+
const rp = reqField(doc, "phenotype", [], errs);
|
|
109
|
+
if (!rp.found)
|
|
110
|
+
phenotype = null;
|
|
111
|
+
else {
|
|
112
|
+
const t = validFloatTuple(rp.value, ["phenotype"], errs);
|
|
113
|
+
phenotype = t === null ? null : t.nums;
|
|
114
|
+
}
|
|
115
|
+
let locals = [];
|
|
116
|
+
let localsBad = false;
|
|
117
|
+
if ("local_changes" in doc && doc["local_changes"] !== undefined) {
|
|
118
|
+
const lv = doc["local_changes"];
|
|
119
|
+
if (!isPlainObject(lv)) {
|
|
120
|
+
errs.push(vErr([], "params_json local_changes must be an object", lv));
|
|
121
|
+
localsBad = true;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
for (const k of Object.keys(lv)) {
|
|
125
|
+
const n = parseFloatLax(lv[k], ["local_changes", k], errs);
|
|
126
|
+
if (n === null)
|
|
127
|
+
localsBad = true;
|
|
128
|
+
else
|
|
129
|
+
locals.push({ name: k, value: n });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
let scale = null;
|
|
134
|
+
if ("scale" in doc && doc["scale"] !== undefined && doc["scale"] !== null) {
|
|
135
|
+
const t = validFloatTuple(doc["scale"], ["scale"], errs);
|
|
136
|
+
if (t !== null)
|
|
137
|
+
scale = t.nums;
|
|
138
|
+
}
|
|
139
|
+
extraSweep(doc, new Set(["dialect", "phenotype", "local_changes", "scale"]), [], errs);
|
|
140
|
+
if (errs.length > 0 || phenotype === null || localsBad) {
|
|
141
|
+
return renderErrors("AnnyBakeParams", errs);
|
|
142
|
+
}
|
|
143
|
+
const fail = (msg) => renderErrors("AnnyBakeParams", [vErr([], msg, s)]);
|
|
144
|
+
if (dialect === "authored") {
|
|
145
|
+
if (phenotype.length !== 11) {
|
|
146
|
+
return fail("authored phenotype wants 11 dims, got " + phenotype.length +
|
|
147
|
+
" — the dims are gender/age/muscle/weight/height/proportions/cupsize/firmness/african/asian/caucasian");
|
|
148
|
+
}
|
|
149
|
+
for (let i = 0; i < phenotype.length; i++) {
|
|
150
|
+
const n = phenotype[i];
|
|
151
|
+
if (!(n >= 0.0 && n <= 1.0)) {
|
|
152
|
+
return fail("authored phenotype[" + i + "] = " + String(n) + " outside 0.0..1.0");
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (scale !== null) {
|
|
156
|
+
return fail("authored takes local_changes, not scale (that is the estimated dialect)");
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
if (phenotype.length !== 6) {
|
|
161
|
+
return fail("estimated phenotype wants 6 dims, got " + phenotype.length +
|
|
162
|
+
" (the estimator's identity coefficients, not the 11 authoring dims)");
|
|
163
|
+
}
|
|
164
|
+
if (scale === null) {
|
|
165
|
+
return fail("estimated wants scale (the estimator run's measurement vector)");
|
|
166
|
+
}
|
|
167
|
+
if (scale.length !== 139) {
|
|
168
|
+
return fail("estimated scale wants 139 entries, got " + scale.length);
|
|
169
|
+
}
|
|
170
|
+
if (locals.length > 0) {
|
|
171
|
+
return fail("estimated bakes phenotype+scale only — local_changes would be silently ignored (that is the authored dialect)");
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
for (const e of locals) {
|
|
175
|
+
if (!(e.value >= -1.0 && e.value <= 2.0)) {
|
|
176
|
+
return fail("local_changes[" + JSON.stringify(e.name) + "] = " +
|
|
177
|
+
String(e.value) + " outside -1.0..2.0");
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=bakeParams.js.map
|
package/lib/bench.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** One bench stage's picks — the card it composes and the model it
|
|
2
|
+
* names (the model is unstated unless explicitly put in params). */
|
|
3
|
+
export interface StagePick {
|
|
4
|
+
readonly card: string | null;
|
|
5
|
+
readonly model: string | null;
|
|
6
|
+
}
|
|
7
|
+
/** The process's melite boot instant — pinned once, survives the
|
|
8
|
+
* estate's re-apply churn (each re-apply re-imports modules; the
|
|
9
|
+
* globalThis pin keeps ONE cutoff per process). */
|
|
10
|
+
export declare function benchBootMs(): number;
|
|
11
|
+
export declare function benchDir(storageRoot?: string): string;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export declare function benchStorageRoot(): string;
|
|
23
|
+
/** The LIVE bench's stage picks — docs written during this
|
|
24
|
+
* process's life only (the boot cutoff; stale docs from dead
|
|
25
|
+
* sessions are invisible by law). Sync by need: buildSkillIndex
|
|
26
|
+
* rides the seat handler synchronously. Malformed or racing docs
|
|
27
|
+
* contribute nothing — never a crash.
|
|
28
|
+
* @param storageRoot the drafts store's resolved storage root —
|
|
29
|
+
* one root for writer and reader (the C1 law); defaults to the
|
|
30
|
+
* store's own default law. */
|
|
31
|
+
export declare function benchPicksSync(storageRoot?: string): StagePick[];
|
|
32
|
+
//# sourceMappingURL=bench.d.ts.map
|
package/lib/bench.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// bench.ts — THE LIVE BENCH (the selection's only source,
|
|
2
|
+
|
|
3
|
+
// surface — skill catalog, skill index, anything — may list craft
|
|
4
|
+
// the bench does not hold. The bench docs live in the drafts
|
|
5
|
+
// storage (one bench-session-<uuid>.json per chat session);
|
|
6
|
+
// a stage landing writes one mid-session.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
// (mtime >= the process's first melite boot). A doc from a dead
|
|
11
|
+
// session must NEVER speak into a fresh one — the operator's two
|
|
12
|
+
// chats were injected at turn one by exactly such a stale file
|
|
13
|
+
// (my own test residue, hours old). The cutoff is pinned ONCE PER
|
|
14
|
+
// PROCESS on globalThis so the estate's re-apply churn (fresh
|
|
15
|
+
// module instances every ~21s) can never reset it.
|
|
16
|
+
import { readFileSync, readdirSync, statSync } from "node:fs";
|
|
17
|
+
import { join } from "node:path";
|
|
18
|
+
/** The process's melite boot instant — pinned once, survives the
|
|
19
|
+
* estate's re-apply churn (each re-apply re-imports modules; the
|
|
20
|
+
* globalThis pin keeps ONE cutoff per process). */
|
|
21
|
+
export function benchBootMs() {
|
|
22
|
+
const g = globalThis;
|
|
23
|
+
g.__meliteBenchBootMs ??= Date.now();
|
|
24
|
+
return g.__meliteBenchBootMs;
|
|
25
|
+
}
|
|
26
|
+
/** The cutoff with a 5s grace: mtime sub-ms precision vs the boot
|
|
27
|
+
* instant's integer ms can eat a same-tick write (probe:
|
|
28
|
+
* mtimeMs X.484 < bootMs X+1); the grace admits same-instant
|
|
29
|
+
* writes while dead-session docs (minutes/hours old) still die. */
|
|
30
|
+
function liveCutoffMs() {
|
|
31
|
+
return benchBootMs() - 5_000;
|
|
32
|
+
}
|
|
33
|
+
export function benchDir(storageRoot) {
|
|
34
|
+
|
|
35
|
+
// the reader follows the WRITER — the drafts store's own storage
|
|
36
|
+
// root (<stateRoot>/storage, the store's default law
|
|
37
|
+
// `data/runs/storage`), never a second tree under the DSH home
|
|
38
|
+
// (the retired seam left 181 files there with no writer). A
|
|
39
|
+
// caller that knows the resolved state root passes it; the
|
|
40
|
+
// default matches the store's own default so a config-free
|
|
41
|
+
// caller and the store resolve the SAME tree.
|
|
42
|
+
return join(storageRoot ?? benchStorageRoot(), "drafts", "docs");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
export function benchStorageRoot() {
|
|
55
|
+
return process.env["MELITE_BENCH_STORAGE"] ?? join("data", "runs", "storage");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// a catalog-follow poll that never landed — the probe found zero
|
|
59
|
+
// production importers (the spec alone). BENCHPICKS (async) went
|
|
60
|
+
// with it for the same reason: the sync twin is the one live seat
|
|
61
|
+
// (skillPlane's buildSkillIndex rides it). benchBootMs and benchDir
|
|
62
|
+
// stay exported for the spec's direct-src pins; the index.ts face
|
|
63
|
+
|
|
64
|
+
/** The LIVE bench's stage picks — docs written during this
|
|
65
|
+
* process's life only (the boot cutoff; stale docs from dead
|
|
66
|
+
* sessions are invisible by law). Sync by need: buildSkillIndex
|
|
67
|
+
* rides the seat handler synchronously. Malformed or racing docs
|
|
68
|
+
* contribute nothing — never a crash.
|
|
69
|
+
* @param storageRoot the drafts store's resolved storage root —
|
|
70
|
+
* one root for writer and reader (the C1 law); defaults to the
|
|
71
|
+
* store's own default law. */
|
|
72
|
+
export function benchPicksSync(storageRoot) {
|
|
73
|
+
const cutoff = liveCutoffMs();
|
|
74
|
+
const dir = benchDir(storageRoot);
|
|
75
|
+
let files = [];
|
|
76
|
+
try {
|
|
77
|
+
files = readdirSync(dir).filter((f) => f.startsWith("bench-") && f.endsWith(".json"));
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
// the roster dir may not exist yet (first bench, nothing
|
|
81
|
+
// persisted) or may be unreadable — both mean "no picks to
|
|
82
|
+
// list", the function's own empty answer, never a crash of a
|
|
83
|
+
// census/read path that must degrade to nothing
|
|
84
|
+
if (error.code !== "ENOENT") {
|
|
85
|
+
console.error("[benchPicksSync] roster read failed:", error);
|
|
86
|
+
}
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
const picks = [];
|
|
90
|
+
for (const f of files) {
|
|
91
|
+
try {
|
|
92
|
+
const full = join(dir, f);
|
|
93
|
+
if (statSync(full).mtimeMs < cutoff)
|
|
94
|
+
continue; // stale — dead session
|
|
95
|
+
const raw = JSON.parse(readFileSync(full, "utf8"));
|
|
96
|
+
for (const stg of raw.record?.doc?.stages ?? raw.doc?.stages ?? []) {
|
|
97
|
+
picks.push({
|
|
98
|
+
card: typeof stg.card === "string" && stg.card !== "" ? stg.card : null,
|
|
99
|
+
model: typeof stg.params?.model === "string" && stg.params.model !== ""
|
|
100
|
+
? stg.params.model
|
|
101
|
+
: null,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
// malformed or racing — contributes nothing, never a crash
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return picks;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=bench.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { RUNS_ERROR_CODES } from "./runsErrorCodes.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
export interface LaneInputMiss {
|
|
8
|
+
/** The model family id whose lane_inputs declared the row. */
|
|
9
|
+
readonly family: string;
|
|
10
|
+
/** The lane slot key (text_encoder, vae, …). */
|
|
11
|
+
readonly slot: string;
|
|
12
|
+
/** The declared file name that has no store copy. */
|
|
13
|
+
readonly missing: string;
|
|
14
|
+
/** The model folders the presence probe checked, in order. */
|
|
15
|
+
readonly folders: readonly string[];
|
|
16
|
+
/** The provision URL when the family declares one for the file. */
|
|
17
|
+
readonly fetchUrl?: string;
|
|
18
|
+
/** The artifact class the popup's action keys on. */
|
|
19
|
+
readonly kind: "model" | "extension";
|
|
20
|
+
}
|
|
21
|
+
export declare class CardArmError extends Error {
|
|
22
|
+
readonly status: number;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
readonly code: keyof typeof RUNS_ERROR_CODES;
|
|
29
|
+
readonly loc?: string;
|
|
30
|
+
readonly expected?: string;
|
|
31
|
+
readonly got?: string;
|
|
32
|
+
/** The structured lane-miss evidence — set only by the
|
|
33
|
+
* lane_input_missing throw site (cardsLanes.lanePresenceMiss). */
|
|
34
|
+
readonly lane?: LaneInputMiss;
|
|
35
|
+
constructor(status: number, message: string, code: keyof typeof RUNS_ERROR_CODES, loc?: string, expected?: string, got?: string, lane?: LaneInputMiss);
|
|
36
|
+
}
|
|
37
|
+
/** The variant rail's own refusal (sampler_envelope) — a subclass
|
|
38
|
+
* so the WRITE seat can tell a DECL-own word from a selection
|
|
39
|
+
* failure (the audit's GAP 1: laneVerdict swallowed these with
|
|
40
|
+
* the selection tolerance, the bench admitted what the run
|
|
41
|
+
* refused, and no served face carried the envelope). Every
|
|
42
|
+
* instanceof CardArmError site still catches it. */
|
|
43
|
+
export declare class EnvelopeRefusal extends CardArmError {
|
|
44
|
+
}
|
|
45
|
+
export declare function phaseRefusal(phase: string, detail: string): CardArmError;
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
export declare function phaseRefusalCode(detail: string, code: keyof typeof RUNS_ERROR_CODES): CardArmError;
|
|
61
|
+
//# sourceMappingURL=cardsArmError.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export class CardArmError extends Error {
|
|
2
|
+
status;
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
code;
|
|
9
|
+
loc;
|
|
10
|
+
expected;
|
|
11
|
+
got;
|
|
12
|
+
/** The structured lane-miss evidence — set only by the
|
|
13
|
+
* lane_input_missing throw site (cardsLanes.lanePresenceMiss). */
|
|
14
|
+
lane;
|
|
15
|
+
constructor(status, message, code, loc, expected, got, lane) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.status = status;
|
|
18
|
+
this.code = code;
|
|
19
|
+
if (loc !== undefined)
|
|
20
|
+
this.loc = loc;
|
|
21
|
+
if (expected !== undefined)
|
|
22
|
+
this.expected = expected;
|
|
23
|
+
if (got !== undefined)
|
|
24
|
+
this.got = got;
|
|
25
|
+
if (lane !== undefined)
|
|
26
|
+
this.lane = lane;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** The variant rail's own refusal (sampler_envelope) — a subclass
|
|
30
|
+
* so the WRITE seat can tell a DECL-own word from a selection
|
|
31
|
+
* failure (the audit's GAP 1: laneVerdict swallowed these with
|
|
32
|
+
* the selection tolerance, the bench admitted what the run
|
|
33
|
+
* refused, and no served face carried the envelope). Every
|
|
34
|
+
* instanceof CardArmError site still catches it. */
|
|
35
|
+
export class EnvelopeRefusal extends CardArmError {
|
|
36
|
+
}
|
|
37
|
+
export function phaseRefusal(phase, detail) {
|
|
38
|
+
return new CardArmError(400, "card_compose phase " + phase + ": " + detail, "card_compose");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
export function phaseRefusalCode(detail, code) {
|
|
55
|
+
return new CardArmError(400, detail, code);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=cardsArmError.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { cardAdmits } from "./cardsFacts.js";
|
|
2
|
+
export { cardAdmits };
|
|
3
|
+
import type { FactsReads } from "@melite/comfyui-cordis";
|
|
4
|
+
import type { PreparedCard } from "./cardsRegistry.js";
|
|
5
|
+
import { type CardDeclRow, type ModelFactsRow } from "./cardsFacts.js";
|
|
6
|
+
export interface ComposeSeat {
|
|
7
|
+
cardDecls(facts?: Record<string, ModelFactsRow>): Record<string, CardDeclRow>;
|
|
8
|
+
modelFacts(): Record<string, import("./cardsFacts.js").ModelFactsRow>;
|
|
9
|
+
modelMids(): Set<string>;
|
|
10
|
+
objectInfo(): Record<string, unknown> | null;
|
|
11
|
+
primeObjectInfo(): Promise<boolean>;
|
|
12
|
+
readsSync(): FactsReads;
|
|
13
|
+
resolveCardFamily(mid: string, facts?: Record<string, import("./cardsFacts.js").ModelFactsRow>): string;
|
|
14
|
+
/** The §23 cross-roots manifest (the queue seat's stateRoots —
|
|
15
|
+
* the dangling sweep's trees; J12: config-named, never env). */
|
|
16
|
+
stateRoots(): readonly string[];
|
|
17
|
+
}
|
|
18
|
+
/** In-process compose (the core: steps 7-9) — per-call throwaway
|
|
19
|
+
* Context + ComfyUIService (owned by the call, never shared). */
|
|
20
|
+
/** THE NESTED STANZA UNWRAP (cli.ts:82-91, one function two seats):
|
|
21
|
+
* a `params` dict key in the incoming params IS the stanza;
|
|
22
|
+
* siblings merge over it. Exported so the phase-1 admission seat
|
|
23
|
+
* gates the LIFTED body, never the raw stanza shell. */
|
|
24
|
+
export declare function liftStanza(params: Record<string, unknown>): Record<string, unknown>;
|
|
25
|
+
export declare function composeOnce(deps: ComposeSeat, card: string, fam: string, params: Record<string, unknown>, runId: string, phase: string): Promise<Record<string, unknown>>;
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
export declare function admissionRefusal(deps: ComposeSeat, card: string, fam: string, lifted: Record<string, unknown>, phase: string, facts?: Record<string, ModelFactsRow>): void;
|
|
38
|
+
/** Resolve + sweep + select + overlay + lift (steps 2-6):
|
|
39
|
+
* everything before compose. Throws CardArmError (the door maps
|
|
40
|
+
* it to the refusal envelope). `phase` stamps the phase-N voice
|
|
41
|
+
* on R1 selection refusals ("1" for validate/phase-1). Order
|
|
42
|
+
* mirrors resolve_card_model + the validate modelArm: artifact
|
|
43
|
+
* sweep FIRST (fail fast — a sloppy compose never runs), then
|
|
44
|
+
* legality, existence, the non-cordis arm check, selection,
|
|
45
|
+
* overlay, lift.
|
|
46
|
+
*
|
|
47
|
+
* @param factsArg a caller-resolved facts table. The validate
|
|
48
|
+
* door passes its degraded read (it answers from the catalog
|
|
49
|
+
* alone when the facts file is absent); omitted by every other
|
|
50
|
+
* seat, which takes the strict read here (`deps.modelFacts()`).
|
|
51
|
+
*/
|
|
52
|
+
export declare function prepareCardParams(deps: ComposeSeat, body: Record<string, unknown>, mid: string, phase: string, factsArg?: Record<string, ModelFactsRow>): PreparedCard;
|
|
53
|
+
//# sourceMappingURL=cardsCompose.d.ts.map
|