Documentation
¶
Index ¶
- Constants
- func ChatHistoryPath(userUuid, chatUuid uuid.UUID) string
- func EncodeSimpleChatFile(file SimpleChatFile) ([]byte, error)
- func IsSkillPath(path string) bool
- func SortSimpleChatsByLastActivityDesc(chats []SimpleChat)
- type APIKeyCredentials
- type AnthropicKeyCredentials
- type ArtelIdentity
- type BodyMatcher
- type CouchAccount
- type CouchDBKeyCredentials
- type CouchInstance
- type CouchInstanceWithAccount
- type DockerHost
- type DocsSource
- type EffectiveSubscription
- type EmailCredentials
- type EmailMessage
- type EmailMeta
- type ExternalConnection
- type ExternalConnectionMeta
- type FeatureSet
- type GitlabCredentials
- type GoogleConnectionMeta
- type GoogleOAuthCredentials
- type HeaderMatcher
- type HttpAction
- type ImapAction
- type ImapOperation
- type ImportAction
- type ImportResolution
- type ListUsersReq
- type MailServerSuggestion
- type McpConnector
- type McpDefinition
- type McpKey
- type McpKeyContext
- type McpKeyPostgresContext
- type McpKeyS3Context
- type McpSpreadsheet
- type McpToolDef
- type McpToolRef
- type MomCandidate
- type OpenAIKeyCredentials
- type Paging
- type PendingAuthCode
- type PostgresInstance
- type PostgresKeyCredentials
- type Prompt
- type RegistrationMode
- type S3Instance
- type S3KeyCredentials
- type ScriptLanguage
- type ScriptParam
- type Session
- type SimpleChat
- type SimpleChatFile
- type SimpleChatHeader
- type SimpleChatMessage
- type SimpleChatRole
- type Skill
- type SkillStorageMode
- type SmtpAction
- type SmtpOperation
- type StorageUsage
- type Subscription
- type SubscriptionFeature
- type SubscriptionPlan
- type SystemSettings
- type TaskTracker
- type TelegramCredentials
- type TelegramIdentity
- type TerminalTab
- type ToolAction
- type ToolApiDescription
- type ToolExecResult
- type ToolProperty
- type ToolSchema
- type Tract
- type TractCondition
- type TractDefinition
- type TractRun
- type TractRunStatus
- type TractRunStep
- type TractRunStepStatus
- type TractStep
- type TractTemplate
- type TrelloBoard
- type TrelloMember
- type Trigger
- type TriggerMatchers
- type TriggerPreset
- type TriggerTractLink
- type User
- type UserDetails
- type UserIdentities
- type UserPermissions
- type UserSettings
- type Vault
- type VaultInvite
- type VaultMember
- type VaultMemberInfo
- type VaultPostgresDatabase
- type VaultPostgresStatus
- type Workbench
- type WorkbenchAuthMode
- type WorkbenchStatus
Constants ¶
const ( ProviderGoogleSheets = "google_sheets" ProviderTrello = "trello" ProviderMiro = "miro" ProviderEmail = "email" ProviderGitlab = "gitlab" ProviderAnthropic = "anthropic" ProviderTelegram = "telegram" ProviderOpenAI = "openai" ProviderOpenRouter = "openrouter" ProviderS3 = "s3" ProviderCouchDB = "couchdb" ProviderPostgres = "postgres" )
const ( // SkillsFolderPrefix is the vault-path prefix under which every skill note lives, hiding // the folder from the regular notes/files listings (mirrors the existing "_design/" skip). SkillsFolderPrefix = ".skills/" // SkillsActiveFolder holds the hot-plug skill set — each one is synthesized into its own // MCP tool. SkillsLibraryFolder holds the rest of the library (available but not injected // as a standalone tool). SkillsActiveFolder = ".skills/active/" SkillsLibraryFolder = ".skills/library/" )
const ChatHistoryFolderPrefix = ".chat_history/"
ChatHistoryFolderPrefix is the vault-path prefix under which every SimpleChat's JSONL transcript lives — hidden from the regular Notes/Files listings the same way SkillsFolderPrefix hides .skills/ (see internal/clients/couchdb/livesync.go).
const MaxSingleFileBytes = 10 * 1024 * 1024
MaxSingleFileBytes caps the size of any single write (note content, imported entry, or MCP file write), independent of plan quota. CheckStorageQuota only rejects once measured usage is already at/over quota, so a user's very first write starts at zero usage and would otherwise pass unchecked no matter how large — this bounds that gap.
const ReservedGithubDocsSlug = "github-quickstart"
ReservedGithubDocsSlug is a sentinel `/docs/:slug` value that never belongs to a real vault — vault.validateSlug rejects it outright. public_docs.Service recognizes it and routes to the GitHub-backed quick-start resolver (internal/service/v1/public_docs/githubdocs) instead of resolving a vaults row, letting GetDefaultVault point unauthenticated `/docs` visitors at the built-in quick-start guide without any frontend route/RPC changes.
const SkillToolPrefix = "skill_"
SkillToolPrefix is prepended to a hot-plug skill's slug to form its dynamic MCP tool name (e.g. skill_my-skill). Synthesized in internal/service/v1/mcp (ListHotPlugSkillTools) and matched against in internal/transport/mcp_api (handleToolsCall) to route a tools/call request to ExecuteSkillTool instead of the static builtin/MoM dispatch paths.
Variables ¶
This section is empty.
Functions ¶
func ChatHistoryPath ¶ added in v1.0.25
ChatHistoryPath returns the vault-relative CouchDB path a SimpleChat's JSONL transcript lives at — one doc per chat, namespaced under the owning user so a per-user listing (ListChats) never has to read another member's threads.
func EncodeSimpleChatFile ¶ added in v1.0.25
func EncodeSimpleChatFile(file SimpleChatFile) ([]byte, error)
EncodeSimpleChatFile renders f as JSONL bytes: the header line, then one line per message, in f.Messages order.
func IsSkillPath ¶ added in v1.0.25
IsSkillPath reports whether path falls under the reserved skills folder.
func SortSimpleChatsByLastActivityDesc ¶ added in v1.0.25
func SortSimpleChatsByLastActivityDesc(chats []SimpleChat)
SortSimpleChatsByLastActivityDesc sorts chats by LastActivityAt, most recent first — the order ListChats returns threads in.
Types ¶
type APIKeyCredentials ¶
APIKeyCredentials is stored encrypted in credentials_enc for api_key providers.
type AnthropicKeyCredentials ¶
type AnthropicKeyCredentials struct {
ApiKey string `json:"api_key"`
BaseUrl string `json:"base_url,omitempty"` // optional override, e.g. a proxy/regional endpoint
}
AnthropicKeyCredentials is stored encrypted in credentials_enc for the anthropic provider.
type ArtelIdentity ¶
type BodyMatcher ¶
BodyMatcher checks a dot-separated JSON body path (e.g. "object_attributes.action") against an exact string value — used where a header alone can't disambiguate (e.g. GitLab sends the same X-Gitlab-Event: Merge Request Hook header for opened/updated/merged/closed alike).
type CouchAccount ¶
type CouchDBKeyCredentials ¶
type CouchDBKeyCredentials struct {
URL string `json:"url"`
Username string `json:"username"`
Password string `json:"password"`
}
CouchDBKeyCredentials is stored encrypted in credentials_enc for the couchdb provider.
type CouchInstance ¶
type CouchInstanceWithAccount ¶
type CouchInstanceWithAccount struct {
Instance CouchInstance
Account *CouchAccount
}
type DockerHost ¶
type DockerHost struct {
Uuid uuid.UUID
Url string
CreatedAt time.Time
// CaCert/ClientCert/ClientKey are the decrypted, in-memory PEM blobs used to build a
// TLS-configured Docker client (internal/clients/workbenchdocker). They are never populated
// by Get/List (creds-free, admin list/view queries) — only by DockerHosts.GetWithCreds,
// mirroring the S3Instances Get vs GetWithCreds split. Empty means "no TLS configured".
CaCert string
ClientCert string
ClientKey string
}
DockerHost is one admin-registered Docker daemon endpoint in the workbench pool. Unlike CouchInstance/S3Instance it has no single credential blob; instead it carries three optional TLS/mTLS fields (see migrations/062_docker_hosts_tls.sql) for the remote-daemon case, empty for a local unix-socket/unauthenticated-tcp daemon.
type DocsSource ¶ added in v1.0.24
type DocsSource string
DocsSource selects what an unauthenticated visitor hitting `/docs` (no slug) is redirected to — either the admin-picked vault (DefaultDocsVaultID) or the built-in GitHub-backed quick-start guide. See public_docs.Service.GetDefaultVault.
const ( DocsSourceVault DocsSource = "vault" DocsSourceGithub DocsSource = "github" )
type EffectiveSubscription ¶
type EffectiveSubscription struct {
UserUuid uuid.UUID
Active bool
PlanKey string
Features FeatureSet
CouchQuotaBytes int64
S3QuotaBytes int64
MaxHotPlugSkills int
MaxTotalSkills int
}
EffectiveSubscription is the merged plan+override view services actually consult — the plan's defaults with the user's overrides applied on top.
type EmailCredentials ¶
type EmailCredentials struct {
ImapHost string `json:"imap_host"`
ImapPort int `json:"imap_port"`
SmtpHost string `json:"smtp_host"`
SmtpPort int `json:"smtp_port"`
Username string `json:"username"`
Password string `json:"password"`
}
EmailCredentials is stored encrypted in credentials_enc for email (IMAP/SMTP) providers.
type EmailMessage ¶
type ExternalConnection ¶
type ExternalConnection struct {
Uuid uuid.UUID
UserUuid uuid.UUID
Provider string
ProviderType artel_q.ExternalProviderType
CredentialsJSON json.RawMessage
Metadata json.RawMessage
CreatedAt time.Time
UpdatedAt time.Time
}
type ExternalConnectionMeta ¶
type FeatureSet ¶
type FeatureSet struct {
Emails bool `json:"emails"`
TaskTrackers bool `json:"task_trackers"`
Notes bool `json:"notes"`
Spreadsheets bool `json:"spreadsheets"`
Connectors bool `json:"connectors"`
Tract bool `json:"tract"`
Postgres bool `json:"postgres"`
}
func (FeatureSet) Has ¶
func (f FeatureSet) Has(feature SubscriptionFeature) bool
func (FeatureSet) With ¶
func (f FeatureSet) With(feature SubscriptionFeature, value bool) FeatureSet
With returns a copy of f with feature set to value — used to apply a sparse override map on top of a plan's FeatureSet.
type GitlabCredentials ¶
type GitlabCredentials struct {
PersonalAccessToken string `json:"personal_access_token"`
InstanceUrl string `json:"instance_url"`
WebhookSecret string `json:"webhook_secret,omitempty"`
}
GitlabCredentials is stored encrypted in credentials_enc for the gitlab provider.
type GoogleConnectionMeta ¶
GoogleConnectionMeta is stored plaintext in metadata (non-sensitive display data).
type GoogleOAuthCredentials ¶
type GoogleOAuthCredentials struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
Expiry time.Time `json:"expiry"`
Scope string `json:"scope"`
TokenType string `json:"token_type"`
}
GoogleOAuthCredentials is stored encrypted in credentials_enc.
type HeaderMatcher ¶
type HttpAction ¶
type HttpAction struct {
Method string // GET | POST | PUT | PATCH | DELETE
Url string // may contain ${{params.name}} placeholders
Headers map[string]string // values may be static or __secrets.*
Query map[string]string // values may be static, ${{params.*}}, or __secrets.*
// Body is a JSON template sent as the request body (Content-Type: application/json).
// String leaves are interpolated the same way as Headers/Query values: whole-value
// "__secrets.field" replacement, otherwise ${{params.*}} substitution.
Body json.RawMessage
// TODO: replace with a typed enum once external_connections.provider is constrained in the DB schema.
Credentials string // external_connections.provider to resolve __secrets.*
}
HttpAction drives the HTTP executor with ${{params.*}} / __secrets.* interpolation.
type ImapAction ¶
type ImapAction struct {
Operation ImapOperation
}
type ImapOperation ¶
type ImapOperation string
const ( IMAP_OP_LIST_FOLDERS ImapOperation = "list_folders" IMAP_OP_LIST_MESSAGES ImapOperation = "list_messages" IMAP_OP_FETCH_MESSAGE ImapOperation = "fetch_message" )
type ImportAction ¶
type ImportAction int
ImportAction is how CommitImport resolves a zip entry that CheckImportConflicts previously reported as colliding with an existing note/file.
const ( ImportActionSkip ImportAction = iota ImportActionOverwrite ImportActionRename )
type ImportResolution ¶
type ImportResolution struct {
Path string // conflicting destination path, as reported by CheckImportConflicts
Action ImportAction
RenameTo string // vault-relative rename target; only used when Action == ImportActionRename
}
type ListUsersReq ¶
type MailServerSuggestion ¶
type McpConnector ¶
type McpConnector struct {
Uuid uuid.UUID
McpKeyUuid uuid.UUID
McpName string
ExternalConnectionUuid uuid.UUID
CreatedAt time.Time
}
McpConnector links an McpKey to an McpDefinition via an ExternalConnection. Stored in the mcp_connectors table.
type McpDefinition ¶
type McpKeyContext ¶
type McpKeyContext struct {
KeyUuid uuid.UUID
VaultUuid uuid.UUID
UserUuid uuid.UUID
CouchURL string
CouchDb string
CouchUser string
CouchPass string
S3 *McpKeyS3Context // nil if the vault has no linked bucket
UseCouchDBForBinaries bool
// Postgres is nil unless the vault has an enabled (status=ready) Postgres database.
Postgres *McpKeyPostgresContext
}
McpKeyContext is resolved from a raw bearer token; contains everything needed to connect to CouchDB for the associated vault.
type McpKeyPostgresContext ¶ added in v1.0.15
type McpKeyPostgresContext struct {
Host string
Port int
Database string
Username string
Password string
SSLMode string
}
McpKeyPostgresContext carries the resolved per-vault Postgres role credentials behind an MCP key, when the vault has an enabled (status=ready) Postgres database.
type McpKeyS3Context ¶
type McpKeyS3Context struct {
Endpoint string
Region string
AccessKey string
SecretKey string
UseSSL bool
PathStyle bool
Bucket string
}
McpKeyS3Context carries the resolved S3-compatible bucket credentials for the vault behind an MCP key, when one is linked.
type McpSpreadsheet ¶
type McpToolDef ¶
type McpToolDef struct {
ApiDescription ToolApiDescription
OutputSchema ToolSchema
Action ToolAction
}
type McpToolRef ¶
type McpToolRef struct {
McpName string
Tool McpToolDef
}
McpToolRef pairs a tool definition with the name of the MoM it belongs to — used by cross-MoM catalogs (e.g. McpDefinitionsRepo.ListAllTools) where the owning MoM isn't otherwise recoverable from McpToolDef alone.
type MomCandidate ¶
type MomCandidate struct {
Name string
Author string
Description string
Connections []ExternalConnectionMeta
Tools []McpToolDef
OwnerUserUuid *uuid.UUID
// ViewerIsOwner reports whether the caller is OwnerUserUuid — computed in the service layer
// (which has access to the caller's identity via user_context) so transport handlers never
// need to inspect auth context themselves.
ViewerIsOwner bool
}
MomCandidate is an McpDefinition paired with the caller's external connections that satisfy the providers its tools require.
type OpenAIKeyCredentials ¶
type OpenAIKeyCredentials struct {
ApiKey string `json:"api_key"`
BaseUrl string `json:"base_url,omitempty"` // optional override, e.g. a proxy/regional endpoint
}
OpenAIKeyCredentials is stored encrypted in credentials_enc for the openai provider.
type PendingAuthCode ¶
type PostgresInstance ¶ added in v1.0.15
type PostgresInstance struct {
Uuid uuid.UUID
Host string
Port int
AdminDatabase string
Username string
Password string
SSLMode string
// OwnerUserUuid is nil for an admin-pool instance, non-nil for a BYOK instance owned by that
// user — mirrors CouchInstance/S3Instance owner_user_id scoping (migrations/066).
OwnerUserUuid *uuid.UUID
CreatedAt time.Time
}
PostgresInstance is a registered Postgres server (admin pool or BYOK) that vault databases can be provisioned on — mirrors CouchInstance/S3Instance.
type PostgresKeyCredentials ¶ added in v1.0.15
type PostgresKeyCredentials struct {
Host string `json:"host"`
Port int `json:"port"`
Database string `json:"database"`
Username string `json:"username"`
Password string `json:"password"`
SSLMode string `json:"ssl_mode"`
}
PostgresKeyCredentials is stored encrypted in credentials_enc for the postgres provider.
type RegistrationMode ¶
type RegistrationMode string
RegistrationMode controls who may self-register a new account versus requiring an administrator to create it. See SystemSettings.
const ( RegistrationModeAdminOnly RegistrationMode = "admin_only" RegistrationModeSelfRegister RegistrationMode = "self_register" )
type S3Instance ¶
type S3KeyCredentials ¶
type S3KeyCredentials struct {
Endpoint string `json:"endpoint"`
Region string `json:"region,omitempty"`
AccessKey string `json:"access_key"`
SecretKey string `json:"secret_key"`
UseSSL bool `json:"use_ssl"`
PathStyle bool `json:"path_style"`
}
S3KeyCredentials is stored encrypted in credentials_enc for the s3 provider.
type ScriptLanguage ¶
type ScriptLanguage string
ScriptLanguage is the engine id a script step runs under — a closed set, mapped to/from a real numbered proto enum at the transport boundary (see internal/transport/tracts_api).
const ( ScriptLanguageUnspecified ScriptLanguage = "" ScriptLanguageJavaScript ScriptLanguage = "javascript" )
type ScriptParam ¶
type ScriptParam struct {
Name string
Property ToolProperty
}
ScriptParam is one named, typed, ordered entry in a script step's declared input or output list — ordered (unlike ToolSchema.Properties, a map) because order drives the function signature generated around the step's user-authored Code.
type SimpleChat ¶ added in v1.0.25
type SimpleChat struct {
Uuid uuid.UUID
VaultUuid uuid.UUID
UserUuid uuid.UUID
// Title is nil until the engine (or the user) names the chat — a nil title is rendered as
// e.g. "New chat" / the first user message by the frontend, not stored as such here.
Title *string
Model string
VaultAccess bool
CreatedAt time.Time
UpdatedAt time.Time
LastActivityAt time.Time
}
SimpleChat is one saved chat thread of the in-process, container-free "Simple Chat" agent — a vault member picks an OpenRouter BYOK model and chats with an agent that can call Artel's existing MCP tools. A (vault, user) pair may have several SimpleChat rows (multiple saved threads); see migrations/075_simple_chats.sql.
type SimpleChatFile ¶ added in v1.0.25
type SimpleChatFile struct {
Header SimpleChatHeader
Messages []SimpleChatMessage
}
SimpleChatFile is a chat's JSONL transcript decoded into memory: the header line plus every message line, in file order. simplechat.Service reads, mutates, and rewrites this whole on every change — see ChatHistoryPath.
func DecodeSimpleChatFile ¶ added in v1.0.25
func DecodeSimpleChatFile(content []byte) (SimpleChatFile, error)
DecodeSimpleChatFile parses JSONL bytes written by EncodeSimpleChatFile back into a SimpleChatFile. Each decoded message's ChatUuid is stamped from the header's id, since the per-line JSON carries no chat id of its own — it's implied by the file itself.
func (SimpleChatFile) HasMessages ¶ added in v1.0.25
func (f SimpleChatFile) HasMessages() bool
HasMessages reports whether f has at least one message line — the CouchDB-era replacement for the Postgres EXISTS(...) check ListSimpleChatsByVaultAndUser used to filter on: a thread created but never sent a first message stays hidden from ListChats until this turns true.
func (SimpleChatFile) NextSeq ¶ added in v1.0.25
func (f SimpleChatFile) NextSeq() int64
NextSeq returns the seq value the next appended message should carry — 1-based position among message lines, so it needs no separately stored counter.
type SimpleChatHeader ¶ added in v1.0.25
type SimpleChatHeader struct {
Type simpleChatLineType `json:"type"`
Uuid uuid.UUID `json:"id"`
VaultUuid uuid.UUID `json:"vault_id"`
UserUuid uuid.UUID `json:"user_id"`
// Title is nil until the engine (or the user) names the chat — see SimpleChat.Title.
Title *string `json:"title,omitempty"`
Model string `json:"model"`
VaultAccess bool `json:"vault_access"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LastActivityAt time.Time `json:"last_activity_at"`
// ToolAllowances remembers a chat's "allow always" answers, keyed by tool name.
ToolAllowances map[string]string `json:"tool_allowances,omitempty"`
}
SimpleChatHeader is line 0 of a chat's JSONL transcript: the thread's own metadata plus its remembered "allow always" tool-permission decisions — the CouchDB-era replacement for migrations/075_simple_chats.sql's row shape and migrations/077_simple_chat_tool_allowances.sql.
func (SimpleChatHeader) ToSimpleChat ¶ added in v1.0.25
func (h SimpleChatHeader) ToSimpleChat() SimpleChat
ToSimpleChat projects a decoded header into the SimpleChat wire/service shape.
type SimpleChatMessage ¶ added in v1.0.25
type SimpleChatMessage struct {
Uuid uuid.UUID
ChatUuid uuid.UUID
Role string
Content string
ToolCallID *string
ToolName *string
ToolInput json.RawMessage
IsError bool
Model *string
Attachments []string
Seq int64
CreatedAt time.Time
}
SimpleChatMessage is one turn (or tool step) in a SimpleChat's history — see migrations/076_simple_chat_messages.sql. Role is one of the SimpleChatRole constants above:
- user: ToolCallID/ToolName/ToolInput/Model unset, Content is the member's message text. Attachments carries the vault-relative paths the member attached, display-only — it plays no part in what was sent to the model, which stays folded into Content alone.
- assistant: Content is the model's reply text (possibly empty when the turn was pure tool calls); Model is the model that produced it. ToolCallID/ToolName/ToolInput are unset here — a requested tool call is recorded as its own row (see below), mirroring how internal/chatprotocol.Event separates assistant text from tool_call_started.
- tool: one row per tool invocation the agent made — ToolCallID/ToolName/ToolInput carry the call, Content carries the tool's result (or the error message when IsError is true).
type SimpleChatRole ¶ added in v1.0.25
type SimpleChatRole string
SimpleChatRole is the role of a SimpleChatMessage — see that struct's doc comment.
const ( SimpleChatRoleUser SimpleChatRole = "user" SimpleChatRoleAssistant SimpleChatRole = "assistant" SimpleChatRoleTool SimpleChatRole = "tool" )
type Skill ¶ added in v1.0.25
type Skill struct {
Slug string
Name string
Description string
StorageMode SkillStorageMode
Body string
IsHotPlug bool
IsSystem bool
}
Skill is a plain in-memory value, never a DB row: it is assembled fresh on every read from a CouchDB note's frontmatter + path (slug = filename), or — for the system skill — from a Go constant. There is no persistent Skill table/repository.
type SkillStorageMode ¶ added in v1.0.25
type SkillStorageMode string
SkillStorageMode is a hint the skill's frontmatter carries for how an agent following the skill should persist data it produces: nothing structured, freeform vault notes, or a dedicated Postgres schema the agent designs itself (see skills.SystemSkill's instructional body — Artel never auto-creates tables/procedures for structured mode).
const ( SkillStorageNone SkillStorageMode = "none" SkillStorageFreeform SkillStorageMode = "freeform_notes" SkillStorageStructured SkillStorageMode = "structured" )
type SmtpAction ¶
type SmtpAction struct {
Operation SmtpOperation
}
type StorageUsage ¶
StorageUsage is a point-in-time measurement of a user's storage footprint across all of their vaults: CouchDB (markdown notes, and binaries when UseCouchDBForBinaries) plus S3 (binaries, for vaults with a bucket linked).
type Subscription ¶
type Subscription struct {
UserUuid uuid.UUID
Active bool
PlanKey string
FeatureOverrides map[SubscriptionFeature]bool
CouchQuotaOverrideBytes *int64
S3QuotaOverrideBytes *int64
MaxHotPlugSkillsOverride *int
MaxTotalSkillsOverride *int
}
Subscription is the per-user row: which plan the user is on, plus admin-granted overrides on top of that plan — sparse (only keys present in FeatureOverrides override the plan's FeatureSet) so most users have an empty override map and simply inherit their plan.
type SubscriptionFeature ¶
type SubscriptionFeature string
const ( FeatureEmails SubscriptionFeature = "emails" FeatureTaskTrackers SubscriptionFeature = "task_trackers" FeatureNotes SubscriptionFeature = "notes" FeatureSpreadsheets SubscriptionFeature = "spreadsheets" FeatureConnectors SubscriptionFeature = "connectors" FeatureTract SubscriptionFeature = "tract" FeaturePostgres SubscriptionFeature = "postgres" )
type SubscriptionPlan ¶
type SystemSettings ¶
type SystemSettings struct {
SystemPrompt string
SetupCompleted bool
PasswordAuthEnabled bool
TelegramAuthEnabled bool
RegistrationMode RegistrationMode
// SetupTokenHash/SetupTokenIssuedAt back the one-time setup token minted on first run to
// authorize the initial admin creation. Empty/zero once CompleteSetup has cleared them.
SetupTokenHash string
SetupTokenIssuedAt time.Time
// DefaultDocsVaultID is the admin-configured vault an unauthenticated visitor hitting
// `/docs` (no slug) is redirected to. Nil when unset — see public_docs.Service.GetDefaultVault.
DefaultDocsVaultID *uuid.UUID
// DefaultDocsSource selects between DefaultDocsVaultID and the built-in GitHub quick-start
// guide for that same `/docs` redirect — see public_docs.Service.GetDefaultVault.
DefaultDocsSource DocsSource
CreatedAt time.Time
UpdatedAt time.Time
}
SystemSettings is the single-row (id=1) global configuration for the first-run setup wizard and instance-wide auth policy — see migrations/064_system_settings.sql and, for DefaultDocsVaultID, migrations/069_default_docs_vault.sql.
type TaskTracker ¶
type TaskTracker struct {
Uuid uuid.UUID
UserUuid uuid.UUID
Type string
Name string
CreatedAt time.Time
}
TaskTracker is the task_trackers_api wire-shape view over a trello external_connections row — backed entirely by external_connections + MoM (see internal/service/v1/tasktracker), not by a dedicated table. Credentials never surface here; they stay inside external_connections' encrypted CredentialsJSON and are only touched by the MoM http executor.
type TelegramCredentials ¶
type TelegramCredentials struct {
BotToken string `json:"bot_token"`
// ChatID is captured from the first inbound webhook update once the user messages their
// linked bot; zero until then.
ChatID int64 `json:"chat_id,omitempty"`
// WebhookSecret is generated when the connection is created and passed to Telegram's
// setWebhook as secret_token, then compared against the X-Telegram-Bot-Api-Secret-Token
// header on each inbound webhook request (mirrors GitlabCredentials.WebhookSecret).
WebhookSecret string `json:"webhook_secret,omitempty"`
}
TelegramCredentials is stored encrypted in credentials_enc for the telegram provider.
type TelegramIdentity ¶
type TerminalTab ¶ added in v1.0.25
TerminalTab is one tmux window inside a workbench's tmux session, surfaced to the browser as a terminal tab. ID is tmux's own #{window_id} (e.g. "@1") — stable across window renumbering, unlike #{window_index}.
type ToolAction ¶
type ToolAction struct {
Imap *ImapAction
Smtp *SmtpAction
Http *HttpAction
}
ToolAction is a discriminated union — exactly one field must be non-nil.
type ToolApiDescription ¶
type ToolApiDescription struct {
Name string
Description string
Properties map[string]ToolProperty
Required []string
}
ToolApiDescription is the LLM-visible metadata for a tool.
type ToolExecResult ¶
ToolExecResult is the result of executing a built-in MCP tool (vault tools, connections). Text holds marshaled JSON/plain text results; Data/MimeType/ResourcePath are set instead for binary file reads.
type ToolProperty ¶
type ToolProperty struct {
Type string // "string" | "integer" | "number" | "boolean" | "array" | "object"
Description string
Enum []string // non-empty when the param is constrained to a fixed set of values
Properties map[string]ToolProperty // nested fields when Type == "object"
Items *ToolProperty // element schema when Type == "array"
Required []string // required nested field names when Type == "object"
}
ToolProperty describes one input or output parameter. Recursive for object/array types: object properties nest via Properties (+ their own Required), array elements via Items.
type ToolSchema ¶
type ToolSchema struct {
Properties map[string]ToolProperty
Required []string
IsArray bool
Items *ToolProperty
}
ToolSchema is a standalone {properties, required} object schema — the same shape as ToolApiDescription's input fields, reused to describe a tool's output. Empty (no properties, no required) means the output shape is undeclared.
IsArray marks the whole schema as describing a list rather than an object: when true, the tool's output is an array of Items and Properties/Required are unused (left zero) — mirrors how ToolProperty itself models a nested array via Type=="array"+Items, just promoted to the schema root.
type Tract ¶
type Tract struct {
Uuid uuid.UUID
UserUuid uuid.UUID
Name string
Description string
Enabled bool
Definition TractDefinition
CreatedAt time.Time
UpdatedAt time.Time
}
Tract is a user-owned automation workflow. Definition is the entire step tree, persisted as a single JSONB document (not normalized rows) — matches the "UI/agents edit whole docs" convention: UpdateTract replaces Definition wholesale.
type TractCondition ¶
type TractCondition struct {
Left string `json:"left"`
Op string `json:"op"`
Right string `json:"right"`
}
TractCondition is {left, op, right} — both sides are template strings rendered before comparison. json tags: consumed directly by internal/transport/tracts_api/to_proto.go's filtersFromJSON via json.Unmarshal.
type TractDefinition ¶
type TractDefinition struct {
Steps []TractStep `json:"steps"`
}
TractDefinition is the JSON-serialized step tree — json tags live here because the engine/validation layer (internal/service/v1/tract) marshals it directly for Postgres JSONB storage. The wire (proto) shape is a typed oneof-per-step-kind message, mapped to/from this flat struct by internal/transport/tracts_api/to_proto.go's stepToProto/stepFromProto.
type TractRun ¶
type TractRun struct {
Uuid uuid.UUID
TractUuid uuid.UUID
TriggerUuid uuid.UUID
StartedBy string // "webhook" | "manual" | "mcp"
Status TractRunStatus
TriggerPayload json.RawMessage // normalized payload / manual form values
Error string
CreatedAt time.Time
UpdatedAt time.Time
}
TractRun is one execution of a tract, persisted before the step walk starts (persist-before-apply). TriggerUuid zero value = manual/mcp run (no trigger fired it).
type TractRunStatus ¶
type TractRunStatus string
const ( TractRunRunning TractRunStatus = "running" TractRunDone TractRunStatus = "done" TractRunFailed TractRunStatus = "failed" )
type TractRunStep ¶
type TractRunStep struct {
Uuid uuid.UUID
RunUuid uuid.UUID
StepId string
StepName string
StepType string
Input json.RawMessage
Output json.RawMessage
Status TractRunStepStatus
Error string
StartedAt time.Time
FinishedAt time.Time // zero value = not finished yet
}
TractRunStep is one executed step within a run (audit trail + state store). StepId is the TractStep.Id string (steps live in a JSONB tree now, not their own rows, so there is no step row uuid to reference) — StepName/StepType are captured at execution time so history reads correctly even if the tract definition changes later.
type TractRunStepStatus ¶
type TractRunStepStatus string
const ( TractRunStepRunning TractRunStepStatus = "running" TractRunStepDone TractRunStepStatus = "done" TractRunStepFailed TractRunStepStatus = "failed" )
type TractStep ¶
type TractStep struct {
Id string `json:"id"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Type string `json:"type"`
Mcp string `json:"mcp,omitempty"`
Tool string `json:"tool,omitempty"`
ConnectionUuid uuid.UUID `json:"connection_uuid,omitempty"`
Params map[string]string `json:"params,omitempty"`
Conditions []TractCondition `json:"conditions,omitempty"`
Then []TractStep `json:"then,omitempty"`
Else []TractStep `json:"else,omitempty"`
Steps []TractStep `json:"steps,omitempty"`
Language ScriptLanguage `json:"language,omitempty"`
Code string `json:"code,omitempty"`
InputParams []ScriptParam `json:"input_params,omitempty"`
OutputParams []ScriptParam `json:"output_params,omitempty"`
LlmConnectionUuid uuid.UUID `json:"llm_connection_uuid,omitempty"`
LlmModel string `json:"llm_model,omitempty"`
Prompt string `json:"prompt,omitempty"`
SystemPrompt string `json:"system_prompt,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
}
TractStep is one node of the nested step tree. Type is one of "action" | "condition" | "parallel" | "group" | "script" | "llm_call" (constants defined locally in internal/service/v1/tract, not here). Action fields (Mcp/Tool/ConnectionUuid/Params) are only meaningful when Type == "action". Conditions only when Type == "condition", with Then/Else as its two branches. Parallel/group steps run/contain Steps (parallel: concurrently; group: sequentially, a plain nesting container). ConnectionUuid's zero value means no external connection required (builtin tools). Script fields (Language/Code/InputParams/OutputParams) are only meaningful when Type == "script" — Params is reused there too, as the template-expression binding for each declared InputParams entry (same role it plays for action steps).
LLM fields — only meaningful when Type == "llm_call". LlmConnectionUuid points at the external_connections row (provider "anthropic", "openai" once that lands) supplying the key — named distinctly from ConnectionUuid only to avoid colliding with the action-step field's semantics (MoM connection vs. LLM key connection are different things even though both are external_connections rows). Prompt and SystemPrompt are template strings rendered through the same resolver as action Params — {{steps.<id>.output...}} and {{trigger...}} both work here — but are plain strings rather than a map, since there's a single prompt, not a bag of named params.
type TractTemplate ¶
type TractTemplate struct {
Uuid uuid.UUID
SourceTractUuid uuid.UUID
OwnerUuid uuid.UUID
Name string
Description string
Definition TractDefinition
Category string
InstallCount int
PublishedAt time.Time
UpdatedAt time.Time
}
TractTemplate is an immutable published snapshot of a Tract, browsable/copyable by any user (not just its owner). Definition is copied at publish time — it is NOT a live view of the source tract; later edits to the source tract never propagate here. Every ConnectionUuid inside Definition's step tree is always zero: those uuids referenced per-user external_connections rows belonging to the publisher's account, meaningless (and unsafe to expose) to anyone who installs the template into their own account, so they are stripped to nil at publish time. SourceTractUuid is zero if the source tract has since been deleted (source_tract_id is ON DELETE SET NULL — the template snapshot is designed to outlive it). OwnerUuid zero value has a second meaning beyond "unset": it also marks a built-in template seeded via migration (owner_id NULL in the DB — see migration 055/056), owned by nobody and permanently unremovable by any real user (see UnpublishTemplate).
type TrelloBoard ¶
type TrelloMember ¶
type TrelloMember struct {
FullName string
}
type Trigger ¶
type Trigger struct {
Uuid uuid.UUID
TriggerUuid uuid.UUID
UserUuid uuid.UUID
Name string
Kind string // "webhook" | "manual"
Source string // "gitlab_push" | "generic"
Config json.RawMessage
PayloadSchema ToolSchema
SecretHash []byte
// TokenSuffix is the last 4 hex chars of the raw webhook token, kept in plaintext (unlike
// SecretHash) purely so the UI can render a persistent "••••1234" reminder; never enough to
// reconstruct the token. Empty for manual/provider-linked triggers.
TokenSuffix string
// Matchers gates which triggers (among possibly several sharing one provider link, see
// trigger_provider_links) actually fire for a given inbound delivery. Seeded from the chosen
// TriggerPreset's DefaultMatchers at creation time; empty always matches (standalone
// triggers, which are the only recipient of their own webhook URL anyway).
Matchers TriggerMatchers
Enabled bool
CreatedAt time.Time
}
Trigger is a standalone, user-owned trigger — reusable across multiple tracts via TriggerTractLink. Uuid is the stable primary key (used for owner-facing CRUD/API refs); TriggerUuid is a SEPARATE, independently rotatable id embedded in the public webhook URL — rotating it invalidates old webhook URLs without disturbing Uuid-keyed references (tract links, etc). SecretHash is sha256(raw webhook token); nil for manual triggers.
type TriggerMatchers ¶
type TriggerMatchers struct {
CheckHeaders []HeaderMatcher
CheckBody []BodyMatcher
}
TriggerMatchers decides whether an inbound delivery should fire a given trigger — AND semantics across all CheckHeaders/CheckBody entries (same philosophy as EvaluateTriggerFilters); future check kinds (mail subject/from match) extend this struct the same way TractCondition covers filter ops.
type TriggerPreset ¶
type TriggerPreset struct {
Key string
Category string
Label string
Description string
Provider string
PayloadSchema ToolSchema
DefaultMatchers TriggerMatchers
}
TriggerPreset describes one webhook trigger source (e.g. "gitlab_push") — backed by the trigger_presets table (seeded via migration, see 038_trigger_presets_and_links.sql), not hardcoded Go. Provider is the external_connections.provider a trigger created from this preset attaches to (see trigger_provider_links); empty means standalone (own trigger_uuid/secret_hash webhook URL, user-declared PayloadSchema).
type TriggerTractLink ¶
type TriggerTractLink struct {
TriggerUuid uuid.UUID
TractUuid uuid.UUID
Filters []TractCondition
}
TriggerTractLink links triggerUuid to tractUuid with filter conditions (AND semantics) that gate whether a given webhook delivery starts a run for that specific tract.
type UserDetails ¶
type UserDetails struct {
User
Permissions UserPermissions
EffectiveSubscription EffectiveSubscription
}
type UserIdentities ¶
type UserIdentities struct {
Telegram *TelegramIdentity
Artel *ArtelIdentity
}
type UserPermissions ¶
UserPermissions now holds only the internal admin-access flag — per-feature gating (emails, notes, task trackers, spreadsheets, connectors, tract) moved to the subscription layer, see SubscriptionFeature/FeatureSet in subscription.go.
type UserSettings ¶ added in v1.0.25
type Vault ¶
type Vault struct {
Uuid uuid.UUID
UserUuid uuid.UUID
CouchInstanceUuid uuid.UUID
Name string
CouchDBName string
CouchDBURL string
LiveSyncPassphrase string
Status string
S3InstanceUuid *uuid.UUID // nil when vault has no linked bucket
S3BucketName string // "" when S3InstanceUuid is nil
UseCouchDBForBinaries bool
CreatedAt time.Time
IsPublic bool
Slug string // "" when vault has never been published
Prompt string
UseSystemPrompt bool
// MyRole is the calling user's membership role on this vault ("owner"/"reader"/"maintainer"),
// or "" if they have no membership row. Only populated by ListByMembership — every other
// repo method (GetByID, CreateVault, etc.) has no "calling user" concept and leaves it "".
MyRole string
}
type VaultInvite ¶
type VaultMember ¶
type VaultMemberInfo ¶
type VaultMemberInfo struct {
VaultMember
Email string
Username string
}
type VaultPostgresDatabase ¶ added in v1.0.15
type VaultPostgresDatabase struct {
VaultUuid uuid.UUID
PostgresInstanceUuid uuid.UUID
DatabaseName string
RoleUsername string
RolePassword string
Status VaultPostgresStatus
ErrorMessage string
CreatedAt time.Time
UpdatedAt time.Time
}
VaultPostgresDatabase is the per-vault Postgres database+role provisioned on a PostgresInstance — mirrors the Workbench provisioning→ready/error lifecycle.
type VaultPostgresStatus ¶ added in v1.0.15
type VaultPostgresStatus string
const ( VaultPostgresStatusProvisioning VaultPostgresStatus = "provisioning" VaultPostgresStatusReady VaultPostgresStatus = "ready" VaultPostgresStatusError VaultPostgresStatus = "error" )
type Workbench ¶
type Workbench struct {
Uuid uuid.UUID
VaultUuid uuid.UUID
UserUuid uuid.UUID
Status WorkbenchStatus
AuthMode WorkbenchAuthMode // "" when not yet started
ContainerId string // "" only in the creation-failed/retry edge case
VolumeName string
CreatedAt time.Time
StartedAt *time.Time // nil until started
StoppedAt *time.Time // nil until stopped
// DockerHostUuid is the docker_hosts row this workbench's container/volume live on, assigned
// at CreateWorkbench time by picking the least-loaded host — see
// internal/service/v1/workbench/workbench.go's resolveClient. nil only for rows created
// before the docker_hosts pool existed.
DockerHostUuid *uuid.UUID
}
Workbench is a thin reflection of the Docker container backing a vault's cloud workbench; Status moves through the WorkbenchStatus values above as CreateWorkbench/StartWorkbench/ StopWorkbench/DeleteWorkbench (internal/service/v1/workbench) proceed.
type WorkbenchAuthMode ¶
type WorkbenchAuthMode string
const ( WorkbenchAuthModeAPIKey WorkbenchAuthMode = "api_key" WorkbenchAuthModeSubscriptionLogin WorkbenchAuthMode = "subscription_login" )
type WorkbenchStatus ¶
type WorkbenchStatus string
const ( WorkbenchStatusCreated WorkbenchStatus = "created" WorkbenchStatusConfiguring WorkbenchStatus = "configuring" WorkbenchStatusRunning WorkbenchStatus = "running" WorkbenchStatusStopped WorkbenchStatus = "stopped" WorkbenchStatusRemoved WorkbenchStatus = "removed" )
Source Files
¶
- couch_account.go
- couch_instance.go
- docker_host.go
- email.go
- external_connection.go
- mcp_key.go
- mom.go
- mom_connector.go
- notes.go
- pagination.go
- pending_auth_code.go
- postgres_instance.go
- prompt.go
- s3_instance.go
- session.go
- simple_chat.go
- skill.go
- spreadsheets.go
- subscription.go
- system_settings.go
- task_tracker.go
- tool_exec_result.go
- tract.go
- trello.go
- user.go
- vault.go
- vault_postgres_database.go
- workbench.go