python-codex 0.2.6__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.
Files changed (84) hide show
  1. pycodex/__init__.py +18 -14
  2. pycodex/agent.py +468 -462
  3. pycodex/bootstrap.py +417 -0
  4. pycodex/cli.py +236 -436
  5. pycodex/compat.py +19 -5
  6. pycodex/context.py +222 -212
  7. pycodex/doctor.py +52 -48
  8. pycodex/events.py +857 -0
  9. pycodex/feishu_card.py +217 -163
  10. pycodex/feishu_link.py +43 -83
  11. pycodex/model.py +329 -252
  12. pycodex/model_metadata.py +19 -7
  13. pycodex/portable.py +90 -52
  14. pycodex/portable_server.py +32 -24
  15. pycodex/prompts/models.json +235 -803
  16. pycodex/protocol.py +177 -137
  17. pycodex/runtime.py +579 -174
  18. pycodex/runtime_services.py +204 -157
  19. pycodex/tools/__init__.py +4 -1
  20. pycodex/tools/apply_patch_tool.py +69 -48
  21. pycodex/tools/base_tool.py +89 -42
  22. pycodex/tools/clock_tool.py +201 -0
  23. pycodex/tools/close_agent_tool.py +2 -2
  24. pycodex/tools/code_mode_manager.py +77 -64
  25. pycodex/tools/exec_command_tool.py +26 -11
  26. pycodex/tools/exec_tool.py +4 -4
  27. pycodex/tools/grep_files_tool.py +12 -10
  28. pycodex/tools/ipython_tool.py +10 -13
  29. pycodex/tools/list_dir_tool.py +13 -9
  30. pycodex/tools/read_file_tool.py +29 -17
  31. pycodex/tools/request_permissions_tool.py +15 -5
  32. pycodex/tools/request_user_input_tool.py +13 -104
  33. pycodex/tools/resume_agent_tool.py +2 -2
  34. pycodex/tools/send_input_tool.py +11 -8
  35. pycodex/tools/shell_command_tool.py +7 -5
  36. pycodex/tools/shell_tool.py +7 -5
  37. pycodex/tools/spawn_agent_tool.py +7 -4
  38. pycodex/tools/unified_exec_manager.py +102 -69
  39. pycodex/tools/update_plan_tool.py +8 -5
  40. pycodex/tools/view_image_tool.py +13 -13
  41. pycodex/tools/wait_agent_tool.py +27 -4
  42. pycodex/tools/wait_tool.py +5 -4
  43. pycodex/tools/web_search_tool.py +4 -2
  44. pycodex/tools/write_stdin_tool.py +12 -11
  45. pycodex/utils/__init__.py +2 -17
  46. pycodex/utils/compactor.py +50 -66
  47. pycodex/utils/debug.py +2 -2
  48. pycodex/utils/dotenv.py +6 -7
  49. pycodex/utils/event_helpers.py +190 -0
  50. pycodex/utils/get_env.py +27 -70
  51. pycodex/utils/image_utils.py +76 -0
  52. pycodex/utils/random_ids.py +1 -2
  53. pycodex/utils/session_persist.py +263 -161
  54. pycodex/utils/truncation.py +21 -45
  55. python_codex-0.3.0.dist-info/METADATA +704 -0
  56. python_codex-0.3.0.dist-info/RECORD +90 -0
  57. responses_server/__init__.py +1 -5
  58. responses_server/__main__.py +0 -1
  59. responses_server/app.py +36 -31
  60. responses_server/config.py +25 -22
  61. responses_server/messages_api.py +96 -49
  62. responses_server/payload_processors.py +25 -19
  63. responses_server/server.py +11 -11
  64. responses_server/session_store.py +14 -11
  65. responses_server/stream_router.py +196 -107
  66. responses_server/tools/custom_adapter.py +17 -16
  67. responses_server/tools/web_search.py +39 -36
  68. responses_server/trajectory_dump.py +51 -13
  69. workspace_server/__main__.py +0 -1
  70. workspace_server/app.py +470 -384
  71. workspace_server/workspace.html +859 -232
  72. workspace_server/workspaces.html +94 -95
  73. workspace_server/workspaces.py +168 -100
  74. pycodex/collaboration.py +0 -20
  75. pycodex/interactive_session.py +0 -415
  76. pycodex/prompts/collaboration_default.md +0 -11
  77. pycodex/prompts/collaboration_plan.md +0 -128
  78. pycodex/utils/toolcall_visualize.py +0 -713
  79. pycodex/utils/visualize.py +0 -553
  80. python_codex-0.2.6.dist-info/METADATA +0 -441
  81. python_codex-0.2.6.dist-info/RECORD +0 -91
  82. {python_codex-0.2.6.dist-info → python_codex-0.3.0.dist-info}/WHEEL +0 -0
  83. {python_codex-0.2.6.dist-info → python_codex-0.3.0.dist-info}/entry_points.txt +0 -0
  84. {python_codex-0.2.6.dist-info → python_codex-0.3.0.dist-info}/licenses/LICENSE +0 -0
