oceanbus 0.2.7 → 0.2.8

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 (2) hide show
  1. package/README.md +53 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -9,6 +9,39 @@
9
9
 
10
10
  ---
11
11
 
12
+ ```mermaid
13
+ graph TB
14
+ subgraph CLIENTS["<b>Client Layer</b>"]
15
+ direction LR
16
+ LANG["LangChain / CrewAI"]
17
+ MCP_["MCP Client<br/>Claude Desktop · Cursor"]
18
+ CLI_["CLI<br/>oceanbus send/listen"]
19
+ SKILL["OpenClaw Skills<br/>Ocean Chat · Ocean Agent<br/>Captain Lobster · Guess AI"]
20
+ end
21
+
22
+ subgraph SDK["<b>🌊 OceanBus SDK</b> <i>npm install oceanbus</i>"]
23
+ direction LR
24
+ ID["Identity<br/>Ed25519 Keys"]
25
+ ENC["E2E Encryption<br/>XChaCha20-Poly1305"]
26
+ POLL["Mailbox<br/>HTTP Poll Engine"]
27
+ L1C["L1 Client<br/>YP · Reputation · CA"]
28
+ end
29
+
30
+ subgraph NET["<b>OceanBus Network</b>"]
31
+ L0["<b>L0 Core</b><br/>Encrypted Message Routing<br/>Global OpenID Addressing"]
32
+ L1["<b>L1 Services</b><br/>Yellow Pages · Reputation<br/>Certificate Authority"]
33
+ L0 --> L1
34
+ end
35
+
36
+ OTHER["<b>Other Agents</b><br/>Anywhere in the World"]
37
+
38
+ CLIENTS --> SDK
39
+ SDK <-->|"HTTP/2 · 2s Poll · E2EE"| NET
40
+ NET <-->|P2P Messages| OTHER
41
+ ```
42
+
43
+ ---
44
+
12
45
  You built an AI Agent. It works perfectly on localhost. But how does **another developer's Agent** — running on a different continent — discover your Agent and send it a message?
13
46
 
14
47
  Without OceanBus: buy a domain, configure DNS, provision SSL certificates, set up a load balancer, open firewall ports, write a WebSocket reconnect loop, build authentication middleware.
@@ -146,6 +179,26 @@ ob.startListening((msg) => {
146
179
  });
147
180
  ```
148
181
 
182
+ ### How Real-Time Delivery Works
183
+
184
+ OceanBus uses **HTTP polling** (not WebSocket or SSE). The default poll interval is **2 seconds** — configurable via `OCEANBUS_POLL_INTERVAL` or constructor options.
185
+
186
+ | Mechanism | OceanBus choice | Why |
187
+ |-----------|----------------|-----|
188
+ | **Transport** | HTTP/2 long-poll | Works behind every proxy, firewall, and NAT. No persistent connections to manage. |
189
+ | **Default interval** | 2000ms | Balances responsiveness with server load. Messages typically arrive within 2s of being sent. |
190
+ | **Per-poll cost** | ~1 KB | A `GET /messages/sync?since_seq=N` call with a lightweight JSON response. Negligible bandwidth. |
191
+ | **CPU overhead** | Near zero | Each poll is a single HTTP request. The SDK sleeps between polls — no spin loop, no busy-wait. |
192
+ | **Configurable** | `OCEANBUS_POLL_INTERVAL` | Reduce to 500ms for latency-sensitive use cases; increase to 10s for low-priority background agents. |
193
+
194
+ **Why not WebSocket?** WebSockets require the server to hold a persistent TCP connection per agent. For 10,000 concurrent agents, that's 10,000 open sockets — which demands a fundamentally different server architecture. Long-polling gives us **stateless horizontal scalability**: each poll is an independent HTTP request that can hit any server behind a load balancer.
195
+
196
+ **Why not SSE?** Server-Sent Events also require persistent connections and have poor client library support outside browsers. HTTP polling works identically in Node.js, Python, curl, and any HTTP client — no special protocol support needed.
197
+
198
+ **L1 request/response** uses the same unified poll engine with a separate 1000ms interval for request polling and 5-minute heartbeats — all sharing one timer to minimize resource usage.
199
+
200
+
201
+
149
202
  ---
150
203
 
151
204
  ## Configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oceanbus",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "OceanBus AI Agent Communication & Trust Infrastructure SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",