@prplkane/roundtable 0.6.3 → 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.
- package/CHANGELOG.md +52 -0
- package/LICENSE +21 -21
- package/README.md +11 -4
- package/SECURITY.md +21 -2
- package/docs/workflow.md +122 -8
- package/package.json +1 -1
- package/scripts/mcp.mjs +4 -2
- package/skills/roundtable/SKILL.md +6 -2
- package/src/adapters/acp.js +201 -0
- package/src/adapters/agy.js +7 -7
- package/src/adapters/claude.js +6 -6
- package/src/adapters/codex.js +6 -6
- package/src/adapters/config.js +11 -1
- package/src/adapters/index.js +2 -1
- package/src/agent-client.js +15 -3
- package/src/doctor.js +15 -3
- package/src/engine.js +2 -2
- package/src/export.js +307 -307
- package/src/local-server.js +32 -4
- package/src/notes.js +8 -4
- package/src/prompts.js +1 -1
- package/src/review-view.js +4 -2
- package/src/seats.js +19 -4
- package/src/server.js +42 -10
- package/src/snapshot.js +10 -3
- package/src/terminal.js +36 -12
- package/src/ui/app.js +18 -8
- package/src/ui/design/preset-dusk.css +91 -91
- package/src/ui/design/tokens.css +129 -129
- package/src/validate.js +4 -1
package/src/local-server.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// A cheap, versioned health check; provider catalogues are not server readiness checks.
|
|
2
2
|
import { spawn } from 'node:child_process';
|
|
3
|
+
import { mkdtempSync, openSync, closeSync, readFileSync, rmSync } from 'node:fs';
|
|
4
|
+
import os from 'node:os';
|
|
3
5
|
import { realpath } from 'node:fs/promises';
|
|
4
6
|
import path from 'node:path';
|
|
5
7
|
import { fileURLToPath } from 'node:url';
|
|
@@ -43,23 +45,49 @@ export async function inspectServer(config, { signal, allowOlder = false } = {})
|
|
|
43
45
|
// Readiness reads may be retried. A review write is never part of this loop.
|
|
44
46
|
export async function ensureServer(config, { signal, timeoutMs = 35000 } = {}) {
|
|
45
47
|
const end = Date.now() + timeoutMs;
|
|
46
|
-
let spawned = false, spawnFailed = false, last;
|
|
48
|
+
let spawned = false, spawnFailed = false, exited = null, ready = false, last;
|
|
49
|
+
// The board's stderr goes to a file, never a pipe: it outlives this process, and a pipe to a
|
|
50
|
+
// gone host would break its logging. The file sits in a fresh private temp directory (no
|
|
51
|
+
// predictable path for another user to plant), is read only when the board exits early, and
|
|
52
|
+
// goes once the board is ready (at once where an open file can be unlinked, else when the
|
|
53
|
+
// board exits while this process is still around).
|
|
54
|
+
let log = null;
|
|
55
|
+
const discard = () => { try { if (log) rmSync(path.dirname(log), { recursive: true, force: true }); } catch {} };
|
|
47
56
|
while (Date.now() < end) {
|
|
48
57
|
signal?.throwIfAborted();
|
|
49
58
|
try {
|
|
50
59
|
const status = await inspectServer(config, { signal });
|
|
51
|
-
if (status) return status;
|
|
60
|
+
if (status) { if (spawned) { ready = true; discard(); } return status; }
|
|
52
61
|
if (config.start === false) throw new Error('Roundtable is not running; start the local board or remove --no-start.');
|
|
53
62
|
if (!spawned) {
|
|
54
63
|
spawned = true;
|
|
55
64
|
// Survives the host connection, so closing chat cannot cancel a review or its timer.
|
|
65
|
+
let fd = null;
|
|
66
|
+
try { log = path.join(mkdtempSync(path.join(os.tmpdir(), 'roundtable-start-')), 'stderr.log'); fd = openSync(log, 'wx'); } catch {}
|
|
56
67
|
const child = spawn(process.execPath, [SERVER, '--no-open', ...(config.fake ? ['--fake'] : [])], {
|
|
57
68
|
env: { ...process.env, PORT: String(config.port), ...(config.dataDir ? { ROUNDTABLE_DEBATES_DIR: config.dataDir } : {}) },
|
|
58
|
-
detached: true, windowsHide: true, stdio: 'ignore',
|
|
69
|
+
detached: true, windowsHide: true, stdio: ['ignore', 'ignore', fd ?? 'ignore'],
|
|
59
70
|
});
|
|
60
|
-
|
|
71
|
+
if (fd != null) closeSync(fd);
|
|
72
|
+
child.once('error', () => { spawnFailed = true; });
|
|
73
|
+
child.once('exit', (code, sig) => { exited = { code, sig, at: Date.now() }; if (ready) discard(); });
|
|
74
|
+
child.unref();
|
|
61
75
|
}
|
|
62
76
|
} catch (e) { if (!e.transient) throw e; last = e; }
|
|
77
|
+
// A board that exits early may have lost the port or the data folder to one that another
|
|
78
|
+
// process started at the same moment (two hosts asking at once), so the port is still
|
|
79
|
+
// watched for a few seconds before the exit counts as the answer.
|
|
80
|
+
if (exited && Date.now() - exited.at > 5000) {
|
|
81
|
+
let tail = '';
|
|
82
|
+
// the board's own last word where it had one, else the message line of a crash, else the last line
|
|
83
|
+
try {
|
|
84
|
+
const lines = readFileSync(log, 'utf8').split(/\r?\n/).filter((l) => l.trim());
|
|
85
|
+
tail = (lines.findLast((l) => l.startsWith('[server]')) || lines.find((l) => /^\w*Error: /.test(l)) || lines.at(-1) || '').trim().slice(0, 200);
|
|
86
|
+
} catch {}
|
|
87
|
+
discard();
|
|
88
|
+
const sandboxed = /cannot listen.*\b(EPERM|EACCES)\b/.test(tail);
|
|
89
|
+
throw new Error(`The local board exited before it was ready${tail ? ` (${tail})` : ''}. ${sandboxed ? 'This environment blocks local servers: start the board from a normal terminal with roundtable server start, then retry.' : 'Run roundtable --no-open in a terminal for startup details.'} No review was started.`);
|
|
90
|
+
}
|
|
63
91
|
if (spawnFailed) break;
|
|
64
92
|
await delay(100, undefined, { signal });
|
|
65
93
|
}
|
package/src/notes.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// Note sources are declared by the client, not authenticated identities. Keep legacy human
|
|
2
|
-
// strings readable while retaining attribution on notes submitted by the agent client
|
|
2
|
+
// strings readable while retaining attribution on notes submitted by the agent client:
|
|
3
|
+
// 'agent' is the assistant's own note, 'relayed' the user's answers as the assistant reported them.
|
|
4
|
+
export const SOURCES = ['human', 'agent', 'relayed'];
|
|
3
5
|
export function noteRecord(note) {
|
|
4
6
|
return {
|
|
5
7
|
text: typeof note === 'string' ? note : String(note?.text || ''),
|
|
6
|
-
source: note?.source
|
|
8
|
+
source: SOURCES.includes(note?.source) ? note.source : 'human',
|
|
7
9
|
};
|
|
8
10
|
}
|
|
9
11
|
|
|
@@ -12,5 +14,7 @@ export function storedNote(note) {
|
|
|
12
14
|
return record.source === 'human' ? record.text : record;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
const AUTHORS = { human: 'Human', agent: 'Agent coordinator', relayed: 'Human (relayed by the assistant)' };
|
|
18
|
+
const LABELS = { human: 'You said', agent: 'Agent note', relayed: 'You said, via your assistant' };
|
|
19
|
+
export const noteAuthor = (note) => AUTHORS[noteRecord(note).source];
|
|
20
|
+
export const noteLabel = (note) => LABELS[noteRecord(note).source];
|
package/src/prompts.js
CHANGED
|
@@ -102,7 +102,7 @@ export function statelessPrefix({ fieldNotes, lens, mood, seatCount, unattended
|
|
|
102
102
|
export function notesBlock(notes) {
|
|
103
103
|
const list = (notes || []).filter((n) => n?.text && n.text.trim());
|
|
104
104
|
if (!list.length) return [];
|
|
105
|
-
return ['### Discussion notes (agent
|
|
105
|
+
return ['### Discussion notes (a relayed note is the human\'s answer as their assistant reported it; an agent note is the assistant\'s own and not a human answer)', ...list.map((n, i) => inputRecord('note', n.text, {
|
|
106
106
|
author: noteAuthor(n), source: noteRecord(n).source, round: n.round,
|
|
107
107
|
after: n.round < 0 ? 'Before round 0' : `After round ${n.round}`, latest: i === list.length - 1,
|
|
108
108
|
})), ''];
|
package/src/review-view.js
CHANGED
|
@@ -15,13 +15,15 @@ export function groupQuestions(questions = []) {
|
|
|
15
15
|
return [...groups.values()];
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
// attributed: each answer line says whether the assistant relayed the user's words or wrote its own.
|
|
19
|
+
const ANSWER_LABEL = { user: "Answer (the user's words, relayed by the assistant)", assistant: "Answer (the assistant's own, not the user's)" };
|
|
20
|
+
export function answerMessage(questions, answers = [], note = '', { attributed = false } = {}) {
|
|
19
21
|
const groups = groupQuestions(questions), seen = new Set(), lines = [];
|
|
20
22
|
for (const answer of answers) {
|
|
21
23
|
const group = groups.find((q) => q.id === answer.id);
|
|
22
24
|
if (!group || seen.has(answer.id)) throw Object.assign(new Error('The question list changed. Review the current questions before sending your answers.'), { status: 409 });
|
|
23
25
|
seen.add(answer.id);
|
|
24
|
-
if (answer.text.trim()) lines.push(`Question (${group.sources.join(', ')}): ${group.question}\
|
|
26
|
+
if (answer.text.trim()) lines.push(`Question (${group.sources.join(', ')}): ${group.question}\n${attributed ? ANSWER_LABEL[answer.from] || ANSWER_LABEL.assistant : 'Answer'}: ${answer.text.trim()}`);
|
|
25
27
|
}
|
|
26
28
|
if (note.trim()) lines.push(note.trim());
|
|
27
29
|
return lines.join('\n\n');
|
package/src/seats.js
CHANGED
|
@@ -93,7 +93,7 @@ export const COLOURS = ['rust', 'olive', 'teal', 'dusk', 'steel'];
|
|
|
93
93
|
// First use starts small. Prefer ready default logins; one ready vendor can fill both seats.
|
|
94
94
|
// With no ready result yet, show two editable CLI choices and their status lamps.
|
|
95
95
|
export function initialSeatVendors(vendors, checks = []) {
|
|
96
|
-
const cli = vendors.filter((v) => v.kind !== 'api').map((v) => v.vendor);
|
|
96
|
+
const cli = vendors.filter((v) => v.kind !== 'api' && v.kind !== 'acp').map((v) => v.vendor);
|
|
97
97
|
const ready = cli.filter((v) => checks.some((p) => p.key === v && p.state === 'ok'));
|
|
98
98
|
const choices = ready.length ? ready : cli;
|
|
99
99
|
return choices.length ? [choices[0], choices[1] || choices[0]] : [];
|
|
@@ -123,6 +123,14 @@ export function normaliseAccount(raw) {
|
|
|
123
123
|
return name;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
export function agentLinkProfile(raw) {
|
|
127
|
+
const name = typeof raw === 'string' ? raw.trim() : '';
|
|
128
|
+
if (!/^[a-z0-9][a-z0-9_-]{0,63}$/.test(name) || /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/.test(name)) {
|
|
129
|
+
throw new Error('An ACP seat needs a valid saved AgentLink profile: 1-64 lowercase letters, digits, underscores or hyphens; no reserved device names.');
|
|
130
|
+
}
|
|
131
|
+
return name;
|
|
132
|
+
}
|
|
133
|
+
|
|
126
134
|
// The one line a seat sees about how to approach the question. Custom text wins when given.
|
|
127
135
|
export function moodLine(mood) {
|
|
128
136
|
if (!mood) return MOODS[DEFAULT_MOOD];
|
|
@@ -200,6 +208,7 @@ export function hostKey(url) {
|
|
|
200
208
|
// What the card and the record say about where a seat runs: the CLI on a subscription, an API
|
|
201
209
|
// on this machine, or an API that bills per token.
|
|
202
210
|
export function seatKind(vendorRow, endpoint = null) {
|
|
211
|
+
if (vendorRow?.kind === 'acp') return 'ACP · profile billing';
|
|
203
212
|
if (vendorRow?.kind !== 'api') return 'CLI · subscription';
|
|
204
213
|
let u; try { u = new URL(String(endpoint || '')); } catch { return 'API'; }
|
|
205
214
|
return privateHost(u.hostname) ? 'API · local' : 'API · pay-per-token';
|
|
@@ -215,6 +224,12 @@ function normaliseEndpoint(raw, label) {
|
|
|
215
224
|
return { endpoint, keyEnv: keyEnv || undefined, model, account: hostKey(endpoint) };
|
|
216
225
|
}
|
|
217
226
|
|
|
227
|
+
// For ACP the existing account field selects an AgentLink profile, not a login
|
|
228
|
+
// directory or a command. Keep pool identity and saved review records consistent.
|
|
229
|
+
function seatAccount(raw, row) {
|
|
230
|
+
return row.kind === 'acp' ? agentLinkProfile(raw.account) : normaliseAccount(raw.account);
|
|
231
|
+
}
|
|
232
|
+
|
|
218
233
|
// vendors: { [vendor]: { label, effortLevels } } (the adapter table). efforts may widen a
|
|
219
234
|
// vendor's levels from the catalogue (agy's come from its model ids); models is the
|
|
220
235
|
// catalogue's model list per vendor, for the lightest model a hidden mood runs on.
|
|
@@ -243,7 +258,7 @@ export function normaliseSeats(input, { vendors, efforts = {}, models = {}, hidd
|
|
|
243
258
|
mood,
|
|
244
259
|
model: locked ? locked.model : ep ? ep.model : raw.model ? String(raw.model).trim() : undefined,
|
|
245
260
|
effort: locked ? locked.effort : effort || undefined,
|
|
246
|
-
account: ep ? ep.account :
|
|
261
|
+
account: ep ? ep.account : seatAccount(raw, vendors[raw.vendor]),
|
|
247
262
|
...(ep ? { endpoint: ep.endpoint, keyEnv: ep.keyEnv } : {}),
|
|
248
263
|
// the vendor's colour (adapters config) unless the board sent one; positions as a fallback
|
|
249
264
|
colour: COLOURS.includes(raw.colour) ? raw.colour : (vendors[raw.vendor].colour || COLOURS[seats.length % COLOURS.length]),
|
|
@@ -253,7 +268,7 @@ export function normaliseSeats(input, { vendors, efforts = {}, models = {}, hidd
|
|
|
253
268
|
// Human-side label only: "Codex 2" when a vendor is seated more than once; an endpoint seat
|
|
254
269
|
// is named by its host ("API localhost-11434"). Never in a prompt.
|
|
255
270
|
const perBase = {};
|
|
256
|
-
for (const s of seats) { s.base = s.endpoint ? `API ${s.account}` : vendors[s.vendor].label; perBase[s.base] = (perBase[s.base] || 0) + 1; }
|
|
271
|
+
for (const s of seats) { s.base = s.endpoint ? `API ${s.account}` : vendors[s.vendor].kind === 'acp' ? `ACP ${s.account}` : vendors[s.vendor].label; perBase[s.base] = (perBase[s.base] || 0) + 1; }
|
|
257
272
|
const seen2 = {};
|
|
258
273
|
for (const s of seats) { seen2[s.base] = (seen2[s.base] || 0) + 1; s.label = perBase[s.base] > 1 ? `${s.base} ${seen2[s.base]}` : s.base; delete s.base; }
|
|
259
274
|
return seats;
|
|
@@ -268,5 +283,5 @@ export function normaliseChairman(raw, { vendors, efforts = {}, role = 'Chairman
|
|
|
268
283
|
if (effort && !allowed.includes(effort)) throw new Error(`${role}: ${vendors[vendor].label}${raw.model ? ` ${String(raw.model).trim()}` : ''} does not accept effort "${effort}".`);
|
|
269
284
|
const ep = vendors[vendor].kind === 'api' ? normaliseEndpoint(raw, role) : null;
|
|
270
285
|
return { vendor, colour: vendors[vendor].colour || undefined, model: ep ? ep.model : raw.model ? String(raw.model).trim() : undefined, effort: effort || undefined,
|
|
271
|
-
account: ep ? ep.account :
|
|
286
|
+
account: ep ? ep.account : seatAccount(raw, vendors[vendor]), ...(ep ? { endpoint: ep.endpoint, keyEnv: ep.keyEnv } : {}) };
|
|
272
287
|
}
|
package/src/server.js
CHANGED
|
@@ -7,6 +7,7 @@ import { readFile } from 'node:fs/promises';
|
|
|
7
7
|
import path from 'node:path';
|
|
8
8
|
import { fileURLToPath } from 'node:url';
|
|
9
9
|
import { adapters, ADAPTERS, quotaReaders, poolsByAccount } from './adapters/index.js';
|
|
10
|
+
import { agentLinkBinary } from './adapters/acp.js';
|
|
10
11
|
import { profileHome, killAll, liveChildren, resolveBinary, runProcess, cleanEnv } from './adapters/spawn.js';
|
|
11
12
|
import { checkPool, STATUS, endpointLamp, createPreflightCache } from './preflight.js';
|
|
12
13
|
import { retired, quotaGroup } from './adapters/models.js';
|
|
@@ -24,12 +25,12 @@ import { answerMessage } from './review-view.js';
|
|
|
24
25
|
import { createSettingsStore } from './settings.js';
|
|
25
26
|
import { createTermsRecord, termsRefusal } from './terms.js';
|
|
26
27
|
import { noteRecord, storedNote } from './notes.js';
|
|
27
|
-
import { reviewSnapshot } from './snapshot.js';
|
|
28
|
+
import { reviewSnapshot, clock } from './snapshot.js';
|
|
28
29
|
import { pickFolder } from './folder-picker.js';
|
|
29
30
|
import { dataDirectory, legacyHistory, acquireDataLock, checkedHistoryPath, removeHistory, createUsageStore, createHistoryIndex } from './history.js';
|
|
30
31
|
import { VERSION } from './version.js';
|
|
31
32
|
import { LOCAL_API_VERSION } from './local-server.js';
|
|
32
|
-
import { terminalBanner } from './terminal.js';
|
|
33
|
+
import { terminalBanner, paintVendor } from './terminal.js';
|
|
33
34
|
|
|
34
35
|
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
35
36
|
const UI = path.join(ROOT, 'src', 'ui');
|
|
@@ -310,6 +311,15 @@ async function preflight(keys, { refresh = false, fresh = false, endpoints = {}
|
|
|
310
311
|
return Promise.all(keys.map(async (key) => {
|
|
311
312
|
const vendor = poolVendor(key), account = poolAccount(key);
|
|
312
313
|
if (!Object.hasOwn(ADAPTERS, vendor)) return { key, state: 'danger', kind: 'missing', note: `unknown vendor ${vendor}` };
|
|
314
|
+
if (ADAPTERS[vendor].kind === 'acp') {
|
|
315
|
+
// No bridge is started or installed by a background readiness check.
|
|
316
|
+
if (FAKE) return { key, vendor, account, installed: null, loggedIn: null, quota: null, state: 'ok', kind: 'demo', note: 'Scripted demo; no AgentLink or vendor process is used' };
|
|
317
|
+
try {
|
|
318
|
+
agentLinkBinary();
|
|
319
|
+
return { key, vendor, account, installed: true, loggedIn: null, quota: null, state: 'warn', kind: 'unknown',
|
|
320
|
+
note: account ? 'AgentLink found; profile, login and ACP support are checked on the first call' : 'Choose a saved AgentLink profile' };
|
|
321
|
+
} catch (e) { return { key, vendor, account, installed: false, loggedIn: null, quota: null, state: 'danger', kind: 'missing', note: e.message }; }
|
|
322
|
+
}
|
|
313
323
|
if (ADAPTERS[vendor].kind === 'api') {
|
|
314
324
|
const ep = refresh ? endpoints[key] || {} : {};
|
|
315
325
|
const url = typeof ep.url === 'string' ? ep.url.slice(0, 500) : '', keyEnv = typeof ep.keyEnv === 'string' ? ep.keyEnv.slice(0, 64) : null;
|
|
@@ -402,6 +412,9 @@ function synthesizeDebate(d, body = {}) {
|
|
|
402
412
|
const quota = {}; // pool key -> { windows, plan, at, groups? }
|
|
403
413
|
const readers = FAKE ? { claude: async () => fakeQuota('claude'), codex: async () => fakeQuota('codex'), agy: async () => fakeQuota('agy') } : quotaReaders;
|
|
404
414
|
const keyOf = (vendor, account) => poolKey(vendor, account, poolsByAccount(ADAPTERS[vendor]));
|
|
415
|
+
// A vendor whose CLI is not on PATH gets no quota read and no startup line: a CLI that is not
|
|
416
|
+
// here is not a failed read. Demo mode seats every vendor with scripted replies.
|
|
417
|
+
const installed = (vendor) => { if (FAKE || ADAPTERS[vendor]?.kind !== 'cli') return true; try { resolveBinary(ADAPTERS[vendor].binary, ADAPTERS[vendor].npmBin); return true; } catch { return false; } };
|
|
405
418
|
|
|
406
419
|
function setQuota(key, q) {
|
|
407
420
|
if (!q) return;
|
|
@@ -415,7 +428,7 @@ const reading = new Map();
|
|
|
415
428
|
function refreshQuota(key, { acknowledged = false } = {}) {
|
|
416
429
|
const vendor = poolVendor(key), account = poolAccount(key);
|
|
417
430
|
// a reader that stopped itself (agy's latch, quota.js) said why once; no read, no repeat
|
|
418
|
-
if (!readers[vendor] || readers[vendor].stopped?.() || termsHeld(vendor, acknowledged)) return Promise.resolve(null);
|
|
431
|
+
if (!readers[vendor] || readers[vendor].stopped?.() || termsHeld(vendor, acknowledged) || !installed(vendor)) return Promise.resolve(null);
|
|
419
432
|
if (reading.has(key)) return reading.get(key);
|
|
420
433
|
// The readers resolve null on every failure (timeout, spawn error, no result) rather than
|
|
421
434
|
// throwing, so say so here or a dead read is invisible on the console. Resolves to the figure
|
|
@@ -423,7 +436,7 @@ function refreshQuota(key, { acknowledged = false } = {}) {
|
|
|
423
436
|
const p = (async () => {
|
|
424
437
|
try {
|
|
425
438
|
const q = await readers[vendor]({ home: account ? profileHome(vendor, account) : null });
|
|
426
|
-
if (!q) { diagnostics.write({ code: 'status-failed', action: 'quota', vendor }); console.warn(`[quota] ${key}: no figure (read failed or timed out); the strip keeps the last one`); }
|
|
439
|
+
if (!q) { diagnostics.write({ code: 'status-failed', action: 'quota', vendor }); console.warn(`[quota] ${paintVendor(ADAPTERS[vendor], { text: key })}: no figure (not logged in, or the read failed or timed out); the strip keeps the last one`); }
|
|
427
440
|
setQuota(key, q);
|
|
428
441
|
return q;
|
|
429
442
|
} catch (e) { diagnostics.write({ code: 'status-failed', action: 'quota', vendor }, e); console.error(`[quota] ${key}: ${e.message}`); return null; } finally { reading.delete(key); }
|
|
@@ -479,7 +492,7 @@ function prepareDebate(raw, { board = false } = {}) {
|
|
|
479
492
|
if (unacknowledged) throw unacknowledged;
|
|
480
493
|
if (!FAKE && !body.options.allowLimitedIsolation && [...seats, chairman, body.options.research].some((s) => s && ADAPTERS[s.vendor]?.limitedIsolation)) {
|
|
481
494
|
// the board sends this whenever a card it shows runs on Antigravity; an agent must send it
|
|
482
|
-
throw Object.assign(new Error('Antigravity cannot be fully isolated. Send options.allowLimitedIsolation: true once the person accepts
|
|
495
|
+
throw Object.assign(new Error('Antigravity and ACP profiles cannot be fully isolated. Send options.allowLimitedIsolation: true once the person accepts the selected provider limits, or choose another provider.'), { status: 400 });
|
|
483
496
|
}
|
|
484
497
|
const options = { ...DEFAULTS, ...body.options };
|
|
485
498
|
// the board always names the searcher's settings, even "default"; an agent may leave them out
|
|
@@ -552,6 +565,7 @@ function attachEngine(d, { fieldNotes, seats, chairman, options, resume = null,
|
|
|
552
565
|
const call = FAKE ? fakeRunner({ consensus: FAKE_CONSENSUS }) : (vendor, prompt, sessionId, opts) =>
|
|
553
566
|
adapters[vendor](prompt, sessionId, {
|
|
554
567
|
cwd: store.seatDir(opts.seat?.id || 'chairman'), home: opts.seat?.account && ADAPTERS[vendor].home ? profileHome(vendor, opts.seat.account) : null,
|
|
568
|
+
account: opts.seat?.account, signal: opts.signal,
|
|
555
569
|
endpoint: opts.seat?.endpoint ? { url: opts.seat.endpoint, keyEnv: opts.seat.keyEnv || null } : null, // an API seat: where to send the round
|
|
556
570
|
timeoutMs: opts.timeoutMs, prevCost: opts.prevCost, prevUsage: opts.prevUsage, model: opts.model || undefined, effort: opts.effort || undefined, tag: d.slug,
|
|
557
571
|
allowLimitedIsolation: opts.allowLimitedIsolation,
|
|
@@ -788,7 +802,7 @@ const server = http.createServer(async (req, res) => {
|
|
|
788
802
|
const body = refresh ? await readBody(req) : { pools: String(url.searchParams.get('pools') || '').split(',') };
|
|
789
803
|
if (body.fresh != null && typeof body.fresh !== 'boolean') throw new Error('fresh must be a boolean.');
|
|
790
804
|
const list = Array.isArray(body.pools) ? body.pools : String(body.pools || '').split(',');
|
|
791
|
-
const keys = [...new Set(list.map((k) => String(k).trim()).filter((k) => /^[a-z]+(@[a-z0-9][a-z0-9_.-]{0,39})?$/i.test(k)))].slice(0, 12);
|
|
805
|
+
const keys = [...new Set(list.map((k) => String(k).trim()).filter((k) => /^acp@[a-z0-9][a-z0-9_-]{0,63}$/.test(k) || /^[a-z]+(@[a-z0-9][a-z0-9_.-]{0,39})?$/i.test(k)))].slice(0, 12);
|
|
792
806
|
const endpoints = req.method === 'POST' && body.endpoints && typeof body.endpoints === 'object' ? body.endpoints : {};
|
|
793
807
|
return json(res, 200, { pools: await preflight(keys, { refresh, fresh: body.fresh === true, endpoints }) });
|
|
794
808
|
}
|
|
@@ -837,7 +851,13 @@ const server = http.createServer(async (req, res) => {
|
|
|
837
851
|
return requestError(res, 400, 'More time does not submit answers or notes. Use Continue or agent answer to send them.', 'hold');
|
|
838
852
|
if (body.answers?.length) {
|
|
839
853
|
if (!d.pending) return requestError(res, 409, 'The review is not waiting for answers. Your draft was not sent.', m[2]);
|
|
840
|
-
|
|
854
|
+
// An agent submission is credited to the person only when every answer is declared as the
|
|
855
|
+
// user's own words and nothing else rides along; otherwise each line says whose it is.
|
|
856
|
+
// The declaration comes from the client and is shown, not verified.
|
|
857
|
+
const given = body.answers.filter((a) => a.text.trim());
|
|
858
|
+
const relayed = body.source === 'agent' && given.length > 0 && given.every((a) => a.from === 'user') && !body.message.trim();
|
|
859
|
+
body.message = validateMessage({ message: answerMessage(d.pending.info.questions, body.answers, body.message, { attributed: body.source === 'agent' && !relayed }) }).message;
|
|
860
|
+
if (relayed) body.source = 'relayed';
|
|
841
861
|
}
|
|
842
862
|
if (m[2] === 'resume') { resumeDebate(d, body); return json(res, 200, { ok: true }); }
|
|
843
863
|
if (m[2] === 'synthesize') { synthesizeDebate(d, body); return json(res, 200, { ok: true }); }
|
|
@@ -858,7 +878,7 @@ const server = http.createServer(async (req, res) => {
|
|
|
858
878
|
if (m[2] === 'hold') {
|
|
859
879
|
if (!d.pending) return requestError(res, 409, 'The response window has closed. Read the current state before requesting more time.', 'hold');
|
|
860
880
|
const deadline = scheduleGate(d, d.pending.info.questionWaitMs || DEFAULTS.questionWaitMs, true);
|
|
861
|
-
return json(res, 200, { ok: true, autoContinueAt: deadline });
|
|
881
|
+
return json(res, 200, { ok: true, autoContinueAt: deadline, ...clock('autoContinue', deadline) });
|
|
862
882
|
}
|
|
863
883
|
}
|
|
864
884
|
res.writeHead(404); res.end('not found');
|
|
@@ -876,15 +896,27 @@ function openBrowser(url) {
|
|
|
876
896
|
const cmd = process.platform === 'win32' ? ['cmd', ['/c', 'start', '', url]] : process.platform === 'darwin' ? ['open', [url]] : ['xdg-open', [url]];
|
|
877
897
|
try { spawn(cmd[0], cmd[1], { stdio: 'ignore', detached: true, windowsHide: true }).on('error', () => {}).unref(); return true; } catch { return false; }
|
|
878
898
|
}
|
|
899
|
+
// A port that cannot be taken is said plainly: in use, or a sandbox that forbids listening
|
|
900
|
+
// (Codex on Linux, for one), where the board has to be started from a normal terminal instead.
|
|
901
|
+
server.on('error', (e) => {
|
|
902
|
+
diagnostics.write({ code: 'server-start', action: 'startup' }, e);
|
|
903
|
+
const why = e.code === 'EADDRINUSE' ? `port ${PORT} is in use. Check roundtable server status, or start with --port`
|
|
904
|
+
: ['EPERM', 'EACCES'].includes(e.code) ? `this environment does not allow a local server on 127.0.0.1:${PORT} (${e.code}). Start the board from a normal terminal with roundtable server start; the assistant's tools then connect to it`
|
|
905
|
+
: e.message;
|
|
906
|
+
console.error(`[server] cannot listen: ${why}`);
|
|
907
|
+
process.exit(1);
|
|
908
|
+
});
|
|
879
909
|
server.listen(PORT, '127.0.0.1', () => {
|
|
880
910
|
const url = `http://localhost:${PORT}`;
|
|
881
911
|
const open = process.stdout.isTTY && !process.argv.includes('--no-open') && process.env.ROUNDTABLE_NO_OPEN !== '1' && !process.env.CI;
|
|
882
912
|
const opened = open && openBrowser(url);
|
|
883
913
|
process.stdout.write(terminalBanner());
|
|
884
914
|
console.log(`roundtable${FAKE ? ' (fake seats)' : ''}: ${url} token ${TOKEN}`);
|
|
885
|
-
console.log(`mode: ${FAKE ? 'demo (scripted replies and usage)' : 'live
|
|
915
|
+
console.log(`mode: ${FAKE ? 'demo (scripted replies and usage)' : 'live'}; data: ${DEBATES_DIR}`);
|
|
916
|
+
const found = Object.entries(ADAPTERS).filter(([v, a]) => a.kind === 'cli' && installed(v)).map(([, a]) => paintVendor(a));
|
|
917
|
+
if (!FAKE) console.log(found.length ? `providers: ${found.join(', ')} (CLIs on PATH; an API endpoint is seated on the board)` : 'providers: no Claude, Codex or Antigravity CLI on PATH; seat an API endpoint on the board, or install one and restart. roundtable doctor has details');
|
|
886
918
|
console.log('diagnostics: _diagnostics in the data folder; use Save error log on the board. Nothing is uploaded.');
|
|
887
|
-
|
|
919
|
+
console.log(`${opened ? 'the board is open in your browser' : `open ${url} in your browser`}; Ctrl+C here stops the server and every CLI it started`);
|
|
888
920
|
});
|
|
889
921
|
|
|
890
922
|
// No CLI outlives the server: on a signal or an uncaught error every registered child goes
|
package/src/snapshot.js
CHANGED
|
@@ -40,6 +40,13 @@ function researchSnapshot(research) {
|
|
|
40
40
|
...(integerWithin(research.searches, 0, 9) ? { searches: research.searches } : {}) };
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// Epoch milliseconds are easy to misread across time zones, so every deadline also carries an
|
|
44
|
+
// ISO timestamp and the whole seconds left, both taken when the snapshot is built.
|
|
45
|
+
export const clock = (name, at) => at == null ? {} : {
|
|
46
|
+
[`${name}AtIso`]: new Date(at).toISOString(),
|
|
47
|
+
[`secondsUntil${name[0].toUpperCase()}${name.slice(1)}`]: Math.max(0, Math.ceil((at - Date.now()) / 1000)),
|
|
48
|
+
};
|
|
49
|
+
|
|
43
50
|
// One compact, read-only view for local clients. Raw provider output and launch tokens stay out.
|
|
44
51
|
export function reviewSnapshot(d) {
|
|
45
52
|
const state = d.debate?.state || d.rebuilt;
|
|
@@ -59,7 +66,7 @@ export function reviewSnapshot(d) {
|
|
|
59
66
|
attemptedCritiqueRounds: rounds.slice(1).filter((r) => r?.length === state.seats.length).length,
|
|
60
67
|
completedRounds: rounds.filter((r) => hasUsableRound([r], state.seats.length)).length,
|
|
61
68
|
completedCritiqueRounds: rounds.slice(1).filter((r) => hasUsableRound([r], state.seats.length)).length },
|
|
62
|
-
deadlineAt: state.deadlineAt, stopReason: state.stopReason || null,
|
|
69
|
+
deadlineAt: state.deadlineAt, ...clock('deadline', state.deadlineAt), stopReason: state.stopReason || null,
|
|
63
70
|
...(state.research ? { research: researchSnapshot(state.research) } : {}),
|
|
64
71
|
...(state.stopReason ? { explanation: stopExplanation(state.stopReason, state.stopContext) } : {}),
|
|
65
72
|
actions: d.finished ? (!verdict || verdict.failed || verdict.skipped) && hasUsableRound(rounds, state.seats.length) ? ['verdict'] : []
|
|
@@ -67,11 +74,11 @@ export function reviewSnapshot(d) {
|
|
|
67
74
|
// reopenCalls: the seats already agree, so empty answers end the discussion; any answer text
|
|
68
75
|
// or message runs one more round at this many calls. Absent when answering cannot reopen.
|
|
69
76
|
gate: gate ? { round: gate.round, mode: gate.mode, reason: gate.reason, stop: gate.stop, questions: groupQuestions(gate.questions),
|
|
70
|
-
autoContinueAt: d.pending.autoContinueAt ?? null, timeoutBehavior: 'continue_without_answers',
|
|
77
|
+
autoContinueAt: d.pending.autoContinueAt ?? null, ...clock('autoContinue', d.pending.autoContinueAt), timeoutBehavior: 'continue_without_answers',
|
|
71
78
|
...(gate.reopenable ? { reopenCalls: (state.seats || []).length } : {}) } : null,
|
|
72
79
|
nextAction: gate?.questions.length ? {
|
|
73
80
|
type: 'ask_user',
|
|
74
|
-
instruction: 'Ask gate.questions using your available user-input tool. If there is no form, ask in chat. Group overlapping questions without losing their IDs. Do not invent answers. Tell the user when the response window closes; unanswered questions remain unknown. Read status before submitting a reply because the review may have continued.',
|
|
81
|
+
instruction: 'Ask gate.questions using your available user-input tool. If there is no form, ask in chat. Group overlapping questions without losing their IDs. Do not invent answers. Tell the user when the response window closes (gate.secondsUntilAutoContinue); unanswered questions remain unknown. Read status before submitting a reply because the review may have continued. Mark each answer from: "user" only when it is the user\'s own reply; from: "assistant" when you supplied it yourself with the user\'s permission.',
|
|
75
82
|
answerTemplate: { round: gate.round, answers: groupQuestions(gate.questions).map((q) => ({ id: q.id, text: '' })) },
|
|
76
83
|
} : { type: gate || ['researching', 'running', 'verdict'].includes(status) ? 'wait'
|
|
77
84
|
: status === 'done' && sections ? 'report_result' : 'report_incomplete',
|
package/src/terminal.js
CHANGED
|
@@ -12,17 +12,40 @@ const TILE = [
|
|
|
12
12
|
];
|
|
13
13
|
const TAGLINE = 'Local decision reviews';
|
|
14
14
|
const RESET = '\x1b[0m';
|
|
15
|
+
const BOLD = '\x1b[1m', DIM = '\x1b[2m', BLINK = '\x1b[5m';
|
|
15
16
|
|
|
16
17
|
// Half blocks need a UTF-8 terminal. Windows consoles take UTF-16 from Node whatever the code
|
|
17
18
|
// page; elsewhere the locale has to say so. ROUNDTABLE_ASCII=1 forces the plain form.
|
|
18
19
|
const unicode = (env, platform) => env.ROUNDTABLE_ASCII !== '1'
|
|
19
20
|
&& (platform === 'win32' || /utf-?8/i.test(env.LC_ALL || env.LC_CTYPE || env.LANG || ''));
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
// Which colours the terminal takes: true colour where it says so, 256 colours, or the basic 8.
|
|
22
|
+
const tier = (env, platform) => (/truecolor|24bit/i.test(env.COLORTERM || '') || env.WT_SESSION || platform === 'win32') ? 'true'
|
|
23
|
+
: env.TERM?.includes('256color') ? '256' : 'basic';
|
|
24
|
+
// Tile and ink colours per tier: [tile background, ink foreground, orchid foreground].
|
|
25
|
+
const PALETTE = {
|
|
26
|
+
true: ['\x1b[48;2;199;154;208m', '\x1b[38;2;43;29;56m', '\x1b[38;2;199;154;208m'],
|
|
27
|
+
256: ['\x1b[48;5;182m', '\x1b[38;5;234m', '\x1b[38;5;182m'],
|
|
28
|
+
basic: ['\x1b[45m', '\x1b[30m', '\x1b[35m'],
|
|
29
|
+
};
|
|
30
|
+
// The family accents the board gives each vendor (adapters/config.js colour, design/app.css
|
|
31
|
+
// --seat-*), per tier, so a vendor reads the same colour in the terminal as on its seat.
|
|
32
|
+
const ACCENTS = {
|
|
33
|
+
rust: ['\x1b[38;2;223;107;85m', '\x1b[38;5;173m', '\x1b[31m'],
|
|
34
|
+
olive: ['\x1b[38;2;156;188;106m', '\x1b[38;5;149m', '\x1b[32m'],
|
|
35
|
+
teal: ['\x1b[38;2;111;179;169m', '\x1b[38;5;73m', '\x1b[36m'],
|
|
36
|
+
steel: ['\x1b[38;2;134;169;196m', '\x1b[38;5;110m', '\x1b[34m'],
|
|
37
|
+
};
|
|
38
|
+
const TIERS = ['true', '256', 'basic'];
|
|
39
|
+
|
|
40
|
+
// Nothing is decorated for a pipe, CI or a dumb terminal; NO_COLOR keeps the text and drops
|
|
41
|
+
// the codes.
|
|
42
|
+
const decorated = (isTTY, env) => isTTY && !env.CI && env.TERM !== 'dumb';
|
|
43
|
+
const painter = (env) => (s, code) => env.NO_COLOR ? s : `${code}${s}${RESET}`;
|
|
44
|
+
|
|
45
|
+
// A vendor's name in its seat colour: paintVendor(ADAPTERS.codex) -> coloured "Codex".
|
|
46
|
+
export function paintVendor({ label, colour }, { text = label, isTTY = process.stdout.isTTY, env = process.env, platform = process.platform } = {}) {
|
|
47
|
+
if (!decorated(isTTY, env) || !ACCENTS[colour]) return text;
|
|
48
|
+
return painter(env)(text, ACCENTS[colour][TIERS.indexOf(tier(env, platform))]);
|
|
26
49
|
}
|
|
27
50
|
|
|
28
51
|
function tileRows(colour) {
|
|
@@ -39,15 +62,16 @@ function tileRows(colour) {
|
|
|
39
62
|
}
|
|
40
63
|
|
|
41
64
|
export function terminalBanner({ isTTY = process.stdout.isTTY, columns = process.stdout.columns ?? 80, env = process.env, platform = process.platform } = {}) {
|
|
42
|
-
if (!isTTY
|
|
43
|
-
const paint = (
|
|
44
|
-
const [tile, ink, orchid] =
|
|
65
|
+
if (!decorated(isTTY, env)) return '';
|
|
66
|
+
const paint = painter(env);
|
|
67
|
+
const [tile, ink, orchid] = PALETTE[tier(env, platform)];
|
|
45
68
|
const version = `v${VERSION}`;
|
|
46
|
-
const name = paint('ROUNDTABLE',
|
|
47
|
-
const compact = `${name}${columns >= 12 + version.length ? ` ${paint(version,
|
|
69
|
+
const name = paint('ROUNDTABLE', BOLD);
|
|
70
|
+
const compact = `${name}${columns >= 12 + version.length ? ` ${paint(version, DIM)}` : ''}`;
|
|
48
71
|
// 2 indent + 16 tile + 3 gap + the tagline, the widest line beside the tile
|
|
49
72
|
if (!unicode(env, platform) || columns < 21 + TAGLINE.length) return `\n${compact}\n\n`;
|
|
50
|
-
|
|
73
|
+
// the block cursor blinks like the board header's, where the terminal allows blinking text
|
|
74
|
+
const beside = { 2: `${name} ${paint('▌', orchid + BLINK)}`, 3: paint(version, DIM), 5: paint(TAGLINE, DIM) };
|
|
51
75
|
const lines = tileRows((row) => paint(row, tile + ink)).map((row, y) => ` ${row}${beside[y] ? ` ${beside[y]}` : ''}`);
|
|
52
76
|
return `\n${lines.join('\n')}\n\n`;
|
|
53
77
|
}
|
package/src/ui/app.js
CHANGED
|
@@ -128,6 +128,7 @@ const ENDPOINT_PRESETS = [
|
|
|
128
128
|
{ label: 'OpenAI', url: 'https://api.openai.com/v1', keyEnv: 'OPENAI_API_KEY' },
|
|
129
129
|
];
|
|
130
130
|
const isApi = (vendor) => VENDOR_META[vendor]?.kind === 'api';
|
|
131
|
+
const isAcp = (vendor) => VENDOR_META[vendor]?.kind === 'acp';
|
|
131
132
|
// The pool a drafted seat draws on: a CLI's login profile, or an endpoint's host.
|
|
132
133
|
const seatAccount = (s) => (isApi(s.vendor) ? hostKey(s.endpoint || '') : (s.account || '').trim());
|
|
133
134
|
const chairAccount = () => (isApi($('chairman').value) ? hostKey($('chairman-endpoint').value) : $('chairman-account').value.trim());
|
|
@@ -441,6 +442,7 @@ function poolLamp(vendor, account, model = '') {
|
|
|
441
442
|
const seatHidden = (s) => (s.mood === 'custom' ? hiddenMood(s.moodText) : null);
|
|
442
443
|
function lockHidden(s) {
|
|
443
444
|
if (!seatHidden(s)) return;
|
|
445
|
+
if (isAcp(s.vendor)) { s.effort = ''; return; }
|
|
444
446
|
s.customModel = false;
|
|
445
447
|
const lightest = lightestModel(s.vendor, VENDOR_META[s.vendor]?.catalogue?.models);
|
|
446
448
|
if (lightest) s.model = lightest;
|
|
@@ -463,7 +465,7 @@ function seatRow(s, i) {
|
|
|
463
465
|
<div class="seat-hd">
|
|
464
466
|
<span class="avatar" title="${esc(s.mood === 'custom' ? 'custom mood' : s.mood)}">${avatar(hidden ? hidden.art : s.mood === 'custom' ? 'custom' : s.mood, hidden?.sprite)}</span>
|
|
465
467
|
<div class="seat-id">
|
|
466
|
-
<span class="chair-title"><select class="flat vendor" aria-label="Vendor">${Object.keys(VENDOR_META).map((v) => `<option value="${v}" ${v === s.vendor ? 'selected' : ''}>${esc(VENDOR_LABEL[v])}</option>`).join('')}</select>${n ? `<span class="seat-note">${n.trim()}</span>` : ''}<span class="kind-tag ${api ? 'api' : ''}" title="${api ? 'Billed by the endpoint, not a subscription' : 'The vendor CLI on your subscription'}">${esc(seatKind(VENDOR_META[s.vendor], s.endpoint))}</span></span>
|
|
468
|
+
<span class="chair-title"><select class="flat vendor" aria-label="Vendor">${Object.keys(VENDOR_META).map((v) => `<option value="${v}" ${v === s.vendor ? 'selected' : ''}>${esc(VENDOR_LABEL[v])}</option>`).join('')}</select>${n ? `<span class="seat-note">${n.trim()}</span>` : ''}<span class="kind-tag ${api ? 'api' : ''}" title="${api ? 'Billed by the endpoint, not a subscription' : isAcp(s.vendor) ? 'Billing belongs to the selected AgentLink profile' : 'The vendor CLI on your subscription'}">${esc(seatKind(VENDOR_META[s.vendor], s.endpoint))}</span></span>
|
|
467
469
|
${hidden && !api ? picker.html.replace('<select', '<select disabled title="Locked to the lightest model"') : picker.html}<input class="flat model" aria-label="Model id" list="models-${s.vendor}" value="${esc(s.model)}" placeholder="${api ? 'model id (required)' : 'model id'}" ${picker.other ? '' : 'hidden'}>
|
|
468
470
|
</div>
|
|
469
471
|
<span class="lamp ${lamp.cls}" title="${esc(lamp.note)}"></span>
|
|
@@ -481,7 +483,7 @@ function seatRow(s, i) {
|
|
|
481
483
|
<div class="f"><span class="label help-label" data-help="effort" tabindex="0" aria-describedby="help-effort">Effort</span><span class="pips ${hidden ? 'locked' : ''}">${pipsHtml(s.vendor, s.effort, s.model)}</span><select class="effort" hidden>${effortOptions(s.vendor, s.effort, s.model)}</select></div>
|
|
482
484
|
<span class="seat-note lamp-note ${lamp.cls === 'danger' || lamp.cls === 'warn' ? lamp.cls : ''}" title="${esc(lamp.note)}" tabindex="0">${esc(lamp.note)}</span>
|
|
483
485
|
${cardNotices(s.vendor)}
|
|
484
|
-
${api ? '' : `<details class="seat-more"><summary
|
|
486
|
+
${api ? '' : `<details class="seat-more" ${isAcp(s.vendor) ? 'open' : ''}><summary>${isAcp(s.vendor) ? 'AgentLink profile (required)' : 'Login profile'}${s.account ? `: ${esc(s.account)}` : ''}</summary><input class="flat account" aria-label="${isAcp(s.vendor) ? 'AgentLink profile' : 'Login profile'}" value="${esc(s.account || '')}" placeholder="${isAcp(s.vendor) ? 'saved profile name' : 'none: your usual login'}" title="${isAcp(s.vendor) ? 'A profile already configured centrally in AgentLink' : 'A second login of this CLI; node src/doctor.js shows how to log a profile in'}"></details>`}
|
|
485
487
|
</div>
|
|
486
488
|
</article>`;
|
|
487
489
|
}
|
|
@@ -567,6 +569,10 @@ function renderChair() {
|
|
|
567
569
|
$('chair-kind').textContent = seatKind(VENDOR_META[v], $('chairman-endpoint').value);
|
|
568
570
|
$('chair-kind').classList.toggle('api', api);
|
|
569
571
|
$('chair-api').hidden = !api; $('chair-profile').hidden = api;
|
|
572
|
+
$('chair-profile').querySelector('summary').textContent = isAcp(v) ? 'AgentLink profile (required)' : 'Login profile';
|
|
573
|
+
$('chair-profile').open = isAcp(v);
|
|
574
|
+
$('chairman-account').placeholder = isAcp(v) ? 'saved profile name' : 'none: your usual login';
|
|
575
|
+
$('chairman-account').setAttribute('aria-label', isAcp(v) ? 'Chairman AgentLink profile' : 'Chairman login profile');
|
|
570
576
|
const picker = api ? { html: '', other: true } : modelPicker(v, $('chairman-model').value.trim(), 'id="chair-model-pick"', S.customChairModel);
|
|
571
577
|
$('chair-model-slot').innerHTML = picker.html;
|
|
572
578
|
$('chairman-model').hidden = !picker.other;
|
|
@@ -581,7 +587,8 @@ function renderChair() {
|
|
|
581
587
|
// its tip explains, and choosing it there is the consent the board sends (isolationAccepted).
|
|
582
588
|
// An agent request has no card, so it must send options.allowLimitedIsolation itself.
|
|
583
589
|
const isoNote = (vendor) => (VENDOR_META[vendor]?.limitedIsolation
|
|
584
|
-
? '<span class="seat-note warn iso-note
|
|
590
|
+
? isAcp(vendor) ? '<span class="seat-note warn iso-note">Limited isolation: the profile owns tools, customization and billing. Use a trusted profile with tools disabled. Stateless memory only; missing token usage stops further seat calls.</span>'
|
|
591
|
+
: '<span class="seat-note warn iso-note help-label" data-help="isolation" tabindex="0" aria-describedby="help-isolation">Limited isolation: your Antigravity customizations and MCP servers still load</span>' : '');
|
|
585
592
|
const isolationAccepted = () => [...draftSeats(), draftChairman(), searcherOn() ? draftSearcher() : null].some((s) => VENDOR_META[s?.vendor]?.limitedIsolation);
|
|
586
593
|
|
|
587
594
|
// A vendor whose own docs say wrapping its CLI is unsupported on some plans (config.js terms,
|
|
@@ -1505,12 +1512,15 @@ function renderGate() {
|
|
|
1505
1512
|
const chairDown = S.verdict?.seat && seatDown(S.verdict.seat);
|
|
1506
1513
|
// the CLI vendors by name; an endpoint only as a seat already at this table (its URL, key
|
|
1507
1514
|
// variable and model are the seat's), since the endpoint vendor alone names no server
|
|
1508
|
-
const pickable = Object.keys(VENDOR_LABEL).filter((v) => !isApi(v) && !Object.values(S.down).some((x) => x.vendor === v && !x.account && !x.group));
|
|
1509
|
-
const apiSeats = S.seats.filter((s) => s.endpoint && !seatDown(s)).map((s) => ({ value: `seat:${s.id}`, label: `${s.label} (${s.model})` }));
|
|
1515
|
+
const pickable = Object.keys(VENDOR_LABEL).filter((v) => !isApi(v) && !isAcp(v) && !Object.values(S.down).some((x) => x.vendor === v && !x.account && !x.group));
|
|
1516
|
+
const apiSeats = S.seats.filter((s) => (s.endpoint || isAcp(s.vendor) && s.account) && !seatDown(s)).map((s) => ({ value: `seat:${s.id}`, label: `${s.label} (${s.model || s.account})` }));
|
|
1510
1517
|
const savedChair = S.configuredChairman || S.chairman;
|
|
1511
|
-
|
|
1518
|
+
if (isAcp(savedChair?.vendor) && savedChair.account && !seatDown(savedChair)) apiSeats.unshift({ value: 'chair:acp', label: `ACP ${savedChair.account} (chairman)` });
|
|
1519
|
+
const first = chairDown || ['quota', 'auth', 'missing'].includes(S.verdict?.errorKind)
|
|
1520
|
+
? (isAcp(savedChair?.vendor) ? apiSeats[0]?.value : null) || pickable.find((v) => v !== S.verdict?.seat?.vendor) || pickable[0]
|
|
1521
|
+
: isAcp(savedChair?.vendor) ? 'chair:acp' : (savedChair?.vendor || pickable[0]);
|
|
1512
1522
|
const synth = S.status === 'done' && S.synthesis && S.synthesis !== 'done' && canFinish
|
|
1513
|
-
? ` <span class="synth">Write the verdict with <select id="synth-chair" aria-label="Chairman for the verdict">${pickable.map((v) => `<option value="${v}" ${v === first ? 'selected' : ''}>${esc(VENDOR_LABEL[v])}${v === savedChair?.vendor ? esc([savedChair.model, savedChair.effort, savedChair.account].filter(Boolean).map((s) => ` · ${s}`).join('')) : ''}</option>`).join('')}${apiSeats.map((o) => `<option value="${esc(o.value)}">${esc(o.label)}</option>`).join('')}</select> <button class="btn btn-small" id="synthesize" type="button" ${S.actionPending ? 'disabled' : ''}>${S.actionPending === 'synthesize' ? 'Starting…' : 'Write'}</button></span>` : '';
|
|
1523
|
+
? ` <span class="synth">Write the verdict with <select id="synth-chair" aria-label="Chairman for the verdict">${pickable.map((v) => `<option value="${v}" ${v === first ? 'selected' : ''}>${esc(VENDOR_LABEL[v])}${v === savedChair?.vendor ? esc([savedChair.model, savedChair.effort, savedChair.account].filter(Boolean).map((s) => ` · ${s}`).join('')) : ''}</option>`).join('')}${apiSeats.map((o) => `<option value="${esc(o.value)}" ${o.value === first ? 'selected' : ''}>${esc(o.label)}</option>`).join('')}</select> <button class="btn btn-small" id="synthesize" type="button" ${S.actionPending ? 'disabled' : ''}>${S.actionPending === 'synthesize' ? 'Starting…' : 'Write'}</button></span>` : '';
|
|
1514
1524
|
const focused = st.contains(document.activeElement) ? document.activeElement.id : null;
|
|
1515
1525
|
st.innerHTML = link + (S.status === 'done' ? `<span class="status ${S.synthesis === 'done' ? 'ok' : 'warn'}">${S.synthesis === 'done' ? 'Review finished' : S.stopReason === 'human' ? 'Review stopped' : 'Review ended without a verdict'}</span> ${esc(stopExplanation(S.stopReason, S.stopContext))}${synth} Record saved locally.${S.exported ? ' Decision record exported.' : ''}${S.exportError ? ` <span class="danger">Export failed: ${esc(S.exportError)}</span>` : ''}${S.replayed ? ' <span class="muted">saved review</span>' : ''}`
|
|
1516
1526
|
: interrupted ? `<span class="status warn">interrupted</span> ${S.interrupted?.round ? `after round ${S.interrupted.round - 1}` : 'before round 0 finished'}${S.interrupted?.partialRound != null ? `, round ${S.interrupted.partialRound} will be re-run` : ''}. Add a note or resume.`
|
|
@@ -1791,7 +1801,7 @@ $('gate-status').addEventListener('click', async (ev) => {
|
|
|
1791
1801
|
const pick = $('synth-chair').value;
|
|
1792
1802
|
const seat = pick.startsWith('seat:') && S.seats.find((s) => s.id === pick.slice(5));
|
|
1793
1803
|
const savedChair = S.configuredChairman || S.chairman;
|
|
1794
|
-
const chosen = seat || (pick === savedChair?.vendor ? savedChair : { vendor: pick });
|
|
1804
|
+
const chosen = seat || (pick === 'chair:acp' || pick === savedChair?.vendor ? savedChair : { vendor: pick });
|
|
1795
1805
|
const chairman = Object.fromEntries(['vendor', 'endpoint', 'keyEnv', 'model', 'effort', 'account'].filter((key) => chosen[key] != null).map((key) => [key, chosen[key]]));
|
|
1796
1806
|
await boardAction('synthesize', { chairman });
|
|
1797
1807
|
if (revision === viewRevision) $('synthesize')?.focus({ preventScroll: true });
|