Commit graph

149 commits

Author SHA1 Message Date
Hibryda
a70d45ad21 security: migrate plugin sandbox from new Function() to Web Worker
Each plugin now runs in a dedicated Web Worker with permission-gated
API proxied via postMessage. Eliminates prototype walking and
arguments.callee.constructor escape vectors inherent to same-realm
new Function() sandbox.
2026-03-15 02:36:55 +01:00
Hibryda
23b4d0cf26 feat: add SidecarManager actor pattern, SPKI pinning, btmsg seen_messages, Aider autonomous mode
Tribunal priorities 1-4: SidecarManager refactored to mpsc actor thread
(eliminates TOCTOU race), SPKI TOFU certificate pinning for relay TLS,
per-message btmsg acknowledgment via seen_messages table, Aider
autonomous mode toggle gating shell execution.
2026-03-14 04:39:40 +01:00
DexterFromLab
55ba8d0969 Add incoming message visibility and shell command execution to Aider runner
- Emit 'input' events so agents show received prompts in their console
- Execute detected shell commands (btmsg, bttask, etc.) from LLM output
- Feed command results back to aider for iterative autonomous work
- Detect commands in code blocks, bare btmsg/bttask lines, and $ prefixes
- More robust THINKING/ANSWER marker detection (multiple unicode variants)
- Adapter handles new 'input' and 'tool_result' event types

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 16:24:20 +01:00
DexterFromLab
fd355ab6fe Batch Aider output into structured blocks instead of per-line events
Aider runner now buffers entire turn output and parses it into thinking,
text, shell command, and cost blocks. Adapter updated for new event types.
Fixes console UI showing individual chevrons per output line.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 16:09:54 +01:00
DexterFromLab
e8555625ff Fix horizontal grid jumping caused by scrollIntoView bubbling
scrollIntoView() in AgentPane was scrolling all ancestor containers
including ProjectGrid (overflow-x: auto), causing the entire project
grid to jump horizontally every time any agent produced output.

Replaced with direct scrollTop/scrollTo manipulation that only affects
the intended scroll container. Also removed scroll-snap-type which
caused additional snap recalculation on layout changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 14:32:14 +01:00
DexterFromLab
bb09b3c0ff Give Tier 2 agents btmsg/bttask access and instructions
- Set BTMSG_AGENT_ID for all projects (not just Tier 1) so Tier 2
  agents can use btmsg/bttask CLI tools
- Add btmsg/bttask documentation to Tier 2 system prompt with
  workflow instructions (inbox, tasks, status updates)
- Unify wake/start prompts to always reference btmsg inbox

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 14:16:57 +01:00
DexterFromLab
c6a41018b6 Auto-wake agents on btmsg and fix unwanted auto-scroll
- Add btmsg inbox polling (10s) to AgentSession so agents wake when
  they receive messages from other agents (not just admin DMs)
- Remove automatic setActiveProject on agent activation to prevent
  focus stealing from the user
- Use untrack() in ProjectGrid scroll effect so agent re-renders
  don't trigger unwanted scrollIntoView

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 14:14:13 +01:00
DexterFromLab
5b7ad30573 Add Aider provider with OpenRouter support and per-provider sidecar routing
- Add aider-runner.ts sidecar that spawns aider CLI in non-interactive mode
- Add Aider provider metadata with OpenRouter model presets
- Add aider-messages.ts adapter for Aider event format
- Refactor SidecarManager from single-process to per-provider process management
  with lazy startup on first query and session→provider routing
- Add openrouter_api_key to secrets system (keyring storage)
- Inject OPENROUTER_API_KEY from secrets into Aider agent environment
- Register Aider in provider registry, build pipeline, and resource bundle

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 13:33:39 +01:00
DexterFromLab
35963be686 Unify provider/model config for Tier 1 and Tier 2 agents
- Add provider and model fields to both GroupAgentConfig and ProjectConfig
- Wire model override through AgentSession → AgentPane → queryAgent → sidecar
- Add model preset dropdown per provider (Opus/Sonnet/Haiku, GPT-5.4/o3, etc.)
  with custom model ID input at the bottom
