Versions in this module Expand all Collapse all v0 v0.5.0 Nov 12, 2026 v0.4.0 Nov 12, 2026 v0.3.0 Nov 11, 2026 v0.2.0 Nov 11, 2026 v0.1.1 Nov 11, 2026 v0.1.0 Nov 11, 2026 Changes in this version + const DefaultAnthropicModel + const DefaultOpenAIURL + const MaxImageSize + const MaxMessageLen + const MaxPDFSize + const MaxProposals + const MaxRounds + const MaxTextSize + const ProviderAnthropic + const ProviderOpenAI + const ReviewTTL + const ScreenCharges + const ScreenSubscriptions + const ScreenTotal + const StatusApplied + const StatusDiscarded + const StatusFailed + const StatusPending + const StatusUndone + var ErrNeedsAssistant = domain.Invalid(...) + var ErrNoReview = domain.NotFound("no import is waiting for review") + var ErrPDFNeedsAssistant = domain.Invalid(...) + var ErrPDFUnreadable = domain.Invalid(...) + var ErrScanNeedsAssistant = domain.Invalid(...) + func Call(name string, args any) func(Request) (Response, error) + func CallWith(name string, args func(Request) any) func(Request) (Response, error) + func Explain(err error) domain.Text + func Fail(err error) func(Request) (Response, error) + func IsKind(err error, k Kind) bool + func NewReviewID() string + func Say(text string) func(Request) (Response, error) + type Anthropic struct + func NewAnthropic(key, model, baseURL string, timeout time.Duration) *Anthropic + func (a *Anthropic) Complete(ctx context.Context, req Request) (Response, error) + func (a *Anthropic) Name() string + func (a *Anthropic) Stream(ctx context.Context, req Request, onText func(string)) (Response, error) + type Assistant struct + func New(svc *app.Service, log *slog.Logger, env Env) (*Assistant, error) + func (a *Assistant) Ask(ctx context.Context, actor app.Actor, conv, text string) (Turn, error) + func (a *Assistant) AskStream(ctx context.Context, actor app.Actor, conv, text string, progress Progress) (Turn, error) + func (a *Assistant) Config(ctx context.Context) Config + func (a *Assistant) Configure(ctx context.Context, in Settings) (Status, error) + func (a *Assistant) Decide(ctx context.Context, actor app.Actor, id string, accept bool) (Outcome, error) + func (a *Assistant) DropReview(ctx context.Context, actor app.Actor) error + func (a *Assistant) Enabled(ctx context.Context) bool + func (a *Assistant) LoadReview(ctx context.Context, actor app.Actor) (Review, error) + func (a *Assistant) ReadImport(ctx context.Context, actor app.Actor, data []byte) (importer.Result, error) + func (a *Assistant) ReadTerms(ctx context.Context, actor app.Actor, documentID string) (TermsProposal, error) + func (a *Assistant) Remove(ctx context.Context) (Status, error) + func (a *Assistant) Reset(ctx context.Context, actor app.Actor, conv string) + func (a *Assistant) SaveReview(ctx context.Context, actor app.Actor, r Review) error + func (a *Assistant) SetProvider(p Provider) + func (a *Assistant) Status(ctx context.Context) Status + func (a *Assistant) Test(ctx context.Context) TestResult + func (a *Assistant) ThisMonth(ctx context.Context, actor app.Actor) MonthUsage + func (a *Assistant) Tools() []Tool + func (a *Assistant) Undo(ctx context.Context, actor app.Actor, id string) (Outcome, error) + func (a *Assistant) Usage(ctx context.Context, actor app.Actor, owner bool, limit int) (UsageList, error) + type Attachment struct + Data []byte + MediaType string + type Config struct + APIKey string + BaseURL string + Enabled bool + Model string + Provider string + func (c Config) Ready() bool + type Env struct + APIKey string + BaseURL string + Model string + Provider string + type Error struct + Detail string + Kind Kind + Status int + func (e *Error) Error() string + type Fake struct + Loop func(Request) (Response, error) + Requests []Request + Steps []func(Request) (Response, error) + func (f *Fake) Calls() int + func (f *Fake) Complete(_ context.Context, req Request) (Response, error) + func (f *Fake) Name() string + func (f *Fake) Stream(ctx context.Context, req Request, onText func(string)) (Response, error) + func (f *Fake) Then(steps ...func(Request) (Response, error)) *Fake + type Kind int + const KindAuth + const KindBusy + const KindExpired + const KindModel + const KindNoAnswer + const KindNotConfigured + const KindOther + const KindOverloaded + const KindRateLimited + const KindRefused + const KindRejected + const KindTooLarge + type Mention struct + ID string + Name string + type Message struct + Attachments []Attachment + Raw json.RawMessage + Role Role + Text string + ToolCalls []ToolCall + ToolResults []ToolResult + type MonthUsage struct + CostUSD *string + InputTokens int + Month string + OutputTokens int + Questions int + Unpriced int + type OpenAI struct + func NewOpenAI(key, model, baseURL string, timeout time.Duration) *OpenAI + func (o *OpenAI) Complete(ctx context.Context, req Request) (Response, error) + func (o *OpenAI) Name() string + func (o *OpenAI) Stream(ctx context.Context, req Request, onText func(string)) (Response, error) + type Outcome struct + CanUndo bool + ID string + Lines []domain.Text + Status string + SubscriptionID string + Title domain.Text + type Price struct + Input string + Output string + type Progress func(text string) + type Proposal struct + Destructive bool + ID string + Lines []domain.Text + Title domain.Text + Tool string + type Provider interface + Complete func(ctx context.Context, req Request) (Response, error) + Name func() string + type Request struct + MaxTokens int + Messages []Message + System string + Tools []Tool + type Response struct + Model string + Raw json.RawMessage + Stop Stop + Text string + ToolCalls []ToolCall + Usage Usage + type Review struct + Channel string + CreatedAt time.Time + ID string + Off map[int]bool + Outcomes []app.ImportOutcome + Result importer.Result + type Role string + const RoleAssistant + const RoleTool + const RoleUser + type Screen struct + Charges *app.ChargeList + Kind string + More int + Subscriptions []app.SubscriptionView + Total *app.Breakdown + type Settings struct + APIKey string + BaseURL string + Enabled *bool + Model string + Price *Price + Provider string + type Status struct + BaseURL string + Configured bool + DefaultModel string + Enabled bool + HasKey bool + Locked []string + Model string + Month *MonthUsage + On bool + Price *Price + PriceSource string + Provider string + type Stop string + const StopEnd + const StopLength + const StopRefused + const StopTools + type Streamer interface + Stream func(ctx context.Context, req Request, onText func(delta string)) (Response, error) + type TermsField struct + Current string + Field string + Quote string + Value string + func (f TermsField) Update(id string) (app.UpdateSubscriptionInput, error) + type TermsProposal struct + DocumentID string + Fields []TermsField + Model string + Notes []string + SubscriptionID string + type TestResult struct + Message domain.Text + Model string + OK bool + type Tool struct + Description string + Name string + Schema json.RawMessage + type ToolCall struct + Arguments json.RawMessage + ID string + Name string + type ToolResult struct + CallID string + Content string + IsError bool + Name string + func LastToolResult(req Request) ToolResult + type Turn struct + Mentions []Mention + Note *domain.Text + Proposals []Proposal + Screens []Screen + Text string + type Usage struct + Input int + Output int + type UsageEntry struct + At time.Time + CostUSD *string + Failed bool + ID string + InputTokens int + Kind string + Member string + Model string + OutputTokens int + Provider string + Rounds int + Surface string + type UsageList struct + Entries []UsageEntry