plugin

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package plugin defines the plugin contract, registry, and projection.

Index

Constants

View Source
const (
	// DefaultClientName is the default client/application identifier a plugin
	// reports to its target when the user configures none.
	DefaultClientName = "shellcn"

	// AgentBinary is the gateway's plugin-agnostic agent binary, referenced by
	// agent-transport install artifacts.
	AgentBinary = "shellcn-agent"

	// AgentImageLatest is the agent's published container image.
	AgentImageLatest = "ghcr.io/charlesng35/" + AgentBinary + ":latest"

	// AgentInternalAddress is the in-tunnel address the gateway dials an enrolled
	// agent's proxy on.
	AgentInternalAddress = AgentBinary + ".internal:443"
)

Gateway-owned identifiers a plugin embeds in its manifest/config. They live in the SDK so an out-of-tree plugin can reference them without reaching into the gateway core.

View Source
const (
	DefaultPageLimit = 50
	MaxPageLimit     = 500
)

Pagination defaults applied when a request omits or over-asks for a limit.

View Source
const (
	SchemaContextTransport = "$transport"
	SchemaContextProtocol  = "$protocol"
)
View Source
const (
	// CredentialRefField is the conventional config key for a credential_ref field.
	CredentialRefField = "credential_id"
)
View Source
const CurrentAPIVersion = 1

CurrentAPIVersion is the plugin contract version this core supports.

View Source
const ProxyPrefixHeader = "X-Shellcn-Proxy-Prefix"

ProxyPrefixHeader carries the connection's public proxy mount on requests the core hands to ServeHTTPProxy.

View Source
const ScopeSeparator = ","

ScopeSeparator joins multiselect scope values in one route param.

Variables

View Source
var (
	ErrInvalidInput  = errors.New("invalid input")
	ErrNotFound      = errors.New("not found")
	ErrUnauthorized  = errors.New("unauthorized")
	ErrForbidden     = errors.New("forbidden")
	ErrConflict      = errors.New("conflict")
	ErrUnavailable   = errors.New("unavailable")
	ErrNotSupported  = errors.New("not supported")
	ErrAlreadyExists = errors.New("already exists")
)

Sentinel errors a handler or the core may return; the server boundary normalizes these to HTTP status codes.

Functions

func AddCredentialKindSupports added in v0.1.4

func AddCredentialKindSupports(catalog *CredentialKindSet, m Manifest)

func CopyTerminalInput added in v0.1.2

func CopyTerminalInput(ch Channel, client ClientStream) error

CopyTerminalInput forwards browser keystrokes from client to ch, handling the terminal panel's in-band control frames: a frame beginning with 0x00 carries JSON ({"type":"resize","cols":N,"rows":N,"theme":"dark"}) and is applied to ch when it implements Resizer instead of being written upstream. Use it as the browser→upstream half of a terminal StreamHandler:

go func() { errc <- plugin.CopyTerminalInput(ch, client) }()

func CredentialKindSupportsProtocol

func CredentialKindSupportsProtocol(kind CredentialKind, protocol string) bool

CredentialKindSupportsProtocol reports whether a built-in credential kind has built-in protocol support. Core built-ins intentionally declare no protocol support. Gateway runtime catalogs derive support from plugin credential_ref selectors.

func FilterRows

func FilterRows[R ~map[string]any](rows []R, term string) []R

FilterRows applies the table's case-insensitive free-text search.

func ParseResizeControl added in v0.1.2

func ParseResizeControl(frame []byte) (cols, rows int, ok bool)

ParseResizeControl decodes a terminal control frame's JSON payload (the bytes after the 0x00 prefix); ok is false for anything that is not a resize.

func RequestProxyPrefix added in v0.1.3

func RequestProxyPrefix(r *http.Request) string

RequestProxyPrefix returns the request's proxy mount (no trailing slash) and strips the header so it is never forwarded upstream.

func SortRows

func SortRows[R ~map[string]any](rows []R, keys []SortKey) []R

SortRows orders rows in place by the first sort key: numeric cells compare numerically, all others case-insensitively as text. It lets a plugin that fetches a whole list honor the grid's column sort with no extra query. No keys → rows unchanged. The sort is stable, so equal cells keep their prior order.

func ValidRecordingPolicy

func ValidRecordingPolicy(p RecordingPolicy) bool

ValidRecordingPolicy reports whether p is a known connection recording policy.

func Validate

func Validate(m Manifest, routes []Route) error

Validate checks a manifest + its routes at registration, returning an aggregate of all actionable problems found (not just the first).

func ValidateWithCredentialKinds

func ValidateWithCredentialKinds(m Manifest, routes []Route, existing CredentialKindCatalog) error

ValidateWithCredentialKinds checks a manifest against an existing credential catalog. Plugin-declared kinds are added to a local copy before credential_ref selectors are validated, so a plugin may use the kinds it declares.

Types

type Action

type Action struct {
	ID          string            `json:"id"`
	Label       string            `json:"label"`
	Icon        Icon              `json:"icon,omitzero"`
	RouteID     string            `json:"routeId"`
	Params      map[string]string `json:"params,omitempty"`
	Body        map[string]any    `json:"body,omitempty"`
	Confirm     bool              `json:"confirm,omitempty"`
	ConfirmText string            `json:"confirmText,omitempty"`
	OnSuccess   *ActionSuccess    `json:"onSuccess,omitempty"`
	// OpenDock/OpenDialog opens a panel in the workspace dock or a modal.
	Open  OpenTarget `json:"open,omitempty"`
	Panel PanelType  `json:"panel,omitempty"`
	// Config is the panel config for dock/dialog-opened panels.
	Config PanelConfig `json:"config,omitempty"`
	// EnabledWhen disables the button unless active-row fields match.
	EnabledWhen *Condition `json:"enabledWhen,omitempty"`
	// VisibleWhen hides the action unless active-row fields match.
	VisibleWhen *Condition `json:"visibleWhen,omitempty"`
	// IconOnly renders the button as its icon alone; Label becomes the tooltip.
	IconOnly bool `json:"iconOnly,omitempty"`
	// Group clusters actions into a labeled dropdown.
	Group string `json:"group,omitempty"`
	// Bulk allows the action to run against multiple selected row targets.
	Bulk bool `json:"bulk,omitempty"`
}

Action is a UI affordance over a route.

func (*Action) UnmarshalJSON

func (a *Action) UnmarshalJSON(data []byte) error

type ActionEffect added in v0.1.10

type ActionEffect struct {
	Type          ActionEffectType     `json:"type"`
	TerminalInput *TerminalInputEffect `json:"terminalInput,omitempty"`
	OpenPanel     *OpenPanelEffect     `json:"openPanel,omitempty"`
}

type ActionEffectType added in v0.1.10

type ActionEffectType string
const (
	ActionEffectTerminalInput ActionEffectType = "terminal_input"
	ActionEffectOpenPanel     ActionEffectType = "open_panel"
)

type ActionSuccess

type ActionSuccess struct {
	SelectTab string `json:"selectTab,omitempty"`
	// Navigate moves the workbench after success.
	Navigate NavigateTarget `json:"navigate,omitempty"`
	Effects  []ActionEffect `json:"effects,omitempty"`
}

type AgentMode

type AgentMode string

AgentMode is what an enrolled agent proxies on the target side.

const (
	AgentTCP         AgentMode = "tcp"
	AgentUnix        AgentMode = "unix"
	AgentHTTP        AgentMode = "http_proxy"
	AgentHostMonitor AgentMode = "host_monitor"
)

type AgentProfile

type AgentProfile struct {
	Proxy   ProxyTarget
	Install []InstallArtifact
}

AgentProfile is required iff a plugin declares TransportAgent.

type ArtifactConnectURL

type ArtifactConnectURL struct {
	LocalhostHost string
}

type ArtifactDelivery

type ArtifactDelivery string

ArtifactDelivery selects how an install artifact reaches the target.

const (
	// DeliveryInline injects the token directly into Template (the default).
	DeliveryInline ArtifactDelivery = ""
	// DeliveryURL serves Content from a single-use signed-ticket URL.
	DeliveryURL ArtifactDelivery = "url"
)

type AuditHook

type AuditHook func(ctx context.Context, result AuditResult, params map[string]string, err error)

AuditHook records a plugin operation that happens inside a long-lived route, such as one query submitted over a WebSocket stream.

type AuditResult

type AuditResult string

AuditResult is the outcome a handler reports for an audited operation that happens inside a long-lived route (e.g. one statement over a WebSocket).

const (
	AuditAllowed AuditResult = "allowed"
	AuditDenied  AuditResult = "denied"
	AuditError   AuditResult = "error"
)

type Badge

type Badge struct {
	Source   *DataSource `json:"source,omitempty"`
	Value    any         `json:"value,omitempty"`
	Severity Severity    `json:"severity,omitempty"`
}

type CanvasConfig added in v0.1.7

type CanvasConfig struct {
	Width     int             `json:"width,omitempty"`
	Height    int             `json:"height,omitempty"`
	ScaleMode CanvasScaleMode `json:"scaleMode,omitempty"`
	// MinScale and MaxScale clamp fit-mode display scaling. They do not change
	// logical coordinates.
	MinScale    float64         `json:"minScale,omitempty"`
	MaxScale    float64         `json:"maxScale,omitempty"`
	HiDPI       bool            `json:"hidpi,omitempty"`
	Interactive bool            `json:"interactive,omitempty"`
	Keyboard    bool            `json:"keyboard,omitempty"`
	Pointer     bool            `json:"pointer,omitempty"`
	WheelMode   CanvasWheelMode `json:"wheelMode,omitempty"`
	// ResizeEvents controls whether ready/resize events are sent with logical
	// size, viewport size, scale, DPR, and theme.
	ResizeEvents   bool   `json:"resizeEvents,omitempty"`
	Background     string `json:"background,omitempty"`
	FocusOnPointer bool   `json:"focusOnPointer,omitempty"`
	AriaLabel      string `json:"ariaLabel,omitempty"`
	Instructions   string `json:"instructions,omitempty"`
}

CanvasConfig declares a plugin-driven 2D canvas surface. The frontend owns the DOM and rendering engine; plugins send typed canvas frames and receive typed input/resize events.

type CanvasScaleMode added in v0.1.7

