hud-python 0.2.10__py3-none-any.whl → 0.3.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 hud-python might be problematic. Click here for more details.
- hud/__init__.py +14 -5
- hud/env/docker_client.py +1 -1
- hud/env/environment.py +10 -7
- hud/env/local_docker_client.py +1 -1
- hud/env/remote_client.py +1 -1
- hud/env/remote_docker_client.py +2 -2
- hud/exceptions.py +2 -1
- hud/mcp_agent/__init__.py +15 -0
- hud/mcp_agent/base.py +723 -0
- hud/mcp_agent/claude.py +316 -0
- hud/mcp_agent/langchain.py +231 -0
- hud/mcp_agent/openai.py +318 -0
- hud/mcp_agent/tests/__init__.py +1 -0
- hud/mcp_agent/tests/test_base.py +437 -0
- hud/settings.py +14 -2
- hud/task.py +4 -0
- hud/telemetry/__init__.py +11 -7
- hud/telemetry/_trace.py +82 -71
- hud/telemetry/context.py +9 -27
- hud/telemetry/exporter.py +6 -5
- hud/telemetry/instrumentation/mcp.py +174 -410
- hud/telemetry/mcp_models.py +13 -74
- hud/telemetry/tests/test_context.py +9 -6
- hud/telemetry/tests/test_trace.py +92 -61
- hud/tools/__init__.py +21 -0
- hud/tools/base.py +65 -0
- hud/tools/bash.py +137 -0
- hud/tools/computer/__init__.py +13 -0
- hud/tools/computer/anthropic.py +411 -0
- hud/tools/computer/hud.py +315 -0
- hud/tools/computer/openai.py +283 -0
- hud/tools/edit.py +290 -0
- hud/tools/executors/__init__.py +13 -0
- hud/tools/executors/base.py +331 -0
- hud/tools/executors/pyautogui.py +585 -0
- hud/tools/executors/tests/__init__.py +1 -0
- hud/tools/executors/tests/test_base_executor.py +338 -0
- hud/tools/executors/tests/test_pyautogui_executor.py +162 -0
- hud/tools/executors/xdo.py +503 -0
- hud/tools/helper/README.md +56 -0
- hud/tools/helper/__init__.py +9 -0
- hud/tools/helper/mcp_server.py +78 -0
- hud/tools/helper/server_initialization.py +115 -0
- hud/tools/helper/utils.py +58 -0
- hud/tools/playwright_tool.py +373 -0
- hud/tools/tests/__init__.py +3 -0
- hud/tools/tests/test_bash.py +152 -0
- hud/tools/tests/test_computer.py +52 -0
- hud/tools/tests/test_computer_actions.py +34 -0
- hud/tools/tests/test_edit.py +233 -0
- hud/tools/tests/test_init.py +27 -0
- hud/tools/tests/test_playwright_tool.py +183 -0
- hud/tools/tests/test_tools.py +154 -0
- hud/tools/tests/test_utils.py +156 -0
- hud/tools/utils.py +50 -0
- hud/types.py +10 -1
- hud/utils/tests/test_init.py +21 -0
- hud/utils/tests/test_version.py +1 -1
- hud/version.py +1 -1
- {hud_python-0.2.10.dist-info → hud_python-0.3.0.dist-info}/METADATA +9 -6
- hud_python-0.3.0.dist-info/RECORD +124 -0
- hud_python-0.2.10.dist-info/RECORD +0 -85
- {hud_python-0.2.10.dist-info → hud_python-0.3.0.dist-info}/WHEEL +0 -0
- {hud_python-0.2.10.dist-info → hud_python-0.3.0.dist-info}/licenses/LICENSE +0 -0
hud/__init__.py
CHANGED
|
@@ -10,24 +10,31 @@ from .job import create_job, load_job, run_job
|
|
|
10
10
|
from .job import job as register_job
|
|
11
11
|
from .task import Task
|
|
12
12
|
from .taskset import load_taskset
|
|
13
|
-
from .telemetry import flush,
|
|
13
|
+
from .telemetry import flush, trace, trace_open
|
|
14
14
|
from .version import __version__
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
|
|
17
|
+
def init_telemetry() -> None:
|
|
18
|
+
from .telemetry import init_telemetry as _init_telemetry
|
|
19
|
+
|
|
20
|
+
_init_telemetry()
|
|
21
|
+
|
|
18
22
|
|
|
19
23
|
if settings.settings.fancy_logging:
|
|
20
24
|
import logging
|
|
25
|
+
import sys
|
|
21
26
|
|
|
22
27
|
hud_logger = logging.getLogger("hud")
|
|
23
|
-
# TODO: Make this configurable
|
|
24
28
|
hud_logger.setLevel(logging.INFO)
|
|
25
29
|
|
|
26
30
|
if not hud_logger.handlers:
|
|
27
|
-
|
|
31
|
+
# Use the configured stream (defaults to stderr)
|
|
32
|
+
stream = sys.stderr if settings.settings.log_stream.lower() == "stderr" else sys.stdout
|
|
33
|
+
handler = logging.StreamHandler(stream)
|
|
28
34
|
formatter = logging.Formatter("[%(levelname)s] %(asctime)s | %(name)s | %(message)s")
|
|
29
35
|
handler.setFormatter(formatter)
|
|
30
36
|
hud_logger.addHandler(handler)
|
|
37
|
+
hud_logger.propagate = False
|
|
31
38
|
|
|
32
39
|
__all__ = [
|
|
33
40
|
"Response",
|
|
@@ -38,6 +45,7 @@ __all__ = [
|
|
|
38
45
|
"env",
|
|
39
46
|
"flush",
|
|
40
47
|
"gym",
|
|
48
|
+
"init_telemetry",
|
|
41
49
|
"load_job",
|
|
42
50
|
"load_taskset",
|
|
43
51
|
"register_job",
|
|
@@ -46,6 +54,7 @@ __all__ = [
|
|
|
46
54
|
"task",
|
|
47
55
|
"taskset",
|
|
48
56
|
"trace",
|
|
57
|
+
"trace_open",
|
|
49
58
|
"types",
|
|
50
59
|
"utils",
|
|
51
60
|
]
|
hud/env/docker_client.py
CHANGED
|
@@ -262,7 +262,7 @@ class DockerClient(Client):
|
|
|
262
262
|
self,
|
|
263
263
|
command: list[str],
|
|
264
264
|
*,
|
|
265
|
-
timeout: int | None = None,
|
|
265
|
+
timeout: int | None = None, # noqa: ASYNC109
|
|
266
266
|
) -> ExecuteResult:
|
|
267
267
|
"""
|
|
268
268
|
Execute a command in the environment. May not be supported by all environments.
|
hud/env/environment.py
CHANGED
|
@@ -378,13 +378,16 @@ def create_remote_config(
|
|
|
378
378
|
|
|
379
379
|
# Case 1: Explicit config provided
|
|
380
380
|
if config:
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
381
|
+
if not isinstance(config, dict):
|
|
382
|
+
expanded_configs = expand_config(config)
|
|
383
|
+
if env and env.final_response and expanded_configs[0].args[0] in LOCAL_EVALUATORS:
|
|
384
|
+
# Ensure args is a list before appending
|
|
385
|
+
if not isinstance(expanded_configs[0].args, list):
|
|
386
|
+
expanded_configs[0].args = [expanded_configs[0].args]
|
|
387
|
+
expanded_configs[0].args.append(env.final_response) # for remote responses
|
|
388
|
+
return [FunctionConfig(function=function, args=expanded_configs, metadata=metadata)]
|
|
389
|
+
else:
|
|
390
|
+
return [FunctionConfig(function=function, args=[config], metadata=metadata)]
|
|
388
391
|
|
|
389
392
|
# Otherwise, use the environment's task
|
|
390
393
|
task = env.task if env else None
|
hud/env/local_docker_client.py
CHANGED
hud/env/remote_client.py
CHANGED
hud/env/remote_docker_client.py
CHANGED
|
@@ -23,7 +23,7 @@ logger = logging.getLogger("hud.env.remote_env_client")
|
|
|
23
23
|
async def upload_bytes_to_presigned_url(
|
|
24
24
|
presigned_url: str,
|
|
25
25
|
data_bytes: bytes,
|
|
26
|
-
timeout: float = 600,
|
|
26
|
+
timeout: float = 600, # noqa: ASYNC109
|
|
27
27
|
) -> None:
|
|
28
28
|
try:
|
|
29
29
|
async with httpx.AsyncClient() as client:
|
|
@@ -206,7 +206,7 @@ class RemoteDockerClient(DockerClient):
|
|
|
206
206
|
command: list[str],
|
|
207
207
|
*,
|
|
208
208
|
workdir: str | None = None,
|
|
209
|
-
timeout: float | None = None,
|
|
209
|
+
timeout: float | None = None, # noqa: ASYNC109
|
|
210
210
|
) -> ExecuteResult:
|
|
211
211
|
"""
|
|
212
212
|
Execute a command in the environment.
|
hud/exceptions.py
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""MCP Agent implementations for HUD."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .base import BaseMCPAgent
|
|
6
|
+
from .claude import ClaudeMCPAgent
|
|
7
|
+
from .langchain import LangChainMCPAgent
|
|
8
|
+
from .openai import OpenAIMCPAgent
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"BaseMCPAgent",
|
|
12
|
+
"ClaudeMCPAgent",
|
|
13
|
+
"LangChainMCPAgent",
|
|
14
|
+
"OpenAIMCPAgent",
|
|
15
|
+
]
|