Commit graph

270 commits

Author SHA1 Message Date
Hibryda
af0eb362e6 docs: update meta files for SDK migration and AgentPane onDestroy bug 2026-03-06 22:57:55 +01:00
Hibryda
bb530edd28 docs: update docs for sidecar SDK migration and AgentPane bug discovery 2026-03-06 22:57:47 +01:00
Hibryda
323703caba feat(v2): migrate sidecar from raw CLI spawning to @anthropic-ai/claude-agent-sdk
Claude CLI v2.1.69 hangs silently when spawned via child_process.spawn()
with piped stdio (known bug github.com/anthropics/claude-code/issues/6775).

Replace raw CLI spawning in both sidecar runners with the SDK's query()
function, which handles subprocess management internally. SDK message
format matches CLI stream-json, so the sdk-messages.ts adapter is
unchanged.

- agent-runner.ts: use SDK query() with AbortController for stop
- agent-runner-deno.ts: use npm:@anthropic-ai/claude-agent-sdk import
- sidecar.rs: add --allow-write and --allow-net Deno permissions
- package.json: add @anthropic-ai/claude-agent-sdk ^0.2.70, build:sidecar script
2026-03-06 22:57:36 +01:00
Hibryda
fdd1884015 docs: update meta files for CLAUDE* env var fix and sidecar constraint 2026-03-06 22:12:23 +01:00
Hibryda
ce79ae671a fix(v2): strip all CLAUDE* env vars in sidecar to prevent CLI nesting detection
When BTerminal is launched from a Claude Code terminal, ~8 CLAUDE*
env vars leak into the sidecar child processes. The claude CLI detects
these as nesting indicators and silently hangs. Previously only
CLAUDECODE was removed; now all CLAUDE-prefixed vars are stripped
in both Node.js and Deno sidecar runners.
2026-03-06 22:12:16 +01:00
Hibryda
4c06b5f121 docs: update docs for TCP probe refactor and frontend reconnection listeners
Replace stale attempt_ws_connect() references with attempt_tcp_probe()
across all docs. Add progress entry for reconnection hardening session.
Update CHANGELOG with new entries and probe refactor change.
2026-03-06 21:50:54 +01:00
Hibryda
71100da125 feat(v2): refactor reconnection probe to TCP-only and add frontend listeners
Replace attempt_ws_connect() with attempt_tcp_probe() in RemoteManager to
avoid allocating per-connection resources (PtyManager, SidecarManager) on
the relay during reconnection probes. Add onRemoteMachineReconnecting and
onRemoteMachineReconnectReady event listeners in remote-bridge.ts. Wire
machines store to auto-reconnect when relay becomes reachable.
2026-03-06 21:50:45 +01:00
Hibryda
218570ac35 docs: update docs for relay hardening, reconnection, and session wrap
Update multi-machine docs with reconnection implementation details,
command response propagation, and pty_created confirmation flow.
Mark reconnection as complete in phases.md, progress.md, TODO.md.
Update CLAUDE.md files with reconnection and relay response info.
Add CHANGELOG entries for new features.
2026-03-06 19:49:28 +01:00
Hibryda
b0cce7ae4f feat(v2): add relay response propagation and reconnection with exponential backoff
Relay (bterminal-relay): command handlers now send structured responses
(pty_created, pong, error) back via shared event channel with commandId
for correlation. New send_error() helper replaces log-only error
reporting.

RemoteManager (remote.rs): exponential backoff reconnection on
disconnect (1s/2s/4s/8s/16s/30s cap). Uses attempt_ws_connect() probe
with 5s timeout. Emits remote-machine-reconnecting and
remote-machine-reconnect-ready events. Handles pty_created relay event
as remote-pty-created Tauri event.
2026-03-06 19:49:19 +01:00
Hibryda
0a17c09a46 docs: update docs for multi-machine implementation (Phases A-D)
Update phases.md with completed multi-machine phases A-D. Add session
entry to progress.md. Update task_plan.md decisions log and open
questions. Update multi-machine.md status to implemented. Update
CLAUDE.md files with new paths and deps. Add multi-machine section to
README.md. Mark multi-machine as done in TODO.md with new follow-up
items. Add changelog entries for all multi-machine components.
2026-03-06 19:06:00 +01:00
Hibryda
5503340e87 feat(v2): add frontend remote machine integration
remote-bridge.ts adapter for machine management IPC. machines.svelte.ts
store for remote machine state. Layout store extended with
remoteMachineId on Pane interface. agent-bridge.ts and pty-bridge.ts
route to remote commands when remoteMachineId is set. SettingsDialog
gains Remote Machines section. Sidebar auto-groups remote panes by
machine label.
2026-03-06 19:05:53 +01:00
Hibryda
0b39133d66 feat(v2): add RemoteManager for multi-machine WebSocket connections
New remote.rs module in src-tauri with WebSocket client connections to
bterminal-relay instances. Machine lifecycle: add/remove/connect/
disconnect. 12 new Tauri commands for remote operations. Heartbeat
ping every 15s. lib.rs updated with remote commands and AppState.
2026-03-06 19:05:47 +01:00
Hibryda
cf37b572cf feat(v2): add bterminal-relay WebSocket server binary
Standalone Rust binary for remote machine management. WebSocket server
with token auth (--port, --token, --insecure CLI flags via clap).
Routes RelayCommand to PtyManager/SidecarManager from bterminal-core,
forwards RelayEvent over WebSocket. Rate limiting on auth failures
(10 attempts, 5min lockout). Per-connection isolated managers.
2026-03-06 19:05:42 +01:00
Hibryda
f894c2862c refactor(v2): extract bterminal-core crate with EventSink trait
Create Cargo workspace at v2/ level with members: src-tauri,
bterminal-core, bterminal-relay. Extract PtyManager and SidecarManager
into shared bterminal-core crate with EventSink trait for abstracting
event emission. TauriEventSink wraps AppHandle. src-tauri pty.rs and
sidecar.rs become thin re-exports. Move Cargo.lock to workspace root.
Add v2/target/ to .gitignore.
2026-03-06 19:05:35 +01:00
Hibryda
250ea17d3e chore: update meta files for multi-machine architecture session 2026-03-06 18:46:03 +01:00
Hibryda
04a7a4bb94 docs: add multi-machine support architecture design
Full WebSocket architecture spec for remote agent/terminal management:
bterminal-relay binary, RemoteManager, NDJSON protocol, pre-shared
token + TLS auth, 4-phase implementation plan (A-D).
2026-03-06 18:45:56 +01:00
Hibryda
86fbe3e762 chore: update meta files for subagent cost and dispatcher tests session 2026-03-06 17:12:58 +01:00
Hibryda
fc429a5095 docs: update docs for subagent cost aggregation, dispatcher tests, Phase 7 complete 2026-03-06 17:12:52 +01:00
Hibryda
097b4b2ee7 test(v2): add 10 subagent routing tests for agent dispatcher
Tests cover: spawn on Agent/Task tool_call, skip non-subagent tools,
deduplicate panes for same toolUseId, reuse existing child sessions,
route child messages/init/cost by parentId, fallback titles and groups.
Total: 28 dispatcher tests, 114 vitest tests overall.
2026-03-06 17:12:43 +01:00
Hibryda
90efeea507 feat(v2): add recursive subagent cost aggregation in agent store and pane
getTotalCost() recursively aggregates costUsd, inputTokens, outputTokens
across parent and all child sessions. AgentPane done-bar displays total
cost in yellow when children are present and total exceeds parent cost.
2026-03-06 17:12:31 +01:00
Hibryda
b7f77d8f60 chore: update meta files for agent teams session work 2026-03-06 16:54:46 +01:00
Hibryda
a34687f844 docs: update docs for Phase 7 agent teams and subagent support 2026-03-06 16:54:35 +01:00
Hibryda
07fc52b958 feat(v2): add agent teams support with subagent pane spawning and routing
Detect subagent tool_call events (Agent/Task/dispatch_agent), auto-spawn
child agent panes with parent/child navigation. Messages with parentId
are routed to child panes; parent session keeps its own messages.

- agents.svelte.ts: parent/child hierarchy fields, findChildByToolUseId,
  getChildSessions, parent-aware createAgentSession/removeAgentSession
- agent-dispatcher.ts: SUBAGENT_TOOL_NAMES detection, toolUseToChildPane
  routing map, spawnSubagentPane with auto-grouping under parent title
- AgentPane.svelte: parent link bar (SUB badge), children bar (chips
  with status colors), clickable navigation between parent/child
- SessionList.svelte: subagent panes show arrow icon instead of asterisk
2026-03-06 16:54:27 +01:00
Hibryda
d021061b8a docs: update all docs for session groups, Deno sidecar, signing key, and tests
Update progress log, phases, task_plan decisions, CLAUDE.md files,
README, TODO, and CHANGELOG to reflect session groups, Deno-first
sidecar integration, auto-update signing key, and 104-test suite.
2026-03-06 15:42:44 +01:00
Hibryda
020dc20d4f test(v2): add integration tests for layout, agent-bridge, and dispatcher
Add 59 new vitest tests: layout.test.ts (30), agent-bridge.test.ts (11),
agent-dispatcher.test.ts (18). Fix unused import in sdk-messages.test.ts.
Add WebDriver E2E scaffold README. Total: 104 vitest + 29 cargo tests.
2026-03-06 15:42:34 +01:00
Hibryda
a2bc8838b4 feat(v2): Deno-first sidecar with Node.js fallback and signing key
Refactor SidecarManager to use SidecarCommand struct abstracting
runtime choice. resolve_sidecar_command() prefers Deno (runs TS
directly, no build step), falls back to Node.js if deno not in PATH.
Both runners bundled in tauri.conf.json resources. Set auto-update
signing pubkey in updater config.
2026-03-06 15:42:26 +01:00
Hibryda
035d4186fa feat(v2): add session groups with collapsible sidebar headers
Add group_name column to sessions table with ALTER TABLE migration,
setPaneGroup in layout store, grouped sidebar rendering with Svelte 5
snippets, and right-click to assign group via prompt dialog.
2026-03-06 15:42:16 +01:00
Hibryda
f349f3bb14 docs: update all docs for polish session — copy/paste, theme hot-swap, tests, drag-resize
- progress.md: add session log for copy/paste, theme hot-swap, tree enhancements,
  session resume, drag-resize, testing, CI, Deno PoC
- phases.md: mark completed items (copy/paste, drag-resize, tree click, subtree cost,
  session resume, CI signing)
- task_plan.md: update theme decision (hot-swap works), add new decisions
- CLAUDE.md: add test paths, test commands, vitest dep
- .claude/CLAUDE.md: fix stale deferred items and theme limitation
- README.md: update feature summary
- TODO.md: move 7 completed items, update active list
- CHANGELOG.md: add session entries under [Unreleased]
2026-03-06 15:10:32 +01:00
Hibryda
c15fe7d912 ci: add auto-update signing and latest.json to release workflow
- Pass TAURI_SIGNING_PRIVATE_KEY env vars from secrets to build step
- Generate latest.json with version, pub_date, platform URL, and .sig signature
- Upload latest.json alongside .deb and .AppImage as release artifacts
2026-03-06 15:10:21 +01:00
Hibryda
35a515db25 test(v2): add vitest and cargo tests for sdk-messages, agent-tree, session, ctx
Frontend (vitest):
- sdk-messages.test.ts: adaptSDKMessage() for all 9 message types
- agent-tree.test.ts: buildAgentTree(), countTreeNodes(), subtreeCost()
- vite.config.ts: vitest test config (src/**/*.test.ts)
- package.json: vitest ^4.0.18 dev dep, "test" script

