Documentation
¶
Index ¶
- Constants
- Variables
- func BootstrapConfig(ctx context.Context, args BootstrapArgs) (writtenPath string, err error)
- func DefaultConfigPath() (string, error)
- func IsCuratedNativeAIProviderModel(providerType string, modelName string) bool
- func ResolveStateRoot(override string) (string, error)
- func RuntimeControlSocketPathFromConfigPath(configPath string) string
- func RuntimeMaintenancePathFromConfigPath(configPath string) string
- func Save(path string, cfg *Config) error
- func WriteEnvironmentCatalogRecord(layout StateLayout, cfg *Config, localUIBind string, passwordConfigured bool) error
- type AIConfig
- func (c *AIConfig) EffectiveBlockDangerousCommands() bool
- func (c *AIConfig) EffectiveMode() string
- func (c *AIConfig) EffectiveRequireUserApproval() bool
- func (c *AIConfig) EffectiveTerminalExecDefaultTimeoutMS() int64
- func (c *AIConfig) EffectiveTerminalExecMaxTimeoutMS() int64
- func (c *AIConfig) EffectiveToolRecoveryAllowPathRewrite() bool
- func (c *AIConfig) EffectiveToolRecoveryAllowProbeTools() bool
- func (c *AIConfig) EffectiveToolRecoveryEnabled() bool
- func (c *AIConfig) EffectiveToolRecoveryFailOnRepeatedSignature() bool
- func (c *AIConfig) EffectiveToolRecoveryMaxSteps() int
- func (c *AIConfig) IsAllowedModelID(modelID string) bool
- func (c *AIConfig) Validate() error
- type AIExecutionPolicy
- type AIProvider
- type AIProviderModel
- type AIProviderWebSearch
- type AITerminalExecPolicy
- type BootstrapArgs
- type Config
- type FilesystemPermissionSet
- type FilesystemRootKind
- type FilesystemRootPolicy
- type FilesystemScope
- type LocalEnvironmentBinding
- type PermissionPolicy
- type PermissionSet
- type ProviderLinkBootstrapArgs
- type StateLayout
Constants ¶
const ( AIModeAct = "act" AIModePlan = "plan" )
const ( AIProviderWebSearchModeDisabled = "disabled" AIProviderWebSearchModeOpenAIBuiltin = "openai_builtin" AIProviderWebSearchModeBrave = "brave" )
const ( AIInputModalityText = "text" AIInputModalityImage = "image" )
const (
DefaultLocalEnvironmentID = "local"
)
const FilesystemScopeSchemaVersionV1 = 1
Variables ¶
Functions ¶
func BootstrapConfig ¶
func BootstrapConfig(ctx context.Context, args BootstrapArgs) (writtenPath string, err error)
func DefaultConfigPath ¶
func ResolveStateRoot ¶
func RuntimeControlSocketPathFromConfigPath ¶ added in v0.6.8
func RuntimeMaintenancePathFromConfigPath ¶ added in v0.6.11
func WriteEnvironmentCatalogRecord ¶
func WriteEnvironmentCatalogRecord(layout StateLayout, cfg *Config, localUIBind string, passwordConfigured bool) error
Types ¶
type AIConfig ¶
type AIConfig struct {
// Providers is the provider registry available to the runtime and UI.
//
// Notes:
// - Providers own their allowed model list (provider + model are always configured together).
Providers []AIProvider `json:"providers,omitempty"`
// CurrentModelID points to the model used by default for new chats.
//
// Format: <provider_id>/<model_name>
CurrentModelID string `json:"current_model_id"`
// Mode controls the AI runtime behavior.
//
// Supported values:
// - "act": full tool execution flow (default)
// - "plan": planning-first mode with strict readonly execution (mutating actions are blocked)
Mode string `json:"mode,omitempty"`
// ToolRecoveryEnabled controls runtime-level recovery orchestration.
//
// When enabled, the Go runtime can continue attempts after recoverable tool failures
// instead of ending the turn immediately.
ToolRecoveryEnabled *bool `json:"tool_recovery_enabled,omitempty"`
// ToolRecoveryMaxSteps limits how many recovery continuations can happen in one run.
//
// Defaults to 3.
ToolRecoveryMaxSteps *int `json:"tool_recovery_max_steps,omitempty"`
// ToolRecoveryAllowPathRewrite controls deterministic path normalization/rewrite strategies.
ToolRecoveryAllowPathRewrite *bool `json:"tool_recovery_allow_path_rewrite,omitempty"`
// ToolRecoveryAllowProbeTools is reserved for strategy diversification retries in runtime recovery.
ToolRecoveryAllowProbeTools *bool `json:"tool_recovery_allow_probe_tools,omitempty"`
// ToolRecoveryFailOnRepeatedSignature controls fail-fast behavior when the same failure signature
// repeats across recovery attempts.
ToolRecoveryFailOnRepeatedSignature *bool `json:"tool_recovery_fail_on_repeated_signature,omitempty"`
// ExecutionPolicy controls runtime execution guardrails.
//
// Defaults are intentionally permissive:
// - no user approval requirement
// - no dangerous-command hard block
ExecutionPolicy *AIExecutionPolicy `json:"execution_policy,omitempty"`
// TerminalExecPolicy controls the bounded execution policy for terminal.exec.
//
// The built-in defaults intentionally mimic Claude-style shell behavior:
// - default timeout: 2 minutes
// - maximum timeout cap: 10 minutes
TerminalExecPolicy *AITerminalExecPolicy `json:"terminal_exec_policy,omitempty"`
}
AIConfig configures the optional Flower (AI assistant) feature (Go Native runtime).
Notes:
- Secrets (api keys) must never be stored in this config. Keys are managed via a separate local secrets file.
- Field names are snake_case to match the rest of the runtime config surface.
func (*AIConfig) EffectiveBlockDangerousCommands ¶
func (*AIConfig) EffectiveMode ¶
func (*AIConfig) EffectiveRequireUserApproval ¶
func (*AIConfig) EffectiveTerminalExecDefaultTimeoutMS ¶
func (*AIConfig) EffectiveTerminalExecMaxTimeoutMS ¶
func (*AIConfig) EffectiveToolRecoveryAllowPathRewrite ¶
func (*AIConfig) EffectiveToolRecoveryAllowProbeTools ¶
func (*AIConfig) EffectiveToolRecoveryEnabled ¶
func (*AIConfig) EffectiveToolRecoveryFailOnRepeatedSignature ¶
func (*AIConfig) EffectiveToolRecoveryMaxSteps ¶
func (*AIConfig) IsAllowedModelID ¶
IsAllowedModelID reports whether the given model wire id (<provider_id>/<model_name>) exists in the config allow-list.
type AIExecutionPolicy ¶
type AIExecutionPolicy struct {
// RequireUserApproval controls whether mutating tool invocations require user approval.
RequireUserApproval bool `json:"require_user_approval"`
// BlockDangerousCommands controls whether dangerous terminal commands are hard-blocked.
BlockDangerousCommands bool `json:"block_dangerous_commands"`
}
type AIProvider ¶
type AIProvider struct {
// ID is a stable internal id (primary key). It must not change once used for secrets/model routing.
ID string `json:"id"`
// Name is a human-friendly display name (safe to rename at any time).
Name string `json:"name,omitempty"`
// Type is one of:
// - "openai"
// - "anthropic"
// - "moonshot"
// - "chatglm"
// - "deepseek"
// - "qwen"
// - "openai_compatible"
Type string `json:"type"`
// BaseURL overrides the provider endpoint (example: "https://api.openai.com/v1").
// When empty, provider defaults apply.
//
// Required provider types:
// - moonshot
// - chatglm
// - deepseek
// - qwen
// - openai_compatible
BaseURL string `json:"base_url,omitempty"`
// StrictToolSchema overrides provider tool schema strictness.
//
// When unset, runtime falls back to built-in policy:
// - openai official endpoints: strict
// - openai custom gateways: non-strict
// - openai_compatible: non-strict
// - moonshot/chatglm/deepseek/qwen: non-strict
StrictToolSchema *bool `json:"strict_tool_schema,omitempty"`
// WebSearch configures optional web search behavior for generic OpenAI-compatible providers.
//
// Native providers (OpenAI, Moonshot, ChatGLM/GLM, DeepSeek, and Qwen) derive their web-search
// behavior from the provider type and explicit model allow-list, so this field is ignored for them.
WebSearch *AIProviderWebSearch `json:"web_search,omitempty"`
// Models is the allowed model list for this provider (shown in the Chat UI).
Models []AIProviderModel `json:"models,omitempty"`
}
type AIProviderModel ¶
type AIProviderModel struct {
ModelName string `json:"model_name"`
ContextWindow int `json:"context_window,omitempty"`
MaxOutputTokens int `json:"max_output_tokens,omitempty"`
EffectiveContextWindowPercent int `json:"effective_context_window_percent,omitempty"`
InputModalities []string `json:"input_modalities,omitempty"`
}
func (AIProviderModel) EffectiveContextWindowPercentValue ¶
func (m AIProviderModel) EffectiveContextWindowPercentValue() int
func (AIProviderModel) EffectiveInputWindowTokens ¶
func (m AIProviderModel) EffectiveInputWindowTokens() int
func (AIProviderModel) NormalizedInputModalities ¶ added in v0.6.10
func (m AIProviderModel) NormalizedInputModalities() []string
func (AIProviderModel) SupportsImageInput ¶ added in v0.6.10
func (m AIProviderModel) SupportsImageInput() bool
type AIProviderWebSearch ¶
type AIProviderWebSearch struct {
// Mode is only honored for openai_compatible providers.
//
// Supported values:
// - "disabled": do not expose any web-search capability
// - "openai_builtin": attach OpenAI Responses-style hosted web search
// - "brave": expose Flower's external Brave-backed web.search tool
Mode string `json:"mode,omitempty"`
}
type AITerminalExecPolicy ¶
type AITerminalExecPolicy struct {
// DefaultTimeoutMS is the timeout applied when terminal.exec does not specify timeout_ms.
DefaultTimeoutMS *int `json:"default_timeout_ms,omitempty"`
// MaxTimeoutMS is the hard upper cap for any terminal.exec timeout_ms request.
MaxTimeoutMS *int `json:"max_timeout_ms,omitempty"`
}
type BootstrapArgs ¶
type BootstrapArgs struct {
ControlplaneBaseURL string
ControlplaneProviderID string
EnvironmentID string
BootstrapTicket string
RuntimeVersion string
StateRoot string
AgentHomeDir string
Shell string
LogFormat string
LogLevel string
// PermissionPolicyPreset is an optional preset used to write permission_policy into the config.
// If empty, bootstrap preserves the existing permission_policy when possible, otherwise uses defaults.
PermissionPolicyPreset string
}
type Config ¶
type Config struct {
ControlplaneBaseURL string `json:"controlplane_base_url"`
ControlplaneProviderID string `json:"controlplane_provider_id,omitempty"`
EnvironmentID string `json:"environment_id"`
LocalEnvironmentPublicID string `json:"local_environment_public_id"`
BindingGeneration int64 `json:"binding_generation,omitempty"`
AgentInstanceID string `json:"agent_instance_id"`
Direct *directv1.DirectConnectInfo `json:"direct"`
// AI config controls optional native AI assistant features.
AI *AIConfig `json:"ai,omitempty"`
// PermissionPolicy is the local permission cap applied on the endpoint.
// It is designed to limit the effective permissions even if the control-plane grants more.
PermissionPolicy *PermissionPolicy `json:"permission_policy,omitempty"`
// AgentHomeDir is the default home/working directory and the target of "~".
// If empty, the runtime picks a safe default (the current user home dir).
// Filesystem access boundaries are defined by FilesystemScope.
AgentHomeDir string `json:"agent_home_dir,omitempty"`
// FilesystemScope defines the endpoint-local filesystem roots exposed to
// runtime capabilities. When omitted, the runtime derives a Home root from
// AgentHomeDir and a read-only Computer root at the OS filesystem root.
FilesystemScope *FilesystemScope `json:"filesystem_scope,omitempty"`
// Shell is the shell command used for terminal sessions.
// If empty, the runtime picks a default (SHELL or /bin/bash).
Shell string `json:"shell,omitempty"`
// LogFormat is "json" or "text".
LogFormat string `json:"log_format,omitempty"`
// LogLevel is "debug|info|warn|error".
LogLevel string `json:"log_level,omitempty"`
// CodeServerPortMin/Max configures the dynamic port range used for code-server processes.
// If unset/invalid, the runtime uses a safe default range.
CodeServerPortMin int `json:"code_server_port_min,omitempty"`
CodeServerPortMax int `json:"code_server_port_max,omitempty"`
// contains filtered or unexported fields
}
Config is the on-disk configuration for the Redeven runtime.
NOTE: This file contains secrets (PSK). Always keep it chmod 0600.
func BootstrapProviderLink ¶ added in v0.6.8
func BootstrapProviderLink(ctx context.Context, args ProviderLinkBootstrapArgs) (*Config, error)
func ResolveProviderLinkConfig ¶ added in v0.6.8
func ResolveProviderLinkConfig(ctx context.Context, args ProviderLinkBootstrapArgs) (*Config, error)
func (Config) MarshalJSON ¶ added in v0.6.8
func (*Config) UnmarshalJSON ¶ added in v0.6.8
func (*Config) ValidateLocalMinimal ¶
ValidateLocalMinimal validates config fields required to start the runtime in local-only mode.
Local-only mode is enabled by `redeven run --mode local` and must work even when the controlplane credentials are missing (no bootstrap yet).
func (*Config) ValidateRemoteStrict ¶
ValidateRemoteStrict validates the fields required to connect to the remote control channel.
This is the standard mode requirements: the runtime must be fully bootstrapped.
type FilesystemPermissionSet ¶ added in v0.6.8
type FilesystemRootKind ¶ added in v0.6.8
type FilesystemRootKind string
const ( FilesystemRootHome FilesystemRootKind = "home" FilesystemRootComputer FilesystemRootKind = "computer" FilesystemRootCustom FilesystemRootKind = "custom" )
type FilesystemRootPolicy ¶ added in v0.6.8
type FilesystemRootPolicy struct {
ID string `json:"id"`
Label string `json:"label"`
Path string `json:"path"`
Kind FilesystemRootKind `json:"kind"`
Permissions FilesystemPermissionSet `json:"permissions"`
Hidden bool `json:"hidden,omitempty"`
System bool `json:"system,omitempty"`
}
type FilesystemScope ¶ added in v0.6.8
type FilesystemScope struct {
SchemaVersion int `json:"schema_version"`
DefaultRootID string `json:"default_root_id,omitempty"`
Roots []FilesystemRootPolicy `json:"roots"`
}
func (*FilesystemScope) Validate ¶ added in v0.6.8
func (s *FilesystemScope) Validate() error
type LocalEnvironmentBinding ¶
type LocalEnvironmentBinding struct {
LocalEnvironmentPublicID string `json:"local_environment_public_id"`
UserPublicID string `json:"user_public_id,omitempty"`
EnvPublicID string `json:"env_public_id"`
Generation int64 `json:"generation"`
Hostname string `json:"hostname,omitempty"`
OS string `json:"os,omitempty"`
Arch string `json:"arch,omitempty"`
RuntimeVersion string `json:"runtime_version,omitempty"`
LastSeenAtUnixMS int64 `json:"last_seen_at_unix_ms,omitempty"`
}
type PermissionPolicy ¶
type PermissionPolicy struct {
SchemaVersion int `json:"schema_version"`
// LocalMax is the global cap. It must be present for schema_version=1.
LocalMax *PermissionSet `json:"local_max"`
// ByUser and ByApp are optional additional caps. They can only further reduce LocalMax.
ByUser map[string]*PermissionSet `json:"by_user,omitempty"`
ByApp map[string]*PermissionSet `json:"by_app,omitempty"`
}
PermissionPolicy is the local permission cap configuration stored on the runtime endpoint.
It is used to clamp control-plane granted permissions ("session_meta") to a user-approved maximum.
func ParsePermissionPolicyPreset ¶
func ParsePermissionPolicyPreset(preset string) (*PermissionPolicy, error)
func (*PermissionPolicy) ResolveCap ¶
func (p *PermissionPolicy) ResolveCap(userPublicID string, floeApp string) PermissionSet
ResolveCap returns the local cap to apply for the given user/app pair.
The resolution model is: - start from LocalMax - intersect with by_user[user_public_id] if present - intersect with by_app[floe_app] if present
func (*PermissionPolicy) Validate ¶
func (p *PermissionPolicy) Validate() error
type PermissionSet ¶
type PermissionSet struct {
Read bool `json:"read"`
Write bool `json:"write"`
Execute bool `json:"execute"`
}
PermissionSet is the 3-bit permission model used by Redeven runtimes.
func ResolvePermissionCapFromConfigPath ¶
func ResolvePermissionCapFromConfigPath( configPath string, userPublicID string, floeApp string, fallback PermissionSet, ) PermissionSet
ResolvePermissionCapFromConfigPath loads configPath and resolves the effective local cap for the given user/app pair. When the config cannot be loaded, it falls back to fallback.
func (PermissionSet) Intersect ¶
func (p PermissionSet) Intersect(other PermissionSet) PermissionSet
type ProviderLinkBootstrapArgs ¶ added in v0.6.8
type ProviderLinkBootstrapArgs struct {
ConfigPath string
ControlplaneBaseURL string
ControlplaneProviderID string
EnvironmentID string
BootstrapTicket string
RuntimeVersion string
PermissionPolicyPreset string
AgentHomeDir string
Shell string
LogFormat string
LogLevel string
RuntimeHostname string
RuntimeGOOS string
RuntimeGOARCH string
PreservePermissionPolicy bool
}
type StateLayout ¶
type StateLayout struct {
StateRoot string
ConfigPath string
SecretsPath string
LockPath string
StateDir string
RuntimeControlSocketPath string
RuntimeMaintenancePath string
DiagnosticsDir string
AuditDir string
AppsDir string
GatewayDir string
}
func DefaultStateLayout ¶
func DefaultStateLayout() (StateLayout, error)
DefaultStateLayout returns the single Local Environment layout rooted under the resolved state root.
func LocalEnvironmentStateLayout ¶
func LocalEnvironmentStateLayout(stateRoot string) (StateLayout, error)