@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.
@@ -14,6 +14,12 @@ Get started with OGP federation in 5 minutes.
14
14
  npm install -g @dp-pcs/ogp
15
15
  ```
16
16
 
17
+ After installation, install the OGP skills for Claude Code:
18
+
19
+ ```bash
20
+ ogp-install-skills
21
+ ```
22
+
17
23
  ## Step 2: Configure
18
24
 
19
25
  Run the interactive setup:
@@ -38,20 +44,42 @@ Don't worry about the gateway URL yet — we'll get a real one in the next step.
38
44
 
39
45
  ## Step 3: Start Daemon
40
46
 
47
+ ```bash
48
+ ogp start --background
49
+ ```
50
+
51
+ Or run in foreground for debugging:
52
+
41
53
  ```bash
42
54
  ogp start
43
55
  ```
44
56
 
57
+ Check status:
58
+
59
+ ```bash
60
+ ogp status
61
+ ```
62
+
45
63
  You should see:
46
64
 
47
65
  ```
48
- [OGP] Daemon listening on port 18790
49
- [OGP] Public key: 302a300506032b6570032100...
66
+ OGP Daemon Status:
67
+ Status: Running
68
+ Port: 18790
69
+ PID: 12345
70
+ Uptime: 5 minutes
71
+ Public Key: 302a300506032b6570032100...
50
72
  ```
51
73
 
52
74
  ## Step 4: Expose to Internet
53
75
 
54
- In a new terminal:
76
+ In a new terminal (or background):
77
+
78
+ ```bash
79
+ ogp expose --background
80
+ ```
81
+
82
+ Or run in foreground:
55
83
 
56
84
  ```bash
57
85
  ogp expose
@@ -67,10 +95,17 @@ https://abc-def-123.trycloudflare.com
67
95
 
68
96
  ## Step 5: Update Gateway URL
69
97
 
70
- 1. Stop the daemon (Ctrl+C in the daemon terminal)
71
- 2. Edit `~/.ogp/config.json`
72
- 3. Update `"gatewayUrl"` to your tunnel URL
73
- 4. Restart: `ogp start`
98
+ ```bash
99
+ ogp config --gateway-url https://abc-def-123.trycloudflare.com
100
+ ```
101
+
102
+ Or manually edit `~/.ogp/config.json` and update `"gatewayUrl"`.
103
+
104
+ Restart the daemon:
105
+
106
+ ```bash
107
+ ogp stop && ogp start --background
108
+ ```
74
109
 
75
110
  ## Step 6: Verify Setup
76
111
 
@@ -84,11 +119,15 @@ You should see:
84
119
 
85
120
  ```json
86
121
  {
87
- "version": "0.1.0",
122
+ "version": "0.2.3",
88
123
  "displayName": "Alice",
89
124
  "email": "alice@example.com",
90
125
  "gatewayUrl": "https://abc-def-123.trycloudflare.com",
91
126
  "publicKey": "302a300506032b6570032100...",
127
+ "capabilities": {
128
+ "intents": ["message", "task-request", "status-update", "agent-comms"],
129
+ "features": ["scope-negotiation", "reply-callback", "project-intent"]
130
+ },
92
131
  "endpoints": {
93
132
  "request": "https://abc-def-123.trycloudflare.com/federation/request",
94
133
  "approve": "https://abc-def-123.trycloudflare.com/federation/approve",
@@ -101,7 +140,13 @@ You should see:
101
140
 
102
141
  ## Step 7: Federate with a Peer
103
142
 
104
- Ask a friend to share their OGP gateway URL, then:
143
+ Ask a friend to share their OGP gateway URL. The peer-id is now **optional** - OGP will auto-resolve it from the gateway's `/.well-known/ogp` endpoint:
144
+
145
+ ```bash
146
+ ogp federation request https://peer.example.com
147
+ ```
148
+
149
+ Or specify a custom peer-id:
105
150
 
106
151
  ```bash
107
152
  ogp federation request https://peer.example.com peer-bob
@@ -115,10 +160,19 @@ You'll see:
115
160
  Message: Federation request received and pending approval
116
161
  ```
117
162
 
118
- Wait for Bob to approve your request:
163
+ Wait for Bob to approve your request. In v0.2.3, Bob can approve with **scope grants** to control what you can access:
164
+
165
+ ```bash
166
+ # Bob approves with specific intents and rate limits
167
+ ogp federation approve peer-alice \
168
+ --intents message,agent-comms \
169
+ --rate 100/3600 \
170
+ --topics memory-management,task-delegation
171
+ ```
172
+
173
+ Or approve without restrictions (v0.1 compatibility):
119
174
 
120
175
  ```bash