type CanvasScaleMode string
const (
	// CanvasScaleResize makes the browser report the viewport as the logical
	// drawing surface. Use it when the plugin can redraw responsively.
	CanvasScaleResize CanvasScaleMode = "resize"
	// CanvasScaleFit keeps a fixed logical surface and scales it into the panel,
	// while pointer and wheel coordinates remain in logical units.
	CanvasScaleFit CanvasScaleMode = "fit"
	// CanvasScaleScroll keeps a fixed logical surface at 1:1 CSS pixels and lets
	// the panel scroll. Use it for naturally large surfaces.
	CanvasScaleScroll CanvasScaleMode = "scroll"
)

type CanvasWheelMode added in v0.1.7

type CanvasWheelMode string
const (
	// CanvasWheelAuto captures wheel events for interactive resize/fit canvases
	// and leaves wheel scrolling to the browser for scroll-mode canvases.
	CanvasWheelAuto CanvasWheelMode = "auto"
	// CanvasWheelCapture sends every wheel event to the plugin. Use it only when
	// wheel gestures are part of the canvas interaction model.
	CanvasWheelCapture CanvasWheelMode = "capture"
	// CanvasWheelModified sends wheel events only with Alt, Ctrl, or Meta held,
	// keeping ordinary panel scrolling available.
	CanvasWheelModified CanvasWheelMode = "modified"
	// CanvasWheelNone disables plugin wheel input.
	CanvasWheelNone CanvasWheelMode = "none"
)

type Capability

type Capability string

Capability is a declarative feature tag, not behavior dispatch.

type Category

type Category string
const (
	CategoryShell          Category = "shell"
	CategoryFiles          Category = "files"
	CategoryContainers     Category = "containers"
	CategoryVirtualization Category = "virtualization"
	CategoryRemoteDesktop  Category = "remote_desktop"
	CategoryDatabases      Category = "databases"
	CategoryOrchestration  Category = "orchestration"
	CategoryCloud          Category = "cloud"
	CategoryNetwork        Category = "network"
	CategorySecurity       Category = "security"
	CategoryDevOps         Category = "devops"
	CategoryObservability  Category = "observability"
	CategorySearch         Category = "search"
	CategoryMessaging      Category = "messaging"
	CategoryOther          Category = "other"
)

type CategoryInfo

type CategoryInfo struct {
	Key   Category `json:"key"`
	Label string   `json:"label"`
	Icon  Icon     `json:"icon"`
	Order int      `json:"order"`
}

func CategoryLookup

func CategoryLookup(category Category) (CategoryInfo, bool)

type Channel

type Channel interface {
	io.ReadWriteCloser
	Kind() StreamKind
}

Channel is one tracked upstream stream.

type ChannelRequest

type ChannelRequest struct {
	Kind   StreamKind
	Params map[string]string
}

ChannelRequest opens a tracked upstream stream within a session.

type ClientStream

type ClientStream interface {
	io.ReadWriteCloser
	// Context is closed when the client disconnects.
	Context() context.Context
}

ClientStream is the browser side of a WS pipe handed to a StreamHandler.

type CodeEditorConfig

type CodeEditorConfig struct {
	Language       string            `json:"language,omitempty"`
	InitialContent string            `json:"initialContent,omitempty"`
	SaveRouteID    string            `json:"saveRouteId,omitempty"`
	SaveMethod     Method            `json:"saveMethod,omitempty"`
	SaveParams     map[string]string `json:"saveParams,omitempty"`
	SaveBodyKey    string            `json:"saveBodyKey,omitempty"`
	SaveExtra      map[string]any    `json:"saveExtra,omitempty"`
	// Watch is an optional StreamResource source pushing the current content; the
	// editor live-updates when clean and shows a notice when there are unsaved edits.
	Watch *DataSource `json:"watch,omitempty"`
	// RefreshField is the save-response key whose content resets the editor baseline.
	RefreshField string `json:"refreshField,omitempty"`
	// DryRunKey, with RefreshField, enables a Preview: the save body is sent with
	// this key set true and the returned content is diffed against the live baseline.
	DryRunKey string `json:"dryRunKey,omitempty"`
	// SaveToast is success feedback shown after a save; SaveDismiss closes the host
	// dialog on success. Both are generic and apply to any save-capable panel.
	SaveToast   *SaveToast  `json:"saveToast,omitempty"`
	SaveDismiss SaveDismiss `json:"saveDismiss,omitempty"`
}

type Column

type Column struct {
	Key      string     `json:"key"`
	Label    string     `json:"label"`
	Sortable bool       `json:"sortable,omitempty"`
	Type     ColumnType `json:"type,omitempty"`
	Width    string     `json:"width,omitempty"`
	// Editable opts this column into table cell editing. Editor declares the
	// concrete input; table-level Editable only enables mutation routes.
	Editable bool         `json:"editable,omitempty"`
	Editor   ColumnEditor `json:"editor,omitempty"`
	Options  []Option     `json:"options,omitempty"`
	// ReadOnly marks display-only values. Nullable lets editors clear a cell to
	// empty/null.
	ReadOnly bool `json:"readOnly,omitempty"`
	Nullable bool `json:"nullable,omitempty"`
	// Precision fixes fraction digits for number/percent cells.
	Precision *int `json:"precision,omitempty"`
	// Severities maps lower-cased badge values to colors.
	Severities map[string]Severity `json:"severities,omitempty"`
}

type ColumnEditor added in v0.1.17

type ColumnEditor string

ColumnEditor selects the input used when a table column is explicitly editable.

const (
	ColumnEditorText     ColumnEditor = "text"
	ColumnEditorTextarea ColumnEditor = "textarea"
	ColumnEditorNumber   ColumnEditor = "number"
	ColumnEditorToggle   ColumnEditor = "toggle"
	ColumnEditorSelect   ColumnEditor = "select"
	ColumnEditorJSON     ColumnEditor = "json"
)

type ColumnType

type ColumnType string

ColumnType selects a cell renderer for a table column.

const (
	ColumnText         ColumnType = "text"
	ColumnBadge        ColumnType = "badge"
	ColumnBytes        ColumnType = "bytes"
	ColumnDateTime     ColumnType = "datetime"
	ColumnRelativeTime ColumnType = "relative_time"
	ColumnDuration     ColumnType = "duration"
	ColumnNumber       ColumnType = "number"
	ColumnPercent      ColumnType = "percent"
	ColumnBool         ColumnType = "bool"
	ColumnJSON         ColumnType = "json"
	ColumnIcon         ColumnType = "icon"
)

type Condition

type Condition struct {
	AllOf []Rule      `json:"allOf,omitempty"`
	AnyOf []Rule      `json:"anyOf,omitempty"`
	All   []Condition `json:"all,omitempty"`
	Any   []Condition `json:"any,omitempty"`
	Not   *Condition  `json:"not,omitempty"`
}

Condition is a structured visibility predicate. AllOf/AnyOf hold leaf rules; All/Any/Not nest sub-conditions so arbitrary boolean logic composes, e.g. "(A and B) or (C and not D)".

type ConnectConfig

type ConnectConfig struct {
	ConnectionID string
	UserID       string
	ActorScope   string
	Transport    Transport
	Config       map[string]any
	Credentials  ResolvedCredentials
	Net          NetTransport
	Storage      Storage
}

ConnectConfig is the decrypted config plus core-built transport.

func (ConnectConfig) CredentialFor added in v0.1.12

func (c ConnectConfig) CredentialFor(field string) (ResolvedCredential, bool)

CredentialFor returns the resolved credential for a credential_ref field.

func (ConnectConfig) CredentialKindFor

func (c ConnectConfig) CredentialKindFor(field string) CredentialKind

CredentialKindFor returns the kind resolved for a credential_ref field.

func (ConnectConfig) CredentialValueFor added in v0.1.11

func (c ConnectConfig) CredentialValueFor(field, key string) string

CredentialValueFor returns one decrypted credential value.

func (ConnectConfig) CredentialValuesFor added in v0.1.11

func (c ConnectConfig) CredentialValuesFor(field string) map[string]string

CredentialValuesFor returns a copy of the decrypted values for a credential_ref field.

func (ConnectConfig) Int

func (c ConnectConfig) Int(key string) (int, bool)

Int returns a typed config value; JSON numbers decode to float64, handled here.

func (ConnectConfig) RequiredCredentialFor added in v0.1.12

func (c ConnectConfig) RequiredCredentialFor(field string, kind CredentialKind) (ResolvedCredential, error)

RequiredCredentialFor returns a resolved credential or a typed validation error when the field was not resolved or resolved to an unexpected kind.

func (ConnectConfig) String

func (c ConnectConfig) String(key string) string

String returns a typed config value, or "" if absent/not a string.

type CredentialBinding added in v0.1.12

type CredentialBinding struct {
	Field      string
	Credential ResolvedCredential
}

CredentialBinding binds one resolved credential to the config field that selected it.

type CredentialKind

type CredentialKind string

CredentialKind tags the type of secret material a reusable credential holds.

const (
	CredentialKindSSHPrivateKey  CredentialKind = "ssh_private_key"
	CredentialKindSSHPassword    CredentialKind = "ssh_password"
	CredentialKindTLSClientCert  CredentialKind = "tls_client_cert"
	CredentialKindDBPassword     CredentialKind = "db_password"
	CredentialKindAPIToken       CredentialKind = "api_token"
	CredentialKindCloudAccessKey CredentialKind = "cloud_access_key"
	CredentialKindBasicAuth      CredentialKind = "basic_auth"
	CredentialKindBearerToken    CredentialKind = "bearer_token"
)

type CredentialKindCatalog

type CredentialKindCatalog interface {
	CredentialKinds() []CredentialKindInfo
	CredentialKindLookup(kind CredentialKind) (CredentialKindInfo, bool)
	CredentialKindSupportsProtocol(kind CredentialKind, protocol string) bool
}

CredentialKindCatalog resolves reusable credential kind metadata.

type CredentialKindInfo

type CredentialKindInfo struct {
	Kind                CredentialKind `json:"kind"`
	Label               string         `json:"label"`
	Fields              []Field        `json:"fields"`
	CompatibleProtocols []string       `json:"compatibleProtocols,omitempty"`
}

CredentialKindInfo is the public metadata for a reusable credential kind. It declares the credential form the control-plane UI renders.

func BuiltInCredentialKinds

func BuiltInCredentialKinds() []CredentialKindInfo

BuiltInCredentialKinds returns core credential kinds that are intentionally shared by multiple protocol families.

func CredentialKindLookup

func CredentialKindLookup(kind CredentialKind) (CredentialKindInfo, bool)

CredentialKindLookup returns one core built-in credential kind's metadata.

