Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
feat(memory): configure IM attachment processing (#1452)
rkrkrkk101f4127be18
diff --git a/config/v2_config.py b/config/v2_config.pyindex 3f6b52d97..2589c1e76 100644--- a/config/v2_config.py+++ b/config/v2_config.py@@ -1011,6 +1011,8 @@ def _recovery_section_for_error(error: BaseException) -> Optional[str]:path = match.group(1)if path.startswith("memory.processing.rerank"):return "memory.rerank"+ if path.startswith("memory.processing.multimodal"):+ return "memory.multimodal"if path == "platform":return "platforms"if path.startswith("agents."):@@ -1022,6 +1024,8 @@ def _recovery_section_for_error(error: BaseException) -> Optional[str]:lowered = message.lower()if "memory rerank endpoint" in lowered:return "memory.rerank"+ if "memory multimodal endpoint" in lowered:+ return "memory.multimodal"if "unsupported enabled platform" in lowered:return "platforms"for platform_id in supported_platform_ids():@@ -1146,6 +1150,13 @@ def _reset_recoverable_config_section(return Falseprocessing.pop("rerank", None)return True+ if section == "memory.multimodal":+ memory = payload.get("memory")+ processing = memory.get("processing") if isinstance(memory, dict) else None+ if not isinstance(processing, dict):+ return False+ processing.pop("multimodal", None)+ return Trueif section == "runtime":# Keep this in sync with ``V2Config.default``. RuntimeConfig has a# required cwd, so an empty object would make the recovery loop fail a@@ -1672,6 +1683,7 @@ class MemoryProcessingConfig:llm: MemoryEndpointConfig = field(default_factory=MemoryEndpointConfig)embedding: MemoryEndpointConfig = field(default_factory=MemoryEndpointConfig)rerank: Optional[MemoryEndpointConfig] = None+ multimodal: Optional[MemoryEndpointConfig] = Nonedef validate(self) -> None:self.llm.validate(name="llm")@@ -1684,6 +1696,20 @@ class MemoryProcessingConfig:raise ValueError("Memory rerank endpoint must include base_url, model, and api_key")+ if self.multimodal is not None:+ self.multimodal.validate(name="multimodal")+ if not any(+ (+ self.multimodal.base_url,+ self.multimodal.model,+ self.multimodal.api_key,+ )+ ):+ self.multimodal = None+ elif not self.multimodal.complete():+ raise ValueError(+ "Memory multimodal endpoint must include base_url, model, and api_key"+ )@dataclass@@ -1825,6 +1851,8 @@ def memory_config_to_payload(}if memory.processing.rerank is not None:processing["rerank"] = endpoint_payload(memory.processing.rerank)+ if memory.processing.multimodal is not None:+ processing["multimodal"] = endpoint_payload(memory.processing.multimodal)payload = {"enabled": memory.enabled,"processing": processing,@@ -1867,6 +1895,12 @@ def memory_config_from_payload(payload: object) -> MemoryConfig:processing_payload["rerank"],name="memory.processing.rerank",)+ multimodal_payload = None+ if "multimodal" in processing_payload:+ multimodal_payload = _optional_memory_object(+ processing_payload["multimodal"],+ name="memory.processing.multimodal",+ )diagnostics_payload = _optional_memory_object(payload.get("diagnostics", {}),name="memory.diagnostics",@@ -1908,6 +1942,16 @@ def memory_config_from_payload(payload: object) -> MemoryConfig:if rerank_payload is not Noneelse None),+ multimodal=(+ MemoryEndpointConfig(+ **_filter_dataclass_fields(+ MemoryEndpointConfig,+ multimodal_payload,+ )+ )+ if multimodal_payload is not None+ else None+ ),),diagnostics=MemoryDiagnosticsConfig(**_filter_dataclass_fields(diff --git a/core/memory/attachments.py b/core/memory/attachments.pyindex 4e81b242f..2a8a50aa7 100644--- a/core/memory/attachments.py+++ b/core/memory/attachments.py@@ -32,6 +32,8 @@ from core.memory.types import (MAX_PINNED_ATTACHMENTS = 8MAX_PINNED_ATTACHMENT_BYTES = 25 * 1024 * 1024MAX_PINNED_BUNDLE_BYTES = 100 * 1024 * 1024+# Delivery gate: PR4 flips this only after the IM admission/materialization path lands.+IM_ATTACHMENT_CAPTURE_AVAILABLE = False_COPY_CHUNK_BYTES = 1024 * 1024_MAX_ATTACHMENT_NAME_BYTES = 512diff --git a/core/memory/everos.py b/core/memory/everos.pyindex 76d231c31..1d3b64833 100644--- a/core/memory/everos.py+++ b/core/memory/everos.py@@ -56,9 +56,23 @@ _AGENTIC_ROUND_HEADER = "X-Avibe-Memory-Agentic-Round"_SIDECAR_TIMEOUT_RESPONSE_MARGIN_SECONDS = 0.05_ADD_TIMEOUT_SECONDS = 30.0_FLUSH_TIMEOUT_SECONDS = 300.0-_PROCESSING_TIMEOUT_SECONDS = 8.0+PROCESSING_PROBE_REQUEST_TIMEOUT_SECONDS = 8.0+PROCESSING_PROBE_DEADLINE_MARGIN_SECONDS = 2.0+PROCESSING_PROBE_MAX_ENDPOINTS = 4+PROCESSING_PROBE_MAX_DEADLINE_SECONDS = (+ PROCESSING_PROBE_REQUEST_TIMEOUT_SECONDS * PROCESSING_PROBE_MAX_ENDPOINTS+ + PROCESSING_PROBE_DEADLINE_MARGIN_SECONDS+)+_PROCESSING_TIMEOUT_SECONDS = PROCESSING_PROBE_REQUEST_TIMEOUT_SECONDS_PREFLIGHT_TIMEOUT_SECONDS = 5.0_PREFLIGHT_RESPONSE_BYTES = _MAX_RESPONSE_BYTES+_PREFLIGHT_IMAGE_DATA_URI = (+ "data:image/png;base64,"+ "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAYElEQVR42u3QAQ0AAAwC"+ "IPuX1hzfIQLpcxEgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAA"+ "AQIECBAgQIAAAQIECBAgQIAAAQIECBAgQIAAAQLuG0bQw7Ko2TvAAAAAAElFTkSuQmCC"+)+MULTIMODAL_EXPLICIT_ENV = "AVIBE_MEMORY_MULTIMODAL_EXPLICIT"_PROFILE_QUERY = "profile"_MAX_LIST_PAGE_SIZE = 20_EVEROS_EXACT_SORT_WINDOW = 20_000@@ -111,6 +125,40 @@ class ProviderCapture:attachments: tuple[CaptureAttachment, ...] = ()+@dataclass(frozen=True)+class _ProcessingProbeSpec:+ base_url: str | None+ api_key: str | None+ path: str+ payload: dict[str, Any]+ validator: Callable[[Any], bool]+++def processing_probe_deadline_seconds(+ *,+ llm: tuple[str | None, str | None],+ embedding: tuple[str | None, str | None],+ rerank: tuple[str | None, str | None] | None = None,+ multimodal: tuple[str | None, str | None] | None = None,+) -> float:+ """Bound a probe child by the largest serialized provider group."""++ group_sizes: dict[tuple[str, str], int] = {}+ for pair in (llm, embedding, rerank, multimodal):+ if pair is None:+ continue+ group = _processing_provider_group_key(*pair)+ if group is None:+ continue+ group_sizes[group] = group_sizes.get(group, 0) + 1+ largest_group = max(group_sizes.values(), default=1)+ deadline = (+ PROCESSING_PROBE_REQUEST_TIMEOUT_SECONDS * largest_group+ + PROCESSING_PROBE_DEADLINE_MARGIN_SECONDS+ )+ return min(deadline, PROCESSING_PROBE_MAX_DEADLINE_SECONDS)++class MemoryProviderFailure(RuntimeError):"""A redaction-safe failure already classified by the provider adapter."""@@ -151,6 +199,7 @@ class MemoryPreflightFailure:"memory_embedding_unavailable","memory_llm_unavailable","memory_rerank_unavailable",+ "memory_multimodal_unavailable",]diagnostic: MemoryPreflightDiagnostic@@ -187,6 +236,9 @@ class EverOSPort:rerank_base_url: str | None = None,rerank_model: str | None = None,rerank_api_key: str | None = None,+ multimodal_base_url: str | None = None,+ multimodal_model: str | None = None,+ multimodal_api_key: str | None = None,processing_health_check: Callable[[], Awaitable[bool]] | None = None,sidecar_timeout_seconds: float = _SIDECAR_TIMEOUT_SECONDS,add_timeout_seconds: float = _ADD_TIMEOUT_SECONDS,@@ -204,6 +256,9 @@ class EverOSPort:self._rerank_base_url = _normalized_endpoint_url(rerank_base_url)self._rerank_model = _optional_string(rerank_model)self._rerank_api_key = _optional_string(rerank_api_key)+ self._multimodal_base_url = _normalized_endpoint_url(multimodal_base_url)+ self._multimodal_model = _optional_string(multimodal_model)+ self._multimodal_api_key = _optional_string(multimodal_api_key)self._processing_health_check = processing_health_checkself._sidecar_timeout_seconds = _positive_timeout(sidecar_timeout_seconds, _SIDECAR_TIMEOUT_SECONDS)self._add_timeout_seconds = _positive_timeout(add_timeout_seconds, _ADD_TIMEOUT_SECONDS)@@ -531,10 +586,11 @@ class EverOSPort:return dict(snapshot.recorder)async def processing_healthy(self) -> bool:- """Probe both configured model endpoints with fixed synthetic requests.+ """Probe configured model endpoints with fixed synthetic requests.The worker may call this after ambiguous provider errors. The lock keepsseveral queued rows from multiplying credential probes during an outage.+ Matching provider credentials are serialized; independent groups overlap."""async with self._processing_lock:@@ -545,33 +601,58 @@ class EverOSPort:return Falseif not self._processing_configured():return False- healthy = await self._probe_processing_endpoint(- base_url=self._llm_base_url,- api_key=self._llm_api_key,- path="chat/completions",- payload={- "model": self._llm_model,- "messages": [{"role": "user", "content": "Reply with OK."}],- "max_tokens": 1,- "temperature": 0,- },- validator=_valid_chat_probe_response,- ) and await self._probe_processing_endpoint(- base_url=self._embedding_base_url,- api_key=self._embedding_api_key,- path="embeddings",- payload={"model": self._embedding_model, "input": "memory health check"},- validator=_valid_embedding_probe_response,- )- if not healthy or not self._rerank_configured():- return healthy- return await self._probe_processing_endpoint(- base_url=self._rerank_base_url,- api_key=self._rerank_api_key,- path=self._rerank_model or "",- payload={"queries": ["OK"], "documents": ["OK"]},- validator=_valid_rerank_probe_response,+ probes = [+ _ProcessingProbeSpec(+ base_url=self._llm_base_url,+ api_key=self._llm_api_key,+ path="chat/completions",+ payload={+ "model": self._llm_model,+ "messages": [{"role": "user", "content": "Reply with OK."}],+ "max_tokens": 1,+ "temperature": 0,+ },+ validator=_valid_chat_probe_response,+ ),+ _ProcessingProbeSpec(+ base_url=self._embedding_base_url,+ api_key=self._embedding_api_key,+ path="embeddings",+ payload={"model": self._embedding_model, "input": "memory health check"},+ validator=_valid_embedding_probe_response,+ ),+ ]+ if self._rerank_configured():+ probes.append(+ _ProcessingProbeSpec(+ base_url=self._rerank_base_url,+ api_key=self._rerank_api_key,+ path=self._rerank_model or "",+ payload={"queries": ["OK"], "documents": ["OK"]},+ validator=_valid_rerank_probe_response,+ )+ )+ if self._multimodal_configured():+ probes.append(+ _ProcessingProbeSpec(+ base_url=self._multimodal_base_url,+ api_key=self._multimodal_api_key,+ path="chat/completions",+ payload=_multimodal_preflight_payload(self._multimodal_model),+ validator=_valid_chat_probe_response,+ )+ )+ groups: dict[tuple[str, str], list[_ProcessingProbeSpec]] = {}+ for probe in probes:+ group = _processing_provider_group_key(probe.base_url, probe.api_key)+ if group is None:+ return False+ groups.setdefault(group, []).append(probe)+ results = await asyncio.gather(+ *(self._run_processing_probe_group(group) for group in groups.values()),+ return_exceptions=True,)+ return all(result is True for result in results)async def preflight(self) -> MemoryPreflightResult:"""Run one bounded request for each configured processing endpoint."""@@ -594,6 +675,17 @@ class EverOSPort:_valid_rerank_probe_response,))+ if self._multimodal_configured():+ checks.append(+ (+ "multimodal",+ self._multimodal_base_url,+ self._multimodal_api_key,+ "chat/completions",+ _multimodal_preflight_payload(self._multimodal_model),+ _valid_chat_probe_response,+ )+ )first_failure = Nonefor side, base_url, api_key, path, payload, validator in checks:started_at_ms = int(time.time() * 1000)@@ -647,6 +739,15 @@ class EverOSPort:def _rerank_configured(self) -> bool:return all((self._rerank_base_url, self._rerank_model, self._rerank_api_key))+ def _multimodal_configured(self) -> bool:+ return all(+ (+ self._multimodal_base_url,+ self._multimodal_model,+ self._multimodal_api_key,+ )+ )+async def _search_data(self,principal_id: str,@@ -843,6 +944,25 @@ class EverOSPort:return Falsereturn bool(validator(value))+ async def _run_processing_probe_group(+ self,+ probes: list[_ProcessingProbeSpec],+ ) -> bool:+ healthy = True+ for probe in probes:+ try:+ result = await self._probe_processing_endpoint(+ base_url=probe.base_url,+ api_key=probe.api_key,+ path=probe.path,+ payload=probe.payload,+ validator=probe.validator,+ )+ except Exception:+ result = False+ healthy = healthy and result is True+ return healthy+async def _preflight_endpoint(self,side,@@ -982,6 +1102,7 @@ class EverOSPort:"llm": self._llm_model,"embedding": self._embedding_model,"rerank": self._rerank_model,+ "multimodal": self._multimodal_model,}.get(side)self._preflight_call_recorder(side=side,@@ -1469,17 +1590,52 @@ def _valid_rerank_probe_response(value: Any) -> bool:)+def _multimodal_preflight_payload(model: str | None) -> dict[str, Any]:+ """Build a minimal synthetic vision request containing no user data."""++ return {+ "model": model,+ "messages": [+ {+ "role": "user",+ "content": [+ {"type": "text", "text": "Reply with OK."},+ {+ "type": "image_url",+ "image_url": {"url": _PREFLIGHT_IMAGE_DATA_URI},+ },+ ],+ }+ ],+ "max_tokens": 1,+ "temperature": 0,+ }+++def _processing_provider_group_key(+ base_url: str | None,+ api_key: str | None,+) -> tuple[str, str] | None:+ normalized_url = _normalized_endpoint_url(base_url)+ credential_identity = _optional_string(api_key)+ if normalized_url is None or credential_identity is None:+ return None+ return normalized_url, credential_identity++def _preflight_error_name(- side: Literal["llm", "embedding", "rerank"],+ side: Literal["llm", "embedding", "rerank", "multimodal"],) -> Literal["memory_llm_unavailable","memory_embedding_unavailable","memory_rerank_unavailable",+ "memory_multimodal_unavailable",]:return {"llm": "memory_llm_unavailable","embedding": "memory_embedding_unavailable","rerank": "memory_rerank_unavailable",+ "multimodal": "memory_multimodal_unavailable",}[side]diff --git a/core/memory/process.py b/core/memory/process.pyindex 27d13e503..1bceb9d2b 100644--- a/core/memory/process.py+++ b/core/memory/process.py@@ -39,7 +39,12 @@ from core.memory.confined_filesystem import (remove_anchored_entry,required_no_follow_flag,)-from core.memory.everos import EverOSPort+from core.memory.everos import (+ EverOSPort,+ MULTIMODAL_EXPLICIT_ENV,+ PROCESSING_PROBE_MAX_DEADLINE_SECONDS,+ processing_probe_deadline_seconds,+)from core.memory.secret_scrubber import scrub_textfrom core.memory.types import MemoryErrorCode@@ -77,6 +82,7 @@ async def _probe_stderr_tail(task: asyncio.Task[bytes] | None, *, settings: Eversettings.llm_base_url,settings.embedding_base_url,settings.rerank_base_url,+ settings.multimodal_base_url,) if value),exact_values=tuple(@@ -84,6 +90,7 @@ async def _probe_stderr_tail(task: asyncio.Task[bytes] | None, *, settings: Eversettings.llm_api_key,settings.embedding_api_key,settings.rerank_api_key,+ settings.multimodal_api_key,) if value),)@@ -101,7 +108,8 @@ _STOP_TIMEOUT_SECONDS = 10.0_HEALTHY_RESET_SECONDS = 5 * 60.0_RESTART_DELAYS_SECONDS = (1.0, 5.0, 30.0, 120.0)_MAX_CONSECUTIVE_FAILURES = 5-_PROCESSING_PROBE_TIMEOUT_SECONDS = 20.0+# Reconcile's transport budget must cover the worst derived probe-child deadline.+_PROCESSING_PROBE_TIMEOUT_SECONDS = PROCESSING_PROBE_MAX_DEADLINE_SECONDS_PROCESSING_PROBE_STDERR_BYTES = 2048_SOCKET_MODE = 0o600_OWNER_DIR_MODE = 0o700@@ -135,6 +143,9 @@ class EverOSProcessSettings:rerank_base_url: str | None = Nonererank_model: str | None = Nonererank_api_key: str | None = field(default=None, repr=False)+ multimodal_base_url: str | None = None+ multimodal_model: str | None = None+ multimodal_api_key: str | None = field(default=None, repr=False)timezone: str | None = Nonecall_log_db_path: Path | None = None@@ -696,7 +707,10 @@ class EverOSProcess:stderr = getattr(probe, "stderr", None)stderr_task = asyncio.create_task(_drain_probe_stderr(stderr)) if stderr is not None else Nonetry:- await asyncio.wait_for(probe.wait(), timeout=_PROCESSING_PROBE_TIMEOUT_SECONDS)+ await asyncio.wait_for(+ probe.wait(),+ timeout=_processing_probe_timeout_seconds(self._settings),+ )except asyncio.TimeoutError:try:await self._terminate_owned_tree(@@ -2312,6 +2326,33 @@ def _settings_complete(settings: EverOSProcessSettings) -> bool:)+def _processing_probe_timeout_seconds(settings: EverOSProcessSettings) -> float:+ rerank = None+ if _endpoint_settings_complete(+ settings.rerank_base_url,+ settings.rerank_model,+ settings.rerank_api_key,+ ):+ rerank = (settings.rerank_base_url, settings.rerank_api_key)+ multimodal = None+ if _endpoint_settings_complete(+ settings.multimodal_base_url,+ settings.multimodal_model,+ settings.multimodal_api_key,+ ):+ multimodal = (settings.multimodal_base_url, settings.multimodal_api_key)+ return processing_probe_deadline_seconds(+ llm=(settings.llm_base_url, settings.llm_api_key),+ embedding=(settings.embedding_base_url, settings.embedding_api_key),+ rerank=rerank,+ multimodal=multimodal,+ )+++def _endpoint_settings_complete(*values: str | None) -> bool:+ return all(isinstance(value, str) and bool(value.strip()) for value in values)++def _rebuild_settings_complete(settings: EverOSProcessSettings) -> bool:return all(isinstance(value, str) and bool(value.strip())@@ -2381,6 +2422,7 @@ def _write_memory_child_config("","[multimodal]",f"file_uri_allow_dirs = [{_toml_string(str(attachments_root))}]",+ "file_uri_max_bytes = 26214400","",))@@ -2433,9 +2475,11 @@ def _memory_child_environment("EVEROS_LLM__BASE_URL": settings.llm_base_url,"EVEROS_LLM__MODEL": settings.llm_model,"EVEROS_LLM__API_KEY": settings.llm_api_key,- "EVEROS_MULTIMODAL__BASE_URL": settings.llm_base_url,- "EVEROS_MULTIMODAL__MODEL": settings.llm_model,- "EVEROS_MULTIMODAL__API_KEY": settings.llm_api_key,+ # Workbench keeps one compatibility cycle of implicit LLM inheritance.+ # IM capture is gated separately by the explicit persisted endpoint.+ "EVEROS_MULTIMODAL__BASE_URL": settings.multimodal_base_url or settings.llm_base_url,+ "EVEROS_MULTIMODAL__MODEL": settings.multimodal_model or settings.llm_model,+ "EVEROS_MULTIMODAL__API_KEY": settings.multimodal_api_key or settings.llm_api_key,"EVEROS_EMBEDDING__BASE_URL": settings.embedding_base_url,"EVEROS_EMBEDDING__MODEL": settings.embedding_model,"EVEROS_EMBEDDING__API_KEY": settings.embedding_api_key,@@ -2444,6 +2488,15 @@ def _memory_child_environment("EVEROS_RERANK__API_KEY": settings.rerank_api_key,}env.update({key: value for key, value in optional.items() if value is not None})+ if all(+ isinstance(value, str) and bool(value.strip())+ for value in (+ settings.multimodal_base_url,+ settings.multimodal_model,+ settings.multimodal_api_key,+ )+ ):+ env[MULTIMODAL_EXPLICIT_ENV] = "1"if settings.call_log_db_path is not None:env["AVIBE_MEMORY_CALL_LOG_DB"] = str(settings.call_log_db_path)if role is not None:@@ -3459,6 +3512,13 @@ def _validate_generated_config()if any(rerank_settings) and not all(rerank_settings):raise RuntimeError("Generated EverOS config received partial rerank settings")+ multimodal_settings = (+ settings.multimodal_base_url,+ settings.multimodal_model,+ settings.multimodal_api_key,+ )+ if any(multimodal_settings) and not all(multimodal_settings):+ raise RuntimeError("Generated EverOS config received partial multimodal settings")if (everos.get("memory", {}).get("timezone") != timezoneor everos.get("memorize", {}).get("mode") != "chat"@@ -3467,6 +3527,8 @@ def _validate_generated_config(or everos.get("rerank", {}).get("model") != ""or everos.get("rerank", {}).get("base_url") != ""or "api_key" in everos.get("rerank", {})+ or everos.get("multimodal", {}).get("file_uri_max_bytes") != 26214400+ or "api_key" in everos.get("multimodal", {})or ome.get("strategies", {}).get("reflect_episodes", {}).get("enabled") is not Falseor ome.get("strategies", {}).get("extract_foresight", {}).get("enabled") is not False):diff --git a/core/memory/runtime.py b/core/memory/runtime.pyindex 29d7ee925..a2c1057b4 100644--- a/core/memory/runtime.py+++ b/core/memory/runtime.py@@ -19,7 +19,7 @@ from contextlib import asynccontextmanagerfrom dataclasses import asdict, dataclass, replacefrom datetime import datetime, timezonefrom pathlib import Path-from typing import Any, TypeVar+from typing import Any, Literal, TypeVarfrom config import pathsfrom config.v2_config import (@@ -36,6 +36,7 @@ from core.memory.artifact import (MemoryRuntimeActivationError,get_memory_artifact_manager,)+from core.memory.attachments import IM_ATTACHMENT_CAPTURE_AVAILABLEfrom core.memory.blocking import run_blockingfrom core.memory.clear_intent import ClearSurfacefrom core.memory.confined_filesystem import required_no_follow_flag@@ -768,12 +769,14 @@ class MemoryRuntime:self._insight_reader = Nonereturnrerank = config.processing.rerank+ multimodal = config.processing.multimodalbase_urls = tuple(valuefor value in (config.processing.llm.base_url,config.processing.embedding.base_url,rerank.base_url if rerank else None,+ multimodal.base_url if multimodal else None,)if value)@@ -783,6 +786,7 @@ class MemoryRuntime:config.processing.llm.api_key,config.processing.embedding.api_key,rerank.api_key if rerank else None,+ multimodal.api_key if multimodal else None,)if value)@@ -1312,7 +1316,15 @@ class MemoryRuntime:async def status_payload(self) -> dict[str, Any]:runtime = await self._processing_record.read_status()- return _runtime_health_payload(runtime)+ payload = _runtime_health_payload(runtime)+ payload["attachment_capture"] = {+ "status": _attachment_capture_status(+ self._config,+ runtime.source.status,+ payload.get("health"),+ ),+ }+ return payloadasync def failure_log_payload(self,@@ -2421,6 +2433,21 @@ class MemoryRuntime:rerank_base_url=(candidate.processing.rerank.base_url if candidate.processing.rerank else None),rerank_model=(candidate.processing.rerank.model if candidate.processing.rerank else None),rerank_api_key=(candidate.processing.rerank.api_key if candidate.processing.rerank else None),+ multimodal_base_url=(+ candidate.processing.multimodal.base_url+ if candidate.processing.multimodal+ else None+ ),+ multimodal_model=(+ candidate.processing.multimodal.model+ if candidate.processing.multimodal+ else None+ ),+ multimodal_api_key=(+ candidate.processing.multimodal.api_key+ if candidate.processing.multimodal+ else None+ ),preflight_call_recorder=self._record_preflight_call,)return (await provider.preflight()).payload()@@ -2442,7 +2469,7 @@ class MemoryRuntime:self._call_log_db_path,started_at_ms=started_at_ms,duration_ms=duration_ms,- kind=side,+ kind="multimodal_llm" if side == "multimodal" else side,model=model,request=request,response=response,@@ -3630,6 +3657,7 @@ class MemoryRuntime:def _provider_kwargs(config: MemoryConfig) -> dict[str, str | None]:rerank = config.processing.rerank+ multimodal = config.processing.multimodalreturn {"llm_base_url": config.processing.llm.base_url,"llm_model": config.processing.llm.model,@@ -3640,9 +3668,40 @@ def _provider_kwargs(config: MemoryConfig) -> dict[str, str | None]:"rerank_base_url": rerank.base_url if rerank else None,"rerank_model": rerank.model if rerank else None,"rerank_api_key": rerank.api_key if rerank else None,+ "multimodal_base_url": multimodal.base_url if multimodal else None,+ "multimodal_model": multimodal.model if multimodal else None,+ "multimodal_api_key": multimodal.api_key if multimodal else None,}+def _attachment_capture_status(+ config: MemoryConfig,+ source_status: object,+ health: object,+) -> Literal["ready", "not_configured", "unavailable"]:+ """Project explicit IM attachment-capture readiness from config and health."""++ if config.processing.multimodal is None:+ return "not_configured"+ if not IM_ATTACHMENT_CAPTURE_AVAILABLE:+ return "unavailable"+ if not config.enabled:+ return "unavailable"+ if source_status != "available":+ return "unavailable"+ if not isinstance(health, dict):+ return "unavailable"+ capabilities = health.get("capabilities")+ disabled = health.get("disabled_features")+ if not isinstance(capabilities, dict) or not isinstance(disabled, list):+ return "unavailable"+ if any(feature in disabled for feature in ("multimodal_llm", "parser")):+ return "unavailable"+ if capabilities.get("multimodal_llm") is not True or capabilities.get("parser") is not True:+ return "unavailable"+ return "ready"++def _active_compatible_root_formats(artifact_manager: MemoryArtifactPort) -> tuple[str, ...]:"""Read the active artifact's root formats, tolerating a broken pointer.diff --git a/core/memory/sidecar.py b/core/memory/sidecar.pyindex f3c7fff23..ce3f73609 100644--- a/core/memory/sidecar.py+++ b/core/memory/sidecar.py@@ -596,7 +596,15 @@ def _valid_session(value: object) -> bool:def _processing_healthy_from_child_environment() -> bool:"""Run fixed authenticated probes only inside the scrubbed owned child."""- from core.memory.everos import EverOSPort+ from core.memory.everos import EverOSPort, MULTIMODAL_EXPLICIT_ENV++ multimodal_kwargs: dict[str, str | None] = {}+ if os.environ.get(MULTIMODAL_EXPLICIT_ENV) == "1":+ multimodal_kwargs = {+ "multimodal_base_url": os.environ.get("EVEROS_MULTIMODAL__BASE_URL"),+ "multimodal_model": os.environ.get("EVEROS_MULTIMODAL__MODEL"),+ "multimodal_api_key": os.environ.get("EVEROS_MULTIMODAL__API_KEY"),+ }provider = EverOSPort(Path("/nonexistent-memory-sidecar.sock"),@@ -609,6 +617,7 @@ def _processing_healthy_from_child_environment() -> bool:rerank_base_url=os.environ.get("EVEROS_RERANK__BASE_URL"),rerank_model=os.environ.get("EVEROS_RERANK__MODEL"),rerank_api_key=os.environ.get("EVEROS_RERANK__API_KEY"),+ **multimodal_kwargs,)return asyncio.run(provider.processing_healthy())diff --git a/core/memory/types.py b/core/memory/types.pyindex 8d9c16bd6..638e84d05 100644--- a/core/memory/types.py+++ b/core/memory/types.py@@ -42,6 +42,7 @@ MemoryErrorCode = Literal["memory_embedding_unavailable","memory_llm_unavailable","memory_rerank_unavailable",+ "memory_multimodal_unavailable","memory_rebuild_root_busy","memory_factory_reset_failed","memory_repair_failed",@@ -76,6 +77,7 @@ CLOSED_MEMORY_ERROR_CODES = frozenset("memory_embedding_unavailable","memory_llm_unavailable","memory_rerank_unavailable",+ "memory_multimodal_unavailable","memory_rebuild_root_busy","memory_factory_reset_failed","memory_repair_failed",@@ -92,7 +94,7 @@ def is_memory_error_code(value: object) -> bool:@dataclass(frozen=True)class MemoryPreflightDiagnostic:- side: Literal["embedding", "llm", "rerank"]+ side: Literal["embedding", "llm", "rerank", "multimodal"]http_status: int | None = Noneprovider_error_code: str | None = Nonemessage: str = "provider unavailable"diff --git a/docs/plans/memory-im-attachments-1425.md b/docs/plans/memory-im-attachments-1425.mdindex 89cbcea56..71eb7a809 100644--- a/docs/plans/memory-im-attachments-1425.md+++ b/docs/plans/memory-im-attachments-1425.md@@ -139,18 +139,79 @@ runs bounded preflight and rolling sidecar reconciliation; it does not rebuildembeddings or restart Avibe.`MemoryPreflightDiagnostic.side` adds `multimodal`. Its real compatibility probe is-a tiny generated image request with no user data. Missing optional configuration-does not block Memory enablement. Insight-reader and preflight redaction include the+a generated 64x64 PNG request with no user data. Missing optional configuration does+not block Memory enablement. Insight-reader and preflight redaction include theindependent multimodal URL and key; a configured parse may produce a bounded,redacted `multimodal_llm` record, while an unconfigured skip produces no provideradd or call-log row.-Settings exposes an optional Multimodal endpoint card with the same write-only-key-and clear semantics as rerank. Status continues to project EverOS+The settings API carries the optional Multimodal endpoint with the same write-only-key+and clear semantics as rerank. Either optional endpoint can be cleared while Memory+remains enabled; required LLM and embedding keys retain the enabled-state clear gate.+The visible card is gated until the Slack closed-loop slice lands. Status continues+to project EverOS`multimodal_llm`, `parser`, and `disabled_features` and adds a concise attachmentcapture availability line. Configuration remains UI-only; no CLI config flags areadded.+### Review-loop closure decision++After review of head `cf66a808`, the orchestrator approved one whole-model closure+for the repeated multimodal health-probe root-cause class. The recurrence came from+environment provenance ambiguity: the same `EVEROS_MULTIMODAL__*` values can mean+either an explicit IM opt-in or the one-cycle Workbench compatibility fallback.++- An Avibe-private marker is present only for a complete explicit multimodal+ triple. The probe child checks multimodal only when that marker is present;+ the normal sidecar keeps the fallback variables for Workbench compatibility.+- Fixed synthetic provider health checks initially ran fully concurrently under a+ fixed 20-second child deadline. The complete model below supersedes that boundary:+ endpoints sharing provider credentials must not overlap, so the child deadline is+ derived from the largest serialized group instead of assuming one concurrent wave.+- Attachment capture reports ready only from a current available runtime health+ observation. Cached stale health and unavailable health report unavailable;+ absent explicit configuration still reports not configured.++This closure adds no persistent field, sidecar route, or provider payload shape.++### Processing health probe model++This is the complete contract for settings compatibility checks, child processing+health, and attachment readiness. It closes root-cause classes A-E, which were all+gaps in the probe model rather than independent endpoint bugs.++- **Endpoints and gating.** Saving processing settings runs the existing bounded+ compatibility preflight for LLM and embedding plus each complete optional rerank+ or multimodal endpoint. Runtime processing health runs fixed authenticated probes+ for LLM and embedding, complete rerank, and multimodal only when the private+ `AVIBE_MEMORY_MULTIMODAL_EXPLICIT=1` marker proves the persisted multimodal triple+ was explicit. The normal sidecar may still receive inherited+ `EVEROS_MULTIMODAL__*` values for the one-cycle Workbench fallback, but those values+ alone never admit a multimodal health probe.+- **Grouping and concurrency.** Runtime health groups endpoints by the exact resolved+ `(base_url, credential identity)` pair. Requests within one group run serially so a+ shared provider or key is not subjected to overlapping health traffic. Different+ groups run concurrently. The credential identity is compared only in private+ process memory and is never logged or projected.+- **Deadlines.** Each runtime provider request remains bounded at 8 seconds. The+ parent child deadline is `8 seconds * largest provider group size + 2 seconds`,+ structurally capped by the four endpoint model at 34 seconds. Independent groups+ therefore receive 10 seconds; the worst case with all four endpoints in one group+ receives 34 seconds. This bounded derived deadline supersedes the earlier fixed+ 20-second composition because serialization is now required to avoid provider+ concurrency and rate-limit failures. Settings compatibility preflight remains a+ separate sequential flow with its existing 5-second per-endpoint bound.+- **Synthetic payload.** Text, embedding, and rerank probes use fixed literals only.+ Multimodal checks use the same generated opaque 64x64 RGBA PNG (153 bytes, no user+ data) in a PNG data URI plus the fixed `Reply with OK.` prompt. Tests pin its PNG+ dimensions and exact byte digest.+- **Readiness and freshness.** Attachment capture can report `ready` only when an+ explicit multimodal config exists, the current runtime source status is+ `available`, and the projected `multimodal_llm` and parser capabilities are+ enabled. An absent config reports `not_configured`; stale or unavailable runtime+ health reports `unavailable` even when cached capability values were previously+ healthy.+## Scenario contractThe canonical capability is `memory_im_attachment_capture` under@@ -173,11 +234,15 @@ running Avibe services, real user paths, or production state.1. Contract and scenario catalog, including the stale Workbench-copy and IMnon-goal corrections in `memory-plugin-system.md`.2. Optional multimodal config, child environment, preflight/redaction, UI, and- status. IM capture stays gated.+ status. IM capture stays gated: `IM_ATTACHMENT_CAPTURE_AVAILABLE` remains false,+ the settings response hides the card, and configured capture cannot report+ `ready`; absent configuration retains the locked `not_configured` projection.3. Shared leased materializer, bounded Telegram/WeChat acquisition, and pin-sourcegeneralization. IM capture stays gated.4. Attachment classification/admission and the Slack closed loop with call-log- proof.+ proof. This slice flips `IM_ATTACHMENT_CAPTURE_AVAILABLE` only after the capture+ path and its closed-loop evidence land, revealing the endpoint card and enabling+ health-derived readiness without adding a user-facing toggle.5. Discord, Telegram, Feishu/Lark, and WeChat enablement and contract tests, plusfinal user documentation and manual verification matrix.diff --git a/tests/test_internal_client_timeouts.py b/tests/test_internal_client_timeouts.pyindex 109ad3970..54ffdae76 100644--- a/tests/test_internal_client_timeouts.py+++ b/tests/test_internal_client_timeouts.py@@ -15,6 +15,7 @@ from pathlib import Pathfrom core.memory.confined_filesystem import PRIVATE_SQLITE_BUSY_TIMEOUT_SECONDSfrom core.memory.module import PROVIDER_READ_TIMEOUT_SECONDS+from core.memory.everos import PROCESSING_PROBE_MAX_DEADLINE_SECONDSfrom core.memory.types import MAX_AGENTIC_TIMEOUT_SECONDSfrom core.memory.processing_record import (PROCESSING_RECORD_TRANSPORT_MARGIN_SECONDS,@@ -163,6 +164,7 @@ def _reconcile_lifecycle_budget_seconds() -> float:def test_reconcile_client_outlasts_every_bounded_lifecycle_step() -> None:+ assert _PROCESSING_PROBE_TIMEOUT_SECONDS == PROCESSING_PROBE_MAX_DEADLINE_SECONDSassert MEMORY_RECONCILE_TIMEOUT_SECONDS > _reconcile_lifecycle_budget_seconds()diff --git a/tests/test_memory_cli.py b/tests/test_memory_cli.pyindex 506589a48..58b5d3693 100644--- a/tests/test_memory_cli.py+++ b/tests/test_memory_cli.py@@ -403,6 +403,7 @@ def test_memory_cli_human_output_uses_configured_i18n(monkeypatch, capsys) -> No"cascade": {},"recorder": {},},+ "attachment_capture": {"status": "ready"},},},)@@ -411,6 +412,7 @@ def test_memory_cli_human_output_uses_configured_i18n(monkeypatch, capsys) -> Noassert capsys.readouterr().out.splitlines() == ["记忆来源:数据已过期","EverOS 1.2.3:正常",+ "IM 附件捕获:可用","来源原因:记忆 sidecar 不可用",]diff --git a/tests/test_memory_config.py b/tests/test_memory_config.pyindex 83a6935f7..1483c74b9 100644--- a/tests/test_memory_config.py+++ b/tests/test_memory_config.py@@ -138,6 +138,34 @@ def test_released_memory_config_without_rerank_loads_and_saves_without_shape_chuassert V2Config.load(tmp_path / "config.json").memory.processing.rerank is None+def test_released_memory_config_without_multimodal_has_no_shape_churn(tmp_path) -> None:+ """MEMORY-IM-ATTACH-003: legacy config remains opted out after round-trip."""++ config = V2Config.from_payload(+ _payload({"enabled": True, "processing": _complete_processing()})+ )++ assert config.memory.processing.multimodal is None+ config.save(tmp_path / "config.json")++ stored = json.loads((tmp_path / "config.json").read_text(encoding="utf-8"))+ assert "multimodal" not in stored["memory"]["processing"]+ assert V2Config.load(tmp_path / "config.json").memory.processing.multimodal is None+++def test_empty_multimodal_endpoint_normalizes_to_absent(tmp_path) -> None:+ processing = _complete_processing()+ processing["multimodal"] = {}+ config = V2Config.from_payload(+ _payload({"enabled": True, "processing": processing})+ )++ assert config.memory.processing.multimodal is None+ config.save(tmp_path / "config.json")+ stored = json.loads((tmp_path / "config.json").read_text(encoding="utf-8"))+ assert "multimodal" not in stored["memory"]["processing"]++def test_disk_load_degrades_only_a_malformed_optional_rerank_section(tmp_path) -> None:processing = _complete_processing()processing["rerank"] = {@@ -165,6 +193,36 @@ def test_disk_load_degrades_only_a_malformed_optional_rerank_section(tmp_path) -assert "rerank" in json.loads(config_path.read_text(encoding="utf-8"))["memory"]["processing"]+def test_disk_load_degrades_only_a_malformed_optional_multimodal_section(tmp_path) -> None:+ processing = _complete_processing()+ processing["multimodal"] = {+ "base_url": "https://vision.example.test/v1",+ "model": "vision-model",+ }+ config_path = tmp_path / "config.json"+ config_path.write_text(+ json.dumps(+ _payload(+ {+ "enabled": True,+ "recovery_intent": "rebuild",+ "processing": processing,+ }+ )+ ),+ encoding="utf-8",+ )++ loaded = V2Config.load(config_path)++ assert loaded.memory.enabled is True+ assert loaded.memory.processing.llm.model == "chat"+ assert loaded.memory.processing.embedding.model == "embed"+ assert loaded.memory.processing.multimodal is None+ assert loaded.memory.recovery_intent == "rebuild"+ assert any("memory.multimodal" in warning for warning in loaded.load_warnings)++def test_memory_rerank_round_trips_without_projecting_its_key(tmp_path) -> None:processing = _complete_processing()processing["rerank"] = {@@ -188,6 +246,48 @@ def test_memory_rerank_round_trips_without_projecting_its_key(tmp_path) -> None:}+def test_memory_multimodal_round_trips_without_projecting_its_key(tmp_path) -> None:+ """MEMORY-IM-ATTACH-001: a complete endpoint is the explicit opt-in."""++ processing = _complete_processing()+ processing["multimodal"] = {+ "base_url": "https://vision.example.test/v1",+ "model": "vision-model",+ "api_key": "vision-secret",+ }+ config = V2Config.from_payload(+ _payload({"enabled": True, "processing": processing})+ )+ config.save(tmp_path / "config.json")++ stored = json.loads((tmp_path / "config.json").read_text(encoding="utf-8"))+ projected = config_to_payload(config)["memory"]["processing"]["multimodal"]+ assert stored["memory"]["processing"]["multimodal"]["api_key"] == "vision-secret"+ assert projected == {+ "base_url": "https://vision.example.test/v1",+ "model": "vision-model",+ "api_key": None,+ "has_api_key": True,+ }++[email protected]("missing", ["base_url", "model", "api_key"])+def test_memory_config_rejects_partially_filled_multimodal(missing: str) -> None:+ processing = _complete_processing()+ multimodal = {+ "base_url": "https://vision.example.test/v1",+ "model": "vision-model",+ "api_key": "vision-secret",+ }+ multimodal.pop(missing)+ processing["multimodal"] = multimodal++ with pytest.raises(ValueError, match="Memory multimodal endpoint must include"):+ V2Config.from_payload(+ _payload({"enabled": False, "processing": processing})+ )++@pytest.mark.parametrize("missing", ["base_url", "model", "api_key"])def test_memory_config_rejects_partially_filled_rerank(missing: str) -> None:processing = _complete_processing()diff --git a/tests/test_memory_everos.py b/tests/test_memory_everos.pyindex f1a8d0105..f92d9697f 100644--- a/tests/test_memory_everos.py+++ b/tests/test_memory_everos.py@@ -1,7 +1,10 @@from __future__ import annotationsimport asyncio+import base64+import hashlibimport json+import structfrom pathlib import Pathfrom unittest.mock import patch@@ -1266,6 +1269,67 @@ def test_processing_health_probes_both_authenticated_endpoints() -> None:assert all(request.headers["authorization"].startswith("Bearer ") for request in requests)+def test_processing_health_serializes_identical_provider_credentials(monkeypatch) -> None:+ provider = EverOSPort(+ Path("/tmp/everos.sock"),+ llm_base_url="https://shared.example.test/v1",+ llm_model="chat-model",+ llm_api_key="shared-secret",+ embedding_base_url="https://shared.example.test/v1",+ embedding_model="embedding-model",+ embedding_api_key="embedding-secret",+ rerank_base_url="https://rerank.example.test/v1/inference",+ rerank_model="rerank-model",+ rerank_api_key="shared-secret",+ multimodal_base_url="https://shared.example.test/v1",+ multimodal_model="vision-model",+ multimodal_api_key="shared-secret",+ )+ first_wave_started = asyncio.Event()+ release = asyncio.Event()+ started: list[tuple[tuple[str, str], str]] = []+ active_by_group: dict[tuple[str, str], int] = {}+ max_active_by_group: dict[tuple[str, str], int] = {}+ max_total_active = 0++ async def probe(*, base_url, api_key, path, payload, **_kwargs) -> bool:+ nonlocal max_total_active+ group = (base_url, api_key)+ name = payload.get("model") or path+ active_by_group[group] = active_by_group.get(group, 0) + 1+ max_active_by_group[group] = max(+ max_active_by_group.get(group, 0),+ active_by_group[group],+ )+ max_total_active = max(max_total_active, sum(active_by_group.values()))+ started.append((group, name))+ if len(started) == 3:+ first_wave_started.set()+ try:+ await release.wait()+ return True+ finally:+ active_by_group[group] -= 1++ monkeypatch.setattr(provider, "_probe_processing_endpoint", probe)++ async def run() -> bool:+ task = asyncio.create_task(provider.processing_healthy())+ await asyncio.wait_for(first_wave_started.wait(), timeout=1.0)+ assert {name for _group, name in started} == {+ "chat-model",+ "embedding-model",+ "rerank-model",+ }+ release.set()+ return await task++ assert asyncio.run(run()) is True+ assert [name for _group, name in started].count("vision-model") == 1+ assert max_total_active == 3+ assert all(active == 1 for active in max_active_by_group.values())++def test_processing_preflight_projects_sanitized_provider_error() -> None:def handler(request: httpx.Request) -> httpx.Response:if request.url.path.endswith("/chat/completions"):@@ -1340,6 +1404,115 @@ def test_processing_preflight_probes_configured_rerank_endpoint() -> None:assert "model" not in recorded[-1]["request"]+def test_processing_preflight_probes_configured_multimodal_endpoint() -> None:+ """MEMORY-IM-ATTACH-001: opt-in is admitted with synthetic image data only."""++ requests: list[httpx.Request] = []+ recorded: list[dict[str, object]] = []++ def handler(request: httpx.Request) -> httpx.Response:+ requests.append(request)+ if request.url.path.endswith("/embeddings"):+ return httpx.Response(200, json={"data": [{"embedding": [0.1]}]})+ return httpx.Response(+ 200,+ json={"choices": [{"message": {"content": "OK"}}]},+ )++ async def run():+ return await EverOSPort(+ Path("/tmp/everos.sock"),+ llm_base_url="https://llm.example.test/v1",+ llm_model="chat",+ llm_api_key="llm-secret",+ embedding_base_url="https://embed.example.test/v1",+ embedding_model="embed",+ embedding_api_key="embedding-secret",+ multimodal_base_url="https://vision.example.test/v1",+ multimodal_model="vision-model",+ multimodal_api_key="vision-secret",+ preflight_call_recorder=lambda **kwargs: recorded.append(kwargs),+ ).preflight()++ real_async_client = httpx.AsyncClient+ with patch("core.memory.everos.httpx.AsyncClient", autospec=True) as client_type:+ client_type.side_effect = lambda **kwargs: real_async_client(+ transport=httpx.MockTransport(handler), **kwargs+ )+ result = asyncio.run(run())++ assert result.ok is True+ assert [request.url.path for request in requests] == [+ "/v1/chat/completions",+ "/v1/embeddings",+ "/v1/chat/completions",+ ]+ payload = json.loads(requests[-1].content)+ assert payload["model"] == "vision-model"+ assert payload["messages"][0]["content"][0] == {+ "type": "text",+ "text": "Reply with OK.",+ }+ image_url = payload["messages"][0]["content"][1]["image_url"]["url"]+ prefix, encoded_image = image_url.split(",", 1)+ assert prefix == "data:image/png;base64"+ assert len(image_url) < 256+ image_bytes = base64.b64decode(encoded_image, validate=True)+ assert len(image_bytes) == 153+ assert image_bytes.startswith(b"\x89PNG\r\n\x1a\n")+ assert struct.unpack(">II", image_bytes[16:24]) == (64, 64)+ assert hashlib.sha256(image_bytes).hexdigest() == (+ "da1cbcc0076a2b589fd4d5b79d7fd171d6dff91f4d708d8dec041f4a6e60734f"+ )+ assert requests[-1].headers["authorization"] == "Bearer vision-secret"+ assert recorded[-1]["side"] == "multimodal"+ assert recorded[-1]["model"] == "vision-model"+++def test_processing_preflight_returns_typed_multimodal_failure() -> None:+ call_count = 0++ def handler(request: httpx.Request) -> httpx.Response:+ nonlocal call_count+ call_count += 1+ if request.url.path.endswith("/embeddings"):+ return httpx.Response(200, json={"data": [{"embedding": [0.1]}]})+ if call_count == 3:+ return httpx.Response(401, json={"error": {"code": "invalid_key"}})+ return httpx.Response(+ 200,+ json={"choices": [{"message": {"content": "OK"}}]},+ )++ async def run():+ return await EverOSPort(+ Path("/tmp/everos.sock"),+ llm_base_url="https://llm.example.test/v1",+ llm_model="chat",+ llm_api_key="llm-secret",+ embedding_base_url="https://embed.example.test/v1",+ embedding_model="embed",+ embedding_api_key="embedding-secret",+ multimodal_base_url="https://vision.example.test/v1",+ multimodal_model="vision-model",+ multimodal_api_key="vision-secret",+ ).preflight()++ real_async_client = httpx.AsyncClient+ with patch("core.memory.everos.httpx.AsyncClient", autospec=True) as client_type:+ client_type.side_effect = lambda **kwargs: real_async_client(+ transport=httpx.MockTransport(handler), **kwargs+ )+ result = asyncio.run(run())++ assert result.ok is False+ assert result.failure is not None+ assert result.failure.error == "memory_multimodal_unavailable"+ assert result.failure.diagnostic.side == "multimodal"+ assert result.failure.diagnostic.http_status == 401+ assert result.failure.diagnostic.provider_error_code == "invalid_key"++def test_processing_preflight_returns_typed_rerank_failure() -> None:def handler(request: httpx.Request) -> httpx.Response:if request.url.path.endswith("/chat/completions"):diff --git a/tests/test_memory_process.py b/tests/test_memory_process.pyindex ef2c4eee1..200b8513d 100644--- a/tests/test_memory_process.py+++ b/tests/test_memory_process.py@@ -29,6 +29,7 @@ from core.memory.artifact import FakeMemoryArtifactManagerfrom core.memory.attachments import AttachmentPinStore, attachment_pin_rootfrom core.memory.everos import (EverOSPort,+ MULTIMODAL_EXPLICIT_ENV,ProviderCapture,)import core.memory.process as memory_process@@ -213,6 +214,71 @@ def _settings() -> EverOSProcessSettings:)+def test_processing_probe_timeout_is_derived_from_largest_provider_group() -> None:+ independent = replace(+ _settings(),+ rerank_base_url="https://rerank.example.test/v1/inference",+ rerank_model="rerank",+ rerank_api_key="shared-secret",+ multimodal_base_url="https://llm.example.test/v1",+ multimodal_model="vision",+ multimodal_api_key="vision-secret",+ )+ one_group = replace(+ independent,+ embedding_base_url="https://llm.example.test/v1",+ embedding_api_key="shared-secret",+ llm_api_key="shared-secret",+ rerank_base_url="https://llm.example.test/v1",+ multimodal_api_key="shared-secret",+ )++ assert memory_process._processing_probe_timeout_seconds(independent) == 10.0+ assert memory_process._processing_probe_timeout_seconds(one_group) == 34.0+++async def test_processing_probe_applies_derived_parent_deadline(+ monkeypatch,+ tmp_path: Path,+) -> None:+ class _Probe:+ pid = 999_999+ returncode = 0+ stderr = None++ async def wait(self) -> None:+ return None++ settings = replace(+ _settings(),+ llm_api_key="shared-secret",+ embedding_base_url="https://llm.example.test/v1",+ embedding_api_key="shared-secret",+ rerank_base_url="https://llm.example.test/v1",+ rerank_model="rerank",+ rerank_api_key="shared-secret",+ multimodal_base_url="https://llm.example.test/v1",+ multimodal_model="vision",+ multimodal_api_key="shared-secret",+ )+ timeouts: list[float] = []++ async def capture_timeout(awaitable, *, timeout):+ timeouts.append(timeout)+ return await awaitable++ monkeypatch.setattr(memory_process.asyncio, "wait_for", capture_timeout)+ process = EverOSProcess(+ sys.executable,+ effective_home=tmp_path,+ settings=settings,+ _host=_FakeProcessHost(spawns=deque([_Probe()])),+ )++ assert await process.processing_healthy() is True+ assert timeouts == [34.0]++def _pid_exists(pid: int) -> bool:try:process = psutil.Process(pid)@@ -308,14 +374,18 @@ def test_sidecar_child_environment_is_allowlisted_and_generated_config_has_no_ke"","[multimodal]",f'file_uri_allow_dirs = ["{attachment_pin_root(tmp_path)}"]',+ "file_uri_max_bytes = 26214400","",))assert environment["EVEROS_LLM__API_KEY"] == "llm-secret"+ # Workbench keeps its legacy implicit LLM inheritance for one cycle. IM+ # capture still requires an explicit persisted multimodal endpoint.assert environment["EVEROS_MULTIMODAL__BASE_URL"] == environment["EVEROS_LLM__BASE_URL"]assert environment["EVEROS_MULTIMODAL__MODEL"] == environment["EVEROS_LLM__MODEL"]assert environment["EVEROS_MULTIMODAL__API_KEY"] == "llm-secret"+ assert MULTIMODAL_EXPLICIT_ENV not in environmentassert environment["AVIBE_MEMORY_ATTACHMENTS_ROOT"] == str(attachment_pin_root(tmp_path))@@ -332,6 +402,37 @@ def test_sidecar_child_environment_is_allowlisted_and_generated_config_has_no_keassert "AVIBE_MEMORY_CALL_LOG_DB" not in environment+def test_configured_multimodal_stays_env_only_and_independent_from_llm(tmp_path: Path) -> None:+ settings = replace(+ _settings(),+ timezone="UTC",+ multimodal_base_url="https://vision.example.test/v1",+ multimodal_model="vision-model",+ multimodal_api_key="vision-secret",+ )+ process = EverOSProcess(+ sys.executable,+ effective_home=tmp_path,+ settings=settings,+ )+ process._prepare_owned_directories()+ process._write_generated_config()++ environment = process._child_environment()+ generated = (tmp_path / "memory" / "generated" / "everos.toml").read_text(+ encoding="utf-8"+ )+ parsed = memory_process.tomllib.loads(generated)++ assert environment["EVEROS_MULTIMODAL__BASE_URL"] == settings.multimodal_base_url+ assert environment["EVEROS_MULTIMODAL__MODEL"] == "vision-model"+ assert environment["EVEROS_MULTIMODAL__API_KEY"] == "vision-secret"+ assert environment["EVEROS_MULTIMODAL__MODEL"] != environment["EVEROS_LLM__MODEL"]+ assert environment[MULTIMODAL_EXPLICIT_ENV] == "1"+ assert parsed["multimodal"]["file_uri_max_bytes"] == 25 * 1024 * 1024+ assert "vision-secret" not in generated++def test_configured_rerank_stays_env_only_when_env_overrides_toml(tmp_path: Path) -> None:settings = replace(_settings(),diff --git a/tests/test_memory_runtime.py b/tests/test_memory_runtime.pyindex cead39be8..1057011ff 100644--- a/tests/test_memory_runtime.py+++ b/tests/test_memory_runtime.py@@ -330,6 +330,7 @@ def test_memory_runtime_factory_degrades_when_private_modes_cannot_be_enforced("reason": "memory_sidecar_unavailable",},"health": None,+ "attachment_capture": {"status": "not_configured"},}assert asyncio.run(runtime.maintenance_payload()) == {"status": "ok",@@ -3427,6 +3428,44 @@ async def test_runtime_reconciliation_rolls_sidecar_for_rerank_configuration(await memory_runtime_factory.close(runtime)+async def test_runtime_reconciliation_rolls_sidecar_for_multimodal_configuration(+ memory_runtime_factory,+) -> None:+ factory = FakeEverOSProcessFactory()+ processing = MemoryProcessingConfig(+ llm=MemoryEndpointConfig("https://llm.example.test/v1", "chat", "llm-key"),+ embedding=MemoryEndpointConfig(+ "https://embed.example.test/v1", "embed", "embed-key"+ ),+ )+ initial = MemoryConfig(enabled=True, processing=processing)+ runtime = memory_runtime_factory(+ initial,+ artifact_manager=_installed_artifact(),+ process_factory=factory,+ )+ assert (await runtime.reconcile(initial))["ok"] is True++ configured = replace(+ initial,+ processing=replace(+ processing,+ multimodal=MemoryEndpointConfig(+ "https://vision.example.test/v1",+ "vision-model",+ "vision-key",+ ),+ ),+ )+ assert (await runtime.reconcile(configured))["ok"] is True++ assert len(factory.supervised) == 2+ assert factory.supervised[0].stopped is True+ assert factory.supervised[1].settings.multimodal_model == "vision-model"+ assert factory.supervised[1].settings.multimodal_api_key == "vision-key"+ await memory_runtime_factory.close(runtime)++async def test_runtime_preflight_failure_keeps_existing_sidecar_running(monkeypatch,memory_runtime_factory,@@ -3593,9 +3632,17 @@ async def test_status_preserves_everos_disabled_recorder_state(memory_runtime_factory,) -> None:monkeypatch.setenv("AVIBE_HOME", str(tmp_path))+ monkeypatch.setattr(memory_runtime, "IM_ATTACHMENT_CAPTURE_AVAILABLE", True)config = MemoryConfig(enabled=True,- processing=_processing_config(),+ processing=replace(+ _processing_config(),+ multimodal=MemoryEndpointConfig(+ "https://vision.example.test/v1",+ "vision-model",+ "vision-key",+ ),+ ),diagnostics=MemoryDiagnosticsConfig(log_provider_calls=True),)@@ -3626,13 +3673,95 @@ async def test_status_preserves_everos_disabled_recorder_state(return snapshotmonkeypatch.setattr(runtime._provider, "health_snapshot", health_snapshot)- assert (await runtime.status_payload())["health"]["recorder"] == {+ status = await runtime.status_payload()+ assert status["health"]["recorder"] == {"state": "disabled","reason": None,}+ assert status["attachment_capture"] == {"status": "ready"}+ await memory_runtime_factory.close(runtime)+++async def test_attachment_capture_status_rejects_stale_runtime_health(+ monkeypatch: pytest.MonkeyPatch,+ tmp_path: Path,+ memory_runtime_factory,+) -> None:+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))+ monkeypatch.setattr(memory_runtime, "IM_ATTACHMENT_CAPTURE_AVAILABLE", True)+ config = MemoryConfig(+ enabled=True,+ processing=replace(+ _processing_config(),+ multimodal=MemoryEndpointConfig(+ "https://vision.example.test/v1",+ "vision-model",+ "vision-key",+ ),+ ),+ )+ runtime = memory_runtime_factory(+ config,+ artifact_manager=_installed_artifact(),+ process_factory=FakeEverOSProcessFactory(),+ effective_home=tmp_path,+ )+ assert (await runtime.reconcile(config))["ok"] is True+ snapshot = ProviderHealthSnapshot(+ status="ok",+ version="1.2.3",+ capabilities={+ "llm": True,+ "embed": True,+ "rerank": True,+ "multimodal_llm": True,+ "parser": True,+ },+ disabled_features=(),+ cascade=None,+ recorder={"state": "active", "reason": None},+ )+ calls = 0++ async def health_snapshot() -> ProviderHealthSnapshot:+ nonlocal calls+ calls += 1+ if calls == 1:+ return snapshot+ raise RuntimeError("sidecar unavailable")++ monkeypatch.setattr(runtime._provider, "health_snapshot", health_snapshot)+ assert (await runtime.status_payload())["attachment_capture"] == {"status": "ready"}++ stale = await runtime.status_payload()+ assert stale["source"]["status"] == "stale"+ assert stale["attachment_capture"] == {"status": "unavailable"}await memory_runtime_factory.close(runtime)+def test_attachment_capture_status_stays_unavailable_until_im_capture_lands() -> None:+ config = MemoryConfig(+ enabled=True,+ processing=replace(+ _processing_config(),+ multimodal=MemoryEndpointConfig(+ "https://vision.example.test/v1",+ "vision-model",+ "vision-key",+ ),+ ),+ )+ health = {+ "capabilities": {"multimodal_llm": True, "parser": True},+ "disabled_features": [],+ }++ assert (+ memory_runtime._attachment_capture_status(config, "available", health)+ == "unavailable"+ )++async def test_recorder_reap_hands_call_log_to_host_until_restart(monkeypatch: pytest.MonkeyPatch,tmp_path: Path,@@ -5408,6 +5537,11 @@ def test_runtime_builds_insight_reader_from_injected_paths(base_url="https://embed.example.test/v1",api_key="opaque-embedding-key",),+ multimodal=MemoryEndpointConfig(+ base_url="https://vision.example.test/v1",+ model="vision-model",+ api_key="opaque-vision-key",+ ),))@@ -5422,13 +5556,61 @@ def test_runtime_builds_insight_reader_from_injected_paths(assert runtime._insight_reader._provider_base_urls == ("https://llm.example.test/v1","https://embed.example.test/v1",+ "https://vision.example.test/v1",)assert set(runtime._insight_reader._exact_redaction_values) == {"opaque-llm-key","opaque-embedding-key",+ "opaque-vision-key",}+def test_multimodal_preflight_records_under_redacted_provider_kind(+ monkeypatch: pytest.MonkeyPatch,+ tmp_path: Path,+) -> None:+ observed: dict[str, object] = {}+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))+ monkeypatch.setattr(+ memory_runtime,+ "record_preflight_call",+ lambda _path, **kwargs: observed.update(kwargs),+ )+ runtime = MemoryRuntime(+ MemoryConfig(),+ store=MemoryStore(tmp_path / "state" / "memory" / "memory.sqlite"),+ effective_home=tmp_path,+ )++ runtime._record_preflight_call(+ side="multimodal",+ model="vision-model",+ request={+ "messages": [+ {+ "role": "user",+ "content": [+ {+ "type": "image_url",+ "image_url": {"url": "data:image/png;base64,synthetic"},+ }+ ],+ }+ ]+ },+ response={"choices": [{"message": {"content": "OK"}}]},+ failure=None,+ base_url="https://vision.example.test/v1",+ api_key="vision-secret",+ started_at_ms=1,+ duration_ms=2,+ )++ assert observed["kind"] == "multimodal_llm"+ assert observed["provider_base_urls"] == ("https://vision.example.test/v1",)+ assert observed["exact_redaction_values"] == ("vision-secret",)++async def test_cancelled_insight_read_keeps_lifecycle_lock_until_thread_finishes(monkeypatch: pytest.MonkeyPatch,tmp_path: Path,diff --git a/tests/test_memory_sidecar.py b/tests/test_memory_sidecar.pyindex faa143353..2106ac001 100644--- a/tests/test_memory_sidecar.py+++ b/tests/test_memory_sidecar.py@@ -10,6 +10,7 @@ from types import SimpleNamespaceimport pytestfrom core.memory import everos+from core.memory.everos import MULTIMODAL_EXPLICIT_ENVfrom core.memory import sidecarfrom core.memory.sidecar import (_RecorderHealthProjection,@@ -717,6 +718,10 @@ def test_processing_probe_builds_the_adapter_from_child_environment_only(monkeypmonkeypatch.setenv("EVEROS_RERANK__BASE_URL", "https://rerank.example.test/v1/inference")monkeypatch.setenv("EVEROS_RERANK__MODEL", "rerank-model")monkeypatch.setenv("EVEROS_RERANK__API_KEY", "rerank-secret")+ monkeypatch.setenv("EVEROS_MULTIMODAL__BASE_URL", "https://vision.example.test/v1")+ monkeypatch.setenv("EVEROS_MULTIMODAL__MODEL", "vision-model")+ monkeypatch.setenv("EVEROS_MULTIMODAL__API_KEY", "vision-secret")+ monkeypatch.setenv(MULTIMODAL_EXPLICIT_ENV, "1")monkeypatch.setattr(everos, "EverOSPort", _Provider)assert _processing_healthy_from_child_environment() is True@@ -731,4 +736,34 @@ def test_processing_probe_builds_the_adapter_from_child_environment_only(monkeyp"rerank_base_url": "https://rerank.example.test/v1/inference","rerank_model": "rerank-model","rerank_api_key": "rerank-secret",+ "multimodal_base_url": "https://vision.example.test/v1",+ "multimodal_model": "vision-model",+ "multimodal_api_key": "vision-secret",}+++def test_processing_probe_omits_legacy_multimodal_fallback_without_explicit_marker(+ monkeypatch,+) -> None:+ received: dict[str, object] = {}++ class _Provider:+ def __init__(self, _socket_path, **kwargs) -> None:+ received.update(kwargs)++ async def processing_healthy(self) -> bool:+ return True++ monkeypatch.setenv("EVEROS_LLM__BASE_URL", "https://llm.example.test/v1")+ monkeypatch.setenv("EVEROS_LLM__MODEL", "text-model")+ monkeypatch.setenv("EVEROS_LLM__API_KEY", "llm-secret")+ monkeypatch.setenv("EVEROS_EMBEDDING__BASE_URL", "https://embed.example.test/v1")+ monkeypatch.setenv("EVEROS_EMBEDDING__MODEL", "embed-model")+ monkeypatch.setenv("EVEROS_EMBEDDING__API_KEY", "embedding-secret")+ monkeypatch.setenv("EVEROS_MULTIMODAL__BASE_URL", "https://llm.example.test/v1")+ monkeypatch.setenv("EVEROS_MULTIMODAL__MODEL", "text-model")+ monkeypatch.setenv("EVEROS_MULTIMODAL__API_KEY", "llm-secret")+ monkeypatch.setattr(everos, "EverOSPort", _Provider)++ assert _processing_healthy_from_child_environment() is True+ assert not any(key.startswith("multimodal_") for key in received)diff --git a/tests/test_ui_memory_routes.py b/tests/test_ui_memory_routes.pyindex 52e041035..4efdaf3fa 100644--- a/tests/test_ui_memory_routes.py+++ b/tests/test_ui_memory_routes.py@@ -121,6 +121,102 @@ def test_memory_settings_key_clear_removes_the_optional_rerank_endpoint() -> Nonassert candidate.memory.processing.rerank is None+def test_memory_settings_patch_accepts_and_clears_multimodal_endpoint() -> None:+ current = V2Config(+ mode="self_host",+ version="v2",+ slack=SlackConfig(bot_token=""),+ runtime=RuntimeConfig(default_cwd="."),+ agents=AgentsConfig(),+ )+ target, confirm_rebuild = ui_memory_routes._memory_settings_patch(+ current,+ {+ "processing": {+ "multimodal": {+ "base_url": "https://vision.example.test/v1",+ "model": "vision-model",+ "api_key": "vision-secret",+ }+ }+ },+ )+ configured = ui_memory_routes._memory_candidate_config(current, target)++ assert confirm_rebuild is False+ assert configured.memory.processing.multimodal == MemoryEndpointConfig(+ "https://vision.example.test/v1",+ "vision-model",+ "vision-secret",+ )++ cleared_target, _ = ui_memory_routes._memory_settings_patch(+ configured,+ {"processing": {"multimodal": {"api_key": None}}},+ )+ cleared = ui_memory_routes._memory_candidate_config(configured, cleared_target)+ assert cleared.memory.processing.multimodal is None++[email protected]("endpoint", ["rerank", "multimodal"])+def test_enabled_memory_can_clear_optional_endpoint_and_reconcile(+ monkeypatch,+ tmp_path,+ endpoint: str,+) -> None:+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))+ _save_config(tmp_path)+ _save_memory(+ MemoryConfig(+ enabled=True,+ processing=MemoryProcessingConfig(+ llm=MemoryEndpointConfig(+ "https://llm.example.test/v1", "chat", "llm-key"+ ),+ embedding=MemoryEndpointConfig(+ "https://embed.example.test/v1", "embed", "embed-key"+ ),+ rerank=MemoryEndpointConfig(+ "https://rerank.example.test/v1/inference",+ "rerank-model",+ "rerank-key",+ ),+ multimodal=MemoryEndpointConfig(+ "https://vision.example.test/v1", "vision-model", "vision-key"+ ),+ ),+ )+ )+ reconcile_calls: list[bool] = []++ async def preflight_must_not_run(*_args, **_kwargs):+ pytest.fail("removing an optional endpoint must not preflight it")++ async def reconcile():+ reconcile_calls.append(True)+ return {"status_code": 200, "body": {"ok": True, "state": "ready"}}++ monkeypatch.setattr(internal_client, "memory_preflight", preflight_must_not_run)+ monkeypatch.setattr(internal_client, "reconcile_memory", reconcile)+ client = app.test_client()+ response = client.patch(+ "/api/memory/settings",+ json={"processing": {endpoint: {"api_key": None}}},+ headers=csrf_headers(client, "http://127.0.0.1:15131"),+ base_url="http://127.0.0.1:15131",+ environ_base={"REMOTE_ADDR": "127.0.0.1"},+ )++ assert response.status_code == 200+ assert response.get_json()["enabled"] is True+ assert response.get_json()["im_attachment_capture_available"] is False+ assert endpoint not in response.get_json()["processing"]+ saved = V2Config.load().memory+ assert saved.enabled is True+ assert getattr(saved.processing, endpoint) is None+ assert reconcile_calls == [True]++def _save_config(tmp_path) -> None:V2Config(mode="self_host",@@ -219,6 +315,87 @@ def test_enabled_rerank_change_runs_typed_preflight_before_persisting(assert V2Config.load().memory.processing.rerank is None+def test_enabled_multimodal_change_runs_typed_preflight_before_persisting(+ monkeypatch,+ tmp_path,+) -> None:+ """MEMORY-IM-ATTACH-001: enabling the endpoint is admitted fail-closed."""++ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))+ _save_config(tmp_path)+ _save_memory(+ MemoryConfig(+ enabled=True,+ processing=MemoryProcessingConfig(+ llm=MemoryEndpointConfig(+ "https://llm.example.test/v1", "chat", "llm-key"+ ),+ embedding=MemoryEndpointConfig(+ "https://embed.example.test/v1", "embed", "embed-key"+ ),+ ),+ )+ )+ from config.paths import get_config_path++ config_before = get_config_path().read_bytes()++ async def preflight(*, payload: dict, user_key: str):+ multimodal = payload["memory"]["processing"]["multimodal"]+ assert user_key == "avibe:local"+ assert multimodal["model"] == "vision-model"+ assert multimodal["api_key"] == "vision-secret"+ return {+ "status_code": 409,+ "body": {+ "ok": False,+ "error": "memory_multimodal_unavailable",+ "diagnostic": {+ "side": "multimodal",+ "http_status": 401,+ "provider_error_code": "invalid_key",+ "message": "provider_error",+ },+ },+ }++ async def unexpected_reconcile():+ pytest.fail("failed multimodal admission must not reconcile or persist")++ monkeypatch.setattr(internal_client, "memory_preflight", preflight)+ monkeypatch.setattr(internal_client, "reconcile_memory", unexpected_reconcile)+ client = app.test_client()+ response = client.patch(+ "/api/memory/settings",+ json={+ "processing": {+ "multimodal": {+ "base_url": "https://vision.example.test/v1",+ "model": "vision-model",+ "api_key": "vision-secret",+ }+ }+ },+ headers=csrf_headers(client, "http://127.0.0.1:15131"),+ base_url="http://127.0.0.1:15131",+ environ_base={"REMOTE_ADDR": "127.0.0.1"},+ )++ assert response.status_code == 409+ assert response.get_json() == {+ "status": "failed",+ "error": "memory_multimodal_unavailable",+ "diagnostic": {+ "side": "multimodal",+ "http_status": 401,+ "provider_error_code": "invalid_key",+ "message": "provider_error",+ },+ }+ assert get_config_path().read_bytes() == config_before+ assert V2Config.load().memory.processing.multimodal is None++def _save_remote_config(tmp_path) -> V2Config:_save_config(tmp_path)config = V2Config.load()@@ -421,6 +598,7 @@ def test_memory_settings_are_direct_loopback_only_and_write_only(monkeypatch, tmassert response.get_json()["processing"]["llm"]["has_api_key"] is Falseassert response.get_json()["rebuild_required"] is Falseassert response.get_json()["repair_available"] is False+ assert response.get_json()["im_attachment_capture_available"] is Falseassert "recovery_intent" not in response.get_json()assert "embedding_change_pending" not in response.get_json()assert "diagnostics" not in response.get_json()diff --git a/ui/src/components/settings/memory/MemorySettingsPanel.test.tsx b/ui/src/components/settings/memory/MemorySettingsPanel.test.tsxindex 6f09780e1..11a7cb4d7 100644--- a/ui/src/components/settings/memory/MemorySettingsPanel.test.tsx+++ b/ui/src/components/settings/memory/MemorySettingsPanel.test.tsx@@ -51,6 +51,7 @@ const endpoint = (baseUrl: string) => ({const legacySettings: MemorySettings = {status: 'ok',enabled: true,+ im_attachment_capture_available: true,processing: {llm: endpoint('https://old.example.test/v1'),embedding: endpoint('https://embedding.example.test/v1'),@@ -67,6 +68,7 @@ const emptyEndpoint = {const firstSetupSettings: MemorySettings = {status: 'ok',enabled: false,+ im_attachment_capture_available: true,processing: {llm: emptyEndpoint,embedding: emptyEndpoint,@@ -79,10 +81,10 @@ afterEach(() => {});describe('MemorySettingsPanel', () => {- it('renders the optional reranking endpoint for released settings without it', () => {+ it('hides multimodal configuration until IM attachment capture is available', () => {render(<MemorySettingsPanel- settings={legacySettings}+ settings={{ ...legacySettings, im_attachment_capture_available: false }}maintenance={null}maintenanceError={null}dependencyReady@@ -94,11 +96,124 @@ describe('MemorySettingsPanel', () => {/>,);- expect(screen.getByText('memory.settings.rerankTitle')).not.toBeNull();+ expect(screen.queryByText('memory.settings.multimodalTitle')).toBeNull();+ expect(screen.queryByText('memory.settings.disclosureAttachment')).toBeNull();expect(screen.getAllByPlaceholderText('memory.settings.baseUrlPlaceholder')).toHaveLength(3);expect(screen.getAllByPlaceholderText('memory.settings.modelPlaceholder')).toHaveLength(3);});+ it('renders optional multimodal configuration once IM capture is available', () => {+ render(+ <MemorySettingsPanel+ settings={legacySettings}+ maintenance={null}+ maintenanceError={null}+ dependencyReady+ onSaved={() => undefined}+ onReloadSettings={() => undefined}+ onReloadMaintenance={() => undefined}+ onClearAll={() => undefined}+ clearing={false}+ />,+ );++ expect(screen.getByText('memory.settings.rerankTitle')).not.toBeNull();+ expect(screen.getByText('memory.settings.multimodalTitle')).not.toBeNull();+ expect(screen.getByText('memory.settings.disclosureAttachment')).not.toBeNull();+ expect(screen.getAllByPlaceholderText('memory.settings.baseUrlPlaceholder')).toHaveLength(4);+ expect(screen.getAllByPlaceholderText('memory.settings.modelPlaceholder')).toHaveLength(4);+ });++ it('submits a complete multimodal endpoint as the IM attachment opt-in', async () => {+ api.saveMemorySettings.mockResolvedValue({+ ...firstSetupSettings,+ processing: {+ ...firstSetupSettings.processing,+ multimodal: endpoint('https://vision.example.test/v1'),+ },+ });+ const user = userEvent.setup();+ render(+ <MemorySettingsPanel+ settings={firstSetupSettings}+ maintenance={null}+ maintenanceError={null}+ dependencyReady+ onSaved={() => undefined}+ onReloadSettings={() => undefined}+ onReloadMaintenance={() => undefined}+ onClearAll={() => undefined}+ clearing={false}+ />,+ );++ const baseUrls = screen.getAllByPlaceholderText('memory.settings.baseUrlPlaceholder');+ const models = screen.getAllByPlaceholderText('memory.settings.modelPlaceholder');+ const keys = screen.getAllByPlaceholderText('memory.settings.apiKeyPlaceholder');+ await user.type(baseUrls[3], 'https://vision.example.test/v1');+ await user.type(models[3], 'vision-model');+ await user.type(keys[3], 'vision-secret');+ await user.click(screen.getByRole('button', { name: 'memory.settings.save' }));++ await waitFor(() => expect(api.saveMemorySettings).toHaveBeenCalledWith({+ processing: {+ multimodal: {+ base_url: 'https://vision.example.test/v1',+ model: 'vision-model',+ api_key: 'vision-secret',+ },+ },+ }));+ });++ it('clears the complete multimodal endpoint to disable IM attachment capture', async () => {+ const configured: MemorySettings = {+ ...legacySettings,+ processing: {+ ...legacySettings.processing,+ rerank: {+ ...endpoint('https://rerank.example.test/v1/inference'),+ model: 'rerank-model',+ has_api_key: true,+ },+ multimodal: {+ ...endpoint('https://vision.example.test/v1'),+ model: 'vision-model',+ has_api_key: true,+ },+ },+ };+ api.saveMemorySettings.mockResolvedValue(legacySettings);+ const user = userEvent.setup();+ render(+ <MemorySettingsPanel+ settings={configured}+ maintenance={null}+ maintenanceError={null}+ dependencyReady+ onSaved={() => undefined}+ onReloadSettings={() => undefined}+ onReloadMaintenance={() => undefined}+ onClearAll={() => undefined}+ clearing={false}+ />,+ );++ expect(screen.getByRole('checkbox', {+ name: 'memory.settings.rerankClearLabel',+ })).not.toBeNull();+ await user.click(screen.getByRole('checkbox', {+ name: 'memory.settings.multimodalClearLabel',+ }));+ await user.click(screen.getByRole('button', { name: 'memory.settings.save' }));++ await waitFor(() => expect(api.saveMemorySettings).toHaveBeenCalledWith({+ processing: {+ multimodal: { api_key: null, base_url: null, model: null },+ },+ }));+ });+it('locks settings mutations while the page owns another mutation', () => {render(<MemorySettingsPaneldiff --git a/ui/src/components/settings/memory/MemorySettingsPanel.tsx b/ui/src/components/settings/memory/MemorySettingsPanel.tsxindex d34186334..f3902305a 100644--- a/ui/src/components/settings/memory/MemorySettingsPanel.tsx+++ b/ui/src/components/settings/memory/MemorySettingsPanel.tsx@@ -175,6 +175,7 @@ export const MemorySettingsPanel: React.FC<{const [llmDraft, setLlmDraft] = useState<EndpointDraft>(() => draftFromConfig(settings.processing.llm));const [embeddingDraft, setEmbeddingDraft] = useState<EndpointDraft>(() => draftFromConfig(settings.processing.embedding));const [rerankDraft, setRerankDraft] = useState<EndpointDraft>(() => draftFromConfig(settings.processing.rerank ?? EMPTY_ENDPOINT));+ const [multimodalDraft, setMultimodalDraft] = useState<EndpointDraft>(() => draftFromConfig(settings.processing.multimodal ?? EMPTY_ENDPOINT));const [saving, setSaving] = useState(false);const [error, setError] = useState<string | null>(null);const [confirmRebuildOpen, setConfirmRebuildOpen] = useState(false);@@ -186,40 +187,55 @@ export const MemorySettingsPanel: React.FC<{setLlmDraft(draftFromConfig(settings.processing.llm));setEmbeddingDraft(draftFromConfig(settings.processing.embedding));setRerankDraft(draftFromConfig(settings.processing.rerank ?? EMPTY_ENDPOINT));+ setMultimodalDraft(draftFromConfig(settings.processing.multimodal ?? EMPTY_ENDPOINT));}, [settings]);const rebuildRequired = settings.rebuild_required === true;const factoryResetRequired = settings.factory_reset_required === true;- const canClearKeys = !enabledDraft;+ const canClearRequiredKeys = !enabledDraft;const canClearMemory = maintenance?.can_clear === true;const busy = saving || rebuildBusy || repairBusy || mutationBusy;const buildPatch = (): MemorySettingsPatch => {const patch: MemorySettingsPatch = {};if (enabledDraft !== settings.enabled) patch.enabled = enabledDraft;- // A key clear is accepted only while the resulting state stays disabled.- const allowClear = !enabledDraft;- const llmPatch = buildEndpointPatch(llmDraft, settings.processing.llm, allowClear);+ // Required keys can clear only while the resulting state stays disabled.+ const allowRequiredClear = !enabledDraft;+ const llmPatch = buildEndpointPatch(+ llmDraft,+ settings.processing.llm,+ allowRequiredClear,+ );// Identity fields stay editable even when data exists; rebuild confirmation// is the safety gate instead of a silent lock.const embeddingPatch = buildEndpointPatch(embeddingDraft,settings.processing.embedding,- allowClear,+ allowRequiredClear,false,);const rerankPatch = buildEndpointPatch(rerankDraft,settings.processing.rerank ?? EMPTY_ENDPOINT,- allowClear,+ true,false,true,);- if (llmPatch || embeddingPatch || rerankPatch) {+ const multimodalPatch = settings.im_attachment_capture_available === true+ ? buildEndpointPatch(+ multimodalDraft,+ settings.processing.multimodal ?? EMPTY_ENDPOINT,+ true,+ false,+ true,+ )+ : null;+ if (llmPatch || embeddingPatch || rerankPatch || multimodalPatch) {patch.processing = {};if (llmPatch) patch.processing.llm = llmPatch;if (embeddingPatch) patch.processing.embedding = embeddingPatch;if (rerankPatch) patch.processing.rerank = rerankPatch;+ if (multimodalPatch) patch.processing.multimodal = multimodalPatch;}return patch;};@@ -276,7 +292,8 @@ export const MemorySettingsPanel: React.FC<{const validationFailure =failure.error === 'memory_embedding_unavailable' ||failure.error === 'memory_llm_unavailable' ||- failure.error === 'memory_rerank_unavailable';+ failure.error === 'memory_rerank_unavailable' ||+ failure.error === 'memory_multimodal_unavailable';if (!validationFailure || failure.rebuild_required === true) {onReloadSettings();onReloadMaintenance();@@ -392,7 +409,7 @@ export const MemorySettingsPanel: React.FC<{original={settings.processing.llm}onChange={setLlmDraft}disabled={busy}- canClearKey={canClearKeys}+ canClearKey={canClearRequiredKeys}/><EndpointFields@@ -404,7 +421,7 @@ export const MemorySettingsPanel: React.FC<{onChange={setEmbeddingDraft}disabled={busy}identityHint={t('memory.settings.embeddingIdentityHint')}- canClearKey={canClearKeys}+ canClearKey={canClearRequiredKeys}/><EndpointFields@@ -416,10 +433,25 @@ export const MemorySettingsPanel: React.FC<{onChange={setRerankDraft}disabled={busy}identityHint={t('memory.settings.rerankIdentityHint')}- canClearKey={canClearKeys}+ canClearKeyclearKeyLabel={t('memory.settings.rerankClearLabel')}/>+ {settings.im_attachment_capture_available === true ? (+ <EndpointFields+ title={t('memory.settings.multimodalTitle')}+ help={t('memory.settings.multimodalHelp')}+ helpLabel={t('memory.settings.multimodalHelpLabel')}+ draft={multimodalDraft}+ original={settings.processing.multimodal ?? EMPTY_ENDPOINT}+ onChange={setMultimodalDraft}+ disabled={busy}+ identityHint={t('memory.settings.multimodalIdentityHint')}+ canClearKey+ clearKeyLabel={t('memory.settings.multimodalClearLabel')}+ />+ ) : null}+{error ? (<div className="rounded-xl border border-destructive/40 bg-destructive/10 px-4 py-3 text-sm text-destructive-ink">{error}</div>) : null}@@ -461,6 +493,12 @@ export const MemorySettingsPanel: React.FC<{{line}</li>))}+ {settings.im_attachment_capture_available === true ? (+ <li className="flex gap-2 text-[11.5px] leading-snug text-muted">+ <span className="mt-1 size-1 shrink-0 rounded-full bg-muted" />+ {t('memory.settings.disclosureAttachment')}+ </li>+ ) : null}</ul></div>diff --git a/ui/src/components/settings/memory/memoryCopyContract.test.ts b/ui/src/components/settings/memory/memoryCopyContract.test.tsindex 81571cd89..4eb8c1f34 100644--- a/ui/src/components/settings/memory/memoryCopyContract.test.ts+++ b/ui/src/components/settings/memory/memoryCopyContract.test.ts@@ -37,6 +37,19 @@ describe('Memory UI copy contracts', () => {}});+ it.each(['en', 'zh'] as const)('keeps staged IM attachment disclosure separate in %s', (language) => {+ const settings = BUNDLES[language].memory.settings;+ const baseDisclosure = settings.disclosure.join('\n');++ if (language === 'en') {+ expect(baseDisclosure).not.toContain('eligible attachments from bound direct messages');+ expect(settings.disclosureAttachment).toContain('eligible attachments from bound direct messages');+ } else {+ expect(baseDisclosure).not.toContain('已绑定私聊中的合规附件');+ expect(settings.disclosureAttachment).toContain('已绑定私聊中的合规附件');+ }+ });+it.each(['en', 'zh'] as const)('discloses proactive non-plain-content capture in %s', (language) => {const disclosure = BUNDLES[language].memory.settings.disclosure.join('\n');diff --git a/ui/src/context/ApiContext.tsx b/ui/src/context/ApiContext.tsxindex df3a0d055..e2781b52b 100644--- a/ui/src/context/ApiContext.tsx+++ b/ui/src/context/ApiContext.tsx@@ -1850,11 +1850,13 @@ export type MemoryProcessingConfig = {llm: MemoryEndpointConfig;embedding: MemoryEndpointConfig;rerank?: MemoryEndpointConfig;+ multimodal?: MemoryEndpointConfig;};export type MemorySettings = {status: 'ok';enabled: boolean;+ im_attachment_capture_available?: boolean;repair_available?: boolean;processing: MemoryProcessingConfig;rebuild_required?: boolean;@@ -1862,8 +1864,9 @@ export type MemorySettings = {factory_reset_required?: boolean;};-// Omitting a field keeps its current value; an explicit `api_key: null` clears it-// (only accepted while Memory is disabled/clearing per the backend contract).+// Omitting a field keeps its current value; an explicit `api_key: null` clears it.+// Required keys can clear only while Memory is disabled; optional endpoints can+// be removed while Memory stays enabled.export type MemoryEndpointPatch = {base_url?: string | null;model?: string | null;@@ -1876,12 +1879,13 @@ export type MemorySettingsPatch = {llm?: MemoryEndpointPatch;embedding?: MemoryEndpointPatch;rerank?: MemoryEndpointPatch;+ multimodal?: MemoryEndpointPatch;};confirm_rebuild?: boolean;};export type MemoryFailureDiagnostic = {- side?: 'embedding' | 'llm' | 'rerank';+ side?: 'embedding' | 'llm' | 'rerank' | 'multimodal';http_status?: number | null;provider_error_code?: string | null;message?: string;@@ -1912,6 +1916,9 @@ export type MemoryStatus = {cascade: Record<string, unknown> | null;recorder: Record<string, unknown> | null;};+ attachment_capture?: {+ status: 'ready' | 'not_configured' | 'unavailable';+ };};// A dependency-missing failure from the internal handler omits `status` anddiff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex 90bcd9066..0346ff90d 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -1633,6 +1633,7 @@"memory_embedding_unavailable": "The embedding provider is unavailable","memory_llm_unavailable": "The LLM provider is unavailable","memory_rerank_unavailable": "The reranking provider is unavailable",+ "memory_multimodal_unavailable": "The attachment processing provider is unavailable","provider_request_timed_out": "The provider request timed out.","provider_response_too_large": "The provider response exceeded the safety limit.","provider_unavailable": "The provider is unavailable.",@@ -4418,6 +4419,10 @@"rerankHelp": "Memory uses this model to score search results for advanced recall. Enter a reranking base URL, model name, and API key to enable it.","rerankHelpLabel": "About the reranking model","rerankClearLabel": "Remove reranking endpoint",+ "multimodalTitle": "IM attachment processing model (optional)",+ "multimodalHelp": "When fully configured, eligible attachments from bound direct messages are sent to this OpenAI-compatible vision endpoint for Memory capture.",+ "multimodalHelpLabel": "About IM attachment processing",+ "multimodalClearLabel": "Disable IM attachment capture","baseUrl": "Base URL","baseUrlPlaceholder": "https://api.example.com/v1","model": "Model",@@ -4442,6 +4447,7 @@"Clear Memory Data deletes Avibe-managed Memory data for every user and project on this machine, including profiles, memories, and messages waiting to process. It can't take back content already sent to model endpoints or touch original chat histories.","Accounts on different platforms each have their own separate memory; they aren't linked."],+ "disclosureAttachment": "When the IM attachment processing endpoint is configured, eligible attachments from bound direct messages are also sent to that provider.","clearKeyLabel": "Clear the saved key","rebuildRequiredTitle": "Memory index rebuild required","rebuildRequiredDescription": "Your embedding endpoint or model change is saved. The Memory engine can't restart until the rebuild finishes.",@@ -4453,7 +4459,8 @@"rebuildCompleted": "Memory index rebuild completed.","rebuildFailed": "Memory index rebuild failed.","embeddingIdentityHint": "Changing the embedding endpoint or model rebuilds the local index. Your memories are kept.",- "rerankIdentityHint": "Leave all three fields empty to keep the standard Memory search tier."+ "rerankIdentityHint": "Leave all three fields empty to keep the standard Memory search tier.",+ "multimodalIdentityHint": "A complete base URL, model, and API key is the opt-in. Leave all three empty to keep IM attachment capture off."},"clear": {"button": "Clear Memory Data",diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex fb6a5b442..4de10897b 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -1633,6 +1633,7 @@"memory_embedding_unavailable": "Embedding 提供商不可用","memory_llm_unavailable": "LLM 提供商不可用","memory_rerank_unavailable": "重排序服务商不可用",+ "memory_multimodal_unavailable": "附件处理服务商不可用","provider_request_timed_out": "提供商请求超时。","provider_response_too_large": "提供商响应超过安全限制。","provider_unavailable": "提供商不可用。",@@ -4418,6 +4419,10 @@"rerankHelp": "记忆功能用这个模型为高级召回结果评分。填写重排序接口地址、模型名称和 API Key 后即可启用。","rerankHelpLabel": "关于重排序模型","rerankClearLabel": "移除重排序端点",+ "multimodalTitle": "IM 附件处理模型(可选)",+ "multimodalHelp": "完整配置后,已绑定私聊中的合规附件会发送到这个兼容 OpenAI 格式的视觉模型端点,用于记忆捕获。",+ "multimodalHelpLabel": "关于 IM 附件处理",+ "multimodalClearLabel": "关闭 IM 附件捕获","baseUrl": "Base URL","baseUrlPlaceholder": "https://api.example.com/v1","model": "模型",@@ -4442,6 +4447,7 @@"「清理记忆数据」会删除 Avibe 在本机上管理的记忆数据,涵盖本安装所有用户和项目,包括画像、记忆条目和待处理的消息。它无法撤回已发送给模型接口的内容,也不会触碰原始聊天记录。","不同平台的账号各自拥有独立的记忆,互不关联。"],+ "disclosureAttachment": "配置 IM 附件处理端点后,已绑定私聊中的合规附件也会发送给该服务商。","clearKeyLabel": "清除已保存的密钥","rebuildRequiredTitle": "需要重建记忆索引","rebuildRequiredDescription": "向量模型接口地址或模型的更改已保存。索引重建完成前,无法重启记忆引擎。",@@ -4453,7 +4459,8 @@"rebuildCompleted": "记忆索引重建完成。","rebuildFailed": "记忆索引重建失败。","embeddingIdentityHint": "更改向量模型接口地址或模型会重建本地索引,已有记忆不会丢失。",- "rerankIdentityHint": "三个字段全部留空时,记忆功能会继续使用标准搜索层级。"+ "rerankIdentityHint": "三个字段全部留空时,记忆功能会继续使用标准搜索层级。",+ "multimodalIdentityHint": "完整填写接口地址、模型和 API Key 即表示选择启用;三个字段全部留空时,IM 附件捕获保持关闭。"},"clear": {"button": "清理记忆数据",diff --git a/vibe/cli.py b/vibe/cli.pyindex 15f4cccc6..87b603d74 100644--- a/vibe/cli.py+++ b/vibe/cli.py@@ -383,6 +383,11 @@ _MEMORY_CLI_SOURCE_STATE_I18N_KEYS = {_MEMORY_CLI_PROVIDER_STATE_I18N_KEYS = {"ok": "memory.cli.providerState.ok",}+_MEMORY_CLI_ATTACHMENT_STATE_I18N_KEYS = {+ "ready": "memory.cli.attachmentCaptureState.ready",+ "not_configured": "memory.cli.attachmentCaptureState.notConfigured",+ "unavailable": "memory.cli.attachmentCaptureState.unavailable",+}_MEMORY_CLI_REASON_I18N_KEYS = {"memory_disabled": "memory.cli.reason.memoryDisabled","memory_invalid_input": "memory.cli.reason.invalidInput",@@ -490,6 +495,21 @@ def _print_memory_cli_human(operation: str, result: dict, *, language: str) -> Nstate=provider_state_label,))+ attachment_capture = result.get("attachment_capture")+ if isinstance(attachment_capture, dict):+ attachment_state_label = _memory_cli_label(+ attachment_capture.get("status"),+ keys=_MEMORY_CLI_ATTACHMENT_STATE_I18N_KEYS,+ fallback_key="memory.cli.attachmentCaptureState.unknown",+ language=language,+ )+ print(+ i18n_t(+ "memory.cli.attachmentCapture",+ language,+ state=attachment_state_label,+ )+ )reason = source.get("reason") if isinstance(source, dict) else Noneif isinstance(reason, str) and reason:reason_label = _memory_cli_label(diff --git a/vibe/i18n/en.json b/vibe/i18n/en.jsonindex 7cf99d422..0ca64002c 100644--- a/vibe/i18n/en.json+++ b/vibe/i18n/en.json@@ -712,6 +712,7 @@"error": "Memory {operation} failed: {code}","status": "Memory source: {state}","provider": "EverOS {version}: {state}",+ "attachmentCapture": "IM attachment capture: {state}","sourceReason": "Source reason: {reason}","sourceState": {"available": "available",@@ -723,6 +724,12 @@"ok": "healthy","unknown": "unknown"},+ "attachmentCaptureState": {+ "ready": "ready",+ "notConfigured": "not configured",+ "unavailable": "unavailable",+ "unknown": "unknown"+ },"unknownVersion": "unknown version","reason": {"memoryDisabled": "Memory is disabled",diff --git a/vibe/i18n/zh.json b/vibe/i18n/zh.jsonindex a5ace01d2..253cdbee4 100644--- a/vibe/i18n/zh.json+++ b/vibe/i18n/zh.json@@ -712,6 +712,7 @@"error": "记忆 {operation} 失败:{code}","status": "记忆来源:{state}","provider": "EverOS {version}:{state}",+ "attachmentCapture": "IM 附件捕获:{state}","sourceReason": "来源原因:{reason}","sourceState": {"available": "可用",@@ -723,6 +724,12 @@"ok": "正常","unknown": "未知"},+ "attachmentCaptureState": {+ "ready": "可用",+ "notConfigured": "未配置",+ "unavailable": "不可用",+ "unknown": "未知"+ },"unknownVersion": "未知版本","reason": {"memoryDisabled": "记忆功能已禁用",diff --git a/vibe/ui_memory_routes.py b/vibe/ui_memory_routes.pyindex 0c915755f..fdee294be 100644--- a/vibe/ui_memory_routes.py+++ b/vibe/ui_memory_routes.py@@ -115,6 +115,12 @@ def _memory_settings_projection(memory: object) -> dict:return payload+def _memory_im_attachment_capture_available() -> bool:+ from core.memory.attachments import IM_ATTACHMENT_CAPTURE_AVAILABLE++ return IM_ATTACHMENT_CAPTURE_AVAILABLE++def _memory_repair_available() -> bool:from core.memory.artifact import get_memory_artifact_manager@@ -130,6 +136,9 @@ def _memory_settings_payload() -> dict:memory = V2Config.load().memorypayload = _memory_settings_projection(memory)payload["status"] = "ok"+ payload["im_attachment_capture_available"] = (+ _memory_im_attachment_capture_available()+ )# Read-only projection while a durable rebuild marker is pending.payload["rebuild_required"] = memory.recovery_intent == "rebuild"payload["factory_reset_required"] = memory.recovery_intent == "factory_reset"@@ -157,7 +166,7 @@ def _memory_settings_patch(current: V2Config, patch_payload: object) -> tuple[diif not isinstance(confirm_rebuild, bool):raise ValueError("invalid_memory_patch")target = memory_config_to_payload(current.memory, include_secrets=True)- endpoints = ("llm", "embedding", "rerank")+ endpoints = ("llm", "embedding", "rerank", "multimodal")for endpoint in endpoints:if endpoint in target["processing"]:target["processing"][endpoint].pop("has_api_key", None)@@ -180,7 +189,7 @@ def _memory_settings_patch(current: V2Config, patch_payload: object) -> tuple[di{"base_url": None, "model": None, "api_key": None},).update(endpoint_patch)if (- endpoint == "rerank"+ endpoint in {"rerank", "multimodal"}and set(endpoint_patch) == {"api_key"}and endpoint_patch["api_key"] in {None, ""}):@@ -190,12 +199,13 @@ def _memory_settings_patch(current: V2Config, patch_payload: object) -> tuple[di"api_key": None,}- explicit_key_clear = any(+ explicit_required_key_clear = any(endpoint_patch.get("api_key") in {None, ""}- for endpoint_patch in (processing_patch or {}).values()+ for endpoint, endpoint_patch in (processing_patch or {}).items()+ if endpoint in {"llm", "embedding"}if isinstance(endpoint_patch, dict) and "api_key" in endpoint_patch)- if explicit_key_clear and target["enabled"]:+ if explicit_required_key_clear and target["enabled"]:raise ValueError("memory_key_clear_while_enabled")return target, confirm_rebuild@@ -238,6 +248,21 @@ def _memory_rerank_configuration_changed(current: V2Config, candidate: V2Config)return endpoint_values(current) != endpoint_values(candidate)+def _memory_multimodal_configuration_changed(+ current: V2Config,+ candidate: V2Config,+) -> bool:+ """Return whether the IM attachment processing endpoint changed."""++ def endpoint_values(config: V2Config) -> tuple[str | None, str | None, str | None]:+ endpoint = config.memory.processing.multimodal+ if endpoint is None:+ return (None, None, None)+ return (endpoint.base_url, endpoint.model, endpoint.api_key)++ return endpoint_values(current) != endpoint_values(candidate)++def _memory_preflight_required(candidate: V2Config) -> bool:"""Require live admission unless a disabled candidate is still incomplete."""@@ -255,7 +280,7 @@ def _memory_api_key_only_patch(patch_payload: object) -> bool:processing = patch_payload.get("processing")if not isinstance(processing, dict) or not processing:return False- if not set(processing).issubset({"llm", "embedding", "rerank"}):+ if not set(processing).issubset({"llm", "embedding", "rerank", "multimodal"}):return Falsereturn all(isinstance(endpoint, dict) and set(endpoint) == {"api_key"}@@ -278,7 +303,7 @@ def _memory_factory_reset_repair_patch(patch_payload: object) -> bool:processing = patch_payload.get("processing")if not isinstance(processing, dict) or not processing:return False- if not set(processing).issubset({"llm", "embedding", "rerank"}):+ if not set(processing).issubset({"llm", "embedding", "rerank", "multimodal"}):return Falsereturn all(isinstance(endpoint, dict)@@ -534,6 +559,7 @@ def _memory_repair_result(payload: dict, status_code: int) -> tuple[dict, int]:"memory_embedding_unavailable": 409,"memory_llm_unavailable": 409,"memory_rerank_unavailable": 409,+ "memory_multimodal_unavailable": 409,}.get(error)if expected_status is None or expected_status != status_code:return protocol_failure, 503@@ -693,6 +719,9 @@ async def _settings_ok_payload(memory, runtime_payload: dict | None = None) -> dpayload = _memory_settings_projection(memory)payload["status"] = "ok"+ payload["im_attachment_capture_available"] = (+ _memory_im_attachment_capture_available()+ )payload["rebuild_required"] = getattr(memory, "recovery_intent", None) == "rebuild"payload["factory_reset_required"] = getattr(memory, "recovery_intent", None) == "factory_reset"payload["repair_available"] = (@@ -741,6 +770,10 @@ async def _apply_memory_settings_patch(candidate = _memory_candidate_config(current, target_payload)identity_changed = _memory_embedding_configuration_changed(current, candidate)rerank_changed = _memory_rerank_configuration_changed(current, candidate)+ multimodal_changed = _memory_multimodal_configuration_changed(+ current,+ candidate,+ )pending_marker = current.memory.recovery_intent == "rebuild"pending_factory_reset = current.memory.recovery_intent == "factory_reset"except (TypeError, ValueError):@@ -824,8 +857,15 @@ async def _apply_memory_settings_patch(rerank_preflight = (rerank_changed and candidate.memory.processing.rerank is not None)+ multimodal_preflight = (+ multimodal_changed and candidate.memory.processing.multimodal is not None+ )if (- ((identity_changed and confirm_rebuild) or rerank_preflight)+ (+ (identity_changed and confirm_rebuild)+ or rerank_preflight+ or multimodal_preflight+ )and _memory_preflight_required(candidate)):from config.v2_config import memory_config_to_payload