From b7f77d8f600dbf8edfeb30a02b5bf2e90835ac85 Mon Sep 17 00:00:00 2001 From: Hibryda Date: Fri, 6 Mar 2026 16:54:46 +0100 Subject: [PATCH] chore: update meta files for agent teams session work --- .claude/CLAUDE.md | 4 ++-- CHANGELOG.md | 8 ++++++++ CLAUDE.md | 10 +++++----- README.md | 4 ++-- TODO.md | 5 ++++- 5 files changed, 21 insertions(+), 10 deletions(-) diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md index e03bbc4..63a507c 100644 --- a/.claude/CLAUDE.md +++ b/.claude/CLAUDE.md @@ -4,7 +4,7 @@ - v1 is a single-file Python app (`bterminal.py`). Changes are localized. - v2 docs are in `docs/`. Architecture decisions are in `docs/task_plan.md`. -- All 6 phases complete + extras (SSH, ctx, themes, detached mode, auto-updater, shiki, copy/paste, session resume, drag-resize, session groups, Deno sidecar, 104 vitest + 29 cargo tests). +- Phases 1-6 complete + Phase 7 (agent teams/subagent support) in progress. Extras: SSH, ctx, themes, detached mode, auto-updater, shiki, copy/paste, session resume, drag-resize, session groups, Deno sidecar, 104 vitest + 29 cargo tests. - Consult Memora (tag: `bterminal`) before making architectural changes. ## Documentation References @@ -27,7 +27,7 @@ - WebKit2GTK has no WebGL — xterm.js must use Canvas addon explicitly. - Agent sessions use `claude` CLI with `--output-format stream-json` (not Agent SDK npm package). All output goes through the adapter layer (`src/lib/adapters/sdk-messages.ts`). - Sidecar uses Deno-first + Node.js fallback (`sidecar/agent-runner-deno.ts` preferred, `sidecar/agent-runner.ts` fallback). SidecarCommand struct in sidecar.rs abstracts runtime. Communicates with Rust via stdio NDJSON. -- Agent dispatcher (`src/lib/agent-dispatcher.ts`) is a singleton that routes sidecar events to the agent store. +- Agent dispatcher (`src/lib/agent-dispatcher.ts`) is a singleton that routes sidecar events to the agent store. Also handles subagent pane spawning (SUBAGENT_TOOL_NAMES detection, toolUseToChildPane routing map). - Maximum 4 active xterm.js instances to avoid WebKit2GTK memory issues. - Store files using Svelte 5 runes (`$state`, `$derived`) MUST have `.svelte.ts` extension (not `.ts`). Import with `.svelte` suffix. Plain `.ts` compiles but fails at runtime with "rune_outside_svelte". - Session persistence uses rusqlite (bundled) with WAL mode. Data dir: `dirs::data_dir()/bterminal/sessions.db`. diff --git a/CHANGELOG.md b/CHANGELOG.md index 11364c4..5df418f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- Agent teams/subagent support (Phase 7): auto-detects subagent tool calls ('Agent', 'Task', 'dispatch_agent'), spawns child agent panes with parent/child navigation, routes messages via parentId field +- Agent store parent/child hierarchy: AgentSession extended with parentSessionId, parentToolUseId, childSessionIds; findChildByToolUseId() and getChildSessions() query functions +- AgentPane parent link bar: SUB badge with navigate-to-parent button for subagent panes +- AgentPane children bar: clickable chips per child subagent with status-colored indicators (running/done/error) +- SessionList subagent icon: subagent panes show '↳' instead of '*' in sidebar - Session groups/folders: group_name column in sessions table, setPaneGroup in layout store, collapsible group headers in sidebar with arrow/count, right-click pane to set group - Auto-update signing key: generated minisign keypair, pubkey configured in tauri.conf.json updater section - Deno-first sidecar: SidecarCommand struct in sidecar.rs, resolve_sidecar_command() prefers Deno (runs TS directly) with Node.js fallback, both runners bundled via tauri.conf.json resources @@ -26,6 +31,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - tempfile dev dependency for Rust test isolation ### Changed +- Agent dispatcher refactored to split messages: parentId-bearing messages routed to child panes via toolUseToChildPane Map, main session messages stay in parent +- Agent store createAgentSession() now accepts optional parent parameter for registering bidirectional parent/child links +- Agent store removeAgentSession() cleans up parent's childSessionIds on removal - Sidecar manager refactored from Node.js-only to Deno-first with Node.js fallback (SidecarCommand abstraction) - Session struct: added group_name field with serde default - SessionDb: added update_group method, list/save queries updated for group_name column diff --git a/CLAUDE.md b/CLAUDE.md index 081dba2..a71d819 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -2,7 +2,7 @@ ## Project Overview -Terminal emulator with SSH and Claude Code session management. v1 (GTK3+VTE Python) is production-stable. v2 redesign (Tauri 2.x + Svelte 5 + Claude Agent SDK) all 6 phases complete plus extras (SSH management, ctx integration, theme flavors, detached pane mode, auto-updater). Packaging: .deb + AppImage via GitHub Actions CI. +Terminal emulator with SSH and Claude Code session management. v1 (GTK3+VTE Python) is production-stable. v2 redesign (Tauri 2.x + Svelte 5 + Claude Agent SDK) Phases 1-6 complete plus Phase 7 (agent teams/subagent support) in progress. Packaging: .deb + AppImage via GitHub Actions CI. - **Repository:** github.com/DexterFromLab/BTerminal - **License:** MIT @@ -22,7 +22,7 @@ Terminal emulator with SSH and Claude Code session management. v1 (GTK3+VTE Pyth | `install-v2.sh` | v2 build-from-source installer (Node.js 20+, Rust 1.77+, system libs) | | `.github/workflows/release.yml` | CI: builds .deb + AppImage on v* tags, uploads to GitHub Releases | | `docs/task_plan.md` | v2 architecture decisions and strategies | -| `docs/phases.md` | v2 implementation phases (1-6) | +| `docs/phases.md` | v2 implementation phases (1-7) | | `docs/findings.md` | v2 research findings | | `docs/progress.md` | Session progress log | | `v2/src-tauri/src/pty.rs` | PTY backend (portable-pty, PtyManager) | @@ -32,13 +32,13 @@ Terminal emulator with SSH and Claude Code session management. v1 (GTK3+VTE Pyth | `v2/src-tauri/src/watcher.rs` | FileWatcherManager (notify crate, file change events) | | `v2/src-tauri/src/ctx.rs` | CtxDb (read-only access to ~/.claude-context/context.db) | | `v2/src/lib/stores/layout.svelte.ts` | Layout store (panes, presets, groups, persistence, Svelte 5 runes) | -| `v2/src/lib/stores/agents.svelte.ts` | Agent session store (messages, cost) | +| `v2/src/lib/stores/agents.svelte.ts` | Agent session store (messages, cost, parent/child hierarchy) | | `v2/src/lib/components/Terminal/TerminalPane.svelte` | xterm.js terminal pane | | `v2/src/lib/components/Agent/AgentPane.svelte` | Agent session pane (prompt, messages, cost) | | `v2/src/lib/adapters/pty-bridge.ts` | PTY IPC wrapper (Tauri invoke/listen) | | `v2/src/lib/adapters/agent-bridge.ts` | Agent IPC wrapper (Tauri invoke/listen) | | `v2/src/lib/adapters/sdk-messages.ts` | SDK message adapter (stream-json parser) | -| `v2/src/lib/agent-dispatcher.ts` | Routes sidecar events to agent store + toast notifications | +| `v2/src/lib/agent-dispatcher.ts` | Routes sidecar events to agent store + subagent pane spawning + toast notifications | | `v2/src/lib/adapters/file-bridge.ts` | File watcher IPC wrapper | | `v2/src/lib/adapters/settings-bridge.ts` | Settings IPC wrapper (get/set/list) | | `v2/src/lib/adapters/ctx-bridge.ts` | ctx database IPC wrapper | @@ -74,7 +74,7 @@ Terminal emulator with SSH and Claude Code session management. v1 (GTK3+VTE Pyth - Context DB: `~/.claude-context/context.db` - Theme: Catppuccin Mocha -## v2 Stack (all phases complete, branch: v2-mission-control) +## v2 Stack (Phases 1-6 complete, Phase 7 in progress, branch: v2-mission-control) - Tauri 2.x (Rust backend) + Svelte 5 (frontend) - xterm.js with Canvas addon (no WebGL on WebKit2GTK) diff --git a/README.md b/README.md index 81e7fb5..7ac8c19 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Terminal with session panel (MobaXterm-style), built with GTK 3 + VTE. Catppuccin Mocha theme. -> **v2 all phases complete + extras:** Multi-session Claude agent dashboard using Tauri 2.x + Svelte 5. Features: multi-pane terminal with PTY backend and copy/paste, agent panes with structured output, tree visualization with subtree cost and session resume, session groups/folders with collapsible sidebar headers, SSH session management, ctx context database viewer, SQLite session persistence with layout restore, live markdown file viewer with Shiki syntax highlighting, global status bar with cost tracking, toast notifications, settings dialog with theme flavors (Catppuccin Latte/Frappe/Macchiato/Mocha) and live hot-swap, detached pane mode (pop-out windows), pane drag-resize handles, auto-updater plugin with signing key configured, Deno-first sidecar with Node.js fallback, CSS Grid tiling, .deb + AppImage packaging, GitHub Actions CI, 104 vitest + 29 cargo tests. Branch `v2-mission-control`. See [docs/task_plan.md](docs/task_plan.md) for architecture and [docs/phases.md](docs/phases.md) for implementation plan. +> **v2 Phases 1-6 complete, Phase 7 (agent teams) in progress:** Multi-session Claude agent dashboard using Tauri 2.x + Svelte 5. Features: multi-pane terminal with PTY backend and copy/paste, agent panes with structured output, tree visualization with subtree cost and session resume, **subagent/agent-teams support** (auto-spawns child panes for subagents with parent/child navigation), session groups/folders with collapsible sidebar headers, SSH session management, ctx context database viewer, SQLite session persistence with layout restore, live markdown file viewer with Shiki syntax highlighting, global status bar with cost tracking, toast notifications, settings dialog with theme flavors (Catppuccin Latte/Frappe/Macchiato/Mocha) and live hot-swap, detached pane mode (pop-out windows), pane drag-resize handles, auto-updater plugin with signing key configured, Deno-first sidecar with Node.js fallback, CSS Grid tiling, .deb + AppImage packaging, GitHub Actions CI, 104 vitest + 29 cargo tests. Branch `v2-mission-control`. See [docs/task_plan.md](docs/task_plan.md) for architecture and [docs/phases.md](docs/phases.md) for implementation plan. ![BTerminal](screenshot.png) @@ -114,7 +114,7 @@ Context database: `~/.claude-context/context.db` | Document | Description | |----------|-------------| | [docs/task_plan.md](docs/task_plan.md) | v2 architecture decisions, error handling, testing strategy | -| [docs/phases.md](docs/phases.md) | v2 implementation phases (1-6) with checklists | +| [docs/phases.md](docs/phases.md) | v2 implementation phases (1-7) with checklists | | [docs/findings.md](docs/findings.md) | Research findings (Agent SDK, Tauri, xterm.js, performance) | | [docs/progress.md](docs/progress.md) | Session-by-session progress log | diff --git a/TODO.md b/TODO.md index bcb9cdf..6c2d024 100644 --- a/TODO.md +++ b/TODO.md @@ -6,10 +6,13 @@ - [ ] **Deno sidecar real-world testing** -- Integrated into sidecar.rs (Deno-first + Node.js fallback). Needs testing with real claude CLI and startup time benchmark vs Node.js. - [ ] **E2E testing (Playwright/WebDriver)** -- Scaffold at v2/tests/e2e/README.md. Needs display server to run. Test: open terminal, run command, open agent, verify output. - [ ] **Multi-machine support** -- Remote agents via WebSocket (Phase 7+ feature). -- [ ] **Agent Teams integration** -- Experimental Anthropic feature. Each teammate gets its own pane (Phase 7+ feature). +- [ ] **Agent Teams real-world testing** -- Frontend routing implemented (Phase 7). Needs testing with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 and real subagent spawning. +- [ ] **Update dispatcher tests for subagent routing** -- New subagent pane spawning and message routing logic in agent-dispatcher.ts not yet covered by tests. +- [ ] **Subagent cost aggregation** -- Aggregate child session costs in parent pane display. ## Completed +- [x] **Agent Teams frontend support** -- Subagent pane spawning, parent/child navigation, message routing by parentId, SUBAGENT_TOOL_NAMES detection in dispatcher. | Done: 2026-03-06 - [x] **Session groups/folders** -- group_name column in sessions table, setPaneGroup in layout store, collapsible group headers in sidebar, right-click to set group. | Done: 2026-03-06 - [x] **Auto-update signing key** -- Generated minisign keypair, pubkey set in tauri.conf.json. | Done: 2026-03-06 - [x] **Deno sidecar integration** -- SidecarCommand struct, resolve_sidecar_command() with Deno-first + Node.js fallback, both runners bundled in tauri.conf.json resources. | Done: 2026-03-06