@guava-ai/guava-sdk 0.10.0 → 0.11.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.
Files changed (65) hide show
  1. package/README.md +1 -1
  2. package/bin/example-runner.ts +4 -4
  3. package/dist/bin/example-runner.js +4 -4
  4. package/dist/bin/example-runner.js.map +1 -1
  5. package/dist/examples/help-desk.js +71 -0
  6. package/dist/examples/help-desk.js.map +1 -0
  7. package/dist/examples/property-insurance.js +14 -22
  8. package/dist/examples/property-insurance.js.map +1 -1
  9. package/dist/examples/restaurant-waitlist.js +74 -0
  10. package/dist/examples/restaurant-waitlist.js.map +1 -0
  11. package/dist/examples/scheduling-outbound.js +30 -54
  12. package/dist/examples/scheduling-outbound.js.map +1 -1
  13. package/dist/src/{action_item.d.ts → action-item.d.ts} +2 -0
  14. package/dist/src/{action_item.js → action-item.js} +3 -1
  15. package/dist/src/action-item.js.map +1 -0
  16. package/dist/src/agent.d.ts +72 -0
  17. package/dist/src/agent.js +444 -0
  18. package/dist/src/agent.js.map +1 -0
  19. package/dist/src/call-controller.d.ts +1 -1
  20. package/dist/src/call-controller.js +1 -1
  21. package/dist/src/call.d.ts +73 -0
  22. package/dist/src/call.js +252 -0
  23. package/dist/src/call.js.map +1 -0
  24. package/dist/src/commands.d.ts +95 -0
  25. package/dist/src/commands.js +24 -2
  26. package/dist/src/commands.js.map +1 -1
  27. package/dist/src/events.d.ts +25 -0
  28. package/dist/src/events.js +12 -1
  29. package/dist/src/events.js.map +1 -1
  30. package/dist/src/example-data.d.ts +1 -0
  31. package/dist/src/example-data.js +41 -1
  32. package/dist/src/example-data.js.map +1 -1
  33. package/dist/src/index.d.ts +14 -5
  34. package/dist/src/index.js +7 -2
  35. package/dist/src/index.js.map +1 -1
  36. package/dist/src/logging.js +1 -1
  37. package/dist/src/logging.js.map +1 -1
  38. package/dist/src/version.d.ts +1 -1
  39. package/dist/src/version.js +1 -1
  40. package/dist/src/version.js.map +1 -1
  41. package/examples/README.md +6 -0
  42. package/examples/help-desk.ts +60 -0
  43. package/examples/property-insurance.ts +14 -30
  44. package/examples/restaurant-waitlist.ts +47 -0
  45. package/examples/scheduling-outbound.ts +40 -76
  46. package/package.json +2 -1
  47. package/src/{action_item.ts → action-item.ts} +3 -0
  48. package/src/agent.ts +439 -0
  49. package/src/call-controller.ts +1 -1
  50. package/src/call.ts +279 -0
  51. package/src/commands.ts +31 -1
  52. package/src/events.ts +15 -0
  53. package/src/example-data.ts +41 -0
  54. package/src/index.ts +7 -5
  55. package/src/logging.ts +1 -1
  56. package/src/version.ts +1 -1
  57. package/dist/examples/credit-card-activation.js +0 -177
  58. package/dist/examples/credit-card-activation.js.map +0 -1
  59. package/dist/examples/thai-palace.js +0 -94
  60. package/dist/examples/thai-palace.js.map +0 -1
  61. package/dist/src/action_item.js.map +0 -1
  62. package/examples/credit-card-activation.ts +0 -178
  63. package/examples/thai-palace.ts +0 -67
  64. /package/dist/examples/{credit-card-activation.d.ts → help-desk.d.ts} +0 -0
  65. /package/dist/examples/{thai-palace.d.ts → restaurant-waitlist.d.ts} +0 -0
