Documentation
¶
Index ¶
- Constants
- func CleanRelativePath(p string) bool
- func Dirs(project string) []string
- type Manager
- func (m *Manager) Get(name string) (Plugin, bool)
- func (m *Manager) Hook(ctx context.Context, event string, payload any, policy *sandbox.Policy) error
- func (m *Manager) Install(src string) error
- func (m *Manager) Invoke(ctx context.Context, name string, args json.RawMessage, policy *sandbox.Policy) (string, error)
- func (m *Manager) List() []Plugin
- func (m *Manager) Platform() string
- func (m *Manager) Project() string
- func (m *Manager) PromptBlock() string
- func (m *Manager) Reload() error
- func (m *Manager) Remove(name string) error
- func (m *Manager) RunHook(ctx context.Context, event hooks.Event) error
- func (m *Manager) SetEnabled(name string, enabled bool) error
- func (m *Manager) Source(p Plugin) string
- func (m *Manager) Tools() []Tool
- type Manifest
- type Panel
- type Plugin
- type Tool
- type UI
Constants ¶
View Source
const ( PlacementSidePane = "sidePane" PlacementSettings = "settings" // MaxPanels bounds the panels one plugin may declare. MaxPanels = 8 // DefaultUIRoot is UI.Root when the manifest leaves it empty. DefaultUIRoot = "ui" )
Variables ¶
This section is empty.
Functions ¶
func CleanRelativePath ¶ added in v0.107.42
CleanRelativePath reports whether p is a slash-separated relative path whose segments are all ordinary names: no empty, "." or ".." segments, no dot files, backslashes, colons or control characters. Such a path can only name something below the directory it is resolved against.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) Project ¶ added in v0.107.42
Project is the workspace whose plugins this manager loads; empty when it loads user plugins only.
func (*Manager) PromptBlock ¶
func (*Manager) SetEnabled ¶
SetEnabled saves name's enabled state on top of the state saved meanwhile by other managers or processes.
type Manifest ¶
type Manifest struct {
Name string `json:"name"`
Version string `json:"version,omitempty"`
Description string `json:"description,omitempty"`
Prompt string `json:"prompt,omitempty"`
Command []string `json:"command,omitempty"`
Tools []Tool `json:"tools,omitempty"`
Hooks map[string]string `json:"hooks,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
// UI declares static web panels a graphical client may show. They are
// plain files under the plugin directory, served read-only and rendered in
// a sandboxed frame; nothing in them runs in K-brain itself.
UI *UI `json:"ui,omitempty"`
}
type Panel ¶ added in v0.107.42
type Panel struct {
ID string `json:"id"`
Title string `json:"title"`
// Entry is the panel's HTML page, relative to Root.
Entry string `json:"entry"`
// Placement says where a client shows the panel: PlacementSidePane or
// PlacementSettings.
Placement string `json:"placement"`
}
Panel is one UI panel.
type Tool ¶
type Tool struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
InputSchema json.RawMessage `json:"inputSchema,omitempty"`
}
type UI ¶ added in v0.107.42
type UI struct {
// Root is the directory, relative to the plugin directory, that holds
// every file a panel may load; "ui" when empty. Nothing outside it is
// served.
Root string `json:"root,omitempty"`
Panels []Panel `json:"panels"`
}
UI is the "ui" section of plugin.json.
Click to show internal directories.
Click to hide internal directories.