Files
zeekay f5ff92c37f fix: repair Go identifier errors and protobuf from rebrand
The AgentField-to-HanzoAgents rebrand introduced invalid Go
identifiers (hanzo-agentsXxx with hyphens), corrupted protobuf
raw descriptors, and missing TypeScript type exports. This commit:

- Renames all `hanzo-agentsXxx` Go vars to `hanzoAgentsXxx`
- Regenerates protobuf .pb.go with correct go_package path
- Copies agentfield.ts types to hanzo-agents.ts for UI build
- Adds amd64 cross-compiler support to Dockerfile
2026-02-09 23:16:43 -08:00

68 lines
1.7 KiB
Go

package server
import (
"os"
"path/filepath"
"testing"
"time"
"github.com/hanzoai/agents/control-plane/pkg/types"
"github.com/stretchr/testify/require"
)
func TestSyncPackagesFromRegistryStoresMissingPackages(t *testing.T) {
t.Parallel()
hanzoAgentsHome := t.TempDir()
pkgDir := filepath.Join(hanzoAgentsHome, "example-agent")
require.NoError(t, os.MkdirAll(pkgDir, 0o755))
installed := `installed:
example-agent:
name: Example Agent
version: 1.0.0
description: demo agent
path: ` + pkgDir + `
source: local
status: installed
`
require.NoError(t, os.WriteFile(filepath.Join(hanzoAgentsHome, "installed.yaml"), []byte(installed), 0o644))
packageYAML := `name: Example Agent
version: 1.0.0
schema:
type: object
`
require.NoError(t, os.WriteFile(filepath.Join(pkgDir, "hanzo-agents-package.yaml"), []byte(packageYAML), 0o644))
storage := newStubPackageStorage()
require.NoError(t, SyncPackagesFromRegistry(hanzoAgentsHome, storage))
pkg, ok := storage.packages["example-agent"]
require.True(t, ok)
require.Equal(t, "Example Agent", pkg.Name)
require.NotEmpty(t, pkg.ConfigurationSchema)
}
func TestSyncPackagesSkipsExistingEntries(t *testing.T) {
t.Parallel()
hanzoAgentsHome := t.TempDir()
installed := `installed:
existing-agent:
name: Existing
version: 0.1.0
description: already present
path: ` + hanzoAgentsHome + `
`
require.NoError(t, os.WriteFile(filepath.Join(hanzoAgentsHome, "installed.yaml"), []byte(installed), 0o644))
storage := newStubPackageStorage()
storage.packages["existing-agent"] = &types.AgentPackage{ID: "existing-agent", Name: "Existing", InstalledAt: time.Now()}
require.NoError(t, SyncPackagesFromRegistry(hanzoAgentsHome, storage))
require.Len(t, storage.packages, 1)
}