@@ -0,0 +1,444 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
19
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
20
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
21
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
22
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
23
+ var _, done = false;
24
+ for (var i = decorators.length - 1; i >= 0; i--) {
25
+ var context = {};
26
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
27
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
28
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
29
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
30
+ if (kind === "accessor") {
31
+ if (result === void 0) continue;
32
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
33
+ if (_ = accept(result.get)) descriptor.get = _;
34
+ if (_ = accept(result.set)) descriptor.set = _;
35
+ if (_ = accept(result.init)) initializers.unshift(_);
36
+ }
37
+ else if (_ = accept(result)) {
38
+ if (kind === "field") initializers.unshift(_);
39
+ else descriptor[key] = _;
40
+ }
41
+ }
42
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
43
+ done = true;
44
+ };
45
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
46
+ var useValue = arguments.length > 2;
47
+ for (var i = 0; i < initializers.length; i++) {
48
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
49
+ }
50
+ return useValue ? value : void 0;
51
+ };
52
+ var __importStar = (this && this.__importStar) || (function () {
53
+ var ownKeys = function(o) {
54
+ ownKeys = Object.getOwnPropertyNames || function (o) {
55
+ var ar = [];
56
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
57
+ return ar;
58
+ };
59
+ return ownKeys(o);
60
+ };
61
+ return function (mod) {
62
+ if (mod && mod.__esModule) return mod;
63
+ var result = {};
64
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
65
+ __setModuleDefault(result, mod);
66
+ return result;
67
+ };
68
+ })();
69
+ var __importDefault = (this && this.__importDefault) || function (mod) {
70
+ return (mod && mod.__esModule) ? mod : { "default": mod };
71
+ };
72
+ Object.defineProperty(exports, "__esModule", { value: true });
73
+ exports.Agent = void 0;
74
+ const ws_1 = __importDefault(require("ws"));
75
+ const index_ts_1 = require("./index.js");
76
+ const logging_ts_1 = require("./logging.js");
77
+ const z = __importStar(require("zod"));
78
+ const commands_ts_1 = require("./commands.js");
79
+ const events_ts_1 = require("./events.js");
80
+ const telemetry_ts_1 = require("./telemetry.js");
81
+ /**
82
+ * @description convenience function for stringifying data according to a schema
83
+ */
84
+ function stringifyZod(schema, data) {
85
+ return JSON.stringify(schema.parse(data));
86
+ }
87
+ let Agent = (() => {
88
+ let _classDecorators = [telemetry_ts_1.telemetryClient.trackClass()];
89
+ let _classDescriptor;
90
+ let _classExtraInitializers = [];
91
+ let _classThis;
92
+ var Agent = class {
93
+ static { _classThis = this; }
94
+ static {
95
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
96
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
97
+ Agent = _classThis = _classDescriptor.value;
98
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
99
+ __runInitializers(_classThis, _classExtraInitializers);
100
+ }
101
+ _name;
102
+ _organization;
103
+ _purpose;
104
+ _logger;
105
+ _client = new index_ts_1.Client();
106
+ _onCallReceived = async () => ({
107
+ action: "accept",
108
+ });
109
+ _onCallStart;
110
+ _onCallerSpeech;
111
+ _onAgentSpeech;
112
+ _onQuestion;
113
+ _onTaskCompleteGeneric;
114
+ _onTaskCompleteHandlers = {};
115
+ _searchQueryHandlers = {};
116
+ _onActionRequested;
117
+ _onActionGeneric;
118
+ _onActionHandlers = {};
119
+ _onSessionEnd;
120
+ constructor(args) {
121
+ this._name = args?.name;
122
+ this._organization = args?.organization;
123
+ this._purpose = args?.purpose;
124
+ this._logger = (0, logging_ts_1.getDefaultLogger)();
125
+ }
126
+ onCallReceived(callback) {
127
+ this._onCallReceived = callback;
128
+ }
129
+ onCallStart(callback) {
130
+ this._onCallStart = callback;
131
+ }
132
+ onCallerSpeech(callback) {
133
+ this._onCallerSpeech = callback;
134
+ }
135
+ onAgentSpeech(callback) {
136
+ this._onAgentSpeech = callback;
137
+ }
138
+ onQuestion(callback) {
139
+ this._onQuestion = callback;
140
+ }
141
+ onTaskComplete(callbackOrTaskName, callback) {
142
+ const mixErr = "Cannot mix a generic onTaskComplete handler with per-task handlers.";
143
+ if (typeof callbackOrTaskName === "string") {
144
+ if (this._onTaskCompleteGeneric !== undefined)
145
+ throw new Error(mixErr);
146
+ this._onTaskCompleteHandlers[callbackOrTaskName] = callback;
147
+ }
148
+ else {
149
+ if (Object.keys(this._onTaskCompleteHandlers).length > 0)
150
+ throw new Error(mixErr);
151
+ this._onTaskCompleteGeneric = callbackOrTaskName;
152
+ }
153
+ }
154
+ onSearchQuery(fieldKey, callback) {
155
+ this._searchQueryHandlers[fieldKey] = callback;
156
+ }
157
+ onActionRequest(callback) {
158
+ this._onActionRequested = callback;
159
+ }
160
+ onAction(callbackOrActionKey, callback) {
161
+ const mixErr = "Cannot mix a generic onAction handler with per-action handlers.";
162
+ if (typeof callbackOrActionKey === "string") {
163
+ if (this._onActionGeneric !== undefined)
164
+ throw new Error(mixErr);
165
+ this._onActionHandlers[callbackOrActionKey] = callback;
166
+ }
167
+ else {
168
+ if (Object.keys(this._onActionHandlers).length > 0)
169
+ throw new Error(mixErr);
170
+ this._onActionGeneric = callbackOrActionKey;
171
+ }
172
+ }
173
+ onSessionEnd(callback) {
174
+ this._onSessionEnd = callback;
175
+ }
176
+ onReachPerson(callback) {
177
+ this.onTaskComplete("reach_person", async (call) => {
178
+ const availability = (await call.getField("contact_availability"));
179
+ await callback(call, availability);
180
+ });
181
+ }
182
+ inboundPhone(phoneNumber) {
183
+ return this._listenInbound({
184
+ agent_number: phoneNumber,
185
+ });
186
+ }
187
+ async _dispatchEvent(call, event) {
188
+ if (event.event_type === "caller-speech") {
189
+ if (this._onCallerSpeech !== undefined) {
190
+ await this._onCallerSpeech(call, event);
191
+ }
192
+ }
193
+ else if (event.event_type === "agent-speech") {
194
+ if (this._onAgentSpeech !== undefined) {
195
+ await this._onAgentSpeech(call, event);
196
+ }
197
+ }
198
+ else if (event.event_type === "inbound-call") {
199
+ this._logger.info(`Received inbound call from ${event.caller_number ?? "unknown"}`);
200
+ const action = await this._onCallReceived({
201
+ caller_number: event.caller_number,
202
+ agent_number: event.agent_number,
203
+ });
204
+ if (action.action === "accept") {
205
+ call.sendCommand(commands_ts_1.AcceptInboundCallCommand, { command_type: "accept-inbound" });
206
+ }
207
+ else {
208
+ call.sendCommand(commands_ts_1.RejectInboundCallCommand, { command_type: "reject-inbound" });
209
+ }
210
+ }
211
+ else if (event.event_type === "task-done") {
212
+ this._logger.info(`Task ${event.task_id} completed.`);
213
+ if (this._onTaskCompleteGeneric !== undefined) {
214
+ await this._onTaskCompleteGeneric(call, event.task_id);
215
+ }
216
+ else if (event.task_id in this._onTaskCompleteHandlers) {
217
+ await this._onTaskCompleteHandlers[event.task_id](call);
218
+ }
219
+ else {
220
+ this._logger.warn(`No handler registered for completion of task '${event.task_id}'`);
221
+ }
222
+ }
223
+ else if (event.event_type === "agent-question") {
224
+ if (this._onQuestion !== undefined) {
225
+ this._logger.info(`Received question from bot: ${event.question}`);
226
+ let answer;
227
+ try {
228
+ answer = await this._onQuestion(call, event.question);
229
+ }
230
+ catch (err) {
231
+ this._logger.error(`Error occurred while answering question: ${err}`);
232
+ answer = "An error occurred and the question could not be answered.";
233
+ }
234
+ call.sendCommand(commands_ts_1.AnswerQuestionCommand, {
235
+ command_type: "answer-question",
236
+ question_id: event.question_id,
237
+ answer,
238
+ });
239
+ }
240
+ else {
241
+ this._logger.warn(`Received question but no onQuestion handler is registered: ${event.question}`);
242
+ call.sendCommand(commands_ts_1.AnswerQuestionCommand, {
243
+ command_type: "answer-question",
244
+ question_id: event.question_id,
245
+ answer: "I don't have an answer to that question.",
246
+ });
247
+ }
248
+ }
249
+ else if (event.event_type === "action-item-done") {
250
+ this._logger.info(`Action item '${event.key}' completed.`);
251
+ call._fieldValues[event.key] = event.payload;
252
+ }
253
+ else if (event.event_type === "choice-query") {
254
+ this._logger.info(`Received search query for field '${event.field_key}': ${event.query}`);
255
+ const handler = this._searchQueryHandlers[event.field_key];
256
+ if (handler === undefined) {
257
+ this._logger.warn(`Search query arrived for field '${event.field_key}' with no handler attached.`);
258
+ }
259
+ else {
260
+ const [matchedChoices, otherChoices] = await handler(call, event.query);
261
+ call.sendCommand(commands_ts_1.ChoiceResultCommand, {
262
+ command_type: "choice-query-result",
263
+ field_key: event.field_key,
264
+ query_id: event.query_id,
265
+ matched_choices: matchedChoices,
266
+ other_choices: otherChoices,
267
+ });
268
+ }
269
+ }
270
+ else if (event.event_type === "action-request") {
271
+ this._logger.info(`Received action request ${event.intent_id}: ${event.intent_summary}`);
272
+ let suggestion;
273
+ if (this._onActionRequested !== undefined) {
274
+ suggestion = await this._onActionRequested(call, event.intent_summary);
275
+ }
276
+ call.sendCommand(commands_ts_1.ActionSuggestionCommand, {
277
+ command_type: "action-suggestion",
278
+ intent_id: event.intent_id,
279
+ action_key: suggestion?.key ?? null,
280
+ action_description: suggestion?.description ?? "",
281
+ });
282
+ }
283
+ else if (event.event_type === "execute-action") {
284
+ this._logger.info(`Executing action '${event.action_key}'`);
285
+ let onActionFunc;
286
+ if (this._onActionGeneric !== undefined) {
287
+ onActionFunc = () => this._onActionGeneric(call, event.action_key);
288
+ }
289
+ else if (event.action_key in this._onActionHandlers) {
290
+ onActionFunc = () => this._onActionHandlers[event.action_key](call);
291
+ }
292
+ if (onActionFunc !== undefined) {
293
+ await onActionFunc();
294
+ }
295
+ else {
296
+ this._logger.warn(`No handler registered for action '${event.action_key}'`);
297
+ }
298
+ }
299
+ else if (event.event_type === "bot-session-ended") {
300
+ this._logger.info("Session ended.");
301
+ if (this._onSessionEnd !== undefined) {
302
+ await this._onSessionEnd(call);
303
+ }
304
+ }
305
+ else if (event.event_type === "error") {
306
+ this._logger.error(`The Guava agent reported an error: ${event.content}`);
307
+ }
308
+ else if (event.event_type === "warning") {
309
+ this._logger.warn(`The Guava agent reported a warning: ${event.content}`);
310
+ }
311
+ }
312
+ async _startCall(variables = {}) {
313
+ const call = new index_ts_1.Call(variables);
314
+ call.setPersona({
315
+ agentName: this._name,
316
+ agentPurpose: this._purpose,
317
+ organizationName: this._organization,
318
+ });
319
+ call.sendCommand(commands_ts_1.RegisteredHooksCommand, {
320
+ command_type: "registered-hooks",
321
+ has_on_question: this._onQuestion !== undefined,
322
+ has_on_intent: false,
323
+ has_on_action_requested: this._onActionRequested !== undefined,
324
+ });
325
+ if (this._onCallStart !== undefined) {
326
+ await this._onCallStart(call);
327
+ }
328
+ return call;
329
+ }
330
+ _listenInbound(conn) {
331
+ const calls = {};
332
+ // return a way to *stop* listening
333
+ const url = new URL("v1/listen-inbound", this._client.getWebsocketBase());
334
+ const ws = new ws_1.default(url, {
335
+ headers: this._client.headers(),
336
+ });
337
+ let agent_number;
338
+ let webrtc_code;
339
+ if ("agent_number" in conn) {
340
+ agent_number = conn.agent_number;
341
+ }
342
+ else {
343
+ webrtc_code = conn.webrtc_code;
344
+ }
345
+ this._logger.info(`Listening for calls to ${agent_number ?? webrtc_code}`);
346
+ if (webrtc_code) {
347
+ const debugurl = new URL(`debug-webrtc?webrtc_code=${webrtc_code}`, this._client.getHttpBase());
348
+ this._logger.debug(`WebRTC DebugURL: ${debugurl}`);
349
+ }
350
+ ws.addEventListener("open", (_ev) => {
351
+ ws.send(stringifyZod(commands_ts_1.ListenInboundCommand, {
352
+ command_type: "listen-inbound",
353
+ agent_number: agent_number,
354
+ webrtc_code: webrtc_code,
355
+ }));
356
+ });
357
+ ws.addEventListener("close", (_ev) => {
358
+ ws.removeAllListeners();
359
+ });
360
+ ws.addEventListener("message", async (ev) => {
361
+ const tunnel_event = events_ts_1.InboundTunnelEvent.parse(JSON.parse(ev.data.toString("utf8")));
362
+ if (!(tunnel_event.call_id in calls)) {
363
+ this._logger.info(`Received tunnel event for new call ID: ${tunnel_event.call_id}. Creating call object.`);
364
+ const call = await this._startCall();
365
+ await call.setDrain(async (commands) => {
366
+ for (const command of commands.splice(0)) {
367
+ this._logger.debug(`Sending command: ${JSON.stringify(command)} for call ID: ${tunnel_event.call_id}`);
368
+ ws.send(stringifyZod(commands_ts_1.InboundTunnelCommand, {
369
+ call_id: tunnel_event.call_id,
370
+ command,
371
+ }));
372
+ }
373
+ });
374
+ calls[tunnel_event.call_id] = call;
375
+ }
376
+ this._dispatchEvent(calls[tunnel_event.call_id], tunnel_event.event);
377
+ });
378
+ return new InboundListener(ws);
379
+ }
380
+ /**
381
+ * @description use the Guava API to call out to a number
382
+ */
383
+ async outboundPhone(fromNumber, toNumber, variables = {}) {
384
+ const url = new URL("v1/create-outbound", this._client.getWebsocketBase());
385
+ const ws = new ws_1.default(url, {
386
+ headers: this._client.headers(),
387
+ });
388
+ const call = await this._startCall(variables);
389
+ let socketInitialized = false;
390
+ ws.addEventListener("open", async (_ev) => {
391
+ ws.send(stringifyZod(commands_ts_1.StartOutboundCallCommand, {
392
+ command_type: "start-outbound",
393
+ to_number: toNumber,
394
+ from_number: fromNumber,
395
+ }));
396
+ // set the callController drain function to send all commands
397
+ // through the now open websocket
398
+ call.setDrain(async (commands) => {
399
+ for (const command of commands.splice(0)) {
400
+ this._logger.debug(`Sending command ${JSON.stringify(command)}`);
401
+ ws.send(JSON.stringify(command));
402
+ }
403
+ });
404
+ });
405
+ ws.addEventListener("message", (ev) => {
406
+ if (socketInitialized) {
407
+ const session_started = z
408
+ .union([events_ts_1.SessionStartedEvent, events_ts_1.ErrorEvent])
409
+ .parse(JSON.parse(ev.data.toString("utf8")));
410
+ if (session_started.event_type === "error") {
411
+ throw new Error(`Outbound call failed: ${session_started.content}`);
412
+ }
413
+ else {
414
+ this._logger.info(`Started session with ID: ${session_started.session_id}`);
415
+ socketInitialized = true;
416
+ }
417
+ }
418
+ else {
419
+ // handle the received event
420
+ const event = (0, events_ts_1.decodeEvent)(ev.data);
421
+ if (event) {
422
+ this._dispatchEvent(call, event);
423
+ }
424
+ }
425
+ });
426
+ ws.addEventListener("close", (_ev) => {
427
+ // we are closing the socket, so don't trigger any other listeners
428
+ ws.removeAllListeners();
429
+ });
430
+ }
431
+ };
432
+ return Agent = _classThis;
433
+ })();
434
+ exports.Agent = Agent;
435
+ class InboundListener {
436
+ ws;
437
+ constructor(ws) {
438
+ this.ws = ws;
439
+ }
440
+ close() {
441
+ this.ws.close();
442
+ }
443
+ }
444
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA2B;AAC3B,yCAA0C;AAC1C,6CAA6D;AAC7D,uCAAyB;AACzB,+CAUuB;AACvB,2CAQqB;AACrB,iDAAiD;AAcjD;;GAEG;AACH,SAAS,YAAY,CAA2B,MAAc,EAAE,IAAqB;IACnF,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5C,CAAC;IAKY,KAAK;4BADjB,8BAAe,CAAC,UAAU,EAAE;;;;;;;;YAC7B,6KA2XC;;;YA3XY,uDAAK;;QACR,KAAK,CAAU;QACf,aAAa,CAAU;QACvB,QAAQ,CAAU;QAClB,O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IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED,KAAK;QACH,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;CACF"}
@@ -1,7 +1,7 @@
1
1
  import { type Logger } from "./logging.ts";
