Documentation
¶
Index ¶
- Constants
- func ConfigPath() string
- func DecodeConfigBytesInto(cfg *Config, data []byte) error
- func InitConfig(force bool) (string, error)
- func InitConfigForProject(project bool, force bool) (string, error)
- func IsPlaceholderAuthToken(token string) bool
- func ProjectConfigPath() string
- func Run(opts RunOptions, version string) error
- func SaveConfig(path string, cfg *Config) error
- func UsesPlaceholderAuthToken(cfg *Config) bool
- type ChannelConfig
- type Config
- type ConfigLayer
- type FeatureConfig
- type PlatformSupervisor
- func (s *PlatformSupervisor) Get(name string) messaging.Platform
- func (s *PlatformSupervisor) RemoveIf(name string, platform messaging.Platform) bool
- func (s *PlatformSupervisor) Replace(name string, platform messaging.Platform) messaging.Platform
- func (s *PlatformSupervisor) ReplaceIf(name string, expected, platform messaging.Platform) bool
- func (s *PlatformSupervisor) Snapshot() []messaging.Platform
- func (s *PlatformSupervisor) StopAll() error
- type RunOptions
- type ServeConfigState
- func (s *ServeConfigState) Reload() error
- func (s *ServeConfigState) Snapshot() *Config
- func (s *ServeConfigState) UpdateChannel(platform string, body []byte, apply func(*Config) error) (channelConfigPatchResponse, error)
- func (s *ServeConfigState) UpdateFull(body []byte, apply func(*Config) error) (*Config, error)
- type SessionLifecycleService
- func (s *SessionLifecycleService) Bind(ctx context.Context, sessionID, channelType, channelID string) error
- func (s *SessionLifecycleService) Delete(ctx context.Context, sessionID string) (bool, error)
- func (s *SessionLifecycleService) Rotate(ctx context.Context, platform, userID string, force bool) error
- func (s *SessionLifecycleService) SetEventPublisher(publish func(string, any))
- func (s *SessionLifecycleService) Transfer(ctx context.Context, channelType, channelID, fromSessionID, toSessionID string) error
- func (s *SessionLifecycleService) Unbind(ctx context.Context, sessionID string) (*session.Binding, error)
- type WebUIConfig
Constants ¶
const PlaceholderAuthToken = "sk-change-me-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
PlaceholderAuthToken is the API token written by `mothx serve init-config`. It is a well-known value, so leaving it in place is equivalent to publishing the API key: the server warns on startup until it is replaced.
const PlaceholderAuthTokenWarning = "WARNING: serve.json ships the placeholder API token (" + PlaceholderAuthToken + "),\n" +
" which is public. Replace api.auth.tokens before enabling auth or exposing this server."
PlaceholderAuthTokenWarning is printed wherever a template token is created or is still in use.
Variables ¶
This section is empty.
Functions ¶
func ConfigPath ¶
func ConfigPath() string
func DecodeConfigBytesInto ¶
func InitConfig ¶
func IsPlaceholderAuthToken ¶
IsPlaceholderAuthToken reports whether token is the generated template value.
func ProjectConfigPath ¶
func ProjectConfigPath() string
func Run ¶
func Run(opts RunOptions, version string) error
func SaveConfig ¶
func UsesPlaceholderAuthToken ¶
UsesPlaceholderAuthToken reports whether the resolved config enables auth and still ships the generated template token, which means the API is reachable with a publicly known key.
Types ¶
type ChannelConfig ¶
type ChannelConfig struct {
Artifact bool `json:"artifact,omitempty"`
Wechat channels.WechatConfig `json:"wechat"`
Feishu channels.FeishuConfig `json:"feishu"`
}
type Config ¶
type Config struct {
API openaiapi.Config `json:"api"`
Features FeatureConfig `json:"features"`
Channels ChannelConfig `json:"channels"`
WebUI WebUIConfig `json:"webUI"`
LobsterMode bool `json:"lobsterMode,omitempty"`
Cron channels.CronConfig `json:"cron"`
Memory channels.MemoryConfig `json:"memory"`
Security channels.SecurityConfig `json:"security"`
Hooks channels.HooksConfig `json:"hooks"`
Agent channels.AgentConfig `json:"agent"`
}
func DecodeConfigBytes ¶
func DefaultConfig ¶
func DefaultConfig() *Config
func LoadConfig ¶
func LoadConfigFrom ¶
func (*Config) MarshalJSON ¶
type ConfigLayer ¶
type ConfigLayer string
const ( ConfigLayerGlobal ConfigLayer = "global" ConfigLayerProject ConfigLayer = "project" ConfigLayerExplicit ConfigLayer = "explicit" )
type FeatureConfig ¶
type FeatureConfig struct {
WebUI bool `json:"webUI,omitempty"`
OpenAIAPI bool `json:"openaiAPI,omitempty"`
Wechat bool `json:"wechat,omitempty"`
Feishu bool `json:"feishu,omitempty"`
MultiAgent bool `json:"multiAgent,omitempty"`
Cron bool `json:"cron,omitempty"`
Memory bool `json:"memory,omitempty"`
}
type PlatformSupervisor ¶
type PlatformSupervisor struct {
// contains filtered or unexported fields
}
PlatformSupervisor is the sole owner of live messaging platform instances. Callers receive snapshots and never retain the internal map or slice.
func NewPlatformSupervisor ¶
func NewPlatformSupervisor() *PlatformSupervisor
func (*PlatformSupervisor) RemoveIf ¶
func (s *PlatformSupervisor) RemoveIf(name string, platform messaging.Platform) bool
RemoveIf removes platform only when it is still the registered instance. This prevents a late Start return from deleting a newer replacement.
func (*PlatformSupervisor) ReplaceIf ¶
func (s *PlatformSupervisor) ReplaceIf(name string, expected, platform messaging.Platform) bool
ReplaceIf swaps an instance only when expected is still the owner. It is used by asynchronous candidate startup so a late result cannot overwrite a newer configuration update.
func (*PlatformSupervisor) Snapshot ¶
func (s *PlatformSupervisor) Snapshot() []messaging.Platform
func (*PlatformSupervisor) StopAll ¶
func (s *PlatformSupervisor) StopAll() error
type RunOptions ¶
type RunOptions struct {
ConfigPath string
Port string
WebUIDir string
Provider string
Model string
WorkDir string
Unsafe bool
Sandbox bool
MultiAgent bool
Delegate bool
Workflows bool
WebSearch bool
Browser bool
Artifact bool
A2AMaster bool
Lobster bool
Verbose bool
Debug bool
// OnReady observes the fully constructed API server and channel dispatcher.
OnReady func(*openaiapi.Server, *channels.Dispatcher)
// Shutdown requests graceful termination of the nested API runtime.
Shutdown <-chan struct{}
}
type ServeConfigState ¶
type ServeConfigState struct {
Effective *Config
WritablePath string
WritableLayer ConfigLayer
// contains filtered or unexported fields
}
ServeConfigState separates the merged runtime configuration from the file layer edited by the WebUI. Runtime CLI overrides are never written back.
func (*ServeConfigState) Reload ¶
func (s *ServeConfigState) Reload() error
func (*ServeConfigState) Snapshot ¶
func (s *ServeConfigState) Snapshot() *Config
Snapshot returns an isolated runtime configuration snapshot. Callers may safely pass it to code that normalizes or annotates the configuration.
func (*ServeConfigState) UpdateChannel ¶
func (s *ServeConfigState) UpdateChannel(platform string, body []byte, apply func(*Config) error) (channelConfigPatchResponse, error)
UpdateChannel applies a channel merge-patch to the selected writable layer, applies the resulting effective runtime config, and restores the old file if runtime application fails. The callback must not perform network I/O.
func (*ServeConfigState) UpdateFull ¶
UpdateFull persists a complete serve configuration through the same serialize/apply/rollback boundary as channel updates. The body is decoded into a normalized writable-layer representation; CLI runtime overrides stay effective in memory but are stripped from the persisted copy.
type SessionLifecycleService ¶
type SessionLifecycleService struct {
// contains filtered or unexported fields
}
SessionLifecycleService is the single coordinator for session persistence, API pool state and dispatcher cache state. Database helpers remain in the session package; this service owns the cross-runtime lock and ordering.
func NewSessionLifecycleService ¶
func NewSessionLifecycleService(sessions interface{ DeleteActiveSession(string) (bool, error) }, dispatcher *channels.Dispatcher, sessionDir string, identityMux *session.IdentityLocks) *SessionLifecycleService
func (*SessionLifecycleService) Bind ¶
func (s *SessionLifecycleService) Bind(ctx context.Context, sessionID, channelType, channelID string) error
func (*SessionLifecycleService) Rotate ¶
func (s *SessionLifecycleService) Rotate(ctx context.Context, platform, userID string, force bool) error
Rotate creates a new bound session for a channel identity. It is used by the channel /new and /clear commands so those commands share the same runtime/identity lock ordering as HTTP binding mutations. A forced rotate requests cancellation of the active run and waits a bounded grace period; it never rotates without a durable mutation lease.
func (*SessionLifecycleService) SetEventPublisher ¶
func (s *SessionLifecycleService) SetEventPublisher(publish func(string, any))
type WebUIConfig ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package hooks implements shell hook scripts for serve channels.
|
Package hooks implements shell hook scripts for serve channels. |
|
Package webhook implements inbound webhook routing for serve channels.
|
Package webhook implements inbound webhook routing for serve channels. |