@eka-care/medassist-core 1.0.56 → 1.0.57

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Synapse.d.ts","sourceRoot":"","sources":["../src/Synapse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH,OAAO,EACL,uBAAuB,EAExB,MAAM,kBAAkB,CAAC;AAuB1B,OAAO,EACL,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,kBAAkB,EAA2C,gBAAgB,EAAiB,aAAa,EAAE,MAAM,SAAS,CAAC;AACxL,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKhD,qBAAa,UAAU;IACrB,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,eAAe,CAAkB;IAEzC,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,mBAAmB,CAAkB;IAC7C,OAAO,CAAC,kBAAkB,CAAa;IACvC,OAAO,CAAC,eAAe,CAAoC;IAC3D,OAAO,CAAC,MAAM,CAA2B;gBAE7B,MAAM,EAAE,gBAAgB;IAcpC;;;;;;OAMG;IACU,YAAY,CACvB,eAAe,CAAC,EAAE,sBAAsB,GACvC,OAAO,CAAC,eAAe,CAAC;IA6B3B;;OAEG;IACU,WAAW,CAAC,EACvB,OAAO,EACP,KAAK,EACL,KAAK,EACL,aAAa,EACb,OAAO,EACP,eAAe,EACf,WAAW,EACZ,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAoCrC;;OAEG;IACU,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,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;IAuB5B;;OAEG;YACW,gBAAgB;IAO9B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAsE1B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAW/B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAe9B;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAgD/B;;OAEG;YACW,mBAAmB;IA0CjC,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,OAAO;CAKhB"}
package/dist/Synapse.js CHANGED
@@ -87,6 +87,7 @@ class SynapseSDK {
87
87
  }