121
- # Bob runs this on their end:
122
176
  ogp federation approve peer-alice
123
177
  ```
124
178
 
@@ -134,7 +188,7 @@ ogp federation list --status approved
134
188
  ogp federation send peer-bob message '{"text":"Hello from OGP!"}'
135
189
  ```
136
190
 
137
- Bob's OpenClaw agent will receive:
191
+ Bob's OpenClaw agent will receive a notification via Telegram (if configured) or system event:
138
192
 
139
193
  ```
140
194
  [OGP] Message from Alice: Hello from OGP!
@@ -142,6 +196,91 @@ Bob's OpenClaw agent will receive:
142
196
 
143
197
  ## Next Steps
144
198
 
199
+ ### Agent-to-Agent Communication (v0.2.0+)
200
+
201
+ Use agent-comms for rich agent collaboration:
202
+
203
+ ```bash
204
+ # Send agent-comms with topic routing
205
+ ogp federation agent peer-bob memory-management "How do you persist context?"
206
+
207
+ # High-priority message
208
+ ogp federation agent peer-bob task-delegation "Schedule standup ASAP" --priority high
209
+
210
+ # Wait for reply
211
+ ogp federation agent peer-bob queries "What's the status?" --wait --timeout 60000
212
+
213
+ # Start a conversation thread
214
+ ogp federation agent peer-bob project-planning "Let's discuss sprint goals" --conversation sprint-42
215
+ ```
216
+
217
+ ### Configure Response Policies
218
+
219
+ Control how your agent responds to incoming agent-comms:
220
+
221
+ ```bash
222
+ # View current policies
223
+ ogp agent-comms policies
224
+
225
+ # Configure global defaults
226
+ ogp agent-comms configure --global --topics "general,testing" --level summary
227
+
228
+ # Configure specific peer
229
+ ogp agent-comms configure peer-bob --topics "memory-management" --level full
230
+
231
+ # Add escalation for sensitive topics
232
+ ogp agent-comms add-topic peer-bob calendar --level escalate
233
+ ```
234
+
235
+ Response levels:
236
+ - `full` - Respond openly with details
237
+ - `summary` - High-level responses only
238
+ - `escalate` - Ask human before responding
239
+ - `deny` - Politely decline to discuss
240
+
241
+ ### Project Collaboration (v0.2.0+)
242
+
243
+ Create and manage collaborative projects:
244
+
245
+ ```bash
246
+ # Create a project
247
+ ogp project create my-app "My Awesome App" --description "Mobile expense tracker"
248
+
249
+ # Add contributions (log work)
250
+ ogp project contribute my-app progress "Completed authentication system"
251
+ ogp project contribute my-app decision "Using PostgreSQL for data storage"
252
+ ogp project contribute my-app blocker "Waiting for API key approval"
253
+
254
+ # View project status
255
+ ogp project status my-app
256
+
257
+ # Query recent activity
258
+ ogp project query my-app --limit 10
259
+
260
+ # Send contribution to peer's project
261
+ ogp project send-contribution peer-bob shared-project progress "Deployed staging environment"
262
+
263
+ # Query peer's project contributions
264
+ ogp project query-peer peer-bob shared-project
265
+ ```
266
+
267
+ ### Custom Intents
268
+
269
+ Register custom intent handlers:
270
+
271
+ ```bash
272
+ # Register a new intent
273
+ ogp intent register deployment \
274
+ --session-key "agent:main:main" \
275
+ --description "Deployment notifications"
276
+
277
+ # List registered intents
278
+ ogp intent list
279
+
280
+ # Remove an intent
281
+ ogp intent remove deployment
282
+ ```
283
+
145
284
  ### Send Different Message Types
146
285
 
147
286
  ```bash
@@ -166,11 +305,26 @@ When someone sends you a federation request:
166
305
  # List pending
167
306
  ogp federation list --status pending
168
307
 
169
- # Approve
308
+ # Approve with scope grants (v0.2.0+)
309
+ ogp federation approve peer-charlie \
310
+ --intents message,agent-comms \
311
+ --rate 50/3600 \
312
+ --topics general,project-updates
313
+
314
+ # Or approve without restrictions
170
315
  ogp federation approve peer-charlie
171
316
 
172
317
  # Or reject
173
318
  ogp federation reject peer-charlie
