python-codex 0.5.0__py3-none-any.whl → 0.5.2__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 +2 -1
- pycodex/events.py +32 -1
- pycodex/model.py +187 -21
- pycodex/runtime.py +146 -19
- pycodex/tools/base_tool.py +6 -0
- pycodex/tools/clock_tool.py +44 -2
- pycodex/tools/exec_command_tool.py +6 -0
- pycodex/tools/runtime_services.py +44 -0
- pycodex/tools/unified_exec_manager.py +27 -0
- pycodex/utils/session_persist.py +31 -0
- {python_codex-0.5.0.dist-info → python_codex-0.5.2.dist-info}/METADATA +72 -3
- {python_codex-0.5.0.dist-info → python_codex-0.5.2.dist-info}/RECORD +15 -15
- {python_codex-0.5.0.dist-info → python_codex-0.5.2.dist-info}/WHEEL +0 -0
- {python_codex-0.5.0.dist-info → python_codex-0.5.2.dist-info}/entry_points.txt +0 -0
- {python_codex-0.5.0.dist-info → python_codex-0.5.2.dist-info}/licenses/LICENSE +0 -0
pycodex/agent.py
CHANGED
|
@@ -17,6 +17,7 @@ from .events import (
|
|
|
17
17
|
ModelCalledEvent,
|
|
18
18
|
ModelCompletedEvent,
|
|
19
19
|
ModelEvent,
|
|
20
|
+
ModelRequestTimingEvent,
|
|
20
21
|
StreamErrorEvent,
|
|
21
22
|
TerminalEvent,
|
|
22
23
|
TokenCountEvent,
|
|
@@ -558,7 +559,7 @@ class Agent:
|
|
|
558
559
|
self._emit(started_type(*details))
|
|
559
560
|
|
|
560
561
|
def handle_compact_stream_event(event: "ModelEvent") -> "None":
|
|
561
|
-
if isinstance(event, StreamErrorEvent) or (
|
|
562
|
+
if isinstance(event, (StreamErrorEvent, ModelRequestTimingEvent)) or (
|
|
562
563
|
phase == "manual" and isinstance(event, TokenCountEvent)
|
|
563
564
|
):
|
|
564
565
|
self._emit(replace(event, turn_id=turn_id))
|
pycodex/events.py
CHANGED
|
@@ -271,6 +271,17 @@ class TokenCountEvent(ModelEvent):
|
|
|
271
271
|
display.set_prompt(display.main_prompt())
|
|
272
272
|
|
|
273
273
|
|
|
274
|
+
@dataclass(frozen=True)
|
|
275
|
+
class ModelRequestTimingEvent(ModelEvent):
|
|
276
|
+
model: "str"
|
|
277
|
+
elapsed_seconds: "float"
|
|
278
|
+
first_data_seconds: "typing.Union[float, None]"
|
|
279
|
+
outcome: "str"
|
|
280
|
+
turn_id: "str" = ""
|
|
281
|
+
submission_id: "typing.Union[str, None]" = None
|
|
282
|
+
kind: ClassVar[str] = "model_request_timing"
|
|
283
|
+
|
|
284
|
+
|
|
274
285
|
@dataclass(frozen=True)
|
|
275
286
|
class StreamErrorEvent(ModelEvent):
|
|
276
287
|
message: "str"
|
|
@@ -285,9 +296,14 @@ class StreamErrorEvent(ModelEvent):
|
|
|
285
296
|
def visualize(self) -> "str":
|
|
286
297
|
return self.message
|
|
287
298
|
|
|
299
|
+
def detail(self) -> "str":
|
|
300
|
+
if not self.error:
|
|
301
|
+
return self.message
|
|
302
|
+
return "{0}\n{1}".format(self.message, self.error)
|
|
303
|
+
|
|
288
304
|
def render(self, display: "EventDisplay") -> "None":
|
|
289
305
|
display.stream_buffer = ""
|
|
290
|
-
display.write("[status] " + self.
|
|
306
|
+
display.write("[status] " + self.detail(), "status")
|
|
291
307
|
display.set_status("reconnecting")
|
|
292
308
|
|
|
293
309
|
|
|
@@ -735,6 +751,12 @@ class SessionStateEvent(Event):
|
|
|
735
751
|
state["input_request"].render(display)
|
|
736
752
|
|
|
737
753
|
|
|
754
|
+
@dataclass(frozen=True)
|
|
755
|
+
class RuntimeUpdatedEvent(Event):
|
|
756
|
+
reason: "str"
|
|
757
|
+
kind: ClassVar[str] = "runtime_updated"
|
|
758
|
+
|
|
759
|
+
|
|
738
760
|
@dataclass(frozen=True)
|
|
739
761
|
class SessionClosedEvent(Event):
|
|
740
762
|
kind: ClassVar[str] = "session_closed"
|
|
@@ -744,6 +766,14 @@ class SessionClosedEvent(Event):
|
|
|
744
766
|
display.finish_stream()
|
|
745
767
|
|
|
746
768
|
|
|
769
|
+
@dataclass(frozen=True)
|
|
770
|
+
class CommandStartedEvent(Event):
|
|
771
|
+
submission_id: "str"
|
|
772
|
+
command: "str"
|
|
773
|
+
sender: "str" = "user"
|
|
774
|
+
kind: ClassVar[str] = "command_started"
|
|
775
|
+
|
|
776
|
+
|
|
747
777
|
@dataclass(frozen=True)
|
|
748
778
|
class CommandCompletedEvent(Event):
|
|
749
779
|
submission_id: "str"
|
|
@@ -766,6 +796,7 @@ class CommandFailedEvent(Event):
|
|
|
766
796
|
command: "str"
|
|
767
797
|
error: "str"
|
|
768
798
|
sender: "str"
|
|
799
|
+
error_type: "str" = "CommandError"
|
|
769
800
|
kind: ClassVar[str] = "command_failed"
|
|
770
801
|
|
|
771
802
|
def visualize(self) -> "str":
|
pycodex/model.py
CHANGED
|
@@ -8,9 +8,11 @@ import urllib.parse
|
|
|
8
8
|
import uuid
|
|
9
9
|
from dataclasses import dataclass, field, replace
|
|
10
10
|
from pathlib import Path
|
|
11
|
+
from time import monotonic
|
|
11
12
|
from typing import Callable
|
|
12
13
|
|
|
13
14
|
import requests
|
|
15
|
+
from urllib3.exceptions import ReadTimeoutError
|
|
14
16
|
|
|
15
17
|
from .utils.compat import Protocol
|
|
16
18
|
|
|
@@ -22,6 +24,7 @@ except ModuleNotFoundError: # pragma: no cover - Python 3.10 path
|
|
|
22
24
|
from .events import (
|
|
23
25
|
AssistantDeltaEvent,
|
|
24
26
|
ModelEvent,
|
|
27
|
+
ModelRequestTimingEvent,
|
|
25
28
|
StreamErrorEvent,
|
|
26
29
|
TokenCountEvent,
|
|
27
30
|
ToolCalledEvent,
|
|
@@ -48,7 +51,7 @@ DEFAULT_STREAM_IDLE_TIMEOUT_MS = 300_000
|
|
|
48
51
|
INITIAL_RETRY_DELAY_SECONDS = 0.2
|
|
49
52
|
RETRY_BACKOFF_FACTOR = 2.0
|
|
50
53
|
RATE_LIMIT_RETRY_AFTER_RE = re.compile(
|
|
51
|
-
r"(?i)try again in\s*(\d+(?:\.\d+)?)\s*(
|
|
54
|
+
r"(?i)(?:try again in|retry after)\s*(\d+(?:\.\d+)?)\s*(ms|seconds?|s)"
|
|
52
55
|
)
|
|
53
56
|
|
|
54
57
|
|
|
@@ -97,6 +100,19 @@ class ResponsesProviderConfig:
|
|
|
97
100
|
stream_idle_timeout_ms: "typing.Union[int, None]" = None
|
|
98
101
|
service_tier: "typing.Union[str, None]" = None
|
|
99
102
|
responses_lite_override: "typing.Union[bool, None]" = None
|
|
103
|
+
fallback_models: "typing.Tuple[str, ...]" = ()
|
|
104
|
+
fallback_cooldown_seconds: "int" = 900
|
|
105
|
+
stream_first_data_timeout_ms: "typing.Union[int, None]" = None
|
|
106
|
+
|
|
107
|
+
def __post_init__(self):
|
|
108
|
+
cooldown = self.fallback_cooldown_seconds
|
|
109
|
+
if isinstance(cooldown, bool) or not isinstance(cooldown, int) or cooldown < 0:
|
|
110
|
+
raise ValueError("fallback_cooldown_seconds must be a non-negative integer")
|
|
111
|
+
value = self.stream_first_data_timeout_ms
|
|
112
|
+
if value is not None and (
|
|
113
|
+
isinstance(value, bool) or not isinstance(value, int) or value <= 0
|
|
114
|
+
):
|
|
115
|
+
raise ValueError("stream_first_data_timeout_ms must be a positive integer")
|
|
100
116
|
|
|
101
117
|
@classmethod
|
|
102
118
|
def from_codex_config(
|
|
@@ -142,6 +158,12 @@ class ResponsesProviderConfig:
|
|
|
142
158
|
use_chat_completion = _optional_bool(provider.get("use_chat_completion"))
|
|
143
159
|
if use_chat_completion is None:
|
|
144
160
|
use_chat_completion = False
|
|
161
|
+
fallback_models = provider.get("fallback_models", [])
|
|
162
|
+
if not isinstance(fallback_models, list) or any(
|
|
163
|
+
not isinstance(model, str) or not model or any(c.isspace() for c in model)
|
|
164
|
+
for model in fallback_models
|
|
165
|
+
):
|
|
166
|
+
raise ValueError("fallback_models must be an array of non-empty model IDs")
|
|
145
167
|
return cls(
|
|
146
168
|
model=selected["model"],
|
|
147
169
|
provider_name=provider_name,
|
|
@@ -160,6 +182,9 @@ class ResponsesProviderConfig:
|
|
|
160
182
|
stream_idle_timeout_ms=_optional_int(
|
|
161
183
|
provider.get("stream_idle_timeout_ms")
|
|
162
184
|
),
|
|
185
|
+
fallback_models=tuple(dict.fromkeys(fallback_models)),
|
|
186
|
+
fallback_cooldown_seconds=provider.get("fallback_cooldown_seconds", 900),
|
|
187
|
+
stream_first_data_timeout_ms=provider.get("stream_first_data_timeout_ms"),
|
|
163
188
|
)
|
|
164
189
|
|
|
165
190
|
def api_key(self) -> "typing.Union[str, None]":
|
|
@@ -361,6 +386,14 @@ class ResponsesRetryableError(ResponsesApiError):
|
|
|
361
386
|
self.retry_delay_seconds = retry_delay_seconds
|
|
362
387
|
|
|
363
388
|
|
|
389
|
+
class ResponsesModelUnavailableError(ResponsesApiError):
|
|
390
|
+
"""The selected model cannot serve this request; another model may work."""
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
class ResponsesFirstDataTimeout(ResponsesRetryableError):
|
|
394
|
+
"""The configured wait for initial response data has expired."""
|
|
395
|
+
|
|
396
|
+
|
|
364
397
|
@dataclass
|
|
365
398
|
class _StreamDiagnostics:
|
|
366
399
|
raw_lines_received: "int" = 0
|
|
@@ -369,6 +402,8 @@ class _StreamDiagnostics:
|
|
|
369
402
|
last_sse_event_name: "str" = ""
|
|
370
403
|
last_event_type: "str" = ""
|
|
371
404
|
last_payload_excerpt: "str" = ""
|
|
405
|
+
started_at: "float" = field(default_factory=monotonic)
|
|
406
|
+
first_data_seconds: "typing.Union[float, None]" = None
|
|
372
407
|
|
|
373
408
|
|
|
374
409
|
class ResponsesModelClient:
|
|
@@ -394,6 +429,7 @@ class ResponsesModelClient:
|
|
|
394
429
|
self._originator = originator
|
|
395
430
|
self._user_agent = user_agent or build_user_agent(originator)
|
|
396
431
|
self._openai_subagent = openai_subagent
|
|
432
|
+
self._model_cooldowns: "typing.Dict[str, float]" = {}
|
|
397
433
|
|
|
398
434
|
@property
|
|
399
435
|
def model(self) -> "str":
|
|
@@ -402,6 +438,7 @@ class ResponsesModelClient:
|
|
|
402
438
|
@model.setter
|
|
403
439
|
def model(self, model: "str") -> "None":
|
|
404
440
|
self._config = replace(self._config, model=model)
|
|
441
|
+
self._model_cooldowns.clear()
|
|
405
442
|
|
|
406
443
|
@property
|
|
407
444
|
def reasoning_effort(self) -> "typing.Union[str, None]":
|
|
@@ -486,6 +523,26 @@ class ResponsesModelClient:
|
|
|
486
523
|
) -> "ModelResponse":
|
|
487
524
|
retries = 0
|
|
488
525
|
max_retries = self._config.effective_stream_max_retries()
|
|
526
|
+
models = tuple(dict.fromkeys((self.model,) + self._config.fallback_models))
|
|
527
|
+
now = monotonic()
|
|
528
|
+
self._model_cooldowns = {
|
|
529
|
+
model: deadline
|
|
530
|
+
for model, deadline in self._model_cooldowns.items()
|
|
531
|
+
if model in models and deadline > now
|
|
532
|
+
}
|
|
533
|
+
available_models = [
|
|
534
|
+
model for model in models if model not in self._model_cooldowns
|
|
535
|
+
]
|
|
536
|
+
if not available_models:
|
|
537
|
+
self._model_cooldowns.clear()
|
|
538
|
+
available_models = list(models)
|
|
539
|
+
fallback_models = iter(available_models)
|
|
540
|
+
first_model = next(fallback_models)
|
|
541
|
+
request_client = (
|
|
542
|
+
self
|
|
543
|
+
if first_model == self.model
|
|
544
|
+
else self.with_overrides(model=first_model)
|
|
545
|
+
)
|
|
489
546
|
loop = asyncio.get_running_loop()
|
|
490
547
|
active = True
|
|
491
548
|
callback_lock = threading.Lock()
|
|
@@ -502,14 +559,35 @@ class ResponsesModelClient:
|
|
|
502
559
|
try:
|
|
503
560
|
while True:
|
|
504
561
|
try:
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
562
|
+
response = await asyncio.to_thread(request_client._complete_sync, prompt, receive)
|
|
563
|
+
self._model_cooldowns.pop(request_client.model, None)
|
|
564
|
+
return response
|
|
565
|
+
except (ResponsesRetryableError, ResponsesModelUnavailableError) as exc:
|
|
566
|
+
if (
|
|
567
|
+
isinstance(exc, ResponsesModelUnavailableError)
|
|
568
|
+
or (isinstance(exc, ResponsesFirstDataTimeout) and len(models) > 1)
|
|
569
|
+
or retries >= max_retries
|
|
570
|
+
):
|
|
571
|
+
cooldown = self._config.fallback_cooldown_seconds
|
|
572
|
+
if len(models) > 1 and cooldown > 0:
|
|
573
|
+
self._model_cooldowns[request_client.model] = (
|
|
574
|
+
monotonic() + cooldown
|
|
575
|
+
)
|
|
576
|
+
fallback_model = next(fallback_models, None)
|
|
577
|
+
if fallback_model is None:
|
|
578
|
+
raise
|
|
579
|
+
event_handler(
|
|
580
|
+
StreamErrorEvent(
|
|
581
|
+
f"Falling back: {request_client.model} -> {fallback_model}",
|
|
582
|
+
0,
|
|
583
|
+
max_retries,
|
|
584
|
+
0.0,
|
|
585
|
+
str(exc),
|
|
586
|
+
)
|
|
587
|
+
)
|
|
588
|
+
request_client = self.with_overrides(model=fallback_model)
|
|
589
|
+
retries = 0
|
|
590
|
+
continue
|
|
513
591
|
retries += 1
|
|
514
592
|
delay_seconds = exc.retry_delay_seconds
|
|
515
593
|
if delay_seconds is None:
|
|
@@ -545,6 +623,9 @@ class ResponsesModelClient:
|
|
|
545
623
|
data=body,
|
|
546
624
|
)
|
|
547
625
|
diagnostics = _StreamDiagnostics()
|
|
626
|
+
completed = False
|
|
627
|
+
first_data_ms = self._config.stream_first_data_timeout_ms
|
|
628
|
+
first_timeout = first_data_ms / 1000.0 if first_data_ms is not None else None
|
|
548
629
|
try:
|
|
549
630
|
with requests.Session() as session:
|
|
550
631
|
settings = session.merge_environment_settings(
|
|
@@ -558,8 +639,10 @@ class ResponsesModelClient:
|
|
|
558
639
|
if verify is not None:
|
|
559
640
|
settings["verify"] = verify
|
|
560
641
|
timeout = (
|
|
561
|
-
max(self._timeout_seconds, 1.0),
|
|
562
|
-
self.
|
|
642
|
+
min(max(self._timeout_seconds, 1.0), first_timeout)
|
|
643
|
+
if first_timeout is not None else max(self._timeout_seconds, 1.0),
|
|
644
|
+
first_timeout if first_timeout is not None
|
|
645
|
+
else self._config.effective_stream_idle_timeout_seconds(),
|
|
563
646
|
)
|
|
564
647
|
response = session.send(
|
|
565
648
|
prepared,
|
|
@@ -576,22 +659,62 @@ class ResponsesModelClient:
|
|
|
576
659
|
)
|
|
577
660
|
if _is_context_length_error_message(error_body):
|
|
578
661
|
raise ContextLengthExceeded(message)
|
|
579
|
-
if response.status_code >= 500:
|
|
580
|
-
raise ResponsesRetryableError(
|
|
662
|
+
if response.status_code >= 500 or response.status_code in (408, 429):
|
|
663
|
+
raise ResponsesRetryableError(
|
|
664
|
+
message,
|
|
665
|
+
retry_delay_seconds=self._try_parse_retry_after_seconds(
|
|
666
|
+
"rate_limit_exceeded" if response.status_code == 429 else "",
|
|
667
|
+
error_body,
|
|
668
|
+
),
|
|
669
|
+
)
|
|
670
|
+
if response.status_code in (403, 404):
|
|
671
|
+
raise ResponsesModelUnavailableError(message)
|
|
581
672
|
raise ResponsesApiError(message)
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
673
|
+
if first_timeout is not None:
|
|
674
|
+
remaining = first_timeout - (monotonic() - diagnostics.started_at)
|
|
675
|
+
if remaining <= 0:
|
|
676
|
+
raise ResponsesFirstDataTimeout(
|
|
677
|
+
"responses first-data timeout after {:.1f}s".format(first_timeout)
|
|
678
|
+
)
|
|
679
|
+
_set_response_read_timeout(response, remaining)
|
|
680
|
+
lines = _stream_lines(self._track_stream_chunks(
|
|
681
|
+
response.iter_content(chunk_size=1, decode_unicode=False),
|
|
682
|
+
diagnostics, response,
|
|
683
|
+
))
|
|
684
|
+
else:
|
|
685
|
+
lines = response.iter_lines(chunk_size=1, decode_unicode=False)
|
|
686
|
+
tracked_lines = self._track_stream_lines(lines, diagnostics)
|
|
687
|
+
result = self._parse_stream(
|
|
587
688
|
tracked_lines,
|
|
588
689
|
event_handler,
|
|
589
690
|
diagnostics=diagnostics,
|
|
590
691
|
)
|
|
692
|
+
completed = True
|
|
693
|
+
return result
|
|
591
694
|
except requests.RequestException as exc:
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
695
|
+
error_type = ResponsesRetryableError
|
|
696
|
+
if (
|
|
697
|
+
first_timeout is not None and diagnostics.first_data_seconds is None
|
|
698
|
+
and (
|
|
699
|
+
isinstance(exc, requests.Timeout)
|
|
700
|
+
or isinstance(exc.__context__, ReadTimeoutError)
|
|
701
|
+
or any(isinstance(arg, ReadTimeoutError) for arg in exc.args)
|
|
702
|
+
)
|
|
703
|
+
):
|
|
704
|
+
error_type = ResponsesFirstDataTimeout
|
|
705
|
+
error = error_type(self._format_transport_error(url, exc, diagnostics))
|
|
706
|
+
error.elapsed_seconds = monotonic() - diagnostics.started_at
|
|
707
|
+
error.first_data_seconds = diagnostics.first_data_seconds
|
|
708
|
+
raise error from exc
|
|
709
|
+
except ResponsesApiError as exc:
|
|
710
|
+
exc.elapsed_seconds = monotonic() - diagnostics.started_at
|
|
711
|
+
exc.first_data_seconds = diagnostics.first_data_seconds
|
|
712
|
+
raise
|
|
713
|
+
finally:
|
|
714
|
+
event_handler(ModelRequestTimingEvent(
|
|
715
|
+
self.model, monotonic() - diagnostics.started_at,
|
|
716
|
+
diagnostics.first_data_seconds, "completed" if completed else "failed",
|
|
717
|
+
))
|
|
595
718
|
|
|
596
719
|
def _build_payload(self, prompt: "Prompt") -> "typing.Dict[str, object]":
|
|
597
720
|
use_responses_lite = self._config.use_responses_lite()
|
|
@@ -974,9 +1097,20 @@ class ResponsesModelClient:
|
|
|
974
1097
|
diagnostics: "_StreamDiagnostics",
|
|
975
1098
|
):
|
|
976
1099
|
for raw_line in response:
|
|
1100
|
+
if diagnostics.first_data_seconds is None:
|
|
1101
|
+
diagnostics.first_data_seconds = monotonic() - diagnostics.started_at
|
|
977
1102
|
diagnostics.raw_lines_received += 1
|
|
978
1103
|
yield raw_line
|
|
979
1104
|
|
|
1105
|
+
def _track_stream_chunks(self, chunks, diagnostics, response):
|
|
1106
|
+
for chunk in chunks:
|
|
1107
|
+
if chunk and diagnostics.first_data_seconds is None:
|
|
1108
|
+
diagnostics.first_data_seconds = monotonic() - diagnostics.started_at
|
|
1109
|
+
_set_response_read_timeout(
|
|
1110
|
+
response, self._config.effective_stream_idle_timeout_seconds()
|
|
1111
|
+
)
|
|
1112
|
+
yield chunk
|
|
1113
|
+
|
|
980
1114
|
def _base_error_details(
|
|
981
1115
|
self,
|
|
982
1116
|
url: "str",
|
|
@@ -1010,6 +1144,8 @@ class ResponsesModelClient:
|
|
|
1010
1144
|
details = self._base_error_details(url)
|
|
1011
1145
|
if diagnostics is not None:
|
|
1012
1146
|
details.extend(self._transport_diagnostics_details(diagnostics))
|
|
1147
|
+
details.append(("elapsed_seconds", round(monotonic() - diagnostics.started_at, 3)))
|
|
1148
|
+
details.append(("first_data_seconds", diagnostics.first_data_seconds))
|
|
1013
1149
|
details.append(("exception", type(exc).__name__))
|
|
1014
1150
|
details.append(("detail", str(exc) or repr(exc)))
|
|
1015
1151
|
details.append(
|
|
@@ -1109,6 +1245,8 @@ class ResponsesModelClient:
|
|
|
1109
1245
|
raise ContextLengthExceeded(
|
|
1110
1246
|
self._format_response_failed_error(message, code)
|
|
1111
1247
|
)
|
|
1248
|
+
if code in {"model_not_found", "model_not_available", "permission_denied"}:
|
|
1249
|
+
raise ResponsesModelUnavailableError(self._format_response_failed_error(message, code))
|
|
1112
1250
|
if code in {
|
|
1113
1251
|
"insufficient_quota",
|
|
1114
1252
|
"invalid_prompt",
|
|
@@ -1210,6 +1348,34 @@ class ResponsesModelClient:
|
|
|
1210
1348
|
return value
|
|
1211
1349
|
|
|
1212
1350
|
|
|
1351
|
+
def _set_response_read_timeout(response, seconds):
|
|
1352
|
+
# Keep-alive responses expose the socket on the urllib3 connection. For
|
|
1353
|
+
# Connection: close, http.client retains it on the response file instead.
|
|
1354
|
+
raw = getattr(response, "raw", None)
|
|
1355
|
+
connection = getattr(raw, "connection", None)
|
|
1356
|
+
sock = getattr(connection, "sock", None)
|
|
1357
|
+
if sock is None:
|
|
1358
|
+
fp = getattr(getattr(raw, "_fp", None), "fp", None)
|
|
1359
|
+
sock = getattr(getattr(fp, "raw", None), "_sock", None)
|
|
1360
|
+
if sock is not None:
|
|
1361
|
+
sock.settimeout(seconds)
|
|
1362
|
+
|
|
1363
|
+
|
|
1364
|
+
def _stream_lines(chunks):
|
|
1365
|
+
pending = None
|
|
1366
|
+
for chunk in chunks:
|
|
1367
|
+
if pending is not None:
|
|
1368
|
+
chunk = pending + chunk
|
|
1369
|
+
lines = chunk.splitlines()
|
|
1370
|
+
if lines and lines[-1] and chunk and lines[-1][-1] == chunk[-1]:
|
|
1371
|
+
pending = lines.pop()
|
|
1372
|
+
else:
|
|
1373
|
+
pending = None
|
|
1374
|
+
yield from lines
|
|
1375
|
+
if pending is not None:
|
|
1376
|
+
yield pending
|
|
1377
|
+
|
|
1378
|
+
|
|
1213
1379
|
def _optional_int(value: "object") -> "typing.Union[int, None]":
|
|
1214
1380
|
if value is None:
|
|
1215
1381
|
return None
|
pycodex/runtime.py
CHANGED
|
@@ -10,10 +10,12 @@ from .events import (
|
|
|
10
10
|
AutoCompactCompletedEvent,
|
|
11
11
|
CommandCompletedEvent,
|
|
12
12
|
CommandFailedEvent,
|
|
13
|
+
CommandStartedEvent,
|
|
13
14
|
Event,
|
|
14
15
|
InputQueuedEvent,
|
|
15
16
|
InputRequestedEvent,
|
|
16
17
|
InputResolvedEvent,
|
|
18
|
+
RuntimeUpdatedEvent,
|
|
17
19
|
SessionClosedEvent,
|
|
18
20
|
SessionStateEvent,
|
|
19
21
|
StreamErrorEvent,
|
|
@@ -86,6 +88,9 @@ class AgentRuntime:
|
|
|
86
88
|
self.title = ""
|
|
87
89
|
self.command_handlers = {}
|
|
88
90
|
self._frontends = {}
|
|
91
|
+
self._interactive_frontends = set()
|
|
92
|
+
self._command_tasks = set()
|
|
93
|
+
self._active_commands = {}
|
|
89
94
|
self._close_handlers = []
|
|
90
95
|
self._worker = None
|
|
91
96
|
self._command_lock = None
|
|
@@ -96,10 +101,18 @@ class AgentRuntime:
|
|
|
96
101
|
environment = agent.tool_registry.runtime_environment
|
|
97
102
|
environment.request_user_input_manager.set_handler(self._request_user_input)
|
|
98
103
|
environment.request_permissions_manager.set_handler(self._request_permissions)
|
|
104
|
+
environment.plan_store.set_listener(lambda _plan: self._publish_update("plan"))
|
|
105
|
+
environment.subagent_manager.set_state_listener(
|
|
106
|
+
lambda: self._publish_update("agents")
|
|
107
|
+
)
|
|
108
|
+
for tool in self.agent.tool_registry.tools():
|
|
109
|
+
tool.set_state_listener(lambda: self._publish_update("background_work"))
|
|
99
110
|
|
|
100
|
-
def attach(self, event_handler):
|
|
111
|
+
def attach(self, event_handler, interactive=True):
|
|
101
112
|
frontend_id = uuid7_string()
|
|
102
113
|
self._frontends[frontend_id] = event_handler
|
|
114
|
+
if interactive:
|
|
115
|
+
self._interactive_frontends.add(frontend_id)
|
|
103
116
|
self._notify_handler(
|
|
104
117
|
event_handler, SessionStateEvent("attach", self.snapshot())
|
|
105
118
|
)
|
|
@@ -107,7 +120,8 @@ class AgentRuntime:
|
|
|
107
120
|
|
|
108
121
|
def detach(self, frontend_id):
|
|
109
122
|
del self._frontends[frontend_id]
|
|
110
|
-
|
|
123
|
+
self._interactive_frontends.discard(frontend_id)
|
|
124
|
+
if not self._interactive_frontends and self._input_request is not None:
|
|
111
125
|
self._finish_input_request(None)
|
|
112
126
|
|
|
113
127
|
def register_command(self, name, handler):
|
|
@@ -170,6 +184,70 @@ class AgentRuntime:
|
|
|
170
184
|
"plan": self.agent.tool_registry.runtime_environment.plan_store.snapshot(),
|
|
171
185
|
}
|
|
172
186
|
|
|
187
|
+
def state_snapshot(self):
|
|
188
|
+
"""Current frontend state, without completed conversation history."""
|
|
189
|
+
agent = self.agent
|
|
190
|
+
client = typing.cast(ModelControl, agent.model_client)
|
|
191
|
+
active = self._active_turn
|
|
192
|
+
return {
|
|
193
|
+
"agent_session_id": agent.session_id,
|
|
194
|
+
"title": self.title,
|
|
195
|
+
"cwd": str(agent.context_manager.cwd),
|
|
196
|
+
"model": {
|
|
197
|
+
"name": agent.model_name,
|
|
198
|
+
"reasoning_effort": client.reasoning_effort,
|
|
199
|
+
},
|
|
200
|
+
"busy": self.is_busy,
|
|
201
|
+
"running": agent.is_running,
|
|
202
|
+
"closed": agent.is_shutdown,
|
|
203
|
+
"accepts_input": self.accepts_input,
|
|
204
|
+
"active_turn": (
|
|
205
|
+
{
|
|
206
|
+
key: active[key]
|
|
207
|
+
for key in (
|
|
208
|
+
"turn_id", "submission_id", "user_texts", "assistant_text",
|
|
209
|
+
"model_errors",
|
|
210
|
+
)
|
|
211
|
+
} if active is not None else None
|
|
212
|
+
),
|
|
213
|
+
"queued_inputs": [
|
|
214
|
+
{
|
|
215
|
+
"submission_id": item.submission_id,
|
|
216
|
+
"turn_id": item.turn_id,
|
|
217
|
+
"queue": name,
|
|
218
|
+
"prompts": list(item.texts),
|
|
219
|
+
}
|
|
220
|
+
for name, queue in (
|
|
221
|
+
("steer", self._steer_queue), ("enqueue", self._enqueue_queue)
|
|
222
|
+
)
|
|
223
|
+
for item in queue
|
|
224
|
+
],
|
|
225
|
+
"input_request": self._input_request_event(),
|
|
226
|
+
"plan": agent.tool_registry.runtime_environment.plan_store.snapshot(),
|
|
227
|
+
"commands": [dict(command) for command in self._active_commands.values()],
|
|
228
|
+
"background_work_count": sum(
|
|
229
|
+
tool.background_work_count(False)
|
|
230
|
+
for tool in agent.tool_registry.tools()
|
|
231
|
+
),
|
|
232
|
+
"context_window": agent.context_manager.resolve_model_context_window(),
|
|
233
|
+
"max_context_window": agent.context_manager.resolve_model_max_context_window(),
|
|
234
|
+
"auto_compact_token_limit": agent.context_manager.resolve_auto_compact_token_limit(),
|
|
235
|
+
"usage_tokens": agent._last_total_usage_tokens,
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
def background_work_snapshot(self):
|
|
239
|
+
return [
|
|
240
|
+
dict(item, tool=tool.name)
|
|
241
|
+
for tool in self.agent.tool_registry.tools()
|
|
242
|
+
for item in tool.background_work_snapshot()
|
|
243
|
+
]
|
|
244
|
+
|
|
245
|
+
async def list_models(self):
|
|
246
|
+
return await self.agent.model_client.list_models()
|
|
247
|
+
|
|
248
|
+
def _publish_update(self, reason):
|
|
249
|
+
self._publish(RuntimeUpdatedEvent(reason))
|
|
250
|
+
|
|
173
251
|
def publish_state(self, reason):
|
|
174
252
|
self._recorded_rollout_path = self.agent.recorded_session_file_path
|
|
175
253
|
self._publish(SessionStateEvent(reason, self.snapshot()))
|
|
@@ -237,11 +315,21 @@ class AgentRuntime:
|
|
|
237
315
|
self._wake_worker()
|
|
238
316
|
await asyncio.shield(self._worker)
|
|
239
317
|
|
|
240
|
-
async def submit_input(self, text, sender="user"):
|
|
318
|
+
async def submit_input(self, text, sender="user", wait_for_command=True):
|
|
241
319
|
if not self.agent.accepts_input:
|
|
242
320
|
raise RuntimeError("agent is shutting down")
|
|
321
|
+
input_starts_with_space = text.startswith(" ")
|
|
243
322
|
text = text.strip()
|
|
244
|
-
|
|
323
|
+
command = text.split(None, 1)[0] if text else ""
|
|
324
|
+
# Codex treats another slash in the name as a path and a leading
|
|
325
|
+
# ASCII space as an escape, even for a registered command.
|
|
326
|
+
is_command = (
|
|
327
|
+
command.startswith("/")
|
|
328
|
+
and not input_starts_with_space
|
|
329
|
+
and "/" not in command[1:]
|
|
330
|
+
and len(command) > 1
|
|
331
|
+
)
|
|
332
|
+
if self._input_request is not None and not is_command:
|
|
245
333
|
self._answer_input(text)
|
|
246
334
|
future = asyncio.get_running_loop().create_future()
|
|
247
335
|
future.set_result(None)
|
|
@@ -251,29 +339,59 @@ class AgentRuntime:
|
|
|
251
339
|
future.set_result(None)
|
|
252
340
|
return SubmittedInput(uuid7_string(), "empty", future)
|
|
253
341
|
parts = text.split(None, 1)
|
|
254
|
-
command = parts[0]
|
|
255
342
|
argument = parts[1] if len(parts) == 2 else ""
|
|
343
|
+
if not is_command:
|
|
344
|
+
return await self._submit_message(text, "steer", sender, False)
|
|
256
345
|
if command == "/queue":
|
|
257
346
|
if not argument.strip():
|
|
258
347
|
raise ValueError("Usage: /queue <message>")
|
|
259
348
|
return await self._submit_message(argument.strip(), "enqueue", sender, True)
|
|
260
|
-
if not command.startswith("/"):
|
|
261
|
-
return await self._submit_message(text, "steer", sender, False)
|
|
262
349
|
submission_id = uuid7_string()
|
|
263
350
|
future = asyncio.get_running_loop().create_future()
|
|
351
|
+
future.add_done_callback(self._observe_completion)
|
|
352
|
+
receipt = SubmittedInput(submission_id, "command", future)
|
|
353
|
+
self._active_commands[submission_id] = {
|
|
354
|
+
"submission_id": submission_id, "command": command,
|
|
355
|
+
"sender": sender, "status": "queued",
|
|
356
|
+
}
|
|
357
|
+
self._publish_update("commands")
|
|
358
|
+
operation = self._run_command(receipt, command, argument.strip(), sender)
|
|
359
|
+
if wait_for_command:
|
|
360
|
+
await operation
|
|
361
|
+
else:
|
|
362
|
+
task = asyncio.create_task(operation)
|
|
363
|
+
self._command_tasks.add(task)
|
|
364
|
+
task.add_done_callback(self._command_tasks.discard)
|
|
365
|
+
return receipt
|
|
366
|
+
|
|
367
|
+
async def _run_command(self, receipt, command, argument, sender):
|
|
264
368
|
try:
|
|
265
369
|
async with self._get_command_lock():
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
370
|
+
self._active_commands[receipt.submission_id]["status"] = "running"
|
|
371
|
+
self._publish(
|
|
372
|
+
CommandStartedEvent(receipt.submission_id, command, sender)
|
|
373
|
+
)
|
|
374
|
+
result = await self._execute_command(command[1:], argument)
|
|
375
|
+
except asyncio.CancelledError:
|
|
376
|
+
del self._active_commands[receipt.submission_id]
|
|
377
|
+
receipt.future.cancel()
|
|
378
|
+
self._publish(CommandFailedEvent(
|
|
379
|
+
receipt.submission_id, command, "command caller cancelled",
|
|
380
|
+
sender, "CancelledError",
|
|
381
|
+
))
|
|
382
|
+
raise
|
|
269
383
|
except Exception as exc:
|
|
270
|
-
|
|
271
|
-
|
|
384
|
+
del self._active_commands[receipt.submission_id]
|
|
385
|
+
receipt.future.set_exception(exc)
|
|
386
|
+
self._publish(CommandFailedEvent(
|
|
387
|
+
receipt.submission_id, command, str(exc), sender, type(exc).__name__,
|
|
388
|
+
))
|
|
272
389
|
else:
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
390
|
+
del self._active_commands[receipt.submission_id]
|
|
391
|
+
receipt.future.set_result(result)
|
|
392
|
+
self._publish(
|
|
393
|
+
CommandCompletedEvent(receipt.submission_id, command, result, sender)
|
|
394
|
+
)
|
|
277
395
|
|
|
278
396
|
async def _execute_command(self, command, argument):
|
|
279
397
|
if command in {"help", "history", "compact", "fork"} and argument:
|
|
@@ -300,7 +418,7 @@ class AgentRuntime:
|
|
|
300
418
|
return {
|
|
301
419
|
"kind": "models",
|
|
302
420
|
"model": self.agent.model_name,
|
|
303
|
-
"models": await self.
|
|
421
|
+
"models": await self.list_models(),
|
|
304
422
|
}
|
|
305
423
|
if command == "effort":
|
|
306
424
|
client = typing.cast(ModelControl, self.agent.model_client)
|
|
@@ -364,7 +482,7 @@ class AgentRuntime:
|
|
|
364
482
|
return await self._request_input("permissions", payload)
|
|
365
483
|
|
|
366
484
|
async def _request_input(self, kind, payload):
|
|
367
|
-
if not self.
|
|
485
|
+
if not self._interactive_frontends or not self.agent.accepts_input:
|
|
368
486
|
return None
|
|
369
487
|
if self._input_request is not None:
|
|
370
488
|
raise RuntimeError("a user input request is already pending")
|
|
@@ -497,6 +615,7 @@ class AgentRuntime:
|
|
|
497
615
|
queued = self._steer_queue[-1]
|
|
498
616
|
queued.texts.append(text)
|
|
499
617
|
queued.futures.append(future)
|
|
618
|
+
self._publish_update("queue")
|
|
500
619
|
return queued.submission_id, future
|
|
501
620
|
|
|
502
621
|
submission_id = uuid7_string()
|
|
@@ -513,6 +632,7 @@ class AgentRuntime:
|
|
|
513
632
|
)
|
|
514
633
|
target = self._steer_queue if queue == "steer" else self._enqueue_queue
|
|
515
634
|
target.append(queued)
|
|
635
|
+
self._publish_update("queue")
|
|
516
636
|
asyncio.get_running_loop().call_soon(self._wake_worker)
|
|
517
637
|
return submission_id, future
|
|
518
638
|
|
|
@@ -535,7 +655,10 @@ class AgentRuntime:
|
|
|
535
655
|
self._finish_submission_result(queued, result)
|
|
536
656
|
finally:
|
|
537
657
|
self._current_submission = None
|
|
658
|
+
self._publish_update("idle")
|
|
538
659
|
try:
|
|
660
|
+
if self._command_tasks:
|
|
661
|
+
await asyncio.gather(*tuple(self._command_tasks))
|
|
539
662
|
async with self._get_command_lock():
|
|
540
663
|
await self._close_resources()
|
|
541
664
|
finally:
|
|
@@ -604,11 +727,15 @@ class AgentRuntime:
|
|
|
604
727
|
"user_texts": list(event.user_texts),
|
|
605
728
|
"assistant_text": "",
|
|
606
729
|
"completed_history": conversation_history_to_turns(self.agent.history),
|
|
730
|
+
"model_errors": [],
|
|
607
731
|
}
|
|
608
732
|
elif self._active_turn is not None:
|
|
609
733
|
if isinstance(event, AssistantDeltaEvent):
|
|
610
734
|
self._active_turn["assistant_text"] += event.delta
|
|
611
|
-
elif isinstance(event,
|
|
735
|
+
elif isinstance(event, StreamErrorEvent):
|
|
736
|
+
self._active_turn["assistant_text"] = ""
|
|
737
|
+
self._active_turn["model_errors"].append(event.detail())
|
|
738
|
+
elif isinstance(event, ToolCompletedEvent):
|
|
612
739
|
self._active_turn["assistant_text"] = ""
|
|
613
740
|
elif isinstance(event, AutoCompactCompletedEvent):
|
|
614
741
|
self._active_turn["completed_history"] = conversation_history_to_turns(
|
pycodex/tools/base_tool.py
CHANGED
|
@@ -107,6 +107,12 @@ class BaseTool(ABC):
|
|
|
107
107
|
def background_work_count(self, after_reply: "bool") -> "int":
|
|
108
108
|
return 0
|
|
109
109
|
|
|
110
|
+
def background_work_snapshot(self) -> "typing.List[JSONDict]":
|
|
111
|
+
return []
|
|
112
|
+
|
|
113
|
+
def set_state_listener(self, listener) -> "None":
|
|
114
|
+
pass
|
|
115
|
+
|
|
110
116
|
|
|
111
117
|
class ToolRegistry:
|
|
112
118
|
def __init__(
|
pycodex/tools/clock_tool.py
CHANGED
|
@@ -8,7 +8,7 @@ cancels the pending countdown, and every successful reply starts a fresh one.
|
|
|
8
8
|
import asyncio
|
|
9
9
|
import math
|
|
10
10
|
import typing
|
|
11
|
-
from datetime import datetime
|
|
11
|
+
from datetime import datetime, timedelta
|
|
12
12
|
|
|
13
13
|
from ..events import (
|
|
14
14
|
CompactCompletedEvent,
|
|
@@ -50,6 +50,8 @@ class ClockManager:
|
|
|
50
50
|
self._period_m: "typing.Union[float, None]" = None
|
|
51
51
|
self._timer_task: "typing.Union[asyncio.Task, None]" = None
|
|
52
52
|
self._generation = 0
|
|
53
|
+
self._next_fire_at = None
|
|
54
|
+
self._state_listener = None
|
|
53
55
|
self._notify_hook: "typing.Union[typing.Callable[[typing.Dict[str, object]], typing.Awaitable[typing.Any]], None]" = (None)
|
|
54
56
|
|
|
55
57
|
def set_notify_hook(
|
|
@@ -58,10 +60,29 @@ class ClockManager:
|
|
|
58
60
|
) -> "None":
|
|
59
61
|
self._notify_hook = callback
|
|
60
62
|
|
|
63
|
+
def set_state_listener(self, listener):
|
|
64
|
+
self._state_listener = listener
|
|
65
|
+
|
|
66
|
+
def _state_changed(self):
|
|
67
|
+
if self._state_listener is not None:
|
|
68
|
+
self._state_listener()
|
|
69
|
+
|
|
70
|
+
def background_snapshot(self):
|
|
71
|
+
return dict(
|
|
72
|
+
self.snapshot(),
|
|
73
|
+
kind="clock",
|
|
74
|
+
next_fire_at=self._next_fire_at,
|
|
75
|
+
status=(
|
|
76
|
+
"armed" if self._next_fire_at is not None
|
|
77
|
+
else "paused" if self.enabled else "disabled"
|
|
78
|
+
),
|
|
79
|
+
)
|
|
80
|
+
|
|
61
81
|
def set_period(self, value: "object") -> "JSONDict":
|
|
62
82
|
self._cancel_pending()
|
|
63
83
|
if value is None:
|
|
64
84
|
self._period_m = None
|
|
85
|
+
self._state_changed()
|
|
65
86
|
return self.snapshot()
|
|
66
87
|
if isinstance(value, bool) or not isinstance(value, (int, float)):
|
|
67
88
|
raise ValueError("period_m must be a positive finite number or null")
|
|
@@ -69,6 +90,7 @@ class ClockManager:
|
|
|
69
90
|
if not math.isfinite(period_m) or period_m <= 0:
|
|
70
91
|
raise ValueError("period_m must be a positive finite number or null")
|
|
71
92
|
self._period_m = period_m
|
|
93
|
+
self._state_changed()
|
|
72
94
|
return self.snapshot()
|
|
73
95
|
|
|
74
96
|
def snapshot(self) -> "JSONDict":
|
|
@@ -81,21 +103,32 @@ class ClockManager:
|
|
|
81
103
|
def enabled(self) -> "bool":
|
|
82
104
|
return self._period_m is not None
|
|
83
105
|
|
|
106
|
+
@property
|
|
107
|
+
def armed(self) -> "bool":
|
|
108
|
+
return self._next_fire_at is not None
|
|
109
|
+
|
|
84
110
|
def turn_started(self) -> "None":
|
|
85
111
|
self._cancel_pending()
|
|
112
|
+
self._state_changed()
|
|
86
113
|
|
|
87
114
|
def arm_after_reply(self) -> "None":
|
|
88
115
|
self._cancel_pending()
|
|
89
116
|
period_m = self._period_m
|
|
90
117
|
if period_m is None or self._notify_hook is None:
|
|
118
|
+
self._state_changed()
|
|
91
119
|
return
|
|
92
120
|
generation = self._generation
|
|
121
|
+
self._next_fire_at = (
|
|
122
|
+
datetime.now().astimezone()
|
|
123
|
+
+ timedelta(seconds=period_m * self._seconds_per_minute)
|
|
124
|
+
).isoformat()
|
|
93
125
|
self._timer_task = asyncio.create_task(
|
|
94
126
|
self._wait_and_notify(generation, period_m)
|
|
95
127
|
)
|
|
96
128
|
self._timer_task.add_done_callback(
|
|
97
129
|
lambda task: None if task.cancelled() else task.exception()
|
|
98
130
|
)
|
|
131
|
+
self._state_changed()
|
|
99
132
|
|
|
100
133
|
def cancel(self) -> "None":
|
|
101
134
|
self.set_period(None)
|
|
@@ -104,6 +137,7 @@ class ClockManager:
|
|
|
104
137
|
self._generation += 1
|
|
105
138
|
task = self._timer_task
|
|
106
139
|
self._timer_task = None
|
|
140
|
+
self._next_fire_at = None
|
|
107
141
|
if task is not None and not task.done():
|
|
108
142
|
task.cancel()
|
|
109
143
|
|
|
@@ -118,6 +152,8 @@ class ClockManager:
|
|
|
118
152
|
return
|
|
119
153
|
|
|
120
154
|
self._timer_task = None
|
|
155
|
+
self._next_fire_at = None
|
|
156
|
+
self._state_changed()
|
|
121
157
|
callback = self._notify_hook
|
|
122
158
|
if callback is None:
|
|
123
159
|
return
|
|
@@ -192,7 +228,13 @@ class ClockTool(BaseTool):
|
|
|
192
228
|
self._manager.set_notify_hook(None)
|
|
193
229
|
|
|
194
230
|
def background_work_count(self, after_reply: "bool") -> "int":
|
|
195
|
-
return int(after_reply
|
|
231
|
+
return int(self._manager.enabled if after_reply else self._manager.armed)
|
|
232
|
+
|
|
233
|
+
def background_work_snapshot(self):
|
|
234
|
+
return [self._manager.background_snapshot()]
|
|
235
|
+
|
|
236
|
+
def set_state_listener(self, listener):
|
|
237
|
+
self._manager.set_state_listener(listener)
|
|
196
238
|
|
|
197
239
|
async def run(self, context: "ToolContext", args: "JSONDict") -> "JSONValue":
|
|
198
240
|
del context
|
|
@@ -86,6 +86,12 @@ class ExecCommandTool(BaseTool):
|
|
|
86
86
|
def background_work_count(self, after_reply: "bool") -> "int":
|
|
87
87
|
return self._manager.running_session_count()
|
|
88
88
|
|
|
89
|
+
def background_work_snapshot(self):
|
|
90
|
+
return self._manager.snapshot()
|
|
91
|
+
|
|
92
|
+
def set_state_listener(self, listener):
|
|
93
|
+
self._manager.set_state_listener(listener)
|
|
94
|
+
|
|
89
95
|
async def run(self, context: "ToolContext", args: "JSONDict") -> "JSONValue":
|
|
90
96
|
cmd = str(args.get("cmd", "")).strip()
|
|
91
97
|
if not cmd:
|
|
@@ -10,6 +10,8 @@ from ..events import (
|
|
|
10
10
|
CompactFailedEvent,
|
|
11
11
|
CompactStartedEvent,
|
|
12
12
|
Event,
|
|
13
|
+
RuntimeUpdatedEvent,
|
|
14
|
+
SessionClosedEvent,
|
|
13
15
|
TurnCompletedEvent,
|
|
14
16
|
TurnFailedEvent,
|
|
15
17
|
TurnInterruptedEvent,
|
|
@@ -225,6 +227,40 @@ class SubAgentManager:
|
|
|
225
227
|
self._condition = None
|
|
226
228
|
self._available_nicknames: "typing.List[str]" = []
|
|
227
229
|
self._nickname_random = random.Random()
|
|
230
|
+
self._state_listener = None
|
|
231
|
+
|
|
232
|
+
def set_state_listener(self, listener):
|
|
233
|
+
self._state_listener = listener
|
|
234
|
+
|
|
235
|
+
def _state_changed(self):
|
|
236
|
+
if self._state_listener is not None:
|
|
237
|
+
self._state_listener()
|
|
238
|
+
|
|
239
|
+
def list_agents(self, parent_agent_id):
|
|
240
|
+
agents = []
|
|
241
|
+
for managed in self._agents.values():
|
|
242
|
+
agents.append({
|
|
243
|
+
"agent_id": managed.agent_id,
|
|
244
|
+
"parent_agent_id": parent_agent_id,
|
|
245
|
+
"nickname": managed.nickname,
|
|
246
|
+
"status": self._status_payload(managed),
|
|
247
|
+
})
|
|
248
|
+
agents.extend(
|
|
249
|
+
managed.runtime.agent.tool_registry.runtime_environment
|
|
250
|
+
.subagent_manager.list_agents(managed.agent_id)
|
|
251
|
+
)
|
|
252
|
+
return agents
|
|
253
|
+
|
|
254
|
+
def get_runtime(self, agent_id):
|
|
255
|
+
if agent_id in self._agents:
|
|
256
|
+
return self._agents[agent_id].runtime
|
|
257
|
+
for managed in self._agents.values():
|
|
258
|
+
manager = managed.runtime.agent.tool_registry.runtime_environment.subagent_manager
|
|
259
|
+
try:
|
|
260
|
+
return manager.get_runtime(agent_id)
|
|
261
|
+
except KeyError:
|
|
262
|
+
continue
|
|
263
|
+
raise KeyError(agent_id)
|
|
228
264
|
|
|
229
265
|
def _get_condition(self):
|
|
230
266
|
if self._condition is None:
|
|
@@ -271,6 +307,7 @@ class SubAgentManager:
|
|
|
271
307
|
async with self._get_condition():
|
|
272
308
|
self._agents[agent_id] = managed
|
|
273
309
|
self._condition.notify_all()
|
|
310
|
+
self._state_changed()
|
|
274
311
|
|
|
275
312
|
initial_prompt = self._compose_prompt(message, items)
|
|
276
313
|
if initial_prompt:
|
|
@@ -300,6 +337,7 @@ class SubAgentManager:
|
|
|
300
337
|
future.add_done_callback(self._submission_finished)
|
|
301
338
|
async with self._get_condition():
|
|
302
339
|
self._condition.notify_all()
|
|
340
|
+
self._state_changed()
|
|
303
341
|
return {"submission_id": submission_id}
|
|
304
342
|
|
|
305
343
|
async def resume_agent(self, agent_id: "str") -> "typing.Dict[str, object]":
|
|
@@ -312,6 +350,7 @@ class SubAgentManager:
|
|
|
312
350
|
await managed.runtime.start()
|
|
313
351
|
async with self._get_condition():
|
|
314
352
|
self._condition.notify_all()
|
|
353
|
+
self._state_changed()
|
|
315
354
|
return {"status": self._status_payload(managed)}
|
|
316
355
|
|
|
317
356
|
async def close_agent(self, agent_id: "str") -> "typing.Dict[str, object]":
|
|
@@ -322,6 +361,7 @@ class SubAgentManager:
|
|
|
322
361
|
await managed.runtime.close()
|
|
323
362
|
async with self._get_condition():
|
|
324
363
|
self._condition.notify_all()
|
|
364
|
+
self._state_changed()
|
|
325
365
|
return {"previous_status": previous_status}
|
|
326
366
|
|
|
327
367
|
async def shutdown(self) -> "None":
|
|
@@ -389,6 +429,9 @@ class SubAgentManager:
|
|
|
389
429
|
asyncio.create_task(self._notify_waiters())
|
|
390
430
|
|
|
391
431
|
def _handle_agent_event(self, managed: "ManagedAgent", event: "Event") -> "None":
|
|
432
|
+
if isinstance(event, (RuntimeUpdatedEvent, SessionClosedEvent)):
|
|
433
|
+
self._state_changed()
|
|
434
|
+
return
|
|
392
435
|
if isinstance(event, TurnCompletedEvent):
|
|
393
436
|
managed.last_status = {"completed": event.output_text}
|
|
394
437
|
elif isinstance(event, CompactCompletedEvent):
|
|
@@ -426,6 +469,7 @@ class SubAgentManager:
|
|
|
426
469
|
asyncio.create_task(self._notify_waiters())
|
|
427
470
|
|
|
428
471
|
async def _notify_waiters(self) -> "None":
|
|
472
|
+
self._state_changed()
|
|
429
473
|
async with self._get_condition():
|
|
430
474
|
self._condition.notify_all()
|
|
431
475
|
|
|
@@ -125,6 +125,7 @@ class UnifiedExecManager:
|
|
|
125
125
|
self._next_session_id = DEFAULT_SESSION_ID_START
|
|
126
126
|
self._sessions: "typing.Dict[int, UnifiedExecSession]" = {}
|
|
127
127
|
self._lock = threading.Lock()
|
|
128
|
+
self._state_listener = None
|
|
128
129
|
self._notify_hook: "typing.Union[typing.Callable[[typing.Dict[str, object]], typing.Awaitable[typing.Any]], None]" = (None)
|
|
129
130
|
|
|
130
131
|
def set_notify_hook(
|
|
@@ -140,6 +141,29 @@ class UnifiedExecManager:
|
|
|
140
141
|
if session.process.returncode is None
|
|
141
142
|
)
|
|
142
143
|
|
|
144
|
+
def set_state_listener(self, listener):
|
|
145
|
+
self._state_listener = listener
|
|
146
|
+
|
|
147
|
+
def _state_changed(self):
|
|
148
|
+
if self._state_listener is not None:
|
|
149
|
+
self._state_listener()
|
|
150
|
+
|
|
151
|
+
def snapshot(self):
|
|
152
|
+
with self._lock:
|
|
153
|
+
return [
|
|
154
|
+
{
|
|
155
|
+
"kind": "exec",
|
|
156
|
+
"session_id": session.session_id,
|
|
157
|
+
"pid": session.process.pid,
|
|
158
|
+
"tty": session.tty,
|
|
159
|
+
"status": (
|
|
160
|
+
"running" if session.process.returncode is None else "exited"
|
|
161
|
+
),
|
|
162
|
+
"exit_code": session.process.returncode,
|
|
163
|
+
}
|
|
164
|
+
for session in self._sessions.values()
|
|
165
|
+
]
|
|
166
|
+
|
|
143
167
|
async def exec_command(
|
|
144
168
|
self,
|
|
145
169
|
cmd: "str",
|
|
@@ -180,6 +204,7 @@ class UnifiedExecManager:
|
|
|
180
204
|
|
|
181
205
|
with self._lock:
|
|
182
206
|
self._sessions[session_id] = session
|
|
207
|
+
self._state_changed()
|
|
183
208
|
|
|
184
209
|
output = await self._wait_and_snapshot(
|
|
185
210
|
session_id,
|
|
@@ -299,6 +324,7 @@ class UnifiedExecManager:
|
|
|
299
324
|
session = self._sessions.pop(session_id, None)
|
|
300
325
|
if session is None:
|
|
301
326
|
return
|
|
327
|
+
self._state_changed()
|
|
302
328
|
if session.process.stdin is not None and not stream_writer_is_closing(
|
|
303
329
|
session.process.stdin
|
|
304
330
|
):
|
|
@@ -349,6 +375,7 @@ class UnifiedExecManager:
|
|
|
349
375
|
if session is None:
|
|
350
376
|
return
|
|
351
377
|
await session.process.wait()
|
|
378
|
+
self._state_changed()
|
|
352
379
|
with self._lock:
|
|
353
380
|
if self._sessions.get(session_id) is not session:
|
|
354
381
|
return
|
pycodex/utils/session_persist.py
CHANGED
|
@@ -332,6 +332,37 @@ def conversation_history_to_turns(
|
|
|
332
332
|
return tuple(turns)
|
|
333
333
|
|
|
334
334
|
|
|
335
|
+
def read_rollout_history_page(rollout_path, before=None, limit=100):
|
|
336
|
+
"""Read a bounded page of conversation records in chronological order."""
|
|
337
|
+
if isinstance(limit, bool) or not isinstance(limit, int) or not 1 <= limit <= 200:
|
|
338
|
+
raise ValueError("limit must be between 1 and 200")
|
|
339
|
+
if before is not None and (
|
|
340
|
+
isinstance(before, bool) or not isinstance(before, int) or before < 0
|
|
341
|
+
):
|
|
342
|
+
raise ValueError("before must be a non-negative record index")
|
|
343
|
+
entries = deque(maxlen=limit + 1)
|
|
344
|
+
index = 0
|
|
345
|
+
for entry in _iter_rollout_entries(Path(rollout_path)):
|
|
346
|
+
kind = entry.get("type")
|
|
347
|
+
if kind not in {"response_item", "compacted"}:
|
|
348
|
+
continue
|
|
349
|
+
if before is not None and index >= before:
|
|
350
|
+
break
|
|
351
|
+
payload = entry["payload"]
|
|
352
|
+
if kind == "compacted":
|
|
353
|
+
payload = {"message": payload.get("message", "")}
|
|
354
|
+
entries.append({"index": index, "type": kind, "payload": payload})
|
|
355
|
+
index += 1
|
|
356
|
+
if before is not None and before > index:
|
|
357
|
+
raise ValueError("history cursor is beyond the current history")
|
|
358
|
+
more = len(entries) > limit
|
|
359
|
+
items = list(entries)[-limit:]
|
|
360
|
+
return {
|
|
361
|
+
"items": items,
|
|
362
|
+
"next_before": items[0]["index"] if more else None,
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
|
|
335
366
|
def load_display_history(
|
|
336
367
|
rollout_path: "typing.Union[str, Path]",
|
|
337
368
|
limit: "int" = 80,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-codex
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: A minimal Python extraction of Codex's main agent loop
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Requires-Python: >=3.6.2
|
|
@@ -102,6 +102,11 @@ pycodex --json "Reply with exactly OK."
|
|
|
102
102
|
| `/queue <message>` | Wait for the active turn to finish before submitting |
|
|
103
103
|
|
|
104
104
|
Ordinary input during a turn steers at the next safe sampling boundary.
|
|
105
|
+
Slash input uses Codex's command rules: `/data/project` and `/tmp/` are
|
|
106
|
+
ordinary messages, while an unknown single-component name such as `/modle`
|
|
107
|
+
or `/tmp` reports a command error. Start the input with a space to send any
|
|
108
|
+
slash-prefixed text literally, including known commands such as ` /model`.
|
|
109
|
+
These rules also apply to the browser workspace and Feishu.
|
|
105
110
|
Sessions are saved under `CODEX_HOME/sessions`. Set
|
|
106
111
|
`model_auto_compact_token_limit` in the configuration to compact automatically.
|
|
107
112
|
|
|
@@ -127,9 +132,34 @@ pycodex-ws --listen 127.0.0.1:6007 --workspace-config workspaces.json
|
|
|
127
132
|
Open `http://127.0.0.1:6007`. The workspace combines conversations with a live
|
|
128
133
|
HTML Canvas and read-only file/diff viewers. Click file links in replies to open
|
|
129
134
|
them, and use **Insert into chat** to add selected code to an editable draft.
|
|
135
|
+
Local PDF links open in the browser's built-in reader, with **Open in new tab**
|
|
136
|
+
and **Download** links. PDF files are streamed separately from text snapshots.
|
|
130
137
|
Keep the server's stdin open: EOF initiates shutdown.
|
|
131
|
-
|
|
132
|
-
|
|
138
|
+
**New session** directly creates a session using the launch `--profile`, or the
|
|
139
|
+
base config when unset. The **+** button on its right (**Custom profile**) lets
|
|
140
|
+
you choose a named profile from the server's Codex config; **Default** uses the
|
|
141
|
+
launch setting. Each session saves its profile name and uses it again on restart; existing sessions
|
|
142
|
+
keep their configuration. Restart the server after adding or removing profiles.
|
|
143
|
+
While the selected Agent is working, the empty composer cycles through usage
|
|
144
|
+
hints about commands, frontend customization, workspace sharing, session collaboration and optional
|
|
145
|
+
features about every six seconds, starting at a random hint. Edit the short
|
|
146
|
+
strings in the `hints` list in `workspace.html`'s `updatePromptPlaceholder` to change the tips.
|
|
147
|
+
The gear button opens **Customize Agent** and **Share**, with a short description of each.
|
|
148
|
+
Customize Agent starts an Agent conversation for editing files in
|
|
149
|
+
`~/.pycodex/frontend/`. Its setup context includes an API quick
|
|
150
|
+
reference and the path to the full API documentation shipped with the package.
|
|
151
|
+
Browse the [feature catalog](packages/pycodex-ws/workspace_server/optional_features/README.md)
|
|
152
|
+
in the view area and tell the Agent which features to adapt. You can also ask it
|
|
153
|
+
to publish a local customization as a GitHub feature PR using the
|
|
154
|
+
[contribution format](packages/pycodex-ws/workspace_server/optional_features/CONTRIBUTING.md).
|
|
155
|
+
The [custom frontend API](docs/WORKSPACE_API.md) provides structured state,
|
|
156
|
+
command results, history pagination, event replay and Agent/background-task
|
|
157
|
+
inventories. Optional `custom.js` extensions can export `mount(host)` to use
|
|
158
|
+
the built-in page's session, draft and viewer controls.
|
|
159
|
+
With a workspace server administrator password configured, **Share** sets a
|
|
160
|
+
separate password for this workspace using the existing login page. Sharing
|
|
161
|
+
passwords and visitor logins live only in memory; changing the password, stopping
|
|
162
|
+
sharing or restarting the process invalidates them. Router login is unchanged.
|
|
133
163
|
|
|
134
164
|
See the [workspace guide](packages/pycodex-ws/README.md) for session controls,
|
|
135
165
|
storage and Feishu setup. The separately distributed
|
|
@@ -185,9 +215,48 @@ uv run --dev pytest
|
|
|
185
215
|
```
|
|
186
216
|
|
|
187
217
|
- [Test environments and coverage](tests/TESTS.md)
|
|
218
|
+
- [Repository development rules and reading guide](AGENTS.md)
|
|
188
219
|
- [Architecture, package layout and runtime contracts](docs/RUNTIME.md)
|
|
189
220
|
- [Prompts, configuration and context](docs/CONTEXT.md)
|
|
190
221
|
- [Upstream alignment](docs/ALIGNMENT.md)
|
|
191
222
|
- [Responses compatibility server](docs/responses_server/README.md)
|
|
223
|
+
- [Portable configuration contracts](docs/PORTABLE.md)
|
|
192
224
|
|
|
193
225
|
Release notes and implementation details live in `docs/`.
|
|
226
|
+
|
|
227
|
+
## Markdown view modes
|
|
228
|
+
|
|
229
|
+
Markdown file views include a Show source / Show preview button. Switching
|
|
230
|
+
modes preserves each mode's reading position without replaying a previous line
|
|
231
|
+
target.
|
|
232
|
+
|
|
233
|
+
## Responses reliability
|
|
234
|
+
|
|
235
|
+
Providers can opt into ordered failover with `fallback_models = ["backup-one",
|
|
236
|
+
"backup-two"]` in their `[model_providers.<name>]` table. Each target uses the
|
|
237
|
+
same endpoint, credentials, history and tools; request settings are rebuilt for
|
|
238
|
+
that model, while the session's selected model stays unchanged. Transient errors
|
|
239
|
+
exhaust `stream_max_retries` before advancing. Unavailable-model errors and
|
|
240
|
+
first-data timeouts advance immediately. Existing retry notices name both models
|
|
241
|
+
and include the underlying error.
|
|
242
|
+
|
|
243
|
+
Failed models cool down for 900 seconds within that client. Subsequent requests
|
|
244
|
+
skip them, retry them after expiry, and restart the full chain when every target
|
|
245
|
+
is cooling. `fallback_cooldown_seconds = 0` disables cooldown; explicit model
|
|
246
|
+
selection clears it. New sessions and subagents have independent cooldowns.
|
|
247
|
+
An absent or empty list disables failover. Invalid input, context-length and
|
|
248
|
+
terminal incomplete errors retain their existing handling. Backups must support
|
|
249
|
+
the active tools and context size; compaction keeps the selected model's policy.
|
|
250
|
+
|
|
251
|
+
Responses HTTP 408/429 and server errors use the provider retry budget.
|
|
252
|
+
Rate-limit messages containing `try again in` or `retry after` supply the retry
|
|
253
|
+
delay. CLI and workspace retry notices include the underlying error details;
|
|
254
|
+
workspace notices survive browser refresh and active-turn reattachment, and
|
|
255
|
+
remain separate from the assistant reply. They are not persisted in rollouts.
|
|
256
|
+
|
|
257
|
+
## Workspace input history
|
|
258
|
+
|
|
259
|
+
The workspace message box supports Up/Down input history. Up recalls earlier
|
|
260
|
+
human inputs in the current conversation; Down returns to the unsent draft.
|
|
261
|
+
Automatic wake-up messages are excluded, and arrows retain normal cursor
|
|
262
|
+
movement inside multiline drafts.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
pycodex/__init__.py,sha256=fHEyhylULeRo-5xEnl-UxT5ZpBzbFzRW7vLwdy_7oxU,2660
|
|
2
2
|
pycodex/__main__.py,sha256=MHKZ_ae3fSLGTLUUMOx15fWdeOnJSHhq-zslRP5F5Lc,79
|
|
3
|
-
pycodex/agent.py,sha256=
|
|
3
|
+
pycodex/agent.py,sha256=n37WeYIEZXahhHSv4fXc5wR5PF1SLuTn5LNl5Zwcogo,21863
|
|
4
4
|
pycodex/bootstrap.py,sha256=wUNipqvIPzJlcP3PTY0cCyPH_QTeIbSR8xtyw4AEP6Y,12282
|
|
5
5
|
pycodex/cli.py,sha256=uCrRARI2IypIU-1aC0Y2DLzhzYGWQta1f7zYWsyaNnU,12797
|
|
6
6
|
pycodex/context.py,sha256=8P3fBXbwzTKmoXGDdkzTsAghfOkAZstJnMTqr-cxHyI,27019
|
|
7
|
-
pycodex/events.py,sha256=
|
|
8
|
-
pycodex/model.py,sha256=
|
|
7
|
+
pycodex/events.py,sha256=U_yk25C-ZqNbDl59w6gtM70oAgr6wq56HsAR23CSyuU,30588
|
|
8
|
+
pycodex/model.py,sha256=KmSO-k_QkOm5qCgkVk9gibvyyiU6-tImZY-PUcX5S6I,54043
|
|
9
9
|
pycodex/protocol.py,sha256=uzUz_06iA4m9vAoqZeCGiJ4SocKZDzOfCJUU4Bpt5dI,12033
|
|
10
|
-
pycodex/runtime.py,sha256=
|
|
10
|
+
pycodex/runtime.py,sha256=CoYkscTyW6WGOm78HSkzHDex2y96RXrQ-6c6lHJSzv8,30045
|
|
11
11
|
pycodex/portable/__init__.py,sha256=FmspRPmblYuZIVXMpXaxE1uosCaz2hZDpkpOzxDJQic,1084
|
|
12
12
|
pycodex/portable/client.py,sha256=DOxzZljVfN1ynmhqrChX7NsT1IFSFVKzEn1J3wvV3XQ,16038
|
|
13
13
|
pycodex/portable/server.py,sha256=w4YD71Sxb7MD5q57GPuIgx7AoicTv0R9xzX2kAaibPA,7503
|
|
@@ -24,11 +24,11 @@ pycodex/prompts/permissions/sandbox_mode/workspace_write.md,sha256=lVN-LwrBbHqlv
|
|
|
24
24
|
pycodex/tools/__init__.py,sha256=UYwmsX_Ckw_YaYQ6TYhUU6w5pxi2qzZoTrq6BAgNErM,1857
|
|
25
25
|
pycodex/tools/agent_tool_schemas.py,sha256=8cL9ml4So0H6IIeK0ZzjAo9bk3VeprDOSYPpIamOqEU,2048
|
|
26
26
|
pycodex/tools/apply_patch_tool.py,sha256=n30M-ofZlOkDCC18nX10MPF5FLROiURACFLG1hd4FK8,13906
|
|
27
|
-
pycodex/tools/base_tool.py,sha256=
|
|
28
|
-
pycodex/tools/clock_tool.py,sha256=
|
|
27
|
+
pycodex/tools/base_tool.py,sha256=paBph9XemCWm2tPBHFUSBcjB9i1BqKeQIJi04OC1-BY,6809
|
|
28
|
+
pycodex/tools/clock_tool.py,sha256=D1uON_F_oXSQka1C2VOC7Hgs7Pvfc5C7-37gRugSbdI,7899
|
|
29
29
|
pycodex/tools/close_agent_tool.py,sha256=uIbCjsQx9MLkjVYheS8ZVf5VVPbC6Iviwox4pneJpmI,2030
|
|
30
30
|
pycodex/tools/code_mode_manager.py,sha256=oEzYkebFdgX993NBC0A4R0mthg4qdhJ-dD0fgeE3III,18948
|
|
31
|
-
pycodex/tools/exec_command_tool.py,sha256=
|
|
31
|
+
pycodex/tools/exec_command_tool.py,sha256=Shv9WMUP-ZGk11C7EMqUl1pr_nAH831iKNx3RTCLPYA,4620
|
|
32
32
|
pycodex/tools/exec_runtime.js,sha256=DR1uocKailTqNWAcJNFJuQgFFMSUzTpT_uQsRaneg2s,3643
|
|
33
33
|
pycodex/tools/exec_tool.py,sha256=tuC21rlhP8CPSYml4XnSDSRV0UPGkQ6aHj0DLIoOOvM,2274
|
|
34
34
|
pycodex/tools/grep_files_tool.py,sha256=KCBVNaSTU45ND-iAhh14YawMyjQnMRZnGI1NGKL3zgg,4809
|
|
@@ -37,12 +37,12 @@ pycodex/tools/read_file_tool.py,sha256=YK__uhIVldBjAQega5S_ZuZU5jgP_kLOwr-YhjAmR
|
|
|
37
37
|
pycodex/tools/request_permissions_tool.py,sha256=nEt3_uw3lmFXyydqcN3PxuKwrEvaRPtfjA_U8nikCtU,3978
|
|
38
38
|
pycodex/tools/request_user_input_tool.py,sha256=_7siHF2p3KiNDFwsTqKKIUw2kPCXMzLaR12PkZ1wdIQ,4050
|
|
39
39
|
pycodex/tools/resume_agent_tool.py,sha256=bZvXEUNdc1RVD2N5Msjv63Rni62FQk4gj9LAXK1Vsy8,1613
|
|
40
|
-
pycodex/tools/runtime_services.py,sha256=
|
|
40
|
+
pycodex/tools/runtime_services.py,sha256=mk4J06htubwStgxBJeHLQi64W5uVNkMamhgvqTCMxe4,17496
|
|
41
41
|
pycodex/tools/send_input_tool.py,sha256=w63SKM05_e3oXvdaBtL-hk941TvkWKuTUDEqTSyWEMQ,3761
|
|
42
42
|
pycodex/tools/shell_command_tool.py,sha256=bJKlTdIs2i28vH5f4GZfpunezr6JNicRzsL_6Vc3HvU,3675
|
|
43
43
|
pycodex/tools/shell_tool.py,sha256=I6lYLABSmLddRrNmpk0Li83AV55MI8x0bckWaRkFGI0,3527
|
|
44
44
|
pycodex/tools/spawn_agent_tool.py,sha256=Jx5jYpxsH_CQ3BLkXYPZuIINW5deO_zY8tyw8kZpreY,6208
|
|
45
|
-
pycodex/tools/unified_exec_manager.py,sha256=
|
|
45
|
+
pycodex/tools/unified_exec_manager.py,sha256=KKmWbJc24tXabbQQPac2Go7yezV3eZSPQqIMauWtZOA,14934
|
|
46
46
|
pycodex/tools/update_plan_tool.py,sha256=xwrSrerw5qfkbFc9Ltx1OZEmD__CWtryOy3UhL0-Jp4,3198
|
|
47
47
|
pycodex/tools/view_image_tool.py,sha256=H7OP-QZEU5Gf-E4YnQbXfu2hDkL5-dJ3Apla2YYjErQ,3754
|
|
48
48
|
pycodex/tools/wait_agent_tool.py,sha256=pLsnk9TxSt4v7krC7s7vxi91pLisSNU0lATt9s-P_3E,3134
|
|
@@ -62,7 +62,7 @@ pycodex/utils/get_env.py,sha256=L4S8h84tkgxZKvrxY7ezTgePbXepG-yIigUTKeY6uuE,6094
|
|
|
62
62
|
pycodex/utils/image_utils.py,sha256=OUzUs0Cow4L8Z2np0EBeEUotAqqsCmRmhrV8AxZUXRw,2460
|
|
63
63
|
pycodex/utils/model_metadata.py,sha256=uK3iI4yC7Ge7yN4I1_gQYalQ4MYKddz2qMwsmQb-P80,1337
|
|
64
64
|
pycodex/utils/random_ids.py,sha256=jLTxZZ0MBbRdQOFDFWGVRjWzIo6FKSQ5ADXbQSLPp1s,379
|
|
65
|
-
pycodex/utils/session_persist.py,sha256=
|
|
65
|
+
pycodex/utils/session_persist.py,sha256=ceCJjg_spDzf3E8UMetlPnMPqy3wZmvqY3E0JwaotO8,25298
|
|
66
66
|
pycodex/utils/truncation.py,sha256=5D6vAorT8EgXgjd7ASwtraAyIZdlCR-w5jKZqJxDzho,5446
|
|
67
67
|
pycodex/utils/_aes_gcm/LICENSE,sha256=KvdHagY3sYIK34GldJaRi34sNnGwMVJIIoDhbC9MRu8,2805
|
|
68
68
|
pycodex/utils/_aes_gcm/README.md,sha256=D9XGeewCgU2PVqJCO6WusUs0Mw2FbMnABCqaVktqCnE,3045
|
|
@@ -83,8 +83,8 @@ responses_server/trajectory_dump.py,sha256=5_Wy6tslszrqx3j1JeP_boyTbzIicKy8No84P
|
|
|
83
83
|
responses_server/tools/__init__.py,sha256=ivsBSEy0SBUhY-Uea5v1XMLXShkwHdCVl0id-1FwdZg,150
|
|
84
84
|
responses_server/tools/custom_adapter.py,sha256=SnIiNUdomff3APtTriURAC9YCeEdhCDjzGMEYusfUdk,8340
|
|
85
85
|
responses_server/tools/web_search.py,sha256=pnKH9JyTScRehWpZS3HpXRvjWsQvC0QZqxjEOCT4ndg,8936
|
|
86
|
-
python_codex-0.5.
|
|
87
|
-
python_codex-0.5.
|
|
88
|
-
python_codex-0.5.
|
|
89
|
-
python_codex-0.5.
|
|
90
|
-
python_codex-0.5.
|
|
86
|
+
python_codex-0.5.2.dist-info/METADATA,sha256=fKnCsLh7iHfZnQlTzJKqyoPMf0LsUyR7N0UZ6D0aZQo,11014
|
|
87
|
+
python_codex-0.5.2.dist-info/WHEEL,sha256=KGYbc1zXlYddvwxnNty23BeaKzh7YuoSIvIMO4jEhvw,87
|
|
88
|
+
python_codex-0.5.2.dist-info/entry_points.txt,sha256=sNUVakoVuTrzJH505ZgRTQxmtRRPUHV_EH0i6EbYTyM,45
|
|
89
|
+
python_codex-0.5.2.dist-info/licenses/LICENSE,sha256=0X8ifk312hYAORM4hlzg8wVSEXYKNmiPgWlB1YIy2Nw,10926
|
|
90
|
+
python_codex-0.5.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|