types

package
v0.1.147 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeLocal  = "local"  // No Redis/Postgres, S3 direct
	ModeRemote = "remote" // Full infrastructure
)

Mode constants for gateway operation

View Source
const (
	MCPTransportSSE  = "sse"  // Server-Sent Events (default)
	MCPTransportHTTP = "http" // Streamable HTTP
)

Transport type constants

View Source
const (
	DefaultGatewayGRPCPort = 1993
	DefaultGatewayHTTPPort = 1994
	DefaultGatewayHost     = "localhost"
)
View Source
const (
	// Credential metadata keys used for OAuth capability gating.
	CredentialMetaGrantedScopes = "oauth_granted_scopes"
	CredentialMetaCapabilities  = "airstore_capabilities"
)
View Source
const (
	AgentRunEventPayloadKeyAttemptID        = "attempt_id"
	AgentRunEventPayloadKeyTaskID           = "task_id"
	AgentRunEventPayloadKeyExitCode         = "exit_code"
	AgentRunEventPayloadKeyError            = "error"
	AgentRunEventPayloadKeyEvent            = "event"
	AgentRunEventPayloadKeyQueueMode        = "queue_mode"
	AgentRunEventPayloadKeyMode             = "mode"
	AgentRunEventPayloadKeyDirect           = "direct"
	AgentRunEventPayloadKeyInteractionState = "interaction_state"
	AgentRunEventPayloadKeyAction           = "action"
	AgentRunEventPayloadKeyCause            = "cause"
	AgentRunEventPayloadKeyNextRunID        = "next_run_id"
	AgentRunEventPayloadKeyNextAttemptNo    = "next_attempt_no"
	AgentRunEventPayloadKeyRestartedFromRun = "restarted_from_run_id"
)
View Source
const (
	AgentRunEventActionCancelThenContinue = "cancel_then_continue"
	AgentRunEventCauseInterrupt           = "interrupt"
)
View Source
const (
	AgentRunErrorInterruptedByQueuedInput    = "interrupted by queued input"
	AgentRunErrorSupersededByFollowupRestart = "superseded by follow-up restart"
)
View Source
const (
	AgentAttemptStrategyPrimary = "primary"
	AgentAttemptStrategyRetry   = "retry"
)
View Source
const (
	AgentTaskDropReasonInterruptMissingTarget = "interrupt_missing_target"
	AgentTaskDropReasonRunMaterializationFail = "run_materialization_failed"
	AgentTaskDropReasonReshapedByQueueMode    = "reshaped_by_queue_mode"
	AgentTaskDropReasonDispatchRetryExhausted = "dispatch_retry_exhausted"
)
View Source
const (
	AgentExecutionMetaKeyInstanceKey      = "instance_key"
	AgentExecutionMetaKeyRetry            = "retry"
	AgentExecutionMetaKeyRetryFromRunID   = "retry_from_run_id"
	AgentExecutionMetaKeyRetryAttemptNo   = "retry_attempt_no"
	AgentExecutionMetaKeyRetryMaxAttempts = "retry_max_attempts"
	AgentExecutionMetaKeyRetryDelayMs     = "retry_delay_ms"
	AgentExecutionMetaKeyResources        = "resources"
	AgentExecutionMetaKeyRunID            = "run_id"
	AgentExecutionMetaKeyRunAttemptID     = "run_attempt_id"
	AgentExecutionMetaKeyOriginTaskID     = "origin_task_id"
	AgentExecutionMetaKeyAgentID          = "agent_id"
	AgentExecutionMetaKeyViewSchema       = "view_schema_context"
	AgentTaskSpawnedByFanOut              = "fanout_subtask"
)
View Source
const (
	OrchestrationOutboxPayloadTaskID                      = "task_id"
	OrchestrationOutboxPayloadAttemptID                   = "attempt_id"
	OrchestrationOutboxPayloadExitCode                    = "exit_code"
	OrchestrationOutboxPayloadError                       = "error"
	OrchestrationOutboxPayloadLLMInputTokens              = "llm_input_tokens"
	OrchestrationOutboxPayloadLLMOutputTokens             = "llm_output_tokens"
	OrchestrationOutboxPayloadLLMCacheCreationInputTokens = "llm_cache_creation_input_tokens"
	OrchestrationOutboxPayloadLLMCacheReadInputTokens     = "llm_cache_read_input_tokens"
	OrchestrationOutboxPayloadLLMTotalTokens              = "llm_total_tokens"
	OrchestrationOutboxPayloadTotalCostUSD                = "total_cost_usd"
	OrchestrationOutboxPayloadLLMModelUsageJSON           = "llm_model_usage_json"
	OrchestrationOutboxPayloadReason                      = "reason"
	OrchestrationOutboxPayloadRetryDelay                  = "retry_delay_ms"
	OrchestrationOutboxPayloadDispatchAttempt             = "dispatch_attempt"
	OrchestrationOutboxPayloadRunID                       = "run_id"
	OrchestrationOutboxPayloadSessionID                   = "session_id"
	OrchestrationOutboxPayloadStreamID                    = "stream_id"
	OrchestrationOutboxPayloadIdempotency                 = "idempotency_key"
	OrchestrationOutboxPayloadDispatchPrompt              = "dispatch_prompt"
	OrchestrationOutboxPayloadResumeSession               = "resume_session"
	OrchestrationOutboxPayloadResumeExcludeRunID          = "resume_exclude_run_id"
	OrchestrationOutboxPayloadResumeCheckpointRunID       = "resume_checkpoint_run_id"
	OrchestrationOutboxPayloadWaitingForInput             = "waiting_for_input"
	OrchestrationOutboxPayloadWakeDelayMinutes            = "wake_delay_minutes"
	OrchestrationOutboxPayloadWakeReason                  = "wake_reason"
	OrchestrationOutboxPayloadWakeFollowUpPrompt          = "wake_follow_up_prompt"
	OrchestrationOutboxPayloadWakeAgenda                  = "wake_agenda"
	OrchestrationOutboxPayloadSubtaskRequests             = "subtask_requests"
	OrchestrationOutboxPayloadSourceWatchRequests         = "source_watch_requests"
)
View Source
const (
	AgentRunUsageVersion                     = 2
	AgentRunUsageKeyVersion                  = "usage_version"
	AgentRunUsageKeyLLMInputTokens           = "llm_input_tokens"
	AgentRunUsageKeyLLMOutputTokens          = "llm_output_tokens"
	AgentRunUsageKeyLLMCacheCreationTokens   = "llm_cache_creation_input_tokens"
	AgentRunUsageKeyLLMCacheReadTokens       = "llm_cache_read_input_tokens"
	AgentRunUsageKeyLLMTotalTokens           = "llm_total_tokens"
	AgentRunUsageKeyTotalCostUSD             = "total_cost_usd"
	AgentRunUsageKeyBillingTotalCostMicrousd = "billing_total_cost_microusd"
	AgentRunUsageKeyModelUsage               = "model_usage"
	AgentRunUsageKeyLegacyBillingTotalTokens = "billing_total_tokens"
)
View Source
const (
	DefaultRunExecutionCPU    int64 = 2000    // 2 CPUs
	DefaultRunExecutionMemory int64 = 2 << 30 // 2 GiB
)

Default resource limits (applied when RunExecution.Resources is nil)

View Source
const (
	MaxRunExecutionCPU    int64 = 32000     // 32 CPUs
	MaxRunExecutionMemory int64 = 128 << 30 // 128 GiB
	MaxRunExecutionGPU    int   = 8         // 8 GPUs
)

Maximum resource limits for validation

View Source
const (
	// IPv4 - using 10.200.x.x to avoid common conflicts
	DefaultSubnet       = "10.200.0.0/24"
	DefaultSubnetPrefix = "10.200.0"
	DefaultGateway      = "10.200.0.1"
	DefaultPrefixLen    = 24

	// IPv6 - ULA prefix (fd00::/8 is for private use)
	DefaultSubnetIPv6    = "fd00:a1b2::/64"
	DefaultGatewayIPv6   = "fd00:a1b2::1"
	DefaultPrefixLenIPv6 = 64
)

Default network settings for container bridge (dual-stack IPv4/IPv6). TODO: Make configurable via worker config to avoid conflicts with:

  • K8s clusters using overlapping pod/service CIDR
  • Cloud VPCs with overlapping ranges
View Source
const (
	SandboxUserUID = 1000
	SandboxUserGID = 1000
)

Sandbox user identity These constants are used by:

  • pkg/worker/sandbox.go: sets OCI spec Process.User.UID/GID
  • pkg/worker/mount.go: passes --uid/--gid to FUSE mount

The Dockerfile.sandbox must create a user with matching uid/gid. The base_*_config.json files contain placeholder values that get overwritten.

View Source
const (
	TaskOutputMetadataArtifactKey           = "artifact_key"
	TaskOutputMetadataArtifactLabel         = "artifact_label"
	TaskOutputMetadataArtifactKind          = "artifact_kind"
	TaskOutputMetadataArtifactRole          = "artifact_role"
	TaskOutputMetadataViewSchemaMatch       = "view_schema_match"
	TaskOutputMetadataViewSchemaViewID      = "view_schema_view_id"
	TaskOutputMetadataViewSchemaSheetID     = "view_schema_sheet_id"
	TaskOutputMetadataViewSchemaComponentID = "view_schema_component_id"
	TaskOutputMetadataViewSchemaKeys        = "view_schema_keys"
	TaskOutputMetadataViewSchemaColumns     = "view_schema_columns"
	TaskOutputMetadataBlockerID             = "_blocker_id"
	TaskOutputMetadataBlockingKind          = "_blocking_kind"
	TaskOutputMetadataInputKind             = "_input_kind"
	TaskOutputMetadataWaitGroupID           = "_wait_group_id"
	TaskOutputMetadataApprovalUI            = "_approval_surface"

	TaskOutputArtifactRolePrimary    = "primary"
	TaskOutputArtifactRoleSupporting = "supporting"
	TaskOutputArtifactRoleIncidental = "incidental"

	TaskOutputBlockingKindApproval = "approval"
	TaskOutputBlockingKindInput    = "input"

	TaskOutputTypeEmail = "email"

	TaskOutputStatusActive    = "active"
	TaskOutputStatusPending   = "pending"
	TaskOutputStatusApproved  = "approved"
	TaskOutputStatusRejected  = "rejected"
	TaskOutputStatusCancelled = "cancelled"
)
View Source
const (
	ResolvedDataStatusOK           = "ok"
	ResolvedDataStatusEmpty        = "empty"
	ResolvedDataStatusBindingError = "binding_error"
	ResolvedDataStatusRequestError = "request_error"

	ComponentTypeTable  = "table"
	ComponentTypeAction = "action"
)
View Source
const (
	ViewContextEntryFeedback   = "feedback"
	ViewContextEntryNote       = "note"
	ViewContextEntryLink       = "link"
	ViewContextEntryCompaction = "compaction"
)
View Source
const (
	DirNameSkills  = "skills"
	DirNameSources = "sources"
	DirNameTools   = "tools"
	DirNameTasks   = "tasks"

	PathRoot    = "/"
	PathSkills  = "/skills"
	PathSources = "/sources"
	PathTools   = "/tools"
	PathTasks   = "/tasks"
)

Directory names and paths

View Source
const (
	MetaKeyProvider   = "provider"
	MetaKeyExternalID = "external_id"
	MetaKeyGuidance   = "guidance"
	MetaKeyHidden     = "hidden"
)

Metadata keys

View Source
const (
	// DefaultBundleDir is where sandbox bundles are created
	DefaultBundleDir = "/var/lib/airstore/bundles"

	// DefaultStateDir is where overlay state is stored (should be tmpfs)
	DefaultStateDir = "/mnt/overlay"

	// DefaultMountDir is where per-task FUSE mounts are created
	DefaultMountDir = "/tmp/airstore-mounts"

	// DefaultCLIBinary is the path to the CLI binary for mounting
	DefaultCLIBinary = "/usr/local/bin/airstore"

	// DefaultWorkerMount is where the worker's global FUSE mount lives
	DefaultWorkerMount = "/var/lib/airstore/fs"

	// ContainerWorkDir is the working directory inside containers
	ContainerWorkDir = "/workspace"
)

Worker filesystem path constants

View Source
const AgentExecAskOff = "off"
View Source
const AgentTaskKindAgentCommand = "agent_command"
View Source
const DefaultInteractiveIdleTimeout = 3 * time.Minute
View Source
const DefaultSandboxImage = "public.ecr.aws/n4e0e1y0/airstore-default-sandbox:0.1.15"

DefaultSandboxImage is the fallback image if not configured

View Source
const DefaultSourceWatchEventType = "fs.create"
View Source
const (
	SourceStatusFile = "README.md" // Status and description file at integration root
)

Source integration files

View Source
const (
	WorkerStateTTL = 5 * time.Minute // TTL for worker state (refreshed by heartbeat)
)

Worker TTL constant

Variables

View Source
var (
	ReservedFolders = map[string]struct{}{
		DirNameSkills:  {},
		DirNameSources: {},
		DirNameTools:   {},
		DirNameTasks:   {},
	}

	VirtualFolders = map[string]struct{}{
		DirNameSources: {},
		DirNameTools:   {},
		DirNameTasks:   {},
	}
)

Reserved folders cannot be deleted. Virtual folders are not S3-backed.

Functions

func CSVToList added in v0.1.71

func CSVToList(value string) []string

func CanonicalArtifactFamilyKey added in v0.1.110

func CanonicalArtifactFamilyKey(artifactKey, artifactKind, outputType string) string

func CanonicalArtifactLifecycleKey added in v0.1.110

func CanonicalArtifactLifecycleKey(artifactKey string) string

func ClassifyExecutionOutcome added in v0.1.75

func ClassifyExecutionOutcome(exitCode int, errText string) (AgentAttemptStatus, AgentRunStatus, *string)

ClassifyExecutionOutcome maps an execution exit code + error text into canonical attempt/run statuses used by orchestration.

func CostUSDToMicrousd added in v0.1.110

func CostUSDToMicrousd(value float64) int64

func CredentialsSupportSourceWrite added in v0.1.71

func CredentialsSupportSourceWrite(integration IntegrationName, creds *IntegrationCredentials) bool

func DefaultGatewayGRPCAddr added in v0.1.68

func DefaultGatewayGRPCAddr() string

func DefaultGatewayHTTPURL added in v0.1.68

func DefaultGatewayHTTPURL() string

func DetermineCredentialCapabilities added in v0.1.71

func DetermineCredentialCapabilities(integration IntegrationName, grantedScopes []string) []string

func GeneratePathID

func GeneratePathID(path string) string

GeneratePathID generates a unique ID for a path (for Redis keys)

func GenerateS3Key

func GenerateS3Key(workspace, path string) string

GenerateS3Key generates an S3 object key for a context file

func IsHiddenDotPath added in v0.1.66

func IsHiddenDotPath(p string) bool

IsHiddenDotPath returns true when any path segment starts with ".". Examples: "/.claude/settings.json", "skills/.cache/index.json".

func IsHookablePath added in v0.1.32

func IsHookablePath(p string) bool

IsHookablePath returns true if a path can have a hook attached. This is a basic check; the frontend also validates via external_id.

func IsPersonalScope

func IsPersonalScope(name IntegrationName) bool

func IsReservedFolder

func IsReservedFolder(name string) bool

func IsRootLevelSource added in v0.1.32

func IsRootLevelSource(p string) bool

IsRootLevelSource returns true if path is a root-level source like /Sources/gmail but not a nested path like /Sources/gmail/query. Comparison is case-insensitive to handle paths from different sources.

func IsSystemRootPath added in v0.1.32

func IsSystemRootPath(p string) bool

IsSystemRootPath returns true if the path is a system root directory. Comparison is case-insensitive to handle paths from different sources.

func IsVirtualFolder

func IsVirtualFolder(name string) bool

func JoinPath

func JoinPath(segments ...string) string

Path helpers

func ListContainsFold added in v0.1.71

func ListContainsFold(values []string, want string) bool

func ListToCSV added in v0.1.71

func ListToCSV(values []string) string

func NormalizeSkillPaths added in v0.1.73

func NormalizeSkillPaths(paths []string, legacy string) []string

func NormalizeSourceWatchEventTypes added in v0.1.110

func NormalizeSourceWatchEventTypes(eventTypes []string) []string

func OAuthWriteScopeHints added in v0.1.71

func OAuthWriteScopeHints(name IntegrationName) []string

func RequiresAuth

func RequiresAuth(name IntegrationName) bool

func ResolveGatewayGRPCPort added in v0.1.68

func ResolveGatewayGRPCPort(port int) int

func ResolveGatewayHTTPPort added in v0.1.68

func ResolveGatewayHTTPPort(port int) int

func SkillsPath

func SkillsPath(subpath string) string

func SourcePath

func SourcePath(subpath string) string

func SourceWatchRequestMergeKey added in v0.1.110

func SourceWatchRequestMergeKey(req *SourceWatchRequest) string

func SourceWatchRequestSignature added in v0.1.110

func SourceWatchRequestSignature(req *SourceWatchRequest) string

func SupportsCapability added in v0.1.71

