verifiers 0.3.2.dev61__py3-none-any.whl → 0.3.2.dev63__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.
@@ -3,7 +3,6 @@
3
3
  import hashlib
4
4
  import json
5
5
  import logging
6
- import shlex
7
6
  from typing import Literal
8
7
 
9
8
  from verifiers.v1.acp import ACPConfig, ACPHarness, ACPTurn
@@ -256,25 +255,17 @@ class PrimeAgentHarness(ACPHarness[PrimeAgentHarnessConfig]):
256
255
  if system_prompt:
257
256
  args += ["--append-system-prompt", system_prompt]
258
257
 
259
- wrapper = f"{root}/prime-agent"
260
- await runtime.write(
261
- wrapper,
262
- (
263
- "#!/bin/sh\n"
264
- "set -eu\n"
265
- f'export PATH="{NODE_BIN_DIR}:$HOME/.local/bin:$PATH"\n'
266
- f'exec {shlex.join(args)} "$@"\n'
267
- ).encode(),
268
- )
269
- executable = await runtime.run(["chmod", "700", wrapper], {})
270
- if executable.exit_code != 0:
271
- raise RuntimeError(
272
- f"prime-agent wrapper chmod failed: {executable.stderr.strip()[-500:]}"
273
- )
274
-
275
258
  return ACPConfig(
276
259
  env=self._env(trace, secret),
277
- command=[wrapper],
260
+ # Expand the sandbox's PATH while keeping every agent argument literal.
261
+ command=[
262
+ "/bin/sh",
263
+ "-eu",
264
+ "-c",
265
+ f'export PATH="{NODE_BIN_DIR}:$HOME/.local/bin:$PATH"; exec "$@"',
266
+ "prime-agent",
267
+ *args,
268
+ ],
278
269
  prompt=prompt,
279
270
  )
280
271
 
