@volter/teams 0.2.58 → 0.2.59

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/home.mjs +21 -0
  2. package/package.json +1 -1
package/home.mjs CHANGED
@@ -231,6 +231,27 @@ export class Launches {
231
231
  }
232
232
  return [...last.values()].sort((a, b) => b.t - a.t);
233
233
  }
234
+ /** No launch rests at `issued` once its handler is gone (its daemon ended between that write and the next; `issuing`
235
+ * holds the keys a live handler still has): with its pane live in `panes` it is ready, and `ready(launch, pane)` is
236
+ * told; with its pane kept dead it ended as `exit(pane)` ({ failed, how }) says; with no pane it exited when its
237
+ * input had been confirmed, and failed otherwise. Answers the records it wrote. */
238
+ settleIssued(panes, { issuing = new Set(), onlyKey = null, exit, ready = () => {} }) {
239
+ const restarted = 'the daemon restarted before this launch became ready';
240
+ const settled = [];
241
+ for (const launch of this.all()) {
242
+ if (launch.status !== 'issued' || (onlyKey && launch.key !== onlyKey) || issuing.has(launch.key)) continue;
243
+ const { t: _previousAt, ...facts } = launch;
244
+ const pane = panes.find((row) => row.contextKey === launch.pane) ?? null;
245
+ const ended = pane?.dead ? exit(pane) : null;
246
+ const entry = pane && !pane.dead ? { ...facts, status: 'ready' }
247
+ : ended?.failed === false ? { ...facts, status: 'finished', completion: ended }
248
+ : ended ? { ...facts, status: 'exited', error: `${restarted}; its pane ended with ${ended.how}` }
249
+ : { ...facts, status: launch.inputDelivered === true ? 'exited' : 'failed', error: `${restarted}; its pane is gone` };
250
+ if (entry.status === 'ready') ready(launch, pane);
251
+ this.record(entry); settled.push(entry);
252
+ }
253
+ return settled;
254
+ }
234
255
  }
235
256
 
236
257
  /** `host:port` or `[v6]:port` → { host, port }. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/teams",
3
- "version": "0.2.58",
3
+ "version": "0.2.59",
4
4
  "type": "module",
5
5
  "description": "Volter Teams, the neutral team plane: machine identity and daemon core, the local door and server link, admission from machine grants, product doors, and the Teams server's neutral routes (company RFC 0008).",
6
6
  "license": "MIT",