mirror of
https://github.com/hanzoai/agents.git
synced 2026-10-30 18:48:36 +00:00
Transforms hanzoai/agents from a marketplace config repo into a full agent orchestration platform by merging the AgentField infrastructure: - Go control plane (K8s-like agent orchestration, service mesh, DAG workflows) - Python SDK (FastAPI-based agent framework, LiteLLM, memory, DID/VC) - TypeScript SDK (@hanzo/agents - Vercel AI SDK, MCP, workflows) - Go SDK (idiomatic agent builder + client) - React 19 embedded dashboard (XyFlow DAGs, Recharts, Radix UI) - Docker/K8s/Helm deployment configs - Examples: hello world, deep research, RAG, simulation, benchmarks - Functional test suite across Python/Go/TypeScript All references rebranded: AgentField → Hanzo Agents - Module: github.com/hanzoai/agents/control-plane - Python: hanzo_agents - TypeScript: @hanzo/agents - Go: github.com/hanzoai/agents/sdk/go - Env vars: HANZO_AGENTS_* - Config: hanzo-agents.yaml Previous marketplace configs moved to config/ directory.
57 lines
1.4 KiB
Go
57 lines
1.4 KiB
Go
package handlers
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
)
|
|
|
|
func TestNormalizeCandidateAddsDefaults(t *testing.T) {
|
|
normalized, err := normalizeCandidate("example.com", "8080")
|
|
if err != nil {
|
|
t.Fatalf("expected no error, got %v", err)
|
|
}
|
|
if normalized != "http://example.com:8080" {
|
|
t.Fatalf("unexpected normalization: %s", normalized)
|
|
}
|
|
|
|
normalized, err = normalizeCandidate("https://example.com", "8080")
|
|
if err != nil {
|
|
t.Fatalf("expected no error, got %v", err)
|
|
}
|
|
if normalized != "https://example.com:8080" {
|
|
t.Fatalf("expected default port applied, got %s", normalized)
|
|
}
|
|
}
|
|
|
|
func TestResolveCallbackCandidatesSuccess(t *testing.T) {
|
|
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
if r.URL.Path == "/health/mcp" || r.URL.Path == "/health" {
|
|
w.WriteHeader(http.StatusOK)
|
|
return
|
|
}
|
|
w.WriteHeader(http.StatusNotFound)
|
|
}))
|
|
defer srv.Close()
|
|
|
|
resolved, normalized, results := resolveCallbackCandidates(
|
|
context.Background(),
|
|
[]string{srv.URL},
|
|
"",
|
|
)
|
|
|
|
if resolved == "" {
|
|
t.Fatalf("expected resolved callback URL")
|
|
}
|
|
if len(normalized) != 1 {
|
|
t.Fatalf("expected exactly one normalized candidate, got %d", len(normalized))
|
|
}
|
|
if len(results) != 1 {
|
|
t.Fatalf("expected exactly one probe result, got %d", len(results))
|
|
}
|
|
if !results[0].Success {
|
|
t.Fatalf("expected probe success, got %+v", results[0])
|
|
}
|
|
}
|