verifiers 0.2.2.dev93__py3-none-any.whl → 0.2.2.dev94__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.
- verifiers/v1/acp/runner.py +39 -17
- {verifiers-0.2.2.dev93.dist-info → verifiers-0.2.2.dev94.dist-info}/METADATA +1 -1
- {verifiers-0.2.2.dev93.dist-info → verifiers-0.2.2.dev94.dist-info}/RECORD +6 -6
- {verifiers-0.2.2.dev93.dist-info → verifiers-0.2.2.dev94.dist-info}/WHEEL +0 -0
- {verifiers-0.2.2.dev93.dist-info → verifiers-0.2.2.dev94.dist-info}/entry_points.txt +0 -0
- {verifiers-0.2.2.dev93.dist-info → verifiers-0.2.2.dev94.dist-info}/licenses/LICENSE +0 -0
verifiers/v1/acp/runner.py
CHANGED
|
@@ -36,6 +36,7 @@ from acp.schema import (
|
|
|
36
36
|
)
|
|
37
37
|
|
|
38
38
|
MAX_PACKET_BYTES = 128 * 1024 * 1024
|
|
39
|
+
LATE_UPDATE_GRACE_SECONDS = 1.0
|
|
39
40
|
|
|
40
41
|
|
|
41
42
|
class VerifiersACPClient(Client):
|
|
@@ -43,6 +44,7 @@ class VerifiersACPClient(Client):
|
|
|
43
44
|
self.visible_reply = ""
|
|
44
45
|
self.message_id: str | None = None
|
|
45
46
|
self.tool_calls: dict[str, str] = {}
|
|
47
|
+
self.output_changed = asyncio.Condition()
|
|
46
48
|
|
|
47
49
|
def reset(self) -> None:
|
|
48
50
|
self.visible_reply = ""
|
|
@@ -50,22 +52,23 @@ class VerifiersACPClient(Client):
|
|
|
50
52
|
self.tool_calls = {}
|
|
51
53
|
|
|
52
54
|
async def session_update(self, session_id: str, update: Any, **kwargs: Any) -> None:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
55
|
+
async with self.output_changed:
|
|
56
|
+
if isinstance(update, ToolCall):
|
|
57
|
+
self.tool_calls[update.tool_call_id] = update.status or "pending"
|
|
58
|
+
elif isinstance(update, ToolCallUpdate):
|
|
59
|
+
if update.status:
|
|
60
|
+
self.tool_calls[update.tool_call_id] = update.status
|
|
61
|
+
elif isinstance(update, AgentMessageChunk) and isinstance(
|
|
62
|
+
update.content, TextContentBlock
|
|
63
|
+
):
|
|
64
|
+
message_id = getattr(update, "message_id", None)
|
|
65
|
+
if message_id is not None and message_id != self.message_id:
|
|
66
|
+
self.visible_reply = ""
|
|
67
|
+
self.message_id = message_id
|
|
68
|
+
self.visible_reply += update.content.text
|
|
69
|
+
else:
|
|
70
|
+
return
|
|
71
|
+
self.output_changed.notify_all()
|
|
69
72
|
|
|
70
73
|
async def request_permission(
|
|
71
74
|
self,
|
|
@@ -172,6 +175,25 @@ async def prompt(
|
|
|
172
175
|
except RequestError as error:
|
|
173
176
|
detail = error.data.get("details") if isinstance(error.data, dict) else None
|
|
174
177
|
raise RuntimeError(detail or str(error)) from error
|
|
178
|
+
|
|
179
|
+
# ACP 0.11 dispatches notifications in background tasks but resolves a request
|
|
180
|
+
# response directly in its receive loop. An agent that sends its final
|
|
181
|
+
# session/update immediately before session/prompt returns can therefore wake
|
|
182
|
+
# this coroutine before the update handler has run. Wait specifically for text:
|
|
183
|
+
# a completed tool update may also arrive first and must not hide a later reply.
|
|
184
|
+
def has_visible_reply() -> bool:
|
|
185
|
+
return bool(client.visible_reply.strip())
|
|
186
|
+
|
|
187
|
+
if not has_visible_reply():
|
|
188
|
+
async with client.output_changed:
|
|
189
|
+
try:
|
|
190
|
+
await asyncio.wait_for(
|
|
191
|
+
client.output_changed.wait_for(has_visible_reply),
|
|
192
|
+
timeout=LATE_UPDATE_GRACE_SECONDS,
|
|
193
|
+
)
|
|
194
|
+
except asyncio.TimeoutError: # noqa: UP041 - Python 3.10 compatibility
|
|
195
|
+
pass
|
|
196
|
+
|
|
175
197
|
tool_statuses = list(client.tool_calls.values())
|
|
176
198
|
completed_tool_turn = (
|
|
177
199
|
config.get("allow_empty_tool_reply", False)
|
|
@@ -179,7 +201,7 @@ async def prompt(
|
|
|
179
201
|
and bool(tool_statuses)
|
|
180
202
|
and all(status in ("completed", "failed") for status in tool_statuses)
|
|
181
203
|
)
|
|
182
|
-
if not
|
|
204
|
+
if not has_visible_reply() and not completed_tool_turn:
|
|
183
205
|
raise RuntimeError(
|
|
184
206
|
"ACP agent produced no visible reply "
|
|
185
207
|
f"(stop_reason={response.stop_reason}, tool_statuses={tool_statuses})"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: verifiers
|
|
3
|
-
Version: 0.2.2.
|
|
3
|
+
Version: 0.2.2.dev94
|
|
4
4
|
Summary: Verifiers: Environments for LLM Reinforcement Learning
|
|
5
5
|
Project-URL: Homepage, https://github.com/primeintellect-ai/verifiers
|
|
6
6
|
Project-URL: Documentation, https://github.com/primeintellect-ai/verifiers
|
|
@@ -184,7 +184,7 @@ verifiers/v1/taskset.py,sha256=fp2E0IEhL_Ybj9cegZwljfTmW27p_30zTWHFKw_kXE4,4374
|
|
|
184
184
|
verifiers/v1/trace.py,sha256=zhNlt_DLsQAydDnq6o_aQSKujqndNwG0qfgBwp-ez_g,20374
|
|
185
185
|
verifiers/v1/types.py,sha256=1PxamJspmoTc3OlFZAwH6o_2i_Tg9ZNvHxttIHWIxq8,8948
|
|
186
186
|
verifiers/v1/acp/__init__.py,sha256=RusAr7bFDHOjQc3mgqnADfhgen9bJlyLs8wQke2fUUs,11675
|
|
187
|
-
verifiers/v1/acp/runner.py,sha256=
|
|
187
|
+
verifiers/v1/acp/runner.py,sha256=0gvXv8BWA2Uih5b3mvMGu-9K2v_KOGJD5vUBMJSd8iU,15820
|
|
188
188
|
verifiers/v1/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
189
189
|
verifiers/v1/cli/debug.py,sha256=WGCiapH2CCwyPfESca5623-_csQv93PoglR8yX5-D3g,11488
|
|
190
190
|
verifiers/v1/cli/gepa.py,sha256=hLIbS_4jBx0vvy4PXoePR5riFXcNvzQCMixZ-g2OR_U,4026
|
|
@@ -339,8 +339,8 @@ verifiers/v1/utils/platform.py,sha256=56Ixmk1SER6q5LvzyYcA0hgzGpzhxKZL8Hiqp4c_XV
|
|
|
339
339
|
verifiers/v1/utils/retries.py,sha256=Y2ZgrAjn-qNkRKZP_RVNL_7EK0iaRcZeCa404lpGYi4,5417
|
|
340
340
|
verifiers/v1/utils/score.py,sha256=-R5Cog14r_tJ6Q_oOfGr5VPAm2CCUhofYZB6B9lm4wM,5787
|
|
341
341
|
verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
|
|
342
|
-
verifiers-0.2.2.
|
|
343
|
-
verifiers-0.2.2.
|
|
344
|
-
verifiers-0.2.2.
|
|
345
|
-
verifiers-0.2.2.
|
|
346
|
-
verifiers-0.2.2.
|
|
342
|
+
verifiers-0.2.2.dev94.dist-info/METADATA,sha256=Apenwhh-Aj7Nzm8EIVuzl1-UHCvpksZZQSOnGmCg4rE,4545
|
|
343
|
+
verifiers-0.2.2.dev94.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
|
|
344
|
+
verifiers-0.2.2.dev94.dist-info/entry_points.txt,sha256=v6v0QT9vVExnfn4br42MostI_o3f3ZbWYlTormz-U3g,515
|
|
345
|
+
verifiers-0.2.2.dev94.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
|
|
346
|
+
verifiers-0.2.2.dev94.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|