fastmcp-agents-library-agent-simple-code 0.5.7__tar.gz → 0.5.8__tar.gz

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.
Files changed (10) hide show
  1. {fastmcp_agents_library_agent_simple_code-0.5.7 → fastmcp_agents_library_agent_simple_code-0.5.8}/PKG-INFO +1 -1
  2. {fastmcp_agents_library_agent_simple_code-0.5.7 → fastmcp_agents_library_agent_simple_code-0.5.8}/pyproject.toml +1 -1
  3. {fastmcp_agents_library_agent_simple_code-0.5.7 → fastmcp_agents_library_agent_simple_code-0.5.8}/src/fastmcp_agents/library/agent/simple_code/investigate.py +27 -3
  4. {fastmcp_agents_library_agent_simple_code-0.5.7 → fastmcp_agents_library_agent_simple_code-0.5.8}/README.md +0 -0
  5. {fastmcp_agents_library_agent_simple_code-0.5.7 → fastmcp_agents_library_agent_simple_code-0.5.8}/src/fastmcp_agents/library/agent/simple_code/__init__.py +0 -0
  6. {fastmcp_agents_library_agent_simple_code-0.5.7 → fastmcp_agents_library_agent_simple_code-0.5.8}/src/fastmcp_agents/library/agent/simple_code/archive/base.py.disabled +0 -0
  7. {fastmcp_agents_library_agent_simple_code-0.5.7 → fastmcp_agents_library_agent_simple_code-0.5.8}/src/fastmcp_agents/library/agent/simple_code/archive/workspace.py.disabled +0 -0
  8. {fastmcp_agents_library_agent_simple_code-0.5.7 → fastmcp_agents_library_agent_simple_code-0.5.8}/src/fastmcp_agents/library/agent/simple_code/helpers/filesystem.py +0 -0
  9. {fastmcp_agents_library_agent_simple_code-0.5.7 → fastmcp_agents_library_agent_simple_code-0.5.8}/src/fastmcp_agents/library/agent/simple_code/helpers/git.py +0 -0
  10. {fastmcp_agents_library_agent_simple_code-0.5.7 → fastmcp_agents_library_agent_simple_code-0.5.8}/src/fastmcp_agents/library/agent/simple_code/implement.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: fastmcp-agents-library-agent-simple-code
3
- Version: 0.5.7
3
+ Version: 0.5.8
4
4
  Summary: Agents for Simple Code
5
5
  Requires-Dist: fastmcp-ai-agent-bridge-pydantic-ai>=0.1.2
6
6
  Requires-Dist: gitpython>=3.1.44
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fastmcp-agents-library-agent-simple-code"
3
- version = "0.5.7"
3
+ version = "0.5.8"
4
4
  description = "Agents for Simple Code"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -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)