hanzo-mcp 0.7.7__py3-none-any.whl → 0.8.0__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.

Potentially problematic release.


This version of hanzo-mcp might be problematic. Click here for more details.

Files changed (178) hide show
  1. hanzo_mcp/__init__.py +6 -0
  2. hanzo_mcp/__main__.py +1 -1
  3. hanzo_mcp/analytics/__init__.py +2 -2
  4. hanzo_mcp/analytics/posthog_analytics.py +76 -82
  5. hanzo_mcp/cli.py +31 -36
  6. hanzo_mcp/cli_enhanced.py +94 -72
  7. hanzo_mcp/cli_plugin.py +27 -17
  8. hanzo_mcp/config/__init__.py +2 -2
  9. hanzo_mcp/config/settings.py +112 -88
  10. hanzo_mcp/config/tool_config.py +32 -34
  11. hanzo_mcp/dev_server.py +66 -67
  12. hanzo_mcp/prompts/__init__.py +94 -12
  13. hanzo_mcp/prompts/enhanced_prompts.py +809 -0
  14. hanzo_mcp/prompts/example_custom_prompt.py +6 -5
  15. hanzo_mcp/prompts/project_todo_reminder.py +0 -1
  16. hanzo_mcp/prompts/tool_explorer.py +10 -7
  17. hanzo_mcp/server.py +17 -21
  18. hanzo_mcp/server_enhanced.py +15 -22
  19. hanzo_mcp/tools/__init__.py +56 -28
  20. hanzo_mcp/tools/agent/__init__.py +16 -19
  21. hanzo_mcp/tools/agent/agent.py +82 -65
  22. hanzo_mcp/tools/agent/agent_tool.py +152 -122
  23. hanzo_mcp/tools/agent/agent_tool_v1_deprecated.py +66 -62
  24. hanzo_mcp/tools/agent/clarification_protocol.py +55 -50
  25. hanzo_mcp/tools/agent/clarification_tool.py +11 -10
  26. hanzo_mcp/tools/agent/claude_cli_tool.py +21 -20
  27. hanzo_mcp/tools/agent/claude_desktop_auth.py +130 -144
  28. hanzo_mcp/tools/agent/cli_agent_base.py +59 -53
  29. hanzo_mcp/tools/agent/code_auth.py +102 -107
  30. hanzo_mcp/tools/agent/code_auth_tool.py +28 -27
  31. hanzo_mcp/tools/agent/codex_cli_tool.py +20 -19
  32. hanzo_mcp/tools/agent/critic_tool.py +86 -73
  33. hanzo_mcp/tools/agent/gemini_cli_tool.py +21 -20
  34. hanzo_mcp/tools/agent/grok_cli_tool.py +21 -20
  35. hanzo_mcp/tools/agent/iching_tool.py +404 -139
  36. hanzo_mcp/tools/agent/network_tool.py +89 -73
  37. hanzo_mcp/tools/agent/prompt.py +2 -1
  38. hanzo_mcp/tools/agent/review_tool.py +101 -98
  39. hanzo_mcp/tools/agent/swarm_alias.py +87 -0
  40. hanzo_mcp/tools/agent/swarm_tool.py +246 -161
  41. hanzo_mcp/tools/agent/swarm_tool_v1_deprecated.py +134 -92
  42. hanzo_mcp/tools/agent/tool_adapter.py +21 -11
  43. hanzo_mcp/tools/common/__init__.py +1 -1
  44. hanzo_mcp/tools/common/base.py +3 -5
  45. hanzo_mcp/tools/common/batch_tool.py +46 -39
  46. hanzo_mcp/tools/common/config_tool.py +120 -84
  47. hanzo_mcp/tools/common/context.py +1 -5
  48. hanzo_mcp/tools/common/context_fix.py +5 -3
  49. hanzo_mcp/tools/common/critic_tool.py +4 -8
  50. hanzo_mcp/tools/common/decorators.py +58 -56
  51. hanzo_mcp/tools/common/enhanced_base.py +29 -32
  52. hanzo_mcp/tools/common/fastmcp_pagination.py +91 -94
  53. hanzo_mcp/tools/common/forgiving_edit.py +91 -87
  54. hanzo_mcp/tools/common/mode.py +15 -17
  55. hanzo_mcp/tools/common/mode_loader.py +27 -24
  56. hanzo_mcp/tools/common/paginated_base.py +61 -53
  57. hanzo_mcp/tools/common/paginated_response.py +72 -79
  58. hanzo_mcp/tools/common/pagination.py +50 -53
  59. hanzo_mcp/tools/common/permissions.py +4 -4
  60. hanzo_mcp/tools/common/personality.py +186 -138
  61. hanzo_mcp/tools/common/plugin_loader.py +54 -54
  62. hanzo_mcp/tools/common/stats.py +65 -47
  63. hanzo_mcp/tools/common/test_helpers.py +31 -0
  64. hanzo_mcp/tools/common/thinking_tool.py +4 -8
  65. hanzo_mcp/tools/common/tool_disable.py +17 -12
  66. hanzo_mcp/tools/common/tool_enable.py +13 -14
  67. hanzo_mcp/tools/common/tool_list.py +36 -28
  68. hanzo_mcp/tools/common/truncate.py +23 -23
  69. hanzo_mcp/tools/config/__init__.py +4 -4
  70. hanzo_mcp/tools/config/config_tool.py +42 -29
  71. hanzo_mcp/tools/config/index_config.py +37 -34
  72. hanzo_mcp/tools/config/mode_tool.py +175 -55
  73. hanzo_mcp/tools/database/__init__.py +15 -12
  74. hanzo_mcp/tools/database/database_manager.py +77 -75
  75. hanzo_mcp/tools/database/graph.py +137 -91
  76. hanzo_mcp/tools/database/graph_add.py +30 -18
  77. hanzo_mcp/tools/database/graph_query.py +178 -102
  78. hanzo_mcp/tools/database/graph_remove.py +33 -28
  79. hanzo_mcp/tools/database/graph_search.py +97 -75
  80. hanzo_mcp/tools/database/graph_stats.py +91 -59
  81. hanzo_mcp/tools/database/sql.py +107 -79
  82. hanzo_mcp/tools/database/sql_query.py +30 -24
  83. hanzo_mcp/tools/database/sql_search.py +29 -25
  84. hanzo_mcp/tools/database/sql_stats.py +47 -35
  85. hanzo_mcp/tools/editor/neovim_command.py +25 -28
  86. hanzo_mcp/tools/editor/neovim_edit.py +21 -23
  87. hanzo_mcp/tools/editor/neovim_session.py +60 -54
  88. hanzo_mcp/tools/filesystem/__init__.py +31 -30
  89. hanzo_mcp/tools/filesystem/ast_multi_edit.py +329 -249
  90. hanzo_mcp/tools/filesystem/ast_tool.py +4 -4
  91. hanzo_mcp/tools/filesystem/base.py +1 -1
  92. hanzo_mcp/tools/filesystem/batch_search.py +316 -224
  93. hanzo_mcp/tools/filesystem/content_replace.py +4 -4
  94. hanzo_mcp/tools/filesystem/diff.py +71 -59
  95. hanzo_mcp/tools/filesystem/directory_tree.py +7 -7
  96. hanzo_mcp/tools/filesystem/directory_tree_paginated.py +49 -37
  97. hanzo_mcp/tools/filesystem/edit.py +4 -4
  98. hanzo_mcp/tools/filesystem/find.py +173 -80
  99. hanzo_mcp/tools/filesystem/find_files.py +73 -52
  100. hanzo_mcp/tools/filesystem/git_search.py +157 -104
  101. hanzo_mcp/tools/filesystem/grep.py +8 -8
  102. hanzo_mcp/tools/filesystem/multi_edit.py +4 -8
  103. hanzo_mcp/tools/filesystem/read.py +12 -10
  104. hanzo_mcp/tools/filesystem/rules_tool.py +59 -43
  105. hanzo_mcp/tools/filesystem/search_tool.py +263 -207
  106. hanzo_mcp/tools/filesystem/symbols_tool.py +94 -54
  107. hanzo_mcp/tools/filesystem/tree.py +35 -33
  108. hanzo_mcp/tools/filesystem/unix_aliases.py +13 -18
  109. hanzo_mcp/tools/filesystem/watch.py +37 -36
  110. hanzo_mcp/tools/filesystem/write.py +4 -8
  111. hanzo_mcp/tools/jupyter/__init__.py +4 -4
  112. hanzo_mcp/tools/jupyter/base.py +4 -5
  113. hanzo_mcp/tools/jupyter/jupyter.py +67 -47
  114. hanzo_mcp/tools/jupyter/notebook_edit.py +4 -4
  115. hanzo_mcp/tools/jupyter/notebook_read.py +4 -7
  116. hanzo_mcp/tools/llm/__init__.py +5 -7
  117. hanzo_mcp/tools/llm/consensus_tool.py +72 -52
  118. hanzo_mcp/tools/llm/llm_manage.py +101 -60
  119. hanzo_mcp/tools/llm/llm_tool.py +226 -166
  120. hanzo_mcp/tools/llm/provider_tools.py +25 -26
  121. hanzo_mcp/tools/lsp/__init__.py +1 -1
  122. hanzo_mcp/tools/lsp/lsp_tool.py +228 -143
  123. hanzo_mcp/tools/mcp/__init__.py +2 -3
  124. hanzo_mcp/tools/mcp/mcp_add.py +27 -25
  125. hanzo_mcp/tools/mcp/mcp_remove.py +7 -8
  126. hanzo_mcp/tools/mcp/mcp_stats.py +23 -22
  127. hanzo_mcp/tools/mcp/mcp_tool.py +129 -98
  128. hanzo_mcp/tools/memory/__init__.py +39 -21
  129. hanzo_mcp/tools/memory/knowledge_tools.py +124 -99
  130. hanzo_mcp/tools/memory/memory_tools.py +90 -108
  131. hanzo_mcp/tools/search/__init__.py +7 -2
  132. hanzo_mcp/tools/search/find_tool.py +297 -212
  133. hanzo_mcp/tools/search/unified_search.py +366 -314
  134. hanzo_mcp/tools/shell/__init__.py +8 -7
  135. hanzo_mcp/tools/shell/auto_background.py +56 -49
  136. hanzo_mcp/tools/shell/base.py +1 -1
  137. hanzo_mcp/tools/shell/base_process.py +75 -75
  138. hanzo_mcp/tools/shell/bash_session.py +2 -2
  139. hanzo_mcp/tools/shell/bash_session_executor.py +4 -4
  140. hanzo_mcp/tools/shell/bash_tool.py +24 -31
  141. hanzo_mcp/tools/shell/command_executor.py +12 -12
  142. hanzo_mcp/tools/shell/logs.py +43 -33
  143. hanzo_mcp/tools/shell/npx.py +13 -13
  144. hanzo_mcp/tools/shell/npx_background.py +24 -21
  145. hanzo_mcp/tools/shell/npx_tool.py +18 -22
  146. hanzo_mcp/tools/shell/open.py +19 -21
  147. hanzo_mcp/tools/shell/pkill.py +31 -26
  148. hanzo_mcp/tools/shell/process_tool.py +32 -32
  149. hanzo_mcp/tools/shell/processes.py +57 -58
  150. hanzo_mcp/tools/shell/run_background.py +24 -25
  151. hanzo_mcp/tools/shell/run_command.py +5 -5
  152. hanzo_mcp/tools/shell/run_command_windows.py +5 -5
  153. hanzo_mcp/tools/shell/session_storage.py +3 -3
  154. hanzo_mcp/tools/shell/streaming_command.py +141 -126
  155. hanzo_mcp/tools/shell/uvx.py +24 -25
  156. hanzo_mcp/tools/shell/uvx_background.py +35 -33
  157. hanzo_mcp/tools/shell/uvx_tool.py +18 -22
  158. hanzo_mcp/tools/todo/__init__.py +6 -2
  159. hanzo_mcp/tools/todo/todo.py +50 -37
  160. hanzo_mcp/tools/todo/todo_read.py +5 -8
  161. hanzo_mcp/tools/todo/todo_write.py +5 -7
  162. hanzo_mcp/tools/vector/__init__.py +40 -28
  163. hanzo_mcp/tools/vector/ast_analyzer.py +176 -143
  164. hanzo_mcp/tools/vector/git_ingester.py +170 -179
  165. hanzo_mcp/tools/vector/index_tool.py +96 -44
  166. hanzo_mcp/tools/vector/infinity_store.py +283 -228
  167. hanzo_mcp/tools/vector/mock_infinity.py +39 -40
  168. hanzo_mcp/tools/vector/project_manager.py +88 -78
  169. hanzo_mcp/tools/vector/vector.py +59 -42
  170. hanzo_mcp/tools/vector/vector_index.py +30 -27
  171. hanzo_mcp/tools/vector/vector_search.py +64 -45
  172. hanzo_mcp/types.py +6 -4
  173. {hanzo_mcp-0.7.7.dist-info → hanzo_mcp-0.8.0.dist-info}/METADATA +1 -1
  174. hanzo_mcp-0.8.0.dist-info/RECORD +185 -0
  175. hanzo_mcp-0.7.7.dist-info/RECORD +0 -182
  176. {hanzo_mcp-0.7.7.dist-info → hanzo_mcp-0.8.0.dist-info}/WHEEL +0 -0
  177. {hanzo_mcp-0.7.7.dist-info → hanzo_mcp-0.8.0.dist-info}/entry_points.txt +0 -0
  178. {hanzo_mcp-0.7.7.dist-info → hanzo_mcp-0.8.0.dist-info}/top_level.txt +0 -0
