@volter/supercode-orchestrator 0.5.93 → 0.5.95

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.
Files changed (2) hide show
  1. package/board/doors.mjs +17 -2
  2. package/package.json +1 -1
package/board/doors.mjs CHANGED
@@ -39,10 +39,25 @@ export async function machineCall(machine, method, params = {}, { timeoutMs = 60
39
39
  try {
40
40
  const door = await opened(machine);
41
41
  if (method.startsWith('harness.v1.sessions.')) {
42
- door.harness ??= (async () => { const client = new SupercodeHarnessClient({ transport: harnessTransport(door.channel) }); await client.start?.(); return client; })();
42
+ // The harness client starts its transport again itself once it ends (a daemon restart there); one that never
43
+ // started is let go, so the next call starts another.
44
+ if (!door.harness) {
45
+ const starting = (async () => { const client = new SupercodeHarnessClient({ transport: harnessTransport(door.channel) }); await client.start?.(); return client; })();
46
+ starting.catch(() => { if (door.harness === starting) door.harness = null; });
47
+ door.harness = starting;
48
+ }
43
49
  return await (await door.harness).request(method, params, { timeoutMs });
44
50
  }
45
- door.node ??= door.channel.open('node').then((stream) => new StreamRpc(stream));
51
+ // The node stream ends with the daemon behind it (another machine's daemon restarting, an upgrade) while the channel
52
+ // to it stays open: it is used only while it is open, and opened again once it is not.
53
+ if (!door.node) {
54
+ const opening = door.channel.open('node').then((stream) => {
55
+ stream.on('close', () => { if (door.node === opening) door.node = null; });
56
+ return new StreamRpc(stream);
57
+ });
58
+ opening.catch(() => { if (door.node === opening) door.node = null; });
59
+ door.node = opening;
60
+ }
46
61
  return await (await door.node).call(method, params, { timeoutMs });
47
62
  } finally {
48
63
  noteStep(`door ${method}${machine ? ' (another machine)' : ''}`, performance.now() - started);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.5.93",
3
+ "version": "0.5.95",
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": {