gateway

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithLocalUICodeSpaceRoute

func WithLocalUICodeSpaceRoute(r *http.Request, codeSpaceID string) *http.Request

func WithLocalUIEnvRoute

func WithLocalUIEnvRoute(r *http.Request) *http.Request

func WithLocalUIPortForwardRoute added in v0.6.3

func WithLocalUIPortForwardRoute(r *http.Request, forwardID string) *http.Request

Types

type Backend

type Backend interface {
	ListSpaces(ctx context.Context) ([]SpaceStatus, error)
	CreateSpace(ctx context.Context, req CreateSpaceRequest) (*SpaceStatus, error)
	UpdateSpace(ctx context.Context, codeSpaceID string, req UpdateSpaceRequest) (*SpaceStatus, error)
	DeleteSpace(ctx context.Context, codeSpaceID string) error
	StartSpace(ctx context.Context, codeSpaceID string) (*SpaceStatus, error)
	StopSpace(ctx context.Context, codeSpaceID string) error
	ResolveCodeServerPort(ctx context.Context, codeSpaceID string) (int, error)
	CodeRuntimeStatus(ctx context.Context) (CodeRuntimeStatus, error)
	CreateCodeRuntimeImportSession(ctx context.Context, manifest CodeRuntimeArtifactManifest) (CodeRuntimeImportSession, error)
	AppendCodeRuntimeImportChunk(ctx context.Context, uploadID string, chunkIndex int64, body io.Reader) (CodeRuntimeImportChunkResult, error)
	CompleteCodeRuntimeImportSession(ctx context.Context, uploadID string) (CodeRuntimeStatus, error)
	SelectCodeRuntimeVersion(ctx context.Context, version string) (CodeRuntimeStatus, error)
	RemoveCodeRuntimeVersion(ctx context.Context, version string) (CodeRuntimeStatus, error)
	CancelCodeRuntimeOperation(ctx context.Context) (CodeRuntimeStatus, error)
}

type CodeRuntimeArtifactManifest added in v0.6.10

type CodeRuntimeArtifactManifest = codeserver.WorkspaceEngineArtifactManifest

type CodeRuntimeImportChunkResult added in v0.6.10

type CodeRuntimeImportChunkResult = codeserver.WorkspaceEngineImportChunkResult

type CodeRuntimeImportSession added in v0.6.10

type CodeRuntimeImportSession = codeserver.WorkspaceEngineImportSession

type CodeRuntimeImportSessionRequest added in v0.6.10

type CodeRuntimeImportSessionRequest struct {
	Manifest CodeRuntimeArtifactManifest `json:"manifest"`
}

type CodeRuntimeStatus

type CodeRuntimeStatus = codeserver.RuntimeStatus

type CodeRuntimeVersionRequest

type CodeRuntimeVersionRequest struct {
	Version string `json:"version"`
}

type CodexBackend

type CodexBackend interface {
	Status(ctx context.Context) codexbridge.Status
	ReadCapabilities(ctx context.Context, cwd string) (*codexbridge.Capabilities, error)
	ListThreads(ctx context.Context, req codexbridge.ListThreadsRequest) ([]codexbridge.Thread, error)
	ReadThread(ctx context.Context, threadID string) (*codexbridge.ThreadDetail, error)
	StartThread(ctx context.Context, req codexbridge.StartThreadRequest) (*codexbridge.ThreadDetail, error)
	StartTurn(ctx context.Context, req codexbridge.StartTurnRequest) (*codexbridge.Turn, error)
	SteerTurn(ctx context.Context, req codexbridge.SteerTurnRequest) (*codexbridge.Turn, error)
	ArchiveThread(ctx context.Context, threadID string) error
	UnarchiveThread(ctx context.Context, threadID string) error
	ForkThread(ctx context.Context, req codexbridge.ForkThreadRequest) (*codexbridge.ThreadDetail, error)
	InterruptTurn(ctx context.Context, req codexbridge.InterruptTurnRequest) error
	StartReview(ctx context.Context, req codexbridge.StartReviewRequest) (*codexbridge.ThreadDetail, error)
	SubscribeThreadEvents(ctx context.Context, threadID string, afterSeq int64) ([]codexbridge.Event, <-chan codexbridge.Event, error)
	RespondToRequest(ctx context.Context, threadID string, requestID string, resp codexbridge.PendingRequestResponse) error
}

