AppState (app/state.rs) is now lifecycle + EngineLink (client port, control channel, worker status, pool, queue timeout) + HttpPolicy (api key, CORS, trusted origins) + ModelView (name, aliases, tokenizer, template, vision port, prefix-cache and memory views) + Services (response store, monitor, MCP port, settings, clock, started_at). Field uses were rewritten mechanically (state.worker -> state.engine.worker, ...); no handler logic changed. The old impl_default_for_appstate.rs, which held the route table and the admin handlers, is app/routes.rs, app/admin_routes.rs and app/readiness.rs. main.rs (1156 lines: an 840-line argument match, the serve function, two helpers) is now 8 lines. The argument match is split into command groups under src/cli/ (operations, model_fetch, model_inspect, model_ensure, model_prepare, kar_inspect, kar_verify, kar_overlay, model_text; each owns its arms in their old order and answers Ok(false) for a line it does not own), serve() and shutdown_signal() are src/serve.rs (the composition root), the usage text is cli/usage.rs. The binary name and every command line are unchanged. Architecture gate: control-plane/src/main.rs leaves the oversize list (1156 -> 8). --allow-increase was used because the type change forces the AppState struct literals in seven already-oversize test/example files to nest by group: cp_replay.rs +7, responses/tests.rs +11, backend_worker_http.rs +14, mcp_hub.rs +3, memory_gate_http.rs +7, vision_http.rs +6, desktop-core api_over_runtime.rs +6 (55 lines in all, against 1148 lines removed from main.rs). Test outcomes are unchanged (597 ok / 2 ignored before and after, 14 new tests from S16).
32 lines
806 B
Rust
32 lines
806 B
Rust
//! Command-line dispatch of `strata-next`: each group of commands owns its own match, in this order.
|
|
|
|
mod kar_inspect;
|
|
mod kar_overlay;
|
|
mod kar_verify;
|
|
mod model_ensure;
|
|
mod model_fetch;
|
|
mod model_inspect;
|
|
mod model_prepare;
|
|
mod model_text;
|
|
mod operations;
|
|
mod report;
|
|
mod usage;
|
|
|
|
use strata_control::BoxError;
|
|
|
|
pub async fn run(args: &[String]) -> Result<(), BoxError> {
|
|
if operations::run(args).await?
|
|
|| model_fetch::run(args).await?
|
|
|| model_inspect::run(args).await?
|
|
|| model_ensure::run(args).await?
|
|
|| model_prepare::run(args).await?
|
|
|| kar_inspect::run(args).await?
|
|
|| kar_verify::run(args).await?
|
|
|| kar_overlay::run(args).await?
|
|
|| model_text::run(args).await?
|
|
{
|
|
return Ok(());
|
|
}
|
|
Err(usage::USAGE.into())
|
|
}
|