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.
@@ -3,7 +3,8 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Chat to your Agent [Sandbox]</title>
6
+ <meta name="description" content="Lua Developer Console - Build, test, and deploy AI agents">
7
+ <title>Lua Developer Console</title>
7
8
  <link rel="stylesheet" href="/app.css">
8
9
  <link rel="stylesheet" href="/tools-page.css">
9
10
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lua-cli",
3
- "version": "2.1.0-alpha.6",
3
+ "version": "2.2.0",
4
4
  "description": "Command-line interface for Lua AI platform - develop, test, and deploy LuaSkills with custom tools",
5
5
  "readmeFilename": "README.md",
6
6
  "main": "dist/index.js",
@@ -8,7 +8,9 @@
8
8
  ".": "./dist/index.js",
9
9
  "./types": "./dist/types.js",
10
10
  "./skill": "./dist/skill.js",
11
- "./user-data-api": "./dist/user-data-api.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"
12
14
  },
13
15
  "scripts": {
14
16
  "clean": "rm -rf dist",
@@ -34,7 +36,7 @@
34
36
  "deployment",
35
37
  "skills"
36
38
  ],
37
- "author": "Stefan Kruger <stefan@lua.dev>",
39
+ "author": "Stefan Kruger <stefan@heylua.ai>",
38
40
  "license": "MIT",
39
41
  "type": "module",
40
42
  "repository": {
@@ -1,13 +1,16 @@
1
1
  agent:
2
- agentId: baseAgent_agent_1759165790010_cmu8t35ta
3
- orgId: 845c77a8-88b9-4381-ba4a-fd7496ef1f57
2
+ agentId: liteAPI_lp1a010
3
+ orgId: 2e7fcabb-7616-4b8d-9114-b6ac121aefe5
4
4
  skills:
5
5
  - name: general-skill
6
6
  version: 0.0.2
7
- skillId: 5d990e43-6204-43af-8246-67dedeb80c68
7
+ skillId: 0ada138d-9155-40fd-bda4-06b51e69e78c
8
8
  - name: user-data-skill
9
9
  version: 0.0.1
10
- skillId: 457bb68a-a136-4671-9bb0-9263a262eb41
10
+ skillId: b551177b-aa50-42bb-9b2f-52249db9ca67
11
11
  - name: eccomerce-skill
12
12
  version: 0.0.1
13
- skillId: e1976320-2bdb-4622-bfde-fe20eabe8360
13
+ skillId: b8c9b6ad-0c3c-4bac-b182-94f19f4c062d
14
+ - name: custom-data-skill
15
+ version: 0.0.1
16
+ skillId: bcffdbdb-4a85-4603-9ddd-2f58e743fbd2
@@ -19,8 +19,9 @@
19
19
  "axios": "^1.6.0",
20
20
  "inquirer": "^12.9.6",
21
21
  "js-yaml": "^4.1.0",
22
- "lua-cli": "2.1.0-alpha.6",
22
+ "lua-cli": "2.2.0",
23
23
  "openai": "^5.23.0",
24
+ "uuid": "^13.0.0",
24
25
  "zod": "^3.24.1"
25
26
  },
