Documentation
¶
Overview ¶
Package hotswap aggregates imports that are required by the hot-swap feature but are not yet referenced in the early scaffolding stages. The blank import ensures the module dependency is added to go.mod so that later stages can rely on it without running `go get` manually.
Index ¶
- func ResolveWorkflowPath(name string) string
- type Action
- type LoaderFunc
- type Manager
- type Reloadable
- func NewAdaptor[T any](load LoaderFunc[T], set SetFunc[T], remove RemoveFunc) Reloadable
- func NewAgentAdaptor(loader *agentloader.Service, finder *agentfinder.Finder) Reloadable
- func NewEmbedderAdaptor(loader *embedload.Service, finder *embedfinder.Finder) Reloadable
- func NewExtensionAdaptor(repo *extensionrepo.Repository, finder *extfinder.Finder) Reloadable
- func NewMCPAdaptor(group *mcpcfg.Group[*mcpcfg.MCPClient]) Reloadable
- func NewModelAdaptor(loader *modelload.Service, finder *modelfinder.Finder) Reloadable
- func NewOAuthAdaptor(loader *oauthloader.Service, finder *oauthfinder.Finder) Reloadable
- func NewWorkflowAdaptor(loadRaw func(ctx context.Context, name string) ([]byte, error), ...) Reloadable
- type RemoveFunc
- type SetFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResolveWorkflowPath ¶
Helper resolving canonical path mirroring repository default logic.
Types ¶
type Action ¶
type Action int
Action represents the type of change detected on the workspace resource.
type LoaderFunc ¶
LoaderFunc loads an object identified by name from an external source. It usually parses YAML/JSON from disk and returns a fully validated object.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager orchestrates hot-swap live reload across multiple workspace kinds. Callers should create one instance per executor and invoke Start/Stop in sync with the executor lifecycle.
func NewManager ¶
NewManager builds a Manager watching workspace root. Debounce specifies the minimum interval between two events for the same file before the latter is forwarded; use 0 for no debouncing.
func (*Manager) Register ¶
func (m *Manager) Register(kind string, r Reloadable)
Register attaches a Reloadable registry to a workspace kind such as workspace.KindAgent. Must be called before Start.
type Reloadable ¶
Reloadable is implemented by any registry/loader pair that can accept hot-swap notifications originating from the workspace file watcher.
The HotSwapManager invokes Reload whenever a YAML file inside the workspace is added, changed or deleted.
name – base file name without extension (e.g. "chat" for chatter.yaml) what – kind of change (AddOrUpdate/Delete).
Implementations are expected to be thread-safe.
func NewAdaptor ¶
func NewAdaptor[T any](load LoaderFunc[T], set SetFunc[T], remove RemoveFunc) Reloadable
NewAdaptor builds a Reloadable that delegates to the provided callbacks.
func NewAgentAdaptor ¶
func NewAgentAdaptor(loader *agentloader.Service, finder *agentfinder.Finder) Reloadable
NewAgentAdaptor wires together the agent loader and finder so that workspace file changes picked up by the HotSwap manager seamlessly refresh the in-memory cache used by the executor.
func NewEmbedderAdaptor ¶
func NewEmbedderAdaptor(loader *embedload.Service, finder *embedfinder.Finder) Reloadable
NewEmbedderAdaptor wires embedder loader + finder for hot-swap.
func NewExtensionAdaptor ¶
func NewExtensionAdaptor(repo *extensionrepo.Repository, finder *extfinder.Finder) Reloadable
NewExtensionAdaptor wires the extensions repository to the in-memory finder so edits in the workspace are reflected live.
func NewMCPAdaptor ¶
func NewMCPAdaptor(group *mcpcfg.Group[*mcpcfg.MCPClient]) Reloadable
NewMCPAdaptor hot-swaps MCP client option YAMLs. It reloads the file into the provided Group so that new orchestrations or restarts see the updated servers.
Note: In decoupled mode this only refreshes workspace definitions. Per‑process MCP clients are refreshed on next use or via explicit restart.
func NewModelAdaptor ¶
func NewModelAdaptor(loader *modelload.Service, finder *modelfinder.Finder) Reloadable
NewModelAdaptor wires model config loader with model finder to support live reload when YAML files under $WORKSPACE/models/ change.
func NewOAuthAdaptor ¶
func NewOAuthAdaptor(loader *oauthloader.Service, finder *oauthfinder.Finder) Reloadable
NewOAuthAdaptor links oauth loader and finder into Reloadable for Manager.
func NewWorkflowAdaptor ¶
func NewWorkflowAdaptor( loadRaw func(ctx context.Context, name string) ([]byte, error), absPathFn func(name string) string, refresh func(location string) error, upsert func(location string, data []byte) error, ) Reloadable
WorkflowAdaptor previously pushed workspace YAML changes into a runtime through user-supplied callbacks. In decoupled mode this remains a generic hot‑reload helper and does not depend on any orchestration engine.
loadRaw – returns raw YAML bytes for a workflow name (without .yaml). absPathFn – resolves the canonical location string that Runtime uses as key
(usually workspace/kind/<name>.yaml).
refresh – invalidates cached copy (called on Delete when upsert is nil). upsert – optional; when non-nil it is used on AddOrUpdate so that runtime
is updated immediately without next-load round-trip.
type RemoveFunc ¶
type RemoveFunc func(name string)
RemoveFunc deletes a value from the registry by name. It must be safe when the entry does not exist.