first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
+6 -77
View File
@@ -1,75 +1,11 @@
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
pub use cloud_object_models::{AgentConfig, CloudAgentConfig, CloudAgentConfigModel};
use crate::{
cloud_object::{
model::{
generic_string_model::{GenericStringModel, GenericStringObjectId, StringModel},
json_model::{JsonModel, JsonSerializer},
persistence::CloudModel,
},
GenericCloudObject, GenericStringObjectFormat, GenericStringObjectUniqueKey,
JsonObjectType, Revision, ServerCloudObject,
},
server::{ids::SyncId, server_api::ai::AgentConfigSnapshot, sync_queue::QueueItem},
use crate::cloud_object::model::generic_string_model::StringModel;
use crate::cloud_object::model::json_model::JsonModel;
use crate::cloud_object::{
GenericStringObjectFormat, GenericStringObjectUniqueKey, JsonObjectType, Revision,
};
use galaxyui::{AppContext, SingletonEntity as _};
/// A CloudAgentConfig represents a saved agent configuration that can be referenced
/// when running agents via `--agent-id`.
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Default)]
pub struct AgentConfig {
/// Configuration name
pub name: String,
/// Base model ID to use for the agent
#[serde(skip_serializing_if = "Option::is_none")]
pub base_model_id: Option<String>,
/// Base prompt to prepend to user prompts
#[serde(skip_serializing_if = "Option::is_none")]
pub base_prompt: Option<String>,
/// MCP servers configuration
#[serde(skip_serializing_if = "Option::is_none")]
pub mcp_servers: Option<HashMap<String, serde_json::Value>>,
}
pub type CloudAgentConfig = GenericCloudObject<GenericStringObjectId, CloudAgentConfigModel>;
pub type CloudAgentConfigModel = GenericStringModel<AgentConfig, JsonSerializer>;
impl AgentConfig {
/// Convert to AgentConfigSnapshot for use in agent execution.
///
/// Note: `AgentConfig` matches the server's JSON format (e.g. `base_model_id`),
/// while `AgentConfigSnapshot` is the runtime config format (e.g. `model_id`).
pub fn to_ambient_config(&self) -> AgentConfigSnapshot {
AgentConfigSnapshot {
name: Some(self.name.clone()),
environment_id: None,
model_id: self.base_model_id.clone(),
base_prompt: self.base_prompt.clone(),
mcp_servers: self.mcp_servers.clone().map(|m| m.into_iter().collect()),
profile_id: None,
worker_host: None,
skill_spec: None,
computer_use_enabled: None,
harness: None,
harness_auth_secrets: None,
}
}
}
impl CloudAgentConfig {
pub fn get_all(app: &AppContext) -> Vec<CloudAgentConfig> {
CloudModel::as_ref(app)
.get_all_objects_of_type::<GenericStringObjectId, CloudAgentConfigModel>()
.cloned()
.collect()
}
pub fn get_by_id<'a>(sync_id: &'a SyncId, app: &'a AppContext) -> Option<&'a CloudAgentConfig> {
CloudModel::as_ref(app)
.get_object_of_type::<GenericStringObjectId, CloudAgentConfigModel>(sync_id)
}
}
use crate::server::sync_queue::QueueItem;
impl StringModel for AgentConfig {
type CloudObjectType = CloudAgentConfig;
@@ -106,13 +42,6 @@ impl StringModel for AgentConfig {
None
}
fn new_from_server_update(&self, server_cloud_object: &ServerCloudObject) -> Option<Self> {
if let ServerCloudObject::CloudAgentConfig(server_config) = server_cloud_object {
return Some(server_config.model.clone().string_model);
}
None
}
fn should_show_activity_toasts() -> bool {
false
}