@@ -4,23 +4,29 @@ This tool enables distributed AI workloads across local and remote agent network
4
4
  with support for both local-only execution (via hanzo-miner) and cloud fallback.
5
5
  """
6
6
 
7
- import asyncio
8
- import json
9
7
  import os
10
- from typing import Annotated, TypedDict, Unpack, final, override, Optional, Dict, Any, List
8
+ import json
9
+ from typing import (
10
+ List,
11
+ Unpack,
12
+ Optional,
13
+ Annotated,
14
+ TypedDict,
15
+ final,
16
+ override,
17
+ )
11
18
 
12
- from mcp.server.fastmcp import Context as MCPContext
13
- from mcp.server import FastMCP
14
19
  from pydantic import Field
20
+ from mcp.server import FastMCP
21
+ from mcp.server.fastmcp import Context as MCPContext
15
22
 
16
23
  from hanzo_mcp.tools.common.base import BaseTool
17
- from hanzo_mcp.tools.common.context import ToolContext, create_tool_context
18
24
  from hanzo_mcp.tools.common.permissions import PermissionManager
19
25
 
20
-
21
26
  # Import hanzo cluster if available
22
27
  try:
23
28
  from hanzoai import cluster
29
+
24
30
  CLUSTER_AVAILABLE = True
25
31
  except ImportError:
26
32
  CLUSTER_AVAILABLE = False
@@ -28,6 +34,7 @@ except ImportError:
28
34
 
29
35
  class NetworkToolParams(TypedDict, total=False):
30
36
  """Parameters for the network tool."""
37
+
31
38
  task: str
32
39
  agents: Optional[List[str]]
33
40
  mode: Optional[str] # "local", "distributed", "hybrid"
@@ -36,25 +43,25 @@ class NetworkToolParams(TypedDict, total=False):
36
43
  require_local: Optional[bool]
37
44
 
38
45
 
39
- @final
46
+ @final
40
47
  class NetworkTool(BaseTool):
41
48
  """Dispatch work to agent networks for distributed AI processing.
