Files
HomeAgent/tools/plugin-dev/templates/plugin.go.tmpl
root 5fd8d04b1e chore: replace hack with tools and remove obsolete artifacts
- Rename hack/ to tools/ for formal naming
- Update plugin development and deployment script references
- Remove obsolete DESIGN/MILESTONE/PLAN docs now superseded by docs/
- Remove abandoned internal/onebot implementation
- Ignore stray local qq binary artifact
2026-07-06 20:46:32 +08:00

57 lines
1.1 KiB
Cheetah

package main
import (
"log"
"sync"
"gitcode.com/JianFeeeee/HomeAgent/internal/sdk"
)
type Plugin struct {
name string
sdk *sdk.PluginSDK
mu sync.RWMutex
}
func NewPlugin(name string, config map[string]interface{}) (sdk.Plugin, error) {
return &Plugin{
name: name,
}, nil
}
func (p *Plugin) Name() string { return p.name }
func (p *Plugin) Start(s *sdk.PluginSDK) error {
p.sdk = s
tp := p.name + "_"
s.RegisterTool(tp+"example", sdk.ToolDef{
Name: tp + "example",
Description: "示例工具 - 请替换为实现",
Parameters: map[string]interface{}{
"type": "object",
"properties": map[string]interface{}{
"input": map[string]interface{}{"type": "string", "description": "输入参数"},
},
"required": []string{"input"},
},
}, p.handleExample)
log.Printf("[%s] plugin started", p.name)
return nil
}
func (p *Plugin) Stop() error {
return nil
}
func (p *Plugin) handleExample(args map[string]interface{}) (interface{}, error) {
input, _ := args["input"].(string)
return map[string]interface{}{
"echo": input,
}, nil
}
func main() {}