func CredentialKinds

func CredentialKinds() []CredentialKindInfo

CredentialKinds returns the core built-in credential-kind catalog.

type CredentialKindSet added in v0.1.4

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

CredentialKindSet is a mutable credential-kind catalog.

func MustCredentialKindSet added in v0.1.4

func MustCredentialKindSet(base []CredentialKindInfo) *CredentialKindSet

MustCredentialKindSet returns a catalog initialized with the given credential kinds and panics if the input is invalid.

func NewCredentialKindSet added in v0.1.4

func NewCredentialKindSet(base []CredentialKindInfo) (*CredentialKindSet, error)

NewCredentialKindSet returns a catalog initialized with the given credential kinds.

func (*CredentialKindSet) Add added in v0.1.4

Add appends a credential kind to the catalog.

func (*CredentialKindSet) AddSupport added in v0.1.4

func (c *CredentialKindSet) AddSupport(kind CredentialKind, protocol string)

AddSupport marks a credential kind as compatible with a protocol.

func (*CredentialKindSet) Clone added in v0.1.4

Clone returns a deep copy of the catalog.

func (*CredentialKindSet) CloneWithout added in v0.1.4

func (c *CredentialKindSet) CloneWithout(exclude map[CredentialKind]bool) *CredentialKindSet

CloneWithout returns a deep copy excluding the given credential kinds.

func (*CredentialKindSet) CredentialKindLookup added in v0.1.4

func (c *CredentialKindSet) CredentialKindLookup(kind CredentialKind) (CredentialKindInfo, bool)

func (*CredentialKindSet) CredentialKindSupportsProtocol added in v0.1.4

func (c *CredentialKindSet) CredentialKindSupportsProtocol(kind CredentialKind, protocol string) bool

func (*CredentialKindSet) CredentialKinds added in v0.1.4

func (c *CredentialKindSet) CredentialKinds() []CredentialKindInfo

type CredentialSelector

type CredentialSelector struct {
	Kind      CredentialKind `json:"kind"`
	Protocols []string       `json:"protocols,omitempty"`
}

CredentialSelector constrains which reusable credentials a credential_ref field accepts. Use separate credential_ref fields for alternative credential types. The field stores only the chosen credential id, never a value.

type DashboardConfig

type DashboardConfig struct {
	Cells []Panel `json:"cells,omitempty"`
}

DashboardConfig renders multiple panels in one responsive grid.

type DataSource

type DataSource struct {
	RouteID string            `json:"routeId"`
	Method  Method            `json:"method,omitempty"`
	Params  map[string]string `json:"params,omitempty"`
}

DataSource binds a panel to a route by id; params interpolate from the active resource or static values. The core resolves RouteID + params to a URL.

type DetailView

type DetailView struct {
	Header     HeaderSpec `json:"header"`
	DefaultTab string     `json:"defaultTab,omitempty"`
	Tabs       []Panel    `json:"tabs"`
}

DetailView is opened when a resource row is clicked.

type DiffConfig added in v0.1.5

type DiffConfig struct {
	Language          string   `json:"language,omitempty"`
	OriginalField     string   `json:"originalField,omitempty"`
	ModifiedField     string   `json:"modifiedField,omitempty"`
	OriginalLabel     string   `json:"originalLabel,omitempty"`
	ModifiedLabel     string   `json:"modifiedLabel,omitempty"`
	Mode              DiffMode `json:"mode,omitempty"`
	CollapseUnchanged bool     `json:"collapseUnchanged,omitempty"`
}

type DiffMode added in v0.1.5

type DiffMode string
const (
	DiffSideBySide DiffMode = "side_by_side"
	DiffUnified    DiffMode = "unified"
)

type Download

type Download struct {
	Name    string
	MIME    string
	Size    int64 // -1 when unknown
	ModTime time.Time
	Inline  bool // Content-Disposition: inline vs attachment

	Body      io.ReadCloser
	Seeker    io.ReadSeekCloser
	OpenRange func(offset, length int64) (io.ReadCloser, error)
}

Download is a route result the core streams over HTTP instead of JSON encoding. A handler sets exactly one byte source: Seeker (full Range via http.ServeContent), OpenRange (single-range for offset-but-not-seek backends), or Body (full, no Range).

type Field

type Field struct {
	Key      string    `json:"key"`
	Label    string    `json:"label"`
	Type     FieldType `json:"type"`
	Required bool      `json:"required,omitempty"`
	Secret   bool      `json:"secret,omitempty"`
	// Public is mainly for credential-kind fields: safe non-secret values that
	// may be returned in credential lists and selectors.
	Public bool `json:"public,omitempty"`
	// Default is a UI hint. In action forms, string defaults may reference
	// the active resource with ${resource.uid} or ${resource.name}.
	Default     any      `json:"default,omitempty"`
	Placeholder string   `json:"placeholder,omitempty"`
	Help        string   `json:"help,omitempty"`
	Options     []Option `json:"options,omitempty"`
	// OptionsSource populates choices from a route at form-open time.
	OptionsSource *DataSource         `json:"optionsSource,omitempty"`
	Credential    *CredentialSelector `json:"credential,omitempty"`
	VisibleWhen   *Condition          `json:"visibleWhen,omitempty"`
	Validators    []Validator         `json:"validators,omitempty"`
	// Step is the increment for number/slider inputs.
	Step any `json:"step,omitempty"`

	// Composite fields: Fields holds object fields; Item describes array items.
	Fields    []Field `json:"fields,omitempty"`
	Item      *Field  `json:"item,omitempty"`
	MinItems  int     `json:"minItems,omitempty"`
	MaxItems  int     `json:"maxItems,omitempty"`
	ItemLabel string  `json:"itemLabel,omitempty"`
	AddLabel  string  `json:"addLabel,omitempty"`
	// KeyLabel/KeyPlaceholder label the key input of a map field.
	KeyLabel       string `json:"keyLabel,omitempty"`
	KeyPlaceholder string `json:"keyPlaceholder,omitempty"`
}

func CredentialPublicField added in v0.1.11

func CredentialPublicField(field Field) Field

CredentialPublicField marks a credential field as non-secret metadata that can be returned in credential lists and selectors.

func CredentialSecretField added in v0.1.11

func CredentialSecretField(field Field) Field

CredentialSecretField marks a credential field as secret material.

type FieldType

type FieldType string

FieldType enumerates the input widgets a config field can render as.

const (
	FieldText          FieldType = "text"
	FieldEmail         FieldType = "email"
	FieldURL           FieldType = "url"
	FieldTel           FieldType = "tel"
	FieldNumber        FieldType = "number"
	FieldStepper       FieldType = "stepper"
	FieldSlider        FieldType = "slider"
	FieldPassword      FieldType = "password"
	FieldSelect        FieldType = "select"
	FieldRadio         FieldType = "radio"
	FieldMultiSelect   FieldType = "multiselect"
	FieldFile          FieldType = "file"
	FieldToggle        FieldType = "toggle"
	FieldTextarea      FieldType = "textarea"
	FieldJSON          FieldType = "json"
	FieldDuration      FieldType = "duration"
	FieldCredentialRef FieldType = "credential_ref"
	// FieldObject nests Fields; FieldArray repeats Item.
	FieldObject FieldType = "object"
	FieldArray  FieldType = "array"
	// FieldAutocomplete is free text with Options/OptionsSource suggestions.
	FieldAutocomplete FieldType = "autocomplete"
	// FieldMap is repeatable key/value rows whose value type is Item.
	FieldMap FieldType = "map"
)

type FileBrowserConfig

type FileBrowserConfig struct {
	PathParam string            `json:"pathParam,omitempty"`
	Routes    FileBrowserRoutes `json:"routes,omitempty"`
	Upload    FileUploadConfig  `json:"upload,omitempty"`
	Writable  bool              `json:"writable,omitempty"`
	// Controls re-parameterize every file operation: the chosen value is merged
	// into the route params and the listing reloads.
	Controls []StreamControl `json:"controls,omitempty"`
}

FileBrowserConfig wires the generic file browser to plugin routes.

type FileBrowserRoutes added in v0.1.16

type FileBrowserRoutes struct {
	Read     string `json:"read,omitempty"`
	Download string `json:"download,omitempty"`
	Write    string `json:"write,omitempty"`
	Mkdir    string `json:"mkdir,omitempty"`
	Rename   string `json:"rename,omitempty"`
	Delete   string `json:"delete,omitempty"`
	Move     string `json:"move,omitempty"`
	Copy     string `json:"copy,omitempty"`
	Chmod    string `json:"chmod,omitempty"`
	Archive  string `json:"archive,omitempty"`
}

FileBrowserRoutes groups request/response file operations.

type FileUploadConfig added in v0.1.16

type FileUploadConfig struct {
	RouteID   string `json:"routeId,omitempty"`
	FieldName string `json:"fieldName,omitempty"`
	Multiple  bool   `json:"multiple,omitempty"`
	MaxBytes  int64  `json:"maxBytes,omitempty"`
}

FileUploadConfig configures browser-to-backend uploads for a file browser.

type FilterOption

type FilterOption struct {
	Value string `json:"value"`
	Label string `json:"label,omitempty"`
}

type FormPanelConfig

type FormPanelConfig struct {
	SubmitRouteID string            `json:"submitRouteId,omitempty"`
	SubmitMethod  Method            `json:"submitMethod,omitempty"`
	SubmitLabel   string            `json:"submitLabel,omitempty"`
	Params        map[string]string `json:"params,omitempty"`
	SaveToast     *SaveToast        `json:"saveToast,omitempty"`
	SaveDismiss   SaveDismiss       `json:"saveDismiss,omitempty"`
}

type GraphConfig

type GraphConfig struct {
	Layout  GraphLayout `json:"layout,omitempty"`
	FitView bool        `json:"fitView,omitempty"`
	// ExpandRouteID makes nodes expandable through a read route.
	ExpandRouteID string `json:"expandRouteId,omitempty"`
	ExpandParam   string `json:"expandParam,omitempty"`
	// Exportable controls client-side graph image export. Nil means enabled.
	Exportable *bool `json:"exportable,omitempty"`
}

type GraphLayout

type GraphLayout string
const (
	GraphLayoutGrid   GraphLayout = "grid"
	GraphLayoutManual GraphLayout = "manual"
)

type Group

type Group struct {
	Name   string  `json:"name"`
	Fields []Field `json:"fields"`
}

type HTTPClientConfig

