@melite/estate-queue 0.1.4-alpha → 0.1.5-pre-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +55 -0
  2. package/lib/bench.d.ts +19 -11
  3. package/lib/bench.js +47 -57
  4. package/lib/cardsArmError.d.ts +45 -2
  5. package/lib/cardsArmError.js +28 -4
  6. package/lib/cardsCompose.d.ts +13 -1
  7. package/lib/cardsCompose.js +109 -61
  8. package/lib/cardsDangling.d.ts +2 -2
  9. package/lib/cardsDangling.js +82 -37
  10. package/lib/cardsFacts.d.ts +16 -3
  11. package/lib/cardsFacts.js +14 -0
  12. package/lib/cardsLanes.d.ts +12 -2
  13. package/lib/cardsLanes.js +73 -10
  14. package/lib/cardsRegistry.d.ts +93 -5
  15. package/lib/cardsRegistry.js +323 -54
  16. package/lib/cardsVariant.d.ts +10 -1
  17. package/lib/cardsVariant.js +66 -13
  18. package/lib/discloseRegistry.d.ts +6 -5
  19. package/lib/discloseRegistry.js +11 -9
  20. package/lib/flowsData.d.ts +67 -12
  21. package/lib/flowsData.js +230 -104
  22. package/lib/flowsFamilyCompose.d.ts +5 -8
  23. package/lib/flowsFamilyCompose.js +13 -13
  24. package/lib/flowsParamsOverlay.d.ts +55 -0
  25. package/lib/flowsParamsOverlay.js +197 -0
  26. package/lib/flowsRegistryRows.d.ts +3 -1
  27. package/lib/flowsRegistryRows.js +148 -6
  28. package/lib/index.d.ts +0 -3
  29. package/lib/index.js +14 -5
  30. package/lib/lifecycleLatch.d.ts +16 -0
  31. package/lib/lifecycleLatch.js +42 -0
  32. package/lib/loadPlane.d.ts +3 -2
  33. package/lib/loadPlane.js +25 -8
  34. package/lib/loadRegistry.js +1 -1
  35. package/lib/manageOps.d.ts +8 -2
  36. package/lib/manageOps.js +26 -6
  37. package/lib/managePlane.d.ts +31 -0
  38. package/lib/managePlane.js +360 -85
  39. package/lib/manageProbe.d.ts +1 -10
  40. package/lib/manageProbe.js +18 -7
  41. package/lib/manageRegistry.d.ts +42 -4
  42. package/lib/manageRegistry.js +45 -7
  43. package/lib/mediaKinds.d.ts +1 -1
  44. package/lib/mediaKinds.js +1 -1
  45. package/lib/queue.js +14 -10
  46. package/lib/queueCore.d.ts +7 -4
  47. package/lib/queueCore.js +9 -5
  48. package/lib/queueLifecycle.d.ts +0 -24
  49. package/lib/queueLifecycle.js +9 -63
  50. package/lib/queueLock.d.ts +8 -2
  51. package/lib/queueLock.js +9 -6
  52. package/lib/queueSidecar.d.ts +4 -0
  53. package/lib/queueSidecar.js +1 -0
  54. package/lib/queueSubmit.d.ts +61 -10
  55. package/lib/queueSubmit.js +120 -46
  56. package/lib/queueSweep.js +13 -2
  57. package/lib/runsChange.d.ts +8 -0
  58. package/lib/runsChange.js +21 -5
  59. package/lib/runsErrorCodes.d.ts +1 -1
  60. package/lib/runsErrorCodes.js +33 -0
  61. package/lib/runsExecute.d.ts +26 -0
  62. package/lib/runsExecute.js +143 -5
  63. package/lib/runsGates.js +4 -3
  64. package/lib/runsList.js +13 -19
  65. package/lib/runsRefusalVoices.js +52 -0
  66. package/lib/runsRegistry.d.ts +105 -7
  67. package/lib/runsRegistry.js +744 -100
  68. package/lib/runsSourceEcho.d.ts +27 -0
  69. package/lib/runsSourceEcho.js +84 -18
  70. package/lib/runsStart.d.ts +56 -14
  71. package/lib/runsStart.js +184 -45
  72. package/lib/runsTypes.d.ts +35 -0
  73. package/lib/runsTypes.js +7 -0
  74. package/lib/runsValidateArms.js +61 -7
  75. package/lib/runsValidateServe.d.ts +2 -2
  76. package/lib/runsValidateServe.js +26 -4
  77. package/lib/runsValidateShared.d.ts +1 -1
  78. package/lib/runsValidateStages.d.ts +10 -3
  79. package/lib/runsValidateStages.js +23 -3
  80. package/lib/service.d.ts +24 -6
  81. package/lib/service.js +19 -11
  82. package/lib/skillFs.d.ts +9 -4
  83. package/lib/skillFs.js +12 -14
  84. package/lib/skillPlane.d.ts +3 -2
  85. package/lib/skillPlane.js +12 -6
  86. package/lib/skillRegistry.js +1 -1
  87. package/lib/skillRows.d.ts +4 -3
  88. package/lib/skillRows.js +14 -12
  89. package/lib/toolProjection.d.ts +1 -1
  90. package/lib/toolProjection.js +1 -1
  91. package/package.json +8 -7
  92. package/lib/runStatus.d.ts +0 -7
  93. package/lib/runStatus.js +0 -21
