agent

package
v0.167.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 85 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package agent is a person's agent: the worker that does its processing with nobody present, and — in later milestones — the conversation it holds with the person and the tools it reaches everything through.

It knows mail and the database; it knows nothing about HTTP. Everything it does for a person is measured against the person and recorded with the source beside it. Nothing here is constructed while the agent is off: the server passes a nil registry and builds no worker.

Index

Constants

View Source
const (
	FirstBudgetYear  = 1900
	BudgetYearsAhead = 10
)

The years a year's budgets and saving may be asked for: 1900 through ten years past today's. Year zero parses as a year but is no year PostgreSQL stores a day in, and refusing it here makes it an invalid argument rather than an internal error from the first query.

View Source
const (
	CommandStop    = "stop"
	CommandAnswer  = "answer"
	CommandResolve = "resolve"
	// CommandLocate carries the browser's answer to a location call in
	// Answer, as JSON (see AnswerLocation).
	CommandLocate = "locate"
	// CommandLiveActivity has the run push its state to the Live Activity
	// in PushRegistration. The app registers the activity wherever its
	// request lands, which need not be the instance running the turn.
	CommandLiveActivity = "liveActivity"
)
View Source
const (
	AnswerFromMemory  = "memory"  // the facts recall carries, as a turn would get them
	AnswerFromSources = "sources" // passages from the documents, as the search tool finds them
	AnswerFromBoth    = "both"    // both, the way a turn that searches has them

	// AnswerFromAgent is a turn of the agent itself, with its tools, the
	// way a person asking in a conversation is answered; "agent@high"
	// asks it to think at that effort.
	AnswerFromAgent = "agent"
)

What an evaluation answers from. The recall evaluation says whether the facts a question needs reach the model; this says whether the answer is right, and comparing the three says what extracted memory is worth over the raw sources it was read from.

View Source
const (
	AnswerCorrect  = "correct"
	AnswerPartial  = "partial"
	AnswerStale    = "stale"
	AnswerNotKnown = "not_known"
	AnswerInvented = "invented"
	AnswerWrong    = "wrong"

	// AnswerMissed is "not known" where the person gave an answer: what
	// the answer was given did not hold the fact, which is recall's
	// failure rather than the model's, and is told apart from a wrong
	// answer so the two can be worked on apart.
	AnswerMissed = "missed"

	// AnswerUngraded is a grader whose answer could not be read. It counts
	// as nothing, rather than as a wrong answer the model did not give.
	AnswerUngraded = "ungraded"
)

The verdicts a graded answer can have. See prompts/evaluate_grade.txt.

View Source
const (
	AnsweringMarker = "[answering]"
	ApprovedMarker  = "[approved]"
	DeclinedMarker  = "[declined]"
)

The markers a turn resumed by a late answer begins with. They are the person's word, not turns of the agent's own, so they are not in models.OwnTurnMarkers.

View Source
const (
	RecallDecisionCarried = "carried"

	// RecallDecisionPageLimit: the overlay had expanded as many pages as
	// it expands, or filled its blocks, before this one's turn came.
	RecallDecisionPageLimit = "page_limit"

	// RecallDecisionUnhitPageLimit: no fact on the page was found, and the
	// overlay had expanded as many such pages as it takes.
	RecallDecisionUnhitPageLimit = "unhit_page_limit"

	// RecallDecisionTokenBudget: the page or fact did not fit in what was
	// left of the overlay's tokens.
	RecallDecisionTokenBudget = "token_budget"

	// RecallDecisionAlreadyExpanded: the page was expanded once already.
	RecallDecisionAlreadyExpanded = "already_expanded"

	// RecallDecisionRetired: the fact is folded, struck or superseded, so
	// the page no longer says it.
	RecallDecisionRetired = "retired"

	// RecallDecisionShownOnPage: the fact was carried inside its page's
	// block rather than among the loose facts.
	RecallDecisionShownOnPage = "shown_on_page"

	// RecallDecisionFactLimit: the loose facts were full.
	RecallDecisionFactLimit = "fact_limit"

	// RecallDecisionOutranked: a query found it, but fusing every query's
	// lists left it out of the candidates.
	RecallDecisionOutranked = "outranked"
)

Why a page or fact was carried, or what kept it out.

View Source
const (
	RecallSectionNone             = "none"
	RecallSectionMatchedByMeaning = "matched_by_meaning"
	RecallSectionMatchedByWords   = "matched_by_words"
	RecallSectionFirst            = "first"

	// RecallSectionFirstGaveWay: the meaning search matched the first
	// section, and a later one the question's other words point at was
	// carried instead.
	RecallSectionFirstGaveWay = "first_gave_way_to_words"

	// RecallSectionLeftOutForBudget: the page was carried without its
	// section, which did not fit.
	RecallSectionLeftOutForBudget = "left_out_for_budget"
)

Which section of a page's overview recall carried, and why.

View Source
const (
	RetrievalModeBasic   = "basic"
	RetrievalModePlanned = "planned"
)

The retrieval modes an explanation or an evaluation names: basic is the message's own search alone, planned follows a retrieval plan.

View Source
const (
	RecallQueryMessage = "message" // the message's own words
	RecallQueryPlanned = "planned" // a focused search the plan named
	RecallQueryHop     = "hop"     // the pages linked to the top page the planned searches found
	RecallQueryBroad   = "broad"   // the pages whose overview sections a broad question matched, counted again
)

What each query of a retrieval is.

View Source
const (
	ScenarioStepRecords      = "records"
	ScenarioStepDream        = "dream"
	ScenarioStepCheckpoint   = "checkpoint"
	ScenarioStepConversation = "conversation"
)

The kinds of step.

View Source
const (
	SpeakFirstOnboarding  = "onboarding"
	SpeakFirstPhoneTour   = "phone_tour"
	SpeakFirstMemoryCheck = "memory_check"
	SpeakFirstIdea        = "idea"
)

The reasons the agent speaks first, which are also the subjects of its speak_first jobs.

View Source
const (
	RiskRead        = tools.RiskRead
	RiskWrite       = tools.RiskWrite
	RiskDestructive = tools.RiskDestructive
	RiskOutward     = tools.RiskOutward
	RiskGranting    = tools.RiskGranting

	FamilyMailbox  = tools.FamilyMailbox
	FamilyDomains  = tools.FamilyDomains
	FamilyAudit    = tools.FamilyAudit
	FamilyPeople   = tools.FamilyPeople
	FamilyServer   = tools.FamilyServer
	FamilyAccount  = tools.FamilyAccount
	FamilyGeneral  = tools.FamilyGeneral
	FamilyServers  = tools.FamilyServers
	FamilySkills   = tools.FamilySkills
	FamilyBrowser  = tools.FamilyBrowser
	FamilyComputer = tools.FamilyComputer
	FamilyFinance  = tools.FamilyFinance
)
View Source
const CodingMemoryTag = "teanode-memory"

CodingMemoryTag wraps what a coding session is shown, so that the sources reading its transcript back can leave it out: memory filed again from its own recital would confirm itself.

View Source
const ScenarioAnswerFromSurvey = "survey"

ScenarioAnswerFromSurvey answers a question with a survey of the whole graph, the way a question about a whole area is answered when asked for: a model call a page, then one to combine them.

View Source
const ShareFor = 30 * 24 * time.Hour

ShareFor is how long a shared artifact's address stays good: long enough to find in a chat's history, not forever.

View Source
const ShareToOpenFor = 6 * time.Hour

ShareToOpenFor is how long an address made to open a file now stays good: one the drawer draws, or one handed to a program over MCP to fetch. Short, because it is made afresh each time, and an address that opens a file without a sign-in should not outlive the moment it was made for.

View Source
const (
	// StatementAddressDetailPrefix begins the detail of a statement import
	// address: the part after the plus, before the token.
	StatementAddressDetailPrefix = "statements-"
)
View Source
const TaxDocumentAddressDetailPrefix = "taxes-"

TaxDocumentAddressDetailPrefix begins the detail of a tax document address: the part after the plus, before the token.

Variables

View Source
var (
	NewCatalog        = tools.NewCatalog
	RenameTools       = tools.Rename
	ActionsOf         = tools.ActionsOf
	NeedsConfirmation = tools.NeedsConfirmation
	Split             = tools.Split
	Search            = tools.Search

	// Location and the time helpers moved to the kit with the datetime tool.
	Location = tools.Location

	// The text and cron helpers moved to the kit too.
	HTMLToText = tools.HTMLToText
)
View Source
var CodingAssistants = []string{"claude-code", "codex"}

CodingAssistants are the source types whose transcripts are coding sessions, which a capture asks to read again.

View Source
var ErrAnnotationIsThePersons = errors.New("the person wrote this annotation, and the agent changes or removes it only when the person asks in a conversation they are there for")

ErrAnnotationIsThePersons refuses the agent changing what the person wrote on a finance transaction.

View Source
var ErrDeviceDetached = tools.ErrDeviceDetached

ErrDeviceDetached is the device leaving while a question was open, or before it could be sent. A caller that can wait treats it like the device not being there.

View Source
var ErrLeftOpen = tools.ErrLeftOpen

ErrLeftOpen says a card was not answered while the turn waited, and is still open for the person to answer later.

View Source
var ErrNotGranted = errors.New("agent: not granted for this mailbox")

ErrNotGranted says the person has not let their agent do this with this source.

View Source
var ErrNotStatementAccount = errors.New("only an account from imported statements can be renamed or deleted; " +
	"an account a provider reports comes back as it was with the next sync, so switch off or delete its finance source instead")

ErrNotStatementAccount refuses renaming or deleting a finance account a provider reports: its next sync would bring it back as it was.

View Source
var ErrPDFReaderMissing = errors.New("this server cannot read PDFs: poppler (pdftotext, pdftoppm) is not installed")

ErrPDFReaderMissing is a server without poppler's readers.

View Source
var ErrPaystubUnbalanced = errors.New("its lines do not add up to its printed totals")

ErrPaystubUnbalanced refuses recording a paystub whose lines do not add up to its printed totals, unless the person says to record it anyway.

View Source
var ErrReceiptUnbalanced = errors.New("its lines do not add up to its printed totals")

ErrReceiptUnbalanced refuses recording a receipt whose lines do not add up to its printed totals, unless the person says to record it anyway.

View Source
var ErrTooManyGoals = errors.New("as many goals as this server allows are already in progress; finish or drop one first")

ErrTooManyGoals is starting a goal while the operator's limit of goals in progress (GoalsInProgress) are going.

View Source
var ErrUnavailable = errors.New("agent: unavailable")

ErrUnavailable says the agent cannot do this here: agents are off, the feature is off for the deployment, or there is no model to ask.

View Source
var FeatureAllowed = tools.FeatureAllowed

FeatureAllowed says whether the deployment offers a feature at all.

Functions

func AlertPrompt added in v0.82.0

func AlertPrompt(input *AlertInput) (string, error)

AlertPrompt renders the decision's prompt. The mail, and everything the sorting wrote from it, goes inside a fence: it is a stranger's text, and what the decision writes is read by the person as the agent's word.

func AlertSubjectPattern added in v0.82.0

func AlertSubjectPattern(subject string) string

AlertSubjectPattern is a subject with what changes from one message of a kind to the next taken out: the digits of a code, a count, a date. Lower case, with the spaces collapsed, so "Your code is 481 022" and "Your code is 99 310" are the same message sent twice.

func AssetEstimatePrompt added in v0.91.0

func AssetEstimatePrompt() string

AssetEstimatePrompt is the standing instruction of the schedule that estimates the person's assets from the web, as the person's own words, because the person is who allowed the estimates. It names only the estimate description as what may be searched with: that is what the person agreed to send to a search provider for each asset. An ordinary schedule row, like the brief's, which the person can rewrite or stop.

func AttachmentContentType added in v0.155.0

func AttachmentContentType(declared string, content []byte) string

AttachmentContentType is the type kept for an uploaded file: the one declared, unless it says nothing (empty or application/octet-stream) and the bytes are a PDF, so the dashboard shows and opens it as one.

func BriefPrompt

func BriefPrompt(found *models.Agent, owner *models.User) string

BriefPrompt is the daily brief's standing instruction, as the person's own words, because the person is who turned it on.

Written here rather than in a template file because it is a starting point rather than a fixed thing: it goes into an ordinary schedule row, where the Schedules card shows it and anybody can rewrite it to say what they actually want to hear each morning.

func BudgetStatus added in v0.87.0

func BudgetStatus(ctx context.Context, tx db.Transaction, fetcher *rates.Fetcher, agentId, month, today string) (*models.BudgetStatus, error)

BudgetStatus is every spending category with a budget in a month ("2006-01"), against its budget, as of today ("2006-01-02", the person's local day): the last day for a past month. Spending in another currency is converted into the budget's at the rate of the day it posted, and spending in a currency with no rate is listed apart rather than guessed. A nil fetcher converts with the rates already stored.

A budget on a spending category counts its child spending categories that have no budget of their own. A budget on an income spending category is the income expected, and is listed apart with a pace of its own (ProjectIncomeCategoryMonth); budget alerts read only the spending.

func CanReadPDFs added in v0.155.0

func CanReadPDFs() bool

CanReadPDFs says whether this server has the readers a PDF needs.

func CaptureCodingSession added in v0.124.0

func CaptureCodingSession(tx db.Transaction, agentId, computerName, assistant string) (bool, error)

CaptureCodingSession asks the computer's sources of a coding tool's transcripts to read again now, so that what was just said is searchable, and the next session can be told where this one stopped, within a minute rather than at the source's next scheduled pass. It says whether any source was asked. A source the person paused stays paused. One asked while a pass runs reads again after it (see markSource), and a burst of short answers before a pass begins is that one pass.

func CheckAnswerSource added in v0.104.3

func CheckAnswerSource(answerFrom string) error

CheckAnswerSource says whether an answer source is one EvaluateAnswer takes, so a run that asks many questions can refuse a misspelled one before it spends anything.

func CountMessages

func CountMessages(items []*models.MailboxItem) int

CountMessages is how many messages a set of items is, which is not how many items it is: one message can be filed twice.

A message somebody sends to themselves is the plain case -- a copy in Sent and a copy in the Inbox, one message, two items -- and so is a message filed in two folders by two rules. Anything asking "is this a conversation yet" has to count messages, or a note to oneself is two.

func CurateRecordingSpeakersLocally added in v0.144.0

func CurateRecordingSpeakersLocally(ctx context.Context, settings *Settings, userId, recordingId string) error

CurateRecordingSpeakersLocally runs metadata and audio screening without a model worker.

func DayStart

func DayStart(owner *models.User, now time.Time) time.Time

DayStart is midnight in the person's own zone, which is when the panel says their budget resets and so when every share of a day turns over.

func DecodedSessionData

func DecodedSessionData(data json.RawMessage) string

DecodedSessionData is what a session message carries, for the websocket handler that has it as raw JSON.

func DocumentBytes

func DocumentBytes(ctx context.Context, files storage.Files, document *models.AgentDocument) ([]byte, error)

DocumentBytes is an attachment document's bytes, out of the store.

The work is in the tools package, because the memory tool's `look` reads the same bytes for the person and a tool cannot import this one. Kept here as well so that every caller in this package and in the API says the same name for the same thing.

func DraftPrompt

func DraftPrompt(input *DraftInput) ([]llm.ChatMessage, error)

DraftPrompt builds the messages for one draft call.

func ExtractAttachmentText

func ExtractAttachmentText(ctx context.Context, name, contentType string, content []byte) string

ExtractAttachmentText is what a model reads of a file: its text when it is a text file, valid UTF-8, or a PDF with a text layer, capped; empty otherwise. Called once, when the file is uploaded, and kept on the row. A PDF is known by its bytes, whatever it was declared as.

func ForgetAttachments

func ForgetAttachments(ctx context.Context, tx db.Transaction, store storage.Storage, agentId string) error

ForgetAttachments removes every file a person's agent holds, for the person forgetting their agent.

func InterpretExtraction

func InterpretExtraction(answer *ExtractAnswer) []models.MailProposal

InterpretExtraction turns the model's answer into proposals, refusing what is not usable: an event with no summary or no start is not an appointment, and a contact with neither an address nor a number is not a person.

func InterpretTriage

func InterpretTriage(answer *TriageAnswer, agent *models.Agent) (*models.MailInsight, error)

InterpretTriage turns the model's answer into an insight, refusing values outside the vocabulary the way a rule would refuse them.

func IsBudgetYear added in v0.104.0

func IsBudgetYear(year, today string) bool

IsBudgetYear says a year, "2006", is one a year's budgets may be asked for on today, "2006-01-02".

func IsImageAttachment

func IsImageAttachment(contentType string) bool

IsImageAttachment says whether a file is a picture a model can look at.

func IsMediaAttachment

func IsMediaAttachment(contentType string) bool

IsMediaAttachment says whether a file is a video or a sound a browser plays in the page.

func IsPDFAttachment added in v0.155.0

func IsPDFAttachment(attachment *models.AgentAttachment) bool

IsPDFAttachment says whether a stored file is a PDF by what was kept of it. An upload's type is corrected from its bytes when it is stored, so the type is enough for any file uploaded since; the name covers the ones before.

func IsStatementSource added in v0.100.0

func IsStatementSource(source *models.AgentKnowledgeSource) bool

IsStatementSource says a source is the finance source of imported statements.

func KnowledgeLanguage added in v0.58.0

func KnowledgeLanguage(agent *models.Agent, user *models.User) string

KnowledgeLanguage is what the agent writes in when nobody is talking to it: its notes, and the triage, summaries, research, drafts and briefs it makes on its own. The agent's own setting for it, else the language the agent or the account was set to, never the one the dashboard happens to be shown in, so that switching the dashboard's language does not switch what the agent keeps; else empty for the model's default.

func Language

func Language(agent *models.Agent, user *models.User) string

Language is what the agent talks to a person in, in a conversation: the agent's own setting, else the account's chosen locale, else the one the dashboard said, else empty for the model's default. Only conversations use it; work the agent does on its own uses KnowledgeLanguage.

func LastStatementImport added in v0.100.0

func LastStatementImport(source *models.AgentKnowledgeSource) *models.FinanceStatementImport

LastStatementImport is the statement source's last import, or nil.

func LoadHeaders

func LoadHeaders(ctx context.Context, store storage.Storage, mail *models.Mail) error

LoadHeaders fills a message's headers from the spool, where they live; the row carries the envelope and a few named fields but not the header block. Nothing is changed when the message is no longer stored.

func MailFacts

func MailFacts(mail *models.Mail) []string

MailFacts is what the server already knows about a message, said plainly: how it authenticated, what the spam filter made of it, whether it came from a list or a machine, and the two headers a forgery shows itself in — a Reply-To or a Return-Path pointing somewhere else than the From.

func MinimumMessages

func MinimumMessages(source *models.AgentMailbox) int

MinimumMessages is how long a conversation in this source is before it is summarized unasked.

func Money

func Money(amount float64, currency string) string

Money is an amount as it is written for a person to read: the amount, and the currency the operator says the prices are in.

func MonthBounds

func MonthBounds(when time.Time, owner *models.User) (time.Time, time.Time)

MonthBounds is the first moment of a month and the first of the next, in the person's own zone: what "June 2023" means to them.

func MuteAlert added in v0.82.0

func MuteAlert(tx db.Transaction, agent *models.Agent, alertId string, muteScope models.AlertMuteScope, muteTarget string) (*models.AgentAlertMute, error)

MuteAlert keeps a mute for the agent. With an alert, the target may be left out and is taken from what the alert covered: by default its bursts, or its senders when it was about messages; or the scope asked for. Every target of that scope is muted, and the first mute returned. Without an alert, the target is the person's own, and its scope, when they leave it out, is read from it.

func NetWorthOn added in v0.96.0

func NetWorthOn(ctx context.Context, tx db.Transaction, fetcher *rates.Fetcher, agentId, currencyCode, day string) (string, []string, error)

NetWorthOn is net worth on a day ("2006-01-02") in one currency, as a decimal, with the currencies left out for want of a rate: what a net worth savings target records as its starting amount. A nil fetcher converts with the rates already stored.

func NewBackgroundSurvey added in v0.81.0

func NewBackgroundSurvey(agentId, question, scopePath string) *models.AgentBackgroundWork

NewBackgroundSurvey is a survey to run in the background, not yet placed in a conversation: the tool places it in the turn's, and the API in none.

func NextRun

func NextRun(schedule *models.AgentSchedule, owner *models.User, now time.Time) (time.Time, error)

NextRun is when a schedule next runs for a person, from now.

func NormalizeAlertMute added in v0.82.0

func NormalizeAlertMute(muteScope models.AlertMuteScope, muteTarget string) (string, error)

NormalizeAlertMute checks a scope and puts its target in the form it is matched in: an address or a domain in lower case, a subject key as the alerts keep them, a kind as a word.

func PeriodPath

func PeriodPath(when time.Time, month bool) string

PeriodPath is where a month or a year lives in the graph.

func ReadAttachmentText added in v0.155.0

func ReadAttachmentText(ctx context.Context, store storage.Storage, attachment *models.AgentAttachment) (string, error)

ReadAttachmentText is the text of a stored file, on demand: the text kept on its row when there is some, else the whole text of the PDF read out of storage. For files whose text must not be kept in the database, such as a tax document. Empty, with no error, for a file that is not a PDF or a PDF with no text layer; ErrPDFReaderMissing when the server has no reader.

func RecordFiled

func RecordFiled(tx db.Transaction, agentId, mailboxId string, mail *models.Mail, insight *models.MailInsight, folderName string) error

RecordFiled records that the person filed a sorted message somewhere the agent's sorting did not put it.

func RecordReplyDeclined

func RecordReplyDeclined(tx db.Transaction, reply *models.AgentReply, how string) error

RecordReplyDeclined records that a reply the agent wrote did not go.

func RecordSorted

func RecordSorted(tx db.Transaction, agentId, mailboxId string, mail *models.Mail, before, after *models.MailInsight) error

RecordSorted records that the person sorted a message themselves, differently from the agent: the category, the priority, whether it needs a reply.

func RecordUsage

func RecordUsage(database db.Database, agentId, mailboxId, model, kind string, usage llm.Usage)

RecordUsage adds what one model call cost to the hourly rows for this agent, source, model and kind of run. Best effort: a row that cannot be written loses accounting, never a run.

func RecordUsageIn

func RecordUsageIn(tx db.Transaction, agentId, mailboxId, model, kind string, usage llm.Usage) error

RecordUsageIn is RecordUsage inside a transaction the caller already holds.

func RenderConduct

func RenderConduct(configuration *config.Configuration, agent *models.Agent, owner *models.User, short bool) (string, error)

RenderConduct renders the system message for a run nobody is present for, in the language of the agent's own work.

func ReplyPrompt

func ReplyPrompt(input *DraftInput, guidance string) ([]llm.ChatMessage, error)

ReplyPrompt builds the messages for one auto-reply call. The draft input carries everything but the guidance, which is the policy's.

func RequireBudget

func RequireBudget(tx db.Transaction, configuration *config.Configuration, agent *models.Agent, owner *models.User, now time.Time) error

RequireBudget is what a run calls before its first model call: it returns a Deferral to the next reset when nothing is left.

func SavingSummary added in v0.98.0

func SavingSummary(ctx context.Context, tx db.Transaction, fetcher *rates.Fetcher, agentId, month, today, currencyCode string) (*models.SavingSummary, error)

SavingSummary is a month's saving ("2006-01") in one currency as of today ("2006-01-02", the person's local day): what its income and spending budgets expect, what income less spending has come to so far, and where it is heading. It reads BudgetStatus for the budgets and their projections, so the figures agree with the budgets shown beside it. A nil fetcher converts with the rates already stored.

The expected saving is every income budget less every spending budget, each converted at the rate of the status's day. The actual saving counts all income and all spending the way cash flow does, budgeted or not, each day at its own rate; a currency with a day that has no rate is left out whole and named, as cash flow leaves it out.

func SettleSchedule

func SettleSchedule(schedule *models.AgentSchedule, owner *models.User, now time.Time) (time.Time, error)

SettleSchedule settles a schedule's time and says when it next runs. A distance from now ("@in 20m") becomes the moment it means, so that what is stored does not move every time it is read. The agent's own tool has always done this; a schedule written from the dashboard or the command line was refused instead, being told it wanted five cron fields.

func SkillRunsCommands

func SkillRunsCommands(declared *skills.Tool) bool

SkillRunsCommands says whether carrying this tool out runs anything on a computer, which is what decides that it is held to the shell's rule.

func SourceActive

func SourceActive(agent *models.Agent, mailbox *models.Mailbox) bool

SourceActive says whether a mailbox is a source anything happens for: granted, of an agent that is on and not switched off by an operator.

func StatementImportSummary added in v0.100.0

func StatementImportSummary(result *models.FinanceStatementImport) string

StatementImportSummary is what an import did, in a sentence for the person.

func SumSpend

func SumSpend(tx db.Transaction, configuration *config.Configuration, agentId string, since time.Time) (int64, float64, error)

SumSpend is what a period came to, in tokens and in money. Usage is kept per model, and each model is priced by its own provider, so a deployment with two providers adds up properly — and grouping by model gives both numbers from the one query, which is why the budget check does not read the same rows twice. An agent id of "" is the whole server.

func SumSpendOfKind

func SumSpendOfKind(tx db.Transaction, agentId, kind string, since time.Time) (int64, error)

SumSpendOfKind is what one kind of run has spent since a time, in tokens.

SumSpend prices everything an agent did, by model, because a budget has to say what it cost. This answers the narrower question a run asks about its own share -- how much of today has already gone on this kind of work -- and the usage rows carry the kind, so it is the same one grouped query with a different key.

func SummarizePrompt

func SummarizePrompt(input *SummarizeInput) ([]llm.ChatMessage, error)

SummarizePrompt builds the messages for one summarize call.

func TaxMailSummary added in v0.155.0

func TaxMailSummary(copied []*models.AgentAttachment, canReadPDFs bool) string

TaxMailSummary is what came of a message mailed to the tax document address, in a sentence for the person: the files being read, or why nothing is.

func TriagePrompt

func TriagePrompt(input *TriageInput) ([]llm.ChatMessage, error)

TriagePrompt renders the two messages a triage call sends.

func UnwantedCategory

func UnwantedCategory(category string) bool

UnwantedCategory says whether the sorting put a message in the two categories nobody wants, which is what the rule every mailbox starts with matches.

func YearBudgetStatus added in v0.104.0

func YearBudgetStatus(ctx context.Context, tx db.Transaction, fetcher *rates.Fetcher, agentId, year, today string) (*models.BudgetStatus, error)

YearBudgetStatus is every spending category with a budget in any month of a year ("2006"), against the budgets of its months, as of today ("2006-01-02"). Each month that has begun is read with BudgetStatus and each month still to come with the budgets in force for it, then ProjectSpendingCategoryYear and ProjectIncomeCategoryYear add them up.

A spending category is reported in the currency of its budget in the latest month begun (the first month to come for a budget that has not started). A month whose budget was in another currency is converted at the rate of that month's as-of day; one with no rate is left out, its spending or income reported as unconverted.

func YearSavingSummary added in v0.104.0

func YearSavingSummary(ctx context.Context, tx db.Transaction, fetcher *rates.Fetcher, agentId, year, today, currencyCode string) (*models.SavingSummary, error)

YearSavingSummary is a year's saving ("2006") in one currency as of today ("2006-01-02"), built from its months: each month begun is its SavingSummary, and each month still to come expects what the budgets in force for it expect, converted at the as-of day's rate.

Only the months in which at least one budget, income or spending, is in force count, and BudgetedMonths names them: expected, actual and projected alike, so nine months of income and spending are never set against four months of budgets. A year with no budget in any month counts all twelve instead, with nothing expected, no difference and no pace to speak of.

The expected saving is every counted month's income budgets less its spending budgets. The projected income is the counted months begun as their summaries project them and each counted month to come at its income budgets; the projected spending is the counted months begun the same way and each counted month to come at their average (or at its spending budgets when none has begun), the way ProjectSpendingCategoryYear carries a budget's year on. The counts are of the spending categories with a budget in any month.

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

Agent is the worker and, for the rest of the server, the way to hand it work.

func New

func New(settings *Settings) *Agent

New builds the agent. Register handlers, then Start.

func (*Agent) AnnotateTransaction added in v0.118.0

func (self *Agent) AnnotateTransaction(ctx context.Context, agentRow *models.Agent, financeTransactionId, annotation string, annotatedBy models.AnnotatedBy, canReplacePersonAnnotation bool) (*models.FinanceTransaction, error)

AnnotateTransaction writes what the person or their agent says about a finance transaction, empty to take it away, and answers the finance transaction as it is now. The agent overwrites or removes the person's only when canReplacePersonAnnotation, which is the person asking for it in a conversation they are there for; never in a run with nobody present (ErrAnnotationIsThePersons). The person always may. What the agent writes is the agent's either way.

func (*Agent) AnswerHerdrQuestion added in v0.120.0

func (self *Agent) AnswerHerdrQuestion(ctx context.Context, agentId, computerName, paneId, questionFingerprint string, optionNumbers []int, optionLabels []string, freeText string) (*HerdrAnswer, error)

AnswerHerdrQuestion answers the question a session waits on, if it is still the one with this fingerprint.

func (*Agent) Apply

func (self *Agent) Apply(run *AskRun, command RunCommand) bool

Apply gives the run the word here. It says whether anything was waiting for it: a stop always is.

func (*Agent) Ask

func (self *Agent) Ask(settings *AskSettings) (*AskRun, error)

Ask starts a turn. It returns at once; the run streams what happens.

func (*Agent) AttachComputer

func (self *Agent) AttachComputer(agentId string, connection DeviceConnection, identity ComputerIdentity)

AttachComputer records a person's computer by its name; a second attach under the same name replaces the first, and a different name is another computer beside it.

func (*Agent) AttachTab

func (self *Agent) AttachTab(agentId string, connection TabConnection, title, url string)

AttachTab records a person's tab; a second attach replaces the first.

func (*Agent) BackgroundCommands added in v0.57.0

func (self *Agent) BackgroundCommands(ctx context.Context, agentId string) ([]*BackgroundCommand, error)

BackgroundCommands are the background commands on a person's computers, newest first on each.

func (*Agent) BeforeDeletingAgent added in v0.87.0

func (self *Agent) BeforeDeletingAgent(ctx context.Context, tx db.Transaction, agentId string) error

BeforeDeletingAgent ends each of an agent's finance sources at its provider, best effort, before the agent and everything it has are deleted. The API calls it before DeleteAgent.

func (*Agent) BeforeDeletingSource added in v0.87.0

func (self *Agent) BeforeDeletingSource(ctx context.Context, tx db.Transaction, source *models.AgentKnowledgeSource, closedOn string) error

BeforeDeletingSource is what deleting a finance source does first, in the deleting transaction: it ends the finance source at its provider, best effort, so the operator stops paying for a link nobody can reach, and turns the assets its finance accounts valued into manual ones closed on closedOn, so their history outlives the source and net worth stops counting them. Any other kind of source needs nothing. The API calls it before DeleteAgentSource.

func (*Agent) BrowserConnected added in v0.69.0

func (self *Agent) BrowserConnected(agentId string) bool

BrowserConnected says whether a person's browser is connected through the extension, with a tab to act in or not.

func (*Agent) CallDirect

func (self *Agent) CallDirect(
	ctx context.Context,
	owner *models.User,
	person *models.Agent,
	operations tools.Operations,
	surface string,
	origin string,
	resultCharacters int,
	name string,
	arguments json.RawMessage,
) (*tools.Result, error)

CallDirect runs one tool by name, as this person, outside a conversation. The tool decides what it may do; the person's permissions decided whether it was offered at all. resultCharacters is how much of an answer the caller takes in one piece, or zero for the usual bound.

func (*Agent) CanSurvey added in v0.81.0

func (self *Agent) CanSurvey() bool

CanSurvey says whether a survey can be run now, for the API to refuse one at once rather than queue work that fails.

func (*Agent) CancelRecordingTranscription added in v0.142.0

func (self *Agent) CancelRecordingTranscription(transaction db.Transaction, userId, runId string) (*models.RecordingTranscriptRun, error)

CancelRecordingTranscription stops local work only after its durable state commits.

func (*Agent) Catalog

func (self *Agent) Catalog() *Catalog

Catalog is every tool the server knows.

func (*Agent) CheckProviderPrices added in v0.165.0

func (self *Agent) CheckProviderPrices(ctx context.Context, isForced bool) ([]*models.AgentBillingCheck, error)

CheckProviderPrices compares the configured prices of every openai provider that has a billing key with what its bill says, sets the ones that differ, and tells the operators. Unless isForced it does nothing when a check ran within the day, here or on another server. It answers the checks it made, one per provider.

func (*Agent) CloseHerdrSession added in v0.120.0

func (self *Agent) CloseHerdrSession(ctx context.Context, agentId, computerName, paneId string) (*HerdrClose, error)

CloseHerdrSession ends a session's coding agent and its pane; refused while it works.

func (*Agent) CodingPromptRecall added in v0.124.0

func (self *Agent) CodingPromptRecall(ctx context.Context, found *models.Agent, owner *models.User, request *CodingRequest) (*CodingContext, error)

CodingPromptRecall is what a prompt typed in a coding session recalls: the recall a turn would carry, kept to the checkout's project, the pages under it, the pages it links to and the lessons, less the pages the session was shown in its last few prompts.

func (*Agent) CodingSessionStart added in v0.124.0

func (self *Agent) CodingSessionStart(ctx context.Context, found *models.Agent, owner *models.User, request *CodingRequest) (*CodingContext, error)

CodingSessionStart is what a coding session starting in a directory is shown: the checkout's project pages and their liveliest facts, and where the last session there stopped. Lessons wait for a prompt: matched to a whole project they were about anything at all.

func (*Agent) ComputerAnswered

func (self *Agent) ComputerAnswered(agentId string, connection DeviceConnection, id int64, ok bool, data json.RawMessage, failure string)

ComputerAnswered is a computer answering a request.

func (*Agent) ComputerBackgroundEnded added in v0.57.0

func (self *Agent) ComputerBackgroundEnded(agentId string, connection DeviceConnection, data json.RawMessage)

ComputerBackgroundEnded is a computer saying a background command ended.

func (*Agent) ComputerHerdrChanged added in v0.120.0

func (self *Agent) ComputerHerdrChanged(agentId string, connection DeviceConnection, data json.RawMessage)

ComputerHerdrChanged is a computer saying, unasked, that a question came or went in one of its herdr panes, or that a watched session finished.

func (*Agent) ComputerSessionSaid

func (self *Agent) ComputerSessionSaid(agentId string, connection DeviceConnection, id, event, stream, data string, code int)

ComputerSessionSaid routes what a computer said about a session.

func (*Agent) ComputersAttached

func (self *Agent) ComputersAttached(agentId string) []AttachedComputer

ComputersAttached are the computers a person has attached, for the API.

func (*Agent) ConnectBrowser added in v0.69.0

func (self *Agent) ConnectBrowser(agentId string, connection TabConnection, title, url string, hasTab bool)

ConnectBrowser records a person's browser, connected through the extension, with a tab to act in or with none yet; a second connection replaces the first.

func (*Agent) CopyMailTaxDocuments added in v0.155.0

func (self *Agent) CopyMailTaxDocuments(ctx context.Context, agentRow *models.Agent, mailId string) ([]*models.AgentAttachment, error)

CopyMailTaxDocuments copies the PDFs and pictures a stored message carries into uploads of the agent's, marked tax documents and so with no text kept, for reading each on its own. A part too large, or of another kind, is left. It answers the uploads made, none when the message carries no such file.

func (*Agent) CurateRecordingSpeakers added in v0.144.0

func (self *Agent) CurateRecordingSpeakers(ctx context.Context, userId, recordingId string) error

CurateRecordingSpeakers derives clean references only from explicit confirmed intervals. Lack of suitable audio is a successful result with no new references.

func (*Agent) DeletePaystub added in v0.155.0

func (self *Agent) DeletePaystub(ctx context.Context, agentRow *models.Agent, paystubId string) error

DeletePaystub deletes a paystub and the file it was read from.

func (*Agent) DeleteReceipt added in v0.118.0

func (self *Agent) DeleteReceipt(ctx context.Context, agentRow *models.Agent, receiptId string) (*models.FinanceReceipt, error)

DeleteReceipt deletes a receipt with its lines and matches, and the photo or PDF it was read from unless a conversation holds the same file. It answers the receipt as it was.

func (*Agent) DeleteStatementAccount added in v0.108.0

func (self *Agent) DeleteStatementAccount(ctx context.Context, agentRow *models.Agent, financeAccountId string) (*db.FinanceAccountDeleted, error)

DeleteStatementAccount deletes an account of imported statements with its transactions and the assets that value it. A transfer one of its transactions was paired in is judged again in the same transaction: the other side is paired with what remains, or given the provider category mapping and the spending rules again, and left to the categorize job when nothing places it.

func (*Agent) DeleteTaxForm added in v0.155.0

func (self *Agent) DeleteTaxForm(ctx context.Context, agentRow *models.Agent, taxFormId string) error

DeleteTaxForm deletes a tax form and the file it was read from.

func (*Agent) DetachComputer

func (self *Agent) DetachComputer(agentId string, connection DeviceConnection)

DetachComputer forgets a person's computer, if this connection is the one attached under its name.

func (*Agent) DetachTab

func (self *Agent) DetachTab(agentId string, connection TabConnection)

DetachTab forgets a person's tab, if this connection is the one attached.

func (*Agent) Digest

func (self *Agent) Digest(ctx context.Context, agent *models.Agent, owner *models.User, from, until time.Time) (string, error)

Digest is what happened between two moments, as text for a prompt.

Empty when nothing happened, which is the answer for a quiet month and is not an error.

func (*Agent) DirectTools

func (self *Agent) DirectTools(ctx context.Context, person *models.Agent, operations tools.Operations) []*tools.Tool

DirectTools is the catalog as this person sees it, for a caller that will choose a tool itself rather than have a model choose one.

It is built the way a turn's catalog is built -- what their permissions allow, less what the operator switched off, plus the tools of the servers they have connected and the skills the operator installed -- with a few left out.

ask_user goes because there is nobody at this end to answer it; see Ask above. tool_search goes because it exists to keep a long catalog out of a model's request until it is wanted, and a caller that lists tools once and keeps the list is better served by the list.

func (*Agent) DraftReply

func (self *Agent) DraftReply(ctx context.Context, request *models.AgentDraftRequest) (*models.AgentDraft, error)

DraftReply writes a reply to a message for the person to read. It is the one thing the agent does in the request rather than from the queue, because the person is sitting in the composer waiting for it.

func (*Agent) EmbedGraph

func (self *Agent) EmbedGraph(ctx context.Context, agent *models.Agent, limit int) (int, error)

EmbedGraph gives vectors to pages and facts that have none, or whose vector an older model made, and says how many it wrote.

func (*Agent) EmbedOverviewSections added in v0.89.0

func (self *Agent) EmbedOverviewSections(ctx context.Context, agent *models.Agent, limit int) (int, error)

EmbedOverviewSections gives a vector to every overview section that has none, most important pages first and at most so many, and removes the vectors of sections no overview holds any more. It says how many it wrote.

