@scout9/app 1.0.0-alpha.0.1.87 → 1.0.0-alpha.0.1.88

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-643c422a.cjs");
3
+ var spirits = require("./spirits-1dc18cf4.cjs");
4
4
  var readline = require('node:readline');
5
5
  var require$$0$2 = require('fs');
6
6
  var require$$2$1 = require('events');
@@ -41174,7 +41174,7 @@ class Body {
41174
41174
  }
41175
41175
  const {
41176
41176
  toFormData
41177
- } = await Promise.resolve().then(function () { return require("./multipart-parser-1f8d78d0.cjs"); });
41177
+ } = await Promise.resolve().then(function () { return require("./multipart-parser-78fb466c.cjs"); });
41178
41178
  return toFormData(this.body, ct);
41179
41179
  }
41180
41180
 
@@ -79141,20 +79141,21 @@ var _excluded$1 = ["entity", "entities", "api", "id"];
79141
79141
  * @returns {string}
79142
79142
  */
79143
79143
  function agentsTemplate(agents) {
79144
- return "\n/**\n * Required core entity type: Agents represents you and your team\n * @returns {Array<import('@scout9/app').Agent>}\n */\nexport default function Agents() {\n return ".concat(JSON.stringify(agents, null, 2), ";\n}\n");
79144
+ return "\n/**\n * Required core entity type: Agents represents you and your team\n * @returns {Array<import('@scout9/app').IAgent>}\n */\nexport default function Agents() {\n return ".concat(JSON.stringify(agents, null, 2), ";\n}\n");
79145
79145
  }
79146
79146
 
79147
79147
  /**
79148
79148
  * @param {Scout9ProjectBuildConfig} config
79149
79149
  * @param {string} exe - file extension
79150
79150
  * @returns {string}
79151
+ *
79151
79152
  */
79152
79153
  function rootTemplate(config) {
79153
79154
  var _config$llm, _config$llm2, _config$pmt, _config$pmt2;
79154
- return "\n/**\n * Configuration for the Scout9 project.\n * @type {import('@scout9/app').Scout9ProjectConfig}\n */\nexport default {\n\n /**\n * Configure large language model (LLM) settings to generate auto replies\n */\n llm: {\n engine: ".concat(config !== null && config !== void 0 && (_config$llm = config.llm) !== null && _config$llm !== void 0 && _config$llm.engine ? "'".concat(config.llm.engine, "'") : "'openai'", ",\n model: ").concat(config !== null && config !== void 0 && (_config$llm2 = config.llm) !== null && _config$llm2 !== void 0 && _config$llm2.model ? "'".concat(config.llm.model, "'") : "'gpt-3.5-turbo'", ",\n },\n /**\n * Configure personal model transformer (PMT) settings to align auto replies the agent's tone\n */\n pmt: {\n engine: ").concat(config !== null && config !== void 0 && (_config$pmt = config.pmt) !== null && _config$pmt !== void 0 && _config$pmt.engine ? "'".concat(config.pmt.engine, "'") : "'scout9'", ",\n model: ").concat(config !== null && config !== void 0 && (_config$pmt2 = config.pmt) !== null && _config$pmt2 !== void 0 && _config$pmt2.model ? "'".concat(config.pmt.model, "'") : "'orin-2.2'", ",\n },\n organization: ").concat(config !== null && config !== void 0 && config.organization ? JSON.stringify(config.organization, null, 2) : "{name: \"Organization Name\", description: \"Organization description.\"}", ",\n initialContext: ").concat(config !== null && config !== void 0 && config.initialContext ? JSON.stringify(config.initialContext, null, 2) : "[]", "\n}\n ");
79155
+ return "\n/**\n * Configuration for the Scout9 project.\n * @type {import('@scout9/app').IScout9ProjectConfig}\n */\nexport default {\n\n /**\n * Configure large language model (LLM) settings to generate auto replies\n */\n llm: {\n engine: ".concat(config !== null && config !== void 0 && (_config$llm = config.llm) !== null && _config$llm !== void 0 && _config$llm.engine ? "'".concat(config.llm.engine, "'") : "'openai'", ",\n model: ").concat(config !== null && config !== void 0 && (_config$llm2 = config.llm) !== null && _config$llm2 !== void 0 && _config$llm2.model ? "'".concat(config.llm.model, "'") : "'gpt-3.5-turbo'", ",\n },\n /**\n * Configure personal model transformer (PMT) settings to align auto replies the agent's tone\n */\n pmt: {\n engine: ").concat(config !== null && config !== void 0 && (_config$pmt = config.pmt) !== null && _config$pmt !== void 0 && _config$pmt.engine ? "'".concat(config.pmt.engine, "'") : "'scout9'", ",\n model: ").concat(config !== null && config !== void 0 && (_config$pmt2 = config.pmt) !== null && _config$pmt2 !== void 0 && _config$pmt2.model ? "'".concat(config.pmt.model, "'") : "'orin-2.2'", ",\n },\n organization: ").concat(config !== null && config !== void 0 && config.organization ? JSON.stringify(config.organization, null, 2) : "{name: \"Organization Name\", description: \"Organization description.\"}", ",\n initialContext: ").concat(config !== null && config !== void 0 && config.initialContext ? JSON.stringify(config.initialContext, null, 2) : "[]", "\n}\n ");
79155
79156
  }