func SupportsCapability(name IntegrationName, capability IntegrationCapability) bool

func SupportsSourceRead added in v0.1.71

func SupportsSourceRead(name IntegrationName) bool

func SupportsSourceWrite added in v0.1.71

func SupportsSourceWrite(name IntegrationName) bool

func SystemPaths added in v0.1.32

func SystemPaths() []string

SystemPaths returns all system root paths that cannot have hooks attached.

func ToolsPath

func ToolsPath(subpath string) string

func ValidateRunInputQueueMode added in v0.1.73

func ValidateRunInputQueueMode(mode AgentQueueMode) error

func WorkspaceBucketName

func WorkspaceBucketName(prefix, workspaceExternalId string) string

WorkspaceBucketName returns the S3 bucket name: {prefix}-{workspaceExternalId}

Types

type AgentAttemptStatus added in v0.1.60

type AgentAttemptStatus string
const (
	AgentAttemptStatusPending   AgentAttemptStatus = "pending"
	AgentAttemptStatusBlocked   AgentAttemptStatus = "blocked"
	AgentAttemptStatusRunning   AgentAttemptStatus = "running"
	AgentAttemptStatusOK        AgentAttemptStatus = "ok"
	AgentAttemptStatusError     AgentAttemptStatus = "error"
	AgentAttemptStatusTimeout   AgentAttemptStatus = "timeout"
	AgentAttemptStatusCancelled AgentAttemptStatus = "cancelled"
)

func AttemptStatusFromRunStatus added in v0.1.75

func AttemptStatusFromRunStatus(status AgentRunStatus, execAsk string, hasExecution bool) AgentAttemptStatus

func (AgentAttemptStatus) IsInFlight added in v0.1.60

func (s AgentAttemptStatus) IsInFlight() bool

func (AgentAttemptStatus) IsRetryable added in v0.1.75

func (s AgentAttemptStatus) IsRetryable() bool

type AgentExecutionInstance added in v0.1.60

type AgentExecutionInstance struct {
	ID                         string                       `json:"id" db:"id"`
	InstanceKey                string                       `json:"instance_key" db:"instance_key"`
	WorkspaceID                uint                         `json:"workspace_id" db:"workspace_id"`
	AgentID                    *string                      `json:"agent_id,omitempty" db:"agent_id"`
	Lane                       *string                      `json:"lane,omitempty" db:"lane"`
	ExecutionClassKey          string                       `json:"execution_class_key" db:"execution_class_key"`
	PoolName                   string                       `json:"pool_name" db:"pool_name"`
	Active                     bool                         `json:"active" db:"active"`
	Status                     AgentExecutionInstanceStatus `json:"status" db:"status"`
	FailedAttemptThreshold     int                          `json:"failed_attempt_threshold" db:"failed_attempt_threshold"`
	DesiredDispatchConcurrency int                          `json:"desired_dispatch_concurrency" db:"desired_dispatch_concurrency"`
	RunningAttempts            int                          `json:"running_attempts" db:"running_attempts"`
	PendingAttempts            int                          `json:"pending_attempts" db:"pending_attempts"`
	StoppingAttempts           int                          `json:"stopping_attempts" db:"stopping_attempts"`
	LastEventAt                *time.Time                   `json:"last_event_at,omitempty" db:"last_event_at"`
	CreatedAt                  time.Time                    `json:"created_at" db:"created_at"`
	UpdatedAt                  time.Time                    `json:"updated_at" db:"updated_at"`
}

type AgentExecutionInstanceStatus added in v0.1.60

type AgentExecutionInstanceStatus string
const (
	AgentExecutionInstanceStatusHealthy  AgentExecutionInstanceStatus = "healthy"
	AgentExecutionInstanceStatusWarning  AgentExecutionInstanceStatus = "warning"
	AgentExecutionInstanceStatusDegraded AgentExecutionInstanceStatus = "degraded"
)

type AgentProfile added in v0.1.60

type AgentProfile struct {
	ID            string         `json:"id" db:"id"`
	WorkspaceID   uint           `json:"workspace_id" db:"workspace_id"`
	AgentKey      string         `json:"agent_key" db:"agent_key"`
	Name          string         `json:"name" db:"name"`
	Role          string         `json:"role" db:"role"`
	MemoryScope   string         `json:"memory_scope" db:"memory_scope"`
	QualityScore  *float64       `json:"quality_score,omitempty" db:"quality_score"`
	CostBudgetUSD *float64       `json:"cost_budget_usd,omitempty" db:"cost_budget_usd"`
	ConfigJSON    map[string]any `json:"config_json" db:"-"`
	Active        bool           `json:"active" db:"active"`
	CreatedAt     time.Time      `json:"created_at" db:"created_at"`
	UpdatedAt     time.Time      `json:"updated_at" db:"updated_at"`
}

type AgentQueueMode added in v0.1.60

type AgentQueueMode string
const (
	AgentQueueModeSteer        AgentQueueMode = "steer"
	AgentQueueModeSteerBacklog AgentQueueMode = "steer-backlog"
	AgentQueueModeFollowup     AgentQueueMode = "followup"
	AgentQueueModeInterrupt    AgentQueueMode = "interrupt"
	AgentQueueModeQueue        AgentQueueMode = "queue"
)
const DefaultRunInputQueueMode AgentQueueMode = AgentQueueModeFollowup

func NormalizeRunInputQueueMode added in v0.1.73

func NormalizeRunInputQueueMode(mode AgentQueueMode) AgentQueueMode

type AgentRun added in v0.1.60

type AgentRun struct {
	ID                string         `json:"id" db:"id"`
	WorkspaceID       uint           `json:"workspace_id" db:"workspace_id"`
	AgentID           *string        `json:"agent_id,omitempty" db:"agent_id"`
	CreatedByMemberID *uint          `json:"created_by_member_id,omitempty" db:"created_by_member_id"`
	OriginTaskID      string         `json:"origin_task_id" db:"origin_task_id"`
	HookID            *uint          `json:"hook_id,omitempty" db:"hook_id"`
	Status            AgentRunStatus `json:"status" db:"status"`
	SessionID         string         `json:"session_id" db:"session_id"`
	SessionKey        *string        `json:"session_key,omitempty" db:"session_key"`
	Provider          *string        `json:"provider,omitempty" db:"provider"`
	Model             *string        `json:"model,omitempty" db:"model"`
	ExecHost          string         `json:"exec_host" db:"exec_host"`
	ExecSecurity      string         `json:"exec_security" db:"exec_security"`
	ExecAsk           string         `json:"exec_ask" db:"exec_ask"`
	RuntimeType       string         `json:"runtime_type" db:"runtime_type"`
	WorkspaceAccess   string         `json:"workspace_access" db:"workspace_access"`
	NetworkEnabled    bool           `json:"network_enabled" db:"network_enabled"`
	Interactive       bool           `json:"interactive" db:"interactive"`
	TimeoutMs         int            `json:"timeout_ms" db:"timeout_ms"`
	StartedAt         *time.Time     `json:"started_at,omitempty" db:"started_at"`
	EndedAt           *time.Time     `json:"ended_at,omitempty" db:"ended_at"`
	ClaimedByWorker   *string        `json:"claimed_by_worker_id,omitempty" db:"claimed_by_worker_id"`
	ClaimHeartbeatAt  *time.Time     `json:"claim_heartbeat_at,omitempty" db:"claim_heartbeat_at"`
	ClaimExpiresAt    *time.Time     `json:"claim_expires_at,omitempty" db:"claim_expires_at"`
	Error             *string        `json:"error,omitempty" db:"error"`
	SnapshotTS        int64          `json:"snapshot_ts" db:"snapshot_ts"`
	CostUSD           float64        `json:"cost_usd" db:"cost_usd"`
	UsageJSON         map[string]any `json:"usage_json" db:"-"`
	DeliveryJSON      map[string]any `json:"delivery_json" db:"-"`
	CreatedAt         time.Time      `json:"created_at" db:"created_at"`
	UpdatedAt         time.Time      `json:"updated_at" db:"updated_at"`
}

type AgentRunAttempt added in v0.1.60

type AgentRunAttempt struct {
	ID              string             `json:"id" db:"id"`
	RunID           string             `json:"run_id" db:"run_id"`
	AttemptNo       int                `json:"attempt_no" db:"attempt_no"`
	Status          AgentAttemptStatus `json:"status" db:"status"`
	Strategy        string             `json:"strategy" db:"strategy"`
	Provider        *string            `json:"provider,omitempty" db:"provider"`
	Model           *string            `json:"model,omitempty" db:"model"`
	ExecHost        string             `json:"exec_host" db:"exec_host"`
	ExecSecurity    string             `json:"exec_security" db:"exec_security"`
	ExecAsk         string             `json:"exec_ask" db:"exec_ask"`
	RuntimeType     string             `json:"runtime_type" db:"runtime_type"`
	WorkspaceAccess string             `json:"workspace_access" db:"workspace_access"`
	NetworkEnabled  bool               `json:"network_enabled" db:"network_enabled"`
	Interactive     bool               `json:"interactive" db:"interactive"`
	ExecutionID     *string            `json:"execution_id,omitempty" db:"execution_task_external_id"`
	StartedAt       *time.Time         `json:"started_at,omitempty" db:"started_at"`
	EndedAt         *time.Time         `json:"ended_at,omitempty" db:"ended_at"`
	ExitCode        *int               `json:"exit_code,omitempty" db:"exit_code"`
	Error           *string            `json:"error,omitempty" db:"error"`
	CreatedAt       time.Time          `json:"created_at" db:"created_at"`
	UpdatedAt       time.Time          `json:"updated_at" db:"updated_at"`
}

func (*AgentRunAttempt) IsActive added in v0.1.96

func (a *AgentRunAttempt) IsActive() bool

type AgentRunEventType added in v0.1.60

type AgentRunEventType string
const (
	// External run-event stream events (redis/s2).
	AgentRunEventAccepted                AgentRunEventType = "accepted"
	AgentRunEventInterrupted             AgentRunEventType = "interrupted"
	AgentRunEventInputSteered            AgentRunEventType = "input_steered"
	AgentRunEventInputDispatched         AgentRunEventType = "input_dispatched"
	AgentRunEventSteerFallbackDispatched AgentRunEventType = "steer_fallback_dispatched"

	// Snapshot payload event markers.
	AgentRunEventStartRejectedTerminalRun AgentRunEventType = "start_rejected_terminal_run"
	AgentRunEventStarted                  AgentRunEventType = "started"
	AgentRunEventAttemptSuperseded        AgentRunEventType = "attempt_superseded"
	AgentRunEventOrphanRecovered          AgentRunEventType = "orphan_recovered"
	AgentRunEventRetryScheduled           AgentRunEventType = "retry_scheduled"
	AgentRunEventFinished                 AgentRunEventType = "finished"
)

type AgentRunListFilter added in v0.1.66

type AgentRunListFilter struct {
	AgentID       *string
	TaskID        *string
	Statuses      []AgentRunStatus
	SessionID     *string
	CreatedAfter  *time.Time
	CreatedBefore *time.Time
	UpdatedAfter  *time.Time
	UpdatedBefore *time.Time
	Limit         int
	Offset        int
}

type AgentRunSnapshot added in v0.1.60

type AgentRunSnapshot struct {
	ID          int64          `json:"id" db:"id"`
	RunID       string         `json:"run_id" db:"run_id"`
	Seq         int64          `json:"seq" db:"seq"`
	Status      AgentRunStatus `json:"status" db:"status"`
	StartedAtMs *int64         `json:"started_at_ms,omitempty" db:"started_at_ms"`
	EndedAtMs   *int64         `json:"ended_at_ms,omitempty" db:"ended_at_ms"`
	Error       *string        `json:"error,omitempty" db:"error"`
	TS          int64          `json:"ts" db:"ts"`
	PayloadJSON map[string]any `json:"payload_json" db:"-"`
	CreatedAt   time.Time      `json:"created_at" db:"created_at"`
}

type AgentRunStatus added in v0.1.60

type AgentRunStatus string
const (
	AgentRunStatusAccepted  AgentRunStatus = "accepted"
	AgentRunStatusRunning   AgentRunStatus = "running"
	AgentRunStatusOK        AgentRunStatus = "ok"
	AgentRunStatusError     AgentRunStatus = "error"
	AgentRunStatusTimeout   AgentRunStatus = "timeout"
	AgentRunStatusCancelled AgentRunStatus = "cancelled"
)

func RunStatusFromAttemptStatus added in v0.1.75

func RunStatusFromAttemptStatus(status AgentAttemptStatus) AgentRunStatus

func (AgentRunStatus) IsActive added in v0.1.60

func (s AgentRunStatus) IsActive() bool

func (AgentRunStatus) IsSteerEligible added in v0.1.60

func (s AgentRunStatus) IsSteerEligible() bool

func (AgentRunStatus) IsTerminal added in v0.1.60

func (s AgentRunStatus) IsTerminal() bool

type AgentStats added in v0.1.96

type AgentStats struct {
	Total          int            `json:"total"`
	ByState        map[string]int `json:"by_state"`
	AvgRunSec      *float64       `json:"avg_run_sec,omitempty"`
	QualityScore   *float64       `json:"quality_score,omitempty"`
	TotalCostUSD   float64        `json:"total_cost_usd"`
	RunningCount   int            `json:"running_count"`
	CompletedCount int            `json:"completed_count"`
	FailedCount    int            `json:"failed_count"`
}

type AgentTask added in v0.1.60

type AgentTask struct {
	ID               string                `json:"id" db:"id"`
	WorkspaceID      uint                  `json:"workspace_id" db:"workspace_id"`
	AgentID          *string               `json:"agent_id,omitempty" db:"agent_id"`
	AgentName        string                `json:"agent_name,omitempty" db:"-"`
	QueueMode        AgentQueueMode        `json:"queue_mode" db:"queue_mode"`
	State            AgentTaskState        `json:"state" db:"state"`
	InputKind        InputKind             `json:"input_kind,omitempty" db:"input_kind"`
	WaitingSummary   *string               `json:"waiting_summary,omitempty" db:"waiting_summary"`
	IdempotencyKey   string                `json:"idempotency_key" db:"idempotency_key"`
	PayloadJSON      map[string]any        `json:"payload_json" db:"-"`
	RoutingJSON      map[string]any        `json:"routing_json" db:"-"`
	ParentTaskID     *string               `json:"parent_task_id,omitempty" db:"parent_envelope_id"`
	TargetRunID      *string               `json:"target_run_id,omitempty" db:"target_run_id"`
	CurrentBlockerID *string               `json:"current_blocker_id,omitempty" db:"current_blocker_id"`
	CurrentBlocker   *TaskBlocker          `json:"current_blocker,omitempty" db:"-"`
	AcceptedAt       time.Time             `json:"accepted_at" db:"accepted_at"`
	QueuedAt         *time.Time            `json:"queued_at,omitempty" db:"queued_at"`
	DispatchedAt     *time.Time            `json:"dispatched_at,omitempty" db:"dispatched_at"`
	Deadline         *time.Time            `json:"deadline,omitempty" db:"deadline"`
	DroppedReason    *string               `json:"dropped_reason,omitempty" db:"dropped_reason"`
	Priority         string                `json:"priority" db:"priority"`
	BudgetUSD        *float64              `json:"budget_usd,omitempty" db:"budget_usd"`
	CostUSD          float64               `json:"cost_usd" db:"cost_usd"`
	ArchivedAt       *time.Time            `json:"archived_at,omitempty" db:"archived_at"`
	WakeAt           *time.Time            `json:"wake_at,omitempty" db:"wake_at"`
	WakeReason       *string               `json:"wake_reason,omitempty" db:"wake_reason"`
	WakeAgenda       []*TaskWakeAgendaItem `json:"wake_agenda,omitempty" db:"-"`
	WakeCount        int                   `json:"wake_count,omitempty" db:"wake_count"`
	CreatedAt        time.Time             `json:"created_at" db:"created_at"`
	UpdatedAt        time.Time             `json:"updated_at" db:"updated_at"`
}

AgentTask is the high-level orchestration task (agent -> task -> run).

type AgentTaskListFilter added in v0.1.66

type AgentTaskListFilter struct {
	AgentID         *string
	States          []AgentTaskState
	CreatedAfter    *time.Time
	CreatedBefore   *time.Time
	IncludeArchived bool
	Limit           int
	Offset          int
}

type AgentTaskPriority added in v0.1.96

type AgentTaskPriority string
const (
	AgentTaskPriorityLow    AgentTaskPriority = "low"
	AgentTaskPriorityNormal AgentTaskPriority = "normal"
	AgentTaskPriorityHigh   AgentTaskPriority = "high"
	AgentTaskPriorityUrgent AgentTaskPriority = "urgent"
)

func (AgentTaskPriority) IsValid added in v0.1.96

func (p AgentTaskPriority) IsValid() bool

type AgentTaskState added in v0.1.60

type AgentTaskState string
const (
	AgentTaskStateQueued    AgentTaskState = "queued"
	AgentTaskStateRunning   AgentTaskState = "running"
	AgentTaskStateWaiting   AgentTaskState = "waiting"
	AgentTaskStateSleeping  AgentTaskState = "sleeping"
	AgentTaskStateDone      AgentTaskState = "done"
	AgentTaskStateError     AgentTaskState = "error"
	AgentTaskStateDropped   AgentTaskState = "dropped"
	AgentTaskStateCancelled AgentTaskState = "cancelled"
)

