Documentation
¶
Overview ¶
Package sessioncontext provides read-only tools that let an agent discover previous sessions and pull one in as context for the current session, without the manual export/import (HTML export + @mention) workflow.
The toolset is a metadata stub — the runtime owns the handlers (pkg/runtime/sessioncontext_handlers.go) so they can reach the live session store and exclude the session that is currently running. This mirrors the session_plan toolset, which is wired the same way.
Index ¶
Constants ¶
const ( ToolNameListSessions = "list_sessions" ToolNameReadSession = "read_session" )
const ( // DefaultListLimit is the number of sessions list_sessions returns when the // caller does not specify a limit. DefaultListLimit = 20 // MaxListLimit caps how many sessions list_sessions will return in one call // so a large history cannot flood the context window. MaxListLimit = 100 // DefaultMaxChars bounds the size of a rendered transcript so pulling in a // long session cannot blow the current context window. When a transcript is // larger, the oldest messages are dropped and a note records the omission. DefaultMaxChars = 24000 )
Variables ¶
This section is empty.
Functions ¶
func ClampLimit ¶
ClampLimit normalizes a caller-supplied limit: non-positive falls back to the default, and anything above the cap is reduced to it.
func CreateToolSet ¶
func RenderTranscript ¶
RenderTranscript renders a previous session as a readable transcript. When the rendered text would exceed maxChars, the oldest messages are dropped (the most recent ones are the most useful for continuing work) and a note records how many were omitted. maxChars <= 0 selects DefaultMaxChars.
Types ¶
type ListSessionsArgs ¶
type ListSessionsArgs struct {
Limit int `` /* 129-byte string literal not displayed */
}
type ReadSessionArgs ¶
type ReadSessionArgs struct {
SessionID string `` /* 157-byte string literal not displayed */
}
type SessionInfo ¶
type SessionInfo struct {
ID string `json:"id"`
Title string `json:"title"`
CreatedAt string `json:"created_at"`
NumMessages int `json:"num_messages"`
Starred bool `json:"starred,omitempty"`
}
SessionInfo is the per-session payload returned by list_sessions.