helpers/history.py.dox.md
history.py helper module.history.py because this directory is intentionally flat.history.py owns the runtime implementation.history.py.dox.md owns durable notes about responsibilities, contracts, side effects, and verification for that implementation.RawMessage (TypedDict)OutputMessage (TypedDict)Record (no explicit base class)
get_tokens(self) -> intasync compress(self) -> booloutput(self) -> list[OutputMessage]async summarize(self) -> strto_dict(self) -> dictfrom_dict(data: dict, history: 'History')output_langchain(self)output_text(self, human_label=..., ai_label=...)Message (Record)
get_tokens(self) -> intcalculate_tokens(self)set_summary(self, summary: str)async compress(self)output(self)output_langchain(self)output_text(self, human_label=..., ai_label=...)to_dict(self)Topic (Record)
get_tokens(self)add_message(self, ai: bool, content: MessageContent, tokens: int=..., id: str=...) -> Messageoutput(self) -> list[OutputMessage]async summarize(self)compress_large_messages(self, message_ratio: float=...) -> boolasync compress(self) -> boolasync compress_attention(self, ratio: float=...) -> boolasync summarize_messages(self, messages: list[Message])Bulk (Record)
get_tokens(self)output(self, human_label: str=..., ai_label: str=...) -> list[OutputMessage]async compress(self)async summarize(self)to_dict(self)from_dict(data: dict, history: 'History')History (Record)
get_tokens(self) -> intis_over_limit(self)get_bulks_tokens(self) -> intget_topics_tokens(self) -> intget_current_topic_tokens(self) -> intadd_message(self, ai: bool, content: MessageContent, tokens: int=..., id: str=...) -> Messagenew_topic(self)output(self) -> list[OutputMessage]deserialize_history(json_data: str, agent) -> History_stringify_output(output: OutputMessage, ai_label=..., human_label=...)_stringify_content(content: MessageContent) -> str_output_content_langchain(content: MessageContent)group_outputs_abab(outputs: list[OutputMessage]) -> list[OutputMessage]group_messages_abab(messages: list[BaseMessage]) -> list[BaseMessage]output_langchain(messages: list[OutputMessage])output_text(messages: list[OutputMessage], ai_label=..., human_label=...)clear_responses_provider_state(agent) -> None_merge_outputs(a: MessageContent, b: MessageContent) -> MessageContent_merge_properties(a: Dict[str, MessageContent], b: Dict[str, MessageContent]) -> Dict[str, MessageContent]_is_raw_message(obj: object) -> bool_is_embedded_data(obj: object) -> bool_json_dumps(obj)_json_loads(obj)BULK_MERGE_COUNT, TOPICS_MERGE_COUNT, CURRENT_TOPIC_RATIO, HISTORY_TOPIC_RATIO, HISTORY_BULK_RATIO, CURRENT_TOPIC_ATTENTION_COMPRESSION, HISTORY_TOPIC_ATTENTION_COMPRESSION, LARGE_MESSAGE_TO_CURRENT_TOPIC_RATIO, LARGE_MESSAGE_TO_HISTORY_TOPIC_RATIO, RAW_MESSAGE_OUTPUT_TEXT_TRIM, COMPRESSION_TARGET_RATIO.clear_responses_provider_state(agent) removes the active provider continuation IDs after local history rewrites while preserving stored response ID lists for later cleanup.abc, asyncio, collections, collections.abc, enum, helpers, json, langchain_core.messages, math, plugins._model_config.helpers.model_config, typing, uuid.History, _is_raw_message, _json_dumps, group_messages_abab, join, make_list, cast, a.copy, json.dumps, json.loads, globals.from_dict, output_langchain, output_text, self.output_text, tokens.approximate_tokens, self.calculate_tokens, Message, get_chat_model_config, large_msgs.sort, self.compress_large_messages.tests/test_browser_agent_regressions.pytests/test_chat_compaction.pytests/test_error_retry_plugin.pytests/test_history_compression_wait.pytests/test_mcp_handler_multimodal.pytests/test_memory_quality.pytests/test_model_config_project_presets.pytests/test_office_document_store.pyNo child DOX files.