@volter/supercode-orchestrator 0.4.107 → 0.4.108
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/engine.mjs +3 -1
- package/board/rows.mjs +1 -1
- package/board/ztrack.mjs +3 -3
- package/package.json +1 -1
package/board/engine.mjs
CHANGED
|
@@ -204,7 +204,8 @@ export function createCard(board, spec) {
|
|
|
204
204
|
inheritSubscriptions(db, id, [arc.id], { workers: true });
|
|
205
205
|
event(db, arc.id, 'subtask_added', { subtask: id, title });
|
|
206
206
|
}
|
|
207
|
-
if (initial === 'running')
|
|
207
|
+
if (initial === 'running' && arc && entry.workflow.run) setStatus(db, entry.workflow, id, 'running');
|
|
208
|
+
else if (initial === 'running') claimIn(db, id, { ttl: claimTtl() });
|
|
208
209
|
return { id, existing: false };
|
|
209
210
|
});
|
|
210
211
|
}
|
|
@@ -247,6 +248,7 @@ export function claim(board, id, { ttl, lock = claimer(), expectStatus = 'ready'
|
|
|
247
248
|
|
|
248
249
|
/** `claim` inside the caller's own transaction (a dispatcher's guard and claim see one state). */
|
|
249
250
|
export function claimIn(db, id, { ttl = claimTtl(), lock = claimer(), expectStatus = null } = {}) {
|
|
251
|
+
if (getTask(db, id)?.subtask_of) throw new Error('a subtask is worked by its arc and has no run of its own');
|
|
250
252
|
// a triage card is claimed to be specified, which does not wait on its parents
|
|
251
253
|
if (expectStatus !== 'triage' && !parentsDone(db, id)) {
|
|
252
254
|
run(db, "UPDATE tasks SET status = 'todo' WHERE id = ? AND status = 'ready'", id);
|
package/board/rows.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// tables, run fields and small indexing metadata. No application locks or snapshot rewrites.
|
|
3
3
|
import { json } from './store.mjs';
|
|
4
4
|
const quote = s => `"${s.replaceAll('"', '""')}"`;
|
|
5
|
-
const RUNTIME = new Set(['claim_lock','claim_expires','worker_pid','last_heartbeat_at','current_run_id','consecutive_failures','last_failure_error','block_recurrences','session_id']);
|
|
5
|
+
const RUNTIME = new Set(['claim_lock','claim_expires','worker_pid','last_heartbeat_at','current_run_id','consecutive_failures','last_failure_error','block_recurrences','session_id','workspace_path']);
|
|
6
6
|
const OMIT = new Set(['tasks','supercode_cards','task_links','sqlite_sequence']);
|
|
7
7
|
export class RuntimeRows {
|
|
8
8
|
constructor(db) { this.db=db; this.revision=null; this.tables=new Map(); this.runtime={}; this.clocks={}; this.cachedTasks={}; this.cachedCards={}; }
|
package/board/ztrack.mjs
CHANGED
|
@@ -14,7 +14,7 @@ const hash = (text) => createHash('sha256').update(text).digest('hex');
|
|
|
14
14
|
const read = (path) => existsSync(path) ? readFileSync(path, 'utf8') : '';
|
|
15
15
|
const quote = (s) => `"${s.replaceAll('"', '""')}"`;
|
|
16
16
|
const nativeId = (id) => /^t-[a-f0-9]+$/.test(id) ? id.replace('t-', 't_') : id;
|
|
17
|
-
const RUNTIME = new Set(['claim_lock', 'claim_expires', 'worker_pid', 'last_heartbeat_at', 'current_run_id', 'consecutive_failures', 'last_failure_error', 'block_recurrences', 'session_id']);
|
|
17
|
+
const RUNTIME = new Set(['claim_lock', 'claim_expires', 'worker_pid', 'last_heartbeat_at', 'current_run_id', 'consecutive_failures', 'last_failure_error', 'block_recurrences', 'session_id', 'workspace_path']);
|
|
18
18
|
const CARD_MAIN = new Set(['id', 'title', 'body', 'status', 'assignee', 'priority', 'workspace_kind', 'workspace_path', 'branch_name']);
|
|
19
19
|
const EPHEMERAL = new Set(['tasks', 'supercode_cards', 'task_links', 'sqlite_sequence']);
|
|
20
20
|
const atomic = (path, text) => { const tmp = `${path}.${process.pid}.tmp`; writeFileSync(tmp, text, { mode: 0o600 }); renameSync(tmp, path); };
|
|
@@ -370,7 +370,7 @@ class ZtrackBoard {
|
|
|
370
370
|
const workspace = /^(scratch|dir|worktree)(?::(.*))?$/.exec(card.workspace ?? 'scratch');
|
|
371
371
|
this.insert('tasks', { ...meta, ...this.saved.runtime?.[id], id, title: card.title, body: stored.body,
|
|
372
372
|
status: card.status, assignee: card.assignee ?? null, created_at: meta.created_at ?? now(), priority: card.priority ?? 0,
|
|
373
|
-
workspace_kind: workspace?.[1] ?? 'scratch', workspace_path: workspace?.[2] ?? null, branch_name: card.branch ?? null });
|
|
373
|
+
workspace_kind: workspace?.[1] ?? 'scratch', workspace_path: workspace?.[1] === 'scratch' ? (this.saved.runtime?.[id]?.workspace_path ?? meta.workspace_path ?? null) : workspace?.[2] ?? null, branch_name: card.branch ?? null });
|
|
374
374
|
this.insert('supercode_cards', { ...this.saved.clocks?.[id], task_id: id, stage: card.status, machine: card.machine ?? null, subtask_of: parent,
|
|
375
375
|
blocked_by: JSON.stringify((card.relations ?? []).map((r) => ({ ...(meta.blocked_by ?? []).find((b) => b.id === nativeId(r.issueId)), id: nativeId(r.issueId), kind: /^[ma]-/.test(r.issueId) ? 'message' : 'card' }))),
|
|
376
376
|
paused: card.paused ? JSON.stringify(card.paused) : null, archived: meta.archived ? 1 : 0, every: card.every ?? null });
|
|
@@ -419,7 +419,7 @@ class ZtrackBoard {
|
|
|
419
419
|
const metadata = Object.fromEntries(Object.entries(row).filter(([k, v]) => !RUNTIME.has(k) && !CARD_MAIN.has(k) && v != null));
|
|
420
420
|
if (c.archived) metadata.archived = true;
|
|
421
421
|
if (json(c.blocked_by, []).length) metadata.blocked_by = json(c.blocked_by, []);
|
|
422
|
-
cards.set(row.id, { ...parsed, metadata, priority: row.priority ?? 0, workspace: row.workspace_kind + (row.workspace_path ? `:${row.workspace_path}` : ''),
|
|
422
|
+
cards.set(row.id, { ...parsed, metadata, priority: row.priority ?? 0, workspace: row.workspace_kind + (row.workspace_kind !== 'scratch' && row.workspace_path ? `:${row.workspace_path}` : ''),
|
|
423
423
|
branch: row.branch_name || undefined, machine: c.machine || undefined, paused: json(c.paused, null) ?? undefined, every: c.every || undefined,
|
|
424
424
|
relations: json(c.blocked_by, []).map((b) => ({ type: 'blocked-by', issueId: this.fileIds.get(b.id) ?? b.id })), acceptanceCriteria: [] });
|
|
425
425
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-orchestrator",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.108",
|
|
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": {
|