@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.
Files changed (82) hide show
  1. package/README.md +437 -0
  2. package/dist/cli/agent-comms.d.ts +55 -0
  3. package/dist/cli/agent-comms.d.ts.map +1 -0
  4. package/dist/cli/agent-comms.js +217 -0
  5. package/dist/cli/agent-comms.js.map +1 -0
  6. package/dist/cli/expose.d.ts +3 -0
  7. package/dist/cli/expose.d.ts.map +1 -0
  8. package/dist/cli/expose.js +104 -0
  9. package/dist/cli/expose.js.map +1 -0
  10. package/dist/cli/federation.d.ts +28 -0
  11. package/dist/cli/federation.d.ts.map +1 -0
  12. package/dist/cli/federation.js +409 -0
  13. package/dist/cli/federation.js.map +1 -0
  14. package/dist/cli/install.d.ts +3 -0
  15. package/dist/cli/install.d.ts.map +1 -0
  16. package/dist/cli/install.js +111 -0
  17. package/dist/cli/install.js.map +1 -0
  18. package/dist/cli/setup.d.ts +2 -0
  19. package/dist/cli/setup.d.ts.map +1 -0
  20. package/dist/cli/setup.js +33 -0
  21. package/dist/cli/setup.js.map +1 -0
  22. package/dist/cli.d.ts +3 -0
  23. package/dist/cli.d.ts.map +1 -0
  24. package/dist/cli.js +305 -0
  25. package/dist/cli.js.map +1 -0
  26. package/dist/daemon/agent-comms.d.ts +76 -0
  27. package/dist/daemon/agent-comms.d.ts.map +1 -0
  28. package/dist/daemon/agent-comms.js +188 -0
  29. package/dist/daemon/agent-comms.js.map +1 -0
  30. package/dist/daemon/doorman.d.ts +52 -0
  31. package/dist/daemon/doorman.d.ts.map +1 -0
  32. package/dist/daemon/doorman.js +203 -0
  33. package/dist/daemon/doorman.js.map +1 -0
  34. package/dist/daemon/intent-registry.d.ts +11 -0
  35. package/dist/daemon/intent-registry.d.ts.map +1 -0
  36. package/dist/daemon/intent-registry.js +101 -0
  37. package/dist/daemon/intent-registry.js.map +1 -0
  38. package/dist/daemon/keypair.d.ts +5 -0
  39. package/dist/daemon/keypair.d.ts.map +1 -0
  40. package/dist/daemon/keypair.js +25 -0
  41. package/dist/daemon/keypair.js.map +1 -0
  42. package/dist/daemon/message-handler.d.ts +20 -0
  43. package/dist/daemon/message-handler.d.ts.map +1 -0
  44. package/dist/daemon/message-handler.js +159 -0
  45. package/dist/daemon/message-handler.js.map +1 -0
  46. package/dist/daemon/notify.d.ts +7 -0
  47. package/dist/daemon/notify.d.ts.map +1 -0
  48. package/dist/daemon/notify.js +54 -0
  49. package/dist/daemon/notify.js.map +1 -0
  50. package/dist/daemon/peers.d.ts +66 -0
  51. package/dist/daemon/peers.d.ts.map +1 -0
  52. package/dist/daemon/peers.js +171 -0
  53. package/dist/daemon/peers.js.map +1 -0
  54. package/dist/daemon/reply-handler.d.ts +67 -0
  55. package/dist/daemon/reply-handler.d.ts.map +1 -0
  56. package/dist/daemon/reply-handler.js +176 -0
  57. package/dist/daemon/reply-handler.js.map +1 -0
  58. package/dist/daemon/scopes.d.ts +62 -0
  59. package/dist/daemon/scopes.d.ts.map +1 -0
  60. package/dist/daemon/scopes.js +113 -0
  61. package/dist/daemon/scopes.js.map +1 -0
  62. package/dist/daemon/server.d.ts +8 -0
  63. package/dist/daemon/server.d.ts.map +1 -0
  64. package/dist/daemon/server.js +286 -0
  65. package/dist/daemon/server.js.map +1 -0
  66. package/dist/shared/config.d.ts +42 -0
  67. package/dist/shared/config.d.ts.map +1 -0
  68. package/dist/shared/config.js +42 -0
  69. package/dist/shared/config.js.map +1 -0
  70. package/dist/shared/signing.d.ts +13 -0
  71. package/dist/shared/signing.d.ts.map +1 -0
  72. package/dist/shared/signing.js +46 -0
  73. package/dist/shared/signing.js.map +1 -0
  74. package/docs/agent-comms.md +277 -0
  75. package/docs/federation-flow.md +407 -0
  76. package/docs/quickstart.md +241 -0
  77. package/docs/scopes.md +198 -0
  78. package/package.json +57 -0
  79. package/scripts/install-skills.js +32 -0
  80. package/skills/ogp/SKILL.md +235 -0
  81. package/skills/ogp-agent-comms/SKILL.md +345 -0
  82. package/skills/ogp-expose/SKILL.md +281 -0
