contract

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

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

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)
	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
	ListOutbox(ctx context.Context, accountID int64) ([]core.OutboxItem, error)
	GetSettings(ctx context.Context) (core.Settings, error)
	SetSettings(ctx context.Context, st core.Settings) (core.Settings, error)
	TrustImageSender(ctx context.Context, from string) error
	UntrustImageSender(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
	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) (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

type Remote struct {
	C *rpc.Client
	// contains filtered or unexported fields
}

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 (r *Remote) AddAccount(ctx context.Context, in core.AccountInput) (core.Account, error)

func (*Remote) Ask

func (r *Remote) Ask(ctx context.Context, conversationID int64, input string) (<-chan core.WitEvent, error)

func (*Remote) BeginOAuth

func (r *Remote) BeginOAuth(ctx context.Context, providerID, loginHint string) (string, string, error)

func (*Remote) CancelOAuth

func (r *Remote) CancelOAuth(flowID string)

CancelOAuth has no result to fail with; a failed call is recorded.

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 (r *Remote) DetectProvider(ctx context.Context, email string) (auth.Provider, auth.Source, error)

func (*Remote) GetAttachment

func (r *Remote) GetAttachment(ctx context.Context, attachmentID int64) (string, core.AttachmentInfo, error)

func (*Remote) GetMessage

func (r *Remote) GetMessage(ctx context.Context, id int64, loadRemoteImages bool) (core.Message, error)

func (*Remote) GetMessageText

func (r *Remote) GetMessageText(ctx context.Context, id int64) (core.MessageText, error)

func (*Remote) GetSettings

func (r *Remote) GetSettings(ctx context.Context) (core.Settings, error)

func (*Remote) GetThread

func (r *Remote) GetThread(ctx context.Context, id int64) (core.Thread, error)

func (*Remote) ListAccounts

func (r *Remote) ListAccounts(ctx context.Context) ([]core.Account, error)

func (*Remote) ListApprovals

func (r *Remote) ListApprovals(ctx context.Context, conversationID int64) ([]core.Approval, error)

func (*Remote) ListFolders

func (r *Remote) ListFolders(ctx context.Context, accountID int64) ([]core.Folder, error)

func (*Remote) ListMessages

func (r *Remote) ListMessages(ctx context.Context, v core.View, cursor string, limit int) (core.MessagePage, error)

func (*Remote) ListOutbox

func (r *Remote) ListOutbox(ctx context.Context, accountID int64) ([]core.OutboxItem, error)

func (*Remote) ListThreads

func (r *Remote) ListThreads(ctx context.Context, v core.View, cursor string, limit int) (core.ThreadPage, error)

func (*Remote) NewConversation

func (r *Remote) NewConversation(ctx context.Context, kind string, draftID int64) (core.Conversation, error)

func (*Remote) NewDraft

func (r *Remote) NewDraft(ctx context.Context, accountID int64, mode string, sourceMessageID int64) (core.Draft, error)

func (*Remote) ResolveApproval

func (r *Remote) ResolveApproval(ctx context.Context, id int64, accept bool) error

func (*Remote) RunAction

func (r *Remote) RunAction(ctx context.Context, id string, t core.Target, opts core.RunActionOptions) (core.ActionResult, error)

func (*Remote) RunSkill

func (r *Remote) RunSkill(ctx context.Context, name string, t core.Target) (<-chan ai.Event, error)

func (*Remote) SaveDraft

func (r *Remote) SaveDraft(ctx context.Context, d core.Draft) (core.Draft, error)

func (*Remote) Search

func (r *Remote) Search(ctx context.Context, accountID int64, query string, limit int) ([]core.MessageSummary, error)

func (*Remote) Send

func (r *Remote) Send(ctx context.Context, draftID int64) error

func (*Remote) SendAcknowledged

func (r *Remote) SendAcknowledged(ctx context.Context, draftID int64, digest string) error

func (*Remote) SetSettings

func (r *Remote) SetSettings(ctx context.Context, st core.Settings) (core.Settings, error)

func (*Remote) StreamErrs

func (r *Remote) StreamErrs() []error

StreamErrs returns every abnormal stream end so far.

func (*Remote) Subscribe

func (r *Remote) Subscribe() (<-chan events.Event, func())

func (*Remote) SubscribeConversation

func (r *Remote) SubscribeConversation(id int64) (<-chan core.WitEvent, func())

func (*Remote) TrustImageSender

func (r *Remote) TrustImageSender(ctx context.Context, from string) error

func (*Remote) UntrustImageSender

func (r *Remote) UntrustImageSender(ctx context.Context, addr string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL