hypha-debugger 0.2.3__tar.gz → 0.2.5__tar.gz
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.
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/PKG-INFO +36 -1
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/README.md +35 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger/__init__.py +1 -1
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger/debugger.py +21 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger/services/source.py +12 -7
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger.egg-info/PKG-INFO +36 -1
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/pyproject.toml +1 -1
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/tests/test_services.py +17 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger/__main__.py +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger/cli.py +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger/services/__init__.py +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger/services/execute.py +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger/services/filesystem.py +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger/services/info.py +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger/services/inspect_vars.py +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger/services/shell.py +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger/utils/__init__.py +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger/utils/env.py +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger.egg-info/SOURCES.txt +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger.egg-info/dependency_links.txt +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger.egg-info/entry_points.txt +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger.egg-info/requires.txt +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/hypha_debugger.egg-info/top_level.txt +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/setup.cfg +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/tests/test_cli.py +0 -0
- {hypha_debugger-0.2.3 → hypha_debugger-0.2.5}/tests/test_shell.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hypha-debugger
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: Injectable debugger for Python processes and AI agents, powered by Hypha RPC
|
|
5
5
|
Author: Amun AI AB
|
|
6
6
|
License: MIT
|
|
@@ -43,6 +43,41 @@ A lightweight, injectable debugger for web pages and Python processes, powered b
|
|
|
43
43
|
└─────────────────────────┘ └──────────────┘ └─────────────────────────┘
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
## The `hyd` CLI — talk to any remote with minimal overhead
|
|
47
|
+
|
|
48
|
+
Installing this package also gives you the **`hyd`** command — the low-overhead way
|
|
49
|
+
for an agent (or you) to drive a remote target. Store the connection once as a
|
|
50
|
+
**profile**, then every command is a short `hyd sh '…'` / `hyd js '…'` with the
|
|
51
|
+
connection + working directory remembered — far fewer tokens than re-sending
|
|
52
|
+
authenticated curl. One CLI drives **both** target types:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install hypha-debugger # or: pipx install hypha-debugger (always on PATH)
|
|
56
|
+
|
|
57
|
+
# Terminal target (a Python process running this debugger):
|
|
58
|
+
hyd profile add box "<py-debugger-service-url>" # type inferred = terminal
|
|
59
|
+
export HYD_PROFILE=box
|
|
60
|
+
hyd sh 'uname -a && pwd' # remote shell | hyd 'ls -la' (bare form)
|
|
61
|
+
hyd py 'import sys; sys.version' # remote Python via execute_code
|
|
62
|
+
|
|
63
|
+
# Browser target (a Hypha Navigator web service):
|
|
64
|
+
hyd profile add web "<navigator-service-url>" --type browser
|
|
65
|
+
export HYD_PROFILE=web
|
|
66
|
+
hyd 'document.title' # bare form runs JavaScript on a browser profile
|
|
67
|
+
hyd nav 'https://example.com' # navigate | hyd shot page.png (screenshot)
|
|
68
|
+
hyd call get_browser_state # call any service function
|
|
69
|
+
|
|
70
|
+
hyd status # confirm the connection
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The current profile + directory live in the `HYD_PROFILE` / `HYD_CWD` environment
|
|
74
|
+
variables (per-terminal, nothing session-specific on disk); the remote stays
|
|
75
|
+
stateless. If `hyd` isn't on your PATH after a `--user` install, use
|
|
76
|
+
`python -m hypha_debugger.cli` (identical arguments). Run `hyd` with no args for help.
|
|
77
|
+
|
|
78
|
+
> Any debugger's `GET <service-url>/get_skill_md` includes these same bootstrap
|
|
79
|
+
> instructions, so an AI agent can self-install and connect from the URL alone.
|
|
80
|
+
|
|
46
81
|
## JavaScript (Browser)
|
|
47
82
|
|
|
48
83
|
[](https://www.npmjs.com/package/hypha-debugger)
|
|
@@ -14,6 +14,41 @@ A lightweight, injectable debugger for web pages and Python processes, powered b
|
|
|
14
14
|
└─────────────────────────┘ └──────────────┘ └─────────────────────────┘
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
## The `hyd` CLI — talk to any remote with minimal overhead
|
|
18
|
+
|
|
19
|
+
Installing this package also gives you the **`hyd`** command — the low-overhead way
|
|
20
|
+
for an agent (or you) to drive a remote target. Store the connection once as a
|
|
21
|
+
**profile**, then every command is a short `hyd sh '…'` / `hyd js '…'` with the
|
|
22
|
+
connection + working directory remembered — far fewer tokens than re-sending
|
|
23
|
+
authenticated curl. One CLI drives **both** target types:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install hypha-debugger # or: pipx install hypha-debugger (always on PATH)
|
|
27
|
+
|
|
28
|
+
# Terminal target (a Python process running this debugger):
|
|
29
|
+
hyd profile add box "<py-debugger-service-url>" # type inferred = terminal
|
|
30
|
+
export HYD_PROFILE=box
|
|
31
|
+
hyd sh 'uname -a && pwd' # remote shell | hyd 'ls -la' (bare form)
|
|
32
|
+
hyd py 'import sys; sys.version' # remote Python via execute_code
|
|
33
|
+
|
|
34
|
+
# Browser target (a Hypha Navigator web service):
|
|
35
|
+
hyd profile add web "<navigator-service-url>" --type browser
|
|
36
|
+
export HYD_PROFILE=web
|
|
37
|
+
hyd 'document.title' # bare form runs JavaScript on a browser profile
|
|
38
|
+
hyd nav 'https://example.com' # navigate | hyd shot page.png (screenshot)
|
|
39
|
+
hyd call get_browser_state # call any service function
|
|
40
|
+
|
|
41
|
+
hyd status # confirm the connection
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The current profile + directory live in the `HYD_PROFILE` / `HYD_CWD` environment
|
|
45
|
+
variables (per-terminal, nothing session-specific on disk); the remote stays
|
|
46
|
+
stateless. If `hyd` isn't on your PATH after a `--user` install, use
|
|
47
|
+
`python -m hypha_debugger.cli` (identical arguments). Run `hyd` with no args for help.
|
|
48
|
+
|
|
49
|
+
> Any debugger's `GET <service-url>/get_skill_md` includes these same bootstrap
|
|
50
|
+
> instructions, so an AI agent can self-install and connect from the URL alone.
|
|
51
|
+
|
|
17
52
|
## JavaScript (Browser)
|
|
18
53
|
|
|
19
54
|
[](https://www.npmjs.com/package/hypha-debugger)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import logging
|
|
5
|
+
import os
|
|
5
6
|
import secrets
|
|
6
7
|
import threading
|
|
7
8
|
from dataclasses import dataclass, field
|
|
@@ -21,6 +22,24 @@ from hypha_debugger.services.source import get_source, get_skill_md
|
|
|
21
22
|
logger = logging.getLogger("hypha_debugger")
|
|
22
23
|
|
|
23
24
|
|
|
25
|
+
def _ensure_ssl_certs() -> None:
|
|
26
|
+
"""Point OpenSSL at certifi's CA bundle when the system trust store is
|
|
27
|
+
unconfigured — otherwise the hypha websocket TLS handshake fails with
|
|
28
|
+
CERTIFICATE_VERIFY_FAILED (macOS framework Python, minimal containers, fresh
|
|
29
|
+
venvs). Only sets the env vars if the user hasn't already; must run before
|
|
30
|
+
the first TLS connection (SSLContext reads these at creation time)."""
|
|
31
|
+
if os.environ.get("SSL_CERT_FILE"):
|
|
32
|
+
return
|
|
33
|
+
try:
|
|
34
|
+
import certifi
|
|
35
|
+
|
|
36
|
+
bundle = certifi.where()
|
|
37
|
+
os.environ["SSL_CERT_FILE"] = bundle
|
|
38
|
+
os.environ.setdefault("SSL_CERT_DIR", os.path.dirname(bundle))
|
|
39
|
+
except Exception:
|
|
40
|
+
pass
|
|
41
|
+
|
|
42
|
+
|
|
24
43
|
def _build_service_url(server_url: str, service_id: str) -> str:
|
|
25
44
|
"""Build the HTTP service URL from server URL and full service ID.
|
|
26
45
|
|
|
@@ -200,6 +219,7 @@ async def start_debugger(
|
|
|
200
219
|
Returns:
|
|
201
220
|
A DebugSession with service_id, workspace, server, service_url, and token.
|
|
202
221
|
"""
|
|
222
|
+
_ensure_ssl_certs()
|
|
203
223
|
from hypha_rpc import connect_to_server
|
|
204
224
|
|
|
205
225
|
effective_id, effective_visibility = _resolve_id_and_visibility(
|
|
@@ -290,6 +310,7 @@ def start_debugger_sync(
|
|
|
290
310
|
Returns:
|
|
291
311
|
A DebugSession with service_id, workspace, server, service_url, and token.
|
|
292
312
|
"""
|
|
313
|
+
_ensure_ssl_certs()
|
|
293
314
|
from hypha_rpc.sync import connect_to_server
|
|
294
315
|
|
|
295
316
|
effective_id, effective_visibility = _resolve_id_and_visibility(
|
|
@@ -92,13 +92,18 @@ def _get_skill_md_impl() -> str:
|
|
|
92
92
|
A remote debugger is attached to a running Python process. You have full access
|
|
93
93
|
to run shell + Python, read/write files, inspect variables, and install packages.
|
|
94
94
|
|
|
95
|
-
**
|
|
96
|
-
more than ~2 commands here (i.e. almost any real task)
|
|
97
|
-
interface — one `pip install`, then every command is
|
|
98
|
-
`hyd py '…'` with the connection + working directory
|
|
99
|
-
tokens than re-sending an authenticated curl each
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
**RECOMMENDED → install the `hyd` CLI (next section).** Decision rule: if you'll run
|
|
96
|
+
more than ~2 commands here (i.e. almost any real task) and you *can* install a pip
|
|
97
|
+
package, `hyd` is the intended interface — one `pip install`, then every command is
|
|
98
|
+
a short `hyd sh '…'` / `hyd py '…'` with the connection + working directory
|
|
99
|
+
remembered for you, far fewer tokens than re-sending an authenticated curl each
|
|
100
|
+
time, and it behaves like a local shell.
|
|
101
|
+
|
|
102
|
+
**No install? Use `curl` — everything works without the CLI.** If you can't install
|
|
103
|
+
packages (no pip, no network to PyPI, locked-down sandbox), skip `hyd` entirely: the
|
|
104
|
+
raw HTTP API below is complete on its own, with copy-paste `curl` examples for every
|
|
105
|
+
function (it's exactly what `hyd` calls under the hood). Recommended path is `hyd`;
|
|
106
|
+
guaranteed-available path is `curl`. Either fully operates the remote host.
|
|
102
107
|
|
|
103
108
|
## Fast path — the `hyd` CLI (do this first)
|
|
104
109
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hypha-debugger
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: Injectable debugger for Python processes and AI agents, powered by Hypha RPC
|
|
5
5
|
Author: Amun AI AB
|
|
6
6
|
License: MIT
|
|
@@ -43,6 +43,41 @@ A lightweight, injectable debugger for web pages and Python processes, powered b
|
|
|
43
43
|
└─────────────────────────┘ └──────────────┘ └─────────────────────────┘
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
## The `hyd` CLI — talk to any remote with minimal overhead
|
|
47
|
+
|
|
48
|
+
Installing this package also gives you the **`hyd`** command — the low-overhead way
|
|
49
|
+
for an agent (or you) to drive a remote target. Store the connection once as a
|
|
50
|
+
**profile**, then every command is a short `hyd sh '…'` / `hyd js '…'` with the
|
|
51
|
+
connection + working directory remembered — far fewer tokens than re-sending
|
|
52
|
+
authenticated curl. One CLI drives **both** target types:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install hypha-debugger # or: pipx install hypha-debugger (always on PATH)
|
|
56
|
+
|
|
57
|
+
# Terminal target (a Python process running this debugger):
|
|
58
|
+
hyd profile add box "<py-debugger-service-url>" # type inferred = terminal
|
|
59
|
+
export HYD_PROFILE=box
|
|
60
|
+
hyd sh 'uname -a && pwd' # remote shell | hyd 'ls -la' (bare form)
|
|
61
|
+
hyd py 'import sys; sys.version' # remote Python via execute_code
|
|
62
|
+
|
|
63
|
+
# Browser target (a Hypha Navigator web service):
|
|
64
|
+
hyd profile add web "<navigator-service-url>" --type browser
|
|
65
|
+
export HYD_PROFILE=web
|
|
66
|
+
hyd 'document.title' # bare form runs JavaScript on a browser profile
|
|
67
|
+
hyd nav 'https://example.com' # navigate | hyd shot page.png (screenshot)
|
|
68
|
+
hyd call get_browser_state # call any service function
|
|
69
|
+
|
|
70
|
+
hyd status # confirm the connection
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The current profile + directory live in the `HYD_PROFILE` / `HYD_CWD` environment
|
|
74
|
+
variables (per-terminal, nothing session-specific on disk); the remote stays
|
|
75
|
+
stateless. If `hyd` isn't on your PATH after a `--user` install, use
|
|
76
|
+
`python -m hypha_debugger.cli` (identical arguments). Run `hyd` with no args for help.
|
|
77
|
+
|
|
78
|
+
> Any debugger's `GET <service-url>/get_skill_md` includes these same bootstrap
|
|
79
|
+
> instructions, so an AI agent can self-install and connect from the URL alone.
|
|
80
|
+
|
|
46
81
|
## JavaScript (Browser)
|
|
47
82
|
|
|
48
83
|
[](https://www.npmjs.com/package/hypha-debugger)
|
|
@@ -342,3 +342,20 @@ def test_debug_session_print_instructions(capsys):
|
|
|
342
342
|
assert "get_skill_md" in captured.out
|
|
343
343
|
assert isinstance(result, str)
|
|
344
344
|
assert "py-debugger-abc" in result
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
def test_ensure_ssl_certs_sets_when_unset(monkeypatch):
|
|
348
|
+
import os
|
|
349
|
+
from hypha_debugger.debugger import _ensure_ssl_certs
|
|
350
|
+
monkeypatch.delenv("SSL_CERT_FILE", raising=False)
|
|
351
|
+
_ensure_ssl_certs()
|
|
352
|
+
# certifi is a dependency, so a real CA bundle path should now be set
|
|
353
|
+
assert os.environ.get("SSL_CERT_FILE") and os.path.exists(os.environ["SSL_CERT_FILE"])
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
def test_ensure_ssl_certs_respects_existing(monkeypatch):
|
|
357
|
+
import os
|
|
358
|
+
from hypha_debugger.debugger import _ensure_ssl_certs
|
|
359
|
+
monkeypatch.setenv("SSL_CERT_FILE", "/custom/ca-bundle.pem")
|
|
360
|
+
_ensure_ssl_certs()
|
|
361
|
+
assert os.environ["SSL_CERT_FILE"] == "/custom/ca-bundle.pem"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|