42
-
49
+
43
50
  Modes:
44
51
  - local: Use only local compute (via hanzo-cluster/miner)
45
52
  - distributed: Use available network resources
46
53
  - hybrid: Prefer local, fallback to cloud
47
-
54
+
48
55
  This tool is the evolution of the swarm tool, providing:
49
56
  - True distributed execution across devices
50
57
  - Local-first privacy-preserving AI
51
58
  - Automatic routing and load balancing
52
59
  - Integration with hanzo-miner for compute contribution
53
60
  """
54
-
61
+
55
62
  name = "network"
56
63
  description = "Dispatch tasks to agent networks for distributed AI processing"
57
-
64
+
58
65
  def __init__(
59
66
  self,
60
67
  permission_manager: PermissionManager,
@@ -62,7 +69,7 @@ class NetworkTool(BaseTool):
62
69
  cluster_endpoint: str = None,
63
70
  ):
64
71
  """Initialize the network tool.
65
-
72
+
66
73
  Args:
67
74
  permission_manager: Permission manager
68
75
  default_mode: Default execution mode
@@ -71,22 +78,22 @@ class NetworkTool(BaseTool):
71
78
  self.permission_manager = permission_manager
72
79
  self.default_mode = default_mode
73
80
  self.cluster_endpoint = cluster_endpoint or os.environ.get(
74
- "HANZO_CLUSTER_ENDPOINT",
75
- "http://localhost:8000"
81
+ "HANZO_CLUSTER_ENDPOINT", "http://localhost:8000"
76
82
  )
