sdk

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 26 Imported by: 3 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Go plugin SDK

Build a native plugin. The finished ZIP contains its executable, so plugin users do not need Go.

Build Counter · Setup · APIs · SDK checks · Host compatibility

Get started

Item Value
Build tools Go 1.27.4+, Python 3.11+
Module github.com/StreamDockManager/Plugin-SDK/Go
Import alias sdk
Build your first plugin

Clone the SDK. From its root:

cd examples/sdk-example-go
go mod download
go mod verify
python3 ../tools/package.py go

Use the printed ZIP in examples/artifacts/. In Manager, import and enable it, save a Counter binding, then press and release. The Counter guide shows what to customize. The checkout is 0.1.1; this starter pins the released Go module at v0.1.0.

Start a project with your own identity

Generate a Go starter, or add the released module from your own project:

go get github.com/StreamDockManager/Plugin-SDK/Go@v0.1.0

Keep the exact module version and go.sum. Private mirrors need authenticated Git access and the SDK module prefix in GOPRIVATE (and any explicitly configured proxy/sum database rules). Use a local workspace for unreleased APIs such as Vault text formatting. The public v0.1.0 module does not provide them.

Common APIs

API Purpose
Run, Handler Start the plugin and handle lifecycle/input events
Scheduler, DeferAction Schedule work and complete actions asynchronously
NewPortableSettings Read and update action/global settings
NewHostStore Use negotiated private host storage
/httptrack Opt in to HTTP diagnostics

The host transport uses coder/websocket; image codecs use the Go standard library. Host storage requires plugin-storage-v1; it does not silently switch to a local file.

Reusable helpers

Import managedstate, requests, connectedws, or thumbnail under the Go module. authoring.StartObservationJob, Present, and CompactDisplay use no extra dependencies. Thumbnail decoding returns an image.Image:

image, err := thumbnail.Decode(ctx, encodedBytes, 72, 72)

Use the SDK packaging helpers to retain dependency notices. Image codecs come from the Go standard library.

See the shared behavior and limits for persistence, discovery, cancellation, and rendering semantics.

Caches, discovery, and operation history

Import Go/cache, Go/discovery, and Go/operations from the SDK module. Use cache.New[T](entries, bytes) and explicit cache.NewPersistence[T](hostStore) for private storage. discovery.Runner.Run schedules read-only inspector work through the authoring engine. operations.New[T] creates a ledger; call Reserve before submission and Update after observing its outcome.

To fit an image and return a display-ready PNG data URI with custom limits:

limits := thumbnail.DefaultLimits()
limits.MaxInputBytes = 128 << 20
limits.MaxSourcePixels = 64_000_000
result, err := thumbnail.Render(ctx, encodedBytes, 256, 256, limits)
// result.DataURI, result.Width, result.Height

Omit limits to use 64 MiB / 32 MP. thumbnail.Fit, FitDecode, PNG, and DataURI are also available separately. Pass complete positive limits when supplying a Limits value.

WebSocket transport

Host connections and external service sessions use coder/websocket, pinned in go.mod. The host transport remains loopback-only, bypasses proxies, rejects redirects, and keeps the 1 MiB message limit. Compression is disabled. HTTP/TLS code is now part of the core Go dependency closure; optional service clients and image codecs still require their own imports.

Service authentication callbacks receive the opening context and a *websocket.Conn. Use that context for every read and write:

func authenticate(ctx context.Context, conn *websocket.Conn) error {
    var greeting map[string]any
    return wsjson.Read(ctx, conn, &greeting)
}

Import websocket and wsjson from github.com/coder/websocket and github.com/coder/websocket/wsjson. Existing Gorilla-based handshake callbacks need this signature change. Service connections retain system TLS verification, direct dialing, bounded requests, 30-second pings, and a 90-second pong allowance. Cancelling before writer admission sends nothing. Cancelling an admitted request stops waiting promptly; an already-started frame can still reach the peer and its delivery is uncertain. Writes have a separate eight-second session deadline; a failed or timed-out write, or cancelled authentication, closes the connection. Commands are never replayed automatically.

Scheduling and restoration

Timed work requires Scheduler; handlers without it are event-only and no longer receive implicit one-second polling. The authoring engine implements scheduling, with a zero deadline suspending idle polling. Set Feature.ShouldLogAction for action classification; the old setter is removed.

Engine.Restore(dst) returns an error directly and replaces the destination only after successful decoding. File stores accept only the current version-1 envelope. Store.Load(dst) has no migration callback. Rejected state blocks writes until an explicit successful reload, preserving the file for user-directed recovery.

Job generation migration

authoring.Engine.Generations has been removed. This is a source-incompatible Go API change: read job.Generation from a checked job, ok := engine.Jobs[id] lookup instead. A missing job must reject progress and completion, even if a previous generation is known. The engine's monotonic allocator remains internal scheduling state; it is not the current identity for a particular job. Update consumers together with their immutable SDK revision pins after that revision is published.

Binding state compatibility

The authoring engine groups binding-local settings, presentation and lifecycle cleanup through an internal live view. Its exported maps remain the authoritative storage, including direct mutations and map replacement by existing consumers. Shared probes, samples and jobs retain their own ownership and cancellation paths. No consumer migration or revision-pin change is required for this internal refactor; replacing those maps with physical binding records would require a separately coordinated breaking API migration.

Work on the SDK

Run from this Go/ directory:

go test ./...
Check Run from Go/ Scope
Compile go build ./... All Go SDK packages
Tests go test ./... Go unit and behavioral tests
Thumbnail tests go test ./thumbnail Optional image helper

To test the local SDK from a plugin module without changing its dependency pin, use a temporary workspace (POSIX shell):

plugin_root="$PWD"
sdk_go=/absolute/path/to/Plugin-SDK/Go
work=$(mktemp -d)
(
    cd "$work" || exit
    GOWORK=off go work init "$plugin_root" "$sdk_go"
    export GOWORK="$work/go.work"
    go work edit "-replace=github.com/StreamDockManager/Plugin-SDK/Go@v0.1.0=$sdk_go"
    cd "$plugin_root" || exit
    go test ./...
)

Use the version in your own go.mod in the replacement if it differs. Keep the workspace and local paths out of commits. Shared SDK behavior must remain consistent across languages.

Troubleshooting

Problem Next step
Module download fails Check the pinned SDK revision and repository access; configure GOPRIVATE only when private access requires it.
Local SDK edits are not visible Use an explicit temporary Go workspace; do not commit sibling-path replacements.

License

SDK code is MIT-licensed. Preserve dependency notices in distributed packages; Manager and the official plugins have separate licenses.

Documentation

Overview

Package sdk implements Stream Dock Manager protocol v1, OpenAction events for OpenDeck, and plugin protocol features shared with VSD Craft and Elgato Stream Deck.

Index

Constants

View Source
const ContractVersion = 1
View Source
const DescriptorLimit = 64 << 10
View Source
const DescriptorPrefix = "SDMCAP1:"
View Source
const DescriptorSuffix = ":ENDSDMCAP1"
View Source
const HTTPBrokerProtocol = "plugin-http-broker-v1"
View Source
const MaxInputBytes = 8 * MaxMessageBytes

MaxInputBytes charges encoded envelopes until dispatch (or dial batching) releases them. The socket reader may additionally hold one bounded envelope

View Source
const MaxInputItems = 128
View Source
const MaxLogBytes = MaxMessageBytes
View Source
const MaxMessageBytes = 1 << 20

MaxMessageBytes bounds the complete UTF-8 JSON envelope in protocol v1, including legacy hosts

View Source
const MaxOutputBytes = 8 * MaxMessageBytes
View Source
const MaxPortableImageBytes = 512 * 1024

MaxPortableImageBytes leaves room for the base64 image and protocol envelope

View Source
const MaximumStorageMessage = 512 << 10
View Source
const MaximumStorageValue = 256 << 10
View Source
const NotificationsProtocol = "plugin-notifications-v1"

NotificationsProtocol identifies Manager's plugin-message notification support

View Source
const OpenActionDidReceiveDeepLink = "didReceiveDeepLink"
View Source
const OpenActionShowSettingsInterface = "showSettingsInterface"

OpenAction events are opt-in; no UI or URL is opened by these helpers

View Source
const PermissionsProtocol = "plugin-permissions-v1"
View Source
const RPCRequestEvent = "streamDockManagerRpcRequest"
View Source
const RPCResponseEvent = "streamDockManagerRpcResponse"
View Source
const SettingsProtocol = "plugin-settings-rpc-v1"
View Source
const StorageProtocol = "plugin-storage-v1"
View Source
const TextReferencesProtocol = "plugin-text-references-v1"
View Source
const ThemeEvent = "didReceivePluginTheme"
View Source
const ThemeProtocol = "plugin-theme-v1"
View Source
const VaultReferencesProtocol = "plugin-vault-references-v1"
View Source
const VaultSecretSharingProtocol = "plugin-vault-secret-sharing-v1"
View Source
const VaultValuesProtocol = "plugin-vault-values-v1"
View Source
const VaultWritesProtocol = "plugin-vault-writes-v1"

Variables

View Source
var CompiledDescriptor string

CompiledDescriptor is injected from the same Definition that generates the manifest. It remains referenced by registration, including stripped builds

Functions

func ConnectWithInfo

func ConnectWithInfo(parent context.Context, address, token string, h Handler, info HostInfo) error

ConnectWithInfo negotiates optional extensions from explicit host metadata

func DeferAction

func DeferAction(ctx context.Context) func(error)

DeferAction ties asynchronous work to the current tracked input. Call the returned function exactly when that work finishes. The SDK reports success only after the handler and every deferred operation have succeeded

func FrameCapabilities

func FrameCapabilities(value Capabilities) (string, error)

Encode the capability descriptor in its framed wire format

func ImageDataURI

func ImageDataURI(mediaType string, data []byte) (string, error)

ImageDataURI encodes caller-provided PNG or SVG bytes for portable setImage messages. It never reads files or URLs, changes paths, or grants permissions It does not decode or sanitize images: only pass trusted image bytes. The ordinary outgoing message limit still applies to the complete message

func NetworkPayload

func NetworkPayload() (sent, received uint64)

NetworkPayload excludes SDK loopback, TLS/TCP overhead, DNS, subprocesses, and library-owned transports (including speedtest-go)

func OpenActionDeepLink(event Event) (url string, matched bool, err error)

OpenActionDeepLink returns the untrusted, opaque payload URL, not a decoded command. The caller must validate routing/content before taking any action

func OpenActionSettingsRequested

func OpenActionSettingsRequested(event Event) bool

OpenActionSettingsRequested recognizes OpenDeck's payload-free request Set HasSettingsInterface in the manifest only if your handler supplies a UI

func OperationID

func OperationID() string