func TaskTerminalStateForRun added in v0.1.75

func TaskTerminalStateForRun(runStatus AgentRunStatus) AgentTaskState

func (AgentTaskState) IsDispatchable added in v0.1.66

func (s AgentTaskState) IsDispatchable() bool

func (AgentTaskState) IsRetryable added in v0.1.131

func (s AgentTaskState) IsRetryable() bool

IsRetryable returns true for terminal states that can be woken back to queued — everything except done (which represents completed work).

func (AgentTaskState) IsTerminal added in v0.1.66

func (s AgentTaskState) IsTerminal() bool

type AppConfig

type AppConfig struct {
	Mode        string            `key:"mode" json:"mode"` // "local" or "remote"
	DebugMode   bool              `key:"debugMode" json:"debug_mode"`
	PrettyLogs  bool              `key:"prettyLogs" json:"pretty_logs"`
	ClusterName string            `key:"clusterName" json:"cluster_name"`
	Database    DatabaseConfig    `key:"database" json:"database"`
	Image       ImageConfig       `key:"image" json:"image"`
	Sandbox     SandboxSettings   `key:"sandbox" json:"sandbox"`
	Filesystem  FilesystemConfig  `key:"filesystem" json:"filesystem"`
	Gateway     GatewayConfig     `key:"gateway" json:"gateway"`
	Scheduler   SchedulerConfig   `key:"scheduler" json:"scheduler"`
	Tools       ToolsConfig       `key:"tools" json:"tools"`
	Sources     SourcesConfig     `key:"sources" json:"sources"`         // Builtin source provider credentials
	OAuth       IntegrationOAuth  `key:"oauth" json:"oauth"`             // OAuth for workspace integrations (gmail, gdrive)
	Streams     StreamsConfig     `key:"streams" json:"streams"`         // S2 stream configuration for task logs
	Models      ModelsConfig      `key:"models" json:"models"`           // LLM provider API keys (BAML inference, sandbox tasks)
	Compression CompressionConfig `key:"compression" json:"compression"` // Context compression middleware
	Channels    ChannelsConfig    `key:"channels" json:"channels"`       // External channel provider credentials
	View        ViewConfig        `key:"view" json:"view"`               // View sync thresholds and settings
}

AppConfig is the root configuration for the airstore gateway

func (*AppConfig) AnthropicAPIKey added in v0.1.43

func (c *AppConfig) AnthropicAPIKey() string

func (*AppConfig) CerebrasAPIKey added in v0.1.43

func (c *AppConfig) CerebrasAPIKey() string

CerebrasAPIKey returns the Cerebras API key.

func (*AppConfig) IsLocalMode

func (c *AppConfig) IsLocalMode() bool

IsLocalMode returns true if running in local mode (no Redis/Postgres)

func (*AppConfig) KernelAPIKey added in v0.1.60

func (c *AppConfig) KernelAPIKey() string

func (*AppConfig) OpenAIAPIKey added in v0.1.125

func (c *AppConfig) OpenAIAPIKey() string

OpenAIAPIKey returns the OpenAI API key (used for embeddings).

type ApprovalPolicy added in v0.1.131

type ApprovalPolicy struct {
	Key string
}

ApprovalPolicy encapsulates a per-view approval policy and provides deterministic methods for deciding whether a blocker should be skipped.

func NewApprovalPolicy added in v0.1.131

func NewApprovalPolicy(key string) ApprovalPolicy

func (ApprovalPolicy) AllowsWrite added in v0.1.131

func (p ApprovalPolicy) AllowsWrite(tool IntegrationName) bool

AllowsWrite returns true if the policy permits a write command on the given tool without requiring user approval.

func (ApprovalPolicy) IsSet added in v0.1.131

func (p ApprovalPolicy) IsSet() bool

func (ApprovalPolicy) String added in v0.1.131

func (p ApprovalPolicy) String() string

type AuthInfo

type AuthInfo struct {
	TokenType TokenType
	TokenId   uint   // Internal ID of the token used for authentication
	TenantId  string // Set when the token has a tenant_id (organization tokens)
	Workspace *WorkspaceInfo
	Member    *MemberInfo
	Worker    *WorkerInfo
}

AuthInfo contains identity information for authenticated requests.

func (*AuthInfo) CanAccessPool

func (a *AuthInfo) CanAccessPool(poolName string) bool

func (*AuthInfo) CanWrite

func (a *AuthInfo) CanWrite() bool

func (*AuthInfo) HasWorkspaceAccess

func (a *AuthInfo) HasWorkspaceAccess(workspaceExtId string) bool

func (*AuthInfo) IsAdmin

func (a *AuthInfo) IsAdmin() bool

func (*AuthInfo) IsClusterAdmin

func (a *AuthInfo) IsClusterAdmin() bool

func (*AuthInfo) IsOrganization added in v0.1.39

func (a *AuthInfo) IsOrganization() bool

func (*AuthInfo) IsWorker

func (a *AuthInfo) IsWorker() bool

func (*AuthInfo) IsWorkspaceMember

func (a *AuthInfo) IsWorkspaceMember() bool

func (*AuthInfo) IsWorkspaceService added in v0.1.32

func (a *AuthInfo) IsWorkspaceService() bool

type CORSConfig

type CORSConfig struct {
	AllowedOrigins []string `key:"allowOrigins" json:"allow_origins"`
	AllowedMethods []string `key:"allowMethods" json:"allow_methods"`
	AllowedHeaders []string `key:"allowHeaders" json:"allow_headers"`
}

type ChannelAgentMailConfig added in v0.1.96

type ChannelAgentMailConfig struct {
	APIKey     string `key:"apiKey" json:"api_key"`
	BaseURL    string `key:"baseUrl" json:"base_url"`
	Domain     string `key:"domain" json:"domain"`
	WebhookURL string `key:"webhookUrl" json:"webhook_url"` // public URL for inbound email webhooks
}

type ChannelBinding added in v0.1.96

type ChannelBinding struct {
	ID          int64          `json:"id" db:"id"`
	WorkspaceID uint           `json:"workspace_id" db:"workspace_id"`
	AgentID     *string        `json:"agent_id" db:"agent_id"`
	ChannelType string         `json:"channel_type" db:"channel_type"`
	Address     string         `json:"address" db:"address"`
	ConfigJSON  map[string]any `json:"config_json" db:"-"`
	Active      bool           `json:"active" db:"active"`
	CreatedAt   time.Time      `json:"created_at" db:"created_at"`
	UpdatedAt   time.Time      `json:"updated_at" db:"updated_at"`
}

type ChannelsConfig added in v0.1.96

type ChannelsConfig struct {
	AgentMail ChannelAgentMailConfig `key:"agentMail" json:"agent_mail"`
}

ChannelsConfig configures inbound/outbound messaging channels.

type ColumnMeta added in v0.1.103

type ColumnMeta struct {
	Key     string         `json:"key"`
	Label   string         `json:"label,omitempty"`
	Type    string         `json:"type"`
	Format  string         `json:"format,omitempty"`
	Options []StatusOption `json:"options,omitempty"`
	Frozen  bool           `json:"frozen,omitempty"`
	Hidden  bool           `json:"hidden,omitempty"`
}

type ComponentSpec added in v0.1.103

type ComponentSpec struct {
	ID         string         `json:"id"`
	Type       string         `json:"type"`
	Title      string         `json:"title"`
	Section    string         `json:"section,omitempty"`
	Position   Position       `json:"position"`
	DataSource *DataSource    `json:"dataSource,omitempty"`
	Config     map[string]any `json:"config,omitempty"`
}

func (ComponentSpec) IsTable added in v0.1.103

func (c ComponentSpec) IsTable() bool

func (ComponentSpec) SchemaColumns added in v0.1.131

func (c ComponentSpec) SchemaColumns() []ViewOutputSchemaColumn

SchemaColumns derives the output schema columns from the component's data source transforms and config column metadata.

type CompressionConfig added in v0.1.43

type CompressionConfig struct {
	Strategy             string        `key:"strategy" json:"strategy"`                            // "strip" or "passthrough"
	CacheEnabled         bool          `key:"cacheEnabled" json:"cache_enabled"`                   // enable Redis compressed content cache (default false)
	TokenThreshold       int           `key:"tokenThreshold" json:"token_threshold"`               // skip compression if below this many tokens
	MaxContentBytes      int           `key:"maxContentBytes" json:"max_content_bytes"`            // skip if content exceeds this size
	TokenEncoding        string        `key:"tokenEncoding" json:"token_encoding"`                 // tiktoken encoding, default "cl100k_base"
	Timeout              time.Duration `key:"timeout" json:"timeout"`                              // max compression time; 0 = strategy default
	ContentCacheMaxBytes int64         `key:"contentCacheMaxBytes" json:"content_cache_max_bytes"` // per-workspace Redis budget; default 10MB (cache only)
	ContentCacheTTL      time.Duration `key:"contentCacheTTL" json:"content_cache_ttl"`            // per-entry TTL; default 5m (cache only)
}

type ContainerRuntime

type ContainerRuntime string
const (
	ContainerRuntimeRunc   ContainerRuntime = "runc"
	ContainerRuntimeGvisor ContainerRuntime = "gvisor"
)

func (ContainerRuntime) String

func (r ContainerRuntime) String() string

type CreateWorkspaceToolRequest

type CreateWorkspaceToolRequest struct {
	Name         string           `json:"name"`
	ProviderType string           `json:"provider_type"` // "mcp"
	MCP          *MCPServerConfig `json:"mcp,omitempty"`
}

CreateWorkspaceToolRequest is the API request to create a workspace tool

type CurrentRunTaskStateUpdate added in v0.1.110

type CurrentRunTaskStateUpdate struct {
	TaskID        string
	ExpectedRunID string
	State         AgentTaskState
	DroppedReason *string
	TargetRunID   *string
}

type DataSource added in v0.1.103

type DataSource struct {
	AgentID     string          `json:"agent_id,omitempty"`
	AgentIDs    []string        `json:"agent_ids,omitempty"`
	OutputType  string          `json:"output_type,omitempty"`
	ArtifactKey string          `json:"artifact_key,omitempty"`
	TimeRange   string          `json:"time_range,omitempty"`
	Statuses    []string        `json:"statuses,omitempty"`
	Transform   []TransformRule `json:"transform,omitempty"`
}

type DatabaseConfig

type DatabaseConfig struct {
	Redis    RedisConfig    `key:"redis" json:"redis"`
	Postgres PostgresConfig `key:"postgres" json:"postgres"`
	Mongo    MongoConfig    `key:"mongo" json:"mongo"`
}

type DirEntry

type DirEntry struct {
	Name   string `json:"name"`
	Mode   uint32 `json:"mode"`
	Size   int64  `json:"size,omitempty"`
	Mtime  int64  `json:"mtime,omitempty"` // Unix timestamp
	IsLink bool   `json:"is_link,omitempty"`
}

DirEntry represents an entry in a directory listing

func (*DirEntry) IsDir

func (e *DirEntry) IsDir() bool

IsDir returns true if this entry is a directory

type DirMeta

type DirMeta struct {
	Path     string    `json:"path"`
	Mode     uint32    `json:"mode"`
	Uid      uint32    `json:"uid"`
	Gid      uint32    `json:"gid"`
	Mtime    time.Time `json:"mtime"`
	Children []string  `json:"children"` // Entry names in this directory
}

DirMeta holds metadata for a directory

type ErrAgentProfileNotFound added in v0.1.60

type ErrAgentProfileNotFound struct {
	ID string
}

func (*ErrAgentProfileNotFound) Error added in v0.1.60

func (e *ErrAgentProfileNotFound) Error() string

type ErrAgentRunAttemptNotFound added in v0.1.60

type ErrAgentRunAttemptNotFound struct {
	ID string
}

func (*ErrAgentRunAttemptNotFound) Error added in v0.1.60

type ErrAgentRunNotFound added in v0.1.60

type ErrAgentRunNotFound struct {
	ID string
}

func (*ErrAgentRunNotFound) Error added in v0.1.60

func (e *ErrAgentRunNotFound) Error() string

type ErrAgentTaskNotFound added in v0.1.60

type ErrAgentTaskNotFound struct {
	ID string
}

func (*ErrAgentTaskNotFound) Error added in v0.1.60

func (e *ErrAgentTaskNotFound) Error() string

type ErrHookNotFound added in v0.1.28

type ErrHookNotFound struct {
	ExternalId string
}

ErrHookNotFound is returned when a hook cannot be found.

func (*ErrHookNotFound) Error added in v0.1.28

func (e *ErrHookNotFound) Error() string

type ErrInvalidTaskInput added in v0.1.107

type ErrInvalidTaskInput struct {
	Message string
}

TaskOutput is a structured output produced by an agent during a task.

func (*ErrInvalidTaskInput) Error added in v0.1.107

func (e *ErrInvalidTaskInput) Error() string

type ErrRunExecutionNotFound added in v0.1.60

type ErrRunExecutionNotFound struct {
	ExternalId string
}

ErrRunExecutionNotFound is returned when a run execution cannot be found

func (*ErrRunExecutionNotFound) Error added in v0.1.60

func (e *ErrRunExecutionNotFound) Error() string

type ErrScheduledTaskNotFound added in v0.1.89

type ErrScheduledTaskNotFound struct {
	ExternalID string
}

func (*ErrScheduledTaskNotFound) Error added in v0.1.89

func (e *ErrScheduledTaskNotFound) Error() string

type ErrTaskBlockerNotFound added in v0.1.110

type ErrTaskBlockerNotFound struct {
	ID string
}

func (*ErrTaskBlockerNotFound) Error added in v0.1.110

func (e *ErrTaskBlockerNotFound) Error() string

type ErrTaskNotArchivable added in v0.1.96

type ErrTaskNotArchivable struct {
	ID    string
	State AgentTaskState
}

func (*ErrTaskNotArchivable) Error added in v0.1.96

func (e *ErrTaskNotArchivable) Error() string

type ErrTaskNotCancellable added in v0.1.96

type ErrTaskNotCancellable struct {
	ID    string
	State AgentTaskState
}

func (*ErrTaskNotCancellable) Error added in v0.1.96

func (e *ErrTaskNotCancellable) Error() string

type ErrTaskNotRetryable added in v0.1.130

type ErrTaskNotRetryable struct {
	ID    string
	State AgentTaskState
}

func (*ErrTaskNotRetryable) Error added in v0.1.130

func (e *ErrTaskNotRetryable) Error() string

type ErrTaskOutputConflict added in v0.1.107

type ErrTaskOutputConflict struct {
	ID                  string
	WorkspaceID         uint
	TaskID              string
	ExistingWorkspaceID uint
	ExistingTaskID      string
}

func (*ErrTaskOutputConflict) Error added in v0.1.107

func (e *ErrTaskOutputConflict) Error() string

type ErrTaskOutputNotFound added in v0.1.96

type ErrTaskOutputNotFound struct {
	ID string
}

func (*ErrTaskOutputNotFound) Error added in v0.1.96

func (e *ErrTaskOutputNotFound) Error() string

type ErrWorkerNotFound

type ErrWorkerNotFound struct {
	WorkerId string
}

ErrWorkerNotFound is returned when a worker is not found

func (*ErrWorkerNotFound) Error

func (e *ErrWorkerNotFound) Error() string

func (*ErrWorkerNotFound) From

func (e *ErrWorkerNotFound) From(err error) bool

From checks if the given error is an ErrWorkerNotFound

type ErrWorkerPoolNotFound

type ErrWorkerPoolNotFound struct {
	PoolName string
}

ErrWorkerPoolNotFound is returned when a worker pool is not found

func (*ErrWorkerPoolNotFound) Error

func (e *ErrWorkerPoolNotFound) Error() string

type ErrWorkspaceNotFound

type ErrWorkspaceNotFound struct {
	ExternalId string
	Name       string
}

ErrWorkspaceNotFound is returned when a workspace cannot be found

func (*ErrWorkspaceNotFound) Error

func (e *ErrWorkspaceNotFound) Error() string

type ErrWorkspaceToolExists

type ErrWorkspaceToolExists struct {
	Name string
}

ErrWorkspaceToolExists is returned when a workspace tool already exists

func (*ErrWorkspaceToolExists) Error

func (e *ErrWorkspaceToolExists) Error() string

type ErrWorkspaceToolNotFound

type ErrWorkspaceToolNotFound struct {
	Name       string
	ExternalId string
}

ErrWorkspaceToolNotFound is returned when a workspace tool cannot be found

func (*ErrWorkspaceToolNotFound) Error

func (e *ErrWorkspaceToolNotFound) Error() string

type FileMeta

type FileMeta struct {
	Path    string    `json:"path"`
	Size    int64     `json:"size"`
	Mode    uint32    `json:"mode"`
	Uid     uint32    `json:"uid"`
	Gid     uint32    `json:"gid"`
	Mtime   time.Time `json:"mtime"`
	S3Key   string    `json:"s3_key,omitempty"`  // Object storage key (for context files)
	Symlink string    `json:"symlink,omitempty"` // Target path if symlink (empty otherwise)
}

