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.
- massgen/__init__.py +1 -1
- massgen/agent_config.py +33 -7
- massgen/api_params_handler/_api_params_handler_base.py +3 -0
- massgen/api_params_handler/_chat_completions_api_params_handler.py +7 -1
- massgen/backend/azure_openai.py +9 -1
- massgen/backend/base.py +56 -0
- massgen/backend/base_with_custom_tool_and_mcp.py +4 -4
- massgen/backend/capabilities.py +6 -6
- massgen/backend/chat_completions.py +18 -11
- massgen/backend/claude_code.py +9 -1
- massgen/backend/gemini.py +71 -6
- massgen/backend/gemini_utils.py +30 -0
- massgen/backend/grok.py +39 -6
- massgen/backend/response.py +18 -11
- massgen/chat_agent.py +9 -3
- massgen/cli.py +319 -43
- massgen/config_builder.py +163 -18
- massgen/configs/README.md +78 -20
- massgen/configs/basic/multi/three_agents_default.yaml +2 -2
- massgen/configs/debug/restart_test_controlled.yaml +60 -0
- massgen/configs/debug/restart_test_controlled_filesystem.yaml +73 -0
- massgen/configs/tools/code-execution/docker_with_sudo.yaml +35 -0
- massgen/configs/tools/custom_tools/computer_use_browser_example.yaml +56 -0
- massgen/configs/tools/custom_tools/computer_use_docker_example.yaml +65 -0
- massgen/configs/tools/custom_tools/computer_use_example.yaml +50 -0
- massgen/configs/tools/custom_tools/crawl4ai_mcp_example.yaml +67 -0
- massgen/configs/tools/custom_tools/crawl4ai_multi_agent_example.yaml +68 -0
- massgen/configs/tools/custom_tools/multimodal_tools/playwright_with_img_understanding.yaml +98 -0
- massgen/configs/tools/custom_tools/multimodal_tools/understand_audio.yaml +33 -0
- massgen/configs/tools/custom_tools/multimodal_tools/understand_file.yaml +34 -0
- massgen/configs/tools/custom_tools/multimodal_tools/understand_image.yaml +33 -0
- massgen/configs/tools/custom_tools/multimodal_tools/understand_video.yaml +34 -0
- massgen/configs/tools/custom_tools/multimodal_tools/understand_video_example.yaml +54 -0
- massgen/configs/tools/custom_tools/multimodal_tools/youtube_video_analysis.yaml +59 -0
- massgen/configs/tools/memory/README.md +199 -0
- massgen/configs/tools/memory/gpt5mini_gemini_context_window_management.yaml +131 -0
- massgen/configs/tools/memory/gpt5mini_gemini_no_persistent_memory.yaml +133 -0
- massgen/configs/tools/memory/test_context_window_management.py +286 -0
- massgen/configs/tools/multimodal/gpt5mini_gpt5nano_documentation_evolution.yaml +97 -0
- massgen/configs/tools/planning/five_agents_discord_mcp_planning_mode.yaml +7 -29
- massgen/configs/tools/planning/five_agents_filesystem_mcp_planning_mode.yaml +5 -6
- massgen/configs/tools/planning/five_agents_notion_mcp_planning_mode.yaml +4 -4
- massgen/configs/tools/planning/five_agents_twitter_mcp_planning_mode.yaml +4 -4
- massgen/configs/tools/planning/gpt5_mini_case_study_mcp_planning_mode.yaml +2 -2
- massgen/docker/README.md +83 -0
- massgen/filesystem_manager/_code_execution_server.py +22 -7
- massgen/filesystem_manager/_docker_manager.py +21 -1
- massgen/filesystem_manager/_filesystem_manager.py +8 -0
- massgen/filesystem_manager/_workspace_tools_server.py +0 -997
- massgen/formatter/_gemini_formatter.py +73 -0
- massgen/frontend/coordination_ui.py +175 -257
- massgen/frontend/displays/base_display.py +29 -0
- massgen/frontend/displays/rich_terminal_display.py +155 -9
- massgen/frontend/displays/simple_display.py +21 -0
- massgen/frontend/displays/terminal_display.py +22 -2
- massgen/logger_config.py +50 -6
- massgen/message_templates.py +123 -3
- massgen/orchestrator.py +652 -44
- massgen/tests/test_code_execution.py +178 -0
- massgen/tests/test_intelligent_planning_mode.py +643 -0
- massgen/tests/test_orchestration_restart.py +204 -0
- massgen/token_manager/token_manager.py +13 -4
- massgen/tool/__init__.py +4 -0
- massgen/tool/_multimodal_tools/understand_audio.py +193 -0
- massgen/tool/_multimodal_tools/understand_file.py +550 -0
- massgen/tool/_multimodal_tools/understand_image.py +212 -0
- massgen/tool/_multimodal_tools/understand_video.py +313 -0
- massgen/tool/docs/multimodal_tools.md +779 -0
- massgen/tool/workflow_toolkits/__init__.py +26 -0
- massgen/tool/workflow_toolkits/post_evaluation.py +216 -0
- massgen/utils.py +1 -0
- {massgen-0.1.1.dist-info → massgen-0.1.3.dist-info}/METADATA +57 -52
- {massgen-0.1.1.dist-info → massgen-0.1.3.dist-info}/RECORD +77 -49
- {massgen-0.1.1.dist-info → massgen-0.1.3.dist-info}/WHEEL +0 -0
- {massgen-0.1.1.dist-info → massgen-0.1.3.dist-info}/entry_points.txt +0 -0
- {massgen-0.1.1.dist-info → massgen-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {massgen-0.1.1.dist-info → massgen-0.1.3.dist-info}/top_level.txt +0 -0
|
@@ -62,7 +62,7 @@ def _validate_path_access(path: Path, allowed_paths: List[Path]) -> None:
|
|
|
62
62
|
raise ValueError(f"Path not in allowed directories: {path}")
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
def _sanitize_command(command: str) -> None:
|
|
65
|
+
def _sanitize_command(command: str, enable_sudo: bool = False) -> None:
|
|
66
66
|
"""
|
|
67
67
|
Sanitize the command to prevent dangerous operations.
|
|
68
68
|
|
|
@@ -71,6 +71,7 @@ def _sanitize_command(command: str) -> None:
|
|
|
71
71
|
|
|
72
72
|
Args:
|
|
73
73
|
command: The command to sanitize
|
|
74
|
+
enable_sudo: Whether sudo is enabled (in Docker mode with sudo variant)
|
|
74
75
|
|
|
75
76
|
Raises:
|
|
76
77
|
ValueError: If dangerous command is detected
|
|
@@ -82,13 +83,20 @@ def _sanitize_command(command: str) -> None:
|
|
|
82
83
|
(r"\bdd\b", "Use of 'dd' command is not allowed"),
|
|
83
84
|
(r">\s*/dev/sd[a-z][1-9]?", "Overwriting disk blocks directly is not allowed"),
|
|
84
85
|
(r":\(\)\{\s*:\|\:&\s*\};:", "Fork bombs are not allowed"),
|
|
85
|
-
# Additional safety patterns
|
|
86
|
-
(r"\bsudo\b", "Use of 'sudo' is not allowed"),
|
|
87
|
-
(r"\bsu\b", "Use of 'su' is not allowed"),
|
|
88
|
-
(r"\bchown\b", "Use of 'chown' is not allowed"),
|
|
89
|
-
(r"\bchmod\b", "Use of 'chmod' is not allowed"),
|
|
90
86
|
]
|
|
91
87
|
|
|
88
|
+
# Only check these patterns if sudo is NOT enabled
|
|
89
|
+
# When sudo is enabled (Docker mode with sudo variant), these are safe
|
|
90
|
+
if not enable_sudo:
|
|
91
|
+
dangerous_patterns.extend(
|
|
92
|
+
[
|
|
93
|
+
(r"\bsudo\b", "Use of 'sudo' is not allowed"),
|
|
94
|
+
(r"\bsu\b", "Use of 'su' is not allowed"),
|
|
95
|
+
(r"\bchown\b", "Use of 'chown' is not allowed"),
|
|
96
|
+
(r"\bchmod\b", "Use of 'chmod' is not allowed"),
|
|
97
|
+
],
|
|
98
|
+
)
|
|
99
|
+
|
|
92
100
|
for pattern, message in dangerous_patterns:
|
|
93
101
|
if re.search(pattern, command):
|
|
94
102
|
raise ValueError(f"Potentially dangerous command detected: {message}")
|
|
@@ -202,6 +210,12 @@ async def create_server() -> fastmcp.FastMCP:
|
|
|
202
210
|
default=None,
|
|
203
211
|
help="Agent ID (required for Docker mode to identify container)",
|
|
204
212
|
)
|
|
213
|
+
parser.add_argument(
|
|
214
|
+
"--enable-sudo",
|
|
215
|
+
action="store_true",
|
|
216
|
+
default=False,
|
|
217
|
+
help="Enable sudo in Docker containers (disables sudo command sanitization checks)",
|
|
218
|
+
)
|
|
205
219
|
args = parser.parse_args()
|
|
206
220
|
|
|
207
221
|
# Create the FastMCP server
|
|
@@ -215,6 +229,7 @@ async def create_server() -> fastmcp.FastMCP:
|
|
|
215
229
|
mcp.blocked_commands = args.blocked_commands # Blacklist patterns
|
|
216
230
|
mcp.execution_mode = args.execution_mode
|
|
217
231
|
mcp.agent_id = args.agent_id
|
|
232
|
+
mcp.enable_sudo = args.enable_sudo
|
|
218
233
|
|
|
219
234
|
# Initialize Docker client if Docker mode
|
|
220
235
|
mcp.docker_client = None
|
|
@@ -294,7 +309,7 @@ async def create_server() -> fastmcp.FastMCP:
|
|
|
294
309
|
try:
|
|
295
310
|
# Basic command sanitization (dangerous patterns)
|
|
296
311
|
try:
|
|
297
|
-
_sanitize_command(command)
|
|
312
|
+
_sanitize_command(command, enable_sudo=mcp.enable_sudo)
|
|
298
313
|
except ValueError as e:
|
|
299
314
|
return {
|
|
300
315
|
"success": False,
|
|
@@ -45,6 +45,7 @@ class DockerManager:
|
|
|
45
45
|
network_mode: str = "none",
|
|
46
46
|
memory_limit: Optional[str] = None,
|
|
47
47
|
cpu_limit: Optional[float] = None,
|
|
48
|
+
enable_sudo: bool = False,
|
|
48
49
|
):
|
|
49
50
|
"""
|
|
50
51
|
Initialize Docker manager.
|
|
@@ -54,6 +55,7 @@ class DockerManager:
|
|
|
54
55
|
network_mode: Network mode (none/bridge/host)
|
|
55
56
|
memory_limit: Memory limit (e.g., "2g", "512m")
|
|
56
57
|
cpu_limit: CPU limit (e.g., 2.0 for 2 CPUs)
|
|
58
|
+
enable_sudo: Enable sudo access in containers (isolated from host system)
|
|
57
59
|
|
|
58
60
|
Raises:
|
|
59
61
|
RuntimeError: If Docker is not available or cannot connect
|
|
@@ -61,7 +63,20 @@ class DockerManager:
|
|
|
61
63
|
if not DOCKER_AVAILABLE:
|
|
62
64
|
raise RuntimeError("Docker Python library not available. Install with: pip install docker")
|
|
63
65
|
|
|
64
|
-
|
|
66
|
+
# If sudo is enabled and user is using default image, switch to sudo variant
|
|
67
|
+
self.enable_sudo = enable_sudo
|
|
68
|
+
if enable_sudo and image == "massgen/mcp-runtime:latest":
|
|
69
|
+
self.image = "massgen/mcp-runtime-sudo:latest"
|
|
70
|
+
logger.info(
|
|
71
|
+
"ℹ️ [Docker] Sudo access enabled in container (isolated from host) - using 'massgen/mcp-runtime-sudo:latest' image.",
|
|
72
|
+
)
|
|
73
|
+
elif enable_sudo:
|
|
74
|
+
logger.info(
|
|
75
|
+
"ℹ️ [Docker] Sudo access enabled in container (isolated from host) with custom image.",
|
|
76
|
+
)
|
|
77
|
+
else:
|
|
78
|
+
self.image = image
|
|
79
|
+
|
|
65
80
|
self.network_mode = network_mode
|
|
66
81
|
self.memory_limit = memory_limit
|
|
67
82
|
self.cpu_limit = cpu_limit
|
|
@@ -103,6 +118,11 @@ class DockerManager:
|
|
|
103
118
|
self.client.images.pull(self.image)
|
|
104
119
|
logger.info(f"✅ [Docker] Successfully pulled image '{self.image}'")
|
|
105
120
|
except DockerException as e:
|
|
121
|
+
# Special handling for sudo image - it's built locally, not pulled
|
|
122
|
+
if "mcp-runtime-sudo" in self.image:
|
|
123
|
+
raise RuntimeError(
|
|
124
|
+
f"Failed to pull Docker image '{self.image}': {e}\n" f"The sudo image must be built locally. Run:\n" f" bash massgen/docker/build.sh --sudo",
|
|
125
|
+
)
|
|
106
126
|
raise RuntimeError(f"Failed to pull Docker image '{self.image}': {e}")
|
|
107
127
|
|
|
108
128
|
def create_container(
|
|
@@ -55,6 +55,7 @@ class FilesystemManager:
|
|
|
55
55
|
command_line_docker_memory_limit: Optional[str] = None,
|
|
56
56
|
command_line_docker_cpu_limit: Optional[float] = None,
|
|
57
57
|
command_line_docker_network_mode: str = "none",
|
|
58
|
+
command_line_docker_enable_sudo: bool = False,
|
|
58
59
|
enable_audio_generation: bool = False,
|
|
59
60
|
):
|
|
60
61
|
"""
|
|
@@ -75,6 +76,7 @@ class FilesystemManager:
|
|
|
75
76
|
command_line_docker_memory_limit: Memory limit for Docker containers (e.g., "2g")
|
|
76
77
|
command_line_docker_cpu_limit: CPU limit for Docker containers (e.g., 2.0 for 2 CPUs)
|
|
77
78
|
command_line_docker_network_mode: Network mode for Docker containers (none/bridge/host)
|
|
79
|
+
command_line_docker_enable_sudo: Enable sudo access in Docker containers (isolated from host system)
|
|
78
80
|
"""
|
|
79
81
|
self.agent_id = None # Will be set by orchestrator via setup_orchestration_paths
|
|
80
82
|
self.enable_image_generation = enable_image_generation
|
|
@@ -86,6 +88,7 @@ class FilesystemManager:
|
|
|
86
88
|
self.command_line_docker_memory_limit = command_line_docker_memory_limit
|
|
87
89
|
self.command_line_docker_cpu_limit = command_line_docker_cpu_limit
|
|
88
90
|
self.command_line_docker_network_mode = command_line_docker_network_mode
|
|
91
|
+
self.command_line_docker_enable_sudo = command_line_docker_enable_sudo
|
|
89
92
|
|
|
90
93
|
# Initialize Docker manager if Docker mode enabled
|
|
91
94
|
self.docker_manager = None
|
|
@@ -97,6 +100,7 @@ class FilesystemManager:
|
|
|
97
100
|
network_mode=command_line_docker_network_mode,
|
|
98
101
|
memory_limit=command_line_docker_memory_limit,
|
|
99
102
|
cpu_limit=command_line_docker_cpu_limit,
|
|
103
|
+
enable_sudo=command_line_docker_enable_sudo,
|
|
100
104
|
)
|
|
101
105
|
self.enable_audio_generation = enable_audio_generation
|
|
102
106
|
|
|
@@ -360,6 +364,10 @@ class FilesystemManager:
|
|
|
360
364
|
if self.command_line_execution_mode == "docker" and self.agent_id:
|
|
361
365
|
config["args"].extend(["--agent-id", self.agent_id])
|
|
362
366
|
|
|
367
|
+
# Add sudo flag for Docker mode
|
|
368
|
+
if self.command_line_execution_mode == "docker" and self.command_line_docker_enable_sudo:
|
|
369
|
+
config["args"].append("--enable-sudo")
|
|
370
|
+
|
|
363
371
|
# Add command filters if specified
|
|
364
372
|
if self.command_line_allowed_commands:
|
|
365
373
|
config["args"].extend(["--allowed-commands"] + self.command_line_allowed_commands)
|