@dp-pcs/ogp 0.2.2 → 0.2.5
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 +247 -30
- package/dist/cli/federation.d.ts +1 -1
- package/dist/cli/federation.d.ts.map +1 -1
- package/dist/cli/federation.js +18 -8
- package/dist/cli/federation.js.map +1 -1
- package/dist/cli/project.d.ts +1 -0
- package/dist/cli/project.d.ts.map +1 -1
- package/dist/cli/project.js +68 -4
- package/dist/cli/project.js.map +1 -1
- package/dist/cli.js +49 -2
- package/dist/cli.js.map +1 -1
- package/dist/daemon/notify.d.ts.map +1 -1
- package/dist/daemon/notify.js +41 -44
- package/dist/daemon/notify.js.map +1 -1
- package/dist/shared/config.js +1 -1
- package/dist/shared/config.js.map +1 -1
- package/docs/agent-comms.md +135 -5
- package/docs/federation-flow.md +349 -14
- package/docs/quickstart.md +229 -22
- package/docs/scopes.md +85 -6
- package/package.json +1 -1
- package/skills/ogp-project/SKILL.md +380 -0
package/docs/federation-flow.md
CHANGED
|
@@ -25,11 +25,15 @@ Host: peer.example.com
|
|
|
25
25
|
|
|
26
26
|
```json
|
|
27
27
|
{
|
|
28
|
-
"version": "0.
|
|
28
|
+
"version": "0.2.3",
|
|
29
29
|
"displayName": "Alice",
|
|
30
30
|
"email": "alice@example.com",
|
|
31
31
|
"gatewayUrl": "https://peer.example.com",
|
|
32
32
|
"publicKey": "302a300506032b6570032100abc123...",
|
|
33
|
+
"capabilities": {
|
|
34
|
+
"intents": ["message", "task-request", "status-update", "agent-comms"],
|
|
35
|
+
"features": ["scope-negotiation", "reply-callback", "project-intent"]
|
|
36
|
+
},
|
|
33
37
|
"endpoints": {
|
|
34
38
|
"request": "https://peer.example.com/federation/request",
|
|
35
39
|
"approve": "https://peer.example.com/federation/approve",
|
|
@@ -42,6 +46,8 @@ This endpoint:
|
|
|
42
46
|
- Is unauthenticated (public discovery)
|
|
43
47
|
- Returns peer identity and public key
|
|
44
48
|
- Lists federation endpoints
|
|
49
|
+
- Advertises gateway capabilities (v0.2.0+)
|
|
50
|
+
- Indicates supported intents and features
|
|
45
51
|
|
|
46
52
|
## Federation Request
|
|
47
53
|
|
|
@@ -49,15 +55,26 @@ Alice wants to federate with Bob. Alice sends a signed request.
|
|
|
49
55
|
|
|
50
56
|
### Alice's Side
|
|
51
57
|
|
|
58
|
+
In v0.2.3, the peer-id is **optional** and auto-resolves from the gateway's `/.well-known/ogp`:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
ogp federation request https://bob.example.com
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Or specify a custom peer-id:
|
|
65
|
+
|
|
52
66
|
```bash
|
|
53
67
|
ogp federation request https://bob.example.com peer-bob
|
|
54
68
|
```
|
|
55
69
|
|
|
56
70
|
This:
|
|
57
|
-
1.
|
|
58
|
-
2.
|
|
59
|
-
3.
|
|
60
|
-
4.
|
|
71
|
+
1. Fetches Bob's `/.well-known/ogp` to discover peer info
|
|
72
|
+
2. Auto-resolves peer-id if not provided (uses hostname or displayName)
|
|
73
|
+
3. Loads Alice's keypair
|
|
74
|
+
4. Builds peer info with Alice's public key
|
|
75
|
+
5. Signs the peer info with Alice's private key
|
|
76
|
+
6. POSTs to Bob's `/federation/request`
|
|
77
|
+
7. Fires an OpenClaw notification (via Telegram if configured)
|
|
61
78
|
|
|
62
79
|
### Request
|
|
63
80
|
|
|
@@ -109,20 +126,71 @@ PENDING PEERS:
|
|
|
109
126
|
|
|
110
127
|
## Federation Approval
|
|
111
128
|
|
|
112
|
-
Bob approves Alice's request.
|
|
129
|
+
Bob approves Alice's request. In v0.2.0+, Bob can include **scope grants** to control what Alice can access.
|
|
113
130
|
|
|
114
131
|
### Bob's Side
|
|
115
132
|
|
|
133
|
+
Approve with scope grants (v0.2.0+):
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
ogp federation approve peer-alice \
|
|
137
|
+
--intents message,agent-comms \
|
|
138
|
+
--rate 100/3600 \
|
|
139
|
+
--topics memory-management,task-delegation
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Or approve without restrictions (v0.1 compatibility):
|
|
143
|
+
|
|
116
144
|
```bash
|
|
117
145
|
ogp federation approve peer-alice
|
|
118
146
|
```
|
|
119
147
|
|
|
120
148
|
This:
|
|
121
149
|
1. Updates peer status to `approved` in `~/.ogp/peers.json`
|
|
122
|
-
2.
|
|
150
|
+
2. Stores scope grants with the peer record
|
|
151
|
+
3. POSTs approval to Alice's `/federation/approve`
|
|
123
152
|
|
|
124
153
|
### Request
|
|
125
154
|
|
|
155
|
+
v0.2.0+ approval includes scope bundle:
|
|
156
|
+
|
|
157
|
+
```http
|
|
158
|
+
POST /federation/approve HTTP/1.1
|
|
159
|
+
Host: alice.example.com
|
|
160
|
+
Content-Type: application/json
|
|
161
|
+
|
|
162
|
+
{
|
|
163
|
+
"peerId": "peer-alice",
|
|
164
|
+
"approved": true,
|
|
165
|
+
"protocolVersion": "0.2.3",
|
|
166
|
+
"scopeGrants": {
|
|
167
|
+
"version": "0.2.0",
|
|
168
|
+
"grantedAt": "2026-03-24T10:30:00Z",
|
|
169
|
+
"scopes": [
|
|
170
|
+
{
|
|
171
|
+
"intent": "message",
|
|
172
|
+
"enabled": true,
|
|
173
|
+
"rateLimit": {
|
|
174
|
+
"requests": 100,
|
|
175
|
+
"windowSeconds": 3600
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"intent": "agent-comms",
|
|
180
|
+
"enabled": true,
|
|
181
|
+
"topics": ["memory-management", "task-delegation"],
|
|
182
|
+
"rateLimit": {
|
|
183
|
+
"requests": 100,
|
|
184
|
+
"windowSeconds": 3600
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
v0.1 approval (backward compatible):
|
|
193
|
+
|
|
126
194
|
```http
|
|
127
195
|
POST /federation/approve HTTP/1.1
|
|
128
196
|
Host: alice.example.com
|
|
@@ -139,6 +207,7 @@ Content-Type: application/json
|
|
|
139
207
|
Alice's OGP daemon:
|
|
140
208
|
1. Receives approval
|
|
141
209
|
2. Updates Bob's status to `approved`
|
|
210
|
+
3. Stores received scope grants (what Alice can request from Bob)
|
|
142
211
|
|
|
143
212
|
Now both sides have approved peers:
|
|
144
213
|
|
|
@@ -152,6 +221,25 @@ APPROVED PEERS:
|
|
|
152
221
|
Status: approved
|
|
153
222
|
Gateway: https://bob.example.com
|
|
154
223
|
Public key: 302a300506032b6570032100abc123...
|
|
224
|
+
Granted scopes: message, agent-comms
|
|
225
|
+
Rate limit: 100 requests / 3600 seconds
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
View detailed scopes:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
$ ogp federation scopes peer-bob
|
|
232
|
+
|
|
233
|
+
Scopes granted TO peer-bob (what they can request from you):
|
|
234
|
+
[not configured - full access]
|
|
235
|
+
|
|
236
|
+
Scopes received FROM peer-bob (what you can request from them):
|
|
237
|
+
• message (enabled)
|
|
238
|
+
Rate limit: 100 requests / 3600 seconds
|
|
239
|
+
|
|
240
|
+
• agent-comms (enabled)
|
|
241
|
+
Topics: memory-management, task-delegation
|
|
242
|
+
Rate limit: 100 requests / 3600 seconds
|
|
155
243
|
```
|
|
156
244
|
|
|
157
245
|
## Message Exchange
|
|
@@ -193,14 +281,49 @@ Content-Type: application/json
|
|
|
193
281
|
|
|
194
282
|
### Bob Receives
|
|
195
283
|
|
|
196
|
-
Bob's OGP daemon:
|
|
284
|
+
Bob's OGP daemon (doorman):
|
|
197
285
|
1. Verifies sender (`peer-alice`) is in approved peers
|
|
198
|
-
2.
|
|
199
|
-
3. Checks
|
|
200
|
-
4.
|
|
286
|
+
2. **Checks scope grants** - Is `message` intent allowed for Alice? (v0.2.0+)
|
|
287
|
+
3. **Checks rate limits** - Has Alice exceeded their quota? (v0.2.0+)
|
|
288
|
+
4. Verifies signature using Alice's public key
|
|
289
|
+
5. Checks intent exists in registry
|
|
290
|
+
6. Forwards to Bob's OpenClaw via webhook or sessions_send (v0.2.3+)
|
|
291
|
+
|
|
292
|
+
If scope check fails:
|
|
293
|
+
- Response: `403 Forbidden`
|
|
294
|
+
- Message: `"Intent 'message' not granted"`
|
|
295
|
+
|
|
296
|
+
If rate limit exceeded:
|
|
297
|
+
- Response: `429 Too Many Requests`
|
|
298
|
+
- Header: `Retry-After: <seconds>`
|
|
299
|
+
- Message: `"Rate limit exceeded for intent 'message'"`
|
|
201
300
|
|
|
202
301
|
### OpenClaw Notification
|
|
203
302
|
|
|
303
|
+
v0.2.3+ prioritizes **sessions_send** over system events for better Telegram integration:
|
|
304
|
+
|
|
305
|
+
```http
|
|
306
|
+
POST /api/sessions/send HTTP/1.1
|
|
307
|
+
Host: bob-openclaw.local:18789
|
|
308
|
+
Authorization: Bearer bob-token
|
|
309
|
+
Content-Type: application/json
|
|
310
|
+
|
|
311
|
+
{
|
|
312
|
+
"sessionKey": "agent:main:main",
|
|
313
|
+
"message": "[OGP] Message from Alice: Hello, Bob!",
|
|
314
|
+
"ogp": {
|
|
315
|
+
"from": "peer-alice",
|
|
316
|
+
"intent": "message",
|
|
317
|
+
"nonce": "550e8400-e29b-41d4-a716-446655440000",
|
|
318
|
+
"payload": {
|
|
319
|
+
"text": "Hello, Bob!"
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Fallback to system event if sessions_send is unavailable:
|
|
326
|
+
|
|
204
327
|
```http
|
|
205
328
|
POST /api/system-event HTTP/1.1
|
|
206
329
|
Host: bob-openclaw.local:18789
|
|
@@ -221,7 +344,7 @@ Content-Type: application/json
|
|
|
221
344
|
}
|
|
222
345
|
```
|
|
223
346
|
|
|
224
|
-
Bob's OpenClaw agent sees:
|
|
347
|
+
Bob's OpenClaw agent sees (via Telegram or system notification):
|
|
225
348
|
|
|
226
349
|
```
|
|
227
350
|
[OGP] Message from Alice: Hello, Bob!
|
|
@@ -238,6 +361,212 @@ Bob's OGP daemon responds to Alice:
|
|
|
238
361
|
}
|
|
239
362
|
```
|
|
240
363
|
|
|
364
|
+
## Agent-Comms Flow (v0.2.0+)
|
|
365
|
+
|
|
366
|
+
Agent-comms enables rich agent-to-agent communication with topic routing, priority, and reply support.
|
|
367
|
+
|
|
368
|
+
### Alice Sends Agent-Comms
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
ogp federation agent peer-bob memory-management "How do you persist context?" --priority high --wait
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Request
|
|
375
|
+
|
|
376
|
+
```http
|
|
377
|
+
POST /federation/message HTTP/1.1
|
|
378
|
+
Host: bob.example.com
|
|
379
|
+
Content-Type: application/json
|
|
380
|
+
|
|
381
|
+
{
|
|
382
|
+
"message": {
|
|
383
|
+
"intent": "agent-comms",
|
|
384
|
+
"from": "peer-alice",
|
|
385
|
+
"to": "peer-bob",
|
|
386
|
+
"nonce": "abc-123-def-456",
|
|
387
|
+
"timestamp": "2026-03-24T10:30:00Z",
|
|
388
|
+
"replyTo": "https://alice.example.com/federation/reply/abc-123-def-456",
|
|
389
|
+
"payload": {
|
|
390
|
+
"topic": "memory-management",
|
|
391
|
+
"message": "How do you persist context?",
|
|
392
|
+
"priority": "high"
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
"signature": "a1b2c3d4e5f6..."
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Bob Receives with Policy
|
|
400
|
+
|
|
401
|
+
Bob's doorman:
|
|
402
|
+
1. Verifies Alice is approved
|
|
403
|
+
2. **Checks intent grant** - Does Alice have `agent-comms` access?
|
|
404
|
+
3. **Checks topic grant** - Is `memory-management` in Alice's allowed topics?
|
|
405
|
+
4. **Checks rate limit** - Within quota?
|
|
406
|
+
5. Verifies signature
|
|
407
|
+
6. **Loads response policy** - How should Bob's agent respond?
|
|
408
|
+
7. Forwards to OpenClaw with policy metadata
|
|
409
|
+
|
|
410
|
+
Bob sees:
|
|
411
|
+
|
|
412
|
+
```
|
|
413
|
+
[OGP Agent-Comms] [HIGH] Alice → memory-management [FULL]: How do you persist context?
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
The `[FULL]` indicator tells Bob's agent to respond openly based on the configured response policy.
|
|
417
|
+
|
|
418
|
+
### Bob Replies
|
|
419
|
+
|
|
420
|
+
Bob's agent can reply via the `replyTo` callback URL:
|
|
421
|
+
|
|
422
|
+
```http
|
|
423
|
+
POST /federation/reply/abc-123-def-456 HTTP/1.1
|
|
424
|
+
Host: alice.example.com
|
|
425
|
+
Content-Type: application/json
|
|
426
|
+
|
|
427
|
+
{
|
|
428
|
+
"reply": {
|
|
429
|
+
"nonce": "abc-123-def-456",
|
|
430
|
+
"success": true,
|
|
431
|
+
"data": {
|
|
432
|
+
"answer": "We use PostgreSQL with a custom context table that stores conversation history..."
|
|
433
|
+
},
|
|
434
|
+
"timestamp": "2026-03-24T10:30:05Z"
|
|
435
|
+
},
|
|
436
|
+
"signature": "x1y2z3..."
|
|
437
|
+
}
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
Alice's agent receives the reply and completes the `--wait` operation.
|
|
441
|
+
|
|
442
|
+
## Project Intent Flow (v0.2.0+)
|
|
443
|
+
|
|
444
|
+
Project intents enable collaborative project management across federated peers.
|
|
445
|
+
|
|
446
|
+
### Alice Sends Contribution
|
|
447
|
+
|
|
448
|
+
```bash
|
|
449
|
+
ogp project send-contribution peer-bob shared-app progress "Completed authentication system"
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### Request
|
|
453
|
+
|
|
454
|
+
```http
|
|
455
|
+
POST /federation/message HTTP/1.1
|
|
456
|
+
Host: bob.example.com
|
|
457
|
+
Content-Type: application/json
|
|
458
|
+
|
|
459
|
+
{
|
|
460
|
+
"message": {
|
|
461
|
+
"intent": "project",
|
|
462
|
+
"from": "peer-alice",
|
|
463
|
+
"to": "peer-bob",
|
|
464
|
+
"nonce": "proj-123-456",
|
|
465
|
+
"timestamp": "2026-03-24T11:00:00Z",
|
|
466
|
+
"payload": {
|
|
467
|
+
"action": "contribute",
|
|
468
|
+
"projectId": "shared-app",
|
|
469
|
+
"contribution": {
|
|
470
|
+
"topic": "progress",
|
|
471
|
+
"summary": "Completed authentication system",
|
|
472
|
+
"metadata": {
|
|
473
|
+
"files": ["src/auth.ts", "src/jwt.ts"],
|
|
474
|
+
"tests": "all passing"
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
"signature": "a1b2c3d4..."
|
|
480
|
+
}
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
### Bob Receives
|
|
484
|
+
|
|
485
|
+
Bob's daemon:
|
|
486
|
+
1. Verifies Alice is approved
|
|
487
|
+
2. Checks `project` intent grant
|
|
488
|
+
3. Verifies signature
|
|
489
|
+
4. **Stores contribution** in local project record
|
|
490
|
+
5. Notifies OpenClaw agent
|
|
491
|
+
|
|
492
|
+
Bob sees:
|
|
493
|
+
|
|
494
|
+
```
|
|
495
|
+
[OGP Project] Alice contributed to shared-app (progress): Completed authentication system
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
### Alice Queries Bob's Project
|
|
499
|
+
|
|
500
|
+
```bash
|
|
501
|
+
ogp project query-peer peer-bob shared-app --limit 10
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
### Request
|
|
505
|
+
|
|
506
|
+
```http
|
|
507
|
+
POST /federation/message HTTP/1.1
|
|
508
|
+
Host: bob.example.com
|
|
509
|
+
Content-Type: application/json
|
|
510
|
+
|
|
511
|
+
{
|
|
512
|
+
"message": {
|
|
513
|
+
"intent": "project",
|
|
514
|
+
"from": "peer-alice",
|
|
515
|
+
"to": "peer-bob",
|
|
516
|
+
"nonce": "proj-789-012",
|
|
517
|
+
"timestamp": "2026-03-24T11:05:00Z",
|
|
518
|
+
"replyTo": "https://alice.example.com/federation/reply/proj-789-012",
|
|
519
|
+
"payload": {
|
|
520
|
+
"action": "query",
|
|
521
|
+
"projectId": "shared-app",
|
|
522
|
+
"filters": {
|
|
523
|
+
"limit": 10
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
},
|
|
527
|
+
"signature": "b2c3d4e5..."
|
|
528
|
+
}
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
### Bob's Response
|
|
532
|
+
|
|
533
|
+
Bob's daemon replies with project contributions:
|
|
534
|
+
|
|
535
|
+
```http
|
|
536
|
+
POST /federation/reply/proj-789-012 HTTP/1.1
|
|
537
|
+
Host: alice.example.com
|
|
538
|
+
Content-Type: application/json
|
|
539
|
+
|
|
540
|
+
{
|
|
541
|
+
"reply": {
|
|
542
|
+
"nonce": "proj-789-012",
|
|
543
|
+
"success": true,
|
|
544
|
+
"data": {
|
|
545
|
+
"projectId": "shared-app",
|
|
546
|
+
"projectName": "Shared Mobile App",
|
|
547
|
+
"contributions": [
|
|
548
|
+
{
|
|
549
|
+
"topic": "progress",
|
|
550
|
+
"summary": "Deployed staging environment",
|
|
551
|
+
"author": "peer-bob",
|
|
552
|
+
"timestamp": "2026-03-24T10:00:00Z"
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
"topic": "blocker",
|
|
556
|
+
"summary": "Waiting for API key approval",
|
|
557
|
+
"author": "peer-bob",
|
|
558
|
+
"timestamp": "2026-03-23T15:30:00Z"
|
|
559
|
+
}
|
|
560
|
+
]
|
|
561
|
+
},
|
|
562
|
+
"timestamp": "2026-03-24T11:05:01Z"
|
|
563
|
+
},
|
|
564
|
+
"signature": "c3d4e5f6..."
|
|
565
|
+
}
|
|
566
|
+
```
|
|
567
|
+
|
|
568
|
+
Alice receives a unified view of project activity from both local and Bob's contributions.
|
|
569
|
+
|
|
241
570
|
## Security Model
|
|
242
571
|
|
|
243
572
|
### Keypair Generation
|
|
@@ -311,11 +640,14 @@ If signature is invalid:
|
|
|
311
640
|
- ✓ Message tampering (signature covers full message)
|
|
312
641
|
- ✓ Unauthorized peers (approval required)
|
|
313
642
|
- ✓ Man-in-the-middle (HTTPS tunnels)
|
|
643
|
+
- ✓ **Scope violations** (doorman enforcement, v0.2.0+)
|
|
644
|
+
- ✓ **Rate abuse** (per-peer rate limiting, v0.2.0+)
|
|
645
|
+
- ✓ **Topic restrictions** (topic-based access control for agent-comms, v0.2.0+)
|
|
314
646
|
|
|
315
647
|
**OGP does NOT protect against:**
|
|
316
648
|
|
|
317
649
|
- ✗ Compromised peer credentials (keep `keypair.json` secure)
|
|
318
|
-
- ✗ DDoS attacks (
|
|
650
|
+
- ✗ DDoS attacks (rate limiting mitigates but doesn't prevent)
|
|
319
651
|
- ✗ Replay attacks (nonce tracking not yet implemented)
|
|
320
652
|
|
|
321
653
|
### Best Practices
|
|
@@ -403,5 +735,8 @@ Alice Bob
|
|
|
403
735
|
## Next Steps
|
|
404
736
|
|
|
405
737
|
- See [quickstart.md](./quickstart.md) for hands-on tutorial
|
|
738
|
+
- Read [scopes.md](./scopes.md) for scope negotiation details
|
|
739
|
+
- Learn [agent-comms.md](./agent-comms.md) for agent-to-agent messaging
|
|
406
740
|
- Check [README.md](../README.md) for CLI reference
|
|
407
|
-
-
|
|
741
|
+
- Register custom intents with `ogp intent register`
|
|
742
|
+
- Configure response policies with `ogp agent-comms configure`
|