Documentation
¶
Overview ¶
Package contextusage holds the latest size of each session's context window and the tool that lets the agent read it.
Index ¶
- Constants
- func Forget(id types.SessionID)
- func Record(id types.SessionID, s Snapshot)
- type Snapshot
- type Tool
- func (t *Tool) BackfillInput(_ context.Context, in map[string]any) map[string]any
- func (t *Tool) Call(_ context.Context, input tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
- func (t *Tool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
- func (t *Tool) Definition() tool.Definition
- func (t *Tool) Description(_ context.Context) (string, error)
- func (t *Tool) FormatResult(data any) string
- func (t *Tool) IsConcurrencySafe(_ map[string]any) bool
- func (t *Tool) IsEnabled() bool
- func (t *Tool) IsReadOnly(_ map[string]any) bool
- func (t *Tool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)
Constants ¶
View Source
const ToolName = "get_context_remaining"
ToolName is the name of the tool that reports the remaining context.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Snapshot ¶
type Snapshot struct {
UsedTokens int `json:"used_tokens"`
WindowTokens int `json:"window_tokens"`
AutoCompactAtTokens int `json:"auto_compact_at_tokens"`
BlockingLimitTokens int `json:"blocking_limit_tokens"`
Source string `json:"source"`
}
Snapshot is where a session's context window stands.
func (Snapshot) UntilCompaction ¶
UntilCompaction is the tokens left before the conversation is compacted automatically.
type Tool ¶
type Tool struct{}
Tool implements get_context_remaining.
func (*Tool) BackfillInput ¶
func (*Tool) Call ¶
func (t *Tool) Call(_ context.Context, input tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
Call reports the session's latest snapshot.
func (*Tool) CheckPermissions ¶
func (t *Tool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
func (*Tool) Definition ¶
func (t *Tool) Definition() tool.Definition
Definition returns the tool definition.
func (*Tool) FormatResult ¶
Click to show internal directories.
Click to hide internal directories.