@volter/supercode-orchestrator 0.4.66 → 0.4.68

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.
package/board/cli.mjs CHANGED
@@ -10,7 +10,7 @@ import { basename, join, resolve } from 'node:path';
10
10
  import { tmpdir } from 'node:os';
11
11
  import { read } from '../orchestration.mjs';
12
12
  import { holdDispatcherLock } from '../hermes-locks.mjs';
13
- import { backingOf, boardExists, boardPath, DEFAULT_BOARD, event, json, listBoards, logsDir, now, openBoard, tx } from './store.mjs';
13
+ import { backingOf, boardExists, boardPath, DEFAULT_BOARD, event, json, listBoards, logsDir, now, openBoard, setActor, tx } from './store.mjs';
14
14
  import * as engine from './engine.mjs';
15
15
  import { adoptSession, boardAddress, boardLabel, boardSettings, callerSession, lanesOf, localMachine, observeFleet, paused, plan, startCard, tick } from './dispatch.mjs';
16
16
  import { loadWorkflow, statusOf, useWorkflow, workflowEntry, workflowFor } from './workflow.mjs';
@@ -234,6 +234,8 @@ export async function runWorkflow(argv) {
234
234
 
235
235
  // a caller that is a card's own session (its harness names it; the board recorded which session it launched)
236
236
  const sid = callerSession();
237
+ // what this command records is the calling session's act (its address, as its subscriptions name it)
238
+ if (sid) setActor(`sc:${localMachine()}:${sid === process.env.CODEX_THREAD_ID ? 'codex' : 'claude-code'}:${sid}`);
237
239
  if (sid && !READS.has(verb) && boardExists(root, slug)) {
238
240
  withBoard((b) => { const own = ownCard(b.db, sid); if (own) authorize(b.db, verb, rest, args, own); });
239
241
  }
@@ -241,6 +243,8 @@ export async function runWorkflow(argv) {
241
243
  // every verb reads the board through its workflow (a list settles cards too), so every verb loads it
242
244
  if (verb !== 'help') await loadWorkflow(root).catch((error) => { if (verb !== 'init' && verb !== 'boards') throw error; });
243
245
  engine.setCaller((db, cardId) => rolesFor(db, cardId, sid, workflowFor(root).params));
246
+ // a verb with no session behind it (a person at the CLI, the board file's sync) is the manager's, as its roles are
247
+ if (!sid && verb !== 'help') { try { setActor([].concat(workflowFor(root).params?.managers ?? [])[0] ?? null); } catch { /* no workflow */ } }
244
248
 
245
249
  switch (verb) {
246
250
  case 'init': {
@@ -21,7 +21,7 @@ import { hostname, tmpdir } from 'node:os';
21
21
  import { basename, dirname, join } from 'node:path';
22
22
  import { randomUUID } from 'node:crypto';
23
23
  import { fileURLToPath } from 'node:url';
24
- import { boardPath, claimer, event, json, listBoards, logsDir, now, openBoard, tx } from './store.mjs';
24
+ import { boardPath, claimer, event, json, listBoards, logsDir, now, openBoard, setActor, tx } from './store.mjs';
25
25
  import { holdBoardTickLock } from '../hermes-locks.mjs';
26
26
  import { doors, fire, loadWorkflow, resumeOf, scopeOf, statusOf, templateValue, workflowFor } from './workflow.mjs';
27
27
  import { evaluate, holds, render } from './expr.mjs';
@@ -931,6 +931,8 @@ async function notify(board, fleet, report, entry) {
931
931
  try {
932
932
  for (const ev of events) {
933
933
  const p = json(ev.payload, {}) ?? {};
934
+ // nobody is told of their own act
935
+ if (p.by && p.by === sub.chat_id) { cursor = ev.id; continue; }
934
936
  let text;
935
937
  if (ev.kind === 'commented') {
936
938
  if (p.author === sub.chat_id) { cursor = ev.id; continue; }
@@ -1222,6 +1224,8 @@ export async function tick({ root, lanes, settings, only = null, slugs = null, d
1222
1224
  try {
1223
1225
  board = openBoard(root, slug);
1224
1226
  board.label = boardLabel(root, slug);
1227
+ // what the dispatcher records on its own is the board's act
1228
+ setActor(boardAddress(board.label));
1225
1229
  // where the tick's time goes, phase by phase (ms), printed by `serve --verbose` and in `--json`
1226
1230
  let mark = Date.now();
1227
1231
  const phase = (name) => { const t = Date.now(); report.ms[name] = t - mark; mark = t; };
package/board/store.mjs CHANGED
@@ -196,8 +196,14 @@ export function json(text, fallback = null) {
196
196
  }
197
197
 
198
198
  /** Append one event to a card's thread (Hermes's `task_events`); answers its id. */
199
+ // the session whose command this process runs (its address), set by the CLI: each event it records says who acted
200
+ // (`by`), so the session is not told of its own act
201
+ let actor = null;
202
+ export function setActor(address) { actor = address || null; }
203
+
199
204
  export function event(db, taskId, kind, payload = null, runId = null) {
205
+ const said = actor && !(payload && 'by' in payload) ? { ...(payload ?? {}), by: actor } : payload;
200
206
  const r = db.prepare('INSERT INTO task_events (task_id, run_id, kind, payload, created_at) VALUES (?, ?, ?, ?, ?)')
201
- .run(taskId, runId, kind, payload ? JSON.stringify(payload) : null, now());
207
+ .run(taskId, runId, kind, said ? JSON.stringify(said) : null, now());
202
208
  return Number(r.lastInsertRowid);
203
209
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.4.66",
3
+ "version": "0.4.68",
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": {