plugin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	DefaultPageLimit = 50
	MaxPageLimit     = 500
)

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

View Source
const (
	// CredentialField is the conventional config key for a credential_ref field.
	CredentialField = "credential_id"

	CredentialSecret   = "_credential_secret"
	CredentialIdentity = "_credential_identity"
	CredentialKindKey  = "_credential_kind"
)
View Source
const (
	SchemaContextTransport = "$transport"
	SchemaContextProtocol  = "$protocol"
)
View Source
const CurrentAPIVersion = 1

CurrentAPIVersion is the plugin contract version this core supports.

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 CredentialIdentityKey

func CredentialIdentityKey(field string) string

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; the registry derives support from plugin credential_ref selectors.

Prefer Registry.CredentialKindSupportsProtocol when validating user data.

func CredentialResolvedKindKey

func CredentialResolvedKindKey(field string) string

func CredentialSecretKey

func CredentialSecretKey(field string) string

func FilterRows

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

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

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"`
	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"`
	// 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"`
}

Action is a UI affordance over a route.

type ActionSuccess

type ActionSuccess struct {
	SelectTab string `json:"selectTab,omitempty"`
	// Navigate moves the workbench after success.
	Navigate NavigateTarget `json:"navigate,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 models.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 Badge

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

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"`
}

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"`
	// ReadOnly keeps server-managed values out of the inline editor. Nullable
	// lets the editor 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 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"
	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"`
}

Condition is a structured visibility predicate.

type ConnectConfig

type ConnectConfig struct {
	ConnectionID string
	Transport    Transport
	Config       map[string]any
	Net          NetTransport
}

ConnectConfig is the decrypted config plus core-built transport.

func (ConnectConfig) CredentialIdentityFor

func (c ConnectConfig) CredentialIdentityFor(field string) string

func (ConnectConfig) CredentialKindFor

func (c ConnectConfig) CredentialKindFor(field string) CredentialKind

func (ConnectConfig) CredentialSecretFor

func (c ConnectConfig) CredentialSecretFor(field string) string

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

func (c ConnectConfig) String(key string) string

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

type CredentialKind

type CredentialKind string

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

const (
	CredentialTLSClientCert  CredentialKind = "tls_client_cert"
	CredentialDBPassword     CredentialKind = "db_password"
	CredentialAPIToken       CredentialKind = "api_token"
	CredentialCloudAccessKey CredentialKind = "cloud_access_key"
	CredentialBasicAuth      CredentialKind = "basic_auth"
	CredentialBearerToken    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"`
	SecretLabel         string         `json:"secretLabel"`
	SecretMultiline     bool           `json:"secretMultiline,omitempty"`
	IdentityLabel       string         `json:"identityLabel,omitempty"`
	CompatibleProtocols []string       `json:"compatibleProtocols,omitempty"`
}

CredentialKindInfo is the public metadata for a reusable credential kind. It describes how the control-plane UI should label non-secret fields and which protocols can consume the kind.

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.

Prefer Registry.CredentialKindLookup when validating user data.

func CredentialKinds

func CredentialKinds() []CredentialKindInfo

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

Prefer Registry.CredentialKinds for user-facing APIs; it includes plugin declared kinds as well.

type CredentialSelector

type CredentialSelector struct {
	Kinds     []CredentialKind `json:"kinds"`
	Protocols []string         `json:"protocols,omitempty"`
	Required  bool             `json:"required,omitempty"`
}

CredentialSelector constrains which reusable credentials a credential_ref field accepts. 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 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"`
	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"`
}

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"`
	ReadRouteID     string `json:"readRouteId,omitempty"`
	DownloadRouteID string `json:"downloadRouteId,omitempty"`
	WriteRouteID    string `json:"writeRouteId,omitempty"`
	UploadRouteID   string `json:"uploadRouteId,omitempty"`
	MkdirRouteID    string `json:"mkdirRouteId,omitempty"`
	RenameRouteID   string `json:"renameRouteId,omitempty"`
	DeleteRouteID   string `json:"deleteRouteId,omitempty"`
	// Bulk-operation slots over a multi-selection; each slot is optional.
	MoveRouteID     string `json:"moveRouteId,omitempty"`
	CopyRouteID     string `json:"copyRouteId,omitempty"`
	ChmodRouteID    string `json:"chmodRouteId,omitempty"`
	ArchiveRouteID  string `json:"archiveRouteId,omitempty"`
	Writable        bool   `json:"writable,omitempty"`
	MultipleUpload  bool   `json:"multipleUpload,omitempty"`
	MaxUploadBytes  int64  `json:"maxUploadBytes,omitempty"`
	UploadFieldName string `json:"uploadFieldName,omitempty"`
}

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"`
}

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"`
}

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"`
}

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

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

MetricsConfig selects the stat, gauge, and series keys rendered from metric stream frames.

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

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"`
	// Span is a dashboard-only sizing hint.
	Span int `json:"span,omitempty"`
}

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

