@scout9/app 1.0.0-alpha.0.5.3 → 1.0.0-alpha.0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{dev-be9ba80f.cjs → dev-7e3c6095.cjs} +99 -57
- package/dist/{index-11e312c6.cjs → index-4dfed9d3.cjs} +54 -44
- package/dist/index.cjs +3 -3
- package/dist/{macros-57f9b28b.cjs → macros-c8392690.cjs} +6 -2
- package/dist/{multipart-parser-8a217889.cjs → multipart-parser-65dc2a0b.cjs} +3 -3
- package/dist/schemas.cjs +1 -1
- package/dist/testing-tools.cjs +2 -2
- package/package.json +1 -1
- package/src/core/config/agents.js +2 -3
- package/src/core/config/commands.js +38 -28
- package/src/core/config/entities.js +17 -9
- package/src/core/config/index.js +3 -2
- package/src/core/config/workflow.js +11 -5
- package/src/core/index.js +2 -3
- package/src/report.js +8 -2
- package/src/runtime/schemas/conversation.js +41 -36
- package/src/testing-tools/dev.js +370 -364
- package/src/utils/configs/agents.js +2 -1
- package/src/utils/configs/entities.js +14 -4
- package/src/utils/configs/workflow.js +42 -35
- package/src/utils/project.js +2 -1
- package/types/index.d.ts +79 -2
- package/types/index.d.ts.map +1 -1
|
@@ -21,9 +21,9 @@ 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-c8392690.cjs");
|
|
24
25
|
var readline = require('node:readline');
|
|
25
26
|
var process$2 = require('node:process');
|
|
26
|
-
var macros = require("./macros-57f9b28b.cjs");
|
|
27
27
|
var node_os = require('node:os');
|
|
28
28
|
var promises = require('fs/promises');
|
|
29
29
|
|
|
@@ -35164,7 +35164,7 @@ function _loadUserPackageJson() {
|
|
|
35164
35164
|
targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
|
|
35165
35165
|
_context2.t0 = JSON;
|
|
35166
35166
|
_context2.next = 10;
|
|
35167
|
-
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-
|
|
35167
|
+
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-7e3c6095.js', document.baseURI).href))), 'utf-8');
|
|
35168
35168
|
case 10:
|
|
35169
35169
|
_context2.t1 = _context2.sent;
|
|
35170
35170
|
pkg = _context2.t0.parse.call(_context2.t0, _context2.t1);
|
|
@@ -36514,9 +36514,10 @@ const bgWhite = init(47, 49);
|
|
|
36514
36514
|
*
|
|
36515
36515
|
* @param {import('zod').ZodError} zodError
|
|
36516
36516
|
* @param {string} source
|
|
36517
|
+
* @returns {import('zod-validation-error').ValidationError}
|
|
36517
36518
|
*/
|
|
36518
36519
|
function logUserValidationError(zodError, source) {
|
|
36519
|
-
var issues = zodError.issues || [];
|
|
36520
|
+
var issues = (zodError === null || zodError === void 0 ? void 0 : zodError.issues) || [];
|
|
36520
36521
|
console.log(red("Scout9 Schema Validation Error at ".concat(bold(source), ", fix these issues and rerun")));
|
|
36521
36522
|
var _iterator = spirits._createForOfIteratorHelper(issues),
|
|
36522
36523
|
_step;
|
|
@@ -36550,6 +36551,9 @@ function logUserValidationError(zodError, source) {
|
|
|
36550
36551
|
} finally {
|
|
36551
36552
|
_iterator.f();
|
|
36552
36553
|
}
|
|
36554
|
+
var simplifiedError = simplifyError(zodError);
|
|
36555
|
+
console.error("\n".concat(red(simplifiedError.message), "\n"));
|
|
36556
|
+
return simplifiedError;
|
|
36553
36557
|
}
|
|
36554
36558
|
|
|
36555
36559
|
/**
|
|
@@ -37413,22 +37417,21 @@ function _loadAgentConfig() {
|
|
|
37413
37417
|
case 39:
|
|
37414
37418
|
result = (deploying ? macros.AgentsConfigurationSchema : macros.AgentsSchema).safeParse(agents);
|
|
37415
37419
|
if (result.success) {
|
|
37416
|
-
_context6.next =
|
|
37420
|
+
_context6.next = 42;
|
|
37417
37421
|
break;
|
|
37418
37422
|
}
|
|
37419
|
-
result.error
|
|
37420
|
-
|
|
37421
|
-
case 43:
|
|
37423
|
+
throw simplifyError(result.error);
|
|
37424
|
+
case 42:
|
|
37422
37425
|
if (!serverDeployed) {
|
|
37423
|
-
_context6.next =
|
|
37426
|
+
_context6.next = 46;
|
|
37424
37427
|
break;
|
|
37425
37428
|
}
|
|
37426
37429
|
cb("Syncing ".concat(sourceFile, " with latest server changes"));
|
|
37427
|
-
_context6.next =
|
|
37430
|
+
_context6.next = 46;
|
|
37428
37431
|
return fs__default["default"].writeFile(sourceFile, projectTemplates.entities.agents(agents, path__default["default"].extname(sourceFile)));
|
|
37429
|
-
case
|
|
37432
|
+
case 46:
|
|
37430
37433
|
return _context6.abrupt("return", agents);
|
|
37431
|
-
case
|
|
37434
|
+
case 47:
|
|
37432
37435
|
case "end":
|
|
37433
37436
|
return _context6.stop();
|
|
37434
37437
|
}
|
|
@@ -37457,7 +37460,7 @@ function _loadEntityApiConfig() {
|
|
|
37457
37460
|
case 5:
|
|
37458
37461
|
mod = _context.sent;
|
|
37459
37462
|
if (!mod) {
|
|
37460
|
-
_context.next =
|
|
37463
|
+
_context.next = 19;
|
|
37461
37464
|
break;
|
|
37462
37465
|
}
|
|
37463
37466
|
config = {};
|
|
@@ -37467,15 +37470,22 @@ function _loadEntityApiConfig() {
|
|
|
37467
37470
|
config[key] = true;
|
|
37468
37471
|
}
|
|
37469
37472
|
}
|
|
37470
|
-
|
|
37471
|
-
return _context.abrupt("return", config);
|
|
37473
|
+
_context.prev = 10;
|
|
37474
|
+
return _context.abrupt("return", macros.EntityApiConfigurationSchema.parse(config));
|
|
37472
37475
|
case 14:
|
|
37476
|
+
_context.prev = 14;
|
|
37477
|
+
_context.t0 = _context["catch"](10);
|
|
37478
|
+
throw simplifyError(config);
|
|
37479
|
+
case 17:
|
|
37480
|
+
_context.next = 20;
|
|
37481
|
+
break;
|
|
37482
|
+
case 19:
|
|
37473
37483
|
return _context.abrupt("return", null);
|
|
37474
|
-
case
|
|
37484
|
+
case 20:
|
|
37475
37485
|
case "end":
|
|
37476
37486
|
return _context.stop();
|
|
37477
37487
|
}
|
|
37478
|
-
}, _callee);
|
|
37488
|
+
}, _callee, null, [[10, 14]]);
|
|
37479
37489
|
}));
|
|
37480
37490
|
return _loadEntityApiConfig.apply(this, arguments);
|
|
37481
37491
|
}
|
|
@@ -37589,7 +37599,7 @@ function _loadEntitiesConfig() {
|
|
|
37589
37599
|
return parents.includes(se);
|
|
37590
37600
|
});
|
|
37591
37601
|
if (!((fileName === 'index' || fileName === 'config') && !isSpecial)) {
|
|
37592
|
-
_context2.next =
|
|
37602
|
+
_context2.next = 26;
|
|
37593
37603
|
break;
|
|
37594
37604
|
}
|
|
37595
37605
|
_context2.next = 9;
|
|
@@ -37620,56 +37630,63 @@ function _loadEntitiesConfig() {
|
|
|
37620
37630
|
path: ['entities', config.length]
|
|
37621
37631
|
});
|
|
37622
37632
|
if (result.success) {
|
|
37623
|
-
_context2.next =
|
|
37633
|
+
_context2.next = 24;
|
|
37624
37634
|
break;
|
|
37625
37635
|
}
|
|
37626
|
-
logUserValidationError(result.error, filePath);
|
|
37627
|
-
|
|
37628
|
-
|
|
37629
|
-
_context2.next = 29;
|
|
37636
|
+
throw logUserValidationError(result.error, filePath);
|
|
37637
|
+
case 24:
|
|
37638
|
+
_context2.next = 28;
|
|
37630
37639
|
break;
|
|
37631
|
-
case
|
|
37640
|
+
case 26:
|
|
37632
37641
|
if (!(isSpecial && (fileName === 'index' || fileName === 'config'))) {
|
|
37633
|
-
_context2.next =
|
|
37642
|
+
_context2.next = 28;
|
|
37634
37643
|
break;
|
|
37635
37644
|
}
|
|
37636
37645
|
return _context2.abrupt("return", 1);
|
|
37637
|
-
case
|
|
37646
|
+
case 28:
|
|
37638
37647
|
// Validate project configuration
|
|
37639
37648
|
entityProjectConfig = spirits._objectSpread2(spirits._objectSpread2({}, entityConfig), {}, {
|
|
37640
37649
|
entity: parents[0],
|
|
37641
37650
|
entities: parents.reverse(),
|
|
37642
37651
|
api: api
|
|
37643
37652
|
});
|
|
37653
|
+
_context2.prev = 29;
|
|
37644
37654
|
macros.EntityRootProjectConfigurationSchema.parse(entityProjectConfig);
|
|
37655
|
+
_context2.next = 36;
|
|
37656
|
+
break;
|
|
37657
|
+
case 33:
|
|
37658
|
+
_context2.prev = 33;
|
|
37659
|
+
_context2.t1 = _context2["catch"](29);
|
|
37660
|
+
throw simplifyError(_context2.t1);
|
|
37661
|
+
case 36:
|
|
37645
37662
|
existingIndex = config.findIndex(function (c) {
|
|
37646
37663
|
return c.entity === entityProjectConfig.entity;
|
|
37647
37664
|
});
|
|
37648
37665
|
if (!(existingIndex > -1)) {
|
|
37649
|
-
_context2.next =
|
|
37666
|
+
_context2.next = 43;
|
|
37650
37667
|
break;
|
|
37651
37668
|
}
|
|
37652
37669
|
if (!(config[existingIndex].entities.length !== entityProjectConfig.entities.length)) {
|
|
37653
|
-
_context2.next =
|
|
37670
|
+
_context2.next = 40;
|
|
37654
37671
|
break;
|
|
37655
37672
|
}
|
|
37656
37673
|
throw new Error("Invalid entity configuration at \"".concat(filePath, "\", entity name mismatch"));
|
|
37657
|
-
case
|
|
37674
|
+
case 40:
|
|
37658
37675
|
config[existingIndex] = spirits._objectSpread2(spirits._objectSpread2({}, config[existingIndex]), {}, {
|
|
37659
37676
|
definitions: [].concat(spirits._toConsumableArray(config[existingIndex].definitions), spirits._toConsumableArray(entityProjectConfig.definitions || [])),
|
|
37660
37677
|
training: [].concat(spirits._toConsumableArray(config[existingIndex].training), spirits._toConsumableArray(entityProjectConfig.training || [])),
|
|
37661
37678
|
tests: [].concat(spirits._toConsumableArray(config[existingIndex].tests), spirits._toConsumableArray(entityProjectConfig.tests || [])),
|
|
37662
37679
|
api: !config[existingIndex].api && !entityProjectConfig.api ? null : spirits._objectSpread2(spirits._objectSpread2({}, config[existingIndex].api || {}), entityProjectConfig.api || {})
|
|
37663
37680
|
});
|
|
37664
|
-
_context2.next =
|
|
37681
|
+
_context2.next = 44;
|
|
37665
37682
|
break;
|
|
37666
|
-
case
|
|
37683
|
+
case 43:
|
|
37667
37684
|
config.push(entityProjectConfig);
|
|
37668
|
-
case
|
|
37685
|
+
case 44:
|
|
37669
37686
|
case "end":
|
|
37670
37687
|
return _context2.stop();
|
|
37671
37688
|
}
|
|
37672
|
-
}, _loop);
|
|
37689
|
+
}, _loop, null, [[29, 33]]);
|
|
37673
37690
|
});
|
|
37674
37691
|
_i = 0, _data = data;
|
|
37675
37692
|
case 23:
|
|
@@ -37705,14 +37722,17 @@ function _loadEntitiesConfig() {
|
|
|
37705
37722
|
}
|
|
37706
37723
|
throw new Error("Missing required entity: \"entities/customers/[customer]\"");
|
|
37707
37724
|
case 34:
|
|
37708
|
-
|
|
37709
|
-
macros.EntitiesRootProjectConfigurationSchema.parse(config);
|
|
37710
|
-
|
|
37711
|
-
|
|
37725
|
+
_context4.prev = 34;
|
|
37726
|
+
return _context4.abrupt("return", macros.EntitiesRootProjectConfigurationSchema.parse(config));
|
|
37727
|
+
case 38:
|
|
37728
|
+
_context4.prev = 38;
|
|
37729
|
+
_context4.t3 = _context4["catch"](34);
|
|
37730
|
+
throw simplifyError(_context4.t3);
|
|
37731
|
+
case 41:
|
|
37712
37732
|
case "end":
|
|
37713
37733
|
return _context4.stop();
|
|
37714
37734
|
}
|
|
37715
|
-
}, _callee2, null, [[5, 14, 17, 20]]);
|
|
37735
|
+
}, _callee2, null, [[5, 14, 17, 20], [34, 38]]);
|
|
37716
37736
|
}));
|
|
37717
37737
|
return _loadEntitiesConfig.apply(this, arguments);
|
|
37718
37738
|
}
|
|
@@ -37757,24 +37777,31 @@ function _loadWorkflowsConfig() {
|
|
|
37757
37777
|
console.log("WARNING: \"".concat(path, "\" Is not a valid entity path, must be contained in a named src under workflows/"));
|
|
37758
37778
|
}
|
|
37759
37779
|
}).map(function (_ref2) {
|
|
37760
|
-
_ref2.path
|
|
37761
|
-
|
|
37780
|
+
var path = _ref2.path,
|
|
37781
|
+
parents = _ref2.parents;
|
|
37762
37782
|
// Validate project configuration
|
|
37763
37783
|
/** @type {WorkflowConfiguration} */
|
|
37764
37784
|
var workflowConfig = {
|
|
37765
37785
|
entity: parents[0],
|
|
37766
37786
|
entities: parents.reverse()
|
|
37767
37787
|
};
|
|
37768
|
-
|
|
37769
|
-
|
|
37788
|
+
try {
|
|
37789
|
+
return macros.WorkflowConfigurationSchema.parse(workflowConfig);
|
|
37790
|
+
} catch (e) {
|
|
37791
|
+
throw logUserValidationError(e, path);
|
|
37792
|
+
}
|
|
37770
37793
|
}); // Validate the config
|
|
37771
|
-
|
|
37772
|
-
return _context.abrupt("return", config);
|
|
37773
|
-
case
|
|
37794
|
+
_context.prev = 2;
|
|
37795
|
+
return _context.abrupt("return", macros.WorkflowsConfigurationSchema.parse(config));
|
|
37796
|
+
case 6:
|
|
37797
|
+
_context.prev = 6;
|
|
37798
|
+
_context.t0 = _context["catch"](2);
|
|
37799
|
+
throw logUserValidationError(_context.t0, src);
|
|
37800
|
+
case 9:
|
|
37774
37801
|
case "end":
|
|
37775
37802
|
return _context.stop();
|
|
37776
37803
|
}
|
|
37777
|
-
}, _callee);
|
|
37804
|
+
}, _callee, null, [[2, 6]]);
|
|
37778
37805
|
}));
|
|
37779
37806
|
return _loadWorkflowsConfig.apply(this, arguments);
|
|
37780
37807
|
}
|
|
@@ -37809,23 +37836,31 @@ function _loadCommandsConfig() {
|
|
|
37809
37836
|
throw new Error("Invalid command path \"".concat(path, "\""));
|
|
37810
37837
|
}
|
|
37811
37838
|
switch (entity) {
|
|
37812
|
-
case
|
|
37813
|
-
case
|
|
37839
|
+
case 'index':
|
|
37840
|
+
case 'command':
|
|
37814
37841
|
entity = path$2.basename(dir);
|
|
37815
37842
|
break;
|
|
37816
37843
|
}
|
|
37817
|
-
|
|
37818
|
-
|
|
37819
|
-
|
|
37820
|
-
|
|
37844
|
+
try {
|
|
37845
|
+
return macros.CommandSchema.parse({
|
|
37846
|
+
entity: entity,
|
|
37847
|
+
path: path.split(src + '/commands/')[1]
|
|
37848
|
+
});
|
|
37849
|
+
} catch (e) {
|
|
37850
|
+
throw logUserValidationError(e, path);
|
|
37851
|
+
}
|
|
37821
37852
|
}); // Validate the config
|
|
37822
|
-
|
|
37823
|
-
return _context.abrupt("return", config);
|
|
37824
|
-
case
|
|
37853
|
+
_context.prev = 2;
|
|
37854
|
+
return _context.abrupt("return", macros.CommandsSchema.parse(config));
|
|
37855
|
+
case 6:
|
|
37856
|
+
_context.prev = 6;
|
|
37857
|
+
_context.t0 = _context["catch"](2);
|
|
37858
|
+
throw simplifyError(_context.t0);
|
|
37859
|
+
case 9:
|
|
37825
37860
|
case "end":
|
|
37826
37861
|
return _context.stop();
|
|
37827
37862
|
}
|
|
37828
|
-
}, _callee);
|
|
37863
|
+
}, _callee, null, [[2, 6]]);
|
|
37829
37864
|
}));
|
|
37830
37865
|
return _loadCommandsConfig.apply(this, arguments);
|
|
37831
37866
|
}
|
|
@@ -37963,7 +37998,7 @@ function _loadConfig() {
|
|
|
37963
37998
|
break;
|
|
37964
37999
|
}
|
|
37965
38000
|
result.error.source = "".concat(src, "/index.js");
|
|
37966
|
-
throw result.error;
|
|
38001
|
+
throw logUserValidationError(result.error, "".concat(src, "/index.js"));
|
|
37967
38002
|
case 22:
|
|
37968
38003
|
return _context.abrupt("return", projectConfig);
|
|
37969
38004
|
case 23:
|
|
@@ -42986,7 +43021,13 @@ var Scout9Test = /*#__PURE__*/function () {
|
|
|
42986
43021
|
} else {
|
|
42987
43022
|
return response;
|
|
42988
43023
|
}
|
|
42989
|
-
}).then(
|
|
43024
|
+
}).then(function (event) {
|
|
43025
|
+
try {
|
|
43026
|
+
return macros.WorkflowResponseSchema.parse(event);
|
|
43027
|
+
} catch (e) {
|
|
43028
|
+
throw simplifyError(e, 'PMT runtime error');
|
|
43029
|
+
}
|
|
43030
|
+
}));
|
|
42990
43031
|
case 2:
|
|
42991
43032
|
case "end":
|
|
42992
43033
|
return _context3.stop();
|
|
@@ -43330,3 +43371,4 @@ exports.reply = reply;
|
|
|
43330
43371
|
exports.report = report;
|
|
43331
43372
|
exports.requireOptionalProjectFile = requireOptionalProjectFile;
|
|
43332
43373
|
exports.requireProjectFile = requireProjectFile;
|
|
43374
|
+
exports.simplifyError = simplifyError;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var spirits = require("./spirits-2ab4d673.cjs");
|
|
4
|
-
var dev = require("./dev-
|
|
5
|
-
var macros = require("./macros-
|
|
4
|
+
var dev = require("./dev-7e3c6095.cjs");
|
|
5
|
+
var macros = require("./macros-c8392690.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-
|
|
29486
|
+
} = await Promise.resolve().then(function () { return require("./multipart-parser-65dc2a0b.cjs"); });
|
|
29487
29487
|
return toFormData(this.body, ct);
|
|
29488
29488
|
}
|
|
29489
29489
|
|
|
@@ -41884,7 +41884,7 @@ function _loadUserPackageJson() {
|
|
|
41884
41884
|
targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
|
|
41885
41885
|
_context.t0 = JSON;
|
|
41886
41886
|
_context.next = 10;
|
|
41887
|
-
return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-
|
|
41887
|
+
return fs__default["default"].readFile(new URL(targetPkgUrl, (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index-4dfed9d3.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);
|
|
@@ -42357,7 +42357,7 @@ function _loadEntitiesConfig() {
|
|
|
42357
42357
|
break;
|
|
42358
42358
|
}
|
|
42359
42359
|
result.error.source = filePath;
|
|
42360
|
-
throw result.error;
|
|
42360
|
+
throw dev.logUserValidationError(result.error, filePath);
|
|
42361
42361
|
case 25:
|
|
42362
42362
|
_context2.next = 29;
|
|
42363
42363
|
break;
|
|
@@ -42374,35 +42374,43 @@ function _loadEntitiesConfig() {
|
|
|
42374
42374
|
entities: parents.reverse(),
|
|
42375
42375
|
api: api
|
|
42376
42376
|
});
|
|
42377
|
+
_context2.prev = 30;
|
|
42377
42378
|
macros.EntityRootProjectConfigurationSchema.parse(entityProjectConfig);
|
|
42379
|
+
_context2.next = 37;
|
|
42380
|
+
break;
|
|
42381
|
+
case 34:
|
|
42382
|
+
_context2.prev = 34;
|
|
42383
|
+
_context2.t1 = _context2["catch"](30);
|
|
42384
|
+
throw dev.simplifyError(_context2.t1);
|
|
42385
|
+
case 37:
|
|
42378
42386
|
existingIndex = config.findIndex(function (c) {
|
|
42379
42387
|
return c.entity === entityProjectConfig.entity;
|
|
42380
42388
|
});
|
|
42381
42389
|
if (!(existingIndex > -1)) {
|
|
42382
|
-
_context2.next =
|
|
42390
|
+
_context2.next = 44;
|
|
42383
42391
|
break;
|
|
42384
42392
|
}
|
|
42385
42393
|
if (!(config[existingIndex].entities.length !== entityProjectConfig.entities.length)) {
|
|
42386
|
-
_context2.next =
|
|
42394
|
+
_context2.next = 41;
|
|
42387
42395
|
break;
|
|
42388
42396
|
}
|
|
42389
42397
|
throw new Error("Invalid entity configuration at \"".concat(filePath, "\", entity name mismatch"));
|
|
42390
|
-
case
|
|
42398
|
+
case 41:
|
|
42391
42399
|
config[existingIndex] = spirits._objectSpread2(spirits._objectSpread2({}, config[existingIndex]), {}, {
|
|
42392
42400
|
definitions: [].concat(spirits._toConsumableArray(config[existingIndex].definitions), spirits._toConsumableArray(entityProjectConfig.definitions || [])),
|
|
42393
42401
|
training: [].concat(spirits._toConsumableArray(config[existingIndex].training), spirits._toConsumableArray(entityProjectConfig.training || [])),
|
|
42394
42402
|
tests: [].concat(spirits._toConsumableArray(config[existingIndex].tests), spirits._toConsumableArray(entityProjectConfig.tests || [])),
|
|
42395
42403
|
api: !config[existingIndex].api && !entityProjectConfig.api ? null : spirits._objectSpread2(spirits._objectSpread2({}, config[existingIndex].api || {}), entityProjectConfig.api || {})
|
|
42396
42404
|
});
|
|
42397
|
-
_context2.next =
|
|
42405
|
+
_context2.next = 45;
|
|
42398
42406
|
break;
|
|
42399
|
-
case
|
|
42407
|
+
case 44:
|
|
42400
42408
|
config.push(entityProjectConfig);
|
|
42401
|
-
case
|
|
42409
|
+
case 45:
|
|
42402
42410
|
case "end":
|
|
42403
42411
|
return _context2.stop();
|
|
42404
42412
|
}
|
|
42405
|
-
}, _loop);
|
|
42413
|
+
}, _loop, null, [[30, 34]]);
|
|
42406
42414
|
});
|
|
42407
42415
|
_i = 0, _data = data;
|
|
42408
42416
|
case 23:
|
|
@@ -42422,27 +42430,23 @@ function _loadEntitiesConfig() {
|
|
|
42422
42430
|
_context4.next = 23;
|
|
42423
42431
|
break;
|
|
42424
42432
|
case 30:
|
|
42425
|
-
|
|
42426
|
-
|
|
42427
|
-
|
|
42428
|
-
|
|
42429
|
-
|
|
42430
|
-
|
|
42431
|
-
|
|
42432
|
-
// Validate the config
|
|
42433
|
-
macros.EntitiesRootProjectConfigurationSchema.parse(config);
|
|
42434
|
-
return _context4.abrupt("return", config);
|
|
42435
|
-
case 32:
|
|
42433
|
+
_context4.prev = 30;
|
|
42434
|
+
return _context4.abrupt("return", macros.EntitiesRootProjectConfigurationSchema.parse(config));
|
|
42435
|
+
case 34:
|
|
42436
|
+
_context4.prev = 34;
|
|
42437
|
+
_context4.t3 = _context4["catch"](30);
|
|
42438
|
+
throw dev.simplifyError(_context4.t3);
|
|
42439
|
+
case 37:
|
|
42436
42440
|
case "end":
|
|
42437
42441
|
return _context4.stop();
|
|
42438
42442
|
}
|
|
42439
|
-
}, _callee2, null, [[5, 14, 17, 20]]);
|
|
42443
|
+
}, _callee2, null, [[5, 14, 17, 20], [30, 34]]);
|
|
42440
42444
|
}));
|
|
42441
42445
|
return _loadEntitiesConfig.apply(this, arguments);
|
|
42442
42446
|
}
|
|
42443
42447
|
|
|
42444
42448
|
/**
|
|
42445
|
-
* @returns {Promise<
|
|
42449
|
+
* @returns {Promise<WorkflowsConfigurationSchema>}
|
|
42446
42450
|
*/
|
|
42447
42451
|
function loadWorkflowsConfig() {
|
|
42448
42452
|
return _loadWorkflowsConfig.apply(this, arguments);
|
|
@@ -42481,24 +42485,31 @@ function _loadWorkflowsConfig() {
|
|
|
42481
42485
|
console.log("WARNING: \"".concat(path, "\" Is not a valid entity path, must be contained in a named src under workflows/"));
|
|
42482
42486
|
}
|
|
42483
42487
|
}).map(function (_ref2) {
|
|
42484
|
-
_ref2.path
|
|
42485
|
-
|
|
42488
|
+
var path = _ref2.path,
|
|
42489
|
+
parents = _ref2.parents;
|
|
42486
42490
|
// Validate project configuration
|
|
42487
|
-
/** @type {
|
|
42491
|
+
/** @type {WorkflowConfigurationSchema} */
|
|
42488
42492
|
var workflowConfig = {
|
|
42489
42493
|
entity: parents[0],
|
|
42490
42494
|
entities: parents.reverse()
|
|
42491
42495
|
};
|
|
42492
|
-
|
|
42493
|
-
|
|
42496
|
+
try {
|
|
42497
|
+
return macros.WorkflowConfigurationSchema.parse(workflowConfig);
|
|
42498
|
+
} catch (e) {
|
|
42499
|
+
throw dev.logUserValidationError(e, path);
|
|
42500
|
+
}
|
|
42494
42501
|
}); // Validate the config
|
|
42495
|
-
|
|
42496
|
-
return _context.abrupt("return", config);
|
|
42497
|
-
case
|
|
42502
|
+
_context.prev = 2;
|
|
42503
|
+
return _context.abrupt("return", macros.WorkflowsConfigurationSchema.parse(config));
|
|
42504
|
+
case 6:
|
|
42505
|
+
_context.prev = 6;
|
|
42506
|
+
_context.t0 = _context["catch"](2);
|
|
42507
|
+
throw dev.simplifyError(_context.t0);
|
|
42508
|
+
case 9:
|
|
42498
42509
|
case "end":
|
|
42499
42510
|
return _context.stop();
|
|
42500
42511
|
}
|
|
42501
|
-
}, _callee);
|
|
42512
|
+
}, _callee, null, [[2, 6]]);
|
|
42502
42513
|
}));
|
|
42503
42514
|
return _loadWorkflowsConfig.apply(this, arguments);
|
|
42504
42515
|
}
|
|
@@ -42949,7 +42960,7 @@ var ProjectFiles = /*#__PURE__*/function () {
|
|
|
42949
42960
|
break;
|
|
42950
42961
|
}
|
|
42951
42962
|
result.error.source = "".concat(this.src, "/index.js");
|
|
42952
|
-
throw result.error;
|
|
42963
|
+
throw dev.logUserValidationError(result.error, "".concat(this.src, "/index.js"));
|
|
42953
42964
|
case 26:
|
|
42954
42965
|
// Log
|
|
42955
42966
|
_iterator = spirits._createForOfIteratorHelper(projectConfig.entities);
|
|
@@ -43164,7 +43175,7 @@ var ProjectFiles = /*#__PURE__*/function () {
|
|
|
43164
43175
|
return ProjectFiles;
|
|
43165
43176
|
}();
|
|
43166
43177
|
|
|
43167
|
-
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-
|
|
43178
|
+
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-4dfed9d3.js', document.baseURI).href)));
|
|
43168
43179
|
var __dirname$1 = path__default["default"].dirname(__filename$1);
|
|
43169
43180
|
function zipDirectory(source, out) {
|
|
43170
43181
|
var archive = archiver$1('tar', {
|
|
@@ -43379,7 +43390,7 @@ function _buildApp() {
|
|
|
43379
43390
|
case 11:
|
|
43380
43391
|
_context4.t0 = JSON;
|
|
43381
43392
|
_context4.next = 14;
|
|
43382
|
-
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-
|
|
43393
|
+
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-4dfed9d3.js', document.baseURI).href))), 'utf-8');
|
|
43383
43394
|
case 14:
|
|
43384
43395
|
_context4.t1 = _context4.sent;
|
|
43385
43396
|
packageTemplate = _context4.t0.parse.call(_context4.t0, _context4.t1);
|
|
@@ -43668,25 +43679,24 @@ function _run$1() {
|
|
|
43668
43679
|
_ref2 = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {}, eventSource = _ref2.eventSource;
|
|
43669
43680
|
result = macros.WorkflowEventSchema.safeParse(event);
|
|
43670
43681
|
if (result.success) {
|
|
43671
|
-
_context8.next =
|
|
43682
|
+
_context8.next = 4;
|
|
43672
43683
|
break;
|
|
43673
43684
|
}
|
|
43674
|
-
dev.logUserValidationError(result.error, eventSource);
|
|
43675
|
-
|
|
43676
|
-
case 5:
|
|
43685
|
+
throw dev.logUserValidationError(result.error, eventSource);
|
|
43686
|
+
case 4:
|
|
43677
43687
|
configuration = new dev.build.Configuration({
|
|
43678
43688
|
apiKey: process.env.SCOUT9_API_KEY
|
|
43679
43689
|
});
|
|
43680
43690
|
scout9 = new dev.build.Scout9Api(configuration);
|
|
43681
|
-
_context8.next =
|
|
43691
|
+
_context8.next = 8;
|
|
43682
43692
|
return scout9.runPlatform(event)["catch"](function (err) {
|
|
43683
43693
|
err.message = "Error running platform: ".concat(err.message);
|
|
43684
43694
|
throw err;
|
|
43685
43695
|
});
|
|
43686
|
-
case
|
|
43696
|
+
case 8:
|
|
43687
43697
|
response = _context8.sent;
|
|
43688
43698
|
return _context8.abrupt("return", response.data);
|
|
43689
|
-
case
|
|
43699
|
+
case 10:
|
|
43690
43700
|
case "end":
|
|
43691
43701
|
return _context8.stop();
|
|
43692
43702
|
}
|
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-
|
|
6
|
-
var dev = require("./dev-
|
|
5
|
+
var index = require("./index-4dfed9d3.cjs");
|
|
6
|
+
var dev = require("./dev-7e3c6095.cjs");
|
|
7
7
|
require("./spirits-2ab4d673.cjs");
|
|
8
|
-
require("./macros-
|
|
8
|
+
require("./macros-c8392690.cjs");
|
|
9
9
|
require('fs');
|
|
10
10
|
require('events');
|
|
11
11
|
require('path');
|
|
@@ -4134,7 +4134,7 @@ var PersonasSchema = z.array(PersonaSchema);
|
|
|
4134
4134
|
var ConversationContext = z.record(z.union([z.any(), z.string(), z.number(), z["boolean"](), z["null"](), z.array(z.union([z.string(), z.number(), z["boolean"](), z["null"]()]))]));
|
|
4135
4135
|
var ConversationAnticipateSchema = z.object({
|
|
4136
4136
|
type: z["enum"](['did', 'literal', 'context'], {
|
|
4137
|
-
description:
|
|
4137
|
+
description: 'Determines the runtime to address the next response'
|
|
4138
4138
|
}),
|
|
4139
4139
|
slots: z.record(z.string(), z.array(z.any())),
|
|
4140
4140
|
did: z.string({
|
|
@@ -4191,7 +4191,11 @@ var ConversationSchema = z.object({
|
|
|
4191
4191
|
intentScore: z.number({
|
|
4192
4192
|
description: 'Confidence score of the assigned intent'
|
|
4193
4193
|
}).optional().nullable(),
|
|
4194
|
-
anticipate: ConversationAnticipateSchema.optional()
|
|
4194
|
+
anticipate: ConversationAnticipateSchema.optional(),
|
|
4195
|
+
/**
|
|
4196
|
+
* Whether this conversation is part of a command flow
|
|
4197
|
+
*/
|
|
4198
|
+
command: CommandsSchema.optional()
|
|
4195
4199
|
});
|
|
4196
4200
|
|
|
4197
4201
|
var ForwardSchema = z.union([z["boolean"](), z.string(), z.object({
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
require('node:fs');
|
|
4
4
|
require('node:path');
|
|
5
|
-
var index = require("./index-
|
|
5
|
+
var index = require("./index-4dfed9d3.cjs");
|
|
6
6
|
require("./spirits-2ab4d673.cjs");
|
|
7
|
-
require("./dev-
|
|
7
|
+
require("./dev-7e3c6095.cjs");
|
|
8
8
|
require('util');
|
|
9
9
|
require('stream');
|
|
10
10
|
require('path');
|
|
@@ -23,9 +23,9 @@ require('node:url');
|
|
|
23
23
|
require('node:events');
|
|
24
24
|
require('node:stream');
|
|
25
25
|
require('node:string_decoder');
|
|
26
|
+
require("./macros-c8392690.cjs");
|
|
26
27
|
require('node:readline');
|
|
27
28
|
require('node:process');
|
|
28
|
-
require("./macros-57f9b28b.cjs");
|
|
29
29
|
require('node:os');
|
|
30
30
|
require('fs/promises');
|
|
31
31
|
require('constants');
|
package/dist/schemas.cjs
CHANGED
package/dist/testing-tools.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var dev = require("./dev-
|
|
5
|
+
var dev = require("./dev-7e3c6095.cjs");
|
|
6
6
|
require("./spirits-2ab4d673.cjs");
|
|
7
7
|
require('util');
|
|
8
8
|
require('stream');
|
|
@@ -24,9 +24,9 @@ require('node:url');
|
|
|
24
24
|
require('node:events');
|
|
25
25
|
require('node:stream');
|
|
26
26
|
require('node:string_decoder');
|
|
27
|
+
require("./macros-c8392690.cjs");
|
|
27
28
|
require('node:readline');
|
|
28
29
|
require('node:process');
|
|
29
|
-
require("./macros-57f9b28b.cjs");
|
|
30
30
|
require('node:os');
|
|
31
31
|
require('fs/promises');
|
|
32
32
|
|