Coverage for integrations / coding_agent / task_distributor.py: 100.0%

4 statements  

« prev     ^ index     » next       coverage.py v7.14.0, created at 2026-05-12 04:49 +0000

1""" 

2HevolveSocial - Chat Dispatch 

3 

4Thin wrapper around the unified dispatch.dispatch_goal(). 

5Kept for backwards compatibility (coding_daemon, tests). 

6All 3-tier logic (in-process → HTTP → fallback) lives in dispatch.py. 

7""" 

8from typing import Optional 

9 

10 

11def dispatch_to_chat(prompt: str, user_id: str, goal_id: str, 

12 goal_type: str = 'coding') -> Optional[str]: 

13 """Send a coding goal prompt through the unified 3-tier dispatch. 

14 

15 Delegates to dispatch.dispatch_goal() which handles: 

16 Tier 1: Direct in-process call (no HTTP, no ports) 

17 Tier 2: HTTP proxy to backend port 

18 Tier 3: llama.cpp fallback 

19 

20 Args: 

21 prompt: The goal prompt text 

22 user_id: Agent user_id to dispatch as 

23 goal_id: The goal identifier 

24 goal_type: Goal type (default 'coding') 

25 

26 Returns: 

27 Response text or None on failure 

28 """ 

29 from integrations.agent_engine.dispatch import dispatch_goal 

30 return dispatch_goal(prompt, user_id, goal_id, goal_type=goal_type)