Documentation
¶
Index ¶
- Constants
- Variables
- func BuildPolicyRules(roles []*api.PolicyRole, bindings []*api.PolicyBinding) []biscuit.Rule
- func FetchHubInfo(ctx context.Context, hubURL string) (*api.HubInfoResponse, error)
- func FetchMeshPolicy(ctx context.Context, hubURL string, biscuitToken []byte) (*api.PolicyConfigGetResponse, error)
- func GetDefaultDataDir() (string, error)
- func GetOrGenerateKey(s *Store) crypto.PrivKey
- func GetRecentLogs() []string
- func NewMCPHandler(node *SamNode) http.Handler
- func NewMCPServer(node *SamNode) *mcp.Server
- func NewUnauthenticatedMCPHandler(hubURL string) http.Handler
- func NewUnauthenticatedMCPServer(hubURL string) *mcp.Server
- func StartSidecarServer(node *SamNode, addr, token, certFile, keyFile, caFile string) (*http.Server, error)
- func StartUnauthSidecarServer(hubURL, addr, certFile, keyFile string) (*http.Server, error)
- func SyncHubConfig(ctx context.Context, s *Store) ([]byte, []multiaddr.Multiaddr, error)
- type A2AService
- type CallRemoteToolParams
- type CheckConnectivityParams
- type ConnectPeerParams
- type DescribeRemoteToolParams
- type DiscoverRemoteServicesParams
- type FindRemoteToolsParams
- type GetMeshInfoParams
- type GetNetworkInfoParams
- type GetRecentLogsParams
- type GetTokenInfoParams
- type InferenceService
- type ListLocalServicesParams
- type MCPService
- type MeshPubsubBroadcastParams
- type NodeConfigComplete
- type Options
- type PeerRateLimiter
- type PollMessagesParams
- type RefreshError
- type RequestContext
- type RingBufferSink
- type SamNode
- func (n *SamNode) Authorize(rawToken []byte, req RequestContext, pubKey ed25519.PublicKey) error
- func (n *SamNode) CallMCPTool(ctx context.Context, targetPeer peer.ID, toolName string, params any) (*mcp.CallToolResult, error)
- func (n *SamNode) ConnectAndAuthWithHub(ctx context.Context, addr multiaddr.Multiaddr) error
- func (n *SamNode) ConnectMCPSession(ctx context.Context, targetPeer peer.ID, targetService string) (*mcp.ClientSession, func(), error)
- func (n *SamNode) DiscoverEndpoints(ctx context.Context, issuerURL string) (tokenURL, authURL string, err error)
- func (n *SamNode) DiscoverRemoteServices(ctx context.Context, serviceType api.ServiceType, serviceName string) ([]*api.DiscoveredProvider, error)
- func (n *SamNode) DiscoverRemoteServicesStream(ctx context.Context, serviceType api.ServiceType, serviceName string) (<-chan *api.DiscoveredProvider, error)
- func (n *SamNode) DiscoverTokenURL(ctx context.Context, issuerURL string) (string, error)
- func (n *SamNode) Enroll(ctx context.Context, hubURL string, jwt string) error
- func (n *SamNode) EnrollBootstrap(ctx context.Context, hubURL string, bootstrapToken string) error
- func (n *SamNode) FetchJWT(ctx context.Context, tokenURL, clientID, clientSecret string) (string, error)
- func (n *SamNode) FindProvidersByName(ctx context.Context, serviceType api.ServiceType, serviceName string) ([]peer.AddrInfo, error)
- func (n *SamNode) FindProvidersByType(ctx context.Context, serviceType api.ServiceType) ([]peer.AddrInfo, error)
- func (n *SamNode) GetIdentity() []byte
- func (n *SamNode) HandleAuthHandshake(s network.Stream)
- func (n *SamNode) HandleMCPStream(s network.Stream, reqCtx RequestContext)
- func (n *SamNode) InteractiveLogin(ctx context.Context, authURL, tokenURL, clientID, audience string, ...) (string, error)
- func (n *SamNode) IsConnected() bool
- func (n *SamNode) IsServiceRegistered(serviceName string) bool
- func (n *SamNode) ListLocalServices(typeFilter api.ServiceType) []*api.ServiceInfo
- func (n *SamNode) LoadHubConfig() ([]byte, []string, error)
- func (n *SamNode) LoadHubURL() (string, error)
- func (n *SamNode) RefreshEnrollment(ctx context.Context) error
- func (n *SamNode) RefreshJWT(ctx context.Context, tokenURL, clientID, clientSecret, refreshToken string) (string, string, error)
- func (n *SamNode) RegisterService(ctx context.Context, req *api.RegisterServiceRequest) error
- func (n *SamNode) RegisterStaticServices(ctx context.Context, services []api.ServiceConfig) error
- func (n *SamNode) SaveHubConfig(pubKey []byte, addrs []string) error
- func (n *SamNode) SetIdentityCache(b []byte)
- func (n *SamNode) Start(ctx context.Context) error
- func (n *SamNode) StartIngressServer(ctx context.Context) error
- func (n *SamNode) StartRenewalLoop(ctx context.Context, issuerURL, clientID, clientSecret, jwtPath string)
- func (n *SamNode) Teardown() error
- func (n *SamNode) UnregisterService(ctx context.Context, serviceName string) error
- func (n *SamNode) UpdateRelays(addrs []multiaddr.Multiaddr)
- func (n *SamNode) VerifyBiscuitToken(biscuitBytes []byte, reqCtx RequestContext) error
- func (n *SamNode) WithBiscuitAuth(next func(network.Stream, RequestContext)) network.StreamHandler
- type SendMessageParams
- type Service
- type ServiceRegistry
- func (r *ServiceRegistry) Get(name string) (Service, bool)
- func (r *ServiceRegistry) List(typeFilter api.ServiceType) []*api.ServiceInfo
- func (r *ServiceRegistry) Register(ctx context.Context, svc Service) error
- func (r *ServiceRegistry) ReprovideAll(ctx context.Context)
- func (r *ServiceRegistry) TeardownAll()
- func (r *ServiceRegistry) Unregister(ctx context.Context, name string) error
- type ServiceRequest
- type StdioBridge
- type Store
- func (s *Store) Close() error
- func (s *Store) IsBanned(p peer.ID) bool
- func (s *Store) LoadHubConfig() ([]byte, []string, error)
- func (s *Store) LoadHubURL() (string, error)
- func (s *Store) LoadIdentity() ([]byte, error)
- func (s *Store) LoadIdentityExpiration() (int64, error)
- func (s *Store) LoadKey() ([]byte, error)
- func (s *Store) LoadOIDCConfig() (string, string, string, error)
- func (s *Store) LoadRefreshToken() (string, error)
- func (s *Store) SaveHubConfig(pubKey []byte, addrs []string) error
- func (s *Store) SaveHubURL(url string) error
- func (s *Store) SaveIdentity(biscuit []byte) error
- func (s *Store) SaveIdentityExpiration(exp int64) error
- func (s *Store) SaveKey(key []byte) error
- func (s *Store) SaveOIDCConfig(issuer, clientID, audience string) error
- func (s *Store) SaveRefreshToken(token string) error
- type StreamTransport
- func (t *StreamTransport) Close() error
- func (t *StreamTransport) Connect(ctx context.Context) (mcp.Connection, error)
- func (t *StreamTransport) Read(ctx context.Context) (jsonrpc.Message, error)
- func (t *StreamTransport) Send(data []byte) error
- func (t *StreamTransport) SessionID() string
- func (t *StreamTransport) Write(ctx context.Context, msg jsonrpc.Message) error
- type SubscribeTopicParams
- type TrustedKey
Constants ¶
const ( // Cache sizes RateLimiterSize = 1000 RevocationCacheSize = 10000 VerificationCacheSize = 1000 // Freshness checks FreshnessThreshold = 5 * time.Minute // Key pruning KeyPruningInterval = 1 * time.Hour // Reprovide interval ReprovideInterval = 5 * time.Minute )
const ( DefaultMeshName = "public-mesh" DefaultDiscoveryInterval = "30s" DefaultConfigFile = "sam-node.yaml" DefaultHubConnectTimeout = 5 * time.Second )
const ( // Rate limiting defaults for peers PeerRateLimit = 5 PeerBurst = 10 )
const PeerstoreKeyPrivateIPFailed = "private_ip_failed"
PeerstoreKeyPrivateIPFailed is the key used in the libp2p Peerstore to track if a peer's private IP was previously found to be unreachable or slower than a relay. This allows the node to "try once and remember", avoiding a 15-second timeout on subsequent discovery or tool calls when dialing unroutable private networks.
Variables ¶
var ( // Renewal timing defaults DefaultRenewalFallback = (api.BiscuitTokenTTL * 8) / 10 // 80% of TTL (19.2h) RenewalBuffer = api.BiscuitTokenTTL / 5 // 20% of TTL (4.8h) RenewalThreshold = api.BiscuitTokenTTL / 4 // 25% of TTL (6h) )
var ErrFatalAuth = errors.New("fatal authentication error")
Functions ¶
func BuildPolicyRules ¶
func BuildPolicyRules(roles []*api.PolicyRole, bindings []*api.PolicyBinding) []biscuit.Rule
func FetchHubInfo ¶
FetchHubInfo retrieves the latest configuration from the Hub's /info endpoint.
func FetchMeshPolicy ¶
func FetchMeshPolicy(ctx context.Context, hubURL string, biscuitToken []byte) (*api.PolicyConfigGetResponse, error)
FetchMeshPolicy retrieves the latest mesh policy from the Hub's /policies endpoint using a biscuit token.
func GetDefaultDataDir ¶
func GetOrGenerateKey ¶
GetOrGenerateKey retrieves a persistent private key or creates one if it's the first run
func NewMCPHandler ¶
NewMCPHandler creates a new HTTP handler for the MCP server using the official SDK.
func NewMCPServer ¶
NewMCPServer creates a new MCP server instance with all tools registered.
func NewUnauthenticatedMCPHandler ¶
NewUnauthenticatedMCPHandler creates an HTTP handler for the unauthenticated MCP server.
func NewUnauthenticatedMCPServer ¶
NewUnauthenticatedMCPServer creates a minimal MCP server that instructs the client on how to authenticate.
func StartSidecarServer ¶
func SyncHubConfig ¶
SyncHubConfig loads the hub configuration from the store, attempts to refresh it via HTTP from the hub, and updates the store if successful. It returns the hub public key and the latest multiaddresses.
Types ¶
type A2AService ¶
type A2AService struct {
// contains filtered or unexported fields
}
A2AService is zero-override embedding. They exist so the factory produces a distinct type per ServiceType, leaving room for future per-kind behaviour without churn.
func (*A2AService) Info ¶
func (b *A2AService) Info() *api.ServiceInfo
type CallRemoteToolParams ¶
type CallRemoteToolParams struct {
PeerID string `json:"peer_id" jsonschema:"The Peer ID of the target agent"`
ToolName string `json:"tool_name" jsonschema:"The name of the server to call"`
Arguments map[string]any `` /* 177-byte string literal not displayed */
}
CallRemoteToolParams defines the parameters for the call_remote_tool tool.
Arguments is a JSON object whose shape matches the target server's input_schema (use describe_remote_tool to fetch it). Earlier revisions took a stringified JSON blob here; that footgun is gone.
type CheckConnectivityParams ¶
type CheckConnectivityParams struct {
PeerID string `json:"peer_id,omitempty" jsonschema:"Optional peer ID to ping."`
}
CheckConnectivityParams defines the parameters for the check_connectivity tool.
type ConnectPeerParams ¶
type ConnectPeerParams struct {
PeerAddr string `json:"peer_addr" jsonschema:"The full multiaddress of the peer to connect to"`
}
ConnectPeerParams defines the parameters for the connect_peer tool.
type DescribeRemoteToolParams ¶
type DescribeRemoteToolParams struct {
PeerID string `json:"peer_id" jsonschema:"Peer ID of the node hosting the server. Required."`
ToolName string `` /* 135-byte string literal not displayed */
}
DescribeRemoteToolParams defines parameters for the describe_remote_tool sidecar tool.
type DiscoverRemoteServicesParams ¶
type DiscoverRemoteServicesParams struct {
Type string `json:"type" jsonschema:"Service type (mcp, inference, a2a)"`
Name string `json:"name,omitempty" jsonschema:"Optional service name. Omit to list all services of the given type."`
Limit int `json:"limit,omitempty" jsonschema:"Optional limit for pagination. Defaults to 20."`
Offset int `json:"offset,omitempty" jsonschema:"Optional offset for pagination. Defaults to 0."`
}
DiscoverRemoteServicesParams defines the parameters for the discover_remote_services tool.
type FindRemoteToolsParams ¶
type FindRemoteToolsParams struct {
Intent string `` /* 170-byte string literal not displayed */
PeerID string `json:"peer_id,omitempty" jsonschema:"Restrict the search to a single peer. Empty means search the whole mesh."`
ServiceName string `` /* 166-byte string literal not displayed */
}
FindRemoteToolsParams defines the parameters for the find_remote_tools tool.
type GetMeshInfoParams ¶
type GetMeshInfoParams struct{}
GetMeshInfoParams defines the parameters for the get_mesh_info tool.
type GetNetworkInfoParams ¶
type GetNetworkInfoParams struct{}
GetNetworkInfoParams defines parameters for the get_network_info tool.
type GetRecentLogsParams ¶
type GetRecentLogsParams struct{}
GetRecentLogsParams defines parameters for the get_recent_logs tool.
type GetTokenInfoParams ¶
type GetTokenInfoParams struct{}
GetTokenInfoParams defines parameters for the get_token_info tool.
type InferenceService ¶
type InferenceService struct {
// contains filtered or unexported fields
}
InferenceService provides intelligent LLM gateway features: traffic routing and token usage tracking for OpenAI-compatible endpoints.
func (*InferenceService) Info ¶
func (b *InferenceService) Info() *api.ServiceInfo
type ListLocalServicesParams ¶
type ListLocalServicesParams struct {
Type string `json:"type,omitempty" jsonschema:"Optional service type filter (mcp, inference, a2a). Empty means all types."`
}
ListLocalServicesParams defines the parameters for the list_local_services tool.
type MCPService ¶
type MCPService struct {
// contains filtered or unexported fields
}
MCPService extends baseService to handle MCP protocol proxying.
func (*MCPService) HandleStreamPassThrough ¶
func (m *MCPService) HandleStreamPassThrough(s network.Stream)
HandleStreamPassThrough connects to the backend and proxies JSON-RPC messages.
func (*MCPService) Info ¶
func (b *MCPService) Info() *api.ServiceInfo
func (*MCPService) Init ¶
func (m *MCPService) Init(ctx context.Context) error
Init initializes the base service.
func (*MCPService) Teardown ¶
func (m *MCPService) Teardown() error
Teardown chains to baseService.Teardown.
type MeshPubsubBroadcastParams ¶
type MeshPubsubBroadcastParams struct {
Topic string `json:"topic" jsonschema:"GossipSub topic name"`
Payload string `json:"payload" jsonschema:"Payload to publish"`
}
MeshPubsubBroadcastParams defines the parameters for the mesh_pubsub_broadcast tool.
type NodeConfigComplete ¶
type NodeConfigComplete struct {
Policies []biscuit.Policy
Checks []biscuit.Check
Rules []biscuit.Rule
Services []api.ServiceConfig
}
func LoadNodeConfig ¶
func LoadNodeConfig(path string) (*NodeConfigComplete, error)
LoadNodeConfig loads the node configuration from the specified path. If the file is missing, it returns an empty initialized config.
type Options ¶
type Options struct {
PrivKey crypto.PrivKey
HubPubKey ed25519.PublicKey
HubAddrs []multiaddr.Multiaddr
Store *Store
MeshID string
DiscoveryInterval string
ListenAddrs []string
EnableRelay bool
NodeConfig *NodeConfigComplete
KeyGracePeriod time.Duration
AllowLoopback bool
MonitorBootstrap time.Duration
MonitorInterval time.Duration
AutoRelayMinInterval time.Duration
AutoRelayBootDelay time.Duration
AutoRelayBackoff time.Duration
// HubConnectTimeout bounds each hub address's dial (connect + stream open).
HubConnectTimeout time.Duration
// DHT Options
DHTProviderAddrTTL time.Duration
DHTMaxRecordAge time.Duration
DHTLookupLimit int
DiscoveryConcurrency int
// RequiredRole restricts enrollment and startup to only accept tokens containing this role.
RequiredRole string
// PolicySyncInterval specifies how often the node syncs the mesh policy from the Hub.
PolicySyncInterval time.Duration
}
Options holds all configuration options for a SamNode.
type PeerRateLimiter ¶
type PeerRateLimiter struct {
// contains filtered or unexported fields
}
PeerRateLimiter tracks rate limits per peer using an LRU cache.
func NewPeerRateLimiter ¶
func NewPeerRateLimiter(size int) (*PeerRateLimiter, error)
NewPeerRateLimiter creates a new PeerRateLimiter with specified cache size.
func (*PeerRateLimiter) Allow ¶
func (prl *PeerRateLimiter) Allow(peerID string) bool
Allow checks if the peer is allowed to perform an action.
type PollMessagesParams ¶
type PollMessagesParams struct {
Topic string `json:"topic" jsonschema:"GossipSub topic name"`
}
PollMessagesParams defines the parameters for the poll_messages tool.
type RefreshError ¶
func (*RefreshError) Error ¶
func (e *RefreshError) Error() string
type RequestContext ¶
type RequestContext struct {
PeerID peer.ID
User string
Group string
Protocol string
Target string
}
RequestContext carries the security metadata for a specific stream request
type RingBufferSink ¶
type RingBufferSink struct {
// contains filtered or unexported fields
}
RingBufferSink implements zap.Sink to capture logs in memory.
type SamNode ¶
type SamNode struct {
Host host.Host
DHT *dht.IpfsDHT
PubSub *pubsub.PubSub
Store *Store
HubPeerID peer.ID
LocalPolicy *NodeConfigComplete
MeshPolicyRules []biscuit.Rule
MeshPolicyMu sync.RWMutex
BoundHTTPAddr string
AllowLoopback bool
BiscuitTimeout time.Duration
// contains filtered or unexported fields
}
func NewSamNode ¶
NewSamNode creates a new Agent instance secured with the 4-layer pipeline. NewSamNode initializes options and structures without starting background tasks or network interfaces.
func (*SamNode) CallMCPTool ¶
func (n *SamNode) CallMCPTool(ctx context.Context, targetPeer peer.ID, toolName string, params any) (*mcp.CallToolResult, error)
CallMCPTool opens a stream to a remote peer, performs the handshake, and calls a tool.
func (*SamNode) ConnectAndAuthWithHub ¶
func (*SamNode) ConnectMCPSession ¶
func (*SamNode) DiscoverEndpoints ¶
func (n *SamNode) DiscoverEndpoints(ctx context.Context, issuerURL string) (tokenURL, authURL string, err error)
DiscoverEndpoints discovers both token and authorization endpoints.
func (*SamNode) DiscoverRemoteServices ¶
func (n *SamNode) DiscoverRemoteServices(ctx context.Context, serviceType api.ServiceType, serviceName string) ([]*api.DiscoveredProvider, error)
DiscoverRemoteServices dispatches to the named or type-only path based on whether serviceName is provided.
func (*SamNode) DiscoverRemoteServicesStream ¶
func (n *SamNode) DiscoverRemoteServicesStream(ctx context.Context, serviceType api.ServiceType, serviceName string) (<-chan *api.DiscoveredProvider, error)
DiscoverRemoteServicesStream performs service discovery and streams results down the returned channel. The channel is closed automatically when discovery completes or the context is cancelled.
func (*SamNode) DiscoverTokenURL ¶
DiscoverTokenURL discovers the token URL from the OIDC issuer.
func (*SamNode) EnrollBootstrap ¶
EnrollBootstrap enrolls the node with the control plane using a pre-shared bootstrap token. If the enrollment status is PENDING, it polls the status endpoint until approved or rejected.
func (*SamNode) FetchJWT ¶
func (n *SamNode) FetchJWT(ctx context.Context, tokenURL, clientID, clientSecret string) (string, error)
FetchJWT fetches a JWT token using the Client Credentials flow.
func (*SamNode) FindProvidersByName ¶
func (n *SamNode) FindProvidersByName(ctx context.Context, serviceType api.ServiceType, serviceName string) ([]peer.AddrInfo, error)
FindProvidersByName returns peers hosting a specific {type, name} service.
func (*SamNode) FindProvidersByType ¶
func (n *SamNode) FindProvidersByType(ctx context.Context, serviceType api.ServiceType) ([]peer.AddrInfo, error)
FindProvidersByType returns peers hosting at least one service of the given type.
func (*SamNode) GetIdentity ¶
GetIdentity returns the node's biscuit identity, caching it in memory.
func (*SamNode) HandleAuthHandshake ¶
HandleAuthHandshake is the core libp2p stream handler for /sam/auth/1.0.0. This is the "Admission Office" of the mesh node.
func (*SamNode) HandleMCPStream ¶
func (n *SamNode) HandleMCPStream(s network.Stream, reqCtx RequestContext)
HandleMCPStream is the libp2p stream handler for the MCP protocol. It routes the authenticated stream to the appropriate backend service, or serves the internal MCP catalog if the TargetService is empty/catalog.
func (*SamNode) InteractiveLogin ¶
func (n *SamNode) InteractiveLogin(ctx context.Context, authURL, tokenURL, clientID, audience string, requestRefresh bool, headless bool) (string, error)
InteractiveLogin prompts the user to go to a URL and enter a code.
func (*SamNode) IsConnected ¶
func (*SamNode) IsServiceRegistered ¶
func (*SamNode) ListLocalServices ¶
func (n *SamNode) ListLocalServices(typeFilter api.ServiceType) []*api.ServiceInfo
ListLocalServices returns services registered on this node. If typeFilter is SERVICE_TYPE_UNSPECIFIED, all services are returned.
func (*SamNode) LoadHubURL ¶
func (*SamNode) RefreshEnrollment ¶
RefreshEnrollment trades the expiring biscuit token for a new one using a cryptographic challenge.
func (*SamNode) RefreshJWT ¶
func (n *SamNode) RefreshJWT(ctx context.Context, tokenURL, clientID, clientSecret, refreshToken string) (string, string, error)
RefreshJWT refreshes the OIDC token using the stored refresh token.
func (*SamNode) RegisterService ¶
func (*SamNode) RegisterStaticServices ¶
func (*SamNode) SaveHubConfig ¶
func (*SamNode) SetIdentityCache ¶
SetIdentityCache explicitly updates the cached identity.
func (*SamNode) Start ¶
Start initializes the libp2p host, DHT, connects to the hub, and starts runtime components.
func (*SamNode) StartIngressServer ¶
func (*SamNode) StartRenewalLoop ¶
func (*SamNode) Teardown ¶
Teardown detaches all registered services and closes the libp2p host. Store is owned by the caller and is not closed here.
func (*SamNode) UnregisterService ¶
func (*SamNode) UpdateRelays ¶
UpdateRelays updates the current relays used by AutoRelay.
func (*SamNode) VerifyBiscuitToken ¶
func (n *SamNode) VerifyBiscuitToken(biscuitBytes []byte, reqCtx RequestContext) error
VerifyBiscuitToken checks revocation, cache, and evaluates the token against trusted keys and local policies.
func (*SamNode) WithBiscuitAuth ¶
func (n *SamNode) WithBiscuitAuth(next func(network.Stream, RequestContext)) network.StreamHandler
WithBiscuitAuth enforces a Protobuf handshake on a stream before calling the next handler.
type SendMessageParams ¶
type SendMessageParams struct {
PeerID string `json:"peer_id" jsonschema:"The Peer ID of the target agent"`
Message string `json:"message" jsonschema:"The message content"`
}
SendMessageParams defines the parameters for the send_message tool.
type Service ¶
type Service interface {
Info() *api.ServiceInfo
Init(ctx context.Context) error
Handler() http.Handler
Teardown() error
}
Service is the contract the ServiceRegistry and ingress server use. Implementations own all type-specific behaviour; the registry stays type-agnostic.
func NewServiceFromRequest ¶
func NewServiceFromRequest(req *api.RegisterServiceRequest) (Service, error)
type ServiceRegistry ¶
type ServiceRegistry struct {
// contains filtered or unexported fields
}
ServiceRegistry is the type-agnostic owner of registered services.
func NewServiceRegistry ¶
func NewServiceRegistry(d dhtProvider) *ServiceRegistry
func (*ServiceRegistry) Get ¶
func (r *ServiceRegistry) Get(name string) (Service, bool)
Get returns the service registered under name, if any.
func (*ServiceRegistry) List ¶
func (r *ServiceRegistry) List(typeFilter api.ServiceType) []*api.ServiceInfo
List returns the ServiceInfo for every registered service, optionally filtered by type. SERVICE_TYPE_UNSPECIFIED means "all types."
func (*ServiceRegistry) Register ¶
func (r *ServiceRegistry) Register(ctx context.Context, svc Service) error
Register initialises a service, advertises it on the DHT, and inserts it into the map. Init runs before Provide so a failed handler-build never briefly advertises an unservable name.
func (*ServiceRegistry) ReprovideAll ¶
func (r *ServiceRegistry) ReprovideAll(ctx context.Context)
ReprovideAll re-provides all registered services to the DHT.
func (*ServiceRegistry) TeardownAll ¶
func (r *ServiceRegistry) TeardownAll()
TeardownAll calls Teardown on every registered service and clears the map. Per-service errors are logged; iteration continues.
func (*ServiceRegistry) Unregister ¶
func (r *ServiceRegistry) Unregister(ctx context.Context, name string) error
Unregister removes the service from the map and calls Teardown. Unknown names are a no-op.
type ServiceRequest ¶
type ServiceRequest struct {
ServiceName string `json:"service_name"`
}
type StdioBridge ¶
type StdioBridge struct {
// contains filtered or unexported fields
}
func (*StdioBridge) Send ¶
func (b *StdioBridge) Send(data []byte) error
Send writes data to the child's stdin, appending a newline.
func (*StdioBridge) ServeHTTP ¶
func (b *StdioBridge) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*StdioBridge) Start ¶
func (b *StdioBridge) Start()
func (*StdioBridge) Subscribe ¶
func (b *StdioBridge) Subscribe() (<-chan string, func())
Subscribe registers a new subscriber channel for stdout lines and returns it along with an idempotent unsubscribe function. Buffered (cap 10); drops on slow consumers match the SSE behaviour in ServeHTTP.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) LoadHubURL ¶
func (*Store) LoadIdentity ¶
func (*Store) LoadIdentityExpiration ¶
func (*Store) LoadRefreshToken ¶
func (*Store) SaveHubURL ¶
func (*Store) SaveIdentity ¶
func (*Store) SaveIdentityExpiration ¶
func (*Store) SaveOIDCConfig ¶
func (*Store) SaveRefreshToken ¶
type StreamTransport ¶
type StreamTransport struct {
// contains filtered or unexported fields
}
StreamTransport implements the mcp.Transport interface for a libp2p stream.
func NewStreamTransport ¶
func NewStreamTransport(s network.Stream) *StreamTransport
NewStreamTransport creates a new StreamTransport for the given stream.
func (*StreamTransport) Connect ¶
func (t *StreamTransport) Connect(ctx context.Context) (mcp.Connection, error)
Connect satisfies the mcp.Transport interface. For a stream, it's already connected.
func (*StreamTransport) Send ¶
func (t *StreamTransport) Send(data []byte) error
Send sends a message over the stream.
func (*StreamTransport) SessionID ¶
func (t *StreamTransport) SessionID() string
SessionID satisfies the mcp.Connection interface.
type SubscribeTopicParams ¶
type SubscribeTopicParams struct {
Topic string `json:"topic" jsonschema:"GossipSub topic name"`
}
SubscribeTopicParams defines the parameters for the subscribe_topic tool.