lua-cli 2.2.7 → 2.2.8-alpha.2
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/api/agent.api.service.d.ts +18 -0
- package/dist/api/agent.api.service.js +30 -0
- package/dist/api/auth.api.service.d.ts +19 -0
- package/dist/api/auth.api.service.js +25 -0
- package/dist/api/basket.api.service.d.ts +43 -0
- package/dist/api/basket.api.service.js +115 -0
- package/dist/api/chat.api.service.d.ts +9 -0
- package/dist/api/chat.api.service.js +12 -0
- package/dist/api/custom.data.api.service.d.ts +33 -0
- package/dist/api/custom.data.api.service.js +91 -0
- package/dist/api/order.api.service.d.ts +23 -0
- package/dist/api/order.api.service.js +57 -0
- package/dist/api/products.api.service.d.ts +36 -0
- package/dist/api/products.api.service.js +74 -0
- package/dist/api/skills.api.service.d.ts +30 -0
- package/dist/api/skills.api.service.js +42 -0
- package/dist/api/tool.api.service.d.ts +14 -0
- package/dist/api/tool.api.service.js +35 -0
- package/dist/api/user.data.api.service.d.ts +11 -0
- package/dist/api/user.data.api.service.js +37 -0
- package/dist/api-exports.d.ts +40 -0
- package/dist/api-exports.js +189 -0
- package/dist/commands/dev.js +22 -17
- package/dist/common/basket.instance.d.ts +27 -0
- package/dist/common/basket.instance.js +79 -0
- package/dist/common/config.d.ts +5 -0
- package/dist/common/config.js +5 -0
- package/dist/common/data.entry.instance.d.ts +16 -0
- package/dist/common/data.entry.instance.js +52 -0
- package/dist/common/http.client.d.ts +14 -0
- package/dist/common/http.client.js +83 -0
- package/dist/common/order.instance.d.ts +18 -0
- package/dist/common/order.instance.js +52 -0
- package/dist/common/product.instance.d.ts +12 -0
- package/dist/common/product.instance.js +45 -0
- package/dist/common/product.pagination.instance.d.ts +23 -0
- package/dist/common/product.pagination.instance.js +53 -0
- package/dist/common/product.search.instance.d.ts +12 -0
- package/dist/common/product.search.instance.js +29 -0
- package/dist/common/user.instance.d.ts +17 -0
- package/dist/common/user.instance.js +63 -0
- package/dist/interfaces/admin.d.ts +95 -0
- package/dist/interfaces/admin.js +1 -0
- package/dist/interfaces/agent.d.ts +86 -0
- package/dist/interfaces/agent.js +1 -0
- package/dist/interfaces/baskets.d.ts +75 -0
- package/dist/interfaces/baskets.js +7 -0
- package/dist/interfaces/chat.d.ts +17 -0
- package/dist/interfaces/chat.js +1 -0
- package/dist/interfaces/custom.data.d.ts +52 -0
- package/dist/interfaces/custom.data.js +1 -0
- package/dist/interfaces/orders.d.ts +54 -0
- package/dist/interfaces/orders.js +7 -0
- package/dist/interfaces/product.d.ts +37 -0
- package/dist/interfaces/product.js +1 -0
- package/dist/product-api.d.ts +2 -10
- package/dist/product-api.js +3 -14
- package/dist/services/api.d.ts +3 -23
- package/dist/services/api.js +2 -31
- package/dist/services/auth.d.ts +1 -1
- package/dist/skill.js +2 -4
- package/dist/types/index.d.ts +36 -0
- package/dist/utils/sandbox.js +3 -7
- package/package.json +8 -12
- package/template/lua.skill.yaml +3 -12
- package/template/package-lock.json +3781 -0
- package/template/package.json +1 -1
- package/template/src/index.ts +200 -99
- package/template/src/tools/UserDataTool.ts +6 -7
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ChatMessage {
|
|
2
|
+
type: 'text';
|
|
3
|
+
text: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ChatRequest {
|
|
6
|
+
messages: ChatMessage[];
|
|
7
|
+
navigate: boolean;
|
|
8
|
+
skillOverride: Array<{
|
|
9
|
+
skillId: string;
|
|
10
|
+
sandboxId: string;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
export interface ChatResponse {
|
|
14
|
+
success: boolean;
|
|
15
|
+
text?: string;
|
|
16
|
+
error?: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface CustomDataEntry {
|
|
2
|
+
id: string;
|
|
3
|
+
data: any;
|
|
4
|
+
createdAt: number;
|
|
5
|
+
updatedAt: number;
|
|
6
|
+
searchText?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CreateCustomDataRequest {
|
|
9
|
+
data: any;
|
|
10
|
+
searchText?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface CreateCustomDataResponse {
|
|
13
|
+
id: string;
|
|
14
|
+
data: any;
|
|
15
|
+
createdAt: number;
|
|
16
|
+
updatedAt: number;
|
|
17
|
+
searchText?: string;
|
|
18
|
+
score?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface GetCustomDataResponse {
|
|
21
|
+
data: CustomDataEntry[];
|
|
22
|
+
pagination: {
|
|
23
|
+
currentPage: number;
|
|
24
|
+
totalPages: number;
|
|
25
|
+
totalCount: number;
|
|
26
|
+
limit: number;
|
|
27
|
+
hasNextPage: boolean;
|
|
28
|
+
hasPrevPage: boolean;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface UpdateCustomDataRequest {
|
|
32
|
+
data: any;
|
|
33
|
+
searchText?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface UpdateCustomDataResponse {
|
|
36
|
+
status: string;
|
|
37
|
+
message: string;
|
|
38
|
+
}
|
|
39
|
+
export interface SearchCustomDataResponse {
|
|
40
|
+
data: Array<CustomDataEntry & {
|
|
41
|
+
score: number;
|
|
42
|
+
}>;
|
|
43
|
+
count: number;
|
|
44
|
+
}
|
|
45
|
+
export interface DeleteCustomDataResponse {
|
|
46
|
+
status: string;
|
|
47
|
+
message: string;
|
|
48
|
+
}
|
|
49
|
+
export interface UpdateBasketMetadataResponse {
|
|
50
|
+
status: string;
|
|
51
|
+
message: string;
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { BasketItem } from "./baskets.js";
|
|
2
|
+
export declare enum OrderStatus {
|
|
3
|
+
PENDING = "pending",
|
|
4
|
+
CONFIRMED = "confirmed",
|
|
5
|
+
FULFILLED = "fulfilled",
|
|
6
|
+
CANCELLED = "cancelled"
|
|
7
|
+
}
|
|
8
|
+
export interface OrderData {
|
|
9
|
+
currency: string;
|
|
10
|
+
items: BasketItem[];
|
|
11
|
+
createdAt: string;
|
|
12
|
+
basketId: string;
|
|
13
|
+
orderDate: string;
|
|
14
|
+
orderId: string;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
export interface OrderCommon {
|
|
18
|
+
status: 'pending' | 'confirmed' | 'fulfilled' | 'cancelled';
|
|
19
|
+
totalAmount: string | number;
|
|
20
|
+
currency: string;
|
|
21
|
+
itemCount: number;
|
|
22
|
+
}
|
|
23
|
+
export interface OrderResponse {
|
|
24
|
+
id: string;
|
|
25
|
+
userId: string;
|
|
26
|
+
agentId: string;
|
|
27
|
+
orderId: string;
|
|
28
|
+
data: OrderData;
|
|
29
|
+
common: OrderCommon;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
__v: number;
|
|
33
|
+
}
|
|
34
|
+
export interface CreateOrderRequest {
|
|
35
|
+
basketId: string;
|
|
36
|
+
data: {
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface CreateOrderResponse {
|
|
41
|
+
success: boolean;
|
|
42
|
+
message: string;
|
|
43
|
+
data: OrderResponse;
|
|
44
|
+
}
|
|
45
|
+
export interface UpdateOrderStatusResponse {
|
|
46
|
+
success: boolean;
|
|
47
|
+
message: string;
|
|
48
|
+
data: OrderResponse;
|
|
49
|
+
}
|
|
50
|
+
export interface GetUserOrdersResponse {
|
|
51
|
+
success: boolean;
|
|
52
|
+
message: string;
|
|
53
|
+
data: OrderResponse[];
|
|
54
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface Product {
|
|
2
|
+
id: string;
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
export interface ProductsResponse {
|
|
6
|
+
success: boolean;
|
|
7
|
+
data?: Product[];
|
|
8
|
+
message?: string;
|
|
9
|
+
pagination?: {
|
|
10
|
+
currentPage: number;
|
|
11
|
+
totalPages: number;
|
|
12
|
+
totalCount: number;
|
|
13
|
+
limit: number;
|
|
14
|
+
hasNextPage: boolean;
|
|
15
|
+
hasPrevPage: boolean;
|
|
16
|
+
nextPage: number | null;
|
|
17
|
+
prevPage: number | null;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface CreateProductResponse {
|
|
21
|
+
updated: boolean;
|
|
22
|
+
isNew: boolean;
|
|
23
|
+
product: Product;
|
|
24
|
+
}
|
|
25
|
+
export interface UpdateProductResponse {
|
|
26
|
+
updated: boolean;
|
|
27
|
+
isNew: boolean;
|
|
28
|
+
product: Product;
|
|
29
|
+
}
|
|
30
|
+
export interface DeleteProductResponse {
|
|
31
|
+
deleted: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface SearchProductsResponse {
|
|
34
|
+
success: boolean;
|
|
35
|
+
message: string;
|
|
36
|
+
data: Product[];
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/product-api.d.ts
CHANGED
|
@@ -48,7 +48,6 @@ export interface Basket {
|
|
|
48
48
|
agentId: string;
|
|
49
49
|
data: {
|
|
50
50
|
currency: string;
|
|
51
|
-
metadata?: any;
|
|
52
51
|
items: BasketItem[];
|
|
53
52
|
createdAt: string;
|
|
54
53
|
};
|
|
@@ -63,7 +62,6 @@ export interface Basket {
|
|
|
63
62
|
}
|
|
64
63
|
export interface CreateBasketRequest {
|
|
65
64
|
currency: string;
|
|
66
|
-
metadata?: any;
|
|
67
65
|
}
|
|
68
66
|
export interface CreateBasketResponse {
|
|
69
67
|
success: boolean;
|
|
@@ -146,10 +144,6 @@ export interface GetUserOrdersResponse {
|
|
|
146
144
|
message: string;
|
|
147
145
|
data: Order[];
|
|
148
146
|
}
|
|
149
|
-
export interface UpdateBasketMetadataResponse {
|
|
150
|
-
success: boolean;
|
|
151
|
-
message: string;
|
|
152
|
-
}
|
|
153
147
|
export type BasketStatus = 'active' | 'checked_out' | 'abandoned' | 'expired';
|
|
154
148
|
export type OrderStatus = 'pending' | 'confirmed' | 'fulfilled' | 'cancelled';
|
|
155
149
|
export declare class ProductAPI {
|
|
@@ -163,7 +157,6 @@ export declare class ProductAPI {
|
|
|
163
157
|
delete(productId: string): Promise<DeleteProductResponse>;
|
|
164
158
|
search(searchQuery: string): Promise<SearchProductsResponse>;
|
|
165
159
|
createBasket(data: CreateBasketRequest): Promise<CreateBasketResponse>;
|
|
166
|
-
updateBasketMetadata(basketId: string, metadata: any): Promise<UpdateBasketMetadataResponse>;
|
|
167
160
|
getBaskets(status?: BasketStatus): Promise<GetBasketsResponse>;
|
|
168
161
|
addItemToBasket(basketId: string, data: AddItemToBasketRequest): Promise<AddItemToBasketResponse>;
|
|
169
162
|
removeItemFromBasket(basketId: string, itemId: string): Promise<RemoveItemFromBasketResponse>;
|
|
@@ -171,7 +164,7 @@ export declare class ProductAPI {
|
|
|
171
164
|
updateBasketStatus(basketId: string, status: BasketStatus): Promise<UpdateBasketStatusResponse>;
|
|
172
165
|
createOrder(data: CreateOrderRequest): Promise<CreateOrderResponse>;
|
|
173
166
|
updateOrderStatus(orderId: string, status: OrderStatus): Promise<UpdateOrderStatusResponse>;
|
|
174
|
-
getUserOrders(): Promise<GetUserOrdersResponse>;
|
|
167
|
+
getUserOrders(userId: string): Promise<GetUserOrdersResponse>;
|
|
175
168
|
}
|
|
176
169
|
export declare const product: {
|
|
177
170
|
create: (data: Record<string, any>) => Promise<CreateProductResponse>;
|
|
@@ -187,11 +180,10 @@ export declare const product: {
|
|
|
187
180
|
removeItem: (basketId: string, itemId: string) => Promise<RemoveItemFromBasketResponse>;
|
|
188
181
|
clear: (basketId: string) => Promise<ClearBasketResponse>;
|
|
189
182
|
updateStatus: (basketId: string, status: BasketStatus) => Promise<UpdateBasketStatusResponse>;
|
|
190
|
-
updateMetadata: (basketId: string, metadata: any) => Promise<UpdateBasketMetadataResponse>;
|
|
191
183
|
};
|
|
192
184
|
order: {
|
|
193
185
|
create: (data: CreateOrderRequest) => Promise<CreateOrderResponse>;
|
|
194
186
|
updateStatus: (orderId: string, status: OrderStatus) => Promise<UpdateOrderStatusResponse>;
|
|
195
|
-
get: () => Promise<GetUserOrdersResponse>;
|
|
187
|
+
get: (userId: string) => Promise<GetUserOrdersResponse>;
|
|
196
188
|
};
|
|
197
189
|
};
|
package/dist/product-api.js
CHANGED
|
@@ -62,16 +62,6 @@ export class ProductAPI {
|
|
|
62
62
|
this.baskets.push(basket);
|
|
63
63
|
return { success: true, message: 'Basket created successfully', data: basket };
|
|
64
64
|
}
|
|
65
|
-
async updateBasketMetadata(basketId, metadata) {
|
|
66
|
-
const basket = this.baskets.find((basket) => basket.id === basketId);
|
|
67
|
-
if (basket) {
|
|
68
|
-
basket.data.metadata = metadata;
|
|
69
|
-
return { success: true, message: 'Basket metadata updated successfully' };
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
return { success: false, message: 'Basket not found' };
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
65
|
async getBaskets(status) {
|
|
76
66
|
if (status) {
|
|
77
67
|
return { success: true, message: 'Baskets fetched successfully', data: this.baskets.filter((basket) => basket.common.status === status) };
|
|
@@ -123,8 +113,8 @@ export class ProductAPI {
|
|
|
123
113
|
}
|
|
124
114
|
return { success: false, message: 'Order not found', data: null };
|
|
125
115
|
}
|
|
126
|
-
async getUserOrders() {
|
|
127
|
-
return { success: true, message: 'User orders fetched successfully', data: this.orders };
|
|
116
|
+
async getUserOrders(userId) {
|
|
117
|
+
return { success: true, message: 'User orders fetched successfully', data: this.orders.filter((order) => order.userId === userId) };
|
|
128
118
|
}
|
|
129
119
|
}
|
|
130
120
|
const productAPI = new ProductAPI();
|
|
@@ -141,8 +131,7 @@ export const product = {
|
|
|
141
131
|
addItem: productAPI.addItemToBasket,
|
|
142
132
|
removeItem: productAPI.removeItemFromBasket,
|
|
143
133
|
clear: productAPI.clearBasket,
|
|
144
|
-
updateStatus: productAPI.updateBasketStatus
|
|
145
|
-
updateMetadata: productAPI.updateBasketMetadata
|
|
134
|
+
updateStatus: productAPI.updateBasketStatus
|
|
146
135
|
},
|
|
147
136
|
order: {
|
|
148
137
|
create: productAPI.createOrder,
|
package/dist/services/api.d.ts
CHANGED
|
@@ -172,7 +172,6 @@ export interface Basket {
|
|
|
172
172
|
agentId: string;
|
|
173
173
|
data: {
|
|
174
174
|
currency: string;
|
|
175
|
-
metadata?: any;
|
|
176
175
|
items: BasketItem[];
|
|
177
176
|
createdAt: string;
|
|
178
177
|
};
|
|
@@ -187,7 +186,6 @@ export interface Basket {
|
|
|
187
186
|
}
|
|
188
187
|
export interface CreateBasketRequest {
|
|
189
188
|
currency: string;
|
|
190
|
-
metadata?: any;
|
|
191
189
|
}
|
|
192
190
|
export interface CreateBasketResponse {
|
|
193
191
|
success: boolean;
|
|
@@ -270,18 +268,8 @@ export interface GetUserOrdersResponse {
|
|
|
270
268
|
message: string;
|
|
271
269
|
data: Order[];
|
|
272
270
|
}
|
|
273
|
-
export
|
|
274
|
-
|
|
275
|
-
CHECKED_OUT = "checked_out",
|
|
276
|
-
ABANDONED = "abandoned",
|
|
277
|
-
EXPIRED = "expired"
|
|
278
|
-
}
|
|
279
|
-
export declare enum OrderStatus {
|
|
280
|
-
PENDING = "pending",
|
|
281
|
-
CONFIRMED = "confirmed",
|
|
282
|
-
FULFILLED = "fulfilled",
|
|
283
|
-
CANCELLED = "cancelled"
|
|
284
|
-
}
|
|
271
|
+
export type BasketStatus = 'active' | 'checked_out' | 'abandoned' | 'expired';
|
|
272
|
+
export type OrderStatus = 'pending' | 'confirmed' | 'fulfilled' | 'cancelled';
|
|
285
273
|
export interface CustomDataEntry {
|
|
286
274
|
id: string;
|
|
287
275
|
data: any;
|
|
@@ -329,10 +317,6 @@ export interface DeleteCustomDataResponse {
|
|
|
329
317
|
status: string;
|
|
330
318
|
message: string;
|
|
331
319
|
}
|
|
332
|
-
export interface UpdateBasketMetadataResponse {
|
|
333
|
-
status: string;
|
|
334
|
-
message: string;
|
|
335
|
-
}
|
|
336
320
|
/**
|
|
337
321
|
* Authentication API calls
|
|
338
322
|
*/
|
|
@@ -468,10 +452,6 @@ export declare class ProductApi {
|
|
|
468
452
|
success: false;
|
|
469
453
|
message: string;
|
|
470
454
|
}>;
|
|
471
|
-
static updateBasketMetadata(apiKey: string, agentId: string, basketId: string, metadata: any): Promise<UpdateBasketMetadataResponse | {
|
|
472
|
-
success: false;
|
|
473
|
-
message: string;
|
|
474
|
-
}>;
|
|
475
455
|
/**
|
|
476
456
|
* Create order from basket
|
|
477
457
|
*/
|
|
@@ -489,7 +469,7 @@ export declare class ProductApi {
|
|
|
489
469
|
/**
|
|
490
470
|
* Get user orders with optional status filter
|
|
491
471
|
*/
|
|
492
|
-
static getUserOrders(apiKey: string, agentId: string, status?: OrderStatus): Promise<GetUserOrdersResponse | {
|
|
472
|
+
static getUserOrders(apiKey: string, agentId: string, userId: string, status?: OrderStatus): Promise<GetUserOrdersResponse | {
|
|
493
473
|
success: false;
|
|
494
474
|
message: string;
|
|
495
475
|
}>;
|
package/dist/services/api.js
CHANGED
|
@@ -9,20 +9,6 @@ const BASE_URLS = {
|
|
|
9
9
|
AUTH: 'https://auth.heylua.ai',
|
|
10
10
|
CHAT: 'https://api.heylua.ai'
|
|
11
11
|
};
|
|
12
|
-
export var BasketStatus;
|
|
13
|
-
(function (BasketStatus) {
|
|
14
|
-
BasketStatus["ACTIVE"] = "active";
|
|
15
|
-
BasketStatus["CHECKED_OUT"] = "checked_out";
|
|
16
|
-
BasketStatus["ABANDONED"] = "abandoned";
|
|
17
|
-
BasketStatus["EXPIRED"] = "expired";
|
|
18
|
-
})(BasketStatus || (BasketStatus = {}));
|
|
19
|
-
export var OrderStatus;
|
|
20
|
-
(function (OrderStatus) {
|
|
21
|
-
OrderStatus["PENDING"] = "pending";
|
|
22
|
-
OrderStatus["CONFIRMED"] = "confirmed";
|
|
23
|
-
OrderStatus["FULFILLED"] = "fulfilled";
|
|
24
|
-
OrderStatus["CANCELLED"] = "cancelled";
|
|
25
|
-
})(OrderStatus || (OrderStatus = {}));
|
|
26
12
|
/**
|
|
27
13
|
* Generic HTTP client with common error handling
|
|
28
14
|
*/
|
|
@@ -374,21 +360,6 @@ export class ProductApi {
|
|
|
374
360
|
};
|
|
375
361
|
}
|
|
376
362
|
}
|
|
377
|
-
//update basket metadata
|
|
378
|
-
static async updateBasketMetadata(apiKey, agentId, basketId, metadata) {
|
|
379
|
-
const response = await httpClient.put(`${BASE_URLS.LOCAL}/developer/agents/${agentId}/basket/${basketId}/metadata`, metadata, {
|
|
380
|
-
Authorization: `Bearer ${apiKey}`,
|
|
381
|
-
});
|
|
382
|
-
if (response.success) {
|
|
383
|
-
return response.data;
|
|
384
|
-
}
|
|
385
|
-
else {
|
|
386
|
-
return {
|
|
387
|
-
success: false,
|
|
388
|
-
message: response.error?.message || 'Failed to update basket metadata'
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
363
|
/**
|
|
393
364
|
* Create order from basket
|
|
394
365
|
*/
|
|
@@ -426,9 +397,9 @@ export class ProductApi {
|
|
|
426
397
|
/**
|
|
427
398
|
* Get user orders with optional status filter
|
|
428
399
|
*/
|
|
429
|
-
static async getUserOrders(apiKey, agentId, status) {
|
|
400
|
+
static async getUserOrders(apiKey, agentId, userId, status) {
|
|
430
401
|
const statusParam = status ? `?status=${status}` : '';
|
|
431
|
-
const response = await httpClient.get(`${BASE_URLS.LOCAL}/developer/agents/${agentId}/order/user${statusParam}`, {
|
|
402
|
+
const response = await httpClient.get(`${BASE_URLS.LOCAL}/developer/agents/${agentId}/order/user/${userId}${statusParam}`, {
|
|
432
403
|
Authorization: `Bearer ${apiKey}`,
|
|
433
404
|
});
|
|
434
405
|
if (response.success) {
|
package/dist/services/auth.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UserData } from "../types
|
|
1
|
+
import { UserData } from "../types";
|
|
2
2
|
export declare function saveApiKey(apiKey: string): Promise<void>;
|
|
3
3
|
export declare function loadApiKey(): Promise<string | null>;
|
|
4
4
|
export declare function deleteApiKey(): Promise<boolean>;
|
package/dist/skill.js
CHANGED
|
@@ -2,8 +2,6 @@ import { assertValidToolName } from "./types/index.js";
|
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import path from "path";
|
|
4
4
|
import yaml from "js-yaml";
|
|
5
|
-
import dotenv from "dotenv";
|
|
6
|
-
dotenv.config();
|
|
7
5
|
/**
|
|
8
6
|
* Safe environment variable access function
|
|
9
7
|
* Gets injected at runtime with skill-specific environment variables
|
|
@@ -24,8 +22,8 @@ export const env = (key) => {
|
|
|
24
22
|
let currentDir = process.cwd();
|
|
25
23
|
let yamlPath = null;
|
|
26
24
|
//check if in .env file
|
|
27
|
-
if (
|
|
28
|
-
return
|
|
25
|
+
if (process.env[key]) {
|
|
26
|
+
return process.env[key];
|
|
29
27
|
}
|
|
30
28
|
while (currentDir !== path.dirname(currentDir)) {
|
|
31
29
|
const potentialPath = path.join(currentDir, 'lua.skill.yaml');
|
package/dist/types/index.d.ts
CHANGED
|
@@ -85,3 +85,39 @@ export declare class LuaSkill {
|
|
|
85
85
|
addTools(tools: LuaTool<any>[]): void;
|
|
86
86
|
run(input: Record<string, any>): Promise<any>;
|
|
87
87
|
}
|
|
88
|
+
export interface UserDataAPI {
|
|
89
|
+
get(): Promise<any>;
|
|
90
|
+
update(data: Record<string, any>): Promise<any>;
|
|
91
|
+
clear(): Promise<any>;
|
|
92
|
+
}
|
|
93
|
+
export interface ProductAPI {
|
|
94
|
+
get(limit?: number, page?: number): Promise<any>;
|
|
95
|
+
create(product: any): Promise<any>;
|
|
96
|
+
update(data: any, id: string): Promise<any>;
|
|
97
|
+
delete(id: string): Promise<any>;
|
|
98
|
+
search(query: string): Promise<any>;
|
|
99
|
+
}
|
|
100
|
+
export interface BasketAPI {
|
|
101
|
+
create(basketData: any): Promise<any>;
|
|
102
|
+
get(status?: any): Promise<any>;
|
|
103
|
+
addItem(basketId: string, itemData: any): Promise<any>;
|
|
104
|
+
removeItem(basketId: string, itemId: string): Promise<any>;
|
|
105
|
+
clear(basketId: string): Promise<any>;
|
|
106
|
+
updateStatus(basketId: string, status: any): Promise<any>;
|
|
107
|
+
updateMetadata(basketId: string, metadata: any): Promise<any>;
|
|
108
|
+
placeOrder(data: Record<string, any>, basketId: string): Promise<any>;
|
|
109
|
+
}
|
|
110
|
+
export interface OrderAPI {
|
|
111
|
+
create(orderData: any): Promise<any>;
|
|
112
|
+
updateStatus(status: any, orderId: string): Promise<any>;
|
|
113
|
+
updateData(data: Record<string, any>, orderId: string): Promise<any>;
|
|
114
|
+
get(status?: any): Promise<any>;
|
|
115
|
+
}
|
|
116
|
+
export interface CustomDataAPI {
|
|
117
|
+
create(collectionName: string, data: any): Promise<any>;
|
|
118
|
+
get(collectionName: string, filter?: any, page?: number, limit?: number): Promise<any>;
|
|
119
|
+
getEntry(collectionName: string, entryId: string): Promise<any>;
|
|
120
|
+
update(collectionName: string, entryId: string, data: any): Promise<any>;
|
|
121
|
+
search(collectionName: string, searchText: string, limit?: number, scoreThreshold?: number): Promise<any>;
|
|
122
|
+
delete(collectionName: string, entryId: string): Promise<any>;
|
|
123
|
+
}
|
package/dist/utils/sandbox.js
CHANGED
|
@@ -100,17 +100,14 @@ export function createSandbox(options) {
|
|
|
100
100
|
const updateBasketStatus = async (basketId, status) => {
|
|
101
101
|
return await ProductApi.updateBasketStatus(apiKey, agentId, basketId, status);
|
|
102
102
|
};
|
|
103
|
-
const updateBasketMetadata = async (basketId, metadata) => {
|
|
104
|
-
return await ProductApi.updateBasketMetadata(apiKey, agentId, basketId, metadata);
|
|
105
|
-
};
|
|
106
103
|
const createOrder = async (data) => {
|
|
107
104
|
return await ProductApi.createOrder(apiKey, agentId, data);
|
|
108
105
|
};
|
|
109
106
|
const updateOrderStatus = async (orderId, status) => {
|
|
110
107
|
return await ProductApi.updateOrderStatus(apiKey, agentId, orderId, status);
|
|
111
108
|
};
|
|
112
|
-
const getUserOrders = async () => {
|
|
113
|
-
return await ProductApi.getUserOrders(apiKey, agentId);
|
|
109
|
+
const getUserOrders = async (userId) => {
|
|
110
|
+
return await ProductApi.getUserOrders(apiKey, agentId, userId);
|
|
114
111
|
};
|
|
115
112
|
// Custom Data API functions
|
|
116
113
|
const createCustomData = async (collectionName, data) => {
|
|
@@ -285,8 +282,7 @@ export function createSandbox(options) {
|
|
|
285
282
|
addItem: addItemToBasket,
|
|
286
283
|
removeItem: removeItemFromBasket,
|
|
287
284
|
clear: clearBasket,
|
|
288
|
-
updateStatus: updateBasketStatus
|
|
289
|
-
updateMetadata: updateBasketMetadata
|
|
285
|
+
updateStatus: updateBasketStatus
|
|
290
286
|
},
|
|
291
287
|
order: {
|
|
292
288
|
create: createOrder,
|
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lua-cli",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8-alpha.2",
|
|
4
4
|
"description": "Command-line interface for Lua AI platform - develop, test, and deploy LuaSkills with custom tools",
|
|
5
5
|
"readmeFilename": "README.md",
|
|
6
|
-
"main": "dist/
|
|
6
|
+
"main": "dist/api-exports.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"lua": "./dist/index.js"
|
|
9
|
+
},
|
|
7
10
|
"exports": {
|
|
8
|
-
".": "./dist/
|
|
9
|
-
"./
|
|
10
|
-
"./skill": "./dist/skill.js",
|
|
11
|
-
"./user-data-api": "./dist/user-data-api.js",
|
|
12
|
-
"./product-api": "./dist/product-api.js",
|
|
13
|
-
"./custom-data-api": "./dist/custom-data-api.js"
|
|
11
|
+
".": "./dist/api-exports.js",
|
|
12
|
+
"./cli": "./dist/index.js"
|
|
14
13
|
},
|
|
15
14
|
"scripts": {
|
|
16
15
|
"clean": "rm -rf dist",
|
|
@@ -65,7 +64,7 @@
|
|
|
65
64
|
"inquirer": "^12.9.6",
|
|
66
65
|
"js-yaml": "^4.1.0",
|
|
67
66
|
"keytar": "^7.9.0",
|
|
68
|
-
"lua-cli": "^2.2.
|
|
67
|
+
"lua-cli": "^2.2.8-alpha.2",
|
|
69
68
|
"node-fetch": "^3.3.2",
|
|
70
69
|
"open": "^10.1.0",
|
|
71
70
|
"react": "^18.2.0",
|
|
@@ -92,8 +91,5 @@
|
|
|
92
91
|
"ts-jest": "^29.1.1",
|
|
93
92
|
"ts-node": "^10.9.2",
|
|
94
93
|
"typescript": "^5.9.2"
|
|
95
|
-
},
|
|
96
|
-
"bin": {
|
|
97
|
-
"lua": "dist/index.js"
|
|
98
94
|
}
|
|
99
95
|
}
|
package/template/lua.skill.yaml
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
agent:
|
|
2
|
-
agentId:
|
|
2
|
+
agentId: baseAgent_agent_1759336134755_qkcomt5gf
|
|
3
3
|
orgId: 2e7fcabb-7616-4b8d-9114-b6ac121aefe5
|
|
4
4
|
skills:
|
|
5
5
|
- name: general-skill
|
|
6
|
-
version: 0.0
|
|
7
|
-
skillId:
|
|
8
|
-
- name: user-data-skill
|
|
9
|
-
version: 0.0.1
|
|
10
|
-
skillId: b551177b-aa50-42bb-9b2f-52249db9ca67
|
|
11
|
-
- name: eccomerce-skill
|
|
12
|
-
version: 0.0.1
|
|
13
|
-
skillId: b8c9b6ad-0c3c-4bac-b182-94f19f4c062d
|
|
14
|
-
- name: custom-data-skill
|
|
15
|
-
version: 0.0.1
|
|
16
|
-
skillId: bcffdbdb-4a85-4603-9ddd-2f58e743fbd2
|
|
6
|
+
version: 1.0.0
|
|
7
|
+
skillId: 15db4b79-615f-48f5-abcb-86ed4dd52578
|