Backend (cargo):
- session.rs: SessionDb CRUD tests (sessions, SSH, settings, layout) with tempfile
- ctx.rs: CtxDb error handling tests with missing database
- Cargo.toml: tempfile 3 dev dependency
2026-03-06 15:10:12 +01:00
Hibryda
7e6e777713 feat(v2): add Deno sidecar proof-of-concept
Experimental agent-runner-deno.ts as drop-in replacement for Node.js sidecar.
Uses Deno.Command for claude CLI subprocess, TextLineStream for NDJSON parsing.
Same stdio NDJSON protocol. Compiles to single binary via deno compile.
Not yet integrated with Rust SidecarManager.
2026-03-06 15:10:01 +01:00
Hibryda
f27543d8d8 feat(v2): add copy/paste, theme hot-swap, tree enhancements, session resume, drag-resize
- TerminalPane: Ctrl+Shift+C/V copy/paste via attachCustomKeyEventHandler
- TerminalPane: subscribe to onThemeChange() for live theme hot-swap
- theme.svelte.ts: callback registry (onThemeChange) notifies listeners on setFlavor()
- AgentPane: session resume with follow-up prompt and resume_session_id
- AgentPane: tree node click scrolls to corresponding message (scrollIntoView)
- AgentTree: subtree cost display below each node, NODE_H 32->40
- TilingGrid: pane drag-resize via splitter overlays with mouse drag (10-90% clamping)
2026-03-06 15:09:52 +01:00
Hibryda
1d028c67f7 docs: update all docs for Phase 5 completion with SSH, ctx, themes, detached mode
- phases.md: Phase 5 status -> complete, added SSH/ctx/themes/detached/shiki/updater items, updated file structure
- progress.md: added Phase 5 continued session log, updated next steps
- task_plan.md: added 6 new decisions (ctx read-only, SSH via PTY, themes, detached, shiki), status Rev 3
- CLAUDE.md: added new key paths (ctx.rs, adapters, utils, stores, components), updated deps
- .claude/CLAUDE.md: updated phase status, added new technical constraints
- README.md: updated v2 feature summary
- TODO.md: resolved completed items, added new active items
- CHANGELOG.md: added SSH, ctx, themes, detached, shiki, updater entries
2026-03-06 14:50:14 +01:00
Hibryda
4db7ccff60 feat(v2): add SSH management, ctx integration, themes, detached mode, auto-updater
SSH session management:
- SshSession struct + ssh_sessions SQLite table in session.rs
- CRUD Tauri commands (ssh_session_list/save/delete) in lib.rs
- SshDialog.svelte (create/edit modal), SshSessionList.svelte (sidebar)
- SSH pane routes to TerminalPane with shell=/usr/bin/ssh + args

ctx context database integration:
- ctx.rs: read-only CtxDb (SQLITE_OPEN_READ_ONLY for ~/.claude-context/context.db)
- 5 Tauri commands (ctx_list_projects/get_context/get_shared/get_summaries/search)
- ContextPane.svelte with project selector, tabs, search
- ctx-bridge.ts adapter

Catppuccin theme flavors (Latte/Frappe/Macchiato/Mocha):
- themes.ts: all 4 palette definitions + buildXtermTheme/applyCssVariables
- theme.svelte.ts: reactive store with SQLite persistence
- SettingsDialog flavor dropdown, TerminalPane theme-aware

Detached pane mode (pop-out windows):
- detach.ts: isDetachedMode/getDetachedConfig from URL params
- App.svelte: conditional rendering of single pane without chrome