OperationID is independent of the authentication token and may be retained for explicit reconciliation. Reuse it only for the identical logical mutation

func Run

func Run(ctx context.Context, args []string, h Handler) error

Parse host launch arguments and run the plugin connection

func ShouldLogAction

func ShouldLogAction(e Event) bool

Select action events worth recording in plugin logs

func TrackConn

func TrackConn(connection net.Conn) net.Conn

Wrap a connection with payload accounting

Types

type ActionCapability

type ActionCapability struct {
	Refresh         *polling.RefreshPolicy `json:"refresh,omitempty"`
	ParameterFields []string               `json:"parameter_fields,omitempty"`
	FeedbackLayout  string                 `json:"feedback_layout,omitempty"`
	ControlTypes    []string               `json:"control_types,omitempty"`
	AdditiveDial    bool                   `json:"additive_dial,omitempty"`
	Settings        string                 `json:"settings,omitempty"`
	Icon            ThemedAsset            `json:"icon"`
	States          []ThemedAsset          `json:"states"`
}

type ActionLogging

type ActionLogging interface {
	ShouldLogAction(Event) bool
}

ActionLogging optionally selects the input events that execute a plugin action Receipts remain independent of logging; release-based actions can opt in here

type ActionPermissionStatus added in v0.1.1

type ActionPermissionStatus struct {
	Action    string            `json:"action"`
	Scope     map[string]string `json:"scope"`
	Granted   bool              `json:"granted"`
	Available bool              `json:"available"`
}

type ActionPermissions added in v0.1.1

type ActionPermissions struct {
	Purpose  string              `json:"purpose"`
	Required []map[string]string `json:"required,omitempty"`
	Optional []map[string]string `json:"optional,omitempty"`
}

type AdditiveDial

type AdditiveDial interface{ BatchDial(action string) bool }

AdditiveDial opts in only actions whose rotation operation is additive

type Capabilities

type Capabilities struct {
	Permissions          *PermissionDeclaration      `json:"permissions,omitempty"`
	MinimumManager       string                      `json:"minimum_manager,omitempty"`
	RequiredCapabilities []string                    `json:"required_capabilities,omitempty"`
	Version              int                         `json:"version"`
	ID                   string                      `json:"id"`
	PluginVersion        string                      `json:"plugin_version"`
	ThemeProtocol        int                         `json:"theme_protocol"`
	SettingsProtocol     int                         `json:"settings_protocol"`
	InputProtocol        int                         `json:"input_protocol"`
	PluginSettings       string                      `json:"plugin_settings,omitempty"`
	Icon                 ThemedAsset                 `json:"icon"`
	Actions              map[string]ActionCapability `json:"actions"`
}

func RuntimeCapabilities

func RuntimeCapabilities() (*Capabilities, error)

Decode the descriptor embedded at build time

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewLocalClient

func NewLocalClient(info HostInfo, identity string) (*Client, <-chan Event)

NewLocalClient supplies the same bounded, capability-gated writer without a socket. The caller owns draining the returned events (for simulations/tests)

func (*Client) Alert

func (c *Client) Alert(ctx context.Context, binding string) error

Show an alert indicator on a binding

func (*Client) CreateNotification added in v0.1.1

func (c *Client) CreateNotification(ctx context.Context, action string, level NotificationLevel, message string) error

CreateNotification sends a plain-text notice under the reviewed action scope

func (*Client) CurrentPluginTheme

func (c *Client) CurrentPluginTheme() *PluginTheme

Read the cached plugin theme

func (*Client) DesktopInput

func (c *Client) DesktopInput(ctx context.Context, binding string, value any) error

Request negotiated desktop input for a binding

func (*Client) Dispatch

func (c *Client) Dispatch(ctx context.Context, handler Handler, event Event)

Dispatch runs one event through the same completion/error machinery as Run It belongs to the caller's serialized loop; testkit uses it for offline replay

func (*Client) Display

func (c *Client) Display(ctx context.Context, binding, title, image string, state int, layout string, feedback any) error

Display sends standard vendor display commands; Manager-only extensions remain negotiated

func (*Client) DynamicItems

func (c *Client) DynamicItems(ctx context.Context, value any) error

Send dynamic inspector choice data

func (*Client) Feedback

func (c *Client) Feedback(ctx context.Context, binding string, value any) error

Send structured feedback to a binding

func (*Client) FeedbackLayout

func (c *Client) FeedbackLayout(ctx context.Context, binding, layout string) error

Select a binding feedback layout

func (*Client) FormatText added in v0.1.1

func (c *Client) FormatText(ctx context.Context, action, text string) (string, error)

FormatText resolves one transient string in the host's permission-checked action scope

func (*Client) GetGlobalSettings

func (c *Client) GetGlobalSettings(ctx context.Context) error

Request the current plugin-global settings

func (*Client) GetPermissions added in v0.1.1

func (c *Client) GetPermissions(ctx context.Context) (PermissionList, error)

func (*Client) GetPluginTheme

func (c *Client) GetPluginTheme(ctx context.Context) (*PluginTheme, error)

Fetch the current theme through negotiated RPC

func (*Client) GetSettings

func (c *Client) GetSettings(ctx context.Context, binding string) error

Request the current binding settings

func (*Client) GlobalSettings

func (c *Client) GlobalSettings(ctx context.Context, value any) error

Replace plugin-global portable settings

func (*Client) HasPermission added in v0.1.1

func (c *Client) HasPermission(ctx context.Context, action string, scope map[string]string) (PermissionStatus, error)