package/lib/runsList.js CHANGED
@@ -15,7 +15,7 @@ import { servableLeaf } from "@melite/contracts/mediaKinds";
15
15
  // on their stroke.
16
16
  import { readdirSync, readFileSync, statSync } from "node:fs";
17
17
  import { join } from "node:path";
18
- import { mediaVocab } from "./mediaKinds.js";
18
+ import { mediaKindOf, mediaVocab } from "./mediaKinds.js";
19
19
  import { engineFilmName } from "./filmLead.js";
20
20
  /** Leading-int read (sidecar tails): optional space, optional
21
21
  * sign, then digits; 0 when no digits lead. */
@@ -105,22 +105,14 @@ export function sidecarStrFound(raw, key, cap) {
105
105
  return [true, Buffer.from(out).toString("utf8")];
106
106
  }
107
107
  export function artifactType(name) {
108
- const kinds = mediaVocab();
109
- const dot = name.lastIndexOf(".");
110
- const ext = dot >= 0 ? name.slice(dot + 1).toLowerCase() : "";
111
- if (kinds.image.includes(ext))
112
- return "image";
113
- if (kinds.audio.includes(ext))
114
- return "audio";
115
- if (kinds.video.includes(ext))
116
- return "video";
117
- if (kinds.model.includes(ext))
118
- return "model";
119
- if (ext === "json")
120
- return "spec";
121
- if (ext === "txt" || ext === "md" || ext === "yaml")
122
- return "text";
123
- return "file";
108
+
109
+ // ext table (json→spec, txt/md/yaml→text) pre-dated the vocab's
110
+ // text kind and minted types the list loop then DROPPED — a
111
+ // tagger's tags.txt never listed. The contract's mediaKindOf is
112
+ // the one answer now; a non-media name answers "file" and the
113
+ // callers' own gates keep deciding what lists.
114
+ const k = mediaKindOf(name);
115
+ return k ?? "file";
124
116
  }
125
117
  /** Byte-wise name order (the sort runs on the surrogateescape bytes — for valid UTF-8, Buffer.compare on the re-encoded name is the same bytes; D5). */
