@melite/estate-queue 0.2.0-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/README.md +0 -5
- package/lib/cardsCompose.d.ts +31 -0
- package/lib/cardsCompose.js +55 -0
- package/lib/cardsRegistry.d.ts +5 -2
- package/lib/cardsRegistry.js +160 -3
- package/lib/discloseRegistry.d.ts +5 -0
- package/lib/discloseRegistry.js +3 -3
- package/lib/flowsData.d.ts +77 -21
- package/lib/flowsData.js +156 -21
- package/lib/flowsRegistryRows.d.ts +0 -4
- package/lib/flowsRegistryRows.js +137 -351
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -4
- package/lib/loadPlane.d.ts +46 -4
- package/lib/loadPlane.js +107 -7
- package/lib/loadRegistry.js +9 -2
- package/lib/managePlane.d.ts +5 -0
- package/lib/managePlane.js +404 -49
- package/lib/managePreflight.js +38 -6
- package/lib/manageProbe.d.ts +35 -0
- package/lib/manageProbe.js +110 -0
- package/lib/queueLock.js +19 -10
- package/lib/queueResurrect.d.ts +0 -3
- package/lib/queueResurrect.js +0 -3
- package/lib/queueRetry.d.ts +12 -10
- package/lib/queueRetry.js +2 -4
- package/lib/queueSidecar.d.ts +12 -0
- package/lib/queueSidecar.js +15 -0
- package/lib/queueSubmit.d.ts +4 -1
- package/lib/queueSubmit.js +28 -5
- package/lib/runsExecute.d.ts +16 -1
- package/lib/runsExecute.js +63 -45
- package/lib/runsGates.d.ts +11 -3
- package/lib/runsGates.js +11 -3
- package/lib/runsList.d.ts +59 -3
- package/lib/runsList.js +217 -36
- package/lib/runsRegistry.d.ts +58 -3
- package/lib/runsRegistry.js +479 -92
- package/lib/runsStart.d.ts +6 -4
- package/lib/runsStart.js +32 -25
- package/lib/runsTypes.d.ts +19 -1
- package/lib/runsTypes.js +40 -3
- package/lib/runsValidate.d.ts +1 -0
- package/lib/runsValidate.js +5 -0
- package/lib/runsValidateArms.js +25 -0
- package/lib/runsValidateServe.js +15 -12
- package/lib/runsValidateShared.d.ts +8 -10
- package/lib/runsValidateShared.js +41 -15
- package/lib/runsValidateStages.d.ts +1 -1
- package/lib/runsValidateStages.js +90 -50
- package/lib/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 +42 -3
- package/package.json +24 -14
- package/lib/resurrect.d.ts +0 -6
- package/lib/resurrect.js +0 -18
package/lib/runsList.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { servableLeaf } from "@melite/contracts/mediaKinds";
|
|
2
|
+
import { ARCHIVED_DIR_NAME } from "@melite/contracts/mediaKinds";
|
|
2
3
|
import { draftIdOf } from "@melite/contracts/benchStage";
|
|
3
4
|
// runsList.ts — the runs LIST surface (REBUILD-7, gateway kill):
|
|
4
5
|
// the retired runs door's list arm (GET /v1/flows/runs, the restore port) re-homed verbatim into the queue package as the registry's `list` business arm.
|
|
@@ -35,6 +36,21 @@ export function sidecarNum(text, key, dflt) {
|
|
|
35
36
|
return dflt;
|
|
36
37
|
return parseLeadingInt(text.slice(i + needle.length));
|
|
37
38
|
}
|
|
39
|
+
/** sidecar_bool: first `"key":`, skip spaces/tabs, expect the
|
|
40
|
+
* `true`/`false` literal — default when the key is absent or
|
|
41
|
+
* non-boolean (never guessed; a torn write reads the default). */
|
|
42
|
+
export function sidecarBool(text, key, dflt) {
|
|
43
|
+
const needle = '"' + key + '":';
|
|
44
|
+
const i = text.indexOf(needle);
|
|
45
|
+
if (i < 0)
|
|
46
|
+
return dflt;
|
|
47
|
+
const tail = text.slice(i + needle.length).replace(/^[ \t]+/, "");
|
|
48
|
+
if (tail.startsWith("true"))
|
|
49
|
+
return true;
|
|
50
|
+
if (tail.startsWith("false"))
|
|
51
|
+
return false;
|
|
52
|
+
return dflt;
|
|
53
|
+
}
|
|
38
54
|
/** sidecar_str: BYTE-wise exact — first `"key":`, skip spaces/tabs, expect `"`, decode \\n \\r \\t \" \\ (any other escape lands literally — \u stays "u"), stop at cap-1 BYTES. Operates on the UTF-8 bytes (D5). */
|
|
39
55
|
export function sidecarStr(raw, key, cap) {
|
|
40
56
|
const pat = Buffer.from('"' + key + '":', "utf8");
|
|
@@ -250,6 +266,83 @@ export function runArtifacts(runDir, outDirLiteral) {
|
|
|
250
266
|
|
|
251
267
|
|
|
252
268
|
|
|
269
|
+
export function runArchivedArtifacts(runDir, outDirLiteral) {
|
|
270
|
+
const runBase = (() => {
|
|
271
|
+
const stripped = outDirLiteral.replace(/\/+$/, "");
|
|
272
|
+
const slash = stripped.lastIndexOf("/");
|
|
273
|
+
return slash >= 0 ? stripped.slice(slash + 1) : stripped;
|
|
274
|
+
})();
|
|
275
|
+
const out = [];
|
|
276
|
+
const push = (rel, full) => {
|
|
277
|
+
const base = rel.includes("/")
|
|
278
|
+
? rel.slice(rel.lastIndexOf("/") + 1)
|
|
279
|
+
: rel;
|
|
280
|
+
const t = artifactType(base);
|
|
281
|
+
if (t !== "image" && t !== "video" && t !== "audio" && t !== "model" && t !== "text")
|
|
282
|
+
return;
|
|
283
|
+
const size = fileSize(full);
|
|
284
|
+
if (size < 0)
|
|
285
|
+
return;
|
|
286
|
+
out.push({
|
|
287
|
+
name: base,
|
|
288
|
+
path: outDirLiteral + "/" + ARCHIVED_DIR_NAME + "/" + rel,
|
|
289
|
+
bytes: size,
|
|
290
|
+
url: runBase + "/" + ARCHIVED_DIR_NAME + "/" + rel,
|
|
291
|
+
type: t,
|
|
292
|
+
size,
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
let tops;
|
|
296
|
+
try {
|
|
297
|
+
tops = readdirSync(join(runDir, ARCHIVED_DIR_NAME));
|
|
298
|
+
}
|
|
299
|
+
catch {
|
|
300
|
+
return [];
|
|
301
|
+
}
|
|
302
|
+
tops.sort(byteLess);
|
|
303
|
+
const subs = [];
|
|
304
|
+
for (const name of tops) {
|
|
305
|
+
if (!servableLeaf(name))
|
|
306
|
+
continue;
|
|
307
|
+
const full = join(runDir, ARCHIVED_DIR_NAME, name);
|
|
308
|
+
if (isDir(full))
|
|
309
|
+
subs.push(name);
|
|
310
|
+
else
|
|
311
|
+
push(name, full);
|
|
312
|
+
}
|
|
313
|
+
subs.sort(byteLess);
|
|
314
|
+
for (const sub of subs) {
|
|
315
|
+
let inner;
|
|
316
|
+
try {
|
|
317
|
+
inner = readdirSync(join(runDir, ARCHIVED_DIR_NAME, sub));
|
|
318
|
+
}
|
|
319
|
+
catch {
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
inner.sort(byteLess);
|
|
323
|
+
for (const name of inner) {
|
|
324
|
+
if (!servableLeaf(name))
|
|
325
|
+
continue;
|
|
326
|
+
const full = join(runDir, ARCHIVED_DIR_NAME, sub, name);
|
|
327
|
+
if (isDir(full))
|
|
328
|
+
continue;
|
|
329
|
+
push(sub + "/" + name, full);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return out;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
253
346
|
|
|
254
347
|
export function runThumbnail(runDir, runId) {
|
|
255
348
|
try {
|
|
@@ -332,8 +425,14 @@ export function runDirHasMedia(runDir) {
|
|
|
332
425
|
// The estate's own emitter half (runArtifacts in this file) counts "model" rows as listable media, mediaKinds.ts carries the galleryModel set, and the img-to-mesh lane is the first producer of model-only runs.
|
|
333
426
|
// Keeping the image-era refusal would drop every completed model run from the restore port (runs/list) — and with it runs/list adoption (fetchLatestRunForDraft) — so the row gate admits "model" alongside the triple.
|
|
334
427
|
const RUN_ID_RE = /^run-[A-Za-z0-9_.@-]+$/;
|
|
335
|
-
// NOT runsTypes.ts's exported RUN_STATUSES: this set is the list-side
|
|
428
|
+
// NOT runsTypes.ts's exported RUN_STATUSES: this set is the list-side
|
|
429
|
+
// vocabulary (adds success/unknown, drops stopping — the C-contract fold
|
|
430
|
+
|
|
431
|
+
// sidecar word serves VERBATIM on the row (the read never folds queued
|
|
432
|
+
// into a terminal word, and refusing the row would vanish a queued run
|
|
433
|
+
// from the very face that must show it — the burn's neighbor defect).
|
|
336
434
|
const RUN_STATUS = new Set([
|
|
435
|
+
"queued",
|
|
337
436
|
"running",
|
|
338
437
|
"completed",
|
|
339
438
|
"failed",
|
|
@@ -388,6 +487,10 @@ export function runRowOrNull(row) {
|
|
|
388
487
|
if (!artifactRowOk(a))
|
|
389
488
|
return null;
|
|
390
489
|
}
|
|
490
|
+
for (const a of row.archived ?? []) {
|
|
491
|
+
if (!artifactRowOk(a))
|
|
492
|
+
return null;
|
|
493
|
+
}
|
|
391
494
|
// a half-shaped truncation verdict refuses the row whole (the
|
|
392
495
|
// gate's own law: never serve a shape it cannot vouch for)
|
|
393
496
|
if (row.truncated !== undefined
|
|
@@ -406,11 +509,18 @@ export function runRowOrNull(row) {
|
|
|
406
509
|
params: row.params,
|
|
407
510
|
draft_id: row.draft_id,
|
|
408
511
|
...(row.stage_ids !== undefined && row.stage_ids.length > 0 ? { stage_ids: [...row.stage_ids] } : {}),
|
|
512
|
+
// THE BENCH INCARNATION rides beside the digest it joins with
|
|
513
|
+
// (W-3 / F3-11); absent stamps stay absent.
|
|
514
|
+
...(typeof row.bench_epoch === "string" && row.bench_epoch !== "" ? { bench_epoch: row.bench_epoch } : {}),
|
|
409
515
|
...(typeof row.export_name === "string" && row.export_name !== "" ? { export_name: row.export_name } : {}),
|
|
410
516
|
...(typeof row.export_path === "string" && row.export_path !== "" ? { export_path: row.export_path } : {}),
|
|
411
517
|
...(row.truncated !== undefined && isIntGe0(row.truncated.listed) && isIntGe0(row.truncated.total)
|
|
412
518
|
? { truncated: { listed: row.truncated.listed, total: row.truncated.total } }
|
|
413
519
|
: {}),
|
|
520
|
+
...(row.archived !== undefined && row.archived.length > 0 ? { archived: row.archived } : {}),
|
|
521
|
+
// the TEST STAMP rides ALWAYS (the live face's law — a missing
|
|
522
|
+
// key would read as "unstamped", never as production).
|
|
523
|
+
test: row.test === true,
|
|
414
524
|
};
|
|
415
525
|
}
|
|
416
526
|
/** Strict int parse: surrounding whitespace stripped, one optional
|
|
@@ -436,6 +546,22 @@ export function firstQuery(qs, name, dflt) {
|
|
|
436
546
|
}
|
|
437
547
|
return dflt;
|
|
438
548
|
}
|
|
549
|
+
/** The filter's row law: every STATED key must hold on the served
|
|
550
|
+
* row (AND, never OR). Absent filter serves every row. */
|
|
551
|
+
function runsFilterServes(row, filter) {
|
|
552
|
+
if (filter.draftId !== undefined && row["draft_id"] !== filter.draftId)
|
|
553
|
+
return false;
|
|
554
|
+
if (filter.benchStageId !== undefined) {
|
|
555
|
+
const ids = row["stage_ids"];
|
|
556
|
+
|
|
557
|
+
// Array.isArray narrows unknown to any[] — the membership test
|
|
558
|
+
// needs no cast, and a cast here would mint a new as-unknown
|
|
559
|
+
// site the census refuses.
|
|
560
|
+
if (!Array.isArray(ids) || !ids.includes(filter.benchStageId))
|
|
561
|
+
return false;
|
|
562
|
+
}
|
|
563
|
+
return true;
|
|
564
|
+
}
|
|
439
565
|
const scanCache = new Map();
|
|
440
566
|
function mtimeMsOf(path) {
|
|
441
567
|
try {
|
|
@@ -480,31 +606,38 @@ function scanRunEnt(runDir) {
|
|
|
480
606
|
return ent;
|
|
481
607
|
}
|
|
482
608
|
function scanRunsRoot(stateRoot) {
|
|
483
|
-
//
|
|
484
|
-
//
|
|
485
|
-
const outputRoot = join(stateRoot, "output");
|
|
486
|
-
let names;
|
|
487
|
-
try {
|
|
488
|
-
names = readdirSync(outputRoot);
|
|
489
|
-
}
|
|
490
|
-
catch {
|
|
491
|
-
names = [];
|
|
492
|
-
}
|
|
609
|
+
// BOTH out seats (the visible-bench law): production first, then
|
|
610
|
+
// test — a same-id collision serves production.
|
|
493
611
|
const ents = [];
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
612
|
+
const seen = new Set();
|
|
613
|
+
for (const seat of ["output", "test-output"]) {
|
|
614
|
+
const seatRoot = join(stateRoot, seat);
|
|
615
|
+
let names;
|
|
616
|
+
try {
|
|
617
|
+
names = readdirSync(seatRoot);
|
|
618
|
+
}
|
|
619
|
+
catch {
|
|
501
620
|
continue;
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
621
|
+
}
|
|
622
|
+
for (const name of names) {
|
|
623
|
+
if (ents.length >= 8192)
|
|
624
|
+
break; // the C's 8192 collected cap
|
|
625
|
+
if (!name.startsWith("run-"))
|
|
626
|
+
continue;
|
|
627
|
+
if (seen.has(name))
|
|
628
|
+
continue;
|
|
629
|
+
seen.add(name);
|
|
630
|
+
const ent = scanRunEnt(join(seatRoot, name));
|
|
631
|
+
if (ent === undefined)
|
|
632
|
+
continue;
|
|
633
|
+
ents.push({
|
|
634
|
+
dir: name,
|
|
635
|
+
created: ent.created,
|
|
636
|
+
media: ent.media,
|
|
637
|
+
root: stateRoot,
|
|
638
|
+
seat,
|
|
639
|
+
});
|
|
640
|
+
}
|
|
508
641
|
}
|
|
509
642
|
return ents;
|
|
510
643
|
}
|
|
@@ -535,19 +668,33 @@ async function buildRunCard(outputRoot, ent, hasDraft) {
|
|
|
535
668
|
let prompt = "";
|
|
536
669
|
let draft = "";
|
|
537
670
|
let stageIdsRaw = "";
|
|
671
|
+
// THE BENCH INCARNATION (W-3 / F3-11): "" = the sidecar named no
|
|
672
|
+
// epoch (pre-cure run) — the row key stays absent, never guessed.
|
|
673
|
+
let benchEpoch = "";
|
|
538
674
|
let exported = "";
|
|
539
675
|
let exportedPath = "";
|
|
540
676
|
let seed = -1;
|
|
677
|
+
// THE TEST FLAG, READ (visible-bench law): the row's own
|
|
678
|
+
// sidecar names the seat it rode — the writer persists `test`
|
|
679
|
+
// (queueSidecar's IDENTITY KEYS); absent reads production for
|
|
680
|
+
// pre-cure trees, and NO sidecar (ENOENT) is production, same
|
|
681
|
+
// as the completed-run default above.
|
|
682
|
+
let testFlag = false;
|
|
541
683
|
let created = ent.created;
|
|
542
684
|
const rawBytes = buf === null ? Buffer.alloc(0) : Buffer.from(buf, "utf8");
|
|
543
685
|
if (buf !== null) {
|
|
544
686
|
// found-ness matters: absent key -> "unknown" (served); present-but-empty -> "" (gate-skipped).
|
|
545
687
|
const [foundStatus, rawStatus] = sidecarStrFound(rawBytes, "status", 16);
|
|
546
688
|
if (foundStatus) {
|
|
689
|
+
|
|
690
|
+
// word (queued/running) carries VERBATIM until the settle
|
|
691
|
+
// rewrites the sidecar — the read never stamps a terminal word
|
|
692
|
+
// on a non-terminal run. The burn: a queue-window read served
|
|
693
|
+
// "failed" (the old disk-only zombie override) while run_status
|
|
694
|
+
// said "completed" — the artifact was real. Zombies are the
|
|
695
|
+
// boot sweep's (queueSweep.bootSweep), not a read-time guess.
|
|
696
|
+
// "error" stays the one lawful normalization (terminal word).
|
|
547
697
|
status = rawStatus === "error" ? "failed" : rawStatus;
|
|
548
|
-
// read-time zombie override (sweep=False: report only, D1).
|
|
549
|
-
if (status === "running")
|
|
550
|
-
status = "failed";
|
|
551
698
|
}
|
|
552
699
|
else {
|
|
553
700
|
status = "unknown";
|
|
@@ -559,6 +706,14 @@ async function buildRunCard(outputRoot, ent, hasDraft) {
|
|
|
559
706
|
// absent on pre-digest sidecars (the export_name precedent:
|
|
560
707
|
// optional key, never guessed).
|
|
561
708
|
stageIdsRaw = sidecarStr(rawBytes, "stage_ids", 512);
|
|
709
|
+
|
|
710
|
+
// draft doc's `epoch` at press rides the identity prefix — the
|
|
711
|
+
// bench read's join requires equality alongside draft_id, so a
|
|
712
|
+
// post-clear read binds only post-clear runs. Additive optional
|
|
713
|
+
// key (the export_path law): absent on pre-cure sidecars, never
|
|
714
|
+
// guessed.
|
|
715
|
+
const [foundEpoch, rawEpoch] = sidecarStrFound(rawBytes, "bench_epoch", 96);
|
|
716
|
+
benchEpoch = foundEpoch ? rawEpoch : "";
|
|
562
717
|
// THE EXPORT NAME, LISTED (023's self-critique #4/#6): the
|
|
563
718
|
// design lane's mint rides the list row too — additive, same
|
|
564
719
|
// spelling as the sidecar; absent on non-export runs.
|
|
@@ -568,13 +723,14 @@ async function buildRunCard(outputRoot, ent, hasDraft) {
|
|
|
568
723
|
// root is long, so the slice budget doubles the name's.
|
|
569
724
|
exportedPath = sidecarStr(rawBytes, "export_path", 256);
|
|
570
725
|
seed = sidecarNum(buf, "seed", -1);
|
|
726
|
+
testFlag = sidecarBool(buf, "test", false);
|
|
571
727
|
const at = buf.indexOf('"created_at":');
|
|
572
728
|
if (at >= 0)
|
|
573
729
|
created = parseLeadingInt(buf.slice(at + 13));
|
|
574
730
|
}
|
|
575
731
|
if (pipeline.startsWith("_"))
|
|
576
732
|
return null; // user-surface law
|
|
577
|
-
const literal = "./
|
|
733
|
+
const literal = "./" + ent.seat + "/" + ent.dir;
|
|
578
734
|
const arts = runArtifacts(runDir, literal);
|
|
579
735
|
|
|
580
736
|
// rides the artifact list's tail, but the panel's capped counter
|
|
@@ -582,6 +738,11 @@ async function buildRunCard(outputRoot, ent, hasDraft) {
|
|
|
582
738
|
// so a 3-of-6 listing never reads as complete (the grid says a
|
|
583
739
|
// product is missing).
|
|
584
740
|
const truncMarker = arts.find((a) => a["truncated"] === true);
|
|
741
|
+
// THE ARCHIVED FACE (mass-archive law): the tuck's rows ride the
|
|
742
|
+
// row beside the live list — the live walk never sees them (the
|
|
743
|
+
// `_archived/` dir fails the servable law at the top level), so
|
|
744
|
+
// this second sweep is the only reader that opens that dir.
|
|
745
|
+
const archivedArts = runArchivedArtifacts(runDir, literal);
|
|
585
746
|
const built = runRowOrNull({
|
|
586
747
|
run_id: ent.dir,
|
|
587
748
|
name: pipeline,
|
|
@@ -595,11 +756,17 @@ async function buildRunCard(outputRoot, ent, hasDraft) {
|
|
|
595
756
|
...(truncMarker !== undefined
|
|
596
757
|
? { truncated: { listed: truncMarker["listed"], total: truncMarker["total"] } }
|
|
597
758
|
: {}),
|
|
759
|
+
...(archivedArts.length > 0 ? { archived: archivedArts } : {}),
|
|
598
760
|
params: { seed },
|
|
599
761
|
draft_id: draft,
|
|
600
762
|
...(stageIdsRaw !== "" ? { stage_ids: stageIdsRaw.split(",") } : {}),
|
|
763
|
+
// THE BENCH INCARNATION, LISTED (W-3 / F3-11): beside the digest
|
|
764
|
+
// it stamps — the bench read's join half. Absent stamps stay
|
|
765
|
+
// absent (the export_name law).
|
|
766
|
+
...(benchEpoch !== "" ? { bench_epoch: benchEpoch } : {}),
|
|
601
767
|
...(exported !== "" ? { export_name: exported } : {}),
|
|
602
768
|
...(exportedPath !== "" ? { export_path: exportedPath } : {}),
|
|
769
|
+
test: testFlag,
|
|
603
770
|
});
|
|
604
771
|
if (built === null)
|
|
605
772
|
return null; // user-surface / RESILIENCE LAW loud skip — never cached
|
|
@@ -653,10 +820,10 @@ async function applyDraftOverlay(row, hasDraft) {
|
|
|
653
820
|
}
|
|
654
821
|
return served;
|
|
655
822
|
}
|
|
656
|
-
/** The runs-list envelope (the restore port): the
|
|
823
|
+
/** The runs-list envelope (the restore port): the BOTH-SEATS scan per root (visible-bench law), media-first + newest sort, the limit sliced off the merged order, the limit parsed (raw STRING — the lane/remote pass the raw text; underscores parse, non-ints refuse), refused cards SKIPPED but counted. */
|
|
657
824
|
/** url/thumbnail are run-RELATIVE (the /v1/assets prefix died with the app — the header's law). */
|
|
658
|
-
export async function listRuns(stateRoot, limit, hasDraft) {
|
|
659
|
-
return listRunsAcross([stateRoot], limit, hasDraft);
|
|
825
|
+
export async function listRuns(stateRoot, limit, hasDraft, filter) {
|
|
826
|
+
return listRunsAcross([stateRoot], limit, hasDraft, filter);
|
|
660
827
|
}
|
|
661
828
|
|
|
662
829
|
|
|
@@ -665,7 +832,12 @@ export async function listRuns(stateRoot, limit, hasDraft) {
|
|
|
665
832
|
|
|
666
833
|
|
|
667
834
|
|
|
668
|
-
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
export async function listRunsAcross(roots, limit, hasDraft, filter) {
|
|
669
841
|
const ents = [];
|
|
670
842
|
for (const root of roots)
|
|
671
843
|
ents.push(...scanRunsRoot(root));
|
|
@@ -677,18 +849,27 @@ export async function listRunsAcross(roots, limit, hasDraft) {
|
|
|
677
849
|
return am - bm;
|
|
678
850
|
return b.created - a.created; // newest-first; stable
|
|
679
851
|
});
|
|
680
|
-
|
|
852
|
+
// THE RUNS-PER-DRAFT DOOR (the stale-two-run chat audit's cure 3,
|
|
853
|
+
|
|
854
|
+
// first-root-wins dedup intact) and slices AFTER the filter — the
|
|
855
|
+
// window is the draft's own tail, never the global limit's (a
|
|
856
|
+
// draft's older takes survive a foreign newer run). Absent filter:
|
|
857
|
+
// the restore port's path unchanged — sliced before build.
|
|
858
|
+
const filtered = filter !== undefined && (filter.draftId !== undefined || filter.benchStageId !== undefined);
|
|
859
|
+
const scanned = filtered ? ents : ents.slice(0, limit);
|
|
681
860
|
const seen = new Set();
|
|
682
861
|
const rows = [];
|
|
683
|
-
for (const ent of
|
|
862
|
+
for (const ent of scanned) {
|
|
684
863
|
if (seen.has(ent.dir))
|
|
685
864
|
continue; // first manifest root wins
|
|
686
865
|
seen.add(ent.dir);
|
|
687
|
-
const row = await buildRunCard(join(ent.root,
|
|
866
|
+
const row = await buildRunCard(join(ent.root, ent.seat), ent, hasDraft);
|
|
688
867
|
if (row === null)
|
|
689
868
|
continue; // RESILIENCE LAW: loud skip
|
|
869
|
+
if (filtered && !runsFilterServes(row, filter))
|
|
870
|
+
continue;
|
|
690
871
|
rows.push({ ...row, served_from: ent.root });
|
|
691
872
|
}
|
|
692
|
-
return { count, runs: rows };
|
|
873
|
+
return { count, runs: filtered ? rows.slice(0, limit) : rows };
|
|
693
874
|
}
|
|
694
875
|
//# sourceMappingURL=runsList.js.map
|
package/lib/runsRegistry.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Service } from "@deepseek-ai/cordis";
|
|
|
2
2
|
import type { Context } from "@deepseek-ai/cordis";
|
|
3
3
|
import type { RunId } from "./queueCore.js";
|
|
4
4
|
export { toRemoteError } from "./runsRefusalVoices.js";
|
|
5
|
+
import { type Phase1Card } from "./cardsRegistry.js";
|
|
5
6
|
import type { FlowsValidateAnswer } from "./runsValidate.js";
|
|
6
7
|
import type { RunRecord } from "./runsTypes.js";
|
|
7
8
|
/** THE START SUMMARY (the door's answer face): what start() and the
|
|
@@ -244,6 +245,7 @@ export declare class RunsRuntimeService extends Service {
|
|
|
244
245
|
|
|
245
246
|
|
|
246
247
|
|
|
248
|
+
|
|
247
249
|
private composeRegistryFlowStages;
|
|
248
250
|
private composeBenchStages;
|
|
249
251
|
start(doc: unknown, signal: AbortSignal,
|
|
@@ -253,6 +255,27 @@ export declare class RunsRuntimeService extends Service {
|
|
|
253
255
|
reuse?: {
|
|
254
256
|
runId: RunId;
|
|
255
257
|
}): Promise<PressStartSummary>;
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
private ledgerPressRefused;
|
|
278
|
+
private startInner;
|
|
256
279
|
/** THE SWEEP START (friction #9's fan-out): one press, N seeds —
|
|
257
280
|
* each seed its own run, all under one shared run-id prefix.
|
|
258
281
|
* Every per-run law rides startReserved unchanged (phase gates,
|
|
@@ -301,8 +324,12 @@ export declare class RunsRuntimeService extends Service {
|
|
|
301
324
|
/** The list arm (REBUILD-7): the restore-port envelope over the
|
|
302
325
|
* output roots. The raw limit STRING rides from the lane (strict
|
|
303
326
|
* int() semantics: underscores parse, junk refuses). The drafts
|
|
304
|
-
* probe rides the drafts remote.
|
|
305
|
-
|
|
327
|
+
* probe rides the drafts remote. The optional draft/stage
|
|
328
|
+
* filters (the stale-two-run chat audit's cure 3 — runsList.ts
|
|
329
|
+
* RunsListFilter) narrow the served rows to one draft's takes;
|
|
330
|
+
* an empty string reads ABSENT (the parse_qs blank law), never
|
|
331
|
+
* as a match against the empty id. */
|
|
332
|
+
list(rawLimit: string, signal: AbortSignal, draftId?: string, benchStageId?: string): Promise<{
|
|
306
333
|
count: number;
|
|
307
334
|
runs: Record<string, unknown>[];
|
|
308
335
|
}>;
|
|
@@ -320,6 +347,31 @@ export declare class RunsRuntimeService extends Service {
|
|
|
320
347
|
* unreachable, stats unparseable) returns none — admission never
|
|
321
348
|
* blocks on a stats read. */
|
|
322
349
|
filmAdmissionWarnings(cardId: string, body: Record<string, unknown>): Promise<string[]>;
|
|
350
|
+
/** THE CHAIN-STORE RUN-ID DOOR (the F35 write side, session 2): an
|
|
351
|
+
* h3-timeline doc's upscale entry may bind its source by ESTATE
|
|
352
|
+
* RUN ID — resolved HERE, before compose, through the run row the
|
|
353
|
+
* harvest registrar stamped (result_outputs.chain_store.run_name),
|
|
354
|
+
* so the composed manager carries a BARE STORE NAME and the
|
|
355
|
+
* execute door's existing law (gates-h3-chain-selection-door)
|
|
356
|
+
* keeps judging name→store — one judge per edge. A store-spelling
|
|
357
|
+
* binding (swap_…/picture_… — anything off the run-id grammar)
|
|
358
|
+
* passes byte-untouched with ZERO registry reads: the store stays
|
|
359
|
+
* the only existence truth, judged where it is already walled. An
|
|
360
|
+
* id-grammar spelling with no row — or a row whose stages carry no
|
|
361
|
+
* chain_store — refuses LOUD at this door naming the plain-film
|
|
362
|
+
* law, never the execute door's typo-reading 404 (the run row,
|
|
363
|
+
* not the store, answers "was this a chain run"). The determinism
|
|
364
|
+
* corner: the grammar resolves through the registry ONLY and never
|
|
365
|
+
* falls through to the store, so a store literally named like a
|
|
366
|
+
* run id binds by its exact spelling only when it does NOT match
|
|
367
|
+
* the grammar. Runs between phase 1 (the doc validated) and phase
|
|
368
|
+
* 2 (the graph composed) — a refusal names the field, never a
|
|
369
|
+
* zombie slot. */
|
|
370
|
+
resolveUpscaleChainRunIds(p1: Phase1Card): Phase1Card;
|
|
371
|
+
/** The store name a run row carries (the registrar's stamp), or
|
|
372
|
+
* null: the live map first, the durable _flow.json on its miss —
|
|
373
|
+
* the same two faces the status door reads. */
|
|
374
|
+
private chainStoreNameOf;
|
|
323
375
|
status(runId: string, signal: AbortSignal, includeLog?: boolean): Promise<Record<string, unknown>>;
|
|
324
376
|
stop(runId: string, signal: AbortSignal): Promise<Record<string, unknown>>;
|
|
325
377
|
/** The live map (the queue seat's core registry — rich rows). */
|
|
@@ -421,7 +473,10 @@ export declare class RunsRuntimeService extends Service {
|
|
|
421
473
|
* The result face: run_id always; the run-relative media url of the
|
|
422
474
|
* stage's own output when one exists (the husk clobber's other
|
|
423
475
|
* half — a bookkeeping mirror never blanks a hero it can name); the
|
|
424
|
-
* error voice
|
|
476
|
+
* error voice is the stage's OWN error, never the run's — the
|
|
477
|
+
* pass-level cause rides the run doc (run_status answers for the
|
|
478
|
+
* pass), and a row that borrowed it would name another stage's
|
|
479
|
+
* cause (qa8 F43, the per-row status law). */
|
|
425
480
|
export declare function settleMirrorPatches(run: RunRecord): Array<{
|
|
426
481
|
stageId: string;
|
|
427
482
|
patch: Record<string, unknown>;
|