Files
kandev/apps/backend/internal/agent/api/requests.go
T
jcfs 20f5f43fb3 feat: complete acp-go-sdk integration with task state updates
- Use acp-go-sdk for all ACP communication in agentctl
- Mark agent as completed when Prompt() returns successfully
- Update task state to COMPLETED when agent completes
- Update task state to FAILED when agent fails and retries exhausted
- Enhanced E2E test to verify agent actually creates files
- E2E test now validates full flow: task creation -> agent work -> file creation -> task completion
2026-01-10 16:46:35 +00:00

108 lines
3.4 KiB
Go

// Package api provides HTTP handlers for the agent manager API.
package api
import "time"
// LaunchAgentRequest for launching an agent
type LaunchAgentRequest struct {
TaskID string `json:"task_id" binding:"required"`
AgentType string `json:"agent_type" binding:"required"`
WorkspacePath string `json:"workspace_path" binding:"required"`
Env map[string]string `json:"env,omitempty"`
Priority int `json:"priority"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
// StopAgentRequest for stopping an agent
type StopAgentRequest struct {
Force bool `json:"force"`
Reason string `json:"reason,omitempty"`
}
// AgentInstanceResponse for agent status
type AgentInstanceResponse struct {
ID string `json:"id"`
TaskID string `json:"task_id"`
AgentType string `json:"agent_type"`
ContainerID string `json:"container_id"`
Status string `json:"status"`
Progress int `json:"progress"`
StartedAt time.Time `json:"started_at"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
ExitCode *int `json:"exit_code,omitempty"`
ErrorMessage string `json:"error_message,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
// AgentTypeResponse for agent type listing
type AgentTypeResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Image string `json:"image"`
Capabilities []string `json:"capabilities"`
Enabled bool `json:"enabled"`
}
// AgentsListResponse for listing agents
type AgentsListResponse struct {
Agents []AgentInstanceResponse `json:"agents"`
Total int `json:"total"`
}
// AgentTypesListResponse for listing agent types
type AgentTypesListResponse struct {
Types []AgentTypeResponse `json:"types"`
Total int `json:"total"`
}
// LogEntry represents a single log entry
type LogEntry struct {
Timestamp time.Time `json:"timestamp"`
Message string `json:"message"`
Stream string `json:"stream"` // stdout or stderr
}
// LogsResponse for agent logs
type LogsResponse struct {
Logs []LogEntry `json:"logs"`
Total int `json:"total"`
}
// HealthResponse for health check
type HealthResponse struct {
Status string `json:"status"`
Timestamp time.Time `json:"timestamp"`
}
// SendPromptRequest for sending a prompt to an agent
type SendPromptRequest struct {
Message string `json:"message" binding:"required"`
}
// SendPromptResponse for prompt acknowledgment
type SendPromptResponse struct {
Success bool `json:"success"`
SessionID string `json:"session_id,omitempty"`
Message string `json:"message,omitempty"`
}
// CancelAgentRequest for cancelling agent operation
type CancelAgentRequest struct {
Reason string `json:"reason,omitempty"`
}
// CancelAgentResponse for cancel acknowledgment
type CancelAgentResponse struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
}
// GetSessionResponse for getting session info
type GetSessionResponse struct {
InstanceID string `json:"instance_id"`
SessionID string `json:"session_id"`
Status string `json:"status"`
}