refactor(curator): rename SessionSummary to SessionRef
This commit is contained in:
4 files changed
+12
-12
No files matched your search
@@ -125,15 +125,15 @@ type MemoryEngineSource interface {
|
||||
type ConversationSource interface {
|
||||
// RecentSessions returns every session touched at or after since,
|
||||
// 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
|
||||
// chronological order.
|
||||
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.
|
||||
type SessionSummary struct {
|
||||
type SessionRef struct {
|
||||
ID string
|
||||
// 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
|
||||
|
||||
@@ -31,11 +31,11 @@ const (
|
||||
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,
|
||||
// channel, thread) is addressing metadata, not something that helps the model
|
||||
// pick which conversation to resume.
|
||||
type ChatSessionSummary struct {
|
||||
type ChatSessionEntry struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
BranchName string `json:"branch_name,omitempty"`
|
||||
@@ -45,7 +45,7 @@ type ChatSessionSummary struct {
|
||||
|
||||
// SessionListResult is what session_list returns.
|
||||
type SessionListResult struct {
|
||||
Sessions []ChatSessionSummary `json:"sessions"`
|
||||
Sessions []ChatSessionEntry `json:"sessions"`
|
||||
}
|
||||
|
||||
// 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
|
||||
// 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 {
|
||||
sessions = append(sessions, ChatSessionSummary{
|
||||
sessions = append(sessions, ChatSessionEntry{
|
||||
ID: s.SessionID,
|
||||
Title: sessionDisplayTitle(s),
|
||||
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
|
||||
// composition's configured bot user, the same value a chat turn addresses
|
||||
// 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)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("sessioncurator: listing sessions: %w", err)
|
||||
}
|
||||
var out []curator.SessionSummary
|
||||
var out []curator.SessionRef
|
||||
for _, s := range sessions {
|
||||
if s.LastActiveAt.Before(since) {
|
||||
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
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ func effectiveSince(since, now time.Time) time.Time {
|
||||
// reviewOne extracts observations from one session and writes them as
|
||||
// agent-user memory for its single participant. It returns nil when nothing
|
||||
// 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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in new issue
Block a user