This commit addresses several critical issues and improvements: 🔧 Critical Fixes: - Fixed conversation history not being included when using continuation_id in AI-to-AI conversations - Fixed test mock targeting issues preventing proper conversation memory validation - Fixed Docker debug logging functionality with Gemini tools 🐛 Bug Fixes: - Docker compose configuration for proper container command execution - Test mock import targeting from utils.conversation_memory.* to tools.base.* - Version bump to 3.1.0 reflecting significant improvements 🚀 Improvements: - Enhanced Docker environment configuration with comprehensive logging setup - Added cross-tool continuation documentation and examples in README - Improved error handling and validation across all tools - Better logging configuration with LOG_LEVEL environment variable support - Enhanced conversation memory system documentation 🧪 Testing: - Added comprehensive conversation history bug fix tests - Added cross-tool continuation functionality tests - All 132 tests now pass with proper conversation history validation - Improved test coverage for AI-to-AI conversation threading ✨ Code Quality: - Applied black, isort, and ruff formatting across entire codebase - Enhanced inline documentation for conversation memory system - Cleaned up temporary files and improved repository hygiene - Better test descriptions and coverage for critical functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
96 lines
3.7 KiB
Python
96 lines
3.7 KiB
Python
"""
|
|
Data models for tool responses and interactions
|
|
"""
|
|
|
|
from typing import Any, Literal, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class FollowUpRequest(BaseModel):
|
|
"""Request for follow-up conversation turn"""
|
|
|
|
continuation_id: str = Field(
|
|
..., description="Thread continuation ID for multi-turn conversations across different tools"
|
|
)
|
|
question_to_user: str = Field(..., description="Follow-up question to ask Claude")
|
|
suggested_tool_params: Optional[dict[str, Any]] = Field(
|
|
None, description="Suggested parameters for the next tool call"
|
|
)
|
|
ui_hint: Optional[str] = Field(
|
|
None, description="UI hint for Claude (e.g., 'text_input', 'file_select', 'multi_choice')"
|
|
)
|
|
|
|
|
|
class ContinuationOffer(BaseModel):
|
|
"""Offer for Claude to continue conversation when Gemini doesn't ask follow-up"""
|
|
|
|
continuation_id: str = Field(
|
|
..., description="Thread continuation ID for multi-turn conversations across different tools"
|
|
)
|
|
message_to_user: str = Field(..., description="Message explaining continuation opportunity to Claude")
|
|
suggested_tool_params: Optional[dict[str, Any]] = Field(
|
|
None, description="Suggested parameters for continued tool usage"
|
|
)
|
|
remaining_turns: int = Field(..., description="Number of conversation turns remaining")
|
|
|
|
|
|
class ToolOutput(BaseModel):
|
|
"""Standardized output format for all tools"""
|
|
|
|
status: Literal[
|
|
"success",
|
|
"error",
|
|
"requires_clarification",
|
|
"requires_file_prompt",
|
|
"requires_continuation",
|
|
"continuation_available",
|
|
] = "success"
|
|
content: Optional[str] = Field(None, description="The main content/response from the tool")
|
|
content_type: Literal["text", "markdown", "json"] = "text"
|
|
metadata: Optional[dict[str, Any]] = Field(default_factory=dict)
|
|
follow_up_request: Optional[FollowUpRequest] = Field(
|
|
None, description="Optional follow-up request for continued conversation"
|
|
)
|
|
continuation_offer: Optional[ContinuationOffer] = Field(
|
|
None, description="Optional offer for Claude to continue conversation"
|
|
)
|
|
|
|
|
|
class ClarificationRequest(BaseModel):
|
|
"""Request for additional context or clarification"""
|
|
|
|
question: str = Field(..., description="Question to ask Claude for more context")
|
|
files_needed: Optional[list[str]] = Field(
|
|
default_factory=list, description="Specific files that are needed for analysis"
|
|
)
|
|
suggested_next_action: Optional[dict[str, Any]] = Field(
|
|
None,
|
|
description="Suggested tool call with parameters after getting clarification",
|
|
)
|
|
|
|
|
|
class DiagnosticHypothesis(BaseModel):
|
|
"""A debugging hypothesis with context and next steps"""
|
|
|
|
rank: int = Field(..., description="Ranking of this hypothesis (1 = most likely)")
|
|
confidence: Literal["high", "medium", "low"] = Field(..., description="Confidence level")
|
|
hypothesis: str = Field(..., description="Description of the potential root cause")
|
|
reasoning: str = Field(..., description="Why this hypothesis is plausible")
|
|
next_step: str = Field(..., description="Suggested action to test/validate this hypothesis")
|
|
|
|
|
|
class StructuredDebugResponse(BaseModel):
|
|
"""Enhanced debug response with multiple hypotheses"""
|
|
|
|
summary: str = Field(..., description="Brief summary of the issue")
|
|
hypotheses: list[DiagnosticHypothesis] = Field(..., description="Ranked list of potential causes")
|
|
immediate_actions: list[str] = Field(
|
|
default_factory=list,
|
|
description="Immediate steps to take regardless of root cause",
|
|
)
|
|
additional_context_needed: Optional[list[str]] = Field(
|
|
default_factory=list,
|
|
description="Additional files or information that would help with analysis",
|
|
)
|