@guava-ai/guava-sdk 0.1.0 → 0.2.0

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.
@@ -3,34 +3,112 @@ import { type Logger } from "./logging.ts";
3
3
  import { type Command } from "./commands.ts";
4
4
  import { type GuavaEvent, type CallerSpeechEvent, type AgentSpeechEvent } from "./events.ts";
5
5
  import type { Field, Say } from "./action_item.ts";
6
+ /**
7
+ * Interface between Guava services and user-supplied code
8
+ */
6
9
  export declare class CallController {
7
10
  private _commandQueue;
8
11
  private _on_complete_current_task?;
9
12
  private _current_task_id?;
10
- private _logger;
13
+ /**
14
+ * @protected
15
+ * @description logger used to emit diagnostics
16
+ */
17
+ protected logger: Logger;
11
18
  private _drain?;
19
+ private _fieldValues;
12
20
  constructor(logger: Logger);
21
+ /**
22
+ * @description Supply a function used to consume commands from the internal command queue.
23
+ *
24
+ * The function is expected to remove from the argument array commands that it has handled (iterating
25
+ * through the result of `Array.splice(0)` is sufficient)
26
+ */
13
27
  setDrain(newDrain: (_: Command[]) => Promise<void>): void;
28
+ /**
29
+ * @description [inbound] receive a call, and process further.
30
+ */
14
31
  protected acceptCall(): Promise<void>;
32
+ /**
33
+ * @description read a span of text verbatim
34
+ */
15
35
  protected readScript(script: string): Promise<void>;
36
+ /**
37
+ * @description [inbound] reject a call
38
+ */
16
39
  protected rejectCall(): Promise<void>;
17
- protected addInfo(info: string): Promise<void>;
40
+ protected addInfo(_info: string): Promise<void>;
41
+ /**
42
+ * @description read a span of text non-verbatim
43
+ */
18
44
  protected sendInstruction(instruction: string): Promise<void>;
19
- protected setPersona(organization_name?: string, agent_name?: string, agent_purpose?: string): Promise<void>;
20
- protected setTask(objective?: string, checklist?: (Field | Say | string)[], on_complete?: (...c: any[]) => void, ...args: any[]): Promise<void>;
45
+ /**
46
+ * @description provide identifiers the agent will use to identify the virtual agent
47
+ */
48
+ protected setPersona(args: {
49
+ organizationName?: string;
50
+ agentName?: string;
51
+ agentPurpose?: string;
52
+ }): Promise<void>;
53
+ /**
54
+ * @description direct the agent to collect information
55
+ * @param goal {} an objective string and/or a checklist of information to collect
56
+ * @param on_complete {} a callback to call once the information is available from the agent
57
+ * @param args {} arguments to pass through to the `on_complete` callback
58
+ */
59
+ protected setTask(goal: TaskObjective, on_complete?: (...c: any[]) => void, ...args: any[]): void;
60
+ /**
61
+ * @description direct the agent to collect information, continuing execution once the agent has collected the information
62
+ * @param goal {} an objective string and/or a checklist of information to collect
63
+ */
64
+ protected awaitTask(goal: TaskObjective): Promise<void>;
65
+ /**
66
+ * @description retrieve a piece of information that the agent has collected
67
+ * @param key {string} key of the field checklist item
68
+ */
69
+ protected getField(key: string): unknown;
70
+ /**
71
+ * @description [inbound] hang up an accepted call
72
+ */
21
73
  protected hangup(final_instructions?: string): Promise<void>;
74
+ /**
75
+ * @description transfer an accepted call
76
+ */
22
77
  protected transfer(to_number: string, transfer_message?: string): void;
23
78
  private sendCommand;
24
79
  private flush;
25
80
  onEvent(event: GuavaEvent): Promise<void>;
26
81
  /**
27
- * @requires super call
82
+ * @abstract
83
+ * @description called when an inbound call is received. The overriding function must start
84
+ * with `await super.onIncomingCall(from_number)`
28
85
  */
29
86
  onIncomingCall(from_number?: string): Promise<void>;
87
+ /**
88
+ * @abstract
89
+ * @description called when a call is connected by the API, whether inbound or outbound
90
+ */
30
91
  onCallStart(): Promise<void>;
92
+ /**
93
+ * @abstract
94
+ * @description called when the caller speaks to the agent.
95
+ */
31
96
  onCallerSpeech(event: CallerSpeechEvent): Promise<void>;
97
+ /**
98
+ * @abstract
99
+ * @description called when the agent speaks to the caller.
100
+ */
32
101
  onAgentSpeech(event: AgentSpeechEvent): Promise<void>;
102
+ /**
103
+ * @abstract
104
+ * @description called when the caller expresses a task they wish to execute
105
+ */
33
106
  onIntent(intent: string): Promise<string | null>;
107
+ /**
108
+ * @abstract
109
+ * @description called when the agent needs to respond to a question that it doesn't know
110
+ * the answer to.
111
+ */
34
112
  onQuestion(question: string): Promise<string>;
35
113
  }
