@scout9/app 1.0.0-alpha.0.6.7 → 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-9719ae4f.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-197a7adb.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-9719ae4f.cjs");
4
- var dev = require("./dev-197a7adb.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-0d83aaf8.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-1010a60c.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-1010a60c.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-1010a60c.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-1010a60c.cjs");
6
- var dev = require("./dev-197a7adb.cjs");
7
- require("./spirits-9719ae4f.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-1010a60c.cjs");
6
- require("./spirits-9719ae4f.cjs");
7
- require("./dev-197a7adb.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
 
@@ -725,7 +717,10 @@ var _excluded = ["keywords"];
725
717
 
726
718
  /**
727
719
  * @typedef {Object} ConversationEvent
728
- * @property {Change<import('@scout9/app').Conversation> & {forwardNote?: string; forward?: import('@scout9/app').WorkflowResponseSlot['forward']}} conversation
720
+ * @property {(Change<import('@scout9/app').Conversation> & {
721
+ * forwardNote?: string;
722
+ * forward?: import('@scout9/app').WorkflowResponseSlot['forward'];
723
+ * })} conversation
729
724
  * @property {Change<Array<import('@scout9/app').Message>>} messages
730
725
  * @property {Change<any>} context
731
726
  * @property {Change<import('@scout9/app').Message>} message
@@ -741,7 +736,7 @@ var Spirits = {
741
736
  customer: function () {
742
737
  var _customer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(input) {
743
738
  var _recentUserMessage;
744
- 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;
745
740
  return _regeneratorRuntime().wrap(function _callee$(_context2) {
746
741
  while (1) switch (_context2.prev = _context2.next) {
747
742
  case 0:
@@ -1016,15 +1011,16 @@ var Spirits = {
1016
1011
  });
1017
1012
  }
1018
1013
  resettedIntent = false;
1014
+ /** @type {Array<string> | undefined} */
1019
1015
  _iterator = _createForOfIteratorHelper(slots);
1020
1016
  _context2.prev = 53;
1021
1017
  _iterator.s();
1022
1018
  case 55:
1023
1019
  if ((_step = _iterator.n()).done) {
1024
- _context2.next = 125;
1020
+ _context2.next = 126;
1025
1021
  break;
1026
1022
  }
1027
- _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;
1028
1024
  if (!anticipate) {
1029
1025
  _context2.next = 70;
1030
1026
  break;
@@ -1071,6 +1067,11 @@ var Spirits = {
1071
1067
  case 69:
1072
1068
  throw new Error("Invalid anticipate payload \"".concat(JSON.stringify(anticipate), "\""));
1073
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
+ }
1074
1075
  if (slotFollowup) {
1075
1076
  followup.push(slotFollowup);
1076
1077
  }
@@ -1121,19 +1122,19 @@ var Spirits = {
1121
1122
 
1122
1123
  // Insert instructions context
1123
1124
  if (!instructions) {
1124
- _context2.next = 88;
1125
+ _context2.next = 89;
1125
1126
  break;
1126
1127
  }
1127
1128
  if (!(typeof instructions === 'string')) {
1128
- _context2.next = 78;
1129
+ _context2.next = 79;
1129
1130
  break;
1130
1131
  }
1131
1132
  addInstruction(instructions, previousLockAttempt);
1132
- _context2.next = 88;
1133
+ _context2.next = 89;
1133
1134
  break;
1134
- case 78:
1135
+ case 79:
1135
1136
  if (!Array.isArray(instructions)) {
1136
- _context2.next = 83;
1137
+ _context2.next = 84;
1137
1138
  break;
1138
1139
  }
1139
1140
  _iterator3 = _createForOfIteratorHelper(instructions);
@@ -1151,25 +1152,25 @@ var Spirits = {
1151
1152
  } finally {
1152
1153
  _iterator3.f();
1153
1154
  }
1154
- _context2.next = 88;
1155
+ _context2.next = 89;
1155
1156
  break;
1156
- case 83:
1157
+ case 84:
1157
1158
  if (!(_typeof(instructions) === 'object' && 'content' in instructions)) {
1158
- _context2.next = 87;
1159
+ _context2.next = 88;
1159
1160
  break;
1160
1161
  }
1161
1162
  addInstruction(instructions.content, previousLockAttempt, instructions.id);
1162
- _context2.next = 88;
1163
+ _context2.next = 89;
1163
1164
  break;
1164
- case 87:
1165
- throw new Error("SpiritsError: instructions must be a string or array or {content: \"<instruction>\"}, got: ".concat(JSON.stringify(instructions)));
1166
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:
1167
1168
  if (!removeInstructions) {
1168
- _context2.next = 105;
1169
+ _context2.next = 106;
1169
1170
  break;
1170
1171
  }
1171
1172
  _iterator4 = _createForOfIteratorHelper(removeInstructions);
1172
- _context2.prev = 90;
1173
+ _context2.prev = 91;
1173
1174
  _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
1174
1175
  var instructionId, index;
1175
1176
  return _regeneratorRuntime().wrap(function _loop$(_context) {
@@ -1194,29 +1195,29 @@ var Spirits = {
1194
1195
  }, _loop);
1195
1196
  });
1196
1197
  _iterator4.s();
1197
- case 93:
1198
+ case 94:
1198
1199
  if ((_step4 = _iterator4.n()).done) {
1199
- _context2.next = 97;
1200
+ _context2.next = 98;
1200
1201
  break;
1201
1202
  }
1202
- return _context2.delegateYield(_loop(), "t0", 95);
1203
- case 95:
1204
- _context2.next = 93;
1203
+ return _context2.delegateYield(_loop(), "t0", 96);
1204
+ case 96:
1205
+ _context2.next = 94;
1205
1206
  break;
1206
- case 97:
1207
- _context2.next = 102;
1207
+ case 98:
1208
+ _context2.next = 103;
1208
1209
  break;
1209
- case 99:
1210
- _context2.prev = 99;
1211
- _context2.t1 = _context2["catch"](90);
1210
+ case 100:
1211
+ _context2.prev = 100;
1212
+ _context2.t1 = _context2["catch"](91);
1212
1213
  _iterator4.e(_context2.t1);
1213
- case 102:
1214
- _context2.prev = 102;
1214
+ case 103:
1215
+ _context2.prev = 103;
1215
1216
  _iterator4.f();
1216
- return _context2.finish(102);
1217
- case 105:
1217
+ return _context2.finish(103);
1218
+ case 106:
1218
1219
  if (!manualMessage) {
1219
- _context2.next = 121;
1220
+ _context2.next = 122;
1220
1221
  break;
1221
1222
  }
1222
1223
  /** @type {import('@scout9/app').Message} */
@@ -1228,25 +1229,25 @@ var Spirits = {
1228
1229
  time: new Date().toISOString()
1229
1230
  };
1230
1231
  if (!(_typeof(manualMessage) === 'object')) {
1231
- _context2.next = 113;
1232
+ _context2.next = 114;
1232
1233
  break;
1233
1234
  }
1234
1235
  Object.assign(manualMessageObj, manualMessage);
1235
1236
  manualMessageObj.role = 'agent';
1236
1237
  manualMessageObj.time = new Date().toISOString();
1237
- _context2.next = 118;
1238
+ _context2.next = 119;
1238
1239
  break;
1239
- case 113:
1240
+ case 114:
1240
1241
  if (!(typeof manualMessage === 'string')) {
1241
- _context2.next = 117;
1242
+ _context2.next = 118;
1242
1243
  break;
1243
1244
  }
1244
1245
  manualMessageObj.content = manualMessage;
1245
- _context2.next = 118;
1246
+ _context2.next = 119;
1246
1247
  break;
1247
- case 117:
1248
- throw new Error('Manual message must be of type "string" or "DirectMessage"');
1249
1248
  case 118:
1249
+ throw new Error('Manual message must be of type "string" or "DirectMessage"');
1250
+ case 119:
1250
1251
  if (scheduled) {
1251
1252
  manualMessageObj.time = new Date(scheduled * 1000).toISOString();
1252
1253
  manualMessageObj.scheduled = manualMessageObj.time;
@@ -1258,7 +1259,7 @@ var Spirits = {
1258
1259
  }
1259
1260
  messages.push(manualMessageObj);
1260
1261
  progress('Added manual message', 'info', 'ADD_MESSAGE', messages[messages.length - 1]);
1261
- case 121:
1262
+ case 122:
1262
1263
  if (contextUpsert) {
1263
1264
  context = updateContext(context, contextUpsert);
1264
1265
  progress('Upserted context', 'info', 'UPDATE_CONTEXT', contextUpsert);
@@ -1266,21 +1267,21 @@ var Spirits = {
1266
1267
  if (resetIntent) {
1267
1268
  resettedIntent = true;
1268
1269
  }
1269
- case 123:
1270
+ case 124:
1270
1271
  _context2.next = 55;
1271
1272
  break;
1272
- case 125:
1273
- _context2.next = 130;
1273
+ case 126:
1274
+ _context2.next = 131;
1274
1275
  break;
1275
- case 127:
1276
- _context2.prev = 127;
1276
+ case 128:
1277
+ _context2.prev = 128;
1277
1278
  _context2.t2 = _context2["catch"](53);
1278
1279
  _iterator.e(_context2.t2);
1279
- case 130:
1280
- _context2.prev = 130;
1280
+ case 131:
1281
+ _context2.prev = 131;
1281
1282
  _iterator.f();
1282
- return _context2.finish(130);
1283
- case 133:
1283
+ return _context2.finish(131);
1284
+ case 134:
1284
1285
  if (resettedIntent && !_forward) {
1285
1286
  conversation.intent = null;
1286
1287
  conversation.intentScore = null;
@@ -1299,24 +1300,28 @@ var Spirits = {
1299
1300
  // 4. Generate response
1300
1301
  // If conversation previously locked, don't generate
1301
1302
  if (input.conversation.locked) {
1302
- _context2.next = 181;
1303
+ _context2.next = 184;
1303
1304
  break;
1304
1305
  }
1305
1306
  if (!((!conversation.locked || !hasNoInstructions) && !!hasNoCustomMessage)) {
1306
- _context2.next = 148;
1307
+ _context2.next = 151;
1307
1308
  break;
1308
1309
  }
1309
- _context2.prev = 136;
1310
+ _context2.prev = 137;
1310
1311
  progress('Generating message', 'info', 'SET_PROCESSING', 'system');
1311
- _context2.next = 140;
1312
- return generator({
1312
+ generatorInput = {
1313
1313
  messages: messages,
1314
1314
  persona: persona,
1315
1315
  context: context,
1316
1316
  llm: config.llm,
1317
1317
  pmt: config.pmt
1318
- });
1319
- 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:
1320
1325
  generatorPayload = _context2.sent;
1321
1326
  if (!generatorPayload.send) {
1322
1327
  progress('Generated response', 'failed', undefined, {
@@ -1355,29 +1360,29 @@ var Spirits = {
1355
1360
  }
1356
1361
  }
1357
1362
  }
1358
- _context2.next = 148;
1363
+ _context2.next = 151;
1359
1364
  break;
1360
- case 144:
1361
- _context2.prev = 144;
1362
- _context2.t3 = _context2["catch"](136);
1365
+ case 147:
1366
+ _context2.prev = 147;
1367
+ _context2.t3 = _context2["catch"](137);
1363
1368
  console.error("Locking conversation, error generating response: ".concat(_context2.t3.message));
1364
1369
  conversation = lockConversation(conversation, 'API: ' + _context2.t3.message);
1365
- case 148:
1370
+ case 151:
1366
1371
  if (!(messagesToTransform.length && transformer)) {
1367
- _context2.next = 180;
1372
+ _context2.next = 183;
1368
1373
  break;
1369
1374
  }
1370
- _context2.prev = 149;
1375
+ _context2.prev = 152;
1371
1376
  _iterator2 = _createForOfIteratorHelper(messagesToTransform);
1372
- _context2.prev = 151;
1377
+ _context2.prev = 154;
1373
1378
  _iterator2.s();
1374
- case 153:
1379
+ case 156:
1375
1380
  if ((_step2 = _iterator2.n()).done) {
1376
- _context2.next = 164;
1381
+ _context2.next = 167;
1377
1382
  break;
1378
1383
  }
1379
1384
  _step2.value;
1380
- _context2.next = 157;
1385
+ _context2.next = 160;
1381
1386
  return transformer({
1382
1387
  message: messagesToTransform,
1383
1388
  persona: persona,
@@ -1385,7 +1390,7 @@ var Spirits = {
1385
1390
  messages: messages,
1386
1391
  context: context
1387
1392
  });
1388
- case 157:
1393
+ case 160:
1389
1394
  transformResponse = _context2.sent;
1390
1395
  progress('Generated response', 'success', undefined, undefined);
1391
1396
  // Check if already had message
@@ -1405,36 +1410,36 @@ var Spirits = {
1405
1410
  });
1406
1411
  progress('Added agent message', 'info', 'ADD_MESSAGE', messages[messages.length - 1]);
1407
1412
  }
1408
- case 162:
1409
- _context2.next = 153;
1413
+ case 165:
1414
+ _context2.next = 156;
1410
1415
  break;
1411
- case 164:
1412
- _context2.next = 169;
1416
+ case 167:
1417
+ _context2.next = 172;
1413
1418
  break;
1414
- case 166:
1415
- _context2.prev = 166;
1416
- _context2.t4 = _context2["catch"](151);
1417
- _iterator2.e(_context2.t4);
1418
1419
  case 169:
1419
1420
  _context2.prev = 169;
1420
- _iterator2.f();
1421
- return _context2.finish(169);
1421
+ _context2.t4 = _context2["catch"](154);
1422
+ _iterator2.e(_context2.t4);
1422
1423
  case 172:
1423
- _context2.next = 178;
1424
+ _context2.prev = 172;
1425
+ _iterator2.f();
1426
+ return _context2.finish(172);
1427
+ case 175:
1428
+ _context2.next = 181;
1424
1429
  break;
1425
- case 174:
1426
- _context2.prev = 174;
1427
- _context2.t5 = _context2["catch"](149);
1430
+ case 177:
1431
+ _context2.prev = 177;
1432
+ _context2.t5 = _context2["catch"](152);
1428
1433
  console.error("Locking conversation, error transforming response: ".concat(_context2.t5.message));
1429
1434
  conversation = lockConversation(conversation, 'API: ' + _context2.t5.message);
1430
- case 178:
1431
- _context2.next = 181;
1435
+ case 181:
1436
+ _context2.next = 184;
1432
1437
  break;
1433
- case 180:
1438
+ case 183:
1434
1439
  if (messagesToTransform.length) {
1435
1440
  console.warn("No transformer provided");
1436
1441
  }
1437
- case 181:
1442
+ case 184:
1438
1443
  progress('Parsing message', 'info', 'SET_PROCESSING', null);
1439
1444
  return _context2.abrupt("return", {
1440
1445
  conversation: {
@@ -1458,11 +1463,11 @@ var Spirits = {
1458
1463
  followup: followup,
1459
1464
  entityContextUpsert: entityContextUpsert
1460
1465
  });
1461
- case 183:
1466
+ case 186:
1462
1467
  case "end":
1463
1468
  return _context2.stop();
1464
1469
  }
1465
- }, _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]]);
1466
1471
  }));
1467
1472
  function customer(_x) {
1468
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-9719ae4f.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-197a7adb.cjs");
6
- require("./spirits-9719ae4f.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.7",
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"