ReMe/reme/constants.py
jinliyl 54fa3381d7
Some checks failed
CI and Release / Docker / Build and test / amd64 (push) Has been cancelled
CI and Release / Docker / Build and test / arm64 (push) Has been cancelled
Security / CodeQL / Analyze python (push) Has been cancelled
CI / Python quality / Pre-commit (push) Has been cancelled
CI / Python tests / Unit Tests - py3.12 (push) Has been cancelled
CI / Python tests / Unit Tests - py3.13 (push) Has been cancelled
CI / Python tests / Unit Tests - py3.14 (push) Has been cancelled
CI / Python packages / Build and verify distributions (push) Has been cancelled
CI / Python quality / GitHub Actions (push) Has been cancelled
CI / Python tests / Hermes embedded - ubuntu-latest (push) Has been cancelled
CI / Python tests / Hermes embedded - windows-latest (push) Has been cancelled
CI / Python tests / Unit Tests - py3.11 (push) Has been cancelled
CI / ReMe Studio / Studio checks (push) Has been cancelled
Deploy / Documentation / Build documentation (push) Has been cancelled
CI / Windows / CLI smoke - py3.11 (push) Has been cancelled
Security / CodeQL / Analyze javascript-typescript (push) Has been cancelled
CI and Release / Docker / Publish multi-platform tags (push) Has been cancelled
Deploy / Documentation / deploy (push) Has been cancelled
refactor(core): reorganize the ReMe runtime and shared helpers (#769)
* refactor(core): reorganize the ReMe runtime and shared helpers

* test(status): import the base component from its canonical module

* test: remove redundant unit checks

* refactor(core): use canonical runtime imports and shared CLI discovery

Restore evolve behavior to the base branch and update its imports. Use Application as the runtime entry point and encode SSE in the HTTP service.

* fix(cli): honor caller config when service replay is incomplete

Use partial startup overrides for port probes and resolve named configs before requesting the service process working directory.
2026-11-20 22:06:46 +08:00

65 lines
2 KiB
Python

"""Shared ReMe protocol, workspace, and default values."""
REME_SERVICE_INFO = "REME_SERVICE_INFO"
REME_IPV4_LOOPBACK_HOST = "127.0.0.1"
REME_IPV6_LOOPBACK_HOST = "::1"
# The service and client defaults are used unless a host or port is configured.
REME_DEFAULT_HOST = REME_IPV4_LOOPBACK_HOST
REME_DEFAULT_PORT = 2333
# Wildcard address accepted when a service is explicitly configured to listen
# on every IPv4 interface.
REME_WILDCARD_BIND_HOST = "0.0.0.0"
REME_IPV6_WILDCARD_BIND_HOST = "::"
DEFAULT_MCP_PATH = "/mcp"
DEFAULT_MCP_SSE_PATH = "/sse"
OPENAPI_SCHEMA_PATH = "/openapi.json"
SSE_MEDIA_TYPE = "text/event-stream"
REME_SSE_DONE_MARKER = "[DONE]"
def normalize_connect_host(host: str) -> str:
"""Return a local destination for a configured bind address."""
if host == REME_WILDCARD_BIND_HOST:
return REME_IPV4_LOOPBACK_HOST
if host == REME_IPV6_WILDCARD_BIND_HOST:
return REME_IPV6_LOOPBACK_HOST
return host
# Fixed workspace and agent identifiers shared by their readers and writers.
SESSION_DIALOG_SUBDIR = "dialog"
CHAT_AGENT_NAME = "Remy"
PROACTIVE_MESSAGE_ID_PREFIX = "reme-proactive-"
WINDOWS_RESERVED_DEVICE_NAMES = frozenset(
{
"CON",
"PRN",
"AUX",
"NUL",
*(f"COM{i}" for i in range(1, 10)),
*(f"LPT{i}" for i in range(1, 10)),
},
)
# CRUD steps: file IO limits and truncation marker (shared across CRUD steps).
DEFAULT_MAX_BYTES = 50 * 1024
MAX_FILE_READ_BYTES = 200 * 1024 * 1024
TRUNCATION_NOTICE_MARKER = "<<TRUNCATION_NOTICE>>"
# read_image step: oversized images above this threshold return path & metadata
# only (no base64) to keep LLM context budgets safe.
DEFAULT_MAX_IMAGE_BYTES = 5 * 1024 * 1024
# Background content-processing jobs skip files above this size. File watchers
# and catalogs still track them so deletes and later size reductions are seen.
DEFAULT_MAX_FILE_BYTES = 20 * 1024 * 1024
# Memory-tag generation and indexing defaults.
DEFAULT_MEMORY_TAG_KEY = "memory_tags"
DEFAULT_MAX_MEMORY_TAGS = 3
DEFAULT_MAX_MEMORY_TAG_LENGTH = 64