httpapi

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 40 Imported by: 0 modules, 0 packages

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

Documentation

Overview

Package httpapi exposes the gateway over HTTP.

Operations are registered with Huma (net/http ServeMux underneath); the OpenAPI 3.1 document is generated from their Go types, served at /openapi.yaml and rendered at /docs. Routes are versioned under /v1. Every route except probes and the docs requires the bearer token when one is configured. Errors are RFC 9457 problem details with a stable code and the request ID (X-Request-ID, accepted from the client or created). Successful responses carry the resource itself; lists are {items, next_cursor}.

Streaming: a run's event log can be read as Server-Sent Events (GET /v1/runs/{id}/events, resumable with Last-Event-ID) or over a WebSocket (GET /v1/runs/{id}/ws) that also accepts control messages. Both are readers of the same log (see package run).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenAPI

func OpenAPI() ([]byte, error)

OpenAPI returns the generated OpenAPI 3.1 document (YAML) without starting a server.

Types

type ControlPath

type ControlPath struct {
	RunPath

	ControlID string `path:"control_id"`
}

type FilePath

type FilePath struct {
	WorkspacePath

	Path string `path:"path" doc:"Slash-separated path inside the workspace." example:"src/main.go"`
}

type PageInput

type PageInput struct {
	Cursor string `query:"cursor" doc:"next_cursor of the previous page, with the same filters. Omit for the first page."`
}

PageInput selects a page of a list.

type PermissionPath

type PermissionPath struct {
	RunPath

	PermissionID string `path:"permission_id"`
}

type RunPath

type RunPath struct {
	RunID string `path:"run_id"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server holds the dependencies shared by all handlers.

func New

func New(base context.Context, cfg config.Config, a agent.Agent, logger *slog.Logger) (*Server, error)

New returns a Server for one agent. Cancelling base cancels every running run (used on shutdown).

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the root HTTP handler with all middleware applied.

func (*Server) Wait

func (s *Server) Wait()

Wait blocks until every run has settled after the server context is cancelled.

type SessionPath

type SessionPath struct {
	SessionID string `path:"session_id" format:"uuid"`
}

type WorkspacePath

type WorkspacePath struct {
	WorkspaceID string `path:"workspace_id" doc:"32 lowercase hex characters." example:"0123456789abcdef0123456789abcdef"`
}

Jump to

Keyboard shortcuts

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