Documentation
¶
Index ¶
- func ExtractContext(platformName, raw string) string
- func MarshalContext(name string, v any) string
- func RegisterExtractor(name string, fn func(string) string)
- func SanitizeFileName(name string) string
- func SessionChatID(sessionKey, platformID string) (string, error)
- type InboundMessage
- type OutboundMessage
- type Platform
- type PlatformReceiverAdapter
- type PlatformSenderAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractContext ¶ added in v0.0.31
func MarshalContext ¶ added in v0.0.31
func RegisterExtractor ¶ added in v0.0.31
func SanitizeFileName ¶
SanitizeFileName removes control characters and path separators for safe file handling (CWE-93).
func SessionChatID ¶ added in v0.0.46
Types ¶
type InboundMessage ¶
type InboundMessage struct {
Platform string // "feishu" | "dingtalk" | "wecom"
SenderID string
SessionKey string // platform-prefixed session key, e.g. "feishu:chatID:userID"
Content string
RawContent string // original message text with formatting preserved (at-tags, markup)
Raw string // original platform event, used by the sender for reply metadata
PlatformMessageID string // platform-native dedup ID; empty string means no dedup
MessageTime int64 // Unix milliseconds from platform; 0 = unknown (fallback to server time)
}
InboundMessage carries a parsed message from any platform.
type OutboundMessage ¶
type OutboundMessage struct {
ID string
SessionKey string
Content string
ReplyTo InboundMessage
Proactive bool
MediaPath string // optional local file path to upload and send
SourceType string // "bee" | "worker" | "system" — who sent this message
SourceID string // worker_id when SourceType is "worker"
InboundMsgID string // ID of the bee_platform_messages row that triggered this reply
}
OutboundMessage carries a reply to send back on a platform.
type Platform ¶
type Platform interface {
ID() string
Receiver() PlatformReceiverAdapter
Sender() PlatformSenderAdapter
}
Platform bundles a receiver and sender for a single messaging platform.
type PlatformReceiverAdapter ¶
type PlatformReceiverAdapter interface {
Start(ctx context.Context, dispatch func(InboundMessage)) error
}
PlatformReceiverAdapter receives inbound messages and dispatches them.
type PlatformSenderAdapter ¶
type PlatformSenderAdapter interface {
Send(ctx context.Context, msg OutboundMessage) error
}
PlatformSenderAdapter sends outbound messages on a platform.