massgen 0.1.1__py3-none-any.whl → 0.1.3__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 (77) hide show
  1. massgen/__init__.py +1 -1
  2. massgen/agent_config.py +33 -7
  3. massgen/api_params_handler/_api_params_handler_base.py +3 -0
  4. massgen/api_params_handler/_chat_completions_api_params_handler.py +7 -1
  5. massgen/backend/azure_openai.py +9 -1
  6. massgen/backend/base.py +56 -0
  7. massgen/backend/base_with_custom_tool_and_mcp.py +4 -4
  8. massgen/backend/capabilities.py +6 -6
  9. massgen/backend/chat_completions.py +18 -11
  10. massgen/backend/claude_code.py +9 -1
  11. massgen/backend/gemini.py +71 -6
  12. massgen/backend/gemini_utils.py +30 -0
  13. massgen/backend/grok.py +39 -6
  14. massgen/backend/response.py +18 -11
  15. massgen/chat_agent.py +9 -3
  16. massgen/cli.py +319 -43
  17. massgen/config_builder.py +163 -18
  18. massgen/configs/README.md +78 -20
  19. massgen/configs/basic/multi/three_agents_default.yaml +2 -2
  20. massgen/configs/debug/restart_test_controlled.yaml +60 -0
  21. massgen/configs/debug/restart_test_controlled_filesystem.yaml +73 -0
  22. massgen/configs/tools/code-execution/docker_with_sudo.yaml +35 -0
  23. massgen/configs/tools/custom_tools/computer_use_browser_example.yaml +56 -0
  24. massgen/configs/tools/custom_tools/computer_use_docker_example.yaml +65 -0
  25. massgen/configs/tools/custom_tools/computer_use_example.yaml +50 -0
  26. massgen/configs/tools/custom_tools/crawl4ai_mcp_example.yaml +67 -0
  27. massgen/configs/tools/custom_tools/crawl4ai_multi_agent_example.yaml +68 -0
  28. massgen/configs/tools/custom_tools/multimodal_tools/playwright_with_img_understanding.yaml +98 -0
  29. massgen/configs/tools/custom_tools/multimodal_tools/understand_audio.yaml +33 -0
  30. massgen/configs/tools/custom_tools/multimodal_tools/understand_file.yaml +34 -0
  31. massgen/configs/tools/custom_tools/multimodal_tools/understand_image.yaml +33 -0
  32. massgen/configs/tools/custom_tools/multimodal_tools/understand_video.yaml +34 -0
  33. massgen/configs/tools/custom_tools/multimodal_tools/understand_video_example.yaml +54 -0
  34. massgen/configs/tools/custom_tools/multimodal_tools/youtube_video_analysis.yaml +59 -0
  35. massgen/configs/tools/memory/README.md +199 -0
  36. massgen/configs/tools/memory/gpt5mini_gemini_context_window_management.yaml +131 -0
  37. massgen/configs/tools/memory/gpt5mini_gemini_no_persistent_memory.yaml +133 -0
  38. massgen/configs/tools/memory/test_context_window_management.py +286 -0
  39. massgen/configs/tools/multimodal/gpt5mini_gpt5nano_documentation_evolution.yaml +97 -0
  40. massgen/configs/tools/planning/five_agents_discord_mcp_planning_mode.yaml +7 -29
  41. massgen/configs/tools/planning/five_agents_filesystem_mcp_planning_mode.yaml +5 -6
  42. massgen/configs/tools/planning/five_agents_notion_mcp_planning_mode.yaml +4 -4
  43. massgen/configs/tools/planning/five_agents_twitter_mcp_planning_mode.yaml +4 -4
  44. massgen/configs/tools/planning/gpt5_mini_case_study_mcp_planning_mode.yaml +2 -2
  45. massgen/docker/README.md +83 -0
  46. massgen/filesystem_manager/_code_execution_server.py +22 -7
  47. massgen/filesystem_manager/_docker_manager.py +21 -1
  48. massgen/filesystem_manager/_filesystem_manager.py +8 -0
  49. massgen/filesystem_manager/_workspace_tools_server.py +0 -997
  50. massgen/formatter/_gemini_formatter.py +73 -0
  51. massgen/frontend/coordination_ui.py +175 -257
  52. massgen/frontend/displays/base_display.py +29 -0
  53. massgen/frontend/displays/rich_terminal_display.py +155 -9
  54. massgen/frontend/displays/simple_display.py +21 -0
  55. massgen/frontend/displays/terminal_display.py +22 -2
  56. massgen/logger_config.py +50 -6
  57. massgen/message_templates.py +123 -3
  58. massgen/orchestrator.py +652 -44
  59. massgen/tests/test_code_execution.py +178 -0
  60. massgen/tests/test_intelligent_planning_mode.py +643 -0
  61. massgen/tests/test_orchestration_restart.py +204 -0
  62. massgen/token_manager/token_manager.py +13 -4
  63. massgen/tool/__init__.py +4 -0
  64. massgen/tool/_multimodal_tools/understand_audio.py +193 -0
  65. massgen/tool/_multimodal_tools/understand_file.py +550 -0
  66. massgen/tool/_multimodal_tools/understand_image.py +212 -0
  67. massgen/tool/_multimodal_tools/understand_video.py +313 -0
  68. massgen/tool/docs/multimodal_tools.md +779 -0
  69. massgen/tool/workflow_toolkits/__init__.py +26 -0
  70. massgen/tool/workflow_toolkits/post_evaluation.py +216 -0
  71. massgen/utils.py +1 -0
  72. {massgen-0.1.1.dist-info → massgen-0.1.3.dist-info}/METADATA +57 -52
  73. {massgen-0.1.1.dist-info → massgen-0.1.3.dist-info}/RECORD +77 -49
  74. {massgen-0.1.1.dist-info → massgen-0.1.3.dist-info}/WHEEL +0 -0
  75. {massgen-0.1.1.dist-info → massgen-0.1.3.dist-info}/entry_points.txt +0 -0
  76. {massgen-0.1.1.dist-info → massgen-0.1.3.dist-info}/licenses/LICENSE +0 -0
  77. {massgen-0.1.1.dist-info → massgen-0.1.3.dist-info}/top_level.txt +0 -0
