@dp-pcs/ogp 0.3.3 → 0.4.3

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 (112) hide show
  1. package/README.md +317 -61
  2. package/dist/cli/completion.d.ts +5 -0
  3. package/dist/cli/completion.d.ts.map +1 -0
  4. package/dist/cli/completion.js +148 -0
  5. package/dist/cli/completion.js.map +1 -0
  6. package/dist/cli/config.d.ts +3 -0
  7. package/dist/cli/config.d.ts.map +1 -0
  8. package/dist/cli/config.js +207 -0
  9. package/dist/cli/config.js.map +1 -0
  10. package/dist/cli/expose.d.ts.map +1 -1
  11. package/dist/cli/expose.js +20 -13
  12. package/dist/cli/expose.js.map +1 -1
  13. package/dist/cli/federation.d.ts +14 -0
  14. package/dist/cli/federation.d.ts.map +1 -1
  15. package/dist/cli/federation.js +347 -23
  16. package/dist/cli/federation.js.map +1 -1
  17. package/dist/cli/project.d.ts +4 -3
  18. package/dist/cli/project.d.ts.map +1 -1
  19. package/dist/cli/project.js +34 -24
  20. package/dist/cli/project.js.map +1 -1
  21. package/dist/cli/setup.d.ts +23 -0
  22. package/dist/cli/setup.d.ts.map +1 -1
  23. package/dist/cli/setup.js +560 -32
  24. package/dist/cli/setup.js.map +1 -1
  25. package/dist/cli.js +358 -35
  26. package/dist/cli.js.map +1 -1
  27. package/dist/daemon/agent-comms.d.ts.map +1 -1
  28. package/dist/daemon/agent-comms.js +15 -10
  29. package/dist/daemon/agent-comms.js.map +1 -1
  30. package/dist/daemon/heartbeat.d.ts +22 -0
  31. package/dist/daemon/heartbeat.d.ts.map +1 -0
  32. package/dist/daemon/heartbeat.js +119 -0
  33. package/dist/daemon/heartbeat.js.map +1 -0
  34. package/dist/daemon/intent-registry.d.ts.map +1 -1
  35. package/dist/daemon/intent-registry.js +19 -10
  36. package/dist/daemon/intent-registry.js.map +1 -1
  37. package/dist/daemon/keypair.d.ts +1 -0
  38. package/dist/daemon/keypair.d.ts.map +1 -1
  39. package/dist/daemon/keypair.js +151 -18
  40. package/dist/daemon/keypair.js.map +1 -1
  41. package/dist/daemon/message-handler.d.ts.map +1 -1
  42. package/dist/daemon/message-handler.js +30 -16
  43. package/dist/daemon/message-handler.js.map +1 -1
  44. package/dist/daemon/notify.d.ts +19 -0
  45. package/dist/daemon/notify.d.ts.map +1 -1
  46. package/dist/daemon/notify.js +376 -73
  47. package/dist/daemon/notify.js.map +1 -1
  48. package/dist/daemon/openclaw-bridge.d.ts +34 -0
  49. package/dist/daemon/openclaw-bridge.d.ts.map +1 -0
  50. package/dist/daemon/openclaw-bridge.js +261 -0
  51. package/dist/daemon/openclaw-bridge.js.map +1 -0
  52. package/dist/daemon/peers.d.ts +21 -0
  53. package/dist/daemon/peers.d.ts.map +1 -1
  54. package/dist/daemon/peers.js +125 -20
  55. package/dist/daemon/peers.js.map +1 -1
  56. package/dist/daemon/projects.d.ts +9 -6
  57. package/dist/daemon/projects.d.ts.map +1 -1
  58. package/dist/daemon/projects.js +30 -20
  59. package/dist/daemon/projects.js.map +1 -1
  60. package/dist/daemon/server.d.ts +17 -0
  61. package/dist/daemon/server.d.ts.map +1 -1
  62. package/dist/daemon/server.js +188 -77
  63. package/dist/daemon/server.js.map +1 -1
  64. package/dist/shared/config.d.ts +52 -1
  65. package/dist/shared/config.d.ts.map +1 -1
  66. package/dist/shared/config.js +18 -11
  67. package/dist/shared/config.js.map +1 -1
  68. package/dist/shared/framework-detection.d.ts +31 -0
  69. package/dist/shared/framework-detection.d.ts.map +1 -0
  70. package/dist/shared/framework-detection.js +91 -0
  71. package/dist/shared/framework-detection.js.map +1 -0
  72. package/dist/shared/help.d.ts +5 -0
  73. package/dist/shared/help.d.ts.map +1 -0
  74. package/dist/shared/help.js +281 -0
  75. package/dist/shared/help.js.map +1 -0
  76. package/dist/shared/meta-config.d.ts +44 -0
  77. package/dist/shared/meta-config.d.ts.map +1 -0
  78. package/dist/shared/meta-config.js +89 -0
  79. package/dist/shared/meta-config.js.map +1 -0
  80. package/dist/shared/migration.d.ts +57 -0
  81. package/dist/shared/migration.d.ts.map +1 -0
  82. package/dist/shared/migration.js +255 -0
  83. package/dist/shared/migration.js.map +1 -0
  84. package/docs/CLI-REFERENCE.md +1361 -0
  85. package/docs/GETTING-STARTED.md +953 -0
  86. package/docs/MIGRATION.md +202 -0
  87. package/docs/MULTI-FRAMEWORK-DEMO.md +352 -0
  88. package/docs/MULTI-FRAMEWORK-DESIGN.md +378 -0
  89. package/docs/MULTI-FRAMEWORK-IMPL.md +197 -0
  90. package/docs/case-studies/CRASH_RESOLUTION_20260407.md +190 -0
  91. package/docs/case-studies/OpenClaw_Hermes_Status_Report_20260407.md +142 -0
  92. package/docs/case-studies/OpenClaw_Stability_Fix_Summary.md +209 -0
  93. package/docs/case-studies/README.md +40 -0
  94. package/docs/case-studies/crash_observations.md +250 -0
  95. package/docs/cloudflare-named-tunnel-setup.md +126 -0
  96. package/docs/federation-flow.md +27 -37
  97. package/docs/hermes-implementation-checklist.md +4 -0
  98. package/docs/project-intent-testing.md +97 -0
  99. package/docs/quickstart.md +12 -4
  100. package/docs/rendezvous.md +13 -14
  101. package/docs/scopes.md +13 -13
  102. package/package.json +12 -6
  103. package/scripts/completion.bash +123 -0
  104. package/scripts/completion.zsh +372 -0
  105. package/scripts/install-skills.js +19 -1
  106. package/scripts/test-migration-execute.js +74 -0
  107. package/scripts/test-migration.js +42 -0
  108. package/scripts/test-project-intents.mjs +614 -0
  109. package/skills/ogp/SKILL.md +197 -64
  110. package/skills/ogp-agent-comms/SKILL.md +107 -41
  111. package/skills/ogp-expose/SKILL.md +183 -25
  112. package/skills/ogp-project/SKILL.md +110 -88
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  skill_name: ogp-expose
3
- version: 0.2.1
4
- description: Expose OGP daemon via public tunnel (cloudflared/ngrok). Automates tunnel setup so federated peers can reach your gateway from anywhere on the internet, without exposing your real IP address.
3
+ version: 0.4.0
4
+ description: Expose OGP via a public HTTPS endpoint, usually a stable Cloudflare hostname or named tunnel. Use when the user wants to verify or fix gateway reachability, align `gatewayUrl` with the real public endpoint, or set up temporary cloudflared/ngrok exposure for testing.
5
5
  trigger: Use when the user wants to expose their OGP daemon to the internet, get a public URL for federation, or set up a tunnel for peer discovery.
