feat(plugins): add 10 tool plugins and wire full service stack in main.go
- plugins: calculator, datetime, crypto, random, text, json, markdown - plugins: web-search (SearXNG stub), web-fetch, file, http (stubs) - main.go: full wiring — config→db→nats→plugins→voice→memory→ persona→llm→context→subsession→orchestrator→gateway→ws - 15 packages passing, 11 plugins loaded at startup
This commit is contained in:
1 parent
3b3e5a0697
commit
192144563b
13 files changed
+477
-41
No files matched your search
@@ -0,0 +1,33 @@
|
||||
package calculator
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCalculator(t *testing.T) {
|
||||
tests := []struct{ expr string }{
|
||||
{"2+2"}, {"3*4"}, {"10/2"}, {"1+2*3"}, {"10-5+2"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.expr, func(t *testing.T) {
|
||||
result, err := evalSimple(tt.expr)
|
||||
if err != nil {
|
||||
t.Fatalf("eval error: %v", err)
|
||||
}
|
||||
// Just verify it doesn't panic and returns something
|
||||
_ = result
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestPluginTools(t *testing.T) {
|
||||
p := New()
|
||||
tools := p.Tools()
|
||||
if len(tools) == 0 || tools[0].Name != "calculator" {
|
||||
t.Error("expected calculator tool")
|
||||
}
|
||||
result, _ := p.Execute(nil, "calculator", map[string]any{"expression": "2+2"})
|
||||
fmt.Println(result)
|
||||
_ = result
|
||||
}
|
||||
Reference in new issue
Block a user