EAPI=8 RUST_MIN_VER="1.98.0" inherit cargo DESCRIPTION="Metadata-only routing plane for owned and frontier AI compute" HOMEPAGE="https://trunkmasters.com/airouter" SRC_URI="https://www.hedronfire.com/distfiles/airouter-0.1.2-r9.tar.zst https://www.hedronfire.com/distfiles/llmbridge-0.1.2-20260924.tar.zst" S="${WORKDIR}/airouter" # The archive contains AIRouter, its pinned LLMBridge path dependency, and a # complete Cargo vendor tree. The package must build without /srv/airouter or # network access. LICENSE="MIT" SLOT="0" KEYWORDS="~amd64" # Independent native service is additive to the immutable r9 platform source. PATCHES=( "${FILESDIR}/airouter-codex-runtime.patch" "${FILESDIR}/airouter-managed-task-outcomes.patch" "${FILESDIR}/airouter-session-service.patch" ) RDEPEND=" acct-group/airouter acct-group/airouter-admin acct-group/airouter-framework acct-user/airouter acct-user/airouter-agent dev-db/postgresql sys-auth/citadel >=dev-lang/python-3.10 sys-apps/acl sys-apps/bubblewrap sys-apps/util-linux " BDEPEND=" net-misc/rsync app-arch/zstd >=dev-lang/rust-1.98.0 " src_unpack() { # Portage on the target profile does not unpack .tar.zst through the # generic helper; extract both immutable source inputs explicitly. tar --zstd -xf "${DISTDIR}/airouter-0.1.2-r9.tar.zst" -C "${WORKDIR}" || die tar --zstd -xf "${DISTDIR}/llmbridge-0.1.2-20260924.tar.zst" -C "${WORKDIR}" || die mv "${WORKDIR}/llmbridge-0.1.2-20260924" "${WORKDIR}/llmbridge" || die } src_compile() { cargo build --offline --release --workspace --locked \ --features "airouter-catalog/skills-tools,airouter-catalog/workspace-tools,\ airouter-catalog/development-tools,airouter-catalog/release-tools,\ airouter-catalog/learning-tools,airouter-catalog/host-tools,\ airouter-catalog/control-tools,airouter-agent-client/executor" || die } src_install() { dosbin target/release/airouterd dosbin target/release/airouter-agentd dosbin target/release/airouter-sessiond dosbin target/release/airouterctl dosbin target/release/airouter-catalog dosbin target/release/airouter-host dosbin target/release/airouter-release dosbin target/release/airouter-verify dosbin target/release/airouter-permissions dosbin target/release/airouter-toolsd dobin target/release/airouter-smoke dobin target/release/airouter-tool exeinto /usr/libexec/airouter doexe target/release/airouter-codex doexe target/release/airouter-native-exec doexe target/release/enroll-node doexe packaging/scripts/airouter-renew-node-server doexe packaging/scripts/airouter-capability-refresh doexe packaging/scripts/airouter-framework-backup doexe packaging/scripts/airouter-tools-launch doexe target/release/airouter-desktop-worker # The Workbench selector invokes this stable top-level helper directly. # Keep it beside the AIRouter executables; catalog helpers belong below # /usr/libexec/airouter/catalog. exeinto /usr/libexec/airouter newexe scripts/airouter-route.py airouter-route exeinto /usr/libexec/airouter/catalog doexe target/release/airouter-skills-catalog doexe target/release/airouter-workspace-catalog doexe target/release/airouter-development-catalog doexe target/release/airouter-release-catalog doexe target/release/airouter-learning-catalog doexe target/release/airouter-host-catalog doexe target/release/airouter-control-catalog exeinto /usr/libexec/airouter/qualification doexe scripts/qualify-citadel-session.py doexe scripts/qualify-context-lifecycle.py doexe scripts/qualify-native-session-service.py insinto /etc/cron.d doins packaging/cron/airouter-server-cert-renew doins packaging/cron/airouter-capability-refresh doins packaging/cron/airouter-framework-backup insinto /etc/airouter newins config/codex-runtime.example.json codex-runtime.json doins config/airouter.toml newins config/framework.example.toml framework.toml doins config/tools.example.toml config/tools-client.example.toml newins config/routing.example.json routing.json insinto /etc/airouter-capabilities newins packaging/capabilities.sources.example.json sources.json # Native Workbench qualification needs its separately versioned fixture # bundle. Do not install a profile referencing absent host-local executors. diropts -o airouter -g airouter -m 0700 keepdir /etc/airouter/secrets newinitd packaging/openrc/airouterd airouterd newinitd packaging/openrc/airouter-frameworkd airouter-frameworkd newinitd packaging/openrc/airouter-sessiond airouter-sessiond newinitd packaging/openrc/airouter-catalog-refresh airouter-catalog-refresh newinitd packaging/openrc/airouter-qualification airouter-qualification newinitd packaging/openrc/airouter-toolsd airouter-toolsd docinto tools dodoc config/tools.example.toml config/tools-client.example.toml crates/airouter-tools/README.md crates/airouter-tools/DESKTOPS.md docinto / dodoc README.md schema/README.md crates/airouter-agentd/CONTEXT_LIFECYCLE.md crates/airouter-agentd/TASKS.md docinto sessions dodoc crates/airouter-agentd/SESSION_SERVICE.md config/session-service.example.toml docinto host dodoc crates/airouter-host/README.md diropts -o airouter -g airouter -m 0750 keepdir /var/lib/airouter keepdir /var/backups/airouter-framework diropts -o root -g root -m 0711 keepdir /var/lib/airouter-native/codex keepdir /var/lib/airouter-native/sessions } pkg_postinst() { elog "Session service draft: configure an independent per-app instance before enabling it; see sessions/SESSION_SERVICE.md." elog "Workbench cutover, durable attachment staging and its independent resource bridge remain separate integration steps." elog "Codex service state: register UID/home entries in /etc/airouter/codex-runtime.json." elog "Provision private service state and login before selecting airouter-codex; see the host README." elog "Context v2: retain compatible runtime/configuration once writer minimum 2 is enabled." elog "Keep the context-input receipt API available until pending application inputs settle." elog "This package does not migrate, enroll or restart services automatically." elog "Create the signing key with: airouterctl generate-signing-key" elog "Apply migrations with the restricted airouter_migrate role before starting airouterd." }