type HTTPClientConfig struct {
	ExecuteRouteID string          `json:"executeRouteId,omitempty"`
	Methods        []string        `json:"methods,omitempty"`
	DefaultMethod  string          `json:"defaultMethod,omitempty"`
	DefaultURL     string          `json:"defaultUrl,omitempty"`
	DefaultHeaders []HeaderDefault `json:"defaultHeaders,omitempty"`
	DefaultBody    string          `json:"defaultBody,omitempty"`
}

type HTTPProxy

type HTTPProxy interface {
	ServeHTTPProxy(w http.ResponseWriter, r *http.Request)
}

HTTPProxy is an optional Session capability for browser-accessible upstreams.

type Handler

type Handler func(rc *RequestContext) (any, error)

Handler is a plugin's pure business logic for an HTTP route. It never sees http.ResponseWriter, status codes, headers, cookies, or auth.

type HeaderDefault

type HeaderDefault struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type HeaderSpec

type HeaderSpec struct {
	Title       string `json:"title,omitempty"`
	StatusField string `json:"statusField,omitempty"`
	// Severities colors the status badge by value (same value->severity map as a
	// badge Column); unmapped values stay neutral.
	Severities map[string]Severity `json:"severities,omitempty"`
}

HeaderSpec configures a resource DetailView header. Detail actions live in ResourceActions.Detail, not here.

type Icon

type Icon struct {
	Type  IconType `json:"type"`
	Value string   `json:"value"`
}

Icon is a structured icon reference used by every icon field in the manifest.

type IconType

type IconType string

IconType selects how an Icon's Value is interpreted by the renderer.

const (
	IconLucide IconType = "lucide" // Lucide icon name, kebab-case e.g. "ellipsis-vertical"
	IconURL    IconType = "url"    // remote image
	IconBase64 IconType = "base64" // inline data URI
	IconEmoji  IconType = "emoji"  // single emoji
	IconSVG    IconType = "svg"    // raw inline SVG markup (sanitized before render)
)

type InstallArtifact

type InstallArtifact struct {
	Label      string
	Kind       string
	Template   string
	Content    string
	Filename   string
	Delivery   ArtifactDelivery
	ConnectURL ArtifactConnectURL
}

InstallArtifact is a launch recipe shown to start an agent.

type KVConfig

type KVConfig struct {
	CreateRouteID string `json:"createRouteId,omitempty"`
	ReadRouteID   string `json:"readRouteId,omitempty"`
	WriteRouteID  string `json:"writeRouteId,omitempty"`
	DeleteRouteID string `json:"deleteRouteId,omitempty"`
	KeyParam      string `json:"keyParam,omitempty"`
	Writable      bool   `json:"writable,omitempty"`
	// ValueTypes enables a type picker; empty means plain value editing.
	ValueTypes []string `json:"valueTypes,omitempty"`
	// Delimiter groups keys into a namespace tree (e.g. ":"); empty offers only
	// the flat list.
	Delimiter string `json:"delimiter,omitempty"`
}

type Layout

type Layout string

Layout selects how the connection workspace is arranged.

const (
	LayoutTabs        Layout = "tabs"         // flat top tab bar, one panel at a time
	LayoutSidebarTree Layout = "sidebar_tree" // left resource tree + detail pane
	LayoutDashboard   Layout = "dashboard"    // grid of panels (from Tabs) shown at once
	LayoutSingle      Layout = "single"       // one full-bleed panel, no tab bar (a desktop/terminal/file screen)
)

type LogStreamConfig added in v0.1.19

type LogStreamConfig struct {
	Controls      []StreamControl `json:"controls,omitempty"`
	AllowPrevious bool            `json:"allowPrevious,omitempty"`
}

LogStreamConfig configures the log viewer: stream controls that re-parameterize the source and an optional "previous (crashed) logs" toggle.

type Manifest

type Manifest struct {
	APIVersion  int
	Name        string
	Version     string
	Title       string
	Description string
	Icon        Icon
	Category    Category

	Config       Schema
	Capabilities []Capability
	// CredentialKinds declares reusable credential kinds owned by this plugin.
	// Shared cross-protocol kinds may still come from the core catalog.
	CredentialKinds []CredentialKindInfo

	SupportedTransports []Transport
	Agent               *AgentProfile

	Layout    Layout
	Tabs      []Panel
	Tree      []TreeGroup
	Resources []ResourceType
	Actions   []Action
	Streams   []Stream

	// HeaderActions reference Actions shown in the connection workspace header.
	HeaderActions []string

	// Scope declares global selectors injected into every request.
	Scope []ScopeFilter

	// Recording declares which stream classes this plugin can record.
	Recording []RecordingCapability
}

Manifest is a plugin's single versioned declarative contract.

func (Manifest) Recordable

func (m Manifest) Recordable() bool

Recordable reports whether a manifest declares any recording capability.

func (Manifest) RecordingClassFor

func (m Manifest) RecordingClassFor(streamID string) (RecordingCapability, bool)

RecordingClassFor returns the capability covering a stream id, if any.

func (Manifest) StreamByRoute

func (m Manifest) StreamByRoute(routeID string) (Stream, bool)

StreamByRoute returns the declared stream served by a WS route, if any.

func (Manifest) SupportsRecordingClass

func (m Manifest) SupportsRecordingClass(class RecordingClass) bool

SupportsRecordingClass reports whether the manifest declares the given class.

func (Manifest) SupportsTransport

func (m Manifest) SupportsTransport(t Transport) bool

SupportsTransport reports whether the manifest declares the given transport.

type Method

type Method string

Method is the HTTP verb (or WS) a route is mounted under.

const (
	MethodGet    Method = "GET"
	MethodPost   Method = "POST"
	MethodPut    Method = "PUT"
	MethodPatch  Method = "PATCH"
	MethodDelete Method = "DELETE"
	MethodWS     Method = "WS"
)

type MetricGauge

type MetricGauge struct {
	Key   string  `json:"key"`
	Label string  `json:"label,omitempty"`
	Unit  string  `json:"unit,omitempty"`
	Max   float64 `json:"max,omitempty"`
}

MetricGauge is one radial/doughnut gauge (current value vs Max; Max 0 = 100, i.e. a percentage).

type MetricSeries

type MetricSeries struct {
	Key   string `json:"key"`
	Label string `json:"label,omitempty"`
	Unit  string `json:"unit,omitempty"`
}

MetricSeries is one line in the metrics time-series chart.

type MetricStat

type MetricStat struct {
	Key   string `json:"key"`
	Label string `json:"label,omitempty"`
	Unit  string `json:"unit,omitempty"`
}

MetricStat is one KPI number card in the metrics panel.

type MetricUsage added in v0.1.9

type MetricUsage = ObjectDetailField

MetricUsage renders one live used/capacity row in a metrics panel. It uses the same field contract as object-detail usage rows so static and streaming capacity displays stay consistent.

type MetricsConfig

type MetricsConfig struct {
	Stats   []MetricStat   `json:"stats,omitempty"`
	Gauges  []MetricGauge  `json:"gauges,omitempty"`
	Usage   []MetricUsage  `json:"usage,omitempty"`
	Series  []MetricSeries `json:"series,omitempty"`
	History int            `json:"history,omitempty"`
}

MetricsConfig selects the stat, usage, gauge, and series keys rendered from metric stream frames. Prefer Usage for values that have used/total context.

type NavigateTarget string

NavigateTarget is where the UI moves after an action succeeds.

const NavigateList NavigateTarget = "list"

NavigateList returns from a resource detail to its list.

type NetTransport

type NetTransport interface {
	// L4 socket/TCP protocols.
	DialContext(ctx context.Context, network, addr string) (net.Conn, error)
	// L7 clients that need an injected HTTP transport.
	HTTP() (baseURL string, rt http.RoundTripper, ok bool)
}

NetTransport exposes the upstream at the layer the protocol needs.

type ObjectDetailConfig added in v0.1.5

type ObjectDetailConfig struct {
	Sections  []ObjectDetailSection `json:"sections,omitempty"`
	RawToggle bool                  `json:"rawToggle,omitempty"`
	// Watch is an optional StreamResource source that live-updates the panel.
	Watch *DataSource `json:"watch,omitempty"`
}

type ObjectDetailField added in v0.1.5

type ObjectDetailField struct {
	Key        string              `json:"key"`
	Label      string              `json:"label,omitempty"`
	Type       ColumnType          `json:"type,omitempty"`
	Usage      *UsageSpec          `json:"usage,omitempty"`
	Copy       bool                `json:"copy,omitempty"`
	Redacted   bool                `json:"redacted,omitempty"`
	Severities map[string]Severity `json:"severities,omitempty"`
}

type ObjectDetailSection added in v0.1.5

type ObjectDetailSection struct {
	Title  string              `json:"title,omitempty"`
	Fields []ObjectDetailField `json:"fields,omitempty"`
}

type OpenPanelEffect added in v0.1.18

type OpenPanelEffect struct {
	Open   OpenTarget  `json:"open"` // dock or dialog
	Panel  PanelType   `json:"panel"`
	Title  string      `json:"title,omitempty"`
	Icon   Icon        `json:"icon,omitzero"`
	Source *DataSource `json:"source,omitempty"`
	Config PanelConfig `json:"config,omitempty"`
}

OpenPanelEffect opens a panel after an action succeeds; source params may interpolate the action's JSON result via ${response.x}, so a route's output can drive a follow-up panel (create a resource, then open a terminal into it).

type OpenTarget

type OpenTarget string

OpenTarget selects where an action's result surfaces.

const (
	OpenView   OpenTarget = "view"
	OpenDock   OpenTarget = "dock"
	OpenDialog OpenTarget = "dialog"
	// OpenURL opens the route-returned URL in a new browser tab.
	OpenURL OpenTarget = "url"
)

type Operator

type Operator string

Operator is the comparison used by a structured visibility Rule.

const (
	OpEq       Operator = "eq"
	OpNeq      Operator = "neq"
	OpIn       Operator = "in"
	OpNin      Operator = "nin"
	OpEmpty    Operator = "empty"
	OpNotEmpty Operator = "notEmpty"
	OpGt       Operator = "gt"
	OpLt       Operator = "lt"
	OpGte      Operator = "gte"
	OpLte      Operator = "lte"
	OpContains Operator = "contains"
)

type Option

type Option struct {
	Label string `json:"label"`
	Value any    `json:"value"`
}

type Page