type PanelConfig

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

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

type PanelType

type PanelType string

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

const (
	PanelTerminal      PanelType = "terminal"
	PanelFileBrowser   PanelType = "file_browser"
	PanelTable         PanelType = "table"
	PanelMetrics       PanelType = "metrics"
	PanelLogStream     PanelType = "log_stream"
	PanelCodeEditor    PanelType = "code_editor"
	PanelDocument      PanelType = "document"
	PanelQueryEditor   PanelType = "query_editor"
	PanelRemoteDesktop PanelType = "remote_desktop"
	PanelForm          PanelType = "form"
	PanelEnroll        PanelType = "enroll"
	PanelDashboard     PanelType = "dashboard"

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

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"`
	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"`
	IconOnly        bool              `json:"iconOnly,omitempty"`
	Group           string            `json:"group,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.

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"`
}

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 Registry

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

Registry holds the compiled-in plugins. It validates each manifest on registration and indexes routes by id for fast resolution.

func NewRegistry

func NewRegistry() *Registry

NewRegistry returns an empty registry.

func (*Registry) All

func (r *Registry) All() []Plugin

All returns every registered plugin, ordered by name.

func (*Registry) CredentialKindLookup

func (r *Registry) CredentialKindLookup(kind CredentialKind) (CredentialKindInfo, bool)

CredentialKindLookup returns one credential kind's metadata.

func (*Registry) CredentialKindSupportsProtocol

func (r *Registry) CredentialKindSupportsProtocol(kind CredentialKind, protocol string) bool

CredentialKindSupportsProtocol reports whether a credential kind may be explicitly scoped to protocol.

func (*Registry) CredentialKinds

func (r *Registry) CredentialKinds() []CredentialKindInfo

CredentialKinds returns every registered credential kind: core shared kinds followed by plugin-declared kinds in plugin registration order.

func (*Registry) Get

func (r *Registry) Get(name string) (Plugin, bool)

Get returns the plugin singleton by name.

func (*Registry) Manifest

func (r *Registry) Manifest(name string) (Manifest, bool)

Manifest returns the (already validated) manifest by name.

func (*Registry) MustRegister

func (r *Registry) MustRegister(p Plugin)

MustRegister panics on registration failure — for wiring at startup.

func (*Registry) Projection

func (r *Registry) Projection(name string) (Projection, bool)

Projection returns the render-only projection for a plugin by name.

func (*Registry) Register

func (r *Registry) Register(p Plugin) error

Register validates a plugin's manifest + routes and adds it. It is safe for concurrent use and rejects duplicates.

func (*Registry) Route

func (r *Registry) Route(plugin, routeID string) (Route, bool)

Route resolves a plugin's route by id.

func (*Registry) Summaries

func (r *Registry) Summaries() []Summary

Summaries returns the lightweight catalog the connection list needs.

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     models.User
	Session  Session
	Snippets SnippetStore
	// 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 models.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 models.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 models.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) 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) 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) WithSnippets

func (rc *RequestContext) WithSnippets(snippets SnippetStore) *RequestContext

WithSnippets attaches the platform snippet store to a request context.

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      ResourceRef `json:"ref"`
	Resource any         `json:"resource,omitempty"`
}

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

type ResourceRef

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

ResourceRef is a managed object's stable identity and display label. 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 // stable UI/audit/policy handle
	Method     Method
	Path       string // plugin-relative mount path
	Permission string // required permission key (server-only)
	Risk       RiskLevel
	AuditEvent string
	Input      *Schema // core validates the body against this before the handler

	Timeout time.Duration // 0 = core default

	Handle Handler       // for HTTP methods
	Stream StreamHandler // for Method == WS
}

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 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. Open vocabulary: the renderer falls back to a select for names it doesn't recognize.

const (
	ScopeSelect      ScopeControl = "select" // default
	ScopeMultiSelect ScopeControl = "multiselect"
	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"`
	OptionsSource *DataSource    `json:"optionsSource,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 SnippetStore

type SnippetStore interface {
	Create(ctx context.Context, s *models.Snippet) error
	Get(ctx context.Context, id string) (models.Snippet, error)
	ListByOwner(ctx context.Context, ownerID, protocol string) ([]models.Snippet, error)
	Update(ctx context.Context, s *models.Snippet) error
	Delete(ctx context.Context, id string) error
}

SnippetStore is the small platform store surface exposed for generic snippet routes. It keeps plugins from depending on the concrete store package.

type SortKey

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

SortKey is one ordering directive for a list route.

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 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"
	StreamDesktop  StreamKind = "desktop"
	StreamMetrics  StreamKind = "metrics"
	StreamFile     StreamKind = "file"
)

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

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

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          *ResourceRef `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            *ResourceRef `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 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"
)

Jump to

Keyboard shortcuts

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