hpcagent-agent 1.0.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 (49) hide show
  1. hpcagent_agent/__init__.py +10 -0
  2. hpcagent_agent/coded.py +78 -0
  3. hpcagent_agent/driver/__init__.py +2 -0
  4. hpcagent_agent/driver/agent_driver.py +3909 -0
  5. hpcagent_agent/driver/effort.py +74 -0
  6. hpcagent_agent/driver/harnesses.py +659 -0
  7. hpcagent_agent/driver/net_relay.py +321 -0
  8. hpcagent_agent/driver/promote_unsubmitted.py +570 -0
  9. hpcagent_agent/driver/seal_worker.py +474 -0
  10. hpcagent_agent/driver/stream_idle_timeout.py +73 -0
  11. hpcagent_agent/driver/token_cost.py +1219 -0
  12. hpcagent_agent/env_aliases.py +78 -0
  13. hpcagent_agent/harness/__init__.py +2 -0
  14. hpcagent_agent/harness/bash-norc +11 -0
  15. hpcagent_agent/harness/miniswe.yaml +119 -0
  16. hpcagent_agent/harness/openhands_stdio.py +54 -0
  17. hpcagent_agent/harness/run_anthropic.py +306 -0
  18. hpcagent_agent/harness/run_miniswe.py +140 -0
  19. hpcagent_agent/harness/run_openai.py +279 -0
  20. hpcagent_agent/harness/run_openhands.py +267 -0
  21. hpcagent_agent/harness/runner_common.py +632 -0
  22. hpcagent_agent/harness/subagents.py +122 -0
  23. hpcagent_agent/knowledge.py +525 -0
  24. hpcagent_agent/network_policy.py +157 -0
  25. hpcagent_agent/plugins.py +698 -0
  26. hpcagent_agent/prompt_blocks.py +244 -0
  27. hpcagent_agent/submission_mode.py +92 -0
  28. hpcagent_agent/templates/submission-blind.md +45 -0
  29. hpcagent_agent/templates/submission-multi.md +36 -0
  30. hpcagent_agent/templates/submission-single.md +36 -0
  31. hpcagent_agent/tools/__init__.py +2 -0
  32. hpcagent_agent/tools/canonical_parallel_form.py +207 -0
  33. hpcagent_agent/tools/hpcagent_bench_tool.py +96 -0
  34. hpcagent_agent/tools/http_json.py +741 -0
  35. hpcagent_agent/tools/knowledge_read.py +63 -0
  36. hpcagent_agent/tools/knowledge_search.py +77 -0
  37. hpcagent_agent/tools/mcp_server.py +247 -0
  38. hpcagent_agent/tools/next_phase.py +36 -0
  39. hpcagent_agent/tools/profile_tool.py +231 -0
  40. hpcagent_agent/tools/registry.py +334 -0
  41. hpcagent_agent/tools/requests_check.py +47 -0
  42. hpcagent_agent/tools/requests_schema.json +564 -0
  43. hpcagent_agent/tools/score.py +72 -0
  44. hpcagent_agent/tools/search.py +54 -0
  45. hpcagent_agent/tools/submit.py +164 -0
  46. hpcagent_agent/tools/syntax_check.py +178 -0
  47. hpcagent_agent-1.0.0.dist-info/METADATA +120 -0
  48. hpcagent_agent-1.0.0.dist-info/RECORD +49 -0
  49. hpcagent_agent-1.0.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,10 @@
1
+ # Copyright 2026 ETH Zurich and the HPCAgent-Bench authors.
2
+ # SPDX-License-Identifier: GPL-3.0-or-later
3
+ """The agent-side runtime: everything that runs inside the agent container, and nothing from hpcagent_bench.
4
+ Dependencies are the MCP SDK and pydantic; the files the driver reads or writes are bare :mod:`json`."""
5
+
6
+ from hpcagent_agent import env_aliases
7
+
8
+ #: The deprecated short names of the configuration knobs reach their readers under the current names: translated
9
+ #: once, when the package is imported, before any of its modules reads one (env_aliases.translate).
10
+ env_aliases.translate()
@@ -0,0 +1,78 @@
1
+ # Copyright 2026 ETH Zurich and the HPCAgent-Bench authors.
2
+ # SPDX-License-Identifier: GPL-3.0-or-later
3
+ """Closed categories as ``enum.auto()`` enums, spelled as text only at a boundary via :attr:`Coded.text` /
4
+ :meth:`Coded.parse` (a member is never compared to a string). A spelling is the lower-case name joined by
5
+ ``SEPARATOR`` unless ``SPELLINGS`` overrides it; spellings of one class are distinct."""
6
+
7
+ import enum
8
+ import functools
9
+ from collections.abc import Mapping
10
+ from typing import Any, cast
11
+
12
+ from pydantic import GetCoreSchemaHandler, GetJsonSchemaHandler
13
+ from pydantic.json_schema import JsonSchemaValue
14
+ from pydantic_core import core_schema
15
+
16
+ __all__ = ["SEPARATOR", "Coded", "spellings"]
17
+
18
+ #: What joins the words of a member's name in its spelling when the class sets no ``SEPARATOR``.
19
+ SEPARATOR = "_"
20
+
21
+
22
+ @functools.lru_cache(maxsize=None, typed=True)
23
+ def spellings(cls: type["Coded"]) -> Mapping[str, "Coded"]:
24
+ """``cls``'s members by spelling; raises when two members share one."""
25
+ by_text: dict[str, Coded] = {}
26
+ for member in cls:
27
+ text = member.text
28
+ if text in by_text:
29
+ raise TypeError(f"{cls.__name__}.{member.name} and .{by_text[text].name} are both spelled {text!r}")
30
+ by_text[text] = member
31
+ return by_text
32
+
33
+
34
+ class Coded(enum.Enum):
35
+ """Base of a closed category; a subclass may set ``SEPARATOR`` and ``SPELLINGS``, both ``enum.nonmember``."""
36
+
37
+ @property
38
+ def text(self) -> str:
39
+ """This member's boundary spelling."""
40
+ own = type(self).__dict__
41
+ separator = cast("str", own.get("SEPARATOR", SEPARATOR))
42
+ overrides = cast("Mapping[str, str]", own.get("SPELLINGS", {}))
43
+ return overrides.get(self.name) or self.name.lower().replace("_", separator)
44
+
45
+ @classmethod
46
+ def parse[CodedT: Coded](cls: type[CodedT], text: str) -> CodedT:
47
+ """The member spelled ``text``; ValueError naming the spellings when none is."""
48
+ member = spellings(cls).get(text)
49
+ if member is None:
50
+ raise ValueError(f"{text!r} is not a {cls.__name__}; one of {', '.join(spellings(cls))}")
51
+ return cast("CodedT", member) # spellings(cls) holds cls's members only
52
+
53
+ @classmethod
54
+ def texts(cls) -> tuple[str, ...]:
55
+ """Every spelling, in definition order."""
56
+ return tuple(spellings(cls))
57
+
58
+ @classmethod
59
+ def validate[CodedT: Coded](cls: type[CodedT], value: object) -> CodedT:
60
+ """A member, or the member a spelling names: what a boundary model accepts."""
61
+ if isinstance(value, cls):
62
+ return value
63
+ if isinstance(value, str):
64
+ return cls.parse(value)
65
+ raise ValueError(f"{value!r} is not a {cls.__name__} spelling")
66
+
67
+ @classmethod
68
+ def __get_pydantic_core_schema__(cls, source: type[Any], handler: GetCoreSchemaHandler) -> core_schema.CoreSchema:
69
+ return core_schema.no_info_plain_validator_function(
70
+ cls.validate,
71
+ serialization=core_schema.plain_serializer_function_ser_schema(lambda member: member.text),
72
+ )
73
+
74
+ @classmethod
75
+ def __get_pydantic_json_schema__(
76
+ cls, schema: core_schema.CoreSchema, handler: GetJsonSchemaHandler
77
+ ) -> JsonSchemaValue:
78
+ return {"type": "string", "enum": list(cls.texts())}
@@ -0,0 +1,2 @@
1
+ # Copyright 2026 ETH Zurich and the HPCAgent-Bench authors.
2
+ # SPDX-License-Identifier: GPL-3.0-or-later