adk_studio/schema/
project.rs1use serde::{Deserialize, Serialize};
2use std::collections::HashMap;
3use uuid::Uuid;
4
5use super::{AgentSchema, ToolConfig, ToolSchema, WorkflowSchema};
6
7#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct ProjectSchema {
10 pub id: Uuid,
11 pub version: String,
12 pub name: String,
13 #[serde(default)]
14 pub description: String,
15 #[serde(default)]
16 pub settings: ProjectSettings,
17 #[serde(default)]
18 pub agents: HashMap<String, AgentSchema>,
19 #[serde(default)]
20 pub tools: HashMap<String, ToolSchema>,
21 #[serde(default)]
22 pub tool_configs: HashMap<String, ToolConfig>,
23 #[serde(default)]
24 pub workflow: WorkflowSchema,
25 #[serde(default)]
26 pub created_at: chrono::DateTime<chrono::Utc>,
27 #[serde(default)]
28 pub updated_at: chrono::DateTime<chrono::Utc>,
29}
30
31impl ProjectSchema {
32 pub fn new(name: impl Into<String>) -> Self {
33 let now = chrono::Utc::now();
34 Self {
35 id: Uuid::new_v4(),
36 version: "1.0".to_string(),
37 name: name.into(),
38 description: String::new(),
39 settings: ProjectSettings::default(),
40 agents: HashMap::new(),
41 tools: HashMap::new(),
42 tool_configs: HashMap::new(),
43 workflow: WorkflowSchema::default(),
44 created_at: now,
45 updated_at: now,
46 }
47 }
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize, Default)]
52pub struct ProjectSettings {
53 #[serde(default = "default_model")]
54 pub default_model: String,
55 #[serde(default)]
56 pub env_vars: HashMap<String, String>,
57}
58
59fn default_model() -> String {
60 "gemini-2.0-flash".to_string()
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize)]
65pub struct ProjectMeta {
66 pub id: Uuid,
67 pub name: String,
68 pub description: String,
69 pub updated_at: chrono::DateTime<chrono::Utc>,
70}
71
72impl From<&ProjectSchema> for ProjectMeta {
73 fn from(p: &ProjectSchema) -> Self {
74 Self {
75 id: p.id,
76 name: p.name.clone(),
77 description: p.description.clone(),
78 updated_at: p.updated_at,
79 }
80 }
81}