Documentation
¶
Index ¶
- Constants
- func Render(tmpl string, ctx *Context) (string, error)
- func RenderDefault(ctx *Context) (string, error)
- func RenderMessagePrompt(ctx *Context) (string, error)
- type Context
- func (c *Context) HasBattery() bool
- func (c *Context) HasCPUTemp() bool
- func (c *Context) HasFanSpeed() bool
- func (c *Context) HasGPUTemp() bool
- func (c *Context) HasGPUUsage() bool
- func (c *Context) HasLoadAverage() bool
- func (c *Context) HasNetwork() bool
- func (c *Context) HasPreviousEntries() bool
- func (c *Context) HasProcessCount() bool
- func (c *Context) HasSwap() bool
- type PreviousEntry
Constants ¶
const DefaultTemplate = `` /* 1950-byte string literal not displayed */
DefaultTemplate is the built-in journal entry prompt
Variables ¶
This section is empty.
Functions ¶
func RenderDefault ¶
RenderDefault renders the default template with the given context
func RenderMessagePrompt ¶ added in v0.0.5
RenderMessagePrompt loads the message prompt template from config and renders it
Types ¶
type Context ¶
type Context struct {
Persona string
Timestamp time.Time
Uptime string
CPUPercent float64
MemoryPercent float64
MemoryUsedGB float64
MemoryTotalGB float64
DiskPercent float64
DiskUsedGB float64
DiskTotalGB float64
// Machine identity
MachineType string // laptop, desktop, server, virtual_machine, container, unknown
TimeOfDay string // night, morning, afternoon, evening
Platform string // e.g., "macOS 14.0 (arm64)" or "Linux 5.15 (amd64)"
// Optional metrics (check with HasX methods in templates)
LoadAverage1 *float64
LoadAverage5 *float64
LoadAverage15 *float64
SwapPercent *float64
SwapUsedGB *float64
SwapTotalGB *float64
ProcessCount *int
NetworkSentGB *float64
NetworkRecvGB *float64
BatteryPct *float64
BatteryChg *bool
CPUTemp *float64
GPUTemp *float64
GPUUsage *float64
FanSpeed *float64 // Average fan speed in RPM
// Previous entries for context continuity
PreviousEntries []PreviousEntry
}
Context holds all the data available to a prompt template
func NewContext ¶
func NewContext(personaDescription string, snapshot *metrics.Snapshot, previousEntries []PreviousEntry) *Context
NewContext creates a prompt context from a persona description, metrics snapshot, and optional previous entries
func (*Context) HasBattery ¶ added in v0.0.3
HasBattery returns true if battery data is available
func (*Context) HasCPUTemp ¶ added in v0.0.5
HasCPUTemp returns true if CPU temperature data is available
func (*Context) HasFanSpeed ¶ added in v0.0.5
HasFanSpeed returns true if fan speed data is available
func (*Context) HasGPUTemp ¶ added in v0.0.5
HasGPUTemp returns true if GPU temperature data is available
func (*Context) HasGPUUsage ¶ added in v0.0.5
HasGPUUsage returns true if GPU usage data is available
func (*Context) HasLoadAverage ¶ added in v0.0.3
HasLoadAverage returns true if load average data is available
func (*Context) HasNetwork ¶ added in v0.0.3
HasNetwork returns true if network I/O data is available
func (*Context) HasPreviousEntries ¶ added in v0.0.5
HasPreviousEntries returns true if previous entries are available for context
func (*Context) HasProcessCount ¶ added in v0.0.3
HasProcessCount returns true if process count is available
type PreviousEntry ¶ added in v0.0.5
PreviousEntry represents a previous journal entry for context