mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-30 23:14:37 +00:00
* refactor(agent): update default model configuration and pricing structure - Changed the default model name in `AgentBuilder` to use a constant `DEFAULT_MODEL` instead of a hardcoded string. - Introduced new model constants (`MODEL_AGENTIC_V1`, `MODEL_CODING_V1`, `MODEL_REASONING_V1`) in `types.rs` for better clarity and maintainability. - Refactored the pricing structure in `identity_cost.rs` to utilize the new model constants, improving consistency across the pricing definitions. These changes enhance the configurability and readability of the agent's model and pricing settings. * refactor(models): update default model references and suggestions - Replaced hardcoded model names with a constant `DEFAULT_MODEL` in multiple files to enhance maintainability. - Updated model suggestions in the `TauriCommandsPanel` and `Conversations` components to reflect new model names, improving user experience and consistency across the application. These changes streamline model management and ensure that the application uses the latest model configurations. * style: fix Prettier formatting for model suggestions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat(agent): introduce multi-agent harness with archetypes and task DAG - Added a new module for the multi-agent harness, defining 8 specialized archetypes (Orchestrator, Planner, CodeExecutor, SkillsAgent, ToolMaker, Researcher, Critic, Archivist) to enhance task management and execution. - Implemented a Directed Acyclic Graph (DAG) structure for task planning, allowing the Planner archetype to create and manage task dependencies. - Introduced a session queue to serialize tasks within sessions, preventing race conditions and enabling parallelism across different sessions. - Updated configuration schema to support orchestrator settings, including per-archetype configurations and maximum concurrent agents. These changes significantly improve the agent's architecture, enabling more complex task management and execution strategies. * feat(agent): implement orchestrator executor and interrupt handling - Introduced a new `executor.rs` module for orchestrated multi-agent execution, enabling a structured run loop that includes planning, executing, reviewing, and synthesizing tasks. - Added an `interrupt.rs` module to handle graceful interruptions via SIGINT and `/stop` commands, ensuring running sub-agents can be cancelled and memory flushed appropriately. - Implemented a self-healing interceptor in `self_healing.rs` to automatically create polyfill scripts for missing commands, enhancing the robustness of tool execution. - Updated the `mod.rs` file to include new modules and functionalities, improving the overall architecture of the agent harness. These changes significantly enhance the agent's capabilities in managing multi-agent workflows and handling interruptions effectively. * feat(agent): implement orchestrator executor and interrupt handling - Introduced a new `executor.rs` module for orchestrated multi-agent execution, enabling a structured run loop that includes planning, executing, reviewing, and synthesizing tasks. - Added an `interrupt.rs` module to handle graceful interruptions via SIGINT and `/stop` commands, ensuring running sub-agents are cancelled and memory is flushed. - Implemented a `SelfHealingInterceptor` in `self_healing.rs` to automatically generate polyfill scripts for missing commands, enhancing the agent's resilience. - Updated the `mod.rs` file to include new modules and functionalities, improving the overall architecture of the agent harness. These changes significantly enhance the agent's ability to manage complex tasks and respond to interruptions effectively. * feat(agent): add context assembly module for orchestrator - Introduced a new `context_assembly.rs` module to handle the assembly of the bootstrap context for the orchestrator, integrating identity files, workspace state, and relevant memory. - Implemented functions to load archetype prompts and identity contexts, enhancing the orchestrator's ability to generate a comprehensive system prompt. - Added a `BootstrapContext` struct to encapsulate the assembled context, improving the organization and clarity of context management. - Updated `mod.rs` to include the new context assembly module, enhancing the overall architecture of the agent harness. These changes significantly improve the orchestrator's context management capabilities, enabling more effective task execution and user interaction. * style: apply cargo fmt to multi-agent harness modules Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: resolve merge conflict in config/mod.rs re-exports Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: address PR review findings — security, correctness, observability Inline fixes: - executor: wire semaphore to enforce max_concurrent_agents cap - executor: placeholder sub-agents now return success=false - executor: halt DAG when level has failed tasks after retries - self_healing: remove overly broad "not found" pattern - session_queue: fix gc() race with acquire() via Arc::strong_count check - skills_agent.md: reference injected memory context, not memory_recall tool - init.rs: run EPISODIC_INIT_SQL during UnifiedMemory::new() - ask_clarification: make "question" param optional to match execute() default - insert_sql_record: return success=false for unimplemented stub - spawn_subagent: return success=false for unimplemented stub - run_linter: reject absolute paths and ".." in path parameter - run_tests: catch spawn/timeout errors as ToolResult, fix UTF-8 truncation - update_memory_md: add symlink escape protection, use async tokio::fs::write Nitpick fixes: - archivist: document timestamp offset intent - dag: add tracing to validate(), hoist id_map out of loop in execution_levels() - session_queue: add trace logging to acquire/gc - types: add serde(rename_all) to ReviewDecision, preserve sub-second Duration - ORCHESTRATOR.md: add escalation rule for Core handoff - read_diff: add debug logging, simplify base_str with Option::map - workspace_state: add debug logging at entry and exit - run_tests: add debug logging for runner selection and exit status Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
100 lines
3.5 KiB
Rust
100 lines
3.5 KiB
Rust
//! Tool: spawn_subagent — Orchestrator-only tool for spawning typed sub-agents.
|
|
|
|
use super::traits::{PermissionLevel, Tool, ToolResult};
|
|
use crate::openhuman::agent::harness::archetypes::AgentArchetype;
|
|
use async_trait::async_trait;
|
|
use serde_json::json;
|
|
|
|
/// Spawns a sub-agent of a specified archetype to handle a delegated task.
|
|
/// Available only to the Orchestrator archetype.
|
|
pub struct SpawnSubagentTool;
|
|
|
|
impl SpawnSubagentTool {
|
|
pub fn new() -> Self {
|
|
Self
|
|
}
|
|
}
|
|
|
|
#[async_trait]
|
|
impl Tool for SpawnSubagentTool {
|
|
fn name(&self) -> &str {
|
|
"spawn_subagent"
|
|
}
|
|
|
|
fn description(&self) -> &str {
|
|
"Spawn a specialised sub-agent to handle a task. Available archetypes: \
|
|
code_executor (writes/runs code), skills_agent (skill tools like Notion/Gmail), \
|
|
tool_maker (writes polyfills for missing commands), researcher (reads docs/web), \
|
|
critic (reviews code quality). Provide the archetype, a clear task prompt, and \
|
|
optional context from prior results."
|
|
}
|
|
|
|
fn parameters_schema(&self) -> serde_json::Value {
|
|
json!({
|
|
"type": "object",
|
|
"required": ["archetype", "prompt"],
|
|
"properties": {
|
|
"archetype": {
|
|
"type": "string",
|
|
"enum": ["code_executor", "skills_agent", "tool_maker", "researcher", "critic"],
|
|
"description": "Which specialised sub-agent to spawn."
|
|
},
|
|
"prompt": {
|
|
"type": "string",
|
|
"description": "Clear, specific instruction for the sub-agent."
|
|
},
|
|
"context": {
|
|
"type": "string",
|
|
"description": "Optional context from prior task results or workspace state."
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
fn permission_level(&self) -> PermissionLevel {
|
|
PermissionLevel::Execute
|
|
}
|
|
|
|
async fn execute(&self, args: serde_json::Value) -> anyhow::Result<ToolResult> {
|
|
let archetype_str = args
|
|
.get("archetype")
|
|
.and_then(|v| v.as_str())
|
|
.unwrap_or("code_executor");
|
|
|
|
let prompt = args.get("prompt").and_then(|v| v.as_str()).unwrap_or("");
|
|
|
|
let context = args.get("context").and_then(|v| v.as_str()).unwrap_or("");
|
|
|
|
if prompt.is_empty() {
|
|
return Ok(ToolResult {
|
|
success: false,
|
|
output: String::new(),
|
|
error: Some("prompt is required".into()),
|
|
});
|
|
}
|
|
|
|
// Parse archetype (validation).
|
|
let _archetype: AgentArchetype = serde_json::from_value(json!(archetype_str))
|
|
.map_err(|_| anyhow::anyhow!("unknown archetype: {archetype_str}"))?;
|
|
|
|
// Placeholder: In the full implementation, this will construct a sub-agent
|
|
// via AgentBuilder with the archetype's tool subset, model, and sandbox,
|
|
// then run its tool loop and return the result.
|
|
tracing::warn!(
|
|
"[spawn_subagent] no-op — would spawn {archetype_str} sub-agent with prompt length={}",
|
|
prompt.len()
|
|
);
|
|
|
|
Ok(ToolResult {
|
|
success: false,
|
|
output: format!(
|
|
"[Sub-agent {archetype_str}] Task received. Prompt: {prompt}\n\
|
|
Context length: {} chars\n\
|
|
(Full sub-agent execution will be wired in next phase)",
|
|
context.len()
|
|
),
|
|
error: Some("spawn_subagent not yet wired to sub-agent execution".into()),
|
|
})
|
|
}
|
|
}
|