Documentation
¶
Index ¶
- Constants
- func DiscoverMCPAuth(ctx context.Context, httpClient *http.Client, serverURL string) (*oauth.DiscoveryResult, error)
- func ServeStoragePath(w http.ResponseWriter, r *http.Request, database *db.DB, s3 *storage.S3Client, ...)
- type Config
- type Handler
- func (h *Handler) AgentHTTP(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CancelAgentRun(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CancelConnectorJob(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CancelConnectorOrchestration(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CancelJob(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ConnectorCommand(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ConnectorDirectoryDelete(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ConnectorDirectoryExport(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ConnectorDirectoryImport(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ConnectorDirectoryList(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ConnectorDirectoryMove(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ConnectorDirectoryRead(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ConnectorDirectoryStat(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ConnectorDirectoryWrite(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ContinueAgent(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateConnectorOrchestration(w http.ResponseWriter, r *http.Request)
- func (h *Handler) CreateRun(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Embed(w http.ResponseWriter, r *http.Request)
- func (h *Handler) EnqueueJob(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetAgentRun(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetCheckpoint(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetConnectorJob(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetConnectorOrchestration(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetEnvVarValue(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetJob(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ImageGenerate(w http.ResponseWriter, r *http.Request)
- func (h *Handler) LLMStream(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ListAgentRuns(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ListJobs(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ListUsers(w http.ResponseWriter, r *http.Request)
- func (h *Handler) MCPToolCall(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Print(w http.ResponseWriter, r *http.Request)
- func (h *Handler) RunComplete(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Seal(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Search(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ServiceProxy(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SessionAppend(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SessionCompact(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SessionLoad(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SpeechGenerate(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StartAgent(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StartConnectorJob(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StorageCopy(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StorageDelete(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StorageInfo(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StorageList(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StorageLoad(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StorageShare(w http.ResponseWriter, r *http.Request)
- func (h *Handler) StorageStore(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Sync(w http.ResponseWriter, r *http.Request)
- func (h *Handler) TopicSubscribe(w http.ResponseWriter, r *http.Request)
- func (h *Handler) TopicUnsubscribe(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Transcribe(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Unseal(w http.ResponseWriter, r *http.Request)
- func (h *Handler) UpdateJobProgress(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Upgrade(w http.ResponseWriter, r *http.Request)
- func (h *Handler) UpsertEnvVar(w http.ResponseWriter, r *http.Request)
- func (h *Handler) WebFetch(w http.ResponseWriter, r *http.Request)
- type MCPPrincipal
- type MCPServer
Constants ¶
const ( MCPPrincipalAnon = mcpaccess.Anonymous MCPPrincipalUser = mcpaccess.User MCPPrincipalOAuthClient = mcpaccess.OAuthClient )
Variables ¶
This section is empty.
Functions ¶
func DiscoverMCPAuth ¶
func DiscoverMCPAuth(ctx context.Context, httpClient *http.Client, serverURL string) (*oauth.DiscoveryResult, error)
DiscoverMCPAuth runs RFC 9728/8414 discovery on an MCP server URL.
func ServeStoragePath ¶
func ServeStoragePath(w http.ResponseWriter, r *http.Request, database *db.DB, s3 *storage.S3Client, files *agentstoragesvc.Service, agentID uuid.UUID, path, jwtSecret, publicURL string, logger *zap.Logger)
ServeStoragePath serves reads from a registered directory on the subdomain proxy's /__air/storage{path} endpoint, gating by the directory's read_access and exact scope identity:
- "public" — served unauthenticated when the directory is unscoped
- "user" — requires a valid __air_session cookie + agent membership
- "admin" — requires admin role on the agent
- unknown — 404
Missing cookies on user/admin dirs get redirected through the relay flow (rejectOrRedirect) so a click-from-chat triggers login. Once logged in, the user lands back on the same URL with a session cookie set and the file streams.
Denied and unknown paths return the same response after authentication so URL guessing does not reveal whether an object exists.
Types ¶
type Config ¶
type Config struct {
AgentRuns *agentruns.Service
Runtime *runtimesvc.Service
DB *db.DB
Encryptor secrets.Store
OAuthClient *oauth.Client
S3 *storage.S3Client
Files *agentstoragesvc.Service
Jobs *jobssvc.Service
ConnectorJobs *connectorjobssvc.Service
ConnectorDirectories *connectordirectoriessvc.Service
ConnectorOrchestration *connectororchestrationsvc.Service
Builder *builder.BuildService
PubSub *realtime.PubSub
BridgeMgr runtimesvc.BridgePartsDeliverer
Scheduler appruntime.ScheduleReconciler
PublicURL string
AgentBaseURL func(slug string) string
JWTSecret string
HTTPNetwork *networkpolicy.Policy
Logger *zap.Logger
}
Config bundles the dependencies New requires. Mirrors the struct fields of Handler one-for-one; api/router.go's RouterConfig translates its own merged config into this on wire-up.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func New ¶
New constructs the agent-internal HTTP surface. Fail-loud on nil deps — every required field is mandatory (airlock fail-loud rule).
func (*Handler) AgentHTTP ¶
func (h *Handler) AgentHTTP(w http.ResponseWriter, r *http.Request)
AgentHTTP handles POST /api/agent/http — raw HTTP proxy for permitted URLs. No auth injection (use proxy/{slug} for authenticated connections).
func (*Handler) CancelAgentRun ¶
func (h *Handler) CancelAgentRun(w http.ResponseWriter, r *http.Request)
func (*Handler) CancelConnectorJob ¶ added in v0.6.1
func (h *Handler) CancelConnectorJob(w http.ResponseWriter, r *http.Request)
func (*Handler) CancelConnectorOrchestration ¶ added in v0.6.1
func (h *Handler) CancelConnectorOrchestration(w http.ResponseWriter, r *http.Request)
func (*Handler) CancelJob ¶ added in v0.5.0
func (h *Handler) CancelJob(w http.ResponseWriter, r *http.Request)
func (*Handler) ConnectorCommand ¶ added in v0.6.1
func (h *Handler) ConnectorCommand(w http.ResponseWriter, r *http.Request)
func (*Handler) ConnectorDirectoryDelete ¶ added in v0.6.1
func (h *Handler) ConnectorDirectoryDelete(w http.ResponseWriter, r *http.Request)
func (*Handler) ConnectorDirectoryExport ¶ added in v0.6.1
func (h *Handler) ConnectorDirectoryExport(w http.ResponseWriter, r *http.Request)
func (*Handler) ConnectorDirectoryImport ¶ added in v0.6.1
func (h *Handler) ConnectorDirectoryImport(w http.ResponseWriter, r *http.Request)
func (*Handler) ConnectorDirectoryList ¶ added in v0.6.1
func (h *Handler) ConnectorDirectoryList(w http.ResponseWriter, r *http.Request)
func (*Handler) ConnectorDirectoryMove ¶ added in v0.6.1
func (h *Handler) ConnectorDirectoryMove(w http.ResponseWriter, r *http.Request)
func (*Handler) ConnectorDirectoryRead ¶ added in v0.6.1
func (h *Handler) ConnectorDirectoryRead(w http.ResponseWriter, r *http.Request)
func (*Handler) ConnectorDirectoryStat ¶ added in v0.6.1
func (h *Handler) ConnectorDirectoryStat(w http.ResponseWriter, r *http.Request)
func (*Handler) ConnectorDirectoryWrite ¶ added in v0.6.1
func (h *Handler) ConnectorDirectoryWrite(w http.ResponseWriter, r *http.Request)
func (*Handler) ContinueAgent ¶
func (h *Handler) ContinueAgent(w http.ResponseWriter, r *http.Request)
func (*Handler) CreateConnectorOrchestration ¶ added in v0.6.1
func (h *Handler) CreateConnectorOrchestration(w http.ResponseWriter, r *http.Request)
func (*Handler) Embed ¶
func (h *Handler) Embed(w http.ResponseWriter, r *http.Request)
Embed handles POST /api/agent/llm/embedding.
func (*Handler) EnqueueJob ¶ added in v0.5.0
func (h *Handler) EnqueueJob(w http.ResponseWriter, r *http.Request)
func (*Handler) GetAgentRun ¶
func (h *Handler) GetAgentRun(w http.ResponseWriter, r *http.Request)
func (*Handler) GetCheckpoint ¶
func (h *Handler) GetCheckpoint(w http.ResponseWriter, r *http.Request)
func (*Handler) GetConnectorJob ¶ added in v0.6.1
func (h *Handler) GetConnectorJob(w http.ResponseWriter, r *http.Request)
func (*Handler) GetConnectorOrchestration ¶ added in v0.6.1
func (h *Handler) GetConnectorOrchestration(w http.ResponseWriter, r *http.Request)
func (*Handler) GetEnvVarValue ¶
func (h *Handler) GetEnvVarValue(w http.ResponseWriter, r *http.Request)
func (*Handler) GetJob ¶ added in v0.5.0
func (h *Handler) GetJob(w http.ResponseWriter, r *http.Request)
func (*Handler) ImageGenerate ¶
func (h *Handler) ImageGenerate(w http.ResponseWriter, r *http.Request)
ImageGenerate handles POST /api/agent/llm/image.
func (*Handler) LLMStream ¶
func (h *Handler) LLMStream(w http.ResponseWriter, r *http.Request)
LLMStream handles POST /api/agent/llm/stream.
func (*Handler) ListAgentRuns ¶
func (h *Handler) ListAgentRuns(w http.ResponseWriter, r *http.Request)
func (*Handler) ListJobs ¶ added in v0.5.0
func (h *Handler) ListJobs(w http.ResponseWriter, r *http.Request)
func (*Handler) MCPToolCall ¶
func (h *Handler) MCPToolCall(w http.ResponseWriter, r *http.Request)
func (*Handler) RunComplete ¶
func (h *Handler) RunComplete(w http.ResponseWriter, r *http.Request)
func (*Handler) Seal ¶
func (h *Handler) Seal(w http.ResponseWriter, r *http.Request)
Seal handles POST /api/agent/seal.
func (*Handler) Search ¶
func (h *Handler) Search(w http.ResponseWriter, r *http.Request)
Search handles POST /api/agent/search — proxies web search requests from agent containers without exposing API keys.
func (*Handler) ServiceProxy ¶
func (h *Handler) ServiceProxy(w http.ResponseWriter, r *http.Request)
func (*Handler) SessionAppend ¶
func (h *Handler) SessionAppend(w http.ResponseWriter, r *http.Request)
func (*Handler) SessionCompact ¶
func (h *Handler) SessionCompact(w http.ResponseWriter, r *http.Request)
func (*Handler) SessionLoad ¶
func (h *Handler) SessionLoad(w http.ResponseWriter, r *http.Request)
func (*Handler) SpeechGenerate ¶
func (h *Handler) SpeechGenerate(w http.ResponseWriter, r *http.Request)
SpeechGenerate handles POST /api/agent/llm/speech.
func (*Handler) StartAgent ¶
func (h *Handler) StartAgent(w http.ResponseWriter, r *http.Request)
func (*Handler) StartConnectorJob ¶ added in v0.6.1
func (h *Handler) StartConnectorJob(w http.ResponseWriter, r *http.Request)
func (*Handler) StorageCopy ¶
func (h *Handler) StorageCopy(w http.ResponseWriter, r *http.Request)
StorageCopy handles POST /api/agent/storage/copy. Both src and dst are absolute paths.
func (*Handler) StorageDelete ¶
func (h *Handler) StorageDelete(w http.ResponseWriter, r *http.Request)
StorageDelete handles DELETE /api/agent/storage/*.
func (*Handler) StorageInfo ¶
func (h *Handler) StorageInfo(w http.ResponseWriter, r *http.Request)
StorageInfo handles POST /api/agent/storage/info. Body: {path}. Returns FileInfo with the original filename surfaced from S3 metadata when the upload set it (chat uploads do; raw writeFile does not).
func (*Handler) StorageList ¶
func (h *Handler) StorageList(w http.ResponseWriter, r *http.Request)
StorageList handles GET /api/agent/storage. Query params:
- path=uploads/ → list under this storage path (slashless; trailing '/' optional)
- path= (empty) → list the agent root
- recursive=true|false (default false; one level only)
func (*Handler) StorageLoad ¶
func (h *Handler) StorageLoad(w http.ResponseWriter, r *http.Request)
StorageLoad handles GET /api/agent/storage/*.
func (*Handler) StorageShare ¶
func (h *Handler) StorageShare(w http.ResponseWriter, r *http.Request)
StorageShare handles POST /api/agent/storage/share. Returns a presigned, unauthenticated, time-limited URL for the given storage path. Used by the agent's shareFileURL JS binding (and ShareFileURL Go method) to hand out a link the user — or a third party — can fetch directly, without going through agent membership / login on the subdomain proxy.
The URL is signed for the public S3 endpoint when configured (so browsers, LLM providers, and external tools can resolve it from outside the docker network). Falls back to the internal endpoint otherwise.
404s on missing files via HeadObject pre-check so the LLM gets a clear signal instead of a working URL that 404s when followed.
func (*Handler) StorageStore ¶
func (h *Handler) StorageStore(w http.ResponseWriter, r *http.Request)
StorageStore handles PUT /api/agent/storage/*. Path-based: the wildcard is the absolute path under the agent's storage root. Original filename can ride on `X-Filename` and is persisted as S3 object metadata.
func (*Handler) TopicSubscribe ¶
func (h *Handler) TopicSubscribe(w http.ResponseWriter, r *http.Request)
func (*Handler) TopicUnsubscribe ¶
func (h *Handler) TopicUnsubscribe(w http.ResponseWriter, r *http.Request)
func (*Handler) Transcribe ¶
func (h *Handler) Transcribe(w http.ResponseWriter, r *http.Request)
Transcribe handles POST /api/agent/llm/transcription.
func (*Handler) Unseal ¶
func (h *Handler) Unseal(w http.ResponseWriter, r *http.Request)
Unseal handles POST /api/agent/unseal. A decrypt failure is a 400, not a 500: the usual cause is a value sealed by (bound to) a different agent or a corrupted blob — a bad request, not a server fault.
func (*Handler) UpdateJobProgress ¶ added in v0.5.0
func (h *Handler) UpdateJobProgress(w http.ResponseWriter, r *http.Request)
func (*Handler) UpsertEnvVar ¶
func (h *Handler) UpsertEnvVar(w http.ResponseWriter, r *http.Request)
type MCPPrincipal ¶
MCPPrincipal retains the opaque credential proof throughout an MCP request.
type MCPServer ¶
type MCPServer struct {
// contains filtered or unexported fields
}
MCPServer exposes registered app tools and resources without a model loop.
func NewMCPServer ¶
func NewMCPServer(dispatcher *trigger.Dispatcher, logger *zap.Logger) *MCPServer