Documentation
¶
Index ¶
- Constants
- Variables
- func DecryptBinary(key string, payload []byte) ([]byte, error)
- func DecryptFromJSON(key string, raw string) (string, error)
- func DefaultConfigPath() (string, error)
- func EncodeHiveBinaryFrame(message HiveMessage) ([]byte, error)
- func EncryptAsBinary(key string, plaintext []byte) ([]byte, error)
- func EncryptAsJSON(key string, plaintext string) (string, error)
- func EndpointFromDomain(domain string, protocol HubProtocol) string
- func EventMatchesContext(event Event, expected Context) bool
- func NewRequestID() string
- func NewSessionID() string
- func RequestIDFromContext(context Context) string
- func RichMediaFromData(data Data) map[string]any
- func RuntimeCryptoKey(raw string) []byte
- func SessionIDFromContext(context Context) string
- func StripSSML(text string) string
- type ActionOptions
- type AnalyticsOverviewOptions
- type BootstrapIdentityOptions
- type BootstrapIdentityResult
- type Client
- func (c *Client) Ask(ctx context.Context, text string, opts RequestOptions) (Reply, error)
- func (c *Client) Close(ctx context.Context) error
- func (c *Client) Connect(ctx context.Context) error
- func (c *Client) ConnectWithInfo(ctx context.Context) (TransportConnectionInfo, error)
- func (c *Client) ConnectionInfo() TransportConnectionInfo
- func (c *Client) Conversation(opts ConversationOptions) Conversation
- func (c *Client) Emit(ctx context.Context, eventType string, data Data, eventContext Context) error
- func (c *Client) Healthcheck() TransportHealth
- func (c *Client) Query(ctx context.Context, text string, opts QueryOptions) (Reply, error)
- func (c *Client) SendAction(ctx context.Context, payload string, opts ActionOptions) error
- func (c *Client) SendCode(ctx context.Context, value string, opts CodeOptions) error
- func (c *Client) SendUtterance(ctx context.Context, text string, opts RequestOptions) error
- type ClientContextOptions
- type ClientOptions
- type CodeOptions
- type Context
- type ControlPlane
- func (c *ControlPlane) ClearHubRating(ctx context.Context, hubID string) (map[string]any, error)
- func (c *ControlPlane) CreateClient(ctx context.Context, payload map[string]any, idempotencyKey string) (map[string]any, error)
- func (c *ControlPlane) CreateClientIdentity(ctx context.Context, hub map[string]any, opts BootstrapIdentityOptions) (BootstrapIdentityResult, error)
- func (c *ControlPlane) CreateClientIdentityForHubID(ctx context.Context, hubID string, opts BootstrapIdentityOptions) (BootstrapIdentityResult, error)
- func (c *ControlPlane) CreateHub(ctx context.Context, payload map[string]any, opts HubCreateOptions) (map[string]any, error)
- func (c *ControlPlane) CreateMemoryItem(ctx context.Context, payload map[string]any) (map[string]any, error)
- func (c *ControlPlane) CreateRuntimeGroup(ctx context.Context, payload map[string]any) (map[string]any, error)
- func (c *ControlPlane) DeleteHub(ctx context.Context, hubID string, etag string) error
- func (c *ControlPlane) DeleteMemoryItem(ctx context.Context, memoryID string) error
- func (c *ControlPlane) DeleteRuntimeGroup(ctx context.Context, runtimeGroupID string) error
- func (c *ControlPlane) GetAnalyticsOverview(ctx context.Context, opts AnalyticsOverviewOptions) (map[string]any, error)
- func (c *ControlPlane) GetHub(ctx context.Context, hubID string) (map[string]any, error)
- func (c *ControlPlane) GetHubRuntimeCapabilities(ctx context.Context, hubID string) (map[string]any, error)
- func (c *ControlPlane) GetMemoryItem(ctx context.Context, memoryID string) (map[string]any, error)
- func (c *ControlPlane) GetMemorySummary(ctx context.Context, ownerID string) (map[string]any, error)
- func (c *ControlPlane) GetOperation(ctx context.Context, operationID string) (OperationResource, error)
- func (c *ControlPlane) GetPublicHub(ctx context.Context, hubRef string) (map[string]any, error)
- func (c *ControlPlane) GetRuntimeGroup(ctx context.Context, runtimeGroupID string) (map[string]any, error)
- func (c *ControlPlane) GetRuntimeGroupConfig(ctx context.Context, runtimeGroupID string) (map[string]any, error)
- func (c *ControlPlane) InstallRuntimeGroupSkill(ctx context.Context, runtimeGroupID string, skillID string, ...) (map[string]any, error)
- func (c *ControlPlane) ListHubs(ctx context.Context, limit int, cursor string, ownerID string) (map[string]any, error)
- func (c *ControlPlane) ListMarketplaceSkills(ctx context.Context, opts MarketplaceSkillListOptions) (map[string]any, error)
- func (c *ControlPlane) ListMemoryItems(ctx context.Context, opts MemoryListOptions) (map[string]any, error)
- func (c *ControlPlane) ListPublicHubs(ctx context.Context, limit int, cursor string) (map[string]any, error)
- func (c *ControlPlane) ListRuntimeGroupInventory(ctx context.Context, runtimeGroupID string, opts RuntimeGroupInventoryOptions) (map[string]any, error)
- func (c *ControlPlane) ListRuntimeGroupMarketplace(ctx context.Context, runtimeGroupID string, ...) (map[string]any, error)
- func (c *ControlPlane) ListRuntimeGroups(ctx context.Context, ownerID string) (map[string]any, error)
- func (c *ControlPlane) Login(ctx context.Context, email string, password string, scope string) (map[string]any, error)
- func (c *ControlPlane) LoginWithBrowser(ctx context.Context, opts DeviceLoginOptions) (map[string]any, error)
- func (c *ControlPlane) LoginWithOptions(ctx context.Context, email string, password string, opts LoginOptions) (map[string]any, error)
- func (c *ControlPlane) ReleaseHub(ctx context.Context, hubID string, opts ReleaseOptions) (map[string]any, error)
- func (c *ControlPlane) ReleaseRuntimeGroup(ctx context.Context, runtimeGroupID string, opts ReleaseOptions) (map[string]any, error)
- func (c *ControlPlane) RequireRuntimeProtocol(result BootstrapIdentityResult, protocol HubProtocol) (*SelectedHubEndpoint, error)
- func (c *ControlPlane) SetHubRating(ctx context.Context, hubID string, rating int) (map[string]any, error)
- func (c ControlPlane) String() string
- func (c *ControlPlane) UninstallRuntimeGroupSkill(ctx context.Context, runtimeGroupID string, skillID string) error
- func (c *ControlPlane) UpdateHub(ctx context.Context, hubID string, payload map[string]any, etag string) (map[string]any, error)
- func (c *ControlPlane) UpdateMemoryItem(ctx context.Context, memoryID string, payload map[string]any) (map[string]any, error)
- func (c *ControlPlane) UpdateRuntimeGroup(ctx context.Context, runtimeGroupID string, payload map[string]any) (map[string]any, error)
- func (c *ControlPlane) UpdateRuntimeGroupConfig(ctx context.Context, runtimeGroupID string, config map[string]any, ...) (map[string]any, error)
- type Conversation
- func (c Conversation) Ask(ctx context.Context, text string, opts RequestOptions) (Reply, error)
- func (c Conversation) Query(ctx context.Context, text string, opts QueryOptions) (Reply, error)
- func (c Conversation) SendAction(ctx context.Context, payload string, opts ActionOptions) error
- func (c Conversation) SendCode(ctx context.Context, value string, opts CodeOptions) error
- func (c Conversation) SendUtterance(ctx context.Context, text string, opts RequestOptions) error
- type ConversationOptions
- type Data
- type DeviceLoginOptions
- type DisplayItem
- type Event
- func (e Event) DisplayItems(maxTextChars int) []DisplayItem
- func (e Event) DisplayText() string
- func (e Event) IsFailure() bool
- func (e Event) RequestID() string
- func (e Event) RichMedia() map[string]any
- func (e Event) SessionID() string
- func (e Event) Text() string
- func (e Event) Utterances() []string
- type HTTPTransport
- func (t *HTTPTransport) Authorization() string
- func (t *HTTPTransport) BaseURL() string
- func (t *HTTPTransport) Connect(ctx context.Context) error
- func (t *HTTPTransport) ConnectionInfo() TransportConnectionInfo
- func (t *HTTPTransport) Disconnect(ctx context.Context) error
- func (t *HTTPTransport) EmitBus(ctx context.Context, eventType string, data Data, eventContext Context) error
- func (t *HTTPTransport) Events() <-chan Event
- func (t *HTTPTransport) Healthcheck() TransportHealth
- func (t *HTTPTransport) HiveMessages() <-chan HiveMessage
- func (t *HTTPTransport) IsHandshakeComplete() bool
- func (t *HTTPTransport) PollOnce(ctx context.Context) error
- func (t *HTTPTransport) SendHiveMessage(ctx context.Context, message HiveMessage, encrypt bool) error
- type HiveMessage
- type HubCreateOptions
- type HubDataPlaneEndpoints
- type HubProtocol
- type HubProtocolSettings
- type Identity
- type LoginOptions
- type MQTTTransport
- func (t *MQTTTransport) Connect(ctx context.Context) error
- func (t *MQTTTransport) ConnectionInfo() TransportConnectionInfo
- func (t *MQTTTransport) Disconnect(ctx context.Context) error
- func (t *MQTTTransport) EmitBus(ctx context.Context, eventType string, data Data, eventContext Context) error
- func (t *MQTTTransport) Events() <-chan Event
- func (t *MQTTTransport) Healthcheck() TransportHealth
- func (t *MQTTTransport) HiveMessages() <-chan HiveMessage
- func (t *MQTTTransport) IsHandshakeComplete() bool
- func (t *MQTTTransport) SendHiveMessage(ctx context.Context, message HiveMessage, encrypt bool) error
- type MarketplaceSkillListOptions
- type MemoryListOptions
- type MqttBrokerCredentials
- type MqttTopicSet
- type OperationResource
- type OperationStatus
- type QueryOptions
- type ReleaseOptions
- type Reply
- type RequestOptions
- type RuntimeGroupConfigOptions
- type RuntimeGroupInventoryOptions
- type RuntimeGroupMarketplaceOptions
- type RuntimeGroupSkillInstallOptions
- type RuntimeTransport
- type SelectedHubEndpoint
- type TransportConnectionInfo
- type TransportConnectionPhase
- type TransportHealth
- type WSSTransport
- func (t *WSSTransport) Authorization() string
- func (t *WSSTransport) Connect(ctx context.Context) error
- func (t *WSSTransport) ConnectionInfo() TransportConnectionInfo
- func (t *WSSTransport) Disconnect(_ context.Context) error
- func (t *WSSTransport) EmitBus(ctx context.Context, eventType string, data Data, eventContext Context) error
- func (t *WSSTransport) Events() <-chan Event
- func (t *WSSTransport) Healthcheck() TransportHealth
- func (t *WSSTransport) HiveMessages() <-chan HiveMessage
- func (t *WSSTransport) IsHandshakeComplete() bool
- func (t *WSSTransport) SendHiveMessage(ctx context.Context, message HiveMessage, encrypt bool) error
Constants ¶
const ( EventRecognizerLoopUtterance = "recognizer_loop:utterance" EventSpeak = "speak" EventOvosUtteranceSpeak = "ovos.utterance.speak" EventUtteranceHandled = "ovos.utterance.handled" // EventIntentUnmatched is the current OVOS bus event fired when an utterance // matches no intent. EventIntentFailure is the legacy Mycroft name for the // same signal; both are kept so old and new runtimes are recognised. EventIntentUnmatched = "ovos.intent.unmatched" EventIntentFailure = "complete_intent_failure" EventPolicyDenied = "hive.policy.denied" EventQueryTimeout = "hive.query.timeout" DefaultUserAgent = userAgent )
const ( DefaultControlAPIURL = "https://api.thalovant.com" DefaultControlUserAgent = userAgent // DefaultDeviceLoginTimeout bounds how long LoginWithBrowser waits for the // user to approve the sign-in request in the browser. DefaultDeviceLoginTimeout = 15 * time.Minute )
const DefaultConfigFilename = "config.yaml"
const Version = "0.3.11"
Version is the module release this package was built from, and the single source of truth for every user agent the SDK sends. The VERSION file at the repository root is the release pipeline's copy of the same number; TestVersionMatchesVersionFile keeps the two in step.
Never hard-code a version inside a user-agent literal anywhere else: TestNoSourceFileHardCodesAUserAgentVersion rejects it.
Variables ¶
var ( ErrIdentity = errors.New("thalovant identity error") ErrConnection = errors.New("thalovant connection error") ErrTimeout = errors.New("thalovant timeout") ErrRuntime = errors.New("thalovant runtime error") ErrAPI = errors.New("thalovant api error") ErrProtocol = errors.New("thalovant unsupported protocol") // ErrDeviceAccessDenied reports that the browser device sign-in request // was denied by the user. ErrDeviceAccessDenied = errors.New("thalovant device sign-in denied") // ErrDeviceCodeExpired reports that the device sign-in code expired // before it was approved. ErrDeviceCodeExpired = errors.New("thalovant device sign-in code expired") )
var DefaultProtocolPreference = []HubProtocol{ProtocolWSS, ProtocolHTTPS, ProtocolMQTT}
Functions ¶
func DefaultConfigPath ¶ added in v0.2.11
func EncodeHiveBinaryFrame ¶ added in v0.2.5
func EncodeHiveBinaryFrame(message HiveMessage) ([]byte, error)
func EncryptAsBinary ¶ added in v0.2.5
func EndpointFromDomain ¶ added in v0.2.1
func EndpointFromDomain(domain string, protocol HubProtocol) string
func EventMatchesContext ¶
func NewRequestID ¶
func NewRequestID() string
func NewSessionID ¶
func NewSessionID() string
func RequestIDFromContext ¶
func RichMediaFromData ¶
func RuntimeCryptoKey ¶
func SessionIDFromContext ¶
Types ¶
type ActionOptions ¶
type AnalyticsOverviewOptions ¶ added in v0.2.13
type BootstrapIdentityOptions ¶ added in v0.2.2
type BootstrapIdentityResult ¶ added in v0.2.2
type BootstrapIdentityResult struct {
Identity Identity
Hub map[string]any
Client map[string]any
Endpoint *SelectedHubEndpoint
}
func (BootstrapIdentityResult) SelectedProtocol ¶ added in v0.2.2
func (r BootstrapIdentityResult) SelectedProtocol() HubProtocol
type Client ¶
type Client struct {
Identity Identity
Transport RuntimeTransport
ConnectTimeout time.Duration
}
func NewClientFromConfig ¶ added in v0.2.11
func NewClientFromEnv ¶
func NewClientFromFile ¶
func NewClientWithOptions ¶ added in v0.2.2
func NewClientWithOptions(identity Identity, opts ClientOptions) (*Client, error)
func (*Client) ConnectWithInfo ¶ added in v0.2.14
func (c *Client) ConnectWithInfo(ctx context.Context) (TransportConnectionInfo, error)
func (*Client) ConnectionInfo ¶ added in v0.2.14
func (c *Client) ConnectionInfo() TransportConnectionInfo
func (*Client) Conversation ¶
func (c *Client) Conversation(opts ConversationOptions) Conversation
func (*Client) Healthcheck ¶
func (c *Client) Healthcheck() TransportHealth
func (*Client) SendAction ¶
func (*Client) SendUtterance ¶
type ClientContextOptions ¶
type ClientOptions ¶ added in v0.2.2
type ClientOptions struct {
Protocol HubProtocol
ConnectTimeout time.Duration
}
type CodeOptions ¶
type Context ¶
func BuildClientContext ¶
func BuildClientContext(base Context, opts ClientContextOptions) Context
func ContextWithCorrelation ¶
func MergeContext ¶
type ControlPlane ¶ added in v0.2.2
type ControlPlane struct {
APIURL string
AccessToken string
UserAgent string
HTTPClient *http.Client
}
func NewControlPlane ¶ added in v0.2.2
func NewControlPlane(apiURL string, accessToken string) *ControlPlane
func NewDefaultControlPlane ¶ added in v0.2.8
func NewDefaultControlPlane(accessToken string) *ControlPlane
func (*ControlPlane) ClearHubRating ¶ added in v0.3.6
ClearHubRating removes the caller's rating from a public hub and returns the updated hub.
Requires a token with the hubs:write scope; it is not paid-gated.
func (*ControlPlane) CreateClient ¶ added in v0.2.2
func (*ControlPlane) CreateClientIdentity ¶ added in v0.2.2
func (c *ControlPlane) CreateClientIdentity(ctx context.Context, hub map[string]any, opts BootstrapIdentityOptions) (BootstrapIdentityResult, error)
func (*ControlPlane) CreateClientIdentityForHubID ¶ added in v0.2.2
func (c *ControlPlane) CreateClientIdentityForHubID(ctx context.Context, hubID string, opts BootstrapIdentityOptions) (BootstrapIdentityResult, error)
func (*ControlPlane) CreateHub ¶ added in v0.3.6
func (c *ControlPlane) CreateHub(ctx context.Context, payload map[string]any, opts HubCreateOptions) (map[string]any, error)
CreateHub creates a hub.
payload mirrors the API's hub create body: "name" and "spec" are required, and "slug", "namespace", "runtime_group_id", "domain", "active", "visibility", "capacity_profile", and "owner_id" are optional. camelCase keys are accepted and sent as snake_case.
The request is idempotent: an Idempotency-Key header is always sent, using HubCreateOptions.IdempotencyKey when set and a generated key otherwise, so a create retried after a timeout returns the first hub instead of making a second one.
Requires a paid plan and a token with the hubs:write scope. A free-plan token fails with HTTP 402.
func (*ControlPlane) CreateMemoryItem ¶ added in v0.2.13
func (*ControlPlane) CreateRuntimeGroup ¶ added in v0.3.6
func (c *ControlPlane) CreateRuntimeGroup(ctx context.Context, payload map[string]any) (map[string]any, error)
CreateRuntimeGroup creates a runtime group.
payload takes the API's create body: "name" is required, and "description", "environment", "owner_id", and "clone_from_default" are optional. camelCase keys are accepted and sent as snake_case.
Requires a paid plan and a token with the hubs:write scope.
func (*ControlPlane) DeleteHub ¶ added in v0.3.6
DeleteHub deletes a hub and its dependent clients and ACLs.
Like UpdateHub this route requires the hub's current etag, sent as If-Match; a stale or empty value fails with HTTP 412.
Requires a paid plan and a token with the hubs:write scope.
func (*ControlPlane) DeleteMemoryItem ¶ added in v0.2.13
func (c *ControlPlane) DeleteMemoryItem(ctx context.Context, memoryID string) error
func (*ControlPlane) DeleteRuntimeGroup ¶ added in v0.3.6
func (c *ControlPlane) DeleteRuntimeGroup(ctx context.Context, runtimeGroupID string) error
DeleteRuntimeGroup deletes a runtime group.
The API answers HTTP 409 for the workspace default group and for a group that still has hubs attached.
Requires a paid plan and a token with the hubs:write scope.
func (*ControlPlane) GetAnalyticsOverview ¶ added in v0.2.13
func (c *ControlPlane) GetAnalyticsOverview(ctx context.Context, opts AnalyticsOverviewOptions) (map[string]any, error)
func (*ControlPlane) GetHubRuntimeCapabilities ¶ added in v0.3.6
func (c *ControlPlane) GetHubRuntimeCapabilities(ctx context.Context, hubID string) (map[string]any, error)
GetHubRuntimeCapabilities reads the live skill and intent inventory a hub runtime exposes.
Requires a token with the hubs:inspect scope. The API answers HTTP 409 when the hub has no connected client that can report inventory and no runtime group snapshot to fall back on. ListRuntimeGroupInventory is the read that reports a pending source instead of failing.
func (*ControlPlane) GetMemoryItem ¶ added in v0.2.13
func (*ControlPlane) GetMemorySummary ¶ added in v0.2.13
func (*ControlPlane) GetOperation ¶ added in v0.2.16
func (c *ControlPlane) GetOperation(ctx context.Context, operationID string) (OperationResource, error)
func (*ControlPlane) GetPublicHub ¶ added in v0.2.6
func (*ControlPlane) GetRuntimeGroup ¶ added in v0.3.6
func (c *ControlPlane) GetRuntimeGroup(ctx context.Context, runtimeGroupID string) (map[string]any, error)
GetRuntimeGroup fetches one runtime group.
Requires a token with the hubs:read scope.
func (*ControlPlane) GetRuntimeGroupConfig ¶ added in v0.3.6
func (c *ControlPlane) GetRuntimeGroupConfig(ctx context.Context, runtimeGroupID string) (map[string]any, error)
GetRuntimeGroupConfig reads a runtime group's runtime configuration and personas.
Requires a token with the hubs:read scope.
func (*ControlPlane) InstallRuntimeGroupSkill ¶ added in v0.3.6
func (c *ControlPlane) InstallRuntimeGroupSkill(ctx context.Context, runtimeGroupID string, skillID string, opts RuntimeGroupSkillInstallOptions) (map[string]any, error)
InstallRuntimeGroupSkill installs, or re-installs, a skill in a runtime group.
The default source type of "catalog" installs a marketplace skill and requires the skill to exist in the catalog; a "git" install needs RuntimeGroupSkillInstallOptions.SourceRef. Installing a skill that is already present updates the existing entry.
Requires a paid plan and a token with the hubs:write scope. Paid marketplace skills also need marketplace access on the tenant plan.
func (*ControlPlane) ListMarketplaceSkills ¶ added in v0.3.6
func (c *ControlPlane) ListMarketplaceSkills(ctx context.Context, opts MarketplaceSkillListOptions) (map[string]any, error)
ListMarketplaceSkills lists the marketplace skill catalog visible to the authenticated user.
The returned "data" entries carry the catalog fields an install needs -- "skill_id", "source_type", "source_ref", "package_name", "version" compatibility, "config_schema" and "secret_schema" -- alongside presentation and access fields such as "category", "tags", "verified", "access_tier" and "billing_sku". Global catalog entries and the caller's own tenant entries are both included.
Requires a token with the hubs:read scope. Unlike the provisioning routes this catalog is not paid-gated, so free-plan callers can browse the marketplace before upgrading; only the install itself needs a paid plan.
func (*ControlPlane) ListMemoryItems ¶ added in v0.2.13
func (c *ControlPlane) ListMemoryItems(ctx context.Context, opts MemoryListOptions) (map[string]any, error)
func (*ControlPlane) ListPublicHubs ¶ added in v0.2.6
func (*ControlPlane) ListRuntimeGroupInventory ¶ added in v0.3.6
func (c *ControlPlane) ListRuntimeGroupInventory(ctx context.Context, runtimeGroupID string, opts RuntimeGroupInventoryOptions) (map[string]any, error)
ListRuntimeGroupInventory lists the skills a runtime group is actually observed running.
Where ListRuntimeGroupMarketplace answers "what could be installed here", this answers "what is loaded right now": each entry carries "skill_id", "version", "source", "active", "adapt_intents", "padatious_intents", "total_intents" and "observed_at". The envelope reports the observation's provenance in "source" -- "ovos-runtime-operator", "runtime-group-cache" or "ovos-runtime-operator-pending" -- plus "operator_phase" and "operator_message".
Unlike GetHubRuntimeCapabilities this route does not answer HTTP 409 when nothing is reporting: it returns an empty "data" list with a pending "source" instead.
Requires a token with the hubs:inspect scope; no paid plan is needed.
func (*ControlPlane) ListRuntimeGroupMarketplace ¶ added in v0.3.6
func (c *ControlPlane) ListRuntimeGroupMarketplace(ctx context.Context, runtimeGroupID string, opts RuntimeGroupMarketplaceOptions) (map[string]any, error)
ListRuntimeGroupMarketplace lists the marketplace catalog resolved against one runtime group.
This is the discovery view to use before installing: every catalog entry is returned with the group's own state folded in -- whether the skill is desired ("active", "version_pin", "source_type"), whether it was observed running ("observed_source", "observed_at", intent counts), operator status fields, and the access verdict for the tenant plan ("purchase_required", "installable", "access_message"). The envelope also carries "runtime_group_id", "observed_at", "source", "operator_phase" and "operator_message".
Requires a token with the hubs:inspect scope; no paid plan is needed to browse. The API answers HTTP 404 for an unknown group and HTTP 403 when the caller does not own it.
func (*ControlPlane) ListRuntimeGroups ¶ added in v0.3.6
func (c *ControlPlane) ListRuntimeGroups(ctx context.Context, ownerID string) (map[string]any, error)
ListRuntimeGroups lists the runtime groups visible to the authenticated user. An empty ownerID is omitted from the query.
Requires a token with the hubs:read scope.
func (*ControlPlane) LoginWithBrowser ¶ added in v0.3.3
func (c *ControlPlane) LoginWithBrowser(ctx context.Context, opts DeviceLoginOptions) (map[string]any, error)
LoginWithBrowser signs in through the browser device flow and stores the returned API token. This is the sign-in path for accounts without a password (for example Google sign-in). It requests a device authorization, tells the user to visit verification_uri and enter the short user_code (set DeviceLoginOptions.Prompt to present it yourself), opens the browser at verification_uri_complete on a best-effort basis unless DeviceLoginOptions.OpenBrowser is false, and polls until the request is approved, denied, expired, the timeout elapses, or ctx is cancelled.
On approval the returned access_token is a durable scoped API token and is stored on ControlPlane.AccessToken exactly like Login. Denial, expiry, and timeout are reported as ErrDeviceAccessDenied, ErrDeviceCodeExpired, and ErrTimeout respectively.
func (*ControlPlane) LoginWithOptions ¶ added in v0.3.2
func (c *ControlPlane) LoginWithOptions(ctx context.Context, email string, password string, opts LoginOptions) (map[string]any, error)
func (*ControlPlane) ReleaseHub ¶ added in v0.3.6
func (c *ControlPlane) ReleaseHub(ctx context.Context, hubID string, opts ReleaseOptions) (map[string]any, error)
ReleaseHub applies a hub release policy and returns the updated hub.
Requires a paid plan and a token with the hubs:write scope.
func (*ControlPlane) ReleaseRuntimeGroup ¶ added in v0.3.6
func (c *ControlPlane) ReleaseRuntimeGroup(ctx context.Context, runtimeGroupID string, opts ReleaseOptions) (map[string]any, error)
ReleaseRuntimeGroup applies a runtime image policy and returns the updated runtime group. Options behave like ReleaseHub.
Requires a paid plan and a token with the hubs:write scope.
func (*ControlPlane) RequireRuntimeProtocol ¶ added in v0.2.2
func (c *ControlPlane) RequireRuntimeProtocol(result BootstrapIdentityResult, protocol HubProtocol) (*SelectedHubEndpoint, error)
func (*ControlPlane) SetHubRating ¶ added in v0.3.6
func (c *ControlPlane) SetHubRating(ctx context.Context, hubID string, rating int) (map[string]any, error)
SetHubRating rates a public hub from 1 to 5 and returns the updated hub.
Only public hubs can be rated, and owners cannot rate their own hubs. Requires a token with the hubs:write scope; unlike the provisioning routes this one is not paid-gated.
func (ControlPlane) String ¶ added in v0.3.7
func (c ControlPlane) String() string
String implements fmt.Stringer so the %v, %s, and %+v verbs render a ControlPlane with its AccessToken (a bearer API token) redacted. The receiver is a value so a dereferenced *ControlPlane printed with %v is redacted too. This is a human-facing formatting guard only; it does not affect json.Marshal.
func (*ControlPlane) UninstallRuntimeGroupSkill ¶ added in v0.3.6
func (c *ControlPlane) UninstallRuntimeGroupSkill(ctx context.Context, runtimeGroupID string, skillID string) error
UninstallRuntimeGroupSkill removes a skill from a runtime group.
Requires a paid plan and a token with the hubs:write scope.
func (*ControlPlane) UpdateHub ¶ added in v0.3.6
func (c *ControlPlane) UpdateHub(ctx context.Context, hubID string, payload map[string]any, etag string) (map[string]any, error)
UpdateHub partially updates a hub.
The API enforces optimistic locking on this route, so etag is required: pass the "etag" of the hub resource you read and the SDK sends it as If-Match. A stale or empty value fails with HTTP 412 and changes nothing; re-read the hub with GetHub and retry with the new etag.
Requires a paid plan and a token with the hubs:write scope.
func (*ControlPlane) UpdateMemoryItem ¶ added in v0.2.13
func (*ControlPlane) UpdateRuntimeGroup ¶ added in v0.3.6
func (c *ControlPlane) UpdateRuntimeGroup(ctx context.Context, runtimeGroupID string, payload map[string]any) (map[string]any, error)
UpdateRuntimeGroup updates a runtime group's "name", "description", or "spec". "spec" patches "replicas" and container "resources". Unlike the hub routes this one reads no If-Match header.
Requires a paid plan and a token with the hubs:write scope.
func (*ControlPlane) UpdateRuntimeGroupConfig ¶ added in v0.3.6
func (c *ControlPlane) UpdateRuntimeGroupConfig(ctx context.Context, runtimeGroupID string, config map[string]any, opts RuntimeGroupConfigOptions) (map[string]any, error)
UpdateRuntimeGroupConfig merges runtime configuration into a runtime group.
The API merges config into the stored configuration rather than replacing it, and marks the group pending so the runtime operator reconciles the change. RuntimeGroupConfigOptions.Personas is replaced only when non-nil.
Requires a paid plan and a token with the hubs:write scope.
type Conversation ¶
type Conversation struct {
Client *Client
Options ConversationOptions
}
func (Conversation) Ask ¶
func (c Conversation) Ask(ctx context.Context, text string, opts RequestOptions) (Reply, error)
func (Conversation) Query ¶ added in v0.2.15
func (c Conversation) Query(ctx context.Context, text string, opts QueryOptions) (Reply, error)
func (Conversation) SendAction ¶
func (c Conversation) SendAction(ctx context.Context, payload string, opts ActionOptions) error
func (Conversation) SendCode ¶
func (c Conversation) SendCode(ctx context.Context, value string, opts CodeOptions) error
func (Conversation) SendUtterance ¶
func (c Conversation) SendUtterance(ctx context.Context, text string, opts RequestOptions) error
type ConversationOptions ¶
type Data ¶
func UtterancePayload ¶
type DeviceLoginOptions ¶ added in v0.3.3
type DeviceLoginOptions struct {
Scopes []string
ClientName string
OpenBrowser *bool
Prompt func(grant map[string]any)
Timeout time.Duration
}
DeviceLoginOptions carries optional device-flow sign-in inputs for LoginWithBrowser. Scopes and ClientName are forwarded to the device authorization request when set; the server may expand the echoed scopes during normalization. OpenBrowser defaults to true when nil. Prompt, when set, receives the device authorization payload instead of the default message printed to stdout. Timeout bounds the whole approval wait and defaults to DefaultDeviceLoginTimeout when zero.
type DisplayItem ¶
type DisplayItem struct {
Kind string
Text string
Data any
Title string
Payload string
URL string
Silent bool
}
func DisplayItemsFromEventData ¶
func DisplayItemsFromEventData(data Data, eventName string, maxTextChars int) []DisplayItem
type Event ¶
func (Event) DisplayItems ¶
func (e Event) DisplayItems(maxTextChars int) []DisplayItem
func (Event) DisplayText ¶
func (Event) Utterances ¶
type HTTPTransport ¶
type HTTPTransport struct {
Identity Identity
UserAgent string
PollInterval time.Duration
HTTPClient *http.Client
BusEvents chan Event
HiveEvents chan HiveMessage
// contains filtered or unexported fields
}
func NewHTTPTransport ¶
func NewHTTPTransport(identity Identity) *HTTPTransport
func (*HTTPTransport) Authorization ¶
func (t *HTTPTransport) Authorization() string
func (*HTTPTransport) BaseURL ¶
func (t *HTTPTransport) BaseURL() string
func (*HTTPTransport) ConnectionInfo ¶ added in v0.2.14
func (t *HTTPTransport) ConnectionInfo() TransportConnectionInfo
func (*HTTPTransport) Disconnect ¶
func (t *HTTPTransport) Disconnect(ctx context.Context) error
func (*HTTPTransport) Events ¶ added in v0.2.4
func (t *HTTPTransport) Events() <-chan Event
func (*HTTPTransport) Healthcheck ¶
func (t *HTTPTransport) Healthcheck() TransportHealth
func (*HTTPTransport) HiveMessages ¶ added in v0.2.15
func (t *HTTPTransport) HiveMessages() <-chan HiveMessage
func (*HTTPTransport) IsHandshakeComplete ¶
func (t *HTTPTransport) IsHandshakeComplete() bool
func (*HTTPTransport) SendHiveMessage ¶ added in v0.2.15
func (t *HTTPTransport) SendHiveMessage(ctx context.Context, message HiveMessage, encrypt bool) error
type HiveMessage ¶
type HiveMessage struct {
MsgType string `json:"msg_type"`
Payload map[string]any `json:"payload"`
Metadata map[string]any `json:"metadata"`
Route []any `json:"route"`
Node any `json:"node"`
TargetSiteID any `json:"target_site_id"`
TargetPubKey any `json:"target_pubkey"`
SourcePeer any `json:"source_peer"`
}
func DecodeHiveBinaryFrame ¶ added in v0.2.5
func DecodeHiveBinaryFrame(payload []byte) (HiveMessage, error)
type HubCreateOptions ¶ added in v0.3.6
type HubCreateOptions struct {
IdempotencyKey string
}
HubCreateOptions carries the optional inputs of CreateHub. IdempotencyKey overrides the key the SDK generates for the Idempotency-Key header; leave it empty to let CreateHub mint one.
type HubDataPlaneEndpoints ¶ added in v0.2.1
type HubDataPlaneEndpoints struct {
HTTPS string `json:"https,omitempty"`
WSS string `json:"wss,omitempty"`
MQTT string `json:"mqtt,omitempty"`
}
func DataPlaneEndpointsFromHub ¶ added in v0.2.1
func DataPlaneEndpointsFromHub(hub map[string]any) HubDataPlaneEndpoints
func DataPlaneEndpointsFromMap ¶ added in v0.2.1
func DataPlaneEndpointsFromMap(values map[string]any) HubDataPlaneEndpoints
func (HubDataPlaneEndpoints) EndpointFor ¶ added in v0.2.1
func (e HubDataPlaneEndpoints) EndpointFor(protocol HubProtocol) string
func (HubDataPlaneEndpoints) HTTPBase ¶ added in v0.2.1
func (e HubDataPlaneEndpoints) HTTPBase(fallbackMaster string, fallbackPort int, fallbackPath string) string
func (HubDataPlaneEndpoints) Map ¶ added in v0.2.1
func (e HubDataPlaneEndpoints) Map(redactCredentials bool) map[string]string
Map renders the data-plane endpoints as a plain map. Polarity note: the boolean is redactCredentials, where true STRIPS any embedded userinfo credentials from each endpoint URL and false returns them verbatim. This is the OPPOSITE polarity of MqttBrokerCredentials.Map(includeSecrets bool) in identity.go, which reveals when its boolean is true — keep the two straight at call sites.
type HubProtocol ¶ added in v0.2.1
type HubProtocol string
const ( ProtocolWSS HubProtocol = "wss" ProtocolHTTPS HubProtocol = "https" ProtocolMQTT HubProtocol = "mqtt" )
type HubProtocolSettings ¶ added in v0.2.1
type HubProtocolSettings struct {
WSS bool `json:"wss"`
HTTP bool `json:"http"`
MQTT bool `json:"mqtt"`
}
func DefaultHubProtocolSettings ¶ added in v0.2.1
func DefaultHubProtocolSettings() HubProtocolSettings
func ProtocolSettingsFromMap ¶ added in v0.2.1
func ProtocolSettingsFromMap(values map[string]any) HubProtocolSettings
func (HubProtocolSettings) EnabledProtocols ¶ added in v0.2.1
func (s HubProtocolSettings) EnabledProtocols() []HubProtocol
func (HubProtocolSettings) IsEnabled ¶ added in v0.2.1
func (s HubProtocolSettings) IsEnabled(protocol HubProtocol) bool
func (HubProtocolSettings) SpecMap ¶ added in v0.2.1
func (s HubProtocolSettings) SpecMap() map[string]any
type Identity ¶
type Identity struct {
AccessKey string `json:"access_key"`
Password string `json:"password"`
CryptoKey string `json:"crypto_key,omitempty"`
SiteID string `json:"site_id"`
DefaultMaster string `json:"default_master"`
DefaultPort int `json:"default_port"`
DefaultPath string `json:"default_path,omitempty"`
PublicKey string `json:"public_key,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
DataPlaneEndpoints HubDataPlaneEndpoints `json:"data_plane_endpoints,omitempty"`
Protocols HubProtocolSettings `json:"protocols,omitempty"`
MQTT *MqttBrokerCredentials `json:"mqtt,omitempty"`
}
func IdentityFromConfig ¶ added in v0.2.11
func IdentityFromEnv ¶
func IdentityFromFile ¶
func (Identity) EnabledProtocols ¶ added in v0.2.1
func (i Identity) EnabledProtocols() []HubProtocol
func (Identity) EndpointBase ¶
func (Identity) EndpointFor ¶ added in v0.2.1
func (i Identity) EndpointFor(protocol HubProtocol) string
func (Identity) String ¶ added in v0.3.7
String implements fmt.Stringer so the %v, %s, and %+v verbs render an Identity with its AccessKey, Password, and CryptoKey (and the nested MQTT credentials) redacted. Without it, %+v would print the client's data-plane secrets into any log line or error string. This affects human-facing formatting ONLY: json.Marshal does not consult String(), so the wire protocol and the identity file on disk still round-trip the real secret values.
func (Identity) SupportsProtocol ¶ added in v0.2.1
func (i Identity) SupportsProtocol(protocol HubProtocol) bool
type LoginOptions ¶ added in v0.3.2
LoginOptions carries optional login inputs. Scope overrides the default token scopes. OTPCode and RecoveryCode satisfy an MFA challenge; the API rejects MFA-enabled accounts with HTTP 401 {"code": "mfa_required"} when neither is provided.
type MQTTTransport ¶ added in v0.2.4
type MQTTTransport struct {
Identity Identity
UserAgent string
Topics MqttTopicSet
BusEvents chan Event
HiveEvents chan HiveMessage
// contains filtered or unexported fields
}
func NewMQTTTransport ¶ added in v0.2.4
func NewMQTTTransport(identity Identity) (*MQTTTransport, error)
func (*MQTTTransport) Connect ¶ added in v0.2.4
func (t *MQTTTransport) Connect(ctx context.Context) error
func (*MQTTTransport) ConnectionInfo ¶ added in v0.2.14
func (t *MQTTTransport) ConnectionInfo() TransportConnectionInfo
func (*MQTTTransport) Disconnect ¶ added in v0.2.4
func (t *MQTTTransport) Disconnect(ctx context.Context) error
func (*MQTTTransport) Events ¶ added in v0.2.4
func (t *MQTTTransport) Events() <-chan Event
func (*MQTTTransport) Healthcheck ¶ added in v0.2.4
func (t *MQTTTransport) Healthcheck() TransportHealth
func (*MQTTTransport) HiveMessages ¶ added in v0.2.15
func (t *MQTTTransport) HiveMessages() <-chan HiveMessage
func (*MQTTTransport) IsHandshakeComplete ¶ added in v0.2.4
func (t *MQTTTransport) IsHandshakeComplete() bool
func (*MQTTTransport) SendHiveMessage ¶ added in v0.2.15
func (t *MQTTTransport) SendHiveMessage(ctx context.Context, message HiveMessage, encrypt bool) error
type MarketplaceSkillListOptions ¶ added in v0.3.6
MarketplaceSkillListOptions carries the optional inputs of ListMarketplaceSkills. OwnerID and IncludeInactive are honored for admin tokens only; the API silently scopes a non-admin caller to their own tenant and to active entries instead of failing. ForceRefresh re-syncs the global catalog from its source before answering, which is slower.
type MemoryListOptions ¶ added in v0.2.13
type MqttBrokerCredentials ¶ added in v0.2.3
type MqttBrokerCredentials struct {
Endpoint string `json:"endpoint"`
Username string `json:"username"`
Password string `json:"password"`
TopicPrefix string `json:"topic_prefix,omitempty"`
QOS byte `json:"qos,omitempty"`
TLS bool `json:"tls"`
}
func MqttBrokerCredentialsFromMap ¶ added in v0.2.3
func MqttBrokerCredentialsFromMap(raw any) *MqttBrokerCredentials
func (MqttBrokerCredentials) Map ¶ added in v0.2.3
func (m MqttBrokerCredentials) Map(includeSecrets bool) map[string]any
Map renders the broker credentials as a plain map. Polarity note: the boolean is includeSecrets, where true REVEALS the username, password, and topic details and false returns only the non-sensitive endpoint and tls fields. This is the OPPOSITE polarity of HubDataPlaneEndpoints.Map(redactCredentials bool) in protocols.go, which redacts when its boolean is true — keep the two straight at call sites.
func (MqttBrokerCredentials) String ¶ added in v0.3.7
func (m MqttBrokerCredentials) String() string
String implements fmt.Stringer so the %v, %s, and %+v verbs render the broker credentials with the Username and Password redacted, mirroring how Map(false) omits them. Like Identity.String this is a formatting-only guard and does not affect json.Marshal, which still serializes the real values.
type MqttTopicSet ¶ added in v0.2.4
func MQTTTopicsForIdentity ¶ added in v0.2.4
func MQTTTopicsForIdentity(identity Identity) (MqttTopicSet, error)
MQTTTopicsForIdentity derives the data-plane topic set from the identity's MQTT credentials. TopicPrefix is the full base -- hivemind/<hub-id>/<access-key> -- and the channels append a fixed suffix to it: publish requests go to <prefix>/in, subscribe replies arrive on <prefix>/out, and the retained presence/LWT lives on <prefix>/status.
type OperationResource ¶ added in v0.2.16
type OperationResource struct {
ID string `json:"id"`
Kind string `json:"kind"`
AggregateType string `json:"aggregate_type"`
AggregateID *string `json:"aggregate_id"`
Status OperationStatus `json:"status"`
Details map[string]any `json:"details"`
GitCommitSHA *string `json:"git_commit_sha"`
ErrorCode *string `json:"error_code"`
ErrorMessage *string `json:"error_message"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
CommittedAt *string `json:"committed_at"`
AppliedAt *string `json:"applied_at"`
ReadyAt *string `json:"ready_at"`
TerminalAt *string `json:"terminal_at"`
Links map[string]*string `json:"links"`
}
type OperationStatus ¶ added in v0.2.16
type OperationStatus string
const ( OperationRequested OperationStatus = "requested" OperationCommitted OperationStatus = "committed" OperationApplied OperationStatus = "applied" OperationReady OperationStatus = "ready" OperationFailed OperationStatus = "failed" OperationTimedOut OperationStatus = "timed_out" )
type QueryOptions ¶ added in v0.2.15
type ReleaseOptions ¶ added in v0.3.6
type ReleaseOptions struct {
Channel string
Mode string
Version string
Images map[string]string
Reason string
}
ReleaseOptions carries the release policy ReleaseHub and ReleaseRuntimeGroup apply. Every field is optional and an unset field is omitted from the request body, so the API falls back to the workspace release policy for it. Setting Images switches the target to "custom" mode unless Mode is also set.
type Reply ¶
type Reply struct {
Text string
Utterances []string
Handled bool
OK bool
SessionID string
RequestID string
Events []Event
FailureEvent *Event
}
func (Reply) DisplayItems ¶
func (r Reply) DisplayItems(maxTextChars int) []DisplayItem
func (Reply) DisplayText ¶
type RequestOptions ¶
type RuntimeGroupConfigOptions ¶ added in v0.3.6
RuntimeGroupConfigOptions carries the optional inputs of UpdateRuntimeGroupConfig. Personas replaces the stored personas when non-nil and is omitted from the request body when nil.
type RuntimeGroupInventoryOptions ¶ added in v0.3.6
type RuntimeGroupInventoryOptions struct {
Refresh bool
}
RuntimeGroupInventoryOptions carries the optional inputs of ListRuntimeGroupInventory. Refresh forces a live read from the runtime operator; the API also refreshes on its own when it holds no cached snapshot.
type RuntimeGroupMarketplaceOptions ¶ added in v0.3.6
type RuntimeGroupMarketplaceOptions struct {
RefreshInventory bool
}
RuntimeGroupMarketplaceOptions carries the optional inputs of ListRuntimeGroupMarketplace. RefreshInventory forces a live read from the runtime operator instead of answering from the cached inventory snapshot.
type RuntimeGroupSkillInstallOptions ¶ added in v0.3.6
type RuntimeGroupSkillInstallOptions struct {
MarketplaceSkillID string
SourceType string
SourceRef string
VersionPin string
Active *bool
}
RuntimeGroupSkillInstallOptions carries the optional inputs of InstallRuntimeGroupSkill. The zero value installs an active skill from the marketplace catalog: SourceType defaults to "catalog" when empty and Active defaults to true when nil. A "git" install needs SourceRef set to the repository URL.
type RuntimeTransport ¶ added in v0.2.4
type SelectedHubEndpoint ¶ added in v0.2.2
type SelectedHubEndpoint struct {
Protocol HubProtocol `json:"protocol"`
Endpoint string `json:"endpoint"`
}
func SelectDataPlaneEndpoint ¶ added in v0.2.2
func SelectDataPlaneEndpoint(endpoints HubDataPlaneEndpoints, protocols HubProtocolSettings, preferred []HubProtocol) *SelectedHubEndpoint
type TransportConnectionInfo ¶ added in v0.2.14
type TransportConnectionInfo struct {
Phase TransportConnectionPhase `json:"phase"`
StartedAt time.Time `json:"started_at,omitempty"`
ConnectedAt time.Time `json:"connected_at,omitempty"`
TransportOpenMS float64 `json:"transport_open_ms,omitempty"`
SocketOpenMS float64 `json:"socket_open_ms,omitempty"`
HandshakeMS float64 `json:"handshake_ms,omitempty"`
ConnectMS float64 `json:"connect_ms,omitempty"`
LastError string `json:"last_error,omitempty"`
}
type TransportConnectionPhase ¶ added in v0.2.14
type TransportConnectionPhase string
const ( ConnectionIdle TransportConnectionPhase = "idle" ConnectionConnecting TransportConnectionPhase = "connecting" ConnectionHandshake TransportConnectionPhase = "handshake" ConnectionReady TransportConnectionPhase = "ready" ConnectionClosed TransportConnectionPhase = "closed" ConnectionError TransportConnectionPhase = "error" )
type TransportHealth ¶
type TransportHealth struct {
Connected bool
HandshakeComplete bool
TransportAlive bool
LastError string
Connection TransportConnectionInfo
}
type WSSTransport ¶ added in v0.2.4
type WSSTransport struct {
Identity Identity
UserAgent string
BusEvents chan Event
HiveEvents chan HiveMessage
// contains filtered or unexported fields
}
func NewWSSTransport ¶ added in v0.2.4
func NewWSSTransport(identity Identity) *WSSTransport
func (*WSSTransport) Authorization ¶ added in v0.2.4
func (t *WSSTransport) Authorization() string
func (*WSSTransport) Connect ¶ added in v0.2.4
func (t *WSSTransport) Connect(ctx context.Context) error
func (*WSSTransport) ConnectionInfo ¶ added in v0.2.14
func (t *WSSTransport) ConnectionInfo() TransportConnectionInfo
func (*WSSTransport) Disconnect ¶ added in v0.2.4
func (t *WSSTransport) Disconnect(_ context.Context) error
func (*WSSTransport) Events ¶ added in v0.2.4
func (t *WSSTransport) Events() <-chan Event
func (*WSSTransport) Healthcheck ¶ added in v0.2.4
func (t *WSSTransport) Healthcheck() TransportHealth
func (*WSSTransport) HiveMessages ¶ added in v0.2.15
func (t *WSSTransport) HiveMessages() <-chan HiveMessage
func (*WSSTransport) IsHandshakeComplete ¶ added in v0.2.4
func (t *WSSTransport) IsHandshakeComplete() bool
func (*WSSTransport) SendHiveMessage ¶ added in v0.2.15
func (t *WSSTransport) SendHiveMessage(ctx context.Context, message HiveMessage, encrypt bool) error