@fastgpt-plugin/cli 0.1.0-beta.8 → 0.2.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.en.md +71 -0
- package/README.md +41 -4
- package/dist/index.js +1311 -95
- package/package.json +6 -3
- package/templates/tool/index.tool.ts +11 -3
- package/templates/tool/index.toolset.ts +39 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fastgpt-plugin/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-alpha.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -17,18 +17,21 @@
|
|
|
17
17
|
"skills"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@oxc-parser/binding-wasm32-wasi": "^0.112.0",
|
|
21
20
|
"@inquirer/prompts": "^8.2.0",
|
|
21
|
+
"@oxc-parser/binding-wasm32-wasi": "^0.112.0",
|
|
22
22
|
"commander": "^14.0.3",
|
|
23
23
|
"consola": "^3.4.2",
|
|
24
24
|
"es-toolkit": "^1.44.0",
|
|
25
|
+
"ink": "^7.1.0",
|
|
25
26
|
"oxc-parser": "^0.112.0",
|
|
27
|
+
"react": "^19.2.7",
|
|
26
28
|
"tsdown": "^0.21.10",
|
|
27
|
-
"yazl": "^3.3.1",
|
|
28
29
|
"yaml": "^2.6.1",
|
|
30
|
+
"yazl": "^3.3.1",
|
|
29
31
|
"zod": "^4"
|
|
30
32
|
},
|
|
31
33
|
"devDependencies": {
|
|
34
|
+
"@types/react": "^19.2.17",
|
|
32
35
|
"@types/yazl": "^3.3.0",
|
|
33
36
|
"typescript": "^5",
|
|
34
37
|
"vite-tsconfig-paths": "^6.0.5",
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createToolHandler,
|
|
3
|
+
defineTool,
|
|
4
|
+
type InputSchemaMetaType,
|
|
5
|
+
type OutputSchemaMetaType
|
|
6
|
+
} from '@fastgpt-plugin/sdk-factory';
|
|
2
7
|
import z from 'zod';
|
|
3
8
|
|
|
4
9
|
const handler = createToolHandler({
|
|
5
10
|
inputSchema: z.object({
|
|
6
|
-
delay: z.number()
|
|
11
|
+
delay: z.number().meta({
|
|
12
|
+
title: 'Delay',
|
|
13
|
+
description: 'Delay duration in milliseconds'
|
|
14
|
+
} satisfies InputSchemaMetaType)
|
|
7
15
|
}),
|
|
8
|
-
outputSchema: z.object({}),
|
|
16
|
+
outputSchema: z.object({}).meta({} satisfies OutputSchemaMetaType),
|
|
9
17
|
handler: async (input, _ctx) => {
|
|
10
18
|
await new Promise((resolve) => setTimeout(resolve, input.delay));
|
|
11
19
|
return {};
|
|
@@ -1,20 +1,45 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createToolHandler,
|
|
3
|
+
defineToolSet,
|
|
4
|
+
type InputSchemaMetaType,
|
|
5
|
+
type OutputSchemaMetaType,
|
|
6
|
+
type SecretSchemaMetaType
|
|
7
|
+
} from '@fastgpt-plugin/sdk-factory';
|
|
2
8
|
import z from 'zod';
|
|
3
9
|
|
|
4
10
|
const secretSchema = z.object({
|
|
5
|
-
host: z.string()
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
host: z.string().meta({
|
|
12
|
+
title: 'Host',
|
|
13
|
+
isSecret: false
|
|
14
|
+
} satisfies SecretSchemaMetaType),
|
|
15
|
+
port: z.number().meta({
|
|
16
|
+
title: 'Port',
|
|
17
|
+
isSecret: false
|
|
18
|
+
} satisfies SecretSchemaMetaType),
|
|
19
|
+
username: z.string().meta({
|
|
20
|
+
title: 'Username',
|
|
21
|
+
isSecret: false
|
|
22
|
+
} satisfies SecretSchemaMetaType),
|
|
23
|
+
password: z.string().meta({
|
|
24
|
+
title: 'Password',
|
|
25
|
+
isSecret: true
|
|
26
|
+
} satisfies SecretSchemaMetaType),
|
|
27
|
+
database: z.string().meta({
|
|
28
|
+
title: 'Database',
|
|
29
|
+
isSecret: false
|
|
30
|
+
} satisfies SecretSchemaMetaType)
|
|
10
31
|
});
|
|
11
32
|
|
|
12
33
|
const mysqlHandler = createToolHandler({
|
|
13
34
|
inputSchema: z.object({
|
|
14
|
-
query: z.string()
|
|
35
|
+
query: z.string().meta({
|
|
36
|
+
title: 'SQL Query'
|
|
37
|
+
} satisfies InputSchemaMetaType)
|
|
15
38
|
}),
|
|
16
39
|
outputSchema: z.object({
|
|
17
|
-
results: z.array(z.record(z.string(), z.unknown()))
|
|
40
|
+
results: z.array(z.record(z.string(), z.unknown())).meta({
|
|
41
|
+
title: 'Query Results'
|
|
42
|
+
} satisfies OutputSchemaMetaType)
|
|
18
43
|
}),
|
|
19
44
|
secretSchema,
|
|
20
45
|
handler: async (input, ctx) => {
|
|
@@ -36,10 +61,14 @@ const mysqlHandler = createToolHandler({
|
|
|
36
61
|
|
|
37
62
|
const pgsqlHandler = createToolHandler({
|
|
38
63
|
inputSchema: z.object({
|
|
39
|
-
query: z.string()
|
|
64
|
+
query: z.string().meta({
|
|
65
|
+
title: 'SQL Query'
|
|
66
|
+
} satisfies InputSchemaMetaType)
|
|
40
67
|
}),
|
|
41
68
|
outputSchema: z.object({
|
|
42
|
-
results: z.array(z.record(z.string(), z.unknown()))
|
|
69
|
+
results: z.array(z.record(z.string(), z.unknown())).meta({
|
|
70
|
+
title: 'Query Results'
|
|
71
|
+
} satisfies OutputSchemaMetaType)
|
|
43
72
|
}),
|
|
44
73
|
secretSchema,
|
|
45
74
|
handler: async (input, ctx) => {
|