@scout9/app 1.0.0-alpha.0.1.96 → 1.0.0-alpha.0.1.98

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.
Files changed (44) hide show
  1. package/dist/{dev-ecdbe765.cjs → dev-1afc1e7b.cjs} +3788 -3684
  2. package/dist/{index-ea1273a0.cjs → index-2aedbf12.cjs} +150 -55
  3. package/dist/index.cjs +6 -47
  4. package/dist/{multipart-parser-26f98006.cjs → multipart-parser-51d88fc4.cjs} +9 -7
  5. package/dist/{spirits-32395ac4.cjs → spirits-43ce19cf.cjs} +19 -19
  6. package/dist/spirits.cjs +1 -1
  7. package/dist/testing-tools.cjs +7 -6
  8. package/package.json +4 -3
  9. package/src/core/config/agents.js +2 -2
  10. package/src/core/config/entities.js +10 -10
  11. package/src/core/config/index.js +2 -2
  12. package/src/core/config/project.js +1 -1
  13. package/src/core/config/workflow.js +2 -2
  14. package/src/core/index.js +7 -7
  15. package/src/core/sync.js +2 -2
  16. package/src/core/templates/project-files.js +1 -1
  17. package/src/exports.js +8 -7
  18. package/src/platform.js +7 -7
  19. package/src/public.d.ts +3383 -0
  20. package/src/runtime/client/api.js +0 -22
  21. package/src/runtime/client/index.js +0 -6
  22. package/src/runtime/index.js +1 -0
  23. package/src/runtime/macros/builder.js +25 -4
  24. package/src/runtime/macros/event.js +139 -35
  25. package/src/runtime/macros/index.js +0 -1
  26. package/src/runtime/schemas/api.js +21 -0
  27. package/src/runtime/{client → schemas}/config.js +13 -17
  28. package/src/runtime/{client → schemas}/entity.js +16 -29
  29. package/src/runtime/schemas/index.js +9 -0
  30. package/src/runtime/{client → schemas}/message.js +0 -3
  31. package/src/runtime/{client → schemas}/platform.js +1 -1
  32. package/src/runtime/{client → schemas}/users.js +32 -26
  33. package/src/runtime/{client → schemas}/workflow.js +7 -59
  34. package/src/testing-tools/dev.js +15 -17
  35. package/src/testing-tools/mocks.js +6 -6
  36. package/src/testing-tools/spirits.js +19 -19
  37. package/src/utils/configs/agents.js +2 -2
  38. package/src/utils/configs/entities.js +8 -8
  39. package/src/utils/project-templates.js +3 -3
  40. package/types/index.d.ts +2899 -25181
  41. package/types/index.d.ts.map +67 -108
  42. package/src/public.d.ts.text +0 -330
  43. /package/src/runtime/{macros/schemas.js → schemas/macros.js} +0 -0
  44. /package/src/runtime/{client → schemas}/utils.js +0 -0
@@ -2,15 +2,9 @@ import { z } from 'zod';
2
2
  import { zId } from './utils.js';
3
3
  import { MessageSchema } from './message.js';
4
4
 
5
- /**
6
- * @typedef {import('zod').infer<typeof customerValueSchema>} ICustomerValue
7
- */
8
- export const customerValueSchema = z.union([z.boolean(), z.number(), z.string()]);
5
+ export const CustomerValueSchema = z.union([z.boolean(), z.number(), z.string()]);
9
6
 
