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
6 changes: 3 additions & 3 deletions crates/forge_app/src/service/tool_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ mod test {
// Mock tool that always succeeds
struct SuccessTool;
#[async_trait::async_trait]
impl forge_domain::ToolCallService for SuccessTool {
impl forge_domain::ExecutableTool for SuccessTool {
type Input = Value;

async fn call(&self, input: Self::Input) -> Result<String, String> {
Expand All @@ -124,7 +124,7 @@ mod test {
// Mock tool that always fails
struct FailureTool;
#[async_trait::async_trait]
impl forge_domain::ToolCallService for FailureTool {
impl forge_domain::ExecutableTool for FailureTool {
type Input = Value;

async fn call(&self, _input: Self::Input) -> Result<String, String> {
Expand Down Expand Up @@ -198,7 +198,7 @@ mod test {
// Mock tool that simulates a long-running task
struct SlowTool;
#[async_trait::async_trait]
impl forge_domain::ToolCallService for SlowTool {
impl forge_domain::ExecutableTool for SlowTool {
type Input = Value;

async fn call(&self, _input: Self::Input) -> Result<String, String> {
Expand Down
8 changes: 4 additions & 4 deletions crates/forge_domain/src/tool.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use schemars::JsonSchema;
use serde_json::Value;

use crate::{NamedTool, ToolCallService, ToolDefinition, ToolDescription};
use crate::{ExecutableTool, NamedTool, ToolDefinition, ToolDescription};

struct JsonTool<T>(T);

Expand All @@ -12,7 +12,7 @@ impl<T> JsonTool<T> {
}

#[async_trait::async_trait]
impl<T: ToolCallService + Sync> ToolCallService for JsonTool<T>
impl<T: ExecutableTool + Sync> ExecutableTool for JsonTool<T>
where
T::Input: serde::de::DeserializeOwned + JsonSchema,
{
Expand All @@ -25,13 +25,13 @@ where
}

pub struct Tool {
pub executable: Box<dyn ToolCallService<Input = Value> + Send + Sync + 'static>,
pub executable: Box<dyn ExecutableTool<Input = Value> + Send + Sync + 'static>,
pub definition: ToolDefinition,
}

impl<T> From<T> for Tool
where
T: ToolCallService + ToolDescription + NamedTool + Send + Sync + 'static,
T: ExecutableTool + ToolDescription + NamedTool + Send + Sync + 'static,
T::Input: serde::de::DeserializeOwned + JsonSchema,
{
fn from(tool: T) -> Self {
Expand Down
4 changes: 2 additions & 2 deletions crates/forge_domain/src/tool_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use schemars::schema::RootSchema;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use crate::{NamedTool, ToolCallService, ToolName, UsageParameterPrompt, UsagePrompt};
use crate::{ExecutableTool, NamedTool, ToolName, UsageParameterPrompt, UsagePrompt};

///
/// Refer to the specification over here:
Expand Down Expand Up @@ -59,7 +59,7 @@ impl ToolDefinition {

impl<T> From<&T> for ToolDefinition
where
T: NamedTool + ToolCallService + ToolDescription + Send + Sync + 'static,
T: NamedTool + ExecutableTool + ToolDescription + Send + Sync + 'static,
T::Input: serde::de::DeserializeOwned + JsonSchema,
{
fn from(t: &T) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion crates/forge_domain/src/tool_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::de::DeserializeOwned;
use crate::{ToolCallFull, ToolDefinition, ToolResult};

#[async_trait::async_trait]
pub trait ToolCallService {
pub trait ExecutableTool {
type Input: DeserializeOwned;

async fn call(&self, input: Self::Input) -> Result<String, String>;
Expand Down
4 changes: 2 additions & 2 deletions crates/forge_tool/src/approve.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Result;
use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
use forge_tool_macros::ToolDescription;
use inquire::Confirm;
use schemars::JsonSchema;
Expand Down Expand Up @@ -37,7 +37,7 @@ impl NamedTool for Approve {
}

#[async_trait::async_trait]
impl ToolCallService for Approve {
impl ExecutableTool for Approve {
type Input = ApproveInput;

async fn call(&self, input: ApproveInput) -> Result<String, String> {
Expand Down
4 changes: 2 additions & 2 deletions crates/forge_tool/src/ask.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
use forge_tool_macros::ToolDescription;
use schemars::JsonSchema;
use serde::Deserialize;
Expand All @@ -24,7 +24,7 @@ impl NamedTool for AskFollowUpQuestion {
}

#[async_trait::async_trait]
impl ToolCallService for AskFollowUpQuestion {
impl ExecutableTool for AskFollowUpQuestion {
type Input = AskFollowUpQuestionInput;

async fn call(&self, input: Self::Input) -> Result<String, String> {
Expand Down
4 changes: 2 additions & 2 deletions crates/forge_tool/src/fetch.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::{anyhow, Result};
use forge_domain::{NamedTool, ToolCallService, ToolDescription};
use forge_domain::{ExecutableTool, NamedTool, ToolDescription};
use forge_tool_macros::ToolDescription;
use reqwest::{Client, Url};
use schemars::JsonSchema;
Expand Down Expand Up @@ -141,7 +141,7 @@ impl Fetch {
}

#[async_trait::async_trait]
impl ToolCallService for Fetch {
impl ExecutableTool for Fetch {
type Input = FetchInput;

async fn call(&self, input: Self::Input) -> Result<String, String> {
Expand Down
4 changes: 2 additions & 2 deletions crates/forge_tool/src/fs/file_info.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::path::Path;

use anyhow::Context;
use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
use forge_tool_macros::ToolDescription;
use schemars::JsonSchema;
use serde::Deserialize;
Expand Down Expand Up @@ -29,7 +29,7 @@ impl NamedTool for FSFileInfo {
}

#[async_trait::async_trait]
impl ToolCallService for FSFileInfo {
impl ExecutableTool for FSFileInfo {
type Input = FSFileInfoInput;

async fn call(&self, input: Self::Input) -> Result<String, String> {
Expand Down
4 changes: 2 additions & 2 deletions crates/forge_tool/src/fs/fs_find.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashSet;
use std::path::Path;

use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
use forge_tool_macros::ToolDescription;
use forge_walker::Walker;
use regex::Regex;
Expand Down Expand Up @@ -36,7 +36,7 @@ impl NamedTool for FSSearch {
}

#[async_trait::async_trait]
impl ToolCallService for FSSearch {
impl ExecutableTool for FSSearch {
type Input = FSSearchInput;

async fn call(&self, input: Self::Input) -> Result<String, String> {
Expand Down
4 changes: 2 additions & 2 deletions crates/forge_tool/src/fs/fs_list.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::path::Path;

use anyhow::Context;
use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
use forge_tool_macros::ToolDescription;
use forge_walker::Walker;
use schemars::JsonSchema;
Expand Down Expand Up @@ -36,7 +36,7 @@ impl NamedTool for FSList {
}

#[async_trait::async_trait]
impl ToolCallService for FSList {
impl ExecutableTool for FSList {
type Input = FSListInput;

async fn call(&self, input: Self::Input) -> Result<String, String> {
Expand Down
4 changes: 2 additions & 2 deletions crates/forge_tool/src/fs/fs_read.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::path::Path;

use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
use forge_tool_macros::ToolDescription;
use schemars::JsonSchema;
use serde::Deserialize;
Expand Down Expand Up @@ -29,7 +29,7 @@ impl NamedTool for FSRead {
}

#[async_trait::async_trait]
impl ToolCallService for FSRead {
impl ExecutableTool for FSRead {
type Input = FSReadInput;

async fn call(&self, input: Self::Input) -> Result<String, String> {
Expand Down
4 changes: 2 additions & 2 deletions crates/forge_tool/src/fs/fs_write.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::path::Path;

use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
use forge_tool_macros::ToolDescription;
use schemars::JsonSchema;
use serde::Deserialize;
Expand Down Expand Up @@ -32,7 +32,7 @@ impl NamedTool for FSWrite {
}

#[async_trait::async_trait]
impl ToolCallService for FSWrite {
impl ExecutableTool for FSWrite {
type Input = FSWriteInput;

async fn call(&self, input: Self::Input) -> Result<String, String> {
Expand Down
4 changes: 2 additions & 2 deletions crates/forge_tool/src/outline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::{HashMap, HashSet};
use std::path::Path;

use anyhow::Context;
use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
use forge_tool_macros::ToolDescription;
use schemars::JsonSchema;
use serde::Deserialize;
Expand Down Expand Up @@ -125,7 +125,7 @@ impl NamedTool for Outline {
}

#[async_trait::async_trait]
impl ToolCallService for Outline {
impl ExecutableTool for Outline {
type Input = OutlineInput;

async fn call(&self, input: Self::Input) -> Result<String, String> {
Expand Down
2 changes: 1 addition & 1 deletion crates/forge_tool/src/outline/tests/css.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use forge_domain::ToolCallService;
use forge_domain::ExecutableTool;
use insta::assert_snapshot;
use tokio::fs;

Expand Down
2 changes: 1 addition & 1 deletion crates/forge_tool/src/outline/tests/java.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use forge_domain::ToolCallService;
use forge_domain::ExecutableTool;
use insta::assert_snapshot;
use tokio::fs;

Expand Down
2 changes: 1 addition & 1 deletion crates/forge_tool/src/outline/tests/javascript.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use forge_domain::ToolCallService;
use forge_domain::ExecutableTool;
use insta::assert_snapshot;
use tokio::fs;

Expand Down
2 changes: 1 addition & 1 deletion crates/forge_tool/src/outline/tests/misc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use forge_domain::ToolCallService;
use forge_domain::ExecutableTool;
use insta::assert_snapshot;
use tokio::fs;

Expand Down
2 changes: 1 addition & 1 deletion crates/forge_tool/src/outline/tests/python.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use forge_domain::ToolCallService;
use forge_domain::ExecutableTool;
use insta::assert_snapshot;
use tokio::fs;

Expand Down
2 changes: 1 addition & 1 deletion crates/forge_tool/src/outline/tests/rust.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use forge_domain::ToolCallService;
use forge_domain::ExecutableTool;
use insta::assert_snapshot;
use tokio::fs;

Expand Down
2 changes: 1 addition & 1 deletion crates/forge_tool/src/outline/tests/scala.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use forge_domain::ToolCallService;
use forge_domain::ExecutableTool;
use insta::assert_snapshot;
use tokio::fs;

Expand Down
2 changes: 1 addition & 1 deletion crates/forge_tool/src/outline/tests/tsx.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use forge_domain::ToolCallService;
use forge_domain::ExecutableTool;
use insta::assert_snapshot;
use tokio::fs;

Expand Down
2 changes: 1 addition & 1 deletion crates/forge_tool/src/outline/tests/typescript.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use forge_domain::ToolCallService;
use forge_domain::ExecutableTool;
use insta::assert_snapshot;
use tokio::fs;

Expand Down
4 changes: 2 additions & 2 deletions crates/forge_tool/src/patch/apply.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::path::{Path, PathBuf};

use dissimilar::Chunk;
use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
use schemars::JsonSchema;
use serde::Deserialize;
use thiserror::Error;
Expand Down Expand Up @@ -139,7 +139,7 @@ async fn apply_patches(content: String, blocks: Vec<PatchBlock>) -> Result<Strin
}

#[async_trait::async_trait]
impl ToolCallService for ApplyPatch {
impl ExecutableTool for ApplyPatch {
type Input = ApplyPatchInput;

async fn call(&self, input: Self::Input) -> Result<String, String> {
Expand Down
4 changes: 2 additions & 2 deletions crates/forge_tool/src/patch/apply_json.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::path::Path;

use dissimilar::Chunk;
use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
use forge_tool_macros::ToolDescription;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -213,7 +213,7 @@ async fn process_file_modifications(
}

#[async_trait::async_trait]
impl ToolCallService for ApplyPatchJson {
impl ExecutableTool for ApplyPatchJson {
type Input = ApplyPatchJsonInput;

async fn call(&self, input: Self::Input) -> Result<String, String> {
Expand Down
4 changes: 2 additions & 2 deletions crates/forge_tool/src/select.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Result;
use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
use forge_tool_macros::ToolDescription;
use inquire::Select as InquireSelect;
use schemars::JsonSchema;
Expand Down Expand Up @@ -41,7 +41,7 @@ impl NamedTool for SelectTool {
}

#[async_trait::async_trait]
impl ToolCallService for SelectTool {
impl ExecutableTool for SelectTool {
type Input = SelectInput;

async fn call(&self, input: SelectInput) -> Result<String, String> {
Expand Down
4 changes: 2 additions & 2 deletions crates/forge_tool/src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::HashSet;
use std::path::PathBuf;

use anyhow::Result;
use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
use forge_tool_macros::ToolDescription;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -129,7 +129,7 @@ impl NamedTool for Shell {
}

#[async_trait::async_trait]
impl ToolCallService for Shell {
impl ExecutableTool for Shell {
type Input = ShellInput;

async fn call(&self, input: Self::Input) -> Result<String, String> {
Expand Down
4 changes: 2 additions & 2 deletions crates/forge_tool/src/think.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::HashMap;

use anyhow::{Context, Result};
use forge_domain::{NamedTool, ToolCallService, ToolDescription, ToolName};
use forge_domain::{ExecutableTool, NamedTool, ToolDescription, ToolName};
use forge_tool_macros::ToolDescription;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -139,7 +139,7 @@ impl NamedTool for Think {
}

#[async_trait::async_trait]
impl ToolCallService for Think {
impl ExecutableTool for Think {
type Input = ThoughtInput;
async fn call(&self, input: Self::Input) -> Result<String, String> {
let mut thinker = self.clone();
Expand Down