Skip to content

Commit e832a0b

Browse files
authored
0.6.0: Port pipecat-subagents into pipecat core (#411)
* Port pipecat-subagents into pipecat core (0.6.0 foundation) Squashed from aleix/port-subagents-to-pipecat: - migrate from pipecat-ai-subagents to in-tree pipecat workers (BaseAgent/LLMAgent -> PipelineWorker; AgentRunner -> PipelineRunner) - adapt #386 (bypass_tutorial) and #410 (init_cekura) to the new PipelineWorker structure - pin pyproject.toml to pipecat-ai/pipecat aleix/port-subagents-to-pipecat branch until upstream PR #4493 merges * stub progress * llm context dump * teardown code complete * client message handler * pre-task agent move over * orchestrator prep * moved task agent over * task agent move * update tests * docs * release: v0.6.0 * fixed config defaults, use pydantic-settings for typing * restore supabase server script * fixed dockerfile uv command * fixed byoa examples and onboarding prompt * fixed task agent onboarding (personal ship) * pin deno version and false out empty envs in config * Fix BYOA worker registry invalidation * Honor edge functions override * Fix BYOA task output type * Drop stale progress expectation * Remove duplicate local API server * Extract event ordering util * Remove player TaskAgent reuse * Align text input with Pipecat mute state * Use typed text append path * pipecat 1.3.0 * ui-agent port (pre subagent / worker migration)
1 parent e9e2a72 commit e832a0b

175 files changed

Lines changed: 7131 additions & 7195 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/byoa-link/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ Path: `--out` value, or `<main-repo-root>/.env.byoa` if not provided. **Never wr
147147
Resolve the main repo root with `git rev-parse --path-format=absolute --git-common-dir` — its parent is the main worktree root whether the caller is in the main checkout or a linked worktree. The `env.byoa.example` template also lives at that root.
148148

149149
```bash
150-
REPO_ROOT="$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)")"
151-
OUT_PATH="${OUT_OVERRIDE:-$REPO_ROOT/.env.byoa}"
150+
PROJECT_ROOT="$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)")"
151+
OUT_PATH="${OUT_OVERRIDE:-$PROJECT_ROOT/.env.byoa}"
152152
umask 077
153-
cp "$REPO_ROOT/env.byoa.example" "$OUT_PATH"
153+
cp "$PROJECT_ROOT/env.byoa.example" "$OUT_PATH"
154154
python3 - "$OUT_PATH" "<character_id>" "<ship_id>" "<wake_secret_hex>" <<'PY'
155155
import sys, pathlib
156156
path, char_id, ship_id, secret = sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4]

.claude/skills/init/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ Generate a universe (5000 sectors, seed 1234) and load it plus quest definitions
8686
```bash
8787
set -a && source .env.supabase && set +a
8888
uv run universe-bang 5000 1234
89-
uv run -m gradientbang.scripts.load_universe_to_supabase --from-json world-data/
90-
uv run -m gradientbang.scripts.load_quests_to_supabase --from-json quest-data/
89+
uv run -m gradientbang.scripts.load_universe_to_supabase --from-json tmp/world-data/
90+
uv run -m gradientbang.scripts.load_quests_to_supabase
9191
```
9292

9393
Redirect output and check for errors. These commands can take a minute.

.claude/skills/load-quests/SKILL.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Load Quest Data
22

3-
Loads quest definitions from JSON files in `quest-data/` into Supabase.
3+
Loads quest definitions from `GRADIENTBANG_QUEST_DATA_DIR` (`data/quests/` by default) into Supabase.
44

55
## Parameters
66

@@ -20,17 +20,17 @@ set -a && source .env.supabase && set +a
2020

2121
Upsert mode (default — updates existing quests, inserts new ones):
2222
```bash
23-
uv run -m gradientbang.scripts.load_quests_to_supabase --from-json quest-data/
23+
uv run -m gradientbang.scripts.load_quests_to_supabase
2424
```
2525

2626
Force mode (wipes all quest definitions and reloads from scratch):
2727
```bash
28-
uv run -m gradientbang.scripts.load_quests_to_supabase --from-json quest-data/ --force
28+
uv run -m gradientbang.scripts.load_quests_to_supabase --force
2929
```
3030

3131
Dry run (validate JSON files without writing to database):
3232
```bash
33-
uv run -m gradientbang.scripts.load_quests_to_supabase --from-json quest-data/ --dry-run
33+
uv run -m gradientbang.scripts.load_quests_to_supabase --dry-run
3434
```
3535

3636
### 3. Verify
@@ -39,7 +39,7 @@ Confirm the output shows "Success!" and check the stats summary for expected que
3939

4040
## Important notes
4141

42-
- Each `.json` file in `quest-data/` represents one quest chain. The loader picks up all `*.json` files in the directory.
42+
- Each `.json` file in `GRADIENTBANG_QUEST_DATA_DIR` represents one quest chain. The loader picks up all `*.json` files in the directory.
4343
- The loader upserts by quest `code`, so it's safe to re-run after editing quest data.
4444
- `--force` deletes ALL quest definitions (cascades to steps and subscriptions) before reloading. Player quest progress (`player_quests`, `player_quest_steps`) is NOT affected — but orphaned progress rows will reference deleted step IDs.
4545
- If you get a PostgREST schema cache error, run: `docker exec supabase_db_gb-world-server psql -U postgres -d postgres -c "NOTIFY pgrst, 'reload schema'"` then retry.

.dockerignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ client
3535
tests
3636
docs
3737
logs
38-
world-data
39-
quest-data
38+
tmp
39+
data
4040
.dockerignore
4141
docker-compose.yml
4242

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
world-data/
2+
tmp/
23
logs/
34
.env
45
.env.*

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.6.0] - 2026-05-26
11+
12+
### Changed
13+
14+
- Centralized runtime configuration in `gradientbang.config` using `pydantic-settings`.
15+
- Repository structure tidy-up and runtime module reorganization under `src/gradientbang/runtime/`.
16+
- Migrated to the latest Pipecat SubAgents spec — `PipelineWorker`-hosted `Orchestrator`, bus-based `TaskAgent` workers, and the universal wake-up handshake aligned to the current `pipecat-ai-subagents` API.
17+
- New-player onboarding now keeps the generated mega-port route as session-scoped private TaskAgent startup context for player-ship tasks, controlled by `BOT_NEW_PLAYER_ONBOARDING`.
18+
- Local player-ship TaskAgents are now one-task workers like local corp-ship TaskAgents; completed player tasks end and remove their worker instead of reusing an idle pipeline.
19+
- Text input now waits on Pipecat user-mute events via `app_resources`, matching voice turn sequencing.
20+
1021
## [0.5.6] - 2026-05-21
1122

1223
### Fixed

CLAUDE.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,28 @@ Gradient Bang is an online multiplayer universe where gameplay and systems are d
1212

1313
Most important code in this repo:
1414

15-
- `src/gradientbang/pipecat_server/bot.py` - pipeline wiring, MainAgent (inline), client message handlers
16-
- `src/gradientbang/pipecat_server/subagents/` - VoiceAgent, EventRelay, TaskAgent, UIAgent
15+
- `src/gradientbang/bot.py` - Pipecat session entrypoint and voice pipeline wiring
16+
- `src/gradientbang/runtime/` - Orchestrator, EventRelay, client messages, task agents, BYOA, bus protocol
17+
- `src/gradientbang/game/` - game API client and event transport adapters
1718
- `deployment/supabase/functions/` - all game server logic
1819
- `client/` - web client for the game
1920

2021
## Bot architecture
2122

22-
`bot.py` creates all components and wires them together:
23+
Core runtime shape:
2324

24-
- **MainAgent** (inline in `bot.py`) - `BaseAgent` owning transport pipeline (STT/TTS) with `BusBridgeProcessor`
25-
- **VoiceAgent** (`subagents/voice_agent.py`) - `LLMAgent` with 16 game tools; spawns TaskAgent children per task, broadcasts game events to bus
26-
- **TaskAgent** (`subagents/task_agent.py`) - `LLMAgent` with 31 game tools; self-contained autonomous agent, receives events via bus
27-
- **EventRelay** (`subagents/event_relay.py`) - single game event subscriber, declarative routing engine; feeds VoiceAgent which distributes to TaskAgents via bus
28-
- **UIAgent** (`subagents/ui_agent.py`) - parallel pipeline branch for autonomous UI control (not on bus)
25+
- The web client connects to the bot over WebRTC. Audio uses the WebRTC transport; RTVI messages flow both ways for client/server events and custom client messages.
26+
- `bot.py` builds the live Pipecat voice pipeline: transport, STT, voice LLM, TTS, aggregators, and the `player` `PipelineWorker`.
27+
- The `player` worker owns Pipecat lifecycle and bus identity. The voice LLM runs inline in this pipeline.
28+
- `Orchestrator` is a plain Python coordinator attached to the `player` worker. It owns session bootstrap, voice tools, client-message routing, event relay integration, task lifecycle, BYOA, and shutdown.
29+
- `AsyncGameClient` calls Supabase Edge Functions and manages session-scoped pubsub event delivery.
30+
- Edge Functions mutate database state and emit game events. The database is the source of truth for world state, ships, corporations, tasks, events, and BYOA config.
31+
- `EventRelay` receives game events and routes them to RTVI, voice LLM context, and the subagent bus.
32+
- `VoiceRuntime` binds the voice tool schema to Orchestrator handler methods.
33+
- `TaskAgent` workers are children of the `player` worker and communicate with Orchestrator over bus messages.
34+
- BYOA agents use the same bus protocol as in-process task agents, but are externally hosted and woken by the runtime.
2935

30-
Tool schemas are defined once in `src/gradientbang/tools/` and shared by VoiceAgent, TaskAgent, and UIAgent.
31-
32-
See `src/gradientbang/pipecat_server/subagents/CLAUDE.md` for detailed architecture docs.
36+
Tool schemas live in `src/gradientbang/runtime/tool_schema.py`.
3337

3438
## Local dev (quick)
3539

@@ -48,6 +52,7 @@ See `src/gradientbang/pipecat_server/subagents/CLAUDE.md` for detailed architect
4852
- To run Supabase edge functions: `npx supabase functions serve --workdir deployment --no-verify-jwt --env-file .env.supabase`.
4953
- To start the bot: `set -a && source .env.supabase && set +a && uv run bot --host 0.0.0.0`.
5054
- If you need to run edge functions or start the bot, redirect ALL output to a file. Do NOT use `tee`; use `head`, `tail`, `grep`, etc. to inspect log files.
55+
- All Python env vars are inventoried in `src/gradientbang/config.py`. When adding or removing an env var anywhere in the Python code, keep that file in sync.
5156

5257
## Testing
5358

0 commit comments

Comments
 (0)