func (*Client) Host

func (c *Client) Host() HostInfo

Return the client host metadata

func (*Client) Image

func (c *Client) Image(ctx context.Context, binding, image string) error

Send an image reference to a binding

func (*Client) ListVaultEntries added in v0.1.1

func (c *Client) ListVaultEntries(ctx context.Context, action string, scope map[string]string, start int) (VaultEntryPage, error)

func (*Client) Log

func (c *Client) Log(ctx context.Context, message string) error

Send a plugin log message

func (*Client) LogStream

func (c *Client) LogStream(ctx context.Context, stream LogStream, message string) error

Send a message on the requested output stream

func (*Client) NotifyCompletion added in v0.1.1

func (c *Client) NotifyCompletion(ctx context.Context, activation string) (CompletionStatus, error)

func (*Client) OK

func (c *Client) OK(ctx context.Context, binding string) error

Show a success indicator on a binding

func (*Client) ObserveControl

func (c *Client) ObserveControl(e Event) bool

ObserveControl is called by the transport before ordinary event admission True means an RPC response was consumed; base settings notifications always remain available to the normal event loop. It never invokes plugin callbacks

func (*Client) OpenURL

func (c *Client) OpenURL(ctx context.Context, address string) error

Ask the host to open a URL

func (*Client) ReadClipboardText added in v0.1.1

func (c *Client) ReadClipboardText(ctx context.Context, activation string) (ClipboardText, error)

func (*Client) ReadVaultLocation added in v0.1.1

func (c *Client) ReadVaultLocation(ctx context.Context, selection VaultValueRequest) (VaultLocation, error)

func (*Client) ReadVaultSecret added in v0.1.1

func (c *Client) ReadVaultSecret(ctx context.Context, selection VaultValueRequest) (VaultSecret, error)

ReadVaultSecret reads one explicitly approved credential, without a vendor fallback.

func (*Client) ReadVaultText added in v0.1.1

func (c *Client) ReadVaultText(ctx context.Context, selection VaultValueRequest) (VaultText, error)

ReadVaultText reads one approved nonsecret text slot, without a vendor fallback.

func (*Client) Request

func (c *Client) Request(ctx context.Context, protocol, method string, payload any) (json.RawMessage, error)

Request performs a bounded, capability-negotiated Manager RPC. Cancellation or timeout after enqueue is indeterminate; it never retries through another route

func (*Client) RequestPermissions added in v0.1.1

func (c *Client) RequestPermissions(ctx context.Context, activation string, scopes []map[string]string) (PermissionReview, error)

func (*Client) RequestVSDCraftSettings added in v0.1.1

func (c *Client) RequestVSDCraftSettings(ctx context.Context) error

RequestVSDCraftSettings sends the documented VSD Craft backend request using the registration UUID Handle didReceiveSettings as an event; the request does not select an action binding

func (*Client) RunVaultRecipe added in v0.1.1

func (c *Client) RunVaultRecipe(ctx context.Context, activation string, scope map[string]string, entryRef string) (RecipeResult, error)

RunVaultRecipe asks Manager to review an exact reference and fixed destination.

func (*Client) SelectVaultEntry added in v0.1.1

func (c *Client) SelectVaultEntry(ctx context.Context, activation, action string, scope map[string]string) (PermissionReview, error)

func (*Client) Send

func (c *Client) Send(ctx context.Context, e Event) error

Enqueue a bounded host event after capability checks

func (*Client) SendExampleWebhook added in v0.1.1

func (c *Client) SendExampleWebhook(ctx context.Context, activation, certificate string) (RecipeResult, error)

SendExampleWebhook opens a review for a fixed local HTTPS ping. The PEM is the listener’s public session certificate.

func (*Client) SendLocalWebhook added in v0.1.1

func (c *Client) SendLocalWebhook(ctx context.Context, activation, origin string) (RecipeResult, error)

SendLocalWebhook asks Manager to review a ping to the declared local HTTP origin.

func (*Client) SetLogRedactor

func (c *Client) SetLogRedactor(redact func(string) string)

SetLogRedactor installs a snapshot-based sanitizer. It is applied before framing; writers never echo RPC messages to the process console

func (*Client) SetNetworkDebug

func (c *Client) SetNetworkDebug(enabled bool)

SetNetworkDebug is normally driven by Manager's per-plugin log preferences Diagnostic traffic uses the independent bounded log queue, never stdout echo

func (*Client) Settings

func (c *Client) Settings(ctx context.Context, binding string, value any) error

Replace binding-scoped portable settings

func (*Client) ShowTextResult added in v0.1.1

func (c *Client) ShowTextResult(ctx context.Context, activation, text string) (RecipeResult, error)

func (*Client) State

func (c *Client) State(ctx context.Context, binding string, state int) error

Send an action state update

func (*Client) Stderr

func (c *Client) Stderr(ctx context.Context) io.Writer

Expose stderr as a host-backed writer

func (*Client) Stdout

func (c *Client) Stdout(ctx context.Context) io.Writer

Expose stdout as a host-backed writer

func (*Client) SubscribeTelemetry

func (c *Client) SubscribeTelemetry(ctx context.Context, topics []string) error

Subscribe to the requested host telemetry topics

func (*Client) SummarizeClipboard added in v0.1.1

func (c *Client) SummarizeClipboard(ctx context.Context, activation string) (RecipeResult, error)

SummarizeClipboard opens the Manager-owned transfer review. Only Manager receives the text.