The pages it embeds for are the overviewSectionPages most important, but a vector of a page outside them is not therefore stale: the page may only have slipped down the order. Such a vector goes only when its page, read again, is gone, dormant, or no longer has that section.

func (*Agent) Enqueue

func (self *Agent) Enqueue(tx db.Transaction, kind models.AgentJobKind, agentId, mailboxId, subjectId string) (*models.AgentJob, error)

Enqueue adds a job inside the caller's transaction. A job for the same agent, kind and subject that is already queued or running is returned instead of a second one.

func (*Agent) EnsureStatementSource added in v0.100.0

func (self *Agent) EnsureStatementSource(ctx context.Context, agentRow *models.Agent) (*models.AgentKnowledgeSource, error)

EnsureStatementSource is the agent's statement source, made with a fresh import token and account key the first time it is asked for, in a transaction of its own so it is there for whatever asks next. Two asking at once make one: the second finds the first's.

func (*Agent) EnsureVectorIndexes

func (self *Agent) EnsureVectorIndexes(ctx context.Context) error

EnsureVectorIndexes builds the vector index for every table and every model that has written a vector. Called at start, and again whenever a model writes its first vector, so that the index exists before a corpus arrives rather than having to be built over one.

func (*Agent) EvaluateAnswer added in v0.60.0

func (self *Agent) EvaluateAnswer(ctx context.Context, found *models.Agent, owner *models.User, question, expectedAnswer, outdatedAnswer, answerFrom string, plan *RetrievalPlan) (*AnswerEvaluation, error)

EvaluateAnswer answers a question from one kind of context, with the model a conversation uses, and grades the answer against the one the person gave. Both calls are runs of kind evaluate, so they are listed and priced like any other call and never touch the conversations or the graph.

memory@planned and both@planned recall following the plan given, as a live turn follows its depth judgement's; no model is asked for one.

func (*Agent) ExplainRecall added in v0.89.0

func (self *Agent) ExplainRecall(ctx context.Context, found *models.Agent, owner *models.User, question string, plan *RetrievalPlan) ([]*RecalledPage, *RecallExplanation, error)

ExplainRecall answers what recall would carry for a question, as RecallForQuestion does, and why: the explanation of every page and fact the searches found. A plan given is followed as a live turn follows the depth judgement's, without asking any model for one; nil is basic recall. Nothing is marked as used.

func (*Agent) FindRun

func (self *Agent) FindRun(runId string) *AskRun

FindRun is a run in flight or recently finished, or nil.

func (*Agent) FinishRecordingCapture added in v0.154.0

func (self *Agent) FinishRecordingCapture(transaction db.Transaction, userId, recordingId string) error

FinishRecordingCapture does, once, the work runs of an unfinished capture skipped: the memory sync and the naming job. The caller has just moved the capture to stopped. When some piece is still being transcribed, nothing is done here, because that piece's own completion sees a stopped capture and does the same.

func (*Agent) FoldByWordsIntoWhatThePageSays

func (self *Agent) FoldByWordsIntoWhatThePageSays(tx db.Transaction, written *models.AgentFact, node *models.AgentNode) (*models.AgentFact, error)

FoldByWordsIntoWhatThePageSays is the fold without the fact's meaning: the twin is found by names and words alone. For a caller that is already inside a transaction it cannot leave -- a dashboard request, which runs whole inside one -- and must not hold it, and the page's row lock, through a provider call.

func (*Agent) FoldIntoWhatThePageSays

func (self *Agent) FoldIntoWhatThePageSays(ctx context.Context, tx db.Transaction, written *models.AgentFact, node *models.AgentNode) (*models.AgentFact, error)

FoldIntoWhatThePageSays merges a fact just written into the one already on the page that says the same thing, and reports which it became.

Every writer needs this and for the same reason: nobody writing a fact has read the page first. A conversation that comes back to a subject is filed by two runs a day apart, neither knowing of the other, and both doing their job; a person adding a line by hand is not going to reread thirteen of them. Left to itself a page ends up saying one thing nine ways, which is worse than saying it once and worse than not saying it, because every answer drawn from it is a little different.

The older one stays: its number is what anything else cites. It gains whatever evidence the new one brought, and the new one goes dormant behind it -- kept, searchable, out of the page -- so a fold the person disagrees with is there to be undone. What happened is in the page's history either way.

What it will not do is guess. Folding with nobody watching is only safe where the two are the same sentence twice; anything that reads alike but says something different is left standing beside its twin, so that the newer is recalled as well as the older. See whatToFold.

func (*Agent) ForeignRun

func (self *Agent) ForeignRun(runId string) (string, bool)

ForeignRun is the conversation of a run another instance is running, as heard through the feed, and whether it is known at all.

func (*Agent) ForgetConnection

func (self *Agent) ForgetConnection(serverName, agentId string)

ForgetConnection drops a person's session with a server, after a disconnect or a new credential.

Every session with that server as that person goes, whichever computer it was through: a new credential or a new reach is true of all of them.

func (*Agent) ForgetSkills

func (self *Agent) ForgetSkills()

ForgetSkills makes the next look read the rows again, for when one has just been installed or taken away.

func (*Agent) Forward

func (self *Agent) Forward(command RunCommand) error

Forward says the word to the other instances, for the one running the turn to apply. Whether anything was waiting for it is not known here.

func (*Agent) ForwardAuthorization added in v0.73.0

func (self *Agent) ForwardAuthorization(ctx context.Context, agentId string, server *config.AgentMCPServer, forwardURL, computerName string) (string, error)

ForwardAuthorization asks the person's attached computer to listen on its loopback interface for a server's authorization and send the browser that brings it on to forwardURL. The answer is the loopback address to give the service, which only a browser on that computer can reach.

The computer is the one the person named, since it is the one they are signing in on; else the server's reach; else the only one attached.

func (*Agent) HerdrComputerNames added in v0.120.0

func (self *Agent) HerdrComputerNames(agentId string) []string

HerdrComputerNames are the names of a person's computers whose program watches herdr, for the dashboard to say where it looked.

func (*Agent) HerdrSessions added in v0.120.0

func (self *Agent) HerdrSessions(ctx context.Context, agentId, computerName string) ([]*HerdrSession, []string, error)

HerdrSessions are the coding sessions on a person's computers, every computer's or one's, by computer and pane, and the computers that did not answer: a computer left out of the list is not one whose questions went.

func (*Agent) HerdrWakeConversation added in v0.120.0

func (self *Agent) HerdrWakeConversation(ctx context.Context, agentId, conversationId string) (string, error)

HerdrWakeConversation is the conversation a watch from the dashboard or the command line wakes: the one named, when it is the person's own and one a turn can be woken in, or their main conversation.

func (*Agent) ImportStatementFiles added in v0.100.0

func (self *Agent) ImportStatementFiles(ctx context.Context, agentRow *models.Agent, owner *models.User, files []*StatementFile, origin models.StatementImportOrigin, mailId string) (*models.FinanceStatementImport, error)

ImportStatementFiles imports OFX files into the agent's statement source, records what came of it as the source's last import, and answers it. A file that cannot be read is named in the answer's error and the others are still imported; the error comes back as an error only when the database fails. mailId names the message the files came from, for the import job to know it has done this one already.

func (*Agent) ImportTransactionRows added in v0.108.0

func (self *Agent) ImportTransactionRows(ctx context.Context, agentRow *models.Agent, owner *models.User, check *finance.TransactionRowsCheck) (*models.FinanceStatementImport, error)

ImportTransactionRows imports one account's transaction rows, checked already (finance.CheckTransactionRows), into the agent's statement source, the way a statement is imported, and records it as the source's last import. Only the rows the chosen account does not hold already are written (planTransactionRows). Rows whose account cannot be chosen are refused, wrapping finance.ErrTransactionRowsRefused, before anything is written: the plan is made once as PreviewTransactionRows makes it, then again under the statement source's lock, so two imports of the same rows at once cannot both find them new. A refusal the second time is returned as the first is, and leaves the source's last import as it was.

func (*Agent) IsStatementImportToken added in v0.100.0

func (self *Agent) IsStatementImportToken(tx db.Transaction, mailbox *models.Mailbox, token string) bool

IsStatementImportToken is the delivery hook's question: is this the token of the statement import address of the mailbox's owner? Only when the agent is on, finance is offered, the person's agent is active and their statement source is switched on. Asked inside the delivery transaction, so it reads and decides and nothing more.

func (*Agent) IsTaxDocumentToken added in v0.155.0

func (self *Agent) IsTaxDocumentToken(tx db.Transaction, mailbox *models.Mailbox, token string) bool

IsTaxDocumentToken is the delivery hook's question: is this the token of the tax document address of the mailbox's owner? Only when the agent is on, finance is offered and the person's agent is active. Asked inside the delivery transaction, so it reads and decides and nothing more.

func (*Agent) JudgeRetrievalPlan added in v0.93.0

func (self *Agent) JudgeRetrievalPlan(ctx context.Context, found *models.Agent, owner *models.User, question string) (*JudgedPlan, error)

JudgeRetrievalPlan asks the depth judgement about a question on its own, as a turn's first message, for an evaluation to replay the plan a live turn would follow. It is one call to the fast model, made only when asked for and priced like any other; a replay given the plan asks nothing.

func (*Agent) KnowledgeMeaning

func (self *Agent) KnowledgeMeaning(agentId string) indexed.Meaning

KnowledgeMeaning is the meaning half of a search of what was indexed, for a caller that is not in a turn: the API, and the command line and the dashboard through it.

The person searching their own documents is ranked the same way their agent's tool is, which is the whole point of one search shared between the surfaces. It embeds the question, which a turn does once and keeps; there is nothing to keep here, so each search pays for its own.

func (*Agent) LatestIn

func (self *Agent) LatestIn(conversationId string) *AskRun

LatestIn is the last turn of a conversation, running or just finished, for a caller that asked, could not wait to the end, and has come back for the rest.

A finished run is handed back rather than withheld, because the caller coming back a second late would otherwise be told there is nothing to wait for and never hear the answer. Subscribing to a finished run replays what it said and closes, which is exactly what they want. A run is forgotten ten minutes after it ends, and after that there is nothing to hand back and the conversation itself is where the answer is.

func (*Agent) LessonsForQuestion added in v0.94.0

func (self *Agent) LessonsForQuestion(ctx context.Context, found *models.Agent, owner *models.User, question string) []string

LessonsForQuestion is the lessons a turn asking this would be shown.

func (*Agent) ListIdeas added in v0.76.0

func (self *Agent) ListIdeas(ctx context.Context, tx db.Transaction, agent *models.Agent, owner *models.User, statuses []models.AgentIdeaStatus, kinds []models.AgentIdeaKind, language string) ([]*models.AgentIdea, error)

ListIdeas is the agent's ideas in the statuses and kinds asked for, or in all, brought up to date first, in the language asked for where the catalog has it.

func (*Agent) MarkIdeasShown added in v0.76.0

func (self *Agent) MarkIdeasShown(tx db.Transaction, agent *models.Agent, ideaIds []string) error

MarkIdeasShown notes that ideas were put in front of the person.

func (*Agent) MatchReceipt added in v0.118.0

func (self *Agent) MatchReceipt(ctx context.Context, agentRow *models.Agent, receiptId, financeTransactionId, matchedAmount string) (*models.FinanceReceipt, error)

MatchReceipt matches a receipt to a finance transaction by hand, as the person's, which the matcher never removes: with the amount of the charge the receipt explains, or when that is empty, the charge's amount or the receipt's total, whichever is less. Matching it again changes the amount. One receipt may be matched to several charges (an order shipped in parts) and one charge to several receipts.

func (*Agent) MeaningSearch

func (self *Agent) MeaningSearch(ctx context.Context, agent *models.Agent, mailboxId, query string, limit int) ([]string, error)

MeaningSearch is meaningSearch for the API and for tests.

func (*Agent) MigrateMemories

func (self *Agent) MigrateMemories(ctx context.Context, agent *models.Agent) error

MigrateMemories moves an agent's flat memories onto the graph, once.

Done here rather than in the migration because a page and a fact need identifiers this package makes, and because doing it lazily means the old table is untouched: a deployment that goes back a release finds its memories exactly as they were.

func (*Agent) MoveScheduleToGoal added in v0.111.0

func (self *Agent) MoveScheduleToGoal(tx db.Transaction, agent *models.Agent, scheduleId, conversationId string) (*models.AgentSchedule, error)

MoveScheduleToGoal makes an existing schedule one of a goal's: its runs take place in the goal's conversation, as the goal's turns, and the goal stops taking turns of its own.

func (*Agent) NotifyPhone added in v0.128.0

func (self *Agent) NotifyPhone(ctx context.Context, phone *models.AgentPhone, content *push.Content) error

NotifyPhone sends one notification to one phone and records how it went.

func (*Agent) OAuthSettings

func (self *Agent) OAuthSettings(server *config.AgentMCPServer, redirectURL string) *mcp.OAuthSettings

OAuthSettings is the flow for a server, from the configuration.

func (*Agent) OnMailboxDelivery

func (self *Agent) OnMailboxDelivery(tx db.Transaction, mailbox *models.Mailbox, item *models.MailboxItem, mail *models.Mail)

OnMailboxDelivery is the delivery hook: a message has just been placed in a mailbox, inside the delivery transaction. If the mailbox is a granted source of an active agent, the processing jobs are queued in the same transaction — and nothing else happens here, because a model call inside the SMTP transaction would be a model outage bouncing mail.

func (*Agent) OnStatementDelivery added in v0.100.0

func (self *Agent) OnStatementDelivery(tx db.Transaction, mailbox *models.Mailbox, item *models.MailboxItem, mail *models.Mail)

OnStatementDelivery is the delivery hook for a message that reached a statement import address, already filed: it queues the import, in the delivery transaction, and does nothing else there.

func (*Agent) OnTaxDocumentDelivery added in v0.155.0

func (self *Agent) OnTaxDocumentDelivery(tx db.Transaction, mailbox *models.Mailbox, item *models.MailboxItem, mail *models.Mail)

OnTaxDocumentDelivery is the delivery hook for a message that reached a tax document address, already filed: it queues the tax_mail job, in the delivery transaction, and does nothing else there.

func (*Agent) OpenHerdrSession added in v0.120.0

func (self *Agent) OpenHerdrSession(ctx context.Context, agentId, computerName, directory, codingAgentKind, agentName string, shouldSkipPermissions bool) (*HerdrSession, error)

OpenHerdrSession starts a coding agent, "claude" or "codex", in a new herdr pane in a directory of the person's on a computer.

func (*Agent) OpenSecret

func (self *Agent) OpenSecret(value string) (string, error)

OpenSecret opens what SealSecret sealed.

func (*Agent) OperationsFor

func (self *Agent) OperationsFor(ctx context.Context, owner *models.User) (Operations, error)

OperationsFor is what a run made for a person outside a request — a scheduled run, a turn from a chat app — may do: what the person may.

func (*Agent) PlanUsage added in v0.85.0

func (self *Agent) PlanUsage(provider string) *llm.PlanUsage

PlanUsage is what the named provider's plan last said of its allowance, or nil for a provider paid by the token, or one whose plan has never answered.

func (*Agent) PreviewReceipt added in v0.118.0

func (self *Agent) PreviewReceipt(ctx context.Context, agentRow *models.Agent, receipt *models.FinanceReceipt) (*ReceiptPreview, error)

PreviewReceipt checks a receipt and finds the charges it could explain, writing nothing: what RecordReceipt would do with it.

func (*Agent) PreviewTransactionRows added in v0.108.0

func (self *Agent) PreviewTransactionRows(ctx context.Context, agentRow *models.Agent, owner *models.User, check *finance.TransactionRowsCheck) (*finance.TransactionRowsPlan, error)

PreviewTransactionRows is what ImportTransactionRows would do with the same rows, writing nothing: not even the statement source is made. A refusal of the account, or of the source switched off, wraps finance.ErrTransactionRowsRefused.

func (*Agent) Probe

func (self *Agent) Probe(ctx context.Context, server *config.AgentMCPServer, agentId string) (int, error)

Probe connects to a server as a person once and reports what it found: how the Agent page checks a credential the person just gave.

func (*Agent) ProposeIdea added in v0.76.0

func (self *Agent) ProposeIdea(ctx context.Context, tx db.Transaction, agent *models.Agent, owner *models.User, idea *models.AgentIdea) (*models.AgentIdea, error)

ProposeIdea keeps an idea found for the person, once it passes the check every idea passes, whoever proposed it: the words and the tools (checkIdea), what prompted it (checkEvidence), that it is not one already kept (repeatedIdea), and a model's judgment that it promises nothing its tools cannot do (judgeIdea).

func (*Agent) ProposeReceiptMatches added in v0.118.0

func (self *Agent) ProposeReceiptMatches(ctx context.Context, agentRow *models.Agent, receiptId string) ([]finance.ReceiptMatchCandidate, error)

ProposeReceiptMatches is the charges a stored receipt could explain, the likeliest first, writing nothing.

func (*Agent) PublishReaction added in v0.134.0

func (self *Agent) PublishReaction(conversationId, messageId, reactionEmoji string, reactorKind models.AgentReactorKind)

PublishReaction tells everybody watching a conversation, on this instance and the others, that a reaction on one of its messages changed: the emoji now there from that reactor, or none. Called once the change is committed.

It belongs to no run, as a title does not, so it has no run id and is never replayed: a drawer that opens later reads it with the messages.

func (*Agent) QueueBackgroundWork added in v0.81.0

func (self *Agent) QueueBackgroundWork(tx db.Transaction, work *models.AgentBackgroundWork) (*models.AgentBackgroundWork, error)

QueueBackgroundWork records a piece of work and queues the job that runs it, in the caller's transaction.

func (*Agent) QueueEvaluation added in v0.61.0

func (self *Agent) QueueEvaluation(tx db.Transaction, agent *models.Agent) (*models.AgentEvaluationRun, error)

QueueEvaluation starts a run of the memory check and queues the job that fills it; one already queued or running is left to run, and is what is returned.

func (*Agent) QueueReceiptReading added in v0.118.0

func (self *Agent) QueueReceiptReading(tx db.Transaction, agentId, mailboxId, sourceId, financeTransactionId string) (*models.AgentJob, error)

QueueReceiptReading queues the receipt job for a source: a stored message in a mailbox (mailboxId given), or an uploaded file, which remembers the finance transaction it was uploaded to when one is given. The job's subject is the source alone: a job's subject has room for one id.

func (*Agent) QueueRecordingSummary added in v0.153.0

func (self *Agent) QueueRecordingSummary(transaction db.Transaction, userId, recordingId string) error

QueueRecordingSummary queues the title and summary job for a recording, inside the caller's transaction. It queues nothing, and says nothing, when the person has no active agent or no model is assigned to summaries.

func (*Agent) QueueRecordingSummaryAfterEdit added in v0.155.1

func (self *Agent) QueueRecordingSummaryAfterEdit(transaction db.Transaction, userId, recordingId string) error

QueueRecordingSummaryAfterEdit has the summary written again once the person has stopped changing who said what, or the words: the job is queued to start recordingSummaryEditDelay from now, and one already queued is moved to then. A title the person set is kept; a generated one may change with the summary.

func (*Agent) QueueRecordingTerms added in v0.153.0

func (self *Agent) QueueRecordingTerms(transaction db.Transaction, userId, recordingId string) (bool, error)

QueueRecordingTerms queues the term correction job for a recording inside the caller's transaction, and says whether it did. It queues nothing when the person has no active agent or no model is set up to run it, in which case the caller goes straight to the summary.

func (*Agent) QueueRecordingTranscription added in v0.142.0

