Files
kandev/apps/backend/pkg/api/v1/agent.go
T
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

67 lines
2.7 KiB
Go

package v1
import "time"
// AgentStatus represents the status of an agent instance
type AgentStatus string
const (
AgentStatusPending AgentStatus = "PENDING"
AgentStatusStarting AgentStatus = "STARTING"
AgentStatusRunning AgentStatus = "RUNNING" // Agent is processing a prompt
AgentStatusReady AgentStatus = "READY" // Agent finished prompt, waiting for next
AgentStatusCompleted AgentStatus = "COMPLETED"
AgentStatusFailed AgentStatus = "FAILED"
AgentStatusStopped AgentStatus = "STOPPED"
)
// ResourceLimits defines container resource limits
type ResourceLimits struct {
CPULimit string `json:"cpu_limit"`
MemoryLimit string `json:"memory_limit"`
DiskLimit string `json:"disk_limit"`
}
// AgentInstance represents a running or completed agent container
type AgentInstance struct {
ID string `json:"id"`
TaskID string `json:"task_id"`
AgentProfileID string `json:"agent_profile_id"`
ContainerID *string `json:"container_id,omitempty"`
ContainerName *string `json:"container_name,omitempty"`
Status AgentStatus `json:"status"`
ImageName string `json:"image_name"`
StartedAt *time.Time `json:"started_at,omitempty"`
StoppedAt *time.Time `json:"stopped_at,omitempty"`
ExitCode *int `json:"exit_code,omitempty"`
ErrorMessage *string `json:"error_message,omitempty"`
ResourceLimits ResourceLimits `json:"resource_limits"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// AgentType represents a registered agent type
type AgentType struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
DockerImage string `json:"docker_image"`
DockerTag string `json:"docker_tag"`
DefaultResources ResourceLimits `json:"default_resources"`
EnvironmentVars map[string]string `json:"environment_vars,omitempty"`
Capabilities []string `json:"capabilities,omitempty"`
Enabled bool `json:"enabled"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// AgentLog represents a log entry from an agent
type AgentLog struct {
ID int64 `json:"id"`
AgentInstanceID string `json:"agent_instance_id"`
LogLevel string `json:"log_level"`
Message string `json:"message"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
}