@botonic/core 0.56.0-alpha.0 → 0.57.0-rslib-esm.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.
- package/lib/esm/constants.js +7 -7
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/core-bot.d.ts +3 -3
- package/lib/esm/core-bot.js +87 -50
- package/lib/esm/core-bot.js.map +1 -1
- package/lib/esm/debug/index.d.ts +1 -1
- package/lib/esm/debug/index.js +5 -4
- package/lib/esm/debug/index.js.map +1 -1
- package/lib/esm/debug/inspector.d.ts +1 -1
- package/lib/esm/debug/inspector.js +27 -21
- package/lib/esm/debug/inspector.js.map +1 -1
- package/lib/esm/handoff.d.ts +1 -1
- package/lib/esm/handoff.js +82 -53
- package/lib/esm/handoff.js.map +1 -1
- package/lib/esm/hubtype-service.d.ts +3 -3
- package/lib/esm/hubtype-service.js +100 -64
- package/lib/esm/hubtype-service.js.map +1 -1
- package/lib/esm/index.d.ts +9 -9
- package/lib/esm/index.js +21 -12
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/models/ai-agents.d.ts +1 -8
- package/lib/esm/models/ai-agents.js +15 -16
- package/lib/esm/models/ai-agents.js.map +1 -1
- package/lib/esm/models/bot-config.js +6 -6
- package/lib/esm/models/bot-config.js.map +1 -1
- package/lib/esm/models/hubtype-analytics.d.ts +1 -1
- package/lib/esm/models/hubtype-analytics.js +10 -10
- package/lib/esm/models/hubtype-analytics.js.map +1 -1
- package/lib/esm/models/index.d.ts +4 -4
- package/lib/esm/models/index.js +11 -7
- package/lib/esm/models/index.js.map +1 -1
- package/lib/esm/models/legacy-types.js +24 -24
- package/lib/esm/models/legacy-types.js.map +1 -1
- package/lib/esm/package.json +3 -0
- package/lib/esm/plugins.d.ts +1 -1
- package/lib/esm/plugins.js +7 -8
- package/lib/esm/plugins.js.map +1 -1
- package/lib/esm/pusher-utils.js +15 -10
- package/lib/esm/pusher-utils.js.map +1 -1
- package/lib/esm/routing/index.d.ts +2 -2
- package/lib/esm/routing/index.js +7 -5
- package/lib/esm/routing/index.js.map +1 -1
- package/lib/esm/routing/router-utils.d.ts +1 -1
- package/lib/esm/routing/router-utils.js +37 -30
- package/lib/esm/routing/router-utils.js.map +1 -1
- package/lib/esm/routing/router.d.ts +2 -2
- package/lib/esm/routing/router.js +152 -149
- package/lib/esm/routing/router.js.map +1 -1
- package/lib/esm/testing/index.d.ts +1 -1
- package/lib/esm/testing/index.js +60 -94
- package/lib/esm/testing/index.js.map +1 -1
- package/lib/esm/utils/bot-config.d.ts +1 -1
- package/lib/esm/utils/bot-config.js +57 -28
- package/lib/esm/utils/bot-config.js.map +1 -1
- package/lib/esm/utils/check-providers.d.ts +1 -1
- package/lib/esm/utils/check-providers.js +14 -17
- package/lib/esm/utils/check-providers.js.map +1 -1
- package/lib/esm/utils/functional.js +19 -38
- package/lib/esm/utils/functional.js.map +1 -1
- package/lib/esm/utils/index.d.ts +3 -3
- package/lib/esm/utils/index.js +9 -6
- package/lib/esm/utils/index.js.map +1 -1
- package/package.json +12 -11
- package/src/hubtype-service.ts +4 -2
- package/src/models/ai-agents.ts +0 -9
- package/lib/cjs/constants.d.ts +0 -4
- package/lib/cjs/constants.js +0 -8
- package/lib/cjs/constants.js.map +0 -1
- package/lib/cjs/core-bot.d.ts +0 -43
- package/lib/cjs/core-bot.js +0 -205
- package/lib/cjs/core-bot.js.map +0 -1
- package/lib/cjs/debug/index.d.ts +0 -1
- package/lib/cjs/debug/index.js +0 -5
- package/lib/cjs/debug/index.js.map +0 -1
- package/lib/cjs/debug/inspector.d.ts +0 -24
- package/lib/cjs/debug/inspector.js +0 -70
- package/lib/cjs/debug/inspector.js.map +0 -1
- package/lib/cjs/handoff.d.ts +0 -110
- package/lib/cjs/handoff.js +0 -238
- package/lib/cjs/handoff.js.map +0 -1
- package/lib/cjs/hubtype-service.d.ts +0 -58
- package/lib/cjs/hubtype-service.js +0 -205
- package/lib/cjs/hubtype-service.js.map +0 -1
- package/lib/cjs/index.d.ts +0 -9
- package/lib/cjs/index.js +0 -13
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/models/ai-agents.d.ts +0 -147
- package/lib/cjs/models/ai-agents.js +0 -31
- package/lib/cjs/models/ai-agents.js.map +0 -1
- package/lib/cjs/models/bot-config.d.ts +0 -24
- package/lib/cjs/models/bot-config.js +0 -10
- package/lib/cjs/models/bot-config.js.map +0 -1
- package/lib/cjs/models/hubtype-analytics.d.ts +0 -210
- package/lib/cjs/models/hubtype-analytics.js +0 -38
- package/lib/cjs/models/hubtype-analytics.js.map +0 -1
- package/lib/cjs/models/index.d.ts +0 -4
- package/lib/cjs/models/index.js +0 -8
- package/lib/cjs/models/index.js.map +0 -1
- package/lib/cjs/models/legacy-types.d.ts +0 -332
- package/lib/cjs/models/legacy-types.js +0 -84
- package/lib/cjs/models/legacy-types.js.map +0 -1
- package/lib/cjs/plugins.d.ts +0 -9
- package/lib/cjs/plugins.js +0 -24
- package/lib/cjs/plugins.js.map +0 -1
- package/lib/cjs/pusher-utils.d.ts +0 -7
- package/lib/cjs/pusher-utils.js +0 -18
- package/lib/cjs/pusher-utils.js.map +0 -1
- package/lib/cjs/routing/index.d.ts +0 -2
- package/lib/cjs/routing/index.js +0 -6
- package/lib/cjs/routing/index.js.map +0 -1
- package/lib/cjs/routing/router-utils.d.ts +0 -11
- package/lib/cjs/routing/router-utils.js +0 -96
- package/lib/cjs/routing/router-utils.js.map +0 -1
- package/lib/cjs/routing/router.d.ts +0 -54
- package/lib/cjs/routing/router.js +0 -330
- package/lib/cjs/routing/router.js.map +0 -1
- package/lib/cjs/testing/index.d.ts +0 -91
- package/lib/cjs/testing/index.js +0 -196
- package/lib/cjs/testing/index.js.map +0 -1
- package/lib/cjs/utils/bot-config.d.ts +0 -4
- package/lib/cjs/utils/bot-config.js +0 -94
- package/lib/cjs/utils/bot-config.js.map +0 -1
- package/lib/cjs/utils/check-providers.d.ts +0 -8
- package/lib/cjs/utils/check-providers.js +0 -34
- package/lib/cjs/utils/check-providers.js.map +0 -1
- package/lib/cjs/utils/functional.d.ts +0 -10
- package/lib/cjs/utils/functional.js +0 -88
- package/lib/cjs/utils/functional.js.map +0 -1
- package/lib/cjs/utils/index.d.ts +0 -3
- package/lib/cjs/utils/index.js +0 -7
- package/lib/cjs/utils/index.js.map +0 -1
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HubtypeService = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
6
|
-
const pusher_js_1 = tslib_1.__importDefault(require("pusher-js"));
|
|
7
|
-
const pusher_utils_1 = require("./pusher-utils");
|
|
8
|
-
const WEBCHAT_PUSHER_KEY = process.env.WEBCHAT_PUSHER_KEY || '434ca667c8e6cb3f641c'; // pragma: allowlist secret
|
|
9
|
-
const HUBTYPE_API_URL = process.env.HUBTYPE_API_URL || 'https://api.hubtype.com';
|
|
10
|
-
const ACTIVITY_TIMEOUT = 20 * 1000; // https://pusher.com/docs/channels/using_channels/connection#activitytimeout-integer-
|
|
11
|
-
const PONG_TIMEOUT = 5 * 1000; // https://pusher.com/docs/channels/using_channels/connection#pongtimeout-integer-
|
|
12
|
-
/**
|
|
13
|
-
* Calls Hubtype APIs from Webchat
|
|
14
|
-
*/
|
|
15
|
-
class HubtypeService {
|
|
16
|
-
constructor({ appId, user, lastMessageId, lastMessageUpdateDate, onEvent, unsentInputs, server, }) {
|
|
17
|
-
this.PUSHER_CONNECT_TIMEOUT_MS = 10000;
|
|
18
|
-
this.appId = appId;
|
|
19
|
-
this.user = user || {};
|
|
20
|
-
this.lastMessageId = lastMessageId;
|
|
21
|
-
this.lastMessageUpdateDate = lastMessageUpdateDate;
|
|
22
|
-
this.onEvent = onEvent;
|
|
23
|
-
this.unsentInputs = unsentInputs;
|
|
24
|
-
this.server = server;
|
|
25
|
-
if (this.user.id && (lastMessageId || lastMessageUpdateDate)) {
|
|
26
|
-
// It's safe not awaiting Promise because:
|
|
27
|
-
// * it will never be called from AWS lambda
|
|
28
|
-
// * though init() is called again from postMesage, it does nothing if Pusher already created
|
|
29
|
-
this.init();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
init(user, lastMessageId, lastMessageUpdateDate) {
|
|
33
|
-
if (user) {
|
|
34
|
-
this.user = user;
|
|
35
|
-
}
|
|
36
|
-
if (lastMessageId) {
|
|
37
|
-
this.lastMessageId = lastMessageId;
|
|
38
|
-
}
|
|
39
|
-
if (lastMessageUpdateDate) {
|
|
40
|
-
this.lastMessageUpdateDate = lastMessageUpdateDate;
|
|
41
|
-
}
|
|
42
|
-
return this._initPusher();
|
|
43
|
-
}
|
|
44
|
-
_initPusher() {
|
|
45
|
-
if (this.pusher) {
|
|
46
|
-
return Promise.resolve();
|
|
47
|
-
}
|
|
48
|
-
if (!this.user.id || !this.appId) {
|
|
49
|
-
// TODO recover user & appId somehow
|
|
50
|
-
return Promise.reject('No User or appId. Clear cache and reload');
|
|
51
|
-
}
|
|
52
|
-
this.pusher = new pusher_js_1.default(WEBCHAT_PUSHER_KEY, {
|
|
53
|
-
cluster: 'eu',
|
|
54
|
-
authEndpoint: `${HUBTYPE_API_URL}/v1/provider_accounts/webhooks/webchat/${this.appId}/auth/`,
|
|
55
|
-
forceTLS: true,
|
|
56
|
-
auth: {
|
|
57
|
-
headers: this.constructHeaders(),
|
|
58
|
-
},
|
|
59
|
-
...this.resolveServerConfig(),
|
|
60
|
-
});
|
|
61
|
-
this.channel = this.pusher.subscribe(this.pusherChannel);
|
|
62
|
-
const connectionPromise = new Promise((resolve, reject) => {
|
|
63
|
-
const cleanAndReject = msg => {
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
65
|
-
clearTimeout(connectTimeout);
|
|
66
|
-
this.destroyPusher();
|
|
67
|
-
reject(msg);
|
|
68
|
-
};
|
|
69
|
-
const connectTimeout = setTimeout(() => cleanAndReject('Connection Timeout'), this.PUSHER_CONNECT_TIMEOUT_MS);
|
|
70
|
-
this.channel.bind('pusher:subscription_succeeded', () => {
|
|
71
|
-
// Once subscribed, we know that authentication has been done: https://pusher.com/docs/channels/server_api/authenticating-users
|
|
72
|
-
this.onConnectionRegained();
|
|
73
|
-
clearTimeout(connectTimeout);
|
|
74
|
-
resolve();
|
|
75
|
-
});
|
|
76
|
-
this.channel.bind('botonic_response', data => this.onPusherEvent(data));
|
|
77
|
-
this.channel.bind('botonic_response_compressed', compressedData => {
|
|
78
|
-
try {
|
|
79
|
-
const data = JSON.parse((0, pusher_utils_1.decompressData)(compressedData));
|
|
80
|
-
this.onPusherEvent(data);
|
|
81
|
-
}
|
|
82
|
-
catch (e) {
|
|
83
|
-
console.error('Error: Unable to decompress data', e);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
this.channel.bind('update_message_info', data => this.onPusherEvent(data));
|
|
87
|
-
this.pusher?.connection.bind('error', event => {
|
|
88
|
-
if (event.type === 'WebSocketError') {
|
|
89
|
-
this.handleConnectionChange(false);
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
const errorMsg = event.error?.data
|
|
93
|
-
? event.error.data.code || event.error.data.message
|
|
94
|
-
: 'Connection error';
|
|
95
|
-
cleanAndReject(`Pusher error (${errorMsg})`);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
this.pusher.connection.bind('state_change', states => {
|
|
100
|
-
if (states.current === 'connecting') {
|
|
101
|
-
this.updateAuthHeaders();
|
|
102
|
-
}
|
|
103
|
-
if (states.current === 'connected') {
|
|
104
|
-
this.handleConnectionChange(true);
|
|
105
|
-
}
|
|
106
|
-
if (states.current === 'unavailable') {
|
|
107
|
-
this.handleConnectionChange(false);
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
return connectionPromise;
|
|
111
|
-
}
|
|
112
|
-
constructHeaders() {
|
|
113
|
-
const headers = {};
|
|
114
|
-
if (this.user?.id) {
|
|
115
|
-
headers['X-BOTONIC-USER-ID'] = this.user.id;
|
|
116
|
-
}
|
|
117
|
-
if (this.lastMessageId) {
|
|
118
|
-
headers['X-BOTONIC-LAST-MESSAGE-ID'] = this.lastMessageId;
|
|
119
|
-
}
|
|
120
|
-
if (this.lastMessageUpdateDate) {
|
|
121
|
-
headers['X-BOTONIC-LAST-MESSAGE-UPDATE-DATE'] = this.lastMessageUpdateDate;
|
|
122
|
-
}
|
|
123
|
-
return headers;
|
|
124
|
-
}
|
|
125
|
-
resolveServerConfig() {
|
|
126
|
-
if (!this.server) {
|
|
127
|
-
return { activityTimeout: ACTIVITY_TIMEOUT, pongTimeout: PONG_TIMEOUT };
|
|
128
|
-
}
|
|
129
|
-
return {
|
|
130
|
-
activityTimeout: this.server.activityTimeout || ACTIVITY_TIMEOUT,
|
|
131
|
-
pongTimeout: this.server.pongTimeout || PONG_TIMEOUT,
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
updateAuthHeaders() {
|
|
135
|
-
if (this.pusher) {
|
|
136
|
-
this.pusher.config.auth.headers = {
|
|
137
|
-
...this.pusher.config.auth.headers,
|
|
138
|
-
...this.constructHeaders(),
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
handleConnectionChange(online) {
|
|
143
|
-
this.onPusherEvent({ action: 'connectionChange', online });
|
|
144
|
-
}
|
|
145
|
-
onPusherEvent(event) {
|
|
146
|
-
if (this.onEvent && typeof this.onEvent === 'function') {
|
|
147
|
-
this.onEvent(event);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
get pusherChannel() {
|
|
151
|
-
return `private-encrypted-${this.appId}-${this.user.id}`;
|
|
152
|
-
}
|
|
153
|
-
handleSentInput(message) {
|
|
154
|
-
this.onEvent({
|
|
155
|
-
action: 'update_message_info',
|
|
156
|
-
message: { id: message.id, ack: 1 },
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
handleUnsentInput(message) {
|
|
160
|
-
this.onEvent({
|
|
161
|
-
action: 'update_message_info',
|
|
162
|
-
message: { id: message.id, ack: 0, unsentInput: message },
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
async postMessage(user, message) {
|
|
166
|
-
try {
|
|
167
|
-
await this.init(user);
|
|
168
|
-
await axios_1.default.post(`${HUBTYPE_API_URL}/v1/provider_accounts/webhooks/webchat/${this.appId}/`, {
|
|
169
|
-
sender: this.user,
|
|
170
|
-
message: message,
|
|
171
|
-
}, {
|
|
172
|
-
validateStatus: status => status === 200,
|
|
173
|
-
});
|
|
174
|
-
this.handleSentInput(message);
|
|
175
|
-
}
|
|
176
|
-
catch (_e) {
|
|
177
|
-
this.handleUnsentInput(message);
|
|
178
|
-
}
|
|
179
|
-
return Promise.resolve();
|
|
180
|
-
}
|
|
181
|
-
static async getWebchatVisibility(appId) {
|
|
182
|
-
return axios_1.default.get(`${HUBTYPE_API_URL}/v1/provider_accounts/${appId}/visibility/`);
|
|
183
|
-
}
|
|
184
|
-
destroyPusher() {
|
|
185
|
-
if (!this.pusher) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
this.pusher.disconnect();
|
|
189
|
-
this.pusher.unsubscribe(this.pusherChannel);
|
|
190
|
-
this.pusher.unbind_all();
|
|
191
|
-
this.pusher.channels = {};
|
|
192
|
-
this.pusher = null;
|
|
193
|
-
}
|
|
194
|
-
async onConnectionRegained() {
|
|
195
|
-
await this.resendUnsentInputs();
|
|
196
|
-
}
|
|
197
|
-
async resendUnsentInputs() {
|
|
198
|
-
for (const message of this.unsentInputs()) {
|
|
199
|
-
message.unsentInput &&
|
|
200
|
-
(await this.postMessage(this.user, message.unsentInput));
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
exports.HubtypeService = HubtypeService;
|
|
205
|
-
//# sourceMappingURL=hubtype-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hubtype-service.js","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K,CAAC,kBAAkB;QACtB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,YAAY,EAAE,EAAE,CAAC;YAC1C,OAAO,CAAC,WAAW;gBACjB,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAA;QAC5D,CAAC;IACH,CAAC;CACF;AAnPD,wCAmPC"}
|
package/lib/cjs/index.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export * from './constants';
|
|
2
|
-
export * from './core-bot';
|
|
3
|
-
export * from './debug';
|
|
4
|
-
export * from './handoff';
|
|
5
|
-
export * from './hubtype-service';
|
|
6
|
-
export * from './models';
|
|
7
|
-
export * from './plugins';
|
|
8
|
-
export * from './routing';
|
|
9
|
-
export * from './utils';
|
package/lib/cjs/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./constants"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./core-bot"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./debug"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./handoff"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./hubtype-service"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./models"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./plugins"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./routing"), exports);
|
|
12
|
-
tslib_1.__exportStar(require("./utils"), exports);
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,sDAA2B;AAC3B,qDAA0B;AAC1B,kDAAuB;AACvB,oDAAyB;AACzB,4DAAiC;AACjC,mDAAwB;AACxB,oDAAyB;AACzB,oDAAyB;AACzB,kDAAuB"}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import type { z } from 'zod';
|
|
2
|
-
export declare enum OutputMessageType {
|
|
3
|
-
Text = "text",
|
|
4
|
-
TextWithButtons = "textWithButtons",
|
|
5
|
-
BotExecutor = "botExecutor",
|
|
6
|
-
Carousel = "carousel",
|
|
7
|
-
RequestContactInfo = "requestContactInfo",
|
|
8
|
-
Exit = "exit"
|
|
9
|
-
}
|
|
10
|
-
export interface BaseMessage<T extends string = OutputMessageType> {
|
|
11
|
-
type: T;
|
|
12
|
-
}
|
|
13
|
-
export interface Button {
|
|
14
|
-
text: string;
|
|
15
|
-
payload?: string;
|
|
16
|
-
url?: string;
|
|
17
|
-
target?: string;
|
|
18
|
-
}
|
|
19
|
-
export interface ButtonWithPayload {
|
|
20
|
-
text: string;
|
|
21
|
-
payload: string;
|
|
22
|
-
}
|
|
23
|
-
export interface TextMessage extends BaseMessage {
|
|
24
|
-
type: OutputMessageType.Text;
|
|
25
|
-
content: {
|
|
26
|
-
text: string;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export interface TextWithButtonsMessage extends BaseMessage {
|
|
30
|
-
type: OutputMessageType.TextWithButtons;
|
|
31
|
-
content: {
|
|
32
|
-
text: string;
|
|
33
|
-
buttons: Button[];
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export interface BotExecutorMessage extends BaseMessage {
|
|
37
|
-
type: OutputMessageType.BotExecutor;
|
|
38
|
-
content: {
|
|
39
|
-
text: string;
|
|
40
|
-
buttons: ButtonWithPayload[];
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
interface CarouselElement {
|
|
44
|
-
title: string;
|
|
45
|
-
subtitle: string;
|
|
46
|
-
image: string;
|
|
47
|
-
button: Button;
|
|
48
|
-
}
|
|
49
|
-
export interface CarouselMessage extends BaseMessage {
|
|
50
|
-
type: OutputMessageType.Carousel;
|
|
51
|
-
content: {
|
|
52
|
-
text?: string;
|
|
53
|
-
elements: CarouselElement[];
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
export interface RequestContactInfoMessage extends BaseMessage {
|
|
57
|
-
type: OutputMessageType.RequestContactInfo;
|
|
58
|
-
content: {
|
|
59
|
-
text: string;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
export interface ExitMessage extends BaseMessage {
|
|
63
|
-
type: OutputMessageType.Exit;
|
|
64
|
-
}
|
|
65
|
-
export type OutputMessage<Extra extends BaseMessage<string> = never> = TextMessage | TextWithButtonsMessage | BotExecutorMessage | CarouselMessage | RequestContactInfoMessage | ExitMessage | Extra;
|
|
66
|
-
export type AgenticOutputMessage<Extra extends BaseMessage<string> = never> = Exclude<OutputMessage<Extra>, ExitMessage>;
|
|
67
|
-
export interface ToolExecution {
|
|
68
|
-
toolName: string;
|
|
69
|
-
toolArguments: Record<string, any>;
|
|
70
|
-
toolResults?: string;
|
|
71
|
-
knowledgebaseSourcesIds?: string[];
|
|
72
|
-
knowledgebaseChunksIds?: string[];
|
|
73
|
-
}
|
|
74
|
-
export interface AvailableSpecialist {
|
|
75
|
-
name: string;
|
|
76
|
-
description: string;
|
|
77
|
-
}
|
|
78
|
-
export interface RunResult<Extra extends BaseMessage<string> = never> {
|
|
79
|
-
messages: AgenticOutputMessage<Extra>[];
|
|
80
|
-
toolsExecuted: ToolExecution[];
|
|
81
|
-
memoryLength: number;
|
|
82
|
-
exit: boolean;
|
|
83
|
-
error: boolean;
|
|
84
|
-
inputGuardrailsTriggered: string[];
|
|
85
|
-
outputGuardrailsTriggered: string[];
|
|
86
|
-
startingAgentName: string;
|
|
87
|
-
lastAgentName: string;
|
|
88
|
-
availableSpecialists: AvailableSpecialist[];
|
|
89
|
-
isTransferredToSpecialist: boolean;
|
|
90
|
-
}
|
|
91
|
-
export type InferenceResponse<Extra extends BaseMessage<string> = never> = RunResult<Extra>;
|
|
92
|
-
export interface GuardrailRule {
|
|
93
|
-
name: string;
|
|
94
|
-
description: string;
|
|
95
|
-
}
|
|
96
|
-
export declare enum VerbosityLevel {
|
|
97
|
-
Low = "low",
|
|
98
|
-
Medium = "medium",
|
|
99
|
-
High = "high"
|
|
100
|
-
}
|
|
101
|
-
export declare enum ReasoningEffort {
|
|
102
|
-
None = "none",
|
|
103
|
-
Low = "low",
|
|
104
|
-
Medium = "medium",
|
|
105
|
-
High = "high"
|
|
106
|
-
}
|
|
107
|
-
export interface HubtypeAssistantMessage {
|
|
108
|
-
role: 'assistant';
|
|
109
|
-
content: string;
|
|
110
|
-
}
|
|
111
|
-
export interface HubtypeUserMessage {
|
|
112
|
-
role: 'user';
|
|
113
|
-
content: string;
|
|
114
|
-
}
|
|
115
|
-
export declare enum AiAgentType {
|
|
116
|
-
Specialist = "specialist",
|
|
117
|
-
Router = "router"
|
|
118
|
-
}
|
|
119
|
-
export type AiAgentArgs = AiAgentSpecialistArgs | AIAgentRouterArgs;
|
|
120
|
-
export type AiAgentBaseArgs = {
|
|
121
|
-
type: AiAgentType;
|
|
122
|
-
name: string;
|
|
123
|
-
instructions: string;
|
|
124
|
-
model: string;
|
|
125
|
-
verbosity: VerbosityLevel;
|
|
126
|
-
reasoningEffort?: ReasoningEffort;
|
|
127
|
-
disableForceRetrieveKnowledge?: boolean;
|
|
128
|
-
inputGuardrailRules?: GuardrailRule[];
|
|
129
|
-
previousHubtypeMessages?: HubtypeAssistantMessage[];
|
|
130
|
-
outputMessagesSchemas?: z.ZodObject<any>[];
|
|
131
|
-
forceToolNameOverride?: string;
|
|
132
|
-
};
|
|
133
|
-
export interface AiAgentSpecialistArgs extends AiAgentBaseArgs {
|
|
134
|
-
type: AiAgentType.Specialist;
|
|
135
|
-
activeTools: {
|
|
136
|
-
name: string;
|
|
137
|
-
}[];
|
|
138
|
-
sourceIds: string[];
|
|
139
|
-
}
|
|
140
|
-
interface AIAgentRoute extends AiAgentSpecialistArgs {
|
|
141
|
-
description: string;
|
|
142
|
-
}
|
|
143
|
-
export interface AIAgentRouterArgs extends AiAgentBaseArgs {
|
|
144
|
-
type: AiAgentType.Router;
|
|
145
|
-
specialists: AIAgentRoute[];
|
|
146
|
-
}
|
|
147
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AiAgentType = exports.ReasoningEffort = exports.VerbosityLevel = exports.OutputMessageType = void 0;
|
|
4
|
-
var OutputMessageType;
|
|
5
|
-
(function (OutputMessageType) {
|
|
6
|
-
OutputMessageType["Text"] = "text";
|
|
7
|
-
OutputMessageType["TextWithButtons"] = "textWithButtons";
|
|
8
|
-
OutputMessageType["BotExecutor"] = "botExecutor";
|
|
9
|
-
OutputMessageType["Carousel"] = "carousel";
|
|
10
|
-
OutputMessageType["RequestContactInfo"] = "requestContactInfo";
|
|
11
|
-
OutputMessageType["Exit"] = "exit";
|
|
12
|
-
})(OutputMessageType || (exports.OutputMessageType = OutputMessageType = {}));
|
|
13
|
-
var VerbosityLevel;
|
|
14
|
-
(function (VerbosityLevel) {
|
|
15
|
-
VerbosityLevel["Low"] = "low";
|
|
16
|
-
VerbosityLevel["Medium"] = "medium";
|
|
17
|
-
VerbosityLevel["High"] = "high";
|
|
18
|
-
})(VerbosityLevel || (exports.VerbosityLevel = VerbosityLevel = {}));
|
|
19
|
-
var ReasoningEffort;
|
|
20
|
-
(function (ReasoningEffort) {
|
|
21
|
-
ReasoningEffort["None"] = "none";
|
|
22
|
-
ReasoningEffort["Low"] = "low";
|
|
23
|
-
ReasoningEffort["Medium"] = "medium";
|
|
24
|
-
ReasoningEffort["High"] = "high";
|
|
25
|
-
})(ReasoningEffort || (exports.ReasoningEffort = ReasoningEffort = {}));
|
|
26
|
-
var AiAgentType;
|
|
27
|
-
(function (AiAgentType) {
|
|
28
|
-
AiAgentType["Specialist"] = "specialist";
|
|
29
|
-
AiAgentType["Router"] = "router";
|
|
30
|
-
})(AiAgentType || (exports.AiAgentType = AiAgentType = {}));
|
|
31
|
-
//# sourceMappingURL=ai-agents.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-agents.js","sourceRoot":"","sources":["../../../src/models/ai-agents.ts"],"names":[],"mappings":";;;AAEA,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,kCAAa,CAAA;IACb,wDAAmC,CAAA;IACnC,gDAA2B,CAAA;IAC3B,0CAAqB,CAAA;IACrB,8DAAyC,CAAA;IACzC,kCAAa,CAAA;AACf,CAAC,EAPW,iBAAiB,iCAAjB,iBAAiB,QAO5B;AAgHD,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,mCAAiB,CAAA;IACjB,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB;AAED,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,gCAAa,CAAA;IACb,8BAAW,CAAA;IACX,oCAAiB,CAAA;IACjB,gCAAa,CAAA;AACf,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B;AAYD,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,wCAAyB,CAAA;IACzB,gCAAiB,CAAA;AACnB,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { core } from 'zod';
|
|
2
|
-
export interface BotConfigJSON {
|
|
3
|
-
tools: ToolConfigJSON[];
|
|
4
|
-
payloads: string[];
|
|
5
|
-
webviews: WebviewConfigJSON[];
|
|
6
|
-
variables?: VariableConfigJSON[];
|
|
7
|
-
}
|
|
8
|
-
export interface ToolConfigJSON {
|
|
9
|
-
name: string;
|
|
10
|
-
schema?: core.JSONSchema.JSONSchema;
|
|
11
|
-
description: string;
|
|
12
|
-
}
|
|
13
|
-
export interface WebviewConfigJSON {
|
|
14
|
-
name: string;
|
|
15
|
-
}
|
|
16
|
-
export declare enum VariableType {
|
|
17
|
-
String = "string",
|
|
18
|
-
Number = "number",
|
|
19
|
-
Boolean = "boolean"
|
|
20
|
-
}
|
|
21
|
-
export interface VariableConfigJSON {
|
|
22
|
-
key_path: string;
|
|
23
|
-
type: VariableType;
|
|
24
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VariableType = void 0;
|
|
4
|
-
var VariableType;
|
|
5
|
-
(function (VariableType) {
|
|
6
|
-
VariableType["String"] = "string";
|
|
7
|
-
VariableType["Number"] = "number";
|
|
8
|
-
VariableType["Boolean"] = "boolean";
|
|
9
|
-
})(VariableType || (exports.VariableType = VariableType = {}));
|
|
10
|
-
//# sourceMappingURL=bot-config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bot-config.js","sourceRoot":"","sources":["../../../src/models/bot-config.ts"],"names":[],"mappings":";;;AAoBA,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,iCAAiB,CAAA;IACjB,mCAAmB,CAAA;AACrB,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB"}
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import type { AvailableSpecialist, ToolExecution } from './ai-agents';
|
|
2
|
-
export declare const EVENT_FORMAT_VERSION = 5;
|
|
3
|
-
export declare enum EventAction {
|
|
4
|
-
AiAgent = "ai_agent",
|
|
5
|
-
FeedbackCase = "feedback_case",
|
|
6
|
-
FeedbackMessage = "feedback_message",
|
|
7
|
-
FeedbackConversation = "feedback_conversation",
|
|
8
|
-
FeedbackWebview = "feedback_webview",
|
|
9
|
-
FlowNode = "flow_node",
|
|
10
|
-
ConditionalCountry = "conditional_country",
|
|
11
|
-
ConditionalQueueStatus = "conditional_queue_status",
|
|
12
|
-
ConditionalCustom = "conditional_custom",
|
|
13
|
-
ConditionalChannel = "conditional_channel",
|
|
14
|
-
BotAction = "bot_action",
|
|
15
|
-
WebviewActionTriggered = "webview_action_triggered",
|
|
16
|
-
HandoffOption = "handoff_option",
|
|
17
|
-
HandoffSuccess = "handoff_success",
|
|
18
|
-
HandoffFail = "handoff_fail",
|
|
19
|
-
Keyword = "nlu_keyword",
|
|
20
|
-
IntentSmart = "nlu_intent_smart",
|
|
21
|
-
Fallback = "fallback",
|
|
22
|
-
WebviewStep = "webview_step",
|
|
23
|
-
WebviewEnd = "webview_end",
|
|
24
|
-
Custom = "custom",
|
|
25
|
-
RedirectFlow = "redirect_flow",
|
|
26
|
-
CaptureUserInput = "capture_user_input",
|
|
27
|
-
AiAgentRouter = "ai_agent_router"
|
|
28
|
-
}
|
|
29
|
-
export interface HtBaseEventProps {
|
|
30
|
-
action: EventAction;
|
|
31
|
-
}
|
|
32
|
-
export interface HtBaseEventAllFlowProps extends HtBaseEventProps {
|
|
33
|
-
flowThreadId: string;
|
|
34
|
-
flowId: string;
|
|
35
|
-
flowName: string;
|
|
36
|
-
flowNodeId: string;
|
|
37
|
-
flowNodeContentId: string;
|
|
38
|
-
flowNodeIsMeaningful: boolean;
|
|
39
|
-
}
|
|
40
|
-
export interface EventFeedback extends HtBaseEventProps {
|
|
41
|
-
action: EventAction.FeedbackCase | EventAction.FeedbackConversation | EventAction.FeedbackMessage | EventAction.FeedbackWebview;
|
|
42
|
-
feedbackTargetId: string;
|
|
43
|
-
feedbackGroupId: string;
|
|
44
|
-
possibleOptions: string[];
|
|
45
|
-
possibleValues?: number[];
|
|
46
|
-
option: string;
|
|
47
|
-
value?: number;
|
|
48
|
-
comment?: string;
|
|
49
|
-
}
|
|
50
|
-
export interface EventFlow extends HtBaseEventProps {
|
|
51
|
-
action: EventAction.FlowNode;
|
|
52
|
-
flowThreadId: string;
|
|
53
|
-
flowId: string;
|
|
54
|
-
flowName: string;
|
|
55
|
-
flowNodeId: string;
|
|
56
|
-
flowNodeContentId: string;
|
|
57
|
-
flowNodeIsMeaningful?: boolean;
|
|
58
|
-
}
|
|
59
|
-
export interface EventBotAction extends HtBaseEventAllFlowProps {
|
|
60
|
-
action: EventAction.BotAction;
|
|
61
|
-
payload: string;
|
|
62
|
-
}
|
|
63
|
-
export interface EventConditionalCountry extends HtBaseEventAllFlowProps {
|
|
64
|
-
action: EventAction.ConditionalCountry;
|
|
65
|
-
country: string;
|
|
66
|
-
}
|
|
67
|
-
export interface EventConditionalQueueStatus extends HtBaseEventAllFlowProps {
|
|
68
|
-
action: EventAction.ConditionalQueueStatus;
|
|
69
|
-
queueId: string;
|
|
70
|
-
queueName: string;
|
|
71
|
-
isQueueOpen: boolean;
|
|
72
|
-
isAvailableAgent: boolean;
|
|
73
|
-
}
|
|
74
|
-
export interface EventConditionalCustom extends HtBaseEventAllFlowProps {
|
|
75
|
-
action: EventAction.ConditionalCustom;
|
|
76
|
-
conditionalVariable: string;
|
|
77
|
-
variableFormat: string;
|
|
78
|
-
operator: string;
|
|
79
|
-
}
|
|
80
|
-
export interface EventConditionalChannel extends HtBaseEventAllFlowProps {
|
|
81
|
-
action: EventAction.ConditionalChannel;
|
|
82
|
-
channel: string;
|
|
83
|
-
}
|
|
84
|
-
export interface EventHandoff extends HtBaseEventProps {
|
|
85
|
-
action: EventAction.HandoffSuccess | EventAction.HandoffFail;
|
|
86
|
-
flowThreadId?: string;
|
|
87
|
-
flowId: string;
|
|
88
|
-
flowName: string;
|
|
89
|
-
flowNodeId: string;
|
|
90
|
-
flowNodeContentId: string;
|
|
91
|
-
queueId: string;
|
|
92
|
-
queueName: string;
|
|
93
|
-
caseId?: string;
|
|
94
|
-
isQueueOpen?: boolean;
|
|
95
|
-
isAvailableAgent?: boolean;
|
|
96
|
-
isThresholdReached?: boolean;
|
|
97
|
-
}
|
|
98
|
-
export interface EventHandoffOption extends HtBaseEventProps {
|
|
99
|
-
action: EventAction.HandoffOption;
|
|
100
|
-
flowThreadId?: string;
|
|
101
|
-
flowId: string;
|
|
102
|
-
flowName: string;
|
|
103
|
-
flowNodeId: string;
|
|
104
|
-
flowNodeContentId: string;
|
|
105
|
-
queueId?: string;
|
|
106
|
-
queueName?: string;
|
|
107
|
-
}
|
|
108
|
-
export interface EventKeyword extends HtBaseEventProps {
|
|
109
|
-
action: EventAction.Keyword;
|
|
110
|
-
flowThreadId: string;
|
|
111
|
-
flowId: string;
|
|
112
|
-
flowName: string;
|
|
113
|
-
flowNodeId: string;
|
|
114
|
-
flowNodeContentId: string;
|
|
115
|
-
nluKeywordName: string;
|
|
116
|
-
nluKeywordIsRegex?: boolean;
|
|
117
|
-
nluKeywordMessageId: string;
|
|
118
|
-
userInput: string;
|
|
119
|
-
}
|
|
120
|
-
export interface EventIntentSmart extends HtBaseEventProps {
|
|
121
|
-
action: EventAction.IntentSmart;
|
|
122
|
-
flowThreadId: string;
|
|
123
|
-
flowId: string;
|
|
124
|
-
flowName: string;
|
|
125
|
-
flowNodeId: string;
|
|
126
|
-
flowNodeContentId: string;
|
|
127
|
-
nluIntentSmartTitle: string;
|
|
128
|
-
nluIntentSmartNumUsed: number;
|
|
129
|
-
nluIntentSmartMessageId: string;
|
|
130
|
-
userInput: string;
|
|
131
|
-
}
|
|
132
|
-
export interface EventWebviewActionTriggered extends HtBaseEventAllFlowProps {
|
|
133
|
-
action: EventAction.WebviewActionTriggered;
|
|
134
|
-
webviewTargetId: string;
|
|
135
|
-
webviewName: string;
|
|
136
|
-
webviewParams?: Record<string, string>;
|
|
137
|
-
}
|
|
138
|
-
export interface EventAiAgent extends HtBaseEventAllFlowProps {
|
|
139
|
-
action: EventAction.AiAgent;
|
|
140
|
-
toolsExecuted: ToolExecution[];
|
|
141
|
-
inputMessageId: string;
|
|
142
|
-
memoryLength: number;
|
|
143
|
-
inputGuardrailsTriggered: string[];
|
|
144
|
-
outputGuardrailsTriggered: string[];
|
|
145
|
-
exit: boolean;
|
|
146
|
-
error: boolean;
|
|
147
|
-
}
|
|
148
|
-
export interface EventAiAgentRouter extends HtBaseEventAllFlowProps {
|
|
149
|
-
action: EventAction.AiAgentRouter;
|
|
150
|
-
inputMessageId: string;
|
|
151
|
-
memoryLength: number;
|
|
152
|
-
inputGuardrailsTriggered: string[];
|
|
153
|
-
outputGuardrailsTriggered: string[];
|
|
154
|
-
exit: boolean;
|
|
155
|
-
error: boolean;
|
|
156
|
-
startingAgentName: string;
|
|
157
|
-
lastAgentName: string;
|
|
158
|
-
availableSpecialists: AvailableSpecialist[];
|
|
159
|
-
isTransferredToSpecialist: boolean;
|
|
160
|
-
}
|
|
161
|
-
export interface EventRedirectFlow extends HtBaseEventAllFlowProps {
|
|
162
|
-
action: EventAction.RedirectFlow;
|
|
163
|
-
flowTargetId: string;
|
|
164
|
-
flowTargetName: string;
|
|
165
|
-
}
|
|
166
|
-
export interface EventCaptureUserInput extends HtBaseEventAllFlowProps {
|
|
167
|
-
action: EventAction.CaptureUserInput;
|
|
168
|
-
fieldName: string;
|
|
169
|
-
userInput: string;
|
|
170
|
-
captureSuccess: boolean;
|
|
171
|
-
messageId: string;
|
|
172
|
-
}
|
|
173
|
-
export interface EventFallback extends HtBaseEventProps {
|
|
174
|
-
action: EventAction.Fallback;
|
|
175
|
-
flowId: string;
|
|
176
|
-
flowName: string;
|
|
177
|
-
flowNodeId: string;
|
|
178
|
-
flowNodeContentId: string;
|
|
179
|
-
userInput: string;
|
|
180
|
-
fallbackOut: number;
|
|
181
|
-
fallbackMessageId: string;
|
|
182
|
-
}
|
|
183
|
-
export interface EventWebviewStep extends HtBaseEventProps {
|
|
184
|
-
action: EventAction.WebviewStep;
|
|
185
|
-
flowThreadId?: string;
|
|
186
|
-
webviewThreadId: string;
|
|
187
|
-
webviewName: string;
|
|
188
|
-
webviewStepName: string;
|
|
189
|
-
webviewStepNumber: number;
|
|
190
|
-
}
|
|
191
|
-
export interface EventWebviewEnd extends HtBaseEventProps {
|
|
192
|
-
action: EventAction.WebviewEnd;
|
|
193
|
-
flowThreadId?: string;
|
|
194
|
-
webviewThreadId: string;
|
|
195
|
-
webviewName: string;
|
|
196
|
-
webviewStepName?: string;
|
|
197
|
-
webviewStepNumber?: number;
|
|
198
|
-
webviewEndFailType?: WebviewEndFailType;
|
|
199
|
-
webviewEndFailMessage?: string;
|
|
200
|
-
}
|
|
201
|
-
export declare enum WebviewEndFailType {
|
|
202
|
-
CanceledByUser = "canceled_by_user",
|
|
203
|
-
ApiError = "api_error",
|
|
204
|
-
NeedsEscalation = "needs_escalation"
|
|
205
|
-
}
|
|
206
|
-
export interface EventCustom extends HtBaseEventProps {
|
|
207
|
-
action: EventAction.Custom;
|
|
208
|
-
customFields?: Record<string, any>;
|
|
209
|
-
customSensitiveFields?: Record<string, any>;
|
|
210
|
-
}
|