func (self *Agent) QueueRecordingTranscription(transaction db.Transaction, userId, mediaId, clientRunId string, isReprocessingRequested bool) (*models.RecordingTranscriptRun, error)

QueueRecordingTranscription retains the requested version and job atomically. Initial uploads have one stable version; explicit reprocessing names a new key.

func (*Agent) QueueTaxDocumentReading added in v0.155.0

func (self *Agent) QueueTaxDocumentReading(tx db.Transaction, agentId, attachmentId string) (*models.AgentJob, error)

QueueTaxDocumentReading marks an upload of the agent's a tax document, forgetting any text kept of it, and queues the job that reads it. The job's subject is the upload.

func (*Agent) ReadBackgroundCommand added in v0.57.0

func (self *Agent) ReadBackgroundCommand(ctx context.Context, agentId, computerName, id string, tailBytes int) (*BackgroundCommand, error)

ReadBackgroundCommand is one of this agent's, with the last tailBytes of each stream.

func (*Agent) ReadHerdrScreen added in v0.120.0

func (self *Agent) ReadHerdrScreen(ctx context.Context, agentId, computerName, paneId string, lineCount int) (*HerdrScreen, error)

ReadHerdrScreen is a session's screen, or its last lineCount lines.

func (*Agent) ReadHerdrSession added in v0.120.0

func (self *Agent) ReadHerdrSession(ctx context.Context, agentId, computerName, paneId string, turnCount int) (*HerdrRead, error)

ReadHerdrSession is the last turns of a session.

func (*Agent) RecallForQuestion

func (self *Agent) RecallForQuestion(ctx context.Context, found *models.Agent, owner *models.User, question string) ([]*RecalledPage, error)

RecallForQuestion answers what the graph would put in front of the model for a question, without asking it anything.

The same two steps a turn takes -- the fused search, then the choice of blocks under the token budget -- so that what this reports is what a turn would carry and not a second implementation of it that drifts. What it deliberately leaves out is the turn's bookkeeping: no `used_at` is moved and no vectors are backfilled, because an evaluation that changed importance and decay as it ran would be measuring its own last pass.

func (*Agent) RecallForQuestionPlanned added in v0.93.0

func (self *Agent) RecallForQuestionPlanned(ctx context.Context, found *models.Agent, owner *models.User, question string, plan *RetrievalPlan) ([]*RecalledPage, error)

RecallForQuestionPlanned is RecallForQuestion following a retrieval plan, as a live turn follows its depth judgement's, without asking any model for one.

func (*Agent) ReconcileRecordingReferenceInvalidations added in v0.144.0

func (self *Agent) ReconcileRecordingReferenceInvalidations(ctx context.Context, userId, recordingId string) error

ReconcileRecordingReferenceInvalidations retires memory that used revoked conditioning evidence.

func (*Agent) RecordPaystub added in v0.155.0

func (self *Agent) RecordPaystub(ctx context.Context, agentRow *models.Agent, paystub *models.FinancePaystub, isUnbalancedAccepted bool) (*models.FinancePaystub, error)

RecordPaystub checks a paystub read out of an upload of the agent's and records it, in the place of whatever was read out of that upload before. One that does not add up is refused unless isUnbalancedAccepted, which only the person decides, or the reading job, which has nobody to ask and leaves the mark for the person to see. The upload is marked a tax document, which forgets any text kept of it.

func (*Agent) RecordReceipt added in v0.118.0

func (self *Agent) RecordReceipt(ctx context.Context, agentRow *models.Agent, receipt *models.FinanceReceipt, recording ReceiptRecording) (*RecordedReceipt, error)

RecordReceipt checks a receipt, stores it in place of any read from the same source before, and matches it: to the charge the recording names, as the person's; else, when the person has not matched it, to the one charge the matcher is sure of. The matcher's earlier matches are taken off first; the person's are kept while they still fit the receipt as read now, and the ones that do not are taken off and said in DroppedReceiptMatchReasons. A receipt that does not balance is refused unless the recording accepts it.

func (*Agent) RecordTaxForm added in v0.155.0

func (self *Agent) RecordTaxForm(ctx context.Context, agentRow *models.Agent, taxForm *models.FinanceTaxForm) (*models.FinanceTaxForm, error)

RecordTaxForm checks a tax form read out of an upload of the agent's and records it, as RecordPaystub records a paystub.

func (*Agent) RecordingTranscriptionAvailability added in v0.144.0

func (self *Agent) RecordingTranscriptionAvailability(transaction db.Transaction, userId string) (bool, string, error)

RecordingTranscriptionAvailability checks current admission without creating work or a model call.

func (*Agent) RegenerateStatementImportToken added in v0.100.0

func (self *Agent) RegenerateStatementImportToken(ctx context.Context, agentRow *models.Agent) (*models.AgentKnowledgeSource, error)

RegenerateStatementImportToken gives the statement source a new token, which ends the old import address at once.

func (*Agent) Register

func (self *Agent) Register(kind models.AgentJobKind, handler Handler)

Register sets the handler for a kind of job.

func (*Agent) RenameStatementAccount added in v0.108.0

func (self *Agent) RenameStatementAccount(ctx context.Context, agentRow *models.Agent, financeAccountId string, rename db.FinanceAccountRename) (*models.FinanceAccount, error)

RenameStatementAccount gives an account of imported statements the person's own name, the last digits of its number, or both, which later imports keep.

func (*Agent) ReportPresence added in v0.61.0

func (self *Agent) ReportPresence(userId, reporterId string, isVisible bool, idleSeconds int, now time.Time)

ReportPresence records one tab's or one phone's report for a person: whether it is shown, and how long since their last keypress, click or scroll in it. reporterId names the tab or phone; a report without one is an older dashboard, whose hidden tab is not taken to hide a visible one that reported lately, since it cannot say which tab it is.

func (*Agent) ResumeInteraction added in v0.61.4

func (self *Agent) ResumeInteraction(settings *ResumeSettings, chatAboutIt string) (*AskRun, error)

ResumeInteraction starts the turn a late answer brings: the answer to the question, or the word on the approval, as the person's message, and for an approval the one call it allows. The card must already have been claimed for this answer. Nil and no turn for an answer that asks for none: the person chose to chat about it instead.

func (*Agent) RetryRecordingTranscription added in v0.144.0

func (self *Agent) RetryRecordingTranscription(transaction db.Transaction, userId, runId string) (*models.RecordingTranscriptRun, error)

RetryRecordingTranscription preserves completed chunks and refuses unknown paid outcomes.

func (*Agent) SealSecret

func (self *Agent) SealSecret(value string) (string, error)

SealSecret seals a credential with the server secret, for storing.

func (*Agent) SendHerdrSession added in v0.120.0

func (self *Agent) SendHerdrSession(ctx context.Context, agentId, computerName, paneId, text string, attachmentIds []string) (*HerdrSent, error)

SendHerdrSession types text into a session, followed by enter; a session at work takes it as a message in its turn.

func (*Agent) Server

func (self *Agent) Server(name string) *config.AgentMCPServer

Server is a declared server by name, or nil.

func (*Agent) SetGoalState added in v0.111.0

func (self *Agent) SetGoalState(tx db.Transaction, agent *models.Agent, conversationId string, goalState models.AgentGoalState) (*models.AgentConversation, error)

SetGoalState is the person marking a goal done, dropping it, or taking it up again: met, dropped, or working. Only the person does this; a turn of the agent's own says note, wait or met through the goal tool.

func (*Agent) SetIdeaStatus added in v0.76.0

func (self *Agent) SetIdeaStatus(tx db.Transaction, agent *models.Agent, ideaId string, status models.AgentIdeaStatus) (*models.AgentIdea, error)

SetIdeaStatus is the person saying what became of an idea: done, dismissed, or open again. Started is StartIdea's, which needs a conversation, and expired is the clock's.

func (*Agent) SetMailer

func (self *Agent) SetMailer(sender mailer.Mailer)

SetMailer hands the worker the mailer, once there is one.

func (*Agent) SetOperationsFactory

func (self *Agent) SetOperationsFactory(factory OperationsFactory)

SetOperationsFactory hands the worker the way to act as a person.

func (*Agent) SetTabHeld added in v0.69.0

func (self *Agent) SetTabHeld(agentId string, hasTab bool)

SetTabHeld is the browser saying whether it has a tab the actions go to.

func (*Agent) SetUpHerdrHooks added in v0.120.0

func (self *Agent) SetUpHerdrHooks(ctx context.Context, agentId, computerName string, isRemoval bool) (*HerdrSetup, error)

SetUpHerdrHooks puts TeaNode's reporting hooks into Claude Code on a computer, or takes them out.

func (*Agent) ShareAttachment

func (self *Agent) ShareAttachment(attachmentId string, until time.Time) string

ShareAttachment is the query value that opens the file until the time given, or "" when the server has no secret to sign with.

func (*Agent) SharedAttachment

func (self *Agent) SharedAttachment(attachmentId, share string) bool

SharedAttachment says whether the query value opens the file now.

func (*Agent) SkillTools

func (self *Agent) SkillTools(ctx context.Context) []*Tool

SkillTools is every tool the installed skills declare.

func (*Agent) SpeakFirstNow added in v0.61.0

func (self *Agent) SpeakFirstNow(tx db.Transaction, agent *models.Agent, reason string) error

SpeakFirstNow queues the agent to speak first for a reason now, outside the sweep's rules: the person asked, from the dashboard or the command line. One already queued or running is left to run.

func (*Agent) Start

func (self *Agent) Start()

Start begins claiming work.

func (*Agent) StartGoal added in v0.111.0

func (self *Agent) StartGoal(tx db.Transaction, agent *models.Agent, goalTitle, goalDescription, originConversationId string) (*models.AgentConversation, error)

StartGoal starts a goal in a conversation of its own and makes it due at once. The title is what it is called in a list, the description what it is for. The origin is the conversation it was asked for in, when there was one, kept in the first activity row.

func (*Agent) StartIdea added in v0.76.0

func (self *Agent) StartIdea(ctx context.Context, tx db.Transaction, agent *models.Agent, ideaId, conversationId, language string) (*models.AgentIdea, *models.AgentConversation, error)

StartIdea records that a conversation carries an idea out: the one given, when the agent took it up where it was talking, or a new one named after the idea, whose first message the person then sends. Nothing is said in it here: starting an idea never acts.

func (*Agent) StatementImportAddress added in v0.100.0

func (self *Agent) StatementImportAddress(tx db.Transaction, owner *models.User, source *models.AgentKnowledgeSource) (string, error)

StatementImportAddress is the address statements are mailed to: the local part of the person's first mailbox address, a plus, statements- and the token, at that address's domain. Empty when the person has no mailbox with an address, since there is then nothing for the address to be delivered into.

func (*Agent) Stop

func (self *Agent) Stop()

Stop ends the worker and waits for the runs in flight.

func (*Agent) StopBackgroundCommand added in v0.57.0

func (self *Agent) StopBackgroundCommand(ctx context.Context, agentId, computerName, id string) (*BackgroundCommand, error)

StopBackgroundCommand stops one of this agent's for the person. The agent is told it ended, as it is of any ending it did not ask for.

func (*Agent) StopBackgroundWork added in v0.81.0

func (self *Agent) StopBackgroundWork(tx db.Transaction, agentId, workId string) (*models.AgentBackgroundWork, error)

StopBackgroundWork stops one of the agent's, in the caller's transaction: the row says stopped at once, and the work, when it runs here, is cancelled once that is committed. Work running on another instance sees the row within backgroundWorkStopCheck. Stopped work wakes nothing. Work that had already finished is returned as it is.

func (*Agent) StopConversation

func (self *Agent) StopConversation(conversationId string)

StopConversation ends every run of a conversation, for the conversation being deleted under them.

func (*Agent) SubscribeConversation

func (self *Agent) SubscribeConversation(conversationId string) (<-chan Event, func())

SubscribeConversation is the feed of a conversation: the turns in flight on this instance are replayed first, then whatever happens until the returned function is called. The channel closes then.

func (*Agent) Survey added in v0.79.0

func (self *Agent) Survey(ctx context.Context, agent *models.Agent, owner *models.User, question, scopePath string) (*SurveyReport, error)

Survey answers a question about a whole area of the graph: scopePath names a theme, or any page, and empty means everything.

Every run it makes is a run of kind survey, read-only, in a conversation of its own. The whole of it is bounded by surveyLongest and by ctx, whichever ends first.

func (*Agent) SyncRecordingKnowledge added in v0.144.0

func (self *Agent) SyncRecordingKnowledge(ctx context.Context, userId, recordingId string) error

SyncRecordingKnowledge publishes passive evidence to existing source ingestion.

func (*Agent) TabAnswered

func (self *Agent) TabAnswered(agentId string, connection TabConnection, id int64, ok bool, data json.RawMessage, failure string)

TabAnswered is the extension answering a request: the extension on this connection, so that a replaced tab's late answers reach nobody.

func (*Agent) TabAttached

func (self *Agent) TabAttached(agentId string) (bool, string, string)

TabAttached says whether a person has a tab to act in, for the API.

func (*Agent) TaxDocumentAddress added in v0.155.0

func (self *Agent) TaxDocumentAddress(ctx context.Context, agentRow *models.Agent, owner *models.User, isRenewed bool) (string, error)

TaxDocumentAddress is the address paystubs and W-2s are mailed to: the local part of the person's first mailbox address, a plus, taxes- and the token, at that address's domain, the token made the first time. Empty when the person has no mailbox with an address. A new token in the old one's place when isRenewed, which ends the old address at once.

func (*Agent) TaxYear added in v0.155.0

func (self *Agent) TaxYear(ctx context.Context, agentRow *models.Agent, taxYear int, filingStatus finance.TaxFilingStatus) (*finance.TaxYearSummary, error)

TaxYear puts a tax year together from every paystub paid in it and every tax form for it, its tax estimated as filed with filingStatus, else the filing status the person keeps, else as the number of people suggests.

func (*Agent) TellGoal added in v0.111.0

func (self *Agent) TellGoal(tx db.Transaction, agent *models.Agent, conversationId, text string) (*models.AgentConversation, error)

TellGoal passes what the person said to one of their goals: written into the goal's conversation as their words, carried over from where they said them, and the goal back at work a minute later. A goal that was met or dropped is not started again by this; the person does that.

func (*Agent) Tick

func (self *Agent) Tick(ctx context.Context) error

Tick releases stale claims, claims what is due, and runs it. The worker calls it on its interval; a test calls it by hand.

func (*Agent) TickAt

func (self *Agent) TickAt(ctx context.Context, now time.Time) error

TickAt is Tick as of a moment, for a test that cannot wait for a hold to end.

func (*Agent) ToolRisks added in v0.76.0

func (self *Agent) ToolRisks(ctx context.Context, agent *models.Agent, owner *models.User) (map[string]tools.Risk, error)

ToolRisks is the person's tools, by name, with what each can do: what an idea may promise.

func (*Agent) UnmatchReceipt added in v0.118.0

func (self *Agent) UnmatchReceipt(ctx context.Context, agentRow *models.Agent, receiptId, financeTransactionId string) (*models.FinanceReceipt, error)

UnmatchReceipt takes a receipt off a finance transaction, whoever matched them, and leaves the receipt to the person: a later sync never matches it on its own again. db.ErrNotFound when they were not matched.

func (*Agent) UpdateTab

func (self *Agent) UpdateTab(agentId, title, url string)

UpdateTab is the tab saying where it went.

func (*Agent) Wait

func (self *Agent) Wait()

Wait blocks until every run in flight has finished. For tests and for Stop.

func (*Agent) WaitHerdrSession added in v0.120.0

func (self *Agent) WaitHerdrSession(ctx context.Context, agentId, computerName, paneId string, waitSeconds int) (*HerdrWait, error)

WaitHerdrSession waits for a session to stop working, waitSeconds at most.

func (*Agent) WakeRecordingSpeakerCuration added in v0.144.0

func (self *Agent) WakeRecordingSpeakerCuration(userId, recordingId string)

WakeRecordingSpeakerCuration coalesces bounded local work after a committed confirmation. Persistent generation markers let the periodic worker recover missed wakeups.

func (*Agent) WatchHerdrSession added in v0.120.0

func (self *Agent) WatchHerdrSession(ctx context.Context, agentId, computerName, paneId string, origin tools.BackgroundOrigin) (*HerdrSession, error)

WatchHerdrSession has a conversation woken when a session next finishes.

type AlertCovered added in v0.82.0

type AlertCovered struct {
	MailID        string `json:"mailId"`
	Subject       string `json:"subject"`
	FromAddress   string `json:"fromAddress"`
	CandidateKind string `json:"candidateKind"`
	// MailCategory is what the sorting called the message, when it did.
	MailCategory string `json:"mailCategory"`
}

AlertCovered is one message an alert was about, as the person is shown it beside the alert.

type AlertDecided added in v0.82.0

type AlertDecided struct {
	SubjectKey   string   `json:"subject_key"`
	IsUrgent     bool     `json:"is_urgent"`
	CandidateIDs []string `json:"candidate_ids"`
	AlertText    string   `json:"alert_text"`
	HasChanged   bool     `json:"has_changed"`
	ChangeReason string   `json:"change_reason"`
}

AlertDecided is one alert the model would send.

type AlertDecision added in v0.82.0

type AlertDecision struct {
	Alerts  []AlertDecided `json:"alerts"`
	Dropped []AlertDropped `json:"dropped"`
}

AlertDecision is the JSON the model is asked for.

type AlertDropped added in v0.82.0

type AlertDropped struct {
	CandidateID string `json:"candidate_id"`
	DropReason  string `json:"drop_reason"`
}

AlertDropped is a candidate the model would not tell, and why.

type AlertInput added in v0.82.0

type AlertInput struct {
	Owner        *models.User
	Language     string
	Now          time.Time
	Memories     []string
	Pages        []string
	RecentAlerts []*models.AgentAlert
	Candidates   []*labeledCandidate
}

AlertInput is everything the decision's prompt is built from, so it can be rendered and tested without a database.

type AlertMuteChoice added in v0.82.0

type AlertMuteChoice struct {
	MuteScope  models.AlertMuteScope `json:"muteScope"`
	MuteTarget string                `json:"muteTarget"`
}

AlertMuteChoice is one way to mute an alert: the scope, and what it would mute, several joined by commas.

type AlertView added in v0.82.0

type AlertView struct {
	ID         string          `json:"id"`
	AlertText  string          `json:"alertText"`
	SentAt     time.Time       `json:"sentAt"`
	SubjectKey string          `json:"subjectKey"`
	IsUrgent   bool            `json:"isUrgent"`
	Covered    []*AlertCovered `json:"covered"`

	// MuteChoices is what a Mute of the alert offers, the default first.
	MuteChoices []*AlertMuteChoice `json:"muteChoices"`
}

AlertView is an alert as the person reads it back: what was said, when, and what it was about.

func ListAlertViews added in v0.82.0

func ListAlertViews(tx db.Transaction, agentId string, limit int) ([]*AlertView, error)

ListAlertViews is the agent's latest alerts, newest first, each with the messages it covered.

type AnswerEvaluation added in v0.60.0

type AnswerEvaluation struct {
	AnswerText    string
	AnswerVerdict string
	VerdictReason string

	// FactCount and PassageCount are what the answer was given.
	FactCount    int
	PassageCount int

	// What the answer and its grading cost, together, and how long the
	// answer took, which is what a person waits for; the grading is not.
	Cost             float64
	AnswerDurationMS int64
}

AnswerEvaluation is one question answered and graded.

type AskRun

type AskRun struct {
	ID string
	// contains filtered or unexported fields
}

AskRun is one turn in flight.

func (*AskRun) Agent

func (self *AskRun) Agent() *models.Agent

func (*AskRun) Answer

