Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChannelCreator ¶
type ChannelCreator interface {
CreateChannel(ctx context.Context, guildID, name string) (string, error)
InviteUserToChannel(ctx context.Context, channelID, userID string) error
GetOwnerUserID(ctx context.Context) (string, error)
SetChannelTopic(ctx context.Context, channelID, topic string) error
}
ChannelCreator can create channels on the chat platform.
type ChannelEnsurer ¶
type ChannelEnsurer interface {
EnsureChannel(ctx context.Context, dirPath string) (string, error)
CreateChannel(ctx context.Context, name, authorID string) (string, error)
}
ChannelEnsurer resolves a directory path to a channel ID, creating the channel if it does not yet exist.
func NewChannelService ¶
func NewChannelService(store db.Store, creator ChannelCreator, guildID string, platform types.Platform) ChannelEnsurer
NewChannelService creates a new ChannelEnsurer.
type ChannelLister ¶ added in v0.1.15
type ChannelLister interface {
ListChannels(ctx context.Context) ([]*db.Channel, error)
GetChannel(ctx context.Context, channelID string) (*db.Channel, error)
}
ChannelLister can list and look up channels from the database.
type MemoryIndexer ¶ added in v0.1.33
type MemoryIndexer interface {
Search(ctx context.Context, memoryDir, query string, topK int) ([]memory.SearchResult, error)
Index(ctx context.Context, memoryDir string) (int, error)
}
MemoryIndexer abstracts memory search and indexing for the memory API endpoints.
type MessageSender ¶ added in v0.1.15
MessageSender can send messages to channels or threads.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server exposes a lightweight HTTP API for task CRUD operations.
func NewServer ¶
func NewServer(sched scheduler.Scheduler, channels ChannelEnsurer, threads ThreadEnsurer, store ChannelLister, messages MessageSender, logger *slog.Logger) *Server
NewServer creates a new API server. The channels, threads, store, and messages parameters may be nil if those features are not configured.
func (*Server) SetLoopDir ¶ added in v0.1.33
SetLoopDir sets the loop directory used for fallback work dir resolution.
func (*Server) SetMemoryIndexer ¶ added in v0.1.33
func (s *Server) SetMemoryIndexer(idx MemoryIndexer)
SetMemoryIndexer configures the memory indexer for the /api/memory/* endpoints.
type ThreadCreator ¶ added in v0.1.11
type ThreadCreator interface {
CreateThread(ctx context.Context, channelID, name, mentionUserID, message string) (string, error)
DeleteThread(ctx context.Context, threadID string) error
}
ThreadCreator can create and delete threads on the chat platform.
type ThreadEnsurer ¶ added in v0.1.11
type ThreadEnsurer interface {
CreateThread(ctx context.Context, channelID, name, authorID, message string) (string, error)
DeleteThread(ctx context.Context, threadID string) error
}
ThreadEnsurer manages threads on the chat platform and the DB.
func NewThreadService ¶ added in v0.1.11
func NewThreadService(store db.Store, creator ThreadCreator, platform types.Platform) ThreadEnsurer
NewThreadService creates a new ThreadEnsurer.