77
83
  self._cluster = None
78
-
84
+
79
85
  async def _ensure_cluster(self):
80
86
  """Ensure we have a cluster connection."""
81
87
  if not CLUSTER_AVAILABLE:
82
88
  return None
83
-
89
+
84
90
  if not self._cluster:
85
91
  try:
86
92
  # Try to connect to existing cluster
87
93
  self._cluster = cluster.HanzoCluster()
88
94
  # Check if cluster is running
89
95
  import httpx
96
+
90
97
  async with httpx.AsyncClient() as client:
91
98
  response = await client.get(f"{self.cluster_endpoint}/health")
92
99
  if response.status_code != 200:
@@ -95,15 +102,13 @@ class NetworkTool(BaseTool):
95
102
  except Exception:
96
103
  # Cluster not available
97
104
  self._cluster = None
98
-
105
+
99
106
  return self._cluster
100
-
107
+
101
108
  @override
102
- async def call(
103
- self, ctx: MCPContext, **params: Unpack[NetworkToolParams]
104
- ) -> str:
109
+ async def call(self, ctx: MCPContext, **params: Unpack[NetworkToolParams]) -> str:
105
110
  """Execute a task on the agent network.
106
-
111
+
107
112
  Args:
108
113
  ctx: MCP context
109
114
  task: Task description to execute
@@ -112,35 +117,32 @@ class NetworkTool(BaseTool):
112
117
  model: Optional model preference
113
118
  routing: Routing strategy
114
119
  require_local: Require local-only execution
115
-
120
+
116
121
  Returns:
117
122
  JSON string with results
118
123
  """
