// Package sdkexample contains reference types and calls for the Nuva Go client. // It does not implement a network client, user authentication, or token signing. package sdkexample import ( "context" "encoding/json" "time" ) type ClientConfig struct { ServiceToken string } type ClientTokenRequest struct { UserID string `json:"userId"` Permissions json.RawMessage `json:"permissions"` } type ClientToken struct { Token string `json:"token"` ExpiresAt time.Time `json:"expiresAt"` } type SkillDefinition struct { Name string `json:"name"` Instructions string `json:"instructions"` HostCalls []HostCallDefinition `json:"hostCalls,omitempty"` } type HostCallDefinition struct { Type string `json:"type"` Description string `json:"description"` InputSchema json.RawMessage `json:"inputSchema"` OutputSchema json.RawMessage `json:"outputSchema,omitempty"` } type RegisteredSkill struct { Ref DefinitionRef `json:"ref"` } type DefinitionRef struct { ID string `json:"id"` Revision string `json:"revision"` } type Client interface { CreateClientToken(context.Context, ClientTokenRequest) (ClientToken, error) RegisterSkill(context.Context, SkillDefinition) (RegisteredSkill, error) } // authenticatedUserID is obtained by the application after its own login check. // Permissions includes skill access; its schema and defaults remain undefined. func requestToken(ctx context.Context, client Client, authenticatedUserID string, permissions json.RawMessage) (ClientToken, error) { return client.CreateClientToken(ctx, ClientTokenRequest{ UserID: authenticatedUserID, Permissions: permissions, }) } func registerSkill(ctx context.Context, client Client, name, instructions string, hostCalls []HostCallDefinition) (RegisteredSkill, error) { return client.RegisterSkill(ctx, SkillDefinition{ Name: name, Instructions: instructions, HostCalls: hostCalls, }) }