@mulmobridge/protocol 0.1.0 → 0.1.1
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.
- package/README.md +63 -0
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# @mulmobridge/protocol
|
|
2
|
+
|
|
3
|
+
Shared types and constants for the [MulmoBridge](https://github.com/receptron/mulmoclaude) chat protocol — the wire-level contract between the chat-service (server) and external bridges (CLI, Telegram, etc.).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @mulmobridge/protocol
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What's included
|
|
12
|
+
|
|
13
|
+
| Export | Description |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `EVENT_TYPES` | Agent SSE event type discriminants (`"text"`, `"error"`, `"session_finished"`, …) |
|
|
16
|
+
| `EventType` | Union type of all event type strings |
|
|
17
|
+
| `CHAT_SOCKET_EVENTS` | Socket.io event names (`"message"`, `"push"`) |
|
|
18
|
+
| `CHAT_SOCKET_PATH` | Socket.io endpoint path (`"/ws/chat"`) |
|
|
19
|
+
| `ChatSocketEvent` | Union type of socket event names |
|
|
20
|
+
| `CHAT_SERVICE_ROUTES` | REST endpoint patterns for the bridge API |
|
|
21
|
+
| `Attachment` | File attachment interface (`mimeType` + base64 `data` + optional `filename`) |
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import {
|
|
27
|
+
EVENT_TYPES,
|
|
28
|
+
CHAT_SOCKET_EVENTS,
|
|
29
|
+
CHAT_SOCKET_PATH,
|
|
30
|
+
type Attachment,
|
|
31
|
+
} from "@mulmobridge/protocol";
|
|
32
|
+
|
|
33
|
+
// Discriminate agent events
|
|
34
|
+
if (event.type === EVENT_TYPES.text) {
|
|
35
|
+
console.log(event.message);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Connect via socket.io
|
|
39
|
+
const socket = io(serverUrl, { path: CHAT_SOCKET_PATH });
|
|
40
|
+
socket.on(CHAT_SOCKET_EVENTS.push, (event) => {
|
|
41
|
+
// handle server push
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Send with attachment
|
|
45
|
+
const attachment: Attachment = {
|
|
46
|
+
mimeType: "image/png",
|
|
47
|
+
data: base64EncodedData,
|
|
48
|
+
};
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Part of the MulmoBridge ecosystem
|
|
52
|
+
|
|
53
|
+
| Package | Description |
|
|
54
|
+
|---|---|
|
|
55
|
+
| **@mulmobridge/protocol** | Wire protocol types and constants (this package) |
|
|
56
|
+
| @mulmobridge/chat-service | Server-side chat service (coming soon) |
|
|
57
|
+
| @mulmobridge/client | Bridge client library (coming soon) |
|
|
58
|
+
| @mulmobridge/cli | CLI bridge (coming soon) |
|
|
59
|
+
| @mulmobridge/telegram | Telegram bridge (coming soon) |
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT — [Receptron Team](https://github.com/receptron)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mulmobridge/protocol",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Shared types and constants for the MulmoBridge protocol",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
-
"dist"
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
16
17
|
],
|
|
17
18
|
"scripts": {
|
|
18
19
|
"build": "tsc",
|