@@ -75,6 +75,21 @@ class GeminiFormatter(FormatterBase):
75
75
 
76
76
  return "vote" in tool_names and "new_answer" in tool_names
77
77
 
78
+ def has_post_evaluation_tools(self, tools: List[Dict[str, Any]]) -> bool:
79
+ """Detect if tools contain submit/restart_orchestration post-evaluation tools."""
80
+ if not tools:
81
+ return False
82
+
83
+ tool_names = set()
84
+ for tool in tools:
85
+ if tool.get("type") == "function":
86
+ if "function" in tool:
87
+ tool_names.add(tool["function"].get("name", ""))
88
+ elif "name" in tool:
89
+ tool_names.add(tool.get("name", ""))
90
+
91
+ return "submit" in tool_names and "restart_orchestration" in tool_names
92
+
78
93
  def build_structured_output_prompt(self, base_content: str, valid_agent_ids: Optional[List[str]] = None) -> str:
79
94
  """Build prompt that encourages structured output for coordination."""
80
95
  agent_list = ""
@@ -104,6 +119,33 @@ If you want to provide a NEW ANSWER:
104
119
  }}
105
120
  }}
106
121
 
122
+ Make your decision and include the JSON at the very end of your response."""
123
+
124
+ def build_post_evaluation_prompt(self, base_content: str) -> str:
125
+ """Build prompt that encourages structured output for post-evaluation."""
126
+ return f"""{base_content}
127
+
128
+ IMPORTANT: You must respond with a structured JSON decision at the end of your response.
129
+
130
+ If you want to SUBMIT the answer (it's complete and satisfactory):
131
+ {{
132
+ "action_type": "submit",
133
+ "submit_data": {{
134
+ "action": "submit",
135
+ "confirmed": true
136
+ }}
137
+ }}
138
+
139
+ If you want to RESTART with improvements:
140
+ {{
141
+ "action_type": "restart",
142
+ "restart_data": {{
143
+ "action": "restart",
144
+ "reason": "Clear explanation of why the answer is insufficient",
145
+ "instructions": "Detailed, actionable guidance for the next attempt"
146
+ }}
147
+ }}
148
+
107
149
  Make your decision and include the JSON at the very end of your response."""
108
150
 
109
151
  def extract_structured_response(self, response_text: str) -> Optional[Dict[str, Any]]:
@@ -192,6 +234,7 @@ Make your decision and include the JSON at the very end of your response."""
192
234
  """Convert structured response to tool call format."""
193
235
  action_type = structured_response.get("action_type")
194
236
 
237
+ # Coordination tools
195
238
  if action_type == "vote":
196
239
  vote_data = structured_response.get("vote_data", {})
197
240
  return [
@@ -221,6 +264,36 @@ Make your decision and include the JSON at the very end of your response."""
221
264
  },
222
265
  ]
223
266
 
267
+ # Post-evaluation tools
268
+ elif action_type == "submit":
269
+ submit_data = structured_response.get("submit_data", {})
270
+ return [
271
+ {
272
+ "id": f"submit_{abs(hash(str(submit_data))) % 10000 + 1}",
273
+ "type": "function",
274
+ "function": {
275
+ "name": "submit",
276
+ "arguments": {"confirmed": submit_data.get("confirmed", True)},
277
+ },
278
+ },
279
+ ]
280
+
281
+ elif action_type == "restart":
282
+ restart_data = structured_response.get("restart_data", {})
283
+ return [
284
+ {
285
+ "id": f"restart_{abs(hash(str(restart_data))) % 10000 + 1}",
286
+ "type": "function",
287
+ "function": {
288
+ "name": "restart_orchestration",
289
+ "arguments": {
290
+ "reason": restart_data.get("reason", ""),
291
+ "instructions": restart_data.get("instructions", ""),
292
+ },
293
+ },
294
+ },
295
+ ]
296
+
224
297
  return []
225
298
 
226
299
  # Custom tools formatting for Gemini