@volter/supercode-orchestrator 0.5.116 → 0.5.117

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
@@ -4,7 +4,7 @@
4
4
  // `serve`, `--at`) are added beside them. The Rust CLI hands every verb but `load` to `bin/orchestrator.mjs workflow`,
5
5
  // which lands here. The home is `--root`, else `SUPERCODE_ORCHESTRATOR_HOME`; the board is
6
6
  // `--board <slug>`, else `HERMES_KANBAN_BOARD`, else the home's current board (`kanban/current`), else `default`.
7
- import { machineCall, closeDoors } from './doors.mjs';
7
+ import { machineCall, closeDoors, onLocalReopen } from './doors.mjs';
8
8
  import { createHash } from 'node:crypto';
9
9
  import { DatabaseSync } from 'node:sqlite';
10
10
  import { homeOf, parse } from './args.mjs';
@@ -1699,14 +1699,21 @@ async function serve(root, args = {}) {
1699
1699
  try { const { PerformanceObserver } = await import('node:perf_hooks'); new PerformanceObserver((list) => { for (const entry of list.getEntries()) noteStep('gc', entry.duration); }).observe({ entryTypes: ['gc'] }); } catch { /* no gc entries here */ }
1700
1700
  // The board's events are published by this machine's connector, not by the dispatcher (D137, D138 step 4): the home is
1701
1701
  // named to the daemon once, and the connector follows its `workflow events` from then on, with or without this serve.
1702
- { let named = null, refusal = null;
1703
- // 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
1702
+ // This process is the home's owner: it names its pid (its claim), which the daemon takes only if it holds the home's
1703
+ // lock. It names it again to each daemon that starts while it serves: the owner a restarted daemon restores from its
1704
+ // file stands only if the kernel probe at its start agreed, and an owner it dropped lost the board's authority over the
1705
+ // panes the board launched (a close refused as "not started by this command").
1706
+ const registerOwner = async () => {
1707
+ let named = null, refusal = null;
1704
1708
  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; }
1705
1709
  const refused = named?.refused ?? null;
1706
1710
  log(refusal ? `board events: not published; the machine daemon did not take this home: ${refusal}`
1707
1711
  : refused ? `board events: registered, but the team refused this machine's credential (${refused.status}); nothing is published until it is re-enrolled`
1708
1712
  : named?.published === false ? `board ownership: registered locally; this machine has no team connector to publish events`
1709
- : `board events: this home is published by the machine's connector`); }
1713
+ : `board events: this home is published by the machine's connector`);
1714
+ };
1715
+ await registerOwner();
1716
+ onLocalReopen(registerOwner);
1710
1717
  log('dispatch wakes on board writes, document edits and board mail; the interval sweep reads each machine\'s own door');
1711
1718
  const stuck = {};
1712
1719
  const warned = {};
package/board/doors.mjs CHANGED
@@ -9,6 +9,12 @@ import { SupercodeHarnessClient } from '@volter/supercode-harness-sdk';
9
9
  import { noteStep } from '@volter/supercode-harness-sdk/slow-log';
10
10
 
11
11
  const held = new Map(); // machine name, '' for this one → Promise<{ channel, node, harness }>
12
+ // Called each time a channel to this machine's daemon opens again after one closed (the daemon restarted): what this
13
+ // process told the daemon it had held only while that daemon ran.
14
+ const reopened = new Set();
15
+ let localOpened = false;
16
+ /** Run `fn` each time the channel to this machine's daemon opens again (a daemon restart). */
17
+ export function onLocalReopen(fn) { reopened.add(fn); }
12
18
 
13
19
  async function opened(machine) {
14
20
  const key = machine ?? '';
@@ -25,6 +31,7 @@ async function opened(machine) {
25
31
  return door;
26
32
  })();
27
33
  held.set(key, opening);
34
+ if (!key) opening.then(() => { if (localOpened) for (const fn of reopened) Promise.resolve().then(fn).catch(() => {}); localOpened = true; }, () => {});
28
35
  try { return await opening; } catch (error) { held.delete(key); throw error; }
29
36
  }
30
37
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.5.116",
3
+ "version": "0.5.117",
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": {