pi-roundtable 0.5.0 → 0.5.2

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +39 -11
  3. package/README.zh-TW.md +35 -14
  4. package/docs/plugins.md +258 -167
  5. package/examples/migrations.test.ts +1 -1
  6. package/examples/migrations.ts +2 -2
  7. package/package.json +8 -4
  8. package/src/cli/cli.ts +2 -0
  9. package/src/cli/main.ts +1 -0
  10. package/src/cli/project.ts +2 -0
  11. package/src/cli/runtime.ts +2 -2
  12. package/src/cli/templates.ts +10 -9
  13. package/src/core/agents/agent-prompt.ts +1 -2
  14. package/src/core/agents/agent-store.ts +1 -2
  15. package/src/core/agents/agent-team-fixture.ts +5 -3
  16. package/src/core/agents/fallback-avatar.ts +1 -0
  17. package/src/core/agents/group-messages.ts +1 -1
  18. package/src/core/agents/group-round.ts +10 -9
  19. package/src/core/agents/group-turns.ts +13 -8
  20. package/src/core/agents/team-layout.ts +13 -14
  21. package/src/core/agents/team-status.ts +8 -8
  22. package/src/core/agents/team-turns.ts +8 -9
  23. package/src/core/define-roundtable.ts +19 -19
  24. package/src/core/define.ts +10 -10
  25. package/src/core/discord/channel-executor.ts +20 -18
  26. package/src/core/discord/channel-operations.ts +7 -3
  27. package/src/core/discord/inbound-message.ts +13 -11
  28. package/src/core/discord/owner-cards.ts +3 -3
  29. package/src/core/discord/owner-discord-threads.ts +16 -12
  30. package/src/core/discord/owner-discord.ts +5 -4
  31. package/src/core/host.ts +1 -0
  32. package/src/core/log.ts +1 -0
  33. package/src/core/modules/schedules/scheduler.ts +3 -0
  34. package/src/core/modules/skills/skill-link.ts +13 -8
  35. package/src/core/modules/skills/skill-listing.ts +2 -4
  36. package/src/core/modules/skills/skill-registry.ts +3 -2
  37. package/src/core/modules/skills/skill-store.ts +3 -2
  38. package/src/core/registry/contributions.ts +1 -1
  39. package/src/core/routing/conversation-turns.ts +2 -2
  40. package/src/core/routing/settle-turn.ts +8 -0
  41. package/src/core/runtime/compaction-tiers.ts +9 -10
  42. package/src/core/runtime/turn-answer.ts +10 -12
  43. package/src/core/shared/session-messages.ts +4 -4
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.5.2] - 2026-10-02
9
+
10
+ ### Changed
11
+
12
+ - `pi-mcp-adapter` is 5.0.0 (was 4.0.0). The core supplies its servers through `createMcpAdapter()`, which 5.0.0 keeps isolated: it reads no `mcp.json` and leaves the host's Pi settings alone. Checked on pi 0.99.2 and 1.0.0 by connecting a session built the way the core builds one to a local MCP server that requires a bearer token: the tool registered, a call returned its result, and the agent directory got no `settings.json`. 5.0.0 declares pi-ai peer support up to 0.99; the checks above ran it on 1.0.0.
13
+
14
+ ## [0.5.1] - 2026-10-02
15
+
16
+ ### Changed
17
+
18
+ - `@earendil-works/pi-ai` and `@earendil-works/pi-coding-agent` take `>=0.99.2 <2`, so hosts can run pi 1.0. The typecheck, lint and full test suite pass on pi 1.0.0, and a session built the way the core builds one still connects `pi-mcp-adapter` 4.0.0 to a bearer-protected MCP server and calls its tool. The lockfile stays on 0.99.2, the lowest tested version, and the daily canary now runs the newest 1.x.
19
+
8
20
  ## [0.5.0] - 2026-10-01
9
21
 
10
22
  ### Changed
package/README.md CHANGED
@@ -2,17 +2,25 @@
2
2
 
3
3
  English | [Traditional Chinese](README.zh-TW.md)
4
4
 
