Go SDK: Align hooks with SEP (#23)

The SEP spec and C# SDK use hooks (plural, JSON array) but the Go SDK
had hook (singular, single object). This meant the wire formats were
incompatible — Go would send `{"hook": {...}}` while everything else
expects `{"hooks": [...]}`.

Signed-off-by: Ukjae Jeong <jeongukjae@gmail.com>
This commit is contained in:
Ukjae Jeong 2026-06-16 15:49:49 +01:00 • committed by GitHub
commit 23d889254b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -37,10 +37,10 @@ func main() {
v := &interceptors.Validator{
Metadata: interceptors.Metadata{
Name: "block-dangerous-tool",
Hook: interceptors.Hook{
Hooks: []interceptors.Hook{{
Events: []string{interceptors.EventToolsCall},
Phase: interceptors.PhaseRequest,
},
}},
Mode: interceptors.ModeEnforce,
},
Handler: func(_ context.Context, inv *interceptors.Invocation) (*interceptors.ValidationResult, error) {