Documentation
¶
Overview ¶
Package heartbeat implements periodic agent turns that check a HEARTBEAT.md checklist and optionally deliver results to channel bots.
The runner triggers an agent turn at a configurable interval, using a light system prompt (identity + HEARTBEAT.md only). If the agent replies with HEARTBEAT_OK (optionally followed by ≤ackMaxChars of text), the response is suppressed. Otherwise the response is delivered to the configured target.
Index ¶
Constants ¶
const HeartbeatOK = "HEARTBEAT_OK"
HeartbeatOK is the token that agents emit to indicate nothing needs attention.
Variables ¶
This section is empty.
Functions ¶
func IsWithinActiveHours ¶
IsWithinActiveHours checks if the given time falls within the [start, end) window. Times are in HH:MM format (24h). "24:00" is allowed for end. If start == end, returns false (zero-width window). If end < start, the window wraps across midnight.
Types ¶
type Chatter ¶
type Chatter interface {
Chat(ctx context.Context, sessionKey, message string) (agentapi.Response, error)
ChatLight(ctx context.Context, sessionKey, message string) (agentapi.Response, error)
SetSessionModel(key, model string)
ClearSessionModel(key string)
}
Chatter is the minimal agent interface needed by the heartbeat runner.
type Deliverer ¶
type Deliverer interface {
SendToAllPaired(text string)
}
Deliverer can broadcast a message to all paired users on a channel.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner manages the periodic heartbeat loop.
type RunnerOpts ¶
type RunnerOpts struct {
Logger *zap.SugaredLogger
Agent Chatter
CfgFn func() config.HeartbeatConfig // dynamic config getter
UserTZFn func() string // dynamic timezone getter
ResolveAlias func(string) string // model alias resolver
Workspace string
Deliverers []Deliverer
SessionKey string // session key for heartbeat turns (default "heartbeat:main")
}
RunnerOpts configures a new Runner.