@volter/supercode-orchestrator 0.4.85 → 0.4.86

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/board/cli.mjs CHANGED
@@ -327,7 +327,6 @@ export async function runWorkflow(argv) {
327
327
  case 'list': case 'ls': {
328
328
  const assignee = args.assignee ?? (args.mine ? callerName() : null);
329
329
  const cards = withBoard((b) => {
330
- engine.recomputeReady(b);
331
330
  let rows = engine.listCards(b.db, { status: args.status, assignee, machine: args.machine, includeArchived: args.archived || args.all });
332
331
  if (args.tenant) rows = rows.filter((t) => t.tenant === args.tenant);
333
332
  if (args.session) rows = rows.filter((t) => t.session_id === args.session);
package/board/ztrack.mjs CHANGED
@@ -39,7 +39,7 @@ class ZtrackBoard {
39
39
  this.codec = require('@volter/ztrack/board-document');
40
40
  this.preset = require('@volter/ztrack/kanban-preset');
41
41
  this.runtime = new DatabaseSync(`${marker}.runtime.db`);
42
- this.runtime.exec('PRAGMA busy_timeout = 10000; CREATE TABLE IF NOT EXISTS state (key TEXT PRIMARY KEY, value TEXT NOT NULL)');
42
+ if (!this.runtime.prepare("SELECT 1 FROM sqlite_master WHERE type='table' AND name='state'").get()) this.runtime.exec('CREATE TABLE state (key TEXT PRIMARY KEY, value TEXT NOT NULL)');
43
43
  this.mem = null; this.active = false;
44
44
  mkdirSync(dirname(this.path), { recursive: true });
45
45
  const self = this;
@@ -48,7 +48,8 @@ class ZtrackBoard {
48
48
  exec(sql) { return self.access(() => self.mem.exec(sql)); },
49
49
  close() { self.close(); },
50
50
  };
51
- this.tx(() => {});
51
+ if (seed) this.tx(() => {});
52
+ else { this.load(); this.loadedStamp = this.stamp(); }
52
53
  }
53
54
  get(key, fallback = null) { return this.computing && this.pendingValues.has(key) ? this.pendingValues.get(key) : json(this.runtime.prepare('SELECT value FROM state WHERE key = ?').get(key)?.value, fallback); }
54
55
  put(key, value) { if (this.computing) { this.pendingValues.set(key, value); return; } this.runtime.prepare('INSERT INTO state VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value').run(key, JSON.stringify(value)); }
@@ -58,6 +59,7 @@ class ZtrackBoard {
58
59
  }
59
60
  access(fn, reading = false) {
60
61
  if (this.active || (reading && this.mem && this.loadedStamp === this.stamp())) return fn();
62
+ if (reading) { this.load(); this.loadedStamp = this.stamp(); return fn(); }
61
63
  return this.tx(fn);
62
64
  }
63
65
  close() { this.mem?.close(); this.runtime.close(); }
@@ -92,7 +94,7 @@ class ZtrackBoard {
92
94
  this.runtime.exec('COMMIT');
93
95
  // Parsing, rules and rendering run against a snapshot, without a runtime writer transaction.
94
96
  this.pendingValues = new Map(); this.computing = true;
95
- this.load();
97
+ this.load({ observe: true });
96
98
  if (this.seed) this.seedIntoMemory();
97
99
  else this.lift();
98
100
  const result = fn(this.db);
@@ -178,7 +180,7 @@ class ZtrackBoard {
178
180
  if (!keys.length) return;
179
181
  this.mem.prepare(`INSERT OR REPLACE INTO ${quote(table)} (${keys.map(quote).join(',')}) VALUES (${keys.map(() => '?').join(',')})`).run(...keys.map((k) => row[k] ?? null));
180
182
  }
181
- load() {
183
+ load({ observe = false } = {}) {
182
184
  this.text = read(this.path); this.archiveText = read(this.archive);
183
185
  this.mem?.close(); this.mem = new DatabaseSync(':memory:'); this.init(this.mem, { fresh: true });
184
186
  this.saved = this.get('snapshot', { tables: {}, runtime: {}, clocks: {}, fingerprints: {} });
@@ -214,7 +216,7 @@ class ZtrackBoard {
214
216
  this.mem.prepare('UPDATE supercode_cards SET blocked_by = ? WHERE task_id = ?').run(JSON.stringify(blocks), row.task_id);
215
217
  for (const b of blocks.filter((b) => b.kind === 'card')) this.insert('task_links', { parent_id: b.id, child_id: row.task_id });
216
218
  }
217
- this.documentEvents();
219
+ if (observe) this.documentEvents();
218
220
  }
219
221
  loadCard(id, card, parent = null) {
220
222
  const meta = card.metadata ?? {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.4.85",
3
+ "version": "0.4.86",
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": {