{"modulePath":"github.com/TeoSlayer/pilotprotocol","version":"v1.10.5","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package runtime\n\nPackage runtime owns the plugin-lifecycle composition root for the daemon binary. Holds the coreapi.ServiceRegistry, constructs the daemon-side adapters that satisfy plugin Deps (Streams, EventBus, Identity, Polo), and registers/starts/stops L11 services.\n\nLives outside pkg/daemon (L7) so daemon stays free of pkg/coreapi (L10) imports — that's T7.1 in docs/architecture/04-EXTRACTION.md. Imports both pkg/daemon and pkg/coreapi (downward edges, allowed).\n\n## Functions\n\n```go\nfunc AsDaemonPolicyManager(pm coreapi.PolicyManager) daemon.PolicyManager\n```\nAsDaemonPolicyManager adapts a coreapi.PolicyManager (returned by plugins/policy.Service.Manager()) to daemon.PolicyManager. The two interfaces have identical method shapes; the adapter does the PolicyRunner element-type conversion on All() and Get().\n\n```go\nfunc NewHandshakeRuntime(d *daemon.Daemon) handshake.Runtime\n```\nNewHandshakeRuntime returns a handshake.Runtime backed by d.\n\n```go\nfunc NewHandshakeServiceAdapter(svc *handshake.Service) daemon.HandshakeService\n```\nNewHandshakeServiceAdapter wraps a \\*handshake.Service so it satisfies daemon.HandshakeService.\n\n```go\nfunc NewPolicyRuntime(d *daemon.Daemon) policy.Runtime\n```\nNewPolicyRuntime returns a policy.Runtime backed by d.\n\n## Types\n\n```go\ntype HandshakeRuntime struct {\n\t// contains filtered or unexported fields\n}\n```\nHandshakeRuntime adapts \\*daemon.Daemon to the handshake.Runtime interface. Lives here (L12 composition root) so plugins/handshake stays free of pkg/daemon.\n\n```go\nfunc (r HandshakeRuntime) DialAndSend(peerNodeID uint32, port uint16, data []byte) error\n```\n\n```go\nfunc (r HandshakeRuntime) HasIdentity() bool\n```\n\n```go\nfunc (r HandshakeRuntime) IdentityPath() string\n```\n\n```go\nfunc (r HandshakeRuntime) IsTrusted(nodeID uint32) (string, bool)\n```\n\n```go\nfunc (r HandshakeRuntime) NodeID() uint32\n```\n\n```go\nfunc (r HandshakeRuntime) PortListener(port uint16) (coreapi.Listener, error)\n```\n\n```go\nfunc (r HandshakeRuntime) PublicKey() ed25519.PublicKey\n```\n\n```go\nfunc (r HandshakeRuntime) PublishEvent(topic string, payload map[string]any)\n```\n\n```go\nfunc (r HandshakeRuntime) Registry() handshake.RegistryClient\n```\n\n```go\nfunc (r HandshakeRuntime) RemoveTunnelPeer(nodeID uint32)\n```\n\n```go\nfunc (r HandshakeRuntime) Sign(msg []byte) []byte\n```\n\n```go\nfunc (r HandshakeRuntime) TrustAutoApprove() bool\n```\n\n```go\ntype PolicyRuntime struct {\n\t// contains filtered or unexported fields\n}\n```\nPolicyRuntime adapts \\*daemon.Daemon to the policy.Runtime interface. Lives here (L12 composition root) so plugins/policy stays free of pkg/daemon.\n\n```go\nfunc (r PolicyRuntime) AdminToken() string\n```\n\n```go\nfunc (r PolicyRuntime) ListNodes(netID uint16, token string) (map[string]any, error)\n```\n\n```go\nfunc (r PolicyRuntime) NodeID() uint32\n```\n\n```go\nfunc (r PolicyRuntime) PublishEvent(topic string, payload map[string]any)\n```\n\n```go\nfunc (r PolicyRuntime) RevokeTrust(nodeID uint32) error\n```\n\n```go\nfunc (r PolicyRuntime) SendHandshakeRequest(nodeID uint32, reason string) error\n```\n\n```go\nfunc (r PolicyRuntime) SetMemberTags(netID uint16, tags []string)\n```\n\n```go\nfunc (r PolicyRuntime) TrustedPeers() []policy.TrustRecord\n```\n\n```go\ntype Runtime struct {\n\t// contains filtered or unexported fields\n}\n```\nRuntime owns the plugin-side glue for a single daemon. cmd/daemon constructs one, registers L11 services, then calls StartPlugins after Daemon.Start (so regConn etc. are wired) and StopPlugins before Daemon.Stop.\n\n```go\nfunc New(d *daemon.Daemon) *Runtime\n```\nNew returns a Runtime bound to the given daemon. Safe to call before d.Start.\n\n```go\nfunc (r *Runtime) Daemon() *daemon.Daemon\n```\nDaemon returns the underlying daemon (test access).\n\n```go\nfunc (r *Runtime) Register(s coreapi.Service) error\n```\nRegister adds a service to the registry. Mirrors the old daemon.RegisterPlugin. Must be called before StartPlugins.\n\n```go\nfunc (r *Runtime) StartPlugins(ctx context.Context) error\n```\nStartPlugins starts every registered service in Order order. Plugins receive a Deps bundle covering Streams, Identity, Events, Trust.\n\n```go\nfunc (r *Runtime) StopPlugins(ctx context.Context) error\n```\nStopPlugins stops every started service in reverse-registration order. Each service has its own Stop ctx (caller-supplied here).\n\n","path":"github.com/TeoSlayer/pilotprotocol/plugins/runtime","name":"runtime","synopsis":"Package runtime owns the plugin-lifecycle composition root for the daemon binary.","isRedistributable":true}
