Commit Graph

123 Commits

Author SHA1 Message Date
Carlos Florêncio 34b86cfab2 feat: add graceful shutdown 2026-01-16 01:59:19 +00:00
Carlos Florêncio 41bad65020 feat: task_session_worktrees 2026-01-16 01:59:00 +00:00
João Salavisa f86044c083 feat: Interactive shell terminal for agent tasks (#19) 2026-01-16 01:54:06 +00:00
João Salavisa e08fa51684 refactor(agentctl): unify configuration and remove single-instance mode (#18) 2026-01-15 23:57:45 +00:00
Carlos Florêncio 4560901d35 feat: flaky resume sessions 2026-01-15 23:40:20 +00:00
Carlos Florêncio 712610e428 feat: rename agent_sessions to task_sessions 2026-01-15 20:31:39 +00:00
Carlos Florêncio 9fda624874 build: improved pre-commit linter config 2026-01-15 20:02:58 +00:00
Carlos Florêncio b96e6df11f fix: typescript errors 2026-01-15 19:49:41 +00:00
Carlos Florêncio a5da45ee80 ci: add pnpm-lock.yaml file 2026-01-15 19:33:02 +00:00
Carlos Florêncio 56a901a3ca ci: only trigger for certain folders 2026-01-15 19:30:56 +00:00
Carlos Florêncio 673d9f7d96 ci: debug 2026-01-15 19:25:27 +00:00
Carlos Florêncio f0a2d2b49b ci: fix node workflow 2026-01-15 19:21:54 +00:00
Carlos Florêncio 45a01f4fd5 ci: fix workflows 2026-01-15 19:19:00 +00:00
Carlos Florêncio 2fa462df0d ci: fix web workflow 2026-01-15 19:06:43 +00:00
Carlos Florêncio e1bce95bac feat: golang linter 2026-01-15 19:05:16 +00:00
Carlos Florêncio 84252719b4 feat: right panel overlay 2026-01-15 18:27:05 +00:00
Carlos Florêncio 7d0905b8cb feat: tasks refactor 2026-01-15 18:25:42 +00:00
Carlos Florêncio 44abff6493 feat: improved chat ui topbar 2026-01-15 02:55:50 +00:00
Carlos Florêncio 004fb20618 feat: chat improved renderer and comments pagination 2026-01-15 02:23:09 +00:00
João Salavisa 7e90883a30 chore: Remove dead code and consolidate agentctl modes (#17) 2026-01-15 00:01:13 +00:00
João Salavisa af7fb84a53 fix: address code review issues (#16) 2026-01-14 23:12:12 +00:00
Carlos Florêncio 79bdee07db feat: tanstack virtual 2026-01-14 21:12:33 +00:00
Carlos Florêncio e965524590 feat: task comments SSR fetch 2026-01-14 20:52:22 +00:00
Carlos Florêncio 5813bd8f14 feat: cmd+enter in task chat 2026-01-14 19:07:34 +00:00
João Salavisa 85ecf7debb feat(agentctl): protocol adapter abstraction with agent profile support (#15)
* feat(agentctl): implement protocol adapter abstraction

- Add AgentAdapter interface for protocol-agnostic agent communication
- Create ACPAdapter implementation for ACP protocol (JSON-RPC over stdin/stdout)
- Add Protocol field to agent registry (AgentTypeConfig)
- Update process.Manager to use adapters instead of hardcoded ACP
- Update API layer to use adapter interface
- Pass protocol from registry to agentctl via CLI flag and env var
- Support protocol configuration in both Docker and standalone modes

This refactoring allows agentctl to support multiple protocols (ACP, REST, MCP)
via a pluggable adapter pattern. The backend remains protocol-agnostic,
always communicating with agentctl's HTTP API.

* refactor(agentctl): consolidate types and clean up code

- Create shared types package (internal/agentctl/types) for permission types
- Create shared protocol package (pkg/agent) for Protocol type
- Remove duplicate permission types from acp/client.go and adapter.go
- Make adapter the single source of truth for session ID
- Remove unused Command field from adapter.Config
- Remove passthrough wrapper function handleAdapterPermissionRequest
- Clean up extra empty lines in process/manager.go and acp_adapter.go
- Re-export permission types from adapter package for convenience

* fix(agent-session): rename AgentType to AgentProfileID for consistency

- Rename AgentSession.AgentType to AgentProfileID in models
- Update agent_sessions table schema column from agent_type to agent_profile_id
- Update all SQL queries in sqlite.go to use agent_profile_id
- Fix ToAPI() method to return agent_profile_id key
- Remove misleading comments in executor.go

Also adds comprehensive tests for affected areas:
- adapter package unit tests (SessionUpdate, PlanEntry, AgentInfo, Config)
- profile resolver unit tests with mock repository
- AgentSession CRUD tests in sqlite_test.go
2026-01-14 18:16:26 +00:00
Carlos Florêncio 3d01863d46 fix: docker cleanup 2026-01-14 18:03:20 +00:00
João Salavisa 82e8c8905b feat: replace agent_type with agent_profile_id (#14)
* feat: replace agent_type with agent_profile_id

- Replace agent_type field with agent_profile_id across backend and frontend
- Add ProfileResolver interface and StoreProfileResolver implementation
- Update task creation/update to use agent_profile_id
- Change default agent runtime from docker to standalone
- Fix workspace state types to include all required fields
- Fix websocket handlers type mismatches for environments, executors, workspaces
- Update integration tests to use agent_profile_id

* feat: pass model as CLI argument to agents

- Add ModelFlag field to AgentTypeConfig for specifying the CLI flag
- Set ModelFlag to '--model' for all agents (auggie, claude, codex, gemini, opencode, copilot)
- Update launchStandalone to append model flag to agent command
- Update launchDocker/buildContainerConfig to append model flag to container command
- Model is passed when both agent supports ModelFlag and profile has Model configured

* fix: make WebSocket message handling async to prevent blocking

When a long-running handler like orchestrator.prompt was executing,
it blocked the ReadPump loop, preventing other requests (like
workspace.tree.get) from being processed until the handler completed.

Now each message is handled in its own goroutine, allowing concurrent
message handling so file tree requests work while the agent is working.

* feat: show task description as first message in chat

- Add 'Task' label with distinct styling (lighter background, border)
- Pass taskDescription from page to TaskChatPanel component
- Differentiate from regular user messages visually
2026-01-14 12:29:58 +00:00
Carlos Florêncio 42d4be97e5 feat: improve cards 2026-01-14 03:09:59 +00:00
Carlos Florêncio 90e02075e8 feat: changed theme to shadcn nova - less paddings 2026-01-14 02:17:29 +00:00
Carlos Florêncio 6a0590fa4e fix: macos launcher 2026-01-14 01:51:37 +00:00
Carlos Florêncio 9e04b75ddf feat: data fetching refactor ssr -> ws updates 2026-01-14 01:42:12 +00:00
João Salavisa 159f98efe6 feat(web): File browser with syntax-highlighted viewer (#13)
* feat(web): add file browser with syntax-highlighted viewer

- Add file browser component in right panel to browse workspace files
- Open files in left panel tabs alongside Notes/Changes/Chat
- Color-coded dots for file types (TS, JS, Go, Python, etc.)
- Visual separator between main tabs and file tabs
- Folders sorted to top in file tree view
- LRU eviction for max 4 open file tabs
- Backend handlers for workspace file tree and content via WebSocket

* fix(web): refresh file tree on filesystem changes via fsnotify

- Subscribe to file change notifications from agentctl's fsnotify watcher
- Backend lifecycle manager now connects to file changes stream
- Publishes FileChangeNotified events to event bus
- WebSocket broadcasts workspace.file.changes to task subscribers
- Frontend file browser refreshes tree when changes detected

* perf(agentctl): use fsnotify instead of polling for git status

- Replace 2-second polling with fsnotify-triggered updates
- Add debouncing (300ms) to batch rapid file changes
- Git status updates now triggered by actual filesystem changes
- More efficient and responsive than periodic polling

* refactor(agentctl): consolidate fs events into single debounced trigger

- Single fsChangeTrigger channel for all filesystem events
- After 300ms debounce: update git status, files, and notify subscribers
- Removed per-file notifications in favor of single 'refresh' event
- Simpler and more efficient than separate triggers

* refactor(agentctl): simplify file API - use HTTP for tree/content

- Remove unused filesConn, fileTreeConn, fileContentConn from Client struct
- Convert RequestFileTree and RequestFileContent from WebSocket to HTTP GET
- Remove StreamFiles and CloseFilesStream (redundant with file changes stream)
- Keep only fileChangesConn for the debounced refresh notification

HTTP is simpler than WebSocket for request/response patterns.

* feat(web): switch to CodeMirror for file viewer

- Replace react-syntax-highlighter with @uiw/react-codemirror
- Add language extensions for JS/TS, Python, Go, Rust, Java, C++, CSS, HTML, JSON, Markdown, YAML
- Use VS Code dark theme for consistent look
- Enable code folding and read-only mode
- Better performance and features than syntax highlighter

* refactor: consolidate duplicated types and extract shared constants

- Re-export file types from process package in agentctl/client.go instead of duplicating
- Move OpenFileTab type to lib/types/backend.ts (shared by file-browser and page-client)
- Extract FILE_EXTENSION_COLORS constant for file type color indicators
- Remove console.log statement and unused imports in file-browser.tsx
- Add 'refresh' operation to FileChangeNotificationPayload type

* refactor(agentctl): move Close() method from acp.go to client.go

Close() is a general client cleanup method that closes all streams
(ACP, permissions, git status, file changes). It belongs in client.go
since acp.go should only contain ACP-specific communication logic.

* fix(web): remove unused cn import in file-browser

* refactor(agentctl): consolidate duplicated types into process/types.go

- Create process/types.go with all workspace-related types
- Remove duplicate GitStatusUpdate, FileInfo from workspace_tracker.go
- Remove duplicate GitStatusUpdate, FileInfo from api/workspace.go
- Re-export all types from agent/agentctl/client.go for convenience

Types are now defined once and imported everywhere.

* chore: remove package-lock.json, add to .gitignore

Project uses pnpm (pnpm-lock.yaml), not npm.

* fix(orchestrator): probe agent before returning stale execution state

When checking task.execution, the backend now probes the actual agent:
- For tracked instances: health check via agentctl
- For Docker: verify container is running

If the agent is not running but DB says 'running', the session is
marked as stopped and false is returned. This fixes the UI showing
agents as running after backend restart when they're actually dead.

Changes:
- Add IsAgentRunningForTask to AgentManagerClient interface
- Add IsContainerRunning to docker client
- Update GetExecution to verify agent is actually running
- Clean up stale sessions in database when agent not found

* fix(orchestrator): use agentctl status to verify agent is running

Simplified approach - probe agentctl's /api/v1/status endpoint to check
if agent process is running. Same check for both Docker and standalone.

- Add IsAgentRunning() helper to StatusResponse
- Simplify IsAgentRunningForTask to just use agentctl.GetStatus()

* fix(orchestrator): also verify agent running for in-memory executions

The previous fix only checked agent status when loading from DB. But if
an execution is cached in memory and the agent process stops (while
agentctl stays running), the stale state was still returned.

Now both paths verify the agent is actually running by probing agentctl.
If agent stopped, clean up in-memory state and update DB session.

* chore(web): remove unused react-syntax-highlighter

Switched to CodeMirror for code viewing, no longer needed.

* fix(tests): add IsAgentRunningForTask to mock agent managers

Add the new interface method to test mocks:
- mockAgentManager in scheduler_test.go
- SimulatedAgentManagerClient in orchestrator_test.go

---------

Co-authored-by: Kandev Agent <kandev@example.com>
2026-01-14 01:24:05 +00:00
João Salavisa 2c1afd7701 feat(backend): auto-launch agentctl subprocess in standalone mode (#12) 2026-01-13 23:56:10 +00:00
Carlos Florêncio 6c50fef6fa feat: add defaults to workspace: env, executor, agent 2026-01-13 23:37:46 +00:00
Carlos Florêncio aed307d9b8 feat: simplify task creation 2026-01-13 22:41:52 +00:00
Carlos Florêncio aebcf5283f feat: display settings in kanban page 2026-01-13 22:37:36 +00:00
João Salavisa bfa22616f0 feat(worktree): semantic naming and branch cleanup on task deletion (#11) 2026-01-13 02:19:35 +00:00
João Salavisa 6d9f78b7b7 fix(agentctl): standalone mode workspace path and worktree lookup (#10) 2026-01-13 02:05:33 +00:00
Carlos Florêncio 084756c921 feat: agents discovery 2026-01-13 00:45:10 +00:00
Carlos Florêncio bcbe09fbb7 feat: add pre-commit hook 2026-01-13 00:40:23 +00:00
Carlos Florêncio f2aea364af feat: environments and executors 2026-01-13 00:28:25 +00:00
João Salavisa 3701d9057b feat(backend): build agentctl to bin/ and use pre-built binary in Dockerfile (#9) 2026-01-12 23:56:36 +00:00
João Salavisa a1013342a3 feat: Real-time Git Status Integration (#8)
* feat: implement real-time git status integration

- Add workspace tracker to monitor git changes every 2 seconds
- Implement WebSocket streaming for git status updates
- Add database persistence for git status in agent session metadata
- Compute diffs backend-side with additions/deletions per file
- Integrate git status into frontend UI (top bar, files panel, changes panel)
- Display real-time ahead/behind commits and line changes
- Show file diffs with syntax highlighting in task view
- Add retry logic for WebSocket connections during reconciliation
- Fix context lifecycle issue in workspace tracker

* refactor: remove debug and unnecessary logging

- Remove debug logs from workspace tracker
- Remove info logs from WebSocket handlers
- Remove verbose git status update logs
- Keep only essential error logs

* fix: compare git diff against remote branch instead of HEAD

- Changed git diff comparison from HEAD to remote tracking branch
- Now shows all changes including committed files that haven't been pushed
- Files committed locally but not pushed will appear in the diff
- Falls back to HEAD if no remote branch is configured

* fix: prevent stale git status when switching tasks

- Clear git status when switching to a new task
- Only accept git.status WebSocket updates for the current task
- Prevents showing git data from previous task when switching

* refactor: remove unused diff stream client code

- Remove diffConn field from agentctl Client struct
- Remove StreamDiff() method (never called)
- Remove CloseDiffStream() method
- Remove DiffUpdate type from client.go
- All diff data is already included in GitStatusUpdate.Files
- Keep server-side diff endpoint in agentctl for potential future use

* refactor: remove unused diff stream server-side code

- Remove /workspace/diff/stream endpoint from agentctl API
- Remove handleDiffStreamWS handler
- Remove DiffUpdate type from workspace_tracker.go
- Remove DiffSubscriber type
- Remove updateDiff() and getDiff() methods
- Remove SubscribeDiff(), UnsubscribeDiff() methods
- Remove notifyDiffSubscribers() method
- Remove GetCurrentDiff() method
- Remove currentDiff field and diffSubscribers map
- All diff data is already included in GitStatusUpdate.Files

* refactor: remove unused output stream code

- Remove /output and /output/stream endpoints from agentctl API
- Remove handleGetOutput and handleOutputStreamWS handlers
- Delete output.go file entirely
- Remove OutputBuffer and related code (buffer.go deleted)
- Remove outputConn field from agentctl Client
- Remove StreamOutput() and CloseOutputStream() methods
- Remove OutputLine type from client.go
- Remove OutputBufferSize config option
- Update readStderr to just log instead of buffering

Output data flows through ACP stream (StreamUpdates) which includes
all session notifications. The separate output stream was never used.
2026-01-12 23:44:29 +00:00
Carlos Florêncio c5eac3551a feat: improved settings repos, boards 2026-01-12 22:13:54 +00:00
Carlos Florêncio ce55dbf1c1 fix: go vet ci 2026-01-12 21:13:25 +00:00
Carlos Florêncio 0cbbeece07 feat: landing page and pnpm workspaces 2026-01-12 20:56:03 +00:00
jcfs c2d08271c9 fix: reconnect to agent streams after backend restart
- Add reconnectStreams() to reconnect WebSocket streams for recovered agents
- Reconnect updates stream (for agent responses)
- Reconnect permissions stream (for permission requests)
- Mark recovered agents as READY so they can accept prompts
- Fix worktree cleanup order: clean files before DB cascade deletes records
2026-01-12 17:14:17 +00:00
jcfs 74c020b371 feat: return worktree info in orchestrator.start response
- Add WorktreePath and WorktreeBranch to StartTaskResponse
- Add those fields to TaskExecution and LaunchAgentResponse
- Store worktree_path and worktree_branch in AgentInstance metadata
- Update frontend to use worktree info from start response directly
2026-01-12 16:28:56 +00:00
jcfs a7deb3300c fix: show worktree path in UI after agent starts
- Add local state for worktree path/branch
- Re-fetch task info 1s after agent starts to get worktree data
- Pass local state to TaskTopBar instead of static task prop
2026-01-12 16:20:11 +00:00
jcfs db454bec8e fix: only show active worktrees in task API response
- GetWorktreeByTaskID now filters by status = 'active'
- Deleted worktrees won't appear in task responses
2026-01-12 16:15:45 +00:00