agent

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FloeAppRedevenAgent = "com.floegence.redeven.agent"
	FloeAppRedevenCode  = "com.floegence.redeven.code"
	// FloeAppRedevenPortForward proxies an arbitrary HTTP service reachable from the agent.
	FloeAppRedevenPortForward = "com.floegence.redeven.portforward"
)

Floe app ids.

View Source
const (
	ProviderLinkErrorActiveWork         = "PROVIDER_LINK_ACTIVE_WORK"
	ProviderLinkErrorBootstrapFailed    = "PROVIDER_LINK_BOOTSTRAP_FAILED"
	ProviderLinkErrorAlreadyLinked      = "PROVIDER_LINK_ALREADY_CONNECTED"
	ProviderLinkErrorDisconnectFailed   = "PROVIDER_LINK_DISCONNECT_FAILED"
	ProviderLinkErrorDisconnectRejected = "PROVIDER_LINK_DISCONNECT_REJECTED"
	ProviderLinkErrorBindingNotCurrent  = "PROVIDER_LINK_NOT_CURRENT"
)
View Source
const (
	// TypeID_SESSIONS_LIST_ACTIVE returns currently active Flowersec channel sessions on the agent (server side).
	//
	// NOTE: This is a UI/auditing endpoint and MUST NOT be used as an authorization source of truth.
	//
	// The type_id must match Env App: internal/envapp/ui_src/src/ui/protocol/redeven_v1/typeIds.ts.
	TypeID_SESSIONS_LIST_ACTIVE uint32 = 5001
)

Variables

This section is empty.

Functions

func LocalEnvPublicIDForAgent added in v0.6.8

func LocalEnvPublicIDForAgent() string

LocalEnvPublicIDForAgent avoids an import cycle with internal/localui.

Types

type Agent

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

func New

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

func (*Agent) BinaryPath added in v0.6.8

func (a *Agent) BinaryPath() string

func (*Agent) CodeAppServer added in v0.7.1

func (a *Agent) CodeAppServer() *appserver.Server

func (*Agent) Commit added in v0.6.8

func (a *Agent) Commit() string

func (*Agent) ConfigureControlPlane added in v0.6.8

func (a *Agent) ConfigureControlPlane(ctx context.Context, setup ControlPlaneSetup) (ControlPlaneRuntimeStatus, error)

func (*Agent) ConnectControlPlane added in v0.6.8

func (a *Agent) ConnectControlPlane(ctx context.Context) error

func (*Agent) ConnectProvider added in v0.6.8

func (a *Agent) ConnectProvider(ctx context.Context, req ProviderLinkRequest) (*ProviderLinkResponse, error)

func (*Agent) ControlPlaneRuntimeStatus added in v0.6.8

func (a *Agent) ControlPlaneRuntimeStatus() ControlPlaneRuntimeStatus

func (*Agent) CurrentMaintenanceSnapshot

func (a *Agent) CurrentMaintenanceSnapshot() *syssvc.MaintenanceSnapshot

func (*Agent) CurrentRuntimeServiceSnapshot

func (a *Agent) CurrentRuntimeServiceSnapshot() runtimeservice.Snapshot

func (*Agent) DiagnosticsEnabled

func (a *Agent) DiagnosticsEnabled() bool

func (*Agent) DiagnosticsStore

func (a *Agent) DiagnosticsStore() *diagnostics.Store

func (*Agent) DisconnectControlPlane added in v0.6.8

func (a *Agent) DisconnectControlPlane(ctx context.Context) error

func (*Agent) DisconnectDesktopModelSource added in v0.6.8

func (a *Agent) DisconnectDesktopModelSource() *ai.AIRuntimeStatus

func (*Agent) DisconnectProvider added in v0.6.8

func (a *Agent) DisconnectProvider(ctx context.Context) (*ProviderLinkResponse, error)

func (*Agent) InstanceID added in v0.6.8

func (a *Agent) InstanceID() string

func (*Agent) PrepareDesktopModelSource added in v0.6.8

func (a *Agent) PrepareDesktopModelSource(session ai.DesktopModelSourceSession) (*ai.AIRuntimeStatus, error)

func (*Agent) ProcessStartedAtUnixMS added in v0.6.8

func (a *Agent) ProcessStartedAtUnixMS() int64

func (*Agent) ProviderLinkBinding added in v0.6.8

func (a *Agent) ProviderLinkBinding() runtimeservice.ProviderLinkBinding

func (*Agent) Run

func (a *Agent) Run(ctx context.Context) error

func (*Agent) RuntimePresentationSessions added in v0.6.8

func (a *Agent) RuntimePresentationSessions() []RuntimePresentationSession

func (*Agent) RuntimeServiceSnapshot

func (a *Agent) RuntimeServiceSnapshot() runtimeservice.Snapshot

func (*Agent) ServeDesktopModelSourceRPC added in v0.6.8

