@volter/supercode-orchestrator 0.5.18 → 0.5.19

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/dispatch.mjs +22 -1
  2. package/package.json +1 -1
@@ -1543,10 +1543,31 @@ export function completeAdoptions(board, fleet, settings, report, lanes = null)
1543
1543
  }
1544
1544
  }
1545
1545
 
1546
+ /**
1547
+ * A session on this machine that Teams never published (one outside every synced root: a profile's own directory) is
1548
+ * found through this machine's own doors: its panes, and the native session each pane's process runs. Only a full
1549
+ * address is looked up here; liveness is still verified below as for any other session.
1550
+ */
1551
+ function localListing(who) {
1552
+ const m = /^sc:([^:]+):([^:]+):(.+)$/.exec(String(who));
1553
+ if (!m || normalMachine(m[1]) !== localMachine()) return null;
1554
+ const [, , harness, sessionId] = m;
1555
+ const listed = runtimeDoor(null, 'harness.v1.panes.list', {}, { timeout: 60_000 });
1556
+ const panes = (listed.code === 0 ? json(listed.stdout.trim(), []) : []) ?? [];
1557
+ const live = panes.filter((p) => !p.dead && p.pid);
1558
+ if (!live.length) return null;
1559
+ const r = runtimeDoor(null, 'harness.v1.sessions.activity_under', { pids: live.map((p) => p.pid) }, { timeout: 30_000 });
1560
+ const row = (r.code === 0 ? json(r.stdout.trim(), {})?.activities ?? [] : []).find((a) => a.activity?.session_id === sessionId && (a.activity?.harness ?? harness) === harness);
1561
+ // Not found in a pane of this machine: not listed, so a session opened moments ago is looked for again next tick.
1562
+ const pane = row ? live.find((p) => p.pid === row.pid)?.pane ?? null : null;
1563
+ if (!pane) return null;
1564
+ return { address: `sc:${localMachine()}:${harness}:${sessionId}`, machine: localMachine(), harness, session_id: sessionId, pane, name: null };
1565
+ }
1566
+
1546
1567
  function adoptSession(board, id, who, { workspace = null, ttl, assignee = null, role = null, fleet = null, lanes = null } = {}) {
1547
1568
  fleet ??= observeFleet();
1548
1569
  if (!fleet.ok) throw new Error(`supercode could not read the fleet: ${fleet.error}`);
1549
- const found = fleet.sessions.find((s) => s.address === who || s.address.endsWith(`:${who}`) || s.name === who);
1570
+ const found = fleet.sessions.find((s) => s.address === who || s.address.endsWith(`:${who}`) || s.name === who) ?? localListing(who);
1550
1571
  if (!found) throw Object.assign(new Error(`the fleet lists no live session ${who}`), { notListed: true });
1551
1572
  const [, host, harness, sessionId] = found.address.split(':');
1552
1573
  if (!HARNESSES[harness]) throw new Error(`${found.address} is ${harness}; the board keeps and resumes ${Object.keys(HARNESSES).join(' and ')} sessions`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.5.18",
3
+ "version": "0.5.19",
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": {