pi-roundtable 0.7.18 → 0.8.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 +44 -0
- package/README.md +44 -11
- package/README.zh-TW.md +44 -9
- package/docs/migrating-0.8.md +132 -0
- package/docs/plugins.md +268 -23
- package/examples/discord-adapter.test.ts +42 -0
- package/examples/discord-adapter.ts +26 -0
- package/examples/echo-runtime.ts +1 -1
- package/examples/headless.test.ts +72 -0
- package/examples/headless.ts +31 -0
- package/examples/http.test.ts +31 -1
- package/examples/http.ts +39 -0
- package/package.json +3 -2
- package/src/cli/cli.ts +15 -4
- package/src/cli/doctor.ts +21 -5
- package/src/cli/init.ts +9 -1
- package/src/cli/project.ts +28 -2
- package/src/cli/templates.ts +46 -14
- package/src/core/agents/agent-team-fixture.ts +6 -0
- package/src/core/agents/team-turns.ts +6 -1
- package/src/core/builtin/agent-server.ts +30 -95
- package/src/core/builtin/modules.ts +133 -34
- package/src/core/builtin/stores.ts +29 -14
- package/src/core/config/adapters.ts +57 -0
- package/src/core/config/config.ts +174 -77
- package/src/core/contract/channels.ts +4 -0
- package/src/core/contract/providers.ts +3 -2
- package/src/core/contract/runtime.ts +8 -4
- package/src/core/contract/surface.ts +13 -0
- package/src/core/conversations/conversation-registry.ts +42 -0
- package/src/core/conversations/conversation-store.ts +113 -0
- package/src/core/conversations/conversations-plugin.ts +29 -0
- package/src/core/define-roundtable.ts +124 -54
- package/src/core/discord/discord-adapter.ts +9 -0
- package/src/core/discord/owner-cards.ts +19 -8
- package/src/core/domain/conversation.ts +5 -0
- package/src/core/domain/owner-prompts.ts +1 -1
- package/src/core/domain/ports.ts +6 -0
- package/src/core/domain/progress.ts +10 -0
- package/src/core/events.ts +1 -0
- package/src/core/host.ts +6 -3
- package/src/core/http/listeners.ts +174 -21
- package/src/core/http/websocket.ts +316 -0
- package/src/core/i18n/cards.ts +5 -7
- package/src/core/modules/memory/owner-memory.ts +5 -3
- package/src/core/ops/error-reporter.ts +24 -12
- package/src/core/plugin.ts +14 -0
- package/src/core/registry/providers.ts +1 -1
- package/src/core/routing/channel-router.ts +8 -0
- package/src/core/routing/conversation-turns.ts +55 -1
- package/src/core/routing/surface-port.ts +3 -0
- package/src/core/runtime/extensions/confirmation-gate.ts +10 -2
- package/src/core/runtime/extensions/self-compact-guard.ts +11 -0
- package/src/core/runtime/pending-confirmation-store.ts +42 -4
- package/src/core/runtime/pi-agent-runtime.ts +13 -6
- package/src/core/runtime/prompt-slot.ts +2 -2
- package/src/core/runtime/runtime-plugin.ts +160 -0
- package/src/core/runtime/turn-progress.ts +116 -0
- package/src/core/services.ts +15 -1
- package/src/core/shared/unix-server.ts +35 -5
- package/src/core/testing/modules.ts +47 -23
- package/src/core/testing/surface-contract.ts +383 -0
- package/src/core/testing/test-host.ts +27 -9
- package/src/discord/index.ts +2 -0
- package/src/index.ts +18 -0
- package/src/testing.ts +41 -5
- package/templates/adapters/web/.env.example +24 -0
- package/templates/adapters/web/README.md +15 -0
- package/templates/adapters/web/package.json.tmpl +26 -0
- package/templates/adapters/web/persona/assistant.md +2 -0
- package/templates/adapters/web/roundtable.config.ts +55 -0
- package/templates/package.json.tmpl +1 -0
- package/templates/plugins/self-compact.ts +11 -0
- package/templates/roundtable.config.ts +2 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__PROJECT__",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"engines": {
|
|
6
|
+
"bun": ">=1.3.0"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"doctor": "roundtable doctor",
|
|
10
|
+
"start": "roundtable start",
|
|
11
|
+
"typecheck": "tsc --noEmit",
|
|
12
|
+
"lint": "biome check .",
|
|
13
|
+
"test": "bun test"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"pi-roundtable": "__VERSION__",
|
|
17
|
+
"pi-roundtable-webchat": "__VERSION__",
|
|
18
|
+
"pi-self-compact": "0.2.0",
|
|
19
|
+
"typebox": "1.3.34"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@biomejs/biome": "2.5.15",
|
|
23
|
+
"@types/bun": "1.4.2",
|
|
24
|
+
"typescript": "7.0.2"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import type { RoundtableConfig } from "pi-roundtable";
|
|
3
|
+
import { oidcJwtVerifier, webChat } from "pi-roundtable-webchat";
|
|
4
|
+
import { hello } from "./plugins/hello.ts";
|
|
5
|
+
import { selfCompact } from "./plugins/self-compact.ts";
|
|
6
|
+
|
|
7
|
+
// Credentials and ids come from .env, which Bun loads on its own; nothing secret belongs in this file.
|
|
8
|
+
const env = (name: string): string => process.env[name] ?? "";
|
|
9
|
+
const list = (name: string): string[] =>
|
|
10
|
+
env(name)
|
|
11
|
+
.split(",")
|
|
12
|
+
.map((value) => value.trim())
|
|
13
|
+
.filter(Boolean);
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
name: "Roundtable",
|
|
17
|
+
// The operator who runs this host. People sign in through your OpenID Connect provider instead.
|
|
18
|
+
owner: { id: "operator", name: env("OWNER_NAME") },
|
|
19
|
+
database: { url: env("DATABASE_URL") },
|
|
20
|
+
// Paths are relative to the project directory, where the roundtable command runs.
|
|
21
|
+
dataDir: "./data",
|
|
22
|
+
model: env("MODEL"),
|
|
23
|
+
// Serve behind a reverse proxy that terminates TLS; the web chat lives under /chat.
|
|
24
|
+
http: { port: 3000, hostname: "127.0.0.1" },
|
|
25
|
+
plugins: [
|
|
26
|
+
selfCompact,
|
|
27
|
+
hello,
|
|
28
|
+
webChat({
|
|
29
|
+
// Accepts only a person's access token. Pin your tenant and pick a stable subject claim
|
|
30
|
+
// with subjectClaim and check: see "Provider settings" in the pi-roundtable-webchat README.
|
|
31
|
+
verifier: oidcJwtVerifier({
|
|
32
|
+
jwksUrl: env("OIDC_JWKS_URL"),
|
|
33
|
+
issuers: [env("OIDC_ISSUER")],
|
|
34
|
+
audiences: [env("OIDC_AUDIENCE")],
|
|
35
|
+
}),
|
|
36
|
+
// Members and admins come from the token's roles; owners only from speaker ids you list.
|
|
37
|
+
access: {
|
|
38
|
+
members: { roles: list("CHAT_MEMBER_ROLES") },
|
|
39
|
+
admins: { roles: list("CHAT_ADMIN_ROLES") },
|
|
40
|
+
},
|
|
41
|
+
origins: list("CHAT_ORIGINS"),
|
|
42
|
+
personas: [
|
|
43
|
+
{
|
|
44
|
+
kind: "assistant",
|
|
45
|
+
label: "Assistant",
|
|
46
|
+
prompt: () => readFileSync("./persona/assistant.md", "utf8"),
|
|
47
|
+
// The tools of its turns, by name. Leave out schedule_* and delegate_task, which a web
|
|
48
|
+
// conversation cannot hear back from, and web_search and fetch_content unless people
|
|
49
|
+
// may make this server fetch any address, internal ones included.
|
|
50
|
+
selection: { tools: ["hello_greet"], groups: [] },
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
}),
|
|
54
|
+
],
|
|
55
|
+
} satisfies RoundtableConfig;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { definePlugin } from "pi-roundtable";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Loads the Pi package pi-self-compact in every conversation session. Its compact_session tool
|
|
5
|
+
* lets a turn compact a long conversation; every session carries it, so startup stops with
|
|
6
|
+
* "required tools are not registered: compact_session" when no plugin loads it.
|
|
7
|
+
*/
|
|
8
|
+
export const selfCompact = definePlugin({
|
|
9
|
+
name: "self-compact",
|
|
10
|
+
setup: () => ({ piPackages: ["pi-self-compact"] }),
|
|
11
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RoundtableConfig } from "pi-roundtable";
|
|
2
2
|
import { agents } from "./agents.ts";
|
|
3
3
|
import { hello } from "./plugins/hello.ts";
|
|
4
|
+
import { selfCompact } from "./plugins/self-compact.ts";
|
|
4
5
|
|
|
5
6
|
// Credentials and ids come from .env, which Bun loads on its own; nothing secret belongs in this file.
|
|
6
7
|
const env = (name: string): string => process.env[name] ?? "";
|
|
@@ -20,5 +21,5 @@ export default {
|
|
|
20
21
|
http: { publicUrl: env("PUBLIC_URL") },
|
|
21
22
|
prompts: { shared: "./persona/shared.md" },
|
|
22
23
|
agents,
|
|
23
|
-
plugins: [hello],
|
|
24
|
+
plugins: [selfCompact, hello],
|
|
24
25
|
} satisfies RoundtableConfig;
|