interaction

package
v0.0.28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

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 Option

type Option struct {
	Label       string `yaml:"label"`
	Value       string `yaml:"value"`
	Description string `yaml:"description"`
}

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL