@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
package/src/testing-tools/dev.js
CHANGED
|
@@ -15,22 +15,22 @@ import { Spirits } from './spirits.js';
|
|
|
15
15
|
export class Scout9Test {
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* @type {import('
|
|
18
|
+
* @type {import('../runtime/client/users.js').ICustomer}
|
|
19
19
|
*/
|
|
20
20
|
customer;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* @type {import('
|
|
23
|
+
* @type {import('../runtime/client/users.js').IPersona}
|
|
24
24
|
*/
|
|
25
25
|
persona;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* @type {import('
|
|
28
|
+
* @type {import('../runtime/client/workflow.js').IConversation}
|
|
29
29
|
*/
|
|
30
30
|
conversation;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* @type {import('
|
|
33
|
+
* @type {import('../runtime/client/message.js').IMessage[]}
|
|
34
34
|
*/
|
|
35
35
|
messages;
|
|
36
36
|
|
|
@@ -41,13 +41,13 @@ export class Scout9Test {
|
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
43
|
* @private
|
|
44
|
-
* @type {import('
|
|
44
|
+
* @type {import('../runtime/client/config.js').IScout9ProjectBuildConfig | null}
|
|
45
45
|
*/
|
|
46
46
|
_project = null;
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
49
|
* @private
|
|
50
|
-
* @type {import('
|
|
50
|
+
* @type {import('../runtime/client/workflow.js').IWorkflowFunction | null}
|
|
51
51
|
*/
|
|
52
52
|
_app = null;
|
|
53
53
|
|
|
@@ -86,16 +86,16 @@ export class Scout9Test {
|
|
|
86
86
|
/**
|
|
87
87
|
* Mimics a customer message to your app (useful for testing)
|
|
88
88
|
* @param props - the Scout9Test properties
|
|
89
|
-
* @param {import('
|
|
89
|
+
* @param {import('../runtime/client/users.js').ICustomer | undefined} [props.customer] - customer to use
|
|
90
90
|
* @param {any | undefined} [props.context] - prior conversation context
|
|
91
91
|
* @param {string | undefined} [props.persona] id to use
|
|
92
|
-
* @param {import('
|
|
92
|
+
* @param {import('../runtime/client/workflow.js').IConversation | undefined} [props.conversation] - existing conversation
|
|
93
93
|
* @param {string | undefined} [props.cwd]
|
|
94
94
|
* @param {string | undefined} [props.src]
|
|
95
95
|
* @param {string | undefined} [props.mode]
|
|
96
96
|
* @param {import('@scout9/admin').Scout9Api} [props.api]
|
|
97
|
-
* @param {import('
|
|
98
|
-
* @param {import('
|
|
97
|
+
* @param {import('../runtime/client/workflow.js').IWorkflowFunction} [props.app]
|
|
98
|
+
* @param {import('../runtime/client/config.js').IScout9ProjectBuildConfig} [props.project]
|
|
99
99
|
*/
|
|
100
100
|
constructor(
|
|
101
101
|
{
|
|
@@ -303,8 +303,8 @@ export class Scout9Test {
|
|
|
303
303
|
/**
|
|
304
304
|
* Runs your local app workflow
|
|
305
305
|
* @param {string} message - the message to run through the workflow
|
|
306
|
-
* @param {Omit<Partial<import('
|
|
307
|
-
* @returns {Promise<import('
|
|
306
|
+
* @param {Omit<Partial<import('../runtime/client/workflow.js').IWorkflowEvent>, 'message'> | undefined} [event] - additional event data
|
|
307
|
+
* @returns {Promise<import('../runtime/client/workflow.js').IWorkflowResponse>}
|
|
308
308
|
*/
|
|
309
309
|
async workflow(message, event = {}) {
|
|
310
310
|
if (!this._app) {
|
|
@@ -324,7 +324,7 @@ export class Scout9Test {
|
|
|
324
324
|
* @param {Object} [input] - Generation input, defaults to test registered data such as existing messages, context, and persona information.
|
|
325
325
|
* @param {string} [input.personaId] - Persona ID to use, defaults to test registered persona id.
|
|
326
326
|
* @param {Partial<import('@scout9/admin').ConversationCreateRequest>} [input.conversation] - Conversation overrides, defaults to test registered conversation data.
|
|
327
|
-
* @param {import('
|
|
327
|
+
* @param {import('../runtime/client/message.js').IMessage[]} [input.messages] - Message overrides, defaults to test registered message data.
|
|
328
328
|
* @param {any} [input.context] - Context overrides, defaults to test registered context data.
|
|
329
329
|
* @returns {Promise<import('@scout9/admin').GenerateResponse>}
|
|
330
330
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import moment from 'moment';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @returns {import('
|
|
4
|
+
* @returns {import('../runtime/client/users.js').IAgent}
|
|
5
5
|
*/
|
|
6
6
|
export const createMockAgent = (firstName = 'Carmela', lastName = 'Soprano') => {
|
|
7
7
|
return {
|
|
@@ -12,7 +12,7 @@ export const createMockAgent = (firstName = 'Carmela', lastName = 'Soprano') =>
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* @returns {import('
|
|
15
|
+
* @returns {import('../runtime/client/users.js').ICustomer}
|
|
16
16
|
*/
|
|
17
17
|
export const createMockCustomer = (firstName = 'Tony', lastName = 'Soprano') => {
|
|
18
18
|
return {
|
|
@@ -28,7 +28,7 @@ export const createMockCustomer = (firstName = 'Tony', lastName = 'Soprano') =>
|
|
|
28
28
|
* @param content
|
|
29
29
|
* @param role
|
|
30
30
|
* @param time
|
|
31
|
-
* @returns {import('
|
|
31
|
+
* @returns {import('../runtime/client/message.js').IMessage}
|
|
32
32
|
*/
|
|
33
33
|
export const createMockMessage = (content, role = 'customer', time = moment().toISOString()) => {
|
|
34
34
|
return {
|
|
@@ -42,7 +42,7 @@ export const createMockMessage = (content, role = 'customer', time = moment().t
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* @returns {import('
|
|
45
|
+
* @returns {import('../runtime/client/workflow.js').IConversation}
|
|
46
46
|
*/
|
|
47
47
|
export const createMockConversation = (environment = 'phone', $agent = 'default', $customer = 'default') => {
|
|
48
48
|
return {
|
|
@@ -54,8 +54,8 @@ export const createMockConversation = (environment = 'phone', $agent = 'default'
|
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* @param {string} message
|
|
57
|
-
* @param {string | import('
|
|
58
|
-
* @returns {import('
|
|
57
|
+
* @param {string | import('../runtime/client/workflow.js').IWorkflowEvent['intent'] | null} intent
|
|
58
|
+
* @returns {import('../runtime/client/workflow.js').IWorkflowEvent}
|
|
59
59
|
*/
|
|
60
60
|
export const createMockWorkflowEvent = (
|
|
61
61
|
message,
|
|
@@ -14,35 +14,35 @@
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @typedef {Object} ConversationData
|
|
17
|
-
* @property {import('
|
|
18
|
-
* @property {import('
|
|
19
|
-
* @property {Array<import('
|
|
20
|
-
* @property {import('
|
|
21
|
-
* @property {import('
|
|
17
|
+
* @property {import('../runtime/client/config.js').IScout9ProjectBuildConfig} config - used to define generation and extract persona metadata
|
|
18
|
+
* @property {import('../runtime/client/workflow.js').IConversation} conversation
|
|
19
|
+
* @property {Array<import('../runtime/client/message.js').IMessage>} messages
|
|
20
|
+
* @property {import('../runtime/client/message.js').IMessage} message - the message sent by the customer (should exist in messages)
|
|
21
|
+
* @property {import('../runtime/client/users.js').ICustomer} customer
|
|
22
22
|
* @property {any} context
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* @typedef {Object} ParseOutput
|
|
27
|
-
* @property {Array<import('
|
|
28
|
-
* @property {import('
|
|
29
|
-
* @property {import('
|
|
27
|
+
* @property {Array<import('../runtime/client/message.js').IMessage>} messages
|
|
28
|
+
* @property {import('../runtime/client/workflow.js').IConversation} conversation
|
|
29
|
+
* @property {import('../runtime/client/message.js').IMessage} message
|
|
30
30
|
* @property {any} context
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* @typedef {Object} WorkflowOutput
|
|
35
|
-
* @property {Array<import('
|
|
36
|
-
* @property {Array<import('
|
|
37
|
-
* @property {import('
|
|
35
|
+
* @property {Array<import('../runtime/client/workflow.js').IWorkflowResponseSlot>} slots
|
|
36
|
+
* @property {Array<import('../runtime/client/message.js').IMessage>} messages
|
|
37
|
+
* @property {import('../runtime/client/workflow.js').IConversation} conversation
|
|
38
38
|
* @property {any} context
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* @typedef {Object} GenerateOutput
|
|
43
43
|
* @property {import('@scout9/admin').GenerateResponse | undefined} generate
|
|
44
|
-
* @property {Array<import('
|
|
45
|
-
* @property {import('
|
|
44
|
+
* @property {Array<import('../runtime/client/message.js').IMessage>} messages
|
|
45
|
+
* @property {import('../runtime/client/workflow.js').IConversation} conversation
|
|
46
46
|
* @property {any} context
|
|
47
47
|
*/
|
|
48
48
|
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* @callback WorkflowFun
|
|
58
|
-
* @param {import('
|
|
59
|
-
* @returns {Promise<import('
|
|
58
|
+
* @param {import('../runtime/client/workflow.js').IWorkflowEvent} event - conversation data
|
|
59
|
+
* @returns {Promise<import('../runtime/client/workflow.js').IWorkflowResponse>}
|
|
60
60
|
*/
|
|
61
61
|
|
|
62
62
|
/**
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* @callback IdGeneratorFun
|
|
70
|
-
* @param {import('
|
|
70
|
+
* @param {import('../runtime/client/message.js').IMessage.role} prefix
|
|
71
71
|
* @returns {string}
|
|
72
72
|
*/
|
|
73
73
|
/**
|
|
@@ -90,10 +90,10 @@
|
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* @typedef {Object} ConversationEvent
|
|
93
|
-
* @property {Change<import('
|
|
94
|
-
* @property {Change<Array<import('
|
|
93
|
+
* @property {Change<import('../runtime/client/workflow.js').IConversation> & {forwardNote?: string; forward?: import('../runtime/client/message.js').IWorkflowResponseSlot['forward']}} conversation
|
|
94
|
+
* @property {Change<Array<import('../runtime/client/message.js').IMessage>>} messages
|
|
95
95
|
* @property {Change<Object>} context
|
|
96
|
-
* @property {Change<import('
|
|
96
|
+
* @property {Change<import('../runtime/client/message.js').IMessage>} message
|
|
97
97
|
*/
|
|
98
98
|
export const Spirits = {
|
|
99
99
|
|
|
@@ -7,7 +7,7 @@ function agentsTemplate(agents, exe = 'js') {
|
|
|
7
7
|
return `
|
|
8
8
|
/**
|
|
9
9
|
* Required core entity type: Agents represents you and your team
|
|
10
|
-
* @returns {Array<import('@scout9/app').
|
|
10
|
+
* @returns {Array<import('@scout9/app').IAgent>}
|
|
11
11
|
*/
|
|
12
12
|
export default function Agents() {
|
|
13
13
|
return ${JSON.stringify(agents, null, 2)};
|
|
@@ -19,12 +19,13 @@ export default function Agents() {
|
|
|
19
19
|
* @param {Scout9ProjectBuildConfig} config
|
|
20
20
|
* @param {string} exe - file extension
|
|
21
21
|
* @returns {string}
|
|
22
|
+
*
|
|
22
23
|
*/
|
|
23
24
|
function rootTemplate(config, exe = 'js') {
|
|
24
25
|
return `
|
|
25
26
|
/**
|
|
26
27
|
* Configuration for the Scout9 project.
|
|
27
|
-
* @type {import('@scout9/app').
|
|
28
|
+
* @type {import('@scout9/app').IScout9ProjectConfig}
|
|
28
29
|
*/
|
|
29
30
|
export default {
|
|
30
31
|
|
|
@@ -51,8 +52,8 @@ export default {
|
|
|
51
52
|
function appTemplate() {
|
|
52
53
|
return `
|
|
53
54
|
/**
|
|
54
|
-
* @param {import('@scout9/app').
|
|
55
|
-
* @returns {Promise<import('@scout9/app').
|
|
55
|
+
* @param {import('@scout9/app').IWorkflowEvent} event - every workflow receives an event object
|
|
56
|
+
* @returns {Promise<import('@scout9/app').IWorkflowResponse>} - every workflow must return a WorkflowResponse
|
|
56
57
|
*/
|
|
57
58
|
export default async function Scout9App(event) {
|
|
58
59
|
return {
|