Documentation
¶
Index ¶
- Constants
- Variables
- func BuildStackVariableData(space *model.Space, variables map[string]interface{}) map[string]interface{}
- func CanUserAccessCommand(user *model.User, command *model.Command) bool
- func CanUserAccessSkill(user *model.User, skill *model.Skill) bool
- func CanUserExecuteScript(user *model.User, script *model.Script) bool
- func CheckSpaceLifecycleEvents(oldSpace, newSpace *model.Space)
- func ClosePluginManager() error
- func ExecuteEventScript(script *model.Script, eventParams map[string]object.Object, user *model.User, ...) (string, error)
- func ExecuteScriptWithMCP(script *model.Script, mcpParams map[string]object.Object, user *model.User) (string, error)
- func ExitOnSystemExit(result object.Object)
- func ForwardToNode(w http.ResponseWriter, r *http.Request, nodeId string) error
- func HandleScriptResult(result object.Object, err error, capturedOutput string) (int, string, error)
- func MaskWebhookSecret(secret string) string
- func NewEventScriptlingEnv(client *apiclient.ApiClient, eventParams map[string]object.Object, ...) (*scriptling.Scriptling, func(), error)
- func NewHealthCheckScriptlingEnv() (*scriptling.Scriptling, func(), error)
- func NewMCPScriptlingEnv(client *apiclient.ApiClient, mcpParams map[string]object.Object, ...) (*scriptling.Scriptling, *knotscriptling.MCPLibrary, func(), error)
- func NewRemoteScriptlingEnv(argv []string, client *apiclient.ApiClient, userId string, ...) (*scriptling.Scriptling, func(), error)
- func NewRemoteStreamingScriptlingEnv(argv []string, client *apiclient.ApiClient, userId string, ...) (*scriptling.Scriptling, func(), error)
- func NewRunScriptEvalEnv(argv []string, client *apiclient.ApiClient, userId string, ...) (*scriptling.Scriptling, func(), error)
- func PoolNameForSpace(space *model.Space) string
- func RaiseCustomEvent(eventId, eventType, spaceId, userId string, payload map[string]interface{})
- func RaiseSystemEvent(eventType, spaceId, userId string, payload map[string]interface{})
- func RegisterKnotServeLibraries(env *scriptling.Scriptling, client *apiclient.ApiClient, userId string)
- func ResolveCommandByName(name string, userId string) (*model.Command, error)
- func ResolveScriptByName(name string, userId string) (*model.Script, error)
- func ResolveSkillByName(name string, userId string) (*model.Skill, error)
- func SelectNodeForSpace(template *model.Template, selectedNodeId string) (string, error)
- func SetAgentHealthConfigUpdater(updater AgentHealthConfigUpdater)
- func SetContainerService(service Container)
- func SetJSONRPCCaller(fn JSONRPCCaller)
- func SetPoolSessionProvider(provider func(spaceID string) *PoolSessionState)
- func SetSpaceHealth(spaceId string, healthy bool, failures uint32)
- func SetTransport(t Transport)
- func SetUserService(service UserService)
- func ShouldForwardToNode(nodeId string) (bool, string)
- func StartConversationRetentionSweep()
- type AgentHealthConfigUpdater
- type CommandListOptions
- type CommandService
- type Container
- type EventActor
- type EventDispatcher
- func (d *EventDispatcher) Dispatch(envelope *EventEnvelope)
- func (d *EventDispatcher) GetEntriesForGossip() []*InFlightEntry
- func (d *EventDispatcher) MarkEventDone(eventId string)
- func (d *EventDispatcher) MergeInFlight(entries []*InFlightEntry)
- func (d *EventDispatcher) RegisterSubscriptions(spaceId, userId string, methods []methods.MethodDefinition)
- func (d *EventDispatcher) ReloadSinks()
- func (d *EventDispatcher) ReplayPending()
- func (d *EventDispatcher) UnregisterSubscriptions(spaceId string)
- type EventEnvelope
- type Icon
- type IconList
- type IconService
- type InFlightEntry
- type JSONRPCCaller
- type JSONRPCSubscription
- type PoolService
- func (s *PoolService) Create(pool *model.PoolDefinition, user *model.User) error
- func (s *PoolService) Delete(pool *model.PoolDefinition, user *model.User) error
- func (s *PoolService) Info(pool *model.PoolDefinition, user *model.User) (apiclient.PoolInfo, error)
- func (s *PoolService) IsDrained(spaceID string) bool
- func (s *PoolService) List(user *model.User) ([]apiclient.PoolInfo, error)
- func (s *PoolService) MarkDrained(spaceID string)
- func (s *PoolService) MarkUndrained(spaceID string)
- func (s *PoolService) PickMemberForRouting(poolName, userId string) *model.Space
- func (s *PoolService) ReapOrphans() error
- func (s *PoolService) Resolve(idOrName string) (*model.PoolDefinition, error)
- func (s *PoolService) ResolveForUser(idOrName string, user *model.User) (*model.PoolDefinition, error)
- func (s *PoolService) SetSize(pool *model.PoolDefinition, desiredCount int, user *model.User) error
- func (s *PoolService) Start(pool *model.PoolDefinition, user *model.User) error
- func (s *PoolService) StartReaper()
- func (s *PoolService) StartSweep()
- func (s *PoolService) Stop(pool *model.PoolDefinition, user *model.User) error
- func (s *PoolService) SweepOnce() error
- func (s *PoolService) UpdateStartupScript(pool *model.PoolDefinition, scriptId string, user *model.User) error
- type PoolSessionState
- type ScriptListOptions
- type ScriptService
- type SkillListOptions
- type SkillService
- type SpaceListOptions
- type SpaceService
- func (s *SpaceService) CheckUserQuotas(user *model.User, template *model.Template) error
- func (s *SpaceService) CreateSpace(space *model.Space, user *model.User) error
- func (s *SpaceService) DeleteSpace(spaceId string, user *model.User) error
- func (s *SpaceService) GetSpace(spaceId string, user *model.User) (*model.Space, error)
- func (s *SpaceService) GetSpaceCustomField(spaceId string, fieldName string, user *model.User) (string, error)
- func (s *SpaceService) ListSpaces(opts SpaceListOptions) ([]*model.Space, error)
- func (s *SpaceService) RemoveDependencyReferences(spaceId string, ownerUserId string) error
- func (s *SpaceService) SetSpaceCustomField(spaceId string, fieldName string, fieldValue string, user *model.User) error
- func (s *SpaceService) UpdateSpace(space *model.Space, user *model.User) error
- func (s *SpaceService) ValidateDependencies(space *model.Space) error
- func (s *SpaceService) ValidateDependenciesRunning(space *model.Space) error
- type TemplateListOptions
- type TemplateService
- func (s *TemplateService) CreateTemplate(template *model.Template, user *model.User) error
- func (s *TemplateService) DeleteTemplate(templateId string, user *model.User) error
- func (s *TemplateService) GetTemplate(templateId string) (*model.Template, error)
- func (s *TemplateService) GetTemplateUsage(templateId string) (total int, deployed int, err error)
- func (s *TemplateService) ListTemplates(opts TemplateListOptions) ([]*model.Template, error)
- func (s *TemplateService) UpdateTemplate(template *model.Template, user *model.User) error
- type Transport
- type UserService
Constants ¶
const ( SinkQueueSize = 100 WebhookTimeout = 10 * time.Second RetryAttempts = 3 TombstoneRetention = 5 * time.Minute )
const ( PoolSweepInterval = 15 * time.Second PoolReapInterval = 1 * time.Hour )
const MaxPendingAge = 10 * time.Minute
Variables ¶
var ( RetryDelay1 = 5 * time.Second RetryDelay2 = 15 * time.Second )
Retry back-off between delivery attempts. Vars (not consts) so tests can shrink them; production values are unchanged.
Functions ¶
func BuildStackVariableData ¶ added in v0.30.1
func BuildStackVariableData(space *model.Space, variables map[string]interface{}) map[string]interface{}
BuildStackVariableData builds the .stack.* template variable map for a space, exposing its sibling spaces within the same stack. Siblings are keyed by their stack-definition key (the space name with the stack prefix stripped), so a template can reference e.g. ${{ .stack.db.space.id }} or ${{ .stack.db.custom.password }}.
Each sibling exposes the full variable set (space, template, user, custom, and the shared server/nomad/var groups). Returns nil when the space is not part of a stack or no siblings can be loaded, leaving .stack absent from the render data (references then resolve to empty, like any missing variable).
This is injected into the model package via model.SetStackResolver at server startup to avoid the model <-> database import cycle.
func CanUserAccessCommand ¶ added in v0.29.0
func CanUserAccessSkill ¶ added in v0.23.0
func CanUserExecuteScript ¶ added in v0.23.0
CanUserExecuteScript checks if a user has permission to execute a script
func CheckSpaceLifecycleEvents ¶ added in v0.28.0
CheckSpaceLifecycleEvents compares the before/after state of a space and raises the appropriate system lifecycle events for any transition detected. Pass a nil oldSpace with a non-nil newSpace to signal creation.
func ClosePluginManager ¶ added in v0.28.0
func ClosePluginManager() error
ClosePluginManager shuts down the shared plugin manager and releases its pooled HTTP transports. It should be called once during server shutdown.
func ExecuteEventScript ¶ added in v0.28.0
func ExecuteScriptWithMCP ¶ added in v0.23.0
func ExitOnSystemExit ¶ added in v0.23.0
ExitOnSystemExit checks for SystemExit and exits the process if found
func ForwardToNode ¶ added in v0.23.0
ForwardToNode forwards an HTTP request to another node in the cluster
func HandleScriptResult ¶ added in v0.23.0
func HandleScriptResult(result object.Object, err error, capturedOutput string) (int, string, error)
HandleScriptResult processes scriptling evaluation results with consistent exception handling. Returns (exitCode, output, error) where: - exitCode: 0 for success, non-zero for SystemExit - output: captured output or result inspection - error: non-nil for errors (excluding successful SystemExit with code 0)
func MaskWebhookSecret ¶ added in v0.28.0
func NewEventScriptlingEnv ¶ added in v0.28.0
func NewEventScriptlingEnv(client *apiclient.ApiClient, eventParams map[string]object.Object, user *model.User, envelope *EventEnvelope) (*scriptling.Scriptling, func(), error)
func NewHealthCheckScriptlingEnv ¶ added in v0.24.0
func NewHealthCheckScriptlingEnv() (*scriptling.Scriptling, func(), error)
NewHealthCheckScriptlingEnv creates a minimal scriptling environment for health check scripts. Registers the knot.healthcheck built-in library only — no system access, no API client. Returns the environment and a cleanup function that must be called (e.g. via defer) once the script has finished executing to release the per-execution plugin scope. The plugin scope is HTTP-only: health checks may probe remote HTTP(S) plugin endpoints but cannot spawn local executables.
func NewMCPScriptlingEnv ¶ added in v0.23.0
func NewMCPScriptlingEnv(client *apiclient.ApiClient, mcpParams map[string]object.Object, user *model.User) (*scriptling.Scriptling, *knotscriptling.MCPLibrary, func(), error)
NewMCPScriptlingEnv creates a scriptling environment for MCP tool execution Libraries: stdlib, requests, secrets, htmlparser, knot.space, knot.ai, knot.mcp, knot.user, knot.group, knot.role, knot.template, knot.vars, knot.volume, knot.permission On-demand loading: Enabled - fetches from server only Output: Captured and returned The AI client connects to the server's OpenAI-compatible endpoint via createServerAIClient. The MCPServerContext middleware handles per-user tool discovery and execution when requests flow through the endpoint. Returns the environment, the MCP library instance for result retrieval, and a cleanup function that must be called (e.g. via defer) once the script has finished executing to release the per-execution plugin scope. The plugin scope is HTTP-only: scripts may load remote HTTP(S) plugin endpoints via scriptling.plugin.load() but cannot spawn local executables, and plugins loaded by one execution are isolated from every other.
func NewRemoteScriptlingEnv ¶ added in v0.23.0
func NewRemoteScriptlingEnv(argv []string, client *apiclient.ApiClient, userId string, customLogger logger.Logger, isSystemCall bool) (*scriptling.Scriptling, func(), error)
NewRemoteScriptlingEnv creates a scriptling environment for remote execution in spaces Libraries: stdlib, requests, secrets, subprocess, htmlparser, threads, os, pathlib, sys, scriptling.grep, scriptling.sed, knot.space, knot.ai, knot.mcp On-demand loading: Enabled - fetches from server only customLogger is optional - pass nil to use the default logger Output: Captured and returned for user scripts, discarded for system scripts (startup/shutdown) Returns the environment and a cleanup function that must be called (e.g. via defer) once the script has finished executing to release the per-execution plugin scope. The plugin scope allows both HTTP(S) and stdio executable plugins (space-side scripts already have subprocess access) but plugins loaded by one execution are isolated from every other.
func NewRemoteStreamingScriptlingEnv ¶ added in v0.23.0
func NewRemoteStreamingScriptlingEnv(argv []string, client *apiclient.ApiClient, userId string, customLogger logger.Logger, output io.Writer, input io.Reader) (*scriptling.Scriptling, func(), error)
NewRemoteStreamingScriptlingEnv creates a scriptling environment for streaming remote execution Libraries: stdlib, requests, secrets, subprocess, htmlparser, threads, os, pathlib, sys, scriptling.grep, scriptling.sed, knot.space, knot.ai, knot.mcp Note: scriptling.console and scriptling.ai.agent.interact are registered after env creation in execute_script_stream.go On-demand loading: Enabled - fetches from server only customLogger is optional - pass nil to use the default logger Output: Connected to provided writer, input from provided reader Returns the environment and a cleanup function that must be called (e.g. via defer) once the script has finished executing to release the per-execution plugin scope.
func NewRunScriptEvalEnv ¶ added in v0.28.0
func NewRunScriptEvalEnv(argv []string, client *apiclient.ApiClient, userId string, customLogger logger.Logger, output io.Writer, input io.Reader) (*scriptling.Scriptling, func(), error)
NewRunScriptEvalEnv builds the environment for `knot run-script` when it evaluates a script (not serving). It registers the full scriptling CLI library set MINUS the container library (no docker/podman runtime inside a space), then layers knot's own libraries on top — so plain run-script has the same library surface as the scriptling CLI and as run-script's server modes.
func PoolNameForSpace ¶ added in v0.28.0
PoolNameForSpace returns the pool name if the space is a pool member, or "".
func RaiseCustomEvent ¶ added in v0.28.0
func RaiseSystemEvent ¶ added in v0.28.0
func RegisterKnotServeLibraries ¶ added in v0.28.0
func RegisterKnotServeLibraries(env *scriptling.Scriptling, client *apiclient.ApiClient, userId string)
RegisterKnotServeLibraries adds knot's libraries to an environment created by the scriptling server runtime (used as the ServerConfig.ExtraLibs hook for `knot run-script` server modes). It registers the Go-backed knot libraries (knot.apiclient transport, knot.ai, knot.mcptools, knot.healthcheck) and chains knot's Python-library loader in front of the server's existing loader so `import knot.space` etc. resolve without losing the server's handler-module loader. knot.methods is intentionally not registered — in server mode the script is the method server itself (via scriptling.runtime.jsonrpc).
func ResolveCommandByName ¶ added in v0.29.0
func ResolveScriptByName ¶ added in v0.23.0
ResolveScriptByName resolves a script by name with user override support First checks user scripts, then falls back to global scripts Returns nil if script not found, deleted, inactive, or not valid for current zone Supports zone-specific overrides - returns the best match for the current zone
func ResolveSkillByName ¶ added in v0.23.0
func SelectNodeForSpace ¶ added in v0.22.0
SelectNodeForSpace selects the best node for a space based on template requirements Returns node ID or empty string for auto-selection, or error if no suitable node found
func SetAgentHealthConfigUpdater ¶ added in v0.28.0
func SetAgentHealthConfigUpdater(updater AgentHealthConfigUpdater)
func SetContainerService ¶
func SetContainerService(service Container)
func SetJSONRPCCaller ¶ added in v0.28.0
func SetJSONRPCCaller(fn JSONRPCCaller)
func SetPoolSessionProvider ¶ added in v0.28.0
func SetPoolSessionProvider(provider func(spaceID string) *PoolSessionState)
func SetSpaceHealth ¶ added in v0.28.0
func SetTransport ¶
func SetTransport(t Transport)
func SetUserService ¶
func SetUserService(service UserService)
func ShouldForwardToNode ¶ added in v0.23.0
ShouldForwardToNode checks if a request should be forwarded to another node
func StartConversationRetentionSweep ¶ added in v0.29.0
func StartConversationRetentionSweep()
StartConversationRetentionSweep runs a background goroutine that tombstones stale conversations and reaps old tombstones. Runs once at start, then on a daily interval. Should be started only on full cluster members — leaf nodes keep chat history in the browser.
Types ¶
type AgentHealthConfigUpdater ¶ added in v0.28.0
type CommandListOptions ¶ added in v0.29.0
type CommandService ¶ added in v0.29.0
type CommandService struct{}
func GetCommandService ¶ added in v0.29.0
func GetCommandService() *CommandService
func (*CommandService) ListCommands ¶ added in v0.29.0
func (s *CommandService) ListCommands(opts CommandListOptions) ([]*model.Command, error)
type Container ¶
type Container interface {
// Volumes
CreateVolume(volume *model.Volume) error
DeleteVolume(volume *model.Volume) error
// Spaces. StopSpace/RestartSpace run the shutdown script and container
// teardown synchronously and return any teardown error. The shutdown script
// is bounded by a timeout (helper.ShutdownScriptTimeout) so a hung agent
// script cannot block the caller indefinitely.
StartSpace(space *model.Space, template *model.Template, user *model.User) error
StopSpace(space *model.Space) error
RestartSpace(space *model.Space) error
DeleteSpace(space *model.Space)
// Helpers
CleanupOnBoot()
}
func GetContainerService ¶
func GetContainerService() Container
type EventActor ¶ added in v0.28.0
type EventDispatcher ¶ added in v0.28.0
type EventDispatcher struct {
// contains filtered or unexported fields
}
func GetEventDispatcher ¶ added in v0.28.0
func GetEventDispatcher() *EventDispatcher
func (*EventDispatcher) Dispatch ¶ added in v0.28.0
func (d *EventDispatcher) Dispatch(envelope *EventEnvelope)
func (*EventDispatcher) GetEntriesForGossip ¶ added in v0.28.0
func (d *EventDispatcher) GetEntriesForGossip() []*InFlightEntry
GetEntriesForGossip returns all in-flight entries, including tombstoned ones. Used for periodic gossip to zone peers. Tombstones must be gossiped so peers that missed the direct done notification (e.g. they were down) learn the entry is complete and remove it after the retention window; otherwise the record would live on those peers until MaxPendingAge.
func (*EventDispatcher) MarkEventDone ¶ added in v0.28.0
func (d *EventDispatcher) MarkEventDone(eventId string)
MarkEventDone tombstones all in-flight entries for an event. Called by non-leaders on receipt of an EventDoneMsg from the leader.
func (*EventDispatcher) MergeInFlight ¶ added in v0.28.0
func (d *EventDispatcher) MergeInFlight(entries []*InFlightEntry)
MergeInFlight merges incoming in-flight records from gossip. Entries with a newer HLC version overwrite local copies; entries we don't have are added.
func (*EventDispatcher) RegisterSubscriptions ¶ added in v0.28.0
func (d *EventDispatcher) RegisterSubscriptions(spaceId, userId string, methods []methods.MethodDefinition)
RegisterSubscriptions extracts event subscriptions from method definitions and registers them for json-rpc event delivery. Called when methods are registered by a running session.
func (*EventDispatcher) ReloadSinks ¶ added in v0.28.0
func (d *EventDispatcher) ReloadSinks()
ReloadSinks refreshes the in-memory sink cache from the database.
func (*EventDispatcher) ReplayPending ¶ added in v0.28.0
func (d *EventDispatcher) ReplayPending()
ReplayPending is called when this node becomes the zone leader. It scans the in-flight map for entries that were not completed (status pending, attempting, or retry) and re-processes them. Since all servers receive every event, non-leaders have recorded these entries but never dispatched them. On leadership change, the new leader picks up where the old one left off. Consumers may see duplicate deliveries (at-least-once) — they dedup via the event UUID.
func (*EventDispatcher) UnregisterSubscriptions ¶ added in v0.28.0
func (d *EventDispatcher) UnregisterSubscriptions(spaceId string)
UnregisterSubscriptions removes all subscriptions for a space. Called when a session disconnects or methods are unregistered.
type EventEnvelope ¶ added in v0.28.0
type Icon ¶ added in v0.19.0
type Icon struct {
Description string `toml:"description" json:"description"`
Source string `toml:"-" json:"source"`
URL string `toml:"url" json:"url"`
}
Icon represents a single icon entry
type IconService ¶ added in v0.19.0
type IconService struct {
// contains filtered or unexported fields
}
func GetIconService ¶ added in v0.19.0
func GetIconService() *IconService
GetIconService returns the singleton icon service instance
func (*IconService) GetIcons ¶ added in v0.19.0
func (s *IconService) GetIcons() []Icon
GetIcons returns all available icons (built-in and user-supplied)
func (*IconService) ReloadIcons ¶ added in v0.19.0
func (s *IconService) ReloadIcons()
ReloadIcons reloads icons from configuration
type InFlightEntry ¶ added in v0.28.0
type InFlightEntry struct {
EventId string
EventType string
SinkId string
UserId string
SpaceId string
Payload map[string]interface{}
ActorId string
ActorName string
ActorKind string
Status string
Attempts uint32
NextAttemptAt time.Time
LastError string
Version hlc.Timestamp
TombstonedAt time.Time
}
type JSONRPCCaller ¶ added in v0.28.0
type JSONRPCCaller func(spaceId, localMethod string, params json.RawMessage) error
JSONRPCCaller is the callback used to invoke a method on a running session. Set by agent_server.ListenAndServe to avoid a circular dependency.
type JSONRPCSubscription ¶ added in v0.28.0
type PoolService ¶ added in v0.28.0
type PoolService struct {
// contains filtered or unexported fields
}
func GetPoolService ¶ added in v0.28.0
func GetPoolService() *PoolService
func (*PoolService) Create ¶ added in v0.28.0
func (s *PoolService) Create(pool *model.PoolDefinition, user *model.User) error
func (*PoolService) Delete ¶ added in v0.28.0
func (s *PoolService) Delete(pool *model.PoolDefinition, user *model.User) error
func (*PoolService) Info ¶ added in v0.28.0
func (s *PoolService) Info(pool *model.PoolDefinition, user *model.User) (apiclient.PoolInfo, error)
func (*PoolService) IsDrained ¶ added in v0.28.0
func (s *PoolService) IsDrained(spaceID string) bool
IsDrained returns true if the pool sweep has drained the space (stopped routing new method calls to it). Used by the HTTP/TCP proxy to skip pool members that are being removed.
func (*PoolService) MarkDrained ¶ added in v0.28.0
func (s *PoolService) MarkDrained(spaceID string)
MarkDrained sets the local drain flag without re-gossiping. Called by the cluster handler on peer nodes when receiving a drain message from the leader, so that HTTP/TCP routing also skips the drained member.
func (*PoolService) MarkUndrained ¶ added in v0.28.0
func (s *PoolService) MarkUndrained(spaceID string)
MarkUndrained clears the local drain flag without re-gossiping. Called by the cluster handler on peer nodes when receiving an undrain message.
func (*PoolService) PickMemberForRouting ¶ added in v0.28.0
func (s *PoolService) PickMemberForRouting(poolName, userId string) *model.Space
PickMemberForRouting selects a healthy, deployed, non-drained member of the pool using round-robin. Returns nil if no suitable member exists.
func (*PoolService) ReapOrphans ¶ added in v0.28.0
func (s *PoolService) ReapOrphans() error
ReapOrphans finds spaces whose pool has been deleted (or no longer exists) and marks them for deletion. This is a safety net for when the normal sweep misses spaces — e.g., after a leader crash mid-deletion, or gossip merge leaving stale pool_id references.
func (*PoolService) Resolve ¶ added in v0.28.0
func (s *PoolService) Resolve(idOrName string) (*model.PoolDefinition, error)
func (*PoolService) ResolveForUser ¶ added in v0.28.0
func (s *PoolService) ResolveForUser(idOrName string, user *model.User) (*model.PoolDefinition, error)
func (*PoolService) SetSize ¶ added in v0.28.0
func (s *PoolService) SetSize(pool *model.PoolDefinition, desiredCount int, user *model.User) error
func (*PoolService) Start ¶ added in v0.28.0
func (s *PoolService) Start(pool *model.PoolDefinition, user *model.User) error
func (*PoolService) StartReaper ¶ added in v0.28.0
func (s *PoolService) StartReaper()
func (*PoolService) StartSweep ¶ added in v0.28.0
func (s *PoolService) StartSweep()
func (*PoolService) Stop ¶ added in v0.28.0
func (s *PoolService) Stop(pool *model.PoolDefinition, user *model.User) error
func (*PoolService) SweepOnce ¶ added in v0.28.0
func (s *PoolService) SweepOnce() error
func (*PoolService) UpdateStartupScript ¶ added in v0.28.0
func (s *PoolService) UpdateStartupScript(pool *model.PoolDefinition, scriptId string, user *model.User) error
UpdateStartupScript changes the pool's startup script and applies it to all existing member spaces. The pool must be stopped.
type PoolSessionState ¶ added in v0.28.0
type ScriptListOptions ¶ added in v0.23.0
type ScriptService ¶ added in v0.23.0
type ScriptService struct{}
func GetScriptService ¶ added in v0.23.0
func GetScriptService() *ScriptService
func (*ScriptService) ListScripts ¶ added in v0.23.0
func (s *ScriptService) ListScripts(opts ScriptListOptions) ([]*model.Script, error)
ListScripts returns a filtered list of scripts based on the provided options
type SkillListOptions ¶ added in v0.23.0
type SkillService ¶ added in v0.23.0
type SkillService struct{}
func GetSkillService ¶ added in v0.23.0
func GetSkillService() *SkillService
func (*SkillService) ListSkills ¶ added in v0.23.0
func (s *SkillService) ListSkills(opts SkillListOptions) ([]*model.Skill, error)
type SpaceListOptions ¶ added in v0.19.0
type SpaceService ¶ added in v0.19.0
type SpaceService struct{}
func GetSpaceService ¶ added in v0.19.0
func GetSpaceService() *SpaceService
func (*SpaceService) CheckUserQuotas ¶ added in v0.19.0
checkUserQuotas validates user quotas for space creation
func (*SpaceService) CreateSpace ¶ added in v0.19.0
CreateSpace creates a new space with validation and quota checks
func (*SpaceService) DeleteSpace ¶ added in v0.19.0
func (s *SpaceService) DeleteSpace(spaceId string, user *model.User) error
DeleteSpace marks a space as deleted with validation
func (*SpaceService) GetSpace ¶ added in v0.19.0
GetSpace retrieves a single space by ID with permission checks
func (*SpaceService) GetSpaceCustomField ¶ added in v0.21.5
func (s *SpaceService) GetSpaceCustomField(spaceId string, fieldName string, user *model.User) (string, error)
GetSpaceCustomField retrieves a single custom field value from a space
func (*SpaceService) ListSpaces ¶ added in v0.19.0
func (s *SpaceService) ListSpaces(opts SpaceListOptions) ([]*model.Space, error)
ListSpaces returns a filtered list of spaces based on the provided options
func (*SpaceService) RemoveDependencyReferences ¶ added in v0.24.0
func (s *SpaceService) RemoveDependencyReferences(spaceId string, ownerUserId string) error
func (*SpaceService) SetSpaceCustomField ¶ added in v0.21.5
func (s *SpaceService) SetSpaceCustomField(spaceId string, fieldName string, fieldValue string, user *model.User) error
SetSpaceCustomField sets or updates a single custom field on a space
func (*SpaceService) UpdateSpace ¶ added in v0.19.0
UpdateSpace updates an existing space with validation
func (*SpaceService) ValidateDependencies ¶ added in v0.24.0
func (s *SpaceService) ValidateDependencies(space *model.Space) error
func (*SpaceService) ValidateDependenciesRunning ¶ added in v0.24.0
func (s *SpaceService) ValidateDependenciesRunning(space *model.Space) error
type TemplateListOptions ¶ added in v0.19.0
type TemplateService ¶ added in v0.19.0
type TemplateService struct{}
func GetTemplateService ¶ added in v0.19.0
func GetTemplateService() *TemplateService
func (*TemplateService) CreateTemplate ¶ added in v0.19.0
CreateTemplate creates a new template with validation
func (*TemplateService) DeleteTemplate ¶ added in v0.19.0
func (s *TemplateService) DeleteTemplate(templateId string, user *model.User) error
DeleteTemplate marks a template as deleted with validation
func (*TemplateService) GetTemplate ¶ added in v0.19.0
func (s *TemplateService) GetTemplate(templateId string) (*model.Template, error)
GetTemplate retrieves a single template by ID
func (*TemplateService) GetTemplateUsage ¶ added in v0.19.0
func (s *TemplateService) GetTemplateUsage(templateId string) (total int, deployed int, err error)
GetTemplateUsage returns usage statistics for a template
func (*TemplateService) ListTemplates ¶ added in v0.19.0
func (s *TemplateService) ListTemplates(opts TemplateListOptions) ([]*model.Template, error)
ListTemplates returns a filtered list of templates based on the provided options
func (*TemplateService) UpdateTemplate ¶ added in v0.19.0
UpdateTemplate updates an existing template with validation
type Transport ¶
type Transport interface {
GossipGroup(group *model.Group)
GossipRole(role *model.Role)
GossipSpace(space *model.Space)
GossipTemplate(template *model.Template)
GossipTemplateVar(templateVar *model.TemplateVar)
GossipUser(user *model.User)
GossipToken(token *model.Token)
GossipVolume(volume *model.Volume)
GossipSpaceUsageSample(sample *model.SpaceUsageSample)
GossipAuditLog(entry *model.AuditLogEntry)
GossipSession(session *model.Session)
GossipScript(script *model.Script)
GossipSkill(skill *model.Skill)
GossipCommand(command *model.Command)
GossipEventSink(sink *model.EventSink)
GossipStackDefinition(stackDef *model.StackDefinition)
GossipResponse(response *model.Response)
GossipConversation(conv *model.Conversation)
GossipMCPServer(server *model.MCPServer)
GossipPoolDefinition(pool *model.PoolDefinition)
GossipPoolDrain(spaceID string)
GossipPoolUndrain(spaceID string)
BroadcastEvent(envelope *EventEnvelope)
NotifyEventDone(eventId string)
GetAgentEndpoints() []string
GetTunnelServers() []string
IsLeader() bool
LockResource(resourceId string) string
UnlockResource(resourceId, unlockToken string)
Nodes() []*gossip.Node
GetNodeByIDString(id string) *gossip.Node
EnqueueSpaceCleanup(space *model.Space)
}
func GetTransport ¶
func GetTransport() Transport
type UserService ¶
type UserService interface {
// User deletion operations
DeleteUser(user *model.User) error
RemoveUsersSessions(user *model.User)
RemoveUsersTokens(user *model.User)
// SSH key and space management
UpdateUserSpaces(user *model.User)
UpdateSpacesSSHKey(user *model.User)
UpdateSpaceSSHKeys(space *model.Space, user *model.User)
}
UserService defines operations that can be performed on users
func GetUserService ¶
func GetUserService() UserService
Source Files
¶
- command_resolver.go
- commands.go
- container.go
- conversations.go
- event_dispatch.go
- event_hooks.go
- event_script.go
- forward.go
- icons.go
- node_selection.go
- plugin_manager.go
- pools.go
- script_resolver.go
- scriptling_env.go
- scriptling_result.go
- scripts.go
- skill_resolver.go
- skills.go
- spaces.go
- stack_vars.go
- templates.go
- transport.go
- user.go