Files
kandev/apps/backend/pkg/websocket/actions.go
T
jcfs 35915ff0cb refactor: Replace REST API with WebSocket-only architecture
- Remove all REST endpoints, replace with WebSocket message-based API
- Add WebSocket gateway with Hub and Client for connection management
- Add WebSocket handlers for Task, Agent, and Orchestrator services
- Add task subscription support for real-time ACP notifications
- Update all documentation to reflect WebSocket-first architecture
- Replace docs/openapi.yaml with docs/asyncapi.yaml
- Update e2e tests to use WebSocket via websocat

WebSocket endpoint: ws://localhost:8080/ws
Message format: {id, type, action, payload, timestamp}

Available actions:
- Board: board.list, board.create, board.get, board.update, board.delete
- Column: column.list, column.create, column.get
- Task: task.list, task.create, task.get, task.update, task.delete,
        task.move, task.state, task.subscribe, task.unsubscribe
- Agent: agent.list, agent.launch, agent.status, agent.logs, agent.stop,
         agent.prompt, agent.cancel, agent.session, agent.types
- Orchestrator: orchestrator.status, orchestrator.queue, orchestrator.trigger,
                orchestrator.start, orchestrator.stop, orchestrator.prompt,
                orchestrator.complete
- Health: health.check
2026-01-10 23:01:05 +00:00

77 lines
2.2 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"
// Column actions
ActionColumnList = "column.list"
ActionColumnCreate = "column.create"
ActionColumnGet = "column.get"
// Task actions
ActionTaskList = "task.list"
ActionTaskCreate = "task.create"
ActionTaskGet = "task.get"
ActionTaskUpdate = "task.update"
ActionTaskDelete = "task.delete"
ActionTaskMove = "task.move"
ActionTaskState = "task.state"
// 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"
// Notification actions (server -> client)
ActionACPProgress = "acp.progress"
ActionACPLog = "acp.log"
ActionACPResult = "acp.result"
ActionACPError = "acp.error"
ActionACPStatus = "acp.status"
ActionACPHeartbeat = "acp.heartbeat"
ActionTaskUpdated = "task.updated"
ActionAgentUpdated = "agent.updated"
)
// Error codes
const (
ErrorCodeBadRequest = "BAD_REQUEST"
ErrorCodeNotFound = "NOT_FOUND"
ErrorCodeInternalError = "INTERNAL_ERROR"
ErrorCodeUnauthorized = "UNAUTHORIZED"
ErrorCodeForbidden = "FORBIDDEN"
ErrorCodeValidation = "VALIDATION_ERROR"
ErrorCodeUnknownAction = "UNKNOWN_ACTION"
)