EAPI=8 inherit cmake flag-o-matic DESCRIPTION="Agent Smith: local terminal and GTK4 desktop assistant backed by AIRouter (C++)" HOMEPAGE="https://trunkmasters.com/smith" SRC_URI="https://distfiles.hedronfire.com/${P}.tar.gz" LICENSE="MIT" SLOT="0" KEYWORDS="~amd64" IUSE="server desktop" DEPEND=" =dev-libs/boost-1.91.0* =dev-libs/openssl-3.6.5* >=dev-db/sqlite-3.53:3 =dev-cpp/nlohmann_json-3.12.0* =dev-cpp/tomlplusplus-3.4.0* desktop? ( >=gui-libs/gtk-4.22.5:4[wayland] >=dev-libs/libportal-0.9.1[gtk] >=media-libs/gstreamer-1.24:1.0 >=media-libs/gst-plugins-base-1.24:1.0 x11-libs/gdk-pixbuf:2[jpeg] ) " # The client runs sandboxed commands in bubblewrap and logs in over OpenSSH. The # server runs as an existing `smith` account (on Alpha it predates any acct package). RDEPEND=" ${DEPEND} dev-vcs/git net-misc/openssh sys-apps/bubblewrap desktop? ( media-video/pipewire[gstreamer] media-libs/gst-plugins-good:1.0 sys-apps/xdg-desktop-portal gui-libs/xdg-desktop-portal-wlr ) " BDEPEND=" virtual/pkgconfig dev-vcs/git =dev-cpp/catch-3.15.3* >=dev-lang/python-3.11 " PATCHES=( "${FILESDIR}/${P}-gtk4.patch" ) src_configure() { # The project refuses in-source builds and requires an absolute build root. export SMITH_CPP_BUILD_ROOT="${WORKDIR}/build" local mycmakeargs=( -DSMITH_SANITIZER=none -DSMITH_BUILD_DESKTOP=$(usex desktop ON OFF) ) cmake_src_configure } src_test() { # Preview tests need a private Wayland compositor; they run outside the sandbox. # Unit and bounded local IPC/capture fixtures run here without model calls. if use desktop; then cmake_src_test -R '^(unit|desktop-ipc)$' else cmake_src_test -R '^unit$' fi } src_install() { cmake_src_install if use server; then newinitd "${ED}"/usr/share/smith/openrc/smithd.initd smithd newconfd "${ED}"/usr/share/smith/openrc/smithd.confd smithd else rm "${ED}"/usr/sbin/smithd "${ED}"/usr/libexec/smith/smith-mcp || die fi } pkg_postinst() { use server || return elog "Server: needs the system account smith (and AIRouter's account in group of the" elog "relay socket). Start from /usr/share/smith/server.toml.example as /etc/smith/server.toml" elog "(root:smith 0640). AIRouter needs a smith principal, the smith role and a profile" elog "pinned to it whose resource server is /usr/libexec/smith/smith-mcp with" elog "SMITH_MCP_SOCKET=/run/smith/relay/relay.sock. Then: rc-service smithd start." elog "Cortex: enable per-user memory = { read = true, write = true } in server.toml." elog "AIRouter must provide airouter.records.v1 and grant smith memory_record_clients access." elog "Grant mcp__smith__memory_recall, mcp__smith__memory_save and mcp__smith__memory_update" elog "in AIRouter's smith role; server.toml.example describes these independent grants." }