feat(memory): add progressive wiki and drain Dream history (#4477)

This commit is contained in:
chengyongru authored and GitHub committed 2026-11-18 16:28:43 +08:00
1 parent 9ccf3b6214
commit 74d070f699
40 files changed
+1513 -738

No files matched your search

+5 -21
View File
@@ -7,6 +7,7 @@ import pytest
from nanobot.agent.context import TranscriptInput
from nanobot.agent.loop import AgentLoop
from nanobot.agent.tools.base import Tool
from nanobot.agent.tools.context import (
RequestContext,
bind_request_context,
@@ -22,9 +23,10 @@ from nanobot.providers.base import LLMResponse, ToolCallRequest
from nanobot.session.turn_continuation import INTERNAL_CONTINUATION_META
class _ContextRecordingTool:
class _ContextRecordingTool(Tool):
name = "cron"
concurrency_safe = False
description = "Record the active request context."
parameters = {"type": "object", "properties": {"action": {"type": "string"}}}
def __init__(self) -> None:
self.contexts: list[dict] = []
@@ -43,24 +45,6 @@ class _ContextRecordingTool:
return "created"
class _Tools:
def __init__(self, tool: _ContextRecordingTool) -> None:
self.tool = tool
@property
def tool_names(self) -> list[str]:
return ["cron"]
def get(self, name: str):
return self.tool if name == "cron" else None
def get_definitions(self) -> list:
return []
def prepare_call(self, name: str, arguments: dict):
return (self.tool, arguments, None) if name == "cron" else (None, arguments, None)
def test_loop_registers_default_tools_in_injected_registry(tmp_path: Path) -> None:
provider = MagicMock()
provider.get_default_model.return_value = "test-model"
@@ -152,7 +136,7 @@ async def test_loop_binds_request_context_for_tool_execution(tmp_path: Path) ->
model="test-model",
)
cron = _ContextRecordingTool()
loop.tools = _Tools(cron)
loop.tools.register(cron)
metadata = {"slack": {"thread_ts": "111.222", "channel_type": "channel"}}
runtime = loop.llm_runtime()