feat: 插件-工具合并 — 创建 pkg/plugins 共享模块并移除 tool-engine
- 新增 backend/pkg/plugins/ 共享模块:SDK 接口、PluginManager、ToolRegistry(含环形缓冲区调用日志) - 13 个通用插件从 plugin-manager 迁移至共享模块(import 路径统一) - ai-core 切换至共享 ToolRegistry,进程内执行(零网络开销),包装 6 个专属工具 - plugin-manager 迁移至共享模块,保留管理 REST API - 新增 DevTools 插件管理面板(侧边栏 → 🔌 插件管理) - 移除 tool-engine 服务(从 go.work、DevTools 配置、编译系统) - 工具调用记录 API 从 Tool-Engine 迁至 AI-Core(/api/v1/tools/calls) - ai-core ContextStore 启动时从 PostgreSQL 恢复会话历史 - 清理所有过时引用和备份文件 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/yourname/cyrene-ai/plugin-manager/internal/manager"
|
||||
"github.com/yourname/cyrene-ai/pkg/plugins/manager"
|
||||
)
|
||||
|
||||
// PluginHandler exposes the Plugin Manager REST API via net/http.
|
||||
@@ -39,13 +39,11 @@ func (h *PluginHandler) listPlugins(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func (h *PluginHandler) pluginRoute(w http.ResponseWriter, r *http.Request) {
|
||||
// Path: /api/v1/plugins/{id}[/enable|/disable|/reload|/tools]
|
||||
path := strings.TrimPrefix(r.URL.Path, "/api/v1/plugins/")
|
||||
parts := strings.SplitN(path, "/", 2)
|
||||
pluginID := parts[0]
|
||||
|
||||
if pluginID == "" {
|
||||
// GET /api/v1/plugins (handled by listPlugins normally)
|
||||
h.listPlugins(w, r)
|
||||
return
|
||||
}
|
||||
@@ -163,7 +161,6 @@ func (h *PluginHandler) toolRoute(w http.ResponseWriter, r *http.Request) {
|
||||
path := strings.TrimPrefix(r.URL.Path, "/api/v1/tools/")
|
||||
toolID := path
|
||||
|
||||
// Check if this is an execute call
|
||||
if strings.HasSuffix(path, "/execute") {
|
||||
toolID = strings.TrimSuffix(path, "/execute")
|
||||
if r.Method != "POST" {
|
||||
|
||||
Reference in New Issue
Block a user