FileMeta holds metadata for a file or symlink

func (f *FileMeta) IsSymlink() bool

IsSymlink returns true if this file metadata represents a symlink

type FilesystemConfig

type FilesystemConfig struct {
	MountPoint       string                 `key:"mountPoint" json:"mount_point"`
	Verbose          bool                   `key:"verbose" json:"verbose"`
	WorkspaceStorage WorkspaceStorageConfig `key:"workspaceStorage" json:"workspace_storage"`
}

type FilesystemQuery

type FilesystemQuery struct {
	Id                 uint                     `json:"id" db:"id"`
	ExternalId         string                   `json:"external_id" db:"external_id"`
	WorkspaceId        uint                     `json:"workspace_id" db:"workspace_id"`
	CredentialMemberID *uint                    `json:"credential_member_id,omitempty" db:"credential_member_id"`
	SystemManaged      bool                     `json:"system_managed" db:"system_managed"`
	Lifecycle          FilesystemQueryLifecycle `json:"lifecycle" db:"lifecycle"`
	OwnerTaskID        *string                  `json:"owner_task_id,omitempty" db:"owner_task_id"`
	OwnerRunID         *string                  `json:"owner_run_id,omitempty" db:"owner_run_id"`
	Integration        string                   `json:"integration" db:"integration"`         // "gmail", "gdrive", "notion"
	Path               string                   `json:"path" db:"path"`                       // Full path: "/sources/gmail/unread-emails"
	Name               string                   `json:"name" db:"name"`                       // Folder/file name: "unread-emails"
	QuerySpec          string                   `json:"query_spec" db:"query_spec"`           // JSON query params
	Guidance           string                   `json:"guidance" db:"guidance"`               // Optional user-provided context (smart mode)
	OutputFormat       ViewOutputFormat         `json:"output_format" db:"output_format"`     // "folder" or "file"
	FileExt            string                   `json:"file_ext" db:"file_ext"`               // For files: ".json", ".md"
	FilenameFormat     string                   `json:"filename_format" db:"filename_format"` // Template for result filenames
	CacheTTL           int                      `json:"cache_ttl" db:"cache_ttl"`             // Seconds, 0 = always live
	Mode               ViewMode                 `json:"mode" db:"mode"`                       // "smart" or "query"
	Filter             string                   `json:"filter,omitempty" db:"filter"`         // JSON structured filter (query mode, round-trip editing)
	CreatedAt          time.Time                `json:"created_at" db:"created_at"`
	UpdatedAt          time.Time                `json:"updated_at" db:"updated_at"`
	LastExecuted       *time.Time               `json:"last_executed,omitempty" db:"last_executed"`
	BaselineItemIDs    []string                 `json:"baseline_item_ids,omitempty" db:"baseline_item_ids"`
}

FilesystemQuery represents a source view that materializes as filesystem content. A view can be created via LLM inference (smart mode) or structured filters (query mode). Reading the folder executes the view's query against the source provider.

func (*FilesystemQuery) IsFile

func (q *FilesystemQuery) IsFile() bool

IsFile returns true if results materialize as a single file.

func (*FilesystemQuery) IsFolder

func (q *FilesystemQuery) IsFolder() bool

IsFolder returns true if results materialize as a directory.

func (*FilesystemQuery) IsLive

func (q *FilesystemQuery) IsLive() bool

IsLive returns true if the query should be re-executed on every access.

func (*FilesystemQuery) IsTaskFollowUp added in v0.1.110

func (q *FilesystemQuery) IsTaskFollowUp() bool

func (*FilesystemQuery) NormalizeOwnership added in v0.1.110

func (q *FilesystemQuery) NormalizeOwnership()

type FilesystemQueryLifecycle added in v0.1.110

type FilesystemQueryLifecycle string
const (
	FilesystemQueryLifecyclePersistent   FilesystemQueryLifecycle = "persistent"
	FilesystemQueryLifecycleTaskFollowUp FilesystemQueryLifecycle = "task_followup"
)

func NormalizeFilesystemQueryLifecycle added in v0.1.110

func NormalizeFilesystemQueryLifecycle(lifecycle FilesystemQueryLifecycle) FilesystemQueryLifecycle

type GRPCConfig

type GRPCConfig struct {
	Port           int `key:"port" json:"port"`
	MaxRecvMsgSize int `key:"maxRecvMsgSize" json:"max_recv_msg_size"`
	MaxSendMsgSize int `key:"maxSendMsgSize" json:"max_send_msg_size"`
}

type GatewayConfig

type GatewayConfig struct {
	GRPC            GRPCConfig    `key:"grpc" json:"grpc"`
	HTTP            HTTPConfig    `key:"http" json:"http"`
	ShutdownTimeout time.Duration `key:"shutdownTimeout" json:"shutdown_timeout"`
	AuthToken       string        `key:"authToken" json:"auth_token"`
}

type GitHubConfig

type GitHubConfig struct {
	Enabled bool `key:"enabled" json:"enabled"`
}

GitHubConfig configures GitHub integration

type HTTPConfig

type HTTPConfig struct {
	Host             string     `key:"host" json:"host"`
	Port             int        `key:"port" json:"port"`
	EnablePrettyLogs bool       `key:"enablePrettyLogs" json:"enable_pretty_logs"`
	CORS             CORSConfig `key:"cors" json:"cors"`
}

type Hook added in v0.1.28

type Hook struct {
	Id                uint             `json:"id" db:"id"`
	ExternalId        string           `json:"external_id" db:"external_id"`
	WorkspaceId       uint             `json:"workspace_id" db:"workspace_id"`
	Path              string           `json:"path" db:"path"`
	Prompt            string           `json:"prompt" db:"prompt"`
	SkillPath         string           `json:"skill_path" db:"skill_path"`
	SkillPaths        []string         `json:"skill_paths,omitempty" db:"skill_paths"`
	AgentId           *string          `json:"agent_id,omitempty" db:"agent_id"`
	AgentKey          string           `json:"agent_key,omitempty" db:"-"`
	AgentName         string           `json:"agent_name,omitempty" db:"-"`
	AgentConfig       map[string]any   `json:"agent_config,omitempty" db:"-"`
	Active            bool             `json:"active" db:"active"`
	EventTypes        []string         `json:"event_types,omitempty" db:"event_types"`
	DeliveryMode      HookDeliveryMode `json:"delivery_mode" db:"delivery_mode"`
	TargetTaskID      *string          `json:"target_task_id,omitempty" db:"target_task_id"`
	SystemManaged     bool             `json:"system_managed" db:"system_managed"`
	OneShot           bool             `json:"one_shot" db:"one_shot"`
	CreatedByMemberId *uint            `json:"created_by_member_id,omitempty" db:"created_by_member_id"`
	TokenId           *uint            `json:"-" db:"token_id"`
	EncryptedToken    []byte           `json:"-" db:"encrypted_token"`
	CreatedAt         time.Time        `json:"created_at" db:"created_at"`
	UpdatedAt         time.Time        `json:"updated_at" db:"updated_at"`
}

Hook is metadata on a filesystem path that creates tasks when something changes at that path. A hook on "/skills" fires when files are created or modified there. A hook on "/sources/gmail/inbox" fires when new query results appear. The event type (create, modify, source change) is passed as context in the task prompt -- not as a filter.

func (*Hook) NormalizeSkills added in v0.1.73

func (h *Hook) NormalizeSkills()

type HookDeliveryMode added in v0.1.110

type HookDeliveryMode string
const (
	HookDeliveryModeSpawnTask HookDeliveryMode = "spawn_task"
	HookDeliveryModeTaskInput HookDeliveryMode = "task_input"
)

type IPAllocation added in v0.1.23

type IPAllocation struct {
	IP            string `json:"ip"`
	Gateway       string `json:"gateway"`
	PrefixLen     int    `json:"prefix_len"`
	IPv6          string `json:"ipv6,omitempty"`
	GatewayIPv6   string `json:"gateway_ipv6,omitempty"`
	PrefixLenIPv6 int    `json:"prefix_len_ipv6,omitempty"`
}

IPAllocation represents an allocated IP for a sandbox

type ImageConfig

type ImageConfig struct {
	S3        S3Config `key:"s3" json:"s3"`
	CachePath string   `key:"cachePath" json:"cache_path"`
	WorkPath  string   `key:"workPath" json:"work_path"`
	MountPath string   `key:"mountPath" json:"mount_path"`
}

type InputKind added in v0.1.98

type InputKind string

InputKind distinguishes what sort of user input an agent is waiting for.

const (
	InputKindApproveReject InputKind = "approve_reject"
	InputKindFreeText      InputKind = "free_text"
)

type IntegrationAPIKey

type IntegrationAPIKey struct {
	APIKey string `key:"apiKey" json:"api_key"`
}

IntegrationAPIKey is a simple API key configuration

type IntegrationAuthType

type IntegrationAuthType string
const (
	AuthNone   IntegrationAuthType = "none"
	AuthAPIKey IntegrationAuthType = "apikey"
	AuthOAuth  IntegrationAuthType = "oauth"
)

type IntegrationCapability added in v0.1.71

type IntegrationCapability string
const (
	CapabilitySourceRead  IntegrationCapability = "source_read"
	CapabilitySourceWrite IntegrationCapability = "source_write"
)

type IntegrationConnection

type IntegrationConnection struct {
	Id              uint       `db:"id" json:"id"`
	ExternalId      string     `db:"external_id" json:"external_id"`
	WorkspaceId     uint       `db:"workspace_id" json:"workspace_id"`
	MemberId        *uint      `db:"member_id" json:"member_id,omitempty"` // nil = workspace-shared
	IntegrationType string     `db:"integration_type" json:"integration_type"`
	Credentials     []byte     `db:"credentials" json:"-"` // Encrypted
	Scope           string     `db:"scope" json:"scope,omitempty"`
	ExpiresAt       *time.Time `db:"expires_at" json:"expires_at,omitempty"`
	CreatedAt       time.Time  `db:"created_at" json:"created_at"`
	UpdatedAt       time.Time  `db:"updated_at" json:"updated_at"`
}

IntegrationConnection stores OAuth tokens or API keys for an integration

func (*IntegrationConnection) IsShared

func (c *IntegrationConnection) IsShared() bool

IsShared returns true if this is a workspace-shared connection

type IntegrationCredentials

type IntegrationCredentials struct {
	AccessToken  string            `json:"access_token,omitempty"`
	RefreshToken string            `json:"refresh_token,omitempty"`
	APIKey       string            `json:"api_key,omitempty"`
	ExpiresAt    *time.Time        `json:"expires_at,omitempty"`
	Extra        map[string]string `json:"extra,omitempty"`
}

IntegrationCredentials contains decrypted credentials for tool execution

type IntegrationMeta

type IntegrationMeta struct {
	Name                IntegrationName
	DisplayName         string
	Description         string
	Icon                string
	AuthType            IntegrationAuthType
	Scope               IntegrationScope
	Capabilities        []IntegrationCapability
	OAuthWriteScopeHint []string
}

func GetIntegrationMeta

func GetIntegrationMeta(name IntegrationName) (IntegrationMeta, bool)

func ListIntegrations

func ListIntegrations() []IntegrationMeta

type IntegrationName added in v0.1.49

type IntegrationName string

IntegrationName identifies an integration (tool or source).

const (
	Wikipedia  IntegrationName = "wikipedia"
	Weather    IntegrationName = "weather"
	Exa        IntegrationName = "exa"
	GitHub     IntegrationName = "github"
	Gmail      IntegrationName = "gmail"
	Notion     IntegrationName = "notion"
	GDrive     IntegrationName = "gdrive"
	Slack      IntegrationName = "slack"
	Linear     IntegrationName = "linear"
	PostHog    IntegrationName = "posthog"
	Confluence IntegrationName = "confluence"
	Outlook    IntegrationName = "outlook"
	Web        IntegrationName = "web"
	Browser    IntegrationName = "browser"
	ViewTool   IntegrationName = "view"
)

func (IntegrationName) String added in v0.1.49

func (n IntegrationName) String() string

type IntegrationOAuth

type IntegrationOAuth struct {
	CallbackURL string                   `key:"callbackUrl" json:"callback_url"` // e.g., https://api.airstore.ai/api/v1/oauth/callback
	Google      ProviderOAuthCredentials `key:"google" json:"google"`
	GitHub      ProviderOAuthCredentials `key:"github" json:"github"`
	Notion      ProviderOAuthCredentials `key:"notion" json:"notion"`
	Slack       ProviderOAuthCredentials `key:"slack" json:"slack"`
	Linear      ProviderOAuthCredentials `key:"linear" json:"linear"`
	Atlassian   ProviderOAuthCredentials `key:"atlassian" json:"atlassian"`
	Microsoft   ProviderOAuthCredentials `key:"microsoft" json:"microsoft"`
}

IntegrationOAuth configures OAuth for workspace integrations (gmail, gdrive, github, etc.) This is separate from admin.oauth which is for admin UI login only.

type IntegrationScope

type IntegrationScope string
const (
	ScopePersonal IntegrationScope = "personal"
	ScopeShared   IntegrationScope = "shared"
)

type IntegrationsConfig

type IntegrationsConfig struct {
	Weather IntegrationAPIKey `key:"weather" json:"weather"`
	Exa     IntegrationAPIKey `key:"exa" json:"exa"`
	GitHub  GitHubConfig      `key:"github" json:"github"`
	Kernel  IntegrationAPIKey `key:"kernel" json:"kernel"`
}

IntegrationsConfig configures builtin tools that require API keys

type ItemDecision added in v0.1.106

type ItemDecision struct {
	OutputID string          `json:"output_id"`
	Action   TaskInputAction `json:"action"`
	Reason   string          `json:"reason,omitempty"`
}

ItemDecision represents a per-item approval/rejection decision.

type LLMModelUsage added in v0.1.110

type LLMModelUsage struct {
	InputTokens              int64   `json:"input_tokens,omitempty"`
	OutputTokens             int64   `json:"output_tokens,omitempty"`
	CacheCreationInputTokens int64   `json:"cache_creation_input_tokens,omitempty"`
	CacheReadInputTokens     int64   `json:"cache_read_input_tokens,omitempty"`
	TotalTokens              int64   `json:"total_tokens,omitempty"`
	CostUSD                  float64 `json:"cost_usd,omitempty"`
	WebSearchRequests        int64   `json:"web_search_requests,omitempty"`
	ContextWindow            int64   `json:"context_window,omitempty"`
	MaxOutputTokens          int64   `json:"max_output_tokens,omitempty"`
}

func (LLMModelUsage) Normalized added in v0.1.110

func (m LLMModelUsage) Normalized() LLMModelUsage

func (LLMModelUsage) NormalizedTotalTokens added in v0.1.110

func (m LLMModelUsage) NormalizedTotalTokens() int64

type LLMUsage added in v0.1.110

type LLMUsage struct {
	InputTokens              int64                    `json:"llm_input_tokens,omitempty"`
	OutputTokens             int64                    `json:"llm_output_tokens,omitempty"`
	CacheCreationInputTokens int64                    `json:"llm_cache_creation_input_tokens,omitempty"`
	CacheReadInputTokens     int64                    `json:"llm_cache_read_input_tokens,omitempty"`
	TotalTokens              int64                    `json:"llm_total_tokens,omitempty"`
	TotalCostUSD             float64                  `json:"total_cost_usd,omitempty"`
	BillingTotalCostMicrousd int64                    `json:"billing_total_cost_microusd,omitempty"`
	ModelUsage               map[string]LLMModelUsage `json:"model_usage,omitempty"`
}

func MergeLLMUsage added in v0.1.110

func MergeLLMUsage(current *LLMUsage, delta *LLMUsage) *LLMUsage

func (*LLMUsage) IsZero added in v0.1.110

func (u *LLMUsage) IsZero() bool

func (*LLMUsage) Normalized added in v0.1.110

func (u *LLMUsage) Normalized() *LLMUsage

func (*LLMUsage) NormalizedBillingTotalCostMicrousd added in v0.1.110

func (u *LLMUsage) NormalizedBillingTotalCostMicrousd() int64

func (*LLMUsage) NormalizedTotal added in v0.1.110

func (u *LLMUsage) NormalizedTotal() int64

func (*LLMUsage) NormalizedTotalCostUSD added in v0.1.110

func (u *LLMUsage) NormalizedTotalCostUSD() float64

func (*LLMUsage) ProtoFields added in v0.1.110

func (u *LLMUsage) ProtoFields() LLMUsageProtoFields

ProtoFields returns the normalized usage fields ready for proto serialization. Returns zero-value fields when the receiver is nil.

type LLMUsageProtoFields added in v0.1.110

type LLMUsageProtoFields struct {
	InputTokens              int64
	OutputTokens             int64
	CacheCreationInputTokens int64
	CacheReadInputTokens     int64
	TotalTokens              int64
	TotalCostUSD             float64
	ModelUsageJSON           string
}

LLMUsageProtoFields holds the flat fields needed for pb.SetTaskResultRequest.

type LayoutConfig added in v0.1.103

