@scout9/app 1.0.0-alpha.0.6.8 → 1.0.0-alpha.0.6.9

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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var spirits = require("./spirits-54ee2389.cjs");
3
+ var spirits = require("./spirits-59475def.cjs");
4
4
  var require$$0$4 = require('util');
5
5
  var require$$0$3 = require('stream');
6
6
  var require$$1 = require('path');
@@ -21,7 +21,7 @@ var node_url = require('node:url');
21
21
  var node_events = require('node:events');
22
22
  var Stream = require('node:stream');
23
23
  var node_string_decoder = require('node:string_decoder');
24
- var macros = require("./macros-85a033b9.cjs");
24
+ var macros = require("./macros-22b2e0b8.cjs");
25
25
  var readline = require('node:readline');
26
26
  var process$2 = require('node:process');
27
27
  var node_os = require('node:os');
@@ -30176,7 +30176,7 @@ common.createRequestFunction = createRequestFunction;
30176
30176
  var configuration = {};
30177
30177
 
30178
30178
  var name$1 = "@scout9/admin";
30179
- var version$2 = "1.0.0-alpha.0.0.58";
30179
+ var version$2 = "1.0.0-alpha.0.0.59";
30180
30180
  var description$1 = "";
30181
30181
  var main$2 = "./build/index.js";
30182
30182
  var types$1 = "./build/index.d.ts";