func (a *Agent) ServeDesktopModelSourceRPC(ctx context.Context, session ai.DesktopModelSourceSession, conn *websocket.Conn, onChange func()) error

func (*Agent) ServeLocalDirectSession

func (a *Agent) ServeLocalDirectSession(ctx context.Context, sess endpoint.Session, meta *session.Meta, opts LocalDirectSessionOptions) (err error)

func (*Agent) SetLocalUIBind added in v0.6.8

func (a *Agent) SetLocalUIBind(bind string)

func (*Agent) StartBackgroundServices

func (a *Agent) StartBackgroundServices(ctx context.Context)

func (*Agent) Version added in v0.6.8

func (a *Agent) Version() string

type ControlPlaneRuntimeStatus added in v0.6.8

type ControlPlaneRuntimeStatus struct {
	Enabled        bool
	Connected      bool
	Connectable    bool
	Label          string
	DisabledReason string
}

type ControlPlaneSetup added in v0.6.8

type ControlPlaneSetup struct {
	ProviderOrigin    string
	AccessPointOrigin string
	EnvironmentID     string
	BootstrapTicket   string
}

type LocalDirectSessionOptions

type LocalDirectSessionOptions struct {
	AccessUnlocked            bool
	TraceID                   string
	ConnectArtifactIssuedAtMs int64
}

ServeLocalDirectSession serves an already-established direct (no tunnel) endpoint session.

The session metadata MUST be treated as authoritative and is used to enforce permission caps.

type Options

type Options struct {
	Config *config.Config
	// ConfigPath is the path used to load the config file (used to derive state_dir).
	ConfigPath string
	StateRoot  string
	// InstanceID is a per-process runtime identity used by desktop lifecycle diagnostics.
	InstanceID string
	// LocalUIBind is the requested Local UI bind address before dynamic port resolution.
	LocalUIBind string
	// LocalUIEnabled indicates Local UI is enabled (e.g. `redeven run --mode hybrid|local`).
	//
	// When enabled, the agent is allowed to start even without a full bootstrap config.
	LocalUIEnabled bool
	// ControlChannelEnabled indicates whether the agent should connect to the control-plane control channel.
	//
	// In Local mode, this should be false even when the config is fully bootstrapped.
	ControlChannelEnabled bool
	// DesktopManaged disables CLI self-upgrade behaviors that do not apply when the
	// agent lifecycle is owned by a desktop shell package.
	DesktopManaged bool
	// EffectiveRunMode reports the current runtime mode exposed to the UI/control plane.
	EffectiveRunMode string
	// RemoteEnabled reports whether the current process has the remote control channel enabled.
	RemoteEnabled bool
	// LogOutput overrides the default runtime log sink.
	//
	// IMPORTANT: callers that reserve stdout for a machine protocol must pass
	// a non-stdout sink so agent services cannot corrupt the protocol stream.
	LogOutput io.Writer

	Version   string
	Commit    string
	BuildTime string

	// OnControlConnected is called once after the agent successfully connects to the
	// remote control channel and completes the initial register call.
	//
	// This hook is intended for CLI UX (e.g., printing the environment access URL)
	// and must not be used for authorization decisions.
	OnControlConnected func()
	// OnControlConnecting is called before a control-channel connection attempt.
	OnControlConnecting func()
	// OnControlRetry is called after a failed control-channel attempt with the retry delay.
	OnControlRetry func(error, time.Duration)
	// OnControlDisabled is called when the runtime starts without a control channel.
	OnControlDisabled func()

	AccessGate *accessgate.Gate
}

type ProviderLinkError added in v0.6.8

type ProviderLinkError struct {
	Code    string
	Message string
	Err     error
}

func (*ProviderLinkError) Error added in v0.6.8

func (e *ProviderLinkError) Error() string

func (*ProviderLinkError) Unwrap added in v0.6.8

func (e *ProviderLinkError) Unwrap() error

type ProviderLinkRequest added in v0.6.8

type ProviderLinkRequest struct {
	ProviderOrigin            string
	ProviderID                string
	EnvPublicID               string
	AccessPointOrigin         string
	BootstrapTicket           string
	ExpectedProviderOrigin    string
	ExpectedProviderID        string
	ExpectedEnvPublicID       string
	ExpectedAccessPointOrigin string
	ExpectedGeneration        int64
	AllowRelinkWhenIdle       bool
	// contains filtered or unexported fields
}

type ProviderLinkResponse added in v0.6.8

type ProviderLinkResponse struct {
	Binding runtimeservice.ProviderLinkBinding
}

type RuntimePresentationSession added in v0.6.8

type RuntimePresentationSession struct {
	ChannelID string

	UserPublicID string
	UserEmail    string

	FloeApp     string
	CodeSpaceID string
	SessionKind string
	TunnelURL   string

	CreatedAtUnixMs   int64
	ConnectedAtUnixMs int64

	CanRead    bool
	CanWrite   bool
	CanExecute bool
}

Jump to

Keyboard shortcuts

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