Skip to main content

mesh_llm_cli/
runtime.rs

1use clap::Subcommand;
2use std::path::PathBuf;
3
4use crate::MeshGuardrailCliMode;
5
6#[derive(Subcommand, Debug)]
7pub enum RuntimeCommand {
8    /// List available or installed native runtimes.
9    List {
10        /// List release-manifest or bundled runtimes instead of installed runtimes.
11        #[arg(long, conflicts_with = "installed")]
12        available: bool,
13        /// List installed native runtimes. This is the default when no list mode is supplied.
14        #[arg(long, conflicts_with = "available")]
15        installed: bool,
16        /// Release manifest JSON to inspect.
17        #[arg(long)]
18        manifest: Option<PathBuf>,
19        /// Packaged native runtime directory to inspect. Repeatable.
20        #[arg(long = "bundle-dir")]
21        bundle_dirs: Vec<PathBuf>,
22        /// Override the native runtime cache root.
23        #[arg(long)]
24        cache_dir: Option<PathBuf>,
25        /// Print machine-readable JSON.
26        #[arg(long)]
27        json: bool,
28    },
29    /// Install the recommended native runtime, or an explicit flavor/runtime ID.
30    Install {
31        /// Optional runtime flavor or native runtime ID. Omit to install the recommended runtime.
32        runtime: Option<String>,
33        /// Release manifest JSON to resolve against.
34        #[arg(long)]
35        manifest: Option<PathBuf>,
36        /// Packaged native runtime directory to install from. Repeatable.
37        #[arg(long = "bundle-dir")]
38        bundle_dirs: Vec<PathBuf>,
39        /// Override the native runtime cache root.
40        #[arg(long)]
41        cache_dir: Option<PathBuf>,
42        /// Print machine-readable JSON.
43        #[arg(long)]
44        json: bool,
45    },
46    /// Remove an installed native runtime.
47    Remove {
48        /// Native runtime ID to remove.
49        native_runtime_id: String,
50        /// MeshLLM version. Defaults to the running MeshLLM version.
51        #[arg(long)]
52        mesh_version: Option<String>,
53        /// Override the native runtime cache root.
54        #[arg(long)]
55        cache_dir: Option<PathBuf>,
56        /// Print machine-readable JSON.
57        #[arg(long)]
58        json: bool,
59    },
60    /// Prune old native runtimes from the cache.
61    Prune {
62        /// Remove every runtime not matching the active MeshLLM version.
63        #[arg(long)]
64        active_only: bool,
65        /// Override the active MeshLLM version. Defaults to the running version.
66        #[arg(long)]
67        mesh_version: Option<String>,
68        /// Override the native runtime cache root.
69        #[arg(long)]
70        cache_dir: Option<PathBuf>,
71        /// Print machine-readable JSON.
72        #[arg(long)]
73        json: bool,
74    },
75    /// Show local model status on a running mesh-llm instance.
76    #[command(hide = true)]
77    Status {
78        /// Console/API port of the running mesh-llm instance (default: 3131)
79        #[arg(long, default_value = "3131")]
80        port: u16,
81    },
82    /// Show the local-only owner-control bootstrap policy for a running mesh-llm instance.
83    #[command(hide = true)]
84    Bootstrap {
85        /// Console/API port of the running mesh-llm instance (default: 3131)
86        #[arg(long, default_value = "3131")]
87        port: u16,
88        /// Print the raw JSON payload.
89        #[arg(long)]
90        json: bool,
91    },
92    /// Fetch config from a remote owner-control endpoint through the local management API.
93    #[command(hide = true)]
94    GetConfig {
95        /// Explicit owner-control endpoint token for the target node.
96        #[arg(long)]
97        endpoint: String,
98        /// Console/API port of the local mesh-llm instance (default: 3131)
99        #[arg(long, default_value = "3131")]
100        port: u16,
101        /// Print the raw JSON payload.
102        #[arg(long)]
103        json: bool,
104    },
105    /// Scan and refresh inventory on a remote owner-control endpoint.
106    ScanRefresh {
107        /// Explicit owner-control endpoint token for the target node.
108        #[arg(long)]
109        endpoint: String,
110        /// Console/API port of the local mesh-llm instance (default: 3131)
111        #[arg(long, default_value = "3131")]
112        port: u16,
113        /// Print the raw JSON payload.
114        #[arg(long)]
115        json: bool,
116    },
117    /// Refresh local inventory on a remote owner-control endpoint through the local management API.
118    #[command(hide = true)]
119    RefreshInventory {
120        /// Explicit owner-control endpoint token for the target node.
121        #[arg(long)]
122        endpoint: String,
123        /// Console/API port of the local mesh-llm instance (default: 3131)
124        #[arg(long, default_value = "3131")]
125        port: u16,
126        /// Print the raw JSON payload.
127        #[arg(long)]
128        json: bool,
129    },
130    /// Apply config to a remote owner-control endpoint through the local management API.
131    #[command(hide = true)]
132    ApplyConfig {
133        /// Explicit owner-control endpoint token for the target node.
134        #[arg(long)]
135        endpoint: String,
136        /// Expected remote config revision for CAS.
137        #[arg(long)]
138        expected_revision: u64,
139        /// TOML config file to apply remotely.
140        #[arg(long)]
141        config: PathBuf,
142        /// Console/API port of the local mesh-llm instance (default: 3131)
143        #[arg(long, default_value = "3131")]
144        port: u16,
145        /// Print the raw JSON payload.
146        #[arg(long)]
147        json: bool,
148    },
149    /// Load a local model into a running mesh-llm instance.
150    #[command(hide = true)]
151    Load {
152        /// Model name/path/url to load
153        name: String,
154        /// Console/API port of the running mesh-llm instance (default: 3131)
155        #[arg(long, default_value = "3131")]
156        port: u16,
157    },
158    /// Unload a local model from a running mesh-llm instance.
159    #[command(alias = "drop", hide = true)]
160    Unload {
161        /// Model name to unload
162        name: String,
163        /// Console/API port of the running mesh-llm instance (default: 3131)
164        #[arg(long, default_value = "3131")]
165        port: u16,
166    },
167    /// Set mesh guardrail mode on running Skippy-backed models without restart.
168    #[command(hide = true)]
169    Guardrails {
170        /// Guardrail mode to apply to active Skippy-backed OpenAI surfaces.
171        #[arg(long, value_enum)]
172        mode: MeshGuardrailCliMode,
173        /// Console/API port of the running mesh-llm instance (default: 3131)
174        #[arg(long, default_value = "3131")]
175        port: u16,
176        /// Print the raw JSON payload.
177        #[arg(long)]
178        json: bool,
179    },
180}