sdk

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 25 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 native Stream Dock Manager plugins in Go. Users install your compiled ZIP and do not need Go on their machine.

SDK overview · Starter plugins · License

Get started

Requirement Details
Go 1.27.4 or newer compatible with go.mod
Authoring tools Python 3.11+ for packaging
Module github.com/StreamDockManager/Plugin-SDK/Go
Import name sdk

Install Go and Python, then confirm go version and python3 --version. See the shared setup notes for Windows commands and native build tools.

The GitHub repository is named Plugin-SDK. Continue to use the Go module path above for imports and dependency pins.

Build your first plugin

Start with the Go Counter, which selects an exact SDK version. After cloning the SDK, run from its repository root:

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

The packager prints a ZIP path in examples/artifacts/. Install it through Plugins → Import plugin in Manager, enable it, assign its Counter action to a button, and save the binding. One press and release should change Count 0 to Count 1. End users do not install this Go module.

Start a project with your own identity

For your own project, use the SDK generator. Keep a versioned SDK dependency in go.mod; private repositories require authenticated Git access and the SDK module prefix in GOPRIVATE (plus any explicitly configured GONOPROXY/GONOSUMDB patterns).

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 Go/managedstate, Go/requests, Go/connectedws, or Go/thumbnail from the SDK module. authoring.StartObservationJob, authoring.Present, and authoring.CompactDisplay are available without 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 local SDK changes in a plugin, run these commands from the plugin's Go module directory:

go work init . /absolute/path/to/StreamDockManager-Plugins-SDK/Go
go test ./...

If you already have a Go workspace, add this SDK with go work use instead. Keep local workspace files out of commits. Shared behavior must remain consistent with Rust, Python, and Node.js. See the SDK overview.

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 the authenticated Stream Dock Manager/Stream Deck protocol v1

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 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 OpenActionDidReceiveDeepLink = "didReceiveDeepLink"
View Source
const OpenActionShowSettingsInterface = "showSettingsInterface"

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

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 ThemeEvent = "didReceivePluginTheme"
View Source
const ThemeProtocol = "plugin-theme-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 AdditiveDial

type AdditiveDial interface{ BatchDial(action string) bool }

AdditiveDial opts in only actions whose rotation operation is additive

type Capabilities

type Capabilities struct {
	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) 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) GetGlobalSettings

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

Request the current plugin-global settings

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) 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) 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) 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) 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) Send

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

Enqueue a bounded host event after capability checks

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) 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) 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

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) 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 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 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 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 {
	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

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