Skip to main content

Crate codei_session

Crate codei_session 

Source
Expand description

Session management and persistence for CodeI.

Structs§

ContextBuilder
Builds the message list sent to the LLM from a session.
Session
SessionStore
Persistent session storage (SQLite or JSONL files, selected by config).
StoredMessage
TokenBudget
Token budget for context window management.
ToolCallRecord

Enums§

MessageContent
Role
SessionError

Functions§

cap_output_tokens
Cap configured max output tokens so estimated input + output fits in the context window.
compact_messages
Truncate older messages when over budget. Keeps system prompt and recent turns. Used as a last-resort guard when building the LLM request.
estimate_tokens
Rough token estimate (chars / 4).
estimate_tool_defs_tokens
Rough token estimate for tool definitions attached to a chat request.
format_transcript
Format stored messages into a transcript for LLM summarization.
should_compact_session
Whether the session should be compacted based on estimated token usage.

Type Aliases§

MessageId
SessionId