type Page[T any] struct {
	Items      []T    `json:"items"`
	NextCursor string `json:"nextCursor"`
	Total      *int   `json:"total,omitempty"`
}

Page is one slice of a paginated list.

type PageRequest

type PageRequest struct {
	Cursor string            `json:"cursor,omitempty"`
	Limit  int               `json:"limit,omitempty"`
	Filter map[string]string `json:"filter,omitempty"`
	Sort   []SortKey         `json:"sort,omitempty"`
}

PageRequest carries cursor pagination, filtering, and sorting for list routes.

func (PageRequest) Search

func (p PageRequest) Search() string

Search returns the table's free-text filter term (the grid's search box), trimmed. The "q" key is the contract — read it through here, never by hand.

type Panel

type Panel struct {
	Key    string      `json:"key"`
	Label  string      `json:"label,omitempty"`
	Icon   Icon        `json:"icon,omitzero"`
	Type   PanelType   `json:"panel"`
	Source *DataSource `json:"source,omitempty"`
	Config PanelConfig `json:"config,omitempty"`
	// Variants switch the renderer/config without duplicating the logical tab.
	// The first variant whose VisibleWhen matches wins.
	Variants []PanelVariant `json:"variants,omitempty"`
	// VisibleWhen hides this panel unless the active row/resource data matches.
	VisibleWhen *Condition `json:"visibleWhen,omitempty"`
	// Span is a dashboard-only sizing hint.
	Span int `json:"span,omitempty"`
}

Panel is a renderable tab, detail panel, or dashboard cell.

func (*Panel) UnmarshalJSON

func (p *Panel) UnmarshalJSON(data []byte) error

type PanelConfig

type PanelConfig interface {
	// contains filtered or unexported methods
}

PanelConfig is closed to this package so config fields cannot accept arbitrary data.

type PanelConfigProperty added in v0.1.5

type PanelConfigProperty struct {
	Type       string                         `json:"type"`
	Items      *PanelConfigProperty           `json:"items,omitempty"`
	Properties map[string]PanelConfigProperty `json:"properties,omitempty"`
	Enum       []string                       `json:"enum,omitempty"`
	Required   []string                       `json:"required,omitempty"`
}

func (PanelConfigProperty) MarshalJSON added in v0.1.20

func (prop PanelConfigProperty) MarshalJSON() ([]byte, error)

type PanelConfigSchema added in v0.1.5

type PanelConfigSchema struct {
	Type       string                         `json:"type"`
	Properties map[string]PanelConfigProperty `json:"properties"`
	Required   []string                       `json:"required,omitempty"`
}

func (PanelConfigSchema) MarshalJSON added in v0.1.20

func (schema PanelConfigSchema) MarshalJSON() ([]byte, error)

type PanelConfigSchemaMap added in v0.1.20

type PanelConfigSchemaMap map[PanelType]PanelConfigSchema

func PanelConfigSchemas added in v0.1.5

func PanelConfigSchemas() PanelConfigSchemaMap

func (PanelConfigSchemaMap) MarshalJSON added in v0.1.20

func (schemas PanelConfigSchemaMap) MarshalJSON() ([]byte, error)

type PanelTheme added in v0.1.7

type PanelTheme string

PanelTheme is the core light/dark hint sent to drawable stream panels. It is advisory: plugins should use it only for colors, never for behavior or auth.

const (
	PanelThemeLight PanelTheme = "light"
	PanelThemeDark  PanelTheme = "dark"
)

type PanelType

type PanelType string

PanelType selects which core renderer component a tab/detail panel uses.

const (
	PanelTerminal      PanelType = "terminal"
	PanelTerminalGrid  PanelType = "terminal_grid"
	PanelFileBrowser   PanelType = "file_browser"
	PanelTable         PanelType = "table"
	PanelMetrics       PanelType = "metrics"
	PanelLogStream     PanelType = "log_stream"
	PanelCodeEditor    PanelType = "code_editor"
	PanelDiff          PanelType = "diff"
	PanelDocument      PanelType = "document"
	PanelQueryEditor   PanelType = "query_editor"
	PanelRemoteDesktop PanelType = "remote_desktop"
	PanelForm          PanelType = "form"
	PanelEnroll        PanelType = "enroll"
	PanelDashboard     PanelType = "dashboard"
	PanelObjectDetail  PanelType = "object_detail"
	PanelTimeline      PanelType = "timeline"
	PanelTaskProgress  PanelType = "task_progress"
	PanelSplit         PanelType = "split"
	PanelCanvas        PanelType = "canvas"
	PanelWasm          PanelType = "wasm"
	PanelWebProxy      PanelType = "web_proxy"

	PanelGraph      PanelType = "graph"
	PanelTrace      PanelType = "trace"
	PanelKV         PanelType = "kv"
	PanelHTTPClient PanelType = "http_client"
)

type PanelVariant added in v0.1.10

type PanelVariant struct {
	Type        PanelType   `json:"panel"`
	Config      PanelConfig `json:"config,omitempty"`
	VisibleWhen *Condition  `json:"visibleWhen,omitempty"`
}

type Plugin

type Plugin interface {
	Manifest() Manifest
	Routes() []Route
	Connect(ctx context.Context, cfg ConnectConfig) (Session, error)
}

Plugin is a stateless, compiled-in protocol implementation.

type ProjectedAction

type ProjectedAction struct {
	ID              string            `json:"id"`
	Label           string            `json:"label"`
	Icon            Icon              `json:"icon,omitzero"`
	RouteID         string            `json:"routeId"`
	Method          Method            `json:"method,omitempty"`
	Params          map[string]string `json:"params,omitempty"`
	Body            map[string]any    `json:"body,omitempty"`
	Risk            RiskLevel         `json:"risk"`
	RequiresConfirm bool              `json:"requiresConfirm"`
	ConfirmText     string            `json:"confirmText,omitempty"`
	Input           *Schema           `json:"input,omitempty"`
	OnSuccess       *ActionSuccess    `json:"onSuccess,omitempty"`
	Open            OpenTarget        `json:"open,omitempty"`
	Panel           PanelType         `json:"panel,omitempty"`
	Config          PanelConfig       `json:"config,omitempty"`
	EnabledWhen     *Condition        `json:"enabledWhen,omitempty"`
	VisibleWhen     *Condition        `json:"visibleWhen,omitempty"`
	IconOnly        bool              `json:"iconOnly,omitempty"`
	Group           string            `json:"group,omitempty"`
	Bulk            bool              `json:"bulk,omitempty"`
}

ProjectedAction is an action with permission/risk/input/method resolved from its route — the browser never sees the permission key or audit-event name.

func (*ProjectedAction) UnmarshalJSON added in v0.1.4

func (a *ProjectedAction) UnmarshalJSON(data []byte) error

type ProjectedAgentProfile

type ProjectedAgentProfile struct {
	Modes    []string `json:"modes"`
	RiskNote string   `json:"riskNote,omitempty"`
}

ProjectedAgentProfile is the render-only view of agent connectivity.

type ProjectedRecording

type ProjectedRecording struct {
	Class         RecordingClass    `json:"class"`
	Formats       []RecordingFormat `json:"formats"`
	Authoritative bool              `json:"authoritative"`
	InputCapture  bool              `json:"inputCapture"`
}

ProjectedRecording tells the browser which recording options a plugin offers for a class, without leaking the server-only stream binding (StreamIDs).

type Projection

type Projection struct {
	APIVersion          int                    `json:"apiVersion"`
	Name                string                 `json:"name"`
	Version             string                 `json:"version"`
	Title               string                 `json:"title"`
	Description         string                 `json:"description"`
	Icon                Icon                   `json:"icon"`
	Category            CategoryInfo           `json:"category"`
	Config              Schema                 `json:"config"`
	Capabilities        []Capability           `json:"capabilities"`
	CredentialKinds     []CredentialKindInfo   `json:"credentialKinds,omitempty"`
	SupportedTransports []Transport            `json:"supportedTransports"`
	Agent               *ProjectedAgentProfile `json:"agent,omitempty"`
	Layout              Layout                 `json:"layout"`
	Tabs                []Panel                `json:"tabs,omitempty"`
	Tree                []TreeGroup            `json:"tree,omitempty"`
	Resources           []ResourceType         `json:"resources,omitempty"`
	Actions             []ProjectedAction      `json:"actions,omitempty"`
	HeaderActions       []string               `json:"headerActions,omitempty"`
	Scope               []ScopeFilter          `json:"scope,omitempty"`
	Streams             []Stream               `json:"streams,omitempty"`
	Recording           []ProjectedRecording   `json:"recording,omitempty"`
	PanelConfigSchemas  PanelConfigSchemaMap   `json:"panelConfigSchemas,omitempty"`
}

Projection is the render-only contract served to the browser. It mirrors projection.ts PluginProjection and excludes handler funcs, raw mount paths, permission keys, audit-event names, and any server-only route internals.

func BuildProjection

func BuildProjection(m Manifest, routes map[string]Route) Projection

BuildProjection derives the browser projection from a validated manifest and its indexed routes. Actions resolve their risk/input/method from the route.

type ProxyTarget

type ProxyTarget struct {
	Mode      AgentMode
	Address   string
	Risk      RiskLevel
	TokenFile string
	CAFile    string
	// Forward allows per-stream target-side addresses instead of only Address.
	Forward bool
}

ProxyTarget describes the endpoint an agent exposes back to the gateway.

type QueryEditorConfig

type QueryEditorConfig struct {
	Language          string            `json:"language,omitempty"`
	Label             string            `json:"label,omitempty"`
	ExecuteLabel      string            `json:"executeLabel,omitempty"`
	CancelLabel       string            `json:"cancelLabel,omitempty"`
	RunningLabel      string            `json:"runningLabel,omitempty"`
	EmptyText         string            `json:"emptyText,omitempty"`
	InitialQuery      string            `json:"initialQuery,omitempty"`
	CancelRouteID     string            `json:"cancelRouteId,omitempty"`
	CancelParams      map[string]string `json:"cancelParams,omitempty"`
	CompletionRouteID string            `json:"completionRouteId,omitempty"`
	CompletionParams  map[string]string `json:"completionParams,omitempty"`
	Exportable        bool              `json:"exportable,omitempty"`
}

type RecordingCapability

type RecordingCapability struct {
	Class   RecordingClass
	Formats []RecordingFormat // ordered preference; Formats[0] is the default
	// StreamIDs are server-only: the projection never exposes the stream binding.
	StreamIDs     []string
	Authoritative bool
	InputCapture  bool
}

