Files
kandev/apps/backend/pkg/websocket/actions.go
T
jcfs e012e070a9 fix: recover agent state from Docker on backend restart
- Add Docker reconciliation on lifecycle manager startup to find running containers
- Add container_id field to agent_sessions table for cleanup tracking
- Add GetRecoveredInstances to AgentManagerClient interface
- Sync executor cache with recovered Docker instances on startup
- Add task.execution WebSocket endpoint to check agent running state
- Fix Stop Agent button showing Start Agent after page refresh
- Ensure containers are not leaked when backend restarts
2026-01-12 03:42:54 +00:00

129 lines
4.6 KiB
Go

package websocket
// Action constants for WebSocket messages
const (
// Health
ActionHealthCheck = "health.check"
// Board actions
ActionBoardList = "board.list"
ActionBoardCreate = "board.create"
ActionBoardGet = "board.get"
ActionBoardUpdate = "board.update"
ActionBoardDelete = "board.delete"
// Workspace actions
ActionWorkspaceList = "workspace.list"
ActionWorkspaceCreate = "workspace.create"
ActionWorkspaceGet = "workspace.get"
ActionWorkspaceUpdate = "workspace.update"
ActionWorkspaceDelete = "workspace.delete"
// Column actions
ActionColumnList = "column.list"
ActionColumnCreate = "column.create"
ActionColumnGet = "column.get"
ActionColumnUpdate = "column.update"
ActionColumnDelete = "column.delete"
// Repository actions
ActionRepositoryList = "repository.list"
ActionRepositoryCreate = "repository.create"
ActionRepositoryGet = "repository.get"
ActionRepositoryUpdate = "repository.update"
ActionRepositoryDelete = "repository.delete"
// Repository Script actions
ActionRepositoryScriptList = "repository.script.list"
ActionRepositoryScriptCreate = "repository.script.create"
ActionRepositoryScriptGet = "repository.script.get"
ActionRepositoryScriptUpdate = "repository.script.update"
ActionRepositoryScriptDelete = "repository.script.delete"
// Task actions
ActionTaskList = "task.list"
ActionTaskCreate = "task.create"
ActionTaskGet = "task.get"
ActionTaskUpdate = "task.update"
ActionTaskDelete = "task.delete"
ActionTaskMove = "task.move"
ActionTaskState = "task.state"
ActionTaskExecution = "task.execution"
// Agent actions
ActionAgentList = "agent.list"
ActionAgentLaunch = "agent.launch"
ActionAgentStatus = "agent.status"
ActionAgentLogs = "agent.logs"
ActionAgentStop = "agent.stop"
ActionAgentPrompt = "agent.prompt"
ActionAgentCancel = "agent.cancel"
ActionAgentSession = "agent.session"
ActionAgentTypes = "agent.types"
// Orchestrator actions
ActionOrchestratorStatus = "orchestrator.status"
ActionOrchestratorQueue = "orchestrator.queue"
ActionOrchestratorTrigger = "orchestrator.trigger"
ActionOrchestratorStart = "orchestrator.start"
ActionOrchestratorStop = "orchestrator.stop"
ActionOrchestratorPause = "orchestrator.pause"
ActionOrchestratorResume = "orchestrator.resume"
ActionOrchestratorPrompt = "orchestrator.prompt"
ActionOrchestratorComplete = "orchestrator.complete"
// Subscription actions
ActionTaskSubscribe = "task.subscribe"
ActionTaskUnsubscribe = "task.unsubscribe"
// Comment actions
ActionCommentAdd = "comment.add"
ActionCommentGet = "comment.get"
ActionCommentList = "comment.list"
// Notification actions (server -> client)
ActionACPProgress = "acp.progress"
ActionACPLog = "acp.log"
ActionACPResult = "acp.result"
ActionACPError = "acp.error"
ActionACPStatus = "acp.status"
ActionACPHeartbeat = "acp.heartbeat"
ActionTaskCreated = "task.created"
ActionTaskUpdated = "task.updated"
ActionTaskDeleted = "task.deleted"
ActionTaskStateChanged = "task.state_changed"
ActionAgentUpdated = "agent.updated"
ActionWorkspaceCreated = "workspace.created"
ActionWorkspaceUpdated = "workspace.updated"
ActionWorkspaceDeleted = "workspace.deleted"
ActionBoardCreated = "board.created"
ActionBoardUpdated = "board.updated"
ActionBoardDeleted = "board.deleted"
ActionColumnCreated = "column.created"
ActionColumnUpdated = "column.updated"
ActionColumnDeleted = "column.deleted"
ActionCommentAdded = "comment.added"
ActionInputRequested = "input.requested"
ActionRepositoryCreated = "repository.created"
ActionRepositoryUpdated = "repository.updated"
ActionRepositoryDeleted = "repository.deleted"
ActionRepositoryScriptCreated = "repository.script.created"
ActionRepositoryScriptUpdated = "repository.script.updated"
ActionRepositoryScriptDeleted = "repository.script.deleted"
// Permission request actions (agent -> user -> agent)
ActionPermissionRequested = "permission.requested" // Agent requesting permission
ActionPermissionRespond = "permission.respond" // User responding to permission request
)
// Error codes
const (
ErrorCodeBadRequest = "BAD_REQUEST"
ErrorCodeNotFound = "NOT_FOUND"
ErrorCodeInternalError = "INTERNAL_ERROR"
ErrorCodeUnauthorized = "UNAUTHORIZED"
ErrorCodeForbidden = "FORBIDDEN"
ErrorCodeValidation = "VALIDATION_ERROR"
ErrorCodeUnknownAction = "UNKNOWN_ACTION"
)