lua-cli 2.2.8-alpha.1 → 2.3.0-alpha.1
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/API_REFERENCE.md +1408 -0
- package/CLI_REFERENCE.md +818 -0
- package/GETTING_STARTED.md +1040 -0
- package/README.md +738 -424
- package/TEMPLATE_GUIDE.md +1398 -0
- package/dist/api/agent.api.service.d.ts +45 -0
- package/dist/api/agent.api.service.js +57 -0
- package/dist/api/auth.api.service.d.ts +48 -0
- package/dist/api/auth.api.service.js +54 -0
- package/dist/api/basket.api.service.d.ts +85 -0
- package/dist/api/basket.api.service.js +164 -0
- package/dist/api/chat.api.service.d.ts +21 -0
- package/dist/api/chat.api.service.js +24 -0
- package/dist/api/credentials.d.ts +24 -0
- package/dist/api/credentials.js +46 -0
- package/dist/api/custom.data.api.service.d.ts +69 -0
- package/dist/api/custom.data.api.service.js +125 -0
- package/dist/api/lazy-instances.d.ts +49 -0
- package/dist/api/lazy-instances.js +95 -0
- package/dist/api/order.api.service.d.ts +53 -0
- package/dist/api/order.api.service.js +95 -0
- package/dist/api/products.api.service.d.ts +66 -0
- package/dist/api/products.api.service.js +112 -0
- package/dist/api/skills.api.service.d.ts +77 -0
- package/dist/api/skills.api.service.js +88 -0
- package/dist/api/tool.api.service.d.ts +52 -0
- package/dist/api/tool.api.service.js +73 -0
- package/dist/api/user.data.api.service.d.ts +33 -0
- package/dist/api/user.data.api.service.js +59 -0
- package/dist/api-exports.d.ts +271 -0
- package/dist/api-exports.js +372 -0
- package/dist/cli/command-definitions.d.ts +30 -0
- package/dist/cli/command-definitions.js +71 -0
- package/dist/commands/agents.d.ts +20 -0
- package/dist/commands/agents.js +24 -2
- package/dist/commands/apiKey.d.ts +23 -0
- package/dist/commands/apiKey.js +23 -0
- package/dist/commands/compile.d.ts +24 -0
- package/dist/commands/compile.js +67 -759
- package/dist/commands/configure.d.ts +24 -0
- package/dist/commands/configure.js +31 -96
- package/dist/commands/deploy.d.ts +31 -19
- package/dist/commands/deploy.js +45 -74
- package/dist/commands/destroy.d.ts +27 -0
- package/dist/commands/destroy.js +27 -1
- package/dist/commands/dev.d.ts +25 -62
- package/dist/commands/dev.js +58 -873
- package/dist/commands/init.d.ts +27 -0
- package/dist/commands/init.js +98 -260
- package/dist/commands/push.d.ts +24 -21
- package/dist/commands/push.js +39 -92
- package/dist/commands/test.d.ts +26 -0
- package/dist/commands/test.js +41 -188
- package/dist/common/basket.instance.d.ts +78 -0
- package/dist/common/basket.instance.js +132 -0
- package/dist/common/data.entry.instance.d.ts +39 -0
- package/dist/common/data.entry.instance.js +76 -0
- package/dist/common/http.client.d.ts +64 -0
- package/dist/common/http.client.js +133 -0
- package/dist/common/order.instance.d.ts +40 -0
- package/dist/common/order.instance.js +79 -0
- package/dist/common/product.instance.d.ts +33 -0
- package/dist/common/product.instance.js +63 -0
- package/dist/common/product.pagination.instance.d.ts +43 -0
- package/dist/common/product.pagination.instance.js +74 -0
- package/dist/common/product.search.instance.d.ts +22 -0
- package/dist/common/product.search.instance.js +40 -0
- package/dist/common/user.instance.d.ts +41 -0
- package/dist/common/user.instance.js +84 -0
- package/dist/config/auth.constants.d.ts +11 -0
- package/dist/config/auth.constants.js +11 -0
- package/dist/config/compile.constants.d.ts +67 -0
- package/dist/config/compile.constants.js +99 -0
- package/dist/config/constants.d.ts +5 -0
- package/dist/config/constants.js +5 -0
- package/dist/config/dev.constants.d.ts +65 -0
- package/dist/config/dev.constants.js +79 -0
- package/dist/config/init.constants.d.ts +23 -0
- package/dist/config/init.constants.js +41 -0
- package/dist/index.d.ts +19 -3
- package/dist/index.js +28 -44
- package/dist/interfaces/admin.d.ts +101 -0
- package/dist/interfaces/admin.js +5 -0
- package/dist/interfaces/agent.d.ts +107 -0
- package/dist/interfaces/agent.js +5 -0
- package/dist/interfaces/baskets.d.ts +135 -0
- package/dist/interfaces/baskets.js +19 -0
- package/dist/interfaces/chat.d.ts +61 -0
- package/dist/interfaces/chat.js +5 -0
- package/dist/interfaces/common.d.ts +62 -0
- package/dist/interfaces/common.js +8 -0
- package/dist/interfaces/compile.d.ts +11 -0
- package/dist/interfaces/compile.js +4 -0
- package/dist/interfaces/custom.data.d.ts +82 -0
- package/dist/interfaces/custom.data.js +5 -0
- package/dist/interfaces/deploy.d.ts +29 -0
- package/dist/interfaces/deploy.js +4 -0
- package/dist/interfaces/dev.d.ts +53 -0
- package/dist/interfaces/dev.js +5 -0
- package/dist/interfaces/init.d.ts +60 -0
- package/dist/interfaces/init.js +4 -0
- package/dist/interfaces/orders.d.ts +91 -0
- package/dist/interfaces/orders.js +19 -0
- package/dist/interfaces/product.d.ts +65 -0
- package/dist/interfaces/product.js +5 -0
- package/dist/interfaces/push.d.ts +26 -0
- package/dist/interfaces/push.js +4 -0
- package/dist/interfaces/test.d.ts +36 -0
- package/dist/interfaces/test.js +4 -0
- package/dist/services/auth.d.ts +54 -99
- package/dist/services/auth.js +76 -12
- package/dist/types/api-contracts.d.ts +211 -0
- package/dist/types/api-contracts.js +8 -0
- package/dist/types/compile.types.d.ts +76 -0
- package/dist/types/compile.types.js +4 -0
- package/dist/types/index.d.ts +23 -85
- package/dist/types/index.js +25 -14
- package/dist/types/skill.d.ts +142 -0
- package/dist/{skill.js → types/skill.js} +66 -19
- package/dist/types/tool-validation.d.ts +34 -0
- package/dist/types/tool-validation.js +42 -0
- package/dist/utils/auth-flows.d.ts +26 -0
- package/dist/utils/auth-flows.js +141 -0
- package/dist/utils/bundling.d.ts +36 -0
- package/dist/utils/bundling.js +137 -0
- package/dist/utils/compile.d.ts +37 -0
- package/dist/utils/compile.js +242 -0
- package/dist/utils/deploy-api.d.ts +26 -0
- package/dist/utils/deploy-api.js +53 -0
- package/dist/utils/deploy-helpers.d.ts +46 -0
- package/dist/utils/deploy-helpers.js +86 -0
- package/dist/utils/deployment.d.ts +25 -0
- package/dist/utils/deployment.js +161 -0
- package/dist/utils/dev-api.d.ts +61 -0
- package/dist/utils/dev-api.js +262 -0
- package/dist/utils/dev-helpers.d.ts +46 -0
- package/dist/utils/dev-helpers.js +83 -0
- package/dist/utils/dev-server.d.ts +24 -0
- package/dist/utils/dev-server.js +555 -0
- package/dist/utils/dev-watcher.d.ts +31 -0
- package/dist/utils/dev-watcher.js +110 -0
- package/dist/utils/files.js +0 -5
- package/dist/utils/init-agent.d.ts +34 -0
- package/dist/utils/init-agent.js +129 -0
- package/dist/utils/init-helpers.d.ts +41 -0
- package/dist/utils/init-helpers.js +73 -0
- package/dist/utils/init-prompts.d.ts +47 -0
- package/dist/utils/init-prompts.js +168 -0
- package/dist/utils/push-api.d.ts +15 -0
- package/dist/utils/push-api.js +48 -0
- package/dist/utils/push-helpers.d.ts +38 -0
- package/dist/utils/push-helpers.js +84 -0
- package/dist/utils/sandbox-storage.d.ts +27 -0
- package/dist/utils/sandbox-storage.js +71 -0
- package/dist/utils/sandbox.js +78 -118
- package/dist/utils/skill-management.d.ts +14 -0
- package/dist/utils/skill-management.js +148 -0
- package/dist/utils/test-helpers.d.ts +40 -0
- package/dist/utils/test-helpers.js +92 -0
- package/dist/utils/test-prompts.d.ts +23 -0
- package/dist/utils/test-prompts.js +186 -0
- package/dist/utils/tool-detection.d.ts +18 -0
- package/dist/utils/tool-detection.js +110 -0
- package/dist/web/app.css +14 -9
- package/package.json +11 -12
- package/template/QUICKSTART.md +299 -144
- package/template/README.md +928 -349
- package/template/TOOL_EXAMPLES.md +655 -0
- package/template/package-lock.json +3781 -0
- package/template/package.json +1 -1
- package/template/src/index.ts +81 -40
- package/template/src/tools/BasketTool.ts +128 -0
- package/template/src/tools/CustomDataTool.ts +7 -13
- package/template/src/tools/OrderTool.ts +54 -0
- package/template/src/tools/PaymentTool.ts +1 -1
- package/template/src/tools/ProductsTool.ts +56 -118
- package/template/src/tools/UserDataTool.ts +4 -27
- package/dist/custom-data-api.d.ts +0 -72
- package/dist/custom-data-api.js +0 -174
- package/dist/product-api.d.ts +0 -197
- package/dist/product-api.js +0 -152
- package/dist/services/api.d.ts +0 -569
- package/dist/services/api.js +0 -625
- package/dist/skill.d.ts +0 -50
- package/dist/types.d.ts +0 -1
- package/dist/types.js +0 -2
- package/dist/user-data-api.d.ts +0 -39
- package/dist/user-data-api.js +0 -50
- package/template/API.md +0 -604
- package/template/DEVELOPER.md +0 -771
- package/template/lua.skill.yaml +0 -16
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lua Skill API Exports
|
|
3
|
+
*
|
|
4
|
+
* Public API surface for LuaSkill tools.
|
|
5
|
+
* This module provides simplified interfaces to Lua platform APIs
|
|
6
|
+
* for use within skill implementations.
|
|
7
|
+
*
|
|
8
|
+
* Available APIs:
|
|
9
|
+
* - User: User data management
|
|
10
|
+
* - Data: Custom data collections (vector search, CRUD)
|
|
11
|
+
* - Products: Product catalog management
|
|
12
|
+
* - Baskets: Shopping basket operations
|
|
13
|
+
* - Orders: Order management
|
|
14
|
+
*
|
|
15
|
+
* Usage in skills:
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { User, Data, Products, Baskets, Orders } from 'lua-cli';
|
|
18
|
+
*
|
|
19
|
+
* // Get user data
|
|
20
|
+
* const user = await User.get();
|
|
21
|
+
*
|
|
22
|
+
* // Create custom data entry
|
|
23
|
+
* await Data.create('customers', { name: 'John' });
|
|
24
|
+
*
|
|
25
|
+
* // Search products
|
|
26
|
+
* const products = await Products.search('laptop');
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
import { LuaSkill, env } from "./types/skill.js";
|
|
30
|
+
import { BasketStatus } from "./interfaces/baskets.js";
|
|
31
|
+
import { OrderStatus } from "./interfaces/orders.js";
|
|
32
|
+
import { getUserInstance, getDataInstance, getProductsInstance, getBasketsInstance, getOrderInstance, } from "./api/lazy-instances.js";
|
|
33
|
+
// ============================================================================
|
|
34
|
+
// USER DATA API
|
|
35
|
+
// ============================================================================
|
|
36
|
+
/**
|
|
37
|
+
* User Data API
|
|
38
|
+
* Access user information and preferences
|
|
39
|
+
*/
|
|
40
|
+
export const User = {
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves current user data.
|
|
43
|
+
*
|
|
44
|
+
* @returns Promise resolving to user data
|
|
45
|
+
*/
|
|
46
|
+
async get() {
|
|
47
|
+
const instance = await getUserInstance();
|
|
48
|
+
return instance.get();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
// ============================================================================
|
|
52
|
+
// CUSTOM DATA API
|
|
53
|
+
// ============================================================================
|
|
54
|
+
/**
|
|
55
|
+
* Custom Data API
|
|
56
|
+
* Store and retrieve custom data with vector search capabilities
|
|
57
|
+
*/
|
|
58
|
+
export const Data = {
|
|
59
|
+
/**
|
|
60
|
+
* Creates a new entry in a custom data collection.
|
|
61
|
+
*
|
|
62
|
+
* @param collectionName - Name of the collection
|
|
63
|
+
* @param data - Data to store
|
|
64
|
+
* @param searchText - Optional text for vector search indexing
|
|
65
|
+
* @returns Promise resolving to created entry
|
|
66
|
+
*/
|
|
67
|
+
async create(collectionName, data, searchText) {
|
|
68
|
+
const instance = await getDataInstance();
|
|
69
|
+
return instance.create(collectionName, data, searchText);
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* Retrieves entries from a collection with optional filtering and pagination.
|
|
73
|
+
*
|
|
74
|
+
* @param collectionName - Name of the collection
|
|
75
|
+
* @param filter - Optional filter criteria
|
|
76
|
+
* @param page - Page number (default: 1)
|
|
77
|
+
* @param limit - Items per page (default: 10)
|
|
78
|
+
* @returns Promise resolving to array of entries
|
|
79
|
+
*/
|
|
80
|
+
async get(collectionName, filter, page, limit) {
|
|
81
|
+
const instance = await getDataInstance();
|
|
82
|
+
return instance.get(collectionName, filter, page, limit);
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* Retrieves a specific entry by ID.
|
|
86
|
+
*
|
|
87
|
+
* @param collectionName - Name of the collection
|
|
88
|
+
* @param entryId - ID of the entry
|
|
89
|
+
* @returns Promise resolving to entry data
|
|
90
|
+
*/
|
|
91
|
+
async getEntry(collectionName, entryId) {
|
|
92
|
+
const instance = await getDataInstance();
|
|
93
|
+
return instance.getEntry(collectionName, entryId);
|
|
94
|
+
},
|
|
95
|
+
/**
|
|
96
|
+
* Updates an existing entry.
|
|
97
|
+
*
|
|
98
|
+
* @param collectionName - Name of the collection
|
|
99
|
+
* @param entryId - ID of the entry to update
|
|
100
|
+
* @param data - Updated data
|
|
101
|
+
* @returns Promise resolving to updated entry
|
|
102
|
+
*/
|
|
103
|
+
async update(collectionName, entryId, data) {
|
|
104
|
+
const instance = await getDataInstance();
|
|
105
|
+
return instance.update(collectionName, entryId, data);
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* Performs vector search on a collection.
|
|
109
|
+
*
|
|
110
|
+
* @param collectionName - Name of the collection
|
|
111
|
+
* @param searchText - Text to search for
|
|
112
|
+
* @param limit - Maximum results to return
|
|
113
|
+
* @param scoreThreshold - Minimum similarity score (0-1)
|
|
114
|
+
* @returns Promise resolving to search results
|
|
115
|
+
*/
|
|
116
|
+
async search(collectionName, searchText, limit, scoreThreshold) {
|
|
117
|
+
const instance = await getDataInstance();
|
|
118
|
+
return instance.search(collectionName, searchText, limit, scoreThreshold);
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* Deletes an entry from a collection.
|
|
122
|
+
*
|
|
123
|
+
* @param collectionName - Name of the collection
|
|
124
|
+
* @param entryId - ID of the entry to delete
|
|
125
|
+
* @returns Promise resolving when deletion is complete
|
|
126
|
+
*/
|
|
127
|
+
async delete(collectionName, entryId) {
|
|
128
|
+
const instance = await getDataInstance();
|
|
129
|
+
return instance.delete(collectionName, entryId);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
// ============================================================================
|
|
133
|
+
// PRODUCTS API
|
|
134
|
+
// ============================================================================
|
|
135
|
+
/**
|
|
136
|
+
* Products API
|
|
137
|
+
* Manage product catalog
|
|
138
|
+
*/
|
|
139
|
+
export const Products = {
|
|
140
|
+
/**
|
|
141
|
+
* Retrieves products with pagination.
|
|
142
|
+
*
|
|
143
|
+
* @param limit - Items per page
|
|
144
|
+
* @param page - Page number
|
|
145
|
+
* @returns Promise resolving to product list
|
|
146
|
+
*/
|
|
147
|
+
async get(limit, page) {
|
|
148
|
+
const instance = await getProductsInstance();
|
|
149
|
+
return instance.get(limit, page);
|
|
150
|
+
},
|
|
151
|
+
/**
|
|
152
|
+
* Creates a new product.
|
|
153
|
+
*
|
|
154
|
+
* @param product - Product data
|
|
155
|
+
* @returns Promise resolving to created product
|
|
156
|
+
*/
|
|
157
|
+
async create(product) {
|
|
158
|
+
const instance = await getProductsInstance();
|
|
159
|
+
return instance.create(product);
|
|
160
|
+
},
|
|
161
|
+
/**
|
|
162
|
+
* Updates an existing product.
|
|
163
|
+
*
|
|
164
|
+
* @param data - Updated product data
|
|
165
|
+
* @param id - Product ID
|
|
166
|
+
* @returns Promise resolving to updated product
|
|
167
|
+
*/
|
|
168
|
+
async update(data, id) {
|
|
169
|
+
const instance = await getProductsInstance();
|
|
170
|
+
return instance.update(data, id);
|
|
171
|
+
},
|
|
172
|
+
/**
|
|
173
|
+
* Deletes a product.
|
|
174
|
+
*
|
|
175
|
+
* @param id - Product ID
|
|
176
|
+
* @returns Promise resolving when deletion is complete
|
|
177
|
+
*/
|
|
178
|
+
async delete(id) {
|
|
179
|
+
const instance = await getProductsInstance();
|
|
180
|
+
return instance.delete(id);
|
|
181
|
+
},
|
|
182
|
+
/**
|
|
183
|
+
* Searches products by query string.
|
|
184
|
+
*
|
|
185
|
+
* @param query - Search query
|
|
186
|
+
* @returns Promise resolving to search results
|
|
187
|
+
*/
|
|
188
|
+
async search(query) {
|
|
189
|
+
const instance = await getProductsInstance();
|
|
190
|
+
return instance.search(query);
|
|
191
|
+
},
|
|
192
|
+
/**
|
|
193
|
+
* Retrieves a specific product by ID.
|
|
194
|
+
*
|
|
195
|
+
* @param id - Product ID
|
|
196
|
+
* @returns Promise resolving to product data
|
|
197
|
+
*/
|
|
198
|
+
async getById(id) {
|
|
199
|
+
const instance = await getProductsInstance();
|
|
200
|
+
return instance.getById(id);
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
// ============================================================================
|
|
204
|
+
// BASKETS API
|
|
205
|
+
// ============================================================================
|
|
206
|
+
/**
|
|
207
|
+
* Baskets API
|
|
208
|
+
* Manage shopping baskets
|
|
209
|
+
*/
|
|
210
|
+
export const Baskets = {
|
|
211
|
+
/**
|
|
212
|
+
* Creates a new basket.
|
|
213
|
+
*
|
|
214
|
+
* @param basketData - Basket initialization data
|
|
215
|
+
* @returns Promise resolving to created basket
|
|
216
|
+
*/
|
|
217
|
+
async create(basketData) {
|
|
218
|
+
const instance = await getBasketsInstance();
|
|
219
|
+
return instance.create(basketData);
|
|
220
|
+
},
|
|
221
|
+
/**
|
|
222
|
+
* Retrieves baskets, optionally filtered by status.
|
|
223
|
+
*
|
|
224
|
+
* @param status - Optional basket status filter
|
|
225
|
+
* @returns Promise resolving to basket list
|
|
226
|
+
*/
|
|
227
|
+
async get(status) {
|
|
228
|
+
const instance = await getBasketsInstance();
|
|
229
|
+
return instance.get(status);
|
|
230
|
+
},
|
|
231
|
+
/**
|
|
232
|
+
* Adds an item to a basket.
|
|
233
|
+
*
|
|
234
|
+
* @param basketId - Basket ID
|
|
235
|
+
* @param itemData - Item data to add
|
|
236
|
+
* @returns Promise resolving to updated basket
|
|
237
|
+
*/
|
|
238
|
+
async addItem(basketId, itemData) {
|
|
239
|
+
const instance = await getBasketsInstance();
|
|
240
|
+
return instance.addItem(basketId, itemData);
|
|
241
|
+
},
|
|
242
|
+
/**
|
|
243
|
+
* Removes an item from a basket.
|
|
244
|
+
*
|
|
245
|
+
* @param basketId - Basket ID
|
|
246
|
+
* @param itemId - Item ID to remove
|
|
247
|
+
* @returns Promise resolving to updated basket
|
|
248
|
+
*/
|
|
249
|
+
async removeItem(basketId, itemId) {
|
|
250
|
+
const instance = await getBasketsInstance();
|
|
251
|
+
return instance.removeItem(basketId, itemId);
|
|
252
|
+
},
|
|
253
|
+
/**
|
|
254
|
+
* Clears all items from a basket.
|
|
255
|
+
*
|
|
256
|
+
* @param basketId - Basket ID
|
|
257
|
+
* @returns Promise resolving to cleared basket
|
|
258
|
+
*/
|
|
259
|
+
async clear(basketId) {
|
|
260
|
+
const instance = await getBasketsInstance();
|
|
261
|
+
return instance.clear(basketId);
|
|
262
|
+
},
|
|
263
|
+
/**
|
|
264
|
+
* Updates basket status.
|
|
265
|
+
*
|
|
266
|
+
* @param basketId - Basket ID
|
|
267
|
+
* @param status - New basket status
|
|
268
|
+
* @returns Promise resolving to updated basket
|
|
269
|
+
*/
|
|
270
|
+
async updateStatus(basketId, status) {
|
|
271
|
+
const instance = await getBasketsInstance();
|
|
272
|
+
return instance.updateStatus(basketId, status);
|
|
273
|
+
},
|
|
274
|
+
/**
|
|
275
|
+
* Updates basket metadata.
|
|
276
|
+
*
|
|
277
|
+
* @param basketId - Basket ID
|
|
278
|
+
* @param metadata - Metadata to update
|
|
279
|
+
* @returns Promise resolving to updated basket
|
|
280
|
+
*/
|
|
281
|
+
async updateMetadata(basketId, metadata) {
|
|
282
|
+
const instance = await getBasketsInstance();
|
|
283
|
+
return instance.updateMetadata(basketId, metadata);
|
|
284
|
+
},
|
|
285
|
+
/**
|
|
286
|
+
* Converts basket to order.
|
|
287
|
+
*
|
|
288
|
+
* @param data - Order data
|
|
289
|
+
* @param basketId - Basket ID to convert
|
|
290
|
+
* @returns Promise resolving to created order
|
|
291
|
+
*/
|
|
292
|
+
async placeOrder(data, basketId) {
|
|
293
|
+
const instance = await getBasketsInstance();
|
|
294
|
+
return instance.placeOrder(data, basketId);
|
|
295
|
+
},
|
|
296
|
+
/**
|
|
297
|
+
* Retrieves a specific basket by ID.
|
|
298
|
+
*
|
|
299
|
+
* @param basketId - Basket ID
|
|
300
|
+
* @returns Promise resolving to basket data
|
|
301
|
+
*/
|
|
302
|
+
async getById(basketId) {
|
|
303
|
+
const instance = await getBasketsInstance();
|
|
304
|
+
return instance.getById(basketId);
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
// ============================================================================
|
|
308
|
+
// ORDERS API
|
|
309
|
+
// ============================================================================
|
|
310
|
+
/**
|
|
311
|
+
* Orders API
|
|
312
|
+
* Manage orders
|
|
313
|
+
*/
|
|
314
|
+
export const Orders = {
|
|
315
|
+
/**
|
|
316
|
+
* Creates a new order.
|
|
317
|
+
*
|
|
318
|
+
* @param orderData - Order data
|
|
319
|
+
* @returns Promise resolving to created order
|
|
320
|
+
*/
|
|
321
|
+
async create(orderData) {
|
|
322
|
+
const instance = await getOrderInstance();
|
|
323
|
+
return instance.create(orderData);
|
|
324
|
+
},
|
|
325
|
+
/**
|
|
326
|
+
* Updates order status.
|
|
327
|
+
*
|
|
328
|
+
* @param status - New order status
|
|
329
|
+
* @param orderId - Order ID
|
|
330
|
+
* @returns Promise resolving to updated order
|
|
331
|
+
*/
|
|
332
|
+
async updateStatus(status, orderId) {
|
|
333
|
+
const instance = await getOrderInstance();
|
|
334
|
+
return instance.updateStatus(status, orderId);
|
|
335
|
+
},
|
|
336
|
+
/**
|
|
337
|
+
* Updates order data.
|
|
338
|
+
*
|
|
339
|
+
* @param data - Data to update
|
|
340
|
+
* @param orderId - Order ID
|
|
341
|
+
* @returns Promise resolving to updated order
|
|
342
|
+
*/
|
|
343
|
+
async updateData(data, orderId) {
|
|
344
|
+
const instance = await getOrderInstance();
|
|
345
|
+
return instance.updateData(data, orderId);
|
|
346
|
+
},
|
|
347
|
+
/**
|
|
348
|
+
* Retrieves orders, optionally filtered by status.
|
|
349
|
+
*
|
|
350
|
+
* @param status - Optional order status filter
|
|
351
|
+
* @returns Promise resolving to order list
|
|
352
|
+
*/
|
|
353
|
+
async get(status) {
|
|
354
|
+
const instance = await getOrderInstance();
|
|
355
|
+
return instance.get(status);
|
|
356
|
+
},
|
|
357
|
+
/**
|
|
358
|
+
* Retrieves a specific order by ID.
|
|
359
|
+
*
|
|
360
|
+
* @param orderId - Order ID
|
|
361
|
+
* @returns Promise resolving to order data
|
|
362
|
+
*/
|
|
363
|
+
async getById(orderId) {
|
|
364
|
+
const instance = await getOrderInstance();
|
|
365
|
+
return instance.getById(orderId);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
// ============================================================================
|
|
369
|
+
// EXPORTS
|
|
370
|
+
// ============================================================================
|
|
371
|
+
// Export skill classes and utilities
|
|
372
|
+
export { LuaSkill, BasketStatus, OrderStatus, env };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command Definitions
|
|
3
|
+
* Centralized command structure for the CLI
|
|
4
|
+
*/
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
/**
|
|
7
|
+
* Sets up authentication-related commands.
|
|
8
|
+
*
|
|
9
|
+
* Commands:
|
|
10
|
+
* - `lua auth configure` - Set up API key
|
|
11
|
+
* - `lua auth logout` - Delete stored API key
|
|
12
|
+
* - `lua auth key` - Display current API key
|
|
13
|
+
*
|
|
14
|
+
* @param program - Commander program instance
|
|
15
|
+
*/
|
|
16
|
+
export declare function setupAuthCommands(program: Command): void;
|
|
17
|
+
/**
|
|
18
|
+
* Sets up skill management commands.
|
|
19
|
+
*
|
|
20
|
+
* Commands:
|
|
21
|
+
* - `lua init` - Initialize new project
|
|
22
|
+
* - `lua compile` - Compile skill
|
|
23
|
+
* - `lua test` - Test tools interactively
|
|
24
|
+
* - `lua push` - Push to server
|
|
25
|
+
* - `lua deploy` - Deploy to production
|
|
26
|
+
* - `lua dev` - Development mode with live reload
|
|
27
|
+
*
|
|
28
|
+
* @param program - Commander program instance
|
|
29
|
+
*/
|
|
30
|
+
export declare function setupSkillCommands(program: Command): void;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command Definitions
|
|
3
|
+
* Centralized command structure for the CLI
|
|
4
|
+
*/
|
|
5
|
+
import { configureCommand, initCommand, destroyCommand, apiKeyCommand, compileCommand, testCommand, pushCommand, deployCommand, devCommand } from "../commands/index.js";
|
|
6
|
+
/**
|
|
7
|
+
* Sets up authentication-related commands.
|
|
8
|
+
*
|
|
9
|
+
* Commands:
|
|
10
|
+
* - `lua auth configure` - Set up API key
|
|
11
|
+
* - `lua auth logout` - Delete stored API key
|
|
12
|
+
* - `lua auth key` - Display current API key
|
|
13
|
+
*
|
|
14
|
+
* @param program - Commander program instance
|
|
15
|
+
*/
|
|
16
|
+
export function setupAuthCommands(program) {
|
|
17
|
+
const authCommand = program
|
|
18
|
+
.command("auth")
|
|
19
|
+
.description("Authentication management commands");
|
|
20
|
+
authCommand
|
|
21
|
+
.command("configure")
|
|
22
|
+
.description("Set up your API key")
|
|
23
|
+
.action(configureCommand);
|
|
24
|
+
authCommand
|
|
25
|
+
.command("logout")
|
|
26
|
+
.description("Delete your stored API key")
|
|
27
|
+
.action(destroyCommand);
|
|
28
|
+
authCommand
|
|
29
|
+
.command("key")
|
|
30
|
+
.description("Display your stored API key")
|
|
31
|
+
.action(apiKeyCommand);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Sets up skill management commands.
|
|
35
|
+
*
|
|
36
|
+
* Commands:
|
|
37
|
+
* - `lua init` - Initialize new project
|
|
38
|
+
* - `lua compile` - Compile skill
|
|
39
|
+
* - `lua test` - Test tools interactively
|
|
40
|
+
* - `lua push` - Push to server
|
|
41
|
+
* - `lua deploy` - Deploy to production
|
|
42
|
+
* - `lua dev` - Development mode with live reload
|
|
43
|
+
*
|
|
44
|
+
* @param program - Commander program instance
|
|
45
|
+
*/
|
|
46
|
+
export function setupSkillCommands(program) {
|
|
47
|
+
program
|
|
48
|
+
.command("init")
|
|
49
|
+
.description("Initialize a new Lua skill project")
|
|
50
|
+
.action(initCommand);
|
|
51
|
+
program
|
|
52
|
+
.command("compile")
|
|
53
|
+
.description("Compile Lua skill to generate deployable format")
|
|
54
|
+
.action(compileCommand);
|
|
55
|
+
program
|
|
56
|
+
.command("test")
|
|
57
|
+
.description("Test Lua skill tools interactively")
|
|
58
|
+
.action(testCommand);
|
|
59
|
+
program
|
|
60
|
+
.command("push")
|
|
61
|
+
.description("Push compiled skill version to server")
|
|
62
|
+
.action(pushCommand);
|
|
63
|
+
program
|
|
64
|
+
.command("deploy")
|
|
65
|
+
.description("Deploy a version to production")
|
|
66
|
+
.action(deployCommand);
|
|
67
|
+
program
|
|
68
|
+
.command("dev")
|
|
69
|
+
.description("Push compiled skill version to sandbox for development")
|
|
70
|
+
.action(devCommand);
|
|
71
|
+
}
|
|
@@ -1 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agents Command
|
|
3
|
+
* Lists all organizations and agents accessible to the authenticated user
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Main agents command - retrieves and displays organization/agent information.
|
|
7
|
+
*
|
|
8
|
+
* This command:
|
|
9
|
+
* 1. Loads the API key from secure storage
|
|
10
|
+
* 2. Calls the agents API to retrieve organizations
|
|
11
|
+
* 3. Displays the retrieved data in JSON format
|
|
12
|
+
*
|
|
13
|
+
* Use this command to:
|
|
14
|
+
* - View all organizations you have access to
|
|
15
|
+
* - Get agent IDs for configuration
|
|
16
|
+
* - Verify API key permissions
|
|
17
|
+
*
|
|
18
|
+
* @returns Promise that resolves when agents are listed
|
|
19
|
+
* @throws Error if API key is not found or API call fails
|
|
20
|
+
*/
|
|
1
21
|
export declare function agentsCommand(): Promise<void>;
|
package/dist/commands/agents.js
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Agents Command
|
|
3
|
+
* Lists all organizations and agents accessible to the authenticated user
|
|
4
|
+
*/
|
|
2
5
|
import { loadApiKey } from "../services/auth.js";
|
|
3
6
|
import { withErrorHandling, writeSuccess } from "../utils/cli.js";
|
|
7
|
+
import AgentApi from '../api/agent.api.service.js';
|
|
8
|
+
import { BASE_URLS } from '../config/constants.js';
|
|
9
|
+
/**
|
|
10
|
+
* Main agents command - retrieves and displays organization/agent information.
|
|
11
|
+
*
|
|
12
|
+
* This command:
|
|
13
|
+
* 1. Loads the API key from secure storage
|
|
14
|
+
* 2. Calls the agents API to retrieve organizations
|
|
15
|
+
* 3. Displays the retrieved data in JSON format
|
|
16
|
+
*
|
|
17
|
+
* Use this command to:
|
|
18
|
+
* - View all organizations you have access to
|
|
19
|
+
* - Get agent IDs for configuration
|
|
20
|
+
* - Verify API key permissions
|
|
21
|
+
*
|
|
22
|
+
* @returns Promise that resolves when agents are listed
|
|
23
|
+
* @throws Error if API key is not found or API call fails
|
|
24
|
+
*/
|
|
4
25
|
export async function agentsCommand() {
|
|
5
26
|
return withErrorHandling(async () => {
|
|
6
27
|
const apiKey = await loadApiKey();
|
|
@@ -8,7 +29,8 @@ export async function agentsCommand() {
|
|
|
8
29
|
console.error("❌ No API key found. Run `lua auth configure` first.");
|
|
9
30
|
process.exit(1);
|
|
10
31
|
}
|
|
11
|
-
const
|
|
32
|
+
const agentApi = new AgentApi(BASE_URLS.API, apiKey);
|
|
33
|
+
const response = await agentApi.getOrganizations();
|
|
12
34
|
if (!response.success) {
|
|
13
35
|
console.error(`❌ Error: ${response.error?.message || 'Unknown error'}`);
|
|
14
36
|
process.exit(1);
|
|
@@ -1 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Key Display Command
|
|
3
|
+
* Securely displays the stored API key with user confirmation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Main API key command - displays the stored API key with confirmation.
|
|
7
|
+
*
|
|
8
|
+
* This command:
|
|
9
|
+
* 1. Loads the API key from secure storage
|
|
10
|
+
* 2. Prompts for confirmation before displaying
|
|
11
|
+
* 3. Displays the API key if confirmed
|
|
12
|
+
*
|
|
13
|
+
* Security:
|
|
14
|
+
* - Requires explicit confirmation to prevent accidental exposure
|
|
15
|
+
* - Only displays if user confirms the action
|
|
16
|
+
*
|
|
17
|
+
* Use this command to:
|
|
18
|
+
* - Retrieve your API key for use elsewhere
|
|
19
|
+
* - Verify which API key is currently configured
|
|
20
|
+
* - Copy your API key to clipboard
|
|
21
|
+
*
|
|
22
|
+
* @returns Promise that resolves when command completes
|
|
23
|
+
*/
|
|
1
24
|
export declare function apiKeyCommand(): Promise<void>;
|
package/dist/commands/apiKey.js
CHANGED
|
@@ -1,6 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API Key Display Command
|
|
3
|
+
* Securely displays the stored API key with user confirmation
|
|
4
|
+
*/
|
|
1
5
|
import inquirer from "inquirer";
|
|
2
6
|
import { loadApiKey } from "../services/auth.js";
|
|
3
7
|
import { withErrorHandling, writeProgress, writeSuccess } from "../utils/cli.js";
|
|
8
|
+
/**
|
|
9
|
+
* Main API key command - displays the stored API key with confirmation.
|
|
10
|
+
*
|
|
11
|
+
* This command:
|
|
12
|
+
* 1. Loads the API key from secure storage
|
|
13
|
+
* 2. Prompts for confirmation before displaying
|
|
14
|
+
* 3. Displays the API key if confirmed
|
|
15
|
+
*
|
|
16
|
+
* Security:
|
|
17
|
+
* - Requires explicit confirmation to prevent accidental exposure
|
|
18
|
+
* - Only displays if user confirms the action
|
|
19
|
+
*
|
|
20
|
+
* Use this command to:
|
|
21
|
+
* - Retrieve your API key for use elsewhere
|
|
22
|
+
* - Verify which API key is currently configured
|
|
23
|
+
* - Copy your API key to clipboard
|
|
24
|
+
*
|
|
25
|
+
* @returns Promise that resolves when command completes
|
|
26
|
+
*/
|
|
4
27
|
export async function apiKeyCommand() {
|
|
5
28
|
return withErrorHandling(async () => {
|
|
6
29
|
const apiKey = await loadApiKey();
|
|
@@ -1 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compile Command
|
|
3
|
+
* Orchestrates the skill compilation process by coordinating various compilation steps
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Main compile command - orchestrates the entire skill compilation process.
|
|
7
|
+
*
|
|
8
|
+
* This command performs the following steps:
|
|
9
|
+
* 1. Cleans and prepares output directories (dist/ and .lua/)
|
|
10
|
+
* 2. Analyzes the TypeScript project to detect all tools
|
|
11
|
+
* 3. Bundles each tool individually using esbuild
|
|
12
|
+
* 4. Extracts execute code and schemas from bundled tools
|
|
13
|
+
* 5. Bundles the main index file
|
|
14
|
+
* 6. Creates deployment data in both new and legacy formats
|
|
15
|
+
*
|
|
16
|
+
* Output:
|
|
17
|
+
* - dist/deployment.json - New deployment format with tool references
|
|
18
|
+
* - dist/tools/*.js - Individual bundled tool files
|
|
19
|
+
* - dist/index.js - Main skill entry point
|
|
20
|
+
* - .lua/deploy.json - Legacy deployment format with compressed tools
|
|
21
|
+
* - .lua/*.js - Individual uncompressed tool files for debugging
|
|
22
|
+
*
|
|
23
|
+
* @returns Promise that resolves when compilation is complete
|
|
24
|
+
*/
|
|
1
25
|
export declare function compileCommand(): Promise<void>;
|