func (*Client) Supports

func (c *Client) Supports(capability string) bool

Check a capability negotiated for this connection

func (*Client) SupportsThemeRPC

func (c *Client) SupportsThemeRPC() bool

Check whether the host supports theme RPC

func (*Client) Title

func (c *Client) Title(ctx context.Context, binding, text string) error

Send a title update for a binding

func (*Client) ToInspector

func (c *Client) ToInspector(ctx context.Context, binding, action string, value any) error

Send a payload to the matching property inspector

func (*Client) WriteVaultSecret added in v0.1.1

func (c *Client) WriteVaultSecret(ctx context.Context, selection VaultValueRequest, kind, value, expectedRevision string) (VaultWriteReceipt, error)

WriteVaultSecret creates a private slot, or rotates it when given its current revision.

type ClipboardText added in v0.1.1

type ClipboardText struct {
	Text     string `json:"text"`
	Revision string `json:"revision"`
}

func (ClipboardText) Format added in v0.1.1

func (ClipboardText) Format(w fmt.State, _ rune)

type CompletionStatus added in v0.1.1

type CompletionStatus struct {
	State string `json:"state"`
}

type Event

type Event struct {
	Event      string          `json:"event"`
	ID         string          `json:"id,omitempty"`
	Action     string          `json:"action,omitempty"`
	Context    string          `json:"context,omitempty"`
	Device     string          `json:"device,omitempty"`
	UUID       string          `json:"uuid,omitempty"`
	Payload    json.RawMessage `json:"payload,omitempty"`
	Surface    *Surface        `json:"streamDockManager,omitempty"`
	DeviceInfo json.RawMessage `json:"deviceInfo,omitempty"`
	Raw        json.RawMessage `json:"-"`
	ProtocolID string          `json:"protocol_id,omitempty"`
	RequestID  string          `json:"request_id,omitempty"`
	Method     string          `json:"method,omitempty"`
	Result     json.RawMessage `json:"result,omitempty"`
	Error      *RPCError       `json:"error,omitempty"`
	// contains filtered or unexported fields
}

func Message

func Message(event, context string, payload any) Event

Construct a host event from a serializable payload

func (Event) Data

func (e Event) Data() Payload

Decode the typed payload fields of an event

func (Event) PermissionNotice added in v0.1.1

func (e Event) PermissionNotice() (PermissionNotice, bool)

func (*Event) UnmarshalJSON

func (e *Event) UnmarshalJSON(data []byte) error

UnmarshalJSON retains the complete event for forward-compatible extensions

type Handler

type Handler interface {
	Handle(context.Context, *Client, Event) error
	Poll(context.Context, *Client) error
	Close() error
}

type HostInfo

type HostInfo struct {
	Raw     map[string]json.RawMessage
	Manager struct {
		Version         string   `json:"version"`
		ContractVersion int      `json:"contract_version"`
		Capabilities    []string `json:"capabilities"`
		RunID           string   `json:"run_id"`
		DebugNetwork    bool     `json:"debug_network"`
	} `json:"streamDockManager"`
}

HostInfo retains the host's raw fields so newer metadata remains available

func ParseHostInfo

func ParseHostInfo(data []byte) (HostInfo, error)

Decode and validate the host registration metadata

func (HostInfo) Supports

func (h HostInfo) Supports(capability string) bool

Check the capabilities advertised by this host

type HostStore

type HostStore struct {
	// contains filtered or unexported fields
}

func NewHostStore

func NewHostStore(client *Client, namespace string) (*HostStore, error)

Create a namespace-scoped negotiated host store

func (*HostStore) Commit

func (s *HostStore) Commit(ctx context.Context, version StorageVersion, operation string, mutations []StorageMutation) (StorageReceipt, error)

Commit validated mutations against an expected storage version

func (*HostStore) Get

func (s *HostStore) Get(ctx context.Context, key string) (StorageValue, error)

Read a value and version from private host storage

func (*HostStore) ListKeys

func (s *HostStore) ListKeys(ctx context.Context, cursor string) (StorageKeys, error)

List a bounded page of namespace keys

func (*HostStore) Receipt

func (s *HostStore) Receipt(ctx context.Context, generation, operation string) (StorageReceipt, error)

Retrieve the receipt for a possibly completed operation

type LogStream

type LogStream string
const (
	Stdout LogStream = "stdout"
	Stderr LogStream = "stderr"
)

type Measurement

type Measurement struct {
	Value      *float64 `json:"value"`
	ObservedAt uint64   `json:"observed_at"`
	MaxAgeMS   uint64   `json:"max_age_ms"`
	Error      *string  `json:"error"`
}

func (Measurement) Fresh

func (m Measurement) Fresh(now time.Time) bool

Check whether a measurement remains fresh at the supplied time

type NotificationLevel added in v0.1.1

type NotificationLevel string
const (
	NotificationInfo    NotificationLevel = "info"
	NotificationSuccess NotificationLevel = "success"
	NotificationWarning NotificationLevel = "warning"
	NotificationError   NotificationLevel = "error"
)

type OpenActionDeviceInfo

type OpenActionDeviceInfo struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Rows        uint8  `json:"rows"`
	Columns     uint8  `json:"columns"`
	Encoders    uint8  `json:"encoders"`
	Touchpoints uint8  `json:"touchpoints"`
	Infobars    uint8  `json:"infobars"`
	Type        uint8  `json:"type"`
}

type OpenActionDeviceOutput

