@exotel-npm-dev/exotel-ai-assist 1.1.2 → 1.1.4
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 +9 -11
- package/dist/controller/index.js +7 -26
- package/dist/index.js +7 -26
- package/dist/react/index.js +7 -26
- package/dist/types/index.d.ts +0 -7
- package/dist/utils/index.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -171,7 +171,6 @@ const ctrl = new ExotelAIAssistController({
|
|
|
171
171
|
authToken: "your-auth-token",
|
|
172
172
|
call_sid: "CALL-SID-001",
|
|
173
173
|
accountId: "your-account-id",
|
|
174
|
-
env: "production", // defaults to PRODUCTION if omitted
|
|
175
174
|
});
|
|
176
175
|
|
|
177
176
|
ctrl.on("onReady", (ready) => {
|
|
@@ -222,16 +221,15 @@ Extends `EventEmitter`.
|
|
|
222
221
|
|
|
223
222
|
#### Constructor options (`ExotelAIAssistParams`)
|
|
224
223
|
|
|
225
|
-
| Field | Type
|
|
226
|
-
| ---------------------- |
|
|
227
|
-
| `authToken` | `string`
|
|
228
|
-
| `call_sid` | `string`
|
|
229
|
-
| `accountId` | `string`
|
|
230
|
-
| `
|
|
231
|
-
| `
|
|
232
|
-
| `
|
|
233
|
-
| `
|
|
234
|
-
| `[customParam]` | `string` | — | — | Extra query params forwarded to the server (max 3) |
|
|
224
|
+
| Field | Type | Required | Default | Description |
|
|
225
|
+
| ---------------------- | -------- | -------- | ------------------------ | -------------------------------------------------------- |
|
|
226
|
+
| `authToken` | `string` | ✓ | — | Bearer token |
|
|
227
|
+
| `call_sid` | `string` | ✓ | — | Active call SID |
|
|
228
|
+
| `accountId` | `string` | ✓ | — | Exotel account identifier |
|
|
229
|
+
| `wssBaseUrl` | `string` | — | Exotel AI Assist backend | Override only when pointing at a non-production endpoint |
|
|
230
|
+
| `reconnectInterval` | `number` | — | `3000` | Base reconnect delay in ms |
|
|
231
|
+
| `maxReconnectAttempts` | `number` | — | `5` | Max retries before error |
|
|
232
|
+
| `[customParam]` | `string` | — | — | Max 3 params you can send |
|
|
235
233
|
|
|
236
234
|
#### Methods
|
|
237
235
|
|
package/dist/controller/index.js
CHANGED
|
@@ -1506,18 +1506,6 @@ function requireObject_hash() {
|
|
|
1506
1506
|
var object_hashExports = requireObject_hash();
|
|
1507
1507
|
var objectHash = /*@__PURE__*/getDefaultExportFromCjs(object_hashExports);
|
|
1508
1508
|
|
|
1509
|
-
var Environment;
|
|
1510
|
-
(function (Environment) {
|
|
1511
|
-
Environment["PRODUCTION"] = "production";
|
|
1512
|
-
Environment["UAT"] = "uat";
|
|
1513
|
-
Environment["DEVELOPMENT"] = "development";
|
|
1514
|
-
})(Environment || (Environment = {}));
|
|
1515
|
-
const WssBaseUrl = {
|
|
1516
|
-
[Environment.PRODUCTION]: "wss://ai-assist.in.exotel.com",
|
|
1517
|
-
[Environment.UAT]: "wss://oneassist-uat.in.exotel.com",
|
|
1518
|
-
[Environment.DEVELOPMENT]: "ws://localhost:8081"
|
|
1519
|
-
};
|
|
1520
|
-
|
|
1521
1509
|
class Utils {
|
|
1522
1510
|
/**
|
|
1523
1511
|
* Returns a deterministic SHA-1 hex digest for any plain object.
|
|
@@ -1549,16 +1537,10 @@ class Utils {
|
|
|
1549
1537
|
* @param accountId - The account ID to get the base WebSocket URL for.
|
|
1550
1538
|
* @returns The base WebSocket URL.
|
|
1551
1539
|
*/
|
|
1552
|
-
static getWssBaseUrl(accountId
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
return `${WssBaseUrl[Environment.UAT]}/ai-assist/ws/v1/accounts/${accountId}/ai-assistants/conversation-events`;
|
|
1557
|
-
} else if (env === Environment.PRODUCTION) {
|
|
1558
|
-
return `${WssBaseUrl[Environment.PRODUCTION]}/ai-assist/ws/v1/accounts/${accountId}/ai-assistants/conversation-events`;
|
|
1559
|
-
} else {
|
|
1560
|
-
return `${WssBaseUrl[Environment.PRODUCTION]}/ai-assist/ws/v1/accounts/${accountId}/ai-assistants/conversation-events`;
|
|
1561
|
-
}
|
|
1540
|
+
static getWssBaseUrl(accountId) {
|
|
1541
|
+
// return `wss://ai-assist.in.exotel.com/ai-assist/accounts/${accountId}/one-assistant-event-publisher`;
|
|
1542
|
+
// return `wss://oneassist-uat.in.exotel.com/ai-assist/one-assistant-event-publisher/${accountId}`;
|
|
1543
|
+
return `wss://oneassist-uat.in.exotel.com/ai-assist/ws/v1/accounts/${accountId}/ai-assistants/conversation-events`;
|
|
1562
1544
|
}
|
|
1563
1545
|
/**
|
|
1564
1546
|
* Builds a WebSocket URL from the given parameters.
|
|
@@ -1566,18 +1548,17 @@ class Utils {
|
|
|
1566
1548
|
* @returns The WebSocket URL.
|
|
1567
1549
|
*/
|
|
1568
1550
|
static buildWsUrl(params) {
|
|
1569
|
-
var _a;
|
|
1570
1551
|
const {
|
|
1571
1552
|
wssBaseUrl
|
|
1572
1553
|
} = params;
|
|
1573
|
-
const resolved = wssBaseUrl !== null && wssBaseUrl !== void 0 ? wssBaseUrl : Utils.getWssBaseUrl(params.accountId
|
|
1554
|
+
const resolved = wssBaseUrl !== null && wssBaseUrl !== void 0 ? wssBaseUrl : Utils.getWssBaseUrl(params.accountId);
|
|
1574
1555
|
const base = resolved.endsWith("/") ? resolved.slice(0, -1) : resolved;
|
|
1575
1556
|
const query = Utils.constructQueryParams(params);
|
|
1576
1557
|
return `${base}?${query}`;
|
|
1577
1558
|
}
|
|
1578
1559
|
static constructQueryParams(params) {
|
|
1579
1560
|
// Keys consumed by the library — never forwarded to the server.
|
|
1580
|
-
const INTERNAL_KEYS = new Set(["authToken", "accountId", "wssBaseUrl", "reconnectInterval", "maxReconnectAttempts"
|
|
1561
|
+
const INTERNAL_KEYS = new Set(["authToken", "accountId", "wssBaseUrl", "reconnectInterval", "maxReconnectAttempts"]);
|
|
1581
1562
|
// Mandatory server params remapped to the names the API expects.
|
|
1582
1563
|
// accountId is embedded in the URL path — never sent as a query param.
|
|
1583
1564
|
const pairs = [];
|
|
@@ -1771,7 +1752,7 @@ class ExotelAIAssistController extends EventEmitter {
|
|
|
1771
1752
|
this.emit("error", err);
|
|
1772
1753
|
return;
|
|
1773
1754
|
}
|
|
1774
|
-
if (msgType === "ack"
|
|
1755
|
+
if (msgType === "ack") {
|
|
1775
1756
|
(_b = this.transport) === null || _b === void 0 ? void 0 : _b.markAcknowledged();
|
|
1776
1757
|
this._fireReady();
|
|
1777
1758
|
}
|
package/dist/index.js
CHANGED
|
@@ -20924,18 +20924,6 @@ function requireObject_hash() {
|
|
|
20924
20924
|
var object_hashExports = requireObject_hash();
|
|
20925
20925
|
var objectHash = /*@__PURE__*/getDefaultExportFromCjs(object_hashExports);
|
|
20926
20926
|
|
|
20927
|
-
var Environment;
|
|
20928
|
-
(function (Environment) {
|
|
20929
|
-
Environment["PRODUCTION"] = "production";
|
|
20930
|
-
Environment["UAT"] = "uat";
|
|
20931
|
-
Environment["DEVELOPMENT"] = "development";
|
|
20932
|
-
})(Environment || (Environment = {}));
|
|
20933
|
-
const WssBaseUrl = {
|
|
20934
|
-
[Environment.PRODUCTION]: "wss://ai-assist.in.exotel.com",
|
|
20935
|
-
[Environment.UAT]: "wss://oneassist-uat.in.exotel.com",
|
|
20936
|
-
[Environment.DEVELOPMENT]: "ws://localhost:8081"
|
|
20937
|
-
};
|
|
20938
|
-
|
|
20939
20927
|
class Utils {
|
|
20940
20928
|
/**
|
|
20941
20929
|
* Returns a deterministic SHA-1 hex digest for any plain object.
|
|
@@ -20967,16 +20955,10 @@ class Utils {
|
|
|
20967
20955
|
* @param accountId - The account ID to get the base WebSocket URL for.
|
|
20968
20956
|
* @returns The base WebSocket URL.
|
|
20969
20957
|
*/
|
|
20970
|
-
static getWssBaseUrl(accountId
|
|
20971
|
-
|
|
20972
|
-
|
|
20973
|
-
|
|
20974
|
-
return `${WssBaseUrl[Environment.UAT]}/ai-assist/ws/v1/accounts/${accountId}/ai-assistants/conversation-events`;
|
|
20975
|
-
} else if (env === Environment.PRODUCTION) {
|
|
20976
|
-
return `${WssBaseUrl[Environment.PRODUCTION]}/ai-assist/ws/v1/accounts/${accountId}/ai-assistants/conversation-events`;
|
|
20977
|
-
} else {
|
|
20978
|
-
return `${WssBaseUrl[Environment.PRODUCTION]}/ai-assist/ws/v1/accounts/${accountId}/ai-assistants/conversation-events`;
|
|
20979
|
-
}
|
|
20958
|
+
static getWssBaseUrl(accountId) {
|
|
20959
|
+
// return `wss://ai-assist.in.exotel.com/ai-assist/accounts/${accountId}/one-assistant-event-publisher`;
|
|
20960
|
+
// return `wss://oneassist-uat.in.exotel.com/ai-assist/one-assistant-event-publisher/${accountId}`;
|
|
20961
|
+
return `wss://oneassist-uat.in.exotel.com/ai-assist/ws/v1/accounts/${accountId}/ai-assistants/conversation-events`;
|
|
20980
20962
|
}
|
|
20981
20963
|
/**
|
|
20982
20964
|
* Builds a WebSocket URL from the given parameters.
|
|
@@ -20984,18 +20966,17 @@ class Utils {
|
|
|
20984
20966
|
* @returns The WebSocket URL.
|
|
20985
20967
|
*/
|
|
20986
20968
|
static buildWsUrl(params) {
|
|
20987
|
-
var _a;
|
|
20988
20969
|
const {
|
|
20989
20970
|
wssBaseUrl
|
|
20990
20971
|
} = params;
|
|
20991
|
-
const resolved = wssBaseUrl !== null && wssBaseUrl !== void 0 ? wssBaseUrl : Utils.getWssBaseUrl(params.accountId
|
|
20972
|
+
const resolved = wssBaseUrl !== null && wssBaseUrl !== void 0 ? wssBaseUrl : Utils.getWssBaseUrl(params.accountId);
|
|
20992
20973
|
const base = resolved.endsWith("/") ? resolved.slice(0, -1) : resolved;
|
|
20993
20974
|
const query = Utils.constructQueryParams(params);
|
|
20994
20975
|
return `${base}?${query}`;
|
|
20995
20976
|
}
|
|
20996
20977
|
static constructQueryParams(params) {
|
|
20997
20978
|
// Keys consumed by the library — never forwarded to the server.
|
|
20998
|
-
const INTERNAL_KEYS = new Set(["authToken", "accountId", "wssBaseUrl", "reconnectInterval", "maxReconnectAttempts"
|
|
20979
|
+
const INTERNAL_KEYS = new Set(["authToken", "accountId", "wssBaseUrl", "reconnectInterval", "maxReconnectAttempts"]);
|
|
20999
20980
|
// Mandatory server params remapped to the names the API expects.
|
|
21000
20981
|
// accountId is embedded in the URL path — never sent as a query param.
|
|
21001
20982
|
const pairs = [];
|
|
@@ -21189,7 +21170,7 @@ class ExotelAIAssistController extends EventEmitter {
|
|
|
21189
21170
|
this.emit("error", err);
|
|
21190
21171
|
return;
|
|
21191
21172
|
}
|
|
21192
|
-
if (msgType === "ack"
|
|
21173
|
+
if (msgType === "ack") {
|
|
21193
21174
|
(_b = this.transport) === null || _b === void 0 ? void 0 : _b.markAcknowledged();
|
|
21194
21175
|
this._fireReady();
|
|
21195
21176
|
}
|
package/dist/react/index.js
CHANGED
|
@@ -6210,18 +6210,6 @@ function requireObject_hash() {
|
|
|
6210
6210
|
var object_hashExports = requireObject_hash();
|
|
6211
6211
|
var objectHash = /*@__PURE__*/getDefaultExportFromCjs(object_hashExports);
|
|
6212
6212
|
|
|
6213
|
-
var Environment;
|
|
6214
|
-
(function (Environment) {
|
|
6215
|
-
Environment["PRODUCTION"] = "production";
|
|
6216
|
-
Environment["UAT"] = "uat";
|
|
6217
|
-
Environment["DEVELOPMENT"] = "development";
|
|
6218
|
-
})(Environment || (Environment = {}));
|
|
6219
|
-
const WssBaseUrl = {
|
|
6220
|
-
[Environment.PRODUCTION]: "wss://ai-assist.in.exotel.com",
|
|
6221
|
-
[Environment.UAT]: "wss://oneassist-uat.in.exotel.com",
|
|
6222
|
-
[Environment.DEVELOPMENT]: "ws://localhost:8081"
|
|
6223
|
-
};
|
|
6224
|
-
|
|
6225
6213
|
class Utils {
|
|
6226
6214
|
/**
|
|
6227
6215
|
* Returns a deterministic SHA-1 hex digest for any plain object.
|
|
@@ -6253,16 +6241,10 @@ class Utils {
|
|
|
6253
6241
|
* @param accountId - The account ID to get the base WebSocket URL for.
|
|
6254
6242
|
* @returns The base WebSocket URL.
|
|
6255
6243
|
*/
|
|
6256
|
-
static getWssBaseUrl(accountId
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
return `${WssBaseUrl[Environment.UAT]}/ai-assist/ws/v1/accounts/${accountId}/ai-assistants/conversation-events`;
|
|
6261
|
-
} else if (env === Environment.PRODUCTION) {
|
|
6262
|
-
return `${WssBaseUrl[Environment.PRODUCTION]}/ai-assist/ws/v1/accounts/${accountId}/ai-assistants/conversation-events`;
|
|
6263
|
-
} else {
|
|
6264
|
-
return `${WssBaseUrl[Environment.PRODUCTION]}/ai-assist/ws/v1/accounts/${accountId}/ai-assistants/conversation-events`;
|
|
6265
|
-
}
|
|
6244
|
+
static getWssBaseUrl(accountId) {
|
|
6245
|
+
// return `wss://ai-assist.in.exotel.com/ai-assist/accounts/${accountId}/one-assistant-event-publisher`;
|
|
6246
|
+
// return `wss://oneassist-uat.in.exotel.com/ai-assist/one-assistant-event-publisher/${accountId}`;
|
|
6247
|
+
return `wss://oneassist-uat.in.exotel.com/ai-assist/ws/v1/accounts/${accountId}/ai-assistants/conversation-events`;
|
|
6266
6248
|
}
|
|
6267
6249
|
/**
|
|
6268
6250
|
* Builds a WebSocket URL from the given parameters.
|
|
@@ -6270,18 +6252,17 @@ class Utils {
|
|
|
6270
6252
|
* @returns The WebSocket URL.
|
|
6271
6253
|
*/
|
|
6272
6254
|
static buildWsUrl(params) {
|
|
6273
|
-
var _a;
|
|
6274
6255
|
const {
|
|
6275
6256
|
wssBaseUrl
|
|
6276
6257
|
} = params;
|
|
6277
|
-
const resolved = wssBaseUrl !== null && wssBaseUrl !== void 0 ? wssBaseUrl : Utils.getWssBaseUrl(params.accountId
|
|
6258
|
+
const resolved = wssBaseUrl !== null && wssBaseUrl !== void 0 ? wssBaseUrl : Utils.getWssBaseUrl(params.accountId);
|
|
6278
6259
|
const base = resolved.endsWith("/") ? resolved.slice(0, -1) : resolved;
|
|
6279
6260
|
const query = Utils.constructQueryParams(params);
|
|
6280
6261
|
return `${base}?${query}`;
|
|
6281
6262
|
}
|
|
6282
6263
|
static constructQueryParams(params) {
|
|
6283
6264
|
// Keys consumed by the library — never forwarded to the server.
|
|
6284
|
-
const INTERNAL_KEYS = new Set(["authToken", "accountId", "wssBaseUrl", "reconnectInterval", "maxReconnectAttempts"
|
|
6265
|
+
const INTERNAL_KEYS = new Set(["authToken", "accountId", "wssBaseUrl", "reconnectInterval", "maxReconnectAttempts"]);
|
|
6285
6266
|
// Mandatory server params remapped to the names the API expects.
|
|
6286
6267
|
// accountId is embedded in the URL path — never sent as a query param.
|
|
6287
6268
|
const pairs = [];
|
|
@@ -6475,7 +6456,7 @@ class ExotelAIAssistController extends EventEmitter {
|
|
|
6475
6456
|
this.emit("error", err);
|
|
6476
6457
|
return;
|
|
6477
6458
|
}
|
|
6478
|
-
if (msgType === "ack"
|
|
6459
|
+
if (msgType === "ack") {
|
|
6479
6460
|
(_b = this.transport) === null || _b === void 0 ? void 0 : _b.markAcknowledged();
|
|
6480
6461
|
this._fireReady();
|
|
6481
6462
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
export declare enum Environment {
|
|
2
|
-
PRODUCTION = "production",
|
|
3
|
-
UAT = "uat",
|
|
4
|
-
DEVELOPMENT = "development"
|
|
5
|
-
}
|
|
6
|
-
export declare const WssBaseUrl: Record<Environment, string>;
|
|
7
1
|
export interface ExotelAIAssistParams {
|
|
8
2
|
authToken: string;
|
|
9
3
|
call_sid: string;
|
|
@@ -13,7 +7,6 @@ export interface ExotelAIAssistParams {
|
|
|
13
7
|
wssBaseUrl?: string;
|
|
14
8
|
reconnectInterval?: number;
|
|
15
9
|
maxReconnectAttempts?: number;
|
|
16
|
-
env?: Environment;
|
|
17
10
|
[key: string]: unknown;
|
|
18
11
|
}
|
|
19
12
|
/** A single AI-generated suggestion for the agent. */
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExotelAIAssistParams } from "../types";
|
|
2
2
|
export declare class Utils {
|
|
3
3
|
static MAX_EXTRA_QUERY_PARAMS: number;
|
|
4
4
|
/**
|
|
@@ -20,7 +20,7 @@ export declare class Utils {
|
|
|
20
20
|
* @param accountId - The account ID to get the base WebSocket URL for.
|
|
21
21
|
* @returns The base WebSocket URL.
|
|
22
22
|
*/
|
|
23
|
-
static getWssBaseUrl(accountId: string
|
|
23
|
+
static getWssBaseUrl(accountId: string): string;
|
|
24
24
|
/**
|
|
25
25
|
* Builds a WebSocket URL from the given parameters.
|
|
26
26
|
* @param params - The parameters to build the WebSocket URL from.
|
package/package.json
CHANGED