@volter/supercode-orchestrator 0.4.111 → 0.4.112

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.
@@ -1124,7 +1124,7 @@ export function adoptSession(board, id, who, { workspace = null, ttl, assignee =
1124
1124
 
1125
1125
  // a notice sent within a transaction's caller that cannot await (the launcher): the same door, synchronously
1126
1126
  function deliverNow(board, to, body, key) {
1127
- const request = { op: 'send', from: boardAddress(board.label), from_name: `${board.label} board`, to, queue: false, id: key,
1127
+ const request = { op: 'send', from: boardAddress(board.label), from_name: `${board.label} board`, to, queue: false, id: key, subject: String(body).split('\n')[0].slice(0, 160),
1128
1128
  body: `[Board notice from the ${board.label} board] ${body}\n\n(An automated notice from the board's dispatcher; replies to this address go nowhere.)` };
1129
1129
  const r = sc(['message', 'remote-deliver'], { input: JSON.stringify(request), timeout: 120_000 });
1130
1130
  const answer = lastJson(r.stdout);
@@ -1133,7 +1133,7 @@ function deliverNow(board, to, body, key) {
1133
1133
 
1134
1134
  async function send(from, label, to, body, key, { queue = false, ask = false } = {}) {
1135
1135
  const request = {
1136
- op: 'send', from, from_name: `${label} board`, to, queue, id: key,
1136
+ op: 'send', from, from_name: `${label} board`, to, queue, id: key, subject: String(body).split('\n')[0].slice(0, 160),
1137
1137
  // a question the board waits on is answered by a reply; a notice is not
1138
1138
  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.)`,
1139
1139
  };
@@ -344,7 +344,7 @@ export function fire(db, board, entry, id, name, { roles = [], payload = {}, ext
344
344
  // `sender`: the roles the event was sent with (a validator can ask who is asking)
345
345
  const scope = scopeOf(db, board, task, { params, event: payload, extra: { lanes: lanesIn(entry), ...extra, sender: roles } });
346
346
  const allowed = candidates.filter((t) => !t.by?.length || t.by.some((r) => roles.includes(r)));
347
- if (!allowed.length) throw new Error(`${id} is ${from}; ${name.replace(/_/g, '-')} there is for ${[...new Set(candidates.flatMap((t) => t.by ?? []))].join(' or ')}`);
347
+ if (!allowed.length) throw new Error(`${id} is ${from}; ${name.replace(/_/g, '-')} there is for ${[...new Set(candidates.flatMap((t) => t.by ?? []))].join(' or ')}. ${candidates.map((t) => t.description).filter(Boolean).join(' ')}`);
348
348
  const taken = allowed.find((t) => holds(t.guard ?? null, scope));
349
349
  if (!taken) { const none = new Error(`${id} is ${from}; ${name.replace(/_/g, '-')} does not apply to it now`); none.noTransition = true; throw none; }
350
350
  for (const v of taken.validate ?? []) {
@@ -557,7 +557,8 @@ const ACTIONS = {
557
557
  if (!['paused', 'archived'].includes(name)) throw new Error(`unknown flag ${name}`);
558
558
  if (name === 'paused') {
559
559
  const was = json(one(ctx.db, 'SELECT paused FROM supercode_cards WHERE task_id = ?', ctx.id)?.paused, null);
560
- if (!value && was && was.by !== actorOf() && !ctx.scope.sender?.includes('owner') && !(ctx.scope.sender?.includes('hermes') && ctx.scope.event?.hermes)) throw new Error('only the pauser or owner may resume this card');
560
+ const clearBy = ctx.entry.workflow.flags?.paused?.clear_by ?? ['pauser', 'owner'];
561
+ if (!value && was && !clearBy.some((role) => role === 'pauser' ? was.by === actorOf() : ctx.scope.sender?.includes(role))) throw new Error(`only ${clearBy.join(' or ')} may resume this card; ask the manager with your reason`);
561
562
  if (value && !String(reason ?? '').trim()) throw new Error('pause needs a reason');
562
563
  cardField(ctx, name, value ? JSON.stringify({ by: actorOf(), reason }) : null);
563
564
  } else cardField(ctx, name, Number(Boolean(value)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-orchestrator",
3
- "version": "0.4.111",
3
+ "version": "0.4.112",
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": {