pi-roundtable 0.39.1 → 0.42.0

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
@@ -5,6 +5,46 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.42.0] - 2026-11-08
9
+
10
+ ### Added
11
+
12
+ - The `tree` display block (`pi-better-show` 0.4.0) is drawn: the web app shows it as a directory tree, Discord and LINE get its ASCII drawing, and the web app's formatting guide describes it.
13
+ - `HoldRule.yolo: "never"` marks a hold rule whose calls yolo mode never approves, whatever the configuration says: its calls carry the class `<rule>.yolo-never`, which the yolo approver always cards (`YOLO_NEVER_CLASS` in `pi-roundtable/kit` names the suffix, so a plugin with its own yolo check, such as `pi-roundtable-coding`, refuses it too), and the host refuses to start when `autonomy.yolo.allow` names the rule or one of its classes (`RoundtableOptions.autonomy`, which `defineRoundtable` fills from `autonomy`). An unattended turn still fails a held call closed.
14
+ - `VirtualServer.hints` (`McpToolHints` in `pi-roundtable/kit`) lists each tool's MCP safety hints (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`) by tool name. It is optional; `mcpExtension` ignores it.
15
+
16
+ ### Changed
17
+
18
+ - `pi-better-show` is pinned to 0.4.0.
19
+
20
+ ### Fixed
21
+
22
+ - pi-roundtable-mcp: `mcpConnectors` and `remoteMcp` start on a host without Discord: neither requires `DISCORD` any more, both read it with `services.find`. Without Discord the connectors add no slash commands and keep `CONNECTORS` and its management; remote MCP adds no `/<root> mcp` commands and no `/mcp/discord/<token>` route, serves `/mcp/personal`, keeps channel grants stored but unused, and with no agent server runs its default turns on the core's runtime. With Discord nothing changes.
23
+
24
+ ## [0.41.0] - 2026-11-08
25
+
26
+ ### Added
27
+
28
+ - A Discord bot whose agent team lives only in the app: leave `discord.guild` out and keep `agents`. Discord stays connected for the plugins' claims, the globally registered slash commands and the owner's direct messages, and the team runs as on a host without Discord: id `local`, rooms only, the coordinator `coordinator` names, no agent channels, categories, `#dashboard`, entry channel or agent threads, and no guild asked for on the agents' behalf. `discord.entryChannel` without `discord.guild` is a `ConfigError`, and so is leaving out both the guild and `agents` unless `agentServer: false`; `http.publicUrl` is required only with the guild.
29
+ - pi-roundtable-web: a Webhooks page (`#/webhooks`, under More) lists and manages every knight's incoming webhooks in one place, from the new owner route `GET api/webhooks`. Its pane is `webhooks`; a host with an explicit `panes` list adds it itself, as with `presets`.
30
+ - pi-roundtable-coding: a coding task can be cancelled. `repo_task_cancel { repo, id, reason? }` drops a queued task before it runs, or stops a running worker the way a timeout does, closing the held actions it waited on; the stopped worker's commits stay on its branch and worktree, not merged into the clone, and its report says "cancelled by <name>" and names both. `repo_task_list { repo? }` lists running and queued tasks. An agent sees and cancels its own tasks, an owner any. The Settings page "Coding workers" lists the tasks with an owner-only Cancel action. `CodingDesk.cancel(id, by)` answers a `CancelResult` and `CodingDesk.tasks()` lists the tasks; `REPO_TOOLS` and `RepoToolName` gain the two names, and the `repo_task` result mentions `repo_task_cancel`.
31
+
32
+ ### Changed
33
+
34
+ - `DiscordConfig.guild` and `ResolvedDiscord.guild` are optional, `agentServer: false` included.
35
+ - A team without Discord channels is no longer offered `channel_arrange` or `channel_read`, and its `agent_create` and `group_create` take no `category`; before, they were offered and refused.
36
+
37
+ ## [0.40.0] - 2026-11-08
38
+
39
+ ### Added
40
+
41
+ - A chat that cannot show an interactive block no longer lets the model believe its reader can fill one in. Core closes the formatting guidance of a turn on any surface whose `blocks` lack an interactive kind (`options`, `suggest`, `form`, `checklist`, `review`) with one line: the chat cannot show forms, option buttons or checklists, so ask in plain text; such a block is shown as text and answered by typing. Discord, LINE, the web chat and a host's room get it without editing their own strings; a surface whose guidance already says so sets `ChatSurface.blockNote: false`. A surface that lists an interactive kind in `blocks` promises that the reader's answer reaches the agent as a message from them.
42
+ - A block that reads as text asks in the host's language: `ChatSurface.lang` (`en` or `zh-TW`) and `SurfacePort.lang`, the locale the host was defined with, reach `supportOf(surface, channel, lang)`, `chunksFor` and `textFor`. The reply instructions of `options`, `form`, `review`, `suggest` and `checklist` read in Traditional Chinese for a `zh-TW` host.
43
+
44
+ ### Changed
45
+
46
+ - `pi-better-show` is pinned to 0.3.0.
47
+
8
48
  ## [0.39.1] - 2026-11-08
9
49
 
10
50
  - Release in lockstep with pi-roundtable 0.39.1 (the coding plugin reads its stored worker limit at start, so `Roundtable.check()` passes with `settingsInDatabase`); no package-specific behavior changes.
package/README.md CHANGED
@@ -50,7 +50,7 @@ Bun loads `.env` by itself, and `.gitignore` keeps it out of Git.
50
50
  | Variable | What it is |
51
51
  | --- | --- |
52
52
  | `DISCORD_TOKEN` | The bot's token, from the application's Bot page |
53
- | `DISCORD_GUILD_ID`, `DISCORD_ENTRY_CHANNEL_ID` | The server and the channel where the coordinating agent lives (turn on Developer Mode, then right-click to copy ids) |
53
+ | `DISCORD_GUILD_ID`, `DISCORD_ENTRY_CHANNEL_ID` | The server and the channel where the coordinating agent lives (turn on Developer Mode, then right-click to copy ids); leave both out of the configuration to keep the agents in the app's rooms |
54
54
  | `OWNER_ID`, `OWNER_NAME` | You: the one person who can change everything |
55
55
  | `DATABASE_URL` | PostgreSQL; the default matches `docker-compose.yml` |
56
56
  | `MODEL` | The agents' model, `<provider>/<id>` |
@@ -195,12 +195,13 @@ A turn works 10 minutes by default before it asks you whether to go on, and 30 m
195
195
  | `autonomy.yolo.questionGraceSeconds` | `30` | In a yolo conversation, how long an `ask_user` card holds the turn, 5 to 600; unanswered, the turn goes on with its own best choice and the card stays open |
196
196
  | `autonomy.yolo.timeoutCardSeconds` | `60` | In a yolo conversation, how long the timeout card waits, 10 to 3600; unanswered, the turn goes on as if you pressed Continue, up to `autonomy.longRunning.maxSeconds` |
197
197
 
198
- Without `discord` the agents still run when `agents` lists them, in the rooms of a surface that hosts them, such as pi-roundtable-web; the host refuses to start when none does:
198
+ Without `discord`, or with `discord` but no `discord.guild`, the agents still run when `agents` lists them, in the rooms of a surface that hosts them, such as pi-roundtable-web; the host refuses to start when none does:
199
199
 
200
200
  | Setting | Default | What it is |
201
201
  | --- | --- | --- |
202
- | `agents` | none | The first team, created once. Without `discord`, a seed has no `channelId` and the team's rows are kept under the id `local` |
203
- | `coordinator` | the first of `agents` | Without `discord`, the agent the owner's general requests come to; it cannot be archived. With `discord` it is an error: the entry channel's agent coordinates |
202
+ | `discord.guild` | none | The agent server's guild, where the agents' channels, categories and `#dashboard` live; needs `discord.entryChannel` and `http.publicUrl`. Left out, the bot keeps serving the plugins' claims, slash commands and the owner's direct messages in every guild it is in, and the team lives in the app's rooms as without `discord`: `agents` is required and `entryChannel` is an error |
203
+ | `agents` | none | The first team, created once. Without `discord.guild`, a seed has no `channelId` and the team's rows are kept under the id `local` |
204
+ | `coordinator` | the first of `agents` | Without `discord.guild`, the agent the owner's general requests come to; it cannot be archived. With `discord.guild` it is an error: the entry channel's agent coordinates |
204
205
  | `skills` | on with `agents` | The skills addon; without `discord` it is on only when `agents` lists some |
205
206
  | `helpers` | 4 per knight, 12 in all, archived 24 hours after finishing | Temp knights, the helpers a knight makes with `helper_create` for one task and clears with `helper_end`: `{ perParent, perHost, archiveFinishedAfterHours }`; `false` offers neither tool |
206
207
 
package/README.zh-TW.md CHANGED
@@ -47,7 +47,7 @@ Bun 會自己讀 `.env`,`.gitignore` 也已經擋掉它。
47
47
  | 變數 | 內容 |
48
48
  | --- | --- |
49
49
  | `DISCORD_TOKEN` | bot 的 token,在應用程式的 Bot 頁面取得 |
50
- | `DISCORD_GUILD_ID`、`DISCORD_ENTRY_CHANNEL_ID` | 伺服器,以及負責統籌的智慧體所在的頻道(開啟開發者模式後,按右鍵複製 id) |
50
+ | `DISCORD_GUILD_ID`、`DISCORD_ENTRY_CHANNEL_ID` | 伺服器,以及負責統籌的智慧體所在的頻道(開啟開發者模式後,按右鍵複製 id);設定裡兩者都不寫,agent 就留在 app 的房間 |
51
51
  | `OWNER_ID`、`OWNER_NAME` | 你自己:唯一能改動一切的人 |
52
52
  | `DATABASE_URL` | PostgreSQL;預設值與 `docker-compose.yml` 一致 |
53
53
  | `MODEL` | 智慧體使用的模型,格式為 `<provider>/<id>` |
@@ -190,12 +190,13 @@ export default {
190
190
  | `autonomy.yolo.questionGraceSeconds` | `30` | yolo 對話裡,`ask_user` 卡片讓這一輪等多久,5 到 600;沒回答時,這一輪照它自己的最佳選擇繼續,卡片仍然開著 |
191
191
  | `autonomy.yolo.timeoutCardSeconds` | `60` | yolo 對話裡,逾時卡片等多久,10 到 3600;沒回答時,這一輪就像按了「繼續」一樣接著做,最多到 `autonomy.longRunning.maxSeconds` |
192
192
 
193
- 沒有 `discord` 時,只要 `agents` 列了 agent,它們就在支援房間的 surface(例如 pi-roundtable-web)裡運作;沒有任何 surface 支援房間時 host 拒絕啟動:
193
+ 沒有 `discord`,或有 `discord` 但沒有 `discord.guild` 時,只要 `agents` 列了 agent,它們就在支援房間的 surface(例如 pi-roundtable-web)裡運作;沒有任何 surface 支援房間時 host 拒絕啟動:
194
194
 
195
195
  | 設定 | 預設 | 說明 |
196
196
  | --- | --- | --- |
197
- | `agents` | 無 | 第一批團隊,只建立一次。沒有 `discord` 時,種子沒有 `channelId`,團隊的資料列記在 id `local` 之下 |
198
- | `coordinator` | `agents` 的第一位 | 沒有 `discord` 時,接手主人一般請求的 agent,不能被封存。有 `discord` 時設它會出錯:由入口頻道的 agent 協調 |
197
+ | `discord.guild` | 無 | agent server 的伺服器,agent 的頻道、分類與 `#dashboard` 都在這裡;需要 `discord.entryChannel` 與 `http.publicUrl`。不設時,bot 仍在它加入的每個伺服器服務外掛的 claim、斜線指令與主人的私訊,團隊則像沒有 `discord` 時一樣住在 app 的房間:必須設 `agents`,設 `entryChannel` 會出錯 |
198
+ | `agents` | 無 | 第一批團隊,只建立一次。沒有 `discord.guild` 時,種子沒有 `channelId`,團隊的資料列記在 id `local` 之下 |
199
+ | `coordinator` | `agents` 的第一位 | 沒有 `discord.guild` 時,接手主人一般請求的 agent,不能被封存。有 `discord.guild` 時設它會出錯:由入口頻道的 agent 協調 |
199
200
  | `skills` | 有 `agents` 時開啟 | 技能 addon;沒有 `discord` 時,只有 `agents` 列了 agent 才會開 |
200
201
  | `helpers` | 每位騎士 4 位、全站 12 位,結束 24 小時後封存 | 臨時騎士:騎士用 `helper_create` 為單一任務做出、完成後用 `helper_end` 清掉的幫手。設定為 `{ perParent, perHost, archiveFinishedAfterHours }`;`false` 兩個工具都不提供 |
201
202
 
package/docs/plugins.md CHANGED
@@ -1097,7 +1097,7 @@ defineTool({
1097
1097
 
1098
1098
  #### Hold classes and yolo mode
1099
1099
 
1100
- Every held call carries its **hold classes**: ids of the form `<rule>.<class>` that name why it is held. They are what yolo mode (below) judges, and they are recorded with the call as `HeldCall.holdClasses`, so they survive a restart. A rule reports them with `holdClasses(tool, input, context)`, which lists every reason the call is held, not only the first. **Report only classes that are safe to approve with no one looking: a rule that reports classes has opted its calls in to yolo mode**, which approves them unless the config cards them. A rule that reports none leaves its calls **unclassed**: they carry the rule's bare name (`mail` for a rule called `mail`) and yolo cards them, unless `autonomy.yolo.allow` lists that name. A tool's own `hold` is a rule named `tool:<name>`, so it is unclassed, and `autonomy.yolo.allow: ["tool:repo_push"]` approves a `repo_push` tool's calls. Every reported id must start with the rule's name and a dot; one that does not, such as another rule's id, leaves the call unclassed, as does a `holdClasses` that throws. A rule that stands for other rules' calls, as the one that holds saving a precheck script does, declares `relay: true` and may list their ids instead; its calls also carry `<rule>.relay`, so `autonomy.yolo.card: ["precheck-scripts"]` cards them. A rule name has no dot. The same holds for `HoldDescription.classes`, and a hold check built without `holdChain` has no classes: yolo cards its calls. A rule that describes a call in a turn may name the classes in the description instead: `{ text, classes: ["repo.push"] }` (`HoldDescription.classes`). When several rules hold one call, its classes are all of theirs, so one unclassed or carded rule cards it. `holdChain(rules)` reports them as `classesOf(tool, input, context)` and, with the description, as `inTurnWithClasses(...)` (`ClassedHold`), which also asks the rules after the first that holds the call; a hold check built without `holdChain` has none.
1100
+ Every held call carries its **hold classes**: ids of the form `<rule>.<class>` that name why it is held. They are what yolo mode (below) judges, and they are recorded with the call as `HeldCall.holdClasses`, so they survive a restart. A rule reports them with `holdClasses(tool, input, context)`, which lists every reason the call is held, not only the first. **Report only classes that are safe to approve with no one looking: a rule that reports classes has opted its calls in to yolo mode**, which approves them unless the config cards them. A rule that reports none leaves its calls **unclassed**: they carry the rule's bare name (`mail` for a rule called `mail`) and yolo cards them, unless `autonomy.yolo.allow` lists that name. A tool's own `hold` is a rule named `tool:<name>`, so it is unclassed, and `autonomy.yolo.allow: ["tool:repo_push"]` approves a `repo_push` tool's calls. Every reported id must start with the rule's name and a dot; one that does not, such as another rule's id, leaves the call unclassed, as does a `holdClasses` that throws. A rule that stands for other rules' calls, as the one that holds saving a precheck script does, declares `relay: true` and may list their ids instead; its calls also carry `<rule>.relay`, so `autonomy.yolo.card: ["precheck-scripts"]` cards them. A rule name has no dot. The same holds for `HoldDescription.classes`, and a hold check built without `holdChain` has no classes: yolo cards its calls. A rule that describes a call in a turn may name the classes in the description instead: `{ text, classes: ["repo.push"] }` (`HoldDescription.classes`). When several rules hold one call, its classes are all of theirs, so one unclassed or carded rule cards it. `holdChain(rules)` reports them as `classesOf(tool, input, context)` and, with the description, as `inTurnWithClasses(...)` (`ClassedHold`), which also asks the rules after the first that holds the call; a hold check built without `holdChain` has none. A rule declared `yolo: "never"` is one yolo mode never approves: its calls carry the class `<rule>.yolo-never` whatever it reports, which yolo always cards, and the host refuses to start when `autonomy.yolo.allow` names the rule or one of its classes (a turn nobody can answer still fails its held call closed). `mcp-connectors` holds a connector's tool through such a rule, `mcp-hints`, when its server's hints mark it `destructiveHint: true` or `readOnlyHint: false`; `VirtualServer.hints` carries the hints.
1101
1101
 
1102
1102
  **Yolo mode.** In a conversation whose `yolo` mode an owner switched on ([`MODES`](#conversation-modes-modes)), the server decides a held call before any card opens, and approves it without one only when **all** of these hold at that moment:
1103
1103
 
@@ -3126,9 +3126,11 @@ The agent server claims `discord:` keys, and, only on a surface that declares `a
3126
3126
  | `readAttachment(channel, ref)` | Returns the content of an attachment this surface made, such as an upload to a room, as `Promise<AttachmentContent>`: the bytes, `{ path }` of a file on the host, or a stream, the last two stored without holding them whole; the agent server's claim reads the refs of the surface's messages here and never fetches them over the network, and a rejection fails that file. A claim of your own passes the same function as `read` to `attachmentsOf`, or its refs are downloaded | the refs' URLs are downloaded, up to 25 MB each |
3127
3127
  | `maxAttachmentBytes` | The most bytes of one attachment a turn takes from this surface, for a ref, a file, a stream or a download alike; a positive integer, so a surface that keeps large uploads can raise it past 25 MiB. See [files from outside a turn](#contextattachments-files-from-outside-a-turn) | 25 MiB, as Discord's |
3128
3128
  | `formatting` | A short English text on how a reply renders here, such as "no Markdown tables"; the runtime appends it to the system prompt of every turn that replies on this surface, after the persona | nothing is appended |
3129
- | `blocks` | The [display-block](#display-blocks-in-a-reply) kinds the surface draws itself, such as `["table", "mermaid"]` (`BlockKind` of `pi-better-show`); a reply reaches `sendReply` whole, with the fences of those kinds intact. Every other block arrives as text | none: every block arrives as text |
3129
+ | `blocks` | The [display-block](#display-blocks-in-a-reply) kinds the surface draws itself, such as `["table", "mermaid"]` (`BlockKind` of `pi-better-show`); a reply reaches `sendReply` whole, with the fences of those kinds intact. Every other block arrives as text. Listing an interactive kind (`options`, `suggest`, `form`, `checklist`, `review`) also promises that the reader's answer reaches the agent as a message from them, as typing it would | none: every block arrives as text |
3130
3130
  | `blockText` | How a block the surface does not draw reads as text: `"discord"` (Markdown, with Discord's native `diff` fence), `"line"` (plain text without Markdown markup) or `"plain"` | `"discord"` |
3131
- | `support(channel)` | What differs in one channel of the surface: a `formatting`, `blocks` or `blockText` that replaces the surface's own for a turn that replies there, such as a host's room on a surface that draws blocks only in its own rooms. Return `undefined` for a channel that is like the rest | every channel is like the surface |
3131
+ | `lang` | The language (`"en"` or `"zh-TW"`) a block the surface does not draw asks its reader to answer in, such as "Reply with a number." | the host's locale |
3132
+ | `blockNote` | `false` when the surface's own `formatting` already says what it cannot do with forms, option buttons and checklists, so core adds no line about them | core adds the line whenever the surface does not draw every interactive kind |
3133
+ | `support(channel)` | What differs in one channel of the surface: a `formatting`, `blocks`, `blockText`, `lang` or `blockNote` that replaces the surface's own for a turn that replies there, such as a host's room on a surface that draws blocks only in its own rooms. Return `undefined` for a channel that is like the rest | every channel is like the surface |
3132
3134
  | `startTyping(channel)` | Shows a typing indicator until the returned function is called | none is shown |
3133
3135
  | `showStop(channel)` | Shows the owner a stop control until the returned function is called; using it calls `conversations.stop(channel)`. A group's round shows it for the whole round, and stopping ends the round: the member speaking is stopped and the members still waiting do not speak | none is shown |
3134
3136
  | `react`, `unreact` | Adds or removes the bot's reaction on a message | no marks on queued or steered messages |
@@ -3237,7 +3239,7 @@ A custom runtime provider reads the same lookup as `RuntimeDeps.formatting(chann
3237
3239
 
3238
3240
  ### Display blocks in a reply
3239
3241
 
3240
- An agent may write a *display block* in a reply: a fenced block whose first word is a kind (`cards`, `table`, `steps`, `stats`, `mindmap`, `mermaid`, `diff`, `options`, `form`, ...) or a GitHub alert (`> [!NOTE]`), as `pi-better-show` defines. A block is YAML or source that only a surface that draws it should show, so the host cuts agent text with `chunksFor(surface, text)` (from `pi-roundtable/kit`), never `splitReply` alone: a block whose kind the surface does not list in `blocks` becomes text first (Discord's flavor by default, `blockText: "line"` for plain text; a diagram is drawn as Unicode boxes, unless its source is over 3 KB or the drawing, which runs in a worker the host waits on for at most 500 ms, is not done by then, and then the source is shown), and the result is split into messages within Discord's limit. A surface that lists any kind in `blocks` gets the text whole in one chunk, because cutting a fence breaks the block. `textFor(surface, text)` does the conversion alone, for a surface that shows a message of any length in one piece (the web chat's replies and inbox notices) and so needs no cutting. A block that is not closed at the end of the reply is still a block: a text surface gets it as text, and a surface that draws it gets it as written. A block that does not parse becomes a plain code block. The same applies to interim posts: the host's surface port copies the surface's `blocks` and `blockText` onto the `InterimPosts` it returns, so the poster cuts for the right surface. A surface whose channels differ (a host's room, read on a page that does not draw blocks) answers `support(channel)` with what is different, and `supportOf(surface, channel)` (from `pi-roundtable/kit`) reads the result; the formatting guidance a turn gets follows it too. Host notices and error reports are the host's own text and keep `splitReply`.
3242
+ An agent may write a *display block* in a reply: a fenced block whose first word is a kind (`cards`, `table`, `steps`, `stats`, `mindmap`, `mermaid`, `diff`, `options`, `form`, ...) or a GitHub alert (`> [!NOTE]`), as `pi-better-show` defines. A block is YAML or source that only a surface that draws it should show, so the host cuts agent text with `chunksFor(surface, text)` (from `pi-roundtable/kit`), never `splitReply` alone: a block whose kind the surface does not list in `blocks` becomes text first (Discord's flavor by default, `blockText: "line"` for plain text; a diagram is drawn as Unicode boxes, unless its source is over 3 KB or the drawing, which runs in a worker the host waits on for at most 500 ms, is not done by then, and then the source is shown), and the result is split into messages within Discord's limit. A surface that lists any kind in `blocks` gets the text whole in one chunk, because cutting a fence breaks the block. `textFor(surface, text)` does the conversion alone, for a surface that shows a message of any length in one piece (the web chat's replies and inbox notices) and so needs no cutting. A block that is not closed at the end of the reply is still a block: a text surface gets it as text, and a surface that draws it gets it as written. A block that does not parse becomes a plain code block. The same applies to interim posts: the host's surface port copies the surface's `blocks` and `blockText` onto the `InterimPosts` it returns, so the poster cuts for the right surface. A surface whose channels differ (a host's room, read on a page that does not draw blocks) answers `support(channel)` with what is different, and `supportOf(surface, channel)` (from `pi-roundtable/kit`) reads the result; the formatting guidance a turn gets follows it too. A surface that does not draw every interactive kind (`options`, `suggest`, `form`, `checklist`, `review`) gets one more line, closing its `formatting`, which tells the model the chat cannot show forms, option buttons or checklists, to ask in plain text, and that such a block is shown as text for the user to answer by typing; `blockNote: false` leaves it out. A block that reads as text asks in the host's language: `supportOf(surface, channel, surfaces.lang)` carries the locale the host was defined with, and the surface's own `lang` wins. Host notices and error reports are the host's own text and keep `splitReply`.
3241
3243
  `describeSurfaceContract` checks that a surface listing `blocks` delivers a block of a declared kind longer than a message whole; `describeBlocksContract(name, make)` registers only that check, for a surface that cannot run the whole contract (the subject needs `surface`, `channel` and `observations()` of the replies its person has seen).
3242
3244
 
3243
3245
  Each message a surface delivers says who wrote it in `actor`, the `ActorFacts` the identity service resolves: `provider` and `subject`, such as `discord` and the user id, `name`, `roles` written `<surface>:role:<name>` (left out where the surface does not know them, such as a Discord DM, which is not the same as none), and `legacyId`, the speaker id 0.8 gave the person, so someone carried over keeps their principal.
@@ -3652,6 +3654,7 @@ What needs Discord is refused or left out rather than failing later:
3652
3654
  - `notify` is not registered unless a plugin contributes a [direct channel](#directchannels-reaching-a-person-on-their-own), since there is nowhere to send a notice.
3653
3655
  - `schedule_*` and `delegate_task` are registered only in a conversation whose claim takes background turns: their runs are turns of the [background target](#backgroundtargets-whose-turn-a-schedule-or-delegated-task-is) `PERSONAL_TARGET`, named `owner`, which the core contributes on every host. A conversation of a claim without `background` has neither; a no-surface conversation needs a registered private principal known to a direct channel, as [background targets](#backgroundtargets-whose-turn-a-schedule-or-delegated-task-is) describes.
3654
3656
  - `roundtable doctor` skips the Discord checks.
3657
+ - pi-roundtable-mcp's `mcpConnectors` and `remoteMcp` add no slash commands, and `remoteMcp` serves `/mcp/personal` without the `/mcp/discord/<token>` channel tools.
3655
3658
 
3656
3659
  Pi's runtime still needs the `compact_session` tool in every session, from the Pi package pi-self-compact: load it from a plugin with `piPackages: ["pi-self-compact"]`, as the `plugins/self-compact.ts` of a project `roundtable init` creates does, or the preflight stops the start and says so.
3657
3660
  `roundtable init --adapter web` creates a host without Discord around the [web chat](#web-chat-pi-roundtable-webchat).
@@ -3661,16 +3664,38 @@ A host that keeps Discord may write it as an adapter instead, as [`adapters`](#a
3661
3664
 
3662
3665
  `agents` and `skills` work without `discord`. The host then assembles the agent server and the skills addon whenever `agents` is not empty: the same team, with the same prompts, models, notes, schedules and skills, whose agents and groups have no Discord channel and are reached only through [rooms](#agent-rooms-on-any-surface) of a surface that declares `agentRooms: true`, such as `pi-roundtable-web`.
3663
3666
 
3664
- - `coordinator` names the agent that coordinates the team; it must be one of `agents` and defaults to the first. With `discord` the agent in `discord.entryChannel` is the coordinator, and `coordinator` is a `ConfigError`. The coordinator cannot be archived. `AGENTS.team.coordinator()` answers with either.
3667
+ - `coordinator` names the agent that coordinates the team; it must be one of `agents` and defaults to the first. With `discord.guild` the agent in `discord.entryChannel` is the coordinator, and `coordinator` is a `ConfigError`. The coordinator cannot be archived. `AGENTS.team.coordinator()` answers with either.
3665
3668
  - The team's id is `LOCAL_TEAM_ID`, `"local"`, where Discord's is the guild's id; the rows are stored under it as under the guild's, and `AGENTS.team.guildId` is it.
3666
3669
  - The start fails, naming the fix ("agents need a surface that hosts their rooms, such as pi-roundtable-web"), when no installed surface declares `agentRooms`: without Discord channels the agents could never be spoken to. The check runs when the plugins are linked, so a surface added by any plugin counts.
3667
- - No channel is made, checked or arranged, and the dashboard (a Discord message) does not exist. `channel_arrange` and `channel_read` answer that the host has no Discord channels. `agent_create` and `group_create` make no channel, and a new agent starts its opening task in its room on the first surface that hosts rooms. Archiving an agent or group stops its rooms from answering.
3668
- - `category` on `agent_create` and `group_create` places a Discord channel only. Their `group` places the new room in a group of the app's room list through `ROOM_LAYOUT`, made when missing; without `group` the room stays ungrouped. `agent_list` ends with the app's groups and pinned rooms, and `room_arrange { groups: [{ group, names }] }` sorts rooms into groups the way `channel_arrange` sorts channels into categories, an owner's tool like it. On a host without the app's room list, `group` and `room_arrange` are refused before anything is made.
3670
+ - No channel is made, checked or arranged, and the dashboard (a Discord message) does not exist. `channel_arrange` and `channel_read` are not offered, and `agent_create` and `group_create` take no `category`; called anyway through `AgentTeam`, arranging and reading answer that the host has no Discord channels. `agent_create` and `group_create` make no channel, and a new agent starts its opening task in its room on the first surface that hosts rooms. Archiving an agent or group stops its rooms from answering.
3671
+ - `category` on `agent_create` and `group_create`, offered only to a team with Discord channels, places a Discord channel. Their `group` places the new room in a group of the app's room list through `ROOM_LAYOUT`, made when missing; without `group` the room stays ungrouped. `agent_list` ends with the app's groups and pinned rooms, and `room_arrange { groups: [{ group, names }] }` sorts rooms into groups the way `channel_arrange` sorts channels into categories, an owner's tool like it. On a host without the app's room list, `group` and `room_arrange` are refused before anything is made.
3669
3672
  - An agent's pictures have no public address unless `http.publicUrl` is set: `AGENTS.avatars.url(hash)` is then the path `/avatars/<hash>.png`, which the surface serves itself through `AGENTS.avatars.serve(pathname)` under its own origin, as the web console does. With `http.publicUrl` they are served on the `public` listener as with Discord.
3670
3673
  - `AgentTeam.channelOf(name, near?)` answers with the agent's room on the surface of `near` (the asker's own conversation) when that surface hosts rooms, so `schedule_list` from a room reads the room's schedules; for an agent with no Discord channel it falls back to its room on the first surface that hosts rooms. The status the dashboard and the web read counts an agent's schedules, waiting turns and context use across its Discord channel and its rooms.
3671
3674
  - A surface that lets the owner edit the team uses the same operations the agent tools do, from outside any agent turn: `AgentTeam.createAgent(speaker, input)` (the fields of `agent_create`, plus `model` and `thinking`, which are checked before anything is made; without a `task` the agent only exists, and `openIn` names the surface whose room runs the opening task instead of the Discord channel), `archive(undefined, name)` (an owner has no calling agent, so only the coordinator is protected), `restore(name)`, `remove(name, cleanup?)` (an archived agent or group only, and never an agent the host's seeds name, which the next start would seed again; it runs `cleanup`, your surface's part of the delete, after its checks and before deleting anything, so a cleanup that throws leaves the target in place to try again; then it frees the name, detaches the agent's skills, clears its group cursors and makes the runtime forget the conversations the name kept, and leaves a Discord channel under Archive), and `createGroup` and `updateGroup`. All of them throw `AgentError` with the reason, and fire the team's change signal.
3672
3675
  - Breaking: `AgentGroup.channelId` is optional (`string | undefined`), and so is `GroupStatus.channelId`; a plugin that reads them handles a group without a Discord channel. The `agent_groups.channel_id` column drops its `NOT NULL` in a migration of the agent server (`agent-groups-channel-optional`), and `AgentServerOptions.guildId` and `entryChannelId` are optional, with `coordinator` added. `AvatarStudioOptions.publicUrl` is optional.
3673
3676
 
3677
+ #### A Discord bot without an agent guild
3678
+
3679
+ A bot that serves other guilds, through plugins' claims, slash commands and the owner's direct messages, can keep its agent team in the app: leave `discord.guild` out and keep `agents`.
3680
+ The team then runs exactly as [an agent team without Discord](#an-agent-team-without-discord): its id is `LOCAL_TEAM_ID`, every agent and group has its room only, `coordinator` names the coordinator, and temp knights get rooms.
3681
+ Leaving the guild out is the switch, rather than a separate flag, because the guild is what only the agents use: the Discord plugin itself never reads it, and an agent server in Discord needs it with `entryChannel` and `http.publicUrl`.
3682
+
3683
+ | `discord` | Without `guild` | With `guild` |
3684
+ | --- | --- | --- |
3685
+ | `guild` | Left out: no agent channels, categories, `#dashboard`, entry channel or agent threads, and nothing asks Discord for a guild on the agents' behalf | The agent server's guild |
3686
+ | `entryChannel` | A `ConfigError`: name the coordinator with `coordinator` | Required, unless `agentServer: false` |
3687
+ | `http.publicUrl` | Optional, as without Discord | Required, unless `agentServer: false` |
3688
+ | `agents` | Required, unless `agentServer: false` | Optional |
3689
+ | `coordinator`, a seed's `channelId`, `routing` naming `discord` for an agent | As without Discord: `coordinator` is allowed, the others are a `ConfigError` | As before |
3690
+
3691
+ - The Discord plugin connects and composes its commands as before: they are registered globally, so the root command (its `schedule` subcommands) and the commands plugins add work in every guild the bot is in. The core adds no agent-only slash command; a host that adds the agent panel itself (`agentPanel`) gets its "no agent here" answer outside agent channels.
3692
+ - Messages in the other guilds that no plugin claims are ignored as before: the agent server owns no Discord channel, since no agent or group has one and its team id is no guild's.
3693
+ - The agent tools are those of a team without Discord: `agent_list` lists the app's groups and no categories, `channel_arrange` and `channel_read` are not offered, and `message_agent`, the opening tasks, the agents' reports, background turns, error reports to an agent and the cards their turns raise all land in the agents' rooms.
3694
+ - The owner's direct messages with the bot stay the owner's own conversation, as on any Discord host: its cards and reports stay in the direct message. A card an agent's turn raises shows in that agent's room in the app.
3695
+ - Switching an existing host over starts a new team under `local`: the rows kept under the old guild's id (agents, groups, edited prompts, skills) are not read. The seeds are created again on the first start.
3696
+
3697
+ `roundtable doctor` skips the guild and entry channel checks when `discord.guild` has no value. `agentServer: false` takes `discord.guild` as optional too, since it has no agents.
3698
+
3674
3699
  <!-- example: examples/headless.ts -->
3675
3700
  ```ts
3676
3701
  import { definePlugin, type RoundtableConfig } from "pi-roundtable";
@@ -4899,6 +4924,8 @@ Import from the entries listed below; source area files are internal.
4899
4924
  | `JUDGE_WORK` | `pi-roundtable/kit` | value |
4900
4925
  | `JevJudgeOptions` | `pi-roundtable/kit` | type |
4901
4926
  | `McpEndpoint` | `pi-roundtable/kit` | type |
4927
+ | `McpToolHints` | `pi-roundtable/kit` | type |
4928
+ | `YOLO_NEVER_CLASS` | `pi-roundtable/kit` | value |
4902
4929
  | `ModelRef` | `pi-roundtable/kit` | type |
4903
4930
  | `OwnerIdentity` | `pi-roundtable/kit` | type |
4904
4931
  | `Notifier` | `pi-roundtable/kit` | type |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-roundtable",
3
- "version": "0.39.1",
3
+ "version": "0.42.0",
4
4
  "description": "A plugin-driven Pi agent server for one owner, reached through Discord or the web",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -71,7 +71,7 @@
71
71
  "canvas": "3.2.3",
72
72
  "discord.js": "14.27.0",
73
73
  "pi-jev-compaction": "1.0.0",
74
- "pi-better-show": "0.2.0",
74
+ "pi-better-show": "0.4.0",
75
75
  "pi-mcp-adapter": "5.3.0",
76
76
  "pino": "10.4.0",
77
77
  "typebox": "1.3.37",
@@ -177,6 +177,7 @@ export class DiscordAgentTeam implements AgentOps, AgentTeam {
177
177
  extension(scope: AgentTurnScope): ExtensionFactory {
178
178
  return agentToolsExtension(this, scope, THE_SPEAKER, {
179
179
  skills: this.#options.skills !== undefined,
180
+ channels: this.#options.channels !== undefined,
180
181
  rooms: new TeamRooms(this.#options.store, () => this.#options.rooms?.()),
181
182
  });
182
183
  }
@@ -183,13 +183,18 @@ export interface AgentToolOptions {
183
183
  skills: boolean;
184
184
  /** The app's room groups; without them `group` and room_arrange are refused. */
185
185
  rooms?: RoomOps;
186
+ /** Whether the team has Discord channels; without them no `category`, channel_arrange or channel_read. */
187
+ channels: boolean;
186
188
  }
187
189
 
190
+ /** The tools that work on the team's Discord channels, left out of a team without them. */
191
+ const CHANNEL_TOOLS: readonly string[] = ["channel_arrange", "channel_read"];
192
+
188
193
  function toolDefs(
189
194
  ops: AgentOps,
190
195
  scope: AgentTurnScope,
191
196
  owner: OwnerIdentity,
192
- { skills: skillsOn, rooms }: AgentToolOptions,
197
+ { skills: skillsOn, rooms, channels }: AgentToolOptions,
193
198
  ): AgentToolDef[] {
194
199
  const o = ownerWords(owner);
195
200
  const defs: AgentToolDef[] = [
@@ -273,7 +278,7 @@ function toolDefs(
273
278
  maxLength: 4000,
274
279
  description: "Its opening task, self-contained.",
275
280
  }),
276
- category: Type.Optional(category("Agents")),
281
+ ...(channels ? { category: Type.Optional(category("Agents")) } : {}),
277
282
  group: Type.Optional(ROOM_GROUP),
278
283
  long_running: Type.Optional(
279
284
  Type.Boolean({
@@ -339,7 +344,7 @@ function toolDefs(
339
344
  display_name: DISPLAY,
340
345
  members: MEMBERS,
341
346
  host: Type.Optional(NAME),
342
- category: Type.Optional(category("Groups")),
347
+ ...(channels ? { category: Type.Optional(category("Groups")) } : {}),
343
348
  group: Type.Optional(ROOM_GROUP),
344
349
  }),
345
350
  run: (i) => {
@@ -481,5 +486,8 @@ export function agentToolsExtension(
481
486
  owner: OwnerIdentity,
482
487
  options: AgentToolOptions,
483
488
  ): ExtensionFactory {
484
- return textToolsExtension(toolDefs(ops, scope, owner, options), AgentError);
489
+ const defs = toolDefs(ops, scope, owner, options).filter(
490
+ (def) => options.channels || !CHANNEL_TOOLS.includes(def.name),
491
+ );
492
+ return textToolsExtension(defs, AgentError);
485
493
  }
@@ -55,7 +55,13 @@ export interface TeamTurnsOptions {
55
55
  */
56
56
  surfaces?: Pick<
57
57
  SurfacePort,
58
- "sendReply" | "interim" | "roomSurfaces" | "of" | "progress" | "groupRound"
58
+ | "sendReply"
59
+ | "interim"
60
+ | "roomSurfaces"
61
+ | "of"
62
+ | "lang"
63
+ | "progress"
64
+ | "groupRound"
59
65
  >;
60
66
  studio: Pick<AvatarStudio, "url">;
61
67
  /**
@@ -305,7 +305,11 @@ export class TeamTurns {
305
305
 
306
306
  /** What the surface that serves the channel does there (see `supportOf`). */
307
307
  #support(channel: ChannelKey) {
308
- return supportOf(this.#options.surfaces?.of(channel), channel);
308
+ return supportOf(
309
+ this.#options.surfaces?.of(channel),
310
+ channel,
311
+ this.#options.surfaces?.lang,
312
+ );
309
313
  }
310
314
 
311
315
  /** The messages that carry an agent's text to the channel, cut for the surface that serves it. */
@@ -55,9 +55,9 @@ export const LOCAL_TEAM_ID = "local";
55
55
 
56
56
  export interface AgentServerOptions {
57
57
  /**
58
- * The Discord guild the team lives in. Absent on a host without Discord: the team is then
59
- * `LOCAL_TEAM_ID`, it has no channels, and its agents live in the rooms of the surfaces that
60
- * host them.
58
+ * The Discord guild the team lives in. Absent on a host without Discord, or whose bot has no
59
+ * agent guild: the team is then `LOCAL_TEAM_ID`, it has no channels, and its agents live in the
60
+ * rooms of the surfaces that host them.
61
61
  */
62
62
  guildId?: string;
63
63
  /** The channel the coordinator lives in; set with `guildId`, never with `coordinator`. */
@@ -217,7 +217,7 @@ export function agentServerPlugin(
217
217
  preflight: () => {
218
218
  if (hostsRooms && !hostsRooms())
219
219
  throw new ConfigError(
220
- "the agents need a surface that hosts their rooms, such as pi-roundtable-web, and none is installed. Without Discord channels there is nowhere to talk to them; add a plugin whose chat surface declares agentRooms: true, or configure discord.",
220
+ "the agents need a surface that hosts their rooms, such as pi-roundtable-web, and none is installed. Without Discord channels there is nowhere to talk to them; add a plugin whose chat surface declares agentRooms: true, or configure discord with its guild.",
221
221
  );
222
222
  // The surfaces the rules name exist only once every plugin has registered its own.
223
223
  linkRoutes?.();
@@ -228,7 +228,12 @@ export function agentServerPlugin(
228
228
  const schedules = context.services.get(SCHEDULES);
229
229
  const connection = discord?.connection;
230
230
  const { logger, providers, surfaces } = context;
231
- if (!connection) hostsRooms = () => surfaces.roomSurfaces().length > 0;
231
+ // The team's Discord channels, in the agent guild; a bot without one serves only the plugins.
232
+ const channels =
233
+ connection && options.guildId
234
+ ? connection.agentChannels(options.guildId)
235
+ : undefined;
236
+ if (!channels) hostsRooms = () => surfaces.roomSurfaces().length > 0;
232
237
  const studio = new FileAvatarStudio({
233
238
  dir: join(options.dataDir, "avatars"),
234
239
  skins: context.env.characterSkins,
@@ -293,7 +298,7 @@ export function agentServerPlugin(
293
298
  linkRoutes = () =>
294
299
  routes.validate({
295
300
  names: surfaces.names?.() ?? [],
296
- discordChannels: connection !== undefined,
301
+ discordChannels: channels !== undefined,
297
302
  });
298
303
  const built: DiscordAgentTeam = new DiscordAgentTeam({
299
304
  routes,
@@ -319,9 +324,7 @@ export function agentServerPlugin(
319
324
  shellUser: options.shellUser,
320
325
  ...(options.scratchDir ? { scratchDir: options.scratchDir } : {}),
321
326
  store,
322
- ...(connection && options.guildId
323
- ? { channels: connection.agentChannels(options.guildId) }
324
- : {}),
327
+ ...(channels ? { channels } : {}),
325
328
  studio,
326
329
  ...(options.refreshAvatars ? { refreshAvatars: true } : {}),
327
330
  runtime: () => running,
@@ -17,9 +17,14 @@ import {
17
17
  export interface DiscordConfig {
18
18
  /** The bot token; keep it in `.env`, not in this file. */
19
19
  token: string;
20
- /** The agent server's guild id. */
21
- guild: string;
22
- /** The channel the coordinator lives in. Required unless the configuration says `agentServer: false`, which has no coordinator. */
20
+ /**
21
+ * The agent server's guild id: the agents' channels, categories, `#dashboard` and threads live
22
+ * there. Left out, the bot serves only the plugins' claims and commands in the guilds it is in,
23
+ * and the agent team lives in the app's rooms as on a host without Discord: `agents` is then
24
+ * required, `coordinator` names the coordinator, and `entryChannel` is refused.
25
+ */
26
+ guild?: string;
27
+ /** The channel the coordinator lives in. Required with `guild`, unless the configuration says `agentServer: false`, which has no coordinator. */
23
28
  entryChannel?: string;
24
29
  /** The root slash command, without the slash; default the lowercase assistant name. */
25
30
  rootCommand?: string;
@@ -108,8 +113,9 @@ export interface DiscordConfig {
108
113
  /** The Discord settings with every default filled in. */
109
114
  export interface ResolvedDiscord {
110
115
  token: string;
111
- guild: string;
112
- /** Undefined only with `agentServer: false`. */
116
+ /** Undefined when the agent team lives in the app's rooms. */
117
+ guild?: string;
118
+ /** Undefined with `agentServer: false` or without `guild`. */
113
119
  entryChannel?: string;
114
120
  rootCommand: string;
115
121
  admin: boolean;
@@ -136,7 +142,7 @@ export function resolvedDiscord(
136
142
  ): ResolvedDiscord {
137
143
  return {
138
144
  token: discord.token,
139
- guild: discord.guild,
145
+ ...(discord.guild === undefined ? {} : { guild: discord.guild }),
140
146
  ...(discord.entryChannel === undefined
141
147
  ? {}
142
148
  : { entryChannel: discord.entryChannel }),
@@ -194,7 +200,7 @@ const channelContextShape = shape({
194
200
  /** The Discord settings, at the top level or in a Discord adapter. */
195
201
  export const discordShape = shape({
196
202
  token: text,
197
- guild: text,
203
+ guild: optional(text),
198
204
  entryChannel: optional(text),
199
205
  rootCommand: optional(text),
200
206
  admin: optional(bool),
@@ -8,8 +8,8 @@ interface AgentTeamKeys {
8
8
  }
9
9
 
10
10
  /**
11
- * Refuses what the agent team needs and a host without Discord lacks, naming the key; and the
12
- * coordinator, which only a host without Discord names: with Discord it is the entry channel's agent.
11
+ * Refuses what the agent team needs and a team without Discord channels lacks, naming the key; and
12
+ * the coordinator, which only such a team names: in the agent guild it is the entry channel's agent.
13
13
  */
14
14
  export function checkAgentTeamKeys(
15
15
  config: AgentTeamKeys,
@@ -19,7 +19,7 @@ export function checkAgentTeamKeys(
19
19
  if (config.coordinator !== undefined) {
20
20
  if (withDiscord)
21
21
  throw new ConfigError(
22
- "config coordinator: the entry channel's agent is the coordinator with discord. Remove coordinator, or move the agent to discord.entryChannel.",
22
+ "config coordinator: the entry channel's agent is the coordinator with discord.guild. Remove coordinator, or move the agent to discord.entryChannel.",
23
23
  );
24
24
  if (seeds.length === 0)
25
25
  throw new ConfigError(
@@ -34,7 +34,7 @@ export function checkAgentTeamKeys(
34
34
  const placed = seeds.findIndex((seed) => seed.channelId !== undefined);
35
35
  if (placed >= 0)
36
36
  throw new ConfigError(
37
- `config agents[${placed}].channelId: a Discord channel, and Discord is not configured. Remove channelId, or configure discord.`,
37
+ `config agents[${placed}].channelId: a Discord channel, and the agents have none (no discord, or no discord.guild). Remove channelId, or configure discord with its guild.`,
38
38
  );
39
39
  if (config.skills && seeds.length === 0)
40
40
  throw new ConfigError(
@@ -42,6 +42,47 @@ export function checkAgentTeamKeys(
42
42
  );
43
43
  }
44
44
 
45
+ /** The keys of the configuration that say whether the agents have Discord channels. */
46
+ interface AgentGuildKeys {
47
+ discord?: { guild?: string; entryChannel?: string };
48
+ http?: { publicUrl?: string };
49
+ agents?: readonly unknown[];
50
+ }
51
+
52
+ /**
53
+ * Whether the agent team lives in the Discord guild `discord.guild` names; refuses what that
54
+ * guild needs and lacks, and an entry channel without it. Without `discord.guild` the bot still
55
+ * serves the plugins, and the team lives in the app's rooms, as on a host without Discord.
56
+ */
57
+ export function checkAgentGuild(
58
+ config: AgentGuildKeys,
59
+ agentServer: boolean,
60
+ ): boolean {
61
+ const { discord } = config;
62
+ if (!discord) return false;
63
+ if (discord.guild === undefined) {
64
+ if (discord.entryChannel !== undefined)
65
+ throw new ConfigError(
66
+ "config discord.entryChannel: the coordinator's channel is in the agent guild, and discord.guild is left out, so the agents live in the app's rooms. Remove entryChannel and name the coordinator with coordinator, or add discord.guild.",
67
+ );
68
+ if (agentServer && (config.agents?.length ?? 0) === 0)
69
+ throw new ConfigError(
70
+ "config discord.guild: left out, so the agents live in the app's rooms, and agents configures none. Add agents, add discord.guild for an agent server in Discord, or set agentServer: false for a host without agents.",
71
+ );
72
+ return false;
73
+ }
74
+ if (!agentServer) return true;
75
+ if (!discord.entryChannel)
76
+ throw new ConfigError(
77
+ "config discord.entryChannel: required, expected the id of the channel the coordinator lives in. Add it to roundtable.config.ts, leave out discord.guild for agents that live in the app, or set agentServer: false for a host without agents.",
78
+ );
79
+ if (!config.http?.publicUrl)
80
+ throw new ConfigError(
81
+ "config http.publicUrl: required with discord, expected the public address that reaches the bot; Discord fetches the agents' avatars from it. Add it to roundtable.config.ts.",
82
+ );
83
+ return true;
84
+ }
85
+
45
86
  /** The keys of the configuration, as written, that only the agent server uses. */
46
87
  interface AgentOnlyKeys {
47
88
  agents?: readonly unknown[];
@@ -26,7 +26,11 @@ import {
26
26
  type ResolvedDiscord,
27
27
  resolvedDiscord,
28
28
  } from "./adapters.ts";
29
- import { checkAgentServerOff, checkAgentTeamKeys } from "./agent-team.ts";
29
+ import {
30
+ checkAgentGuild,
31
+ checkAgentServerOff,
32
+ checkAgentTeamKeys,
33
+ } from "./agent-team.ts";
30
34
  import type { AttachmentsConfig } from "./attachments.ts";
31
35
  import { configSchema, DRAIN_LIMIT_MS } from "./config-schema.ts";
32
36
  import type { ConversationsConfig } from "./conversations.ts";
@@ -164,13 +168,13 @@ export interface RoundtableConfig extends LimitsConfig, ShellEnvConfig {
164
168
  prompts?: { shared: string; guest?: string };
165
169
  /**
166
170
  * The first team, created once; an agent already stored is never overwritten. Without `discord`
167
- * the team lives in the rooms of a surface that hosts them, so a seed has no `channelId`.
171
+ * or `discord.guild` the team lives in the rooms of a surface that hosts them: a seed has no `channelId`.
168
172
  */
169
173
  agents?: AgentSeed[];
170
174
  /**
171
- * Without `discord`, the name of the agent that coordinates the team: the one the owner's
172
- * general requests come to, which cannot be archived. It must be one of `agents`; default the
173
- * first. With `discord` the agent in `discord.entryChannel` is the coordinator, and this key is refused.
175
+ * Without `discord` or `discord.guild`, the name of the agent that coordinates the team: the one
176
+ * the owner's general requests come to, which cannot be archived. It must be one of `agents`; default
177
+ * the first. With `discord.guild` the agent in `discord.entryChannel` is the coordinator, and this key is refused.
174
178
  */
175
179
  coordinator?: string;
176
180
  /**
@@ -318,7 +322,7 @@ export interface ResolvedConfig extends ResolvedLimits {
318
322
  toolTiers: Record<string, Tier>;
319
323
  prompts: { shared?: string; guest?: string };
320
324
  agents: AgentSeed[];
321
- /** The coordinator's name; set only without `discord` and with `agents`: the configured one, else the first seed. */
325
+ /** The coordinator's name; set only without `discord.guild` and with `agents`: the configured one, else the first seed. */
322
326
  coordinator?: string;
323
327
  /** How the agents' characters are drawn: the six skin tones, the package's own unless `characters.skins` is set. */
324
328
  characters: { skins: readonly Hex[]; refreshAvatars: boolean };
@@ -376,26 +380,18 @@ export function resolveConfig(input: unknown): ResolvedConfig {
376
380
  const { discord, http } = config;
377
381
  const agentServer = config.agentServer !== false;
378
382
  if (!agentServer) checkAgentServerOff(config);
379
- if (discord && agentServer && !discord.entryChannel)
380
- throw new ConfigError(
381
- "config discord.entryChannel: required, expected the id of the channel the coordinator lives in. Add it to roundtable.config.ts, or set agentServer: false for a host without agents.",
382
- );
383
- if (discord && agentServer && !http?.publicUrl)
384
- throw new ConfigError(
385
- "config http.publicUrl: required with discord, expected the public address that reaches the bot; Discord fetches the agents' avatars from it. Add it to roundtable.config.ts.",
386
- );
387
- checkAgentTeamKeys(config, discord !== undefined);
383
+ // Whether the agents have Discord channels: with `discord.guild`, else they live in the app's rooms.
384
+ const agentGuild = checkAgentGuild(config, agentServer);
385
+ checkAgentTeamKeys(config, agentGuild);
388
386
  const slug =
389
387
  discord?.rootCommand ?? name.toLowerCase().replace(/[^a-z0-9-]+/g, "-");
390
388
  const routing = routingOf(config.routing, {
391
- withDiscord: discord !== undefined,
389
+ withDiscord: agentGuild,
392
390
  agentServer:
393
- agentServer &&
394
- (discord !== undefined || (config.agents?.length ?? 0) > 0),
391
+ agentServer && (agentGuild || (config.agents?.length ?? 0) > 0),
395
392
  topLevelOps: config.ops !== undefined,
396
393
  });
397
- const ops =
398
- opsOf(config.ops, discord !== undefined) ?? opsOfPlace(routing?.places.ops);
394
+ const ops = opsOf(config.ops, agentGuild) ?? opsOfPlace(routing?.places.ops);
399
395
  const access = accessOf(config, discord !== undefined);
400
396
  const { primaryOwner } = access;
401
397
  return {
@@ -452,13 +448,12 @@ export function resolveConfig(input: unknown): ResolvedConfig {
452
448
  prompts: config.prompts ?? {},
453
449
  agents: config.agents ?? [],
454
450
  agentServer:
455
- agentServer &&
456
- (discord !== undefined || (config.agents?.length ?? 0) > 0),
451
+ agentServer && (agentGuild || (config.agents?.length ?? 0) > 0),
457
452
  agentTools:
458
453
  typeof config.agentServer === "object"
459
454
  ? config.agentServer.tools
460
455
  : "full",
461
- ...(!discord && config.agents?.[0]
456
+ ...(!agentGuild && config.agents?.[0]
462
457
  ? { coordinator: config.coordinator ?? config.agents[0].name }
463
458
  : {}),
464
459
  characters: {
@@ -18,7 +18,7 @@ export function opsOf(
18
18
  if (agent !== undefined) {
19
19
  if (!withDiscord)
20
20
  throw new ConfigError(
21
- 'config ops.agent: the agents live in Discord, which is not configured. Report to a conversation a plugin\'s chat surface serves instead, with ops: { conversation: "<surface>:<id>" }; the web chat takes no error reports.',
21
+ 'config ops.agent: the agents live in Discord, which is not configured or has no discord.guild. Report to a conversation a plugin\'s chat surface serves instead, with ops: { conversation: "<surface>:<id>" }; the web chat takes no error reports.',
22
22
  );
23
23
  return { agent };
24
24
  }
@@ -167,7 +167,7 @@ export interface ResolvedRouting {
167
167
 
168
168
  /** What the rest of the configuration says that the block is checked against. */
169
169
  export interface RoutingContext {
170
- /** Whether Discord is configured, so agents have Discord channels. */
170
+ /** Whether the agents have Discord channels: Discord is configured with `discord.guild`. */
171
171
  withDiscord: boolean;
172
172
  /** Whether the agent server runs: only then do agents and their places exist. */
173
173
  agentServer: boolean;
@@ -261,8 +261,8 @@ export function routingOf(
261
261
  if (named[0] || surfaces.discord)
262
262
  throw refuse(
263
263
  named[0] ?? "routing.surfaces.discord",
264
- "names the discord surface, and Discord is not configured",
265
- "Name a surface that hosts rooms instead, or configure discord",
264
+ "names the discord surface, and Discord is not configured or has no discord.guild, so the agents have no Discord channels",
265
+ "Name a surface that hosts rooms instead, or configure discord with its guild",
266
266
  );
267
267
  }
268
268
  return {
@@ -1,4 +1,4 @@
1
- import type { BlockKind } from "pi-better-show";
1
+ import type { BlockKind, TextLang } from "pi-better-show";
2
2
  import type {
3
3
  BlockTextFlavor,
4
4
  ChannelSupport,
@@ -140,7 +140,10 @@ export interface ChatSurface {
140
140
  * The display-block kinds this surface draws itself, such as `table` or `mermaid` (see
141
141
  * pi-better-show). A reply reaches `sendReply` whole, with the fences of those kinds intact; a
142
142
  * block of any other kind arrives as text, and a surface that lists none gets every block as
143
- * text. Absent = none.
143
+ * text. Absent = none. Listing an interactive kind (`options`, `suggest`, `form`, `checklist`,
144
+ * `review`) also promises that the surface hands the reader's answer to the agent as a message
145
+ * from them, the way typing it would; a surface that cannot promise that leaves the kind out,
146
+ * and core tells the model it cannot show forms, option buttons or checklists (see `blockNote`).
144
147
  */
145
148
  readonly blocks?: readonly BlockKind[];
146
149
  /**
@@ -148,6 +151,17 @@ export interface ChatSurface {
148
151
  * `diff` fence), `line` (plain text without Markdown markup), or `plain`. Absent = `discord`.
149
152
  */
150
153
  readonly blockText?: BlockTextFlavor;
154
+ /**
155
+ * The language a block this surface does not draw asks its reader to answer in, `en` or
156
+ * `zh-TW`. Absent = the host's locale.
157
+ */
158
+ readonly lang?: TextLang;
159
+ /**
160
+ * `false` = this surface's `formatting` already says what it cannot do with forms, option
161
+ * buttons and checklists, so core adds no line about them. Absent = core adds one to the
162
+ * guidance of a turn when the surface does not draw every interactive kind.
163
+ */
164
+ readonly blockNote?: false;
151
165
  /**
152
166
  * What differs in one channel of this surface: its `formatting`, `blocks` or `blockText`
153
167
  * replace the surface's for a turn that replies there, such as a host's room on a surface that
@@ -239,6 +253,8 @@ export interface ChatSurface {
239
253
  * NotLinkedError, because the surfaces are collected once every plugin is set up.
240
254
  */
241
255
  export interface SurfacePort {
256
+ /** The host's locale: the language a block that reads as text asks its reader to answer in. */
257
+ readonly lang?: TextLang;
242
258
  /** The surface that serves the channel's prefix; undefined when none does. */
243
259
  of(channel: ChannelKey): ChatSurface | undefined;
244
260
  /** Throws PluginError naming the prefix when no surface serves it. */
@@ -1,4 +1,8 @@
1
- import type { BlockKind } from "pi-better-show";
1
+ import {
2
+ type BlockKind,
3
+ INTERACTIVE_KINDS,
4
+ type TextLang,
5
+ } from "pi-better-show";
2
6
 
3
7
  /** How a block that a surface does not draw reads as text. */
4
8
  export type BlockTextFlavor = "discord" | "line" | "plain";
@@ -9,6 +13,17 @@ export interface BlockSupport {
9
13
  readonly blocks?: readonly BlockKind[];
10
14
  /** The flavor of text for the other kinds; absent = `discord`. */
11
15
  readonly blockText?: BlockTextFlavor;
16
+ /**
17
+ * The language a block that reads as text asks its reader to answer in: `en` or `zh-TW`.
18
+ * Absent = the host's, and without one `en`.
19
+ */
20
+ readonly lang?: TextLang;
21
+ /**
22
+ * `false` = the surface's own guidance already says what it cannot do with forms, option
23
+ * buttons and checklists, so core adds no line about them. Absent = core adds one whenever the
24
+ * surface does not draw every interactive kind.
25
+ */
26
+ readonly blockNote?: false;
12
27
  }
13
28
 
14
29
  /** What a surface says about one channel where it differs from the surface's own; a field that is absent changes nothing. */
@@ -19,7 +34,10 @@ export interface ChannelSupport extends BlockSupport {
19
34
 
20
35
  /**
21
36
  * What a surface does in `channel`: its own `formatting`, `blocks` and `blockText`, over which the
22
- * channel's `support` lays what differs (a host's room on an app, which draws no blocks).
37
+ * channel's `support` lays what differs (a host's room on an app, which draws no blocks). A
38
+ * surface that does not draw every interactive kind (`options`, `suggest`, `form`, `checklist`,
39
+ * `review`) gets a closing line in its `formatting` that says so, so the model does not expect
40
+ * its reader to fill one in. `lang` is the host's language for the text form of a block.
23
41
  */
24
42
  export function supportOf(
25
43
  surface:
@@ -28,6 +46,7 @@ export function supportOf(
28
46
  })
29
47
  | undefined,
30
48
  channel: string,
49
+ lang?: TextLang,
31
50
  ): ChannelSupport {
32
51
  if (!surface) return {};
33
52
  const own = {
@@ -36,6 +55,34 @@ export function supportOf(
36
55
  : { formatting: surface.formatting }),
37
56
  ...(surface.blocks ? { blocks: surface.blocks } : {}),
38
57
  ...(surface.blockText ? { blockText: surface.blockText } : {}),
58
+ ...(surface.lang ? { lang: surface.lang } : {}),
59
+ ...(surface.blockNote === false ? { blockNote: false as const } : {}),
39
60
  };
40
- return { ...own, ...surface.support?.(channel) };
61
+ const merged: ChannelSupport = { ...own, ...surface.support?.(channel) };
62
+ const note =
63
+ merged.blockNote === false ? undefined : interactiveNote(merged.blocks);
64
+ const language = merged.lang ?? lang;
65
+ return {
66
+ ...merged,
67
+ ...(note === undefined
68
+ ? {}
69
+ : { formatting: [merged.formatting, note].filter(Boolean).join(" ") }),
70
+ ...(language === undefined ? {} : { lang: language }),
71
+ };
72
+ }
73
+
74
+ /**
75
+ * What the model is told about the interactive kinds a surface does not draw: none when it draws
76
+ * them all. Such a block reaches the reader as a question to answer by typing.
77
+ */
78
+ function interactiveNote(
79
+ blocks: readonly BlockKind[] | undefined,
80
+ ): string | undefined {
81
+ const missing = INTERACTIVE_KINDS.filter((kind) => !blocks?.includes(kind));
82
+ if (missing.length === 0) return undefined;
83
+ const cannot =
84
+ missing.length === INTERACTIVE_KINDS.length
85
+ ? "forms, option buttons or checklists"
86
+ : `${missing.map((kind) => `\`${kind}\``).join(", ")} blocks`;
87
+ return `This chat cannot show ${cannot}. Ask in plain text. If you write such a block anyway, the user sees it as text and answers by typing.`;
41
88
  }
@@ -175,8 +175,8 @@ function discordAssembly(
175
175
 
176
176
  /**
177
177
  * The agent server and what only it uses, each in its place in the plugin list: the skills addon
178
- * and the seed agents. Its team lives in the Discord guild when there is one, and otherwise in
179
- * the rooms of the surfaces that host them.
178
+ * and the seed agents. Its team lives in the Discord guild `discord.guild` names when there is one,
179
+ * and otherwise in the rooms of the surfaces that host them.
180
180
  */
181
181
  interface AgentAssembly {
182
182
  skills: RoundtablePlugin[];
@@ -215,7 +215,8 @@ function agentAssembly(
215
215
  ]
216
216
  : [],
217
217
  agentServer: agentServerPlugin({
218
- ...(discord
218
+ // Without the agent guild the team lives in the app's rooms, as on a host without Discord.
219
+ ...(discord?.guild
219
220
  ? {
220
221
  guildId: discord.guild,
221
222
  ...(discord.entryChannel
@@ -319,6 +320,7 @@ export async function defineRoundtable(
319
320
  return {
320
321
  options: {
321
322
  logger,
323
+ autonomy: config.autonomy,
322
324
  environment: {
323
325
  locale: config.locale,
324
326
  timeZone: config.timeZone,
@@ -17,6 +17,7 @@ import { setLocale } from "../i18n/index.ts";
17
17
  import { contactsOf } from "../identity/identity-view.ts";
18
18
  import { NotLinkedError } from "../kernel/errors.ts";
19
19
  import { setTimeZone } from "../kernel/time.ts";
20
+ import { refuseYoloOverrides } from "../plugin-api/holds.ts";
20
21
  import type {
21
22
  HostEnv,
22
23
  LinkedSessions,
@@ -232,6 +233,10 @@ export class Linkage {
232
233
  );
233
234
  const { routes, channels } = this.registry;
234
235
  this.sessions = linkSessions(this.registry);
236
+ refuseYoloOverrides(
237
+ this.registry.holdRules,
238
+ this.#options.autonomy?.yolo.allow ?? [],
239
+ );
235
240
  this.events.link(this.registry.handlers);
236
241
  const identity = services.find(IDENTITY);
237
242
  this.router = new ChannelRouter({
@@ -311,7 +316,10 @@ export class Linkage {
311
316
  );
312
317
  return this.registry.surfaces;
313
318
  },
314
- { deprecated: (message) => this.#deprecated(message) },
319
+ {
320
+ deprecated: (message) => this.#deprecated(message),
321
+ lang: this.#options.environment?.locale ?? "en",
322
+ },
315
323
  );
316
324
  }
317
325
 
@@ -10,6 +10,7 @@ import type { Locale } from "../i18n/index.ts";
10
10
  import type { JudgeModel } from "../judging/model-judge.ts";
11
11
  import { MigrationError, PluginError } from "../kernel/errors.ts";
12
12
  import type { Logger } from "../kernel/log.ts";
13
+ import type { Autonomy } from "../modes/autonomy.ts";
13
14
  import type {
14
15
  AgentTools,
15
16
  RoundtablePlugin,
@@ -63,6 +64,11 @@ export interface RoundtableOptions {
63
64
  * the peers' messages at `peerMessageChars`; `defineRoundtable` does both.
64
65
  */
65
66
  peerBots?: PeerBotsConfig;
67
+ /**
68
+ * What yolo mode may approve. Stops the start when `autonomy.yolo.allow` names a hold rule that
69
+ * yolo mode never approves (`HoldRule.yolo`).
70
+ */
71
+ autonomy?: Pick<Autonomy, "yolo">;
66
72
  /** The model the default judge asks, when no plugin provides a judge. */
67
73
  judgeModel?: JudgeModel;
68
74
  /**
@@ -73,6 +73,13 @@ export type HoldDescription =
73
73
  */
74
74
  export interface HoldRule {
75
75
  name: string;
76
+ /**
77
+ * `"never"` marks a rule whose held calls yolo mode never approves, whatever the configuration
78
+ * says. Its calls carry the class `<name>.yolo-never` (the classes it reports are ignored), which
79
+ * the yolo approver always cards, and the host refuses to start when `autonomy.yolo.allow` names
80
+ * the rule or one of its classes.
81
+ */
82
+ yolo?: "never";
76
83
  /**
77
84
  * Whether the rule stands for other rules' calls, as the precheck scripts' does, and may report
78
85
  * their ids in `holdClasses`. Any other rule may report only ids that start with its own name
@@ -155,6 +162,29 @@ export interface HoldRule {
155
162
  mayName?(tool: string): boolean;
156
163
  }
157
164
 
165
+ /** The class a `yolo: "never"` rule's calls carry, after `<rule>.`; yolo mode never approves it. */
166
+ export const YOLO_NEVER_CLASS = "yolo-never";
167
+
168
+ /**
169
+ * Refuses a yolo configuration that would approve a call of a `yolo: "never"` rule: `allow` naming
170
+ * the rule or one of its classes. Naming it in `card` is harmless and passes.
171
+ */
172
+ export function refuseYoloOverrides(
173
+ rules: readonly HoldRule[],
174
+ allow: readonly string[],
175
+ ): void {
176
+ for (const rule of rules) {
177
+ if (rule.yolo !== "never") continue;
178
+ const named = allow.find(
179
+ (id) => id === rule.name || id.startsWith(`${rule.name}.`),
180
+ );
181
+ if (named !== undefined)
182
+ throw new PluginError(
183
+ `autonomy.yolo.allow names ${named}, but hold rule ${rule.name} is one yolo mode never approves. Remove ${named} from autonomy.yolo.allow.`,
184
+ );
185
+ }
186
+ }
187
+
158
188
  /** The description of a held call with its hold classes. */
159
189
  export interface ClassedHold {
160
190
  description: HoldDescription;
@@ -394,6 +424,7 @@ function validClasses(
394
424
  rule: HoldRule,
395
425
  names: ReadonlySet<string>,
396
426
  ): readonly string[] {
427
+ if (rule.yolo === "never") return [`${rule.name}.${YOLO_NEVER_CLASS}`];
397
428
  if (!Array.isArray(reported) || reported.length === 0) return [rule.name];
398
429
  const ids = reported as unknown[];
399
430
  if (!ids.every((id): id is string => isClassOf(id, rule, names)))
@@ -50,7 +50,8 @@ export interface DeliveryRouter {
50
50
 
51
51
  export function deliveryRouter(
52
52
  providers: () => readonly DirectChannelProvider[],
53
- surfaces: Pick<SurfacePort, "sendReply"> & Partial<Pick<SurfacePort, "of">>,
53
+ surfaces: Pick<SurfacePort, "sendReply"> &
54
+ Partial<Pick<SurfacePort, "of" | "lang">>,
54
55
  logger?: Pick<Logger, "warn">,
55
56
  ): DeliveryRouter {
56
57
  const order = (origin: Origin): readonly DirectChannelProvider[] => {
@@ -127,7 +128,11 @@ export function deliveryRouter(
127
128
  await surfaces.sendReply(reached.channel, {
128
129
  // The text of a notice may be an agent's (the notify tool's), block fences included.
129
130
  chunks: chunksFor(
130
- supportOf(surfaces.of?.(reached.channel), reached.channel),
131
+ supportOf(
132
+ surfaces.of?.(reached.channel),
133
+ reached.channel,
134
+ surfaces.lang,
135
+ ),
131
136
  text,
132
137
  ),
133
138
  });
@@ -1,4 +1,4 @@
1
- import { type BlockKind, parse, toText } from "pi-better-show";
1
+ import { type BlockKind, parse, type TextLang, toText } from "pi-better-show";
2
2
  import type { BlockSupport, BlockTextFlavor } from "../domain/block-support.ts";
3
3
  import { diagramDrawer } from "./diagram-text.ts";
4
4
  import { splitReply } from "./reply-splitter.ts";
@@ -29,18 +29,29 @@ export function textFor(
29
29
  surface: BlockSupport | undefined,
30
30
  text: string,
31
31
  ): string {
32
- return convert(text, surface?.blocks ?? [], surface?.blockText ?? "discord");
32
+ return convert(
33
+ text,
34
+ surface?.blocks ?? [],
35
+ surface?.blockText ?? "discord",
36
+ surface?.lang,
37
+ );
33
38
  }
34
39
 
35
40
  function convert(
36
41
  text: string,
37
42
  draws: readonly BlockKind[],
38
43
  flavor: BlockTextFlavor,
44
+ lang: TextLang | undefined,
39
45
  ): string {
40
46
  const segments = parse(text);
41
47
  const blocks = segments.filter((segment) => segment.type !== "markdown");
42
48
  // Toward a surface that draws all of them the text is already right, and rejoining the
43
49
  // segments would only change its spacing.
44
50
  if (blocks.every((block) => draws.includes(block.kind))) return text;
45
- return toText(segments, { flavor, mermaid: diagramDrawer(), keep: draws });
51
+ return toText(segments, {
52
+ flavor,
53
+ mermaid: diagramDrawer(),
54
+ keep: draws,
55
+ ...(lang ? { lang } : {}),
56
+ });
46
57
  }
@@ -251,7 +251,10 @@ export function conversationTurns(
251
251
  else
252
252
  await surfaces.sendReply(
253
253
  channel,
254
- replyBody(result, supportOf(surfaces.of(channel), channel)),
254
+ replyBody(
255
+ result,
256
+ supportOf(surfaces.of(channel), channel, surfaces.lang),
257
+ ),
255
258
  );
256
259
  } catch (error) {
257
260
  logger.error({ channel, kind, err: error }, "reply not posted");
@@ -1,3 +1,4 @@
1
+ import type { TextLang } from "pi-better-show";
1
2
  import type { ChatSurface, SurfacePort } from "../contract/surface.ts";
2
3
  import { parseChannelKey } from "../contract/surface.ts";
3
4
  import { supportOf } from "../domain/block-support.ts";
@@ -13,6 +14,8 @@ import { PluginError } from "../kernel/errors.ts";
13
14
  export interface SurfacePortOptions {
14
15
  /** Told when a caller uses a form that goes away, such as `prompts(channel, speaker)`. */
15
16
  deprecated?(message: string): void;
17
+ /** The host's locale, the language a block that reads as text asks its reader to answer in. */
18
+ lang?: TextLang;
16
19
  }
17
20
 
18
21
  /**
@@ -38,6 +41,7 @@ export function surfacePort(
38
41
  return surface;
39
42
  };
40
43
  return {
44
+ ...(options.lang ? { lang: options.lang } : {}),
41
45
  of,
42
46
  sendReply: async (channel, reply) => {
43
47
  const surface = served(channel);
@@ -67,11 +71,16 @@ export function surfacePort(
67
71
  const posts = surface?.interim?.(channel, as);
68
72
  if (!surface || !posts) return posts;
69
73
  // The poster cuts text for the surface it posts on, which only the port knows.
70
- const { blocks, blockText } = supportOf(surface, channel);
74
+ const { blocks, blockText, lang } = supportOf(
75
+ surface,
76
+ channel,
77
+ options.lang,
78
+ );
71
79
  return {
72
80
  ...(posts.tools === undefined ? {} : { tools: posts.tools }),
73
81
  ...(blocks ? { blocks } : {}),
74
82
  ...(blockText ? { blockText } : {}),
83
+ ...(lang ? { lang } : {}),
75
84
  post: (text) => posts.post(text),
76
85
  };
77
86
  },
@@ -6,6 +6,7 @@ import type { ApprovedBy } from "../../interactions/prompts.ts";
6
6
  import { type Autonomy, DEFAULT_AUTONOMY } from "../../modes/autonomy.ts";
7
7
  import type { ConversationModes } from "../../modes/conversation-modes.ts";
8
8
  import { YOLO_CARDED_SHELL_CLASSES } from "../../modules/host-shell/shell-policy.ts";
9
+ import { YOLO_NEVER_CLASS } from "../../plugin-api/holds.ts";
9
10
  import type { PiAgentRuntimeOptions } from "../runtime-types.ts";
10
11
  import type { AutoApprover } from "./confirmation-gate.ts";
11
12
  import type { SpeakerRef } from "./gate-refusals.ts";
@@ -73,6 +74,8 @@ export function yoloApprover(seams: YoloSeams): AutoApprover {
73
74
  const card = new Set(autonomy.yolo.card);
74
75
  const carded = new Set(YOLO_CARDED_SHELL_CLASSES);
75
76
  const approves = (id: string) => {
77
+ // A `yolo: "never"` rule's call, which no configuration lets through.
78
+ if (id.endsWith(`.${YOLO_NEVER_CLASS}`)) return false;
76
79
  if (card.has(id) || card.has(ruleOf(id))) return false;
77
80
  // A rule that reports classes has opted in; one that reports none is approved only by name.
78
81
  if (unclassed(id)) return allow.has(id);
@@ -1,11 +1,21 @@
1
1
  import type { ExtensionFactory } from "@earendil-works/pi-coding-agent";
2
2
  import { mcpAdapterExtension } from "../shared/mcp-adapter.ts";
3
3
 
4
+ /** A tool's MCP safety hints as its server declares them; a hint it leaves out is absent. */
5
+ export interface McpToolHints {
6
+ readOnlyHint?: boolean;
7
+ destructiveHint?: boolean;
8
+ idempotentHint?: boolean;
9
+ openWorldHint?: boolean;
10
+ }
11
+
4
12
  /** An MCP server a session connects to, with the tools it offers. */
5
13
  export interface VirtualServer {
6
14
  name: string;
7
15
  url: string;
8
16
  tools: string[];
17
+ /** Each tool's hints by tool name; a tool without an entry declared none. Absent when its source reads no hints. */
18
+ hints?: Readonly<Record<string, McpToolHints>>;
9
19
  }
10
20
 
11
21
  /** MCP endpoints supplied by a session plugin, reached with its bearer token. */
@@ -8,7 +8,12 @@ import {
8
8
  until,
9
9
  } from "./surface-contract-support.ts";
10
10
 
11
- /** The contract of a surface that lists `ChatSurface.blocks`: what it says it draws arrives whole. */
11
+ /**
12
+ * The contract of a surface that lists `ChatSurface.blocks`: what it says it draws arrives whole.
13
+ * A surface that lists an interactive kind (`options`, `suggest`, `form`, `checklist`, `review`)
14
+ * also promises that the reader's answer reaches the agent as a message from them, sent the way
15
+ * typing it would be: the contract cannot drive a reader's click, so a surface's own tests show it.
16
+ */
12
17
  export const BLOCK_CHECKS: readonly {
13
18
  name: string;
14
19
  applies(subject: SurfaceContractSubject): boolean;
@@ -78,7 +78,7 @@ export interface DispatchThreadsOptions {
78
78
  * the surface that serves the channel's prefix; a channel whose surface has none gets no thread.
79
79
  * Give this or `host`, not both.
80
80
  */
81
- surfaces?: Pick<SurfacePort, "of">;
81
+ surfaces?: Pick<SurfacePort, "of" | "lang">;
82
82
  /**
83
83
  * Discord's thread host, for the `discord:` channels only.
84
84
  *
@@ -248,9 +248,10 @@ export class DispatchThreads {
248
248
  const { id } = parseChannelKey(channel);
249
249
  let closed = false;
250
250
  const send = threads.send?.bind(threads);
251
- const { blocks, blockText } = supportOf(
251
+ const { blocks, blockText, lang } = supportOf(
252
252
  this.#options.surfaces?.of(channel),
253
253
  channel,
254
+ this.#options.surfaces?.lang,
254
255
  );
255
256
  const post = async (text: string) => {
256
257
  try {
@@ -273,6 +274,7 @@ export class DispatchThreads {
273
274
  // The poster cuts text for the surface the thread is on.
274
275
  ...(blocks ? { blocks } : {}),
275
276
  ...(blockText ? { blockText } : {}),
277
+ ...(lang ? { lang } : {}),
276
278
  post: (text: string) => send(id, text),
277
279
  },
278
280
  }
package/src/kit/holds.ts CHANGED
@@ -5,4 +5,5 @@
5
5
  export {
6
6
  HOLD_DESCRIBE_TIMEOUT_MS,
7
7
  holdChain,
8
+ YOLO_NEVER_CLASS,
8
9
  } from "../core/plugin-api/holds.ts";
package/src/kit/index.ts CHANGED
@@ -57,7 +57,11 @@ export {
57
57
  THINKING_LEVELS,
58
58
  thinkingLabel,
59
59
  } from "./domain.ts";
60
- export { HOLD_DESCRIBE_TIMEOUT_MS, holdChain } from "./holds.ts";
60
+ export {
61
+ HOLD_DESCRIBE_TIMEOUT_MS,
62
+ holdChain,
63
+ YOLO_NEVER_CLASS,
64
+ } from "./holds.ts";
61
65
  export type {
62
66
  CodexFetch,
63
67
  CodexImage,
@@ -210,6 +214,7 @@ export type {
210
214
  CardLimits,
211
215
  InterimPosterOptions,
212
216
  McpEndpoint,
217
+ McpToolHints,
213
218
  PromptSlot,
214
219
  VirtualServer,
215
220
  } from "./worker.ts";
package/src/kit/worker.ts CHANGED
@@ -9,7 +9,7 @@ export {
9
9
  export { canonicalJson } from "../core/runtime/extensions/confirmation-gate.ts";
10
10
  export type { InterimPosterOptions } from "../core/runtime/interim-text.ts";
11
11
  export { InterimPoster } from "../core/runtime/interim-text.ts";
12
- export type { VirtualServer } from "../core/runtime/mcp.ts";
12
+ export type { McpToolHints, VirtualServer } from "../core/runtime/mcp.ts";
13
13
  export { mcpExtension } from "../core/runtime/mcp.ts";
14
14
  export type { PromptSlot } from "../core/runtime/prompt-slot.ts";
15
15
  export { promptSlot, workTimeout } from "../core/runtime/prompt-slot.ts";