plugin-sdk
The SDK for creating plugins in Omniview, the Integrated DevOps Environment
Plugin author documentation
Start with the plugin author guides, or
run the read-only plugin quickstart.
Use the resource API reference for signatures and contracts,
and the migration guide when moving from resource v1.
Internal Logging
Use log for plugin runtime/internal logging. This is separate from the log capability API in pkg/v1/logs.
See docs/internal-logging.md.
Log capability readers
pkg/v1/logs treats clean reader EOF as source completion, including follow
requests. Completed sources do not reopen or replay their history. Genuine
reader-open failures and read errors, including unexpected EOF, retain bounded
reconnection. Cancellation closes readers and ends their session normally.
Handlers must return a streaming reader promptly; do not buffer follow responses
until EOF before returning the reader.
Settings validation
Register settings.Setting.Validator with a
func(interface{}) settings.ValidationResult to return contextual validation
feedback. Set Valid for accepted values and provide a stable Code plus a
user-safe Message. Validators may read provider state, but must not mutate
provider values, definitions, or handlers. Bound any external work.
This is a breaking source migration: replace error-returning Validator callbacks
with callbacks returning settings.ValidationResult, then rebuild plugins.
There is only one callback; no legacy callback adapter is provided.
Setting.Validation and Provider.ValidateSetting check drafts without saving.
Writes validate again and reject invalid values; bulk writes validate all values
before changing any. Sensitive settings always return generic feedback.
Invalid structured results with an empty message receive generic user-safe feedback;
nonempty contextual messages remain unchanged. Setting.Validate enforces writes
by calling the same Setting.Validation evaluation and returning rejection messages
as errors.
Provider.CommitSettings(ctx, values, persist) normalizes and validates each proposed
value exactly once, then passes only the normalized changed values to persist.
The callback receives scoped setting IDs and detached values. Persistence runs
before publication; returning an error leaves all values unchanged and sends no
notifications. After persistence succeeds, the provider publishes the prepared
values without validating again. A nil callback performs an in-memory commit.
Root SetSetting and SetSettings use this same transaction path.
Validators and persistence callbacks may read the previously published provider
state. They must not call provider mutation methods or wait for another mutation:
transactions serialize value and definition writes. Change notifications run
after publication, outside transaction serialization, and may read or mutate the
provider, including starting another commit.
Waiting transactions honor context cancellation before validation or persistence.
Once persistence succeeds, the provider publishes even if cancellation follows:
durable success must not become a rejected commit. Root setters use
context.Background(). The v1 client caps commits at 30 seconds while honoring
earlier caller deadlines.
settings.CommitResult reports Committed, Applied, and Uncertain. The plugin
RPC uses a bidirectional commit stream: the plugin prepares values, the host
persists and acknowledges them, and the plugin publishes. If host persistence
succeeds but the final RPC response is lost, the client returns durable success
with Committed: true, Applied: false, and Uncertain: true; do not retry as
though persistence failed. Rebuild both host and plugins for this breaking RPC
cutover; the old RPC write endpoints are removed.
Setting.RequiresRestart is definition metadata. Setting.PendingRestart is a
host snapshot projection, not provider-owned restart state. settings.CloneValue
detaches supported JSON values and typed setting slices; it is not an arbitrary
Go object copier. Provider.GetCategoryValues returns detached category values
for trusted internal consumers, including sensitive values; do not expose that
accessor as an authorized public snapshot.
Draft validation and commits share schema-driven normalization before the custom
validator runs. JSON arrays become native []string, []int, or []float64
according to the definition. Booleans accept only booleans. Integers reject
fractional and out-of-range numbers; floats reject NaN and infinity. Validators
receive canonical values for both drafts and writes.
The settings capability exposes draft validation through gRPC using a dedicated
ValidateSettingRequest, executing callbacks inside the plugin rather than on
serialized host copies. Rebuild plugins and the
host against the updated SDK to use this RPC. Older plugin processes report an
unsupported RPC instead of approving unvalidated drafts.
Application state and workspace isolation
The SDK resolves all owned plugin configuration and capability stores through
pkg/state.ResolveRoot. The host must pass its
resolved absolute root as OMNIVIEW_STATE_DIR, including when the host selected
that root programmatically. A non-workspace process without this variable retains
the production default ~/.omniview; nightly hosts must explicitly pass their
nightly root. The SDK never changes HOME.
When OMNIVIEW_WORKSPACE_FILE is nonempty, it must be an absolute readable v1
workspace manifest with a canonical nonzero workspaceID UUID and
profile.kind: development. The SDK reads identity/path-boundary metadata,
leaving full manifest validation and mutation to the host.
OMNIVIEW_STATE_DIR is mandatory and must agree with the selected profile.
Without a machine-local binding, the default remains the exact literal
<canonical-shared-profiles>/<workspaceID>/state; UUID-specific profile/state
symlink remaps are rejected, while HOME/shared profiles-container aliases are
canonicalized.
A host-bound custom root is accepted only when all three v1 machine-local
records match: <workspace>/.local/profile.json,
<custom-parent>/.omniview-profile.json, and a claim in
<HOME>/.omniview-dev/custom-profiles.json. Identity records contain
schemaVersion, workspaceID, and canonical absolute stateRoot; the claims
registry contains schemaVersion and claims. State must be the literal state
child of its dedicated canonical parent. Missing/foreign/malformed or redirected
records, duplicate/nested claims, environment disagreement, and overlap with
production/nightly/default profiles or workspace/registered source storage fail
closed. Absent binding permits only the default, never an unclaimed custom
override. The SDK reads these records but never creates claims, binds/rebinds a
profile, or initializes state during resolution. The host keeps runtime storage
in the default private UUID namespace independently of custom application state.
A moved workspace may retain a durable interrupted sibling-rename journal before
the host rewrites its root. The SDK accepts only the exact recorded rename phase
and current target, clean absolute sibling old root, matching v1 UUID/development
identity, and valid target slug. The old root remains a protected source boundary.
Unrelated root mismatches remain errors; the host still performs full manifest
validation and owns rename recovery.
The native-independent pkg/profilecontract package owns these v1 binding,
claim, and ownership-journal schemas and shared read-only identity validation.
Both host and SDK consume that contract directly; only the host validates the
complete portable manifest and publishes or repairs ownership metadata. Metadata
decode failures use fixed diagnostics without including private JSON values.
Plugin IDs and capability filenames must be single nonempty ASCII
letter/digit/dot/underscore/hyphen components, not ./.., trailing-dot names,
or Windows reserved device names. SDK file operations use os.Root handles and
reject symlink aliases in owned plugin/store paths. Returned path
strings such as GetPluginStorePath are advisory: external consumers must not
replace handle-based SDK operations with unchecked path-based access.
Development plugins use the same go-plugin handshake/lifecycle RPC transport as
other plugins. The host owns process supervision, readiness, rebuilds, and
shutdown through its managed lifecycle/control client. The SDK does not inspect
OMNIVIEW_DEV, intercept stdout, write .devinfo, or clean up old discovery
records. The removed standalone runner/discovery APIs have no compatibility shim.
Legacy .devinfo* files remain excluded from baseline exports and are not proof
of attachment/readiness or permission to start an imported executable.
Plugin process profiling
sdk.Plugin.Serve() starts an optional local pprof listener when the host explicitly supplies OMNIVIEW_PLUGIN_PPROF_ENABLED=true. The default, missing, and other values leave it disabled. Each enabled process binds an automatically allocated IPv4 loopback port and closes its listener when serving ends. Plugin authors do not register a profiling capability or add startup code; existing binaries must be rebuilt with the profiling-capable SDK.
The lifecycle service exposes GetProfilingStatus with the process PID, actual listener URL, running state, and any listener error. A listener failure does not stop plugin startup. The host uses this RPC to display process endpoints; it does not infer runtime state from saved preferences.
The shared pkg/profiling package also serves host pprof. Requests require the exact numeric loopback Host and no Origin header. CPU and trace captures accept GET only and cap explicit durations at 120 and 15 seconds. Captures are unauthenticated and may contain sensitive data: never publish or forward these ports. Continuous Pyroscope and pprof cannot own the same process's CPU profiler simultaneously; coordination remains manual.
When the host sets OMNIVIEW_TELEMETRY_CLIENT_ID, the SDK adds the value to
plugin traces as omniview.client.id and Pyroscope profiles as
omniview_client_id. An empty value adds neither attribute. Existing plugin
binaries must be rebuilt with this SDK to label their Pyroscope profiles.
Resource v2 streaming actions create finite client and provider spans. They propagate
W3C trace context across the action stream even when gRPC stream instrumentation is
filtered out. Spans identify the action, plugin, connection, resource type and
resource ID, and report readiness stage, outcome and reviewed error classification.
They do not record action inputs, event payloads or provider error messages. Resource
identifiers are operational metadata and should be handled under the deployment's
trace retention and access policy.
Pre-launch artifact compatibility
config.PluginMeta.StateIsolation is optional, additive YAML/JSON metadata under
state_isolation. Missing metadata means isolation support is unverified.
Its v1 fields are schema_version: 1, capability: state-root-v1,
sdk_module: github.com/omniviewdev/plugin-sdk, a fully resolved lowercase
sdk_revision checkout commit hash observed by the builder, binary_sha256,
and optional sdk_source_sha256 identifying the exact selected SDK source snapshot.
A trusted host-owned builder calls
config.BuildStateIsolationProvenance(binaryPath, sdkRevision, sdkSourceSHA256)
after validating the selected SDK module/path and actual build inputs. It
records the selected checkout's resolved commit. For live editable SDK
worktrees, it computes a stable lowercase SHA-256 source snapshot before and
after the build and rejects a changing snapshot. Dirty edits are supported
without requiring a commit per edit; the source digest identifies the exact
editable build. The SDK does not define a second source-tree hashing algorithm:
the trusted host builder owns that snapshot contract.
The host stores the attestation and independent expected source digest in its
owned artifact/install record, or accepts independently authenticated registry
provenance. Before launch, it calls
provenance.VerifyArtifact(binaryPath, expectedSDKRevision, expectedSDKSourceSHA256)
to check capability, schema, module, expected SDK checkout commit, source snapshot,
and exact artifact bytes without executing the plugin. A supplied snapshot must
be lowercase 64-hex and match the trusted expectation exactly. Empty source
digests are permitted only when both expectation and attestation are empty for a
trusted immutable clean-commit build; a source-bound record cannot downgrade to
commit-only verification. Trusted expectations never come from arbitrary artifact
self-assertions. Protect verified artifact bytes from replacement before execution.
These helpers hash and compare attestations; they do not prove source inclusion
or authenticate metadata. Arbitrary plugin.yaml claims are not sufficient
authorization. No lifecycle RPC, protobuf, or protocol-version change is needed:
starting an unknown binary to query isolation support is already unsafe.
Existing marketplace executables are not retroactively fixed. Baseline-imported
binaries remain inactive until rebuilt with the fixed SDK or verified through an
appropriate trusted artifact pipeline.
Application-state isolation is not a process, credential, or remote-resource
sandbox. Plugin-authored filesystem operations, user-selected exports, external
tool caches, and cluster/account mutations require their own policies.
Plugin settings sensitivity transport
The v1 settings protobuf carries optional bool sensitive with field presence.
Current SDK schema conversion explicitly transmits either public (false) or
sensitive (true) classification; Password settings are always classified
sensitive, even if a sender supplies false. Settings received without this
field are legacy/unclassified and decode conservatively as Sensitive: true.
Re-encoding such a setting cannot upgrade it to public. Rebuild legacy plugins
with the corrected SDK before expecting nonsecret settings to remain visible in
secret-safe inspection; absent metadata is not evidence that a value is public.
Conversion preserves setting values/defaults, options, and file-selection
metadata for trusted runtime consumers. The inspecting host must use sensitivity
classification to redact every value-bearing field, including defaults, options,
and file-selection defaults, rather than exposing the raw RPC schema. Malformed
value/default/option payloads fail closed as sensitive metadata. This transport
fix does not change the provider's runtime accessors or itself authorize access
to secret settings.
Resource v2 boundary
SDK v0.20.0 targets the coordinated resource-v2 cutover described below.
Providers use handwritten pkg/resource/v2 values and
sdk.RegisterResourcePlugin(plugin, provider). Only catalog observation is required;
finite operations, lifecycle, ancillary traits and source sessions are optional.
Catalog declarations qualify each operation independently, including create,
mutation update and delete. OperationSourceUpdates never authorizes writes.
Start with the plugin author guides for a runnable quickstart,
resource recipes, connection management, and capability registration.
Use the API reference for lookup and the
advanced contracts for host integration details.
The Go package overview links those concepts to the
compiling public examples: catalog-only,
get-only, controller lifecycle and custom-provider generation issuance.
Resource RPC wire 3 separates support/body formats from optional targeted schemas.
Representation is only {ID, Revision}; SchemaResolver resolves one selected target.
CatalogRequest.Refresh requests discovery explicitly; ordinary observation performs no schema acquisition.
Rebuild supported cohorts together; old schema-bearing shapes are rejected, not decoded as new shapes.
Resource-aware utilities retain their independent wire 2.
Read the code review and
specification comparison before freezing or
claiming approval. Connection routes and catalog pins are not permission grants;
the host owns authority and public error policy. Generated messages and binary
framing are transport details, not provider construction APIs.
Providers must rebuild for the resource v2 contract. Existing nonresource utility
engines remain; resource-bearing operations use canonical values and strict
versioned admission without legacy-method fallback. Resource RPC wire version is
3; host callback broker negotiation is 2. Resource-aware utility lanes remain
independently 2, and the shared go-plugin transport remains 1. Local
replacements alone are not a consumable release receipt.
buf.gen.yaml pins protoc-gen-go v1.36.11 and protoc-gen-go-grpc v1.3.0.
Use make proto for regeneration; remote Buf generators require no ambient
native protoc binary.
Raw JSON validation walks tokens without retaining a generic document tree.
Domain-object admission retains root presence information without child trees.
Native JSON conversion keeps its existing sized map/list conversion path to
avoid wide-container allocation regressions. Structural admission still precedes
numeric conversion; strict Unicode, duplicate keys, exact numbers, and independent
resource limits remain enforced.
Protobuf map decoding reuses destination storage for duplicate detection without
changing entry-error precedence or mutable ownership. Generic metadata traversal
uses immutable field plans for fixed SDK types; arbitrary caller-defined types
retain uncached admission, so dynamic types cannot grow a global plan cache.
Metadata map[string]string admission iterates typed entries without reflective
key/value copies, while retaining the same node, field, depth, and byte budgets.
Profile host and plugin processes separately when evaluating these paths.
Allocation savings from catalog batching and JSON validation overlap; do not add
inclusive profile percentages or infer application-wide gains from microprobes.
Settings value reads
The v1 RPC client's GetSettingValue returns the decoded setting value, not a
protobuf Any envelope. It uses the existing JSON-backed settings codec:
numbers decode as float64, objects as map[string]any, arrays as []any, and
JSON null as nil. Malformed or unsupported wire payloads return decoding errors;
RPC status errors propagate unchanged.
Activity transport budgets
Activity reporter requests allow 256 KiB of JSON. Responses allow 1 MiB so that
persisted source data, later presentation updates, and host-owned record metadata
do not compete for the request budget. All reporter operations use these bounds.
Activity presentations additionally allow at most 128 KiB of encoded JSON,
including JSON/HTML escaping, alongside their existing field limits. Shared
validation rejects oversized presentations before reporter calls or stream sends;
stream receivers enforce the same encoded limit.
Releasing the Go module
The module is github.com/omniviewdev/plugin-sdk at the repository root.
Publish a new, previously unused root tag of the form v0.MINOR.PATCH on the
reviewed commit after it has merged into main. The module has no source-code
release-version constant, nested module, or publishing workflow; a pushed Git tag
is the Go module release. A GitHub release can accompany that tag but is not
required for Go module resolution. Never move or reuse an existing release tag:
Go proxies and the checksum database treat published versions as immutable.
Before tagging, run the SDK tests with GOWORK=off GOFLAGS= go test ./... -count=1
and finish the coordinated host/plugin compatibility checks. After pushing the
tag, confirm the version's .info and .mod endpoints at
https://proxy.golang.org/github.com/omniviewdev/plugin-sdk/@v/, then resolve it
with GOWORK=off GOFLAGS= GOPROXY=https://proxy.golang.org GOSUMDB=sum.golang.org go mod download -json github.com/omniviewdev/plugin-sdk@<release-tag>.
Consumers must pin the new version, update go.sum, and pass their own checks
without a local SDK replacement before their releases are published.
v0.20.0 coordinated resource release
The v0.20.0 tag targets Omniview v0.36.0 and rebuilt resource plugins,
including Kubernetes v0.21.0. Resource wire 3 and host callback broker 2
are a breaking cohort; utility wire 2 and process protocol 1 are unchanged.
Migrate schema-bearing representations and bulk editor-schema lists to
Representation{ID, Revision} and targeted SchemaResolver requests. Catalog
refresh is explicit; optional schemas do not own support revisions or source
lifetimes. Ongoing source fences retain the selected operational contract and
the originally admitted native binding epoch.
Keep current streaming-action descriptor resolution and action, lifecycle,
source, admission, and stream telemetry when rebuilding. Repeat matched
allocation and end-to-end measurements on the integrated cohort; historical
profile receipts do not verify this release.
Preserve the root google.golang.org/grpc replacement in every consuming module
until stock gRPC supplies the required scoped receive controls. The existing
v0.14.4 retraction remains in force. Publication and coordinated acceptance
must complete before this source becomes a release receipt.
The workspace-isolation release is v0.6.0: it removes the standalone .devinfo
APIs and requires rebuilding plugins against this SDK. It must not reuse the
already published v0.5.0, v0.5.1, or v0.5.2 tags. The added exec sequence and optional
settings-sensitivity fields preserve their protobuf field numbers and wire
compatibility. Their generated Go files are committed alongside the schemas;
regenerate them with make proto only when changing those schemas. The module's
release tag is independent of sdk.CurrentProtocolVersion, which remains 1;
these additive fields and the host-owned isolation metadata do not require a
handshake/lifecycle protocol bump.