plugins

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 44 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const CardMaxQrBytes = 2048

Variables

This section is empty.

Functions

func ComposerStatistics

func ComposerStatistics(statistics *protocol.ConversationStatistics) (json.RawMessage, error)

func PublicToolResult

func PublicToolResult(result json.RawMessage) json.RawMessage

PublicToolResult is a tool's result as a script reads it: a Node output takes the scripts' public form, and any other value, or an output scripts may not read in that form, stays as the model received it.

func ThemeSnapshot

func ThemeSnapshot(palette *theme.Palette) json.RawMessage

Types

type Bundle

type CallbackRef

type CallbackRef struct {
	Generation uint64 `json:"generation"`
	ID         uint64 `json:"id"`
}

type CardAction

type CardAction struct {
	Kind   string                   `json:"kind"`
	Target *string                  `json:"target,omitempty"`
	Mode   *protocol.PluginCardMode `json:"mode,omitempty"`
}

type CardBindings

type CardBindings struct {
	Context       context.Context
	Summary       protocol.PluginCardSummary
	Declaration   protocol.PluginCardDeclaration
	Locale        string
	Native        *NativeBinding
	Clock         clockwork.Clock
	ValidateProps func(json.RawMessage) bool
	Status        func(context.Context) (protocol.PluginConnectionStatus, error)
	Action        func(string, CardAction)
	Toast         func(string, bool)
}

type CardHost

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

func NewCardHost

func NewCardHost(binding CardBindings) (*CardHost, error)

func (*CardHost) Close

func (host *CardHost) Close() error

func (*CardHost) Components

func (host *CardHost) Components() []NativeComponent

func (*CardHost) Login

func (host *CardHost) Login(state string, canOpen, canCancel bool)

func (*CardHost) Modules

func (host *CardHost) Modules() []HostModule

func (*CardHost) Permits

func (host *CardHost) Permits(action CardAction) bool

func (*CardHost) Refresh

func (host *CardHost) Refresh(identity string)

func (*CardHost) State

func (host *CardHost) State() CardState

func (*CardHost) Target

func (host *CardHost) Target(name string, mode protocol.PluginCardMode) (protocol.PluginCardTarget, bool)

type CardState

type CardState struct {
	Cursor     string          `json:"cursor"`
	Props      json.RawMessage `json:"props"`
	Configured bool            `json:"configured"`
	Login      string          `json:"login"`
	CanOpen    bool            `json:"can_open"`
	CanCancel  bool            `json:"can_cancel"`
	Action     *string         `json:"action"`
	Locale     string          `json:"locale,omitempty"`
}

type ContributionEntry

type ContributionEntry struct {
	Key         ContributionKey               `json:"key"`
	Declaration protocol.PluginUiContribution `json:"declaration"`
	State       protocol.PluginUiState        `json:"state"`
	Retry       bool                          `json:"retry"`
}

type ContributionHooks

type ContributionHooks struct {
	Publish func(json.RawMessage) error
	Close   func(string) error
	Next    func(context.Context) (json.RawMessage, error)
}

type ContributionKey

type ContributionKey struct {
	Node       protocol.NodeID          `json:"node"`
	Worktree   *protocol.WorktreeID     `json:"worktree"`
	Session    *protocol.SessionID      `json:"session"`
	Package    protocol.PluginReference `json:"package"`
	ID         string                   `json:"id"`
	Generation uint64                   `json:"generation"`
}

type ElementStyle

type ElementStyle struct {
	Name      string            `json:"name"`
	Arguments []json.RawMessage `json:"arguments"`
}

type Host

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

func NewHost

func NewHost(binding HostBinding) *Host

func (*Host) Close

func (owner *Host) Close() error

func (*Host) Disconnect

func (owner *Host) Disconnect() error

func (*Host) Enter

func (owner *Host) Enter()

func (*Host) Modules

func (owner *Host) Modules() ([]HostModule, error)