6
6
  requires:
7
7
  bins:
@@ -10,9 +10,12 @@ requires:
10
10
  - cloudflared
11
11
  - ngrok
12
12
  state_paths:
13
+ - ~/.ogp-meta/config.json
13
14
  - ~/.ogp/config.json
15
+ - ~/.ogp-hermes/config.json
14
16
  - ~/.ogp/tunnel.pid
15
17
  - ~/.ogp/tunnel.log
18
+ - ~/.cloudflared/config.yml
16
19
  install: npm install -g @dp-pcs/ogp
17
20
  docs: https://github.com/dp-pcs/ogp
18
21
  ---
@@ -21,9 +24,10 @@ requires:
21
24
 
22
25
  **Tunnels are optional — and often more private than alternatives.**
23
26
 
24
- `ogp expose` uses cloudflared or ngrok to create a secure public URL for your OGP daemon. This is one approach, not the only approach. You can expose your gateway however you prefer:
27
+ `ogp expose` can create a temporary public URL for your OGP daemon. This is one approach, not the only approach. You can expose your gateway however you prefer:
25
28
 
26
- - **Cloudflared/ngrok tunnel** (default) — your real IP is never exposed; traffic routes through the tunnel provider's infrastructure
29
+ - **Named Cloudflare tunnel / stable HTTPS hostname** (preferred) — long-lived canonical URL for federation
30
+ - **Cloudflared/ngrok temporary tunnel** — useful for ad hoc testing
27
31
  - **Reverse proxy** (nginx, Caddy, etc.) — if you have a server with a static IP