26
27
  "devDependencies": {
@@ -2,8 +2,9 @@ import { LuaSkill } from "lua-cli/skill";
2
2
  import GetWeatherTool from "./tools/GetWeatherTool";
3
3
  import { GetUserDataTool, CreateUserDataTool, UpdateUserDataTool } from "./tools/UserDataTool";
4
4
  import CreatePostTool from "./tools/CreatePostTool";
5
- import { SearchProductsTool, GetAllProductsTool, CreateProductTool, UpdateProductTool, DeleteProductTool } from "./tools/ProductsTool";
5
+ import { SearchProductsTool, GetAllProductsTool, CreateProductTool, UpdateProductTool, DeleteProductTool, AddItemToBasketTool, RemoveItemFromBasketTool, ClearBasketTool, CreateOrderTool, GetUserOrdersTool, UpdateOrderStatusTool, UpdateBasketStatusTool, GetBasketsTool, CreateBasketTool } from "./tools/ProductsTool";
6
6
  import CreatePaymentLinkTool from "./tools/PaymentTool";
7
+ import { CreateMovieTool, GetMoviesTool, GetMovieByIdTool, UpdateMovieTool, SearchMoviesTool, DeleteMovieTool } from "./tools/CustomDataTool";
7
8
 
8
9
 
9
10
  // Initialize skill with tools
@@ -47,10 +48,34 @@ eccomerceSkill.addTools([
47
48
  new CreateProductTool(),
48
49
  new UpdateProductTool(),
49
50
  new DeleteProductTool(),
50
- new CreatePaymentLinkTool()
51
+ new CreatePaymentLinkTool(),
52
+ new CreateBasketTool(),
53
+ new GetBasketsTool(),
54
+ new AddItemToBasketTool(),
55
+ new RemoveItemFromBasketTool(),
56
+ new ClearBasketTool(),
57
+ new UpdateBasketStatusTool(),
58
+ new CreateOrderTool(),
59
+ new UpdateOrderStatusTool(),
60
+ new GetUserOrdersTool()
51
61
  ]);
52
62
 
53
63
 
64
+ const customDataSkill = new LuaSkill({
65
+ name: "custom-data-skill",
66
+ version: "0.0.1",
67
+ description: "A specific Lua skill with custom data",
68
+ context: "This skill provides various utilities including custom data.",
69
+ tools: [
70
+ new CreateMovieTool(),
71
+ new GetMoviesTool(),
72
+ new GetMovieByIdTool(),
73
+ new UpdateMovieTool(),
74
+ new SearchMoviesTool(),
75
+ new DeleteMovieTool()
76
+ ]
77
+ });
78
+
54
79
  // Test cases
55
80
  const testCases = [
56
81
  { tool: "get_weather", city: "London" },
@@ -0,0 +1,116 @@
1
+ import { LuaTool } from "lua-cli/skill";
2
+ import { z } from "zod";
3
+ import { customData } from 'lua-cli/custom-data-api';
4
+
5
+ // Movie data schema
6
+
7
+
8
+ export class CreateMovieTool implements LuaTool {
9
+ name = "create_movie";
10
+ description = "Add a new movie to the movies database";
11
+ inputSchema = z.object({
12
+ movie: z.object({
13
+ title: z.string(),
14
+ director: z.string(),
15
+ year: z.number(),
16
+ genre: z.array(z.string()),
17
+ rating: z.number().min(0).max(10),
18
+ duration: z.number(), // in minutes
19
+ plot: z.string(),
20
+ cast: z.array(z.string()),
21
+ budget: z.number().optional(),
22
+ boxOffice: z.number().optional(),
23
+ imdbId: z.string().optional()
24
+ }),
25
+ searchText: z.string().optional().describe("Optional search text for better discoverability")
26
+ });
27
+ async execute(input: z.infer<typeof this.inputSchema>) {
28
+ return customData.create("movies", {
29
+ data: input.movie,
30
+ searchText: input.searchText || `${input.movie.title} ${input.movie.director} ${input.movie.genre.join(' ')} ${input.movie.year}`
31
+ });
32
+ }
33
+ }
34
+
35
+ export class GetMoviesTool implements LuaTool {
36
+ name = "get_movies";
37
+ description = "Get movies from the database with optional filtering";
38
+ inputSchema = z.object({
39
+ filter: z.object({
40
+ genre: z.string().optional().describe("Filter by genre (e.g., 'Action', 'Drama')"),
41
+ year: z.number().optional().describe("Filter by release year"),
42
+ director: z.string().optional().describe("Filter by director name"),
43
+ minRating: z.number().min(0).max(10).optional().describe("Minimum rating filter"),
44
+ maxRating: z.number().min(0).max(10).optional().describe("Maximum rating filter")
45
+ }).optional(),
46
+ page: z.number().min(1).default(1).describe("Page number for pagination"),
47
+ limit: z.number().min(1).max(100).default(10).describe("Number of movies per page")
48
+ });
49
+ async execute(input: z.infer<typeof this.inputSchema>) {
50
+ return customData.get("movies", input.filter, input.page, input.limit);
51
+ }
52
+ }
53
+
54
+ export class GetMovieByIdTool implements LuaTool {
55
+ name = "get_movie_by_id";
56
+ description = "Get a specific movie by its ID";
57
+ inputSchema = z.object({
58
+ movieId: z.string().describe("The unique ID of the movie to retrieve")
59
+ });
60
+ async execute(input: z.infer<typeof this.inputSchema>) {
61
+ return customData.getEntry("movies", input.movieId);
62
+ }
63
+ }
64
+
65
+ export class UpdateMovieTool implements LuaTool {
66
+ name = "update_movie";
67
+ description = "Update an existing movie in the database";
68
+ inputSchema = z.object({
69
+ movieId: z.string().describe("The unique ID of the movie to update"),
70
+ updates: z.object({
71
+ title: z.string().optional(),
72
+ director: z.string().optional(),
73
+ year: z.number().optional(),
74
+ genre: z.array(z.string()).optional(),
75
+ rating: z.number().min(0).max(10).optional(),
76
+ duration: z.number().optional(),
77
+ plot: z.string().optional(),
78
+ cast: z.array(z.string()).optional(),
79
+ budget: z.number().optional(),
80
+ boxOffice: z.number().optional(),
81
+ imdbId: z.string().optional()
82
+ }).describe("Movie fields to update"),
83
+ searchText: z.string().optional().describe("Updated search text for better discoverability")
84
+ });
85
+ async execute(input: z.infer<typeof this.inputSchema>) {
86
+ const updateData: any = { data: input.updates };
87
+ if (input.searchText) {
88
+ updateData.searchText = input.searchText;
89
+ }
90
+ return customData.update("movies", input.movieId, updateData);
91
+ }
92
+ }
93
+
94
+ export class SearchMoviesTool implements LuaTool {
95
+ name = "search_movies";
96
+ description = "Search movies by text (title, director, genre, plot, cast, etc.)";
97
+ inputSchema = z.object({
98
+ searchText: z.string().describe("Text to search for in movie titles, directors, genres, plot, cast, etc."),
99
+ limit: z.number().min(1).max(50).default(10).describe("Maximum number of results to return"),
100
+ scoreThreshold: z.number().min(0).max(1).default(0.3).describe("Minimum similarity score (0-1)")
101
+ });
102
+ async execute(input: z.infer<typeof this.inputSchema>) {
103
+ return customData.search("movies", input.searchText, input.limit, input.scoreThreshold);
104
+ }
105
+ }
106
+
107
+ export class DeleteMovieTool implements LuaTool {
108
+ name = "delete_movie";
109
+ description = "Delete a movie from the database";
110
+ inputSchema = z.object({
111
+ movieId: z.string().describe("The unique ID of the movie to delete")
112
+ });
113
+ async execute(input: z.infer<typeof this.inputSchema>) {
114
+ return customData.delete("movies", input.movieId);
115
+ }
116
+ }
@@ -1,6 +1,7 @@
1
1
  import { env, LuaTool } from "lua-cli/skill";
2
2
  import { z } from "zod";
3
- import { product } from 'lua-cli';
3
+ import { product, BasketStatus, OrderStatus, CreateOrderRequest } from 'lua-cli/product-api';
4
+ import { v4 as uuidv4 } from 'uuid';
4
5
  export class SearchProductsTool implements LuaTool {
5
6
  name = "search_products";
6
7
  description = "Search for products";
@@ -11,17 +12,20 @@ export class SearchProductsTool implements LuaTool {
11
12
  constructor() {}
12
13
 
13
14
  async execute(input: z.infer<typeof this.inputSchema>) {
14
- const products = await product.data.search(input.query);
15
+ return await product.data.search(input.query);
15
16
  }
16
17
  }
17
18
 
18
19
  export class GetAllProductsTool implements LuaTool {
19
20
  name = "get_all_products";
20
21
  description = "Get all products";
21
- inputSchema = z.object({ });
22
+ inputSchema = z.object({
23
+ page: z.number().optional(),
24
+ limit: z.number().optional()
25
+ });
22
26
 
23
27
  async execute(input: z.infer<typeof this.inputSchema>) {
24
- return product.data.get();
28
+ return product.data.get(input.page, input.limit);
25
29
  }
26
30
  }
27
31
 
@@ -37,7 +41,7 @@ export class CreateProductTool implements LuaTool {
37
41
  });
38
42
 
39
43
  async execute(input: z.infer<typeof this.inputSchema>) {
40
- return product.data.create(input.product);
44
+ return product.data.create({...input.product, id: uuidv4()});
41
45
  }
42
46
  }
43
47
 
@@ -54,7 +58,7 @@ export class UpdateProductTool implements LuaTool {
54
58
  });