type LayoutConfig struct {
	Columns int `json:"columns"`
}

type ListItem added in v0.1.108

type ListItem struct {
	Label  string `json:"label"`
	Value  string `json:"value"`
	Detail string `json:"detail,omitempty"`
}

type ListWidgetData added in v0.1.108

type ListWidgetData struct {
	Items []ListItem `json:"items"`
}

type MCPAuthConfig

type MCPAuthConfig struct {
	// Token is the bearer token for authentication.
	// For stdio: passed as MCP_AUTH_TOKEN env var (or custom var via TokenEnv)
	// For remote: passed as Authorization: Bearer <token> header
	Token string `key:"token" json:"token,omitempty"`

	// TokenEnv specifies a custom env var name for the token (stdio only, default: MCP_AUTH_TOKEN)
	TokenEnv string `key:"tokenEnv" json:"token_env,omitempty"`

	// Headers are additional auth headers.
	// For stdio: passed as MCP_AUTH_HEADER_<NAME> env vars
	// For remote: passed directly as HTTP headers
	Headers map[string]string `key:"headers" json:"headers,omitempty"`
}

MCPAuthConfig configures authentication for an MCP server. For stdio servers, auth is passed via environment variables. For remote servers, auth is passed via HTTP headers.

func (*MCPAuthConfig) Redact

func (c *MCPAuthConfig) Redact() *MCPAuthConfig

Redact returns a copy of MCPAuthConfig with sensitive values redacted

type MCPServerConfig

type MCPServerConfig struct {
	// Local (stdio) server - spawn process
	Command    string            `key:"command" json:"command,omitempty"` // Executable (npx, uvx, python)
	Args       []string          `key:"args" json:"args,omitempty"`       // Command arguments
	Env        map[string]string `key:"env" json:"env,omitempty"`         // Environment variables
	WorkingDir string            `key:"cwd" json:"cwd,omitempty"`         // Working directory

	// Remote (HTTP/SSE) server - connect to URL
	URL string `key:"url" json:"url,omitempty"`

	// Transport specifies the remote transport type: "sse" (default) or "http" (Streamable HTTP)
	Transport string `key:"transport" json:"transport,omitempty"`

	// Auth for both local (env vars) and remote (HTTP headers)
	Auth *MCPAuthConfig `key:"auth" json:"auth,omitempty"`
}

MCPServerConfig defines an MCP server to spawn or connect to. Set Command for local stdio servers, or URL for remote HTTP/SSE servers.

func (MCPServerConfig) GetTransport

func (c MCPServerConfig) GetTransport() string

GetTransport returns the transport type, defaulting to SSE

func (MCPServerConfig) IsRemote

func (c MCPServerConfig) IsRemote() bool

IsRemote returns true if this is a remote HTTP/SSE server (URL is set)

func (*MCPServerConfig) RedactConfig

func (c *MCPServerConfig) RedactConfig() *MCPServerConfig

RedactConfig returns a copy of MCPServerConfig with auth values redacted

type MapMarker added in v0.1.108

type MapMarker struct {
	Lat    float64 `json:"lat"`
	Lng    float64 `json:"lng"`
	Label  string  `json:"label"`
	Detail string  `json:"detail,omitempty"`
}

type MapWidgetData added in v0.1.108

type MapWidgetData struct {
	Markers []MapMarker `json:"markers"`
}

type MemberInfo

type MemberInfo struct {
	Id         uint
	ExternalId string
	Email      string
	Role       MemberRole
}

type MemberRole

type MemberRole string

MemberRole represents the role of a member in a workspace

const (
	RoleAdmin  MemberRole = "admin"
	RoleMember MemberRole = "member"
	RoleViewer MemberRole = "viewer"
)

type MetadataNotFoundError

type MetadataNotFoundError struct {
	Key string
}

MetadataNotFoundError is returned when metadata is not found

func (*MetadataNotFoundError) Error

func (e *MetadataNotFoundError) Error() string

type MetricData added in v0.1.108

type MetricData struct {
	Value      string `json:"value"`
	Label      string `json:"label"`
	Comparison string `json:"comparison,omitempty"`
}

type ModelProviderConfig added in v0.1.43

type ModelProviderConfig struct {
	APIKey string `key:"apiKey" json:"api_key"`
}

ModelProviderConfig holds credentials for a single LLM provider.

type ModelsConfig added in v0.1.43

type ModelsConfig struct {
	Anthropic ModelProviderConfig `key:"anthropic" json:"anthropic"` // Claude models (smart queries, sandbox)
	Cerebras  ModelProviderConfig `key:"cerebras" json:"cerebras"`   // Cerebras models (distillation)
	OpenAI    ModelProviderConfig `key:"openai" json:"openai"`       // OpenAI models (embeddings)
}

ModelsConfig centralises API keys for all LLM providers. BAML picks these up via env vars (ANTHROPIC_API_KEY, CEREBRAS_API_KEY).

type MongoConfig added in v0.1.103

type MongoConfig struct {
	URI      string `key:"uri" json:"uri"`
	Database string `key:"database" json:"database"`
}

type OrchestrationOutboxEvent added in v0.1.75

type OrchestrationOutboxEvent struct {
	ID          int64                        `json:"id" db:"id"`
	EventType   OrchestrationOutboxEventType `json:"event_type" db:"event_type"`
	DedupeKey   string                       `json:"dedupe_key" db:"dedupe_key"`
	PayloadJSON map[string]any               `json:"payload_json" db:"-"`
	AvailableAt time.Time                    `json:"available_at" db:"available_at"`
	PublishedAt *time.Time                   `json:"published_at,omitempty" db:"published_at"`
	Attempts    int                          `json:"attempts" db:"attempts"`
	LastError   *string                      `json:"last_error,omitempty" db:"last_error"`
	CreatedAt   time.Time                    `json:"created_at" db:"created_at"`
	UpdatedAt   time.Time                    `json:"updated_at" db:"updated_at"`
}

type OrchestrationOutboxEventType added in v0.1.75

type OrchestrationOutboxEventType string
const (
	OrchestrationOutboxEventTypeTaskDispatch OrchestrationOutboxEventType = "task_dispatch"
	OrchestrationOutboxEventTypeRunResult    OrchestrationOutboxEventType = "run_result"
)

type PoolScalerStatus

type PoolScalerStatus struct {
	PoolName        string `json:"pool_name"`
	QueueDepth      int64  `json:"queue_depth"`
	InFlightTasks   int64  `json:"in_flight_tasks"`
	CurrentReplicas int32  `json:"current_replicas"`
	MinReplicas     int32  `json:"min_replicas"`
	MaxReplicas     int32  `json:"max_replicas"`
}

PoolScalerStatus represents the current scaling status of a pool

type Position added in v0.1.103

type Position struct {
	Col     int `json:"col"`
	Row     int `json:"row"`
	ColSpan int `json:"colSpan"`
	RowSpan int `json:"rowSpan"`
}

type PostgresConfig

type PostgresConfig struct {
	Host            string        `key:"host" json:"host"`
	Port            int           `key:"port" json:"port"`
	User            string        `key:"user" json:"user"`
	Password        string        `key:"password" json:"password"`
	Database        string        `key:"database" json:"database"`
	SSLMode         string        `key:"sslMode" json:"ssl_mode"`
	MaxOpenConns    int           `key:"maxOpenConns" json:"max_open_conns"`
	MaxIdleConns    int           `key:"maxIdleConns" json:"max_idle_conns"`
	ConnMaxLifetime time.Duration `key:"connMaxLifetime" json:"conn_max_lifetime"`
}

type ProviderOAuthCredentials added in v0.1.16

type ProviderOAuthCredentials struct {
	ClientID     string `key:"clientId" json:"client_id"`
	ClientSecret string `key:"clientSecret" json:"client_secret"`
}

ProviderOAuthCredentials contains client credentials for an OAuth provider.

type RedisConfig

type RedisConfig struct {
	Mode               RedisMode     `key:"mode" json:"mode"`
	Addrs              []string      `key:"addrs" json:"addrs"`
	Username           string        `key:"username" json:"username"`
	Password           string        `key:"password" json:"password"`
	ClientName         string        `key:"clientName" json:"client_name"`
	EnableTLS          bool          `key:"enableTLS" json:"enable_tls"`
	InsecureSkipVerify bool          `key:"insecureSkipVerify" json:"insecure_skip_verify"`
	PoolSize           int           `key:"poolSize" json:"pool_size"`
	MinIdleConns       int           `key:"minIdleConns" json:"min_idle_conns"`
	MaxIdleConns       int           `key:"maxIdleConns" json:"max_idle_conns"`
	ConnMaxIdleTime    time.Duration `key:"connMaxIdleTime" json:"conn_max_idle_time"`
	ConnMaxLifetime    time.Duration `key:"connMaxLifetime" json:"conn_max_lifetime"`
	DialTimeout        time.Duration `key:"dialTimeout" json:"dial_timeout"`
	ReadTimeout        time.Duration `key:"readTimeout" json:"read_timeout"`
	WriteTimeout       time.Duration `key:"writeTimeout" json:"write_timeout"`
	MaxRedirects       int           `key:"maxRedirects" json:"max_redirects"`
	MaxRetries         int           `key:"maxRetries" json:"max_retries"`
	RouteByLatency     bool          `key:"routeByLatency" json:"route_by_latency"`
}

type RedisMode

type RedisMode string
const (
	RedisModeSingle  RedisMode = "single"
	RedisModeCluster RedisMode = "cluster"
)

type ResolvedBlocker added in v0.1.110

type ResolvedBlocker struct {
	ID              string                `json:"id,omitempty"`
	Kind            string                `json:"kind,omitempty"`
	InputKind       string                `json:"input_kind,omitempty"`
	Status          string                `json:"status,omitempty"`
	WaitGroupID     string                `json:"wait_group_id,omitempty"`
	OutputID        string                `json:"output_id,omitempty"`
	OutputStatus    string                `json:"output_status,omitempty"`
	OutputIDs       []string              `json:"output_ids,omitempty"`
	ApprovalSurface bool                  `json:"approval_surface,omitempty"`
	Summary         string                `json:"summary,omitempty"`
	Details         string                `json:"details,omitempty"`
	Items           []ResolvedBlockerItem `json:"items,omitempty"`
	PayloadJSON     map[string]any        `json:"payload_json,omitempty"`
}

type ResolvedBlockerItem added in v0.1.110

type ResolvedBlockerItem struct {
	OutputID string `json:"output_id"`
	Title    string `json:"title,omitempty"`
	ItemKey  string `json:"item_key,omitempty"`
}

type ResolvedData added in v0.1.103

type ResolvedData struct {
	Columns     []string       `json:"columns"`
	ColumnMeta  []ColumnMeta   `json:"column_meta,omitempty"`
	Rows        [][]any        `json:"rows"`
	Total       int            `json:"total"`
	CachedAt    *time.Time     `json:"cached_at,omitempty"`
	Status      string         `json:"status,omitempty"`
	Error       string         `json:"error,omitempty"`
	Diagnostics map[string]any `json:"diagnostics,omitempty"`
}

ResolvedData is the response from the DataResolver for a single component.

type ResolvedTool

type ResolvedTool struct {
	Name         string              `json:"name"`
	Help         string              `json:"help,omitempty"`
	Origin       WorkspaceToolOrigin `json:"origin"`
	ExternalId   string              `json:"external_id,omitempty"`
	Enabled      bool                `json:"enabled"`
	ToolCount    int                 `json:"tool_count,omitempty"`
	LocalCommand string              `json:"local_command,omitempty"`
}

ResolvedTool represents a tool with its origin and metadata for listing

type RunExecution added in v0.1.60

type RunExecution struct {
	// Id is the internal ID for joins
	Id uint `json:"id" db:"id"`

	// ExternalId is the UUID exposed via API
	ExternalId string `json:"external_id" db:"external_id"`

	// WorkspaceId is the internal workspace ID (for joins)
	WorkspaceId uint `json:"workspace_id" db:"workspace_id"`

	// CreatedByMemberId is the member who created this task (for token auth)
	CreatedByMemberId *uint `json:"created_by_member_id,omitempty" db:"created_by_member_id"`

	// MemberToken is the workspace token to use for filesystem access
	// This is NOT stored in the database - it's set at creation time and passed to workers
	MemberToken string `json:"member_token,omitempty" db:"-"`

	// Status is the current run execution status
	Status RunExecutionStatus `json:"status" db:"status"`

	// Type controls run execution mode (background by default).
	Type RunExecutionType `json:"type" db:"type"`

	// Prompt is the Claude Code prompt (if this is a Claude Code task)
	Prompt string `json:"prompt,omitempty" db:"prompt"`

	// Image is the container image to use
	Image string `json:"image" db:"image"`

	// Entrypoint is the command to run
	Entrypoint []string `json:"entrypoint" db:"entrypoint"`

	// Env is environment variables for the task
	Env map[string]string `json:"env" db:"env"`

	// Resources specifies resource requirements (optional - uses defaults if nil)
	Resources *RunExecutionResources `json:"resources,omitempty" db:"-"`

	// RunAttemptID links this run execution to an orchestrated run attempt.
	RunAttemptID *string `json:"run_attempt_id,omitempty" db:"run_attempt_id"`

	// TimeoutMs applies a per-task execution timeout when set.
	TimeoutMs *int `json:"timeout_ms,omitempty" db:"timeout_ms"`

	// Execution policy fields bridged from run attempts.
	ExecHost        *string        `json:"exec_host,omitempty" db:"exec_host"`
	ExecSecurity    *string        `json:"exec_security,omitempty" db:"exec_security"`
	ExecAsk         *string        `json:"exec_ask,omitempty" db:"exec_ask"`
	RuntimeType     *string        `json:"runtime_type,omitempty" db:"runtime_type"`
	WorkspaceAccess *string        `json:"workspace_access,omitempty" db:"workspace_access"`
	NetworkEnabled  *bool          `json:"network_enabled,omitempty" db:"network_enabled"`
	ExecutionPolicy map[string]any `json:"execution_policy,omitempty" db:"-"`

	// Hook-triggered task fields (nil/defaults for manual tasks)
	HookId      *uint `json:"hook_id,omitempty" db:"hook_id"` // nil = manual, non-nil = hook-triggered
	Attempt     int   `json:"attempt" db:"attempt"`           // 1-based attempt number
	MaxAttempts int   `json:"max_attempts" db:"max_attempts"` // default 1 (manual), 3 (hook)

	// ExitCode is the exit code when complete
	ExitCode *int `json:"exit_code,omitempty" db:"exit_code"`

	// Error contains error message if failed
	Error string `json:"error,omitempty" db:"error"`

	// CreatedAt is when the task was created
	CreatedAt time.Time `json:"created_at" db:"created_at"`

	// StartedAt is when the task started running
	StartedAt *time.Time `json:"started_at,omitempty" db:"started_at"`

	// FinishedAt is when the task finished
	FinishedAt *time.Time `json:"finished_at,omitempty" db:"finished_at"`
}

RunExecution represents a run worker payload.

func (*RunExecution) GetResources added in v0.1.60

func (t *RunExecution) GetResources() RunExecutionResources

GetResources returns resources with defaults applied.

func (*RunExecution) IsInteractive added in v0.1.60

func (t *RunExecution) IsInteractive() bool

IsInteractive returns true when the run execution should run in interactive mode.

func (*RunExecution) IsTerminal added in v0.1.60

func (t *RunExecution) IsTerminal() bool

IsTerminal returns true if the run execution is in a terminal state.

func (*RunExecution) NormalizeType added in v0.1.60

func (t *RunExecution) NormalizeType()

NormalizeType applies the default run execution type when unset.

type RunExecutionPostRun added in v0.1.110

type RunExecutionPostRun struct {
	WaitingForInput     bool                    `json:"waiting_for_input,omitempty"`
	WakeSignal          *RunExecutionWakeSignal `json:"wake_signal,omitempty"`
	SubtaskRequests     []*SubtaskRequest       `json:"subtask_requests,omitempty"`
	SourceWatchRequests []*SourceWatchRequest   `json:"source_watch_requests,omitempty"`
}

func NormalizeRunExecutionPostRun added in v0.1.110

func NormalizeRunExecutionPostRun(postRun *RunExecutionPostRun) *RunExecutionPostRun

type RunExecutionResources added in v0.1.60

type RunExecutionResources struct {
	CPU    int64 `json:"cpu"`    // millicores (1000 = 1 CPU)
	Memory int64 `json:"memory"` // bytes
	GPU    int   `json:"gpu"`    // count
}

RunExecutionResources specifies resource requirements. Flow: API -> RunExecution.Resources -> SandboxConfig.Resources -> OCI spec limits

func (*RunExecutionResources) Validate added in v0.1.60

func (r *RunExecutionResources) Validate() error

Validate checks that resource values are within acceptable bounds. Returns an error describing the first invalid field found.

type RunExecutionResult added in v0.1.60