Other additions:
- Shiki syntax highlighting (highlight.ts, lazy singleton, 13 languages)
- Tauri auto-updater plugin (tauri-plugin-updater + updater.ts)
- AgentPane markdown rendering with Shiki code highlighting
- New deps: shiki, @tauri-apps/plugin-updater, tauri-plugin-updater
2026-03-06 14:50:00 +01:00
Hibryda
4f2614186d chore: update README, TODO, and CHANGELOG for Phase 6 completion 2026-03-06 14:23:24 +01:00
Hibryda
173c55cb2b docs: update all docs for Phase 6 packaging completion 2026-03-06 14:23:16 +01:00
Hibryda
67875a1f70 feat(v2): add packaging, installer, and CI release workflow (Phase 6)
Build-from-source installer (install-v2.sh) with dependency checks for
Node.js 20+, Rust 1.77+, and system libraries. Tauri bundle config for
.deb and AppImage targets. GitHub Actions workflow builds and uploads
release artifacts on version tags. Icons regenerated as RGBA PNGs.
2026-03-06 14:23:09 +01:00
Hibryda
643eb15697 chore: update README, TODO, and CHANGELOG for Phase 5 progress 2026-03-06 13:46:44 +01:00
Hibryda
d7a1dca40d docs: update all docs for Phase 5 agent tree, status bar, notifications, settings 2026-03-06 13:46:37 +01:00
Hibryda
be24d07c65 feat(v2): add agent tree, status bar, notifications, settings dialog (Phase 5)
Agent tree visualization (SVG) with horizontal layout and bezier edges.
Global status bar with pane counts, active agents pulse, token/cost totals.
Toast notification system with auto-dismiss and agent dispatcher integration.
Settings dialog with SQLite persistence for shell, cwd, and max panes.
Keyboard shortcuts: Ctrl+W close pane, Ctrl+, open settings.
2026-03-06 13:46:21 +01:00
Hibryda
cd1271adf0 docs: update all docs for Phase 4 completion and MVP status
- phases.md: Phase 3 polish + Phase 4 items checked off as complete
- progress.md: Phase 4 session details added
- task_plan.md: status updated to "MVP COMPLETE"
- README.md: v2 status updated to "MVP complete (Phase 4 done)"
- TODO.md: Phase 3/4 moved to Completed, new post-MVP items added
- CHANGELOG.md: Phase 4 entries added under [Unreleased]
- .claude/CLAUDE.md: workflow status and constraints updated
2026-03-06 12:20:10 +01:00
Hibryda
bdb87978a9 feat(v2): implement session persistence, file watcher, and markdown viewer
Phase 4 complete (MVP ship):
- SessionDb (rusqlite, WAL mode): sessions + layout_state tables, CRUD
- FileWatcherManager (notify v6): watch files, emit Tauri change events
- MarkdownPane: marked.js rendering with Catppuccin styles, live reload
- Layout store wired to persistence (addPane/removePane/setPreset persist)
- restoreFromDb() on startup restores panes in layout order
- Sidebar "M" button opens file picker for markdown files
- New adapters: session-bridge.ts, file-bridge.ts
- Deps: rusqlite (bundled), dirs 5, notify 6, marked
2026-03-06 12:19:56 +01:00
Hibryda
5ca035d438 feat(v2): add sidecar crash detection, restart UI, and auto-scroll lock
Phase 3 polish: dispatcher listens for sidecar-exited events and marks
running sessions as error. AgentPane shows "Restart Sidecar" button on
error. Auto-scroll disables when user scrolls >50px from bottom with
"Scroll to bottom" button. Added agent_restart Tauri command.
2026-03-06 12:19:35 +01:00
Hibryda
da6d7272ee docs: update docs for .svelte.ts rune store fix and Phase 3 status
- progress.md: add bug fix section for rune file extension issue
- phases.md: update store file names to .svelte.ts in file structure
- task_plan.md: add error entry and .svelte.ts decision to decisions log
- .claude/CLAUDE.md: add .svelte.ts constraint, update Phase 3 status
- CHANGELOG.md: add Fixed entries for rune store rename
2026-03-06 01:11:58 +01:00
Hibryda
af1516ed2b fix(v2): rename rune stores to .svelte.ts to fix rune_outside_svelte error
Svelte 5 $state/$derived runes only work in .svelte and .svelte.ts
files. The stores had plain .ts extensions, causing a blank screen with
"rune_outside_svelte" runtime error. Renamed all three store files and
updated import paths across 5 consuming files.
2026-03-06 01:11:51 +01:00
Hibryda
c24e540080 docs: reflect Phase 3 agent SDK integration progress
Update phases.md with Phase 3 checklist (in_progress), add session
progress log entry, record claude CLI architecture decision in
task_plan.md, update README/TODO/CHANGELOG with Phase 3 additions,
and sync .claude/CLAUDE.md with current constraints.
2026-03-06 01:02:13 +01:00
Hibryda
314c6d77aa feat(v2): add agent pane with SDK message adapter and dispatcher
Implement full agent session frontend: SDK message adapter parsing
stream-json into 9 typed message types, agent bridge for Tauri IPC,
dispatcher routing sidecar events to store, agent session store with
cost tracking, and AgentPane component with prompt input, message
rendering (text, thinking, tool calls, results, cost), and stop
button. Add Ctrl+Shift+N shortcut and sidebar agent button.
2026-03-06 01:01:56 +01:00
Hibryda
f928501075 feat(v2): implement agent-runner sidecar with claude CLI subprocess
Replace Agent SDK stub with working implementation that spawns
claude CLI with --output-format stream-json, manages multiple
sessions via Map<sessionId, ChildProcess>, and forwards NDJSON
events to Rust backend. Supports query, stop, and graceful shutdown.
2026-03-06 01:01:43 +01:00
Hibryda
f0ec44f6a6 feat(v2): add SidecarManager and agent Tauri commands
Implement Rust SidecarManager that spawns Node.js sidecar process,
communicates via stdio NDJSON, and manages agent session lifecycle.
Add agent_query, agent_stop, agent_ready Tauri commands. Sidecar
auto-starts on app launch.
2026-03-06 01:01:35 +01:00
Hibryda
54b0d44bc1 docs: reflect Phase 2 completion across all project documentation
Update progress log with Phase 2 deliverables, mark Phase 2 complete
in TODO/CHANGELOG/README, fix stale Solid.js reference in findings,
update task_plan status to BUILDING, add v2 key paths to CLAUDE.md.
2026-03-05 23:50:16 +01:00