Files
zeekayandGitHub 5b5cf9e9db feat: merge AgentField control plane + SDKs as Hanzo Agents (#1)
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.
2026-02-09 18:53:09 -08:00

74 lines
1.9 KiB
Go

package ui
import (
"bytes"
"context"
"encoding/json"
"errors"
"io"
"testing"
"github.com/hanzoai/agents/control-plane/internal/services"
"github.com/stretchr/testify/require"
)
type testPayloadStore struct {
data map[string][]byte
}
func newTestPayloadStore() *testPayloadStore {
return &testPayloadStore{data: make(map[string][]byte)}
}
func (s *testPayloadStore) SaveFromReader(ctx context.Context, r io.Reader) (*services.PayloadRecord, error) {
return nil, errors.New("not implemented")
}
func (s *testPayloadStore) SaveBytes(ctx context.Context, data []byte) (*services.PayloadRecord, error) {
return nil, errors.New("not implemented")
}
func (s *testPayloadStore) Open(ctx context.Context, uri string) (io.ReadCloser, error) {
payload, ok := s.data[uri]
if !ok {
return nil, errors.New("payload not found")
}
return io.NopCloser(bytes.NewReader(payload)), nil
}
func (s *testPayloadStore) Remove(ctx context.Context, uri string) error {
delete(s.data, uri)
return nil
}
func TestHasMeaningfulDataDetectsCorruptedPlaceholder(t *testing.T) {
placeholder := map[string]interface{}{
"error": corruptedJSONSentinel,
"preview": "truncated",
}
require.False(t, hasMeaningfulData(placeholder))
}
func TestHasMeaningfulDataAllowsValidMap(t *testing.T) {
payload := map[string]interface{}{"foo": "bar"}
require.True(t, hasMeaningfulData(payload))
}
func TestResolveExecutionDataFallsBackForCorruptedPreview(t *testing.T) {
store := newTestPayloadStore()
handler := &ExecutionHandler{payloads: store}
raw := []byte(`{"error":"corrupted_json_data","preview":"partial"}`)
uri := "payload://test"
store.data[uri] = []byte(`{"full":true}`)
data, size := handler.resolveExecutionData(context.Background(), raw, &uri)
require.Equal(t, len(store.data[uri]), size)
marshalled, err := json.Marshal(data)
require.NoError(t, err)
require.JSONEq(t, `{"full":true}`, string(marshalled))
}