28
32
  - **VPN/Tailscale** — federate only with peers on the same network
29
33
  - **Any publicly reachable URL** — update `gatewayUrl` in `~/.ogp/config.json` manually
@@ -38,6 +42,7 @@ The OGP daemon must be installed. If you see errors like 'ogp: command not found
38
42
  npm install -g @dp-pcs/ogp
39
43
  ogp-install-skills
40
44
  ogp setup
45
+ ogp config show
41
46
  ```
42
47
 
43
48
  Full documentation: https://github.com/dp-pcs/ogp
@@ -46,15 +51,145 @@ Full documentation: https://github.com/dp-pcs/ogp
46
51
 
47
52
  # OGP Expose - Public Tunnel Setup
48
53
 
49
- This skill helps expose the OGP daemon to the internet using cloudflared or ngrok tunnels.
54
+ This skill helps expose the OGP daemon to the internet and, more importantly, confirm that the public discovery endpoint matches the intended framework identity.
50
55
 
51
56
  ## When to Use
52
57
 
53
58
  Use this skill when:
54
59
  - User wants to make their OGP daemon publicly accessible
55
60
  - User needs a public URL for federation
56
- - User wants to set up tunneling for OGP
61
+ - User wants to set up or verify a stable Cloudflare route
57
62
  - User is testing OGP federation remotely
63
+ - User suspects `gatewayUrl` or tunnel config is stale or mismatched
64
+
65
+ ## Framework Selection
66
+
67
+ If multiple frameworks are enabled, choose the framework first:
68
+
69
+ ```bash
70
+ ogp config show
71
+ ogp --for openclaw status
72
+ ogp --for hermes status
73
+ ```
74
+
75
+ Use `--for <framework>` on all exposure and verification commands when the target is not obvious.
76
+
77
+ ## Guided Wizard
78
+
79
+ Follow this decision order every time:
80
+
81
+ 1. **Cloudflare named tunnel + stable hostname** if the user has a domain on Cloudflare or wants a durable production URL.
82
+ 2. **ngrok** if they need a stable-enough ad hoc URL and already have ngrok/auth configured.
83
+ 3. **Temporary Cloudflare quick tunnel** only for fast testing when the URL can change on restart.
84
+
85
+ Ask or determine these three facts first:
86
+
87
+ 1. Which framework is being exposed (`openclaw`, `hermes`, or another configured framework)?
88
+ 2. Does the user want a **stable long-lived URL** or just a **temporary test URL**?
89
+ 3. Do they already have **Cloudflare DNS/domain control** or **ngrok auth** available?
90
+
91
+ Then route them through exactly one branch below instead of mixing options.
92
+
93
+ ## Branch 1: Stable Cloudflare Named Tunnel
94
+
95
+ Choose this when the user wants the recommended path.
96
+
97
+ Checklist:
98
+
99
+ 1. Confirm the framework and its daemon port.
100
+ 2. Choose the canonical hostname that should become `gatewayUrl`.
101
+ 3. Create or verify the named tunnel.
102
+ 4. Route DNS to the tunnel.
103
+ 5. Point ingress at the correct local daemon port.
104
+ 6. Set `gatewayUrl` to the same public hostname.
105
+ 7. Verify local card, public card, and config all agree.
106
+
107
+ Primary repo doc:
108
+
109
+ - `docs/cloudflare-named-tunnel-setup.md`
110
+
111
+ Use that doc as the copy-paste path instead of rewriting the steps from scratch.
112
+
113
+ Success criteria:
114
+
115
+ - The public `/.well-known/ogp` card loads.
116
+ - Its `gatewayUrl` matches the intended hostname.
117
+ - Its public key matches the local daemon card.
118
+
119
+ ## Branch 2: ngrok
120
+
121
+ Choose this when the user wants something faster than named Cloudflare but more intentional than a throwaway quick tunnel.
122
+
123
+ Checklist:
124
+
125
+ 1. Confirm ngrok is installed and authenticated.
126
+ 2. Start the tunnel against the correct local daemon port.
127
+ 3. Capture the HTTPS URL.
128
+ 4. Update `gatewayUrl` to that URL only if it is the intended endpoint for current federation.
129
+ 5. Verify the public `/.well-known/ogp` card.
130
+
131
+ Use this command path:
132
+
133
+ ```bash
134
+ ogp --for openclaw expose --method ngrok
135
+ ```
136
+
137
+ ## Branch 3: Temporary Cloudflare Quick Tunnel
138
+
139
+ Choose this only for short-lived testing.
140
+
141
+ Checklist:
142
+
143
+ 1. Start the quick tunnel on the correct daemon port.
144
+ 2. Copy the temporary HTTPS URL.
145
+ 3. Warn that it changes on restart.
146
+ 4. Update `gatewayUrl` only if the user is intentionally federating against this temporary URL.
147
+ 5. Verify the public `/.well-known/ogp` card before testing federation.
148
+
149
+ Use this command path:
150
+
151
+ ```bash
152
+ ogp --for openclaw expose
153
+ ```
154
+
155
+ ## Verification Flow
156
+
157
+ Always end with this verification sequence:
158
+
159
+ ```bash
160
+ curl -s http://127.0.0.1:<daemon-port>/.well-known/ogp
161
+ curl -s https://your-public-hostname/.well-known/ogp
162
+ ```
163
+
164
+ Confirm:
165
+
166
+ 1. Public key matches local.
167
+ 2. Public `gatewayUrl` matches config `gatewayUrl`.
168
+ 3. The framework/port behind the hostname is the one the user intended.
169
+
170
+ If any of those disagree, do not treat the gateway as ready for federation.
171
+
172
+ ## Recommended Production Baseline
173
+
174
+ Prefer one stable HTTPS hostname per framework:
175
+
176
+ - OpenClaw: `https://ogp.example.com`
177
+ - Hermes: `https://hermes.example.com`
178
+
179
+ Those hostnames should terminate at a named Cloudflare tunnel or equivalent reverse proxy and forward to the local daemon port for that framework.
180
+
181
+ After any tunnel or routing change, verify all three values agree:
182
+
183
+ 1. Local daemon discovery card
184
+ 2. Public discovery card
185
+ 3. `gatewayUrl` in the framework config
186
+
187
+ ```bash
188
+ curl -s http://127.0.0.1:18790/.well-known/ogp
189
+ curl -s https://ogp.example.com/.well-known/ogp
190
+ ```
191
+
192
+ The public key and `gatewayUrl` should match. If they do not, do not federate yet.
58
193
 