type CreateSpaceRequest

type CreateSpaceRequest struct {
	Path        string `json:"path"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type Gateway

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

func New

func New(opts Options) (*Gateway, error)

func (*Gateway) AppendCodeRuntimeImportChunk added in v0.6.10

func (g *Gateway) AppendCodeRuntimeImportChunk(ctx context.Context, uploadID string, chunkIndex int64, body io.Reader) (CodeRuntimeImportChunkResult, error)

func (*Gateway) Close

func (g *Gateway) Close() error

func (*Gateway) CodeRuntimeStatus added in v0.6.10

func (g *Gateway) CodeRuntimeStatus(ctx context.Context) (CodeRuntimeStatus, error)

func (*Gateway) CompleteCodeRuntimeImportSession added in v0.6.10

func (g *Gateway) CompleteCodeRuntimeImportSession(ctx context.Context, uploadID string) (CodeRuntimeStatus, error)

func (*Gateway) CreateCodeRuntimeImportSession added in v0.6.10

func (g *Gateway) CreateCodeRuntimeImportSession(ctx context.Context, manifest CodeRuntimeArtifactManifest) (CodeRuntimeImportSession, error)

func (*Gateway) EnvAppShellReadinessError

func (g *Gateway) EnvAppShellReadinessError() error

EnvAppShellReadinessError validates that the embedded Env App shell can be opened by Desktop before the runtime advertises open-readiness.

func (*Gateway) EnvAppShellReady

func (g *Gateway) EnvAppShellReady() bool

EnvAppShellReady reports whether the embedded Env App shell is complete.

func (*Gateway) ServeHTTP

func (g *Gateway) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Gateway) Start

func (g *Gateway) Start(ctx context.Context) error

func (*Gateway) URL

func (g *Gateway) URL() string

type Options

type Options struct {
	Logger                  *slog.Logger
	ListenAddr              string
	DistFS                  fs.FS
	Backend                 Backend
	PortForward             PortForwardBackend
	AI                      *ai.Service
	Notes                   *notes.Service
	WorkbenchLayout         *workbenchlayout.Service
	Terminal                *terminal.Manager
	Codex                   CodexBackend
	Audit                   *auditlog.Store
	Diagnostics             *diagnostics.Store
	ResolveSessionMeta      func(channelID string) (*session.Meta, bool)
	ResolveSessionTunnelURL func(channelID string) (string, bool)
	// ConfigPath is the absolute path to the runtime config file.
	// It is used to read and persist settings updates initiated from the Env App UI.
	ConfigPath string
	// SecretsStore holds user-managed secrets (such as AI provider API keys).
	// If nil, the gateway will derive a default secrets path from ConfigPath.
	SecretsStore *settings.SecretsStore
	// ThreadReadStateStore persists per-user per-surface thread read watermarks.
	ThreadReadStateStore *threadreadstate.Store
	// AgentHomeDir is the canonical absolute path to the default home directory.
	AgentHomeDir    string
	FilesystemScope *filesystemscope.Registry
}

type PortForwardBackend

type PortForwardBackend interface {
	ListForwards(ctx context.Context) ([]pfregistry.Forward, error)
	GetForward(ctx context.Context, forwardID string) (*pfregistry.Forward, error)
	CreateForward(ctx context.Context, req portforward.CreateForwardRequest) (*pfregistry.Forward, error)
	UpdateForward(ctx context.Context, forwardID string, req portforward.UpdateForwardRequest) (*pfregistry.Forward, error)
	DeleteForward(ctx context.Context, forwardID string) error
	TouchLastOpened(ctx context.Context, forwardID string) (*pfregistry.Forward, error)
}

type SpaceStatus

type SpaceStatus struct {
	CodeSpaceID        string `json:"code_space_id"`
	Name               string `json:"name"`
	Description        string `json:"description"`
	WorkspacePath      string `json:"workspace_path"`
	CodePort           int    `json:"code_port"`
	CreatedAtUnixMs    int64  `json:"created_at_unix_ms"`
	UpdatedAtUnixMs    int64  `json:"updated_at_unix_ms"`
	LastOpenedAtUnixMs int64  `json:"last_opened_at_unix_ms"`

	Running bool `json:"running"`
	PID     int  `json:"pid"`
}

type UpdateSpaceRequest

type UpdateSpaceRequest struct {
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
}

Jump to

Keyboard shortcuts

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