chat

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAgentAuthPolicyNotDefined is returned when agent authorization policy is not defined
	ErrAgentAuthPolicyNotDefined = errors.New("agent authorization policy not defined")

	// ErrAgentAuthDenied is returned when agent authorization is denied
	ErrAgentAuthDenied = errors.New("agent request not authorized")
)
View Source
var (
	// ErrSessionAborted is returned when a session is aborted by user request
	ErrSessionAborted = goerr.New("session aborted by user")
)

Functions

func AuthorizeAgentRequest

func AuthorizeAgentRequest(ctx context.Context, policyClient interfaces.PolicyClient, noAuthz bool, message string) error

AuthorizeAgentRequest checks policy-based authorization for agent execution.

func CollectThreadComments

func CollectThreadComments(ctx context.Context, repo interfaces.Repository, ticketID types.TicketID, currentSession *session.Session) []ticket.Comment

CollectThreadComments retrieves thread comments posted between sessions. If currentSession is nil, it collects recent comments without session-based filtering.

func LoadHistory

func LoadHistory(ctx context.Context, repo interfaces.Repository, ticketID types.TicketID, storageSvc *storage.Service) (*gollem.History, error)

LoadHistory loads the chat history for a ticket from storage. It first tries to load from latest.json, falling back to history/{id}.json.

func SaveHistory

func SaveHistory(ctx context.Context, repo interfaces.Repository, storageClient interfaces.StorageClient, storageSvc *storage.Service, ticketID types.TicketID, history *gollem.History) error

SaveHistory saves a gollem History to storage and records it in the repository.

Types

type Option added in v0.15.0

type Option func(*UseCase)

Option configures a UseCase.

func WithFrontendURL added in v0.15.0

func WithFrontendURL(url string) Option

WithFrontendURL sets the frontend URL for session links.

func WithNoAuthorization added in v0.15.0

func WithNoAuthorization(noAuthz bool) Option

WithNoAuthorization disables policy-based authorization checks.

func WithPolicyClient added in v0.15.0

func WithPolicyClient(pc interfaces.PolicyClient) Option

WithPolicyClient sets the policy client for authorization.

func WithRepository added in v0.15.0

func WithRepository(repo interfaces.Repository) Option

WithRepository sets the repository.

func WithSlackService added in v0.15.0

func WithSlackService(svc *slackService.Service) Option

WithSlackService sets the Slack service for message routing.

type RunContext added in v0.15.0

type RunContext struct {
	Session *session.Session
	Message string
	ChatCtx *chatModel.ChatContext
}

RunContext holds all the pre-initialized resources that UseCase passes to a Strategy after completing common setup.

type Strategy added in v0.15.0

type Strategy interface {
	Execute(ctx context.Context, rc *RunContext) error
}

Strategy defines the interface for chat execution strategies. Implementations receive a RunContext with a pre-initialized Warren session (session created, message routing configured, authorization verified). The strategy is responsible for its own gollem LLM session management and execution workflow (planning, task execution, replanning, etc.).

type UseCase added in v0.15.0

type UseCase struct {
	// contains filtered or unexported fields
}

UseCase implements interfaces.ChatUseCase by performing common setup (Warren session management, message routing, authorization) and delegating strategy-specific execution to a Strategy implementation.

func NewUseCase added in v0.15.0

func NewUseCase(strategy Strategy, opts ...Option) *UseCase

NewUseCase creates a new UseCase with the given strategy and options.

func (*UseCase) Execute added in v0.15.0

func (u *UseCase) Execute(ctx context.Context, message string, chatCtx chatModel.ChatContext) error

Execute processes a chat message: creates a Warren session, sets up message routing, checks authorization, and delegates to the Strategy.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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