- Add provider dropdown to Tier 1 agents (was Tier 2 only)
- Add "Apply & Restart" button on both tiers to restart agent with new settings
- Changing provider auto-resets model selection
- Admin bypasses stale heartbeat check in btmsg so DMs always deliver

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 12:54:13 +01:00
DexterFromLab
2c710fa0db Wire play/stop buttons and DM send to agent lifecycle
- Play button in GroupAgentsPanel now starts agent session via emitAgentStart
- Stop button now stops running agent session via emitAgentStop
- Sending a DM to a stopped agent auto-wakes it (sets active + emitAgentStart)
- Fix autoPrompt in AgentPane to work for fresh sessions (not just done/error)
- Fix btmsg: admin (tier 0) bypasses stale heartbeat check so messages deliver

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 12:33:08 +01:00
DexterFromLab
42907f22a4 Auto-scroll ProjectGrid to focused project on agent selection
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 12:16:13 +01:00
DexterFromLab
adde8462ef Rename binary to agent-orchestrator, add splash screen, fix white flash
- Rename Cargo package from bterminal to agent-orchestrator so WM_CLASS
  matches desktop entry and taskbar groups correctly
- Update lib name (agent_orchestrator_lib) and telemetry service name
- Add Pandora's Box splash screen with progress steps during startup
- Prevent white window flash with inline CSS and Tauri backgroundColor

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 12:09:18 +01:00
DexterFromLab
4fee567dd9 chore: rebrand to Agent Orchestrator + fix pragma busy_timeout crash
Rebrand all user-visible BTerminal references to Agent Orchestrator
(window title, product name, identifier, status bar, updater URL,
context registration, CLAUDE.md branch reference).

Fix critical btmsg/bttask crash: pragma_update uses execute() internally
but PRAGMA busy_timeout returns a result row, causing "Execute returned
results" error that silently broke all CommsTab message loading.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 11:42:13 +01:00
Hibryda
5e949696d5 fix: track plugin-host source and add 35 sandbox security tests
Fix .gitignore 'plugins/' rule that was accidentally ignoring source
files in v2/src/lib/plugins/. Narrow to /plugins/ and /v2/plugins/
(runtime plugin directories only). Track plugin-host.ts (was written
but never committed) and add comprehensive test suite covering all 13
shadowed globals, this-binding, permission gating, API freeze, and
lifecycle management.
2026-03-12 11:10:50 +01:00
Hibryda
7e65ee2360 feat: fix subagent delegation for Manager agents
Add multi-agent delegation documentation to Manager system prompt so
Claude knows it can spawn child agents via the Agent tool. Also inject
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 env var for Manager agents.
2026-03-12 11:10:50 +01:00
Hibryda
c94a82b8dd test: update tests for production readiness features
Update btmsg-bridge, bttask-bridge, and agent-dispatcher tests for new
APIs (registerAgents, version param, notification mocks).
2026-03-12 11:10:50 +01:00
Hibryda
afc059b346 feat: integrate all production readiness modules
Register new commands in lib.rs, add command modules, update Cargo deps
(notify-rust, keyring, bundled-full), fix PRAGMA WAL for bundled-full,
add notifications/heartbeats/FTS5 indexing to agent-dispatcher,
update SettingsTab with secrets/plugins/sandbox/updates sections.
2026-03-12 11:10:50 +01:00
Hibryda
66cbee2c53 feat: add optimistic locking for bttask and error classification
Version column in tasks table with WHERE id=? AND version=? guard.
Conflict detection in TaskBoardTab. error-classifier.ts: 6 error types
with actionable messages and retry logic. UsageMeter.svelte.
2026-03-12 11:10:50 +01:00
Hibryda
a9b7ed0dda feat: add keyboard-first UX and rewrite CommandPalette
Alt+1-5 project jump, Ctrl+H/L vi-nav, Ctrl+Shift+1-9 tab switch,
Ctrl+J terminal toggle, Ctrl+Shift+K focus agent. isEditing() guard.
CommandPalette: 18+ commands, 6 categories, fuzzy filter, arrow nav.
2026-03-12 11:10:50 +01:00
Hibryda
d31a2c3ed7 feat: add agent health monitoring, audit log, and dead letter queue
heartbeats + dead_letter_queue + audit_log tables in btmsg.db. 15s
heartbeat polling in ProjectBox, stale detection, ProjectHeader heart
indicator. AuditLogTab for Manager. register_agents_from_groups() with
bidirectional contacts and review channel creation.
2026-03-12 11:10:50 +01:00
Hibryda
cb9d99d191 feat: add plugin system with sandboxed runtime
Plugin discovery from ~/.config/bterminal/plugins/ with plugin.json
manifest. Sandboxed new Function() execution, permission-gated API
(palette, btmsg:read, bttask:read, events). Plugin store + SettingsTab.
2026-03-12 11:10:50 +01:00
Hibryda
e8acd6c3d5 feat: add OS + in-app notification system
notify-rust for desktop notifications, NotificationCenter.svelte with
bell icon, unread badge, history (max 100), 6 notification types.
Extended notification store with history and type support.
2026-03-12 11:10:50 +01:00
Hibryda
c6836cecf3 feat: add secrets management via system keyring
SecretsManager using keyring crate (linux-native/libsecret). Store/get/
delete/list with __bterminal_keys__ metadata tracking. SettingsTab
Secrets section. No plaintext fallback.
2026-03-12 11:10:50 +01:00
Hibryda
3148d31ab1 feat: add FTS5 full-text search with Spotlight-style overlay
Upgrade rusqlite to bundled-full for FTS5. SearchDb with 3 virtual tables
(messages, tasks, btmsg). SearchOverlay.svelte: Ctrl+Shift+F, 300ms
debounce, grouped results with highlight snippets.
2026-03-12 11:10:50 +01:00
Hibryda
871fd0385f feat: add Landlock sandbox for sidecar process isolation
SandboxConfig with RW/RO paths applied via pre_exec() in sidecar child
process. Requires kernel 6.2+ with graceful fallback. Per-project toggle
in SettingsTab. 9 unit tests.
2026-03-12 11:10:50 +01:00
Hibryda
1f293083b2 fix(e2e): fix 27 E2E test failures across 3 spec files
Fix stale v2 CSS selectors for v3 UI, WebKit2GTK keyboard/focus
quirks (JS-dispatched KeyboardEvent, programmatic focus check,
backdrop click close), conditional render timing (waitUntil for
project boxes, null handling for burn-rate/cost elements), and
AgentPane missing closing > on data-testid div tag.
2026-03-12 11:10:50 +01:00
Hibryda
51abc6ee34 feat(e2e): add data-testid attributes to 7 key Svelte components
Stable test selectors for E2E: agent-pane, data-agent-status,
project-box, data-project-id, status-bar, agent-session,
sidebar-rail, command-palette, terminal-tabs and more.
2026-03-12 11:10:50 +01:00
Hibryda
4b86065163 feat(e2e): add test mode infrastructure with BTERMINAL_TEST env isolation
Rust: watcher.rs/fs_watcher.rs skip watchers in test mode,
is_test_mode Tauri command. Frontend: wake-scheduler disable,
App.svelte test mode detection. AppConfig centralization in
bterminal-core (OnceLock pattern for path overrides).
2026-03-12 11:10:50 +01:00
Hibryda
4b72c26158 feat(reviewer): add Tier 1 reviewer agent role with auto-channel notifications
Reviewer workflow in agent-prompts.ts (8-step process), Rust auto-post
to #review-queue on task->review transition, reviewQueueDepth in
attention scoring (10pts/task cap 50), Tasks tab for reviewer in
ProjectBox with 10s queue polling. 7 vitest + 4 cargo tests.
2026-03-12 11:10:50 +01:00
Hibryda
488c758e1d feat(wake): add auto-wake Manager scheduler with 3 selectable strategies
New wake system for Manager agents: persistent (resume prompt), on-demand
(fresh session), smart (threshold-gated). 6 wake signals from tribunal S-3
hybrid. Pure scorer function (24 tests), Svelte 5 rune scheduler store,
SettingsTab UI (strategy button + threshold slider), AgentSession integration.
2026-03-12 11:10:50 +01:00
Hibryda
93d0b76004 feat(metrics): add Dashboard Metrics Panel with live health and SVG sparkline history
New MetricsPanel.svelte component as ProjectBox tab (PERSISTED-LAZY, all projects).
Live view: fleet aggregates, project health grid, task board summary, attention queue.
History view: 5 switchable SVG sparklines (cost/tokens/turns/tools/duration), stats row,
recent sessions table. 25 tests for pure utility functions.
2026-03-12 11:10:50 +01:00
Hibryda
92ff25a9ab refactor(adapters): brand btmsg/bttask/groups bridge interfaces with GroupId/AgentId
Apply branded types to all IPC bridge interfaces and function
parameters. Update test mock data with branded constructors.
2026-03-12 11:10:50 +01:00
Hibryda
5454587acb refactor(types): add GroupId and AgentId branded types to ids.ts
Extend the branded type system with two new domain types for
btmsg/bttask agent and group identifiers. Apply to groups.ts
interfaces including agentToProject() domain crossing cast.
2026-03-12 11:10:50 +01:00
Hibryda
52fd3ee562 refactor(components): apply branded types at Svelte component call sites
GroupAgentsPanel, TaskBoardTab, SettingsTab now use GroupId/AgentId
branded constructors at their IPC call sites.
2026-03-12 11:10:50 +01:00
Hibryda
2b7aeb2b47 test(btmsg): add regression tests for named column access and camelCase serialization
Covers the CRITICAL status vs system_prompt bug (positional index 7),
JOIN alias disambiguation, serde camelCase serialization, TypeScript
bridge IPC commands, and plantuml hex encoding algorithm.
49 new tests: 8 btmsg.rs + 7 bttask.rs + 8 sidecar + 17 btmsg-bridge.ts + 10 bttask-bridge.ts + 7 plantuml-encode.ts
2026-03-12 11:10:50 +01:00
Hibryda
cba9b298eb fix(components): stopPropagation, PlantUML encoding, Tauri 2.x asset URL
GroupAgentsPanel: added e.stopPropagation() on toggleAgent button.
ArchitectureTab: collapsed rawDeflate no-op into single plantumlEncode().
TestingTab: replaced asset://localhost/ with convertFileSrc().
2026-03-12 11:10:50 +01:00
Hibryda
bd904de151 fix(btmsg): convert positional column access to named, fix camelCase mismatch
CRITICAL: get_agents() used SELECT * positional index 7 for status,
but column 7 is system_prompt (column 8 is status). Converted all
query functions in btmsg.rs and bttask.rs to named column access.

