objectiveai_sdk/cli/command/
agent_arguments.rs1#[derive(
32 Debug,
33 Clone,
34 Default,
35 PartialEq,
36 Eq,
37 serde::Serialize,
38 serde::Deserialize,
39 schemars::JsonSchema,
40)]
41#[schemars(rename = "cli.command.AgentArguments")]
42pub struct AgentArguments {
43 #[serde(default, skip_serializing_if = "Option::is_none")]
44 #[schemars(extend("omitempty" = true))]
45 pub agent_instance_hierarchy: Option<String>,
46 #[serde(default, skip_serializing_if = "Option::is_none")]
47 #[schemars(extend("omitempty" = true))]
48 pub agent_id: Option<String>,
49 #[serde(default, skip_serializing_if = "Option::is_none")]
50 #[schemars(extend("omitempty" = true))]
51 pub agent_full_id: Option<String>,
52 #[serde(default, skip_serializing_if = "Option::is_none")]
53 #[schemars(extend("omitempty" = true))]
54 pub agent_remote: Option<String>,
55 #[serde(default, skip_serializing_if = "Option::is_none")]
56 #[schemars(extend("omitempty" = true))]
57 pub response_id: Option<String>,
58 #[serde(default, skip_serializing_if = "Option::is_none")]
59 #[schemars(extend("omitempty" = true))]
60 pub response_ids: Option<String>,
61 #[serde(default, skip_serializing_if = "Option::is_none")]
62 #[schemars(extend("omitempty" = true))]
63 pub plugin_owner: Option<String>,
64 #[serde(default, skip_serializing_if = "Option::is_none")]
65 #[schemars(extend("omitempty" = true))]
66 pub plugin_repository: Option<String>,
67 #[serde(default, skip_serializing_if = "Option::is_none")]
68 #[schemars(extend("omitempty" = true))]
69 pub plugin_version: Option<String>,
70}
71
72impl AgentArguments {
73 #[cfg(feature = "cli-executor")]
79 pub fn apply_to_command(&self, command: &mut tokio::process::Command) {
80 let pairs: [(&str, &Option<String>); 9] = [
81 (
82 "OBJECTIVEAI_AGENT_INSTANCE_HIERARCHY",
83 &self.agent_instance_hierarchy,
84 ),
85 ("OBJECTIVEAI_AGENT_ID", &self.agent_id),
86 ("OBJECTIVEAI_AGENT_FULL_ID", &self.agent_full_id),
87 ("OBJECTIVEAI_AGENT_REMOTE", &self.agent_remote),
88 ("OBJECTIVEAI_RESPONSE_ID", &self.response_id),
89 ("OBJECTIVEAI_RESPONSE_IDS", &self.response_ids),
90 ("OBJECTIVEAI_PLUGIN_OWNER", &self.plugin_owner),
91 ("OBJECTIVEAI_PLUGIN_REPOSITORY", &self.plugin_repository),
92 ("OBJECTIVEAI_PLUGIN_VERSION", &self.plugin_version),
93 ];
94 for (name, value) in pairs {
95 match value {
96 Some(v) => {
97 command.env(name, v);
98 }
99 None => {
100 command.env_remove(name);
101 }
102 }
103 }
104 }
105}