59
194
  ## Prerequisites
60
195
 
@@ -93,12 +228,12 @@ Sign up at https://ngrok.com and get your auth token:
93
228
  ngrok config add-authtoken <your-token>
94
229
  ```
95
230
 
96
- ## Usage
231
+ ## Command Reference
97
232
 
98
- ### Expose with Cloudflared (Default)
233
+ ### Temporary Cloudflare Quick Tunnel
99
234
 
100
235
  ```bash
101
- ogp expose
236
+ ogp --for openclaw expose
102
237
  ```
103
238
 
104
239
  This will:
@@ -108,14 +243,14 @@ This will:
108
243
 
109
244
  **Update your config:**
110
245
  ```bash
111
- # Edit ~/.ogp/config.json
112
- # Set "gatewayUrl" to the URL shown by cloudflared
246
+ # Edit the correct framework config
247
+ # Set "gatewayUrl" to the URL shown by cloudflared only if this temporary URL is the intended canonical endpoint
113
248
  ```
114
249
 
115
- ### Expose with ngrok
250
+ ### ngrok Tunnel
116
251
 
117
252
  ```bash
118
- ogp expose --method ngrok
253
+ ogp --for openclaw expose --method ngrok
119
254
  ```
120
255
 
121
256
  This will:
@@ -129,9 +264,9 @@ This will:
129
264
  # Set "gatewayUrl" to the ngrok URL
130
265
  ```
131
266
 
132
- ## Complete Setup Workflow
267
+ ## Worked Flows
133
268
 
134
- ### First-time Setup
269
+ ### Temporary Exposure Flow
135
270
 
136
271
  1. **Run OGP setup:**
137
272
  ```bash
@@ -141,12 +276,12 @@ This will:
141
276
 
142
277
  2. **Start the daemon:**
143
278
  ```bash
144
- ogp start
279
+ ogp --for openclaw start
145
280
  ```
146
281
 
147
282
  3. **In a new terminal, expose the daemon:**
148
283
  ```bash
149
- ogp expose
284
+ ogp --for openclaw expose
150
285
  ```
151
286
 
152
287
  4. **Copy the public URL** shown by cloudflared/ngrok
@@ -160,7 +295,7 @@ This will:
160
295
  6. **Restart the daemon:**
161
296
  ```bash
162
297
  # Stop with Ctrl+C in the daemon terminal
163
- ogp start
298
+ ogp --for openclaw start
164
299
  ```
165
300
 
166
301
  7. **Verify the setup:**
@@ -169,7 +304,7 @@ This will:
169
304
  curl https://your-tunnel-url/.well-known/ogp
170
305
  ```
171
306
 
172
- ### Permanent Setup with Cloudflared Named Tunnel
307
+ ### Stable Named Tunnel Flow
173
308
 
174
309
  For production use, create a permanent cloudflared tunnel:
175
310
 
@@ -190,16 +325,32 @@ credentials-file: ~/.cloudflared/<tunnel-id>.json
190
325
  ingress:
191
326
  - hostname: ogp.yourdomain.com
192
327
  service: http://localhost:18790
328
+ - hostname: hermes.yourdomain.com
329
+ service: http://localhost:18793
193
330
  - service: http_status:404
194
331
  EOF
195
332
 
196
333
  # Run tunnel
197
- cloudflared tunnel run ogp-daemon
334
+ cloudflared tunnel run sarcastek-backend
198
335
  ```
199
336
 
200
- ## Comparison: Cloudflared vs ngrok
337
+ Then make sure each framework config uses its own canonical hostname:
338
+
339
+ ```json
340
+ {
341
+ "gatewayUrl": "https://ogp.yourdomain.com"
342
+ }
343
+ ```
201
344
 
202
- ### Cloudflared
345
+ ```json
346
+ {
347
+ "gatewayUrl": "https://hermes.yourdomain.com"
348
+ }
349
+ ```
350
+
351
+ ## Selection Notes
352
+
353
+ ### Cloudflared / Stable Hostname
203
354
  **Pros:**
204
355
  - Free, unlimited usage
205
356
  - No signup required for temporary tunnels
@@ -228,12 +379,19 @@ cloudflared tunnel run ogp-daemon
228
379
  ### Tunnel won't start
229
380
  - **Cloudflared not found:** Install cloudflared
230
381
  - **ngrok not found:** Install ngrok and configure auth token
231
- - **Port already in use:** Stop other services on port 18790
382
+ - **Port already in use:** Verify the framework's daemon port and stop stale listeners
383
+
384
+ ### Public URL resolves but serves the wrong framework
385
+ - Check `ogp config show`
386
+ - Check the relevant framework config's `gatewayUrl`
387
+ - Verify local discovery card on the framework port
388
+ - Verify Cloudflare ingress routes the hostname to the expected local port
389
+ - If you recently switched from a temporary tunnel, remove stale fields like old temporary `gateway.publicUrl` overrides and keep only the canonical `gatewayUrl`
232
390
 
233
391
  ### Can't access public URL
234
392
  - Check firewall settings
235
- - Verify daemon is running (`ogp status`)
236
- - Test locally first: `curl http://localhost:18790/.well-known/ogp`
393
+ - Verify daemon is running (`ogp --for <framework> status`)
394
+ - Test locally first: `curl http://localhost:<port>/.well-known/ogp`
237
395
 
238
396
  ### Tunnel disconnects frequently
239
397
  - Check internet connection