The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: files changed crates/openhuman-core/src/agent/orchestration/spawn_parallel_graph.rs,crates/op
Steven Enamakel240285d0cd19
diff --git a/crates/openhuman-core/src/agent/orchestration/spawn_parallel_graph.rs b/crates/openhuman-core/src/agent/orchestration/spawn_parallel_graph.rsindex f371da6dcb..e07a1c9c11 100644--- a/crates/openhuman-core/src/agent/orchestration/spawn_parallel_graph.rs+++ b/crates/openhuman-core/src/agent/orchestration/spawn_parallel_graph.rs@@ -12,7 +12,32 @@//! [`plan_shared_workspace_dispatch`](tinyagents_graph::parallel::plan_shared_workspace_dispatch).//! The rejection sentences stay here, which is why the crate reports conflicts//! as data.+//!+//! ## Module layout+//!+//! - [`request`] — request decoding and structural validation.+//! - [`types`] — shared worker/result/lineage types.+//! - [`staging`] — OpenHuman policy admission, shared-workspace arbitration,+//! worktree preflight, and progress projection for the `dispatch` phase.+//! - [`workers`] — the serial and `map_reduce` worker fanout.+//! - [`collect`] — collecting fanned-out results into the tool's final shape.+//! - [`graph`] — the fixed phase-graph scaffold and topology export.+//! - [`run`] — the public entry points that tie the above together.++mod collect;+mod graph;+mod request;+mod run;+mod staging;+mod types;+mod workers;++pub(crate) use collect::{format_spawn_parallel_success, SpawnParallelGraphOutcome};+pub(crate) use graph::spawn_parallel_graph_topology;+pub(crate) use request::{ParallelAgentTask, SpawnParallelTaskValidationError};+pub(crate) use run::run_spawn_parallel_graph_with_cancellation_and_workspace;+pub(crate) use staging::with_ownership_boundary;+pub(crate) use types::{ParallelAgentLineage, ParallelAgentResult};-include!("spawn_parallel_graph_part_01.rs");-include!("spawn_parallel_graph_part_02.rs");-include!("spawn_parallel_graph_part_03.rs");+#[cfg(test)]+pub(crate) use run::{run_spawn_parallel_graph, run_spawn_parallel_graph_with_cancellation};diff --git a/crates/openhuman-core/src/integrations/file_storage/tools/download.rs b/crates/openhuman-core/src/integrations/file_storage/tools/download.rsnew file mode 100644index 0000000000..2561936cad--- /dev/null+++ b/crates/openhuman-core/src/integrations/file_storage/tools/download.rs@@ -0,0 +1,162 @@+//! `storage_download_file` — download a stored file into the agent workspace.++use std::path::{Path, PathBuf};+use std::sync::Arc;++use async_trait::async_trait;+use serde_json::{json, Value};++use super::helpers::{+ action_dir_for_context, extension_for_content_type, file_path, readonly_autonomy_block,+ sanitize_filename, validate_file_id, DOWNLOADS_DIR,+};+use crate::integrations::IntegrationClient;+use crate::security::SecurityPolicy;+use crate::tools::traits::{PermissionLevel, Tool, ToolCallOptions, ToolCategory, ToolResult};+use tinytools::ToolRunContext;++pub struct StorageDownloadFileTool {+ client: Arc<IntegrationClient>,+ action_dir: PathBuf,+ security: Arc<SecurityPolicy>,+}++impl StorageDownloadFileTool {+ pub fn new(client: Arc<IntegrationClient>, action_dir: PathBuf) -> Self {+ Self::new_with_security(client, action_dir, Arc::new(SecurityPolicy::default()))+ }++ pub fn new_with_security(+ client: Arc<IntegrationClient>,+ action_dir: PathBuf,+ security: Arc<SecurityPolicy>,+ ) -> Self {+ Self {+ client,+ action_dir,+ security,+ }+ }++ async fn run(&self, args: Value, action_dir: &Path) -> anyhow::Result<ToolResult> {+ if let Some(blocked) = readonly_autonomy_block(&self.security) {+ return Ok(blocked);+ }++ let file_id = match validate_file_id(&args) {+ Ok(id) => id,+ Err(e) => return Ok(ToolResult::error(e)),+ };+ let requested_name = args+ .get("filename")+ .and_then(|v| v.as_str())+ .and_then(sanitize_filename);++ tracing::debug!("[file_storage] downloading file_id={file_id}");+ let (body, content_type, server_name) = match self+ .client+ .get_bytes(&file_path(&file_id, "/download"))+ .await+ {+ Ok(t) => t,+ Err(e) => return Ok(ToolResult::error(format!("File download failed: {e}"))),+ };++ // Naming: explicit arg > server Content-Disposition > file_id + a+ // content-type-derived extension (mirrors persist_media's scheme).+ let filename = requested_name+ .or_else(|| server_name.as_deref().and_then(sanitize_filename))+ .unwrap_or_else(|| {+ format!(+ "{file_id}.{}",+ extension_for_content_type(content_type.as_deref())+ )+ });++ let dir = action_dir.join(DOWNLOADS_DIR);+ if let Err(e) = tokio::fs::create_dir_all(&dir).await {+ return Ok(ToolResult::error(format!(+ "failed to create downloads dir {}: {e}",+ dir.display()+ )));+ }+ let path = dir.join(&filename);+ if let Err(e) = tokio::fs::write(&path, &body).await {+ return Ok(ToolResult::error(format!(+ "failed to write {}: {e}",+ path.display()+ )));+ }+ tracing::debug!(+ "[file_storage] saved file_id={} → {} ({} bytes)",+ file_id,+ path.display(),+ body.len()+ );++ let payload = json!({+ "file_id": file_id,+ "path": path.display().to_string(),+ "size": body.len(),+ "content_type": content_type,+ });+ Ok(ToolResult::success_with_markdown(+ payload,+ format!(+ "Downloaded file {} ({} bytes) → {}",+ file_id,+ body.len(),+ path.display()+ ),+ ))+ }+}++#[async_trait]+impl Tool for StorageDownloadFileTool {+ fn name(&self) -> &str {+ "storage_download_file"+ }++ fn description(&self) -> &str {+ "Download a file from managed cloud file storage into the agent workspace and \+ return the saved local path. Egress is billed at S3 rates plus margin."+ }++ fn parameters_schema(&self) -> Value {+ json!({+ "type": "object",+ "properties": {+ "file_id": { "type": "string", "description": "The stored file's id (from storage_upload_file / storage_list_files)" },+ "filename": { "type": "string", "description": "Optional local filename to save as (defaults to the stored filename)" }+ },+ "required": ["file_id"]+ })+ }++ fn category(&self) -> ToolCategory {+ ToolCategory::Workflow+ }++ fn permission_level(&self) -> PermissionLevel {+ PermissionLevel::Write+ }++ fn external_effect(&self) -> bool {+ true+ }++ async fn execute(&self, args: Value) -> anyhow::Result<ToolResult> {+ self.run(args, &self.action_dir).await+ }++ async fn execute_with_context(+ &self,+ args: Value,+ _options: ToolCallOptions,+ context: Option<&dyn ToolRunContext>,+ ) -> anyhow::Result<ToolResult> {+ let action_dir = action_dir_for_context(&self.action_dir, context, self.name());+ self.run(args, &action_dir).await+ }+}