codetether 1.2.2__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.
Files changed (66) hide show
  1. a2a_server/__init__.py +29 -0
  2. a2a_server/a2a_agent_card.py +365 -0
  3. a2a_server/a2a_errors.py +1133 -0
  4. a2a_server/a2a_executor.py +926 -0
  5. a2a_server/a2a_router.py +1033 -0
  6. a2a_server/a2a_types.py +344 -0
  7. a2a_server/agent_card.py +408 -0
  8. a2a_server/agents_server.py +271 -0
  9. a2a_server/auth_api.py +349 -0
  10. a2a_server/billing_api.py +638 -0
  11. a2a_server/billing_service.py +712 -0
  12. a2a_server/billing_webhooks.py +501 -0
  13. a2a_server/config.py +96 -0
  14. a2a_server/database.py +2165 -0
  15. a2a_server/email_inbound.py +398 -0
  16. a2a_server/email_notifications.py +486 -0
  17. a2a_server/enhanced_agents.py +919 -0
  18. a2a_server/enhanced_server.py +160 -0
  19. a2a_server/hosted_worker.py +1049 -0
  20. a2a_server/integrated_agents_server.py +347 -0
  21. a2a_server/keycloak_auth.py +750 -0
  22. a2a_server/livekit_bridge.py +439 -0
  23. a2a_server/marketing_tools.py +1364 -0
  24. a2a_server/mcp_client.py +196 -0
  25. a2a_server/mcp_http_server.py +2256 -0
  26. a2a_server/mcp_server.py +191 -0
  27. a2a_server/message_broker.py +725 -0
  28. a2a_server/mock_mcp.py +273 -0
  29. a2a_server/models.py +494 -0
  30. a2a_server/monitor_api.py +5904 -0
  31. a2a_server/opencode_bridge.py +1594 -0
  32. a2a_server/redis_task_manager.py +518 -0
  33. a2a_server/server.py +726 -0
  34. a2a_server/task_manager.py +668 -0
  35. a2a_server/task_queue.py +742 -0
  36. a2a_server/tenant_api.py +333 -0
  37. a2a_server/tenant_middleware.py +219 -0
  38. a2a_server/tenant_service.py +760 -0
  39. a2a_server/user_auth.py +721 -0
  40. a2a_server/vault_client.py +576 -0
  41. a2a_server/worker_sse.py +873 -0
  42. agent_worker/__init__.py +8 -0
  43. agent_worker/worker.py +4877 -0
  44. codetether/__init__.py +10 -0
  45. codetether/__main__.py +4 -0
  46. codetether/cli.py +112 -0
  47. codetether/worker_cli.py +57 -0
  48. codetether-1.2.2.dist-info/METADATA +570 -0
  49. codetether-1.2.2.dist-info/RECORD +66 -0
  50. codetether-1.2.2.dist-info/WHEEL +5 -0
  51. codetether-1.2.2.dist-info/entry_points.txt +4 -0
  52. codetether-1.2.2.dist-info/licenses/LICENSE +202 -0
  53. codetether-1.2.2.dist-info/top_level.txt +5 -0
  54. codetether_voice_agent/__init__.py +6 -0
  55. codetether_voice_agent/agent.py +445 -0
  56. codetether_voice_agent/codetether_mcp.py +345 -0
  57. codetether_voice_agent/config.py +16 -0
  58. codetether_voice_agent/functiongemma_caller.py +380 -0
  59. codetether_voice_agent/session_playback.py +247 -0
  60. codetether_voice_agent/tools/__init__.py +21 -0
  61. codetether_voice_agent/tools/definitions.py +135 -0
  62. codetether_voice_agent/tools/handlers.py +380 -0
  63. run_server.py +314 -0
  64. ui/monitor-tailwind.html +1790 -0
  65. ui/monitor.html +1775 -0
  66. ui/monitor.js +2662 -0