@@ -0,0 +1,235 @@
1
+ ---
2
+ skill_name: ogp
3
+ version: 0.1.0
4
+ description: Manage OGP (Open Gateway Protocol) daemon and federation
5
+ trigger: Use when the user wants to configure, start, or manage the OGP federation daemon
6
+ ---
7
+ ## Prerequisites
8
+
9
+ The OGP daemon must be installed. If you see errors like 'ogp: command not found', install it first:
10
+
11
+ ```bash
12
+ npm install -g github:dp-pcs/ogp --ignore-scripts
13
+ ogp-install-skills
14
+ ogp setup
15
+ ```
16
+
17
+ Full documentation: https://github.com/dp-pcs/ogp
18
+
19
+
20
+
21
+ # OGP Federation Management
22
+
23
+ This skill helps manage the OGP (Open Gateway Protocol) daemon, which adds federation capability to OpenClaw.
24
+
25
+ ## When to Use
26
+
27
+ Use this skill when:
28
+ - User wants to set up OGP federation
29
+ - User wants to start/stop the OGP daemon
30
+ - User wants to manage federated peers (list, approve, reject)
31
+ - User wants to send messages to federated peers
32
+ - User asks about OGP status or configuration
33
+
34
+ ## Commands
35
+
36
+ ### Setup
37
+
38
+ ```bash
39
+ ogp setup
40
+ ```
41
+
42
+ Interactive setup wizard. Prompts for:
43
+ - Daemon port (default: 18790)
44
+ - OpenClaw URL (default: http://localhost:18789)
45
+ - OpenClaw API token
46
+ - Gateway URL (your public URL)
47
+ - Display name
48
+ - Email
49
+
50
+ ### Start/Stop Daemon
51
+
52
+ ```bash
53
+ # Start daemon
54
+ ogp start
55
+
56
+ # Stop daemon
57
+ ogp stop
58
+
59
+ # Check status
60
+ ogp status
61
+ ```
62
+
63
+ ### Federation Management
64
+
65
+ ```bash
66
+ # List all peers
67
+ ogp federation list
68
+
69
+ # List only pending requests
70
+ ogp federation list --status pending
71
+
72
+ # List approved peers
73
+ ogp federation list --status approved
74
+
75
+ # Request federation with another OGP instance
76
+ ogp federation request <peer-gateway-url> <peer-id>
77
+
78
+ # Approve a pending request
79
+ ogp federation approve <peer-id>
80
+
81
+ # Reject a pending request
82
+ ogp federation reject <peer-id>
83
+
84
+ # Send message to a peer
85
+ ogp federation send <peer-id> message '{"text":"Hello from OGP!"}'
86
+
87
+ # Send task request
88
+ ogp federation send <peer-id> task-request '{"taskType":"analysis","description":"Analyze logs"}'
89
+ ```
90
+
91
+ ### Expose Daemon
92
+
93
+ ```bash
94
+ # Expose via cloudflared (default)
95
+ ogp expose
96
+
97
+ # Expose via ngrok
98
+ ogp expose --method ngrok
99
+ ```
100
+
101
+ ## Common Workflows
102
+
103
+ ### Initial Setup
104
+
105
+ 1. Run `ogp setup` to configure
106
+ 2. Run `ogp expose` to get a public URL
107
+ 3. Update gateway URL in config if needed
108
+ 4. Run `ogp start` to start daemon
109
+
110
+ ### Adding a Peer
111
+
112
+ 1. Get peer's gateway URL
113
+ 2. Run `ogp federation request <peer-url> <peer-id>`
114
+ 3. Wait for peer to approve
115
+ 4. Verify with `ogp federation list --status approved`
116
+
117
+ ### Receiving Federation Requests
118
+
119
+ When another OGP instance sends a federation request:
120
+ 1. You'll see it in `ogp federation list --status pending`
121
+ 2. Approve with `ogp federation approve <peer-id>`
122
+ 3. Or reject with `ogp federation reject <peer-id>`
123
+
124
+ ### Approving with Scope Grants (v0.2.0)
125
+
126
+ Control what intents and topics each peer can access:
127
+
128
+ ```bash
129
+ # Approve with specific scopes
130
+ ogp federation approve alice \
131
+ --intents message,agent-comms \
132
+ --rate 100/3600 \
133
+ --topics memory-management,task-delegation
134
+
135
+ # View peer's scopes
136
+ ogp federation scopes alice
137
+
138
+ # Update grants for existing peer
139
+ ogp federation grant alice \
140
+ --intents agent-comms \
141
+ --topics project-planning
142
+ ```
143
+
144
+ ### Sending Messages
145
+
146
+ Once peers are approved:
147
+
148
+ ```bash
149
+ # Simple message
150
+ ogp federation send alice message '{"text":"Hi Alice!"}'
151
+
152
+ # Agent-comms (v0.2.0) - agent-to-agent communication
153
+ ogp federation agent alice memory-management "How do you persist context?"
154
+ ogp federation agent alice task-delegation "Can you help with code review?" --priority high
155
+
156
+ # Task request
157
+ ogp federation send bob task-request '{
158
+ "taskType": "code-review",
159
+ "description": "Review PR #123",
160
+ "parameters": {"repo": "openclaw", "pr": 123}
161
+ }'
162
+
163
+ # Status update
164
+ ogp federation send charlie status-update '{
165
+ "status": "completed",
166
+ "message": "Task finished"
167
+ }'
168
+ ```
169
+
170
+ ### Configuring Response Policies
171
+
172
+ Control how your agent responds to incoming messages:
173
+
174
+ ```bash
175
+ # View policies
176
+ ogp agent-comms policies
177
+ ogp agent-comms policies alice
178
+
179
+ # Configure per-peer policies
180
+ ogp agent-comms configure alice --topics "memory-management" --level full
181
+
182
+ # View activity log
183
+ ogp agent-comms activity
184
+ ```
185
+
186
+ For detailed response policy setup, use the `/ogp-agent-comms` skill.
187
+
188
+ ## Configuration
189
+
190
+ Config file: `~/.ogp/config.json`
191
+
192
+ ```json
193
+ {
194
+ "daemonPort": 18790,
195
+ "openclawUrl": "http://localhost:18789",
196
+ "openclawToken": "your-token",
197
+ "gatewayUrl": "https://your-public-url.com",
198
+ "displayName": "Your Name",
199
+ "email": "you@example.com",
200
+ "stateDir": "~/.ogp"
201
+ }
202
+ ```
203
+
204
+ ## Troubleshooting
205
+
206
+ ### Daemon won't start
207
+ - Check if port 18790 is already in use
208
+ - Verify OpenClaw is running and accessible
209
+ - Check `~/.ogp/config.json` exists and is valid
210
+
211
+ ### Federation request fails
212
+ - Verify peer's gateway URL is accessible
213
+ - Check peer's OGP daemon is running
214
+ - Ensure network connectivity
215
+
216
+ ### Messages not reaching OpenClaw
217
+ - Verify OpenClaw token is correct
218
+ - Check OpenClaw URL is accessible
219
+ - Look for errors in daemon logs
220
+
221
+ ## Architecture
222
+
223
+ The OGP daemon:
224
+ - Runs on port 18790 (configurable)
225
+ - Uses Ed25519 for signing messages
226
+ - Exposes `/.well-known/ogp` for discovery
227
+ - Stores peers in `~/.ogp/peers.json`
228
+ - Notifies OpenClaw via POST to `/api/system-event`
229
+
230
+ ## Security
231
+
232
+ - All messages are signed with Ed25519
233
+ - Peer public keys are verified on every message
234
+ - Only approved peers can send messages
235
+ - Signatures prevent tampering and impersonation
@@ -0,0 +1,345 @@
1
+ ---
2
+ skill_name: ogp-agent-comms
3
+ version: 0.1.0
4
+ description: Interactive wizard to configure agent-to-agent communication policies
5
+ trigger: Use when the user wants to configure how their agent responds to incoming agent-comms messages from federated peers
6
+ ---
7
+ ## Prerequisites
8
+
9
+ The OGP daemon must be installed. If you see errors like 'ogp: command not found', install it first:
10
+
11
+ ```bash
12
+ npm install -g github:dp-pcs/ogp --ignore-scripts
13
+ ogp-install-skills
14
+ ogp setup
15
+ ```
16
+
17
+ Full documentation: https://github.com/dp-pcs/ogp
18
+
19
+
20
+
21
+ # OGP Agent-Comms Configuration
22
+
23
+ This skill is an interactive wizard for configuring how your agent handles incoming agent-comms messages from federated peers.
24
+
25
+ ## When to Use
26
+
27
+ Use this skill when:
28
+ - User wants to set up agent-to-agent communication policies
29
+ - User wants to configure what topics their agent can discuss with peers
30
+ - User wants different policies for different peers
31
+ - User says things like "configure agent comms", "set up agent communication", "how should my agent respond to X"
32
+
33
+ ## Overview
34
+
35
+ Agent-comms policies control HOW your agent responds to incoming messages (separate from scope grants which control WHETHER messages are allowed).
36
+
37
+ **Two layers:**
38
+ 1. **Scope grants** (doorman) - Controls which intents/topics are ALLOWED
39
+ 2. **Response policies** (this skill) - Controls HOW your agent RESPONDS
40
+
41
+ ## Interactive Flow
42
+
43
+ When invoked, guide the user through this flow:
44
+
45
+ ### Step 1: Check Prerequisites
46
+
47
+ ```bash
48
+ # Verify OGP is running and has peers
49
+ ogp status
50
+ ogp federation list --status approved
51
+ ```
52
+
53
+ If no approved peers, inform the user they need to federate first.
54
+
55
+ ### Step 2: Show Current Configuration
56
+
57
+ ```bash
58
+ # Show current policies
59
+ ogp agent-comms policies
60
+ ```
61
+
62
+ ### Step 3: Ask What to Configure
63
+
64
+ Present options:
65
+ 1. **Global defaults** - Apply to all peers (current and future)
66
+ 2. **Specific peer(s)** - Configure individual peers
67
+ 3. **View current policies** - Just show what's configured
68
+
69
+ ### Step 4: For Specific Peers - Multi-Select
70
+
71
+ If configuring specific peers, show the list and allow multi-select:
72
+
73
+ ```bash
74
+ # List peers for selection
75
+ ogp federation list --status approved --json
76
+ ```
77
+
78
+ Example interaction:
79
+ ```
80
+ Select peers to configure:
81
+ [x] Stanislav (giving-produces-microphone-mild.trycloudflare.com)
82
+ [ ] Leonardo (leo-gateway.example.com)
83
+ [x] Alice (alice.ngrok-free.app)
84
+
85
+ Selected: Stanislav, Alice
86
+ ```
87
+
88
+ ### Step 5: Configure Topics
89
+
90
+ Ask which topics the agent should engage on:
91
+
92
+ ```
93
+ Which topics should your agent discuss with these peers?
94
+ [x] memory-management
95
+ [x] testing
96
+ [x] general
97
+ [ ] calendar (add custom)
98
+ [ ] personal (add custom)
99
+
100
+ Add custom topic: _______
101
+ ```
102
+
103
+ ### Step 6: Configure Response Level
104
+
105
+ For each topic (or all topics), set the response level:
106
+
107
+ | Level | Behavior |
108
+ |-------|----------|
109
+ | `full` | Respond openly, share details |
110
+ | `summary` | High-level responses only, no specifics |
111
+ | `escalate` | Ask human before responding |
112
+ | `deny` | Politely decline to discuss |
113
+
114
+ ### Step 7: Save Configuration
115
+
116
+ ```bash
117
+ # Save policies for selected peers
118
+ ogp agent-comms configure <peer-id> \
119
+ --topics "memory-management,testing,general" \
120
+ --level full
121
+
122
+ # Or set global defaults
123
+ ogp agent-comms configure --global \
124
+ --topics "general,testing" \
125
+ --level summary
126
+ ```
127
+
128
+ ### Step 8: Confirm and Show Result
129
+
130
+ ```bash
131
+ # Show the updated configuration
132
+ ogp agent-comms policies <peer-id>
133
+ ```
134
+
135
+ ## CLI Commands
136
+
137
+ ### View All Policies
138
+
139
+ ```bash
140
+ ogp agent-comms policies
141
+ ```
142
+
143
+ Shows global defaults and per-peer overrides.
144
+
145
+ ### View Peer Policy
146
+
147
+ ```bash
148
+ ogp agent-comms policies <peer-id>
149
+ ```
150
+
151
+ Shows effective policy for a specific peer (global + overrides).
152
+
153
+ ### Configure Global Defaults
154
+
155
+ ```bash
156
+ ogp agent-comms configure --global \
157
+ --topics "general,testing" \
158
+ --level summary \
159
+ --notes "Default: be helpful but don't overshare"
160
+ ```
161
+
162
+ ### Configure Specific Peer
163
+
164
+ ```bash
165
+ ogp agent-comms configure <peer-id> \
166
+ --topics "memory-management,testing,general" \
167
+ --level full \
168
+ --notes "Stan is a trusted collaborator"
169
+ ```
170
+
171
+ ### Configure Multiple Peers at Once
172
+
173
+ ```bash
174
+ ogp agent-comms configure stan,leonardo,alice \
175
+ --topics "testing" \
176
+ --level full
177
+ ```
178
+
179
+ ### Add Topic to Existing Policy
180
+
181
+ ```bash
182
+ ogp agent-comms add-topic <peer-id> calendar --level escalate
183
+ ```
184
+
185
+ ### Remove Topic
186
+
187
+ ```bash
188
+ ogp agent-comms remove-topic <peer-id> personal
189
+ ```
190
+
191
+ ### Reset to Global Defaults
192
+
193
+ ```bash
194
+ ogp agent-comms reset <peer-id>
195
+ ```
196
+
197
+ ## Policy Inheritance
198
+
199
+ 1. **Global defaults** apply to all peers
200
+ 2. **Per-peer policies** override globals for that peer
201
+ 3. **Topic-level settings** are the most specific
202
+
203
+ Example:
204
+ ```
205
+ Global: { "general": "summary", "testing": "full" }
206
+ Stan: { "memory-management": "full" }
207
+
208
+ Effective for Stan:
209
+ - general: summary (from global)
210
+ - testing: full (from global)
211
+ - memory-management: full (from Stan-specific)
212
+ ```
213
+
214
+ ## Response Policy Schema
215
+
216
+ Stored in `~/.ogp/peers.json` under each peer:
217
+
218
+ ```json
219
+ {
220
+ "id": "stan:18790",
221
+ "displayName": "Stanislav",
222
+ "responsePolicy": {
223
+ "memory-management": {
224
+ "level": "full",
225
+ "notes": "Stan is working on similar architecture"
226
+ },
227
+ "testing": {
228
+ "level": "full"
229
+ },
230
+ "calendar": {
231
+ "level": "escalate",
232
+ "notes": "Ask me before sharing schedule"
233
+ }
234
+ }
235
+ }
236
+ ```
237
+
238
+ Global defaults in `~/.ogp/config.json`:
239
+
240
+ ```json
241
+ {
242
+ "agentComms": {
243
+ "globalPolicy": {
244
+ "general": { "level": "summary" },
245
+ "testing": { "level": "full" }
246
+ },
247
+ "defaultLevel": "summary",
248
+ "activityLog": true
249
+ }
250
+ }
251
+ ```
252
+
253
+ ## How Your Agent Uses These Policies
254
+
255
+ When an agent-comms message arrives:
256
+
257
+ 1. **Doorman** checks if the intent/topic is allowed (scope grants)
258
+ 2. **Your agent** receives the message via notification
259
+ 3. **Your agent** looks up the response policy:
260
+ - Check peer-specific policy for this topic
261
+ - Fall back to global policy for this topic
262
+ - Fall back to defaultLevel
263
+ 4. **Your agent** responds according to the level:
264
+ - `full`: Engage openly
265
+ - `summary`: Brief, high-level response
266
+ - `escalate`: "Let me check with my human and get back to you"
267
+ - `deny`: "I'm not able to discuss that topic"
268
+
269
+ ## Activity Logging
270
+
271
+ When enabled, all agent-comms interactions are logged:
272
+
273
+ ```bash
274
+ # View activity log
275
+ ogp agent-comms activity
276
+
277
+ # View for specific peer
278
+ ogp agent-comms activity <peer-id>
279
+
280
+ # View last N entries
281
+ ogp agent-comms activity --last 20
282
+ ```
283
+
284
+ Log format:
285
+ ```
286
+ 2026-03-23 11:52:14 [IN] Stanislav → testing: Hello from Stan!
287
+ 2026-03-23 11:52:15 [OUT] → Stanislav: Hi Stan! Test received successfully.
288
+ 2026-03-23 11:55:22 [IN] Leonardo → calendar: What's David's availability?
289
+ 2026-03-23 11:55:23 [OUT] → Leonardo: [ESCALATED] Checking with David...
290
+ ```
291
+
292
+ ## Example Configurations
293
+
294
+ ### Trusted Collaborator (Full Access)
295
+
296
+ ```bash
297
+ ogp agent-comms configure stan \
298
+ --topics "memory-management,testing,general,code-review" \
299
+ --level full \
300
+ --notes "Trusted peer, full collaboration"
301
+ ```
302
+
303
+ ### Business Contact (Limited)
304
+
305
+ ```bash
306
+ ogp agent-comms configure leonardo \
307
+ --topics "general,status-updates" \
308
+ --level summary \
309
+ --notes "Professional contact, keep it high-level"
310
+ ```
311
+
312
+ ### New Federation (Cautious)
313
+
314
+ ```bash
315
+ ogp agent-comms configure --global \
316
+ --topics "general,testing" \
317
+ --level escalate \
318
+ --notes "Default: check with human for new peers"
319
+ ```
320
+
321
+ ## Troubleshooting
322
+
323
+ ### Agent not following policies
324
+
325
+ 1. Verify the policy is saved:
326
+ ```bash
327
+ ogp agent-comms policies <peer-id>
328
+ ```
329
+
330
+ 2. Check if the topic is in scope grants (doorman):
331
+ ```bash
332
+ ogp federation scopes <peer-id>
333
+ ```
334
+
335
+ 3. Restart daemon to reload config:
336
+ ```bash
337
+ ogp stop && ogp start
338
+ ```
339
+
340
+ ### Policy not taking effect for new peer
341
+
342
+ New peers inherit global defaults. Configure them specifically:
343
+ ```bash
344
+ ogp agent-comms configure <new-peer-id> --topics "..." --level "..."
345
+ ```