pycodex/__init__.py CHANGED
@@ -2,47 +2,47 @@ from .compat import patch_asyncio
2
2
 
3
3
  patch_asyncio()
4
4
 
5
- from .agent import Agent
5
+ from .agent import Agent, TurnInterrupted
6
6
  from .context import ContextConfig, ContextManager
7
+ from .events import Event, ModelEvent
7
8
  from .model import (
8
- ModelClient,
9
9
  NOOP_MODEL_STREAM_EVENT_HANDLER,
10
+ ContextLengthExceeded,
11
+ ModelClient,
10
12
  ResponsesApiError,
11
13
  ResponsesIncompleteError,
12
14
  ResponsesModelClient,
13
15
  ResponsesProviderConfig,
14
16
  )
15
17
  from .protocol import (
16
- AgentEvent,
17
18
  AssistantMessage,
18
19
  ContextMessage,
19
20
  ModelResponse,
20
- ModelStreamEvent,
21
21
  Prompt,
22
22
  ReasoningItem,
23
- Submission,
24
23
  ToolCall,
25
24
  ToolResult,
26
25
  ToolSpec,
27
26
  TurnResult,
28
27
  UserMessage,
29
28
  )
30
- from .runtime import CliSubmissionQueue
29
+ from .runtime import AgentRuntime
31
30
  from .runtime_services import (
32
31
  PlanStore,
33
32
  RequestPermissionsManager,
34
33
  RequestUserInputManager,
35
34
  SubAgentManager,
36
35
  create_agent_runtime_environment,
37
- get_agent_runtime_environment,
38
36
  )
39
37
  from .tools import (
40
38
  ApplyPatchTool,
41
39
  BaseTool,
40
+ ClockManager,
41
+ ClockTool,
42
42
  CloseAgentTool,
43
43
  CodeModeManager,
44
- ExecTool,
45
44
  ExecCommandTool,
45
+ ExecTool,
46
46
  GrepFilesTool,
47
47
  ListDirTool,
48
48
  ReadFileTool,
@@ -65,7 +65,8 @@ from .tools import (
65
65
  WriteStdinTool,
66
66
  )
67
67
 
68
- def debug(stop: 'bool' = False):
68
+
69
+ def debug(stop: "bool" = False):
69
70
 
70
71
  import socket
71
72
 
@@ -89,13 +90,18 @@ def debug(stop: 'bool' = False):
89
90
 
90
91
  print("\n".join(traceback.format_exception(e)))
91
92
 
93
+
92
94
  __all__ = [
93
- "AgentEvent",
95
+ "ContextLengthExceeded",
96
+ "Event",
94
97
  "Agent",
95
- "CliSubmissionQueue",
98
+ "AgentRuntime",
99
+ "TurnInterrupted",
96
100
  "ApplyPatchTool",
97
101
  "AssistantMessage",
98
102
  "BaseTool",
103
+ "ClockManager",
104
+ "ClockTool",
99
105
  "CloseAgentTool",
100
106
  "create_agent_runtime_environment",
101
107
  "CodeModeManager",
@@ -113,7 +119,7 @@ __all__ = [
113
119
  "RequestPermissionsTool",
114
120
  "RequestUserInputTool",
115
121
  "ModelResponse",
116
- "ModelStreamEvent",
122
+ "ModelEvent",
117
123
  "PlanStore",
118
124
  "Prompt",
119
125
  "ReasoningItem",
@@ -128,7 +134,6 @@ __all__ = [
128
134
  "ShellCommandTool",
129
135
  "ShellTool",
130
136
  "SpawnAgentTool",
131
- "Submission",
132
137
  "SubAgentManager",
133
138
  "ToolCall",
134
139
  "ToolContext",
@@ -144,5 +149,4 @@ __all__ = [
144
149
  "WaitTool",
145
150
  "WebSearchTool",
146
151
  "WriteStdinTool",
147
- "get_agent_runtime_environment",
148
152
  ]