@mulmobridge/client 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/dist/client.d.ts +5 -0
- package/dist/client.js +6 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mime.d.ts +4 -3
- package/dist/mime.js +5 -3
- package/package.json +6 -3
package/dist/client.d.ts
CHANGED
|
@@ -22,6 +22,11 @@ export interface BridgeClient {
|
|
|
22
22
|
send(externalChatId: string, text: string, attachments?: Attachment[]): Promise<MessageAck>;
|
|
23
23
|
/** Subscribe to server → bridge async pushes (Phase B of #268). */
|
|
24
24
|
onPush(handler: (event: PushEvent) => void): void;
|
|
25
|
+
/** Subscribe to streaming text chunks during a relay (Phase C of
|
|
26
|
+
* #268). Each chunk is a fragment of the assistant's response,
|
|
27
|
+
* emitted in real time as the agent generates text. The final
|
|
28
|
+
* ack from `send()` still carries the full response. */
|
|
29
|
+
onTextChunk(handler: (chunk: string) => void): void;
|
|
25
30
|
/** Called each time the socket (re-)establishes a connection. */
|
|
26
31
|
onConnect(handler: () => void): void;
|
|
27
32
|
/** Called when the socket disconnects. */
|
package/dist/client.js
CHANGED
|
@@ -33,7 +33,7 @@ export function requireBearerToken() {
|
|
|
33
33
|
`at startup (mode 0600). Start the server with \`yarn dev\` (or\n` +
|
|
34
34
|
`\`npm run dev\`) first, or set MULMOCLAUDE_AUTH_TOKEN to the\n` +
|
|
35
35
|
`same value the server is using.\n`);
|
|
36
|
-
process.exit(1);
|
|
36
|
+
return process.exit(1);
|
|
37
37
|
}
|
|
38
38
|
export function createBridgeClient(opts) {
|
|
39
39
|
const apiUrl = opts.apiUrl ?? process.env.MULMOCLAUDE_API_URL ?? DEFAULT_API_URL;
|
|
@@ -49,6 +49,11 @@ export function createBridgeClient(opts) {
|
|
|
49
49
|
onPush: (handler) => {
|
|
50
50
|
socket.on(CHAT_SOCKET_EVENTS.push, handler);
|
|
51
51
|
},
|
|
52
|
+
onTextChunk: (handler) => {
|
|
53
|
+
socket.on(CHAT_SOCKET_EVENTS.textChunk, (event) => {
|
|
54
|
+
handler(event.text);
|
|
55
|
+
});
|
|
56
|
+
},
|
|
52
57
|
onConnect: (handler) => {
|
|
53
58
|
socket.on("connect", handler);
|
|
54
59
|
},
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { createBridgeClient, requireBearerToken, type MessageAck, type PushEvent, type BridgeClientOptions, type BridgeClient, } from "./client.js";
|
|
2
2
|
export { readBridgeToken, TOKEN_FILE_PATH } from "./token.js";
|
|
3
|
-
export { mimeFromExtension, isImageMime, isPdfMime, isSupportedAttachmentMime, parseDataUrl, buildDataUrl, type ParsedDataUrl, } from "./mime.js";
|
|
3
|
+
export { mimeFromExtension, isImageMime, isPdfMime, isSupportedAttachmentMime, isNativeAttachmentMime, parseDataUrl, buildDataUrl, type ParsedDataUrl, } from "./mime.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @mulmobridge/client — shared socket.io client for all MulmoBridge bridges.
|
|
2
2
|
export { createBridgeClient, requireBearerToken, } from "./client.js";
|
|
3
3
|
export { readBridgeToken, TOKEN_FILE_PATH } from "./token.js";
|
|
4
|
-
export { mimeFromExtension, isImageMime, isPdfMime, isSupportedAttachmentMime, parseDataUrl, buildDataUrl, } from "./mime.js";
|
|
4
|
+
export { mimeFromExtension, isImageMime, isPdfMime, isSupportedAttachmentMime, isNativeAttachmentMime, parseDataUrl, buildDataUrl, } from "./mime.js";
|
package/dist/mime.d.ts
CHANGED
|
@@ -6,9 +6,10 @@ export declare function isImageMime(mimeType: string): boolean;
|
|
|
6
6
|
/** True when the MIME type is a PDF document Claude can read natively
|
|
7
7
|
* via `type: "document"` content blocks. */
|
|
8
8
|
export declare function isPdfMime(mimeType: string): boolean;
|
|
9
|
-
/** True when the attachment can be sent to Claude as a
|
|
10
|
-
* (image
|
|
11
|
-
export declare function
|
|
9
|
+
/** True when the attachment can be sent to Claude directly as a
|
|
10
|
+
* native content block (image or PDF) — no conversion needed. */
|
|
11
|
+
export declare function isNativeAttachmentMime(mimeType: string): boolean;
|
|
12
|
+
export declare const isSupportedAttachmentMime: typeof isNativeAttachmentMime;
|
|
12
13
|
export interface ParsedDataUrl {
|
|
13
14
|
mimeType: string;
|
|
14
15
|
data: string;
|
package/dist/mime.js
CHANGED
|
@@ -40,11 +40,13 @@ export function isImageMime(mimeType) {
|
|
|
40
40
|
export function isPdfMime(mimeType) {
|
|
41
41
|
return mimeType === "application/pdf";
|
|
42
42
|
}
|
|
43
|
-
/** True when the attachment can be sent to Claude as a
|
|
44
|
-
* (image
|
|
45
|
-
export function
|
|
43
|
+
/** True when the attachment can be sent to Claude directly as a
|
|
44
|
+
* native content block (image or PDF) — no conversion needed. */
|
|
45
|
+
export function isNativeAttachmentMime(mimeType) {
|
|
46
46
|
return isImageMime(mimeType) || isPdfMime(mimeType);
|
|
47
47
|
}
|
|
48
|
+
// Keep the old name as an alias for backward compatibility.
|
|
49
|
+
export const isSupportedAttachmentMime = isNativeAttachmentMime;
|
|
48
50
|
/** Parse a `data:<mime>;base64,<data>` string. Returns null if the
|
|
49
51
|
* format doesn't match. Also handles parameterised data URLs like
|
|
50
52
|
* `data:image/png;charset=binary;base64,…`. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mulmobridge/client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Socket.io client library for MulmoBridge — shared by all bridge implementations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.js"
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.js",
|
|
13
|
+
"default": "./dist/index.js"
|
|
12
14
|
}
|
|
13
15
|
},
|
|
14
16
|
"files": [
|
|
@@ -29,6 +31,7 @@
|
|
|
29
31
|
"socket.io-client": "^4.0.0"
|
|
30
32
|
},
|
|
31
33
|
"devDependencies": {
|
|
32
|
-
"
|
|
34
|
+
"@types/node": "^25.6.0",
|
|
35
|
+
"typescript": "^6.0.3"
|
|
33
36
|
}
|
|
34
37
|
}
|