type OpenActionDeviceOutput struct {
	Event      string  `json:"event"`
	Device     string  `json:"device"`
	Controller *string `json:"controller"`
	Position   *uint8  `json:"position"`
	Image      *string `json:"image"`
	Brightness *uint8  `json:"brightness"`
}

OpenActionDeviceOutput is a provider command, not an action-plugin setImage A setImage with nil Controller/Position/Image requests clearing the screen Image is opaque; callers must validate/decode it before hardware use

type OpenActionDeviceProvider

type OpenActionDeviceProvider struct {
	// contains filtered or unexported fields
}

OpenActionDeviceProvider builds OpenDeck-specific wire envelopes. It neither grants a namespace nor sends messages or accesses hardware. Declare the same two-character DeviceNamespace in the manifest and use only on an opted-in host Wire reference: nekename/OpenDeck commit 3ddecc1ce8952a423916cf066724356267b97410

func NewOpenActionDeviceProvider

func NewOpenActionDeviceProvider(namespace string) (*OpenActionDeviceProvider, error)

Create a device provider with a validated namespace

func (*OpenActionDeviceProvider) Deregister

func (p *OpenActionDeviceProvider) Deregister(device string) (map[string]any, error)

Build a device removal envelope

func (*OpenActionDeviceProvider) DeviceEvent

func (p *OpenActionDeviceProvider) DeviceEvent(event, device string) (map[string]any, error)

Build a namespace-checked device lifecycle envelope

func (*OpenActionDeviceProvider) EncoderChange

func (p *OpenActionDeviceProvider) EncoderChange(device string, position uint8, ticks int16) (map[string]any, error)

Build an encoder rotation envelope

func (*OpenActionDeviceProvider) EncoderDown

func (p *OpenActionDeviceProvider) EncoderDown(device string, position uint8) (map[string]any, error)

Build an encoder-down event for the selected position

func (*OpenActionDeviceProvider) EncoderUp

func (p *OpenActionDeviceProvider) EncoderUp(device string, position uint8) (map[string]any, error)

Build an encoder-up event for the selected position

func (*OpenActionDeviceProvider) KeyDown

func (p *OpenActionDeviceProvider) KeyDown(device string, position uint8) (map[string]any, error)

Build a key-down event for the selected position

func (*OpenActionDeviceProvider) KeyUp

func (p *OpenActionDeviceProvider) KeyUp(device string, position uint8) (map[string]any, error)

Build a key-up event for the selected position

func (*OpenActionDeviceProvider) ParseOutput

func (p *OpenActionDeviceProvider) ParseOutput(data []byte) (OpenActionDeviceOutput, error)

Decode bounded host output addressed to this provider

func (*OpenActionDeviceProvider) Press

func (p *OpenActionDeviceProvider) Press(event, device string, position uint8) (map[string]any, error)

Build a key or encoder press envelope

func (*OpenActionDeviceProvider) Register

Build a provider registration envelope

func (*OpenActionDeviceProvider) RerenderImages

func (p *OpenActionDeviceProvider) RerenderImages(device string) (map[string]any, error)

Request the host to resend device images

func (*OpenActionDeviceProvider) TouchscreenPress

func (p *OpenActionDeviceProvider) TouchscreenPress(device string, position uint8, x, y uint16, hold bool) (map[string]any, error)

Build a touchscreen press envelope

type Payload

type Payload struct {
	Settings    map[string]any  `json:"settings"`
	Ticks       int             `json:"ticks"`
	Hold        bool            `json:"hold"`
	Pressed     bool            `json:"pressed"`
	Controller  string          `json:"controller"`
	State       int             `json:"state"`
	Coordinates json.RawMessage `json:"coordinates"`
}

type PermissionDeclaration added in v0.1.1

type PermissionDeclaration struct {
	Version int                          `json:"version"`
	Actions map[string]ActionPermissions `json:"actions"`
}

PermissionDeclaration describes requests. Only Manager can grant them.

type PermissionList added in v0.1.1

type PermissionList struct {
	Revision string                   `json:"revision"`
	Scopes   []ActionPermissionStatus `json:"scopes"`
}

type PermissionNotice added in v0.1.1

type PermissionNotice struct {
	Event        string              `json:"event"`
	RequestID    string              `json:"request_id,omitempty"`
	ReviewID     string              `json:"review_id,omitempty"`
	Outcome      string              `json:"outcome,omitempty"`
	Revision     string              `json:"revision,omitempty"`
	Action       string              `json:"action,omitempty"`
	Scopes       []map[string]string `json:"scopes,omitempty"`
	Entry        *VaultEntryName     `json:"entry,omitempty"`
	ResultHandle string              `json:"result_handle,omitempty"`
}

PermissionNotice contains only the fields published by Manager for this terminal or change event.

type PermissionReview added in v0.1.1

type PermissionReview struct {
	ReviewID string `json:"review_id"`
	Revision string `json:"revision"`
	State    string `json:"state"`
}

type PermissionStatus added in v0.1.1

type PermissionStatus struct {
	Granted   bool   `json:"granted"`
	Available bool   `json:"available"`
	Revision  string `json:"revision"`
}

type PluginTheme

type PluginTheme struct {
	Version  int         `json:"version"`
	Resolved string      `json:"resolved"`
	Revision uint64      `json:"revision"`
	Theme    ThemeColors `json:"theme"`
}

type PortableSettings

type PortableSettings struct {
	// contains filtered or unexported fields
}

