lua-cli 2.1.0-alpha.4 → 2.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lua-cli",
3
- "version": "2.1.0-alpha.4",
3
+ "version": "2.1.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,8 @@
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"
12
13
  },
13
14
  "scripts": {
14
15
  "clean": "rm -rf dist",
@@ -34,7 +35,7 @@
34
35
  "deployment",
35
36
  "skills"
36
37
  ],
37
- "author": "Stefan Kruger <stefan@lua.dev>",
38
+ "author": "Stefan Kruger <stefan@heylua.ai>",
38
39
  "license": "MIT",
39
40
  "type": "module",
40
41
  "repository": {
@@ -1,15 +1,4 @@
1
1
  agent:
2
- agentId: baseAgent_agent_1758705162448_cyu7ybbhx
3
- orgId: ae25d3f8-5446-4135-806f-daf4ec55d010
4
- persona: Your name is Stefan always remember that
5
- welcomeMessage: 'Hi, I am your AI assistant. How can I help you today?'
2
+ agentId: baseAgent_agent_1759165790010_cmu8t35ta
3
+ orgId: 845c77a8-88b9-4381-ba4a-fd7496ef1f57
6
4
  skills:
7
- - name: general-skill
8
- version: 0.0.2
9
- skillId: 24294a5a-bd95-4167-89b1-aebad352196a
10
- - name: user-data-skill
11
- version: 0.0.1
12
- skillId: 5c167305-9f59-4e20-84e9-fd1b50856ec4
13
- - name: eccomerce-skill
14
- version: 0.0.1
15
- skillId: dbec43db-9786-4223-9eac-8087d976d22d
@@ -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.4",
22
+ "lua-cli": "2.1.0",
23
23
  "openai": "^5.23.0",
24
+ "uuid": "^13.0.0",
24
25
  "zod": "^3.24.1"
25
26
  },
26
27
  "devDependencies": {
@@ -2,9 +2,10 @@ 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 } from "./tools/SearchProducts";
5
+ import { SearchProductsTool, GetAllProductsTool, CreateProductTool, UpdateProductTool, DeleteProductTool } from "./tools/ProductsTool";
6
6
  import CreatePaymentLinkTool from "./tools/PaymentTool";
7
7
 
8
+
8
9
  // Initialize skill with tools
9
10
  const generalSkill = new LuaSkill({
10
11
  name: "general-skill",
@@ -42,6 +43,10 @@ const eccomerceSkill = new LuaSkill({
42
43
 
43
44
  eccomerceSkill.addTools([
44
45
  new SearchProductsTool(),
46
+ new GetAllProductsTool(),
47
+ new CreateProductTool(),
48
+ new UpdateProductTool(),
49
+ new DeleteProductTool(),
45
50
  new CreatePaymentLinkTool()
46
51
  ]);
47
52
 
@@ -1,43 +1,75 @@
1
1
  import { env, LuaTool } from "lua-cli/skill";
2
2
  import { z } from "zod";
3
3
  import { product } from 'lua-cli/product-api';
4
- import { Pinecone, Index } from '@pinecone-database/pinecone';
5
- import OpenAI from "openai";
4
+ import { v4 as uuidv4 } from 'uuid';
6
5
  export class SearchProductsTool implements LuaTool {
7
6
  name = "search_products";
8
7
  description = "Search for products";
9
8
  inputSchema = z.object({
10
9
  query: z.string()
11
10
  });
12
- pinecone: Pinecone;
13
- openai: OpenAI;
14
- index: Index;
15
-
16
- constructor() {
17
- const pinecone = new Pinecone({
18
- apiKey: env('PINECONE_API_KEY') || ''
19
- });
20
- this.openai = new OpenAI({ apiKey: env('OPENAI_API_KEY') || '' });
21
- this.pinecone = pinecone;
22
- this.index = pinecone.Index('products-demo');
11
+
12
+ constructor() {}
13
+
14
+ async execute(input: z.infer<typeof this.inputSchema>) {
15
+ return await product.data.search(input.query);
23
16
  }
17
+ }
18
+
19
+ export class GetAllProductsTool implements LuaTool {
20
+ name = "get_all_products";
21
+ description = "Get all products";
22
+ inputSchema = z.object({
23
+ page: z.number().optional(),
24
+ limit: z.number().optional()
25
+ });
24
26
 
25
- async embedText(text: string) {
26
- const embeddingResponse = await this.openai.embeddings.create({
27
- model: "text-embedding-3-small",
28
- input: text,
29
- });
30
- return embeddingResponse.data[0].embedding;
27
+ async execute(input: z.infer<typeof this.inputSchema>) {
28
+ return product.data.get(input.page, input.limit);
31
29
  }
30
+ }
31
+
32
+ export class CreateProductTool implements LuaTool {
33
+ name = "create_product";
34
+ description = "Create a new product";
35
+ inputSchema = z.object({
36
+ product: z.object({
37
+ name: z.string(),
38
+ description: z.string(),
39
+ price: z.number()
40
+ })
41
+ });
32
42
 
33
43
  async execute(input: z.infer<typeof this.inputSchema>) {
34
- const queryVector = await this.embedText(input.query);
35
- const results = await this.index.query({
36
- vector: queryVector,
37
- topK: 3,
38
- includeMetadata: true,
39
- });
40
- console.log(results);
41
- return results;
44
+ return product.data.create({...input.product, id: uuidv4()});
45
+ }
46
+ }
47
+
48
+ export class UpdateProductTool implements LuaTool {
49
+ name = "update_product";
50
+ description = "Update an existing product";
51
+ inputSchema = z.object({
52
+ product: z.object({
53
+ id: z.string(),
54
+ name: z.string(),
55
+ description: z.string(),
56
+ price: z.number()
57
+ })
58
+ });
59
+
60
+ async execute(input: z.infer<typeof this.inputSchema>) {
61
+ return product.data.update({...input.product, id: uuidv4()}, input.product.id);
42
62
  }
43
63
  }
64
+
65
+ export class DeleteProductTool implements LuaTool {
66
+ name = "delete_product";
67
+ description = "Delete an existing product";
68
+ inputSchema = z.object({
69
+ id: z.string()
70
+ });
71
+
72
+ async execute(input: z.infer<typeof this.inputSchema>) {
73
+ return product.data.delete(input.id);
74
+ }
75
+ }