@@ -35241,7 +35241,7 @@ function _loadUserPackageJson() {
35241
35241
  targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
35242
35242
  _context2.t0 = JSON;
35243
35243
  _context2.next = 10;
35244
- 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-7570f439.js', document.baseURI).href))), 'utf-8');
35244
+ 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-d74b94c8.js', document.baseURI).href))), 'utf-8');
35245
35245
  case 10:
35246
35246
  _context2.t1 = _context2.sent;
35247
35247
  pkg = _context2.t0.parse.call(_context2.t0, _context2.t1);
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var spirits = require("./spirits-54ee2389.cjs");
4
- var dev = require("./dev-7570f439.cjs");
5
- var macros = require("./macros-85a033b9.cjs");
3
+ var spirits = require("./spirits-59475def.cjs");
4
+ var dev = require("./dev-d74b94c8.cjs");
5
+ var macros = require("./macros-22b2e0b8.cjs");
6
6
  var require$$0 = require('fs');
7
7
  var require$$2$1 = require('events');
8
8
  var require$$1 = require('path');
@@ -29483,7 +29483,7 @@ class Body {
29483
29483
  }
29484
29484
  const {
29485
29485
  toFormData
29486
- } = await Promise.resolve().then(function () { return require("./multipart-parser-a071f5a9.cjs"); });
29486
+ } = await Promise.resolve().then(function () { return require("./multipart-parser-8ce4a465.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-fe1b9d3a.js', document.baseURI).href))), 'utf-8');
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-ddb54eed.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-fe1b9d3a.js', document.baseURI).href)));
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-ddb54eed.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-fe1b9d3a.js', document.baseURI).href))), 'utf-8');
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-ddb54eed.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,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require("./index-fe1b9d3a.cjs");
6
- var dev = require("./dev-7570f439.cjs");
7
- require("./spirits-54ee2389.cjs");
8
- require("./macros-85a033b9.cjs");
5
+ var index = require("./index-ddb54eed.cjs");
6
+ var dev = require("./dev-d74b94c8.cjs");
7
+ require("./spirits-59475def.cjs");
8
+ require("./macros-22b2e0b8.cjs");
9
9
  require('fs');
10
10
  require('events');
11
11
  require('path');
@@ -4347,18 +4347,18 @@ var DirectMessageSchema = MessageSchema.partial().omit({
4347
4347
  * The workflow response object slot
4348
4348
  */
4349
4349
  var WorkflowResponseSlotBaseSchema = z.object({
4350
+ contextUpsert: ConversationContext.optional(),
4351
+ followup: FollowupSchema.optional(),
4350
4352
  forward: ForwardSchema.optional(),
4351
4353
  forwardNote: z.string({
4352
4354
  description: 'Note to provide to the agent, recommend using forward object api instead'
4353
4355
  }).optional(),
4354
4356
  instructions: InstructionSchema.optional(),
4355
- removeInstructions: z.array(z.string()).optional(),
4356
4357
  message: z.union([z.string(), DirectMessageSchema]).optional(),
4357
- secondsDelay: z.number().optional(),
4358
- scheduled: z.number().optional(),
4359
- contextUpsert: ConversationContext.optional(),
4358
+ removeInstructions: z.array(z.string()).optional(),
4360
4359
  resetIntent: z["boolean"]().optional(),
4361
- followup: FollowupSchema.optional()
4360
+ secondsDelay: z.number().optional(),
4361
+ scheduled: z.number().optional()
4362
4362
  });
4363
4363
  var deleteSchema = z.object({
4364
4364
  entityType: z.string(),
@@ -4388,7 +4388,10 @@ var WorkflowResponseSlotSchema = WorkflowResponseSlotBaseSchema.extend({
4388
4388
  }), z.array(WorkflowResponseSlotBaseSchema.extend({
4389
4389
  keywords: z.array(z.string()).min(1).max(20)
4390
4390
  }))]).optional(),
4391
- entityContextUpsert: z.array(EntityContextUpsertSchema).optional()
4391
+ entityContextUpsert: z.array(EntityContextUpsertSchema).optional(),
4392
+ tasks: z.array(z.string({
4393
+ description: '@ingress=auto/manual only, If provided, it will send the user\'s workflow tasks to the PMT to execute custom business logic'
4394
+ })).optional()
4392
4395
  });
4393
4396
 
4394
4397
  /**
@@ -2,9 +2,9 @@
2
2
 
3
3
  require('node:fs');
4
4
  require('node:path');
5
- var index = require("./index-fe1b9d3a.cjs");
6
- require("./spirits-54ee2389.cjs");
7
- require("./dev-7570f439.cjs");
5
+ var index = require("./index-ddb54eed.cjs");
6
+ require("./spirits-59475def.cjs");
7
+ require("./dev-d74b94c8.cjs");
8
8
  require('util');
9
9
  require('stream');
10
10
  require('path');
@@ -23,7 +23,7 @@ require('node:url');
23
23
  require('node:events');
24
24
  require('node:stream');
25
25
  require('node:string_decoder');
26
- require("./macros-85a033b9.cjs");
26
+ require("./macros-22b2e0b8.cjs");
27
27
  require('node:readline');
28
28
  require('node:process');
29
29
  require('node:os');
package/dist/schemas.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var macros = require("./macros-85a033b9.cjs");
5
+ var macros = require("./macros-22b2e0b8.cjs");
6
6
 
7
7
 
8
8
 
@@ -665,14 +665,6 @@ var _excluded = ["keywords"];
665
665
  * @property {any} context
666
666
  */
667
667
 
668
- /**
669
- * @typedef {Object} GenerateOutput
670
- * @property {import('@scout9/admin').GenerateResponse | undefined} generate
671
- * @property {Array<import('@scout9/app').Message>} messages
672
- * @property {import('@scout9/app').Conversation} conversation
673
- * @property {any} context
674
- */
675
-
676
668
  /**
677
669
  * @callback ParseFun
678
670
  * @param {string} message - message to send
@@ -688,7 +680,7 @@ var _excluded = ["keywords"];
688
680
 
689
681
  /**
690
682
  * @callback GenerateFun
691
- * @param {import('@scout9/admin').GenerateRequestOneOf} data - data to generate from
683
+ * @param {import('@scout9/admin').GenerateRequestOneOf1} data - data to generate from
692
684
  * @returns {Promise<import('@scout9/admin').GenerateResponse>}
693
685
  */
694
686
 
@@ -744,7 +736,7 @@ var Spirits = {
744
736
  customer: function () {
745
737
  var _customer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(input) {
746
738
  var _recentUserMessage;
747
- var customer, config, parser, workflow, generator, transformer, idGenerator, _input$progress, progress, messageBefore, contextBefore, messagesBefore, conversationBefore, conversation, messages, context, message, followup, entityContextUpsert, updateConversation, updateContext, userMessages, recentUserMessage, lockConversation, incrementLockAttempt, _addInstruction, addInstruction, persona, invalidRoles, parsePayload, index, _message, previousUserMessages, oldKeyCount, newKeyCount, noNewContext, slots, hasNoInstructions, hasNoCustomMessage, messagesToTransform, previousLockAttempt, resettedIntent, _forward, _forwardNote, _iterator, _step, _step$value, forward, forwardNote, instructions, removeInstructions, manualMessage, scheduled, resetIntent, secondsDelay, contextUpsert, anticipate, slotFollowup, slotEntityContextUpsert, _slots, map, i, _anticipate$i, keywords, _slot, slotId, _iterator3, _step3, instruction, _iterator4, _step4, _loop, manualMessageObj, now, generatorPayload, agentMessages, lastAgentMessage, _generatorPayload$ent, _generatorPayload$con, _iterator2, _step2, transformResponse, _agentMessages, _lastAgentMessage;
739
+ var customer, config, parser, workflow, generator, transformer, idGenerator, _input$progress, progress, messageBefore, contextBefore, messagesBefore, conversationBefore, conversation, messages, context, message, followup, entityContextUpsert, updateConversation, updateContext, userMessages, recentUserMessage, lockConversation, incrementLockAttempt, _addInstruction, addInstruction, persona, invalidRoles, parsePayload, index, _message, previousUserMessages, oldKeyCount, newKeyCount, noNewContext, slots, hasNoInstructions, hasNoCustomMessage, messagesToTransform, previousLockAttempt, resettedIntent, _forward, _forwardNote, _tasks, _iterator, _step, _step$value, forward, forwardNote, instructions, removeInstructions, manualMessage, scheduled, resetIntent, secondsDelay, contextUpsert, anticipate, slotFollowup, slotEntityContextUpsert, tasks, _slots, map, i, _anticipate$i, keywords, _slot, slotId, _tasks2, _iterator3, _step3, instruction, _iterator4, _step4, _loop, manualMessageObj, now, generatorInput, generatorPayload, agentMessages, lastAgentMessage, _generatorPayload$ent, _generatorPayload$con, _iterator2, _step2, transformResponse, _agentMessages, _lastAgentMessage;
748
740
  return _regeneratorRuntime().wrap(function _callee$(_context2) {
749
741
  while (1) switch (_context2.prev = _context2.next) {
750
742
  case 0:
@@ -1019,15 +1011,16 @@ var Spirits = {
1019
1011
  });
1020
1012
  }
1021
1013
  resettedIntent = false;
1014
+ /** @type {Array<string> | undefined} */
1022
1015
  _iterator = _createForOfIteratorHelper(slots);
1023
1016
  _context2.prev = 53;
1024
1017
  _iterator.s();
1025
1018
  case 55:
1026
1019
  if ((_step = _iterator.n()).done) {
1027
- _context2.next = 125;
1020
+ _context2.next = 126;
1028
1021
  break;
1029
1022
  }
1030
- _step$value = _step.value, forward = _step$value.forward, forwardNote = _step$value.forwardNote, instructions = _step$value.instructions, removeInstructions = _step$value.removeInstructions, manualMessage = _step$value.message, scheduled = _step$value.scheduled, resetIntent = _step$value.resetIntent, secondsDelay = _step$value.secondsDelay, contextUpsert = _step$value.contextUpsert, anticipate = _step$value.anticipate, slotFollowup = _step$value.followup, slotEntityContextUpsert = _step$value.entityContextUpsert;
1023
+ _step$value = _step.value, forward = _step$value.forward, forwardNote = _step$value.forwardNote, instructions = _step$value.instructions, removeInstructions = _step$value.removeInstructions, manualMessage = _step$value.message, scheduled = _step$value.scheduled, resetIntent = _step$value.resetIntent, secondsDelay = _step$value.secondsDelay, contextUpsert = _step$value.contextUpsert, anticipate = _step$value.anticipate, slotFollowup = _step$value.followup, slotEntityContextUpsert = _step$value.entityContextUpsert, tasks = _step$value.tasks;
1031
1024
  if (!anticipate) {
1032
1025
  _context2.next = 70;
1033
1026
  break;
@@ -1074,6 +1067,11 @@ var Spirits = {
1074
1067
  case 69:
1075
1068
  throw new Error("Invalid anticipate payload \"".concat(JSON.stringify(anticipate), "\""));
1076
1069
  case 70:
1070
+ // tasks from auto/manual ingress to execute
1071
+ if (!!tasks && Array.isArray(tasks) && !!tasks.length) {
1072
+ if (!_tasks) _tasks = [];
1073
+ (_tasks2 = _tasks).push.apply(_tasks2, _toConsumableArray(tasks));
1074
+ }
1077
1075
  if (slotFollowup) {
1078
1076
  followup.push(slotFollowup);
1079
1077
  }
@@ -1124,19 +1122,19 @@ var Spirits = {
1124
1122
 
1125
1123
  // Insert instructions context
1126
1124
  if (!instructions) {
1127
- _context2.next = 88;
1125
+ _context2.next = 89;
1128
1126
  break;
1129
1127
  }
1130
1128
  if (!(typeof instructions === 'string')) {
1131
- _context2.next = 78;
1129
+ _context2.next = 79;
1132
1130
  break;
1133
1131
  }
1134
1132
  addInstruction(instructions, previousLockAttempt);
1135
- _context2.next = 88;
1133
+ _context2.next = 89;
1136
1134
  break;
1137
- case 78:
1135
+ case 79:
1138
1136
  if (!Array.isArray(instructions)) {
1139
- _context2.next = 83;
1137
+ _context2.next = 84;
1140
1138
  break;
1141
1139
  }
1142
1140
  _iterator3 = _createForOfIteratorHelper(instructions);
@@ -1154,25 +1152,25 @@ var Spirits = {
1154
1152
  } finally {
1155
1153
  _iterator3.f();
1156
1154
  }
1157
- _context2.next = 88;
1155
+ _context2.next = 89;
1158
1156
  break;
1159
- case 83:
1157
+ case 84:
1160
1158
  if (!(_typeof(instructions) === 'object' && 'content' in instructions)) {
1161
- _context2.next = 87;
1159
+ _context2.next = 88;
1162
1160
  break;
1163
1161
  }
1164
1162
  addInstruction(instructions.content, previousLockAttempt, instructions.id);
1165
- _context2.next = 88;
1163
+ _context2.next = 89;
1166
1164
  break;
1167
- case 87:
1168
- throw new Error("SpiritsError: instructions must be a string or array or {content: \"<instruction>\"}, got: ".concat(JSON.stringify(instructions)));
1169
1165
  case 88:
1166
+ throw new Error("SpiritsError: instructions must be a string or array or {content: \"<instruction>\"}, got: ".concat(JSON.stringify(instructions)));
1167
+ case 89:
1170
1168
  if (!removeInstructions) {
1171
- _context2.next = 105;
1169
+ _context2.next = 106;
1172
1170
  break;
1173
1171
  }
1174
1172
  _iterator4 = _createForOfIteratorHelper(removeInstructions);
1175
- _context2.prev = 90;
1173
+ _context2.prev = 91;
1176
1174
  _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
1177
1175
  var instructionId, index;
1178
1176
  return _regeneratorRuntime().wrap(function _loop$(_context) {
@@ -1197,29 +1195,29 @@ var Spirits = {
1197
1195
  }, _loop);
1198
1196
  });
1199
1197
  _iterator4.s();
1200
- case 93:
1198
+ case 94:
1201
1199
  if ((_step4 = _iterator4.n()).done) {
1202
- _context2.next = 97;
1200
+ _context2.next = 98;
1203
1201
  break;
1204
1202
  }
1205
- return _context2.delegateYield(_loop(), "t0", 95);
1206
- case 95:
1207
- _context2.next = 93;
1203
+ return _context2.delegateYield(_loop(), "t0", 96);
1204
+ case 96:
1205
+ _context2.next = 94;
1208
1206
  break;
1209
- case 97:
1210
- _context2.next = 102;
1207
+ case 98:
1208
+ _context2.next = 103;
1211
1209
  break;
1212
- case 99:
1213
- _context2.prev = 99;
1214
- _context2.t1 = _context2["catch"](90);
1210
+ case 100:
1211
+ _context2.prev = 100;
1212
+ _context2.t1 = _context2["catch"](91);
1215
1213
  _iterator4.e(_context2.t1);
1216
- case 102:
1217
- _context2.prev = 102;
1214
+ case 103:
1215
+ _context2.prev = 103;
1218
1216
  _iterator4.f();
1219
- return _context2.finish(102);
1220
- case 105:
1217
+ return _context2.finish(103);
1218
+ case 106:
1221
1219
  if (!manualMessage) {
1222
- _context2.next = 121;
1220
+ _context2.next = 122;
1223
1221
  break;
1224
1222
  }
1225
1223
  /** @type {import('@scout9/app').Message} */
@@ -1231,25 +1229,25 @@ var Spirits = {
1231
1229
  time: new Date().toISOString()
1232
1230
  };
1233
1231
  if (!(_typeof(manualMessage) === 'object')) {
1234
- _context2.next = 113;
1232
+ _context2.next = 114;
1235
1233
  break;
1236
1234
  }
1237
1235
  Object.assign(manualMessageObj, manualMessage);
1238
1236
  manualMessageObj.role = 'agent';
1239
1237
  manualMessageObj.time = new Date().toISOString();
1240
- _context2.next = 118;
1238
+ _context2.next = 119;
1241
1239
  break;
1242
- case 113:
1240
+ case 114:
1243
1241
  if (!(typeof manualMessage === 'string')) {
1244
- _context2.next = 117;
1242
+ _context2.next = 118;
1245
1243
  break;
1246
1244
  }
1247
1245
  manualMessageObj.content = manualMessage;
1248
- _context2.next = 118;
1246
+ _context2.next = 119;
1249
1247
  break;
1250
- case 117:
1251
- throw new Error('Manual message must be of type "string" or "DirectMessage"');
1252
1248
  case 118:
1249
+ throw new Error('Manual message must be of type "string" or "DirectMessage"');
1250
+ case 119:
1253
1251
  if (scheduled) {
1254
1252
  manualMessageObj.time = new Date(scheduled * 1000).toISOString();
1255
1253
  manualMessageObj.scheduled = manualMessageObj.time;
@@ -1261,7 +1259,7 @@ var Spirits = {
1261
1259
  }
1262
1260
  messages.push(manualMessageObj);
1263
1261
  progress('Added manual message', 'info', 'ADD_MESSAGE', messages[messages.length - 1]);
1264
- case 121:
1262
+ case 122:
1265
1263
  if (contextUpsert) {
1266
1264
  context = updateContext(context, contextUpsert);
1267
1265
  progress('Upserted context', 'info', 'UPDATE_CONTEXT', contextUpsert);
@@ -1269,21 +1267,21 @@ var Spirits = {
1269
1267
  if (resetIntent) {
1270
1268
  resettedIntent = true;
1271
1269
  }
1272
- case 123:
1270
+ case 124:
1273
1271
  _context2.next = 55;
1274
1272
  break;
1275
- case 125:
1276
- _context2.next = 130;
1273
+ case 126:
1274
+ _context2.next = 131;
1277
1275
  break;
1278
- case 127:
1279
- _context2.prev = 127;
1276
+ case 128:
1277
+ _context2.prev = 128;
1280
1278
  _context2.t2 = _context2["catch"](53);
1281
1279
  _iterator.e(_context2.t2);
1282
- case 130:
1283
- _context2.prev = 130;
1280
+ case 131:
1281
+ _context2.prev = 131;
1284
1282
  _iterator.f();
1285
- return _context2.finish(130);
1286
- case 133:
1283
+ return _context2.finish(131);
1284
+ case 134:
1287
1285
  if (resettedIntent && !_forward) {
1288
1286
  conversation.intent = null;
1289
1287
  conversation.intentScore = null;
@@ -1302,24 +1300,28 @@ var Spirits = {
1302
1300
  // 4. Generate response
1303
1301
  // If conversation previously locked, don't generate
1304
1302
  if (input.conversation.locked) {
1305
- _context2.next = 181;
1303
+ _context2.next = 184;
1306
1304
  break;
1307
1305
  }
1308
1306
  if (!((!conversation.locked || !hasNoInstructions) && !!hasNoCustomMessage)) {
1309
- _context2.next = 148;
1307
+ _context2.next = 151;
1310
1308
  break;
1311
1309
  }
1312
- _context2.prev = 136;
1310
+ _context2.prev = 137;
1313
1311
  progress('Generating message', 'info', 'SET_PROCESSING', 'system');
1314
- _context2.next = 140;
1315
- return generator({
1312
+ generatorInput = {
1316
1313
  messages: messages,
1317
1314
  persona: persona,
1318
1315
  context: context,
1319
1316
  llm: config.llm,
1320
1317
  pmt: config.pmt
1321
- });
1322
- case 140:
1318
+ };
1319
+ if (!!_tasks && Array.isArray(_tasks) && !!_tasks.length) {
1320
+ generatorInput.tasks = _tasks;
1321
+ }
1322
+ _context2.next = 143;
1323
+ return generator(generatorInput);
1324
+ case 143:
1323
1325
  generatorPayload = _context2.sent;
1324
1326
  if (!generatorPayload.send) {
1325
1327
  progress('Generated response', 'failed', undefined, {
@@ -1358,29 +1360,29 @@ var Spirits = {
1358
1360
  }
1359
1361
  }
1360
1362
  }
1361
- _context2.next = 148;
1363
+ _context2.next = 151;
1362
1364
  break;
1363
- case 144:
1364
- _context2.prev = 144;
1365
- _context2.t3 = _context2["catch"](136);
1365
+ case 147:
1366
+ _context2.prev = 147;
1367
+ _context2.t3 = _context2["catch"](137);
1366
1368
  console.error("Locking conversation, error generating response: ".concat(_context2.t3.message));
1367
1369
  conversation = lockConversation(conversation, 'API: ' + _context2.t3.message);
1368
- case 148:
1370
+ case 151:
1369
1371
  if (!(messagesToTransform.length && transformer)) {
1370
- _context2.next = 180;
1372
+ _context2.next = 183;
1371
1373
  break;
1372
1374
  }
1373
- _context2.prev = 149;
1375
+ _context2.prev = 152;
1374
1376
  _iterator2 = _createForOfIteratorHelper(messagesToTransform);
1375
- _context2.prev = 151;
1377
+ _context2.prev = 154;
1376
1378
  _iterator2.s();
1377
- case 153:
1379
+ case 156:
1378
1380
  if ((_step2 = _iterator2.n()).done) {
1379
- _context2.next = 164;
1381
+ _context2.next = 167;
1380
1382
  break;
1381
1383
  }
1382
1384
  _step2.value;
1383
- _context2.next = 157;
1385
+ _context2.next = 160;
1384
1386
  return transformer({
1385
1387
  message: messagesToTransform,
1386
1388
  persona: persona,
@@ -1388,7 +1390,7 @@ var Spirits = {
1388
1390
  messages: messages,
1389
1391
  context: context
1390
1392
  });
1391
- case 157:
1393
+ case 160:
1392
1394
  transformResponse = _context2.sent;
1393
1395
  progress('Generated response', 'success', undefined, undefined);
1394
1396
  // Check if already had message
@@ -1408,36 +1410,36 @@ var Spirits = {
1408
1410
  });
1409
1411
  progress('Added agent message', 'info', 'ADD_MESSAGE', messages[messages.length - 1]);
1410
1412
  }
1411
- case 162:
1412
- _context2.next = 153;
1413
+ case 165:
1414
+ _context2.next = 156;
1413
1415
  break;
1414
- case 164:
1415
- _context2.next = 169;
1416
+ case 167:
1417
+ _context2.next = 172;
1416
1418
  break;
1417
- case 166:
1418
- _context2.prev = 166;
1419
- _context2.t4 = _context2["catch"](151);
1420
- _iterator2.e(_context2.t4);
1421
1419
  case 169:
1422
1420
  _context2.prev = 169;
1423
- _iterator2.f();
1424
- return _context2.finish(169);
1421
+ _context2.t4 = _context2["catch"](154);
1422
+ _iterator2.e(_context2.t4);
1425
1423
  case 172:
1426
- _context2.next = 178;
1424
+ _context2.prev = 172;
1425
+ _iterator2.f();
1426
+ return _context2.finish(172);
1427
+ case 175:
1428
+ _context2.next = 181;
1427
1429
  break;
1428
- case 174:
1429
- _context2.prev = 174;
1430
- _context2.t5 = _context2["catch"](149);
1430
+ case 177:
1431
+ _context2.prev = 177;
1432
+ _context2.t5 = _context2["catch"](152);
1431
1433
  console.error("Locking conversation, error transforming response: ".concat(_context2.t5.message));
1432
1434
  conversation = lockConversation(conversation, 'API: ' + _context2.t5.message);
1433
- case 178:
1434
- _context2.next = 181;
1435
+ case 181:
1436
+ _context2.next = 184;
1435
1437
  break;
1436
- case 180:
1438
+ case 183:
1437
1439
  if (messagesToTransform.length) {
1438
1440
  console.warn("No transformer provided");
1439
1441
  }
1440
- case 181:
1442
+ case 184:
1441
1443
  progress('Parsing message', 'info', 'SET_PROCESSING', null);
1442
1444
  return _context2.abrupt("return", {
1443
1445
  conversation: {
@@ -1461,11 +1463,11 @@ var Spirits = {
1461
1463
  followup: followup,
1462
1464
  entityContextUpsert: entityContextUpsert
1463
1465
  });
1464
- case 183:
1466
+ case 186:
1465
1467
  case "end":
1466
1468
  return _context2.stop();
1467
1469
  }
1468
- }, _callee, null, [[53, 127, 130, 133], [90, 99, 102, 105], [136, 144], [149, 174], [151, 166, 169, 172]]);
1470
+ }, _callee, null, [[53, 128, 131, 134], [91, 100, 103, 106], [137, 147], [152, 177], [154, 169, 172, 175]]);
1469
1471
  }));
1470
1472
  function customer(_x) {
1471
1473
  return _customer.apply(this, arguments);
package/dist/spirits.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var spirits = require("./spirits-54ee2389.cjs");
5
+ var spirits = require("./spirits-59475def.cjs");
6
6
 
7
7
 
8
8
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var dev = require("./dev-7570f439.cjs");
6
- require("./spirits-54ee2389.cjs");
5
+ var dev = require("./dev-d74b94c8.cjs");
6
+ require("./spirits-59475def.cjs");
7
7
  require('util');
8
8
  require('stream');
9
9
  require('path');
@@ -24,7 +24,7 @@ require('node:url');
24
24
  require('node:events');
25
25
  require('node:stream');
26
26
  require('node:string_decoder');
27
- require("./macros-85a033b9.cjs");
27
+ require("./macros-22b2e0b8.cjs");
28
28
  require('node:readline');
29
29
  require('node:process');
30
30
  require('node:os');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scout9/app",
3
- "version": "1.0.0-alpha.0.6.8",
3
+ "version": "1.0.0-alpha.0.6.9",
4
4
  "description": "Build and deploy your Scout9 app for SMS auto replies",
5
5
  "publishConfig": {
6
6
  "access": "public"