The dense leg used to be a pair of files next to the database: a full .npy re-encoded from every atom, re-normalized on every query, and stale the moment anything was ingested. It is now a vec0 table inside the same SQLite file, written in the same transaction as the atom it describes, so a memory is queryable the instant it is remembered. - vector_index.py maintains the table; the writer inserts, the reader never rebuilds. A repair scan (ely-eye build-dense-index) catches what a crash hid, and it is not on the search path. - Ranking stays in the engine; every boundary (closed, retired, not yet true, another holder's private memory, the mounted cartridge) is checked once against the atoms table afterwards. A visibility subquery inside the KNN cost 48.9s on 153,857 vectors; the same check over 200 candidates costs 0.2ms. When the boundaries reject enough candidates the ask widens once, never twice. - The Go mirror and the web panel carry the new status fields. - bench/dense_scale.py and bench/quant_probe.py measure the leg at corpus size; bench/scale_check.py now works on a copy so the frozen baseline stays frozen. Measured on the frozen 165,973-atom corpus. bench/reports/DENSE.md, QUANT.md and SCALE.md carry the numbers and the machine they were taken on. Gates: 285 pytest, ruff clean, pyright 0 on the touched files, go build/vet/test and gofmt clean, frontend build and eslint clean. mypy is 25 findings against the parent's 24: the new one is "Skipping analyzing sqlite_vec: missing library stubs", the same class as the two existing qwen_vl_utils lines, and the repo keeps no type: ignore anywhere.
75 lines
1.8 KiB
Python
75 lines
1.8 KiB
Python
"""What the machine reports about itself: runtime, memory, cache layers, senses."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from typing import Any, Literal
|
|
|
|
from pydantic import BaseModel
|
|
|
|
from .schemas import TrainingAdapterKind
|
|
|
|
|
|
class CacheLayerStatus(BaseModel):
|
|
layer: str
|
|
entries: int
|
|
bytes_estimate: int
|
|
hit_count: int
|
|
miss_count: int
|
|
last_event_at: datetime | None
|
|
|
|
|
|
class MemoryStatus(BaseModel):
|
|
active_atoms: int
|
|
active_token_equivalent: int
|
|
cartridges: int
|
|
library_token_equivalent: int
|
|
layers: list[CacheLayerStatus]
|
|
|
|
|
|
class RuntimeStatus(BaseModel):
|
|
backend: str
|
|
model_id: str
|
|
available: bool
|
|
detail: str
|
|
adapter_path: str | None = None
|
|
adapter_kind: TrainingAdapterKind | None = None
|
|
adapter_id: str | None = None
|
|
adapter_sha256: str | None = None
|
|
gpu_name: str | None = None
|
|
cuda: str | None = None
|
|
vram_total_mb: int | None = None
|
|
vram_used_mb: int | None = None
|
|
|
|
|
|
SenseState = Literal["absent", "missing", "ready"]
|
|
VisualState = Literal["absent", "stale", "ready"]
|
|
DenseState = Literal["off", "missing", "behind", "current"]
|
|
|
|
|
|
class SenseStatus(BaseModel):
|
|
"""What the machine can perceive now; absent means no model was given, missing means the one it was given is gone."""
|
|
|
|
dense: DenseState
|
|
dense_covered: int
|
|
dense_expected: int
|
|
picture_atoms: int
|
|
picture_bytes_missing: int
|
|
visual: VisualState
|
|
audio_atoms: int
|
|
speech: SenseState
|
|
captioning: SenseState
|
|
clip_path: str | None = None
|
|
asr_path: str | None = None
|
|
vlm_path: str | None = None
|
|
|
|
|
|
class SystemStatus(BaseModel):
|
|
app: str = "Ely-Eye"
|
|
version: str
|
|
runtime: RuntimeStatus
|
|
memory: MemoryStatus
|
|
senses: SenseStatus
|
|
profiles: dict[str, dict[str, Any]]
|
|
data_home: str
|