@volter/supercode-orchestrator 0.5.61 → 0.5.63

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.
@@ -15,7 +15,9 @@ if (process.argv[2] === 'workflow') {
15
15
  if(verb!=='serve')timeCommand(`workflow ${verb??''}`.trim(),process.argv.slice(3));
16
16
  let code=0;
17
17
  try {code=await runWorkflow(process.argv.slice(3));}
18
- catch(error) {process.stderr.write(`supercode workflow: ${error.message??error}\n`);code=1;}
18
+ // a store's own error (SQLite's, with its errcode) is no message written for a person: its stack says which statement
19
+ // met it, as a follower's end in the connector's log (board events) otherwise could not
20
+ catch(error) {process.stderr.write(`supercode workflow: ${error.message??error}\n${error?.errcode!=null&&error.stack?`${error.stack}\n`:''}`);code=1;}
19
21
  finally {await closeWorld();}
20
22
  await Promise.all([process.stdout,process.stderr].map(stream=>new Promise(done=>stream.write('',done))));
21
23
  process.exit(code);
package/board/ci.mjs CHANGED
@@ -5,6 +5,7 @@ import { readFileSync, realpathSync, writeFileSync, renameSync, statSync } from
5
5
  import { dirname, join, relative } from 'node:path';
6
6
  import { createHash } from 'node:crypto';
7
7
  import { branchCheckouts, checkoutOf, isLocalWorkspace, resolveWorkspace } from './workspace.mjs';
8
+ import { noteStep } from '@volter/supercode-harness-sdk/slow-log';
8
9
 
9
10
  // GitHub is read through its REST API with Node's own fetch, not the gh binary: Node takes a World's trust bundle and
10
11
  // injector (NODE_EXTRA_CA_CERTS, NODE_OPTIONS), so a review World's GitHub twin answers it, where gh (Go) trusts only
@@ -35,7 +36,9 @@ function github(path, all = false) {
35
36
  const env = token ? { ...process.env, GH_TOKEN: token } : process.env;
36
37
  return spawnSync(process.execPath, ['--input-type=module', '-e', GITHUB_READ, path, all ? '1' : '0'], { env, encoding: 'utf8', timeout: 30_000, maxBuffer: 16 * 1024 * 1024 });
37
38
  };
39
+ const started = performance.now();
38
40
  let result = read();
41
+ noteStep('github read', performance.now() - started);
39
42
  if (result.status !== 0 && !fixed && loginToken && /^GitHub 401 /.test(result.stderr ?? '')) { loginToken = null; result = read(); }
40
43
  if (result.status !== 0) throw new Error(`GitHub: ${(result.stderr || result.error?.message || 'read failed').trim().slice(-500)}`);
41
44
  return JSON.parse(result.stdout);
@@ -16,6 +16,7 @@
16
16
  // `workflow dispatch`) is harmless: every act of a round is a compare-and-set claim, a transaction that re-reads what it
17
17
  // acts on and does nothing when another round already acted (see `tick`). Every side effect follows a committed claim, so
18
18
  // a crash between the two steps is answered by the next round.
19
+ import { noteStep } from '@volter/supercode-harness-sdk/slow-log';
19
20
  import { monitorsRuns, failedObservation, surfaceIncident, auditEndedRuns, originOf } from './incidents.mjs';
20
21
  import { readMachineFleet } from './machine-fleet.mjs';
21
22
  import { boardLabel, boardName } from '@volter/teams/board-name';
@@ -77,7 +78,9 @@ function sc(args, { input = null, timeout = 120_000, as = null } = {}) {
77
78
  // `as`: the board this
78
79
  // command acts for, so a card's pane is started and closed by its board, whichever session ran the board's verb
79
80
  const env = commandEnv(as);
81
+ const started = performance.now();
80
82
  const r = spawnSync(supercodeBin(), args, { cwd: tmpdir(), input: input ?? undefined, encoding: 'utf8', timeout, env, maxBuffer: 512 * 1024 * 1024 });
83
+ noteStep(`supercode ${args[0]}`, performance.now() - started);
81
84
  return { code: r.status, stdout: r.stdout ?? '', stderr: (r.stderr ?? '') + (r.error ? r.error.message : '') };
82
85
  }
83
86
 
@@ -10,6 +10,7 @@
10
10
  // not linked (`machine_offline`): then it is offline. This machine's door not answering is no reading at all.
11
11
  import { spawnSync } from 'node:child_process';
12
12
  import { fileURLToPath } from 'node:url';
13
+ import { noteStep } from '@volter/supercode-harness-sdk/slow-log';
13
14
 
14
15
  const entry = fileURLToPath(new URL('../bin/machine-fleet.mjs', import.meta.url));
15
16
  const DEADLINE_MS = 10_000;
@@ -17,8 +18,10 @@ const DEADLINE_MS = 10_000;
17
18
  /** One reading of `machines` (normalized names) and this machine, `local`. */
18
19
  export function readMachineFleet(machines, local) {
19
20
  const names = [...new Set([local, ...machines])];
21
+ const started = performance.now();
20
22
  const reply = spawnSync(process.execPath, [entry], { input: JSON.stringify({ machines: names.map((name) => ({ name, at: name === local ? null : name })), deadlineMs: DEADLINE_MS }),
21
23
  encoding: 'utf8', timeout: DEADLINE_MS + 5_000, maxBuffer: 64 * 1024 * 1024 });
24
+ noteStep(`fleet reading (${names.length} machine${names.length === 1 ? '' : 's'})`, performance.now() - started);
22
25
  let rows = null;
23
26
  try { rows = JSON.parse(String(reply.stdout).trim().split('\n').pop()); } catch { /* no reading */ }
24
27
  // `panes`: each answering machine's live pane ids, whether or not a session was read in them
@@ -1,12 +1,16 @@
1
1
  import { spawnSync } from 'node:child_process';
2
2
  import { fileURLToPath } from 'node:url';
3
+ import { noteStep } from '@volter/supercode-harness-sdk/slow-log';
3
4
  const entry = fileURLToPath(new URL('../bin/runtime-door.mjs',import.meta.url));
4
5
 
5
6
  /** Public machine RPC only; no Teams binary or implementation/state-file access. */
6
7
  export function runtimeDoor(machine,method,params={}, {env=process.env,timeout=60_000,as=null}={}) {
8
+ // a step of the running command (a dispatch round's slow-log line names its doors, and their time, by method)
9
+ const started = performance.now();
7
10
  const result = spawnSync(process.execPath,[entry],{
8
11
  input:JSON.stringify({machine,method,params}),encoding:'utf8',timeout,
9
12
  env:{...env,...(as?{SUPERCODE_CALLER:as}:{})},maxBuffer:512*1024*1024,
10
13
  });
14
+ noteStep(`door ${method}${machine ? ' (another machine)' : ''}`, performance.now() - started);
11
15
  return {code:result.status,stdout:result.stdout??'',stderr:(result.stderr??'')+(result.error?.message??'')};
12
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.5.61",
3
+ "version": "0.5.63",
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": {