refactor(curator): rename SessionSummary to SessionRef

This commit is contained in:
sam committed 2026-10-17 17:12:52 +11:00
1 parent ca12e36728
commit c67e2c8335
4 files changed
+12 -12

No files matched your search

+3 -3
View File
@@ -125,15 +125,15 @@ type MemoryEngineSource interface {
type ConversationSource interface { type ConversationSource interface {
// RecentSessions returns every session touched at or after since, // RecentSessions returns every session touched at or after since,
// newest first. // newest first.
RecentSessions(ctx context.Context, since time.Time) ([]SessionSummary, error) RecentSessions(ctx context.Context, since time.Time) ([]SessionRef, error)
// Messages returns the most recent n messages of one session, in // Messages returns the most recent n messages of one session, in
// chronological order. // chronological order.
Messages(ctx context.Context, sessionID string, n int) ([]ConversationMessage, error) Messages(ctx context.Context, sessionID string, n int) ([]ConversationMessage, error)
} }
// SessionSummary identifies one session, the agent that served it, and when // SessionRef identifies one session, the agent that served it, and when
// it was last active. // it was last active.
type SessionSummary struct { type SessionRef struct {
ID string ID string
// AgentID is the agent that owns the session, as recorded on the // AgentID is the agent that owns the session, as recorded on the
// session's own source. Agent-user memory is addressed by it, so a // session's own source. Agent-user memory is addressed by it, so a
+5 -5
View File
@@ -31,11 +31,11 @@ const (
maxSessionTranscriptLimit = 10000 maxSessionTranscriptLimit = 10000
) )
// ChatSessionSummary is the per-session view the session tools return. It is // ChatSessionEntry is the per-session view the session tools return. It is
// deliberately narrower than a store session: the source tuple (platform, bot, // deliberately narrower than a store session: the source tuple (platform, bot,
// channel, thread) is addressing metadata, not something that helps the model // channel, thread) is addressing metadata, not something that helps the model
// pick which conversation to resume. // pick which conversation to resume.
type ChatSessionSummary struct { type ChatSessionEntry struct {
ID string `json:"id"` ID string `json:"id"`
Title string `json:"title"` Title string `json:"title"`
BranchName string `json:"branch_name,omitempty"` BranchName string `json:"branch_name,omitempty"`
@@ -45,7 +45,7 @@ type ChatSessionSummary struct {
// SessionListResult is what session_list returns. // SessionListResult is what session_list returns.
type SessionListResult struct { type SessionListResult struct {
Sessions []ChatSessionSummary `json:"sessions"` Sessions []ChatSessionEntry `json:"sessions"`
} }
// SessionResumeResult is what session_resume returns. // SessionResumeResult is what session_resume returns.
@@ -122,9 +122,9 @@ func sessionListTool(store SessionStore, platform, channelID string) tools.ToolE
} }
// Non-nil even when empty: an empty catalog is an answer, and a // Non-nil even when empty: an empty catalog is an answer, and a
// null would read to the model as a failed call worth retrying. // null would read to the model as a failed call worth retrying.
sessions := make([]ChatSessionSummary, 0, len(all)) sessions := make([]ChatSessionEntry, 0, len(all))
for _, s := range all { for _, s := range all {
sessions = append(sessions, ChatSessionSummary{ sessions = append(sessions, ChatSessionEntry{
ID: s.SessionID, ID: s.SessionID,
Title: sessionDisplayTitle(s), Title: sessionDisplayTitle(s),
BranchName: s.BranchName, BranchName: s.BranchName,
@@ -31,17 +31,17 @@ func NewAdapter(store gateway.SessionStore, agentID string) *Adapter {
// AgentID is the agent every session's memory is addressed by -- the // AgentID is the agent every session's memory is addressed by -- the
// composition's configured bot user, the same value a chat turn addresses // composition's configured bot user, the same value a chat turn addresses
// its own reads with. // its own reads with.
func (a *Adapter) RecentSessions(ctx context.Context, since time.Time) ([]curator.SessionSummary, error) { func (a *Adapter) RecentSessions(ctx context.Context, since time.Time) ([]curator.SessionRef, error) {
sessions, err := a.store.List(ctx) sessions, err := a.store.List(ctx)
if err != nil { if err != nil {
return nil, fmt.Errorf("sessioncurator: listing sessions: %w", err) return nil, fmt.Errorf("sessioncurator: listing sessions: %w", err)
} }
var out []curator.SessionSummary var out []curator.SessionRef
for _, s := range sessions { for _, s := range sessions {
if s.LastActiveAt.Before(since) { if s.LastActiveAt.Before(since) {
continue continue
} }
out = append(out, curator.SessionSummary{ID: s.SessionID, AgentID: a.agentID, LastActive: s.LastActiveAt}) out = append(out, curator.SessionRef{ID: s.SessionID, AgentID: a.agentID, LastActive: s.LastActiveAt})
} }
return out, nil return out, nil
} }
@@ -128,7 +128,7 @@ func effectiveSince(since, now time.Time) time.Time {
// reviewOne extracts observations from one session and writes them as // reviewOne extracts observations from one session and writes them as
// agent-user memory for its single participant. It returns nil when nothing // agent-user memory for its single participant. It returns nil when nothing
// was extracted, or a skip action when the session cannot be attributed. // was extracted, or a skip action when the session cannot be attributed.
func (c *Curator) reviewOne(ctx context.Context, engine domainmemory.MemoryEngine, sess curator.SessionSummary) (*curator.Action, error) { func (c *Curator) reviewOne(ctx context.Context, engine domainmemory.MemoryEngine, sess curator.SessionRef) (*curator.Action, error) {
msgs, err := c.host.Conversations.Messages(ctx, sess.ID, messageTailSize) msgs, err := c.host.Conversations.Messages(ctx, sess.ID, messageTailSize)
if err != nil { if err != nil {
return nil, err return nil, err