@volter/supercode-orchestrator 0.4.97 → 0.4.99
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/bin/orchestrator.mjs +11 -759
- package/bin/runtime.mjs +748 -0
- package/board/rows.mjs +16 -0
- package/board/ztrack.mjs +5 -1
- package/package.json +1 -1
package/board/rows.mjs
CHANGED
|
@@ -55,6 +55,22 @@ export class RuntimeRows {
|
|
|
55
55
|
if(name==='tasks')return {name:'@runtime',key:JSON.parse(key)[0],value:row&&Object.fromEntries(Object.entries(row).filter(([k])=>RUNTIME.has(k))),source:{name,key,row}};
|
|
56
56
|
if(name==='supercode_cards')return {name:'@clock',key:JSON.parse(key)[0],value:row&&{since:row.since,after_fired:row.after_fired,next_run_at:row.next_run_at},source:{name,key,row}};
|
|
57
57
|
return {name,key,value:row,source:{name,key,row}};
|
|
58
|
+
}).filter(change=>{
|
|
59
|
+
if(all)return true;
|
|
60
|
+
const {name,key,value,source}=change;
|
|
61
|
+
if(name==='task_links') {
|
|
62
|
+
const [parent,child]=JSON.parse(key);
|
|
63
|
+
const before=json(this.cachedCards[child]?.blocked_by,[]).some(b=>b.kind==='card'&&b.id===parent);
|
|
64
|
+
return before!==Boolean(source.row);
|
|
65
|
+
}
|
|
66
|
+
const before=this.db.prepare('SELECT value FROM runtime_rows WHERE name=? AND key=?').get(name,key)?.value??null;
|
|
67
|
+
if(before!==(value===null?null:JSON.stringify(value)))return true;
|
|
68
|
+
if(name==='@runtime') {
|
|
69
|
+
const fields=row=>row&&Object.fromEntries(Object.entries(row).filter(([k])=>k!=='status'));
|
|
70
|
+
return JSON.stringify(fields(source.row))!==JSON.stringify(fields(this.cachedTasks[key]??null));
|
|
71
|
+
}
|
|
72
|
+
if(name==='@clock')return JSON.stringify(source.row)!==JSON.stringify(this.cachedCards[key]??null);
|
|
73
|
+
return false;
|
|
58
74
|
});
|
|
59
75
|
}
|
|
60
76
|
mirror(changes, revision) {
|
package/board/ztrack.mjs
CHANGED
|
@@ -136,10 +136,14 @@ class ZtrackBoard {
|
|
|
136
136
|
const files = [{ path: this.path, before: hash(this.text), base: this.text, text: documents.open }, { path: this.archive, before: hash(this.archiveText), base: this.archiveText, text: documents.archived }];
|
|
137
137
|
const snapshot = this.snapshot(documents);
|
|
138
138
|
this.computing = false;
|
|
139
|
+
const pendingValues=[...this.pendingValues].filter(([key,value])=>JSON.stringify(this.get(key))!==JSON.stringify(value));
|
|
140
|
+
if(!changes.length && !pendingValues.length && files.every(f=>hash(f.text)===f.before)) {
|
|
141
|
+
this.loadedStamp=this.stamp();return result;
|
|
142
|
+
}
|
|
139
143
|
this.runtime.exec('BEGIN');
|
|
140
144
|
this.recover();
|
|
141
145
|
if (this.get('version') !== version || files.some((f) => hash(read(f.path)) !== f.before)) { this.runtime.exec('ROLLBACK'); this.invalidate(); continue; }
|
|
142
|
-
for (const [key, value] of
|
|
146
|
+
for (const [key, value] of pendingValues) this.put(key, value);
|
|
143
147
|
// A durable intent precedes filesystem writes; recovery completes exactly this version.
|
|
144
148
|
const intent = randomBytes(16).toString('hex');
|
|
145
149
|
this.put('pending', { intent, files, snapshot, changes });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-orchestrator",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.99",
|
|
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": {
|