python-codex 0.2.7__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.
- pycodex/__init__.py +14 -14
- pycodex/agent.py +465 -499
- pycodex/bootstrap.py +417 -0
- pycodex/cli.py +236 -510
- pycodex/compat.py +19 -5
- pycodex/context.py +222 -212
- pycodex/doctor.py +52 -48
- pycodex/events.py +857 -0
- pycodex/feishu_card.py +217 -163
- pycodex/feishu_link.py +43 -83
- pycodex/model.py +324 -253
- pycodex/model_metadata.py +19 -7
- pycodex/portable.py +76 -45
- pycodex/portable_server.py +32 -24
- pycodex/prompts/models.json +245 -983
- pycodex/protocol.py +177 -137
- pycodex/runtime.py +579 -176
- pycodex/runtime_services.py +204 -157
- pycodex/tools/__init__.py +1 -1
- pycodex/tools/apply_patch_tool.py +69 -48
- pycodex/tools/base_tool.py +89 -42
- pycodex/tools/clock_tool.py +58 -25
- pycodex/tools/close_agent_tool.py +2 -2
- pycodex/tools/code_mode_manager.py +77 -64
- pycodex/tools/exec_command_tool.py +26 -11
- pycodex/tools/exec_tool.py +4 -4
- pycodex/tools/grep_files_tool.py +12 -10
- pycodex/tools/ipython_tool.py +10 -13
- pycodex/tools/list_dir_tool.py +13 -9
- pycodex/tools/read_file_tool.py +29 -17
- pycodex/tools/request_permissions_tool.py +15 -5
- pycodex/tools/request_user_input_tool.py +13 -104
- pycodex/tools/resume_agent_tool.py +2 -2
- pycodex/tools/send_input_tool.py +11 -8
- pycodex/tools/shell_command_tool.py +7 -5
- pycodex/tools/shell_tool.py +7 -5
- pycodex/tools/spawn_agent_tool.py +7 -4
- pycodex/tools/unified_exec_manager.py +102 -69
- pycodex/tools/update_plan_tool.py +8 -5
- pycodex/tools/view_image_tool.py +7 -5
- pycodex/tools/wait_agent_tool.py +27 -4
- pycodex/tools/wait_tool.py +5 -4
- pycodex/tools/web_search_tool.py +4 -2
- pycodex/tools/write_stdin_tool.py +12 -11
- pycodex/utils/__init__.py +2 -17
- pycodex/utils/compactor.py +41 -72
- pycodex/utils/debug.py +2 -2
- pycodex/utils/dotenv.py +6 -7
- pycodex/utils/event_helpers.py +190 -0
- pycodex/utils/get_env.py +27 -70
- pycodex/{image_utils.py → utils/image_utils.py} +8 -11
- pycodex/utils/random_ids.py +1 -2
- pycodex/utils/session_persist.py +217 -163
- pycodex/utils/truncation.py +21 -45
- python_codex-0.3.0.dist-info/METADATA +704 -0
- python_codex-0.3.0.dist-info/RECORD +90 -0
- responses_server/__init__.py +1 -5
- responses_server/__main__.py +0 -1
- responses_server/app.py +36 -31
- responses_server/config.py +23 -23
- responses_server/messages_api.py +51 -53
- responses_server/payload_processors.py +25 -20
- responses_server/server.py +11 -11
- responses_server/session_store.py +14 -11
- responses_server/stream_router.py +101 -98
- responses_server/tools/custom_adapter.py +17 -16
- responses_server/tools/web_search.py +39 -36
- responses_server/trajectory_dump.py +36 -14
- workspace_server/__main__.py +0 -1
- workspace_server/app.py +461 -375
- workspace_server/workspace.html +852 -228
- workspace_server/workspaces.html +94 -95
- workspace_server/workspaces.py +137 -79
- pycodex/collaboration.py +0 -20
- pycodex/interactive_session.py +0 -415
- pycodex/prompts/collaboration_default.md +0 -11
- pycodex/prompts/collaboration_plan.md +0 -128
- pycodex/utils/toolcall_visualize.py +0 -713
- pycodex/utils/visualize.py +0 -560
- python_codex-0.2.7.dist-info/METADATA +0 -455
- python_codex-0.2.7.dist-info/RECORD +0 -93
- {python_codex-0.2.7.dist-info → python_codex-0.3.0.dist-info}/WHEEL +0 -0
- {python_codex-0.2.7.dist-info → python_codex-0.3.0.dist-info}/entry_points.txt +0 -0
- {python_codex-0.2.7.dist-info → python_codex-0.3.0.dist-info}/licenses/LICENSE +0 -0
pycodex/compat.py
CHANGED
|
@@ -11,6 +11,7 @@ except ImportError: # pragma: no cover - Python 3.6 path
|
|
|
11
11
|
class ThreadingHTTPServer(ThreadingMixIn, HTTPServer):
|
|
12
12
|
daemon_threads = True
|
|
13
13
|
|
|
14
|
+
|
|
14
15
|
try:
|
|
15
16
|
from importlib import metadata as importlib_metadata
|
|
16
17
|
except ImportError: # pragma: no cover - Python 3.6 path
|
|
@@ -20,6 +21,7 @@ try:
|
|
|
20
21
|
from typing import Literal, Protocol, TypeAlias
|
|
21
22
|
except ImportError: # pragma: no cover - Python 3.6 path
|
|
22
23
|
from typing_extensions import Literal, Protocol # type: ignore
|
|
24
|
+
|
|
23
25
|
try:
|
|
24
26
|
from typing_extensions import TypeAlias # type: ignore
|
|
25
27
|
except ImportError: # pragma: no cover - old typing_extensions
|
|
@@ -34,6 +36,20 @@ def _get_running_loop_compat():
|
|
|
34
36
|
|
|
35
37
|
|
|
36
38
|
def patch_asyncio():
|
|
39
|
+
if not hasattr(asyncio, "current_task"):
|
|
40
|
+
asyncio.current_task = asyncio.Task.current_task
|
|
41
|
+
|
|
42
|
+
if not hasattr(asyncio, "all_tasks"):
|
|
43
|
+
|
|
44
|
+
def all_tasks(loop=None):
|
|
45
|
+
if loop is None:
|
|
46
|
+
loop = asyncio.get_running_loop()
|
|
47
|
+
return {
|
|
48
|
+
task for task in asyncio.Task.all_tasks(loop=loop) if not task.done()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
asyncio.all_tasks = all_tasks
|
|
52
|
+
|
|
37
53
|
if not hasattr(asyncio, "create_task"):
|
|
38
54
|
asyncio.create_task = asyncio.ensure_future
|
|
39
55
|
|
|
@@ -41,6 +57,7 @@ def patch_asyncio():
|
|
|
41
57
|
asyncio.get_running_loop = _get_running_loop_compat
|
|
42
58
|
|
|
43
59
|
if not hasattr(asyncio, "to_thread"):
|
|
60
|
+
|
|
44
61
|
async def to_thread(func, *args, **kwargs):
|
|
45
62
|
loop = asyncio.get_event_loop()
|
|
46
63
|
call = functools.partial(func, *args, **kwargs)
|
|
@@ -49,17 +66,14 @@ def patch_asyncio():
|
|
|
49
66
|
asyncio.to_thread = to_thread
|
|
50
67
|
|
|
51
68
|
if not hasattr(asyncio, "run"):
|
|
69
|
+
|
|
52
70
|
def run(main):
|
|
53
71
|
loop = asyncio.new_event_loop()
|
|
54
72
|
try:
|
|
55
73
|
asyncio.set_event_loop(loop)
|
|
56
74
|
return loop.run_until_complete(main)
|
|
57
75
|
finally:
|
|
58
|
-
|
|
59
|
-
if all_tasks is not None:
|
|
60
|
-
pending = all_tasks(loop=loop)
|
|
61
|
-
else:
|
|
62
|
-
pending = asyncio.all_tasks(loop)
|
|
76
|
+
pending = asyncio.all_tasks(loop)
|
|
63
77
|
for task in pending:
|
|
64
78
|
task.cancel()
|
|
65
79
|
if pending:
|