119
124
  task = params.get("task", "")
120
125
  if not task:
121
- return json.dumps({
122
- "error": "Task description required",
123
- "success": False
124
- })
125
-
126
+ return json.dumps({"error": "Task description required", "success": False})
127
+
126
128
  mode = params.get("mode", self.default_mode)
127
129
  agents_list = params.get("agents", [])
128
130
  model_pref = params.get("model")
129
131
  routing = params.get("routing", "sequential")
130
132
  require_local = params.get("require_local", False)
131
-
133
+
132
134
  # Check if we should use local cluster
133
135
  use_local = mode in ["local", "hybrid"] or require_local
134
-
136
+
135
137
  results = {
136
138
  "task": task,
137
139
  "mode": mode,
138
140
  "routing": routing,
139
141
  "agents_used": [],
140
142
  "results": [],
141
- "success": False
143
+ "success": False,
142
144
  }
143
-
145
+
144
146
  try:
145
147
  # Try local execution first if requested
146
148
  if use_local:
@@ -151,82 +153,98 @@ class NetworkTool(BaseTool):
151
153
  local_result = await cluster.inference(
152
154
  prompt=task,
153
155
  model=model_pref or "llama-3.2-3b",
154
- max_tokens=4000
156
+ max_tokens=4000,
155
157
  )
156
-
158
+
157
159
  results["agents_used"].append("local-cluster")
158
- results["results"].append({
159
- "agent": "local-cluster",
160
- "response": local_result.get("choices", [{}])[0].get("text", ""),
161
- "local": True
162
- })
160
+ results["results"].append(
161
+ {
162
+ "agent": "local-cluster",
163
+ "response": local_result.get("choices", [{}])[0].get(
164
+ "text", ""
165
+ ),
166
+ "local": True,
167
+ }
168
+ )
163
169
  results["success"] = True
164
-
170
+
165
171
  # If local succeeded and not hybrid, return
166
172
  if mode == "local" or (mode == "hybrid" and results["results"]):
167
173
  return json.dumps(results, indent=2)
168
-
174
+
169
175
  except Exception as e:
170
176
  if require_local:
171
177
  results["error"] = f"Local execution failed: {str(e)}"
172
178
  return json.dumps(results, indent=2)
173
-
179
+
174
180
  # Fallback to agent-based execution
175
181
  # This would use hanzo-agents or the existing swarm implementation
176
182
  if not results["success"] or mode in ["distributed", "hybrid"]:
177
183
  # Import swarm tool as fallback
178
184
  from hanzo_mcp.tools.agent.swarm_tool import SwarmTool
179
-
185
+
180
186
  # Create temporary swarm tool
181
187
  swarm = SwarmTool(
182
- permission_manager=self.permission_manager,
183
- model=model_pref
188
+ permission_manager=self.permission_manager, model=model_pref
184
189
  )
185
-
190
+
186
191
  # Convert network params to swarm params
187
192
  swarm_params = {
188
193
  "prompts": [task] if not agents_list else agents_list,
189
194
  "consensus": routing == "consensus",
190
195
  "parallel": routing == "parallel",
191
196
  }
192
-
197
+
193
198
  # Execute via swarm
194
199
  swarm_result = await swarm.call(ctx, **swarm_params)
195
200
  swarm_data = json.loads(swarm_result)