2
2
  import { type Command } from "./commands.ts";
3
3
  import type { GuavaEvent, CallerSpeechEvent, AgentSpeechEvent } from "./events.ts";
4
- import { type FieldItem, type SayItem } from "./action_item.ts";
4
+ import { type FieldItem, type SayItem } from "./action-item.ts";
5
5
  export type TaskObjective = {
6
6
  objective: string;
7
7
  } | {
@@ -37,7 +37,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.CallController = void 0;
38
38
  const logging_ts_1 = require("./logging.js");
39
39
  const commands_ts_1 = require("./commands.js");
40
- const action_item_ts_1 = require("./action_item.js");
40
+ const action_item_ts_1 = require("./action-item.js");
41
41
  const telemetry_ts_1 = require("./telemetry.js");
42
42
  /**
43
43
  * Interface between Guava services and user-supplied code
@@ -0,0 +1,73 @@
1
+ import { type Logger } from "./logging.ts";
2
+ import { type Command, type Language } from "./commands.ts";
3
+ import type * as z from "zod";
4
+ import type { FieldItem, SayItem } from "./action-item.ts";
5
+ export type TaskObjective = {
6
+ objective: string;
7
+ } | {
8
+ objective?: string;
9
+ checklist: (FieldItem | SayItem | string)[];
10
+ };
11
+ export type ReachPersonOutcome = {
12
+ key: string;
13
+ description?: string;
14
+ nextActionPreview?: string;
15
+ };
16
+ export declare class Call {
17
+ private _commandQueue;
18
+ private _variables;
19
+ protected logger: Logger;
20
+ private _drain?;
21
+ _fieldValues: Record<string, unknown>;
22
+ constructor(variables?: Record<string, any>, logger?: Logger);
23
+ /**
24
+ * @description Supply a function used to consume commands from the internal command queue.
25
+ *
26
+ * The function is expected to remove from the argument array commands that it has handled (iterating
27
+ * through the result of `Array.splice(0)` is sufficient)
28
+ */
29
+ setDrain(newDrain: (_: Command[]) => Promise<void>): Promise<void>;
30
+ private flush;
31
+ getField(key: string): Promise<unknown>;
32
+ sendCommand<C extends Command, Schema extends z.ZodType<C>>(schema: Schema, data: z.input<Schema>): Promise<void>;
33
+ setLanguageMode(args: {
34
+ primary?: Language;
35
+ secondary?: Language[];
36
+ }): Promise<void>;
37
+ /**
38
+ * @description provide identifiers the agent will use to identify the virtual agent
39
+ */
40
+ setPersona(args: {
41
+ organizationName?: string;
42
+ agentName?: string;
43
+ agentPurpose?: string;
44
+ voice?: string;
45
+ }): Promise<void>;
46
+ /**
47
+ * @description direct the agent to collect information
48
+ * @param taskArgs.task_id unique identifier for this task
49
+ * @param taskArgs.objective high-level goal for the agent
50
+ * @param taskArgs.checklist ordered list of fields, statements, or instructions to collect
51
+ */
52
+ setTask(taskArgs: {
53
+ taskId: string;
54
+ objective?: string;
55
+ checklist?: (FieldItem | SayItem | string)[];
56
+ completionCriteria?: string;
57
+ }): Promise<void>;
58
+ transfer(destination: string, instructions?: string): Promise<void>;
59
+ addInfo(label: string, info: unknown): Promise<void>;
60
+ retryTask(reason: string): Promise<void>;
61
+ readScript(script: string): Promise<void>;
62
+ sendInstruction(instruction: string): Promise<void>;
63
+ /**
64
+ * @description hang up an accepted call
65
+ */
66
+ hangup(final_instructions?: string): Promise<void>;
67
+ reachPerson(contactFullName: string, options?: {
68
+ outcomes?: ReachPersonOutcome[];
69
+ greeting?: string;
70
+ }): Promise<void>;
71
+ setVariable(variableName: string, variableValue: any): Promise<void>;
72
+ getVariable(variableName: string): Promise<any>;
73
+ }