scripts/dev/split_module.py (lexer-based, with 16 self-tests) moves the top-level fn and impl items of 59 oversize module files in control-plane, desktop-core, model-format, gateway-text, leleka-memory, experimental-ref, context, serving-policy, tokenizer, backend-api, quant-core, harmony, igpu, libc-shim, npu-service and runtime-client into foo/<name>.rs groups of about 250 lines; types, constants, macros, nested modules and tests stay, every path stays valid through pub use re-exports, restricted visibilities keep their scope one level down, include paths and super:: paths are shifted. Not touched: leleka-runtime, cuda-driver, native-cpu-expert, sampler-ref and cpu-* (hot path, next wave) and the files kar-off-ab edits. The baseline drops from 311 to 263 oversize files and from 273,600 to about 233,000 lines; the path-include ratchet ignores dir/name.rs child declarations.
58 lines
1.4 KiB
Rust
58 lines
1.4 KiB
Rust
//! One trusted local profile. RPC supplies actions, never commands or paths.
|
|
use crate::operation_journal::{Entries, Journal};
|
|
use crate::{
|
|
gateway::{self, Gateway},
|
|
node::proto::{WorkerCommand, WorkerOperation, WorkerState},
|
|
};
|
|
use serde::{Deserialize, Serialize};
|
|
use std::{
|
|
collections::BTreeMap,
|
|
net::{IpAddr, SocketAddr},
|
|
path::PathBuf,
|
|
process::Stdio,
|
|
sync::{Arc, Mutex},
|
|
time::Duration,
|
|
};
|
|
use tokio::{
|
|
process::{Child, Command},
|
|
sync::{mpsc, watch},
|
|
task::JoinHandle,
|
|
};
|
|
use tonic::Status;
|
|
#[derive(Clone, Deserialize, Serialize)]
|
|
#[serde(deny_unknown_fields)]
|
|
pub struct Profile {
|
|
pub schema_version: u32,
|
|
pub id: String,
|
|
pub model: String,
|
|
pub executable: PathBuf,
|
|
pub args: Vec<String>,
|
|
pub endpoint: SocketAddr,
|
|
pub startup_timeout_ms: u64,
|
|
/// Verified adapter capabilities, never inferred from the model name.
|
|
#[serde(default = "default_capabilities")]
|
|
pub capabilities: Vec<String>,
|
|
}
|
|
#[derive(Clone)]
|
|
pub struct Manager(Arc<Owner>);
|
|
struct Owner {
|
|
tx: mpsc::Sender<WorkerCommand>,
|
|
records: Records,
|
|
state: watch::Receiver<WorkerState>,
|
|
task: JoinHandle<()>,
|
|
gateway: Gateway,
|
|
}
|
|
struct History {
|
|
entries: Entries,
|
|
journal: Option<Journal>,
|
|
blocked: bool,
|
|
}
|
|
type Records = Arc<Mutex<History>>;
|
|
|
|
mod default_capabilities;
|
|
#[allow(unused_imports)]
|
|
pub use default_capabilities::*;
|
|
mod start;
|
|
#[allow(unused_imports)]
|
|
pub use start::*;
|