@volter/supercode-orchestrator 0.4.137 → 0.4.139

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
@@ -316,9 +316,10 @@ export async function runWorkflow(argv) {
316
316
  const address = args['no-notify'] ? null : args.notify ?? callerAddress();
317
317
  if (address) withBoard((b) => engine.subscribe(b, created.id, address, 'creator'));
318
318
  const task = withBoard((b) => view(b, (db) => engine.getTask(db, created.id)));
319
- if (args.json) { say(args, '', { ...cardDict(task), ...answer, notify: address ?? null }); return answer.failed ? 1 : 0; }
319
+ const recipients = withBoard(b => engine.subscriptions(b.db, created.id)).filter(s => s.platform === 'supercode').map(s => s.chat_id);
320
+ if (args.json) { say(args, '', { ...cardDict(task), ...answer, notify: address ?? null, recipients }); return answer.failed ? 1 : 0; }
320
321
  const said = answer.started ? `; started session ${answer.session} (${answer.mode})` : answer.failed ? `; did not start: ${answer.failed}` : answer.waits ? `; waits: ${answer.waits}` : '';
321
- say(args, `${created.existing ? 'Existing' : 'Created'} ${created.id} (${task.status}, assignee=${task.assignee || '-'})${said}${address ? `; notices go to ${address}` : ''}`, null);
322
+ say(args, `${created.existing ? 'Existing' : 'Created'} ${created.id} (${task.status}, assignee=${task.assignee || '-'})${said}${recipients.length ? `; notices go to ${recipients.join(', ')}` : ''}`, null);
322
323
  return answer.failed ? 1 : 0;
323
324
  }
324
325
 
@@ -1307,9 +1307,9 @@ function deliverNow(board, to, body, key) {
1307
1307
  if (!answer.receipt?.delivered) throw new Error(answer.receipt?.reason ?? 'native delivery confirmation pending');
1308
1308
  }
1309
1309
 
1310
- async function send(from, label, to, body, key, { queue = false, ask = false } = {}) {
1310
+ async function send(from, label, to, body, key, { queue = false, ask = false, subject } = {}) {
1311
1311
  const request = {
1312
- op: 'send', from, from_name: `${label} board`, to, queue, id: key, subject: String(body).split('\n')[0].slice(0, 160),
1312
+ op: 'send', from, from_name: `${label} board`, to, queue, id: key, subject: String(subject ?? String(body).split('\n')[0]).slice(0, 160),
1313
1313
  // a question the board waits on is answered by a reply; a notice is not
1314
1314
  body: ask ? `[A question from the ${label} board] ${body}` : `[Board notice from the ${label} board] ${body}\n\n(An automated notice from the board's dispatcher; replies to this address go nowhere.)`,
1315
1315
  };
@@ -1333,7 +1333,8 @@ export async function sendBoardMessages(board, report, taskId = null) {
1333
1333
  if (taskId && row.task_id !== taskId) continue;
1334
1334
  const m = json(row.payload, {}) ?? {};
1335
1335
  try {
1336
- const receipt = await send(boardAddress(board.label), board.label, m.to, m.text, m.message_id ?? `board-message-${row.id}`, { ask: Boolean(m.message_id) });
1336
+ const task = view(board, db => getTask(db, row.task_id));
1337
+ const receipt = await send(boardAddress(board.label), board.label, m.to, m.text, m.message_id ?? `board-message-${row.id}`, { ask: Boolean(m.message_id), subject: `${task?.title || row.task_id} · ${m.message_id ? 'Question' : 'Update'}` });
1337
1338
  if (!receipt.delivered) throw new Error(receipt.reason ?? 'queued; native transcript confirmation pending');
1338
1339
  tx(board, (db) => event(db, row.task_id, 'board_message_sent', { event: row.id, to: m.to, receipt, ...(m.message_id ? { message_id: m.message_id } : {}) }));
1339
1340
  } catch (error) {
@@ -1420,7 +1421,7 @@ async function notify(board, fleet, report, entry) {
1420
1421
  text = c ? noticeOf(entry, role, ev.kind, task, p, c) : null;
1421
1422
  } else text = noticeOf(entry, role, ev.kind, task, p);
1422
1423
  if (text) {
1423
- const receipt = await send(from, board.label, sub.chat_id, text, `board-${sub.task_id}-${ev.id}-${sub.chat_id.slice(-12)}`, { queue: !entry.workflow.run && sub.delivery_mode === 'notify' });
1424
+ const receipt = await send(from, board.label, sub.chat_id, text, `board-${sub.task_id}-${ev.id}-${sub.chat_id.slice(-12)}`, { queue: !entry.workflow.run && sub.delivery_mode === 'notify', subject: `${task?.title || sub.task_id} · ${ev.kind.replaceAll('_', ' ')}` });
1424
1425
  if (!receipt.delivered) { pending = Boolean(receipt.queued); throw new Error(receipt.reason ?? 'native delivery confirmation pending'); }
1425
1426
  tx(board, (db) => event(db, sub.task_id, 'notice_delivered', { source_event: ev.id, kind: ev.kind, address: sub.chat_id, receipt }));
1426
1427
  report.notified.push([sub.task_id, ev.kind, sub.chat_id]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.4.137",
3
+ "version": "0.4.139",
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": {