Documentation
¶
Index ¶
- type AdminWorkspaceInfo
- type AgentCard
- type AgentInfo
- type AgentInteraction
- type AgentMessage
- type AgentRegistrationCode
- type AgentSession
- type AgentSessionEvent
- type AgentSessionWorker
- type AgentTask
- type AttachResult
- type CodexBrowserSession
- type CodexToken
- type CreateTUISessionParams
- type CredentialBinding
- type CredentialBindingMeta
- type DB
- func (db *DB) AddWorkspaceMember(workspaceID, userID, role string) error
- func (db *DB) AddWorkspaceVolume(id, workspaceID, pvcName, mountPath string) error
- func (db *DB) ArchiveAgentSession(id string) error
- func (db *DB) AttachResponder(ctx context.Context, sessionID, executorID string, becomePreferred bool) (AttachResult, error)
- func (db *DB) BindSandboxToChannel(sandboxID, channelID string) error
- func (db *DB) BumpAgentSessionEpoch(id string) (int, error)
- func (db *DB) ClaimActiveTurn(ctx context.Context, sessionID, turnID string) (bool, error)
- func (db *DB) ClearActiveTurn(ctx context.Context, sessionID, expectedTurnID string) error
- func (db *DB) ClearResponder(ctx context.Context, sessionID string) error
- func (db *DB) CloseCodexBrowserSession(ctx context.Context, id string) error
- func (db *DB) ConsumeAgentRegistrationCode(code string) (*AgentRegistrationCode, error)
- func (db *DB) CountCredentialBindings(workspaceID, kind string) (int, error)
- func (db *DB) CountOpenCodexBrowserSessions(ctx context.Context, tokenID string) (int, error)
- func (db *DB) CountSandboxesByWorkspace(workspaceID string) (int, error)
- func (db *DB) CountUsers() (int, error)
- func (db *DB) CountWorkspacesOwnedByUser(userID string) (int, error)
- func (db *DB) CreateAgentRegistrationCode(code, userID, workspaceID string, expiresAt time.Time) error
- func (db *DB) CreateAgentSession(id string, sandboxID *string, workspaceID, title string, tags []string) error
- func (db *DB) CreateAgentSessionTUI(ctx context.Context, p CreateTUISessionParams) error
- func (db *DB) CreateAgentTask(t *AgentTask) error
- func (db *DB) CreateCodexBrowserSession(ctx context.Context, s CodexBrowserSession) error
- func (db *DB) CreateCodexToken(ctx context.Context, t CodexToken) error
- func (db *DB) CreateCredentialBinding(b *CredentialBinding) error
- func (db *DB) CreateIMBinding(sandboxID, provider, botID, userID string) error
- func (db *DB) CreateIMChannel(workspaceID, provider, botID, userID string) (string, error)
- func (db *DB) CreateLocalSandbox(...) error
- func (db *DB) CreateOIDCIdentity(provider, subject, userID string, email *string) error
- func (db *DB) CreateSandbox(...) error
- func (db *DB) CreateSandboxProxyToken(token, sandboxID, workspaceID string) error
- func (db *DB) CreateToken(token, userID string, expiresAt time.Time) error
- func (db *DB) CreateUser(id, email, passwordHash string) error
- func (db *DB) CreateUserWithEmail(id string, passwordHash *string, email string) error
- func (db *DB) CreateWorkspace(id, name string) error
- func (db *DB) DeleteAgentCard(sandboxID string) error
- func (db *DB) DeleteCredentialBinding(id string) error
- func (db *DB) DeleteExpiredTokens() error
- func (db *DB) DeleteIMBinding(sandboxID, provider, botID string) error
- func (db *DB) DeleteIMChannel(channelID string) error
- func (db *DB) DeleteModelserverConnection(workspaceID string) error
- func (db *DB) DeleteSandbox(id string) error
- func (db *DB) DeleteUserQuota(userID string) error
- func (db *DB) DeleteWorkspace(id string) error
- func (db *DB) DeleteWorkspaceLLMConfig(workspaceID string) error
- func (db *DB) DeleteWorkspaceQuota(workspaceID string) error
- func (db *DB) FailAgentTask(id, reason string) error
- func (db *DB) GetActiveBindings(provider string) ([]*IMBinding, error)
- func (db *DB) GetActiveBindingsForSandbox(sandboxID string) ([]*IMBinding, error)
- func (db *DB) GetActiveTurn(ctx context.Context, sessionID string) (string, error)
- func (db *DB) GetAgentCard(sandboxID string) (*AgentCard, error)
- func (db *DB) GetAgentInfo(sandboxID string) (*AgentInfo, error)
- func (db *DB) GetAgentSession(id string) (*AgentSession, error)
- func (db *DB) GetAgentSessionEpoch(id string) (int, error)
- func (db *DB) GetAgentSessionEventsSince(sessionID string, sinceSeqNum int64, limit int) ([]AgentSessionEvent, error)
- func (db *DB) GetAgentSessionEventsTail(sessionID string, n int) ([]AgentSessionEvent, error)
- func (db *DB) GetAgentSessionInternalEventsSince(sessionID string, sinceID int64, limit int) ([]struct{ ... }, error)
- func (db *DB) GetAgentSessionWorker(sessionID string, epoch int) (*AgentSessionWorker, error)
- func (db *DB) GetAgentTask(id string) (*AgentTask, error)
- func (db *DB) GetAllChannelMeta(channelID, userID string) (map[string]string, error)
- func (db *DB) GetAllProviderMeta(sandboxID, provider, botID, userID string) (map[string]string, error)
- func (db *DB) GetAllWorkspaceNamespaces() ([]string, error)
- func (db *DB) GetChannelMeta(channelID, userID, key string) (string, error)
- func (db *DB) GetChannelRequireMention(channelID string) (bool, error)
- func (db *DB) GetCodexToken(ctx context.Context, id string) (*CodexToken, error)
- func (db *DB) GetCredentialBinding(id string) (*CredentialBinding, error)
- func (db *DB) GetIMChannel(channelID string) (*IMChannel, error)
- func (db *DB) GetIMChannelForSandbox(sandboxID string) (*IMChannel, error)
- func (db *DB) GetIMCredentials(sandboxID, provider, botID string) (botToken, baseURL string, err error)
- func (db *DB) GetModelserverConnection(workspaceID string) (*ModelserverConnection, error)
- func (db *DB) GetOIDCIdentity(provider, subject string) (*OIDCIdentity, error)
- func (db *DB) GetOrCreateWorkspaceToken(workspaceID string) (string, error)
- func (db *DB) GetPasswordHash(userID string) (*string, error)
- func (db *DB) GetProviderMeta(sandboxID, provider, botID, userID, key string) (string, error)
- func (db *DB) GetProxyToken(token string) (*ProxyToken, error)
- func (db *DB) GetSandbox(id string) (*Sandbox, error)
- func (db *DB) GetSandboxByAnyToken(token string) (*Sandbox, error)
- func (db *DB) GetSandboxByProxyToken(proxyToken string) (*Sandbox, error)
- func (db *DB) GetSandboxByShortID(shortID string) (*Sandbox, error)
- func (db *DB) GetSandboxByTunnelToken(sandboxID, tunnelToken string) (*Sandbox, error)
- func (db *DB) GetSandboxForChannel(channelID string) (sandboxID, podIP, bridgeSecret, assistantName string, err error)
- func (db *DB) GetSessionByExternalID(ctx context.Context, workspaceID, externalID string) (*AgentSession, error)
- func (db *DB) GetSystemSetting(key string) (string, error)
- func (db *DB) GetUserByEmail(email string) (*User, error)
- func (db *DB) GetUserByID(id string) (*User, error)
- func (db *DB) GetUserQuota(userID string) (*UserQuota, error)
- func (db *DB) GetWorkspace(id string) (*Workspace, error)
- func (db *DB) GetWorkspaceLLMConfig(workspaceID string) (*WorkspaceLLMConfig, error)
- func (db *DB) GetWorkspaceMember(workspaceID, userID string) (*WorkspaceMember, error)
- func (db *DB) GetWorkspaceMemberRole(workspaceID, userID string) (string, error)
- func (db *DB) GetWorkspaceQuota(workspaceID string) (*WorkspaceQuota, error)
- func (db *DB) HasModelserverConnection(workspaceID string) (bool, error)
- func (db *DB) InsertAgentSessionEvents(sessionID string, events []AgentSessionEvent) ([]InsertedEvent, error)
- func (db *DB) InsertAgentSessionInternalEvents(sessionID string, events []struct{ ... }) error
- func (db *DB) InsertOperation(o Operation) error
- func (db *DB) IsWorkspaceMember(workspaceID, userID string) (bool, error)
- func (db *DB) LatestCodexBrowserSession(ctx context.Context, tokenID string) (*CodexBrowserSession, error)
- func (db *DB) ListAgentCardsByWorkspace(workspaceID string) ([]AgentCard, error)
- func (db *DB) ListAgentTasksByWorkspace(workspaceID string, limit int) ([]AgentTask, error)
- func (db *DB) ListAllActiveChannels(provider string) ([]IMChannel, error)
- func (db *DB) ListAllActiveSandboxNames() ([]string, error)
- func (db *DB) ListAllSandboxes() ([]*Sandbox, error)
- func (db *DB) ListAllUsers() ([]*User, error)
- func (db *DB) ListAllWorkspaces() ([]*Workspace, error)
- func (db *DB) ListAllWorkspacesAdmin() ([]*AdminWorkspaceInfo, error)
- func (db *DB) ListCodexTokensForWorkspace(ctx context.Context, workspaceID string, includeRevoked bool) ([]CodexToken, error)
- func (db *DB) ListCredentialBindings(workspaceID, kind string) ([]*CredentialBinding, error)
- func (db *DB) ListCredentialBindingsMeta(workspaceID, kind string) ([]*CredentialBindingMeta, error)
- func (db *DB) ListIMBindings(sandboxID, provider string) ([]*IMBinding, error)
- func (db *DB) ListIMChannels(workspaceID string) ([]IMChannel, error)
- func (db *DB) ListIdleSandboxes(defaultTimeoutSeconds int) ([]*Sandbox, error)
- func (db *DB) ListInteractions(workspaceID string, limit, offset int) ([]AgentInteraction, error)
- func (db *DB) ListOperations(f OperationFilter) ([]Operation, error)
- func (db *DB) ListPendingAgentTasksByTarget(targetID string, limit int) ([]AgentTask, error)
- func (db *DB) ListSandboxesByWorkspace(workspaceID string) ([]*Sandbox, error)
- func (db *DB) ListSessionsByChannel(ctx context.Context, workspaceID, channelType, executorID string, limit int) ([]SessionListItem, error)
- func (db *DB) ListStaleActiveTurns(ctx context.Context, cutoff time.Time) ([]StaleActiveTurn, error)
- func (db *DB) ListStaleResponders(ctx context.Context, cutoff time.Time) ([]string, error)
- func (db *DB) ListWorkspaceMembers(workspaceID string) ([]*WorkspaceMember, error)
- func (db *DB) ListWorkspaceVolumes(workspaceID string) ([]WorkspaceVolume, error)
- func (db *DB) ListWorkspacesByUser(userID string) ([]*Workspace, error)
- func (db *DB) ListWorkspacesWithoutNamespace() ([]*Workspace, error)
- func (db *DB) LogInteraction(i *AgentInteraction)
- func (db *DB) MarkStaleAgentCardsOffline(threshold time.Duration) (int64, error)
- func (db *DB) PruneOperationsOlderThan(cutoff time.Time) (int64, error)
- func (db *DB) ReadInbox(toID string, limit int) ([]AgentMessage, error)
- func (db *DB) RemoveWorkspaceMember(workspaceID, userID string) error
- func (db *DB) RevokeCodexToken(ctx context.Context, id string) error
- func (db *DB) SaveIMChannelCredentials(channelID, botToken, baseURL string) error
- func (db *DB) SaveIMCredentials(sandboxID, provider, botID, botToken, baseURL string) error
- func (db *DB) SendMessage(msg *AgentMessage) error
- func (db *DB) SetCredentialBindingDefault(workspaceID, kind, id string) error
- func (db *DB) SetModelserverConnection(c *ModelserverConnection) error
- func (db *DB) SetPasswordHash(userID, hash string) error
- func (db *DB) SetSessionCodexThreadID(ctx context.Context, sessionID string, threadID *string) error
- func (db *DB) SetSessionExternalID(ctx context.Context, sessionID, externalID string) error
- func (db *DB) SetSessionIMChannel(ctx context.Context, sessionID, channelID string) error
- func (db *DB) SetSystemSetting(key, value string) error
- func (db *DB) SetUserQuota(userID string, maxWorkspaces *int) error
- func (db *DB) SetWorkspaceLLMConfig(workspaceID, baseURL, apiKey string, models []LLMModel) error
- func (db *DB) SetWorkspaceNamespace(id, namespace string) error
- func (db *DB) SetWorkspaceQuota(workspaceID string, maxSandboxes *int, maxSandboxCPU *int, ...) error
- func (db *DB) SumWorkspaceSandboxResources(workspaceID string) (cpuMillis int64, memBytes int64, err error)
- func (db *DB) SweepStaleCodexBrowserSessions(ctx context.Context, olderThan time.Time) (int64, error)
- func (db *DB) TouchCodexToken(ctx context.Context, id string) error
- func (db *DB) UnbindSandboxFromChannel(sandboxID string) error
- func (db *DB) UpdateAgentCardStatus(sandboxID, status string) error
- func (db *DB) UpdateAgentSessionWorkerHeartbeat(sessionID string, epoch int) error
- func (db *DB) UpdateAgentSessionWorkerState(sessionID string, epoch int, state string, ...) error
- func (db *DB) UpdateAgentTaskResult(id string, resultJSON json.RawMessage, totalCostUSD *float64, numTurns int) error
- func (db *DB) UpdateAgentTaskStatus(id, status string) error
- func (db *DB) UpdateCursor(sandboxID, provider, botID, cursor string) error
- func (db *DB) UpdateIMChannelCursor(channelID, cursor string) error
- func (db *DB) UpdateIMChannelRoutingMode(channelID, mode string) error
- func (db *DB) UpdateIMChannelSettings(channelID string, requireMention bool) error
- func (db *DB) UpdateModelserverTokens(workspaceID, accessToken, refreshToken string, expiresAt time.Time) error
- func (db *DB) UpdateOIDCIdentityEmail(provider, subject, email string) error
- func (db *DB) UpdateSandboxActivity(id string) error
- func (db *DB) UpdateSandboxHeartbeat(id string) error
- func (db *DB) UpdateSandboxName(id, name string) error
- func (db *DB) UpdateSandboxNanoclawBridgeSecret(id, secret string) error
- func (db *DB) UpdateSandboxPodIP(id, podIP string) error
- func (db *DB) UpdateSandboxSandboxName(id, sandboxName string) error
- func (db *DB) UpdateSandboxStatus(id, status string) error
- func (db *DB) UpdateUserEmail(userID, email string) error
- func (db *DB) UpdateUserName(userID, name string) error
- func (db *DB) UpdateUserPicture(userID, picture string) error
- func (db *DB) UpdateUserRole(userID, role string) error
- func (db *DB) UpdateWorkspaceMemberRole(workspaceID, userID, role string) error
- func (db *DB) UpdateWorkspaceName(id, name string) error
- func (db *DB) UpsertAgentCard(card *AgentCard) error
- func (db *DB) UpsertAgentCardFromCapabilities(sandboxID, workspaceID, displayName string, cardJSON json.RawMessage) error
- func (db *DB) UpsertAgentInfo(info *AgentInfo) error
- func (db *DB) UpsertAgentSessionWorker(sessionID string, epoch int) error
- func (db *DB) UpsertChannelMeta(channelID, userID, key, value string) error
- func (db *DB) UpsertProviderMeta(sandboxID, provider, botID, userID, key, value string) error
- func (db *DB) ValidateToken(token string) (string, error)
- type IMBinding
- type IMChannel
- type InsertedEvent
- type LLMModel
- type ModelserverConnection
- type OIDCIdentity
- type Operation
- type OperationFilter
- type ProxyToken
- type ProxyTokenType
- type Sandbox
- type SessionListItem
- type StaleActiveTurn
- type User
- type UserQuota
- type Workspace
- type WorkspaceLLMConfig
- type WorkspaceMember
- type WorkspaceQuota
- type WorkspaceVolume
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminWorkspaceInfo ¶ added in v0.18.3
type AdminWorkspaceInfo struct {
Workspace
OwnerID *string
OwnerEmail *string
OwnerName *string
OwnerPicture *string
SandboxCount int
}
AdminWorkspaceInfo holds enriched workspace data for the admin panel.
type AgentCard ¶ added in v0.30.0
type AgentCard struct {
SandboxID string
WorkspaceID string
AgentType string
DisplayName string
Description string
CardJSON json.RawMessage
AgentStatus string
Version int
UpdatedAt time.Time
}
AgentCard stores an agent's capability declaration.
type AgentInfo ¶ added in v0.16.0
type AgentInfo struct {
SandboxID string `json:"sandbox_id"`
Hostname string `json:"hostname"`
OS string `json:"os"`
Platform string `json:"platform"`
PlatformVersion string `json:"platform_version"`
KernelArch string `json:"kernel_arch"`
CPUModelName string `json:"cpu_model_name"`
CPUCountLogical int `json:"cpu_count_logical"`
MemoryTotal int64 `json:"memory_total"`
DiskTotal int64 `json:"disk_total"`
DiskFree int64 `json:"disk_free"`
AgentVersion string `json:"agent_version"`
OpencodeVersion string `json:"opencode_version"`
Workdir string `json:"workdir"`
HostInfo json.RawMessage `json:"host_info"`
CPUInfo json.RawMessage `json:"cpu_info"`
MemoryInfo json.RawMessage `json:"memory_info"`
DiskInfo json.RawMessage `json:"disk_info"`
Capabilities json.RawMessage `json:"capabilities"`
UpdatedAt time.Time `json:"updated_at"`
}
AgentInfo holds system information reported by a local agent.
type AgentInteraction ¶ added in v0.36.0
type AgentInteraction struct {
ID int64
WorkspaceID string
ActorID *string
Action string // "task_created", "task_status_changed", "task_cancelled", "message_sent"
TargetID string
TargetType string // "task" or "message"
DetailJSON json.RawMessage
CreatedAt time.Time
}
AgentInteraction is an audit trail entry for multi-agent activity.
type AgentMessage ¶ added in v0.36.0
type AgentMessage struct {
ID string
WorkspaceID string
FromID string
ToID string
Text string
MsgType string
CreatedAt time.Time
ReadAt sql.NullTime
}
AgentMessage represents a mailbox message between agents.
type AgentRegistrationCode ¶
type AgentSession ¶ added in v0.30.0
type AgentSession struct {
ID string
SandboxID *string
WorkspaceID string
Title string
Status string
Epoch int
Tags []string
IMChannelID *string // set when session is created from an IM inbound message
CreatedAt time.Time
UpdatedAt time.Time
ArchivedAt sql.NullTime
// TUI fields (added in migration 021)
ChannelType string
CreatorUserID *string // NULL for legacy IM rows
PreferredModel *string
PermissionMode string
PreferredExecutorID *string
PermissionResponder *string
ResponderAttachedAt *time.Time
ActiveTurnID *string
CodexThreadID *string `json:"codex_thread_id,omitempty"`
}
AgentSession represents a bridge session.
type AgentSessionEvent ¶ added in v0.30.0
type AgentSessionEvent struct {
ID int64 // sequence_num (BIGSERIAL)
SessionID string
EventID string
EventType string
Source string
Epoch int
Payload json.RawMessage
Ephemeral bool
CreatedAt time.Time
}
AgentSessionEvent is a single event in a session's event log.
type AgentSessionWorker ¶ added in v0.30.0
type AgentSessionWorker struct {
SessionID string
Epoch int
State string
ExternalMetadata json.RawMessage
RequiresActionDetails json.RawMessage
LastHeartbeatAt time.Time
RegisteredAt time.Time
}
AgentSessionWorker tracks worker state per epoch.
type AgentTask ¶ added in v0.30.0
type AgentTask struct {
ID string
WorkspaceID string
RequesterID sql.NullString
TargetID string
SessionID sql.NullString
Skill sql.NullString
Prompt string
SystemContext sql.NullString
Status string
ResultJSON *json.RawMessage
FailureReason sql.NullString
TimeoutSeconds int
DelegationChain []string
TotalCostUSD *float64
NumTurns int
CreatedAt time.Time
AcceptedAt sql.NullTime
CompletedAt sql.NullTime
}
AgentTask represents a delegated task.
type AttachResult ¶ added in v0.47.0
AttachResult holds the previous responder/preferred state before an AttachResponder call.
type CodexBrowserSession ¶ added in v0.62.3
type CodexBrowserSession struct {
ID string
TokenID string
ClientIP string
ClientUA string
CodexVersion string
OS string
ConnectedAt time.Time
DisconnectedAt *time.Time
}
CodexBrowserSession is a single live (or historical) `codex --remote` ws connection. The row is inserted by CXG on ws accept and stamped with disconnected_at on ws close. Multiple concurrent rows per token_id are supported — a token can be used from N machines simultaneously.
type CodexToken ¶ added in v0.50.7
type CodexToken struct {
ID string
UserID string
WorkspaceID string
Name string
TokenHash string
CreatedAt time.Time
ExpiresAt time.Time
LastUsedAt *time.Time
RevokedAt *time.Time
}
CodexToken is one row from codex_remote_tokens.
type CreateTUISessionParams ¶ added in v0.47.0
type CreateTUISessionParams struct {
ID string
WorkspaceID string
ExternalID string
Title string
CreatorUserID string
PermissionMode string
PreferredExecutorID string
PreferredModel string
}
CreateTUISessionParams holds parameters for creating a TUI-originated session.
type CredentialBinding ¶ added in v0.36.0
type CredentialBinding struct {
ID string
WorkspaceID string
Kind string
DisplayName string
ServerURL string
PublicMeta json.RawMessage
AuthType string
AuthBlob []byte
IsDefault bool
CreatedAt time.Time
UpdatedAt time.Time
}
CredentialBinding represents a row in the credential_bindings table.
type CredentialBindingMeta ¶ added in v0.36.0
type CredentialBindingMeta struct {
ID string
WorkspaceID string
Kind string
DisplayName string
ServerURL string
PublicMeta json.RawMessage
AuthType string
IsDefault bool
CreatedAt time.Time
UpdatedAt time.Time
}
CredentialBindingMeta is a credential binding without the encrypted auth blob.
type DB ¶
DB wraps a *sql.DB with migration support.
func (*DB) AddWorkspaceMember ¶
func (*DB) AddWorkspaceVolume ¶ added in v0.9.0
func (*DB) ArchiveAgentSession ¶ added in v0.30.0
func (*DB) AttachResponder ¶ added in v0.47.0
func (db *DB) AttachResponder(ctx context.Context, sessionID, executorID string, becomePreferred bool) (AttachResult, error)
AttachResponder sets permission_responder (and optionally preferred_executor_id) for a session. Returns the previous values before the update. Uses a single CTE-based statement to avoid a SELECT-then-UPDATE race when two callers attach concurrently.
func (*DB) BindSandboxToChannel ¶ added in v0.27.0
BindSandboxToChannel binds a sandbox to a workspace IM channel. Any other sandbox previously bound to this channel is unbound first.
func (*DB) BumpAgentSessionEpoch ¶ added in v0.30.0
BumpAgentSessionEpoch atomically increments the epoch and returns the new value.
func (*DB) ClaimActiveTurn ¶ added in v0.47.0
ClaimActiveTurn atomically sets active_turn_id if no turn is currently active. Returns (true, nil) if the claim succeeded, (false, nil) if another turn is active.
func (*DB) ClearActiveTurn ¶ added in v0.47.0
ClearActiveTurn clears active_turn_id only if it matches expectedTurnID (CAS).
func (*DB) ClearResponder ¶ added in v0.47.0
ClearResponder clears permission_responder and responder_attached_at for a session.
func (*DB) CloseCodexBrowserSession ¶ added in v0.62.3
CloseCodexBrowserSession stamps disconnected_at. Idempotent: a missing or already-closed row is a no-op.
func (*DB) ConsumeAgentRegistrationCode ¶
func (db *DB) ConsumeAgentRegistrationCode(code string) (*AgentRegistrationCode, error)
ConsumeAgentRegistrationCode atomically validates and marks a code as used. Returns the code record if valid, nil if not found/expired/used.
func (*DB) CountCredentialBindings ¶ added in v0.36.0
func (*DB) CountOpenCodexBrowserSessions ¶ added in v0.62.3
CountOpenCodexBrowserSessions returns the number of open (disconnected_at IS NULL) sessions for a token. Used by the Browsers list endpoint to set is_online without iterating all rows.
func (*DB) CountSandboxesByWorkspace ¶ added in v0.7.0
func (*DB) CountUsers ¶ added in v0.6.1
func (*DB) CountWorkspacesOwnedByUser ¶ added in v0.7.0
func (*DB) CreateAgentRegistrationCode ¶
func (db *DB) CreateAgentRegistrationCode(code, userID, workspaceID string, expiresAt time.Time) error
CreateAgentRegistrationCode inserts a new one-time registration code.
func (*DB) CreateAgentSession ¶ added in v0.30.0
func (*DB) CreateAgentSessionTUI ¶ added in v0.47.0
func (db *DB) CreateAgentSessionTUI(ctx context.Context, p CreateTUISessionParams) error
CreateAgentSessionTUI creates a new session with channel_type='tui'.
func (*DB) CreateAgentTask ¶ added in v0.30.0
func (*DB) CreateCodexBrowserSession ¶ added in v0.62.3
func (db *DB) CreateCodexBrowserSession(ctx context.Context, s CodexBrowserSession) error
CreateCodexBrowserSession inserts a new session row. The caller supplies the id (cryptographic random, namespaced separately from token ids so a leaked session id can't be confused with a token).
func (*DB) CreateCodexToken ¶ added in v0.50.7
func (db *DB) CreateCodexToken(ctx context.Context, t CodexToken) error
CreateCodexToken inserts a new row. Caller mints the bcrypt hash.
func (*DB) CreateCredentialBinding ¶ added in v0.36.0
func (db *DB) CreateCredentialBinding(b *CredentialBinding) error
func (*DB) CreateIMBinding ¶ added in v0.27.0
CreateIMBinding inserts or updates an IM binding record. On conflict (same sandbox+provider+bot), updates user_id and bound_at.
func (*DB) CreateIMChannel ¶ added in v0.27.0
CreateIMChannel inserts or updates a workspace IM channel record. On conflict (same workspace+provider+bot), updates bound_at. Returns the channel ID.
func (*DB) CreateLocalSandbox ¶
func (db *DB) CreateLocalSandbox(id, workspaceID, name, sandboxType, opencodeToken, proxyToken, tunnelToken, shortID string) error
CreateLocalSandbox inserts a local agent sandbox with is_local=true.
func (*DB) CreateOIDCIdentity ¶
func (*DB) CreateSandbox ¶
func (*DB) CreateSandboxProxyToken ¶ added in v0.47.0
CreateSandboxProxyToken inserts a sandbox-scoped row into proxy_tokens. CreateSandbox / CreateLocalSandbox call this in the same DB session as the sandbox INSERT so the two tables stay in lockstep.
func (*DB) CreateUser ¶
func (*DB) CreateUserWithEmail ¶
func (*DB) CreateWorkspace ¶
func (*DB) DeleteAgentCard ¶ added in v0.30.0
func (*DB) DeleteCredentialBinding ¶ added in v0.36.0
func (*DB) DeleteExpiredTokens ¶
func (*DB) DeleteIMBinding ¶ added in v0.27.0
DeleteIMBinding deletes an IM binding by sandbox, provider, and bot ID.
func (*DB) DeleteIMChannel ¶ added in v0.27.0
DeleteIMChannel deletes a workspace IM channel by ID.
func (*DB) DeleteModelserverConnection ¶ added in v0.22.0
func (*DB) DeleteSandbox ¶
func (*DB) DeleteUserQuota ¶ added in v0.7.0
func (*DB) DeleteWorkspace ¶
func (*DB) DeleteWorkspaceLLMConfig ¶ added in v0.22.0
func (*DB) DeleteWorkspaceQuota ¶ added in v0.9.0
func (*DB) FailAgentTask ¶ added in v0.30.0
func (*DB) GetActiveBindings ¶ added in v0.27.0
GetActiveBindings returns all bindings with credentials for a given provider, filtered to sandboxes of type 'nanoclaw' with status 'running'.
func (*DB) GetActiveBindingsForSandbox ¶ added in v0.27.0
GetActiveBindingsForSandbox returns all bindings with credentials for a specific sandbox.
func (*DB) GetActiveTurn ¶ added in v0.47.0
GetActiveTurn returns the current active_turn_id for a session, or "" if none. A missing session is treated the same as no active turn (no error returned).
func (*DB) GetAgentCard ¶ added in v0.30.0
func (*DB) GetAgentInfo ¶ added in v0.16.0
GetAgentInfo returns agent info for a sandbox, or nil,nil if not found.
func (*DB) GetAgentSession ¶ added in v0.30.0
func (db *DB) GetAgentSession(id string) (*AgentSession, error)
func (*DB) GetAgentSessionEpoch ¶ added in v0.30.0
GetAgentSessionEpoch returns the current epoch for a session.
func (*DB) GetAgentSessionEventsSince ¶ added in v0.30.0
func (db *DB) GetAgentSessionEventsSince(sessionID string, sinceSeqNum int64, limit int) ([]AgentSessionEvent, error)
GetAgentSessionEventsSince returns events with sequence_num > sinceSeqNum.
func (*DB) GetAgentSessionEventsTail ¶ added in v0.47.0
func (db *DB) GetAgentSessionEventsTail(sessionID string, n int) ([]AgentSessionEvent, error)
GetAgentSessionEventsTail returns the most recent N events for the session, in chronological order. Used by the TUI SSE endpoint when ?tail=N is set.
func (*DB) GetAgentSessionInternalEventsSince ¶ added in v0.30.0
func (db *DB) GetAgentSessionInternalEventsSince(sessionID string, sinceID int64, limit int) ([]struct { ID int64 EventType string Payload json.RawMessage IsCompaction bool AgentID string CreatedAt time.Time }, error)
GetAgentSessionInternalEventsSince returns internal events with id > sinceID.
func (*DB) GetAgentSessionWorker ¶ added in v0.30.0
func (db *DB) GetAgentSessionWorker(sessionID string, epoch int) (*AgentSessionWorker, error)
func (*DB) GetAgentTask ¶ added in v0.30.0
func (*DB) GetAllChannelMeta ¶ added in v0.27.0
GetAllChannelMeta retrieves all metadata entries for a user on a channel.
func (*DB) GetAllProviderMeta ¶ added in v0.27.0
func (db *DB) GetAllProviderMeta(sandboxID, provider, botID, userID string) (map[string]string, error)
GetAllProviderMeta retrieves all metadata entries for a user.
func (*DB) GetAllWorkspaceNamespaces ¶
func (*DB) GetChannelMeta ¶ added in v0.27.0
GetChannelMeta retrieves a channel-specific metadata value.
func (*DB) GetChannelRequireMention ¶ added in v0.27.0
GetChannelRequireMention returns the require_mention flag for a channel.
func (*DB) GetCodexToken ¶ added in v0.50.7
GetCodexToken returns the row by id, or (nil, nil) if absent. It includes revoked rows so the verify endpoint can apply its own policy.
func (*DB) GetCredentialBinding ¶ added in v0.36.0
func (db *DB) GetCredentialBinding(id string) (*CredentialBinding, error)
func (*DB) GetIMChannel ¶ added in v0.27.0
GetIMChannel retrieves a single workspace IM channel by ID.
func (*DB) GetIMChannelForSandbox ¶ added in v0.27.0
GetIMChannelForSandbox returns the IM channel bound to a sandbox, if any. Returns sql.ErrNoRows if the sandbox has no channel bound.
func (*DB) GetIMCredentials ¶ added in v0.27.0
func (db *DB) GetIMCredentials(sandboxID, provider, botID string) (botToken, baseURL string, err error)
GetIMCredentials retrieves bot credentials for an IM binding.
func (*DB) GetModelserverConnection ¶ added in v0.22.0
func (db *DB) GetModelserverConnection(workspaceID string) (*ModelserverConnection, error)
func (*DB) GetOIDCIdentity ¶
func (db *DB) GetOIDCIdentity(provider, subject string) (*OIDCIdentity, error)
func (*DB) GetOrCreateWorkspaceToken ¶ added in v0.47.0
GetOrCreateWorkspaceToken returns the workspace's persistent proxy token, creating one if none exists. Idempotent: concurrent callers race-free thanks to the unique index on (workspace_id) WHERE token_type='workspace'.
func (*DB) GetPasswordHash ¶ added in v0.9.0
GetPasswordHash returns the bcrypt hash for the given user, or nil if no credential exists.
func (*DB) GetProviderMeta ¶ added in v0.27.0
GetProviderMeta retrieves a provider-specific metadata value.
func (*DB) GetProxyToken ¶ added in v0.47.0
func (db *DB) GetProxyToken(token string) (*ProxyToken, error)
GetProxyToken looks up a token in the unified proxy_tokens table. Returns (nil, nil) if the token is not present. Callers (llmproxy validation) branch on TokenType to decide whether sandbox status checks apply.
func (*DB) GetSandboxByAnyToken ¶ added in v0.30.2
GetSandboxByAnyToken looks up a sandbox by proxy_token first, then tunnel_token. This allows local agents (which only have tunnel_token) to authenticate against HTTP APIs, mirroring CC's pattern where a single OAuth token is used for both session creation and worker JWT exchange.
func (*DB) GetSandboxByProxyToken ¶
func (*DB) GetSandboxByShortID ¶
func (*DB) GetSandboxByTunnelToken ¶
GetSandboxByTunnelToken finds a local sandbox by its tunnel token.
func (*DB) GetSandboxForChannel ¶ added in v0.27.0
func (db *DB) GetSandboxForChannel(channelID string) (sandboxID, podIP, bridgeSecret, assistantName string, err error)
GetSandboxForChannel returns the running sandbox bound to a channel. Returns sql.ErrNoRows if no sandbox is bound or none is running.
func (*DB) GetSessionByExternalID ¶ added in v0.40.0
func (db *DB) GetSessionByExternalID(ctx context.Context, workspaceID, externalID string) (*AgentSession, error)
GetSessionByExternalID looks up a session by workspace and external ID.
func (*DB) GetSystemSetting ¶ added in v0.7.0
func (*DB) GetUserQuota ¶ added in v0.7.0
func (*DB) GetWorkspaceLLMConfig ¶ added in v0.22.0
func (db *DB) GetWorkspaceLLMConfig(workspaceID string) (*WorkspaceLLMConfig, error)
func (*DB) GetWorkspaceMember ¶
func (db *DB) GetWorkspaceMember(workspaceID, userID string) (*WorkspaceMember, error)
func (*DB) GetWorkspaceMemberRole ¶
func (*DB) GetWorkspaceQuota ¶ added in v0.9.0
func (db *DB) GetWorkspaceQuota(workspaceID string) (*WorkspaceQuota, error)
func (*DB) HasModelserverConnection ¶ added in v0.22.0
func (*DB) InsertAgentSessionEvents ¶ added in v0.30.0
func (db *DB) InsertAgentSessionEvents(sessionID string, events []AgentSessionEvent) ([]InsertedEvent, error)
InsertAgentSessionEvents inserts a batch of events, skipping duplicates. Returns only the successfully inserted events with their sequence numbers.
func (*DB) InsertAgentSessionInternalEvents ¶ added in v0.30.0
func (db *DB) InsertAgentSessionInternalEvents(sessionID string, events []struct { EventType string Payload json.RawMessage IsCompaction bool AgentID string }) error
InsertAgentSessionInternalEvents inserts internal events (transcript).
func (*DB) InsertOperation ¶ added in v0.59.1
func (*DB) IsWorkspaceMember ¶
func (*DB) LatestCodexBrowserSession ¶ added in v0.62.3
func (db *DB) LatestCodexBrowserSession(ctx context.Context, tokenID string) (*CodexBrowserSession, error)
LatestCodexBrowserSession returns the most recent session for a token (open if any, otherwise the latest historical one), or (nil, nil) if the token has never been used.
func (*DB) ListAgentCardsByWorkspace ¶ added in v0.30.0
func (*DB) ListAgentTasksByWorkspace ¶ added in v0.30.0
func (*DB) ListAllActiveChannels ¶ added in v0.27.0
ListAllActiveChannels returns all IM channels with credentials for a given provider. Used by RestoreIMBridgePollers.
func (*DB) ListAllActiveSandboxNames ¶
func (*DB) ListAllSandboxes ¶ added in v0.6.1
func (*DB) ListAllUsers ¶ added in v0.6.1
func (*DB) ListAllWorkspaces ¶ added in v0.6.1
func (*DB) ListAllWorkspacesAdmin ¶ added in v0.18.3
func (db *DB) ListAllWorkspacesAdmin() ([]*AdminWorkspaceInfo, error)
func (*DB) ListCodexTokensForWorkspace ¶ added in v0.50.7
func (db *DB) ListCodexTokensForWorkspace(ctx context.Context, workspaceID string, includeRevoked bool) ([]CodexToken, error)
ListCodexTokensForWorkspace returns tokens for a workspace, ordered by created_at desc. includeRevoked controls whether soft-revoked rows are included.
func (*DB) ListCredentialBindings ¶ added in v0.36.0
func (db *DB) ListCredentialBindings(workspaceID, kind string) ([]*CredentialBinding, error)
func (*DB) ListCredentialBindingsMeta ¶ added in v0.36.0
func (db *DB) ListCredentialBindingsMeta(workspaceID, kind string) ([]*CredentialBindingMeta, error)
ListCredentialBindingsMeta returns bindings without the encrypted auth blob.
func (*DB) ListIMBindings ¶ added in v0.27.0
ListIMBindings returns all IM bindings for a sandbox, optionally filtered by provider. If provider is empty, all bindings are returned.
func (*DB) ListIMChannels ¶ added in v0.27.0
ListIMChannels returns all IM channels for a workspace.
func (*DB) ListIdleSandboxes ¶
func (*DB) ListInteractions ¶ added in v0.36.0
func (db *DB) ListInteractions(workspaceID string, limit, offset int) ([]AgentInteraction, error)
func (*DB) ListOperations ¶ added in v0.59.1
func (db *DB) ListOperations(f OperationFilter) ([]Operation, error)
func (*DB) ListPendingAgentTasksByTarget ¶ added in v0.30.0
ListPendingAgentTasksByTarget returns pending tasks assigned to a target sandbox. Also atomically marks them as 'assigned' to prevent double-pickup.
func (*DB) ListSandboxesByWorkspace ¶
func (*DB) ListSessionsByChannel ¶ added in v0.47.0
func (db *DB) ListSessionsByChannel(ctx context.Context, workspaceID, channelType, executorID string, limit int) ([]SessionListItem, error)
ListSessionsByChannel returns sessions for a workspace filtered by channel type and executor. The external_id is expected to follow the pattern "<channelType>:<executorID>:<timestamp>".
func (*DB) ListStaleActiveTurns ¶ added in v0.47.0
func (db *DB) ListStaleActiveTurns(ctx context.Context, cutoff time.Time) ([]StaleActiveTurn, error)
ListStaleActiveTurns returns sessions with an active turn that has not been updated since cutoff.
func (*DB) ListStaleResponders ¶ added in v0.47.0
ListStaleResponders returns session IDs whose responder was attached before cutoff.
func (*DB) ListWorkspaceMembers ¶
func (db *DB) ListWorkspaceMembers(workspaceID string) ([]*WorkspaceMember, error)
func (*DB) ListWorkspaceVolumes ¶ added in v0.9.0
func (db *DB) ListWorkspaceVolumes(workspaceID string) ([]WorkspaceVolume, error)
func (*DB) ListWorkspacesByUser ¶
func (*DB) ListWorkspacesWithoutNamespace ¶
func (*DB) LogInteraction ¶ added in v0.36.0
func (db *DB) LogInteraction(i *AgentInteraction)
LogInteraction inserts an audit entry. Errors are logged but not returned (fire-and-forget).
func (*DB) MarkStaleAgentCardsOffline ¶ added in v0.30.0
MarkStaleAgentCardsOffline marks agents as offline if their sandbox heartbeat is stale.
func (*DB) PruneOperationsOlderThan ¶ added in v0.59.1
PruneOperationsOlderThan deletes operations whose started_at is strictly before cutoff. Returns the number of rows deleted.
func (*DB) ReadInbox ¶ added in v0.36.0
func (db *DB) ReadInbox(toID string, limit int) ([]AgentMessage, error)
ReadInbox returns unread messages for the given sandbox, atomically marking them as read.
func (*DB) RemoveWorkspaceMember ¶
func (*DB) RevokeCodexToken ¶ added in v0.50.7
RevokeCodexToken soft-revokes a token. Idempotent: re-revoke and missing-id are no-ops.
func (*DB) SaveIMChannelCredentials ¶ added in v0.27.0
SaveIMChannelCredentials stores bot credentials for a workspace IM channel.
func (*DB) SaveIMCredentials ¶ added in v0.27.0
SaveIMCredentials stores bot credentials for an IM binding.
func (*DB) SendMessage ¶ added in v0.36.0
func (db *DB) SendMessage(msg *AgentMessage) error
func (*DB) SetCredentialBindingDefault ¶ added in v0.36.0
SetCredentialBindingDefault atomically switches the default binding for a (workspace, kind) pair.
func (*DB) SetModelserverConnection ¶ added in v0.22.0
func (db *DB) SetModelserverConnection(c *ModelserverConnection) error
func (*DB) SetPasswordHash ¶ added in v0.9.0
SetPasswordHash upserts a password hash for the given user.
func (*DB) SetSessionCodexThreadID ¶ added in v0.60.15
func (db *DB) SetSessionCodexThreadID(ctx context.Context, sessionID string, threadID *string) error
SetSessionCodexThreadID updates (or clears, when threadID is nil) the codex_thread_id for a session. Used by the codex routing handler to persist the thread id after the first thread/start, and to clear it on thread-not-found / contextWindowExceeded so the next user message opens a fresh thread.
func (*DB) SetSessionExternalID ¶ added in v0.40.0
SetSessionExternalID sets the external_id for a session.
func (*DB) SetSessionIMChannel ¶ added in v0.40.0
SetSessionIMChannel sets the im_channel_id for a session. Called when a session is created from an inbound IM message so that CC's response can later be routed back to the correct channel.
func (*DB) SetSystemSetting ¶ added in v0.7.0
func (*DB) SetUserQuota ¶ added in v0.7.0
func (*DB) SetWorkspaceLLMConfig ¶ added in v0.22.0
func (*DB) SetWorkspaceNamespace ¶
func (*DB) SetWorkspaceQuota ¶ added in v0.9.0
func (*DB) SumWorkspaceSandboxResources ¶ added in v0.7.0
func (db *DB) SumWorkspaceSandboxResources(workspaceID string) (cpuMillis int64, memBytes int64, err error)
SumWorkspaceSandboxResources returns the total CPU (millicores) and memory (bytes) allocated by non-offline sandboxes in a workspace.
func (*DB) SweepStaleCodexBrowserSessions ¶ added in v0.62.3
func (db *DB) SweepStaleCodexBrowserSessions(ctx context.Context, olderThan time.Time) (int64, error)
SweepStaleCodexBrowserSessions marks any session connected before olderThan and not yet closed as disconnected. Called from CXG startup so rows from a crashed previous CXG pod don't leak forever as "online".
func (*DB) TouchCodexToken ¶ added in v0.50.7
TouchCodexToken sets last_used_at = NOW(). Best-effort use only — caller should fire-and-forget in a goroutine and log warnings, not propagate errors.
func (*DB) UnbindSandboxFromChannel ¶ added in v0.27.0
UnbindSandboxFromChannel removes the IM channel binding from a sandbox.
func (*DB) UpdateAgentCardStatus ¶ added in v0.30.0
func (*DB) UpdateAgentSessionWorkerHeartbeat ¶ added in v0.30.0
func (*DB) UpdateAgentSessionWorkerState ¶ added in v0.30.0
func (*DB) UpdateAgentTaskResult ¶ added in v0.30.0
func (*DB) UpdateAgentTaskStatus ¶ added in v0.30.0
func (*DB) UpdateCursor ¶ added in v0.27.0
UpdateCursor persists the long-poll cursor for an IM binding.
func (*DB) UpdateIMChannelCursor ¶ added in v0.27.0
UpdateIMChannelCursor persists the long-poll cursor for an IM channel.
func (*DB) UpdateIMChannelRoutingMode ¶ added in v0.40.1
UpdateIMChannelRoutingMode updates the routing_mode column for a channel. Caller is expected to validate `mode` before calling (valid values: "nanoclaw", "stateless_cc"). Unknown values are accepted by the DB but will cause forwardMessage to fall through to the default nanoclaw branch.
func (*DB) UpdateIMChannelSettings ¶ added in v0.27.0
UpdateIMChannelSettings updates channel settings.
func (*DB) UpdateModelserverTokens ¶ added in v0.22.0
func (*DB) UpdateOIDCIdentityEmail ¶ added in v0.9.0
func (*DB) UpdateSandboxActivity ¶
func (*DB) UpdateSandboxHeartbeat ¶
UpdateSandboxHeartbeat updates the last_heartbeat_at timestamp.
func (*DB) UpdateSandboxName ¶ added in v0.16.0
func (*DB) UpdateSandboxNanoclawBridgeSecret ¶ added in v0.26.0
UpdateSandboxNanoclawBridgeSecret stores the bridge secret for a nanoclaw sandbox.
func (*DB) UpdateSandboxPodIP ¶
func (*DB) UpdateSandboxSandboxName ¶
func (*DB) UpdateSandboxStatus ¶
func (*DB) UpdateUserEmail ¶
func (*DB) UpdateUserName ¶ added in v0.9.0
func (*DB) UpdateUserPicture ¶ added in v0.9.0
func (*DB) UpdateUserRole ¶ added in v0.6.1
func (*DB) UpdateWorkspaceMemberRole ¶
func (*DB) UpdateWorkspaceName ¶ added in v0.16.0
func (*DB) UpsertAgentCard ¶ added in v0.30.0
func (*DB) UpsertAgentCardFromCapabilities ¶ added in v0.37.0
func (db *DB) UpsertAgentCardFromCapabilities(sandboxID, workspaceID, displayName string, cardJSON json.RawMessage) error
UpsertAgentCardFromCapabilities creates or updates an agent card from capability data.
func (*DB) UpsertAgentInfo ¶ added in v0.16.0
UpsertAgentInfo inserts or updates agent info for a sandbox.
func (*DB) UpsertAgentSessionWorker ¶ added in v0.30.0
func (*DB) UpsertChannelMeta ¶ added in v0.27.0
UpsertChannelMeta inserts or updates a channel-specific metadata entry.
func (*DB) UpsertProviderMeta ¶ added in v0.27.0
UpsertProviderMeta inserts or updates a provider-specific metadata entry.
type IMBinding ¶ added in v0.27.0
type IMBinding struct {
ID int
SandboxID string
Provider string
BotID string
UserID string
BotToken string
BaseURL string
Cursor string
BoundAt time.Time
}
IMBinding represents a row in the sandbox_im_bindings table.
type IMChannel ¶ added in v0.27.0
type IMChannel struct {
ID string
WorkspaceID string
Provider string
BotID string
UserID string
BotToken string
BaseURL string
Cursor string
RequireMention bool
RoutingMode string
BoundAt time.Time
}
IMChannel represents a row in the workspace_im_channels table.
type InsertedEvent ¶ added in v0.30.0
type InsertedEvent struct {
SeqNum int64
Event AgentSessionEvent
}
InsertedEvent pairs an event with its assigned sequence number.
type ModelserverConnection ¶ added in v0.22.0
type ModelserverConnection struct {
WorkspaceID string `json:"workspace_id"`
ProjectID string `json:"project_id"`
ProjectName string `json:"project_name"`
UserID string `json:"user_id"`
AccessToken string `json:"-"`
RefreshToken string `json:"-"`
TokenExpiresAt time.Time `json:"token_expires_at"`
Models []LLMModel `json:"models"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type OIDCIdentity ¶
type Operation ¶ added in v0.59.1
type Operation struct {
ID string
WorkspaceID string
UserID *string
Source string // "sdk" | "tui" | (v1.5) "llm"
ThreadID *string
RequestID *string
EnvID string
Tool string
Arguments json.RawMessage // nil if truncated
ArgumentsMeta json.RawMessage // {"truncated":true,"size_bytes":N,"sha256":"..."} if so
IsError bool
ResultSummary *string
ResultMeta json.RawMessage
StartedAt time.Time
CompletedAt time.Time
DurationMs int32
NotebookPath *string // v1.5
CellID *string // v1.5
}
Operation is one row of the operations table — a single completed mcpServer/tool/call observed by codex-app-gateway.
type OperationFilter ¶ added in v0.59.1
type OperationFilter struct {
WorkspaceID string // REQUIRED — server-side enforced
EnvID string // optional
Tool string // optional
Source string // optional
IsError *bool // optional
Since *time.Time
ID string // optional: exact match (returns 0 or 1 rows)
Limit int // default 100, max 1000
}
OperationFilter is the optional filter set for ListOperations.
type ProxyToken ¶ added in v0.47.0
type ProxyToken struct {
Token string
TokenType ProxyTokenType
SandboxID sql.NullString
WorkspaceID string
}
ProxyToken is a row from the proxy_tokens table.
type ProxyTokenType ¶ added in v0.47.0
type ProxyTokenType string
ProxyTokenType discriminates the two kinds of tokens stored in proxy_tokens. Sandbox tokens are bound to a specific sandbox lifecycle (must be 'running' / 'creating' to authorize requests). Workspace tokens are bound only to a workspace and authorize cc-broker turn workers, which do not have a sandbox identity.
const ( ProxyTokenSandbox ProxyTokenType = "sandbox" ProxyTokenWorkspace ProxyTokenType = "workspace" )
type Sandbox ¶
type Sandbox struct {
ID string
WorkspaceID string
Name string
Type string
Status string
IsLocal bool
ShortID sql.NullString
SandboxName sql.NullString
PodIP sql.NullString
ProxyToken sql.NullString
OpencodeToken sql.NullString
OpenclawToken sql.NullString
TunnelToken sql.NullString
NanoclawBridgeSecret sql.NullString
LastActivityAt sql.NullTime
CreatedAt time.Time
PausedAt sql.NullTime
LastHeartbeatAt sql.NullTime
CPU *int
Memory *int64
IdleTimeout *int
Metadata json.RawMessage
}
type SessionListItem ¶ added in v0.47.0
type SessionListItem struct {
ID string
ExternalID string
Title string
LastActivityAt time.Time
PermissionResponder *string
}
SessionListItem is a summary row returned by ListSessionsByChannel.
type StaleActiveTurn ¶ added in v0.47.0
type StaleActiveTurn struct{ SessionID, TurnID string }
StaleActiveTurn pairs a session ID with a stuck active turn ID.
type WorkspaceLLMConfig ¶ added in v0.22.0
type WorkspaceMember ¶
type WorkspaceQuota ¶ added in v0.9.0
Source Files
¶
- agent_cards.go
- agent_info.go
- agent_interactions.go
- agent_mailbox.go
- agent_sessions.go
- agent_tasks.go
- codex_browser_sessions.go
- codex_tokens.go
- credential_bindings.go
- credentials.go
- db.go
- im_bindings.go
- im_channels.go
- llm_config.go
- modelserver_tokens.go
- oidc.go
- operations.go
- proxy_tokens.go
- quotas.go
- sandboxes.go
- tokens.go
- users.go
- workspaces.go