lua-cli 2.1.0-alpha.6 → 2.2.0
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 +2 -2
- package/dist/commands/compile.js +58 -2
- package/dist/custom-data-api.d.ts +72 -0
- package/dist/custom-data-api.js +174 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/product-api.d.ts +142 -1
- package/dist/product-api.js +124 -10
- package/dist/services/api.d.ts +288 -5
- package/dist/services/api.js +322 -9
- package/dist/utils/files.js +2 -2
- package/dist/utils/sandbox.js +77 -2
- package/dist/web/app.css +505 -4
- package/dist/web/app.js +20 -20
- package/dist/web/index.html +2 -1
- package/package.json +5 -3
- package/template/lua.skill.yaml +8 -5
- package/template/package.json +2 -1
- package/template/src/index.ts +27 -2
- package/template/src/tools/CustomDataTool.ts +116 -0
- package/template/src/tools/ProductsTool.ts +126 -7
- package/template/package-lock.json +0 -1511
package/dist/services/api.d.ts
CHANGED
|
@@ -158,6 +158,165 @@ export interface SearchProductsResponse {
|
|
|
158
158
|
message: string;
|
|
159
159
|
data: Product[];
|
|
160
160
|
}
|
|
161
|
+
export interface BasketItem {
|
|
162
|
+
id: string;
|
|
163
|
+
price: number;
|
|
164
|
+
quantity: number;
|
|
165
|
+
SKU?: string;
|
|
166
|
+
addedAt?: string;
|
|
167
|
+
[key: string]: any;
|
|
168
|
+
}
|
|
169
|
+
export interface Basket {
|
|
170
|
+
id: string;
|
|
171
|
+
userId: string;
|
|
172
|
+
agentId: string;
|
|
173
|
+
data: {
|
|
174
|
+
currency: string;
|
|
175
|
+
items: BasketItem[];
|
|
176
|
+
createdAt: string;
|
|
177
|
+
};
|
|
178
|
+
common: {
|
|
179
|
+
status: 'active' | 'checked_out' | 'abandoned' | 'expired';
|
|
180
|
+
totalAmount: string | number;
|
|
181
|
+
itemCount: number;
|
|
182
|
+
};
|
|
183
|
+
createdAt: string;
|
|
184
|
+
updatedAt: string;
|
|
185
|
+
__v: number;
|
|
186
|
+
}
|
|
187
|
+
export interface CreateBasketRequest {
|
|
188
|
+
currency: string;
|
|
189
|
+
}
|
|
190
|
+
export interface CreateBasketResponse {
|
|
191
|
+
success: boolean;
|
|
192
|
+
message: string;
|
|
193
|
+
data: Basket;
|
|
194
|
+
}
|
|
195
|
+
export interface GetBasketsResponse {
|
|
196
|
+
success: boolean;
|
|
197
|
+
message: string;
|
|
198
|
+
data: Basket[];
|
|
199
|
+
}
|
|
200
|
+
export interface AddItemToBasketRequest {
|
|
201
|
+
id: string;
|
|
202
|
+
price: number;
|
|
203
|
+
quantity: number;
|
|
204
|
+
[key: string]: any;
|
|
205
|
+
}
|
|
206
|
+
export interface AddItemToBasketResponse {
|
|
207
|
+
success: boolean;
|
|
208
|
+
message: string;
|
|
209
|
+
data: Basket;
|
|
210
|
+
}
|
|
211
|
+
export interface RemoveItemFromBasketResponse {
|
|
212
|
+
success: boolean;
|
|
213
|
+
message: string;
|
|
214
|
+
data: Basket;
|
|
215
|
+
}
|
|
216
|
+
export interface ClearBasketResponse {
|
|
217
|
+
success: boolean;
|
|
218
|
+
message: string;
|
|
219
|
+
data: Basket;
|
|
220
|
+
}
|
|
221
|
+
export interface UpdateBasketStatusResponse {
|
|
222
|
+
success: boolean;
|
|
223
|
+
message: string;
|
|
224
|
+
data: Basket;
|
|
225
|
+
}
|
|
226
|
+
export interface Order {
|
|
227
|
+
id: string;
|
|
228
|
+
userId: string;
|
|
229
|
+
agentId: string;
|
|
230
|
+
orderId: string;
|
|
231
|
+
data: {
|
|
232
|
+
currency: string;
|
|
233
|
+
items: BasketItem[];
|
|
234
|
+
createdAt: string;
|
|
235
|
+
basketId: string;
|
|
236
|
+
orderDate: string;
|
|
237
|
+
orderId: string;
|
|
238
|
+
[key: string]: any;
|
|
239
|
+
};
|
|
240
|
+
common: {
|
|
241
|
+
status: 'pending' | 'confirmed' | 'fulfilled' | 'cancelled';
|
|
242
|
+
totalAmount: string | number;
|
|
243
|
+
currency: string;
|
|
244
|
+
itemCount: number;
|
|
245
|
+
};
|
|
246
|
+
createdAt: string;
|
|
247
|
+
updatedAt: string;
|
|
248
|
+
__v: number;
|
|
249
|
+
}
|
|
250
|
+
export interface CreateOrderRequest {
|
|
251
|
+
basketId: string;
|
|
252
|
+
data: {
|
|
253
|
+
[key: string]: any;
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
export interface CreateOrderResponse {
|
|
257
|
+
success: boolean;
|
|
258
|
+
message: string;
|
|
259
|
+
data: Order;
|
|
260
|
+
}
|
|
261
|
+
export interface UpdateOrderStatusResponse {
|
|
262
|
+
success: boolean;
|
|
263
|
+
message: string;
|
|
264
|
+
data: Order;
|
|
265
|
+
}
|
|
266
|
+
export interface GetUserOrdersResponse {
|
|
267
|
+
success: boolean;
|
|
268
|
+
message: string;
|
|
269
|
+
data: Order[];
|
|
270
|
+
}
|
|
271
|
+
export type BasketStatus = 'active' | 'checked_out' | 'abandoned' | 'expired';
|
|
272
|
+
export type OrderStatus = 'pending' | 'confirmed' | 'fulfilled' | 'cancelled';
|
|
273
|
+
export interface CustomDataEntry {
|
|
274
|
+
id: string;
|
|
275
|
+
data: any;
|
|
276
|
+
createdAt: number;
|
|
277
|
+
updatedAt: number;
|
|
278
|
+
searchText?: string;
|
|
279
|
+
}
|
|
280
|
+
export interface CreateCustomDataRequest {
|
|
281
|
+
data: any;
|
|
282
|
+
searchText?: string;
|
|
283
|
+
}
|
|
284
|
+
export interface CreateCustomDataResponse {
|
|
285
|
+
id: string;
|
|
286
|
+
data: any;
|
|
287
|
+
createdAt: number;
|
|
288
|
+
updatedAt: number;
|
|
289
|
+
searchText?: string;
|
|
290
|
+
}
|
|
291
|
+
export interface GetCustomDataResponse {
|
|
292
|
+
data: CustomDataEntry[];
|
|
293
|
+
pagination: {
|
|
294
|
+
currentPage: number;
|
|
295
|
+
totalPages: number;
|
|
296
|
+
totalCount: number;
|
|
297
|
+
limit: number;
|
|
298
|
+
hasNextPage: boolean;
|
|
299
|
+
hasPrevPage: boolean;
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
export interface UpdateCustomDataRequest {
|
|
303
|
+
data: any;
|
|
304
|
+
searchText?: string;
|
|
305
|
+
}
|
|
306
|
+
export interface UpdateCustomDataResponse {
|
|
307
|
+
status: string;
|
|
308
|
+
message: string;
|
|
309
|
+
}
|
|
310
|
+
export interface SearchCustomDataResponse {
|
|
311
|
+
data: Array<CustomDataEntry & {
|
|
312
|
+
score: number;
|
|
313
|
+
}>;
|
|
314
|
+
count: number;
|
|
315
|
+
}
|
|
316
|
+
export interface DeleteCustomDataResponse {
|
|
317
|
+
status: string;
|
|
318
|
+
message: string;
|
|
319
|
+
}
|
|
161
320
|
/**
|
|
162
321
|
* Authentication API calls
|
|
163
322
|
*/
|
|
@@ -219,23 +378,101 @@ export declare class ProductApi {
|
|
|
219
378
|
/**
|
|
220
379
|
* Get all products for an agent with pagination
|
|
221
380
|
*/
|
|
222
|
-
static getProducts(apiKey: string, agentId: string, page?: number, limit?: number): Promise<
|
|
381
|
+
static getProducts(apiKey: string, agentId: string, page?: number, limit?: number): Promise<ProductsResponse | {
|
|
382
|
+
success: false;
|
|
383
|
+
message: string;
|
|
384
|
+
}>;
|
|
223
385
|
/**
|
|
224
386
|
* Create a new product
|
|
225
387
|
*/
|
|
226
|
-
static createProduct(apiKey: string, agentId: string, productData: Product): Promise<
|
|
388
|
+
static createProduct(apiKey: string, agentId: string, productData: Product): Promise<CreateProductResponse | {
|
|
389
|
+
success: false;
|
|
390
|
+
message: string;
|
|
391
|
+
}>;
|
|
227
392
|
/**
|
|
228
393
|
* Update an existing product
|
|
229
394
|
*/
|
|
230
|
-
static updateProduct(apiKey: string, agentId: string, productData: Product): Promise<
|
|
395
|
+
static updateProduct(apiKey: string, agentId: string, productData: Product): Promise<UpdateProductResponse | {
|
|
396
|
+
success: false;
|
|
397
|
+
message: string;
|
|
398
|
+
}>;
|
|
231
399
|
/**
|
|
232
400
|
* Delete a product
|
|
233
401
|
*/
|
|
234
|
-
static deleteProduct(apiKey: string, agentId: string, productId: string): Promise<
|
|
402
|
+
static deleteProduct(apiKey: string, agentId: string, productId: string): Promise<DeleteProductResponse | {
|
|
403
|
+
success: false;
|
|
404
|
+
message: string;
|
|
405
|
+
}>;
|
|
235
406
|
/**
|
|
236
407
|
* Search products by text query
|
|
237
408
|
*/
|
|
238
|
-
static searchProducts(apiKey: string, agentId: string, searchQuery: string): Promise<
|
|
409
|
+
static searchProducts(apiKey: string, agentId: string, searchQuery: string): Promise<SearchProductsResponse | {
|
|
410
|
+
success: false;
|
|
411
|
+
message: string;
|
|
412
|
+
}>;
|
|
413
|
+
/**
|
|
414
|
+
* Create a new user basket
|
|
415
|
+
*/
|
|
416
|
+
static createBasket(apiKey: string, agentId: string, basketData: CreateBasketRequest): Promise<CreateBasketResponse | {
|
|
417
|
+
success: false;
|
|
418
|
+
message: string;
|
|
419
|
+
}>;
|
|
420
|
+
/**
|
|
421
|
+
* Get all user baskets with optional status filter
|
|
422
|
+
*/
|
|
423
|
+
static getUserBaskets(apiKey: string, agentId: string, status?: BasketStatus): Promise<GetBasketsResponse | {
|
|
424
|
+
success: false;
|
|
425
|
+
message: string;
|
|
426
|
+
}>;
|
|
427
|
+
/**
|
|
428
|
+
* Add item to basket
|
|
429
|
+
*/
|
|
430
|
+
static addItemToBasket(apiKey: string, agentId: string, basketId: string, itemData: AddItemToBasketRequest): Promise<AddItemToBasketResponse | {
|
|
431
|
+
success: false;
|
|
432
|
+
message: string;
|
|
433
|
+
}>;
|
|
434
|
+
/**
|
|
435
|
+
* Remove item from basket
|
|
436
|
+
*/
|
|
437
|
+
static removeItemFromBasket(apiKey: string, agentId: string, basketId: string, itemId: string): Promise<RemoveItemFromBasketResponse | {
|
|
438
|
+
success: false;
|
|
439
|
+
message: string;
|
|
440
|
+
}>;
|
|
441
|
+
/**
|
|
442
|
+
* Clear basket (remove all items)
|
|
443
|
+
*/
|
|
444
|
+
static clearBasket(apiKey: string, agentId: string, basketId: string): Promise<ClearBasketResponse | {
|
|
445
|
+
success: false;
|
|
446
|
+
message: string;
|
|
447
|
+
}>;
|
|
448
|
+
/**
|
|
449
|
+
* Update basket status
|
|
450
|
+
*/
|
|
451
|
+
static updateBasketStatus(apiKey: string, agentId: string, basketId: string, status: BasketStatus): Promise<UpdateBasketStatusResponse | {
|
|
452
|
+
success: false;
|
|
453
|
+
message: string;
|
|
454
|
+
}>;
|
|
455
|
+
/**
|
|
456
|
+
* Create order from basket
|
|
457
|
+
*/
|
|
458
|
+
static createOrder(apiKey: string, agentId: string, orderData: CreateOrderRequest): Promise<CreateOrderResponse | {
|
|
459
|
+
success: false;
|
|
460
|
+
message: string;
|
|
461
|
+
}>;
|
|
462
|
+
/**
|
|
463
|
+
* Update order status
|
|
464
|
+
*/
|
|
465
|
+
static updateOrderStatus(apiKey: string, agentId: string, orderId: string, status: OrderStatus): Promise<UpdateOrderStatusResponse | {
|
|
466
|
+
success: false;
|
|
467
|
+
message: string;
|
|
468
|
+
}>;
|
|
469
|
+
/**
|
|
470
|
+
* Get user orders with optional status filter
|
|
471
|
+
*/
|
|
472
|
+
static getUserOrders(apiKey: string, agentId: string, userId: string, status?: OrderStatus): Promise<GetUserOrdersResponse | {
|
|
473
|
+
success: false;
|
|
474
|
+
message: string;
|
|
475
|
+
}>;
|
|
239
476
|
}
|
|
240
477
|
/**
|
|
241
478
|
* Tool API calls (for compile command)
|
|
@@ -253,6 +490,50 @@ export declare class UserDataApi {
|
|
|
253
490
|
static updateUserData(apiKey: string, agentId: string, data: any): Promise<ApiResponse<any>>;
|
|
254
491
|
static deleteUserData(apiKey: string, agentId: string): Promise<ApiResponse<any>>;
|
|
255
492
|
}
|
|
493
|
+
export declare class CustomDataApi {
|
|
494
|
+
/**
|
|
495
|
+
* Create a new custom data entry
|
|
496
|
+
*/
|
|
497
|
+
static createCustomData(apiKey: string, agentId: string, collectionName: string, data: CreateCustomDataRequest): Promise<CreateCustomDataResponse | {
|
|
498
|
+
success: false;
|
|
499
|
+
message: string;
|
|
500
|
+
}>;
|
|
501
|
+
/**
|
|
502
|
+
* Get custom data entries with optional filtering and pagination
|
|
503
|
+
*/
|
|
504
|
+
static getCustomData(apiKey: string, agentId: string, collectionName: string, filter?: any, page?: number, limit?: number): Promise<GetCustomDataResponse | {
|
|
505
|
+
success: false;
|
|
506
|
+
message: string;
|
|
507
|
+
}>;
|
|
508
|
+
/**
|
|
509
|
+
* Get a single custom data entry by ID
|
|
510
|
+
*/
|
|
511
|
+
static getCustomDataEntry(apiKey: string, agentId: string, collectionName: string, entryId: string): Promise<CustomDataEntry | {
|
|
512
|
+
success: false;
|
|
513
|
+
message: string;
|
|
514
|
+
}>;
|
|
515
|
+
/**
|
|
516
|
+
* Update a custom data entry
|
|
517
|
+
*/
|
|
518
|
+
static updateCustomData(apiKey: string, agentId: string, collectionName: string, entryId: string, data: UpdateCustomDataRequest): Promise<UpdateCustomDataResponse | {
|
|
519
|
+
success: false;
|
|
520
|
+
message: string;
|
|
521
|
+
}>;
|
|
522
|
+
/**
|
|
523
|
+
* Search custom data entries by text
|
|
524
|
+
*/
|
|
525
|
+
static searchCustomData(apiKey: string, agentId: string, collectionName: string, searchText: string, limit?: number, scoreThreshold?: number): Promise<SearchCustomDataResponse | {
|
|
526
|
+
success: false;
|
|
527
|
+
message: string;
|
|
528
|
+
}>;
|
|
529
|
+
/**
|
|
530
|
+
* Delete a custom data entry
|
|
531
|
+
*/
|
|
532
|
+
static deleteCustomData(apiKey: string, agentId: string, collectionName: string, entryId: string): Promise<DeleteCustomDataResponse | {
|
|
533
|
+
success: false;
|
|
534
|
+
message: string;
|
|
535
|
+
}>;
|
|
536
|
+
}
|
|
256
537
|
/**
|
|
257
538
|
* Main API service that exports all API classes
|
|
258
539
|
*/
|
|
@@ -263,4 +544,6 @@ export declare const ApiService: {
|
|
|
263
544
|
Chat: typeof ChatApi;
|
|
264
545
|
Product: typeof ProductApi;
|
|
265
546
|
Tool: typeof ToolApi;
|
|
547
|
+
UserData: typeof UserDataApi;
|
|
548
|
+
CustomData: typeof CustomDataApi;
|
|
266
549
|
};
|