@@ -91,12 +91,33 @@ async def collect(
91
91
  raise RuntimeError(f"artifact {artifact.source!r} declared more than once")
92
92
  seen.add(artifact.source)
93
93
 
94
+ # Batch roots to save remote round trips. Leave room below the shell argument
95
+ # limit for the command itself and further quoting by runtime transports.
96
+ batches: list[list[str]] = [[]]
97
+ batch_bytes = 0
98
+ for artifact in entries:
99
+ source_bytes = len(shlex.quote(artifact.source).encode()) + 1
100
+ if batches[-1] and batch_bytes + source_bytes > 8 * 1024:
101
+ batches.append([])
102
+ batch_bytes = 0
103
+ batches[-1].append(artifact.source)
104
+ batch_bytes += source_bytes
105
+
106
+ existence: list[str] = []
107
+ for sources in batches:
108
+ output = await _run(
109
+ runtime,
110
+ f"for source in {shlex.join(sources)}; do "
111
+ 'if test -e "$source" || test -L "$source"; then echo 1; else echo 0; fi; '
112
+ "done",
113
+ "check artifact roots",
114
+ )
115
+ existence.extend(output.splitlines())
94
116
  collected: dict[str, bytes | None] = {}
95
117
  budget = MAX_ARTIFACT_BYTES
96
- for artifact in entries:
118
+ for artifact, exists in zip(entries, existence, strict=True):
97
119
  source = artifact.source
98
- exists = f"test -e {shlex.quote(source)} || test -L {shlex.quote(source)}"
99
- if (await runtime.run(["sh", "-c", exists], {})).exit_code != 0:
120
+ if exists != "1":
100
121
  if not artifact.required:
101
122
  collected[source] = None
102
123
  continue
@@ -205,8 +226,9 @@ def _validate_restore(root: str, archive: bytes | None) -> None:
205
226
  raise RuntimeError(f"unreadable artifact archive for {root!r}: {exc}") from exc
206
227
 
207
228
 
208
- async def _run(runtime: Runtime, command: str, action: str) -> None:
229
+ async def _run(runtime: Runtime, command: str, action: str) -> str:
209
230
  result = await runtime.run(["sh", "-c", command], {})
210
231
  if result.exit_code:
211
232
  detail = (result.stderr or result.stdout).strip()[-500:]
212
233
  raise RuntimeError(f"failed to {action}: {detail}")
234
+ return result.stdout
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: verifiers
3
- Version: 0.3.2.dev61
3
+ Version: 0.3.2.dev63
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
@@ -110,7 +110,7 @@ verifiers/v1/harnesses/pi/harness.py,sha256=11V9d6_npjE9vEEgIG7y80kfaX1Ilfi3lbYs
110
110
  verifiers/v1/harnesses/pool/__init__.py,sha256=HTYsNiWGdiNEsSHj4xhPmshJSNb7SHjQ7d4yZQ4p3HM,127
111
111
  verifiers/v1/harnesses/pool/harness.py,sha256=TsELYhW4mMOt_laiDN6nAQJxFL3iCcKvckQWYve2XiE,3571
112
112
  verifiers/v1/harnesses/prime_agent/__init__.py,sha256=xfPC4RrlnyYWaf38tPAOZq4YL6M55lMpj5BoRLmaK8I,171
113
- verifiers/v1/harnesses/prime_agent/harness.py,sha256=CgrKBXoelwRiSH9fzsNnz4oykz_iDJ3p5WVGBOB9AeU,10906
113
+ verifiers/v1/harnesses/prime_agent/harness.py,sha256=cMvkNdqEutzCoX3lrmCQ5dAi_HSDV3Vhw6K1N-LiBtA,10630
114
114
  verifiers/v1/harnesses/rlm/__init__.py,sha256=hwx51xTdEWzzYgMj-p4ETNcptoub3IPMDbEdJ4uB8Ns,122
115
115
  verifiers/v1/harnesses/rlm/harness.py,sha256=A-3lUD4t6kND5Hq01wedTbAcCWAlQvjqn-QQKBIYbi4,10671
116
116
  verifiers/v1/harnesses/terminus_2/__init__.py,sha256=l1pwfg1HyVDEqT9efdnFWcXqaZwtKwe7TrplkyxZSA0,166
@@ -172,7 +172,7 @@ verifiers/v1/tasksets/textarena/__init__.py,sha256=Os2OlBY_pSH0B1DP32RitumgSLpq2
172
172
  verifiers/v1/tasksets/textarena/taskset.py,sha256=9fa_unlFiFZyuN4I02rW3x4qyRnFWXqwTUZTloQefu0,4433
173
173
  verifiers/v1/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
174
174
  verifiers/v1/utils/aio.py,sha256=0yNFOqB2oO6Qktc6NI_ZSAGuo1aHsIK_wuT1BtmoZ3I,1532
175
- verifiers/v1/utils/artifacts.py,sha256=GowZubXGk6NhVgaAUKCVXYoBh_3L1Aw0LAHe6tNwl8g,8447
175
+ verifiers/v1/utils/artifacts.py,sha256=PFrSkwAyvzHyT6JjlFeGOPIXDmS-uRajaN3am4HZ0TI,9263
176
176
  verifiers/v1/utils/compile.py,sha256=5pxy31wx2Q-3pQjOO5B9SH6OT-wwb8r4F1LAl6HMeQA,5835
177
177
  verifiers/v1/utils/decorators.py,sha256=vhoN6YoKb15-Fkqmc9RaNlUIbt9WRvNK4zAn2bAxfS4,5367
178
178
  verifiers/v1/utils/format.py,sha256=NfQo9M5KMzWCZpQaet5YtsJx56vCKAZPfbjZZJLJhhM,2187
@@ -189,8 +189,8 @@ verifiers/v1/utils/prime.py,sha256=UTYRjp9cbjNb6CVmBHda-1wWZAIIfxNOmTyNuT7_wL4,9
189
189
  verifiers/v1/utils/retries.py,sha256=Y2ZgrAjn-qNkRKZP_RVNL_7EK0iaRcZeCa404lpGYi4,5417
190
190
  verifiers/v1/utils/score.py,sha256=493yJVMw8teCu9JxapxMFPFzI0hNUqdo0Y2nGW4kckk,6200
191
191
  verifiers/v1/utils/version.py,sha256=-obEo_-l9-D8FLef4hYxncOe-uJpxrM1g2Hig_37Sgs,1607
192
- verifiers-0.3.2.dev61.dist-info/METADATA,sha256=7o5tiEoE-ol4J9KtYpx1306yqLvQ6cEKtF0inhzekjQ,4204
193
- verifiers-0.3.2.dev61.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
194
- verifiers-0.3.2.dev61.dist-info/entry_points.txt,sha256=uqQje0TMsr7k6nXlWxlPs13Si0evb3pVCEDF6c-YL80,241
195
- verifiers-0.3.2.dev61.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
196
- verifiers-0.3.2.dev61.dist-info/RECORD,,
192
+ verifiers-0.3.2.dev63.dist-info/METADATA,sha256=gUF-jEoP0VpPXkADaNMPJUezstcC2q9qL06f985QPoM,4204
193
+ verifiers-0.3.2.dev63.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
194
+ verifiers-0.3.2.dev63.dist-info/entry_points.txt,sha256=uqQje0TMsr7k6nXlWxlPs13Si0evb3pVCEDF6c-YL80,241
195
+ verifiers-0.3.2.dev63.dist-info/licenses/LICENSE,sha256=v0RrUsdV3IDoZhrRce297IXS3xMHNJ-_LdLpFAUWb9k,1072
196
+ verifiers-0.3.2.dev63.dist-info/RECORD,,