mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
ca5c6a1866
- Rename chat module to conversation with flow-based architecture - Move channelidentities into channel/identities subpackage - Add channel/route for routing logic - Add message service with event hub - Add MCP providers: container, directory, schedule - Refactor Feishu/Telegram adapters with directory and stream support - Add platform management page and channel badges in web UI - Update database schema for conversations, messages and channel routes - Add @memoh/shared package for cross-package type definitions
37 lines
1.5 KiB
Go
37 lines
1.5 KiB
Go
package channel
|
|
|
|
import "context"
|
|
|
|
// DirectoryEntryKind classifies a directory entry as a user or a group.
|
|
type DirectoryEntryKind string
|
|
|
|
const (
|
|
DirectoryEntryUser DirectoryEntryKind = "user"
|
|
DirectoryEntryGroup DirectoryEntryKind = "group"
|
|
)
|
|
|
|
// DirectoryEntry represents a single user or group discovered through the channel's directory.
|
|
type DirectoryEntry struct {
|
|
Kind DirectoryEntryKind `json:"kind"`
|
|
ID string `json:"id"`
|
|
Name string `json:"name,omitempty"`
|
|
Handle string `json:"handle,omitempty"`
|
|
AvatarURL string `json:"avatar_url,omitempty"`
|
|
Metadata map[string]any `json:"metadata,omitempty"`
|
|
}
|
|
|
|
// DirectoryQuery contains filters for directory listing operations.
|
|
type DirectoryQuery struct {
|
|
Query string `json:"query,omitempty"`
|
|
Limit int `json:"limit,omitempty"`
|
|
Kind DirectoryEntryKind `json:"kind,omitempty"`
|
|
}
|
|
|
|
// ChannelDirectoryAdapter provides contact and group lookup for a channel platform.
|
|
type ChannelDirectoryAdapter interface {
|
|
ListPeers(ctx context.Context, cfg ChannelConfig, query DirectoryQuery) ([]DirectoryEntry, error)
|
|
ListGroups(ctx context.Context, cfg ChannelConfig, query DirectoryQuery) ([]DirectoryEntry, error)
|
|
ListGroupMembers(ctx context.Context, cfg ChannelConfig, groupID string, query DirectoryQuery) ([]DirectoryEntry, error)
|
|
ResolveEntry(ctx context.Context, cfg ChannelConfig, input string, kind DirectoryEntryKind) (DirectoryEntry, error)
|
|
}
|