Documentation
¶
Overview ¶
Package hostmux exposes a *host.Service over HTTP. It is consumed by `cmd/clank-host` (which serves it on a Unix socket) and by tests that want to exercise the wire format.
The Hub never imports this package directly; it goes through internal/host/client (hostclient) which has both an in-process adapter (calls *host.Service methods) and an HTTP adapter (calls these handlers). The wire endpoints are designed to be the only contract between Hub and Host.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscoverRequest ¶
type DiscoverRequest struct {
Backend agent.BackendType `json:"backend"`
SeedDir string `json:"seed_dir"`
}
HOST
type ForkRequest ¶
type ForkRequest struct {
MessageID string `json:"message_id"`
}
ForkRequest is the body for POST /sessions/{id}/fork.
type Mux ¶
type Mux struct {
// contains filtered or unexported fields
}
Mux wraps a *host.Service with an http.Handler.
func (*Mux) Handler ¶
Handler returns an http.Handler with all routes registered. When an auth token is configured via SetAuthToken, the entire handler is wrapped in the requireBearer middleware so every endpoint is gated uniformly. The access log wraps outermost so rejected (401) requests are visible too.
func (*Mux) SetAuthToken ¶
SetAuthToken configures the bearer-token middleware. When non-empty, every request must carry "Authorization: Bearer <token>" or the handler returns 401. When empty (the default), no auth is enforced — that's the laptop-local single-user mode where a Unix socket or loopback TCP listener is the only access boundary.
Must be called before Handler() so the wrap is applied; calling after has no effect on the already-built handler.
type PermissionReplyRequest ¶
type PermissionReplyRequest struct {
Allow bool `json:"allow"`
// Message is the reason forwarded to the model when Allow is false (e.g.
// plan-review comments). Ignored when Allow is true.
Message string `json:"message,omitempty"`
}
PermissionReplyRequest is the body for POST /sessions/{id}/permissions/{permID}/reply.
type SessionSnapshot ¶
type SessionSnapshot struct {
SessionID string `json:"session_id"`
ExternalID string `json:"external_id"`
Status agent.SessionStatus `json:"status"`
ServerURL string `json:"server_url,omitempty"`
}
SessionSnapshot is the runtime-fields shape returned by endpoints where the caller already has the full SessionInfo. ServerURL is populated for backends that expose an HTTP server (OpenCode only).
Source Files
¶
- accesslog.go
- auth.go
- catalog.go
- events.go
- github_connect.go
- github_credentials.go
- github_pr.go
- github_pull_request.go
- github_repos.go
- github_repository.go
- import_project.go
- middleware.go
- mux.go
- presets.go
- preview.go
- projects.go
- remote.go
- remote_ref.go
- repos.go
- sessions.go
- sessions_meta.go
- software_manifest.go
- templates.go
- tunnel.go
- worktrees.go