55
59
 
56
60
  async execute(input: z.infer<typeof this.inputSchema>) {
57
- return product.data.update(input.product, input.product.id);
61
+ return product.data.update({...input.product, id: uuidv4()}, input.product.id);
58
62
  }
59
63
  }
60
64
 
@@ -68,4 +72,119 @@ export class DeleteProductTool implements LuaTool {
68
72
  async execute(input: z.infer<typeof this.inputSchema>) {
69
73
  return product.data.delete(input.id);
70
74
  }
71
- }
75
+ }
76
+
77
+ export class CreateBasketTool implements LuaTool {
78
+ name = "create_basket";
79
+ description = "Create a new basket";
80
+ inputSchema = z.object({
81
+ basket: z.object({
82
+ currency: z.string()
83
+ })
84
+ });
85
+
86
+ async execute(input: z.infer<typeof this.inputSchema>) {
87
+ return product.basket.create(input.basket);
88
+ }
89
+ }
90
+
91
+ export class GetBasketsTool implements LuaTool {
92
+ name = "get_baskets";
93
+ description = "Get all baskets";
94
+ inputSchema = z.object({
95
+ status: z.enum(['active', 'checked_out', 'abandoned', 'expired']).optional()
96
+ });
97
+ async execute(input: z.infer<typeof this.inputSchema>) {
98
+ return product.basket.get(input.status as BasketStatus);
99
+ }
100
+ }
101
+
102
+ export class AddItemToBasketTool implements LuaTool {
103
+ name = "add_item_to_basket";
104
+ description = "Add an item to a basket";
105
+ inputSchema = z.object({
106
+ basketId: z.string(),
107
+ item: z.object({
108
+ id: z.string(),
109
+ price: z.number(),
110
+ quantity: z.number()
111
+ })
112
+ });
113
+ async execute(input: z.infer<typeof this.inputSchema>) {
114
+ return product.basket.addItem(input.basketId, input.item);
115
+ }
116
+ }
117
+
118
+ export class RemoveItemFromBasketTool implements LuaTool {
119
+ name = "remove_item_from_basket";
120
+ description = "Remove an item from a basket";
121
+ inputSchema = z.object({
122
+ basketId: z.string(),
123
+ itemId: z.string()
124
+ });
125
+ async execute(input: z.infer<typeof this.inputSchema>) {
126
+ return product.basket.removeItem(input.basketId, input.itemId);
127
+ }
128
+ }
129
+
130
+ export class ClearBasketTool implements LuaTool {
131
+ name = "clear_basket";
132
+ description = "Clear a basket";
133
+ inputSchema = z.object({
134
+ basketId: z.string()
135
+ });
136
+ async execute(input: z.infer<typeof this.inputSchema>) {
137
+ return product.basket.clear(input.basketId);
138
+ }
139
+ }
140
+
141
+ export class UpdateBasketStatusTool implements LuaTool {
142
+ name = "update_basket_status";
143
+ description = "Update the status of a basket";
144
+ inputSchema = z.object({
145
+ basketId: z.string(),
146
+ status: z.enum(['active', 'checked_out', 'abandoned', 'expired'])
147
+ });
148
+ async execute(input: z.infer<typeof this.inputSchema>) {
149
+ return product.basket.updateStatus(input.basketId, input.status as BasketStatus);
150
+ }
151
+ }
152
+
153
+ export class CreateOrderTool implements LuaTool {
154
+ name = "create_order";
155
+ description = "Create a new order";
156
+ inputSchema = z.object({
157
+ order: z.object({
158
+ basketId: z.string(),
159
+ data: z.object({
160
+ storeId: z.string(),
161
+ }).optional()
162
+ })
163
+ });
164
+ async execute(input: z.infer<typeof this.inputSchema>) {
165
+ return product.order.create(input.order as CreateOrderRequest);
166
+ }
167
+ }
168
+
169
+ export class UpdateOrderStatusTool implements LuaTool {
170
+ name = "update_order_status";
171
+ description = "Update the status of an order";
172
+ inputSchema = z.object({
173
+ orderId: z.string(),
174
+ status: z.enum(['pending', 'confirmed', 'fulfilled', 'cancelled'])
175
+ });
176
+ async execute(input: z.infer<typeof this.inputSchema>) {
177
+ return product.order.updateStatus(input.orderId, input.status as OrderStatus);
178
+ }
179
+ }
180
+
181
+ export class GetUserOrdersTool implements LuaTool {
182
+ name = "get_user_orders";
183
+ description = "Get all orders for a user";
184
+ inputSchema = z.object({
185
+ userId: z.string()
186
+ });
187
+ async execute(input: z.infer<typeof this.inputSchema>) {
188
+ return product.order.get(input.userId);
189
+ }
190
+ }