@timmy_hu/plugin-middleware 1.0.1 → 1.0.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.
- package/.xpertai-plugin/plugin.json +2 -2
- package/examples/request.example.json +90 -30
- package/index.js +275 -285
- package/package.json +1 -1
- package/src/middlewares/plugin-middleware.middleware.ts +271 -146
- package/src/schemas/config.schema.ts +3 -14
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "插件中间件",
|
|
3
3
|
"code": "plugin-middleware",
|
|
4
|
-
"version": "1.0.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "1.0.2",
|
|
5
|
+
"description": "自动发现 XpertAI 平台上所有已安装的中间件类型插件,展示加载状态,支持从 npm 安装新插件、搜索、统计。通过 /api/auth/login 登录获取 token。",
|
|
6
6
|
"createdBy": "fpi",
|
|
7
7
|
"platform": "http://10.161.48.53:3300",
|
|
8
8
|
"category": "middleware",
|
|
@@ -9,69 +9,129 @@
|
|
|
9
9
|
"loggedIn": true,
|
|
10
10
|
"email": "hu_cao@fpi-inc.com",
|
|
11
11
|
"platformUrl": "http://10.161.48.53:3300",
|
|
12
|
+
"organizationId": "a8313602-e2e2-4597-bf6d-f9b5e39b3b15",
|
|
12
13
|
"tokenExpiry": "2026-07-07T11:00:00.000Z",
|
|
14
|
+
"cachedPlugins": 36,
|
|
15
|
+
"cachedMiddleware": 14,
|
|
13
16
|
"message": "登录状态正常,token 有效"
|
|
14
17
|
}
|
|
15
18
|
},
|
|
16
19
|
{
|
|
17
20
|
"name": "list_middleware_plugins",
|
|
18
|
-
"description": "
|
|
21
|
+
"description": "列出所有已安装的中间件类型插件",
|
|
19
22
|
"input": { "filter": "all" },
|
|
20
23
|
"expectedOutput": {
|
|
21
24
|
"success": true,
|
|
22
|
-
"total":
|
|
25
|
+
"total": 14,
|
|
26
|
+
"totalAllPlugins": 36,
|
|
27
|
+
"totalMiddleware": 14,
|
|
28
|
+
"filter": "all",
|
|
23
29
|
"plugins": [
|
|
24
|
-
{
|
|
25
|
-
|
|
30
|
+
{
|
|
31
|
+
"name": "echarts-generator",
|
|
32
|
+
"packageName": "@timmy_hu/echarts-generator",
|
|
33
|
+
"displayName": "ECharts图表生成器",
|
|
34
|
+
"version": "1.0.0",
|
|
35
|
+
"description": "根据输入的一组或多组数据生成ECharts图表配置",
|
|
36
|
+
"category": "middleware",
|
|
37
|
+
"loadStatus": "loaded",
|
|
38
|
+
"loadError": null,
|
|
39
|
+
"configurationStatus": "valid",
|
|
40
|
+
"canUninstall": true,
|
|
41
|
+
"effectiveInCurrentScope": true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "@xpert-ai/plugin-web-tools",
|
|
45
|
+
"packageName": "@xpert-ai/plugin-web-tools",
|
|
46
|
+
"displayName": "@xpert-ai/plugin-web-tools",
|
|
47
|
+
"version": "0.0.3",
|
|
48
|
+
"description": "A middleware that provides web fetch and web search tools for agents.",
|
|
49
|
+
"category": "middleware",
|
|
50
|
+
"loadStatus": "loaded",
|
|
51
|
+
"loadError": null
|
|
52
|
+
}
|
|
26
53
|
]
|
|
27
54
|
}
|
|
28
55
|
},
|
|
29
56
|
{
|
|
30
|
-
"name": "
|
|
31
|
-
"description": "
|
|
32
|
-
"input": { "
|
|
57
|
+
"name": "get_middleware_plugin_detail",
|
|
58
|
+
"description": "查询指定中间件插件的详细信息",
|
|
59
|
+
"input": { "pluginNameOrPackage": "echarts-generator" },
|
|
33
60
|
"expectedOutput": {
|
|
34
61
|
"success": true,
|
|
35
|
-
"
|
|
36
|
-
|
|
62
|
+
"plugin": {
|
|
63
|
+
"name": "echarts-generator",
|
|
64
|
+
"packageName": "@timmy_hu/echarts-generator",
|
|
65
|
+
"displayName": "ECharts图表生成器",
|
|
66
|
+
"version": "1.0.0",
|
|
67
|
+
"description": "根据输入的一组或多组数据生成ECharts图表配置",
|
|
68
|
+
"loadStatus": "loaded",
|
|
69
|
+
"configurationStatus": "valid",
|
|
70
|
+
"components": []
|
|
71
|
+
}
|
|
37
72
|
}
|
|
38
73
|
},
|
|
39
74
|
{
|
|
40
|
-
"name": "
|
|
41
|
-
"description": "
|
|
42
|
-
"input": { "
|
|
75
|
+
"name": "install_middleware_plugin",
|
|
76
|
+
"description": "从 npm 安装新的中间件插件",
|
|
77
|
+
"input": { "packageName": "@timmy_hu/bulk-email-sender", "version": "1.0.1" },
|
|
43
78
|
"expectedOutput": {
|
|
44
79
|
"success": true,
|
|
45
|
-
"message": "插件
|
|
46
|
-
"
|
|
80
|
+
"message": "插件 @timmy_hu/bulk-email-sender 安装成功",
|
|
81
|
+
"installed": {
|
|
82
|
+
"name": "@timmy_hu/bulk-email-sender",
|
|
83
|
+
"packageName": "@timmy_hu/bulk-email-sender",
|
|
84
|
+
"version": "1.0.1",
|
|
85
|
+
"organizationId": "a8313602-e2e2-4597-bf6d-f9b5e39b3b15"
|
|
86
|
+
}
|
|
47
87
|
}
|
|
48
88
|
},
|
|
49
89
|
{
|
|
50
|
-
"name": "
|
|
51
|
-
"description": "
|
|
52
|
-
"input": { "
|
|
90
|
+
"name": "search_middleware_plugins",
|
|
91
|
+
"description": "按关键词搜索中间件插件",
|
|
92
|
+
"input": { "keyword": "email" },
|
|
53
93
|
"expectedOutput": {
|
|
54
94
|
"success": true,
|
|
55
|
-
"
|
|
95
|
+
"keyword": "email",
|
|
96
|
+
"total": 1,
|
|
97
|
+
"plugins": [
|
|
98
|
+
{
|
|
99
|
+
"name": "@timmy_hu/bulk-email-sender",
|
|
100
|
+
"displayName": "批量邮件发送",
|
|
101
|
+
"version": "1.0.1",
|
|
102
|
+
"description": "为 XpertAI 智能体提供基于 SMTP 协议的批量邮件发送能力",
|
|
103
|
+
"loadStatus": "loaded"
|
|
104
|
+
}
|
|
105
|
+
]
|
|
56
106
|
}
|
|
57
107
|
},
|
|
58
108
|
{
|
|
59
|
-
"name": "
|
|
60
|
-
"description": "
|
|
109
|
+
"name": "get_plugin_statistics",
|
|
110
|
+
"description": "获取插件统计信息",
|
|
61
111
|
"input": {},
|
|
62
|
-
"expectedOutput": {
|
|
112
|
+
"expectedOutput": {
|
|
113
|
+
"success": true,
|
|
114
|
+
"statistics": {
|
|
115
|
+
"totalPlugins": 36,
|
|
116
|
+
"totalMiddleware": 14,
|
|
117
|
+
"byCategory": { "middleware": 14, "model": 10, "integration": 4, "database": 2, "tools": 2, "set": 3, "vector-store": 1 },
|
|
118
|
+
"middlewareByLoadStatus": { "loaded": 14 },
|
|
119
|
+
"updatableCount": 0,
|
|
120
|
+
"configErrorCount": 0,
|
|
121
|
+
"loadErrorCount": 0
|
|
122
|
+
}
|
|
123
|
+
}
|
|
63
124
|
},
|
|
64
125
|
{
|
|
65
|
-
"name": "
|
|
66
|
-
"description": "
|
|
67
|
-
"input": {
|
|
126
|
+
"name": "refresh_plugin_list",
|
|
127
|
+
"description": "刷新插件列表缓存",
|
|
128
|
+
"input": {},
|
|
68
129
|
"expectedOutput": {
|
|
69
|
-
"success": true,
|
|
70
|
-
"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
]
|
|
130
|
+
"success": true,
|
|
131
|
+
"message": "插件列表已刷新,共发现 36 个插件,其中 14 个中间件类型",
|
|
132
|
+
"totalPlugins": 36,
|
|
133
|
+
"totalMiddleware": 14,
|
|
134
|
+
"refreshedAt": "2026-07-07T10:15:00.000Z"
|
|
75
135
|
}
|
|
76
136
|
}
|
|
77
137
|
]
|