@melite/estate-queue 0.1.5-pre-alpha → 0.2.2-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 +0 -5
- package/lib/cardsArmError.d.ts +52 -3
- package/lib/cardsArmError.js +7 -1
- package/lib/cardsCompose.d.ts +31 -0
- package/lib/cardsCompose.js +98 -7
- package/lib/cardsFacts.d.ts +16 -0
- package/lib/cardsFacts.js +25 -1
- package/lib/cardsLanes.d.ts +51 -3
- package/lib/cardsLanes.js +337 -13
- package/lib/cardsLanesCopy.d.ts +21 -0
- package/lib/cardsLanesCopy.js +22 -0
- package/lib/cardsRegistry.d.ts +105 -5
- package/lib/cardsRegistry.js +826 -46
- package/lib/cardsVariant.d.ts +12 -7
- package/lib/cardsVariant.js +196 -58
- package/lib/discloseRegistry.d.ts +41 -6
- package/lib/discloseRegistry.js +155 -17
- package/lib/filmLead.js +5 -3
- package/lib/flowsData.d.ts +77 -21
- package/lib/flowsData.js +159 -21
- package/lib/flowsFamilyCompose.js +12 -1
- package/lib/flowsRegistryRows.d.ts +0 -3
- package/lib/flowsRegistryRows.js +166 -222
- package/lib/index.d.ts +1 -1
- package/lib/index.js +6 -4
- package/lib/loadPlane.d.ts +46 -4
- package/lib/loadPlane.js +116 -7
- package/lib/loadRegistry.js +9 -2
- package/lib/manageOps.js +2 -1
- package/lib/managePlane.d.ts +16 -1
- package/lib/managePlane.js +955 -65
- package/lib/managePreflight.d.ts +26 -0
- package/lib/managePreflight.js +211 -0
- package/lib/manageProbe.d.ts +52 -0
- package/lib/manageProbe.js +171 -1
- package/lib/queueCore.d.ts +14 -1
- package/lib/queueCore.js +13 -0
- package/lib/queueLock.js +19 -10
- package/lib/queueResurrect.d.ts +7 -5
- package/lib/queueResurrect.js +25 -9
- package/lib/queueRetry.d.ts +12 -10
- package/lib/queueRetry.js +2 -4
- package/lib/queueSidecar.d.ts +122 -1
- package/lib/queueSidecar.js +192 -7
- package/lib/queueSubmit.d.ts +70 -4
- package/lib/queueSubmit.js +159 -7
- package/lib/runsErrorCodes.js +5 -3
- package/lib/runsExecute.d.ts +16 -1
- package/lib/runsExecute.js +97 -39
- package/lib/runsGates.d.ts +16 -4
- package/lib/runsGates.js +17 -5
- package/lib/runsList.d.ts +100 -4
- package/lib/runsList.js +364 -63
- package/lib/runsRefusalVoices.js +50 -1
- package/lib/runsRegistry.d.ts +142 -9
- package/lib/runsRegistry.js +960 -163
- package/lib/runsStart.d.ts +30 -7
- package/lib/runsStart.js +136 -14
- package/lib/runsTypes.d.ts +46 -3
- package/lib/runsTypes.js +63 -9
- package/lib/runsValidate.d.ts +1 -0
- package/lib/runsValidate.js +5 -0
- package/lib/runsValidateArms.js +25 -0
- package/lib/runsValidateServe.js +25 -12
- package/lib/runsValidateShared.d.ts +8 -1
- package/lib/runsValidateShared.js +44 -4
- package/lib/runsValidateStages.d.ts +1 -1
- package/lib/runsValidateStages.js +107 -55
- package/lib/runtimeProvision.d.ts +119 -0
- package/lib/runtimeProvision.js +243 -0
- package/lib/skillAuthored.d.ts +50 -0
- package/lib/skillAuthored.js +178 -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 +49 -5
- package/package.json +33 -23
- package/lib/resurrect.d.ts +0 -6
- package/lib/resurrect.js +0 -18
package/lib/runsRegistry.js
CHANGED
|
@@ -15,9 +15,11 @@ import { join, relative } from "node:path";
|
|
|
15
15
|
import { Service } from "@deepseek-ai/cordis";
|
|
16
16
|
import { RemoteError } from "@deepseek-ai/dsh-typert-protocol";
|
|
17
17
|
import { stageEngineOf } from "@melite/contracts/benchStage";
|
|
18
|
+
import { draftIdOf } from "@melite/contracts/benchStage";
|
|
18
19
|
import { benchResultDefects } from "@melite/contracts/benchResult";
|
|
19
20
|
import { remoteErrorOf } from "@deepseek-ai/dsh-typert-protocol";
|
|
20
21
|
import { needComfyUI } from "@melite/comfyui-cordis";
|
|
22
|
+
import { STAGE_RESERVED_PARAMS } from "@melite/comfyui-cordis";
|
|
21
23
|
import { expandRegistryFlow, extractRequestInitials, initialFileCandidates, registryFlowToInline, inlineStagesNameCards, registryInitialsError, } from "./flowsData.js";
|
|
22
24
|
import { isFile } from "./skillFs.js";
|
|
23
25
|
import { kindsOk } from "./runsValidateStages.js";
|
|
@@ -29,6 +31,8 @@ import { loadEndpointConfig } from "@melite/comfyui-cordis";
|
|
|
29
31
|
import { fetchEngineMem, filmLoadOf, filmMemoryWarn } from "./filmMemoryWarn.js";
|
|
30
32
|
import { searchedVoice } from "./rootsManifest.js";
|
|
31
33
|
import { newRunId, outRootFor, pipelineOf, strictBodyCheck, planResurrect, bootSweep, appendLedger, refusal, walkSubmitEnvelope } from "./queue.js";
|
|
34
|
+
import { graphReceiptOf, graphReceiptStageOf } from "./queueSidecar.js";
|
|
35
|
+
import { sweepRunIds } from "./queueCore.js";
|
|
32
36
|
import { cardRefusal, toRemoteError, refusePreview } from "./runsRefusalVoices.js";
|
|
33
37
|
import { lifecycleInFlight } from "./lifecycleLatch.js";
|
|
34
38
|
import { lanePresenceRefusal } from "./cardsLanes.js";
|
|
@@ -37,12 +41,13 @@ import { coerceSnapshotBody } from "./runsValidateStages.js";
|
|
|
37
41
|
import { applyFlowParamsOverride, overlayDecls } from "./flowsParamsOverlay.js";
|
|
38
42
|
export { toRemoteError } from "./runsRefusalVoices.js";
|
|
39
43
|
import { readFileSync } from "node:fs";
|
|
40
|
-
import { CardArmError, } from "./cardsRegistry.js";
|
|
44
|
+
import { CARD_ENVELOPE_KEYS, CardArmError, liftCardParams, } from "./cardsRegistry.js";
|
|
41
45
|
import { FLOW_ID_RE } from "./runsGates.js";
|
|
42
46
|
import { compileFlowInline, registerCompiledRun, selectSubmitDoor, } from "./runsStart.js";
|
|
47
|
+
import { expandSeedSweep } from "./queueSubmit.js";
|
|
43
48
|
import { listRunsAcross, parseIntOrNull } from "./runsList.js";
|
|
44
49
|
import { claimPersist, errText, runLogTail, settlePersist, RUN_STATUSES, } from "./runsTypes.js";
|
|
45
|
-
import { runOne, runEngine as runEngineOf } from "./runsExecute.js";
|
|
50
|
+
import { runOne, runEngine as runEngineOf, stampUnansweredRows } from "./runsExecute.js";
|
|
46
51
|
import { engineFilmName } from "./filmLead.js";
|
|
47
52
|
import { validate as validateArm, modelValidateArm } from "./runsValidateArms.js";
|
|
48
53
|
import { BENCH_DRAFT_PREFIX_RE, benchDraftIdOf } from '@melite/contracts/benchStage';
|
|
@@ -62,11 +67,33 @@ export function enrichDiskRow(row) {
|
|
|
62
67
|
const artifacts = Array.isArray(row['artifacts'])
|
|
63
68
|
? row['artifacts'].filter((value) => typeof value === 'string' && value !== '')
|
|
64
69
|
: [];
|
|
70
|
+
|
|
71
|
+
// the sidecar persists the identity stamp as bench_stage_id (snake,
|
|
72
|
+
// queueSidecar.ts); the wire contract is benchStageId (camel,
|
|
73
|
+
// melite-run-wire) — served verbatim, the disk-served rows carried
|
|
74
|
+
// a stamp the client join could never read, and the history reload
|
|
75
|
+
// (the operator's own burn) fell to the positional tier for every
|
|
76
|
+
// stamped run. Map at the SERVE door: the wire speaks one spelling;
|
|
77
|
+
// the disk format never changes under stored rows (the sidecar's
|
|
78
|
+
// own readers keep the snake field, served additively).
|
|
79
|
+
let stamped = false;
|
|
80
|
+
const wireStages = stages.map((stage) => {
|
|
81
|
+
if (stage === null || typeof stage !== 'object' || Array.isArray(stage))
|
|
82
|
+
return stage;
|
|
83
|
+
const current = stage;
|
|
84
|
+
if (typeof current['benchStageId'] === 'string' && current['benchStageId'] !== '')
|
|
85
|
+
return stage;
|
|
86
|
+
if (typeof current['bench_stage_id'] !== 'string' || current['bench_stage_id'] === '')
|
|
87
|
+
return stage;
|
|
88
|
+
stamped = true;
|
|
89
|
+
return { ...current, benchStageId: current['bench_stage_id'] };
|
|
90
|
+
});
|
|
91
|
+
const stampedRow = stamped ? { ...row, stages: wireStages } : row;
|
|
65
92
|
if (stages.length !== 1 || artifacts.length === 0)
|
|
66
|
-
return
|
|
67
|
-
const stage =
|
|
93
|
+
return stampedRow;
|
|
94
|
+
const stage = wireStages[0];
|
|
68
95
|
if (stage === null || typeof stage !== 'object' || Array.isArray(stage))
|
|
69
|
-
return
|
|
96
|
+
return stampedRow;
|
|
70
97
|
const runId = typeof row['run_id'] === 'string' ? row['run_id'] : '';
|
|
71
98
|
const relative = (value) => {
|
|
72
99
|
const marker = `/${runId}/`;
|
|
@@ -88,8 +115,14 @@ export function enrichDiskRow(row) {
|
|
|
88
115
|
const names = [...new Set(artifacts.map(relative))]
|
|
89
116
|
.filter((name) => !isEstateSidecarName(name))
|
|
90
117
|
.filter((name) => mediaKindOf(name) !== undefined);
|
|
118
|
+
|
|
119
|
+
// this zero-names exit once returned the ORIGINAL row — silently
|
|
120
|
+
// discarding the adapter's own mapping when the lone stamped
|
|
121
|
+
// stage's artifacts all filter out (sidecar names, non-vocab
|
|
122
|
+
// extensions). Every exit serves stampedRow; the stamp never
|
|
123
|
+
// rides on the hero path's coat-tails.
|
|
91
124
|
if (names.length === 0)
|
|
92
|
-
return
|
|
125
|
+
return stampedRow;
|
|
93
126
|
const hero = engineFilmName(names) ?? names[0];
|
|
94
127
|
const current = stage;
|
|
95
128
|
return {
|
|
@@ -256,6 +289,11 @@ function curatedBenchLog(stageCount) {
|
|
|
256
289
|
console.log("[runs] bench run admitted — " + String(stageCount) +
|
|
257
290
|
" composed stage(s) with their FromStage links riding as stage inputs");
|
|
258
291
|
}
|
|
292
|
+
/** The estate run-id grammar (queueCore's newRunId mint:
|
|
293
|
+
* run-<12hex>-<8hex>, plus the seed sweep's `-s<k>` family seat).
|
|
294
|
+
* The upscale door's ONLY registry-resolving spelling — every other
|
|
295
|
+
* chain_run value is a store name and passes untouched. */
|
|
296
|
+
const ESTATE_RUN_ID_RE = /^run-[0-9a-f]+(?:-[0-9a-f]+)*(?:-s\d+)?$/;
|
|
259
297
|
/** The card plane's engine is the CONTRACT's (benchStage.ts) — the
|
|
260
298
|
* bench is the card bench, and that is where it is stated. This arm
|
|
261
299
|
* applies it to a flow document's card= rows only: an mcp/flow
|
|
@@ -538,7 +576,7 @@ export class RunsRuntimeService extends Service {
|
|
|
538
576
|
/* v8 ignore next -- planResurrect admits only string sidecar
|
|
539
577
|
* draft_ids (durableRecordUsable's gate); the non-string arm
|
|
540
578
|
* is torn-state defense, unreachable in sequence. */
|
|
541
|
-
draftId: typeof pre["draft_id"] === "string" ? pre["draft_id"] : "",
|
|
579
|
+
draftId: draftIdOf(typeof pre["draft_id"] === "string" ? pre["draft_id"] : ""),
|
|
542
580
|
dir,
|
|
543
581
|
testFlag: false,
|
|
544
582
|
stopFlag: false,
|
|
@@ -585,19 +623,46 @@ export class RunsRuntimeService extends Service {
|
|
|
585
623
|
|
|
586
624
|
|
|
587
625
|
|
|
588
|
-
famsOut
|
|
626
|
+
famsOut,
|
|
627
|
+
/** THE GRAPH-RECEIPT LEDGER (the silent UI-drop purge's P1):
|
|
628
|
+
* the composed stage's queue-time doc→graph evidence lands
|
|
629
|
+
* here, keyed by stage id (the per-stage rows inside the
|
|
630
|
+
* run-level `graph_receipt`). The receipt judges the row's OWN
|
|
631
|
+
* `params` (the doc verbatim, pre-stamp) against the composed
|
|
632
|
+
* graph. The stage row itself stays schema-clean (extra=forbid
|
|
633
|
+
* at the wire door) — same law as the fams ledger. */
|
|
634
|
+
receiptsOut) {
|
|
589
635
|
const cards = this.ctx.cardRegistry;
|
|
590
636
|
const params = (typeof row["params"] === "object" && row["params"] !== null && !Array.isArray(row["params"]))
|
|
591
637
|
? { ...row["params"] }
|
|
592
638
|
: {};
|
|
639
|
+
|
|
640
|
+
// stage-policy keys (comfyui-merge.ts STAGE_RESERVED_PARAMS — the
|
|
641
|
+
// unload boundary's knob, the merged VRAM budget) live on the
|
|
642
|
+
// STAGE row, not the card surface. Admission stays the declared
|
|
643
|
+
// CARD law, so the reserved keys are lifted OUT of the compose
|
|
644
|
+
// walk here (phase 1 would refuse them as undeclared card params —
|
|
645
|
+
// the live P7 press's refusal) and carried back onto the COMPOSED
|
|
646
|
+
// row's params additively, so planMerge's paramsByStage reads the
|
|
647
|
+
// bag the bench stored. The copy above keeps the original row
|
|
648
|
+
// untouched; the graph receipt below still judges the doc
|
|
649
|
+
// verbatim.
|
|
650
|
+
const reserved = {};
|
|
651
|
+
for (const k of STAGE_RESERVED_PARAMS) {
|
|
652
|
+
if (params[k] !== undefined) {
|
|
653
|
+
reserved[k] = params[k];
|
|
654
|
+
delete params[k];
|
|
655
|
+
}
|
|
656
|
+
}
|
|
593
657
|
const card = String(row["card"] ?? "");
|
|
594
658
|
// STROKE 3'S FALLBACK (the validate walk's own shape —
|
|
595
659
|
// runsValidateArms: a family-less card stage composes by its OWN
|
|
596
660
|
// card id — mid alone, never an injected body.model, which would
|
|
597
661
|
// hit the board check before prepareCardParams resolved the
|
|
598
662
|
// card-unit arm). The old `?? ""` handed prepareCardParams an
|
|
599
|
-
// empty mid — "model id \"\" is not a legal identifier" on
|
|
600
|
-
//
|
|
663
|
+
// empty mid — "model id \"\" is not a legal identifier" on a
|
|
664
|
+
// family-less flow stage's card hop (the af-move commission's
|
|
665
|
+
|
|
601
666
|
|
|
602
667
|
|
|
603
668
|
// effective routing key rode an EXPLICIT spelling — params.model
|
|
@@ -615,11 +680,64 @@ export class RunsRuntimeService extends Service {
|
|
|
615
680
|
const mid = String(params["model"] ?? service ?? card);
|
|
616
681
|
if (params["model"] === undefined && service !== undefined)
|
|
617
682
|
params["model"] = service;
|
|
683
|
+
|
|
684
|
+
// the row's params resolves at the merge against the row's own inputs
|
|
685
|
+
// edges — FromStage links and initial bindings ride the composed row
|
|
686
|
+
// verbatim into the merge's inputNames — so a spell naming NO wired
|
|
687
|
+
// input is a promise this seat cannot keep. Composing it verbatim let
|
|
688
|
+
// a card guard misdiagnose it (h3's stated-variant voice for an
|
|
689
|
+
// unwired image) or the merge refuse it with a stranger's voice. THE
|
|
690
|
+
// DOOR COVERS WHAT THE RUN WILL DO (the flow_inline SPELL GATE's own
|
|
691
|
+
// law, runsStart.ts): refuse here, in the seat's voice, naming the
|
|
692
|
+
// spell and the fix. The exempt set IS the downstream gate's (the
|
|
693
|
+
// inputs bag's keys — every binding shape the merge reads) — a wired
|
|
694
|
+
// spell still rides for the merged worker to resolve, so no legal run
|
|
695
|
+
// changes verdict; only the seat of the refusal moves earlier.
|
|
696
|
+
const wiredInputs = new Set(typeof row["inputs"] === "object" && row["inputs"] !== null && !Array.isArray(row["inputs"])
|
|
697
|
+
? Object.keys(row["inputs"])
|
|
698
|
+
: []);
|
|
699
|
+
const ghosts = [];
|
|
700
|
+
const sweepSpell = (v) => {
|
|
701
|
+
if (typeof v === "string") {
|
|
702
|
+
if (v.startsWith("$") && v.length > 1 && !wiredInputs.has(v.slice(1)))
|
|
703
|
+
ghosts.push(v);
|
|
704
|
+
}
|
|
705
|
+
else if (Array.isArray(v)) {
|
|
706
|
+
for (const x of v)
|
|
707
|
+
sweepSpell(x);
|
|
708
|
+
}
|
|
709
|
+
else if (typeof v === "object" && v !== null) {
|
|
710
|
+
for (const x of Object.values(v))
|
|
711
|
+
sweepSpell(x);
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
sweepSpell(params);
|
|
715
|
+
if (ghosts.length > 0) {
|
|
716
|
+
throw new RemoteError("runs/invalid-request", label + JSON.stringify(id) + ": params carry " +
|
|
717
|
+
JSON.stringify([...new Set(ghosts)].sort()) +
|
|
718
|
+
" but the stage wires no input of that name — the merge would refuse it at run time. " +
|
|
719
|
+
"Wire the input (an inputs edge from a prior stage, or an initial binding) or replace the $spell with a concrete value.", { loc: "stages" });
|
|
720
|
+
}
|
|
721
|
+
// THE INITIAL-TENSOR REFUSAL (the initial-grammar law, audit
|
|
722
|
+
|
|
723
|
+
// composed graph — the seat a spell lands in is only visible
|
|
724
|
+
// there. See the gate below the phase try/catch.
|
|
618
725
|
let p1;
|
|
619
726
|
let composed;
|
|
620
727
|
try {
|
|
621
728
|
p1 = await cards.phase1Card({ ...params, card }, mid);
|
|
622
729
|
composed = await cards.phase2Card(p1, runId);
|
|
730
|
+
// THE GRAPH RECEIPT (the silent UI-drop purge's P1): the
|
|
731
|
+
// stage's compose just landed — receipt the doc (the row's
|
|
732
|
+
// OWN params, verbatim: the routing-key stamp above rides
|
|
733
|
+
// only the compose copy, never the judged doc) against the
|
|
734
|
+
// composed graph. EVIDENCE, never a refusal.
|
|
735
|
+
if (receiptsOut !== undefined) {
|
|
736
|
+
const docParams = typeof row["params"] === "object" && row["params"] !== null && !Array.isArray(row["params"])
|
|
737
|
+
? row["params"]
|
|
738
|
+
: {};
|
|
739
|
+
receiptsOut[id] = graphReceiptStageOf(id, graphReceiptOf(docParams, { workflow: composed.graph }));
|
|
740
|
+
}
|
|
623
741
|
}
|
|
624
742
|
catch (e) {
|
|
625
743
|
if (e instanceof CardArmError) {
|
|
@@ -654,20 +772,100 @@ export class RunsRuntimeService extends Service {
|
|
|
654
772
|
}
|
|
655
773
|
throw e;
|
|
656
774
|
}
|
|
657
|
-
|
|
775
|
+
// THE INITIAL-TENSOR REFUSAL (the initial-grammar law, audit
|
|
776
|
+
|
|
777
|
+
// resolves at the merge to the initial's VALUE — legal on a
|
|
778
|
+
// value seat (a STRING/INT/FLOAT dial) or a Load* file slot, a
|
|
779
|
+
// BURN on a tensor slot (the F48 voices→ref_audios class: the
|
|
780
|
+
// node received a string where the engine wants a link —
|
|
781
|
+
// TypeError at run time, after the kind gate stayed green). The
|
|
782
|
+
// SEAT is only visible in the composed graph, so the gate rides
|
|
783
|
+
// after phase2, judging every initial-bound spell against the
|
|
784
|
+
// engine's own served slot types (the live /object_info census —
|
|
785
|
+
// the same table the pack gate refuses closed on). This is the
|
|
786
|
+
// mirror of the merge's ROW-4 file-slot gate
|
|
787
|
+
// (comfyui-merge.ts): ROW-4 refuses a producer LINK in a Load*
|
|
788
|
+
// slot; this refuses an initial VALUE in a tensor slot. The
|
|
789
|
+
// media KIND cannot judge this — rig's mesh_glb is a "mesh"
|
|
790
|
+
// port that legally takes an initial $glb (a LoadGLB path seat;
|
|
791
|
+
// the rig card's auto lane runs green) while upscale's
|
|
792
|
+
// input_image tensor seat refuses the same shape.
|
|
793
|
+
{
|
|
794
|
+
const census = cards.objectInfo();
|
|
795
|
+
if (census !== null) {
|
|
796
|
+
const initialBound = new Set();
|
|
797
|
+
if (typeof row["inputs"] === "object" && row["inputs"] !== null && !Array.isArray(row["inputs"])) {
|
|
798
|
+
for (const [wire, edge] of Object.entries(row["inputs"])) {
|
|
799
|
+
if (typeof edge === "object" && edge !== null && !Array.isArray(edge) &&
|
|
800
|
+
typeof edge["initial"] === "string") {
|
|
801
|
+
initialBound.add(wire);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
if (initialBound.size > 0) {
|
|
806
|
+
const VALUE_SLOT_TYPES = new Set(["STRING", "INT", "FLOAT", "BOOLEAN"]);
|
|
807
|
+
const wf = (composed.graph ?? {});
|
|
808
|
+
for (const node of Object.values(wf)) {
|
|
809
|
+
const cls = String(node["class_type"] ?? "");
|
|
810
|
+
if (cls.startsWith("Load"))
|
|
811
|
+
continue;
|
|
812
|
+
const info = census[cls]?.input;
|
|
813
|
+
const ins = node["inputs"];
|
|
814
|
+
if (typeof ins !== "object" || ins === null || Array.isArray(ins))
|
|
815
|
+
continue;
|
|
816
|
+
for (const [slot, val] of Object.entries(ins)) {
|
|
817
|
+
if (typeof val !== "string" || !val.startsWith("$") || val.length < 2)
|
|
818
|
+
continue;
|
|
819
|
+
if (!initialBound.has(val.slice(1)))
|
|
820
|
+
continue;
|
|
821
|
+
const decl = info?.required?.[slot] ?? info?.optional?.[slot];
|
|
822
|
+
// a type tuple ["IMAGE", {…}] declares its slot type; a
|
|
823
|
+
// combo list (nested array) or an absent entry takes a
|
|
824
|
+
// value by construction — never refused here. A "*"
|
|
825
|
+
// wildcard is a LINK seat the node's own code types
|
|
826
|
+
// (the reference bundle's inputs) — an initial VALUE
|
|
827
|
+
// there is the F48 burn class, so it refuses too.
|
|
828
|
+
const slotType = Array.isArray(decl) && typeof decl[0] === "string" ? decl[0] : null;
|
|
829
|
+
if (slotType === null || VALUE_SLOT_TYPES.has(slotType))
|
|
830
|
+
continue;
|
|
831
|
+
throw new RemoteError("runs/invalid-request", label + JSON.stringify(id) + ": node " + JSON.stringify(cls) +
|
|
832
|
+
" input " + JSON.stringify(slot) + " carries " + val +
|
|
833
|
+
" but input " + JSON.stringify(val.slice(1)) +
|
|
834
|
+
" is an initial binding — the initial's VALUE would land in the engine's " +
|
|
835
|
+
JSON.stringify(slotType) + " slot, which wants a link (a tensor seat needs a producer). " +
|
|
836
|
+
"Wire the input from a prior stage's output, or feed the file through the card's own loader param.", { loc: "stages" });
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
const rowOutputs = (typeof row["outputs"] === "object" && row["outputs"] !== null && !Array.isArray(row["outputs"])
|
|
658
843
|
&& Object.keys(row["outputs"]).length > 0)
|
|
659
844
|
? { ...row["outputs"] }
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
845
|
+
: undefined;
|
|
846
|
+
const rowCardIo = (typeof row["card_io"] === "object" && row["card_io"] !== null && !Array.isArray(row["card_io"])
|
|
847
|
+
&& Object.keys(row["card_io"]).length > 0)
|
|
848
|
+
? { ...row["card_io"] }
|
|
849
|
+
: undefined;
|
|
850
|
+
const composedOuts = (typeof composed.outputs === "object" && composed.outputs !== null
|
|
851
|
+
&& Object.keys(composed.outputs).length > 0)
|
|
852
|
+
? { ...composed.outputs }
|
|
853
|
+
: undefined;
|
|
854
|
+
const cardDeclaredOuts = cards.defsSync().get(card)?.flowKinds?.outputs;
|
|
855
|
+
const cardDeclared = (typeof cardDeclaredOuts === "object" && cardDeclaredOuts !== null
|
|
856
|
+
&& Object.keys(cardDeclaredOuts).length > 0)
|
|
857
|
+
? { ...cardDeclaredOuts }
|
|
858
|
+
: undefined;
|
|
859
|
+
const stageOutputs =
|
|
860
|
+
|
|
861
|
+
// they carry channels (the work audit's R1 — preserved: a
|
|
862
|
+
// regression the card-ports law introduced here), then the
|
|
863
|
+
// compose's own ports (the card's bindings, the mask-produce
|
|
864
|
+
// law's seat), then the row's declared cardIo table, then the
|
|
865
|
+
// card's declared output kinds. An EMPTY channel map means
|
|
866
|
+
// "undeclared" at every leg — the start door refuses it loud
|
|
867
|
+
// (never a fabricated {default: <engine kind>}).
|
|
868
|
+
rowOutputs ?? composedOuts ?? rowCardIo ?? cardDeclared ?? {};
|
|
671
869
|
// THE OUTPUT RENAME FOLLOWS THE BINDINGS (the run-9f8bd60f8cb8
|
|
672
870
|
|
|
673
871
|
// channels (outputs {body: "mesh"} over the card's own
|
|
@@ -716,12 +914,15 @@ export class RunsRuntimeService extends Service {
|
|
|
716
914
|
params: {
|
|
717
915
|
workflow: composed.graph,
|
|
718
916
|
output_nodes: (renamedAny ? renamedNodes : cardNodes),
|
|
917
|
+
// THE STAGE-RESERVED CARRY (F-C): the merge plane's own keys
|
|
918
|
+
// ride beside the composed graph — additive, never a card key.
|
|
919
|
+
...reserved,
|
|
719
920
|
},
|
|
720
921
|
|
|
721
922
|
// `expected` for its kindsOk walk and defaults an absent bag to
|
|
722
923
|
// {} — so a composed stage that dropped it would compile with NO
|
|
723
924
|
// kind assertion on its own inputs. The registry rows declare
|
|
724
|
-
// them (
|
|
925
|
+
// them (anny-hmr-estimator: { photo: "photo" }), and the check is
|
|
725
926
|
// theirs, not the composer's to discard.
|
|
726
927
|
//
|
|
727
928
|
|
|
@@ -761,26 +962,36 @@ export class RunsRuntimeService extends Service {
|
|
|
761
962
|
|
|
762
963
|
|
|
763
964
|
|
|
965
|
+
|
|
764
966
|
async composeRegistryFlowStages(inlineDoc, runId,
|
|
765
967
|
|
|
766
968
|
|
|
767
|
-
stageFams
|
|
969
|
+
stageFams,
|
|
970
|
+
/** THE GRAPH-RECEIPT LEDGER (P1): filled with {stageId: row}
|
|
971
|
+
* for every composed card stage (composeCardStageRow's seat). */
|
|
972
|
+
receiptsOut) {
|
|
973
|
+
// registryFlowToInline always projects an array of object rows
|
|
974
|
+
// and the raw door's junkFree gate admits only arrays of object
|
|
975
|
+
// rows — the non-array fallback never fires (the bench twin's
|
|
976
|
+
// own pruned dead leg, composeBenchStages). The assertion names
|
|
977
|
+
// the callers' guaranteed shape, never unknown (the sniff wall
|
|
978
|
+
// counts as-unknown sites against the baseline).
|
|
768
979
|
const rows = inlineDoc["stages"];
|
|
769
|
-
// registryFlowToInline always projects an array of object rows, so
|
|
770
|
-
// the non-array answer needs no second shape (the compile-time
|
|
771
|
-
// gate below judges the same value).
|
|
772
|
-
if (!Array.isArray(rows))
|
|
773
|
-
return inlineDoc;
|
|
774
980
|
const out = [];
|
|
775
981
|
for (const [i, st] of rows.entries()) {
|
|
776
|
-
|
|
982
|
+
const item = st;
|
|
983
|
+
/* v8 ignore next -- both callers guarantee object rows (the
|
|
984
|
+
* projection above, the raw door's junkFree gate), so the junk
|
|
985
|
+
* skip never fires here — the walk's belt for a caller that
|
|
986
|
+
* skips the gates. */
|
|
987
|
+
if (typeof item !== "object" || item === null)
|
|
777
988
|
continue;
|
|
778
|
-
const row =
|
|
989
|
+
const row = item;
|
|
779
990
|
const card = typeof row["card"] === "string" ? row["card"] : "";
|
|
780
991
|
const id = typeof row["id"] === "string" && row["id"] !== "" ? row["id"] : "s_" + String(i);
|
|
781
992
|
out.push(card === ""
|
|
782
993
|
? { ...row }
|
|
783
|
-
: await this.composeCardStageRow(row, id, runId, "flow stage ", stageFams));
|
|
994
|
+
: await this.composeCardStageRow(row, id, runId, "flow stage ", stageFams, receiptsOut));
|
|
784
995
|
}
|
|
785
996
|
return { ...inlineDoc, stages: out };
|
|
786
997
|
}
|
|
@@ -790,7 +1001,10 @@ export class RunsRuntimeService extends Service {
|
|
|
790
1001
|
|
|
791
1002
|
|
|
792
1003
|
|
|
793
|
-
famsOut
|
|
1004
|
+
famsOut,
|
|
1005
|
+
/** THE GRAPH-RECEIPT LEDGER (P1): filled with {stageId: row}
|
|
1006
|
+
* for every composed card stage (composeCardStageRow's seat). */
|
|
1007
|
+
receiptsOut) {
|
|
794
1008
|
// the sole caller arrives gated on benchWiring(...).cross being
|
|
795
1009
|
// non-empty, and benchWiring answers [] unless stages is an
|
|
796
1010
|
// array — the non-array fallback here was a dead leg, pruned
|
|
@@ -800,6 +1014,12 @@ export class RunsRuntimeService extends Service {
|
|
|
800
1014
|
if (typeof st !== "object" || st === null)
|
|
801
1015
|
continue;
|
|
802
1016
|
const row = st;
|
|
1017
|
+
|
|
1018
|
+
// archived composes nowhere — the row keeps its provenance on
|
|
1019
|
+
// the bench, the run leaves it out (the friction burn: spent
|
|
1020
|
+
// stages re-ran ahead of newer stages, blocking the queue).
|
|
1021
|
+
if (row["archived"] === true)
|
|
1022
|
+
continue;
|
|
803
1023
|
const id = typeof row["id"] === "string" && row["id"] !== "" ? row["id"] : "s_" + String(i);
|
|
804
1024
|
// A STAGE WITH NO CARD (an mcp/flow row) composes nowhere here
|
|
805
1025
|
// — the bench run is the CARD bench; a foreign stage is named
|
|
@@ -808,7 +1028,7 @@ export class RunsRuntimeService extends Service {
|
|
|
808
1028
|
throw new RemoteError("runs/invalid-request", "bench stage " + JSON.stringify(id) +
|
|
809
1029
|
" names no card — the bench run composes card stages; an mcp/flow stage belongs in a flow, not the bench", { loc: "stages" });
|
|
810
1030
|
}
|
|
811
|
-
out.push(await this.composeCardStageRow(row, id, runId, "bench stage ", famsOut));
|
|
1031
|
+
out.push(await this.composeCardStageRow(row, id, runId, "bench stage ", famsOut, receiptsOut));
|
|
812
1032
|
}
|
|
813
1033
|
/* v8 ignore next 4 -- this bench is only composed when
|
|
814
1034
|
* benchWiring found a CROSS wire, and benchWiring reaches wires
|
|
@@ -826,6 +1046,55 @@ export class RunsRuntimeService extends Service {
|
|
|
826
1046
|
* run id when replaying its _request.json — the remote surface
|
|
827
1047
|
* never passes this (two-arg wire calls only). */
|
|
828
1048
|
reuse) {
|
|
1049
|
+
try {
|
|
1050
|
+
return await this.startInner(doc, signal, reuse);
|
|
1051
|
+
}
|
|
1052
|
+
catch (error) {
|
|
1053
|
+
this.ledgerPressRefused(doc, error, reuse);
|
|
1054
|
+
throw error;
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
|
|
1060
|
+
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
ledgerPressRefused(doc, error, reuse) {
|
|
1077
|
+
try {
|
|
1078
|
+
const stateRoot = this.ctx.queue.stateRoot;
|
|
1079
|
+
const remote = remoteErrorOf(error);
|
|
1080
|
+
const body = JSON.stringify(doc) ?? "unserializable";
|
|
1081
|
+
const CAPPED = 4000;
|
|
1082
|
+
appendLedger(stateRoot, "press.refused", {
|
|
1083
|
+
code: remote?.code ?? "throw",
|
|
1084
|
+
voice: errText(error).slice(0, 400),
|
|
1085
|
+
draft_id: typeof doc === "object" && doc !== null
|
|
1086
|
+
? (doc["draft_id"] ?? null)
|
|
1087
|
+
: null,
|
|
1088
|
+
...(reuse !== undefined ? { replay_of: reuse.runId } : {}),
|
|
1089
|
+
request: body.length > CAPPED ? body.slice(0, CAPPED) + "…+trunc" : body,
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
catch {
|
|
1093
|
+
/* the echo never replaces the refusal (appendLedger already
|
|
1094
|
+
* self-swallows I/O; this guards the stateRoot read itself) */
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
async startInner(doc, signal, reuse) {
|
|
829
1098
|
signal.throwIfAborted();
|
|
830
1099
|
// The pre-registration chain, order (queue.ts's envelope
|
|
831
1100
|
// walk with the draft probe handed in): non-object, test-bool,
|
|
@@ -862,6 +1131,22 @@ export class RunsRuntimeService extends Service {
|
|
|
862
1131
|
if (lifecycleHeld !== null) {
|
|
863
1132
|
throw toRemoteError(refusal(409, "refused: lifecycle " + lifecycleHeld + " in flight — retry the press when it settles (the teardown holds the run gate until it completes)", "lifecycle_inflight"));
|
|
864
1133
|
}
|
|
1134
|
+
// THE SEED-SWEEP EXPANSION (friction #9, the melite friction
|
|
1135
|
+
|
|
1136
|
+
// roll was a separate press + status + view cycle, and ~5 of 7
|
|
1137
|
+
// generation rounds were seed iterations): a {model:} card body
|
|
1138
|
+
// may carry `seeds: [...]` — the press fans out to ONE run per
|
|
1139
|
+
// seed under one shared run-id prefix, the same card and params
|
|
1140
|
+
// with the seed alone varying. Judged BEFORE the press laws
|
|
1141
|
+
// (a malformed sweep mints nothing); the fan-out itself rides
|
|
1142
|
+
// startSweep, which wraps the whole family in the same replay /
|
|
1143
|
+
// reservation laws a single press holds.
|
|
1144
|
+
const sweep = expandSeedSweep(checked.body);
|
|
1145
|
+
if (sweep.kind === "refusal")
|
|
1146
|
+
throw toRemoteError(sweep.refusal);
|
|
1147
|
+
if (sweep.kind === "sweep") {
|
|
1148
|
+
return await this.startSweep(sweep.seeds, checked, signal);
|
|
1149
|
+
}
|
|
865
1150
|
|
|
866
1151
|
// answered names a run that exists — return ITS summary, mint
|
|
867
1152
|
// nothing, enqueue nothing. The row is gone (swept, or its seat
|
|
@@ -900,6 +1185,121 @@ export class RunsRuntimeService extends Service {
|
|
|
900
1185
|
}
|
|
901
1186
|
return this.startReserved(undefined, checked, signal, reuse);
|
|
902
1187
|
}
|
|
1188
|
+
/** THE SWEEP START (friction #9's fan-out): one press, N seeds —
|
|
1189
|
+
* each seed its own run, all under one shared run-id prefix.
|
|
1190
|
+
* Every per-run law rides startReserved unchanged (phase gates,
|
|
1191
|
+
* spell gate, self-wire gate, the registration door); the press
|
|
1192
|
+
* laws wrap the WHOLE family: one press_key answers the sweep
|
|
1193
|
+
* (a replay re-mints NOTHING — the sweep mirror holds every id),
|
|
1194
|
+
* the twin reservation settles once after the last run registers,
|
|
1195
|
+
* and a refusal anywhere propagates with the runs already minted
|
|
1196
|
+
* standing (registered runs never un-register — the registry's
|
|
1197
|
+
* own law; the retry law is the stale-key law's).
|
|
1198
|
+
* @param seeds the judged sweep (capped, integer, model-door).
|
|
1199
|
+
* @param checked the envelope's ok face for the sweep press.
|
|
1200
|
+
* @param signal the caller's abort. */
|
|
1201
|
+
async startSweep(seeds, checked, signal) {
|
|
1202
|
+
signal.throwIfAborted();
|
|
1203
|
+
const pressKey = typeof checked.body["press_key"] === "string"
|
|
1204
|
+
? checked.body["press_key"]
|
|
1205
|
+
: undefined;
|
|
1206
|
+
if (pressKey === undefined)
|
|
1207
|
+
return await this.mintSweep(seeds, checked, signal, undefined);
|
|
1208
|
+
const replay = this.sweepReplay(pressKey);
|
|
1209
|
+
if (replay !== null)
|
|
1210
|
+
return replay;
|
|
1211
|
+
// THE CONCURRENT-PRESS RESERVATION, sweep-shaped (the double-mint
|
|
1212
|
+
// cure's law): the reservation goes in SYNCHRONOUSLY after the
|
|
1213
|
+
// miss, exactly one caller becomes the minter, and the twin
|
|
1214
|
+
// answers the family's summary.
|
|
1215
|
+
const twin = this.reservePress(pressKey);
|
|
1216
|
+
if (twin !== null)
|
|
1217
|
+
return await this.awaitTwin(twin, signal);
|
|
1218
|
+
try {
|
|
1219
|
+
const summary = await this.mintSweep(seeds, checked, signal, pressKey);
|
|
1220
|
+
this.resolvePress(pressKey, summary);
|
|
1221
|
+
return summary;
|
|
1222
|
+
}
|
|
1223
|
+
catch (error) {
|
|
1224
|
+
this.failPress(pressKey, error);
|
|
1225
|
+
throw error;
|
|
1226
|
+
}
|
|
1227
|
+
finally {
|
|
1228
|
+
this.pendingPresses.delete(pressKey);
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
/** The sweep's mint loop: N startReserved calls, one per seed —
|
|
1232
|
+
* the seed stamped into its own body, the sweep's runId handed
|
|
1233
|
+
* through the INTERNAL reuse seat (the deterministic-id seam, the
|
|
1234
|
+
* same seat the boot-resurrect replay rides). The answer carries
|
|
1235
|
+
* the first run's summary face plus sweep_runs (every id, seed
|
|
1236
|
+
* order). @param pressKey undefined on the inner calls — the
|
|
1237
|
+
* per-run press memory would clobber the family's one entry; this
|
|
1238
|
+
* loop owns the memory after every run stands. */
|
|
1239
|
+
async mintSweep(seeds, checked, signal, pressKey) {
|
|
1240
|
+
const runIds = sweepRunIds(seeds.length);
|
|
1241
|
+
const summaries = [];
|
|
1242
|
+
for (const [k, seed] of seeds.entries()) {
|
|
1243
|
+
const bodyK = { ...checked.body, seed };
|
|
1244
|
+
delete bodyK["seeds"];
|
|
1245
|
+
summaries.push(await this.startReserved(undefined, { ...checked, body: bodyK }, signal, { runId: runIds[k] }));
|
|
1246
|
+
}
|
|
1247
|
+
const first = summaries[0];
|
|
1248
|
+
const sweepRunList = summaries.map((s) => s.run_id);
|
|
1249
|
+
const sweepSummary = {
|
|
1250
|
+
run_id: first.run_id,
|
|
1251
|
+
status: first.status,
|
|
1252
|
+
queue_position: first.queue_position,
|
|
1253
|
+
sweep_runs: sweepRunList,
|
|
1254
|
+
};
|
|
1255
|
+
if (pressKey !== undefined) {
|
|
1256
|
+
// the family's one memory entry: the single mirror holds the
|
|
1257
|
+
// first id (the answer's run_id), the sweep mirror holds all
|
|
1258
|
+
this.rememberPress(pressKey, runIds[0]);
|
|
1259
|
+
this.rememberSweepPress(pressKey, sweepRunList);
|
|
1260
|
+
}
|
|
1261
|
+
return sweepSummary;
|
|
1262
|
+
}
|
|
1263
|
+
/** THE SWEEP MIRROR (audit N-E1's sweep half): press_key -> every
|
|
1264
|
+
* run id the sweep minted. A replay answers the family only while
|
|
1265
|
+
* EVERY row still stands — one swept row is the stale-key law's
|
|
1266
|
+
* (the whole sweep re-runs on retry, the same class as the single
|
|
1267
|
+
* door). Capped beside the single mirror. */
|
|
1268
|
+
sweepPresses = new Map();
|
|
1269
|
+
rememberSweepPress(pressKey, runIds) {
|
|
1270
|
+
this.sweepPresses.delete(pressKey); // refresh recency before the cap read
|
|
1271
|
+
this.sweepPresses.set(pressKey, runIds);
|
|
1272
|
+
while (this.sweepPresses.size > RunsRuntimeService.PRESS_MEMORY_MAX) {
|
|
1273
|
+
const oldest = this.sweepPresses.keys().next();
|
|
1274
|
+
/* v8 ignore next -- the map holds >0 entries whenever the loop
|
|
1275
|
+
* runs (size > PRESS_MEMORY_MAX > 0), so next() always yields —
|
|
1276
|
+
* the single mirror's rememberPress carries the same vacuous
|
|
1277
|
+
* guard shape unexecuted. */
|
|
1278
|
+
if (oldest.done)
|
|
1279
|
+
break;
|
|
1280
|
+
this.sweepPresses.delete(oldest.value);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
/** The sweep replay: the family's answer while every row stands,
|
|
1284
|
+
* null when the key is unknown or stale (the mirror entry dies
|
|
1285
|
+
* with the verdict). */
|
|
1286
|
+
sweepReplay(pressKey) {
|
|
1287
|
+
const ids = this.sweepPresses.get(pressKey);
|
|
1288
|
+
if (ids === undefined)
|
|
1289
|
+
return null;
|
|
1290
|
+
const rows = ids.map((id) => this.core.runs.get(id));
|
|
1291
|
+
if (rows.some((row) => row === undefined)) {
|
|
1292
|
+
this.sweepPresses.delete(pressKey);
|
|
1293
|
+
return null;
|
|
1294
|
+
}
|
|
1295
|
+
const first = rows[0];
|
|
1296
|
+
return {
|
|
1297
|
+
run_id: first.runId,
|
|
1298
|
+
status: first.status,
|
|
1299
|
+
queue_position: this.core.queuePosition(first.runId),
|
|
1300
|
+
sweep_runs: ids,
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
903
1303
|
|
|
904
1304
|
|
|
905
1305
|
|
|
@@ -950,6 +1350,11 @@ export class RunsRuntimeService extends Service {
|
|
|
950
1350
|
// bench-composed arm feed it; the single-card run alone rides
|
|
951
1351
|
// its fam key).
|
|
952
1352
|
let flowStageFams = {};
|
|
1353
|
+
// THE GRAPH-RECEIPT LEDGER (the silent UI-drop purge's P1):
|
|
1354
|
+
// start()'s arm scope owns it — the registerCompiledRun door
|
|
1355
|
+
// folds it after the arms close (bench + flow arms feed it; the
|
|
1356
|
+
// single-card run stamps its own row on its own door).
|
|
1357
|
+
let flowStageReceipts = {};
|
|
953
1358
|
// THE BENCH SNAPSHOT (stroke 45d, the operator's question: "the
|
|
954
1359
|
// FULL workflow, or just the card that ran?"): the run is born
|
|
955
1360
|
// from the bench doc (CARD BIRTH LAW — draft_id = the bench);
|
|
@@ -962,22 +1367,32 @@ export class RunsRuntimeService extends Service {
|
|
|
962
1367
|
// row says so.
|
|
963
1368
|
let benchDoc;
|
|
964
1369
|
const benchWarnings = [];
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
(
|
|
980
|
-
|
|
1370
|
+
// THE FLOW-DOC EXEMPTION'S READ GATE (flows-are-compositions
|
|
1371
|
+
// slice C): a {flow}/{flow_inline} press with no draft_id has no
|
|
1372
|
+
// bench to snapshot — skipping the read is the legal shape, not
|
|
1373
|
+
// an outage, so no warning rides (the run row is the record;
|
|
1374
|
+
// restore reconstructs from the live registry, the run-rooted
|
|
1375
|
+
// face Slice A served). A PRESENT draft_id (the materialized
|
|
1376
|
+
// bench the melite_flow press lands) snapshots exactly as the
|
|
1377
|
+
// card arm does.
|
|
1378
|
+
if (checked.draftId !== undefined) {
|
|
1379
|
+
try {
|
|
1380
|
+
// R7 CURE (round-14 race audit, LOW — the run-press live alias):
|
|
1381
|
+
// the drafts read answers the CACHED doc by reference (the
|
|
1382
|
+
// cached-object law), so composing + snapshotting from it naked
|
|
1383
|
+
// let a mutation landing between press and snapshot straddle
|
|
1384
|
+
// the two (a snapshot that was not quite a snapshot). The
|
|
1385
|
+
// press now owns a DEEP copy: what the run composes and what
|
|
1386
|
+
// the sidecar snapshots is the SAME frozen instant, no matter
|
|
1387
|
+
// what the live bench does next.
|
|
1388
|
+
benchDoc = structuredClone(await this.ctx.draftsRemote.get(checked.draftId, signal));
|
|
1389
|
+
}
|
|
1390
|
+
catch (e) {
|
|
1391
|
+
benchDoc = undefined;
|
|
1392
|
+
benchWarnings.push("bench snapshot read failed at press (" +
|
|
1393
|
+
(e instanceof Error ? e.message : String(e)) +
|
|
1394
|
+
") — only the card snapshot rode; restore reconstructs from the live bench");
|
|
1395
|
+
}
|
|
981
1396
|
}
|
|
982
1397
|
// THE ONE RUN ID, MINTED ONCE (the operator's live refusal,
|
|
983
1398
|
|
|
@@ -1021,43 +1436,99 @@ export class RunsRuntimeService extends Service {
|
|
|
1021
1436
|
// preview-scope posture — never a silent accept).
|
|
1022
1437
|
const stateRoot = this.ctx.queue.stateRoot;
|
|
1023
1438
|
|
|
1024
|
-
//
|
|
1025
|
-
|
|
1026
|
-
//
|
|
1027
|
-
//
|
|
1028
|
-
//
|
|
1029
|
-
//
|
|
1030
|
-
//
|
|
1031
|
-
//
|
|
1032
|
-
//
|
|
1033
|
-
//
|
|
1034
|
-
// the
|
|
1035
|
-
//
|
|
1036
|
-
//
|
|
1037
|
-
//
|
|
1038
|
-
// the
|
|
1039
|
-
//
|
|
1040
|
-
//
|
|
1439
|
+
// A CARD INDEPENDENTLY, OTHER CARDS RUN TOO????????") ───────────
|
|
1440
|
+
|
|
1441
|
+
// bench flow'. There is ALWAYS FromStage links. THERE IS NO
|
|
1442
|
+
// FILTER, NO BREAKAGE FROM THIS. EVER.") is honored by RESOLUTION,
|
|
1443
|
+
// never by fan-out: a single-card press composes ONE card, and the
|
|
1444
|
+
// wire rides as the CONCRETE upstream value the caller resolved
|
|
1445
|
+
// (the client's wire-resolution law, stage-run.ts: the upstream's
|
|
1446
|
+
// last result substitutes every $spell before the start — THE
|
|
1447
|
+
// PARAM IS THE WIRE). The shape this block carried until today —
|
|
1448
|
+
// restage every single-card press onto the whole-bench compose
|
|
1449
|
+
// because the bench had wires — made one per-card Run execute
|
|
1450
|
+
// EVERY card on the bench, and Run ALL amplified it N-fold (the
|
|
1451
|
+
// operator's live catch: one press, five stages composed, run
|
|
1452
|
+
// 3e4cf0680c0b). A caller that sends a raw $spell (no resolution)
|
|
1453
|
+
// hits the card door's spell gate below — a LOUD refusal naming
|
|
1454
|
+
// the spell and the fix, never a discarded wire. The bench compose
|
|
1455
|
+
// is the DRAFT door's alone: pressing the BENCH (the tool's
|
|
1456
|
+
// familyless walk, {test, draft_id} alone) still composes every
|
|
1457
|
+
// stage with the wires riding as stage inputs.
|
|
1041
1458
|
let benchComposed = false;
|
|
1042
|
-
if (
|
|
1043
|
-
benchDoc !== undefined) {
|
|
1459
|
+
if (selected.door === "draft" && benchDoc !== undefined) {
|
|
1044
1460
|
const wired = benchWiring(benchDoc);
|
|
1045
|
-
|
|
1046
|
-
//
|
|
1047
|
-
//
|
|
1048
|
-
//
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1461
|
+
|
|
1462
|
+
// "running flows that don't show up on the bench"). A body
|
|
1463
|
+
// carrying bench_stage_id names the ONE row the caller
|
|
1464
|
+
// pressed — until now this door ignored the claim and
|
|
1465
|
+
// composed the WHOLE bench into one merged run: every
|
|
1466
|
+
// sibling stage re-executed on the GPU, the run's stage
|
|
1467
|
+
// digest named every row (so a failure poisoned every
|
|
1468
|
+
// tile's last_run), and the settle mirror stamped 'stopped'
|
|
1469
|
+
// onto rows nobody pressed. The claim arm composes ONLY the
|
|
1470
|
+
// claimed row — the same ONE-PRESS ONE-CARD law the {model:}
|
|
1471
|
+
// door owns, reached from the familyless walk. The claim is
|
|
1472
|
+
// JUDGED (benchStageIdOf's membership law: a stale or
|
|
1473
|
+
// foreign id refuses loud, never a stamp on a row nobody
|
|
1474
|
+
// pressed); an archived claim refuses in the archived skip's
|
|
1475
|
+
// own voice.
|
|
1476
|
+
const claimRaw = body["bench_stage_id"];
|
|
1477
|
+
const claim = typeof claimRaw === "string" && claimRaw !== "" ? claimRaw : undefined;
|
|
1478
|
+
const benchFams = {};
|
|
1479
|
+
// THE GRAPH-RECEIPT LEDGER (P1): the bench rows' per-stage
|
|
1480
|
+
// queue-time evidence rides the same function-scope ledger
|
|
1481
|
+
// as the fams (the seat the registration door reads).
|
|
1482
|
+
const benchReceipts = {};
|
|
1483
|
+
let composed;
|
|
1484
|
+
if (claim !== undefined) {
|
|
1485
|
+
benchStageIdOf(benchDoc, "", claim, checked.draftId ?? draftIdOf(""));
|
|
1486
|
+
const claimRows = benchDoc["stages"];
|
|
1487
|
+
/* v8 ignore next 1 -- pinned by benchStageIdOf's membership law above: a non-array stages list can never contain the claimed id, so the door refused before this read; the fallback stays as the read's own contract */
|
|
1488
|
+
const allRows = Array.isArray(claimRows) ? claimRows : [];
|
|
1489
|
+
const claimed = allRows.find((r) => typeof r === "object" && r !== null && r["id"] === claim);
|
|
1490
|
+
// benchStageIdOf judged membership above — the find reads
|
|
1491
|
+
// the same ledger once, for the row itself.
|
|
1492
|
+
/* v8 ignore next 7 -- pinned by benchStageIdOf's membership law above (runsRegistry's own benchStageIdOf refuses any id that names no stage row before this block runs); the backstop stays in case the two reads ever diverge */
|
|
1493
|
+
if (claimed === undefined) {
|
|
1494
|
+
throw toRemoteError(refusal(400, "bench_stage_id " + JSON.stringify(claim) + " names no stage row of draft " +
|
|
1495
|
+
JSON.stringify(String(checked.draftId ?? "")) + " — the press names the row it came from, and that row must exist on the bench (reopen the tab and press again)", "invalid_request"));
|
|
1496
|
+
}
|
|
1497
|
+
if (claimed["archived"] === true) {
|
|
1498
|
+
throw toRemoteError(refusal(400, "bench stage " + JSON.stringify(claim) + " is archived — a spent stage composes nowhere; unarchive it to run it again", "invalid_request"));
|
|
1499
|
+
}
|
|
1500
|
+
// THE WIRE RESOLUTION LAW, server half: a single-stage press
|
|
1501
|
+
// has no upstream stages to merge, so every wire must arrive
|
|
1502
|
+
// RESOLVED — the caller's concrete params overlay the row's
|
|
1503
|
+
// own bag (the client resolves each $spell to the upstream's
|
|
1504
|
+
// last result before the start; the same law the {model:}
|
|
1505
|
+
// door's body rides). The row's `inputs` edges are dropped
|
|
1506
|
+
// here ON PURPOSE: there is no upstream stage in this run to
|
|
1507
|
+
// link, and a $spell the caller did NOT resolve rides the
|
|
1508
|
+
// unwired-spell gate's refusal (composeCardStageRow) — the
|
|
1509
|
+
// honest wall, never a link to nowhere at the merge.
|
|
1510
|
+
const overlay = {};
|
|
1511
|
+
for (const [k, v] of Object.entries(body)) {
|
|
1512
|
+
if (!CARD_ENVELOPE_KEYS.includes(k))
|
|
1513
|
+
overlay[k] = v;
|
|
1514
|
+
}
|
|
1515
|
+
const rowParams = typeof claimed["params"] === "object" && claimed["params"] !== null && !Array.isArray(claimed["params"])
|
|
1516
|
+
? { ...claimed["params"] } : {};
|
|
1517
|
+
const single = {
|
|
1518
|
+
...claimed,
|
|
1519
|
+
params: { ...rowParams, ...overlay },
|
|
1520
|
+
};
|
|
1521
|
+
delete single["inputs"];
|
|
1522
|
+
composed = [await this.composeCardStageRow(single, claim, runId, "bench stage ", benchFams, benchReceipts)];
|
|
1523
|
+
}
|
|
1524
|
+
else {
|
|
1525
|
+
// THE BENCH RUN, COMPOSED (the draft door): this door composes
|
|
1526
|
+
// EVERY card stage of the bench — through the SAME registry walk
|
|
1527
|
+
// a single card start uses, laws and all — and submits ONE
|
|
1528
|
+
// merged run whose stages carry their `inputs` edges for the
|
|
1529
|
+
// worker to link. A $spell survives into the composed graph on
|
|
1530
|
+
// purpose: the merge resolves it into the upstream stage's
|
|
1531
|
+
// output (that is what a FromStage link IS).
|
|
1061
1532
|
|
|
1062
1533
|
// "run sources resolve nowhere (1 dead: run-65dc3ee505ef-…/
|
|
1063
1534
|
// gen)"). The bench run minted the id TWICE: once here, to
|
|
@@ -1069,35 +1540,36 @@ export class RunsRuntimeService extends Service {
|
|
|
1069
1540
|
// before it registered. The id is minted ONCE, here, and both
|
|
1070
1541
|
// the compose and the registration take it — one derivation,
|
|
1071
1542
|
// and a wall drives the pair.
|
|
1072
|
-
|
|
1073
|
-
const composed = await this.composeBenchStages(benchDoc, runId, benchFams);
|
|
1074
|
-
// the bench-composed stages' families reach the same claim
|
|
1075
|
-
// re-probe ledger the flow arm feeds (S-S4): the empty-ledger
|
|
1076
|
-
// carve-out below is the card-single path alone, never this
|
|
1077
|
-
// one.
|
|
1078
|
-
flowStageFams = benchFams;
|
|
1079
|
-
const rest = { ...body };
|
|
1080
|
-
delete rest["model"];
|
|
1081
|
-
delete rest["card"];
|
|
1082
|
-
delete rest["params"];
|
|
1083
|
-
body = {
|
|
1084
|
-
...rest,
|
|
1085
|
-
flow_inline: {
|
|
1086
|
-
|
|
1087
|
-
// and add it straight back — one address, two spellings.
|
|
1088
|
-
id: benchDraftIdOf(String(checked.draftId).replace(BENCH_DRAFT_PREFIX_RE, "")),
|
|
1089
|
-
stages: composed,
|
|
1090
|
-
},
|
|
1091
|
-
};
|
|
1092
|
-
selected = { door: "flow_inline" };
|
|
1093
|
-
benchComposed = true;
|
|
1094
|
-
// the run's own log line says what happened — a re-route is
|
|
1095
|
-
// never silent (NO SILENT BEHAVIOR, the same order as the
|
|
1096
|
-
// spell gate below)
|
|
1097
|
-
console.log("[runs] the bench wires " + JSON.stringify(wired.cross) +
|
|
1098
|
-
" — the single-card start became the bench run (" +
|
|
1099
|
-
String(composed.length) + " stages composed, wires riding as stage inputs)");
|
|
1543
|
+
composed = await this.composeBenchStages(benchDoc, runId, benchFams, benchReceipts);
|
|
1100
1544
|
}
|
|
1545
|
+
// the bench-composed stages' families reach the same claim
|
|
1546
|
+
// re-probe ledger the flow arm feeds (S-S4): the empty-ledger
|
|
1547
|
+
// carve-out below is the card-single path alone, never this
|
|
1548
|
+
// one.
|
|
1549
|
+
flowStageFams = benchFams;
|
|
1550
|
+
flowStageReceipts = benchReceipts;
|
|
1551
|
+
const rest = { ...body };
|
|
1552
|
+
delete rest["model"];
|
|
1553
|
+
delete rest["card"];
|
|
1554
|
+
delete rest["params"];
|
|
1555
|
+
body = {
|
|
1556
|
+
...rest,
|
|
1557
|
+
flow_inline: {
|
|
1558
|
+
|
|
1559
|
+
// and add it straight back — one address, two spellings.
|
|
1560
|
+
id: benchDraftIdOf(String(checked.draftId).replace(BENCH_DRAFT_PREFIX_RE, "")),
|
|
1561
|
+
stages: composed,
|
|
1562
|
+
},
|
|
1563
|
+
};
|
|
1564
|
+
selected = { door: "flow_inline" };
|
|
1565
|
+
benchComposed = true;
|
|
1566
|
+
// the run's own log line says what happened — a re-route is
|
|
1567
|
+
// never silent (NO SILENT BEHAVIOR, the same order as the
|
|
1568
|
+
// spell gate below)
|
|
1569
|
+
console.log(claim !== undefined
|
|
1570
|
+
? "[runs] the draft-door claimed-stage press composed 1 stage (" + claim + ") — the bench's other rows were not pressed"
|
|
1571
|
+
: "[runs] the draft-door bench run composed " + String(composed.length) +
|
|
1572
|
+
" stages, wires " + JSON.stringify(wired.cross) + " riding as stage inputs");
|
|
1101
1573
|
}
|
|
1102
1574
|
if (selected.door === "model") {
|
|
1103
1575
|
// The card start arm (handleCardStart 1016-1136, second
|
|
@@ -1117,6 +1589,11 @@ export class RunsRuntimeService extends Service {
|
|
|
1117
1589
|
throw toRemoteError(cardRefusal(e));
|
|
1118
1590
|
throw e;
|
|
1119
1591
|
}
|
|
1592
|
+
// THE CHAIN-STORE RUN-ID DOOR (the F35 write side, session 2):
|
|
1593
|
+
// the upscale bag's run-id bindings resolve to their stores
|
|
1594
|
+
// BEFORE compose — a store-less id refuses here (the honest
|
|
1595
|
+
// plain-film voice), a store spelling passes untouched.
|
|
1596
|
+
p1 = this.resolveUpscaleChainRunIds(p1);
|
|
1120
1597
|
let composed;
|
|
1121
1598
|
try {
|
|
1122
1599
|
composed = await cards.phase2Card(p1, runId);
|
|
@@ -1202,12 +1679,12 @@ export class RunsRuntimeService extends Service {
|
|
|
1202
1679
|
// run's own stage is a CYCLE (bench/self-wire, the same law
|
|
1203
1680
|
// the write doors hold).
|
|
1204
1681
|
//
|
|
1205
|
-
// A wire naming ANOTHER stage
|
|
1206
|
-
//
|
|
1207
|
-
// bench run before the card arm composes (a bench with wires
|
|
1208
|
-
// is a flow, whatever the caller named). The cross arms this
|
|
1209
|
-
// block once carried were provably dead code — deleted in
|
|
1682
|
+
// A wire naming ANOTHER stage (a CROSS wire) falls through
|
|
1683
|
+
// to the card arm untouched (the one-press one-card law,
|
|
1210
1684
|
|
|
1685
|
+
// before the start, and a raw unresolved $spell is the spell
|
|
1686
|
+
// gate's refusal below — this census refuses nothing a later
|
|
1687
|
+
// gate refuses better.
|
|
1211
1688
|
const selfWired = [];
|
|
1212
1689
|
/* v8 ignore next -- the same benchDoc and the same stages
|
|
1213
1690
|
* array the wired-rows walk above tested, with nothing
|
|
@@ -1228,11 +1705,9 @@ export class RunsRuntimeService extends Service {
|
|
|
1228
1705
|
}
|
|
1229
1706
|
}
|
|
1230
1707
|
}
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
* card arm composes — so every wire the census collected is
|
|
1235
|
-
* the row's own, and selfWired is never empty here. */
|
|
1708
|
+
// Both census outcomes are walled: a SELF wire refuses here
|
|
1709
|
+
// (the self-wire arm), a bench of CROSS wires falls through
|
|
1710
|
+
// to the card arm (the one-press one-card arm) — no ignore.
|
|
1236
1711
|
if (selfWired.length > 0) {
|
|
1237
1712
|
throw toRemoteError(refusal(400, "the bench carries a SELF-WIRE (bench/self-wire): stage " +
|
|
1238
1713
|
JSON.stringify([...new Set(selfWired)]) +
|
|
@@ -1251,7 +1726,13 @@ export class RunsRuntimeService extends Service {
|
|
|
1251
1726
|
// run-4610e1c38d75 was "edit" here vs "s_2" in the draft
|
|
1252
1727
|
// doc). Multi-row benches compose through the bench loop,
|
|
1253
1728
|
// which stamps each row's own id.
|
|
1254
|
-
benchStageId: benchStageIdOf(benchDoc, skeleton
|
|
1729
|
+
benchStageId: benchStageIdOf(benchDoc, skeleton, typeof body["bench_stage_id"] === "string" ? body["bench_stage_id"] : undefined,
|
|
1730
|
+
// the {model:} door always carries a draft_id (the CARD
|
|
1731
|
+
// BIRTH LAW binds it; the envelope's flow-doc exemption
|
|
1732
|
+
// admits only flow/flow_inline bodies) — the ?? covers the
|
|
1733
|
+
// type, never a real press
|
|
1734
|
+
/* v8 ignore next 1 -- the CARD BIRTH LAW pins checked.draftId on this arm; the ?? covers the type, never a real press */
|
|
1735
|
+
checked.draftId ?? draftIdOf("")),
|
|
1255
1736
|
// The {model:} card door's engine (the compose plane is
|
|
1256
1737
|
// ComfyUI's — the card arm rides it by construction).
|
|
1257
1738
|
engine: CARD_PLANE_ENGINE,
|
|
@@ -1267,10 +1748,25 @@ export class RunsRuntimeService extends Service {
|
|
|
1267
1748
|
outputNodes: composed.outputNodes,
|
|
1268
1749
|
inputNames: {},
|
|
1269
1750
|
};
|
|
1751
|
+
// THE CARD ARM'S ADMITTED BODY (hoisted, P1): the snapshot
|
|
1752
|
+
// law coerces here — the sidecar's requestBody AND the graph
|
|
1753
|
+
// receipt judge the SAME admitted doc (the task's doc seat:
|
|
1754
|
+
// run.cardSnapshot.params, the run door's admitted request
|
|
1755
|
+
// body), never two derivations.
|
|
1756
|
+
const cardRequestBody = coerceSnapshotBody(cards.defsSync().get(p1.card), body);
|
|
1757
|
+
// THE GRAPH-RECEIPT ROW (the silent UI-drop purge's P1): the
|
|
1758
|
+
// single card stage's queue-time evidence — the admitted body
|
|
1759
|
+
// against the composed graph, keyed by the card stage's own id.
|
|
1760
|
+
const cardReceiptRow = graphReceiptStageOf(skeleton, graphReceiptOf(cardRequestBody, { workflow: composed.graph }));
|
|
1270
1761
|
const reg = await registerCompiledRun({
|
|
1271
1762
|
compiled: { stages: [cardStage] },
|
|
1272
1763
|
testFlag: checked.testFlag,
|
|
1273
|
-
|
|
1764
|
+
executeCeilMs: checked.ceilMs,
|
|
1765
|
+
// the {model:} door always carries a draft_id (CARD BIRTH
|
|
1766
|
+
// LAW; the flow-doc exemption never reaches this arm) — the
|
|
1767
|
+
// ?? covers the type, never a real press
|
|
1768
|
+
/* v8 ignore next 1 -- the CARD BIRTH LAW pins checked.draftId on this arm; the ?? covers the type, never a real press */
|
|
1769
|
+
draftId: checked.draftId ?? draftIdOf(""),
|
|
1274
1770
|
stateRoot,
|
|
1275
1771
|
enqueue: (row) => this.core.enqueue(row),
|
|
1276
1772
|
// F-6(b): the admission warn computes pre-registration so
|
|
@@ -1292,7 +1788,13 @@ export class RunsRuntimeService extends Service {
|
|
|
1292
1788
|
// family the compose seat runs), not dsh's stringly
|
|
1293
1789
|
// encoding — the raw body above still feeds phase-1/2,
|
|
1294
1790
|
// which own their own coercion.
|
|
1295
|
-
requestBody:
|
|
1791
|
+
requestBody: cardRequestBody,
|
|
1792
|
+
// THE ADMITTED RECIPE (the F27 cure): the card doc the
|
|
1793
|
+
// compose actually received — restore's paste source.
|
|
1794
|
+
cardRecipe: { card: p1.card, params: liftCardParams(cardRequestBody) },
|
|
1795
|
+
// THE GRAPH-RECEIPT ROW (P1): the single stage's evidence
|
|
1796
|
+
// rides the same door the flow arms' ledger rides.
|
|
1797
|
+
graphReceipts: { [skeleton]: cardReceiptRow },
|
|
1296
1798
|
// the bench snapshot rides the same law per stage: each
|
|
1297
1799
|
// row's params coerce through its OWN card's carrier
|
|
1298
1800
|
// (unknown cards verbatim), on a COPY — the remote's doc
|
|
@@ -1484,8 +1986,15 @@ export class RunsRuntimeService extends Service {
|
|
|
1484
1986
|
// bench runs, and the compiler only ever sees compiled stages.
|
|
1485
1987
|
if (inlineStagesNameCards(inlineDoc)) {
|
|
1486
1988
|
const stageFams = {};
|
|
1487
|
-
|
|
1989
|
+
// THE GRAPH-RECEIPT LEDGER (P1): the flow rows' per-stage
|
|
1990
|
+
// evidence — assigned to the FUNCTION-scope ledger (the
|
|
1991
|
+
// block-scoped flowStageFams twin above is a dead shadow its
|
|
1992
|
+
// own arm never feeds to the door; the receipt does not
|
|
1993
|
+
// repeat that law).
|
|
1994
|
+
const stageReceipts = {};
|
|
1995
|
+
inlineDoc = await this.composeRegistryFlowStages(inlineDoc, runId, stageFams, stageReceipts);
|
|
1488
1996
|
flowStageFams = stageFams;
|
|
1997
|
+
flowStageReceipts = stageReceipts;
|
|
1489
1998
|
console.log("[runs] the flow " + name +
|
|
1490
1999
|
" composes its card stages through the card plane (" +
|
|
1491
2000
|
inlineDoc["stages"].length + " stages)");
|
|
@@ -1494,6 +2003,45 @@ export class RunsRuntimeService extends Service {
|
|
|
1494
2003
|
delete rest["flow"];
|
|
1495
2004
|
body = { ...rest, flow_inline: inlineDoc };
|
|
1496
2005
|
}
|
|
2006
|
+
// THE RAW flow_inline CARD COMPOSE (the warm-1 unported refusal,
|
|
2007
|
+
|
|
2008
|
+
// stages met "card= stages are unported on this gateway" — the
|
|
2009
|
+
// agent's ad-hoc bypass arm (one card, exact params, no bench
|
|
2010
|
+
// round trip) refused while the bench and named-flow doors
|
|
2011
|
+
// composed the SAME stages through the card walk. There is no
|
|
2012
|
+
// second execution path here either: the raw door rides the same
|
|
2013
|
+
// composeRegistryFlowStages walk, so the compiler only ever sees
|
|
2014
|
+
// compiled stages — mixed docs (a card row beside an engine row)
|
|
2015
|
+
// stay mixed, the engine rows passing through untouched, exactly
|
|
2016
|
+
// as the named-flow arm treats them. The compose's own gates
|
|
2017
|
+
// (unknown card, illegal params) refuse in the card plane's
|
|
2018
|
+
// voice; nothing caller-authored reaches the engine unjudged.
|
|
2019
|
+
if (selected.door === "flow_inline" && !benchComposed) {
|
|
2020
|
+
const rawInline = body["flow_inline"];
|
|
2021
|
+
if (typeof rawInline === "object" && rawInline !== null &&
|
|
2022
|
+
inlineStagesNameCards(rawInline)) {
|
|
2023
|
+
// THE JUNK LAW STANDS (the tolerance arm's own contract): the
|
|
2024
|
+
// shared walk SKIPS non-object rows — correct for a named
|
|
2025
|
+
// flow (its projection guarantees object rows), a silent
|
|
2026
|
+
// DROP for a hand-authored doc. A raw doc carrying junk rows
|
|
2027
|
+
// is left untouched here so the compile gate refuses it in
|
|
2028
|
+
// its own voice (junk costs the whole flow its start, never
|
|
2029
|
+
// a half flow); only a junk-free card doc composes.
|
|
2030
|
+
const rawRows = rawInline["stages"];
|
|
2031
|
+
const junkFree = Array.isArray(rawRows) &&
|
|
2032
|
+
rawRows.every((st) => typeof st === "object" && st !== null);
|
|
2033
|
+
if (junkFree) {
|
|
2034
|
+
const stageFams = {};
|
|
2035
|
+
const stageReceipts = {};
|
|
2036
|
+
const composedInline = await this.composeRegistryFlowStages(rawInline, runId, stageFams, stageReceipts);
|
|
2037
|
+
flowStageFams = stageFams;
|
|
2038
|
+
flowStageReceipts = stageReceipts;
|
|
2039
|
+
body = { ...body, flow_inline: composedInline };
|
|
2040
|
+
console.log("[runs] the raw inline doc composes its card stages through the card plane (" +
|
|
2041
|
+
composedInline["stages"].length + " stages)");
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
}
|
|
1497
2045
|
// ONE stage schema for the whole bench (the law above): every
|
|
1498
2046
|
// stage that reaches the compiler carries an engine, whether a
|
|
1499
2047
|
// human, the GUI, the agent or a hand-written flow authored it.
|
|
@@ -1580,12 +2128,21 @@ export class RunsRuntimeService extends Service {
|
|
|
1580
2128
|
// first cut was NAMED NOT CURED; judging the compiled rows needs
|
|
1581
2129
|
// no card plane at all.)
|
|
1582
2130
|
try {
|
|
1583
|
-
kindsOk(typeof replayId === "string" ? replayId : "flow_inline", replayJudgeRows(compiled),
|
|
2131
|
+
kindsOk(typeof replayId === "string" ? replayId : "flow_inline", replayJudgeRows(compiled), undefined);
|
|
1584
2132
|
}
|
|
1585
2133
|
catch (judgeError) {
|
|
2134
|
+
|
|
1586
2135
|
if (judgeError instanceof FlowError) {
|
|
1587
2136
|
throw new RemoteError("runs/invalid-request", judgeError.message, { loc: "body" });
|
|
1588
2137
|
}
|
|
2138
|
+
/* v8 ignore next -- kindsOk judges the rows this same press
|
|
2139
|
+
* just compiled: its non-FlowError arms (needCardRegistry's
|
|
2140
|
+
* plain Error, the row-shape guards) judge caller-authored
|
|
2141
|
+
* rows, while compiled rows arrive well-shaped — the compiler
|
|
2142
|
+
* refused anything else — with no card stages left
|
|
2143
|
+
* (composition consumed them). Only the kind lattice
|
|
2144
|
+
* (FlowError) can fire here; the rethrow is the belt for a
|
|
2145
|
+
* future kindsOk arm that throws outside the lattice. */
|
|
1589
2146
|
throw judgeError;
|
|
1590
2147
|
}
|
|
1591
2148
|
if (compiled.stages.length !== 1) {
|
|
@@ -1632,7 +2189,11 @@ export class RunsRuntimeService extends Service {
|
|
|
1632
2189
|
const reg = await registerCompiledRun({
|
|
1633
2190
|
compiled,
|
|
1634
2191
|
testFlag: checked.testFlag,
|
|
1635
|
-
|
|
2192
|
+
executeCeilMs: checked.ceilMs,
|
|
2193
|
+
// the flow arms may run doc-less (the flow-doc exemption): the
|
|
2194
|
+
// empty id records exactly that — no draft, the run row is the
|
|
2195
|
+
// record; a materialized flow press carries its bench id here
|
|
2196
|
+
draftId: checked.draftId ?? draftIdOf(""),
|
|
1636
2197
|
stateRoot,
|
|
1637
2198
|
enqueue: (row) => this.core.enqueue(row),
|
|
1638
2199
|
// the bench-read warning rides the inline arm too (audit N-S3)
|
|
@@ -1678,6 +2239,11 @@ export class RunsRuntimeService extends Service {
|
|
|
1678
2239
|
// rows — extra=forbid at the wire door) for the pump's
|
|
1679
2240
|
// claim-time gate re-run.
|
|
1680
2241
|
...(Object.keys(flowStageFams).length > 0 ? { stageFams: flowStageFams } : {}),
|
|
2242
|
+
// THE GRAPH-RECEIPT LEDGER (P1): the per-stage queue-time
|
|
2243
|
+
// evidence rows ride the row the same way (not the stage
|
|
2244
|
+
// rows — extra=forbid at the wire door) — registerCompiledRun
|
|
2245
|
+
// folds them into the run-level `graph_receipt`.
|
|
2246
|
+
...(Object.keys(flowStageReceipts).length > 0 ? { graphReceipts: flowStageReceipts } : {}),
|
|
1681
2247
|
},
|
|
1682
2248
|
});
|
|
1683
2249
|
// THE SOURCE-ECHO REFUSAL (same law on the inline door).
|
|
@@ -1704,8 +2270,12 @@ export class RunsRuntimeService extends Service {
|
|
|
1704
2270
|
/** The list arm (REBUILD-7): the restore-port envelope over the
|
|
1705
2271
|
* output roots. The raw limit STRING rides from the lane (strict
|
|
1706
2272
|
* int() semantics: underscores parse, junk refuses). The drafts
|
|
1707
|
-
* probe rides the drafts remote.
|
|
1708
|
-
|
|
2273
|
+
* probe rides the drafts remote. The optional draft/stage
|
|
2274
|
+
* filters (the stale-two-run chat audit's cure 3 — runsList.ts
|
|
2275
|
+
* RunsListFilter) narrow the served rows to one draft's takes;
|
|
2276
|
+
* an empty string reads ABSENT (the parse_qs blank law), never
|
|
2277
|
+
* as a match against the empty id. */
|
|
2278
|
+
async list(rawLimit, signal, draftId, benchStageId) {
|
|
1709
2279
|
signal.throwIfAborted();
|
|
1710
2280
|
// The door's 400 text (parseIntOrNull in runsList.ts) — the runs face's invalid-request refusal.
|
|
1711
2281
|
// ONLY this parse folds; every other failure stays loud (no absorb).
|
|
@@ -1716,9 +2286,20 @@ export class RunsRuntimeService extends Service {
|
|
|
1716
2286
|
const limit = Math.max(1, Math.min(500, parsed));
|
|
1717
2287
|
// §23 CROSS-ROOTS: the union list across the manifest (own
|
|
1718
2288
|
// root first — own rows win collisions, every row served_from).
|
|
1719
|
-
|
|
2289
|
+
|
|
2290
|
+
// the scan covers BOTH out seats per root — test:true runs
|
|
2291
|
+
// list with `test: true` stamped (listRunsAcross owns the
|
|
2292
|
+
// seats; there is no flag-filtered list, hiding by query is
|
|
2293
|
+
// not a door this estate serves).
|
|
2294
|
+
const filter = (draftId !== undefined && draftId !== "") || (benchStageId !== undefined && benchStageId !== "")
|
|
2295
|
+
? {
|
|
2296
|
+
...(draftId !== undefined && draftId !== "" ? { draftId } : {}),
|
|
2297
|
+
...(benchStageId !== undefined && benchStageId !== "" ? { benchStageId } : {}),
|
|
2298
|
+
}
|
|
2299
|
+
: undefined;
|
|
2300
|
+
return await listRunsAcross(this.ctx.queue.stateRoots, limit, async (probeId) => {
|
|
1720
2301
|
try {
|
|
1721
|
-
await this.ctx.draftsRemote.get(
|
|
2302
|
+
await this.ctx.draftsRemote.get(probeId, signal);
|
|
1722
2303
|
return true;
|
|
1723
2304
|
}
|
|
1724
2305
|
catch (e) {
|
|
@@ -1729,7 +2310,7 @@ export class RunsRuntimeService extends Service {
|
|
|
1729
2310
|
void e;
|
|
1730
2311
|
return false;
|
|
1731
2312
|
}
|
|
1732
|
-
});
|
|
2313
|
+
}, filter);
|
|
1733
2314
|
}
|
|
1734
2315
|
/** The validate arm (REBUILD-8): the PURE compile pipeline
|
|
1735
2316
|
* (flowFromBody → compile → pin sweep → the 200 row) over the
|
|
@@ -1762,6 +2343,84 @@ export class RunsRuntimeService extends Service {
|
|
|
1762
2343
|
const warn = filmMemoryWarn(load, await fetchEngineMem(url));
|
|
1763
2344
|
return warn === null ? [] : [warn];
|
|
1764
2345
|
}
|
|
2346
|
+
/** THE CHAIN-STORE RUN-ID DOOR (the F35 write side, session 2): an
|
|
2347
|
+
* h3-timeline doc's upscale entry may bind its source by ESTATE
|
|
2348
|
+
* RUN ID — resolved HERE, before compose, through the run row the
|
|
2349
|
+
* harvest registrar stamped (result_outputs.chain_store.run_name),
|
|
2350
|
+
* so the composed manager carries a BARE STORE NAME and the
|
|
2351
|
+
* execute door's existing law (gates-h3-chain-selection-door)
|
|
2352
|
+
* keeps judging name→store — one judge per edge. A store-spelling
|
|
2353
|
+
* binding (swap_…/picture_… — anything off the run-id grammar)
|
|
2354
|
+
* passes byte-untouched with ZERO registry reads: the store stays
|
|
2355
|
+
* the only existence truth, judged where it is already walled. An
|
|
2356
|
+
* id-grammar spelling with no row — or a row whose stages carry no
|
|
2357
|
+
* chain_store — refuses LOUD at this door naming the plain-film
|
|
2358
|
+
* law, never the execute door's typo-reading 404 (the run row,
|
|
2359
|
+
* not the store, answers "was this a chain run"). The determinism
|
|
2360
|
+
* corner: the grammar resolves through the registry ONLY and never
|
|
2361
|
+
* falls through to the store, so a store literally named like a
|
|
2362
|
+
* run id binds by its exact spelling only when it does NOT match
|
|
2363
|
+
* the grammar. Runs between phase 1 (the doc validated) and phase
|
|
2364
|
+
* 2 (the graph composed) — a refusal names the field, never a
|
|
2365
|
+
* zombie slot. */
|
|
2366
|
+
resolveUpscaleChainRunIds(p1) {
|
|
2367
|
+
const bag = p1.params?.["upscale"];
|
|
2368
|
+
if (!Array.isArray(bag) || bag.length === 0)
|
|
2369
|
+
return p1;
|
|
2370
|
+
const resolved = [];
|
|
2371
|
+
let changed = false;
|
|
2372
|
+
for (const entry of bag) {
|
|
2373
|
+
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) {
|
|
2374
|
+
resolved.push(entry);
|
|
2375
|
+
continue;
|
|
2376
|
+
}
|
|
2377
|
+
const rec = entry;
|
|
2378
|
+
const chainRun = rec["chain_run"];
|
|
2379
|
+
if (typeof chainRun !== "string" || !ESTATE_RUN_ID_RE.test(chainRun)) {
|
|
2380
|
+
// a store spelling (or a shape the upscale arm's own
|
|
2381
|
+
// blank-seat refusal owns): byte-untouched, zero registry reads
|
|
2382
|
+
resolved.push(entry);
|
|
2383
|
+
continue;
|
|
2384
|
+
}
|
|
2385
|
+
const store = this.chainStoreNameOf(chainRun);
|
|
2386
|
+
if (store === null) {
|
|
2387
|
+
throw toRemoteError(refusal(400, "runs/chain-run-unresolved: run \"" + chainRun + "\" left no chain store — " +
|
|
2388
|
+
"plain films don't checkpoint (a film's windows join by file; no scene latents " +
|
|
2389
|
+
"survive). Bind a swap/repair/extend run's chain store (its run row carries " +
|
|
2390
|
+
"chain_store), or re-press the film through a chain seat first", "invalid_request"));
|
|
2391
|
+
}
|
|
2392
|
+
resolved.push({ ...rec, chain_run: store });
|
|
2393
|
+
changed = true;
|
|
2394
|
+
}
|
|
2395
|
+
if (!changed)
|
|
2396
|
+
return p1;
|
|
2397
|
+
return { ...p1, params: { ...p1.params, upscale: resolved } };
|
|
2398
|
+
}
|
|
2399
|
+
/** The store name a run row carries (the registrar's stamp), or
|
|
2400
|
+
* null: the live map first, the durable _flow.json on its miss —
|
|
2401
|
+
* the same two faces the status door reads. */
|
|
2402
|
+
chainStoreNameOf(runId) {
|
|
2403
|
+
const live = this.liveRun(runId);
|
|
2404
|
+
const stages = live !== undefined
|
|
2405
|
+
? live.stages
|
|
2406
|
+
: this.diskRunRow(runId)?.row["stages"];
|
|
2407
|
+
if (!Array.isArray(stages))
|
|
2408
|
+
return null;
|
|
2409
|
+
for (const st of stages) {
|
|
2410
|
+
if (st === null || typeof st !== "object" || Array.isArray(st))
|
|
2411
|
+
continue;
|
|
2412
|
+
const ro = st["result_outputs"];
|
|
2413
|
+
if (ro === null || typeof ro !== "object" || Array.isArray(ro))
|
|
2414
|
+
continue;
|
|
2415
|
+
const store = ro["chain_store"];
|
|
2416
|
+
if (store === null || typeof store !== "object" || Array.isArray(store))
|
|
2417
|
+
continue;
|
|
2418
|
+
const name = store["run_name"];
|
|
2419
|
+
if (typeof name === "string" && name !== "")
|
|
2420
|
+
return name;
|
|
2421
|
+
}
|
|
2422
|
+
return null;
|
|
2423
|
+
}
|
|
1765
2424
|
async status(runId, signal, includeLog = false) {
|
|
1766
2425
|
signal.throwIfAborted();
|
|
1767
2426
|
const run = this.liveRun(runId);
|
|
@@ -1787,6 +2446,23 @@ export class RunsRuntimeService extends Service {
|
|
|
1787
2446
|
}
|
|
1788
2447
|
return withStageReports({ ...enrichDiskRow(disk.row), from_disk: true, queue_position: 0, served_from: disk.root }, sidecarReaderFor(disk.dir));
|
|
1789
2448
|
}
|
|
2449
|
+
|
|
2450
|
+
// polled row derives from the durable truth. A live row still
|
|
2451
|
+
// claiming queued/running/stopping over a settled run tree
|
|
2452
|
+
// resyncs here — the answer is the disk-enriched serve (the same
|
|
2453
|
+
// shape the fallback arms above return, marked from_disk), and
|
|
2454
|
+
// the map row now reads the settled verdict.
|
|
2455
|
+
if (this.resyncSettledTruth(run)) {
|
|
2456
|
+
const disk = this.diskRunRow(runId);
|
|
2457
|
+
/* v8 ignore next -- the synchronous re-read of the row the
|
|
2458
|
+
* resync just adopted: no await sits between the resync's own
|
|
2459
|
+
* read and this one, so the durable row cannot vanish
|
|
2460
|
+
* mid-tick in any seat — the undefined leg is the belt for a
|
|
2461
|
+
* torn durable write between the two reads. */
|
|
2462
|
+
if (disk !== undefined) {
|
|
2463
|
+
return withStageReports({ ...enrichDiskRow(disk.row), from_disk: true, queue_position: this.core.queuePosition(run.runId), served_from: disk.root }, sidecarReaderFor(disk.dir));
|
|
2464
|
+
}
|
|
2465
|
+
}
|
|
1790
2466
|
const payload = {
|
|
1791
2467
|
run_id: run.runId,
|
|
1792
2468
|
status: run.status,
|
|
@@ -1829,6 +2505,19 @@ export class RunsRuntimeService extends Service {
|
|
|
1829
2505
|
// THE SOURCE ECHO, SERVED (same law: the run's sources ride
|
|
1830
2506
|
// the live row too — additive, same spelling as the sidecar).
|
|
1831
2507
|
...(run.sourceEcho !== undefined ? { source_echo: run.sourceEcho } : {}),
|
|
2508
|
+
// THE GRAPH RECEIPT, SERVED (the silent UI-drop purge's P1,
|
|
2509
|
+
// same law: the queue-time doc→graph evidence rides the live
|
|
2510
|
+
// row too — additive, same spelling as the sidecar; the disk
|
|
2511
|
+
// fallback spreads the sidecar row, which carries it).
|
|
2512
|
+
// Absent on inline runs (no card composed).
|
|
2513
|
+
...(run.graphReceipt !== undefined ? { graph_receipt: run.graphReceipt } : {}),
|
|
2514
|
+
|
|
2515
|
+
// exact card + authoring body that ran rides the live row —
|
|
2516
|
+
// restore rebuilds the recipe from THIS, never from the
|
|
2517
|
+
// mutable draft (which a later edit rewrote). Same spelling
|
|
2518
|
+
// as the sidecar; the disk fallback spreads the sidecar row.
|
|
2519
|
+
...(run.cardSnapshot !== undefined ? { card_snapshot: run.cardSnapshot } : {}),
|
|
2520
|
+
...(run.cardRecipe !== undefined ? { card_recipe: run.cardRecipe } : {}),
|
|
1832
2521
|
// THE EXPORT NAME, SERVED (023's self-critique #4/#6: the
|
|
1833
2522
|
// design lane's mint rides the live row too — additive,
|
|
1834
2523
|
// same spelling as the sidecar; absent on non-export runs.
|
|
@@ -1925,8 +2614,22 @@ export class RunsRuntimeService extends Service {
|
|
|
1925
2614
|
throw new RemoteError("runs/run-unknown", "unknown run_id " + JSON.stringify(runId) + " " +
|
|
1926
2615
|
searchedVoice(this.ctx.queue.stateRoots), { runId });
|
|
1927
2616
|
}
|
|
2617
|
+
|
|
2618
|
+
// press first judges the claim against the durable row. A zombie
|
|
2619
|
+
// (live claim over a settled run tree) RESOLVES here: the verdict
|
|
2620
|
+
// names the row's true state and clears the stale claim — the
|
|
2621
|
+
// operator's press does something honest, never a stop lie.
|
|
2622
|
+
if (this.resyncSettledTruth(run)) {
|
|
2623
|
+
return { run_id: runId, status: run.status, already_settled: true };
|
|
2624
|
+
}
|
|
1928
2625
|
if (run.status !== "queued" && run.status !== "running" && run.status !== "stopping") {
|
|
1929
|
-
|
|
2626
|
+
|
|
2627
|
+
// old `{ error: "cannot stop run in state …" }` payload resolved
|
|
2628
|
+
// as success at every unwrapping client and nothing voiced —
|
|
2629
|
+
// the exact no-op press the burn named. A plainly settled row
|
|
2630
|
+
// refuses with its own wire code, naming the true state.
|
|
2631
|
+
throw new RemoteError("runs/already-settled", "run " + JSON.stringify(runId) + " is already settled (status " + run.status +
|
|
2632
|
+
") — nothing to stop", { runId, status: run.status });
|
|
1930
2633
|
}
|
|
1931
2634
|
// THE STOPPING STAMP (stroke 83 — the state existed in the
|
|
1932
2635
|
// union but nothing ever set it): a stop press on a LIVE run
|
|
@@ -1957,6 +2660,42 @@ export class RunsRuntimeService extends Service {
|
|
|
1957
2660
|
liveRun(runId) {
|
|
1958
2661
|
return this.core.runs.get(runId);
|
|
1959
2662
|
}
|
|
2663
|
+
|
|
2664
|
+
|
|
2665
|
+
|
|
2666
|
+
|
|
2667
|
+
|
|
2668
|
+
|
|
2669
|
+
|
|
2670
|
+
|
|
2671
|
+
|
|
2672
|
+
|
|
2673
|
+
|
|
2674
|
+
|
|
2675
|
+
|
|
2676
|
+
|
|
2677
|
+
resyncSettledTruth(run) {
|
|
2678
|
+
if (run.status !== "queued" && run.status !== "running" && run.status !== "stopping") {
|
|
2679
|
+
return false;
|
|
2680
|
+
}
|
|
2681
|
+
const disk = this.diskRunRow(run.runId);
|
|
2682
|
+
if (disk === undefined)
|
|
2683
|
+
return false;
|
|
2684
|
+
const diskStatus = disk.row["status"];
|
|
2685
|
+
if (diskStatus === run.status)
|
|
2686
|
+
return false;
|
|
2687
|
+
// THE SETTLED TRIPLE only: a disk row claiming a live word is a
|
|
2688
|
+
// foreign/partial write — the durable boundary never adopts it
|
|
2689
|
+
// (the same law diskRunRow's vocabulary guard serves).
|
|
2690
|
+
if (diskStatus !== "completed" && diskStatus !== "failed" && diskStatus !== "stopped") {
|
|
2691
|
+
return false;
|
|
2692
|
+
}
|
|
2693
|
+
run.status = diskStatus;
|
|
2694
|
+
if (typeof disk.row["error"] === "string")
|
|
2695
|
+
run.error = disk.row["error"];
|
|
2696
|
+
notifyRunChanged(run.runId);
|
|
2697
|
+
return true;
|
|
2698
|
+
}
|
|
1960
2699
|
/** The durable record under the run tree (F-5's fallback read):
|
|
1961
2700
|
* the on-disk _flow.json for a run — the SAME file the maker
|
|
1962
2701
|
* verified byte-by-byte while status answered husks. The
|
|
@@ -2036,6 +2775,12 @@ export class RunsRuntimeService extends Service {
|
|
|
2036
2775
|
if (pressKey === undefined)
|
|
2037
2776
|
return;
|
|
2038
2777
|
const pending = this.pendingPresses.get(pressKey);
|
|
2778
|
+
/* v8 ignore next -- the minter holds its own reservation: the
|
|
2779
|
+
* key lands in pendingPresses synchronously at reservePress
|
|
2780
|
+
* (before the first await) and leaves in the finally AFTER this
|
|
2781
|
+
* resolve — no path deletes between, so a defined key always
|
|
2782
|
+
* finds its waiter here. The belt for a future caller that
|
|
2783
|
+
* resolves without reserving. */
|
|
2039
2784
|
if (pending !== undefined)
|
|
2040
2785
|
pending.resolve(summary);
|
|
2041
2786
|
}
|
|
@@ -2045,6 +2790,11 @@ export class RunsRuntimeService extends Service {
|
|
|
2045
2790
|
|
|
2046
2791
|
failPress(pressKey, error) {
|
|
2047
2792
|
const pending = this.pendingPresses.get(pressKey);
|
|
2793
|
+
/* v8 ignore next -- same reservation invariant as resolvePress
|
|
2794
|
+
* above: the failing minter's own key is still held (the
|
|
2795
|
+
* finally deletes AFTER this reject), so the waiter is always
|
|
2796
|
+
* found — the belt for a future caller that fails a key it
|
|
2797
|
+
* never reserved. */
|
|
2048
2798
|
if (pending !== undefined)
|
|
2049
2799
|
pending.reject(error);
|
|
2050
2800
|
}
|
|
@@ -2077,6 +2827,9 @@ export class RunsRuntimeService extends Service {
|
|
|
2077
2827
|
this.presses.set(pressKey, runId);
|
|
2078
2828
|
while (this.presses.size > RunsRuntimeService.PRESS_MEMORY_MAX) {
|
|
2079
2829
|
const oldest = this.presses.keys().next();
|
|
2830
|
+
/* v8 ignore next -- the map holds >0 entries whenever the loop
|
|
2831
|
+
* runs (size > PRESS_MEMORY_MAX > 0), so next() always yields —
|
|
2832
|
+
* the sweep mirror's identical guard carries the same ignore. */
|
|
2080
2833
|
if (oldest.done)
|
|
2081
2834
|
break;
|
|
2082
2835
|
this.presses.delete(oldest.value);
|
|
@@ -2161,13 +2914,11 @@ export class RunsRuntimeService extends Service {
|
|
|
2161
2914
|
if (laneMiss !== null) {
|
|
2162
2915
|
run.status = "failed";
|
|
2163
2916
|
run.error = laneMiss.message;
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
}
|
|
2170
|
-
}
|
|
2917
|
+
// THE PER-ROW TRUTH STAMP (F2): a claim refusal is the
|
|
2918
|
+
// RUN's verdict — nothing ever answered. The sole stage
|
|
2919
|
+
// owns the cause; unanswered peers read stopped and
|
|
2920
|
+
// never carry the borrowed text.
|
|
2921
|
+
stampUnansweredRows(run, laneMiss.message, false);
|
|
2171
2922
|
await claimPersist(run);
|
|
2172
2923
|
await this.settle(run);
|
|
2173
2924
|
continue;
|
|
@@ -2189,11 +2940,23 @@ export class RunsRuntimeService extends Service {
|
|
|
2189
2940
|
const roots = { stateRoot: this.ctx.queue.stateRoot, repoRoot: resolveRepoRoot() };
|
|
2190
2941
|
let initialMiss = null;
|
|
2191
2942
|
for (const key of fileKeys) {
|
|
2943
|
+
/* v8 ignore next -- initialFileKeys is string[]-typed on
|
|
2944
|
+
* the run row and every live row arrives through typed
|
|
2945
|
+
* construction (door, replay, pump) — a non-string key is
|
|
2946
|
+
* unconstructible through every seat that stamps it; the
|
|
2947
|
+
* unknown read is torn-state defense for durable
|
|
2948
|
+
* variance. */
|
|
2192
2949
|
if (typeof key !== "string")
|
|
2193
2950
|
continue;
|
|
2194
2951
|
const raw = run.initials[key];
|
|
2952
|
+
/* v8 ignore next -- the press gate normalizes photo/glb
|
|
2953
|
+
* initials to strings (normalizedInitialValue) or refuses
|
|
2954
|
+
* the press, and the replay path re-runs that same
|
|
2955
|
+
* extractor — so a stamped key carries a string on every
|
|
2956
|
+
* live row. Absent/linked values are the merged worker's
|
|
2957
|
+
* own seat (it resolves them), never the probe's. */
|
|
2195
2958
|
if (typeof raw !== "string")
|
|
2196
|
-
continue;
|
|
2959
|
+
continue;
|
|
2197
2960
|
if (!initialFileCandidates(raw.trim(), roots).some((cand) => isFile(cand))) {
|
|
2198
2961
|
initialMiss = "initial " + JSON.stringify(key) + " is not on disk (" + raw.trim() + ")";
|
|
2199
2962
|
break;
|
|
@@ -2202,13 +2965,10 @@ export class RunsRuntimeService extends Service {
|
|
|
2202
2965
|
if (initialMiss !== null) {
|
|
2203
2966
|
run.status = "failed";
|
|
2204
2967
|
run.error = initialMiss;
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
stage["error"] = initialMiss;
|
|
2210
|
-
}
|
|
2211
|
-
}
|
|
2968
|
+
// THE PER-ROW TRUTH STAMP (F2): same law as the lane
|
|
2969
|
+
// refusal above — the run owns the verdict, the sole
|
|
2970
|
+
// stage carries it, peers read stopped.
|
|
2971
|
+
stampUnansweredRows(run, initialMiss, false);
|
|
2212
2972
|
await claimPersist(run);
|
|
2213
2973
|
await this.settle(run);
|
|
2214
2974
|
continue;
|
|
@@ -2245,12 +3005,10 @@ export class RunsRuntimeService extends Service {
|
|
|
2245
3005
|
// keeps claiming: the queue may delay a run, never
|
|
2246
3006
|
// strand it.
|
|
2247
3007
|
const text = "run seat escape (pump settle): " + errText(exc);
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
3008
|
+
// THE PER-ROW TRUTH STAMP (F2): the escape is the run's
|
|
3009
|
+
// receipt — the sole stage carries it, unanswered peers
|
|
3010
|
+
// read stopped with no borrowed text.
|
|
3011
|
+
stampUnansweredRows(run, text, false);
|
|
2254
3012
|
run.status = "failed";
|
|
2255
3013
|
run.error = text;
|
|
2256
3014
|
try {
|
|
@@ -2320,11 +3078,47 @@ export class RunsRuntimeService extends Service {
|
|
|
2320
3078
|
notifyRunChanged(run.runId);
|
|
2321
3079
|
}
|
|
2322
3080
|
}
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
3081
|
+
|
|
3082
|
+
|
|
3083
|
+
|
|
3084
|
+
|
|
3085
|
+
|
|
3086
|
+
|
|
3087
|
+
|
|
3088
|
+
|
|
3089
|
+
|
|
3090
|
+
|
|
3091
|
+
|
|
3092
|
+
|
|
3093
|
+
|
|
3094
|
+
|
|
3095
|
+
|
|
3096
|
+
|
|
3097
|
+
|
|
3098
|
+
|
|
3099
|
+
|
|
3100
|
+
|
|
3101
|
+
|
|
3102
|
+
|
|
3103
|
+
|
|
3104
|
+
|
|
3105
|
+
|
|
3106
|
+
|
|
3107
|
+
function benchStageIdOf(benchDoc, skeleton, claimed, pressedDraft) {
|
|
3108
|
+
if (claimed !== undefined && claimed !== "") {
|
|
3109
|
+
if (benchDoc === undefined)
|
|
3110
|
+
return claimed;
|
|
3111
|
+
const rows = benchDoc["stages"];
|
|
3112
|
+
const known = Array.isArray(rows)
|
|
3113
|
+
? rows.some((r) => typeof r === "object" && r !== null && r["id"] === claimed)
|
|
3114
|
+
: false;
|
|
3115
|
+
if (!known) {
|
|
3116
|
+
throw new RemoteError("runs/invalid-request", "bench_stage_id " + JSON.stringify(claimed) +
|
|
3117
|
+
" names no stage row of draft " + JSON.stringify(pressedDraft) +
|
|
3118
|
+
" — the press names the row it came from, and that row must exist on the bench (reopen the tab and press again)", { loc: "bench_stage_id" });
|
|
3119
|
+
}
|
|
3120
|
+
return claimed;
|
|
3121
|
+
}
|
|
2328
3122
|
if (benchDoc === undefined)
|
|
2329
3123
|
return undefined;
|
|
2330
3124
|
const rows = benchDoc["stages"];
|
|
@@ -2353,7 +3147,10 @@ function benchStageIdOf(benchDoc, skeleton) {
|
|
|
2353
3147
|
* The result face: run_id always; the run-relative media url of the
|
|
2354
3148
|
* stage's own output when one exists (the husk clobber's other
|
|
2355
3149
|
* half — a bookkeeping mirror never blanks a hero it can name); the
|
|
2356
|
-
* error voice
|
|
3150
|
+
* error voice is the stage's OWN error, never the run's — the
|
|
3151
|
+
* pass-level cause rides the run doc (run_status answers for the
|
|
3152
|
+
* pass), and a row that borrowed it would name another stage's
|
|
3153
|
+
* cause (qa8 F43, the per-row status law). */
|
|
2357
3154
|
export function settleMirrorPatches(run) {
|
|
2358
3155
|
const out = [];
|
|
2359
3156
|
for (const stage of run.stages) {
|
|
@@ -2376,7 +3173,7 @@ export function settleMirrorPatches(run) {
|
|
|
2376
3173
|
: undefined;
|
|
2377
3174
|
const voice = typeof stage["error"] === "string" && stage["error"] !== ""
|
|
2378
3175
|
? stage["error"]
|
|
2379
|
-
:
|
|
3176
|
+
: undefined;
|
|
2380
3177
|
out.push({
|
|
2381
3178
|
stageId,
|
|
2382
3179
|
patch: {
|