Skip to content

chore: add safe type hints for constants and returns (6 files)#12

Open
mangodxd wants to merge 1 commit intoGPT-AGI:mainfrom
mangodxd:cleanup/type_hints-5d95780a
Open

chore: add safe type hints for constants and returns (6 files)#12
mangodxd wants to merge 1 commit intoGPT-AGI:mainfrom
mangodxd:cleanup/type_hints-5d95780a

Conversation

@mangodxd
Copy link
Copy Markdown

@mangodxd mangodxd commented Apr 5, 2026

Hello,

I noticed a few areas where the code could be slightly improved. This PR focuses on minor housekeeping tasks and does not change any of the existing runtime logic:

Type hint additions

  • src/agent/conversation.py: added type hints to 5 function(s)
  • src/agent/session.py: added type hints to 1 function(s)
  • src/cli.py: added type hints to 3 function(s)
  • src/query_engine.py: added type hints to 1 function(s)
  • src/repl.py: added type hints to 5 function(s)
  • src/repl/core.py: added type hints to 9 function(s)

I have added strictly conservative type annotations based only on explicit primitive default values and singular return statements. Complex objects and dynamic references were purposefully ignored to avoid false positives.

Examples of changes

Example change in src/agent/conversation.py:

-    def add_message(self, role: str, content: Union[str, list[ContentBlock]]):
+    def add_message(self, role: str, content: Union[str, list[ContentBlock]]) -> None:
-    def add_user_message(self, text: str):
+    def add_user_message(self, text: str) -> None:
-    def add_assistant_message(self, content: Union[str, list[ContentBlock]]):
+    def add_assistant_message(self, content: Union[str, list[ContentBlock]]) -> None:
-    def add_tool_result_message(self, tool_use_id: str, content: Union[str, list[dict]], is_error: bool = False):
+    def add_tool_result_message(self, tool_use_id: str, content: Union[str, list[dict]], is_error: bool = False) -> None:
-    def clear(self):
+    def clear(self) -> None:

Example change in src/agent/session.py:

-    def save(self):
+    def save(self) -> None:

Verification

  • I verified these changes using ast.parse() to ensure no syntax errors were introduced.
  • I did not modify any __init__.py files.

If anything looks incorrect, please feel free to adjust it or close the PR entirely. Thank you for maintaining this project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant