Documentation
¶
Index ¶
- type AgentHealthMonitor
- type ExecutorsClient
- func (c *ExecutorsClient) Bind(ctx context.Context, userID, workspaceID, exeID, name, description string, ...) error
- func (c *ExecutorsClient) List(ctx context.Context, userID, workspaceID string) ([]ListedExecutor, error)
- func (c *ExecutorsClient) Register(ctx context.Context, userID string, req RegisterExecutorRequest) (RegisterExecutorResponse, error)
- func (c *ExecutorsClient) Unbind(ctx context.Context, userID, workspaceID, exeID string) error
- func (c *ExecutorsClient) Unregister(ctx context.Context, userID, exeID string) error
- type IMInboundMessage
- type LeakWorker
- type LeakWorkerConfig
- type ListedExecutor
- type RegisterExecutorRequest
- type RegisterExecutorResponse
- type ResourceDefaults
- type Server
- type WorkspaceDefaults
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentHealthMonitor ¶ added in v0.30.0
type AgentHealthMonitor struct {
// contains filtered or unexported fields
}
AgentHealthMonitor periodically marks stale agents as offline.
func NewAgentHealthMonitor ¶ added in v0.30.0
func NewAgentHealthMonitor(database *db.DB) *AgentHealthMonitor
func (*AgentHealthMonitor) Run ¶ added in v0.30.0
func (m *AgentHealthMonitor) Run(ctx context.Context)
Run blocks until ctx is cancelled.
type ExecutorsClient ¶ added in v0.50.7
type ExecutorsClient struct {
// contains filtered or unexported fields
}
ExecutorsClient talks to codex-exec-gateway's user-management API on behalf of a session-authenticated agentserver user. Every request carries:
- X-Internal-Secret: agentserver's INTERNAL_API_SECRET (matches the RequireAgentserverSecret middleware on the gateway side)
- X-User-Id: the calling user's ID (gateway uses this for its own ownership ACL on executors)
func NewExecutorsClient ¶ added in v0.50.7
func NewExecutorsClient(baseURL, secret string) *ExecutorsClient
func (*ExecutorsClient) Bind ¶ added in v0.50.7
func (c *ExecutorsClient) Bind(ctx context.Context, userID, workspaceID, exeID, name, description string, isDefault bool) error
Bind attaches an existing executor to a workspace under the caller-supplied name (workspace-unique). description is optional.
func (*ExecutorsClient) List ¶ added in v0.50.7
func (c *ExecutorsClient) List(ctx context.Context, userID, workspaceID string) ([]ListedExecutor, error)
List returns all executors bound to the workspace.
func (*ExecutorsClient) Register ¶ added in v0.50.7
func (c *ExecutorsClient) Register(ctx context.Context, userID string, req RegisterExecutorRequest) (RegisterExecutorResponse, error)
Register creates a new executor owned by userID and returns the raw registration token (one-time).
func (*ExecutorsClient) Unbind ¶ added in v0.50.7
func (c *ExecutorsClient) Unbind(ctx context.Context, userID, workspaceID, exeID string) error
Unbind removes an executor from a workspace.
func (*ExecutorsClient) Unregister ¶ added in v0.59.1
func (c *ExecutorsClient) Unregister(ctx context.Context, userID, exeID string) error
Unregister deletes an executor row (and any of its bindings via CASCADE) from the gateway store. Used by the agentserver Register handler to clean up after a failed Bind so we don't leak orphan executors. Idempotent: 404 is treated as success.
type IMInboundMessage ¶ added in v0.40.0
type IMInboundMessage struct {
ChatJID string `json:"chat_jid"`
SenderName string `json:"sender_name"`
Content string `json:"content"`
Provider string `json:"provider"`
ChannelID string `json:"channel_id"`
}
IMInboundMessage represents an inbound message from an IM channel.
type LeakWorker ¶ added in v0.47.0
type LeakWorker struct {
// contains filtered or unexported fields
}
LeakWorker is a background goroutine that cleans up stale active turns and responders.
func NewLeakWorker ¶ added in v0.47.0
func NewLeakWorker(s *Server, cfg LeakWorkerConfig) *LeakWorker
NewLeakWorker creates a new LeakWorker with defaults applied to zero values.
func (*LeakWorker) Run ¶ added in v0.47.0
func (l *LeakWorker) Run(ctx context.Context)
Run starts the ticker loop until ctx is cancelled.
func (*LeakWorker) RunOnce ¶ added in v0.47.0
func (l *LeakWorker) RunOnce(ctx context.Context)
RunOnce runs both cleanup sweeps once. Exposed for testing.
type LeakWorkerConfig ¶ added in v0.47.0
type LeakWorkerConfig struct {
StaleTurnAfter time.Duration // default 5m
ResponderTTL time.Duration // default 90s
Period time.Duration // default 1m
}
LeakWorkerConfig holds configuration for the leak worker.
type ListedExecutor ¶ added in v0.50.7
type ListedExecutor struct {
ExeID string `json:"exe_id"`
Name string `json:"name"`
Description string `json:"description"`
IsDefault bool `json:"is_default"`
LastSeenAt *time.Time `json:"last_seen_at,omitempty"`
}
ListedExecutor matches codex-exec-gateway's GET /api/codex-exec/workspaces/{wid}/executors element shape. Per v0.54.0, surfaced fields are binding-level (name + description) from workspace_executors, not the executor row.
type RegisterExecutorRequest ¶ added in v0.50.7
type RegisterExecutorRequest struct {
DisplayName string `json:"display_name,omitempty"`
}
RegisterExecutorRequest matches codex-exec-gateway's POST /api/codex-exec/register body. Per v0.54.0, executors no longer carry a default_cwd; that field was useless to the LLM and confusing in the UI.
type RegisterExecutorResponse ¶ added in v0.50.7
type RegisterExecutorResponse struct {
ExeID string `json:"exe_id"`
RegistrationToken string `json:"registration_token"`
}
RegisterExecutorResponse matches codex-exec-gateway's response (raw token is returned ONCE — agentserver forwards it to the web UI for one-time display, never stores it).
type ResourceDefaults ¶ added in v0.7.0
type ResourceDefaults struct {
MaxWorkspacesPerUser int
MaxSandboxesPerWorkspace int
MaxWorkspaceDriveSize int64 // bytes
MaxSandboxCPU int // millicores
MaxSandboxMemory int64 // bytes
MaxIdleTimeout int // seconds
WsMaxTotalCPU int // millicores
WsMaxTotalMemory int64 // bytes
WsMaxIdleTimeout int // seconds
}
ResourceDefaults holds all resolved system-wide defaults.
type Server ¶
type Server struct {
Auth *auth.Auth
OIDC *auth.OIDCManager
DB *db.DB
Sandboxes *sbxstore.Store
ProcessManager process.Manager
DriveManager storage.DriveManager
NamespaceManager *namespace.Manager
TunnelRegistry *tunnel.Registry
StaticFS fs.FS
BaseDomains []string // e.g. ["agentserver.dev", "agent.cs.ac.cn"] (first is primary)
OpencodeSubdomainPrefix string // e.g. "code" — subdomain: code-{id}.{baseDomain}
OpenclawSubdomainPrefix string // e.g. "claw" — subdomain: claw-{id}.{baseDomain}
ClaudeCodeSubdomainPrefix string // e.g. "claude" — subdomain: claude-{id}.{baseDomain}
JupyterSubdomainPrefix string // e.g. "jupyter" — subdomain: jupyter-{id}.{baseDomain}
PasswordAuthEnabled bool // when false, /api/auth/login and /api/auth/register are not registered
LLMProxyURL string // base URL for the llmproxy service (e.g. "http://agentserver-llmproxy:8081")
// IMBridgeURL is the base URL of the standalone imbridge service
// (e.g. "http://agentserver-imbridge:8083"). When set, IM API routes
// are reverse-proxied to the imbridge service.
IMBridgeURL string
// ModelServer OAuth
ModelserverOAuthClientID string
ModelserverOAuthClientSecret string
ModelserverOAuthAuthURL string
ModelserverOAuthTokenURL string
ModelserverOAuthIntrospectURL string
ModelserverOAuthRedirectURI string
ModelserverProxyURL string
DatabaseURL string // PostgreSQL connection URL (needed for Matrix E2EE crypto DB)
// Hydra OAuth2 (for agent Device Flow)
HydraClient *auth.HydraClient
HydraPublicURL string // internal URL for reverse proxy (e.g. "http://hydra-public:4444")
// BridgeHandler provides CCR V2-compatible bridge API for agent sessions.
BridgeHandler *bridge.Handler
// CCBrokerURL is the base URL of the cc-broker service for stateless
// Claude Code sessions (e.g. "http://cc-broker:8090").
CCBrokerURL string
// ExecutorRegistryURL is the base URL of the executor-registry service
// (e.g. "http://executor-registry:8091"). Used by the /control agents command.
ExecutorRegistryURL string
// Credential proxy
EncryptionKey []byte // AES-256 key for credential_bindings auth_blob
CredproxyPublicURL string // URL sandboxes use to reach credentialproxy
// Codex exec gateway
ExecutorsClient *ExecutorsClient
CodexExecGatewayPublicHost string // e.g. "codex-exec.example.com" — used to compose connect commands
// OperationsRetention is the TTL for rows in the operations table.
// 0 disables the background retention loop. Configurable via
// AGENTSERVER_OPERATIONS_RETENTION_DAYS (default 90).
OperationsRetention time.Duration
// contains filtered or unexported fields
}
func (*Server) GetEffectiveIdleTimeout ¶ added in v0.7.0
GetEffectiveIdleTimeout is the exported version for use by cmd/serve.go.
type WorkspaceDefaults ¶ added in v0.9.0
type WorkspaceDefaults struct {
MaxSandboxes int
MaxSandboxCPU int // millicores
MaxSandboxMemory int64 // bytes
MaxIdleTimeout int // seconds
MaxTotalCPU int // millicores
MaxTotalMemory int64 // bytes
MaxDriveSize int64 // bytes
}
WorkspaceDefaults holds workspace-level resolved defaults (system defaults <- workspace_quotas override).
Source Files
¶
- admin.go
- agent_discovery.go
- agent_health.go
- agent_interactions.go
- agent_mailbox.go
- agent_proxy_routes.go
- agent_register.go
- agent_tasks.go
- ccbroker_v2_client.go
- codex_executors.go
- codex_executors_client.go
- codex_token_format.go
- codex_tokens.go
- codex_tokens_internal.go
- credential_bindings.go
- handler_tui_control.go
- handler_tui_events.go
- handler_tui_inbound.go
- handler_tui_internal.go
- handler_tui_proxy.go
- handler_tui_session.go
- im_inbound.go
- im_inbound_parse.go
- leak_worker.go
- modelserver_oauth.go
- modelserver_token.go
- oauth_provider.go
- operations.go
- operations_retention.go
- quota.go
- server.go
- task_output.go
- validate_proxy_token.go
- workspace_token.go