@volter/supercode-orchestrator 0.4.52 → 0.4.54

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/cli.mjs +17 -6
  2. package/package.json +1 -1
package/board/cli.mjs CHANGED
@@ -4,7 +4,7 @@
4
4
  // `serve`, `--at`) are added beside them. The Rust CLI hands every verb but `load` to `bin/orchestrator.mjs workflow`,
5
5
  // which lands here. The home is `--root`, else `SUPERCODE_ORCHESTRATOR_HOME`, else `HERMES_HOME`; the board is
6
6
  // `--board <slug>`, else `HERMES_KANBAN_BOARD`, else the home's current board (`kanban/current`), else `default`.
7
- import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from 'node:fs';
7
+ import { appendFileSync, copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from 'node:fs';
8
8
  import { spawnSync } from 'node:child_process';
9
9
  import { basename, join, resolve } from 'node:path';
10
10
  import { tmpdir } from 'node:os';
@@ -1084,7 +1084,13 @@ async function serve(root, args = {}) {
1084
1084
  const stop = () => { stopped = true; };
1085
1085
  process.on('SIGTERM', stop);
1086
1086
  process.on('SIGINT', stop);
1087
- const log = (text) => process.stdout.write(`${new Date().toISOString()} ${text}\n`);
1087
+ // what the serve says is kept in the home too (logs/workflow-serve.log), so why it stopped outlives its pane
1088
+ const kept = join(root, 'logs', 'workflow-serve.log');
1089
+ const log = (text) => {
1090
+ const line = `${new Date().toISOString()} ${text}\n`;
1091
+ process.stdout.write(line);
1092
+ try { mkdirSync(join(root, 'logs'), { recursive: true }); appendFileSync(kept, line); } catch { /* the pane still has it */ }
1093
+ };
1088
1094
  // the orchestrator this serve runs, as installed: a newer install ends the serve after its tick, so whatever keeps it
1089
1095
  // running starts it again on the new code (a fix reaches the board with no hand relaunch)
1090
1096
  const installed = () => { try { return JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version ?? null; } catch { return null; } };
@@ -1117,17 +1123,22 @@ async function serve(root, args = {}) {
1117
1123
  } catch (error) {
1118
1124
  log(`tick failed: ${error.message}`);
1119
1125
  }
1120
- const now = installed();
1121
- if (running && now && now !== running) { log(`orchestrator ${now} is installed (this serve runs ${running}); stopping, for its keeper to start the new one`); break; }
1126
+ // a newer install is looked for after each tick and through the wait before the next
1127
+ const newer = () => { const now = installed(); return running && now && now !== running ? now : null; };
1128
+ let moved = newer();
1122
1129
  // the next tick is due an interval after this one began (a long tick is not followed by a full interval's wait)
1123
1130
  const rest = Math.max(1, interval - Math.floor((Date.now() - began) / 1000));
1124
- for (let waited = 0; waited < rest && !stopped; waited += 1) await new Promise((done) => setTimeout(done, 1000));
1131
+ for (let waited = 0; waited < rest && !stopped && !moved; waited += 1) {
1132
+ await new Promise((done) => setTimeout(done, 1000));
1133
+ if (waited % 5 === 4) moved = newer();
1134
+ }
1135
+ if (moved) { log(`orchestrator ${moved} is installed (this serve runs ${running}); stopping, for its keeper to start the new one`); break; }
1125
1136
  }
1126
1137
  } finally {
1127
1138
  lock.release();
1128
1139
  if (args.pidfile) { try { unlinkSync(args.pidfile); } catch { /* gone */ } }
1129
1140
  }
1130
- log('stopped');
1141
+ log(stopped ? 'stopped (a signal)' : 'stopped');
1131
1142
  return 0;
1132
1143
  }
1133
1144
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.4.52",
3
+ "version": "0.4.54",
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": {