dynvars

package
v0.32.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() engine.Plugin

New creates a new dynamic variables plugin.

Types

type Plugin

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

Plugin injects dynamic runtime variables into the turn's own user message, as an XML block prepended to it on the way to the provider.

Why the user message and not the system prompt

These variables CHANGE EVERY TURN — the clock most obviously. A system prompt is the most cache-stable region of a request and sits at the very front of it, so putting a per-turn value there invalidates the prompt cache at position zero and re-bills the entire conversation on every turn. Moving them to the live user message puts the only volatile bytes at the END of the prompt, which is exactly where a cache wants its variance.

Why it never reaches stored history

The block is applied to the OUTBOUND llm.request, not to the message the memory plugin persisted. That is what stops the obvious failure of per-turn injection: ten turns in, a history carrying ten increasingly stale copies of "Current time", contradicting each other. Nothing has to detect or strip an old block, because no old block is ever written — see decorate.

func (*Plugin) Capabilities

func (p *Plugin) Capabilities() []engine.Capability

func (*Plugin) ConfigSchema

func (p *Plugin) ConfigSchema() []byte

ConfigSchema implements engine.ConfigSchemaProvider.

func (*Plugin) Dependencies

func (p *Plugin) Dependencies() []string

func (*Plugin) Emissions

func (p *Plugin) Emissions() []string

func (*Plugin) ID

func (p *Plugin) ID() string

func (*Plugin) Init

func (p *Plugin) Init(ctx engine.PluginContext) error

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) Ready

func (p *Plugin) Ready() error

func (*Plugin) Requires

func (p *Plugin) Requires() []engine.Requirement

func (*Plugin) Shutdown

func (p *Plugin) Shutdown(_ context.Context) error

func (*Plugin) Subscriptions

func (p *Plugin) Subscriptions() []engine.EventSubscription

Subscriptions declares the one hook this plugin needs: the outbound request, where the block is applied.

Priority 20 puts it after the handlers that rewrite a request's shape — fanout (2), fallback (3), the schema registry (5), progressive discovery (8) and skills (15) — so none of them sees a message this plugin has already decorated, and a veto from any of them costs nothing to undo.

func (*Plugin) Version

func (p *Plugin) Version() string

Jump to

Keyboard shortcuts

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