@volter/supercode-orchestrator 0.4.158 → 0.4.159

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.
@@ -46,13 +46,16 @@ function sessionsOf(db, taskId) {
46
46
  * own transcript reports it runs, or null where none can be read; `machineOf` normalises a machine name; `lanes` gives
47
47
  * a profile's harness and model.
48
48
  */
49
- export function holdings(board, { lanes, fleetOk, alive, liveRecord, modelOf = () => null, machineOf }) {
49
+ export function holdings(board, { lanes, fleetOk, alive, liveRecord, modelOf = () => null, storedOf = null, machineOf }) {
50
50
  const out = [];
51
51
  const rows = board.db.prepare("SELECT t.id, t.status, t.assignee, t.current_run_id, t.model_override, c.machine, c.subtask_of FROM tasks t LEFT JOIN supercode_cards c ON c.task_id = t.id WHERE t.status != 'archived'").all();
52
52
  for (const row of rows) {
53
53
  const lane = lanes[row.assignee] ?? {};
54
54
  const card = {
55
- card: row.id, board: board.slug, assignee: row.assignee ?? null, status: statusOf(board.db, row), stored: row.status,
55
+ card: row.id, board: board.slug, assignee: row.assignee ?? null, status: statusOf(board.db, row),
56
+ // what the board stores for an arc is read through its workflow's stored_as rules now, never the column a write has
57
+ // not yet brought up to date (a paused card counted as running until its row caught up)
58
+ stored: !row.subtask_of && storedOf ? storedOf(row.id) : row.status,
56
59
  machine: row.machine ? machineOf(row.machine) : null,
57
60
  model: row.model_override ?? lane.model ?? null, harness: lane.harness ?? null,
58
61
  };
@@ -24,7 +24,7 @@ import { basename, dirname, join } from 'node:path';
24
24
  import { createHash, randomUUID } from 'node:crypto';
25
25
  import { fileURLToPath } from 'node:url';
26
26
  import { view, boardCopyOf, boardPath, claimer, copyRefusal, event, json, listBoards, logsDir, now, openBoard, setActor, tx } from './store.mjs';
27
- import { doors, fire, loadWorkflow, resumeOf, runSpec, runWorkingSeconds, requestSessionClose, retireSupersededRuns, refreshCardInputs, refreshRelationAnswers, transitionsFor, scopeOf, statusOf, templateValue, workflowFor } from './workflow.mjs';
27
+ import { doors, fire, loadWorkflow, resumeOf, runSpec, runWorkingSeconds, requestSessionClose, retireSupersededRuns, refreshCardInputs, refreshRelationAnswers, transitionsFor, scopeOf, statusOf, storedStatus, templateValue, workflowFor } from './workflow.mjs';
28
28
  import { checkWorkspace, assertWorkspaceOwner, notePresence, resolveWorkspace } from './workspace.mjs';
29
29
  import { capacity, harnessDefaults, holdings } from './capacity.mjs';
30
30
  import { evaluate, holds, render } from './expr.mjs';
@@ -464,13 +464,17 @@ export function whereOf(board, task) {
464
464
  const hostOf = (pressure) => ({ memory_pressure: pressure, max_in_progress: derivedMaxInProgress() });
465
465
 
466
466
  /** What every board of the home at `root` holds now, counted for its caps (capacity.mjs). */
467
- function homeHoldings(root, slugs, lanes, fleet) {
467
+ function homeHoldings(root, slugs, lanes, fleet, entry) {
468
468
  const live = (s) => fleet.sessions?.find((x) => x.address === addressOf(s)) ?? null;
469
469
  const out = [];
470
470
  for (const slug of slugs) {
471
471
  try {
472
472
  const b = openBoard(root, slug);
473
- try { b.slug ??= slug; out.push(...holdings(b, { lanes, fleetOk: fleet.ok, alive: (s) => sessionAlive(fleet, s), liveRecord: live, modelOf: transcriptModel, machineOf: normalMachine })); }
473
+ try {
474
+ b.slug ??= slug; b.label ??= boardLabel(root, slug);
475
+ const storedOf = (id) => storedStatus(b.db, b, entry, id).stored;
476
+ out.push(...holdings(b, { lanes, fleetOk: fleet.ok, alive: (s) => sessionAlive(fleet, s), liveRecord: live, modelOf: transcriptModel, storedOf, machineOf: normalMachine }));
477
+ }
474
478
  finally { b.close(); }
475
479
  } catch { /* its own tick reports it */ }
476
480
  }
@@ -1872,7 +1876,7 @@ export async function plan({ root, lanes, settings, slugs = null, params = {} })
1872
1876
  const fleet = Object.values(lanes).some((l) => l.surface === 'pane') ? observeFleet() : { ok: false, alive: new Set(), online: new Set(), sessions: [], error: 'no pane lanes' };
1873
1877
  const out = [];
1874
1878
  // the home's caps count every board, whichever boards are planned
1875
- const held = homeHoldings(root, listBoards(root), lanes, fleet);
1879
+ const held = homeHoldings(root, listBoards(root), lanes, fleet, entry);
1876
1880
  const caps = capacity(entry.workflow.dispatch?.capacity, held, evaluate);
1877
1881
  // what each cap counts now, before anything this plan would start
1878
1882
  Object.defineProperty(out, 'capacity', { value: caps.view().map((cap) => ({ ...cap, groups: cap.groups.map((g) => ({ ...g, max: capMax(cap, g, entry, lanes) })) })) });
@@ -1982,7 +1986,7 @@ export async function tick({ root, lanes, settings, only = null, slugs = null, d
1982
1986
  const fleetMs = Date.now() - fleetAt;
1983
1987
  const boards = slugs ?? listBoards(root);
1984
1988
  // what every board of the home holds, for caps whose scope is the whole home (kanban.max_in_progress counts so)
1985
- const held = dispatch ? homeHoldings(root, boards, lanes, fleet) : [];
1989
+ const held = dispatch ? homeHoldings(root, boards, lanes, fleet, entry) : [];
1986
1990
  const out = [];
1987
1991
  for (const slug of boards) {
1988
1992
  const report = { board: slug, ms: { fleet: fleetMs }, mailed: [], started: [], queued: [], failed: [], lost: [], crashed: [], timed_out: [], reclaimed: [], auto_blocked: [], promoted: 0, unassigned: [], nonspawnable: [], notified: [], undelivered: [], fleet: fleet.ok ? 'read' : fleet.error };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.4.158",
3
+ "version": "0.4.159",
4
4
  "type": "module",
5
5
  "description": "The orchestrator runtime over the Volter Harness ontology: one typed operational model whose folder is its serialization, read and written through the harness orchestration doors (docs/ORCHESTRATOR-IR.md)",
6
6
  "exports": {