88
88
  switch (this.connectionType) {
89
89
  case ConnectionFactory_1.ConnectionType.SOCKET:
90
+ case ConnectionFactory_1.ConnectionType.SSE:
90
91
  this.messageManager.sendSocketMessage({
91
92
  message: message,
92
93
  files: files,
@@ -130,6 +131,7 @@ class SynapseSDK {
130
131
  }
131
132
  switch (this.connectionType) {
132
133
  case ConnectionFactory_1.ConnectionType.SOCKET:
134
+ case ConnectionFactory_1.ConnectionType.SSE:
133
135
  await this.resourceManager.sendFeedback(this.sessionConfig.session_id, messageId, feedback, reason);
134
136
  break;
135
137
  }
@@ -180,6 +182,7 @@ class SynapseSDK {
180
182
  }
181
183
  switch (this.connectionType) {
182
184
  case ConnectionFactory_1.ConnectionType.SOCKET:
185
+ case ConnectionFactory_1.ConnectionType.SSE:
183
186
  try {
184
187
  const response = await this.resourceManager.callTool(this.sessionConfig.session_id, tool_id, message_id, this.sessionConfig.session_token, params);
185
188
  if (response.error) {
@@ -352,13 +355,16 @@ class SynapseSDK {
352
355
  });
353
356
  }
354
357
  this.sessionConfig = sessionResponse;
355
- const serverUrl = (0, constants_1.getConfig)(this.config?.environment).WEBSOCKET_URL;
356
- const customSocketUrl = this.config.serverUrl ? `wss://${this.config.serverUrl.split("://")[1]}` : null;
357
- const connectionType = this.config.connectionType === "socket"
358
- ? ConnectionFactory_1.ConnectionType.SOCKET
359
- : ConnectionFactory_1.ConnectionType.SOCKET;
360
- this.connection = await ConnectionFactory_1.ConnectionFactory.createConnection(connectionType, {
361
- serverUrl: customSocketUrl || serverUrl,
358
+ const envConfig = (0, constants_1.getConfig)(this.config?.environment);
359
+ const isSse = this.connectionType === ConnectionFactory_1.ConnectionType.SSE;
360
+ const defaultUrl = isSse ? envConfig.BASE_API_URL : envConfig.WEBSOCKET_URL;
361
+ const customUrl = this.config.serverUrl
362
+ ? isSse
363
+ ? this.config.serverUrl
364
+ : `wss://${this.config.serverUrl.split("://")[1]}`
365
+ : null;
366
+ this.connection = await ConnectionFactory_1.ConnectionFactory.createConnection(this.connectionType, {
367
+ serverUrl: customUrl || defaultUrl,
362
368
  auth: {
363
369
  sessionId: sessionResponse.session_id,
364
370
  sessionToken: sessionResponse.session_token,
@@ -459,6 +465,22 @@ class SynapseSDK {
459
465
  this.handleSessionExpiry();
460
466
  });
461
467
  break;
468
+ case ConnectionFactory_1.ConnectionType.SSE:
469
+ // SSE auth is handled at the URL/header layer, no auth message needed.
470
+ // Connection is considered "established" as soon as the stream opens.
471
+ this.connection.onOpen(() => {
472
+ this.messageManager.handleConnectionEstablished();
473
+ });
474
+ this.connection.onMessage((message) => {
475
+ this.onIncomingSocketMessage(message);
476
+ });
477
+ this.connection.onError((error) => {
478
+ this.onSocketConnectionError(error);
479
+ });
480
+ this.connection.on(types_2.SYNAPSE_REALTIME_RESERVED_EVENTS.SESSION_EXPIRED, () => {
481
+ this.handleSessionExpiry();
482
+ });
483
+ break;
462
484
  default:
463
485
  throw new Error_2.ConnectionError("Unsupported connection type", {
464
486
  context: {
@@ -3,11 +3,13 @@
3
3
  */
4
4
  import { BaseConnection } from "../internal/connection/BaseConnection";
5
5
  import { type WebSocketConnectionConfig } from "./Websocket";
6
+ import { type SSEConnectionConfig } from "./SSE";
6
7
  export declare const ConnectionType: {
7
8
  readonly SOCKET: "socket";
9
+ readonly SSE: "sse";
8
10
  };
9
11
  export type ConnectionType = (typeof ConnectionType)[keyof typeof ConnectionType];
10
- export type ConnectionConfig = WebSocketConnectionConfig;
12
+ export type ConnectionConfig = WebSocketConnectionConfig | SSEConnectionConfig;
11
13
  export declare class ConnectionFactory {
12
14
  /**
13
15
  * Create a connection based on the specified type
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectionFactory.d.ts","sourceRoot":"","sources":["../../src/connection/ConnectionFactory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,aAAa,CAAC;AAGrB,eAAO,MAAM,cAAc;;CAGjB,CAAC;AAEX,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAEvD,MAAM,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;AAEzD,qBAAa,iBAAiB;IAC5B;;OAEG;WACiB,gBAAgB,CAClC,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,cAAc,CAAC;CAU3B"}
1
+ {"version":3,"file":"ConnectionFactory.d.ts","sourceRoot":"","sources":["../../src/connection/ConnectionFactory.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAiB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAGhE,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AAEX,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAEvD,MAAM,MAAM,gBAAgB,GAAG,yBAAyB,GAAG,mBAAmB,CAAC;AAE/E,qBAAa,iBAAiB;IAC5B;;OAEG;WACiB,gBAAgB,CAClC,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,cAAc,CAAC;CAY3B"}
@@ -5,10 +5,11 @@
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ConnectionFactory = exports.ConnectionType = void 0;
7
7
  const Websocket_1 = require("./Websocket");
8
+ const SSE_1 = require("./SSE");
8
9
  const Error_1 = require("../internal/Error/Error");
9
10
  exports.ConnectionType = {
10
11
  SOCKET: "socket",
11
- // Add more connection types in the future (e.g., HTTP polling, SSE)
12
+ SSE: "sse",
12
13
  };
13
14
  class ConnectionFactory {
14
15
  /**
@@ -18,6 +19,8 @@ class ConnectionFactory {
18
19
  switch (type) {
19
20
  case exports.ConnectionType.SOCKET:
20
21
  return new Websocket_1.WebSocketConnection(config);
22
+ case exports.ConnectionType.SSE:
23
+ return new SSE_1.SSEConnection(config);
21
24
  default:
22
25
  throw new Error_1.ConnectionError(`Unsupported connection type: ${type}`, {
23
26
  context: { type },
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Server-Sent Events implementation of BaseConnection.
3
+ *
4
+ * Unlike the classic GET + EventSource pattern, this server streams events
5
+ * back as the response body of a POST to /chat. The request body is the
6
+ * same OutgoingSocketMessage envelope used over the WebSocket, so
7
+ * MessageManager parsing is shared.
8
+ *
9
+ * Wire shape:
10
+ * POST {serverUrl}/med-assist/session/{sessionId}/chat
11
+ * Headers: Content-Type: application/json
12
+ * Accept: text/event-stream
13
+ * sess-token: <session token>
14
+ * x-agent-id: <agent id>
15
+ * Body: JSON-encoded OutgoingSocketMessage
16
+ * Response: text/event-stream with `data: <json>\n\n` frames whose payloads
17
+ * match the IncomingSocketMessage shape.
18
+ */
19
+ import { BaseConnection } from "../internal/connection/BaseConnection";
20
+ import { type OnOpenCallback, type SessionConfig } from "../internal/connection/types";
21
+ import { type OutgoingSocketMessage } from "../events/Events";
22
+ export interface SSEConnectionConfig extends SessionConfig {
23
+ serverUrl: string;
24
+ auth: {
25
+ sessionToken: string;
26
+ sessionId: string;
27
+ };
28
+ }
29
+ export declare class SSEConnection extends BaseConnection {
30
+ readonly conversationId: string;
31
+ private config;
32
+ private connected;
33
+ private activeStreamController;
34
+ constructor(config: SSEConnectionConfig);
35
+ /**
36
+ * "Open" the SSE channel. There is no persistent socket — the connection
37
+ * is considered ready as soon as the session/agent identifiers are set.
38
+ * Each outgoing message opens its own short-lived streaming response.
39
+ *
40
+ * The open callback is deferred to a macrotask so it fires AFTER
41
+ * `Synapse.startSession()` resolves and the consumer (e.g. widget's
42
+ * `setUpEventListeners`) has had a chance to register the CONNECTED
43
+ * listener. With WebSocket the real socket open is naturally async; we
44
+ * have to simulate that here, otherwise the CONNECTED event is emitted
45
+ * before anyone is listening for it.
46
+ */
47
+ private connect;
48
+ /**
49
+ * Fire the open callback if the connection is already up by the time
50
+ * the listener registers. Mirrors the queued-disconnect pattern in
51
+ * BaseConnection so late-registering consumers don't miss the open
52
+ * event. Deferred via setTimeout for the same reason as connect().
53
+ */
54
+ onOpen(callback: OnOpenCallback): void;
55
+ private buildChatUrl;
56
+ /**
57
+ * Send an outgoing message. POSTs the same envelope used over the
58
+ * WebSocket and streams the response back as SSE-encoded events.
59
+ */
60
+ sendMessage(message: OutgoingSocketMessage): void;
61
+ private streamChat;
62
+ /**
63
+ * Walk the buffer and dispatch every complete top-level JSON object it
64
+ * contains, returning any trailing partial-object bytes that still need
65
+ * more data. The server streams back-to-back objects (`{…}{…}{…}`) with
66
+ * no separator, so we track brace depth (respecting strings/escapes)
67
+ * to find each object boundary. Any whitespace or stray SSE prefixes
68
+ * between objects is skipped automatically since we anchor on `{`.
69
+ */
70
+ private extractJsonObjects;
71
+ /**
72
+ * Return the index of the matching closing brace for the `{` at `start`,
73
+ * or -1 if the buffer ends before the object closes. String contents
74
+ * and escape sequences are skipped so braces inside strings don't
75
+ * affect the depth count.
76
+ */
77
+ private findObjectEnd;
78
+ close(): void;
79
+ isConnected(): boolean;
80
+ handleConnected(): void;
81
+ }
82
+ //# sourceMappingURL=SSE.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SSE.d.ts","sourceRoot":"","sources":["../../src/connection/SSE.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAO9D,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE;QACJ,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,qBAAa,aAAc,SAAQ,cAAc;IAC/C,SAAgB,cAAc,EAAE,MAAM,CAAC;IACvC,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,sBAAsB,CAAgC;gBAElD,MAAM,EAAE,mBAAmB;IAOvC;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,OAAO;IAQf;;;;;OAKG;IACa,MAAM,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAOtD,OAAO,CAAC,YAAY;IAMpB;;;OAGG;IACI,WAAW,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI;YAc1C,UAAU;IAuDxB;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;IA4B1B;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IA4Bd,KAAK,IAAI,IAAI;IAOb,WAAW,IAAI,OAAO;IAItB,eAAe,IAAI,IAAI;CAG/B"}
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+ /**
3
+ * Server-Sent Events implementation of BaseConnection.
4
+ *
5
+ * Unlike the classic GET + EventSource pattern, this server streams events
6
+ * back as the response body of a POST to /chat. The request body is the
7
+ * same OutgoingSocketMessage envelope used over the WebSocket, so
8
+ * MessageManager parsing is shared.
9
+ *
10
+ * Wire shape:
11
+ * POST {serverUrl}/med-assist/session/{sessionId}/chat
12
+ * Headers: Content-Type: application/json
13
+ * Accept: text/event-stream
14
+ * sess-token: <session token>
15
+ * x-agent-id: <agent id>
16
+ * Body: JSON-encoded OutgoingSocketMessage
17
+ * Response: text/event-stream with `data: <json>\n\n` frames whose payloads
18
+ * match the IncomingSocketMessage shape.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.SSEConnection = void 0;
22
+ const BaseConnection_1 = require("../internal/connection/BaseConnection");
23
+ const types_1 = require("../internal/connection/types");
24
+ const Error_1 = require("../internal/Error/Error");
25
+ class SSEConnection extends BaseConnection_1.BaseConnection {
26
+ conversationId;
27
+ config;
28
+ connected = false;
29
+ activeStreamController = null;
30
+ constructor(config) {
31
+ super();
32
+ this.config = config;
33
+ this.conversationId = config.auth.sessionId;
34
+ this.connect();
35
+ }
36
+ /**
37
+ * "Open" the SSE channel. There is no persistent socket — the connection
38
+ * is considered ready as soon as the session/agent identifiers are set.
39
+ * Each outgoing message opens its own short-lived streaming response.
40
+ *
41
+ * The open callback is deferred to a macrotask so it fires AFTER
42
+ * `Synapse.startSession()` resolves and the consumer (e.g. widget's
43
+ * `setUpEventListeners`) has had a chance to register the CONNECTED
44
+ * listener. With WebSocket the real socket open is naturally async; we
45
+ * have to simulate that here, otherwise the CONNECTED event is emitted
46
+ * before anyone is listening for it.
47
+ */
48
+ connect() {
49
+ this.updateStatus(types_1.ConnectionStatus.CONNECTING);
50
+ this.connected = true;
51
+ setTimeout(() => {
52
+ this.onOpenCallback?.();
53
+ }, 0);
54
+ }
55
+ /**
56
+ * Fire the open callback if the connection is already up by the time
57
+ * the listener registers. Mirrors the queued-disconnect pattern in
58
+ * BaseConnection so late-registering consumers don't miss the open
59
+ * event. Deferred via setTimeout for the same reason as connect().
60
+ */
61
+ onOpen(callback) {
62
+ this.onOpenCallback = callback;
63
+ if (this.connected) {
64
+ setTimeout(() => callback(), 0);
65
+ }
66
+ }
67
+ buildChatUrl() {
68
+ const url = new URL(this.config.serverUrl);
69
+ url.pathname = `${url.pathname.replace(/\/$/, "")}/med-assist/session/${this.config.auth.sessionId}/chat`;
70
+ return url.toString();
71
+ }
72
+ /**
73
+ * Send an outgoing message. POSTs the same envelope used over the
74
+ * WebSocket and streams the response back as SSE-encoded events.
75
+ */
76
+ sendMessage(message) {
77
+ if (!this.connected) {
78
+ const error = new Error_1.ConnectionError("SSE connection is not open", {
79
+ context: { stage: "sendMessage" },
80
+ });
81
+ this.onErrorCallback?.(error);
82
+ return;
83
+ }
84
+ this.activeStreamController?.abort();
85
+ const controller = new AbortController();
86
+ this.activeStreamController = controller;
87
+ void this.streamChat(message, controller);
88
+ }
89
+ async streamChat(message, controller) {
90
+ const url = this.buildChatUrl();
91
+ try {
92
+ const response = await fetch(url, {
93
+ method: "POST",
94
+ headers: {
95
+ "Content-Type": "application/json",
96
+ Accept: "text/event-stream",
97
+ "sess-token": this.config.auth.sessionToken,
98
+ "x-agent-id": this.config.agentId,
99
+ },
100
+ body: JSON.stringify(message),
101
+ signal: controller.signal,
102
+ });
103
+ if (!response.ok || !response.body) {
104
+ throw new Error_1.ConnectionError(`SSE chat request failed with status ${response.status}`, { context: { stage: "streamChat", status: response.status } });
105
+ }
106
+ const reader = response.body.getReader();
107
+ const decoder = new TextDecoder();
108
+ let buffer = "";
109
+ while (true) {
110
+ const { done, value } = await reader.read();
111
+ if (done)
112
+ break;
113
+ buffer += decoder.decode(value, { stream: true });
114
+ buffer = this.extractJsonObjects(buffer);
115
+ }
116
+ // Final flush in case the stream ends mid-object.
117
+ if (buffer.trim().length > 0) {
118
+ this.extractJsonObjects(buffer);
119
+ }
120
+ }
121
+ catch (error) {
122
+ if (controller.signal.aborted)
123
+ return;
124
+ const connectionError = (0, Error_1.normalizeError)(error, Error_1.ConnectionError, "SSE chat stream failed", { context: { stage: "streamChat" } });
125
+ this.onErrorCallback?.(connectionError);
126
+ }
127
+ finally {
128
+ if (this.activeStreamController === controller) {
129
+ this.activeStreamController = null;
130
+ }
131
+ }
132
+ }
133
+ /**
134
+ * Walk the buffer and dispatch every complete top-level JSON object it
135
+ * contains, returning any trailing partial-object bytes that still need
136
+ * more data. The server streams back-to-back objects (`{…}{…}{…}`) with
137
+ * no separator, so we track brace depth (respecting strings/escapes)
138
+ * to find each object boundary. Any whitespace or stray SSE prefixes
139
+ * between objects is skipped automatically since we anchor on `{`.
140
+ */
141
+ extractJsonObjects(buffer) {
142
+ let i = 0;
143
+ while (i < buffer.length) {
144
+ const start = buffer.indexOf("{", i);
145
+ if (start === -1)
146
+ return "";
147
+ const end = this.findObjectEnd(buffer, start);
148
+ if (end === -1) {
149
+ // Incomplete object — keep from `start` onward for the next chunk.
150
+ return buffer.slice(start);
151
+ }
152
+ const objStr = buffer.slice(start, end + 1);
153
+ try {
154
+ const parsed = JSON.parse(objStr);
155
+ this.handleMessage(parsed);
156
+ }
157
+ catch (error) {
158
+ const parseError = (0, Error_1.normalizeError)(error, Error_1.MessageError, "Failed to parse incoming SSE object", { context: { stage: "extractJsonObjects", objStr } });
159
+ this.onErrorCallback?.(parseError);
160
+ }
161
+ i = end + 1;
162
+ }
163
+ return "";
164
+ }
165
+ /**
166
+ * Return the index of the matching closing brace for the `{` at `start`,
167
+ * or -1 if the buffer ends before the object closes. String contents
168
+ * and escape sequences are skipped so braces inside strings don't
169
+ * affect the depth count.
170
+ */
171
+ findObjectEnd(buffer, start) {
172
+ let depth = 0;
173
+ let inString = false;
174
+ let escape = false;
175
+ for (let i = start; i < buffer.length; i++) {
176
+ const ch = buffer[i];
177
+ if (inString) {
178
+ if (escape) {
179
+ escape = false;
180
+ }
181
+ else if (ch === "\\") {
182
+ escape = true;
183
+ }
184
+ else if (ch === '"') {
185
+ inString = false;
186
+ }
187
+ continue;
188
+ }
189
+ if (ch === '"') {
190
+ inString = true;
191
+ }
192
+ else if (ch === "{") {
193
+ depth++;
194
+ }
195
+ else if (ch === "}") {
196
+ depth--;
197
+ if (depth === 0)
198
+ return i;
199
+ }
200
+ }
201
+ return -1;
202
+ }
203
+ close() {
204
+ this.connected = false;
205
+ this.activeStreamController?.abort();
206
+ this.activeStreamController = null;
207
+ this.updateStatus(types_1.ConnectionStatus.NOT_CONNECTED);
208
+ }
209
+ isConnected() {
210
+ return this.connected;
211
+ }
212
+ handleConnected() {
213
+ this.updateStatus(types_1.ConnectionStatus.CONNECTED);
214
+ }
215
+ }
216
+ exports.SSEConnection = SSEConnection;
package/dist/index.d.ts CHANGED
@@ -6,6 +6,8 @@ export { SynapseSDK } from "./Synapse";
6
6
  export type { SynapseSDKConfig, SynapseSDKCallbacks, SynapseSDKOverrides, ExistingSessionOptions, } from "./types";
7
7
  export { BaseConnection } from "./internal/connection/BaseConnection";
8
8
  export { WebSocketConnection } from "./connection/Websocket";
9
+ export { SSEConnection } from "./connection/SSE";
10
+ export type { SSEConnectionConfig } from "./connection/SSE";
9
11
  export { ConnectionFactory, ConnectionType, } from "./connection/ConnectionFactory";
10
12
  export type { ConnectionConfig } from "./connection/ConnectionFactory";
11
13
  export * from "./internal/connection/types";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,iBAAiB,EACjB,cAAc,GACf,MAAM,gCAAgC,CAAC;AACxC,YAAY,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,cAAc,6BAA6B,CAAC;AAG5C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,cAAc,mBAAmB,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AAC/B,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
18
18
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
19
19
  };
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.SYNAPSE_MESSAGE_TYPES = exports.ErrorUtils = exports.ErrorType = exports.SynapseErrorCode = exports.InternalServerError = exports.RateLimitError = exports.MethodNotAllowedError = exports.NotFoundError = exports.PermissionDeniedError = exports.UnauthorizedError = exports.BadRequestError = exports.APIConnectionTimeoutError = exports.APIUserAbortError = exports.APIError = exports.SynapseError = exports.HttpClient = exports.MessageManager = exports.ToolCall = exports.Session = exports.ResourceManager = exports.ConnectionType = exports.ConnectionFactory = exports.WebSocketConnection = exports.BaseConnection = exports.SynapseSDK = void 0;
21
+ exports.SYNAPSE_MESSAGE_TYPES = exports.ErrorUtils = exports.ErrorType = exports.SynapseErrorCode = exports.InternalServerError = exports.RateLimitError = exports.MethodNotAllowedError = exports.NotFoundError = exports.PermissionDeniedError = exports.UnauthorizedError = exports.BadRequestError = exports.APIConnectionTimeoutError = exports.APIUserAbortError = exports.APIError = exports.SynapseError = exports.HttpClient = exports.MessageManager = exports.ToolCall = exports.Session = exports.ResourceManager = exports.ConnectionType = exports.ConnectionFactory = exports.SSEConnection = exports.WebSocketConnection = exports.BaseConnection = exports.SynapseSDK = void 0;
22
22
  // High-level API (Primary interface for most users)
23
23
  var Synapse_1 = require("./Synapse");
24
24
  Object.defineProperty(exports, "SynapseSDK", { enumerable: true, get: function () { return Synapse_1.SynapseSDK; } });
@@ -27,6 +27,8 @@ var BaseConnection_1 = require("./internal/connection/BaseConnection");
27
27
  Object.defineProperty(exports, "BaseConnection", { enumerable: true, get: function () { return BaseConnection_1.BaseConnection; } });
28
28
  var Websocket_1 = require("./connection/Websocket");
29
29
  Object.defineProperty(exports, "WebSocketConnection", { enumerable: true, get: function () { return Websocket_1.WebSocketConnection; } });
30
+ var SSE_1 = require("./connection/SSE");
31
+ Object.defineProperty(exports, "SSEConnection", { enumerable: true, get: function () { return SSE_1.SSEConnection; } });
30
32
  var ConnectionFactory_1 = require("./connection/ConnectionFactory");
31
33
  Object.defineProperty(exports, "ConnectionFactory", { enumerable: true, get: function () { return ConnectionFactory_1.ConnectionFactory; } });
32
34
  Object.defineProperty(exports, "ConnectionType", { enumerable: true, get: function () { return ConnectionFactory_1.ConnectionType; } });
@@ -16,6 +16,7 @@ export interface SessionResponse extends ResourceResponse {
16
16
  initial_message?: TInitialMessage;
17
17
  }
18
18
  export interface AgentConfigResponse extends ResourceResponse {
19
+ connectivity?: "sse" | "socket";
19
20
  theme?: {
20
21
  background?: string;
21
22
  background_img?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/resources/session/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACvE,CAAC;AAEF,MAAM,WAAW,eAAgB,SAAQ,gBAAgB;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC7D,KAAK,CAAC,EAAE;QACN,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,cAA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AE,MAAM,CAAC;QAChB,aAAa,CAAC,EAAE;YACd,GAAG,EAAE,MAAM,CAAC;YACZ,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;QACF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AACD,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAA;AACD,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eka-care/medassist-core",
3
- "version": "1.0.56",
3
+ "version": "1.0.57",
4
4
  "description": "TypeScript SDK for real-time medical chatbot experiences with session management, WebSocket connectivity, and media handling",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",