1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
"""``net`` — Net mesh integration for Hermes (``HERMES_INTEGRATION_PLAN.md``
Phase 1).
A first-party, standalone plugin that lets a Hermes agent reach capabilities
running on the user's *other* machines — the ones published there with
``net wrap`` — as ``net_*`` tools, with local consent + pin approval. It
embeds a first-class Net node in-process via ``net-mesh-sdk`` (no daemon, no MCP
shim); the node joins the mesh, and the tools drive the SDK's consent-gated
``AsyncCapabilityGateway`` and the machine-shared pin store.
Doctrine: the plugin sees only neutral capability shapes — no MCP awareness
(H-anti-goals). All consent / validation / pin logic lives once in the Rust SDK
(H2); this plugin is a thin, public-API-only view over it (H6).
Enable it by adding ``net`` to ``plugins.enabled`` in your Hermes config, then
set ``NET_MESH_PSK`` (and ``NET_MESH_PEERS``) to join your mesh — see
``node.py`` for the environment configuration.
"""
# `delegation` / `renewal` / `provider` / `federate` / `a2a` are imported for
# package-attribute access (tests, and the node's lazy imports); the node owns
# their lifecycle.
=
=
=
=
=
=
# The running pin-promotion subscription (Phase 2), if started. Held so the
# session-end hook can stop it.
: = None
# The running local-tool publication (V2 Phase 2, provider side), if started —
# this Hermes's OWN tools announced to the mesh. Opt-in; held so the session-end
# hook can withdraw it.
: = None
# The running tool-federation service (V2 Phase 2, consumer side), if started —
# surfaces discovered mesh capabilities as machine-namespaced first-class tools.
# Opt-in; held so the session-end hook can stop it.
: = None
# The running A2A executor service (V2 Phase 3), if started — accepts
# hand-off tasks from sibling in-root agents and runs them through the host
# agent loop. Opt-in; held so the session-end hook can stop it.
: = None
return in
"""Whether to announce this Hermes's OWN local tools to the mesh. Opt-in —
exposing a machine's toolset to the operator mesh must be deliberate, so it
is off unless ``NET_MESH_PUBLISH_LOCAL_TOOLS`` is truthy."""
return
"""Whether to auto-surface discovered mesh capabilities as first-class tools.
Opt-in via ``NET_MESH_FEDERATE_TOOLS`` — a federation-heavy mesh can add many
tools, so a deployment turns it on deliberately."""
return
"""Whether this Hermes accepts hand-off tasks from sibling agents. Opt-in via
``NET_MESH_A2A_EXECUTOR`` — running other agents' work must be deliberate.
(The requester-side ``net_a2a_*`` tools are always available.)"""
return
"""Start the pin-promotion subscription (Phase 2) for this session. Promotes
approved pins to first-class tools, driven by the SDK's pin-change
subscription. Best-effort and idempotent — a failure here must never break a
session; the meta-tools stand on their own."""
global , , ,
=
# noqa: BLE001 — a session must not fail on this
# Provider side (opt-in): announce this Hermes's OWN local tools to the mesh,
# so a sibling machine can invoke them (dangerous ones gated by the
# provider's approval flow). Best-effort — a publish failure must never break
# a session; the consume/enroll features stand on their own.
=
# noqa: BLE001 — a session must not fail on this
# Consumer side (opt-in): auto-surface discovered mesh capabilities as
# machine-namespaced first-class tools. Best-effort — a discovery failure
# must never break a session; the meta-tools still reach the mesh.
=
# noqa: BLE001 — a session must not fail on this
# A2A executor side (opt-in): accept hand-off tasks from sibling agents and
# run them through the host agent loop. Best-effort — a failure must never
# break a session; the requester-side net_a2a_* tools stand on their own.
=
# noqa: BLE001 — a session must not fail on this
"""Best-effort teardown when the session ends. Idempotent; swallows errors
so session end never fails on cleanup — and each step is guarded
individually, so one service's failing ``stop()`` can't skip the rest of
the teardown (which would leak the mesh node, the silent-renewal daemon
thread, and the served RPC handles)."""
global , , ,
=
= = = = None
continue
# noqa: BLE001 — teardown must not fail session end
# noqa: BLE001 — teardown must not fail session end
"""Register the ``net_*`` mesh tools + the session lifecycle hooks.
Called once by the plugin loader when ``net`` is in ``plugins.enabled``.
Every tool shares ``check_fn`` = local node/SDK health (never "peers
visible"), so a healthy-but-isolated node keeps its tools; only an
SDK/node failure removes them at the next tools-assembly boundary. The
pin-promotion subscription starts per-session (``on_session_start``), so
plugin load itself stays a pure, side-effect-free wiring step.
"""