feat: Phase 3 插件与工具系统 — Plugin SDK + Plugin Manager + 13内置插件 (40文件, 3293行)
- Plugin SDK: Plugin/Tool/ComplexTool/HostAPI 标准化接口 - Plugin Manager: 插件生命周期管理 (Install/Enable/Disable/Uninstall/Reload) - Tool Registry: 聚合工具注册表 (Register/Execute/Dispatch) - 13 个内置插件: 将原有硬编码工具迁移为标准插件格式 - REST API: 11 个端点 (net/http, 零外部依赖) - ai-core 集成: PluginManagerClient 替代本地工具调用 - plugin.json 元数据: 每个插件含完整 author/version/category/permissions Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package sdk
|
||||
|
||||
// PluginPermissions defines what a plugin is allowed to do.
|
||||
type PluginPermissions struct {
|
||||
NetworkAllowed bool `json:"networkAllowed"`
|
||||
AllowedHosts []string `json:"allowedHosts,omitempty"`
|
||||
IoTRead bool `json:"iotRead"`
|
||||
IoTWrite bool `json:"iotWrite"`
|
||||
MemoryRead bool `json:"memoryRead"`
|
||||
MemoryWrite bool `json:"memoryWrite"`
|
||||
FileRead bool `json:"fileRead"`
|
||||
FileWrite bool `json:"fileWrite"`
|
||||
AllowedPaths []string `json:"allowedPaths,omitempty"`
|
||||
ExecAllowed bool `json:"execAllowed"`
|
||||
MaxCPUPercent float64 `json:"maxCPUPercent"`
|
||||
MaxMemoryMB int `json:"maxMemoryMB"`
|
||||
}
|
||||
|
||||
// DefaultPermissions returns a safe default permission set.
|
||||
func DefaultPermissions() PluginPermissions {
|
||||
return PluginPermissions{
|
||||
NetworkAllowed: false,
|
||||
AllowedHosts: []string{},
|
||||
IoTRead: false,
|
||||
IoTWrite: false,
|
||||
MemoryRead: false,
|
||||
MemoryWrite: false,
|
||||
FileRead: false,
|
||||
FileWrite: false,
|
||||
AllowedPaths: []string{},
|
||||
ExecAllowed: false,
|
||||
MaxCPUPercent: 10.0,
|
||||
MaxMemoryMB: 128,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user