@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 CHANGED
@@ -1,5 +1,57 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.6
4
+
5
+ - Keep MCP wait deadlines and caller cancellation connected on Node 22 when
6
+ garbage collection runs while an idle event stream is open.
7
+
8
+ - Use the public `@prplkane/agentlink` package for optional ACP seats, including
9
+ shell-free Windows npm launch resolution. Document the qualified beta version.
10
+
11
+ - Bind ACP session IDs while receiving `session/new` so a foreign-session update
12
+ coalesced with that reply is rejected before prompting. Update the offline peer
13
+ to return the correct v2 initialization fields when probed by AgentLink.
14
+
15
+ - Add AgentLink (ACP) seats and chairman profiles through standard ACP v1 stdio,
16
+ without runtime dependencies. Keep bridge management in AgentLink and existing
17
+ direct CLI adapters available. Each call uses a fresh isolated seat session.
18
+ - Deny ACP client tools, stop reported tool activity, preserve missing usage,
19
+ and propagate cancellation with process cleanup. Refuse unsupported session
20
+ resume, effort and model overrides instead of inventing compatibility.
21
+ - Test complete reviews, profile selection, chairman fallback, malformed output,
22
+ authentication failure, tool denial and cancellation with offline fake agents.
23
+
24
+ ## 0.6.5
25
+
26
+ ### Agent API
27
+
28
+ - Say who wrote each answer: every answer to `roundtable_answer` or `agent answer` takes
29
+ `from: "user"` or `from: "assistant"`, and a missing `from` counts as `assistant`. A submission made
30
+ only of the user's own answers reaches the board as "You said, via your assistant", and the
31
+ seats and the exported record as the human's answer relayed by the assistant; anything else
32
+ stays an agent note whose answer lines say whose words they are. The declaration is the
33
+ assistant's and is shown, not verified.
34
+ - Deadlines readable without arithmetic: `deadlineAt` and `gate.autoContinueAt` (epoch
35
+ milliseconds) now come with `deadlineAtIso`, `secondsUntilDeadline`, `autoContinueAtIso`
36
+ and `secondsUntilAutoContinue`; `roundtable_hold` returns the same pair for the renewed
37
+ window.
38
+
39
+ ## 0.6.4
40
+
41
+ ### Terminal
42
+
43
+ - Report only the provider CLIs found on this machine: `roundtable doctor` lists missing ones
44
+ in a single line instead of a block each (`--vendor <name>` still shows the full block), and
45
+ foreground startup prints a `providers:` line in the seat colours instead of a failed quota
46
+ read for every CLI that is not installed.
47
+ - Always print how to open the board and that Ctrl+C stops it, including with `--no-open`.
48
+ - Say plainly when the port cannot be taken: in use, or a sandbox that forbids a local server
49
+ (`EPERM`), with the `roundtable server start` way out. The MCP tools and `roundtable server
50
+ start` report that last line within seconds instead of waiting out the readiness timeout,
51
+ while two hosts starting the board at once both get the one that won the port.
52
+ - Blink the block cursor beside the wordmark where the terminal allows blinking text, and show
53
+ vendor names in their seat colours.
54
+
3
55
  ## 0.6.3
4
56
 
5
57
  ### Assistant integration
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 prplkane
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 prplkane
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -12,6 +12,12 @@ supports the same workflow for agents and scripts.
12
12
  Usage statistics describe your own agents' calls in Roundtable and stay on your machine.
13
13
  Roundtable has no telemetry or analytics service and sends no usage data to its developers.
14
14
 