type RunExecutionResult struct {
	ID                  string                  `json:"id"`
	ExitCode            int                     `json:"exit_code"`
	Output              []byte                  `json:"output,omitempty"`
	Error               string                  `json:"error,omitempty"`
	Duration            time.Duration           `json:"duration"`
	PostRun             *RunExecutionPostRun    `json:"post_run,omitempty"`
	WaitingForInput     bool                    `json:"waiting_for_input,omitempty"`
	WakeSignal          *RunExecutionWakeSignal `json:"wake_signal,omitempty"`
	SubtaskRequests     []*SubtaskRequest       `json:"subtask_requests,omitempty"`
	SourceWatchRequests []*SourceWatchRequest   `json:"source_watch_requests,omitempty"`
	Usage               *LLMUsage               `json:"usage,omitempty"`
}

func (*RunExecutionResult) NormalizedPostRun added in v0.1.110

func (r *RunExecutionResult) NormalizedPostRun() *RunExecutionPostRun

func (*RunExecutionResult) SetPostRun added in v0.1.110

func (r *RunExecutionResult) SetPostRun(postRun *RunExecutionPostRun)

type RunExecutionState added in v0.1.60

type RunExecutionState struct {
	// ID is the run execution identifier
	ID string `json:"id"`

	// Status is the current status
	Status RunExecutionStatus `json:"status"`

	// SandboxID is the sandbox running this task (empty if not yet scheduled)
	SandboxID string `json:"sandbox_id,omitempty"`

	// WorkerID is the worker running this task (empty if not yet scheduled)
	WorkerID string `json:"worker_id,omitempty"`

	// ExitCode is the exit code if complete (-1 if still running)
	ExitCode int `json:"exit_code"`

	// Error contains error message if failed
	Error string `json:"error,omitempty"`

	// CreatedAt is when the task was created
	CreatedAt time.Time `json:"created_at"`

	// ScheduledAt is when the task was scheduled
	ScheduledAt time.Time `json:"scheduled_at,omitempty"`

	// StartedAt is when the task started running
	StartedAt time.Time `json:"started_at,omitempty"`

	// FinishedAt is when the task finished
	FinishedAt time.Time `json:"finished_at,omitempty"`
}

RunExecutionState represents the current state of a run execution

type RunExecutionStatus added in v0.1.60

type RunExecutionStatus string

RunExecutionStatus represents the current status of a run execution

const (
	RunExecutionStatusPending   RunExecutionStatus = "pending"
	RunExecutionStatusScheduled RunExecutionStatus = "scheduled"
	RunExecutionStatusRunning   RunExecutionStatus = "running"
	RunExecutionStatusComplete  RunExecutionStatus = "complete"
	RunExecutionStatusFailed    RunExecutionStatus = "failed"
	RunExecutionStatusCancelled RunExecutionStatus = "cancelled"
)

type RunExecutionType added in v0.1.60

type RunExecutionType string

RunExecutionType represents how a run execution should execute.

const (
	RunExecutionTypeBackground  RunExecutionType = "background"
	RunExecutionTypeInteractive RunExecutionType = "interactive"
)

type RunExecutionWakeSignal added in v0.1.96

type RunExecutionWakeSignal struct {
	DelayMinutes   int                   `json:"delay_minutes"`
	Reason         string                `json:"reason,omitempty"`
	FollowUpPrompt string                `json:"follow_up_prompt,omitempty"`
	WakeAgenda     []*TaskWakeAgendaItem `json:"wake_agenda,omitempty"`
}

RunExecutionResult contains the result of a completed run execution

func NormalizeRunExecutionWakeSignal added in v0.1.110

func NormalizeRunExecutionWakeSignal(signal *RunExecutionWakeSignal) *RunExecutionWakeSignal

type RunInputDeliveryOutcome added in v0.1.73

type RunInputDeliveryOutcome string

RunInputDeliveryOutcome describes how a run-input message was handled.

const (
	RunInputDeliveryDirect      RunInputDeliveryOutcome = "direct"
	RunInputDeliveryQueued      RunInputDeliveryOutcome = "queued"
	RunInputDeliveryInterrupted RunInputDeliveryOutcome = "interrupted"
	RunInputDeliveryRestarted   RunInputDeliveryOutcome = "restarted"
)

type RunInteraction added in v0.1.73

type RunInteraction struct {
	State             RunInteractionState `json:"state"`
	ActiveExecutionID string              `json:"active_execution_id,omitempty"`
	UpdatedAt         int64               `json:"updated_at,omitempty"`
}

RunInteraction is the runtime interaction state of an active run.

type RunInteractionState added in v0.1.73

type RunInteractionState string

RunInteractionState is the backend-owned interaction state for an agent run.

const (
	RunInteractionStateWorking         RunInteractionState = "working"
	RunInteractionStateWaitingForInput RunInteractionState = "waiting_for_input"
	RunInteractionStateClosed          RunInteractionState = "closed"
)

type S3Config

type S3Config struct {
	Bucket         string `key:"bucket" json:"bucket"`
	Region         string `key:"region" json:"region"`
	Endpoint       string `key:"endpoint" json:"endpoint"`
	AccessKey      string `key:"accessKey" json:"access_key"`
	SecretKey      string `key:"secretKey" json:"secret_key"`
	ForcePathStyle bool   `key:"forcePathStyle" json:"force_path_style"`
}

type SandboxConfig

type SandboxConfig struct {
	// ID is the unique identifier for this sandbox
	ID string `json:"id"`

	// WorkspaceID is the workspace this sandbox belongs to
	WorkspaceID string `json:"workspace_id"`

	// Image is the container image to use for the sandbox
	Image string `json:"image"`

	// Runtime is the container runtime to use (runc, gvisor)
	Runtime ContainerRuntime `json:"runtime"`

	// Entrypoint is the command to run in the sandbox
	Entrypoint []string `json:"entrypoint"`

	// Env is the environment variables to set
	Env map[string]string `json:"env"`

	// WorkingDir is the working directory inside the sandbox
	WorkingDir string `json:"working_dir"`

	// Resources specifies resource limits for the sandbox
	Resources RunExecutionResources `json:"resources"`

	// Mounts specifies additional mounts for the sandbox
	Mounts []SandboxMount `json:"mounts"`

	// Network specifies network configuration
	Network SandboxNetwork `json:"network"`

	// FilesystemMount is the host path to bind-mount at /workspace (optional)
	FilesystemMount string `json:"-"`

	// FilesystemReadOnly controls whether /workspace is mounted read-only.
	FilesystemReadOnly bool `json:"-"`
}

SandboxConfig defines the configuration for creating a sandbox

type SandboxMount

type SandboxMount struct {
	// Source is the host path or volume name
	Source string `json:"source"`

	// Destination is the path inside the sandbox
	Destination string `json:"destination"`

	// ReadOnly specifies if the mount is read-only
	ReadOnly bool `json:"read_only"`

	// Type is the mount type (bind, volume, tmpfs)
	Type string `json:"type"`
}

SandboxMount specifies a mount point for a sandbox

type SandboxNetwork

type SandboxNetwork struct {
	// Mode is the network mode (none, host, bridge)
	Mode string `json:"mode"`

	// ExposedPorts is a list of ports to expose
	ExposedPorts []int `json:"exposed_ports"`
}

SandboxNetwork specifies network configuration for a sandbox

type SandboxSettings added in v0.1.23

type SandboxSettings struct {
	// DefaultImage is the container image used when a task omits image.
	DefaultImage string `key:"defaultImage" json:"default_image"`
	// InteractiveIdleTimeout controls how long an interactive task may stay
	// inactive (no input/output activity) before it is automatically completed.
	InteractiveIdleTimeout time.Duration `key:"interactiveIdleTimeout" json:"interactive_idle_timeout"`
}

SandboxSettings configures the task sandbox/container runtime defaults

func (SandboxSettings) GetDefaultImage added in v0.1.23

func (c SandboxSettings) GetDefaultImage() string

GetDefaultImage returns the configured default image or the fallback

func (SandboxSettings) GetInteractiveIdleTimeout added in v0.1.53

func (c SandboxSettings) GetInteractiveIdleTimeout() time.Duration

GetInteractiveIdleTimeout returns the interactive idle timeout with a sane default.

type SandboxState

type SandboxState struct {
	// ID is the sandbox identifier
	ID string `json:"id"`

	// Status is the current status
	Status SandboxStatus `json:"status"`

	// PID is the main process ID (0 if not running)
	PID int `json:"pid"`

	// ExitCode is the exit code if stopped (-1 if still running)
	ExitCode int `json:"exit_code"`

	// Error contains error message if failed
	Error string `json:"error,omitempty"`

	// ContainerIP is the container's IP address (for routing)
	ContainerIP string `json:"container_ip,omitempty"`

	// CreatedAt is when the sandbox was created
	CreatedAt time.Time `json:"created_at"`

	// StartedAt is when the sandbox started running
	StartedAt time.Time `json:"started_at,omitempty"`

	// FinishedAt is when the sandbox stopped
	FinishedAt time.Time `json:"finished_at,omitempty"`
}

SandboxState represents the current state of a sandbox

type SandboxStatus

type SandboxStatus string

SandboxStatus represents the current status of a sandbox

const (
	SandboxStatusPending  SandboxStatus = "pending"
	SandboxStatusCreating SandboxStatus = "creating"
	SandboxStatusRunning  SandboxStatus = "running"
	SandboxStatusStopped  SandboxStatus = "stopped"
	SandboxStatusFailed   SandboxStatus = "failed"
)

type ScheduledTask added in v0.1.89

type ScheduledTask struct {
	ID                string     `json:"id" db:"id"`
	ExternalID        string     `json:"external_id" db:"external_id"`
	WorkspaceID       uint       `json:"workspace_id" db:"workspace_id"`
	AgentID           string     `json:"agent_id" db:"agent_id"`
	CronExpr          string     `json:"cron_expr" db:"cron_expr"`
	Timezone          string     `json:"timezone" db:"timezone"`
	Prompt            string     `json:"prompt" db:"prompt"`
	SkillPaths        []string   `json:"skill_paths" db:"skill_paths"`
	Active            bool       `json:"active" db:"active"`
	NextRunAt         time.Time  `json:"next_run_at" db:"next_run_at"`
	LastRunAt         *time.Time `json:"last_run_at,omitempty" db:"last_run_at"`
	TokenID           *uint      `json:"-" db:"token_id"`
	EncryptedToken    []byte     `json:"-" db:"encrypted_token"`
	CreatedByMemberID *uint      `json:"created_by_member_id,omitempty" db:"created_by_member_id"`
	SourceViewID      *string    `json:"source_view_id,omitempty" db:"source_view_id"`
	CreatedAt         time.Time  `json:"created_at" db:"created_at"`
	UpdatedAt         time.Time  `json:"updated_at" db:"updated_at"`
}

type SchedulerConfig

type SchedulerConfig struct {
	Enabled                   bool                        `key:"enabled" json:"enabled"`
	GatewayServiceName        string                      `key:"gatewayServiceName" json:"gateway_service_name"`
	WorkerImage               string                      `key:"workerImage" json:"worker_image"`
	WorkerNamespace           string                      `key:"workerNamespace" json:"worker_namespace"`
	GatewayExternalGRPCAddr   string                      `key:"gatewayExternalGRPCAddr" json:"gateway_external_grpc_addr"`
	WorkerServiceAccountName  string                      `key:"workerServiceAccountName" json:"worker_service_account_name"`
	WorkerHostNetwork         bool                        `key:"workerHostNetwork" json:"worker_host_network"`
	WorkerImagePullSecrets    []string                    `key:"workerImagePullSecrets" json:"worker_image_pull_secrets"`
	UseGatewayServiceHostname bool                        `key:"useGatewayServiceHostname" json:"use_gateway_service_hostname"`
	UseHostResolvConf         bool                        `key:"useHostResolvConf" json:"use_host_resolv_conf"`
	WorkerTTL                 time.Duration               `key:"workerTTL" json:"worker_ttl"`
	WorkerShutdownTimeout     time.Duration               `key:"workerShutdownTimeout" json:"worker_shutdown_timeout"` // Time to wait for tasks during graceful shutdown
	CleanupInterval           time.Duration               `key:"cleanupInterval" json:"cleanup_interval"`
	HeartbeatInterval         time.Duration               `key:"heartbeatInterval" json:"heartbeat_interval"`
	HeartbeatTimeout          time.Duration               `key:"heartbeatTimeout" json:"heartbeat_timeout"`
	RunClaimLeaseTTL          time.Duration               `key:"runClaimLeaseTTL" json:"run_claim_lease_ttl"`
	RecoveryLoopEnabled       bool                        `key:"recoveryLoopEnabled" json:"recovery_loop_enabled"`
	RecoveryLoopInterval      time.Duration               `key:"recoveryLoopInterval" json:"recovery_loop_interval"`
	RecoveryLoopBatchSize     int                         `key:"recoveryLoopBatchSize" json:"recovery_loop_batch_size"`
	UnclaimedRunStaleAfter    time.Duration               `key:"unclaimedRunStaleAfter" json:"unclaimed_run_stale_after"`
	DefaultWorkerCpu          int64                       `key:"defaultWorkerCpu" json:"default_worker_cpu"`       // millicores
	DefaultWorkerMemory       int64                       `key:"defaultWorkerMemory" json:"default_worker_memory"` // MiB
	Pools                     map[string]WorkerPoolConfig `key:"pools" json:"pools"`
}

SchedulerConfig holds scheduler-specific configuration

type SessionCheckpoint added in v0.1.97

type SessionCheckpoint struct {
	RunID       string `json:"run_id"`
	ExecutionID string `json:"execution_id,omitempty"`
	UpdatedAt   int64  `json:"updated_at"`
}

SessionCheckpoint records the most recent interactive run that fully flushed its Claude session state and is safe to resume from.

type SheetRelation added in v0.1.103

type SheetRelation struct {
	ID         string `json:"id"`
	Name       string `json:"name,omitempty"`
	ToSheetID  string `json:"to_sheet_id"`
	FromColumn string `json:"from_column"`
	ToColumn   string `json:"to_column"`
}

type SheetSpec added in v0.1.103

type SheetSpec struct {
	ID          string          `json:"id"`
	Name        string          `json:"name"`
	Description string          `json:"description,omitempty"`
	Layout      LayoutConfig    `json:"layout"`
	Components  []ComponentSpec `json:"components"`
	Relations   []SheetRelation `json:"relations,omitempty"`
	Widgets     []WidgetSpec    `json:"widgets,omitempty"`
}

type SourceType added in v0.1.43

type SourceType string

SourceType identifies an integration data source.

const (
	SourceGmail      SourceType = "gmail"
	SourceGitHub     SourceType = "github"
	SourceNotion     SourceType = "notion"
	SourceGDrive     SourceType = "gdrive"
	SourceSlack      SourceType = "slack"
	SourceLinear     SourceType = "linear"
	SourcePostHog    SourceType = "posthog"
	SourceConfluence SourceType = "confluence"
	SourceOutlook    SourceType = "outlook"
	SourceWeb        SourceType = "web"
)

func (SourceType) String added in v0.1.43

func (s SourceType) String() string

type SourceView added in v0.1.50

type SourceView = FilesystemQuery

SourceView is the canonical name for FilesystemQuery.

type SourceWatchBlockerEntry added in v0.1.110

type SourceWatchBlockerEntry struct {
	Integration    string
	Path           string
	EntityLabel    string
	EntityKey      string
	SourceOutputID string
	ThreadID       string
	MessageID      string
}

type SourceWatchRequest added in v0.1.110

type SourceWatchRequest struct {
	Integration        string   `json:"integration"`
	Reason             string   `json:"reason,omitempty"`
	Query              string   `json:"query,omitempty"`
	FilenameFormat     string   `json:"filename_format,omitempty"`
	EventTypes         []string `json:"event_types,omitempty"`
	EntityKey          string   `json:"entity_key,omitempty"`
	EntityLabel        string   `json:"entity_label,omitempty"`
	SourceOutputID     string   `json:"source_output_id,omitempty"`
	ThreadID           string   `json:"thread_id,omitempty"`
	MessageID          string   `json:"message_id,omitempty"`
	IncludeAttachments bool     `json:"include_attachments,omitempty"`
	IncludeInline      bool     `json:"include_inline,omitempty"`
	IncludeMessageBody bool     `json:"include_message_body,omitempty"`
}

func CanonicalizeSourceWatchRequest added in v0.1.110

func CanonicalizeSourceWatchRequest(req *SourceWatchRequest) *SourceWatchRequest

func MergeSourceWatchRequests added in v0.1.110

func MergeSourceWatchRequests(base, incoming *SourceWatchRequest) *SourceWatchRequest

func NormalizeSourceWatchRequest added in v0.1.110

func NormalizeSourceWatchRequest(req *SourceWatchRequest) *SourceWatchRequest

func NormalizeSourceWatchRequestList added in v0.1.110

func NormalizeSourceWatchRequestList(requests []*SourceWatchRequest) []*SourceWatchRequest

type SourcesConfig added in v0.1.49

type SourcesConfig struct {
	Firecrawl IntegrationAPIKey `key:"firecrawl" json:"firecrawl"`
}

SourcesConfig holds API keys for builtin source providers.

type StatusOption added in v0.1.103

type StatusOption struct {
	Value string `json:"value"`
	Color string `json:"color"`
}

type StreamsConfig

