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 locally discoverable 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 locally discoverable native runtimes. This is the default.
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 /// Load a model on a remote node through owner-control.
118 LoadModel {
119 /// Explicit owner-control endpoint token for the target node.
120 #[arg(long)]
121 endpoint: String,
122 /// Model canonical reference to load.
123 #[arg(long)]
124 model: String,
125 /// Optional runtime profile to apply.
126 #[arg(long)]
127 profile: Option<String>,
128 /// Console/API port of the local mesh-llm instance (default: 3131)
129 #[arg(long, default_value = "3131")]
130 port: u16,
131 /// Print machine-readable JSON.
132 #[arg(long)]
133 json: bool,
134 },
135 /// Unload a model on a remote node through owner-control.
136 UnloadModel {
137 /// Explicit owner-control endpoint token for the target node.
138 #[arg(long)]
139 endpoint: String,
140 /// Model canonical reference to unload.
141 #[arg(
142 long,
143 required_unless_present = "instance_id",
144 conflicts_with = "instance_id"
145 )]
146 model: Option<String>,
147 /// Exact instance ID to unload.
148 #[arg(long, required_unless_present = "model", conflicts_with = "model")]
149 instance_id: Option<String>,
150 /// Console/API port of the local mesh-llm instance (default: 3131)
151 #[arg(long, default_value = "3131")]
152 port: u16,
153 /// Print machine-readable JSON.
154 #[arg(long)]
155 json: bool,
156 },
157 /// Ensure a model is loaded on a remote node through owner-control.
158 EnsureModel {
159 /// Explicit owner-control endpoint token for the target node.
160 #[arg(long)]
161 endpoint: String,
162 /// Model canonical reference to ensure loaded.
163 #[arg(long)]
164 model: String,
165 /// Optional runtime profile to maintain.
166 #[arg(long)]
167 profile: Option<String>,
168 /// Console/API port of the local mesh-llm instance (default: 3131)
169 #[arg(long, default_value = "3131")]
170 port: u16,
171 /// Print machine-readable JSON.
172 #[arg(long)]
173 json: bool,
174 },
175 /// Drain and unload a model on a remote node through owner-control.
176 DrainModel {
177 /// Explicit owner-control endpoint token for the target node.
178 #[arg(long)]
179 endpoint: String,
180 /// Model canonical reference to drain.
181 #[arg(
182 long,
183 required_unless_present = "instance_id",
184 conflicts_with = "instance_id"
185 )]
186 model: Option<String>,
187 /// Exact instance ID to drain.
188 #[arg(long, required_unless_present = "model", conflicts_with = "model")]
189 instance_id: Option<String>,
190 /// Console/API port of the local mesh-llm instance (default: 3131)
191 #[arg(long, default_value = "3131")]
192 port: u16,
193 /// Print machine-readable JSON.
194 #[arg(long)]
195 json: bool,
196 },
197 /// Refresh local inventory on a remote owner-control endpoint through the local management API.
198 #[command(hide = true)]
199 RefreshInventory {
200 /// Explicit owner-control endpoint token for the target node.
201 #[arg(long)]
202 endpoint: String,
203 /// Console/API port of the local mesh-llm instance (default: 3131)
204 #[arg(long, default_value = "3131")]
205 port: u16,
206 /// Print the raw JSON payload.
207 #[arg(long)]
208 json: bool,
209 },
210 /// Apply config to a remote owner-control endpoint through the local management API.
211 #[command(hide = true)]
212 ApplyConfig {
213 /// Explicit owner-control endpoint token for the target node.
214 #[arg(long)]
215 endpoint: String,
216 /// Expected remote config revision for CAS.
217 #[arg(long)]
218 expected_revision: u64,
219 /// TOML config file to apply remotely.
220 #[arg(long)]
221 config: PathBuf,
222 /// Console/API port of the local mesh-llm instance (default: 3131)
223 #[arg(long, default_value = "3131")]
224 port: u16,
225 /// Print the raw JSON payload.
226 #[arg(long)]
227 json: bool,
228 },
229 /// Load a local model into a running mesh-llm instance.
230 #[command(hide = true)]
231 Load {
232 /// Model name/path/url to load
233 name: String,
234 /// Console/API port of the running mesh-llm instance (default: 3131)
235 #[arg(long, default_value = "3131")]
236 port: u16,
237 },
238 /// Unload a local model from a running mesh-llm instance.
239 #[command(alias = "drop", hide = true)]
240 Unload {
241 /// Model name to unload
242 name: String,
243 /// Console/API port of the running mesh-llm instance (default: 3131)
244 #[arg(long, default_value = "3131")]
245 port: u16,
246 },
247 /// Set mesh guardrail mode on running Skippy-backed models without restart.
248 #[command(hide = true)]
249 Guardrails {
250 /// Guardrail mode to apply to active Skippy-backed OpenAI surfaces.
251 #[arg(long, value_enum)]
252 mode: MeshGuardrailCliMode,
253 /// Console/API port of the running mesh-llm instance (default: 3131)
254 #[arg(long, default_value = "3131")]
255 port: u16,
256 /// Print the raw JSON payload.
257 #[arg(long)]
258 json: bool,
259 },
260}