10
- /**
11
- * @typedef {import('zod').infer<typeof customerSchema>} ICustomer
12
- */
13
- export const customerSchema = z.object({
7
+ export const CustomerSchema = z.object({
14
8
  firstName: z.string().optional(),
15
9
  lastName: z.string().optional(),
16
10
  name: z.string(),
@@ -28,12 +22,9 @@ export const customerSchema = z.object({
28
22
  joined: z.string().nullable().optional(),
29
23
  stripe: z.string().nullable().optional(),
30
24
  stripeDev: z.string().nullable().optional()
31
- }).catchall(customerValueSchema);
25
+ }).catchall(CustomerValueSchema);
32
26
 
33
- /**
34
- * @typedef {import('zod').infer<typeof agentBaseConfigurationSchema>} IAgentBase
35
- */
36
- export const agentBaseConfigurationSchema = z.object({
27
+ export const AgentSchema = z.object({
37
28
  deployed: z.object({
38
29
  web: z.string({description: 'Web URL for agent'}).optional(),
39
30
  phone: z.string({description: 'Phone number for agent'}).optional(),
@@ -57,21 +48,36 @@ export const agentBaseConfigurationSchema = z.object({
57
48
  audios: z.array(z.any()).optional()
58
49
  });
59
50
 
60
- /**
61
- * @typedef {import('zod').infer<typeof agentBaseConfigurationSchema>} IAgent
62
- * @typedef {import('zod').infer<typeof agentBaseConfigurationSchema>} IPersona
63
- */
64
- export const agentConfigurationSchema = agentBaseConfigurationSchema.extend({
51
+ export const PersonaSchema = AgentSchema;
52
+
53
+ export const AgentConfigurationSchema = AgentSchema.extend({
65
54
  id: zId('Agent ID', {description: 'Unique ID for agent'}),
66
55
  });
67
56
 
68
- /**
69
- * @typedef {import('zod').infer<typeof agentsConfigurationSchema>} IAgentsConfiguration
70
- */
71
- export const agentsConfigurationSchema = z.array(agentConfigurationSchema);
57
+ export const PersonaConfigurationSchema = AgentConfigurationSchema.extend({
58
+ id: zId('Agent ID', {description: 'Unique ID for agent'}),
59
+ });
60
+
61
+ export const AgentsConfigurationSchema = z.array(AgentConfigurationSchema);
62
+
63
+ export const PersonasConfigurationSchema = z.array(PersonaConfigurationSchema);
72
64
 
73
- /**
74
- * @typedef {import('zod').infer<typeof agentsBaseConfigurationSchema>} IAgentsBaseConfiguration
75
- */
76
- export const agentsBaseConfigurationSchema = z.array(agentBaseConfigurationSchema);
65
+ export const AgentsSchema = z.array(AgentSchema);
77
66
 
67
+ export const PersonasSchema = z.array(PersonaSchema);
68
+
69
+
70
+ export const Bus = z.object({
71
+ foo: z.string(),
72
+ bar: z.boolean().optional()
73
+ });
74
+ export const Baz = z.object({
75
+ boo: z.object({
76
+ one: z.number(),
77
+ two: z.number().optional()
78
+ })
79
+ })
80
+ export const TestSchema = z.object({
81
+ baz: Baz,
82
+ bus: Bus
83
+ });
@@ -2,13 +2,10 @@
2
2
 
3
3
  import { z } from 'zod';
4
4
  import { zId } from './utils.js';
5
- import { agentConfigurationSchema, customerSchema } from './users.js';
5
+ import { AgentConfigurationSchema, CustomerSchema } from './users.js';
6
6
  import { MessageSchema } from './message.js';
7
7
 
8
8
 
9
- /**
10
- * @typedef {import('zod').infer<typeof WorkflowConfigurationSchema>} IWorkflowConfiguration
11
- */
12
9
  export const WorkflowConfigurationSchema = z.object({
13
10
  entities: z.array(
14
11
  zId('Workflow Folder', z.string()),
@@ -19,15 +16,9 @@ export const WorkflowConfigurationSchema = z.object({
19
16
  entity: zId('Workflow Folder', z.string())
20
17
  });
21
18
 
22
- /**
23
- * @typedef {import('zod').infer<typeof WorkflowsConfigurationSchema>} IWorkflowsConfiguration
24
- */
25
19
  export const WorkflowsConfigurationSchema = z.array(WorkflowConfigurationSchema);
26
20
 
27
21
 
28
- /**
29
- * @typedef {import('zod').infer<typeof ConversationSchema>} IConversation
30
- */
31
22
  export const ConversationSchema = z.object({
32
23
  $agent: zId('Conversation Agent ID', z.string({description: 'Default agent assigned to the conversation(s)'})),
33
24
  $customer: zId('Conversation Customer ID', z.string({description: 'Customer this conversation is with'})),
@@ -48,24 +39,18 @@ export const ConversationSchema = z.object({
48
39
  intentScore: z.number({description: 'Confidence score of the assigned intent'}).optional().nullable()
49
40
  });
50
41
 
51
- /**
52
- * @typedef {import('zod').infer<typeof IntentWorkflowEventSchema>} IIntentWorkflowEvent
53
- */
54
42
  export const IntentWorkflowEventSchema = z.object({
55
43
  current: z.string().nullable(),
56
44
  flow: z.array(z.string()),
57
45
  initial: z.string().nullable()
58
46
  });
59
47
 
60
- /**
61
- * @typedef {import('zod').infer<typeof WorkflowEventSchema>} IWorkflowEvent
62
- */
63
48
  export const WorkflowEventSchema = z.object({
64
49
  messages: z.array(MessageSchema),
65
50
  conversation: ConversationSchema,
66
51
  context: z.any(),
67
52
  message: MessageSchema,
68
- agent: agentConfigurationSchema.omit({
53
+ agent: AgentConfigurationSchema.omit({
69
54
  transcripts: true,
70
55
  audios: true,
71
56
  includedLocations: true,
@@ -73,31 +58,14 @@ export const WorkflowEventSchema = z.object({
73
58
  model: true,
74
59
  context: true
75
60
  }),
76
- customer: customerSchema,
61
+ customer: CustomerSchema,
77
62
  intent: IntentWorkflowEventSchema,
78
63
  stagnationCount: z.number(),
79
64
  note: z.string({description: 'Any developer notes to provide'}).optional()
80
65
  });
81
66
 
82
- const Primitive = z.union([z.string(), z.number(), z.boolean()]);
83
- // Assuming ConversationContext is already defined as a Zod schema
67
+ export const ConversationContext = z.record(z.string(), z.any());
84
68
 
85
- /**
86
- * Lazy is used to handle recursive types.
87
- * @typedef {import('zod').infer<typeof ConversationContext>} IConversation
88
- */
89
- export const ConversationContext = z.lazy(() =>
90
- z.record(
91
- Primitive.or(ConversationContext)
92
- )
93
- );
94
-
95
- const ContextSchema = z.record(Primitive.or(ConversationContext));
96
-
97
- /**
98
- * Forward input information of a conversation
99
- * @typedef {import('zod').infer<typeof ForwardSchema>} IForward
100
- */
101
69
  export const ForwardSchema = z.union([
102
70
  z.boolean(),
103
71
  z.string(),
@@ -109,10 +77,6 @@ export const ForwardSchema = z.union([
109
77
  ], {description: 'Forward input information of a conversation'});
110
78
 
111
79
 
112
- /**
113
- * Instruction object schema used to send context to guide conversations
114
- * @typedef {import('zod').infer<typeof InstructionObjectSchema>} IInstruction
115
- */
116
80
  export const InstructionObjectSchema = z.object({
117
81
  id: zId('Instruction ID')
118
82
  .describe('Unique ID for the instruction, this is used to remove the instruction later')
@@ -125,36 +89,29 @@ export const InstructionObjectSchema = z.object({
125
89
  content: z.string()
126
90
  });
127
91
 
128
- /**
129
- * @typedef {import('zod').infer<typeof WorkflowResponseMessageApiRequest>} IWorkflowResponseMessageApiRequest
130
- */
131
92
  export const WorkflowResponseMessageApiRequest = z.object({
132
93
  uri: z.string(),
133
94
  data: z.any().optional(),
134
- headers: z.object({
135
- [z.string()]: z.string()
136
- }).optional(),
95
+ headers: z.record(z.string(), z.string()).optional(),
137
96
  method: z.enum(['GET', 'POST', 'PUT']).optional()
138
97
  });
139
98
 
140
99
  /**
141
100
  * If its a string, it will be sent as a static string.
142
101
  * If it's a object or WorkflowResponseMessageAPI - it will use
143
- * @typedef {import('zod').infer<typeof WorkflowResponseMessage>} IWorkflowResponseMessage
144
102
  */
145
- export const WorkflowResponseMessage = z.union(
103
+ export const WorkflowResponseMessage = z.union([
146
104
  z.string(),
147
105
 
148
106
  /**
149
107
  * An api call that should be called later, must return a string or {message: string}
150
108
  */
151
109
  WorkflowResponseMessageApiRequest
152
- );
110
+ ]);
153
111
 
154
112
 
155
113
  /**
156
114
  * The intended response provided by the WorkflowResponseMessageApiRequest
157
- * @typedef {import('zod').infer<typeof WorkflowResponseMessageApiResponse>} IWorkflowResponseMessageApiResponse
158
115
  */
159
116
  export const WorkflowResponseMessageApiResponse = z.union([
160
117
  z.string(),
@@ -178,14 +135,12 @@ export const WorkflowResponseMessageApiResponse = z.union([
178
135
 
179
136
  /**
180
137
  * The workflow response object slot
181
- * @typedef {import('zod').infer<typeof InstructionSchema>} IInstruction
182
138
  */
183
139
  export const InstructionSchema = z.union([z.string(), InstructionObjectSchema, z.array(z.string()), z.array(
184
140
  InstructionObjectSchema)]);
185
141
 
186
142
  /**
187
143
  * Base follow up schema to follow up with the client
188
- * @typedef {import('zod').infer<typeof FollowupBaseSchema>} IFollowupBase
189
144
  */
190
145
  export const FollowupBaseSchema = z.object({
191
146
  scheduled: z.number(),
@@ -195,7 +150,6 @@ export const FollowupBaseSchema = z.object({
195
150
 
196
151
  /**
197
152
  * Data used to automatically follow up with the client in the future
198
- * @typedef {import('zod').infer<typeof FollowupSchema>} IFollowup
199
153
  */
200
154
  export const FollowupSchema = z.union([
201
155
  FollowupBaseSchema.extend({
@@ -208,7 +162,6 @@ export const FollowupSchema = z.union([
208
162
 
209
163
  /**
210
164
  * The workflow response object slot
211
- * @typedef {import('zod').infer<typeof WorkflowResponseSlotBaseSchema>} IWorkflowResponseSlotBase
212
165
  */
213
166
  export const WorkflowResponseSlotBaseSchema = z.object({
214
167
  forward: ForwardSchema.optional(),
@@ -226,7 +179,6 @@ export const WorkflowResponseSlotBaseSchema = z.object({
226
179
 
227
180
  /**
228
181
  * The workflow response object slot
229
- * @typedef {import('zod').infer<typeof WorkflowResponseSlotSchema>} IWorkflowResponseSlot
230
182
  */
231
183
  export const WorkflowResponseSlotSchema = WorkflowResponseSlotBaseSchema.extend({
232
184
  anticipate: z.union([
@@ -243,16 +195,12 @@ export const WorkflowResponseSlotSchema = WorkflowResponseSlotBaseSchema.extend(
243
195
 
244
196
  /**
245
197
  * The workflow response to send in any given workflow
246
- * @typedef {import('zod').infer<typeof WorkflowResponseSchema>} IWorkflowResponse
247
198
  */
248
199
  export const WorkflowResponseSchema = z.union([
249
200
  WorkflowResponseSlotSchema,
250
201
  z.array(WorkflowResponseSlotSchema)
251
202
  ]);
252
203
 
253
- /**
254
- * @typedef {import('zod').infer<typeof WorkflowFunctionSchema>} IWorkflowFunction
255
- */
256
204
  export const WorkflowFunctionSchema = z.function()
257
205
  .args(WorkflowEventSchema)
258
206
  .returns(z.union([
@@ -5,8 +5,6 @@ import { loadConfig } from '../core/config/index.js';
5
5
  import { requireProjectFile } from '../utils/index.js';
6
6
  import { globSync } from 'glob';
7
7
 
8
- export * from './spirits.js';
9
-
10
8
  import { Spirits } from './spirits.js';
11
9
 
12
10
  /**
@@ -15,22 +13,22 @@ import { Spirits } from './spirits.js';
15
13
  export class Scout9Test {
16
14
 
17
15
  /**
18
- * @type {import('../runtime/client/users.js').ICustomer}
16
+ * @type {import('@scout9/app').Customer}
19
17
  */
20
18
  customer;
21
19
 
22
20
  /**
23
- * @type {import('../runtime/client/users.js').IPersona}
21
+ * @type {import('@scout9/app').Persona}
24
22
  */
25
23
  persona;
26
24
 
27
25
  /**
28
- * @type {import('../runtime/client/workflow.js').IConversation}
26
+ * @type {import('@scout9/app').Conversation}
29
27
  */
30
28
  conversation;
31
29
 
32
30
  /**
33
- * @type {import('../runtime/client/message.js').IMessage[]}
31
+ * @type {import('@scout9/app').Message[]}
34
32
  */
35
33
  messages;
36
34
 
@@ -41,13 +39,13 @@ export class Scout9Test {
41
39
 
42
40
  /**
43
41
  * @private
44
- * @type {import('../runtime/client/config.js').IScout9ProjectBuildConfig | null}
42
+ * @type {import('@scout9/app').Scout9ProjectBuildConfig | null}
45
43
  */
46
44
  _project = null;
47
45
 
48
46
  /**
49
47
  * @private
50
- * @type {import('../runtime/client/workflow.js').IWorkflowFunction | null}
48
+ * @type {import('@scout9/app').WorkflowFunction | null}
51
49
  */
52
50
  _app = null;
53
51
 
@@ -86,16 +84,16 @@ export class Scout9Test {
86
84
  /**
87
85
  * Mimics a customer message to your app (useful for testing)
88
86
  * @param props - the Scout9Test properties
89
- * @param {import('../runtime/client/users.js').ICustomer | undefined} [props.customer] - customer to use
87
+ * @param {import('@scout9/app').Customer | undefined} [props.customer] - customer to use
90
88
  * @param {any | undefined} [props.context] - prior conversation context
91
89
  * @param {string | undefined} [props.persona] id to use
92
- * @param {import('../runtime/client/workflow.js').IConversation | undefined} [props.conversation] - existing conversation
90
+ * @param {import('@scout9/app').Conversation | undefined} [props.conversation] - existing conversation
93
91
  * @param {string | undefined} [props.cwd]
94
92
  * @param {string | undefined} [props.src]
95
93
  * @param {string | undefined} [props.mode]
96
94
  * @param {import('@scout9/admin').Scout9Api} [props.api]
97
- * @param {import('../runtime/client/workflow.js').IWorkflowFunction} [props.app]
98
- * @param {import('../runtime/client/config.js').IScout9ProjectBuildConfig} [props.project]
95
+ * @param {import('@scout9/app').WorkflowFunction} [props.app]
96
+ * @param {import('@scout9/app').Scout9ProjectBuildConfig} [props.project]
99
97
  */
100
98
  constructor(
101
99
  {
@@ -195,8 +193,8 @@ export class Scout9Test {
195
193
  /**
196
194
  * Send a message as a customer to your app
197
195
  * @param {string} message - message to send
198
- * @param {import('@scout9/app/testing-tools').StatusCallback | boolean} [progress] - progress callback, if true, will log progress, can override with your own callback. If not provided, no logs will be added.
199
- * @returns {Promise<ConversationEvent>}
196
+ * @param {import('@scout9/app/spirits').StatusCallback | boolean} [progress] - progress callback, if true, will log progress, can override with your own callback. If not provided, no logs will be added.
197
+ * @returns {Promise<import('@scout9/app/spirits').ConversationEvent>}
200
198
  */
201
199
  async send(message, progress = false) {
202
200
  if (!this._loaded) {
@@ -303,8 +301,8 @@ export class Scout9Test {
303
301
  /**
304
302
  * Runs your local app workflow
305
303
  * @param {string} message - the message to run through the workflow
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>}
304
+ * @param {Omit<Partial<import('@scout9/app').WorkflowEvent>, 'message'> | undefined} [event] - additional event data
305
+ * @returns {Promise<import('@scout9/app').WorkflowResponse>}
308
306
  */
309
307
  async workflow(message, event = {}) {
310
308
  if (!this._app) {
@@ -324,7 +322,7 @@ export class Scout9Test {
324
322
  * @param {Object} [input] - Generation input, defaults to test registered data such as existing messages, context, and persona information.
325
323
  * @param {string} [input.personaId] - Persona ID to use, defaults to test registered persona id.
326
324
  * @param {Partial<import('@scout9/admin').ConversationCreateRequest>} [input.conversation] - Conversation overrides, defaults to test registered conversation data.
327
- * @param {import('../runtime/client/message.js').IMessage[]} [input.messages] - Message overrides, defaults to test registered message data.
325
+ * @param {import('@scout9/app').Message[]} [input.messages] - Message overrides, defaults to test registered message data.
328
326
  * @param {any} [input.context] - Context overrides, defaults to test registered context data.
329
327
  * @returns {Promise<import('@scout9/admin').GenerateResponse>}
330
328
  */
@@ -1,7 +1,7 @@
1
1
  import moment from 'moment';
2
2
 
3
3
  /**
4
- * @returns {import('../runtime/client/users.js').IAgent}
4
+ * @returns {import('@scout9/app').Agent}
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('../runtime/client/users.js').ICustomer}
15
+ * @returns {import('@scout9/app').Customer}
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('../runtime/client/message.js').IMessage}
31
+ * @returns {import('@scout9/app').Message}
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('../runtime/client/workflow.js').IConversation}
45
+ * @returns {import('@scout9/app').Conversation}
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('../runtime/client/workflow.js').IWorkflowEvent['intent'] | null} intent
58
- * @returns {import('../runtime/client/workflow.js').IWorkflowEvent}
57
+ * @param {string | import('@scout9/app').WorkflowEvent['intent'] | null} intent
58
+ * @returns {import('@scout9/app').WorkflowEvent}
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('../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
17
+ * @property {import('@scout9/app').Scout9ProjectBuildConfig} config - used to define generation and extract persona metadata
18
+ * @property {import('@scout9/app').Conversation} conversation
19
+ * @property {Array<import('@scout9/app').Message>} messages
20
+ * @property {import('@scout9/app').Message} message - the message sent by the customer (should exist in messages)
21
+ * @property {import('@scout9/app').Customer} customer
22
22
  * @property {any} context
23
23
  */
24
24
 
25
25
  /**
26
26
  * @typedef {Object} ParseOutput
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
27
+ * @property {Array<import('@scout9/app').Message>} messages
28
+ * @property {import('@scout9/app').Conversation} conversation
29
+ * @property {import('@scout9/app').Message} message
30
30
  * @property {any} context
31
31
  */
32
32
 
33
33
  /**
34
34
  * @typedef {Object} WorkflowOutput
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
35
+ * @property {Array<import('@scout9/app').WorkflowResponseSlot>} slots
36
+ * @property {Array<import('@scout9/app').Message>} messages
37
+ * @property {import('@scout9/app').Conversation} 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('../runtime/client/message.js').IMessage>} messages
45
- * @property {import('../runtime/client/workflow.js').IConversation} conversation
44
+ * @property {Array<import('@scout9/app').Message>} messages
45
+ * @property {import('@scout9/app').Conversation} 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('../runtime/client/workflow.js').IWorkflowEvent} event - conversation data
59
- * @returns {Promise<import('../runtime/client/workflow.js').IWorkflowResponse>}
58
+ * @param {import('@scout9/app').WorkflowEvent} event - conversation data
59
+ * @returns {Promise<import('@scout9/app').WorkflowResponse>}
60
60
  */
61
61
 
62
62
  /**
@@ -67,7 +67,7 @@
67
67
 
68
68
  /**
69
69
  * @callback IdGeneratorFun
70
- * @param {import('../runtime/client/message.js').IMessage.role} prefix
70
+ * @param {import('@scout9/app').Message['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('../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
93
+ * @property {Change<import('@scout9/app').Conversation> & {forwardNote?: string; forward?: import('@scout9/app').WorkflowResponseSlot['forward']}} conversation
94
+ * @property {Change<Array<import('@scout9/app').Message>>} messages
95
95
  * @property {Change<any>} context
96
- * @property {Change<import('../runtime/client/message.js').IMessage>} message
96
+ * @property {Change<import('@scout9/app').Message>} message
97
97
  */
98
98
  export const Spirits = {
99
99
 
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import colors from 'kleur';
3
3
  import { globSync } from 'glob';
4
4
  import { checkVariableType, requireProjectFile } from '../../utils/index.js';
5
- import { agentsConfigurationSchema, agentsBaseConfigurationSchema } from '../../runtime/index.js';
5
+ import { AgentsConfigurationSchema, AgentsSchema } from '../../runtime/index.js';
6
6
 
7
7
  /**
8
8
  * @param {Array<Agent>} agents
@@ -26,7 +26,7 @@ export function validateAgentConfig(agents) {
26
26
  }
27
27
  }
28
28
 
29
- const result = agentsBaseConfigurationSchema.safeParse(agents);
29
+ const result = AgentsSchema.safeParse(agents);
30
30
  if (!result.success) {
31
31
  result.error.source = `src/entities/agents.js|ts`;
32
32
  throw result.error;
@@ -1,10 +1,10 @@
1
1
  import { globSync } from 'glob';
2
2
  import path from 'node:path';
3
3
  import {
4
- entitiesRootProjectConfigurationSchema,
5
- entityApiConfigurationSchema,
6
- entityConfigurationSchema,
7
- entityRootProjectConfigurationSchema
4
+ EntitiesRootProjectConfigurationSchema,
5
+ EntityApiConfigurationSchema,
6
+ EntityConfigurationSchema,
7
+ EntityRootProjectConfigurationSchema
8
8
  } from '../../runtime/index.js';
9
9
  import { checkVariableType, requireOptionalProjectFile, requireProjectFile } from '../module.js';
10
10
 
@@ -22,7 +22,7 @@ async function loadEntityApiConfig(cwd, filePath) {
22
22
  config[key] = true;
23
23
  }
24
24
  }
25
- entityApiConfigurationSchema.parse(config);
25
+ EntityApiConfigurationSchema.parse(config);
26
26
  return config;
27
27
  } else {
28
28
  return null;
@@ -83,7 +83,7 @@ export default async function loadEntitiesConfig(
83
83
  }
84
84
 
85
85
  // Validate entity configuration
86
- const result = entityConfigurationSchema.safeParse(entityConfig, {path: ['entities', config.length]});
86
+ const result = EntityConfigurationSchema.safeParse(entityConfig, {path: ['entities', config.length]});
87
87
  if (!result.success) {
88
88
  result.error.source = filePath;
89
89
  throw result.error;
@@ -100,7 +100,7 @@ export default async function loadEntitiesConfig(
100
100
  entities: parents.reverse(),
101
101
  api
102
102
  };
103
- entityRootProjectConfigurationSchema.parse(entityProjectConfig);
103
+ EntityRootProjectConfigurationSchema.parse(entityProjectConfig);
104
104
  const existingIndex = config.findIndex(c => c.entity === entityProjectConfig.entity);
105
105
  if (existingIndex > -1) {
106
106
  if (config[existingIndex].entities.length !== entityProjectConfig.entities.length) {
@@ -138,7 +138,7 @@ export default async function loadEntitiesConfig(
138
138
  // }
139
139
 
140
140
  // Validate the config
141
- entitiesRootProjectConfigurationSchema.parse(config);
141
+ EntitiesRootProjectConfigurationSchema.parse(config);
142
142
 
143
143
  return config;
144
144
  }
@@ -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').IAgent>}
10
+ * @returns {Array<import('@scout9/app').Agent>}
11
11
  */
12
12
  export default function Agents() {
13
13
  return ${JSON.stringify(agents, null, 2)};
@@ -25,7 +25,7 @@ function rootTemplate(config, exe = 'js') {
25
25
  return `
26
26
  /**
27
27
  * Configuration for the Scout9 project.
28
- * @type {import('@scout9/app').IScout9ProjectConfig}
28
+ * @type {import('@scout9/app').Scout9ProjectConfig}
29
29
  */
30
30
  export default {
31
31
 
@@ -53,7 +53,7 @@ function appTemplate() {
53
53
  return `
54
54
  /**
55
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
+ * @returns {Promise<import('@scout9/app').WorkflowResponse>} - every workflow must return a WorkflowResponse
57
57
  */
58
58
  export default async function Scout9App(event) {
59
59
  return {