@volter/supercode-orchestrator 0.4.19 → 0.4.20

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
@@ -40,7 +40,7 @@ supercode's own:
40
40
  create … --machine M --subtask-of ARC --notify ADDRESS|--no-notify --no-start
41
41
  With a pane lane and room, a card starts at once and answers "started" with its session; else it answers why it
42
42
  waits, and its creator is told when it starts. A subtask is worked by its arc's session and never starts alone.
43
- move <id> <machine|none> adopt <id> <session> close <id> serve (= daemon) list --machine M
43
+ move <id> <machine|none> adopt <id> <session> [--assignee P] close <id> serve (= daemon) list --machine M
44
44
  notify-subscribe <id> --address sc:<machine>:<harness>:<id> [--role creator|worker|dependency]
45
45
  Any verb … --at sc:<machine>:board:<home>: sent as mail to a board kept on another machine.
46
46
 
@@ -693,7 +693,7 @@ export async function runWorkflow(argv) {
693
693
  case 'adopt': {
694
694
  need(2, 'a card id and a session');
695
695
  const { settings } = await laneState(root);
696
- const got = withBoard((b) => adoptSession(b, id, rest[1], { workspace: args.workspace ?? null, ttl: settings.ttl }));
696
+ const got = withBoard((b) => adoptSession(b, id, rest[1], { workspace: args.workspace ?? null, ttl: settings.ttl, assignee: args.assignee ?? null }));
697
697
  say(args, `${id} is worked by ${got.address} (pane ${got.pane ?? '?'} in ${got.workspace ?? 'its card\'s directory'})`, { ok: true, ...got });
698
698
  return 0;
699
699
  }
@@ -583,7 +583,7 @@ function resolveLocalWorkspace(board, task) {
583
583
  * never as the session describes itself. From then on the board watches it, resumes it when lost, and tells it of
584
584
  * its card. `who` is an address, a session id, or a `name@machine` the fleet lists.
585
585
  */
586
- export function adoptSession(board, id, who, { workspace = null, ttl } = {}) {
586
+ export function adoptSession(board, id, who, { workspace = null, ttl, assignee = null } = {}) {
587
587
  const fleet = observeFleet();
588
588
  if (!fleet.ok) throw new Error(`supercode could not read the fleet: ${fleet.error}`);
589
589
  const found = fleet.sessions.find((s) => s.address === who || s.address.endsWith(`:${who}`) || s.name === who);
@@ -603,6 +603,8 @@ export function adoptSession(board, id, who, { workspace = null, ttl } = {}) {
603
603
  const was = lastSession(db, id);
604
604
  if (was && was.session_id !== sessionId && sessionAlive(fleet, was)) throw new Error(`${id} already has a live session, ${was.address}`);
605
605
  if (!task.machine) db.prepare('INSERT OR REPLACE INTO supercode_cards (task_id, machine, subtask_of) VALUES (?, ?, ?)').run(id, host, task.subtask_of);
606
+ // the lane that resumes it if it is lost, set in the same transaction (assigning first would let a tick start another)
607
+ if (assignee && assignee !== task.assignee) { db.prepare('UPDATE tasks SET assignee = ? WHERE id = ?').run(assignee, id); event(db, id, 'assigned', { assignee }); }
606
608
  if (dir && !(task.workspace_kind === 'dir' && task.workspace_path)) {
607
609
  db.prepare("UPDATE tasks SET workspace_kind = 'dir', workspace_path = ? WHERE id = ?").run(dir.replace(/^dir:/, ''), id);
608
610
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.4.19",
3
+ "version": "0.4.20",
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": {