79156
79157
  function appTemplate() {
79157
- return "\n/**\n * @param {import('@scout9/app').WorkflowEvent} event - every workflow receives an event object\n * @returns {Promise<import('@scout9/app').WorkflowResponse>} - every workflow must return a WorkflowResponse\n */\nexport default async function Scout9App(event) {\n return {\n forward: true,\n };\n}\n ";
79158
+ return "\n/**\n * @param {import('@scout9/app').IWorkflowEvent} event - every workflow receives an event object\n * @returns {Promise<import('@scout9/app').IWorkflowResponse>} - every workflow must return a WorkflowResponse\n */\nexport default async function Scout9App(event) {\n return {\n forward: true,\n };\n}\n ";
79158
79159
  }
79159
79160
 
79160
79161
  /**
@@ -81151,7 +81152,8 @@ function writeImageToServer(_x) {
81151
81152
  return _writeImageToServer.apply(this, arguments);
81152
81153
  }
81153
81154
  /**
81154
- * Loads the users local package.json, if they provide a package-s9-test.json, it will load that instead (used for scout9 internal testing)
81155
+ * Loads the users local package.json, if they provide a package-s9-test.json,
81156
+ * it will load that instead (used for scout9 internal testing)
81155
81157
  * @param {cwd?: string}
81156
81158
  * @returns {Promise<{isTest: boolean, pkg: {name: string; version: string; dependencies: Record<string, string>}}>}
81157
81159
  */
@@ -81213,7 +81215,7 @@ function loadUserPackageJson$1(_x2) {
81213
81215
  }
81214
81216
 
81215
81217
  /**
81216
- * @returns {Promise<Scout9ProjectConfig>}
81218
+ * @returns {Promise<import('@scout9/app').IScout9ProjectConfig>}
81217
81219
  */
81218
81220
  function _loadUserPackageJson$1() {
81219
81221
  _loadUserPackageJson$1 = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee2(_ref2) {
@@ -81230,7 +81232,7 @@ function _loadUserPackageJson$1() {
81230
81232
  targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
81231
81233
  _context2.t0 = JSON;
81232
81234
  _context2.next = 10;
81233
- 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('exports-85e8c05c.js', document.baseURI).href))), 'utf-8');
81235
+ 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('exports-b2e88386.js', document.baseURI).href))), 'utf-8');
81234
81236
  case 10:
81235
81237
  _context2.t1 = _context2.sent;
81236
81238
  pkg = _context2.t0.parse.call(_context2.t0, _context2.t1);
@@ -81562,8 +81564,8 @@ function _platformApi() {
81562
81564
  }
81563
81565
 
81564
81566
  /**
81565
- * @param {Scout9ProjectBuildConfig} config
81566
- * @returns {Promise<Scout9ProjectBuildConfig>}
81567
+ * @param {import('@scout9/app').IScout9ProjectBuildConfig} config
81568
+ * @returns {Promise<import('@scout9/app').IScout9ProjectBuildConfig>}
81567
81569
  */
81568
81570
  function syncData(_x) {
81569
81571
  return _syncData.apply(this, arguments);
@@ -82075,7 +82077,7 @@ function _loadUserPackageJson() {
82075
82077
  targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
82076
82078
  _context.t0 = JSON;
82077
82079
  _context.next = 10;
82078
- 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('exports-85e8c05c.js', document.baseURI).href))), 'utf-8');
82080
+ 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('exports-b2e88386.js', document.baseURI).href))), 'utf-8');
82079
82081
  case 10:
82080
82082
  _context.t1 = _context.sent;
82081
82083
  pkg = _context.t0.parse.call(_context.t0, _context.t1);
@@ -86669,6 +86671,9 @@ var MessageSchema = z.object({
86669
86671
  }).optional().nullable(),
86670
86672
  intentScore: z.number({
86671
86673
  description: 'Confidence score of the assigned intent'
86674
+ }).nullable().optional(),
86675
+ delayInSeconds: z.number({
86676
+ description: 'How long to delay the message manually in seconds'
86672
86677
  }).nullable().optional()