Fixed BtmsgAgent/BtmsgMessage TypeScript interfaces to use camelCase
matching Rust serde(rename_all = camelCase). Updated CommsTab consumer.
2026-03-12 11:10:50 +01:00
DexterFromLab
2ca7756a74 feat(agents): role-specific tabs + bttask Tauri backend
- TaskBoardTab: kanban board (5 columns, CRUD, comments, 5s poll) for Manager
- ArchitectureTab: PlantUML viewer/editor (4 templates, plantuml.com) for Architect
- TestingTab: Selenium screenshots + test file discovery for Tester
- bttask.rs: Rust backend (list, create, update_status, delete, comments)
- bttask-bridge.ts: TypeScript IPC adapter
- ProjectBox: conditional role tabs (isAgent && agentRole), PERSISTED-LAZY
2026-03-11 15:25:41 +01:00
DexterFromLab
0c28f204c7 feat(agents): custom context for Tier 2 + periodic system prompt re-injection
- SettingsTab: Custom Context textarea for Tier 2 project cards
- AgentSession passes systemPrompt for ALL projects (Tier 1 gets full
  generated prompt, Tier 2 gets custom context)
- Periodic re-injection: 1-hour timer checks if agent is idle, then
  auto-sends context refresh prompt with role/tools reminder
- AgentPane: autoPrompt prop consumed when session is done/error,
  resumes session with fresh system prompt
2026-03-11 15:02:28 +01:00
DexterFromLab
14808a97e9 feat(settings): add Tier 1 agent config panel with system prompt editor
- Agent cards in SettingsTab: name, enable/disable, CWD, model, wake interval
- Custom Context textarea for editable system prompt per agent
- Collapsible preview of full generated introductory prompt
- Agent cards styled with mauve left border accent and role badge
- Export AGENT_ROLE_ICONS from groups.ts, add updateAgent() to workspace store
2026-03-11 14:55:38 +01:00
DexterFromLab
a158ed9544 feat(orchestration): multi-agent communication, unified agents, env passthrough
- btmsg: admin role (tier 0), channel messaging (create/list/send/history),
  admin global feed, mark-read conversations
