hypha-debugger 0.1.8__tar.gz → 0.1.9__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.1.8 → hypha_debugger-0.1.9}/PKG-INFO +1 -1
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger/__init__.py +1 -1
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger/services/source.py +64 -78
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger.egg-info/PKG-INFO +1 -1
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/pyproject.toml +1 -1
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/README.md +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger/__main__.py +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger/debugger.py +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger/services/__init__.py +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger/services/execute.py +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger/services/filesystem.py +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger/services/info.py +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger/services/inspect_vars.py +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger/utils/__init__.py +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger/utils/env.py +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger.egg-info/SOURCES.txt +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger.egg-info/dependency_links.txt +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger.egg-info/entry_points.txt +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger.egg-info/requires.txt +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/hypha_debugger.egg-info/top_level.txt +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/setup.cfg +0 -0
- {hypha_debugger-0.1.8 → hypha_debugger-0.1.9}/tests/test_services.py +0 -0
|
@@ -87,104 +87,90 @@ def _get_skill_md_impl() -> str:
|
|
|
87
87
|
return """# Hypha Remote Debugger — Python Process API
|
|
88
88
|
|
|
89
89
|
## Overview
|
|
90
|
-
A debugger is attached to a running Python process. You
|
|
91
|
-
read/write files, inspect variables, and
|
|
90
|
+
A remote debugger is attached to a running Python process. You have full access
|
|
91
|
+
to execute code, read/write files, inspect variables, and install packages.
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
**Recommended approach**: Use `execute_code` as your primary tool — it's a
|
|
94
|
+
persistent Python REPL where variables, imports, and functions survive across
|
|
95
|
+
calls. The other endpoints are convenience shortcuts.
|
|
94
96
|
|
|
95
|
-
|
|
96
|
-
Get information about the current Python process.
|
|
97
|
-
- **Returns**: `{pid, cwd, python_version, hostname, platform, memory_mb, cpu_count, ...}`
|
|
98
|
-
- **Example**: `curl "$SERVICE_URL/get_process_info"`
|
|
97
|
+
## Quick Start
|
|
99
98
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
across calls in the default REPL namespace.
|
|
104
|
-
- **code** (string, required): Python code to execute.
|
|
105
|
-
- **namespace** (string, default `""`): Namespace. Empty = persistent REPL. `"__main__"` = main module.
|
|
106
|
-
- **timeout** (int, default `30`): Timeout in seconds. 0 for no timeout.
|
|
107
|
-
- **Returns**: `{ok, stdout, stderr, result, result_repr, result_type, error?, error_type?, error_message?, traceback?, timed_out?}`
|
|
108
|
-
- The last expression in the code block is automatically captured as `result`.
|
|
109
|
-
E.g. `"x = 1\\nx + 1"` returns `result=2`.
|
|
110
|
-
- **Example**:
|
|
111
|
-
```bash
|
|
112
|
-
curl -X POST "$SERVICE_URL/execute_code" \\
|
|
113
|
-
-H "Content-Type: application/json" \\
|
|
114
|
-
-d '{"code": "import sys; sys.version"}'
|
|
115
|
-
```
|
|
99
|
+
```bash
|
|
100
|
+
# Set the service URL (provided when debugger starts)
|
|
101
|
+
SERVICE_URL="<your-service-url>"
|
|
116
102
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
- **Returns**: `{name, type, repr, length?, shape?, dtype?, keys?}`
|
|
103
|
+
# Run Python code (persistent REPL — variables survive across calls):
|
|
104
|
+
curl -X POST "$SERVICE_URL/execute_code" \\
|
|
105
|
+
-H "Content-Type: application/json" \\
|
|
106
|
+
-d '{"code": "import os; os.listdir(\\".\\")"}'
|
|
122
107
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
- **include_private** (bool, default `false`): Include `_`-prefixed names.
|
|
128
|
-
- **Returns**: List of `{name, type, repr}`.
|
|
108
|
+
# Install a package:
|
|
109
|
+
curl -X POST "$SERVICE_URL/execute_code" \\
|
|
110
|
+
-H "Content-Type: application/json" \\
|
|
111
|
+
-d '{"code": "import subprocess; subprocess.check_output([\\\"pip\\\", \\\"install\\\", \\\"requests\\\"])"}'
|
|
129
112
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
-
|
|
133
|
-
-
|
|
113
|
+
# Write a file via execute_code (avoids JSON escaping issues):
|
|
114
|
+
curl -X POST "$SERVICE_URL/execute_code" \\
|
|
115
|
+
-H "Content-Type: application/json" \\
|
|
116
|
+
-d '{"code": "with open(\\\"hello.py\\\", \\\"w\\\") as f: f.write(\\\"print(42)\\\\n\\\")"}'
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Functions
|
|
120
|
+
|
|
121
|
+
### execute_code(code, namespace?, timeout?) — PRIMARY
|
|
122
|
+
Execute Python code in a persistent REPL. The last expression is automatically
|
|
123
|
+
captured as the return value via AST parsing.
|
|
124
|
+
- **code** (str, required): Python code to execute.
|
|
125
|
+
- **namespace** (str, default `""`): Empty = persistent REPL, `"__main__"` = main module.
|
|
126
|
+
- **timeout** (int, default `30`): Seconds. 0 = no timeout.
|
|
127
|
+
- **Returns**: `{ok, stdout, stderr, result, result_repr, result_type, error?, error_type?, error_message?, traceback?, timed_out?}`
|
|
128
|
+
- Variables, functions, and imports persist across calls.
|
|
129
|
+
- Example: `"x = 1\\nx + 1"` returns `{ok: true, result: 2}`.
|
|
130
|
+
|
|
131
|
+
### get_process_info()
|
|
132
|
+
PID, CWD, Python version, hostname, platform, memory usage, CPU count.
|
|
133
|
+
- **Example**: `curl "$SERVICE_URL/get_process_info"`
|
|
134
134
|
|
|
135
135
|
### list_files(path?, pattern?)
|
|
136
|
-
List
|
|
137
|
-
- **path** (
|
|
138
|
-
- **pattern** (string): Glob filter, e.g. `"*.py"`.
|
|
136
|
+
List directory contents (sandboxed to CWD).
|
|
137
|
+
- **path** (str, default `"."`), **pattern** (str): glob filter e.g. `"*.py"`.
|
|
139
138
|
- **Returns**: `{path, entries: [{name, type, size?}], total}`
|
|
140
|
-
- **Example**: `curl "$SERVICE_URL/list_files"`
|
|
141
139
|
|
|
142
140
|
### read_file(path, max_lines?, offset?, encoding?)
|
|
143
141
|
Read a file (sandboxed to CWD).
|
|
144
|
-
- **path** (
|
|
145
|
-
- **max_lines** (int, default `500`): Max lines to read.
|
|
146
|
-
- **offset** (int, default `0`): Lines to skip from beginning.
|
|
142
|
+
- **path** (str, required), **max_lines** (int, default `500`), **offset** (int, default `0`).
|
|
147
143
|
- **Returns**: `{path, content, lines_read, offset, truncated}`
|
|
148
|
-
- **Example**:
|
|
149
|
-
```bash
|
|
150
|
-
curl -X POST "$SERVICE_URL/read_file" \\
|
|
151
|
-
-H "Content-Type: application/json" \\
|
|
152
|
-
-d '{"path": "main.py"}'
|
|
153
|
-
```
|
|
154
144
|
|
|
155
145
|
### write_file(path, content, mode?, create_dirs?, encoding?)
|
|
156
|
-
Write
|
|
157
|
-
- **path** (
|
|
158
|
-
- **content** (string, required): Content to write.
|
|
159
|
-
- **mode** (string, default `"w"`): `"w"` to overwrite, `"a"` to append.
|
|
160
|
-
- **create_dirs** (bool, default `true`): Create parent directories.
|
|
146
|
+
Write/append to a file (sandboxed to CWD). Auto-creates parent dirs.
|
|
147
|
+
- **path** (str), **content** (str), **mode** (`"w"` or `"a"`).
|
|
161
148
|
- **Returns**: `{path, bytes_written, mode}`
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
149
|
+
|
|
150
|
+
### get_variable(name, namespace?)
|
|
151
|
+
Inspect a variable by name in a module namespace.
|
|
152
|
+
- **Returns**: `{name, type, repr, length?, shape?, dtype?, keys?}`
|
|
153
|
+
|
|
154
|
+
### list_variables(namespace?, filter?, include_private?)
|
|
155
|
+
List variables in a namespace. Filters by substring.
|
|
156
|
+
|
|
157
|
+
### get_stack_trace()
|
|
158
|
+
Stack traces of all threads. Useful for debugging hangs.
|
|
168
159
|
|
|
169
160
|
### get_installed_packages(filter?)
|
|
170
|
-
List
|
|
171
|
-
- **filter** (string): Substring filter for package names.
|
|
172
|
-
- **Returns**: List of `{name, version}`.
|
|
173
|
-
- **Example**: `curl "$SERVICE_URL/get_installed_packages"`
|
|
161
|
+
List pip packages. Optional name substring filter.
|
|
174
162
|
|
|
175
163
|
### get_source(module?)
|
|
176
|
-
Get
|
|
177
|
-
- **module** (string): Module path, e.g. `"services.execute"`. Empty to list modules.
|
|
178
|
-
- **Returns**: `{module, source, lines}` or `{modules, hint}`.
|
|
164
|
+
Get debugger source code. Empty = list modules, e.g. `"services.execute"`.
|
|
179
165
|
|
|
180
166
|
### get_skill_md()
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
- All file operations are sandboxed to the process CWD.
|
|
187
|
-
- POST endpoints accept JSON body
|
|
188
|
-
-
|
|
189
|
-
-
|
|
167
|
+
Returns this document.
|
|
168
|
+
|
|
169
|
+
## Tips
|
|
170
|
+
- **Use `execute_code` for file writes** when content has special characters —
|
|
171
|
+
it avoids JSON/curl escaping issues that affect `write_file` via HTTP.
|
|
172
|
+
- All file operations (list/read/write) are sandboxed to the process CWD.
|
|
173
|
+
- POST endpoints accept JSON body. GET endpoints take no body.
|
|
174
|
+
- Code execution has a 30s default timeout to prevent hangs.
|
|
175
|
+
- The REPL namespace is independent from `__main__` by default.
|
|
190
176
|
"""
|
|
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
|