@melite/estate-queue 0.1.4-alpha → 0.2.0-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 +561 -457
- package/README.md +55 -0
- package/lib/bench.d.ts +19 -11
- package/lib/bench.js +47 -57
- package/lib/cardsArmError.d.ts +94 -2
- package/lib/cardsArmError.js +34 -4
- package/lib/cardsCompose.d.ts +13 -1
- package/lib/cardsCompose.js +151 -67
- package/lib/cardsDangling.d.ts +2 -2
- package/lib/cardsDangling.js +82 -37
- package/lib/cardsFacts.d.ts +32 -3
- package/lib/cardsFacts.js +39 -1
- package/lib/cardsLanes.d.ts +62 -4
- package/lib/cardsLanes.js +407 -20
- package/lib/cardsLanesCopy.d.ts +21 -0
- package/lib/cardsLanesCopy.js +22 -0
- package/lib/cardsRegistry.d.ts +195 -10
- package/lib/cardsRegistry.js +959 -67
- package/lib/cardsVariant.d.ts +22 -8
- package/lib/cardsVariant.js +243 -52
- package/lib/discloseRegistry.d.ts +42 -11
- package/lib/discloseRegistry.js +163 -23
- package/lib/filmLead.js +5 -3
- package/lib/flowsData.d.ts +68 -13
- package/lib/flowsData.js +236 -107
- package/lib/flowsFamilyCompose.d.ts +5 -8
- package/lib/flowsFamilyCompose.js +25 -14
- package/lib/flowsParamsOverlay.d.ts +55 -0
- package/lib/flowsParamsOverlay.js +197 -0
- package/lib/flowsRegistryRows.d.ts +4 -1
- package/lib/flowsRegistryRows.js +325 -25
- package/lib/index.d.ts +1 -3
- package/lib/index.js +20 -5
- package/lib/lifecycleLatch.d.ts +16 -0
- package/lib/lifecycleLatch.js +42 -0
- package/lib/loadPlane.d.ts +3 -2
- package/lib/loadPlane.js +34 -8
- package/lib/loadRegistry.js +1 -1
- package/lib/manageOps.d.ts +8 -2
- package/lib/manageOps.js +28 -7
- package/lib/managePlane.d.ts +42 -1
- package/lib/managePlane.js +911 -101
- package/lib/managePreflight.d.ts +26 -0
- package/lib/managePreflight.js +179 -0
- package/lib/manageProbe.d.ts +15 -7
- package/lib/manageProbe.js +79 -8
- package/lib/manageRegistry.d.ts +42 -4
- package/lib/manageRegistry.js +45 -7
- package/lib/mediaKinds.d.ts +1 -1
- package/lib/mediaKinds.js +1 -1
- package/lib/queue.js +14 -10
- package/lib/queueCore.d.ts +21 -5
- package/lib/queueCore.js +22 -5
- package/lib/queueLifecycle.d.ts +0 -24
- package/lib/queueLifecycle.js +9 -63
- package/lib/queueLock.d.ts +8 -2
- package/lib/queueLock.js +9 -6
- package/lib/queueResurrect.d.ts +7 -2
- package/lib/queueResurrect.js +25 -6
- package/lib/queueSidecar.d.ts +114 -1
- package/lib/queueSidecar.js +178 -7
- package/lib/queueSubmit.d.ts +124 -10
- package/lib/queueSubmit.js +251 -48
- package/lib/queueSweep.js +13 -2
- package/lib/runsChange.d.ts +8 -0
- package/lib/runsChange.js +21 -5
- package/lib/runsErrorCodes.d.ts +1 -1
- package/lib/runsErrorCodes.js +35 -0
- package/lib/runsExecute.d.ts +26 -0
- package/lib/runsExecute.js +184 -6
- package/lib/runsGates.d.ts +5 -1
- package/lib/runsGates.js +10 -5
- package/lib/runsList.d.ts +43 -3
- package/lib/runsList.js +172 -58
- package/lib/runsRefusalVoices.js +101 -0
- package/lib/runsRegistry.d.ts +188 -12
- package/lib/runsRegistry.js +1233 -179
- package/lib/runsSourceEcho.d.ts +27 -0
- package/lib/runsSourceEcho.js +84 -18
- package/lib/runsStart.d.ts +80 -17
- package/lib/runsStart.js +303 -49
- package/lib/runsTypes.d.ts +62 -2
- package/lib/runsTypes.js +30 -6
- package/lib/runsValidateArms.js +61 -7
- package/lib/runsValidateServe.d.ts +2 -2
- package/lib/runsValidateServe.js +46 -14
- package/lib/runsValidateShared.d.ts +10 -1
- package/lib/runsValidateShared.js +14 -0
- package/lib/runsValidateStages.d.ts +10 -3
- package/lib/runsValidateStages.js +44 -12
- package/lib/runtimeProvision.d.ts +119 -0
- package/lib/runtimeProvision.js +243 -0
- package/lib/service.d.ts +24 -6
- package/lib/service.js +19 -11
- package/lib/skillFs.d.ts +9 -4
- package/lib/skillFs.js +12 -14
- package/lib/skillPlane.d.ts +3 -2
- package/lib/skillPlane.js +12 -6
- package/lib/skillRegistry.js +1 -1
- package/lib/skillRows.d.ts +4 -3
- package/lib/skillRows.js +21 -14
- package/lib/toolProjection.d.ts +1 -1
- package/lib/toolProjection.js +1 -1
- package/package.json +18 -17
- package/lib/runStatus.d.ts +0 -7
- package/lib/runStatus.js +0 -21
package/lib/cardsVariant.d.ts
CHANGED
|
@@ -5,6 +5,15 @@ export interface VariantSelection {
|
|
|
5
5
|
readonly variantId: string;
|
|
6
6
|
readonly variantRoute: string;
|
|
7
7
|
readonly quant: string;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
readonly cellRoute: string;
|
|
16
|
+
readonly cellParams?: readonly string[];
|
|
8
17
|
readonly resolverDefaults: Record<string, unknown>;
|
|
9
18
|
/** THE ROUTE ENVELOPE (the 25-steps-into-turbo cure): when the
|
|
10
19
|
* selected variant declares one, a caller-STATED steps/cfg
|
|
@@ -12,14 +21,19 @@ export interface VariantSelection {
|
|
|
12
21
|
* distilled lane's marriage is not agency territory. */
|
|
13
22
|
readonly samplerEnvelope: Readonly<Record<"steps" | "cfg", EnvelopeBound | undefined>> | null;
|
|
14
23
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
export declare function selectCardVariant(mid: string, famRow: ModelFactsRow, body: Record<string, unknown>, phase: string, familyLanes?: readonly string[], familyId?: string): VariantSelection;
|
|
36
|
+
export declare function stampCardOverlay(body: Record<string, unknown>, famRow: ModelFactsRow, decl: CardDeclRow, sel: VariantSelection, phase: string, fam: string): Record<string, unknown>;
|
|
23
37
|
/** The card-compose lift (card_compose_body 363-372): the run body
|
|
24
38
|
* minus the gateway envelope, restaged as the ONE params stanza.
|
|
25
39
|
* variant/quant ride the R1 contract (consumed at selection, never
|
package/lib/cardsVariant.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { samplerEnvelopeCure } from "@melite/contracts/laneRelations";
|
|
2
2
|
import { EnvelopeRefusal, phaseRefusal } from "./cardsArmError.js";
|
|
3
|
-
import { judgeSamplerEnvelope, unknownQuantVoice, unknownVariantVoice } from "@melite/contracts/laneRelations";
|
|
3
|
+
import { judgeSamplerEnvelope, offeredPool, resolveCellRow, resolveVariantRow, unknownQuantVoice, unknownVariantVoice, } from "@melite/contracts/laneRelations";
|
|
4
4
|
import { CARD_ENVELOPE_KEYS } from "./cardsRegistry.js";
|
|
5
|
+
import { cardAdmits } from "./cardsFacts.js";
|
|
6
|
+
import { theService, owningAtom } from "@melite/comfyui-cordis";
|
|
5
7
|
/** Normalize a facts variant's sampler_envelope declaration (the
|
|
6
8
|
* DECL authors it as {steps?: [min,max], cfg?: [min,max]}); junk
|
|
7
9
|
* shapes contribute nothing (never a crash). */
|
|
@@ -19,74 +21,113 @@ function normalizeEnvelope(raw) {
|
|
|
19
21
|
const cfg = bound(r.cfg);
|
|
20
22
|
return steps === undefined && cfg === undefined ? null : { steps, cfg };
|
|
21
23
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
export function selectCardVariant(mid, famRow, body, phase, familyLanes, familyId) {
|
|
32
36
|
const variants = famRow.variants ?? [];
|
|
33
|
-
const offered = variants.filter((v) => v.hide_from_dropdown !== true);
|
|
34
37
|
const hiddenRoute = variants.find((v) => v.hide_from_dropdown === true && (v.route === mid || v.id === mid || (v.cells ?? []).some((c) => c.route === mid)));
|
|
35
38
|
const hiddenCellRoute = variants.some((v) => (v.cells ?? []).some((c) => c.hide_from_dropdown === true && c.route === mid));
|
|
36
39
|
if (hiddenRoute !== undefined || hiddenCellRoute) {
|
|
37
40
|
throw phaseRefusal(phase, "model " + JSON.stringify(mid) +
|
|
38
41
|
" is not offered (the variant route is hidden from the dropdown)");
|
|
39
42
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
// THE DOOR'S EARLY ALL-HIDDEN REFUSAL (order-pinned by its suite:
|
|
44
|
+
// before the stated search — an all-hidden family refuses its
|
|
45
|
+
// address, never its stated coordinate). The pool itself is the
|
|
46
|
+
// resolver's one spelling (offeredPool).
|
|
47
|
+
if (offeredPool(variants).length === 0 && variants.length > 0) {
|
|
43
48
|
throw phaseRefusal(phase, "model " + JSON.stringify(mid) + " has no offered variants");
|
|
44
49
|
}
|
|
45
50
|
const rawVariant = body["variant"];
|
|
46
51
|
const rawQuant = body["quant"];
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
if (rawVariant !== undefined && rawVariant !== null && typeof rawVariant !== "string") {
|
|
53
|
+
throw phaseRefusal(phase, "variant must be a string (got " +
|
|
54
|
+
(Array.isArray(rawVariant) ? "list" : typeof rawVariant) + ")");
|
|
50
55
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
// THE STATED/UNSTATED VARIANT ARM (the resolver's offered face):
|
|
57
|
+
// the stated search runs over the whole handed matrix (a hidden hit
|
|
58
|
+
// is the door's not-offered refusal, a miss speaks the matrix's own
|
|
59
|
+
// ids); the unstated coordinate is the address claim, else pool[0].
|
|
60
|
+
//
|
|
61
|
+
|
|
62
|
+
// audit 013 — the edit-steps burn): the address claim exists for
|
|
63
|
+
// ROUTE pins (a draft naming a variant-level lane like
|
|
64
|
+
// 'krea-2-raw'). When the door's address IS the family's own head
|
|
65
|
+
// id, the doc states the FAMILY, not a pin — and the claim captured
|
|
66
|
+
// the BASE row for every family whose base route equals the family
|
|
67
|
+
// id (qwen-img-edit-21: door resolved base/25 while the client
|
|
68
|
+
// mirror's '' spelling fell to pool[0]/turbo — one resolver, two
|
|
69
|
+
// spellings, the UI banner over a base-composed run). The head
|
|
70
|
+
// spelling narrows to '' so the door and the mirror read pool[0] —
|
|
71
|
+
// the DECL-walk law: first declared = the default.
|
|
72
|
+
const address = familyId !== undefined && mid === familyId ? "" : mid;
|
|
73
|
+
const vres = resolveVariantRow(variants, rawVariant, address, "offered");
|
|
74
|
+
if (vres.status === "missing") {
|
|
75
|
+
throw phaseRefusal(phase, unknownVariantVoice(vres.stated, mid, vres.known, familyLanes));
|
|
76
|
+
}
|
|
77
|
+
if (vres.status === "hidden") {
|
|
78
|
+
throw phaseRefusal(phase, "variant " + JSON.stringify(rawVariant) +
|
|
79
|
+
" is not offered for model " + JSON.stringify(mid));
|
|
65
80
|
}
|
|
81
|
+
// 'pool-empty' is only reachable on an EMPTY matrix here (the
|
|
82
|
+
// early all-hidden throw guarded the non-empty one) — the
|
|
83
|
+
// variant-less family resolves empty coordinates.
|
|
84
|
+
const variant = vres.status === "resolved" ? vres.variant : undefined;
|
|
66
85
|
let quant = "";
|
|
67
|
-
|
|
86
|
+
let cell;
|
|
87
|
+
// THE LEGACY COORDINATE (the size-at-quant fold, operator
|
|
88
|
+
|
|
89
|
+
// 'native' — an old draft carries that coordinate against a
|
|
90
|
+
// family whose cells now name SIZES. 'native' meant "the only
|
|
91
|
+
// size this family ships", which the ADDRESS already says, so it
|
|
92
|
+
// resolves as UNSTATED (the mid's cell claim picks the size —
|
|
93
|
+
// never a silent neighbor cell, never a refusal on a draft the
|
|
94
|
+
// fold promised to keep landing).
|
|
95
|
+
const legacyNative = rawQuant === "native";
|
|
96
|
+
if (rawQuant !== undefined && rawQuant !== null && !legacyNative) {
|
|
68
97
|
if (typeof rawQuant !== "string") {
|
|
69
98
|
throw phaseRefusal(phase, "quant must be a string (got " +
|
|
70
99
|
(Array.isArray(rawQuant) ? "list" : typeof rawQuant) + ")");
|
|
71
100
|
}
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
:
|
|
75
|
-
const hit = cells.find((c) => c.quant === rawQuant);
|
|
76
|
-
if (hit === undefined) {
|
|
77
|
-
throw phaseRefusal(phase, unknownQuantVoice(rawQuant, mid, variant !== undefined ? variant.id : "", cells.map((c) => c.quant)));
|
|
101
|
+
const qres = resolveCellRow(variant, rawQuant, mid, "offered");
|
|
102
|
+
if (qres.status === "missing") {
|
|
103
|
+
throw phaseRefusal(phase, unknownQuantVoice(qres.stated, mid, variant !== undefined ? variant.id : "", qres.known));
|
|
78
104
|
}
|
|
79
|
-
|
|
105
|
+
cell = qres.cell ?? undefined;
|
|
106
|
+
quant = qres.quant;
|
|
80
107
|
}
|
|
81
108
|
else if (variant !== undefined) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
109
|
+
// Unstated quant: the ADDRESS'S OWN CELL CLAIM wins (the
|
|
110
|
+
// fold's coverage law — a draft pinned to 'qwen3-tts-base'
|
|
111
|
+
// means the 0.6B clone; one pinned to 'qwen3-tts-voicedesign'
|
|
112
|
+
// means the 1.7B persona), else the FIRST cell (Model.resolve's
|
|
113
|
+
// family default — the large rung leads every ladder). The
|
|
114
|
+
// claim rides the NARROWED address (the B3 address trap,
|
|
115
|
+
|
|
116
|
+
// 0.6B cell for the family head 'qwen3-tts' — whose id IS that
|
|
117
|
+
// cell's route — so every family-stated compose stole the small
|
|
118
|
+
// model while the agent doc promised "ALWAYS the 1.7B cell".
|
|
119
|
+
// The head spelling narrows to '' (line 128), the claim goes
|
|
120
|
+
// unstated, and pool[0] (the declared 1.7B first cell) serves.
|
|
121
|
+
const qres = resolveCellRow(variant, null, address, "offered");
|
|
122
|
+
cell = qres.status === "resolved" ? (qres.cell ?? undefined) : undefined;
|
|
123
|
+
quant = qres.status === "resolved" ? qres.quant : "";
|
|
85
124
|
}
|
|
86
125
|
return {
|
|
87
126
|
variantId: variant !== undefined ? variant.id : "",
|
|
88
127
|
variantRoute: variant !== undefined ? String(variant.route ?? "") : "",
|
|
89
128
|
quant,
|
|
129
|
+
cellRoute: cell !== undefined ? String(cell.route ?? "") : "",
|
|
130
|
+
cellParams: cell?.params,
|
|
90
131
|
resolverDefaults: variant !== undefined ? { ...(variant.resolver_defaults ?? {}) } : {},
|
|
91
132
|
samplerEnvelope: variant !== undefined
|
|
92
133
|
? normalizeEnvelope(variant.sampler_envelope)
|
|
@@ -125,19 +166,162 @@ function envelopeRefusal(body, sel, phase) {
|
|
|
125
166
|
". " + samplerEnvelopeCure() +
|
|
126
167
|
" (Read the family lane: melite_skill_read model:<family>.)", "card_compose");
|
|
127
168
|
}
|
|
128
|
-
|
|
169
|
+
/** THE ONE-SWITCH LAW, BAG HALF — the variant voice for a carried
|
|
170
|
+
* mod row the arrival family does not serve. One shape with
|
|
171
|
+
* unknownQuantVoice (the shared lane voices): the stated row, the
|
|
172
|
+
* lane it landed on, the rows the lane serves; the tail names the
|
|
173
|
+
* law, not a silent fix. The client half of this law nulls the bag
|
|
174
|
+
* at the gesture (card-base spec.ts modelSwitchPatch's cross-model
|
|
175
|
+
* arm); this voice is the door's half for re-points no gesture
|
|
176
|
+
* covers. */
|
|
177
|
+
function unknownBagRowVoice(pack, id, fam, sel, known) {
|
|
178
|
+
return "unknown " + pack + " row " + JSON.stringify(id) +
|
|
179
|
+
" for model " + JSON.stringify(fam) +
|
|
180
|
+
" variant " + JSON.stringify(sel.variantId) +
|
|
181
|
+
(known.length > 0
|
|
182
|
+
? " (known: " + known.join(", ") + ")"
|
|
183
|
+
: " (the family serves no rows)") +
|
|
184
|
+
" — mods are per model: the bag was picked for another model's weights and refuses here rather than ride to the engine" +
|
|
185
|
+
" (Read the family lane: melite_skill_read model:" + fam + ".)";
|
|
186
|
+
}
|
|
187
|
+
/** THE CROSS-MODEL CARRY JUDGE, BAG HALF (journey-closure §D3 — the
|
|
188
|
+
* axis-unification audit's estate-lane residue, 071f8c7a1's
|
|
189
|
+
* recorded finding): a doc whose model key was re-pointed without a
|
|
190
|
+
* gesture (the card's semantic-model knob, a tool face patch, an
|
|
191
|
+
* agent write, a stage copy) arrives here with bag values still
|
|
192
|
+
* stamped under the departed family. Every absorbed pack's array
|
|
193
|
+
* field the body carries is mod currency picked for SOME model's
|
|
194
|
+
* weights; each option-mode entry ({id,…}) must name a row of the
|
|
195
|
+
* arrival atom's OWN catalog, else it refuses loud — foreign values
|
|
196
|
+
* never reach the engine. Reads the arrival family's DIRECT catalog
|
|
197
|
+
* (modCatalog on the route→atom fold, the same fold the stamp
|
|
198
|
+
* surface scopes) — never the compose walk's boarded-family
|
|
199
|
+
* fallback (service.ts modCatalogForCompose), whose fallback serves
|
|
200
|
+
* another boarded family's rows when the arrival family serves
|
|
201
|
+
* none: exactly the cross-model absorption this judge refuses.
|
|
202
|
+
* Filename entries ({name,…}) ride untouched — the card-authoring
|
|
203
|
+
* lane, the service door's own boundary. @param bags the absorbed
|
|
204
|
+
* packs' array-typed field names, collected in the fold below;
|
|
205
|
+
* empty when the fold degraded (card defs not booted in this
|
|
206
|
+
* fiber) — the judge degrades with it, the pre-judge shape. */
|
|
207
|
+
function bagRefusal(body, bags, atom, sel, phase, fam) {
|
|
208
|
+
for (const bag of bags) {
|
|
209
|
+
const carried = body[bag.key];
|
|
210
|
+
if (!Array.isArray(carried))
|
|
211
|
+
continue;
|
|
212
|
+
const known = theService().modCatalog(bag.pack, atom).rows.map((r) => r.id);
|
|
213
|
+
for (const entry of carried) {
|
|
214
|
+
if (entry === null || typeof entry !== "object")
|
|
215
|
+
continue;
|
|
216
|
+
const row = entry;
|
|
217
|
+
if (typeof row.name === "string" && row.name !== "")
|
|
218
|
+
continue;
|
|
219
|
+
if (typeof row.id !== "string" || row.id === "")
|
|
220
|
+
continue;
|
|
221
|
+
if (known.includes(row.id))
|
|
222
|
+
continue;
|
|
223
|
+
throw phaseRefusal(phase, unknownBagRowVoice(bag.pack, row.id, fam, sel, known));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
export function stampCardOverlay(body, famRow, decl, sel, phase, fam) {
|
|
129
228
|
envelopeRefusal(body, sel, phase);
|
|
130
229
|
const stamps = { ...(famRow.defaults ?? {}) };
|
|
131
230
|
for (const [k, v] of Object.entries(sel.resolverDefaults))
|
|
132
231
|
stamps[k] = v;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
232
|
+
// THE SHARED SURFACE (audit Y-S2, the third admission seat): the
|
|
233
|
+
// stamp gate judged knobs+admits by hand and omitted the absorbed
|
|
234
|
+
// mod fields — a mod-surfaced default failed to stamp (fail-closed,
|
|
235
|
+
// no live key) while both other seats admitted it. One predicate,
|
|
236
|
+
// three seats; the atom rides in (owningAtom(fam), the same fold
|
|
237
|
+
// admissionRefusal judges).
|
|
238
|
+
const modNames = new Set();
|
|
239
|
+
// THE BAG FIELDS (the carry judge's walk, one fold two products):
|
|
240
|
+
// each absorbed pack's array-typed field is mod currency (the bag
|
|
241
|
+
// law) — collected beside the knob names so the judge reads the
|
|
242
|
+
// SAME route→atom fold the stamp surface scopes.
|
|
243
|
+
const bagFields = [];
|
|
244
|
+
let envelopeAtom = "";
|
|
245
|
+
try {
|
|
246
|
+
// THE ROUTE→ATOM FOLD (same fold admissionRefusal judges): the
|
|
247
|
+
// owning atom scopes the absorbed surface; a not-booted models
|
|
248
|
+
// service degrades the whole fold to knobs+admits.
|
|
249
|
+
envelopeAtom = owningAtom(fam);
|
|
250
|
+
for (const a of theService().cardModFields(famRow.card)) {
|
|
251
|
+
if (!a.families.includes(envelopeAtom))
|
|
252
|
+
continue;
|
|
253
|
+
for (const [n, node] of Object.entries(a.fields.dict ?? {})) {
|
|
254
|
+
modNames.add(n);
|
|
255
|
+
if (node?.type === "array") {
|
|
256
|
+
bagFields.push({ pack: a.pack, key: n });
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
catch (modFoldError) {
|
|
262
|
+
// modFoldError: card defs not booted in this fiber — the stamp
|
|
263
|
+
// gate degrades to knobs+admits, the pre-Y-S2 surface (and the
|
|
264
|
+
// carry judge degrades with it: bagFields stays empty).
|
|
265
|
+
}
|
|
266
|
+
// THE CARRY JUDGE, BAG HALF — before the stamps walk and the
|
|
267
|
+
// compose walk: the departure-blind door judges the carry against
|
|
268
|
+
// the arrival family's own catalog (bagRefusal's contract).
|
|
269
|
+
bagRefusal(body, bagFields, envelopeAtom, sel, phase, fam);
|
|
270
|
+
const onSurface = (k) => cardAdmits(decl, modNames, k);
|
|
140
271
|
const out = { ...body };
|
|
272
|
+
// THE QVOICE-STATED PRESET SKIP (the tts dossier's B7 cure,
|
|
273
|
+
|
|
274
|
+
// a body carrying a non-empty qvoice (the saved-persona bag:
|
|
275
|
+
// string or rows) NEVER takes the 'voice' preset stamp. The
|
|
276
|
+
// engine's qvoice branch has no speaker at all (upstream
|
|
277
|
+
// generate_voice_clone carries none), so the stamped preset was
|
|
278
|
+
// inert currency the receipts lied about; with the stamp skipped,
|
|
279
|
+
// an EXPLICIT both-stated run refuses loud at the card's own
|
|
280
|
+
// compose (card.ts's B2 refusal), never silently drops one.
|
|
281
|
+
// THE STANZA SEAT (the B7 residue, the second rebuild's live
|
|
282
|
+
// refusal): the bench-save shape carries the bag INSIDE the
|
|
283
|
+
// params stanza ({model, params:{…qvoice…}}) — a top-level-only
|
|
284
|
+
// look missed it, stamped 'ryan' at the top level, and the lift
|
|
285
|
+
// merged stamp + stanza into a both-stated body the card refused
|
|
286
|
+
// verbatim (card-mode qvoice compose, no voice stated anywhere).
|
|
287
|
+
// The skip reads BOTH seats: the flat agent body AND the stanza.
|
|
288
|
+
const stanzaRow = typeof body["params"] === "object" && body["params"] !== null && !Array.isArray(body["params"])
|
|
289
|
+
? body["params"]
|
|
290
|
+
: null;
|
|
291
|
+
const qvoiceSeats = [body["qvoice"]];
|
|
292
|
+
if (stanzaRow !== null)
|
|
293
|
+
qvoiceSeats.push(stanzaRow["qvoice"]);
|
|
294
|
+
const qvoiceStated = qvoiceSeats.some((q) => (typeof q === "string" && q !== "") ||
|
|
295
|
+
(Array.isArray(q) && q.length > 0));
|
|
296
|
+
|
|
297
|
+
// burn): the 'voice' stamp above is DERIVED currency, never the
|
|
298
|
+
// author's word — but once a compile has written it into the doc, a
|
|
299
|
+
// later add-stage that states a qvoice meets it as a both-stated
|
|
300
|
+
// body and the card's B2 gate refuses. Patching {voice: null} could
|
|
301
|
+
// not hold: JSON-merge-patch deletes the key and the next compile
|
|
302
|
+
// re-stamps it, so the saved doc could never reach a legal
|
|
303
|
+
// qvoice-only stage. Release the derived seat instead: while a
|
|
304
|
+
// persona is stated, a preset equal to THIS lane's own stamp value
|
|
305
|
+
// is the overlay's residue, so it is dropped at both seats. A
|
|
306
|
+
// preset the author states beside the persona stays — the card's
|
|
307
|
+
// own B2 refusal (ONE voice performs) is the loud door for that.
|
|
308
|
+
if (qvoiceStated) {
|
|
309
|
+
const derived = new Set();
|
|
310
|
+
for (const v of [stamps["voice"], (famRow.defaults ?? {})["voice"], sel.resolverDefaults["voice"]]) {
|
|
311
|
+
if (typeof v === "string" && v !== "")
|
|
312
|
+
derived.add(v);
|
|
313
|
+
}
|
|
314
|
+
if (derived.size > 0) {
|
|
315
|
+
if (derived.has(out["voice"]))
|
|
316
|
+
delete out["voice"];
|
|
317
|
+
const held = out["params"];
|
|
318
|
+
if (held !== null && typeof held === "object" && !Array.isArray(held) && derived.has(held["voice"])) {
|
|
319
|
+
const next = { ...held };
|
|
320
|
+
delete next["voice"];
|
|
321
|
+
out["params"] = next;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
141
325
|
for (const [k, v] of Object.entries(stamps)) {
|
|
142
326
|
if (v === null || v === undefined || v === "")
|
|
143
327
|
continue;
|
|
@@ -147,6 +331,8 @@ export function stampCardOverlay(body, famRow, decl, sel, phase) {
|
|
|
147
331
|
continue;
|
|
148
332
|
if (CARD_ENVELOPE_KEYS.includes(k))
|
|
149
333
|
continue;
|
|
334
|
+
if (k === "voice" && qvoiceStated)
|
|
335
|
+
continue;
|
|
150
336
|
out[k] = v;
|
|
151
337
|
}
|
|
152
338
|
return out;
|
|
@@ -178,11 +364,16 @@ export function liftCardParams(body) {
|
|
|
178
364
|
// stanza; the "ONE SPELLING" claim is only true once this
|
|
179
365
|
// matches it.)
|
|
180
366
|
for (const [ik, iv] of Object.entries(v)) {
|
|
181
|
-
|
|
367
|
+
|
|
368
|
+
// undefined reads as absent, matching what JSON persistence
|
|
369
|
+
// would hand the row.
|
|
370
|
+
if (!(ik in params) && iv !== undefined)
|
|
182
371
|
params[ik] = iv;
|
|
183
372
|
}
|
|
184
373
|
continue;
|
|
185
374
|
}
|
|
375
|
+
if (v === undefined)
|
|
376
|
+
continue;
|
|
186
377
|
params[k] = v;
|
|
187
378
|
}
|
|
188
379
|
return params;
|
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { Service } from "@deepseek-ai/cordis";
|
|
2
2
|
import type { Context } from "@deepseek-ai/cordis";
|
|
3
|
+
import type { FlowsSeat } from "./flowsData.js";
|
|
3
4
|
/** One card summary (the routing layer — no bodies). */
|
|
4
|
-
export interface
|
|
5
|
+
export interface DiscoveredCard {
|
|
5
6
|
readonly id: string;
|
|
6
7
|
readonly label: string;
|
|
7
8
|
readonly description: string;
|
|
8
9
|
readonly genre: string;
|
|
9
10
|
readonly tags: readonly string[];
|
|
11
|
+
/** WHY this row surfaced (the ranked-answer law, slice 3): the
|
|
12
|
+
* facets that matched, strongest first — `tags=image` for a facet
|
|
13
|
+
* filter, `tag:sky`, `word:beta`, `modality:image`, or
|
|
14
|
+
* `fuzzy:seas~sea(0.67)`. Never a bare row the agent must guess
|
|
15
|
+
* the reason for. */
|
|
16
|
+
readonly matched_by: string;
|
|
17
|
+
/** The ranking score (sum of facet weights) — the sort key, served
|
|
18
|
+
* so a caller can see the distance between rows. */
|
|
19
|
+
readonly score: number;
|
|
10
20
|
}
|
|
11
21
|
/** One flow summary (the routing layer). */
|
|
12
22
|
export interface FlowSummary {
|
|
@@ -17,7 +27,10 @@ export interface FlowSummary {
|
|
|
17
27
|
readonly skillRefs: readonly string[];
|
|
18
28
|
}
|
|
19
29
|
/** The search surface a card def offers (the def itself satisfies
|
|
20
|
-
* this — structural, no import of the engine service).
|
|
30
|
+
* this — structural, no import of the engine service). boarded is
|
|
31
|
+
* the card's family roster — a model name in q must route, so the
|
|
32
|
+
* corpus carries the family ids, never just the card's own words
|
|
33
|
+
* (friction-report #5: q ignored model names). */
|
|
21
34
|
export interface SearchableCard {
|
|
22
35
|
readonly identity?: {
|
|
23
36
|
readonly label?: string;
|
|
@@ -25,17 +38,26 @@ export interface SearchableCard {
|
|
|
25
38
|
readonly genre?: string;
|
|
26
39
|
};
|
|
27
40
|
readonly tags?: readonly string[];
|
|
41
|
+
readonly boarded?: readonly string[];
|
|
28
42
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
export declare function diceTrigrams(a: string, b: string): number;
|
|
47
|
+
/** Search the card defs (slice 3, the intent door): the tags param
|
|
48
|
+
* (comma list) is a HARD facet — a card must carry every tag. q is
|
|
49
|
+
* RANKED, never an AND: every non-stopword token scores its best
|
|
50
|
+
* facet (exact tag 3, exact word 2, modality 2, trigram fuzzy
|
|
51
|
+
* 0.42–1), rows sort by score then id, and every row carries the
|
|
52
|
+
* WHY it surfaced. With tags stated the facet alone keeps a row
|
|
53
|
+
* (score 0 is a lawful tag hit); without tags a row needs at least
|
|
54
|
+
* one scoring token. Empty q + tags = every tag-matched card. */
|
|
55
|
+
export declare function searchCards(defs: ReadonlyMap<string, SearchableCard>, q: string, tags: string): DiscoveredCard[];
|
|
34
56
|
/** Search the flow rows (PURE over the merged rows). */
|
|
35
57
|
export declare function searchFlows(rows: ReadonlyArray<FlowSummary>, q: string): FlowSummary[];
|
|
36
58
|
/** The flow rows: REGISTRY (the compile truth) merged with the
|
|
37
59
|
* flows/<name>/tool.json leaf (the agent face: stage_title). */
|
|
38
|
-
export declare function flowSummaryRows(repo: string): FlowSummary[];
|
|
60
|
+
export declare function flowSummaryRows(repo: string, flowsSeat?: FlowsSeat | null): FlowSummary[];
|
|
39
61
|
|
|
40
62
|
|
|
41
63
|
|
|
@@ -57,7 +79,7 @@ export interface FlowContract {
|
|
|
57
79
|
readonly tool: unknown;
|
|
58
80
|
}
|
|
59
81
|
/** The contract rows, one per registry flow, in registry order. */
|
|
60
|
-
export declare function flowContractRows(): FlowContract[];
|
|
82
|
+
export declare function flowContractRows(flowsSeat?: FlowsSeat | null): FlowContract[];
|
|
61
83
|
/** The disclosure service: ONE disclosure system over both planes.
|
|
62
84
|
* discover(lookup, q, tags) answers {flows?, cards?} — the door's
|
|
63
85
|
* combined body, live-derived. */
|
|
@@ -73,10 +95,19 @@ export declare class DiscloseDirectoryService extends Service {
|
|
|
73
95
|
};
|
|
74
96
|
/** GET /v1/discover: unknown
|
|
75
97
|
* lookup refuses with the door's own voice; the body carries the
|
|
76
|
-
* requested planes only.
|
|
98
|
+
* requested planes only. totals is the UNFILTERED estate size
|
|
99
|
+
* (friction-report #5: a filtered answer must say "N cards, M
|
|
100
|
+
* matched" — never present the match as the catalog); missed_tags
|
|
101
|
+
* is the tag vocabulary of cards the filter removed, so a miss is
|
|
102
|
+
* discoverable in one hop. */
|
|
77
103
|
discover(lookup: string, q: string, tags: string): {
|
|
78
104
|
flows?: FlowSummary[];
|
|
79
|
-
cards?:
|
|
105
|
+
cards?: DiscoveredCard[];
|
|
106
|
+
totals: {
|
|
107
|
+
flows: number;
|
|
108
|
+
cards: number;
|
|
109
|
+
};
|
|
110
|
+
missed_tags?: string[];
|
|
80
111
|
};
|
|
81
112
|
}
|
|
82
113
|
/** The disclose row: mounts after the card-registry provider (its
|