- Rust btmsg module: admin bypass, channels, feed, 8 new Tauri commands
- CommsTab: sidebar chat interface with activity feed, DMs, channels (Ctrl+M)
- Agent unification: Tier 1 agents rendered as ProjectBoxes via agentToProject()
  converter, getAllWorkItems() combines agents + projects in ProjectGrid
- GroupAgentsPanel: click-to-navigate agents to their ProjectBox
- Agent system prompts: generateAgentPrompt() builds comprehensive introductory
  context (role, environment, team, btmsg/bttask docs, workflow instructions)
- AgentSession passes group context to prompt generator via $derived.by()
- BTMSG_AGENT_ID env var passthrough: extra_env field flows through full chain
  (agent-bridge → Rust AgentQueryOptions → NDJSON → sidecar runners → cleanEnv)
- workspace store: updateAgent() for Tier 1 agent config persistence
2026-03-11 14:53:39 +01:00
DexterFromLab
1331d094b3 feat(GroupAgentsPanel): add Tier 1/2 division with project agents
Show Tier 1 (Management: Manager, Architect, Tester) and Tier 2
(Execution: project agents) separated by a divider line. Tier 2
cards show project icon and name, are slightly smaller, no start/stop
button. Header dots show all agents with a separator between tiers.
2026-03-11 14:05:09 +01:00
DexterFromLab
f2dcedc460 feat(orchestration): add bttask CLI + GroupAgentsPanel + btmsg Tauri bridge
Phase 2: bttask CLI (Python, SQLite) — task management with role-based
visibility. Kanban board view. Manager/Architect can create tasks,
Tier 2 agents receive tasks via btmsg only.

Phase 3: GroupAgentConfig in groups.json + Rust backend. GroupAgentsPanel
Svelte component above ProjectGrid with status dots, role icons,
unread badges, start/stop buttons.

Phase 4: btmsg Rust bridge (btmsg.rs) — read/write access to btmsg.db.
6 Tauri commands for agent status, messages, and history.
GroupAgentsPanel polls btmsg.db every 5s for live status updates.
2026-03-11 14:03:11 +01:00
DexterFromLab
e1025a0a8a feat(btmsg): add group agent messenger CLI
Python CLI tool for hierarchical multi-agent communication.
SQLite-backed (WAL mode), agent identity via BTMSG_AGENT_ID env var.

Features:
- inbox/read/send/reply — message CRUD with read tracking
- contacts — role-based communication hierarchy enforcement
- history — per-agent conversation view
- status — all agents with tier/role/model/unread counts
- register/allow — agent and contact management
- notify — single-line notification for agent injection
- Short ID prefix matching for convenience

Also: change default Claude model to opus-4-6
2026-03-11 13:51:40 +01:00
DexterFromLab
44610f3177 fix(workspace): docs discovery for doc/ dirs + SSH terminal tab args
- Add doc/ alongside docs/ in markdown file discovery (groups.rs)
- Add SETUP.md to priority root files
- Fix SSH terminal tabs: resolve session args via sshArgsCache derived
  from listSshSessions() instead of passing empty args
- Fix Agent Preview: only mount xterm when tab is active (prevents
  CanvasAddon crash on hidden elements)
- Separate tab type rendering (shell/ssh/agent-preview) with proper guards
2026-03-11 13:04:32 +01:00
Hibryda
af3cd45324 refactor(components): apply branded types at Svelte component call sites 2026-03-11 05:46:22 +01:00
Hibryda
889adcb004 refactor(agent-dispatcher): brand sessionId at sidecar boundary 2026-03-11 05:40:28 +01:00
Hibryda
a06b9d5053 refactor(utils): apply branded types to session-persistence and auto-anchoring 2026-03-11 05:40:28 +01:00
Hibryda
3f4f2d70af refactor(stores): apply branded types to conflicts and health Map keys 2026-03-11 05:40:28 +01:00
Hibryda
f2a7d385d6 feat(types): introduce SessionId/ProjectId branded types (SOLID Phase 3) 2026-03-11 05:40:28 +01:00