Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ channel_versions = { path = "crates/channel_versions", default-features = false
command = { path = "crates/command" }
command-signatures-v2 = { path = "crates/command-signatures-v2" }
cloud_objects = { path = "crates/cloud_objects" }
cloud_object_client = { path = "crates/cloud_object_client" }
cloud_object_models = { path = "crates/cloud_object_models" }
computer_use = { path = "crates/computer_use" }
field_mask = { path = "crates/field_mask" }
firebase = { path = "crates/firebase" }
Expand Down Expand Up @@ -197,6 +199,7 @@ openh264 = "0.8"
static_assertions = "1.1.0"
url = "2.5.4"
urlocator = "0.1.4"
mockall = "0.13.1"
objc = "0.2"
objc2 = "0.6.3"
objc2-app-kit = { version = "0.3.2", default-features = false, features = ["NSScreen", "objc2-core-foundation"] }
Expand Down
6 changes: 5 additions & 1 deletion app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ cfg-if.workspace = true
channel_versions.workspace = true
chrono.workspace = true
clap.workspace = true
cloud_object_client.workspace = true
cloud_object_models.workspace = true
cloud_objects.workspace = true
command = { workspace = true }
command-corrections.workspace = true
Expand Down Expand Up @@ -397,8 +399,9 @@ jsonschema = { workspace = true, default-features = false }
async-executor = "1.5.1"
command = { workspace = true, features = ["test-util"] }
ctor = "0.1.18"
cloud_object_client = { workspace = true, features = ["test-util"] }
http_client = { workspace = true, features = ["test-util"] }
mockall = "0.13.1"
mockall.workspace = true
mockito.workspace = true
serial_test = "0.8.0"
sum_tree = { workspace = true, features = ["test-util"] }
Expand Down Expand Up @@ -798,6 +801,7 @@ voice_input = ["dep:voice_input"]
system_theme = []
tab_close_button_on_left = []
team_features_override = []
test-util = ["cloud_object_client/test-util"]
team_workflows = ["team_features_override"]
toggle_bootstrap_block = []
# Feature enabled only when app is compiled for integration tests.
Expand Down
1 change: 1 addition & 0 deletions app/src/ai/agent/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use crate::ai::agent::conversation::AIConversationId;
use crate::ai::ambient_agents::AmbientAgentTaskId;
use crate::ai::blocklist::{BlocklistAIPermissions, RequestInput, SessionContext};
use crate::ai::execution_profiles::profiles::AIExecutionProfilesModel;
use crate::ai::execution_profiles::AIExecutionProfileAppExt;
use crate::ai::llms::LLMId;
use crate::ai::mcp::templatable_manager::TemplatableMCPServerInfo;
use crate::ai::mcp::TemplatableMCPServerManager;
Expand Down
20 changes: 1 addition & 19 deletions app/src/ai/agent/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3030,25 +3030,7 @@ pub struct RequestMetadata {
pub is_auto_resume_after_error: bool,
}

/// A globally unique ID for a suggested objects.
///
/// This is used for telemetry purposes to track and connect both:
/// - Suggested objects generated by the AI agent
/// - The corresponding objects stored in the cloud (if the suggestion was accepted)
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash)]
pub struct SuggestedLoggingId(String);

impl Display for SuggestedLoggingId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}

impl From<String> for SuggestedLoggingId {
fn from(value: String) -> Self {
Self(value)
}
}
pub use cloud_object_models::SuggestedLoggingId;

#[derive(Debug, Clone, Eq, PartialEq)]
pub struct SuggestedRule {
Expand Down
56 changes: 7 additions & 49 deletions app/src/ai/ambient_agents/scheduled.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
use std::collections::HashMap;
use std::future::Future;

pub use cloud_object_models::{
CloudScheduledAmbientAgent, CloudScheduledAmbientAgentModel, ScheduledAmbientAgent,
};
use futures::channel::oneshot;
use futures::FutureExt;
use serde::{Deserialize, Serialize};
use serde_json::{Map, Value};
use warp_graphql::queries::get_scheduled_agent_history::ScheduledAgentHistory;
use warpui::{AppContext, Entity, ModelContext, SingletonEntity};

use super::AgentConfigSnapshot;
use crate::cloud_object::model::generic_string_model::{
GenericStringModel, GenericStringObjectId, StringModel,
};
use crate::cloud_object::model::json_model::{JsonModel, JsonSerializer};
use crate::cloud_object::model::generic_string_model::StringModel;
use crate::cloud_object::model::json_model::JsonModel;
use crate::cloud_object::model::persistence::CloudModel;
use crate::cloud_object::{
CloudObjectLookup as _, GenericCloudObject, GenericStringObjectFormat,
GenericStringObjectUniqueKey, JsonObjectType, Owner, Revision,
CloudObjectLookup as _, GenericStringObjectFormat, GenericStringObjectUniqueKey,
JsonObjectType, Owner, Revision,
};
use crate::drive::CloudObjectTypeAndId;
use crate::server::cloud_objects::update_manager::{
Expand All @@ -26,47 +25,6 @@ use crate::server::ids::{ClientId, SyncId};
use crate::server::server_api::ServerApiProvider;
use crate::server::sync_queue::QueueItem;

#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
/// A ScheduledAmbientAgent represents configuration for ambient agents that run on a cron schedule.
pub struct ScheduledAmbientAgent {
/// Agent name
#[serde(default)]
pub name: String,
/// Cron schedule expression
#[serde(default)]
pub cron_schedule: String,
/// Whether the scheduled agent is enabled
#[serde(default)]
pub enabled: bool,
/// The prompt to use for the scheduled agent
#[serde(default)]
pub prompt: String,
/// The latest failure to execute this scheduled agent.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub last_spawn_error: Option<String>,
/// Configuration for how the ambient agent should run.
#[serde(default, skip_serializing_if = "AgentConfigSnapshot::is_empty")]
pub agent_config: AgentConfigSnapshot,
}

pub type CloudScheduledAmbientAgent =
GenericCloudObject<GenericStringObjectId, CloudScheduledAmbientAgentModel>;
pub type CloudScheduledAmbientAgentModel =
GenericStringModel<ScheduledAmbientAgent, JsonSerializer>;

impl ScheduledAmbientAgent {
pub fn new(name: String, cron_schedule: String, enabled: bool, prompt: String) -> Self {
Self {
name,
cron_schedule,
enabled,
prompt,
last_spawn_error: None,
agent_config: Default::default(),
}
}
}

impl StringModel for ScheduledAmbientAgent {
type CloudObjectType = CloudScheduledAmbientAgent;

Expand Down
Loading
Loading