@@ -0,0 +1,160 @@
1
+ """
2
+ Enhanced A2A Server with MCP tool integration.
3
+ """
4
+
5
+ import asyncio
6
+ import logging
7
+ from typing import Optional
8
+
9
+ from .server import A2AServer
10
+ from .models import Message, Part
11
+ from .enhanced_agents import route_message_to_agent, initialize_all_agents, cleanup_all_agents
12
+ from .agent_card import AgentCard
13
+ from .message_broker import MessageBroker, InMemoryMessageBroker
14
+
15
+ logger = logging.getLogger(__name__)
16
+
17
+
18
+ class EnhancedA2AServer(A2AServer):
19
+ """Enhanced A2A Server that uses MCP tools through specialized agents."""
20
+
21
+ def __init__(self, *args, use_redis: bool = False, redis_url: str = "redis://localhost:6379", **kwargs):
22
+ super().__init__(*args, **kwargs)
23
+ self._agents_initialized = False
24
+ self._use_redis = use_redis
25
+ self._redis_url = redis_url
26
+ # Note: message_broker is already set by parent class constructor
27
+
28
+ async def initialize_agents(self):
29
+ """Initialize all MCP-enabled agents with message broker."""
30
+ if not self._agents_initialized:
31
+ try:
32
+ # Use the message broker from parent class
33
+ await self.message_broker.start()
34
+ logger.info(f"Message broker started ({'Redis' if self._use_redis else 'In-Memory'})")
35
+
36
+ # Initialize agents with message broker
37
+ await initialize_all_agents(self.message_broker)
38
+ self._agents_initialized = True
39
+ logger.info("Enhanced agents initialized successfully with message broker")
40
+ except Exception as e:
41
+ logger.error(f"Failed to initialize enhanced agents: {e}")
42
+ raise
43
+
44
+ async def _process_message(self, message: Message, skill_id: Optional[str] = None) -> Message:
45
+ """Process message using MCP-enabled agents."""
46
+ # Ensure agents are initialized
47
+ if not self._agents_initialized:
48
+ await self.initialize_agents()
49
+
50
+ try:
51
+ # Route message to appropriate agent with message broker
52
+ response = await route_message_to_agent(message, self.message_broker)
53
+ logger.info(f"Message processed by enhanced agents")
54
+ return response
55
+ except Exception as e:
56
+ logger.error(f"Error processing message with enhanced agents: {e}")
57
+ # Fallback to echo behavior
58
+ response_parts = []
59
+ for part in message.parts:
60
+ if part.type == "text":
61
+ response_parts.append(Part(
62
+ type="text",
63
+ content=f"Echo: {part.content}"
64
+ ))
65
+ else:
66
+ response_parts.append(part)
67
+
68
+ return Message(parts=response_parts)
69
+
70
+ async def start(self, host: str = "0.0.0.0", port: int = 8000) -> None:
71
+ """Start the enhanced A2A server with proper initialization."""
72
+ # Initialize agents and message broker first
73
+ await self.initialize_agents()
74
+
75
+ # Now call parent start method
76
+ await super().start(host=host, port=port)
77
+
78
+ async def cleanup(self):
79
+ """Clean up server resources."""
80
+ if self._agents_initialized:
81
+ await cleanup_all_agents()
82
+ if self.message_broker:
83
+ await self.message_broker.stop()
84
+ self._agents_initialized = False
85
+ logger.info("Enhanced server cleanup completed")
86
+
87
+
88
+ def create_enhanced_agent_card() -> AgentCard:
89
+ """Create an enhanced agent card with A2A coordination capabilities."""
90
+ from .agent_card import AgentCard
91
+ from .models import AgentProvider
92
+
93
+ provider = AgentProvider(
94
+ organization="A2A Protocol Server",
95
+ url="https://github.com/rileyseaburg/codetether"
96
+ )
97
+
98
+ card = AgentCard(
99
+ name="A2A Coordination Hub",
100
+ description="Agent-to-Agent communication and task coordination server enabling distributed agent collaboration",
101
+ url="http://localhost:8000",
102
+ provider=provider
103
+ )
104
+
105
+ # Core A2A coordination skills
106
+ card.add_skill(
107
+ skill_id="task_delegation",
108
+ name="Task Delegation",
109
+ description="Delegate tasks to other agents in the network with status tracking",
110
+ input_modes=["text", "structured"],
111
+ output_modes=["text", "structured"]
112
+ )
113
+
114
+ card.add_skill(
115
+ skill_id="agent_discovery",
116
+ name="Agent Discovery",
117
+ description="Discover available agents and their capabilities for task routing",
118
+ input_modes=["text"],
119
+ output_modes=["structured"]
120
+ )
121
+
122
+ card.add_skill(
123
+ skill_id="message_queue",
124
+ name="Inter-Agent Messaging",
125
+ description="Asynchronous message queue for agent-to-agent communication",
126
+ input_modes=["text", "structured"],
127
+ output_modes=["text", "structured"]
128
+ )
129
+
130
+ card.add_skill(
131
+ skill_id="task_monitoring",
132
+ name="Task Status Monitoring",
133
+ description="Monitor and track task progress across distributed agents",
134
+ input_modes=["structured"],
135
+ output_modes=["structured", "streaming"]
136
+ )
137
+
138
+ card.add_skill(
139
+ skill_id="agent_registration",
140
+ name="Agent Registration",
141
+ description="Register new agents and their capabilities to the network",
142
+ input_modes=["structured"],
143
+ output_modes=["structured"]
144
+ )
145
+
146
+ # Enable media capability for real-time agent collaboration
147
+ card.enable_media()
148
+ card.add_livekit_interface(
149
+ token_endpoint="/v1/livekit/token",
150
+ server_managed=True
151
+ )
152
+
153
+ # Add MCP interface for external agent synchronization
154
+ card.add_mcp_interface(
155
+ endpoint="http://localhost:9000/mcp/v1/rpc",
156
+ protocol="http",
157
+ description="MCP interface for A2A task delegation, agent discovery, and message routing"
158
+ )
159
+
160
+ return card