RecordingCapability is one recordable stream class a plugin declares.

func (RecordingCapability) DefaultFormat

func (c RecordingCapability) DefaultFormat() RecordingFormat

DefaultFormat returns the capability's preferred (first) format.

func (RecordingCapability) SupportsFormat

func (c RecordingCapability) SupportsFormat(f RecordingFormat) bool

SupportsFormat reports whether the capability declares the given format.

type RecordingClass

type RecordingClass string

RecordingClass groups streams by recording format family.

const (
	RecordingTerminal RecordingClass = "terminal"
	RecordingDesktop  RecordingClass = "desktop"
)

type RecordingFormat

type RecordingFormat string

RecordingFormat is a concrete on-disk recording encoding.

const (
	FormatAsciicastV2 RecordingFormat = "asciicast_v2"
	FormatWebMCanvas  RecordingFormat = "webm_canvas"
)

type RecordingPolicy

type RecordingPolicy string

RecordingPolicy is a connection's per-class recording setting. Off by default.

const (
	PolicyDisabled RecordingPolicy = "disabled"
	PolicyManual   RecordingPolicy = "manual"
	PolicyAuto     RecordingPolicy = "auto"
)

type RemoteDesktopConfig

type RemoteDesktopConfig struct {
	Resize     bool   `json:"resize,omitempty"`
	Clipboard  bool   `json:"clipboard,omitempty"`
	Audio      bool   `json:"audio,omitempty"`
	RepeaterID string `json:"repeaterID,omitempty"`
}

type RequestContext

type RequestContext struct {
	Ctx     context.Context
	User    User
	Session Session
	Storage Storage
	// contains filtered or unexported fields
}

RequestContext gives a handler typed access to the request without ever touching http internals. Bind decodes + validates into a struct, so handlers never do panic-prone map[string]any assertions.

func NewMultipartRequestContext

func NewMultipartRequestContext(ctx context.Context, user User, sess Session, params map[string]string, query url.Values, form url.Values, files map[string][]UploadedFile) *RequestContext

NewMultipartRequestContext builds a context for a multipart/form-data request.

func NewRequestContext

func NewRequestContext(ctx context.Context, user User, sess Session, params map[string]string, query url.Values, body []byte) *RequestContext

NewRequestContext builds a context for the server adapter and for tests.

func (*RequestContext) Audit

func (rc *RequestContext) Audit(result AuditResult, params map[string]string, err error)

Audit records one operation inside this route. It is a no-op when no core audit hook is attached, which keeps plugin unit tests lightweight.

func (*RequestContext) Bind

func (rc *RequestContext) Bind(dst any) error

Bind decodes the request body into dst and runs struct-tag validation. JSON is the default; multipart form values are coerced into JSON-compatible values and uploaded bytes remain available through Uploads.

func (*RequestContext) Body

func (rc *RequestContext) Body() []byte

Body returns the raw request body.

func (*RequestContext) Page

func (rc *RequestContext) Page() (PageRequest, error)

Page parses cursor/limit/filter/sort from the query and clamps the limit.

func (*RequestContext) Param

func (rc *RequestContext) Param(name string) string

Param returns a resolved renderer-supplied parameter. Route handlers use it for required path placeholders and optional scoped context values.

func (*RequestContext) ParamList

func (rc *RequestContext) ParamList(name, sep string) []string

ParamList splits a param that carries several values joined by sep — e.g. a multiselect scope filter, read with sep = ScopeSeparator — dropping blanks. It returns nil when the param is absent, so a handler treats "no scope" as "all".

func (*RequestContext) Params

func (rc *RequestContext) Params() map[string]string

Params returns a copy of all resolved parameters.

func (*RequestContext) ProxyPrefix added in v0.1.3

func (rc *RequestContext) ProxyPrefix() string

ProxyPrefix returns the core-supplied proxy mount, without a trailing slash.

func (*RequestContext) ProxyURL added in v0.1.3

func (rc *RequestContext) ProxyURL(sub ...string) string

ProxyURL builds the "open in browser" URL: the core-supplied proxy mount plus path-escaped segments and a trailing slash.

func (*RequestContext) Query

func (rc *RequestContext) Query() url.Values

Query returns the raw query values (list controls + p.* params).

func (*RequestContext) UploadFields

func (rc *RequestContext) UploadFields() []string

UploadFields returns the names of multipart fields that carried files.

func (*RequestContext) Uploads

func (rc *RequestContext) Uploads(field string) []UploadedFile

Uploads returns multipart files for a form field. The returned slice is a copy so callers cannot mutate the request context.

func (*RequestContext) ValidateSchema

func (rc *RequestContext) ValidateSchema(schema *Schema) error

ValidateSchema applies the manifest-declared input schema at the core wrapper before the handler runs. Handlers still call Bind for typed decoding.

func (*RequestContext) WithAuditHook

func (rc *RequestContext) WithAuditHook(hook AuditHook) *RequestContext

WithAuditHook attaches the core audit writer for stream-internal operations.

func (*RequestContext) WithProxyPrefix added in v0.1.3

func (rc *RequestContext) WithProxyPrefix(prefix string) *RequestContext

WithProxyPrefix attaches the connection's public proxy mount (core-set).

func (*RequestContext) WithStorage added in v0.1.6

func (rc *RequestContext) WithStorage(storage Storage) *RequestContext

WithStorage attaches the platform storage surface to a request context.

type Resizer added in v0.1.2

type Resizer interface {
	Resize(cols, rows int) error
}

Resizer is implemented by channels whose upstream can change terminal size.

type ResolvedCredential added in v0.1.12

type ResolvedCredential struct {
	ID     string
	Kind   CredentialKind
	Values map[string]string
}

ResolvedCredential is decrypted credential material resolved by the core for one credential_ref config field.

func (ResolvedCredential) RequiredValue added in v0.1.12

func (r ResolvedCredential) RequiredValue(key string) (string, error)

RequiredValue returns one decrypted credential value or a typed validation error when it is empty.

func (ResolvedCredential) Value added in v0.1.12

func (r ResolvedCredential) Value(key string) string

Value returns one decrypted credential value.

type ResolvedCredentials added in v0.1.12

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

ResolvedCredentials is the set of reusable credentials resolved for a connection attempt.

func NewResolvedCredentials added in v0.1.12

func NewResolvedCredentials(bindings ...CredentialBinding) ResolvedCredentials

NewResolvedCredentials builds a resolved credential set keyed by the credential_ref field that selected each credential.

func (ResolvedCredentials) For added in v0.1.12

For returns the resolved credential for a credential_ref field.

type ResourceActions

type ResourceActions struct {
	Toolbar    []string `json:"toolbar,omitempty"`    // list toolbar, no row context (create, prune)
	Row        []string `json:"row,omitempty"`        // bulk over selected rows (delete); implies Selectable
	Detail     []string `json:"detail,omitempty"`     // the one open resource, in its detail header
	Selectable bool     `json:"selectable,omitempty"` // row checkboxes without a row bar; Row implies it
}

ResourceActions groups action IDs by render surface.

type ResourceEvent

type ResourceEvent struct {
	Type     string           `json:"type"`
	Ref      ResourceIdentity `json:"ref"`
	Resource any              `json:"resource,omitempty"`
}

ResourceEvent is emitted by watch streams to patch a resource list.

type ResourceIdentity added in v0.1.13

type ResourceIdentity struct {
	Kind      string `json:"kind"`
	Scope     string `json:"scope,omitempty"`
	Namespace string `json:"namespace,omitempty"`
	Name      string `json:"name"`
	UID       string `json:"uid"`
}

ResourceIdentity identifies a real, navigable resource exposed by a plugin. Put it in a row's "ref" field only when that row should open a resource detail view or feed ${resource.*} action params. Plain data rows should use their own fields plus ${record.*} instead of fabricating an identity. Scope is an optional outer container for hierarchies deeper than namespace/name.

type ResourceType

type ResourceType struct {
	Kind  string      `json:"kind"`
	Title string      `json:"title"`
	List  DataSource  `json:"list"`
	Watch *DataSource `json:"watch,omitempty"`
	// Columns are the static list columns. Leave empty and set ColumnsSource to
	// derive columns at runtime (e.g. a CRD's own printer columns).
	Columns []Column `json:"columns"`
	// ColumnsSource is an optional route returning column definitions (rows with
	// name/label) for lists whose columns are only known at runtime. The list's
	// scoping params are merged in, so one generic type can serve many shapes.
	ColumnsSource *DataSource `json:"columnsSource,omitempty"`
	// Actions groups this resource's actions by render surface (toolbar / row /
	// detail). The single action contract for a resource.
	Actions ResourceActions `json:"actions,omitzero"`
	Detail  DetailView      `json:"detail"`
}

ResourceType is a managed object type: columns, actions, detail.

type RiskLevel

type RiskLevel string

RiskLevel is enforced by the route wrapper and projected (read-only) to the UI.

const (
	RiskSafe        RiskLevel = "safe"        // read-only (list, describe)
	RiskWrite       RiskLevel = "write"       // create/update
	RiskDestructive RiskLevel = "destructive" // delete, truncate, restore
	RiskPrivileged  RiskLevel = "privileged"  // shell, exec, raw socket
)

type Route

type Route struct {
	ID         string    `json:"id"`
	Method     Method    `json:"method"`
	Path       string    `json:"path"`
	Permission string    `json:"permission"`
	Risk       RiskLevel `json:"risk"`
	AuditEvent string    `json:"auditEvent"`
	Input      *Schema   `json:"input,omitempty"`

	Timeout time.Duration `json:"timeout,omitempty"`

	Handle Handler       `json:"-"`
	Stream StreamHandler `json:"-"`
}

Route is a typed server endpoint with the metadata the core enforces. It is the ONE behavior mechanism: no HandleAction, no plugin-owned HTTP.

func (Route) IsStream

func (r Route) IsStream() bool

IsStream reports whether the route is a WebSocket route.

type RowClickAction

type RowClickAction string

RowClickAction declares what a click on a table row's body does.

const (
	RowClickNavigate RowClickAction = "navigate" // open the row's ref resource
	RowClickDetail   RowClickAction = "detail"   // open the per-row details dialog
	RowClickSelect   RowClickAction = "select"   // toggle row selection
	RowClickNone     RowClickAction = "none"
)

type Rule

type Rule struct {
	Field string   `json:"field"`
	Op    Operator `json:"op"`
	Value any      `json:"value,omitempty"`
}

