create-auto-app 0.3.0 → 0.8.5
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/README.md +197 -0
- package/package.json +2 -3
- package/templates/shopping-app/.context/schema.json +426 -215
- package/templates/shopping-app/.context/server/.context/auto-ia-scheme.json +79 -0
- package/templates/shopping-app/.context/server/server/package.json +1 -1
- package/templates/shopping-app/.context/server/server/scripts/generate-schema.ts +1 -1
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/accepts-items-and-adds-to-their-cart/decide.specs.ts +1 -1
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/creates-a-chat-session/react.specs.ts +51 -0
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/creates-a-chat-session/react.ts +43 -0
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/creates-a-chat-session/register.ts +24 -0
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/creates-a-chat-session-/react.specs.ts +1 -1
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/enters-shopping-criteria-into-assistant/decide.specs.ts +1 -1
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/commands.ts +8 -0
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/decide.specs.ts +101 -0
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/decide.ts +42 -0
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/events.ts +9 -0
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/evolve.ts +28 -0
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/handle.ts +52 -0
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/mutation.resolver.ts +25 -0
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/register.ts +7 -0
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria/state.ts +47 -0
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/decide.specs.ts +41 -1
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/decide.ts +9 -1
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/selects-items-relevant-to-the-shopping-criteria-/handle.ts +4 -1
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/views-suggested-items/projection.specs.ts +3 -41
- package/templates/shopping-app/.context/server/server/src/domain/flows/seasonal-assistant/views-suggested-items/projection.ts +2 -15
- package/templates/shopping-app/auto.config.ts +20 -20
- package/templates/shopping-app/client/package.json +4 -4
- package/templates/shopping-app/example-integrations/ai-chat-completion/package.json +5 -6
- package/templates/shopping-app/example-integrations/ai-chat-completion/src/ai-integration.ts +2 -2
- package/templates/shopping-app/example-integrations/cart/package.json +5 -6
- package/templates/shopping-app/example-integrations/cart-api/package.json +3 -3
- package/templates/shopping-app/example-integrations/product-catalogue/package.json +5 -5
- package/templates/shopping-app/example-integrations/product-catalogue/src/product-catalogue-integration.ts +0 -132
- package/templates/shopping-app/example-integrations/product-catalogue-api/package.json +3 -3
- package/templates/shopping-app/flows/shopping-assistant.flow.ts +195 -195
- package/templates/shopping-app/package.json +6 -2
- package/templates/shopping-app/server/package.json +5 -4
- package/templates/shopping-app/server/src/integrations/ai-integration.ts +2 -2
- package/templates/shopping-app/server/src/integrations/index.ts +1 -1
- package/templates/shopping-app/server/src/integrations/product-catalogue/generated/product-catalog/client/client.gen.ts +199 -0
- package/templates/shopping-app/server/src/integrations/product-catalogue/generated/product-catalog/client/index.ts +25 -0
- package/templates/shopping-app/server/src/integrations/product-catalogue/generated/product-catalog/client/types.gen.ts +232 -0
- package/templates/shopping-app/server/src/integrations/product-catalogue/generated/product-catalog/client/utils.gen.ts +419 -0
- package/templates/shopping-app/server/src/integrations/product-catalogue/generated/product-catalog/client.gen.ts +18 -0
- package/templates/shopping-app/server/src/integrations/product-catalogue/generated/product-catalog/core/auth.gen.ts +42 -0
- package/templates/shopping-app/server/src/integrations/product-catalogue/generated/product-catalog/core/bodySerializer.gen.ts +92 -0
- package/templates/shopping-app/server/src/integrations/product-catalogue/generated/product-catalog/core/params.gen.ts +153 -0
- package/templates/shopping-app/server/src/integrations/product-catalogue/generated/product-catalog/core/pathSerializer.gen.ts +181 -0
- package/templates/shopping-app/server/src/integrations/product-catalogue/generated/product-catalog/core/types.gen.ts +120 -0
- package/templates/shopping-app/server/src/integrations/product-catalogue/generated/product-catalog/index.ts +2 -0
- package/templates/shopping-app/server/src/integrations/product-catalogue/generated/product-catalog/types.gen.ts +133 -0
- package/templates/shopping-app/server/src/integrations/product-catalogue/generated/product-catalog/zod.gen.ts +62 -0
- package/templates/shopping-app/server/src/integrations/product-catalogue/index.ts +1 -0
- package/templates/shopping-app/server/src/integrations/product-catalogue/product-catalogue-integration.ts +232 -0
- package/templates/shopping-app/tsconfig.json +2 -2
- package/templates/shopping-app/server/src/integrations/product-catalogue-integration.ts +0 -363
|
@@ -3,11 +3,10 @@ import {
|
|
|
3
3
|
querySlice,
|
|
4
4
|
reactSlice,
|
|
5
5
|
flow,
|
|
6
|
-
createBuilders,
|
|
7
6
|
should,
|
|
8
|
-
given,
|
|
9
|
-
when,
|
|
10
7
|
specs,
|
|
8
|
+
rule,
|
|
9
|
+
example,
|
|
11
10
|
gql,
|
|
12
11
|
source,
|
|
13
12
|
data,
|
|
@@ -17,7 +16,7 @@ import {
|
|
|
17
16
|
type State,
|
|
18
17
|
} from '@auto-engineer/flow';
|
|
19
18
|
|
|
20
|
-
import { AI, ProductCatalog, type
|
|
19
|
+
import { AI, ProductCatalog, type Products } from '../server/src/integrations';
|
|
21
20
|
|
|
22
21
|
type ShoppingCriteriaEntered = Event<
|
|
23
22
|
'ShoppingCriteriaEntered',
|
|
@@ -77,13 +76,7 @@ type AddItemsToCart = Command<
|
|
|
77
76
|
}
|
|
78
77
|
>;
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
.events<ShoppingCriteriaEntered | ShoppingItemsSuggested | ChatCompleted | ItemsAddedToCart>()
|
|
82
|
-
.commands<EnterShoppingCriteria | SuggestShoppingItems | DoChat | AddItemsToCart>()
|
|
83
|
-
.state<{
|
|
84
|
-
Products: Products['data'];
|
|
85
|
-
SuggestedItems: SuggestedItems['data'];
|
|
86
|
-
}>();
|
|
79
|
+
// Using generic DSL instead of typed builders
|
|
87
80
|
|
|
88
81
|
flow('Seasonal Assistant', () => {
|
|
89
82
|
commandSlice('enters shopping criteria into assistant')
|
|
@@ -111,43 +104,49 @@ flow('Seasonal Assistant', () => {
|
|
|
111
104
|
.server(() => {
|
|
112
105
|
data([sink().event('ShoppingCriteriaEntered').toStream('shopping-session-${sessionId}')]);
|
|
113
106
|
specs('When shopper submits criteria, a shopping session is started', () => {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
107
|
+
rule('Valid criteria should start a shopping session', () => {
|
|
108
|
+
example('User submits shopping criteria for children')
|
|
109
|
+
.when<EnterShoppingCriteria>({
|
|
110
|
+
sessionId: 'shopper-123',
|
|
111
|
+
criteria:
|
|
112
|
+
'I need back-to-school items for my 7-year-old daughter who loves soccer and crafts, and my 12-year-old son who is into computers and Magic the Gathering.',
|
|
113
|
+
})
|
|
114
|
+
.then<ShoppingCriteriaEntered>([
|
|
115
|
+
{
|
|
116
|
+
sessionId: 'shopper-123',
|
|
117
|
+
criteria:
|
|
118
|
+
'I need back-to-school items for my 7-year-old daughter who loves soccer and crafts, and my 12-year-old son who is into computers and Magic the Gathering.',
|
|
119
|
+
timestamp: new Date(),
|
|
120
|
+
},
|
|
121
|
+
]);
|
|
122
|
+
});
|
|
128
123
|
});
|
|
129
124
|
});
|
|
130
125
|
|
|
131
|
-
reactSlice('creates a chat session
|
|
126
|
+
reactSlice('creates a chat session').server(() => {
|
|
132
127
|
specs('When shopping criteria are entered, request wishlist creation', () => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
128
|
+
rule('Shopping criteria should trigger item suggestion', () => {
|
|
129
|
+
example('Criteria entered triggers wishlist creation')
|
|
130
|
+
.when<ShoppingCriteriaEntered>([
|
|
131
|
+
{
|
|
132
|
+
sessionId: 'session-abc',
|
|
133
|
+
criteria:
|
|
134
|
+
'I need back-to-school items for my 7-year-old daughter who loves soccer and crafts, and my 12-year-old son who is into computers and Magic the Gathering.',
|
|
135
|
+
timestamp: new Date(),
|
|
136
|
+
},
|
|
137
|
+
])
|
|
138
|
+
.then<SuggestShoppingItems>([
|
|
139
|
+
{
|
|
140
|
+
sessionId: 'session-abc',
|
|
141
|
+
prompt:
|
|
142
|
+
'I need back-to-school items for my 7-year-old daughter who loves soccer and crafts, and my 12-year-old son who is into computers and Magic the Gathering.',
|
|
143
|
+
},
|
|
144
|
+
]);
|
|
145
|
+
});
|
|
147
146
|
});
|
|
148
147
|
});
|
|
149
148
|
|
|
150
|
-
commandSlice('selects items relevant to the shopping criteria
|
|
149
|
+
commandSlice('selects items relevant to the shopping criteria').server(() => {
|
|
151
150
|
data([
|
|
152
151
|
sink()
|
|
153
152
|
.command('SuggestShoppingItems')
|
|
@@ -160,82 +159,83 @@ flow('Seasonal Assistant', () => {
|
|
|
160
159
|
]);
|
|
161
160
|
|
|
162
161
|
specs('When chat is triggered, AI suggests items based on product catalog', () => {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
{
|
|
167
|
-
productId: 'prod-soccer-ball',
|
|
168
|
-
name: 'Super Soccer Ball',
|
|
169
|
-
category: 'Sports',
|
|
170
|
-
price: 10,
|
|
171
|
-
tags: ['soccer', 'sports'],
|
|
172
|
-
imageUrl: 'https://example.com/soccer-ball.jpg',
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
productId: 'prod-craft-kit',
|
|
176
|
-
name: 'Deluxe Craft Kit',
|
|
177
|
-
category: 'Arts & Crafts',
|
|
178
|
-
price: 25,
|
|
179
|
-
tags: ['crafts', 'art', 'creative'],
|
|
180
|
-
imageUrl: 'https://example.com/craft-kit.jpg',
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
productId: 'prod-laptop-bag',
|
|
184
|
-
name: 'Tech Laptop Backpack',
|
|
185
|
-
category: 'School Supplies',
|
|
186
|
-
price: 45,
|
|
187
|
-
tags: ['computers', 'tech', 'school'],
|
|
188
|
-
imageUrl: 'https://example.com/laptop-bag.jpg',
|
|
189
|
-
},
|
|
162
|
+
rule('AI should suggest relevant items from available products', () => {
|
|
163
|
+
example('Product catalog with matching items generates suggestions')
|
|
164
|
+
.given<Products>([
|
|
190
165
|
{
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
166
|
+
products: [
|
|
167
|
+
{
|
|
168
|
+
productId: 'prod-soccer-ball',
|
|
169
|
+
name: 'Super Soccer Ball',
|
|
170
|
+
category: 'Sports',
|
|
171
|
+
price: 10,
|
|
172
|
+
tags: ['soccer', 'sports'],
|
|
173
|
+
imageUrl: 'https://example.com/soccer-ball.jpg',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
productId: 'prod-craft-kit',
|
|
177
|
+
name: 'Deluxe Craft Kit',
|
|
178
|
+
category: 'Arts & Crafts',
|
|
179
|
+
price: 25,
|
|
180
|
+
tags: ['crafts', 'art', 'creative'],
|
|
181
|
+
imageUrl: 'https://example.com/craft-kit.jpg',
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
productId: 'prod-laptop-bag',
|
|
185
|
+
name: 'Tech Laptop Backpack',
|
|
186
|
+
category: 'School Supplies',
|
|
187
|
+
price: 45,
|
|
188
|
+
tags: ['computers', 'tech', 'school'],
|
|
189
|
+
imageUrl: 'https://example.com/laptop-bag.jpg',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
productId: 'prod-mtg-starter',
|
|
193
|
+
name: 'Magic the Gathering Starter Set',
|
|
194
|
+
category: 'Games',
|
|
195
|
+
price: 30,
|
|
196
|
+
tags: ['magic', 'tcg', 'games'],
|
|
197
|
+
imageUrl: 'https://example.com/mtg-starter.jpg',
|
|
198
|
+
},
|
|
199
|
+
],
|
|
197
200
|
},
|
|
198
|
-
]
|
|
199
|
-
|
|
200
|
-
])
|
|
201
|
-
.when(
|
|
202
|
-
Commands.SuggestShoppingItems({
|
|
201
|
+
])
|
|
202
|
+
.when<SuggestShoppingItems>({
|
|
203
203
|
sessionId: 'session-abc',
|
|
204
204
|
prompt:
|
|
205
205
|
'I need back-to-school items for my 7-year-old daughter who loves soccer and crafts, and my 12-year-old son who is into computers and Magic the Gathering.',
|
|
206
|
-
})
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
206
|
+
})
|
|
207
|
+
.then<ShoppingItemsSuggested>([
|
|
208
|
+
{
|
|
209
|
+
sessionId: 'session-abc',
|
|
210
|
+
suggestedItems: [
|
|
211
|
+
{
|
|
212
|
+
productId: 'prod-soccer-ball',
|
|
213
|
+
name: 'Super Soccer Ball',
|
|
214
|
+
quantity: 1,
|
|
215
|
+
reason: 'Perfect for your daughter who loves soccer',
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
productId: 'prod-craft-kit',
|
|
219
|
+
name: 'Deluxe Craft Kit',
|
|
220
|
+
quantity: 1,
|
|
221
|
+
reason: 'Great for creative activities and crafts',
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
productId: 'prod-laptop-bag',
|
|
225
|
+
name: 'Tech Laptop Backpack',
|
|
226
|
+
quantity: 1,
|
|
227
|
+
reason: `Essential for your son's school computer needs`,
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
productId: 'prod-mtg-starter',
|
|
231
|
+
name: 'Magic the Gathering Starter Set',
|
|
232
|
+
quantity: 1,
|
|
233
|
+
reason: 'Ideal starter set for Magic the Gathering enthusiasts',
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
},
|
|
237
|
+
]);
|
|
238
|
+
});
|
|
239
239
|
});
|
|
240
240
|
});
|
|
241
241
|
|
|
@@ -264,67 +264,67 @@ flow('Seasonal Assistant', () => {
|
|
|
264
264
|
data([source().state('SuggestedItems').fromProjection('SuggestedItemsProjection', 'sessionId')]);
|
|
265
265
|
|
|
266
266
|
specs('Suggested items are available for viewing', () => {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
267
|
+
rule('Items should be available for viewing after suggestion', () => {
|
|
268
|
+
example('Item becomes available after AI suggestion event')
|
|
269
|
+
.when<ShoppingItemsSuggested>({
|
|
270
|
+
sessionId: 'session-abc',
|
|
271
|
+
suggestedItems: [
|
|
272
|
+
{
|
|
273
|
+
productId: 'prod-soccer-ball',
|
|
274
|
+
name: 'Super Soccer Ball',
|
|
275
|
+
quantity: 1,
|
|
276
|
+
reason: 'Perfect for your daughter who loves soccer',
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
productId: 'prod-craft-kit',
|
|
280
|
+
name: 'Deluxe Craft Kit',
|
|
281
|
+
quantity: 1,
|
|
282
|
+
reason: 'Great for creative activities and crafts',
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
productId: 'prod-laptop-bag',
|
|
286
|
+
name: 'Tech Laptop Backpack',
|
|
287
|
+
quantity: 1,
|
|
288
|
+
reason: `Essential for your son's school computer needs`,
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
productId: 'prod-mtg-starter',
|
|
292
|
+
name: 'Magic the Gathering Starter Set',
|
|
293
|
+
quantity: 1,
|
|
294
|
+
reason: 'Ideal starter set for Magic the Gathering enthusiasts',
|
|
295
|
+
},
|
|
296
|
+
],
|
|
297
|
+
})
|
|
298
|
+
.then<SuggestedItems>({
|
|
299
|
+
sessionId: 'session-abc',
|
|
300
|
+
items: [
|
|
301
|
+
{
|
|
302
|
+
productId: 'prod-soccer-ball',
|
|
303
|
+
name: 'Super Soccer Ball',
|
|
304
|
+
quantity: 1,
|
|
305
|
+
reason: 'Perfect for your daughter who loves soccer',
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
productId: 'prod-craft-kit',
|
|
309
|
+
name: 'Deluxe Craft Kit',
|
|
310
|
+
quantity: 1,
|
|
311
|
+
reason: 'Great for creative activities and crafts',
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
productId: 'prod-laptop-bag',
|
|
315
|
+
name: 'Tech Laptop Backpack',
|
|
316
|
+
quantity: 1,
|
|
317
|
+
reason: `Essential for your son's school computer needs`,
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
productId: 'prod-mtg-starter',
|
|
321
|
+
name: 'Magic the Gathering Starter Set',
|
|
322
|
+
quantity: 1,
|
|
323
|
+
reason: 'Ideal starter set for Magic the Gathering enthusiasts',
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
328
|
});
|
|
329
329
|
});
|
|
330
330
|
|
|
@@ -339,28 +339,28 @@ flow('Seasonal Assistant', () => {
|
|
|
339
339
|
.server(() => {
|
|
340
340
|
data([sink().event('ItemsAddedToCart').toStream('shopping-session-${sessionId}')]);
|
|
341
341
|
specs('When shopper accepts items, they are added to cart', () => {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
342
|
+
rule('Accepted items should be added to the shopping cart', () => {
|
|
343
|
+
example('User selects all suggested items for cart')
|
|
344
|
+
.when<AddItemsToCart>({
|
|
345
|
+
sessionId: 'session-abc',
|
|
346
|
+
items: [
|
|
347
|
+
{ productId: 'prod-soccer-ball', quantity: 1 },
|
|
348
|
+
{ productId: 'prod-craft-kit', quantity: 1 },
|
|
349
|
+
{ productId: 'prod-laptop-bag', quantity: 1 },
|
|
350
|
+
{ productId: 'prod-mtg-starter', quantity: 1 },
|
|
351
|
+
],
|
|
352
|
+
})
|
|
353
|
+
.then<ItemsAddedToCart>({
|
|
354
|
+
sessionId: 'session-abc',
|
|
355
|
+
items: [
|
|
356
|
+
{ productId: 'prod-soccer-ball', quantity: 1 },
|
|
357
|
+
{ productId: 'prod-craft-kit', quantity: 1 },
|
|
358
|
+
{ productId: 'prod-laptop-bag', quantity: 1 },
|
|
359
|
+
{ productId: 'prod-mtg-starter', quantity: 1 },
|
|
360
|
+
],
|
|
361
|
+
timestamp: new Date(),
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
364
|
});
|
|
365
365
|
});
|
|
366
366
|
});
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shopping-assistant",
|
|
3
|
+
"private": true,
|
|
3
4
|
"type": "module",
|
|
4
5
|
"scripts": {
|
|
5
6
|
"auto": "auto",
|
|
7
|
+
"auto:debug": "DEBUG=flow:*,cli:* auto",
|
|
6
8
|
"start": "dotenv -e .env -- pnpm --parallel start",
|
|
7
|
-
"build": "
|
|
9
|
+
"build": "tsc",
|
|
8
10
|
"start:ecommerce-site": "cd examples/ecommerce-site && pnpm start",
|
|
9
11
|
"start:product-api": "cd examples/product-catalogue-api && pnpm start",
|
|
10
12
|
"start:cart-api": "cd examples/cart-api && pnpm start",
|
|
@@ -21,9 +23,11 @@
|
|
|
21
23
|
"@auto-engineer/message-bus": "workspace:*",
|
|
22
24
|
"@auto-engineer/server-checks": "workspace:*",
|
|
23
25
|
"@auto-engineer/server-generator-apollo-emmett": "workspace:*",
|
|
24
|
-
"@auto-engineer/server-implementer": "workspace:*"
|
|
26
|
+
"@auto-engineer/server-implementer": "workspace:*",
|
|
27
|
+
"zod": "^3.25.76"
|
|
25
28
|
},
|
|
26
29
|
"devDependencies": {
|
|
30
|
+
"@types/node": "^24.3.1",
|
|
27
31
|
"chokidar": "^3.6.0",
|
|
28
32
|
"dotenv": "^16.4.5",
|
|
29
33
|
"dotenv-cli": "^9.0.0",
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "tsx --no-deprecation src/server.ts",
|
|
8
8
|
"type-check": "tsc --noEmit",
|
|
9
|
-
"test": "vitest run",
|
|
9
|
+
"test": "vitest run --reporter=dot",
|
|
10
10
|
"dev": "tsx watch --no-deprecation src/server.ts"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@auto-engineer/ai-gateway": "
|
|
14
|
-
"@auto-engineer/flow": "
|
|
13
|
+
"@auto-engineer/ai-gateway": "workspace:*",
|
|
14
|
+
"@auto-engineer/flow": "workspace:*",
|
|
15
15
|
"axios": "^1.11.0",
|
|
16
16
|
"@event-driven-io/emmett": "^0.38.2",
|
|
17
17
|
"type-graphql": "^2.0.0-rc.2",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"fast-glob": "^3.3.3",
|
|
20
20
|
"reflect-metadata": "^0.2.2",
|
|
21
21
|
"apollo-server": "^3.13.0",
|
|
22
|
-
"uuid": "^10.0.0"
|
|
22
|
+
"uuid": "^10.0.0",
|
|
23
|
+
"zod": "^3.25.67"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {}
|
|
25
26
|
}
|
|
@@ -52,7 +52,7 @@ export const AI: Integration<'ai', Record<string, never>, AICommands> = {
|
|
|
52
52
|
const schema = getSchemaByName(schemaName);
|
|
53
53
|
|
|
54
54
|
if (schema) {
|
|
55
|
-
return await generateStructuredDataWithAI(fullPrompt,
|
|
55
|
+
return await generateStructuredDataWithAI(fullPrompt, {
|
|
56
56
|
schema: schema as z.ZodSchema<T>,
|
|
57
57
|
schemaName,
|
|
58
58
|
schemaDescription: `AI output matching schema '${schemaName}'`,
|
|
@@ -60,7 +60,7 @@ export const AI: Integration<'ai', Record<string, never>, AICommands> = {
|
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
const raw = await generateTextWithAI(fullPrompt,
|
|
63
|
+
const raw = await generateTextWithAI(fullPrompt, {
|
|
64
64
|
includeTools: true,
|
|
65
65
|
});
|
|
66
66
|
|