lua-cli 1.3.2-alpha.0 → 1.3.2-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.
@@ -48,7 +48,7 @@
48
48
 
49
49
  .tools-header h3 {
50
50
  margin: 0 0 4px 0;
51
- font-size: 18px;
51
+ font-size: 14px;
52
52
  font-weight: 600;
53
53
  color: #ffffff;
54
54
  font-family: inherit;
@@ -56,7 +56,7 @@
56
56
 
57
57
  .tools-header p {
58
58
  margin: 0;
59
- font-size: 14px;
59
+ font-size: 12px;
60
60
  color: #cccccc;
61
61
  font-family: inherit;
62
62
  }
@@ -75,13 +75,13 @@
75
75
  background: #252526;
76
76
  border: 1px solid #3e3e42;
77
77
  border-radius: 8px;
78
- padding: 12px;
78
+ padding: 8px 12px;
79
79
  cursor: pointer;
80
80
  transition: all 0.2s;
81
81
  display: flex;
82
82
  flex-direction: column;
83
83
  height: fit-content;
84
- min-height: 100px;
84
+ min-height: 50px;
85
85
  }
86
86
 
87
87
  .tool-card:hover {
@@ -92,45 +92,18 @@
92
92
  }
93
93
 
94
94
  .tool-card-header {
95
- margin-bottom: 12px;
95
+ margin-bottom: 0;
96
96
  }
97
97
 
98
98
  .tool-card-header h4 {
99
99
  margin: 0;
100
- font-size: 16px;
100
+ font-size: 13px;
101
101
  font-weight: 600;
102
102
  color: #ffffff;
103
103
  font-family: inherit;
104
104
  }
105
105
 
106
- .tool-card-body {
107
- display: flex;
108
- flex-direction: column;
109
- gap: 8px;
110
- }
111
-
112
- .tool-card-body p {
113
- margin: 0;
114
- font-size: 14px;
115
- color: #cccccc;
116
- line-height: 1.4;
117
- font-family: inherit;
118
- }
119
-
120
- .tool-card-meta {
121
- display: flex;
122
- justify-content: space-between;
123
- align-items: center;
124
- }
125
-
126
- .input-count {
127
- font-size: 12px;
128
- color: #8c8c8c;
129
- background: #1e1e1e;
130
- padding: 4px 8px;
131
- border-radius: 4px;
132
- font-family: inherit;
133
- }
106
+ /* Tool card body styles removed - now empty for compact design */
134
107
 
135
108
  /* Tool Form View */
136
109
  .tool-form {
@@ -152,27 +125,35 @@
152
125
  }
153
126
 
154
127
  .back-button {
155
- background: #3e3e42;
128
+ background: #333333;
156
129
  color: #cccccc;
157
130
  border: none;
158
131
  border-radius: 4px;
159
- padding: 8px 12px;
132
+ padding: 6px;
160
133
  font-size: 14px;
161
134
  font-family: inherit;
162
135
  cursor: pointer;
163
136
  transition: background-color 0.2s;
137
+ width: 28px;
138
+ height: 28px;
164
139
  display: flex;
165
140
  align-items: center;
166
- gap: 4px;
141
+ justify-content: center;
142
+ }
143
+
144
+ .back-button:hover:not(:disabled) {
145
+ background: #000000;
167
146
  }
168
147
 
