Documentation
¶
Index ¶
- func MarshalInteractionPayload(pb *taskguildv1.Interaction) string
- func ToProto(i *Interaction) *taskguildv1.Interaction
- func UnmarshalInteractionPayload(payload string) *taskguildv1.Interaction
- type Interaction
- type InteractionStatus
- type InteractionType
- type Option
- type Repository
- type Server
- func (s *Server) ExpireInteraction(ctx context.Context, ...) (*connect.Response[taskguildv1.ExpireInteractionResponse], error)
- func (s *Server) ListInteractions(ctx context.Context, req *connect.Request[taskguildv1.ListInteractionsRequest]) (*connect.Response[taskguildv1.ListInteractionsResponse], error)
- func (s *Server) RespondToInteraction(ctx context.Context, ...) (*connect.Response[taskguildv1.RespondToInteractionResponse], error)
- func (s *Server) RespondToInteractionByToken(ctx context.Context, ...) (*connect.Response[taskguildv1.RespondToInteractionByTokenResponse], error)
- func (s *Server) SendMessage(ctx context.Context, req *connect.Request[taskguildv1.SendMessageRequest]) (*connect.Response[taskguildv1.SendMessageResponse], error)
- func (s *Server) SubscribeInteractions(ctx context.Context, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalInteractionPayload ¶
func MarshalInteractionPayload(pb *taskguildv1.Interaction) string
MarshalInteractionPayload serializes an Interaction proto to a JSON string suitable for embedding in an Event's payload field.
func ToProto ¶
func ToProto(i *Interaction) *taskguildv1.Interaction
ToProto converts a domain Interaction to its protobuf representation.
func UnmarshalInteractionPayload ¶
func UnmarshalInteractionPayload(payload string) *taskguildv1.Interaction
UnmarshalInteractionPayload deserializes an Interaction proto from a JSON payload string. Returns nil if the payload is empty or cannot be parsed.
Types ¶
type Interaction ¶
type Interaction struct {
ID string `yaml:"id"`
TaskID string `yaml:"task_id"`
AgentID string `yaml:"agent_id"`
Type InteractionType `yaml:"type"`
Status InteractionStatus `yaml:"status"`
Title string `yaml:"title"`
Description string `yaml:"description"`
Options []Option `yaml:"options"`
Response string `yaml:"response"`
ResponseToken string `yaml:"response_token,omitempty"`
Metadata string `yaml:"metadata,omitempty"`
CreatedAt time.Time `yaml:"created_at"`
RespondedAt *time.Time `yaml:"responded_at"`
}
func FromProto ¶
func FromProto(pb *taskguildv1.Interaction) *Interaction
FromProto converts a protobuf Interaction back to the domain model.
type InteractionStatus ¶
type InteractionStatus int32
const ( StatusUnspecified InteractionStatus = 0 StatusPending InteractionStatus = 1 StatusResponded InteractionStatus = 2 StatusExpired InteractionStatus = 3 )
type InteractionType ¶
type InteractionType int32
const ( TypeUnspecified InteractionType = 0 TypePermissionRequest InteractionType = 1 TypeQuestion InteractionType = 2 TypeNotification InteractionType = 3 TypeUserMessage InteractionType = 4 )
type Repository ¶
type Repository interface {
Create(ctx context.Context, i *Interaction) error
Get(ctx context.Context, id string) (*Interaction, error)
// GetByResponseToken finds a PENDING interaction by its single-use response token.
// Returns nil and an error if no matching interaction is found.
GetByResponseToken(ctx context.Context, token string) (*Interaction, error)
List(ctx context.Context, taskID string, taskIDs []string, limit, offset int) ([]*Interaction, int, error)
Update(ctx context.Context, i *Interaction) error
// ExpirePendingByTask sets all PENDING interactions for the given task to EXPIRED.
// Returns the number of interactions expired.
ExpirePendingByTask(ctx context.Context, taskID string) (int, error)
// DeleteByTaskID removes all interactions belonging to the given task.
DeleteByTaskID(ctx context.Context, taskID string) (int, error)
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(repo Repository, taskRepo task.Repository, eventBus *eventbus.Bus) *Server
func (*Server) ExpireInteraction ¶
func (s *Server) ExpireInteraction(ctx context.Context, req *connect.Request[taskguildv1.ExpireInteractionRequest]) (*connect.Response[taskguildv1.ExpireInteractionResponse], error)
func (*Server) ListInteractions ¶
func (s *Server) ListInteractions(ctx context.Context, req *connect.Request[taskguildv1.ListInteractionsRequest]) (*connect.Response[taskguildv1.ListInteractionsResponse], error)
func (*Server) RespondToInteraction ¶
func (s *Server) RespondToInteraction(ctx context.Context, req *connect.Request[taskguildv1.RespondToInteractionRequest]) (*connect.Response[taskguildv1.RespondToInteractionResponse], error)
func (*Server) RespondToInteractionByToken ¶
func (s *Server) RespondToInteractionByToken(ctx context.Context, req *connect.Request[taskguildv1.RespondToInteractionByTokenRequest]) (*connect.Response[taskguildv1.RespondToInteractionByTokenResponse], error)
func (*Server) SendMessage ¶
func (s *Server) SendMessage(ctx context.Context, req *connect.Request[taskguildv1.SendMessageRequest]) (*connect.Response[taskguildv1.SendMessageResponse], error)
func (*Server) SubscribeInteractions ¶
func (s *Server) SubscribeInteractions(ctx context.Context, req *connect.Request[taskguildv1.SubscribeInteractionsRequest], stream *connect.ServerStream[taskguildv1.InteractionEvent]) error
Click to show internal directories.
Click to hide internal directories.