@scout9/app 1.0.0-alpha.0.8.2 → 1.0.0-alpha.0.8.3
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/dist/{dev-bc9e04ca.cjs → dev-0102b73f.cjs} +2 -2
- package/dist/{index-0d4223e3.cjs → index-5f4f222f.cjs} +6 -6
- package/dist/index.cjs +3 -3
- package/dist/{multipart-parser-0717500b.cjs → multipart-parser-22a1e9f6.cjs} +3 -3
- package/dist/{spirits-5dc52d64.cjs → spirits-6abaf567.cjs} +102 -100
- package/dist/spirits.cjs +1 -1
- package/dist/testing-tools.cjs +2 -2
- package/package.json +1 -1
- package/src/testing-tools/spirits.js +2 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var spirits = require("./spirits-
|
|
3
|
+
var spirits = require("./spirits-6abaf567.cjs");
|
|
4
4
|
var require$$0$4 = require('util');
|
|
5
5
|
var require$$0$3 = require('stream');
|
|
6
6
|
var require$$1 = require('path');
|
|
@@ -35337,7 +35337,7 @@ function _loadUserPackageJson() {
|
|
|
35337
35337
|
targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
|
|
35338
35338
|
_context2.t0 = JSON;
|
|
35339
35339
|
_context2.next = 10;
|
|
35340
|
-
return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('dev-
|
|
35340
|
+
return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('dev-0102b73f.js', document.baseURI).href))), 'utf-8');
|
|
35341
35341
|
case 10:
|
|
35342
35342
|
_context2.t1 = _context2.sent;
|
|
35343
35343
|
pkg = _context2.t0.parse.call(_context2.t0, _context2.t1);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var spirits = require("./spirits-
|
|
4
|
-
var dev = require("./dev-
|
|
3
|
+
var spirits = require("./spirits-6abaf567.cjs");
|
|
4
|
+
var dev = require("./dev-0102b73f.cjs");
|
|
5
5
|
var macros = require("./macros-f62cceac.cjs");
|
|
6
6
|
var require$$0 = require('fs');
|
|
7
7
|
var require$$2$1 = require('events');
|
|
@@ -29483,7 +29483,7 @@ class Body {
|
|
|
29483
29483
|
}
|
|
29484
29484
|
const {
|
|
29485
29485
|
toFormData
|
|
29486
|
-
} = await Promise.resolve().then(function () { return require("./multipart-parser-
|
|
29486
|
+
} = await Promise.resolve().then(function () { return require("./multipart-parser-22a1e9f6.cjs"); });
|
|
29487
29487
|
return toFormData(this.body, ct);
|
|
29488
29488
|
}
|
|
29489
29489
|
|
|
@@ -41884,7 +41884,7 @@ function _loadUserPackageJson() {
|
|
|
41884
41884
|
targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
|
|
41885
41885
|
_context.t0 = JSON;
|
|
41886
41886
|
_context.next = 10;
|
|
41887
|
-
return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-
|
|
41887
|
+
return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-5f4f222f.js', document.baseURI).href))), 'utf-8');
|
|
41888
41888
|
case 10:
|
|
41889
41889
|
_context.t1 = _context.sent;
|
|
41890
41890
|
pkg = _context.t0.parse.call(_context.t0, _context.t1);
|
|
@@ -43176,7 +43176,7 @@ var ProjectFiles = /*#__PURE__*/function () {
|
|
|
43176
43176
|
return ProjectFiles;
|
|
43177
43177
|
}();
|
|
43178
43178
|
|
|
43179
|
-
var __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-
|
|
43179
|
+
var __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-5f4f222f.js', document.baseURI).href)));
|
|
43180
43180
|
var __dirname$1 = path__default["default"].dirname(__filename$1);
|
|
43181
43181
|
function zipDirectory(source, out) {
|
|
43182
43182
|
var archive = archiver$1('tar', {
|
|
@@ -43391,7 +43391,7 @@ function _buildApp() {
|
|
|
43391
43391
|
case 11:
|
|
43392
43392
|
_context4.t0 = JSON;
|
|
43393
43393
|
_context4.next = 14;
|
|
43394
|
-
return fs__default["default"].readFile(new URL(templatePackagePath, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-
|
|
43394
|
+
return fs__default["default"].readFile(new URL(templatePackagePath, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-5f4f222f.js', document.baseURI).href))), 'utf-8');
|
|
43395
43395
|
case 14:
|
|
43396
43396
|
_context4.t1 = _context4.sent;
|
|
43397
43397
|
packageTemplate = _context4.t0.parse.call(_context4.t0, _context4.t1);
|
package/dist/index.cjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require("./index-
|
|
6
|
-
var dev = require("./dev-
|
|
7
|
-
require("./spirits-
|
|
5
|
+
var index = require("./index-5f4f222f.cjs");
|
|
6
|
+
var dev = require("./dev-0102b73f.cjs");
|
|
7
|
+
require("./spirits-6abaf567.cjs");
|
|
8
8
|
require("./macros-f62cceac.cjs");
|
|
9
9
|
require('fs');
|
|
10
10
|
require('events');
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
require('node:fs');
|
|
4
4
|
require('node:path');
|
|
5
|
-
var index = require("./index-
|
|
6
|
-
require("./spirits-
|
|
7
|
-
require("./dev-
|
|
5
|
+
var index = require("./index-5f4f222f.cjs");
|
|
6
|
+
require("./spirits-6abaf567.cjs");
|
|
7
|
+
require("./dev-0102b73f.cjs");
|
|
8
8
|
require('util');
|
|
9
9
|
require('stream');
|
|
10
10
|
require('path');
|
|
@@ -1077,18 +1077,20 @@ var Spirits = {
|
|
|
1077
1077
|
}
|
|
1078
1078
|
|
|
1079
1079
|
// 3. Run the contextualizer
|
|
1080
|
-
|
|
1080
|
+
progress('Running contextualizer', 'info', 'SET_PROCESSING', 'system');
|
|
1081
|
+
_context2.next = 47;
|
|
1081
1082
|
return contextualizer({
|
|
1082
1083
|
conversation: conversation,
|
|
1083
1084
|
messages: messages
|
|
1084
1085
|
});
|
|
1085
|
-
case
|
|
1086
|
+
case 47:
|
|
1086
1087
|
newContextMessages = _context2.sent;
|
|
1087
1088
|
_iterator = _createForOfIteratorHelper(newContextMessages);
|
|
1088
1089
|
try {
|
|
1089
1090
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1090
1091
|
contextMessage = _step.value;
|
|
1091
1092
|
messages.push(contextMessage);
|
|
1093
|
+
progress("Added context", 'info', 'ADD_MESSAGE', messages[messages.length - 1]);
|
|
1092
1094
|
}
|
|
1093
1095
|
|
|
1094
1096
|
// 4. Run the workflow
|
|
@@ -1098,7 +1100,7 @@ var Spirits = {
|
|
|
1098
1100
|
_iterator.f();
|
|
1099
1101
|
}
|
|
1100
1102
|
progress('Running workflow', 'info', 'SET_PROCESSING', 'system');
|
|
1101
|
-
_context2.next =
|
|
1103
|
+
_context2.next = 53;
|
|
1102
1104
|
return workflow({
|
|
1103
1105
|
messages: messages,
|
|
1104
1106
|
conversation: conversation,
|
|
@@ -1127,7 +1129,7 @@ var Spirits = {
|
|
|
1127
1129
|
return accumulator;
|
|
1128
1130
|
}, []);
|
|
1129
1131
|
});
|
|
1130
|
-
case
|
|
1132
|
+
case 53:
|
|
1131
1133
|
slots = _context2.sent;
|
|
1132
1134
|
hasNoInstructions = slots.every(function (s) {
|
|
1133
1135
|
return !s.instructions || Array.isArray(s.instructions) && s.instructions.length === 0;
|
|
@@ -1154,20 +1156,20 @@ var Spirits = {
|
|
|
1154
1156
|
resettedIntent = false;
|
|
1155
1157
|
/** @type {Array<string> | undefined} */
|
|
1156
1158
|
_iterator2 = _createForOfIteratorHelper(slots);
|
|
1157
|
-
_context2.prev =
|
|
1159
|
+
_context2.prev = 61;
|
|
1158
1160
|
_iterator2.s();
|
|
1159
|
-
case
|
|
1161
|
+
case 63:
|
|
1160
1162
|
if ((_step2 = _iterator2.n()).done) {
|
|
1161
|
-
_context2.next =
|
|
1163
|
+
_context2.next = 134;
|
|
1162
1164
|
break;
|
|
1163
1165
|
}
|
|
1164
1166
|
_step2$value = _step2.value, forward = _step2$value.forward, forwardNote = _step2$value.forwardNote, instructions = _step2$value.instructions, removeInstructions = _step2$value.removeInstructions, manualMessage = _step2$value.message, scheduled = _step2$value.scheduled, resetIntent = _step2$value.resetIntent, secondsDelay = _step2$value.secondsDelay, contextUpsert = _step2$value.contextUpsert, anticipate = _step2$value.anticipate, slotFollowup = _step2$value.followup, slotEntityContextUpsert = _step2$value.entityContextUpsert, tasks = _step2$value.tasks;
|
|
1165
1167
|
if (!anticipate) {
|
|
1166
|
-
_context2.next =
|
|
1168
|
+
_context2.next = 78;
|
|
1167
1169
|
break;
|
|
1168
1170
|
}
|
|
1169
1171
|
if (!Array.isArray(anticipate)) {
|
|
1170
|
-
_context2.next =
|
|
1172
|
+
_context2.next = 73;
|
|
1171
1173
|
break;
|
|
1172
1174
|
}
|
|
1173
1175
|
// 'literal' anticipation
|
|
@@ -1187,11 +1189,11 @@ var Spirits = {
|
|
|
1187
1189
|
slots: _slots,
|
|
1188
1190
|
map: map
|
|
1189
1191
|
});
|
|
1190
|
-
_context2.next =
|
|
1192
|
+
_context2.next = 78;
|
|
1191
1193
|
break;
|
|
1192
|
-
case
|
|
1194
|
+
case 73:
|
|
1193
1195
|
if (!('yes' in anticipate && 'no' in anticipate && 'did' in anticipate)) {
|
|
1194
|
-
_context2.next =
|
|
1196
|
+
_context2.next = 77;
|
|
1195
1197
|
break;
|
|
1196
1198
|
}
|
|
1197
1199
|
// "did" anticipation
|
|
@@ -1203,11 +1205,11 @@ var Spirits = {
|
|
|
1203
1205
|
},
|
|
1204
1206
|
did: anticipate.did
|
|
1205
1207
|
});
|
|
1206
|
-
_context2.next =
|
|
1208
|
+
_context2.next = 78;
|
|
1207
1209
|
break;
|
|
1208
|
-
case 76:
|
|
1209
|
-
throw new Error("Invalid anticipate payload \"".concat(JSON.stringify(anticipate), "\""));
|
|
1210
1210
|
case 77:
|
|
1211
|
+
throw new Error("Invalid anticipate payload \"".concat(JSON.stringify(anticipate), "\""));
|
|
1212
|
+
case 78:
|
|
1211
1213
|
// tasks from auto/manual ingress to execute
|
|
1212
1214
|
if (!!tasks && Array.isArray(tasks) && !!tasks.length) {
|
|
1213
1215
|
if (!_tasks) _tasks = [];
|
|
@@ -1263,19 +1265,19 @@ var Spirits = {
|
|
|
1263
1265
|
|
|
1264
1266
|
// Insert instructions context
|
|
1265
1267
|
if (!instructions) {
|
|
1266
|
-
_context2.next =
|
|
1268
|
+
_context2.next = 97;
|
|
1267
1269
|
break;
|
|
1268
1270
|
}
|
|
1269
1271
|
if (!(typeof instructions === 'string')) {
|
|
1270
|
-
_context2.next =
|
|
1272
|
+
_context2.next = 87;
|
|
1271
1273
|
break;
|
|
1272
1274
|
}
|
|
1273
1275
|
addInstruction(instructions, previousLockAttempt);
|
|
1274
|
-
_context2.next =
|
|
1276
|
+
_context2.next = 97;
|
|
1275
1277
|
break;
|
|
1276
|
-
case
|
|
1278
|
+
case 87:
|
|
1277
1279
|
if (!Array.isArray(instructions)) {
|
|
1278
|
-
_context2.next =
|
|
1280
|
+
_context2.next = 92;
|
|
1279
1281
|
break;
|
|
1280
1282
|
}
|
|
1281
1283
|
_iterator5 = _createForOfIteratorHelper(instructions);
|
|
@@ -1293,25 +1295,25 @@ var Spirits = {
|
|
|
1293
1295
|
} finally {
|
|
1294
1296
|
_iterator5.f();
|
|
1295
1297
|
}
|
|
1296
|
-
_context2.next =
|
|
1298
|
+
_context2.next = 97;
|
|
1297
1299
|
break;
|
|
1298
|
-
case
|
|
1300
|
+
case 92:
|
|
1299
1301
|
if (!(_typeof(instructions) === 'object' && 'content' in instructions)) {
|
|
1300
|
-
_context2.next =
|
|
1302
|
+
_context2.next = 96;
|
|
1301
1303
|
break;
|
|
1302
1304
|
}
|
|
1303
1305
|
addInstruction(instructions.content, previousLockAttempt, instructions.id);
|
|
1304
|
-
_context2.next =
|
|
1306
|
+
_context2.next = 97;
|
|
1305
1307
|
break;
|
|
1306
|
-
case 95:
|
|
1307
|
-
throw new Error("SpiritsError: instructions must be a string or array or {content: \"<instruction>\"}, got: ".concat(JSON.stringify(instructions)));
|
|
1308
1308
|
case 96:
|
|
1309
|
+
throw new Error("SpiritsError: instructions must be a string or array or {content: \"<instruction>\"}, got: ".concat(JSON.stringify(instructions)));
|
|
1310
|
+
case 97:
|
|
1309
1311
|
if (!removeInstructions) {
|
|
1310
|
-
_context2.next =
|
|
1312
|
+
_context2.next = 114;
|
|
1311
1313
|
break;
|
|
1312
1314
|
}
|
|
1313
1315
|
_iterator6 = _createForOfIteratorHelper(removeInstructions);
|
|
1314
|
-
_context2.prev =
|
|
1316
|
+
_context2.prev = 99;
|
|
1315
1317
|
_loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
|
|
1316
1318
|
var instructionId, index;
|
|
1317
1319
|
return _regeneratorRuntime().wrap(function _loop$(_context) {
|
|
@@ -1336,29 +1338,29 @@ var Spirits = {
|
|
|
1336
1338
|
}, _loop);
|
|
1337
1339
|
});
|
|
1338
1340
|
_iterator6.s();
|
|
1339
|
-
case
|
|
1341
|
+
case 102:
|
|
1340
1342
|
if ((_step6 = _iterator6.n()).done) {
|
|
1341
|
-
_context2.next =
|
|
1343
|
+
_context2.next = 106;
|
|
1342
1344
|
break;
|
|
1343
1345
|
}
|
|
1344
|
-
return _context2.delegateYield(_loop(), "t0",
|
|
1345
|
-
case
|
|
1346
|
-
_context2.next =
|
|
1346
|
+
return _context2.delegateYield(_loop(), "t0", 104);
|
|
1347
|
+
case 104:
|
|
1348
|
+
_context2.next = 102;
|
|
1347
1349
|
break;
|
|
1348
|
-
case
|
|
1349
|
-
_context2.next =
|
|
1350
|
+
case 106:
|
|
1351
|
+
_context2.next = 111;
|
|
1350
1352
|
break;
|
|
1351
|
-
case
|
|
1352
|
-
_context2.prev =
|
|
1353
|
-
_context2.t1 = _context2["catch"](
|
|
1353
|
+
case 108:
|
|
1354
|
+
_context2.prev = 108;
|
|
1355
|
+
_context2.t1 = _context2["catch"](99);
|
|
1354
1356
|
_iterator6.e(_context2.t1);
|
|
1355
|
-
case
|
|
1356
|
-
_context2.prev =
|
|
1357
|
+
case 111:
|
|
1358
|
+
_context2.prev = 111;
|
|
1357
1359
|
_iterator6.f();
|
|
1358
|
-
return _context2.finish(
|
|
1359
|
-
case
|
|
1360
|
+
return _context2.finish(111);
|
|
1361
|
+
case 114:
|
|
1360
1362
|
if (!manualMessage) {
|
|
1361
|
-
_context2.next =
|
|
1363
|
+
_context2.next = 130;
|
|
1362
1364
|
break;
|
|
1363
1365
|
}
|
|
1364
1366
|
/** @type {import('@scout9/admin').Message} */
|
|
@@ -1370,25 +1372,25 @@ var Spirits = {
|
|
|
1370
1372
|
time: new Date().toISOString()
|
|
1371
1373
|
};
|
|
1372
1374
|
if (!(_typeof(manualMessage) === 'object')) {
|
|
1373
|
-
_context2.next =
|
|
1375
|
+
_context2.next = 122;
|
|
1374
1376
|
break;
|
|
1375
1377
|
}
|
|
1376
1378
|
Object.assign(manualMessageObj, manualMessage);
|
|
1377
1379
|
manualMessageObj.role = 'agent';
|
|
1378
1380
|
manualMessageObj.time = new Date().toISOString();
|
|
1379
|
-
_context2.next =
|
|
1381
|
+
_context2.next = 127;
|
|
1380
1382
|
break;
|
|
1381
|
-
case
|
|
1383
|
+
case 122:
|
|
1382
1384
|
if (!(typeof manualMessage === 'string')) {
|
|
1383
|
-
_context2.next =
|
|
1385
|
+
_context2.next = 126;
|
|
1384
1386
|
break;
|
|
1385
1387
|
}
|
|
1386
1388
|
manualMessageObj.content = manualMessage;
|
|
1387
|
-
_context2.next =
|
|
1389
|
+
_context2.next = 127;
|
|
1388
1390
|
break;
|
|
1389
|
-
case 125:
|
|
1390
|
-
throw new Error('Manual message must be of type "string" or "DirectMessage"');
|
|
1391
1391
|
case 126:
|
|
1392
|
+
throw new Error('Manual message must be of type "string" or "DirectMessage"');
|
|
1393
|
+
case 127:
|
|
1392
1394
|
if (scheduled) {
|
|
1393
1395
|
manualMessageObj.time = new Date(scheduled * 1000).toISOString();
|
|
1394
1396
|
manualMessageObj.scheduled = manualMessageObj.time;
|
|
@@ -1400,7 +1402,7 @@ var Spirits = {
|
|
|
1400
1402
|
}
|
|
1401
1403
|
messages.push(manualMessageObj);
|
|
1402
1404
|
progress('Added manual message', 'info', 'ADD_MESSAGE', messages[messages.length - 1]);
|
|
1403
|
-
case
|
|
1405
|
+
case 130:
|
|
1404
1406
|
if (contextUpsert) {
|
|
1405
1407
|
context = updateContext(context, contextUpsert);
|
|
1406
1408
|
progress('Upserted context', 'info', 'UPDATE_CONTEXT', contextUpsert);
|
|
@@ -1408,21 +1410,21 @@ var Spirits = {
|
|
|
1408
1410
|
if (resetIntent) {
|
|
1409
1411
|
resettedIntent = true;
|
|
1410
1412
|
}
|
|
1411
|
-
case
|
|
1412
|
-
_context2.next =
|
|
1413
|
+
case 132:
|
|
1414
|
+
_context2.next = 63;
|
|
1413
1415
|
break;
|
|
1414
|
-
case
|
|
1415
|
-
_context2.next =
|
|
1416
|
+
case 134:
|
|
1417
|
+
_context2.next = 139;
|
|
1416
1418
|
break;
|
|
1417
|
-
case
|
|
1418
|
-
_context2.prev =
|
|
1419
|
-
_context2.t2 = _context2["catch"](
|
|
1419
|
+
case 136:
|
|
1420
|
+
_context2.prev = 136;
|
|
1421
|
+
_context2.t2 = _context2["catch"](61);
|
|
1420
1422
|
_iterator2.e(_context2.t2);
|
|
1421
|
-
case
|
|
1422
|
-
_context2.prev =
|
|
1423
|
+
case 139:
|
|
1424
|
+
_context2.prev = 139;
|
|
1423
1425
|
_iterator2.f();
|
|
1424
|
-
return _context2.finish(
|
|
1425
|
-
case
|
|
1426
|
+
return _context2.finish(139);
|
|
1427
|
+
case 142:
|
|
1426
1428
|
if (resettedIntent && !_forward) {
|
|
1427
1429
|
conversation.intent = null;
|
|
1428
1430
|
conversation.intentScore = null;
|
|
@@ -1441,14 +1443,14 @@ var Spirits = {
|
|
|
1441
1443
|
// 5. Generate response
|
|
1442
1444
|
// If conversation previously locked, don't generate
|
|
1443
1445
|
if (input.conversation.locked) {
|
|
1444
|
-
_context2.next =
|
|
1446
|
+
_context2.next = 194;
|
|
1445
1447
|
break;
|
|
1446
1448
|
}
|
|
1447
1449
|
if (!((!conversation.locked || !hasNoInstructions) && !!hasNoCustomMessage)) {
|
|
1448
|
-
_context2.next =
|
|
1450
|
+
_context2.next = 160;
|
|
1449
1451
|
break;
|
|
1450
1452
|
}
|
|
1451
|
-
_context2.prev =
|
|
1453
|
+
_context2.prev = 145;
|
|
1452
1454
|
progress('Generating message', 'info', 'SET_PROCESSING', 'system');
|
|
1453
1455
|
|
|
1454
1456
|
/** @type {import('@scout9/admin').GenerateRequestOneOf1} */
|
|
@@ -1462,9 +1464,9 @@ var Spirits = {
|
|
|
1462
1464
|
if (!!_tasks && Array.isArray(_tasks) && !!_tasks.length) {
|
|
1463
1465
|
generatorInput.tasks = _tasks;
|
|
1464
1466
|
}
|
|
1465
|
-
_context2.next =
|
|
1467
|
+
_context2.next = 151;
|
|
1466
1468
|
return generator(generatorInput);
|
|
1467
|
-
case
|
|
1469
|
+
case 151:
|
|
1468
1470
|
generatorPayload = _context2.sent;
|
|
1469
1471
|
if (!generatorPayload.send) {
|
|
1470
1472
|
progress('Generated response', 'failed', undefined, {
|
|
@@ -1538,30 +1540,30 @@ var Spirits = {
|
|
|
1538
1540
|
}
|
|
1539
1541
|
}
|
|
1540
1542
|
}
|
|
1541
|
-
_context2.next =
|
|
1543
|
+
_context2.next = 160;
|
|
1542
1544
|
break;
|
|
1543
|
-
case
|
|
1544
|
-
_context2.prev =
|
|
1545
|
-
_context2.t3 = _context2["catch"](
|
|
1545
|
+
case 155:
|
|
1546
|
+
_context2.prev = 155;
|
|
1547
|
+
_context2.t3 = _context2["catch"](145);
|
|
1546
1548
|
onError(_context2.t3);
|
|
1547
1549
|
console.error("Spirits: Locking conversation, error generating response: ".concat(_context2.t3.message));
|
|
1548
1550
|
conversation = lockConversation(conversation, 'API: ' + _context2.t3.message);
|
|
1549
|
-
case
|
|
1551
|
+
case 160:
|
|
1550
1552
|
if (!(messagesToTransform.length && transformer)) {
|
|
1551
|
-
_context2.next =
|
|
1553
|
+
_context2.next = 193;
|
|
1552
1554
|
break;
|
|
1553
1555
|
}
|
|
1554
|
-
_context2.prev =
|
|
1556
|
+
_context2.prev = 161;
|
|
1555
1557
|
_iterator4 = _createForOfIteratorHelper(messagesToTransform);
|
|
1556
|
-
_context2.prev =
|
|
1558
|
+
_context2.prev = 163;
|
|
1557
1559
|
_iterator4.s();
|
|
1558
|
-
case
|
|
1560
|
+
case 165:
|
|
1559
1561
|
if ((_step4 = _iterator4.n()).done) {
|
|
1560
|
-
_context2.next =
|
|
1562
|
+
_context2.next = 176;
|
|
1561
1563
|
break;
|
|
1562
1564
|
}
|
|
1563
1565
|
_step4.value;
|
|
1564
|
-
_context2.next =
|
|
1566
|
+
_context2.next = 169;
|
|
1565
1567
|
return transformer({
|
|
1566
1568
|
message: messagesToTransform,
|
|
1567
1569
|
persona: persona,
|
|
@@ -1569,7 +1571,7 @@ var Spirits = {
|
|
|
1569
1571
|
messages: messages,
|
|
1570
1572
|
context: context
|
|
1571
1573
|
});
|
|
1572
|
-
case
|
|
1574
|
+
case 169:
|
|
1573
1575
|
transformResponse = _context2.sent;
|
|
1574
1576
|
progress('Generated response', 'success', undefined, undefined);
|
|
1575
1577
|
// Check if already had message
|
|
@@ -1589,37 +1591,37 @@ var Spirits = {
|
|
|
1589
1591
|
});
|
|
1590
1592
|
progress('Added agent message', 'info', 'ADD_MESSAGE', messages[messages.length - 1]);
|
|
1591
1593
|
}
|
|
1592
|
-
case
|
|
1593
|
-
_context2.next =
|
|
1594
|
+
case 174:
|
|
1595
|
+
_context2.next = 165;
|
|
1594
1596
|
break;
|
|
1595
|
-
case
|
|
1596
|
-
_context2.next =
|
|
1597
|
+
case 176:
|
|
1598
|
+
_context2.next = 181;
|
|
1597
1599
|
break;
|
|
1598
|
-
case
|
|
1599
|
-
_context2.prev =
|
|
1600
|
-
_context2.t4 = _context2["catch"](
|
|
1600
|
+
case 178:
|
|
1601
|
+
_context2.prev = 178;
|
|
1602
|
+
_context2.t4 = _context2["catch"](163);
|
|
1601
1603
|
_iterator4.e(_context2.t4);
|
|
1602
|
-
case
|
|
1603
|
-
_context2.prev =
|
|
1604
|
+
case 181:
|
|
1605
|
+
_context2.prev = 181;
|
|
1604
1606
|
_iterator4.f();
|
|
1605
|
-
return _context2.finish(
|
|
1606
|
-
case
|
|
1607
|
-
_context2.next =
|
|
1607
|
+
return _context2.finish(181);
|
|
1608
|
+
case 184:
|
|
1609
|
+
_context2.next = 191;
|
|
1608
1610
|
break;
|
|
1609
|
-
case
|
|
1610
|
-
_context2.prev =
|
|
1611
|
-
_context2.t5 = _context2["catch"](
|
|
1611
|
+
case 186:
|
|
1612
|
+
_context2.prev = 186;
|
|
1613
|
+
_context2.t5 = _context2["catch"](161);
|
|
1612
1614
|
console.error("Locking conversation, error transforming response: ".concat(_context2.t5.message));
|
|
1613
1615
|
conversation = lockConversation(conversation, 'API: ' + _context2.t5.message);
|
|
1614
1616
|
onError(_context2.t5);
|
|
1615
|
-
case
|
|
1616
|
-
_context2.next =
|
|
1617
|
+
case 191:
|
|
1618
|
+
_context2.next = 194;
|
|
1617
1619
|
break;
|
|
1618
|
-
case
|
|
1620
|
+
case 193:
|
|
1619
1621
|
if (messagesToTransform.length) {
|
|
1620
1622
|
console.warn("No transformer provided");
|
|
1621
1623
|
}
|
|
1622
|
-
case
|
|
1624
|
+
case 194:
|
|
1623
1625
|
progress('Parsing message', 'info', 'SET_PROCESSING', null);
|
|
1624
1626
|
return _context2.abrupt("return", {
|
|
1625
1627
|
conversation: {
|
|
@@ -1643,11 +1645,11 @@ var Spirits = {
|
|
|
1643
1645
|
followup: followup,
|
|
1644
1646
|
entityContextUpsert: entityContextUpsert
|
|
1645
1647
|
});
|
|
1646
|
-
case
|
|
1648
|
+
case 196:
|
|
1647
1649
|
case "end":
|
|
1648
1650
|
return _context2.stop();
|
|
1649
1651
|
}
|
|
1650
|
-
}, _callee, null, [[
|
|
1652
|
+
}, _callee, null, [[61, 136, 139, 142], [99, 108, 111, 114], [145, 155], [161, 186], [163, 178, 181, 184]]);
|
|
1651
1653
|
}));
|
|
1652
1654
|
function customer(_x) {
|
|
1653
1655
|
return _customer.apply(this, arguments);
|
package/dist/spirits.cjs
CHANGED
package/dist/testing-tools.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dev = require("./dev-
|
|
6
|
-
require("./spirits-
|
|
5
|
+
var dev = require("./dev-0102b73f.cjs");
|
|
6
|
+
require("./spirits-6abaf567.cjs");
|
|
7
7
|
require('util');
|
|
8
8
|
require('stream');
|
|
9
9
|
require('path');
|
package/package.json
CHANGED
|
@@ -361,9 +361,11 @@ export const Spirits = {
|
|
|
361
361
|
}
|
|
362
362
|
|
|
363
363
|
// 3. Run the contextualizer
|
|
364
|
+
progress('Running contextualizer', 'info', 'SET_PROCESSING', 'system')
|
|
364
365
|
const newContextMessages = await contextualizer({conversation, messages});
|
|
365
366
|
for (const contextMessage of newContextMessages) {
|
|
366
367
|
messages.push(contextMessage);
|
|
368
|
+
progress(`Added context`, 'info', 'ADD_MESSAGE', messages[messages.length - 1]);
|
|
367
369
|
}
|
|
368
370
|
|
|
369
371
|
// 4. Run the workflow
|