@volter/supercode-orchestrator 0.4.114 → 0.4.115

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.
@@ -127,8 +127,11 @@ const mailboxAnswers = new Map();
127
127
  const execFileAsync = promisify(execFile);
128
128
  export async function refreshRelationAnswers(board) {
129
129
  const ids = new Set();
130
- for (const row of board.db.prepare('SELECT blocked_by FROM supercode_cards').all())
130
+ const entry = workflowFor(board.root);
131
+ for (const row of board.db.prepare("SELECT t.*,c.blocked_by FROM tasks t JOIN supercode_cards c ON c.task_id=t.id WHERE c.blocked_by IS NOT NULL AND c.blocked_by!='[]'").all()) {
132
+ if (!relationActive(board.db, board, entry, row)) continue;
131
133
  for (const block of json(row.blocked_by, []) ?? []) if (block.kind === 'message') ids.add(block.id);
134
+ }
132
135
  for (const row of board.db.prepare("SELECT e.payload FROM task_events e JOIN (SELECT task_id, MAX(id) id FROM task_events WHERE kind IN ('blocked','unblocked') GROUP BY task_id) last ON e.id=last.id JOIN tasks t ON t.id=e.task_id WHERE e.kind='blocked' AND t.status='blocked'").all()) {
133
136
  const id = json(row.payload, {})?.waiting_on; if (id) ids.add(id);
134
137
  }
@@ -886,8 +889,12 @@ export function fireRun(db, board, entry, id, name, { roles = [], payload = {},
886
889
  return { from: status, to: statusOf(db, cardOf(db, id)), effects };
887
890
  }
888
891
 
892
+ function relationActive(db, board, entry, task) {
893
+ const policy = entry.workflow.relations?.blocked_by;
894
+ return Boolean(policy) && holds(policy.guard ?? null, scopeOf(db, board, task, { params: entry.params }));
895
+ }
889
896
  function settleRelations(db, board, entry, id, effects) {
890
- if (!entry.workflow.relations?.blocked_by) return;
897
+ if (!relationActive(db, board, entry, cardOf(db, id))) return;
891
898
  const row = one(db, 'SELECT blocked_by FROM supercode_cards WHERE task_id = ?', id);
892
899
  const blocks = json(row?.blocked_by, []) ?? [];
893
900
  for (const block of blocks) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.4.114",
3
+ "version": "0.4.115",
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": {