pi-roundtable 0.53.6 → 0.54.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 +12 -0
- package/README.md +6 -2
- package/README.zh-TW.md +6 -2
- package/docs/plugins.md +199 -7
- package/package.json +3 -1
- package/runner/Dockerfile +46 -0
- package/runner/Dockerfile.dockerignore +5 -0
- package/src/cli/checks/images.ts +3 -2
- package/src/cli/checks/preset.ts +20 -0
- package/src/cli/checks/runner.ts +45 -0
- package/src/cli/doctor.ts +7 -1
- package/src/core/agents/agent-claim.ts +7 -4
- package/src/core/agents/agent-prompt.ts +11 -2
- package/src/core/agents/helper-workspace.ts +72 -0
- package/src/core/agents/team-options.ts +2 -0
- package/src/core/agents/team-prompt.ts +12 -1
- package/src/core/builtin/agent-server.ts +8 -0
- package/src/core/builtin/polls.ts +67 -0
- package/src/core/builtin/runner.ts +139 -0
- package/src/core/config/config-schema.ts +4 -0
- package/src/core/config/config.ts +49 -185
- package/src/core/config/preset.ts +51 -0
- package/src/core/config/resolve-config.ts +175 -0
- package/src/core/config/runner-config.ts +80 -0
- package/src/core/contract/polls.ts +71 -0
- package/src/core/contract/runtime.ts +12 -0
- package/src/core/contract/surface.ts +13 -0
- package/src/core/discord/discord-polls.ts +156 -0
- package/src/core/discord/discord-replies.ts +55 -0
- package/src/core/discord/discord-surface.ts +13 -43
- package/src/core/domain/errors.ts +5 -0
- package/src/core/domain/sessions.ts +8 -1
- package/src/core/host/define-roundtable.ts +8 -0
- package/src/core/host/host-registration.ts +7 -0
- package/src/core/host/host.ts +8 -0
- package/src/core/i18n/schedules.ts +2 -0
- package/src/core/modules/polls/poll-result-turns.ts +124 -0
- package/src/core/modules/polls/poll-rules.ts +108 -0
- package/src/core/modules/polls/poll-service.ts +477 -0
- package/src/core/modules/polls/poll-store.ts +336 -0
- package/src/core/modules/polls/poll-tools.ts +118 -0
- package/src/core/modules/polls/poll-turn-text.ts +60 -0
- package/src/core/plugin-api/define.ts +9 -2
- package/src/core/plugin-api/holds.ts +2 -0
- package/src/core/plugin-api/plugin.ts +8 -0
- package/src/core/runner/protocol.ts +456 -0
- package/src/core/runner/runner-client.ts +450 -0
- package/src/core/runner/runner-drivers.ts +356 -0
- package/src/core/runner/runner-files.ts +102 -0
- package/src/core/runner/runner-holds.ts +76 -0
- package/src/core/runner/runner-port.ts +77 -0
- package/src/core/runner/runner-probe.ts +53 -0
- package/src/core/runner/runner-prompt.ts +36 -0
- package/src/core/runner/runner-session.ts +131 -0
- package/src/core/runner/runner-tiers.ts +20 -0
- package/src/core/runner/runner-tools.ts +325 -0
- package/src/core/runner/settings.ts +108 -0
- package/src/core/runtime/conversation-sessions.ts +73 -15
- package/src/core/runtime/extensions/approval-card.ts +29 -2
- package/src/core/runtime/extensions/confirmation-gate.ts +24 -63
- package/src/core/runtime/extensions/gate-card.ts +105 -0
- package/src/core/runtime/extensions/yolo.ts +17 -3
- package/src/core/runtime/pi-agent-runtime.ts +37 -68
- package/src/core/runtime/runtime-plugin.ts +9 -0
- package/src/core/runtime/runtime-types.ts +29 -1
- package/src/core/runtime/session-factory.ts +59 -62
- package/src/core/runtime/session-shell.ts +43 -0
- package/src/core/runtime/session-tool-names.ts +78 -0
- package/src/core/runtime/turn-selection.ts +97 -0
- package/src/core/shared/generate-image-tool.ts +4 -4
- package/src/core/shared/poll-target.ts +14 -0
- package/src/core/shared/workspace-files.ts +42 -4
- package/src/core/testing/fake-polls.ts +131 -0
- package/src/core/testing/fake-runner.ts +146 -0
- package/src/core/testing/surface-contract-approvals.ts +215 -0
- package/src/core/testing/surface-contract-polls.ts +142 -0
- package/src/core/testing/surface-contract.ts +32 -208
- package/src/core/tool-set.snapshot.json +8 -0
- package/src/index.ts +17 -0
- package/src/kit/index.ts +6 -0
- package/src/kit/polls.ts +8 -0
- package/src/runner-server/exec.ts +174 -0
- package/src/runner-server/file-helper.ts +208 -0
- package/src/runner-server/files.ts +93 -0
- package/src/runner-server/host.ts +65 -0
- package/src/runner-server/main.ts +89 -0
- package/src/runner-server/server.ts +318 -0
- package/src/runner-server/shared-dirs.ts +45 -0
- package/src/runner-server/state.ts +293 -0
- package/src/runner-server/transports.ts +187 -0
- package/src/testing.ts +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.54.0] - 2026-12-03
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Hosts can set `imageTool: "selected"` to offer `generate_image` only to tool selections that name it, without changing its tier.
|
|
13
|
+
- Agents can post native polls: `poll_create` (`question`, `answers`, `multi?`, `closes_in_minutes`) posts one in the conversation the turn runs in and returns at once, and `poll_end` ends an open poll early, by its starter or an owner. When a poll ends, at its deadline or through `poll_end`, a new turn runs in the same conversation as the person who started it, with the results as data: each answer's votes and up to 100 voters' names. That turn is a background turn for the new `POLL_TARGET`, never a message, so a poll approves nothing. Polls run from 1 minute to 7 days, at most 3 open per conversation, both tools need the `member` tier, and polls survive a restart in the new `roundtable_polls` table, whose rows are deleted 30 days after a poll is reported. Discord's surface supports them (the bot needs Send Polls and Read Message History); a surface without polls makes `poll_create` refuse, naming it. The agent server's claim answers `POLL_TARGET` in agents' channels.
|
|
14
|
+
- A chat surface can offer native polls as `ChatSurface.polls`, a `SurfacePolls` (`limits` as `PollLimits`, `post` taking a `SurfacePoll`, `end`, and `results` resolving to `PollResults` with each answer's `PollVoter`s, or `"gone"`). `describeSurfaceContract` checks a subject that gives `polls`, and `describePollsContract` with a `PollsContractSubject` checks a surface's polls alone; `fakeSurfacePolls` (a `FakeSurfacePolls` holding each `FakePoll`) is an in-memory one for tests.
|
|
15
|
+
- A runner container for multi-user conversations' shell tools: `runner/Dockerfile` builds an image with no credential and no network, preinstalling bash, sh, git, jq, coreutils, Bun and Python 3 with numpy, pandas, openpyxl, matplotlib (with CJK fonts), python-docx and Pillow. Its server (`src/runner-server/`, protocol `src/core/runner/protocol.ts`) gives each conversation its own uid and a private workspace, runs every command with only `PATH`, `HOME`, `TMPDIR`, `LANG` and `TERM` set and its text kept out of the process arguments, leaves no directory writable by every account (a root-owned `/tmp`, no `/dev/shm`, root-owned message queues), never hands a uid out twice or a workspace to a uid that does not own it, stops it at its time and output limits, kills whatever it left running when the call returns, and removes idle workspaces on request. It is reached over a unix socket guarded by a per-boot token, or through `docker exec` with `roundtable-runner serve --stdio`. The package ships the Dockerfile, not an image; hosts are wired to it in a later change.
|
|
16
|
+
- `runner` runs `bash`, `read`, `edit` and `write` in the runner container for every conversation except the owners' own: the owner's direct messages, and an agent's conversation only the owners reach (`AgentSessions.ownersOnly`: its room on a surface that declares its agent rooms the owners' alone, `ChatSurface.agentRoomsOwnersOnly`, which pi-roundtable-web does, and a temp knight's room there made in its parent's room). A room on a surface that does not declare it runs in the runner. That covers agents' Discord channels and threads and groups' rooms and seats on a full-tools host, and personas whose selection names those tools on a chat-only host. Without `runner` nothing changes. Set `{ driver: "docker", image }` and the host starts the container itself with no network. Set `{ driver: "socket", socket }` to reach a sidecar. Optional settings cover the time and output limits, how many idle days a workspace is kept (`keepDays`), and the tier those tools need there (`minTier`, default `member`). In those sessions the tools work in the conversation's workspace in the runner. A temp knight works in the workspace of the parent turn that made it, as it shares the workspace on the host, until that origin is gone (`AgentSessions.runnerHome`); from its next turn it then works in its own. A bash output too long to show is kept whole in the workspace's `.tmp`, and Pi's `grep`, `find`, `ls` and `powershell`, which would reach the host, are not there: a selection that names one is refused. `attach_file`, `generate_image`, the Discord tools' file paths and pi-roundtable-drawing's saved pictures reach that workspace through `ToolTurn.workspace.files` (`WorkspaceFiles`, `WorkspaceFile`), never through the host's disk. The core's `runner-shell` rule holds what the shell rule holds. When the speaker is below the owner, only that speaker can answer the card. An owner's card works like a host shell hold, and yolo mode judges `runner-shell.<class>` as `shell.<class>`. Idle workspaces are removed at start and once a day, and a conversation that retention deletes takes its workspace with it. Plugins read the setting as `context.env.runner` (`RunnerSettings`; the configuration's form is `RunnerConfig`, with `RunnerDriverConfig`). `roundtable doctor` reports whether the runner is reachable. pi-roundtable-webchat lets a persona's selection name the four tools on a chat-only host when `runner` is set.
|
|
17
|
+
- `preset: "shared"` sets up a host many people talk to in one key: it requires `runner` (the host stops at start with a `ConfigError` naming `runner` without it), so every conversation but the owner's own runs `bash`, `read`, `edit` and `write` in the runner and a persona's selection may name them on a chat-only host; it sets `imageTool: "selected"` and gives `generate_image`, `poll_create` and `poll_end` the `member` tier. A setting the configuration writes itself wins over the preset, a selection still has to name each tool, and without `preset` nothing changes. `ResolvedConfig.preset` lists what the preset filled in, and `roundtable doctor` prints it on a new `preset` line.
|
|
18
|
+
- `pollResultTurns` in `pi-roundtable/kit` gives a plugin's own claim `background` and `backgroundRefusal` for `POLL_TARGET` alone (`PollResultTurns`), so it hears the results of the polls its turns started: each runs as the poll's starter with the `PollResultAnswer` (kind, selection, optional origin) the claim gives for the channel, never as a message, and it skips other targets, turns not run as the starter, and conversations that are gone or now someone else's. `PollResultTurnsOptions` takes the turns, the conversation registry and that `answer`.
|
|
19
|
+
|
|
8
20
|
## [0.53.6] - 2026-11-29
|
|
9
21
|
|
|
10
22
|
### Added
|
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@ Source and issues: <https://github.com/wayne930242/pi-roundtable>
|
|
|
7
7
|
|
|
8
8
|
An agent server on [Pi](https://github.com/earendil-works/pi) that you talk to through Discord, or through a web chat.
|
|
9
9
|
In Discord, each AI agent has its own channel and conversation in your server, and they share tools and memory.
|
|
10
|
+
An agent can post a Discord poll there and pick up the results in a new turn once it ends.
|
|
10
11
|
On the web, people your OpenID Connect provider signs in chat with an assistant in private conversations, through [pi-roundtable-webchat](packages/webchat).
|
|
11
12
|
You can extend the bot with TypeScript plugins.
|
|
12
13
|
|
|
@@ -213,6 +214,9 @@ Without `discord`, or with `discord` but no `discord.guild`, the agents still ru
|
|
|
213
214
|
| `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 |
|
|
214
215
|
| `team.id`, `team.formerIds` | the `discord.guild` id, else `local`; none | The id the team's rows are stored under, independent of the guild, and the ids it was stored under before: their rows move to it at every boot, and without Discord channels lose their channel ids |
|
|
215
216
|
| `skills` | on with `agents` | The skills addon; without `discord` it is on only when `agents` lists some |
|
|
217
|
+
| `preset` | none | `"shared"` for a host many people talk to: it requires `runner` (startup stops without it), so every conversation but the owners' own runs `bash`, `read`, `edit` and `write` in the runner and a persona's selection may name them; it sets `imageTool: "selected"` and gives `generate_image`, `poll_create` and `poll_end` the `member` tier. A setting you write yourself wins, a selection still has to name each tool, and `roundtable doctor` prints what the preset set; see the [plugin guide](docs/plugins.md#shared-hosts-preset-shared) |
|
|
218
|
+
| `imageTool` | `"every-selection"` | Only selections listing `generate_image` in `tools` offer it in `"selected"` mode. The image provider and speaker tier still apply. |
|
|
219
|
+
| `runner` | none | Runs `bash`, `read`, `edit` and `write` for every conversation but the owners' own (their direct messages, and agent rooms only owners reach) in a container with no network and no credential: `{ driver: "docker", image }` on a plain host, or `{ driver: "socket", socket }` beside a sidecar, with optional limits. There those tools need `minTier` (default `member`), a held command of a speaker below the owner is on a card that is theirs alone, and a temp knight works in its parent's workspace; see the [plugin guide](docs/plugins.md#runner-a-container-for-the-shell-and-files-of-conversations-with-other-people) |
|
|
216
220
|
| `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 |
|
|
217
221
|
|
|
218
222
|
Work no person is waiting on (a foreign webhook's post in an agent's channel, a `message_agent` call that names no conversation, an agent's opening task, the error reports) lands where it always did, unless the optional `routing` block says otherwise.
|
|
@@ -291,9 +295,9 @@ pi-roundtable runs one assistant for one owner.
|
|
|
291
295
|
- **Approvals.** A held call is approved only by the speaker whose turn held it, at a tier that still holds the call, or, in a shared conversation, by an owner, on its card or by a confirming message. In a private conversation nobody else may, and a call above the speaker's tier is not approved there.
|
|
292
296
|
- **Conversations.** In Discord an agent's channel and a group room are shared: everyone who writes there adds to one conversation the agent reads. A web chat conversation belongs to the person who opened it: in the web chat only they may read it, write in it, or answer its prompts, but the owner can read it through the owner console ([pi-roundtable-web](packages/web)), and the operator through the database and the data directory.
|
|
293
297
|
- **Memory isolation.** Memory follows the principal, not owner tier: a private conversation's person, or the current speaker in a shared room. Link accounts to share one person's memory across Discord and web. In shared requests and summaries, memory-tool and memory-loaded-worker exchanges (arguments and results together) are hidden from other speakers, and earlier reasoning is removed with provider-aware handling. Other tools' arguments and public assistant replies remain public, even if the model repeats private memory there; this is not general secret-flow prevention. Third-party compactors must use `privateCompaction` before summarizing shared history. `claude-bridge` shared turns refuse when raw reader records, including compacted turns, show another reader's private memory (even prompt-only memory and its reasoning), or an exchange is hidden from the current reader. A turn with no private memory does not block other readers, and disabling future memory does not bypass prior private history; admitting other people only warns at boot and in doctor. SYSTEM counts as primary owner for this core guard alone, so it can read and publicly repeat the owner's retained exchanges/reasoning; pre-0.9 untagged built-in memory results before the first scope record retain owner attribution. Sandbox party-wide prompt blocks must explicitly use `memory.visibility: "shared"`, and private turns require worker capabilities. Bridge replays unfiltered history outside these projections; see the [exact rule and remaining risk](docs/migration-0.9.md#claude-bridge-guard).
|
|
294
|
-
- **The host shell.** An agent's shell runs as the host's user. Holds keep risky commands behind a card; they are not a sandbox. The shell gets only part of the host's environment (the paths, user, locale, terminal, `TMPDIR` and proxies, plus what `shellEnv` adds), so the bot tokens, model logins, `GH_TOKEN`, `DATABASE_URL` and keys the host holds stay in the host process; printing the environment, reading a secret file such as `.env` or `~/.ssh/*`, and `gh auth token` are held as `shell.secret-read`, which yolo mode always cards; a secret's value in a tool's output is replaced with `****`. This stops casual and accidental leaks, not a determined command run as the same user, which can read `/proc/<host pid>/environ` and any file that user can. To keep secrets from the agents, run their shells under a dedicated account without the `docker` group (membership in it equals root), or use [pi-roundtable-sandbox](packages/sandbox).
|
|
298
|
+
- **The host shell.** An agent's shell runs as the host's user. Holds keep risky commands behind a card; they are not a sandbox. The shell gets only part of the host's environment (the paths, user, locale, terminal, `TMPDIR` and proxies, plus what `shellEnv` adds), so the bot tokens, model logins, `GH_TOKEN`, `DATABASE_URL` and keys the host holds stay in the host process; printing the environment, reading a secret file such as `.env` or `~/.ssh/*`, and `gh auth token` are held as `shell.secret-read`, which yolo mode always cards; a secret's value in a tool's output is replaced with `****`. This stops casual and accidental leaks, not a determined command run as the same user, which can read `/proc/<host pid>/environ` and any file that user can. To keep secrets from the agents, run their shells under a dedicated account without the `docker` group (membership in it equals root), or use [pi-roundtable-sandbox](packages/sandbox). With [`runner`](docs/plugins.md#runner-a-container-for-the-shell-and-files-of-conversations-with-other-people) set, every conversation but the owners' own (their direct messages, and agent rooms only owners reach) runs these tools in a container instead: no network, no credential, none of the host's environment, an account and a workspace of its own per conversation, no directory shared between accounts, and nothing left running between calls; a command's text is not in its arguments, though the arguments of the programs it starts are visible to the other accounts while they run. The runner limits what a command can reach, not what the model may ask for; the other tools still run in the host process.
|
|
295
299
|
- **Model credentials.** Every turn, whoever speaks, runs on the host's model login and is billed to it. Per-person credentials are planned for a later release.
|
|
296
|
-
- **Data.** Conversations, memory, and
|
|
300
|
+
- **Data.** Conversations, memory, schedules, and polls (with the display names of their voters, kept 30 days after a poll ends) sit unencrypted in PostgreSQL and the data directory.
|
|
297
301
|
|
|
298
302
|
## Upgrading
|
|
299
303
|
|
package/README.zh-TW.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
一個建立在 [Pi](https://github.com/earendil-works/pi) 上的智慧體(agent)伺服器,可以透過 Discord 或網頁聊天跟它對話。
|
|
9
9
|
在 Discord 裡,每個 AI 智慧體在你的伺服器有自己的頻道和對話,共用工具與記憶。
|
|
10
|
+
智慧體可以在頻道裡發 Discord 投票,投票結束後會開一個新回合接手結果。
|
|
10
11
|
在網頁上,經你的 OpenID Connect 供應商登入的人,透過 [pi-roundtable-webchat](packages/webchat) 在各自的私人對話裡跟騎士聊天。
|
|
11
12
|
想加功能,就用 TypeScript 寫外掛(plugin)。
|
|
12
13
|
|
|
@@ -207,6 +208,9 @@ export default {
|
|
|
207
208
|
| `coordinator` | `agents` 的第一位 | 沒有 `discord.guild` 時,接手主人一般請求的 agent,不能被封存。有 `discord.guild` 時設它會出錯:由入口頻道的 agent 協調 |
|
|
208
209
|
| `team.id`、`team.formerIds` | `discord.guild` 的 id,否則 `local`;無 | 團隊資料列存放用的 id(與 guild 無關),以及先前用過的 id:其資料列每次啟動時搬到新 id,沒有 Discord 頻道時一併清掉頻道 id |
|
|
209
210
|
| `skills` | 有 `agents` 時開啟 | 技能 addon;沒有 `discord` 時,只有 `agents` 列了 agent 才會開 |
|
|
211
|
+
| `preset` | 無 | `"shared"` 給許多人一起使用的主機:必須設定 `runner`(沒設就無法啟動),除了主人自己的對話,其餘對話的 `bash`、`read`、`edit`、`write` 都在 runner 裡執行,persona 的選擇也可以列出它們;同時設定 `imageTool: "selected"`,並把 `generate_image`、`poll_create`、`poll_end` 的層級設為 `member`。你自己寫的設定優先,選擇仍須逐一列出工具,`roundtable doctor` 會印出 preset 設了哪些值;見[外掛指南](docs/plugins.md#shared-hosts-preset-shared) |
|
|
212
|
+
| `imageTool` | `"every-selection"` | 設為 `"selected"` 時,只有在 `tools` 列出 `generate_image` 的選擇才提供它。仍須設定圖片供應者,且發言者須有使用權限。 |
|
|
213
|
+
| `runner` | 無 | 除了主人自己的對話,其餘對話的 `bash`、`read`、`edit`、`write` 都改在一個不連網、不帶任何憑證的容器裡執行:一般主機用 `{ driver: "docker", image }`,搭配 sidecar 時用 `{ driver: "socket", socket }`,限制可另外設定。在容器裡這四個工具需要 `minTier`(預設 `member`);非主人提出而被暫緩的指令,只有提出的人能核准;臨時騎士和發起它的 agent 共用工作區;見[外掛指南](docs/plugins.md#runner-a-container-for-the-shell-and-files-of-conversations-with-other-people) |
|
|
210
214
|
| `helpers` | 每位騎士 4 位、全站 12 位,結束 24 小時後封存 | 臨時騎士:騎士用 `helper_create` 為單一任務做出、完成後用 `helper_end` 清掉的幫手。設定為 `{ perParent, perHost, archiveFinishedAfterHours }`;`false` 兩個工具都不提供 |
|
|
211
215
|
|
|
212
216
|
沒有人在等的工作(外部 webhook 在 agent 頻道的貼文、沒指定對話的 `message_agent` 呼叫、agent 的開場任務、錯誤回報)照舊落在原本的地方,除非選填的 `routing` 區塊另有指定。
|
|
@@ -274,9 +278,9 @@ pi-roundtable 為一位擁有者執行騎士。
|
|
|
274
278
|
- **核准。** 暫緩的呼叫只由當輪暫緩它的發言者核准,而且當下 tier 仍要足夠;在共用對話裡,擁有者也可以在卡片上或用確認訊息核准。私人對話裡別人都不能核准,高於發言者 tier 的呼叫在那裡也不會被核准。
|
|
275
279
|
- **對話。** Discord 裡智慧體的頻道和群組房間是共用的:在那裡發言的每個人,都會寫進智慧體讀取的同一段對話。網頁聊天的對話屬於開啟它的人:在網頁聊天裡只有開啟者本人能讀、能發言、能回答它的提問,但擁有者可以透過擁有者主控台([pi-roundtable-web](packages/web))讀取,營運者也能從資料庫和資料目錄讀到。
|
|
276
280
|
- **記憶隔離。** 記憶依 principal 分開,不依擁有者 tier 判斷。私人對話讀本人的,共用對話讀當輪發言者的;連結 Discord 與網頁身分後,同一個人共用一份記憶。在共用對話送給模型的請求和摘要裡,記憶工具與載入記憶的 worker 的呼叫(參數和結果成對)會對其他發言者隱藏,先前回合的 reasoning 則依 provider 清除。其他工具的參數和公開的騎士回覆仍是公開內容,即使模型在裡面重述私人記憶;這不是一般的秘密流向防護。第三方摘要器必須先使用 `privateCompaction`,才能摘要共用歷史。`claude-bridge` 的共用回合只在原始讀者紀錄(含已壓縮的回合)顯示另一位讀者的私人記憶(連只放進 prompt 的記憶與其 reasoning 也算),或某個呼叫已對當前讀者隱藏時才被拒絕。沒有私人記憶的回合不會擋其他讀者,關掉之後的記憶也繞不過先前的私人歷史;開放其他人進來只會在開機和 doctor 裡警告。SYSTEM 只在這項核心防護裡算作主要擁有者,所以它能讀取並公開重述擁有者保留的呼叫與 reasoning;0.9 之前、第一筆範圍紀錄之前未標記的內建記憶結果,仍歸屬擁有者。沙盒的全場共用 prompt 區塊必須明確使用 `memory.visibility: "shared"`,私人回合需要 worker 能力。Bridge 會在這些投影之外重播未過濾的歷史;見[確切規則與剩餘風險](docs/migration-0.9.md#claude-bridge-guard)。
|
|
277
|
-
- **主機上的 shell。** 智慧體的 shell 以主機的使用者身分執行。暫緩只是把有風險的指令擋在卡片後面,不是沙箱。shell 只拿到主機環境變數的一部分(路徑、使用者、語系、終端機、`TMPDIR`、proxy,加上 `shellEnv` 額外給的),所以主機持有的 `GH_TOKEN`、bot token、模型登入、`DATABASE_URL` 和金鑰都留在主機行程裡;印出環境變數、讀取 `.env` 或 `~/.ssh/*` 這類秘密檔案、`gh auth token` 會以 `shell.secret-read` 暫緩,yolo 模式一律出卡片;工具輸出裡的秘密值會換成 `****`。這擋得住隨手和意外的外洩,擋不住以同一個使用者刻意執行的指令:它讀得到 `/proc/<主機 pid>/environ`,也讀得到那個使用者能讀的任何檔案。要讓智慧體碰不到秘密,請讓它們的 shell 以不在 `docker` 群組裡的專用帳號執行(加入這個群組等同 root),或改用 [pi-roundtable-sandbox](packages/sandbox)
|
|
281
|
+
- **主機上的 shell。** 智慧體的 shell 以主機的使用者身分執行。暫緩只是把有風險的指令擋在卡片後面,不是沙箱。shell 只拿到主機環境變數的一部分(路徑、使用者、語系、終端機、`TMPDIR`、proxy,加上 `shellEnv` 額外給的),所以主機持有的 `GH_TOKEN`、bot token、模型登入、`DATABASE_URL` 和金鑰都留在主機行程裡;印出環境變數、讀取 `.env` 或 `~/.ssh/*` 這類秘密檔案、`gh auth token` 會以 `shell.secret-read` 暫緩,yolo 模式一律出卡片;工具輸出裡的秘密值會換成 `****`。這擋得住隨手和意外的外洩,擋不住以同一個使用者刻意執行的指令:它讀得到 `/proc/<主機 pid>/environ`,也讀得到那個使用者能讀的任何檔案。要讓智慧體碰不到秘密,請讓它們的 shell 以不在 `docker` 群組裡的專用帳號執行(加入這個群組等同 root),或改用 [pi-roundtable-sandbox](packages/sandbox)。設定 [`runner`](docs/plugins.md#runner-a-container-for-the-shell-and-files-of-conversations-with-other-people) 之後,除了主人自己的對話,其餘對話都改在容器裡執行這些工具:不連網、沒有憑證、拿不到主機的任何環境變數,每個對話有自己的帳號和工作區,呼叫結束後不留任何行程。runner 限制的是指令碰得到什麼,不是模型能要求什麼;其他工具仍在主機行程裡執行。
|
|
278
282
|
- **模型憑證。** 每一輪不論誰發言,都用主機的模型登入執行、由它計費。每個人自己的憑證預計在之後的版本加入。
|
|
279
|
-
- **資料。**
|
|
283
|
+
- **資料。** 對話、記憶、排程和投票(含投票者的顯示名稱,投票結束後保留 30 天)以未加密的形式存在 PostgreSQL 和資料目錄裡。
|
|
280
284
|
|
|
281
285
|
## 升級
|
|
282
286
|
|
package/docs/plugins.md
CHANGED
|
@@ -886,7 +886,7 @@ Transient `SessionContext.runTask` tasks return only text and cannot attach to t
|
|
|
886
886
|
|
|
887
887
|
The model attaches a file it already has on disk with the core's `attach_file({ path, filename? })`. A session with a workspace (`SessionContext.workspace`, an agent's) registers it; the path must resolve, symlinks followed, inside the workspace or the scratch dir, a relative path resolves in the workspace, and `filename` defaults to the path's base name. It queues the file with `attachReplyFile`, so `REPLY_FILE_LIMITS` apply and a surface without reply files refuses it as a tool error; its result tells the model the file will appear with its reply. It holds nothing, since it only posts in the channel the turn answers in, and its tier defaults to the owner, like any tool the core's table does not name.
|
|
888
888
|
|
|
889
|
-
With an `images` provider, agent and owner sessions also offer the core's `generate_image({ prompt, reference_paths? })`, which draws a new picture from a description (`prompt`, at most 4,000 characters). `reference_paths` lists up to 4 local images, checked like `attach_file` paths (inside the workspace or the scratch dir, symlinks followed, regular files only), each a PNG, JPEG, WebP or GIF by content, at most 20 MiB each and 40 MiB together; a refused reference is a tool error before the provider is called. It passes them to the provider as `ReferenceImage`s with the turn's signal, saves the picture under `<scratch dir or workspace>/drawings/generated-<ISO time>.<ext>`, and attaches it with `attachReplyFile`; when it cannot be attached the file is kept and the result says so. The result names the saved path, never the bytes, so the model can send it on or edit it. A provider error, such as a refusal, is a tool error carrying the provider's message. It holds nothing, and its tier defaults to the owner; `toolTiers` lowers it. The agents' prompt mentions it only when it is offered.
|
|
889
|
+
With an `images` provider, agent and owner sessions also offer the core's `generate_image({ prompt, reference_paths? })`, which draws a new picture from a description (`prompt`, at most 4,000 characters). `reference_paths` lists up to 4 local images, checked like `attach_file` paths (inside the workspace or the scratch dir, symlinks followed, regular files only), each a PNG, JPEG, WebP or GIF by content, at most 20 MiB each and 40 MiB together; a refused reference is a tool error before the provider is called. It passes them to the provider as `ReferenceImage`s with the turn's signal, saves the picture under `<scratch dir or workspace>/drawings/generated-<ISO time>.<ext>`, and attaches it with `attachReplyFile`; when it cannot be attached the file is kept and the result says so. The result names the saved path, never the bytes, so the model can send it on or edit it. A provider error, such as a refusal, is a tool error carrying the provider's message. It holds nothing, and its tier defaults to the owner; `toolTiers` lowers it. Set `imageTool: "selected"` to offer it only when a selection explicitly lists `generate_image` in `tools`; a tool group alone does not opt in. The agents' prompt mentions it only when it is offered.
|
|
890
890
|
The Discord tools that upload, `discord_send_message` and `discord_edit_message`, take each file as exactly one of `path` (a local file, read when the call runs, with the same roots; `filename` defaults to its base name) or `dataBase64` with a `filename`, at most 8 MiB in all. A session without a workspace takes only `dataBase64`, and so does remote MCP, whose schemas stay inline only. A path outside the roots, a missing file, or a directory is a tool error naming the path. A held call's card (`approvalCard(call, workspace?, limits?, parameters?)`) lists each file it sends by path with the file's size now, never its bytes, and shows an input within `limits.totalChars` (1,500) whole; a longer input has its string values cut, longest first and never below `limits.valueChars` (200), to their start plus `… [N chars]` (N in code points) until it fits, and if it still does not, the rest is dropped and the keys no longer shown are listed. `approvalDetails(call, workspace?)` gives the same call as data (`{ action, tool, input, files? }`, the whole input, files as `{ path, bytes? }`); the gate passes it to `Prompts.confirm` as `details`, for a surface that is not text.
|
|
891
891
|
|
|
892
892
|
Given `parameters`, the tool's JSON Schema, `approvalCard` shows the input as fields instead of JSON, and the gate does so for every tool the session lists (it reads the schema from the tool list of the Pi session): one line or block per argument, in the order the schema declares its properties (an argument the schema does not list follows them, its name in code format so it cannot pass for a declared label), labelled by the property's `title` or else its name, absent arguments left out; only an argument's own properties count, so one named `toString` or `constructor` is shown with its value. A short value sits on the line (`**label**: value`, with markdown, links and `@everyone`/`@here` in it escaped so nothing in a model-written value formats or mentions anyone); a string with a line break or over 100 characters, and a nested value as compact JSON, go in a fenced block that keeps their line breaks and in which nothing is markdown (`\r`, `\u2028`, `\u2029` and `\u0085` are line breaks too); booleans, numbers and enum values show as they are; an array of scalars is joined with commas, unless an item is empty, shows nothing, holds a comma and a space or a line break, in which case the array is shown as JSON; a string that is empty or shows nothing (white space, zero-width characters) is written out as a quoted, escaped text, such as `""`, so the person sees it is there. `limits` apply as they do to the JSON: a long string is cut, the longest first and never below `limits.valueChars`, marked `… [N chars]`, and when that is not enough the last fields are dropped and their labels listed. A tool with no schema, or one that lists no properties (and a card a plugin builds without `parameters`, such as the coding desk's), shows the JSON as before. The card is text, so every surface that shows `message` shows the fields; `approvalDetails` is unchanged.
|
|
@@ -1108,7 +1108,7 @@ Every held call carries its **hold classes**: ids of the form `<rule>.<class>` t
|
|
|
1108
1108
|
- the call names no approvers and its card is not [the speaker's alone](#a-hold-that-makes-its-card-the-speakers-alone);
|
|
1109
1109
|
- the call has hold classes (a call held before this existed, or by a check without classes, is unknown and always asks), and none of them is carded.
|
|
1110
1110
|
|
|
1111
|
-
A class is carded when it is listed in `autonomy.yolo.card`, when its rule's name is, when it is in `YOLO_CARDED_SHELL_CLASSES` (`pi-roundtable/kit`) and `autonomy.yolo.allow` does not list it, or when it is a rule's bare name (the call is unclassed) and `autonomy.yolo.allow` does not list that name. A class in both lists stays carded. Everything else is approved. So a plugin rule that reports no classes, such as Merlin's `google`, `discord` and `mc` rules or a tool's own `tool:repo_push` hold, asks on a card in yolo conversations until the config allows it by name.
|
|
1111
|
+
A class is carded when it is listed in `autonomy.yolo.card`, when its rule's name is, when it is in `YOLO_CARDED_SHELL_CLASSES` (`pi-roundtable/kit`) and `autonomy.yolo.allow` does not list it, or when it is a rule's bare name (the call is unclassed) and `autonomy.yolo.allow` does not list that name. A class of the [runner's](#runner-a-container-for-the-shell-and-files-of-conversations-with-other-people) `runner-shell` rule is judged both as itself and as the shell class it stands for (`runner-shell.rm` as `shell.rm`), so an owner's runner commands in a yolo conversation go as the host's would, and the same `allow` and `card` entries reach them; a runner hold of a speaker below the owner is the speaker's alone, which yolo never answers. A class in both lists stays carded. Everything else is approved. So a plugin rule that reports no classes, such as Merlin's `google`, `discord` and `mc` rules or a tool's own `tool:repo_push` hold, asks on a card in yolo conversations until the config allows it by name.
|
|
1112
1112
|
|
|
1113
1113
|
Yolo approves only where there is a turn: a call decided outside one (none of the host's own paths does) is held as before. It covers every owner-attributed turn in that conversation, including turns another agent starts with `message_agent` and turns a schedule starts for an owner's conversation; only turns the host's own principal speaks (webhooks, reports) always ask. Saving a precheck script through a schedule tool is classed by every held call the script makes, so yolo approves the save only if it would approve each of them (an inner call that is unclassed counts as its rule's bare name, and so does one whose arguments the script computes, besides its classes; a computed call of a classed tool counts as the bare name of its own rules, not of `precheck-scripts`); `autonomy.yolo.allow` listing `precheck-scripts` does not cover them, and `autonomy.yolo.card` listing it cards every such save. A redirect or `tee` target the shell cannot expand, such as `> $(printf /dev/sda)` or `> $DISK`, is `shell.disk`. The same holds for the targets of `>|`, `>& file`, `<>` and a `tee` behind a path or wrapper. A command substitution inside double quotes is judged like an unquoted one (inside single quotes it is text), so substitutions in a redirect or `tee` target card under yolo; this is a known cost of failing closed.
|
|
1114
1114
|
|
|
@@ -1139,6 +1139,7 @@ The mode is read when the card is asked for, so a toggle applies to the next car
|
|
|
1139
1139
|
#### The shell rule
|
|
1140
1140
|
|
|
1141
1141
|
`shellHoldRule` in `pi-roundtable/kit` judges the agents' `bash`, `write`, `edit` and `read` calls (a `read` only for a secret file); the agent server links it, and a session without a workspace has no shell.
|
|
1142
|
+
A session the [runner](#runner-a-container-for-the-shell-and-files-of-conversations-with-other-people) serves is judged first by the core's `runner-shell` rule: the same judgement with the runner's workspace and scratch dir as the roots, under classes named `runner-shell.<class>`, on a card that is the speaker's alone when the speaker is not an owner. What follows describes the host's shell; the scratch dir below is not the runner's.
|
|
1142
1143
|
Its scratch roots are the shared workspace (`HoldContext.workspace`) and the scratch dir (`HoldContext.scratchDir`).
|
|
1143
1144
|
The scratch dir is the config's `scratchDir`, by default `<os temp dir>/<discord.rootCommand>-scratch` (such as `/tmp/roundtable-scratch`); the agent server creates it with mode 0700 at startup and refuses one that is a symlink or another user's, and the agents' `bash` runs with `TMPDIR` pointing to it, so tools that read `TMPDIR` and GNU `mktemp` write there. macOS's BSD `mktemp` ignores `TMPDIR` for a bare `mktemp`; `mktemp -p "$TMPDIR"` works with both, and the agents' prompt tells them to use it.
|
|
1144
1145
|
`AgentSessions.scratchDir` carries it to a runtime, and the agents' prompt tells them to write temporary files there, and to show a file with `attach_file` or a `discord_send_message` file `path` rather than reading an image or base64-encoding it.
|
|
@@ -1228,7 +1229,7 @@ A host composed by hand sets the same object as `RoundtableOptions.environment.s
|
|
|
1228
1229
|
|
|
1229
1230
|
Before a tool's result enters the model's context, `maskSecrets` replaces each value of a host variable whose name `SECRET_NAME` matches (`TOKEN`, `SECRET`, `KEY`, `PASS`, `PASSWORD`, `DATABASE_URL`, `JWT`, `CREDENTIAL`, any case) and that is at least 8 characters with `****`; every session runs `secretMaskExtension()` after the other extensions' `tool_result` handlers.
|
|
1230
1231
|
|
|
1231
|
-
None of this is a sandbox. The shell runs as the host's user, so a determined command reads what that user can: `/proc/<host pid>/environ`, a file the rule does not know, a token in a program's memory. The whitelist, the `shell.secret-read` hold and the mask stop casual and accidental leaks. To keep secrets from the agents, run their shells under a dedicated account without the `docker` group (membership in it equals root),
|
|
1232
|
+
None of this is a sandbox. The shell runs as the host's user, so a determined command reads what that user can: `/proc/<host pid>/environ`, a file the rule does not know, a token in a program's memory. The whitelist, the `shell.secret-read` hold and the mask stop casual and accidental leaks. To keep secrets from the agents, run their shells under a dedicated account without the `docker` group (membership in it equals root), use the sandbox package, or set [`runner`](#runner-a-container-for-the-shell-and-files-of-conversations-with-other-people), whose commands get none of this environment: only `PATH`, `HOME`, `TMPDIR`, `LANG` and `TERM`, in a container with no network, and `shellEnv` does not reach them. The owners' own conversations (direct messages, and agent rooms only owners reach) still run on the host.
|
|
1232
1233
|
|
|
1233
1234
|
### `PROMPTS`: prompt texts the owner edits
|
|
1234
1235
|
|
|
@@ -1723,6 +1724,7 @@ An unknown or misspelled slot stops startup with an error listing the valid name
|
|
|
1723
1724
|
| `images` | No drawing; no session offers `generate_image` | `async (prompt, references, options?) => bytes` returning PNG, JPEG, WebP or GIF bytes; `options.signal` aborts with the turn that asked |
|
|
1724
1725
|
| `runtime` | None: the runtime plugin builds the Pi runtime itself | `(deps) => runtime`, an [`AgentRuntime`](#the-runtime-slot-replace-pi) that runs every conversation |
|
|
1725
1726
|
|
|
1727
|
+
The host setting `imageTool` defaults to `"every-selection"`; `"selected"` requires each selection to opt in.
|
|
1726
1728
|
A filled `images` slot powers the core's [`generate_image`](#attach-files-to-the-agents-reply) tool.
|
|
1727
1729
|
`AgentTeam.redrawAvatar` and the `AvatarMode` type are deprecated, still work (with an image provider), and are removed in 1.0; use `AgentTeam.dress`.
|
|
1728
1730
|
Agents' avatars are composed characters since 0.23 and do not use it; drawing them with the slot, `AvatarStudio.draw`, `edit`, `fallback` and `canDraw`, `config.avatar` (a warning is logged when it is set) and `AgentSeed.avatarPrompt` are deprecated, ignored, and removed in 1.0.
|
|
@@ -2276,14 +2278,154 @@ The agent server stays, with its team, rooms, memory, schedules and the tools pl
|
|
|
2276
2278
|
Plugins read the mode as `context.env.agentTools` (`"full"` or `"chat-only"`), and `ResolvedConfig.agentTools` and `RoundtableOptions.environment.agentTools` carry it for a host that builds its own options.
|
|
2277
2279
|
With `"chat-only"`:
|
|
2278
2280
|
|
|
2279
|
-
- No turn is offered `bash`, `read`, `edit` or `write`: the agent team's selection leaves them out, an agent's system prompt says it has no shell, file tools or workspace, its sessions get no workspace (no `attach_file`, no shell scratch dir) and its held-action gate judges none.
|
|
2281
|
+
- No turn on the host is offered `bash`, `read`, `edit` or `write`: the agent team's selection leaves them out, an agent's system prompt says it has no shell, file tools or workspace, its sessions get no workspace (no `attach_file`, no shell scratch dir) and its held-action gate judges none. With [`runner`](#runner-a-container-for-the-shell-and-files-of-conversations-with-other-people) set, a persona's turns are the exception: a `selection` that names the four tools runs them in the runner.
|
|
2280
2282
|
- The host refuses to start with a plugin that declares `hostAccess: true` (`pi-roundtable-coding` does), with a `ConfigError` that names the plugin, and with a plugin whose `agentSelection` names one of the four tools. `roundtable doctor` prints `agent tools: chat-only (no shell, file or workspace tools)` and fails for a registered `hostAccess` plugin; with the full tools it prints `full`.
|
|
2281
|
-
- A selection that names one of the four tools anyway, whatever built it (a turn run through `context.turns` with its own `selection`, a plugin that grants tools at run time), is refused at the one place where `SessionFactory` turns a selection into active tools (`toolsFor` and `taskTools`): the turn fails closed with a `ConfigError`, which is logged as the turn's failure, and no session runs it.
|
|
2282
|
-
- `pi-roundtable-webchat` stops at start when a persona's own `selection` names one of the four tools.
|
|
2283
|
+
- A selection that names one of the four tools anyway, whatever built it (a turn run through `context.turns` with its own `selection`, a plugin that grants tools at run time), is refused at the one place where `SessionFactory` turns a selection into active tools (`toolsFor` and `taskTools`): the turn fails closed with a `ConfigError`, which is logged as the turn's failure, and no session runs it. A session the runner serves is not refused there; an agent's never is one on a chat-only host.
|
|
2284
|
+
- `pi-roundtable-webchat` stops at start when a persona's own `selection` names one of the four tools, unless `runner` is set.
|
|
2283
2285
|
|
|
2284
2286
|
The mode is the host's decision, not a permission: it does not change who may use which tool (`toolTiers`), and an MCP server or other plugin that reaches the machine in a way it does not declare is outside what it can see.
|
|
2285
2287
|
A plugin whose tools reach the host declares `hostAccess`, so that the one flag decides.
|
|
2286
2288
|
|
|
2289
|
+
### Runner: a container for the shell and files of conversations with other people
|
|
2290
|
+
|
|
2291
|
+
By default the shell and file tools (`bash`, `read`, `edit`, `write`) run on the host, as the host's user.
|
|
2292
|
+
That suits a host only its owner talks to; once other people speak with the agents, their requests would run commands on the owner's machine.
|
|
2293
|
+
`runner` moves those tools into a container that holds no credential and reaches no network:
|
|
2294
|
+
|
|
2295
|
+
```ts
|
|
2296
|
+
export default defineRoundtable({
|
|
2297
|
+
// ...
|
|
2298
|
+
runner: { driver: "docker", image: "pi-roundtable-runner" },
|
|
2299
|
+
});
|
|
2300
|
+
```
|
|
2301
|
+
|
|
2302
|
+
**Which sessions it serves.** With `runner` set, every session runs its four tools in the runner except the owners' own conversations, which keep running them on the host: the owner's direct messages (kind `"owner"`), and an agent's conversation only the owners reach (`AgentSessions.ownersOnly`).
|
|
2303
|
+
On a full-tools host the agents' sessions are served too, all but those the owners alone reach:
|
|
2304
|
+
|
|
2305
|
+
| An agent's conversation | Where its tools run |
|
|
2306
|
+
| --- | --- |
|
|
2307
|
+
| Its own room (`<surface>:agent.<name>`) on a surface that declares its agent rooms the owners' alone (`agentRoomsOwnersOnly: true`), such as the web app, with one owner or several | the host |
|
|
2308
|
+
| A temp knight's room on such a surface, while the conversation it was made in is its parent's room there | the host |
|
|
2309
|
+
| Its room on any other surface of rooms, which may let others in | the runner |
|
|
2310
|
+
| Its Discord channel and threads there (who else reads and writes in them is the server's to say) | the runner |
|
|
2311
|
+
| A group's room or seat, where several agents talk | the runner |
|
|
2312
|
+
| A temp knight's room when it was made in a Discord channel or a group's place, and every Discord thread of a temp knight | the runner |
|
|
2313
|
+
|
|
2314
|
+
An agent's prompt says where its tools run in each of them.
|
|
2315
|
+
On the host a speaker below the owner still gets none of the four tools, as `toolTiers` gives them to owners.
|
|
2316
|
+
On a chat-only host (`agentServer: { tools: "chat-only" }`) the agents keep no shell, and the start-time refusal of an `agentSelection` that names one of the four tools stays; a persona's `selection` may name them, and its turns run them in the runner.
|
|
2317
|
+
Without `runner` nothing changes.
|
|
2318
|
+
|
|
2319
|
+
**What such a session gets.**
|
|
2320
|
+
|
|
2321
|
+
- `bash`, `read`, `edit` and `write` built from Pi's own tools, with every operation sent to the runner. The working directory is the conversation's workspace, `/roundtable-runner/ws/<conversation id>`, the id taken from the conversation's home channel: an agent's own channel for all of its conversations, the room for anyone else's. A task the turn hands to a worker uses the same workspace. A temp knight shares its parent's, as it shares the workspace on the host: in its thread, its room and every other conversation of its own it works in the workspace of the parent's turn that made it (`AgentSessions.runnerHome`), so it sees and changes the files that turn left. Once that origin is gone (the agent or group whose conversation it is, or the parent, is archived or deleted, though a Discord channel's row is kept) it works in a workspace of its own from its next turn on: a session already open is made anew there with its history, and what it held in the old workspace is dropped. Other conversations never see these files.
|
|
2322
|
+
- Each command runs as the conversation's own account in the container, with only `PATH`, `HOME`, `TMPDIR` (the workspace's `.tmp`), `LANG` and `TERM` set, and stops at `commandTimeoutMs` or at `maxOutputBytes` of output; whatever it left running is killed when the call returns. A tool call's own `timeout` is capped by `commandTimeoutMs`.
|
|
2323
|
+
- The command's text reaches `bash` through a pipe, never as an argument, so no other account reads it in `/proc/<pid>/cmdline` while it runs. The programs it starts are another matter: the arguments of `python3 -c '...'` or `grep secret` are theirs, and every account can read them there while they run.
|
|
2324
|
+
- No directory in the container is writable by every account, where one conversation could leave something for another: `/tmp` is root's (each conversation's `TMPDIR` is its own), there is no `/dev/shm`, and the message queues are root's. So POSIX shared memory is not there, and Python's `multiprocessing` cannot make its locks.
|
|
2325
|
+
- An output too long to show in full (Pi shows its last 2,000 lines or 50 KB) is kept whole in the workspace's `.tmp`, and the result names that path, which `read` reaches; when the workspace cannot take it, the result says it was not kept. Nothing of it stays on the host.
|
|
2326
|
+
- Pi's `grep`, `find`, `ls` and `powershell` would read the host's disk or run its shell, so such a session does not have them: a selection that names one is refused with a `ConfigError`. `bash` runs `grep`, `find` and `ls` in the runner.
|
|
2327
|
+
- `SessionContext.workspace` and `ToolTurn.workspace` carry the runner's paths and `files` (`WorkspaceFiles`), through which the core's `attach_file`, `generate_image` (its saved picture and its `reference_paths`), the Discord tools' file `path` and pi-roundtable-drawing's saved pictures find, read and write files. Nothing reads or writes a runner path on the host's disk, and the bot never mounts the workspaces. A plugin tool that saves a file for the model does the same: with `files` set, write through `files.write(path, data)`.
|
|
2328
|
+
- A held call's card names the files it sends without their sizes, since the host's disk knows nothing of them.
|
|
2329
|
+
- In those sessions the four tools need `minTier` (default `"member"`), whatever `toolTiers` says of them on the host; the turn's tools and the held-action gate read the same tiers, so a member who may run a command may also approve its held call. Every other tool keeps its tier.
|
|
2330
|
+
- A line at the end of the system prompt says where the tools run, where the workspace and the scratch dir are, that there is no network, how long a command may run, and how long files are kept. The agents' own prompt says their tools run in an isolated container rather than on the host as its user.
|
|
2331
|
+
|
|
2332
|
+
**Holds.** The runner's plugin links the core's `runner-shell` rule, which judges only the calls of sessions the runner serves (`HoldContext.runner`).
|
|
2333
|
+
It holds what [the shell rule](#the-shell-rule) (`shellHoldRuleFor()`, every push held) holds, with the runner's workspace and scratch dir as the scratch roots, worded "in the runner" rather than "on the host", under classes of its own name (`runner-shell.rm`, `runner-shell.write`, ...).
|
|
2334
|
+
A call raised in a turn of a speaker below the owner is on a card that is theirs alone (`approval: "speaker"`): in a room with several people only whoever asked for the command answers it, and yolo mode never approves it.
|
|
2335
|
+
An owner's call is on the card a host shell hold has, which any owner may answer, and [yolo mode](#hold-classes-and-yolo-mode) decides it as it decides a host shell call: each `runner-shell.<class>` is judged as `shell.<class>`, so writes outside the workspace and plain pushes are approved, `YOLO_CARDED_SHELL_CLASSES` are carded, and `autonomy.yolo.allow` and `autonomy.yolo.card` reach it through the shell ids and the rule name `shell` as well as through its own.
|
|
2336
|
+
A host's own shell rules still see a call that `runner-shell` lets through.
|
|
2337
|
+
|
|
2338
|
+
**Settings.**
|
|
2339
|
+
|
|
2340
|
+
| Key | Default | What it is |
|
|
2341
|
+
| --- | --- | --- |
|
|
2342
|
+
| `driver` | none | `"docker"`: the host runs the container itself. `"socket"`: a sidecar runs it and the host reaches it through a unix socket |
|
|
2343
|
+
| `image` | none | With `"docker"`, the runner image, built once from the installed package (below) |
|
|
2344
|
+
| `name` | `roundtable-runner-<hash of dataDir>` | With `"docker"`, the container's name; its workspaces live in the volume `<name>-ws` |
|
|
2345
|
+
| `memoryMb`, `cpus`, `pids` | `1024`, `1`, `256` | With `"docker"`, the container's limits |
|
|
2346
|
+
| `socket` | none | With `"socket"`, the absolute path of the runner's socket |
|
|
2347
|
+
| `commandTimeoutMs` | `120000` | A command's time limit, at most 900,000 |
|
|
2348
|
+
| `maxOutputBytes` | 1 MiB | A command's output limit; past it the command is stopped and the result says it was cut |
|
|
2349
|
+
| `maxFileBytes` | 10 MiB | A file operation's limit |
|
|
2350
|
+
| `keepDays` | `30` | Days a workspace is kept after its last use |
|
|
2351
|
+
| `minTier` | `"member"` | The tier the four tools need in a session the runner serves |
|
|
2352
|
+
|
|
2353
|
+
**The docker driver** suits a plain host, macOS with Docker Desktop included.
|
|
2354
|
+
Build the image once from the installed package (the release publishes none; `runner/Dockerfile` lists what it preinstalls, such as bash, git, jq and Python with pandas and matplotlib):
|
|
2355
|
+
|
|
2356
|
+
```sh
|
|
2357
|
+
docker build -t pi-roundtable-runner -f node_modules/pi-roundtable/runner/Dockerfile node_modules/pi-roundtable
|
|
2358
|
+
```
|
|
2359
|
+
|
|
2360
|
+
At start the host refuses to run, with a `ConfigError` naming `runner.image`, without the `docker` CLI or the image.
|
|
2361
|
+
It then runs the container unless one of its name already runs that image (`docker run -d --network none --cap-drop ALL` plus the six capabilities the server needs, `--security-opt no-new-privileges`, `--read-only`, `--tmpfs /tmp:mode=0755`, `--ipc none`, a tmpfs for the socket directory, the workspace volume, and the limits), and talks to it through `docker exec -i <container> roundtable-runner serve --stdio`; when that ends, the next call starts another.
|
|
2362
|
+
It reuses or replaces only a container it labelled `pi-roundtable.runner=1`: a container of that name without the label is neither used nor removed, and the start stops with a `ConfigError` naming `runner.name`.
|
|
2363
|
+
Docker access is the authentication: no socket or token leaves the container.
|
|
2364
|
+
|
|
2365
|
+
**The socket driver** suits a host that is itself a container, where the runner runs beside it as a second container with no network.
|
|
2366
|
+
Both mount one directory at `/run/roundtable-runner`, owned by the bot's account with mode 0700 so the conversations' accounts cannot reach it; the runner listens on `runner.sock` there and writes a per-boot token beside it, which the bot reads on each connection. No conversation is ever given the uid of that directory's owner.
|
|
2367
|
+
Run the sidecar with the docker driver's flags, `--tmpfs /tmp:mode=0755 --ipc none` included; without them the server makes `/tmp` and `/dev/shm` root's itself at start, and stops when it cannot.
|
|
2368
|
+
The two may start in either order: the host waits up to 30 seconds for the socket, then starts anyway and logs an error, and until the runner answers each call to its tools fails with "the runner is not reachable".
|
|
2369
|
+
|
|
2370
|
+
**Accounts.** Each conversation's account is a uid of its own, from 20000 up, never handed out twice: should the runner's state file (`.state/uids.json` in the workspace volume) be lost, each workspace keeps the uid that owns its directory and new ones start above every uid there. A workspace owned by another uid is refused rather than handed over.
|
|
2371
|
+
|
|
2372
|
+
**Retention.** At start and once a day the runner removes the workspaces unused for `keepDays`.
|
|
2373
|
+
When [conversation retention](#conversation-retention-conversationskeepdays) deletes a conversation, its workspace goes with it; starting a conversation over keeps its files.
|
|
2374
|
+
|
|
2375
|
+
`roundtable doctor` prints where the runner runs and whether it answers (`runner: docker, image pi-roundtable-runner: reachable (protocol 1); minTier member`), and fails when it does not.
|
|
2376
|
+
Plugins read the setting, its defaults filled in, as `context.env.runner` (`RunnerSettings`; `RunnerConfig` is the configuration's form), and `RoundtableOptions.environment.runner` carries it for a host that builds its own options.
|
|
2377
|
+
pi-roundtable-webchat reads it to let a persona's `selection` name the four tools on a chat-only host.
|
|
2378
|
+
The runner covers these four tools and the core's file tools only: a plugin whose own tools reach the host, such as pi-roundtable-coding (`hostAccess: true`), still runs them on the host.
|
|
2379
|
+
|
|
2380
|
+
### Shared hosts: `preset: "shared"`
|
|
2381
|
+
|
|
2382
|
+
A host many people talk to, each in conversations of their own, such as a company bot on Discord, needs the same handful of settings every time.
|
|
2383
|
+
`preset: "shared"` gives them in one key, so such a host writes only what is its own: the runner, and which tools each persona's selection names.
|
|
2384
|
+
|
|
2385
|
+
```ts
|
|
2386
|
+
export default defineRoundtable({
|
|
2387
|
+
// ...
|
|
2388
|
+
agentServer: { tools: "chat-only" },
|
|
2389
|
+
preset: "shared",
|
|
2390
|
+
runner: { driver: "socket", socket: "/run/roundtable-runner/runner.sock" },
|
|
2391
|
+
});
|
|
2392
|
+
```
|
|
2393
|
+
|
|
2394
|
+
It does this:
|
|
2395
|
+
|
|
2396
|
+
| What | Why |
|
|
2397
|
+
| --- | --- |
|
|
2398
|
+
| Requires [`runner`](#runner-a-container-for-the-shell-and-files-of-conversations-with-other-people); the host stops at start with a `ConfigError` naming `runner` and `preset: "shared"` without it | Other people's commands must never run on the host. With the runner, every conversation but the owners' own runs `bash`, `read`, `edit` and `write` there, and on a chat-only host a persona's `selection` may name them (`runner.minTier`, default `member`, is the tier they need) |
|
|
2399
|
+
| Sets `imageTool: "selected"` | `generate_image` is offered only where a selection names it, so a host opens it to one persona and not to every turn |
|
|
2400
|
+
| Sets `toolTiers` of `generate_image`, `poll_create` and `poll_end` to `"member"` | The people a persona serves may draw and post [polls](#native-polls-polls) when its selection names those tools; `generate_image` otherwise needs the owner |
|
|
2401
|
+
|
|
2402
|
+
A setting the configuration writes itself always wins: `imageTool: "every-selection"` or `toolTiers: { generate_image: "admin" }` beside the preset keeps that value, and the preset fills in only what is left out.
|
|
2403
|
+
The preset opens no tool by itself: a selection still has to name each one, and the agent team's selection on a chat-only host is still refused the shell and file tools.
|
|
2404
|
+
Without `preset` nothing changes.
|
|
2405
|
+
`ResolvedConfig.preset` is `{ name, set }`, `set` listing each setting the preset filled in as `key: value`, and `roundtable doctor` prints it: `preset: shared; it set imageTool: "selected", toolTiers.generate_image: "member", ...`.
|
|
2406
|
+
|
|
2407
|
+
The key is `preset` rather than `mode` because a mode in this guide is a conversation's ([`MODES`](#conversation-modes-modes): yolo, long-running) or `agentServer.tools`; a preset fills in defaults that explicit settings override, which is exactly what this key does.
|
|
2408
|
+
|
|
2409
|
+
**Poll results in a plugin's own claim.** The agent server's claim answers a poll's result turn (`POLL_TARGET`) in agents' channels. A plugin whose own claim serves people, such as a company assistant in direct messages and threads, answers them with `pollResultTurns` from `pi-roundtable/kit`, spread into the claim:
|
|
2410
|
+
|
|
2411
|
+
```ts
|
|
2412
|
+
import { pollResultTurns } from "pi-roundtable/kit";
|
|
2413
|
+
|
|
2414
|
+
const claim: ChannelClaim = {
|
|
2415
|
+
// ... name, priority, owns, admit, startFresh
|
|
2416
|
+
...pollResultTurns({
|
|
2417
|
+
turns: context.turns,
|
|
2418
|
+
conversations: () => context.services.find(CONVERSATIONS),
|
|
2419
|
+
answer: (channel) => ({ kind: "assistant", selection: selectionFor(channel) }),
|
|
2420
|
+
}),
|
|
2421
|
+
};
|
|
2422
|
+
```
|
|
2423
|
+
|
|
2424
|
+
It gives the claim `background` and `backgroundRefusal` for `POLL_TARGET` alone (`PollResultTurns`).
|
|
2425
|
+
Each result turn runs as the poll's starter, as the router checked them, in the conversation's kind with the `selection` (and the optional `origin`) that `answer(channel)` returns as a `PollResultAnswer`; nobody waits on it, and it is never a message: no `byMessage`, no `confirmed`, so a poll approves no held action.
|
|
2426
|
+
It skips every other target, a turn the router did not run as the starter, a channel `answer` returns undefined for, a conversation that is gone or now private to someone else, and every turn on a host that records no conversations (`PollResultTurnsOptions.conversations` returns undefined), since whose conversation it is cannot be checked there.
|
|
2427
|
+
A claim that answers another target too writes its own `background` and calls these for `POLL_TARGET`.
|
|
2428
|
+
|
|
2287
2429
|
### Conversation retention: `conversations.keepDays`
|
|
2288
2430
|
|
|
2289
2431
|
The conversations run through `context.turns` are recorded (`CONVERSATIONS`).
|
|
@@ -3131,7 +3273,7 @@ In a turn nobody is named for, the schedule and delegation tools refuse.
|
|
|
3131
3273
|
- Contribute `backgroundTargets` alongside the claim that serves them; read one with `context.conversations.target(name)` from a service or handler.
|
|
3132
3274
|
- Two targets with the same name are refused, naming both plugins.
|
|
3133
3275
|
- The core's `modules` plugin contributes `PERSONAL_TARGET` (name `"owner"`, exported from the main entry; `OWNER_TARGET` is a deprecated alias) on every host, for every person's conversations whose claim answers background turns, such as the agents' and an app's owner conversation.
|
|
3134
|
-
The agent server's claim answers that target and skips all others, so a turn for another target never runs with the owner's tools.
|
|
3276
|
+
The agent server's claim answers that target and `POLL_TARGET` (a poll's results, see [native polls](#native-polls-polls)), and skips all others, so a turn for another target never runs with the owner's tools.
|
|
3135
3277
|
Its limits are 0.8's, and it holds no one to a number of schedules or running tasks across their conversations unless the host's configuration says so: `background: { perPrincipal: { schedules: 20, delegations: 2 } }` sets its `perPrincipal` and `maxRunningPerPrincipal`. A host that serves many people sets both.
|
|
3136
3278
|
- The built-in schedule and delegation tools make `PERSONAL_TARGET` work, and a session has them only where it can run: when the claim that owns its conversation has `background`, or, for a conversation no chat surface carries, when its creator has a direct channel, as a provider knows without the network.
|
|
3137
3279
|
Such a conversation has the tools only when the registry records it private: its person is whom the work runs for. One recorded shared, or not recorded, has neither tool, whoever speaks in it, because a session outlives the turn it is built in.
|
|
@@ -3142,6 +3284,7 @@ In a turn nobody is named for, the schedule and delegation tools refuse.
|
|
|
3142
3284
|
It never falls back to the owner's target; a recurring schedule keeps the reason as its last status and runs again once a plugin contributes the target.
|
|
3143
3285
|
A one-time schedule is spent when it fires.
|
|
3144
3286
|
- A schedule keeps its target's name in its row, so renaming a target orphans the schedules made for it.
|
|
3287
|
+
- The `polls` plugin contributes `POLL_TARGET` (name `"poll"`, exported from the main entry), with no schedules and no delegation: its turns bring a poll's results back as its starter's. A claim that should hear the results of polls posted in its conversations answers it in `background`.
|
|
3145
3288
|
|
|
3146
3289
|
<!-- example: examples/support-desk.ts -->
|
|
3147
3290
|
```ts
|
|
@@ -3257,7 +3400,9 @@ The agent server claims `discord:` keys, and, only on a surface that declares `a
|
|
|
3257
3400
|
| `sendReply(channel, reply)` | Posts an `OutboundReply`: a thinking line, a card, text chunks, then files; a reply with `intercom` is a message between agents, which a surface may draw as a small card in place of its chunks | (required) |
|
|
3258
3401
|
| `stop()` | Disconnects when the host stops | nothing to stop |
|
|
3259
3402
|
| `agentRooms` | `true` makes the surface host [agent rooms](#agent-rooms-on-any-surface): a conversation with each agent and group of the team, as `<surface>:agent.<name>` and `<surface>:group.<name>` | no rooms; the agent team answers only in Discord |
|
|
3403
|
+
| `agentRoomsOwnersOnly` | `true` says only the owners enter the surface's agent and group rooms: it serves them, their messages and their cards to owners alone and refuses anyone else. On a host with a [`runner`](#runner-a-container-for-the-shell-and-files-of-conversations-with-other-people), an agent's own room there then keeps the host's shell | others may be in the rooms, and the runner serves them |
|
|
3260
3404
|
| `threads` | A `SurfaceThreads` that hosts [dispatch threads](#dispatch-threads-on-any-surface): a background dispatch started in one of the surface's channels opens its thread there, and the thread is the conversation `<surface>:<id>` | the dispatch posts in the channel as before |
|
|
3405
|
+
| `polls` | A `SurfacePolls`: [native polls](#native-polls-polls) an agent posts with `poll_create`, whose results come back to it in a turn of their own | the poll tools refuse here |
|
|
3261
3406
|
| `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 |
|
|
3262
3407
|
| `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 |
|
|
3263
3408
|
| `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 |
|
|
@@ -3372,6 +3517,32 @@ The built-in values: Discord says that Markdown renders except tables, which sho
|
|
|
3372
3517
|
A host overrides or removes a built-in value through that surface's options (`discord.formatting`, `line({ formatting })`, `webChat({ formatting })`): a text replaces it, and `false` tells the model nothing.
|
|
3373
3518
|
A custom runtime provider reads the same lookup as `RuntimeDeps.formatting(channel)`.
|
|
3374
3519
|
|
|
3520
|
+
#### Native polls: `polls`
|
|
3521
|
+
|
|
3522
|
+
A surface whose chat network has native polls offers them as `polls`, a `SurfacePolls`; Discord's surface does.
|
|
3523
|
+
An agent posts one with `poll_create` (`question`, `answers`, `multi?`, `closes_in_minutes`) in the conversation its turn runs in, and anyone who can see that channel votes.
|
|
3524
|
+
The call returns at once: the turn does not wait for votes.
|
|
3525
|
+
When the poll ends, at its deadline or through `poll_end`, the host reads its results and runs a new turn in the same conversation, as the person who started the poll and at the tier they held then, with the results as data: each answer's votes, and the id and display name of up to 100 voters of each answer (Discord lists no more), fenced and labelled as votes rather than instructions.
|
|
3526
|
+
That turn is a background turn for `POLL_TARGET` (name `"poll"`), not a message, so it can neither confirm nor spend a held action's approval: a winning "Yes" approves nothing.
|
|
3527
|
+
`poll_end` (`poll_id?`) ends one open poll, or every one the speaker may end; a poll's starter and the owners may end it, no one else.
|
|
3528
|
+
|
|
3529
|
+
| Rule | Value |
|
|
3530
|
+
|---|---|
|
|
3531
|
+
| Who may use the tools | `member` and up (both tools); a selection still has to name them |
|
|
3532
|
+
| Duration | 1 minute to 7 days, and no longer than the surface's `limits.maxDurationMs` |
|
|
3533
|
+
| Answers | 2 to the surface's `limits.answers` (10 on Discord), each different; question and answer lengths as the surface's `limits` say (300 and 55 on Discord) |
|
|
3534
|
+
| Open polls | at most 3 at once in one conversation |
|
|
3535
|
+
| Results that cannot be read | tried again for an hour after the end, or after the restart that picked the poll up; then the turn says they could not be read |
|
|
3536
|
+
| Kept | each poll is a row of `roundtable_polls` (question, answers, starter, results with voter names), deleted 30 days after its result turn ran |
|
|
3537
|
+
|
|
3538
|
+
`poll_create` refuses, with a sentence the model reads, on a surface without `polls` (naming the surface's `label`), in a conversation whose claim takes no background turns or would skip the starter's (`backgroundRefusal`), in a turn nobody is named for, and past the limits above.
|
|
3539
|
+
The host stores each step, so a restart picks up where it was: a poll whose deadline passed while the process was down ends at the next start, and a claim on its row keeps two processes from reporting it twice. A process that starts while another is posting a poll, or running its result turn, leaves it to that process for a while (2 minutes for a post, 3 hours for a result turn) and takes it over only if it is still unfinished then. A host that is shutting down starts no poll.
|
|
3540
|
+
The agent server's claim answers `POLL_TARGET` in agents' channels (not in groups); a plugin's own claim that should hear its polls' results answers it in its `background` beside its own target, or spreads in [`pollResultTurns`](#shared-hosts-preset-shared) from `pi-roundtable/kit` when poll results are all it answers there.
|
|
3541
|
+
|
|
3542
|
+
On Discord the bot needs the Send Polls and Read Message History permissions in the channel; Discord keeps a poll open for whole hours, so the host ends it at the deadline itself.
|
|
3543
|
+
A surface of your own implements `SurfacePolls`: `limits` (`PollLimits`), `post(channel, poll)` resolving to the poll's own id, `end(channel, pollId)` (harmless when it ended or is gone), and `results(channel, pollId)` resolving to `PollResults`, or `"gone"` when the poll's message was deleted; a rejection is retried.
|
|
3544
|
+
`describePollsContract(name, make)` in `pi-roundtable/testing` checks those promises on a `PollsContractSubject`, and `fakeSurfacePolls()` is an in-memory one for tests.
|
|
3545
|
+
|
|
3375
3546
|
### `places`: where the agents are spoken to on a surface
|
|
3376
3547
|
|
|
3377
3548
|
A `PlaceProvider` tells the agent team where an agent or group lives on one surface and how to post there.
|
|
@@ -4390,6 +4561,7 @@ It checks that the surface names a prefix and owns its channel, delivers what th
|
|
|
4390
4561
|
A check for a part the surface does not offer passes.
|
|
4391
4562
|
The contract has no check for `ApprovalDetails.copy`: a surface that shows it keeps it informational, so using it never resolves, approves or declines the prompt, whoever uses it.
|
|
4392
4563
|
A subject that gives `answerQuestionnaire` (and a `stranger` that gives its own) must declare `asks` and also keeps the questionnaire checks.
|
|
4564
|
+
A surface with `polls` whose subject gives `polls` (the hands of the people in the channel: `remove(pollId)` deletes a poll's message, and `vote(pollId, index, voter)`, when given, votes) also keeps the poll checks: a poll is posted and ended twice without failing, read after the end with every answer in order and, with `vote`, its votes and voters, read `"gone"` once deleted, and taken at the surface's own `limits`. `describePollsContract(name, make)` registers those checks alone, for a surface's `polls` tested apart from the surface, on a `PollsContractSubject` (`polls`, `channel`, `remove`, `vote?`, `close?`).
|
|
4393
4565
|
`checkSurfaceContract(make)` runs the same checks and returns the ones that failed, as `SurfaceContractFailure`s.
|
|
4394
4566
|
|
|
4395
4567
|
## What happens when the bot starts and stops
|
|
@@ -4813,6 +4985,7 @@ Import from the entries listed below; source area files are internal.
|
|
|
4813
4985
|
| `NotLinkedError` | `pi-roundtable` | value |
|
|
4814
4986
|
| `OWNER_TARGET` | `pi-roundtable` | value |
|
|
4815
4987
|
| `PERSONAL_TARGET` | `pi-roundtable` | value |
|
|
4988
|
+
| `POLL_TARGET` | `pi-roundtable` | value |
|
|
4816
4989
|
| `OutboundReply` | `pi-roundtable` | type |
|
|
4817
4990
|
| `PostAuthor` | `pi-roundtable` | type |
|
|
4818
4991
|
| `OwnerAnswer` | `pi-roundtable` | type |
|
|
@@ -4889,6 +5062,9 @@ Import from the entries listed below; source area files are internal.
|
|
|
4889
5062
|
| `RouteSocket` | `pi-roundtable` | type |
|
|
4890
5063
|
| `RoutingConfig` | `pi-roundtable` | type |
|
|
4891
5064
|
| `RoutingTable` | `pi-roundtable` | type |
|
|
5065
|
+
| `RunnerConfig` | `pi-roundtable` | type |
|
|
5066
|
+
| `RunnerDriverConfig` | `pi-roundtable` | type |
|
|
5067
|
+
| `RunnerSettings` | `pi-roundtable` | type |
|
|
4892
5068
|
| `RuntimeDeps` | `pi-roundtable` | type |
|
|
4893
5069
|
| `RuntimeFactory` | `pi-roundtable` | type |
|
|
4894
5070
|
| `SCHEDULES` | `pi-roundtable` | value |
|
|
@@ -4941,6 +5117,11 @@ Import from the entries listed below; source area files are internal.
|
|
|
4941
5117
|
| `SpeakerMemory` | `pi-roundtable` | type |
|
|
4942
5118
|
| `StoredAttachment` | `pi-roundtable` | type |
|
|
4943
5119
|
| `SurfacePort` | `pi-roundtable` | type |
|
|
5120
|
+
| `SurfacePolls` | `pi-roundtable` | type |
|
|
5121
|
+
| `SurfacePoll` | `pi-roundtable` | type |
|
|
5122
|
+
| `PollLimits` | `pi-roundtable` | type |
|
|
5123
|
+
| `PollResults` | `pi-roundtable` | type |
|
|
5124
|
+
| `PollVoter` | `pi-roundtable` | type |
|
|
4944
5125
|
| `SurfaceRouting` | `pi-roundtable` | type |
|
|
4945
5126
|
| `SurfaceThreads` | `pi-roundtable` | type |
|
|
4946
5127
|
| `SurfaceMessageEvents` | `pi-roundtable` | type |
|
|
@@ -4996,6 +5177,8 @@ Import from the entries listed below; source area files are internal.
|
|
|
4996
5177
|
| `validateQuestionnaire` | `pi-roundtable` | value |
|
|
4997
5178
|
| `withReplyFiles` | `pi-roundtable` | value |
|
|
4998
5179
|
| `withdrawalNote` | `pi-roundtable` | value |
|
|
5180
|
+
| `WorkspaceFile` | `pi-roundtable` | type |
|
|
5181
|
+
| `WorkspaceFiles` | `pi-roundtable` | type |
|
|
4999
5182
|
| `prepareImageBytes` | `pi-roundtable/kit` | value |
|
|
5000
5183
|
| `ImagePreparationError` | `pi-roundtable/kit` | value |
|
|
5001
5184
|
| `squarePng` | `pi-roundtable/kit` | value |
|
|
@@ -5031,6 +5214,8 @@ Import from the entries listed below; source area files are internal.
|
|
|
5031
5214
|
| `describeDb` | `pi-roundtable/testing` | value |
|
|
5032
5215
|
| `describeBlocksContract` | `pi-roundtable/testing` | value |
|
|
5033
5216
|
| `describeSurfaceContract` | `pi-roundtable/testing` | value |
|
|
5217
|
+
| `describePollsContract` | `pi-roundtable/testing` | value |
|
|
5218
|
+
| `PollsContractSubject` | `pi-roundtable/testing` | type |
|
|
5034
5219
|
| `checkSurfaceContract` | `pi-roundtable/testing` | value |
|
|
5035
5220
|
| `checkPlaceProviderContract` | `pi-roundtable/testing` | value |
|
|
5036
5221
|
| `placeProviderContract` | `pi-roundtable/testing` | value |
|
|
@@ -5059,6 +5244,9 @@ Import from the entries listed below; source area files are internal.
|
|
|
5059
5244
|
| `FakeScriptAnswer` | `pi-roundtable/testing` | type |
|
|
5060
5245
|
| `FakeScriptRunner` | `pi-roundtable/testing` | type |
|
|
5061
5246
|
| `fakeThreads` | `pi-roundtable/testing` | value |
|
|
5247
|
+
| `fakeSurfacePolls` | `pi-roundtable/testing` | value |
|
|
5248
|
+
| `FakeSurfacePolls` | `pi-roundtable/testing` | type |
|
|
5249
|
+
| `FakePoll` | `pi-roundtable/testing` | type |
|
|
5062
5250
|
| `openTestStore` | `pi-roundtable/testing` | value |
|
|
5063
5251
|
| `servicePair` | `pi-roundtable/testing` | value |
|
|
5064
5252
|
| `partial` | `pi-roundtable/testing` | value |
|
|
@@ -5221,6 +5409,10 @@ Import from the entries listed below; source area files are internal.
|
|
|
5221
5409
|
| `outcome` | `pi-roundtable/kit` | value |
|
|
5222
5410
|
| `ownerAttachmentDir` | `pi-roundtable/kit` | value |
|
|
5223
5411
|
| `parseModelRef` | `pi-roundtable/kit` | value |
|
|
5412
|
+
| `pollResultTurns` | `pi-roundtable/kit` | value |
|
|
5413
|
+
| `PollResultAnswer` | `pi-roundtable/kit` | type |
|
|
5414
|
+
| `PollResultTurns` | `pi-roundtable/kit` | type |
|
|
5415
|
+
| `PollResultTurnsOptions` | `pi-roundtable/kit` | type |
|
|
5224
5416
|
| `promptSlot` | `pi-roundtable/kit` | value |
|
|
5225
5417
|
| `quietLinks` | `pi-roundtable/kit` | value |
|
|
5226
5418
|
| `readAttachmentExtension` | `pi-roundtable/kit` | value |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-roundtable",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.54.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",
|
|
@@ -39,6 +39,8 @@
|
|
|
39
39
|
"!src/fixtures",
|
|
40
40
|
"!src/prompt-text.snapshot.json",
|
|
41
41
|
"!src/cli/testing",
|
|
42
|
+
"!src/runner-server/testing",
|
|
43
|
+
"runner",
|
|
42
44
|
"templates",
|
|
43
45
|
"docs",
|
|
44
46
|
"examples",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# The runner image: where multi-user conversations' bash, read, edit and write run. It holds no
|
|
2
|
+
# credential and reaches no network; each conversation gets its own uid and a private workspace.
|
|
3
|
+
# Nothing is published: a host builds it once from the installed package's root, for example
|
|
4
|
+
# docker build -t pi-roundtable-runner -f node_modules/pi-roundtable/runner/Dockerfile node_modules/pi-roundtable
|
|
5
|
+
# and runs it with
|
|
6
|
+
# --network none --cap-drop ALL
|
|
7
|
+
# --cap-add CHOWN --cap-add DAC_OVERRIDE --cap-add FOWNER --cap-add SETUID --cap-add SETGID --cap-add KILL
|
|
8
|
+
# --security-opt no-new-privileges --read-only
|
|
9
|
+
# --tmpfs /tmp:mode=0755 --ipc none --tmpfs /run/roundtable-runner:mode=0700
|
|
10
|
+
# --volume <workspaces>:/roundtable-runner/ws --memory 1g --cpus 1 --pids-limit 256
|
|
11
|
+
# /tmp is root's and --ipc none leaves no /dev/shm, so no directory is writable by every uid
|
|
12
|
+
# (each conversation's TMPDIR is its own); the server makes /dev/mqueue root's at start, and
|
|
13
|
+
# makes /tmp and /dev/shm root's too when a container is run without these two flags.
|
|
14
|
+
# A sidecar mounts a directory owned by the bot's account (mode 0700) at /run/roundtable-runner
|
|
15
|
+
# instead of the tmpfs, and the bot reaches runner.sock with the token beside it.
|
|
16
|
+
FROM oven/bun:1.4.4-slim
|
|
17
|
+
|
|
18
|
+
# Tools a conversation can use without a network: shells and text tools, git and jq, and Python
|
|
19
|
+
# with common data and office packages (pandas brings scipy and sympy along). More go here, since
|
|
20
|
+
# nothing can be installed at run time. tini reaps orphaned processes (see the entrypoint).
|
|
21
|
+
RUN apt-get update \
|
|
22
|
+
&& apt-get install -y --no-install-recommends \
|
|
23
|
+
bash dash coreutils findutils grep sed gawk diffutils util-linux procps \
|
|
24
|
+
git jq file less zip unzip xz-utils bzip2 \
|
|
25
|
+
python3 python3-numpy python3-pandas python3-openpyxl python3-matplotlib \
|
|
26
|
+
python3-docx python3-pil \
|
|
27
|
+
fonts-noto-cjk tini \
|
|
28
|
+
&& rm -rf /var/lib/apt/lists/* \
|
|
29
|
+
&& printf '\nfont.sans-serif: Noto Sans CJK TC, Noto Sans CJK JP, DejaVu Sans\n' >> /etc/matplotlibrc
|
|
30
|
+
|
|
31
|
+
# The server runs from its source with the image's Bun; runner/Dockerfile.dockerignore keeps the
|
|
32
|
+
# build context to these files.
|
|
33
|
+
COPY src/core/runner/protocol.ts /opt/roundtable-runner/src/core/runner/protocol.ts
|
|
34
|
+
COPY src/runner-server/ /opt/roundtable-runner/src/runner-server/
|
|
35
|
+
RUN printf '#!/bin/sh\nexec bun /opt/roundtable-runner/src/runner-server/main.ts "$@"\n' \
|
|
36
|
+
> /usr/local/bin/roundtable-runner \
|
|
37
|
+
&& chmod 0755 /usr/local/bin/roundtable-runner \
|
|
38
|
+
&& chmod -R a=rX,u+w /opt/roundtable-runner \
|
|
39
|
+
&& mkdir -p /roundtable-runner/ws /run/roundtable-runner \
|
|
40
|
+
&& chmod 0711 /roundtable-runner/ws \
|
|
41
|
+
&& chmod 0700 /run/roundtable-runner
|
|
42
|
+
|
|
43
|
+
# tini as PID 1 reaps what the runner kills after each call; without it the killed background
|
|
44
|
+
# processes stay as zombies and use up the container's process limit.
|
|
45
|
+
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/roundtable-runner"]
|
|
46
|
+
CMD ["serve"]
|
package/src/cli/checks/images.ts
CHANGED
|
@@ -11,11 +11,12 @@ export async function checkImageProvider(project: Project): Promise<Result> {
|
|
|
11
11
|
const assembled = await project.assembled();
|
|
12
12
|
if (!assembled.ok)
|
|
13
13
|
return { status: "skipped", reason: "the configuration is not valid yet" };
|
|
14
|
+
const mode = `imageTool: ${assembled.value.config.imageTool}`;
|
|
14
15
|
return fillsImages(assembled.value.defined.plugins)
|
|
15
16
|
? ok(
|
|
16
|
-
|
|
17
|
+
`${mode}; a plugin fills the images slot, used for agents' generate_image; the agent server no longer draws their avatars with it`,
|
|
17
18
|
)
|
|
18
19
|
: ok(
|
|
19
|
-
`none; agents are composed characters, and the agent server no longer draws with the images slot. To let agents make pictures with generate_image, fill the slot, as the plugin guide shows: ${GUIDE}`,
|
|
20
|
+
`none; ${mode}; agents are composed characters, and the agent server no longer draws with the images slot. To let agents make pictures with generate_image, fill the slot, as the plugin guide shows: ${GUIDE}`,
|
|
20
21
|
);
|
|
21
22
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Project } from "../project.ts";
|
|
2
|
+
import { ok, type Result, skipped } from "../report.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The configuration's preset and each setting it filled in; a setting the configuration wrote
|
|
6
|
+
* itself is not listed, since it wins over the preset.
|
|
7
|
+
*/
|
|
8
|
+
export async function checkPreset(project: Project): Promise<Result> {
|
|
9
|
+
const assembled = await project.assembled();
|
|
10
|
+
if (!assembled.ok) return skipped("the configuration is not valid yet");
|
|
11
|
+
const { preset } = assembled.value.config;
|
|
12
|
+
if (!preset) return ok("none");
|
|
13
|
+
const set =
|
|
14
|
+
preset.set.length > 0
|
|
15
|
+
? `it set ${preset.set.join(", ")}`
|
|
16
|
+
: "it set nothing; the configuration writes each of its settings";
|
|
17
|
+
return ok(
|
|
18
|
+
`${preset.name}; ${set}; bash, read, edit and write run in the runner for every conversation but the owner's own`,
|
|
19
|
+
);
|
|
20
|
+
}
|