Documentation
¶
Overview ¶
Package client talks to a running TeaNode server's GraphQL API.
It exists so that the command line tool and the dashboard change configuration the same way: through the server. The alternative, editing teanode.yaml underneath a running process, loses whichever change the other writer made second, because the server holds the whole configuration in memory and rewrites the file from it.
Index ¶
- Constants
- Variables
- func AnswerAgentQuestion(ctx context.Context, connection *Client, runId, callId, answer string) (bool, error)
- func BeginAgentServerOAuth(ctx context.Context, connection *Client, server, redirectURL string) (string, error)
- func ClearAgentKnowledgeSourceSecret(ctx context.Context, connection *Client, sourceId, key string) error
- func ClearAgentSkillSecret(ctx context.Context, connection *Client, skill, key string) (bool, error)
- func DeleteAgentConversation(ctx context.Context, connection *Client, conversationId string) error
- func DeleteAgentFact(ctx context.Context, connection *Client, path string, number int) error
- func DeleteAgentKnowledgeSource(ctx context.Context, connection *Client, sourceId string) error
- func DeleteAgentMemory(ctx context.Context, connection *Client, memoryId string) error
- func DeleteAgentNode(ctx context.Context, connection *Client, path string) error
- func DeleteAgentSchedule(ctx context.Context, connection *Client, scheduleId string) error
- func DeleteAlias(ctx context.Context, connection *Client, aliasId string) error
- func DeleteCalendarEvent(ctx context.Context, connection *Client, calendarId, id string) error
- func DeleteCalendarEventWithRequest(ctx context.Context, connection *Client, calendarId, id, requestId string) error
- func DeleteContact(ctx context.Context, connection *Client, id string) error
- func DeleteCredential(ctx context.Context, connection *Client, credentialId string) error
- func DeleteDomain(ctx context.Context, connection *Client, domainId string) error
- func DeleteDomainLogo(ctx context.Context, connection *Client, domainId string) error
- func DeleteGroup(ctx context.Context, connection *Client, groupId string) error
- func DeleteLayout(ctx context.Context, connection *Client, layoutId string) error
- func DeleteMailboxAppPassword(ctx context.Context, connection *Client, appPasswordId string) error
- func DeleteMailboxFolder(ctx context.Context, connection *Client, folderId string) error
- func DeleteNote(ctx context.Context, connection *Client, mailboxId, noteId string) error
- func DeletePasskey(ctx context.Context, connection *Client, passkeyId string) error
- func DeleteReminder(ctx context.Context, connection *Client, reminderId string) error
- func DeleteRole(ctx context.Context, connection *Client, roleId string) error
- func DeleteTemplate(ctx context.Context, connection *Client, templateId string) error
- func DeleteToken(ctx context.Context, connection *Client, id, username string) error
- func DeleteUser(ctx context.Context, connection *Client, username string) error
- func DisconnectApp(ctx context.Context, connection *Client, clientId, username string) error
- func DreamAgentNow(ctx context.Context, connection *Client, bootstrap *bool) error
- func ImportAgentEvaluationQuestions(ctx context.Context, connection *Client, ...) (int, error)
- func IsMutationDocument(document string) bool
- func LinkAgentNodes(ctx context.Context, connection *Client, path, to, relation, note string) error
- func NormalizeURL(url string) string
- func RemoveAgentChannel(ctx context.Context, connection *Client, kind string) error
- func RemoveAgentSkill(ctx context.Context, connection *Client, name string) error
- func RemoveAgentSourceType(ctx context.Context, connection *Client, name string) error
- func RenameApp(ctx context.Context, connection *Client, clientId, username, name string) error
- func RereadAgentDocuments(ctx context.Context, connection *Client, minutes int) (int, error)
- func ResolveAgentConfirmation(ctx context.Context, connection *Client, runId, callId string, approve bool) (bool, error)
- func RevokeAllSessions(ctx context.Context, connection *Client) error
- func RevokeSession(ctx context.Context, connection *Client, sessionId string) error
- func RunAgentSchedule(ctx context.Context, connection *Client, scheduleId string) error
- func SetMyContact(ctx context.Context, connection *Client, contactId string) error
- func SpeakFirstNow(ctx context.Context, connection *Client, speakFirstReason string) error
- func StopAgentRun(ctx context.Context, connection *Client, runId string) error
- func SyncAgentKnowledgeSource(ctx context.Context, connection *Client, sourceId string) error
- func UnlinkAgentNodes(ctx context.Context, connection *Client, path, to, relation string) error
- type Address
- type AddressBook
- type AgentAnswerEvaluation
- type AgentAttachment
- type AgentBackgroundCommand
- func ListAgentBackgroundCommands(ctx context.Context, connection *Client, conversationId string) ([]*AgentBackgroundCommand, error)
- func ReadAgentBackgroundCommand(ctx context.Context, connection *Client, computer, id string, tailBytes int) (*AgentBackgroundCommand, error)
- func StopAgentBackgroundCommand(ctx context.Context, connection *Client, computer, id string) (*AgentBackgroundCommand, error)
- type AgentBudget
- type AgentChannel
- func ListAgentChannels(ctx context.Context, connection *Client) ([]*AgentChannel, error)
- func SetAgentChannel(ctx context.Context, connection *Client, kind, token string, enabled *bool) (*AgentChannel, error)
- func UnlinkAgentChannel(ctx context.Context, connection *Client, kind string) (*AgentChannel, error)
- type AgentCollection
- type AgentComputerView
- type AgentComputersView
- type AgentConversation
- func ListAgentConversations(ctx context.Context, connection *Client, archived bool) ([]*AgentConversation, error)
- func ListAgentGoals(ctx context.Context, connection *Client) ([]*AgentConversation, error)
- func MarkAgentGoalMet(ctx context.Context, connection *Client, conversationId string) (*AgentConversation, error)
- func SearchAgentConversations(ctx context.Context, connection *Client, archived bool, query string) ([]*AgentConversation, error)
- func SetAgentMainConversation(ctx context.Context, connection *Client, conversationId string) (*AgentConversation, error)
- func StartAgentConversation(ctx context.Context, connection *Client, title, goal string) (*AgentConversation, error)
- func UpdateAgentConversation(ctx context.Context, connection *Client, conversationId, title string, ...) (*AgentConversation, error)
- type AgentConversationView
- type AgentDefinition
- type AgentDocumentExtract
- type AgentDocumentSearch
- type AgentDraft
- type AgentDream
- type AgentEdge
- type AgentEvaluationQuestion
- type AgentEvaluationRun
- type AgentEvent
- type AgentEvidence
- type AgentFact
- type AgentFeedback
- type AgentGraphPage
- type AgentGraphSearch
- type AgentIdea
- func ListAgentIdeas(ctx context.Context, connection *Client, statuses, kinds []string) ([]*AgentIdea, error)
- func ProposeAgentIdea(ctx context.Context, connection *Client, proposal *AgentIdeaProposal) (*AgentIdea, error)
- func SetAgentIdeaStatus(ctx context.Context, connection *Client, ideaId, status string) (*AgentIdea, error)
- type AgentIdeaEvidence
- type AgentIdeaProposal
- type AgentJob
- type AgentKnowledgeSource
- type AgentKnowledgeSpecification
- type AgentLearnedFact
- type AgentMemory
- type AgentMessage
- type AgentNode
- func AgentGraphIndex(ctx context.Context, connection *Client, under string, first int) ([]*AgentNode, error)
- func MergeAgentNodes(ctx context.Context, connection *Client, path, into string) (*AgentNode, error)
- func MoveAgentNode(ctx context.Context, connection *Client, path, under string) (*AgentNode, error)
- func SaveAgentNode(ctx context.Context, connection *Client, fields map[string]any) (*AgentNode, error)
- type AgentPageRevision
- type AgentPassage
- type AgentReadingProgress
- type AgentRecall
- type AgentRecalledFact
- type AgentRecalledPage
- type AgentReference
- type AgentReply
- type AgentReplyPage
- type AgentRun
- type AgentRunFilter
- type AgentRunSummary
- func ListAgentRuns(ctx context.Context, connection *Client, first, offset int, jobId string) ([]*AgentRunSummary, int64, error)
- func ListAllAgentRuns(ctx context.Context, connection *Client, first, offset int, agentId string) ([]*AgentRunSummary, int64, error)
- func SearchAgentRuns(ctx context.Context, connection *Client, first, offset int, ...) ([]*AgentRunSummary, int64, error)
- func SearchAllAgentRuns(ctx context.Context, connection *Client, first, offset int, agentId string, ...) ([]*AgentRunSummary, int64, error)
- type AgentSchedule
- func ListAgentSchedules(ctx context.Context, connection *Client) ([]*AgentSchedule, error)
- func RunAgentBriefNow(ctx context.Context, connection *Client) (*AgentSchedule, error)
- func SaveAgentSchedule(ctx context.Context, connection *Client, scheduleId string, ...) (*AgentSchedule, error)
- func SetAgentBrief(ctx context.Context, connection *Client, enabled bool, at string, days []int) (*AgentSchedule, error)
- type AgentServer
- func ConnectAgentServer(ctx context.Context, connection *Client, server, credential string) (*AgentServer, error)
- func DisconnectAgentServer(ctx context.Context, connection *Client, server string) (*AgentServer, error)
- func FinishAgentServerOAuth(ctx context.Context, connection *Client, server, code, state string) (*AgentServer, error)
- func ListAgentServers(ctx context.Context, connection *Client) ([]*AgentServer, error)
- type AgentSkill
- func InstallAgentSkill(ctx context.Context, connection *Client, name string) (*AgentSkill, error)
- func ListAgentSkills(ctx context.Context, connection *Client) ([]*AgentSkill, error)
- func SetAgentSkillEnabled(ctx context.Context, connection *Client, name string, enabled bool) (*AgentSkill, error)
- func SetAgentSkillScope(ctx context.Context, connection *Client, name, scope string) (*AgentSkill, error)
- type AgentSkillOffer
- type AgentSkillSecret
- type AgentSkillTool
- type AgentSource
- type AgentSourceSecret
- type AgentSourceType
- func AddLocalAgentSourceType(ctx context.Context, connection *Client, content string) (*AgentSourceType, error)
- func InstallAgentSourceType(ctx context.Context, connection *Client, name string) (*AgentSourceType, error)
- func ListAgentSourceTypes(ctx context.Context, connection *Client) ([]*AgentSourceType, error)
- type AgentSourceTypeOffer
- type AgentSourceTypeSetting
- type AgentSummary
- func ListAgents(ctx context.Context, connection *Client) ([]*AgentSummary, error)
- func SetAgentDisabled(ctx context.Context, connection *Client, agentId string, disabled bool) (*AgentSummary, error)
- func SetAgentLimit(ctx context.Context, connection *Client, agentId string, dailyTokens *int64, ...) (*AgentSummary, error)
- type AgentTodo
- type AgentTool
- type AgentToolCall
- type AgentTurn
- type AgentUsageNote
- type AgentUsageRow
- type AgentView
- func GrantAgentMailbox(ctx context.Context, connection *Client, mailboxId string, policy any) (*AgentView, error)
- func GrantAgentSource(ctx context.Context, connection *Client, kind, id string, granted bool) (*AgentView, error)
- func ReadAgent(ctx context.Context, connection *Client) (*AgentView, error)
- func RevokeAgentMailbox(ctx context.Context, connection *Client, mailboxId string) (*AgentView, error)
- func UpdateAgent(ctx context.Context, connection *Client, variables map[string]any) (*AgentView, error)
- type Alias
- func CreateAlias(ctx context.Context, connection *Client, domainId string, ...) (*Alias, error)
- func ListAliases(ctx context.Context, connection *Client, domainId string) ([]*Alias, error)
- func MatchAliases(ctx context.Context, connection *Client, domainId, address string) ([]*Alias, error)
- func UpdateAlias(ctx context.Context, connection *Client, aliasId string, ...) (*Alias, error)
- type AliasParameters
- type App
- type Argument
- type AskAgentRequest
- type Attachment
- type AttachmentParameters
- type AuditEvent
- type AuditEventPage
- type AuditFilter
- type Calendar
- type CalendarAttendee
- type CalendarEvent
- func GetCalendarEvent(ctx context.Context, connection *Client, calendarId, id string) (*CalendarEvent, error)
- func ListCalendarEvents(ctx context.Context, connection *Client, calendarId, from, until string) ([]*CalendarEvent, error)
- func SaveCalendarEvent(ctx context.Context, connection *Client, fields *SaveCalendarEventFields) (*CalendarEvent, error)
- type CalendarRequest
- type Client
- func (self *Client) Download(ctx context.Context, path string) (*http.Response, error)
- func (self *Client) Execute(ctx context.Context, query string, variables map[string]any, result any) error
- func (self *Client) PostJSON(ctx context.Context, path string, body []byte) (*http.Response, error)
- func (self *Client) ReadOnly() bool
- func (self *Client) SetTimeout(timeout time.Duration)
- func (self *Client) Token() string
- func (self *Client) URL() string
- func (self *Client) Upload(ctx context.Context, path, field, filename string, content []byte) (*http.Response, error)
- type ConnectionError
- type Contact
- func GetContact(ctx context.Context, connection *Client, id string) (*Contact, error)
- func ListContacts(ctx context.Context, connection *Client, addressBookId, query string, ...) ([]*Contact, error)
- func SaveContact(ctx context.Context, connection *Client, fields *SaveContactFields) (*Contact, error)
- type CreatedAppPassword
- type CreatedCredential
- type Credential
- type CredentialParameters
- type CredentialSettings
- type Delivery
- func GetDelivery(ctx context.Context, connection *Client, deliveryId string) (*Delivery, error)
- func ListDeliveries(ctx context.Context, connection *Client, domainId string, first int) ([]*Delivery, error)
- func ListDeliveriesByMail(ctx context.Context, connection *Client, mailId string) ([]*Delivery, error)
- func ListPendingDeliveries(ctx context.Context, connection *Client, domainId string, first int) ([]*Delivery, error)
- func RetryDelivery(ctx context.Context, connection *Client, deliveryId string) (*Delivery, error)
- type Domain
- func CheckDomain(ctx context.Context, connection *Client, domainId string) (*Domain, error)
- func CreateDomain(ctx context.Context, connection *Client, parameters *DomainParameters) (*Domain, error)
- func FindDomain(ctx context.Context, connection *Client, name string) (*Domain, error)
- func ListDomains(ctx context.Context, connection *Client) ([]*Domain, error)
- func RegenerateDomainKey(ctx context.Context, connection *Client, domainId string) (*Domain, error)
- func UpdateDomain(ctx context.Context, connection *Client, domainId string, ...) (*Domain, error)
- type DomainLogo
- type DomainParameters
- type DomainSubmission
- type Error
- type Errors
- type EvaluationSourceScore
- type ExternalAddresses
- type Facet
- type Field
- type Filter
- type Group
- type GroupParameters
- type Header
- type ImportedEvaluationQuestion
- type Layout
- func CreateLayout(ctx context.Context, connection *Client, domainId string, ...) (*Layout, error)
- func GetLayout(ctx context.Context, connection *Client, layoutId string) (*Layout, error)
- func ListLayouts(ctx context.Context, connection *Client, domainId string) ([]*Layout, error)
- func ModifyLayout(ctx context.Context, connection *Client, layoutId string, ...) (*Layout, error)
- type LayoutParameters
- type LayoutTranslation
- type Mail
- type MailContent
- type MailOpens
- type MailProgramSettings
- type MailServer
- type MailServerParameters
- type MailSubmission
- type Mailbox
- type MailboxAddress
- type MailboxAppPassword
- type MailboxAutoReply
- type MailboxFolder
- func CreateMailboxFolder(ctx context.Context, connection *Client, mailboxId, name, parentId string) (*MailboxFolder, error)
- func SetMailboxFolderPinned(ctx context.Context, connection *Client, folderId string, pinned bool) (*MailboxFolder, error)
- func UpdateMailboxFolder(ctx context.Context, connection *Client, folderId string, ...) (*MailboxFolder, error)
- type MailboxItem
- type MailboxMail
- type MailboxParameters
- type MailboxRule
- type MailboxRuleAction
- type MailboxRuleApplication
- type MailboxRuleCondition
- type MailboxRuleTest
- type MailboxSubscription
- type MailboxSubscriptionPage
- type MailboxSummary
- type MailboxThreadItem
- type MailboxThreadView
- type MailboxView
- type MessageParameters
- type Note
- type Operation
- type Options
- type OutgoingIdentity
- type Passkey
- type PasskeyPolicy
- type PermissionDescription
- type ReadOnlyError
- type Record
- type RecordSet
- type Reminder
- func ListReminders(ctx context.Context, connection *Client, isDone *bool) ([]*Reminder, error)
- func SaveReminder(ctx context.Context, connection *Client, reminderId string, ...) (*Reminder, error)
- func SetReminderDone(ctx context.Context, connection *Client, reminderId string, isDone bool) (*Reminder, error)
- type ReminderChange
- type Rendered
- type Report
- type RestartResult
- type Role
- type RoleParameters
- type SaveCalendarEventFields
- type SaveContactFields
- type Schema
- type ServerStatus
- type Session
- type Settings
- type StartedAgentIdea
- type Template
- func CreateTemplate(ctx context.Context, connection *Client, domainId string, ...) (*Template, error)
- func GetTemplateByName(ctx context.Context, connection *Client, domainId, name string) (*Template, error)
- func ListTemplates(ctx context.Context, connection *Client, domainId string) ([]*Template, error)
- func ModifyTemplate(ctx context.Context, connection *Client, templateId string, ...) (*Template, error)
- type TemplateParameters
- type TemplateTranslation
- type Token
- func CreateToken(ctx context.Context, connection *Client, name, username, lifetime string) (*Token, string, error)
- func ListTokens(ctx context.Context, connection *Client, username string, includeRevoked bool) ([]*Token, error)
- func UpdateToken(ctx context.Context, connection *Client, id, username, name, lifetime string) (*Token, error)
- type Type
- type TypeReference
- type Upgrade
- type User
- func CreateUser(ctx context.Context, connection *Client, username, password, email string) (*User, error)
- func GetCurrentUser(ctx context.Context, connection *Client) (*User, error)
- func ListUsers(ctx context.Context, connection *Client) ([]*User, error)
- func SetUserPassword(ctx context.Context, connection *Client, username, password string) (*User, error)
- func UpdateUser(ctx context.Context, connection *Client, username string, ...) (*User, error)
- type UserParameters
Constants ¶
const ( DocumentListGroups = `query { ListGroups ` + groupFields + ` }` DocumentCreateGroup = `mutation ($name: String!, $description: String, $idpGroup: String, $userIds: [String!], $roleIds: [String!], $domainIds: [String!]) { CreateGroup(name: $name, description: $description, idpGroup: $idpGroup, userIds: $userIds, roleIds: $roleIds, domainIds: $domainIds) ` + groupFields + ` }` DocumentUpdateGroup = `mutation ($groupId: String!, $name: String, $description: String, $idpGroup: String, $userIds: [String!], $roleIds: [String!], $domainIds: [String!]) { UpdateGroup(groupId: $groupId, name: $name, description: $description, idpGroup: $idpGroup, userIds: $userIds, roleIds: $roleIds, domainIds: $domainIds) ` + groupFields + ` }` DocumentDeleteGroup = `mutation ($groupId: String!) { DeleteGroup(groupId: $groupId) }` DocumentListRoles = `query { ListRoles ` + roleFields + ` }` DocumentListPermissions = `query { ListPermissions { key kind widens } }` DocumentCreateRole = `mutation ($name: String!, $description: String, $permissions: [String!]!) { CreateRole(name: $name, description: $description, permissions: $permissions) ` + roleFields + ` }` DocumentUpdateRole = `mutation ($roleId: String!, $name: String, $description: String, $permissions: [String!]) { UpdateRole(roleId: $roleId, name: $name, description: $description, permissions: $permissions) ` + roleFields + ` }` DocumentDeleteRole = `mutation ($roleId: String!) { DeleteRole(roleId: $roleId) }` DocumentListAuditEvents = `` /* 442-byte string literal not displayed */ )
The documents this file sends, named so that a test can validate each one against the schema the server builds.
const ( DocumentReadAgent = `query { ReadAgent ` + agentViewSelection + ` }` DocumentUpdateAgent = `mutation ($enabled: Boolean, $name: String, $instructions: String, $language: String, $knowledgeLanguage: String, $voice: AgentVoiceInput, $categories: [AgentCategoryInput!], $notifications: AgentNotificationsInput, $confirm: [String!], $askModel: String, $dreamFrom: String, $dreamUntil: String, $forget: Boolean) { UpdateAgent(enabled: $enabled, name: $name, instructions: $instructions, language: $language, knowledgeLanguage: $knowledgeLanguage, voice: $voice, categories: $categories, notifications: $notifications, confirm: $confirm, askModel: $askModel, dreamFrom: $dreamFrom, dreamUntil: $dreamUntil, forget: $forget) ` + agentViewSelection + ` }` DocumentGrantAgentMailbox = `mutation ($mailboxId: String!, $policy: AgentMailboxInput) { GrantAgentMailbox(mailboxId: $mailboxId, policy: $policy) ` + agentViewSelection + ` }` DocumentRevokeAgentMailbox = `mutation ($mailboxId: String!) { RevokeAgentMailbox(mailboxId: $mailboxId) ` + agentViewSelection + ` }` DocumentGrantAgentSource = `mutation ($kind: String!, $id: String!, $granted: Boolean!) { GrantAgentSource(kind: $kind, id: $id, granted: $granted) ` + agentViewSelection + ` }` DocumentSetAgentBrief = `mutation ($enabled: Boolean!, $at: String, $days: [Int!]) { SetAgentBrief(enabled: $enabled, at: $at, days: $days) ` + scheduleFields + ` }` DocumentRunAgentBriefNow = `mutation { RunAgentBriefNow ` + scheduleFields + ` }` DocumentAgentUsage = `` /* 181-byte string literal not displayed */ DocumentListAgents = `query { ListAgents ` + agentSummarySelection + ` }` DocumentAgentServerUsage = `` /* 187-byte string literal not displayed */ DocumentListAgentDeadLetters = `query { ListAgentDeadLetters ` + agentJobSelection + ` }` DocumentSetAgentLimit = `mutation ($agentId: String!, $dailyTokens: Int64, $dailyCost: Float) { SetAgentLimit(agentId: $agentId, dailyTokens: $dailyTokens, dailyCost: $dailyCost) ` + agentSummarySelection + ` }` DocumentSetAgentDisabled = `mutation ($agentId: String!, $disabled: Boolean!) { SetAgentDisabled(agentId: $agentId, disabled: $disabled) ` + agentSummarySelection + ` }` DocumentRetryAgentJob = `mutation ($jobId: String!) { RetryAgentJob(jobId: $jobId) ` + agentJobSelection + ` }` )
The documents, exported so a test can compare them with the schema.
const ( DocumentAskAgent = `` /* 378-byte string literal not displayed */ DocumentReadAgentRun = `` /* 203-byte string literal not displayed */ DocumentResolveAgentConfirmation = `` /* 147-byte string literal not displayed */ DocumentStopAgentRun = `mutation ($runId: String!) { StopAgentRun(runId: $runId) }` DocumentListAgentConversations = `query ($archived: Boolean, $query: String, $isGoalInProgress: Boolean) { ListAgentConversations(archived: $archived, query: $query, isGoalInProgress: $isGoalInProgress) ` + conversationFields + ` }` DocumentDeleteAgentConversation = `mutation ($conversationId: String!) { DeleteAgentConversation(conversationId: $conversationId) }` DocumentListAgentRuns = `query ($first: Int, $offset: Int, $jobId: String, $kinds: [String!], $query: String) { ListAgentRuns(first: $first, offset: $offset, jobId: $jobId, kinds: $kinds, query: $query) { total runs ` + runFields + ` } }` DocumentListAllAgentRuns = `query ($first: Int, $offset: Int, $agentId: String, $kinds: [String!], $query: String) { ListAllAgentRuns(first: $first, offset: $offset, agentId: $agentId, kinds: $kinds, query: $query) { total runs ` + runFields + ` } }` DocumentReadAgentConversation = `query ($conversationId: String, $first: Int, $offset: Int) { ReadAgentConversation(conversationId: $conversationId, first: $first, offset: $offset) { conversation ` + conversationFields + ` messages { id createdAt role content name toolCallId toolCalls { id name arguments } usage { model kind promptTokens completionTokens } attachments { id name contentType size } references { itemId threadId subject from } } total todos ` + todoFields + ` } }` DocumentStartAgentConversation = `mutation ($title: String, $goal: String) { StartAgentConversation(title: $title, goal: $goal) ` + conversationFields + ` }` DocumentUpdateAgentConversation = `mutation ($conversationId: String!, $title: String, $archived: Boolean, $goal: String, $goalState: String) { UpdateAgentConversation(conversationId: $conversationId, title: $title, archived: $archived, goal: $goal, goalState: $goalState) ` + conversationFields + ` }` DocumentSetAgentMainConversation = `mutation ($conversationId: String) { SetAgentMainConversation(conversationId: $conversationId) ` + conversationFields + ` }` DocumentListAgentTools = `query { ListAgentTools { name family risk description confirms core } }` )
The documents.
const ( DocumentListAgentBackgroundCommands = `query ($conversationId: String) { ListAgentBackgroundCommands(conversationId: $conversationId) { ` + backgroundCommandFields + ` } }` DocumentReadAgentBackgroundCommand = `query ($computer: String!, $id: String!, $tailBytes: Int) { ReadAgentBackgroundCommand(computer: $computer, id: $id, tailBytes: $tailBytes) { ` + backgroundCommandFields + ` stdout stderr isStdoutTruncated isStderrTruncated stdoutByteCount stderrByteCount } }` DocumentStopAgentBackgroundCommand = `` /* 169-byte string literal not displayed */ )
The documents the command line sends, exported so a test can check them against the schema.
const ( DocumentListAgentServers = `query { ListAgentServers ` + serverFields + ` }` DocumentConnectAgentServer = `mutation ($server: String!, $credential: String) { ConnectAgentServer(server: $server, credential: $credential) ` + serverFields + ` }` DocumentDisconnectAgentServer = `mutation ($server: String!) { DisconnectAgentServer(server: $server) ` + serverFields + ` }` DocumentBeginAgentServerOAuth = `mutation ($server: String!, $redirectUrl: String!) { BeginAgentServerOAuth(server: $server, redirectUrl: $redirectUrl) }` )
The documents.
const ( DocumentAgentGraphIndex = `query ($under: String, $first: Int) { AgentGraphIndex(under: $under, first: $first) ` + nodeFields + ` }` DocumentAgentGraphPage = `query ($path: String!) { AgentGraphPage(path: $path) { node ` + nodeFields + ` facts ` + factFields + ` edges { relation status fromPath toPath } children ` + nodeFields + ` contact { id name emails phones organization } } }` DocumentSearchAgentGraph = `query ($query: String!, $first: Int) { SearchAgentGraph(query: $query, first: $first) { nodes ` + nodeFields + ` facts { fact ` + factFields + ` path name } } }` DocumentEvaluateAgentAnswer = `` /* 343-byte string literal not displayed */ DocumentRecallAgentMemory = `query ($question: String!) { RecallAgentMemory(question: $question) { pages { path facts { number text } } } }` DocumentListAgentLearned = `query ($days: Int, $first: Int) { ListAgentLearned(days: $days, first: $first) { fact ` + factFields + ` path name } }` DocumentSaveAgentNode = `mutation ($path: String!, $kind: String, $name: String, $summary: String, $aliases: [String!], $pinned: Boolean) { SaveAgentNode(path: $path, kind: $kind, name: $name, summary: $summary, aliases: $aliases, pinned: $pinned) ` + nodeFields + ` }` DocumentMergeAgentNodes = `mutation ($path: String!, $into: String!) { MergeAgentNodes(path: $path, into: $into) { id path name } }` DocumentMoveAgentNode = `mutation ($path: String!, $under: String!) { MoveAgentNode(path: $path, under: $under) ` + nodeFields + ` }` DocumentDeleteAgentNode = `mutation ($path: String!) { DeleteAgentNode(path: $path) }` DocumentSaveAgentFact = `mutation ($path: String!, $number: Int, $kind: String, $text: String!, $happened: String, $audiences: [String!]) { SaveAgentFact(path: $path, number: $number, kind: $kind, text: $text, happened: $happened, audiences: $audiences) ` + factFields + ` }` DocumentMoveAgentFact = `mutation ($path: String!, $number: Int!, $to: String!) { MoveAgentFact(path: $path, number: $number, to: $to) ` + factFields + ` }` DocumentDeleteAgentFact = `mutation ($path: String!, $number: Int!) { DeleteAgentFact(path: $path, number: $number) }` DocumentSetMyContact = `mutation ($contactId: String) { SetMyContact(contactId: $contactId) }` DocumentListAgentKnowledgeSources = `query { ListAgentKnowledgeSources ` + sourceFields + ` }` DocumentSaveAgentKnowledgeSource = `mutation ($sourceId: String, $kind: String, $name: String, $computer: String, $path: String, $format: String, $rootPath: String, $cron: String, $enabled: Boolean, $mailboxId: String, $readEveryCheckout: Boolean, $commitsPerPass: Int, $ownCommitsAtLeast: Int, $type: String, $settings: JSON) { SaveAgentKnowledgeSource(type: $type, settings: $settings, sourceId: $sourceId, kind: $kind, name: $name, computer: $computer, path: $path, format: $format, rootPath: $rootPath, cron: $cron, enabled: $enabled, mailboxId: $mailboxId, readEveryCheckout: $readEveryCheckout, commitsPerPass: $commitsPerPass, ownCommitsAtLeast: $ownCommitsAtLeast) ` + sourceFields + ` }` DocumentSearchAgentDocuments = `query ($query: String!, $first: Int, $sourceId: String) { SearchAgentDocuments(query: $query, first: $first, sourceId: $sourceId) { passages ` + passageFields + ` definitions { symbol kind line documentId externalId title } meaningful } }` DocumentReadAgentDocument = `query ($documentId: String!, $from: Int, $first: Int) { ReadAgentDocument(documentId: $documentId, from: $from, first: $first) ` + extractFields + ` }` DocumentDeleteAgentKnowledgeSource = `mutation ($sourceId: String!) { DeleteAgentKnowledgeSource(sourceId: $sourceId) }` DocumentSyncAgentKnowledgeSource = `mutation ($sourceId: String!) { SyncAgentKnowledgeSource(sourceId: $sourceId) }` DocumentDreamAgentNow = `mutation ($bootstrap: Boolean) { DreamAgentNow(bootstrap: $bootstrap) }` DocumentRereadAgentDocuments = `mutation ($minutes: Int!) { RereadAgentDocuments(minutes: $minutes) }` DocumentLinkAgentNodes = `` /* 149-byte string literal not displayed */ DocumentUnlinkAgentNodes = `mutation ($path: String!, $to: String!, $relation: String!) { UnlinkAgentNodes(path: $path, to: $to, relation: $relation) }` DocumentListAgentDreams = `query ($first: Int) { ListAgentDreams(first: $first) ` + dreamFields + ` }` DocumentAgentReadingProgress = `query { AgentReadingProgress { waiting read perHour hoursLeft bootstrapping } }` DocumentListAgentPageHistory = `query ($path: String!, $first: Int) { ListAgentPageHistory(path: $path, first: $first) ` + revisionFields + ` }` )
The documents.
const ( DocumentListAgentIdeas = `query ($ideaStatuses: [String!], $ideaKinds: [String!]) { ListAgentIdeas(ideaStatuses: $ideaStatuses, ideaKinds: $ideaKinds) { ideas ` + agentIdeaFields + ` ideaCategories { ideaCategory emojis } } }` DocumentProposeAgentIdea = `mutation ($ideaCategory: String!, $emoji: String!, $headline: String!, $body: String!, $openingRequest: String!, $neededToolNames: [String!], $evidence: [AgentIdeaEvidenceInput!]!, $suggestionReason: String, $expiresOn: String) { ProposeAgentIdea(ideaCategory: $ideaCategory, emoji: $emoji, headline: $headline, body: $body, openingRequest: $openingRequest, neededToolNames: $neededToolNames, evidence: $evidence, suggestionReason: $suggestionReason, expiresOn: $expiresOn) ` + agentIdeaFields + ` }` DocumentStartAgentIdea = `mutation ($ideaId: String!, $conversationId: String) { StartAgentIdea(ideaId: $ideaId, conversationId: $conversationId) { idea ` + agentIdeaFields + ` conversation { id title } openingRequest } }` DocumentSetAgentIdeaStatus = `mutation ($ideaId: String!, $ideaStatus: String!) { SetAgentIdeaStatus(ideaId: $ideaId, ideaStatus: $ideaStatus) ` + agentIdeaFields + ` }` )
const ( DocumentListAgentMemories = `query ($audience: String, $query: String, $first: Int) { ListAgentMemories(audience: $audience, query: $query, first: $first) ` + memoryFields + ` }` DocumentSaveAgentMemory = `mutation ($memoryId: String, $title: String, $content: String, $tags: [String!], $appliesTo: [String!], $pinned: Boolean) { SaveAgentMemory(memoryId: $memoryId, title: $title, content: $content, tags: $tags, appliesTo: $appliesTo, pinned: $pinned) ` + memoryFields + ` }` DocumentDeleteAgentMemory = `mutation ($memoryId: String!) { DeleteAgentMemory(memoryId: $memoryId) }` DocumentListAgentCorrections = `query ($first: Int) { ListAgentCorrections(first: $first) { id createdAt kind mailId said } }` DocumentListAgentSchedules = `query { ListAgentSchedules ` + scheduleFields + ` }` DocumentSaveAgentSchedule = `mutation ($scheduleId: String, $name: String, $cron: String, $prompt: String, $deliver: String, $enabled: Boolean) { SaveAgentSchedule(scheduleId: $scheduleId, name: $name, cron: $cron, prompt: $prompt, deliver: $deliver, enabled: $enabled) ` + scheduleFields + ` }` DocumentDeleteAgentSchedule = `mutation ($scheduleId: String!) { DeleteAgentSchedule(scheduleId: $scheduleId) }` DocumentRunAgentSchedule = `mutation ($scheduleId: String!) { RunAgentSchedule(scheduleId: $scheduleId) }` DocumentAnswerAgentQuestion = `` /* 135-byte string literal not displayed */ )
The documents.
const ( DocumentListAgentSourceTypes = `query { ListAgentSourceTypes { ` + sourceTypeFields + ` } }` DocumentSearchAgentSourceTypes = `query ($query: String) { SearchAgentSourceTypes(query: $query) { name description version tags installed newer } }` DocumentInstallAgentSourceType = `mutation ($name: String!) { InstallAgentSourceType(name: $name) { ` + sourceTypeFields + ` } }` DocumentAddLocalAgentSourceType = `mutation ($content: String!) { AddLocalAgentSourceType(content: $content) { ` + sourceTypeFields + ` } }` DocumentRemoveAgentSourceType = `mutation ($name: String!) { RemoveAgentSourceType(name: $name) }` )
const ( DocumentListAgentKnowledgeSourceSecrets = `query ($sourceId: String!) { ListAgentKnowledgeSourceSecrets(sourceId: $sourceId) { key description isOptional isSet } }` DocumentSetAgentKnowledgeSourceSecret = `` /* 181-byte string literal not displayed */ DocumentClearAgentKnowledgeSourceSecret = `mutation ($sourceId: String!, $key: String!) { ClearAgentKnowledgeSourceSecret(sourceId: $sourceId, key: $key) }` )
const ( DocumentListCalendars = `query { ListCalendars { id name description colour timezone weekStart events calendarKind agentGranted } }` DocumentListCalendarEvents = `` /* 235-byte string literal not displayed */ DocumentGetCalendarEvent = `` /* 290-byte string literal not displayed */ DocumentSaveCalendarEvent = `` /* 601-byte string literal not displayed */ DocumentSaveCalendarEventWithRequest = `` /* 645-byte string literal not displayed */ DocumentGetCalendarRequest = `` /* 141-byte string literal not displayed */ DocumentDeleteCalendarEvent = `mutation ($calendarId: String!, $id: String!) { DeleteCalendarEvent(calendarId: $calendarId, id: $id) }` DocumentDeleteCalendarEventWithRequest = `` /* 150-byte string literal not displayed */ DocumentSaveCalendar = `` /* 316-byte string literal not displayed */ )
const ( DocumentListAddressBooks = `query { ListAddressBooks { id name description contacts } }` DocumentListContacts = `` /* 220-byte string literal not displayed */ DocumentGetContact = `` /* 193-byte string literal not displayed */ DocumentSaveContact = `` /* 392-byte string literal not displayed */ DocumentDeleteContact = `mutation ($id: String!) { DeleteContact(id: $id) }` )
const ( DocumentListMailboxes = `query { ListMailboxes ` + mailboxFields + ` }` DocumentListAllMailboxes = `query { ListAllMailboxes { id name userId username userName } }` DocumentCreateMailboxFolder = `mutation ($mailboxId: String!, $name: String!, $parentId: String) { CreateMailboxFolder(mailboxId: $mailboxId, name: $name, parentId: $parentId) ` + folderFields + ` }` DocumentUpdateMailboxFolder = `mutation ($folderId: String!, $name: String, $parentId: String) { UpdateMailboxFolder(folderId: $folderId, name: $name, parentId: $parentId) ` + folderFields + ` }` DocumentSetMailboxFolderPinned = `mutation ($folderId: String!, $pinned: Boolean!) { SetMailboxFolderPinned(folderId: $folderId, pinned: $pinned) ` + folderFields + ` }` DocumentDeleteMailboxFolder = `mutation ($folderId: String!) { DeleteMailboxFolder(folderId: $folderId) }` DocumentUpdateMailbox = `mutation ($mailboxId: String!, $name: String, $signatureText: String, $signatureHtml: String, $rules: [MailboxRuleInput!], $autoReply: MailboxAutoReplyInput, $clearAutoReply: Boolean) { UpdateMailbox(mailboxId: $mailboxId, name: $name, signatureText: $signatureText, signatureHtml: $signatureHtml, rules: $rules, autoReply: $autoReply, clearAutoReply: $clearAutoReply) ` + mailboxFields + ` }` DocumentTestMailboxRules = `` /* 286-byte string literal not displayed */ DocumentApplyMailboxRules = `` /* 218-byte string literal not displayed */ DocumentListMailboxAppPasswords = `query ($mailboxId: String!) { ListMailboxAppPasswords(mailboxId: $mailboxId) { id mailboxId name createdAt lastUsedAt } }` DocumentCreateMailboxAppPassword = `` /* 196-byte string literal not displayed */ DocumentDeleteMailboxAppPassword = `mutation ($appPasswordId: String!) { DeleteMailboxAppPassword(appPasswordId: $appPasswordId) }` DocumentGetMailProgramSettings = `query { GetMailProgramSettings { imapHost imapPort imapsPort submissionHost submissionPort } }` )
DocumentListMailboxes and the rest are the documents this file sends, named so that a test can validate every one of them against the schema the server builds. A field renamed on the server is then a failing test rather than a command that fails in somebody's terminal.
const ( DocumentListNotes = `` /* 138-byte string literal not displayed */ DocumentGetNote = `` /* 181-byte string literal not displayed */ DocumentSaveNote = `` /* 310-byte string literal not displayed */ DocumentDeleteNote = `mutation ($mailboxId: String!, $noteId: String!) { DeleteNote(mailboxId: $mailboxId, noteId: $noteId) }` )
const ( DocumentListReminders = `query ($isDone: Boolean) { ListReminders(isDone: $isDone) ` + reminderFields + ` }` DocumentSaveReminder = `mutation ($reminderId: String, $title: String, $notes: String, $dueAt: String, $dueOn: String, $isDueCleared: Boolean, $priority: Int) { SaveReminder(reminderId: $reminderId, title: $title, notes: $notes, dueAt: $dueAt, dueOn: $dueOn, isDueCleared: $isDueCleared, priority: $priority) ` + reminderFields + ` }` DocumentSetReminderDone = `mutation ($reminderId: String!, $isDone: Boolean!) { SetReminderDone(reminderId: $reminderId, isDone: $isDone) ` + reminderFields + ` }` DocumentDeleteReminder = `mutation ($reminderId: String!) { DeleteReminder(reminderId: $reminderId) }` )
const DocumentCancelAgentReply = `mutation ($replyId: String!) {
CancelAgentReply(replyId: $replyId) { id status reason subject to sendAfter }
}`
DocumentCancelAgentReply cancels a held reply.
const DocumentDraftReply = `` /* 134-byte string literal not displayed */
DocumentDraftReply asks the agent to write a reply to a message.
const DocumentEvaluateAgentMemoryNow = `mutation { EvaluateAgentMemoryNow { id startedAt } }`
DocumentEvaluateAgentMemoryNow starts a run now.
const DocumentImportAgentEvaluationQuestions = `mutation ($questions: [ImportedEvaluationQuestionInput!]!) { ImportAgentEvaluationQuestions(questions: $questions) }`
DocumentImportAgentEvaluationQuestions adds questions from a file.
const DocumentListAgentEvaluationQuestions = `` /* 217-byte string literal not displayed */
DocumentListAgentEvaluationQuestions reads the memory check's questions.
const DocumentListAgentEvaluationRuns = `` /* 224-byte string literal not displayed */
DocumentListAgentEvaluationRuns reads the memory check's runs.
const DocumentListAgentReplies = `` /* 336-byte string literal not displayed */
DocumentListAgentReplies lists the replies the agent wrote.
const DocumentSpeakFirstNow = `mutation ($speakFirstReason: String!) { SpeakFirstNow(speakFirstReason: $speakFirstReason) }`
DocumentSpeakFirstNow has the agent start a conversation now.
const LocalTokenLifetime = 5 * time.Minute
LocalTokenLifetime is how long a minted token lasts. One command's worth, with room for a slow reply and a clock that is a little out.
Variables ¶
var ( // or the API's own "not logged in". ErrUnauthorized = errors.New("client: the server refused the token") // ErrNotFound means the server has no such thing. ErrNotFound = errors.New("client: not found") )
Functions ¶
func AnswerAgentQuestion ¶
func AnswerAgentQuestion(ctx context.Context, connection *Client, runId, callId, answer string) (bool, error)
AnswerAgentQuestion answers a question the agent asked in a turn.
func BeginAgentServerOAuth ¶
func BeginAgentServerOAuth(ctx context.Context, connection *Client, server, redirectURL string) (string, error)
BeginAgentServerOAuth is the address to send the person to.
func ClearAgentKnowledgeSourceSecret ¶ added in v0.55.0
func ClearAgentKnowledgeSourceSecret(ctx context.Context, connection *Client, sourceId, key string) error
ClearAgentKnowledgeSourceSecret forgets one value of a source.
func ClearAgentSkillSecret ¶
func ClearAgentSkillSecret(ctx context.Context, connection *Client, skill, key string) (bool, error)
ClearAgentSkillSecret forgets one, and says whether there was one to forget.
func DeleteAgentConversation ¶
DeleteAgentConversation removes a named conversation and everything in it.
func DeleteAgentFact ¶
DeleteAgentFact strikes one.
func DeleteAgentKnowledgeSource ¶
DeleteAgentKnowledgeSource stops one and forgets what it found.
func DeleteAgentMemory ¶
DeleteAgentMemory forgets one memory.
func DeleteAgentNode ¶
DeleteAgentNode removes a page and what is under it.
func DeleteAgentSchedule ¶
DeleteAgentSchedule removes a schedule.
func DeleteAlias ¶
DeleteAlias removes an alias.
func DeleteCalendarEvent ¶
DeleteCalendarEvent takes one away.
func DeleteCalendarEventWithRequest ¶ added in v0.48.0
func DeleteCalendarEventWithRequest(ctx context.Context, connection *Client, calendarId, id, requestId string) error
DeleteCalendarEventWithRequest retains a deletion identity across explicit retries.
func DeleteContact ¶
DeleteContact forgets one.
func DeleteCredential ¶
DeleteCredential removes a credential.
func DeleteDomain ¶
DeleteDomain removes a domain with its aliases and credentials. Mail already received for it is kept.
func DeleteDomainLogo ¶
DeleteDomainLogo stops publishing a domain's mark, and removes the file.
func DeleteGroup ¶
DeleteGroup removes a group. Its members keep their accounts and lose what the group gave them.
func DeleteLayout ¶
DeleteLayout removes a layout.
func DeleteMailboxAppPassword ¶
DeleteMailboxAppPassword revokes one device's app password.
func DeleteMailboxFolder ¶
DeleteMailboxFolder removes a folder somebody made, and everything in it.
func DeleteNote ¶ added in v0.78.0
DeleteNote removes a note.
func DeletePasskey ¶
DeletePasskey removes a passkey, so that authenticator can no longer sign in.
func DeleteReminder ¶ added in v0.77.0
DeleteReminder removes a reminder.
func DeleteRole ¶
DeleteRole removes a role. A seeded role cannot be removed.
func DeleteTemplate ¶
DeleteTemplate removes a template.
func DeleteToken ¶
DeleteToken revokes a token.
func DeleteUser ¶
DeleteUser removes an account and the tokens issued to it.
func DisconnectApp ¶ added in v0.53.0
DisconnectApp revokes every token an app holds.
func DreamAgentNow ¶
DreamAgentNow queues a dream now, whatever the agent's hours. bootstrap, when given, switches bootstrapping on or off: the night at every tick with wider limits until nothing waits to be read.
func ImportAgentEvaluationQuestions ¶ added in v0.61.0
func ImportAgentEvaluationQuestions(ctx context.Context, connection *Client, questions []ImportedEvaluationQuestion) (int, error)
ImportAgentEvaluationQuestions adds questions as confirmed, skipping those already on record, and says how many were added.
func IsMutationDocument ¶
IsMutationDocument says whether a GraphQL document would change anything: whether any operation in it is a mutation.
A read-only client decides with this what to refuse, so it has to be right about documents it did not write — "teanode api graphql" sends whatever it was given. The document is parsed with the same library the server parses it with, so the two cannot disagree about where a comment ends, what a byte order mark is, or whether a "mutation" is a keyword or a field: a hand-written tokenizer was tried first and got two of those wrong.
A document that does not parse is reported as not a mutation, and is sent: the server, using the same parser, rejects it as a syntax error and executes nothing, and that error is the one the caller should see.
func LinkAgentNodes ¶
LinkAgentNodes joins two pages.
func NormalizeURL ¶
NormalizeURL is how a server is named everywhere the client remembers one: trimmed, without a trailing slash, and https unless a scheme was given.
func RemoveAgentChannel ¶
RemoveAgentChannel forgets a chat app's bot.
func RemoveAgentSkill ¶
RemoveAgentSkill takes one away.
func RemoveAgentSourceType ¶ added in v0.54.0
RemoveAgentSourceType takes one away.
func RenameApp ¶ added in v0.53.0
RenameApp names an app on every token it holds, and on each it renews into.
func RereadAgentDocuments ¶
RereadAgentDocuments puts back what a night marked read in the last so many minutes.
func ResolveAgentConfirmation ¶
func ResolveAgentConfirmation(ctx context.Context, connection *Client, runId, callId string, approve bool) (bool, error)
ResolveAgentConfirmation answers a confirmation card.
func RevokeAllSessions ¶
RevokeAllSessions ends every browser the account is signed in on.
func RevokeSession ¶
RevokeSession ends one signed-in browser.
func RunAgentSchedule ¶
RunAgentSchedule runs a schedule now.
func SetMyContact ¶
SetMyContact names the contact that is the caller.
func SpeakFirstNow ¶ added in v0.61.0
SpeakFirstNow has the agent start a conversation in the main one now, for a reason: onboarding, memory_check or idea.
func StopAgentRun ¶
StopAgentRun stops a turn where it is.
func SyncAgentKnowledgeSource ¶
SyncAgentKnowledgeSource reads one again now.
Types ¶
type Address ¶
type Address struct {
Label string `json:"label,omitempty"`
Street string `json:"street,omitempty"`
Locality string `json:"locality,omitempty"`
Region string `json:"region,omitempty"`
PostalCode string `json:"postalCode,omitempty"`
Country string `json:"country,omitempty"`
Written string `json:"written"`
}
Address is one postal address on a contact. Written is the same thing on one line, the way somebody would put it on an envelope.
type AddressBook ¶
type AddressBook struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Contacts int `json:"contacts"`
}
AddressBook is one address book and how much is in it.
func ListAddressBooks ¶
func ListAddressBooks(ctx context.Context, connection *Client) ([]*AddressBook, error)
ListAddressBooks are the caller's. An account that has never had one is given one by the server when it first looks.
type AgentAnswerEvaluation ¶ added in v0.60.0
type AgentAnswerEvaluation struct {
AnswerText string `json:"answerText"`
AnswerVerdict string `json:"answerVerdict"`
VerdictReason string `json:"verdictReason"`
FactCount int `json:"factCount"`
PassageCount int `json:"passageCount"`
Cost float64 `json:"cost"`
Currency string `json:"currency"`
AnswerDurationMS int `json:"answerDurationMS"`
}
AgentAnswerEvaluation is one question of a memory evaluation, answered and graded.
func EvaluateAgentAnswer ¶ added in v0.60.0
func EvaluateAgentAnswer(ctx context.Context, connection *Client, question, expectedAnswer, outdatedAnswer, answerFrom string) (*AgentAnswerEvaluation, error)
EvaluateAgentAnswer answers a question from memory, sources or both, and grades the answer against the expected one.
type AgentAttachment ¶
type AgentAttachment struct {
ID string `json:"id"`
Name string `json:"name"`
ContentType string `json:"contentType"`
Size int64 `json:"size"`
}
AgentAttachment is a file handed to the agent with a turn.
func UploadAgentAttachment ¶
func UploadAgentAttachment(ctx context.Context, connection *Client, filename string, content []byte) (*AgentAttachment, error)
UploadAgentAttachment hands the agent a file for the next turn and returns its record; AskAgentWith names it by id.
type AgentBackgroundCommand ¶ added in v0.57.0
type AgentBackgroundCommand struct {
Computer string `json:"computer"`
ID string `json:"id"`
Command string `json:"command"`
Directory string `json:"directory"`
ConversationID string `json:"conversationId"`
StartedAt time.Time `json:"startedAt"`
EndedAt *time.Time `json:"endedAt"`
IsRunning bool `json:"isRunning"`
ExitCode int `json:"exitCode"`
// StopReason is "stopped" or "lifetime" when it did not end by itself,
// and empty otherwise.
StopReason string `json:"stopReason"`
Stdout string `json:"stdout,omitempty"`
Stderr string `json:"stderr,omitempty"`
IsStdoutTruncated bool `json:"isStdoutTruncated,omitempty"`
IsStderrTruncated bool `json:"isStderrTruncated,omitempty"`
StdoutByteCount int `json:"stdoutByteCount,omitempty"`
StderrByteCount int `json:"stderrByteCount,omitempty"`
}
AgentBackgroundCommand is one background command, with its output when it was read.
func ListAgentBackgroundCommands ¶ added in v0.57.0
func ListAgentBackgroundCommands(ctx context.Context, connection *Client, conversationId string) ([]*AgentBackgroundCommand, error)
ListAgentBackgroundCommands is what runs, or ended lately, in the background on the caller's computers, newest first; only what one conversation started when conversationId is given.
func ReadAgentBackgroundCommand ¶ added in v0.57.0
func ReadAgentBackgroundCommand(ctx context.Context, connection *Client, computer, id string, tailBytes int) (*AgentBackgroundCommand, error)
ReadAgentBackgroundCommand is one background command with the last tailBytes of each of its streams; zero leaves the amount to the server.
func StopAgentBackgroundCommand ¶ added in v0.57.0
func StopAgentBackgroundCommand(ctx context.Context, connection *Client, computer, id string) (*AgentBackgroundCommand, error)
StopAgentBackgroundCommand stops one background command.
type AgentBudget ¶
type AgentBudget struct {
Used int64 `json:"used"`
Limit int64 `json:"limit"`
ResetsAt time.Time `json:"resetsAt"`
Cost float64 `json:"cost"`
CostLimit float64 `json:"costLimit"`
Currency string `json:"currency"`
}
AgentBudget is today's spend.
type AgentChannel ¶
type AgentChannel struct {
Kind string `json:"kind"`
HasToken bool `json:"hasToken"`
BotName string `json:"botName,omitempty"`
Linked bool `json:"linked"`
LinkedName string `json:"linkedName,omitempty"`
LinkCode string `json:"linkCode,omitempty"`
Enabled bool `json:"enabled"`
Running bool `json:"running"`
LastError string `json:"lastError,omitempty"`
LastSeenAt *time.Time `json:"lastSeenAt,omitempty"`
}
AgentChannel is one chat app of the caller's, as the API shows it.
func ListAgentChannels ¶
func ListAgentChannels(ctx context.Context, connection *Client) ([]*AgentChannel, error)
ListAgentChannels is the caller's chat apps.
func SetAgentChannel ¶
func SetAgentChannel(ctx context.Context, connection *Client, kind, token string, enabled *bool) (*AgentChannel, error)
SetAgentChannel sets a chat app's bot token, or whether it runs.
func UnlinkAgentChannel ¶
func UnlinkAgentChannel(ctx context.Context, connection *Client, kind string) (*AgentChannel, error)
UnlinkAgentChannel drops the linked chat and draws a new code.
type AgentCollection ¶
type AgentCollection struct {
ID string `json:"id"`
Name string `json:"name"`
Kind string `json:"kind"`
Granted bool `json:"granted"`
Items int `json:"items"`
}
AgentCollection is one calendar or address book as a source: a switch, and how much is in it.
type AgentComputerView ¶
type AgentComputerView struct {
Name string `json:"name"`
System string `json:"system,omitempty"`
Description string `json:"description,omitempty"`
Since time.Time `json:"since"`
}
AgentComputerView is one attached computer.
type AgentComputersView ¶
type AgentComputersView struct {
Allowed bool `json:"allowed"`
Computers []AgentComputerView `json:"computers"`
}
AgentComputersView is which computers the caller has attached.
func ReadAgentComputers ¶
func ReadAgentComputers(ctx context.Context, connection *Client) (*AgentComputersView, error)
ReadAgentComputers says which computers the server sees for the caller.
type AgentConversation ¶
type AgentConversation struct {
ID string `json:"id"`
Kind string `json:"kind"`
Title string `json:"title"`
Summary string `json:"summary"`
JobKind string `json:"jobKind"`
SubjectID string `json:"subjectId"`
Surface string `json:"surface"`
LastAt time.Time `json:"lastAt"`
ArchivedAt *time.Time `json:"archivedAt"`
CompactedThrough string `json:"compactedThrough"`
// The goal the agent works toward in this conversation, where it
// stands (working, waiting, met), its last word on it, and when it
// takes its next turn.
Goal string `json:"goal"`
GoalState string `json:"goalState"`
GoalNote string `json:"goalNote"`
GoalNextAt *time.Time `json:"goalNextAt"`
GoalSetAt *time.Time `json:"goalSetAt"`
}
AgentConversation is a conversation with the agent.
func ListAgentConversations ¶
func ListAgentConversations(ctx context.Context, connection *Client, archived bool) ([]*AgentConversation, error)
ListAgentConversations is the main conversation and the named ones.
func ListAgentGoals ¶ added in v0.76.0
func ListAgentGoals(ctx context.Context, connection *Client) ([]*AgentConversation, error)
ListAgentGoals is the conversations whose goal is still in progress: what the agent is keeping track of.
func MarkAgentGoalMet ¶ added in v0.76.0
func MarkAgentGoalMet(ctx context.Context, connection *Client, conversationId string) (*AgentConversation, error)
MarkAgentGoalMet says a conversation's goal is done.
func SearchAgentConversations ¶
func SearchAgentConversations(ctx context.Context, connection *Client, archived bool, query string) ([]*AgentConversation, error)
SearchAgentConversations lists conversations, or finds them by words in the title or in what was said.
func SetAgentMainConversation ¶
func SetAgentMainConversation(ctx context.Context, connection *Client, conversationId string) (*AgentConversation, error)
SetAgentMainConversation makes a named conversation the main one, or starts a fresh main one when none is named; the old main is kept as a named conversation.
func StartAgentConversation ¶
func StartAgentConversation(ctx context.Context, connection *Client, title, goal string) (*AgentConversation, error)
StartAgentConversation begins a named conversation, with a goal on it when one is given.
func UpdateAgentConversation ¶
func UpdateAgentConversation(ctx context.Context, connection *Client, conversationId, title string, archived *bool, goal *string) (*AgentConversation, error)
UpdateAgentConversation renames a conversation, archives it, or sets the goal it works toward; a goal of "" clears the goal, and a nil goal leaves it alone.
type AgentConversationView ¶
type AgentConversationView struct {
Conversation *AgentConversation `json:"conversation"`
Messages []*AgentMessage `json:"messages"`
Total int `json:"total"`
Todos []*AgentTodo `json:"todos"`
}
AgentConversationView is a conversation, a page of its messages, and the task list the agent is keeping in it.
func ReadAgentConversation ¶
func ReadAgentConversation(ctx context.Context, connection *Client, conversationId string, first, offset int) (*AgentConversationView, error)
ReadAgentConversation is a conversation and its newest messages.
type AgentDefinition ¶
type AgentDefinition struct {
Symbol string `json:"symbol"`
Kind string `json:"kind"`
Line int `json:"line"`
DocumentID string `json:"documentId"`
ExternalID string `json:"externalId"`
Title string `json:"title"`
}
AgentDefinition is one place an identifier in the words is defined.
type AgentDocumentExtract ¶
type AgentDocumentExtract struct {
DocumentID string `json:"documentId"`
ExternalID string `json:"externalId"`
Title string `json:"title"`
URL string `json:"url"`
Kind string `json:"kind"`
Author string `json:"author"`
SourceID string `json:"sourceId"`
Source string `json:"source"`
HappenedAt *time.Time `json:"happenedAt"`
Private bool `json:"private"`
From int `json:"from"`
Text string `json:"text"`
Total int `json:"total"`
Next int `json:"next"`
}
AgentDocumentExtract is a document and a slice of its text. Next is where the read that carries on from this one starts, and zero at the end of the document.
func ReadAgentDocument ¶
func ReadAgentDocument(ctx context.Context, connection *Client, documentId string, from, first int) (*AgentDocumentExtract, error)
ReadAgentDocument reads one indexed document from an offset.
type AgentDocumentSearch ¶
type AgentDocumentSearch struct {
Passages []*AgentPassage `json:"passages"`
Definitions []*AgentDefinition `json:"definitions"`
Meaningful bool `json:"meaningful"`
}
AgentDocumentSearch is what a search of what was indexed found. Meaningful is false where the deployment can only search by words.
func SearchAgentDocuments ¶
func SearchAgentDocuments(ctx context.Context, connection *Client, query string, first int, sourceId string) (*AgentDocumentSearch, error)
SearchAgentDocuments finds passages in what the sources indexed: the same search the agent's own knowledge tool runs.
type AgentDraft ¶
type AgentDraft struct {
Text string `json:"text"`
Model string `json:"model"`
RunID string `json:"runId"`
}
AgentDraft is a reply the agent wrote, for the person to read and send.
func DraftReply ¶
func DraftReply(ctx context.Context, connection *Client, itemId, instructions string) (*AgentDraft, error)
DraftReply has the agent write a reply to the message an item holds.
type AgentDream ¶
type AgentDream struct {
ID string `json:"id"`
JobID string `json:"jobId"`
StartedAt time.Time `json:"startedAt"`
FinishedAt *time.Time `json:"finishedAt"`
Digested int `json:"digested"`
Filed int `json:"filed"`
Merged int `json:"merged"`
Rewritten int `json:"rewritten"`
Moved int `json:"moved"`
Dormant int `json:"dormant"`
Embedded int `json:"embedded"`
Backlog int `json:"backlog"`
Coarse bool `json:"coarse"`
Revised int `json:"revised"`
Strengthened int `json:"strengthened"`
Associated int `json:"associated"`
Rehearsed int `json:"rehearsed"`
Gaps int `json:"gaps"`
Unknown int `json:"unknown"`
Tokens int64 `json:"tokens"`
LastError string `json:"lastError"`
// Cost is what its model calls cost, in Currency.
Cost float64 `json:"cost"`
Currency string `json:"currency"`
Proposals []struct {
Kind string `json:"kind"`
Path string `json:"path"`
To string `json:"to"`
Reason string `json:"reason"`
} `json:"proposals"`
}
AgentDream is what the nightly run did.
func ListAgentDreams ¶
ListAgentDreams is what the nightly run did, newest first.
type AgentEdge ¶
type AgentEdge struct {
Relation string `json:"relation"`
Status string `json:"status"`
FromPath string `json:"fromPath"`
ToPath string `json:"toPath"`
}
AgentEdge joins two pages. Status is "stated" or "proposed": a link the nightly walk guessed is read as a guess and not as a fact.
type AgentEvaluationQuestion ¶ added in v0.61.0
type AgentEvaluationQuestion struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
QuestionKind string `json:"questionKind"`
QuestionText string `json:"questionText"`
ExpectedAnswer string `json:"expectedAnswer"`
OutdatedAnswer string `json:"outdatedAnswer,omitempty"`
QuestionState string `json:"questionState"`
IsAnswerFiledAfter bool `json:"isAnswerFiledAfter"`
AnsweredAt *time.Time `json:"answeredAt,omitempty"`
}
AgentEvaluationQuestion is a memory check question as the API gives it.
func ListAgentEvaluationQuestions ¶ added in v0.61.0
func ListAgentEvaluationQuestions(ctx context.Context, connection *Client, questionStates []string) ([]*AgentEvaluationQuestion, error)
ListAgentEvaluationQuestions is the memory check's questions, newest first, in the states given or in all of them.
type AgentEvaluationRun ¶ added in v0.61.0
type AgentEvaluationRun struct {
ID string `json:"id"`
StartedAt time.Time `json:"startedAt"`
FinishedAt *time.Time `json:"finishedAt,omitempty"`
QuestionCount int `json:"questionCount"`
Cost float64 `json:"cost"`
SourceScores []*EvaluationSourceScore `json:"sourceScores"`
}
AgentEvaluationRun is a run of the memory check as the API gives it.
func EvaluateAgentMemoryNow ¶ added in v0.61.0
func EvaluateAgentMemoryNow(ctx context.Context, connection *Client) (*AgentEvaluationRun, error)
EvaluateAgentMemoryNow starts a run of the memory check now, or returns the one under way.
func ListAgentEvaluationRuns ¶ added in v0.61.0
func ListAgentEvaluationRuns(ctx context.Context, connection *Client, first int) ([]*AgentEvaluationRun, error)
ListAgentEvaluationRuns is the memory check's runs, newest first.
type AgentEvent ¶
type AgentEvent struct {
Kind string `json:"kind"`
RunID string `json:"runId"`
Sequence int `json:"sequence"`
Text string `json:"text"`
Tool string `json:"tool"`
CallID string `json:"callId"`
Arguments string `json:"arguments"`
Risk string `json:"risk"`
Note string `json:"note"`
Error string `json:"error"`
At time.Time `json:"at"`
}
AgentEvent is one thing that happened in a run.
type AgentEvidence ¶
type AgentEvidence struct {
Kind string `json:"kind"`
ID string `json:"id"`
Quote string `json:"quote"`
}
AgentEvidence is where a fact came from.
type AgentFact ¶
type AgentFact struct {
ID string `json:"id"`
Number int `json:"number"`
Kind string `json:"kind"`
Text string `json:"text"`
HappenedAt *time.Time `json:"happenedAt"`
Confidence float32 `json:"confidence"`
Inferred bool `json:"inferred"`
Evidence []AgentEvidence `json:"evidence"`
Audiences []string `json:"audiences"`
Dormant bool `json:"dormant"`
CreatedAt time.Time `json:"createdAt"`
}
AgentFact is one sentence on a page.
type AgentFeedback ¶
type AgentFeedback struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
Kind string `json:"kind"`
MailID string `json:"mailId"`
Said string `json:"said"`
}
AgentFeedback is a correction recorded from the person's own action.
func ListAgentCorrections ¶
func ListAgentCorrections(ctx context.Context, connection *Client, first int) ([]*AgentFeedback, error)
ListAgentCorrections is what the person corrected, newest first.
type AgentGraphPage ¶
type AgentGraphPage struct {
Node *AgentNode `json:"node"`
Facts []*AgentFact `json:"facts"`
Edges []*AgentEdge `json:"edges"`
Children []*AgentNode `json:"children"`
Contact *Contact `json:"contact"`
}
AgentGraphPage is a page and everything a reader of it wants.
func AgentGraphPageOf ¶
func AgentGraphPageOf(ctx context.Context, connection *Client, path string) (*AgentGraphPage, error)
AgentGraphPageOf is one page with its facts and links.
type AgentGraphSearch ¶
type AgentGraphSearch struct {
Nodes []*AgentNode `json:"nodes"`
Facts []*AgentLearnedFact `json:"facts"`
}
AgentGraphSearch is what words found.
func SearchAgentGraph ¶
func SearchAgentGraph(ctx context.Context, connection *Client, query string, first int) (*AgentGraphSearch, error)
SearchAgentGraph finds pages and facts by words.
type AgentIdea ¶ added in v0.76.0
type AgentIdea struct {
ID string `json:"id"`
IdeaKey string `json:"ideaKey"`
IdeaKind string `json:"ideaKind"`
IdeaCategory string `json:"ideaCategory"`
Emoji string `json:"emoji"`
Headline string `json:"headline"`
Body string `json:"body"`
OpeningRequest string `json:"openingRequest"`
NeededToolNames []string `json:"neededToolNames"`
Evidence []AgentIdeaEvidence `json:"evidence"`
SuggestionReason string `json:"suggestionReason"`
IdeaStatus string `json:"ideaStatus"`
StartedConversationID string `json:"startedConversationId"`
CreatedAt time.Time `json:"createdAt"`
ShownAt *time.Time `json:"shownAt"`
StartedAt *time.Time `json:"startedAt"`
ClosedAt *time.Time `json:"closedAt"`
ExpiresAt *time.Time `json:"expiresAt"`
}
AgentIdea is one idea.
func ListAgentIdeas ¶ added in v0.76.0
func ListAgentIdeas(ctx context.Context, connection *Client, statuses, kinds []string) ([]*AgentIdea, error)
ListAgentIdeas is the ideas in the statuses and kinds given, or in all.
func ProposeAgentIdea ¶ added in v0.76.0
func ProposeAgentIdea(ctx context.Context, connection *Client, proposal *AgentIdeaProposal) (*AgentIdea, error)
ProposeAgentIdea keeps an idea, once it passes the check every idea passes.
type AgentIdeaEvidence ¶ added in v0.76.0
type AgentIdeaEvidence struct {
EvidenceKind string `json:"evidenceKind"`
EvidenceID string `json:"evidenceId"`
EvidenceSummary string `json:"evidenceSummary"`
}
AgentIdeaEvidence is one thing that prompted a personal idea.
type AgentIdeaProposal ¶ added in v0.76.0
type AgentIdeaProposal struct {
IdeaCategory string `json:"ideaCategory"`
Emoji string `json:"emoji"`
Headline string `json:"headline"`
Body string `json:"body"`
OpeningRequest string `json:"openingRequest"`
NeededToolNames []string `json:"neededToolNames"`
Evidence []AgentIdeaEvidence `json:"evidence"`
SuggestionReason string `json:"suggestionReason"`
ExpiresOn string `json:"expiresOn"`
}
AgentIdeaProposal is an idea to keep.
type AgentJob ¶
type AgentJob struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
AgentID string `json:"agentId"`
MailboxID string `json:"mailboxId"`
Kind string `json:"kind"`
SubjectID string `json:"subjectId"`
Status string `json:"status"`
Attempts int `json:"attempts"`
Error string `json:"error"`
FinishedAt *time.Time `json:"finishedAt"`
}
AgentJob is one job of the worker.
func ListAgentDeadLetters ¶
ListAgentDeadLetters is the jobs the worker gave up on.
type AgentKnowledgeSource ¶
type AgentKnowledgeSource struct {
ID string `json:"id"`
Kind string `json:"kind"`
Name string `json:"name"`
Specification AgentKnowledgeSpecification `json:"specification"`
RootPath string `json:"rootPath"`
Enabled bool `json:"enabled"`
Cron string `json:"cron"`
LastRunAt *time.Time `json:"lastRunAt"`
NextRunAt *time.Time `json:"nextRunAt"`
LastError string `json:"lastError"`
DocumentCount int `json:"documentCount"`
ChunkCount int `json:"chunkCount"`
RefusedCount int `json:"refusedCount"`
More bool `json:"more"`
UnknownAuthors []string `json:"unknownAuthors"`
// CheckoutsKeptToProfile is how many checkouts under this source were
// kept to what git says about them, and FilesKeptToProfile how many
// files that was.
CheckoutsKeptToProfile int `json:"checkoutsKeptToProfile"`
FilesKeptToProfile int `json:"filesKeptToProfile"`
}
AgentKnowledgeSource is a place the agent reads.
func ListAgentKnowledgeSources ¶
func ListAgentKnowledgeSources(ctx context.Context, connection *Client) ([]*AgentKnowledgeSource, error)
ListAgentKnowledgeSources is what the agent reads.
func SaveAgentKnowledgeSource ¶
func SaveAgentKnowledgeSource(ctx context.Context, connection *Client, fields map[string]any) (*AgentKnowledgeSource, error)
SaveAgentKnowledgeSource adds one, or changes one.
type AgentKnowledgeSpecification ¶
type AgentKnowledgeSpecification struct {
// Type is the source type this source is one of, and Settings what
// was filled in for it.
Type string `json:"type"`
Settings json.RawMessage `json:"settings"`
Computer string `json:"computer"`
Path string `json:"path"`
Format string `json:"format"`
Include []string `json:"include"`
Exclude []string `json:"exclude"`
Tool string `json:"tool"`
Start string `json:"start"`
Depth int `json:"depth"`
MailboxID string `json:"mailboxId"`
// ReadEveryCheckout reads the files of every checkout under this
// source, the person's own and the ones they cloned alike.
ReadEveryCheckout bool `json:"readEveryCheckout"`
// CommitsPerPass is how many commits one pass over this source's
// tree carries; zero is the pace the program on the machine reads
// at.
CommitsPerPass int `json:"commitsPerPass"`
// OwnCommitsAtLeast is the fewest commits of the person's own a
// checkout under this source must hold before its files are read;
// zero is the floor the program on the machine reads at.
OwnCommitsAtLeast int `json:"ownCommitsAtLeast"`
}
AgentKnowledgeSpecification says what a source reads.
type AgentLearnedFact ¶
type AgentLearnedFact struct {
Fact *AgentFact `json:"fact"`
Path string `json:"path"`
Name string `json:"name"`
}
AgentLearnedFact is a fact with the page it sits on.
func ListAgentLearned ¶
func ListAgentLearned(ctx context.Context, connection *Client, days, first int) ([]*AgentLearnedFact, error)
ListAgentLearned is what has been filed lately.
type AgentMemory ¶
type AgentMemory struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
ModifiedAt time.Time `json:"modifiedAt"`
Title string `json:"title"`
Content string `json:"content"`
Tags []string `json:"tags"`
AppliesTo []string `json:"appliesTo"`
Pinned bool `json:"pinned"`
UsedAt *time.Time `json:"usedAt"`
}
AgentMemory is a durable fact the agent keeps about the person.
func ListAgentMemories ¶
func ListAgentMemories(ctx context.Context, connection *Client, audience, query string, first int) ([]*AgentMemory, error)
ListAgentMemories is what the agent remembers, pinned first; searched when words are given.
func SaveAgentMemory ¶
func SaveAgentMemory(ctx context.Context, connection *Client, memoryId string, fields map[string]any) (*AgentMemory, error)
SaveAgentMemory adds a memory, or changes one when memoryId is given.
type AgentMessage ¶
type AgentMessage struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
Role string `json:"role"`
Content string `json:"content"`
Name string `json:"name"`
ToolCallID string `json:"toolCallId"`
ToolCalls []AgentToolCall `json:"toolCalls"`
Usage *AgentUsageNote `json:"usage"`
Attachments []AgentAttachment `json:"attachments"`
References []AgentReference `json:"references"`
}
AgentMessage is one turn, tool call or result of a conversation.
type AgentNode ¶
type AgentNode struct {
ID string `json:"id"`
Path string `json:"path"`
Kind string `json:"kind"`
Name string `json:"name"`
Aliases []string `json:"aliases"`
Summary string `json:"summary"`
ContactID string `json:"contactId"`
Pinned bool `json:"pinned"`
Importance float32 `json:"importance"`
Dormant bool `json:"dormant"`
UsedAt *time.Time `json:"usedAt"`
ModifiedAt time.Time `json:"modifiedAt"`
}
AgentNode is one page of the graph.
func AgentGraphIndex ¶
func AgentGraphIndex(ctx context.Context, connection *Client, under string, first int) ([]*AgentNode, error)
AgentGraphIndex is the pages, under a path or the whole graph.
func MergeAgentNodes ¶
func MergeAgentNodes(ctx context.Context, connection *Client, path, into string) (*AgentNode, error)
MergeAgentNodes folds one page into another.
func MoveAgentNode ¶
MoveAgentNode files a page under another.
type AgentPageRevision ¶
type AgentPageRevision struct {
Revision int `json:"revision"`
Kind string `json:"kind"`
Actor string `json:"actor"`
Summary string `json:"summary"`
Change string `json:"change"`
Before string `json:"before"`
After string `json:"after"`
Path string `json:"path"`
Reason string `json:"reason"`
CreatedAt time.Time `json:"createdAt"`
}
AgentPageRevision is one change to a page.
func ListAgentPageHistory ¶
func ListAgentPageHistory(ctx context.Context, connection *Client, path string, first int) ([]*AgentPageRevision, error)
ListAgentPageHistory is what has happened to one page, newest first.
type AgentPassage ¶
type AgentPassage struct {
DocumentID string `json:"documentId"`
ExternalID string `json:"externalId"`
Title string `json:"title"`
URL string `json:"url"`
Kind string `json:"kind"`
Author string `json:"author"`
SourceID string `json:"sourceId"`
Source string `json:"source"`
HappenedAt *time.Time `json:"happenedAt"`
Private bool `json:"private"`
Number int `json:"number"`
Text string `json:"text"`
Score float64 `json:"score"`
}
AgentPassage is one passage a search of what was indexed found, with enough of the document it came from to cite it.
type AgentReadingProgress ¶
type AgentReadingProgress struct {
Waiting int64 `json:"waiting"`
Read int64 `json:"read"`
PerHour float64 `json:"perHour"`
HoursLeft float64 `json:"hoursLeft"`
Bootstrapping bool `json:"bootstrapping"`
}
AgentReadingProgress is how far the night has got through what was indexed, and how long the rest takes at the pace of the last dreams.
func ReadAgentReadingProgress ¶
func ReadAgentReadingProgress(ctx context.Context, connection *Client) (*AgentReadingProgress, error)
ReadAgentReadingProgress asks how far the reading has got.
type AgentRecall ¶
type AgentRecall struct {
Pages []*AgentRecalledPage `json:"pages"`
}
AgentRecall is what a turn asking a question would have been carried from the graph: the pages, each with the facts recall would have put in front of the model.
func RecallAgentMemory ¶
func RecallAgentMemory(ctx context.Context, connection *Client, question string) (*AgentRecall, error)
RecallAgentMemory is what a turn asking this question would have been carried from the graph. It asks nothing of a model and changes nothing.
type AgentRecalledFact ¶
AgentRecalledFact is a fact as the page cites it.
type AgentRecalledPage ¶
type AgentRecalledPage struct {
Path string `json:"path"`
Facts []*AgentRecalledFact `json:"facts"`
}
AgentRecalledPage is one of those pages.
type AgentReference ¶
type AgentReference struct {
ItemID string `json:"itemId,omitempty"`
ThreadID string `json:"threadId,omitempty"`
Subject string `json:"subject,omitempty"`
From string `json:"from,omitempty"`
}
AgentReference is a thread the person pointed at with a turn.
type AgentReply ¶
type AgentReply struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
ModifiedAt time.Time `json:"modifiedAt"`
AgentID string `json:"agentId"`
MailboxID string `json:"mailboxId"`
MailID string `json:"mailId"`
ThreadID string `json:"threadId"`
DraftItemID string `json:"draftItemId"`
RunID string `json:"runId"`
Status string `json:"status"`
Reason string `json:"reason"`
Subject string `json:"subject"`
From string `json:"from"`
To string `json:"to"`
Text string `json:"text"`
SendAfter *time.Time `json:"sendAfter"`
SentMailID string `json:"sentMailId"`
SentAt *time.Time `json:"sentAt"`
}
AgentReply is a reply the agent wrote on the person's behalf.
func CancelAgentReply ¶
CancelAgentReply cancels a reply the agent is holding.
type AgentReplyPage ¶
type AgentReplyPage struct {
Replies []*AgentReply `json:"replies"`
Total int64 `json:"total"`
}
AgentReplyPage is a page of replies.
func ListAgentReplies ¶
func ListAgentReplies(ctx context.Context, connection *Client, mailboxId, status string, first, offset int) (*AgentReplyPage, error)
ListAgentReplies is the replies the agent wrote, newest first.
type AgentRun ¶
type AgentRun struct {
RunID string `json:"runId"`
Events []*AgentEvent `json:"events"`
Done bool `json:"done"`
}
AgentRun is what happened in a run from a point on.
type AgentRunFilter ¶
AgentRunFilter narrows a listing of runs: to the runs one job made, to some kinds of run, or to the titles carrying some words.
type AgentRunSummary ¶
type AgentRunSummary struct {
ID string `json:"id"`
AgentID string `json:"agentId"`
Title string `json:"title"`
JobID string `json:"jobId"`
JobKind string `json:"jobKind"`
SubjectID string `json:"subjectId"`
LastAt time.Time `json:"lastAt"`
Usage struct {
PromptTokens int `json:"promptTokens"`
CacheReadTokens int `json:"cacheReadTokens"`
CompletionTokens int `json:"completionTokens"`
Cost float64 `json:"cost"`
} `json:"usage"`
}
AgentRunSummary is one run as a list shows it, with what it cost.
func ListAgentRuns ¶
func ListAgentRuns(ctx context.Context, connection *Client, first, offset int, jobId string) ([]*AgentRunSummary, int64, error)
ListAgentRuns is a page of the transcripts of runs, newest first, and how many there are in all.
func ListAllAgentRuns ¶
func ListAllAgentRuns(ctx context.Context, connection *Client, first, offset int, agentId string) ([]*AgentRunSummary, int64, error)
ListAllAgentRuns is every person's runs, for an operator with agent:act; an agent narrows it to one person's.
func SearchAgentRuns ¶
func SearchAgentRuns(ctx context.Context, connection *Client, first, offset int, filter *AgentRunFilter) ([]*AgentRunSummary, int64, error)
SearchAgentRuns is ListAgentRuns narrowed by a filter.
func SearchAllAgentRuns ¶
func SearchAllAgentRuns(ctx context.Context, connection *Client, first, offset int, agentId string, filter *AgentRunFilter) ([]*AgentRunSummary, int64, error)
SearchAllAgentRuns is ListAllAgentRuns narrowed by a filter.
type AgentSchedule ¶
type AgentSchedule struct {
ID string `json:"id"`
Name string `json:"name"`
Cron string `json:"cron"`
Prompt string `json:"prompt"`
Deliver string `json:"deliver"`
Enabled bool `json:"enabled"`
LastRunAt *time.Time `json:"lastRunAt"`
NextRunAt *time.Time `json:"nextRunAt"`
}
AgentSchedule is a prompt the agent runs at set times.
func ListAgentSchedules ¶
func ListAgentSchedules(ctx context.Context, connection *Client) ([]*AgentSchedule, error)
ListAgentSchedules is the person's schedules.
func RunAgentBriefNow ¶
func RunAgentBriefNow(ctx context.Context, connection *Client) (*AgentSchedule, error)
RunAgentBriefNow sends one immediately.
func SaveAgentSchedule ¶
func SaveAgentSchedule(ctx context.Context, connection *Client, scheduleId string, fields map[string]any) (*AgentSchedule, error)
SaveAgentSchedule adds a schedule, or changes one when scheduleId is given.
func SetAgentBrief ¶
func SetAgentBrief(ctx context.Context, connection *Client, enabled bool, at string, days []int) (*AgentSchedule, error)
SetAgentBrief turns the daily brief on or off and says when it comes.
type AgentServer ¶
type AgentServer struct {
Name string `json:"name"`
Transport string `json:"transport"`
Location string `json:"location"`
Auth string `json:"auth"`
Headless bool `json:"headless"`
Enabled bool `json:"enabled"`
Status string `json:"status"`
LastError string `json:"lastError"`
LastConnectedAt *time.Time `json:"lastConnectedAt"`
Tools int `json:"tools"`
}
AgentServer is a declared server as the person sees it.
func ConnectAgentServer ¶
func ConnectAgentServer(ctx context.Context, connection *Client, server, credential string) (*AgentServer, error)
ConnectAgentServer connects a server with the person's credential.
func DisconnectAgentServer ¶
func DisconnectAgentServer(ctx context.Context, connection *Client, server string) (*AgentServer, error)
DisconnectAgentServer forgets the person's credential for a server.
func FinishAgentServerOAuth ¶
func FinishAgentServerOAuth(ctx context.Context, connection *Client, server, code, state string) (*AgentServer, error)
FinishAgentServerOAuth hands back what the authorization came back with.
func ListAgentServers ¶
func ListAgentServers(ctx context.Context, connection *Client) ([]*AgentServer, error)
ListAgentServers is the declared servers and where the person stands.
type AgentSkill ¶
type AgentSkill struct {
Name string `json:"name"`
Description string `json:"description"`
Version string `json:"version"`
Publisher string `json:"publisher"`
Enabled bool `json:"enabled"`
Readable bool `json:"readable"`
Problem string `json:"problem,omitempty"`
Secrets []string `json:"secrets"`
PersonalSecrets []string `json:"personalSecrets"`
Scope string `json:"scope"`
Tools []*AgentSkillTool `json:"tools"`
}
AgentSkill is an installed skill.
func InstallAgentSkill ¶
InstallAgentSkill installs one, or replaces it with a newer version.
func ListAgentSkills ¶
func ListAgentSkills(ctx context.Context, connection *Client) ([]*AgentSkill, error)
ListAgentSkills is what is installed here.
func SetAgentSkillEnabled ¶
func SetAgentSkillEnabled(ctx context.Context, connection *Client, name string, enabled bool) (*AgentSkill, error)
SetAgentSkillEnabled offers a skill's tools or stops offering them.
func SetAgentSkillScope ¶
func SetAgentSkillScope(ctx context.Context, connection *Client, name, scope string) (*AgentSkill, error)
SetAgentSkillScope settles who fills a skill's secrets in: "operator", "person", or empty to leave it to what the skill declares.
type AgentSkillOffer ¶
type AgentSkillOffer struct {
Name string `json:"name"`
Description string `json:"description"`
Version string `json:"version"`
Tags []string `json:"tags"`
Installed string `json:"installed,omitempty"`
Newer bool `json:"newer"`
}
AgentSkillOffer is one skill the registry publishes.
func SearchAgentSkills ¶
func SearchAgentSkills(ctx context.Context, connection *Client, query string) ([]*AgentSkillOffer, error)
SearchAgentSkills is what the registry offers.
type AgentSkillSecret ¶
type AgentSkillSecret struct {
Skill string `json:"skill"`
Key string `json:"key"`
Description string `json:"description"`
Set bool `json:"set"`
}
AgentSkillSecret is one value an installed skill asks a person for.
func ListAgentSkillSecrets ¶
func ListAgentSkillSecrets(ctx context.Context, connection *Client) ([]*AgentSkillSecret, error)
ListAgentSkillSecrets is what the installed skills ask this person for.
func SetAgentSkillSecret ¶
func SetAgentSkillSecret(ctx context.Context, connection *Client, skill, key, value string) (*AgentSkillSecret, error)
SetAgentSkillSecret keeps one of this person's values.
type AgentSkillTool ¶
type AgentSkillTool struct {
Name string `json:"name"`
Description string `json:"description"`
Kind string `json:"kind"`
NeedsComputer bool `json:"needsComputer"`
}
AgentSkillTool is one tool a skill declares.
type AgentSource ¶
type AgentSource struct {
MailboxID string `json:"mailboxId"`
Name string `json:"name"`
Addresses []string `json:"addresses"`
Policy json.RawMessage `json:"policy"`
}
AgentSource is one mailbox as a source.
type AgentSourceSecret ¶ added in v0.55.0
type AgentSourceSecret struct {
Key string `json:"key"`
Description string `json:"description"`
IsOptional bool `json:"isOptional"`
IsSet bool `json:"isSet"`
}
AgentSourceSecret is one secret a source's type asks for.
func ListAgentKnowledgeSourceSecrets ¶ added in v0.55.0
func ListAgentKnowledgeSourceSecrets(ctx context.Context, connection *Client, sourceId string) ([]*AgentSourceSecret, error)
ListAgentKnowledgeSourceSecrets is what a source's type asks for, and whether each is filled in.
func SetAgentKnowledgeSourceSecret ¶ added in v0.55.0
func SetAgentKnowledgeSourceSecret(ctx context.Context, connection *Client, sourceId, key, value string) (*AgentSourceSecret, error)
SetAgentKnowledgeSourceSecret keeps one value for a source.
type AgentSourceType ¶ added in v0.54.0
type AgentSourceType struct {
Name string `json:"name"`
Description string `json:"description"`
Version string `json:"version"`
Publisher string `json:"publisher"`
IsLocal bool `json:"isLocal"`
Reader string `json:"reader"`
Runs []string `json:"runs"`
Requires []string `json:"requires"`
Settings []*AgentSourceTypeSetting `json:"settings"`
Secrets []*AgentSourceSecret `json:"secrets"`
Guide string `json:"guide"`
Readable bool `json:"readable"`
Problem string `json:"problem,omitempty"`
}
AgentSourceType is an installed source type.
func AddLocalAgentSourceType ¶ added in v0.54.0
func AddLocalAgentSourceType(ctx context.Context, connection *Client, content string) (*AgentSourceType, error)
AddLocalAgentSourceType adds the operator's own file as a local type.
func InstallAgentSourceType ¶ added in v0.54.0
func InstallAgentSourceType(ctx context.Context, connection *Client, name string) (*AgentSourceType, error)
InstallAgentSourceType installs one, or replaces it with a newer version.
func ListAgentSourceTypes ¶ added in v0.54.0
func ListAgentSourceTypes(ctx context.Context, connection *Client) ([]*AgentSourceType, error)
ListAgentSourceTypes is what is installed here.
type AgentSourceTypeOffer ¶ added in v0.54.0
type AgentSourceTypeOffer struct {
Name string `json:"name"`
Description string `json:"description"`
Version string `json:"version"`
Tags []string `json:"tags"`
Installed string `json:"installed,omitempty"`
Newer bool `json:"newer"`
}
AgentSourceTypeOffer is one type the registry publishes.
func SearchAgentSourceTypes ¶ added in v0.54.0
func SearchAgentSourceTypes(ctx context.Context, connection *Client, query string) ([]*AgentSourceTypeOffer, error)
SearchAgentSourceTypes is what the registry offers.
type AgentSourceTypeSetting ¶ added in v0.54.0
type AgentSourceTypeSetting struct {
Name string `json:"name"`
Description string `json:"description"`
SettingType string `json:"settingType"`
Pattern string `json:"pattern"`
ItemPattern string `json:"itemPattern"`
Default json.RawMessage `json:"default"`
IsRequired bool `json:"isRequired"`
Minimum *int `json:"minimum"`
Maximum *int `json:"maximum"`
}
AgentSourceTypeSetting is one setting a type asks for.
type AgentSummary ¶
type AgentSummary struct {
AgentID string `json:"agentId"`
UserID string `json:"userId"`
Username string `json:"username"`
Name string `json:"name"`
Enabled bool `json:"enabled"`
OperatorDisabledAt *time.Time `json:"operatorDisabledAt"`
DailyTokens int64 `json:"dailyTokens"`
DailyCost float64 `json:"dailyCost"`
Sources []*AgentSource `json:"sources"`
Today *AgentBudget `json:"today"`
LastRunAt *time.Time `json:"lastRunAt"`
Dead int64 `json:"dead"`
Queued int64 `json:"queued"`
}
AgentSummary is one person's agent as an operator sees it.
func ListAgents ¶
func ListAgents(ctx context.Context, connection *Client) ([]*AgentSummary, error)
ListAgents is every person's agent, for an operator.
func SetAgentDisabled ¶
func SetAgentDisabled(ctx context.Context, connection *Client, agentId string, disabled bool) (*AgentSummary, error)
SetAgentDisabled switches a person's agent off or on.
func SetAgentLimit ¶
func SetAgentLimit(ctx context.Context, connection *Client, agentId string, dailyTokens *int64, dailyCost *float64) (*AgentSummary, error)
SetAgentLimit sets one person's daily budget. SetAgentLimit changes a person's daily budget. A nil budget is left as it is, so one can be set without clearing the other.
type AgentTodo ¶
type AgentTodo struct {
ID string `json:"id"`
ConversationID string `json:"conversationId"`
Text string `json:"text"`
CreatedAt time.Time `json:"createdAt"`
DoneAt *time.Time `json:"doneAt"`
}
AgentTodo is one item of a conversation's task list.
type AgentTool ¶
type AgentTool struct {
Name string `json:"name"`
Family string `json:"family"`
Risk string `json:"risk"`
Description string `json:"description"`
Confirms bool `json:"confirms"`
Core bool `json:"core"`
}
AgentTool is one tool as the caller sees it.
type AgentToolCall ¶
type AgentToolCall struct {
ID string `json:"id"`
Name string `json:"name"`
Arguments string `json:"arguments"`
}
AgentToolCall is a tool the model asked for.
type AgentTurn ¶
AgentTurn is the run a turn started.
func AskAgent ¶
func AskAgent(ctx context.Context, connection *Client, conversationId, message, surface string) (*AgentTurn, error)
AskAgent says something to the agent and returns the run to follow. A read-only client asks with every changing tool left out, which is why it may send this one mutation.
func AskAgentWith ¶
func AskAgentWith(ctx context.Context, connection *Client, request *AskAgentRequest) (*AgentTurn, error)
AskAgentWith is AskAgent with files and references.
type AgentUsageNote ¶
type AgentUsageNote struct {
Model string `json:"model"`
Kind string `json:"kind"`
PromptTokens int `json:"promptTokens"`
CompletionTokens int `json:"completionTokens"`
}
AgentUsageNote is what one model call cost.
type AgentUsageRow ¶
type AgentUsageRow struct {
Key string `json:"key"`
Cost float64 `json:"cost"`
Currency string `json:"currency"`
Totals struct {
PromptTokens int64 `json:"promptTokens"`
CompletionTokens int64 `json:"completionTokens"`
CacheReadTokens int64 `json:"cacheReadTokens"`
CacheWriteTokens int64 `json:"cacheWriteTokens"`
Calls int64 `json:"calls"`
} `json:"totals"`
}
AgentUsageRow is totals under one key.
func AgentServerUsage ¶
func AgentServerUsage(ctx context.Context, connection *Client, since *time.Time, by string) ([]*AgentUsageRow, error)
AgentServerUsage is token use across the server, for an operator.
func AgentUsage ¶
func AgentUsage(ctx context.Context, connection *Client, since *time.Time, by string) ([]*AgentUsageRow, error)
AgentUsage is the caller's own token use.
type AgentView ¶
type AgentView struct {
Agent json.RawMessage `json:"agent"`
Sources []*AgentSource `json:"sources"`
Collections []*AgentCollection `json:"collections"`
Allowed map[string]bool `json:"allowed"`
Budget *AgentBudget `json:"budget"`
Choices []string `json:"choices"`
Timezone string `json:"timezone"`
Language string `json:"language"`
// KnowledgeLanguage is what the agent's notes are written in.
KnowledgeLanguage string `json:"knowledgeLanguage"`
Categories []string `json:"categories"`
}
AgentView is what ReadAgent returns.
func GrantAgentMailbox ¶
func GrantAgentMailbox(ctx context.Context, connection *Client, mailboxId string, policy any) (*AgentView, error)
GrantAgentMailbox lets the agent reach a mailbox, with a policy or the stored one.
func GrantAgentSource ¶
func GrantAgentSource(ctx context.Context, connection *Client, kind, id string, granted bool) (*AgentView, error)
GrantAgentSource gives the agent a calendar or an address book, or takes it back.
type Alias ¶
type Alias struct {
ID string `json:"id"`
Pattern string `json:"pattern"`
Comment string `json:"comment"`
Kind string `json:"kind"`
Email string `json:"email"`
Webhook string `json:"webhook"`
MailServer *MailServer `json:"mailServer"`
MailboxID string `json:"mailboxId"`
Disabled bool `json:"disabled"`
}
Alias matches recipient addresses and says where the mail goes.
func CreateAlias ¶
func CreateAlias(ctx context.Context, connection *Client, domainId string, parameters *AliasParameters) (*Alias, error)
CreateAlias adds an alias to a domain.
func ListAliases ¶
ListAliases returns a domain's aliases in the order they are evaluated.
func MatchAliases ¶
func MatchAliases(ctx context.Context, connection *Client, domainId, address string) ([]*Alias, error)
MatchAliases returns the aliases an address would match.
func UpdateAlias ¶
func UpdateAlias(ctx context.Context, connection *Client, aliasId string, parameters *AliasParameters) (*Alias, error)
UpdateAlias changes an alias.
func (*Alias) Destination ¶
Destination is where an alias sends mail, as one string for a table.
type AliasParameters ¶
type AliasParameters struct {
Pattern string `json:"pattern"`
Comment *string `json:"comment,omitempty"`
Kind string `json:"kind"`
Email *string `json:"email,omitempty"`
Webhook *string `json:"webhook,omitempty"`
MailServer *MailServerParameters `json:"mailServer,omitempty"`
MailboxID *string `json:"mailboxId,omitempty"`
Disabled *bool `json:"disabled,omitempty"`
}
AliasParameters are the settings of an alias an operator can set. Pattern and Kind left empty keep what is stored; the pointers left nil do too.
type App ¶ added in v0.53.0
type App struct {
ClientID string `json:"clientId"`
Name string `json:"name"`
RegisteredName string `json:"registeredName"`
RedirectHosts []string `json:"redirectHosts"`
Registered *time.Time `json:"registered"`
LastUsed *time.Time `json:"lastUsed"`
LastUsedIP string `json:"lastUsedIp"`
Expires *time.Time `json:"expires"`
RenewableUntil *time.Time `json:"renewableUntil"`
TokenCount int `json:"tokenCount"`
}
App is a program somebody authorized, holding a token of theirs that it renews by itself.
type Argument ¶
type Argument struct {
Name string
Description string
Type *TypeReference
}
Argument is one argument of an operation or input object field.
type AskAgentRequest ¶
type AskAgentRequest struct {
ConversationID string
Message string
Surface string
AttachmentIDs []string
References []AgentReference
// Effort is how hard the model thinks: low, medium or high; empty
// leaves it to the agent.
Effort string
}
AskAgentRequest is one turn with everything that may come with it.
type Attachment ¶
type Attachment struct {
Index int `json:"index"`
Filename string `json:"filename"`
ContentType string `json:"contentType"`
Size int `json:"size"`
Inline bool `json:"inline"`
}
Attachment is a file attached to a message.
type AttachmentParameters ¶
type AttachmentParameters struct {
Filename string `json:"filename"`
ContentType string `json:"contentType,omitempty"`
Content []byte `json:"content"`
}
AttachmentParameters is a file to attach to a message being sent.
type AuditEvent ¶
type AuditEvent struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
ActorKind string `json:"actorKind"`
ActorUserID string `json:"actorUserId"`
ActorLabel string `json:"actorLabel"`
TokenID string `json:"tokenId"`
SourceIP string `json:"sourceIp"`
ResourceType string `json:"resourceType"`
ResourceID string `json:"resourceId"`
Action string `json:"action"`
Before json.RawMessage `json:"before"`
After json.RawMessage `json:"after"`
}
AuditEvent is one administrative change: who made it, to what, and the row before and after.
type AuditEventPage ¶
type AuditEventPage struct {
Events []*AuditEvent `json:"events"`
Total int `json:"total"`
}
AuditEventPage is a page of the audit log, and how many there are in all.
func ListAuditEvents ¶
func ListAuditEvents(ctx context.Context, connection *Client, filter *AuditFilter) (*AuditEventPage, error)
ListAuditEvents returns a page of the audit log, newest first.
type AuditFilter ¶
type AuditFilter struct {
ResourceType string
ResourceID string
ActorUserID string
Since *time.Time
Until *time.Time
First int
Offset int
}
AuditFilter narrows the audit log.
type Calendar ¶
type Calendar struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Colour string `json:"colour,omitempty"`
Timezone string `json:"timezone,omitempty"`
WeekStart string `json:"weekStart,omitempty"`
Events int `json:"events"`
// CalendarKind is what it holds: events, or reminders.
CalendarKind string `json:"calendarKind"`
// AgentGranted says the person has given their agent this one.
AgentGranted bool `json:"agentGranted"`
}
Calendar is one calendar and how much is in it.
func ListCalendars ¶
ListCalendars are the caller's. An account that has never had one is given one by the server when it first looks.
type CalendarAttendee ¶
type CalendarAttendee struct {
Address string `json:"address"`
Name string `json:"name,omitempty"`
Participation string `json:"participation,omitempty"`
Role string `json:"role,omitempty"`
}
CalendarAttendee is one person asked to an event.
type CalendarEvent ¶
type CalendarEvent struct {
ID string `json:"id"`
CalendarID string `json:"calendarId"`
UID string `json:"uid"`
ETag string `json:"etag,omitempty"`
Summary string `json:"summary,omitempty"`
Location string `json:"location,omitempty"`
Description string `json:"description,omitempty"`
StartsAt string `json:"startsAt"`
EndsAt string `json:"endsAt"`
AllDay bool `json:"allDay"`
Recurring bool `json:"recurring"`
Recurrence string `json:"recurrence,omitempty"`
Occurrence bool `json:"occurrence"`
Status string `json:"status,omitempty"`
Timezone string `json:"timezone,omitempty"`
Organizer string `json:"organizer,omitempty"`
Attendees []*CalendarAttendee `json:"attendees,omitempty"`
File string `json:"file,omitempty"`
}
CalendarEvent is one entry. In a listing it is one time something happens, so an event that repeats weekly appears once for each week in the window; StartsAt and EndsAt are that occurrence rather than the event's own first time. File is the whole of it and comes back only when one is asked for.
func GetCalendarEvent ¶
func GetCalendarEvent(ctx context.Context, connection *Client, calendarId, id string) (*CalendarEvent, error)
GetCalendarEvent is one event, with the file as it is stored.
func ListCalendarEvents ¶
func ListCalendarEvents(ctx context.Context, connection *Client, calendarId, from, until string) ([]*CalendarEvent, error)
ListCalendarEvents is what is on between two moments, written as RFC 3339.
func SaveCalendarEvent ¶
func SaveCalendarEvent(ctx context.Context, connection *Client, fields *SaveCalendarEventFields) (*CalendarEvent, error)
SaveCalendarEvent keeps one, or changes one that is kept.
type CalendarRequest ¶ added in v0.48.0
type CalendarRequest struct {
RequestID string `json:"requestId"`
CalendarID string `json:"calendarId"`
ObjectID string `json:"objectId"`
Operation string `json:"operation"`
CompletedAt time.Time `json:"completedAt"`
IsMissing bool `json:"isMissing"`
}
CalendarRequest identifies a committed change even when its event was deleted.
func CancelCalendarRequest ¶ added in v0.48.0
func CancelCalendarRequest(ctx context.Context, connection *Client, requestId string) (*CalendarRequest, error)
CancelCalendarRequest stops future execution or returns an already completed change. It never undoes the event or mail belonging to a completed request.
func GetCalendarRequest ¶ added in v0.48.0
func GetCalendarRequest(ctx context.Context, connection *Client, requestId string) (*CalendarRequest, error)
GetCalendarRequest looks up completion without repeating the original mutation. A nil receipt does not prove that an in-flight request will never commit.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a connection to one server's API.
func Local ¶
func Local(configuration *config.Configuration, readOnly bool) (*Client, error)
Local builds a Client for the server described by a configuration file, connecting over the loopback interface and authenticating with a token minted from the server secret.
This is what "teanode credential add" uses when it is run on the server, and the reason no token has to be set up before the tool is usable there. readOnly refuses mutations, as it does for a client over the network.
func (*Client) Download ¶
Download fetches something that is a file rather than a GraphQL reply — the raw source of a stored message — with the same credentials. The caller closes the body. A reply that is not a success is returned as an error, so that a "not found" page is never saved as though it were the file.
func (*Client) Execute ¶
func (self *Client) Execute(ctx context.Context, query string, variables map[string]any, result any) error
Execute runs a query or mutation and decodes the data into result, which should be a pointer to a struct with the field names the query selects.
func (*Client) PostJSON ¶
PostJSON sends a JSON body to a path beside the GraphQL endpoint and hands back what came of it, with the same credentials and the same verification of the server's certificate.
For an endpoint that is not GraphQL and is not a file: the Model Context Protocol, whose messages are JSON-RPC and whose answers are the same. The caller closes the body and reads whatever status came back, because this protocol says things in the body that HTTP would say with a code.
func (*Client) SetTimeout ¶ added in v0.66.0
SetTimeout changes how long a single request may take, for the few that run a whole agent turn before they answer.
func (*Client) Token ¶
Token is what this client signs in with, for a connection made beside it, such as a websocket.
func (*Client) Upload ¶
func (self *Client) Upload(ctx context.Context, path, field, filename string, content []byte) (*http.Response, error)
Upload sends a file to an endpoint that takes one, as a multipart form with the file under the given field. The counterpart of Download, and the only way to reach the parts of the API that take a file rather than arguments: a logo is bytes, and bytes are not a GraphQL argument.
The reply is returned as it came, since callers read a small JSON object out of it — the address to publish, or the reason the file was refused.
type ConnectionError ¶
ConnectionError means the server could not be reached at all, which is a different question from what it answered.
func (*ConnectionError) Error ¶
func (self *ConnectionError) Error() string
func (*ConnectionError) Unwrap ¶
func (self *ConnectionError) Unwrap() error
type Contact ¶
type Contact struct {
ID string `json:"id"`
UID string `json:"uid"`
ETag string `json:"etag"`
Name string `json:"name,omitempty"`
Organization string `json:"organization,omitempty"`
Emails []string `json:"emails"`
Phones []string `json:"phones"`
Addresses []*Address `json:"addresses,omitempty"`
Note string `json:"note,omitempty"`
HasPhoto bool `json:"hasPhoto"`
Card string `json:"card,omitempty"`
}
Contact is one person kept in an address book. Card is the whole of it and comes back only when one contact is asked for by name.
func GetContact ¶
GetContact is one contact, with its card.
func ListContacts ¶
func ListContacts(ctx context.Context, connection *Client, addressBookId, query string, first int) ([]*Contact, error)
ListContacts are the contacts in one book, narrowed by a query when there is one.
func SaveContact ¶
func SaveContact(ctx context.Context, connection *Client, fields *SaveContactFields) (*Contact, error)
SaveContact keeps one, or changes one that is kept.
type CreatedAppPassword ¶
type CreatedAppPassword struct {
AppPassword *MailboxAppPassword `json:"appPassword"`
Password string `json:"password"`
Username string `json:"username"`
}
CreatedAppPassword is an app password at the one moment its secret is known: the server keeps only a hash of it.
func CreateMailboxAppPassword ¶
func CreateMailboxAppPassword(ctx context.Context, connection *Client, mailboxId, name string) (*CreatedAppPassword, error)
CreateMailboxAppPassword makes an app password for a device. The password is in the reply and nowhere else, ever.
type CreatedCredential ¶
type CreatedCredential struct {
Credential *Credential `json:"credential"`
Host string `json:"host"`
Port string `json:"port"`
Username string `json:"username"`
Password string `json:"password"`
}
CreatedCredential is a new credential with the settings to enter into a mail client.
func CreateCredential ¶
func CreateCredential(ctx context.Context, connection *Client, domainId string, parameters *CredentialParameters) (*CreatedCredential, error)
CreateCredential issues a credential for a domain.
type Credential ¶
type Credential struct {
ID string `json:"id"`
Comment string `json:"comment"`
Alias string `json:"alias"`
Disabled bool `json:"disabled"`
}
Credential may send mail as a domain.
func ListCredentials ¶
func ListCredentials(ctx context.Context, connection *Client, domainId string) ([]*Credential, error)
ListCredentials returns the credentials of one domain.
func UpdateCredential ¶
func UpdateCredential(ctx context.Context, connection *Client, credentialId string, parameters *CredentialParameters) (*Credential, error)
UpdateCredential changes a credential's comment, alias restriction or whether it is refused.
type CredentialParameters ¶
type CredentialParameters struct {
Comment *string `json:"comment,omitempty"`
Alias *string `json:"alias,omitempty"`
Disabled *bool `json:"disabled,omitempty"`
}
CredentialParameters are the settings of a credential an operator can set.
type CredentialSettings ¶
type CredentialSettings struct {
Host string `json:"host"`
Port string `json:"port"`
Username string `json:"username"`
Password string `json:"password"`
}
CredentialSettings is what to enter into a mail client.
func GetCredentialSettings ¶
func GetCredentialSettings(ctx context.Context, connection *Client, domainId, credentialId string) (*CredentialSettings, error)
GetCredentialSettings returns the SMTP settings for an existing credential, including its password.
type Delivery ¶
type Delivery struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
MailID string `json:"mailId"`
DomainID string `json:"domainId"`
AliasID string `json:"aliasId"`
Recipient string `json:"recipient"`
Kind string `json:"kind"`
Status string `json:"status"`
Size uint64 `json:"size"`
AttemptedAt *time.Time `json:"attemptedAt"`
DeliveredAt *time.Time `json:"deliveredAt"`
DroppedAt *time.Time `json:"droppedAt"`
RetryAt *time.Time `json:"retryAt"`
Attempts uint64 `json:"attempts"`
Error string `json:"error"`
}
Delivery is one attempt to pass a message on: to an address, a webhook or another server.
func GetDelivery ¶
GetDelivery returns one delivery.
func ListDeliveries ¶
func ListDeliveries(ctx context.Context, connection *Client, domainId string, first int) ([]*Delivery, error)
ListDeliveries returns a domain's deliveries, newest first.
func ListDeliveriesByMail ¶
func ListDeliveriesByMail(ctx context.Context, connection *Client, mailId string) ([]*Delivery, error)
ListDeliveriesByMail returns every delivery made for one message.
type Domain ¶
type Domain struct {
ID string `json:"id"`
Domain string `json:"domain"`
Subdomain string `json:"subdomain"`
Comment string `json:"comment"`
SpamFilterScoreThreshold float64 `json:"spamFilterScoreThreshold"`
MailServers []string `json:"mailServers"`
MailHosts []string `json:"mailHosts"`
LinkHost string `json:"linkHost"`
LinkHostname string `json:"linkHostname"`
DKIMSelector string `json:"dkimSelector"`
HasDKIMKey bool `json:"hasDkimKey"`
Aliases []*Alias `json:"aliases"`
Credentials []*Credential `json:"credentials"`
Records *RecordSet `json:"records"`
Logo *DomainLogo `json:"logo"`
}
Domain is a mail domain the server accepts mail for, as the dashboard sees it: the configured settings plus the live state of its DNS records.
func CheckDomain ¶
CheckDomain checks a domain's DNS records now.
func CreateDomain ¶
func CreateDomain(ctx context.Context, connection *Client, parameters *DomainParameters) (*Domain, error)
CreateDomain adds a domain, which the server gives a signing key.
func FindDomain ¶
FindDomain returns the configured domain with this name, matched case insensitively, or nil.
func ListDomains ¶
ListDomains returns the configured domains.
func RegenerateDomainKey ¶
RegenerateDomainKey replaces a domain's signing key.
func UpdateDomain ¶
func UpdateDomain(ctx context.Context, connection *Client, domainId string, parameters *DomainParameters) (*Domain, error)
UpdateDomain changes a domain.
type DomainLogo ¶
type DomainLogo struct {
Filename string `json:"filename"`
Title string `json:"title"`
URL string `json:"url"`
PublicURL string `json:"publicUrl"`
UploadedAt time.Time `json:"uploadedAt"`
}
DomainLogo is the mark this server publishes for a domain, when one has been uploaded.
func UploadDomainLogo ¶
func UploadDomainLogo(ctx context.Context, connection *Client, domainId, filename string, content []byte) (*DomainLogo, error)
UploadDomainLogo publishes a mark for a domain.
Not a schema operation: it sends a file, and the server checks the file against the profile a mark has to satisfy before storing it. A refusal carries the rule that refused it, which is the whole value of checking here rather than leaving a receiver to refuse it silently.
type DomainParameters ¶
type DomainParameters struct {
Domain *string `json:"domain,omitempty"`
Subdomain *string `json:"subdomain,omitempty"`
Comment *string `json:"comment,omitempty"`
SpamFilterScoreThreshold *float64 `json:"spamFilterScoreThreshold,omitempty"`
MailServers *[]string `json:"mailServers,omitempty"`
LinkHost *string `json:"linkHost,omitempty"`
DKIMSelector *string `json:"dkimSelector,omitempty"`
}
DomainParameters are the settings of a domain an operator can change. A nil field is left alone, so an update carries only what it changes.
type DomainSubmission ¶ added in v0.48.0
type DomainSubmission struct {
SubmissionID string `json:"submissionId"`
MailID string `json:"mailId"`
AcceptedAt time.Time `json:"acceptedAt"`
}
DomainSubmission identifies locally accepted mail after the stored copy expires.
func GetDomainSubmission ¶ added in v0.48.0
func GetDomainSubmission(ctx context.Context, connection *Client, domainId, submissionId string) (*DomainSubmission, error)
GetDomainSubmission checks this account's send without reading or sending content. A nil result does not prevent an in-flight send from committing later.
type Error ¶
type Error struct {
Message string `json:"message"`
Path []any `json:"path,omitempty"`
Locations []struct {
Line int `json:"line"`
Column int `json:"column"`
} `json:"locations,omitempty"`
}
Error is a message the server returned for a query.
type EvaluationSourceScore ¶ added in v0.61.0
type EvaluationSourceScore struct {
AnswerFrom string `json:"answerFrom"`
AnsweredCount int `json:"answeredCount"`
ScorePercent float64 `json:"scorePercent"`
ScorePercentWithoutFiledAfter float64 `json:"scorePercentWithoutFiledAfter"`
FiledAfterCount int `json:"filedAfterCount"`
VerdictCounts map[string]int `json:"verdictCounts"`
}
EvaluationSourceScore is how the answers from one source scored.
type ExternalAddresses ¶
type ExternalAddresses struct {
IPv4 string `json:"ipv4"`
IPv6 string `json:"ipv6"`
Error string `json:"error"`
}
ExternalAddresses is how the outside world reaches this server.
func GetServerAddresses ¶
func GetServerAddresses(ctx context.Context, connection *Client) (*ExternalAddresses, error)
GetServerAddresses returns the addresses the DNS records have to point at.
type Field ¶
type Field struct {
Name string
Description string
Arguments []*Argument
Type *TypeReference
}
Field is one field of an object type.
type Filter ¶
type Filter struct {
Field string
Value string
// Contains matches a substring rather than the whole value, for subjects.
Contains bool
}
Filter is one equality or substring test on a mail column, for ListMails.
type Group ¶
type Group struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
ModifiedAt time.Time `json:"modifiedAt"`
Name string `json:"name"`
Description string `json:"description"`
IDPGroup string `json:"idpGroup"`
UserIDs []string `json:"userIds"`
RoleIDs []string `json:"roleIds"`
DomainIDs []string `json:"domainIds"`
}
Group is a set of people, what they may do, and where. Permissions come from the group's roles; the domain-kind ones apply to the group's domains.
func CreateGroup ¶
func CreateGroup(ctx context.Context, connection *Client, name string, parameters *GroupParameters) (*Group, error)
CreateGroup adds a group.
func ListGroups ¶
ListGroups returns the groups on this server.
func UpdateGroup ¶
func UpdateGroup(ctx context.Context, connection *Client, groupId string, parameters *GroupParameters) (*Group, error)
UpdateGroup changes a group.
type GroupParameters ¶
type GroupParameters struct {
Name *string
Description *string
IDPGroup *string
UserIDs *[]string
RoleIDs *[]string
DomainIDs *[]string
}
GroupParameters is what a group is made or changed with. A nil field is left alone; a list replaces the one stored.
type ImportedEvaluationQuestion ¶ added in v0.61.0
type ImportedEvaluationQuestion struct {
QuestionKind string `json:"questionKind,omitempty"`
QuestionText string `json:"questionText"`
ExpectedAnswer string `json:"expectedAnswer"`
OutdatedAnswer string `json:"outdatedAnswer,omitempty"`
}
ImportedEvaluationQuestion is one question to import.
type Layout ¶
type Layout struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
ModifiedAt time.Time `json:"modifiedAt"`
DomainID string `json:"domainId"`
Comment string `json:"comment"`
Locale string `json:"locale"`
HTMLContent string `json:"htmlContent"`
TextContent string `json:"textContent"`
Translations []*LayoutTranslation `json:"translations"`
}
Layout is what goes around a template: the frame the message is rendered into.
func CreateLayout ¶
func CreateLayout(ctx context.Context, connection *Client, domainId string, parameters *LayoutParameters) (*Layout, error)
CreateLayout adds a layout to a domain.
func ListLayouts ¶
ListLayouts returns a domain's layouts.
func ModifyLayout ¶
func ModifyLayout(ctx context.Context, connection *Client, layoutId string, parameters *LayoutParameters) (*Layout, error)
ModifyLayout replaces a layout's settings.
func (*Layout) Parameters ¶
func (self *Layout) Parameters() *LayoutParameters
Parameters returns a layout's settings, so that a change can start from what is stored.
type LayoutParameters ¶
type LayoutParameters struct {
Comment string `json:"comment"`
Locale string `json:"locale,omitempty"`
HTMLContent string `json:"htmlContent"`
TextContent string `json:"textContent"`
Translations []*LayoutTranslation `json:"translations,omitempty"`
}
LayoutParameters is everything that can be set on a layout. The server replaces the whole layout with them.
type LayoutTranslation ¶
type LayoutTranslation struct {
Locale string `json:"locale"`
HTMLContent string `json:"htmlContent"`
TextContent string `json:"textContent"`
}
LayoutTranslation is a layout's content in one locale.
type Mail ¶
type Mail struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
ReceivedAt time.Time `json:"receivedAt"`
DomainID string `json:"domainId"`
CredentialID string `json:"credentialId"`
EnvelopeID string `json:"envelopeId"`
Kind string `json:"kind"`
Status string `json:"status"`
Sender string `json:"sender"`
Recipients []string `json:"recipients"`
From string `json:"from"`
Subject string `json:"subject"`
MessageID string `json:"messageId"`
Size uint64 `json:"size"`
IP string `json:"ip"`
RDNS string `json:"rdns"`
Hello string `json:"hello"`
TLSVersion string `json:"tlsVersion"`
AuthenticationResults json.RawMessage `json:"authenticationResults"`
Deliveries []*Delivery `json:"deliveries"`
}
Mail is a message the server has handled, as the list shows it.
type MailContent ¶
type MailContent struct {
MailID string `json:"mailId"`
Available bool `json:"available"`
Text string `json:"text"`
HTML string `json:"html"`
HasRemoteContent bool `json:"hasRemoteContent"`
Attachments []*Attachment `json:"attachments"`
Headers []*Header `json:"headers"`
RawHeaders string `json:"rawHeaders"`
Size int `json:"size"`
}
MailContent is a stored message taken apart for display.
func GetMailContent ¶
GetMailContent returns a stored message decoded: its text, its HTML with scripts removed, its headers and its attachments.
type MailOpens ¶
type MailOpens struct {
MailID string `json:"mailId"`
Trackable bool `json:"trackable"`
Opened bool `json:"opened"`
OpenedAt *time.Time `json:"openedAt"`
LastOpenedAt *time.Time `json:"lastOpenedAt"`
OpenCount int64 `json:"openCount"`
IP string `json:"ip"`
UserAgent string `json:"userAgent"`
}
MailOpens is whether a sent message has been looked at, as far as a fetched picture can say.
type MailProgramSettings ¶
type MailProgramSettings struct {
IMAPHost string `json:"imapHost"`
IMAPPort int `json:"imapPort"`
IMAPSPort int `json:"imapsPort"`
SubmissionHost string `json:"submissionHost"`
SubmissionPort int `json:"submissionPort"`
}
MailProgramSettings is where a mail program connects.
func GetMailProgramSettings ¶
func GetMailProgramSettings(ctx context.Context, connection *Client) (*MailProgramSettings, error)
GetMailProgramSettings returns the hosts and ports a mail program needs.
type MailServer ¶
type MailServer struct {
Host string `json:"host"`
Port uint16 `json:"port"`
Username string `json:"username"`
}
MailServer is a downstream server an alias relays to. The password is never returned.
type MailServerParameters ¶
type MailServerParameters struct {
Host string `json:"host"`
Port uint16 `json:"port"`
Username *string `json:"username,omitempty"`
Password *string `json:"password,omitempty"`
}
MailServerParameters describes a downstream server to relay to.
type MailSubmission ¶ added in v0.48.0
type MailSubmission struct {
SubmissionID string `json:"submissionId"`
MailID string `json:"mailId"`
Mail *Mail `json:"mail"`
}
MailSubmission names durable acceptance even when the stored mail has expired.
func SendMailWithSubmission ¶ added in v0.48.0
func SendMailWithSubmission(ctx context.Context, connection *Client, domainId, submissionId string, message *MessageParameters) (*MailSubmission, error)
SendMailWithSubmission reuses one identifier and unchanged parameters on retry.
type Mailbox ¶
type Mailbox struct {
ID string `json:"id"`
UserID string `json:"userId"`
Name string `json:"name"`
SignatureText string `json:"signatureText"`
SignatureHTML string `json:"signatureHtml"`
Addresses []*MailboxAddress `json:"addresses"`
Rules []MailboxRule `json:"rules"`
AutoReply *MailboxAutoReply `json:"autoReply"`
}
Mailbox is where a person's mail lives.
type MailboxAddress ¶
type MailboxAddress struct {
AliasID string `json:"aliasId"`
DomainID string `json:"domainId"`
Domain string `json:"domain"`
LocalPart string `json:"localPart"`
Address string `json:"address"`
}
MailboxAddress is an address that delivers into a mailbox: an alias of kind mailbox, read back from its pattern.
type MailboxAppPassword ¶
type MailboxAppPassword struct {
ID string `json:"id"`
MailboxID string `json:"mailboxId"`
Name string `json:"name"`
CreatedAt time.Time `json:"createdAt"`
LastUsedAt *time.Time `json:"lastUsedAt"`
}
MailboxAppPassword is what one mail program signs in with.
func ListMailboxAppPasswords ¶
func ListMailboxAppPasswords(ctx context.Context, connection *Client, mailboxId string) ([]*MailboxAppPassword, error)
ListMailboxAppPasswords returns the app passwords of a mailbox, one per device. The passwords themselves are never returned.
type MailboxAutoReply ¶
type MailboxAutoReply struct {
Enabled bool `json:"enabled"`
From *time.Time `json:"from,omitempty"`
Until *time.Time `json:"until,omitempty"`
Subject string `json:"subject"`
Text string `json:"text"`
HTML string `json:"html,omitempty"`
// SameDomainOnly answers only senders at the mailbox's own domains.
SameDomainOnly bool `json:"sameDomainOnly,omitempty"`
}
MailboxAutoReply is the out-of-office setting.
type MailboxFolder ¶
type MailboxFolder struct {
ID string `json:"id"`
MailboxID string `json:"mailboxId"`
ParentID string `json:"parentId"`
Name string `json:"name"`
Kind string `json:"kind"`
PinnedAt *time.Time `json:"pinnedAt"`
Unread int `json:"unread"`
Total int `json:"total"`
}
MailboxFolder is one folder of a mailbox. The kind is empty for a folder somebody made; the rest are the ones every mailbox has.
func CreateMailboxFolder ¶
func CreateMailboxFolder(ctx context.Context, connection *Client, mailboxId, name, parentId string) (*MailboxFolder, error)
CreateMailboxFolder adds a folder, at the top level or under another.
func SetMailboxFolderPinned ¶
func SetMailboxFolderPinned(ctx context.Context, connection *Client, folderId string, pinned bool) (*MailboxFolder, error)
SetMailboxFolderPinned pins a folder to the top of the rail, or takes it down. The Inbox is always there and cannot be pinned.
func UpdateMailboxFolder ¶
func UpdateMailboxFolder(ctx context.Context, connection *Client, folderId string, name, parentId *string) (*MailboxFolder, error)
UpdateMailboxFolder renames a folder, moves it under another, or moves it to the top level with an empty parent. Only what is given changes.
type MailboxItem ¶
type MailboxItem struct {
ID string `json:"id"`
FolderID string `json:"folderId"`
Seen bool `json:"seen"`
Flagged bool `json:"flagged"`
Mail *MailboxMail `json:"mail"`
}
MailboxItem is one message in one folder.
type MailboxMail ¶
type MailboxMail struct {
ID string `json:"id"`
From string `json:"from"`
FromName string `json:"fromName"`
Subject string `json:"subject"`
ReceivedAt *time.Time `json:"receivedAt"`
}
MailboxMail is the little of a message a list needs.
type MailboxParameters ¶
type MailboxParameters struct {
Name *string
SignatureText *string
SignatureHTML *string
Rules *[]MailboxRule
AutoReply *MailboxAutoReply
ClearAutoReply bool
}
MailboxParameters is what UpdateMailbox may change. A nil field is left alone; the rules and the out-of-office setting replace what is stored.
type MailboxRule ¶
type MailboxRule struct {
Name string `json:"name"`
Enabled bool `json:"enabled"`
Conditions []MailboxRuleCondition `json:"conditions"`
Actions []MailboxRuleAction `json:"actions"`
Stop bool `json:"stop"`
}
MailboxRule files arriving mail: every condition must match, then every action runs, in order.
type MailboxRuleAction ¶
type MailboxRuleAction struct {
Kind string `json:"kind"`
FolderID string `json:"folderId,omitempty"`
Address string `json:"address,omitempty"`
}
MailboxRuleAction is one thing to do with a message a rule matched.
type MailboxRuleApplication ¶
type MailboxRuleApplication struct {
Considered int `json:"considered"`
Matched int `json:"matched"`
Moved int `json:"moved"`
Marked int `json:"marked"`
Flagged int `json:"flagged"`
Deleted int `json:"deleted"`
Skipped int `json:"skipped"`
Failed int `json:"failed"`
}
MailboxRuleApplication is what applying the rules to stored mail did.
func ApplyMailboxRules ¶
func ApplyMailboxRules(ctx context.Context, connection *Client, mailboxId, folderId string, first int) (*MailboxRuleApplication, error)
ApplyMailboxRules runs the stored rules over the mail already in a folder.
type MailboxRuleCondition ¶
type MailboxRuleCondition struct {
Field string `json:"field"`
Header string `json:"header,omitempty"`
Operator string `json:"operator"`
Value string `json:"value,omitempty"`
}
MailboxRuleCondition is one test: a field, how to compare it, and what to.
type MailboxRuleTest ¶
type MailboxRuleTest struct {
Item *MailboxItem `json:"item"`
Matched []int `json:"matched"`
}
MailboxRuleTest is one message the rules were tried against, and which of them matched, by position in the list given.
func TestMailboxRules ¶
func TestMailboxRules(ctx context.Context, connection *Client, mailboxId, folderId string, first int, rules []MailboxRule) ([]*MailboxRuleTest, error)
TestMailboxRules says which of the given rules would match the mail already in a folder, without changing anything.
type MailboxSubscription ¶
type MailboxSubscription struct {
Key string `json:"key"`
Name string `json:"name"`
From string `json:"from"`
Count int `json:"count"`
Unread int `json:"unread"`
LastAt time.Time `json:"lastAt"`
LastItemID string `json:"lastItemId"`
OneClick bool `json:"oneClick"`
Unsubscribe []string `json:"unsubscribe"`
RequestedAt *time.Time `json:"requestedAt"`
Method string `json:"method"`
Failed bool `json:"failed"`
Error string `json:"error"`
}
MailboxSubscription is one mailing list a mailbox receives: who sends it, how much of it there is, and whether leaving has been asked for.
func GetMailboxSubscription ¶
func GetMailboxSubscription(ctx context.Context, connection *Client, mailboxId, key string) (*MailboxSubscription, error)
GetMailboxSubscription is one of them, by the key that identifies the list.
func UnsubscribeMailboxSubscription ¶
func UnsubscribeMailboxSubscription(ctx context.Context, connection *Client, mailboxId, key string) (*MailboxSubscription, error)
UnsubscribeMailboxSubscription asks to leave a list, by whichever way the sender offered: a one-click request, a message to the address it named, or a page handed back for a person to open.
type MailboxSubscriptionPage ¶
type MailboxSubscriptionPage struct {
Subscriptions []*MailboxSubscription `json:"subscriptions"`
Total int64 `json:"total"`
}
MailboxSubscriptionPage is a page of them, with how many there are in all.
func ListMailboxSubscriptions ¶
func ListMailboxSubscriptions(ctx context.Context, connection *Client, mailboxId string, first, offset int) (*MailboxSubscriptionPage, error)
ListMailboxSubscriptions is every mailing list a mailbox receives.
type MailboxSummary ¶
type MailboxSummary struct {
ID string `json:"id"`
Name string `json:"name"`
UserID string `json:"userId"`
Username string `json:"username"`
UserName string `json:"userName"`
}
MailboxSummary is a mailbox with its owner, for pointing an alias at one.
func ListAllMailboxes ¶
func ListAllMailboxes(ctx context.Context, connection *Client) ([]*MailboxSummary, error)
ListAllMailboxes returns every mailbox on the server with its owner. It needs the permission to manage domains or users; an ordinary account is told the operation does not exist.
type MailboxThreadItem ¶
type MailboxThreadItem struct {
Item *MailboxItem `json:"item"`
FolderID string `json:"folderId"`
FolderName string `json:"folderName"`
FolderKind string `json:"folderKind"`
}
MailboxThreadItem is one message in that view, with the folder it sits in.
type MailboxThreadView ¶
type MailboxThreadView struct {
ThreadID string `json:"threadId"`
Subject string `json:"subject"`
Items []*MailboxThreadItem `json:"items"`
Truncated bool `json:"truncated"`
}
MailboxThreadView is the mail of one subscription, read as a conversation is: the messages it sent, newest first.
func ReadMailboxSubscription ¶
func ReadMailboxSubscription(ctx context.Context, connection *Client, mailboxId, key string) (*MailboxThreadView, error)
ReadMailboxSubscription is its mail, grouped the way a conversation is.
type MailboxView ¶
type MailboxView struct {
Mailbox *Mailbox `json:"mailbox"`
Folders []*MailboxFolder `json:"folders"`
Unread int `json:"unread"`
MaxMessageSize uint64 `json:"maxMessageSize"`
}
MailboxView is a mailbox with its folders, as the server returns it.
func ListMailboxes ¶
func ListMailboxes(ctx context.Context, connection *Client) ([]*MailboxView, error)
ListMailboxes returns the caller's own mailboxes with their folders.
func UpdateMailbox ¶
func UpdateMailbox(ctx context.Context, connection *Client, mailboxId string, parameters *MailboxParameters) (*MailboxView, error)
UpdateMailbox changes a mailbox's name, signature, rules or out-of-office setting.
type MessageParameters ¶
type MessageParameters struct {
From string `json:"from"`
FromName string `json:"fromName,omitempty"`
To []string `json:"to"`
Cc []string `json:"cc,omitempty"`
Bcc []string `json:"bcc,omitempty"`
Subject string `json:"subject,omitempty"`
TemplateID string `json:"templateId,omitempty"`
Locale string `json:"locale,omitempty"`
Variables map[string]any `json:"variables,omitempty"`
HTMLContent string `json:"htmlContent,omitempty"`
TextContent string `json:"textContent,omitempty"`
Attachments []*AttachmentParameters `json:"attachments,omitempty"`
}
MessageParameters is a message to send: who it is from and to, and either a template with its variables or a subject and body written by hand.
type Note ¶ added in v0.78.0
type Note struct {
ID string `json:"id"`
MailboxID string `json:"mailboxId"`
FolderID string `json:"folderId"`
Title string `json:"title"`
Preview string `json:"preview"`
HTML string `json:"html"`
Text string `json:"text"`
IsEditable bool `json:"isEditable"`
CreatedAt time.Time `json:"createdAt"`
ModifiedAt time.Time `json:"modifiedAt"`
}
Note is one note. HTML and Text are empty in a list.
type Operation ¶
type Operation struct {
Name string
Kind string // "query" or "mutation"
Description string
Arguments []*Argument
Type *TypeReference
}
Operation is one query or mutation.
func (*Operation) FindArgument ¶
FindArgument resolves one of an operation's arguments, case insensitively.
type Options ¶
type Options struct {
// URL of the server, for example https://mail.example.com. The API path
// is appended.
URL string
// Token sent as "Authorization: Bearer". Empty is allowed, and works
// against a server that has no accounts yet.
Token string
// HTTPClient overrides the transport, which is how the local connection
// pins the server's own certificate.
HTTPClient *http.Client
// Insecure skips verifying the server's certificate, for a development
// server with a self-signed one. Ignored when HTTPClient is given.
Insecure bool
// Timeout for a single request. Zero means one minute.
Timeout time.Duration
// ReadOnly refuses every mutation before it is sent, so that a profile
// handed to a script or an agent can look but not change. Queries,
// introspection and downloads go through as they would otherwise.
ReadOnly bool
}
Options configure a Client.
type OutgoingIdentity ¶
type OutgoingIdentity struct {
Address string `json:"address"`
Via string `json:"via"`
ReverseName string `json:"reverseName"`
ForwardAddresses []string `json:"forwardAddresses"`
Confirmed bool `json:"confirmed"`
HelloName string `json:"helloName"`
HelloAddresses []string `json:"helloAddresses"`
HelloMatches bool `json:"helloMatches"`
}
OutgoingIdentity is how outgoing mail identifies itself, and whether the receivers that check will believe it.
func GetOutgoingIdentity ¶
func GetOutgoingIdentity(ctx context.Context, connection *Client) (*OutgoingIdentity, error)
GetOutgoingIdentity returns how this server's outgoing mail identifies itself.
type Passkey ¶
type Passkey struct {
ID string `json:"id"`
Name string `json:"name"`
CreatedAt time.Time `json:"createdAt"`
UsedAt time.Time `json:"usedAt"`
IP string `json:"ip"`
Transports []string `json:"transports"`
BackupEligible bool `json:"backupEligible"`
BackupState bool `json:"backupState"`
}
Passkey is an authenticator registered to an account.
func ListPasskeys ¶
ListPasskeys returns the passkeys of the account this client acts as.
type PasskeyPolicy ¶
type PasskeyPolicy struct {
Enabled bool `json:"enabled"`
MaximumPerUser int `json:"maximumPerUser"`
}
PasskeyPolicy is whether this server offers passkeys, and how many an account may have.
func GetPasskeyPolicy ¶
func GetPasskeyPolicy(ctx context.Context, connection *Client) (*PasskeyPolicy, error)
GetPasskeyPolicy returns whether passkeys are offered at all.
type PermissionDescription ¶
type PermissionDescription struct {
Key string `json:"key"`
Kind string `json:"kind"`
Widens string `json:"widens"`
}
PermissionDescription is one permission a role may hold: its key, whether it applies to the server or to a group's domains, and, for one that covers every domain, the domain permission it stands in for.
func ListPermissions ¶
func ListPermissions(ctx context.Context, connection *Client) ([]*PermissionDescription, error)
ListPermissions returns every permission a role may hold.
type ReadOnlyError ¶
type ReadOnlyError struct {
URL string
}
ReadOnlyError is a mutation refused by a read-only client before it was sent, so nothing on the server has changed.
func (*ReadOnlyError) Error ¶
func (self *ReadOnlyError) Error() string
type Record ¶
type Record struct {
Type string `json:"type"`
Name string `json:"name"`
Expected string `json:"expected"`
Found []string `json:"found"`
Verified bool `json:"verified"`
Priority uint16 `json:"priority"`
Optional bool `json:"optional"`
Purpose string `json:"purpose"`
// Blocked says why publishing this record would not have the effect it
// promises — a BIMI record with no logo behind it, or with a DMARC policy
// no receiver acts on. Empty when nothing is in the way.
Blocked string `json:"blocked"`
}
Record is one DNS record a domain needs.
type RecordSet ¶
type RecordSet struct {
Domain string `json:"domain"`
Records []*Record `json:"records"`
CheckedAt time.Time `json:"checkedAt"`
Error string `json:"error"`
}
RecordSet is the DNS a domain needs, and what is published now.
func (*RecordSet) FindRecord ¶
FindRecord returns the record of a type whose name matches, or nil.
The trailing dot is ignored on both sides: the server reports fully qualified names, and a caller building one from a domain and a selector will not have written it.
type Reminder ¶ added in v0.77.0
type Reminder struct {
ID string `json:"id"`
Title string `json:"title"`
Notes string `json:"notes"`
DueAt *time.Time `json:"dueAt"`
IsDueDate bool `json:"isDueDate"`
IsDone bool `json:"isDone"`
DoneAt *time.Time `json:"doneAt"`
Priority int `json:"priority"`
IsRepeating bool `json:"isRepeating"`
CreatedAt time.Time `json:"createdAt"`
ModifiedAt time.Time `json:"modifiedAt"`
}
Reminder is one reminder.
func ListReminders ¶ added in v0.77.0
ListReminders is the reminders, done or not when isDone says, or all.
func SaveReminder ¶ added in v0.77.0
func SaveReminder(ctx context.Context, connection *Client, reminderId string, change *ReminderChange) (*Reminder, error)
SaveReminder makes a reminder, when reminderId is empty, or changes one.
type ReminderChange ¶ added in v0.77.0
type ReminderChange struct {
Title *string `json:"title,omitempty"`
Notes *string `json:"notes,omitempty"`
DueAt *string `json:"dueAt,omitempty"`
DueOn *string `json:"dueOn,omitempty"`
IsDueCleared bool `json:"isDueCleared,omitempty"`
Priority *int `json:"priority,omitempty"`
}
ReminderChange is what to write into a reminder; what is nil is kept.
type Rendered ¶
type Rendered struct {
Subject string `json:"subject"`
HTMLContent string `json:"htmlContent"`
TextContent string `json:"textContent"`
Locale string `json:"locale"`
Variables []string `json:"variables"`
}
Rendered is a template or layout with its variables filled in.
type Report ¶
type Report struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
MailID string `json:"mailId"`
DomainID string `json:"domainId"`
BeginAt time.Time `json:"beginAt"`
EndAt time.Time `json:"endAt"`
Count uint64 `json:"count"`
IP string `json:"ip"`
RDNS string `json:"rdns"`
FromDomain string `json:"fromDomain"`
SenderDomain string `json:"senderDomain"`
Disposition string `json:"disposition"`
DKIMAligned bool `json:"dkimAligned"`
SPFAligned bool `json:"spfAligned"`
Feedback json.RawMessage `json:"feedback"`
}
Report is a DMARC aggregate report somebody sent about mail claiming to be from one of this server's domains.
type RestartResult ¶
type RestartResult struct {
Started bool `json:"started"`
Instance string `json:"instance"`
Supervision string `json:"supervision"`
}
RestartResult is what the server says when asked to restart.
func RestartServer ¶
func RestartServer(ctx context.Context, connection *Client) (*RestartResult, error)
RestartServer asks the instance to exit so its supervisor starts a new one.
type Role ¶
type Role struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
ModifiedAt time.Time `json:"modifiedAt"`
Name string `json:"name"`
Description string `json:"description"`
Permissions []string `json:"permissions"`
}
Role is a named set of permissions.
func CreateRole ¶
func CreateRole(ctx context.Context, connection *Client, name string, permissions []string, description *string) (*Role, error)
CreateRole adds a role.
func UpdateRole ¶
func UpdateRole(ctx context.Context, connection *Client, roleId string, parameters *RoleParameters) (*Role, error)
UpdateRole changes a role.
type RoleParameters ¶
RoleParameters is what a role is made or changed with.
type SaveCalendarEventFields ¶
type SaveCalendarEventFields struct {
RequestID string
CalendarID string
ID string
File string
Summary *string
Location *string
Description *string
StartsAt *string
EndsAt *string
AllDay *bool
Timezone string
Recurrence *string
Status *string
Attendees *[]string
}
SaveCalendarEventFields keeps an event from filled-in fields. A nil field is left as it was; a pointer to an empty value clears it.
type SaveContactFields ¶
type SaveContactFields struct {
AddressBookID string
ID string
Card string
Name *string
Organization *string
Title *string
Emails *[]string
Phones *[]string
Note *string
}
SaveContactFields keeps a contact from filled-in fields. A nil field is left as it was; a pointer to an empty value clears it.
type Schema ¶
type Schema struct {
QueryType string
MutationType string
Operations map[string]*Operation
Types map[string]*Type
}
Schema is as much of the server's GraphQL schema as is needed to call an operation without knowing it in advance.
It exists so the command line tool covers the whole API without a hand written command per operation. Hand written ones drift: an operation added to the schema is reachable the moment the server supports it, with no second place to remember to update.
func Introspect ¶
Introspect reads the schema from the server.
func (*Schema) BuildQuery ¶
func (self *Schema) BuildQuery(operation *Operation, arguments map[string]any, depth int) (string, error)
BuildQuery assembles a query for an operation and its arguments, declaring a variable for each so that input objects and lists work without having to write GraphQL literal syntax.
func (*Schema) FindOperation ¶
FindOperation resolves an operation name, matching case insensitively so that a name typed from memory still works.
func (*Schema) OperationNames ¶
OperationNames returns every operation, sorted, so that a listing and an error message can both suggest what there is.
func (*Schema) Selection ¶
func (self *Schema) Selection(reference *TypeReference, depth int) string
Selection builds the selection set for an operation's return type: every field that can be asked for without arguments, to a bounded depth.
Bounded because the schema is cyclic — a Domain has Credentials, and a Delivery has a Mail that has a Domain — so an unbounded walk does not terminate. Three levels is enough for everything the API returns to be legible without asking for the whole graph.
type ServerStatus ¶
type ServerStatus struct {
Instance string `json:"instance"`
Version string `json:"version"`
Commit string `json:"commit"`
StartedAt time.Time `json:"startedAt"`
UptimeSeconds int64 `json:"uptimeSeconds"`
PendingRestart []string `json:"pendingRestart"`
Supervision string `json:"supervision"`
Restarting bool `json:"restarting"`
}
ServerStatus describes the running instance rather than the configuration.
func GetServerStatus ¶
func GetServerStatus(ctx context.Context, connection *Client) (*ServerStatus, error)
GetServerStatus returns what the instance is and how it is running.
type Session ¶
type Session struct {
ID string `json:"id"`
Current bool `json:"current"`
Created time.Time `json:"created"`
Expires *time.Time `json:"expires"`
LastUsed *time.Time `json:"lastUsed"`
IP string `json:"ip"`
UserAgent string `json:"userAgent"`
Revoked *time.Time `json:"revoked"`
}
Session is one signed-in browser.
type Settings ¶
type Settings map[string]json.RawMessage
Settings are the optional integrations, as the server describes them. Kept as raw JSON per section rather than as typed structs: the command line prints whatever fields the server reports, so a setting added to the API shows up without a change here.
func GetSettings ¶
GetSettings returns the optional integrations. Secrets are never returned; a field that is set reads back as whether it is set.
func UpdateSettings ¶
func UpdateSettings(ctx context.Context, connection *Client, sections map[string]any) (Settings, error)
UpdateSettings changes one or more sections. Each value is the parameters object for that section, as the schema's <Section>ParametersInput declares it; a field left out keeps its stored value.
type StartedAgentIdea ¶ added in v0.76.0
type StartedAgentIdea struct {
Idea *AgentIdea `json:"idea"`
Conversation *AgentConversation `json:"conversation"`
OpeningRequest string `json:"openingRequest"`
}
StartedAgentIdea is an idea started, the conversation carrying it out, and what to say in it first.
func StartAgentIdea ¶ added in v0.76.0
func StartAgentIdea(ctx context.Context, connection *Client, ideaId, conversationId string) (*StartedAgentIdea, error)
StartAgentIdea starts an idea: in the conversation given, or in one of its own when none is.
type Template ¶
type Template struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
ModifiedAt time.Time `json:"modifiedAt"`
DomainID string `json:"domainId"`
LayoutID string `json:"layoutId"`
Name string `json:"name"`
Comment string `json:"comment"`
Locale string `json:"locale"`
Subject string `json:"subject"`
HTMLContent string `json:"htmlContent"`
TextContent string `json:"textContent"`
Translations []*TemplateTranslation `json:"translations"`
Variables []string `json:"variables"`
}
Template is a message to be sent with variables filled in.
func CreateTemplate ¶
func CreateTemplate(ctx context.Context, connection *Client, domainId string, parameters *TemplateParameters) (*Template, error)
CreateTemplate adds a template to a domain.
func GetTemplateByName ¶
func GetTemplateByName(ctx context.Context, connection *Client, domainId, name string) (*Template, error)
GetTemplateByName returns a domain's template with this name, or nil.
func ListTemplates ¶
ListTemplates returns a domain's templates.
func ModifyTemplate ¶
func ModifyTemplate(ctx context.Context, connection *Client, templateId string, parameters *TemplateParameters) (*Template, error)
ModifyTemplate replaces a template's settings.
func (*Template) Parameters ¶
func (self *Template) Parameters() *TemplateParameters
Parameters returns a template's settings, so that a change can start from what is stored.
type TemplateParameters ¶
type TemplateParameters struct {
LayoutID string `json:"layoutId"`
Name string `json:"name"`
Comment string `json:"comment"`
Locale string `json:"locale,omitempty"`
Subject string `json:"subject"`
HTMLContent string `json:"htmlContent"`
TextContent string `json:"textContent"`
Translations []*TemplateTranslation `json:"translations,omitempty"`
}
TemplateParameters is everything that can be set on a template. The server replaces the whole template with them, so an update sends every field.
type TemplateTranslation ¶
type TemplateTranslation struct {
Locale string `json:"locale"`
Subject string `json:"subject"`
HTMLContent string `json:"htmlContent"`
TextContent string `json:"textContent"`
}
TemplateTranslation is a template's subject and content in one locale.
type Token ¶
type Token struct {
ID string `json:"id"`
Name string `json:"name"`
Username string `json:"username"`
Created time.Time `json:"created"`
Expires *time.Time `json:"expires"`
LastUsed *time.Time `json:"lastUsed"`
LastUsedIP string `json:"lastUsedIp"`
Revoked *time.Time `json:"revoked"`
}
Token is an issued API token, without its secret.
func CreateToken ¶
func CreateToken(ctx context.Context, connection *Client, name, username, lifetime string) (*Token, string, error)
CreateToken issues a token and returns it. The secret is not recoverable afterwards.
func ListTokens ¶
func ListTokens(ctx context.Context, connection *Client, username string, includeRevoked bool) ([]*Token, error)
ListTokens returns the tokens belonging to the account this client is authenticated as.
There is no listing somebody else's: a token acts as the person it belongs to, so a list of theirs is a list of ways to become them. The console, which is not an account, names whose with username.
func UpdateToken ¶ added in v0.52.0
func UpdateToken(ctx context.Context, connection *Client, id, username, name, lifetime string) (*Token, error)
UpdateToken renames a token or gives it a new lifetime counted from now, "never" for one that does not expire. An empty name or lifetime leaves that as it is.
type Type ¶
type Type struct {
Name string
Kind string
Description string
Fields []*Field
InputFields []*Argument
EnumValues []string
}
Type is a named type in the schema.
type TypeReference ¶
type TypeReference struct {
Kind string
Name string
OfType *TypeReference
}
TypeReference is a type as used, which may wrap a named type in non-null and list markers.
func (*TypeReference) Named ¶
func (self *TypeReference) Named() string
Named returns the underlying named type, unwrapping non-null and list.
func (*TypeReference) Required ¶
func (self *TypeReference) Required() bool
Required reports whether a value has to be given.
func (*TypeReference) String ¶
func (self *TypeReference) String() string
String renders the type the way it is written in a query, for example "[Domain!]!".
type Upgrade ¶
type Upgrade struct {
Current string `json:"current"`
Latest string `json:"latest"`
Available bool `json:"available"`
Notes string `json:"notes"`
URL string `json:"url"`
CheckedAt *time.Time `json:"checkedAt"`
AttemptedAt *time.Time `json:"attemptedAt"`
Checking bool `json:"checking"`
Error string `json:"error"`
Applicable bool `json:"applicable"`
Reason string `json:"reason"`
Automatic bool `json:"automatic"`
Upgrading bool `json:"upgrading"`
Enabled bool `json:"enabled"`
Window string `json:"window"`
CheckError string `json:"checkError"`
}
Upgrade is what version is running, what has been released since, and whether anything can be done about the difference from here.
func ApplyUpgrade ¶
ApplyUpgrade installs a release: the newest, or the version named. It answers as soon as the upgrade has started.
type User ¶
type User struct {
// ID is what other rows hold a user by: a group's membership, an audit
// event's actor.
ID string `json:"id"`
Username string `json:"username"`
Name string `json:"name"`
Email string `json:"email"`
}
User is an account that may administer a server.
func CreateUser ¶
func CreateUser(ctx context.Context, connection *Client, username, password, email string) (*User, error)
CreateUser adds an account.
func GetCurrentUser ¶
GetCurrentUser returns the account this connection authenticates as, or nil when it authenticates as something that is not an account — which is what a locally minted token does.
func SetUserPassword ¶
func SetUserPassword(ctx context.Context, connection *Client, username, password string) (*User, error)
SetUserPassword replaces an account's password.
func UpdateUser ¶
func UpdateUser(ctx context.Context, connection *Client, username string, parameters *UserParameters) (*User, error)
UpdateUser changes an account's name, address or username.
type UserParameters ¶
UserParameters are what UpdateUser can change. A nil field is left alone.
Source Files
¶
- access.go
- agent.go
- agent_ask.go
- agent_background.go
- agent_connection.go
- agent_graph.go
- agent_idea.go
- agent_memory.go
- agent_skill.go
- agent_source_type.go
- alias.go
- app.go
- calendar.go
- client.go
- contact.go
- credential.go
- delivery.go
- domain.go
- errors.go
- introspect.go
- layout.go
- local.go
- location.go
- mail.go
- mailbox.go
- mutation.go
- note.go
- passkey.go
- reminder.go
- report.go
- server.go
- session.go
- settings.go
- template.go
- token.go
- upgrade.go
- user.go