connector

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIgnoreMessage = errors.New("ignore message")

Functions

This section is empty.

Types

type App

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

func NewApp

func NewApp(cfg config.Config, processor *Processor) *App

func (*App) FlushRuntimeState

func (a *App) FlushRuntimeState() error

func (*App) FlushRuntimeStateIfDirty

func (a *App) FlushRuntimeStateIfDirty() error

func (*App) IdleSummaryIdle

func (a *App) IdleSummaryIdle() time.Duration

func (*App) LoadRuntimeState

func (a *App) LoadRuntimeState(path string) error

func (*App) Run

func (a *App) Run(ctx context.Context) error

func (*App) SetAutomationRunner

func (a *App) SetAutomationRunner(runner AutomationRunner)

func (*App) SetPromptLoader

func (a *App) SetPromptLoader(loader *prompting.Loader)

func (*App) UpdateRuntimeConfig

func (a *App) UpdateRuntimeConfig(cfg config.Config)

type Attachment

type Attachment struct {
	SourceMessageID string
	Kind            string
	FileKey         string
	ImageKey        string
	FileName        string
	LocalPath       string
	DownloadError   string
}

type AttachmentDownloader

type AttachmentDownloader interface {
	DownloadAttachment(ctx context.Context, memoryScopeKey, sourceMessageID string, attachment *Attachment) error
}

type AutomationRunner

type AutomationRunner interface {
	Run(ctx context.Context)
}

type ChatMemberNameResolver

type ChatMemberNameResolver interface {
	ResolveChatMemberName(ctx context.Context, chatID, openID, userID string) (string, error)
}

type Job

type Job struct {
	ReceiveID            string
	ReceiveIDType        string
	ChatType             string
	BotOpenID            string
	BotUserID            string
	SenderName           string
	SenderOpenID         string
	SenderUserID         string
	SenderUnionID        string
	MentionedUsers       []MentionedUser
	SourceMessageID      string
	ReplyParentMessageID string
	ThreadID             string
	RootID               string
	MessageType          string
	Text                 string
	Attachments          []Attachment
	RawContent           string
	EventID              string
	ReceivedAt           time.Time
	MemoryScopeKey       string
	SessionKey           string
	SessionVersion       uint64
	WorkflowPhase        string
}

func BuildJob

func BuildJob(event *larkim.P2MessageReceiveV1) (*Job, error)

type JobProcessState

type JobProcessState string
const (
	JobProcessCompleted         JobProcessState = "completed"
	JobProcessRetryAfterRestart JobProcessState = "retry_after_restart"
)

type LarkSender

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

func NewLarkSender

func NewLarkSender(client *lark.Client, resourceDir string) *LarkSender

func (*LarkSender) AddReaction

func (s *LarkSender) AddReaction(ctx context.Context, messageID, emojiType string) error

func (*LarkSender) DownloadAttachment

func (s *LarkSender) DownloadAttachment(ctx context.Context, memoryScopeKey, sourceMessageID string, attachment *Attachment) error

func (*LarkSender) GetMessageText

func (s *LarkSender) GetMessageText(ctx context.Context, messageID string) (string, error)

func (*LarkSender) ReplyCard

func (s *LarkSender) ReplyCard(ctx context.Context, sourceMessageID, cardContent string) (string, error)

func (*LarkSender) ReplyFile

func (s *LarkSender) ReplyFile(ctx context.Context, sourceMessageID, fileKey string) (string, error)

func (*LarkSender) ReplyImage

func (s *LarkSender) ReplyImage(ctx context.Context, sourceMessageID, imageKey string) (string, error)

func (*LarkSender) ReplyRichText

func (s *LarkSender) ReplyRichText(ctx context.Context, sourceMessageID string, lines []string) (string, error)

func (*LarkSender) ReplyRichTextMarkdown

func (s *LarkSender) ReplyRichTextMarkdown(ctx context.Context, sourceMessageID, markdown string) (string, error)

func (*LarkSender) ReplyText

func (s *LarkSender) ReplyText(ctx context.Context, sourceMessageID, text string) (string, error)

func (*LarkSender) ResolveChatMemberName

func (s *LarkSender) ResolveChatMemberName(ctx context.Context, chatID, openID, userID string) (string, error)

