pi-roundtable 0.40.0 → 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,35 @@ 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
+
8
37
  ## [0.40.0] - 2026-11-08
9
38
 
10
39
  ### Added
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
 
@@ -3654,6 +3654,7 @@ What needs Discord is refused or left out rather than failing later:
3654
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.
3655
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.
3656
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.
3657
3658
 
3658
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.
3659
3660
  `roundtable init --adapter web` creates a host without Discord around the [web chat](#web-chat-pi-roundtable-webchat).
@@ -3663,16 +3664,38 @@ A host that keeps Discord may write it as an adapter instead, as [`adapters`](#a
3663
3664
 
3664
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`.
3665
3666
 
3666
- - `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.
3667
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.
3668
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.
3669
- - 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.
3670
- - `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.
3671
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.
3672
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.
3673
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.
3674
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.
3675
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
+
3676
3699
  <!-- example: examples/headless.ts -->
3677
3700
  ```ts
3678
3701
  import { definePlugin, type RoundtableConfig } from "pi-roundtable";
@@ -4901,6 +4924,8 @@ Import from the entries listed below; source area files are internal.
4901
4924
  | `JUDGE_WORK` | `pi-roundtable/kit` | value |
4902
4925
  | `JevJudgeOptions` | `pi-roundtable/kit` | type |
4903
4926
  | `McpEndpoint` | `pi-roundtable/kit` | type |
4927
+ | `McpToolHints` | `pi-roundtable/kit` | type |
4928
+ | `YOLO_NEVER_CLASS` | `pi-roundtable/kit` | value |
4904
4929
  | `ModelRef` | `pi-roundtable/kit` | type |
4905
4930
  | `OwnerIdentity` | `pi-roundtable/kit` | type |
4906
4931
  | `Notifier` | `pi-roundtable/kit` | type |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-roundtable",
3
- "version": "0.40.0",
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.3.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,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 {
@@ -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({
@@ -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)))
@@ -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. */
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";