type StreamsConfig struct {
	Token string `key:"token" json:"token"` // S2 API token
	Basin string `key:"basin" json:"basin"` // S2 basin name (e.g., "airstore")
}

StreamsConfig configures S2 stream storage for task logs

type SubtaskRequest added in v0.1.110

type SubtaskRequest struct {
	SourceOutputID   string `json:"source_output_id"`
	EntityLabel      string `json:"entity_label"`
	Prompt           string `json:"prompt"`
	WakeDelayMinutes int    `json:"wake_delay_minutes"`
}

func NormalizeSubtaskRequests added in v0.1.110

func NormalizeSubtaskRequests(requests []*SubtaskRequest) []*SubtaskRequest

type TaskBlocker added in v0.1.110

type TaskBlocker struct {
	ID             string            `json:"id" db:"id"`
	WorkspaceID    uint              `json:"workspace_id" db:"workspace_id"`
	TaskID         string            `json:"task_id" db:"task_id"`
	RunID          *string           `json:"run_id,omitempty" db:"run_id"`
	Kind           TaskBlockerKind   `json:"kind" db:"kind"`
	InputKind      InputKind         `json:"input_kind,omitempty" db:"input_kind"`
	Status         TaskBlockerStatus `json:"status" db:"status"`
	WaitGroupID    *string           `json:"wait_group_id,omitempty" db:"wait_group_id"`
	PayloadJSON    map[string]any    `json:"payload_json,omitempty" db:"-"`
	ResolutionJSON map[string]any    `json:"resolution_json,omitempty" db:"-"`
	OutputIDs      []string          `json:"output_ids,omitempty" db:"-"`
	Revision       int               `json:"revision" db:"revision"`
	CreatedAt      time.Time         `json:"created_at" db:"created_at"`
	UpdatedAt      time.Time         `json:"updated_at" db:"updated_at"`
	ResolvedAt     *time.Time        `json:"resolved_at,omitempty" db:"resolved_at"`
}

func (*TaskBlocker) ApprovalSurface added in v0.1.110

func (b *TaskBlocker) ApprovalSurface() bool

type TaskBlockerKind added in v0.1.110

type TaskBlockerKind string
const (
	TaskBlockerKindApproval TaskBlockerKind = "approval"
	TaskBlockerKindInput    TaskBlockerKind = "input"
)

func TaskBlockerKindForInputKind added in v0.1.110

func TaskBlockerKindForInputKind(kind InputKind) TaskBlockerKind

type TaskBlockerOpenRequest added in v0.1.110

type TaskBlockerOpenRequest struct {
	WorkspaceID   uint
	TaskID        string
	ExpectedRunID string
	Blocker       *TaskBlockerSpec
}

type TaskBlockerPayload added in v0.1.110

type TaskBlockerPayload struct {
	InputKind InputKind      `json:"-"`
	Summary   string         `json:"summary,omitempty"`
	Details   string         `json:"details,omitempty"`
	Fields    map[string]any `json:"-"`
}

func NewTaskBlockerPayload added in v0.1.110

func NewTaskBlockerPayload(inputKind InputKind, waitingSummary, assistantMessage string) TaskBlockerPayload

func ParseTaskBlockerPayload added in v0.1.110

func ParseTaskBlockerPayload(values map[string]any) TaskBlockerPayload

func (TaskBlockerPayload) ToMap added in v0.1.110

func (p TaskBlockerPayload) ToMap() map[string]any

type TaskBlockerResolution added in v0.1.110

type TaskBlockerResolution struct {
	Status         TaskBlockerStatus
	ResolutionJSON map[string]any
}

type TaskBlockerSpec added in v0.1.110

type TaskBlockerSpec struct {
	Kind        TaskBlockerKind
	InputKind   InputKind
	WaitGroupID *string
	PayloadJSON map[string]any
	OutputIDs   []string
}

func NewSourceWatchBlockerSpec added in v0.1.110

func NewSourceWatchBlockerSpec(summary, details string, entries []SourceWatchBlockerEntry) *TaskBlockerSpec

type TaskBlockerStatus added in v0.1.110

type TaskBlockerStatus string
const (
	TaskBlockerStatusOpen       TaskBlockerStatus = "open"
	TaskBlockerStatusResolved   TaskBlockerStatus = "resolved"
	TaskBlockerStatusSuperseded TaskBlockerStatus = "superseded"
)

type TaskInput added in v0.1.98

type TaskInput struct {
	ID              string           `json:"id" db:"id"`
	WorkspaceID     uint             `json:"workspace_id" db:"workspace_id"`
	TaskID          string           `json:"task_id" db:"task_id"`
	SessionID       string           `json:"session_id" db:"session_id"`
	Seq             int              `json:"seq" db:"seq"`
	Kind            InputKind        `json:"kind" db:"kind"`
	Action          *TaskInputAction `json:"action,omitempty" db:"action"`
	Message         string           `json:"message" db:"message"`
	IdempotencyKey  string           `json:"idempotency_key" db:"idempotency_key"`
	Status          TaskInputStatus  `json:"status" db:"status"`
	ClaimedByRunID  *string          `json:"claimed_by_run_id,omitempty" db:"claimed_by_run_id"`
	ClaimedByExecID *string          `json:"claimed_by_execution_id,omitempty" db:"claimed_by_execution_id"`
	CreatedAt       time.Time        `json:"created_at" db:"created_at"`
	ClaimedAt       *time.Time       `json:"claimed_at,omitempty" db:"claimed_at"`
	ConsumedAt      *time.Time       `json:"consumed_at,omitempty" db:"consumed_at"`
}

TaskInput is a durable follow-up input row owned by a task and consumed by whichever run is active for the task/session at delivery time.

type TaskInputAction added in v0.1.98

type TaskInputAction string

TaskInputAction is a structured reply action (e.g. approve/reject).

const (
	TaskInputActionApprove TaskInputAction = "approve"
	TaskInputActionReject  TaskInputAction = "reject"
)

type TaskInputStatus added in v0.1.98

type TaskInputStatus string

TaskInputStatus tracks the lifecycle of a durable follow-up input row.

const (
	TaskInputStatusPending  TaskInputStatus = "pending"
	TaskInputStatusClaimed  TaskInputStatus = "claimed"
	TaskInputStatusConsumed TaskInputStatus = "consumed"
)

type TaskLiveUpdate added in v0.1.110

type TaskLiveUpdate struct {
	TaskID  string
	RunID   string
	State   AgentTaskState
	Blocker *TaskBlockerSpec
}

type TaskOutput added in v0.1.96

type TaskOutput struct {
	ID          string         `json:"id"`
	WorkspaceID uint           `json:"workspace_id"`
	TaskID      string         `json:"task_id"`
	RunID       *string        `json:"run_id,omitempty"`
	AgentID     *string        `json:"agent_id,omitempty"`
	AgentName   string         `json:"agent_name,omitempty"`
	OutputType  string         `json:"output_type"`
	Title       string         `json:"title"`
	Summary     *string        `json:"summary,omitempty"`
	URI         *string        `json:"uri,omitempty"`
	Data        map[string]any `json:"data"`
	Metadata    map[string]any `json:"metadata,omitempty"`
	Status      string         `json:"status"`
	ArchivedAt  *time.Time     `json:"archived_at,omitempty"`
	CreatedAt   time.Time      `json:"created_at"`
}

TaskOutput is a structured output produced by an agent during a task.

func (*TaskOutput) ArtifactKey added in v0.1.110

func (o *TaskOutput) ArtifactKey() string

func (*TaskOutput) ArtifactKind added in v0.1.110

func (o *TaskOutput) ArtifactKind() string

func (*TaskOutput) ArtifactLabel added in v0.1.110

func (o *TaskOutput) ArtifactLabel() string

func (*TaskOutput) ArtifactRole added in v0.1.110

func (o *TaskOutput) ArtifactRole() string

func (*TaskOutput) Blocking added in v0.1.110

func (o *TaskOutput) Blocking() TaskOutputBlockingMetadata

func (*TaskOutput) DataString added in v0.1.110

func (o *TaskOutput) DataString(keys ...string) string

func (*TaskOutput) HasApprovalSurface added in v0.1.110

func (o *TaskOutput) HasApprovalSurface() bool

func (*TaskOutput) IsApprovalArtifact added in v0.1.110

func (o *TaskOutput) IsApprovalArtifact() bool

func (*TaskOutput) IsDraftEmail added in v0.1.126

func (o *TaskOutput) IsDraftEmail() bool

func (*TaskOutput) IsPending added in v0.1.110

func (o *TaskOutput) IsPending() bool

func (*TaskOutput) MetadataString added in v0.1.110

func (o *TaskOutput) MetadataString(keys ...string) string

func (*TaskOutput) SetBlocking added in v0.1.110

func (o *TaskOutput) SetBlocking(blocking TaskOutputBlockingMetadata)

func (*TaskOutput) ShouldHideInWorkspace added in v0.1.110

func (o *TaskOutput) ShouldHideInWorkspace() bool

func (*TaskOutput) WaitGroupID added in v0.1.110

func (o *TaskOutput) WaitGroupID() string

type TaskOutputBlockingMetadata added in v0.1.110

type TaskOutputBlockingMetadata struct {
	BlockerID       string    `json:"blocker_id,omitempty"`
	Kind            string    `json:"kind,omitempty"`
	InputKind       InputKind `json:"input_kind,omitempty"`
	WaitGroupID     string    `json:"wait_group_id,omitempty"`
	ApprovalSurface bool      `json:"approval_surface,omitempty"`
}

func (TaskOutputBlockingMetadata) Apply added in v0.1.110

func (m TaskOutputBlockingMetadata) Apply(metadata map[string]any) map[string]any

func (TaskOutputBlockingMetadata) IsApproval added in v0.1.110

func (m TaskOutputBlockingMetadata) IsApproval() bool

type TaskOutputListFilter added in v0.1.96

type TaskOutputListFilter struct {
	TaskID          *string  `json:"task_id,omitempty"`
	TaskIDs         []string `json:"task_ids,omitempty"`
	AgentID         *string  `json:"agent_id,omitempty"`
	AgentIDIsNull   bool     `json:"agent_id_is_null,omitempty"`
	OutputType      *string  `json:"output_type,omitempty"`
	ExcludeArchived bool     `json:"exclude_archived,omitempty"`
	SourceViewID    *string  `json:"source_view_id,omitempty"`
	Limit           int      `json:"limit,omitempty"`
}

type TaskStateUpdate added in v0.1.110

type TaskStateUpdate struct {
	TaskID        string
	State         AgentTaskState
	DroppedReason *string
	TargetRunID   *string
}

type TaskWakeAgendaItem added in v0.1.103

type TaskWakeAgendaItem struct {
	Seq    int    `json:"seq" db:"seq"`
	Type   string `json:"type,omitempty" db:"item_type"`
	Title  string `json:"title" db:"title"`
	Reason string `json:"reason,omitempty" db:"reason"`
}

type Token

type Token struct {
	Id          uint       `db:"id" json:"id"`
	ExternalId  string     `db:"external_id" json:"external_id"`
	WorkspaceId *uint      `db:"workspace_id" json:"workspace_id,omitempty"`
	MemberId    *uint      `db:"member_id" json:"member_id,omitempty"`
	TokenType   TokenType  `db:"token_type" json:"token_type"`
	TokenHash   string     `db:"token_hash" json:"-"`
	TokenPrefix *string    `db:"token_prefix" json:"-"`
	Name        string     `db:"name" json:"name"`
	PoolName    *string    `db:"pool_name" json:"pool_name,omitempty"`
	TenantId    *string    `db:"tenant_id" json:"tenant_id,omitempty"`
	ExpiresAt   *time.Time `db:"expires_at" json:"expires_at,omitempty"`
	CreatedAt   time.Time  `db:"created_at" json:"created_at"`
	LastUsedAt  *time.Time `db:"last_used_at" json:"last_used_at,omitempty"`
}

Token represents an authentication token For workspace_member tokens: WorkspaceId and MemberId are set For worker tokens: WorkspaceId and MemberId are nil, PoolName may be set For organization tokens: TenantId is set, WorkspaceId and MemberId are nil

type TokenType

type TokenType string

TokenType represents the type of authentication token.

const (
	TokenTypeClusterAdmin     TokenType = "cluster_admin"
	TokenTypeWorkspaceMember  TokenType = "workspace_member"
	TokenTypeWorker           TokenType = "worker"
	TokenTypeWorkspaceService TokenType = "workspace_service"
	TokenTypeOrganization     TokenType = "organization"
)

type TokenValidationResult

type TokenValidationResult struct {
	// Common
	TokenType TokenType
	TokenId   uint // Internal ID of the matched token

	// Workspace fields (set for workspace_member tokens)
	WorkspaceId   uint
	WorkspaceExt  string
	WorkspaceName string
	MemberId      uint
	MemberExt     string
	MemberEmail   string
	MemberRole    MemberRole

	// Worker fields (set for worker tokens)
	PoolName string

	// Organization fields (set for organization tokens)
	TenantId string
}

TokenValidationResult is returned when validating a token

type ToolsConfig

type ToolsConfig struct {
	// Builtin API-key integrations
	Integrations IntegrationsConfig `key:"integrations" json:"integrations"`

	// External MCP servers (tools auto-discovered and exposed as POSIX commands)
	MCP map[string]MCPServerConfig `key:"mcp" json:"mcp"`
}

ToolsConfig configures all tool sources: builtin integrations and MCP servers

type TransformRule added in v0.1.103

type TransformRule struct {
	Column  string `json:"column"`
	Source  string `json:"source"`
	Type    string `json:"type"`
	Extract string `json:"extract,omitempty"`
	Format  string `json:"format,omitempty"`
}

type View added in v0.1.103

type View struct {
	ID            string         `json:"id"`
	WorkspaceID   uint           `json:"workspace_id"`
	Name          string         `json:"name"`
	Description   string         `json:"description"`
	SourceDraftID string         `json:"source_draft_id,omitempty"`
	Definition    ViewDefinition `json:"definition"`
	CreatedAt     time.Time      `json:"created_at"`
	UpdatedAt     time.Time      `json:"updated_at"`
}

View is the persisted representation of a published view.

func (*View) SyncNameDescription added in v0.1.103

func (v *View) SyncNameDescription()

SyncNameDescription keeps the top-level view metadata and definition metadata aligned, preferring explicit top-level values when present.

type ViewConfig added in v0.1.125

type ViewConfig struct {
	Sync ViewSyncConfig `key:"sync" json:"sync"`
}

type ViewContextEntry added in v0.1.131

type ViewContextEntry struct {
	ID           string         `json:"id"`
	ViewID       string         `json:"view_id"`
	Timestamp    int64          `json:"timestamp"`
	EntryType    string         `json:"entry_type"`
	Content      string         `json:"content"`
	SourceTaskID string         `json:"source_task_id,omitempty"`
	Metadata     map[string]any `json:"metadata,omitempty"`
	CompactUpTo  int64          `json:"compact_up_to,omitempty"`
	SeqNum       int64          `json:"seq_num,omitempty"`
}

ViewContextEntry is a single record in a view's persistent context stream. The stream is append-only (S2-backed); compaction entries summarize prior entries up to a sequence frontier.

type ViewDefinition added in v0.1.103

type ViewDefinition struct {
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Agents      []string        `json:"agents"`
	Sheets      []SheetSpec     `json:"sheets"`
	Actions     []ComponentSpec `json:"actions,omitempty"`
	Settings    *ViewSettings   `json:"settings,omitempty"`
}

ViewDefinition is the JSON-serializable workbook schema for a view.

func (ViewDefinition) ComponentMatchesAgent added in v0.1.131

func (d ViewDefinition) ComponentMatchesAgent(comp ComponentSpec, refs map[string]struct{}) bool

ComponentMatchesAgent returns true if the component references any of the given agent match refs (case-insensitive).

type ViewMode added in v0.1.50

type ViewMode string

ViewMode distinguishes how a view's query was created.

const (
	ViewModeSmart ViewMode = "smart" // Created via LLM inference from name + guidance
	ViewModeQuery ViewMode = "query" // Created via structured filter
)

type ViewOutputFormat added in v0.1.50

type ViewOutputFormat string

ViewOutputFormat specifies how source view results are materialized.

const (
	ViewOutputFolder ViewOutputFormat = "folder" // Each result as a file in a directory
	ViewOutputFile   ViewOutputFormat = "file"   // All results in a single file
)

type ViewOutputSchemaBackend added in v0.1.110

type ViewOutputSchemaBackend interface {
	GetAgentProfile(ctx context.Context, workspaceID uint, agentID string) (*AgentProfile, error)
	GetView(ctx context.Context, workspaceID uint, viewID string) (*View, error)
	ListViews(ctx context.Context, workspaceID uint) ([]*View, error)
}

type ViewOutputSchemaColumn added in v0.1.110

type ViewOutputSchemaColumn struct {
	Key     string         `json:"key"`
	Label   string         `json:"label,omitempty"`
	Type    string         `json:"type,omitempty"`
	Options []StatusOption `json:"options,omitempty"`
}

type ViewOutputSchemaContext added in v0.1.110

