Documentation
¶
Overview ¶
Package authoring owns the shared plugin lifecycle; it imports no feature implementation
Index ¶
- func Action(id string) string
- func Active(ev sdk.Event) bool
- func CloneFeedback(source map[string]any) map[string]any
- func CloneSetting(value any) any
- func CloneSettings(value map[string]any) map[string]any
- func DisplayLayout(wide bool) []byte
- func DisplayLines(text string, columns int) []string
- func DisplayMessages(id string, previous *Display, view Display, rich, states bool) []sdk.Event
- func FeedbackEqual(a, b any) bool
- func ResultText(value any) string
- func StartObservationJob(ctx context.Context, e *Engine, id string, ...) bool
- func ThemeAsset(path, ThemeName string) string
- func ValidateViewTargets(def Definition) error
- type ActionHooks
- type BackgroundJob
- type Binding
- type Definition
- type Display
- type DisplayStatus
- type Engine
- func (e *Engine) ActionKey(action string) string
- func (e *Engine) ActivateView(id string)
- func (e *Engine) ApplyJobResult(ctx context.Context, c *sdk.Client, result JobResult) (err error)
- func (e *Engine) BatchDial(id string) bool
- func (e *Engine) BuildDisplayView(id string, status DisplayStatus) Display
- func (e *Engine) CanUpdateView(ctx context.Context, id string) bool
- func (e *Engine) CancelJob(id string)
- func (e *Engine) ClearContext(id string)
- func (e *Engine) Close() error
- func (e *Engine) CollectStatus(ctx context.Context, id string, b Binding) DisplayStatus
- func (e *Engine) DisplayView(id string, status DisplayStatus) Display
- func (e *Engine) DrainJobs(ctx context.Context, c *sdk.Client) error
- func (e *Engine) EffectiveSettings(id string, settings map[string]any) map[string]any
- func (e *Engine) FinishJob(ctx context.Context, c *sdk.Client, result JobResult, job BackgroundJob) error
- func (e *Engine) Handle(ctx context.Context, c *sdk.Client, ev sdk.Event) (err error)
- func (e *Engine) InspectBasic(ctx context.Context, c *sdk.Client, ev sdk.Event) (bool, error)
- func (e *Engine) InvalidateProbe(id string)
- func (e *Engine) MergedSettings(settings map[string]any) map[string]any
- func (e *Engine) NextPoll(now time.Time) time.Time
- func (e *Engine) Persist() error
- func (e *Engine) Poll(ctx context.Context, c *sdk.Client) (err error)
- func (e *Engine) ProbeKey(id string, b Binding) string
- func (e *Engine) RefreshProbe(id string)
- func (e *Engine) Register(action string, hooks ActionHooks) error
- func (e *Engine) Render(ctx context.Context, c *sdk.Client, id string) error
- func (e *Engine) RenderViewTargets(ctx context.Context, c *sdk.Client) error
- func (e *Engine) Restore(dst any) error
- func (e *Engine) RoutinePersist() error
- func (e *Engine) SendDisplay(ctx context.Context, c *sdk.Client, id string, status DisplayStatus) error
- func (e *Engine) SendDisplayView(ctx context.Context, c *sdk.Client, id string, view Display, states bool) error
- func (e *Engine) ShouldLogAction(ev sdk.Event) bool
- func (e *Engine) StartJob(ctx context.Context, id string, ...) bool
- func (e *Engine) StartOrReplaceJob(ctx context.Context, id string, replace bool, ...) bool
- func (e *Engine) ThemeName() string
- func (e *Engine) ThemedAsset(path string) string
- func (e *Engine) ThemedLayout(path string) string
- func (e *Engine) Time() time.Time
- func (e *Engine) UpdateGlobalSettings(settings map[string]any, preserveJob string)
- func (e *Engine) ViewIsActive(id string) bool
- func (e *Engine) Wake() <-chan struct{}
- func (e *Engine) WantsLiveView(id string) bool
- type Factory
- type Feature
- type JobResult
- type Presentation
- type Renderer
- type SampledStatus
- type ViewTarget
- type Visual
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneFeedback ¶
Clone feedback so later mutation cannot change render history
func CloneSettings ¶
Clone a settings map without sharing nested mutable values
func DisplayLayout ¶
Select the embedded wide or square display layout
func DisplayLines ¶
Wrap text into bounded display lines
func DisplayMessages ¶
DisplayMessages computes one desired revision. Commit the snapshot only after every queued write succeeds; reset it after host/context/theme changes
func FeedbackEqual ¶
Compare feedback with consistent JSON numeric semantics
func StartObservationJob ¶
func StartObservationJob(ctx context.Context, e *Engine, id string, work func(context.Context) (string, any, error), apply func(context.Context, *sdk.Client, JobResult, BackgroundJob) error) bool
StartObservationJob schedules a read after a command. Admission, cancellation, and read failures never change the command receipt. Apply receives read errors in JobResult; use StartJob for work that determines command success
func ThemeAsset ¶
Choose a themed variant of an asset path
func ValidateViewTargets ¶
func ValidateViewTargets(def Definition) error
Validate complete and unambiguous view-target declarations
Types ¶
type ActionHooks ¶
type ActionHooks struct {
Input func(context.Context, *sdk.Client, sdk.Event, Binding) error
Appeared func(context.Context, *sdk.Client, sdk.Event, Binding) error
Changed func(context.Context, *sdk.Client, sdk.Event, Binding) error
Disappeared func(context.Context, *sdk.Client, sdk.Event, Binding) error
Render func(context.Context, *sdk.Client, string, Binding) (Display, error)
}
type BackgroundJob ¶
type Definition ¶
type Definition struct {
ID string `json:"id,omitempty"`
// RuntimeAssets lists feature-owned paths selected dynamically rather than by action metadata
RuntimeAssets []string `json:"-"`
ViewTargets []ViewTarget `json:"-"`
Slug string `json:"slug"`
Name string `json:"name"`
Version string `json:"version"`
MinimumManager string `json:"minimum_manager"`
RequiredCapabilities []string `json:"required_capabilities"`
Actions []string `json:"actions"`
}
type Display ¶
func CompactDisplay ¶
CompactDisplay gives a semantic value and label more room on small square keys It preserves the full title, saved element identities, and the input snapshot
func Present ¶
func Present(view Display, content *Presentation, width, height int) Display
Present selects semantic rows without changing layout identities, legacy element keys, canvas sources, or the full live-text customization source
func StatusDisplay ¶
func StatusDisplay(status DisplayStatus, surface *sdk.Surface, visual Visual, theme string) Display
Convert status and visual preferences into a display
type DisplayStatus ¶
type DisplayStatus struct {
Content *Presentation
Icon string
Text string
State int
}
type Engine ¶
type Engine struct {
Now func() time.Time
Registered map[string]ActionHooks
Store *storage.Store
Slug, Path, Theme string
Global map[string]any
Bindings map[string]Binding
Statuses, Samples map[string]SampledStatus
Probes *sdk.ProbePool
WakeChannel chan struct{}
PendingWrite, NextPeriodic time.Time
Written []byte
DirtyState, Closed bool
ProbeKeys map[string]string
Effective map[string]map[string]any
DisplayTicks map[string]int
Jobs map[string]BackgroundJob
Generation uint64
Completed chan JobResult
ResultsText map[string]string
Results map[string]any
Checked map[string]time.Time
Last map[string]Display
LastStatus map[string]DisplayStatus
Mu sync.Mutex
Feature Feature
ViewTargets map[string]ViewTarget
ViewActive map[string]bool
// contains filtered or unexported fields
}
func New ¶
func New(def Definition, path string, factory Factory) *Engine
Construct the action engine and initialize its state maps
func (*Engine) ActivateView ¶
Mark a binding as activated for subsequent live updates
func (*Engine) ApplyJobResult ¶
Completion callbacks are attached to individual jobs, never selected by plugin identity
func (*Engine) BuildDisplayView ¶
func (e *Engine) BuildDisplayView(id string, status DisplayStatus) Display
Build a binding display using its current surface and theme
func (*Engine) CanUpdateView ¶
Authorize rendering using origin, activation and shared identity
func (*Engine) ClearContext ¶
Cancel binding-owned work and clear transient context
func (*Engine) CollectStatus ¶
Collect feature status and cached job outcomes
func (*Engine) DisplayView ¶
func (e *Engine) DisplayView(id string, status DisplayStatus) Display
Build a display without sending host messages
func (*Engine) EffectiveSettings ¶
Return the cached effective settings for a binding
func (*Engine) FinishJob ¶
func (e *Engine) FinishJob(ctx context.Context, c *sdk.Client, result JobResult, job BackgroundJob) error
Finish a job and settle its deferred action
func (*Engine) InspectBasic ¶
Handle shared inspector requests before feature-specific requests
func (*Engine) InvalidateProbe ¶
Invalidate the shared probe associated with a binding
func (*Engine) MergedSettings ¶
Clone global settings and overlay binding-specific values
func (*Engine) RefreshProbe ¶
Request a new sample for the binding probe
func (*Engine) Register ¶
func (e *Engine) Register(action string, hooks ActionHooks) error
Register adds a complete action UUID with live rendering by default
func (*Engine) RenderViewTargets ¶
Refresh other bindings explicitly targeted by this event
func (*Engine) Restore ¶
Restore loads file-backed state atomically and reports failures directly Rejected state remains protected until an explicit successful restore
func (*Engine) RoutinePersist ¶
Persist dirty state once its debounce deadline is due
func (*Engine) SendDisplay ¶
func (e *Engine) SendDisplay(ctx context.Context, c *sdk.Client, id string, status DisplayStatus) error
Build and send the binding status display
func (*Engine) SendDisplayView ¶
func (e *Engine) SendDisplayView(ctx context.Context, c *sdk.Client, id string, view Display, states bool) error
Send a display subject to the current view-update scope
func (*Engine) ShouldLogAction ¶
Decide whether an input event merits an action log
func (*Engine) StartJob ¶
func (e *Engine) StartJob(ctx context.Context, id string, work func(context.Context) (string, any, error), apply func(context.Context, *sdk.Client, JobResult, BackgroundJob) error) bool
Schedule bounded background work with binding ownership
func (*Engine) StartOrReplaceJob ¶
func (e *Engine) StartOrReplaceJob(ctx context.Context, id string, replace bool, work func(context.Context) (string, any, error), apply func(context.Context, *sdk.Client, JobResult, BackgroundJob) error) bool
Admit a job or explicitly replace the existing binding job
func (*Engine) ThemedAsset ¶
Resolve an asset using the current plugin theme
func (*Engine) ThemedLayout ¶
Resolve a layout using the current plugin theme
func (*Engine) UpdateGlobalSettings ¶ added in v0.1.1
UpdateGlobalSettings replaces the global snapshot and invalidates dependent work. A connector can preserve its shared job when its connection settings did not change.
func (*Engine) ViewIsActive ¶
Report whether the binding has been activated
func (*Engine) Wake ¶
func (e *Engine) Wake() <-chan struct{}
Expose the wake signal used by the host event loop
func (*Engine) WantsLiveView ¶
Decide whether live updates are enabled for this binding
type Feature ¶
type Feature struct {
// ObserveFailure is an optional nonblocking application policy hook for admitted failures
ObserveFailure func(context.Context, *sdk.Client, string, error)
// FilterStatus applies optional application display policy before status deduplication
FilterStatus func(context.Context, *sdk.Client, string, DisplayStatus) DisplayStatus
ShouldLogAction func(sdk.Event) bool
DemandChanged func()
Present func(string, DisplayStatus) Presentation
Actions map[string]func(context.Context, *sdk.Client, sdk.Event, Binding) error
Before func(context.Context, *sdk.Client, sdk.Event) (bool, error)
After func(context.Context, *sdk.Client, sdk.Event) error
Action func(context.Context, *sdk.Client, sdk.Event, Binding) error
Inspector func(context.Context, *sdk.Client, sdk.Event) (bool, error)
Settings func(string)
Clear func(string)
Unbound func(string)
Status func(context.Context, string, Binding) DisplayStatus
Collect func(context.Context, string, Binding) DisplayStatus
Poll func(context.Context, *sdk.Client) (bool, error)
Deadline func(time.Time) time.Time
View func(string, DisplayStatus) Display
Render func(context.Context, *sdk.Client, string) error
Close func()
Progress func()
Snapshot func() any
Apply func(context.Context, *sdk.Client, JobResult, BackgroundJob) error
Visuals map[string]Visual
DynamicDisplay bool
AdditiveDial func(string) bool
}
Feature callbacks run on the SDK event loop. Background work receives immutable snapshots
type Presentation ¶
type Presentation struct {
Kind string
Primary string
Label string
Detail string
Progress float64
ShowProgress bool
}
Presentation is optional semantic content. Text remains the legacy/customized live-text source; zero content preserves historical rendering
func ConciseStatus ¶
func ConciseStatus(text string) Presentation
ConciseStatus is a safe default for a connector that still returns legacy text. Drivers may supply richer content through optional Presentation below
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
type SampledStatus ¶
type ViewTarget ¶
ViewTarget declares which actions may refresh a view. Command feedback uses exact binding contexts; Shared requires an explicit matching shared_id Live views observe their own state. AfterActivation reserves live progress for a control that has actually been used, rather than every copy of its action