@volter/supercode-orchestrator 0.5.86 → 0.5.88
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 +7 -1
- package/board/dispatch.mjs +4 -2
- package/board/runtime-door.mjs +8 -3
- package/board/workflow.mjs +11 -8
- package/package.json +2 -2
package/board/cli.mjs
CHANGED
|
@@ -970,6 +970,11 @@ export async function runVerb(argv) {
|
|
|
970
970
|
say(args, lines.length ? lines.join('\n') : 'nothing would start', args.json ? { would, would_review: reviews } : would);
|
|
971
971
|
return 0;
|
|
972
972
|
}
|
|
973
|
+
// This process holds the home's lock for the round, so it is the board's owner for it: it registers its pid, which
|
|
974
|
+
// the daemon takes only because that pid holds the lock, so the card panes it launches as the board are the
|
|
975
|
+
// board's (SUPERCODE_BOARD_OWNER_PID, commandEnv). A later owner's registration replaces it.
|
|
976
|
+
try { await machineCall(null, 'harness.v1.boards.register', { root, claim: { pid: process.pid, ppid: process.ppid } }, { timeoutMs: 30_000 }); }
|
|
977
|
+
catch (error) { current().err(`supercode workflow: the machine daemon did not register this round as the board's owner (${error.message}); card panes it launches may not be the board's\n`); }
|
|
973
978
|
const reports = await tick({ root, lanes, settings, params });
|
|
974
979
|
if (args.json) say(args, '', reports);
|
|
975
980
|
else for (const r of reports) current().out(`${summary(r)}\n`);
|
|
@@ -1678,7 +1683,8 @@ async function serve(root, args = {}) {
|
|
|
1678
1683
|
// The board's events are published by this machine's connector, not by the dispatcher (D137, D138 step 4): the home is
|
|
1679
1684
|
// named to the daemon once, and the connector follows its `workflow events` from then on, with or without this serve.
|
|
1680
1685
|
{ let named = null, refusal = null;
|
|
1681
|
-
|
|
1686
|
+
// this process is the home's owner: it names its pid (its claim), which the daemon takes only if it holds the home's lock
|
|
1687
|
+
try { named = await machineCall(null, 'harness.v1.boards.register', { root, claim: { pid: process.pid, ppid: process.ppid } }, { timeoutMs: 30_000 }); } catch (error) { refusal = error.message; }
|
|
1682
1688
|
const refused = named?.refused ?? null;
|
|
1683
1689
|
log(refusal ? `board events: not published; the machine daemon did not take this home: ${refusal}`
|
|
1684
1690
|
: refused ? `board events: registered, but the team refused this machine's credential (${refused.status}); nothing is published until it is re-enrolled`
|
package/board/dispatch.mjs
CHANGED
|
@@ -76,9 +76,11 @@ export function localMachine() {
|
|
|
76
76
|
/** The supercode command the dispatcher drives. */
|
|
77
77
|
export const supercodeBin = () => process.env.SUPERCODE_BIN || 'supercode';
|
|
78
78
|
|
|
79
|
-
/** Public CLI calls carry caller attribution; installed clients own transport selection.
|
|
79
|
+
/** Public CLI calls carry caller attribution; installed clients own transport selection. A command acting as a board
|
|
80
|
+
* also names this process, the board's owner (the pid the machine daemon registered it by), so the daemon can hold
|
|
81
|
+
* the board's name to its owner (docs/architecture/overview.md, "Who is calling"). */
|
|
80
82
|
export function commandEnv(as = null) {
|
|
81
|
-
return { ...process.env, ...(as ? { SUPERCODE_CALLER: as } : {}) };
|
|
83
|
+
return { ...process.env, ...(as ? { SUPERCODE_CALLER: as, SUPERCODE_BOARD_OWNER_PID: String(process.pid) } : {}) };
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
/**
|
package/board/runtime-door.mjs
CHANGED
|
@@ -4,13 +4,18 @@
|
|
|
4
4
|
import { machineCall } from './doors.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* One door call. `machine` null for this machine. `as`: the board this call acts for (`sc:<machine>:board:<name>`)
|
|
8
|
-
*
|
|
7
|
+
* One door call. `machine` null for this machine. `as`: the board this call acts for (`sc:<machine>:board:<name>`). To
|
|
8
|
+
* this machine's daemon it is this process's claim, naming the board, from the board's owner (this process, the pid the
|
|
9
|
+
* daemon registered for its home); to another machine, the board's name as the caller, which that machine takes from
|
|
10
|
+
* this machine's link (machine.mjs #callerOf).
|
|
9
11
|
*/
|
|
10
12
|
export async function runtimeDoor(machine, method, params = {}, { timeout = 60_000, as = null } = {}) {
|
|
11
13
|
try {
|
|
12
14
|
if (!method.startsWith('harness.v1.')) throw Object.assign(new Error('the runtime door accepts harness.v1 methods'), { code: 'invalid_request' });
|
|
13
|
-
const
|
|
15
|
+
const acting = as && !method.startsWith('harness.v1.sessions.');
|
|
16
|
+
const named = !acting ? params
|
|
17
|
+
: machine ? { ...params, caller: as }
|
|
18
|
+
: { ...params, claim: { pid: process.pid, ppid: process.ppid, session: null, named: as, owner: String(process.pid) } };
|
|
14
19
|
const result = await machineCall(machine, method, named, { timeoutMs: timeout });
|
|
15
20
|
return { code: 0, stdout: `${JSON.stringify(result ?? null)}\n`, stderr: '' };
|
|
16
21
|
} catch (error) {
|
package/board/workflow.mjs
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
// pane, sending a session a message, cleaning a workspace) is answered as effects the caller runs after commit.
|
|
7
7
|
import { current } from './call.mjs';
|
|
8
8
|
import { notRuntime } from './owner-files.mjs';
|
|
9
|
+
import { machineCall } from './doors.mjs';
|
|
9
10
|
import { execFile } from 'node:child_process';
|
|
10
11
|
import { promisify } from 'node:util';
|
|
11
12
|
import { existsSync, readdirSync, realpathSync, watch, readFileSync } from 'node:fs';
|
|
@@ -275,14 +276,16 @@ export async function refreshRelationAnswers(board) {
|
|
|
275
276
|
const id = json(row.payload, {})?.waiting_on; if (id) ids.add(id);
|
|
276
277
|
}
|
|
277
278
|
const list = [...ids];
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
279
|
+
if (!list.length) return;
|
|
280
|
+
// one read of this machine's daemon for every id (its header index answers, no process per message)
|
|
281
|
+
try {
|
|
282
|
+
const { rows } = await machineCall(null, 'harness.v1.mail.show', { ids: list, replies: true }, { timeoutMs: 20_000 });
|
|
283
|
+
if (!Array.isArray(rows)) throw new Error('the mail door returned no message list');
|
|
284
|
+
for (const id of list) {
|
|
285
|
+
const row = rows.find((item) => item?.id === id);
|
|
286
|
+
mailboxAnswers.set(id, { answer: row?.replies?.[0]?.id ?? null, askedOf: row?.session ?? null });
|
|
287
|
+
}
|
|
288
|
+
} catch (error) { for (const id of list) mailboxAnswers.set(id, { error: `the answer to ${id} could not be read: ${String(error.message).slice(0, 200)}` }); }
|
|
286
289
|
}
|
|
287
290
|
function answerTo(id) {
|
|
288
291
|
const observed = mailboxAnswers.get(id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-orchestrator",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.88",
|
|
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": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@volter/supercode-harness-sdk": "^0.3.60",
|
|
28
|
-
"@volter/teams": "0.2.
|
|
28
|
+
"@volter/teams": "0.2.32",
|
|
29
29
|
"@volter/ztrack": "^2.4.23",
|
|
30
30
|
"yaml": "^2.9.0"
|
|
31
31
|
},
|