Documentation
¶
Overview ¶
Package sessiontarget manages persisted session delivery targets.
Index ¶
- func ChannelOwner(a config.AgentConfig, sess *domain.Session) int
- func ChannelSessions(a config.AgentConfig, idx int) ([]*domain.Session, error)
- func EnsureChannel(agentName string, cc config.ChannelConfig, mgr *channels.Manager) (*domain.Session, error)
- func EnsureChannels(cfg *config.Config, mgr *channels.Manager) error
- func Register(agentID, agentName, sessionID string, target store.SessionChannel, ...)
- func RekeyChannels(prev, next *config.Config) error
- func ReleaseAgent(a config.AgentConfig, deleteData bool) error
- func ReleaseChannel(a config.AgentConfig, idx int, deleteData bool) error
- func ReleaseOrphans(orphans []Orphan, deleteData bool) error
- func ReleaseTask(agentID, taskName string, deleteData bool) error
- func Set(agentID, agentName, sessionID string, target store.SessionChannel, ...) error
- type DataCounts
- type Orphan
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChannelOwner ¶ added in v0.7.1
func ChannelOwner(a config.AgentConfig, sess *domain.Session) int
ChannelOwner returns the index in a.Channels of the channel that owns sess, or -1. Only channel sessions are owned: the channel's own session and the conversations it received. Archived sessions are regular chats.
func ChannelSessions ¶ added in v0.7.1
ChannelSessions lists the sessions of a.Channels[idx]: its own session first, then the conversations it received, most recent first.
func EnsureChannel ¶ added in v0.7.1
func EnsureChannel(agentName string, cc config.ChannelConfig, mgr *channels.Manager) (*domain.Session, error)
EnsureChannel creates the channel's own session when it has none yet and points the session's delivery at the channel's DeliverTo conversation. It is safe to call on every config load.
func EnsureChannels ¶ added in v0.7.1
EnsureChannels runs EnsureChannel for every channel in cfg, returning the first error after trying them all.
func Register ¶
func Register(agentID, agentName, sessionID string, target store.SessionChannel, mgr *channels.Manager)
Register wires the session's text and media delivery to the configured target described by the sidecar entry.
func RekeyChannels ¶ added in v0.7.1
RekeyChannels moves the sessions of channels whose type stayed but whose ID changed between prev and next, matched by their position in each agent's channel list: the channel's own session moves to its new name, and its conversations record the new configured ID. Without this, editing a channel's ID (a Signal channel's phone number) would orphan its session.
func ReleaseAgent ¶ added in v0.7.60
func ReleaseAgent(a config.AgentConfig, deleteData bool) error
ReleaseAgent disposes of the data of agent a, which is being deregistered. deleteData removes its data directory and task files with everything in them; otherwise they stay on disk so the agent can be added again.
func ReleaseChannel ¶ added in v0.7.1
func ReleaseChannel(a config.AgentConfig, idx int, deleteData bool) error
ReleaseChannel disposes of the sessions of a.Channels[idx], which is being removed: deleteData removes each one with its messages and media, and otherwise each is kept as a regular chat titled after the channel.
func ReleaseOrphans ¶ added in v0.7.60
ReleaseOrphans archives each orphan as a regular chat titled after its old owner, or deletes it with its messages and media when deleteData is set.
func ReleaseTask ¶ added in v0.7.60
ReleaseTask disposes of the data of agentID's task taskName, which is being deleted. deleteData removes its session, with its messages and media, and its run records; otherwise its session is kept as a regular chat titled after the task and its run records stay on disk.
Types ¶
type DataCounts ¶ added in v0.7.60
type DataCounts struct {
Sessions int `json:"sessions"`
Messages int `json:"messages"`
Runs int `json:"runs"`
Files int `json:"files"`
}
DataCounts is what deleting an object's data removes: its sessions, their messages, its run records, and the files it owns.
func AgentData ¶ added in v0.7.60
func AgentData(a config.AgentConfig) DataCounts
AgentData counts the data deleting agent a with its data removes: every session, message and run in its data directory, and its other files, such as AGENTS.md, MEMORY.md, memory/, notes/ and task files.
func ChannelData ¶ added in v0.7.60
func ChannelData(a config.AgentConfig, idx int) (DataCounts, error)
ChannelData counts the data removing a.Channels[idx] with its data removes: its own session and the conversations it received.
func TaskData ¶ added in v0.7.60
func TaskData(agentID, taskName string) DataCounts
TaskData counts the data deleting agentID's task taskName with its data removes: its session and its runs.