Documentation
¶
Index ¶
- Constants
- type APIKeyCredentials
- type AnthropicKeyCredentials
- type ArtelIdentity
- type BodyMatcher
- type CouchAccount
- type CouchDBKeyCredentials
- type CouchInstance
- type CouchInstanceWithAccount
- type DockerHost
- 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 SmtpAction
- type SmtpOperation
- type StorageUsage
- type Subscription
- type SubscriptionFeature
- type SubscriptionPlan
- type SystemSettings
- type TaskTracker
- type TelegramCredentials
- type TelegramIdentity
- 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 Vault
- type VaultInvite
- type VaultMember
- type VaultMemberInfo
- type VaultPostgresDatabase
- type VaultPostgresStatus
- type Workbench
- type WorkbenchAuthMode
- type WorkbenchLoginPrompt
- type WorkbenchLoginState
- type WorkbenchStatus
Constants ¶
const ( ProviderGoogleSheets = "google_sheets" ProviderTrello = "trello" ProviderMiro = "miro" ProviderEmail = "email" ProviderGitlab = "gitlab" ProviderAnthropic = "anthropic" ProviderTelegram = "telegram" ProviderOpenAI = "openai" ProviderS3 = "s3" ProviderCouchDB = "couchdb" ProviderPostgres = "postgres" )
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.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 — see docs/workbench/02_docker_topology.md. 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 EffectiveSubscription ¶
type EffectiveSubscription struct {
UserUuid uuid.UUID
Active bool
PlanKey string
Features FeatureSet
CouchQuotaBytes int64
S3QuotaBytes int64
}
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 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
}
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 {
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
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.
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"`
}
TelegramCredentials is stored encrypted in credentials_enc for the telegram provider.
type TelegramIdentity ¶
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 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
// 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 — see docs/workbench/01_data_model_and_lifecycle.md for the full state machine.
type WorkbenchAuthMode ¶
type WorkbenchAuthMode string
const ( WorkbenchAuthModeAPIKey WorkbenchAuthMode = "api_key" WorkbenchAuthModeSubscriptionLogin WorkbenchAuthMode = "subscription_login" )
type WorkbenchLoginPrompt ¶
type WorkbenchLoginPrompt struct {
State WorkbenchLoginState
URL string
ErrorMessage string
}
WorkbenchLoginPrompt is a snapshot of the subscription_login TUI flow's current state. URL is only meaningful when State == WorkbenchLoginStateURLPresent; ErrorMessage only when State == WorkbenchLoginStateError.
type WorkbenchLoginState ¶
type WorkbenchLoginState string
WorkbenchLoginState is the state of the in-container subscription_login TUI flow, derived by parsing a tmux capture-pane snapshot of the workbench's session — see docs/workbench/03_auth_and_login_flow.md, "Mechanism (confirmed)".
const ( // WorkbenchLoginStatePending: claude hasn't printed the OAuth authorize URL yet (e.g. the // one-time theme-selection screen or the login-method menu is still showing). Nothing // actionable for the caller besides "keep polling". WorkbenchLoginStatePending WorkbenchLoginState = "pending" // WorkbenchLoginStateURLPresent: the OAuth authorize URL has been printed and claude is // waiting for a pasted code. URL is populated. WorkbenchLoginStateURLPresent WorkbenchLoginState = "url_present" // WorkbenchLoginStateError: a previously submitted code was rejected ("OAuth error: ..."). // ErrorMessage is populated; the caller should let the user retry. WorkbenchLoginStateError WorkbenchLoginState = "error" // WorkbenchLoginStateAuthorized: neither the login prompt/menu nor an error is visible // anymore — login completed. WorkbenchLoginStateAuthorized WorkbenchLoginState = "authorized" )
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
- 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