@volter/supercode-orchestrator 0.5.93 → 0.5.94
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/doors.mjs +23 -2
- package/package.json +1 -1
package/board/doors.mjs
CHANGED
|
@@ -38,11 +38,32 @@ export async function machineCall(machine, method, params = {}, { timeoutMs = 60
|
|
|
38
38
|
const started = performance.now();
|
|
39
39
|
try {
|
|
40
40
|
const door = await opened(machine);
|
|
41
|
+
// A stream on the channel ends with the daemon behind it (another machine's daemon restarting, an upgrade), while
|
|
42
|
+
// the channel to it stays open: a held stream is used only while it is open, and opened again once it is not.
|
|
41
43
|
if (method.startsWith('harness.v1.sessions.')) {
|
|
42
|
-
door.harness
|
|
44
|
+
if (door.harness && door.harnessStarted && !door.harnessTransport?.running) {
|
|
45
|
+
const ended = door.harness;
|
|
46
|
+
door.harness = null;
|
|
47
|
+
void ended.then((client) => client.close?.(), () => {}).catch(() => {});
|
|
48
|
+
}
|
|
49
|
+
if (!door.harness) {
|
|
50
|
+
const transport = harnessTransport(door.channel);
|
|
51
|
+
door.harnessTransport = transport;
|
|
52
|
+
door.harnessStarted = false;
|
|
53
|
+
const starting = (async () => { const client = new SupercodeHarnessClient({ transport }); await client.start?.(); door.harnessStarted = true; return client; })();
|
|
54
|
+
starting.catch(() => { if (door.harness === starting) door.harness = null; });
|
|
55
|
+
door.harness = starting;
|
|
56
|
+
}
|
|
43
57
|
return await (await door.harness).request(method, params, { timeoutMs });
|
|
44
58
|
}
|
|
45
|
-
|
|
59
|
+
if (!door.node) {
|
|
60
|
+
const opening = door.channel.open('node').then((stream) => {
|
|
61
|
+
stream.on('close', () => { if (door.node === opening) door.node = null; });
|
|
62
|
+
return new StreamRpc(stream);
|
|
63
|
+
});
|
|
64
|
+
opening.catch(() => { if (door.node === opening) door.node = null; });
|
|
65
|
+
door.node = opening;
|
|
66
|
+
}
|
|
46
67
|
return await (await door.node).call(method, params, { timeoutMs });
|
|
47
68
|
} finally {
|
|
48
69
|
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.
|
|
3
|
+
"version": "0.5.94",
|
|
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": {
|