Files
Memoh/db/migrations/0043_drop_subagents_add_parent_session.up.sql
T
Acbox Liu b3a39ad93d refactor: replace persistent subagents with ephemeral spawn tool (#280)
* refactor: replace persistent subagents with ephemeral spawn tool (#subagent)

- Drop subagents table, remove all persistent subagent infrastructure
- Add 'subagent' session type with parent_session_id on bot_sessions
- Rewrite subagent tool as single 'spawn' tool with parallel execution
- Create system_subagent.md prompt, add _subagent.md include for chat
- Limit subagent tools to file, exec, web_search, web_fetch only
- Merge subagent token usage into parent chat session in reporting
- Remove frontend subagent management page, update chat UI for spawn
- Fix UTF-8 truncation in session title, fix query not passed to agent

* refactor: remove history message page
2026-03-22 19:03:28 +08:00

16 lines
652 B
SQL

-- 0043_drop_subagents_add_parent_session
-- Drop the subagents table (no longer needed) and add parent_session_id to bot_sessions for subagent session tracking.
DROP TABLE IF EXISTS subagents;
ALTER TABLE bot_sessions
DROP CONSTRAINT IF EXISTS bot_sessions_type_check;
ALTER TABLE bot_sessions
ADD CONSTRAINT bot_sessions_type_check CHECK (type IN ('chat', 'heartbeat', 'schedule', 'subagent'));
ALTER TABLE bot_sessions
ADD COLUMN IF NOT EXISTS parent_session_id UUID REFERENCES bot_sessions(id) ON DELETE SET NULL;
CREATE INDEX IF NOT EXISTS idx_bot_sessions_parent ON bot_sessions(parent_session_id) WHERE parent_session_id IS NOT NULL;