319
+
320
+ # View granted scopes
321
+ ogp federation scopes peer-charlie
322
+
323
+ # Update scopes later
324
+ ogp federation grant peer-charlie \
325
+ --intents agent-comms \
326
+ --topics memory-management,planning \
327
+ --rate 100/3600
174
328
  ```
175
329
 
176
330
  ### Keep Tunnel Running
@@ -206,36 +360,89 @@ Run `ogp setup` first.
206
360
 
207
361
  The peer must approve your federation request first. Contact them or check their status.
208
362
 
363
+ ### "Scope not granted" or 403 errors
364
+
365
+ Check the peer's granted scopes:
366
+
367
+ ```bash
368
+ ogp federation scopes peer-bob
369
+ ```
370
+
371
+ Request the peer to update your grants if needed.
372
+
373
+ ### "Rate limit exceeded" or 429 errors
374
+
375
+ You've exceeded the rate limit granted by the peer. Wait for the retry window or request higher limits.
376
+
209
377
  ### Tunnel URL not accessible
210
378
 
211
379
  - Check firewall settings
212
380
  - Verify daemon is running
213
381
  - Try accessing locally first: `curl http://localhost:18790/.well-known/ogp`
214
382
 
383
+ ### Daemon won't start
384
+
385
+ Check if already running:
386
+
387
+ ```bash
388
+ ogp status
389
+ ```
390
+
391
+ OGP v0.2.3+ detects externally-started daemons via port probe. If port 18790 is in use, stop the existing process first.
392
+
215
393
  ## Common Commands Cheat Sheet
216
394
 
217
395
  ```bash
218
- # Setup
396
+ # Setup & Installation
219
397
  ogp setup
220
- ogp start
221
- ogp expose
398
+ ogp-install-skills # Install Claude Code skills
399
+ ogp start --background
400
+ ogp expose --background
222
401
 
223
402
  # Status
224
403
  ogp status
225
404
  ogp federation list
405
+ ogp federation list --status approved
406
+ ogp project list
226
407
 
227
- # Federation
228
- ogp federation request <url> <peer-id>
229
- ogp federation approve <peer-id>
408
+ # Federation (peer-id auto-resolves in v0.2.3)
409
+ ogp federation request <url>
410
+ ogp federation approve <peer-id> [--intents <list>] [--rate <n>/<s>] [--topics <list>]
230
411
  ogp federation send <peer-id> <intent> '<json>'
412
+ ogp federation agent <peer-id> <topic> <message> [--priority high] [--wait]
413
+ ogp federation scopes <peer-id>
414
+
415
+ # Projects
416
+ ogp project create <id> <name> [--description "..."]
417
+ ogp project contribute <id> <topic> <summary>
418
+ ogp project query <id> [--limit 10] [--topic <topic>]
419
+ ogp project status <id>
420
+
421
+ # Intents
422
+ ogp intent register <name> [--session-key <key>] [--description "..."]
423
+ ogp intent list
424
+ ogp intent remove <name>
425
+
426
+ # Agent-Comms Policies
427
+ ogp agent-comms policies [peer-id]
428
+ ogp agent-comms configure [peer-id] --topics <list> --level <level>
429
+ ogp agent-comms activity [peer-id]
231
430
 
232
431
  # Stop
233
432
  ogp stop
433
+ ogp expose-stop
434
+ ogp shutdown # Stop both daemon and tunnel
234
435
  ```
235
436
 
236
437
  ## What's Next?
237
438
 
238
439
  - Read [Federation Flow](./federation-flow.md) for detailed message flow
239
- - Check [Skills](../skills/) for Claude Code integration
240
- - Explore custom intents in `~/.ogp/intents.json`
241
- - Set up automatic peer discovery
440
+ - Learn about [Scope Negotiation](./scopes.md) for per-peer access control
441
+ - Explore [Agent Communications](./agent-comms.md) for agent-to-agent messaging
442
+ - Check [Skills](../skills/) for Claude Code integration:
443
+ - `ogp` - Core protocol management
444
+ - `ogp-expose` - Tunnel configuration
445
+ - `ogp-agent-comms` - Interactive policy configuration
446
+ - `ogp-project` - Project context and collaboration
447
+ - Register custom intents with `ogp intent register`
448
+ - Set up response policies for incoming agent-comms
package/docs/scopes.md CHANGED
@@ -16,17 +16,22 @@ Your gateway advertises its capabilities in the federation card at `/.well-known
16
16
 
17
17
  ```json
