@melite/estate-queue 0.1.5-pre-alpha → 0.2.0-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +561 -457
- package/lib/cardsArmError.d.ts +52 -3
- package/lib/cardsArmError.js +7 -1
- package/lib/cardsCompose.js +43 -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 +102 -5
- package/lib/cardsRegistry.js +668 -45
- package/lib/cardsVariant.d.ts +12 -7
- package/lib/cardsVariant.js +196 -58
- package/lib/discloseRegistry.d.ts +36 -6
- package/lib/discloseRegistry.js +153 -15
- package/lib/filmLead.js +5 -3
- package/lib/flowsData.d.ts +1 -1
- package/lib/flowsData.js +7 -4
- package/lib/flowsFamilyCompose.js +12 -1
- package/lib/flowsRegistryRows.d.ts +1 -0
- package/lib/flowsRegistryRows.js +193 -35
- package/lib/index.d.ts +1 -0
- package/lib/index.js +6 -0
- package/lib/loadPlane.js +9 -0
- package/lib/manageOps.js +2 -1
- package/lib/managePlane.d.ts +11 -1
- package/lib/managePlane.js +559 -24
- package/lib/managePreflight.d.ts +26 -0
- package/lib/managePreflight.js +179 -0
- package/lib/manageProbe.d.ts +17 -0
- package/lib/manageProbe.js +61 -1
- package/lib/queueCore.d.ts +14 -1
- package/lib/queueCore.js +13 -0
- package/lib/queueResurrect.d.ts +7 -2
- package/lib/queueResurrect.js +25 -6
- package/lib/queueSidecar.d.ts +110 -1
- package/lib/queueSidecar.js +177 -7
- package/lib/queueSubmit.d.ts +67 -4
- package/lib/queueSubmit.js +133 -4
- package/lib/runsErrorCodes.js +5 -3
- package/lib/runsExecute.js +44 -4
- package/lib/runsGates.d.ts +5 -1
- package/lib/runsGates.js +6 -2
- package/lib/runsList.d.ts +43 -3
- package/lib/runsList.js +159 -39
- package/lib/runsRefusalVoices.js +50 -1
- package/lib/runsRegistry.d.ts +84 -6
- package/lib/runsRegistry.js +515 -105
- package/lib/runsStart.d.ts +24 -3
- package/lib/runsStart.js +128 -13
- package/lib/runsTypes.d.ts +27 -2
- package/lib/runsTypes.js +23 -6
- package/lib/runsValidateServe.js +20 -10
- package/lib/runsValidateShared.d.ts +9 -0
- package/lib/runsValidateShared.js +14 -0
- package/lib/runsValidateStages.js +21 -9
- package/lib/runtimeProvision.d.ts +119 -0
- package/lib/runtimeProvision.js +243 -0
- package/lib/skillRows.js +7 -2
- package/package.json +18 -18
package/lib/runsList.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type DraftId } from "@melite/contracts/benchStage";
|
|
1
2
|
/** Leading-int read (sidecar tails): optional space, optional
|
|
2
3
|
* sign, then digits; 0 when no digits lead. */
|
|
3
4
|
export declare function parseLeadingInt(s: string): number;
|
|
@@ -17,7 +18,19 @@ export declare function mediaCandidates(runDir: string): MediaCand[];
|
|
|
17
18
|
/** run_artifacts: image/video/audio/model rows (image capped at _MAX_IMGS — counted but unlisted past it), everything else skipped; the {truncated,listed,total} marker when entries went unlisted. */
|
|
18
19
|
/** path keeps the "./output/<run>/" literal. */
|
|
19
20
|
export declare function runArtifacts(runDir: string, outDirLiteral: string): Record<string, unknown>[];
|
|
20
|
-
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
21
34
|
export declare function runThumbnail(runDir: string, runId: string): string;
|
|
22
35
|
/** _run_dir_has_media: the media-FIRST sort key — top-level names, then one level down. */
|
|
23
36
|
/** NOTE the absences: NO `_` skip (a lone `_poster.jpg` counts), NO inner isdir check (a nested DIR named x.mp4 counts) — probed live, mirrored exactly. */
|
|
@@ -48,6 +61,14 @@ export declare function runRowOrNull(row: {
|
|
|
48
61
|
* engine-reported minted .qvoice absolute path; older sidecars
|
|
49
62
|
* predate it, load lanes stamp nothing. */
|
|
50
63
|
export_path?: string;
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
truncated?: {
|
|
69
|
+
listed: number;
|
|
70
|
+
total: number;
|
|
71
|
+
};
|
|
51
72
|
}): Record<string, unknown> | null;
|
|
52
73
|
/** Strict int parse: surrounding whitespace stripped, one optional
|
|
53
74
|
* sign, ASCII digits with single internal underscores ("1_0" ->
|
|
@@ -57,9 +78,28 @@ export declare function parseIntOrNull(s: string): number | null;
|
|
|
57
78
|
* value wins; the shared ctx parseQuery keeps blanks, so the
|
|
58
79
|
* filter lives here (parse_qs default). */
|
|
59
80
|
export declare function firstQuery(qs: Record<string, string[]>, name: string, dflt: string): string;
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
export declare function noteRunTreeChanged(mutatedPath: string): void;
|
|
60
100
|
/** The runs-list envelope (the restore port): the output-root scan, media-first + newest sort, the limit parse (raw STRING — the lane/remote pass the raw text; underscores parse, non-ints refuse), refused cards SKIPPED but counted. */
|
|
61
101
|
/** url/thumbnail are run-RELATIVE (the /v1/assets prefix died with the app — the header's law). */
|
|
62
|
-
export declare function listRuns(stateRoot: string, limit: number, hasDraft: (draftId:
|
|
102
|
+
export declare function listRuns(stateRoot: string, limit: number, hasDraft: (draftId: DraftId) => Promise<boolean>): Promise<{
|
|
63
103
|
count: number;
|
|
64
104
|
runs: Record<string, unknown>[];
|
|
65
105
|
}>;
|
|
@@ -70,7 +110,7 @@ export declare function listRuns(stateRoot: string, limit: number, hasDraft: (dr
|
|
|
70
110
|
|
|
71
111
|
|
|
72
112
|
|
|
73
|
-
export declare function listRunsAcross(roots: string[], limit: number, hasDraft: (draftId:
|
|
113
|
+
export declare function listRunsAcross(roots: string[], limit: number, hasDraft: (draftId: DraftId) => Promise<boolean>): Promise<{
|
|
74
114
|
count: number;
|
|
75
115
|
runs: Record<string, unknown>[];
|
|
76
116
|
}>;
|
package/lib/runsList.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { servableLeaf } from "@melite/contracts/mediaKinds";
|
|
2
|
+
import { draftIdOf } from "@melite/contracts/benchStage";
|
|
2
3
|
// runsList.ts — the runs LIST surface (REBUILD-7, gateway kill):
|
|
3
4
|
// 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.
|
|
4
5
|
// The sidecar byte-surgery helpers are the door's own bodies, second move unchanged (the section notes below name the reader each helper implements).
|
|
@@ -237,19 +238,45 @@ export function runArtifacts(runDir, outDirLiteral) {
|
|
|
237
238
|
: [named.find((art) => art['name'] === film), ...named.filter((art) => art['name'] !== film)];
|
|
238
239
|
return marker === undefined ? ordered : [...ordered, marker];
|
|
239
240
|
}
|
|
240
|
-
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
241
254
|
export function runThumbnail(runDir, runId) {
|
|
242
255
|
try {
|
|
243
256
|
statSync(join(runDir, "_poster.jpg"));
|
|
244
257
|
return runId + "/_poster.jpg";
|
|
245
258
|
}
|
|
246
259
|
catch {
|
|
247
|
-
/* no poster — fall through to
|
|
260
|
+
/* no poster — fall through to the deliverable law */
|
|
261
|
+
}
|
|
262
|
+
const cands = mediaCandidates(runDir);
|
|
263
|
+
const baseOf = (rel) => (rel.includes("/")
|
|
264
|
+
? rel.slice(rel.lastIndexOf("/") + 1)
|
|
265
|
+
: rel);
|
|
266
|
+
for (const cand of cands) {
|
|
267
|
+
const base = baseOf(cand.rel);
|
|
268
|
+
if (artifactType(base) === "video" && engineFilmName([base]) !== null) {
|
|
269
|
+
return runId + "/" + cand.rel;
|
|
270
|
+
}
|
|
248
271
|
}
|
|
249
|
-
for (const cand of
|
|
250
|
-
const base = cand.rel
|
|
251
|
-
|
|
252
|
-
|
|
272
|
+
for (const cand of cands) {
|
|
273
|
+
const base = baseOf(cand.rel);
|
|
274
|
+
if (artifactType(base) === "video") {
|
|
275
|
+
return runId + "/" + cand.rel;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
for (const cand of cands) {
|
|
279
|
+
const base = baseOf(cand.rel);
|
|
253
280
|
if (artifactType(base) === "image") {
|
|
254
281
|
return runId + "/" + cand.rel;
|
|
255
282
|
}
|
|
@@ -361,6 +388,11 @@ export function runRowOrNull(row) {
|
|
|
361
388
|
if (!artifactRowOk(a))
|
|
362
389
|
return null;
|
|
363
390
|
}
|
|
391
|
+
// a half-shaped truncation verdict refuses the row whole (the
|
|
392
|
+
// gate's own law: never serve a shape it cannot vouch for)
|
|
393
|
+
if (row.truncated !== undefined
|
|
394
|
+
&& !(isIntGe0(row.truncated.listed) && isIntGe0(row.truncated.total)))
|
|
395
|
+
return null;
|
|
364
396
|
return {
|
|
365
397
|
run_id: row.run_id,
|
|
366
398
|
name: row.name,
|
|
@@ -376,6 +408,9 @@ export function runRowOrNull(row) {
|
|
|
376
408
|
...(row.stage_ids !== undefined && row.stage_ids.length > 0 ? { stage_ids: [...row.stage_ids] } : {}),
|
|
377
409
|
...(typeof row.export_name === "string" && row.export_name !== "" ? { export_name: row.export_name } : {}),
|
|
378
410
|
...(typeof row.export_path === "string" && row.export_path !== "" ? { export_path: row.export_path } : {}),
|
|
411
|
+
...(row.truncated !== undefined && isIntGe0(row.truncated.listed) && isIntGe0(row.truncated.total)
|
|
412
|
+
? { truncated: { listed: row.truncated.listed, total: row.truncated.total } }
|
|
413
|
+
: {}),
|
|
379
414
|
};
|
|
380
415
|
}
|
|
381
416
|
/** Strict int parse: surrounding whitespace stripped, one optional
|
|
@@ -401,8 +436,49 @@ export function firstQuery(qs, name, dflt) {
|
|
|
401
436
|
}
|
|
402
437
|
return dflt;
|
|
403
438
|
}
|
|
404
|
-
|
|
405
|
-
|
|
439
|
+
const scanCache = new Map();
|
|
440
|
+
function mtimeMsOf(path) {
|
|
441
|
+
try {
|
|
442
|
+
return statSync(path).mtimeMs;
|
|
443
|
+
}
|
|
444
|
+
catch {
|
|
445
|
+
return -1;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
function scanRunEnt(runDir) {
|
|
449
|
+
// TWO KEYS, one convergence law: the DIR mtime bumps when a file
|
|
450
|
+
// lands at the top level, but a run that writes its artifacts one
|
|
451
|
+
// level down never bumps it. The SIDECAR mtime closes that hole —
|
|
452
|
+
// the registry rewrites _flow.json on every status transition, so
|
|
453
|
+
// the final write (completed) lands AFTER the last artifact
|
|
454
|
+
// wherever it went, and any sidecar rewrite re-opens the dir for
|
|
455
|
+
// one fresh scan. Warm cost per run: two stats, zero reads.
|
|
456
|
+
const dirMtime = mtimeMsOf(runDir);
|
|
457
|
+
const flowMtime = mtimeMsOf(join(runDir, "_flow.json"));
|
|
458
|
+
if (dirMtime < 0 && flowMtime < 0)
|
|
459
|
+
return undefined;
|
|
460
|
+
const hit = scanCache.get(runDir);
|
|
461
|
+
if (hit !== undefined && hit.dirMtime === dirMtime && hit.flowMtime === flowMtime)
|
|
462
|
+
return hit;
|
|
463
|
+
let created = 0;
|
|
464
|
+
let buf = "";
|
|
465
|
+
try {
|
|
466
|
+
buf = readFileSync(join(runDir, "_flow.json"), "utf8").slice(0, 8191);
|
|
467
|
+
}
|
|
468
|
+
catch {
|
|
469
|
+
buf = "";
|
|
470
|
+
}
|
|
471
|
+
if (buf) {
|
|
472
|
+
// created_at (sidecar) first, "created" (C fossil) fallback.
|
|
473
|
+
created = sidecarNum(buf, "created", 0);
|
|
474
|
+
const at = buf.indexOf('"created_at":');
|
|
475
|
+
if (at >= 0)
|
|
476
|
+
created = parseLeadingInt(buf.slice(at + 13));
|
|
477
|
+
}
|
|
478
|
+
const ent = { dirMtime, flowMtime, created, media: runDirHasMedia(runDir) };
|
|
479
|
+
scanCache.set(runDir, ent);
|
|
480
|
+
return ent;
|
|
481
|
+
}
|
|
406
482
|
function scanRunsRoot(stateRoot) {
|
|
407
483
|
// The PROD output root only (the door's list scanned
|
|
408
484
|
// roots.runsRoot; test runs never listed — kept 1:1).
|
|
@@ -420,40 +496,27 @@ function scanRunsRoot(stateRoot) {
|
|
|
420
496
|
break; // the C's 8192 collected cap
|
|
421
497
|
if (!name.startsWith("run-"))
|
|
422
498
|
continue;
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
try {
|
|
427
|
-
buf = readFileSync(join(runDir, "_flow.json"), "utf8").slice(0, 8191);
|
|
428
|
-
}
|
|
429
|
-
catch {
|
|
430
|
-
buf = "";
|
|
431
|
-
}
|
|
432
|
-
if (buf) {
|
|
433
|
-
// created_at (sidecar) first, "created" (C fossil) fallback.
|
|
434
|
-
created = sidecarNum(buf, "created", 0);
|
|
435
|
-
const at = buf.indexOf('"created_at":');
|
|
436
|
-
if (at >= 0)
|
|
437
|
-
created = parseLeadingInt(buf.slice(at + 13));
|
|
438
|
-
}
|
|
499
|
+
const ent = scanRunEnt(join(outputRoot, name));
|
|
500
|
+
if (ent === undefined)
|
|
501
|
+
continue;
|
|
439
502
|
ents.push({
|
|
440
503
|
dir: name,
|
|
441
|
-
created,
|
|
442
|
-
media:
|
|
504
|
+
created: ent.created,
|
|
505
|
+
media: ent.media,
|
|
443
506
|
root: stateRoot,
|
|
444
507
|
});
|
|
445
508
|
}
|
|
446
509
|
return ents;
|
|
447
510
|
}
|
|
448
|
-
|
|
449
|
-
* byte-scan → zombie override → user-surface skip → orphan-draft
|
|
450
|
-
* clearing → runRowOrNull. Null = skipped (never stored, never
|
|
451
|
-
* served — the count still counts the dir). The drafts probe is
|
|
452
|
-
* ASYNC (the drafts remote's birth-certificate face — the legacy
|
|
453
|
-
* drafts/<id>.json stat died with the drafts-door migration;
|
|
454
|
-
* orphans lose their draft link, never the row). */
|
|
511
|
+
const rowCache = new Map();
|
|
455
512
|
async function buildRunCard(outputRoot, ent, hasDraft) {
|
|
456
513
|
const runDir = join(outputRoot, ent.dir);
|
|
514
|
+
const dirMtime = mtimeMsOf(runDir);
|
|
515
|
+
const flowMtime = mtimeMsOf(join(runDir, "_flow.json"));
|
|
516
|
+
const cached = rowCache.get(runDir);
|
|
517
|
+
if (cached !== undefined && cached.dirMtime === dirMtime && cached.flowMtime === flowMtime) {
|
|
518
|
+
return applyDraftOverlay(cached.row, hasDraft);
|
|
519
|
+
}
|
|
457
520
|
let buf = null;
|
|
458
521
|
// NO sidecar (ENOENT) is the file-era completed-run law: it reads
|
|
459
522
|
// the "success" default, pinned by runs-list.spec. A sidecar that
|
|
@@ -511,11 +574,15 @@ async function buildRunCard(outputRoot, ent, hasDraft) {
|
|
|
511
574
|
}
|
|
512
575
|
if (pipeline.startsWith("_"))
|
|
513
576
|
return null; // user-surface law
|
|
514
|
-
if (draft && !(await hasDraft(draft))) {
|
|
515
|
-
draft = "";
|
|
516
|
-
}
|
|
517
577
|
const literal = "./output/" + ent.dir;
|
|
518
|
-
const
|
|
578
|
+
const arts = runArtifacts(runDir, literal);
|
|
579
|
+
|
|
580
|
+
// rides the artifact list's tail, but the panel's capped counter
|
|
581
|
+
// reads the run row's `truncated` FIELD — stamp it beside the list
|
|
582
|
+
// so a 3-of-6 listing never reads as complete (the grid says a
|
|
583
|
+
// product is missing).
|
|
584
|
+
const truncMarker = arts.find((a) => a["truncated"] === true);
|
|
585
|
+
const built = runRowOrNull({
|
|
519
586
|
run_id: ent.dir,
|
|
520
587
|
name: pipeline,
|
|
521
588
|
flow: pipeline,
|
|
@@ -524,14 +591,67 @@ async function buildRunCard(outputRoot, ent, hasDraft) {
|
|
|
524
591
|
prompt,
|
|
525
592
|
seed,
|
|
526
593
|
thumbnail: runThumbnail(runDir, ent.dir),
|
|
527
|
-
artifacts:
|
|
594
|
+
artifacts: arts,
|
|
595
|
+
...(truncMarker !== undefined
|
|
596
|
+
? { truncated: { listed: truncMarker["listed"], total: truncMarker["total"] } }
|
|
597
|
+
: {}),
|
|
528
598
|
params: { seed },
|
|
529
599
|
draft_id: draft,
|
|
530
600
|
...(stageIdsRaw !== "" ? { stage_ids: stageIdsRaw.split(",") } : {}),
|
|
531
601
|
...(exported !== "" ? { export_name: exported } : {}),
|
|
532
602
|
...(exportedPath !== "" ? { export_path: exportedPath } : {}),
|
|
533
603
|
});
|
|
534
|
-
|
|
604
|
+
if (built === null)
|
|
605
|
+
return null; // user-surface / RESILIENCE LAW loud skip — never cached
|
|
606
|
+
// TORN reads are transient (permissions, torn mid-write): caching
|
|
607
|
+
// one would freeze "unknown" while the mtimes hold. Clean reads
|
|
608
|
+
// (and absent sidecars — their APPEARANCE moves the flow key)
|
|
609
|
+
// cache.
|
|
610
|
+
if (!torn)
|
|
611
|
+
rowCache.set(runDir, { dirMtime, flowMtime, row: built });
|
|
612
|
+
return applyDraftOverlay(built, hasDraft);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
export function noteRunTreeChanged(mutatedPath) {
|
|
633
|
+
const seg = mutatedPath.split(/[/\\]+/).find((s) => RUN_ID_RE.test(s));
|
|
634
|
+
if (seg === undefined)
|
|
635
|
+
return;
|
|
636
|
+
for (const key of [...rowCache.keys()]) {
|
|
637
|
+
if (key.replace(/[/\\]+$/, "").split(/[/\\]/).pop() === seg)
|
|
638
|
+
rowCache.delete(key);
|
|
639
|
+
}
|
|
640
|
+
for (const key of [...scanCache.keys()]) {
|
|
641
|
+
if (key.replace(/[/\\]+$/, "").split(/[/\\]/).pop() === seg)
|
|
642
|
+
scanCache.delete(key);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
/** The FRESH overlay on a served row: the draft probe is registry
|
|
646
|
+
* state, never disk truth — it re-runs on every serve, mutating a
|
|
647
|
+
* CLONE so the cache never learns the probe's answer. */
|
|
648
|
+
async function applyDraftOverlay(row, hasDraft) {
|
|
649
|
+
const served = structuredClone(row);
|
|
650
|
+
const draft = served["draft_id"];
|
|
651
|
+
if (typeof draft === "string" && draft !== "" && !(await hasDraft(draftIdOf(draft)))) {
|
|
652
|
+
served["draft_id"] = "";
|
|
653
|
+
}
|
|
654
|
+
return served;
|
|
535
655
|
}
|
|
536
656
|
/** The runs-list envelope (the restore port): the output-root scan, media-first + newest sort, the limit parse (raw STRING — the lane/remote pass the raw text; underscores parse, non-ints refuse), refused cards SKIPPED but counted. */
|
|
537
657
|
/** url/thumbnail are run-RELATIVE (the /v1/assets prefix died with the app — the header's law). */
|
package/lib/runsRefusalVoices.js
CHANGED
|
@@ -19,6 +19,18 @@ function refusalEnvelopeOf(err) {
|
|
|
19
19
|
p["folders"] = [...lane.folders];
|
|
20
20
|
if (lane.fetchUrl !== undefined)
|
|
21
21
|
p["fetch_url"] = lane.fetchUrl;
|
|
22
|
+
|
|
23
|
+
// spelling is snake; every row carries the popup's download
|
|
24
|
+
// facts (slot, name, folders, declared size, fetch address).
|
|
25
|
+
if (lane.missingAll !== undefined) {
|
|
26
|
+
p["missing_all"] = lane.missingAll.map((r) => ({
|
|
27
|
+
slot: r.slot,
|
|
28
|
+
name: r.name,
|
|
29
|
+
folders: [...r.folders],
|
|
30
|
+
...(r.sizeBytes !== undefined ? { size_bytes: r.sizeBytes } : {}),
|
|
31
|
+
...(r.fetchUrl !== undefined ? { fetch_url: r.fetchUrl } : {}),
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
22
34
|
p["kind"] = lane.kind;
|
|
23
35
|
}
|
|
24
36
|
return p;
|
|
@@ -36,13 +48,49 @@ function laneDetailsOf(p) {
|
|
|
36
48
|
const kind = p["kind"];
|
|
37
49
|
if (typeof family !== "string" || typeof slot !== "string"
|
|
38
50
|
|| typeof missing !== "string" || !Array.isArray(folders)
|
|
39
|
-
|
|
51
|
+
// "runtime" rides the tool-runtime leg (E2-2 Piece A): the
|
|
52
|
+
// popup's runtime banner keys on the parsed prose, and the
|
|
53
|
+
// fold carries the row through like every other refusal's.
|
|
54
|
+
|| (kind !== "model" && kind !== "extension" && kind !== "runtime")) {
|
|
40
55
|
throw new Error("runs remote: lane_input_missing refusal lacks its structured artifact (family/slot/missing/folders/kind)");
|
|
41
56
|
}
|
|
42
57
|
const fetchUrl = p["fetch_url"];
|
|
43
58
|
const loc = p["loc"];
|
|
44
59
|
const expected = p["expected"];
|
|
45
60
|
const got = p["got"];
|
|
61
|
+
|
|
62
|
+
// malformed rows throw loud — the popup's download list keys on
|
|
63
|
+
// these fields, never on prose. Optional: the runtime leg and the
|
|
64
|
+
// in-flight arm carry no list.
|
|
65
|
+
const rawMissingAll = p["missing_all"];
|
|
66
|
+
let missingAll;
|
|
67
|
+
if (rawMissingAll !== undefined) {
|
|
68
|
+
if (!Array.isArray(rawMissingAll)) {
|
|
69
|
+
throw new Error("runs remote: lane_input_missing missing_all is not a list");
|
|
70
|
+
}
|
|
71
|
+
missingAll = rawMissingAll.map((row) => {
|
|
72
|
+
const r = row;
|
|
73
|
+
const slot = r["slot"];
|
|
74
|
+
const name = r["name"];
|
|
75
|
+
const folders = r["folders"];
|
|
76
|
+
const size = r["size_bytes"];
|
|
77
|
+
const fetch = r["fetch_url"];
|
|
78
|
+
if (typeof slot !== "string" || slot === "" || typeof name !== "string" || name === ""
|
|
79
|
+
|| !Array.isArray(folders)) {
|
|
80
|
+
throw new Error("runs remote: lane_input_missing missing_all row lacks slot/name/folders");
|
|
81
|
+
}
|
|
82
|
+
if (size !== undefined && typeof size !== "number") {
|
|
83
|
+
throw new Error("runs remote: lane_input_missing missing_all row size_bytes is not a number");
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
slot,
|
|
87
|
+
name,
|
|
88
|
+
folders: folders.filter((f) => typeof f === "string"),
|
|
89
|
+
...(typeof size === "number" ? { size_bytes: size } : {}),
|
|
90
|
+
...(typeof fetch === "string" && fetch !== "" ? { fetch_url: fetch } : {}),
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
}
|
|
46
94
|
return {
|
|
47
95
|
// THE ROW EXTENDS RunsRefusalDetails: the bench arm's loc-carry
|
|
48
96
|
// reads these three off the mapped details — a lane refusal that
|
|
@@ -55,6 +103,7 @@ function laneDetailsOf(p) {
|
|
|
55
103
|
missing,
|
|
56
104
|
folders: folders.filter((f) => typeof f === "string"),
|
|
57
105
|
...(typeof fetchUrl === "string" && fetchUrl !== "" ? { fetch_url: fetchUrl } : {}),
|
|
106
|
+
...(missingAll !== undefined ? { missing_all: missingAll } : {}),
|
|
58
107
|
kind,
|
|
59
108
|
};
|
|
60
109
|
}
|
package/lib/runsRegistry.d.ts
CHANGED
|
@@ -4,6 +4,16 @@ import type { RunId } from "./queueCore.js";
|
|
|
4
4
|
export { toRemoteError } from "./runsRefusalVoices.js";
|
|
5
5
|
import type { FlowsValidateAnswer } from "./runsValidate.js";
|
|
6
6
|
import type { RunRecord } from "./runsTypes.js";
|
|
7
|
+
/** THE START SUMMARY (the door's answer face): what start() and the
|
|
8
|
+
* concurrent-press reservation both answer with. `sweep_runs` rides
|
|
9
|
+
* ONLY a seed-sweep press (friction #9): every run id the one
|
|
10
|
+
* press minted, first seed first — absent on every single run. */
|
|
11
|
+
interface PressStartSummary {
|
|
12
|
+
run_id: string;
|
|
13
|
+
status: string;
|
|
14
|
+
queue_position: number;
|
|
15
|
+
readonly sweep_runs?: readonly string[];
|
|
16
|
+
}
|
|
7
17
|
/** The runs Remote failure codes, merged into the protocol's ONE
|
|
8
18
|
* vocabulary (cookbook §2: declaration merging, next to the
|
|
9
19
|
* throws). The codes ride kebab-cased; the byte-pinned prose
|
|
@@ -25,7 +35,21 @@ export interface LaneInputMissingDetails extends RunsRefusalDetails {
|
|
|
25
35
|
readonly missing: string;
|
|
26
36
|
readonly folders: readonly string[];
|
|
27
37
|
readonly fetch_url?: string;
|
|
28
|
-
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
readonly missing_all?: ReadonlyArray<{
|
|
43
|
+
readonly slot: string;
|
|
44
|
+
readonly name: string;
|
|
45
|
+
readonly folders: readonly string[];
|
|
46
|
+
readonly size_bytes?: number;
|
|
47
|
+
readonly fetch_url?: string;
|
|
48
|
+
}>;
|
|
49
|
+
/** "runtime" rides the tool-runtime leg (E2-2 Piece A) — the
|
|
50
|
+
* popup's runtime banner keys on the parsed prose, never on
|
|
51
|
+
* this row (there is no fetch_url for a provision command). */
|
|
52
|
+
readonly kind: "model" | "extension" | "runtime";
|
|
29
53
|
}
|
|
30
54
|
declare module "@deepseek-ai/dsh-typert-protocol" {
|
|
31
55
|
interface RemoteErrorDetailsMap {
|
|
@@ -74,6 +98,15 @@ declare module "@deepseek-ai/dsh-typert-protocol" {
|
|
|
74
98
|
"runs/run-unknown": {
|
|
75
99
|
readonly runId: string;
|
|
76
100
|
};
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
"runs/already-settled": {
|
|
107
|
+
readonly runId: string;
|
|
108
|
+
readonly status: string;
|
|
109
|
+
};
|
|
77
110
|
}
|
|
78
111
|
}
|
|
79
112
|
/** The refusal codes this remote serves, folded to the
|
|
@@ -219,11 +252,41 @@ export declare class RunsRuntimeService extends Service {
|
|
|
219
252
|
* never passes this (two-arg wire calls only). */
|
|
220
253
|
reuse?: {
|
|
221
254
|
runId: RunId;
|
|
222
|
-
}): Promise<
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
255
|
+
}): Promise<PressStartSummary>;
|
|
256
|
+
/** THE SWEEP START (friction #9's fan-out): one press, N seeds —
|
|
257
|
+
* each seed its own run, all under one shared run-id prefix.
|
|
258
|
+
* Every per-run law rides startReserved unchanged (phase gates,
|
|
259
|
+
* spell gate, self-wire gate, the registration door); the press
|
|
260
|
+
* laws wrap the WHOLE family: one press_key answers the sweep
|
|
261
|
+
* (a replay re-mints NOTHING — the sweep mirror holds every id),
|
|
262
|
+
* the twin reservation settles once after the last run registers,
|
|
263
|
+
* and a refusal anywhere propagates with the runs already minted
|
|
264
|
+
* standing (registered runs never un-register — the registry's
|
|
265
|
+
* own law; the retry law is the stale-key law's).
|
|
266
|
+
* @param seeds the judged sweep (capped, integer, model-door).
|
|
267
|
+
* @param checked the envelope's ok face for the sweep press.
|
|
268
|
+
* @param signal the caller's abort. */
|
|
269
|
+
private startSweep;
|
|
270
|
+
/** The sweep's mint loop: N startReserved calls, one per seed —
|
|
271
|
+
* the seed stamped into its own body, the sweep's runId handed
|
|
272
|
+
* through the INTERNAL reuse seat (the deterministic-id seam, the
|
|
273
|
+
* same seat the boot-resurrect replay rides). The answer carries
|
|
274
|
+
* the first run's summary face plus sweep_runs (every id, seed
|
|
275
|
+
* order). @param pressKey undefined on the inner calls — the
|
|
276
|
+
* per-run press memory would clobber the family's one entry; this
|
|
277
|
+
* loop owns the memory after every run stands. */
|
|
278
|
+
private mintSweep;
|
|
279
|
+
/** THE SWEEP MIRROR (audit N-E1's sweep half): press_key -> every
|
|
280
|
+
* run id the sweep minted. A replay answers the family only while
|
|
281
|
+
* EVERY row still stands — one swept row is the stale-key law's
|
|
282
|
+
* (the whole sweep re-runs on retry, the same class as the single
|
|
283
|
+
* door). Capped beside the single mirror. */
|
|
284
|
+
private readonly sweepPresses;
|
|
285
|
+
private rememberSweepPress;
|
|
286
|
+
/** The sweep replay: the family's answer while every row stands,
|
|
287
|
+
* null when the key is unknown or stale (the mirror entry dies
|
|
288
|
+
* with the verdict). */
|
|
289
|
+
private sweepReplay;
|
|
227
290
|
|
|
228
291
|
|
|
229
292
|
|
|
@@ -261,6 +324,21 @@ export declare class RunsRuntimeService extends Service {
|
|
|
261
324
|
stop(runId: string, signal: AbortSignal): Promise<Record<string, unknown>>;
|
|
262
325
|
/** The live map (the queue seat's core registry — rich rows). */
|
|
263
326
|
private liveRun;
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
private resyncSettledTruth;
|
|
264
342
|
/** The durable record under the run tree (F-5's fallback read):
|
|
265
343
|
* the on-disk _flow.json for a run — the SAME file the maker
|
|
266
344
|
* verified byte-by-byte while status answered husks. The
|