126
118
  function byteLess(a, b) {
@@ -218,7 +210,7 @@ export function runArtifacts(runDir, outDirLiteral) {
218
210
  if (imgs > maxImgs)
219
211
  continue;
220
212
  }
221
- else if (t === "video" || t === "audio" || t === "model") {
213
+ else if (t === "video" || t === "audio" || t === "model" || t === "text") {
222
214
  mediaTotal++;
223
215
  }
224
216
  else {
@@ -275,7 +267,8 @@ export function runDirHasMedia(runDir) {
275
267
  return (kinds.galleryVideo.includes(ext) ||
276
268
  kinds.galleryImage.includes(ext) ||
277
269
  kinds.galleryAudio.includes(ext) ||
278
- kinds.galleryModel.includes(ext));
270
+ kinds.galleryModel.includes(ext) ||
271
+ kinds.galleryText.includes(ext));
279
272
  };
280
273
  let names;
281
274
  try {
@@ -326,6 +319,7 @@ const ARTIFACT_TYPE = new Set([
326
319
  "video",
327
320
  "audio",
328
321
  "model",
322
+ "text",
329
323
  ]);
330
324
  function isIntGe0(v) {
331
325
  return typeof v === "number" && Number.isInteger(v) && v >= 0;
@@ -11,8 +11,53 @@ function refusalEnvelopeOf(err) {
11
11
  p["expected"] = err.expected;
12
12
  if (err.got !== undefined)
13
13
  p["got"] = err.got;
14
+ if (err.lane !== undefined) {
15
+ const lane = err.lane;
16
+ p["family"] = lane.family;
17
+ p["slot"] = lane.slot;
18
+ p["missing"] = lane.missing;
19
+ p["folders"] = [...lane.folders];
20
+ if (lane.fetchUrl !== undefined)
21
+ p["fetch_url"] = lane.fetchUrl;
22
+ p["kind"] = lane.kind;
23
+ }
14
24
  return p;
15
25
  }
26
+ /** The lane-miss row's structured details, read back off the
27
+ * envelope. A lane_input_missing refusal without the structured
28
+ * evidence is a bug at the throw site — LOUD, never a popup keyed
29
+ * on prose (the fold's law: unmapped or malformed is thrown,
30
+ * never a silent generic). */
31
+ function laneDetailsOf(p) {
32
+ const family = p["family"];
33
+ const slot = p["slot"];
34
+ const missing = p["missing"];
35
+ const folders = p["folders"];
36
+ const kind = p["kind"];
37
+ if (typeof family !== "string" || typeof slot !== "string"
38
+ || typeof missing !== "string" || !Array.isArray(folders)
39
+ || (kind !== "model" && kind !== "extension")) {
40
+ throw new Error("runs remote: lane_input_missing refusal lacks its structured artifact (family/slot/missing/folders/kind)");
41
+ }
42
+ const fetchUrl = p["fetch_url"];
43
+ const loc = p["loc"];
44
+ const expected = p["expected"];
45
+ const got = p["got"];
46
+ return {
47
+ // THE ROW EXTENDS RunsRefusalDetails: the bench arm's loc-carry
48
+ // reads these three off the mapped details — a lane refusal that
49
+ // set them must survive the fold like every other refusal's.
50
+ ...(typeof loc === "string" && loc !== "" ? { loc } : {}),
51
+ ...(typeof expected === "string" ? { expected } : {}),
52
+ ...(typeof got === "string" ? { got } : {}),
53
+ family,
54
+ slot,
55
+ missing,
56
+ folders: folders.filter((f) => typeof f === "string"),
57
+ ...(typeof fetchUrl === "string" && fetchUrl !== "" ? { fetch_url: fetchUrl } : {}),
58
+ kind,
59
+ };
60
+ }
16
61
  export function cardRefusal(err) {
17
62
  return {
18
63
  status: err.status,
@@ -28,6 +73,13 @@ export function toRemoteError(r) {
28
73
  // a silent generic.
29
74
  throw new Error("runs remote: unmapped refusal code " + p["code"]);
30
75
  }
76
+ // THE LANE-MISS ROW CARRIES ITS ARTIFACT (the details map's
77
+ // typed row forces the branch): the popup keys on the fields,
78
+ // so the fold reads them back off the envelope and refuses a
79
+ // malformed one loud.
80
+ if (mapped === "runs/lane-input-missing") {
81
+ return new RemoteError(mapped, p["error"], laneDetailsOf(p));
82
+ }
31
83
  const details = {};
32
84
  if (p["loc"] !== undefined)
33
85
  details["loc"] = p["loc"];
@@ -15,6 +15,18 @@ export interface RunsRefusalDetails {
15
15
  readonly expected?: string;
16
16
  readonly got?: string;
17
17
  }
18
+
19
+
20
+
21
+
22
+ export interface LaneInputMissingDetails extends RunsRefusalDetails {
23
+ readonly family: string;
24
+ readonly slot: string;
25
+ readonly missing: string;
26
+ readonly folders: readonly string[];
27
+ readonly fetch_url?: string;
28
+ readonly kind: "model" | "extension";
29
+ }
18
30
  declare module "@deepseek-ai/dsh-typert-protocol" {
19
31
  interface RemoteErrorDetailsMap {
20
32
  /** The start body is not a JSON object (bad_envelope/body). */
@@ -37,15 +49,23 @@ declare module "@deepseek-ai/dsh-typert-protocol" {
37
49
  "runs/workflow-pin": RunsRefusalDetails & {
38
50
  readonly errors?: unknown;
39
51
  };
40
- "runs/card-compose": RunsRefusalDetails & {
41
- readonly loc?: string;
42
- readonly expected?: string;
43
- readonly got?: string;
44
- };
52
+ "runs/card-compose": RunsRefusalDetails;
53
+
54
+
55
+
56
+
57
+
58
+ "runs/card-compose-incomplete": RunsRefusalDetails;
59
+
60
+
61
+
62
+
63
+
64
+ "runs/lane-input-missing": LaneInputMissingDetails;
45
65
 
46
66
 
47
67
 
48
- "runs/lane-input-missing": RunsRefusalDetails;
68
+ "runs/lifecycle-inflight": RunsRefusalDetails;
49
69
 
50
70
  "runs/unknown-run": {
51
71
  readonly runId: string;
@@ -88,6 +108,10 @@ export declare function benchWiring(benchDoc: Record<string, unknown>): {
88
108
  self: string[];
89
109
  };
90
110
  export declare class RunsRuntimeService extends Service {
111
+
112
+
113
+
114
+ private static readonly PRESS_MEMORY_MAX;
91
115
  static inject: string[];
92
116
  /** The pump reentrancy guard (door-verbatim — a public field:
93
117
  * cordis proxies services, and private #fields do not cross the
@@ -200,6 +224,17 @@ export declare class RunsRuntimeService extends Service {
200
224
  status: string;
201
225
  queue_position: number;
202
226
  }>;
227
+
228
+
229
+
230
+
231
+
232
+ private pressReplay;
233
+ /** THE START ARMS under a settled replay/reservation verdict: the
234
+ * bench-composed arm and the flow_inline arm, behavior-verbatim
235
+ * from before the concurrent-press cure split them behind the
236
+ * shell (the split's only edits are the two summary settles). */
237
+ private startReserved;
203
238
  /** The list arm (REBUILD-7): the restore-port envelope over the
204
239
  * output roots. The raw limit STRING rides from the lane (strict
205
240
  * int() semantics: underscores parse, junk refuses). The drafts
@@ -236,7 +271,46 @@ export declare class RunsRuntimeService extends Service {
236
271
  private diskRunRow;
237
272
  /** The envelope walk with the AWAITED draft probe (door order
238
273
  * preserved: the probe sits between malformed and unknown). */
239
- private walkEnvelope;
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+ private readonly presses;
282
+
283
+
284
+
285
+
286
+
287
+
288
+ private readonly pendingPresses;
289
+ /** The caller's verdict at the press gate: null when it becomes
290
+ * the minter (its entry is registered before this returns); the
291
+ * in-flight promise when a concurrent mint owns the key — the
292
+ * twin awaits and answers with the SAME summary or refusal. */
293
+ private reservePress;
294
+ /** The minter's summary settles the twin (no-op without a press —
295
+ * the door's return sites serve both keyed and keyless starts). */
296
+ private resolvePress;
297
+
298
+
299
+
300
+
301
+ private failPress;
302
+
303
+
304
+
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+ private awaitTwin;
313
+ private rememberPress;
240
314
  /** Kick the serial pump (door-verbatim guard). */
241
315
  private kick;
242
316
  /** The serial worker: claim the FIFO head, execute, settle —
@@ -250,4 +324,28 @@ export declare class RunsRuntimeService extends Service {
250
324
  /** Terminal settle (queue core row + the settle persist). */
251
325
  private settle;
252
326
  }
327
+ /** THE SETTLE MIRROR (pure — the walls' seam, bench-trail/runs-remote
328
+ * W4–W8): per draft stage, the terminal outcome patch the runs seat
329
+ * mirrors into the draft doc at settle, with no browser tab alive.
330
+ *
331
+ * Identity: the DRAFT row id (benchStageId, the compose's stamp) —
332
+ * the run row's `id` may be the card skeleton's, a namespace the
333
+ * draft doc never heard of (draft.ts's own admission). Legacy rows
334
+ * without the stamp fall back to `id`.
335
+ *
336
+ * Words: the draft row's terminal vocabulary. completed→done (the
337
+ * client's word, cards-resource tileStatusFromVerdict),
338
+ * failed→failed, stopped→stopped; a STOPPED run's untouched
339
+ * (queued/pending/running) stage rows mirror the run's word — the
340
+ * queued-stop arm settles without stamping stages (the defect-hunt
341
+ * §1 P1: the closed-tab row would read running forever).
342
+ *
343
+ * The result face: run_id always; the run-relative media url of the
344
+ * stage's own output when one exists (the husk clobber's other
345
+ * half — a bookkeeping mirror never blanks a hero it can name); the
346
+ * error voice (stage's, else the run's) when the word is failed. */
347
+ export declare function settleMirrorPatches(run: RunRecord): Array<{
348
+ stageId: string;
349
+ patch: Record<string, unknown>;
350
+ }>;
253
351
  //# sourceMappingURL=runsRegistry.d.ts.map