@volter/supercode-orchestrator 0.5.86 → 0.5.87

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
@@ -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
- try { named = await machineCall(null, 'harness.v1.boards.register', { root }, { timeoutMs: 30_000 }); } catch (error) { refusal = error.message; }
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`
@@ -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
  /**
@@ -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
- * named to the daemon as the caller, which it takes from the process that registered that board's home (machine.mjs).
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 named = as && !method.startsWith('harness.v1.sessions.') ? { ...params, caller: as } : params;
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.5.86",
3
+ "version": "0.5.87",
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.31",
28
+ "@volter/teams": "0.2.32",
29
29
  "@volter/ztrack": "^2.4.23",
30
30
  "yaml": "^2.9.0"
31
31
  },