model

package
v0.0.124 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: GPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

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

Documentation

Index

Constants

View Source
const (
	HarnessClaude  = "claude"
	HarnessCodex   = "codex"
	HarnessBedrock = "bedrock"
)

Harness names an agent backend. claude/codex are LOCAL CLI harnesses the runner drives by spawning a process; bedrock is an API harness — the agent loop calls a hosted LLM (AWS Bedrock Converse) instead of a local CLI, so it has the chat/workspace tool surface but NO local shell or filesystem.

View Source
const (
	ExecutionRunner = "runner"
	ExecutionServer = "server"
)

Execution modes for API harnesses. API harnesses run SERVER-side only: the backend executes the loop on the service's task role, so the agent answers with no desktop app open and an invoker's own cloud credentials are never involved. ExecutionRunner survives only as a legacy stored value — Resolve coerces it to server, validators reject it on write, and the runner claim path skips server runs outright. CLI harnesses are always runner-executed.

View Source
const (
	AgentStatusActive     = "active"
	AgentStatusNeedsSetup = "needs_setup"
	AgentStatusOffline    = "offline"
)

Per-invoker agent availability, derived at read time (never stored on the agent — agents belong to no one). NeedsSetup means the CALLER's runners lack the harness their pin resolves to; Offline means no live runner.

View Source
const (
	AutoAllowRead  = "read"  // Read / Glob / Grep / notebook reads
	AutoAllowEdit  = "edit"  // Edit / MultiEdit / Write / NotebookEdit
	AutoAllowShell = "shell" // Bash
	AutoAllowWeb   = "web"   // WebFetch / WebSearch
)

Harness tool classes a user may pre-approve (UserAgentPrefs.AutoAllow).

View Source
const (
	FollowUpOff    = "off"    // default: mentions only
	FollowUpWindow = "window" // follow for FollowUpMins after the agent's last post
	FollowUpAlways = "always" // follow the thread indefinitely
)

Follow-up modes.

View Source
const (
	OfflinePolicyReject = "reject"
	OfflinePolicyQueue  = "queue"
)

Offline policies: what a mention does when the invoker has no live runner. Reject (default) fails fast with a legible notice; queue holds the run until the invoker's desktop app comes online (bounded — see the orchestrator's queue TTL).

View Source
const (
	ApprovalPending  = "pending"
	ApprovalApproved = "approved"
	ApprovalDenied   = "denied"
	ApprovalExpired  = "expired"
)

Approval lifecycle states.

View Source
const (
	ApprovalMaxOptions   = 5
	ApprovalOptionMaxLen = 120
)

Approval option bounds (ask_user).

View Source
const (
	ArtifactMaxBytes = 64 * 1024
	ArtifactsPerRun  = 5
	// UploadsPerRun caps the files one run may store for its posts, and
	// UploadMaxBytes caps each one. Generous for a report with a few
	// screenshots; far below what a loop could do with the bucket.
	UploadsPerRun  = 20
	UploadMaxBytes = 10 << 20
	// Raw API responses (auto-captured connector_call bodies) get their own,
	// larger budget — they exist so a human can audit what the agent actually
	// saw, and a research-y run makes a dozen calls.
	ArtifactKindAPIResponse    = "api_response"
	APIResponseArtifactsPerRun = 25
)

Artifact bounds.

View Source
const (
	SkillNameMaxLen         = 64
	SkillDescriptionMaxLen  = 256
	SkillInstructionsMaxLen = 8 * 1024

	// SkillVisibilityPrivate: only the author sees or uses it (the default for
	// a newly created skill). SkillVisibilityPublished: shared workspace-wide.
	SkillVisibilityPrivate   = "private"
	SkillVisibilityPublished = "published"
)

Skill bounds and visibility values.

View Source
const (
	WatchActionNotify     = "notify"     // DM the creator only; never posts publicly
	WatchActionDraft      = "draft"      // DM the creator a ready-to-send reply; never posts
	WatchActionReply      = "reply"      // may post publicly, but must request_approval first
	WatchActionAutonomous = "autonomous" // may post publicly with no approval
)

Watcher action modes — the safety dial, ascending in autonomy. Enforced server-side: notify/draft runs cannot post publicly (only DM the creator).

View Source
const (
	RunModeDirect    = "direct"
	RunModeWatch     = "watch"     // subscription-triggered
	RunModeHeartbeat = "heartbeat" // periodic idle check-in
	RunModeFollowUp  = "followup"  // un-tagged invoker reply in a followed thread
	RunModeTask      = "task"      // bound to a coding task (uncapped, workspace-backed)
	// RunModeScheduled is a cron-driven standing order. It carries the DIRECT
	// budget, not the ambient one: the creator explicitly asked for this work
	// ("pull yesterday's numbers and summarize"), which takes real tool calls,
	// unlike a heartbeat's "glance and usually say nothing".
	RunModeScheduled = "scheduled"
)

Run modes beyond plain mentions.

View Source
const (
	TokenScopeRunner = "runner" // ex-runner: register/claim/heartbeat/report/renew
	TokenScopeRun    = "run"    // one run's MCP tool calls, invoker-scoped
)

Token scopes. An empty Scope is an ordinary interactive session token. Scoped tokens are accepted ONLY by their dedicated middleware — the regular Auth middleware rejects them, so a leaked runner or run token can never drive the interactive API.

View Source
const (
	BlockSection = "section"
	BlockActions = "actions"
	BlockContext = "context"
	BlockDivider = "divider"
	BlockHeader  = "header"
	// BlockInput is a form field: a label, an optional hint, and one input
	// element. Forms (views) only; a message drops it.
	BlockInput = "input"
	// BlockImage is a picture with alt text and an optional title, drawn
	// through ex's image proxy.
	BlockImage = "image"
	// BlockRichText is formatted text built from parts rather than markdown:
	// paragraphs, headings, lists, quotes and code (Content), with styled
	// pieces — bold, colours, links, mentions, dates, pills — in each.
	BlockRichText = "rich_text"
	// BlockCallout is rich text in a tinted box with an emoji: a note, a
	// warning, a tip.
	BlockCallout = "callout"
	// BlockToggle is a summary line people click to show the blocks under it
	// (logs, details) — kept out of the way until wanted.
	BlockToggle = "toggle"
	// BlockTable is rows and columns of rich text: status matrices, rotas.
	BlockTable = "table"
	// BlockColumns lays 2 or 3 column blocks side by side (stacked when
	// narrow); BlockColumn is one of them, holding its own blocks.
	BlockColumns = "columns"
	BlockColumn  = "column"
	// BlockChart is a bar, line or donut chart ex draws from the app's
	// numbers — no image, nothing fetched.
	BlockChart = "chart"
)

