SlidingWindowConversationManager
Defined in: src/conversation-manager/sliding-window-conversation-manager.ts:43
Implements a sliding window strategy for managing conversation history.
This class handles the logic of maintaining a conversation window that preserves tool usage pairs and avoids invalid window states. When the message count exceeds the window size, it will either truncate large tool results or remove the oldest messages while ensuring tool use/result pairs remain valid.
As a Plugin, it registers callbacks for:
- AfterInvocationEvent: Applies sliding window management after each invocation
- AfterModelCallEvent: Reduces context on overflow errors and requests retry
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SlidingWindowConversationManager(config?): SlidingWindowConversationManager;Defined in: src/conversation-manager/sliding-window-conversation-manager.ts:59
Initialize the sliding window conversation manager.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
config? | SlidingWindowConversationManagerConfig | Configuration options for the sliding window manager. |
Returns
Section titled “Returns”SlidingWindowConversationManager
Overrides
Section titled “Overrides”Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get name(): string;Defined in: src/conversation-manager/sliding-window-conversation-manager.ts:50
Unique identifier for this plugin.
Returns
Section titled “Returns”string
Overrides
Section titled “Overrides”Methods
Section titled “Methods”initAgent()
Section titled “initAgent()”initAgent(agent): void;Defined in: src/conversation-manager/sliding-window-conversation-manager.ts:74
Initialize the plugin by registering hooks with the agent.
Registers:
- AfterInvocationEvent callback to apply sliding window management
- AfterModelCallEvent callback to handle context overflow and request retry
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
agent | AgentData | The agent to register hooks with |
Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”getTools()
Section titled “getTools()”getTools(): Tool[];Defined in: src/plugins/plugin.ts:82
Returns tools provided by this plugin for auto-registration. Override to provide plugin-specific tools.
Returns
Section titled “Returns”Tool[]
Array of tools to register with the agent