sessiontarget

package
v1.0.41 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sessiontarget manages persisted session delivery targets.

Index

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

func ChannelSessions(a config.AgentConfig, idx int) ([]*domain.Session, error)

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

func EnsureChannels(cfg *config.Config, mgr *channels.Manager) error

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

func RekeyChannels(prev, next *config.Config) error

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

func ReleaseOrphans(orphans []Orphan, deleteData bool) error

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

func ReleaseTask(agentID, taskName string, deleteData bool) error

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.

func Set

func Set(agentID, agentName, sessionID string, target store.SessionChannel, mgr *channels.Manager) error

Set persists a single target in the session sidecar and registers it with the live channel manager when available.

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.

type Orphan added in v0.7.60

type Orphan struct {
	Agent   string `json:"agent"`
	Session string `json:"session"`
	Title   string `json:"title"`
}

Orphan is a task or channel session whose owner no longer exists, so it would show in Chats as if its task or channel did.

func FindOrphans added in v0.7.60

func FindOrphans(cfg *config.Config) ([]Orphan, error)

FindOrphans lists every configured agent's task and channel sessions whose task or channel is gone. An agent whose task files fail to load is skipped, since its tasks' sessions would look orphaned.

Jump to

Keyboard shortcuts

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