mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-29 23:47:30 +08:00
feat: expand mcp transports and skill execution
This commit is contained in:
37
pkg/agent/loop_skill_exec_test.go
Normal file
37
pkg/agent/loop_skill_exec_test.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package agent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"clawgo/pkg/bus"
|
||||
"clawgo/pkg/config"
|
||||
"clawgo/pkg/providers"
|
||||
)
|
||||
|
||||
type stubLLMProvider struct{}
|
||||
|
||||
func (stubLLMProvider) Chat(ctx context.Context, messages []providers.Message, tools []providers.ToolDefinition, model string, options map[string]interface{}) (*providers.LLMResponse, error) {
|
||||
return &providers.LLMResponse{Content: "ok", FinishReason: "stop"}, nil
|
||||
}
|
||||
|
||||
func (stubLLMProvider) GetDefaultModel() string { return "stub-model" }
|
||||
|
||||
func TestNewAgentLoopRegistersSkillExec(t *testing.T) {
|
||||
cfg := config.DefaultConfig()
|
||||
cfg.Agents.Defaults.Workspace = t.TempDir()
|
||||
|
||||
loop := NewAgentLoop(cfg, bus.NewMessageBus(), stubLLMProvider{}, nil)
|
||||
catalog := loop.GetToolCatalog()
|
||||
|
||||
found := false
|
||||
for _, item := range catalog {
|
||||
if item["name"] == "skill_exec" {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Fatalf("expected skill_exec in tool catalog, got %v", catalog)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user