func (self *AskRun) Answer(callId, answer string) bool

Answer answers a question card. It says whether there was one.

func (*AskRun) AnswerLocation added in v0.125.0

func (self *AskRun) AnswerLocation(callId, said string) bool

AnswerLocation is the browser's answer to a location call, as LocationAnswer's JSON. It says whether a call was waiting for it. A message handed to a running turn follows that turn's events under its own id, so its answer goes on to the turn that asked.

func (*AskRun) Ask

func (self *AskRun) Ask(ctx context.Context, callId, question string, choices []string) (string, error)

Ask shows the question card and waits for the person's words.

func (*AskRun) AttachedComputers

func (self *AskRun) AttachedComputers() []tools.Computer

func (*AskRun) AttachedTab

func (self *AskRun) AttachedTab() tools.Tab

func (*AskRun) BrowserPage

func (self *AskRun) BrowserPage(ctx context.Context) (*browser.Context, error)

func (*AskRun) CanAsk added in v0.61.3

func (self *AskRun) CanAsk() bool

func (*AskRun) CanShowPages added in v0.132.0

func (self *AskRun) CanShowPages() bool

CanShowPages says this turn's surface is the dashboard's own drawer (tools.Showing), by the same entry that decides whether a DashboardOnly tool is offered.

func (*AskRun) CodingMemory added in v0.124.0

func (self *AskRun) CodingMemory(ctx context.Context, directory, computerName, prompt string) (string, error)

CodingMemory is tools.CodingRemembering for a turn.

func (*AskRun) ComputersAllowed

func (self *AskRun) ComputersAllowed() bool

func (*AskRun) Configuration

func (self *AskRun) Configuration() *config.Configuration

func (*AskRun) Conversation

func (self *AskRun) Conversation() *models.AgentConversation

Conversation is the conversation the run belongs to.

func (*AskRun) Database

func (self *AskRun) Database() db.Database

func (*AskRun) DiscardDraft

func (self *AskRun) DiscardDraft(ctx context.Context, tx db.Transaction, itemId string) error

func (*AskRun) DraftReply

func (self *AskRun) DraftReply(ctx context.Context, request *models.AgentDraftRequest) (*models.AgentDraft, error)

func (*AskRun) Enqueue

func (self *AskRun) Enqueue(tx db.Transaction, kind models.AgentJobKind, mailboxId, subjectId string) error

func (*AskRun) GuardRecordingEvidence added in v0.144.4

func (self *AskRun) GuardRecordingEvidence() bool

GuardRecordingEvidence enables trusted provenance checks only inside a dream's turns.

func (*AskRun) Headless

func (self *AskRun) Headless() bool

func (*AskRun) IsLinkInPlaceOfPath added in v0.74.0

func (self *AskRun) IsLinkInPlaceOfPath() bool

IsLinkInPlaceOfPath is false: the dashboard shows a file by its path with the person's session, and a link is for when they ask for one.

func (*AskRun) Load

func (self *AskRun) Load(name string)

func (*AskRun) Loaded

func (self *AskRun) Loaded() map[string]bool

Loaded and Load are under the run's lock, and Loaded is a copy: a round's reads run together, and two tool_search calls among them load at once.

func (*AskRun) Locate added in v0.125.0

func (self *AskRun) Locate(ctx context.Context, callId string) (*tools.BrowserLocation, error)

Locate asks the browser the person is writing in where it is (tools.Locating): the drawer that sent the turn answers the event with AnswerLocation. A turn not written in the dashboard in a browser has none to ask, and says so; the tool is not offered there (BrowserOnly), and a subagent's turn is not one.

func (*AskRun) MeaningSearch

func (self *AskRun) MeaningSearch(ctx context.Context, mailboxId, query string, limit int) ([]string, error)

func (*AskRun) NoteFact

func (self *AskRun) NoteFact(ctx context.Context, fact *models.AgentFact) []*models.AgentFact

func (*AskRun) NoteNode

func (self *AskRun) NoteNode(ctx context.Context, node *models.AgentNode)

func (*AskRun) ObserveRecordingEvidence added in v0.144.4

func (self *AskRun) ObserveRecordingEvidence()

ObserveRecordingEvidence is called only for trusted, owned recording provenance.

func (*AskRun) Offered

func (self *AskRun) Offered() []*tools.Tool

func (*AskRun) Operations

func (self *AskRun) Operations() tools.Operations

func (*AskRun) Owner

func (self *AskRun) Owner() *models.User

Owner is the person.

func (*AskRun) PreparePage added in v0.48.0

func (self *AskRun) PreparePage(ctx context.Context, path string, kind models.AgentNodeKind, name string) tools.PreparedPage

func (*AskRun) Queued

func (self *AskRun) Queued() bool

Queued says whether the run is still waiting for the turn before it.

func (*AskRun) RankChunksByMeaning

func (self *AskRun) RankChunksByMeaning(ctx context.Context, words string, chunks []*models.AgentChunk, limit int) []*models.AgentChunk

RankChunksByMeaning puts a set the words found into the order the meaning wants. What a deployment with no vector index does instead of a vector search: it finds everything the words find, in a better order, and misses a paraphrase that shares no word with the question.

func (*AskRun) ReadOnly

func (self *AskRun) ReadOnly() bool

func (*AskRun) Recall

func (self *AskRun) Recall(line string)

Recall keeps what a memory search found, for the overlay.

func (*AskRun) Recalled

func (self *AskRun) Recalled() []string

func (*AskRun) ReconnectedTab added in v0.121.1

func (self *AskRun) ReconnectedTab(ctx context.Context, dropped tools.Tab, wait time.Duration) tools.Tab

func (*AskRun) RegisterLiveActivity added in v0.131.0

func (self *AskRun) RegisterLiveActivity(pushRegistration string) error

RegisterLiveActivity has the run push its state to a Live Activity, from now on and at once.

func (*AskRun) Resolve

func (self *AskRun) Resolve(callId string, approve bool) bool

Resolve answers a confirmation card. It says whether there was one.

func (*AskRun) ResultCharacters added in v0.106.1

func (self *AskRun) ResultCharacters() int

ResultCharacters is how much of a tool's result this run keeps, for a tool that fits a page to it.

func (*AskRun) SearchGraphByMeaning

func (self *AskRun) SearchGraphByMeaning(ctx context.Context, words string, limit int) ([]*models.AgentNode, []*models.AgentFact)

SearchGraphByMeaning is what the memory tool's search adds to its own word search. Part of tools.GraphSearching.

func (*AskRun) SearchKnowledgeByMeaning

func (self *AskRun) SearchKnowledgeByMeaning(ctx context.Context, sourceIds []string, documentPrefix string, words string, limit int) ([]*models.AgentChunk, bool)

SearchKnowledgeByMeaning is the passages nearest some words, and whether the database ranked them itself.

Part of tools.KnowledgeSearching. False means this deployment has no vector index, and the caller should fall back to re-ranking what the words found: reading half a million vectors into memory to sort them is not a search.

func (self *AskRun) SharedLink(attachmentId string) string

SharedLink is an address that opens one file with no sign-in, on the dashboard the turn came through (tools.Linking), for a person who asked for a link to open elsewhere; empty when the turn did not come through the dashboard.

func (*AskRun) ShowPage added in v0.84.0

func (self *AskRun) ShowPage(path string)

ShowPage has the drawer that is following this turn move the dashboard to a page of it (tools.Showing).

func (*AskRun) SteeredInto added in v0.71.5

func (self *AskRun) SteeredInto() *AskRun

SteeredInto is the running turn this message was handed to, or nil when it is a turn of its own.

func (*AskRun) Stop

func (self *AskRun) Stop()

Stop ends the run; the turn stays where it got to.

func (*AskRun) StopByPerson added in v0.61.4

func (self *AskRun) StopByPerson()

StopByPerson ends the run because the person asked, closing the cards it was waiting on.

func (*AskRun) Storage

func (self *AskRun) Storage() storage.Storage

func (*AskRun) Subscribe

func (self *AskRun) Subscribe() (<-chan Event, func())

Subscribe replays what happened so far and then follows the run. The channel closes when the run is over.

func (*AskRun) Surface

func (self *AskRun) Surface() string

func (*AskRun) TabsAllowed

func (self *AskRun) TabsAllowed() bool

func (*AskRun) TellReaction added in v0.134.0

func (self *AskRun) TellReaction(conversationId, messageId, reactionEmoji string, reactorKind models.AgentReactorKind)

TellReaction is PublishReaction for a tool, which reaches the agent through the run it is called in (tools.ReactionTelling).

func (*AskRun) Usage

func (self *AskRun) Usage() llm.Usage

Usage is what the turn has spent so far, every round added up.

type AskSettings

type AskSettings struct {
	Agent      *models.Agent
	Owner      *models.User
	Operations Operations

	// Conversation is where the turn goes; the caller made or found it.
	Conversation *models.AgentConversation

	// Message is what the person said.
	Message string

	// Viewing is what they have open, when the drawer knows.
	Viewing *Viewing

	// InterruptedAnswer is how much of the agent's spoken answer the
	// person heard before they talked over it, when they did.
	InterruptedAnswer *InterruptedAnswer

	// Attachments are the files that came with the message, uploaded
	// already; References the threads the person pointed at.
	Attachments []*models.AgentAttachment
	References  []models.AgentReference

	// Pictures are images the caller puts in the turn itself rather than
	// files of the person's: a night looking at an attachment whose bytes
	// it fetched out of the store. They are shown to the model as the
	// same image parts a person's own picture is, and they belong to this
	// turn alone -- nothing stores them, so a later round names nothing.
	Pictures []llm.ContentPart

	// Surface is where the answer goes: drawer, phone, cli, api or mail.
	Surface string

	// DrawerID names the open drawer that sent the turn: the browser a
	// location call asks, rather than any other the person has open. Empty
	// for a turn no drawer sent, such as one begun after a card was
	// approved.
	DrawerID string

	// Origin is the address the dashboard was reached at, scheme and host,
	// for a link to a file that has to open somewhere else; empty where the
	// turn did not come through it.
	Origin string

	// ReadOnly leaves out every tool that changes anything, for a
	// read-only credential.
	ReadOnly bool

	// ReadOnlyTools names the tools this turn may only look with, while
	// the rest of its kit acts as usual. Each call to one of them is
	// judged as it is made, so a tool whose actions differ -- memory,
	// which both reads a page and rewrites one -- keeps the half that
	// reads instead of going altogether.
	//
	// The night is what this is for: it has the person's whole kit, and
	// its changes to the graph are still said in the object it ends with
	// so that code files them with their evidence. That was enforced by
	// the whole turn being read-only until the turn stopped being
	// read-only, and a rule the frame merely asks for is a rule only
	// until a model reads the memory tool's description and takes it at
	// its word.
	ReadOnlyTools map[string]bool

	// Allow, when set, is the only tools offered by name; Headless adds
	// the remote tools marked for runs with nobody present. MaxRounds
	// overrides the limit; UsageKind names the usage rows.
	Allow     map[string]bool
	Headless  bool
	MaxRounds int

	// PreApproved is the calls the person approved on a card whose turn
	// had ended, by tool name and arguments: this turn may make each once
	// without asking again. See interaction.go.
	PreApproved map[string]bool

	// CanAsk says that a turn nobody typed may still put a question card
	// to the person: they have the dashboard open, and the turn is the
	// agent starting a conversation with them. Everything else about a
	// headless turn stands; only ask_user and confirmations may wait for
	// them.
	CanAsk    bool
	UsageKind string

	// Effort is how hard the model thinks before each round: "low",
	// "medium" or "high", or empty for the provider's default, which for
	// a newer model with tools is no reasoning at all.
	Effort string

	// Research gives the turn a procedure for answering a question about
	// the person's own work: search more than once and everywhere, read
	// the whole thread, prefer what their people wrote over what is
	// generally true, and say where the sources do not answer.
	Research bool

	// Work is the kind of work this turn is, which chooses the model: a
	// dream runs on the operator's scan model, sorting on the triage one.
	// Empty means the person's own choice, or the ask model, which is
	// what a turn somebody typed gets.
	Work config.AgentWork

	// Model, when set, is the model this headless turn runs on, by its
	// "provider:model" name, and wins over Work: for work whose model is
	// a setting of its own that no kind of work names, such as the chat
	// model the categorize model falls back to.
	Model string

	// ReadThenAnswer is a run that looks things up and then answers once:
	// a dream reading a batch, an ingest describing a checkout. Its
	// history is never compacted, because a compaction note would stand
	// in for the very documents it was given to read; when the history
	// fills, the run is told to answer now instead. ResultCharacters
	// bounds each lookup's answer for such a run, so a long page does not
	// fill the window by itself; zero means the usual bound.
	ReadThenAnswer   bool
	ResultCharacters int

	// Short asks for the one-paragraph conduct rather than the full rules.
	// A run with nobody present and six tools does not need the page about
	// how to talk to somebody, and sorting runs on every message that
	// arrives, so what the prompt costs is what sorting costs.
	Short bool
	// contains filtered or unexported fields
}

AskSettings is one turn of a conversation.

type AttachedComputer

type AttachedComputer struct {
	Name        string
	System      string
	Description string
	Since       time.Time
}

AttachedComputer is one attached computer of a person, for the API.

type BackgroundCommand added in v0.57.0

type BackgroundCommand struct {
	Computer string
	*computer.BackgroundStatus
	Origin tools.BackgroundOrigin
}

BackgroundCommand is one background command on one of a person's computers, for the API.

type Budget

type Budget struct {
	Used     int64
	Limit    int64 // 0 = unlimited
	ResetsAt time.Time

	// ServerUsed and ServerLimit are the monthly cap for the whole server.
	ServerUsed  int64
	ServerLimit int64

	// Cost and CostLimit are the same day said in money, at the prices
	// the providers are configured with; ServerCost and ServerCostLimit
	// the same for the month and the whole server. Currency is what the
	// operator says those prices are in, for whoever shows them.
	Cost            float64
	CostLimit       float64
	ServerCost      float64
	ServerCostLimit float64
	Currency        string
}

Budget is what a person may still spend today, and when the day turns. A budget can be said in tokens, in money, or in both; where both are set, whichever runs out first stops the day.

func CheckBudget

func CheckBudget(tx db.Transaction, configuration *config.Configuration, agent *models.Agent, owner *models.User, now time.Time) (*Budget, error)

CheckBudget reads today's spend for a person against their limit, and the month's against the server's. "Today" is midnight to midnight in the person's own zone, which is when the panel says it resets.

func (*Budget) Exhausted

func (self *Budget) Exhausted() bool

Exhausted says whether the next call should wait.

func (*Budget) NearlySpent

func (self *Budget) NearlySpent() string

NearlySpent is a line about the budget for the model, once four fifths of whichever cap binds first is gone, and "" while there is room. Money and tokens are said the way they are counted.

type BudgetMonthPhase added in v0.104.0

type BudgetMonthPhase string

BudgetMonthPhase is where one month of a year stands on the day a year's budgets are computed for.

const (
	BudgetMonthPhaseOver       BudgetMonthPhase = "over"
	BudgetMonthPhaseInProgress BudgetMonthPhase = "in_progress"
	BudgetMonthPhaseToCome     BudgetMonthPhase = "to_come"
)

The three phases: the month is over, it is the month in progress, or it has not begun.

type Call

type Call = tools.Call

type Catalog

type Catalog = tools.Catalog

func FullCatalog

func FullCatalog() *Catalog

FullCatalog is every tool the agent can be given, before permissions and policy narrow it: what the worker runs with, and what the operator's tool policy lists.

type CodingContext added in v0.124.0

type CodingContext struct {
	// ProjectPath is the page of the checkout the session runs in, and
	// CheckoutDirectory where that checkout is; both empty where the
	// directory is in no checkout memory knows.
	ProjectPath       string
	CheckoutDirectory string

	// ReadFrom says where and at which commit memory read the project,
	// where that is not the session's own checkout as it stands: another
	// computer's copy of the repository, or this one at an older commit.
	// Empty where they are the same, or where the session's commit is not
	// known.
	ReadFrom string

	// Pages are the pages shown and the facts shown from each.
	Pages []*RecalledPage

	// Lessons are the lessons shown, a line each.
	Lessons []string

	// LastSession is the previous session in the directory, at session
	// start only.
	LastSession *CodingSession

	// ShownPaths is every page shown, for the session to skip next time.
	ShownPaths []string

	// Text is all of it as the session reads it, wrapped in
	// CodingMemoryTag; empty where there is nothing to show.
	Text string
}

CodingContext is what a coding session is shown.

type CodingRequest added in v0.124.0

type CodingRequest struct {
	// Directory is the session's working directory, absolute, on the
	// computer ComputerName; HomeDirectory is that computer's home
	// directory, which a checkout recorded with a leading ~ is under.
	Directory     string
	ComputerName  string
	HomeDirectory string

	// SessionID is the coding tool's own id for the session, so that the
	// session being resumed is not reported as the one before it.
	SessionID string

	// RemoteURLs, Head and CheckoutRoot are what git says about the
	// checkout the session runs in, where it is one: where it is pushed,
	// the commit it is at, and its top directory. A checkout on another
	// computer is the same project only when it is the same repository,
	// whatever its path, and memory read at another commit may not say
	// what is here.
	RemoteURLs   []string
	Head         string
	CheckoutRoot string

	// Prompt is what the person typed, for a prompt's recall.
	Prompt string

	// ShownPaths are pages the session was shown in its last few
	// prompts, which are not shown again.
	ShownPaths []string

	// IsEverywhere recalls from the whole graph instead of the checkout's
	// project and what it links to.
	IsEverywhere bool
}

CodingRequest is where a coding session is and what it asks.

type CodingSession added in v0.124.0

type CodingSession struct {
	Title        string
	Assistant    string
	LastActiveAt time.Time
	Requests     []string
	LastAnswer   string
}

CodingSession is a previous session in a directory: what it was called, when it was last active, and how it ended.

type ComputerIdentity added in v0.50.0

type ComputerIdentity struct {
	Name   string
	System string
	Home   string

	// Description is the person's sentence about what the computer is for,
	// which the agent reads to choose between several; empty when they gave
	// none.
	Description string

	// Terminal is the session of the terminal the person attached it from,
	// when they did.
	Terminal string

	// Features are what the program offers beyond its protocol, such as
	// background commands.
	Features []string
}

ComputerIdentity is what a computer says about itself when it attaches.

type ConductData

type ConductData struct {
	AgentName         string
	PersonName        string
	ServerName        string
	Language          string
	Short             bool
	HouseInstructions string
	Instructions      string
	Voice             string
}

ConductData is what the conduct is rendered with.

type Deferral

type Deferral struct {
	Until  time.Time
	Reason string
}

Deferral is what a handler returns when a run must wait — for a budget, for a hold window — rather than fail.

func (*Deferral) Error

func (self *Deferral) Error() string

type DeviceConnection

type DeviceConnection interface {
	Send(message []byte) error
}

DeviceConnection is what the relay needs of a device's websocket.

type DraftInput

type DraftInput struct {
	Configuration *config.Configuration
	Agent         *models.Agent
	Owner         *models.User
	Mailbox       *models.Mailbox
	Source        *models.AgentMailbox
	Subject       string
	Instructions  string

	// Message is the one being answered; Earlier are the ones before it,
	// oldest first, as many as fit.
	Message *MessageContext
	Earlier []*MessageContext

	// Summary and Notes are what the agent already worked out about the
	// conversation and the message, when it has.
	Summary  string
	Notes    string
	Memories []string

	// Corrections are the replies this agent wrote that the person would
	// not let go: cancelled, or rewritten before they went. Shown as
	// examples of what not to write again.
	Corrections []string

	// Exemplars are the person's own past messages nearest in meaning to
	// this one: how they actually write to somebody about something like
	// this. Empty unless they have pointed the agent at their sent mail.
	//
	// Their own words rather than a description of them. A voice
	// described in fields says "friendly, brief"; five of their own
	// replies say how they open, how much they explain, and whether they
	// sign off at all.
	Exemplars []string
}