func (*LarkSender) ResolveUserName

func (s *LarkSender) ResolveUserName(ctx context.Context, openID, userID string) (string, error)

func (*LarkSender) ResourceRootForScope

func (s *LarkSender) ResourceRootForScope(memoryScopeKey string) string

func (*LarkSender) SendCard

func (s *LarkSender) SendCard(ctx context.Context, receiveIDType, receiveID, cardContent string) error

func (*LarkSender) SendFile

func (s *LarkSender) SendFile(ctx context.Context, receiveIDType, receiveID, fileKey string) error

func (*LarkSender) SendImage

func (s *LarkSender) SendImage(ctx context.Context, receiveIDType, receiveID, imageKey string) error

func (*LarkSender) SendText

func (s *LarkSender) SendText(ctx context.Context, receiveIDType, receiveID, text string) error

func (*LarkSender) UploadFile

func (s *LarkSender) UploadFile(ctx context.Context, localPath, fileName string) (string, error)

func (*LarkSender) UploadImage

func (s *LarkSender) UploadImage(ctx context.Context, localPath string) (string, error)

type MemoryManager

type MemoryManager interface {
	BuildPrompt(memoryScopeKey, userText string) (string, error)
	SaveInteraction(memoryScopeKey, userText, assistantText string, failed bool) (changed bool, err error)
	AppendDailySummary(memoryScopeKey, sessionKey, summary string, at time.Time) error
}

type MentionedUser

type MentionedUser struct {
	Key     string
	Name    string
	OpenID  string
	UserID  string
	UnionID string
}

type Processor

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

func NewProcessor

func NewProcessor(
	backend llm.Backend,
	sender Sender,
	failureMessage string,
	thinkingMessage string,
) *Processor

func NewProcessorWithMemory

func NewProcessorWithMemory(
	backend llm.Backend,
	sender Sender,
	failureMessage string,
	thinkingMessage string,
	memoryManager MemoryManager,
) *Processor

func (*Processor) FlushSessionState

func (p *Processor) FlushSessionState() error

func (*Processor) FlushSessionStateIfDirty

func (p *Processor) FlushSessionStateIfDirty() error

func (*Processor) LoadSessionState

func (p *Processor) LoadSessionState(path string) error

func (*Processor) ProcessJob

func (p *Processor) ProcessJob(ctx context.Context, job Job) bool

func (*Processor) ProcessJobState

func (p *Processor) ProcessJobState(ctx context.Context, job Job) JobProcessState

func (*Processor) RunIdleSummaryScan

func (p *Processor) RunIdleSummaryScan(ctx context.Context, idleThreshold time.Duration)

func (*Processor) SetCodeArmyCommandDependencies

func (p *Processor) SetCodeArmyCommandDependencies(inspector *codearmy.Inspector, store *automation.Store)

func (*Processor) SetImmediateFeedback

func (p *Processor) SetImmediateFeedback(mode, emojiType string)

func (*Processor) SetLLMBackend

func (p *Processor) SetLLMBackend(backend llm.Backend)

func (*Processor) SetPromptLoader

func (p *Processor) SetPromptLoader(loader *prompting.Loader)

func (*Processor) SetReplyMessages

func (p *Processor) SetReplyMessages(failureMessage, thinkingMessage string)

func (*Processor) SetRuntimeAPI

func (p *Processor) SetRuntimeAPI(baseURL, token, runtimeBin string)

type ReplyContextProvider

type ReplyContextProvider interface {
	GetMessageText(ctx context.Context, messageID string) (string, error)
}

type Sender

type Sender interface {
	SendText(ctx context.Context, receiveIDType, receiveID, text string) error
	AddReaction(ctx context.Context, messageID, emojiType string) error
	ReplyText(ctx context.Context, sourceMessageID, text string) (string, error)
	ReplyRichText(ctx context.Context, sourceMessageID string, lines []string) (string, error)
	ReplyRichTextMarkdown(ctx context.Context, sourceMessageID, markdown string) (string, error)
	ReplyCard(ctx context.Context, sourceMessageID, cardContent string) (string, error)
}

type UserNameResolver

type UserNameResolver interface {
	ResolveUserName(ctx context.Context, openID, userID string) (string, error)
}

Jump to

Keyboard shortcuts

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