feat: add cli execution contracts

This commit is contained in:
Evandro Fonseca Junior committed 2026-03-26 19:14:00 -03:00
1 parent 1881b63d7b
commit 812b486855
5 files changed
+54 -6

No files matched your search

+39 -2
View File
@@ -331,9 +331,46 @@ fn execution_contract(plan: &CommandPlan) -> ExecutionContract {
CommandPlan::SummaryOnly { command } => ExecutionContract::SummaryOnly {
command: command.clone(),
},
_ => ExecutionContract::SummaryOnly {
command: "unplanned".to_owned(),
CommandPlan::ProbeStatus {
api_key_present, ..
} => ExecutionContract::HttpGet {
path: "/health".to_owned(),
api_key_present: *api_key_present,
},
CommandPlan::ScanModels { models_dir } => ExecutionContract::LocalModelScan {
models_dir: models_dir.clone(),
},
CommandPlan::LoadModel {
models_dir,
model,
alias,
} => ExecutionContract::LocalModelLoad {
models_dir: models_dir.clone(),
model: model.clone(),
alias: alias.clone(),
},
CommandPlan::ConfigureAuth { mode, api_key } => ExecutionContract::LocalAuthConfig {
mode: *mode,
api_key: api_key.clone(),
},
CommandPlan::SetConfig { key, value } => ExecutionContract::LocalConfigWrite {
key: key.clone(),
value: value.clone(),
},
CommandPlan::RunThroughputBench {
api_key_present,
samples,
prompt_tokens,
completion_tokens,
..
} => ExecutionContract::ThroughputRequest {
path: "/v1/chat/completions".to_owned(),
api_key_present: *api_key_present,
samples: *samples,
prompt_tokens: *prompt_tokens,
completion_tokens: *completion_tokens,
},
CommandPlan::ReadLogs { lines } => ExecutionContract::LocalLogRead { lines: *lines },
}
}