DraftInput is everything the draft prompt is built from.

type Event

type Event struct {
	Kind           EventKind `json:"kind"`
	RunID          string    `json:"runId"`
	ConversationID string    `json:"conversationId"`
	Sequence       int       `json:"sequence"`
	Text           string    `json:"text,omitempty"`
	Tool           string    `json:"tool,omitempty"`
	CallID         string    `json:"callId,omitempty"`
	Arguments      string    `json:"arguments,omitempty"`
	Risk           string    `json:"risk,omitempty"`
	Note           string    `json:"note,omitempty"`
	// NoteKind and NoteDetail are a note's kind and detail, for a client
	// that words it in the person's language; Note is it in English.
	NoteKind   string `json:"noteKind,omitempty"`
	NoteDetail string `json:"noteDetail,omitempty"`
	Error      string `json:"error,omitempty"`
	// DrawerID is, on a locate event, the drawer that is to answer it
	// (AskSettings.DrawerID).
	DrawerID string `json:"drawerId,omitempty"`
	// MessageID, Emoji and ReactorKind are, on a reacted event, the
	// message, the emoji now on it from that reactor, empty when the
	// reaction was taken away, and who reacted: person or agent.
	MessageID   string    `json:"messageId,omitempty"`
	Emoji       string    `json:"emoji,omitempty"`
	ReactorKind string    `json:"reactorKind,omitempty"`
	At          time.Time `json:"at"`
}

Event is one thing that happened in a run.

type EventKind

type EventKind string

EventKind is what an event of a run carries.

const (
	EventAsked        EventKind = "asked"        // a turn began: what the person said, and where from
	EventText         EventKind = "text"         // a piece of the answer
	EventMessage      EventKind = "message"      // the whole answer, once it is
	EventToolCall     EventKind = "tool_call"    // the model asked for a tool
	EventToolResult   EventKind = "tool_result"  // the tool answered
	EventConfirmation EventKind = "confirmation" // waiting for the person
	EventQuestion     EventKind = "question"     // the agent asked something
	EventNote         EventKind = "note"         // compaction and the like
	EventTitled       EventKind = "titled"       // the conversation was given a title: Text
	EventNavigate     EventKind = "navigate"     // the dashboard is to show a page of itself: Text is its path
	EventLocate       EventKind = "locate"       // the browser the person writes in is asked where it is: CallID
	EventReacted      EventKind = "reacted"      // a reaction on a message changed: MessageID, Emoji (empty is taken away), ReactorKind
	EventDone         EventKind = "done"
	EventError        EventKind = "error"
)

The events a run emits, in the order a drawer shows them.

type ExtractAnswer

type ExtractAnswer struct {
	Events   []ExtractedEvent   `json:"events"`
	Contacts []ExtractedContact `json:"contacts"`
}

ExtractAnswer is the object the run answers with.

type ExtractedContact

type ExtractedContact struct {
	Name         string   `json:"name"`
	Organization string   `json:"organization"`
	Title        string   `json:"title"`
	Emails       []string `json:"emails"`
	Phones       []string `json:"phones"`
	Note         string   `json:"note"`
	ContactID    string   `json:"contact_id"`
	Because      string   `json:"because"`
}

ExtractedContact is somebody the words describe, usually a signature.

type ExtractedEvent

type ExtractedEvent struct {
	Summary  string `json:"summary"`
	Starts   string `json:"starts"`
	Ends     string `json:"ends"`
	Location string `json:"location"`
	AllDay   bool   `json:"all_day"`
	Because  string `json:"because"`
}

ExtractedEvent is an appointment the words describe.

type Family

type Family = tools.Family

type Handler

type Handler func(ctx context.Context, run *Run) error

Handler runs one kind of job. It returns nil when the job is done, a Deferral to wait for a budget, or an error to retry.

type HerdrAnswer added in v0.120.0

type HerdrAnswer struct {
	ComputerName string
	*computer.HerdrAnswerResult
}

HerdrAnswer says whether a question took its answer.

type HerdrClose added in v0.120.0

type HerdrClose struct {
	ComputerName string
	*computer.HerdrCloseResult
}

HerdrClose says a session's pane was closed.

type HerdrRead added in v0.120.0

type HerdrRead struct {
	ComputerName string
	*computer.HerdrReadResult
}

HerdrRead is a session's last turns.

type HerdrScreen added in v0.120.0

type HerdrScreen struct {
	ComputerName string
	*computer.HerdrScreenResult
}

HerdrScreen is a session's screen.

type HerdrSent added in v0.164.0

type HerdrSent struct {
	HerdrSession
	FilePaths []string
}

HerdrSent is a session once something was sent to it, and where the files sent with it were written.

type HerdrSession added in v0.120.0

type HerdrSession struct {
	ComputerName string
	*computer.HerdrSession
}

HerdrSession is one coding session on one of a person's computers.

type HerdrSetup added in v0.120.0

type HerdrSetup struct {
	ComputerName string
	*computer.HerdrSetupResult
}

HerdrSetup says what setting up the hooks did, on which computer.

type HerdrWait added in v0.120.0

type HerdrWait struct {
	ComputerName string
	*computer.HerdrWaitResult
}

HerdrWait is a session once it stopped working, or when the wait ran out.

type IdeaProposal added in v0.78.3

type IdeaProposal struct {
	IdeaCategory     string                     `json:"idea_category"`
	Emoji            string                     `json:"emoji"`
	Headline         string                     `json:"headline"`
	Body             string                     `json:"body"`
	OpeningRequest   string                     `json:"opening_request"`
	NeededToolNames  []string                   `json:"needed_tool_names"`
	Evidence         []models.AgentIdeaEvidence `json:"evidence"`
	SuggestionReason string                     `json:"suggestion_reason"`
	// ExpiresOn is the day it stops mattering, as 2006-01-02; two weeks
	// from now when left out.
	ExpiresOn string `json:"expires_on"`
}

IdeaProposal is a personal idea as whoever proposes it words it: the `idea` tool's propose action through ProposeAgentIdea, and a dream that ends with its ideas in an object. The JSON names are the tool's own parameter names, which is what the dream's prompt asks the object for.

func (*IdeaProposal) Idea added in v0.78.3

func (self *IdeaProposal) Idea(now time.Time) (*models.AgentIdea, error)

Idea is the proposal as the idea ProposeIdea checks and keeps, or why the day it stops mattering cannot be read.

type IncomeCategoryMonthInput added in v0.98.0

type IncomeCategoryMonthInput struct {
	// BudgetAmount is the income expected in the whole month, and
	// IncomeAmount what has come in so far.
	BudgetAmount *big.Rat
	IncomeAmount *big.Rat

	// DayOfMonth is today, from one; DaysInMonth how many days the month
	// has; IsMonthOver says today is past the month's last day.
	DayOfMonth  int
	DaysInMonth int
	IsMonthOver bool
}

IncomeCategoryMonthInput is what ProjectIncomeCategoryMonth reads, every amount already in the budget's currency.

type IncomeCategoryMonthProjection added in v0.98.0

type IncomeCategoryMonthProjection struct {
	ExpectedByTodayAmount *big.Rat
	ProjectedAmount       *big.Rat
	IncomePace            models.IncomePace
}

IncomeCategoryMonthProjection is where an income spending category's month is heading.

func ProjectIncomeCategoryMonth added in v0.98.0

func ProjectIncomeCategoryMonth(input *IncomeCategoryMonthInput) *IncomeCategoryMonthProjection

ProjectIncomeCategoryMonth projects an income spending category's month end and names its pace. Income comes in a few large amounts (a salary on one day, a payment on another), so the straight line spending is projected with would read a month before its pay day as heading for nothing. The projection is the expected income instead, or what came in when that is more already; a month that is over ends at what came in.

The pace compares what came in with the expected income spread evenly over the month up to today: behind after the first week (or in a month that is over) when less than ninety percent of that came in; ahead when more than the whole month's expected income, by over ten percent, came in; on_track otherwise.

type IncomeCategoryYearInput added in v0.104.0

type IncomeCategoryYearInput struct {
	Months     []*IncomeCategoryYearMonth
	IsYearOver bool
}

IncomeCategoryYearInput is what ProjectIncomeCategoryYear reads.

type IncomeCategoryYearMonth added in v0.104.0

type IncomeCategoryYearMonth struct {
	BudgetMonthPhase BudgetMonthPhase

	// BudgetAmount is the income expected that month.
	BudgetAmount *big.Rat

	// IncomeAmount is what came in, so far for the month in progress; nil
	// for a month to come.
	IncomeAmount *big.Rat

	// ProjectedAmount and ExpectedByTodayAmount are the month in
	// progress's (ProjectIncomeCategoryMonth), and DayOfMonth is its
	// today, from one; ignored for the other phases.
	ProjectedAmount       *big.Rat
	ExpectedByTodayAmount *big.Rat
	DayOfMonth            int
}

IncomeCategoryYearMonth is one month of a year in which an income spending category had a budget, every amount in the year's currency.

type IncomeCategoryYearProjection added in v0.104.0

type IncomeCategoryYearProjection struct {
	BudgetAmount          *big.Rat
	IncomeAmount          *big.Rat
	ExpectedByTodayAmount *big.Rat
	ProjectedAmount       *big.Rat
	BudgetedMonthCount    int
	IncomePace            models.IncomePace
}

IncomeCategoryYearProjection is where an income spending category's year is heading against the income expected in its months.

func ProjectIncomeCategoryYear added in v0.104.0

func ProjectIncomeCategoryYear(input *IncomeCategoryYearInput) *IncomeCategoryYearProjection

ProjectIncomeCategoryYear adds up an income spending category's budgeted months the way ProjectIncomeCategoryMonth does one: a month that is over ends at what came in, the month in progress at its projection, and a month to come at the income expected of it. The income expected by today is the months that are over whole and the month in progress's share by its days.

The pace is a month's over the year: ahead once more than the whole year's expected income, by over ten percent, came in; behind, after the first week of the first budgeted month to begin, when less than ninety percent of what was expected by today came in; on_track otherwise.

type InterruptedAnswer added in v0.115.0

type InterruptedAnswer struct {
	HeardText   string `json:"heardText"`
	UnheardText string `json:"unheardText"`
}

InterruptedAnswer is a spoken answer the person cut in on: what had been played to them, and the rest, which was written but not heard.

type JudgedPlan added in v0.93.0

type JudgedPlan struct {
	Depth  string
	Reason string
	Plan   *RetrievalPlan

	// Cost is what the judgement cost, in the configured currency.
	Cost float64
}

JudgedPlan is what the depth judgement said of a question judged on its own: how deep it deserves, why, and the retrieval plan a live turn would follow for it.

type LocationAnswer added in v0.125.0

type LocationAnswer struct {
	LatitudeDegrees  float64   `json:"latitudeDegrees"`
	LongitudeDegrees float64   `json:"longitudeDegrees"`
	AccuracyMeters   float64   `json:"accuracyMeters"`
	MeasuredAt       time.Time `json:"measuredAt"`
	ErrorMessage     string    `json:"errorMessage,omitempty"`
}

LocationAnswer is what the browser says to a location call: where it is, or, in ErrorMessage, why it cannot say.

type MessageContext

type MessageContext struct {
	MailID      string
	From        string
	To          string
	Cc          string
	Date        string
	Subject     string
	ListKey     string
	Attachments []string
	Text        string
	Truncated   bool

	// Facts the server already established, in a line the model can use:
	// authentication results, whether the sender is a contact, whether a
	// filter flagged it.
	Facts []string
}

MessageContext is one message, reduced.

func BuildMessageContext

func BuildMessageContext(ctx context.Context, store storage.Storage, mail *models.Mail, maximumCharacters int, includeQuoted bool) (*MessageContext, error)

BuildMessageContext reads a stored message and reduces it.

func (*MessageContext) Render

func (self *MessageContext) Render() string

Render writes the context the way the prompts include it.

type Operations

type Operations = tools.Operations

Operations is the server as the person: every tool that touches the server goes through it, so a tool can do exactly what the person can do and nothing else. It is the API — the same operations the dashboard and the command line call, with the same permissions, validation and audit — handed to the agent by the package that owns them, executed as the person with the audit trail saying the agent did it.

type OperationsFactory

type OperationsFactory func(ctx context.Context, owner *models.User) (Operations, error)

OperationsFactory makes the API as a person, for a run nobody started from a request. The API package provides it.

type OverviewCoverage added in v0.89.0

type OverviewCoverage struct {
	ChildCount                 int `json:"childCount"`
	ChildShownCount            int `json:"childShownCount"`
	ChildWithoutOverviewCount  int `json:"childWithoutOverviewCount"`
	MemberCount                int `json:"memberCount"`
	MemberShownCount           int `json:"memberShownCount"`
	MemberWithoutOverviewCount int `json:"memberWithoutOverviewCount"`
	LinkCount                  int `json:"linkCount"`
	LinkShownCount             int `json:"linkShownCount"`
}

OverviewCoverage is how much of what a page's overview could be written from its prompt shows: of the pages under it, the members of a theme and the pages linked to it, how many there are and how many were shown, the most important and strongest first; and how many of those shown had no overview of their own, so were shown by their opening alone.

type OverviewState added in v0.89.0

type OverviewState struct {
	Coverage OverviewCoverage

	// IsStale says what the overview is written from has changed since it
	// was written, or a rewrite was asked for; the next dream writes it
	// again.
	IsStale bool
}

OverviewState is how a page's overview stands: how much of what it could be written from its prompt shows now, and whether that has changed since it was written. Counted by code, from the graph as it is.

func OverviewStateOf added in v0.89.0

func OverviewStateOf(tx db.Transaction, agentId string, page *models.AgentNode) (*OverviewState, error)

OverviewStateOf reads how a page's overview stands.

type Proposal

type Proposal struct {
	Kind   string `json:"kind"`
	Path   string `json:"path"`
	To     string `json:"to"`
	Reason string `json:"reason"`
}

Proposal is something the night wants the person to decide.

type RecallExplanation added in v0.89.0

type RecallExplanation struct {
	// RetrievalMode is basic or planned, and Plan the plan followed, if
	// any.
	RetrievalMode string         `json:"retrievalMode"`
	Plan          *RetrievalPlan `json:"plan" graphapi:"nullable"`

	// Queries is each query the retrieval ran, in order: the message
	// first, then the planned searches, the hop and the broad weighting.
	Queries []*RecallQuery `json:"queries"`

	// Searches is each list a query produced and how much it found.
	Searches []*RecallSearch `json:"searches"`

	// Pages is every page any query found: the ones fused into the
	// candidates first, by fused rank, then the ones fusion left out.
	Pages []*RecallPageExplanation `json:"pages"`

	// Facts is every fact any query found, in the same order.
	Facts []*RecallFactExplanation `json:"facts"`

	// IsBroadNoteCarried says the turn was told a survey reads the whole
	// area, as a broad question is.
	IsBroadNoteCarried bool `json:"isBroadNoteCarried"`

	// TokenBudget is what the overlay may spend on the graph, and
	// TokensSpent what it did.
	TokenBudget int `json:"tokenBudget"`
	TokensSpent int `json:"tokensSpent"`
	// contains filtered or unexported fields
}

RecallExplanation is how one question's recall went.

type RecallFactExplanation added in v0.89.0

type RecallFactExplanation struct {
	// Reference is the fact as a page cites it, path#number.
	Reference string `json:"reference"`

	FusedRank int           `json:"fusedRank"`
	Ranks     []*RecallRank `json:"ranks"`

	RecallDecision string `json:"recallDecision"`
}

RecallFactExplanation is one fact the searches found and what became of it.

type RecallPageExplanation added in v0.89.0

type RecallPageExplanation struct {
	Path   string `json:"path"`
	NodeID string `json:"nodeId"`

	// FusedRank is the page's place among the candidates once every
	// query's lists were fused, from one; zero where fusion left it out.
	// Ranks is its place in each list that found it.
	FusedRank int           `json:"fusedRank"`
	Ranks     []*RecallRank `json:"ranks"`

	// HitFactCount is how many of the facts the searches found are on it.
	HitFactCount int `json:"hitFactCount"`

	RecallDecision string `json:"recallDecision"`

	// OverviewSectionHeading is the section of the overview carried, and
	// SectionChoice why that one; see the RecallSection values.
	OverviewSectionHeading string `json:"overviewSectionHeading"`
	SectionChoice          string `json:"sectionChoice"`

	// CarriedFactCount is how many facts the page's block carried, and
	// TokenCount what the block cost.
	CarriedFactCount int `json:"carriedFactCount"`
	TokenCount       int `json:"tokenCount"`
}

RecallPageExplanation is one page and what became of it.

type RecallQuery added in v0.93.0

type RecallQuery struct {
	QueryID   string `json:"queryId"`
	QueryKind string `json:"queryKind"`

	// QueryText is the words searched, or for the hop the page followed.
	QueryText string `json:"queryText"`
}

RecallQuery is one query a retrieval ran.

type RecallRank added in v0.93.0

type RecallRank struct {
	QueryID    string `json:"queryId"`
	SearchName string `json:"searchName"`
	Rank       int    `json:"rank"`
}

RecallRank is where a page or fact stood in one list.

type RecallSearch added in v0.89.0

type RecallSearch struct {
	QueryID    string `json:"queryId"`
	SearchName string `json:"searchName"`
	FoundCount int    `json:"foundCount"`
}

RecallSearch is one list a query produced, and how much it found.

type RecalledPage

type RecalledPage struct {
	Path string

	// Summary is the page's opening as the overlay carried it, or empty
	// where it carried none: a page the prompt's index already names.
	Summary string

	// Overview is the section of the page's overview the overlay
	// carried, or empty where it carried none.
	Overview string

	Facts []*models.AgentFact
}

RecalledPage is one page recall would carry and the facts it would carry from it.

type ReceiptPreview added in v0.118.0

type ReceiptPreview struct {
	ReceiptCheckState      models.ReceiptCheckState
	CheckDifferenceAmount  string
	ReceiptMatchCandidates []finance.ReceiptMatchCandidate
	IsReplacing            bool
}

ReceiptPreview is what recording a receipt would do, writing nothing.

type ReceiptRecording added in v0.118.0

type ReceiptRecording struct {
	// IsUnbalancedAccepted records a receipt whose lines do not add up,
	// marked unbalanced; without it such a receipt is refused. Only the
	// person decides it, or the receipt job, which has nobody to ask and
	// leaves the mark for the person to see.
	IsUnbalancedAccepted bool

	// FinanceTransactionID is the charge the receipt was handed in for, a
	// photo uploaded to it say: matched by hand, as the person's, instead
	// of by the matcher.
	FinanceTransactionID string

	// IsRecordedWhenHandMatchRefused records the receipt, unmatched with
	// its candidates, when the match to FinanceTransactionID is refused
	// (other receipts already explain the charge, another currency, money
	// in), saying why in HandMatchRefusalReason. Without it the whole
	// receipt is refused, which is right for a person who can fix the
	// call, and wrong for the receipt job, which would lose the upload's
	// reading for good.
	IsRecordedWhenHandMatchRefused bool
}

ReceiptRecording is how a receipt is recorded.

type RecordedReceipt added in v0.118.0

