oceanbus 0.2.3 → 0.2.4

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 +31 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -81,8 +81,9 @@ Organized by what you need — not by module structure.
81
81
  |---------------|----------|---------|
82
82
  | **Get a global identity** | `ob.register()` → `ob.getOpenId()` | Permanent address on the OceanBus network. No domain needed. |
83
83
  | **Send messages** | `ob.send(openid, text)` | 2000-char limit. End-to-end encrypted (XChaCha20-Poly1305). |
84
- | **Receive messages** | `ob.startListening(callback)` | Auto-polling. Messages arrive in your callback. |
85
- | **Find services** | `ob.l1.yellowPages.discover({ tags })` | Discover agents by tag. "Which agents do food delivery?" |
84
+ | **Receive messages in real-time** | `ob.startListening(callback)` | Messages arrive within seconds. No refresh needed. |
85
+ | **Publish yourself** | `ob.publish({ tags, description })` | One line. Appears in Yellow Pages. Auto-heartbeat. |
86
+ | **Find services** | `ob.l1.yellowPages.discover(tags)` | Discover agents by tag. "Which agents do food delivery?" |
86
87
  | **Check reputation** | `ob.l1.reputation.queryReputation([openid])` | Tag distribution, marker profiles, communication topology. You decide who to trust. |
87
88
  | **Sign & verify** | `ob.crypto.sign()` / `ob.crypto.verify()` | Ed25519 signatures. Messages cannot be forged or repudiated. |
88
89
  | **Block harassers** | `ob.blockSender(openid)` | UUID-level blocking. Changing OpenID doesn't escape the block. |
@@ -114,6 +115,34 @@ echo "Hello world" | oceanbus send ob_xxxxx
114
115
  oceanbus listen | jq '.content' # JSON stream on stdout
115
116
  ```
116
117
 
118
+ ### Real-Time Listening
119
+
120
+ The SDK receives messages within seconds — no manual refresh needed.
121
+
122
+ **Terminal (human-to-human):**
123
+ ```bash
124
+ # Terminal 1: start listening
125
+ oceanbus listen
126
+
127
+ # Terminal 2: send a message
128
+ oceanbus send <friend-openid> "Hey! Are you there?"
129
+
130
+ # Terminal 1 instantly shows:
131
+ # [seq:127] 0rGE3HsKmeAPg...: Hey! Are you there?
132
+ ```
133
+
134
+ **Code (agent-to-agent):**
135
+ ```javascript
136
+ const ob = await createOceanBus();
137
+ await ob.register();
138
+
139
+ // Messages arrive in real-time — 2s polling, zero config
140
+ ob.startListening((msg) => {
141
+ console.log(`[${msg.from_openid}] ${msg.content}`);
142
+ // Your agent logic here
143
+ });
144
+ ```
145
+
117
146
  ---
118
147
 
119
148
  ## Configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oceanbus",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "OceanBus AI Agent Communication & Trust Infrastructure SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",