func (*Host) Native

func (owner *Host) Native() NativeBinding

func (*Host) Observe

func (owner *Host) Observe(cursor, packageCursor, settled uint64, connected bool)

func (*Host) ObserveSettings

func (owner *Host) ObserveSettings(rows []protocol.PluginSummary, connected bool)

func (*Host) ObserveTerminalTools

func (owner *Host) ObserveTerminalTools(revision uint64)

func (*Host) RetainSettings

func (owner *Host) RetainSettings() bool

func (*Host) SetUsageSample

func (owner *Host) SetUsageSample(sample *UsageSample)

SetUsageSample has the usage calls answer from sample, or from the Nodes again when it is nil. It wakes the calls that wait for the sources and moves the page's watch over, so an open page draws the other figures.

func (*Host) SetVisible

func (owner *Host) SetVisible(visible bool)

type HostBinding

type HostBinding struct {
	// ExecutionResources keeps a host-owned view on its mounted Node.
	ExecutionResources bool
	Context            context.Context
	Client             *client.Client
	Resources          *client.Client
	Target             protocol.NodeID
	Scope              protocol.PluginContext
	Locale             string
	Contributions      ContributionHooks
	Native             *NativeBinding
	Clock              clockwork.Clock
	ReadFiles          bool
	Actions            []protocol.PluginAction
	UsageSources       func() []UsageSource
	UsageChanges       <-chan struct{}
	// UsageSample is the sample the usage calls answer from at first;
	// SetUsageSample changes it.
	UsageSample *UsageSample
	// SshDirectoryCache retains recent SSH directory listings across view
	// remounts; its owner clears it on close or disconnect.
	SshDirectoryCache *SshDirectoryCache
}

type HostExport

type HostExport struct {
	Name  string
	Sync  HostOperation
	Async HostOperation
}

type HostModule

type HostModule struct {
	Name    string
	Exports []HostExport
}

type HostOperation

type HostOperation func(context.Context, []json.RawMessage) (json.RawMessage, error)

type Mounted

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

func (*Mounted) Close

func (mounted *Mounted) Close() error

func (*Mounted) Context

func (mounted *Mounted) Context() PluginContext

func (*Mounted) Dispatch

func (mounted *Mounted) Dispatch(callback CallbackRef, event json.RawMessage) error

func (*Mounted) Error

func (mounted *Mounted) Error() error

func (*Mounted) MemoryBytes

func (mounted *Mounted) MemoryBytes() (uint64, bool)

MemoryBytes estimates the JavaScript heap this view retains, including values registered through AddLiveRoots. Shared builtins and the host's Go, native and image resources are outside this approximate JS-only account. Call it on the VM's owner goroutine, between calls. The bool is false if execution is in progress or the measurement was interrupted; a view with no live engine has a complete zero measurement.

func (*Mounted) Pending

func (mounted *Mounted) Pending() int

func (*Mounted) Pump

func (mounted *Mounted) Pump() error

func (*Mounted) Render

func (mounted *Mounted) Render(context *ui.Context) (ui.Element, error)

func (*Mounted) Snapshot

func (mounted *Mounted) Snapshot() (*NativeElement, error)

func (*Mounted) Suspend

func (mounted *Mounted) Suspend()

func (*Mounted) Suspended

func (mounted *Mounted) Suspended() bool

type NativeBinding

