@scout9/app 1.0.0-alpha.0.1.87 → 1.0.0-alpha.0.1.89
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/{exports-85e8c05c.cjs → exports-e7d51b70.cjs} +43 -38
- package/dist/index.cjs +2 -2
- package/dist/{multipart-parser-1f8d78d0.cjs → multipart-parser-e09a67c9.cjs} +2 -2
- package/dist/{spirits-643c422a.cjs → spirits-3b603262.cjs} +19 -19
- package/dist/spirits.cjs +1 -1
- package/dist/testing-tools.cjs +2 -2
- package/package.json +2 -2
- package/src/core/config/entities.js +2 -2
- package/src/core/config/index.js +2 -4
- package/src/core/config/project.js +3 -2
- package/src/core/config/workflow.js +3 -7
- package/src/core/sync.js +2 -2
- package/src/core/templates/project-files.js +1 -5
- package/src/public.d.ts +1 -0
- package/src/runtime/client/config.js +1 -1
- package/src/runtime/client/message.js +1 -0
- package/src/testing-tools/dev.js +13 -13
- package/src/testing-tools/mocks.js +6 -6
- package/src/testing-tools/spirits.js +19 -19
- package/src/utils/project-templates.js +5 -4
- package/types/index.d.ts +6340 -3156
- package/types/index.d.ts.map +20 -20
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var spirits = require("./spirits-
|
|
3
|
+
var spirits = require("./spirits-3b603262.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-
|
|
41177
|
+
} = await Promise.resolve().then(function () { return require("./multipart-parser-e09a67c9.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').
|
|
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').
|
|
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').
|
|
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,
|
|
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<
|
|
81218
|
+
* @returns {Promise<import('../../runtime/client/config.js').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-
|
|
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-e7d51b70.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 {
|
|
81566
|
-
* @returns {Promise<
|
|
81567
|
+
* @param {import('../runtime/client/config.js').IScout9ProjectBuildConfig} config
|
|
81568
|
+
* @returns {Promise<import('../runtime/client/config.js').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-
|
|
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-e7d51b70.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-
|
|
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-e7d51b70.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-
|
|
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-e7d51b70.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);
|
|
@@ -90149,7 +90154,7 @@ function loadEntityApiConfig(_x, _x2) {
|
|
|
90149
90154
|
return _loadEntityApiConfig.apply(this, arguments);
|
|
90150
90155
|
}
|
|
90151
90156
|
/**
|
|
90152
|
-
* @returns {Promise<
|
|
90157
|
+
* @returns {Promise<import('../../runtime/client/config.js').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
|
|
90220
|
+
/** @type import('../../runtime/client/config.js').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<
|
|
90434
|
+
* @returns {Promise<import('../../runtime/client/workflow.js').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 {
|
|
90476
|
+
/** @type {import('../../runtime/client/workflow.js').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<
|
|
90523
|
+
* @returns {Promise<import('../../runtime/client/config.js').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 {
|
|
90603
|
+
* @type {import('../../runtime/client/config.js').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('
|
|
91108
|
+
* @returns {import('../runtime/client/users.js').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('
|
|
91121
|
+
* @returns {import('../runtime/client/users.js').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('
|
|
91139
|
+
* @returns {import('../runtime/client/message.js').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('
|
|
91155
|
+
* @returns {import('../runtime/client/workflow.js').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('
|
|
91166
|
-
* @returns {import('
|
|
91170
|
+
* @param {string | import('../runtime/client/workflow.js').IWorkflowEvent['intent'] | null} intent
|
|
91171
|
+
* @returns {import('../runtime/client/workflow.js').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('
|
|
91198
|
+
* @param {import('../runtime/client/users.js').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('
|
|
91201
|
+
* @param {import('../runtime/client/workflow.js').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('
|
|
91202
|
-
* @param {import('
|
|
91206
|
+
* @param {import('../runtime/client/workflow.js').IWorkflowFunction} [props.app]
|
|
91207
|
+
* @param {import('../runtime/client/config.js').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('
|
|
91231
|
+
* @type {import('../runtime/client/users.js').ICustomer}
|
|
91227
91232
|
*/
|
|
91228
91233
|
spirits._defineProperty(this, "customer", void 0);
|
|
91229
91234
|
/**
|
|
91230
|
-
* @type {import('
|
|
91235
|
+
* @type {import('../runtime/client/users.js').IPersona}
|
|
91231
91236
|
*/
|
|
91232
91237
|
spirits._defineProperty(this, "persona", void 0);
|
|
91233
91238
|
/**
|
|
91234
|
-
* @type {import('
|
|
91239
|
+
* @type {import('../runtime/client/workflow.js').IConversation}
|
|
91235
91240
|
*/
|
|
91236
91241
|
spirits._defineProperty(this, "conversation", void 0);
|
|
91237
91242
|
/**
|
|
91238
|
-
* @type {import('
|
|
91243
|
+
* @type {import('../runtime/client/message.js').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('
|
|
91252
|
+
* @type {import('../runtime/client/config.js').IScout9ProjectBuildConfig | null}
|
|
91248
91253
|
*/
|
|
91249
91254
|
spirits._defineProperty(this, "_project", null);
|
|
91250
91255
|
/**
|
|
91251
91256
|
* @private
|
|
91252
|
-
* @type {import('
|
|
91257
|
+
* @type {import('../runtime/client/workflow.js').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('
|
|
91602
|
-
* @returns {Promise<import('
|
|
91606
|
+
* @param {Omit<Partial<import('../runtime/client/workflow.js').IWorkflowEvent>, 'message'> | undefined} [event] - additional event data
|
|
91607
|
+
* @returns {Promise<import('../runtime/client/workflow.js').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('
|
|
91646
|
+
* @param {import('../runtime/client/message.js').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-
|
|
6
|
-
var spirits = require("./spirits-
|
|
5
|
+
var exports$1 = require("./exports-e7d51b70.cjs");
|
|
6
|
+
var spirits = require("./spirits-3b603262.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-
|
|
6
|
-
require("./spirits-
|
|
5
|
+
var exports$1 = require("./exports-e7d51b70.cjs");
|
|
6
|
+
require("./spirits-3b603262.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('
|
|
570
|
-
* @property {import('
|
|
571
|
-
* @property {Array<import('
|
|
572
|
-
* @property {import('
|
|
573
|
-
* @property {import('
|
|
569
|
+
* @property {import('../runtime/client/config.js').IScout9ProjectBuildConfig} config - used to define generation and extract persona metadata
|
|
570
|
+
* @property {import('../runtime/client/workflow.js').IConversation} conversation
|
|
571
|
+
* @property {Array<import('../runtime/client/message.js').IMessage>} messages
|
|
572
|
+
* @property {import('../runtime/client/message.js').IMessage} message - the message sent by the customer (should exist in messages)
|
|
573
|
+
* @property {import('../runtime/client/users.js').ICustomer} customer
|
|
574
574
|
* @property {any} context
|
|
575
575
|
*/
|
|
576
576
|
|
|
577
577
|
/**
|
|
578
578
|
* @typedef {Object} ParseOutput
|
|
579
|
-
* @property {Array<import('
|
|
580
|
-
* @property {import('
|
|
581
|
-
* @property {import('
|
|
579
|
+
* @property {Array<import('../runtime/client/message.js').IMessage>} messages
|
|
580
|
+
* @property {import('../runtime/client/workflow.js').IConversation} conversation
|
|
581
|
+
* @property {import('../runtime/client/message.js').IMessage} message
|
|
582
582
|
* @property {any} context
|
|
583
583
|
*/
|
|
584
584
|
|
|
585
585
|
/**
|
|
586
586
|
* @typedef {Object} WorkflowOutput
|
|
587
|
-
* @property {Array<import('
|
|
588
|
-
* @property {Array<import('
|
|
589
|
-
* @property {import('
|
|
587
|
+
* @property {Array<import('../runtime/client/workflow.js').IWorkflowResponseSlot>} slots
|
|
588
|
+
* @property {Array<import('../runtime/client/message.js').IMessage>} messages
|
|
589
|
+
* @property {import('../runtime/client/workflow.js').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('
|
|
597
|
-
* @property {import('
|
|
596
|
+
* @property {Array<import('../runtime/client/message.js').IMessage>} messages
|
|
597
|
+
* @property {import('../runtime/client/workflow.js').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('
|
|
611
|
-
* @returns {Promise<import('
|
|
610
|
+
* @param {import('../runtime/client/workflow.js').IWorkflowEvent} event - conversation data
|
|
611
|
+
* @returns {Promise<import('../runtime/client/workflow.js').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('
|
|
622
|
+
* @param {import('../runtime/client/message.js').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('
|
|
646
|
-
* @property {Change<Array<import('
|
|
645
|
+
* @property {Change<import('../runtime/client/workflow.js').IConversation> & {forwardNote?: string; forward?: import('../runtime/client/message.js').IWorkflowResponseSlot['forward']}} conversation
|
|
646
|
+
* @property {Change<Array<import('../runtime/client/message.js').IMessage>>} messages
|
|
647
647
|
* @property {Change<Object>} context
|
|
648
|
-
* @property {Change<import('
|
|
648
|
+
* @property {Change<import('../runtime/client/message.js').IMessage>} message
|
|
649
649
|
*/
|
|
650
650
|
var Spirits = {
|
|
651
651
|
/**
|
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 exports$1 = require("./exports-
|
|
6
|
-
var spirits = require("./spirits-
|
|
5
|
+
var exports$1 = require("./exports-e7d51b70.cjs");
|
|
6
|
+
var spirits = require("./spirits-3b603262.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.
|
|
3
|
+
"version": "1.0.0-alpha.0.1.89",
|
|
4
4
|
"description": "Build and deploy your Scout9 app for SMS auto replies",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"generate:types": "node scripts/generate-dts.js",
|
|
17
17
|
"prebuild": "rimraf dist/",
|
|
18
18
|
"build": "rollup -c",
|
|
19
|
-
"postbuild": "npm run generate:types && node scripts/post-build.js"
|
|
19
|
+
"postbuild": "npm run generate:types && node scripts/post-build.js && npx tsc --noEmit"
|
|
20
20
|
},
|
|
21
21
|
"type": "module",
|
|
22
22
|
"bin": {
|
|
@@ -31,12 +31,12 @@ async function loadEntityApiConfig(cwd, filePath) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* @returns {Promise<
|
|
34
|
+
* @returns {Promise<import('../../runtime/client/config.js').IEntitiesRootProjectConfiguration>}
|
|
35
35
|
*/
|
|
36
36
|
export default async function loadEntitiesConfig(
|
|
37
37
|
{cwd = process.cwd(), src = 'src', logger, cb = (message) => {}} = {}
|
|
38
38
|
) {
|
|
39
|
-
/** @type
|
|
39
|
+
/** @type import('../../runtime/client/config.js').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});
|
package/src/core/config/index.js
CHANGED
|
@@ -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<
|
|
37
|
+
* @returns {Promise<import('../../runtime/client/config.js').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 {
|
|
52
|
+
* @type {import('../../runtime/client/config.js').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,
|
|
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<
|
|
58
|
+
* @returns {Promise<import('../../runtime/client/config.js').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
|
|
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<
|
|
6
|
+
* @returns {Promise<import('../../runtime/client/workflow.js').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 {
|
|
33
|
+
/** @type {import('../../runtime/client/workflow.js').IWorkflowConfiguration} */
|
|
38
34
|
const workflowConfig = {
|
|
39
35
|
entity: parents[0],
|
|
40
36
|
entities: parents.reverse(),
|
package/src/core/sync.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { platformApi } from './data.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @param {
|
|
5
|
-
* @returns {Promise<
|
|
4
|
+
* @param {import('../runtime/client/config.js').IScout9ProjectBuildConfig} config
|
|
5
|
+
* @returns {Promise<import('../runtime/client/config.js').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 {
|
|
18
|
+
* @param {import('../../runtime/client/config.js').IScout9ProjectBuildConfig} config
|
|
23
19
|
* @param {string} cwd
|
|
24
20
|
* @param {string} src
|
|
25
21
|
* @returns {Promise<void>}
|
package/src/public.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { agentsBaseConfigurationSchema } from './users.js';
|
|
3
3
|
import { entitiesRootProjectConfigurationSchema } from './entity.js';
|
|
4
4
|
import { WorkflowsConfigurationSchema } from './workflow.js';
|
|
5
5
|
|
|
@@ -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
|
});
|