type ViewOutputSchemaContext struct {
	ViewID         string                   `json:"view_id"`
	ViewName       string                   `json:"view_name,omitempty"`
	SheetID        string                   `json:"sheet_id"`
	SheetName      string                   `json:"sheet_name,omitempty"`
	ComponentID    string                   `json:"component_id"`
	ComponentTitle string                   `json:"component_title,omitempty"`
	ArtifactKey    string                   `json:"artifact_key,omitempty"`
	OutputType     string                   `json:"output_type,omitempty"`
	Columns        []ViewOutputSchemaColumn `json:"columns,omitempty"`
	Transform      []TransformRule          `json:"transform,omitempty"`
	TransformHints []string                 `json:"transform_hints,omitempty"`
}

func BuildViewOutputSchemaContext added in v0.1.125

func BuildViewOutputSchemaContext(view *View, sheet SheetSpec, comp ComponentSpec) *ViewOutputSchemaContext

BuildViewOutputSchemaContext builds a schema context for a single table component. Returns nil if the component has no usable columns.

func LoadViewOutputSchemaContexts added in v0.1.110

func LoadViewOutputSchemaContexts(
	ctx context.Context,
	backend ViewOutputSchemaBackend,
	workspaceID uint,
	agentID string,
	sourceViewIDs ...string,
) ([]ViewOutputSchemaContext, error)

func ParseViewOutputSchemaContexts added in v0.1.110

func ParseViewOutputSchemaContexts(value any) []ViewOutputSchemaContext

ParseViewOutputSchemaContexts recovers typed schema contexts from a generic value (typically read back from JSON-serialized execution policy).

func (ViewOutputSchemaContext) ColumnKeys added in v0.1.110

func (c ViewOutputSchemaContext) ColumnKeys() []string

func (ViewOutputSchemaContext) CompactColumns added in v0.1.110

func (c ViewOutputSchemaContext) CompactColumns() []map[string]any

func (ViewOutputSchemaContext) MatchLabel added in v0.1.110

func (c ViewOutputSchemaContext) MatchLabel() string

func (ViewOutputSchemaContext) SortKey added in v0.1.110

func (c ViewOutputSchemaContext) SortKey() string

type ViewSettings added in v0.1.131

type ViewSettings struct {
	ApprovalPolicy string `json:"approval_policy,omitempty"`
}

ViewSettings holds per-view configuration that controls agent behavior.

type ViewSyncConfig added in v0.1.125

type ViewSyncConfig struct {
	HighMatchThreshold float64 `key:"highMatchThreshold" json:"high_match_threshold"`
	ClassifyFloor      float64 `key:"classifyFloor" json:"classify_floor"`
	VectorLimit        int     `key:"vectorLimit" json:"vector_limit"`
	MinInsertCells     int     `key:"minInsertCells" json:"min_insert_cells"`
}

func (ViewSyncConfig) WithDefaults added in v0.1.125

func (c ViewSyncConfig) WithDefaults() ViewSyncConfig

type VirtualFile

type VirtualFile struct {
	ID         string                 `json:"id"`
	Name       string                 `json:"name"`
	Path       string                 `json:"path"`
	Type       VirtualFileType        `json:"type"`
	IsFolder   bool                   `json:"is_folder"`
	IsSymlink  bool                   `json:"is_symlink,omitempty"`
	IsReadOnly bool                   `json:"is_readonly,omitempty"`
	Size       int64                  `json:"size,omitempty"`
	ModifiedAt *time.Time             `json:"modified_at,omitempty"`
	ChildCount int                    `json:"child_count,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

VirtualFile represents a file or folder in the virtual filesystem

func NewRootFolder

func NewRootFolder(name, path string) *VirtualFile

func NewVirtualFile

func NewVirtualFile(id, name, path string, fileType VirtualFileType) *VirtualFile

func (*VirtualFile) WithChildCount

func (f *VirtualFile) WithChildCount(v int) *VirtualFile

func (*VirtualFile) WithFolder

func (f *VirtualFile) WithFolder(v bool) *VirtualFile

Builder methods for fluent construction

func (*VirtualFile) WithMetadata

func (f *VirtualFile) WithMetadata(key string, value interface{}) *VirtualFile

func (*VirtualFile) WithModifiedAt

func (f *VirtualFile) WithModifiedAt(t time.Time) *VirtualFile

func (*VirtualFile) WithReadOnly

func (f *VirtualFile) WithReadOnly(v bool) *VirtualFile

func (*VirtualFile) WithSize

func (f *VirtualFile) WithSize(v int64) *VirtualFile

type VirtualFileListResponse

type VirtualFileListResponse struct {
	Path    string        `json:"path"`
	Entries []VirtualFile `json:"entries"`
}

type VirtualFileSearchResponse added in v0.1.10

type VirtualFileSearchResponse struct {
	Query   string        `json:"query"`
	Results []VirtualFile `json:"results"`
}

type VirtualFileTreeResponse

type VirtualFileTreeResponse struct {
	Path    string        `json:"path"`
	Depth   int           `json:"depth"`
	Entries []VirtualFile `json:"entries"`
}

type VirtualFileType

type VirtualFileType string

VirtualFileType determines UI behavior and available operations

const (
	VFTypeContext VirtualFileType = "context" // S3-backed writable storage (skills, user files)
	VFTypeStorage VirtualFileType = "storage" // S3-backed storage files (alias for context)
	VFTypeSource  VirtualFileType = "source"  // Integration sources (github, gmail, etc)
	VFTypeTool    VirtualFileType = "tool"    // Available tools
	VFTypeTask    VirtualFileType = "task"    // Running/completed tasks
	VFTypeRoot    VirtualFileType = "root"    // Virtual root directories
)

type WidgetData added in v0.1.108

type WidgetData struct {
	WidgetID string          `json:"widget_id"`
	Type     string          `json:"type"`
	Metric   *MetricData     `json:"metric,omitempty"`
	MapData  *MapWidgetData  `json:"map_data,omitempty"`
	ListData *ListWidgetData `json:"list_data,omitempty"`
	Status   string          `json:"status,omitempty"`
	Error    string          `json:"error,omitempty"`
	CachedAt *time.Time      `json:"cached_at,omitempty"`
}

WidgetData is the resolved data for a single widget tile.

type WidgetSpec added in v0.1.108

type WidgetSpec struct {
	ID          string         `json:"id"`
	Type        string         `json:"type"`
	Title       string         `json:"title"`
	Description string         `json:"description,omitempty"`
	Config      map[string]any `json:"config,omitempty"`
	Size        string         `json:"size,omitempty"`
	W           int            `json:"w,omitempty"`
	H           int            `json:"h,omitempty"`
}

type Worker

type Worker struct {
	ID           string       `json:"id" redis:"id"`
	Status       WorkerStatus `json:"status" redis:"status"`
	PoolName     string       `json:"pool_name" redis:"pool_name"`
	Hostname     string       `json:"hostname" redis:"hostname"`
	Cpu          int64        `json:"cpu" redis:"cpu"`
	Memory       int64        `json:"memory" redis:"memory"`
	LastSeenAt   time.Time    `json:"last_seen_at" redis:"last_seen_at"`
	RegisteredAt time.Time    `json:"registered_at" redis:"registered_at"`
	Version      string       `json:"version" redis:"version"`
}

Worker represents a worker that can execute workloads

type WorkerInfo

type WorkerInfo struct {
	PoolName string
}

type WorkerJobOpts

type WorkerJobOpts struct {
	PoolName  string
	Cpu       int64
	Memory    int64
	Image     string
	Namespace string
	Labels    map[string]string
	Env       map[string]string
}

WorkerJobOpts contains options for creating a worker Kubernetes Job

type WorkerPaths

type WorkerPaths struct {
	// BundleDir is where sandbox bundles are created
	BundleDir string `key:"bundleDir" json:"bundle_dir"`

	// StateDir is where overlay state is stored (should be tmpfs)
	StateDir string `key:"stateDir" json:"state_dir"`

	// MountDir is where per-task FUSE mounts are created
	MountDir string `key:"mountDir" json:"mount_dir"`

	// CLIBinary is the path to the CLI binary for mounting
	CLIBinary string `key:"cliBinary" json:"cli_binary"`

	// WorkerMount is the global worker FUSE mount path
	WorkerMount string `key:"workerMount" json:"worker_mount"`
}

WorkerPaths configures filesystem paths for the worker

func DefaultWorkerPaths

func DefaultWorkerPaths() WorkerPaths

DefaultWorkerPaths returns sensible defaults for worker paths

type WorkerPoolConfig

type WorkerPoolConfig struct {
	// DeploymentName is the K8s Deployment to scale (auto-generated if empty)
	DeploymentName string `key:"deploymentName" json:"deployment_name"`

	// Namespace is the K8s namespace
	Namespace string `key:"namespace" json:"namespace"`

	// MinReplicas is the minimum number of workers
	MinReplicas int32 `key:"minReplicas" json:"min_replicas"`

	// MaxReplicas is the maximum number of workers
	MaxReplicas int32 `key:"maxReplicas" json:"max_replicas"`

	// ScaleDownDelay is how long queue must be empty before scaling down
	ScaleDownDelay time.Duration `key:"scaleDownDelay" json:"scale_down_delay"`

	// Cpu is the CPU request/limit for workers (e.g., "500m", "1")
	Cpu string `key:"cpu" json:"cpu"`

	// Memory is the memory request/limit for workers (e.g., "512Mi", "1Gi")
	Memory string `key:"memory" json:"memory"`

	// RuntimeClassName optionally sets PodSpec.RuntimeClassName.
	RuntimeClassName string `key:"runtimeClassName" json:"runtime_class_name"`

	// NodeSelector pins workers to specific nodes.
	NodeSelector map[string]string `key:"nodeSelector" json:"node_selector"`
}

WorkerPoolConfig defines the configuration for a worker pool

func NewWorkerPoolConfig

func NewWorkerPoolConfig() *WorkerPoolConfig

NewWorkerPoolConfig creates a new WorkerPoolConfig with default values

type WorkerPoolState

type WorkerPoolState struct {
	Name             string           `json:"name"`
	Status           WorkerPoolStatus `json:"status"`
	TotalWorkers     int              `json:"total_workers"`
	AvailableWorkers int              `json:"available_workers"`
}

WorkerPoolState represents the current state of a worker pool

type WorkerPoolStatus

type WorkerPoolStatus string

WorkerPoolStatus represents the health status of a worker pool

const (
	WorkerPoolStatusHealthy  WorkerPoolStatus = "healthy"
	WorkerPoolStatusDegraded WorkerPoolStatus = "degraded"
)

type WorkerStatus

type WorkerStatus string

WorkerStatus represents the status of a worker

const (
	WorkerStatusPending   WorkerStatus = "pending"
	WorkerStatusAvailable WorkerStatus = "available"
	WorkerStatusBusy      WorkerStatus = "busy"
	WorkerStatusDraining  WorkerStatus = "draining"
	WorkerStatusOffline   WorkerStatus = "offline"
)

type Workspace

type Workspace struct {
	Id         uint      `json:"id" db:"id"`                   // Internal ID for joins
	ExternalId string    `json:"external_id" db:"external_id"` // External UUID for API
	Name       string    `json:"name" db:"name"`
	TenantId   *string   `json:"tenant_id,omitempty" db:"tenant_id"` // Nullable tenant scoping tag
	CreatedAt  time.Time `json:"created_at" db:"created_at"`
	UpdatedAt  time.Time `json:"updated_at" db:"updated_at"`
}

Workspace represents a workspace that contains tasks

type WorkspaceInfo

type WorkspaceInfo struct {
	Id         uint
	ExternalId string
	Name       string
}

type WorkspaceMember

type WorkspaceMember struct {
	Id          uint       `db:"id" json:"id"`
	ExternalId  string     `db:"external_id" json:"external_id"`
	WorkspaceId uint       `db:"workspace_id" json:"workspace_id"`
	Email       string     `db:"email" json:"email"`
	Name        string     `db:"name" json:"name"`
	Role        MemberRole `db:"role" json:"role"`
	CreatedAt   time.Time  `db:"created_at" json:"created_at"`
	UpdatedAt   time.Time  `db:"updated_at" json:"updated_at"`
}

WorkspaceMember represents a user who belongs to a workspace

type WorkspaceStorageConfig

type WorkspaceStorageConfig struct {
	DefaultBucketPrefix string `key:"defaultBucketPrefix" json:"default_bucket_prefix"`
	DefaultAccessKey    string `key:"defaultAccessKey" json:"default_access_key"`
	DefaultSecretKey    string `key:"defaultSecretKey" json:"default_secret_key"`
	DefaultEndpointUrl  string `key:"defaultEndpointUrl" json:"default_endpoint_url"`
	DefaultRegion       string `key:"defaultRegion" json:"default_region"`
	// PublicEndpointUrl is the browser-reachable S3 endpoint used in presigned URLs.
	// When set, presigned URLs have their host rewritten from DefaultEndpointUrl to this value.
	// Leave empty in production where S3 presigned URLs are already publicly reachable.
	PublicEndpointUrl string `key:"publicEndpointUrl" json:"public_endpoint_url"`
}

WorkspaceStorageConfig for per-workspace S3 buckets (bucket: {prefix}-{workspace_id})

func (WorkspaceStorageConfig) IsConfigured

func (c WorkspaceStorageConfig) IsConfigured() bool

type WorkspaceTool

type WorkspaceTool struct {
	Id                uint                      `json:"id" db:"id"`
	ExternalId        string                    `json:"external_id" db:"external_id"`
	WorkspaceId       uint                      `json:"workspace_id" db:"workspace_id"`
	Name              string                    `json:"name" db:"name"`
	ProviderType      WorkspaceToolProviderType `json:"provider_type" db:"provider_type"`
	Config            json.RawMessage           `json:"config" db:"config"`               // Serialized MCPServerConfig
	Manifest          json.RawMessage           `json:"manifest,omitempty" db:"manifest"` // Cached tools/list output
	CreatedByMemberId *uint                     `json:"created_by_member_id,omitempty" db:"created_by_member_id"`
	CreatedAt         time.Time                 `json:"created_at" db:"created_at"`
	UpdatedAt         time.Time                 `json:"updated_at" db:"updated_at"`
}

WorkspaceTool represents a workspace-scoped tool provider stored in the database

func (*WorkspaceTool) GetMCPConfig

func (t *WorkspaceTool) GetMCPConfig() (*MCPServerConfig, error)

GetMCPConfig deserializes the config as MCPServerConfig

func (*WorkspaceTool) SetMCPConfig

func (t *WorkspaceTool) SetMCPConfig(cfg *MCPServerConfig) error

SetMCPConfig serializes an MCPServerConfig into the config field

type WorkspaceToolOrigin

type WorkspaceToolOrigin string

WorkspaceToolOrigin indicates where a tool comes from

const (
	ToolOriginGlobal    WorkspaceToolOrigin = "global"
	ToolOriginWorkspace WorkspaceToolOrigin = "workspace"
)

type WorkspaceToolProviderType

type WorkspaceToolProviderType string

WorkspaceToolProviderType represents the type of tool provider

const (
	// ProviderTypeMCP is an MCP server (stdio or remote)
	ProviderTypeMCP WorkspaceToolProviderType = "mcp"
)

type WorkspaceToolResponse

type WorkspaceToolResponse struct {
	ExternalId   string    `json:"external_id"`
	Name         string    `json:"name"`
	ProviderType string    `json:"provider_type"`
	ToolCount    int       `json:"tool_count,omitempty"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

WorkspaceToolResponse is the API response for a workspace tool

type WorkspaceToolSetting

type WorkspaceToolSetting struct {
	Id          uint      `json:"id" db:"id"`
	WorkspaceId uint      `json:"workspace_id" db:"workspace_id"`
	ToolName    string    `json:"tool_name" db:"tool_name"`
	Enabled     bool      `json:"enabled" db:"enabled"`
	CreatedAt   time.Time `json:"created_at" db:"created_at"`
	UpdatedAt   time.Time `json:"updated_at" db:"updated_at"`
}

WorkspaceToolSetting represents the enabled/disabled state of a single tool for a workspace

type WorkspaceToolSettings

type WorkspaceToolSettings struct {
	WorkspaceId uint
	// DisabledTools is a set of tool names that are disabled
	// Tools not in this map are enabled by default
	DisabledTools map[string]bool
}

WorkspaceToolSettings is a collection of tool settings for a workspace Provides helper methods for checking tool state

func NewWorkspaceToolSettings

func NewWorkspaceToolSettings(workspaceId uint) *WorkspaceToolSettings

NewWorkspaceToolSettings creates a new WorkspaceToolSettings instance

func (*WorkspaceToolSettings) IsDisabled

func (s *WorkspaceToolSettings) IsDisabled(toolName string) bool

IsDisabled returns true if the tool is disabled for this workspace

func (*WorkspaceToolSettings) IsEnabled

func (s *WorkspaceToolSettings) IsEnabled(toolName string) bool

IsEnabled returns true if the tool is enabled for this workspace

func (*WorkspaceToolSettings) SetEnabled

func (s *WorkspaceToolSettings) SetEnabled(toolName string, enabled bool)

SetEnabled sets the enabled state for a tool

Jump to

Keyboard shortcuts

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