mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-11-29 00:38:33 +00:00
* fix(proactive): simplify round files and restore failed summaries * fix(proactive): validate document-relative Markdown links * feat(proactive_agent): implement v2 daily record workflow with single-file decision - Add ProactiveAgentStepV2 class to support single daily note decision and reminder - Introduce RoundOutputs for v2 round file tracking, and keep RoundArtifacts for v1 summary backup - Refactor AgentOutbox to support both v1 standalone reminder files and v2 daily reminder records - Add proactive_record utilities to parse and validate v2 daily record frontmatter and metadata - Enhance proactive_agent to prepare, read, and manage artifacts for both v1 and v2 flows - Add configuration profile proactive_v2 to enable new workflow with backward compatibility - Update proactive.yaml and reactive proactive_agent_step configuration comment for easy switching - Provide extensive schema validation for v2 reminders ensuring priority and message consistency - Document v2 workflow and usage in English and Chinese runtime docs - Add unit tests for v2 step verifying single file output and proper decision handling * refactor(agent/runtime): replace ReminderRef with string keys and simplify reminder handling - Remove ReminderRef model and switch to using workspace-relative string keys for reminders - Simplify AgentOutbox to read, write, and manage reminders keyed by strings - Change file locking and version checking to protect concurrent edits on daily record files - Replace legacy and v2 reminder file handling with unified ReminderFiles storage - Adjust ChatNotifications to operate with the new key scheme and update pending/read sets - Refactor RoundOutputs to RoundRecord for safer round record tracking and rollback - Remove unused ProactiveRunResult and related references from imports and exports - Update InboxWakeRequest, AgentReminder, and related models for consistent ID and path validation - Adjust proactive agent runtime and local runtime to check reminder versions before commit - Correct language and docs to describe reminders as daily records instead of separate files - Clean up roles of inbox and outbox for reminder ownership, delivery, and acknowledgments * fix(proactive): serialize round commits and align desktop reminders * refactor(proactive): unify task triggers in Proactive Runtime * fix(proactive): bound reminder payloads and simplify receipts * refactor(studio): share workbench and simplify proactive delivery * fix(studio): update and centralize build dependencies * fix(proactive): guard draft repair and verify Studio deployments * chore(docs): update source-map-js * feat(release): support publishing selected artifacts from a tag * chore(studio): remove the public playground * refactor: simplify reminders and release workflows * fix: preserve proactive records and align release provenance * test(proactive): remove brittle prompt and preset assertions * fix(proactive): register reminders after input acknowledgement * feat(notebook): list projects across todos and ideas * feat(studio): connect mobile apps to configurable ReMe services * fix(proactive): reserve registered reminder paths * fix(studio): request Android local network access * fix(proactive): reserve reminder paths referenced by receipts
61 lines
2.5 KiB
Python
61 lines
2.5 KiB
Python
"""One fixed Chat Agent with durable native session history."""
|
|
|
|
from ....constants import CHAT_AGENT_NAME
|
|
from .base import BaseAgentStep
|
|
from ....core.registry import R
|
|
|
|
|
|
class BaseChatAgentStep(BaseAgentStep):
|
|
"""Share prompt, memory and tool bindings across inference and empty-session creation."""
|
|
|
|
def session_options(self):
|
|
"""Build the shared Chat prompt, memory path and tool bindings."""
|
|
runtime = self.proactive_runtime
|
|
memory = runtime.agents.chat_memory_path()
|
|
return {
|
|
"job_tools": self.kwargs.get("job_tools") or [],
|
|
"system_prompt": self.prompt_format(
|
|
"system_prompt",
|
|
workspace_dir=self.workspace_path,
|
|
memory_path=memory,
|
|
),
|
|
"injected_job_kwargs": {"_agent_name": CHAT_AGENT_NAME},
|
|
}
|
|
|
|
async def ensure_session(self, options, *, new=False):
|
|
"""Select the current Chat session or create a fresh one with the same bindings."""
|
|
runtime = self.proactive_runtime
|
|
return await runtime.sessions.ensure(CHAT_AGENT_NAME, runtime.agent_wrapper, options, runtime.now(), new=new)
|
|
|
|
async def chat(self, query, *, on_chunk):
|
|
"""Continue Remy's selected native session."""
|
|
async with self.proactive_runtime.chat_turn():
|
|
options = self.session_options()
|
|
session_id = await self.ensure_session(options)
|
|
return await self.stream_reply(
|
|
query,
|
|
session_id=session_id,
|
|
agent_name=CHAT_AGENT_NAME,
|
|
on_chunk=on_chunk,
|
|
**options,
|
|
)
|
|
|
|
async def new_session(self):
|
|
"""Rotate the selected Chat session under the same generation lock."""
|
|
if self.proactive_runtime.chat_lock.locked():
|
|
raise RuntimeError("Chat Agent is busy; retry after its turn completes")
|
|
async with self.proactive_runtime.chat_turn():
|
|
await self.ensure_session(self.session_options(), new=True)
|
|
|
|
|
|
@R.register("list_chat_sessions_step")
|
|
class ListChatSessionsStep(BaseAgentStep):
|
|
"""Global history query; cold listing never creates a session."""
|
|
|
|
async def execute(self):
|
|
arguments = self.parameters()
|
|
if set(arguments) - {"offset", "limit"}:
|
|
raise ValueError("list_chat_sessions accepts only offset and limit")
|
|
self.require_paths(self.proactive_runtime.agents.path(CHAT_AGENT_NAME))
|
|
self.context.response.answer = await self.proactive_runtime.list_chat_sessions(**arguments)
|
|
return self.context.response
|