@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,281 @@
1
+ ---
2
+ skill_name: ogp-expose
3
+ version: 0.1.0
4
+ description: Expose OGP daemon via public tunnel (cloudflared/ngrok)
5
+ trigger: Use when the user wants to expose their OGP daemon to the internet
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 Expose - Public Tunnel Setup
22
+
23
+ This skill helps expose the OGP daemon to the internet using cloudflared or ngrok tunnels.
24
+
25
+ ## When to Use
26
+
27
+ Use this skill when:
28
+ - User wants to make their OGP daemon publicly accessible
29
+ - User needs a public URL for federation
30
+ - User wants to set up tunneling for OGP
31
+ - User is testing OGP federation remotely
32
+
33
+ ## Prerequisites
34
+
35
+ ### For Cloudflared (Recommended)
36
+
37
+ Install cloudflared:
38
+
39
+ ```bash
40
+ # macOS (Homebrew)
41
+ brew install cloudflared
42
+
43
+ # Linux
44
+ wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
45
+ sudo mv cloudflared-linux-amd64 /usr/local/bin/cloudflared
46
+ sudo chmod +x /usr/local/bin/cloudflared
47
+
48
+ # Windows
49
+ # Download from: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/
50
+ ```
51
+
52
+ ### For ngrok
53
+
54
+ Install ngrok:
55
+
56
+ ```bash
57
+ # macOS (Homebrew)
58
+ brew install ngrok/ngrok/ngrok
59
+
60
+ # Linux/Windows
61
+ # Download from: https://ngrok.com/download
62
+ ```
63
+
64
+ Sign up at https://ngrok.com and get your auth token:
65
+
66
+ ```bash
67
+ ngrok config add-authtoken <your-token>
68
+ ```
69
+
70
+ ## Usage
71
+
72
+ ### Expose with Cloudflared (Default)
73
+
74
+ ```bash
75
+ ogp expose
76
+ ```
77
+
78
+ This will:
79
+ 1. Start a cloudflared tunnel on the daemon port
80
+ 2. Display a public URL (e.g., `https://abc-def-123.trycloudflare.com`)
81
+ 3. Keep the tunnel running until you stop it (Ctrl+C)
82
+
83
+ **Update your config:**
84
+ ```bash
85
+ # Edit ~/.ogp/config.json
86
+ # Set "gatewayUrl" to the URL shown by cloudflared
87
+ ```
88
+
89
+ ### Expose with ngrok
90
+
91
+ ```bash
92
+ ogp expose --method ngrok
93
+ ```
94
+
95
+ This will:
96
+ 1. Start an ngrok tunnel on the daemon port
97
+ 2. Display a public URL (e.g., `https://abc123.ngrok-free.app`)
98
+ 3. Open ngrok web interface at http://127.0.0.1:4040
99
+
100
+ **Update your config:**
101
+ ```bash
102
+ # Edit ~/.ogp/config.json
103
+ # Set "gatewayUrl" to the ngrok URL
104
+ ```
105
+
106
+ ## Complete Setup Workflow
107
+
108
+ ### First-time Setup
109
+
110
+ 1. **Run OGP setup:**
111
+ ```bash
112
+ ogp setup
113
+ ```
114
+ - Enter temporary gateway URL (you'll update this)
115
+
116
+ 2. **Start the daemon:**
117
+ ```bash
118
+ ogp start
119
+ ```
120
+
121
+ 3. **In a new terminal, expose the daemon:**
122
+ ```bash
123
+ ogp expose
124
+ ```
125
+
126
+ 4. **Copy the public URL** shown by cloudflared/ngrok
127
+
128
+ 5. **Update the config:**
129
+ ```bash
130
+ # Edit ~/.ogp/config.json
131
+ # Update "gatewayUrl": "https://your-tunnel-url"
132
+ ```
133
+
134
+ 6. **Restart the daemon:**
135
+ ```bash
136
+ # Stop with Ctrl+C in the daemon terminal
137
+ ogp start
138
+ ```
139
+
140
+ 7. **Verify the setup:**
141
+ ```bash
142
+ # In another terminal or browser, test:
143
+ curl https://your-tunnel-url/.well-known/ogp
144
+ ```
145
+
146
+ ### Permanent Setup with Cloudflared Named Tunnel
147
+
148
+ For production use, create a permanent cloudflared tunnel:
149
+
150
+ ```bash
151
+ # Authenticate
152
+ cloudflared tunnel login
153
+
154
+ # Create tunnel
155
+ cloudflared tunnel create ogp-daemon
156
+
157
+ # Note the tunnel ID shown
158
+
159
+ # Create config file: ~/.cloudflared/config.yml
160
+ cat > ~/.cloudflared/config.yml <<EOF
161
+ tunnel: <tunnel-id>
162
+ credentials-file: ~/.cloudflared/<tunnel-id>.json
163
+
164
+ ingress:
165
+ - hostname: ogp.yourdomain.com
166
+ service: http://localhost:18790
167
+ - service: http_status:404
168
+ EOF
169
+
170
+ # Run tunnel
171
+ cloudflared tunnel run ogp-daemon
172
+ ```
173
+
174
+ ## Comparison: Cloudflared vs ngrok
175
+
176
+ ### Cloudflared
177
+ **Pros:**
178
+ - Free, unlimited usage
179
+ - No signup required for temporary tunnels
180
+ - Fast and reliable
181
+ - Can create permanent tunnels with custom domains
182
+
183
+ **Cons:**
184
+ - URL changes on each restart (unless using named tunnel)
185
+ - Requires Cloudflare account for permanent tunnels
186
+
187
+ ### ngrok
188
+ **Pros:**
189
+ - Web interface at http://127.0.0.1:4040
190
+ - Request inspection and replay
191
+ - Custom domains on paid plans
192
+ - Stable URLs on paid plans
193
+
194
+ **Cons:**
195
+ - Free tier has limitations
196
+ - Requires signup
197
+ - URL changes on free tier
198
+ - Usage limits on free tier
199
+
200
+ ## Troubleshooting
201
+
202
+ ### Tunnel won't start
203
+ - **Cloudflared not found:** Install cloudflared
204
+ - **ngrok not found:** Install ngrok and configure auth token
205
+ - **Port already in use:** Stop other services on port 18790
206
+
207
+ ### Can't access public URL
208
+ - Check firewall settings
209
+ - Verify daemon is running (`ogp status`)
210
+ - Test locally first: `curl http://localhost:18790/.well-known/ogp`
211
+
212
+ ### Tunnel disconnects frequently
213
+ - Check internet connection
214
+ - Use permanent tunnel instead of temporary
215
+ - Consider running tunnel as a system service
216
+
217
+ ## Running as a System Service
218
+
219
+ ### macOS (launchd)
220
+
221
+ Create `~/Library/LaunchAgents/com.ogp.tunnel.plist`:
222
+
223
+ ```xml
224
+ <?xml version="1.0" encoding="UTF-8"?>
225
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
226
+ <plist version="1.0">
227
+ <dict>
228
+ <key>Label</key>
229
+ <string>com.ogp.tunnel</string>
230
+ <key>ProgramArguments</key>
231
+ <array>
232
+ <string>/usr/local/bin/cloudflared</string>
233
+ <string>tunnel</string>
234
+ <string>--url</string>
235
+ <string>http://localhost:18790</string>
236
+ </array>
237
+ <key>RunAtLoad</key>
238
+ <true/>
239
+ <key>KeepAlive</key>
240
+ <true/>
241
+ </dict>
242
+ </plist>
243
+ ```
244
+
245
+ Load the service:
246
+ ```bash
247
+ launchctl load ~/Library/LaunchAgents/com.ogp.tunnel.plist
248
+ ```
249
+
250
+ ### Linux (systemd)
251
+
252
+ Create `/etc/systemd/system/ogp-tunnel.service`:
253
+
254
+ ```ini
255
+ [Unit]
256
+ Description=OGP Cloudflared Tunnel
257
+ After=network.target
258
+
259
+ [Service]
260
+ Type=simple
261
+ User=youruser
262
+ ExecStart=/usr/local/bin/cloudflared tunnel --url http://localhost:18790
263
+ Restart=always
264
+
265
+ [Install]
266
+ WantedBy=multi-user.target
267
+ ```
268
+
269
+ Enable and start:
270
+ ```bash
271
+ sudo systemctl enable ogp-tunnel
272
+ sudo systemctl start ogp-tunnel
273
+ ```
274
+
275
+ ## Security Notes
276
+
277
+ - Tunnel exposes your OGP daemon to the internet
278
+ - Only approved peers can send messages (signature verification)
279
+ - All messages are cryptographically signed
280
+ - Consider IP allowlisting for production use
281
+ - Use HTTPS tunnels only (cloudflared/ngrok handle this)