fix: align agent registration contract
This commit is contained in:
1 parent
eae9015a61
commit
c9d1075585
4 files changed
+71
-4
No files matched your search
@@ -193,6 +193,7 @@ agent, err := client.RegisterAgent(&elydora.RegisterAgentRequest{
|
||||
AgentID: "my-agent",
|
||||
DisplayName: "My Agent",
|
||||
ResponsibleEntity: "team@example.com",
|
||||
IntegrationType: elydora.IntegrationTypeSDK,
|
||||
Keys: []elydora.RegisterAgentKeyInput{
|
||||
{KID: "key-v1", PublicKey: "<base64url>", Algorithm: "ed25519"},
|
||||
},
|
||||
|
||||
@@ -106,6 +106,7 @@ func TestSDKCompatibilityAgainstLatestAPI(t *testing.T) {
|
||||
AgentID: agentID,
|
||||
DisplayName: "Go SDK Compat Agent",
|
||||
ResponsibleEntity: "sdk-matrix",
|
||||
IntegrationType: elydora.IntegrationTypeSDK,
|
||||
Keys: []elydora.RegisterAgentKeyInput{
|
||||
{
|
||||
KID: kid,
|
||||
|
||||
@@ -23,16 +23,21 @@ const (
|
||||
type IntegrationType string
|
||||
|
||||
const (
|
||||
IntegrationTypeAugment IntegrationType = "augment"
|
||||
IntegrationTypeClaudecode IntegrationType = "claudecode"
|
||||
IntegrationTypeCline IntegrationType = "cline"
|
||||
IntegrationTypeCodex IntegrationType = "codex"
|
||||
IntegrationTypeCopilot IntegrationType = "copilot"
|
||||
IntegrationTypeCursor IntegrationType = "cursor"
|
||||
IntegrationTypeDroid IntegrationType = "droid"
|
||||
IntegrationTypeGemini IntegrationType = "gemini"
|
||||
IntegrationTypeGrok IntegrationType = "grok"
|
||||
IntegrationTypeKimi IntegrationType = "kimi"
|
||||
IntegrationTypeKiroCLI IntegrationType = "kirocli"
|
||||
IntegrationTypeKiroIDE IntegrationType = "kiroide"
|
||||
IntegrationTypeOpenCode IntegrationType = "opencode"
|
||||
IntegrationTypeCopilot IntegrationType = "copilot"
|
||||
IntegrationTypeLetta IntegrationType = "letta"
|
||||
IntegrationTypeCodex IntegrationType = "codex"
|
||||
IntegrationTypeKimi IntegrationType = "kimi"
|
||||
IntegrationTypeOpenCode IntegrationType = "opencode"
|
||||
IntegrationTypeQwen IntegrationType = "qwen"
|
||||
IntegrationTypeEnterprise IntegrationType = "enterprise"
|
||||
IntegrationTypeGUI IntegrationType = "gui"
|
||||
IntegrationTypeSDK IntegrationType = "sdk"
|
||||
@@ -230,6 +235,7 @@ type RegisterAgentRequest struct {
|
||||
AgentID string `json:"agent_id"`
|
||||
DisplayName string `json:"display_name,omitempty"`
|
||||
ResponsibleEntity string `json:"responsible_entity,omitempty"`
|
||||
IntegrationType IntegrationType `json:"integration_type"`
|
||||
Keys []RegisterAgentKeyInput `json:"keys"`
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package elydora
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestRegisterAgentRequestIncludesIntegrationType(t *testing.T) {
|
||||
payload, err := json.Marshal(RegisterAgentRequest{
|
||||
AgentID: "agent-1",
|
||||
IntegrationType: IntegrationTypeSDK,
|
||||
Keys: []RegisterAgentKeyInput{},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("marshal register agent request: %v", err)
|
||||
}
|
||||
|
||||
var decoded map[string]any
|
||||
if err := json.Unmarshal(payload, &decoded); err != nil {
|
||||
t.Fatalf("unmarshal register agent request: %v", err)
|
||||
}
|
||||
if got := decoded["integration_type"]; got != "sdk" {
|
||||
t.Fatalf("integration_type = %v, want sdk", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIntegrationTypesMatchPublicAPIContract(t *testing.T) {
|
||||
got := []IntegrationType{
|
||||
IntegrationTypeAugment,
|
||||
IntegrationTypeClaudecode,
|
||||
IntegrationTypeCline,
|
||||
IntegrationTypeCodex,
|
||||
IntegrationTypeCopilot,
|
||||
IntegrationTypeCursor,
|
||||
IntegrationTypeDroid,
|
||||
IntegrationTypeGemini,
|
||||
IntegrationTypeGrok,
|
||||
IntegrationTypeKimi,
|
||||
IntegrationTypeKiroCLI,
|
||||
IntegrationTypeKiroIDE,
|
||||
IntegrationTypeLetta,
|
||||
IntegrationTypeOpenCode,
|
||||
IntegrationTypeQwen,
|
||||
IntegrationTypeEnterprise,
|
||||
IntegrationTypeGUI,
|
||||
IntegrationTypeSDK,
|
||||
IntegrationTypeOther,
|
||||
}
|
||||
want := []IntegrationType{
|
||||
"augment", "claudecode", "cline", "codex", "copilot", "cursor", "droid",
|
||||
"gemini", "grok", "kimi", "kirocli", "kiroide", "letta", "opencode", "qwen",
|
||||
"enterprise", "gui", "sdk", "other",
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(got, want) {
|
||||
t.Fatalf("integration types = %v, want %v", got, want)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user