Documentation
¶
Overview ¶
Package api - application REST API
Package api - application REST API ¶
Package api - application REST API ¶
Package api - application REST API ¶
Package api - application REST API ¶
Package api - application REST API ¶
Package api - application REST API ¶
Package api - application REST API ¶
Package api - application REST API ¶
Package api - application REST API
Index ¶
- func BuildHTTPServer(httpCfg models.APIServerConfig, persistence db.Client, ...) (*http.Server, error)
- func BuildMetricsCollectionServer(httpCfg models.HTTPServerConfig, metricsCollector goutils.MetricsCollector, ...) *http.Server
- type LivenessHandler
- type MCPDefineNewSessionParams
- type MCPDeleteSessionParams
- type MCPDockerDriverSettings
- type MCPGetSessionParams
- type MCPGetSessionResp
- type MCPHandler
- type MCPListSessionsParams
- type MCPListSessionsResp
- type MCPReadSessionOutputChunkParams
- type MCPReadSessionOutputNewestParams
- type MCPReadSessionOutputResp
- type MCPSession
- type MCPStartSessionParams
- type MCPStopSessionParams
- type MCPSubmitUserInputParams
- type MCPUpdateSessionCommandParams
- type MCPUpdateSessionDescriptionParams
- type MCPUpdateSessionNameParams
- type MCPUpdateSessionOutputBufCapacityParams
- type NewSessionRequest
- type SessionEntryResponse
- type SessionIOCore
- func (c SessionIOCore) GetSessionOutputBuffer(ctx context.Context, sessionName string) (goutilsRedis.RingBuffer, error)
- func (c SessionIOCore) ReadSessionOutputChunk(ctx context.Context, sessionName string, offset int64, limit int, ...) (SessionOutputRead, error)
- func (c SessionIOCore) ReadSessionOutputNewest(ctx context.Context, sessionName string, limit int, stripANSI bool) (SessionOutputRead, error)
- func (c SessionIOCore) SubmitUserCommandToSession(ctx context.Context, sessionName string, commands []models.SessionInputCommand) error
- type SessionIOHandler
- func (h SessionIOHandler) ReadSessionOutputChunk(w http.ResponseWriter, r *http.Request)
- func (h SessionIOHandler) ReadSessionOutputNewest(w http.ResponseWriter, r *http.Request)
- func (h SessionIOHandler) SubmitUserCommandToSession(w http.ResponseWriter, r *http.Request)
- func (h SessionIOHandler) TailSessionOutput(w http.ResponseWriter, r *http.Request)
- type SessionListResponse
- type SessionManagerCore
- func (c SessionManagerCore) DefineNewSession(ctx context.Context, params NewSessionRequest) (models.Session, error)
- func (c SessionManagerCore) DeleteSession(ctx context.Context, sessionName string) error
- func (c SessionManagerCore) GetSession(ctx context.Context, sessionName string) (models.Session, error)
- func (c SessionManagerCore) ListSessions(ctx context.Context, filters db.SessionQueryFilter) ([]models.Session, error)
- func (c SessionManagerCore) Ready(ctx context.Context) error
- func (c SessionManagerCore) StartSession(ctx context.Context, sessionName string, blocking bool) error
- func (c SessionManagerCore) StopSession(ctx context.Context, sessionName string, blocking bool) error
- func (c SessionManagerCore) UpdateSessionCommand(ctx context.Context, sessionName string, newCommand models.SessionCommand) error
- func (c SessionManagerCore) UpdateSessionDescription(ctx context.Context, sessionName string, description *string) error
- func (c SessionManagerCore) UpdateSessionDriver(ctx context.Context, sessionName string, ...) error
- func (c SessionManagerCore) UpdateSessionName(ctx context.Context, sessionName string, newName string) error
- func (c SessionManagerCore) UpdateSessionOutputBufCapacity(ctx context.Context, sessionName string, newCapacity int64, blocking bool) error
- func (c SessionManagerCore) UpdateSessionRunMode(ctx context.Context, sessionName string, ...) error
- type SessionManagerHandler
- func (h SessionManagerHandler) Alive(w http.ResponseWriter, r *http.Request)
- func (h SessionManagerHandler) DefineNewSession(w http.ResponseWriter, r *http.Request)
- func (h SessionManagerHandler) DeleteSession(w http.ResponseWriter, r *http.Request)
- func (h SessionManagerHandler) GetSession(w http.ResponseWriter, r *http.Request)
- func (h SessionManagerHandler) ListSessions(w http.ResponseWriter, r *http.Request)
- func (h SessionManagerHandler) Ready(w http.ResponseWriter, r *http.Request)
- func (h SessionManagerHandler) StartSession(w http.ResponseWriter, r *http.Request)
- func (h SessionManagerHandler) StopSession(w http.ResponseWriter, r *http.Request)
- func (h SessionManagerHandler) UpdateSessionCommand(w http.ResponseWriter, r *http.Request)
- func (h SessionManagerHandler) UpdateSessionDescription(w http.ResponseWriter, r *http.Request)
- func (h SessionManagerHandler) UpdateSessionDriver(w http.ResponseWriter, r *http.Request)
- func (h SessionManagerHandler) UpdateSessionName(w http.ResponseWriter, r *http.Request)
- func (h SessionManagerHandler) UpdateSessionOutputBufCapacity(w http.ResponseWriter, r *http.Request)
- func (h SessionManagerHandler) UpdateSessionRunMode(w http.ResponseWriter, r *http.Request)
- type SessionOutputChunkResponse
- type SessionOutputRead
- type UpdateSessionDescriptionRequest
- type UpdateSessionDriverRequest
- type UserCommandRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildHTTPServer ¶
func BuildHTTPServer( httpCfg models.APIServerConfig, persistence db.Client, redisClient goutilsRedis.Client, manager session.Manager, metrics goutils.HTTPRequestMetricHelper, ) (*http.Server, error)
BuildHTTPServer create server to host session CRUD and IO endpoints
@param httpCfg models.APIServerConfig - HTTP API server configuration @param persistence db.Client - DB persistence layer @param redisClient goutilsRedis.Client - redis client @param manager session.Manager - session manager @param metrics goutils.HTTPRequestMetricHelper - metric collection agent @returns HTTP server instance
func BuildMetricsCollectionServer ¶
func BuildMetricsCollectionServer( httpCfg models.HTTPServerConfig, metricsCollector goutils.MetricsCollector, collectionEndpoint string, maxRESTRequests int, ) *http.Server
BuildMetricsCollectionServer create server to host metrics collection endpoint
@param httpCfg common.HTTPServerConfig - HTTP server configuration @param metricsCollector goutils.MetricsCollector - metrics collector @param collectionEndpoint string - endpoint to expose the metrics on @param maxRESTRequests int - max number fo parallel requests to support @returns HTTP server instance
Types ¶
type LivenessHandler ¶
type LivenessHandler struct {
goutils.RestAPIHandler
// contains filtered or unexported fields
}
LivenessHandler liveness API handlers
func NewLivenessHandler ¶
func NewLivenessHandler( persistence db.Client, logConfig models.HTTPRequestLogging, metrics goutils.HTTPRequestMetricHelper, ) LivenessHandler
NewLivenessHandler define a new liveness REST API handler
@param persistence db.Client - DB persistence layer @param logConfig common.HTTPRequestLogging - handler log settings @param metrics goutils.HTTPRequestMetricHelper - metric collection agent @returns new handler
func (LivenessHandler) Alive ¶
func (h LivenessHandler) Alive(w http.ResponseWriter, r *http.Request)
Alive godoc @Summary API liveness check @Description Will return success to indicate REST API module is live @tags util @Produce json @Param X-Request-ID header string false "Request ID" @Success 200 {object} goutils.RestAPIBaseResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /liveness/alive [get]
func (LivenessHandler) Ready ¶
func (h LivenessHandler) Ready(w http.ResponseWriter, r *http.Request)
Ready godoc @Summary API readiness check @Description Will return success to indicate REST API module is ready @tags util @Produce json @Param X-Request-ID header string false "Request ID" @Success 200 {object} goutils.RestAPIBaseResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /liveness/ready [get]
type MCPDefineNewSessionParams ¶ added in v0.2.0
type MCPDefineNewSessionParams struct {
// Name session name, can only contain alphanumeric characters and -
Name string `json:"name" validate:"required,session_name_type" jsonschema:"session name, can only contain alphanumeric characters and -"`
// Description session description
Description *string `json:"description,omitempty" validate:"omitempty" jsonschema:"session description"`
// Command the session will operate
Command models.SessionCommand `json:"command" validate:"required" jsonschema:"the command the session will run"`
// OutputBufferCapacity buffering capacity for holding command output history
OutputBufferCapacity int64 `` /* 143-byte string literal not displayed */
// Driver the sandboxed docker container settings for the session
Driver MCPDockerDriverSettings `json:"driver" validate:"required" jsonschema:"the sandboxed docker container settings for the session"`
}
MCPDefineNewSessionParams parameters for the define-new-session tool.
Loosely mirrors NewSessionRequest (POST /v1/sessions), but the driver is fixed: an agent may only define sessions backed by a sandboxed docker container. There is no driver-type selection and no raw driver metadata; the permitted docker settings are given by the typed Driver field.
type MCPDeleteSessionParams ¶ added in v0.2.0
type MCPDeleteSessionParams struct {
// SessionName name of the session to delete
SessionName string `json:"session_name" validate:"required" jsonschema:"name of the session to delete"`
}
MCPDeleteSessionParams parameters for the delete-session tool.
Mirrors DELETE /v1/sessions/{sessionName}. Only permitted on IDLE sessions.
type MCPDockerDriverSettings ¶ added in v0.2.0
type MCPDockerDriverSettings struct {
// Image container image reference to run
Image string `json:"image" validate:"required" jsonschema:"container image reference to run"`
// DisplayRows TTY number of rows (in cells).
DisplayRows uint16 `json:"display_rows" validate:"gte=30" jsonschema:"TTY number of rows (in cells); must be >= 30"`
// DisplayCols TTY number of columns (in cells).
DisplayCols uint16 `json:"display_cols" validate:"gte=80" jsonschema:"TTY number of columns (in cells); must be >= 80"`
// WorkingDir working directory for the container process; defaults to '/tmp'
WorkingDir string `json:"working_dir,omitempty" jsonschema:"working directory for the container process; defaults to '/tmp'"`
// WritableDirs tmpfs mounts providing writable directories within the read-only rootfs
WritableDirs []goutilsRuntime.InMemoryWritableDir `` /* 141-byte string literal not displayed */
// NetworkMode the container network mode (e.g. "none", "bridge"); defaults to 'none'.
// Must be routable when PublishPorts is set.
NetworkMode string `` /* 162-byte string literal not displayed */
// PublishPorts container ports published to the host for inbound connections
PublishPorts []goutilsRuntime.DockerPortPublish `` /* 131-byte string literal not displayed */
// ExtraHosts additional host-to-IP mappings for the container
ExtraHosts []goutilsRuntime.ContainerExtraHost `json:"extra_hosts,omitempty" validate:"omitempty,dive" jsonschema:"additional host-to-IP mappings for the container"`
// Environment additional environment variables for the container process
Environment []goutilsRuntime.ContainerEnvVar `` /* 126-byte string literal not displayed */
}
MCPDockerDriverSettings the docker driver settings an agent is permitted to set when defining a session via MCP.
This is a deliberately restricted projection of models.SessionDriverDockerParams. Agent sessions are always run in a sandboxed docker container, so only the fields safe for an agent to control are exposed here: notably, host bind-mounts (HostMounts), added Linux capabilities (AddCapabilities), and the container hardening toggles (read-only rootfs, drop-all-capabilities, no-new-privileges, etc.) are NOT exposed and keep their hardened defaults. Any field left unset falls back to the default defined on models.SessionDriverDockerParams. If a session needs capabilities beyond what this allows, an operator can adjust the driver settings out-of-band via the REST API.
func (MCPDockerDriverSettings) ToDriverParams ¶ added in v0.2.0
func (s MCPDockerDriverSettings) ToDriverParams() models.SessionDriverDockerParams
ToDriverParams project the restricted agent-facing settings onto the full docker driver parameters. Fields not exposed to the agent are left at their zero value so the driver applies its hardened defaults (read-only rootfs, all capabilities dropped, no host mounts, no-new-privileges, etc.).
type MCPGetSessionParams ¶ added in v0.2.0
type MCPGetSessionParams struct {
// SessionName name of the session to fetch
SessionName string `json:"session_name" validate:"required" jsonschema:"name of the session to fetch"`
}
MCPGetSessionParams parameters for the get-session tool.
Mirrors GET /v1/sessions/{sessionName}.
type MCPGetSessionResp ¶ added in v0.2.0
type MCPGetSessionResp struct {
// Session the requested session
Session MCPSession `json:"session" jsonschema:"the requested session"`
}
MCPGetSessionResp response for the get-session tool.
type MCPHandler ¶ added in v0.2.0
type MCPHandler struct {
goutils.MCPHandler
// contains filtered or unexported fields
}
MCPHandler MCP request handler
func NewSessionMCPHandler ¶ added in v0.2.0
func NewSessionMCPHandler( persistence db.Client, manager session.Manager, redisClient goutilsRedis.Client, logConfig models.HTTPRequestLogging, ) (MCPHandler, error)
NewSessionMCPHandler define a new session MCP request handler
@param persistence db.Client - DB persistence layer @param manager session.Manager - session manager @param redisClient goutilsRedis.Client - redis client @returns new handler
func (MCPHandler) RegisterTools ¶ added in v0.2.0
func (h MCPHandler) RegisterTools(server *mcp.Server) error
RegisterTools register all session MCP tools against the given MCP server.
@param server *mcp.Server - target MCP server
type MCPListSessionsParams ¶ added in v0.2.0
type MCPListSessionsParams = db.SessionQueryFilter
MCPListSessionsParams parameters for the list-sessions tool.
Mirrors the GET /v1/sessions query filters. This is db.SessionQueryFilter directly, so the tool exposes the same filtering, pagination, and ordering the core already consumes.
type MCPListSessionsResp ¶ added in v0.2.0
type MCPListSessionsResp struct {
// Sessions sessions matching the query filter
Sessions []MCPSession `json:"sessions" jsonschema:"sessions matching the query filter"`
}
MCPListSessionsResp response for the list-sessions tool.
type MCPReadSessionOutputChunkParams ¶ added in v0.2.0
type MCPReadSessionOutputChunkParams struct {
// SessionName name of the session to read output from
SessionName string `json:"session_name" validate:"required" jsonschema:"name of the session to read output from"`
// Offset read index position within the session output stream
Offset int64 `` /* 383-byte string literal not displayed */
// Limit max number of bytes to read
Limit int `json:"limit" validate:"required,gte=1" jsonschema:"max number of bytes to read; must be >= 1"`
}
MCPReadSessionOutputChunkParams parameters for the read-session-output-chunk tool.
Mirrors GET /v1/sessions/{sessionName}/io/output/chunk. As the buffer only retains the most recent bytes, the requested offset may have aged out; in that case the read is moved forward to the oldest byte still buffered.
type MCPReadSessionOutputNewestParams ¶ added in v0.2.0
type MCPReadSessionOutputNewestParams struct {
// SessionName name of the session to read output from
SessionName string `json:"session_name" validate:"required" jsonschema:"name of the session to read output from"`
// Limit max number of bytes to read
Limit int `json:"limit" validate:"required,gte=1" jsonschema:"max number of bytes to read; must be >= 1"`
}
MCPReadSessionOutputNewestParams parameters for the read-session-output-newest tool.
Mirrors GET /v1/sessions/{sessionName}/io/output/newest. Unlike the chunk tool no offset is given; the read is anchored to the end of the stream and returns up to "limit" of the most recently written bytes.
type MCPReadSessionOutputResp ¶ added in v0.2.0
type MCPReadSessionOutputResp struct {
// Output the decoded terminal text (ANSI escape sequences removed). This is the same
// text returned in the tool result's text content block, duplicated here so clients
// that surface only structured content still receive it.
Output string `` /* 159-byte string literal not displayed */
// ActualOffset the offset the returned data actually starts at. When the requested
// offset has already aged out of the ring buffer, the read is moved forward to the
// oldest byte still in the buffer, and this reports that position.
ActualOffset int64 `` /* 210-byte string literal not displayed */
// Read number of bytes actually read from the buffer
Read int `json:"read" jsonschema:"number of bytes actually read from the buffer"`
}
MCPReadSessionOutputResp structured result for the output-read tools.
The decoded terminal output is ALSO returned to the agent as a text content block; the same text is duplicated here in Output so it is delivered regardless of whether a client surfaces the text content block or only the structured content. The struct additionally carries the positional metadata an agent needs to continue reading (i.e. compute the next offset). This value is emitted as the tool's structured content.
type MCPSession ¶ added in v0.2.0
type MCPSession struct {
// ID PTY session ID
ID string `json:"id" jsonschema:"PTY session ID"`
// Name for the session
Name string `json:"name" jsonschema:"name for the session"`
// Description an optional description for the session
Description *string `json:"description" jsonschema:"an optional description for the session"`
// Command being executed by the session
Command models.SessionCommand `json:"command" jsonschema:"command being executed by the session"`
// State of the session
State models.SessionStateENUMType `json:"state" jsonschema:"state of the session [IDLE, READY]"`
// DriverType indicate which driver the session uses
DriverType models.SessionDriverTypeENUMType `json:"driver" jsonschema:"indicate which driver the session uses"`
// OutputBufferCapacity buffering capacity for holding command output history
OutputBufferCapacity int64 `json:"io_buf_cap" jsonschema:"buffering capacity for holding command output history"`
// RunnerMode session runner operating mode
RunnerMode models.SessionRunnerModeTypeENUMType `json:"runner_mode" jsonschema:"session runner operating mode"`
// CreatedAt entry creation timestamp
CreatedAt time.Time `json:"created_at" jsonschema:"entry creation timestamp"`
// UpdatedAt entry update timestamp
UpdatedAt time.Time `json:"updated_at" jsonschema:"entry update timestamp"`
}
MCPSession the agent-facing projection of models.Session.
This mirrors models.Session but deliberately omits DriverMetadata: the agent is not permitted to inspect or drive the underlying driver settings, so exposing them would be both unnecessary and misleading. Omitting the field here also sidesteps a schema/value mismatch: models.Session.DriverMetadata is a datatypes.JSON (i.e. []byte), which jsonschema-go infers as a "null"/"array" schema, while the marshaled value is the raw driver-metadata object — the output validator rejects that discrepancy.
type MCPStartSessionParams ¶ added in v0.2.0
type MCPStartSessionParams struct {
// SessionName name of the session to start
SessionName string `json:"session_name" validate:"required" jsonschema:"name of the session to start"`
}
MCPStartSessionParams parameters for the start-session tool.
Mirrors POST /v1/sessions/{sessionName}/start.
type MCPStopSessionParams ¶ added in v0.2.0
type MCPStopSessionParams struct {
// SessionName name of the session to stop
SessionName string `json:"session_name" validate:"required" jsonschema:"name of the session to stop"`
}
MCPStopSessionParams parameters for the stop-session tool.
Mirrors POST /v1/sessions/{sessionName}/stop.
type MCPSubmitUserInputParams ¶ added in v0.2.0
type MCPSubmitUserInputParams struct {
// SessionName name of the session to submit input to
SessionName string `json:"session_name" validate:"required" jsonschema:"name of the session to submit input to"`
// Inputs the list of input events to send to the session's running process
Inputs []models.SessionInputCommand `` /* 341-byte string literal not displayed */
}
MCPSubmitUserInputParams parameters for the submit-user-command tool.
Mirrors UserCommandRequest (POST /v1/sessions/{sessionName}/io/input/commands). Only permitted on READY sessions.
Note: the input-events field is deliberately named "inputs" here rather than "commands" (its name on the REST DTO). These are keystroke-level input events fed to the session's running process, NOT the {cmd, args} "command" a session is defined to run; keeping the names distinct on the agent-facing surface prevents an agent from conflating the two.
type MCPUpdateSessionCommandParams ¶ added in v0.2.0
type MCPUpdateSessionCommandParams struct {
// SessionName name of the session to update
SessionName string `json:"session_name" validate:"required" jsonschema:"name of the session to update"`
// Command new command the session runs
Command models.SessionCommand `json:"command" validate:"required" jsonschema:"the new command the session will run"`
}
MCPUpdateSessionCommandParams parameters for the update-session-command tool.
Mirrors PUT /v1/sessions/{sessionName}/command. Only permitted on IDLE sessions.
type MCPUpdateSessionDescriptionParams ¶ added in v0.2.0
type MCPUpdateSessionDescriptionParams struct {
// SessionName name of the session to update
SessionName string `json:"session_name" validate:"required" jsonschema:"name of the session to update"`
// Description new session description, set to null to clear
Description *string `json:"description" validate:"omitempty" jsonschema:"new session description, set to null to clear"`
}
MCPUpdateSessionDescriptionParams parameters for the update-session-description tool.
Mirrors UpdateSessionDescriptionRequest (PUT /v1/sessions/{sessionName}/description).
type MCPUpdateSessionNameParams ¶ added in v0.2.0
type MCPUpdateSessionNameParams struct {
// SessionName current name of the session to rename
SessionName string `json:"session_name" validate:"required" jsonschema:"current name of the session to rename"`
// NewName new session name, can only contain alphanumeric characters and -
NewName string `` /* 131-byte string literal not displayed */
}
MCPUpdateSessionNameParams parameters for the update-session-name tool.
Mirrors PUT /v1/sessions/{sessionName}/name.
type MCPUpdateSessionOutputBufCapacityParams ¶ added in v0.2.0
type MCPUpdateSessionOutputBufCapacityParams struct {
// SessionName name of the session to update
SessionName string `json:"session_name" validate:"required" jsonschema:"name of the session to update"`
// Capacity new output buffer capacity
Capacity int64 `json:"capacity" validate:"required,gte=16384" jsonschema:"new output buffer capacity, in bytes; must be >= 16384"`
}
MCPUpdateSessionOutputBufCapacityParams parameters for the update-session-output-buffer-capacity tool.
Mirrors PUT /v1/sessions/{sessionName}/output-buf-cap. Only permitted on IDLE sessions.
type NewSessionRequest ¶
type NewSessionRequest struct {
// Name session name, can only contain alphanumeric characters and -
Name string `json:"name" validate:"required,session_name_type"`
// Description session description
Description *string `json:"description,omitempty" validate:"omitempty"`
// Command the session will operate
Command models.SessionCommand `json:"command" validate:"required"`
// OutputBufferCapacity buffering capacity for holding command output history
OutputBufferCapacity int64 `json:"io_buf_cap" validate:"required,gte=16384"`
// DriverType indicate which driver the session uses
DriverType models.SessionDriverTypeENUMType `json:"driver" validate:"required,session_driver_type"`
// DriverMetadata metadata relating to the session driver
DriverMetadata json.RawMessage `json:"driver_metadata,omitempty"`
}
NewSessionRequest parameters to define a new session
type SessionEntryResponse ¶
type SessionEntryResponse struct {
goutils.RestAPIBaseResponse
// Session the session
Session models.Session `json:"session" validate:"required"`
}
SessionEntryResponse response containing information for one session
type SessionIOCore ¶ added in v0.2.0
type SessionIOCore struct {
// contains filtered or unexported fields
}
SessionIOCore transport-agnostic session IO business logic. It holds the dependencies shared by the REST handlers and the MCP tools so the actual persistence / redis IPC operations live in one place independent of transport.
func (SessionIOCore) GetSessionOutputBuffer ¶ added in v0.2.0
func (c SessionIOCore) GetSessionOutputBuffer( ctx context.Context, sessionName string, ) (goutilsRedis.RingBuffer, error)
GetSessionOutputBuffer fetch a session by name and return a handle to its output ring buffer. This is the transport-agnostic entry point for callers that drive their own reads against the buffer (e.g. the REST tail streamer), where the per-read length is chosen by the caller rather than by a "limit" parameter. Errors are returned wrapped: a goutils.NotFoundError if the session is unknown.
@param ctx context.Context - execution context @param sessionName string - the name of the session whose output buffer to fetch @returns the ring buffer handle
func (SessionIOCore) ReadSessionOutputChunk ¶ added in v0.2.0
func (c SessionIOCore) ReadSessionOutputChunk( ctx context.Context, sessionName string, offset int64, limit int, stripANSI bool, ) (SessionOutputRead, error)
ReadSessionOutputChunk read one chunk of data from a session's output ring buffer, starting at the given offset. As the buffer only retains the most recent bytes, the requested offset may have aged out; in that case the read is moved forward and the returned ActualOffset reports where the data starts. Errors are returned as-is: a goutils.NotFoundError if the session is unknown.
@param ctx context.Context - execution context @param sessionName string - the name of the session to read from @param offset int64 - the stream offset to start reading at @param limit int - the max number of bytes to read @param stripANSI bool - whether to strip ANSI escape sequences from the returned data @returns the read result
func (SessionIOCore) ReadSessionOutputNewest ¶ added in v0.2.0
func (c SessionIOCore) ReadSessionOutputNewest( ctx context.Context, sessionName string, limit int, stripANSI bool, ) (SessionOutputRead, error)
ReadSessionOutputNewest read the newest bytes from a session's output ring buffer. Unlike ReadSessionOutputChunk no offset is given; the read is anchored to the end of the stream and returns up to "limit" of the most recently written bytes. The returned ActualOffset reports the stream position the returned data starts at. Errors are returned as-is: a goutils.NotFoundError if the session is unknown.
@param ctx context.Context - execution context @param sessionName string - the name of the session to read from @param limit int - the max number of bytes to read @param stripANSI bool - whether to strip ANSI escape sequences from the returned data @returns the read result
func (SessionIOCore) SubmitUserCommandToSession ¶ added in v0.2.0
func (c SessionIOCore) SubmitUserCommandToSession( ctx context.Context, sessionName string, commands []models.SessionInputCommand, ) error
SubmitUserCommandToSession submit a batch of user commands to a session's runner and wait for the runner's acknowledgement, exchanged over the redis IPC queues.
The session must exist and be in the READY state to accept commands. Errors are returned as-is: a goutils.NotFoundError if the session is unknown, a goutils.ConsistencyError if the session is not ready, and other errors for IPC / runner failures.
@param ctx context.Context - execution context @param sessionName string - the name of the session to submit commands to @param commands []models.SessionInputCommand - the commands to submit @returns error encountered while submitting the commands
type SessionIOHandler ¶
type SessionIOHandler struct {
goutils.RestAPIHandler
// contains filtered or unexported fields
}
SessionIOHandler session IO API handlers
func NewSessionIOHandler ¶
func NewSessionIOHandler( persistence db.Client, redisClient goutilsRedis.Client, logConfig models.HTTPRequestLogging, metrics goutils.HTTPRequestMetricHelper, ) (SessionIOHandler, error)
NewSessionIOHandler define a new session IO REST API handler
@param persistence db.Client - DB persistence layer @param redisClient goutilsRedis.Client - redis client @param logConfig common.HTTPRequestLogging - handler log settings @param metrics goutils.HTTPRequestMetricHelper - metric collection agent @returns new handler
func (SessionIOHandler) ReadSessionOutputChunk ¶
func (h SessionIOHandler) ReadSessionOutputChunk(w http.ResponseWriter, r *http.Request)
ReadSessionOutputChunk godoc @Summary Read one chunk of session output @Description Read one chunk of data from a session's output ring buffer. As the buffer only @Description retains the most recent bytes, the requested offset may have aged out; in that @Description case the read is moved forward and "actual_offset" reports where the data starts. @tags io @Produce json @Param X-Request-ID header string false "Request ID" @Param sessionName path string true "Session name" @Param offset query int true "Read index position within the session output stream" @Param limit query int true "Max number of bytes to read" @Param strip_ansi query bool false "Strip ANSI escape sequences from the returned data" @Success 200 {object} SessionOutputChunkResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions/{sessionName}/io/output/chunk [get]
func (SessionIOHandler) ReadSessionOutputNewest ¶
func (h SessionIOHandler) ReadSessionOutputNewest(w http.ResponseWriter, r *http.Request)
ReadSessionOutputNewest godoc @Summary Read the newest session output @Description Read the newest bytes from a session's output ring buffer. Unlike the "chunk" @Description endpoint no offset is given; the read is anchored to the end of the stream and @Description returns up to "limit" of the most recently written bytes. "actual_offset" reports @Description the stream position the returned data starts at. @tags io @Produce json @Param X-Request-ID header string false "Request ID" @Param sessionName path string true "Session name" @Param limit query int true "Max number of bytes to read" @Param strip_ansi query bool false "Strip ANSI escape sequences from the returned data" @Success 200 {object} SessionOutputChunkResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions/{sessionName}/io/output/newest [get]
func (SessionIOHandler) SubmitUserCommandToSession ¶
func (h SessionIOHandler) SubmitUserCommandToSession(w http.ResponseWriter, r *http.Request)
SubmitUserCommandToSession godoc @Summary Submit user commands @Description Submit user commands to session runner @tags io @Produce json @Param X-Request-ID header string false "Request ID" @Param sessionName path string true "Session name" @Param param body UserCommandRequest true "User commands" @Success 200 {object} goutils.RestAPIBaseResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 409 {object} goutils.RestAPIBaseResponse "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions/{sessionName}/io/input/commands [post]
func (SessionIOHandler) TailSessionOutput ¶
func (h SessionIOHandler) TailSessionOutput(w http.ResponseWriter, r *http.Request)
TailSessionOutput godoc @Summary Tail session output @Description Continuously stream a session's output via server-sent events (SSE). Each event @Description carries a base64 encoded chunk of bytes read from the output ring buffer. The @Description stream runs until the client disconnects. @tags io @Produce text/event-stream @Param X-Request-ID header string false "Request ID" @Param sessionName path string true "Session name" @Param offset query int true "Read index position to start tailing from" @Param poll_period_msec query int false "Milliseconds between buffer data availability checks (default 250)" @Param strip_ansi query bool false "Strip ANSI escape sequences from the streamed data" @Success 200 {string} string "SSE stream" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions/{sessionName}/io/output/tail [get]
type SessionListResponse ¶
type SessionListResponse struct {
goutils.RestAPIBaseResponse
// Sessions the list of sessions
Sessions []models.Session `json:"sessions,omitempty" validate:"omitempty,dive"`
}
SessionListResponse response containing a list of sessions
type SessionManagerCore ¶ added in v0.2.0
type SessionManagerCore struct {
// contains filtered or unexported fields
}
SessionManagerCore transport-agnostic session management business logic. It holds the dependencies shared by the REST handlers and the MCP tools so the actual persistence / session-manager operations live in one place independent of transport.
func (SessionManagerCore) DefineNewSession ¶ added in v0.2.0
func (c SessionManagerCore) DefineNewSession( ctx context.Context, params NewSessionRequest, ) (models.Session, error)
DefineNewSession define a new session.
The parameters and the driver metadata are validated before the session is created; parse and validation failures are reported as a goutils.ValidationError.
@param ctx context.Context - execution context @param params NewSessionRequest - the new session parameters @returns the newly defined session, or a goutils.ValidationError if the parameters are invalid
func (SessionManagerCore) DeleteSession ¶ added in v0.2.0
func (c SessionManagerCore) DeleteSession(ctx context.Context, sessionName string) error
DeleteSession delete a session. Only permitted on IDLE sessions.
@param ctx context.Context - execution context @param sessionName string - the name of the session to delete @returns goutils.NotFoundError if the session is unknown, goutils.ConsistencyError if the session is not in a state allowing deletion
func (SessionManagerCore) GetSession ¶ added in v0.2.0
func (c SessionManagerCore) GetSession( ctx context.Context, sessionName string, ) (models.Session, error)
GetSession fetch one session by its name.
@param ctx context.Context - execution context @param sessionName string - the name of the session to fetch @returns the session, or a goutils.NotFoundError if no such session exists
func (SessionManagerCore) ListSessions ¶ added in v0.2.0
func (c SessionManagerCore) ListSessions( ctx context.Context, filters db.SessionQueryFilter, ) ([]models.Session, error)
ListSessions list the known sessions matching the given filter.
The filter is validated before the query is run; an invalid filter is reported as a goutils.ValidationError so callers can distinguish bad input from a query failure.
@param ctx context.Context - execution context @param filters db.SessionQueryFilter - filtering and ordering to apply @returns the matching sessions
func (SessionManagerCore) Ready ¶ added in v0.2.0
func (c SessionManagerCore) Ready(ctx context.Context) error
Ready run the persistence-layer readiness check.
@param ctx context.Context - execution context @returns error if the persistence layer is not ready
func (SessionManagerCore) StartSession ¶ added in v0.2.0
func (c SessionManagerCore) StartSession( ctx context.Context, sessionName string, blocking bool, ) error
StartSession bring up a session runner for an existing session and start it, applied through the session manager.
@param ctx context.Context - execution context @param sessionName string - the name of the session to start @param blocking bool - whether to wait for the start to complete @returns goutils.NotFoundError if the session is unknown, goutils.ConsistencyError if the session is not in a state allowing start
func (SessionManagerCore) StopSession ¶ added in v0.2.0
func (c SessionManagerCore) StopSession( ctx context.Context, sessionName string, blocking bool, ) error
StopSession bring a session back to IDLE and unload its runner, applied through the session manager.
@param ctx context.Context - execution context @param sessionName string - the name of the session to stop @param blocking bool - whether to wait for the stop to complete @returns goutils.NotFoundError if the session is unknown, goutils.ConsistencyError if the session is not in a state allowing stop
func (SessionManagerCore) UpdateSessionCommand ¶ added in v0.2.0
func (c SessionManagerCore) UpdateSessionCommand( ctx context.Context, sessionName string, newCommand models.SessionCommand, ) error
UpdateSessionCommand change the command a session runs. Only permitted on IDLE sessions.
The command is validated before the change is applied; an invalid command is reported as a goutils.ValidationError.
@param ctx context.Context - execution context @param sessionName string - the name of the session to update @param newCommand models.SessionCommand - the new command @returns goutils.ValidationError if the command is invalid, goutils.NotFoundError if the session is unknown, goutils.ConsistencyError if the session is not in a state allowing the change
func (SessionManagerCore) UpdateSessionDescription ¶ added in v0.2.0
func (c SessionManagerCore) UpdateSessionDescription( ctx context.Context, sessionName string, description *string, ) error
UpdateSessionDescription change the description of a session.
@param ctx context.Context - execution context @param sessionName string - the name of the session to update @param description *string - the new description, or nil to clear it @returns goutils.NotFoundError if the session is unknown
func (SessionManagerCore) UpdateSessionDriver ¶ added in v0.2.0
func (c SessionManagerCore) UpdateSessionDriver( ctx context.Context, sessionName string, driverType models.SessionDriverTypeENUMType, rawMetadata json.RawMessage, ) error
UpdateSessionDriver change the driver a session uses, along with its setup metadata. Only permitted on IDLE sessions.
The driver metadata is parsed and validated for the given driver type before the change is applied; parse/validation failures are reported as a goutils.ValidationError.
@param ctx context.Context - execution context @param sessionName string - the name of the session to update @param driverType models.SessionDriverTypeENUMType - the new driver type @param rawMetadata json.RawMessage - the raw driver metadata JSON @returns goutils.ValidationError if the driver parameters are invalid, goutils.NotFoundError if the session is unknown, goutils.ConsistencyError if the session is not in a state allowing the change
func (SessionManagerCore) UpdateSessionName ¶ added in v0.2.0
func (c SessionManagerCore) UpdateSessionName( ctx context.Context, sessionName string, newName string, ) error
UpdateSessionName change the name of a session.
The new name is validated before the change is applied; an invalid name is reported as a goutils.ValidationError.
@param ctx context.Context - execution context @param sessionName string - the current name of the session to update @param newName string - the new session name @returns goutils.ValidationError if the name is invalid, goutils.NotFoundError if the session is unknown
func (SessionManagerCore) UpdateSessionOutputBufCapacity ¶ added in v0.2.0
func (c SessionManagerCore) UpdateSessionOutputBufCapacity( ctx context.Context, sessionName string, newCapacity int64, blocking bool, ) error
UpdateSessionOutputBufCapacity change the output buffer capacity of a session, applied through the session manager. Only permitted on IDLE sessions.
@param ctx context.Context - execution context @param sessionName string - the name of the session to update @param newCapacity int64 - the new output buffer capacity @param blocking bool - whether to wait for the change to complete @returns goutils.NotFoundError if the session is unknown, goutils.ConsistencyError if the session is not in a state allowing the change
func (SessionManagerCore) UpdateSessionRunMode ¶ added in v0.2.0
func (c SessionManagerCore) UpdateSessionRunMode( ctx context.Context, sessionName string, newMode models.SessionRunnerModeTypeENUMType, ) error
UpdateSessionRunMode change the runner mode of a session. Only permitted on IDLE sessions.
The mode is validated before the change is applied; an invalid mode is reported as a goutils.ValidationError.
@param ctx context.Context - execution context @param sessionName string - the name of the session to update @param newMode models.SessionRunnerModeTypeENUMType - the new runner mode @returns goutils.ValidationError if the mode is invalid, goutils.NotFoundError if the session is unknown, goutils.ConsistencyError if the session is not in a state allowing the change
type SessionManagerHandler ¶
type SessionManagerHandler struct {
goutils.RestAPIHandler
// contains filtered or unexported fields
}
SessionManagerHandler session management API handlers
func NewSessionManagerHandler ¶
func NewSessionManagerHandler( persistence db.Client, manager session.Manager, logConfig models.HTTPRequestLogging, metrics goutils.HTTPRequestMetricHelper, ) (SessionManagerHandler, error)
NewSessionManagerHandler define a new session manager REST API handler
@param persistence db.Client - DB persistence layer @param manager session.Manager - session manager @param logConfig common.HTTPRequestLogging - handler log settings @param metrics goutils.HTTPRequestMetricHelper - metric collection agent @returns new handler
func (SessionManagerHandler) Alive ¶
func (h SessionManagerHandler) Alive(w http.ResponseWriter, r *http.Request)
Alive godoc @Summary API liveness check @Description Will return success to indicate REST API module is live @tags util @Produce json @Param X-Request-ID header string false "Request ID" @Success 200 {object} goutils.RestAPIBaseResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /liveness/alive [get]
func (SessionManagerHandler) DefineNewSession ¶
func (h SessionManagerHandler) DefineNewSession(w http.ResponseWriter, r *http.Request)
DefineNewSession godoc @Summary Define a new session @Description Define a new session @tags management @Accept json @Produce json @Param X-Request-ID header string false "Request ID" @Param param body NewSessionRequest true "Session parameters" @Success 200 {object} SessionEntryResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions [post]
func (SessionManagerHandler) DeleteSession ¶
func (h SessionManagerHandler) DeleteSession(w http.ResponseWriter, r *http.Request)
DeleteSession godoc @Summary Delete a session @Description Delete a session. Only permitted on IDLE sessions. @tags management @Produce json @Param X-Request-ID header string false "Request ID" @Param sessionName path string true "Session name" @Success 200 {object} goutils.RestAPIBaseResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 409 {object} goutils.RestAPIBaseResponse "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions/{sessionName} [delete]
func (SessionManagerHandler) GetSession ¶
func (h SessionManagerHandler) GetSession(w http.ResponseWriter, r *http.Request)
GetSession godoc @Summary Get one session @Description Fetch one session by its name @tags management @Produce json @Param X-Request-ID header string false "Request ID" @Param sessionName path string true "Session name" @Success 200 {object} SessionEntryResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions/{sessionName} [get]
func (SessionManagerHandler) ListSessions ¶
func (h SessionManagerHandler) ListSessions(w http.ResponseWriter, r *http.Request)
ListSessions godoc @Summary List sessions @Description List the known sessions, with optional filtering and ordering @tags management @Produce json @Param X-Request-ID header string false "Request ID" @Param name query string false "Filter by sessions whose name is similar to this, case insensitive" @Param offset query int false "Number of leading entries to skip" @Param limit query int false "Max number of entries to return" @Param driver query []string false "Filter by session driver type" collectionFormat(multi) @Param state query []string false "Filter by session state" collectionFormat(multi) @Param order_by_name query bool false "Whether to order the results by session name" @Param order_dir query string false "Ordering direction, defaults to 'ASC'" Enums(asc, desc, ASC, DESC) @Success 200 {object} SessionListResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions [get]
func (SessionManagerHandler) Ready ¶
func (h SessionManagerHandler) Ready(w http.ResponseWriter, r *http.Request)
Ready godoc @Summary API readiness check @Description Will return success to indicate REST API module is ready @tags util @Produce json @Param X-Request-ID header string false "Request ID" @Success 200 {object} goutils.RestAPIBaseResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /liveness/ready [get]
func (SessionManagerHandler) StartSession ¶
func (h SessionManagerHandler) StartSession(w http.ResponseWriter, r *http.Request)
StartSession godoc @Summary Start a session @Description Bring up a session runner for an existing session and start it. By default @Description the request to the session manager is non-blocking; set "block" to true to @Description wait for the start to complete. @tags management @Produce json @Param X-Request-ID header string false "Request ID" @Param sessionName path string true "Session name" @Param block query bool false "Whether to block until the start completes" @Success 200 {object} goutils.RestAPIBaseResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 409 {object} goutils.RestAPIBaseResponse "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions/{sessionName}/start [post]
func (SessionManagerHandler) StopSession ¶
func (h SessionManagerHandler) StopSession(w http.ResponseWriter, r *http.Request)
StopSession godoc @Summary Stop a session @Description Bring a session back to IDLE and unload its runner. By default the request @Description to the session manager is non-blocking; set "block" to true to wait for the @Description stop to complete. @tags management @Produce json @Param X-Request-ID header string false "Request ID" @Param sessionName path string true "Session name" @Param block query bool false "Whether to block until the stop completes" @Success 200 {object} goutils.RestAPIBaseResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 409 {object} goutils.RestAPIBaseResponse "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions/{sessionName}/stop [post]
func (SessionManagerHandler) UpdateSessionCommand ¶
func (h SessionManagerHandler) UpdateSessionCommand(w http.ResponseWriter, r *http.Request)
UpdateSessionCommand godoc @Summary Change session command @Description Change the command a session runs. Only permitted on IDLE sessions. @tags management @Accept json @Produce json @Param X-Request-ID header string false "Request ID" @Param sessionName path string true "Session name" @Param param body models.SessionCommand true "New session command" @Success 200 {object} goutils.RestAPIBaseResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 409 {object} goutils.RestAPIBaseResponse "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions/{sessionName}/command [put]
func (SessionManagerHandler) UpdateSessionDescription ¶
func (h SessionManagerHandler) UpdateSessionDescription(w http.ResponseWriter, r *http.Request)
UpdateSessionDescription godoc @Summary Change session description @Description Change the description of a session @tags management @Accept json @Produce json @Param X-Request-ID header string false "Request ID" @Param sessionName path string true "Session name" @Param param body UpdateSessionDescriptionRequest true "New session description" @Success 200 {object} goutils.RestAPIBaseResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions/{sessionName}/description [put]
func (SessionManagerHandler) UpdateSessionDriver ¶
func (h SessionManagerHandler) UpdateSessionDriver(w http.ResponseWriter, r *http.Request)
UpdateSessionDriver godoc @Summary Change session driver @Description Change the driver a session uses, along with its setup metadata. Only permitted on IDLE sessions. @tags management @Accept json @Produce json @Param X-Request-ID header string false "Request ID" @Param sessionName path string true "Session name" @Param param body UpdateSessionDriverRequest true "New session driver parameters" @Success 200 {object} goutils.RestAPIBaseResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 409 {object} goutils.RestAPIBaseResponse "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions/{sessionName}/driver [put]
func (SessionManagerHandler) UpdateSessionName ¶
func (h SessionManagerHandler) UpdateSessionName(w http.ResponseWriter, r *http.Request)
UpdateSessionName godoc @Summary Change session name @Description Change the name of a session @tags management @Produce json @Param X-Request-ID header string false "Request ID" @Param sessionName path string true "Session name" @Param name query string true "New session name, can only contain alphanumeric characters and -" @Success 200 {object} goutils.RestAPIBaseResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions/{sessionName}/name [put]
func (SessionManagerHandler) UpdateSessionOutputBufCapacity ¶
func (h SessionManagerHandler) UpdateSessionOutputBufCapacity( w http.ResponseWriter, r *http.Request, )
UpdateSessionOutputBufCapacity godoc @Summary Change session output buffer capacity @Description Change the output buffer capacity of a session. Only permitted on IDLE sessions. @Description The change is performed through the session manager; by default the request is @Description non-blocking, set "block" to true to wait for the change to complete. @tags management @Produce json @Param X-Request-ID header string false "Request ID" @Param sessionName path string true "Session name" @Param capacity query int true "New output buffer capacity" @Param block query bool false "Whether to block until the change completes" @Success 200 {object} goutils.RestAPIBaseResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 409 {object} goutils.RestAPIBaseResponse "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions/{sessionName}/output-buf-cap [put]
func (SessionManagerHandler) UpdateSessionRunMode ¶
func (h SessionManagerHandler) UpdateSessionRunMode(w http.ResponseWriter, r *http.Request)
UpdateSessionRunMode godoc @Summary Change session runner mode @Description Change the runner mode of a session. Only permitted on IDLE sessions. @tags management @Produce json @Param X-Request-ID header string false "Request ID" @Param sessionName path string true "Session name" @Param mode query string true "New session runner mode" Enums(COMMANDED, BY_PASSED) @Success 200 {object} goutils.RestAPIBaseResponse "success" @Failure 400 {object} goutils.RestAPIBaseResponse "error" @Failure 403 {object} goutils.RestAPIBaseResponse "error" @Failure 404 {string} string "error" @Failure 409 {object} goutils.RestAPIBaseResponse "error" @Failure 500 {object} goutils.RestAPIBaseResponse "error" @Router /v1/sessions/{sessionName}/run-mode [put]
type SessionOutputChunkResponse ¶
type SessionOutputChunkResponse struct {
goutils.RestAPIBaseResponse
// ActualOffset the offset the returned data actually starts at. When the requested offset
// has already aged out of the ring buffer, the read is moved forward to the oldest byte
// still in the buffer, and this reports that position.
ActualOffset int64 `json:"actual_offset" validate:"gte=0"`
// Read number of bytes actually read from the buffer
Read int `json:"read" validate:"gte=0"`
// Data base64 encoded chunk read from the buffer
Data string `json:"data"`
}
SessionOutputChunkResponse response containing one chunk of session output
type SessionOutputRead ¶ added in v0.2.0
type SessionOutputRead struct {
// ActualOffset the offset the returned data actually starts at. When the requested offset
// has already aged out of the ring buffer, the read is moved forward to the oldest byte
// still in the buffer, and this reports that position.
ActualOffset int64
// Read number of bytes actually read from the buffer (in terms of buffer bytes, before any
// ANSI stripping is applied to Data).
Read int
// Data the chunk read from the buffer, ANSI-stripped when requested.
Data []byte
}
SessionOutputRead the result of a single session output ring buffer read.
type UpdateSessionDescriptionRequest ¶
type UpdateSessionDescriptionRequest struct {
// Description new session description, set to null to clear
Description *string `json:"description" validate:"omitempty"`
}
UpdateSessionDescriptionRequest parameters to change a session description
type UpdateSessionDriverRequest ¶
type UpdateSessionDriverRequest struct {
// DriverType indicate which driver the session uses
DriverType models.SessionDriverTypeENUMType `json:"driver" validate:"required,session_driver_type"`
// DriverMetadata metadata relating to the session driver
DriverMetadata json.RawMessage `json:"driver_metadata,omitempty"`
}
UpdateSessionDriverRequest parameters to change a session driver
type UserCommandRequest ¶
type UserCommandRequest struct {
// Commands the list of commands to send to the session
Commands []models.SessionInputCommand `json:"commands" validate:"required,gte=1,dive"`
}
UserCommandRequest user command requests