fastmcp-agents-library-agent-simple-code 0.5.7__py3-none-any.whl → 0.5.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fastmcp_agents/library/agent/simple_code/investigate.py +27 -3
- {fastmcp_agents_library_agent_simple_code-0.5.7.dist-info → fastmcp_agents_library_agent_simple_code-0.5.8.dist-info}/METADATA +1 -1
- {fastmcp_agents_library_agent_simple_code-0.5.7.dist-info → fastmcp_agents_library_agent_simple_code-0.5.8.dist-info}/RECORD +5 -5
- {fastmcp_agents_library_agent_simple_code-0.5.7.dist-info → fastmcp_agents_library_agent_simple_code-0.5.8.dist-info}/WHEEL +0 -0
- {fastmcp_agents_library_agent_simple_code-0.5.7.dist-info → fastmcp_agents_library_agent_simple_code-0.5.8.dist-info}/entry_points.txt +0 -0
@@ -11,7 +11,7 @@ from typing import Annotated, Any, Literal
|
|
11
11
|
from fastmcp import FastMCP
|
12
12
|
from fastmcp.tools.tool import Tool
|
13
13
|
from fastmcp_ai_agent_bridge.pydantic_ai import FastMCPToolset
|
14
|
-
from git import Repo
|
14
|
+
from git.repo import Repo
|
15
15
|
from pydantic import AnyHttpUrl, BaseModel, Field, RootModel
|
16
16
|
from pydantic_ai import Agent
|
17
17
|
|
@@ -84,6 +84,27 @@ class InvestigationRecommendation(BaseModel):
|
|
84
84
|
proposed_lines: FileLines = Field(default=..., description="The proposed lines of code in the file with their line numbers.")
|
85
85
|
|
86
86
|
|
87
|
+
class BranchInfo(BaseModel):
|
88
|
+
"""A repository info."""
|
89
|
+
|
90
|
+
name: str
|
91
|
+
commit_sha: str
|
92
|
+
|
93
|
+
@classmethod
|
94
|
+
def from_repo(cls, repo: Repo) -> "BranchInfo":
|
95
|
+
"""Create a branch info from a repository."""
|
96
|
+
return cls(name=repo.active_branch.name, commit_sha=repo.head.commit.hexsha)
|
97
|
+
|
98
|
+
@classmethod
|
99
|
+
def from_dir(cls, directory: Path) -> "BranchInfo | None":
|
100
|
+
"""Create a branch info from a directory."""
|
101
|
+
try:
|
102
|
+
repo: Repo = Repo(path=directory)
|
103
|
+
return cls.from_repo(repo)
|
104
|
+
except Exception:
|
105
|
+
return None
|
106
|
+
|
107
|
+
|
87
108
|
class InvestigationResponse(BaseModel):
|
88
109
|
"""An investigation response."""
|
89
110
|
|
@@ -123,17 +144,20 @@ CODE_REPOSITORY_TYPE = Annotated[
|
|
123
144
|
]
|
124
145
|
|
125
146
|
|
126
|
-
async def investigate_code(task: str, code_repository: CODE_REPOSITORY_TYPE) -> InvestigationResponse:
|
147
|
+
async def investigate_code(task: str, code_repository: CODE_REPOSITORY_TYPE) -> tuple[InvestigationResponse, BranchInfo | None]:
|
127
148
|
"""Perform a code investigation."""
|
128
149
|
|
129
150
|
with tempfile.TemporaryDirectory(delete=False) as temp_dir:
|
130
151
|
# We only actually use the tempdir if we are cloning a git repository
|
131
152
|
if isinstance(code_repository, AnyHttpUrl):
|
132
153
|
Repo.clone_from(url=str(code_repository), to_path=temp_dir, single_branch=True, depth=1)
|
154
|
+
|
133
155
|
code_repository = Path(temp_dir)
|
134
156
|
if code_repository is None:
|
135
157
|
code_repository = Path.cwd()
|
136
158
|
|
159
|
+
branch_info: BranchInfo | None = BranchInfo.from_dir(directory=code_repository)
|
160
|
+
|
137
161
|
directory_locked_toolset = FastMCPToolset.from_mcp_config(
|
138
162
|
mcp_config={"filesystem": read_only_filesystem_mcp(root_dir=code_repository)}
|
139
163
|
)
|
@@ -147,7 +171,7 @@ async def investigate_code(task: str, code_repository: CODE_REPOSITORY_TYPE) ->
|
|
147
171
|
|
148
172
|
run_result = await code_investigation_agent.run(user_prompt=[task, repo_info], toolsets=[directory_locked_toolset])
|
149
173
|
|
150
|
-
return run_result.output
|
174
|
+
return run_result.output, branch_info
|
151
175
|
|
152
176
|
|
153
177
|
investigate_code_tool = Tool.from_function(fn=investigate_code)
|
@@ -4,8 +4,8 @@ fastmcp_agents/library/agent/simple_code/archive/workspace.py.disabled,sha256=d2
|
|
4
4
|
fastmcp_agents/library/agent/simple_code/helpers/filesystem.py,sha256=ced0f82524a1355cb6cc2a2a5f61b61a6c507455e49cdfdb2d0bf12695586757,3771
|
5
5
|
fastmcp_agents/library/agent/simple_code/helpers/git.py,sha256=7d3264b3b29df8025752018a51e677201f8761c07f549559260de06e6a88502f,262
|
6
6
|
fastmcp_agents/library/agent/simple_code/implement.py,sha256=5267dbc76ca6fdebeb76282846068cc96901503e3004da5ac65cb04e242c5e94,5801
|
7
|
-
fastmcp_agents/library/agent/simple_code/investigate.py,sha256=
|
8
|
-
fastmcp_agents_library_agent_simple_code-0.5.
|
9
|
-
fastmcp_agents_library_agent_simple_code-0.5.
|
10
|
-
fastmcp_agents_library_agent_simple_code-0.5.
|
11
|
-
fastmcp_agents_library_agent_simple_code-0.5.
|
7
|
+
fastmcp_agents/library/agent/simple_code/investigate.py,sha256=4c3ab2c0011c4c60eb3f24df097c9b676a25fe3c5917889b860f230b1a03148c,7180
|
8
|
+
fastmcp_agents_library_agent_simple_code-0.5.8.dist-info/WHEEL,sha256=03f80d698bb4300c27bcafc3987ea73ef427fcb365e59e808e50d041a7f87b89,78
|
9
|
+
fastmcp_agents_library_agent_simple_code-0.5.8.dist-info/entry_points.txt,sha256=6a34307eece27892df63ae0af789d4ee3b839693877c185288303c27b92b5ada,166
|
10
|
+
fastmcp_agents_library_agent_simple_code-0.5.8.dist-info/METADATA,sha256=168944da9e725c74b31778ae397fcede4707d630586736c7631891ec785e6dd1,314
|
11
|
+
fastmcp_agents_library_agent_simple_code-0.5.8.dist-info/RECORD,,
|
File without changes
|