Documentation
¶
Overview ¶
Client link endpoints: the UI counterpart of the stack's declarative link: block. POST/DELETE write BOTH the client's own config (via the provisioner) and the stack.yaml link: entry (via stackedit), so the UI and the file never diverge. These endpoints write files in the operator's home directory — the same local-operator capability the vault and stack-editing endpoints already assume.
Index ¶
- type AgentPreview
- type AuthRequest
- type ClientStatus
- type FeatureStatus
- type LinkEntryInfo
- type MCPServerStatus
- type ResourceStatus
- type Server
- func (s *Server) Close()
- func (s *Server) Handler() http.Handler
- func (s *Server) LogBuffer() *logging.LogBuffer
- func (s *Server) MetricsAccumulator() *metrics.Accumulator
- func (s *Server) PinStore() *pins.PinStore
- func (s *Server) RegistryServer() *registry.Server
- func (s *Server) ReloadHandler() *reload.Handler
- func (s *Server) SetAgentsManager(m *agentsync.Manager)
- func (s *Server) SetAllowedHosts(hosts []string)
- func (s *Server) SetAllowedOrigins(origins []string)
- func (s *Server) SetAuth(authType, token, header string)
- func (s *Server) SetContextsManager(m *contexts.Manager)
- func (s *Server) SetDockerClient(cli dockerclient.DockerClient)
- func (s *Server) SetFeatures(get func() []FeatureStatus)
- func (s *Server) SetGatewayAddr(addr string)
- func (s *Server) SetLimitsStatusFunc(fn func() limits.StatusReport)
- func (s *Server) SetLogBuffer(buffer *logging.LogBuffer)
- func (s *Server) SetMetricsAccumulator(acc *metrics.Accumulator)
- func (s *Server) SetModelPolicyProvider(provider func() (skillPolicy, agentPolicy *registry.ModelPolicy))
- func (s *Server) SetOAuthBroker(b *mcpauth.Broker)
- func (s *Server) SetPacksManagers(m *packops.Managers)
- func (s *Server) SetPinStore(ps *pins.PinStore)
- func (s *Server) SetProber(p *probe.Prober)
- func (s *Server) SetProvisionerRegistry(r *provisioner.Registry, serverName string)
- func (s *Server) SetRegistryServer(r *registry.Server)
- func (s *Server) SetReloadHandler(h *reload.Handler)
- func (s *Server) SetSkillPinStore(ps *skillpins.Store)
- func (s *Server) SetSkillSourcePaths(lockPath, configPath string)
- func (s *Server) SetSkillUpdateCachePath(path string)
- func (s *Server) SetStackFile(path string)
- func (s *Server) SetStackName(name string)
- func (s *Server) SetStartWatcher(fn func(stackPath string))
- func (s *Server) SetTokenizerName(name string)
- func (s *Server) SetTraceBuffer(buf *tracing.Buffer)
- func (s *Server) SetVaultStore(v *vault.Store)
- func (s *Server) SetWiringManager(m *wiring.Manager)
- func (s *Server) SkillPinStore() *skillpins.Store
- type ServerInfo
- type SkillDiffResponse
- type SkillPreview
- type SkillSourceEntry
- type SkillSourceStatus
- type SkillSyncResult
- type SourceSyncResult
- type SourceSyncSummary
- type SourceUpdateSummary
- type StackRecipe
- type UpdateSummary
- type WizardDraft
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentPreview ¶
type AgentPreview struct {
Name string `json:"name"`
Description string `json:"description"`
Body string `json:"body"`
Valid bool `json:"valid"`
Errors []string `json:"errors,omitempty"`
Findings []skills.SecurityFinding `json:"findings,omitempty"`
Exists bool `json:"exists"`
}
AgentPreview represents a previewed agent definition from a repo (not yet imported). The kind marker for the wizard's review step: a mixed repo previews as skills plus agents, each under its own key.
type AuthRequest ¶
type AuthRequest struct {
Method string `json:"method,omitempty"` // "token" | "ssh-agent" | "ssh-key" | ""
Token string `json:"token,omitempty"` // ephemeral plaintext
CredentialRef string `json:"credentialRef,omitempty"` // e.g. "${vault:GIT_TOKEN}"
SSHUser string `json:"sshUser,omitempty"`
SSHKeyPath string `json:"sshKeyPath,omitempty"`
}
AuthRequest is the optional auth payload accepted on /api/skills/sources/* endpoints. Raw Token values are transient; CredentialRef (e.g. "${vault:GIT_TOKEN}") is resolved against the live vault on every request.
type ClientStatus ¶
type ClientStatus struct {
Name string `json:"name"`
Slug string `json:"slug"`
Detected bool `json:"detected"`
Linked bool `json:"linked"`
Transport string `json:"transport"`
ConfigPath string `json:"configPath,omitempty"`
// EffectiveScope is the backend-computed per-client tool access scope when a
// `clients:` block is configured: the servers and prefixed tools this client
// can reach. nil when no access scoping is in effect, so the frontend can
// distinguish "unscoped (legacy)" from "scoped to nothing".
EffectiveScope *mcp.ClientScopeResult `json:"effectiveScope,omitempty"`
// Declared reports whether the stack's link: block lists this client;
// LinkEntry carries the declared options when it does. Desired state,
// distinct from Linked (actual config-file state).
Declared bool `json:"declared,omitempty"`
LinkEntry *LinkEntryInfo `json:"linkEntry,omitempty"`
// Drifted reports that a recorded gridctl entry in this client's
// config was edited since gridctl wrote it (wiring ownership).
Drifted bool `json:"drifted,omitempty"`
}
ClientStatus describes an LLM client's detection and link state.
type FeatureStatus ¶
type FeatureStatus struct {
Name string `json:"name"`
Stage string `json:"stage"`
Description string `json:"description"`
}
FeatureStatus is one enabled experimental flag as exposed on /api/status. Read-only display metadata: the UI never toggles flags (they are configured in stack.yaml and cannot be changed from the browser).
type LinkEntryInfo ¶
type LinkEntryInfo struct {
Group string `json:"group,omitempty"`
ClientID string `json:"clientId,omitempty"`
Name string `json:"name,omitempty"`
}
LinkEntryInfo is the wire shape of a declared link: entry's options.
type MCPServerStatus ¶
type MCPServerStatus struct {
Name string `json:"name"`
Transport string `json:"transport"`
Endpoint string `json:"endpoint"`
Initialized bool `json:"initialized"`
ToolCount int `json:"toolCount"`
Tools []string `json:"tools"`
External bool `json:"external"`
LocalProcess bool `json:"localProcess"`
SSH bool `json:"ssh"`
SSHHost string `json:"sshHost,omitempty"`
OpenAPI bool `json:"openapi"`
OpenAPISpec string `json:"openapiSpec,omitempty"`
OutputFormat string `json:"outputFormat,omitempty"`
Healthy *bool `json:"healthy,omitempty"`
LastCheck *string `json:"lastCheck,omitempty"`
HealthError string `json:"healthError,omitempty"`
ToolWhitelist []string `json:"toolWhitelist,omitempty"`
// ProtocolVersion is the MCP protocol version the downstream server
// reported at initialize; empty for lax servers and OpenAPI adapters.
ProtocolVersion string `json:"protocolVersion,omitempty"`
// ProtocolGeneration is the resolved protocol era ("handshake" or
// "stateless"); empty for OpenAPI adapters and unresolved servers.
ProtocolGeneration string `json:"protocolGeneration,omitempty"`
// RegistrationFailed marks a server that never registered with the
// gateway; the UI shows it as failed instead of omitting the node.
RegistrationFailed bool `json:"registrationFailed,omitempty"`
Replicas []mcp.ReplicaStatus `json:"replicas,omitempty"`
Autoscale *mcp.AutoscaleStatus `json:"autoscale,omitempty"`
// AuthStatus reports downstream authorization state ("authorized" or
// "needs_auth"); empty for servers without tracked auth state.
AuthStatus string `json:"authStatus,omitempty"`
AuthIssuer string `json:"authIssuer,omitempty"`
AuthExpiry *time.Time `json:"authExpiry,omitempty"`
}
MCPServerStatus mirrors the mcp.MCPServerStatus type for API responses.
type ResourceStatus ¶
type ResourceStatus struct {
Name string `json:"name"`
Image string `json:"image"`
Status string `json:"status"`
}
ResourceStatus contains status information for a resource container.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server provides the combined API server for gridctl.
func (*Server) Close ¶
func (s *Server) Close()
Close performs cleanup of the API server's managed resources.
func (*Server) MetricsAccumulator ¶
func (s *Server) MetricsAccumulator() *metrics.Accumulator
MetricsAccumulator returns the token metrics accumulator.
func (*Server) PinStore ¶
PinStore returns the wired pin store, or nil when schema pinning is not configured. Exposed so callers and tests can confirm whether pin management is active.
func (*Server) RegistryServer ¶
RegistryServer returns the registry server.
func (*Server) ReloadHandler ¶
ReloadHandler returns the reload handler.
func (*Server) SetAgentsManager ¶
SetAgentsManager injects the agent projection manager. Tests use it to keep projection handlers away from the real home directory.
func (*Server) SetAllowedHosts ¶
SetAllowedHosts sets extra Host header values accepted across the whole HTTP surface. Loopback hosts are always accepted, so an empty list is the secure default.
func (*Server) SetAllowedOrigins ¶
SetAllowedOrigins sets the CORS allowed origins for the server.
func (*Server) SetAuth ¶
SetAuth configures authentication for the server. When configured, all requests (except /health and /ready) must include a valid token.
func (*Server) SetContextsManager ¶
SetContextsManager overrides the global-context manager. Must be called before the server handles its first request (it races with the lazy sync.Once initialization otherwise); tests call it during setup.
func (*Server) SetDockerClient ¶
func (s *Server) SetDockerClient(cli dockerclient.DockerClient)
SetDockerClient sets the Docker client for container operations.
func (*Server) SetFeatures ¶
func (s *Server) SetFeatures(get func() []FeatureStatus)
SetFeatures sets a getter for the enabled experimental flag list. The getter (rather than a static slice) lets hot reloads of `experimental:` reach /api/status without re-wiring; it must be safe for concurrent calls.
func (*Server) SetGatewayAddr ¶
SetGatewayAddr sets the base URL of this server (e.g. "http://localhost:8180"). Used to build the MCP config JSON for CLI proxy sessions so the claude CLI can reach gridctl's MCP gateway at <gatewayAddr>/sse.
func (*Server) SetLimitsStatusFunc ¶
func (s *Server) SetLimitsStatusFunc(fn func() limits.StatusReport)
SetLimitsStatusFunc installs the closure GET /api/limits reads. The builder wires a closure over the live limits policy so hot-reload swaps are reflected without re-wiring.
func (*Server) SetLogBuffer ¶
SetLogBuffer sets the log buffer for gateway logs.
func (*Server) SetMetricsAccumulator ¶
func (s *Server) SetMetricsAccumulator(acc *metrics.Accumulator)
SetMetricsAccumulator sets the token metrics accumulator.
func (*Server) SetModelPolicyProvider ¶
func (s *Server) SetModelPolicyProvider(provider func() (skillPolicy, agentPolicy *registry.ModelPolicy))
SetModelPolicyProvider wires the live model preference policies into the API (the controller points it at the gateway instance's compiled scopes, which hot reload keeps current). nil (the default) means no stack policy is available and responses carry declarations only.
func (*Server) SetOAuthBroker ¶
SetOAuthBroker wires the downstream OAuth broker: enables the /api/servers/{name}/auth/* endpoints and mounts the /oauth/callback route (outside the inbound auth middleware).
func (*Server) SetPacksManagers ¶
SetPacksManagers injects the pack engine. Tests use it to keep pack handlers away from the real home directory.
func (*Server) SetPinStore ¶
SetPinStore sets the pin store for schema pin management.
func (*Server) SetProber ¶
SetProber wires an externally-constructed prober. The API server owns the limiter but the prober's cache and spawner come from the gateway builder.
func (*Server) SetProvisionerRegistry ¶
func (s *Server) SetProvisionerRegistry(r *provisioner.Registry, serverName string)
SetProvisionerRegistry sets the provisioner registry for client detection.
func (*Server) SetRegistryServer ¶
SetRegistryServer sets the registry server for skill management.
func (*Server) SetReloadHandler ¶
SetReloadHandler sets the reload handler for hot reload support.
func (*Server) SetSkillPinStore ¶
SetSkillPinStore sets the skill pin store for skill governance management.
func (*Server) SetSkillSourcePaths ¶
SetSkillSourcePaths overrides the skill lock-file and skills.yaml paths used by /api/skills/* handlers. Empty values keep the global defaults.
func (*Server) SetSkillUpdateCachePath ¶
SetSkillUpdateCachePath overrides the skill update cache path. Empty keeps the global default. Tests use this to isolate from $HOME/.gridctl/cache.
func (*Server) SetStackFile ¶
SetStackFile sets the path to the stack YAML file for spec endpoints.
func (*Server) SetStackName ¶
SetStackName sets the stack name for container lookups.
func (*Server) SetStartWatcher ¶
SetStartWatcher sets a callback that activates live-reload file watching for the given stack path. Called by POST /api/stack/initialize after cold-loading.
func (*Server) SetTokenizerName ¶
SetTokenizerName sets the active tokenizer mode for display in /api/status.
func (*Server) SetTraceBuffer ¶
SetTraceBuffer sets the distributed tracing ring buffer.
func (*Server) SetVaultStore ¶
SetVaultStore sets the vault store for secrets management.
func (*Server) SetWiringManager ¶
SetWiringManager injects the wiring ownership manager. Tests use it to keep link handlers away from the real home directory.
func (*Server) SkillPinStore ¶
SkillPinStore returns the wired skill pin store, or nil when skill pinning is not configured.
type ServerInfo ¶
type ServerInfo struct {
Name string `json:"name"`
Version string `json:"version"`
Tokenizer string `json:"tokenizer,omitempty"`
}
ServerInfo mirrors the mcp.ServerInfo type for API responses.
type SkillDiffResponse ¶
type SkillDiffResponse struct {
Skill string `json:"skill"`
Local string `json:"local"`
Upstream string `json:"upstream"`
UnifiedDiff string `json:"unifiedDiff,omitempty"`
Drifted bool `json:"drifted"`
}
SkillDiffResponse is the body of the per-skill compare-with-upstream endpoint.
type SkillPreview ¶
type SkillPreview struct {
Name string `json:"name"`
Description string `json:"description"`
Body string `json:"body"`
Valid bool `json:"valid"`
Errors []string `json:"errors,omitempty"`
Warnings []string `json:"warnings,omitempty"`
Findings []skills.SecurityFinding `json:"findings,omitempty"`
Exists bool `json:"exists"`
}
SkillPreview represents a previewed skill from a repo (not yet imported).
type SkillSourceEntry ¶
type SkillSourceEntry struct {
Name string `json:"name"`
Description string `json:"description"`
State string `json:"state"`
IsRemote bool `json:"isRemote"`
ContentHash string `json:"contentHash,omitempty"`
// HasLocalEdits is true when the on-disk SKILL.md diverges from the hash
// snapshotted at the last import/sync (i.e. the user edited it locally).
HasLocalEdits bool `json:"hasLocalEdits"`
}
SkillSourceEntry represents a single skill within a source.
type SkillSourceStatus ¶
type SkillSourceStatus struct {
Name string `json:"name"`
Repo string `json:"repo"`
Ref string `json:"ref,omitempty"`
Path string `json:"path,omitempty"`
AutoUpdate bool `json:"autoUpdate"`
UpdateInterval string `json:"updateInterval"`
Skills []SkillSourceEntry `json:"skills"`
LastFetched string `json:"lastFetched,omitempty"`
CommitSHA string `json:"commitSha,omitempty"`
UpdateAvail bool `json:"updateAvailable"`
// DriftedSkills lists the skills in this source whose on-disk SKILL.md has
// local edits (drift) that a sync would otherwise overwrite.
DriftedSkills []string `json:"driftedSkills,omitempty"`
}
SkillSourceStatus represents a skill source with its update status.
type SkillSyncResult ¶
type SkillSyncResult struct {
Skill string `json:"skill"`
Imported int `json:"imported,omitempty"`
// ImportedAgents counts agent definitions the same update refreshed
// (Update re-imports the whole source, so agents ride along).
ImportedAgents int `json:"importedAgents,omitempty"`
Warnings []string `json:"warnings,omitempty"`
Error string `json:"error,omitempty"`
// Skipped, when set, is the reason a drifted skill was left untouched
// (e.g. "local edits"). Its tracking metadata is still advanced.
Skipped string `json:"skipped,omitempty"`
// Backup is the file name of the pre-overwrite SKILL.md backup written
// when a drifted skill was force-overwritten.
Backup string `json:"backup,omitempty"`
}
SkillSyncResult is the per-skill outcome within a sync.
type SourceSyncResult ¶
type SourceSyncResult struct {
Name string `json:"name"`
Repo string `json:"repo"`
Pinned bool `json:"pinned,omitempty"`
Skills []SkillSyncResult `json:"skills,omitempty"`
Error string `json:"error,omitempty"`
}
SourceSyncResult is the per-source outcome of a bulk sync.
type SourceSyncSummary ¶
type SourceSyncSummary struct {
Sources []SourceSyncResult `json:"sources"`
SyncedSources int `json:"syncedSources"`
UpdatedSkills int `json:"updatedSkills"`
SkippedSkills int `json:"skippedSkills"`
FailedSources int `json:"failedSources"`
PinnedSources int `json:"pinnedSources"`
}
SourceSyncSummary is the aggregate response from a bulk sync.
type SourceUpdateSummary ¶
type SourceUpdateSummary struct {
Name string `json:"name"`
Repo string `json:"repo"`
Current string `json:"currentSha"`
Latest string `json:"latestSha,omitempty"`
HasUpdate bool `json:"hasUpdate"`
Error string `json:"error,omitempty"`
}
SourceUpdateSummary represents update status for a single source.
type StackRecipe ¶
type StackRecipe struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Category string `json:"category"`
Spec string `json:"spec"`
}
StackRecipe is a pre-built stack template.
type UpdateSummary ¶
type UpdateSummary struct {
Available int `json:"available"`
Sources []SourceUpdateSummary `json:"sources"`
}
UpdateSummary represents pending updates across all sources.
type WizardDraft ¶
type WizardDraft struct {
ID string `json:"id"`
Name string `json:"name"`
ResourceType string `json:"resourceType"`
FormData map[string]interface{} `json:"formData"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
WizardDraft represents a saved wizard draft.
Source Files
¶
- agents.go
- api.go
- auth.go
- catalog.go
- clients.go
- clients_edit.go
- clients_preview.go
- context.go
- groups.go
- limits.go
- link.go
- mcp_servers.go
- modelpref.go
- optimize.go
- packs.go
- pins.go
- probe.go
- registry.go
- server_auth.go
- skillpins.go
- skills.go
- skills_usage.go
- stack.go
- stack_append.go
- stack_edit.go
- stack_telemetry.go
- telemetry.go
- textdiff.go
- tools_usage.go
- traces.go
- traces_otlp.go
- var_usage.go
- vault.go
- wiring.go
- wizard.go