hermes-mesh 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hermes_mesh-0.1.0/LICENSE +21 -0
- hermes_mesh-0.1.0/PKG-INFO +165 -0
- hermes_mesh-0.1.0/README.md +150 -0
- hermes_mesh-0.1.0/hermes_mesh/__init__.py +167 -0
- hermes_mesh-0.1.0/hermes_mesh/adapter.py +330 -0
- hermes_mesh-0.1.0/hermes_mesh/float.py +71 -0
- hermes_mesh-0.1.0/hermes_mesh/identity.py +206 -0
- hermes_mesh-0.1.0/hermes_mesh/session_relay.py +415 -0
- hermes_mesh-0.1.0/hermes_mesh.egg-info/PKG-INFO +165 -0
- hermes_mesh-0.1.0/hermes_mesh.egg-info/SOURCES.txt +15 -0
- hermes_mesh-0.1.0/hermes_mesh.egg-info/dependency_links.txt +1 -0
- hermes_mesh-0.1.0/hermes_mesh.egg-info/entry_points.txt +2 -0
- hermes_mesh-0.1.0/hermes_mesh.egg-info/requires.txt +3 -0
- hermes_mesh-0.1.0/hermes_mesh.egg-info/top_level.txt +1 -0
- hermes_mesh-0.1.0/pyproject.toml +26 -0
- hermes_mesh-0.1.0/setup.cfg +4 -0
- hermes_mesh-0.1.0/tests/test_mesh.py +369 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Emil Tsoi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hermes-mesh
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Session-aware mesh relay for Hermes fleet agents — wife-to-wife communication, fleet identity, gateway hook float
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/emiltsoi/hermes-mesh
|
|
7
|
+
Project-URL: Repository, https://github.com/emiltsoi/hermes-mesh.git
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: pyyaml>=6.0
|
|
12
|
+
Requires-Dist: aiohttp>=3.9
|
|
13
|
+
Requires-Dist: cryptography>=41.0
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# hermes-mesh
|
|
17
|
+
|
|
18
|
+
**Agent-to-agent session relay for Hermes fleet agents.**
|
|
19
|
+
|
|
20
|
+
Standard A2A is request/response — fine for one-shot jobs, inadequate for
|
|
21
|
+
conversational fleet coordination. `hermes-mesh` adds session-preserving
|
|
22
|
+
communication: when one agent dispatches to another, the recipient knows
|
|
23
|
+
who asked, what they're responding to, and what action to take.
|
|
24
|
+
|
|
25
|
+
## Tools
|
|
26
|
+
|
|
27
|
+
- `mesh_list` — list all agents in the fleet mesh vault.
|
|
28
|
+
- `mesh_register` — register or update an agent identity in the fleet mesh vault.
|
|
29
|
+
- `mesh_send` — send a session-preserving message to another fleet agent.
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Caller: mesh_send(agent="britney", message="Review this plan")
|
|
33
|
+
│
|
|
34
|
+
├─ 1. Resolves Britney's identity from the fleet vault
|
|
35
|
+
├─ 2. Pads [mesh][from:linda][to:britney][id:uuid][action:do][reply:yes]
|
|
36
|
+
├─ 3. HMAC-SHA256 signs with the sender's own secret
|
|
37
|
+
└─ 4. POSTs to Britney's mesh adapter endpoint
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Britney's gateway receives the message on its `mesh` platform adapter,
|
|
41
|
+
routes it into her active session, and she sees it as an inbound mesh
|
|
42
|
+
trigger with full sender context.
|
|
43
|
+
|
|
44
|
+
`mesh_send` returns `{"state": "completed", "status": "delivered", ...}` on
|
|
45
|
+
success, with `message_id` and `task_id` populated.
|
|
46
|
+
|
|
47
|
+
## What it does NOT do
|
|
48
|
+
|
|
49
|
+
This plugin is a **mesh layer**, not a full A2A implementation. Standard A2A
|
|
50
|
+
operations (discover, call, serve, JSON-RPC, Agent Cards) are handled by the
|
|
51
|
+
[hermes-agent-a2a plugin](https://github.com/emiltsoi/hermes-agent-a2a), which
|
|
52
|
+
provides Google A2A 1.0 compliance. The upstream `hermes-agent` core does not
|
|
53
|
+
provide A2A support.
|
|
54
|
+
|
|
55
|
+
## Install
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install hermes-mesh
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or from source:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git clone https://github.com/emiltsoi/hermes-mesh.git
|
|
65
|
+
cd hermes-mesh
|
|
66
|
+
pip install -e .
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Configure
|
|
70
|
+
|
|
71
|
+
### 1. Enable the mesh platform adapter
|
|
72
|
+
|
|
73
|
+
Add `hermes-mesh` to `plugins.enabled` and enable the `mesh` platform in
|
|
74
|
+
`config.yaml`:
|
|
75
|
+
|
|
76
|
+
```yaml
|
|
77
|
+
plugins:
|
|
78
|
+
enabled:
|
|
79
|
+
- hermes-mesh
|
|
80
|
+
|
|
81
|
+
platforms:
|
|
82
|
+
mesh:
|
|
83
|
+
enabled: true
|
|
84
|
+
extra:
|
|
85
|
+
port: 8744
|
|
86
|
+
secret: <mesh-adapter-hmac-secret>
|
|
87
|
+
route: receive # listens on /mesh/receive
|
|
88
|
+
agent_name: agent0 # local agent name
|
|
89
|
+
target_session: "telegram:dm:<chat_id>" # optional session routing
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Each agent's gateway should listen on its own mesh port. The default port
|
|
93
|
+
is `8645`.
|
|
94
|
+
|
|
95
|
+
### 2. Set up fleet identity
|
|
96
|
+
|
|
97
|
+
Each agent needs an identity in `$HERMES_HOME/fleet/mesh/agents/<name>/identity.yaml`
|
|
98
|
+
(legacy `fleet/a2a/agents` is also checked, but `hermes-mesh` targets use the
|
|
99
|
+
mesh adapter URL):
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
id: britney
|
|
103
|
+
name: britney
|
|
104
|
+
description: Principal SWE — Orchestrator
|
|
105
|
+
transports:
|
|
106
|
+
hermes_webhook:
|
|
107
|
+
protocol: hermes-webhook
|
|
108
|
+
url: http://127.0.0.1:8745/mesh/receive
|
|
109
|
+
auth:
|
|
110
|
+
type: hmac-sha256
|
|
111
|
+
secret: <britney-mesh-adapter-secret>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The `hermes_webhook.url` must point at the target agent's mesh adapter
|
|
115
|
+
endpoint (`/mesh/<route>`). The `hermes_webhook.auth.secret` is the
|
|
116
|
+
**target's** adapter secret; messages are signed with the **sender's**
|
|
117
|
+
own secret for per-agent HMAC authentication.
|
|
118
|
+
|
|
119
|
+
### 3. Register local agents
|
|
120
|
+
|
|
121
|
+
You can also register identities at runtime:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
mesh_register(name="britney", url="http://127.0.0.1:8745/mesh/receive", secret="...", role="agent")
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 4. Environment
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
export MESH_AGENT_NAME=linda # Who the sender is
|
|
131
|
+
export MESH_WEBHOOK_DELIVERY_RETRIES=3 # Delivery retry count
|
|
132
|
+
export MESH_WEBHOOK_DELIVERY_BACKOFF=1 # Initial retry backoff in seconds
|
|
133
|
+
export MESH_WEBHOOK_DELIVERY_TIMEOUT=5 # Per-attempt timeout
|
|
134
|
+
export TELEGRAM_BOT_TOKEN=... # For float delivery
|
|
135
|
+
export TELEGRAM_HOME_CHANNEL=... # Where floats go
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
`A2A_*` names (`A2A_AGENT_NAME`, `A2A_WEBHOOK_DELIVERY_RETRIES`, etc.) are
|
|
139
|
+
still accepted as fallbacks for backward compatibility.
|
|
140
|
+
|
|
141
|
+
## CTA Protocol
|
|
142
|
+
|
|
143
|
+
Messages carry a 2D Call To Action in the header:
|
|
144
|
+
|
|
145
|
+
| Field | Values | Meaning |
|
|
146
|
+
|--------|--------|---------|
|
|
147
|
+
| action | `do` | Recipient should take action |
|
|
148
|
+
| | `info` | Informational — acknowledge |
|
|
149
|
+
| reply | `yes` | Sender expects a reply |
|
|
150
|
+
| | `no` | Fire-and-forget |
|
|
151
|
+
|
|
152
|
+
## Relationship to hermes-agent-a2a
|
|
153
|
+
|
|
154
|
+
`hermes-mesh` replaces the mesh functionality of the now-archived `hermes-agent-a2a` plugin.
|
|
155
|
+
Standard A2A (discover, call, serve, Agent Cards, JSON-RPC, security) is
|
|
156
|
+
provided by the [hermes-agent-a2a plugin](https://github.com/emiltsoi/hermes-agent-a2a);
|
|
157
|
+
the upstream `hermes-agent` core does not include A2A support.
|
|
158
|
+
|
|
159
|
+
The old plugin's `a2a_send_session_message` is the genesis of this project —
|
|
160
|
+
a focused, dependency-light extraction of the only unique feature the old
|
|
161
|
+
plugin had that the upstream standard doesn't cover.
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# hermes-mesh
|
|
2
|
+
|
|
3
|
+
**Agent-to-agent session relay for Hermes fleet agents.**
|
|
4
|
+
|
|
5
|
+
Standard A2A is request/response — fine for one-shot jobs, inadequate for
|
|
6
|
+
conversational fleet coordination. `hermes-mesh` adds session-preserving
|
|
7
|
+
communication: when one agent dispatches to another, the recipient knows
|
|
8
|
+
who asked, what they're responding to, and what action to take.
|
|
9
|
+
|
|
10
|
+
## Tools
|
|
11
|
+
|
|
12
|
+
- `mesh_list` — list all agents in the fleet mesh vault.
|
|
13
|
+
- `mesh_register` — register or update an agent identity in the fleet mesh vault.
|
|
14
|
+
- `mesh_send` — send a session-preserving message to another fleet agent.
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
Caller: mesh_send(agent="britney", message="Review this plan")
|
|
18
|
+
│
|
|
19
|
+
├─ 1. Resolves Britney's identity from the fleet vault
|
|
20
|
+
├─ 2. Pads [mesh][from:linda][to:britney][id:uuid][action:do][reply:yes]
|
|
21
|
+
├─ 3. HMAC-SHA256 signs with the sender's own secret
|
|
22
|
+
└─ 4. POSTs to Britney's mesh adapter endpoint
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Britney's gateway receives the message on its `mesh` platform adapter,
|
|
26
|
+
routes it into her active session, and she sees it as an inbound mesh
|
|
27
|
+
trigger with full sender context.
|
|
28
|
+
|
|
29
|
+
`mesh_send` returns `{"state": "completed", "status": "delivered", ...}` on
|
|
30
|
+
success, with `message_id` and `task_id` populated.
|
|
31
|
+
|
|
32
|
+
## What it does NOT do
|
|
33
|
+
|
|
34
|
+
This plugin is a **mesh layer**, not a full A2A implementation. Standard A2A
|
|
35
|
+
operations (discover, call, serve, JSON-RPC, Agent Cards) are handled by the
|
|
36
|
+
[hermes-agent-a2a plugin](https://github.com/emiltsoi/hermes-agent-a2a), which
|
|
37
|
+
provides Google A2A 1.0 compliance. The upstream `hermes-agent` core does not
|
|
38
|
+
provide A2A support.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install hermes-mesh
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or from source:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
git clone https://github.com/emiltsoi/hermes-mesh.git
|
|
50
|
+
cd hermes-mesh
|
|
51
|
+
pip install -e .
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Configure
|
|
55
|
+
|
|
56
|
+
### 1. Enable the mesh platform adapter
|
|
57
|
+
|
|
58
|
+
Add `hermes-mesh` to `plugins.enabled` and enable the `mesh` platform in
|
|
59
|
+
`config.yaml`:
|
|
60
|
+
|
|
61
|
+
```yaml
|
|
62
|
+
plugins:
|
|
63
|
+
enabled:
|
|
64
|
+
- hermes-mesh
|
|
65
|
+
|
|
66
|
+
platforms:
|
|
67
|
+
mesh:
|
|
68
|
+
enabled: true
|
|
69
|
+
extra:
|
|
70
|
+
port: 8744
|
|
71
|
+
secret: <mesh-adapter-hmac-secret>
|
|
72
|
+
route: receive # listens on /mesh/receive
|
|
73
|
+
agent_name: agent0 # local agent name
|
|
74
|
+
target_session: "telegram:dm:<chat_id>" # optional session routing
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Each agent's gateway should listen on its own mesh port. The default port
|
|
78
|
+
is `8645`.
|
|
79
|
+
|
|
80
|
+
### 2. Set up fleet identity
|
|
81
|
+
|
|
82
|
+
Each agent needs an identity in `$HERMES_HOME/fleet/mesh/agents/<name>/identity.yaml`
|
|
83
|
+
(legacy `fleet/a2a/agents` is also checked, but `hermes-mesh` targets use the
|
|
84
|
+
mesh adapter URL):
|
|
85
|
+
|
|
86
|
+
```yaml
|
|
87
|
+
id: britney
|
|
88
|
+
name: britney
|
|
89
|
+
description: Principal SWE — Orchestrator
|
|
90
|
+
transports:
|
|
91
|
+
hermes_webhook:
|
|
92
|
+
protocol: hermes-webhook
|
|
93
|
+
url: http://127.0.0.1:8745/mesh/receive
|
|
94
|
+
auth:
|
|
95
|
+
type: hmac-sha256
|
|
96
|
+
secret: <britney-mesh-adapter-secret>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The `hermes_webhook.url` must point at the target agent's mesh adapter
|
|
100
|
+
endpoint (`/mesh/<route>`). The `hermes_webhook.auth.secret` is the
|
|
101
|
+
**target's** adapter secret; messages are signed with the **sender's**
|
|
102
|
+
own secret for per-agent HMAC authentication.
|
|
103
|
+
|
|
104
|
+
### 3. Register local agents
|
|
105
|
+
|
|
106
|
+
You can also register identities at runtime:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
mesh_register(name="britney", url="http://127.0.0.1:8745/mesh/receive", secret="...", role="agent")
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 4. Environment
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
export MESH_AGENT_NAME=linda # Who the sender is
|
|
116
|
+
export MESH_WEBHOOK_DELIVERY_RETRIES=3 # Delivery retry count
|
|
117
|
+
export MESH_WEBHOOK_DELIVERY_BACKOFF=1 # Initial retry backoff in seconds
|
|
118
|
+
export MESH_WEBHOOK_DELIVERY_TIMEOUT=5 # Per-attempt timeout
|
|
119
|
+
export TELEGRAM_BOT_TOKEN=... # For float delivery
|
|
120
|
+
export TELEGRAM_HOME_CHANNEL=... # Where floats go
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`A2A_*` names (`A2A_AGENT_NAME`, `A2A_WEBHOOK_DELIVERY_RETRIES`, etc.) are
|
|
124
|
+
still accepted as fallbacks for backward compatibility.
|
|
125
|
+
|
|
126
|
+
## CTA Protocol
|
|
127
|
+
|
|
128
|
+
Messages carry a 2D Call To Action in the header:
|
|
129
|
+
|
|
130
|
+
| Field | Values | Meaning |
|
|
131
|
+
|--------|--------|---------|
|
|
132
|
+
| action | `do` | Recipient should take action |
|
|
133
|
+
| | `info` | Informational — acknowledge |
|
|
134
|
+
| reply | `yes` | Sender expects a reply |
|
|
135
|
+
| | `no` | Fire-and-forget |
|
|
136
|
+
|
|
137
|
+
## Relationship to hermes-agent-a2a
|
|
138
|
+
|
|
139
|
+
`hermes-mesh` replaces the mesh functionality of the now-archived `hermes-agent-a2a` plugin.
|
|
140
|
+
Standard A2A (discover, call, serve, Agent Cards, JSON-RPC, security) is
|
|
141
|
+
provided by the [hermes-agent-a2a plugin](https://github.com/emiltsoi/hermes-agent-a2a);
|
|
142
|
+
the upstream `hermes-agent` core does not include A2A support.
|
|
143
|
+
|
|
144
|
+
The old plugin's `a2a_send_session_message` is the genesis of this project —
|
|
145
|
+
a focused, dependency-light extraction of the only unique feature the old
|
|
146
|
+
plugin had that the upstream standard doesn't cover.
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"""Hermes Mesh — session-aware fleet relay plugin.
|
|
2
|
+
|
|
3
|
+
Registers tools: mesh_list, mesh_register, mesh_send.
|
|
4
|
+
Does NOT re-implement standard A2A — delegates to the upstream
|
|
5
|
+
Hermes A2A platform adapter for discover/call/serve.
|
|
6
|
+
"""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
import logging
|
|
11
|
+
|
|
12
|
+
logger = logging.getLogger(__name__)
|
|
13
|
+
|
|
14
|
+
__all__ = ["register"]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def check_requirements() -> bool:
|
|
18
|
+
"""Mesh depends on Hermes core — always loadable."""
|
|
19
|
+
return True
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def validate_config(config) -> bool:
|
|
23
|
+
"""No required config — everything is env-var or vault-driven."""
|
|
24
|
+
return True
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _serialize_dict_handler(handler):
|
|
28
|
+
"""Wrap a handler that returns a dict so the tool registry sees a JSON string."""
|
|
29
|
+
def wrapper(*args, **kwargs):
|
|
30
|
+
result = handler(*args, **kwargs)
|
|
31
|
+
if isinstance(result, dict):
|
|
32
|
+
return json.dumps(result)
|
|
33
|
+
return result
|
|
34
|
+
return wrapper
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def register(ctx) -> None:
|
|
38
|
+
"""Register the mesh_send tool with Hermes."""
|
|
39
|
+
try:
|
|
40
|
+
from .session_relay import handle_mesh_list, handle_mesh_register, handle_mesh_send
|
|
41
|
+
|
|
42
|
+
ctx.register_tool(
|
|
43
|
+
name="mesh_list",
|
|
44
|
+
toolset="mesh",
|
|
45
|
+
schema={
|
|
46
|
+
"name": "mesh_list",
|
|
47
|
+
"description": "List all agents registered in the fleet mesh vault.",
|
|
48
|
+
"parameters": {
|
|
49
|
+
"type": "object",
|
|
50
|
+
"properties": {},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
handler=_serialize_dict_handler(handle_mesh_list),
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
ctx.register_tool(
|
|
57
|
+
name="mesh_register",
|
|
58
|
+
toolset="mesh",
|
|
59
|
+
schema={
|
|
60
|
+
"name": "mesh_register",
|
|
61
|
+
"description": (
|
|
62
|
+
"Register or update an agent identity in the fleet mesh vault. "
|
|
63
|
+
"Requires name, url, and secret."
|
|
64
|
+
),
|
|
65
|
+
"parameters": {
|
|
66
|
+
"type": "object",
|
|
67
|
+
"properties": {
|
|
68
|
+
"name": {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"description": "Agent name (defaults to MESH_AGENT_NAME env var)",
|
|
71
|
+
},
|
|
72
|
+
"url": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"description": "Hermes webhook URL for this agent",
|
|
75
|
+
},
|
|
76
|
+
"secret": {
|
|
77
|
+
"type": "string",
|
|
78
|
+
"description": "Shared HMAC secret for this agent",
|
|
79
|
+
},
|
|
80
|
+
"role": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"description": "Role description",
|
|
83
|
+
"default": "agent",
|
|
84
|
+
},
|
|
85
|
+
"description": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"description": "Human-readable agent description",
|
|
88
|
+
"default": "",
|
|
89
|
+
},
|
|
90
|
+
"overwrite": {
|
|
91
|
+
"type": "boolean",
|
|
92
|
+
"description": "Overwrite existing identity",
|
|
93
|
+
"default": False,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
"required": ["url", "secret"],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
handler=_serialize_dict_handler(handle_mesh_register),
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
ctx.register_tool(
|
|
103
|
+
name="mesh_send",
|
|
104
|
+
toolset="mesh",
|
|
105
|
+
schema={
|
|
106
|
+
"name": "mesh_send",
|
|
107
|
+
"description": (
|
|
108
|
+
"Send a one-way message through a target Hermes gateway into "
|
|
109
|
+
"its configured platform session context. Auto-pads "
|
|
110
|
+
"[mesh][from:<self>][to:<agent>][id:<uuid>][action:<action>]"
|
|
111
|
+
"[reply:<reply>] header. Returns delivery status."
|
|
112
|
+
),
|
|
113
|
+
"parameters": {
|
|
114
|
+
"type": "object",
|
|
115
|
+
"properties": {
|
|
116
|
+
"message": {
|
|
117
|
+
"type": "string",
|
|
118
|
+
"description": "The message body to send (header is auto-padded)",
|
|
119
|
+
},
|
|
120
|
+
"agent": {
|
|
121
|
+
"type": "string",
|
|
122
|
+
"description": "Name of the target Hermes mesh peer (e.g. daji, yoyo)",
|
|
123
|
+
},
|
|
124
|
+
"action": {
|
|
125
|
+
"type": "string",
|
|
126
|
+
"enum": ["do", "info"],
|
|
127
|
+
"description": "do (recipient should take action) | info (log/acknowledge)",
|
|
128
|
+
"default": "do",
|
|
129
|
+
},
|
|
130
|
+
"reply": {
|
|
131
|
+
"type": "string",
|
|
132
|
+
"enum": ["yes", "no"],
|
|
133
|
+
"description": "yes (sender expects reply) | no (fire-and-forget)",
|
|
134
|
+
"default": "yes",
|
|
135
|
+
},
|
|
136
|
+
"ref": {
|
|
137
|
+
"type": "string",
|
|
138
|
+
"description": "Optional message ID being replied to (for threading)",
|
|
139
|
+
},
|
|
140
|
+
"task_id": {
|
|
141
|
+
"type": "string",
|
|
142
|
+
"description": "Optional task ID override (auto-generated if omitted)",
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
"required": ["message", "agent"],
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
handler=_serialize_dict_handler(handle_mesh_send),
|
|
149
|
+
)
|
|
150
|
+
logger.info("Hermes Mesh: registered mesh tools")
|
|
151
|
+
except Exception:
|
|
152
|
+
logger.warning("Hermes Mesh: failed to register tool", exc_info=True)
|
|
153
|
+
|
|
154
|
+
try:
|
|
155
|
+
from .adapter import MeshAdapter, check_mesh_requirements
|
|
156
|
+
|
|
157
|
+
ctx.register_platform(
|
|
158
|
+
name="mesh",
|
|
159
|
+
label="Hermes Mesh",
|
|
160
|
+
adapter_factory=lambda cfg: MeshAdapter(cfg),
|
|
161
|
+
check_fn=check_mesh_requirements,
|
|
162
|
+
validate_config=validate_config,
|
|
163
|
+
emoji="🕸️",
|
|
164
|
+
)
|
|
165
|
+
logger.info("Hermes Mesh: registered mesh platform adapter")
|
|
166
|
+
except Exception:
|
|
167
|
+
logger.warning("Hermes Mesh: failed to register platform adapter", exc_info=True)
|