36
114
  export type InboundConnection = {
@@ -38,6 +116,12 @@ export type InboundConnection = {
38
116
  } | {
39
117
  webrtc_code: string;
40
118
  };
119
+ export type TaskObjective = {
120
+ objective: string;
121
+ } | {
122
+ objective?: string;
123
+ checklist: (Field | Say | string)[];
124
+ };
41
125
  export declare class Client {
42
126
  private _apiKey;
43
127
  private _baseUrl;
@@ -46,13 +130,25 @@ export declare class Client {
46
130
  private _controller?;
47
131
  private messageHandler?;
48
132
  constructor(apiKey?: string, baseUrl?: string, logger?: Logger);
49
- private getHttpBase;
50
133
  private getWebsocketBase;
134
+ private getHttpBase;
51
135
  private headers;
136
+ /**
137
+ * @description use the Guava API to call out to a number
138
+ */
52
139
  createOutbound(fromNumber: string | undefined, toNumber: string, callControllerFactory?: (logger: Logger) => CallController): void;
53
- replaceHandler(newHandler?: (_: WebSocket.MessageEvent) => void): void;
140
+ private replaceHandler;
54
141
  private uninitializedOutbound;
55
142
  private initializedOutbound;
56
- setInboundHandler(agent_number: string, public_url: string, inbound_token: string): void;
57
- listenInbound<U extends CallController>(conn: InboundConnection, controller_class: U): void;
143
+ setInboundHandler(agent_number: string, public_url: string, inbound_token: string): Promise<void>;
144
+ /**
145
+ * @description use the Guava API to receive calls at a given number
146
+ */
147
+ listenInbound<U extends CallController>(conn: InboundConnection, controllerClassFactory: (logger: Logger) => U): InboundListener;
148
+ }
149
+ declare class InboundListener {
150
+ private ws;
151
+ constructor(ws: WebSocket);
152
+ close(): void;
58
153
  }
154
+ export {};
package/dist/src/index.js CHANGED
@@ -9,29 +9,42 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import WebSocket from "ws";
11
11
  import { getConsoleLogger } from "./logging.js";
12
- import { acceptInboundCallCommand, startOutboundCallCommand, setPersona, setTaskCommand, answerQuestionCommand, sendInstructionCommand, readScriptCommand, rejectInboundCallCommand, transferCommand, listenInboundCommand, } from "./commands.js";
12
+ import { acceptInboundCallCommand, startOutboundCallCommand, setPersona, setTaskCommand, answerQuestionCommand, sendInstructionCommand, readScriptCommand, rejectInboundCallCommand, transferCommand, listenInboundCommand, inboundTunnelCommand, } from "./commands.js";
13
13
  import * as z from "zod";
14
- import { errorEvent, sessionStartedEvent, decodeEvent, } from "./events.js";
14
+ import { errorEvent, sessionStartedEvent, decodeEvent, inboundTunnelEvent, } from "./events.js";
15
15
  import pkgdata from "../package.json" with { type: "json" };
16
16
  import os from "node:os";
17
- const DEFAULT_BASE_URL = "wss://guava-dev.gridspace.com/guava/";
18
- const DEFAULT_LOG_LEVEL = "info";
17
+ const DEFAULT_BASE_URL = "https://guava-dev.gridspace.com/";
18
+ const DEFAULT_LOG_LEVEL = "debug";
19
19
  /**
20
20
  * @description convenience function for stringifying data according to a schema
21
21
  */
22
22
  function stringifyZod(schema, data) {
23
23
  return JSON.stringify(schema.parse(data));
24
24
  }
25
+ /**
26
+ * Interface between Guava services and user-supplied code
27
+ */
25
28
  export class CallController {
26
29
  constructor(logger) {
27
30
  this._commandQueue = [];
31
+ this._fieldValues = {};
28
32
  // Set up the default logger.
29
- this._logger = logger;
33
+ this.logger = logger;
30
34
  }
35
+ /**
36
+ * @description Supply a function used to consume commands from the internal command queue.
37
+ *
38
+ * The function is expected to remove from the argument array commands that it has handled (iterating
39
+ * through the result of `Array.splice(0)` is sufficient)
40
+ */
31
41
  setDrain(newDrain) {
32
42
  this._drain = newDrain;
33
43
  this.flush();
34
44
  }
45
+ /**
46
+ * @description [inbound] receive a call, and process further.
47
+ */
35
48
  acceptCall() {
36
49
  return __awaiter(this, void 0, void 0, function* () {
37
50
  yield this.sendCommand(acceptInboundCallCommand, {
@@ -39,6 +52,9 @@ export class CallController {
39
52
  });
40
53
  });
41
54
  }
55
+ /**
56
+ * @description read a span of text verbatim
57
+ */
42
58
  readScript(script) {
43
59
  return __awaiter(this, void 0, void 0, function* () {
44
60
  yield this.sendCommand(readScriptCommand, {
@@ -47,6 +63,9 @@ export class CallController {
47
63
  });
48
64
  });
49
65
  }
66
+ /**
67
+ * @description [inbound] reject a call
68
+ */
50
69
  rejectCall() {
51
70
  return __awaiter(this, void 0, void 0, function* () {
52
71
  yield this.sendCommand(rejectInboundCallCommand, {
@@ -54,11 +73,14 @@ export class CallController {
54
73
  });
55
74
  });
56
75
  }
57
- addInfo(info) {
76
+ addInfo(_info) {
58
77
  return __awaiter(this, void 0, void 0, function* () {
59
78
  throw new Error("not implemeneted");
60
79
  });
61
80
  }
81
+ /**
82
+ * @description read a span of text non-verbatim
83
+ */
62
84
  sendInstruction(instruction) {
63
85
  return __awaiter(this, void 0, void 0, function* () {
64
86
  yield this.sendCommand(sendInstructionCommand, {
@@ -67,38 +89,80 @@ export class CallController {
67
89
  });
68
90
  });
69
91
  }
70
- setPersona(organization_name, agent_name, agent_purpose) {
92
+ /**
93
+ * @description provide identifiers the agent will use to identify the virtual agent
94
+ */
95
+ setPersona(args) {
71
96
  return __awaiter(this, void 0, void 0, function* () {
72
97
  yield this.sendCommand(setPersona, {
73
98
  command_type: "set-persona",
74
- organization_name: organization_name,
75
- agent_name: agent_name,
76
- agent_purpose: agent_purpose,
99
+ organization_name: args.organizationName,
100
+ agent_name: args.agentName,
101
+ agent_purpose: args.agentPurpose,
77
102
  });
78
103
  });
79
104
  }
80
- setTask() {
81
- return __awaiter(this, arguments, void 0, function* (objective = "", checklist, on_complete = () => { }, ...args) {
82
- if (!objective && !checklist) {
83
- throw new Error("At least one of args ['objective','checklist'] must be provided.");
84
- }
85
- this._current_task_id = Math.random().toString(16).substring(2, 8);
86
- checklist = checklist !== null && checklist !== void 0 ? checklist : [];
87
- const action_items = checklist.map((item) => typeof item == "string"
105
+ /**
106
+ * @description direct the agent to collect information
107
+ * @param goal {} an objective string and/or a checklist of information to collect
108
+ * @param on_complete {} a callback to call once the information is available from the agent
109
+ * @param args {} arguments to pass through to the `on_complete` callback
110
+ */
111
+ setTask(goal, on_complete = () => { }, ...args) {
112
+ var _a;
113
+ this._current_task_id = Math.random().toString(16).substring(2, 8);
114
+ this._on_complete_current_task = on_complete.bind(this, ...args);
115
+ if (!("checklist" in goal)) {
116
+ this.sendCommand(setTaskCommand, {
117
+ command_type: "set-task",
118
+ task_id: this._current_task_id,
119
+ objective: goal.objective,
120
+ action_items: [],
121
+ });
122
+ }
123
+ else {
124
+ const action_items = goal.checklist.map((item) => typeof item == "string"
88
125
  ? {
89
126
  item_type: "todo",
90
127
  description: item,
91
128
  }
92
129
  : item);
93
- this._on_complete_current_task = on_complete.apply(this, args);
94
130
  this.sendCommand(setTaskCommand, {
95
131
  command_type: "set-task",
96
132
  task_id: this._current_task_id,
97
- objective: objective,
98
- action_items: action_items,
133
+ objective: (_a = goal.objective) !== null && _a !== void 0 ? _a : "",
134
+ action_items,
135
+ });
136
+ }
137
+ }
138
+ /**
139
+ * @description direct the agent to collect information, continuing execution once the agent has collected the information
140
+ * @param goal {} an objective string and/or a checklist of information to collect
141
+ */
142
+ awaitTask(goal) {
143
+ return __awaiter(this, void 0, void 0, function* () {
144
+ return new Promise((resolve) => {
145
+ this.setTask(goal, (_args) => {
146
+ resolve();
147
+ });
99
148
  });
100
149
  });
101
150
  }
151
+ /**
152
+ * @description retrieve a piece of information that the agent has collected
153
+ * @param key {string} key of the field checklist item
154
+ */
155
+ getField(key) {
156
+ if (key in this._fieldValues) {
157
+ return this._fieldValues[key];
158
+ }
159
+ else {
160
+ return null;
161
+ }
162
+ }
163
+ /**
164
+ * @description [inbound] hang up an accepted call
165
+ */
102
166
  hangup() {
103
167
  return __awaiter(this, arguments, void 0, function* (final_instructions = "") {
104
168
  let instructions;
@@ -111,6 +175,9 @@ export class CallController {
111
175
  this.sendInstruction(instructions);
112
176
  });
113
177
  }
178
+ /**
179
+ * @description transfer an accepted call
180
+ */
114
181
  transfer(to_number, transfer_message) {
115
182
  const message = transfer_message !== null && transfer_message !== void 0 ? transfer_message : "I'm transferring you now";
116
183
  this.sendCommand(transferCommand, {
@@ -123,7 +190,7 @@ export class CallController {
123
190
  return __awaiter(this, void 0, void 0, function* () {
124
191
  const command = schema.parse(data);
125
192
  this._commandQueue.push(command);
126
- this._logger.debug(`Command queued: ${JSON.stringify(command)}`);
193
+ this.logger.debug(`Command queued: ${JSON.stringify(command)}`);
127
194
  yield this.flush();
128
195
  });
129
196
  }
@@ -143,7 +210,7 @@ export class CallController {
143
210
  }
144
211
  else if (event.event_type == "agent-question") {
145
212
  try {
146
- this._logger.info(`Received question from bot: ${event.question}`);
213
+ this.logger.info(`Received question from bot: ${event.question}`);
147
214
  const answer = yield this.onQuestion(event.question);
148
215
  yield this.sendCommand(answerQuestionCommand, {
149
216
  command_type: "answer-question",
@@ -152,7 +219,7 @@ export class CallController {
152
219
  });
153
220
  }
154
221
  catch (e) {
155
- this._logger.error("Error occured while answering question.");
222
+ this.logger.error("Error occured while answering question.");
156
223
  yield this.sendCommand(answerQuestionCommand, {
157
224
  command_type: "answer-question",
158
225
  question_id: event.question_id,
@@ -161,12 +228,12 @@ export class CallController {
161
228
  }
162
229
  }
163
230
  else if (event.event_type == "intent") {
164
- this._logger.info(`Received intent ${event.intent_id} from bot: ${event.intent_summary}`);
231
+ this.logger.info(`Received intent ${event.intent_id} from bot: ${event.intent_summary}`);
165
232
  const intent_response = yield this.onIntent(event.intent_summary);
166
233
  if (intent_response) {
167
- const response_str = `Responding to intent ${event.intent_id}: ${event.intent_summary}`;
168
- this._logger.info(response_str);
169
- this.sendInstruction(response_str);
234
+ const response_str = `Responding to intent ${event.intent_id}: ${intent_response}`;
235
+ this.logger.info(response_str);
236
+ this.sendInstruction(intent_response);
170
237
  }
171
238
  }
172
239
  else if (event.event_type == "task-done") {
@@ -181,7 +248,10 @@ export class CallController {
181
248
  }
182
249
  }
183
250
  else if (event.event_type == "action-item-done") {
184
- // self._field_values...
251
+ this._fieldValues[event.key] = event.payload;
252
+ if (event.key && event.payload) {
253
+ this.logger.info(`Field ${event.key} updated with value: ${event.payload}`);
254
+ }
185
255
  }
186
256
  else if (event.event_type == "inbound-call") {
187
257
  this.onIncomingCall(event.caller_number);
@@ -191,44 +261,67 @@ export class CallController {
191
261
  // no-op, don't warn
192
262
  }
193
263
  else if (event.event_type == "error") {
194
- this._logger.error(`The Guava agent reported an error: ${event.content}`);
264
+ this.logger.error(`The Guava agent reported an error: ${event.content}`);
195
265
  }
196
266
  else {
197
- this._logger.warn(`Unhandled event: ${JSON.stringify(event)}`);
267
+ this.logger.warn(`Unhandled event: ${JSON.stringify(event)}`);
198
268
  }
199
269
  });
200
270
  }
201
271
  // callbacks
202
272
  /**
203
- * @requires super call
273
+ * @abstract
274
+ * @description called when an inbound call is received. The overriding function must start
275
+ * with `await super.onIncomingCall(from_number)`
204
276
  */
205
277
  onIncomingCall(from_number) {
206
278
  return __awaiter(this, void 0, void 0, function* () {
207
279
  yield this.onCallStart();
208
280
  });
209
281
  }
282
+ /**
283
+ * @abstract
284
+ * @description called when a call is connected by the API, whether inbound or outbound
285
+ */
210
286
  onCallStart() {
211
287
  return __awaiter(this, void 0, void 0, function* () { });
212
288
  }
289
+ /**
290
+ * @abstract
291
+ * @description called when the caller speaks to the agent.
292
+ */
213
293
  onCallerSpeech(event) {
214
294
  return __awaiter(this, void 0, void 0, function* () { });
215
295
  }
296
+ /**
297
+ * @abstract
298
+ * @description called when the agent speaks to the caller.
299
+ */
216
300
  onAgentSpeech(event) {
217
301
  return __awaiter(this, void 0, void 0, function* () { });
218
302
  }
303
+ /**
304
+ * @abstract
305
+ * @description called when the caller expresses a task they wish to execute
306
+ */
219
307
  onIntent(intent) {
220
308
  return __awaiter(this, void 0, void 0, function* () {
221
309
  return "Unfortunately I'm not able to help with that.";
222
310
  });
223
311
  }
312
+ /**
313
+ * @abstract
314
+ * @description called when the agent needs to respond to a question that it doesn't know
315
+ * the answer to.
316
+ */
224
317
  onQuestion(question) {
225
318
  return __awaiter(this, void 0, void 0, function* () {
226
319
  return "I don't have an answer to that question.";
227
320
  });
228
321
  }
229
322
  }
230
- const ws_start = /^ws:\/\//;
231
- const wss_start = /^wss:\/\//;
323
+ const http_start = /^http:\/\//;
324
+ const https_start = /^https:\/\//;
232
325
  export class Client {
233
326
  constructor(apiKey, baseUrl, logger) {
234
327
  // Set up the default logger.
@@ -259,18 +352,18 @@ export class Client {
259
352
  throw new Error("Guava API key must be provided either as argument to client constructor, or in environment variable GUAVA_API_KEY.");
260
353
  }
261
354
  }
262
- getHttpBase() {
263
- if (ws_start.test(this._baseUrl)) {
355
+ getWebsocketBase() {
356
+ if (http_start.test(this._baseUrl)) {
264
357
  return `ws://${this._baseUrl.substring("ws://".length)}`;
265
358
  }
266
- else if (wss_start.test(this._baseUrl)) {
359
+ else if (https_start.test(this._baseUrl)) {
267
360
  return `wss://${this._baseUrl.substring("wss://".length)}`;
268
361
  }
269
362
  else {
270
363
  throw new Error(`Invalid base URL: ${this._baseUrl}}`);
271
364
  }
272
365
  }
273
- getWebsocketBase() {
366
+ getHttpBase() {
274
367
  return this._baseUrl;
275
368
  }
276
369
  headers() {
@@ -283,8 +376,11 @@ export class Client {
283
376
  "x-guava-sdk-version": pkgdata.version,
284
377
  };
285
378
  }
379
+ /**
380
+ * @description use the Guava API to call out to a number
381
+ */
286
382
  createOutbound(fromNumber, toNumber, callControllerFactory) {
287
- const url = new URL("create-outbound", this.getWebsocketBase()).toString();
383
+ const url = new URL("v1/create-outbound", this.getWebsocketBase());
288
384
  const ws = new WebSocket(url, {
289
385
  headers: this.headers(),
290
386
  });
@@ -343,7 +439,6 @@ export class Client {
343
439
  // move to next state
344
440
  this.replaceHandler(this.initializedOutbound.bind(this));
345
441
  }
346
- // this._controller?.flush();
347
442
  }
348
443
  initializedOutbound(ev) {
349
444
  return __awaiter(this, void 0, void 0, function* () {
@@ -363,16 +458,30 @@ export class Client {
363
458
  this._ws.close();
364
459
  }
365
460
  }
366
- // this._controller?.flush();
367
461
  });
368
462
  }
369
463
  setInboundHandler(agent_number, public_url, inbound_token) {
370
- // TODO
464
+ return __awaiter(this, void 0, void 0, function* () {
465
+ const response = yield fetch(new URL(`v1/inbound-handler/${agent_number}`, this.getHttpBase()), {
466
+ method: "PUT",
467
+ headers: this.headers(),
468
+ body: JSON.stringify({
469
+ handler_url: public_url,
470
+ handler_token: inbound_token,
471
+ }),
472
+ });
473
+ if (!response.ok) {
474
+ throw new Error("Failed to set inbound handler");
475
+ }
476
+ });
371
477
  }
372
- // why use a typevar here and not for outbound?
373
- listenInbound(conn, controller_class) {
374
- const call_controllers = {};
375
- const url = new URL("listen-inbound", this.getWebsocketBase()).toString();
478
+ /**
479
+ * @description use the Guava API to receive calls at a given number
480
+ */
481
+ listenInbound(conn, controllerClassFactory) {
482
+ const callControllers = {};
483
+ // return a way to *stop* listening
484
+ const url = new URL("v1/listen-inbound", this.getWebsocketBase());
376
485
  const ws = new WebSocket(url, {
377
486
  headers: this.headers(),
378
487
  });
@@ -384,17 +493,52 @@ export class Client {
384
493
  else {
385
494
  webrtc_code = conn.webrtc_code;
386
495
  }
387
- ws.send(stringifyZod(listenInboundCommand, {
388
- command_type: "listen-inbound",
389
- agent_number: agent_number,
390
- webrtc_code: webrtc_code,
391
- }));
392
496
  this._logger.info(`Listening for calls to ${agent_number !== null && agent_number !== void 0 ? agent_number : webrtc_code}`);
393
497
  if (webrtc_code) {
394
- // converted to print, but should be logger?
395
498
  const debugurl = new URL(`debug-webrtc?webrtc_code=${webrtc_code}`, this.getHttpBase());
396
- this._logger.debug(`WebRTC DebugURL: ${new URL("debug-webrtc?we")}`);
499
+ this._logger.debug(`WebRTC DebugURL: ${debugurl}`);
397
500
  }
501
+ ws.addEventListener("open", (_ev) => {
502
+ ws.send(stringifyZod(listenInboundCommand, {
503
+ command_type: "listen-inbound",
504
+ agent_number: agent_number,
505
+ webrtc_code: webrtc_code,
506
+ }));
507
+ });
508
+ ws.addEventListener("close", (_ev) => {
509
+ ws.removeAllListeners();
510
+ });
511
+ ws.addEventListener("message", (ev) => {
512
+ const tunnel_event = inboundTunnelEvent.parse(JSON.parse(ev.data.toString("utf8")));
513
+ if (!(tunnel_event.call_id in callControllers)) {
514
+ this._logger.info(`Received tunnel event for new call ID: ${tunnel_event.call_id}. Creating call controller.`);
515
+ const newController = controllerClassFactory(this._logger);
516
+ newController.setDrain((commands) => __awaiter(this, void 0, void 0, function* () {
517
+ for (const command of commands.splice(0)) {
518
+ this._logger.debug(`Sending command: ${JSON.stringify(command)} for call ID: ${tunnel_event.call_id}`);
519
+ ws.send(stringifyZod(inboundTunnelCommand, {
520
+ call_id: tunnel_event.call_id,
521
+ command,
522
+ }));
523
+ }
524
+ }));
525
+ callControllers[tunnel_event.call_id] = newController;
526
+ newController.onEvent(tunnel_event.event);
527
+ }
528
+ else {
529
+ // no threading, so manually forward to onEvent!
530
+ callControllers[tunnel_event.call_id].onEvent(tunnel_event.event);
531
+ }
532
+ });
533
+ return new InboundListener(ws);
534
+ }
535
+ }
536
+ class InboundListener {
537
+ constructor(ws) {
538
+ this.ws = ws;
539
+ }
540
+ close() {
541
+ this.ws.close();
398
542
  }
399
543
  }
400
544
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,SAAS,MAAM,IAAI,CAAC;AAC3B,OAAO,EAAe,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EACL,wBAAwB,EAExB,wBAAwB,EACxB,UAAU,EACV,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,eAAe,EACf,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EACL,UAAU,EAEV,mBAAmB,EACnB,WAAW,GAGZ,MAAM,aAAa,CAAC;AAErB,OAAO,OAAO,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC5D,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,MAAM,gBAAgB,GAAG,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