ReMe/reme/components/agent_inbox/base_agent_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

94 lines
3.1 KiB
Python

"""Public contract for durable, single-consumer Agent inboxes."""
from __future__ import annotations
from abc import abstractmethod
from pydantic import BaseModel
from ..base import BaseComponent
from ...enumeration import ComponentEnum
from ...schema.agent_inbox import InboxReceipt
class InvalidInboxBatchError(ValueError):
"""The submitted items cannot be stored unchanged, even when capacity is available."""
class BaseAgentInbox(BaseComponent):
"""Keep input receipt and asynchronous-result retention backend-independent."""
component_type = ComponentEnum.AGENT_INBOX
max_read_items: int
max_pending_items: int
max_pending_bytes: int
claim_max_items: int
claim_max_bytes: int
@abstractmethod
async def create(self, name: str) -> None:
"""Create an inbox; duplicate identities fail explicitly."""
@abstractmethod
async def mount(self, name: str, directory: str) -> None:
"""Create or restore an identity at a workspace-relative storage location."""
@abstractmethod
async def list(self) -> list[dict]:
"""Read inbox summaries without consuming inputs."""
@abstractmethod
async def snapshot(self, name: str) -> dict:
"""Read the retained execution receipt and pending counts."""
@abstractmethod
async def pending_ids(self, name: str) -> set[str]:
"""Read the identifiers currently admitted to the pending queue."""
@abstractmethod
async def read(self, name: str, *, state: str = "all", offset: int = 0, limit: int = 20) -> dict:
"""Page retained inputs and their real processing state without consuming them."""
@abstractmethod
async def append(
self,
name: str,
items: BaseModel | dict | list[BaseModel | dict],
*,
wait: bool = True,
) -> list[str]:
"""Persist inputs before publishing them to a consumer."""
@abstractmethod
async def claim(
self,
name: str,
limit: int | None = None,
*,
item_ids: list[str] | None = None,
) -> dict | None:
"""Lease the next FIFO batch or retry the selected inputs."""
@abstractmethod
async def ack(self, name: str, token: str, *, metadata: dict | None = None, retain: bool = False) -> str:
"""Commit execution and optionally protect its inputs until result handoff."""
@abstractmethod
async def nack(self, name: str, token: str) -> None:
"""Release a claim without consuming its inputs."""
@abstractmethod
async def receipts(self) -> dict[str, list[InboxReceipt]]:
"""Read retained execution receipts grouped by inbox identity."""
@abstractmethod
async def retain(self, name: str, item_ids: list[str], *, release: bool = False) -> None:
"""Protect inputs from history trimming or release completed result handoffs."""
@abstractmethod
async def forget(self, name: str) -> None:
"""Unmount an idle identity without deleting source files."""
@abstractmethod
async def wait(self, names: str | list[str] | None = None, timeout: float | None = None) -> bool:
"""Wait for claimable inputs or shutdown."""