5
- A Discord agent server on [Pi](https://github.com/earendil-works/pi).
6
- You get a team of AI agents in one Discord server: each agent owns a channel and a conversation, they share tools and memory, and you extend the bot with plugins written in TypeScript.
5
+ Docs: <https://pi-roundtable.wayneh.tw>
6
+ Source and issues: <https://github.com/wayne930242/pi-roundtable>
7
7
 
8
- - Built for one owner and one Discord server. Others can be allowed to talk to the agents, but that setup, and its risks, are the operator's.
9
- - Bun only. The package ships its TypeScript source, so there is no build step.
8
+ A Discord agent server on [Pi](https://github.com/earendil-works/pi).
9
+ Each AI agent has its own channel and conversation in your Discord server.
10
+ They share tools and memory.
11
+ You can extend the bot with TypeScript plugins.
12
+
13
+ - Built for one owner and one Discord server.
14
+ You can allow others to talk to the agents, but that setup and its risks are the operator's.
15
+ - Bun only.
16
+ The package ships its TypeScript source, so there is no build step.
10
17
  - MIT licensed.
11
18
 
12
19
  ## What you need
13
20
 
14
21
  - [Bun](https://bun.sh/docs/installation) 1.3 or newer.
15
- - PostgreSQL. The project `init` creates has a `docker-compose.yml` that runs one.
22
+ - PostgreSQL.
23
+ The project `init` creates has a `docker-compose.yml` that runs one.
16
24
  - A Discord bot: an application with a bot user, the Message Content intent turned on, and an invitation to your server.
17
25
  - A model login: the API key of the provider of the model you choose (`ANTHROPIC_API_KEY` for `anthropic/...`), or a login made with Pi.
18
26
  - An address that reaches the process from the internet, such as a tunnel, because Discord fetches the agents' avatars from it.
@@ -29,7 +37,7 @@ bunx roundtable doctor
29
37
  bunx roundtable start
30
38
  ```
31
39
 
32
- `init` writes a working project and asks for no secret.
40
+ `init` writes a working project without asking for secrets.
33
41
  It refuses to write anything when Bun is missing or too old, or when a file it would create already exists.
34
42
 
35
43
  ### `.env`
@@ -54,7 +62,8 @@ Bun loads `.env` by itself, and `.gitignore` keeps it out of Git.
54
62
  2. `.env` has a value for every variable `.env.example` lists.
55
63
  3. `roundtable.config.ts` against its schema, naming the failing key.
56
64
  4. Every plugin loads, and no two share a name.
57
- 5. Whether a plugin fills the `images` slot. Without one is not a failure: agents get avatars generated from their display names.
65
+ 5. Whether a plugin fills the `images` slot.
66
+ The check passes with or without one; agents without an image provider get avatars generated from their display names.
58
67
  6. PostgreSQL is reachable and migratable.
59
68
  7. The Discord token is valid, the bot is in your server, the Message Content intent is on, and the bot has the permissions it needs in the entry channel (including Pin Messages).
60
69
  When the bot is not in the server, the fix is an invitation link that asks for exactly those permissions.
@@ -67,7 +76,7 @@ A fresh project fails only on the credentials you have not entered yet, and says
67
76
  ### `start`
68
77
 
69
78
  `bunx roundtable start` runs the checks that need no network, stops with the same message `doctor` prints when one fails, and otherwise starts the bot.
70
- Once it runs, the agents in `agents.ts` have their channels, and `/roundtable schedule list` shows their schedules.
79
+ The running bot gives the agents in `agents.ts` their channels, and `/roundtable schedule list` shows their schedules.
71
80
  On `SIGTERM` or `SIGINT` it finishes running work before it stops.
72
81
 
73
82
  ## A plugin
@@ -95,7 +104,7 @@ export const hello = definePlugin({
95
104
  });
96
105
  ```
97
106
 
98
- It is tested without Discord or PostgreSQL:
107
+ You can test it without Discord or PostgreSQL:
99
108
 
100
109
  ```ts
101
110
  import { expect, test } from "bun:test";
@@ -111,14 +120,33 @@ test("hello greets", async () => {
111
120
 
112
121
  The [plugin guide](docs/plugins.md) explains every part a plugin can add (tools, prompt sections, agents, events, services, migrations, providers, slash commands, HTTP routes, and more), the order things start and stop in, and every startup error with its fix.
113
122
  Its examples live in [`examples/`](examples), and the test suite runs each of them.
114
- `pi-roundtable/kit` supplies claim, tool and presentation helpers and type-only names for the context’s existing services, and `pi-roundtable/discord` supplies the slash-command registrar, owner-command and panel helpers, and the agent panel, and is the entry that names discord.js types (`pi-roundtable/testing` names a few, through `testHost`'s composed commands); both are versioned like the main entry: before 1.0 a breaking change comes in a minor release and is listed in the changelog.
123
+ `pi-roundtable/kit` supplies claim, tool and presentation helpers and type-only names for the context’s existing services.
124
+ `pi-roundtable/discord` supplies the slash-command registrar, owner-command and panel helpers, and the agent panel.
125
+ It is the entry that names discord.js types (`pi-roundtable/testing` names a few, through `testHost`'s composed commands).
126
+ Both follow the main entry's versioning: before 1.0, breaking changes come in minor releases and are listed in the changelog.
127
+
128
+ ## MCP connectors
129
+
130
+ The separate package [pi-roundtable-mcp](https://www.npmjs.com/package/pi-roundtable-mcp) connects the bot to the MCP ecosystem in both directions, with two plugins:
131
+
132
+ - `mcpConnectors`: you add an MCP server in Discord with a private form, such as Notion, a calendar, or anything that speaks MCP over HTTP.
133
+ Your code then gives its tools to the agents you choose.
134
+ A [ContextForge](https://github.com/IBM/mcp-context-forge) gateway that you run keeps each server and its token.
135
+ - `remoteMcp`: an agent outside Discord sends your agent a message over MCP and reads the answer.
136
+ It can also use the Discord channels you grant, with only the operations you choose.
137
+
138
+ ```sh
139
+ bun add pi-roundtable-mcp
140
+ ```
141
+
142
+ It works with pi-roundtable 0.4 and 0.5, and its README lists every option.
115
143
 
116
144
  ## Settings
117
145
 
118
146
  `roundtable.config.ts` holds the settings and the list of plugins.
119
147
  An unknown key is an error that names the closest known one.
120
148
 
121
- The language of what the bot shows in Discord is the `locale` setting: `en` by default, or `zh-TW`.
149
+ `locale` sets the language of the bot's Discord text: `en` by default, or `zh-TW`.
122
150
 
123
151
  ```ts
124
152
  export default {
package/README.zh-TW.md CHANGED
@@ -2,10 +2,13 @@
2
2
 
3
3
  [English](./README.md) | 繁體中文
4
4
 
5
+ 文件:<https://pi-roundtable.wayneh.tw>
6
+ 原始碼與 issue:<https://github.com/wayne930242/pi-roundtable>
7
+
5
8
  一個建立在 [Pi](https://github.com/earendil-works/pi) 上的 Discord 智慧體(agent)伺服器。
6
- 你會在一個 Discord 伺服器裡得到一組 AI 智慧體:每個智慧體擁有一個頻道和一段對話,彼此共用工具與記憶,你用 TypeScript 寫外掛(plugin)來擴充這個 bot。
9
+ 它在你的 Discord 伺服器裡放一組 AI 智慧體:每個有自己的頻道和對話,共用工具與記憶。想加功能,就用 TypeScript 寫外掛(plugin)。
7
10
 
8
- - 為一位擁有者和一個 Discord 伺服器設計。你可以允許其他人與智慧體對話,但這樣的設定與風險由營運者自行承擔。
11
+ - 為一位擁有者和一個 Discord 伺服器設計。其他人也能跟智慧體對話,風險由營運者自行承擔。
9
12
  - 只支援 Bun。套件直接發佈 TypeScript 原始碼,不需要建置步驟。
10
13
  - MIT 授權。
11
14
 
@@ -13,9 +16,9 @@
13
16
 
14
17
  - [Bun](https://bun.sh/docs/installation) 1.3 以上。
15
18
  - PostgreSQL。`init` 建立的專案附有 `docker-compose.yml`,可以直接啟動一個。
16
- - 一個 Discord bot:一個含 bot 使用者、已開啟 Message Content intent,並已邀請進你的伺服器的應用程式。
17
- - 模型登入:你選的模型的供應商 API key(`anthropic/...` 用 `ANTHROPIC_API_KEY`),或用 Pi 做過的登入。
18
- - 一個能從網際網路連到這個行程的位址,例如通道(tunnel),因為 Discord 會從該位址取得智慧體的頭像。
19
+ - 一個 Discord bot:有 bot 使用者、開了 Message Content intent,也已經邀請進你的伺服器。
20
+ - 模型登入:你選的模型的供應商 API key(`anthropic/...` 用 `ANTHROPIC_API_KEY`),或之前用 Pi 登入過的帳號。
21
+ - 一個從網際網路連得到這個行程的位址,例如通道(tunnel)。Discord 要從這個位址抓智慧體的頭像。
19
22
 
20
23
  ## 五分鐘上手
21
24
 
@@ -29,13 +32,13 @@ bunx roundtable doctor
29
32
  bunx roundtable start
30
33
  ```
31
34
 
32
- `init` 會寫出一個可運作的專案,不會向你要任何祕密資訊。
33
- Bun 不存在或版本太舊,或它要建立的檔案已經存在時,它不會寫入任何東西。
35
+ `init` 會寫出一個能跑的專案,過程不會問你任何祕密資訊。
36
+ Bun 沒裝、版本太舊,或要建立的檔案已經存在時,它什麼都不寫。
34
37
 
35
38
  ### `.env`
36
39
 
37
40
  `.env.example` 說明了每個值的來源。
38
- Bun 會自行載入 `.env`,`.gitignore` 也已讓它不進 Git。
41
+ Bun 會自己讀 `.env`,`.gitignore` 也已經擋掉它。
39
42
 
40
43
  | 變數 | 內容 |
41
44
  | --- | --- |
@@ -54,15 +57,15 @@ Bun 會自行載入 `.env`,`.gitignore` 也已讓它不進 Git。
54
57
  2. `.env` 對 `.env.example` 列出的每個變數都有值。
55
58
  3. `roundtable.config.ts` 符合其 schema,失敗時指出是哪個鍵。
56
59
  4. 每個外掛都能載入,且沒有兩個外掛同名。
57
- 5. 是否有外掛填入 `images` 槽位。沒有並不算失敗:智慧體會用顯示名稱產生頭像。
60
+ 5. 有沒有外掛填了 `images` 槽位。沒有也不算失敗,智慧體會用顯示名稱產生頭像。
58
61
  6. PostgreSQL 連得上,且能執行 migration。
59
62
  7. Discord token 有效、bot 已在你的伺服器裡、Message Content intent 已開啟,而且 bot 在入口頻道有它需要的權限(包含 Pin Messages)。
60
- bot 不在伺服器裡時,修正方式是一個邀請連結,連結要求的正是這些權限。
63
+ bot 還不在伺服器裡的話,它會給你一個邀請連結,連結已經帶好這些權限。
61
64
  8. 模型登入存在。
62
- 9. `PUBLIC_URL` 是格式正確的位址;加上 `--reachable` 時它還必須有回應,這只有在 bot 執行中才成立。
65
+ 9. `PUBLIC_URL` 的格式正確;加上 `--reachable` 還要求它有回應,所以 bot 得先跑起來。
63
66
 
64
- 任何一項失敗,它就以非零狀態結束,並且不更動它檢查過的任何東西。
65
- 全新的專案只會因為你還沒填的憑證而失敗,而且會指出是哪些。
67
+ 只要有一項失敗,就以非零狀態結束,檢查過程不會改動任何東西。
68
+ 全新的專案只會卡在還沒填的憑證,它會列出是哪幾個。
66
69
 
67
70
  ### `start`
68
71
 
@@ -111,7 +114,25 @@ test("hello greets", async () => {
111
114
 
112
115
  [外掛指南](docs/plugins.md)(英文)說明外掛能新增的每個部分(工具、提示詞區段、智慧體、事件、服務、migration、provider、斜線指令、HTTP 路由等等)、啟動與停止的順序,以及每一種啟動錯誤和它的修正方式。
113
116
  指南裡的範例放在 [`examples/`](examples),測試套件會執行每一個範例。
114
- `pi-roundtable/kit` 提供頻道認領(claim)、工具與呈現用的輔助函式,以及 context 現有服務的純型別名稱;`pi-roundtable/discord` 提供斜線指令註冊器、擁有者指令與面板的輔助函式,以及智慧體面板,是會用到 discord.js 型別的入口(`pi-roundtable/testing` 也透過 `testHost` 組合出的指令用到少數幾個)。這兩個入口的版本規則與主入口相同:1.0 之前,不相容的變更會放在次版本(minor)發佈,並列在變更記錄中。
117
+ `pi-roundtable/kit` 提供頻道認領(claim)、工具與呈現用的輔助函式,以及 context 現有服務的純型別名稱。
118
+ `pi-roundtable/discord` 提供斜線指令註冊器、擁有者指令與面板的輔助函式,以及智慧體面板;它是會用到 discord.js 型別的入口(`pi-roundtable/testing` 也透過 `testHost` 組合出的指令用到少數幾個)。
119
+ 這兩個入口的版本規則與主入口相同:1.0 之前,不相容的變更會放在次版本(minor)發佈,並列在變更記錄中。
120
+
121
+ ## MCP connector
122
+
123
+ 獨立套件 [pi-roundtable-mcp](https://www.npmjs.com/package/pi-roundtable-mcp) 用兩個外掛,把 bot 雙向接上 MCP:
124
+
125
+ - `mcpConnectors`:你在 Discord 用私人表單加入一台 MCP server,例如 Notion、行事曆,或任何用 HTTP 提供 MCP 的服務。
126
+ 接著由你的程式碼把它的工具交給你選的智慧體。
127
+ 每台 server 和它的 token 由你自己架的 [ContextForge](https://github.com/IBM/mcp-context-forge) gateway 保管。
128
+ - `remoteMcp`:Discord 以外的智慧體透過 MCP 傳訊息給你的智慧體,並讀取回答。
129
+ 它也能使用你授權的 Discord 頻道,而且只限你選的操作。
130
+
131
+ ```sh
132
+ bun add pi-roundtable-mcp
133
+ ```
134
+
135
+ 它支援 pi-roundtable 0.4 和 0.5,每個選項都列在它的 README。
115
136
 
116
137
  ## 設定
117
138