ReMe/reme/constants.py
Adarsh edf08a186d
fix(client): format IPv6 service URLs correctly (#719)
* fix(client): format IPv6 service URLs correctly

* fix(service): normalize IPv6 wildcard hosts

* fix(service): probe IPv6 ports on loopback only

* fix(service): preserve wildcard port conflict checks
2026-11-11 11:43:02 +08:00

42 lines
1.4 KiB
Python

"""Constants"""
REME_SERVICE_INFO = "REME_SERVICE_INFO"
# Loopback address used by services and clients unless a host is configured.
REME_DEFAULT_HOST = "127.0.0.1"
REME_IPV6_LOOPBACK_HOST = "::1"
# 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 = "::"
REME_DEFAULT_PORT = 2333
def normalize_connect_host(host: str) -> str:
"""Return a local destination for a configured bind address."""
if host == REME_WILDCARD_BIND_HOST:
return REME_DEFAULT_HOST
if host == REME_IPV6_WILDCARD_BIND_HOST:
return REME_IPV6_LOOPBACK_HOST
return host
# 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