@mulmobridge/protocol 0.1.0 → 0.1.2

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 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](https://www.npmjs.com/package/@mulmobridge/chat-service) | Server-side chat service |
57
+ | [@mulmobridge/client](https://www.npmjs.com/package/@mulmobridge/client) | Bridge client library |
58
+ | [@mulmobridge/cli](https://www.npmjs.com/package/@mulmobridge/cli) | CLI bridge |
59
+ | [@mulmobridge/telegram](https://www.npmjs.com/package/@mulmobridge/telegram) | Telegram bridge |
60
+
61
+ ## License
62
+
63
+ MIT — [Receptron Team](https://github.com/receptron)
package/dist/socket.d.ts CHANGED
@@ -2,5 +2,10 @@ export declare const CHAT_SOCKET_PATH = "/ws/chat";
2
2
  export declare const CHAT_SOCKET_EVENTS: {
3
3
  readonly message: "message";
4
4
  readonly push: "push";
5
+ /** Server → bridge streaming text chunk (Phase C of #268).
6
+ * Emitted during a relay while the agent is generating text.
7
+ * Bridge accumulates chunks for display; the final ack still
8
+ * carries the full response for backward compatibility. */
9
+ readonly textChunk: "textChunk";
5
10
  };
6
11
  export type ChatSocketEvent = (typeof CHAT_SOCKET_EVENTS)[keyof typeof CHAT_SOCKET_EVENTS];
package/dist/socket.js CHANGED
@@ -3,4 +3,9 @@ export const CHAT_SOCKET_PATH = "/ws/chat";
3
3
  export const CHAT_SOCKET_EVENTS = {
4
4
  message: "message",
5
5
  push: "push",
6
+ /** Server → bridge streaming text chunk (Phase C of #268).
7
+ * Emitted during a relay while the agent is generating text.
8
+ * Bridge accumulates chunks for display; the final ack still
9
+ * carries the full response for backward compatibility. */
10
+ textChunk: "textChunk",
6
11
  };
package/package.json CHANGED
@@ -1,38 +1,32 @@
1
1
  {
2
2
  "name": "@mulmobridge/protocol",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Shared types and constants for the MulmoBridge protocol",
5
5
  "type": "module",
6
- "main": "./src/index.ts",
7
- "types": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "import": "./src/index.ts",
11
- "types": "./src/index.ts"
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.js",
13
+ "default": "./dist/index.js"
12
14
  }
13
15
  },
14
16
  "files": [
15
- "dist"
17
+ "dist",
18
+ "README.md"
16
19
  ],
17
20
  "scripts": {
18
21
  "build": "tsc",
19
22
  "prepack": "yarn build",
20
23
  "typecheck": "tsc --noEmit",
21
- "test": "tsx --test test/test_*.ts"
22
- },
23
- "publishConfig": {
24
- "main": "./dist/index.js",
25
- "types": "./dist/index.d.ts",
26
- "exports": {
27
- ".": {
28
- "types": "./dist/index.d.ts",
29
- "import": "./dist/index.js"
30
- }
31
- }
24
+ "test": "tsx --test test/test_*.ts",
25
+ "lint": "eslint src test"
32
26
  },
33
27
  "license": "MIT",
34
28
  "author": "Receptron Team",
35
29
  "devDependencies": {
36
- "typescript": "^5.8.0"
30
+ "typescript": "^6.0.3"
37
31
  }
38
32
  }