peakstone 0.1.0__tar.gz

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 (90) hide show
  1. peakstone-0.1.0/LICENSE +201 -0
  2. peakstone-0.1.0/NOTICE +15 -0
  3. peakstone-0.1.0/PKG-INFO +276 -0
  4. peakstone-0.1.0/README.md +246 -0
  5. peakstone-0.1.0/peakstone/__init__.py +5 -0
  6. peakstone-0.1.0/peakstone/dashboard/__init__.py +2 -0
  7. peakstone-0.1.0/peakstone/dashboard/__main__.py +4 -0
  8. peakstone-0.1.0/peakstone/dashboard/app.py +2495 -0
  9. peakstone-0.1.0/peakstone/dashboard/challenges.py +122 -0
  10. peakstone-0.1.0/peakstone/dashboard/client.py +206 -0
  11. peakstone-0.1.0/peakstone/dashboard/hardware.py +353 -0
  12. peakstone-0.1.0/peakstone/dashboard/history.py +27 -0
  13. peakstone-0.1.0/peakstone/dashboard/login.py +186 -0
  14. peakstone-0.1.0/peakstone/dashboard/models.py +306 -0
  15. peakstone-0.1.0/peakstone/dashboard/preflight.py +93 -0
  16. peakstone-0.1.0/peakstone/dashboard/reproduce.py +134 -0
  17. peakstone-0.1.0/peakstone/dashboard/update.py +54 -0
  18. peakstone-0.1.0/peakstone/engine/__init__.py +1 -0
  19. peakstone-0.1.0/peakstone/engine/adherence.py +47 -0
  20. peakstone-0.1.0/peakstone/engine/agentic.py +178 -0
  21. peakstone-0.1.0/peakstone/engine/apply_judge.py +80 -0
  22. peakstone-0.1.0/peakstone/engine/bandwidth.py +46 -0
  23. peakstone-0.1.0/peakstone/engine/bundle.py +507 -0
  24. peakstone-0.1.0/peakstone/engine/capabilities.py +205 -0
  25. peakstone-0.1.0/peakstone/engine/challenges.py +151 -0
  26. peakstone-0.1.0/peakstone/engine/config.toml +66 -0
  27. peakstone-0.1.0/peakstone/engine/contamination.py +98 -0
  28. peakstone-0.1.0/peakstone/engine/env/__init__.py +28 -0
  29. peakstone-0.1.0/peakstone/engine/env/agent.py +160 -0
  30. peakstone-0.1.0/peakstone/engine/env/base.py +132 -0
  31. peakstone-0.1.0/peakstone/engine/env/capabilities.py +155 -0
  32. peakstone-0.1.0/peakstone/engine/env/docker.py +268 -0
  33. peakstone-0.1.0/peakstone/engine/env/fc_sandbox.py +154 -0
  34. peakstone-0.1.0/peakstone/engine/env/firecracker.py +387 -0
  35. peakstone-0.1.0/peakstone/engine/env/harness.py +146 -0
  36. peakstone-0.1.0/peakstone/engine/env/local.py +194 -0
  37. peakstone-0.1.0/peakstone/engine/env/netshape.py +41 -0
  38. peakstone-0.1.0/peakstone/engine/env/planner.py +72 -0
  39. peakstone-0.1.0/peakstone/engine/env/spec.py +106 -0
  40. peakstone-0.1.0/peakstone/engine/estimate.py +119 -0
  41. peakstone-0.1.0/peakstone/engine/export_solutions.py +69 -0
  42. peakstone-0.1.0/peakstone/engine/extract.py +73 -0
  43. peakstone-0.1.0/peakstone/engine/global_rules.py +81 -0
  44. peakstone-0.1.0/peakstone/engine/honesty.py +40 -0
  45. peakstone-0.1.0/peakstone/engine/importers/__init__.py +8 -0
  46. peakstone-0.1.0/peakstone/engine/importers/aime.py +165 -0
  47. peakstone-0.1.0/peakstone/engine/importers/bigcodebench.py +251 -0
  48. peakstone-0.1.0/peakstone/engine/importers/codeforces.py +244 -0
  49. peakstone-0.1.0/peakstone/engine/importers/humaneval.py +235 -0
  50. peakstone-0.1.0/peakstone/engine/importers/livecodebench.py +288 -0
  51. peakstone-0.1.0/peakstone/engine/importers/swebench.py +166 -0
  52. peakstone-0.1.0/peakstone/engine/judge.py +83 -0
  53. peakstone-0.1.0/peakstone/engine/keys.py +60 -0
  54. peakstone-0.1.0/peakstone/engine/levels.py +95 -0
  55. peakstone-0.1.0/peakstone/engine/levels.toml +110 -0
  56. peakstone-0.1.0/peakstone/engine/matheval.py +45 -0
  57. peakstone-0.1.0/peakstone/engine/merge.py +52 -0
  58. peakstone-0.1.0/peakstone/engine/metrics.py +27 -0
  59. peakstone-0.1.0/peakstone/engine/paths.py +96 -0
  60. peakstone-0.1.0/peakstone/engine/propose.py +156 -0
  61. peakstone-0.1.0/peakstone/engine/provider.py +287 -0
  62. peakstone-0.1.0/peakstone/engine/recommend.py +139 -0
  63. peakstone-0.1.0/peakstone/engine/report.py +427 -0
  64. peakstone-0.1.0/peakstone/engine/report_html.py +389 -0
  65. peakstone-0.1.0/peakstone/engine/runner.py +1508 -0
  66. peakstone-0.1.0/peakstone/engine/sandbox.py +499 -0
  67. peakstone-0.1.0/peakstone/engine/schema/README.md +41 -0
  68. peakstone-0.1.0/peakstone/engine/schema/result-bundle.schema.json +223 -0
  69. peakstone-0.1.0/peakstone/engine/schema/taxonomy.json +31 -0
  70. peakstone-0.1.0/peakstone/engine/scoring.py +41 -0
  71. peakstone-0.1.0/peakstone/engine/serving.py +308 -0
  72. peakstone-0.1.0/peakstone/engine/swebench.py +464 -0
  73. peakstone-0.1.0/peakstone/engine/versions.py +34 -0
  74. peakstone-0.1.0/peakstone/engine/vram.py +216 -0
  75. peakstone-0.1.0/peakstone/gateway/__init__.py +17 -0
  76. peakstone-0.1.0/peakstone/gateway/__main__.py +103 -0
  77. peakstone-0.1.0/peakstone/gateway/app.py +308 -0
  78. peakstone-0.1.0/peakstone/gateway/auth.py +76 -0
  79. peakstone-0.1.0/peakstone/gateway/jobs.py +398 -0
  80. peakstone-0.1.0/peakstone/gateway/launch.py +110 -0
  81. peakstone-0.1.0/peakstone/gateway/swap.py +233 -0
  82. peakstone-0.1.0/peakstone/gateway/webchat/index.html +767 -0
  83. peakstone-0.1.0/peakstone.egg-info/PKG-INFO +276 -0
  84. peakstone-0.1.0/peakstone.egg-info/SOURCES.txt +88 -0
  85. peakstone-0.1.0/peakstone.egg-info/dependency_links.txt +1 -0
  86. peakstone-0.1.0/peakstone.egg-info/entry_points.txt +3 -0
  87. peakstone-0.1.0/peakstone.egg-info/requires.txt +13 -0
  88. peakstone-0.1.0/peakstone.egg-info/top_level.txt +1 -0
  89. peakstone-0.1.0/pyproject.toml +59 -0
  90. peakstone-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