196
-
201
+
197
202
  # Merge results
198
203
  if swarm_data.get("success"):
199
- results["agents_used"].extend([r["agent"] for r in swarm_data.get("results", [])])
204
+ results["agents_used"].extend(
205
+ [r["agent"] for r in swarm_data.get("results", [])]
206
+ )
200
207
  results["results"].extend(swarm_data.get("results", []))
201
208
  results["success"] = True
202
209
  else:
203
210
  results["error"] = swarm_data.get("error", "Unknown error")
204
-
211
+
205
212
  except Exception as e:
206
213
  results["error"] = str(e)
207
-
214
+
208
215
  return json.dumps(results, indent=2)
209
-
216
+
210
217
  def register(self, server: FastMCP):
211
218
  """Register the network tool with the server.
212
-
219
+
213
220
  Args:
214
221
  server: FastMCP server instance
215
222
  """
216
223
  tool = self
217
-
218
- @server.tool(
219
- name=tool.name,
220
- description=tool.description
221
- )
224
+
225
+ @server.tool(name=tool.name, description=tool.description)
222
226
  async def network_handler(
223
227
  ctx: MCPContext,
224
228
  task: Annotated[str, Field(description="Task to execute on the network")],
225
- agents: Annotated[Optional[List[str]], Field(description="Specific agents to use")] = None,
226
- mode: Annotated[Optional[str], Field(description="Execution mode: local, distributed, or hybrid")] = None,
227
- model: Annotated[Optional[str], Field(description="Model preference")] = None,
228
- routing: Annotated[Optional[str], Field(description="Routing strategy: sequential, parallel, or consensus")] = None,
229
- require_local: Annotated[Optional[bool], Field(description="Require local-only execution")] = None,
229
+ agents: Annotated[
230
+ Optional[List[str]], Field(description="Specific agents to use")
231
+ ] = None,
232
+ mode: Annotated[
233
+ Optional[str],
234
+ Field(description="Execution mode: local, distributed, or hybrid"),
235
+ ] = None,
236
+ model: Annotated[
237
+ Optional[str], Field(description="Model preference")
238
+ ] = None,
239
+ routing: Annotated[
240
+ Optional[str],
241
+ Field(
242
+ description="Routing strategy: sequential, parallel, or consensus"
243
+ ),
244
+ ] = None,
245
+ require_local: Annotated[
246
+ Optional[bool], Field(description="Require local-only execution")
247
+ ] = None,
230
248
  ) -> str:
231
249
  """Dispatch work to agent networks."""
232
250
  params = NetworkToolParams(
@@ -238,7 +256,7 @@ class NetworkTool(BaseTool):
238
256
  require_local=require_local,
239
257
  )
240
258
  return await tool.call(ctx, **params)
241
-
259
+
242
260
  return tool
243
261
 
244
262
 
@@ -246,26 +264,24 @@ class NetworkTool(BaseTool):
246
264
  @final
247
265
  class LocalSwarmTool(NetworkTool):
248
266
  """Local-only version of the network tool (swarm compatibility).
249
-
267
+
250
268
  This provides backward compatibility with the swarm tool
251
269
  while using local compute resources only.
252
270
  """
253
-
271
+
254
272
  name = "swarm"
255
273
  description = "Run agent swarms locally using hanzo-miner compute"
256
-
274
+
257
275
  def __init__(self, permission_manager: PermissionManager, **kwargs):
258
276
  """Initialize as local-only network."""
259
277
  super().__init__(
260
- permission_manager=permission_manager,
261
- default_mode="local",
262
- **kwargs
278
+ permission_manager=permission_manager, default_mode="local", **kwargs
263
279
  )
264
-
280
+
265
281
  @override
266
282
  async def call(self, ctx: MCPContext, **params: Unpack[NetworkToolParams]) -> str:
267
283
  """Execute with local-only mode."""
268
284
  # Force local mode
269
285
  params["mode"] = "local"
270
286
  params["require_local"] = True
271
- return await super().call(ctx, **params)
287
+ return await super().call(ctx, **params)
@@ -141,7 +141,8 @@ def get_default_model(model_override: str | None = None) -> str:
141
141
  # Special cases for tests
142
142
  if (
143
143
  model.startswith("test-model")
144
- or "TEST_MODE" in os.environ and model == "claude-3-5-sonnet-20241022"
144
+ or "TEST_MODE" in os.environ
145
+ and model == "claude-3-5-sonnet-20241022"
145
146
  ):
146
147
  return model
147
148