lua-cli 2.0.6 → 2.1.0-alpha.14
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/dist/commands/compile.js +18 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/product-api.d.ts +48 -0
- package/dist/product-api.js +61 -0
- package/dist/services/api.d.ts +20 -5
- package/dist/services/api.js +50 -5
- package/dist/utils/sandbox.js +26 -1
- package/dist/web/app.css +447 -0
- package/dist/web/app.js +20 -20
- package/package.json +3 -2
- package/template/lua-skill-1.0.1-beta.0.tgz +0 -0
- package/template/lua.skill.yaml +5 -7
- package/template/package-lock.json +72 -7
- package/template/package.json +2 -1
- package/template/src/index.ts +6 -1
- package/template/src/tools/ProductsTool.ts +75 -0
- package/template/src/tools/SearchProducts.ts +0 -43
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lua-cli",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.1.0-alpha.14",
|
|
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",
|
|
Binary file
|
package/template/lua.skill.yaml
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
agent:
|
|
2
|
-
agentId:
|
|
3
|
-
orgId:
|
|
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
5
|
- name: general-skill
|
|
8
6
|
version: 0.0.2
|
|
9
|
-
skillId:
|
|
7
|
+
skillId: 5d990e43-6204-43af-8246-67dedeb80c68
|
|
10
8
|
- name: user-data-skill
|
|
11
9
|
version: 0.0.1
|
|
12
|
-
skillId:
|
|
10
|
+
skillId: 457bb68a-a136-4671-9bb0-9263a262eb41
|
|
13
11
|
- name: eccomerce-skill
|
|
14
12
|
version: 0.0.1
|
|
15
|
-
skillId:
|
|
13
|
+
skillId: e1976320-2bdb-4622-bfde-fe20eabe8360
|
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
"axios": "^1.6.0",
|
|
16
16
|
"inquirer": "^12.9.6",
|
|
17
17
|
"js-yaml": "^4.1.0",
|
|
18
|
-
"lua-cli": "2.0.
|
|
18
|
+
"lua-cli": "file:../lua-cli-2.1.0-alpha.13.tgz",
|
|
19
19
|
"openai": "^5.23.0",
|
|
20
|
+
"uuid": "^13.0.0",
|
|
20
21
|
"zod": "^3.24.1"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
@@ -1209,9 +1210,9 @@
|
|
|
1209
1210
|
}
|
|
1210
1211
|
},
|
|
1211
1212
|
"node_modules/debug": {
|
|
1212
|
-
"version": "4.3
|
|
1213
|
-
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.
|
|
1214
|
-
"integrity": "sha512-
|
|
1213
|
+
"version": "4.4.3",
|
|
1214
|
+
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
|
1215
|
+
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
|
1215
1216
|
"license": "MIT",
|
|
1216
1217
|
"dependencies": {
|
|
1217
1218
|
"ms": "^2.1.3"
|
|
@@ -1384,6 +1385,23 @@
|
|
|
1384
1385
|
"xmlhttprequest-ssl": "~2.1.1"
|
|
1385
1386
|
}
|
|
1386
1387
|
},
|
|
1388
|
+
"node_modules/engine.io-client/node_modules/debug": {
|
|
1389
|
+
"version": "4.3.7",
|
|
1390
|
+
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
|
|
1391
|
+
"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
|
|
1392
|
+
"license": "MIT",
|
|
1393
|
+
"dependencies": {
|
|
1394
|
+
"ms": "^2.1.3"
|
|
1395
|
+
},
|
|
1396
|
+
"engines": {
|
|
1397
|
+
"node": ">=6.0"
|
|
1398
|
+
},
|
|
1399
|
+
"peerDependenciesMeta": {
|
|
1400
|
+
"supports-color": {
|
|
1401
|
+
"optional": true
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
},
|
|
1387
1405
|
"node_modules/engine.io-client/node_modules/ws": {
|
|
1388
1406
|
"version": "8.17.1",
|
|
1389
1407
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
|
|
@@ -2045,9 +2063,9 @@
|
|
|
2045
2063
|
}
|
|
2046
2064
|
},
|
|
2047
2065
|
"node_modules/lua-cli": {
|
|
2048
|
-
"version": "2.0.
|
|
2049
|
-
"resolved": "
|
|
2050
|
-
"integrity": "sha512-
|
|
2066
|
+
"version": "2.1.0-alpha.13",
|
|
2067
|
+
"resolved": "file:../lua-cli-2.1.0-alpha.13.tgz",
|
|
2068
|
+
"integrity": "sha512-DqeKYOVtCudnJQO6V/Vy4kpHoAItdIPC6v1v3+0gxF4Q502q1NV0Jdm22XmQzN2G3rkoOTcqmZht/+f3+QLi2Q==",
|
|
2051
2069
|
"license": "MIT",
|
|
2052
2070
|
"dependencies": {
|
|
2053
2071
|
"commander": "^14.0.1",
|
|
@@ -3233,6 +3251,23 @@
|
|
|
3233
3251
|
"node": ">=10.0.0"
|
|
3234
3252
|
}
|
|
3235
3253
|
},
|
|
3254
|
+
"node_modules/socket.io-client/node_modules/debug": {
|
|
3255
|
+
"version": "4.3.7",
|
|
3256
|
+
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
|
|
3257
|
+
"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
|
|
3258
|
+
"license": "MIT",
|
|
3259
|
+
"dependencies": {
|
|
3260
|
+
"ms": "^2.1.3"
|
|
3261
|
+
},
|
|
3262
|
+
"engines": {
|
|
3263
|
+
"node": ">=6.0"
|
|
3264
|
+
},
|
|
3265
|
+
"peerDependenciesMeta": {
|
|
3266
|
+
"supports-color": {
|
|
3267
|
+
"optional": true
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
},
|
|
3236
3271
|
"node_modules/socket.io-parser": {
|
|
3237
3272
|
"version": "4.2.4",
|
|
3238
3273
|
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz",
|
|
@@ -3246,6 +3281,23 @@
|
|
|
3246
3281
|
"node": ">=10.0.0"
|
|
3247
3282
|
}
|
|
3248
3283
|
},
|
|
3284
|
+
"node_modules/socket.io-parser/node_modules/debug": {
|
|
3285
|
+
"version": "4.3.7",
|
|
3286
|
+
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
|
|
3287
|
+
"integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
|
|
3288
|
+
"license": "MIT",
|
|
3289
|
+
"dependencies": {
|
|
3290
|
+
"ms": "^2.1.3"
|
|
3291
|
+
},
|
|
3292
|
+
"engines": {
|
|
3293
|
+
"node": ">=6.0"
|
|
3294
|
+
},
|
|
3295
|
+
"peerDependenciesMeta": {
|
|
3296
|
+
"supports-color": {
|
|
3297
|
+
"optional": true
|
|
3298
|
+
}
|
|
3299
|
+
}
|
|
3300
|
+
},
|
|
3249
3301
|
"node_modules/space-separated-tokens": {
|
|
3250
3302
|
"version": "2.0.2",
|
|
3251
3303
|
"resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz",
|
|
@@ -3557,6 +3609,19 @@
|
|
|
3557
3609
|
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
|
|
3558
3610
|
"license": "MIT"
|
|
3559
3611
|
},
|
|
3612
|
+
"node_modules/uuid": {
|
|
3613
|
+
"version": "13.0.0",
|
|
3614
|
+
"resolved": "https://registry.npmjs.org/uuid/-/uuid-13.0.0.tgz",
|
|
3615
|
+
"integrity": "sha512-XQegIaBTVUjSHliKqcnFqYypAd4S+WCYt5NIeRs6w/UAry7z8Y9j5ZwRRL4kzq9U3sD6v+85er9FvkEaBpji2w==",
|
|
3616
|
+
"funding": [
|
|
3617
|
+
"https://github.com/sponsors/broofa",
|
|
3618
|
+
"https://github.com/sponsors/ctavan"
|
|
3619
|
+
],
|
|
3620
|
+
"license": "MIT",
|
|
3621
|
+
"bin": {
|
|
3622
|
+
"uuid": "dist-node/bin/uuid"
|
|
3623
|
+
}
|
|
3624
|
+
},
|
|
3560
3625
|
"node_modules/vfile": {
|
|
3561
3626
|
"version": "6.0.3",
|
|
3562
3627
|
"resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz",
|
package/template/package.json
CHANGED
package/template/src/index.ts
CHANGED
|
@@ -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/
|
|
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
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { env, LuaTool } from "lua-cli/skill";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { product } from 'lua-cli/product-api';
|
|
4
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
5
|
+
export class SearchProductsTool implements LuaTool {
|
|
6
|
+
name = "search_products";
|
|
7
|
+
description = "Search for products";
|
|
8
|
+
inputSchema = z.object({
|
|
9
|
+
query: z.string()
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
constructor() {}
|
|
13
|
+
|
|
14
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
15
|
+
return await product.data.search(input.query);
|
|
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
|
+
});
|
|
26
|
+
|
|
27
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
28
|
+
return product.data.get(input.page, input.limit);
|
|
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
|
+
});
|
|
42
|
+
|
|
43
|
+
async execute(input: z.infer<typeof this.inputSchema>) {
|
|
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);
|
|
62
|
+
}
|
|
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
|
+
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { env, LuaTool } from "lua-cli/skill";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { user } from 'lua-cli/user-data-api';
|
|
4
|
-
import { Pinecone, Index } from '@pinecone-database/pinecone';
|
|
5
|
-
import OpenAI from "openai";
|
|
6
|
-
export class SearchProductsTool implements LuaTool {
|
|
7
|
-
name = "search_products";
|
|
8
|
-
description = "Search for products";
|
|
9
|
-
inputSchema = z.object({
|
|
10
|
-
query: z.string()
|
|
11
|
-
});
|
|
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');
|
|
23
|
-
}
|
|
24
|
-
|
|
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;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
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;
|
|
42
|
-
}
|
|
43
|
-
}
|