type SaveDismiss added in v0.1.19

type SaveDismiss string

SaveDismiss selects what happens to a save panel's host surface after success.

const (
	SaveDismissNone  SaveDismiss = ""
	SaveDismissClose SaveDismiss = "close"
)

type SaveToast added in v0.1.19

type SaveToast struct {
	Summary  string   `json:"summary,omitempty"`
	Detail   string   `json:"detail,omitempty"`
	Severity Severity `json:"severity,omitempty"`
}

SaveToast is optional success feedback for a save/apply. Detail may interpolate the save response via ${response.x}.

type Schema

type Schema struct {
	Groups []Group `json:"groups"`
}

Schema is the connection config form: ordered groups of typed fields.

func (Schema) Defaults

func (s Schema) Defaults() map[string]any

Defaults returns the manifest-declared default values keyed by field.

func (Schema) HasFileField

func (s Schema) HasFileField() bool

HasFileField reports whether the schema can submit browser File values and therefore requires multipart/form-data binding at the server boundary.

func (Schema) ValidateValues

func (s Schema) ValidateValues(values map[string]any, uploaded map[string]bool) error

ValidateValues checks a decoded value map against the schema: per-field visibility, required-ness, type, options, and validators. File fields are satisfied by the caller-supplied uploaded set (the actual bytes live outside the value map). It is the shared validator behind the route wrapper (ValidateSchema) and the control-plane connection-config check.

func (Schema) ValidateValuesWithContext

func (s Schema) ValidateValuesWithContext(values map[string]any, uploaded map[string]bool, context map[string]any) error

func (Schema) ValuesWithDefaults

func (s Schema) ValuesWithDefaults(values map[string]any) map[string]any

ValuesWithDefaults returns a copy of values with missing schema defaults filled in. Explicit false/zero/empty values are preserved.

func (Schema) VisibleSecretKeys

func (s Schema) VisibleSecretKeys(values map[string]any, context map[string]any) []string

func (Schema) VisibleValues

func (s Schema) VisibleValues(values map[string]any, context map[string]any) map[string]any

type ScopeControl

type ScopeControl string

ScopeControl names the scope filter's input widget.

const (
	ScopeSelect       ScopeControl = "select" // default
	ScopeAutoComplete ScopeControl = "autocomplete"
	ScopeSearch       ScopeControl = "search"
	ScopeToggle       ScopeControl = "toggle" // on sets the first Option's value
)

type ScopeFilter

type ScopeFilter struct {
	Param         string         `json:"param"`
	Label         string         `json:"label"`
	Icon          Icon           `json:"icon,omitzero"`
	Control       ScopeControl   `json:"control,omitempty"`
	Multiple      bool           `json:"multiple,omitempty"`
	AllowCustom   bool           `json:"allowCustom,omitempty"`
	DisableSearch bool           `json:"disableSearch,omitempty"`
	OptionsSource *DataSource    `json:"optionsSource,omitempty"`
	WatchSource   *DataSource    `json:"watchSource,omitempty"`
	Options       []FilterOption `json:"options,omitempty"`
	ValueField    string         `json:"valueField,omitempty"`
	LabelField    string         `json:"labelField,omitempty"`
	AllLabel      string         `json:"allLabel,omitempty"`
	DefaultValue  string         `json:"defaultValue,omitempty"`
}

ScopeFilter is a global selector injected into read and stream route params.

type Session

type Session interface {
	HealthCheck(ctx context.Context) error
	OpenChannel(ctx context.Context, req ChannelRequest) (Channel, error)
	Close() error
}

Session is a live, authenticated runtime for one connection. It holds all per-connection state; the Plugin struct holds none.

type Severity

type Severity string

Severity styles a badge.

const (
	SeverityInfo      Severity = "info"
	SeveritySuccess   Severity = "success"
	SeverityWarn      Severity = "warn"
	SeverityDanger    Severity = "danger"
	SeveritySecondary Severity = "secondary"
)

type SortKey

type SortKey struct {
	Field string `json:"field"`
	Desc  bool   `json:"desc,omitempty"`
}

SortKey is one ordering directive for a list route.

type SplitConfig added in v0.1.5

type SplitConfig struct {
	Orientation SplitOrientation `json:"orientation,omitempty"`
	Panels      []SplitPanel     `json:"panels,omitempty"`
}

type SplitOrientation added in v0.1.5

type SplitOrientation string
const (
	SplitHorizontal SplitOrientation = "horizontal"
	SplitVertical   SplitOrientation = "vertical"
)

type SplitPanel added in v0.1.5

type SplitPanel struct {
	Panel
	Size    int `json:"size,omitempty"`
	MinSize int `json:"minSize,omitempty"`
}

type Storage added in v0.1.6

type Storage interface {
	Get(ctx context.Context, scope StorageScope, key string) (StorageItem, error)
	Put(ctx context.Context, collection string, item StorageItem) (StorageItem, error)
	Delete(ctx context.Context, scope StorageScope, key string) error
	List(ctx context.Context, scope StorageScope, filter *StorageListFilter) ([]StorageItem, error)
}

Storage is the generic persistence surface exposed to plugin route handlers. Implementations must scope access; plugins never receive raw database access.

type StorageItem added in v0.1.6