type NativeBinding struct {
	Context            context.Context
	Post               func(func(*ui.Context)) bool
	Invalidate         func()
	Frame              func(*ui.Context)
	Release            func()
	PreparedRequest    func(context.Context, string) (protocol.Request, error)
	Theme              func() json.RawMessage
	TerminalAppearance func() (protocol.TerminalAppearance, error)
	Operations         map[string]HostOperation
	Components         []NativeComponent
	ChooseSecretFile   func(context.Context, string) ([]byte, string, error)
	Header             func(json.RawMessage) error
	// Details receives what a Workspace supplies to the Shell's right
	// sidebar each time it draws, nil when it supplies nothing. Without it
	// a Workspace draws its details under its content.
	Details func(func(*ui.Context) error)
	// Navigation receives a Workspace's resource tree for the Shell's left
	// column. It is never drawn inside the page, even without this slot.
	Navigation func(func(*ui.Context) error)
	// Models are the Node's models as the application names them: a
	// ModelPopup shows the names, marks and scores of the ones its catalog
	// lists. Without it a model shows under its catalog's own identifiers.
	Models func() []kit.ModelOption
	// OnEmit observes native UI events before they are queued for scripts.
	OnEmit func(name string, value any)
	// contains filtered or unexported fields
}

func NewNativeBinding

func NewNativeBinding(ctx context.Context) NativeBinding

func (NativeBinding) BindActions

func (binding NativeBinding) BindActions(view *ui.Context, region ui.Element, element NativeElement, emit func(CallbackRef, json.RawMessage))

func (*NativeBinding) DetailsHeading

func (binding *NativeBinding) DetailsHeading() func(*ui.Context) error

DetailsHeading is what the details last drawn gave the sidebar's header.

func (*NativeBinding) DrawingDetails

func (binding *NativeBinding) DrawingDetails() bool

DrawingDetails reports whether the element being drawn is in the details a Workspace gave the Shell's right sidebar.

func (*NativeBinding) EmitHeaderAction

func (binding *NativeBinding) EmitHeaderAction(identity string)

func (*NativeBinding) HeaderSnapshot

func (binding *NativeBinding) HeaderSnapshot() json.RawMessage

func (*NativeBinding) SetDetailsHeading

func (binding *NativeBinding) SetDetailsHeading(draw func(*ui.Context) error)

SetDetailsHeading gives the sidebar's header what the details being drawn would otherwise show as their own first row.

func (*NativeBinding) Suspended

func (binding *NativeBinding) Suspended() bool

func (*NativeBinding) TakeDroppedFiles

func (binding *NativeBinding) TakeDroppedFiles(identity string) ([]string, error)

func (*NativeBinding) WorkspaceLayout

func (binding *NativeBinding) WorkspaceLayout() WorkspaceLayout

type NativeComponent

type NativeComponent struct {
	Module string
	Export string
	Render func(*ui.Context, NativeElement, func(), func(CallbackRef, json.RawMessage)) (ui.Element, error)
}

func NativeComponents

func NativeComponents(binding NativeBinding) ([]NativeComponent, error)

type NativeElement

type NativeElement struct {
	ID          uint64
	Module      string
	Export      string
	Text        string
	Props       json.RawMessage
	Styles      []ElementStyle
	Children    []*NativeElement
	Slots       map[string][]*NativeElement
	Callbacks   map[string]CallbackRef
	RenderChild func(*ui.Context, *NativeElement) (ui.Element, error) `json:"-"`
	Focus       func() bool                                           `json:"-"`
	// contains filtered or unexported fields
}

type PluginContext

type PluginContext = protocol.PluginContext

type Registry

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

func NewRegistry

func NewRegistry(options RegistryOptions) *Registry

func (*Registry) Close

func (registry *Registry) Close() error

func (*Registry) Commands

func (registry *Registry) Commands() []ContributionEntry

func (*Registry) Entries

func (registry *Registry) Entries(slot protocol.PluginUiSlot) []ContributionEntry

func (*Registry) ForwardStatus

func (registry *Registry) ForwardStatus(key ContributionKey, kind protocol.PluginUiEventKind, value json.RawMessage) error

func (*Registry) Hooks

func (registry *Registry) Hooks(reference protocol.PluginReference, declarations []protocol.PluginUiContribution) (ContributionHooks, error)

func (*Registry) Intent

func (registry *Registry) Intent(intent string) (ContributionEntry, bool)

func (*Registry) IntentReady