peakstone-0.1.0/NOTICE ADDED
@@ -0,0 +1,15 @@
1
+ Peakstone
2
+ Copyright 2026 The Peakstone Authors
3
+
4
+ This product includes software developed by the Peakstone project and its contributors,
5
+ licensed under the Apache License, Version 2.0 (see LICENSE).
6
+
7
+ Peakstone — a public, reproducible benchmark platform that tracks the evolution of open-model
8
+ capabilities, from simple verifiable assignments to complex iterated projects.
9
+ https://peakstone.ai
10
+
11
+ Submitted benchmark result data is published under CC-BY-4.0 (see DATA-LICENSE.md), separate from
12
+ the Apache-2.0 software license above.
13
+
14
+ Portions of this repository originated as a local coding-LLM benchmarking harness; see the git
15
+ history for provenance.
@@ -0,0 +1,276 @@
1
+ Metadata-Version: 2.4
2
+ Name: peakstone
3
+ Version: 0.1.0
4
+ Summary: A public, reproducible benchmark platform tracking the capability frontier of open models (coding, agentic, planning).
5
+ Author: The Peakstone Authors
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://peakstone.ai
8
+ Project-URL: Source, https://github.com/peakstone-ai/peakstone
9
+ Keywords: llm,benchmark,evaluation,reproducibility,coding,agents,gpu
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Requires-Python: >=3.11
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ License-File: NOTICE
18
+ Requires-Dist: jsonschema>=4
19
+ Requires-Dist: cryptography>=41
20
+ Provides-Extra: dashboard
21
+ Requires-Dist: textual>=0.60; extra == "dashboard"
22
+ Requires-Dist: huggingface_hub>=0.20; extra == "dashboard"
23
+ Requires-Dist: fastapi>=0.110; extra == "dashboard"
24
+ Requires-Dist: uvicorn>=0.27; extra == "dashboard"
25
+ Requires-Dist: httpx>=0.27; extra == "dashboard"
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=8; extra == "dev"
28
+ Requires-Dist: httpx>=0.27; extra == "dev"
29
+ Dynamic: license-file
30
+
31
+ # Peakstone
32
+
33
+ **A public, reproducible benchmark platform for the capabilities of open models** — from solving
34
+ simple verifiable assignments to (eventually) iterating their way through complex, multi-machine
35
+ projects. Community-run, community-authored, independently reproducible.
36
+
37
+ > *Tsunami "high-water-mark" stones record how far the wave reached. Peakstone records how far the
38
+ > open-model capability frontier has reached — permanent, reproducible markers ("set in stone") of a
39
+ > moving peak.*
40
+
41
+ See **[PLAN.md](./PLAN.md)** for the full vision, architecture, and roadmap.
42
+
43
+ ## Status
44
+
45
+ Early. **P1 (reproducible coding leaderboard)** is in progress. What exists today:
46
+
47
+ - **`engine/`** — the test harness: serves a model over an OpenAI-compatible API, runs a suite of
48
+ **verifiable** challenges (deterministic tests), scores them, and (soon) emits a signed
49
+ **result bundle**. Also supports LLM-judge grading, self-repair (`--retries`), a global-rules
50
+ output contract (`--agents-md`), tool-calling/agentic/injection modes, and a planner eval. Ships
51
+ the **result-bundle JSON Schema** (the reproducibility contract) + capability taxonomy as packaged
52
+ data in `engine/schema/`, so a bare `pip install` can produce and validate bundles.
53
+ - **`challenges/`** — the challenge corpus (`spec.md` + `tests/` + `reference/` per challenge). Part
54
+ of the repo workspace, not the PyPI wheel; running the suite needs a checkout (set `PEAKSTONE_REPO`
55
+ if the package and corpus live apart).
56
+ - **`serve/`** — local model-serving helpers (run your own GGUF models to test).
57
+ - **`gateway/`** — `peakstone serve`: a standing, **llama-swap-style OpenAI-compatible gateway** on one
58
+ port. It picks (and hot-swaps) the backend `llama-server` from the `model` field of each request, so
59
+ it doubles as a local OpenAI endpoint for everyday use — not just benchmarking. It also owns the
60
+ **benchmark job queue** (sqlite-persisted), so the TUI/CLI are thin clients: runs survive quitting
61
+ the dashboard.
62
+
63
+ - **`api/`** — the submission/leaderboard API (FastAPI + Postgres) that runs on peakstone.ai. Validates
64
+ signed result bundles, serves faceted leaderboards, and moderates the open challenge corpus.
65
+ Deployed from this repo via Docker (see **Running the server** below); not part of the PyPI client.
66
+ - **`web/`** — the Next.js leaderboard frontend.
67
+
68
+ ## Quickstart — run the engine against a local model
69
+
70
+ ```bash
71
+ # 0. Sanity-check the suite itself (no model needed): reference solutions must all pass
72
+ python -m peakstone.engine.runner --reference --models reference
73
+
74
+ # 1. Serve a model over an OpenAI-compatible API (any engine works; helper for llama.cpp GGUFs):
75
+ ./serve/serve.sh <model-name> # see serve/models.toml for the local registry
76
+ # …or run the model gateway, which hot-swaps models per request (see "Model gateway" below):
77
+ peakstone serve # then add `--gateway http://localhost:12434` to step 2
78
+
79
+ # 2. Evaluate it
80
+ export PATH="$HOME/opt/node/bin:$PATH" # JS/TS test runners need this Node
81
+ python -m peakstone.engine.runner --models <model-name>
82
+ python -m peakstone.engine.runner --models <model-name> --retries 2 --agents-md # self-repair + output contract
83
+ ```
84
+
85
+ Scoring: `final = pass_rate` for `tests` challenges; `0.7*pass_rate + 0.3*judge` for `both`.
86
+ Each run records full per-challenge transcripts and the model/environment metadata needed to
87
+ reproduce it. See `peakstone/engine/runner.py --help` for filters (`--lang`, `--type`, `--difficulty`,
88
+ `--ids`) and modes (judge, retries, agents-md, planner eval).
89
+
90
+ ### Offline test sandbox (Linux)
91
+
92
+ Each test runs **offline**, in a throwaway network namespace (loopback only). This keeps a solution
93
+ that does real network I/O — e.g. a BigCodeBench task that `wget`/HTTP/FTPs past the test's mocks —
94
+ from hanging to the per-challenge timeout: the call fails fast instead.
95
+
96
+ It uses unprivileged user namespaces, which **Ubuntu's AppArmor disables by default**. Enable them:
97
+
98
+ ```bash
99
+ sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 # this boot
100
+ echo 'kernel.apparmor_restrict_unprivileged_userns=0' | sudo tee /etc/sysctl.d/99-peakstone.conf # persist
101
+ # older kernels: kernel.unprivileged_userns_clone=1
102
+ ```
103
+
104
+ Without it the harness still works — it just falls back to a plain subprocess (no network isolation),
105
+ so a runaway network call can burn the full challenge timeout. Verify it's active:
106
+ `unshare -rn -- true` should exit 0. (No-op on macOS, which mocks-or-Docker-isolates instead.)
107
+
108
+ ### Running on macOS (Apple Silicon)
109
+
110
+ The harness, dashboard, and serving all run on macOS. The engine auto-detects the platform —
111
+ hardware stats come from `sysctl`/`ioreg`/`vm_stat` (the dashboard shows the unified-memory GPU
112
+ live), and it uses GNU `time` only when present. One-time toolchain setup:
113
+
114
+ ```bash
115
+ # Work in an isolated venv — don't install into system / conda-base Python:
116
+ python -m venv ~/.peakstone/venv && source ~/.peakstone/venv/bin/activate
117
+
118
+ # Python: engine deps + the optional library-challenge references + the dashboard TUI
119
+ pip install jsonschema cryptography pytest numpy pandas pydantic networkx more-itertools \
120
+ python-dateutil sortedcontainers "textual>=0.60" "huggingface_hub>=0.20"
121
+
122
+ # JS/TS challenges: install the jsenv libs, plus tsx + typescript on PATH (the TS runner needs them)
123
+ ( cd peakstone/engine/jsenv && npm install )
124
+ npm install -g tsx typescript
125
+
126
+ # Serving (optional — only to run a model): a Metal build of llama.cpp
127
+ brew install llama.cpp # serve.sh finds `llama-server` on PATH automatically
128
+ ```
129
+
130
+ On Apple Silicon, memory is **unified** (weights + KV share system RAM), so pick a model that fits
131
+ your RAM with headroom — on a 16 GB Mac, `vibethinker-3b` (3.3 GB) or `phi-4-mini` (~9 GB) rather
132
+ than the 22 GB roster tuned for a 24 GB NVIDIA card.
133
+
134
+ For the multi-machine agentic env challenges, the **local** provider works everywhere, and the
135
+ **docker** provider gives full isolation *plus network shaping* (`tc` latency / `iptables` link
136
+ partitions) on macOS too — those run inside Docker Desktop's Linux VM, so start Docker Desktop and
137
+ use `--env-provider docker`. Only **firecracker** is genuinely Linux-only (it needs `/dev/kvm`,
138
+ which Apple Silicon does not provide).
139
+
140
+ ## Dashboard (TUI)
141
+
142
+ A Textual terminal UI shows your **local GPU/CPU/RAM** live, next to the leaderboard **filtered to
143
+ what fits your hardware** — so you can see how models that actually run on your machine compare:
144
+
145
+ Install into an **isolated environment** so Peakstone's dependencies never touch your system or
146
+ conda-base Python (they'd otherwise clobber whatever `requests`/`urllib3`/etc. you already have):
147
+
148
+ ```bash
149
+ pipx install "peakstone[dashboard]" # recommended — pipx gives it its own venv + a PATH shim
150
+ # …or a plain venv:
151
+ python -m venv ~/.peakstone/venv && ~/.peakstone/venv/bin/pip install "peakstone[dashboard]"
152
+
153
+ peakstone --api https://peakstone.ai/api # public API is under /api; default http://localhost:8000
154
+ peakstone login --api https://peakstone.ai/api # link your signing key to GitHub (one browser round-trip)
155
+ ```
156
+
157
+ `peakstone login` binds your local ed25519 signing key to a GitHub handle: it opens the OAuth consent
158
+ page, catches the redirect on a loopback callback, and proves key ownership by signing a server nonce —
159
+ the private key never leaves your machine. Optional, but it attributes your runs and lets your
160
+ reproductions count toward the community-verified (ranked) tier.
161
+
162
+ The published package is the **client**: the engine and the dashboard, nothing server-side. The
163
+ submission API (`api/`) is the *server* and is deployed from this repo, never installed from PyPI —
164
+ see **Running the server** below.
165
+
166
+ See **[peakstone/dashboard/README.md](./peakstone/dashboard/README.md)**.
167
+
168
+ ## Model gateway (`peakstone serve`)
169
+
170
+ A standing, **llama-swap-style** OpenAI-compatible gateway on a single port (default `:12434`). The
171
+ `model` field of each request selects the backend — the gateway loads/swaps the right `llama-server`
172
+ on demand — so it's a drop-in local OpenAI endpoint for editors, scripts, and agents, *and* the
173
+ serving layer the benchmark harness runs on.
174
+
175
+ ```bash
176
+ peakstone serve # foreground; or `peakstone serve --detach`
177
+ # point any OpenAI client at it:
178
+ curl http://localhost:12434/v1/chat/completions \
179
+ -d '{"model": "<model-name>", "messages": [{"role":"user","content":"hi"}]}'
180
+ ```
181
+
182
+ **Browser chat UI.** The gateway also serves a single-file chat app at **`http://localhost:12434/chat`**
183
+ (root `/` redirects there). It's a multi-conversation UI with editable system prompts, image input,
184
+ streaming + reasoning, and a **model selector** populated live from `GET /v1/models` — picking a model
185
+ just puts its name in the request body, so the gateway loads/swaps it into VRAM on demand. Because it's
186
+ served from the gateway origin it shares `/v1` (no CORS) and is reachable on the LAN at the gateway's
187
+ host:port. On a trusted network, `peakstone serve --host 0.0.0.0 --open` drops auth so any device can
188
+ use it tokenlessly; otherwise paste the token into the chat's ⚙ Settings (see auth below).
189
+
190
+ The gateway also owns the **benchmark job queue** (persisted to `results/jobs.db`), so the TUI/CLI are
191
+ thin clients over it — **runs keep going after you quit the dashboard**, and reconnecting shows their
192
+ state. Drive it headless with the `jobs` CLI:
193
+
194
+ ```bash
195
+ peakstone jobs add <model-name> --level standard # queue a run on the daemon
196
+ peakstone jobs list # queued / running / done
197
+ peakstone jobs logs <id> # stream a job's log
198
+ peakstone jobs cancel <id>
199
+ ```
200
+
201
+ `peakstone` (the TUI) auto-spawns the gateway detached on startup; disable with `--no-gateway` or
202
+ `PEAKSTONE_NO_GATEWAY=1`. Config lives under `[gateway]` in `peakstone/engine/config.toml`
203
+ (host/port/`idle_timeout_s` — unload the model and free VRAM after a quiet spell; `0` = never).
204
+
205
+ **Use it from another machine (auth).** Loopback requests (`127.0.0.1`) need no token, so the TUI, the
206
+ CLI, and anything on the box just work. To reach it over a LAN — e.g. an editor on your laptop driving
207
+ the GPU box — bind it publicly and present the token; non-loopback requests without a valid one get
208
+ `401`:
209
+
210
+ ```bash
211
+ peakstone serve --host 0.0.0.0 # prints the token; also saved to ~/.peakstone/gateway_token (0600)
212
+ # from the laptop — OpenAI base URL http://<gpu-box>:12434/v1, API key = that token:
213
+ curl http://<gpu-box>:12434/v1/chat/completions \
214
+ -H "Authorization: Bearer $TOKEN" \
215
+ -d '{"model": "<model-name>", "messages": [{"role":"user","content":"hi"}]}'
216
+ ```
217
+
218
+ The token is generated on first run; override it with `PEAKSTONE_GATEWAY_TOKEN`. On a trusted LAN you
219
+ can skip tokens entirely with `peakstone serve --host 0.0.0.0 --open` (auth disabled — any reachable
220
+ device can drive the GPU, so use it only at home).
221
+
222
+ **Sharing one GPU.** Only one model is resident at a time. While a benchmark job runs it *pins* the GPU
223
+ to that model: chat requests for the same model are served, but a request for a *different* model gets
224
+ `503 busy` rather than evicting the run mid-flight. With no job running, any model loads/swaps on demand.
225
+
226
+ ## Running the server (peakstone.ai)
227
+
228
+ The website + leaderboard API + Postgres + automatic-HTTPS proxy run as one Docker stack (`infra/`).
229
+ Caddy serves the Next.js site at `/` and the API under `/api/*` on the same domain (so
230
+ `https://<domain>/` is the leaderboard and `https://<domain>/api/...` is the API). On a Linux box
231
+ reachable on a public IP:
232
+
233
+ ```bash
234
+ git clone https://github.com/peakstone-ai/peakstone && cd peakstone
235
+ cp infra/.env.example infra/.env # set PEAKSTONE_DOMAIN + a strong POSTGRES_PASSWORD
236
+ ./infra/deploy.sh # build, migrate (alembic), start db + api + web + caddy
237
+ ```
238
+
239
+ [Caddy](https://caddyserver.com) provisions and renews the TLS cert for `PEAKSTONE_DOMAIN`
240
+ automatically — point its DNS A record at the box and open ports 80 + 443; there's no certbot to
241
+ manage. **To update:** `git pull && ./infra/deploy.sh`. Migrations (`alembic upgrade head`) run on
242
+ every deploy before the app starts. Postgres is internal-only (not published to the host); only the
243
+ proxy is exposed. For a local self-signed smoke test, leave `PEAKSTONE_DOMAIN=localhost` and run
244
+ `docker compose -f infra/docker-compose.yml up --build`.
245
+
246
+ **Running the API directly (dev / LAN).** Outside Docker, `python -m peakstone.api` starts uvicorn
247
+ with host/port from the `[api]` block in `engine/config.toml`. It's local-only by default; to reach it
248
+ from your phone or another machine on the LAN, expose it without editing the tracked config by dropping
249
+ this in `~/.peakstone/config.toml` (or pass `--host 0.0.0.0`, or set `PEAKSTONE_API_HOST=0.0.0.0`):
250
+
251
+ ```toml
252
+ [api]
253
+ host = "0.0.0.0"
254
+ ```
255
+
256
+ Ingest is signature-verified, but account/admin endpoints are reachable too — only bind `0.0.0.0` on a
257
+ trusted network.
258
+
259
+ ## Add a challenge
260
+
261
+ Create `challenges/<lang-or-category>/NN-slug/` with `meta.toml`, `spec.md`, `tests/`, and a
262
+ `reference/` solution, then verify it passes its own tests:
263
+
264
+ ```bash
265
+ python -m peakstone.engine.runner --reference --models reference --ids <id>
266
+ ```
267
+
268
+ See **[CONTRIBUTING.md](./CONTRIBUTING.md)** for the challenge schema, the corpus → admin-canonized
269
+ suite lifecycle, and the DCO sign-off. Several challenges test **library fluency** with offline-safe
270
+ libs (Python: numpy/pandas/pydantic/networkx/...; JS/TS: lodash/date-fns/zod/mathjs in `peakstone/engine/jsenv`).
271
+
272
+ ## License
273
+
274
+ - **Code & challenges:** Apache-2.0 ([LICENSE](./LICENSE)), via DCO ([CONTRIBUTING.md](./CONTRIBUTING.md)).
275
+ - **Submitted result data:** CC-BY-4.0 ([DATA-LICENSE.md](./DATA-LICENSE.md)).
276
+ - The **Peakstone** name and "official"/"verified" designations are reserved ([TRADEMARK.md](./TRADEMARK.md)).