type StorageItem struct {
	Key         string
	Value       []byte
	ContentType string
	Metadata    map[string]string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

StorageItem is one plugin storage record. Value is opaque to core; Metadata is intended for labels or lightweight local filtering.

type StorageListFilter added in v0.1.8

type StorageListFilter struct {
	Keys          []string
	KeyPrefix     string
	ContentType   string
	CreatedAfter  time.Time
	CreatedBefore time.Time
	UpdatedAfter  time.Time
	UpdatedBefore time.Time
	Limit         int
	Offset        int
}

StorageListFilter narrows List results within a resolved StorageScope.

type StorageScope added in v0.1.6

type StorageScope struct {
	Collection string
	Level      StorageScopeLevel
}

StorageScope filters a storage collection. Empty Level defaults to StorageScopeConnection. Core resolves and enforces plugin, connection, and user identity; plugins declare only the logical collection and filter level.

func ConnectionStorage added in v0.1.6

func ConnectionStorage(collection string) StorageScope

func UserStorage added in v0.1.6

func UserStorage(collection string) StorageScope

type StorageScopeLevel added in v0.1.6

type StorageScopeLevel string
const (
	StorageScopeConnection StorageScopeLevel = "connection"
	StorageScopeUser       StorageScopeLevel = "user"
)

type Stream

type Stream struct {
	ID      string     `json:"id"`
	Kind    StreamKind `json:"kind"`
	RouteID string     `json:"routeId"`
}

Stream is a long-lived channel a panel binds to, pointing at a WS route.

type StreamControl added in v0.1.19

type StreamControl struct {
	Param         string      `json:"param"`
	Label         string      `json:"label,omitempty"`
	OptionsSource *DataSource `json:"optionsSource,omitempty"`
}

StreamControl is a generic selector that re-parameterizes a panel: the chosen option value is sent as Param on the source and the stream reconnects. Options come from OptionsSource (a read route) or, if absent, the panel's own state.

type StreamHandler

type StreamHandler func(rc *RequestContext, client ClientStream) error

StreamHandler is a plugin's logic for a WS route, bridging to the browser.

type StreamKind

type StreamKind string

StreamKind tags the long-lived channel a panel binds to.

const (
	StreamTerminal StreamKind = "terminal"
	StreamLogs     StreamKind = "logs"
	StreamQuery    StreamKind = "query"
	StreamDesktop  StreamKind = "desktop"
	StreamMetrics  StreamKind = "metrics"
	StreamTask     StreamKind = "task"
	StreamCanvas   StreamKind = "canvas"
	// StreamResource is a server-push watch of resource state: list deltas for a
	// table/tree or object snapshots for a detail/editor.
	StreamResource StreamKind = "resource"
)

type Summary

type Summary struct {
	Name        string       `json:"name"`
	Title       string       `json:"title"`
	Icon        Icon         `json:"icon"`
	Category    CategoryInfo `json:"category"`
	Description string       `json:"description,omitempty"`
}

Summary is the lightweight catalog entry the connection list needs.

type TableConfig

type TableConfig struct {
	Columns       []Column    `json:"columns,omitempty"`
	ColumnsSource *DataSource `json:"columnsSource,omitempty"`
	Watch         *DataSource `json:"watch,omitempty"`
	ActionIDs     []string    `json:"actionIds,omitempty"`
	RowActionIDs  []string    `json:"rowActionIds,omitempty"`
	// Selectable makes rows selectable (checkboxes) even without RowActionIDs —
	// for a browse table where actions live in the detail view, not a row bar.
	// Declaring RowActionIDs implies it.
	Selectable bool `json:"selectable,omitempty"`

	// RefreshIntervalMs re-fetches the current page on a cadence and replaces it
	// in place — preferred over Watch for high-churn tables where per-row diffs
	// would flood the client.
	RefreshIntervalMs int `json:"refreshIntervalMs,omitempty"`
	// DefaultSort is the column the table sorts by on first load.
	DefaultSort *SortKey `json:"defaultSort,omitempty"`

	Editable  bool        `json:"editable,omitempty"`
	RowKey    []string    `json:"rowKey,omitempty"`
	Insert    *DataSource `json:"insert,omitempty"`
	Update    *DataSource `json:"update,omitempty"`
	Delete    *DataSource `json:"delete,omitempty"`
	EmptyText string      `json:"emptyText,omitempty"`

	// StagedEdits batches local row edits until the user commits or discards them.
	StagedEdits bool `json:"stagedEdits,omitempty"`

	// HiddenColumns omits helper fields when columns are inferred from row data.
	HiddenColumns []string `json:"hiddenColumns,omitempty"`

	// Exportable opts the table into the generic CSV/JSON export of loaded rows.
	// Off by default so a plugin must deliberately allow data to leave the grid.
	Exportable bool `json:"exportable,omitempty"`

	// RowClick overrides the automatic row-body click (navigate a navigable row,
	// else select); empty uses that default.
	RowClick RowClickAction `json:"rowClick,omitempty"`
}

TableConfig drives the generic table panel. Editable tables use RowKey plus Insert/Update/Delete routes with uniform mutation bodies.

type TableRow added in v0.1.13

type TableRow = map[string]any

TableRow is the canonical dynamic record shape for table responses.

type TaskProgressConfig added in v0.1.5

type TaskProgressConfig struct {
	Title         string `json:"title,omitempty"`
	CancelRouteID string `json:"cancelRouteId,omitempty"`
	RetryRouteID  string `json:"retryRouteId,omitempty"`
}

type TerminalConfig

type TerminalConfig struct {
	Zoom   bool `json:"zoom,omitempty"`   // font-size +/- controls and Ctrl/⌘ +/-/0
	Search bool `json:"search,omitempty"` // scrollback find with match navigation
	// Controls re-parameterize the session and reconnect
	Controls []StreamControl `json:"controls,omitempty"`
}

TerminalConfig opts a terminal panel into extra controls. Off by default so a plugin enables only what its terminal needs.

type TerminalControl added in v0.1.7

type TerminalControl struct {
	Type  string     `json:"type"`
	Cols  int        `json:"cols,omitempty"`
	Rows  int        `json:"rows,omitempty"`
	Theme PanelTheme `json:"theme,omitempty"`
}

func ParseTerminalControl added in v0.1.7

func ParseTerminalControl(frame []byte) (TerminalControl, bool)

type TerminalGridConfig added in v0.1.5

type TerminalGridConfig struct {
	MaxPanes     int  `json:"maxPanes,omitempty"`
	DefaultPanes int  `json:"defaultPanes,omitempty"`
	Zoom         bool `json:"zoom,omitempty"`
	Search       bool `json:"search,omitempty"`
}

type TerminalInputEffect added in v0.1.10

type TerminalInputEffect struct {
	Tab           string `json:"tab,omitempty"`
	Text          string `json:"text,omitempty"`
	ResultField   string `json:"resultField,omitempty"`
	AppendNewline bool   `json:"appendNewline,omitempty"`
}

type TimelineConfig added in v0.1.5

type TimelineConfig struct {
	TimestampField    string `json:"timestampField,omitempty"`
	TitleField        string `json:"titleField,omitempty"`
	BodyField         string `json:"bodyField,omitempty"`
	SeverityField     string `json:"severityField,omitempty"`
	IconField         string `json:"iconField,omitempty"`
	ResourceField     string `json:"resourceField,omitempty"`
	EmptyText         string `json:"emptyText,omitempty"`
	RefreshIntervalMs int    `json:"refreshIntervalMs,omitempty"`
	// Watch is an optional StreamResource source, preferred over RefreshIntervalMs.
	Watch *DataSource `json:"watch,omitempty"`
}

type TraceConfig

type TraceConfig struct {
	ServiceField string `json:"serviceField,omitempty"`
}

type Transport

type Transport string

Transport is how a session reaches its target (orthogonal to protocol).

const (
	TransportDirect Transport = "direct"
	TransportAgent  Transport = "agent"
)

type TreeGroup

type TreeGroup struct {
	Key          string            `json:"key"`
	Label        string            `json:"label"`
	Icon         Icon              `json:"icon,omitzero"`
	Source       DataSource        `json:"source,omitzero"`
	ResourceKind string            `json:"resourceKind,omitempty"`
	Ref          *ResourceIdentity `json:"ref,omitempty"`
	Badge        *Badge            `json:"badge,omitempty"`
}

TreeGroup is a lazy connection-sidebar root. With Source it expands; without Source it opens ResourceKind or Ref directly.

type TreeNode

type TreeNode struct {
	Key            string            `json:"key"`
	Label          string            `json:"label"`
	Icon           Icon              `json:"icon,omitzero"`
	Ref            *ResourceIdentity `json:"ref,omitempty"`
	Leaf           bool              `json:"leaf,omitempty"`
	ChildrenSource *DataSource       `json:"childrenSource,omitempty"`
	Badge          *Badge            `json:"badge,omitempty"`
	// ResourceKind opens a resource list instead of a single-resource detail.
	ResourceKind string `json:"resourceKind,omitempty"`
	// ListParams merge into the resource list DataSource params.
	ListParams map[string]string `json:"listParams,omitempty"`
	// Data carries row fields for status badges and action gating.
	Data map[string]any `json:"data,omitempty"`
}

TreeNode is one node returned by a tree DataSource.

type UploadedFile

type UploadedFile struct {
	Field    string
	Filename string
	Size     int64
	Header   textproto.MIMEHeader
	// contains filtered or unexported fields
}

UploadedFile is a multipart file part made available to route handlers. The file bytes are opened lazily so the audit/logging path never materializes them.

func NewUploadedFile

func NewUploadedFile(field string, header *multipart.FileHeader) UploadedFile

NewUploadedFile wraps a parsed multipart file header for RequestContext.

func (UploadedFile) Open

func (f UploadedFile) Open() (multipart.File, error)

Open opens the uploaded file stream. Callers must close it.

type UsageSpec added in v0.1.9

type UsageSpec struct {
	PercentKey string     `json:"percentKey,omitempty"`
	UsedKey    string     `json:"usedKey,omitempty"`
	TotalKey   string     `json:"totalKey,omitempty"`
	UsedType   ColumnType `json:"usedType,omitempty"`
	TotalType  ColumnType `json:"totalType,omitempty"`
	Unit       string     `json:"unit,omitempty"`
	TotalLabel string     `json:"totalLabel,omitempty"`
	WarnAt     float64    `json:"warnAt,omitempty"`
	CriticalAt float64    `json:"criticalAt,omitempty"`
}

type User

type User struct {
	ID          string
	Username    string
	DisplayName string
	Roles       []string
}

User is the lean identity of the acting user handed to a route handler. Authorization is enforced by the core before the handler runs; a handler only needs identity for context and per-owner scoping (e.g. snippets).

type Validator

type Validator struct {
	Type    ValidatorType `json:"type"`
	Value   any           `json:"value,omitempty"`
	Message string        `json:"message,omitempty"`
}

type ValidatorType

type ValidatorType string

ValidatorType is the kind of server-side check applied to a field value.

const (
	ValidatorMin   ValidatorType = "min"
	ValidatorMax   ValidatorType = "max"
	ValidatorRegex ValidatorType = "regex"
	ValidatorOneOf ValidatorType = "oneOf"
)

type WasmAsset added in v0.1.7

type WasmAsset struct {
	Path   string     `json:"path"`
	MIME   string     `json:"mime,omitempty"`
	Source DataSource `json:"source"`
}

type WasmBoot added in v0.1.7

type WasmBoot struct {
	Scripts []string `json:"scripts,omitempty"`
}

type WasmBridge added in v0.1.7

type WasmBridge struct {
	Routes  []WasmBridgeRoute  `json:"routes,omitempty"`
	Streams []WasmBridgeStream `json:"streams,omitempty"`
}

type WasmBridgeRoute added in v0.1.7

type WasmBridgeRoute struct {
	RouteID string            `json:"routeId"`
	Method  Method            `json:"method,omitempty"`
	Params  map[string]string `json:"params,omitempty"`
}

type WasmBridgeStream added in v0.1.7

type WasmBridgeStream struct {
	RouteID string            `json:"routeId"`
	Params  map[string]string `json:"params,omitempty"`
}

type WasmCapabilities added in v0.1.7

type WasmCapabilities struct {
	Keyboard    bool `json:"keyboard,omitempty"`
	Pointer     bool `json:"pointer,omitempty"`
	Audio       bool `json:"audio,omitempty"`
	Fullscreen  bool `json:"fullscreen,omitempty"`
	PointerLock bool `json:"pointerLock,omitempty"`
	Gamepad     bool `json:"gamepad,omitempty"`
}

type WasmConfig added in v0.1.7

type WasmConfig struct {
	Entry        string           `json:"entry"`
	Runtime      WasmRuntime      `json:"runtime,omitempty"`
	Boot         WasmBoot         `json:"boot,omitempty"`
	Assets       []WasmAsset      `json:"assets,omitempty"`
	Width        int              `json:"width,omitempty"`
	Height       int              `json:"height,omitempty"`
	ScaleMode    WasmScaleMode    `json:"scaleMode,omitempty"`
	Capabilities WasmCapabilities `json:"capabilities,omitempty"`
	Bridge       WasmBridge       `json:"bridge,omitempty"`
	AriaLabel    string           `json:"ariaLabel,omitempty"`
	Instructions string           `json:"instructions,omitempty"`
}

WasmConfig declares a sandboxed browser-side app. Entry is the primary app artifact, usually a WASM binary. For generic JavaScript-owned runtimes, boot scripts own startup and may load Entry through the bridge. The core owns the iframe, CSP, asset URLs, and bridge.

type WasmRuntime added in v0.1.7

type WasmRuntime string
const (
	WasmRuntimeGo      WasmRuntime = "go"
	WasmRuntimeGeneric WasmRuntime = "generic"
)

type WasmScaleMode added in v0.1.7

type WasmScaleMode string
const (
	WasmScaleFit    WasmScaleMode = "fit"
	WasmScaleResize WasmScaleMode = "resize"
	WasmScaleScroll WasmScaleMode = "scroll"
)

type WebProxyCapability added in v0.1.20

type WebProxyCapability string
const (
	WebProxyCapabilityClipboard  WebProxyCapability = "clipboard"
	WebProxyCapabilityDownloads  WebProxyCapability = "downloads"
	WebProxyCapabilityFullscreen WebProxyCapability = "fullscreen"
	WebProxyCapabilityPopups     WebProxyCapability = "popups"
	// WebProxyCapabilitySameOrigin lets the embedded page keep a non-opaque
	// origin. Only enable it for trusted, connection-owned surfaces.
	WebProxyCapabilitySameOrigin WebProxyCapability = "same_origin"
)

type WebProxyConfig added in v0.1.20

type WebProxyConfig struct {
	Path          string               `json:"path,omitempty"`
	Capabilities  []WebProxyCapability `json:"capabilities,omitempty"`
	OpenExternal  bool                 `json:"openExternal,omitempty"`
	InlineToolbar *bool                `json:"inlineToolbar,omitempty"`
	AriaLabel     string               `json:"ariaLabel,omitempty"`
	Instructions  string               `json:"instructions,omitempty"`
}

WebProxyConfig embeds the connection-scoped HTTP proxy as a panel.

Directories

Path Synopsis
Package canvas provides helpers for the plugin canvas stream protocol.
Package canvas provides helpers for the plugin canvas stream protocol.
Package webproxy reverse-proxies a browser to an upstream web app and rewrites the response so the app works under a gateway sub-path.
Package webproxy reverse-proxies a browser to an upstream web app and rewrites the response so the app works under a gateway sub-path.

Jump to

Keyboard shortcuts

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