@volter/supercode-orchestrator 0.4.12 → 0.4.13

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/package.json +1 -1
  2. package/reducer.mjs +14 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.4.12",
3
+ "version": "0.4.13",
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": {
package/reducer.mjs CHANGED
@@ -549,8 +549,8 @@ function handleTick(state, ev, effects) {
549
549
  // ---------------------------------------------------------------- restart / adapter / operator
550
550
 
551
551
  // §4.7 on a clean stop: the daemon closes every runtime, so each binding that held one keeps it as the runtime to
552
- // resume, as a crash's pass marks it, and the next line reopens the same session. A turn cut off mid-way is told so
553
- // on its surface; an idle binding is not.
552
+ // resume, as a crash's pass marks it, and the restart reopens the same session (a clean stop is a restart's). A turn
553
+ // cut off mid-way is told so on its surface; an idle binding is not.
554
554
  function handleStopping(state, ev, effects) {
555
555
  const rt = ensureRuntime(state);
556
556
  for (const profile of Object.values(state.profiles)) {
@@ -558,6 +558,8 @@ function handleStopping(state, ev, effects) {
558
558
  if (b.ended_at || ks.includes('#') || !b.residue?.runtime_id) continue;
559
559
  b.residue.resume_runtime_id = b.residue.runtime_id;
560
560
  delete b.residue.runtime_id;
561
+ // a stop for a restart: what was live now is live again once the daemon is back (handleRestart)
562
+ if (b.key.platform !== 'webhook' && b.key.platform !== 'cron') b.residue.reopen_at_start = true;
561
563
  if (rt.turns[leaseId(profile.name, ks)] && !b.recurrence && b.key.platform !== 'webhook' && b.key.platform !== 'cron') {
562
564
  b.residue.interrupted_at = ev.at;
563
565
  reply(state, profile, b.key, REPLY.interrupted, ev.at, effects);
@@ -579,7 +581,16 @@ function handleRestart(state, ev, effects) {
579
581
  // attaches where the worker's door allows it and marks the rest
580
582
  // interrupted (`binding_interrupted` below).
581
583
  for (const [ks, b] of Object.entries(profile.bindings)) {
582
- if (b.ended_at || ks.includes('#') || !b.residue?.runtime_id) continue;
584
+ if (b.ended_at || ks.includes('#')) continue;
585
+ // one the clean stop closed reopens its own session now, so its conversation stays reachable (a message, a
586
+ // voice line) rather than waiting for its next inbound
587
+ if (!b.residue?.runtime_id) {
588
+ if (!b.residue?.reopen_at_start) continue;
589
+ delete b.residue.reopen_at_start;
590
+ live += 1;
591
+ startWorker(state, profile, ks, effects);
592
+ continue;
593
+ }
583
594
  live += 1;
584
595
  // a message arriving while the attach is in flight queues behind it,
585
596
  // rather than starting a fresh runtime that would replace the session