Block kinds a message can carry (Slack's Block Kit, the subset ex draws). The service layer drops any other kind when it normalizes a payload.

View Source
const (
	ChartBar   = "bar"
	ChartLine  = "line"
	ChartDonut = "donut"
)

Chart kinds.

View Source
const (
	AlignLeft   = "left"
	AlignCenter = "center"
	AlignRight  = "right"
)

Table column alignments.

View Source
const (
	RichParagraph = "paragraph"
	RichHeading   = "heading"
	RichList      = "list"
	RichQuote     = "quote"
	RichCode      = "code"
)

Rich text nodes: the paragraph-level parts of a rich_text block.

View Source
const (
	RichSpanText    = "text"
	RichSpanUser    = "user"
	RichSpanChannel = "channel"
	RichSpanEmoji   = "emoji"
	RichSpanDate    = "date"
	RichSpanPill    = "pill"
)

Rich text spans: the inline pieces of a paragraph, heading, quote or list item. A span with no type is text.

View Source
const (
	RichListBullet  = "bullet"
	RichListOrdered = "ordered"
)

List styles.

View Source
const (
	TextPlain    = "plain_text"
	TextMarkdown = "markdown"
	TextMrkdwn   = "mrkdwn"
)

Text kinds. "mrkdwn" is accepted from Slack-shaped payloads and stored as "markdown": both mean ex markdown (**bold**), not Slack's *bold*.

View Source
const (
	ElementPlainTextInput    = "plain_text_input"
	ElementNumberInput       = "number_input"
	ElementEmailInput        = "email_text_input"
	ElementURLInput          = "url_text_input"
	ElementDatepicker        = "datepicker"
	ElementTimepicker        = "timepicker"
	ElementStaticSelect      = "static_select"
	ElementMultiStaticSelect = "multi_static_select"
	ElementUsersSelect       = "users_select"
	ElementMultiUsersSelect  = "multi_users_select"
	ElementCheckboxes        = "checkboxes"
	ElementRadioButtons      = "radio_buttons"
	// ElementOverflow is a ⋯ menu of up to five options (messages only).
	ElementOverflow = "overflow"
)

Elements that take a value. Each one can sit in a form field; the ones IsMessageInteractive names can also sit in a message's actions row or a section's accessory, where using them calls the app.

View Source
const (
	ButtonPrimary = "primary"
	ButtonDanger  = "danger"
)

Button styles.

View Source
const (
	// ExActionAck records who acknowledged first; the button gives way to
	// "Acknowledged by …".
	ExActionAck = "ack"
	// ExActionVote toggles the clicker's vote and shows the count.
	ExActionVote = "vote"
)

Built-in actions: buttons ex handles itself, with no app server.

View Source
const (
	ProjectDescriptionMaxLen = 2000
	ProjectDesignNotesMaxLen = 8000
	ProjectLinksMax          = 10
	ProjectScreensMax        = 60
	ScreenPageMaxLen         = 80
	ScreenDescriptionMaxLen  = 300
	ScreenFieldMaxLen        = 120
	// ScreenImageMaxBytes caps a reference screenshot; agents load these
	// into their context, so huge images only cost tokens.
	ScreenImageMaxBytes    = 8 << 20
	ProjectUILibraryMaxLen = 300
	// ProjectThemeMaxBytes caps an uploaded theme stylesheet (globals.css).
	ProjectThemeMaxBytes = 256 << 10
)

Project design-reference bounds.

View Source
const (
	ScreenViewportDesktop = "desktop"
	ScreenViewportMobile  = "mobile"
)

Screen viewports.

View Source
const (
	RepoRoleBackend  = "backend"
	RepoRoleFrontend = "frontend"
	RepoRoleMobile   = "mobile"
	RepoRoleInfra    = "infra"
	RepoRoleOther    = "other"
)

Repo roles.

View Source
const (
	TaskKindBug     = "bug"
	TaskKindFeature = "feature"
	TaskKindChore   = "chore"
)

Task kinds — the flair the channel shows.

View Source
const (
	TaskSteeringRequester = "requester" // default: only the requester directs
	TaskSteeringAnyone    = "anyone"    // any project-channel member may steer
)

Steering modes.

View Source
const (
	TaskTitleMaxLen       = 120
	TaskGoalMaxLen        = 8 * 1024
	TaskProjectPathMaxLen = 200
	TaskProjectNameMaxLen = 64
	TaskNoteMaxLen        = 4 * 1024
	TaskBranchMaxLen      = 120
	TaskMaxRepos          = 6
	TestPlanMaxSteps      = 20
	TestPlanStepMaxLen    = 400
)

Task bounds.

View Source
const (
	ConnectorAgentUseAsk    = "ask"
	ConnectorAgentUseAlways = "always"
	ConnectorAgentUseNever  = "never"
)

Connector agent-use policies.

View Source
const (
	ConnectorSlugMaxLen        = 64
	ConnectorTitleMaxLen       = 128
	ConnectorDescriptionMaxLen = 1024
	ConnectorFileMaxBytes      = 350 * 1024 // stay under the DynamoDB item cap
	ConnectorMaxFiles          = 64
	ConnectorFileNameMaxLen    = 128
	ConnectorTokenMaxLen       = 4096
)

Connector bounds.

View Source
const (
	ConnectorAuthPaste    = "paste"
	ConnectorAuthPassword = "password"
	// ConnectorAuthSSOWindow: connecting opens the service's own SSO entry
	// point (StartURL) in a shell window — the user signs in with their
	// Microsoft account — and the shell captures the service-minted bearer
	// from the redirect matching CapturePattern (falling back to sniffing the
	// Authorization header on the service's own API calls). Install then
	// proceeds exactly like paste, with the captured token. Web clients
	// without a capture-capable shell fall back to pasting.
	ConnectorAuthSSOWindow = "sso_window"
	// ConnectorAuthNone: the service needs no credential (anonymous access) —
	// install is a bare "connect", calls carry no Authorization header.
	ConnectorAuthNone = "none"
)

Connector auth kinds.

View Source
const (
	ConnectorStatusConnected  = "connected"
	ConnectorStatusUnverified = "unverified"
)

Connector install statuses.

View Source
const (
	ContextItemMaxBytes  = 2048
	ContextItemsPerScope = 50
)

Shared-context governance bounds (plan-v2 §8). Config-worthy later; consts until someone needs to tune them.

View Source
const (
	InteractionClick       = "click"
	InteractionResponseURL = "response_url"
	InteractionTest        = "test"
	// InteractionSubmission is a form submitted to the app; InteractionAPI
	// is a call the app made to ex (ActionID names the method).
	InteractionSubmission = "view_submission"
	InteractionAPI        = "api"
	// InteractionClosed is a form closed without submitting, told to the
	// app because the form asked (notify_on_close).
	InteractionClosed = "view_closed"

	InteractionOK      = "ok"
	InteractionFailed  = "failed"
	InteractionTimeout = "timeout"
)

Interaction kinds and results, as the webhooks panel's history lists them.

View Source
const (
	DeactivatedByAdmin     = "admin"
	DeactivatedByDirectory = "directory"
)

Who deactivated an account (User.DeactivatedBy).

View Source
const AgentMemoryMaxBytes = 8 * 1024

AgentMemoryMaxBytes caps the core memory (buzz keeps ~10KB healthy).

View Source
const (
	ApprovalPurposeWatchReply = "watch-reply"
)

Approval purposes. Structured "<action>:<subject>" strings, minted only by the server-side gate that raises the approval.

View Source
const ConnectorCredentialHintMaxLen = 300

ConnectorCredentialHintMaxLen bounds CredentialHint: it is one line under a form field, not documentation — the bundle is where instructions belong.

View Source
const DefaultAuthHeader = "Authorization: Bearer {token}"

DefaultAuthHeader is the credential header used when a connector sets none.

View Source
const DefaultFollowUpMins = 10

DefaultFollowUpMins is the window when the pref enables follow-ups without picking a duration.

View Source
const DefaultMaxUploadBytes int64 = 50 * 1024 * 1024

DefaultMaxUploadBytes is the fallback ceiling when the workspace hasn't overridden it (50 MiB).

View Source
const ElementButton = "button"

ElementButton is a button: a link, a built-in action, or a call to the app.

View Source
const ElementImage = "image"

ElementImage is a small picture: a section's accessory or a context row's.

View Source
const MaxAgentModelsPerHarness = 25

MaxAgentModelsPerHarness caps each engine's list: it is a dropdown.

View Source
const (
	// RunnerFeatureFiles: the runner can fetch run attachments and post files
	// (fetch_attachment, post_message attachments).
	RunnerFeatureFiles = "files"
)

RunnerRegistration is a live runner process on one of the owner's machines. Rows carry a DynamoDB TTL so dead runners self-reap. Runner features a run may require (Run.RequiresFeatures) and a runner advertises at claim time.

View Source
const TaskClaimLabelMaxLen = 64

TaskClaimLabelMaxLen bounds claim labels.

View Source
const (
	TaskModeUnlimitedTurns = 1 << 30
)

Task-mode budgets: "no limits" by decision. The horizon exists only so deadlines and run tokens stay finite; the idle reaper is what actually ends a stuck task. (taskModeHorizon stays unexported: tygo cannot mirror a time.Duration expression into the SPA's generated types.)

View Source
const UserGroupIDPrefix = "group-"

UserGroupIDPrefix starts every user-group ID. A group is mentioned with the same "@[id|label]" token as a person, so the prefix is what tells a mention parser it names a group (ULID user IDs and "bot-" IDs never start with it).

View Source
const UserGroupSourceEntraGroup = "entra-group"

UserGroupSourceEntraGroup is the kind of a group that follows an Entra security group.

View Source
const ViewModal = "modal"

ViewModal is the one kind of view: a form in a dialog.

View Source
const WebhookKindRich = "rich"

WebhookKindRich marks a rich webhook (see IncomingWebhook.Kind).

Variables

View Source
var DefaultAgentModels = []AgentModelOption{

	{Harness: HarnessClaude, ID: "claude-opus-5-5", Label: "Claude Opus 5.5"},
	{Harness: HarnessClaude, ID: "claude-sonnet-5-5", Label: "Claude Sonnet 5.5"},
	{Harness: HarnessClaude, ID: "claude-haiku-5-5", Label: "Claude Haiku 5.5"},
	{Harness: HarnessClaude, ID: "claude-fable-5-2", Label: "Claude Fable 5.2"},
	{Harness: HarnessClaude, ID: "claude-opus-5", Label: "Claude Opus 5"},
	{Harness: HarnessClaude, ID: "claude-sonnet-5", Label: "Claude Sonnet 5"},
	{Harness: HarnessClaude, ID: "claude-fable-5-1", Label: "Claude Fable 5.1"},
	{Harness: HarnessClaude, ID: "claude-fable-5", Label: "Claude Fable 5"},
	{Harness: HarnessClaude, ID: "claude-opus-4-8", Label: "Claude Opus 4.8"},
	{Harness: HarnessClaude, ID: "claude-opus-4-7", Label: "Claude Opus 4.7"},
	{Harness: HarnessClaude, ID: "claude-opus-4-6", Label: "Claude Opus 4.6"},
	{Harness: HarnessClaude, ID: "claude-sonnet-4-6", Label: "Claude Sonnet 4.6"},
	{Harness: HarnessClaude, ID: "claude-haiku-4-5", Label: "Claude Haiku 4.5"},
	{Harness: HarnessBedrock, ID: "eu.anthropic.claude-opus-5", Label: "Claude Opus 5 (EU)"},
}

DefaultAgentModels is the list a workspace offers until an admin edits it. Claude Code takes Claude model ids. Bedrock takes the EU cross-region inference profiles ("eu." + the Bedrock model id), so a run stays inside the EU whichever EU region serves it.

View Source
var DefaultAllowedExtensions = []string{
	"png", "jpg", "jpeg", "gif", "webp", "svg",
	"pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx",
	"txt", "md", "csv", "log",
	"zip", "tar", "gz",
	"mp4", "mov", "webm",
	"mp3", "wav", "ogg",
}

DefaultAllowedExtensions is the conservative ship-with default — common document, image, and archive formats. Admins can broaden or narrow it.

View Source
var RichColors = []string{"gray", "brown", "orange", "yellow", "green", "blue", "purple", "red"}

RichColors are the colours a span's text, highlight or a pill may take — names, never CSS, so an app can't style ex beyond the palette. The client maps each to a theme token for light and dark. (No pink: that is ex's brand accent, kept for unread and calls to action.)

View Source
var SidebarBuiltInSections = []string{"__unread__", "__favorites__", "__channels__", "__dms__"}

The built-in sidebar sections a sort can be set for; every other section is one of the user's categories.

Functions

func ApprovalPurposeConnector added in v0.0.72

func ApprovalPurposeConnector(slug string) string

ApprovalPurposeConnector is the purpose that authorizes attaching one connector to a live run.

func ApprovalPurposeTaskMR added in v0.0.72

func ApprovalPurposeTaskMR(taskID string) string

ApprovalPurposeTaskMR is the purpose that authorizes pushing and opening the merge request(s) for one coding task.

func BlockTexts added in v0.0.116

func BlockTexts(blocks Blocks, attachments []MessageAttachment) []string

BlockTexts lists the readable text of a message's blocks and its cards' blocks — headers, sections, fields, context and rich text, in order. Search indexes it, and a message with blocks but no text stands on it.

func CanTransition added in v0.0.72

func CanTransition(from, to TaskState) bool

CanTransition reports whether from → to is a legal task transition. Same-state is always allowed (idempotent re-reports).

func HarnessHasModelList added in v0.0.118

func HarnessHasModelList(harness string) bool

HarnessHasModelList reports whether an engine picks its model from the admin's list.

func HarnessIsAPI added in v0.0.72

func HarnessIsAPI(harness string) bool

HarnessIsAPI reports whether a harness runs as a hosted-LLM API loop rather than a spawned local CLI. API harnesses can execute server-side (no desktop app needed) and never touch the invoker's shell/files.

func IsColumnChild added in v0.0.116

func IsColumnChild(t string) bool

IsColumnChild reports whether a block of kind t may sit in a column: the toggle's text-only kinds plus headers, callouts and charts — no buttons, pickers, images or further nesting.

func IsInputType added in v0.0.116

func IsInputType(t string) bool

IsInputType reports whether t names an element a form field can hold.

func IsMessageInteractive added in v0.0.116

func IsMessageInteractive(t string) bool

IsMessageInteractive reports whether t names an element a message can carry besides buttons: a pick that goes to the app.

func IsMultiValue added in v0.0.116

func IsMultiValue(t string) bool

IsMultiValue reports whether t's value is a list.

func IsNamePrefix added in v0.0.101

func IsNamePrefix(word string) bool

IsNamePrefix reports whether word is a leading name word people are not called by ("Muhammad", "Md."), case- and trailing-dot-insensitive.

func IsRichColor added in v0.0.116

func IsRichColor(c string) bool

IsRichColor reports whether c names a palette colour.

func IsTextType added in v0.0.116

func IsTextType(t string) bool

IsTextType reports whether t names a text kind.

func IsToggleChild added in v0.0.116

func IsToggleChild(t string) bool

IsToggleChild reports whether a block of kind t may sit inside a toggle: text only — no buttons, pickers or images, so what a click reaches and which images ex fetches stay in the message's top level.

func ModeUncapped added in v0.0.72

func ModeUncapped(mode string) bool

ModeUncapped reports whether a run mode is exempt from turn/token budgets.

func NotificationKeywordsFromName added in v0.0.50

func NotificationKeywordsFromName(displayName string) []string

NotificationKeywordsFromName seeds a new user's keyword list from their display name: first name + full name, deduped (case-insensitively), blanks dropped. "John Smith" → ["John", "John Smith"]; a single-word name yields one entry. So @-name mentions and plain name references notify out of the box. A name opening with a name prefix seeds what follows it instead of a first name (ShortName): "Muhammad Ali Khan" → ["Ali Khan", "Muhammad Ali Khan"], and a name that is only a prefix seeds nothing — every mention of any Muhammad would alert them.

func OffersAgentModel added in v0.0.118

func OffersAgentModel(list []AgentModelOption, harness, id string) bool

OffersAgentModel reports whether the list offers id for harness. An engine without a list offers anything.

func RenderAuthHeader added in v0.0.72

func RenderAuthHeader(template, token string) (name, value string)

RenderAuthHeader turns a connector's AuthHeader template into the header (name, value) that carries token. Accepted shapes: "Name: prefix {token}", "Name: {token}", "Name: Prefix" (token appended after a space) and a bare "Name" (token as the whole value). Empty template → DefaultAuthHeader.

func RepoName added in v0.0.72

func RepoName(path string) string

RepoName is the last path segment of a repo path.

func RichSpansPlain added in v0.0.116

func RichSpansPlain(spans []RichSpan) string

func RichTextPlain added in v0.0.116

func RichTextPlain(nodes []RichNode) string

RichTextPlain is rich text as plain lines: list items bulleted or numbered, mentions in ex's mention syntax (so a message that stands on this text still mentions them), dates as their fallback, emoji by name.

func ScreenAttachmentRef added in v0.0.89

func ScreenAttachmentRef(screenID string) string

ScreenAttachmentRef is the pseudo message ID a screen holds in its attachment's reference set: the attachment is deleted only when no message AND no screen references it any more.

func ShortName added in v0.0.101

func ShortName(displayName string) string

ShortName is the name a person goes by: the first word of their display name, or — for a name opening with a name prefix — everything after the prefix: "Muhammad Ali Khan" → "Ali Khan", since so many go by Ali that the next word alone would still name a crowd. A name that is nothing but prefixes keeps its first word.

func TaskKindFlair added in v0.0.72

func TaskKindFlair(k string) string

TaskKindFlair renders the kind as its chat flair.

func TaskModeHorizon added in v0.0.72

func TaskModeHorizon() time.Duration

TaskModeHorizon returns the far ceiling used for task-mode runs.

func ValidAutoAllow added in v0.0.72

func ValidAutoAllow(c string) bool

ValidAutoAllow reports whether c names a known tool class.

func ValidProjectKey added in v0.0.72

func ValidProjectKey(k string) bool

ValidProjectKey reports whether k is a usable project key.

func ValidProjectPath added in v0.0.72

func ValidProjectPath(p string) bool

ValidProjectPath reports whether p is a plausible GitLab repo path.

func ValidRepoRole added in v0.0.72

func ValidRepoRole(r string) bool

ValidRepoRole reports whether r is a known role ("" is accepted and normalized to other by the service).

func ValidTaskKind added in v0.0.72

func ValidTaskKind(k string) bool

ValidTaskKind reports whether k is a known kind.

func ValidTaskState added in v0.0.72

func ValidTaskState(s string) bool

ValidTaskState reports whether s names a known state.

func ValidTaskSteering added in v0.0.72

func ValidTaskSteering(s string) bool

ValidTaskSteering reports whether s is a known steering mode.

func ValidWatchActionMode added in v0.0.72

func ValidWatchActionMode(m string) bool

ValidWatchActionMode reports whether m is a known action mode.

func ValidateAuthHeader added in v0.0.72

func ValidateAuthHeader(template string) error

ValidateAuthHeader accepts an empty template or one whose header name is a legal HTTP field name and whose value part carries no line breaks — the two ways a template could smuggle a second header into every request.

func WatchModePostsPrivately added in v0.0.72

func WatchModePostsPrivately(m string) bool

WatchModePostsPrivately reports whether a watcher in this mode is barred from posting publicly (notify/draft may only DM the creator).

Types

type ActionTally added in v0.0.116

type ActionTally struct {
	BlockID  string    `json:"blockID" dynamodbav:"blockID"`
	ActionID string    `json:"actionID" dynamodbav:"actionID"`
	UserIDs  []string  `json:"userIDs" dynamodbav:"userIDs"`
	At       time.Time `json:"at" dynamodbav:"at"`
}

ActionTally is the state of one built-in action on a message: who acknowledged (the first clicker) or who voted, and when it last changed.

type ActivityChangedEvent added in v0.0.83

type ActivityChangedEvent struct {
	All          bool     `json:"all,omitempty"`
	IDs          []string `json:"ids,omitempty"`
	Read         *bool    `json:"read,omitempty"`
	Removed      []string `json:"removed,omitempty"`
	Updated      []string `json:"updated,omitempty"`
	ParentID     string   `json:"parentID,omitempty"`
	ThreadRootID string   `json:"threadRootID,omitempty"`
}

ActivityChangedEvent is the activity.read payload: what changed in the user's stream. One group is set per event:

  • All: every item was marked read.
  • IDs + Read: these items were marked read or unread.
  • Removed: these items are gone — removed by the user, deleted with their message, or dropped when the user lost access to the parent.
  • Updated: these items' previews changed (their message was edited).
  • ParentID (+ ThreadRootID): the user read, or marked unread, part of that channel, conversation or thread, so items there may have flipped.

type ActivityFeed added in v0.0.83

type ActivityFeed struct {
	Items        []*ActivityFeedItem  `json:"items"`
	Unread       int                  `json:"unread"`
	UnreadByType map[ActivityType]int `json:"unreadByType"`
}

ActivityFeed is a user's activity stream as returned to their client, newest first. Unread counts every unread item; UnreadByType splits that count by item type.

type ActivityFeedItem added in v0.0.83

type ActivityFeedItem struct {
	ActivityItem `tstype:",extends"`
	Read         bool `json:"read"`
}

ActivityFeedItem is an ActivityItem as listed to its owner: the stored item plus its read state, which is resolved from the owner's read state at list time rather than stored with the item.

type ActivityItem added in v0.0.54

type ActivityItem struct {
	ID         string       `json:"id"`
	Type       ActivityType `json:"type"`
	CreatedAt  time.Time    `json:"createdAt"`
	MessageID  string       `json:"messageID"`
	ParentID   string       `json:"parentID"`
	ParentType string       `json:"parentType"` // "channel" | "conversation"
	// ParentMessageID is the thread root when the source message is a thread
	// reply (empty for top-level messages). Replies never render in the main
	// list, so the deep link must open the thread to show them.
	ParentMessageID string `json:"parentMessageID,omitempty"`
	// ChannelSlug is set for channel parents so the client can build a slug URL
	// without resolving the channel; empty for conversations.
	ChannelSlug string `json:"channelSlug,omitempty"`
	// MessagePreview is a short plain-text excerpt of the source message.
	MessagePreview string `json:"messagePreview,omitempty"`
	// ActorID is who acted: the reactor, the message author, or who added the
	// user to a channel. Emoji is set for ActivityReaction.
	ActorID string `json:"actorID,omitempty"`
	Emoji   string `json:"emoji,omitempty"`
	// ActorName is the display name to show instead of resolving ActorID — set
	// for incoming-webhook messages, whose author is a bot sentinel.
	ActorName string `json:"actorName,omitempty"`
	// Webhook marks an item whose actor is an incoming webhook: ActorName is the
	// name the webhook chose for itself, so it must render as a bot, never as
	// a person.
	Webhook bool `json:"webhook,omitempty"`
	// ParentName snapshots the channel name for ActivityChannelAdded items so
	// the row can render before the client's channel list catches up.
	ParentName string `json:"parentName,omitempty"`
	// MentionKind is set on ActivityMention items.
	MentionKind MentionKind `json:"mentionKind,omitempty"`
	// UserGroupID / UserGroupHandle name the group of a MentionKindUserGroup
	// item; the handle is snapshotted so the row renders without a lookup.
	UserGroupID     string `json:"userGroupID,omitempty"`
	UserGroupHandle string `json:"userGroupHandle,omitempty"`
}

ActivityItem is one entry in a user's personal activity stream (Slack-style Activity tab). It is a denormalized hint: it carries enough context (preview + parent + message id) to render a row and deep-link to the source message without further lookups. It follows its message: deleting the message removes the item, editing it refreshes the preview, and losing access to the parent removes the parent's items.

type ActivityNewEvent added in v0.0.83

type ActivityNewEvent struct {
	Item *ActivityFeedItem `json:"item"`
}

ActivityNewEvent is the activity.new payload: the item that just arrived in the user's stream, with its read state (it can arrive already read when the user read past its message before the item was written).

type ActivityType added in v0.0.54

type ActivityType string

ActivityType discriminates the kinds of entries in a user's activity stream.

const (
	// ActivityReaction records that someone added an emoji reaction to one of
	// the user's own messages.
	ActivityReaction ActivityType = "reaction"
	// ActivityReminder records a "remind me about this message" reminder that
	// has fired at its scheduled time.
	ActivityReminder ActivityType = "reminder"
	// ActivityMention records that a message addressed the user: an explicit
	// @-mention, an @all/@here group mention, or one of their notification
	// keywords. MentionKind says which.
	ActivityMention ActivityType = "mention"
	// ActivityThreadReply records a reply in a thread the user takes part in
	// or follows.
	ActivityThreadReply ActivityType = "thread_reply"
	// ActivityDM records a message in one of the user's direct or group
	// conversations.
	ActivityDM ActivityType = "dm"
	// ActivityChannelAdded records that someone else added the user to a
	// channel.
	ActivityChannelAdded ActivityType = "channel_added"
	// ActivityChannelMessage records a channel message that alerted the user
	// through nothing more specific than the channel's "All messages" level
	// (an alert feed): every alert has its Activity row, so the bell, the tab
	// title and the app icon count the same things.
	ActivityChannelMessage ActivityType = "channel_message"
)

type AgentConfig added in v0.0.72

type AgentConfig struct {
	TemplateSlug string `json:"templateSlug" dynamodbav:"templateSlug"`
}

AgentConfig marks a user row as one of the shared agent users. It carries identity only — behavior lives on the template plus each invoker's UserAgentPrefs, resolved per run.

type AgentLimits added in v0.0.72

type AgentLimits struct {
	MaxTurns int `json:"maxTurns,omitempty" dynamodbav:"maxTurns,omitempty"`
	// MaxWallClockSec caps CONVERSATION runs — ambient invocations (watch,
	// heartbeat, follow-up) where the expected output is a short reply and a
	// stuck harness should die fast.
	MaxWallClockSec int   `json:"maxWallClockSec,omitempty" dynamodbav:"maxWallClockSec,omitempty"`
	MaxTokens       int64 `json:"maxTokens,omitempty" dynamodbav:"maxTokens,omitempty"`
	MaxPosts        int   `json:"maxPosts,omitempty" dynamodbav:"maxPosts,omitempty"`
	MaxConsultDepth int   `json:"maxConsultDepth,omitempty" dynamodbav:"maxConsultDepth,omitempty"`
	// MaxChainRounds bounds agent-to-agent handoffs per conversation chain:
	// a human invocation is round 0; each @mention handoff starts the next
	// round. The INVOKER's resolved value rides the run snapshot, so "how
	// long may a debate I start run" is a per-user tunable.
	MaxChainRounds int `json:"maxChainRounds,omitempty" dynamodbav:"maxChainRounds,omitempty"`
	// MaxTaskWallClockSec is the HARD ceiling for direct-@mention runs, where
	// the user may have asked for real work (coding, research) that
	// legitimately runs long. A direct run doesn't get this up front — every
	// run starts on the short MaxWallClockSec window and earns extensions by
	// producing events (see Orchestrator.ReportEvents); this is the absolute
	// cap those extensions can never pass. Runaway backstop, not a pace-setter.
	MaxTaskWallClockSec int `json:"maxTaskWallClockSec,omitempty" dynamodbav:"maxTaskWallClockSec,omitempty"`
	// MaxTaskTurns is the turn budget for direct runs. A turn is one harness
	// iteration (every tool call consumes one), so real tasks burn them fast —
	// the conversation budget (MaxTurns) starves a coding task at ~13 tool
	// calls.
	MaxTaskTurns int `json:"maxTaskTurns,omitempty" dynamodbav:"maxTaskTurns,omitempty"`
}

AgentLimits are the hard bounds the orchestrator enforces per run. The zero value of any field means "no override" at the config layer; the resolved value is never zero (platform defaults apply last).

func DefaultAgentLimits added in v0.0.72

func DefaultAgentLimits() AgentLimits

DefaultAgentLimits is the platform floor applied when neither the caller's prefs nor the template override a field.

MaxTurns counts HARNESS iterations — every MCP tool round (set_state, get_thread, post_message) consumes one — so it must leave room for a few tool calls plus the reply. 3 (the plan's inter-agent round cap, a different bound that arrives with consults in Phase 3) starved trivial tasks.

func (AgentLimits) TurnsFor added in v0.0.72

func (l AgentLimits) TurnsFor(mode string) int

TurnsFor returns the turn budget for a run mode — task depth for direct mentions, the short conversation budget for ambient modes. Zero fields fall back to platform defaults.

func (AgentLimits) WallClockFor added in v0.0.72

func (l AgentLimits) WallClockFor(mode string) time.Duration

WallClockFor returns the HARD wall-clock ceiling for a run mode: direct mentions get the task cap, ambient modes (watch/heartbeat/followup) the short conversation cap. Zero fields (runs snapshotted before the task cap existed, or unresolved configs) fall back to platform defaults.

type AgentMemory added in v0.0.72

type AgentMemory struct {
	AgentID   string    `json:"agentID" dynamodbav:"agentID"`
	InvokerID string    `json:"invokerID" dynamodbav:"invokerID"`
	Content   string    `json:"content" dynamodbav:"content"`
	UpdatedAt time.Time `json:"updatedAt" dynamodbav:"updatedAt"`
}

AgentMemory is one agent's self-maintained "core" memory FOR ONE INVOKER (buzz's engrams, scoped to our shared-agent model: a memory written while serving Alice must never leak into a bundle Bob's run reads — bundles are invoker-visible by contract). Injected into every bundle; replaced whole via the update_memory tool.

type AgentModelOption added in v0.0.118

type AgentModelOption struct {
	Harness string `json:"harness" dynamodbav:"harness"`
	ID      string `json:"id" dynamodbav:"id"`
	// Label is what the dropdown shows; the id when blank.
	Label string `json:"label,omitempty" dynamodbav:"label,omitempty"`
}

AgentModelOption is one model an admin offers for an engine: the agents page and the admin panel pick an agent's model from these instead of a free text field. Only the engines with a fixed set of models have a list: Claude Code (Claude models) and AWS Bedrock (Claude in the EU); Codex keeps its free text.

func NormalizeAgentModels added in v0.0.118

func NormalizeAgentModels(in []AgentModelOption) ([]AgentModelOption, error)

NormalizeAgentModels trims and checks an admin's list: a known engine, an id in that engine's form (a Claude model id; for Bedrock an EU Claude inference profile), no repeats, and every listed engine keeping between one and MaxAgentModelsPerHarness models. Both engines must be listed: a dropdown with nothing in it leaves no way to pick a model.

type AgentSubscription added in v0.0.72

type AgentSubscription struct {
	ID         string `json:"id" dynamodbav:"id"`
	AgentID    string `json:"agentID" dynamodbav:"agentID"`
	CreatorID  string `json:"creatorID" dynamodbav:"creatorID"` // whose quota/machine
	ParentID   string `json:"parentID" dynamodbav:"parentID"`
	ParentType string `json:"parentType" dynamodbav:"parentType"`
	// Keywords: any-match (case-insensitive substring) triggers; empty means
	// every human message triggers. Kept deliberately simpler than buzz's
	// evalexpr filters — no expression engine to time-box.
	Keywords []string `json:"keywords,omitempty" dynamodbav:"keywords,omitempty"`
	// ThreadRootID scopes the watcher to ONE thread (the message it was
	// attached to). Empty = the whole channel/conversation. When set, only
	// messages in that thread trigger.
	ThreadRootID string `json:"threadRootID,omitempty" dynamodbav:"threadRootID,omitempty"`
	// Instruction is the creator's standing order — what to watch for and what
	// to do ("DM me if the budget comes up", "draft answers I'd give"). Injected
	// into the watch run's prompt. Empty = the agent's default watch behavior.
	Instruction string `json:"instruction,omitempty" dynamodbav:"instruction,omitempty"`
	// ActionMode caps what the watcher may DO on a trigger (WatchAction*). Empty
	// defaults to notify — the safest: DM the creator, never post publicly.
	ActionMode    string `json:"actionMode,omitempty" dynamodbav:"actionMode,omitempty"`
	HeartbeatMins int    `json:"heartbeatMins,omitempty" dynamodbav:"heartbeatMins,omitempty"`
	// Schedule turns this row into a STANDING ORDER on a clock rather than a
	// watcher on messages: a five-field cron spec (internal/cron) evaluated in
	// ScheduleTZ. "0 8 * * 1-5" with Instruction "post yesterday's metabase
	// revenue" is the whole feature. A scheduled row never reacts to messages —
	// the two triggers are deliberately exclusive, so a daily report doesn't
	// also fire on every chat line.
	Schedule string `json:"schedule,omitempty" dynamodbav:"schedule,omitempty"`
	// ScheduleTZ is the IANA zone the spec is read in, defaulted at write time
	// from the CREATOR's profile timezone — "8am" means their 8am, not the
	// server's. Empty (unknown zone, or a user who never set one) reads as UTC.
	ScheduleTZ string `json:"scheduleTZ,omitempty" dynamodbav:"scheduleTZ,omitempty"`
	// ConnectorSlugs / SkillIDs pin the tools a standing order may reach for.
	// A chat invocation names them with /picks in the message; a scheduled
	// order has no message, and leaving the agent to guess which of a dozen
	// connected services the instruction meant is exactly the confusion this
	// removes. Empty = no pins (the agent discovers as usual).
	ConnectorSlugs []string   `json:"connectorSlugs,omitempty" dynamodbav:"connectorSlugs,omitempty"`
	SkillIDs       []string   `json:"skillIDs,omitempty" dynamodbav:"skillIDs,omitempty"`
	LastRunAt      *time.Time `json:"lastRunAt,omitempty" dynamodbav:"lastRunAt,omitempty"`
	// PendingCatchUp marks triggers this watcher COULDN'T act on — creator
	// offline, or the agent already busy in the thread. Instead of one run
	// per missed message (overwhelming: 20 messages = 20 runs = 20 DMs) the
	// flag coalesces them: the reconcile sweep starts ONE catch-up run
	// covering everything since PendingSince, then clears it.
	PendingCatchUp bool       `json:"pendingCatchUp,omitempty" dynamodbav:"pendingCatchUp,omitempty"`
	PendingSince   *time.Time `json:"pendingSince,omitempty" dynamodbav:"pendingSince,omitempty"`
	// PendingOffline records that at least one missed trigger happened while
	// the creator was OFFLINE (vs merely agent-busy). Offline backlogs on a
	// local CLI harness are processed only with the creator's consent — the
	// sweep notifies instead of auto-running, and CatchUpNotifiedAt dedupes
	// that ask (re-armed when the flags clear). Busy-only backlogs auto-run.
	PendingOffline    bool       `json:"pendingOffline,omitempty" dynamodbav:"pendingOffline,omitempty"`
	CatchUpNotifiedAt *time.Time `json:"catchUpNotifiedAt,omitempty" dynamodbav:"catchUpNotifiedAt,omitempty"`
	CreatedAt         time.Time  `json:"createdAt" dynamodbav:"createdAt"`
}

AgentSubscription makes an agent WATCH a channel for its creator: human messages matching the filter invoke the agent un-mentioned, on the CREATOR's machine and quota (they opted in). HeartbeatMins > 0 adds periodic idle check-ins.

type AgentTemplate added in v0.0.72

type AgentTemplate struct {
	Slug        string `json:"slug" dynamodbav:"slug"`
	DisplayName string `json:"displayName" dynamodbav:"displayName"`
	Harness     string `json:"harness" dynamodbav:"harness"`
	Model       string `json:"model,omitempty" dynamodbav:"model,omitempty"`
	// ExecutionMode applies to API harnesses (bedrock): "runner" (default) or
	// "server". Empty/ignored for CLI harnesses, which are always runner-run.
	ExecutionMode string   `json:"executionMode,omitempty" dynamodbav:"executionMode,omitempty"`
	Persona       string   `json:"persona" dynamodbav:"persona"`
	SkillIDs      []string `json:"skillIDs,omitempty" dynamodbav:"skillIDs,omitempty"`
	// SkillSnapshots is each attached skill AS IT WAS when an admin attached
	// it. Runs inject this copy, not the live row, so the skill's author
	// cannot rewrite what every run of the agent follows after the review.
	// Server-side only.
	SkillSnapshots    []Skill     `json:"-" dynamodbav:"skillSnapshots,omitempty"`
	Limits            AgentLimits `json:"limits" dynamodbav:"limits"`
	MaxConcurrentRuns int         `json:"maxConcurrentRuns" dynamodbav:"maxConcurrentRuns"`
	// FollowUpMode is the template's default for thread follow-ups when the
	// invoker has no pref of their own ("" = off). The design agent defaults
	// to "always": tweaking a mockup is replying in its thread.
	FollowUpMode string    `json:"followUpMode,omitempty" dynamodbav:"followUpMode,omitempty"`
	CreatedAt    time.Time `json:"createdAt" dynamodbav:"createdAt"`
	UpdatedAt    time.Time `json:"updatedAt" dynamodbav:"updatedAt"`
}

AgentTemplate is a workspace-level agent definition ("gg", "qib"). One shared agent user exists per template — agents belong to NO ONE. Runs are attributed to whoever invoked them, and execute on the invoker's own machine with the invoker's per-user preferences applied. Admin-managed.

type AgentThreadFollow added in v0.0.72

type AgentThreadFollow struct {
	ParentID     string    `json:"parentID" dynamodbav:"parentID"`
	ParentType   string    `json:"parentType" dynamodbav:"parentType"`
	ThreadRootID string    `json:"threadRootID" dynamodbav:"threadRootID"`
	AgentID      string    `json:"agentID" dynamodbav:"agentID"`
	InvokerID    string    `json:"invokerID" dynamodbav:"invokerID"`
	LastPostAt   time.Time `json:"lastPostAt" dynamodbav:"lastPostAt"`
}

AgentThreadFollow marks that an agent recently posted in a thread while serving an invoker. The invoker's later UN-TAGGED replies in that thread re-invoke the agent (per the invoker's follow-up prefs) — like a person who stays in a conversation they just spoke in. Distinct from the human notification ThreadFollow. Rows carry a TTL.

type Approval added in v0.0.72

type Approval struct {
	ID        string `json:"id" dynamodbav:"id"`
	RunID     string `json:"runID" dynamodbav:"runID"`
	AgentID   string `json:"agentID" dynamodbav:"agentID"`
	InvokerID string `json:"invokerID" dynamodbav:"invokerID"` // the only user who may decide

	Summary string `json:"summary" dynamodbav:"summary"`
	Risk    string `json:"risk,omitempty" dynamodbav:"risk,omitempty"`
	// Kind is the harness tool class (AutoAllow*) for permission-gateway
	// approvals — lets the card offer "always allow reads for this agent".
	Kind string `json:"kind,omitempty" dynamodbav:"kind,omitempty"`
	// Purpose binds the approval to the exact action it authorizes, so a gate
	// verifies a decision by EQUALITY instead of searching for a slug or an id
	// inside the prose (where "core" matched "core-eu", and any approved
	// approval at all satisfied the reply-mode gate). Set ONLY by the server
	// when the server itself raises the gate — an agent-raised approval can
	// never carry one, which is what makes it trustworthy.
	Purpose string `json:"purpose,omitempty" dynamodbav:"purpose,omitempty"`
	// Options turns the gate into a multiple-choice question (the ask_user
	// tool): the invoker picks one instead of approve/deny, and the pick
	// lands in Choice. Empty = plain yes/no approval.
	Options []string `json:"options,omitempty" dynamodbav:"options,omitempty"`
	Choice  string   `json:"choice,omitempty" dynamodbav:"choice,omitempty"`

	// ReplyText makes this an editable REPLY PROPOSAL (the propose_reply tool):
	// a reply the agent drafted for the invoker to approve/edit/cancel. When
	// set, approving posts this text (or the invoker's edit) in the thread as
	// the agent; denying posts nothing. ReplyThreadRoot is where it lands, and
	// ReplyToMessageID is the message it answers (shown for context in the UI).
	ReplyText        string `json:"replyText,omitempty" dynamodbav:"replyText,omitempty"`
	ReplyThreadRoot  string `json:"replyThreadRoot,omitempty" dynamodbav:"replyThreadRoot,omitempty"`
	ReplyToMessageID string `json:"replyToMessageID,omitempty" dynamodbav:"replyToMessageID,omitempty"`

	// Note is what the invoker typed alongside the decision — "no, use the
	// seed DB instead" — relayed to the agent inside the blocked tool call
	// (the deny message of a permission prompt, the text of a denied
	// request_approval), so a refusal comes with direction, not silence.
	Note      string     `json:"note,omitempty" dynamodbav:"note,omitempty"`
	State     string     `json:"state" dynamodbav:"state"`
	Deadline  time.Time  `json:"deadline" dynamodbav:"deadline"`
	DecidedBy string     `json:"decidedBy,omitempty" dynamodbav:"decidedBy,omitempty"`
	DecidedAt *time.Time `json:"decidedAt,omitempty" dynamodbav:"decidedAt,omitempty"`
	CreatedAt time.Time  `json:"createdAt" dynamodbav:"createdAt"`
	// ConsumedAt marks an approved decision as SPENT: one "yes" authorizes
	// one action, never every later one of the same kind. Server-side only.
	ConsumedAt *time.Time `json:"-" dynamodbav:"consumedAt,omitempty"`
}

Approval is one blocking human-in-the-loop gate inside a run (plan-v2 §7): the agent's request_approval tool call parks until the INVOKER decides or the deadline lapses (which resolves as denied{approval_timeout} inside the tool call — the harness never hits its own MCP timeout first).

type Artifact added in v0.0.72

type Artifact struct {
	ID        string    `json:"id" dynamodbav:"id"`
	RunID     string    `json:"runID" dynamodbav:"runID"`
	AgentID   string    `json:"agentID" dynamodbav:"agentID"`
	InvokerID string    `json:"invokerID" dynamodbav:"invokerID"`
	Kind      string    `json:"kind" dynamodbav:"kind"` // freeform: "markdown", "diff", …
	Title     string    `json:"title" dynamodbav:"title"`
	Content   string    `json:"content,omitempty" dynamodbav:"content,omitempty"`
	CreatedAt time.Time `json:"createdAt" dynamodbav:"createdAt"`
}

Artifact is a run-produced document too large or too durable for a chat message (plan-v2 §7). Content is stored inline (small, capped) — the drawer is the viewer; S3 offload arrives if artifacts outgrow this.

type Attachment

type Attachment struct {
	ID          string `json:"id" dynamodbav:"id"`
	SHA256      string `json:"sha256" dynamodbav:"sha256"`
	Size        int64  `json:"size" dynamodbav:"size"`
	ContentType string `json:"contentType" dynamodbav:"contentType"`
	Filename    string `json:"filename" dynamodbav:"filename"`
	S3Key       string `json:"-" dynamodbav:"s3Key"`
	URL         string `json:"url,omitempty" dynamodbav:"-"`         // resolved at fetch time, inline (used by <img>/preview)
	DownloadURL string `json:"downloadURL,omitempty" dynamodbav:"-"` // resolved at fetch time, forces Content-Disposition: attachment
	// ThumbnailS3Key is a 2x WebP preview for the large single-image
	// message attachment renderer. SquareThumbnailS3Key is a 2x WebP
	// square crop for compact multi-attachment rows and sidebars.
	ThumbnailS3Key       string `json:"-" dynamodbav:"thumbnailS3Key,omitempty"`
	SquareThumbnailS3Key string `json:"-" dynamodbav:"squareThumbnailS3Key,omitempty"`
	ThumbnailURL         string `json:"thumbnailURL,omitempty" dynamodbav:"-"`
	SquareThumbnailURL   string `json:"squareThumbnailURL,omitempty" dynamodbav:"-"`
	// Width and Height are the intrinsic pixel dimensions of an
	// image attachment. Detected at upload time from the image's
	// own headers and persisted so the frontend can render the
	// <img> with explicit width/height attributes — that reserves
	// the layout box on first paint and stops the message list
	// from shifting as the image decodes. Zero for non-image
	// attachments and for image attachments uploaded before this
	// field existed (lazy-backfilled on next read).
	Width     int       `json:"width,omitempty" dynamodbav:"width,omitempty"`
	Height    int       `json:"height,omitempty" dynamodbav:"height,omitempty"`
	CreatedBy string    `json:"createdBy" dynamodbav:"createdBy"`
	CreatedAt time.Time `json:"createdAt" dynamodbav:"createdAt"`
	// MessageIDs is the set of message IDs currently referencing this
	// attachment. Maintained as a Dynamo string set; never serialized to JSON.
	MessageIDs []string `json:"-" dynamodbav:"messageIDs,omitempty,stringset"`
	// MultipartUploadID is the S3 multipart upload in progress for S3Key, so
	// re-attaching the same file resumes it instead of starting over.
	MultipartUploadID string `json:"-" dynamodbav:"multipartUploadId,omitempty"`
	// VerifiedETag is the ETag of the object version the server verified
	// (size, SHA-256, content type). Later uses only re-read the object when
	// its current ETag differs.
	VerifiedETag string `json:"-" dynamodbav:"verifiedEtag,omitempty"`
	// RunID is set on files an agent run uploaded through the run-scoped
	// API. Only that run may attach them to its posts: CreatedBy is the agent
	// user, which is shared, so the run binding is what keeps one invoker's
	// output out of another invoker's thread.
	RunID string `json:"-" dynamodbav:"runID,omitempty"`
}

Attachment is a file uploaded to object storage and tracked in DynamoDB so messages can reference it by ID. SHA256 dedupes uploads of the same content to a single S3 object; MessageIDs is the (Dynamo string-set-backed) refcount — when it drops to zero the S3 object and Attachment row are removed.

func (*Attachment) IsImage

func (a *Attachment) IsImage() bool

IsImage returns true when the content type starts with "image/".

type AuthProvider

type AuthProvider string

AuthProvider records how a user authenticates. It is authoritative for "is this user managed by an external IdP?" — OIDC users have their display name owned by the IdP and cannot rename themselves locally.

const (
	AuthProviderOIDC  AuthProvider = "oidc"
	AuthProviderGuest AuthProvider = "guest"
	// AuthProviderAgent marks agent-instance users. No auth flow accepts it:
	// agents have no password and no OIDC identity, so no session can ever be
	// minted for one — they act only through run-scoped tokens.
	AuthProviderAgent AuthProvider = "agent"
)

type Block added in v0.0.116

type Block struct {
	Type      string         `json:"type"`
	BlockID   string         `json:"block_id,omitempty"`
	Text      *TextObject    `json:"text,omitempty"`
	Fields    []TextObject   `json:"fields,omitempty"`
	Accessory *BlockElement  `json:"accessory,omitempty"`
	Elements  []BlockElement `json:"elements,omitempty"`
	Label     *TextObject    `json:"label,omitempty"`
	Hint      *TextObject    `json:"hint,omitempty"`
	Optional  bool           `json:"optional,omitempty"`
	Element   *BlockElement  `json:"element,omitempty"`
	// DispatchAction (input only) sends the field's changes to the app as
	// they happen, so it can reshape the form.
	DispatchAction bool `json:"dispatch_action,omitempty"`
	// Image block.
	ImageURL    string `json:"image_url,omitempty"`
	AltText     string `json:"alt_text,omitempty"`
	ImageWidth  int    `json:"image_width,omitempty"`
	ImageHeight int    `json:"image_height,omitempty"`
	// Rich text, callout.
	Content []RichNode `json:"content,omitempty"`
	Icon    string     `json:"icon,omitempty"`
	Color   string     `json:"color,omitempty"`
	// Toggle.
	Summary []RichSpan `json:"summary,omitempty"`
	Blocks  Blocks     `json:"blocks,omitempty"`
	Open    bool       `json:"open,omitempty"`
	// Table.
	Columns []TableColumn `json:"columns,omitempty"`
	Rows    [][]TableCell `json:"rows,omitempty"`
	// Column.
	Width int `json:"width,omitempty"`
	// Chart.
	Kind   string        `json:"kind,omitempty"`
	Labels []string      `json:"labels,omitempty"`
	Series []ChartSeries `json:"series,omitempty"`
	Unit   string        `json:"unit,omitempty"`
}

Block is one piece of a message's layout.

  • section: Text and/or Fields, and an optional Accessory button.
  • actions: a row of buttons (Elements).
  • context: small text (Elements are text elements).
  • divider: a rule.
  • header: Text, plain.
  • input (forms only): Label, an optional Hint, Optional, and one input Element; DispatchAction sends each change to the app.
  • image: ImageURL, AltText, an optional plain Title (Text), and the intrinsic size ex measured.
  • rich_text: Content, its paragraph-level parts.
  • callout: Content in a box tinted Color, with an Icon (an emoji name).
  • toggle: Summary (rich text pieces) over child Blocks (text-only kinds, see IsToggleChild), shown when opened; Open starts it open.
  • table: Columns and Rows of cells.
  • columns: child column Blocks; column: a Width (1 to 3, a share of the row) and its own Blocks (see IsColumnChild).
  • chart: a Kind (bar, line, donut), an optional plain title (Text), Labels, Series (a value per label) and a Unit for its numbers.

type BlockElement added in v0.0.116

type BlockElement struct {
	Type string `json:"type"`
	// Text is a button's label; on the wire a text element's text (Content)
	// takes its place as a plain string.
	Text     *TextObject    `json:"text,omitempty" tstype:"TextObject | string"`
	ActionID string         `json:"action_id,omitempty"`
	Value    string         `json:"value,omitempty"`
	Style    string         `json:"style,omitempty"`
	URL      string         `json:"url,omitempty"`
	Confirm  *ConfirmDialog `json:"confirm,omitempty"`
	// AllowedUsers are the ex user IDs that may see and click the button
	// (resolved from the emails or IDs the app gave). Empty: everyone who can
	// see the message.
	AllowedUsers []string `json:"allowed_users,omitempty"`
	// ExAction makes the button a built-in action (ExActionAck, ExActionVote).
	ExAction string `json:"ex_action,omitempty"`
	// Input elements (forms only): placeholder for all three; Multiline,
	// InitialValue and Min/MaxLength for text; InitialDate (YYYY-MM-DD) for
	// a date; Options and InitialOption for a select.
	Placeholder   *TextObject    `json:"placeholder,omitempty"`
	Multiline     bool           `json:"multiline,omitempty"`
	InitialValue  string         `json:"initial_value,omitempty"`
	MinLength     int            `json:"min_length,omitempty"`
	MaxLength     int            `json:"max_length,omitempty"`
	InitialDate   string         `json:"initial_date,omitempty"`
	Options       []SelectOption `json:"options,omitempty"`
	InitialOption *SelectOption  `json:"initial_option,omitempty"`
	// More value elements: InitialOptions (multi-select, checkboxes),
	// InitialTime (HH:MM), InitialUser(s) (ex user IDs), MaxSelectedItems
	// (multi-selects), and a number field's IsDecimalAllowed and Min/Max
	// (decimal strings, as Slack has them).
	InitialOptions   []SelectOption `json:"initial_options,omitempty"`
	InitialTime      string         `json:"initial_time,omitempty"`
	InitialUser      string         `json:"initial_user,omitempty"`
	InitialUsers     []string       `json:"initial_users,omitempty"`
	MaxSelectedItems int            `json:"max_selected_items,omitempty"`
	IsDecimalAllowed bool           `json:"is_decimal_allowed,omitempty"`
	MinValue         string         `json:"min_value,omitempty"`
	MaxValue         string         `json:"max_value,omitempty"`
	// An image element: its proxied URL, alt text and (once ex has fetched
	// it) intrinsic size.
	ImageURL    string `json:"image_url,omitempty"`
	AltText     string `json:"alt_text,omitempty"`
	ImageWidth  int    `json:"image_width,omitempty"`
	ImageHeight int    `json:"image_height,omitempty"`
	// Content is a text element's text.
	Content string `json:"-"`
}

BlockElement is a button (in an actions row or a section's accessory) or a text element (in a context row). On the wire a text element carries its text as a plain string — {"type":"markdown","text":"…"} — while a button's label is a TextObject; Content holds a text element's string.

func (BlockElement) IsText added in v0.0.116

func (e BlockElement) IsText() bool

IsText reports whether e is a text element rather than a button.

func (BlockElement) MarshalJSON added in v0.0.116

func (e BlockElement) MarshalJSON() ([]byte, error)

MarshalJSON writes a text element's text as a string, a button's as a TextObject.

func (*BlockElement) UnmarshalJSON added in v0.0.116

func (e *BlockElement) UnmarshalJSON(data []byte) error

UnmarshalJSON reads either shape of text (see MarshalJSON).

type Blocks added in v0.0.116

type Blocks []Block

Blocks is a message's (or an attachment's) layout. DynamoDB stores it as one JSON string: a nested list of maps of every block and element would cost far more item size and marshal time, and nothing queries into it.

func (Blocks) MarshalDynamoDBAttributeValue added in v0.0.116

func (b Blocks) MarshalDynamoDBAttributeValue() (types.AttributeValue, error)

MarshalDynamoDBAttributeValue stores the blocks as a JSON string; none as NULL, which `omitempty` leaves out of the item.

func (*Blocks) UnmarshalDynamoDBAttributeValue added in v0.0.116

func (b *Blocks) UnmarshalDynamoDBAttributeValue(av types.AttributeValue) error

UnmarshalDynamoDBAttributeValue reads what MarshalDynamoDBAttributeValue wrote.

type BotAccount added in v0.0.112

type BotAccount struct {
	ID          string `json:"id"`
	Username    string `json:"username"`
	DisplayName string `json:"displayName"`
	Description string `json:"description"`
	// OwnerID is the admin who created the bot; empty for a migrated one.
	OwnerID string `json:"ownerID"`
	// Status is "active" or "deactivated" (a disabled bot).
	Status    string    `json:"status"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

BotAccount is a bot as the admin API lists it: the bot accounts admins create, and the ones migrated from Mattermost. The bots behind incoming webhooks belong to their webhooks and are not listed.

type BotToken added in v0.0.112

type BotToken struct {
	ID          string    `json:"id" dynamodbav:"id"`
	BotUserID   string    `json:"botUserID" dynamodbav:"botUserID"`
	Description string    `json:"description" dynamodbav:"description"`
	CreatedBy   string    `json:"createdBy" dynamodbav:"createdBy"`
	CreatedAt   time.Time `json:"createdAt" dynamodbav:"createdAt"`
	TokenHash   string    `json:"-" dynamodbav:"tokenHash"`
}

BotToken is an access token a bot authenticates the Mattermost-compatible API (/api/v4) with. Only the SHA-256 of the secret is stored: the secret is shown once, when the token is made, and cannot be read back.

type BotTokenIssued added in v0.0.112

type BotTokenIssued struct {
	Token  BotToken `json:"token"`
	Secret string   `json:"secret"`
}

BotTokenIssued answers the request that made a token: the record, and the secret, which is never shown again.

type Channel

type Channel struct {
	ID          string `json:"id" dynamodbav:"id"`
	Name        string `json:"name" dynamodbav:"name"`
	Slug        string `json:"slug" dynamodbav:"slug"`
	Description string `json:"description,omitempty" dynamodbav:"description,omitempty"`
	// Icon is an emoji (the glyph, or its name) shown in place of the
	// channel's globe or lock; empty keeps those.
	Icon      string      `json:"icon,omitempty" dynamodbav:"icon,omitempty"`
	Type      ChannelType `json:"type" dynamodbav:"type"`
	CreatedBy string      `json:"createdBy" dynamodbav:"createdBy"`
	Archived  bool        `json:"archived" dynamodbav:"archived"`
	CreatedAt time.Time   `json:"createdAt" dynamodbav:"createdAt"`
	UpdatedAt time.Time   `json:"updatedAt" dynamodbav:"updatedAt"`
	// MessageSeq is a monotonic counter bumped once per top-level human
	// message (not thread replies, not system events). Paired with each
	// member's UserChannel.LastReadSeq it yields an exact, O(1) unread count
	// without per-member writes or count queries. Starts at 0, so on rollout
	// every member is "caught up" and only new messages count — no backfill.
	MessageSeq int64 `json:"messageSeq,omitempty" dynamodbav:"messageSeq,omitempty"`
	// LastMessageAt is when the last top-level human message was posted —
	// stamped by the same write that bumps MessageSeq. The sidebar's "Recent
	// activity" sort orders channels by it. Unset on a channel nobody has
	// posted in since it was introduced; those sort after the active ones.
	LastMessageAt *time.Time `json:"lastMessageAt,omitempty" dynamodbav:"lastMessageAt,omitempty"`
}

type ChannelMembership

type ChannelMembership struct {
	ChannelID   string      `json:"channelID" dynamodbav:"channelID"`
	UserID      string      `json:"userID" dynamodbav:"userID"`
	Role        ChannelRole `json:"role" dynamodbav:"role"`
	DisplayName string      `json:"displayName" dynamodbav:"displayName"` // denormalized
	JoinedAt    time.Time   `json:"joinedAt" dynamodbav:"joinedAt"`
}

ChannelMembership represents a user's membership in a channel (stored on channel side).

type ChannelNotificationOverride added in v0.0.50

type ChannelNotificationOverride struct {
	DesktopLevel        *NotificationLevel       `json:"desktopLevel,omitempty"`
	MobileLevel         *MobileNotificationLevel `json:"mobileLevel,omitempty"`
	ThreadReplies       *bool                    `json:"threadReplies,omitempty"`
	IgnoreGroupMentions *bool                    `json:"ignoreGroupMentions,omitempty"`
	FollowAllThreads    *bool                    `json:"followAllThreads,omitempty"`
}

ChannelNotificationOverride carries the per-channel override values a user submits. A nil field means "inherit the account default" — persisted as an absent attribute so the resolver falls back to the account setting.

type ChannelRole

type ChannelRole int
const (
	ChannelRoleMember ChannelRole = 1
	ChannelRoleAdmin  ChannelRole = 2
	ChannelRoleOwner  ChannelRole = 3
)

func ParseChannelRole

func ParseChannelRole(s string) ChannelRole

func (ChannelRole) String

func (r ChannelRole) String() string

type ChannelType

type ChannelType string
const (
	ChannelTypePublic  ChannelType = "public"
	ChannelTypePrivate ChannelType = "private"
)

type ChartSeries added in v0.0.116

type ChartSeries struct {
	Name   string    `json:"name,omitempty"`
	Values []float64 `json:"values"`
}

ChartSeries is one named series of a chart: a value per label.

type CodingProject added in v0.0.72

type CodingProject struct {
	Key   string        `json:"key" dynamodbav:"key"`   // slug, e.g. "cliffhub"
	Name  string        `json:"name" dynamodbav:"name"` // display, e.g. "CliffHub"
	Repos []ProjectRepo `json:"repos" dynamodbav:"repos"`
	// Design references (plan-projects-design.md): what the design agent
	// copies from so mockups look like THIS product. All optional — a
	// project learned by a coding task starts with none.
	AppURL      string        `json:"appURL,omitempty" dynamodbav:"appURL,omitempty"`
	Description string        `json:"description,omitempty" dynamodbav:"description,omitempty"`
	DesignNotes string        `json:"designNotes,omitempty" dynamodbav:"designNotes,omitempty"`
	Links       []ProjectLink `json:"links,omitempty" dynamodbav:"links,omitempty"`
	// UILibrary names the product's component stack ("shadcn/ui (Radix),
	// Tailwind v4, Tabler icons") — the design agent draws anything the
	// screens don't show the way that library renders it.
	UILibrary string `json:"uiLibrary,omitempty" dynamodbav:"uiLibrary,omitempty"`
	// No channel here on purpose: a project has one channel PER REQUESTER,
	// derived from (project key, requester id) — see service.ProjectChannelID.
	// Rows written before 2026-09-21 carry a channelID attribute for the old
	// shared channel; it is ignored on read.
	CreatedBy string    `json:"createdBy" dynamodbav:"createdBy"`
	UpdatedBy string    `json:"updatedBy,omitempty" dynamodbav:"updatedBy,omitempty"`
	CreatedAt time.Time `json:"createdAt" dynamodbav:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt" dynamodbav:"updatedAt"`
}

CodingProject is a product the team works on: a name, its repos with roles, and the project channel. Learned on first use (the intake agent resolves the repos with the requester) and reused by every later task.

type CodingTask added in v0.0.72

type CodingTask struct {
	ID          string    `json:"id" dynamodbav:"id"`
	ProjectKey  string    `json:"projectKey" dynamodbav:"projectKey"`
	ProjectName string    `json:"projectName" dynamodbav:"projectName"`
	Title       string    `json:"title" dynamodbav:"title"`
	Goal        string    `json:"goal" dynamodbav:"goal"`
	Kind        string    `json:"kind" dynamodbav:"kind"` // TaskKind* — drives the flair
	State       TaskState `json:"state" dynamodbav:"state"`
	// Steering: who may direct the task in chat — the requester only
	// (default) or anyone in the project channel. Authority (approvals, MR
	// sign-off) stays with the requester regardless.
	Steering string `json:"steering,omitempty" dynamodbav:"steering,omitempty"`

	ChannelID    string `json:"channelID" dynamodbav:"channelID"`       // the project channel
	ThreadRootID string `json:"threadRootID" dynamodbav:"threadRootID"` // the task card message
	RequesterID  string `json:"requesterID" dynamodbav:"requesterID"`
	AgentID      string `json:"agentID" dynamodbav:"agentID"` // the coding agent user (dev)
	// RunnerID is machine affinity: the checkouts live on the runner that
	// took the first task run, so later runs must land there too.
	RunnerID string `json:"runnerID,omitempty" dynamodbav:"runnerID,omitempty"`
	// RunnerOwnerID is whose machine holds that pin. Runner registrations are
	// stored per owner, so without it a liveness check can only look at the
	// CLAIMER's runners — which reports every other owner's live pin as dead
	// and lets the claim steal the workspace. Empty on rows written before the
	// field existed; the requester's machine is the right fallback, since task
	// runs execute for the requester.
	RunnerOwnerID string `json:"runnerOwnerID,omitempty" dynamodbav:"runnerOwnerID,omitempty"`

	// Repos the task touches, each with its own branch/MR. The first entry
	// is the primary (naming, default cwd hints).
	Repos []TaskRepo `json:"repos" dynamodbav:"repos"`

	Ticket *TaskTicket `json:"ticket,omitempty" dynamodbav:"ticket,omitempty"`

	// TestPlan is the requester-facing "how to test" the agent published.
	TestPlan *TestPlan `json:"testPlan,omitempty" dynamodbav:"testPlan,omitempty"`
	// SignedOffAt records the requester's "ship it" — the MR gate.
	SignedOffAt *time.Time `json:"signedOffAt,omitempty" dynamodbav:"signedOffAt,omitempty"`

	RunIDs    []string   `json:"runIDs,omitempty" dynamodbav:"runIDs,omitempty"`
	LastRunAt *time.Time `json:"lastRunAt,omitempty" dynamodbav:"lastRunAt,omitempty"`
	CreatedAt time.Time  `json:"createdAt" dynamodbav:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt" dynamodbav:"updatedAt"`

	// Legacy single-repo fields (rows written before projects/repos existed).
	// Read-only compatibility: NormalizeLegacy folds them into Repos/Project
	// and clears them so the next write drops them. Never in API JSON.
	LegacyProjectPath  string `json:"-" dynamodbav:"projectPath,omitempty"`
	LegacyBranch       string `json:"-" dynamodbav:"branch,omitempty"`
	LegacyBaseBranch   string `json:"-" dynamodbav:"baseBranch,omitempty"`
	LegacyWorkspaceDir string `json:"-" dynamodbav:"workspaceDir,omitempty"`
	LegacyMRURL        string `json:"-" dynamodbav:"mrURL,omitempty"`
	LegacyTestURL      string `json:"-" dynamodbav:"testURL,omitempty"`
	LegacyTestNotes    string `json:"-" dynamodbav:"testNotes,omitempty"`
}

CodingTask is one unit of coding work the dev agent performs for a requester in one project, across one or more of its repos.

func (*CodingTask) HasRole added in v0.0.72

func (t *CodingTask) HasRole(role string) bool

HasRole reports whether any task repo has the given role.

func (*CodingTask) MRURLs added in v0.0.72

func (t *CodingTask) MRURLs() []string

MRURLs lists the merge requests opened so far.

func (*CodingTask) NormalizeLegacy added in v0.0.72

func (t *CodingTask) NormalizeLegacy() (upgraded bool)

NormalizeLegacy upgrades a task row written by the single-repo model: the one repo becomes Repos[0] (role unknown → other), the project is named after that repo, and a published test link becomes a one-step test plan. Idempotent; a no-op for rows that already carry repos.

Reports whether it actually upgraded anything, so the store can log when a legacy row is still being read. That is the signal this compatibility layer needs to be deletable: it has no writers, so once nothing logs it for a retention period the fields and this function can go — until then, deleting them would silently blank the project and repos of any surviving row.

func (*CodingTask) Repo added in v0.0.72

func (t *CodingTask) Repo(path string) *TaskRepo

Repo returns the task's slice of a repo by path (nil when absent).

func (*CodingTask) SteerEntitled added in v0.0.72

func (t *CodingTask) SteerEntitled(userID string) bool

SteerEntitled reports whether userID may direct this task in chat.

type ConfirmDialog added in v0.0.116

type ConfirmDialog struct {
	Title   TextObject `json:"title"`
	Text    TextObject `json:"text"`
	Confirm TextObject `json:"confirm"`
	Deny    TextObject `json:"deny"`
}

ConfirmDialog asks before a button's click is sent. All four texts are plain text.

type Connector added in v0.0.72

type Connector struct {
	Slug        string `json:"slug" dynamodbav:"slug"`
	Title       string `json:"title" dynamodbav:"title"`
	Description string `json:"description" dynamodbav:"description"`
	BaseURL     string `json:"baseURL" dynamodbav:"baseURL"`

	// AuthKind: how a user connects.
	//   "paste"    — paste a bearer token (the only option).
	//   "password" — sign in with email/password (DT auth password grant),
	//                with paste-a-token always available as a fallback.
	AuthKind string `json:"authKind" dynamodbav:"authKind"`
	// TokenURL + ClientID drive the password grant (AuthKind "password").
	TokenURL string `json:"tokenURL,omitempty" dynamodbav:"tokenURL,omitempty"`
	ClientID string `json:"clientID,omitempty" dynamodbav:"clientID,omitempty"`
	// VerifyURL is an authenticated GET used to validate a credential at
	// install time ("connected as {name}").
	VerifyURL string `json:"verifyURL,omitempty" dynamodbav:"verifyURL,omitempty"`
	// AuthHeader is HOW a credential rides a request: a header template with
	// {token} in it — "X-Api-Key: {token}" for Metabase API keys, or
	// "X-Metabase-Session: {token}". Empty means the default
	// "Authorization: Bearer {token}". Admin-owned (it comes with the
	// registration, never from KB content) and it changes only the header
	// shape, never the destination — the host stays pinned to BaseURL.
	AuthHeader string `json:"authHeader,omitempty" dynamodbav:"authHeader,omitempty"`

	// CredentialHint is the one-line "where do I get this?" shown under the
	// paste field, and CredentialURL the page it links to (the service's own
	// token screen). Both are admin-owned like the rest of the auth block, so
	// each service can word its own instruction — "Bearer token" with no
	// instruction had people pasting an OAuth app secret, or nothing at all.
	// Only paste-kind connectors have anywhere to show them.
	CredentialHint string `json:"credentialHint,omitempty" dynamodbav:"credentialHint,omitempty"`
	CredentialURL  string `json:"credentialURL,omitempty" dynamodbav:"credentialURL,omitempty"`

	// StartURL is the SSO entry point opened by an sso_window connect; the
	// service redirects through its own login (silent when the user holds a
	// live Microsoft session) and lands on a URL matching CapturePattern
	// (e.g. "/callback?token={token}"), from which the shell captures the
	// service-minted bearer.
	StartURL       string `json:"startURL,omitempty" dynamodbav:"startURL,omitempty"`
	CapturePattern string `json:"capturePattern,omitempty" dynamodbav:"capturePattern,omitempty"`

	// Revision is the provider's content hash for the ingested bundle. The
	// periodic provider sync skips any connector whose provider revision
	// still equals this, so an unchanged catalog costs one listing fetch.
	// Empty for connectors ingested by direct admin upload — those never
	// match a provider revision and are re-pulled on the next sync.
	Revision string `json:"revision,omitempty" dynamodbav:"revision,omitempty"`

	// FileNames is the docs-bundle manifest; contents live in separate rows.
	FileNames []string `json:"fileNames" dynamodbav:"fileNames"`

	// Services is the parsed services: manifest from the bundle's index.yml —
	// the hierarchy layer between the connector and its endpoint docs (which
	// service file owns which domain). Validated at ingest: every entry must
	// resolve to a shipped file and every service file must be listed.
	Services []ConnectorServiceInfo `json:"services,omitempty" dynamodbav:"services,omitempty"`

	CreatedBy string    `json:"createdBy" dynamodbav:"createdBy"`
	CreatedAt time.Time `json:"createdAt" dynamodbav:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt" dynamodbav:"updatedAt"`
}

Connectors give agents API access to external services. A connector is a docs bundle (index.yml + per-service endpoint YAMLs + a grep catalog) authored to the connector standard, plus just enough auth metadata for Ex to collect a per-user credential at install time. Admin-managed; users install and connect their own account.

func (*Connector) CredentialHeader added in v0.0.72

func (c *Connector) CredentialHeader(token string) (name, value string)

CredentialHeader renders this connector's credential header for token.

func (*Connector) EnvPrefix added in v0.0.72

func (c *Connector) EnvPrefix() string

EnvPrefix is the env-var prefix agents use for this connector's credentials: cliffhub → CLIFFHUB_TOKEN / CLIFFHUB_APP_URL.

type ConnectorFile added in v0.0.72

type ConnectorFile struct {
	Slug    string `json:"slug" dynamodbav:"slug"`
	Name    string `json:"name" dynamodbav:"name"`
	Content string `json:"content" dynamodbav:"content"`
}

ConnectorFile is one docs file in a connector's bundle.

type ConnectorInstall added in v0.0.72

type ConnectorInstall struct {
	UserID        string `json:"userID" dynamodbav:"userID"`
	ConnectorSlug string `json:"connectorSlug" dynamodbav:"connectorSlug"`
	Token         string `json:"-" dynamodbav:"token"`
	// Status: "connected" (verify passed) or "unverified" (verify endpoint
	// unreachable from the server — token accepted, will be proven at use).
	Status      string `json:"status" dynamodbav:"status"`
	ConnectedAs string `json:"connectedAs,omitempty" dynamodbav:"connectedAs,omitempty"`
	// Identity is the raw verify-endpoint response captured at connect time —
	// the caller's own profile on that service (ids, name, email). Synced to
	// runs as _identity.json so agents resolve "who am I" locally instead of
	// burning an auth/me call every run. Never in API JSON (runner path only).
	Identity string `json:"-" dynamodbav:"identity,omitempty"`
	// AgentUse: may an AGENT attach this connector to a run itself (via the
	// use_connector tool) when the user didn't /pick it?
	//   "ask" (default, empty = ask) — one approval card per run
	//   "always" — auto-attach, no ask
	//   "never"  — only explicit /picks work
	AgentUse    string    `json:"agentUse,omitempty" dynamodbav:"agentUse,omitempty"`
	InstalledAt time.Time `json:"installedAt" dynamodbav:"installedAt"`
	UpdatedAt   time.Time `json:"updatedAt" dynamodbav:"updatedAt"`
}

ConnectorInstall is one user's connection to a connector. The token is the user's own credential for that service (stored server-side for v1; the runner injects it into agent runs as $<PREFIX>_TOKEN).

type ConnectorServiceInfo added in v0.0.72

type ConnectorServiceInfo struct {
	Name        string `json:"name" dynamodbav:"name"`
	File        string `json:"file" dynamodbav:"file"`
	Endpoints   int    `json:"endpoints,omitempty" dynamodbav:"endpoints,omitempty"`
	Description string `json:"description,omitempty" dynamodbav:"description,omitempty"`
	// RoutePrefixes are the distinct route_id prefixes found in this
	// service's endpoint docs (e.g. tasks-and-stories.yaml → ["work"]).
	// Manifest names and route prefixes often differ — scoped catalog greps
	// must use these, not the service name.
	RoutePrefixes []string `json:"routePrefixes,omitempty" dynamodbav:"routePrefixes,omitempty"`
}

ConnectorServiceInfo is one entry of a connector's service manifest (index.yml services:) — name, owning file, and what the domain covers.

type ContextItem added in v0.0.72

type ContextItem struct {
	ID         string `json:"id" dynamodbav:"id"`
	ParentID   string `json:"parentID" dynamodbav:"parentID"`
	ParentType string `json:"parentType" dynamodbav:"parentType"`

	// AuthorID is who wrote the item — a human user or a shared agent. When
	// an agent wrote it, InvokerID records whose run it was (the agent is
	// shared; attribution is always to the invoking human).
	AuthorID  string `json:"authorID" dynamodbav:"authorID"`
	InvokerID string `json:"invokerID,omitempty" dynamodbav:"invokerID,omitempty"`

	Body   string `json:"body" dynamodbav:"body"`
	Pinned bool   `json:"pinned,omitempty" dynamodbav:"pinned,omitempty"`

	CreatedAt time.Time `json:"createdAt" dynamodbav:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt" dynamodbav:"updatedAt"`
}

ContextItem is one curated shared-context entry for a channel or conversation (plan-v2 §8): briefs, decisions, constraints. Humans write them in the UI; agents append via the write_shared_context tool. Every agent run in that parent reads them — this is the "central context which they can share".

type Conversation

type Conversation struct {
	ID             string           `json:"id" dynamodbav:"id"`
	Type           ConversationType `json:"type" dynamodbav:"type"`
	Name           string           `json:"name,omitempty" dynamodbav:"name,omitempty"` // for groups
	ParticipantIDs []string         `json:"participantIDs" dynamodbav:"participantIDs"`
	CreatedBy      string           `json:"createdBy" dynamodbav:"createdBy"`
	// Activated becomes true once the first message is sent. Until then, the
	// conversation is hidden from non-creator participants.
	Activated bool      `json:"activated" dynamodbav:"activated"`
	CreatedAt time.Time `json:"createdAt" dynamodbav:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt" dynamodbav:"updatedAt"`
	// MessageSeq is the per-conversation monotonic counter bumped once per
	// top-level message — the same unread mechanism channels use (see
	// model.Channel.MessageSeq). Paired with each member's
	// UserConversation.LastReadSeq it yields exact unread counts.
	MessageSeq int64 `json:"messageSeq,omitempty" dynamodbav:"messageSeq,omitempty"`
	// ConvertedToChannelID: the group became this private channel, which
	// keeps the conversation's ID and history. The conversation stays only
	// as a pointer to it.
	ConvertedToChannelID string     `json:"convertedToChannelID,omitempty" dynamodbav:"convertedToChannelID,omitempty"`
	ConvertedAt          *time.Time `json:"convertedAt,omitempty" dynamodbav:"convertedAt,omitempty"`
}

type ConversationType

type ConversationType string
const (
	ConversationTypeDM    ConversationType = "dm"
	ConversationTypeGroup ConversationType = "group"
)

type CustomEmoji

type CustomEmoji struct {
	Name      string    `json:"name" dynamodbav:"name"`
	ImageURL  string    `json:"imageURL" dynamodbav:"imageURL"`
	ImageKey  string    `json:"-" dynamodbav:"imageKey,omitempty"`
	CreatedBy string    `json:"createdBy" dynamodbav:"createdBy"`
	CreatedAt time.Time `json:"createdAt" dynamodbav:"createdAt"`
	// GettingWorkDone pins the emoji into the picker's themed
	// "Getting Work Done" shelf; set on the custom-emoji upload page.
	GettingWorkDone bool `json:"gettingWorkDone" dynamodbav:"gettingWorkDone,omitempty"`
}

CustomEmoji represents a workspace-uploaded custom emoji that can be referenced in messages or reactions as :name:.

ImageKey is the persistent S3 key. The service re-signs ImageURL on every List call from the key so the frontend never has to deal with expired presigned URLs (the bug where custom emojis broke after 7 days). ImageURL is sent to clients but not relied on for storage.

type DeletedContent added in v0.0.101

type DeletedContent struct {
	Body               string              `json:"-" dynamodbav:"body,omitempty"`
	AttachmentIDs      []string            `json:"-" dynamodbav:"attachmentIDs,omitempty"`
	MessageAttachments []MessageAttachment `json:"-" dynamodbav:"messageAttachments,omitempty"`
	Blocks             Blocks              `json:"-" dynamodbav:"blocks,omitempty"`
}

DeletedContent is what a soft-deleted message said: kept in its row, never served. It lives in its own file so tygo leaves it out of the wire types: no client ever sees it.

type HastNode added in v0.0.45

type HastNode struct {
	Type       string                 `json:"type"`
	TagName    string                 `json:"tagName,omitempty"`
	Properties map[string]interface{} `json:"properties,omitempty"`
	// Children is intentionally NOT marked omitempty. hast-util-to-
	// jsx-runtime reads `node.children.length` unconditionally for
	// element/root nodes — omitting an empty children array on a
	// leaf element (e.g. our `ex-mention-user` sentinel tag) crashes
	// the frontend hydrator and unmounts the entire message tree.
	// A custom MarshalJSON below skips the field for text nodes so
	// the wire format stays clean.
	Children []*HastNode `json:"children"`
	Value    string      `json:"value,omitempty"`
}

HastNode is the JSON-serializable hast (HTML AST) shape that the backend emits for every rendered message. Frontend consumers hydrate the tree with React via hast-util-to-jsx-runtime.

Three node variants share one struct:

{ "type": "root",    "children": [...] }
{ "type": "element", "tagName": "p", "properties": {...}, "children": [...] }
{ "type": "text",    "value": "..." }

Custom domain tags use `tagName: "ex-mention-user"`, `"ex-hashtag"`, `"ex-ohmagif"` and so on; the frontend's components map maps them to the corresponding React component (mention pill, hashtag button, GifEmbed, …) so per-viewer behaviour stays on the client without re-parsing on every render.

Lives in `model` (not `service`) because it's a wire/data type: the struct is serialized over HTTP and WS, persisted/cached optionally, and consumed by handlers.

func (*HastNode) MarshalJSON added in v0.0.45

func (n *HastNode) MarshalJSON() ([]byte, error)

MarshalJSON skips the `children` field for text nodes — only element/root nodes carry children, and the hydrator only reads children on those kinds. Without this, every text node would emit `"children": null` which is wasteful (and confusing for any downstream JSON consumer).

type IncomingWebhook added in v0.0.48

type IncomingWebhook struct {
	ID              string    `json:"id" dynamodbav:"id"`
	Title           string    `json:"title" dynamodbav:"title"`
	Description     string    `json:"description,omitempty" dynamodbav:"description,omitempty"`
	ChannelID       string    `json:"channelID" dynamodbav:"channelID"`
	ChannelName     string    `json:"channelName,omitempty" dynamodbav:"channelName,omitempty"`
	ChannelSlug     string    `json:"channelSlug,omitempty" dynamodbav:"channelSlug,omitempty"`
	LockToChannel   bool      `json:"lockToChannel" dynamodbav:"lockToChannel"`
	Username        string    `json:"username,omitempty" dynamodbav:"username,omitempty"`
	ProfileImageURL string    `json:"profileImageURL,omitempty" dynamodbav:"profileImageURL,omitempty"`
	CreatedBy       string    `json:"createdBy" dynamodbav:"createdBy"`
	CreatedAt       time.Time `json:"createdAt" dynamodbav:"createdAt"`
	UpdatedAt       time.Time `json:"updatedAt" dynamodbav:"updatedAt"`
	// Kind is chosen when the webhook is created and never changes. A classic
	// webhook ("") posts text and Slack-style cards exactly as webhooks always
	// have: blocks and an Authorization header in its payloads are ignored. A
	// rich webhook (WebhookKindRich) is an app's: blocks, buttons, forms, a
	// bot token and interactivity. Keeping the two apart means no existing
	// sender's posts change shape — or start being refused — because rich
	// messages exist.
	Kind string `json:"kind,omitempty" dynamodbav:"kind,omitempty"`

	// Interactivity (rich webhooks only): an app that gets the clicks on its messages' buttons.
	// InteractivityURL is where ex sends them; empty means the webhook only
	// posts.
	InteractivityURL string `json:"interactivityURL,omitempty" dynamodbav:"interactivityURL,omitempty"`
	// EmailSharing adds the clicker's email to what the app receives. Only a
	// workspace admin turns it on.
	EmailSharing bool `json:"emailSharing,omitempty" dynamodbav:"emailSharing,omitempty"`
	// AdminPaused stops the app's buttons everywhere until an admin resumes
	// them.
	AdminPaused bool `json:"adminPaused,omitempty" dynamodbav:"adminPaused,omitempty"`
	// BotTokenHash is the SHA-256 of the app's bot token (the token itself is
	// shown once and never stored). PrevBotTokenHash stays valid until
	// PrevBotTokenUntil, so a rotation needs no downtime.
	BotTokenHash      string     `json:"-" dynamodbav:"botTokenHash,omitempty"`
	PrevBotTokenHash  string     `json:"-" dynamodbav:"prevBotTokenHash,omitempty"`
	PrevBotTokenUntil *time.Time `json:"-" dynamodbav:"prevBotTokenUntil,omitempty"`
	// SecretVersion names the current signing secret, which is derived from
	// the server's key and never stored (0: none issued yet). The version
	// before it keeps signing alongside until PrevSecretUntil.
	SecretVersion   int        `json:"-" dynamodbav:"secretVersion,omitempty"`
	PrevSecretUntil *time.Time `json:"-" dynamodbav:"prevSecretUntil,omitempty"`
	// HasBotToken and HasSigningSecret tell the webhooks panel what has been
	// issued, without the values.
	HasBotToken      bool `json:"hasBotToken,omitempty" dynamodbav:"-"`
	HasSigningSecret bool `json:"hasSigningSecret,omitempty" dynamodbav:"-"`
	// Templates are message layouts saved on a rich webhook: the app posts
	// {"template": key, "data": {...}} and ex fills the layout's
	// {{placeholders}}, so a layout changes without the app changing.
	Templates []MessageTemplate `json:"templates,omitempty" dynamodbav:"templates,omitempty"`
}

func (*IncomingWebhook) IsRich added in v0.0.116

func (w *IncomingWebhook) IsRich() bool

IsRich reports whether the webhook is a rich (app) webhook.

func (*IncomingWebhook) Present added in v0.0.116

func (w *IncomingWebhook) Present() *IncomingWebhook

Present fills the fields the webhooks panel shows instead of the secrets.

func (*IncomingWebhook) Template added in v0.0.116

func (w *IncomingWebhook) Template(key string) *MessageTemplate

Template is the saved template named key, nil when there is none.

type InteractionEntry added in v0.0.116

type InteractionEntry struct {
	At        time.Time `json:"at"`
	Kind      string    `json:"kind"`
	UserID    string    `json:"userID,omitempty"`
	ActionID  string    `json:"actionID,omitempty"`
	Result    string    `json:"result"`
	Status    int       `json:"status,omitempty"`
	LatencyMs int64     `json:"latencyMs"`
	Error     string    `json:"error,omitempty"`
}

InteractionEntry is one line of an app's interaction history: a click or a form sent to it, a use of a response_url, a call it made, or a test.

type Invite

type Invite struct {
	Token      string    `json:"token" dynamodbav:"token"`
	Email      string    `json:"email" dynamodbav:"email"`
	InviterID  string    `json:"inviterID" dynamodbav:"inviterID"`
	ChannelIDs []string  `json:"channelIDs,omitempty" dynamodbav:"channelIDs,omitempty"`
	ExpiresAt  time.Time `json:"expiresAt" dynamodbav:"expiresAt"`
	CreatedAt  time.Time `json:"createdAt" dynamodbav:"createdAt"`
}

type MarkUnreadResult added in v0.0.81

type MarkUnreadResult struct {
	ParentID     string     `json:"parentID"`
	ParentType   string     `json:"parentType"`
	MessageID    string     `json:"messageID"`
	UnreadCount  int64      `json:"unreadCount"`
	ThreadRootID string     `json:"threadRootID,omitempty"`
	SeenAt       *time.Time `json:"seenAt,omitempty"`
}

MarkUnreadResult is the outcome of marking a message unread. A top-level message rewinds the caller's read watermark on its channel/conversation so UnreadCount messages (it and everything after it) are unread again; a thread reply rewinds the thread's seen time to just before it instead.

type MentionKind added in v0.0.83

type MentionKind string

MentionKind says how an ActivityMention item addressed the user.

const (
	MentionKindUser    MentionKind = "user"    // @-mentioned by name
	MentionKindAll     MentionKind = "all"     // @all / @channel
	MentionKindHere    MentionKind = "here"    // @here
	MentionKindKeyword MentionKind = "keyword" // matched one of the user's notification keywords
	// MentionKindUserGroup: mentioned through a user group they belong to
	// (UserGroupID / UserGroupHandle name it).
	MentionKindUserGroup MentionKind = "usergroup"
)

type Message

type Message struct {
	ID         string `json:"id" dynamodbav:"id"`
	ParentID   string `json:"parentID" dynamodbav:"parentID"` // channel or conversation ID
	ParentType string `json:"parentType,omitempty" dynamodbav:"-"`
	AuthorID   string `json:"authorID" dynamodbav:"authorID"`
	Body       string `json:"body" dynamodbav:"body"`
	System     bool   `json:"system,omitempty" dynamodbav:"system,omitempty"`
	// NoIndex keeps the message out of the search index (live indexing AND
	// admin reindex) — for machine-posted ephemera like /mstmeetings join
	// links, where a stale meeting URL surfacing in search is noise. Internal
	// only, never serialized to clients.
	NoIndex bool `json:"-" dynamodbav:"noIndex,omitempty"`
	// NotifyExcept are members this message's notifications skip: a
	// reminder for everyone but them. Internal only, never serialized to
	// clients; stored, so the fan-out's safety net skips them too.
	NotifyExcept    []string   `json:"-" dynamodbav:"notifyExcept,omitempty"`
	ParentMessageID string     `json:"parentMessageID,omitempty" dynamodbav:"parentMessageID,omitempty"` // root message of the thread
	ReplyCount      int        `json:"replyCount,omitempty" dynamodbav:"replyCount,omitempty"`           // count of replies (only set on root messages)
	LastReplyAt     *time.Time `json:"lastReplyAt,omitempty" dynamodbav:"lastReplyAt,omitempty"`         // timestamp of the latest reply (only set on root messages)
	// RecentReplyAuthorIDs holds up to 3 most-recent distinct author IDs
	// for the thread, newest first. Used by the client to render an
	// avatar stack on the thread-action bar without re-fetching the full
	// thread. Only set on root messages.
	RecentReplyAuthorIDs []string            `json:"recentReplyAuthorIDs,omitempty" dynamodbav:"recentReplyAuthorIDs,omitempty"`
	Reactions            map[string][]string `json:"reactions,omitempty" dynamodbav:"reactions,omitempty"`         // emoji -> userIDs that reacted
	AttachmentIDs        []string            `json:"attachmentIDs,omitempty" dynamodbav:"attachmentIDs,omitempty"` // ordered list of attachments referenced by this message
	Pinned               bool                `json:"pinned,omitempty" dynamodbav:"pinned,omitempty"`               // pinned to the parent (channel/conversation)
	PinnedAt             *time.Time          `json:"pinnedAt,omitempty" dynamodbav:"pinnedAt,omitempty"`
	PinnedBy             string              `json:"pinnedBy,omitempty" dynamodbav:"pinnedBy,omitempty"`
	CreatedAt            time.Time           `json:"createdAt" dynamodbav:"createdAt"`
	EditedAt             *time.Time          `json:"editedAt,omitempty" dynamodbav:"editedAt,omitempty"`
	// Deleted is set on soft-delete: the row stays in the list so the
	// thread structure (replies referencing this ID) is preserved, but
	// Body / AttachmentIDs / Reactions are cleared and the client
	// renders a "(Message deleted)" placeholder.
	Deleted bool `json:"deleted,omitempty" dynamodbav:"deleted,omitempty"`
	// DeletedAt and DeletedBy record the soft delete; DeletedContent keeps
	// what the message said. None of it is ever served (json:"-"): to
	// everyone but someone reading the table, a deleted message is gone.
	DeletedAt      *time.Time      `json:"-" dynamodbav:"deletedAt,omitempty"`
	DeletedBy      string          `json:"-" dynamodbav:"deletedBy,omitempty"`
	DeletedContent *DeletedContent `json:"-" dynamodbav:"deletedContent,omitempty"`
	// NoUnfurl suppresses the link-preview card the client would
	// otherwise render below the body. Set when the author dismisses
	// the unfurl — the suppression is global (every viewer sees it
	// off), which is what authors expect when the preview is wrong.
	NoUnfurl bool `json:"noUnfurl,omitempty" dynamodbav:"noUnfurl,omitempty"`
	// Rendered is the server-rendered hast tree for Body — populated
	// at read time, never persisted (the `dynamodbav:"-"` tag keeps
	// it out of DDB). Frontend consumers prefer this over re-parsing
	// the markdown source per render. nil means "not yet rendered"
	// (legacy messages, intermediate API paths) — clients fall back
	// to client-side parsing.
	Rendered *HastNode `json:"rendered,omitempty" dynamodbav:"-"`
	// Incoming webhook messages can override the displayed author and carry
	// Mattermost-compatible message attachments. AuthorID remains a stable
	// bot identifier for notifications/search, while these fields drive rendering.
	WebhookUsername    string              `json:"webhookUsername,omitempty" dynamodbav:"webhookUsername,omitempty"`
	WebhookAvatarURL   string              `json:"webhookAvatarURL,omitempty" dynamodbav:"webhookAvatarURL,omitempty"`
	WebhookIconEmoji   string              `json:"webhookIconEmoji,omitempty" dynamodbav:"webhookIconEmoji,omitempty"` // emoji name (no colons) from icon_emoji; rendered as the avatar
	MessageAttachments []MessageAttachment `json:"messageAttachments,omitempty" dynamodbav:"messageAttachments,omitempty"`
	// WebhookID is the incoming webhook that posted the message. Channel
	// webhooks all author as the shared "webhook" sentinel, so this is what
	// lets a webhook continue only ITS OWN threads. Internal only.
	WebhookID string `json:"-" dynamodbav:"webhookID,omitempty"`
	// WebhookOwnerID is the person who set up the webhook that posted the
	// message: the integration card names them. The author can't, being the
	// "webhook" sentinel (or the webhook's bot, in a DM). Empty on posts from
	// before it was recorded.
	WebhookOwnerID string `json:"webhookOwnerID,omitempty" dynamodbav:"webhookOwnerID,omitempty"`
	// AgentInvokerID attributes an agent-authored message to the human whose
	// invocation produced it. Agents are shared ("gg" belongs to no one), so
	// a reader — human or another agent's context bundle — needs this to say
	// "bob's gg said X" rather than an ambiguous "gg said X". Set only on the
	// SendAsAgent path.
	AgentInvokerID string `json:"agentInvokerID,omitempty" dynamodbav:"agentInvokerID,omitempty"`
	// AgentRunID links an agent-authored message to the run that produced it,
	// so the UI can offer "Show activity" (the run drawer: timeline,
	// artifacts, spend) straight from the message.
	AgentRunID string `json:"agentRunID,omitempty" dynamodbav:"agentRunID,omitempty"`
	// AgentSkills names the skills this run actually USED when it posted —
	// explicit /skill picks plus invoke_skill calls, never the template's
	// standing skills. Rendered as badges next to the "for <invoker>" tag, so
	// skill usage is visible to everyone in the thread (run logs are
	// invoker-only, this is the public trace).
	AgentSkills []string `json:"agentSkills,omitempty" dynamodbav:"agentSkills,omitempty"`
	// AgentWatchers maps an agent user id to the person whose WATCHER brought
	// that agent to this message (a channel subscription, not a mention). The
	// agent's run-state reactions look the same either way, so the reaction
	// tooltip reads this to say "gg (watcher set up by Alice)" — otherwise
	// people see an untagged agent react and nobody can tell who asked.
	AgentWatchers map[string]string `json:"agentWatchers,omitempty" dynamodbav:"agentWatchers,omitempty"`
	// ClientNonce echoes the sender's client-generated tag (X-Client-Nonce) on
	// the send response and the message.new broadcast, so the sender's client
	// can swap its optimistic "sending" row for the real message whichever
	// arrives first. Never persisted.
	ClientNonce string `json:"clientNonce,omitempty" dynamodbav:"-"`
	// Blocks lay out an app's message (Block Kit); Body stays its plain-text
	// fallback for notifications, search and clients that can't draw them.
	Blocks Blocks `json:"blocks,omitempty" dynamodbav:"blocks,omitempty"`
	// ActionTallies hold the state of the message's built-in actions: who
	// acknowledged, who voted.
	ActionTallies []ActionTally `json:"actionTallies,omitempty" dynamodbav:"actionTallies,omitempty"`
	// Version counts the changes made to an app's message (its blocks, its
	// tallies). A change is written only over the version it was made on, so
	// two at once can't undo each other.
	Version int `json:"version,omitempty" dynamodbav:"version,omitempty"`
	// AppButtons: the message was posted (or last replaced) by its app with
	// the app's bot token, so its app buttons send their clicks to the app.
	// A message posted with the webhook URL alone — which anyone holding a
	// leaked URL could do — never reaches the app.
	AppButtons bool `json:"appButtons,omitempty" dynamodbav:"appButtons,omitempty"`
}

func (*Message) Tombstone added in v0.0.50

func (m *Message) Tombstone()

Tombstone soft-deletes a message in place: it flags Deleted, moves the body, attachments and webhook attachments into DeletedContent, and clears what readers see — those, the reactions and the pin state. The row itself is kept so replies can still resolve their thread root. This is the single source of truth for the soft-delete field contract — the service soft-delete path, the importer and the offline migrations all call it.

type MessageAttachment added in v0.0.48

type MessageAttachment struct {
	Fallback   string                   `json:"fallback,omitempty" dynamodbav:"fallback,omitempty"`
	Color      string                   `json:"color,omitempty" dynamodbav:"color,omitempty"`
	Pretext    string                   `json:"pretext,omitempty" dynamodbav:"pretext,omitempty"`
	Text       string                   `json:"text,omitempty" dynamodbav:"text,omitempty"`
	AuthorName string                   `json:"author_name,omitempty" dynamodbav:"authorName,omitempty"`
	AuthorLink string                   `json:"author_link,omitempty" dynamodbav:"authorLink,omitempty"`
	AuthorIcon string                   `json:"author_icon,omitempty" dynamodbav:"authorIcon,omitempty"`
	Title      string                   `json:"title,omitempty" dynamodbav:"title,omitempty"`
	TitleLink  string                   `json:"title_link,omitempty" dynamodbav:"titleLink,omitempty"`
	Fields     []MessageAttachmentField `json:"fields,omitempty" dynamodbav:"fields,omitempty"`
	ImageURL   string                   `json:"image_url,omitempty" dynamodbav:"imageURL,omitempty"`
	// ImageWidth/ImageHeight are the intrinsic pixel dimensions of the
	// S3-cached image_url, captured server-side at send time so the
	// client can render <img width height> and avoid layout shift in the
	// virtualised message list. Not part of the inbound webhook payload.
	ImageWidth  int    `json:"image_width,omitempty" dynamodbav:"imageWidth,omitempty"`
	ImageHeight int    `json:"image_height,omitempty" dynamodbav:"imageHeight,omitempty"`
	ThumbURL    string `json:"thumb_url,omitempty" dynamodbav:"thumbURL,omitempty"`
	Footer      string `json:"footer,omitempty" dynamodbav:"footer,omitempty"`
	FooterIcon  string `json:"footer_icon,omitempty" dynamodbav:"footerIcon,omitempty"`
	// Icon (rich webhooks only) is an emoji name shown before the title,
	// Notion-style.
	Icon string `json:"icon,omitempty" dynamodbav:"icon,omitempty"`
	// Blocks inside a card sit on the card's tint.
	Blocks Blocks `json:"blocks,omitempty" dynamodbav:"blocks,omitempty"`
	// Rich marks a card posted by a rich webhook, drawn tinted. Set by the
	// server, never read from a payload: a classic card keeps the side bar
	// it always had.
	Rich bool `json:"rich,omitempty" dynamodbav:"rich,omitempty"`
}

type MessageAttachmentField added in v0.0.48

type MessageAttachmentField struct {
	Title string `json:"title,omitempty" dynamodbav:"title,omitempty"`
	Value string `json:"value,omitempty" dynamodbav:"value,omitempty"`
	Short bool   `json:"short,omitempty" dynamodbav:"short,omitempty"`
}

type MessageDraft added in v0.0.23

type MessageDraft struct {
	ID              string    `json:"id" dynamodbav:"id"`
	UserID          string    `json:"userID" dynamodbav:"userID"`
	ParentID        string    `json:"parentID" dynamodbav:"parentID"`
	ParentType      string    `json:"parentType" dynamodbav:"parentType"`
	ParentMessageID string    `json:"parentMessageID,omitempty" dynamodbav:"parentMessageID,omitempty"`
	Body            string    `json:"body" dynamodbav:"body"`
	AttachmentIDs   []string  `json:"attachmentIDs,omitempty" dynamodbav:"attachmentIDs,omitempty"`
	UpdatedAt       time.Time `json:"updatedAt" dynamodbav:"updatedAt"`
	CreatedAt       time.Time `json:"createdAt" dynamodbav:"createdAt"`
	// Gen is the SERVER-assigned generation token for optimistic concurrency:
	// every accepted write mints a new one, and a save or clear is accepted
	// only when the client presents the generation it acted on (empty = "no
	// draft exists"). Ordering is decided entirely server-side — client
	// clocks play no part — so a delayed, stale, or hostile client write can
	// never supersede a later clear or send. Pre-gen rows report "legacy".
	Gen string `json:"gen"`
}

type MessageTemplate added in v0.0.116

type MessageTemplate struct {
	Key       string          `json:"key" dynamodbav:"key"`
	Payload   json.RawMessage `json:"payload" dynamodbav:"payload"`
	UpdatedAt time.Time       `json:"updatedAt" dynamodbav:"updatedAt"`
}

MessageTemplate is one saved layout: a webhook payload whose string values may hold {{placeholders}}.

type MobileNotificationLevel added in v0.0.50

type MobileNotificationLevel string

MobileNotificationLevel mirrors NotificationLevel but adds a "default" sentinel meaning "use the same rule as desktop". This is the default so a user only has to configure mobile separately when they actually want to.

const (
	MobileNotificationDefault  MobileNotificationLevel = "default" // same as desktop
	MobileNotificationAll      MobileNotificationLevel = "all"
	MobileNotificationMentions MobileNotificationLevel = "mentions"
)

func (MobileNotificationLevel) Valid added in v0.0.50

func (m MobileNotificationLevel) Valid() bool

Valid reports whether m is a recognised mobile notification level.

type Notification added in v0.0.97

type Notification struct {
	Kind       NotificationKind `json:"kind"`
	Title      string           `json:"title"`
	Body       string           `json:"body"`
	DeepLink   string           `json:"deepLink"`
	ParentID   string           `json:"parentID"`   // channel/conversation ID
	ParentType string           `json:"parentType"` // "channel" | "conversation"
	MessageID  string           `json:"messageID,omitempty"`
	// AlertID identifies the alert itself when one message can legitimately
	// alert more than once — a fired reminder is a NEW alert about a message
	// the user may already have been notified about (or reminded of before).
	// When set it replaces MessageID as the delivery key (client dedup,
	// desktop ack, push idempotency); otherwise those stay keyed by MessageID.
	AlertID         string `json:"alertID,omitempty"`
	ParentMessageID string `json:"parentMessageID,omitempty"`
	// AuthorID is the message's author, for the client's own-author echo
	// suppression. A webhook post carries the "webhook" sentinel here, never
	// the webhook's creator.
	AuthorID string `json:"authorID,omitempty"`
	// Webhook marks a notification that originated from an incoming
	// webhook (CI alerts, deploy bots, etc.). The "author" is the webhook,
	// not a real sender, so the client exempts these from its own-author
	// echo suppression. Whether to notify at all is decided server-side by
	// the recipient's notification level, exactly like a regular message.
	Webhook   bool      `json:"webhook,omitempty"`
	CreatedAt time.Time `json:"createdAt"`
	// ParentUnreadNotifyCount is the recipient's authoritative alerted-unread
	// badge for the parent AFTER this notification (top-level messages only;
	// thread replies never touch parent counters). Clients SET their sidebar
	// badge to this value — never increment locally — so replayed or
	// duplicated events can't drift the count.
	ParentUnreadNotifyCount int64 `json:"parentUnreadNotifyCount,omitempty"`
	// Silent: the recipient has Do Not Disturb on. The client takes the
	// notification in (badges, Activity) but shows no popup and plays no
	// sound; the server sends no phone push for it either.
	Silent bool `json:"silent,omitempty"`
}

Notification is the user-facing alert payload of a `notification.new` frame, delivered over the same WebSocket pipe as state events (and, as the mobile-push fallback, through the push scheduler). It is intentionally minimal — title, body, where to go on click, and a stable client-side de-dup key. It lives in model so tygo mirrors it into src/types/generated.ts.

func (Notification) DeliveryKey added in v0.0.97

func (n Notification) DeliveryKey() string

DeliveryKey is the identity the desktop ack and the mobile-push idempotency key on: the AlertID when set, else the MessageID. The client dedups and acks on the same key, so both sides always agree.

type NotificationKind added in v0.0.97

type NotificationKind string

NotificationKind tags a notification with its semantic class so the client can apply different sounds, copy, and grouping rules without a large payload-shape switch on the receiver. Adding a new kind here is the single place a new notification flavor is registered.

const (
	NotificationKindMessage     NotificationKind = "message"
	NotificationKindMention     NotificationKind = "mention"
	NotificationKindThreadReply NotificationKind = "thread_reply"
	// NotificationKindReminder is a self-set "remind me about this message"
	// alert firing at its scheduled time. Always notifiable — the user
	// explicitly asked to be alerted, so no gating applies.
	NotificationKindReminder NotificationKind = "reminder"
	// NotificationKindApproval fires when an agent the user invoked needs their
	// decision (request_approval / ask_user). It blocks the run until answered,
	// so it's always notifiable and the client renders it distinctly (it's an
	// action the user must take, not just something to read).
	NotificationKindApproval NotificationKind = "approval"
	// NotificationKindCatchUp fires when a watcher accumulated an OFFLINE
	// backlog on a local CLI harness and needs the creator's go-ahead to
	// process it (their machine, their tokens). Always notifiable — it waits
	// for a decision.
	NotificationKindCatchUp NotificationKind = "catchup"
)

type NotificationLevel added in v0.0.50

type NotificationLevel string

NotificationLevel controls which messages fire a user-facing notification (sound + popup on desktop; push on mobile). It is deliberately small: the "all" firehose or the quiet "mentions, DMs & keywords only" default.

const (
	NotificationLevelAll      NotificationLevel = "all"      // every message
	NotificationLevelMentions NotificationLevel = "mentions" // mentions, DMs, keywords only
)

func (NotificationLevel) Valid added in v0.0.50

func (l NotificationLevel) Valid() bool

Valid reports whether l is a recognised desktop notification level.

type NotificationSettings added in v0.0.50

type NotificationSettings struct {
	DesktopLevel        NotificationLevel       `json:"desktopLevel" dynamodbav:"desktopLevel"`
	MobileLevel         MobileNotificationLevel `json:"mobileLevel" dynamodbav:"mobileLevel"`
	ThreadReplies       bool                    `json:"threadReplies" dynamodbav:"threadReplies"`
	IgnoreGroupMentions bool                    `json:"ignoreGroupMentions" dynamodbav:"ignoreGroupMentions"`
	FollowAllThreads    bool                    `json:"followAllThreads" dynamodbav:"followAllThreads"`
	Keywords            []string                `json:"keywords,omitempty" dynamodbav:"keywords,omitempty"`
	// SnoozeUntil is Do Not Disturb: until then nothing alerts this user (no
	// popup, sound or phone push), though everything is still listed in
	// Activity and counted on badges. Set through its own endpoint, never
	// with the rest of the settings.
	SnoozeUntil *time.Time `json:"snoozeUntil,omitempty" dynamodbav:"snoozeUntil,omitempty"`
}

NotificationSettings is a user's account-level notification baseline. Every channel inherits these unless overridden per-channel (see UserChannel's pointer override fields). Keywords live only here — they are global, matched case-insensitively on word boundaries so "mentions, DMs & keywords only" can still surface messages a user cares about.

func DefaultNotificationSettings added in v0.0.50

func DefaultNotificationSettings() NotificationSettings

DefaultNotificationSettings is the baseline applied to any user who has never saved preferences: quiet by default (mentions/DMs/keywords only), thread replies on, group mentions honoured, no follow-all.

func DefaultNotificationSettingsForNewUser added in v0.0.50

func DefaultNotificationSettingsForNewUser(displayName string) NotificationSettings

DefaultNotificationSettingsForNewUser is the baseline seeded onto a user at account creation: the standard defaults plus name-derived keywords, so they are notified about messages mentioning their name immediately (no migration or first-visit-to-settings required).

func ResolveNotificationPrefs added in v0.0.50

func ResolveNotificationPrefs(account NotificationSettings, uc *UserChannel) NotificationSettings

ResolveNotificationPrefs folds a per-channel override onto the account baseline, returning the effective settings used by the notifier. Keywords always come from the account; only the five gating fields can be overridden. Empty enum strings on the account fall back to their defaults so a partially populated record still resolves sensibly.

func (NotificationSettings) Snoozed added in v0.0.118

func (s NotificationSettings) Snoozed(now time.Time) bool

Snoozed reports whether Do Not Disturb is on at `now`.

type ProjectLink struct {
	Label string `json:"label" dynamodbav:"label"`
	URL   string `json:"url" dynamodbav:"url"`
}

ProjectLink is a labelled reference link on a project (Figma, style guide, Storybook, …).

type ProjectRepo added in v0.0.72

type ProjectRepo struct {
	Path string `json:"path" dynamodbav:"path"` // GitLab "group/sub/repo"
	Role string `json:"role" dynamodbav:"role"` // RepoRole*
	// DefaultBranch, when known (learned by the runner from origin/HEAD).
	DefaultBranch string `json:"defaultBranch,omitempty" dynamodbav:"defaultBranch,omitempty"`
}

ProjectRepo is one GitLab repository of a project with its role in the product — the role is what tells the agent where UI work belongs.

type ProjectScreen added in v0.0.89

type ProjectScreen struct {
	ID           string    `json:"id" dynamodbav:"id"`
	ProjectKey   string    `json:"projectKey" dynamodbav:"projectKey"`
	Page         string    `json:"page" dynamodbav:"page"`               // "Booking detail"
	Description  string    `json:"description" dynamodbav:"description"` // what the page is for / shows
	Viewport     string    `json:"viewport" dynamodbav:"viewport"`       // ScreenViewport*
	State        string    `json:"state,omitempty" dynamodbav:"state,omitempty"`
	SeenBy       string    `json:"seenBy,omitempty" dynamodbav:"seenBy,omitempty"`
	Route        string    `json:"route,omitempty" dynamodbav:"route,omitempty"`
	AttachmentID string    `json:"attachmentID" dynamodbav:"attachmentID"`
	UploadedBy   string    `json:"uploadedBy" dynamodbav:"uploadedBy"`
	CreatedAt    time.Time `json:"createdAt" dynamodbav:"createdAt"`
	UpdatedAt    time.Time `json:"updatedAt" dynamodbav:"updatedAt"`
}

ProjectScreen is one screenshot of a real page of a project — the design agent's reference for "what this product looks like". The image is an ordinary attachment; the screen holds a reference on it (see ScreenAttachmentRef) so the attachment GC keeps it alive.

type ProjectTheme added in v0.0.89

type ProjectTheme struct {
	ProjectKey string    `json:"projectKey" dynamodbav:"projectKey"`
	Filename   string    `json:"filename" dynamodbav:"filename"`
	CSS        string    `json:"css" dynamodbav:"css"`
	UpdatedBy  string    `json:"updatedBy" dynamodbav:"updatedBy"`
	UpdatedAt  time.Time `json:"updatedAt" dynamodbav:"updatedAt"`
}

ProjectTheme is a project's main stylesheet (e.g. globals.css), kept in its own row so project lists stay small. Agents never see the raw file — only its condensed tokens (variables, fonts, imports).

type RefreshToken

type RefreshToken struct {
	TokenHash string    `json:"tokenHash" dynamodbav:"tokenHash"`
	UserID    string    `json:"userID" dynamodbav:"userID"`
	ExpiresAt time.Time `json:"expiresAt" dynamodbav:"expiresAt"`
	CreatedAt time.Time `json:"createdAt" dynamodbav:"createdAt"`
	// RotatedAt marks the moment this token was used and superseded by a
	// successor. A rotated token is NOT deleted: the Set-Cookie carrying its
	// successor rides exactly one HTTP response, and on mobile networks that
	// response is regularly lost — the client then legitimately retries with
	// the only token it ever received. Deleting on rotation turned every
	// lost response into a forced re-login (see AuthService.RefreshAccessToken
	// for the reuse rules that keep rotation's replay protection intact).
	RotatedAt *time.Time `json:"rotatedAt,omitempty" dynamodbav:"rotatedAt,omitempty"`
	// SupersededBy is the hash of the successor issued when this token was
	// rotated. Reuse of a rotated token is allowed ONLY while that successor
	// is itself unused — a lost response means the successor's raw value was
	// destroyed with it, so nobody can ever present it.
	SupersededBy string `json:"supersededBy,omitempty" dynamodbav:"supersededBy,omitempty"`
	// FamilyID ties every token of one login session together across
	// rotations. A detected replay or a logout revokes the whole family —
	// deleting only the presented row left its rotated predecessor (or a
	// stolen sibling) able to mint a fresh session.
	FamilyID string `json:"familyID,omitempty" dynamodbav:"familyID,omitempty"`
	// AuthTime is when the user actually authenticated (the login), carried
	// unchanged across rotations so a session has an absolute lifetime no
	// matter how often it refreshes.
	AuthTime *time.Time `json:"authTime,omitempty" dynamodbav:"authTime,omitempty"`
}

type Reminder added in v0.0.54

type Reminder struct {
	ID         string `json:"id"`
	UserID     string `json:"userID"`
	MessageID  string `json:"messageID"`
	ParentID   string `json:"parentID"`
	ParentType string `json:"parentType"` // "channel" | "conversation"
	// ParentMessageID is the thread root when the reminded message is a thread
	// reply, taken from the stored message (never the client) at schedule time.
	ParentMessageID string `json:"parentMessageID,omitempty"`
	ChannelSlug     string `json:"channelSlug,omitempty"`
	MessagePreview  string `json:"messagePreview,omitempty"`
	// UserIDs are the people the owner added: when it comes due, the reminder
	// bot replies to the message tagging the owner and them. Without any, the
	// bot DMs the owner alone.
	UserIDs []string `json:"userIDs,omitempty"`
	// Everyone: the reminder is for every member of the chat (UserIDs is then
	// empty) but ExcludedUserIDs, the few the owner left out. The bot's reply
	// tags @all, and its notifications skip them.
	Everyone        bool     `json:"everyone,omitempty"`
	ExcludedUserIDs []string `json:"excludedUserIDs,omitempty"`
	// Note is the owner's own words for context, shown with the reminder
	// when it comes due.
	Note      string    `json:"note,omitempty"`
	RemindAt  time.Time `json:"remindAt"`
	CreatedAt time.Time `json:"createdAt"`
}

Reminder is a scheduled "remind me about this message" entry. It lives until it fires (or is cancelled), at which point it produces an ActivityReminder item in the owner's activity stream plus a desktop/mobile alert.

type ResolvedAgentConfig added in v0.0.72

type ResolvedAgentConfig struct {
	Harness       string   `json:"harness"`
	Model         string   `json:"model"`
	ExecutionMode string   `json:"executionMode"`
	Persona       string   `json:"persona"`
	SkillIDs      []string `json:"skillIDs,omitempty"`
	// SkillSnapshots: the template's attached skills as attached (see
	// AgentTemplate.SkillSnapshots). Server-side only.
	SkillSnapshots    []Skill     `json:"-"`
	Limits            AgentLimits `json:"limits"`
	MaxConcurrentRuns int         `json:"maxConcurrentRuns"`
	OfflinePolicy     string      `json:"offlinePolicy"`
	FollowUpMode      string      `json:"followUpMode"`
	FollowUpMins      int         `json:"followUpMins"`
	FollowUpAsk       bool        `json:"followUpAsk"`
	AutoAllow         []string    `json:"autoAllow,omitempty"`
}

ResolvedAgentConfig is the effective configuration a run executes under: invoker prefs ?? template ?? platform default, computed at run start and snapshotted onto the Run row so mid-run edits never change an in-flight run (plan-v2 §4).

type ResponseURLRecord added in v0.0.116

type ResponseURLRecord struct {
	WebhookID  string `json:"webhookID"`
	ParentID   string `json:"parentID"`
	ParentType string `json:"parentType"`
	MessageID  string `json:"messageID"`
	UserID     string `json:"userID"`
}

ResponseURLRecord is what a response_url stands for: one interaction's message, its app and its clicker. Kept only for the URL's short life.

type RichItem added in v0.0.116

type RichItem struct {
	Spans []RichSpan `json:"spans,omitempty"`
	Items []RichItem `json:"items,omitempty"`
}

RichItem is one list item: its text, and the items nested under it.

type RichNode added in v0.0.116

type RichNode struct {
	Type     string     `json:"type"`
	Level    int        `json:"level,omitempty"`
	Style    string     `json:"style,omitempty"`
	Spans    []RichSpan `json:"spans,omitempty"`
	Items    []RichItem `json:"items,omitempty"`
	Language string     `json:"language,omitempty"`
	Text     string     `json:"text,omitempty"`
}

RichNode is one paragraph-level part of a rich_text block:

  • paragraph, quote: Spans.
  • heading: Spans and a Level, 1 to 3.
  • list: Items (each may hold Items of its own) and a Style, bullet or ordered.
  • code: Text, and an optional Language for highlighting.

type RichSpan added in v0.0.116

type RichSpan struct {
	Type      string `json:"type,omitempty"`
	Text      string `json:"text,omitempty"`
	Bold      bool   `json:"bold,omitempty"`
	Italic    bool   `json:"italic,omitempty"`
	Strike    bool   `json:"strike,omitempty"`
	Underline bool   `json:"underline,omitempty"`
	Code      bool   `json:"code,omitempty"`
	Color     string `json:"color,omitempty"`
	Highlight string `json:"highlight,omitempty"`
	Link      string `json:"link,omitempty"`
	User      string `json:"user,omitempty"`
	Channel   string `json:"channel,omitempty"`
	Name      string `json:"name,omitempty"`
	Timestamp int64  `json:"timestamp,omitempty"`
	Format    string `json:"format,omitempty"`
	Fallback  string `json:"fallback,omitempty"`
}

RichSpan is an inline piece of rich text.

  • text: Text, styled by Bold … Code, Color and Highlight; Link makes it a link (http, https or mailto).
  • user, channel: a mention. The app names it (User: an ID or an email; Channel: a name or an ID); ex stores the ID it resolved to, with Name (the person's display name, the channel's slug) for drawing.
  • emoji: Name, like "rocket".
  • date: Timestamp (Unix seconds) shown in each reader's own time zone through Format's {date_short}, {date}, {date_long} and {time}, with Fallback for places that can't.
  • pill: Text in a small coloured label (Color).

type Run added in v0.0.72

type Run struct {
	ID      string `json:"id" dynamodbav:"id"`
	AgentID string `json:"agentID" dynamodbav:"agentID"` // shared agent user id
	// OwnerID is whose MACHINE executes the run. Agents belong to no one, so
	// this is always the invoker at Phase 1 — kept as a separate field because
	// it answers a different question (where does it run) than InvokerID does
	// (whose task, whose permissions, whose prefs).
	OwnerID      string `json:"ownerID" dynamodbav:"ownerID"`
	InvokerID    string `json:"invokerID" dynamodbav:"invokerID"`
	ParentID     string `json:"parentID" dynamodbav:"parentID"`
	ParentType   string `json:"parentType" dynamodbav:"parentType"`
	ThreadRootID string `json:"threadRootID,omitempty" dynamodbav:"threadRootID,omitempty"`
	MessageID    string `json:"messageID" dynamodbav:"messageID"` // invoking message (state reactions land here)

	State  RunState `json:"state" dynamodbav:"state"`
	Mode   string   `json:"mode" dynamodbav:"mode"` // "direct" at Phase 1
	Prompt string   `json:"prompt" dynamodbav:"prompt"`
	// AttachmentIDs are the files on the invoking message, in message order.
	// They are the run's INPUT files: the engine hands them to the model
	// (Bedrock content blocks, or downloads on the runner) and the run-scoped
	// attachment endpoint serves exactly these without a further message
	// lookup. Access is still the invoker's — the message they came from is
	// one the invoker could read when the run started.
	AttachmentIDs []string `json:"attachmentIDs,omitempty" dynamodbav:"attachmentIDs,omitempty"`

	// Round is the agent-to-agent handoff depth: 0 = human-invoked; an agent
	// whose reply @mentions another agent starts that agent at Round+1. The
	// orchestrator refuses rounds past the chain cap — the anti-loop bound
	// from plan.md §5.
	Round int `json:"round,omitempty" dynamodbav:"round,omitempty"`
	// CoInvoked lists the display names of ALL agents the invoking message
	// summoned, in mention order. >1 entry means parallel peers: the bundle
	// renders the roster so ordered task splits ("one do X, the other Y")
	// resolve deterministically by position instead of racing.
	CoInvoked []string `json:"coInvoked,omitempty" dynamodbav:"coInvoked,omitempty"`
	// AskFirst (follow-up runs): the invoker requires an approval gate before
	// the agent posts its reply.
	AskFirst bool `json:"askFirst,omitempty" dynamodbav:"askFirst,omitempty"`
	// WatchInstruction + ActionMode carry a watcher's standing order into the
	// run (watch/heartbeat modes). ActionMode also gates posting: notify/draft
	// runs are barred from public posts server-side.
	WatchInstruction string `json:"watchInstruction,omitempty" dynamodbav:"watchInstruction,omitempty"`
	ActionMode       string `json:"actionMode,omitempty" dynamodbav:"actionMode,omitempty"`
	// UntrustedTrigger marks a run that acts on activity its invoker did not
	// write: a watcher woken by another member's message, a catch-up over
	// such a backlog, a periodic check-in, and any agent hand-off chained from
	// one of those. Its write and exfiltration tools need the invoker's
	// approval per action (Orchestrator.AuthorizeAction). Server-side only.
	UntrustedTrigger bool `json:"-" dynamodbav:"untrustedTrigger,omitempty"`
	// TriggerAuthorID / TriggerText carry the message that woke a watcher —
	// rendered in the bundle as DATA, apart from the # Task (which is the
	// standing order). Server-side only.
	TriggerAuthorID string `json:"-" dynamodbav:"triggerAuthorID,omitempty"`
	TriggerText     string `json:"-" dynamodbav:"triggerText,omitempty"`

	// Config snapshot — what this run actually executes under.
	Harness       string   `json:"harness" dynamodbav:"harness"`
	Model         string   `json:"model,omitempty" dynamodbav:"model,omitempty"`
	ExecutionMode string   `json:"executionMode,omitempty" dynamodbav:"executionMode,omitempty"`
	PersonaHash   string   `json:"personaHash" dynamodbav:"personaHash"`
	Persona       string   `json:"-" dynamodbav:"persona"` // full text for the runner; hash for display
	SkillIDs      []string `json:"skillIDs,omitempty" dynamodbav:"skillIDs,omitempty"`
	// PickedSkillIDs: the subset of SkillIDs the INVOKING MESSAGE picked with
	// /skill tokens (template-attached skills excluded). These badge the
	// agent's replies — a standing template skill on every message would be
	// noise, an explicit pick is signal.
	PickedSkillIDs []string `json:"pickedSkillIDs,omitempty" dynamodbav:"pickedSkillIDs,omitempty"`
	// AttachedSkills snapshots the template's attached skills (content as an
	// admin attached them) — the bundle injects these, never a live rewrite.
	AttachedSkills []Skill `json:"-" dynamodbav:"attachedSkills,omitempty"`
	// ConnectorSlugs: the /connector tokens the invoking message carried —
	// the user's explicit pick of which external services this run may use.
	// The runner only syncs docs + injects credentials for these.
	ConnectorSlugs []string `json:"connectorSlugs,omitempty" dynamodbav:"connectorSlugs,omitempty"`
	// ProjectKey: the product whose design references ride this run (a
	// /project pick, inherited in a thread, or name-matched for the design
	// agent). Empty for most runs.
	ProjectKey string `json:"projectKey,omitempty" dynamodbav:"projectKey,omitempty"`
	// RequiresFeatures: runner features this run needs (RunnerFeature*). A
	// runner that doesn't advertise every one of them never claims the run —
	// e.g. design runs need file fetch/post, which old built-in runners lack.
	RequiresFeatures []string `json:"requiresFeatures,omitempty" dynamodbav:"requiresFeatures,omitempty"`
	// TaskID binds the run to a coding task (RunModeTask): its thread root is
	// the task card, its budget is uncapped, and the runner prepares the
	// project workspace before the harness starts.
	TaskID string `json:"taskID,omitempty" dynamodbav:"taskID,omitempty"`
	// AutoAllow: the invoker's pre-approved harness tool classes, snapshotted
	// so the runner's permission gateway can skip the card for them.
	AutoAllow []string    `json:"autoAllow,omitempty" dynamodbav:"autoAllow,omitempty"`
	Limits    AgentLimits `json:"limits" dynamodbav:"limits"`

	Spend RunSpend `json:"spend" dynamodbav:"spend"`
	// LastRunnerSeq is the highest runner-supplied event sequence whose spend
	// has already been counted. A batch retried after a lost HTTP response
	// re-reports the same sequences; without this high-water mark its turns and
	// tokens would be added twice and could trip a limit early.
	LastRunnerSeq int64 `json:"lastRunnerSeq,omitempty" dynamodbav:"lastRunnerSeq,omitempty"`

	RunnerID       string     `json:"runnerID,omitempty" dynamodbav:"runnerID,omitempty"`
	LeaseExpiresAt *time.Time `json:"leaseExpiresAt,omitempty" dynamodbav:"leaseExpiresAt,omitempty"`
	// Deadline is the ROLLING kill time: every run starts on the short
	// conversation window and each event batch extends it (harness activity =
	// stay alive; silence = die soon). HardDeadline is the absolute ceiling
	// extensions can never pass — WallClockFor(mode) from claim time. Zero
	// HardDeadline (pre-field runs) means no extensions.
	Deadline     time.Time `json:"deadline" dynamodbav:"deadline"`
	HardDeadline time.Time `json:"hardDeadline,omitempty" dynamodbav:"hardDeadline,omitempty"`

	FailReason string    `json:"failReason,omitempty" dynamodbav:"failReason,omitempty"`
	CreatedAt  time.Time `json:"createdAt" dynamodbav:"createdAt"`
	UpdatedAt  time.Time `json:"updatedAt" dynamodbav:"updatedAt"`

	// EventsArchived is set once a terminal run's timeline has been rolled into
	// a single object-storage blob and the per-event EVT# rows pruned from the
	// hot table — completed runs are the bulk of event volume, so this keeps
	// DynamoDB small. Timeline reads for such runs load from the archive
	// instead of the EVT# rows; live runs keep their events in DynamoDB.
	EventsArchived bool `json:"eventsArchived,omitempty" dynamodbav:"eventsArchived,omitempty"`
}

Run is one bounded agent task: invoked by a human mention, executed by the owner's runner, audited via its EVT# timeline.

type RunDigest added in v0.0.72

type RunDigest struct {
	RunID     string    `json:"runID" dynamodbav:"-"`
	AgentID   string    `json:"agentID" dynamodbav:"agentID"`
	InvokerID string    `json:"invokerID" dynamodbav:"invokerID"`
	Summary   string    `json:"summary" dynamodbav:"summary"`
	State     RunState  `json:"state" dynamodbav:"state"`
	CreatedAt time.Time `json:"createdAt" dynamodbav:"createdAt"`
}

RunDigest is the ≤5-bullet summary written at terminal state, read into other agents' context bundles (plan-v2 §8). InvokerID keeps the "whose invocation was this" attribution — the agent itself is shared.

type RunEvent added in v0.0.72

type RunEvent struct {
	RunID     string         `json:"runID" dynamodbav:"-"`
	Seq       int64          `json:"seq" dynamodbav:"seq"`
	ActorID   string         `json:"actorID" dynamodbav:"actorID"`
	Type      string         `json:"type" dynamodbav:"type"`
	Payload   map[string]any `json:"payload,omitempty" dynamodbav:"payload,omitempty"`
	CreatedAt time.Time      `json:"createdAt" dynamodbav:"createdAt"`
}

RunEvent is one append-only timeline row. Seq is assigned by the writer that owns the sequence (orchestrator for lifecycle events, runner batches carry their own runner-side seq offset) and writes are idempotent on (RunID, Seq) so a retried batch cannot duplicate the timeline.

type RunSpend added in v0.0.72

type RunSpend struct {
	Turns        int   `json:"turns" dynamodbav:"turns"`
	InputTokens  int64 `json:"inputTokens" dynamodbav:"inputTokens"`
	OutputTokens int64 `json:"outputTokens" dynamodbav:"outputTokens"`
	Posts        int   `json:"posts" dynamodbav:"posts"`
	// Uploads counts files the run stored for its own posts; capped per run
	// (UploadsPerRun) so a runaway agent can't fill the bucket.
	Uploads int `json:"uploads,omitempty" dynamodbav:"uploads,omitempty"`
}

RunSpend accumulates the resources a run has consumed, updated from runner-reported usage events. Runner figures are untrusted input — the orchestrator clamps and enforces against the run's limits (plan-v2 §9).

type RunState added in v0.0.72

type RunState string

RunState is the run lifecycle state machine. Direct mode at Phase 1 uses: queued → acknowledged → running → completed | failed | canceled.

const (
	RunStateQueued       RunState = "queued"
	RunStateAcknowledged RunState = "acknowledged"
	RunStateRunning      RunState = "running"
	RunStateCompleted    RunState = "completed"
	RunStateFailed       RunState = "failed"
	RunStateCanceled     RunState = "canceled"
)

func (RunState) Terminal added in v0.0.72

func (s RunState) Terminal() bool

Terminal reports whether the state accepts no further work. Tool calls and runner events against a terminal run are rejected.

type RunnerGrant added in v0.0.89

type RunnerGrant struct {
	CodeHash string `json:"codeHash" dynamodbav:"codeHash"`
	UserID   string `json:"userID" dynamodbav:"userID"`
	// Challenge is the PKCE S256 challenge: base64url(sha256(verifier)).
	Challenge string    `json:"challenge" dynamodbav:"challenge"`
	Label     string    `json:"label" dynamodbav:"label"`
	ExpiresAt time.Time `json:"expiresAt" dynamodbav:"expiresAt"`
}

RunnerGrant is the short-lived, single-use approval a signed-in user gives in the browser while pairing an ex-runner. The browser hands its code to the runner on localhost; the runner redeems it together with the PKCE verifier only it holds, so a code that leaks (browser history, a proxy log) is useless on its own. Stored under the hash of the code, never the code itself.

type RunnerHarness added in v0.0.72

type RunnerHarness struct {
	Name    string `json:"name" dynamodbav:"name"`
	Version string `json:"version,omitempty" dynamodbav:"version,omitempty"`
	Authed  bool   `json:"authed" dynamodbav:"authed"`
}

RunnerHarness is one detected CLI on a runner host.

type RunnerRegistration added in v0.0.72

type RunnerRegistration struct {
	RunnerID       string          `json:"runnerID" dynamodbav:"runnerID"`
	OwnerID        string          `json:"ownerID" dynamodbav:"ownerID"`
	Host           string          `json:"host" dynamodbav:"host"`
	OS             string          `json:"os" dynamodbav:"os"`
	Harnesses      []RunnerHarness `json:"harnesses" dynamodbav:"harnesses"`
	LeaseExpiresAt time.Time       `json:"leaseExpiresAt" dynamodbav:"leaseExpiresAt"`
	CreatedAt      time.Time       `json:"createdAt" dynamodbav:"createdAt"`
	// TokenID is the paired install this process signed in with (the
	// runner JWT's jti = RunnerToken.ID): how the Runners page knows which
	// of the owner's computers is online.
	TokenID string `json:"tokenID,omitempty" dynamodbav:"tokenID,omitempty"`
	// Version is the ex-runner build, when the runner reports it.
	Version string `json:"version,omitempty" dynamodbav:"version,omitempty"`
}

type RunnerToken added in v0.0.89

type RunnerToken struct {
	ID     string `json:"id" dynamodbav:"id"`
	UserID string `json:"userID" dynamodbav:"userID"`
	// Label names the machine as the runner reported it at sign-in (its
	// hostname), so the owner can tell installs apart when revoking one.
	Label     string    `json:"label" dynamodbav:"label"`
	CreatedAt time.Time `json:"createdAt" dynamodbav:"createdAt"`
	ExpiresAt time.Time `json:"expiresAt" dynamodbav:"expiresAt"`
	// Workbench marks the install ex set up on the shared agent workbench
	// for this person (Connect to Claude), not one they paired themselves.
	Workbench bool `json:"workbench,omitempty" dynamodbav:"workbench,omitempty"`
	// WorkbenchJob is the workbench's id for the onboarding that set this
	// install up, to ask it how that went. Empty when the workbench didn't
	// take the onboarding.
	WorkbenchJob string `json:"-" dynamodbav:"workbenchJob,omitempty"`
}

RunnerToken is the server-side record behind one paired ex-runner install. The runner's JWT carries this ID as its `jti`, and the runner middleware accepts a runner JWT only while its row exists — so deleting the row revokes exactly that install, without rotating the signing secret (which would sign every user out).

type ScheduledMessage added in v0.0.81

type ScheduledMessage struct {
	ID              string                `json:"id"`
	UserID          string                `json:"userID"`
	ParentID        string                `json:"parentID"`
	ParentType      string                `json:"parentType"` // "channel" | "conversation"
	ParentMessageID string                `json:"parentMessageID,omitempty"`
	Body            string                `json:"body"`
	AttachmentIDs   []string              `json:"attachmentIDs,omitempty"`
	SendAt          time.Time             `json:"sendAt"`
	State           ScheduledMessageState `json:"state"`
	// FailReason says why a failed delivery couldn't be made.
	FailReason string    `json:"failReason,omitempty"`
	CreatedAt  time.Time `json:"createdAt"`
	UpdatedAt  time.Time `json:"updatedAt"`
}

ScheduledMessage is a message its author composed now to be sent at SendAt — into a channel, a conversation, or a thread (ParentMessageID). At SendAt it is posted exactly like a normal send (notifications included) and removed.

type ScheduledMessageState added in v0.0.81

type ScheduledMessageState string

ScheduledMessageState is where a scheduled message stands: waiting for its time, or a delivery that could not be made (kept so its text isn't lost).

const (
	ScheduledMessagePending ScheduledMessageState = "pending"
	ScheduledMessageFailed  ScheduledMessageState = "failed"
)

type SelectOption added in v0.0.116

type SelectOption struct {
	Text        TextObject  `json:"text"`
	Value       string      `json:"value"`
	Description *TextObject `json:"description,omitempty"`
	URL         string      `json:"url,omitempty"`
}

SelectOption is one choice of a select, overflow menu, checkbox or radio group. Description is a second line (checkboxes and radios); URL makes an overflow option open a link (http or https only).

type SharePointChangedEvent added in v0.0.116

type SharePointChangedEvent struct {
	ParentID   string   `json:"parentID"`
	ParentType string   `json:"parentType"`
	URLs       []string `json:"urls"`
}

SharePointChangedEvent is the sharepoint.changed payload: these links in the parent changed state.

type SharePointFile added in v0.0.116

type SharePointFile struct {
	ID       string `json:"id"`
	Name     string `json:"name"`
	Size     int64  `json:"size"`
	Folder   bool   `json:"folder,omitempty"`
	MimeType string `json:"mimeType,omitempty"`
	WebURL   string `json:"webURL"`
	// EditURL opens the file for editing in Office for the web; empty for
	// files Office doesn't edit.
	EditURL string `json:"editURL,omitempty"`
	// DownloadURL downloads the file from SharePoint; empty for folders and
	// items Microsoft 365 gave no SharePoint ids.
	DownloadURL string `json:"downloadURL,omitempty"`
}

SharePointFile is a SharePoint or OneDrive file (or folder) shared with a channel or conversation.

type SharePointLink struct {
	URL      string            `json:"url"`
	Status   SharePointStatus  `json:"status"`
	PosterID string            `json:"posterID"`
	File     *SharePointFile   `json:"file,omitempty"`
	Problem  SharePointProblem `json:"problem,omitempty"`
	// SharedWith counts the members who have the file through this link.
	SharedWith int `json:"sharedWith,omitempty"`
	// NotShared lists the members it could not be shared with: guests,
	// accounts outside the directory, and members Microsoft 365 refused.
	NotShared []string `json:"notShared,omitempty"`
}

SharePointLink is a SharePoint link as posted in a channel or conversation: the file it leads to, once known, and how sharing it went. Problem, SharedWith and NotShared are filled in only for the person who posted it.

type SharePointProblem added in v0.0.116

type SharePointProblem string

SharePointProblem says why a link was not shared.

const (
	// SharePointSignIn: the poster's Microsoft sign-in has to be renewed —
	// none is stored, or it expired or was revoked.
	SharePointSignIn SharePointProblem = "sign_in"
	// SharePointDenied: the poster may not share the file.
	SharePointDenied SharePointProblem = "denied"
	// SharePointNotFound: the link doesn't lead to a file the poster can see.
	SharePointNotFound SharePointProblem = "not_found"
	// SharePointUnavailable: Microsoft 365 could not be reached.
	SharePointUnavailable SharePointProblem = "unavailable"
)

type SharePointStatus added in v0.0.116

type SharePointStatus string

SharePointStatus is how far sharing a posted SharePoint link with its channel or conversation has got.

const (
	SharePointPending SharePointStatus = "pending"
	SharePointShared  SharePointStatus = "shared"
	SharePointFailed  SharePointStatus = "failed"
)

type SidebarSort added in v0.0.124

type SidebarSort string

SidebarSort is a sidebar section's order: by recent activity, or the user's own order then A-Z ("az"; Unread, which has no order of the user's own, is plain A-Z).

const (
	SidebarSortRecent SidebarSort = "recent"
	SidebarSortAZ     SidebarSort = "az"
)

type Skill added in v0.0.72

type Skill struct {
	ID           string `json:"id" dynamodbav:"id"`
	Name         string `json:"name" dynamodbav:"name"`
	Description  string `json:"description" dynamodbav:"description"`
	Instructions string `json:"instructions" dynamodbav:"instructions"`
	// Visibility gates who beyond the author may see and use the skill:
	// "private" — only the author; "published" — everyone in the workspace may
	// see and USE it, but still only the author may edit, delete, or change its
	// visibility. Empty is treated as published so skills authored before this
	// field existed stay workspace-wide (see IsPublished).
	Visibility string    `json:"visibility,omitempty" dynamodbav:"visibility,omitempty"`
	CreatedBy  string    `json:"createdBy" dynamodbav:"createdBy"`
	CreatedAt  time.Time `json:"createdAt" dynamodbav:"createdAt"`
	UpdatedAt  time.Time `json:"updatedAt" dynamodbav:"updatedAt"`
}

Skill is a named instruction pack agents can pull in mid-run via invoke_skill (plan.md §2c, chat-scoped at this phase: a skill carries instructions, not extra tool grants — the tool surface is fixed and already bounded by the invoker's permissions).

func (*Skill) IsPublished added in v0.0.72

func (s *Skill) IsPublished() bool

IsPublished reports whether a skill is visible to and usable by the whole workspace. Legacy rows (empty Visibility) count as published — they were workspace-wide before the field existed and must not silently disappear.

func (*Skill) VisibleTo added in v0.0.72

func (s *Skill) VisibleTo(userID string) bool

VisibleTo reports whether userID may see and use this skill: its author always, anyone else only when it is published.

type StoredView added in v0.0.116

type StoredView struct {
	View      View   `json:"view"`
	WebhookID string `json:"webhookID"`
	UserID    string `json:"userID"`
	ClickID   string `json:"clickID,omitempty"`
	IconEmoji string `json:"iconEmoji,omitempty"`
	// Depth is the form's place in its stack: 0 for the first, 1 for one
	// pushed on it, and so on.
	Depth    int       `json:"depth,omitempty"`
	OpenedAt time.Time `json:"openedAt"`
}

StoredView is an open form as ex keeps it (in Redis, while it is open): the view, whose it is, and which app and click it came from. Submissions are checked against it, never against what the browser sends back.

type SystemRole

type SystemRole string
const (
	SystemRoleAdmin  SystemRole = "admin"
	SystemRoleMember SystemRole = "member"
	SystemRoleGuest  SystemRole = "guest"
)

type TableCell added in v0.0.116

type TableCell struct {
	Text  string     `json:"text,omitempty"`
	Spans []RichSpan `json:"spans,omitempty"`
}

TableCell is one cell: rich text pieces. On the way in, Text is a plain shorthand for a single text piece; ex stores Spans.

type TableColumn added in v0.0.116

type TableColumn struct {
	Header string `json:"header,omitempty"`
	Align  string `json:"align,omitempty"`
}

TableColumn is a table's column: its plain header (may be empty) and how its cells align.

type TaskClaim added in v0.0.72

type TaskClaim struct {
	ParentID     string    `json:"parentID" dynamodbav:"parentID"`
	ThreadRootID string    `json:"threadRootID" dynamodbav:"threadRootID"`
	Label        string    `json:"label" dynamodbav:"label"`
	AgentID      string    `json:"agentID" dynamodbav:"agentID"`
	InvokerID    string    `json:"invokerID" dynamodbav:"invokerID"`
	CreatedAt    time.Time `json:"createdAt" dynamodbav:"createdAt"`
}

TaskClaim is one agent's atomic claim on a part of a co-invoked task ("hindi", "auth.go") — first write wins, so two agents invoked together can split work without racing. Scoped to a thread; rows carry a TTL.

type TaskRepo added in v0.0.72

type TaskRepo struct {
	Path       string `json:"path" dynamodbav:"path"`
	Role       string `json:"role" dynamodbav:"role"`
	BaseBranch string `json:"baseBranch,omitempty" dynamodbav:"baseBranch,omitempty"`
	Branch     string `json:"branch" dynamodbav:"branch"`
	// WorkspaceDir is the runner-reported checkout path (informational — it
	// describes THAT machine's disk).
	WorkspaceDir string `json:"workspaceDir,omitempty" dynamodbav:"workspaceDir,omitempty"`
	MRURL        string `json:"mrURL,omitempty" dynamodbav:"mrURL,omitempty"`
	// Changed reports whether the branch carries commits beyond its base
	// (runner-reported at MR time); untouched repos get no MR.
	Changed bool `json:"changed,omitempty" dynamodbav:"changed,omitempty"`
}

TaskRepo is one repo's slice of a task.

type TaskSpec added in v0.0.72

type TaskSpec struct {
	ID           string         `json:"id"`
	ProjectKey   string         `json:"projectKey"`
	ProjectName  string         `json:"projectName"`
	Title        string         `json:"title"`
	Goal         string         `json:"goal"`
	Kind         string         `json:"kind"`
	State        string         `json:"state"`
	Repos        []TaskSpecRepo `json:"repos"`
	ChannelID    string         `json:"channelID"`
	ThreadRootID string         `json:"threadRootID"`
	TestURL      string         `json:"testURL,omitempty"`
	SignedOff    bool           `json:"signedOff,omitempty"`
	// RunnerID is the machine the workspace is pinned to ("" until the first
	// task run is claimed). The runner compares it with its own ID: a
	// mismatch means the checkouts live elsewhere and it is inheriting.
	RunnerID string `json:"runnerID,omitempty"`
}

TaskSpec is the task snapshot handed to the runner on an Assignment — what the workspace manager needs to prepare the checkouts and what the prompt preamble narrates. Never carries credentials (those ride the connector payload).

type TaskSpecRepo added in v0.0.72

type TaskSpecRepo struct {
	Path       string `json:"path"`
	Role       string `json:"role"`
	Branch     string `json:"branch"`
	BaseBranch string `json:"baseBranch,omitempty"`
	MRURL      string `json:"mrURL,omitempty"`
}

TaskSpecRepo is one repo on the runner's spec.

type TaskState added in v0.0.72

type TaskState string

TaskState is the task lifecycle. Transitions are validated server-side — notably nothing reaches mr_created without the sign-off gate.

const (
	TaskStateCreated        TaskState = "created"
	TaskStateWorkspaceReady TaskState = "workspace_ready"
	TaskStateInProgress     TaskState = "in_progress"
	TaskStateAwaitingTest   TaskState = "awaiting_user_test"
	TaskStateMRCreated      TaskState = "mr_created"
	TaskStateDone           TaskState = "done"
	TaskStateSetupFailed    TaskState = "setup_failed"
	TaskStateAbandoned      TaskState = "abandoned"
)

func (TaskState) Terminal added in v0.0.72

func (s TaskState) Terminal() bool

Terminal reports whether the task accepts no further work.

type TaskTicket added in v0.0.72

type TaskTicket struct {
	Connector string `json:"connector" dynamodbav:"connector"`
	ID        string `json:"id" dynamodbav:"id"`
	URL       string `json:"url,omitempty" dynamodbav:"url,omitempty"`
}

TaskTicket links a task to a ticket in a ticketing connector (CliffHub…).

type TestPlan added in v0.0.72

type TestPlan struct {
	// URL the requester opens — the product UI (or an API base when the
	// project genuinely has no UI).
	URL string `json:"url,omitempty" dynamodbav:"url,omitempty"`
	// Steps from the requester's perspective, in order.
	Steps []string `json:"steps" dynamodbav:"steps"`
	// CounterSteps are what must NOT happen / who must NOT see it.
	CounterSteps []string `json:"counterSteps,omitempty" dynamodbav:"counterSteps,omitempty"`
	// Accounts names the roles/test users to use (never secrets).
	Accounts string `json:"accounts,omitempty" dynamodbav:"accounts,omitempty"`
	Notes    string `json:"notes,omitempty" dynamodbav:"notes,omitempty"`
}

TestPlan is the requester-facing verification recipe: where to open the product, the steps that should work, and the counter-checks that should NOT (the other role's view, the regression you'd expect). API-only instructions are not a test plan when the product has a UI.

type TextObject added in v0.0.116

type TextObject struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

TextObject is a piece of text in a block: plain, or ex markdown.

type ThreadFollow added in v0.0.24

type ThreadFollow struct {
	UserID       string    `json:"userID" dynamodbav:"userID"`
	ParentID     string    `json:"parentID" dynamodbav:"parentID"`
	ParentType   string    `json:"parentType" dynamodbav:"parentType"`
	ThreadRootID string    `json:"threadRootID" dynamodbav:"threadRootID"`
	Following    bool      `json:"following" dynamodbav:"following"`
	UpdatedAt    time.Time `json:"updatedAt" dynamodbav:"updatedAt"`
	// LastActivityAt is the thread's latest reply (its root's time while it
	// has none): where a followed thread sorts in the user's /threads list.
	LastActivityAt *time.Time `json:"lastActivityAt,omitempty" dynamodbav:"lastActivityAt,omitempty"`
}

ThreadFollow is a per-user override for thread participation. Following=true explicitly adds a thread to /threads and thread-reply notifications. Following=false suppresses implicit participation from authored roots/replies without suppressing direct mentions.

type ThreadReadState added in v0.0.110

type ThreadReadState struct {
	SeenAt         *time.Time `json:"seenAt,omitempty"`
	MarkedUnreadAt *time.Time `json:"markedUnreadAt,omitempty"`
}

ThreadReadState is how far the user has read one thread: SeenAt is the server's seen time (absent when they never opened it). MarkedUnreadAt is when they marked a reply unread: SeenAt was rewound to just before it, so a newer seen time a client kept from before the mark must yield to it.

type ThreadRef added in v0.0.107

type ThreadRef struct {
	ParentID     string `json:"parentID"`
	ThreadRootID string `json:"threadRootID"`
}

ThreadRef names one thread: its parent and its root message.

type TokenClaims

type TokenClaims struct {
	jwt.RegisteredClaims
	UserID      string     `json:"uid"`
	Email       string     `json:"email"`
	DisplayName string     `json:"name"`
	SystemRole  SystemRole `json:"role"`

	// Scope marks non-interactive tokens (see TokenScope*). Empty = session.
	Scope string `json:"scope,omitempty"`
	// RunID binds a run-scoped token to exactly one run.
	RunID string `json:"runID,omitempty"`
	// ActorID is the agent user a run-scoped token posts as. UserID stays
	// the invoker — permissions are always the invoking human's; ActorID is
	// authorship only.
	ActorID string `json:"actorID,omitempty"`
}

type TriggerRecord added in v0.0.116

type TriggerRecord struct {
	WebhookID string `json:"webhookID"`
	UserID    string `json:"userID"`
	ClickID   string `json:"clickID,omitempty"`
	// IconEmoji is the icon the clicked message showed, so the form wears
	// the same face.
	IconEmoji string `json:"iconEmoji,omitempty"`
	// ViewID is the form the interaction came from, when it did: only a
	// trigger from a form can push another form on top of it.
	ViewID string `json:"viewID,omitempty"`
}

TriggerRecord is what a trigger_id stands for: one person's click (or form submission) on one app, allowing that app to open one form for them within seconds. ClickID names the browser tab that clicked.

type User

type User struct {
	ID            string       `json:"id" dynamodbav:"id"`
	Email         string       `json:"email" dynamodbav:"email"`
	DisplayName   string       `json:"displayName" dynamodbav:"displayName"`
	AvatarKey     string       `json:"-" dynamodbav:"avatarKey,omitempty"` // S3 object key (persistent)
	AvatarURL     string       `json:"avatarURL,omitempty" dynamodbav:"-"` // presigned URL, regenerated on each fetch
	SystemRole    SystemRole   `json:"systemRole" dynamodbav:"systemRole"`
	AuthProvider  AuthProvider `json:"authProvider,omitempty" dynamodbav:"authProvider,omitempty"`
	PasswordHash  string       `json:"-" dynamodbav:"passwordHash,omitempty"`
	EmojiSkinTone string       `json:"emojiSkinTone,omitempty" dynamodbav:"emojiSkinTone,omitempty"`
	UserStatus    *UserStatus  `json:"userStatus,omitempty" dynamodbav:"userStatus,omitempty"`
	TimeZone      string       `json:"timeZone,omitempty" dynamodbav:"timeZone,omitempty"`
	// NotificationSettings is the user's account-level notification baseline
	// (desktop/mobile levels, thread replies, group mentions, follow-all, and
	// the global keyword list). Nil means the user has never customised it and
	// DefaultNotificationSettings applies.
	NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty" dynamodbav:"notificationSettings,omitempty"`
	Status               string                `json:"status" dynamodbav:"status"` // "active", "deactivated"
	LastSeenAt           *time.Time            `json:"lastSeenAt,omitempty" dynamodbav:"lastSeenAt,omitempty"`
	CreatedAt            time.Time             `json:"createdAt" dynamodbav:"createdAt"`
	UpdatedAt            time.Time             `json:"updatedAt" dynamodbav:"updatedAt"`

	// IsBot marks a machine account: the identity behind an incoming webhook
	// (which owns the DM conversations its webhook posts into), or a bot
	// account admins manage, created on the admin page or migrated from
	// Mattermost, that an integration acts as through the Mattermost API.
	// Bots are hidden from the people directory, user search and mention
	// autocomplete; a bot account shows up only when adding someone to a
	// channel.
	IsBot bool `json:"isBot,omitempty" dynamodbav:"isBot,omitempty"`
	// Username is a bot's handle, unique among bots: the Mattermost API's
	// `username`. People have none, and neither do the bots behind incoming
	// webhooks or the bots migrated without one.
	Username string `json:"username,omitempty" dynamodbav:"username,omitempty"`
	// BotDescription says what a bot is for.
	BotDescription string `json:"botDescription,omitempty" dynamodbav:"botDescription,omitempty"`
	// BotOwnerID is the admin who created the bot (Mattermost's owner_id).
	BotOwnerID string `json:"-" dynamodbav:"botOwnerID,omitempty"`
	// BotDeletedAt is when an admin deleted the bot. The row stays so its
	// messages keep their author; the bot itself is gone from the bot list,
	// deactivated, tokenless, and its username free for another bot.
	BotDeletedAt *time.Time `json:"-" dynamodbav:"botDeletedAt,omitempty"`

	// Phone and Manager are directory attributes synced from Microsoft 365
	// at SSO login when the Graph integration is enabled. They are owned by
	// the directory (read-only in the app) and shown on profile surfaces.
	Phone   string       `json:"phone,omitempty" dynamodbav:"phone,omitempty"`
	Manager *UserManager `json:"manager,omitempty" dynamodbav:"manager,omitempty"`

	// MSObjectID is the user's Azure AD directory object id (the verified
	// `oid` ID-token claim), captured at login so Graph lookups don't depend
	// on email == userPrincipalName. Internal only — never serialized to
	// clients.
	MSObjectID string `json:"-" dynamodbav:"msObjectID,omitempty"`

	// OIDCIssuer + OIDCSubject bind the account to ONE identity-provider
	// identity, recorded at the first SSO login. The email claim is mutable
	// (renames, recycled addresses), so a later login whose issuer/subject
	// differ from the bound pair is refused rather than handed this account.
	// Internal only — never serialized to clients.
	OIDCIssuer  string `json:"-" dynamodbav:"oidcIssuer,omitempty"`
	OIDCSubject string `json:"-" dynamodbav:"oidcSubject,omitempty"`

	// DeactivatedBy records who deactivated the account: DeactivatedByAdmin
	// or DeactivatedByDirectory. The directory sweep only reactivates what
	// the directory itself deactivated — it must never undo an admin's call.
	DeactivatedBy string `json:"-" dynamodbav:"deactivatedBy,omitempty"`

	// Kind discriminates humans ("") from agent instances ("agent"). Agents
	// are the same kind of thing as a human user — member lists, mentions,
	// presence and authorship all resolve through the same user id — with
	// AgentConfig carrying the agent-only settings.
	Kind UserKind `json:"kind,omitempty" dynamodbav:"kind,omitempty"`
	// AgentConfig is set only when Kind == UserKindAgent.
	AgentConfig *AgentConfig `json:"agentConfig,omitempty" dynamodbav:"agentConfig,omitempty"`
}

func (*User) IsAgent added in v0.0.72

func (u *User) IsAgent() bool

IsAgent reports whether the user is an agent instance.

type UserAgentPrefs added in v0.0.72

type UserAgentPrefs struct {
	UserID string `json:"userID" dynamodbav:"userID"`
	Slug   string `json:"slug" dynamodbav:"slug"`

	Harness string       `json:"harness,omitempty" dynamodbav:"harness,omitempty"`
	Model   string       `json:"model,omitempty" dynamodbav:"model,omitempty"`
	Persona string       `json:"persona,omitempty" dynamodbav:"persona,omitempty"`
	Limits  *AgentLimits `json:"limits,omitempty" dynamodbav:"limits,omitempty"`
	// ExecutionMode (API harnesses only): "runner" | "server". "" inherits.
	ExecutionMode string `json:"executionMode,omitempty" dynamodbav:"executionMode,omitempty"`
	// OfflinePolicy: "" inherits the platform default (reject).
	OfflinePolicy string `json:"offlinePolicy,omitempty" dynamodbav:"offlinePolicy,omitempty"`

	// Thread follow-ups: whether MY invocations of this agent keep listening
	// when I reply in the same thread WITHOUT re-tagging it. "" inherits the
	// platform default (off). Runs on my quota — my agent, my choice.
	FollowUpMode string `json:"followUpMode,omitempty" dynamodbav:"followUpMode,omitempty"`
	FollowUpMins int    `json:"followUpMins,omitempty" dynamodbav:"followUpMins,omitempty"`
	// FollowUpAsk: the agent must ask me (approval gate) before actually
	// posting a follow-up reply.
	FollowUpAsk bool `json:"followUpAsk,omitempty" dynamodbav:"followUpAsk,omitempty"`
	// AutoAllow lists harness tool CLASSES (AutoAllow*) this user pre-approves
	// for runs of this agent — the "don't ask me again for reads" dial. The
	// runner's permission gateway honors it locally; everything else still
	// raises an approval card.
	AutoAllow []string `json:"autoAllow,omitempty" dynamodbav:"autoAllow,omitempty"`

	UpdatedAt time.Time `json:"updatedAt" dynamodbav:"updatedAt"`
}

UserAgentPrefs are ONE USER's preferences for how a shared agent behaves when THEY invoke it — the prompt they edit, the harness pin, the model. Nil/empty fields inherit the template. Stored per (userID, slug); never on the agent, which is shared.

type UserChannel

type UserChannel struct {
	UserID        string      `json:"userID" dynamodbav:"userID"`
	ChannelID     string      `json:"channelID" dynamodbav:"channelID"`
	ChannelName   string      `json:"channelName" dynamodbav:"channelName"`
	ChannelType   ChannelType `json:"channelType" dynamodbav:"channelType"`
	Role          ChannelRole `json:"role" dynamodbav:"role"`
	JoinedAt      time.Time   `json:"joinedAt" dynamodbav:"joinedAt"`
	LastReadMsgID string      `json:"lastReadMsgID,omitempty" dynamodbav:"lastReadMsgID,omitempty"`
	// LastReadSeq is the Channel.MessageSeq value this user had consumed as
	// of their last read. unread count = max(0, Channel.MessageSeq -
	// LastReadSeq); unread = count > 0. Set to the channel's current seq on
	// join, on read, and when the user sends (posting marks the channel read
	// for the author). Persisted on the user-side row only — it's per-user.
	LastReadSeq int64 `json:"lastReadSeq,omitempty" dynamodbav:"lastReadSeq,omitempty"`
	// Unread / UnreadCount are read-time enrichments computed in
	// ListUserChannels from the seq pair above — never persisted (mirrors
	// UserConversation.Unread).
	Unread      bool `json:"unread,omitempty" dynamodbav:"-"`
	UnreadCount int  `json:"unreadCount,omitempty" dynamodbav:"-"`
	// Archived mirrors the channel's archived (read-only) flag, stamped at
	// read time by ListUserChannels; the sidebar groups archived channels.
	Archived bool `json:"archived,omitempty" dynamodbav:"-"`
	// LastMessageAt mirrors the channel's last top-level message time,
	// stamped at read time by ListUserChannels for the sidebar's "Recent
	// activity" sort.
	LastMessageAt *time.Time `json:"lastMessageAt,omitempty" dynamodbav:"-"`
	// Icon mirrors the channel's emoji icon, stamped at read time like
	// Archived, so changing it writes one row, not one per member.
	Icon string `json:"icon,omitempty" dynamodbav:"-"`
	// UnreadNotifyCount counts unread messages that actually ALERTED this
	// user per their notification rules (mentions, keywords, "all messages"
	// level; mute suppresses) — the sidebar's numeric badge. Plain unread
	// messages only set the Unread indicator. Persisted (incremented by the
	// notifier for each alerted recipient, reset alongside LastReadSeq)
	// because the notification decision is made once, server-side, at send
	// time and can't be recomputed cheaply at read time.
	UnreadNotifyCount int64 `json:"unreadNotifyCount,omitempty" dynamodbav:"unreadNotifyCount,omitempty"`
	// Muted suppresses notifications (sound + browser popup) for this
	// channel without unsubscribing the user. Real-time event delivery is
	// unaffected; only the notifier respects this flag.
	Muted bool `json:"muted,omitempty" dynamodbav:"muted,omitempty"`
	// Favorite pins the channel to the "Favorites" sidebar section. Per
	// user — flipping it here doesn't affect anyone else's view.
	Favorite bool `json:"favorite,omitempty" dynamodbav:"favorite,omitempty"`
	// CategoryID assigns the channel to a user-defined sidebar category;
	// empty string means "no category" (lands under the default "Other"
	// section). The category record itself lives in UserChannelCategory.
	CategoryID string `json:"categoryID,omitempty" dynamodbav:"categoryID,omitempty"`
	// SidebarPosition is a sparse per-user ordering key inside the
	// channel's current sidebar bucket.
	SidebarPosition int `json:"sidebarPosition,omitempty" dynamodbav:"sidebarPosition,omitempty"`
	// Per-channel notification preference overrides. A nil pointer means
	// "inherit the user's account-level NotificationSettings" and is stored
	// as an absent attribute. ResolveNotificationPrefs folds these onto the
	// account baseline. Keywords are global (account-only) and not overridable
	// here. Muted (above) is independent and always suppresses everything.
	DesktopLevel        *NotificationLevel       `json:"desktopLevel,omitempty" dynamodbav:"notifDesktopLevel,omitempty"`
	MobileLevel         *MobileNotificationLevel `json:"mobileLevel,omitempty" dynamodbav:"notifMobileLevel,omitempty"`
	ThreadReplies       *bool                    `json:"threadReplies,omitempty" dynamodbav:"notifThreadReplies,omitempty"`
	IgnoreGroupMentions *bool                    `json:"ignoreGroupMentions,omitempty" dynamodbav:"notifIgnoreGroupMentions,omitempty"`
	FollowAllThreads    *bool                    `json:"followAllThreads,omitempty" dynamodbav:"notifFollowAllThreads,omitempty"`
}

UserChannel represents a channel from the user's perspective (stored on user side).

type UserChannelCategory added in v0.0.3

type UserChannelCategory struct {
	UserID    string    `json:"userID" dynamodbav:"userID"`
	ID        string    `json:"id" dynamodbav:"id"`
	Name      string    `json:"name" dynamodbav:"name"`
	Position  int       `json:"position" dynamodbav:"position"`
	CreatedAt time.Time `json:"createdAt" dynamodbav:"createdAt"`
}

UserChannelCategory is a user-defined grouping for the sidebar. Users with 100+ channels create categories like "Engineering" or "Customer support" and assign channels to them so the sidebar stays navigable. Categories are per-user — there's no shared workspace concept.

type UserConversation

type UserConversation struct {
	UserID         string           `json:"userID" dynamodbav:"userID"`
	ConversationID string           `json:"conversationID" dynamodbav:"conversationID"`
	Type           ConversationType `json:"type" dynamodbav:"type"`
	DisplayName    string           `json:"displayName" dynamodbav:"displayName"` // other user's name for DM, group name for group
	ParticipantIDs []string         `json:"participantIDs" dynamodbav:"participantIDs"`
	CreatedBy      string           `json:"createdBy,omitempty" dynamodbav:"createdBy,omitempty"`
	Activated      bool             `json:"activated" dynamodbav:"activated"`
	JoinedAt       time.Time        `json:"joinedAt" dynamodbav:"joinedAt"`
	UpdatedAt      time.Time        `json:"updatedAt,omitempty" dynamodbav:"updatedAt,omitempty"`
	LastReadMsgID  string           `json:"lastReadMsgID,omitempty" dynamodbav:"lastReadMsgID,omitempty"`
	// LastReadSeq mirrors UserChannel.LastReadSeq: unread = Conversation.MessageSeq
	// - LastReadSeq. The same exact-count seq model backs channels and
	// conversations alike (no more Redis unread boolean).
	LastReadSeq int64 `json:"lastReadSeq,omitempty" dynamodbav:"lastReadSeq,omitempty"`
	// Unread / UnreadCount are read-time enrichments computed in
	// ListUserConversations from the seq pair — never persisted.
	Unread      bool `json:"unread,omitempty" dynamodbav:"-"`
	UnreadCount int  `json:"unreadCount,omitempty" dynamodbav:"-"`
	// UnreadNotifyCount mirrors UserChannel.UnreadNotifyCount: unread
	// messages that actually alerted this user (DM messages always do unless
	// muted), maintained by the notifier and reset alongside LastReadSeq.
	UnreadNotifyCount int64 `json:"unreadNotifyCount,omitempty" dynamodbav:"unreadNotifyCount,omitempty"`
	// Muted: this user muted the chat. Only a chat with a bot or a webhook
	// can be muted (never one with a person); its messages then alert them
	// for nothing but a direct @-mention.
	Muted bool `json:"muted,omitempty" dynamodbav:"muted,omitempty"`
	// AvatarURL and UserStatus are read-time enrichments for DM sidebar rows.
	// They are intentionally not persisted so profile changes stay single
	// sourced from the User record.
	AvatarURL       string      `json:"avatarURL,omitempty" dynamodbav:"-"`
	UserStatus      *UserStatus `json:"userStatus,omitempty" dynamodbav:"-"`
	ProfileResolved bool        `json:"profileResolved,omitempty" dynamodbav:"-"`
	// Bot: the other side of this DM is a bot or a webhook, read from its
	// profile like the avatar. Such a chat can be muted; one with a person
	// can't.
	Bot bool `json:"bot,omitempty" dynamodbav:"-"`
	// Favorite pins this DM/group to the user's "Favorites" sidebar
	// section. Same per-user semantics as on UserChannel.
	Favorite bool `json:"favorite,omitempty" dynamodbav:"favorite,omitempty"`
	// CategoryID assigns this DM/group to one of the user's sidebar
	// categories. The same SidebarCategory namespace holds both channels
	// and conversations so a category like "Engineering" can hold both
	// #eng-channel and a DM with the team lead.
	CategoryID string `json:"categoryID,omitempty" dynamodbav:"categoryID,omitempty"`
	// SidebarPosition is a sparse per-user ordering key inside the
	// conversation's current sidebar bucket.
	SidebarPosition int `json:"sidebarPosition,omitempty" dynamodbav:"sidebarPosition,omitempty"`
}

UserConversation represents a conversation from the user's perspective.

type UserGroup added in v0.0.121

type UserGroup struct {
	ID          string    `json:"id" dynamodbav:"id"`
	Handle      string    `json:"handle" dynamodbav:"handle"`
	Name        string    `json:"name" dynamodbav:"name"`
	Description string    `json:"description" dynamodbav:"description"`
	Disabled    bool      `json:"disabled" dynamodbav:"disabled"`
	MemberCount int       `json:"memberCount" dynamodbav:"memberCount"`
	CreatedBy   string    `json:"createdBy" dynamodbav:"createdBy"`
	CreatedAt   time.Time `json:"createdAt" dynamodbav:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt" dynamodbav:"updatedAt"`

	// Source is the Entra group the group follows.
	Source UserGroupSource `json:"source" dynamodbav:"source"`
	// SyncSkipped counts the people in the Entra group who aren't group
	// members in ex (no ex account, a guest, a bot or deactivated).
	SyncSkipped int `json:"syncSkipped,omitempty" dynamodbav:"syncSkipped,omitempty"`
	// SyncState flags something about the source an admin should know (""
	// when there's nothing).
	SyncState UserGroupSyncState `json:"syncState,omitempty" dynamodbav:"syncState,omitempty"`
}

UserGroup is a named set of people mentioned together through its handle (Slack-style "@oncall"). Groups come from Microsoft 365 (Entra ID): each security group in the configured parent group is one user group, its display name the handle, kept in sync by the user-group sync. A disabled group keeps its members and its handle but is not mentionable.

type UserGroupDetail added in v0.0.121

type UserGroupDetail struct {
	UserGroup `tstype:",extends"`
	MemberIDs []string `json:"memberIds" dynamodbav:"-"`
	Version   int64    `json:"-" dynamodbav:"version"`
}

UserGroupDetail is a group with its member IDs. The members are rows of their own (one per member), so a group has no size limit. Version is the group row's optimistic-concurrency counter.

type UserGroupSource added in v0.0.121

type UserGroupSource struct {
	Kind string `json:"kind" dynamodbav:"kind"`
	ID   string `json:"id" dynamodbav:"id"`
	Key  string `json:"key" dynamodbav:"key"`
}

UserGroupSource is where a group's members come from. Key identifies it ("entra-group:<object id>") and is claimed, so one source backs at most one group; it never changes, so renaming the Entra group renames this group.

type UserGroupSyncSkip added in v0.0.121

type UserGroupSyncSkip struct {
	// GroupID is the ex group (when it exists), Name the Entra group's name.
	GroupID string `json:"groupId,omitempty"`
	Name    string `json:"name"`
	Reason  string `json:"reason"`
}

UserGroupSyncSkip is an Entra group a sync couldn't use as it is, and why.

type UserGroupSyncState added in v0.0.121

type UserGroupSyncState string

UserGroupSyncState flags a group's source for admins.

const (
	// UserGroupSyncSourceMissing: the Entra group left the parent group (or
	// was deleted), so the group has no members; an admin can disable it.
	UserGroupSyncSourceMissing UserGroupSyncState = "source-missing"
	// UserGroupSyncHandleConflict: the Entra group was renamed to a handle ex
	// can't use (invalid, reserved, or held by another group or a bot), so
	// the group keeps its handle until that's fixed.
	UserGroupSyncHandleConflict UserGroupSyncState = "handle-conflict"
)

type UserGroupSyncStatus added in v0.0.121

type UserGroupSyncStatus struct {
	// Configured is false when no parent group is set, so nothing syncs.
	Configured bool `json:"configured"`
	// IntervalMinutes is how often the scheduled sync runs.
	IntervalMinutes int `json:"intervalMinutes"`
	// Running is set while a sync runs; StartedAt and Trigger ("scheduled"
	// or "manual") describe it.
	Running   bool       `json:"running"`
	StartedAt *time.Time `json:"startedAt,omitempty"`
	Trigger   string     `json:"trigger,omitempty"`
	// LastSyncedAt is when the last successful sync finished; nil before
	// the first.
	LastSyncedAt *time.Time `json:"lastSyncedAt,omitempty"`
	// FinishedAt is when the last sync, successful or not, finished.
	FinishedAt *time.Time `json:"finishedAt,omitempty"`
	// LastError says why the last sync failed; "" when it succeeded.
	LastError string `json:"lastError,omitempty"`
	// Skipped lists the Entra groups the last sync couldn't create or rename.
	Skipped []UserGroupSyncSkip `json:"skipped"`
}

UserGroupSyncStatus is how the user-group sync went, for admins.

type UserKind added in v0.0.72

type UserKind string

UserKind discriminates humans from agent instances on the shared user record. The zero value ("") is a human so every pre-existing row keeps its meaning without a migration.

const (
	UserKindHuman UserKind = "" // implicit on all existing rows
	UserKindAgent UserKind = "agent"
)

type UserManager added in v0.0.65

type UserManager struct {
	DisplayName string `json:"displayName" dynamodbav:"displayName"`
	Email       string `json:"email,omitempty" dynamodbav:"email,omitempty"`
	UserID      string `json:"userID,omitempty" dynamodbav:"userID,omitempty"`
}

UserManager is a lightweight reference to a user's manager from the employee directory. UserID is set when the manager is also an Ex user (matched by email) so clients can link to their profile.

func (*UserManager) Equal added in v0.0.65

func (m *UserManager) Equal(other *UserManager) bool

Equal reports whether two manager references carry the same directory data. Used to decide whether a login-time directory sync actually changed the profile (and therefore whether to broadcast user.updated).

type UserState added in v0.0.26

type UserState struct {
	ThreadNotifications []string `json:"threadNotifications"`
	HiddenConversations []string `json:"hiddenConversations"`
	HiddenSkills        []string `json:"hiddenSkills"`
	// SidebarSorts maps a sidebar section's key to the order the user chose
	// for it; a section not listed keeps its default.
	SidebarSorts map[string]SidebarSort `json:"sidebarSorts"`
}

UserState is the user's small, always-loaded state. How far they read each thread is not part of it: that is one row per thread they ever opened, and a thread's row is read when it opens (ThreadReadState).

type UserStateItem added in v0.0.26

type UserStateItem struct {
	UserID       string        `json:"userID" dynamodbav:"userID"`
	Kind         UserStateKind `json:"kind" dynamodbav:"kind"`
	TargetID     string        `json:"targetID" dynamodbav:"targetID"`
	ParentID     string        `json:"parentID,omitempty" dynamodbav:"parentID,omitempty"`
	ParentType   string        `json:"parentType,omitempty" dynamodbav:"parentType,omitempty"`
	ThreadRootID string        `json:"threadRootID,omitempty" dynamodbav:"threadRootID,omitempty"`
	SeenAt       *time.Time    `json:"seenAt,omitempty" dynamodbav:"seenAt,omitempty"`
	// Rewound marks a thread_seen row a mark-unread wrote: SeenAt was set back
	// to just before a reply on purpose. An ordinary "seen" write replaces the
	// row without it.
	Rewound bool `json:"rewound,omitempty" dynamodbav:"rewound,omitempty"`
	// Sort is a sidebar_sort row's order.
	Sort      SidebarSort `json:"sort,omitempty" dynamodbav:"sort,omitempty"`
	UpdatedAt time.Time   `json:"updatedAt" dynamodbav:"updatedAt"`
}

type UserStateKind added in v0.0.26

type UserStateKind string
const (
	UserStateThreadNotification UserStateKind = "thread_notification"
	UserStateThreadSeen         UserStateKind = "thread_seen"
	UserStateHiddenConversation UserStateKind = "hidden_conversation"
	// UserStateHiddenSkill removes one skill from the "# Workspace skills"
	// discovery index of THIS user's agent runs — a per-user curation knob so
	// a workspace full of skills stays legible. An explicit /skill pick still
	// attaches a hidden skill: hiding is about discovery, not permission.
	UserStateHiddenSkill UserStateKind = "hidden_skill"
	// UserStateSidebarSort is how one sidebar section orders its rows for this
	// user, on every device: TargetID is the section's key (a built-in
	// section's, or a category's ID), Sort the order.
	UserStateSidebarSort UserStateKind = "sidebar_sort"
)

type UserStatus added in v0.0.22

type UserStatus struct {
	Emoji   string     `json:"emoji" dynamodbav:"emoji"`
	Text    string     `json:"text" dynamodbav:"text"`
	ClearAt *time.Time `json:"clearAt,omitempty" dynamodbav:"clearAt,omitempty"`
}

type View added in v0.0.116

type View struct {
	ID              string      `json:"id"`
	Type            string      `json:"type"`
	CallbackID      string      `json:"callback_id,omitempty"`
	Title           TextObject  `json:"title"`
	Submit          *TextObject `json:"submit,omitempty"`
	Close           *TextObject `json:"close,omitempty"`
	Blocks          Blocks      `json:"blocks"`
	PrivateMetadata string      `json:"private_metadata,omitempty"`
	ExternalID      string      `json:"external_id,omitempty"`
	// NotifyOnClose has ex tell the app (view_closed) when the person
	// closes the form without submitting it.
	NotifyOnClose bool `json:"notify_on_close,omitempty"`
	// PreviousViewID / RootViewID place a pushed form in its stack: the
	// form under it, and the first form. Set by ex.
	PreviousViewID string `json:"previous_view_id,omitempty"`
	RootViewID     string `json:"root_view_id,omitempty"`
	// Hash changes with every update; an app's views.update naming an old
	// hash is refused, so two updates can't silently overwrite each other.
	Hash string `json:"hash"`
}

View is a form an app opens for one person (Slack's modal): a title, submit and close labels, and blocks — a message's blocks plus input fields. This is the shape the app sends and the person's client draws; what ex keeps beside it is StoredView.

type WorkspaceSettings added in v0.0.2

type WorkspaceSettings struct {
	// MaxUploadBytes is the maximum file size accepted by the
	// attachment-upload endpoint. 0 means "use the built-in default".
	MaxUploadBytes int64 `json:"maxUploadBytes" dynamodbav:"maxUploadBytes"`
	// AllowedExtensions is a lowercase list (without the leading dot)
	// of file extensions that may be uploaded. Empty list means "use
	// the built-in default".
	AllowedExtensions []string `json:"allowedExtensions" dynamodbav:"allowedExtensions"`
	// OhmagifAPIKey, when non-empty, turns on the GIF picker in the
	// composer. The picker asks ohmagif.com directly, so this key goes to
	// every signed-in client; ohmagif refuses it on any site the key does
	// not list. GIFs in messages need no key: they show from their files'
	// lasting addresses.
	OhmagifAPIKey string `json:"ohmagifAPIKey,omitempty" dynamodbav:"ohmagifAPIKey,omitempty"`
	// RunnersInApp turns on the Runners tab in the AI hub, where people set
	// up, start and disconnect ex-runner (the desktop app can install and run
	// it for them). Off by default: until an admin turns it on, runners are
	// set up from the command line and the account menu's Runners dialog.
	RunnersInApp bool `json:"runnersInApp" dynamodbav:"runnersInApp"`
	// AgentModels are the models agents may run on, per engine: the agents
	// page and the admin panel offer them in a dropdown. Empty means the
	// built-in list (DefaultAgentModels). Changed only through its own admin
	// route, never by a save of the other settings.
	AgentModels []AgentModelOption `json:"agentModels" dynamodbav:"agentModels,omitempty"`
}

WorkspaceSettings holds workspace-wide knobs an admin controls. The document is keyed in the single-table store under a fixed PK/SK so there's exactly one record. Settings are read on every upload, so callers should rely on the cache layer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL