feat: add bidirectional comment system and agent input request flow

- Add Comment model and CRUD operations (repository, service layers)
- Add WAITING_FOR_INPUT task state for agent input requests
- Add WebSocket actions for comment.add, comment.get, comment.list
- Add ActionCommentAdded and ActionInputRequested notifications
- Update PromptAgent to return PromptResult with stop reason
- Add e2e test for agent input request flow
- Add PR template for the repository

This enables agents to request input from users by returning
stopReason 'needs_input' which transitions the task to
WAITING_FOR_INPUT state and creates an agent comment.
This commit is contained in:
jcfs
2026-01-11 18:38:03 +00:00
parent 47a26fcc0e
commit 0fdf18c37b
24 changed files with 1296 additions and 68 deletions
+27 -7
View File
@@ -6,13 +6,14 @@ import "time"
type TaskState string
const (
TaskStateTODO TaskState = "TODO"
TaskStateInProgress TaskState = "IN_PROGRESS"
TaskStateReview TaskState = "REVIEW"
TaskStateBlocked TaskState = "BLOCKED"
TaskStateCompleted TaskState = "COMPLETED"
TaskStateFailed TaskState = "FAILED"
TaskStateCancelled TaskState = "CANCELLED"
TaskStateTODO TaskState = "TODO"
TaskStateInProgress TaskState = "IN_PROGRESS"
TaskStateReview TaskState = "REVIEW"
TaskStateBlocked TaskState = "BLOCKED"
TaskStateWaitingForInput TaskState = "WAITING_FOR_INPUT"
TaskStateCompleted TaskState = "COMPLETED"
TaskStateFailed TaskState = "FAILED"
TaskStateCancelled TaskState = "CANCELLED"
)
// Task represents a Kanban task
@@ -74,3 +75,22 @@ type TaskEvent struct {
CreatedBy *string `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
// Comment represents a comment on a task (user or agent)
type Comment struct {
ID string `json:"id"`
TaskID string `json:"task_id"`
AuthorType string `json:"author_type"` // "user" or "agent"
AuthorID string `json:"author_id,omitempty"`
Content string `json:"content"`
RequestsInput bool `json:"requests_input"` // True if agent is requesting user input
CreatedAt time.Time `json:"created_at"`
}
// CreateCommentRequest for adding a comment to a task
type CreateCommentRequest struct {
TaskID string `json:"task_id" binding:"required"`
Content string `json:"content" binding:"required"`
AuthorType string `json:"author_type,omitempty"` // Defaults to "user" if not specified
RequestsInput bool `json:"requests_input,omitempty"`
}