sessionmanager

package
v1.354.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package sessionmanager implements the session manager forwarding endpoint.

This package enables "small-cluster mode": a Proxy B instance that accepts pre-built SessionSettings from a trusted upstream Proxy A and creates sessions without needing any local secrets (agentapi-settings-*, GitHub secrets, etc.).

All requests to /api/v1/sessions must carry an HMAC-SHA256 signature in the X-Hub-Signature-256 header and the Unix timestamp in the X-Timestamp header. The signature covers "METHOD\nPATH?QUERY\nTIMESTAMP\nBODY", preventing both request forgery and replay attacks. The shared secret is configured via SESSION_MANAGER_HMAC_SECRET (or config file).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateSessionResponse

type CreateSessionResponse struct {
	SessionID string `json:"session_id"`
}

CreateSessionResponse is returned after successful session creation.

type Handlers

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

Handlers implements app.CustomHandler for the session manager forwarding endpoint.

func NewHandlers

func NewHandlers(sessionManager repositories.SessionManager, hmacSecret string) *Handlers

NewHandlers creates a new Handlers instance. hmacSecret must be non-empty; if it is empty, RegisterRoutes will refuse to register.

func (*Handlers) CreateSession

func (h *Handlers) CreateSession(c echo.Context) error

CreateSession handles POST /api/v1/sessions.

Body: sessionsettings.SessionSettings JSON (pre-built by upstream Proxy A). The settings are used verbatim as the provision payload; no local secrets are resolved on Proxy B.

func (*Handlers) DeleteSession

func (h *Handlers) DeleteSession(c echo.Context) error

DeleteSession handles DELETE /api/v1/sessions/:sessionId.

func (*Handlers) GetName

func (h *Handlers) GetName() string

GetName returns the handler name for logging.

func (*Handlers) GetSession

func (h *Handlers) GetSession(c echo.Context) error

GetSession handles GET /api/v1/sessions/:sessionId.

func (*Handlers) ListSessions

func (h *Handlers) ListSessions(c echo.Context) error

ListSessions handles GET /api/v1/sessions.

Optional query parameters:

  • user_id : filter by user ID
  • scope : "user" or "team"
  • team_id : filter by team ID (e.g., "org/team-slug")
  • status : filter by session status (e.g., "running", "stopped")

func (*Handlers) RegisterRoutes

func (h *Handlers) RegisterRoutes(e *echo.Echo, _ *app.Server) error

RegisterRoutes registers /api/v1/sessions routes with HMAC middleware. If hmacSecret is empty, registration is skipped with a warning.

type ListSessionsResponse

type ListSessionsResponse struct {
	Sessions []SessionInfo `json:"sessions"`
}

ListSessionsResponse wraps the list of sessions.

type SessionInfo

type SessionInfo struct {
	ID        string    `json:"id"`
	UserID    string    `json:"user_id"`
	Status    string    `json:"status"`
	CreatedAt time.Time `json:"created_at"`
}

SessionInfo is a lightweight session representation returned by list/get.

Jump to

Keyboard shortcuts

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