PortableSettings uses the same action/global object on every host. Its base writes report only "sent"; reads report observed state, never a commit receipt

func NewPortableSettings

func NewPortableSettings(client *Client, scope, address string) (*PortableSettings, error)

Create a portable settings accessor for an explicit scope

func (*PortableSettings) Read

Read portable settings through the selected host contract

func (*PortableSettings) Replace

func (s *PortableSettings) Replace(ctx context.Context, value map[string]any) (SettingsResult, error)

Replace portable settings with a cloned object

func (*PortableSettings) Update

func (s *PortableSettings) Update(ctx context.Context, changes map[string]any) (SettingsResult, error)

Update serializes read/merge/write within this facade only, not across other plugin/inspector writers. Explicit null remains a value, not a deletion marker

type ProbePool

type ProbePool struct {
	// contains filtered or unexported fields
}

func NewProbePool

func NewProbePool() *ProbePool

Workers and their queue are allocated only when the first probe is submitted

func (*ProbePool) Close

func (p *ProbePool) Close()

Stop accepting probes and signal worker shutdown

func (*ProbePool) Submit

func (p *ProbePool) Submit(ctx context.Context, job func()) bool

Submit background work without exceeding pool capacity

type RPCError

type RPCError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

RPCError never includes the request's settings or private values

func (*RPCError) Error

func (e *RPCError) Error() string

Format the host RPC error code and message

type RecipeResult added in v0.1.1

type RecipeResult struct {
	ResultHandle string `json:"result_handle"`
	State        string `json:"state"`
}

type Scheduler

type Scheduler interface {
	NextPoll(time.Time) time.Time
	Wake() <-chan struct{}
}

Scheduler explicitly enables timed polling. Handlers without Scheduler never poll A zero deadline suspends idle polling until an event or wake Methods run on the handler event loop and must not block

type SettingsResult

type SettingsResult struct {
	Settings  map[string]any `json:"settings,omitempty"`
	Backend   string         `json:"backend"`
	Assurance string         `json:"assurance"`
}

type StorageKeys

type StorageKeys struct {
	StorageVersion
	Keys   []string `json:"keys"`
	Cursor string   `json:"cursor,omitempty"`
}

type StorageMutation

type StorageMutation struct {
	Op, Key string
	Value   any
}

type StorageReceipt

type StorageReceipt struct {
	StorageVersion
	OperationID string `json:"operation_id"`
	Committed   bool   `json:"committed"`
	Found       bool   `json:"found,omitempty"`
}

type StorageValue

type StorageValue struct {
	StorageVersion
	Found bool            `json:"found"`
	Value json.RawMessage `json:"value,omitempty"`
}

type StorageVersion

type StorageVersion struct {
	Generation string `json:"generation"`
	Revision   string `json:"revision"`
}

type Surface

type Surface struct {
	ActivationToken string `json:"activation_token,omitempty"`
	RequestID       string `json:"request_id,omitempty"`
	ControlID       string `json:"control_id"`
	Width           int    `json:"width"`
	Height          int    `json:"height"`
	FeedbackTarget  string `json:"feedback_target"`
	Touch           *struct {
		X     int    `json:"x"`
		Y     int    `json:"y"`
		Phase string `json:"phase"`
	} `json:"touch,omitempty"`
}

type TelemetrySnapshot

type TelemetrySnapshot struct {
	AudioObserver bool                   `json:"audio_observer"`
	CPU           Measurement            `json:"cpu"`
	Memory        Measurement            `json:"memory"`
	Network       Measurement            `json:"network"`
	Disks         map[string]Measurement `json:"disks"`
	AudioVolume   Measurement            `json:"audio_volume"`
	AudioMuted    Measurement            `json:"audio_muted"`
}

func (*TelemetrySnapshot) UnmarshalJSON

func (s *TelemetrySnapshot) UnmarshalJSON(data []byte) error

Decode a validated telemetry snapshot

type ThemeColors

type ThemeColors struct {
	Surface   string         `json:"surface"`
	Ink       string         `json:"ink"`
	Muted     string         `json:"muted"`
	Accent    string         `json:"accent"`
	Meter     string         `json:"meter"`
	Border    string         `json:"border"`
	Wallpaper ThemeWallpaper `json:"wallpaper"`
}

type ThemeMedia

type ThemeMedia struct {
	Kind     string `json:"kind"`
	AssetID  string `json:"asset_id"`
	Format   string `json:"format"`
	Animated bool   `json:"animated"`
}

type ThemeWallpaper

type ThemeWallpaper struct {
	SVG   string
	Media *ThemeMedia
}

func (*ThemeWallpaper) UnmarshalJSON

func (w *ThemeWallpaper) UnmarshalJSON(data []byte) error

Decode a bounded wallpaper description

type ThemedAsset

type ThemedAsset struct {
	Light string `json:"light"`
	Dark  string `json:"dark"`
}

type UnsupportedFeatureError

type UnsupportedFeatureError struct{ Feature string }

func (*UnsupportedFeatureError) Error

func (e *UnsupportedFeatureError) Error() string

Describe the unsupported host feature

type VaultEntryName added in v0.1.1

type VaultEntryName struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type VaultEntryPage added in v0.1.1

type VaultEntryPage struct {
	Entries []VaultEntryName `json:"entries"`
	Next    *int             `json:"next"`
}

type VaultLocation added in v0.1.1

type VaultLocation struct {
	Latitude, Longitude float64
	Revision            string
}

VaultLocation contains the saved coordinates approved for a single action.

