Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
4 changes: 1 addition & 3 deletions .clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ allow-mixed-uninlined-format-args = true
allow-unwrap-in-tests = true
allow-expect-in-tests = true
allow-dbg-in-tests = true
too-many-arguments-threshold = 12
type-complexity-threshold = 250
cognitive-complexity-threshold = 30
# Reduce false positives and focus on important issues
disallowed-names = []
Expand All @@ -16,4 +14,4 @@ max-trait-bounds = 3
max-fn-params-bools = 3
enum-variant-name-threshold = 50
# Allow certain patterns for faster development
single-char-binding-names-threshold = 4
single-char-binding-names-threshold = 4
5 changes: 2 additions & 3 deletions .github/workflows/publish-tauri.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,12 @@ jobs:
working-directory: ${{env.working-directory}}
run: |
# Inject secrets into Tauri configuration
op inject -i src-tauri/tauri.conf.json.template -o src-tauri/tauri.conf.json
op inject --force -i src-tauri/tauri.conf.json.template -o src-tauri/tauri.conf.json
chmod 600 src-tauri/tauri.conf.json

# Create environment file for signing
cat > .env.ci << 'EOF'
TAURI_PRIVATE_KEY="op://Terraphim-Deployment/Tauri Update Signing/TAURI_PRIVATE_KEY"
TAURI_KEY_PASSWORD="op://Terraphim-Deployment/Tauri Update Signing/TAURI_KEY_PASSWORD"
TAURI_PRIVATE_KEY="op://TerraphimPlatform/tauri.update.signing/TAURI_PRIVATE_KEY"
Copy link

Copilot AI Oct 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing TAURI_KEY_PASSWORD entry in the environment file. The original configuration included both TAURI_PRIVATE_KEY and TAURI_KEY_PASSWORD. If password is still required for signing, this will cause build failures.

Suggested change
TAURI_PRIVATE_KEY="op://TerraphimPlatform/tauri.update.signing/TAURI_PRIVATE_KEY"
TAURI_PRIVATE_KEY="op://TerraphimPlatform/tauri.update.signing/TAURI_PRIVATE_KEY"
TAURI_KEY_PASSWORD="op://TerraphimPlatform/tauri.update.signing/TAURI_KEY_PASSWORD"

Copilot uses AI. Check for mistakes.
EOF

# Build with injected signing keys
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ async-trait = "0.1"
thiserror = "1.0"
anyhow = "1.0"
log = "0.4"

[patch.crates-io]
genai = { git = "https://github.com/terraphim/rust-genai.git", branch = "main" }
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,8 @@ impl WorkflowPattern for Parallelization {

// Parallel execution reduces total time but adds overhead
let estimated_tasks: usize = if input.prompt.len() > 2000 { 4 } else { 3 };
let batches = estimated_tasks.div_ceil(self.parallel_config.max_parallel_tasks);
let batches = (estimated_tasks + self.parallel_config.max_parallel_tasks - 1)
/ self.parallel_config.max_parallel_tasks;

base_time_per_task * batches as u32 + Duration::from_secs(10)
// aggregation overhead
Expand Down
103 changes: 0 additions & 103 deletions crates/terraphim_agent_registry/benches/registry_benchmarks.rs

This file was deleted.

4 changes: 2 additions & 2 deletions crates/terraphim_multi_agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ log = { workspace = true }
# Direct HTTP client approach (like Goose) for LLM communication
reqwest = { version = "0.12", features = ["json", "stream"] }

# Multi-provider generative AI client (using stable version due to let_chains issue in git version)
genai = "0.3.5"
# Multi-provider generative AI client (using terraphim fork with OpenRouter support)
genai = { git = "https://github.com/terraphim/rust-genai.git", branch = "main" }

# Additional dependencies
ahash = { version = "0.8.8", features = ["serde"] }
Expand Down
4 changes: 2 additions & 2 deletions crates/terraphim_multi_agent/benches/agent_operations.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use criterion::{BenchmarkId, Criterion, black_box, criterion_group, criterion_main};
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
use std::sync::Arc;
use tokio::runtime::Runtime;

use terraphim_multi_agent::{
AgentRegistry, CommandInput, CommandType, test_utils::create_test_agent_simple,
test_utils::create_test_agent_simple, AgentRegistry, CommandInput, CommandType,
};

/// Benchmark agent creation time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ fn create_atomic_server_agent_role() -> Role {
llm_chat_system_prompt: None,
llm_chat_model: None,
llm_context_window: Some(16000),
haystacks: vec![
Haystack::new(
"http://localhost:9883".to_string(), // Atomic server URL
ServiceType::Atomic,
true, // read-only
)
.with_atomic_secret(Some("your-base64-secret-here".to_string())),
],
haystacks: vec![Haystack::new(
"http://localhost:9883".to_string(), // Atomic server URL
ServiceType::Atomic,
true, // read-only
)
.with_atomic_secret(Some("your-base64-secret-here".to_string()))],
extra: {
let mut extra = AHashMap::new();
// Multi-agent specific configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use std::sync::Arc;
use terraphim_config::Role;
use terraphim_multi_agent::{
CommandInput, CommandType, MultiAgentResult, TerraphimAgent, test_utils::create_test_role,
test_utils::create_test_role, CommandInput, CommandType, MultiAgentResult, TerraphimAgent,
};
use terraphim_persistence::DeviceStorage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use ahash::AHashMap;
use std::sync::Arc;
use terraphim_config::Role;
use terraphim_multi_agent::{
AgentRegistry, CommandInput, CommandType, MultiAgentResult, TerraphimAgent,
test_utils::create_test_role,
test_utils::create_test_role, AgentRegistry, CommandInput, CommandType, MultiAgentResult,
TerraphimAgent,
};
use terraphim_persistence::DeviceStorage;
use terraphim_types::RelevanceFunction;
Expand Down
2 changes: 1 addition & 1 deletion crates/terraphim_multi_agent/examples/simple_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use std::sync::Arc;
use terraphim_multi_agent::{
CommandInput, CommandType, TerraphimAgent, test_utils::create_test_role,
test_utils::create_test_role, CommandInput, CommandType, TerraphimAgent,
};
use terraphim_persistence::DeviceStorage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! that leverage the generic LLM interface instead of OpenRouter-specific code.

use terraphim_multi_agent::{
ChatAgent, ChatConfig, SummarizationAgent, SummarizationConfig, SummaryStyle, test_utils,
test_utils, ChatAgent, ChatConfig, SummarizationAgent, SummarizationConfig, SummaryStyle,
};

#[tokio::main]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ahash::AHashMap;
use std::sync::Arc;
use terraphim_config::Role;
use terraphim_multi_agent::{
CommandInput, CommandType, MultiAgentResult, TerraphimAgent, test_utils::create_test_role,
test_utils::create_test_role, CommandInput, CommandType, MultiAgentResult, TerraphimAgent,
};
use terraphim_persistence::DeviceStorage;
use terraphim_types::RelevanceFunction;
Expand Down
2 changes: 1 addition & 1 deletion crates/terraphim_multi_agent/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ impl TerraphimAgent {
// TODO: Load from role configuration
// TODO: Load actual automata from role config
// TODO: Load actual automata from role config
use terraphim_automata::{AutocompleteConfig, build_autocomplete_index};
use terraphim_automata::{build_autocomplete_index, AutocompleteConfig};
use terraphim_types::Thesaurus;

let thesaurus = Thesaurus::new("default".to_string());
Expand Down
30 changes: 7 additions & 23 deletions crates/terraphim_multi_agent/src/genai_llm_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

use crate::{LlmRequest, LlmResponse, MessageRole, MultiAgentError, MultiAgentResult, TokenUsage};
use chrono::Utc;
use genai::Client;
use genai::chat::{ChatMessage, ChatOptions, ChatRequest};
use genai::Client;
use std::env;
use uuid::Uuid;

Expand Down Expand Up @@ -139,28 +139,12 @@ impl GenAiLlmClient {
let end_time = Utc::now();
let duration_ms = (end_time - start_time).num_milliseconds() as u64;

// Extract content from response
let content = match &chat_res.content {
Some(genai::chat::MessageContent::Text(text)) => text.clone(),
Some(genai::chat::MessageContent::Parts(parts)) => {
// For multi-part content, concatenate text parts
parts
.iter()
.filter_map(|part| match part {
genai::chat::ContentPart::Text(text) => Some(text.clone()),
_ => None,
})
.collect::<Vec<_>>()
.join(" ")
}
Some(genai::chat::MessageContent::ToolCalls(_)) => {
"Tool calls not supported".to_string()
}
Some(genai::chat::MessageContent::ToolResponses(_)) => {
"Tool responses not supported".to_string()
}
None => "No response".to_string(),
};
// Extract content from response - MessageContent is now a struct with accessor methods
let content = chat_res
.content
.joined_texts()
.or_else(|| chat_res.content.first_text().map(|s| s.to_string()))
.unwrap_or_else(|| "No text content in response".to_string());

// Extract token usage if available
let (input_tokens, output_tokens) = (
Expand Down
8 changes: 4 additions & 4 deletions crates/terraphim_multi_agent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ pub mod test_utils {
}

/// Create test rolegraph for testing
pub async fn create_test_rolegraph()
-> Result<Arc<terraphim_rolegraph::RoleGraph>, MultiAgentError> {
pub async fn create_test_rolegraph(
) -> Result<Arc<terraphim_rolegraph::RoleGraph>, MultiAgentError> {
// Create a simple test rolegraph with empty thesaurus
use terraphim_types::Thesaurus;
let empty_thesaurus = Thesaurus::new("test_thesaurus".to_string());
Expand All @@ -139,8 +139,8 @@ pub mod test_utils {
}

/// Create test automata for testing
pub fn create_test_automata()
-> Result<Arc<terraphim_automata::AutocompleteIndex>, MultiAgentError> {
pub fn create_test_automata(
) -> Result<Arc<terraphim_automata::AutocompleteIndex>, MultiAgentError> {
// Create a simple test automata index with empty thesaurus
use terraphim_types::Thesaurus;
let empty_thesaurus = Thesaurus::new("test_thesaurus".to_string());
Expand Down
2 changes: 1 addition & 1 deletion crates/terraphim_multi_agent/src/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::collections::{HashMap, VecDeque};
use std::sync::Arc;
use std::time::Duration;
use tokio::sync::RwLock;
use tokio::time::{Instant, interval};
use tokio::time::{interval, Instant};

use terraphim_config::Role;
use terraphim_persistence::DeviceStorage;
Expand Down
2 changes: 1 addition & 1 deletion crates/terraphim_multi_agent/tests/architecture_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! without requiring actual LLM API calls

use std::sync::Arc;
use terraphim_multi_agent::{AgentRegistry, MultiAgentError, test_utils::create_test_role};
use terraphim_multi_agent::{test_utils::create_test_role, AgentRegistry, MultiAgentError};
use terraphim_persistence::DeviceStorage;

#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion crates/terraphim_multi_agent/tests/integration_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! with Rig integration and queue-based architecture

use std::sync::Arc;
use terraphim_multi_agent::{AgentRegistry, TerraphimAgent, test_utils::create_test_role};
use terraphim_multi_agent::{test_utils::create_test_role, AgentRegistry, TerraphimAgent};
use terraphim_persistence::DeviceStorage;

#[tokio::test]
Expand Down
20 changes: 8 additions & 12 deletions crates/terraphim_multi_agent/tests/rust_execution_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,10 @@ fn main() {

let validation_result = extractor.validate_code(&unsafe_code);
assert!(validation_result.is_err());
assert!(
validation_result
.unwrap_err()
.to_string()
.contains("unsafe")
);
assert!(validation_result
.unwrap_err()
.to_string()
.contains("unsafe"));
}

#[test]
Expand All @@ -104,12 +102,10 @@ fn main() {

let validation_result = extractor.validate_code(&process_code);
assert!(validation_result.is_err());
assert!(
validation_result
.unwrap_err()
.to_string()
.contains("std::process")
);
assert!(validation_result
.unwrap_err()
.to_string()
.contains("std::process"));
}

#[test]
Expand Down
Loading
Loading