Documentation
¶
Index ¶
- Variables
- func DefaultBindingsPath() (string, error)
- func DefaultPairingStatePath() (string, error)
- func StartNamedAdapter(parent context.Context, cfg config.IMConfig, name string, mgr *Manager) error
- type AdapterController
- type AdapterDescriptor
- type AdapterState
- type ApprovalRequest
- type ApprovalResponse
- type ApprovalResult
- type ApprovalState
- type Attachment
- type AttachmentKind
- type BindingStore
- type Bridge
- type ChannelBinding
- type Envelope
- type InboundMessage
- type JSONFileBindingStore
- type JSONFilePairingStore
- type Manager
- func (m *Manager) ActiveSession() *SessionBinding
- func (m *Manager) BindChannel(binding ChannelBinding) (ChannelBinding, error)
- func (m *Manager) BindSession(binding SessionBinding)
- func (m *Manager) ClearChannel(workspace string) error
- func (m *Manager) ClearReplyWindow(workspace string) error
- func (m *Manager) CurrentBinding() *ChannelBinding
- func (m *Manager) Emit(ctx context.Context, event OutboundEvent) error
- func (m *Manager) GenerateShareLink(ctx context.Context, adapter, callbackData string) (string, error)
- func (m *Manager) HandleInbound(ctx context.Context, msg InboundMessage) error
- func (m *Manager) HandlePairingInbound(msg InboundMessage) (PairingResult, error)
- func (m *Manager) ListBindings() ([]ChannelBinding, error)
- func (m *Manager) PublishAdapterState(state AdapterState)
- func (m *Manager) RecordPassiveReply(workspace, messageID string, sentAt time.Time) error
- func (m *Manager) RegisterApproval(req ApprovalRequest) (ApprovalRequest, <-chan permission.Decision)
- func (m *Manager) RegisterSink(sink Sink)
- func (m *Manager) RejectPendingPairing() (*PairingChallenge, bool, error)
- func (m *Manager) ResolveApproval(resp ApprovalResponse) (ApprovalResult, bool, error)
- func (m *Manager) SendDirect(ctx context.Context, binding ChannelBinding, event OutboundEvent) error
- func (m *Manager) SetBindingStore(store BindingStore) error
- func (m *Manager) SetBridge(bridge Bridge)
- func (m *Manager) SetOnUpdate(cb func(StatusSnapshot))
- func (m *Manager) SetPairingStore(store PairingStateStore) error
- func (m *Manager) Snapshot() StatusSnapshot
- func (m *Manager) SyncSessionHistory(ctx context.Context, messages []provider.Message) error
- func (m *Manager) UnbindChannel(workspace string) error
- func (m *Manager) UnbindSession()
- func (m *Manager) UnregisterSink(name string)
- type MemoryBindingStore
- type MemoryPairingStore
- type OutboundEvent
- type OutboundEventKind
- type PairingChallenge
- type PairingChannelState
- type PairingKind
- type PairingResult
- type PairingStateStore
- type Platform
- type SessionBinding
- type ShareLinkProvider
- type Sink
- type StatusSnapshot
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoSessionBound = errors.New("no active session bound") ErrNoChannelBound = errors.New("no channel bound for active workspace") ErrNoBridge = errors.New("no IM bridge configured") ErrApprovalNotFound = errors.New("approval not found") ErrAdapterAlreadyBound = errors.New("adapter already bound to another workspace") ErrInboundChannelDenied = errors.New("inbound message does not match active binding") ErrNoPendingPairing = errors.New("no pending pairing challenge") )
Functions ¶
func DefaultBindingsPath ¶
func DefaultPairingStatePath ¶
Types ¶
type AdapterController ¶
type AdapterController struct {
// contains filtered or unexported fields
}
func StartConfiguredAdapters ¶
func (*AdapterController) Stop ¶
func (c *AdapterController) Stop()
type AdapterDescriptor ¶
type AdapterState ¶
type ApprovalRequest ¶
type ApprovalResponse ¶
type ApprovalResult ¶
type ApprovalResult struct {
Request ApprovalRequest
Decision permission.Decision
RespondedBy string
RespondedAt time.Time
}
type ApprovalState ¶
type ApprovalState struct {
Request ApprovalRequest
Resolved bool
Decision permission.Decision
RespondedBy string
RespondedAt time.Time
}
type Attachment ¶
type AttachmentKind ¶
type AttachmentKind string
const ( AttachmentImage AttachmentKind = "image" AttachmentVoice AttachmentKind = "voice" AttachmentAudio AttachmentKind = "audio" AttachmentFile AttachmentKind = "file" )
type BindingStore ¶
type BindingStore interface {
Load(workspace string) (*ChannelBinding, error)
Save(binding ChannelBinding) error
Delete(workspace string) error
List() ([]ChannelBinding, error)
}
type Bridge ¶
type Bridge interface {
SubmitInboundMessage(ctx context.Context, msg InboundMessage) error
}
type ChannelBinding ¶
type InboundMessage ¶
type InboundMessage struct {
Envelope Envelope
Text string
Attachments []Attachment
Metadata map[string]string
}
func (InboundMessage) ProviderContent ¶
func (m InboundMessage) ProviderContent() []provider.ContentBlock
type JSONFileBindingStore ¶
type JSONFileBindingStore struct {
// contains filtered or unexported fields
}
func NewJSONFileBindingStore ¶
func NewJSONFileBindingStore(path string) (*JSONFileBindingStore, error)
func (*JSONFileBindingStore) Delete ¶
func (s *JSONFileBindingStore) Delete(workspace string) error
func (*JSONFileBindingStore) List ¶
func (s *JSONFileBindingStore) List() ([]ChannelBinding, error)
func (*JSONFileBindingStore) Load ¶
func (s *JSONFileBindingStore) Load(workspace string) (*ChannelBinding, error)
func (*JSONFileBindingStore) Save ¶
func (s *JSONFileBindingStore) Save(binding ChannelBinding) error
type JSONFilePairingStore ¶
type JSONFilePairingStore struct {
// contains filtered or unexported fields
}
func NewJSONFilePairingStore ¶
func NewJSONFilePairingStore(path string) (*JSONFilePairingStore, error)
func (*JSONFilePairingStore) LoadAll ¶
func (s *JSONFilePairingStore) LoadAll() (map[string]PairingChannelState, error)
func (*JSONFilePairingStore) SaveAll ¶
func (s *JSONFilePairingStore) SaveAll(states map[string]PairingChannelState) error
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager() *Manager
func (*Manager) ActiveSession ¶
func (m *Manager) ActiveSession() *SessionBinding
func (*Manager) BindChannel ¶
func (m *Manager) BindChannel(binding ChannelBinding) (ChannelBinding, error)
func (*Manager) BindSession ¶
func (m *Manager) BindSession(binding SessionBinding)
func (*Manager) ClearChannel ¶
func (*Manager) ClearReplyWindow ¶
func (*Manager) CurrentBinding ¶
func (m *Manager) CurrentBinding() *ChannelBinding
func (*Manager) GenerateShareLink ¶
func (*Manager) HandleInbound ¶
func (m *Manager) HandleInbound(ctx context.Context, msg InboundMessage) error
func (*Manager) HandlePairingInbound ¶
func (m *Manager) HandlePairingInbound(msg InboundMessage) (PairingResult, error)
func (*Manager) ListBindings ¶
func (m *Manager) ListBindings() ([]ChannelBinding, error)
func (*Manager) PublishAdapterState ¶
func (m *Manager) PublishAdapterState(state AdapterState)
func (*Manager) RecordPassiveReply ¶
func (*Manager) RegisterApproval ¶
func (m *Manager) RegisterApproval(req ApprovalRequest) (ApprovalRequest, <-chan permission.Decision)
func (*Manager) RegisterSink ¶
func (*Manager) RejectPendingPairing ¶
func (m *Manager) RejectPendingPairing() (*PairingChallenge, bool, error)
func (*Manager) ResolveApproval ¶
func (m *Manager) ResolveApproval(resp ApprovalResponse) (ApprovalResult, bool, error)
func (*Manager) SendDirect ¶
func (m *Manager) SendDirect(ctx context.Context, binding ChannelBinding, event OutboundEvent) error
func (*Manager) SetBindingStore ¶
func (m *Manager) SetBindingStore(store BindingStore) error
func (*Manager) SetOnUpdate ¶
func (m *Manager) SetOnUpdate(cb func(StatusSnapshot))
func (*Manager) SetPairingStore ¶
func (m *Manager) SetPairingStore(store PairingStateStore) error
func (*Manager) Snapshot ¶
func (m *Manager) Snapshot() StatusSnapshot
func (*Manager) SyncSessionHistory ¶
func (*Manager) UnbindChannel ¶
func (*Manager) UnbindSession ¶
func (m *Manager) UnbindSession()
func (*Manager) UnregisterSink ¶
type MemoryBindingStore ¶
type MemoryBindingStore struct {
// contains filtered or unexported fields
}
func NewMemoryBindingStore ¶
func NewMemoryBindingStore() *MemoryBindingStore
func (*MemoryBindingStore) Delete ¶
func (s *MemoryBindingStore) Delete(workspace string) error
func (*MemoryBindingStore) List ¶
func (s *MemoryBindingStore) List() ([]ChannelBinding, error)
func (*MemoryBindingStore) Load ¶
func (s *MemoryBindingStore) Load(workspace string) (*ChannelBinding, error)
func (*MemoryBindingStore) Save ¶
func (s *MemoryBindingStore) Save(binding ChannelBinding) error
type MemoryPairingStore ¶
type MemoryPairingStore struct {
// contains filtered or unexported fields
}
func NewMemoryPairingStore ¶
func NewMemoryPairingStore() *MemoryPairingStore
func (*MemoryPairingStore) LoadAll ¶
func (s *MemoryPairingStore) LoadAll() (map[string]PairingChannelState, error)
func (*MemoryPairingStore) SaveAll ¶
func (s *MemoryPairingStore) SaveAll(states map[string]PairingChannelState) error
type OutboundEvent ¶
type OutboundEvent struct {
Kind OutboundEventKind
Text string
Status string
Approval *ApprovalRequest
Result *ApprovalResult
CreatedAt time.Time
}
func SessionHistoryEvents ¶
func SessionHistoryEvents(messages []provider.Message) []OutboundEvent
type OutboundEventKind ¶
type OutboundEventKind string
const ( OutboundEventText OutboundEventKind = "text" OutboundEventStatus OutboundEventKind = "status" OutboundEventApprovalRequest OutboundEventKind = "approval_request" OutboundEventApprovalResult OutboundEventKind = "approval_result" )
type PairingChallenge ¶
type PairingChallenge struct {
Kind PairingKind
Workspace string
Adapter string
Platform Platform
ChannelID string
ThreadID string
SenderID string
SenderName string
Code string
RequestedAt time.Time
LastInboundMessageID string
LastInboundAt time.Time
ExistingBinding *ChannelBinding
}
func (PairingChallenge) ReplyBinding ¶
func (c PairingChallenge) ReplyBinding() ChannelBinding
type PairingChannelState ¶
type PairingChannelState struct {
Adapter string
Platform Platform
ChannelID string
RejectCount int
BlacklistedAt time.Time
UpdatedAt time.Time
}
func (PairingChannelState) IsBlacklisted ¶
func (s PairingChannelState) IsBlacklisted() bool
type PairingKind ¶
type PairingKind string
const ( PairingKindBind PairingKind = "bind" PairingKindRebind PairingKind = "rebind" )
type PairingResult ¶
type PairingResult struct {
Consumed bool
Kind PairingKind
ReplyText string
Bound bool
PreviousBinding *ChannelBinding
NewBinding *ChannelBinding
}
type PairingStateStore ¶
type PairingStateStore interface {
LoadAll() (map[string]PairingChannelState, error)
SaveAll(map[string]PairingChannelState) error
}
type SessionBinding ¶
type ShareLinkProvider ¶
type ShareLinkProvider interface {
}
type Sink ¶
type Sink interface {
Name() string
Send(context.Context, ChannelBinding, OutboundEvent) error
}
type StatusSnapshot ¶
type StatusSnapshot struct {
ActiveSession *SessionBinding
CurrentBinding *ChannelBinding
PendingPairing *PairingChallenge
Adapters []AdapterState
PendingApprovals []ApprovalState
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.