type RecordedReceipt struct {
	FinanceReceipt         *models.FinanceReceipt
	ReceiptMatchCandidates []finance.ReceiptMatchCandidate
	IsReplaced             bool

	// HandMatchRefusalReason says why the receipt was not matched to the
	// charge the recording named, when IsRecordedWhenHandMatchRefused let
	// it be recorded anyway; "" otherwise.
	HandMatchRefusalReason string

	// DroppedReceiptMatchReasons say, one sentence each, which of the
	// person's matches were taken off because the receipt as read again no
	// longer fits them: a lower total, another currency.
	DroppedReceiptMatchReasons []string
}

RecordedReceipt is what recording a receipt did: the receipt as stored, with its lines and matches; the charges it could explain when the matcher left them for the person; and whether it took the place of the receipt read from the same source before.

type RememberAnswer

type RememberAnswer struct {
	Facts      []RememberedFact `json:"facts"`
	Links      []RememberedLink `json:"links"`
	Supersedes []SupersededFact `json:"supersedes"`
}

RememberAnswer is what the run answers with.

type RememberedFact

type RememberedFact struct {
	Path      string `json:"path"`
	NodeKind  string `json:"node_kind"`
	NodeName  string `json:"node_name"`
	Kind      string `json:"kind"`
	Text      string `json:"text"`
	Happened  string `json:"happened"`
	Quote     string `json:"quote"`
	MessageID string `json:"message_id"`

	// IsAskedToRemember says the person asked for this to be remembered.
	// Such a fact does not count against how many a reading may file,
	// since a list somebody asked to have kept is kept whole.
	IsAskedToRemember bool `json:"is_asked_to_remember"`
}

RememberedFact is one thing the conversation taught.

type RememberedLink struct {
	From     string `json:"from"`
	To       string `json:"to"`
	Relation string `json:"relation"`

	// Note is the sentence that justifies the link, in the words somebody
	// would use to say it, including details the relation alone cannot carry.
	Note string `json:"note"`
}

RememberedLink joins two pages.

type ReplyAnswer

type ReplyAnswer struct {
	Reply  *string `json:"reply"`
	Reason *string `json:"reason"`
}

ReplyAnswer is what the model answers: a reply, or a reason not to.

type Result

type Result = tools.Result

type ResumeSettings added in v0.61.4

type ResumeSettings struct {
	Interaction  *models.AgentInteraction
	Answer       string
	Agent        *models.Agent
	Owner        *models.User
	Operations   Operations
	Conversation *models.AgentConversation
}

ResumeSettings is what a late answer needs to carry on: the card, what the person said, and who they are to the API.

type RetrievalPlan added in v0.93.0

type RetrievalPlan struct {
	Searches []string `json:"searches"`
	IsBroad  bool     `json:"isBroad"`
}

RetrievalPlan is how a turn's graph retrieval searches beyond the message's own words: the focused searches the depth judgement planned, and whether the message asks about a whole area. A live turn gets it from the judgement; a replay is given it, so that it asks no model anything.

type Risk

type Risk = tools.Risk

type Run

type Run struct {
	Job     *models.AgentJob
	Agent   *models.Agent
	Owner   *models.User
	Mailbox *models.Mailbox
	Source  *models.AgentMailbox

	// Now is the moment the tick that claimed the job ran as of, so that a
	// hold or a deferral is judged against the same clock that claimed it.
	Now time.Time

	// Subject is what a run no job queued is about -- the message a draft
	// answers, the conversation being titled or compacted -- so that its
	// transcript names it as a job's would.
	Subject string
	// contains filtered or unexported fields
}

Run is one job with what every handler needs resolved: the agent, its owner, and the mailbox the job is about.

func (*Run) Configuration

func (self *Run) Configuration() *config.Configuration

Configuration is the operator's configuration as of this tick.

func (*Run) Database

func (self *Run) Database() db.Database

Database is the run's database.

func (*Run) Registry

func (self *Run) Registry() *llm.Registry

Registry is the run's models.

func (*Run) Storage

func (self *Run) Storage() storage.Storage

Storage is the run's message store.

type RunCommand

type RunCommand struct {
	// Instance is who said it, filled in on the way out.
	Instance string `json:"instance"`
	RunID    string `json:"runId"`
	// Action is "stop", "answer", "resolve", "locate" or "liveActivity".
	Action  string `json:"action"`
	CallID  string `json:"callId,omitempty"`
	Answer  string `json:"answer,omitempty"`
	Approve bool   `json:"approve,omitempty"`
	// PushRegistration is the Live Activity a liveActivity command has the
	// run follow (see RegisterLiveActivity).
	PushRegistration string `json:"pushRegistration,omitempty"`
}

RunCommand is one word to a run.

type SavingMonthInput added in v0.98.0

type SavingMonthInput struct {
	// ExpectedIncomeAmount and ExpectedSpendingAmount are the month's
	// income and spending budgets added up.
	ExpectedIncomeAmount   *big.Rat
	ExpectedSpendingAmount *big.Rat

	// ProjectedIncomeAmount and ProjectedSpendingAmount are where the
	// month's income and spending are heading, or ended for a month that
	// is over.
	ProjectedIncomeAmount   *big.Rat
	ProjectedSpendingAmount *big.Rat

	// DayOfMonth is today, from one; IsMonthOver says today is past the
	// month's last day.
	DayOfMonth  int
	IsMonthOver bool
}

SavingMonthInput is what ProjectSavingMonth reads, every amount in one currency.

type SavingMonthProjection added in v0.98.0

type SavingMonthProjection struct {
	ExpectedSavingAmount   *big.Rat
	ProjectedSavingAmount  *big.Rat
	SavingDifferenceAmount *big.Rat
	SavingPace             models.SavingPace
}

SavingMonthProjection is a month's saving as its budgets expect it and as it is heading.

func ProjectSavingMonth added in v0.98.0

func ProjectSavingMonth(input *SavingMonthInput) *SavingMonthProjection

ProjectSavingMonth is a month's expected saving (income budgets less spending budgets), its projected saving (projected income less projected spending) and the difference. The pace is on_track while the projection lands within a tenth of the spending budgets (of the income budgets when there are no spending budgets) either side of the expected saving; behind below that, only after the first week or in a month that is over, since a hot first week projects spending high; ahead above it.

type SavingsTargetProgress added in v0.87.0

type SavingsTargetProgress struct {
	// SavedAmount is, for a cash flow target, income less spending since
	// it started; for an asset value target, what its assets and the
	// assets of its finance accounts are worth now less its starting
	// amount; for a net worth target, net worth now less its starting
	// amount. RemainingAmount is the target less that, never below zero.
	SavedAmount     string `json:"savedAmount"`
	RemainingAmount string `json:"remainingAmount"`

	// MonthsLeftCount is the months from this one to the target's, both
	// included, and RequiredMonthlyAmount what remains over them: the pace
	// needed.
	MonthsLeftCount       int    `json:"monthsLeftCount"`
	RequiredMonthlyAmount string `json:"requiredMonthlyAmount"`

	// IsBehind says a cash flow target's last two full months both saved
	// less than the pace they needed: the same test its alert is written
	// by. Always false for an asset value or net worth target.
	IsBehind bool `json:"isBehind"`

	// UnconvertedCurrencyCodes are the currencies left out for want of an
	// exchange rate into the target's.
	UnconvertedCurrencyCodes []string `json:"unconvertedCurrencyCodes"`
}

SavingsTargetProgress is how a savings target stands, in its currency: what it has saved, what remains, and the monthly pace that would still reach it by its day.

func SavingsTargetProgressOf added in v0.87.0

func SavingsTargetProgressOf(ctx context.Context, tx db.Transaction, fetcher *rates.Fetcher, agentId string, savingsTarget *models.SavingsTarget, today string) (*SavingsTargetProgress, error)

