@prplkane/roundtable 0.6.4 → 0.6.6

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,10 +15,11 @@ export const HELP = {
15
15
  resume: 'Resume an interrupted review. May make provider calls.',
16
16
  verdict: 'Request a missing or failed verdict from saved replies. May make a provider call.',
17
17
  },
18
+ acp: 'To use a saved AgentLink profile, select vendor="acp" and account="profile-name" for each seat and the chairman. Requires stateless memory and allowLimitedIsolation=true after the person accepts profile-owned permissions, customization and billing. Roundtable denies client tools and stops reported tool activity. AgentLink must already be installed/configured. Missing token usage stays unknown and stops further calls for that seat under its cap; no live quota is inferred.',
18
19
  setup: 'Use roundtable server status to inspect the local board; roundtable server start launches it hidden if needed (add --fake for a free test). After an update, server restart refuses active reviews. This client reads its launch token locally; it never prints or stores the token.',
19
20
  input: 'check/start accept the same {fieldNotes,seats,chairman,options} JSON as the board. Check available providers first. Every result with an id carries board, a link where a person can watch the review in a browser; offer it, do not open it.',
20
21
  recipe: {
21
- questions: 'When nextAction.type is ask_user, present gate.questions with an available user-input tool; if unavailable, ask in normal chat. Tell the user the autoContinueAt deadline and that unknowns stay unknown. Do not just print JSON or answer for the user. In an async host, use nextAction.waitCommand while the question is pending; await_user means it has already been shown, so do not ask again. Read status before sending the user reply; if the round has advanced, preserve the reply and report that it was not submitted. Use hold only when the person needs more time, never as an automatic keepalive.',
22
+ questions: 'When nextAction.type is ask_user, present gate.questions with an available user-input tool; if unavailable, ask in normal chat. Tell the user when the answer window closes (gate.secondsUntilAutoContinue, or gate.autoContinueAtIso; autoContinueAt is epoch milliseconds) and that unknowns stay unknown. Send the user\'s own reply as answers with from "user"; anything you add yourself goes in message, or in an answer with from "assistant". Do not just print JSON or answer for the user. In an async host, use nextAction.waitCommand while the question is pending; await_user means it has already been shown, so do not ask again. Read status before sending the user reply; if the round has advanced, preserve the reply and report that it was not submitted. Use hold only when the person needs more time, never as an automatic keepalive.',
22
23
  size: 'Normally use two seats, critiqueRounds 1 (the engine default), memory stateless and an explicit budget per vendor: up to five calls before repairs. Use 0 only for a requested quick comparison and disclose that the seats did not respond to each other. Consider 2 for a requested deep review or a decision with several consequential trade-offs, within the user\'s time and budget. Consensus can end discussion early. Do not automatically start another review or exceed agreed limits because disagreement remains.',
23
24
  completion: 'A start acknowledgement or seat positions are not a completed review. Keep waiting through status running and verdict until status done and verdict.status ready. If interrupted, failed, skipped or missing, report that limitation instead of supplying your own chairman result. Include the review id, board link and depth.completedCritiqueRounds in the final report.',
24
25
  lenses: 'Give every seat a different lens, taken from what the decision could get wrong: risk, cost, evidence, reversibility, long-term effects, user impact. Two seats with one lens mostly agree, which wastes a call.',
@@ -64,11 +65,17 @@ export async function runAgent(command, flags = {}, input, signal) {
64
65
  result = await request(`${route}/state`);
65
66
  if (['researching', 'running', 'verdict'].includes(result.status) || result.status === 'waiting' && (result.gate?.round === afterRound || result.gate?.mode === 'countdown' && !result.gate.questions.length)) {
66
67
  const controller = new AbortController(), timer = setTimeout(() => controller.abort(), seconds * 1000);
68
+ const waiting = signal ? AbortSignal.any([signal, controller.signal]) : controller.signal;
67
69
  let reader;
70
+ // Node 22 can lose fetch's abort link after collection while an SSE body
71
+ // is idle. Cancel the held reader directly so its pending read settles.
72
+ const cancelRead = () => { reader?.cancel().catch(() => {}); };
73
+ waiting.addEventListener('abort', cancelRead, { once: true });
68
74
  try {
69
- const response = await fetch(`${base}${route}/events`, { redirect: 'error', signal: signal ? AbortSignal.any([signal, controller.signal]) : controller.signal, headers: { 'last-event-id': result.revision } });
75
+ const response = await fetch(`${base}${route}/events`, { redirect: 'error', signal: waiting, headers: { 'last-event-id': result.revision } });
70
76
  if (!response.ok) throw new Error('Could not wait for review events.');
71
77
  reader = response.body.getReader();
78
+ waiting.throwIfAborted();
72
79
  const decoder = new TextDecoder(); let buffer = '', finished = false;
73
80
  while (!finished) {
74
81
  const next = await reader.read(); if (next.done) break;
@@ -82,8 +89,13 @@ export async function runAgent(command, flags = {}, input, signal) {
82
89
  }
83
90
  }
84
91
  }
92
+ signal?.throwIfAborted();
85
93
  } catch (error) { signal?.throwIfAborted(); if (!controller.signal.aborted) throw error; }
86
- finally { clearTimeout(timer); if (reader) await reader.cancel().catch(() => {}); }
94
+ finally {
95
+ clearTimeout(timer);
96
+ waiting.removeEventListener('abort', cancelRead);
97
+ if (reader) await reader.cancel().catch(() => {});
98
+ }
87
99
  result = await request(`${route}/state`);
88
100
  }
89
101
  result = { ...result, board: board(flags.id) };
package/src/doctor.js CHANGED
@@ -54,6 +54,13 @@ async function main() {
54
54
  if (a.kind === 'cli') try { bin = resolveBinary(a.binary, a.npmBin); } catch (e) { lookup = e.message; }
55
55
  if (a.kind === 'cli' && !bin && only !== vendor) { missing.push(`${a.label} (${a.binary})`); continue; }
56
56
  console.log(`\n== ${paintVendor(a)} (${vendor}) pool: ${a.pool}`);
57
+ if (a.kind === 'acp') {
58
+ console.log(' seat it choose AgentLink (ACP) and a saved profile on the board; use stateless memory');
59
+ console.log(' check it agentlink doctor; agentlink check PROFILE (initialization only)');
60
+ console.log(` isolation ${a.isolation}`);
61
+ console.log(' live call use an explicitly selected profile in a review; no default ACP agent is launched');
62
+ continue;
63
+ }
57
64
  if (a.kind === 'api') { // no binary: everything about an endpoint seat is on its card
58
65
  console.log(' seat it on the board: base URL (…/v1), model id, and for a hosted API the NAME of the key variable');
59
66
  console.log(` efforts ${a.effortLevels.join(', ')} (reasoning_effort, sent only when set)`);
package/src/engine.js CHANGED
@@ -80,7 +80,7 @@ export function createDebate({ fieldNotes, seats, chairman, options = {}, runner
80
80
  delete seat.lastRawUsage;
81
81
  return seat;
82
82
  }),
83
- chairman: chairman || { vendor: seats[0].vendor },
83
+ chairman: chairman || { vendor: seats[0].vendor, ...(seats[0].vendor === 'acp' ? { account: seats[0].account, model: seats[0].model } : {}) },
84
84
  startedAt: null, deadlineAt: null, stopContext: null, fieldNotes, options: opts, usage: [], research: resume?.research || null,
85
85
  };
86
86
  const fire = (type, payload = {}) => emit(type, { ...payload, type });
@@ -516,7 +516,7 @@ export function createDebate({ fieldNotes, seats, chairman, options = {}, runner
516
516
  // effort, once. The board is told which and why; the record keeps the fallback chairman.
517
517
  function fallbackChairman(from) {
518
518
  const tried = new Set([`${from.vendor}@${from.account || ''}`]);
519
- const seat = state.seats.find((s) => !tried.has(`${s.vendor}@${s.account || ''}`) && !downOf(s) && !policyBlocked(s) && s.vendor !== from.vendor);
519
+ const seat = state.seats.find((s) => !tried.has(`${s.vendor}@${s.account || ''}`) && !downOf(s) && !policyBlocked(s) && (s.vendor !== from.vendor || s.vendor === 'acp'));
520
520
  return seat ? { vendor: seat.vendor, account: seat.account, colour: seat.colour, model: seat.endpoint ? seat.model : undefined, effort: undefined, ...(seat.endpoint ? { endpoint: seat.endpoint, keyEnv: seat.keyEnv } : {}) } : null;
521
521
  }
522
522