169
- .back-button:hover {
170
- background: #4e4e52;
148
+ .back-button:disabled {
149
+ background: #2d2d30;
150
+ color: #8c8c8c;
151
+ cursor: not-allowed;
171
152
  }
172
153
 
173
154
  .tool-form-header h3 {
174
155
  margin: 0;
175
- font-size: 18px;
156
+ font-size: 14px;
176
157
  font-weight: 600;
177
158
  color: #ffffff;
178
159
  font-family: inherit;
@@ -190,7 +171,7 @@
190
171
 
191
172
  .tool-info p {
192
173
  margin: 0;
193
- font-size: 14px;
174
+ font-size: 12px;
194
175
  color: #cccccc;
195
176
  line-height: 1.5;
196
177
  font-family: inherit;
@@ -202,7 +183,7 @@
202
183
 
203
184
  .tool-inputs h4 {
204
185
  margin: 0 0 16px 0;
205
- font-size: 16px;
186
+ font-size: 13px;
206
187
  font-weight: 600;
207
188
  color: #ffffff;
208
189
  font-family: inherit;
@@ -221,7 +202,7 @@
221
202
  }
222
203
 
223
204
  .input-field label {
224
- font-size: 14px;
205
+ font-size: 12px;
225
206
  font-weight: 500;
226
207
  color: #cccccc;
227
208
  font-family: inherit;
@@ -237,8 +218,8 @@
237
218
  color: #cccccc;
238
219
  border: 1px solid #3e3e42;
239
220
  border-radius: 4px;
240
- padding: 8px 12px;
241
- font-size: 14px;
221
+ padding: 6px 10px;
222
+ font-size: 12px;
242
223
  font-family: inherit;
243
224
  outline: none;
244
225
  transition: border-color 0.2s;
@@ -255,14 +236,50 @@
255
236
  }
256
237
 
257
238
  .input-description {
258
- font-size: 12px;
239
+ font-size: 10px;
259
240
  color: #8c8c8c;
260
241
  font-style: italic;
261
242
  font-family: inherit;
262
243
  }
263
244
 
245
+ /* Nested Object Styles */
246
+ .nested-object {
247
+ background: #252526;
248
+ border: 1px solid #3e3e42;
249
+ border-radius: 6px;
250
+ padding: 12px;
251
+ margin-top: 8px;
252
+ }
253
+
254
+ .nested-object-label {
255
+ font-size: 12px;
256
+ font-weight: 600;
257
+ color: #ffffff;
258
+ margin-bottom: 12px;
259
+ font-family: inherit;
260
+ }
261
+
262
+ .nested-fields {
263
+ display: flex;
264
+ flex-direction: column;
265
+ gap: 12px;
266
+ }
267
+
268
+ .nested-field {
269
+ display: flex;
270
+ flex-direction: column;
271
+ gap: 6px;
272
+ }
273
+
274
+ .nested-label {
275
+ font-size: 11px;
276
+ font-weight: 500;
277
+ color: #cccccc;
278
+ font-family: inherit;
279
+ }
280
+
264
281
  .no-inputs {
265
- font-size: 14px;
282
+ font-size: 12px;
266
283
  color: #8c8c8c;
267
284
  font-style: italic;
268
285
  font-family: inherit;
@@ -277,8 +294,8 @@
277
294
  color: white;
278
295
  border: none;
279
296
  border-radius: 6px;
280
- padding: 12px 24px;
281
- font-size: 14px;
297
+ padding: 8px 16px;
298
+ font-size: 12px;
282
299
  font-weight: 500;
283
300
  font-family: inherit;
284
301
  cursor: pointer;
@@ -304,7 +321,7 @@
304
321
 
305
322
  .test-result h4 {
306
323
  margin: 0 0 12px 0;
307
- font-size: 16px;
324
+ font-size: 13px;
308
325
  font-weight: 600;
309
326
  color: #ffffff;
310
327
  font-family: inherit;
@@ -327,7 +344,7 @@
327
344
  }
328
345
 
329
346
  .result-label {
330
- font-size: 14px;
347
+ font-size: 12px;
331
348
  font-weight: 600;
332
349
  margin-bottom: 8px;
333
350
  font-family: inherit;
@@ -346,7 +363,7 @@
346
363
  color: #cccccc;
347
364
  padding: 12px;
348
365
  border-radius: 4px;
349
- font-size: 12px;
366
+ font-size: 10px;
350
367
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
351
368
  overflow-x: auto;
352
369
  margin: 0;
@@ -356,7 +373,7 @@
356
373
 
357
374
  .result-error {
358
375
  color: #f85149;
359
- font-size: 14px;
376
+ font-size: 12px;
360
377
  font-family: inherit;
361
378
  }
362
379
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lua-cli",
3
- "version": "1.3.2-alpha.0",
3
+ "version": "1.3.2-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
6
  "main": "dist/index.js",
@@ -0,0 +1,16 @@
1
+ agent:
2
+ agentId: "baseAgent_agent_1758705162448_cyu7ybbhx"
3
+ orgId: "ae25d3f8-5446-4135-806f-daf4ec55d010"
4
+ persona: |
5
+ Your name is Richard always remember that
6
+ welcomeMessage: "Hi, I am your AI assistant. How can I help you today?"
7
+
8
+ skill:
9
+ name: "test-3"
10
+ version: "0.0.1"
11
+ skillId: "0aa3b6fe-45b2-40a9-a19c-b7bf85cbc798"
12
+ env:
13
+ BASE_URL: "http://localhost:3000"
14
+ API_KEY: "1234567890"
15
+ NAME: "test-3"
16
+ PINECONE_API_KEY: "pcsk_5iFtQD_CzPDnQgjMwhDgVKwJhiYRq53U7agFc6yXiiwwJrTeEWoh1BveSZzvZwA8ZVXoky"
@@ -24,7 +24,7 @@
24
24
  }
25
25
  },
26
26
  "..": {
27
- "version": "1.3.0-alpha.1",
27
+ "version": "1.3.2-alpha.0",
28
28
  "license": "MIT",
29
29
  "dependencies": {
30
30
  "commander": "^14.0.1",
@@ -33,6 +33,10 @@
33
33
  "keytar": "^7.9.0",
34
34
  "node-fetch": "^3.3.2",
35
35
  "open": "^10.1.0",
36
+ "react": "^18.2.0",
37
+ "react-dom": "^18.2.0",
38
+ "socket.io-client": "^4.7.2",
39
+ "ws": "^8.18.3",
36
40
  "zod": "^4.1.9"
37
41
  },
38
42
  "bin": {
@@ -41,8 +45,12 @@
41
45
  "devDependencies": {
42
46
  "@types/inquirer": "^9.0.9",
43
47
  "@types/jest": "^29.5.8",
48
+ "@types/js-yaml": "^4.0.9",
44
49
  "@types/node": "^24.5.1",
45
50
  "@types/node-fetch": "^2.6.13",
51
+ "@types/react": "^18.2.0",
52
+ "@types/react-dom": "^18.2.0",
53
+ "@types/ws": "^8.18.1",
46
54
  "@typescript-eslint/parser": "^8.44.1",
47
55
  "@typescript-eslint/typescript-estree": "^8.44.1",
48
56
  "jest": "^29.7.0",
@@ -5,10 +5,10 @@
5
5
  "license": "ISC",
6
6
  "author": "",
7
7
  "type": "module",
8
- "main": "index.ts",
8
+ "main": "src/index.ts",
9
9
  "scripts": {
10
- "start": "tsx index.ts",
11
- "dev": "tsx watch index.ts",
10
+ "start": "tsx src/index.ts",
11
+ "dev": "tsx watch src/index.ts",
12
12
  "build": "tsc",
13
13
  "test": "echo \"Error: no test specified\" && exit 1"
14
14
  },
@@ -1,30 +1,20 @@
1
1
  import { LuaSkill } from "lua-cli/skill";
2
+
2
3
  import GetWeatherTool from "./tools/GetWeatherTool";
3
- import GetUserDataTool from "./tools/GetUserDataTool";
4
+ import { GetUserDataTool, CreateUserDataTool, UpdateUserDataTool } from "./tools/UserDataTool";
4
5
  import CreatePostTool from "./tools/CreatePostTool";
5
- import CalculatorTool from "./tools/CalculatorTool";
6
- import AdvancedMathTool from "./tools/AdvancedMathTool";
7
-
8
6
 
9
7
  // Initialize skill with tools
10
8
  const skill = new LuaSkill({
11
9
  description: "A comprehensive Lua skill with weather, user data, post creation, and mathematical tools",
12
10
  context: "This skill provides various utilities including weather information, user data retrieval, post creation, basic calculator operations, and advanced mathematical functions. Use get_weather to fetch current weather conditions for any city, get_user_data to retrieve user information, create_post to publish new posts, calculator for basic arithmetic operations, and advanced_math for complex mathematical computations like factorials, prime checking, fibonacci sequences, and greatest common divisor calculations."
13
11
  });
14
- skill.addTool(new GetWeatherTool());
15
- skill.addTool(new GetUserDataTool());
16
- skill.addTool(new CreatePostTool());
17
- skill.addTool(new CalculatorTool());
18
- skill.addTool(new AdvancedMathTool());
12
+ skill.addTools([new GetWeatherTool(), new GetUserDataTool(), new CreateUserDataTool(), new UpdateUserDataTool(), new CreatePostTool()]);
19
13
 
20
14
  // Test cases
21
15
  const testCases = [
22
16
  { tool: "get_weather", city: "London" },
23
17
  { tool: "get_user_data", userId: "user123" },
24
- { tool: "user_preferences", action: "get" },
25
- { tool: "user_preferences", action: "set", key: "theme", value: "dark" },
26
- { tool: "user_preferences", action: "set", key: "language", value: "en" },
27
- { tool: "user_preferences", action: "get" },
28
18
  { tool: "create_post", title: "Test Post", content: "This is a test post content" },
29
19
  { tool: "calculator", operation: "add", a: 5, b: 3 },
30
20
  { tool: "advanced_math", operation: "factorial", numbers: [5] },
@@ -2,37 +2,29 @@ import { LuaTool } from "lua-cli/skill";
2
2
  import { z } from "zod";
3
3
  import ApiService from "../services/ApiService";
4
4
 
5
- // Define schemas as static properties for Lua CLI detection
6
- const inputSchema = z.object({
7
- title: z.string(),
8
- content: z.string()
9
- });
10
5
 
11
- const outputSchema = z.object({
12
- id: z.string().nullable(),
13
- title: z.string(),
14
- status: z.string(),
15
- error: z.string().optional(),
16
- url: z.string().nullable()
17
- });
18
-
19
- export default class CreatePostTool implements LuaTool<typeof inputSchema, typeof outputSchema> {
20
- name: string;
21
- description: string;
22
- inputSchema: typeof inputSchema;
23
- outputSchema: typeof outputSchema;
6
+ export default class CreatePostTool implements LuaTool {
7
+ name = "create_post";
8
+ description = "Create a new post";
9
+ inputSchema = z.object({
10
+ title: z.string(),
11
+ content: z.string()
12
+ });
13
+ outputSchema = z.object({
14
+ id: z.string().nullable(),
15
+ title: z.string(),
16
+ status: z.string(),
17
+ error: z.string().optional(),
18
+ url: z.string().nullable()
19
+ });
24
20
 
25
21
  apiService: ApiService;
26
22
 
27
23
  constructor() {
28
- this.name = "create_post";
29
- this.description = "Create a new post";
30
- this.inputSchema = inputSchema;
31
- this.outputSchema = outputSchema;
32
24
  this.apiService = new ApiService();
33
25
  }
34
26
 
35
- async execute(input: z.infer<typeof inputSchema>) {
27
+ async execute(input: z.infer<typeof this.inputSchema>) {
36
28
  return this.apiService.createPost(input.title, input.content);
37
29
  }
38
30
  }
@@ -1,37 +1,36 @@
1
- import { LuaTool } from "lua-cli/skill";
1
+ import { LuaTool, env } from "lua-cli/skill";
2
2
  import { z } from "zod";
3
3
  import GetWeatherService from "../services/GetWeather";
4
4
 
5
- // Define schemas as static properties for Lua CLI detection
6
- const inputSchema = z.object({
7
- city: z.string()
8
- });
9
5
 
10
- const outputSchema = z.object({
11
- weather: z.string(),
12
- city: z.string(),
13
- temperature: z.number().optional(),
14
- humidity: z.number().optional(),
15
- description: z.string().optional()
16
- });
6
+ export default class GetWeatherTool implements LuaTool {
7
+ name = "get_weather";
8
+ description = "Get the weather for a given city";
9
+ inputSchema = z.object({
10
+ city: z.string()
11
+ });
12
+ outputSchema = z.object({
13
+ weather: z.string(),
14
+ city: z.string(),
15
+ temperature: z.number().optional(),
16
+ humidity: z.number().optional(),
17
+ description: z.string().optional()
18
+ });
17
19
 
18
- export default class GetWeatherTool implements LuaTool<typeof inputSchema, typeof outputSchema> {
19
- name: string;
20
- description: string;
21
- inputSchema: typeof inputSchema;
22
- outputSchema: typeof outputSchema;
23
-
24
20
  weatherService: GetWeatherService;
25
21
 
26
22
  constructor() {
27
- this.name = "get_weather";
28
- this.description = "Get the weather for a given city";
29
- this.inputSchema = inputSchema;
30
- this.outputSchema = outputSchema;
31
23
  this.weatherService = new GetWeatherService();
32
24
  }
33
25
 
34
- async execute(input: z.infer<typeof inputSchema>) {
26
+ async execute(input: z.infer<typeof this.inputSchema>) {
27
+ // Access environment variables safely using the env() function
28
+ const baseUrl = env('BASE_URL');
29
+ const apiKey = env('API_KEY');
30
+ const agentId = env('AGENT_ID');
31
+
32
+ console.error('Environment variables:', { baseUrl, apiKey, agentId });
33
+
35
34
  return this.weatherService.getWeather(input.city);
36
35
  }
37
36
  }
@@ -0,0 +1,56 @@
1
+ import { LuaTool } from "lua-cli/skill";
2
+ import { z } from "zod";
3
+ import { user } from 'lua-cli/user-data-api';
4
+
5
+
6
+ export class GetUserDataTool implements LuaTool {
7
+ name = "get_user_data";
8
+ description = "Get the user data for a given user id";
9
+ inputSchema = z.object({ });
10
+
11
+ constructor() {}
12
+
13
+ async execute(input: z.infer<typeof this.inputSchema>) {
14
+ return user.data.get();
15
+ }
16
+ }
17
+
18
+
19
+ export class CreateUserDataTool implements LuaTool {
20
+ name = "create_user_data";
21
+ description = "Get the user data for a given user id";
22
+ inputSchema = z.object({
23
+ data: z.object({
24
+ name: z.string(),
25
+ age: z.number()
26
+ })
27
+ });
28
+
29
+ constructor() {}
30
+
31
+ async execute(input: z.infer<typeof this.inputSchema>) {
32
+ console.log('createUserData tool', input);
33
+ const userData = await user.data.get();
34
+ if (userData.data) {
35
+ return user.data.update(input.data);
36
+ }
37
+ return user.data.create(input.data);
38
+ }
39
+ }
40
+
41
+ export class UpdateUserDataTool implements LuaTool {
42
+ name = "update_user_data";
43
+ description = "Update the user data for a given user id";
44
+ inputSchema = z.object({
45
+ data: z.object({
46
+ name: z.string().optional(),
47
+ age: z.number().optional()
48
+ })
49
+ });
50
+
51
+ constructor() {}
52
+
53
+ async execute(input: z.infer<typeof this.inputSchema>) {
54
+ return user.data.update(input.data);
55
+ }
56
+ }
@@ -1,61 +0,0 @@
1
- // Example: Simple Math Service
2
- export default class MathService {
3
- /**
4
- * Calculate the factorial of a number
5
- */
6
- factorial(n: number): number {
7
- if (n < 0) throw new Error("Factorial is not defined for negative numbers");
8
- if (n === 0 || n === 1) return 1;
9
- return n * this.factorial(n - 1);
10
- }
11
-
12
- /**
13
- * Check if a number is prime
14
- */
15
- isPrime(n: number): boolean {
16
- if (n < 2) return false;
17
- if (n === 2) return true;
18
- if (n % 2 === 0) return false;
19
-
20
- for (let i = 3; i <= Math.sqrt(n); i += 2) {
21
- if (n % i === 0) return false;
22
- }
23
-
24
- return true;
25
- }
26
-
27
- /**
28
- * Generate Fibonacci sequence up to n terms
29
- */
30
- fibonacci(n: number): number[] {
31
- if (n <= 0) return [];
32
- if (n === 1) return [0];
33
- if (n === 2) return [0, 1];
34
-
35
- const sequence = [0, 1];
36
- for (let i = 2; i < n; i++) {
37
- sequence.push(sequence[i - 1] + sequence[i - 2]);
38
- }
39
-
40
- return sequence;
41
- }
42
-
43
- /**
44
- * Calculate the greatest common divisor
45
- */
46
- gcd(a: number, b: number): number {
47
- while (b !== 0) {
48
- const temp = b;
49
- b = a % b;
50
- a = temp;
51
- }
52
- return Math.abs(a);
53
- }
54
-
55
- /**
56
- * Calculate the least common multiple
57
- */
58
- lcm(a: number, b: number): number {
59
- return Math.abs(a * b) / this.gcd(a, b);
60
- }
61
- }
@@ -1,82 +0,0 @@
1
- // Example: Advanced Math Tool using MathService
2
- import { LuaTool } from "lua-cli/skill";
3
- import { z } from "zod";
4
- import MathService from "../services/MathService";
5
-
6
- // Define schemas as static properties for Lua CLI detection
7
- const inputSchema = z.object({
8
- operation: z.enum(["factorial", "is_prime", "fibonacci", "gcd", "lcm"]).describe("Mathematical operation"),
9
- numbers: z.array(z.number()).describe("Numbers for the operation")
10
- });
11
-
12
- const outputSchema = z.object({
13
- result: z.any(),
14
- operation: z.string(),
15
- input: z.array(z.number())
16
- });
17
-
18
- export default class AdvancedMathTool implements LuaTool<typeof inputSchema, typeof outputSchema> {
19
- name: string;
20
- description: string;
21
- inputSchema: typeof inputSchema;
22
- outputSchema: typeof outputSchema;
23
- private mathService: MathService;
24
-
25
- constructor() {
26
- this.name = "advanced_math";
27
- this.description = "Perform advanced mathematical operations";
28
- this.inputSchema = inputSchema;
29
- this.outputSchema = outputSchema;
30
- this.mathService = new MathService();
31
- }
32
-
33
- async execute(input: z.infer<typeof inputSchema>) {
34
- let result: any;
35
-
36
- switch (input.operation) {
37
- case "factorial":
38
- if (input.numbers.length !== 1) {
39
- throw new Error("Factorial requires exactly one number");
40
- }
41
- result = this.mathService.factorial(input.numbers[0]);
42
- break;
43
-
44
- case "is_prime":
45
- if (input.numbers.length !== 1) {
46
- throw new Error("Prime check requires exactly one number");
47
- }
48
- result = this.mathService.isPrime(input.numbers[0]);
49
- break;
50
-
51
- case "fibonacci":
52
- if (input.numbers.length !== 1) {
53
- throw new Error("Fibonacci requires exactly one number");
54
- }
55
- result = this.mathService.fibonacci(input.numbers[0]);
56
- break;
57
-
58
- case "gcd":
59
- if (input.numbers.length !== 2) {
60
- throw new Error("GCD requires exactly two numbers");
61
- }
62
- result = this.mathService.gcd(input.numbers[0], input.numbers[1]);
63
- break;
64
-
65
- case "lcm":
66
- if (input.numbers.length !== 2) {
67
- throw new Error("LCM requires exactly two numbers");
68
- }
69
- result = this.mathService.lcm(input.numbers[0], input.numbers[1]);
70
- break;
71
-
72
- default:
73
- throw new Error(`Unknown operation: ${input.operation}`);
74
- }
75
-
76
- return {
77
- result,
78
- operation: input.operation,
79
- input: input.numbers
80
- };
81
- }
82
- }