use clap::{Args, Subcommand, ValueEnum};
#[derive(Debug, Args)]
pub(crate) struct TrustArgs {
#[command(subcommand)]
pub command: TrustCommand,
}
#[derive(Debug, Subcommand)]
pub(crate) enum TrustCommand {
Query(TrustQueryArgs),
VerifyChain(TrustVerifyChainArgs),
Export(TrustExportArgs),
Promote(TrustPromoteArgs),
Demote(TrustDemoteArgs),
}
#[derive(Debug, Clone, Copy, ValueEnum)]
pub(crate) enum TrustTierArg {
Shadow,
Suggest,
ActWithApproval,
ActAuto,
}
impl From<TrustTierArg> for harn_vm::AutonomyTier {
fn from(value: TrustTierArg) -> Self {
match value {
TrustTierArg::Shadow => harn_vm::AutonomyTier::Shadow,
TrustTierArg::Suggest => harn_vm::AutonomyTier::Suggest,
TrustTierArg::ActWithApproval => harn_vm::AutonomyTier::ActWithApproval,
TrustTierArg::ActAuto => harn_vm::AutonomyTier::ActAuto,
}
}
}
#[derive(Debug, Clone, Copy, ValueEnum)]
pub(crate) enum TrustOutcomeArg {
Success,
Failure,
Denied,
Timeout,
}
impl From<TrustOutcomeArg> for harn_vm::TrustOutcome {
fn from(value: TrustOutcomeArg) -> Self {
match value {
TrustOutcomeArg::Success => harn_vm::TrustOutcome::Success,
TrustOutcomeArg::Failure => harn_vm::TrustOutcome::Failure,
TrustOutcomeArg::Denied => harn_vm::TrustOutcome::Denied,
TrustOutcomeArg::Timeout => harn_vm::TrustOutcome::Timeout,
}
}
}
#[derive(Debug, Args)]
pub(crate) struct TrustQueryArgs {
#[arg(long)]
pub agent: Option<String>,
#[arg(long)]
pub action: Option<String>,
#[arg(long)]
pub since: Option<String>,
#[arg(long)]
pub until: Option<String>,
#[arg(long, value_enum)]
pub tier: Option<TrustTierArg>,
#[arg(long, value_enum)]
pub outcome: Option<TrustOutcomeArg>,
#[arg(long)]
pub limit: Option<usize>,
#[arg(long)]
pub grouped_by_trace: bool,
#[arg(long)]
pub json: bool,
#[arg(long)]
pub summary: bool,
}
#[derive(Debug, Args)]
pub(crate) struct TrustVerifyChainArgs {
#[arg(long)]
pub json: bool,
}
#[derive(Debug, Args)]
pub(crate) struct TrustExportArgs {
#[arg(long, short = 'o')]
pub output: Option<std::path::PathBuf>,
#[arg(long)]
pub compact: bool,
}
#[derive(Debug, Args)]
pub(crate) struct TrustPromoteArgs {
pub agent: String,
#[arg(long, value_enum)]
pub to: TrustTierArg,
}
#[derive(Debug, Args)]
pub(crate) struct TrustDemoteArgs {
pub agent: String,
#[arg(long, value_enum)]
pub to: TrustTierArg,
#[arg(long)]
pub reason: String,
}