func (VaultLocation) Format added in v0.1.1

func (VaultLocation) Format(w fmt.State, _ rune)

func (VaultLocation) MarshalJSON added in v0.1.1

func (VaultLocation) MarshalJSON() ([]byte, error)

type VaultSecret added in v0.1.1

type VaultSecret struct {
	Revision  string
	EntryKind string
	// contains filtered or unexported fields
}

VaultSecret keeps a directly shared credential out of default display and serialization.

func (VaultSecret) Format added in v0.1.1

func (VaultSecret) Format(w fmt.State, _ rune)

func (VaultSecret) MarshalJSON added in v0.1.1

func (VaultSecret) MarshalJSON() ([]byte, error)

func (VaultSecret) Reveal added in v0.1.1

func (s VaultSecret) Reveal() string

Reveal explicitly extracts plaintext. Avoid logging, persistence and replay.

type VaultText added in v0.1.1

type VaultText struct {
	Value    string
	Revision string
}

VaultText contains a nonsecret text slot value (which may still be private).

func (VaultText) Format added in v0.1.1

func (VaultText) Format(w fmt.State, _ rune)

func (VaultText) MarshalJSON added in v0.1.1

func (VaultText) MarshalJSON() ([]byte, error)

type VaultValueRequest added in v0.1.1

type VaultValueRequest struct {
	Slot   string `json:"slot"`
	Field  string `json:"field"`
	Action string `json:"action"`
}

VaultValueRequest selects a reviewed logical setup slot; it grants no authority.

type VaultWriteReceipt added in v0.1.1

type VaultWriteReceipt struct {
	EntryRef string `json:"entry_ref"`
	Revision string `json:"revision"`
}

Directories

Path Synopsis
Package authoring owns the shared plugin lifecycle; it imports no feature implementation
Package authoring owns the shared plugin lifecycle; it imports no feature implementation
Package cache provides owner-serialized caches with deterministic LRU eviction Values are caller-owned immutable snapshots.
Package cache provides owner-serialized caches with deterministic LRU eviction Values are caller-owned immutable snapshots.
Package connectedws supplies the bounded, tracked transport for external service connections.
Package connectedws supplies the bounded, tracked transport for external service connections.
Package connectors adapts independent integrations to the SDK lifecycle It contains no feature imports, so executables retain dependency isolation
Package connectors adapts independent integrations to the SDK lifecycle It contains no feature imports, so executables retain dependency isolation
Package discovery coordinates read-only inspector work on an owner event loop Start uses a bounded executor supplied by the caller; Complete and Expire run on the loop.
Package discovery coordinates read-only inspector work on an owner event loop Start uses a bounded executor supplied by the caller; Complete and Expire run on the loop.
Package displaybench measures the real engine/SDK display path on loopback It deliberately imports no official plugin or operating-system action adapter
Package displaybench measures the real engine/SDK display path on loopback It deliberately imports no official plugin or operating-system action adapter
examples
advanced command
SPDX-License-Identifier: MIT
SPDX-License-Identifier: MIT
benchmark command
A bounded in-process authoring workload, separate from loopback/hardware measurements
A bounded in-process authoring workload, separate from loopback/hardware measurements
Package httptrack optionally tracks transferred HTTP payload for SDK reporting
Package httptrack optionally tracks transferred HTTP payload for SDK reporting
Package inspectors contains the SDK's packaged, local inspector helpers
Package inspectors contains the SDK's packaged, local inspector helpers
internal
benchmarkclock
Package benchmarkclock measures benchmark intervals without changing runtime timers or the system timer resolution
Package benchmarkclock measures benchmark intervals without changing runtime timers or the system timer resolution
netdebug
Package netdebug connects optional transport diagnostics to the SDK log queue without adding HTTP dependencies to plugins that do not use HTTP
Package netdebug connects optional transport diagnostics to the SDK log queue without adding HTTP dependencies to plugins that do not use HTTP
payload
Package payload shares process-local payload accounting without importing HTTP
Package payload shares process-local payload accounting without importing HTTP
statefile
Package statefile bounds state reads before JSON decoding, including files that grow after they are opened.
Package statefile bounds state reads before JSON decoding, including files that grow after they are opened.
Package managedstate persists JSON records through an explicitly selected SDK backend.
Package managedstate persists JSON records through an explicitly selected SDK backend.
Package operations tracks external outcomes without executing or retrying work Serialize calls on the owner loop or with a caller-held mutex.
Package operations tracks external outcomes without executing or retrying work Serialize calls on the owner loop or with a caller-held mutex.
Package packaging audits runtime dependencies and local resource closure
Package packaging audits runtime dependencies and local resource closure
Package requests shares in-flight JSON reads without coupling consumer cancellation It never retries a write.
Package requests shares in-flight JSON reads without coupling consumer cancellation It never retries a write.
Package settings validates declarative inspector fields without losing extensions
Package settings validates declarative inspector fields without losing extensions
Package storage persists plugin-owned state.
Package storage persists plugin-owned state.
Package testkit runs real SDK handlers without sockets or a Manager checkout
Package testkit runs real SDK handlers without sockets or a Manager checkout
peers
Package testutil provides disposable protocol peers; it never connects to a user's accounts, local services or VPN tools
Package testutil provides disposable protocol peers; it never connects to a user's accounts, local services or VPN tools
Package thumbnail provides bounded standard-library image decoding and sampling
Package thumbnail provides bounded standard-library image decoding and sampling

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL