feat(dictate): use local socket-activated Parakeet

This commit is contained in:
jb
2026-08-26 12:38:45 -04:00
parent ea74dbc6a7
commit e234468a73
34 changed files with 6702 additions and 527 deletions
@@ -0,0 +1,38 @@
from pathlib import Path
import unittest
REPOSITORY_ROOT = Path(__file__).resolve().parents[3]
UNIT_DIR = REPOSITORY_ROOT / "systemd/user"
class SystemdUnitTests(unittest.TestCase):
def test_socket_unit_owns_the_exact_private_runtime_path(self) -> None:
socket_unit = (UNIT_DIR / "pi-dictate.socket").read_text(encoding="utf-8")
self.assertIn("ListenStream=%t/pi-dictate.sock", socket_unit)
self.assertIn("SocketMode=0600", socket_unit)
self.assertIn("Accept=no", socket_unit)
self.assertIn("RemoveOnStop=yes", socket_unit)
def test_service_is_offline_hardened_and_uses_private_native_caches(self) -> None:
service_unit = (UNIT_DIR / "pi-dictate.service").read_text(encoding="utf-8")
for expected in (
"PI_DICTATE_MODEL_PATH=%h/.local/share/pi-dictate/models/",
"PI_DICTATE_TERMS_PATH=%h/.local/share/pi-dictate/config/coding-terms.txt",
"PI_DICTATE_BOOST_ALPHA=1.0",
"HF_HUB_OFFLINE=1",
"TRANSFORMERS_OFFLINE=1",
"TRITON_CACHE_DIR=/tmp/pi-dictate-triton",
"NUMBA_CACHE_DIR=/tmp/pi-dictate-numba",
"LimitCORE=0",
"MemorySwapMax=0",
"ProtectSystem=strict",
"ProtectHome=read-only",
"RestrictAddressFamilies=AF_UNIX",
"IPAddressDeny=any",
):
self.assertIn(expected, service_unit)
if __name__ == "__main__":
unittest.main()