feat: init
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
use crate::models::common::{AgentType, Status, Visibility};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct Agent {
|
||||
pub id: Uuid,
|
||||
pub owner_id: Uuid,
|
||||
pub workspace_id: Option<Uuid>,
|
||||
pub name: String,
|
||||
pub slug: String,
|
||||
pub description: Option<String>,
|
||||
pub avatar_url: Option<String>,
|
||||
pub agent_type: AgentType,
|
||||
pub status: Status,
|
||||
pub visibility: Visibility,
|
||||
pub default_model_id: Option<Uuid>,
|
||||
pub current_version_id: Option<Uuid>,
|
||||
pub system_prompt: Option<String>,
|
||||
pub tools: Vec<String>,
|
||||
pub tags: Vec<String>,
|
||||
pub enabled: bool,
|
||||
pub last_run_at: Option<DateTime<Utc>>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
pub deleted_at: Option<DateTime<Utc>>,
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
use crate::models::common::EventType;
|
||||
use crate::models::json_types::{AgentEventFilters, TypedJson};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct AgentEventSubscription {
|
||||
pub id: Uuid,
|
||||
pub agent_id: Uuid,
|
||||
pub workspace_id: Option<Uuid>,
|
||||
pub repo_id: Option<Uuid>,
|
||||
pub event_type: EventType,
|
||||
pub filters: Option<TypedJson<AgentEventFilters>>,
|
||||
pub enabled: bool,
|
||||
pub created_by: Uuid,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
use crate::models::common::{JsonValue, Status, StepType};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct AgentExecutionStep {
|
||||
pub id: Uuid,
|
||||
pub execution_id: Uuid,
|
||||
pub step_index: i32,
|
||||
pub step_type: StepType,
|
||||
pub name: String,
|
||||
pub status: Status,
|
||||
pub model_id: Option<Uuid>,
|
||||
pub tool_name: Option<String>,
|
||||
pub input: Option<JsonValue>,
|
||||
pub output: Option<JsonValue>,
|
||||
pub error_message: Option<String>,
|
||||
pub token_input_count: Option<i32>,
|
||||
pub token_output_count: Option<i32>,
|
||||
pub started_at: Option<DateTime<Utc>>,
|
||||
pub finished_at: Option<DateTime<Utc>>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
use crate::models::common::{JsonValue, Status, TriggerType};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct AgentExecution {
|
||||
pub id: Uuid,
|
||||
pub agent_id: Uuid,
|
||||
pub agent_version_id: Option<Uuid>,
|
||||
pub workspace_id: Option<Uuid>,
|
||||
pub repo_id: Option<Uuid>,
|
||||
pub issue_id: Option<Uuid>,
|
||||
pub pull_request_id: Option<Uuid>,
|
||||
pub triggered_by: Option<Uuid>,
|
||||
pub trigger_type: TriggerType,
|
||||
pub status: Status,
|
||||
pub input: Option<JsonValue>,
|
||||
pub output: Option<JsonValue>,
|
||||
pub error_message: Option<String>,
|
||||
pub started_at: Option<DateTime<Utc>>,
|
||||
pub finished_at: Option<DateTime<Utc>>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
use crate::models::common::{FeedbackType, JsonValue};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct AgentFeedback {
|
||||
pub id: Uuid,
|
||||
pub agent_id: Uuid,
|
||||
pub execution_id: Option<Uuid>,
|
||||
pub user_id: Uuid,
|
||||
pub rating: i32,
|
||||
pub feedback_type: FeedbackType,
|
||||
pub comment: Option<String>,
|
||||
pub metadata: Option<JsonValue>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
use crate::models::json_types::{AgentSchedulePayload, TypedJson};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct AgentSchedule {
|
||||
pub id: Uuid,
|
||||
pub agent_id: Uuid,
|
||||
pub workspace_id: Option<Uuid>,
|
||||
pub repo_id: Option<Uuid>,
|
||||
pub name: String,
|
||||
pub cron_expr: String,
|
||||
pub timezone: String,
|
||||
pub payload: Option<TypedJson<AgentSchedulePayload>>,
|
||||
pub enabled: bool,
|
||||
pub last_run_at: Option<DateTime<Utc>>,
|
||||
pub next_run_at: Option<DateTime<Utc>>,
|
||||
pub created_by: Uuid,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
use crate::models::json_types::{AgentVersionConfig, TypedJson};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct AgentVersion {
|
||||
pub id: Uuid,
|
||||
pub agent_id: Uuid,
|
||||
pub version: String,
|
||||
pub name: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub model_id: Option<Uuid>,
|
||||
pub system_prompt: String,
|
||||
pub instructions: Option<String>,
|
||||
pub tools: Vec<String>,
|
||||
pub config: Option<TypedJson<AgentVersionConfig>>,
|
||||
pub changelog: Option<String>,
|
||||
pub stable: bool,
|
||||
pub published_by: Uuid,
|
||||
pub published_at: Option<DateTime<Utc>>,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
use crate::models::common::{Permission, Role};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, sqlx::FromRow)]
|
||||
pub struct AgentWorkspaceBinding {
|
||||
pub id: Uuid,
|
||||
pub agent_id: Uuid,
|
||||
pub workspace_id: Uuid,
|
||||
pub repo_id: Option<Uuid>,
|
||||
pub role: Role,
|
||||
pub permissions: Vec<Permission>,
|
||||
pub enabled: bool,
|
||||
pub bound_by: Uuid,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
pub mod agent;
|
||||
pub mod agent_event_subscriptions;
|
||||
pub mod agent_execution_steps;
|
||||
pub mod agent_executions;
|
||||
pub mod agent_feedback;
|
||||
pub mod agent_schedules;
|
||||
pub mod agent_versions;
|
||||
pub mod agent_workspace_bindings;
|
||||
|
||||
pub use agent::Agent;
|
||||
pub use agent_event_subscriptions::AgentEventSubscription;
|
||||
pub use agent_execution_steps::AgentExecutionStep;
|
||||
pub use agent_executions::AgentExecution;
|
||||
pub use agent_feedback::AgentFeedback;
|
||||
pub use agent_schedules::AgentSchedule;
|
||||
pub use agent_versions::AgentVersion;
|
||||
pub use agent_workspace_bindings::AgentWorkspaceBinding;
|
||||
Reference in New Issue
Block a user