SavingsTargetProgressOf is how one savings target stands as of today ("2006-01-02", the person's local day), measured the way its alert is. A nil fetcher converts with the rates already stored.

type Scenario added in v0.94.0

type Scenario struct {
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Steps       []*ScenarioStep `json:"steps"`
}

Scenario is the file.

func ReadScenario added in v0.94.0

func ReadScenario(path string) (*Scenario, error)

ReadScenario reads and checks a scenario file.

type ScenarioAnswerReport added in v0.94.0

type ScenarioAnswerReport struct {
	AnswerFrom       string   `json:"answerFrom"`
	AnswerVerdict    string   `json:"answerVerdict"`
	VerdictReason    string   `json:"verdictReason"`
	AnswerText       string   `json:"answerText"`
	PlannedSearches  []string `json:"plannedSearches,omitempty"`
	Cost             float64  `json:"cost"`
	AnswerDurationMS int64    `json:"answerDurationMS"`
}

ScenarioAnswerReport is one answer and its grade.

type ScenarioClaim added in v0.94.0

type ScenarioClaim struct {
	Path  string   `json:"path,omitempty"`
	Words []string `json:"words"`
}

ScenarioClaim is a statement recall has to carry, or must not: every word in one fact, on the page named or under it.

type ScenarioClaimLayers added in v0.94.0

type ScenarioClaimLayers struct {
	Claim       string         `json:"claim"`
	LayerCounts map[string]int `json:"layerCounts"`
}

ScenarioClaimLayers is where one claim is said.

type ScenarioEvidenceReport added in v0.104.3

type ScenarioEvidenceReport struct {
	// NamedEvidence is what the question says supports the answer.
	NamedEvidence []string `json:"namedEvidence"`

	// CitedEvidence is the inputs the supporting facts rest on, each once.
	CitedEvidence []string `json:"citedEvidence"`

	// MissingEvidence is what was named and no supporting fact rests on.
	MissingEvidence []string `json:"missingEvidence,omitempty"`

	// SupportingFactCount is how many carried facts say an expected claim,
	// and IndependentSourceCount how many inputs they rest on: when the
	// first is larger, facts repeat one another rather than confirm.
	SupportingFactCount    int `json:"supportingFactCount"`
	IndependentSourceCount int `json:"independentSourceCount"`

	// UnsourcedFactCount is how many supporting facts lead back to no
	// input at all: derived from nothing that can be found, or carrying no
	// evidence.
	UnsourcedFactCount int `json:"unsourcedFactCount"`

	// IsEvidenceTraced is whether every named input is among the cited.
	IsEvidenceTraced bool `json:"isEvidenceTraced"`
}

ScenarioEvidenceReport is where the facts behind a question's expected answer came from.

type ScenarioGraphCounts added in v0.94.0

type ScenarioGraphCounts struct {
	DocumentCount int `json:"documentCount"`
	PageCount     int `json:"pageCount"`
	FactCount     int `json:"factCount"`
	OverviewCount int `json:"overviewCount"`

	// SupersededFactCount is how many facts a later one corrected or
	// replaced: the corrections the run has made so far.
	SupersededFactCount int `json:"supersededFactCount"`
}

ScenarioGraphCounts is how big the graph is.

type ScenarioMessage added in v0.94.0

type ScenarioMessage struct {
	Role       string              `json:"role"`
	Content    string              `json:"content,omitempty"`
	ToolCalls  []*ScenarioToolCall `json:"toolCalls,omitempty"`
	ToolCallID string              `json:"toolCallId,omitempty"`
	ToolName   string              `json:"toolName,omitempty"`
}

ScenarioMessage is one message of a conversation. A tool message's content is the tool's result as the tool returned it; it is fenced as a turn fences it before it is stored.

type ScenarioQuestion added in v0.94.0

type ScenarioQuestion struct {
	ID             string           `json:"id"`
	Question       string           `json:"question"`
	QuestionKind   string           `json:"kind"`
	Expects        []*ScenarioClaim `json:"expects"`
	Forbids        []*ScenarioClaim `json:"forbids"`
	ExpectedAnswer string           `json:"expectedAnswer"`
	OutdatedAnswer string           `json:"outdatedAnswer,omitempty"`

	// OutdatedClaims are statements that were true once and are not
	// now. Recall may carry them, as history; they are looked for in
	// every layer, to see where what is no longer true still stands as
	// current.
	OutdatedClaims []*ScenarioClaim `json:"outdatedClaims,omitempty"`

	// Evidence is the inputs the expected answer rests on: a record by its
	// id, a message as "<step id>#<number>" counting from one, or a whole
	// conversation step by its id. scenario_evidence.go follows the facts
	// behind an answer back to them.
	Evidence []string `json:"evidence,omitempty"`
}

ScenarioQuestion is a question of the evaluation question set's shape. A claim with no path is met by any page.

type ScenarioQuestionReport added in v0.94.0

type ScenarioQuestionReport struct {
	ID string `json:"id"`

	// IsRecallHit is whether recall carried every expected claim and no
	// forbidden one; RecallFailure names the first that was not met.
	IsRecallHit   bool   `json:"isRecallHit"`
	RecallFailure string `json:"recallFailure,omitempty"`

	Answers []*ScenarioAnswerReport `json:"answers,omitempty"`

	// ShownLessons are the lessons a turn asking the question is shown.
	ShownLessons []string `json:"shownLessons,omitempty"`

	// ExpectedLayers and OutdatedLayers say, for each claim, in which
	// layer of the graph it is said and how many times: whether an
	// expected statement was ever learned, and where an outdated one
	// still stands.
	ExpectedLayers []*ScenarioClaimLayers `json:"expectedLayers"`
	OutdatedLayers []*ScenarioClaimLayers `json:"outdatedLayers"`

	// Evidence is where the carried facts that say an expected claim came
	// from, for a question with expected claims.
	Evidence *ScenarioEvidenceReport `json:"evidence,omitempty"`
}

ScenarioQuestionReport is one question at one checkpoint.

type ScenarioReport added in v0.94.0

type ScenarioReport struct {
	Scenario    string                `json:"scenario"`
	Database    string                `json:"database,omitempty"`
	StartedAt   time.Time             `json:"startedAt"`
	FinishedAt  time.Time             `json:"finishedAt"`
	Models      map[string]string     `json:"models"`
	Steps       []*ScenarioStepReport `json:"steps"`
	TotalCost   float64               `json:"totalCost"`
	IsStopped   bool                  `json:"isStopped"`
	StoppedWhy  string                `json:"stoppedWhy,omitempty"`
	GraphCounts *ScenarioGraphCounts  `json:"graphCounts,omitempty"`
}

ScenarioReport is what a run found.

func RunScenario added in v0.94.0

func RunScenario(ctx context.Context, settings *ScenarioSettings) (*ScenarioReport, error)

RunScenario runs a scenario from the start and reports on it.

type ScenarioSettings added in v0.94.0

type ScenarioSettings struct {
	Database      db.Database
	Storage       storage.Storage
	Configuration *config.Configuration
	Scenario      *Scenario

	// RecordsDirectory is where the records are written for the reader,
	// one file a step, as a records source's folder holds them.
	RecordsDirectory string

	// AnswerSources are what each question is answered from: memory,
	// sources, both, memory@planned, both@planned. None asks recall
	// alone, which costs nothing.
	AnswerSources []string

	// BudgetDollars stops the run between steps once what it recorded as
	// spent passes it; zero is no limit.
	BudgetDollars float64

	Progress io.Writer

	// KeepRefreshTokens is handed a signed-in provider's refresh token
	// each time the service rotates it, so a run's own sign-in is written
	// back and still works for the next run.
	KeepRefreshTokens func(provider, refreshToken string)
}

ScenarioSettings is what a run needs. The database is the run's own: RunScenario makes the person, the agent and the records source in it.

type ScenarioStep added in v0.94.0

type ScenarioStep struct {
	ID       string `json:"id"`
	StepKind string `json:"stepKind"`

	// Records are lines in the shape a records source reads: id, kind,
	// at, author, title, text, and for chat channel and thread.
	Records []json.RawMessage `json:"records,omitempty"`

	// DreamCount is how many dreams to run one after another; more than
	// one with nothing new filed shows what repeating maintenance does.
	DreamCount int `json:"dreamCount,omitempty"`

	// IsUntilRead runs dreams until nothing is waiting to be read, as a
	// server's later dreams would, at most scenarioDreamsUntilRead of
	// them: a call the model did not answer leaves its documents for the
	// next dream, and one dream would measure that call rather than the
	// memory.
	IsUntilRead bool `json:"isUntilRead,omitempty"`

	Questions []*ScenarioQuestion `json:"questions,omitempty"`

	// Messages are a conversation of the agent's own, filed as one and
	// remembered the way a finished conversation is: what it learned,
	// and the lessons its commands bore out.
	Messages []*ScenarioMessage `json:"messages,omitempty"`
}

ScenarioStep is one step: records to file, dreams to run, or questions to ask.

type ScenarioStepReport added in v0.94.0

type ScenarioStepReport struct {
	ID          string                    `json:"id"`
	StepKind    string                    `json:"stepKind"`
	DurationMS  int64                     `json:"durationMS"`
	Cost        float64                   `json:"cost"`
	FiledCount  int                       `json:"filedCount,omitempty"`
	GraphCounts *ScenarioGraphCounts      `json:"graphCounts,omitempty"`
	Questions   []*ScenarioQuestionReport `json:"questions,omitempty"`
}

ScenarioStepReport is one step: what it cost and, for a checkpoint, how each question did.

func AskScenarioAgain added in v0.95.0

func AskScenarioAgain(ctx context.Context, settings *ScenarioSettings) (*ScenarioStepReport, error)

AskScenarioAgain asks a scenario's last checkpoint again, of the graph a run left in its database, with the configuration given: what a change to recall or answering does to the same memory, without reading the history again. Only the last checkpoint, because the graph is as it was at the end of the run.

type ScenarioToolCall added in v0.94.0

type ScenarioToolCall struct {
	ID        string `json:"id"`
	ToolName  string `json:"toolName"`
	Arguments string `json:"arguments"`
}

ScenarioToolCall is a call an assistant message makes.

type Settings

type Settings struct {
	Database db.Database
	Storage  storage.Storage
	Registry *llm.Registry

	// Exchange runs the rules that wait for an insight, and climbs the
	// out-of-office ladder for the agent. Nil in tests that have no mail
	// path.
	Exchange mx.Exchange

	// Mailer composes and sends what the agent writes. Set after the
	// mailer exists, which is after the worker does; nil until then.
	Mailer mailer.Mailer

	// Configuration is read at the start of every tick, so an operator's
	// change to a limit or a feature applies without a restart.
	Configuration func() *config.Configuration

	// UpdateConfiguration changes the stored configuration, as the
	// configuration store's Update does. The daily check of model prices
	// against the provider's bill sets prices through it. Nil in tests
	// that never change a price, which then cannot.
	UpdateConfiguration func(change func(*config.Configuration) error) error

	// Instance names this server instance on the jobs it claims.
	Instance string

	// Tick is how often the worker looks for work. Zero means five seconds.
	Tick time.Duration
}

Settings is what the agent needs.

type SpendingCategoryMonthInput added in v0.87.0

type SpendingCategoryMonthInput struct {
	// BudgetAmount is the month's budget.
	BudgetAmount *big.Rat

	// SpendingByDay is each day's spending so far, the first of the month
	// first, up to and including today. A day of refunds may be negative.
	SpendingByDay []*big.Rat

	// FixedChargesDueAmount is what merchants that charged this spending
	// category in each of the last three full months are expected to
	// charge again and have not yet this month, at their median amounts.
	// FixedChargesSeenAmount is what those merchants have charged this
	// month already, which is in SpendingByDay and is left out of the
	// rate the rest of the month is projected at.
	FixedChargesDueAmount  *big.Rat
	FixedChargesSeenAmount *big.Rat

	// DayOfMonth is today, from one; DaysInMonth how many days the month
	// has.
	DayOfMonth  int
	DaysInMonth int
}

SpendingCategoryMonthInput is what ProjectSpendingCategoryMonth reads, every amount already in the budget's currency.

type SpendingCategoryMonthProjection added in v0.87.0

type SpendingCategoryMonthProjection struct {
	SpendingAmount  *big.Rat
	ProjectedAmount *big.Rat
	BudgetPace      models.BudgetPace
}

SpendingCategoryMonthProjection is where a spending category's month is heading.

func ProjectSpendingCategoryMonth added in v0.87.0

func ProjectSpendingCategoryMonth(input *SpendingCategoryMonthInput) *SpendingCategoryMonthProjection

ProjectSpendingCategoryMonth projects a spending category's month end: the spending so far, plus the fixed charges expected and not yet seen, plus the rest of the spending (what is not a fixed charge) at the rate it has come so far, for the days left.

The pace is over once spending passes the budget; at_risk after the first week when the projection passes the budget by more than ten percent; under when the projection stays below ninety percent of it; on_track otherwise, which includes a first week that looks hot.

type SpendingCategoryYearInput added in v0.104.0

type SpendingCategoryYearInput struct {
	Months []*SpendingCategoryYearMonth

	// IsYearOver says the day computed for is past the year's last.
	IsYearOver bool
}

SpendingCategoryYearInput is what ProjectSpendingCategoryYear reads: the months of the year that had a budget, whichever they were.

type SpendingCategoryYearMonth added in v0.104.0

type SpendingCategoryYearMonth struct {
	BudgetMonthPhase BudgetMonthPhase

	// BudgetAmount is the month's budget as it was in force that month.
	BudgetAmount *big.Rat

	// SpendingAmount is the month's spending, so far for the month in
	// progress; nil for a month to come.
	SpendingAmount *big.Rat

	// ProjectedAmount and BudgetToDateAmount are the month in progress's
	// projection (ProjectSpendingCategoryMonth) and its budget over the
	// days so far, and DayOfMonth is its today, from one; ignored for the
	// other phases.
	ProjectedAmount    *big.Rat
	BudgetToDateAmount *big.Rat
	DayOfMonth         int
}

SpendingCategoryYearMonth is one month of a year in which a spending category had a budget, every amount in the year's currency.

type SpendingCategoryYearProjection added in v0.104.0

type SpendingCategoryYearProjection struct {
	BudgetAmount       *big.Rat
	BudgetToDateAmount *big.Rat
	SpendingAmount     *big.Rat
	ProjectedAmount    *big.Rat
	BudgetedMonthCount int
	BudgetPace         models.BudgetPace
}

SpendingCategoryYearProjection is where a spending category's year is heading against the budgets of its months.

func ProjectSpendingCategoryYear added in v0.104.0

func ProjectSpendingCategoryYear(input *SpendingCategoryYearInput) *SpendingCategoryYearProjection

ProjectSpendingCategoryYear adds up a spending category's budgeted months and projects the year's end. The budget is each month's budget as it was in force that month, so a budget changed or ended part way through the year counts each month at what it was then, and the spending is that of the months that had a budget.

The projection is built from the monthly ones where they exist: a month that is over as it ended, the month in progress as it is projected (repeat charges and its pace counted), and each budgeted month still to come at the average of those, which is the year carried on the way it has gone. With no month begun there is nothing to carry on, and a month to come counts at its budget. In its first week the month in progress counts at its budget, or at its spending when that is more already: its straight line is noise then (one dinner on the first projects a month of dinners), and carried on it would be repeated for every month to come.

The pace is a month's thresholds over the year: over once spending passes the year's budget; at_risk, after the first week of the first budgeted month to begin, when the projection passes it by more than ten percent; under below ninety percent of it; on_track otherwise.

type StatementFile added in v0.100.0

type StatementFile struct {
	StatementFileName string
	Content           []byte

	// IsTooLarge says the file was over ofx.MaximumFileBytes and Content
	// holds only its start.
	IsTooLarge bool
}

StatementFile is one OFX file to import, as it was named.

func StatementFilesOf added in v0.100.0

func StatementFilesOf(headers []string, body []byte) []*StatementFile

StatementFilesOf are the OFX files a message carries: every part named .ofx, .qfx or .qbo, and every part whose content is OFX whatever it is called or typed, since a phone sends a statement as application/octet-stream and some programs paste it into the body. A part is decoded and read; nothing in it is run or shown.

type SummarizeInput

type SummarizeInput struct {
	Configuration *config.Configuration
	Agent         *models.Agent
	Owner         *models.User
	Mailbox       *models.Mailbox
	Source        *models.AgentMailbox
	Subject       string

	// Previous is the summary so far, empty the first time; Messages are
	// the ones it does not cover, oldest first.
	Previous string
	Messages []*MessageContext
	Memories []string
}

SummarizeInput is everything the summarize prompt is built from.

type SupersededFact

type SupersededFact struct {
	Path   string `json:"path"`
	Number int    `json:"number"`

	// ReplacedBy is which of this answer's facts replaces it, counting
	// from 1. Without it, any fact the answer filed on the page stood in
	// for the line being retired, whatever it said: a fact about something
	// else retired a true one. Nil for a retraction, which carries a quote
	// instead.
	ReplacedBy *int `json:"replaced_by"`

	// Quote and MessageID are what says the line is no longer true, for a
	// retirement that files nothing in its place.
	//
	// "I go to a different dentist now" retires what the page says about
	// the dentist without saying who the new one is, and that is a real
	// thing for somebody to say. What it cannot be is a retirement nobody
	// said: without these, an answer naming a fact retired it on the
	// strength of naming it, and an answer carrying nothing else could
	// empty a page. Checked exactly as a fact's citation is -- the words
	// have to occur in something the run was actually shown.
	Quote     string `json:"quote"`
	MessageID string `json:"message_id"`
}

SupersededFact is a fact this conversation has replaced.

type SurveyReport added in v0.79.0

type SurveyReport struct {
	// Report is the combined answer in markdown, ending with the pages
	// it covered and any that failed.
	Report string

	// CoveredPaths is the pages whose run answered, and FailedPaths the
	// ones whose run did not: an error, or out of time.
	CoveredPaths []string
	FailedPaths  []string

	// EligiblePageCount is how many pages in scope had an overview to ask;
	// OverLimitPageCount how many of those were left out, the least
	// important, over surveyPageCount; WithoutOverviewPageCount how many
	// pages in scope had no overview yet and were not asked.
	EligiblePageCount        int
	OverLimitPageCount       int
	WithoutOverviewPageCount int

	// IsChosenByRelevance says the pages asked were chosen by how near
	// they are to the question as well as by importance.
	IsChosenByRelevance bool

	// RunIDs is every run the survey made, each a transcript the person
	// can open: one per page, and the one that combined them.
	RunIDs []string
}

SurveyReport is what a survey answers with.

type TabConnection

type TabConnection = DeviceConnection

TabConnection is what the relay needs of the extension's websocket.

type Tool

type Tool = tools.Tool

type TriageAnswer

type TriageAnswer struct {
	Category    string   `json:"category"`
	Priority    string   `json:"priority"`
	NeedsReply  bool     `json:"needs_reply"`
	Research    bool     `json:"research"`
	Extract     bool     `json:"extract"`
	Summary     string   `json:"summary"`
	ActionItems []string `json:"action_items"`
	AlertSignal string   `json:"alert_signal"`
	AlertReason string   `json:"alert_reason"`
}

TriageAnswer is the JSON the model is asked for.

type TriageInput

type TriageInput struct {
	Configuration *config.Configuration
	Agent         *models.Agent
	Owner         *models.User
	Mailbox       *models.Mailbox
	Source        *models.AgentMailbox
	Message       *MessageContext
	Memories      []string
	Corrections   []string
	ResearchNotes []string

	// Tools says the run may look things up before it answers, which
	// changes what the prompt asks for: the same object, after as many
	// lookups as it needs.
	Tools bool
}

TriageInput is everything the prompt is built from, so the prompt can be rendered and tested without a database.

type Viewing

type Viewing struct {
	ItemID      string `json:"itemId,omitempty" graphapi:"nullable"`
	ThreadID    string `json:"threadId,omitempty" graphapi:"nullable"`
	Subject     string `json:"subject,omitempty" graphapi:"nullable"`
	MailboxID   string `json:"mailboxId,omitempty" graphapi:"nullable"`
	MailboxName string `json:"mailboxName,omitempty" graphapi:"nullable"`
	FolderID    string `json:"folderId,omitempty" graphapi:"nullable"`
	FolderName  string `json:"folderName,omitempty" graphapi:"nullable"`
	Page        string `json:"page,omitempty" graphapi:"nullable"`

	// ListKey and ListName are the mailing list open on the subscriptions
	// page, which the subscription tool acts on by key.
	ListKey  string `json:"listKey,omitempty" graphapi:"nullable"`
	ListName string `json:"listName,omitempty" graphapi:"nullable"`
}

Viewing is what the person has open in the dashboard.

Source Files

Directories

Path Synopsis
Package feedback records corrections for subsequent agent work.
Package feedback records corrections for subsequent agent work.
Package indexed is searching and reading what a person's sources put in front of their agent: the documents a pass read, and the passages they were cut into.
Package indexed is searching and reading what a person's sources put in front of their agent: the documents a pass read, and the passages they were cut into.
Package reading is how far the night has got through what was indexed: one measure that the API, the command line and the knowledge tool share, in a package of its own because the tool cannot import the agent.
Package reading is how far the night has got through what was indexed: one measure that the API, the command line and the knowledge tool share, in a package of its own because the tool cannot import the agent.
Package tools is the agent's tool kit: what a tool is, what a call and a result are, the catalog with its permissions and policy, and the registry every tool package registers into from its own init.
Package tools is the agent's tool kit: what a tool is, what a call and a result are, the catalog with its permissions and policy, and the registry every tool package registers into from its own init.
account
Package account is the person's own account: profile, tokens, sessions, app passwords, and what their permissions let them do.
Package account is the person's own account: profile, tokens, sessions, app passwords, and what their permissions let them do.
agentprofile
Package agentprofile is the agent's own profile, as the person tells it in conversation: what it is called, which language it talks in, and the lines the person wants added to its standing instructions.
Package agentprofile is the agent's own profile, as the person tells it in conversation: what it is called, which language it talks in, and the lines the person wants added to its standing instructions.
all
Package all imports every tool package, so that importing it is importing the catalog.
Package all imports every tool package, so that importing it is importing the catalog.
artifact
Package artifact is what the agent makes for the person to open beside the conversation: a page, a drawing or a document it wrote, kept as a file of the conversation, served to its owner alone and in a sandbox.
Package artifact is what the agent makes for the person to open beside the conversation: a page, a drawing or a document it wrote, kept as a file of the conversation, served to its owner alone and in a sandbox.
askuser
Package askuser is the question to the person, for when the answer changes what happens.
Package askuser is the question to the person, for when the answer changes what happens.
browser
Package browser is the agent's browser: a page in the operator's headless Chrome, signed in as nobody, read as a tree with [ref=N] on everything that can be acted on; or, with target tab, the person's own attached tab, with their session, while they watch.
Package browser is the agent's browser: a page in the operator's headless Chrome, signed in as nobody, read as a tree with [ref=N] on everything that can be acted on; or, with target tab, the person's own attached tab, with their session, while they watch.
calendar
Package calendar is what the agent knows about its person's diary: what they have on, when they are free, and -- asking first -- putting something in.
Package calendar is what the agent knows about its person's diary: what they have on, when they are free, and -- asking first -- putting something in.
coding
Package coding hands a piece of work to a coding agent on the person's own computer.
Package coding hands a piece of work to a coding agent on the person's own computer.
computer
Package computer is the person's own computer, when they attached one with `teanode computer`: a shell to run a command in, and its files to read, write, list and search, as the person, anywhere on it.
Package computer is the person's own computer, when they attached one with `teanode computer`: a shell to run a command in, and its files to read, write, list and search, as the person, anywhere on it.
connected
Package connected is the tool for the servers that speak the Model Context Protocol: what the operator has declared, what this person has connected, and the two steps of setting one up.
Package connected is the tool for the servers that speak the Model Context Protocol: what the operator has declared, what this person has connected, and the two steps of setting one up.
contact
Package contact is the person's address book: the people they keep.
Package contact is the person's address book: the people they keep.
conversation
Package conversation is how the agent reaches what was said before: the other conversations this person has with it, and the transcripts of the runs nobody watched.
Package conversation is how the agent reaches what was said before: the other conversations this person has with it, and the transcripts of the runs nobody watched.
datetime
Package datetime is the agent's time arithmetic: now, a conversion between zones, a duration added, the difference between two times, a phrase such as "next Tuesday 3pm" read in the person's zone.
Package datetime is the agent's time arithmetic: now, a conversion between zones, a duration added, the difference between two times, a phrase such as "next Tuesday 3pm" read in the person's zone.
domain
Package domain is the operator's domains and their delivery: domains, addresses, sending credentials, the queue.
Package domain is the operator's domains and their delivery: domains, addresses, sending credentials, the queue.
finance
Package finance is the person's money as the agent reads and keeps it for them: their finance sources (logins at banks, card issuers, brokerages and lenders, linked through a provider), finance accounts, transactions and trades, exchange rates, net worth, spending categories and rules, budgets and savings targets.
Package finance is the person's money as the agent reads and keeps it for them: their finance sources (logins at banks, card issuers, brokerages and lenders, linked through a provider), finance accounts, transactions and trades, exchange rates, net worth, spending categories and rules, budgets and savings targets.
folder
Package folder lists and manages a mailbox's folders.
Package folder lists and manages a mailbox's folders.
goal
Package goal is the conversation's standing instruction: the sentence the agent keeps working toward across turns of its own, and the one tool that says where it is with it.
Package goal is the conversation's standing instruction: the sentence the agent keeps working toward across turns of its own, and the one tool that says where it is with it.
idea
Package idea is the agent's list of ideas for the person, as the agent manages it in conversation: what is on offer, one it found for them, one they took up, finished or do not want.
Package idea is the agent's list of ideas for the person, as the agent manages it in conversation: what is on offer, one it found for them, one they took up, finished or do not want.
knowledge
Package knowledge is the tool for what the person pointed their agent at: their checkout, their chat archive, their notes, their wiki.
Package knowledge is the tool for what the person pointed their agent at: their checkout, their chat archive, their notes, their wiki.
location
Package location asks the browser the person is chatting in where it is.
Package location asks the browser the person is chatting in where it is.
mailact
Package mailact acts on messages: marks, stars, files, junks, trashes.
Package mailact acts on messages: marks, stars, files, junks, trashes.
mailaudit
Package mailaudit is the mail audit as tools: search, one message, its content, marks, and the reports.
Package mailaudit is the mail audit as tools: search, one message, its content, marks, and the reports.
mailbox
Package mailbox is what the mailbox tools share: the person's mailboxes and folders as the API lists them, a conversation and a message's content as the tools read them.
Package mailbox is what the mailbox tools share: the person's mailboxes and folders as the API lists them, a conversation and a message's content as the tools read them.
mailboxsettings
Package mailboxsettings renames a mailbox or sets its signature.
Package mailboxsettings renames a mailbox or sets its signature.
mailcomposehelp
Package mailcomposehelp writes the body of a reply for the person to use, without saving anything.
Package mailcomposehelp writes the body of a reply for the person to use, without saving anything.
maildraft
Package maildraft writes a draft into Drafts for the person to send.
Package maildraft writes a draft into Drafts for the person to send.
mailread
Package mailread reads a message, or the conversation it belongs to, as text the model can weigh.
Package mailread reads a message, or the conversation it belongs to, as text the model can weigh.
mailsearch
Package mailsearch finds messages by words, by meaning where it exists, and by what the agent decided about them.
Package mailsearch finds messages by words, by meaning where it exists, and by what the agent decided about them.
mailsend
Package mailsend sends a draft, with the person's word.
Package mailsend sends a draft, with the person's word.
memory
Package memory is the tool the agent keeps what it knows about the person with: a graph of pages, each addressed by a path, with facts on them and links between them.
Package memory is the tool the agent keeps what it knows about the person with: a graph of pages, each addressed by a path, with facts on them and links between them.
memorycheck
Package memorycheck is the memory check as the agent runs it in conversation: drafting questions from what it remembers about the person, putting them one at a time, and recording what the person says.
Package memorycheck is the memory check as the agent runs it in conversation: drafting questions from what it remembers about the person, putting them one at a time, and recording what the person says.
note
Package note is the person's notes, as the agent keeps them for them: the ones their phone's Notes app keeps in their mailbox.
Package note is the person's notes, as the agent keeps them for them: the ones their phone's Notes app keeps in their mailbox.
openpage
Package openpage moves the dashboard the person is reading the agent in to a page of itself: a page of the agent's memory, a message, a settings tab.
Package openpage moves the dashboard the person is reading the agent in to a page of itself: a page of the agent's memory, a message, a settings tab.
operator
Package operator is what the operator's tools share: a document run as the person with its answer as a map, and the domains the person manages as the API lists them.
Package operator is what the operator's tools share: a document run as the person with its answer as a map, and the domains the person manages as the API lists them.
people
Package people is the operator's people and access: accounts, groups, roles, and the audit log.
Package people is the operator's people and access: accounts, groups, roles, and the audit log.
phone
Package phone is the person's phones running the TeaNode app, for the agent: which there are and whether notifications reach them, naming them, choosing what each is told, a test notification, and removing one.
Package phone is the person's phones running the TeaNode app, for the agent: which there are and whether notifications reach them, naming them, choosing what each is told, a test notification, and removing one.
recording
Package recording exposes account-owned passive evidence through the API.
Package recording exposes account-owned passive evidence through the API.
reminder
Package reminder is the person's reminders list, as the agent keeps it for them: the list beside their calendar that their phone's Reminders app syncs.
Package reminder is the person's reminders list, as the agent keeps it for them: the list beside their calendar that their phone's Reminders app syncs.
replyqueue
Package replyqueue is the replies the agent holds on the person's behalf, and the <pending> overlay that lists them.
Package replyqueue is the replies the agent holds on the person's behalf, and the <pending> overlay that lists them.
rule
Package rule is the mailbox's rules as tools: listed, added, changed, removed, tried and applied.
Package rule is the mailbox's rules as tools: listed, added, changed, removed, tried and applied.
schedule
Package schedule is the tool the agent keeps its own times with: a prompt run on a cron line, at one moment, or a distance from now, in the person's zone, with nobody present.
Package schedule is the tool the agent keeps its own times with: a prompt run on a cron line, at one moment, or a distance from now, in the person's zone, with nobody present.
server
Package server is the server itself: its status, its settings, an upgrade.
Package server is the server itself: its status, its settings, an upgrade.
share
Package share is how the agent hands the person a file: the photo on a message, a file from their computer, something already in the conversation.
Package share is how the agent hands the person a file: the photo on a message, a file from their computer, something already in the conversation.
subscription
Package subscription is the mailing lists a mailbox receives and the ways out of each.
Package subscription is the mailing lists a mailbox receives and the ways out of each.
todo
Package todo is a conversation's task list: the agent's own, laid out when a piece of work has several steps and kept as it goes, so the agent keeps its place and the person watches its progress.
Package todo is a conversation's task list: the agent's own, laid out when a piece of work has several steps and kept as it goes, so the agent keeps its place and the person watches its progress.
toolsearch
Package toolsearch loads tools that are listed but not sent, when the catalog is long: the model names what it wants to do and the matching tools join the request from the next round.
Package toolsearch loads tools that are listed but not sent, when the catalog is long: the model names what it wants to do and the matching tools join the request from the next round.
webfetch
Package webfetch reads a web page as text for the agent: a public one through this server, with the same guarded fetcher the rest of the server uses, or any one through a computer the person attached, on the networks that computer is on.
Package webfetch reads a web page as text for the agent: a public one through this server, with the same guarded fetcher the rest of the server uses, or any one through a computer the person attached, on the networks that computer is on.
websearch
Package websearch asks the search service the operator configured.
Package websearch asks the search service the operator configured.

Jump to

Keyboard shortcuts

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