func (registry *Registry) IntentReady(intent string) (bool, bool)

func (*Registry) Invoke

func (registry *Registry) Invoke(key ContributionKey, kind protocol.PluginUiEventKind, value json.RawMessage) error

func (*Registry) InvokeIntent

func (registry *Registry) InvokeIntent(key ContributionKey, value json.RawMessage) error

func (*Registry) Key

func (registry *Registry) Key(reference protocol.PluginReference, id string) (ContributionKey, bool)

func (*Registry) ProviderEntries

func (registry *Registry) ProviderEntries(scope protocol.PluginUiProviderScope) []ContributionEntry

func (*Registry) Ready

func (registry *Registry) Ready(reference protocol.PluginReference) bool

func (*Registry) Revision

func (registry *Registry) Revision() uint64

Revision identifies the state observed by contribution projections. Read it before projecting so concurrent changes invalidate the next frame.

func (*Registry) SetActivity

func (registry *Registry) SetActivity(reference protocol.PluginReference, active, failed bool) error

func (*Registry) SetProviderScopes

func (registry *Registry) SetProviderScopes(reference protocol.PluginReference, scopes []protocol.PluginUiProviderScope) error

func (*Registry) TakeClosed

func (registry *Registry) TakeClosed(reference protocol.PluginReference) []string

type RegistryOptions

type RegistryOptions struct {
	Node       protocol.NodeID
	Context    protocol.PluginContext
	Invalidate func()
}

type Runtime

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

func NewRuntime

func NewRuntime(bindings RuntimeBindings) (*Runtime, error)

func (*Runtime) Close

func (runtime *Runtime) Close() error

func (*Runtime) Mount

func (runtime *Runtime) Mount(bundle Bundle, pluginContext PluginContext) (_ *Mounted, result error)

func (*Runtime) SetClock

func (runtime *Runtime) SetClock(clock clockwork.Clock) error

type RuntimeBindings

type RuntimeBindings struct {
	Modules       []HostModule
	Components    []NativeComponent
	Contributions ContributionHooks
	Invalidate    func()
	Post          func(func())
	BindActions   func(*ui.Context, ui.Element, NativeElement, func(CallbackRef, json.RawMessage))
}

type SshDirectoryCache

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

SshDirectoryCache is a bounded, owner-scoped cache of SSH directory listings shared across remounts of a window's SSH plugin view. Entries are evicted by revision, TTL, count, total byte budget, explicit refresh, file mutations, disconnect, and owner close.

func NewSshDirectoryCache

func NewSshDirectoryCache(clock clockwork.Clock) *SshDirectoryCache

func (*SshDirectoryCache) Clear

func (cache *SshDirectoryCache) Clear()

func (*SshDirectoryCache) InvalidateNode

func (cache *SshDirectoryCache) InvalidateNode(node protocol.NodeID)

func (*SshDirectoryCache) InvalidateProfile

func (cache *SshDirectoryCache) InvalidateProfile(node protocol.NodeID, profile string)

func (*SshDirectoryCache) Len

func (cache *SshDirectoryCache) Len() int

type UsageSample

type UsageSample struct {
	Report    func(protocol.NodeID, protocol.UsageQuery) (protocol.UsageReport, error)
	Inventory func() ([]protocol.Project, []protocol.ConversationProvider)
}

UsageSample answers the usage calls from memory in place of the Nodes' ledgers, as the one source this device is. Nothing it answers is read from or written to a Node.

type UsageSource

type UsageSource struct {
	Client *client.Client
	Label  string
}

type WorkspaceLayout

type WorkspaceLayout struct {
	ID                  string
	MinNavigationWidth  float32
	MinDetailsWidth     float32
	DefaultDetailsWidth float32
	DetailsLabel        string
}

WorkspaceLayout is the current Workspace's column constraints. Widths are interpreted by the Shell, which owns their saved, user-adjustable state.

Jump to

Keyboard shortcuts

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