Skip to content

"Vibe-Trading: Your Personal Trading Agent"

feat(settings): per-channel configuration, custom providers, and Persian locale

Emad Karimi9d5f246baa9e
diff --git a/agent/api_server.py b/agent/api_server.py
index 220649eb2..85619265c 100644
--- a/agent/api_server.py
+++ b/agent/api_server.py
@@ -222,6 +222,9 @@ from src.api.settings_routes import ( # noqa: F401, E402
_load_llm_providers,
)
+from src.api.custom_provider_routes import register_custom_provider_routes # noqa: E402
+register_custom_provider_routes(app, require_local_or_auth, require_settings_write_auth)
+
# --- Uploads ---
from src.api.uploads_routes import register_uploads_routes # noqa: E402
register_uploads_routes(app)
diff --git a/agent/src/api/channels_routes.py b/agent/src/api/channels_routes.py
index a79c5e6b6..e1225a91a 100644
--- a/agent/src/api/channels_routes.py
+++ b/agent/src/api/channels_routes.py
@@ -5,10 +5,14 @@ Mounted by ``agent/api_server.py`` via ``register_channels_routes(app, ...)``.
from __future__ import annotations
+import json
+import os
+import re
+import tempfile
from typing import Any, Awaitable, Callable
-from fastapi import Depends, FastAPI
-from pydantic import BaseModel
+from fastapi import Depends, FastAPI, HTTPException
+from pydantic import BaseModel, Field
# ---------------------------------------------------------------------------
@@ -22,6 +26,155 @@ class ChannelPairingCommandRequest(BaseModel):
command: str
+class ChannelConfigUpdateRequest(BaseModel):
+ """Per-channel enable/token/allowlist update for the Settings UI."""
+
+ channel: str = Field(min_length=1, max_length=64)
+ enabled: bool
+ token: str | None = Field(default=None, max_length=2000)
+ allowlist: str | None = Field(default=None, max_length=4000)
+
+
+class ChannelConfigTestRequest(BaseModel):
+ """Connectivity probe inputs for one channel."""
+
+ channel: str = Field(min_length=1, max_length=64)
+ token: str | None = Field(default=None, max_length=2000)
+
+
+# ---------------------------------------------------------------------------
+# Channel config helpers (agent.json is the single source of truth)
+# ---------------------------------------------------------------------------
+
+_CHANNEL_ID_RE = re.compile(r"^[a-z0-9_]{1,64}$")
+_SECRET_KEYS = frozenset(
+ {"token", "secret", "app_secret", "api_key", "apikey", "password", "webhook_secret"}
+)
+_ALLOWLIST_KEYS = ("allowFrom", "allow_from", "allowlist", "allowList")
+
+
+def _agent_config_path():
+ from src.config.paths import get_config_path
+
+ return get_config_path()
+
+
+def _read_agent_config_payload() -> dict[str, Any]:
+ from src.config.loader import _read_config_file
+
+ path = _agent_config_path()
+ if not path.exists():
+ return {}
+ payload = _read_config_file(path)
+ return payload if isinstance(payload, dict) else {}
+
+
+def _write_agent_config_payload(payload: dict[str, Any]) -> None:
+ path = _agent_config_path()
+ if path.suffix.lower() != ".json":
+ raise ValueError("Channel configuration requires a JSON agent config (~/.vibe-trading/agent.json)")
+ path.parent.mkdir(parents=True, exist_ok=True)
+ content = (json.dumps(payload, ensure_ascii=False, indent=2) + "\n").encode("utf-8")
+ fd, temporary = tempfile.mkstemp(dir=path.parent, prefix=f".{path.name}.", suffix=".tmp")
+ try:
+ with os.fdopen(fd, "wb") as handle:
+ fd = -1
+ handle.write(content)
+ handle.flush()
+ os.fsync(handle.fileno())
+ os.replace(temporary, path)
+ finally:
+ if fd >= 0:
+ os.close(fd)
+ if os.path.exists(temporary):
+ os.unlink(temporary)
+ try:
+ path.chmod(0o600)
+ except OSError:
+ pass
+
+
+def _redacted_channel_summary(name: str, section: dict[str, Any] | None, availability: dict[str, Any]) -> dict[str, Any]:
+ section = section if isinstance(section, dict) else {}
+ token_configured = any(
+ key in section and str(section.get(key) or "").strip() for key in _SECRET_KEYS
+ )
+ allowlist: list[str] = []
+ for key in _ALLOWLIST_KEYS:
+ raw = section.get(key)
+ if isinstance(raw, list):
+ allowlist = [str(item) for item in raw]
+ break
+ if isinstance(raw, str) and raw.strip():
+ allowlist = [item.strip() for item in raw.split(",") if item.strip()]
+ break
+ return {
+ "channel": name,
+ "display_name": availability.get("display_name", name),
+ "available": availability.get("available", False),
+ "error": availability.get("error", ""),
+ "install_hint": availability.get("install_hint", ""),
+ "configured": bool(section),
+ "enabled": bool(section.get("enabled", False)),
+ "token_configured": token_configured,
+ "allowlist": allowlist,
+ }
+
+
+def _apply_channel_update(
+ payload: dict[str, Any],
+ *,
+ channel: str,
+ enabled: bool,
+ token: str | None,
+ allowlist: str | None,
+) -> dict[str, Any]:
+ channels = payload.setdefault("channels", {})
+ if not isinstance(channels, dict):
+ raise ValueError("agent config 'channels' must be an object")
+ section = channels.setdefault(channel, {})
+ if not isinstance(section, dict):
+ raise ValueError(f"agent config 'channels.{channel}' must be an object")
+ section["enabled"] = enabled
+ if token is not None and token.strip():
+ section["token"] = token.strip()
+ if allowlist is not None and allowlist.strip():
+ section["allowFrom"] = [item.strip() for item in allowlist.split(",") if item.strip()]
+ _write_agent_config_payload(payload)
+ return section
+
+
+async def _probe_channel(channel: str, token: str | None) -> dict[str, Any]:
+ from src.channels.registry import inspect_channel
+
+ availability = inspect_channel(channel).to_dict()
+ checks: dict[str, Any] = {
+ "adapter_available": bool(availability.get("available")),
+ "token_present": bool((token or "").strip()),
+ "live_probe": "none",
+ }
+ if channel == "telegram":
+ probe_token = (token or "").strip()
+ if not probe_token:
+ raise ValueError("Telegram probe requires a bot token")
+ import httpx
+
+ try:
+ async with httpx.AsyncClient(timeout=15.0) as client:
+ response = await client.get(f"https://api.telegram.org/bot{probe_token}/getMe")
+ payload = response.json()
+ except (httpx.HTTPError, ValueError) as exc:
+ raise ValueError("Telegram probe failed: could not reach the Bot API") from exc
+ checks["live_probe"] = "telegram_getme"
+ if not isinstance(payload, dict) or not payload.get("ok"):
+ raise ValueError("Telegram rejected the bot token")
+ bot = payload.get("result") or {}
+ checks["bot_username"] = str(bot.get("username") or "")
+ if not checks["adapter_available"]:
+ raise ValueError(availability.get("error") or "channel adapter is unavailable")
+ return {"status": "ok", "channel": channel, "checks": checks}
+
+
# ---------------------------------------------------------------------------
# Lifecycle helpers (module-level, access host state via sys.modules)
# ---------------------------------------------------------------------------
@@ -91,6 +244,64 @@ def register_channels_routes(
runtime = _get_channel_runtime()
return runtime.status()
+ @app.get("/channels/config", dependencies=[Depends(require_auth)])
+ async def channels_config():
+ """Return per-channel config summaries with secrets redacted."""
+ from src.channels.registry import inspect_channels
+
+ payload = _read_agent_config_payload()
+ channels_section = payload.get("channels")
+ channels_section = channels_section if isinstance(channels_section, dict) else {}
+ statuses = inspect_channels(channels_section)
+ summaries = []
+ for name, availability in statuses.items():
+ section = channels_section.get(name)
+ section = section if isinstance(section, dict) else {}
+ summaries.append(_redacted_channel_summary(name, section, availability))
+ summaries.sort(key=lambda item: (not item["configured"], not item["enabled"], item["channel"]))
+ return {"status": "ok", "channels": summaries, "env_path": str(_agent_config_path())}
+
+ @app.put("/channels/config", dependencies=[Depends(require_auth)])
+ async def update_channels_config(update: ChannelConfigUpdateRequest):
+ channel = update.channel.strip().lower()
+ if not _CHANNEL_ID_RE.fullmatch(channel):
+ raise HTTPException(status_code=400, detail="invalid channel id")
+ try:
+ payload = _read_agent_config_payload()
+ _apply_channel_update(
+ payload,
+ channel=channel,
+ enabled=update.enabled,
+ token=update.token,
+ allowlist=update.allowlist,
+ )
+ except ValueError as exc:
+ raise HTTPException(status_code=400, detail=str(exc)) from exc
+ section = payload.get("channels", {}).get(channel, {})
+ section = section if isinstance(section, dict) else {}
+ from src.channels.registry import inspect_channel
+
+ return {
+ "status": "ok",
+ "channel": _redacted_channel_summary(channel, section, inspect_channel(channel).to_dict()),
+ "needs_restart": True,
+ }
+
+ @app.post("/channels/config/test", dependencies=[Depends(require_auth)])
+ async def test_channels_config(probe: ChannelConfigTestRequest):
+ channel = probe.channel.strip().lower()
+ if not _CHANNEL_ID_RE.fullmatch(channel):
+ raise HTTPException(status_code=400, detail="invalid channel id")
+ token = probe.token
+ if not (token or "").strip():
+ section = _read_agent_config_payload().get("channels", {}).get(channel, {})
+ section = section if isinstance(section, dict) else {}
+ token = next((str(section[key]) for key in _SECRET_KEYS if section.get(key)), None)
+ try:
+ return await _probe_channel(channel, token)
+ except ValueError as exc:
+ raise HTTPException(status_code=400, detail=str(exc)) from exc
+
@app.post("/channels/start", dependencies=[Depends(require_auth)])
async def channels_start():
"""Start configured IM channel adapters."""
diff --git a/agent/src/api/custom_provider_routes.py b/agent/src/api/custom_provider_routes.py
new file mode 100644
index 000000000..6fccfcdd1
--- /dev/null
+++ b/agent/src/api/custom_provider_routes.py
@@ -0,0 +1,217 @@
+"""Web API for test-first custom OpenAI-compatible provider profiles."""
+
+from __future__ import annotations
+
+import hashlib
+import ipaddress
+import socket
+import time
+import uuid
+from typing import Any, Awaitable, Callable
+from urllib.parse import urlsplit
+
+import httpx
+from fastapi import Depends, FastAPI, HTTPException
+from pydantic import BaseModel, Field
+
+from src.api.settings_routes import _host
+from src.config.accessor import reset_env_config
+from src.providers.custom_profiles import CustomProviderStore
+
+AuthDep = Callable[..., Awaitable[Any] | Any]
+_TEST_TTL_S = 300.0
+_PROVIDER_REQUEST_TIMEOUT_S = 60.0
+_TESTS: dict[str, tuple[float, str]] = {}
+
+
+def _build_store() -> CustomProviderStore:
+ return CustomProviderStore()
+
+
+class CustomProviderTestRequest(BaseModel):
+ base_url: str = Field(min_length=1, max_length=500)
+ model: str = Field(min_length=1, max_length=200)
+ api_key: str = Field(min_length=1, max_length=500)
+
+
+class CustomProviderSaveRequest(CustomProviderTestRequest):
+ id: str = Field(min_length=1, max_length=64)
+ label: str = Field(min_length=1, max_length=100)
+ test_id: str = Field(min_length=1, max_length=80)
+
+
+class CustomProviderActivateRequest(BaseModel):
+ confirm: bool = False
+
+
+def _validate_custom_base_url(value: str) -> str:
+ normalized = value.strip().rstrip("/")
+ parsed = urlsplit(normalized)
+ if (
+ parsed.scheme not in {"http", "https"}
+ or not parsed.hostname
+ or parsed.username is not None
+ or parsed.password is not None
+ ):
+ raise ValueError("Provider base URL must be an HTTP(S) URL without embedded credentials")
+ hostname = parsed.hostname.lower()
+ if hostname in {"localhost", "localhost.localdomain", "metadata.google.internal"}:
+ raise ValueError("Provider base URL cannot target local or metadata services")
+ try:
+ address = ipaddress.ip_address(hostname)
+ except ValueError:
+ address = None
+ if address is not None and (
+ address.is_loopback
+ or address.is_private
+ or address.is_link_local
+ or address.is_reserved
+ or address.is_multicast
+ or address.is_unspecified
+ ):
+ raise ValueError("Provider base URL cannot target local or private network addresses")
+ return normalized
+
+
+def _reject_private_dns_targets(base_url: str) -> None:
+ hostname = urlsplit(base_url).hostname
+ if not hostname:
+ raise ValueError("Provider base URL must include a hostname")
+ try:
+ results = socket.getaddrinfo(hostname, None, type=socket.SOCK_STREAM)
+ except socket.gaierror as exc:
+ raise ValueError("Provider hostname could not be resolved") from exc
+ for result in results:
+ address = ipaddress.ip_address(result[4][0])
+ if (
+ address.is_loopback
+ or address.is_private
+ or address.is_link_local
+ or address.is_reserved
+ or address.is_multicast
+ or address.is_unspecified
+ ):
+ raise ValueError("Provider hostname resolves to a local or private network address")
+
+
+def _completion_url(base_url: str) -> str:
+ url = _validate_custom_base_url(base_url)
+ if url.endswith("/chat/completions"):
+ return url
+ return f"{url}/chat/completions"
+
+
+async def _perform_completion_test(*, base_url: str, model: str, api_key: str) -> dict[str, Any]:
+ started = time.perf_counter()
+ normalized_base_url = _validate_custom_base_url(base_url)
+ _reject_private_dns_targets(normalized_base_url)
+ headers = {"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"}
+ body = {
+ "model": model,
+ "messages": [{"role": "user", "content": "Reply with exactly: PROVIDER_TEST_OK"}],
+ "max_tokens": 32,
+ "temperature": 0,
+ }
+ try:
+ async with httpx.AsyncClient(timeout=_PROVIDER_REQUEST_TIMEOUT_S, follow_redirects=False) as client:
+ response = await client.post(_completion_url(normalized_base_url), headers=headers, json=body)
+ response.raise_for_status()
+ payload = response.json()
+ except httpx.HTTPStatusError as exc:
+ raise ValueError(f"Provider returned HTTP {exc.response.status_code}") from exc
+ except (httpx.HTTPError, ValueError) as exc:
+ raise ValueError("Provider test failed: endpoint did not return valid JSON") from exc
+ try:
+ content = payload["choices"][0]["message"].get("content", "")
+ except (KeyError, IndexError, TypeError) as exc:
+ raise ValueError("Provider test failed: response had no chat completion") from exc
+ return {
+ "response_preview": str(content).strip()[:500],
+ "latency_ms": round((time.perf_counter() - started) * 1000),
+ }
+
+
+def _fingerprint(payload: CustomProviderTestRequest) -> str:
+ raw = "\x00".join((payload.base_url.strip(), payload.model.strip(), payload.api_key.strip()))
+ return hashlib.sha256(raw.encode("utf-8")).hexdigest()
+
+
+def _prune_tests() -> None:
+ now = time.monotonic()
+ for test_id, (expires, _) in list(_TESTS.items()):
+ if expires <= now:
+ _TESTS.pop(test_id, None)
+
+
+def _activate_profile(profile: dict[str, Any]) -> dict[str, Any]:
+ host = _host()
+ updates = {
+ "LANGCHAIN_PROVIDER": "custom",
+ "LANGCHAIN_MODEL_NAME": str(profile["model"]),
+ "OPENAI_BASE_URL": str(profile["base_url"]),
+ }
+ host._write_env_values(host.ENV_PATH, {**host._read_env_values(host.ENV_PATH), **updates})
+ import os
+
+ os.environ.update(updates)
+ os.environ.pop("OPENAI_API_KEY", None)
+ from src.providers.custom_profiles import active_provider_credentials
+
+ active = active_provider_credentials()
+ if active:
+ os.environ["OPENAI_API_KEY"] = active["api_key"]
+ reset_env_config()
+ return {"status": "ok", "active_id": str(profile["id"]), "model": profile["model"], "base_url": profile["base_url"]}
+
+
+def register_custom_provider_routes(
+ app: FastAPI,
+ require_local_or_auth: AuthDep,
+ require_settings_write_auth: AuthDep,
+) -> None:
+ @app.get("/settings/custom-providers", dependencies=[Depends(require_local_or_auth)])
+ def list_custom_providers() -> dict[str, Any]:
+ return {"status": "ok", "providers": _build_store().list_public()}
+
+ @app.post("/settings/custom-providers/test", dependencies=[Depends(require_settings_write_auth)])
+ async def test_custom_provider(payload: CustomProviderTestRequest) -> dict[str, Any]:
+ try:
+ payload.base_url = _validate_custom_base_url(payload.base_url)
+ result = await _perform_completion_test(
+ base_url=payload.base_url, model=payload.model, api_key=payload.api_key
+ )
+ except ValueError as exc:
+ raise HTTPException(status_code=400, detail=str(exc)) from exc
+ _prune_tests()
+ test_id = uuid.uuid4().hex
+ _TESTS[test_id] = (time.monotonic() + _TEST_TTL_S, _fingerprint(payload))
+ return {"status": "ok", "test_id": test_id, **result}
+
+ @app.post("/settings/custom-providers", dependencies=[Depends(require_settings_write_auth)])
+ def save_custom_provider(payload: CustomProviderSaveRequest) -> dict[str, Any]:
+ _prune_tests()
+ expected = _TESTS.pop(payload.test_id, None)
+ if expected is None or expected[0] <= time.monotonic() or expected[1] != _fingerprint(payload):
+ raise HTTPException(status_code=409, detail="A successful provider test is required before saving")
+ try:
+ base_url = _validate_custom_base_url(payload.base_url)
+ profile = _build_store().save(
+ profile_id=payload.id,
+ label=payload.label,
+ base_url=base_url,
+ model=payload.model,
+ api_key=payload.api_key,
+ )
+ except ValueError as exc:
+ raise HTTPException(status_code=400, detail=str(exc)) from exc
+ return {"status": "ok", "provider": profile}
+
+ @app.post("/settings/custom-providers/{profile_id}/activate", dependencies=[Depends(require_settings_write_auth)])
+ def activate_custom_provider(profile_id: str, payload: CustomProviderActivateRequest) -> dict[str, Any]:
+ if not payload.confirm:
+ raise HTTPException(status_code=400, detail="Explicit confirmation is required to activate a provider")
+ try:
+ profile = _build_store().activate(profile_id)
+ return _activate_profile(profile)
+ except (RuntimeError, ValueError, OSError) as exc:
+ raise HTTPException(status_code=400, detail=str(exc)) from exc
diff --git a/agent/src/config/env_schema.py b/agent/src/config/env_schema.py
index be4ae07f4..1deea3105 100644
--- a/agent/src/config/env_schema.py
+++ b/agent/src/config/env_schema.py
@@ -144,6 +144,9 @@ class LLMConfig(_EnvBase):
# preflight could not tell a missing key from a working one and the failure
# surfaced as an opaque 401 at the first call instead (#1223).
anthropic_api_key: str = Field(alias="ANTHROPIC_API_KEY", default="")
+ langchain_max_tokens: int | None = Field(
+ alias="LANGCHAIN_MAX_TOKENS", default=None, gt=0
+ )
anthropic_max_tokens: int | None = Field(alias="ANTHROPIC_MAX_TOKENS", default=None, gt=0)
timeout_seconds: int = Field(alias="TIMEOUT_SECONDS", default=120)
max_retries: int = Field(alias="MAX_RETRIES", default=2)
diff --git a/agent/src/providers/capabilities.py b/agent/src/providers/capabilities.py
index 46fc1b6ca..207b635d7 100644
--- a/agent/src/providers/capabilities.py
+++ b/agent/src/providers/capabilities.py
@@ -362,6 +362,22 @@ def get_llm_credentials(
preflight, environment synchronization, and runtime construction all
consume the same endpoint.
"""
+ normalized_provider = (provider or "").strip().lower().replace("_", "-")
+ if normalized_provider == "custom":
+ try:
+ from src.providers.custom_profiles import active_provider_credentials
+
+ active = active_provider_credentials()
+ except (RuntimeError, ValueError, OSError):
+ active = None
+ if active:
+ return {
+ "provider": "custom",
+ "api_key": active["api_key"],
+ "base_url": active["base_url"],
+ "model": model or active["model"],
+ }
+
caps = get_provider_capabilities(provider, model)
key_env, base_env = caps.api_key_env, caps.base_url_env
diff --git a/agent/src/providers/custom_profiles.py b/agent/src/providers/custom_profiles.py
new file mode 100644
index 000000000..5be72a8ad
--- /dev/null
+++ b/agent/src/providers/custom_profiles.py
@@ -0,0 +1,125 @@
+"""Persistent metadata and OS-vault secrets for custom LLM providers."""
+
+from __future__ import annotations
+
+import json
+import re
+from datetime import datetime, timezone
+from pathlib import Path
+from typing import Any
+
+from src.config.paths import get_runtime_root
+from src.trading.credentials import CredentialStore
+
+_ID_RE = re.compile(r"^[a-z0-9][a-z0-9._-]{0,63}$")
+
+
+class CustomProviderStore:
+ """Store custom-provider metadata on disk and API keys in the OS vault."""
+
+ def __init__(self, path: Path | None = None, backend: Any = None) -> None:
+ self.path = path or (get_runtime_root() / "custom-llm-providers.json")
+ self.credentials = CredentialStore(backend)
+
+ def list_public(self) -> list[dict[str, Any]]:
+ payload = self._read()
+ profiles = payload.get("profiles", {})
+ return [
+ {
+ "id": profile_id,
+ "label": str(item.get("label") or profile_id),
+ "base_url": str(item.get("base_url") or ""),
+ "model": str(item.get("model") or ""),
+ "api_key_configured": self.credentials.status(
+ profile_id, ["api_key"]
+ ).get("api_key", False),
+ "active": payload.get("active_id") == profile_id,
+ "last_tested_at": item.get("last_tested_at"),
+ }
+ for profile_id, item in sorted(profiles.items())
+ if isinstance(item, dict)
+ ]
+
+ def save(
+ self,
+ *,
+ profile_id: str,
+ label: str,
+ base_url: str,
+ model: str,
+ api_key: str,
+ last_tested_at: str | None = None,
+ ) -> dict[str, Any]:
+ profile_id = profile_id.strip().lower()
+ if not _ID_RE.fullmatch(profile_id):
+ raise ValueError("Provider id must use lowercase letters, numbers, dot, dash, or underscore")
+ if not label.strip() or len(label.strip()) > 100:
+ raise ValueError("Provider label must contain 1 to 100 characters")
+ if not base_url.strip() or not model.strip() or not api_key.strip():
+ raise ValueError("Provider base URL, model, and API key are required")
+ payload = self._read()
+ profiles = payload.setdefault("profiles", {})
+ profiles[profile_id] = {
+ "label": label.strip(),
+ "base_url": base_url.strip().rstrip("/"),
+ "model": model.strip(),
+ "last_tested_at": last_tested_at or _now(),
+ }
+ self.credentials.save(profile_id, {"api_key": api_key.strip()})
+ self._write(payload)
+ return next(item for item in self.list_public() if item["id"] == profile_id)
+
+ def get(self, profile_id: str) -> dict[str, Any]:
+ profile_id = profile_id.strip().lower()
+ item = self._read().get("profiles", {}).get(profile_id)
+ if not isinstance(item, dict):
+ raise ValueError(f"Unknown custom provider profile: {profile_id}")
+ api_key = self.credentials.load(profile_id, ["api_key"]).get("api_key", "")
+ if not api_key:
+ raise ValueError(f"Custom provider profile has no API key: {profile_id}")
+ return {"id": profile_id, **item, "api_key": api_key}
+
+ def activate(self, profile_id: str) -> dict[str, Any]:
+ profile = self.get(profile_id)
+ payload = self._read()
+ payload["active_id"] = profile_id.strip().lower()
+ self._write(payload)
+ return {key: value for key, value in profile.items() if key != "api_key"}
+
+ def _read(self) -> dict[str, Any]:
+ if not self.path.exists():
+ return {"profiles": {}, "active_id": None}
+ try:
+ payload = json.loads(self.path.read_text(encoding="utf-8"))
+ except (OSError, UnicodeError, json.JSONDecodeError) as exc:
+ raise ValueError(f"Invalid custom provider store: {exc}") from exc
+ return payload if isinstance(payload, dict) else {"profiles": {}, "active_id": None}
+
+ def _write(self, payload: dict[str, Any]) -> None:
+ self.path.parent.mkdir(parents=True, exist_ok=True)
+ self.path.write_text(json.dumps(payload, indent=2) + "\n", encoding="utf-8")
+ try:
+ self.path.chmod(0o600)
+ except OSError:
+ pass
+
+
+def _now() -> str:
+ return datetime.now(timezone.utc).isoformat()
+
+
+def active_provider_credentials() -> dict[str, str] | None:
+ try:
+ store = CustomProviderStore()
+ payload = store._read()
+ active_id = str(payload.get("active_id") or "").strip()
+ if not active_id:
+ return None
+ profile = store.get(active_id)
+ return {
+ "base_url": str(profile["base_url"]),
+ "model": str(profile["model"]),
+ "api_key": str(profile["api_key"]),
+ }
+ except (RuntimeError, ValueError, OSError):
+ return None
diff --git a/agent/src/providers/llm.py b/agent/src/providers/llm.py
index b2e9ddeb1..e7229259d 100644
--- a/agent/src/providers/llm.py
+++ b/agent/src/providers/llm.py
@@ -1592,6 +1592,9 @@ def build_llm(*, model_name: Optional[str] = None, callbacks: Any = None) -> Any
"vibe_provider": provider,
"vibe_api_key": api_key,
}
+ langchain_max_tokens = get_env_config().llm.langchain_max_tokens
+ if langchain_max_tokens:
+ kwargs["max_tokens"] = langchain_max_tokens
if caps.default_headers:
headers = dict(caps.default_headers)
if caps.name in {"moonshot", "kimi-coding"}:
diff --git a/agent/tests/test_channels_config_api.py b/agent/tests/test_channels_config_api.py
new file mode 100644
index 000000000..4e3b4b064
--- /dev/null
+++ b/agent/tests/test_channels_config_api.py
@@ -0,0 +1,123 @@
+"""Tests for the IM channel configuration API."""
+
+from __future__ import annotations
+
+import json
+from pathlib import Path
+
+import pytest
+from fastapi.testclient import TestClient
+
+import api_server
+from src.api import channels_routes
+
+
+def config_path(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
+ path = tmp_path / "agent.json"
+ monkeypatch.setattr("src.config.paths.get_config_path", lambda config_path=None: path)
+ return path
+
+
+def client() -> TestClient:
+ return TestClient(api_server.app, client=("127.0.0.1", 50000))
+
+
+def test_get_channels_config_redacts_secrets(client: TestClient, config_path: Path) -> None:
+ config_path.write_text(
+ json.dumps({
+ "channels": {
+ "telegram": {"enabled": True, "token": "secret-token", "allowFrom": ["123", "456"]}
+ }
+ }),
+ encoding="utf-8",
+ )
+
+ response = client.get("/channels/config")
+
+ assert response.status_code == 200
+ body = response.json()
+ telegram = next(item for item in body["channels"] if item["channel"] == "telegram")
+ assert telegram["configured"] is True
+ assert telegram["enabled"] is True
+ assert telegram["token_configured"] is True
+ assert telegram["allowlist"] == ["123", "456"]
+ assert "secret-token" not in response.text
+
+
+def test_get_channels_config_marks_unconfigured_channels(client: TestClient, config_path: Path) -> None:
+ config_path.write_text("{}", encoding="utf-8")
+
+ response = client.get("/channels/config")
+
+ assert response.status_code == 200
+ body = response.json()
+ assert body["channels"]
+ assert all(item["configured"] is False for item in body["channels"])
+ assert all(item["enabled"] is False for item in body["channels"])
+
+
+def test_put_channels_config_writes_enabled_token_allowlist(client: TestClient, config_path: Path) -> None:
+ response = client.put(
+ "/channels/config",
+ json={"channel": "telegram", "enabled": True, "token": "new-token", "allowlist": "111, 222"},
+ )
+
+ assert response.status_code == 200
+ payload = json.loads(config_path.read_text(encoding="utf-8"))
+ section = payload["channels"]["telegram"]
+ assert section["enabled"] is True
+ assert section["token"] == "new-token"
+ assert section["allowFrom"] == ["111", "222"]
+ assert "new-token" not in response.text
+
+
+def test_put_channels_config_rejects_invalid_channel_id(client: TestClient, config_path: Path) -> None:
+ response = client.put("/channels/config", json={"channel": "../evil", "enabled": True})
+
+ assert response.status_code == 400
+ assert not config_path.exists()
+
+
+def test_put_channels_config_requires_json_agent_config(
+ client: TestClient, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ monkeypatch.setattr("src.config.paths.get_config_path", lambda config_path=None: tmp_path / "agent.yaml")
+
+ response = client.put(
+ "/channels/config",
+ json={"channel": "telegram", "enabled": True, "token": "x"},
+ )
+
+ assert response.status_code == 400
+
+
+def test_channel_test_endpoint_validates_channel_id(client: TestClient, config_path: Path) -> None:
+ response = client.post("/channels/config/test", json={"channel": "bad id!"})
+
+ assert response.status_code == 400
+
+
+def test_channel_test_endpoint_uses_stored_token(
+ client: TestClient, config_path: Path, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ config_path.write_text(
+ json.dumps({"channels": {"telegram": {"enabled": True, "token": "stored-token"}}}),
+ encoding="utf-8",
+ )
+
+ async def fake_probe(channel: str, token: str | None) -> dict:
+ assert token == "stored-token"
+ return {
+ "status": "ok",
+ "channel": channel,
+ "checks": {"adapter_available": True, "token_present": True, "live_probe": "telegram_getme"},
+ }
+
+ monkeypatch.setattr(channels_routes, "_probe_channel", fake_probe)
+
+ response = client.post("/channels/config/test", json={"channel": "telegram"})
+
+ assert response.status_code == 200
+ assert response.json()["status"] == "ok"
diff --git a/agent/tests/test_custom_provider_routes.py b/agent/tests/test_custom_provider_routes.py
new file mode 100644
index 000000000..086b5ab92
--- /dev/null
+++ b/agent/tests/test_custom_provider_routes.py
@@ -0,0 +1,150 @@
+"""Tests for the custom OpenAI-compatible provider manager."""
+
+from __future__ import annotations
+
+import json
+from pathlib import Path
+from typing import Any
+
+import pytest
+from fastapi.testclient import TestClient
+
+import api_server
+from src.api import custom_provider_routes
+from src.providers.custom_profiles import CustomProviderStore
+
+
+class _MemoryCredentials:
+ def __init__(self) -> None:
+ self.values: dict[tuple[str, str], str] = {}
+
+ def get_password(self, service_name: str, username: str) -> str | None:
+ return self.values.get((service_name, username))
+
+ def set_password(self, service_name: str, username: str, password: str) -> None:
+ self.values[(service_name, username)] = password
+
+ def delete_password(self, service_name: str, username: str) -> None:
+ self.values.pop((service_name, username), None)
+
+
+def custom_store(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> CustomProviderStore:
+ store = CustomProviderStore(tmp_path / "custom-providers.json", _MemoryCredentials())
+ monkeypatch.setattr(custom_provider_routes, "_build_store", lambda: store)
+ return store
+
+
+def client() -> TestClient:
+ return TestClient(api_server.app, client=("127.0.0.1", 50000))
+
+
+def test_custom_provider_base_url_rejects_embedded_credentials() -> None:
+ with pytest.raises(ValueError, match="without embedded credentials"):
+ custom_provider_routes._validate_custom_base_url("https://user:[email protected]/v1")
+
+
[email protected]("base_url", ["http://127.0.0.1/v1", "http://localhost/v1", "http://169.254.169.254/v1"])
+def test_custom_provider_base_url_rejects_local_targets(base_url: str) -> None:
+ with pytest.raises(ValueError):
+ custom_provider_routes._validate_custom_base_url(base_url)
+
+
+def test_store_never_serializes_api_key(tmp_path: Path) -> None:
+ backend = _MemoryCredentials()
+ store = CustomProviderStore(tmp_path / "custom-providers.json", backend)
+
+ store.save(
+ profile_id="hilinkup",
+ label="Hilinkup",
+ base_url="https://api.example.test/v1",
+ model="glm-5.3-flash",
+ api_key="secret-key",
+ )
+
+ payload = json.loads((tmp_path / "custom-providers.json").read_text(encoding="utf-8"))
+ assert "secret-key" not in json.dumps(payload)
+ assert backend.values
+ assert store.list_public()[0]["api_key_configured"] is True
+
+
+def test_save_requires_a_successful_test(client: TestClient, custom_store: CustomProviderStore) -> None:
+ response = client.post(
+ "/settings/custom-providers",
+ json={
+ "id": "hilinkup",
+ "label": "Hilinkup",
+ "base_url": "https://api.example.test/v1",
+ "model": "glm-5.3-flash",
+ "api_key": "temporary-key",
+ "test_id": "missing-test",
+ },
+ )
+
+ assert response.status_code == 409
+ assert custom_store.list_public() == []
+ assert "temporary-key" not in response.text
+
+
+def test_test_endpoint_returns_no_secret_and_save_then_requires_confirmation(
+ client: TestClient,
+ custom_store: CustomProviderStore,
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ async def fake_completion(**_: Any) -> dict[str, Any]:
+ return {"response_preview": "CUSTOM_PROVIDER_TEST_OK", "latency_ms": 12}
+
+ monkeypatch.setattr(custom_provider_routes, "_perform_completion_test", fake_completion)
+ test_response = client.post(
+ "/settings/custom-providers/test",
+ json={
+ "base_url": "https://api.example.test/v1",
+ "model": "glm-5.3-flash",
+ "api_key": "temporary-key",
+ },
+ )
+
+ assert test_response.status_code == 200
+ test_body = test_response.json()
+ assert test_body["status"] == "ok"
+ assert test_body["response_preview"] == "CUSTOM_PROVIDER_TEST_OK"
+ assert "temporary-key" not in test_response.text
+
+ save_payload = {
+ "id": "hilinkup",
+ "label": "Hilinkup",
+ "base_url": "https://api.example.test/v1",
+ "model": "glm-5.3-flash",
+ "api_key": "temporary-key",
+ "test_id": test_body["test_id"],
+ }
+ save_response = client.post("/settings/custom-providers", json=save_payload)
+ assert save_response.status_code == 200
+ assert "temporary-key" not in save_response.text
+
+ activation = client.post("/settings/custom-providers/hilinkup/activate", json={"confirm": False})
+ assert activation.status_code == 400
+
+
+def test_activation_requires_explicit_confirmation(
+ client: TestClient,
+ custom_store: CustomProviderStore,
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ custom_store.save(
+ profile_id="hilinkup",
+ label="Hilinkup",
+ base_url="https://api.example.test/v1",
+ model="glm-5.3-flash",
+ api_key="secret-key",
+ )
+ monkeypatch.setattr(custom_provider_routes, "_activate_profile", lambda profile: {"status": "ok"})
+
+ response = client.post(
+ "/settings/custom-providers/hilinkup/activate",
+ json={"confirm": False},
+ )
+
+ assert response.status_code == 400
+ assert response.json()["detail"] == "Explicit confirmation is required to activate a provider"
diff --git a/frontend/DESIGN.md b/frontend/DESIGN.md
new file mode 100644
index 000000000..ad641dd04
--- /dev/null
+++ b/frontend/DESIGN.md
@@ -0,0 +1,105 @@
+# Vibe-Trading Web Design System
+
+## 1. Atmosphere & Identity
+
+The Web UI is a quiet dark trading workbench: information-dense but calm,
+with orange reserved for actions and active states. Settings should feel like a
+safe control room, not a generic onboarding wizard. The custom-provider flow's
+signature is an explicit three-state progression: draft, tested, then active.
+
+## 2. Color
+
+Use the existing semantic Tailwind tokens only.
+
+| Role | Token | Usage |
+|---|---|---|
+| Surface | `bg-background` | Page background |
+| Panel | `bg-card` | Settings cards |
+| Secondary surface | `bg-muted/20`, `bg-muted/30` | Field groups and status panels |
+| Primary text | `text-foreground` | Headings and values |
+| Secondary text | `text-muted-foreground` | Help text and metadata |
+| Action | `bg-primary`, `text-primary-foreground` | Primary buttons and active state |
+| Success | `text-success`, `bg-success/10` | Verified/tested state |
+| Warning | `text-warning`, `bg-warning/10` | Unactivated or caution state |
+| Error | `text-danger`, `bg-danger/5` | Validation and request failures |
+| Border | `border`, `border-border` | Cards, fields, dividers |
+
+Rules: no raw hex values in components; color must not be the only status
+indicator; pair status colors with text and/or icons.
+
+## 3. Typography
+
+- Primary: the existing application sans stack.
+- Data and URLs: existing `font-mono` treatment.
+- Page title: existing `text-2xl font-semibold`.
+- Section title: existing `text-base font-semibold` or `text-lg font-semibold`.
+- Body: existing `text-sm`; helper text: `text-xs`.
+- Body line-height remains the existing `leading-relaxed` convention.
+- Provider/model/URL values must wrap instead of overflow.
+
+## 4. Spacing & Layout
+
+- Base rhythm: Tailwind spacing tokens on the existing 4px/8px rhythm.
+- Settings page: existing `mx-auto max-w-5xl space-y-6 p-6` shell.
+- Cards: existing `rounded-lg border bg-card p-5 shadow-sm` treatment.
+- Form groups: `grid gap-4` or `gap-5`; controls use the existing field class.
+- Provider manager uses a responsive single-column flow on small screens and a
+ compact two-column form/status layout from `md` upward.
+- Long URLs and provider errors use `break-all` or `break-words`; no horizontal
+ page overflow.
+
+## 5. Components
+
+### Custom Provider Manager
+
+- **Structure:** section card → header/status summary → profile list → editor
+ form → test result → explicit activation action.
+- **Variants:** empty, draft, testing, tested, active, error.
+- **Spacing:** existing card padding, `space-y-4`, `gap-3`, and field rhythm.
+- **States:** loading skeleton, empty guidance, inline validation, testing
+ spinner, success result, error with retry, active badge, disabled activation.
+- **Accessibility:** visible labels, `aria-describedby` for help/error text,
+ `role="alert"` for failures, `aria-live="polite"` for test status, keyboard
+ reachable controls, minimum 44px action targets.
+- **Motion:** only existing short opacity/transition states; no decorative
+ animation and no layout animation.
+- **Layout:** stack inside Settings; the profile list owns its own content flow.
+
+### Status Badge
+
+- **Structure:** text badge with optional status icon.
+- **Variants:** draft, tested, active, failed.
+- **Accessibility:** status is written as text, not color alone.
+
+## 6. Motion & Interaction
+
+- Use existing Tailwind transitions, approximately 150–300ms.
+- Test action gives immediate loading feedback and disables duplicate submits.
+- Activation is disabled until the current draft has a successful test token.
+- Activation requires an explicit confirmation control/dialog.
+- Respect `prefers-reduced-motion`; no essential information depends on motion.
+
+## 7. Depth & Surface
+
+Use the existing mixed strategy: one-pixel borders plus restrained card shadows.
+Do not introduce glassmorphism, gradients, or new decorative surfaces into the
+operational Settings page.
+
+## 8. Accessibility Constraints & Accepted Debt
+
+### Constraints
+
+- WCAG 2.2 AA target.
+- Every input has a visible label and stable error/help text.
+- API keys use password inputs and are never rendered back after submission.
+- API key values never enter localStorage, URL query strings, React error text,
+ or client-side logs.
+- Test and activation outcomes are announced to assistive technology.
+- Keyboard users can complete the full draft → test → confirm → activate flow.
+- RTL content follows the existing `dir="auto"` behavior.
+
+### Accepted Debt
+
+| Item | Location | Why accepted | Owner / Exit |
+|---|---|---|---|
+| UI copy remains localized through existing i18n keys | `Settings.tsx` | Matches current locale architecture | Add Persian locale when project locale policy supports it |
diff --git a/frontend/src/__tests__/viteProxy.test.ts b/frontend/src/__tests__/viteProxy.test.ts
index f0d6abafc..deb6ceca3 100644
--- a/frontend/src/__tests__/viteProxy.test.ts
+++ b/frontend/src/__tests__/viteProxy.test.ts
@@ -10,6 +10,10 @@ describe("Vite API proxy config", () => {
expect(config).toContain('"/channels"');
});
+ it("proxies the portfolio and connections API namespace", () => {
+ expect(config).toContain('"/api"');
+ });
+
it("proxies settings endpoints", () => {
expect(config).toContain('"/settings/llm"');
expect(config).toContain('"/settings/data-sources"');
diff --git a/frontend/src/components/chat/Composer.tsx b/frontend/src/components/chat/Composer.tsx
index 4d99ffdc7..da991a684 100644
--- a/frontend/src/components/chat/Composer.tsx
+++ b/frontend/src/components/chat/Composer.tsx
@@ -411,6 +411,7 @@ export const Composer = memo(forwardRef<ComposerHandle, Props>(function Composer
/>
<textarea
ref={inputRef}
+ dir="auto"
value={input}
rows={1}
onChange={(e) => setInput(e.target.value)}
diff --git a/frontend/src/components/chat/MessageBubble.tsx b/frontend/src/components/chat/MessageBubble.tsx
index 89ae6d649..0dfe9a187 100644
--- a/frontend/src/components/chat/MessageBubble.tsx
+++ b/frontend/src/components/chat/MessageBubble.tsx
@@ -14,6 +14,12 @@ import type { StoredAgentMessage } from "@/stores/agent";
import { AgentAvatar } from "./AgentAvatar";
import { RunCompleteCard } from "./RunCompleteCard";
+// Hebrew + Arabic-block ranges: first-strong RTL detection for dir hints.
+const RTL_RE = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB1D-\uFDFF\uFE70-\uFEFF]/;
+function isRTLContent(text: string): boolean {
+ return RTL_RE.test(text.slice(0, 400));
+}
+
// singleDollarTextMath off: dollar amounts ("$150 to $120") must never parse as
// formulas; LLM \(...\)/\[...\] delimiters are normalized to $$ before render.
const remarkPlugins: ReactMarkdownOptions["remarkPlugins"] = [
@@ -86,7 +92,7 @@ export const MarkdownContent = memo(function MarkdownContent({
}
return (
- <div className={proseClassName}>
+ <div className={`${proseClassName} vt-bidi`} dir="auto">
<MarkdownErrorBoundary content={content}>
<ReactMarkdown
remarkPlugins={remarkPlugins}
@@ -131,7 +137,7 @@ async function copyText(text: string): Promise<boolean> {
return copied;
}
-function CopyButton({ text }: { text: string }) {
+function CopyButton({ text, rtl = false }: { text: string; rtl?: boolean }) {
const [copied, setCopied] = useState(false);
const handleCopy = useCallback(async () => {
if (await copyText(text)) {
@@ -146,7 +152,7 @@ function CopyButton({ text }: { text: string }) {
return (
<button
onClick={handleCopy}
- className="absolute top-2 right-2 p-1.5 rounded-md bg-muted/80 hover:bg-muted text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity"
+ className={`absolute top-2 ${rtl ? "left-2" : "right-2"} p-1.5 rounded-md bg-muted/80 hover:bg-muted text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity`}
aria-label={label}
title={label}
>
@@ -191,7 +197,7 @@ export const MessageBubble = memo(function MessageBubble({ msg, onRetry }: Props
?? (meta?.attachment ? [meta.attachment] : []);
return (
<div className="flex justify-end group">
- <div className="max-w-[72%] max-h-[40vh] overflow-y-auto break-words rounded-[18px] bg-muted px-4 py-3 text-[15px] text-foreground leading-relaxed whitespace-pre-wrap">
+ <div dir="auto" className="max-w-[72%] max-h-[40vh] overflow-y-auto break-words rounded-[18px] bg-muted px-4 py-3 text-[15px] text-foreground leading-relaxed whitespace-pre-wrap">
{meta && (attachments.length > 0 || meta.swarmMode || meta.goalMode) && (
<div className="mb-1.5 flex flex-wrap justify-end gap-1.5 text-[10px] leading-none text-muted-foreground">
{attachments.map((attachment, index) => (
@@ -230,7 +236,7 @@ export const MessageBubble = memo(function MessageBubble({ msg, onRetry }: Props
<div className="flex gap-3 group relative">
<AgentAvatar />
<div className="flex-1 min-w-0 space-y-1.5">
- <CopyButton text={msg.content} />
+ <CopyButton text={msg.content} rtl={isRTLContent(msg.content)} />
<MarkdownContent content={msg.content} />
{msg.elapsed_ms != null && (
<div className="mt-1 flex items-center gap-2 text-[10px] text-muted-foreground/55">
@@ -257,7 +263,7 @@ export const MessageBubble = memo(function MessageBubble({ msg, onRetry }: Props
<div className="space-y-2">
<div className="flex items-start gap-2 rounded-xl border border-danger/30 bg-danger/5 px-4 py-3">
<XCircle className="h-4 w-4 text-danger shrink-0 mt-0.5" />
- <p className="text-sm text-danger leading-relaxed">{msg.content}</p>
+ <p dir="auto" className="text-sm text-danger leading-relaxed">{msg.content}</p>
</div>
{onRetry && (
<div className="space-y-1.5">
@@ -282,7 +288,7 @@ export const MessageBubble = memo(function MessageBubble({ msg, onRetry }: Props
return (
<div className="flex gap-3">
<AgentAvatar />
- <p className="text-sm text-muted-foreground leading-relaxed">{msg.content}</p>
+ <p dir="auto" className="text-sm text-muted-foreground leading-relaxed">{msg.content}</p>
</div>
);
}
diff --git a/frontend/src/components/settings/ChannelConfigSection.tsx b/frontend/src/components/settings/ChannelConfigSection.tsx
new file mode 100644
index 000000000..9777853f9
--- /dev/null
+++ b/frontend/src/components/settings/ChannelConfigSection.tsx
@@ -0,0 +1,217 @@
+import { CheckCircle2, Loader2, MessageSquareMore, Save, TestTube2 } from "lucide-react";
+import { useEffect, useState } from "react";
+import { useTranslation } from "react-i18next";
+import { toast } from "sonner";
+import { api, type ChannelConfigSummary } from "@/lib/api";
+
+interface Draft {
+ enabled: boolean;
+ token: string;
+ allowlist: string;
+}
+
+const fieldClass =
+ "w-full rounded-md border bg-background px-3 py-2 text-sm outline-none transition focus:border-primary focus:ring-2 focus:ring-primary/20 disabled:cursor-not-allowed disabled:opacity-60";
+const hintClass = "text-xs text-muted-foreground";
+
+export function ChannelConfigSection() {
+ const { t } = useTranslation();
+ const [channels, setChannels] = useState<ChannelConfigSummary[]>([]);
+ const [loading, setLoading] = useState(true);
+ const [loadError, setLoadError] = useState<string | null>(null);
+ const [openChannel, setOpenChannel] = useState<string | null>(null);
+ const [draft, setDraft] = useState<Draft>({ enabled: false, token: "", allowlist: "" });
+ const [testing, setTesting] = useState(false);
+ const [saving, setSaving] = useState(false);
+ const [testOk, setTestOk] = useState<string | null>(null);
+ const [testError, setTestError] = useState<string | null>(null);
+
+ const refresh = async () => {
+ const result = await api.getChannelsConfig();
+ setChannels(result.channels);
+ };
+
+ useEffect(() => {
+ setLoading(true);
+ refresh()
+ .then(() => setLoadError(null))
+ .catch((error: unknown) => {
+ setLoadError(error instanceof Error ? error.message : t("settings.channels.loadFailed"));
+ })
+ .finally(() => setLoading(false));
+ }, [t]);
+
+ const open = (channel: ChannelConfigSummary) => {
+ setOpenChannel((current) => (current === channel.channel ? null : channel.channel));
+ setDraft({ enabled: channel.enabled, token: "", allowlist: channel.allowlist.join(", ") });
+ setTestOk(null);
+ setTestError(null);
+ };
+
+ const testChannel = async (channel: ChannelConfigSummary) => {
+ setTesting(true);
+ setTestOk(null);
+ setTestError(null);
+ try {
+ const result = await api.testChannelsConfig({
+ channel: channel.channel,
+ token: draft.token.trim() || undefined,
+ });
+ const bot = result.checks.bot_username ? ` @${result.checks.bot_username}` : "";
+ setTestOk(`${t("settings.channels.testOk")}${bot}`);
+ } catch (error: unknown) {
+ setTestError(error instanceof Error ? error.message : t("settings.channels.testFailed"));
+ } finally {
+ setTesting(false);
+ }
+ };
+
+ const saveChannel = async (channel: ChannelConfigSummary) => {
+ setSaving(true);
+ try {
+ await api.updateChannelsConfig({
+ channel: channel.channel,
+ enabled: draft.enabled,
+ token: draft.token.trim() || undefined,
+ allowlist: draft.allowlist.trim() || undefined,
+ });
+ setOpenChannel(null);
+ await refresh();
+ toast.success(t("settings.channels.saved"));
+ } catch (error: unknown) {
+ toast.error(error instanceof Error ? error.message : t("settings.channels.saveFailed"));
+ } finally {
+ setSaving(false);
+ }
+ };
+
+ return (
+ <section className="rounded-lg border bg-card p-5 shadow-sm">
+ <div className="mb-5 space-y-1">
+ <div className="flex items-center gap-2">
+ <MessageSquareMore className="h-4 w-4 text-primary" aria-hidden="true" />
+ <h2 className="text-base font-semibold">{t("settings.channels.configTitle")}</h2>
+ </div>
+ <p className="max-w-3xl text-sm text-muted-foreground">{t("settings.channels.configHint")}</p>
+ </div>
+
+ {loadError ? (
+ <div className="rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive" role="alert">
+ {loadError}
+ </div>
+ ) : loading ? (
+ <div className="flex items-center gap-2 text-sm text-muted-foreground">
+ <Loader2 className="h-4 w-4 animate-spin" aria-hidden="true" /> {t("settings.loading")}
+ </div>
+ ) : (
+ <div className="space-y-2">
+ {channels.map((channel) => (
+ <div key={channel.channel} className="rounded-md border">
+ <div className="flex flex-col gap-3 p-3 md:flex-row md:items-center md:justify-between">
+ <div className="min-w-0 space-y-1">
+ <div className="flex flex-wrap items-center gap-2">
+ <span className="font-medium">{channel.display_name}</span>
+ {channel.enabled ? (
+ <span className="rounded-full bg-success/10 px-2 py-0.5 text-xs text-success">{t("settings.channels.enabled")}</span>
+ ) : (
+ <span className="rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground">{t("settings.channels.disabled")}</span>
+ )}
+ {channel.token_configured ? (
+ <span className="rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground">{t("settings.configured")}</span>
+ ) : null}
+ </div>
+ <div className="text-xs text-muted-foreground">
+ {channel.available ? channel.channel : `${channel.error} · ${channel.install_hint}`}
+ </div>
+ </div>
+ <button
+ type="button"
+ onClick={() => open(channel)}
+ className="inline-flex min-h-11 shrink-0 items-center justify-center gap-2 rounded-md border px-3 py-2 text-sm text-muted-foreground transition hover:bg-muted hover:text-foreground"
+ >
+ {openChannel === channel.channel ? t("portfolio.editor.close") : t("settings.channels.configTitle")}
+ </button>
+ </div>
+
+ {openChannel === channel.channel ? (
+ <div className="space-y-4 border-t p-3">
+ <label className="flex items-center gap-2 text-sm font-medium">
+ <input
+ type="checkbox"
+ checked={draft.enabled}
+ onChange={(event) => setDraft((current) => ({ ...current, enabled: event.target.checked }))}
+ className="h-4 w-4 accent-primary"
+ />
+ {t("settings.channels.enabledLabel")}
+ </label>
+ <div className="grid gap-4 md:grid-cols-2">
+ <div className="grid gap-2">
+ <label htmlFor={`channel-token-${channel.channel}`} className="text-sm font-medium">
+ {t("settings.channels.token")}
+ </label>
+ <input
+ id={`channel-token-${channel.channel}`}
+ type="password"
+ value={draft.token}
+ onChange={(event) => setDraft((current) => ({ ...current, token: event.target.value }))}
+ className={`${fieldClass} font-mono`}
+ placeholder={channel.token_configured ? t("settings.keepCurrentToken") : ""}
+ autoComplete="new-password"
+ />
+ <span className={hintClass}>{t("settings.channels.tokenHint")}</span>
+ </div>
+ <div className="grid gap-2">
+ <label htmlFor={`channel-allowlist-${channel.channel}`} className="text-sm font-medium">
+ {t("settings.channels.allowlistLabel")}
+ </label>
+ <input
+ id={`channel-allowlist-${channel.channel}`}
+ value={draft.allowlist}
+ onChange={(event) => setDraft((current) => ({ ...current, allowlist: event.target.value }))}
+ className={fieldClass}
+ autoComplete="off"
+ />
+ <span className={hintClass}>{t("settings.channels.allowlistHint")}</span>
+ </div>
+ </div>
+
+ {testOk ? (
+ <div className="rounded-md border border-success/30 bg-success/10 px-3 py-2 text-sm text-success" role="status">
+ <CheckCircle2 className="me-1 inline h-4 w-4" aria-hidden="true" /> {testOk}
+ </div>
+ ) : null}
+ {testError ? (
+ <div className="rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive" role="alert">
+ {t("settings.channels.testFailed")}: {testError}
+ </div>
+ ) : null}
+
+ <div className="flex flex-wrap gap-2">
+ <button
+ type="button"
+ onClick={() => void testChannel(channel)}
+ disabled={testing || saving}
+ className="inline-flex min-h-11 items-center justify-center gap-2 rounded-md border px-4 py-2 text-sm font-medium transition hover:bg-muted disabled:cursor-not-allowed disabled:opacity-60"
+ >
+ {testing ? <Loader2 className="h-4 w-4 animate-spin" aria-hidden="true" /> : <TestTube2 className="h-4 w-4" aria-hidden="true" />}
+ {t("settings.channels.test")}
+ </button>
+ <button
+ type="button"
+ onClick={() => void saveChannel(channel)}
+ disabled={saving || testing}
+ className="inline-flex min-h-11 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60"
+ >
+ {saving ? <Loader2 className="h-4 w-4 animate-spin" aria-hidden="true" /> : <Save className="h-4 w-4" aria-hidden="true" />}
+ {t("settings.channels.save")}
+ </button>
+ </div>
+ </div>
+ ) : null}
+ </div>
+ ))}
+ </div>
+ )}
+ </section>
+ );
+}
diff --git a/frontend/src/components/settings/CustomProviderManager.tsx b/frontend/src/components/settings/CustomProviderManager.tsx
new file mode 100644
index 000000000..ddc21d51f
--- /dev/null
+++ b/frontend/src/components/settings/CustomProviderManager.tsx
@@ -0,0 +1,196 @@
+import { CheckCircle2, KeyRound, Loader2, Plus, Save, Server, ShieldCheck, TestTube2 } from "lucide-react";
+import { useEffect, useState } from "react";
+import { toast } from "sonner";
+import { api, type CustomProviderProfile } from "@/lib/api";
+
+interface Draft {
+ id: string;
+ label: string;
+ base_url: string;
+ model: string;
+ api_key: string;
+}
+
+const emptyDraft: Draft = { id: "", label: "", base_url: "", model: "", api_key: "" };
+const fieldClass = "w-full rounded-md border bg-background px-3 py-2 text-sm outline-none transition focus:border-primary focus:ring-2 focus:ring-primary/20 disabled:cursor-not-allowed disabled:opacity-60";
+const labelClass = "text-sm font-medium";
+const hintClass = "text-xs text-muted-foreground";
+
+export function CustomProviderManager() {
+ const [profiles, setProfiles] = useState<CustomProviderProfile[]>([]);
+ const [draft, setDraft] = useState<Draft>(emptyDraft);
+ const [testId, setTestId] = useState<string | null>(null);
+ const [testPreview, setTestPreview] = useState<string | null>(null);
+ const [testing, setTesting] = useState(false);
+ const [testElapsed, setTestElapsed] = useState(0);
+ const [testError, setTestError] = useState<string | null>(null);
+ const [saving, setSaving] = useState(false);
+ const [activating, setActivating] = useState<string | null>(null);
+
+ const refresh = async () => {
+ const result = await api.listCustomProviders();
+ setProfiles(result.providers);
+ };
+
+ useEffect(() => {
+ void refresh().catch((error: unknown) => {
+ toast.error(error instanceof Error ? error.message : "Failed to load custom providers");
+ });
+ }, []);
+
+ const update = (key: keyof Draft, value: string) => {
+ setDraft((current) => ({ ...current, [key]: value }));
+ setTestId(null);
+ setTestPreview(null);
+ };
+
+ const testProvider = async () => {
+ setTesting(true);
+ setTestElapsed(0);
+ setTestError(null);
+ setTestId(null);
+ setTestPreview(null);
+ try {
+ const result = await api.testCustomProvider({
+ base_url: draft.base_url,
+ model: draft.model,
+ api_key: draft.api_key,
+ });
+ setTestId(result.test_id);
+ setTestPreview(`${result.response_preview} · ${result.latency_ms} ms`);
+ toast.success("Provider test passed");
+ } catch (error: unknown) {
+ setTestError(error instanceof Error ? error.message : "Provider test failed");
+ toast.error(error instanceof Error ? error.message : "Provider test failed");
+ } finally {
+ setTesting(false);
+ setTestElapsed(0);
+ }
+ };
+
+ useEffect(() => {
+ if (!testing) return;
+ const startedAt = Date.now();
+ const timer = window.setInterval(() => {
+ setTestElapsed(Math.floor((Date.now() - startedAt) / 1000));
+ }, 1000);
+ return () => window.clearInterval(timer);
+ }, [testing]);
+
+ const saveProvider = async () => {
+ if (!testId) return;
+ setSaving(true);
+ try {
+ await api.saveCustomProvider({ ...draft, test_id: testId });
+ setDraft(emptyDraft);
+ setTestId(null);
+ setTestPreview(null);
+ await refresh();
+ toast.success("Provider saved in the local credential vault");
+ } catch (error: unknown) {
+ toast.error(error instanceof Error ? error.message : "Provider save failed");
+ } finally {
+ setSaving(false);
+ }
+ };
+
+ const activateProvider = async (profile: CustomProviderProfile) => {
+ if (!window.confirm(`Activate ${profile.label} for new agent requests?`)) return;
+ setActivating(profile.id);
+ try {
+ await api.activateCustomProvider(profile.id);
+ await refresh();
+ toast.success(`${profile.label} is now active`);
+ } catch (error: unknown) {
+ toast.error(error instanceof Error ? error.message : "Provider activation failed");
+ } finally {
+ setActivating(null);
+ }
+ };
+
+ return (
+ <section className="rounded-lg border bg-card p-5 shadow-sm" dir="auto">
+ <div className="mb-5 flex flex-col gap-3 md:flex-row md:items-start md:justify-between">
+ <div className="space-y-1">
+ <div className="flex items-center gap-2">
+ <ShieldCheck className="h-4 w-4 text-primary" aria-hidden="true" />
+ <h2 className="text-base font-semibold">Custom OpenAI-compatible providers</h2>
+ </div>
+ <p className="max-w-3xl text-sm text-muted-foreground">
+ Add any provider with a compatible chat-completions API. The key is tested before saving, then kept in the OS credential vault.
+ </p>
+ </div>
+ <span className="inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-1 text-xs text-muted-foreground">
+ <KeyRound className="h-3 w-3" aria-hidden="true" /> Key never displayed
+ </span>
+ </div>
+
+ {profiles.length > 0 ? (
+ <div className="mb-5 space-y-2" aria-live="polite">
+ {profiles.map((profile) => (
+ <div key={profile.id} className="flex flex-col gap-3 rounded-md border bg-muted/20 p-3 md:flex-row md:items-center md:justify-between">
+ <div className="min-w-0 space-y-1">
+ <div className="flex flex-wrap items-center gap-2">
+ <span className="font-medium">{profile.label}</span>
+ {profile.active ? <span className="rounded-full bg-success/10 px-2 py-0.5 text-xs text-success">Active</span> : null}
+ {profile.api_key_configured ? <span className="rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground">Key stored</span> : null}
+ </div>
+ <div className="break-all font-mono text-xs text-muted-foreground">{profile.model} · {profile.base_url}</div>
+ </div>
+ <button type="button" onClick={() => void activateProvider(profile)} disabled={profile.active || activating === profile.id} className="inline-flex min-h-11 shrink-0 items-center justify-center gap-2 rounded-md border px-3 py-2 text-sm text-muted-foreground transition hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-60">
+ {activating === profile.id ? <Loader2 className="h-4 w-4 animate-spin" aria-hidden="true" /> : <CheckCircle2 className="h-4 w-4" aria-hidden="true" />}
+ {profile.active ? "Active" : "Activate"}
+ </button>
+ </div>
+ ))}
+ </div>
+ ) : (
+ <div className="mb-5 rounded-md border border-dashed bg-muted/10 px-4 py-4 text-sm text-muted-foreground">No custom providers yet. Add one below and test it before saving.</div>
+ )}
+
+ <div className="mb-4 flex items-center gap-2 border-t pt-5">
+ <Plus className="h-4 w-4 text-primary" aria-hidden="true" />
+ <h3 className="text-sm font-semibold">Add provider</h3>
+ </div>
+ <div className="grid gap-4 md:grid-cols-2">
+ <div className="grid gap-2">
+ <label htmlFor="custom-provider-id" className={labelClass}>Provider ID</label>
+ <input id="custom-provider-id" value={draft.id} onChange={(event) => update("id", event.target.value)} className={fieldClass} placeholder="hilinkup" autoComplete="off" />
+ <span className={hintClass}>Lowercase letters, numbers, dots, dashes, or underscores.</span>
+ </div>
+ <div className="grid gap-2">
+ <label htmlFor="custom-provider-label" className={labelClass}>Display name</label>
+ <input id="custom-provider-label" value={draft.label} onChange={(event) => update("label", event.target.value)} className={fieldClass} placeholder="My provider" autoComplete="off" />
+ </div>
+ <div className="grid gap-2 md:col-span-2">
+ <label htmlFor="custom-provider-base-url" className={labelClass}><Server className="me-1 inline h-3.5 w-3.5" aria-hidden="true" />API Base URL</label>
+ <input id="custom-provider-base-url" value={draft.base_url} onChange={(event) => update("base_url", event.target.value)} className={`${fieldClass} font-mono`} placeholder="https://api.example.com/v1" type="url" autoComplete="url" />
+ <span className={hintClass}>Use the API root. Do not include an API key in the URL.</span>
+ </div>
+ <div className="grid gap-2">
+ <label htmlFor="custom-provider-model" className={labelClass}>Model</label>
+ <input id="custom-provider-model" value={draft.model} onChange={(event) => update("model", event.target.value)} className={`${fieldClass} font-mono`} placeholder="glm-5.3-flash" autoComplete="off" />
+ </div>
+ <div className="grid gap-2">
+ <label htmlFor="custom-provider-api-key" className={labelClass}><KeyRound className="me-1 inline h-3.5 w-3.5" aria-hidden="true" />API key</label>
+ <input id="custom-provider-api-key" value={draft.api_key} onChange={(event) => update("api_key", event.target.value)} className={`${fieldClass} font-mono`} placeholder="Enter key for one-time test" type="password" autoComplete="new-password" />
+ </div>
+ </div>
+
+ {testPreview ? <div className="mt-4 rounded-md border border-success/30 bg-success/10 px-3 py-2 text-sm text-success" role="status"><CheckCircle2 className="me-1 inline h-4 w-4" aria-hidden="true" />Test passed: {testPreview}</div> : null}
+ {testError ? <div className="mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive" role="alert">Provider test failed: {testError}</div> : null}
+ {testing && testElapsed >= 8 ? <div className="mt-4 rounded-md border bg-muted/30 px-3 py-2 text-sm text-muted-foreground" role="status">The provider is taking longer than usual ({testElapsed}s). The request will continue until the server timeout.</div> : null}
+ <div className="mt-5 flex flex-wrap gap-2">
+ <button type="button" onClick={() => void testProvider()} disabled={testing || saving || !draft.base_url || !draft.model || !draft.api_key} className="inline-flex min-h-11 items-center justify-center gap-2 rounded-md border px-4 py-2 text-sm font-medium transition hover:bg-muted disabled:cursor-not-allowed disabled:opacity-60">
+ {testing ? <Loader2 className="h-4 w-4 animate-spin" aria-hidden="true" /> : <TestTube2 className="h-4 w-4" aria-hidden="true" />}
+ {testing ? "Testing…" : "Test connection"}
+ </button>
+ <button type="button" onClick={() => void saveProvider()} disabled={!testId || saving || testing || !draft.id || !draft.label} className="inline-flex min-h-11 items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-60">
+ {saving ? <Loader2 className="h-4 w-4 animate-spin" aria-hidden="true" /> : <Save className="h-4 w-4" aria-hidden="true" />}
+ {saving ? "Saving…" : "Save tested provider"}
+ </button>
+ <span className="basis-full text-xs text-muted-foreground">Save unlocks only after a successful test. Activation is a separate confirmed action.</span>
+ </div>
+ </section>
+ );
+}
diff --git a/frontend/src/components/settings/__tests__/CustomProviderManager.test.tsx b/frontend/src/components/settings/__tests__/CustomProviderManager.test.tsx
new file mode 100644
index 000000000..309b1b82e
--- /dev/null
+++ b/frontend/src/components/settings/__tests__/CustomProviderManager.test.tsx
@@ -0,0 +1,107 @@
+import { fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import { CustomProviderManager } from "../CustomProviderManager";
+
+const apiMock = vi.hoisted(() => ({
+ listCustomProviders: vi.fn(),
+ testCustomProvider: vi.fn(),
+ saveCustomProvider: vi.fn(),
+ activateCustomProvider: vi.fn(),
+}));
+
+vi.mock("@/lib/api", () => ({ api: apiMock }));
+
+describe("CustomProviderManager", () => {
+ beforeEach(() => {
+ vi.restoreAllMocks();
+ apiMock.listCustomProviders.mockResolvedValue({ status: "ok", providers: [] });
+ apiMock.testCustomProvider.mockResolvedValue({
+ status: "ok",
+ test_id: "test-123",
+ response_preview: "PROVIDER_TEST_OK",
+ latency_ms: 42,
+ });
+ apiMock.saveCustomProvider.mockResolvedValue({
+ status: "ok",
+ provider: {
+ id: "demo",
+ label: "Demo",
+ base_url: "https://example.com/v1",
+ model: "demo-model",
+ api_key_configured: true,
+ active: false,
+ },
+ });
+ });
+
+ it("requires a successful test before saving", async () => {
+ render(<CustomProviderManager />);
+
+ expect(await screen.findByText("No custom providers yet. Add one below and test it before saving.")).toBeInTheDocument();
+ const saveButton = screen.getByRole("button", { name: "Save tested provider" });
+ expect(saveButton).toBeDisabled();
+
+ fireEvent.change(screen.getByRole("textbox", { name: "API Base URL" }), { target: { value: "https://example.com/v1" } });
+ fireEvent.change(screen.getByRole("textbox", { name: "Model" }), { target: { value: "demo-model" } });
+ fireEvent.change(screen.getByLabelText("API key"), { target: { value: "secret-value" } });
+ fireEvent.change(screen.getByRole("textbox", { name: "Provider ID" }), { target: { value: "demo" } });
+ fireEvent.change(screen.getByRole("textbox", { name: "Display name" }), { target: { value: "Demo" } });
+
+ fireEvent.click(screen.getByRole("button", { name: "Test connection" }));
+ await waitFor(() => expect(apiMock.testCustomProvider).toHaveBeenCalledWith({
+ base_url: "https://example.com/v1",
+ model: "demo-model",
+ api_key: "secret-value",
+ }));
+
+ expect(await screen.findByText(/Test passed: PROVIDER_TEST_OK/)).toBeInTheDocument();
+ expect(saveButton).toBeEnabled();
+ fireEvent.click(saveButton);
+ await waitFor(() => expect(apiMock.saveCustomProvider).toHaveBeenCalledWith({
+ id: "demo",
+ label: "Demo",
+ base_url: "https://example.com/v1",
+ model: "demo-model",
+ api_key: "secret-value",
+ test_id: "test-123",
+ }));
+ });
+
+ it("requires confirmation before activating a saved provider", async () => {
+ apiMock.listCustomProviders.mockResolvedValue({
+ status: "ok",
+ providers: [{
+ id: "demo",
+ label: "Demo",
+ base_url: "https://example.com/v1",
+ model: "demo-model",
+ api_key_configured: true,
+ active: false,
+ }],
+ });
+ const confirm = vi.spyOn(window, "confirm").mockReturnValue(false);
+ render(<CustomProviderManager />);
+
+ fireEvent.click(await screen.findByRole("button", { name: "Activate" }));
+ expect(confirm).toHaveBeenCalledWith("Activate Demo for new agent requests?");
+ expect(apiMock.activateCustomProvider).not.toHaveBeenCalled();
+
+ confirm.mockReturnValue(true);
+ fireEvent.click(screen.getByRole("button", { name: "Activate" }));
+ await waitFor(() => expect(apiMock.activateCustomProvider).toHaveBeenCalledWith("demo"));
+ });
+
+ it("shows a provider test failure inside the manager", async () => {
+ apiMock.testCustomProvider.mockRejectedValue(new Error("Provider returned HTTP 404"));
+ render(<CustomProviderManager />);
+
+ fireEvent.change(screen.getByRole("textbox", { name: "API Base URL" }), { target: { value: "https://example.com/v1" } });
+ fireEvent.change(screen.getByRole("textbox", { name: "Model" }), { target: { value: "demo-model" } });
+ fireEvent.change(screen.getByLabelText("API key"), { target: { value: "synthetic-key" } });
+ fireEvent.click(screen.getByRole("button", { name: "Test connection" }));
+
+ expect(await screen.findByRole("alert")).toHaveTextContent("Provider returned HTTP 404");
+ expect(screen.getByRole("button", { name: "Test connection" })).toBeEnabled();
+ expect(screen.getByRole("button", { name: "Save tested provider" })).toBeDisabled();
+ });
+});
diff --git a/frontend/src/i18n/__tests__/i18n.test.ts b/frontend/src/i18n/__tests__/i18n.test.ts
index 6209c991f..8ba07470f 100644
--- a/frontend/src/i18n/__tests__/i18n.test.ts
+++ b/frontend/src/i18n/__tests__/i18n.test.ts
@@ -132,6 +132,11 @@ describe("i18n utilities", () => {
expect(isRtl("ar")).toBe(true);
});
+ it("isRtl returns true for Persian", () => {
+ expect(isRtl("fa")).toBe(true);
+ expect(isRtl("fa-IR")).toBe(true);
+ });
+
it("isRtl returns true for Arabic regional variants", () => {
expect(isRtl("ar-EG")).toBe(true);
expect(isRtl("ar-SA")).toBe(true);
@@ -159,7 +164,7 @@ describe("i18n utilities", () => {
// the order the switcher renders, and that "en" stays first so the
// primary-match fallback in Layout resolves regional codes to it.
const codes = SUPPORTED_LANGUAGES.map((l) => l.code);
- expect(codes).toEqual(["en", "zh-CN", "ja", "ko", "ar", "es", "de"]);
+ expect(codes).toEqual(["en", "zh-CN", "ja", "ko", "ar", "fa", "es", "de"]);
});
it("accepts zh-CN as an explicit supported language", async () => {
diff --git a/frontend/src/i18n/index.ts b/frontend/src/i18n/index.ts
index eee41d6a3..3b70a098b 100644
--- a/frontend/src/i18n/index.ts
+++ b/frontend/src/i18n/index.ts
@@ -13,6 +13,7 @@ export const SUPPORTED_LANGUAGES = [
{ code: "ja", label: "日本語", dir: "ltr" as const },
{ code: "ko", label: "한국어", dir: "ltr" as const },
{ code: "ar", label: "العربية", dir: "rtl" as const },
+ { code: "fa", label: "فارسی", dir: "rtl" as const },
{ code: "es", label: "Español", dir: "ltr" as const },
{ code: "de", label: "Deutsch", dir: "ltr" as const },
] as const;
@@ -25,6 +26,7 @@ const localeLoaders = {
ja: () => import("./locales/ja.json"),
ko: () => import("./locales/ko.json"),
ar: () => import("./locales/ar.json"),
+ fa: () => import("./locales/fa.json"),
es: () => import("./locales/es.json"),
de: () => import("./locales/de.json"),
} satisfies Record<LazyLanguageCode, () => Promise<{ default: typeof en }>>;
diff --git a/frontend/src/i18n/locales/ar.json b/frontend/src/i18n/locales/ar.json
index 433bc0480..a1737cfe2 100644
--- a/frontend/src/i18n/locales/ar.json
+++ b/frontend/src/i18n/locales/ar.json
@@ -416,7 +416,22 @@
"stoppedToast": "تم إيقاف قنوات IM",
"refreshFailed": "فشل تحديث قنوات IM",
"startFailed": "فشل بدء قنوات IM",
- "stopFailed": "فشل إيقاف قنوات IM"
+ "stopFailed": "فشل إيقاف قنوات IM",
+ "configTitle": "إعداد القناة",
+ "configHint": "تحقق من الاتصال عبر «اختبار الاتصال» قبل الحفظ؛ الحفظ يسجل القناة في ملف تكوين الوكيل المحلي.",
+ "enabledLabel": "تفعيل القناة",
+ "token": "الرمز المميز",
+ "tokenHint": "يُخزَّن في ملف التكوين المحلي للوكيل ولا يُعرض مرة أخرى.",
+ "allowlistLabel": "قائمة السماح (مفصولة بفواصل)",
+ "allowlistHint": "معرّفات المرسلين المسموح لهم بالمحادثة؛ الفراغ يعني قبول الجميع إذا سمحت القناة بذلك.",
+ "test": "اختبار الاتصال",
+ "testOk": "القناة جاهزة.",
+ "testFailed": "فشل اختبار القناة",
+ "save": "حفظ إعداد القناة",
+ "saved": "تم حفظ إعداد القناة؛ أعد تشغيل القنوات للتطبيق",
+ "saveFailed": "فشل حفظ إعداد القناة",
+ "notConfigurable": "لا يمكن إعداد هذه القناة من هذه الصفحة؛ عدّل ملف تكوين الوكيل بدلاً من ذلك.",
+ "loadFailed": "فشل تحميل إعدادات القنوات"
},
"generation": "إعدادات التوليد",
"dataSourceSettings": "إعدادات مصادر البيانات",
diff --git a/frontend/src/i18n/locales/de.json b/frontend/src/i18n/locales/de.json
index d074606e2..3d6c4cd46 100644
--- a/frontend/src/i18n/locales/de.json
+++ b/frontend/src/i18n/locales/de.json
@@ -421,7 +421,22 @@
"stoppedToast": "IM-Kanäle gestoppt",
"refreshFailed": "IM-Kanäle konnten nicht aktualisiert werden",
"startFailed": "IM-Kanäle konnten nicht gestartet werden",
- "stopFailed": "IM-Kanäle konnten nicht gestoppt werden"
+ "stopFailed": "IM-Kanäle konnten nicht gestoppt werden",
+ "configTitle": "Kanalkonfiguration",
+ "configHint": "Prüfen Sie die Verbindung vor dem Speichern mit „Verbindung testen“; das Speichern schreibt den Kanal in die lokale Agent-Konfiguration.",
+ "enabledLabel": "Kanal aktivieren",
+ "token": "Token",
+ "tokenHint": "Wird in der lokalen Agent-Konfiguration gespeichert und nie wieder angezeigt.",
+ "allowlistLabel": "Erlaubnisliste (durch Kommas getrennt)",
+ "allowlistHint": "Absender-IDs, die chatten dürfen; leer akzeptiert alle, sofern der Kanal es erlaubt.",
+ "test": "Verbindung testen",
+ "testOk": "Kanal ist bereit.",
+ "testFailed": "Kanaltest fehlgeschlagen",
+ "save": "Kanalkonfiguration speichern",
+ "saved": "Kanalkonfiguration gespeichert; Kanäle neu starten, um sie anzuwenden",
+ "saveFailed": "Speichern der Kanalkonfiguration fehlgeschlagen",
+ "notConfigurable": "Dieser Kanal kann nicht über diese Seite konfiguriert werden; bearbeiten Sie stattdessen die Agent-Konfigurationsdatei.",
+ "loadFailed": "Laden der Kanalkonfiguration fehlgeschlagen"
},
"generation": "Generierung",
"dataSourceSettings": "Datenquellen-Einstellungen",
diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json
index 5986b954d..b1a285666 100644
--- a/frontend/src/i18n/locales/en.json
+++ b/frontend/src/i18n/locales/en.json
@@ -421,7 +421,22 @@
"stoppedToast": "IM channels stopped",
"refreshFailed": "Failed to refresh IM channels",
"startFailed": "Failed to start IM channels",
- "stopFailed": "Failed to stop IM channels"
+ "stopFailed": "Failed to stop IM channels",
+ "configTitle": "Channel configuration",
+ "configHint": "Verify the connection with Test before saving; saving writes this channel into the local agent config.",
+ "enabledLabel": "Enable channel",
+ "token": "Token",
+ "tokenHint": "Stored in the local agent config and never displayed again.",
+ "allowlistLabel": "Allowlist (comma separated)",
+ "allowlistHint": "Sender IDs allowed to chat; empty accepts everyone if the channel allows it.",
+ "test": "Test connection",
+ "testOk": "Channel is ready.",
+ "testFailed": "Channel test failed",
+ "save": "Save channel configuration",
+ "saved": "Channel configuration saved; restart channels to apply",
+ "saveFailed": "Failed to save channel configuration",
+ "notConfigurable": "This channel cannot be configured from this page; edit the agent config file instead.",
+ "loadFailed": "Failed to load channel configuration"
},
"generation": "Generation",
"dataSourceSettings": "Data Source Settings",
diff --git a/frontend/src/i18n/locales/es.json b/frontend/src/i18n/locales/es.json
index 502adce4a..e005f1fc0 100644
--- a/frontend/src/i18n/locales/es.json
+++ b/frontend/src/i18n/locales/es.json
@@ -421,7 +421,22 @@
"stoppedToast": "Canales de mensajería detenidos",
"refreshFailed": "Error al actualizar los canales de mensajería",
"startFailed": "Error al iniciar los canales de mensajería",
- "stopFailed": "Error al detener los canales de mensajería"
+ "stopFailed": "Error al detener los canales de mensajería",
+ "configTitle": "Configuración de canal",
+ "configHint": "Verifique la conexión con «Probar conexión» antes de guardar; guardar escribe el canal en la configuración local del agente.",
+ "enabledLabel": "Habilitar canal",
+ "token": "Token",
+ "tokenHint": "Se guarda en la configuración local del agente y no se vuelve a mostrar.",
+ "allowlistLabel": "Lista de permitidos (separada por comas)",
+ "allowlistHint": "IDs de remitentes autorizados a chatear; vacío acepta a todos si el canal lo permite.",
+ "test": "Probar conexión",
+ "testOk": "El canal está listo.",
+ "testFailed": "Prueba del canal fallida",
+ "save": "Guardar configuración del canal",
+ "saved": "Configuración del canal guardada; reinicie los canales para aplicarla",
+ "saveFailed": "Error al guardar la configuración del canal",
+ "notConfigurable": "Este canal no se puede configurar desde esta página; edite el archivo de configuración del agente.",
+ "loadFailed": "Error al cargar la configuración de canales"
},
"generation": "Generación",
"dataSourceSettings": "Configuración de fuentes de datos",
diff --git a/frontend/src/i18n/locales/fa.json b/frontend/src/i18n/locales/fa.json
new file mode 100644
index 000000000..48d087a24
--- /dev/null
+++ b/frontend/src/i18n/locales/fa.json
@@ -0,0 +1,1635 @@
+{
+ "app": {
+ "version": "v0.1.14"
+ },
+ "charts": {
+ "noPriceData": "هنوز داده قیمتی برای این نماد وجود ندارد",
+ "noCorrelationData": "برای مقایسه حداقل دو نماد انتخاب کنید",
+ "noEquityData": "هنوز منحنی ارزش حسابی وجود ندارد — ابتدا یک بک‌تست اجرا کنید"
+ },
+ "layout": {
+ "home": "خانه",
+ "agent": "ایجنت",
+ "runtime": "ران‌تایم",
+ "scheduled": "زمان‌بندی‌شده",
+ "reports": "گزارش‌ها",
+ "portfolio": "پورتفولیو",
+ "alphaZoo": "آلفا زو",
+ "settings": "تنظیمات",
+ "correlation": "ماتریس همبستگی",
+ "optionsLab": "آزمایشگاه آپشن",
+ "sessions": "نشست‌ها",
+ "newChat": "گفتگوی جدید",
+ "noSessions": "هنوز گفتگویی ندارید — برای شروع دکمه + را بزنید",
+ "confirm": "تأیید",
+ "cancel": "لغو",
+ "rename": "تغییر نام",
+ "delete": "حذف",
+ "light": "روشن",
+ "dark": "تاریک",
+ "language": "زبان",
+ "collapse": "جمع‌کردن",
+ "expand": "بازکردن",
+ "skipToMain": "پرش به محتوای اصلی",
+ "sidebar": "نوار کناری Vibe-Trading",
+ "mainNavigation": "ناوبری اصلی",
+ "about": "درباره"
+ },
+ "runtime": {
+ "monitorBadge": "مانیتور ران‌تایم",
+ "title": "وضعیت زنده / شبیه‌سازی (Paper)",
+ "subtitlePre": "وضعیت فقط‌خواندنی از",
+ "subtitlePost": ". این صفحه کانکتورها را مجاز نمی‌کند، رانرها را راه‌اندازی یا متوقف نمی‌کند، سفارش ثبت یا لغو نمی‌کند و ماندیت را تغییر نمی‌دهد.",
+ "refresh": "بازخوانی",
+ "unavailableTitle": "وضعیت ران‌تایم در دسترس نیست",
+ "unavailableHint": "تا زمانی که بک‌اند وضعیت به‌روزی ارائه ندهد، ران‌تایم کانکتور را غیرقابل‌اعتماد فرض کنید.",
+ "statusUnavailable": "وضعیت ران‌تایم در دسترس نیست.",
+ "globalHalt": "توقف سراسری",
+ "halted": "متوقف‌شده",
+ "clear": "رفع توقف",
+ "brokers": "کارگزاران",
+ "authorized": "مجاز‌شده",
+ "runners": "رانرها",
+ "running": "{{count}} در حال اجرا",
+ "noProfilesTitle": "هیچ پروفایل ران‌تایمی گزارش نشده",
+ "noProfilesBody": "بک‌اند هیچ پروفایل زنده یا شبیه‌سازی شناخته‌شده‌ای از کارگزارها برنگردانده است.",
+ "authPresent": "اعتبارنامه موجود",
+ "authMissing": "اعتبارنامه موجود نیست",
+ "runnerAlive": "رانر فعال",
+ "runnerStopped": "رانر متوقف",
+ "haltedPill": "متوقف‌شده",
+ "recognizedProfile": "پروفایل کانکتور شناخته‌شده",
+ "unknownProfile": "پروفایل کانکتور ناشناخته",
+ "lastTick": "آخرین تیک",
+ "authorization": "مجوز",
+ "oauthToken": "توکن OAuth",
+ "present": "موجود",
+ "missing": "ناموجود",
+ "profileType": "نوع پروفایل",
+ "recognized": "شناخته‌شده",
+ "unknown": "ناشناخته",
+ "mandate": "ماندیت",
+ "account": "حساب",
+ "unrecorded": "ثبت‌نشده",
+ "expiry": "انقضا",
+ "expired": "منقضی‌شده",
+ "limits": "محدودیت‌ها",
+ "noMandate": "ماندیتی فعال گزارش نشده است.",
+ "riskStateTitle": "وضعیت ریسک ران‌تایم",
+ "riskHalted": "ریسک متوقف",
+ "riskHaltedDesc": "کلید قطع برای این پروفایل فعال شده است. تا پاک‌شدن وضعیت، ران‌تایم کانکتور را متوقف فرض کنید.",
+ "riskActive": "ران‌تایم فعال",
+ "riskActiveDesc": "رانر زنده است و ماندیت منقضی‌نشده‌ای وجود دارد. این صفحه همچنان فقط وضعیتِ فقط‌خواندنی است.",
+ "riskIdle": "آماده اما بیکار",
+ "riskIdleDesc": "مجوز و ماندیت موجودند، اما رانر زنده نیست.",
+ "riskDormant": "غیرفعال",
+ "riskDormantDesc": "ران‌تایم کانکتور برای عملیات خودکار آماده نیست؛ مجوز، ماندیت یا زنده‌بودن رانر ناقص است.",
+ "limitsUnavailable": "محدودیت‌ها در دسترس نیست",
+ "perOrder": "/سفارش",
+ "exposure": "در معرض",
+ "perDay": "/روز",
+ "leverageSuffix": "برابر اهرم",
+ "never": "هرگز",
+ "ago": "پیش",
+ "notConfigured": "پیکربندی نشده",
+ "readyToVerify": "آماده راستی‌آزمایی",
+ "connectedReadOnly": "متصل · فقط‌خواندنی",
+ "connectionFailed": "اتصال ناموفق",
+ "verifyConnection": "راستی‌آزمایی اتصال",
+ "retry": "تلاش دوباره",
+ "credentialSource": "منبع اعتبارنامه",
+ "sdk": "SDK",
+ "configDeclared": "اعلان‌شده در پیکربندی",
+ "connectorStatusUnavailable": "وضعیت در دسترس نیست",
+ "connectedAccessUnknown": "متصل · سطح دسترسی نامشخص",
+ "missingLongbridgeVariables": "پیکربندی ناقص است. این متغیرها را در agent/.env تنظیم کنید و سرویس را دوباره بسازید:",
+ "missingEtoroVariables": "پیکربندی ناقص است. این متغیرهای محیطی را تنظیم کنید یا فایل ~/.vibe-trading/etoro.json بسازید:",
+ "missingEtoroFileHint": "فایل نمونه: {\"api_key\": \"کلید عمومی شما\", \"user_key\": \"کلید کاربری شما\", \"profile\": \"live-readonly\"}. پروفایل‌ها: etoro-paper-sdk، etoro-live-sdk-readonly، etoro-paper-trade، etoro-live-trade.",
+ "missingConnectorVariables": "پیکربندی ناقص است. اعتبارنامه‌های کانکتور را در ~/.vibe-trading/ یا agent/.env تنظیم کنید و اتصال را راستی‌آزمایی کنید.",
+ "pathSeparatedKeyBound": "مسیر جداشده دمو/واقعی (جفت‌کلید مشترک)",
+ "sdkConnectorProfile": "کانکتور مستقیم SDK · پروفایل فقط‌خواندنی",
+ "connectionDetails": "جزئیات اتصال",
+ "environment": "محیط",
+ "environmentIdentity": "محیط اعلام‌شده",
+ "capabilities": "قابلیت‌ها",
+ "capabilityAccount": "حساب",
+ "capabilityPositions": "موقعیت‌ها",
+ "capabilityOpenOrders": "سفارش‌های باز",
+ "capabilityQuotes": "نقل‌قول‌ها",
+ "capabilityHistory": "تاریخچه",
+ "readOnly": "فقط‌خواندنی",
+ "accessUnknown": "دسترسی نامشخص",
+ "diagnostics": "عیب‌یابی",
+ "lastChecked": "آخرین بررسی",
+ "errorCode": "کد خطا",
+ "installed": "نصب‌شده",
+ "notInstalled": "نصب‌نشده",
+ "connectorVerifyFailed": "راستی‌آزمایی اتصال ناموفق بود.",
+ "diagnosticCredentialsPartial": "اعتبارنامه‌ها ناقص‌اند. همه متغیرهای لازم را تنظیم کنید و سرویس را دوباره بسازید.",
+ "diagnosticCredentialsConflict": "منابع اعتبارنامه در تضادند. یک منبع کامل نگه دارید و دوباره تلاش کنید.",
+ "diagnosticSdkMissing": "SDK لانگ‌بریج در سرویس بک‌اند نصب نیست.",
+ "diagnosticAuthenticationFailed": "احراز هویت ناموفق بود. اعتبارنامه‌های پیکربندی‌شده را بررسی کنید.",
+ "diagnosticNetworkUnreachable": "سرویس لانگ‌بریج در دسترس نیست. دسترسی شبکه را بررسی کنید و دوباره تلاش کنید.",
+ "diagnosticBrokerError": "کارگزار درخواست راستی‌آزمایی فقط‌خواندنی را رد کرد. دوباره تلاش کنید یا لاگ‌های بک‌اند را بررسی کنید."
+ },
+ "scheduled": {
+ "title": "پژوهش زمان‌بندی‌شده",
+ "subtitle": "اجرای تکرارشونده پژوهش بر اساس ساعت محلی شما — فاصله‌ها با تغییر ساعت تابستانی هم پایدار می‌مانند.",
+ "promptLabel": "پرامپت پژوهش",
+ "promptPlaceholder": "مثلاً اسکن پیش از بازار: رتبه‌بندی حجم‌های غیرعادی دیروز و خلاصه اخبار شبانه",
+ "modeLabel": "دوره تکرار",
+ "modeTime": "در ساعت مشخصی از روز",
+ "modeAdvanced": "پیشرفته (cron یا بازه زمانی)",
+ "timeLabel": "ساعت محلی",
+ "daysLabel": "روزها",
+ "daysWeekdays": "روزهای هفته (دوشنبه تا جمعه)",
+ "daysEveryDay": "هر روز",
+ "scheduleLabel": "عبارت زمان‌بندی",
+ "advancedHint": "یک عبارت cron پنج‌فیلدی در منطقه زمانی انتخابی ارزیابی می‌شود (دقیقه، ساعت، روز، ماه، روزِ هفته؛ لیست و بازه مجاز است)، یا یک بازه ساده به میلی‌ثانیه.",
+ "timezoneLabel": "منطقه زمانی",
+ "create": "زمان‌بندی اجرا",
+ "promptRequired": "پیش از زمان‌بندی، پرامپت پژوهش را وارد کنید.",
+ "invalidTime": "زمان معتبری با قالب HH:MM وارد کنید.",
+ "executorHint": "اجراها فقط زمانی انجام می‌شوند که سرور با فعال‌بودن VIBE_TRADING_ENABLE_SCHEDULER راه‌اندازی شده باشد.",
+ "listTitle": "اجراهای زمان‌بندی‌شده",
+ "loading": "در حال بارگذاری اجراهای زمان‌بندی‌شده…",
+ "retry": "تلاش دوباره",
+ "empty": "هنوز اجرای زمان‌بندی‌شده‌ای ندارید — از بالا یکی بسازید.",
+ "cadenceEvery": "هر {{interval}}",
+ "cadenceDaily": "هر روز ساعت {{time}}",
+ "cadenceWeekly": "{{days}} ساعت {{time}}",
+ "statusPending": "در انتظار",
+ "statusRunning": "در حال اجرا",
+ "statusCompleted": "کامل‌شده",
+ "statusFailed": "ناموفق",
+ "statusCancelled": "لغوشده",
+ "statusExpired": "منقضی‌شده",
+ "noFurtherRuns": "اجرای دیگری وجود ندارد",
+ "endsAt": "پایان در {{when}}",
+ "proposalCreateTitle": "تأیید پژوهش زمان‌بندی‌شده · ایجاد",
+ "proposalCancelTitle": "تأیید پژوهش زمان‌بندی‌شده · لغو",
+ "proposalConfirmed": "تأییدشده",
+ "proposalDiscarded": "دورانداخته‌شده",
+ "proposalExpired": "منقضی‌شده",
+ "proposalCadence": "دوره تکرار",
+ "proposalTimezone": "منطقه زمانی",
+ "proposalEndAt": "زمان پایان",
+ "proposalNoEnd": "ندارد",
+ "proposalDelivery": "تحویل نتیجه",
+ "proposalInApp": "فقط درون‌برنامه‌ای",
+ "proposalDiscard": "دور انداختن",
+ "proposalConfirmCreate": "تأیید ایجاد",
+ "proposalConfirmCancel": "تأیید لغو",
+ "nextRun": "اجرای بعدی: {{when}}",
+ "lastError": "آخرین خطا: {{error}}",
+ "delete": "حذف",
+ "deleteAria": "حذف اجرای زمان‌بندی‌شده: {{prompt}}",
+ "confirmDelete": "تأیید حذف",
+ "confirmDeleteAria": "تأیید حذف اجرای زمان‌بندی‌شده: {{prompt}}",
+ "deliveryChannelLabel": "تحویل به کانال",
+ "deliveryChannelPlaceholder": "تلگرام، فیشیو، … (خالی بگذارید تا نتیجه فقط در برنامه بماند)",
+ "deliveryTargetLabel": "مقصد کانال",
+ "deliveryTargetPlaceholder": "شناسه چت / گروه / کاربر",
+ "deliveryHint": "به‌طور پیش‌فرض خاموش است. بریفینگ یک‌بار پس از پایان اجرا ارسال می‌شود، نه هنگام زمان‌بندی.",
+ "deliveryTargetRequired": "برای این کانال مقصدی انتخاب کنید یا کانال را پاک کنید.",
+ "delivery_none": "تحویل به {{channel}} پس از اجرای بعدی",
+ "delivery_pending": "بریفینگ در انتظار ارسال به {{channel}}",
+ "delivery_sending": "در حال ارسال بریفینگ به {{channel}}",
+ "delivery_accepted": "بریفینگ توسط {{channel}} پذیرفته شد (رسید ارائه‌دهنده ندارد)",
+ "delivery_sent": "بریفینگ به {{channel}} تحویل شد",
+ "delivery_failed": "تحویل به {{channel}} ناموفق بود",
+ "verdictEmpty": "هنوز حکمی ثبت نشده",
+ "verdictUnreadable": "آخرین حکم خوانا نیست",
+ "verdictNoCalls": "بدون فراخوان",
+ "verdictDelta": "{{was}} → {{now}}",
+ "verdictRecorded": "تا {{when}}"
+ },
+ "reports": {
+ "badge": "گزارش‌ها",
+ "title": "کتابخانه گزارش بک‌تست",
+ "subtitle": "مرور گزارش‌های بک‌تست، متریک‌ها و جزئیات اجرا از یک‌جا.",
+ "refresh": "بازخوانی",
+ "searchPlaceholder": "جستجوی شناسه اجرا، پرامپت، نماد، وضعیت…",
+ "allStatuses": "همه وضعیت‌ها",
+ "startDate": "تاریخ شروع",
+ "endDate": "تاریخ پایان",
+ "sort": "مرتب‌سازی",
+ "sortNewest": "جدیدترین اول",
+ "sortOldest": "قدیمی‌ترین اول",
+ "sortReturn": "بازده از زیاد به کم",
+ "sortSharpe": "شارپ از زیاد به کم",
+ "count": "{{shown}} از {{total}} گزارش",
+ "unavailable": "کتابخانه گزارش در دسترس نیست",
+ "loadError": "بارگذاری گزارش‌ها ممکن نشد.",
+ "emptyTitle": "هنوز گزارشی وجود ندارد",
+ "emptyBody": "از ایجنت یک بک‌تست بسازید، سپس برای مرور به این‌جا برگردید.",
+ "noMatchesTitle": "گزارشی مطابق یافت نشد",
+ "noMatchesBody": "عبارت جستجو، فیلتر وضعیت یا بازه تاریخ را تنظیم کنید.",
+ "noPrompt": "پرامپتی ثبت نشده است.",
+ "to": "تا",
+ "return": "بازده",
+ "sharpe": "شارپ",
+ "fullReport": "گزارش کامل",
+ "compare": "مقایسه",
+ "unknown": "نامشخص"
+ },
+ "connection": {
+ "reconnecting": "در حال اتصال دوباره…",
+ "disconnected": "اتصال قطع شد. برای اتصال دوباره صفحه را بازخوانی کنید.",
+ "reload": "بازخوانی"
+ },
+ "welcome": {
+ "categories": {
+ "multiMarketBacktest": "بک‌تست سهام A",
+ "researchAnalysis": "پژوهش و تحلیل",
+ "swarmTeams": "تیم‌های تحلیل‌گر هوش مصنوعی",
+ "docWebResearch": "پژوهش سند و وب",
+ "tradeJournal": "دفتر معاملات",
+ "tradingConnectors": "کانکتورهای معاملاتی",
+ "shadowAccount": "حساب سایه",
+ "valueInvesting": "سرمایه‌گذاری ارزشی"
+ },
+ "examples": {
+ "crossMarketPortfolio": "پورتفولیوی سه‌سهمی متوازن",
+ "crossMarketPortfolioDesc": "سرمایه را بین ۳ سهم A تقسیم کنید تا هر سهم ریسک برابر ببرد (ریسک پاریتی) و با وزن برابر مقایسه کنید",
+ "crossMarketPortfolioPrompt": "یک پورتفولیوی ریسک‌پاریتی با 000001.SZ و 600519.SH و 000858.SZ بساز، برای کل سال ۲۰۲۴ بک‌تست بگیر و با بنچمارک وزن برابر مقایسه کن",
+ "btcMacd": "استراتژی MACD سهام A",
+ "btcMacdDesc": "بک‌تست استراتژی MACD در سطح دقیقه برای سهام A",
+ "btcMacdPrompt": "استراتژی MACD را روی کندل‌های ۵ دقیقه‌ای 000001.SZ بک‌تست کن: fast=12، slow=26، signal=9، ۳۰ روز اخیر",
+ "usTechMaxDiv": "پراکندگی ریسک بین سهام بزرگ",
+ "usTechMaxDivDesc": "وزن‌دهی ۵ سهم بزرگ به‌گونه‌ای که هیچ نمادی ریسک را مسلط نکند (بهینه‌ساز حداکثر تنوع)",
+ "usTechMaxDivPrompt": "پورتفولیوی حداکثر تنوع را برای 600519.SH و 000858.SZ و 601318.SH و 000001.SZ و 600036.SH برای کل سال ۲۰۲۴ بک‌تست کن",
+ "multiFactorAlpha": "مدل آلفای چندعاملی",
+ "multiFactorAlphaDesc": "ترکیب ۴ سیگنال سهم‌گزینی روی ۳۰۰ سهم با وزن‌دهی بر اساس قدرت پیش‌بینی بازده (IC)",
+ "multiFactorAlphaPrompt": "یک مدل آلفای چندعاملی با مومنتوم، بازگشت، نوسان و گردش معاملات روی اعضای CSI 300 با ترکیب وزنی مبتنی بر IC بساز و ۲۰۲۳ تا ۲۰۲۴ بک‌تست بگیر",
+ "optionsGreeks": "بررسی ریسک آپشن (گریک‌ها)",
+ "optionsGreeksDesc": "قیمت‌گذاری آپشن و بررسی حساسیت به قیمت سهم، زمان و نوسان (گریک‌ها)",
+ "optionsGreeksPrompt": "گریک‌های آپشن را با بلک-شولز محاسبه کن: spot=100، strike=105، نرخ بدون ریسک=۳٪، نوسان=۲۵٪، سررسید=۹۰ روز؛ دلتا/گاما/تتا/وگا را تحلیل کن",
+ "valueCommittee": "کمیته سرمایه‌گذاری ارزشی",
+ "valueCommitteeDesc": "مناظره چهار استاد (بافیت / مانگر / دوان یونگ‌پینگ / لی لو) روی یک سهم",
+ "valueCommitteePrompt": "با run_swarm و پرست value_investing_committee شرکت تنسنت (00700.HK) را تحلیل کن: بافیت درباره خندق و قیمت، مانگر درباره وارونگی، دوان یونگ‌پینگ درباره کسب‌وکار و مدیریت، لی لو درباره قطعیت ده‌ساله؛ سپس رئیس اجماع و تناقض‌ها را جمع‌بندی کند",
+ "bottleneckHunter": "شکارچی گلوگاه زنجیره تأمین",
+ "bottleneckHunterDesc": "تأمین‌کنندگان کوچکی که یک روند بزرگ بدون آن‌ها ممکن نیست را پیدا کن و ارزانی‌شان را بسنج",
+ "bottleneckHunterPrompt": "از مهارت bottleneck-hunter برای یافتن گلوگاه‌های لایه ۲/۳ زنجیره تأمین در زیرساخت هوش مصنوعی (اپتیک/لیزر/زیرلایه InP) استفاده کن؛ هر نقطه گلوگاه را امتیازده و شرکت‌های واجد شرط ارزش‌گذاری را فهرست کن",
+ "thesisTracker": "ردیاب تِزیس سرمایه‌گذاری",
+ "thesisTrackerDesc": "در ۵ جمله بنویس چرا سهام را نگه می‌داری و خطوط قرمزی که به فروش می‌رساند",
+ "thesisTrackerPrompt": "از مهارت thesis-tracker برای ساخت تِزیس سرمایه‌گذاری مائوتای کوئی‌جو (600519.SH) استفاده کن: تِزیس مرکزی ۵ جمله‌ای، فرض‌های ابطال‌پذیر، خطوط قرمز و لنگرهای ارزش‌گذاری، با financial_rigor راستی‌آزمایی شود",
+ "valuationCheck": "بررسی گران‌بودن یک سهم",
+ "valuationCheckDesc": "محاسبه دقیق PE / PB / ROE / ارزش بازار و آزمون فشار در ۳ سناریوی رشد",
+ "valuationCheckPrompt": "از ابزار financial_rigor برای راستی‌آزمایی ارزش‌گذاری مائوتای کوئی‌جو استفاده کن: قیمت ۱۵۰۰، EPS برابر ۶۸.۶، ارزش دفتری هر سهم ۱۸۰ — دقیقاً PE و PB و ROE را حساب کن و سپس ارزش‌گذاری سه‌سناریویی (رشد ۱۲٪/۸٪/۰٪، PE برابر ۲۲/۱۸/۱۴، سه سال)",
+ "investmentCommittee": "خرید یا فروش؟ کمیته تصمیم بگیرد",
+ "investmentCommitteeDesc": "مناظره چندایجنسی: خرید در برابر فروش، بررسی ریسک، تصمیم مدیر پرتفوی",
+ "investmentCommitteePrompt": "[حالت تیمی Swarm] با پرست investment_committee ارزیابی کن که با توجه به شرایط فعلی بازار روی 600519.SH خرید یا فروش بگیریم",
+ "quantStrategyDesk": "میز استراتژی کمّی",
+ "quantStrategyDeskDesc": "خط لوله غربالگری ← پژوهش فاکتور ← بک‌تست ← ممیزی ریسک",
+ "quantStrategyDeskPrompt": "[حالت تیمی Swarm] با پرست quant_strategy_desk بهترین استراتژی مومنتوم را روی اعضای CSI 300 پیدا و بک‌تست کن",
+ "earningsReport": "تحلیل گزارش مالی PDF",
+ "earningsReportDesc": "فایل PDF بارگذاری کنید و درباره ارقام مالی بپرسید",
+ "earningsReportPrompt": "متریک‌های کلیدی مالی، ریسک‌ها و چشم‌انداز گزارش مالی بارگذاری‌شده را خلاصه کن",
+ "macroResearch": "پژوهش وب: چشم‌انداز کلان",
+ "macroResearchDesc": "تحلیل کلان و چشم‌انداز بازار سهام A",
+ "macroResearchPrompt": "آخرین گزارش سیاست پولی بانک مرکزی را بخوان و تأثیر آن بر بازار سهام A را خلاصه کن",
+ "analyzeBrokerExport": "تحلیل خروجی کارگزاری من",
+ "analyzeBrokerExportDesc": "خروجی تونگ‌هواشون / ایست‌مانی / فوتو یا هر CSV — روزهای نگهداری، نرخ برد، نسبت سود به زیان، الگوی زمانی",
+ "analyzeBrokerExportPrompt": "دفتر معاملاتی را که همین حالا بارگذاری کردم تحلیل کن — پروفایل کامل با آمار نگهداری، نرخ برد، نمادهای برتر و توزیع ساعتی",
+ "diagnoseBehavior": "تشخیص سوگیری‌های رفتاری من",
+ "diagnoseBehaviorDesc": "اثر واگذاری، معامله افراطی، تعقیب مومنتوم، لنگر انداختن — شدت و شواهد عددی",
+ "diagnoseBehaviorPrompt": "چهار تشخیص رفتاری را روی دفتر معاملاتی من اجرا کن (واگذاری، معامله افراطی، تعقیب، لنگر) و بگو کدام سوگیری بیشترین آسیب را به سود و زیان من می‌زند",
+ "checkConnector": "بررسی کانکتور انتخاب‌شده",
+ "checkConnectorDesc": "فهرست پروفایل‌های کانکتور و راستی‌آزمایی مورد انتخاب‌شده",
+ "checkConnectorPrompt": "پروفایل‌های کانکتور معاملاتی من را فهرست کن، انتخاب‌شده را نشان بده و همان را بررسی کن. اگر آماده نیست دقیقاً بگو چه گام راه‌اندازی جا افتاده. هیچ سفارشی ثبت یا تغییر نده.",
+ "analyzePortfolio": "تحلیل پورتفولیوی کانکتور",
+ "analyzePortfolioDesc": "خواندن خلاصه حساب و موقعیت‌ها از کانکتور انتخاب‌شده",
+ "analyzePortfolioPrompt": "با پروفایل کانکتور انتخاب‌شده، حساب، موقعیت‌ها، تمرکز، نقدی و ریسک پورتفولیوی من را خلاصه کن. هیچ سفارشی ثبت یا تغییر نده.",
+ "quoteTrend": "نرخ و روند",
+ "quoteTrendDesc": "دریافت نرخ لحظه‌ای و کندل‌های روزانه اخیر از کانکتور انتخاب‌شده",
+ "quoteTrendPrompt": "با کانکتور انتخاب‌شده نرخ 600519.SH و ۳۰ کندل روزانه بگیر و نرخ فعلی را با روند اخیر خلاصه کن. فقط‌خواندنی بمان.",
+ "trainShadow": "آموزش سایه من از دفتر معاملات",
+ "trainShadowDesc": "استخراج قواعد استراتژی شما از CSV کارگزاری و ذخیره پروفایل سایه",
+ "trainShadowPrompt": "حساب سایه‌ام را از دفتر معاملاتی‌ای که همین حالا بارگذاری کردم آموزش بده — قواعد استخراج‌شده را نشان بده و تأیید کن که شبیه رفتار من است",
+ "shadowDelta": "چقدر از دست می‌دهم؟",
+ "shadowDeltaDesc": "بک‌تست استراتژی سایه و تفکیک اختلاف با سود و زیان واقعی",
+ "shadowDeltaPrompt": "بک‌تست سایه را برای ۹۰ روز اخیر اجرا کن و نشان بده سود و زیان من کجا از سایه جدا شده (نقض قواعد، خروج زودهنگام، سیگنال‌های ازدست‌رفته)",
+ "shadowReport": "تولید گزارش سایه",
+ "shadowReportDesc": "گزارش قابل‌اشتراک ۸ بخشی: منحنی حساب، بازده تنظیم‌شده با ریسک و منشأ هر سود",
+ "shadowReportPrompt": "گزارش سایه را بساز و نشانی آن را بده — با اختلاف شما-نسبت-به-سایه شروع کن"
+ },
+ "taskSubtitle": "درباره یک سهم، یک استراتژی یا پورتفولیوی خود بپرسید — داده را می‌کشم، محاسبه می‌کنم و همه گام‌ها را نشان می‌دهم.",
+ "quickActions": "اقدامات سریع",
+ "browseAllExamples": "مرور همه مثال‌ها",
+ "greetings": {
+ "morning1": "صبح بخیر.",
+ "morning2": "صبح بخیر — هر وقت آماده بودی من هم هستم.",
+ "morning3": "صبح بخیر. شروع کنیم.",
+ "afternoon1": "بعدازظهر بخیر.",
+ "afternoon2": "برای سؤال بعدی آماده‌ای؟",
+ "afternoon3": "امروز بعدازظهر چه را کاوش کنیم؟",
+ "evening1": "عصر بخیر.",
+ "evening2": "بگذار بازار را معنا کنیم.",
+ "evening3": "آماده یک پژوهش متمرکز هستی؟",
+ "night1": "هنوز در حال فکر کردن؟",
+ "night2": "با هم حلش کنیم.",
+ "night3": "پیش از خواب یک ایده دیگر؟"
+ }
+ },
+ "settings": {
+ "title": "تنظیمات",
+ "authRequired": "احراز هویت لازم است",
+ "authDesc": "کلید احراز API را وارد کنید تا تنظیمات باز شود.",
+ "dataSources": "منابع داده",
+ "llmBackend": "بک‌اند LLM",
+ "save": "ذخیره",
+ "saving": "در حال ذخیره…",
+ "saved": "تنظیمات ذخیره شد",
+ "saveFailed": "ذخیره ناموفق بود",
+ "provider": "ارائه‌دهنده",
+ "refresh": "بازخوانی",
+ "modelName": "نام مدل",
+ "baseUrl": "URL پایه",
+ "apiAuthKey": "کلید احراز API",
+ "loading": "در حال بارگذاری…",
+ "temperature": "دما",
+ "temperatureDesc": "تصادفی‌بودن پاسخ را کنترل می‌کند، نه هوش. مقادیر کمتر پایدارتر و برای تحلیل مالی مناسب‌ترند؛ ۰ تا ۰٫۲ پیش‌فرض معقولی است.",
+ "timeoutSeconds": "زمان انتظار (ثانیه)",
+ "maxRetries": "حداکثر تلاش مجدد",
+ "reasoningEffort": "عمق استدلال",
+ "providerDefault": "پیش‌فرض ارائه‌دهنده",
+ "off": "خاموش",
+ "reasoningEffortNone": "بدون (صریح)",
+ "reasoningEffortLow": "کم",
+ "reasoningEffortMedium": "متوسط",
+ "reasoningEffortHigh": "زیاد",
+ "reasoningEffortMax": "بیشینه",
+ "reasoningEffortDesc": "عمق استدلال را روی مدل‌های پشتیبان‌شده کنترل می‌کند. سطوح بالاتر ممکن است تحلیل پیچیده را بهتر کنند اما زمان بیشتری می‌برند؛ ارائه‌دهندگان پشتیبان‌نشده ممکن است این تنظیم را نادیده بگیرند. «بدون (صریح)» این فیلد را با استدلال غیرفعال می‌فرستد — برخی مدل‌های OpenAI برای استفاده از ابزارها به آن نیاز دارند.",
+ "useDefaultModel": "استفاده از مدل پیش‌فرض",
+ "useDefaultUrl": "استفاده از URL پیش‌فرض",
+ "dataSourcesDesc": "منابع داده خارجی برای موتور بک‌تست را پیکربندی کنید.",
+ "tushareDesc": "داده تاریخی سهام A چین (نیازمند متغیر محیطی TUSHARE_TOKEN).",
+ "baostockDesc": "داده جایگزین سهام A از طریق پروتکل TCP (بدون نیاز به کلید API).",
+ "status": "وضعیت",
+ "installed": "نصب‌شده",
+ "notInstalled": "نصب‌نشده",
+ "token": "توکن",
+ "tokenConfigured": "توکن پیکربندی‌شده",
+ "tokenNotSet": "متغیر محیطی TUSHARE_TOKEN تنظیم نشده است",
+ "apiTimeout": "زمان انتظار درخواست API",
+ "loaderAvailable": "بارگذار موجود",
+ "noProjectLoader": "بارگذار پروژه موجود نیست",
+ "pythonPackageInstalled": "بسته پایتون نصب‌شده",
+ "pythonPackageNotInstalled": "بسته پایتون نصب نشده",
+ "localApiAccess": "دسترسی محلی API",
+ "localApiAccessDesc": "برای استقرارهای وب راه‌دور یا خصوصی، کلید API سرور را یک‌بار در این مرورگر وارد کنید. استفاده از localhost می‌تواند خالی بماند.",
+ "serverApiKey": "کلید API سرور",
+ "storedInBrowser": "فقط در همین مرورگر ذخیره می‌شود. برای پاک‌کردن خالی بگذارید.",
+ "localApiKeySaved": "کلید محلی API ذخیره شد",
+ "subtitle": "اعتبارنامه مدل و توکن‌های منبع داده بازار را برای این پروژه محلی پیکربندی کنید.",
+ "unavailable": "تنظیمات در دسترس نیست",
+ "llmSettings": "تنظیمات LLM",
+ "llmSettingsDesc": "مدل مورد استفاده ایجنت را انتخاب و در فایل محلی agent/.env ذخیره کنید.",
+ "connection": "اتصال",
+ "model": "مدل",
+ "useProviderDefaults": "استفاده از پیش‌فرض‌های ارائه‌دهنده",
+ "modelIdHint": "شناسه دقیق مدلی را که ارائه‌دهنده شما لازم دارد وارد کنید.",
+ "loadModels": "بارگذاری مدل‌ها",
+ "modelsLoaded": "{{count}} مدل موجود بارگذاری شد.",
+ "modelsLoadFailed": "بارگذاری فهرست مدل‌های ارائه‌دهنده ممکن نشد.",
+ "modelOptions": "مدل‌های موجود",
+ "modelDiscoveryOauthUnsupported": "این ارائه‌دهنده کشف مدل را از طریق نقطه پایانی OAuth ارائه نمی‌دهد.",
+ "modelDiscoveryApiKeyRequired": "برای بارگذاری مدل‌های موجود این ارائه‌دهنده، کلید API آن را وارد یا ذخیره کنید.",
+ "modelDiscoveryUnavailable": "ارائه‌دهنده فهرست مدلی برنگرداند. همچنان می‌توانید شناسه دقیق مدل را تایپ کنید.",
+ "modelPickerHint": "گزینه‌های ارائه‌دهنده را بارگذاری کنید یا شناسه دقیق مدل سفارشی را تایپ کنید.",
+ "clearApiKey": "پاک‌کردن کلید API ذخیره‌شده",
+ "channels": {
+ "title": "کانال‌های IM",
+ "description": "آداپتورهای چت را به همان ران‌تایم نشست Vibe-Trading که Web UI و CLI استفاده می‌کنند متصل کنید.",
+ "runtime": "ران‌تایم",
+ "running": "در حال اجرا",
+ "stopped": "متوقف",
+ "enabled": "فعال",
+ "disabled": "غیرفعال",
+ "loaded": "بارگذاری‌شده",
+ "notLoaded": "بارگذاری‌نشده",
+ "unavailable": "در دسترس نیست",
+ "channel": "کانال",
+ "state": "وضعیت",
+ "recovery": "راه‌اندازی مجدد",
+ "noRecovery": "آماده",
+ "refresh": "بازخوانی",
+ "start": "راه‌اندازی کانال‌ها",
+ "stop": "توقف کانال‌ها",
+ "started": "کانال‌های IM راه‌اندازی شدند",
+ "stoppedToast": "کانال‌های IM متوقف شدند",
+ "refreshFailed": "بازخوانی کانال‌های IM ناموفق بود",
+ "startFailed": "راه‌اندازی کانال‌های IM ناموفق بود",
+ "stopFailed": "توقف کانال‌های IM ناموفق بود",
+ "configTitle": "پیکربندی کانال",
+ "configHint": "پیش از ذخیره، اتصال را با «تست اتصال» راستی‌آزمایی کنید؛ ذخیره، کانال را در فایل پیکربندی محلی ایجنت ثبت می‌کند.",
+ "enabledLabel": "کانال فعال باشد",
+ "token": "توکن",
+ "tokenHint": "در فایل پیکربندی محلی ایجنت ذخیره می‌شود و دوباره نمایش داده نمی‌شود.",
+ "allowlistLabel": "فهرست مجاز (جدا با ویرگول)",
+ "allowlistHint": "شناسه‌های مجاز برای گفتگو؛ خالی به معنای پذیرش همه است اگر پیکربندی کانال اجازه دهد.",
+ "test": "تست اتصال",
+ "testOk": "کانال آماده است.",
+ "testFailed": "تست کانال ناموفق بود",
+ "save": "ذخیره پیکربندی کانال",
+ "saved": "پیکربندی کانال ذخیره شد؛ برای اعمال، کانال‌ها را راه‌اندازی مجدد کنید",
+ "saveFailed": "ذخیره پیکربندی کانال ناموفق بود",
+ "notConfigurable": "این کانال از این صفحه پیکربندی نمی‌شود؛ پیکربندی را در فایل پیکربندی ایجنت انجام دهید.",
+ "loadFailed": "بارگذاری پیکربندی کانال‌ها ناموفق بود"
+ },
+ "generation": "تولید",
+ "dataSourceSettings": "تنظیمات منبع داده",
+ "dataSourceSettingsDesc": "اعتبارنامه‌های اختیاری داده بازار را که بک‌تست‌ها و ایجنت‌های پژوهشی استفاده می‌کنند پیکربندی کنید.",
+ "tushareToken": "توکن توشار",
+ "clearTushareToken": "پاک‌کردن توکن توشار ذخیره‌شده",
+ "saveDataSourceSettings": "ذخیره تنظیمات منبع داده",
+ "baostock": "بائواستاک",
+ "loadLlmSettingsFailed": "بارگذاری تنظیمات LLM ناموفق بود: {{message}}",
+ "loadDataSourceSettingsFailed": "بارگذاری تنظیمات منبع داده ناموفق بود: {{message}}",
+ "llmSettingsSaved": "تنظیمات LLM ذخیره شد",
+ "saveLlmSettingsFailed": "ذخیره تنظیمات LLM ناموفق بود: {{message}}",
+ "dataSourceSettingsSaved": "تنظیمات منبع داده ذخیره شد",
+ "desktopCredentialRestarting": "اعتبارنامه رمزنگاری شد. در حال راه‌اندازی مجدد سرویس محلی…",
+ "saveDataSourceSettingsFailed": "ذخیره تنظیمات منبع داده ناموفق بود: {{message}}",
+ "configured": "پیکربندی‌شده",
+ "keepCurrentKey": "برای حفظ کلید فعلی خالی بگذارید",
+ "providerUsesOauth": "این ارائه‌دهنده از OAuth استفاده می‌کند. اجرا کنید: {{command}}",
+ "providerUsesManagedAuth": "این ارائه‌دهنده احراز هویت را مدیریت می‌کند. اجرا کنید: {{command}}",
+ "noApiKeyRequired": "این ارائه‌دهنده کلید API لازم ندارد.",
+ "keepCurrentToken": "برای حفظ توکن فعلی خالی بگذارید",
+ "iwencaiApiKey": "کلید API iWenCai",
+ "fredApiKey": "کلید API FRED",
+ "iwencaiDesc": "برای غربالگری معنایی سهم از طریق iWenCai (问财) استفاده می‌شود. کلید رایگان لازم است.",
+ "clearSavedKey": "پاک‌کردن کلید ذخیره‌شده",
+ "fredDesc": "برای داده‌های کلان اقتصادی FRED (CPI، GDP، بیکاری و…) استفاده می‌شود. کلید رایگان از fred.stlouisfed.org.",
+ "featureFlags": "پرچم‌های ویژگی",
+ "featureFlagsDesc": "پرچم‌های ویژگی زمان اجرا شناسایی‌شده از متغیرهای محیطی.",
+ "shellTools": "ابزارهای پوسته",
+ "scheduler": "زمان‌بند",
+ "sessionRuntime": "ران‌تایم نشست",
+ "flagsReadFrom": "پرچم‌ها از {{env1}}، {{env2}} و {{env3}} در {{env_path}} خوانده می‌شوند.",
+ "unknownError": "خطای ناشناخته",
+ "providerChangeHint": "تغییر ارائه‌دهنده مدل و نقطه پایانی پیشنهادی را به‌روزرسانی می‌کند.",
+ "oauth": "OAuth",
+ "authentication": "احراز هویت",
+ "apiKey": "کلید API",
+ "tushareTokenDesc": "برای داده سهام A، آینده، صندوق و کلان چین استفاده می‌شود. اگر تنظیم نشود، در صورت وجود، پروژه به AKShare برمی‌گردد.",
+ "sourcePriority": {
+ "title": "اولویت منابع داده",
+ "description": "ترتیب امتحان‌شدن منابع داده در هر بازار را زمانی که ایجنت داده را خودکار واکشی می‌کند مدیریت کنید. منابعی که صراحتاً درخواست شده‌اند بی‌تأثیرند.",
+ "marketLabel": "بازار",
+ "badgeDefault": "پیش‌فرض",
+ "badgeCustom": "سفارشی",
+ "customMarkets": "سفارشی · {{count}}",
+ "moveUp": "انتقال به بالا",
+ "moveDown": "انتقال به پایین",
+ "resetToDefault": "بازگردانی به پیش‌فرض",
+ "invalidOverrideWarning": "بازنویسی ذخیره‌شده برای {{envVar}} نامعتبر است (باید همان منابع را مرتب کند) — ترتیب پیش‌فرض اعمال شده است.",
+ "noMarkets": "هیچ منبع داده بازار ثبت نشده است.",
+ "howItWorksTitle": "نحوه‌ی کار",
+ "howItWorks": "برای نمادهای خودتشخیص، منابع از بالا به پایین امتحان می‌شوند؛ منبعی که شکست بخورد به بعدی می‌رسد. ذخیره بلافاصله اعمال می‌شود — نیازی به راه‌اندازی مجدد نیست.",
+ "caliberCaveat": "هشدار کالیبره: منابع در مبنا تعدیل تفاوت دارند — مثلاً Yahoo قیمت خام (تعدیل‌نشده) می‌دهد اما Tencent/Eastmoney/Tushare/BaoStock قیمت تعدیل‌شده — پس تغییر ترتیب می‌تواند اعداد بک‌تست را عوض کند.",
+ "markets": {
+ "a_share": "سهام چین (A-Share)",
+ "us_equity": "سهام آمریکا",
+ "hk_equity": "سهام هنگ‌کنگ",
+ "india_equity": "سهام هند",
+ "kr_equity": "سهام کره",
+ "ca_equity": "سهام کانادا",
+ "vietnam_equity": "سهام ویتنام",
+ "crypto": "رمزارز",
+ "futures": "آتی",
+ "fund": "صندوق‌ها",
+ "macro": "کلان",
+ "forex": "فارکس"
+ }
+ }
+ },
+ "qveris": {
+ "title": "بازار ابزار QVeris",
+ "subtitle": "داده عمومی رایگان را پیش‌فرض نگه دارید، یا اجرای پولی QVeris را برای ابزارهای داده تخصصی فعال کنید.",
+ "enabled": "فعال‌سازی مسیر پولی QVeris",
+ "baseUrl": "URL پایه",
+ "apiKey": "کلید API",
+ "apiKeyPlaceholder": "برای حفظ کلید فعلی خالی بگذارید",
+ "mode": "حالت",
+ "modeFree": "فقط داده عمومی رایگان",
+ "modePaid": "اجرای پولی QVeris فعال",
+ "budget": "اعتبار بودجه هر نشست",
+ "budgetHint": "اجرای پولی با رسیدن به بودجه این نشست متوقف می‌شود.",
+ "balance": "اعتبار باقی‌مانده",
+ "recentUsage": "مصرف اخیر",
+ "noUsage": "مصرف اخیری وجود ندارد",
+ "signupCta": "ثبت‌نام",
+ "signupHint": "هنگام ساخت حساب QVeris از این کد دعوت استفاده کنید.",
+ "inviteCode": "کد دعوت",
+ "save": "ذخیره تنظیمات QVeris",
+ "saved": "تنظیمات QVeris ذخیره شد",
+ "testFailed": "درخواست QVeris ناموفق بود",
+ "notConfigured": "پیکربندی نشده"
+ },
+ "agent": {
+ "reasoningStrength": "عمق استدلال",
+ "unknownProvider": "ارائه‌دهنده ناشناخته",
+ "unknownModel": "مدل ناشناخته",
+ "connectionLostReconnect": "اتصال قطع شد، در حال اتصال دوباره…",
+ "connectionRestored": "اتصال برقرار شد",
+ "agentWorking": "شروع به کار…",
+ "reasoning": "در حال فکر کردن…",
+ "running": "در حال اجرا",
+ "newMessages": "پیام‌های جدید",
+ "newResearchGoal": "هدف پژوهشی جدید",
+ "goal": "هدف",
+ "criteria": "معیارها",
+ "evidence": "شواهد",
+ "recentEvidence": "شواهد اخیر",
+ "continue": "ادامه",
+ "edit": "ویرایش",
+ "cancel": "لغو",
+ "save": "ذخیره",
+ "cancelGoal": "لغو هدف",
+ "describeGoal": "هدف پژوهشی پیوست‌شده به این نشست را توصیف کنید",
+ "placeholder": "مثلاً آزمون یک استراتژی ساده میانگین متحرک روی 000001.SZ در سال ۲۰۲۴",
+ "send": "ارسال پیام",
+ "messageInputLabel": "پیام به ایجنت",
+ "inputHint": "Enter برای ارسال · Shift+Enter برای خط جدید",
+ "editGoalObjectiveLabel": "ویرایش هدف پژوهشی",
+ "exportChat": "خروجی گفتگو",
+ "stopGeneration": "توقف تولید",
+ "runSwarmTeam": "اجرای تیم Swarm",
+ "uploadFile": "بارگذاری فایل",
+ "checkConnector": "بررسی کانکتور",
+ "analyzePortfolio": "تحلیل پورتفولیوی کانکتور",
+ "executionTimedOut": "اجرای بیش از حد طول کشید و به‌طور خودکار متوقف شد",
+ "researchGoalAttached": "هدف پژوهشی پیوست شد",
+ "failedToStartGoal": "شروع هدف ناموفق بود.",
+ "researchGoalCancelled": "هدف پژوهشی لغو شد",
+ "failedToCancelGoal": "لغو هدف ناموفق بود.",
+ "researchGoalUpdated": "هدف پژوهشی به‌روزرسانی شد",
+ "failedToUpdateGoal": "به‌روزرسانی هدف ناموفق بود.",
+ "failedToLoadGoal": "بارگذاری هدف ناموفق بود.",
+ "cancelRequestSent": "در حال توقف…",
+ "cancelFailed": "متوقف نشد — دوباره تلاش کنید.",
+ "connectorHalted": "ران‌تایم کانکتور متوقف شد",
+ "failedToHaltConnector": "توقف ران‌تایم کانکتور ناموفق بود.",
+ "cancelledFromUI": "از Web UI لغو شد.",
+ "executablesNotAllowed": "فایل‌های اجرایی و آرشیو مجاز نیستند",
+ "fileSizeExceeds": "اندازه فایل از سقف ۵۰ مگابایت بیشتر است",
+ "uploaded": "بارگذاری شد: {{filename}}",
+ "attachmentLimit": "می‌توانید تا {{count}} فایل پیوست کنید",
+ "dropFiles": "فایل‌ها را این‌جا رها کنید",
+ "removeAttachment": "حذف {{filename}}",
+ "uploadFailed": "بارگذاری ناموفق بود: {{error}}",
+ "failedToSend": "ارسال پیام ناموفق بود؛ لطفاً دوباره تلاش کنید.",
+ "failedToContinue": "ادامه هدف ناموفق بود؛ لطفاً دوباره تلاش کنید.",
+ "runtimeBadge": "ران‌تایم",
+ "activeResearchGoal": "هدف پژوهشی فعال",
+ "evidenceCollectedTitle": "شواهد گردآوری‌شده برای این هدف پژوهشی",
+ "evidenceCount": "{{count}} شواهد",
+ "uploading": "در حال بارگذاری…",
+ "haltConnectorTitle": "توقف فوری فعالیت ران‌تایم کانکتور",
+ "haltConnector": "توقف ران‌تایم کانکتور",
+ "moreOptions": "گزینه‌های بیشتر",
+ "researchGoal": "هدف پژوهشی",
+ "agentSwarm": "گروه ایجنت‌ها",
+ "attachmentChip": "پیوست",
+ "swarmModeChip": "حالت تیمی",
+ "goalModeChip": "هدف پژوهشی",
+ "continueGoalMessage": "ادامه هدف پژوهشی: {{goal}}",
+ "loadEarlier": "بارگذاری پیام‌های پیشین",
+ "authRequired": "دسترسی راه‌دور به API نیازمند کلید API است. آن را در تنظیمات اضافه کنید یا بک‌اند را روی localhost اجرا کنید.",
+ "followUpPlaceholder": "درباره این اجرا بپرسید — مثلاً چرا افت حساب این‌قدر عمیق است؟",
+ "continuePrompt": "از همان‌جا که متوقف شدی ادامه بده.",
+ "doneMarker": "اجرای کامل شد",
+ "backgroundRunComplete": "اجرایی در نشست دیگری به پایان رسید.",
+ "activity": {
+ "verbs": {
+ "readingMarketData": "خواندن داده بازار",
+ "writingStrategy": "نوشتن استراتژی",
+ "runningBacktest": "اجرای بک‌تست",
+ "validatingNumbers": "بازبینی اعداد",
+ "working": "در حال کار"
+ },
+ "done": "تمام شد",
+ "stopped": "توسط شما متوقف شد",
+ "timeout": "پس از {{elapsed}} منتظر ماند و متوقف شد — اجرا ممکن است هنوز در حال پایان‌یافتن باشد",
+ "failed": "ناموفق",
+ "steps": "{{count}} گام",
+ "continue": "ادامه",
+ "reattach": "اتصال دوباره"
+ },
+ "resumeConnector": "ازسرگیری کانکتور",
+ "resumeConnectorTitle": "کلید قطع را پاک کنید و فعالیت کانکتور را دوباره فعال کنید",
+ "connectorResumed": "کانکتور ازسرگیری شد",
+ "failedToResumeConnector": "ازسرگیری کانکتور ناموفق بود."
+ },
+ "runDetail": {
+ "title": "جزئیات اجرا",
+ "runNotFound": "اجرا یافت نشد",
+ "runNotFoundDesc": "پوشه اجرا ممکن است حذف شده باشد یا مرورگر شما دسترسی API نداشته باشد. اگر از راه دور دسترسی دارید، بررسی کنید کلید احراز API در تنظیمات ست شده باشد.",
+ "goBack": "بازگشت",
+ "chart": "نمودار",
+ "trades": "معاملات",
+ "factor": "پژوهش فاکتور",
+ "studio": "استودیوی پورتفولیو",
+ "riskXray": "اشعه ریسک",
+ "rebalanceNotes": "یادداشت‌های متوازن‌سازی",
+ "hhi": "HHI",
+ "effectiveN": "N مؤثر",
+ "annualizedVol": "نوسان سالانه",
+ "maxDrawdown": "بیشترین افت",
+ "symbol": "نماد",
+ "weight": "وزن",
+ "rebalanceCount": "متوازن‌سازی‌ها",
+ "turnoverMean": "میانگین گردش",
+ "turnoverMax": "حداکثر گردش",
+ "largestRebalance": "بزرگ‌ترین متوازن‌سازی",
+ "date": "تاریخ",
+ "turnover": "گردش",
+ "entries": "ورودها",
+ "exits": "خروج‌ها",
+ "validation": "اعتبارسنجی",
+ "runCard": "کارت اجرا",
+ "code": "کد",
+ "downloadTradesCsv": "دانلود CSV معاملات",
+ "downloadMetricsCsv": "دانلود CSV متریک‌ها",
+ "noChartData": "داده نموداری موجود نیست",
+ "noChartDataDesc": "این اجرا داده قیمت ذخیره نکرده، پس نموداری وجود ندارد. متریک‌های زیر همچنان معتبرند.",
+ "showOnly": "نمایش فقط",
+ "addSymbol": "افزودن نماد",
+ "loadAll": "بارگذاری همه",
+ "cancelLoad": "لغو",
+ "loadingCharts": "در حال بارگذاری داده نمودار",
+ "loadingSelectedChart": "در حال بارگذاری نمودار انتخاب‌شده…",
+ "pickSymbolToLoad": "برای بارگذاری داده نمودار یک نماد انتخاب کنید.",
+ "equityDrawdown": "ارزش حساب و افت",
+ "noTrades": "هیچ معامله‌ای ثبت نشده است.",
+ "time": "زمان",
+ "code2": "کد",
+ "side": "سمت",
+ "price": "قیمت",
+ "qty": "تعداد",
+ "reason": "علت",
+ "schema": "اسکیمای داده",
+ "generated": "تولیدشده",
+ "dataSources": "منابع داده",
+ "warnings": "هشدارها",
+ "backtestSummary": "خلاصه بک‌تست",
+ "reproducibility": "بازتولیدپذیری",
+ "metrics": "متریک‌ها",
+ "validationPayload": "اعتبارسنجی",
+ "artifactChecksums": "چک‌سام خروجی‌ها",
+ "path": "مسیر",
+ "size": "اندازه",
+ "sha256": "SHA-256",
+ "noBacktestSummary": "خلاصه بک‌تستی ثبت نشده است.",
+ "noReproducibilityHashes": "هش بازتولیدپذیری ثبت نشده است.",
+ "noScalarMetrics": "متریک عددی ثبت نشده است.",
+ "noValidationPayload": "بار اعتبارسنجی ثبت نشده است.",
+ "noArtifactChecksums": "چک‌سامی برای خروجی‌ها ثبت نشده است.",
+ "noCodeFiles": "فایلی از کد وجود ندارد.",
+ "fullReport": "گزارش کامل ←",
+ "unknown": "نامشخص",
+ "noneRecorded": "چیزی ثبت نشده",
+ "tradesCount": "{{count}} معامله",
+ "sideSummary": "خرید {{buy}} · فروش {{sell}}",
+ "totalPnl": "جمع سود و زیان",
+ "pnl": "سود و زیان",
+ "returnPct": "بازده",
+ "holdingDays": "مدت نگهداری (روز)",
+ "showMore": "نمایش {{count}} مورد بیشتر",
+ "allSymbols": "همه نمادها",
+ "sideAll": "همه",
+ "sideBuy": "خرید",
+ "sideSell": "فروش",
+ "copyCode": "کپی",
+ "codeCopied": "کد کپی شد",
+ "codeLines": "{{count}} خط",
+ "tearsheet": "برگه خلاصه",
+ "monthlyReturns": "بازده ماهانه",
+ "annualReturns": "بازده سالانه",
+ "topDrawdowns": "افت‌های بزرگ",
+ "tearsheetYear": "کل سال",
+ "noTearsheetData": "داده ارزش حساب برای برگه خلاصه کافی نیست.",
+ "ddRank": "#",
+ "ddDepth": "عمق",
+ "ddPeak": "قله",
+ "ddTrough": "کف",
+ "ddRecovery": "بازیابی",
+ "ddPeakToTrough": "قله←کف",
+ "ddTroughToRecovery": "کف←بازیابی",
+ "ddNotRecovered": "بازیابی نشده",
+ "ddDays": "{{count}} روز",
+ "dashboard": "داشبورد پژوهش",
+ "positions": {
+ "tab": "موقعیت‌ها",
+ "weightDistribution": "توزیع وزن",
+ "sectorDistribution": "توزیع صنعت",
+ "weightEvolution": "تحول وزن",
+ "pie": "دایره‌ای",
+ "treemap": "درختی",
+ "cash": "نقدی",
+ "rest": "سایر",
+ "restLong": "سایر (خرید)",
+ "restShort": "سایر (فروش)",
+ "basisGross": "برش‌ها بر مبنای |وزن| (مارجین ÷ ارزش خالص) هستند؛ نقدی باقیمانده تعهدنشده است و هنگام تعهد کامل یا اهرم حذف می‌شود.",
+ "basisNet": "بهره‌گیری خالص: وزن علامت‌دار ÷ ارزش خالص. مقادیر منفی یعنی خالص فروش.",
+ "short": "فروش",
+ "resolveIndustries": "تشخیص صنعت‌ها",
+ "resolving": "در حال تشخیص…",
+ "resolveFailed": "تشخیص صنعت‌ها ناموفق بود",
+ "retry": "تلاش دوباره",
+ "asOf": "تا {{date}}",
+ "noPositions": "برای این اجرا وزن موقعیتی ثبت نشده است.",
+ "holdingsCount": "{{count}} دارایی",
+ "assetClass": {
+ "a_share": "سهام A",
+ "us_equity": "سهام آمریکا",
+ "hk_equity": "سهام هنگ‌کنگ",
+ "ca_equity": "سهام کانادا",
+ "kr_equity": "سهام کره",
+ "india_equity": "سهام هند",
+ "crypto": "رمزارز",
+ "futures": "آینده",
+ "forex": "فارکس",
+ "other": "سایر"
+ }
+ },
+ "attribution": "تفکیک بازده",
+ "attrBenchmark": "بنچمارک",
+ "attrPortfolio": "پورتفولیو",
+ "attrActive": "فعال",
+ "attrAutoEqualWeight": "وزن برابر خودکار",
+ "attrNoBenchmark": "بنچمارکی پیکربندی نشده است",
+ "attrModeSymbol": "حالت برینسون: نماد",
+ "attrModeAssetClass": "حالت برینسون: کلاس دارایی",
+ "attrModeInvestedCash": "حالت برینسون: نقدی سرمایه‌گذاری‌شده",
+ "attrSector": "بخش",
+ "attrPortfolioWeight": "وزن پورتفولیو",
+ "attrBenchmarkWeight": "وزن بنچمارک",
+ "attrPortfolioReturn": "بازده پورتفولیو",
+ "attrBenchmarkReturn": "بازده بنچمارک",
+ "attrAllocation": "تخصیص",
+ "attrSelection": "گزینش",
+ "attrInteraction": "برهم‌کنش",
+ "attrTotal": "جمع",
+ "attrBrinsonTitle": "تفکیک برینسون",
+ "attrWaterfallTitle": "آبشار بازده",
+ "attrNoBrinson": "تفکیک برینسون برای این اجرا موجود نیست.",
+ "attrAlpha": "آلفا (سالانه)",
+ "attrBeta": "بتا",
+ "attrTStat": "t-stat: {{value}}",
+ "attrRSquared": "R²",
+ "attrInformationRatio": "نسبت اطلاعاتی",
+ "attrTrackingError": "خطای ردیابی",
+ "attrNoFactor": "تفکیک فاکتوری برای این اجرا موجود نیست.",
+ "attrRollingTitle": "بتا و آلفای غلتان",
+ "attrRollingWindow": "پنجره غلتان {{count}} کندلی",
+ "attrCumulativeTitle": "بازده تجمعی",
+ "attrLoading": "در حال بارگذاری تفکیک…",
+ "attrError": "بارگذاری تفکیک ناموفق بود.",
+ "attrNoData": "برای این اجرا داده تفکیکی موجود نیست."
+ },
+ "compare": {
+ "title": "مقایسه استراتژی‌ها",
+ "baseline": "پایه",
+ "compare": "مقایسه",
+ "select": "-- انتخاب --",
+ "equityDrawdown": "ارزش حساب و افت",
+ "metric": "متریک",
+ "baselineCol": "پایه",
+ "compareCol": "مقایسه",
+ "delta": "اختلاف",
+ "selectTwoRuns": "برای مقایسه متریک‌ها دو اجرا انتخاب کنید.",
+ "loadError": "بارگذاری داده اجرا ناموفق بود. دوباره تلاش کنید.",
+ "totalReturn": "بازده کل",
+ "annualizedReturn": "بازده سالانه",
+ "sharpeRatio": "نسبت شارپ",
+ "calmarRatio": "نسبت کالمار",
+ "sortinoRatio": "نسبت سورتینو",
+ "maxDrawdown": "بیشترین افت",
+ "volatility": "نوسان",
+ "winRate": "نرخ برد",
+ "profitFactor": "فاکتور سود",
+ "avgWin": "میانگین سود",
+ "avgLoss": "میانگین زیان",
+ "trades": "معاملات",
+ "maxConsecLosses": "حداکثر زیان‌های پیاپی",
+ "exposureTime": "زمان در معرض",
+ "avgHoldingPeriod": "میانگین دوره نگهداری",
+ "better": "بهتر",
+ "worse": "بدتر",
+ "equityOverlay": "منحنی‌های ارزش حساب",
+ "rebasedMode": "تنظیم‌شده = ۱۰۰",
+ "rawMode": "خام",
+ "swapRuns": "جابه‌جایی"
+ },
+ "correlation": {
+ "title": "ماتریس همبستگی",
+ "assetCodes": "نمادهای دارایی",
+ "assetCodesHint": "نمادهای جدا با ویرگول، مثلاً 000001.SZ,600519.SH,000858.SZ",
+ "windowDays": "پنجره (روز)",
+ "method": "روش",
+ "method_pearson": "پیرسون",
+ "method_spearman": "اسپیرمن",
+ "compute": "محاسبه",
+ "loading": "در حال محاسبه…",
+ "failedToCompute": "محاسبه همبستگی ناموفق بود",
+ "regimeTimeline": "خط زمانی رژیم",
+ "regimeTimelineHint": "چگالی یال + پس‌ماند در طول زمان — زمینه توصیفی ریسک، نه سیگنال معاملاتی",
+ "regimeDensity": "چگالی یال",
+ "regimeSmoothed": "هموارشده",
+ "regimeFused": "ترکیبی",
+ "regimeEnterThreshold": "ورود",
+ "regimeExitThreshold": "خروج"
+ },
+ "options": {
+ "title": "آزمایشگاه آپشن",
+ "subtitle": "سازنده استراتژی، بازده سررسید، ماتریس سناریوی قیمت×IV، گریک‌های پورتفولیو و زنجیره زنده آپشن آمریکا.",
+ "disclaimer": "فقط پژوهشی. قیمت‌گذاری نظری و خروجی سناریوها برآورد مدل‌اند، نه توصیه سرمایه‌گذاری.",
+ "errorGeneric": "تحلیل ناموفق بود",
+ "presets": {
+ "label": "پرست‌ها",
+ "longCall": "کال خرید",
+ "longPut": "پوت خرید",
+ "bullCallSpread": "اسپرد کال صعودی",
+ "bearPutSpread": "اسپرد پوت نزولی",
+ "bullPutSpread": "اسپرد پوت صعودی",
+ "bearCallSpread": "اسپرد کال نزولی",
+ "longStraddle": "استردل خرید",
+ "longStrangle": "استرنگل خرید",
+ "ironCondor": "آیرون کاندور",
+ "ironButterfly": "آیرون باترفلای",
+ "callButterfly": "باترفلای کال",
+ "ratioCallSpread": "اسپرد کال نسبتی"
+ },
+ "builder": {
+ "title": "سازنده استراتژی",
+ "legs": "پایه‌ها",
+ "type": "نوع",
+ "call": "کال",
+ "put": "پوت",
+ "strike": "قیمت اعمال",
+ "qty": "تعداد",
+ "premium": "پریمیوم",
+ "premiumHint": "پریمیوم خالی = قیمت‌گذاری بلک-شولز توسط موتور",
+ "qtyHint": "مثبت = خرید، منفی = فروش",
+ "addLeg": "افزودن پایه",
+ "removeLeg": "حذف پایه",
+ "parameters": "پارامترها",
+ "entrySpot": "نقطه ورود",
+ "expiryDays": "روز تا سررسید",
+ "volatility": "نوسان (٪)",
+ "riskFreeRate": "نرخ بدون ریسک (٪)",
+ "multiplier": "ضریب",
+ "multiplierHint": "۱۰۰ = قرارداد استاندارد سهام آمریکا",
+ "commissionRate": "نرخ کارمزد (٪)",
+ "invalidHint": "ورودی‌ها را بررسی کنید: نقطه و قیمت اعمال مثبت، تعداد صحیح غیرصفر، نوسان مثبت.",
+ "analyzing": "در حال تحلیل…"
+ },
+ "metrics": {
+ "entryCost": "هزینه ورود",
+ "debit": "بدهکار",
+ "credit": "بستانکار",
+ "flat": "صفر",
+ "breakevens": "نقاط سر‌به‌سر",
+ "maxProfit": "حداکثر سود",
+ "maxLoss": "حداکثر زیان",
+ "unlimited": "نامحدود",
+ "none": "هیچ"
+ },
+ "payoff": {
+ "title": "بازده در سررسید",
+ "pnl": "سود و زیان",
+ "spot": "قیمت نقدی در سررسید",
+ "entrySpot": "نقطه",
+ "breakeven": "سر‌به‌سر",
+ "noData": "داده بازدهی نیست — ابتدا استراتژی بسازید."
+ },
+ "greeks": {
+ "title": "گریک‌های پورتفولیو",
+ "delta": "دلتا",
+ "deltaDesc": "بهره‌گیری جهت‌دار، برحسب سهم معادل دارایی پایه.",
+ "gamma": "گاما",
+ "gammaDesc": "میزان تغییر دلتا به ازای هر ۱ دلار جابه‌جایی دارایی پایه.",
+ "theta": "تتا",
+ "thetaDesc": "استهلاک زمانی روزانه به دلار. منفی یعنی موقعیت هر روز ارزش از دست می‌دهد.",
+ "vega": "وگا",
+ "vegaDesc": "سود و زیان دلاری برای حرکت +۱٪ نوسان ضمنی.",
+ "rho": "رو",
+ "rhoDesc": "سود و زیان دلاری برای حرکت +۱٪ نرخ بهره."
+ },
+ "scenario": {
+ "title": "ماتریس سناریوی قیمت × نوسان ضمنی",
+ "spotAxis": "قیمت نقدی در سررسید",
+ "ivAxis": "نوسان ضمنی",
+ "pnl": "سود و زیان",
+ "noData": "شبکه سناریویی برنگشت."
+ },
+ "chain": {
+ "title": "زنجیره آپشن آمریکا",
+ "ticker": "نماد",
+ "expiration": "سررسید",
+ "load": "بارگذاری",
+ "loading": "در حال بارگذاری زنجیره…",
+ "calls": "کال‌ها",
+ "puts": "پوت‌ها",
+ "strike": "قیمت اعمال",
+ "last": "آخرین",
+ "bid": "خرید",
+ "ask": "فروش",
+ "spread": "اسپرد٪",
+ "volume": "حجم",
+ "openInterest": "باز",
+ "iv": "IV٪",
+ "itm": "سودده",
+ "atm": "برابر",
+ "noData": "برای این انتخاب قراردادی برنگشت.",
+ "errorTitle": "زنجیره آپشن در دسترس نیست",
+ "retry": "تلاش دوباره"
+ }
+ },
+ "alphaZoo": {
+ "title": "آلفا زو",
+ "prebuiltAlpha": "{{count}} آلفای کمّی آماده در ۵ خانواده",
+ "prebuiltAlphaLoading": "آلفاهای کمّی آماده در ۵ خانواده",
+ "browseDesc": "سیگنال‌های مقطعی فرمول‌محور از Qlib، مجموعه ۱۰۱ کاکوشادزه، GTJA 191، ادبیات ناهنجاری‌های دانشگاهی و بنیادی‌های PIT-safe را مرور کنید. روی هر آلفا کلیک کنید تا فرمول و کد منبعش را ببینید، یا بنچ بگیرید تا کل زو را روی یک جهان و دوره امتیازدهید.",
+ "search": "جستجو",
+ "searchPlaceholder": "فیلتر بر اساس شناسه یا لقب…",
+ "zoo": "زو",
+ "allZoos": "همه زوها",
+ "theme": "تم",
+ "allThemes": "همه تم‌ها",
+ "universe": "جهان",
+ "allUniverses": "همه جهان‌ها",
+ "compare": "مقایسه",
+ "runBenchmark": "اجرای بنچمارک",
+ "decayDays": "کاهش (روز)",
+ "selectForCompare": "انتخاب برای مقایسه",
+ "loadingAlphas": "در حال بارگذاری آلفاها…",
+ "noAlphasMatch": "هیچ آلفایی با فیلترهای فعلی مطابقت ندارد.",
+ "showingOf": "نمایش {{visible}} از {{total}}",
+ "loadMore": "بارگذاری بیشتر",
+ "backToAlphaZoo": "بازگشت به آلفا زو",
+ "couldNotLoad": "بارگذاری آلفا ممکن نشد",
+ "unknownError": "خطای ناشناخته",
+ "formula": "فرمول",
+ "noFormula": "(فرمولی ارائه نشده)",
+ "metadata": "فراداده",
+ "themeKey": "تم",
+ "frequency": "بسامد",
+ "decayHorizon": "افق کاهش",
+ "minWarmupBars": "حداقل کندل گرم‌سازی",
+ "requiresSector": "نیازمند بخش",
+ "modulePath": "مسیر ماژول",
+ "notes": "یادداشت‌ها",
+ "sourceCode": "کد منبع",
+ "viewSource": "مشاهده کد ({{lines}} خط)",
+ "noSource": "(کدی موجود نیست)",
+ "benchRunner": "اجرای بنچ",
+ "scoreZoo": "امتیازدهی یک زو روی یک جهان",
+ "scoreDesc": "IC / IR هر آلفای زوی انتخابی را روی جهان و دوره انتخابی محاسبه و سپس به زنده / وارون‌شده / مرده دسته‌بندی می‌کند.",
+ "period": "دوره",
+ "top": "برترین‌ها",
+ "running": "در حال اجرا…",
+ "submitting": "در حال ارسال…",
+ "computing": "در حال محاسبه: {{id}}",
+ "alive": "زنده",
+ "reversed": "وارون‌شده",
+ "dead": "مرده",
+ "skipped": "ردشده",
+ "topByIr": "۵ برتر بر اساس IR",
+ "mostReversed": "بیشترین وارون‌شده",
+ "byTheme": "بر اساس تم",
+ "noRows": "ردیفی وجود ندارد.",
+ "meanIc": "میانگین IC",
+ "ir": "IR",
+ "category": "دسته",
+ "headToHeadCompare": "مقایسه رو‌در‌رو",
+ "compareAlphas": "مقایسه آلفاها کنار هم",
+ "compareDesc": "فقط آلفاهای انتخابی شما را روی یک جهان و دوره بنچ می‌گیرد و بر اساس IC / IR با فاصله تا پیشتاز رتبه‌بندی می‌کند — وقتی فقط فهرست کوتاهی مدنظر دارید، بسیار سریع‌تر از بنچ کل زو است.",
+ "alphaIds": "شناسه آلفاها",
+ "selected": "{{count}} انتخاب‌شده",
+ "alphaIdsHint": "شناسه‌ها را با ویرگول یا فاصله جدا کنید. نکته: در کاتالوگ آلفاها را تیک بزنید و «مقایسه» را بزنید تا این‌جا پیش‌پر شود.",
+ "rankBy": "رتبه‌بندی بر اساس",
+ "pickAtLeast2": "حداقل ۲ آلفا انتخاب کنید.",
+ "enterAtLeast2": "برای مقایسه حداقل ۲ شناسه آلفای متمایز وارد کنید.",
+ "winner": "برنده",
+ "compared": "مقایسه‌شده",
+ "rankedBy": "رتبه‌بندی‌شده بر اساس",
+ "icMean": "میانگین IC",
+ "icStd": "انحراف معیار IC",
+ "icPositive": "IC>0",
+ "icPositiveTitle": "سهم دوره‌های با IC مثبت",
+ "sampleCount": "n",
+ "sampleCountTitle": "تعداد نمونه IC",
+ "noBenchmarkMatch": "بدون بنچمارک مطابق",
+ "alphaCatalogue": "کاتالوگ آلفا",
+ "predictiveHalfLifeTitle": "نیم‌عمر پیش‌بینی: تعداد روز معاملاتی تا کاهش قدرت سیگنال",
+ "id": "شناسه",
+ "icSampleCount": "تعداد نمونه IC",
+ "alpha": "آلفا",
+ "alphaComparisonRanking": "رتبه‌بندی مقایسه آلفاها",
+ "skippedPre": "ردشده:",
+ "zooCardTitle": {
+ "qlib158": "Qlib 158",
+ "alpha101": "۱۰۱ آلفای فرمولی کاکوشادزه",
+ "gtja191": "GTJA 191",
+ "academic": "ناهنجاری‌های دانشگاهی",
+ "fundamental": "بنیادی‌های PIT-safe"
+ },
+ "zooCardDesc": {
+ "qlib158": "کتابخانه کامل ۱۵۸ ویژگی مایکروسافت Qlib شامل سیگنال‌های مومنتوم، نوسان، حجم و آماری غلتان.",
+ "alpha101": "۱۰۱ آلفای فرمولی کاکوشادزه (۲۰۱۵)؛ سیگنال‌های مقطعی افق کوتاه.",
+ "gtja191": "۱۹۱ آلفای شرکت اوراق بهادار گووتای جون‌آن؛ سیگنال‌های تکنیکال و ریزساختاری متناسب با بازار سهام A چین.",
+ "academic": "ناهنجاری‌های افق بلند گزینش‌شده از ادبیات دانشگاهی (ارزش، مومنتوم، کیفیت، کم‌نوسان و…).",
+ "fundamental": "فاکتورهای کیفیت و ارزش محاسبه‌شده از ارقام شرکت‌های SEC با مبنای PIT-safe — بازده سود، ROE، سودآوری ناخالص، رشد دارایی (لنگر بر تاریخ ثبت)."
+ },
+ "universeOption": {
+ "csi300": "CSI 300 (سهام A چین)",
+ "sp500": "S&P 500 (آمریکا)",
+ "btc-usdt": "BTC-USDT (رمزارز)",
+ "equity_cn": "سهام A چین",
+ "equity_us": "سهام آمریکا",
+ "equity_hk": "سهام هنگ‌کنگ",
+ "equity_in": "سهام هند",
+ "equity_kr": "سهام کره",
+ "crypto": "رمزارز",
+ "futures": "آینده"
+ },
+ "themes": {
+ "momentum": "مومنتوم",
+ "reversal": "بازگشت",
+ "volume": "حجم",
+ "volatility": "نوسان",
+ "quality": "کیفیت",
+ "value": "ارزش",
+ "liquidity": "نقدشوندگی",
+ "microstructure": "ریزساختار",
+ "sentiment": "احساس بازار",
+ "growth": "رشد",
+ "leverage": "اهرم"
+ },
+ "compareTooltip": "۲ آلفا یا بیشتر را زیر تیک بزنید، سپس رو‌در‌رو مقایسه کنید",
+ "loadingAlpha": "در حال بارگذاری {{id}}…",
+ "comparedRankedBy": "{{count}} مقایسه‌شده · رتبه‌بندی بر اساس {{sort}} · {{universe}} · {{period}}",
+ "skippedCount": "{{count}} ردشده",
+ "gapTitle": "فاصله تا پیشتاز بر اساس {{sort}}",
+ "sortOption": {
+ "ir": "IR (نسبت اطلاعاتی)",
+ "icMean": "میانگین IC",
+ "icPositiveRatio": "نسبت IC > 0",
+ "icCount": "تعداد نمونه"
+ },
+ "failedToLoadAlphas": "بارگذاری آلفاها ناموفق بود",
+ "selectAlphaForCompare": "انتخاب {{id}} برای مقایسه",
+ "failedToLoadAlpha": "بارگذاری آلفا ناموفق بود",
+ "failedToStartBench": "شروع بنچ ناموفق بود",
+ "singleAssetHint": "{{message}} برای IC مقطعی معنادار `sp500` یا `csi300` را امتحان کنید.",
+ "benchStreamError": "خطای جریان بنچ",
+ "job": "کار {{id}}…",
+ "compareStreamError": "خطای جریان مقایسه",
+ "failedToStartComparison": "شروع مقایسه ناموفق بود"
+ },
+ "validation": {
+ "noData": "داده اعتبارسنجی موجود نیست.",
+ "monteCarlo": "آزمون جایگشت مونت‌کارلو",
+ "significant": "معنادار",
+ "notSignificant": "معنادار نیست",
+ "monteCarloDesc": "ترتیب معاملات {{n}} بار به‌هم‌ریخته شد تا بررسی شود آیا شارپ بهتر از تصادفی است.",
+ "actualSharpe": "شارپ واقعی",
+ "pValueSharpe": "مقدار p (شارپ)",
+ "simulatedMean": "میانگین شبیه‌سازی‌شده",
+ "simulatedRange": "بازه ۹۰٪ شبیه‌سازی‌شده",
+ "bootstrap": "بازه اطمینان بوت‌استرپ شارپ",
+ "ciAbove0": "بازه بالای ۰",
+ "ciIncludes0": "بازه شامل ۰",
+ "bootstrapDesc": "بازده‌های روزانه {{n}} بار بازنمونه‌گیری شد تا بازه اطمینان {{pct}} برآورد شود.",
+ "observedSharpe": "شارپ مشاهده‌شده",
+ "ci": "بازه {{pct}}",
+ "medianSharpe": "شارپ میانه",
+ "probSharpePositive": "P(شارپ > 0)",
+ "walkForward": "تحلیل گام‌به‌جلوی (Walk-Forward)",
+ "profitable": "{{profitable}}/{{total}} سودده",
+ "walkForwardDesc": "به {{n}} پنجره متوالی تقسیم شد تا ثبات عملکرد بررسی شود.",
+ "consistency": "ثبات",
+ "avgReturn": "میانگین بازده",
+ "avgSharpe": "میانگین شارپ",
+ "windows": "پنجره‌ها",
+ "period2": "دوره",
+ "return": "بازده",
+ "maxDd": "حداکثر افت",
+ "winRate": "نرخ برد",
+ "pathsTitle": "مسیرهای شبیه‌سازی‌شده ارزش حساب",
+ "sharpeDist": "توزیع شارپ",
+ "actualLabel": "واقعی",
+ "medianLabel": "میانه",
+ "windowReturns": "بازده هر پنجره",
+ "tradeNumber": "معامله #"
+ },
+ "thinking": {
+ "processing": "در حال پردازش",
+ "running": "در حال اجرا",
+ "done": "تمام شد",
+ "steps": "{{count}} گام"
+ },
+ "runnerStatus": {
+ "connectorRuntime": "ران‌تایم کانکتور",
+ "configuredProfiles": "پروفایل‌های پیکربندی‌شده ران‌تایم کانکتور",
+ "connected": "{{count}} متصل",
+ "noConnector": "کانکتوری متصل نیست",
+ "running": "در حال اجرا",
+ "halted": "متوقف‌شده",
+ "authorized": "مجاز‌شده",
+ "sdkConnected": "متصل",
+ "sdkReadOnlyNote": "کانکتور مستقیم SDK · پروفایل فقط‌خواندنی. معامله زنده نیازمند پروفایل معاملاتی و ماندیت مصوب است.",
+ "sdkCredentialsRequired": "اعتبارنامه API این کانکتور را پیکربندی کنید (راهنما در ران‌تایم).",
+ "sdkConnectionError": "بررسی اتصال ناموفق بود. اعتبارنامه‌ها را در صفحه ران‌تایم تأیید کنید.",
+ "notConnected": "متصل نیست",
+ "connectProfile": "این پروفایل را متصل کنید تا ران‌تایم کانکتور فعال شود",
+ "authorizeNote": "کانال کانکتور تا موفق‌شدن OAuth و ثبت ماندیت فقط‌خواندنی می‌ماند.",
+ "runner": "رانر",
+ "runnerRunning": "در حال اجرا",
+ "runnerStopped": "متوقف",
+ "lastTick": "آخرین تیک",
+ "activeMandate": "ماندیت فعال",
+ "expiresIn": "انقضا تا {{time}}",
+ "expired": "منقضی‌شده",
+ "limitsUnavailable": "محدودیت‌ها در دسترس نیست",
+ "noActiveMandate": "ماندیتی فعال نیست. از ایجنت بخواهید پیشنهاد بدهد، سپس پیش از راه‌اندازی ران‌تایم کانکتور آن را مصوب کنید.",
+ "haltedControlsDisabled": "متوقف‌شده — کنترل‌های رانر غیرفعال‌اند",
+ "runtimeActive": "ران‌تایم درون ماندیت فعال است",
+ "idle": "بیکار",
+ "stopRunner": "توقف رانر",
+ "startRunner": "راه‌اندازی رانر",
+ "never": "هرگز",
+ "unknown": "نامشخص",
+ "justNow": "همین حالا",
+ "loadingInstructions": "در حال بارگذاری دستورالعمل‌های مجوز کانکتور…",
+ "fallbackInstruction": "اجرای `vibe-trading connector list`، انتخاب پروفایل کارگزار، سپس اجرای `vibe-trading connector authorize <profile>` از نشست دسکتاپی که اتصال کارگزار را نگه می‌دارد.",
+ "secondsAgo": "{{n}} ثانیه پیش",
+ "minutesAgo": "{{n}} دقیقه پیش",
+ "hoursAgo": "{{n}} ساعت پیش",
+ "daysAgo": "{{n}} روز پیش",
+ "runnerStartedFor": "رانر برای {{broker}} راه‌اندازی شد",
+ "runnerStoppedFor": "رانر برای {{broker}} متوقف شد",
+ "runnerControlFailed": "کنترل رانر ناموفق بود.",
+ "startRunnerTitle": "راه‌اندازی رانر پایدار",
+ "stopRunnerTitle": "توقف رانر پایدار",
+ "expiresAt": "انقضا در {{time}}"
+ },
+ "swarmStatus": {
+ "agents": "{{done}}/{{total}} ایجنت",
+ "layer": "دور {{current}} از {{total}}",
+ "agent": "ایجنت",
+ "status": "وضعیت",
+ "tool": "ابزار",
+ "time": "زمان",
+ "iters": "دورها",
+ "output": "خروجی",
+ "waitingForEvents": "در انتظار رویدادهای ایجنت…",
+ "teamStarting": "تیم در حال آماده‌سازی است — اولین به‌روزرسانی‌ها در چند ثانیه…",
+ "detailsUnavailable": "جزئیات در دسترس نیست"
+ },
+ "mandate": {
+ "runtimeMandate": "ماندیت ران‌تایم کانکتور",
+ "reauthMandate": "تجدید مجوز ماندیت کانکتور",
+ "universe": "جهان",
+ "maxOrder": "حداکثر سفارش",
+ "dailyCap": "سقف روزانه",
+ "leverage": "اهرم",
+ "instruments": "ابزارها",
+ "adjust": "تنظیم",
+ "committing": "در حال مصوب‌سازی…",
+ "commit": "مصوب‌سازی \"{{label}}\"",
+ "cancel": "لغو",
+ "sendAdjustment": "ارسال تنظیم",
+ "mandateActive": "ماندیت {{id}} فعال است",
+ "fundedBy": "تأمین‌شده توسط",
+ "noBroker": "مصوب‌سازی ماندیت ممکن نیست: کارگزار کانکتور موجود نیست. از ایجنت بخواهید پیشنهاد را دوباره بسازد.",
+ "failedToCommit": "مصوب‌سازی ماندیت ناموفق بود.",
+ "noLeverage": "بدون اهرم",
+ "leverageValue": "{{value}} برابر اهرم",
+ "tradesPerDay": "{{count}} معامله در روز",
+ "adjustTitle": "تنظیم این ماندیت",
+ "adjustPlaceholder": "مثلاً همین بماند اما سقف روزانه به ۱۰ برسد",
+ "adjustInputLabel": "درخواست تنظیم",
+ "confirmTitle": "تأیید مصوب‌سازی ماندیت",
+ "confirmDescription": "این کار به ایجنت مجوز معامله در محدوده محدودیت‌های زیر را می‌دهد و بلافاصله اعمال می‌شود.",
+ "confirmButton": "تأیید و مصوب‌سازی",
+ "maxPerOrder": "≤{{amount}}/سفارش",
+ "expiresOn": "انقضا {{date}}",
+ "accountSummary": "{{broker}} · حساب {{type}} · تأمین‌شده توسط {{fundedBy}}",
+ "adjustRequestMessage": "برای پیشنهاد ماندیت \"{{label}}\" (گزینه {{ordinal}}): {{text}}"
+ },
+ "messageBubble": {
+ "elapsedTime": "کل زمان پاسخ",
+ "copied": "کپی شد",
+ "copy": "کپی",
+ "copyFailed": "کپی ناموفق بود. متن را انتخاب و Ctrl+C بزنید.",
+ "timeoutHint": "مهلت تمام شد. استراتژی را ساده‌تر کنید یا دارایی کمتری استفاده کنید.",
+ "apiFailedHint": "درخواست API ناموفق بود. اندکی بعد دوباره تلاش کنید.",
+ "executionFailedHint": "اجرا ناموفق بود. دوباره تلاش کنید.",
+ "retry": "تلاش دوباره"
+ },
+ "pineViewer": {
+ "pineScript": "Pine Script v6",
+ "copied": "کپی شد",
+ "copy": "کپی",
+ "docs": "مستندات",
+ "footer": "Pine Editor در تریدینگ‌ویو ← اندیکاتور خالی جدید ← کد را بچسبانید ← به چارت اضافه کنید"
+ },
+ "runComplete": {
+ "fullReport": "گزارش کامل ←",
+ "pineScript": "Pine Script",
+ "shadowReport": "گزارش سایه"
+ },
+ "home": {
+ "title": "پژوهش استراتژی کمّی با هوش مصنوعی",
+ "subtitle": "استراتژی معاملاتی را با زبان طبیعی توصیف کنید. ایجنت کد می‌سازد، بک‌تست می‌گیرد و بهینه می‌کند — همه در لحظه.",
+ "startResearch": "شروع پژوهش",
+ "featureAgent": "ایجنت هوش مصنوعی",
+ "featureAgentDesc": "تولید استراتژی با زبان طبیعی و استدلال ReAct",
+ "featureBacktest": "بک‌تست داخلی",
+ "featureBacktestDesc": "منابع داده متعدد پوشش‌دهنده تحلیل کمّی سهام A",
+ "featureStreaming": "پخش زنده",
+ "featureStreamingDesc": "فکر کردن، فراخوانی ابزار و تکرار ایجنت را ببینید",
+ "featureReplay": "بازپخش استراتژی",
+ "featureReplayDesc": "تحلیلگر دفتر معاملات + حساب سایه — قواعد شما را استخراج، بک‌تست و اختلاف سود و زیان را تفکیک می‌کند",
+ "howItWorksTitle": "چگونه کار می‌کند",
+ "step1Title": "۱. استراتژی خود را توصیف کنید",
+ "step1Desc": "با زبان ساده به ایجنت بگویید چه چیزی را می‌خواهید آزمایش کنید — بدون نیاز به کد.",
+ "step2Title": "۲. پژوهش و بک‌تست را تماشا کنید",
+ "step2Desc": "ایجنت برنامه می‌ریزد، داده بازار می‌کشد و بک‌تست را زنده اجرا می‌کند تا هر گام را دنبال کنید.",
+ "step3Title": "۳. نتایج را بررسی کنید",
+ "step3Desc": "متریک‌های عملکرد، منحنی ارزش حساب و Pine Script قابل‌خروجی استراتژی را ببینید.",
+ "step4Title": "۴. هر وقت آماده بودید واقعی شوید",
+ "step4Desc": "در صورت تمایل یک ماندیت معاملاتی با محدودیت‌های صریح مصوب کنید — بدون تأیید شما هیچ معامله‌ای انجام نمی‌شود."
+ },
+ "errorBoundary": {
+ "somethingWrong": "خطایی رخ داد. برای ادامه صفحه را بازخوانی کنید."
+ },
+ "toolProgress": {
+ "step": "گام {{step}} · {{tool}}",
+ "toolsRunning": "روی {{count}} کار به‌طور هم‌زمان کار می‌کند",
+ "toolsCompleted": "{{count}} گام تمام شد",
+ "more": "… +{{count}} بیشتر",
+ "etaSeconds": "~{{seconds}} ثانیه مانده",
+ "earlier": "+{{count}} پیش‌تر"
+ },
+ "swarm": {
+ "assemblingTeam": "در حال تشکیل تیم…",
+ "preparingLayers": "در حال تعیین ترتیب…",
+ "agentProgress": "پیشرفت ایجنت‌های گروه",
+ "status": {
+ "waiting": "در انتظار",
+ "running": "در حال اجرا",
+ "done": "تمام‌شده",
+ "failed": "ناموفق",
+ "blocked": "مسدود",
+ "retry": "در حال تلاش دوباره",
+ "cancelled": "لغوشده",
+ "pending": "در انتظار",
+ "completed": "کامل‌شده",
+ "unknown": "نامشخص"
+ },
+ "elapsed": {
+ "seconds": "{{value}} ثانیه",
+ "minutesSeconds": "{{minutes}} دقیقه {{seconds}} ثانیه"
+ },
+ "presets": {
+ "investment_committee": "بررسی کمیته سرمایه‌گذاری",
+ "quant_strategy_desk": "میز استراتژی کمّی",
+ "value_investing_committee": "کمیته سرمایه‌گذاری ارزشی"
+ }
+ },
+ "metrics": {
+ "good": "خوب",
+ "poor": "ضعیف",
+ "gloss": {
+ "total_return": "میزان سود یا زیان استراتژی در کل دوره آزمون.",
+ "annual_return": "بازده استراتژی مقیاس‌شده به یک دوره یک‌ساله معمول.",
+ "sharpe": "بازده کسب‌شده به ازای واحد ریسک کل؛ بالاتر معمولاً بهتر است.",
+ "max_drawdown": "بزرگ‌ترین زیان از قله تا کف در طول دوره آزمون.",
+ "win_rate": "سهم معاملات تکمیل‌شده‌ای که سودده بوده‌اند.",
+ "trade_count": "تعداد معاملات انجام‌شده در دوره آزمون.",
+ "calmar": "بازده سالانه تقسیم بر بیشترین افت؛ توازن رشد و بدترین زیان.",
+ "sortino": "بازده کسب‌شده به ازای واحد ریسک نزولی؛ بالاتر معمولاً بهتر است.",
+ "profit_loss_ratio": "میانگین معامله سودده در مقایسه با میانگین معامله زیان‌ده.",
+ "max_consecutive_loss": "بلندترین رشته زیان‌های پیاپی.",
+ "benchmark_return": "بازده بنچمارک مقایسه در همان دوره.",
+ "excess_return": "میزان بهتر یا بدتربودن استراتژی نسبت به بنچمارک.",
+ "information_ratio": "بازده مازاد کسب‌شده به ازای واحد خطای ردیابی نسبت به بنچمارک.",
+ "final_value": "ارزش پورتفولیو در پایان دوره آزمون.",
+ "avg_holding_days": "میانگین تعداد روزهای بازماندن هر موقعیت."
+ }
+ },
+ "tools": {
+ "add_goal_evidence": "افزودن شواهد هدف",
+ "alpha_bench": "بنچمارک فاکتورهای آلفا",
+ "alpha_compare": "مقایسه فاکتورهای آلفا",
+ "alpha_zoo": "مرور کتابخانه آلفا",
+ "analyze_image": "تحلیل تصویر",
+ "analyze_trade_journal": "تحلیل دفتر معاملات",
+ "background_run": "شروع کار پس‌زمینه",
+ "backtest": "اجرای بک‌تست",
+ "bash": "اجرای دستور",
+ "cancel_background": "لغو کار پس‌زمینه",
+ "check_background": "بررسی کار پس‌زمینه",
+ "compact": "خلاصه‌سازی گفتگو",
+ "create_hypothesis": "ایجاد فرضیه پژوهشی",
+ "delete_skill": "حذف مهارت سفارشی",
+ "edit_file": "ویرایش کد",
+ "extract_shadow_strategy": "استخراج استراتژی سایه",
+ "factor_analysis": "تحلیل فاکتورها",
+ "financial_rigor": "راستی‌آزمایی تحلیل مالی",
+ "generate_backtest_config": "تولید پیکربندی بک‌تست",
+ "get_block_trades": "دریافت معاملات عمده",
+ "get_dragon_tiger": "دریافت فهرست اژدها-ببر",
+ "get_financial_statements": "دریافت صورت‌های مالی",
+ "get_fund_flow": "دریافت جریان صندوق",
+ "get_fundamentals": "دریافت بنیادها",
+ "get_lockup_expiry": "دریافت انقضای قفل سهام",
+ "get_macro_series": "دریافت سری‌های کلان",
+ "get_margin_trading": "دریافت معاملات مارجین",
+ "get_market_data": "دریافت داده بازار",
+ "get_northbound_flow": "دریافت جریان شمال‌مقصد",
+ "get_options_chain": "دریافت زنجیره آپشن",
+ "get_research_goal": "مشاهده هدف پژوهشی",
+ "get_research_reports": "دریافت گزارش‌های پژوهشی",
+ "get_sec_filings": "دریافت پرونده‌های SEC",
+ "get_sector_info": "دریافت داده بخش",
+ "get_shareholder_count": "دریافت تعداد سهامداران",
+ "get_stock_news": "دریافت اخبار سهم",
+ "get_stock_profile": "دریافت پروفایل سهم",
+ "iwencai_search": "جستجوی iWenCai",
+ "link_autopilot_backtest": "پیوند بک‌تست اتوپایلوت",
+ "link_backtest": "پیوند بک‌تست فرضیه",
+ "load_skill": "بارگذاری دانش استراتژی",
+ "options_payoff": "تحلیل بازده آپشن",
+ "options_pricing": "قیمت‌گذاری آپشن",
+ "patch_skill": "به‌روزرسانی مهارت سفارشی",
+ "pattern": "تشخیص الگوهای چارت",
+ "portfolio_risk_xray": "اشعه ریسک پورتفولیو",
+ "propose_mandate_profiles": "پیشنهاد ماندیت‌های معاملاتی",
+ "qveris_execute": "اجرای کنش QVeris",
+ "qveris_inspect": "بازرسی کنش QVeris",
+ "qveris_search": "جستجوی QVeris",
+ "read_document": "خواندن سند",
+ "read_file": "خواندن فایل",
+ "read_url": "خواندن صفحه وب",
+ "remember": "این را به یاد بسپار",
+ "render_shadow_report": "ساخت گزارش سایه",
+ "report_audit": "ممیزی گزارش پژوهشی",
+ "run_research_autopilot": "اجرای اتوپایلوت پژوهش",
+ "run_shadow_backtest": "اجرای بک‌تست سایه",
+ "run_swarm": "تشکیل تیم",
+ "save_skill": "ذخیره مهارت سفارشی",
+ "scaffold_signal_engine": "ساخت موتور سیگنال",
+ "scan_shadow_signals": "اسکن سیگنال‌های سایه",
+ "screen_market": "غربالگری بازار",
+ "sdm_decay_scan": "اسکن کاهش استراتژی",
+ "sdm_register": "ثبت استراتژی",
+ "sdm_status": "بررسی وضعیت استراتژی",
+ "search_hypotheses": "جستجوی فرضیه‌ها",
+ "search_symbol": "جستجوی نمادها",
+ "session_search": "جستجوی نشست‌های پیشین",
+ "skill_file": "خواندن فایل مهارت",
+ "start_research_goal": "شروع هدف پژوهشی",
+ "trading_account": "مشاهده حساب کارگزار",
+ "trading_cancel_order": "لغو سفارش کارگزار",
+ "trading_check": "بررسی اتصال کارگزار",
+ "trading_connections": "فهرست اتصالات کارگزار",
+ "trading_history": "مشاهده تاریخچه معاملات",
+ "trading_orders": "مشاهده سفارش‌های کارگزار",
+ "trading_place_order": "ثبت سفارش کارگزار",
+ "trading_positions": "مشاهده موقعیت‌های کارگزار",
+ "trading_quote": "دریافت نرخ کارگزار",
+ "trading_select_connection": "انتخاب اتصال کارگزار",
+ "update_hypothesis": "به‌روزرسانی فرضیه پژوهشی",
+ "update_research_goal_status": "به‌روزرسانی وضعیت هدف",
+ "web_search": "جستجوی وب",
+ "write_file": "تولید کد"
+ },
+ "runDashboard": {
+ "eyebrow": "پژوهش کمّی · بک‌تست",
+ "engine": "موتور",
+ "portfolio": "پورتفولیو",
+ "systematicStrategy": "استراتژی سیستمی",
+ "strategyInferred": "استنباط‌شده",
+ "strategyMacd": "استراتژی روند MACD",
+ "strategyRsi": "استراتژی زمان‌بندی RSI",
+ "strategyMomentum": "استراتژی مومنتوم",
+ "strategyMeanReversion": "استراتژی بازگشت به میانگین",
+ "strategyBreakout": "استراتژی شکست",
+ "strategyMaCrossover": "تقاطع میانگین متحرک {{fast}}/{{slow}} روزه",
+ "seriesStrategy": "استراتژی",
+ "seriesBenchmark": "بنچمارک",
+ "seriesDrawdown": "افت",
+ "seriesRollingSharpe": "شارپ غلتان (۲۰)",
+ "kpiTotalReturn": "بازده کل",
+ "kpiAnnualReturn": "بازده سالانه",
+ "kpiMaxDrawdown": "حداکثر افت",
+ "kpiWinRate": "نرخ برد",
+ "kpiTrades": "معاملات",
+ "figEquityTitle": "ارزش حساب و بنچمارک",
+ "figEquityNote": "مسیر رشد استراتژی را با بنچمارکش مقایسه کنید.",
+ "figRiskTitle": "افت و ریسک غلتان",
+ "figRiskNote": "ببینید زیان‌ها کجا عمیق‌تر شد و عملکرد تنظیم‌شده با ریسک کجا تغییر کرد.",
+ "figPnlTitle": "سود و زیان تحقق‌یافته معاملات",
+ "figPnlNote": "سود و زیان از معاملات تکمیل‌شده.",
+ "figLedgerTitle": "دفتر معاملات",
+ "figLedgerNote": "۱۰۰ معامله اخیر را با جزئیات زمانی مرور کنید.",
+ "figMetricsTitle": "متریک‌های عملکرد",
+ "figMetricsNote": "خلاصه کامل بازده، ریسک و آمار معاملات.",
+ "noTrades": "هیچ معامله‌ای ثبت نشد.",
+ "colTime": "زمان",
+ "colSymbol": "نماد",
+ "colSide": "سمت",
+ "colPrice": "قیمت",
+ "colQty": "تعداد",
+ "colPnl": "سود و زیان",
+ "colReason": "علت"
+ },
+ "factor": {
+ "title": "پژوهش فاکتور",
+ "selectFactor": "انتخاب فاکتور",
+ "icSeries": "IC روزانه",
+ "icMa": "میانگین متحرک ۲۰ دوره‌ای",
+ "icStats": "آمار IC",
+ "icMean": "میانگین IC",
+ "icStd": "انحراف معیار IC",
+ "ir": "IR",
+ "icPositiveRatio": "نسبت IC > 0",
+ "icCount": "مشاهدات IC",
+ "longShortSpread": "اختلاف خرید-فروش",
+ "nGroups": "گروه‌های چارکی",
+ "quantileEquity": "ارزش حساب گروه‌های چارکی",
+ "quantileEquityNote": "گروه_۱ پایین‌ترین مقادیر فاکتور و گروه_N بالاترین را نگه می‌دارد؛ فاصله چارک بالا و پایین قدرت گزینش را می‌سنجد.",
+ "correlation": "همبستگی IC",
+ "correlationNote": "همبستگی جفتی سری زمانی IC روزانه بین فاکتورها؛ فاکتورهای به‌شدت همبسته اطلاعات هم‌پوشان دارند.",
+ "insufficientOverlap": "همبستگی IC در دسترس نیست، زیرا سری‌های IC فاکتورها روی تاریخ‌های مشترک به‌اندازه کافی هم‌پوشان نیستند.",
+ "loading": "در حال بارگذاری نتایج فاکتور…",
+ "error": "بارگذاری نتایج فاکتور ناموفق بود",
+ "noFactorData": "برای این اجرا نتیجه تحلیل فاکتوری موجود نیست."
+ },
+ "portfolio": {
+ "page": {
+ "badge": "محلی فقط‌خواندنی · چندحسابی",
+ "title": "پورتفولیو",
+ "subtitle": "یک ارزش‌گذاری بر اساس اتصالات فقط‌خواندنی فعال. حسابی که خوانده نشود به‌صورت خطا گزارش و از جمع‌ها کنار گذاشته می‌شود.",
+ "fxFresh": "USD/CNY {{rate}} · نرخ زنده",
+ "fxCached": "USD/CNY {{rate}} · نرخ ذخیره‌شده",
+ "manageAccounts": "مدیریت حساب‌ها",
+ "exportCsv": "خروجی CSV",
+ "refreshAll": "بازخوانی همه",
+ "refreshing": "در حال بازخوانی",
+ "warningsTitle": "یادداشت‌های داده",
+ "emptyTitle": "هنوز اسنپ‌شات پورتفولیویی نیست",
+ "emptyBody": "برای شروع حداقل یک حساب فقط‌خواندنی اضافه کنید.",
+ "emptyAction": "افزودن حساب",
+ "errorLoad": "پورتفولیو در دسترس نیست",
+ "errorRefresh": "بازخوانی ناموفق بود",
+ "errorReconnect": "اتصال دوباره حساب ناموفق بود",
+ "errorSaveSettings": "ذخیره تنظیمات پورتفولیو ممکن نشد",
+ "errorExport": "خروجی گرفتن ناموفق بود",
+ "errorReconnectTimeout": "احراز هویت مرورگر منقضی شد. دوباره وصل شوید و تأیید کارگزار را سریع کامل کنید."
+ },
+ "metrics": {
+ "total": "جمع دارایی‌ها",
+ "change": "تغییر دارایی امروز",
+ "changeNote": "شامل جابه‌جایی بازار و جریان‌های نقدی",
+ "coverage": "پوشش ارزش‌گذاری",
+ "coverageNote": "قیمت‌گذاری‌شده {{priced}} · نقدی {{cash}}",
+ "lastComplete": "آخرین به‌روزرسانی کامل",
+ "excluded": "{{count}} حساب خوانده نشد و از این جمع کنار گذاشته شد"
+ },
+ "allocation": {
+ "byAccount": "تخصیص بر اساس حساب",
+ "byHolding": "تخصیص بر اساس دارایی",
+ "center": "دارایی‌ها",
+ "other": "سایر دارایی‌ها",
+ "cash": "نقدی",
+ "unpriced": "بدون قیمت / سایر",
+ "cashUnpriced": "نقدی / بدون قیمت"
+ },
+ "accounts": {
+ "title": "وضعیت حساب‌ها",
+ "hint": "برای فیلتر دارایی‌ها روی یک حساب کلیک کنید",
+ "clearFilter": "پاک‌کردن فیلتر",
+ "positions": "{{count}} موقعیت",
+ "fresh": "با موفقیت خوانده شد",
+ "failed": "خوانده نشد — در جمع لحاظ نمی‌شود",
+ "lastSuccess": "آخرین خواندن موفق {{time}}",
+ "noSuccess": "هنوز خواندن موفقی نداشته است",
+ "reconnect": "اتصال دوباره",
+ "retryRead": "تلاش دوباره برای خواندن"
+ },
+ "holdings": {
+ "title": "دارایی‌ها",
+ "count": "{{count}} موقعیت",
+ "search": "جستجوی کارگزار، نماد یا بازار",
+ "colBroker": "کارگزار",
+ "colSymbol": "نماد",
+ "colType": "نوع",
+ "colQuantity": "تعداد",
+ "colCostPrice": "هزینه / قیمت",
+ "colValue": "ارزش",
+ "colWeight": "وزن",
+ "colPnl": "سود و زیان تحقق‌نیافته",
+ "colData": "داده",
+ "priced": "قیمت‌گذاری‌شده",
+ "unpriced": "بدون قیمت"
+ },
+ "history": {
+ "title": "تاریخچه دارایی",
+ "hint": "فقط اسنپ‌شات‌های کامل؛ تغییرات ممکن است شامل جریان نقدی باشد.",
+ "count": "{{count}} اسنپ‌شات کامل",
+ "empty": "تاریخچه پس از یک بازخوانی کامل آغاز می‌شود"
+ },
+ "credentials": {
+ "title": "اتصالات و اعتبارنامه‌ها",
+ "readOnlyProfile": "پروفایل فقط‌خواندنی",
+ "writableProfile": "پروفایل با قابلیت نوشتن",
+ "renewalAutomatic": "تمدید مدیریت‌شده توسط کانکتور",
+ "renewalSession": "نشست محلی",
+ "renewalProvider": "اعتبار مدیریت‌شده توسط ارائه‌دهنده"
+ },
+ "status": {
+ "title": "بازخوانی متوالی حساب‌های فعال",
+ "reading": "خواندن",
+ "done": "تمام‌شده",
+ "failed": "ناموفق",
+ "waiting": "در انتظار"
+ },
+ "env": {
+ "live": "زنده",
+ "paper": "شبیه‌سازی"
+ },
+ "editor": {
+ "title": "مدیریت حساب‌های پورتفولیو",
+ "subtitle": "فقط انتخاب حساب و تنظیمات نمایش این‌جا ذخیره می‌شود.",
+ "close": "بستن",
+ "currency": "ارز اصلی نمایش",
+ "selected": "حساب‌های انتخاب‌شده",
+ "selectedHint": "با دکمه‌های جهت‌دار ترتیب نمایش را تغییر دهید.",
+ "enableAccount": "فعال‌سازی حساب",
+ "accountLabel": "برچسب حساب",
+ "moveUp": "انتقال به بالا",
+ "moveDown": "انتقال به پایین",
+ "removeAccount": "حذف حساب",
+ "includeCash": "شامل نقدی این حساب",
+ "noAccounts": "هیچ حسابی انتخاب نشده",
+ "addTitle": "افزودن اتصال محلی فقط‌خواندنی",
+ "addHint": "از اتصالاتی که همین حالا روی این رایانه ساخته شده‌اند انتخاب کنید.",
+ "openConnections": "باز کردن مرکز اتصالات",
+ "chooseConnection": "انتخاب اتصال…",
+ "noConnections": "اتصال موجودی نیست",
+ "add": "افزودن",
+ "footerHint": "حساب‌های فعال پس از ذخیره بازخوانی می‌شوند.",
+ "cancel": "لغو",
+ "save": "ذخیره و بازخوانی",
+ "saving": "در حال ذخیره"
+ },
+ "connections": {
+ "title": "مرکز اتصالات محلی",
+ "subtitle": "تعریف‌ها محلی می‌مانند؛ اسرار فقط به خزانه اعتبار سیستم‌عامل می‌روند.",
+ "close": "بستن مرکز اتصالات",
+ "createTitle": "ایجاد اتصال حساب",
+ "createHint": "پروفایل یک الگوی عمومی است؛ اتصال خصوصیِ همین رایانه است.",
+ "profile": "پروفایل فقط‌خواندنی",
+ "chooseProfile": "انتخاب پروفایل…",
+ "localId": "شناسه اتصال محلی",
+ "displayName": "نام نمایشی",
+ "displayNamePlaceholder": "حساب اصلی من",
+ "create": "ایجاد اتصال",
+ "created": "اتصال محلی ساخته شد.",
+ "listTitle": "اتصالات این رایانه",
+ "listCount": "{{count}} اتصال",
+ "empty": "هنوز اتصال محلی‌ای ندارید",
+ "codexTitle": "افزودن کارگزار با Codex",
+ "codexBody": "از Codex بخواهید connector init را اجرا کند، آداپتر خواندن را از مستندات رسمی پیاده‌سازی و اعتبارسنجی کند، سپس نصبش کند. افزونه بیرون از مخزن می‌ماند.",
+ "readOnly": "فقط‌خواندنی",
+ "credentialSaved": "ذخیره شد",
+ "oauthNote": "از OAuth استفاده می‌کند؛ در صورت نیاز از طریق اتصال دوباره مجاز کنید.",
+ "localNote": "اعتبارنامه‌ها توسط پیکربندی موجود کانکتور محلی مدیریت می‌شوند.",
+ "saveVault": "ذخیره در خزانه",
+ "savedVault": "اعتبارنامه‌ها در خزانه سیستم‌عامل ذخیره شدند.",
+ "test": "تست",
+ "testOk": "{{label}} آماده است.",
+ "delete": "حذف",
+ "configured": "اعتبارنامه‌های لازم پیکربندی شده‌اند",
+ "optional": "(اختیاری)",
+ "authType": "احراز هویت",
+ "dependency": "وابستگی محلی",
+ "testFailed": "بررسی {{label}} ناموفق بود: {{error}}",
+ "unknownTestError": "کانکتور خطای ناشناخته‌ای برگرداند."
+ },
+ "compatibility": {
+ "native": "آداپتور بومی",
+ "contractTested": "تست‌شده با قرارداد",
+ "experimental": "آزمایشی"
+ }
+ }
+}
diff --git a/frontend/src/i18n/locales/ja.json b/frontend/src/i18n/locales/ja.json
index c05889a84..cef8fcd57 100644
--- a/frontend/src/i18n/locales/ja.json
+++ b/frontend/src/i18n/locales/ja.json
@@ -416,7 +416,22 @@
"stoppedToast": "IM チャンネルを停止しました",
"refreshFailed": "IM チャンネルの更新に失敗しました",
"startFailed": "IM チャンネルの開始に失敗しました",
- "stopFailed": "IM チャンネルの停止に失敗しました"
+ "stopFailed": "IM チャンネルの停止に失敗しました",
+ "configTitle": "チャンネル設定",
+ "configHint": "保存前に「接続テスト」で接続を確認してください。保存するとローカルのエージェント設定にチャンネルが書き込まれます。",
+ "enabledLabel": "チャンネルを有効化",
+ "token": "トークン",
+ "tokenHint": "ローカルのエージェント設定ファイルに保存され、再表示されません。",
+ "allowlistLabel": "許可リスト(カンマ区切り)",
+ "allowlistHint": "チャットを許可する送信者ID。空の場合はチャンネルの設定に従い全員を受け入れます。",
+ "test": "接続テスト",
+ "testOk": "チャンネルは準備できています。",
+ "testFailed": "チャンネルテストに失敗しました",
+ "save": "チャンネル設定を保存",
+ "saved": "チャンネル設定を保存しました。適用するにはチャンネルを再起動してください",
+ "saveFailed": "チャンネル設定の保存に失敗しました",
+ "notConfigurable": "このチャンネルはこのページから設定できません。エージェント設定ファイルを編集してください。",
+ "loadFailed": "チャンネル設定の読み込みに失敗しました"
},
"generation": "生成設定",
"dataSourceSettings": "データソース設定",
diff --git a/frontend/src/i18n/locales/ko.json b/frontend/src/i18n/locales/ko.json
index 40bf82c9b..c7af0ad95 100644
--- a/frontend/src/i18n/locales/ko.json
+++ b/frontend/src/i18n/locales/ko.json
@@ -416,7 +416,22 @@
"stoppedToast": "IM 채널이 중지되었습니다",
"refreshFailed": "IM 채널 새로 고침 실패",
"startFailed": "IM 채널 시작 실패",
- "stopFailed": "IM 채널 중지 실패"
+ "stopFailed": "IM 채널 중지 실패",
+ "configTitle": "채널 설정",
+ "configHint": "저장하기 전에 연결 테스트로 연결을 확인하세요. 저장하면 로컬 에이전트 설정에 채널이 기록됩니다.",
+ "enabledLabel": "채널 활성화",
+ "token": "토큰",
+ "tokenHint": "로컬 에이전트 설정 파일에 저장되며 다시 표시되지 않습니다.",
+ "allowlistLabel": "허용 목록(쉼표로 구분)",
+ "allowlistHint": "채팅을 허용할 발신자 ID입니다. 비워 두면 채널 설정에 따라 모두 허용됩니다.",
+ "test": "연결 테스트",
+ "testOk": "채널이 준비되었습니다.",
+ "testFailed": "채널 테스트 실패",
+ "save": "채널 설정 저장",
+ "saved": "채널 설정이 저장되었습니다. 적용하려면 채널을 다시 시작하세요",
+ "saveFailed": "채널 설정 저장 실패",
+ "notConfigurable": "이 채널은 이 페이지에서 설정할 수 없습니다. 에이전트 설정 파일을 편집하세요.",
+ "loadFailed": "채널 설정을 불러오지 못했습니다"
},
"generation": "생성 설정",
"dataSourceSettings": "데이터 소스 설정",
diff --git a/frontend/src/i18n/locales/zh-CN.json b/frontend/src/i18n/locales/zh-CN.json
index ff1db00a9..674d2bd5e 100644
--- a/frontend/src/i18n/locales/zh-CN.json
+++ b/frontend/src/i18n/locales/zh-CN.json
@@ -416,7 +416,22 @@
"stoppedToast": "IM 通道已停止",
"refreshFailed": "刷新 IM 通道失败",
"startFailed": "启动 IM 通道失败",
- "stopFailed": "停止 IM 通道失败"
+ "stopFailed": "停止 IM 通道失败",
+ "configTitle": "频道配置",
+ "configHint": "保存前请先用「测试连接」验证;保存会把该频道写入本地 Agent 配置文件。",
+ "enabledLabel": "启用频道",
+ "token": "令牌",
+ "tokenHint": "保存在本地 Agent 配置文件中,之后不会再显示。",
+ "allowlistLabel": "允许列表(逗号分隔)",
+ "allowlistHint": "允许聊天的发送者 ID;留空表示在频道允许的情况下接受所有人。",
+ "test": "测试连接",
+ "testOk": "频道已就绪。",
+ "testFailed": "频道测试失败",
+ "save": "保存频道配置",
+ "saved": "频道配置已保存;请重启频道以生效",
+ "saveFailed": "保存频道配置失败",
+ "notConfigurable": "此频道无法从本页配置;请直接编辑 Agent 配置文件。",
+ "loadFailed": "加载频道配置失败"
},
"generation": "生成设置",
"dataSourceSettings": "数据源设置",
diff --git a/frontend/src/index.css b/frontend/src/index.css
index f95778cd8..f7814fa2a 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -120,3 +120,29 @@
/* RTL: mirror directional icons (chevrons, arrows) automatically */
[dir="rtl"] .rtl\:flip-x { transform: scaleX(-1); }
+
+/* ===== Bidi/RTL support for chat content =====
+ Each markdown block auto-detects its own base direction (first-strong,
+ like Telegram) instead of inheriting the LTR document direction.
+ Unlayered on purpose: unlayered author rules win over @layer utilities,
+ so these override prose-* / Tailwind alignment classes. */
+.vt-bidi :is(p, li, h1, h2, h3, h4, h5, h6, blockquote, td, th, figcaption, dd, dt) {
+ unicode-bidi: plaintext;
+ text-align: start;
+}
+.vt-bidi table {
+ unicode-bidi: plaintext;
+}
+.vt-bidi pre {
+ direction: ltr;
+ text-align: left;
+ unicode-bidi: isolate;
+}
+.vt-bidi :not(pre) > code {
+ direction: ltr;
+ unicode-bidi: isolate;
+}
+.vt-bidi .katex,
+.vt-bidi .katex * {
+ direction: ltr;
+}
diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts
index a5b56b1e7..f63d42964 100644
--- a/frontend/src/lib/api.ts
+++ b/frontend/src/lib/api.ts
@@ -488,6 +488,39 @@ export const api = {
method: "POST",
body: JSON.stringify(settings),
}),
+ listCustomProviders: () =>
+ request<{ status: string; providers: CustomProviderProfile[] }>("/settings/custom-providers"),
+ testCustomProvider: (settings: { base_url: string; model: string; api_key: string }) =>
+ request<CustomProviderTestResponse>("/settings/custom-providers/test", {
+ method: "POST",
+ body: JSON.stringify(settings),
+ }),
+ saveCustomProvider: (settings: CustomProviderSaveRequest) =>
+ request<{ status: string; provider: CustomProviderProfile }>("/settings/custom-providers", {
+ method: "POST",
+ body: JSON.stringify(settings),
+ }),
+ activateCustomProvider: (profileId: string) =>
+ request<{ status: string; active_id: string; model: string; base_url: string }>(
+ `/settings/custom-providers/${encodeURIComponent(profileId)}/activate`, {
+ method: "POST",
+ body: JSON.stringify({ confirm: true }),
+ },
+ ),
+ getChannelsConfig: () =>
+ request<ChannelsConfigResponse>("/channels/config"),
+ updateChannelsConfig: (update: { channel: string; enabled: boolean; token?: string; allowlist?: string }) =>
+ request<{ status: string; needs_restart: boolean }>("/channels/config", {
+ method: "PUT",
+ body: JSON.stringify(update),
+ }),
+ testChannelsConfig: (probe: { channel: string; token?: string }) =>
+ request<{ status: string; checks: { adapter_available: boolean; token_present: boolean; live_probe: string; bot_username?: string } }>(
+ "/channels/config/test", {
+ method: "POST",
+ body: JSON.stringify(probe),
+ },
+ ),
getDataSourceSettings: () => request<DataSourceSettings>("/settings/data-sources"),
updateDataSourceSettings: (settings: UpdateDataSourceSettingsRequest) =>
request<DataSourceSettings>("/settings/data-sources", {
@@ -744,6 +777,50 @@ export interface ListLLMModelsRequest {
api_key?: string;
}
+export interface CustomProviderProfile {
+ id: string;
+ label: string;
+ base_url: string;
+ model: string;
+ api_key_configured: boolean;
+ active: boolean;
+ last_tested_at?: string | null;
+}
+
+export interface CustomProviderTestResponse {
+ status: "ok";
+ test_id: string;
+ response_preview: string;
+ latency_ms: number;
+}
+
+export interface CustomProviderSaveRequest {
+ id: string;
+ label: string;
+ base_url: string;
+ model: string;
+ api_key: string;
+ test_id: string;
+}
+
+export interface ChannelConfigSummary {
+ channel: string;
+ display_name: string;
+ available: boolean;
+ error: string;
+ install_hint: string;
+ configured: boolean;
+ enabled: boolean;
+ token_configured: boolean;
+ allowlist: string[];
+}
+
+export interface ChannelsConfigResponse {
+ status: string;
+ channels: ChannelConfigSummary[];
+ env_path: string;
+}
+
export interface LLMModelsResponse {
provider: string;
models: string[];
diff --git a/frontend/src/pages/Settings.tsx b/frontend/src/pages/Settings.tsx
index eb143f518..109752e7d 100644
--- a/frontend/src/pages/Settings.tsx
+++ b/frontend/src/pages/Settings.tsx
@@ -3,6 +3,8 @@ import { Database, KeyRound, Loader2, MessageSquareMore, Play, RefreshCw, Rotate
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
import { ModelPicker } from "@/components/settings/ModelPicker";
+import { CustomProviderManager } from "@/components/settings/CustomProviderManager";
+import { ChannelConfigSection } from "@/components/settings/ChannelConfigSection";
import { QVerisSettings } from "@/components/settings/QVerisSettings"; // QVERIS-INTEGRATION
import { SourcePrioritySettings } from "@/components/settings/SourcePrioritySettings";
import { api, isAuthRequiredError, type ChannelRuntimeStatus, type DataSourceSettings, type LLMProviderOption, type LLMSettings } from "@/lib/api";
@@ -489,6 +491,8 @@ export function Settings() {
{channelsSection}
+ <ChannelConfigSection />
+
<div className="space-y-2">
<h2 className="text-lg font-semibold tracking-tight">{t("settings.llmSettings")}</h2>
<p className="max-w-3xl text-sm text-muted-foreground">{t("settings.llmSettingsDesc")}</p>
@@ -696,6 +700,8 @@ export function Settings() {
</section>
</form>
+ <CustomProviderManager />
+
<form onSubmit={submitDataSources} className="rounded-lg border bg-card p-5 shadow-sm">
<div className="mb-5 space-y-1">
<div className="flex items-center gap-2">
diff --git a/frontend/src/pages/__tests__/SettingsChannels.test.tsx b/frontend/src/pages/__tests__/SettingsChannels.test.tsx
index eb9bfa7eb..f960fb145 100644
--- a/frontend/src/pages/__tests__/SettingsChannels.test.tsx
+++ b/frontend/src/pages/__tests__/SettingsChannels.test.tsx
@@ -10,6 +10,8 @@ const apiMock = vi.hoisted(() => ({
stopChannels: vi.fn(),
updateLLMSettings: vi.fn(),
updateDataSourceSettings: vi.fn(),
+ listCustomProviders: vi.fn(),
+ getChannelsConfig: vi.fn(),
}));
vi.mock("@/lib/api", async () => {
@@ -112,6 +114,8 @@ describe("Settings IM channels panel", () => {
});
apiMock.startChannels.mockResolvedValue(channelStatus({ running: true }));
apiMock.stopChannels.mockResolvedValue(channelStatus());
+ apiMock.listCustomProviders.mockResolvedValue({ status: "ok", providers: [] });
+ apiMock.getChannelsConfig.mockResolvedValue({ status: "ok", channels: [], env_path: "agent.json" });
});
it("renders channel runtime status and refreshes it", async () => {
diff --git a/frontend/src/pages/__tests__/SettingsQVeris.test.tsx b/frontend/src/pages/__tests__/SettingsQVeris.test.tsx
index 2b32186ef..b19d400b7 100644
--- a/frontend/src/pages/__tests__/SettingsQVeris.test.tsx
+++ b/frontend/src/pages/__tests__/SettingsQVeris.test.tsx
@@ -11,6 +11,8 @@ const apiMock = vi.hoisted(() => ({
stopChannels: vi.fn(),
updateLLMSettings: vi.fn(),
updateDataSourceSettings: vi.fn(),
+ getChannelsConfig: vi.fn(),
+ listCustomProviders: vi.fn(),
}));
vi.mock("@/lib/api", async () => {
@@ -150,6 +152,8 @@ describe("Settings QVeris card", () => {
apiMock.getChannelStatus.mockResolvedValue(channelStatus());
apiMock.startChannels.mockResolvedValue(channelStatus());
apiMock.stopChannels.mockResolvedValue(channelStatus());
+ apiMock.getChannelsConfig.mockResolvedValue({ status: "ok", channels: [], env_path: "agent.json" });
+ apiMock.listCustomProviders.mockResolvedValue({ status: "ok", providers: [] });
});
afterEach(() => {
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index 852808cf0..793d9b09a 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -3,6 +3,7 @@ import react from "@vitejs/plugin-react";
import path from "path";
const PROXY_PATHS = [
+ "/api",
"/auth",
"/sessions",
"/swarm/presets",
@@ -10,6 +11,7 @@ const PROXY_PATHS = [
"/qveris",
"/settings/llm",
"/settings/data-sources",
+ "/settings/custom-providers",
"/channels",
"/mandate",
"/live",