@scout9/app 1.0.0-alpha.0.1.82 → 1.0.0-alpha.0.1.84
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-85a21837.cjs → exports-5ad64876.cjs} +86 -7
- package/dist/index.cjs +2 -2
- package/dist/{multipart-parser-b4ea21cc.cjs → multipart-parser-141ee5a8.cjs} +2 -2
- package/dist/{spirits-08d69f88.cjs → spirits-643c422a.cjs} +12 -4
- package/dist/spirits.cjs +1 -1
- package/dist/testing-tools.cjs +2 -2
- package/package.json +1 -1
- package/src/testing-tools/dev.js +1 -0
- package/src/testing-tools/spirits.js +8 -4
- package/src/utils/file.js +1 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var spirits = require("./spirits-
|
|
3
|
+
var spirits = require("./spirits-643c422a.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-141ee5a8.cjs"); });
|
|
41178
41178
|
return toFormData(this.body, ct);
|
|
41179
41179
|
}
|
|
41180
41180
|
|
|
@@ -62872,6 +62872,47 @@ common.createRequestFunction = createRequestFunction;
|
|
|
62872
62872
|
options: localVarRequestOptions
|
|
62873
62873
|
};
|
|
62874
62874
|
},
|
|
62875
|
+
/**
|
|
62876
|
+
* Returns log data for a given range, specified by start and end Unix timestamps.
|
|
62877
|
+
* @summary Retrieve platform run time logs
|
|
62878
|
+
* @param {number} [start]
|
|
62879
|
+
* @param {number} [end]
|
|
62880
|
+
* @param {*} [options] Override http request option.
|
|
62881
|
+
* @throws {RequiredError}
|
|
62882
|
+
*/
|
|
62883
|
+
logs: async (start, end, options = {}) => {
|
|
62884
|
+
const localVarPath = `/v1-utils-platform-logs`;
|
|
62885
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
62886
|
+
const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
|
|
62887
|
+
let baseOptions;
|
|
62888
|
+
if (configuration) {
|
|
62889
|
+
baseOptions = configuration.baseOptions;
|
|
62890
|
+
}
|
|
62891
|
+
const localVarRequestOptions = {
|
|
62892
|
+
method: 'GET',
|
|
62893
|
+
...baseOptions,
|
|
62894
|
+
...options
|
|
62895
|
+
};
|
|
62896
|
+
const localVarHeaderParameter = {};
|
|
62897
|
+
const localVarQueryParameter = {};
|
|
62898
|
+
if (start !== undefined) {
|
|
62899
|
+
localVarQueryParameter['start'] = start;
|
|
62900
|
+
}
|
|
62901
|
+
if (end !== undefined) {
|
|
62902
|
+
localVarQueryParameter['end'] = end;
|
|
62903
|
+
}
|
|
62904
|
+
(0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
|
|
62905
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
62906
|
+
localVarRequestOptions.headers = {
|
|
62907
|
+
...localVarHeaderParameter,
|
|
62908
|
+
...headersFromBaseOptions,
|
|
62909
|
+
...options.headers
|
|
62910
|
+
};
|
|
62911
|
+
return {
|
|
62912
|
+
url: (0, common_1.toPathString)(localVarUrlObj),
|
|
62913
|
+
options: localVarRequestOptions
|
|
62914
|
+
};
|
|
62915
|
+
},
|
|
62875
62916
|
/**
|
|
62876
62917
|
* Creates a new message and sends it to the conversation. If the conversation is scheduled, the message will be scheduled as well. @TODO does not support the ability to mute or delay send
|
|
62877
62918
|
* @summary Create and send message
|
|
@@ -63911,6 +63952,18 @@ common.createRequestFunction = createRequestFunction;
|
|
|
63911
63952
|
const localVarAxiosArgs = await localVarAxiosParamCreator.generate(generateRequest, options);
|
|
63912
63953
|
return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1$1.default, base_1.BASE_PATH, configuration);
|
|
63913
63954
|
},
|
|
63955
|
+
/**
|
|
63956
|
+
* Returns log data for a given range, specified by start and end Unix timestamps.
|
|
63957
|
+
* @summary Retrieve platform run time logs
|
|
63958
|
+
* @param {number} [start]
|
|
63959
|
+
* @param {number} [end]
|
|
63960
|
+
* @param {*} [options] Override http request option.
|
|
63961
|
+
* @throws {RequiredError}
|
|
63962
|
+
*/
|
|
63963
|
+
async logs(start, end, options) {
|
|
63964
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.logs(start, end, options);
|
|
63965
|
+
return (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1$1.default, base_1.BASE_PATH, configuration);
|
|
63966
|
+
},
|
|
63914
63967
|
/**
|
|
63915
63968
|
* Creates a new message and sends it to the conversation. If the conversation is scheduled, the message will be scheduled as well. @TODO does not support the ability to mute or delay send
|
|
63916
63969
|
* @summary Create and send message
|
|
@@ -64592,6 +64645,17 @@ common.createRequestFunction = createRequestFunction;
|
|
|
64592
64645
|
generate(generateRequest, options) {
|
|
64593
64646
|
return localVarFp.generate(generateRequest, options).then(request => request(axios, basePath));
|
|
64594
64647
|
},
|
|
64648
|
+
/**
|
|
64649
|
+
* Returns log data for a given range, specified by start and end Unix timestamps.
|
|
64650
|
+
* @summary Retrieve platform run time logs
|
|
64651
|
+
* @param {number} [start]
|
|
64652
|
+
* @param {number} [end]
|
|
64653
|
+
* @param {*} [options] Override http request option.
|
|
64654
|
+
* @throws {RequiredError}
|
|
64655
|
+
*/
|
|
64656
|
+
logs(start, end, options) {
|
|
64657
|
+
return localVarFp.logs(start, end, options).then(request => request(axios, basePath));
|
|
64658
|
+
},
|
|
64595
64659
|
/**
|
|
64596
64660
|
* Creates a new message and sends it to the conversation. If the conversation is scheduled, the message will be scheduled as well. @TODO does not support the ability to mute or delay send
|
|
64597
64661
|
* @summary Create and send message
|
|
@@ -65314,6 +65378,18 @@ common.createRequestFunction = createRequestFunction;
|
|
|
65314
65378
|
generate(generateRequest, options) {
|
|
65315
65379
|
return (0, exports.Scout9ApiFp)(this.configuration).generate(generateRequest, options).then(request => request(this.axios, this.basePath));
|
|
65316
65380
|
}
|
|
65381
|
+
/**
|
|
65382
|
+
* Returns log data for a given range, specified by start and end Unix timestamps.
|
|
65383
|
+
* @summary Retrieve platform run time logs
|
|
65384
|
+
* @param {number} [start]
|
|
65385
|
+
* @param {number} [end]
|
|
65386
|
+
* @param {*} [options] Override http request option.
|
|
65387
|
+
* @throws {RequiredError}
|
|
65388
|
+
* @memberof Scout9Api
|
|
65389
|
+
*/
|
|
65390
|
+
logs(start, end, options) {
|
|
65391
|
+
return (0, exports.Scout9ApiFp)(this.configuration).logs(start, end, options).then(request => request(this.axios, this.basePath));
|
|
65392
|
+
}
|
|
65317
65393
|
/**
|
|
65318
65394
|
* Creates a new message and sends it to the conversation. If the conversation is scheduled, the message will be scheduled as well. @TODO does not support the ability to mute or delay send
|
|
65319
65395
|
* @summary Create and send message
|
|
@@ -65593,7 +65669,7 @@ common.createRequestFunction = createRequestFunction;
|
|
|
65593
65669
|
var configuration = {};
|
|
65594
65670
|
|
|
65595
65671
|
var name$2 = "@scout9/admin";
|
|
65596
|
-
var version$3 = "1.0.0-alpha.0.0.
|
|
65672
|
+
var version$3 = "1.0.0-alpha.0.0.41";
|
|
65597
65673
|
var description$2 = "";
|
|
65598
65674
|
var main$3 = "./build/index.js";
|
|
65599
65675
|
var types$1 = "./build/index.d.ts";
|
|
@@ -78898,6 +78974,7 @@ function _toBuffer() {
|
|
|
78898
78974
|
_context2.next = 34;
|
|
78899
78975
|
break;
|
|
78900
78976
|
}
|
|
78977
|
+
// @TODO support windows
|
|
78901
78978
|
relative = path$d.resolve(path$d.dirname(source), fileBufferOrFilepath);
|
|
78902
78979
|
_context2.next = 14;
|
|
78903
78980
|
return promises.access(relative, fss.constants.R_OK).then(function () {
|
|
@@ -81153,7 +81230,7 @@ function _loadUserPackageJson$1() {
|
|
|
81153
81230
|
targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
|
|
81154
81231
|
_context2.t0 = JSON;
|
|
81155
81232
|
_context2.next = 10;
|
|
81156
|
-
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-
|
|
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-5ad64876.js', document.baseURI).href))), 'utf-8');
|
|
81157
81234
|
case 10:
|
|
81158
81235
|
_context2.t1 = _context2.sent;
|
|
81159
81236
|
pkg = _context2.t0.parse.call(_context2.t0, _context2.t1);
|
|
@@ -81998,7 +82075,7 @@ function _loadUserPackageJson() {
|
|
|
81998
82075
|
targetPkgUrl = isTest ? packageTestJsonUrl : packageJsonUrl;
|
|
81999
82076
|
_context.t0 = JSON;
|
|
82000
82077
|
_context.next = 10;
|
|
82001
|
-
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-
|
|
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-5ad64876.js', document.baseURI).href))), 'utf-8');
|
|
82002
82079
|
case 10:
|
|
82003
82080
|
_context.t1 = _context.sent;
|
|
82004
82081
|
pkg = _context.t0.parse.call(_context.t0, _context.t1);
|
|
@@ -88239,7 +88316,7 @@ function report(config, logger) {
|
|
|
88239
88316
|
logger.primary("Run ".concat(cyan('scout9 dev'), " to test your project locally"));
|
|
88240
88317
|
}
|
|
88241
88318
|
|
|
88242
|
-
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-
|
|
88319
|
+
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-5ad64876.js', document.baseURI).href)));
|
|
88243
88320
|
var __dirname$1 = path__default["default"].dirname(__filename$1);
|
|
88244
88321
|
|
|
88245
88322
|
/**
|
|
@@ -88482,7 +88559,7 @@ function _buildApp() {
|
|
|
88482
88559
|
case 11:
|
|
88483
88560
|
_context4.t0 = JSON;
|
|
88484
88561
|
_context4.next = 14;
|
|
88485
|
-
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-
|
|
88562
|
+
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-5ad64876.js', document.baseURI).href))), 'utf-8');
|
|
88486
88563
|
case 14:
|
|
88487
88564
|
_context4.t1 = _context4.sent;
|
|
88488
88565
|
packageTemplate = _context4.t0.parse.call(_context4.t0, _context4.t1);
|
|
@@ -91164,6 +91241,7 @@ var Scout9Test = /*#__PURE__*/function () {
|
|
|
91164
91241
|
_message,
|
|
91165
91242
|
result,
|
|
91166
91243
|
_result$conversation$,
|
|
91244
|
+
_result$conversation$2,
|
|
91167
91245
|
_args4 = arguments;
|
|
91168
91246
|
return spirits._regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
91169
91247
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -91282,6 +91360,7 @@ var Scout9Test = /*#__PURE__*/function () {
|
|
|
91282
91360
|
this.conversation.forwarded = new Date().toString();
|
|
91283
91361
|
this.conversation.forwardNote = result.conversation.forwardNote || '';
|
|
91284
91362
|
this.conversation.locked = true;
|
|
91363
|
+
this.conversation.lockedReason = (_result$conversation$2 = result.conversation.forwardNote) !== null && _result$conversation$2 !== void 0 ? _result$conversation$2 : 'Forwarded to ' + this.conversation.forwardedTo;
|
|
91285
91364
|
}
|
|
91286
91365
|
if (!result.messages.after.find(function (m) {
|
|
91287
91366
|
return m.id === result.message.after.id;
|
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-5ad64876.cjs");
|
|
6
|
+
var spirits = require("./spirits-643c422a.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-5ad64876.cjs");
|
|
6
|
+
require("./spirits-643c422a.cjs");
|
|
7
7
|
require('node:readline');
|
|
8
8
|
require('fs');
|
|
9
9
|
require('events');
|
|
@@ -692,10 +692,12 @@ var Spirits = {
|
|
|
692
692
|
_conversation.lockAttempts++;
|
|
693
693
|
if (_conversation.lockAttempts > ((_config === null || _config === void 0 ? void 0 : _config.maxLockAttempts) || 3)) {
|
|
694
694
|
_conversation.locked = true;
|
|
695
|
+
_conversation.lockedReason = "Max lock attempts exceeded (".concat(_conversation.lockAttempts, " > ").concat((_config === null || _config === void 0 ? void 0 : _config.maxLockAttempts) || 3, ")");
|
|
695
696
|
}
|
|
696
697
|
progress('Incremented lock attempt', 'info', 'UPDATE_CONVERSATION', {
|
|
697
698
|
lockAttempts: _conversation.lockAttempts,
|
|
698
|
-
locked: _conversation.locked
|
|
699
|
+
locked: _conversation.locked,
|
|
700
|
+
lockedReason: _conversation.lockedReason || ''
|
|
699
701
|
});
|
|
700
702
|
return _conversation;
|
|
701
703
|
};
|
|
@@ -853,9 +855,11 @@ var Spirits = {
|
|
|
853
855
|
// Reset lock attempts
|
|
854
856
|
conversation.locked = false;
|
|
855
857
|
conversation.lockAttempts = 0;
|
|
858
|
+
conversation.lockedReason = '';
|
|
856
859
|
progress('Reset lock', 'info', 'UPDATE_CONVERSATION', {
|
|
857
860
|
locked: false,
|
|
858
|
-
lockAttempts: 0
|
|
861
|
+
lockAttempts: 0,
|
|
862
|
+
lockedReason: ''
|
|
859
863
|
});
|
|
860
864
|
}
|
|
861
865
|
noNewContext = Object.keys(parsePayload.context).length === 0; // 3. Run the workflow
|
|
@@ -893,9 +897,11 @@ var Spirits = {
|
|
|
893
897
|
} else {
|
|
894
898
|
conversation.lockAttempts = 0;
|
|
895
899
|
conversation.locked = false;
|
|
900
|
+
conversation.lockedReason = '';
|
|
896
901
|
progress('Reset lock', 'info', 'UPDATE_CONVERSATION', {
|
|
897
902
|
lockAttempts: 0,
|
|
898
|
-
locked: false
|
|
903
|
+
locked: false,
|
|
904
|
+
lockedReason: ''
|
|
899
905
|
});
|
|
900
906
|
}
|
|
901
907
|
resettedIntent = false;
|
|
@@ -1088,12 +1094,14 @@ var Spirits = {
|
|
|
1088
1094
|
conversation.intent = null;
|
|
1089
1095
|
conversation.intentScore = null;
|
|
1090
1096
|
conversation.locked = false;
|
|
1097
|
+
conversation.lockedReason = '';
|
|
1091
1098
|
conversation.lockAttempts = 0;
|
|
1092
1099
|
progress('Reset conversation intent', 'info', 'UPDATE_CONVERSATION', {
|
|
1093
1100
|
intent: null,
|
|
1094
1101
|
intentScore: null,
|
|
1095
1102
|
locked: false,
|
|
1096
|
-
lockAttempts: 0
|
|
1103
|
+
lockAttempts: 0,
|
|
1104
|
+
lockedReason: ''
|
|
1097
1105
|
});
|
|
1098
1106
|
}
|
|
1099
1107
|
|
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-5ad64876.cjs");
|
|
6
|
+
var spirits = require("./spirits-643c422a.cjs");
|
|
7
7
|
require('node:readline');
|
|
8
8
|
require('fs');
|
|
9
9
|
require('events');
|
package/package.json
CHANGED
package/src/testing-tools/dev.js
CHANGED
|
@@ -273,6 +273,7 @@ export class Scout9Test {
|
|
|
273
273
|
this.conversation.forwarded = new Date().toString();
|
|
274
274
|
this.conversation.forwardNote = result.conversation.forwardNote || '';
|
|
275
275
|
this.conversation.locked = true;
|
|
276
|
+
this.conversation.lockedReason = result.conversation.forwardNote ?? ('Forwarded to ' + this.conversation.forwardedTo);
|
|
276
277
|
}
|
|
277
278
|
|
|
278
279
|
if (!result.messages.after.find(m => m.id === result.message.after.id)) {
|
|
@@ -156,8 +156,9 @@ export const Spirits = {
|
|
|
156
156
|
_conversation.lockAttempts++;
|
|
157
157
|
if (_conversation.lockAttempts > (_config?.maxLockAttempts || 3)) {
|
|
158
158
|
_conversation.locked = true;
|
|
159
|
+
_conversation.lockedReason = `Max lock attempts exceeded (${_conversation.lockAttempts} > ${(_config?.maxLockAttempts || 3)})`;
|
|
159
160
|
}
|
|
160
|
-
progress('Incremented lock attempt', 'info', 'UPDATE_CONVERSATION', {lockAttempts: _conversation.lockAttempts, locked: _conversation.locked});
|
|
161
|
+
progress('Incremented lock attempt', 'info', 'UPDATE_CONVERSATION', {lockAttempts: _conversation.lockAttempts, locked: _conversation.locked, lockedReason: _conversation.lockedReason || ''});
|
|
161
162
|
return _conversation;
|
|
162
163
|
}
|
|
163
164
|
|
|
@@ -290,7 +291,8 @@ export const Spirits = {
|
|
|
290
291
|
// Reset lock attempts
|
|
291
292
|
conversation.locked = false;
|
|
292
293
|
conversation.lockAttempts = 0;
|
|
293
|
-
|
|
294
|
+
conversation.lockedReason = '';
|
|
295
|
+
progress('Reset lock', 'info', 'UPDATE_CONVERSATION', {locked: false, lockAttempts: 0, lockedReason: ''});
|
|
294
296
|
}
|
|
295
297
|
|
|
296
298
|
const noNewContext = Object.keys(parsePayload.context).length === 0;
|
|
@@ -320,7 +322,8 @@ export const Spirits = {
|
|
|
320
322
|
} else {
|
|
321
323
|
conversation.lockAttempts = 0;
|
|
322
324
|
conversation.locked = false;
|
|
323
|
-
|
|
325
|
+
conversation.lockedReason = '';
|
|
326
|
+
progress('Reset lock', 'info', 'UPDATE_CONVERSATION', {lockAttempts: 0, locked: false, lockedReason: ''});
|
|
324
327
|
}
|
|
325
328
|
|
|
326
329
|
let resettedIntent = false;
|
|
@@ -443,8 +446,9 @@ export const Spirits = {
|
|
|
443
446
|
conversation.intent = null;
|
|
444
447
|
conversation.intentScore = null;
|
|
445
448
|
conversation.locked = false;
|
|
449
|
+
conversation.lockedReason = '';
|
|
446
450
|
conversation.lockAttempts = 0;
|
|
447
|
-
progress('Reset conversation intent', 'info', 'UPDATE_CONVERSATION', {intent: null, intentScore: null, locked: false, lockAttempts: 0});
|
|
451
|
+
progress('Reset conversation intent', 'info', 'UPDATE_CONVERSATION', {intent: null, intentScore: null, locked: false, lockAttempts: 0, lockedReason: ''});
|
|
448
452
|
}
|
|
449
453
|
|
|
450
454
|
// 4. Generate response
|
package/src/utils/file.js
CHANGED
|
@@ -78,6 +78,7 @@ export async function toBuffer(fileBufferOrFilepath, source) {
|
|
|
78
78
|
mime = result.mime;
|
|
79
79
|
} else {
|
|
80
80
|
if (source) {
|
|
81
|
+
// @TODO support windows
|
|
81
82
|
let relative = resolve(dirname(source), fileBufferOrFilepath);
|
|
82
83
|
if (await access(relative, constants.R_OK).then(() => true).catch(() => false)) {
|
|
83
84
|
buffer = await readFile(relative);
|