[refactor](workspace): complete remaining architecture phases

Bundle all pending repository updates, including plugin context de-globalization, runtime hardening, config validation, boundary tests, and supporting docs/scripts.

Co-authored-by: OpenAI Codex <codex@openai.com>
Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
2026-02-12 22:27:36 +01:00
parent 144afbae8e
commit 4b34a39745
27 changed files with 684 additions and 210 deletions
+14 -6
View File
@@ -8,18 +8,25 @@ use tokio::sync::{mpsc, watch};
use tokio::task::JoinHandle;
use tracing::info;
use trx_backend::{register_backend, RigAccess};
use trx_backend::{RegistrationContext, RigAccess};
use trx_core::{DynResult, RigRequest, RigState};
use trx_frontend::{register_frontend, FrontendSpawner};
use trx_frontend::{FrontendRuntimeContext, FrontendSpawner, FrontendRegistrationContext};
const BACKEND_NAME: &str = "example";
const FRONTEND_NAME: &str = "example-frontend";
/// Entry point called by trx-server/trx-client when the plugin is loaded.
/// Entry point called by trx-server when the plugin is loaded.
#[no_mangle]
pub extern "C" fn trx_register() {
register_backend(BACKEND_NAME, example_backend_factory);
register_frontend(FRONTEND_NAME, ExampleFrontend::spawn_frontend);
pub extern "C" fn trx_register_backend(context: *mut std::ffi::c_void) {
let context = unsafe { &mut *(context as *mut RegistrationContext) };
context.register_backend(BACKEND_NAME, example_backend_factory);
}
/// Entry point called by trx-client when the plugin is loaded.
#[no_mangle]
pub extern "C" fn trx_register_frontend(context: *mut std::ffi::c_void) {
let context = unsafe { &mut *(context as *mut FrontendRegistrationContext) };
context.register_frontend(FRONTEND_NAME, ExampleFrontend::spawn_frontend);
}
fn example_backend_factory(_access: RigAccess) -> DynResult<Box<dyn trx_core::rig::RigCat>> {
@@ -34,6 +41,7 @@ impl FrontendSpawner for ExampleFrontend {
_rig_tx: mpsc::Sender<RigRequest>,
_callsign: Option<String>,
listen_addr: SocketAddr,
_context: std::sync::Arc<FrontendRuntimeContext>,
) -> JoinHandle<()> {
tokio::spawn(async move {
info!("example frontend loaded at {} (no-op)", listen_addr);