objectiveai_sdk/cli/command/daemon/config/refresh_secret_signature_pair/
mod.rs1use crate::cli::command::CommandRequest;
4
5#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
6#[schemars(rename = "cli.command.daemon.config.refresh_secret_signature_pair.Request")]
7pub struct Request {
8 pub path_type: Path,
9 #[serde(flatten)]
10 pub base: crate::cli::command::RequestBase,
11}
12
13#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
14#[schemars(rename = "cli.command.daemon.config.refresh_secret_signature_pair.Path")]
15pub enum Path {
16 #[serde(rename = "daemon/config/refresh_secret_signature_pair")]
17 DaemonConfigRefreshSecretSignaturePair,
18}
19impl CommandRequest for Request {
20 fn request_base(&self) -> &crate::cli::command::RequestBase {
21 &self.base
22 }
23
24 fn request_base_mut(&mut self) -> Option<&mut crate::cli::command::RequestBase> {
25 Some(&mut self.base)
26 }
27}
28
29#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize, schemars::JsonSchema)]
30#[schemars(rename = "cli.command.daemon.config.refresh_secret_signature_pair.Response")]
31pub struct Response {
32 pub secret: String,
33 pub signature: String,
34}
35
36#[derive(clap::Args)]
37pub struct Args {
38 #[command(flatten)]
39 pub base: crate::cli::command::RequestBaseArgs,
40}
41
42#[derive(clap::Args)]
43#[command(args_conflicts_with_subcommands = true)]
44pub struct Command {
45 #[command(flatten)]
46 pub args: Args,
47 #[command(subcommand)]
48 pub schema: Option<Schema>,
49}
50
51#[derive(clap::Subcommand)]
52pub enum Schema {
53 RequestSchema(request_schema::Args),
55 ResponseSchema(response_schema::Args),
57}
58
59impl TryFrom<Args> for Request {
60 type Error = crate::cli::command::FromArgsError;
61 fn try_from(args: Args) -> Result<Self, Self::Error> {
62 Ok(Self {
63 path_type: Path::DaemonConfigRefreshSecretSignaturePair,
64 base: args.base.into(),
65 })
66 }
67}
68
69#[cfg(feature = "cli-executor")]
70pub async fn execute<E: crate::cli::command::CommandExecutor>(
71 executor: &E,
72 mut request: Request,
73
74 agent_arguments: Option<&crate::cli::command::AgentArguments>,
75 ) -> Result<Response, E::Error> {
76 request.base.clear_transform();
77 executor.execute_one(request, agent_arguments).await
78}
79
80#[cfg(feature = "cli-executor")]
81pub async fn execute_transform<E: crate::cli::command::CommandExecutor>(
82 executor: &E,
83 mut request: Request,
84 transform: crate::cli::command::Transform,
85
86 agent_arguments: Option<&crate::cli::command::AgentArguments>,
87 ) -> Result<serde_json::Value, E::Error> {
88 request.base.set_transform(transform);
89 executor.execute_one(request, agent_arguments).await
90}
91
92#[cfg(feature = "mcp")]
93impl crate::cli::command::CommandResponse for Response {
94 fn into_mcp(self) -> crate::cli::command::McpResponseItem {
95 crate::cli::command::McpResponseItem::JSONL(serde_json::to_value(self).unwrap())
96 }
97}
98
99pub mod request_schema;
100
101pub mod response_schema;
102
103#[cfg(feature = "cli-listener")]
108pub struct ListenerExecution {
109 pub request: Request,
110 pub agent_arguments: crate::cli::command::AgentArguments,
111 pub response: crate::cli::broadcast_listener::UnaryResponse<Response>,
112}