18
18
  {
19
- "version": "0.2.0",
19
+ "version": "0.2.3",
20
20
  "displayName": "David's Gateway",
21
21
  "capabilities": {
22
- "intents": ["message", "task-request", "status-update", "agent-comms"],
23
- "features": ["scope-negotiation", "reply-callback"]
22
+ "intents": ["message", "task-request", "status-update", "agent-comms", "project"],
23
+ "features": ["scope-negotiation", "reply-callback", "project-intent"]
24
24
  }
25
25
  }
26
26
  ```
27
27
 
28
28
  This tells other gateways what you **can** support, not what you **will** grant.
29
29
 
30
+ Capabilities are automatically populated from:
31
+ - **Built-in intents**: `message`, `task-request`, `status-update`, `agent-comms`, `project`
32
+ - **Custom intents**: Registered via `ogp intent register`
33
+ - **Features**: Protocol features your gateway supports
34
+
30
35
  ### Layer 2: Peer Negotiation
31
36
 
32
37
  When you approve a federation request, you decide what to grant **this specific peer**:
@@ -169,12 +174,67 @@ Protocol version is detected automatically from:
169
174
  - **Use topic restrictions**: Especially for agent-comms
170
175
  - **Set expiration**: For temporary access, use `expiresAt` in code
171
176
 
177
+ ## Custom Intents
178
+
179
+ Register custom intent handlers for specialized workflows:
180
+
181
+ ```bash
182
+ # Register a deployment intent
183
+ ogp intent register deployment \
184
+ --session-key "agent:main:main" \
185
+ --description "Deployment notifications"
186
+
187
+ # Register a monitoring intent
188
+ ogp intent register monitoring \
189
+ --session-key "agent:ops:alerts" \
190
+ --description "System monitoring and alerts"
191
+
192
+ # List all registered intents
193
+ ogp intent list
194
+
195
+ # Remove an intent
196
+ ogp intent remove deployment
197
+ ```
198
+
199
+ Custom intents appear in your gateway capabilities and can be granted to peers:
200
+
201
+ ```bash
202
+ # Grant peer access to custom intent
203
+ ogp federation approve alice \
204
+ --intents message,deployment \
205
+ --rate 50/3600
206
+ ```
207
+
208
+ ## Project Intent
209
+
210
+ The `project` intent enables collaborative project management across federated peers.
211
+
212
+ ### Project Actions
213
+
214
+ | Action | Description | Rate Limit Recommended |
215
+ |--------|-------------|------------------------|
216
+ | `contribute` | Send contribution to peer's project | 100/hour |
217
+ | `query` | Query peer's project contributions | 50/hour |
218
+ | `request-join` | Request to join peer's project | 10/hour |
219
+ | `status` | Get project status from peer | 20/hour |
220
+
221
+ ### Grant Project Access
222
+
223
+ ```bash
224
+ # Grant project collaboration access
225
+ ogp federation approve alice \
226
+ --intents project \
227
+ --rate 100/3600
228
+ ```
229
+
230
+ Project scope grants don't require topic restrictions - access is controlled at the project membership level. Peers can only contribute to projects they're members of.
231
+
172
232
  ## Examples
173
233
 
174
234
  ### Minimal Access
175
235
 
176
236
  ```bash
177
- # Grant only ping intent
237
+ # Grant only message intent
178
238
  ogp federation approve stan --intents message --rate 10/3600
179
239
  ```
180
240
 
@@ -190,9 +250,28 @@ ogp federation approve alice \
190
250
  ### Scoped Agent Access
191
251
 
192
252
  ```bash
193
- # Grant agent-comms for specific project
253
+ # Grant agent-comms for specific topics
194
254
  ogp federation approve bob \
195
255
  --intents agent-comms \
196
- --topics project-alpha,planning \
256
+ --topics memory-management,planning \
197
257
  --rate 50/3600
198
258
  ```
259
+
260
+ ### Project Collaboration
261
+
262
+ ```bash
263
+ # Grant project and agent-comms for team collaboration
264
+ ogp federation approve charlie \
265
+ --intents agent-comms,project \
266
+ --topics project-updates,planning \
267
+ --rate 200/3600
268
+ ```
269
+
270
+ ### Custom Intent Access
271
+
272
+ ```bash
273
+ # Grant custom deployment intent
274
+ ogp federation approve deploy-bot \
275
+ --intents deployment,monitoring \
276
+ --rate 500/3600
277
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dp-pcs/ogp",
3
- "version": "0.2.2",
3
+ "version": "0.2.5",
4
4
  "description": "Open Gateway Protocol (OGP) - Peer-to-peer federation daemon for OpenClaw AI gateways with cryptographic signatures",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",