Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrThreadGone = errors.New("thread gone")
ErrThreadGone indicates the thread/topic no longer exists. Channel.Send returns this when the target has been deleted by the user.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel interface {
Name() string
Setup(ctx context.Context) error
Start(ctx context.Context, handler InboundHandler) error
Send(ctx context.Context, msg OutboundMessage) error
StartTyping(ctx context.Context, userID, replyToken string) (stop func())
// Returns "" if not supported.
ShareQR(ctx context.Context) (string, error)
// ProbeThread checks if the thread/topic for senderID is still valid.
// Returns ErrThreadGone if the thread has been deleted. Returns nil if valid or unsupported.
ProbeThread(ctx context.Context, senderID string) error
// RenameThread renames the thread/topic identified by replyToken. No-op if unsupported.
RenameThread(ctx context.Context, replyToken, name string)
Presenter() Presenter
}
Channel is a messaging platform (WeChat, Discord, Telegram, etc.).
type InboundHandler ¶
type InboundHandler func(ctx context.Context, msg InboundMessage)
InboundHandler is called for each inbound message from the platform.
type InboundMessage ¶
type InboundMessage struct {
SenderID string // platform user ID (e.g. xxx@im.wechat)
Text string // text content (includes quoted message formatting)
MediaFiles []types.MediaFile // media downloaded to local paths
ReplyToken string // platform-specific reply routing token
ActionOnly bool // if true, drop silently when the action is not handled (e.g. stale button press)
}
InboundMessage is a platform-agnostic inbound message.
type OutboundMessage ¶
type OutboundMessage struct {
RecipientID string
Text string
FilePath string // optional local file path for media
ReplyToken string
PromptKind PromptKind // interactive prompt type (0=normal message)
Options []string // option values for structured interaction (e.g. ["1","2","3"])
}
OutboundMessage is a platform-agnostic outbound message.
type Presenter ¶
type Presenter interface {
FormatPrompt(kind PromptKind, promptText string, options []string, toolName, description string) string
FormatError(err error) string
FormatMediaAnnotation(mf types.MediaFile) string
MediaInstructions() string
FormatText(text string) string
// ParseAction parses platform-specific input into a unified action.
// Returns nil if the input is not a control action (treat as normal message).
ParseAction(input string) *types.Action
}
Presenter renders structured responses for a specific platform.
type PromptKind ¶
type PromptKind int
PromptKind identifies the type of interactive prompt for channel-specific rendering. Defined independently from agent.PromptType — server maps between them.
const ( PromptKindNone PromptKind = iota PromptKindPermission // tool permission approval PromptKindInteractive // terminal interactive prompt PromptKindElicitation // MCP elicitation request PromptKindTUIMenu // TUI cursor menu (/model, /fast) )
Click to show internal directories.
Click to hide internal directories.