feat: make context compaction visible in channels (#5656)

* feat: surface context compaction lifecycle

* fix: complete and simplify context compaction notifications
This commit is contained in:
chengyongru authored and GitHub committed 2026-09-05 20:21:54 +08:00
1 parent 455533169d
commit 5229989f28
52 files changed
+1849 -140

No files matched your search

+3
View File
@@ -27,6 +27,7 @@ from nanobot.agent.context_governance import (
from nanobot.agent.hook import AgentHook, AgentHookContext, AgentRunHookContext
from nanobot.agent.tools.execution import execute_tool_calls
from nanobot.agent.tools.registry import ToolRegistry
from nanobot.bus.outbound_events import ContextCompactionCallback
from nanobot.llm_usage.context import (
LLMUsageSource,
bind_llm_usage_source,
@@ -116,6 +117,7 @@ class AgentRunSpec:
finalize_on_max_iterations: bool = True
provider_state: ProviderConversationState | None = None
llm_usage_source: LLMUsageSource | None = None
compaction_callback: ContextCompactionCallback | None = None
@dataclass(slots=True)
@@ -431,6 +433,7 @@ class AgentRunner:
config=governance_config,
conversation=conversation_state,
compaction=compaction,
compaction_callback=spec.compaction_callback,
)
for iteration in range(spec.max_iterations):