Documentation
¶
Index ¶
- Constants
- func ConversationSummaryAAD(id string) string
- func ConversationTitleAAD(id string) string
- func FollowUpAAD(id string) string
- func MemoryAAD(id string) string
- func MessageAAD(id string) string
- func PanelNotesAAD() string
- func PlanCardAAD(id string) string
- func PlanConfirmAAD(id string) string
- func ProviderKeyAAD(p adminv1.AssistantProvider) string
- type Config
- type FollowUpNotifier
- type FollowUpOutcome
- type ScheduledOutcome
- type ScheduledRun
- type Service
- func (s *Service) ApplyPlan(ctx context.Context, req *connect.Request[adminv1.ApplyPlanRequest]) (*connect.Response[adminv1.ApplyPlanResponse], error)
- func (s *Service) CancelFollowUp(ctx context.Context, req *connect.Request[adminv1.CancelFollowUpRequest]) (*connect.Response[adminv1.CancelFollowUpResponse], error)
- func (s *Service) Chat(ctx context.Context, req *connect.Request[adminv1.ChatRequest], ...) error
- func (s *Service) DeleteAllConversations(ctx context.Context, ...) (*connect.Response[adminv1.DeleteAllConversationsResponse], error)
- func (s *Service) DeleteConversation(ctx context.Context, req *connect.Request[adminv1.DeleteConversationRequest]) (*connect.Response[adminv1.DeleteConversationResponse], error)
- func (s *Service) DeleteMemory(ctx context.Context, req *connect.Request[adminv1.DeleteMemoryRequest]) (*connect.Response[adminv1.DeleteMemoryResponse], error)
- func (s *Service) DismissPlan(ctx context.Context, req *connect.Request[adminv1.DismissPlanRequest]) (*connect.Response[adminv1.DismissPlanResponse], error)
- func (s *Service) ForgetAll(ctx context.Context, _ *connect.Request[adminv1.ForgetAllRequest]) (*connect.Response[adminv1.ForgetAllResponse], error)
- func (s *Service) GetAssistantAccess(ctx context.Context, _ *connect.Request[adminv1.GetAssistantAccessRequest]) (*connect.Response[adminv1.GetAssistantAccessResponse], error)
- func (s *Service) GetAssistantSettings(ctx context.Context, _ *connect.Request[adminv1.GetAssistantSettingsRequest]) (*connect.Response[adminv1.GetAssistantSettingsResponse], error)
- func (s *Service) GetConversation(ctx context.Context, req *connect.Request[adminv1.GetConversationRequest]) (*connect.Response[adminv1.GetConversationResponse], error)
- func (s *Service) Handler(opts ...connect.HandlerOption) (string, http.Handler)
- func (s *Service) ListConversations(ctx context.Context, req *connect.Request[adminv1.ListConversationsRequest]) (*connect.Response[adminv1.ListConversationsResponse], error)
- func (s *Service) ListMemory(ctx context.Context, _ *connect.Request[adminv1.ListMemoryRequest]) (*connect.Response[adminv1.ListMemoryResponse], error)
- func (s *Service) ListProviderModels(ctx context.Context, req *connect.Request[adminv1.ListProviderModelsRequest]) (*connect.Response[adminv1.ListProviderModelsResponse], error)
- func (s *Service) RecentQuestions(ctx context.Context, _ *connect.Request[adminv1.RecentQuestionsRequest]) (*connect.Response[adminv1.RecentQuestionsResponse], error)
- func (s *Service) RemoveProviderKey(ctx context.Context, req *connect.Request[adminv1.RemoveProviderKeyRequest]) (*connect.Response[adminv1.RemoveProviderKeyResponse], error)
- func (s *Service) Retention(ctx context.Context, now time.Time) error
- func (s *Service) RunFollowUp(ctx context.Context, f store.AssistantFollowUp) FollowUpOutcome
- func (s *Service) RunScheduled(ctx context.Context, run ScheduledRun) ScheduledOutcome
- func (s *Service) SaveMemory(ctx context.Context, req *connect.Request[adminv1.SaveMemoryRequest]) (*connect.Response[adminv1.SaveMemoryResponse], error)
- func (s *Service) SetFollowUpNotifier(n FollowUpNotifier)
- func (s *Service) SetProviderKey(ctx context.Context, req *connect.Request[adminv1.SetProviderKeyRequest]) (*connect.Response[adminv1.SetProviderKeyResponse], error)
- func (s *Service) SetToolRuntime(runtime mcp.AssistantRuntime)
- func (s *Service) StopTurn(ctx context.Context, req *connect.Request[adminv1.StopTurnRequest]) (*connect.Response[adminv1.StopTurnResponse], error)
- func (s *Service) UpdateAssistantSettings(ctx context.Context, ...) (*connect.Response[adminv1.UpdateAssistantSettingsResponse], error)
Constants ¶
const ( // FollowUpLate: a follow-up the panel could not run until this long after its time (it was down) is dropped with a note. FollowUpLate = 24 * time.Hour // FollowUpRunLimit bounds one RunFollowUp: a turn, with the waits between a provider's attempts inside it. FollowUpRunLimit = maxTurnDuration + time.Minute )
const ScheduledRunLimit = 2*scheduledTurn + 2*time.Minute
ScheduledRunLimit bounds one RunScheduled: a turn on each of two providers, with the waits between attempts.
Variables ¶
This section is empty.
Functions ¶
func ConversationSummaryAAD ¶
func ConversationTitleAAD ¶
func FollowUpAAD ¶
FollowUpAAD is the vault's associated data of a follow-up's note.
func MessageAAD ¶
func PanelNotesAAD ¶
func PanelNotesAAD() string
func PlanCardAAD ¶
func PlanConfirmAAD ¶
func ProviderKeyAAD ¶
func ProviderKeyAAD(p adminv1.AssistantProvider) string
Types ¶
type Config ¶
type Config struct {
Store *store.Store
Vault *vault.Vault
Auth *auth.Service
Now func() time.Time
Log *slog.Logger
ProviderBases map[adminv1.AssistantProvider]string
HTTPClients map[adminv1.AssistantProvider]*http.Client
Providers map[adminv1.AssistantProvider]adapter
}
Config supplies the signed-in AssistantService dependencies. Endpoint overrides and clients exist only for tests; production uses the fixed HTTPS URLs in provider_prices.go.
type FollowUpNotifier ¶
type FollowUpNotifier func(adminID, summary string)
FollowUpNotifier sends a follow-up's problem to its admin's Telegram (telegram.Service.FollowUpProblem).
type FollowUpOutcome ¶
type FollowUpOutcome struct {
// "ran" (its turn ended with an answer), "failed" (it did not run, or its turn failed: the conversation says why), "missed"
// (too late: the conversation says so), "dropped" (its admin or conversation is gone: nothing to say it to), or "deferred"
// (try again after RetryAfter).
Status string
Reason string
RetryAfter time.Duration
// Counted: the deferral counts as a try (the store failed), not a wait for a busy conversation.
Counted bool
}
FollowUpOutcome is what came of RunFollowUp.
type ScheduledOutcome ¶
type ScheduledOutcome struct {
Status string // "ok", "problem", "failed" or "skipped"
Reason string // a code, for failed and skipped
Summary string // the verdict's line, cleaned
ConversationID string
Provider string // the provider's slug ("anthropic" ...)
Model string
USD float64
FellBack bool
}
ScheduledOutcome is what came of a run.
type ScheduledRun ¶
type ScheduledRun struct {
TaskID, TaskName string
// AdminID is the task's owner: the conversation is theirs, and so is the cost.
AdminID string
Prompt string
// ConversationID is the task's conversation; empty, or deleted meanwhile, starts a new one.
ConversationID string
}
ScheduledRun is what a scheduled task asks of the assistant.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) CancelFollowUp ¶
func (s *Service) CancelFollowUp(ctx context.Context, req *connect.Request[adminv1.CancelFollowUpRequest]) (*connect.Response[adminv1.CancelFollowUpResponse], error)
CancelFollowUp removes a follow-up waiting in one of the admin's own conversations.
func (*Service) Chat ¶
func (s *Service) Chat(ctx context.Context, req *connect.Request[adminv1.ChatRequest], stream *connect.ServerStream[adminv1.ChatResponse]) error
func (*Service) DeleteAllConversations ¶
func (*Service) DeleteConversation ¶
func (*Service) DeleteMemory ¶
func (*Service) DismissPlan ¶
func (*Service) GetAssistantAccess ¶
func (*Service) GetAssistantSettings ¶
func (*Service) GetConversation ¶
func (*Service) ListConversations ¶
func (*Service) ListMemory ¶
func (*Service) ListProviderModels ¶
func (*Service) RecentQuestions ¶
func (s *Service) RecentQuestions(ctx context.Context, _ *connect.Request[adminv1.RecentQuestionsRequest]) (*connect.Response[adminv1.RecentQuestionsResponse], error)
RecentQuestions returns what the admin typed lately across their conversations (not a task's or a follow-up's turns): short one-line texts, newest first, each once.
func (*Service) RemoveProviderKey ¶
func (*Service) RunFollowUp ¶
func (s *Service) RunFollowUp(ctx context.Context, f store.AssistantFollowUp) FollowUpOutcome
RunFollowUp runs one due follow-up: a turn of its conversation as its admin. It never returns an error: what went wrong is the outcome, and a note in the conversation when there is one to write it in.
func (*Service) RunScheduled ¶
func (s *Service) RunScheduled(ctx context.Context, run ScheduledRun) ScheduledOutcome
RunScheduled runs one scheduled assistant task and reports the outcome. It never returns an error: everything that went wrong is a status and a reason code, recorded with the run.
func (*Service) SaveMemory ¶
func (*Service) SetFollowUpNotifier ¶
func (s *Service) SetFollowUpNotifier(n FollowUpNotifier)
SetFollowUpNotifier installs the Telegram sender once the services are built.
func (*Service) SetProviderKey ¶
func (*Service) SetToolRuntime ¶
func (s *Service) SetToolRuntime(runtime mcp.AssistantRuntime)
SetToolRuntime installs the MCP server once the authenticated admin API has been assembled.