chore: initialize EverOS 1.0.0

md-first memory extraction framework for AI agents.

Markdown is the single source of truth; SQLite holds state and LanceDB
provides the rebuildable vector + BM25 + scalar index. The codebase follows
a single-direction DDD layering (entrypoints -> service -> memory -> infra,
with component / core / config cross-cutting) enforced by import-linter.

Engineering surface:
- Coding conventions in .claude/rules/ (path-scoped) and workflows in
  .claude/skills/ (/commit, /new-branch, /pr).
- GitHub Actions CI runs make lint + test + integration; pre-commit mirrors
  the gates locally (ruff, hygiene hooks, gitlint commit-msg).
- Commit messages follow Conventional Commits, enforced by gitlint.
- make lint also enforces datetime two-zone discipline and OpenAPI drift.
This commit is contained in:
Elliot Chen
2026-06-05 22:35:51 +08:00
commit 518b8eca85
636 changed files with 160553 additions and 0 deletions

View File

@ -0,0 +1,64 @@
"""get_llm_client — raises on missing credentials, caches on success."""
from __future__ import annotations
import importlib
import pytest
from pydantic import SecretStr
from everos.component.llm import LLMNotConfiguredError
from everos.config import Settings
from everos.config.settings import LLMSettings
_client_mod = importlib.import_module("everos.component.llm.client")
def _reset_singleton(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(_client_mod, "_llm_client", None, raising=False)
def _patch_settings(
monkeypatch: pytest.MonkeyPatch,
*,
api_key: str | None,
base_url: str | None,
) -> None:
"""Stub the ``load_settings`` reference bound inside the client module."""
cfg = Settings(
llm=LLMSettings(
model="gpt-4o-mini",
api_key=SecretStr(api_key) if api_key is not None else None,
base_url=base_url,
)
)
monkeypatch.setattr(_client_mod, "load_settings", lambda: cfg)
def test_raises_when_api_key_missing(monkeypatch: pytest.MonkeyPatch) -> None:
_reset_singleton(monkeypatch)
_patch_settings(monkeypatch, api_key=None, base_url="https://example.test")
with pytest.raises(LLMNotConfiguredError, match="EVEROS_LLM__API_KEY"):
_client_mod.get_llm_client()
def test_raises_when_base_url_missing(monkeypatch: pytest.MonkeyPatch) -> None:
_reset_singleton(monkeypatch)
_patch_settings(monkeypatch, api_key="sk-test", base_url=None)
with pytest.raises(LLMNotConfiguredError, match="EVEROS_LLM__BASE_URL"):
_client_mod.get_llm_client()
def test_returns_singleton_when_configured(monkeypatch: pytest.MonkeyPatch) -> None:
_reset_singleton(monkeypatch)
_patch_settings(monkeypatch, api_key="sk-test", base_url="https://example.test")
sentinel = object()
monkeypatch.setattr(_client_mod, "build_client", lambda cfg: sentinel)
first = _client_mod.get_llm_client()
second = _client_mod.get_llm_client()
assert first is sentinel
assert first is second

View File

@ -0,0 +1,28 @@
"""``build_llm_provider`` — settings validation + provider build."""
from __future__ import annotations
import pytest
from pydantic import SecretStr
from everos.component.llm import build_llm_provider
from everos.component.llm.openai_provider import OpenAIProvider
from everos.config.settings import LLMSettings
def test_raises_when_api_key_missing() -> None:
s = LLMSettings(model="m", api_key=None, base_url="https://x")
with pytest.raises(ValueError, match="EVEROS_LLM__API_KEY"):
build_llm_provider(s)
def test_raises_when_base_url_missing() -> None:
s = LLMSettings(model="m", api_key=SecretStr("k"), base_url=None)
with pytest.raises(ValueError, match="EVEROS_LLM__BASE_URL"):
build_llm_provider(s)
def test_builds_openai_provider() -> None:
s = LLMSettings(model="m", api_key=SecretStr("k"), base_url="https://x")
p = build_llm_provider(s)
assert isinstance(p, OpenAIProvider)