Documentation
¶
Index ¶
- func CloseAllForwards()
- func LeaseGate(cfg LeaseGateConfig, extract NodeExtractor, inner server.ToolHandlerFunc) server.ToolHandlerFunc
- func ProgressTokenFromRequest(req mcp.CallToolRequest) mcp.ProgressToken
- func RegisterContext(s *server.MCPServer, reg *registry.Registry, leaseCfg LeaseGateConfig)
- func RegisterDeploy(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterDiagnostics(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterExecute(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterForward(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterHistory(s *server.MCPServer, auditLog *audit.Log)
- func RegisterImportExport(s *server.MCPServer, reg *registry.Registry)
- func RegisterInventory(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool)
- func RegisterJobs(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterLeasing(s *server.MCPServer, reg *registry.Registry, store leasing.Store)
- func RegisterMultiNode(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterNodeOps(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterPackage(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterPatch(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterPortal(s *server.MCPServer)
- func RegisterProcess(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterSchedule(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterSecrets(s *server.MCPServer, store *secretstore.Store, helperPath string)
- func RegisterTopology(s *server.MCPServer, reg *registry.Registry)
- func RegisterTransfer(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func RegisterVM(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, ...)
- func SetHealthMonitor(m *healthmon.Monitor)
- func SetOpsRegistry(r *ops.Registry)
- func SetPortalURL(u string)
- func StartMCPHeartbeat(ctx context.Context, req mcp.CallToolRequest, interval time.Duration, ...) func()
- func StartMCPProgressHeartbeat(ctx context.Context, req mcp.CallToolRequest, interval time.Duration, ...) func()
- type LeaseGateConfig
- type MCPProgressState
- type NodeExtractor
- type PatchConfig
- type Target
- type VMEnrollmentConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseAllForwards ¶ added in v0.2.0
func CloseAllForwards()
CloseAllForwards releases all active forwards. Safe to call during shutdown.
func LeaseGate ¶ added in v0.4.0
func LeaseGate(cfg LeaseGateConfig, extract NodeExtractor, inner server.ToolHandlerFunc) server.ToolHandlerFunc
LeaseGate wraps an inner tool handler so that, before invoking it, the caller's effective identity is verified to hold an active lease covering every node the call would touch.
Behavior:
- cfg.Enabled == false → pass-through (no store calls).
- extract returns [] → pass-through (no node ownership to check).
- All requested nodes are covered by one or more active leases owned by this agent_id → call inner; on return, if inner took > 30s and the covering lease's runway is < 5min, opportunistically Extend by 60s (errors silently ignored, this is best-effort heartbeat).
- Otherwise → render a structured markdown error listing the holders of the offending nodes and the recommended recovery commands.
The wrap order is: LeaseGate(...) → addTool(...) so that ops-registry tracking sees both successful calls and lease-denied calls. Tools that bypass addTool (s.AddTool direct) still call LeaseGate first.
func ProgressTokenFromRequest ¶ added in v0.4.1
func ProgressTokenFromRequest(req mcp.CallToolRequest) mcp.ProgressToken
ProgressTokenFromRequest extracts _meta.progressToken from an inbound CallToolRequest. Returns nil if the client did not supply one.
func RegisterContext ¶
func RegisterContext(s *server.MCPServer, reg *registry.Registry, leaseCfg LeaseGateConfig)
func RegisterDeploy ¶
func RegisterDeploy(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, creds *credentials.Store, agentToken string)
func RegisterDiagnostics ¶
func RegisterDiagnostics(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, auditLog *audit.Log, leaseCfg LeaseGateConfig)
func RegisterExecute ¶
func RegisterExecute(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, secrets *secretstore.Store, auditLog *audit.Log, leaseCfg LeaseGateConfig)
func RegisterForward ¶ added in v0.2.0
func RegisterForward(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, leaseCfg LeaseGateConfig)
RegisterForward wires the forward_port / stop_forward / list_forwards tools.
func RegisterInventory ¶
func RegisterJobs ¶ added in v0.2.0
func RegisterJobs(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, leaseCfg LeaseGateConfig)
RegisterJobs exposes the background-job tools (detached executions).
func RegisterLeasing ¶ added in v0.4.0
RegisterLeasing registers the 8 lease tools described in v0.4.0 M2 of the leasing design memo. Tools wrap the in-process leasing.Store (M1).
The reg argument is used only by the topology / role convenience tools and the optional node-name validation in lease(). Store is owned by the caller (cmd/lablink-server/main.go).
func RegisterMultiNode ¶
func RegisterMultiNode(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, auditLog *audit.Log, leaseCfg LeaseGateConfig)
func RegisterNodeOps ¶
func RegisterNodeOps(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, leaseCfg LeaseGateConfig)
func RegisterPackage ¶
func RegisterPackage(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, leaseCfg LeaseGateConfig)
func RegisterPatch ¶
func RegisterPatch(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, auditLog *audit.Log, patchCfg *PatchConfig, leaseCfg LeaseGateConfig)
func RegisterPortal ¶ added in v0.2.0
RegisterPortal exposes get_portal_url so the AI client can hand the operator a clickable link to the local operations portal without grepping logs.
func RegisterProcess ¶
func RegisterProcess(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, leaseCfg LeaseGateConfig)
func RegisterSchedule ¶
func RegisterSchedule(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, auditLog *audit.Log, leaseCfg LeaseGateConfig)
func RegisterSecrets ¶ added in v0.6.1
func RegisterSecrets(s *server.MCPServer, store *secretstore.Store, helperPath string)
RegisterSecrets exposes secret metadata and safe local-ingestion guidance. Secret values never appear in MCP requests, results, ops, or audit logs.
func RegisterTransfer ¶
func RegisterTransfer(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, leaseCfg LeaseGateConfig)
func RegisterVM ¶ added in v0.6.0
func RegisterVM(s *server.MCPServer, reg *registry.Registry, pool *agentclient.Pool, creds *credentials.Store, secrets *secretstore.Store, vmDefaults *vmconfig.Store, auditLog *audit.Log, enrollment VMEnrollmentConfig, leaseCfg LeaseGateConfig)
RegisterVM wires the Phase-1 Hyper-V VM-management primitives. Discovery tools are ungated; mutating tools are lease-gated on the resolved target (local target => no lease; remote node => lease required). The orchestrator create_windows_vm is deliberately DEFERRED (primitives-first, OQ-5).
func SetHealthMonitor ¶
SetHealthMonitor stores the health monitor for use by all tool handlers.
func SetOpsRegistry ¶
SetOpsRegistry registers a process-wide operations registry. Tool handlers that opt in via beginOp will record themselves there for the local portal. Safe to leave nil; in that case beginOp is a no-op pass-through.
func SetPortalURL ¶ added in v0.2.0
func SetPortalURL(u string)
SetPortalURL records the bookmarkable portal URL for get_portal_url to return. Pass "" to indicate the portal is unavailable.
func StartMCPHeartbeat ¶ added in v0.4.1
func StartMCPHeartbeat( ctx context.Context, req mcp.CallToolRequest, interval time.Duration, progress func() (done, total int64), ) func()
StartMCPHeartbeat starts a background goroutine that sends a notifications/progress message to the MCP client every interval. progress is called on each tick to retrieve the current (done, total) pair. Returns a cancel func that stops the goroutine and waits for it to exit. Safe to call when req carries no _meta.progressToken — the goroutine is not started and the returned cancel is a no-op.
func StartMCPProgressHeartbeat ¶ added in v0.7.0
func StartMCPProgressHeartbeat( ctx context.Context, req mcp.CallToolRequest, interval time.Duration, state *MCPProgressState, ) func()
Types ¶
type LeaseGateConfig ¶ added in v0.4.0
LeaseGateConfig is the wiring an MCP tool registration uses to enable lease checks. One LeaseGateConfig is shared across every tool registration in a single lablink-server process.
Enabled gates the whole middleware: when false, LeaseGate degrades to a pass-through (no lookup, no heartbeat, no allocation). Lease enforcement is opt-in: lablink-server leaves this false by default and enables it only when LABLINK_LEASE_REQUIRED=1 (or another affirmative token).
type MCPProgressState ¶ added in v0.7.0
type MCPProgressState struct {
// contains filtered or unexported fields
}
func NewMCPProgressState ¶ added in v0.7.0
func NewMCPProgressState(total time.Duration, phase, status string) *MCPProgressState
func (*MCPProgressState) Update ¶ added in v0.7.0
func (p *MCPProgressState) Update(phase, status string)
type NodeExtractor ¶ added in v0.4.0
type NodeExtractor func(mcp.CallToolRequest, *registry.Registry) []string
NodeExtractor pulls the tool-touched node names out of an MCP request. Tools that act on a single node pass extractSingleNode("node"); tools that fan out over a role/topology or a node list pass a custom extractor.
An empty return is allowed and means "this call doesn't touch a node" — LeaseGate then passes through without consulting the store.
type PatchConfig ¶
type PatchConfig struct {
SfpCopySource string // Network share or local path to sfpcopy.exe (dev machine accessible)
CacheDir string // Local cache dir for sfpcopy.exe on the dev machine
}
PatchConfig holds configurable paths for patching.
func NewPatchConfig ¶
func NewPatchConfig(configDir string) *PatchConfig
type Target ¶ added in v0.6.0
type Target struct {
Name string // "localhost" or a registry node name
IsLocal bool // true for the server host
Node *registry.Node // resolved node when remote; nil when local
}
Target is the execution endpoint for a tool that can run on either the lablink-server host (localhost) or a registered node. It is the unifying abstraction for the VM-management tools and is intentionally generic so future "runs here or on a node" tools can reuse it (Heimdall review §2).
Source Files
¶
- context.go
- deploy.go
- diagnostics.go
- domain_join.go
- execute.go
- forward.go
- heartbeat.go
- helpers.go
- history.go
- importexport.go
- inventory.go
- jobs.go
- leasecheck.go
- leasing.go
- linux_image.go
- linux_vm.go
- multinode.go
- nodeops.go
- ops_hook.go
- package.go
- patch.go
- portal.go
- process.go
- pull.go
- schedule.go
- secret_prompt_other.go
- secrets.go
- staging.go
- target.go
- topology.go
- transfer.go
- upload.go
- vm.go
- vm_delete.go
- vm_enrollment.go
- vm_failure.go
- vm_orchestrator.go
- vm_resources.go
- vm_templates.go