@dp-pcs/ogp 0.2.0
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.
- package/README.md +437 -0
- package/dist/cli/agent-comms.d.ts +55 -0
- package/dist/cli/agent-comms.d.ts.map +1 -0
- package/dist/cli/agent-comms.js +217 -0
- package/dist/cli/agent-comms.js.map +1 -0
- package/dist/cli/expose.d.ts +3 -0
- package/dist/cli/expose.d.ts.map +1 -0
- package/dist/cli/expose.js +104 -0
- package/dist/cli/expose.js.map +1 -0
- package/dist/cli/federation.d.ts +28 -0
- package/dist/cli/federation.d.ts.map +1 -0
- package/dist/cli/federation.js +409 -0
- package/dist/cli/federation.js.map +1 -0
- package/dist/cli/install.d.ts +3 -0
- package/dist/cli/install.d.ts.map +1 -0
- package/dist/cli/install.js +111 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/cli/setup.d.ts +2 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +33 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +305 -0
- package/dist/cli.js.map +1 -0
- package/dist/daemon/agent-comms.d.ts +76 -0
- package/dist/daemon/agent-comms.d.ts.map +1 -0
- package/dist/daemon/agent-comms.js +188 -0
- package/dist/daemon/agent-comms.js.map +1 -0
- package/dist/daemon/doorman.d.ts +52 -0
- package/dist/daemon/doorman.d.ts.map +1 -0
- package/dist/daemon/doorman.js +203 -0
- package/dist/daemon/doorman.js.map +1 -0
- package/dist/daemon/intent-registry.d.ts +11 -0
- package/dist/daemon/intent-registry.d.ts.map +1 -0
- package/dist/daemon/intent-registry.js +101 -0
- package/dist/daemon/intent-registry.js.map +1 -0
- package/dist/daemon/keypair.d.ts +5 -0
- package/dist/daemon/keypair.d.ts.map +1 -0
- package/dist/daemon/keypair.js +25 -0
- package/dist/daemon/keypair.js.map +1 -0
- package/dist/daemon/message-handler.d.ts +20 -0
- package/dist/daemon/message-handler.d.ts.map +1 -0
- package/dist/daemon/message-handler.js +159 -0
- package/dist/daemon/message-handler.js.map +1 -0
- package/dist/daemon/notify.d.ts +7 -0
- package/dist/daemon/notify.d.ts.map +1 -0
- package/dist/daemon/notify.js +54 -0
- package/dist/daemon/notify.js.map +1 -0
- package/dist/daemon/peers.d.ts +66 -0
- package/dist/daemon/peers.d.ts.map +1 -0
- package/dist/daemon/peers.js +171 -0
- package/dist/daemon/peers.js.map +1 -0
- package/dist/daemon/reply-handler.d.ts +67 -0
- package/dist/daemon/reply-handler.d.ts.map +1 -0
- package/dist/daemon/reply-handler.js +176 -0
- package/dist/daemon/reply-handler.js.map +1 -0
- package/dist/daemon/scopes.d.ts +62 -0
- package/dist/daemon/scopes.d.ts.map +1 -0
- package/dist/daemon/scopes.js +113 -0
- package/dist/daemon/scopes.js.map +1 -0
- package/dist/daemon/server.d.ts +8 -0
- package/dist/daemon/server.d.ts.map +1 -0
- package/dist/daemon/server.js +286 -0
- package/dist/daemon/server.js.map +1 -0
- package/dist/shared/config.d.ts +42 -0
- package/dist/shared/config.d.ts.map +1 -0
- package/dist/shared/config.js +42 -0
- package/dist/shared/config.js.map +1 -0
- package/dist/shared/signing.d.ts +13 -0
- package/dist/shared/signing.d.ts.map +1 -0
- package/dist/shared/signing.js +46 -0
- package/dist/shared/signing.js.map +1 -0
- package/docs/agent-comms.md +277 -0
- package/docs/federation-flow.md +407 -0
- package/docs/quickstart.md +241 -0
- package/docs/scopes.md +198 -0
- package/package.json +57 -0
- package/scripts/install-skills.js +32 -0
- package/skills/ogp/SKILL.md +235 -0
- package/skills/ogp-agent-comms/SKILL.md +345 -0
- package/skills/ogp-expose/SKILL.md +281 -0
package/README.md
ADDED
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
# @dp-pcs/ogp
|
|
2
|
+
|
|
3
|
+
> Open Gateway Protocol (OGP) - Federation for OpenClaw AI Gateways
|
|
4
|
+
|
|
5
|
+
OGP enables peer-to-peer federation between OpenClaw instances, allowing AI agents to communicate and collaborate across different deployments. Think of it as email for AI agents - each OpenClaw instance can securely send and receive messages from other instances without any central authority.
|
|
6
|
+
|
|
7
|
+
## What This Package Does
|
|
8
|
+
|
|
9
|
+
This is a companion daemon that adds federation capabilities to any standard OpenClaw installation. It runs alongside your OpenClaw instance on a separate port and handles:
|
|
10
|
+
|
|
11
|
+
- Cryptographically signed peer-to-peer messaging using Ed25519
|
|
12
|
+
- Peer relationship management (request, approve, reject)
|
|
13
|
+
- Message verification and relay to your OpenClaw agent
|
|
14
|
+
- Public tunnel support (cloudflared/ngrok) for internet accessibility
|
|
15
|
+
- Optional macOS LaunchAgent for automatic startup
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
- **Node.js 18 or higher**
|
|
20
|
+
- **OpenClaw installed and running** - Get it at [https://openclaw.ai](https://openclaw.ai)
|
|
21
|
+
- **OpenClaw API token** - Generated during OpenClaw setup
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install -g github:dp-pcs/ogp
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
After installation, install the OGP skills for Claude Code:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
ogp-install-skills
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
### 1. Setup
|
|
38
|
+
|
|
39
|
+
Run the interactive setup wizard:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
ogp setup
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
You'll be prompted for:
|
|
46
|
+
- Daemon port (default: 18790)
|
|
47
|
+
- OpenClaw URL (default: http://localhost:18789)
|
|
48
|
+
- OpenClaw API token
|
|
49
|
+
- Your public gateway URL (can update later)
|
|
50
|
+
- Display name and email
|
|
51
|
+
|
|
52
|
+
### 2. Start the Daemon
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
ogp start
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or run in the background:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
ogp start --background
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 3. Expose to the Internet
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
ogp expose
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This starts a cloudflared tunnel and displays your public URL. Copy this URL and update your configuration:
|
|
71
|
+
|
|
72
|
+
1. Stop the daemon: `ogp stop`
|
|
73
|
+
2. Edit `~/.ogp/config.json` and update `"gatewayUrl"` with your tunnel URL
|
|
74
|
+
3. Restart: `ogp start --background`
|
|
75
|
+
4. Optionally run tunnel in background: `ogp expose --background`
|
|
76
|
+
|
|
77
|
+
### 4. Share Your URL
|
|
78
|
+
|
|
79
|
+
Share your gateway URL with peers who want to federate with you. They can discover your public key at:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
https://your-tunnel-url.com/.well-known/ogp
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## All Commands
|
|
86
|
+
|
|
87
|
+
### Daemon Management
|
|
88
|
+
|
|
89
|
+
| Command | Description |
|
|
90
|
+
|---------|-------------|
|
|
91
|
+
| `ogp setup` | Interactive setup wizard |
|
|
92
|
+
| `ogp start` | Start daemon in foreground |
|
|
93
|
+
| `ogp start --background` | Start daemon as background process |
|
|
94
|
+
| `ogp stop` | Stop the daemon |
|
|
95
|
+
| `ogp status` | Show daemon status and configuration |
|
|
96
|
+
|
|
97
|
+
### Tunnel Management
|
|
98
|
+
|
|
99
|
+
| Command | Description |
|
|
100
|
+
|---------|-------------|
|
|
101
|
+
| `ogp expose` | Start cloudflared tunnel in foreground |
|
|
102
|
+
| `ogp expose --background` | Run tunnel as background process |
|
|
103
|
+
| `ogp expose --provider ngrok` | Use ngrok instead of cloudflared |
|
|
104
|
+
| `ogp expose stop` | Stop the tunnel |
|
|
105
|
+
|
|
106
|
+
### System Integration (macOS)
|
|
107
|
+
|
|
108
|
+
| Command | Description |
|
|
109
|
+
|---------|-------------|
|
|
110
|
+
| `ogp install` | Install LaunchAgent for auto-start on login |
|
|
111
|
+
| `ogp uninstall` | Remove LaunchAgent |
|
|
112
|
+
|
|
113
|
+
### Federation Management
|
|
114
|
+
|
|
115
|
+
| Command | Description |
|
|
116
|
+
|---------|-------------|
|
|
117
|
+
| `ogp federation list` | List all peers |
|
|
118
|
+
| `ogp federation list --status pending` | List pending federation requests |
|
|
119
|
+
| `ogp federation list --status approved` | List approved peers |
|
|
120
|
+
| `ogp federation request <url> <peer-id>` | Request federation with a peer |
|
|
121
|
+
| `ogp federation approve <peer-id>` | Approve a federation request |
|
|
122
|
+
| `ogp federation reject <peer-id>` | Reject a federation request |
|
|
123
|
+
| `ogp federation send <peer-id> <intent> <json>` | Send a message to an approved peer |
|
|
124
|
+
| `ogp federation scopes <peer-id>` | Show scope grants for a peer |
|
|
125
|
+
| `ogp federation grant <peer-id> [options]` | Update scope grants for a peer |
|
|
126
|
+
| `ogp federation agent <peer-id> <topic> <message>` | Send agent-comms message |
|
|
127
|
+
|
|
128
|
+
### Scope Options (v0.2.0)
|
|
129
|
+
|
|
130
|
+
When approving or granting scopes:
|
|
131
|
+
- `--intents <list>` - Comma-separated intents (e.g., `message,agent-comms`)
|
|
132
|
+
- `--rate <limit>` - Rate limit as requests/seconds (e.g., `100/3600`)
|
|
133
|
+
- `--topics <list>` - Topics for agent-comms (e.g., `memory-management,task-delegation`)
|
|
134
|
+
|
|
135
|
+
### Federation Examples
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# Request federation with another OGP instance
|
|
139
|
+
ogp federation request https://peer.example.com peer-alice
|
|
140
|
+
|
|
141
|
+
# Check pending requests
|
|
142
|
+
ogp federation list --status pending
|
|
143
|
+
|
|
144
|
+
# Approve a peer (v0.1 mode - no scope restrictions)
|
|
145
|
+
ogp federation approve peer-alice
|
|
146
|
+
|
|
147
|
+
# Approve with scope grants (v0.2.0)
|
|
148
|
+
ogp federation approve peer-alice \
|
|
149
|
+
--intents message,agent-comms \
|
|
150
|
+
--rate 100/3600 \
|
|
151
|
+
--topics memory-management,task-delegation
|
|
152
|
+
|
|
153
|
+
# View peer scopes
|
|
154
|
+
ogp federation scopes peer-alice
|
|
155
|
+
|
|
156
|
+
# Update grants for an existing peer
|
|
157
|
+
ogp federation grant peer-alice \
|
|
158
|
+
--intents agent-comms \
|
|
159
|
+
--topics project-planning
|
|
160
|
+
|
|
161
|
+
# Send a simple message
|
|
162
|
+
ogp federation send peer-alice message '{"text":"Hello!"}'
|
|
163
|
+
|
|
164
|
+
# Send agent-comms (v0.2.0)
|
|
165
|
+
ogp federation agent peer-alice memory-management "How do you persist context?"
|
|
166
|
+
|
|
167
|
+
# Send agent-comms with priority
|
|
168
|
+
ogp federation agent peer-alice task-delegation "Schedule standup" --priority high
|
|
169
|
+
|
|
170
|
+
# Send agent-comms and wait for reply
|
|
171
|
+
ogp federation agent peer-alice queries "What's the status?" --wait --timeout 60000
|
|
172
|
+
|
|
173
|
+
# Send a task request
|
|
174
|
+
ogp federation send peer-alice task-request '{
|
|
175
|
+
"taskType": "analysis",
|
|
176
|
+
"description": "Analyze recent logs"
|
|
177
|
+
}'
|
|
178
|
+
|
|
179
|
+
# Send a status update
|
|
180
|
+
ogp federation send peer-alice status-update '{
|
|
181
|
+
"status": "completed",
|
|
182
|
+
"message": "Task finished"
|
|
183
|
+
}'
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## How Federation Works
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
|
|
190
|
+
│ OpenClaw │◄────────│ OGP Daemon │◄────────│ Remote │
|
|
191
|
+
│ :18789 │ webhook│ :18790 │ signed │ Peer │
|
|
192
|
+
│ │ │ │ message│ (OGP) │
|
|
193
|
+
└─────────────┘ └──────────────┘ └─────────────┘
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
1. **Discovery**: Peers discover each other via `/.well-known/ogp` endpoint
|
|
197
|
+
2. **Request**: Alice requests federation with Bob's OGP instance
|
|
198
|
+
3. **Approval**: Bob approves (or rejects) the federation request
|
|
199
|
+
4. **Messaging**: Approved peers can send cryptographically signed messages
|
|
200
|
+
5. **Verification**: Recipient OGP daemon verifies signatures using sender's public key
|
|
201
|
+
6. **Relay**: Valid messages are forwarded to the local OpenClaw agent via webhook
|
|
202
|
+
|
|
203
|
+
All messages are signed with Ed25519 cryptographic signatures to prevent tampering and impersonation.
|
|
204
|
+
|
|
205
|
+
### Message Format
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
{
|
|
209
|
+
"message": {
|
|
210
|
+
"intent": "message",
|
|
211
|
+
"from": "peer-alice",
|
|
212
|
+
"to": "peer-bob",
|
|
213
|
+
"nonce": "550e8400-e29b-41d4-a716-446655440000",
|
|
214
|
+
"timestamp": "2026-03-19T10:30:00Z",
|
|
215
|
+
"payload": {
|
|
216
|
+
"text": "Hello, Bob!"
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
"signature": "a1b2c3d4..."
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Default Intents
|
|
224
|
+
|
|
225
|
+
- **message**: Simple text message
|
|
226
|
+
- **task-request**: Request peer to perform a task
|
|
227
|
+
- **status-update**: Status update from a peer
|
|
228
|
+
- **agent-comms**: Agent-to-agent communication with topic routing (v0.2.0)
|
|
229
|
+
|
|
230
|
+
Custom intents can be added by editing `~/.ogp/intents.json`.
|
|
231
|
+
|
|
232
|
+
## Scope Negotiation (v0.2.0)
|
|
233
|
+
|
|
234
|
+
OGP v0.2.0 introduces a three-layer scope model based on BGP-style per-peer policies:
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
Layer 1: Gateway Capabilities → What I CAN support (advertised globally)
|
|
238
|
+
Layer 2: Peer Negotiation → What I WILL grant YOU (per-peer, during approval)
|
|
239
|
+
Layer 3: Runtime Enforcement → Is THIS request within YOUR granted scope (doorman)
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### How It Works
|
|
243
|
+
|
|
244
|
+
1. **Discovery**: Peers discover each other's capabilities via `/.well-known/ogp`
|
|
245
|
+
2. **Request**: Peer A requests federation with Peer B
|
|
246
|
+
3. **Grant**: Peer B approves with specific scope grants (intents, rate limits, topics)
|
|
247
|
+
4. **Enforcement**: The doorman validates every incoming message against granted scopes
|
|
248
|
+
|
|
249
|
+
### Example: David ↔ Stan Federation
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
# David approves Stan with agent-comms for memory-management topics only
|
|
253
|
+
ogp federation approve stan \
|
|
254
|
+
--intents agent-comms \
|
|
255
|
+
--topics memory-management \
|
|
256
|
+
--rate 10/60
|
|
257
|
+
|
|
258
|
+
# Stan can now send:
|
|
259
|
+
ogp federation agent david memory-management "How do you persist context?" # ✓
|
|
260
|
+
|
|
261
|
+
# But NOT:
|
|
262
|
+
ogp federation agent david personal-finances "What's your budget?" # ✗ Topic not allowed
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Backward Compatibility
|
|
266
|
+
|
|
267
|
+
- v0.1 peers work without scope negotiation (default rate limits apply)
|
|
268
|
+
- v0.2 gateways automatically detect protocol version
|
|
269
|
+
- No breaking changes - existing federations continue working
|
|
270
|
+
|
|
271
|
+
## Agent-Comms Response Policies
|
|
272
|
+
|
|
273
|
+
Control how your agent responds to incoming agent-comms messages with per-peer policies.
|
|
274
|
+
|
|
275
|
+
### Response Levels
|
|
276
|
+
|
|
277
|
+
| Level | Behavior |
|
|
278
|
+
|-------|----------|
|
|
279
|
+
| `full` | Respond openly, share details |
|
|
280
|
+
| `summary` | High-level responses only |
|
|
281
|
+
| `escalate` | Ask human before responding |
|
|
282
|
+
| `deny` | Politely decline to discuss |
|
|
283
|
+
|
|
284
|
+
### Policy Commands
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
# View all policies
|
|
288
|
+
ogp agent-comms policies
|
|
289
|
+
|
|
290
|
+
# View policies for a specific peer
|
|
291
|
+
ogp agent-comms policies stan
|
|
292
|
+
|
|
293
|
+
# Configure global defaults
|
|
294
|
+
ogp agent-comms configure --global --topics "general,testing" --level summary
|
|
295
|
+
|
|
296
|
+
# Configure specific peer(s)
|
|
297
|
+
ogp agent-comms configure stan --topics "memory-management" --level full --notes "Trusted"
|
|
298
|
+
ogp agent-comms configure stan,leo,alice --topics "testing" --level full # Multi-select
|
|
299
|
+
|
|
300
|
+
# Add/remove topics
|
|
301
|
+
ogp agent-comms add-topic stan calendar --level escalate
|
|
302
|
+
ogp agent-comms remove-topic stan personal
|
|
303
|
+
|
|
304
|
+
# Reset peer to global defaults
|
|
305
|
+
ogp agent-comms reset stan
|
|
306
|
+
|
|
307
|
+
# View activity log
|
|
308
|
+
ogp agent-comms activity
|
|
309
|
+
ogp agent-comms activity --last 20
|
|
310
|
+
ogp agent-comms activity stan # Filter by peer
|
|
311
|
+
|
|
312
|
+
# Settings
|
|
313
|
+
ogp agent-comms default summary # Set default level
|
|
314
|
+
ogp agent-comms logging on # Enable/disable logging
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Policy Inheritance
|
|
318
|
+
|
|
319
|
+
1. **Peer-specific** policies override global policies
|
|
320
|
+
2. **Global** policies apply to all peers without specific config
|
|
321
|
+
3. **Default level** applies to unknown topics
|
|
322
|
+
|
|
323
|
+
When an agent-comms message arrives, your agent receives the policy level in metadata:
|
|
324
|
+
```
|
|
325
|
+
[OGP Agent-Comms] Stanislav → memory-management [FULL]: How do you persist context?
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
Your agent can then respond according to the policy level.
|
|
329
|
+
|
|
330
|
+
## Configuration
|
|
331
|
+
|
|
332
|
+
Configuration is stored in `~/.ogp/config.json`:
|
|
333
|
+
|
|
334
|
+
```json
|
|
335
|
+
{
|
|
336
|
+
"daemonPort": 18790,
|
|
337
|
+
"openclawUrl": "http://localhost:18789",
|
|
338
|
+
"openclawToken": "your-openclaw-api-token",
|
|
339
|
+
"gatewayUrl": "https://your-public-url.com",
|
|
340
|
+
"displayName": "Your Name",
|
|
341
|
+
"email": "you@example.com",
|
|
342
|
+
"stateDir": "~/.ogp"
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Additional state files:
|
|
347
|
+
- `~/.ogp/keypair.json` - Ed25519 keypair (keep secure!)
|
|
348
|
+
- `~/.ogp/peers.json` - Federated peer list
|
|
349
|
+
- `~/.ogp/intents.json` - Intent registry
|
|
350
|
+
|
|
351
|
+
## Skills (Claude Code)
|
|
352
|
+
|
|
353
|
+
OGP includes skills for Claude Code agents. Install them with:
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
ogp-install-skills
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Available Skills
|
|
360
|
+
|
|
361
|
+
| Skill | Purpose |
|
|
362
|
+
|-------|---------|
|
|
363
|
+
| **ogp** | Core protocol: federation setup, peer management, sending messages |
|
|
364
|
+
| **ogp-expose** | Tunnel setup: cloudflared/ngrok configuration |
|
|
365
|
+
| **ogp-agent-comms** | Interactive wizard: configure response policies per-peer |
|
|
366
|
+
|
|
367
|
+
The `ogp-agent-comms` skill guides you through setting up response policies interactively, including multi-select for batch peer configuration.
|
|
368
|
+
|
|
369
|
+
## Documentation
|
|
370
|
+
|
|
371
|
+
- [Quick Start Guide](./docs/quickstart.md) - Detailed step-by-step setup
|
|
372
|
+
- [Federation Flow](./docs/federation-flow.md) - How federation works internally
|
|
373
|
+
- [Scope Negotiation](./docs/scopes.md) - Per-peer scope configuration (v0.2.0)
|
|
374
|
+
- [Agent Communications](./docs/agent-comms.md) - Agent-to-agent messaging (v0.2.0)
|
|
375
|
+
- [Protocol Specification](https://github.com/dp-pcs/openclaw-federation) - Full OGP protocol spec
|
|
376
|
+
|
|
377
|
+
## Security
|
|
378
|
+
|
|
379
|
+
- **Ed25519 signatures**: All messages are cryptographically signed
|
|
380
|
+
- **Peer approval required**: Only approved peers can send messages
|
|
381
|
+
- **Signature verification**: Invalid signatures are rejected
|
|
382
|
+
- **HTTPS tunnels**: Encrypted transport via cloudflared/ngrok
|
|
383
|
+
- **Nonce tracking**: Prevents replay attacks
|
|
384
|
+
|
|
385
|
+
**Best practices:**
|
|
386
|
+
- Keep `~/.ogp/keypair.json` secure with proper file permissions (`chmod 600`)
|
|
387
|
+
- Verify peer identity out-of-band before approving federation requests
|
|
388
|
+
- Always use HTTPS tunnels (never expose raw HTTP)
|
|
389
|
+
- Monitor OpenClaw logs for suspicious peer activity
|
|
390
|
+
|
|
391
|
+
## Development
|
|
392
|
+
|
|
393
|
+
### Build from Source
|
|
394
|
+
|
|
395
|
+
```bash
|
|
396
|
+
git clone https://github.com/dp-pcs/ogp.git
|
|
397
|
+
cd ogp
|
|
398
|
+
npm install
|
|
399
|
+
npm run build
|
|
400
|
+
npm link
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Project Structure
|
|
404
|
+
|
|
405
|
+
```
|
|
406
|
+
src/
|
|
407
|
+
cli.ts # Main CLI entrypoint
|
|
408
|
+
daemon/
|
|
409
|
+
server.ts # HTTP server and endpoints
|
|
410
|
+
keypair.ts # Ed25519 keypair management
|
|
411
|
+
peers.ts # Peer storage and management
|
|
412
|
+
scopes.ts # Scope types and utilities (v0.2.0)
|
|
413
|
+
doorman.ts # Scope enforcement + rate limiting (v0.2.0)
|
|
414
|
+
reply-handler.ts # Async reply mechanism (v0.2.0)
|
|
415
|
+
intent-registry.ts # Intent definitions
|
|
416
|
+
message-handler.ts # Message verification and routing
|
|
417
|
+
notify.ts # OpenClaw webhook integration
|
|
418
|
+
cli/
|
|
419
|
+
setup.ts # Setup wizard
|
|
420
|
+
federation.ts # Federation commands (scopes, agent-comms)
|
|
421
|
+
expose.ts # Tunnel management
|
|
422
|
+
install.ts # LaunchAgent installation
|
|
423
|
+
shared/
|
|
424
|
+
signing.ts # Ed25519 sign/verify utilities
|
|
425
|
+
config.ts # Configuration management
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
## License
|
|
429
|
+
|
|
430
|
+
MIT
|
|
431
|
+
|
|
432
|
+
## Links
|
|
433
|
+
|
|
434
|
+
- **GitHub Repository**: https://github.com/dp-pcs/ogp
|
|
435
|
+
- **Issues**: https://github.com/dp-pcs/ogp/issues
|
|
436
|
+
- **OGP Protocol Spec**: https://github.com/dp-pcs/openclaw-federation
|
|
437
|
+
- **OpenClaw**: https://openclaw.ai
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI commands for agent-comms configuration
|
|
3
|
+
*/
|
|
4
|
+
import { type ResponseLevel } from '../daemon/peers.js';
|
|
5
|
+
/**
|
|
6
|
+
* Show all policies (global + per-peer)
|
|
7
|
+
*/
|
|
8
|
+
export declare function showPolicies(peerId?: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* Configure policies
|
|
11
|
+
*/
|
|
12
|
+
export interface ConfigureOptions {
|
|
13
|
+
global?: boolean;
|
|
14
|
+
topics?: string;
|
|
15
|
+
level?: ResponseLevel;
|
|
16
|
+
notes?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function configurePolicies(peerIds: string | undefined, options: ConfigureOptions): void;
|
|
19
|
+
/**
|
|
20
|
+
* Add a topic to a peer's policy
|
|
21
|
+
*/
|
|
22
|
+
export declare function addTopic(peerId: string, topic: string, level: ResponseLevel, notes?: string): void;
|
|
23
|
+
/**
|
|
24
|
+
* Remove a topic from a peer's policy
|
|
25
|
+
*/
|
|
26
|
+
export declare function removeTopic(peerId: string, topic: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Reset a peer's policy to global defaults
|
|
29
|
+
*/
|
|
30
|
+
export declare function resetPolicy(peerId: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Show activity log
|
|
33
|
+
*/
|
|
34
|
+
export declare function showActivity(peerId?: string, last?: number): void;
|
|
35
|
+
/**
|
|
36
|
+
* Clear activity log
|
|
37
|
+
*/
|
|
38
|
+
export declare function clearActivity(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Set default response level
|
|
41
|
+
*/
|
|
42
|
+
export declare function setDefault(level: ResponseLevel): void;
|
|
43
|
+
/**
|
|
44
|
+
* Enable/disable activity logging
|
|
45
|
+
*/
|
|
46
|
+
export declare function setLogging(enabled: boolean): void;
|
|
47
|
+
/**
|
|
48
|
+
* Interactive peer selection (returns peer IDs)
|
|
49
|
+
*/
|
|
50
|
+
export declare function listPeersForSelection(): {
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
hasPolicy: boolean;
|
|
54
|
+
}[];
|
|
55
|
+
//# sourceMappingURL=agent-comms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-comms.d.ts","sourceRoot":"","sources":["../../src/cli/agent-comms.ts"],"names":[],"mappings":"AAAA;;GAEG;AAeH,OAAO,EAML,KAAK,aAAa,EAEnB,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CA2DlD;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI,CA6D9F;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CASlG;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAS/D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAShD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAajE;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAGpC;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAGrD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAGjD;AAsBD;;GAEG;AACH,wBAAgB,qBAAqB,IAAI;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,EAAE,CAO1F"}
|