summaryrefslogtreecommitdiff
path: root/app-misc/smith/smith-0.16.1.ebuild
blob: 5cad371684ecff7520190837d864edef665ff803 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
EAPI=8

inherit cmake flag-o-matic

DESCRIPTION="Agent Smith: local terminal and 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? (
		>=dev-qt/qtbase-6.11:6[widgets,network]
		>=dev-qt/qtmultimedia-6.11:6[pipewire,ffmpeg,dbus]
	)
"
# 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? (
		dev-qt/qtwayland:6
		media-video/pipewire
		sys-apps/xdg-desktop-portal
		gui-libs/xdg-desktop-portal-wlr
	)
"
BDEPEND="
	dev-vcs/git
	=dev-cpp/catch-3.15.3*
	>=dev-lang/python-3.11
"

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() {
	# The end-to-end tests (sockets, TLS, a pty) run in CI, outside the Portage sandbox.
	if use desktop; then
		cmake_src_test -R '^(unit|desktop-ipc|desktop-preview)$'
	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."
}