15
+ You can also choose **AgentLink (ACP)** for seats and the chairman, then enter a saved
16
+ AgentLink profile name. Roundtable speaks standard ACP to the centrally installed
17
+ launcher; AgentLink owns bridge installation and updates. This path uses stateless
18
+ memory and has the selected profile's permissions and billing. See
19
+ [AgentLink setup and limits](docs/workflow.md#7c-agentlink-acp-profiles-optional).
20
+
15
21
  **Requirements:** Node.js 22 or newer. No runtime dependencies. Live reviews use installed
16
22
  Claude, Codex or Antigravity CLIs, or an OpenAI-compatible endpoint for a local or hosted model.
17
23
 
@@ -69,9 +75,10 @@ For a source snapshot before its npm release, use
69
75
  `npm install -g https://github.com/prplkane/roundtable/archive/refs/heads/main.tar.gz`.
70
76
 
71
77
  Interactive `roundtable --help`, `roundtable` and `roundtable fake` show the app's pixel logo
72
- tile in orchid, with the wordmark and installed version beside it. Narrow terminals and
73
- terminals without UTF-8 use a short title; `NO_COLOR=1` disables color. Redirected output,
74
- CI, dumb terminals, MCP and JSON commands omit the decoration.
78
+ tile in orchid, with the wordmark, a blinking cursor and the installed version beside it, then
79
+ the provider CLIs found on this machine in their seat colors. Narrow terminals and terminals
80
+ without UTF-8 use a short title; `NO_COLOR=1` disables color. Redirected output, CI, dumb
81
+ terminals, MCP and JSON commands omit the decoration.
75
82
 
76
83
  ### Try the demo
77
84
 
@@ -116,7 +123,7 @@ page. Refreshing the browser alone does not load an updated server or model list
116
123
 
117
124
  | Control | Behavior |
118
125
  | --- | --- |
119
- | Answer questions | Add context before the discussion continues. Agent notes and your notes are labelled separately. |
126
+ | Answer questions | Add context before the discussion continues. Your notes, answers your assistant relayed for you, and the assistant's own notes are labelled separately. |
120
127
  | Finish with verdict | End the discussion and request a recommendation from the completed replies. Available after a usable round. |
121
128
  | Stop | Cancel the discussion and any active chairman call. Saved replies and reported usage remain. |
122
129
  | Delete / Clear | Remove finished and interrupted history while protecting running sessions. Exports and local usage statistics are retained. |
package/SECURITY.md CHANGED
@@ -1,10 +1,29 @@
1
1
  # Security
2
2
 
3
- Roundtable runs a loopback server on your machine. Live debates use the vendor CLIs you
4
- installed or API endpoints you explicitly configure; demo mode uses scripted replies.
3
+ Roundtable runs a loopback server on your machine. Live debates use the vendor CLIs,
4
+ AgentLink ACP profiles or API endpoints you explicitly configure; demo mode uses
5
+ scripted replies.
5
6
 
6
7
  ## Data and execution
7
8
 
9
+ - **ACP profiles are trusted local executables, not sandboxes.** Roundtable launches
10
+ the installed AgentLink with a validated saved profile name. Executable overrides
11
+ come only from the server's environment, never review JSON. Each turn creates a
12
+ fresh ACP v1 session in a separate seat directory, advertises no client tools and
13
+ supplies no MCP servers. Permission requests are denied; filesystem/terminal
14
+ callbacks and reported tool activity stop the seat. The client binds the session
15
+ ID while receiving `session/new`, before processing any following frame, and
16
+ rejects foreign-session updates. Agents can still have their own built-in tools,
17
+ permissions, customizations and billing configuration. Use a
18
+ profile with those tools disabled and explicitly accept limited isolation. This
19
+ does not acknowledge a vendor's terms or guarantee its sandbox. Inherited API keys
20
+ are filtered as for direct CLIs, but AgentLink profile settings can add them back.
21
+ ACP output, including stderr, is bounded to 8 MiB per call. Roundtable sends
22
+ `session/cancel` on interruption and closes the connection, with process-tree
23
+ termination after a bounded grace period. Already-orphaned Windows descendants
24
+ are not guaranteed to be contained. Tokens are unknown unless valid optional
25
+ end-turn counters are reported; existing seat/vendor budget rules still apply.
26
+
8
27
  - **No telemetry or analytics service.** Usage statistics describe your own agents' calls in
9
28
  Roundtable. They are calculated and stored on your machine; Roundtable sends no usage
10
29
  statistics, review text or diagnostic logs to its developers. Live reviews still send the
package/docs/workflow.md CHANGED
@@ -160,6 +160,23 @@ requested action needs them. There is no Roundtable cloud connection or API key
160
160
  Keep the provider CLI executables on the assistant's `PATH`; after changing a Node version or
161
161
  moving its installation, rerun setup and reload the assistant.
162
162
 
163
+ Some assistants run commands in a sandbox that forbids opening a local port. A `roundtable`
164
+ command run inside such a shell cannot start the board: it dies with `listen EPERM
165
+ 127.0.0.1:4747`, and the command reports that line. Codex on Linux has shown this. Check
166
+ first that the MCP connection itself is loaded (`codex mcp list`, then `/mcp` in Codex), since
167
+ the MCP tools are started by the assistant rather than by its sandboxed shell. If the tools
168
+ still cannot start the board, start it once from a normal terminal:
169
+
170
+ ```bash
171
+ roundtable server start
172
+ ```
173
+
174
+ It keeps running in the background and `roundtable server status` shows it; the tools then
175
+ only connect to it. Stop it with `roundtable server stop` when no review is active. If a tool
176
+ still cannot reach a board that is running, that sandbox blocks loopback connections too, and
177
+ the assistant cannot use Roundtable from inside it; report it as an issue with the assistant,
178
+ version and OS.
179
+
163
180
  To check the workflow without a provider account, use `roundtable setup --client codex --fake`
164
181
  before restarting the assistant and request a scripted demo review. This uses port 4748 and
165
182
  makes no model calls. Switch back with `roundtable setup --client codex --live` and reload again.
@@ -168,10 +185,12 @@ the board, or run `roundtable fake` for a foreground demo. If the board is alrea
168
185
  the background, open its URL instead of starting a second server.
169
186
 
170
187
  Foreground board startup and top-level help show the app's pixel logo tile in orchid, with
171
- the wordmark and installed version beside it. The tile is drawn with half-block characters,
172
- so it needs a UTF-8 terminal; other locales, and `ROUNDTABLE_ASCII=1`, get the wordmark
173
- alone. Narrow terminals use a short title, `NO_COLOR=1` removes color, and redirected
174
- output, CI, `TERM=dumb`, MCP and JSON commands omit it.
188
+ the wordmark, a blinking block cursor and the installed version beside it. The tile is drawn
189
+ with half-block characters, so it needs a UTF-8 terminal; other locales, and
190
+ `ROUNDTABLE_ASCII=1`, get the wordmark alone. Startup then lists the provider CLIs found on
191
+ `PATH`, each in its seat color; `roundtable doctor` names the missing ones in one line.
192
+ Narrow terminals use a short title, `NO_COLOR=1` removes color, and redirected output, CI,
193
+ `TERM=dumb`, MCP and JSON commands omit the decoration.
175
194
 
176
195
  ## 2. Install and log in to each vendor
177
196
 
@@ -818,6 +837,94 @@ What is different from a CLI seat:
818
837
  The chairman can be an endpoint too; its card takes the same fields. The decision record
819
838
  names the endpoint on each seat's line (`API http://localhost:11434/v1`) and on the chairman's.
820
839
 
840
+ ## 7c. AgentLink ACP profiles (optional)
841
+
842
+ [AgentLink](https://github.com/prplkane/agentlink) manages existing agent CLI/ACP
843
+ bridges in one place. Configure profiles there once. In Roundtable, choose
844
+ **AgentLink (ACP)** on each seat and the chairman, and enter its saved profile name.
845
+ The project uses the profile name; it does not install or copy the vendor bridge.
846
+
847
+ Install the qualified public beta once:
848
+
849
+ ```sh
850
+ npm install -g @prplkane/agentlink@0.3.0-beta.1
851
+ ```
852
+
853
+ With AgentLink installed globally, Roundtable launches `agentlink acp PROFILE`.
854
+ On Windows it resolves the npm script through Node, without a shell. For source
855
+ checkouts, set the absolute path once in the shell that starts Roundtable:
856
+
857
+ ```powershell
858
+ $env:ROUNDTABLE_AGENTLINK_CLI = 'C:\code\agentlink\src\cli.mjs'
859
+ node src/server.js
860
+ ```
861
+
862
+ On Linux/macOS use `export ROUNDTABLE_AGENTLINK_CLI=/absolute/path/agentlink/src/cli.mjs`.
863
+ `AGENTLINK_HOME`, if set in that shell, selects the shared AgentLink store. Otherwise
864
+ AgentLink uses its normal user store. The launcher override is local configuration;
865
+ a review request cannot supply executable paths or arguments.
866
+
867
+ For the JSON client, `vendor: "acp"` selects this connection and `account` names the
868
+ AgentLink profile. For ACP this field is not a Roundtable login directory:
869
+
870
+ ```json
871
+ {
872
+ "fieldNotes": { "decision": "Which rollout should we choose?", "options": ["Small trial", "Wait"] },
873
+ "seats": [
874
+ { "vendor": "acp", "account": "codex", "lens": "risk" },
875
+ { "vendor": "acp", "account": "claude", "lens": "cost" }
876
+ ],
877
+ "chairman": { "vendor": "acp", "account": "codex" },
878
+ "options": { "memory": "stateless", "critiqueRounds": 1, "allowLimitedIsolation": true }
879
+ }
880
+ ```
881
+
882
+ Save this as your own review JSON, then use `node src/cli.js agent check --input FILE`
883
+ and `node src/cli.js agent start --input FILE`. Check validates the request; it does
884
+ not start an agent. Start can make model calls. Follow the normal wait/answer flow
885
+ through a ready chairman verdict.
886
+
887
+ The initial integration deliberately has these limits:
888
+
889
+ - **ACP v1 and text reviews.** Each turn gets a fresh process/session in its seat's
890
+ isolated working directory. The session is bound as its creation response arrives,
891
+ so even a following update in the same stdout chunk must belong to that session.
892
+ `memory: resume` is refused. No AgentLink library,
893
+ daemon, package installation or discovery is loaded into Roundtable.
894
+ - **Profile-owned permissions and billing.** Roundtable advertises no filesystem
895
+ or terminal capabilities, supplies no MCP servers, denies permission requests,
896
+ and stops a seat on reported tool calls. ACP is not a sandbox and cannot disable
897
+ tools or customizations inside the agent. Use a trusted profile configured with
898
+ its own tools disabled. The board shows this limit; JSON clients must explicitly
899
+ accept it with `allowLimitedIsolation`. Check the selected vendor's applicable
900
+ terms separately. The direct adapters' vendor-specific restrictions do not apply
901
+ to an arbitrary ACP profile. Profile environment settings can select API billing.
902
+ - **Agent defaults remain defaults.** Leave Model empty, or supply a model ID
903
+ advertised in the session's standard model configuration options. Unadvertised
904
+ model overrides fail before a prompt. Reasoning preferences stay with the profile;
905
+ Roundtable does not guess effort flags or a safe mode from their names.
906
+ - **Usage is optional.** Roundtable reads the existing experimental
907
+ [end-turn usage field](https://docs.rs/agent-client-protocol/latest/agent_client_protocol/schema/v1/struct.PromptResponse.html#structfield.usage)
908
+ only when its counters and total agree. Missing/invalid usage remains unknown,
909
+ and the existing seat cap blocks that seat's next call, including a repair or
910
+ critique. The chairman may still summarize usable replies. ACP context occupancy
911
+ is not spending. No live subscription quota is inferred; dollar caps are refused.
912
+ An explicit `acp` token budget covers all ACP profiles in the review.
913
+ - **Login stays with the agent.** Sign in through the vendor's own flow. Authentication
914
+ errors identify that step; Roundtable does not open a login terminal automatically.
915
+ The readiness lamp checks the launcher only. Use `agentlink check PROFILE` to
916
+ check initialization; a successful check does not prove task compatibility.
917
+ - **Updates are central.** An explicit `agentlink bridge update NAME` changes new
918
+ connections, including the next Roundtable turn. In-flight connections retain
919
+ their AgentLink lease. There is no automatic update during connection startup.
920
+
921
+ `npm test` exercises the ACP client with a local fake peer. With both source
922
+ checkouts, run `node scripts/test-roundtable.mjs /absolute/path/to/roundtable`
923
+ **from AgentLink** for the real gateway integration. It starts an isolated local
924
+ Roundtable server with vendor discovery disabled, creates temporary managed fake
925
+ bridges, completes a two-round review and chairman verdict, updates the bridge,
926
+ and tests cancellation and missing usage. It never uses a real vendor account.
927
+
821
928
  ## 8. Run a debate without the browser
822
929
 
823
930
  ### Optional searcher before discussion
@@ -961,8 +1068,10 @@ When `nextAction.type` is `ask_user`, the coordinator must actually ask `gate.qu
961
1068
  1. Use the host's available question/input tool. If there is no form, ask in normal chat.
962
1069
  Combine overlapping questions when useful, while retaining their IDs. A raw JSON dump
963
1070
  alone is not the question handoff.
964
- 2. Tell the person when `gate.autoContinueAt` expires and that the review will continue with
965
- unanswered facts still unknown. Use only supplied facts; do not fill missing answers yourself.
1071
+ 2. Tell the person when the answer window closes: `gate.secondsUntilAutoContinue` is the whole
1072
+ seconds left and `gate.autoContinueAtIso` the same moment as an ISO timestamp
1073
+ (`autoContinueAt` is epoch milliseconds). The review will continue with unanswered facts
1074
+ still unknown. Use only supplied facts; do not fill missing answers yourself.
966
1075
  3. If the person needs more time, send `agent hold --id <review-id> --input file` with
967
1076
  `{ "round": 0 }`. This renews the configured answer window, bounded by the wall clock.
968
1077
  Do not use it as a background keepalive. `nextAction.extend` provides the command and input.
@@ -976,10 +1085,15 @@ When `nextAction.type` is `ask_user`, the coordinator must actually ask `gate.qu
976
1085
 
977
1086
  `nextAction.answerTemplate` and `nextAction.command` give the answer shape and agent subcommand.
978
1087
  Prefix subcommands with `node src/cli.js` from a checkout, or `roundtable` when installed.
979
- Use the current question IDs and round number in an answer file:
1088
+ Use the current question IDs and round number in an answer file. Each answer says who wrote it:
1089
+ `from: "user"` for the person's own reply, `from: "assistant"` for one the agent supplied with the
1090
+ person's permission (the default when `from` is omitted). A submission made only of the person's
1091
+ own answers, with no `message`, reaches the board, the seats and the exported record as the
1092
+ human's answer relayed by the assistant; anything else is an agent note whose answer lines say
1093
+ whose words they are. The declaration is the agent's own and is shown, not verified:
980
1094
 
981
1095
  ```json
982
- { "round": 0, "answers": [{ "id": "q1", "text": "The deadline can move by a week." }], "message": "Keep the trial reversible." }
1096
+ { "round": 0, "answers": [{ "id": "q1", "text": "The deadline can move by a week.", "from": "user" }] }
983
1097
  ```
984
1098
 
985
1099
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prplkane/roundtable",
3
- "version": "0.6.3",
3
+ "version": "0.6.6",
4
4
  "description": "Local decision reviews with coding-agent CLIs, human input, budget checks and Markdown records.",
5
5
  "keywords": [
6
6
  "claude",
package/scripts/mcp.mjs CHANGED
@@ -33,8 +33,10 @@ const descriptors = [
33
33
  ['check', 'Validate a proposed review and estimate its calls/tokens before starting. Makes no model call.', object({ review }, ['review']), true],
34
34
  ['start', 'Start the requested Roundtable review after check. Makes model calls within its limits. Returns an id, NOT a recommendation; keep calling wait through the chairman.', object({ review }, ['review']), false],
35
35
  ['wait', 'Wait up to 25 seconds for questions or completion. A wait timeout is progress, not completion. After showing questions, pass afterRound to await the next step without repeating them.', object({ id, seconds: integer(LIMITS.waitSeconds), afterRound: round }, ['id']), true],
36
- ['answer', 'Submit only the user\'s real answers to the current round; read status first. May resume model calls. Silence is handled by the timer, not blank answers.', object({ id, round,
37
- answers: { type: 'array', maxItems: LIMITS.answers, items: object({ id: text(LIMITS.questionId), text: text(LIMITS.answer) }, ['id', 'text']) }, message: text(LIMITS.message) }, ['id', 'round']), false],
36
+ ['answer', 'Submit the user\'s real answers to the current round; read status first. Each answer says who wrote it: from "user" for the user\'s own reply, from "assistant" when you supplied it with the user\'s permission (also what a missing from means). The board and the seats see that declaration. May resume model calls. Silence is handled by the timer, not blank answers.', object({ id, round,
37
+ answers: { type: 'array', maxItems: LIMITS.answers, items: object({ id: text(LIMITS.questionId), text: text(LIMITS.answer),
38
+ from: { type: 'string', enum: ['user', 'assistant'], description: 'user: the user\'s own words, relayed. assistant: your own answer, given with the user\'s permission. Omitted counts as assistant.' } }, ['id', 'text']) },
39
+ message: text(LIMITS.message) }, ['id', 'round']), false],
38
40
  ['hold', 'Give the user another bounded answer window when they need more time. No model call. Never use as an automatic keepalive.', object({ id, round }, ['id', 'round']), false],
39
41
  ['finish', 'On the user\'s request, end discussion and call the chairman with collected replies. Keep waiting for the verdict.', object({ id, message: text(LIMITS.message) }, ['id']), false],
40
42
  ['stop', 'Cancel this review, including an in-flight chairman, when the user asks to stop. Does not synthesize a recommendation.', object({ id, message: text(LIMITS.message) }, ['id']), false],
@@ -16,7 +16,9 @@ one-time `roundtable setup --client codex` (or `claude` / `agy`) step.
16
16
  The MCP server starts the local board when needed; offer its link without opening it.
17
17
  For the CLI fallback, read `roundtable agent --help`, then `roundtable agent status --refresh`.
18
18
  If no server answers, use `roundtable server start` to start a hidden board and retry
19
- the read. An incompatible running board needs a restart after its reviews finish;
19
+ the read. If that reports `EPERM` or that the environment blocks local servers, your
20
+ sandbox forbids the port: ask the user to run `roundtable server start` in their own
21
+ terminal once, then retry. An incompatible running board needs a restart after its reviews finish;
20
22
  `roundtable server restart` refuses active reviews. Never automatically retry a write
21
23
  that might already have succeeded.
22
24
  2. Choose distinct perspectives using the user's facts and constraints. Normally use two seats,
@@ -31,7 +33,9 @@ one-time `roundtable setup --client codex` (or `claude` / `agy`) step.
31
33
  job sets `options.unattended: true`; an attended chat or browser review leaves it false.
32
34
  4. Keep using `roundtable_wait` through discussion and chairman synthesis. At `ask_user`,
33
35
  present the supplied questions using the host's available input tool, or normal chat.
34
- Include the deadline and explain that silence continues with unanswered facts unknown.
36
+ Include when the window closes (`gate.secondsUntilAutoContinue`) and explain that silence
37
+ continues with unanswered facts unknown. Send the user's reply with `from: "user"` on each
38
+ answer; an answer you supply yourself, with the user's permission, carries `from: "assistant"`.
35
39
  Keep question IDs when combining questions. Never fabricate or submit blank answers to
36
40
  move the review along. The server owns auto-continue; reading does not extend it.
37
41
  5. After presenting a question, asynchronous hosts wait with `afterRound` set to that round.
@@ -0,0 +1,201 @@
1
+ // Standard ACP v1 over stdio. AgentLink owns profiles/installations; Roundtable owns
2
+ // the review, fresh seat sessions, deadlines and denial of client-side tools.
3
+ import { spawn } from 'node:child_process';
4
+ import { mkdirSync, existsSync } from 'node:fs';
5
+ import path from 'node:path';
6
+ import { cleanEnv, resolveBinary, registerCall, killTree } from './spawn.js';
7
+ import { agentLinkProfile } from '../seats.js';
8
+ import { VERSION } from '../version.js';
9
+
10
+ const LIMIT = 8 * 1024 * 1024;
11
+ const fault = (message, code = 'PROVIDER_PROTOCOL', kind = 'other') => Object.assign(new Error(message), { code, kind });
12
+ const policy = () => Object.assign(fault('ACP agent requested or reported prohibited tool activity. This seat is stopped for the review.', 'TOOL_POLICY', 'policy'), { usedTools: true });
13
+ const record = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
14
+
15
+ // This local launch override is read only from the server's environment, never a
16
+ // review request. It supports source checkouts and avoids Windows .cmd execution.
17
+ export function agentLinkBinary(env = process.env) {
18
+ const script = env.ROUNDTABLE_AGENTLINK_CLI;
19
+ if (script) {
20
+ if (!path.isAbsolute(script) || !existsSync(script)) throw fault('ROUNDTABLE_AGENTLINK_CLI must name an existing absolute AgentLink CLI script.', 'ENOENT', 'missing');
21
+ return { file: process.execPath, prefix: [script] };
22
+ }
23
+ try { return resolveBinary('agentlink', ['@prplkane/agentlink', 'src/cli.mjs'], { env }); }
24
+ catch { throw fault('AgentLink is not installed. Run npm install -g @prplkane/agentlink@beta, or set ROUNDTABLE_AGENTLINK_CLI to its absolute src/cli.mjs path.', 'ENOENT', 'missing'); }
25
+ }
26
+
27
+ // Optional ACP end-turn usage is still experimental. Fresh sessions avoid the
28
+ // deployed turn-vs-session ambiguity. Context-window `used` is never spending.
29
+ // Accept inclusive or additive cache counts only when the reported total agrees.
30
+ export function promptUsage(value, cost, ms) {
31
+ if (!record(value)) return null;
32
+ const count = (n) => Number.isSafeInteger(n) && n >= 0;
33
+ const { inputTokens: input, outputTokens: output, totalTokens: total } = value;
34
+ const cacheRead = value.cachedReadTokens ?? 0, cacheWrite = value.cachedWriteTokens ?? 0, thinking = value.thoughtTokens ?? 0;
35
+ if (![input, output, total, cacheRead, cacheWrite, thinking].every(count)) return null;
36
+ let uncached;
37
+ if (total === input + output && input >= cacheRead + cacheWrite) uncached = input - cacheRead - cacheWrite;
38
+ else if (total === input + output + cacheRead + cacheWrite) uncached = input;
39
+ else return null;
40
+ return { input: uncached, output, cacheRead, cacheWrite, thinking, cost, ms, usageVersion: 3 };
41
+ }
42
+
43
+ function connect(bin, profile, { cwd, env, signal, onUpdate }) {
44
+ const child = spawn(bin.file, [...bin.prefix, 'acp', profile], {
45
+ cwd, env, windowsHide: true, detached: process.platform !== 'win32', stdio: ['pipe', 'pipe', 'pipe'],
46
+ });
47
+ let next = 0, pendingText = '', bytes = 0, failure, closed = false, closing = false, sessionId;
48
+ const pending = new Map();
49
+ const send = (message) => { if (!closed && child.stdin.writable) child.stdin.write(JSON.stringify({ jsonrpc: '2.0', ...message }) + '\n'); };
50
+ const cancel = () => { if (sessionId) send({ method: 'session/cancel', params: { sessionId } }); };
51
+ const fail = (error) => {
52
+ if (failure) return;
53
+ failure = error;
54
+ cancel();
55
+ for (const p of pending.values()) p.reject(error);
56
+ pending.clear();
57
+ };
58
+ const aborted = () => fail(signal.reason || fault('ACP call cancelled.', 'KILLED', 'killed'));
59
+ const exit = new Promise((resolve) => child.once('close', () => {
60
+ closed = true;
61
+ if (pendingText.trim()) fail(fault('ACP stdout ended with an incomplete JSON-RPC frame.'));
62
+ if (!closing) fail(fault('ACP process exited before the call completed. Run agentlink check for this profile.', 'CLI_EXIT'));
63
+ resolve();
64
+ }));
65
+ child.on('error', (e) => fail(fault(`Could not launch AgentLink (${e.code || 'spawn error'}).`, e.code || 'CLI_EXIT', 'missing')));
66
+ child.stdin.on('error', () => { if (!closing) fail(fault('ACP input closed before the call completed.', 'CLI_EXIT')); });
67
+ function receive(message) {
68
+ if (!record(message) || message.jsonrpc !== '2.0') throw fault('Invalid ACP JSON-RPC envelope.');
69
+ if (Object.hasOwn(message, 'method')) {
70
+ if (typeof message.method !== 'string') throw fault('Invalid ACP method.');
71
+ if (Object.hasOwn(message, 'id')) {
72
+ if (message.method === 'session/request_permission') {
73
+ send({ id: message.id, result: { outcome: { outcome: 'cancelled' } } });
74
+ throw policy();
75
+ }
76
+ send({ id: message.id, error: { code: -32601, message: 'Roundtable does not provide client tools.' } });
77
+ if (/^(fs\/|terminal\/)/.test(message.method)) throw policy();
78
+ } else if (message.method === 'session/update') {
79
+ const { params } = message;
80
+ if (!record(params) || !record(params.update) || typeof params.sessionId !== 'string') throw fault('Invalid ACP session update.');
81
+ if (['tool_call', 'tool_call_update'].includes(params.update.sessionUpdate)) throw policy();
82
+ if (sessionId && params.sessionId !== sessionId) throw fault('ACP update belongs to another session.');
83
+ if (sessionId) onUpdate(params.update);
84
+ }
85
+ return;
86
+ }
87
+ if (!Object.hasOwn(message, 'id') || Object.hasOwn(message, 'result') === Object.hasOwn(message, 'error')) throw fault('Invalid ACP response.');
88
+ const p = pending.get(message.id);
89
+ if (!p) throw fault('ACP response has an unknown request ID.');
90
+ pending.delete(message.id);
91
+ if (message.error) {
92
+ const auth = message.error.code === -32000;
93
+ p.reject(fault(auth ? 'ACP authentication is required. Sign in using the agent vendor login flow, then check the AgentLink profile.'
94
+ : `ACP request failed: ${String(message.error.message || 'unknown error').slice(0, 500)}`, 'CLI_FAILURE', auth ? 'auth' : 'other'));
95
+ } else if (!record(message.result)) p.reject(fault('ACP response result must be an object.'));
96
+ else {
97
+ // Bind at the receive boundary: the next frame can be in this same chunk,
98
+ // before the awaiting session/new caller gets a chance to resume.
99
+ if (p.method === 'session/new' && typeof message.result.sessionId === 'string') sessionId = message.result.sessionId;
100
+ p.resolve(message.result);
101
+ }
102
+ }
103
+ const accountBytes = (d) => {
104
+ bytes += Buffer.byteLength(d);
105
+ if (bytes > LIMIT) { fail(fault('ACP output exceeded the local size limit.', 'OUTPUT_LIMIT')); return false; }
106
+ return !failure;
107
+ };
108
+ child.stderr.on('data', accountBytes); // diagnostics are bounded, never copied into review records
109
+ child.stdout.setEncoding('utf8').on('data', (d) => {
110
+ if (!accountBytes(d)) return;
111
+ pendingText += d;
112
+ try {
113
+ let i;
114
+ while ((i = pendingText.indexOf('\n')) >= 0) {
115
+ const line = pendingText.slice(0, i); pendingText = pendingText.slice(i + 1);
116
+ if (line.trim()) receive(JSON.parse(line));
117
+ if (failure) break;
118
+ }
119
+ } catch (e) { fail(e instanceof SyntaxError ? fault('ACP stdout contained invalid JSON.') : e); }
120
+ });
121
+ signal.addEventListener('abort', aborted, { once: true });
122
+ if (signal.aborted) aborted();
123
+ return {
124
+ setSession(id) { sessionId = id; },
125
+ check() { if (failure) throw failure; },
126
+ request(method, params) {
127
+ if (failure) return Promise.reject(failure);
128
+ const id = ++next;
129
+ return new Promise((resolve, reject) => { pending.set(id, { resolve, reject, method }); send({ id, method, params }); });
130
+ },
131
+ async close() {
132
+ closing = true;
133
+ signal.removeEventListener('abort', aborted);
134
+ if (!closed) {
135
+ child.stdin.end();
136
+ // Leave time for AgentLink's own bridge cleanup and lease release.
137
+ const timer = setTimeout(() => killTree(child), 2000);
138
+ try { await exit; } finally { clearTimeout(timer); }
139
+ }
140
+ },
141
+ };
142
+ }
143
+
144
+ export function makeAcpAdapter({ bin, env: suppliedEnv } = {}) {
145
+ return async (prompt, previousSession = null, opts = {}) => {
146
+ const profile = agentLinkProfile(opts.account);
147
+ if (!opts.allowLimitedIsolation) throw fault('ACP profiles control their own permissions and customization. Accept limited isolation before using this profile.', 'ISOLATION_REQUIRED', 'policy');
148
+ if (previousSession || opts.keepSession) throw fault('ACP seats currently require stateless memory; no previous session was loaded.', 'ACP_STATELESS_REQUIRED');
149
+ if (opts.research) throw fault('ACP seats do not support Roundtable web research.', 'ACP_UNSUPPORTED');
150
+ if (opts.effort) throw fault('Set reasoning preferences in the AgentLink profile; this ACP client does not override effort.', 'ACP_UNSUPPORTED');
151
+ const cwd = opts.cwd;
152
+ if (!cwd || !path.isAbsolute(cwd)) throw fault('ACP seats need an absolute, isolated working directory.');
153
+ mkdirSync(cwd, { recursive: true });
154
+ const env = cleanEnv(null, { source: suppliedEnv || process.env });
155
+ const launch = bin || agentLinkBinary(env);
156
+ const call = registerCall(opts.tag);
157
+ const timeout = new AbortController();
158
+ const timer = setTimeout(() => timeout.abort(fault('ACP call timed out.', 'TIMEOUT', 'timeout')), opts.timeoutMs ?? 300_000);
159
+ const signal = AbortSignal.any([call.signal, timeout.signal, ...(opts.signal ? [opts.signal] : [])]);
160
+ const started = Date.now();
161
+ let text = '', cost = null, activePrompt = false;
162
+ let connection;
163
+ try {
164
+ if (signal.aborted) throw signal.reason;
165
+ connection = connect(launch, profile, { cwd, env, signal, onUpdate: (update) => {
166
+ if (!activePrompt) return;
167
+ if (update.sessionUpdate === 'agent_message_chunk') {
168
+ if (update.content?.type !== 'text' || typeof update.content.text !== 'string') throw fault('ACP review replies must contain text.');
169
+ text += update.content.text;
170
+ } else if (update.sessionUpdate === 'usage_update' && update.cost?.currency === 'USD' && Number.isFinite(update.cost.amount) && update.cost.amount >= 0) cost = update.cost.amount;
171
+ } });
172
+ const init = await connection.request('initialize', { protocolVersion: 1, clientCapabilities: {}, clientInfo: { name: 'roundtable', version: VERSION } });
173
+ if (init.protocolVersion !== 1) throw fault('This Roundtable client requires ACP v1; the agent negotiated an incompatible protocol.', 'ACP_UNSUPPORTED');
174
+ const session = await connection.request('session/new', { cwd, mcpServers: [] });
175
+ if (typeof session.sessionId !== 'string' || !session.sessionId) throw fault('ACP agent did not return a session ID.');
176
+ connection.setSession(session.sessionId);
177
+ if (opts.model) {
178
+ const option = Array.isArray(session.configOptions) && session.configOptions.find((o) => o?.type === 'select' && (o.category === 'model' || (!o.category && o.id === 'model')));
179
+ const choices = Array.isArray(option?.options) ? option.options.flatMap((o) => Array.isArray(o?.options) ? o.options : [o]).filter(record) : [];
180
+ if (!option || !choices.some((o) => o.value === opts.model)) throw fault('The ACP agent did not advertise this model. Use its default or an advertised model ID.', 'ACP_UNSUPPORTED');
181
+ await connection.request('session/set_config_option', { sessionId: session.sessionId, configId: option.id, value: opts.model });
182
+ }
183
+ activePrompt = true;
184
+ const result = await connection.request('session/prompt', { sessionId: session.sessionId, prompt: [{ type: 'text', text: prompt }] });
185
+ connection.check();
186
+ if (result.stopReason !== 'end_turn') throw fault(`ACP turn did not complete (${String(result.stopReason || 'missing stop reason')}).`, result.stopReason === 'cancelled' ? 'KILLED' : 'CLI_FAILURE', result.stopReason === 'cancelled' ? 'killed' : 'other');
187
+ if (!text.trim()) throw fault('ACP agent completed without a text answer.');
188
+ await connection.close();
189
+ connection.check();
190
+ const ms = Date.now() - started;
191
+ return { text, usage: promptUsage(result.usage, cost, ms), cost, ms, sessionId: session.sessionId, usedTools: false };
192
+ } catch (e) {
193
+ throw Object.assign(e, { usage: null, cost, ms: Date.now() - started });
194
+ } finally {
195
+ clearTimeout(timer);
196
+ try { await connection?.close(); } finally { call.release(); }
197
+ }
198
+ };
199
+ }
200
+
201
+ export const run = makeAcpAdapter();
@@ -1,7 +1,7 @@
1
- // Antigravity CLI: `agy --output-format json -p=<prompt>`, `--conversation <id>` to resume.
2
- // Quirks: `-p` needs its value attached (`-p=...`) and stdin is ignored in that mode; for long
3
- // prompts common.js switches to --input-format stream-json, where each stdin line is
4
- // {"event":"user","message":{"role":"user","content":...}} and the last stdout line is
5
- // {"event":"result","result":{...same shape as --output-format json...}}. No cost reported.
6
- import { makeAdapter } from './common.js';
7
- export const run = makeAdapter('agy');
1
+ // Antigravity CLI: `agy --output-format json -p=<prompt>`, `--conversation <id>` to resume.
2
+ // Quirks: `-p` needs its value attached (`-p=...`) and stdin is ignored in that mode; for long
3
+ // prompts common.js switches to --input-format stream-json, where each stdin line is
4
+ // {"event":"user","message":{"role":"user","content":...}} and the last stdout line is
5
+ // {"event":"result","result":{...same shape as --output-format json...}}. No cost reported.
6
+ import { makeAdapter } from './common.js';
7
+ export const run = makeAdapter('agy');
@@ -1,6 +1,6 @@
1
- // Claude Code: `claude -p --output-format stream-json --verbose`, prompt on stdin, `--resume <id>`.
2
- // Quirks: total_cost_usd is cumulative for the session on resume; common.js takes the delta.
3
- // stream-json is used only so the rate_limit_event line (remaining quota) comes with each reply.
4
- import { makeAdapter } from './common.js';
5
- import { claudeQuota } from './quota.js';
6
- export const run = makeAdapter('claude', { normaliseQuota: claudeQuota });
1
+ // Claude Code: `claude -p --output-format stream-json --verbose`, prompt on stdin, `--resume <id>`.
2
+ // Quirks: total_cost_usd is cumulative for the session on resume; common.js takes the delta.
3
+ // stream-json is used only so the rate_limit_event line (remaining quota) comes with each reply.
4
+ import { makeAdapter } from './common.js';
5
+ import { claudeQuota } from './quota.js';
6
+ export const run = makeAdapter('claude', { normaliseQuota: claudeQuota });
@@ -1,6 +1,6 @@
1
- // Codex: `codex exec --json`, prompt on stdin (`-`), `exec resume <id>`.
2
- // Quirks: usage comes in the turn.completed event, no cost; `resume` rejects --sandbox so the
3
- // policy is passed with -c sandbox_mode; the PATH entry is an npm .cmd shim, so spawn.js runs
4
- // bin/codex.js through node instead.
5
- import { makeAdapter } from './common.js';
6
- export const run = makeAdapter('codex');
1
+ // Codex: `codex exec --json`, prompt on stdin (`-`), `exec resume <id>`.
2
+ // Quirks: usage comes in the turn.completed event, no cost; `resume` rejects --sandbox so the
3
+ // policy is passed with -c sandbox_mode; the PATH entry is an npm .cmd shim, so spawn.js runs
4
+ // bin/codex.js through node instead.
5
+ import { makeAdapter } from './common.js';
6
+ export const run = makeAdapter('codex');