571 lines
22 KiB
Go
571 lines
22 KiB
Go
// Package plugin implements the Reims-Go plugin kernel: unified extension
|
|
// registry, reversible scopes, dependency-driven reconciliation, hook dispatch,
|
|
// start-intent argument ownership ledger, package lifecycle, security broker,
|
|
// L1 declarative rules, and L3 Sidecar supervision.
|
|
package plugin
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
// PluginAPIVersion is the host plugin API contract version (SemVer).
|
|
PluginAPIVersion = "1.0.0"
|
|
// UIAPIVersion is the frontend UI contract version (SemVer).
|
|
UIAPIVersion = "1.0.0"
|
|
// ManifestSchemaVersion is the current plugin.json schema version.
|
|
ManifestSchemaVersion = 1
|
|
)
|
|
|
|
// State represents the runtime lifecycle state of a plugin (§4.1).
|
|
type State string
|
|
|
|
const (
|
|
StateOff State = "off"
|
|
StatePending State = "pending"
|
|
StateActive State = "active"
|
|
StateDegraded State = "degraded"
|
|
StateFailed State = "failed"
|
|
)
|
|
|
|
// TrustLevel classifies the provenance and signature trust of a plugin (§7.2).
|
|
type TrustLevel string
|
|
|
|
const (
|
|
TrustOfficial TrustLevel = "official"
|
|
TrustVerified TrustLevel = "verified"
|
|
TrustCommunity TrustLevel = "community"
|
|
TrustDev TrustLevel = "dev"
|
|
)
|
|
|
|
// Tier identifies the execution isolation layer derived from package contents (§3.1).
|
|
type Tier string
|
|
|
|
const (
|
|
TierBuiltin Tier = "builtin"
|
|
TierL1 Tier = "L1"
|
|
TierRuntime Tier = "runtime"
|
|
TierL2 Tier = "L2"
|
|
TierL3 Tier = "L3"
|
|
TierL4 Tier = "L4"
|
|
)
|
|
|
|
// SourceKind distinguishes where a plugin came from.
|
|
type SourceKind string
|
|
|
|
const (
|
|
SourceBuiltin SourceKind = "builtin"
|
|
SourceBundled SourceKind = "bundled"
|
|
SourceLocal SourceKind = "local"
|
|
SourceMarket SourceKind = "market"
|
|
SourceDevLink SourceKind = "dev"
|
|
)
|
|
|
|
// LocalizedText holds bilingual zh-CN / en-US strings readable without executing code (§6.2).
|
|
type LocalizedText struct {
|
|
ZhCN string `json:"zh-CN,omitempty"`
|
|
EnUS string `json:"en-US,omitempty"`
|
|
}
|
|
|
|
// Get returns the best localized string for locale, falling back cleanly.
|
|
func (lt LocalizedText) Get(locale string) string {
|
|
if strings.HasPrefix(strings.ToLower(locale), "zh") {
|
|
if lt.ZhCN != "" {
|
|
return lt.ZhCN
|
|
}
|
|
return lt.EnUS
|
|
}
|
|
if lt.EnUS != "" {
|
|
return lt.EnUS
|
|
}
|
|
return lt.ZhCN
|
|
}
|
|
|
|
// UnmarshalJSON accepts either a plain string or an object {"zh-CN": ..., "en-US": ...}.
|
|
func (lt *LocalizedText) UnmarshalJSON(data []byte) error {
|
|
var plain string
|
|
if err := json.Unmarshal(data, &plain); err == nil {
|
|
lt.ZhCN = plain
|
|
lt.EnUS = plain
|
|
return nil
|
|
}
|
|
type alias LocalizedText
|
|
var a alias
|
|
if err := json.Unmarshal(data, &a); err != nil {
|
|
return err
|
|
}
|
|
*lt = LocalizedText(a)
|
|
return nil
|
|
}
|
|
|
|
// Engines specifies host compatibility ranges checked before install (§6.2).
|
|
type Engines struct {
|
|
ReimsGo string `json:"reims-go,omitempty"`
|
|
PluginAPI string `json:"pluginApi,omitempty"`
|
|
UIAPI string `json:"uiApi,omitempty"`
|
|
}
|
|
|
|
// Entry declares executable/script/panel entrypoints. Tier is inferred from this (§6.2).
|
|
type Entry struct {
|
|
Sidecar string `json:"sidecar,omitempty"`
|
|
Script string `json:"script,omitempty"`
|
|
PanelDir string `json:"panelDir,omitempty"`
|
|
UIScript string `json:"uiScript,omitempty"`
|
|
}
|
|
|
|
// ServiceRequirement declares a service dependency with an optional SemVer range.
|
|
type ServiceRequirement struct {
|
|
Service string `json:"service"`
|
|
Version string `json:"version,omitempty"`
|
|
Optional bool `json:"optional,omitempty"`
|
|
}
|
|
|
|
// ServiceProvision declares a service provided by a plugin.
|
|
type ServiceProvision struct {
|
|
Service string `json:"service"`
|
|
Version string `json:"version"`
|
|
}
|
|
|
|
// Provenance records upstream build and source archive metadata (mandatory for runtime packages).
|
|
type Provenance struct {
|
|
UpstreamRepo string `json:"upstreamRepo,omitempty"`
|
|
Commit string `json:"commit,omitempty"`
|
|
Patches []string `json:"patches,omitempty"`
|
|
PatchHashes []string `json:"patchHashes,omitempty"`
|
|
SourcePackage string `json:"sourcePackage,omitempty"`
|
|
}
|
|
|
|
// Manifest is the declarative plugin.json descriptor (§6.2).
|
|
type Manifest struct {
|
|
Schema int `json:"schema"`
|
|
ID string `json:"id"`
|
|
Version string `json:"version"`
|
|
Name LocalizedText `json:"name"`
|
|
Description LocalizedText `json:"description"`
|
|
Publisher string `json:"publisher,omitempty"`
|
|
License string `json:"license,omitempty"`
|
|
Homepage string `json:"homepage,omitempty"`
|
|
Engines Engines `json:"engines,omitempty"`
|
|
Platforms []string `json:"platforms,omitempty"`
|
|
Entry Entry `json:"entry,omitempty"`
|
|
Contributes Contributes `json:"contributes,omitempty"`
|
|
Requires []ServiceRequirement `json:"requires,omitempty"`
|
|
Provides []ServiceProvision `json:"provides,omitempty"`
|
|
Permissions []string `json:"permissions,omitempty"`
|
|
Activation []string `json:"activation,omitempty"`
|
|
Settings *SettingsSchema `json:"settings,omitempty"`
|
|
DefaultEnabled bool `json:"defaultEnabled,omitempty"`
|
|
Provenance *Provenance `json:"provenance,omitempty"`
|
|
}
|
|
|
|
// InferTier derives the plugin's execution tier from manifest contents (never trusting self-claims).
|
|
func (m Manifest) InferTier(isBuiltin bool) Tier {
|
|
if isBuiltin {
|
|
return TierBuiltin
|
|
}
|
|
if strings.TrimSpace(m.Entry.Sidecar) != "" {
|
|
return TierL3
|
|
}
|
|
if strings.TrimSpace(m.Entry.Script) != "" {
|
|
return TierL2
|
|
}
|
|
if strings.TrimSpace(m.Entry.PanelDir) != "" || len(m.Contributes.Panels) > 0 {
|
|
return TierL4
|
|
}
|
|
if len(m.Contributes.Runtimes) > 0 {
|
|
return TierRuntime
|
|
}
|
|
return TierL1
|
|
}
|
|
|
|
// Contributes enumerates all extension-point declarations in plugin.json (§4.2).
|
|
type Contributes struct {
|
|
Themes []ThemeContribution `json:"themes,omitempty"`
|
|
UIScripts []UIScriptContribution `json:"uiScripts,omitempty"`
|
|
Locales []LocaleContribution `json:"locales,omitempty"`
|
|
InputFilters []InputFilterContribution `json:"inputFilters,omitempty"`
|
|
VMTemplates []VMTemplateContribution `json:"vmTemplates,omitempty"`
|
|
RuntimeSources []RuntimeSourceContribution `json:"runtimeSources,omitempty"`
|
|
RuntimeKinds []RuntimeKindContribution `json:"runtimeKinds,omitempty"`
|
|
Runtimes []RuntimePackContribution `json:"runtimes,omitempty"`
|
|
GuestDrivers []GuestDriverContribution `json:"guestDrivers,omitempty"`
|
|
Hooks []HookContribution `json:"hooks,omitempty"`
|
|
RuleHooks []RuleHook `json:"ruleHooks,omitempty"`
|
|
Commands []CommandContribution `json:"commands,omitempty"`
|
|
Menus []MenuContribution `json:"menus,omitempty"`
|
|
VMCards []VMCardContribution `json:"vmCards,omitempty"`
|
|
SettingsPages []SettingsPageContribution `json:"settingsPages,omitempty"`
|
|
StatusItems []StatusItemContribution `json:"statusItems,omitempty"`
|
|
Panels []PanelContribution `json:"panels,omitempty"`
|
|
Diagnostics []DiagnosticsContribution `json:"diagnostics,omitempty"`
|
|
}
|
|
|
|
// ThemeContribution describes a L1 token/style theme or tier-3 interactive theme (§5.1).
|
|
type ThemeContribution struct {
|
|
ID string `json:"id"`
|
|
Name LocalizedText `json:"name"`
|
|
Description LocalizedText `json:"description,omitempty"`
|
|
Appearance string `json:"appearance,omitempty"` // "light" | "dark" | "both"
|
|
Seeds map[string]string `json:"seeds,omitempty"`
|
|
Schemes []ThemeScheme `json:"schemes,omitempty"`
|
|
DeriveRules []TokenDeriveRule `json:"deriveRules,omitempty"`
|
|
Tokens map[string]string `json:"tokens,omitempty"`
|
|
DarkTokens map[string]string `json:"darkTokens,omitempty"`
|
|
Fonts []ThemeFont `json:"fonts,omitempty"`
|
|
Icons map[string]string `json:"icons,omitempty"`
|
|
BrandMark string `json:"brandMark,omitempty"`
|
|
Background string `json:"background,omitempty"`
|
|
Sounds map[string]string `json:"sounds,omitempty"`
|
|
Stylesheet string `json:"stylesheet,omitempty"` // relative path inside package
|
|
Decorations []ThemeDecoration `json:"decorations,omitempty"`
|
|
UIScript string `json:"uiScript,omitempty"` // requires ui:script
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// ThemeScheme is a named seed-color preset inside a theme pack.
|
|
type ThemeScheme struct {
|
|
ID string `json:"id"`
|
|
Name LocalizedText `json:"name"`
|
|
Appearance string `json:"appearance,omitempty"` // "light" | "dark" | "both"
|
|
Seeds map[string]string `json:"seeds"`
|
|
}
|
|
|
|
// TokenDeriveRule derives a CSS custom property from a seed color using
|
|
// declarative lightness/chroma/alpha adjustments per light/dark appearance.
|
|
type TokenDeriveRule struct {
|
|
Token string `json:"token"`
|
|
FromSeed string `json:"fromSeed"`
|
|
Appearance string `json:"appearance,omitempty"` // "" (both) | "light" | "dark"
|
|
Lightness float64 `json:"lightness,omitempty"` // delta in [-1, 1]
|
|
Chroma float64 `json:"chroma,omitempty"` // scale multiplier (0 = unchanged)
|
|
Alpha float64 `json:"alpha,omitempty"` // 0 = opaque / unchanged, (0,1] sets alpha
|
|
}
|
|
|
|
// ThemeFont declares a bundled font face.
|
|
type ThemeFont struct {
|
|
Family string `json:"family"`
|
|
File string `json:"file"`
|
|
Weight string `json:"weight,omitempty"`
|
|
Style string `json:"style,omitempty"`
|
|
UnicodeRange string `json:"unicodeRange,omitempty"`
|
|
}
|
|
|
|
// ThemeDecoration defines a declarative state-driven sprite/frame decoration anchored to a slot.
|
|
type ThemeDecoration struct {
|
|
ID string `json:"id"`
|
|
Slot string `json:"slot"` // e.g. "sidebar.footer", "vm.preview.br"
|
|
Width int `json:"width,omitempty"`
|
|
Height int `json:"height,omitempty"`
|
|
Alt LocalizedText `json:"alt,omitempty"`
|
|
States []ThemeDecorationState `json:"states"`
|
|
}
|
|
|
|
// ThemeDecorationState maps a state expression (e.g. "vmState==running") to a static/animated asset.
|
|
type ThemeDecorationState struct {
|
|
When string `json:"when"` // "default", "vmState==running", "busy==true", etc.
|
|
Asset string `json:"asset,omitempty"`
|
|
Frames []string `json:"frames,omitempty"`
|
|
FPS int `json:"fps,omitempty"`
|
|
}
|
|
|
|
// UIScriptContribution registers a trusted interactive theme script.
|
|
type UIScriptContribution struct {
|
|
ID string `json:"id"`
|
|
ThemeID string `json:"themeId"`
|
|
Script string `json:"script"`
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// LocaleContribution registers additional UI translations.
|
|
type LocaleContribution struct {
|
|
Locale string `json:"locale"`
|
|
File string `json:"file,omitempty"`
|
|
Messages map[string]string `json:"messages,omitempty"`
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// InputFilterContribution declares a host-side input filter rule (§5.4).
|
|
type InputFilterContribution struct {
|
|
ID string `json:"id"`
|
|
Event string `json:"event"` // "mouse_wheel"
|
|
Axis string `json:"axis,omitempty"` // "vertical" | "horizontal" | "both"
|
|
Transform string `json:"transform"` // "invert"
|
|
Scope string `json:"scope"` // "vm_foreground"
|
|
SettingKey string `json:"settingKey,omitempty"` // VM-scoped boolean key
|
|
HorizKey string `json:"horizontalKey,omitempty"`
|
|
VertKey string `json:"verticalKey,omitempty"`
|
|
Name LocalizedText `json:"name,omitempty"`
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// VMTemplateContribution contributes a VM creation preset.
|
|
type VMTemplateContribution struct {
|
|
ID string `json:"id"`
|
|
DriverID string `json:"driverId,omitempty"`
|
|
Name LocalizedText `json:"name"`
|
|
Description LocalizedText `json:"description,omitempty"`
|
|
Defaults map[string]any `json:"defaults,omitempty"`
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// RuntimeSourceContribution contributes an additional runtime download mirror/source.
|
|
type RuntimeSourceContribution struct {
|
|
ID string `json:"id"`
|
|
Kind string `json:"kind"`
|
|
Name LocalizedText `json:"name"`
|
|
IndexURL string `json:"indexUrl"`
|
|
Channel string `json:"channel,omitempty"`
|
|
License string `json:"license,omitempty"`
|
|
Publisher string `json:"publisher,omitempty"`
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// RuntimeKindContribution registers a new runtime kind (e.g. "qemu-ovmf").
|
|
type RuntimeKindContribution struct {
|
|
Kind string `json:"kind"`
|
|
Name LocalizedText `json:"name"`
|
|
Description LocalizedText `json:"description,omitempty"`
|
|
RequiredFiles []string `json:"requiredFiles,omitempty"`
|
|
DefaultAPIVer string `json:"defaultApiVersion,omitempty"`
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// RuntimePackContribution declares an archive/binary runtime package inside a plugin.
|
|
type RuntimePackContribution struct {
|
|
Kind string `json:"kind"`
|
|
Version string `json:"version"`
|
|
RuntimeAPI string `json:"runtimeApi"`
|
|
Capabilities []string `json:"capabilities,omitempty"`
|
|
Dir string `json:"dir,omitempty"`
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// GuestDriverContribution declares a guest VM driver provided by an L3 Sidecar or builtin.
|
|
type GuestDriverContribution struct {
|
|
ID string `json:"id"`
|
|
Name LocalizedText `json:"name"`
|
|
Description LocalizedText `json:"description,omitempty"`
|
|
RuntimeKind string `json:"runtimeKind"`
|
|
RuntimeAPIRange string `json:"runtimeApiRange,omitempty"`
|
|
Capabilities []string `json:"capabilities,omitempty"`
|
|
CreateSchema *SettingsSchema `json:"createSchema,omitempty"`
|
|
SettingsSchema *SettingsSchema `json:"settingsSchema,omitempty"`
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// HookContribution subscribes a Sidecar or L2 script to a lifecycle event.
|
|
type HookContribution struct {
|
|
Event string `json:"event"`
|
|
Priority int `json:"priority,omitempty"`
|
|
Blocking bool `json:"blocking,omitempty"`
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// CommandContribution exposes a command callable via CLI (`plugin run`) or GUI menu.
|
|
type CommandContribution struct {
|
|
ID string `json:"id"`
|
|
Title LocalizedText `json:"title"`
|
|
Description LocalizedText `json:"description,omitempty"`
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// MenuContribution contributes a button/menu item to a declared UI slot (e.g. vm.toolbar).
|
|
type MenuContribution struct {
|
|
ID string `json:"id"`
|
|
Slot string `json:"slot"` // "vm.toolbar"
|
|
Command string `json:"command"`
|
|
Title LocalizedText `json:"title"`
|
|
When string `json:"when,omitempty"`
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// VMCardContribution contributes key-value info to `vm.card`.
|
|
type VMCardContribution struct {
|
|
ID string `json:"id"`
|
|
Title LocalizedText `json:"title"`
|
|
Value LocalizedText `json:"value,omitempty"`
|
|
Badge string `json:"badge,omitempty"` // "ok" | "warn" | "idle" | "error"
|
|
When string `json:"when,omitempty"`
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// SettingsPageContribution declares a plugin settings group.
|
|
type SettingsPageContribution struct {
|
|
ID string `json:"id"`
|
|
Title LocalizedText `json:"title"`
|
|
Group string `json:"group,omitempty"` // e.g. "keyboard", "collaboration", "general"
|
|
Scope string `json:"scope,omitempty"` // "app" | "vm"
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// StatusItemContribution contributes an item to `statusbar.right`.
|
|
type StatusItemContribution struct {
|
|
ID string `json:"id"`
|
|
Slot string `json:"slot"` // "statusbar.right"
|
|
Text LocalizedText `json:"text"`
|
|
Tooltip LocalizedText `json:"tooltip,omitempty"`
|
|
Command string `json:"command,omitempty"`
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// PanelContribution declares an L4 sandboxed iframe panel in a declared slot.
|
|
type PanelContribution struct {
|
|
ID string `json:"id"`
|
|
Slot string `json:"slot"` // "settings.plugin" | "vm.card" | "sidebar.footer"
|
|
Title LocalizedText `json:"title"`
|
|
Entry string `json:"entry"` // relative HTML file under entry.panelDir
|
|
Height int `json:"height,omitempty"`
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// DiagnosticsContribution declares a diagnostics collector.
|
|
type DiagnosticsContribution struct {
|
|
ID string `json:"id"`
|
|
Title LocalizedText `json:"title"`
|
|
PluginID string `json:"pluginId,omitempty"`
|
|
}
|
|
|
|
// SettingsSchema is a JSON Schema subset with Reims-Go extensions (§6.2).
|
|
type SettingsSchema struct {
|
|
Title LocalizedText `json:"title,omitempty"`
|
|
Group string `json:"x-group,omitempty"` // e.g. "keyboard", "collaboration"
|
|
Scope string `json:"x-scope,omitempty"` // "app" | "vm"
|
|
Properties map[string]SettingProperty `json:"properties"`
|
|
Order []string `json:"x-order,omitempty"`
|
|
}
|
|
|
|
// SettingProperty describes one configurable field.
|
|
type SettingProperty struct {
|
|
Type string `json:"type"` // "boolean" | "string" | "number" | "integer"
|
|
Title LocalizedText `json:"title"`
|
|
Description LocalizedText `json:"description,omitempty"`
|
|
Default any `json:"default,omitempty"`
|
|
Enum []string `json:"enum,omitempty"`
|
|
EnumLabels []LocalizedText `json:"x-enumLabels,omitempty"`
|
|
Minimum *float64 `json:"minimum,omitempty"`
|
|
Maximum *float64 `json:"maximum,omitempty"`
|
|
Secret bool `json:"x-secret,omitempty"`
|
|
Effect string `json:"x-effect,omitempty"` // "immediate" | "next_start"
|
|
Scope string `json:"x-scope,omitempty"` // "app" | "vm"
|
|
Group string `json:"x-group,omitempty"` // VM settings section id
|
|
Required bool `json:"required,omitempty"`
|
|
}
|
|
|
|
// PermissionLevel categorizes permission risk (§7.1).
|
|
type PermissionLevel string
|
|
|
|
const (
|
|
PermLow PermissionLevel = "low"
|
|
PermMedium PermissionLevel = "medium"
|
|
PermHigh PermissionLevel = "high"
|
|
PermForbidden PermissionLevel = "forbidden"
|
|
)
|
|
|
|
// PermissionSpec classifies a declared permission string.
|
|
type PermissionSpec struct {
|
|
Name string `json:"name"`
|
|
Level PermissionLevel `json:"level"`
|
|
}
|
|
|
|
// ClassifyPermission returns the risk tier of a permission per §7.1.
|
|
func ClassifyPermission(perm string) PermissionLevel {
|
|
p := strings.TrimSpace(perm)
|
|
switch p {
|
|
case "vm:read", "ui:notify", "task:progress", "fs:plugin_data", "log:read":
|
|
return PermLow
|
|
case "vm:intent", "runtime:source", "ui:slot", "input:filter":
|
|
return PermMedium
|
|
case "driver:vm", "runtime:provider", "process:spawn", "vm:control",
|
|
"qmp:write", "fs:vm_dir", "fs:shared", "host:clipboard", "ui:script":
|
|
return PermHigh
|
|
}
|
|
if strings.HasPrefix(p, "net:") && len(p) > len("net:") {
|
|
return PermMedium
|
|
}
|
|
return PermForbidden
|
|
}
|
|
|
|
// HasHighRiskPermission returns all high-risk permissions in perms.
|
|
func HighRiskPermissions(perms []string) []string {
|
|
var out []string
|
|
for _, p := range perms {
|
|
if ClassifyPermission(p) == PermHigh {
|
|
out = append(out, p)
|
|
}
|
|
}
|
|
return out
|
|
}
|
|
|
|
// ForbiddenPermissions returns any unrecognized/forbidden permissions in perms.
|
|
func ForbiddenPermissions(perms []string) []string {
|
|
var out []string
|
|
for _, p := range perms {
|
|
if ClassifyPermission(p) == PermForbidden {
|
|
out = append(out, p)
|
|
}
|
|
}
|
|
return out
|
|
}
|
|
|
|
// DeclaredUISlots lists the host-declared UI slots and their max item caps (§4.2).
|
|
var DeclaredUISlots = map[string]int{
|
|
"vm.toolbar": 8,
|
|
"vm.card": 6,
|
|
"settings.plugin": 16,
|
|
"sidebar.footer": 2,
|
|
"statusbar.right": 4,
|
|
"create.source": 4,
|
|
"vm.preview.tl": 2,
|
|
"vm.preview.tr": 2,
|
|
"vm.preview.bl": 2,
|
|
"vm.preview.br": 2,
|
|
"empty.state": 2,
|
|
}
|
|
|
|
// IsDeclaredSlot checks whether slot is a host-recognized UI slot.
|
|
func IsDeclaredSlot(slot string) bool {
|
|
_, ok := DeclaredUISlots[slot]
|
|
return ok
|
|
}
|
|
|
|
// PluginInfo is the read-only UI/CLI view of an installed or builtin plugin.
|
|
type PluginInfo struct {
|
|
ID string `json:"id"`
|
|
Version string `json:"version"`
|
|
Name LocalizedText `json:"name"`
|
|
Description LocalizedText `json:"description"`
|
|
Publisher string `json:"publisher,omitempty"`
|
|
License string `json:"license,omitempty"`
|
|
Homepage string `json:"homepage,omitempty"`
|
|
Source SourceKind `json:"source"`
|
|
Trust TrustLevel `json:"trust"`
|
|
Tier Tier `json:"tier"`
|
|
State State `json:"state"`
|
|
Enabled bool `json:"enabled"`
|
|
Removable bool `json:"removable"`
|
|
InUse bool `json:"in_use"`
|
|
Error string `json:"error,omitempty"`
|
|
DegradedReason string `json:"degraded_reason,omitempty"`
|
|
Permissions []PermissionSpec `json:"permissions,omitempty"`
|
|
ApprovedPermissions []string `json:"approved_permissions,omitempty"`
|
|
NeedsApproval bool `json:"needs_approval"`
|
|
Requires []string `json:"requires,omitempty"`
|
|
Provides []string `json:"provides,omitempty"`
|
|
Settings *SettingsSchema `json:"settings,omitempty"`
|
|
InstallDir string `json:"install_dir,omitempty"`
|
|
EntryHash string `json:"entry_hash,omitempty"`
|
|
EntryPath string `json:"entry_path,omitempty"`
|
|
LogPath string `json:"log_path,omitempty"`
|
|
UpdatedAt time.Time `json:"updated_at,omitempty"`
|
|
}
|
|
|
|
// DiagnosticsEntry is one redacted diagnostic section contributed by a plugin.
|
|
type DiagnosticsEntry struct {
|
|
PluginID string `json:"plugin_id"`
|
|
Title string `json:"title"`
|
|
Data map[string]any `json:"data,omitempty"`
|
|
Text string `json:"text,omitempty"`
|
|
}
|