mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
90b4a64683
Phase 10: Define TypingCapable, MessageEditor, PlaceholderRecorder interfaces. Manager orchestrates outbound typing stop and placeholder editing via preSend. Migrate Telegram, Discord, Slack, OneBot to register state with Manager instead of handling locally in Send. Phase 7: Add native WebSocket Pico Protocol channel as reference implementation of all optional capability interfaces.
25 lines
1007 B
Go
25 lines
1007 B
Go
package channels
|
|
|
|
import "context"
|
|
|
|
// TypingCapable — channels that can show a typing/thinking indicator.
|
|
// StartTyping begins the indicator and returns a stop function.
|
|
// The stop function MUST be idempotent and safe to call multiple times.
|
|
type TypingCapable interface {
|
|
StartTyping(ctx context.Context, chatID string) (stop func(), err error)
|
|
}
|
|
|
|
// MessageEditor — channels that can edit an existing message.
|
|
// messageID is always string; channels convert platform-specific types internally.
|
|
type MessageEditor interface {
|
|
EditMessage(ctx context.Context, chatID string, messageID string, content string) error
|
|
}
|
|
|
|
// PlaceholderRecorder is injected into channels by Manager.
|
|
// Channels call these methods on inbound to register typing/placeholder state.
|
|
// Manager uses the registered state on outbound to stop typing and edit placeholders.
|
|
type PlaceholderRecorder interface {
|
|
RecordPlaceholder(channel, chatID, placeholderID string)
|
|
RecordTypingStop(channel, chatID string, stop func())
|
|
}
|