Documentation
¶
Overview ¶
Package contract checks that the Local API behaves like *core.Service: the same scenarios run against the typed service and through JSON-RPC.
Index ¶
- type API
- type Remote
- func (r *Remote) AddAccount(ctx context.Context, in core.AccountInput) (core.Account, error)
- func (r *Remote) Ask(ctx context.Context, conversationID int64, input string) (<-chan core.WitEvent, error)
- func (r *Remote) BeginOAuth(ctx context.Context, providerID, loginHint string, client core.OAuthClient) (string, string, error)
- func (r *Remote) BlockSender(ctx context.Context, from string) error
- func (r *Remote) BlockedSenders(ctx context.Context) ([]string, error)
- func (r *Remote) CachedImage(ctx context.Context, src string) (core.CachedImageFile, error)
- func (r *Remote) CachedImageDims(src string) core.ImageDims
- func (r *Remote) CancelOAuth(flowID string)
- func (r *Remote) CancelOutbox(ctx context.Context, id int64) error
- func (r *Remote) CheckAccount(ctx context.Context, in core.AccountInput) (core.CheckReport, error)
- func (r *Remote) CheckModelService(ctx context.Context, id int64, in core.ModelServiceInput) (core.ServiceCheck, error)
- func (r *Remote) DetectProvider(ctx context.Context, email string) (auth.Provider, auth.Source, error)
- func (r *Remote) DownloadRecognitionModelStream(ctx context.Context) (<-chan core.RecognitionModelProgress, error)
- func (r *Remote) ExportAccounts(ctx context.Context) ([]byte, error)
- func (r *Remote) FetchAttachmentsStream(ctx context.Context, attachmentIDs []int64) (<-chan core.FetchedAttachment, error)
- func (r *Remote) ForgetImageFailure(urls []string)
- func (r *Remote) GetAttachment(ctx context.Context, attachmentID int64) (string, core.AttachmentInfo, error)
- func (r *Remote) GetMessage(ctx context.Context, id int64, loadRemoteImages bool) (core.Message, error)
- func (r *Remote) GetMessageLazyImages(ctx context.Context, id int64, loadRemoteImages bool) (core.Message, error)
- func (r *Remote) GetMessageText(ctx context.Context, id int64) (core.MessageText, error)
- func (r *Remote) GetSettings(ctx context.Context) (core.Settings, error)
- func (r *Remote) GetThread(ctx context.Context, id int64) (core.Thread, error)
- func (r *Remote) ImportAccounts(ctx context.Context, data []byte) (core.AccountImportResult, error)
- func (r *Remote) InboxOnly() bool
- func (r *Remote) InlineImagesStream(ctx context.Context, id int64) (<-chan core.InlineImage, error)
- func (r *Remote) InstallPluginFromRegistryStream(ctx context.Context, name string) (<-chan core.PluginInstallEvent, error)
- func (r *Remote) ListAccounts(ctx context.Context) ([]core.Account, error)
- func (r *Remote) ListApprovals(ctx context.Context, conversationID int64) ([]core.Approval, error)
- func (r *Remote) ListFolders(ctx context.Context, accountID int64) ([]core.Folder, error)
- func (r *Remote) ListMessages(ctx context.Context, v core.View, cursor string, limit int) (core.MessagePage, error)
- func (r *Remote) ListOutbox(ctx context.Context, accountID int64) ([]core.OutboxItem, error)
- func (r *Remote) ListThreads(ctx context.Context, v core.View, cursor string, limit int) (core.ThreadPage, error)
- func (r *Remote) ModelServiceAvatar(ctx context.Context, id int64) (core.Avatar, error)
- func (r *Remote) NewConversation(ctx context.Context, kind string, draftID int64) (core.Conversation, error)
- func (r *Remote) NewDraft(ctx context.Context, accountID int64, mode string, sourceMessageID int64) (core.Draft, error)
- func (r *Remote) PluginReadme(ctx context.Context, name, lang string) (string, error)
- func (r *Remote) PrepareModelStream(ctx context.Context, ref string) (<-chan core.PrepareModelEvent, error)
- func (r *Remote) PreviewAccountImport(ctx context.Context, data []byte) (core.AccountImportPreview, error)
- func (r *Remote) RemoveAccount(ctx context.Context, id int64) error
- func (r *Remote) RequestMCPSend(ctx context.Context, draftID, revision int64) (bool, error)
- func (r *Remote) ResolveApproval(ctx context.Context, id int64, accept bool) error
- func (r *Remote) ResolveApprovalWithArgs(ctx context.Context, id int64, accept bool, args json.RawMessage) error
- func (r *Remote) RunAction(ctx context.Context, id string, t core.Target, opts core.RunActionOptions) (core.ActionResult, error)
- func (r *Remote) RunSkill(ctx context.Context, name string, t core.Target) (<-chan ai.Event, error)
- func (r *Remote) SaveDraft(ctx context.Context, d core.Draft) (core.Draft, error)
- func (r *Remote) Search(ctx context.Context, accountID int64, query string, limit int) ([]core.MessageSummary, error)
- func (r *Remote) Send(ctx context.Context, draftID int64) error
- func (r *Remote) SendAcknowledged(ctx context.Context, draftID int64, digest string) error
- func (r *Remote) SenderAvatar(ctx context.Context, messageID int64, allowRemote bool) (core.Avatar, error)
- func (r *Remote) SetComposeOpen(ctx context.Context, draftIDs []int64) error
- func (r *Remote) SetInboxOnly(on bool)
- func (r *Remote) SetSettings(ctx context.Context, st core.Settings) (core.Settings, error)
- func (r *Remote) SetUIForeground(ctx context.Context, on bool) error
- func (r *Remote) StreamErrs() []error
- func (r *Remote) Subscribe() (<-chan events.Event, func())
- func (r *Remote) SubscribeConversation(id int64) (<-chan core.WitEvent, func())
- func (r *Remote) SystemTranslatorLanguages() []string
- func (r *Remote) TrustImageSender(ctx context.Context, from string) error
- func (r *Remote) TrustedImageSenders(ctx context.Context) ([]string, error)
- func (r *Remote) UnblockSender(ctx context.Context, addr string) error
- func (r *Remote) UntrustImageSender(ctx context.Context, addr string) error
- func (r *Remote) UpdatePassword(ctx context.Context, id int64, password string) error
- type UIAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface {
AddAccount(ctx context.Context, in core.AccountInput) (core.Account, error)
CheckAccount(ctx context.Context, in core.AccountInput) (core.CheckReport, error)
DetectProvider(ctx context.Context, email string) (auth.Provider, auth.Source, error)
ExportAccounts(ctx context.Context) ([]byte, error)
PreviewAccountImport(ctx context.Context, data []byte) (core.AccountImportPreview, error)
ImportAccounts(ctx context.Context, data []byte) (core.AccountImportResult, error)
RemoveAccount(ctx context.Context, id int64) error
UpdatePassword(ctx context.Context, id int64, password string) error
ListAccounts(ctx context.Context) ([]core.Account, error)
ListFolders(ctx context.Context, accountID int64) ([]core.Folder, error)
ListThreads(ctx context.Context, v core.View, cursor string, limit int) (core.ThreadPage, error)
GetThread(ctx context.Context, id int64) (core.Thread, error)
ListMessages(ctx context.Context, v core.View, cursor string, limit int) (core.MessagePage, error)
GetMessage(ctx context.Context, id int64, loadRemoteImages bool) (core.Message, error)
GetMessageText(ctx context.Context, id int64) (core.MessageText, error)
Search(ctx context.Context, accountID int64, query string, limit int) ([]core.MessageSummary, error)
GetAttachment(ctx context.Context, attachmentID int64) (string, core.AttachmentInfo, error)
NewDraft(ctx context.Context, accountID int64, mode string, sourceMessageID int64) (core.Draft, error)
SaveDraft(ctx context.Context, d core.Draft) (core.Draft, error)
Send(ctx context.Context, draftID int64) error
SendAcknowledged(ctx context.Context, draftID int64, digest string) error
RequestMCPSend(ctx context.Context, draftID, revision int64) (sent bool, err error)
ListOutbox(ctx context.Context, accountID int64) ([]core.OutboxItem, error)
CancelOutbox(ctx context.Context, id int64) error
GetSettings(ctx context.Context) (core.Settings, error)
SetSettings(ctx context.Context, st core.Settings) (core.Settings, error)
TrustedImageSenders(ctx context.Context) ([]string, error)
TrustImageSender(ctx context.Context, from string) error
UntrustImageSender(ctx context.Context, addr string) error
BlockedSenders(ctx context.Context) ([]string, error)
BlockSender(ctx context.Context, from string) error
UnblockSender(ctx context.Context, addr string) error
CheckModelService(ctx context.Context, id int64, in core.ModelServiceInput) (core.ServiceCheck, error)
RunSkill(ctx context.Context, name string, t core.Target) (<-chan ai.Event, error)
NewConversation(ctx context.Context, kind string, draftID int64) (core.Conversation, error)
Ask(ctx context.Context, conversationID int64, input string) (<-chan core.WitEvent, error)
SubscribeConversation(id int64) (<-chan core.WitEvent, func())
ResolveApproval(ctx context.Context, id int64, accept bool) error
ResolveApprovalWithArgs(ctx context.Context, id int64, accept bool, args json.RawMessage) error
ListApprovals(ctx context.Context, conversationID int64) ([]core.Approval, error)
Subscribe() (<-chan events.Event, func())
RunAction(ctx context.Context, id string, t core.Target, opts core.RunActionOptions) (core.ActionResult, error)
BeginOAuth(ctx context.Context, providerID, loginHint string, client core.OAuthClient) (flowID, authURL string, err error)
CancelOAuth(flowID string)
}
API is the subset of *core.Service the contract scenarios use, with the same signatures.
type Remote ¶
Remote implements API over a Local API connection (full role). Streams that end abnormally, or carry an event that does not decode, are recorded in StreamErrs: the typed signatures have no place for them.
func (*Remote) AddAccount ¶
func (*Remote) BeginOAuth ¶
func (*Remote) BlockSender ¶ added in v1.17.0
func (*Remote) BlockedSenders ¶ added in v1.19.0
func (*Remote) CachedImage ¶ added in v1.36.0
func (*Remote) CachedImageDims ¶ added in v1.36.0
func (*Remote) CancelOAuth ¶
CancelOAuth has no result to fail with; a failed call is recorded.
func (*Remote) CancelOutbox ¶ added in v1.14.0
func (*Remote) CheckAccount ¶
func (r *Remote) CheckAccount(ctx context.Context, in core.AccountInput) (core.CheckReport, error)
func (*Remote) CheckModelService ¶
func (r *Remote) CheckModelService(ctx context.Context, id int64, in core.ModelServiceInput) (core.ServiceCheck, error)
func (*Remote) DetectProvider ¶
func (*Remote) DownloadRecognitionModelStream ¶ added in v1.36.0
func (*Remote) ExportAccounts ¶ added in v1.36.0
func (*Remote) FetchAttachmentsStream ¶ added in v1.36.0
func (*Remote) ForgetImageFailure ¶ added in v1.36.0
func (*Remote) GetAttachment ¶
func (*Remote) GetMessage ¶
func (*Remote) GetMessageLazyImages ¶ added in v1.36.0
func (*Remote) GetMessageText ¶
func (*Remote) GetSettings ¶
func (*Remote) ImportAccounts ¶ added in v1.36.0
func (*Remote) InlineImagesStream ¶ added in v1.36.0
func (*Remote) InstallPluginFromRegistryStream ¶ added in v1.36.0
func (*Remote) ListAccounts ¶
func (*Remote) ListApprovals ¶
func (*Remote) ListFolders ¶
func (*Remote) ListMessages ¶
func (*Remote) ListOutbox ¶
func (*Remote) ListThreads ¶
func (*Remote) ModelServiceAvatar ¶ added in v1.36.0
func (*Remote) NewConversation ¶
func (*Remote) PluginReadme ¶ added in v1.36.0
func (*Remote) PrepareModelStream ¶ added in v1.36.0
func (*Remote) PreviewAccountImport ¶ added in v1.36.0
func (*Remote) RemoveAccount ¶ added in v1.36.0
func (*Remote) RequestMCPSend ¶ added in v1.36.0
func (*Remote) ResolveApproval ¶
func (*Remote) ResolveApprovalWithArgs ¶ added in v1.17.0
func (*Remote) SendAcknowledged ¶
func (*Remote) SenderAvatar ¶ added in v1.36.0
func (*Remote) SetComposeOpen ¶ added in v1.36.0
func (*Remote) SetInboxOnly ¶ added in v1.36.0
func (*Remote) SetSettings ¶
func (*Remote) SetUIForeground ¶ added in v1.36.0
func (*Remote) StreamErrs ¶
StreamErrs returns every abnormal stream end so far.
func (*Remote) SubscribeConversation ¶
func (*Remote) SystemTranslatorLanguages ¶ added in v1.36.0
func (*Remote) TrustImageSender ¶
func (*Remote) TrustedImageSenders ¶ added in v1.19.0
func (*Remote) UnblockSender ¶ added in v1.17.0
func (*Remote) UntrustImageSender ¶
type UIAPI ¶ added in v1.36.0
type UIAPI interface {
API
SetUIForeground(ctx context.Context, on bool) error
SetComposeOpen(ctx context.Context, draftIDs []int64) error
SetInboxOnly(on bool)
InboxOnly() bool
GetMessageLazyImages(ctx context.Context, id int64, loadRemoteImages bool) (core.Message, error)
InlineImagesStream(ctx context.Context, id int64) (<-chan core.InlineImage, error)
FetchAttachmentsStream(ctx context.Context, attachmentIDs []int64) (<-chan core.FetchedAttachment, error)
CachedImage(ctx context.Context, src string) (core.CachedImageFile, error)
CachedImageDims(src string) core.ImageDims
ForgetImageFailure(urls []string)
SystemTranslatorLanguages() []string
SenderAvatar(ctx context.Context, messageID int64, allowRemote bool) (core.Avatar, error)
ModelServiceAvatar(ctx context.Context, id int64) (core.Avatar, error)
PluginReadme(ctx context.Context, name, lang string) (string, error)
InstallPluginFromRegistryStream(ctx context.Context, name string) (<-chan core.PluginInstallEvent, error)
PrepareModelStream(ctx context.Context, ref string) (<-chan core.PrepareModelEvent, error)
DownloadRecognitionModelStream(ctx context.Context) (<-chan core.RecognitionModelProgress, error)
}
UIAPI extends API with the methods exposed only to RoleUI.