python-codex 0.6.3__py3-none-any.whl → 0.7.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/agent.py +325 -321
- pycodex/config.py +4 -2
- pycodex/context.py +24 -9
- pycodex/events.py +116 -7
- pycodex/model.py +184 -94
- pycodex/multi_agents.py +11 -40
- pycodex/prompts/models.json +8 -8
- pycodex/protocol.py +1 -0
- pycodex/runtime.py +173 -127
- pycodex/tools/__init__.py +1 -3
- pycodex/tools/clock_manager.py +0 -7
- pycodex/tools/exec_command_tool.py +16 -5
- pycodex/tools/exec_runtime.py +5 -1
- pycodex/tools/goal_manager.py +25 -32
- pycodex/tools/runtime_services.py +21 -11
- pycodex/tools/unified_exec_manager.py +15 -3
- pycodex/utils/compactor.py +28 -101
- pycodex/utils/compat.py +6 -0
- pycodex/utils/event_helpers.py +9 -0
- pycodex/utils/model_metadata.py +5 -4
- {python_codex-0.6.3.dist-info → python_codex-0.7.0.dist-info}/METADATA +31 -8
- {python_codex-0.6.3.dist-info → python_codex-0.7.0.dist-info}/RECORD +28 -28
- responses_server/app.py +4 -0
- responses_server/gemini_api.py +26 -7
- responses_server/transport.py +12 -5
- {python_codex-0.6.3.dist-info → python_codex-0.7.0.dist-info}/WHEEL +0 -0
- {python_codex-0.6.3.dist-info → python_codex-0.7.0.dist-info}/entry_points.txt +0 -0
- {python_codex-0.6.3.dist-info → python_codex-0.7.0.dist-info}/licenses/LICENSE +0 -0
responses_server/transport.py
CHANGED
|
@@ -25,9 +25,13 @@ class OutcommingChatError(RuntimeError):
|
|
|
25
25
|
self,
|
|
26
26
|
message: "str",
|
|
27
27
|
error_type: "typing.Union[str, None]" = None,
|
|
28
|
+
http_status: "typing.Union[int, None]" = None,
|
|
29
|
+
error_code: "typing.Union[str, None]" = None,
|
|
28
30
|
) -> "None":
|
|
29
31
|
super().__init__(message)
|
|
30
32
|
self.error_type = error_type
|
|
33
|
+
self.http_status = http_status
|
|
34
|
+
self.error_code = error_code
|
|
31
35
|
|
|
32
36
|
|
|
33
37
|
class OutcommingTransport:
|
|
@@ -120,7 +124,7 @@ class OutcommingTransport:
|
|
|
120
124
|
yield payload
|
|
121
125
|
if not saw_done:
|
|
122
126
|
raise OutcommingChatError(
|
|
123
|
-
"outcomming chat stream ended before [DONE]"
|
|
127
|
+
"outcomming chat stream ended before [DONE]", error_code="502",
|
|
124
128
|
)
|
|
125
129
|
except (
|
|
126
130
|
ConnectionError,
|
|
@@ -139,7 +143,8 @@ class OutcommingTransport:
|
|
|
139
143
|
progress["phase"] = "reading_error_body"
|
|
140
144
|
body = exc.read().decode("utf-8", errors="replace")
|
|
141
145
|
raise OutcommingChatError(
|
|
142
|
-
f"outcomming chat request failed with status {exc.code}: {body[:500]}"
|
|
146
|
+
f"outcomming chat request failed with status {exc.code}: {body[:500]}",
|
|
147
|
+
http_status=exc.code,
|
|
143
148
|
) from exc
|
|
144
149
|
except TimeoutError as exc:
|
|
145
150
|
raise OutcommingChatError(
|
|
@@ -219,7 +224,7 @@ class OutcommingTransport:
|
|
|
219
224
|
if not finished:
|
|
220
225
|
terminal = "finishReason" if api == "gemini" else "message_stop"
|
|
221
226
|
raise OutcommingChatError(
|
|
222
|
-
f"outcomming {api} stream ended before `{terminal}`"
|
|
227
|
+
f"outcomming {api} stream ended before `{terminal}`", error_code="502",
|
|
223
228
|
)
|
|
224
229
|
if api == "gemini":
|
|
225
230
|
yield gemini_continuation_chunk(stream_state)
|
|
@@ -246,7 +251,8 @@ class OutcommingTransport:
|
|
|
246
251
|
progress["phase"] = "reading_error_body"
|
|
247
252
|
body = exc.read().decode("utf-8", errors="replace")
|
|
248
253
|
raise OutcommingChatError(
|
|
249
|
-
f"outcomming {api} request failed with status {exc.code}: {body[:500]}"
|
|
254
|
+
f"outcomming {api} request failed with status {exc.code}: {body[:500]}",
|
|
255
|
+
http_status=exc.code,
|
|
250
256
|
) from exc
|
|
251
257
|
except TimeoutError as exc:
|
|
252
258
|
raise OutcommingChatError(
|
|
@@ -338,7 +344,8 @@ class OutcommingTransport:
|
|
|
338
344
|
progress["phase"] = "reading_error_body"
|
|
339
345
|
body = exc.read().decode("utf-8", errors="replace")
|
|
340
346
|
raise OutcommingChatError(
|
|
341
|
-
f"outcomming request failed with status {exc.code}: {body[:500]}"
|
|
347
|
+
f"outcomming request failed with status {exc.code}: {body[:500]}",
|
|
348
|
+
http_status=exc.code,
|
|
342
349
|
) from exc
|
|
343
350
|
except TimeoutError as exc:
|
|
344
351
|
raise OutcommingChatError(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|