lua-cli 2.0.5 → 2.1.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/README.md CHANGED
@@ -195,7 +195,7 @@ This command will:
195
195
  - Available at `http://localhost:3000` (opens automatically)
196
196
  - **Live Log Panel**:
197
197
  - Real-time log feed showing execution details
198
- - WebSocket connection to `wss://api.heylua.ai/feed`
198
+ - WebSocket connection to `wss://api.lua.dev/feed`
199
199
  - Console-style interface with color-coded log levels
200
200
  - Shows tool calls, errors, metrics, and execution metadata
201
201
  - Displays detailed information in expandable sections
@@ -498,7 +498,7 @@ For more details, see [USER_DATA_API.md](./USER_DATA_API.md).
498
498
 
499
499
  For support and questions:
500
500
  - Create an issue on [GitHub](https://github.com/lua-ai-global/lua-cli/issues)
501
- - Contact: stefan@heylua.ai
501
+ - Contact: stefan@lua.dev
502
502
 
503
503
  ## Changelog
504
504
 
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  export { user, UserDataAPI } from './user-data-api.js';
3
+ export { product, ProductAPI } from './product-api.js';
package/dist/index.js CHANGED
@@ -45,3 +45,4 @@ program
45
45
  program.parse(process.argv);
46
46
  // Export user data API for use in projects
47
47
  export { user, UserDataAPI } from './user-data-api.js';
48
+ export { product, ProductAPI } from './product-api.js';
@@ -0,0 +1,13 @@
1
+ export declare class ProductAPI {
2
+ products: any;
3
+ constructor();
4
+ get(page?: number, limit?: number): Promise<any>;
5
+ create(data: Record<string, any>): Promise<any>;
6
+ update(data: Record<string, any>, productId: string): Promise<any>;
7
+ delete(productId: string): Promise<{
8
+ success: boolean;
9
+ }>;
10
+ }
11
+ export declare const product: {
12
+ data: ProductAPI;
13
+ };
@@ -0,0 +1,24 @@
1
+ export class ProductAPI {
2
+ constructor() {
3
+ this.products = {};
4
+ }
5
+ async get(page = 1, limit = 10) {
6
+ return { success: true, data: this.products };
7
+ }
8
+ async create(data) {
9
+ this.products = data;
10
+ return { success: true, data: this.products };
11
+ }
12
+ async update(data, productId) {
13
+ // Update is the same as create for this API
14
+ this.products = { ...this.products, ...data };
15
+ return { success: true, data: this.products };
16
+ }
17
+ async delete(productId) {
18
+ this.products = this.products.filter((product) => product.id !== productId);
19
+ return { success: true };
20
+ }
21
+ }
22
+ export const product = {
23
+ data: new ProductAPI()
24
+ };
@@ -122,6 +122,42 @@ export interface ChatResponse {
122
122
  text?: string;
123
123
  error?: string;
124
124
  }
125
+ export interface Product {
126
+ id: string;
127
+ [key: string]: any;
128
+ }
129
+ export interface ProductsResponse {
130
+ success: boolean;
131
+ data: Product[];
132
+ pagination: {
133
+ currentPage: number;
134
+ totalPages: number;
135
+ totalCount: number;
136
+ limit: number;
137
+ hasNextPage: boolean;
138
+ hasPrevPage: boolean;
139
+ nextPage: number | null;
140
+ prevPage: number | null;
141
+ };
142
+ }
143
+ export interface CreateProductResponse {
144
+ updated: boolean;
145
+ isNew: boolean;
146
+ product: Product;
147
+ }
148
+ export interface UpdateProductResponse {
149
+ updated: boolean;
150
+ isNew: boolean;
151
+ product: Product;
152
+ }
153
+ export interface DeleteProductResponse {
154
+ deleted: boolean;
155
+ }
156
+ export interface SearchProductsResponse {
157
+ success: boolean;
158
+ message: string;
159
+ data: Product[];
160
+ }
125
161
  /**
126
162
  * Authentication API calls
127
163
  */
@@ -176,6 +212,31 @@ export declare class SkillApi {
176
212
  export declare class ChatApi {
177
213
  static sendMessage(agentId: string, chatData: ChatRequest, apiKey: string): Promise<ApiResponse<ChatResponse>>;
178
214
  }
215
+ /**
216
+ * Product API calls
217
+ */
218
+ export declare class ProductApi {
219
+ /**
220
+ * Get all products for an agent with pagination
221
+ */
222
+ static getProducts(apiKey: string, agentId: string, page?: number, limit?: number): Promise<ApiResponse<ProductsResponse>>;
223
+ /**
224
+ * Create a new product
225
+ */
226
+ static createProduct(apiKey: string, agentId: string, productData: Product): Promise<ApiResponse<CreateProductResponse>>;
227
+ /**
228
+ * Update an existing product
229
+ */
230
+ static updateProduct(apiKey: string, agentId: string, productData: Product): Promise<ApiResponse<UpdateProductResponse>>;
231
+ /**
232
+ * Delete a product
233
+ */
234
+ static deleteProduct(apiKey: string, agentId: string, productId: string): Promise<ApiResponse<DeleteProductResponse>>;
235
+ /**
236
+ * Search products by text query
237
+ */
238
+ static searchProducts(apiKey: string, agentId: string, searchQuery: string): Promise<ApiResponse<SearchProductsResponse>>;
239
+ }
179
240
  /**
180
241
  * Tool API calls (for compile command)
181
242
  */
@@ -200,5 +261,6 @@ export declare const ApiService: {
200
261
  Agent: typeof AgentApi;
201
262
  Skill: typeof SkillApi;
202
263
  Chat: typeof ChatApi;
264
+ Product: typeof ProductApi;
203
265
  Tool: typeof ToolApi;
204
266
  };
@@ -4,10 +4,10 @@
4
4
  */
5
5
  // Base URLs for different environments
6
6
  const BASE_URLS = {
7
- LOCAL: 'https://api.heylua.ai',
8
- API: 'https://api.heylua.ai',
9
- AUTH: 'https://auth.heylua.ai',
10
- CHAT: 'https://api.heylua.ai'
7
+ LOCAL: 'https://api.lua.dev',
8
+ API: 'https://api.lua.dev',
9
+ AUTH: 'https://auth.lua.dev',
10
+ CHAT: 'https://api.lua.dev'
11
11
  };
12
12
  /**
13
13
  * Generic HTTP client with common error handling
@@ -168,6 +168,51 @@ export class ChatApi {
168
168
  });
169
169
  }
170
170
  }
171
+ /**
172
+ * Product API calls
173
+ */
174
+ export class ProductApi {
175
+ /**
176
+ * Get all products for an agent with pagination
177
+ */
178
+ static async getProducts(apiKey, agentId, page = 1, limit = 10) {
179
+ return httpClient.get(`${BASE_URLS.API}/developer/agents/${agentId}/products?page=${page}&limit=${limit}`, {
180
+ Authorization: `Bearer ${apiKey}`,
181
+ });
182
+ }
183
+ /**
184
+ * Create a new product
185
+ */
186
+ static async createProduct(apiKey, agentId, productData) {
187
+ return httpClient.post(`${BASE_URLS.API}/developer/agents/${agentId}/products`, productData, {
188
+ Authorization: `Bearer ${apiKey}`,
189
+ });
190
+ }
191
+ /**
192
+ * Update an existing product
193
+ */
194
+ static async updateProduct(apiKey, agentId, productData) {
195
+ return httpClient.put(`${BASE_URLS.API}/developer/agents/${agentId}/products`, productData, {
196
+ Authorization: `Bearer ${apiKey}`,
197
+ });
198
+ }
199
+ /**
200
+ * Delete a product
201
+ */
202
+ static async deleteProduct(apiKey, agentId, productId) {
203
+ return httpClient.delete(`${BASE_URLS.API}/developer/agents/${agentId}/products/${productId}`, {
204
+ Authorization: `Bearer ${apiKey}`,
205
+ });
206
+ }
207
+ /**
208
+ * Search products by text query
209
+ */
210
+ static async searchProducts(apiKey, agentId, searchQuery) {
211
+ return httpClient.get(`${BASE_URLS.API}/developer/agents/${agentId}/products/search?searchQuery=${encodeURIComponent(searchQuery)}`, {
212
+ Authorization: `Bearer ${apiKey}`,
213
+ });
214
+ }
215
+ }
171
216
  /**
172
217
  * Tool API calls (for compile command)
173
218
  */
@@ -233,5 +278,6 @@ export const ApiService = {
233
278
  Agent: AgentApi,
234
279
  Skill: SkillApi,
235
280
  Chat: ChatApi,
281
+ Product: ProductApi,
236
282
  Tool: ToolApi,
237
283
  };
@@ -2,7 +2,7 @@ import { createRequire } from "module";
2
2
  import vm from "vm";
3
3
  import path from "path";
4
4
  import fs from "fs";
5
- import { UserDataApi } from "../services/api.js";
5
+ import { UserDataApi, ProductApi } from "../services/api.js";
6
6
  import { readSkillConfig } from "./files.js";
7
7
  /**
8
8
  * Loads environment variables from multiple sources in priority order:
@@ -66,6 +66,21 @@ export function createSandbox(options) {
66
66
  const linkUserData = async (data) => {
67
67
  return await UserDataApi.createUserData(apiKey, agentId, data);
68
68
  };
69
+ const createProduct = async (data) => {
70
+ return await ProductApi.createProduct(apiKey, agentId, data);
71
+ };
72
+ const getProducts = async (page = 1, limit = 10) => {
73
+ return await ProductApi.getProducts(apiKey, agentId, page, limit);
74
+ };
75
+ const updateProduct = async (data, productId) => {
76
+ return await ProductApi.updateProduct(apiKey, agentId, { ...data, id: productId });
77
+ };
78
+ const deleteProduct = async (productId) => {
79
+ return await ProductApi.deleteProduct(apiKey, agentId, productId);
80
+ };
81
+ const searchProducts = async (searchQuery) => {
82
+ return await ProductApi.searchProducts(apiKey, agentId, searchQuery);
83
+ };
69
84
  // Create console object (use custom console if provided, otherwise default)
70
85
  const consoleObj = customConsole || console;
71
86
  // Create comprehensive polyfills for browser/Node.js APIs
@@ -201,6 +216,13 @@ export function createSandbox(options) {
201
216
  create: linkUserData
202
217
  }
203
218
  },
219
+ product: {
220
+ create: createProduct,
221
+ get: getProducts,
222
+ update: updateProduct,
223
+ delete: deleteProduct,
224
+ search: searchProducts
225
+ },
204
226
  // Environment variables function
205
227
  env: (key) => envVars[key]
206
228
  };