ReMe/reme/components/agent_inbox/agent_event_inbox.py
jinliyl ae55e2e570
Some checks are pending
CI / Python packages / Build and verify distributions (push) Waiting to run
CI / Python quality / GitHub Actions (push) Waiting to run
CI / Python quality / Pre-commit (push) Waiting to run
CI / Python tests / Hermes embedded - ubuntu-latest (push) Waiting to run
CI / Python tests / Hermes embedded - windows-latest (push) Waiting to run
CI / Python tests / Unit Tests - py3.11 (push) Waiting to run
CI / Python tests / Unit Tests - py3.12 (push) Waiting to run
CI / Python tests / Unit Tests - py3.13 (push) Waiting to run
CI / Python tests / Unit Tests - py3.14 (push) Waiting to run
CI / ReMe Studio / Studio checks (push) Waiting to run
CI / Windows / CLI smoke - py3.11 (push) Waiting to run
Deploy / Documentation / Build documentation (push) Waiting to run
Deploy / Documentation / deploy (push) Blocked by required conditions
Security / CodeQL / Analyze javascript-typescript (push) Waiting to run
Security / CodeQL / Analyze python (push) Waiting to run
feat!: split proactive runtimes and add Studio backend management (#776)
* refactor(proactive)!: separate runtime ownership and unify delivery

* refactor(proactive): finish runtime and Studio migration

* test(proactive): make scheduled skip coverage deterministic

* refactor(studio): unify navigation and notebook resource loading

* feat(studio): edit workspace documents and update proactive task names

* refactor(studio): simplify task settings and navigation

* feat(studio): secure and supervise backend settings

* feat(studio): unify workbench timelines and refine desktop updates

Use shared timeline panes for notebook, memory, and resources. Add Todo creation ordering, persist companion visibility, and align desktop update handling and release artifacts.

Recheck editor file versions at read and publication boundaries. Retry reminder detail requests from the resource view.

* fix(studio): support unsigned GitHub preview releases

* fix: verify container state and isolate proactive view errors

Mount private supervisor state in Docker smoke tests and verify token and settings persistence. Exercise Studio startup with a loopback-only model fixture, and exclude packaged desktop output from Docker contexts.

Keep Remy subscriptions and healthy tasks available when an individual task has an invalid workspace path or session history.

* fix(home): align candidate Docker context exclusions

* chore(deps): update openai-codex dependency to v0.172.0

- Bump openai-codex from version 0.169.0 to 0.172.0 in pyproject.toml
- Keep other dependencies unchanged
- Ensure compatibility with latest openai-codex features and fixes

* fix(daemon): discover parent dotenv and isolate listeners

Restore parent-directory environment discovery in workers while retaining system precedence. Partition the default supervisor profile and lock by the configured bind address and port.
2026-11-25 21:33:16 +08:00

58 lines
1.9 KiB
Python

"""Per-Agent inbox directories backed by the local unread/read logs."""
from datetime import datetime
import json
from pydantic import BaseModel
from ...constants import CHAT_AGENT_NAME
from .local_agent_inbox import LocalAgentInbox
from ...core.registry import R
from ...schema.proactive_runtime import validate_agent_name
from ...schema.application_config import ApplicationConfig
from ...schema.event import Event
@R.register("event")
class AgentEventInbox(LocalAgentInbox):
"""Adapt storage locations without owning Agent definitions or notification policy."""
def __init__(self, **kwargs):
context = kwargs.get("app_context")
directory = context.app_config.reme_agent_dir if context else ApplicationConfig().reme_agent_dir
super().__init__(directory=directory, **kwargs)
@staticmethod
def _normalize_name(value):
return validate_agent_name(value)
def _names(self):
return [
self._normalize_name(path.parent.name)
for path in sorted(self._root.glob("*/inbox"))
if path.parent.name != CHAT_AGENT_NAME
]
def _inbox_path(self, name):
return self._root / name / "inbox"
def _pending_usage(self, inbox):
"""An inactive runtime must not consume other runtimes' queue capacity."""
return len(inbox.pending), inbox.pending_bytes
@staticmethod
def _validate(value):
if isinstance(value, BaseModel):
value = value.model_dump(mode="json")
return Event.model_validate(value).model_dump(mode="json")
def _item(self, raw):
value = json.loads(raw)
result = self._validate(value)
if result.keys() != value.keys():
raise ValueError("persisted inputs must contain every item field")
return result
@staticmethod
def _sort_key(item):
return datetime.fromisoformat(item["event_ts"]), item["id"]