86673
86678
  });
86674
86679
 
@@ -88511,7 +88516,7 @@ function report(config, logger) {
88511
88516
  logger.primary("Run ".concat(cyan('scout9 dev'), " to test your project locally"));
88512
88517
  }
88513
88518
 
88514
- var __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-85e8c05c.js', document.baseURI).href)));
88519
+ var __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('exports-b2e88386.js', document.baseURI).href)));
88515
88520
  var __dirname$1 = path__default["default"].dirname(__filename$1);
88516
88521
  function zipDirectory(source, out) {
88517
88522
  var archive = archiver$1('tar', {
@@ -88726,7 +88731,7 @@ function _buildApp() {
88726
88731
  case 11:
88727
88732
  _context4.t0 = JSON;
88728
88733
  _context4.next = 14;
88729
- 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('exports-85e8c05c.js', document.baseURI).href))), 'utf-8');
88734
+ 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('exports-b2e88386.js', document.baseURI).href))), 'utf-8');
88730
88735
  case 14:
88731
88736
  _context4.t1 = _context4.sent;
88732
88737
  packageTemplate = _context4.t0.parse.call(_context4.t0, _context4.t1);
@@ -89183,7 +89188,7 @@ function deploy(_x11, _x12) {
89183
89188
  /**
89184
89189
  * Tests a local project to scout9 by running a dummy parse command with the project's local entities
89185
89190
  * @param {{cwd: string; src: string, dest: string}} - build options
89186
- * @param {import('../runtime/client/config.js').IScout9ProjectBuildConfig} config
89191
+ * @param {import('@scout9/app').IScout9ProjectBuildConfig} config
89187
89192
  */
89188
89193
  function _deploy() {
89189
89194
  _deploy = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee11(_ref4, config) {
@@ -89259,8 +89264,8 @@ function test(_x13, _x14) {
89259
89264
  /**
89260
89265
  *
89261
89266
  * @param {{cwd: string; src: string; projectFiles: ProjectFiles; logger: ProgressLogger}} options
89262
- * @param {import('../runtime/client/config.js').IScout9ProjectBuildConfig} config
89263
- * @returns {Promise<{success: boolean; config: import('../runtime/client/config.js').IScout9ProjectBuildConfig}>}
89267
+ * @param {import('@scout9/app').IScout9ProjectBuildConfig} config
89268
+ * @returns {Promise<{success: boolean; config: import('@scout9/app').IScout9ProjectBuildConfig}>}
89264
89269
  */
89265
89270
  function _test() {
89266
89271
  _test = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee12(_ref5, config) {
@@ -90149,7 +90154,7 @@ function loadEntityApiConfig(_x, _x2) {
90149
90154
  return _loadEntityApiConfig.apply(this, arguments);
90150
90155
  }
90151
90156
  /**
90152
- * @returns {Promise<EntitiesBuildConfig>}
90157
+ * @returns {Promise<import('@scout9/app').IEntitiesRootProjectConfiguration>}
90153
90158
  */
90154
90159
  function _loadEntityApiConfig() {
90155
90160
  _loadEntityApiConfig = spirits._asyncToGenerator( /*#__PURE__*/spirits._regeneratorRuntime().mark(function _callee(cwd, filePath) {
@@ -90212,7 +90217,7 @@ function _loadEntitiesConfig() {
90212
90217
  while (1) switch (_context4.prev = _context4.next) {
90213
90218
  case 0:
90214
90219
  _ref = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {}, _ref$cwd = _ref.cwd, cwd = _ref$cwd === void 0 ? process.cwd() : _ref$cwd, _ref$src = _ref.src, src = _ref$src === void 0 ? 'src' : _ref$src, _ref.logger, _ref.cb;
90215
- /** @type EntitiesBuildConfig */
90220
+ /** @type import('@scout9/app').IEntitiesRootProjectConfiguration */
90216
90221
  config = []; // const paths = globSync(path.resolve(cwd, `${src}/entities/**/{index,config,api}.{ts,js}`), {cwd, absolute: true});
90217
90222
  filePaths = globSync("".concat(src, "/entities/**/{index,config,api}.{ts,js}"), {
90218
90223
  cwd: cwd,
@@ -90426,7 +90431,7 @@ function _loadEntitiesConfig() {
90426
90431
  }
90427
90432
 
90428
90433
  /**
90429
- * @returns {Promise<WorkflowsBuildConfig>}
90434
+ * @returns {Promise<import('@scout9/app').IWorkflowsConfiguration>}
90430
90435
  */
90431
90436
  function loadWorkflowsConfig() {
90432
90437
  return _loadWorkflowsConfig.apply(this, arguments);
@@ -90468,7 +90473,7 @@ function _loadWorkflowsConfig() {
90468
90473
  _ref2.path;
90469
90474
  var parents = _ref2.parents;
90470
90475
  // Validate project configuration
90471
- /** @type {WorkflowBuildConfig} */
90476
+ /** @type {import('@scout9/app').IWorkflowConfiguration} */
90472
90477
  var workflowConfig = {
90473
90478
  entity: parents[0],
90474
90479
  entities: parents.reverse()
@@ -90515,7 +90520,7 @@ function loadEnvConfig() {
90515
90520
  /**
90516
90521
  * @deprecated use "new ProjectFiles(...).load()" instead
90517
90522
  * @param {{cwd: string; src: string; logger?: ProgressLogger; deploying?: boolean; cb?: (message: string) => void}} - build options
90518
- * @returns {Promise<Scout9ProjectBuildConfig>}
90523
+ * @returns {Promise<import('@scout9/app').IScout9ProjectBuildConfig>}
90519
90524
  */
90520
90525
  function loadConfig() {
90521
90526
  return _loadConfig.apply(this, arguments);
@@ -90595,7 +90600,7 @@ function _loadConfig() {
90595
90600
  case 13:
90596
90601
  workflowsConfig = _context.sent;
90597
90602
  /**
90598
- * @type {Scout9ProjectBuildConfig}
90603
+ * @type {import('@scout9/app').IScout9ProjectBuildConfig}
90599
90604
  */
90600
90605
  projectConfig = spirits._objectSpread2(spirits._objectSpread2({}, baseProjectConfig), {}, {
90601
90606
  entities: entitiesConfig,
@@ -91100,7 +91105,7 @@ var Scout9Platform = {
91100
91105
  };
91101
91106
 
91102
91107
  /**
91103
- * @returns {import('@scout9/app').Agent}
91108
+ * @returns {import('@scout9/app').IAgent}
91104
91109
  */
91105
91110
  var createMockAgent = function createMockAgent() {
91106
91111
  var firstName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Carmela';
@@ -91113,7 +91118,7 @@ var createMockAgent = function createMockAgent() {
91113
91118
  };
91114
91119
 
91115
91120
  /**
91116
- * @returns {import('@scout9/app').Customer}
91121
+ * @returns {import('@scout9/app').ICustomer}
91117
91122
  */
91118
91123
  var createMockCustomer = function createMockCustomer() {
91119
91124
  var firstName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Tony';
@@ -91131,7 +91136,7 @@ var createMockCustomer = function createMockCustomer() {
91131
91136
  * @param content
91132
91137
  * @param role
91133
91138
  * @param time
91134
- * @returns {import('@scout9/app').Message}
91139
+ * @returns {import('@scout9/app').IMessage}
91135
91140
  */
91136
91141
  var createMockMessage = function createMockMessage(content) {
91137
91142
  var role = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'customer';
@@ -91147,7 +91152,7 @@ var createMockMessage = function createMockMessage(content) {
91147
91152
  };
91148
91153
 
91149
91154
  /**
91150
- * @returns {import('@scout9/app').Conversation}
91155
+ * @returns {import('@scout9/app').IConversation}
91151
91156
  */
91152
91157
  var createMockConversation = function createMockConversation() {
91153
91158
  var environment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'phone';
@@ -91162,8 +91167,8 @@ var createMockConversation = function createMockConversation() {
91162
91167
 
91163
91168
  /**
91164
91169
  * @param {string} message
91165
- * @param {string | import('@scout9/app').WorkflowEvent['intent'] | null} intent
91166
- * @returns {import('@scout9/app').WorkflowEvent}
91170
+ * @param {string | import('@scout9/app').IWorkflowEvent['intent'] | null} intent
91171
+ * @returns {import('@scout9/app').IWorkflowEvent}
91167
91172
  */
91168
91173
  var createMockWorkflowEvent = function createMockWorkflowEvent(message) {
91169
91174
  var intent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
@@ -91190,16 +91195,16 @@ var Scout9Test = /*#__PURE__*/function () {
91190
91195
  /**
91191
91196
  * Mimics a customer message to your app (useful for testing)
91192
91197
  * @param props - the Scout9Test properties
91193
- * @param {import('@scout9/app').Customer | undefined} [props.customer] - customer to use
91198
+ * @param {import('@scout9/app').ICustomer | undefined} [props.customer] - customer to use
91194
91199
  * @param {any | undefined} [props.context] - prior conversation context
91195
91200
  * @param {string | undefined} [props.persona] id to use
91196
- * @param {import('@scout9/app').Conversation | undefined} [props.conversation] - existing conversation
91201
+ * @param {import('@scout9/app').IConversation | undefined} [props.conversation] - existing conversation
91197
91202
  * @param {string | undefined} [props.cwd]
91198
91203
  * @param {string | undefined} [props.src]
91199
91204
  * @param {string | undefined} [props.mode]
91200
91205
  * @param {import('@scout9/admin').Scout9Api} [props.api]
91201
- * @param {import('@scout9/app').WorkflowFunction} [props.app]
91202
- * @param {import('scout9/app').Scout9ProjectBuildConfig} [props.project]
91206
+ * @param {import('@scout9/app').IWorkflowFunction} [props.app]
91207
+ * @param {import('scout9/app').IScout9ProjectBuildConfig} [props.project]
91203
91208
  */
91204
91209
  function Scout9Test() {
91205
91210
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
@@ -91223,19 +91228,19 @@ var Scout9Test = /*#__PURE__*/function () {
91223
91228
  project = _ref.project;
91224
91229
  spirits._classCallCheck(this, Scout9Test);
91225
91230
  /**
91226
- * @type {import('@scout9/app').Customer}
91231
+ * @type {import('@scout9/app').ICustomer}
91227
91232
  */
91228
91233
  spirits._defineProperty(this, "customer", void 0);
91229
91234
  /**
91230
- * @type {import('@scout9/app').Persona}
91235
+ * @type {import('@scout9/app').IPersona}
91231
91236
  */
91232
91237
  spirits._defineProperty(this, "persona", void 0);
91233
91238
  /**
91234
- * @type {import('@scout9/app').Conversation}
91239
+ * @type {import('@scout9/app').IConversation}
91235
91240
  */
91236
91241
  spirits._defineProperty(this, "conversation", void 0);
91237
91242
  /**
91238
- * @type {import('@scout9/app').Message[]}
91243
+ * @type {import('@scout9/app').IMessage[]}
91239
91244
  */
91240
91245
  spirits._defineProperty(this, "messages", void 0);
91241
91246
  /**
@@ -91244,12 +91249,12 @@ var Scout9Test = /*#__PURE__*/function () {
91244
91249
  spirits._defineProperty(this, "context", void 0);
91245
91250
  /**
91246
91251
  * @private
91247
- * @type {import('scout9/app').Scout9ProjectBuildConfig | null}
91252
+ * @type {import('scout9/app').IScout9ProjectBuildConfig | null}
91248
91253
  */
91249
91254
  spirits._defineProperty(this, "_project", null);
91250
91255
  /**
91251
91256
  * @private
91252
- * @type {import('@scout9/app').WorkflowFunction | null}
91257
+ * @type {import('@scout9/app').IWorkflowFunction | null}
91253
91258
  */
91254
91259
  spirits._defineProperty(this, "_app", null);
91255
91260
  /**
@@ -91598,8 +91603,8 @@ var Scout9Test = /*#__PURE__*/function () {
91598
91603
  /**
91599
91604
  * Runs your local app workflow
91600
91605
  * @param {string} message - the message to run through the workflow
91601
- * @param {Omit<Partial<import('@scout9/app').WorkflowEvent>, 'message'> | undefined} [event] - additional event data
91602
- * @returns {Promise<import('@scout9/app').WorkflowResponse>}
91606
+ * @param {Omit<Partial<import('@scout9/app').IWorkflowEvent>, 'message'> | undefined} [event] - additional event data
91607
+ * @returns {Promise<import('@scout9/app').IWorkflowResponse>}
91603
91608
  */
91604
91609
  )
91605
91610
  }, {
@@ -91638,7 +91643,7 @@ var Scout9Test = /*#__PURE__*/function () {
91638
91643
  * @param {Object} [input] - Generation input, defaults to test registered data such as existing messages, context, and persona information.
91639
91644
  * @param {string} [input.personaId] - Persona ID to use, defaults to test registered persona id.
91640
91645
  * @param {Partial<import('@scout9/admin').ConversationCreateRequest>} [input.conversation] - Conversation overrides, defaults to test registered conversation data.
91641
- * @param {import('@scout9/app').Message[]} [input.messages] - Message overrides, defaults to test registered message data.
91646
+ * @param {import('@scout9/app').IMessage[]} [input.messages] - Message overrides, defaults to test registered message data.
91642
91647
  * @param {any} [input.context] - Context overrides, defaults to test registered context data.
91643
91648
  * @returns {Promise<import('@scout9/admin').GenerateResponse>}
91644
91649
  */
package/dist/index.cjs CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var exports$1 = require("./exports-85e8c05c.cjs");
6
- var spirits = require("./spirits-643c422a.cjs");
5
+ var exports$1 = require("./exports-b2e88386.cjs");
6
+ var spirits = require("./spirits-1dc18cf4.cjs");
7
7
  require('node:readline');
8
8
  require('fs');
9
9
  require('events');
@@ -2,8 +2,8 @@
2
2
 
3
3
  require('node:fs');
4
4
  require('node:path');
5
- var exports$1 = require("./exports-85e8c05c.cjs");
6
- require("./spirits-643c422a.cjs");
5
+ var exports$1 = require("./exports-b2e88386.cjs");
6
+ require("./spirits-1dc18cf4.cjs");
7
7
  require('node:readline');
8
8
  require('fs');
9
9
  require('events');
@@ -566,35 +566,35 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
566
566
 
567
567
  /**
568
568
  * @typedef {Object} ConversationData
569
- * @property {import('@scout9/app').Scout9ProjectBuildConfig} config - used to define generation and extract persona metadata
570
- * @property {import('@scout9/app').Conversation} conversation
571
- * @property {Array<import('@scout9/app').Message>} messages
572
- * @property {import('@scout9/app').Message} message - the message sent by the customer (should exist in messages)
573
- * @property {import('@scout9/app').Customer} customer
569
+ * @property {import('@scout9/app').IScout9ProjectBuildConfig} config - used to define generation and extract persona metadata
570
+ * @property {import('@scout9/app').IConversation} conversation
571
+ * @property {Array<import('@scout9/app').IMessage>} messages
572
+ * @property {import('@scout9/app').IMessage} message - the message sent by the customer (should exist in messages)
573
+ * @property {import('@scout9/app').ICustomer} customer
574
574
  * @property {any} context
575
575
  */
576
576
 
577
577
  /**
578
578
  * @typedef {Object} ParseOutput
579
- * @property {Array<import('@scout9/app').Message>} messages
580
- * @property {import('@scout9/app').Conversation} conversation
581
- * @property {import('@scout9/app').Message} message
579
+ * @property {Array<import('@scout9/app').IMessage>} messages
580
+ * @property {import('@scout9/app').IConversation} conversation
581
+ * @property {import('@scout9/app').IMessage} message
582
582
  * @property {any} context
583
583
  */
584
584
 
585
585
  /**
586
586
  * @typedef {Object} WorkflowOutput
587
- * @property {Array<import('@scout9/app').WorkflowResponseSlot>} slots
588
- * @property {Array<import('@scout9/app').Message>} messages
589
- * @property {import('@scout9/app').Conversation} conversation
587
+ * @property {Array<import('@scout9/app').IWorkflowResponseSlot>} slots
588
+ * @property {Array<import('@scout9/app').IMessage>} messages
589
+ * @property {import('@scout9/app').IConversation} conversation
590
590
  * @property {any} context
591
591
  */
592
592
 
593
593
  /**
594
594
  * @typedef {Object} GenerateOutput
595
595
  * @property {import('@scout9/admin').GenerateResponse | undefined} generate
596
- * @property {Array<import('@scout9/app').Message>} messages
597
- * @property {import('@scout9/app').Conversation} conversation
596
+ * @property {Array<import('@scout9/app').IMessage>} messages
597
+ * @property {import('@scout9/app').IConversation} conversation
598
598
  * @property {any} context
599
599
  */
600
600
 
@@ -607,8 +607,8 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
607
607
 
608
608
  /**
609
609
  * @callback WorkflowFun
610
- * @param {import('@scout9/app').WorkflowEvent} event - conversation data
611
- * @returns {Promise<import('@scout9/app').WorkflowResponse>}
610
+ * @param {import('@scout9/app').IWorkflowEvent} event - conversation data
611
+ * @returns {Promise<import('@scout9/app').IWorkflowResponse>}
612
612
  */
613
613
 
614
614
  /**
@@ -619,7 +619,7 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
619
619
 
620
620
  /**
621
621
  * @callback IdGeneratorFun
622
- * @param {import('@scout9/app').Message.role} prefix
622
+ * @param {import('@scout9/app').IMessage.role} prefix
623
623
  * @returns {string}
624
624
  */
625
625
  /**
@@ -642,10 +642,10 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
642
642
 
643
643
  /**
644
644
  * @typedef {Object} ConversationEvent
645
- * @property {Change<import('@scout9/app').Conversation> & {forwardNote?: string; forward?: import('@scout9/app').WorkflowResponseSlot['forward']}} conversation
646
- * @property {Change<Array<import('@scout9/app').Message>>} messages
645
+ * @property {Change<import('@scout9/app').IConversation> & {forwardNote?: string; forward?: import('@scout9/app').WorkflowResponseSlot['forward']}} conversation
646
+ * @property {Change<Array<import('@scout9/app').IMessage>>} messages
647
647
  * @property {Change<Object>} context
648
- * @property {Change<import('@scout9/app').Message>} message
648
+ * @property {Change<import('@scout9/app').IMessage>} message
649
649
  */
650
650
  var Spirits = {
651
651
  /**
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-643c422a.cjs");
5
+ var spirits = require("./spirits-1dc18cf4.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 exports$1 = require("./exports-85e8c05c.cjs");
6
- var spirits = require("./spirits-643c422a.cjs");
5
+ var exports$1 = require("./exports-b2e88386.cjs");
6
+ var spirits = require("./spirits-1dc18cf4.cjs");
7
7
  require('node:readline');
8
8
  require('fs');
9
9
  require('events');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scout9/app",
3
- "version": "1.0.0-alpha.0.1.87",
3
+ "version": "1.0.0-alpha.0.1.88",
4
4
  "description": "Build and deploy your Scout9 app for SMS auto replies",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -31,12 +31,12 @@ async function loadEntityApiConfig(cwd, filePath) {
31
31
  }
32
32
 
33
33
  /**
34
- * @returns {Promise<EntitiesBuildConfig>}
34
+ * @returns {Promise<import('@scout9/app').IEntitiesRootProjectConfiguration>}
35
35
  */
36
36
  export default async function loadEntitiesConfig(
37
37
  {cwd = process.cwd(), src = 'src', logger, cb = (message) => {}} = {}
38
38
  ) {
39
- /** @type EntitiesBuildConfig */
39
+ /** @type import('@scout9/app').IEntitiesRootProjectConfiguration */
40
40
  const config = [];
41
41
  // const paths = globSync(path.resolve(cwd, `${src}/entities/**/{index,config,api}.{ts,js}`), {cwd, absolute: true});
42
42
  const filePaths = globSync(`${src}/entities/**/{index,config,api}.{ts,js}`, {cwd, absolute: true});
@@ -7,8 +7,6 @@ import loadProjectConfig from './project.js';
7
7
  import loadWorkflowsConfig from './workflow.js';
8
8
  import { Scout9ProjectBuildConfigSchema } from '../../runtime/index.js';
9
9
  import { ProgressLogger } from '../../utils/index.js';
10
- import ProjectFiles from '../../utils/project.js';
11
- import { logUserValidationError } from '../../report.js';
12
10
 
13
11
 
14
12
  export function loadEnvConfig({
@@ -36,7 +34,7 @@ export function loadEnvConfig({
36
34
  /**
37
35
  * @deprecated use "new ProjectFiles(...).load()" instead
38
36
  * @param {{cwd: string; src: string; logger?: ProgressLogger; deploying?: boolean; cb?: (message: string) => void}} - build options
39
- * @returns {Promise<Scout9ProjectBuildConfig>}
37
+ * @returns {Promise<import('@scout9/app').IScout9ProjectBuildConfig>}
40
38
  */
41
39
  export async function loadConfig({
42
40
  cwd = process.cwd(), src = 'src', dest = '/tmp/project', deploying = false, logger = new ProgressLogger(), cb = (msg) => {
@@ -51,7 +49,7 @@ export async function loadConfig({
51
49
  const workflowsConfig = await loadWorkflowsConfig({cwd, src, logger, deploying, cb});
52
50
 
53
51
  /**
54
- * @type {Scout9ProjectBuildConfig}
52
+ * @type {import('@scout9/app').IScout9ProjectBuildConfig}
55
53
  */
56
54
  const projectConfig = {
57
55
  ...baseProjectConfig,
@@ -35,7 +35,8 @@ async function writeImageToServer({img, type = 'icon', source}) {
35
35
 
36
36
 
37
37
  /**
38
- * Loads the users local package.json, if they provide a package-s9-test.json, it will load that instead (used for scout9 internal testing)
38
+ * Loads the users local package.json, if they provide a package-s9-test.json,
39
+ * it will load that instead (used for scout9 internal testing)
39
40
  * @param {cwd?: string}
40
41
  * @returns {Promise<{isTest: boolean, pkg: {name: string; version: string; dependencies: Record<string, string>}}>}
41
42
  */
@@ -54,7 +55,7 @@ export async function loadUserPackageJson({cwd = process.cwd()}) {
54
55
  }
55
56
 
56
57
  /**
57
- * @returns {Promise<Scout9ProjectConfig>}
58
+ * @returns {Promise<import('@scout9/app').IScout9ProjectConfig>}
58
59
  */
59
60
  export default async function loadProjectConfig({cwd = process.cwd(), deploying = false, src = 'src', cb = (message) => {}} = {}) {
60
61
  // Grab the project tag name (from their package.json)
@@ -1,13 +1,9 @@
1
1
  import { globSync } from 'glob';
2
- import path from 'node:path';
3
- import {
4
- WorkflowConfigurationSchema,
5
- WorkflowsConfigurationSchema
6
- } from '../../runtime/index.js';
2
+ import { WorkflowConfigurationSchema, WorkflowsConfigurationSchema } from '../../runtime/index.js';
7
3
 
8
4
 
9
5
  /**
10
- * @returns {Promise<WorkflowsBuildConfig>}
6
+ * @returns {Promise<import('@scout9/app').IWorkflowsConfiguration>}
11
7
  */
12
8
  export default async function loadWorkflowsConfig(
13
9
  {
@@ -34,7 +30,7 @@ export default async function loadWorkflowsConfig(
34
30
  .map(({path, parents}) => {
35
31
 
36
32
  // Validate project configuration
37
- /** @type {WorkflowBuildConfig} */
33
+ /** @type {import('@scout9/app').IWorkflowConfiguration} */
38
34
  const workflowConfig = {
39
35
  entity: parents[0],
40
36
  entities: parents.reverse(),
package/src/core/index.js CHANGED
@@ -98,7 +98,7 @@ async function downloadAndUnpackZip(outputDir) {
98
98
  * @param {string} cwd
99
99
  * @param {string} src
100
100
  * @param {string} dest
101
- * @param {import('../runtime/client/config.js').IScout9ProjectBuildConfig} config
101
+ * @param {import('@scout9/app').IScout9ProjectBuildConfig} config
102
102
  * @returns {Promise<void>}
103
103
  */
104
104
  async function buildApp(cwd, src, dest, config) {
@@ -435,7 +435,7 @@ export async function deploy(
435
435
  /**
436
436
  * Tests a local project to scout9 by running a dummy parse command with the project's local entities
437
437
  * @param {{cwd: string; src: string, dest: string}} - build options
438
- * @param {import('../runtime/client/config.js').IScout9ProjectBuildConfig} config
438
+ * @param {import('@scout9/app').IScout9ProjectBuildConfig} config
439
439
  */
440
440
  export async function test(
441
441
  {cwd = process.cwd(), src = './src', dest = '/tmp/project', logger = new ProgressLogger()},
@@ -467,8 +467,8 @@ export async function test(
467
467
  /**
468
468
  *
469
469
  * @param {{cwd: string; src: string; projectFiles: ProjectFiles; logger: ProgressLogger}} options
470
- * @param {import('../runtime/client/config.js').IScout9ProjectBuildConfig} config
471
- * @returns {Promise<{success: boolean; config: import('../runtime/client/config.js').IScout9ProjectBuildConfig}>}
470
+ * @param {import('@scout9/app').IScout9ProjectBuildConfig} config
471
+ * @returns {Promise<{success: boolean; config: import('@scout9/app').IScout9ProjectBuildConfig}>}
472
472
  */
473
473
  export async function sync({
474
474
  cwd = process.cwd(), src = 'src',
package/src/core/sync.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { platformApi } from './data.js';
2
2
 
3
3
  /**
4
- * @param {Scout9ProjectBuildConfig} config
5
- * @returns {Promise<Scout9ProjectBuildConfig>}
4
+ * @param {import('@scout9/app').IScout9ProjectBuildConfig} config
5
+ * @returns {Promise<import('@scout9/app').IScout9ProjectBuildConfig>}
6
6
  */
7
7
  export async function syncData(config) {
8
8
  if (!process.env.SCOUT9_API_KEY) {
@@ -1,9 +1,5 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import { globSync } from 'glob';
3
- import path from 'node:path';
4
- import fss from 'node:fs';
5
- import { checkVariableType, requireProjectFile } from '../../utils/index.js';
6
-
7
3
 
8
4
 
9
5
  const resolveFilePath = () => {
@@ -19,7 +15,7 @@ const resolveFilePath = () => {
19
15
  export const entities = {
20
16
  /**
21
17
  * Generates ./src/entities/
22
- * @param {Scout9ProjectBuildConfig} config
18
+ * @param {import('@scout9/app').IScout9ProjectBuildConfig} config
23
19
  * @param {string} cwd
24
20
  * @param {string} src
25
21
  * @returns {Promise<void>}
@@ -14,4 +14,5 @@ export const MessageSchema = z.object({
14
14
  context: z.any({description: 'The context generated from the message'}).optional(),
15
15
  intent: z.string({description: 'Detected intent'}).optional().nullable(),
16
16
  intentScore: z.number({description: 'Confidence score of the assigned intent'}).nullable().optional(),
17
+ delayInSeconds: z.number({description: 'How long to delay the message manually in seconds'}).nullable().optional()
17
18
  });