hsom 1.0.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.
- hsom-1.0.0/.github/workflows/ci.yml +71 -0
- hsom-1.0.0/.gitignore +229 -0
- hsom-1.0.0/.python-version +1 -0
- hsom-1.0.0/LICENSE +21 -0
- hsom-1.0.0/PKG-INFO +245 -0
- hsom-1.0.0/README.md +210 -0
- hsom-1.0.0/benchmark.py +7 -0
- hsom-1.0.0/environment.toml.example +119 -0
- hsom-1.0.0/eval.toml.example +44 -0
- hsom-1.0.0/examples/BENCHMARK-REPORT.md +706 -0
- hsom-1.0.0/examples/BENCHMARKS.md +197 -0
- hsom-1.0.0/examples/README.md +137 -0
- hsom-1.0.0/examples/benchmark.toml +34 -0
- hsom-1.0.0/examples/container-ops/README.md +13 -0
- hsom-1.0.0/examples/container-ops/environment.toml +203 -0
- hsom-1.0.0/examples/container-ops/eval.toml +259 -0
- hsom-1.0.0/examples/container-ops/manifest.json +22 -0
- hsom-1.0.0/examples/container-ops/run_eval.sh +14 -0
- hsom-1.0.0/examples/container-ops/workspace/Dockerfile +4 -0
- hsom-1.0.0/examples/container-ops/workspace/Makefile +13 -0
- hsom-1.0.0/examples/container-ops/workspace/README.md +3 -0
- hsom-1.0.0/examples/container-ops/workspace/compose.yaml +7 -0
- hsom-1.0.0/examples/container-ops/workspace/dist/app.whl +1 -0
- hsom-1.0.0/examples/container-ops/workspace/docs/notes.md +3 -0
- hsom-1.0.0/examples/container-ops/workspace/logs/app.log +2 -0
- hsom-1.0.0/examples/container-ops/workspace/scripts/deploy.sh +2 -0
- hsom-1.0.0/examples/container-ops/workspace/src/app.py +6 -0
- hsom-1.0.0/examples/container-ops/workspace/src/utils.py +2 -0
- hsom-1.0.0/examples/container-ops/workspace/tests/test_app.py +5 -0
- hsom-1.0.0/examples/git-workflow/environment.toml +150 -0
- hsom-1.0.0/examples/git-workflow/eval.toml +351 -0
- hsom-1.0.0/examples/git-workflow/excluded.toml +60 -0
- hsom-1.0.0/examples/git-workflow/run_eval.sh +22 -0
- hsom-1.0.0/examples/git-workflow/workspace/docs/notes.md +4 -0
- hsom-1.0.0/examples/git-workflow/workspace/src/main.py +10 -0
- hsom-1.0.0/examples/git-workflow/workspace/src/utils.py +5 -0
- hsom-1.0.0/examples/library_usage.py +71 -0
- hsom-1.0.0/examples/pricing.toml +11 -0
- hsom-1.0.0/examples/python-qa/environment.toml +118 -0
- hsom-1.0.0/examples/python-qa/eval.toml +294 -0
- hsom-1.0.0/examples/python-qa/excluded.toml +73 -0
- hsom-1.0.0/examples/python-qa/run_eval.sh +22 -0
- hsom-1.0.0/examples/python-qa/workspace/src/app.py +9 -0
- hsom-1.0.0/examples/python-qa/workspace/tests/test_app.py +6 -0
- hsom-1.0.0/main.py +6 -0
- hsom-1.0.0/pyproject.toml +72 -0
- hsom-1.0.0/src/hsom/__init__.py +60 -0
- hsom-1.0.0/src/hsom/api.py +557 -0
- hsom-1.0.0/src/hsom/baselines.py +438 -0
- hsom-1.0.0/src/hsom/benchmark.py +1211 -0
- hsom-1.0.0/src/hsom/cli.py +475 -0
- hsom-1.0.0/src/hsom/client.py +100 -0
- hsom-1.0.0/src/hsom/config.py +728 -0
- hsom-1.0.0/src/hsom/discovery.py +183 -0
- hsom-1.0.0/src/hsom/dispatcher.py +701 -0
- hsom-1.0.0/src/hsom/eval.py +455 -0
- hsom-1.0.0/src/hsom/executor.py +195 -0
- hsom-1.0.0/src/hsom/questions.py +216 -0
- hsom-1.0.0/src/hsom/runlog.py +229 -0
- hsom-1.0.0/src/hsom/stats.py +149 -0
- hsom-1.0.0/tests/conftest.py +69 -0
- hsom-1.0.0/tests/test_advanced.py +826 -0
- hsom-1.0.0/tests/test_baselines.py +163 -0
- hsom-1.0.0/tests/test_benchmark.py +185 -0
- hsom-1.0.0/tests/test_config.py +287 -0
- hsom-1.0.0/tests/test_discovery.py +106 -0
- hsom-1.0.0/tests/test_dispatcher.py +202 -0
- hsom-1.0.0/tests/test_eval.py +535 -0
- hsom-1.0.0/tests/test_executor.py +168 -0
- hsom-1.0.0/tests/test_exit_codes.py +115 -0
- hsom-1.0.0/tests/test_library.py +323 -0
- hsom-1.0.0/tests/test_provider.py +210 -0
- hsom-1.0.0/tests/test_questions.py +108 -0
- hsom-1.0.0/tests/test_runlog.py +113 -0
- hsom-1.0.0/tests/test_security.py +119 -0
- hsom-1.0.0/tests/test_stats.py +52 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
15
|
+
env:
|
|
16
|
+
PYTHONPATH: src:tests
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
- name: Install
|
|
23
|
+
run: |
|
|
24
|
+
python -m pip install --upgrade pip
|
|
25
|
+
pip install -e .
|
|
26
|
+
pip install pytest
|
|
27
|
+
- name: Test
|
|
28
|
+
run: pytest -q
|
|
29
|
+
|
|
30
|
+
quality:
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v4
|
|
34
|
+
- uses: actions/setup-python@v5
|
|
35
|
+
with:
|
|
36
|
+
python-version: "3.12"
|
|
37
|
+
- name: Install
|
|
38
|
+
run: |
|
|
39
|
+
python -m pip install --upgrade pip
|
|
40
|
+
pip install -e '.[dev]'
|
|
41
|
+
- name: Benchmark integrity
|
|
42
|
+
run: python benchmark.py check
|
|
43
|
+
- name: Ruff
|
|
44
|
+
run: ruff check .
|
|
45
|
+
- name: Typecheck
|
|
46
|
+
run: mypy
|
|
47
|
+
|
|
48
|
+
package:
|
|
49
|
+
runs-on: ubuntu-latest
|
|
50
|
+
steps:
|
|
51
|
+
- uses: actions/checkout@v4
|
|
52
|
+
- uses: actions/setup-python@v5
|
|
53
|
+
with:
|
|
54
|
+
python-version: "3.12"
|
|
55
|
+
- name: Build wheel
|
|
56
|
+
run: |
|
|
57
|
+
python -m pip install --upgrade pip
|
|
58
|
+
pip install build pip-audit
|
|
59
|
+
python -m build
|
|
60
|
+
- name: Clean-install smoke test
|
|
61
|
+
run: |
|
|
62
|
+
python -m venv /tmp/hsom-venv
|
|
63
|
+
/tmp/hsom-venv/bin/python -m pip install --upgrade pip
|
|
64
|
+
/tmp/hsom-venv/bin/pip install dist/*.whl
|
|
65
|
+
/tmp/hsom-venv/bin/python -c "import hsom; print(hsom.__version__)"
|
|
66
|
+
/tmp/hsom-venv/bin/hsom --help
|
|
67
|
+
/tmp/hsom-venv/bin/pip check
|
|
68
|
+
- name: Dependency audit
|
|
69
|
+
run: |
|
|
70
|
+
python -m pip install --target /tmp/hsom-site dist/*.whl
|
|
71
|
+
python -m pip_audit --path /tmp/hsom-site
|
hsom-1.0.0/.gitignore
ADDED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
# Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
# poetry.lock
|
|
109
|
+
# poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
# pdm.lock
|
|
116
|
+
# pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
# pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# Redis
|
|
135
|
+
*.rdb
|
|
136
|
+
*.aof
|
|
137
|
+
*.pid
|
|
138
|
+
|
|
139
|
+
# RabbitMQ
|
|
140
|
+
mnesia/
|
|
141
|
+
rabbitmq/
|
|
142
|
+
rabbitmq-data/
|
|
143
|
+
|
|
144
|
+
# ActiveMQ
|
|
145
|
+
activemq-data/
|
|
146
|
+
|
|
147
|
+
# SageMath parsed files
|
|
148
|
+
*.sage.py
|
|
149
|
+
|
|
150
|
+
# Environments
|
|
151
|
+
.env
|
|
152
|
+
.envrc
|
|
153
|
+
.venv
|
|
154
|
+
env/
|
|
155
|
+
venv/
|
|
156
|
+
ENV/
|
|
157
|
+
env.bak/
|
|
158
|
+
venv.bak/
|
|
159
|
+
|
|
160
|
+
# Spyder project settings
|
|
161
|
+
.spyderproject
|
|
162
|
+
.spyproject
|
|
163
|
+
|
|
164
|
+
# Rope project settings
|
|
165
|
+
.ropeproject
|
|
166
|
+
|
|
167
|
+
# mkdocs documentation
|
|
168
|
+
/site
|
|
169
|
+
|
|
170
|
+
# mypy
|
|
171
|
+
.mypy_cache/
|
|
172
|
+
.dmypy.json
|
|
173
|
+
dmypy.json
|
|
174
|
+
|
|
175
|
+
# Pyre type checker
|
|
176
|
+
.pyre/
|
|
177
|
+
|
|
178
|
+
# pytype static type analyzer
|
|
179
|
+
.pytype/
|
|
180
|
+
|
|
181
|
+
# Cython debug symbols
|
|
182
|
+
cython_debug/
|
|
183
|
+
|
|
184
|
+
# PyCharm
|
|
185
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
186
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
188
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
189
|
+
# .idea/
|
|
190
|
+
|
|
191
|
+
# Abstra
|
|
192
|
+
# Abstra is an AI-powered process automation framework.
|
|
193
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
194
|
+
# Learn more at https://abstra.io/docs
|
|
195
|
+
.abstra/
|
|
196
|
+
|
|
197
|
+
# Visual Studio Code
|
|
198
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
199
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
200
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
201
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
202
|
+
# .vscode/
|
|
203
|
+
# Temporary file for partial code execution
|
|
204
|
+
tempCodeRunnerFile.py
|
|
205
|
+
|
|
206
|
+
# Ruff stuff:
|
|
207
|
+
.ruff_cache/
|
|
208
|
+
|
|
209
|
+
# PyPI configuration file
|
|
210
|
+
.pypirc
|
|
211
|
+
|
|
212
|
+
# Marimo
|
|
213
|
+
marimo/_static/
|
|
214
|
+
marimo/_lsp/
|
|
215
|
+
__marimo__/
|
|
216
|
+
|
|
217
|
+
# Streamlit
|
|
218
|
+
.streamlit/secrets.toml
|
|
219
|
+
|
|
220
|
+
# hsom examples: eval run artifacts (regenerate via examples/*/run_eval.sh)
|
|
221
|
+
examples/*/eval-results.jsonl
|
|
222
|
+
examples/benchmark-results/
|
|
223
|
+
|
|
224
|
+
# Frozen benchmark workspaces include build artifacts and logs as fixtures.
|
|
225
|
+
!examples/*/workspace/dist/
|
|
226
|
+
!examples/*/workspace/logs/
|
|
227
|
+
!examples/*/workspace/**/*.log
|
|
228
|
+
|
|
229
|
+
PLAN*.md
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.10
|
hsom-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Giuseppe
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
hsom-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: hsom
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Harness for System One Models. | Connects Jev to your shell
|
|
5
|
+
Project-URL: Homepage, https://github.com/gi-dellav/hsom
|
|
6
|
+
Project-URL: Repository, https://github.com/gi-dellav/hsom
|
|
7
|
+
Author: Giuseppe Della Vedova
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: agent-harness,cli,jev,shell,system-one,typesafe
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Classifier: Topic :: System :: Shells
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: tomli>=2.0; python_version < '3.11'
|
|
25
|
+
Requires-Dist: typesafe-sdk>=0.7.0
|
|
26
|
+
Provides-Extra: benchmark
|
|
27
|
+
Requires-Dist: litellm>=1.82; extra == 'benchmark'
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
30
|
+
Requires-Dist: mypy>=1.19; extra == 'dev'
|
|
31
|
+
Requires-Dist: pip-audit>=2.9; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: ruff>=0.15; extra == 'dev'
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# hsom
|
|
37
|
+
|
|
38
|
+
*Harness for System One Models. Runs allowlisted shell commands using decision trees.*
|
|
39
|
+
|
|
40
|
+
*hsom* is a strict-allowlist harness. `environment.toml` defines which shell commands Jev (the TypeSafe System One classifier) may select. In one step, Jev picks: command → subcommand → flags (boolean or valued) → path slots; this works by navigating the decision tree as defined by the TOML file.
|
|
41
|
+
|
|
42
|
+
- `read` actions run directly.
|
|
43
|
+
- `write` and `destructive` actions ask for confirmation (`y/N`, default N; non-tty declines).
|
|
44
|
+
- `--dry-run` previews without executing or prompting.
|
|
45
|
+
|
|
46
|
+
*hsom* is usable both as a CLI tool for shell-based harnesses and as a Python library for building custom harnesses.
|
|
47
|
+
|
|
48
|
+
(*note*: I'm currently working on a research paper on the inner workings and theoritical aspects of the algorithm implemented by *hsom*.)
|
|
49
|
+
|
|
50
|
+
## Benchmark
|
|
51
|
+
|
|
52
|
+
Strict pass rate (all repeats passed) on the bundled suites; structured and
|
|
53
|
+
logprob baselines use `openai/gpt-6-luna`. Full results:
|
|
54
|
+
[`examples/benchmark-results/final-gpt6/report.md`](examples/benchmark-results/final-gpt6/report.md).
|
|
55
|
+
|
|
56
|
+
| Suite | Label | Jev | Structured | Logprobs |
|
|
57
|
+
| --- | --- | --- | --- | --- |
|
|
58
|
+
| git-workflow | regression | 95.3% | 58.7% | 66.7% |
|
|
59
|
+
| python-qa | regression | 96.2% | 43.1% | 45.1% |
|
|
60
|
+
| container-ops | heldout | **92.0%** | 62.0% | 68.0% |
|
|
61
|
+
|
|
62
|
+
## Setup
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install -e .
|
|
66
|
+
export TYPESAFE_API_KEY=... # from https://console.typesafe.ai/keys
|
|
67
|
+
cp environment.toml.example environment.toml
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Or with [uv](https://docs.astral.sh/uv/):
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
uv venv # creates .venv
|
|
74
|
+
source .venv/bin/activate
|
|
75
|
+
uv pip install -e .
|
|
76
|
+
export TYPESAFE_API_KEY=... # from https://console.typesafe.ai/keys
|
|
77
|
+
cp environment.toml.example environment.toml
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### OpenRouter
|
|
81
|
+
|
|
82
|
+
hsom can call Jev through [OpenRouter's System One API](https://openrouter.ai/docs/guides/community/typesafe-sdk) (billed to your OpenRouter account) instead of TypeSafe Cloud. Pick one provider:
|
|
83
|
+
|
|
84
|
+
```toml
|
|
85
|
+
# environment.toml
|
|
86
|
+
[meta]
|
|
87
|
+
provider = "openrouter" # default base_url: https://openrouter.ai/api
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
export OPENROUTER_API_KEY=... # from https://openrouter.ai/settings/keys
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Endpoint precedence (highest first): `--base-url` > `[meta] base_url` > `TYPESAFE_BASE_URL` > provider default.
|
|
95
|
+
|
|
96
|
+
Key precedence: `TYPESAFE_API_KEY` > `OPENROUTER_API_KEY`. The SDK itself reads only `TYPESAFE_API_KEY`, so hsom forwards `OPENROUTER_API_KEY` explicitly.
|
|
97
|
+
|
|
98
|
+
- `TYPESAFE_BASE_URL=https://openrouter.ai/api` also works and keeps `provider = "typesafe"`.
|
|
99
|
+
- Bare model IDs (`jev-latest`) and prefixed IDs (`typesafe/jev-1.13`) are both passed through.
|
|
100
|
+
- Model listing via the SDK is not supported by OpenRouter. Browse https://openrouter.ai/typesafe instead.
|
|
101
|
+
|
|
102
|
+
## Configuration
|
|
103
|
+
|
|
104
|
+
`environment.toml` holds one `[meta]` section and one `[[command]]` table per allowed command.
|
|
105
|
+
|
|
106
|
+
### `[meta]` settings
|
|
107
|
+
|
|
108
|
+
```toml
|
|
109
|
+
[meta]
|
|
110
|
+
model = "jev-latest"
|
|
111
|
+
min_confidence = 0.5
|
|
112
|
+
timeout = 60
|
|
113
|
+
default_risk = "read" # read | write | destructive
|
|
114
|
+
max_steps = 1 # 1..10 upper bound; >1 lets Jev decide to continue
|
|
115
|
+
max_history = 5 # optional; cap history entries sent back to Jev
|
|
116
|
+
continue_threshold = 0.5 # optional; Noul bar for the __continue__ chaining gate
|
|
117
|
+
continue_question = "..." # optional; override the __continue__ gate instructions
|
|
118
|
+
temperature = 0.0 # optional; extra_body passthrough (provider-dependent)
|
|
119
|
+
command_question = "What shell task is the user asking for?"
|
|
120
|
+
|
|
121
|
+
[meta.risk_thresholds]
|
|
122
|
+
read = 0.5
|
|
123
|
+
write = 0.7
|
|
124
|
+
destructive = 0.9
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
`temperature` is forwarded through the SDK's `extra_body`. The OpenRouter
|
|
128
|
+
System One schema does not document a temperature parameter, so treat it as
|
|
129
|
+
provider-dependent and not as a determinism guarantee. The benchmark configs
|
|
130
|
+
set it explicitly to `0.0`, and run logs record the value used
|
|
131
|
+
(`temperature` in `plan`/`eval` events).
|
|
132
|
+
|
|
133
|
+
### Commands, subcommands, flags, and paths
|
|
134
|
+
|
|
135
|
+
```toml
|
|
136
|
+
[[command]]
|
|
137
|
+
name = "git"
|
|
138
|
+
description = "version control operations"
|
|
139
|
+
risk = "read"
|
|
140
|
+
instructions_subcommand = "Which git subcommand does the request need?"
|
|
141
|
+
|
|
142
|
+
[[command.subcommand]]
|
|
143
|
+
name = "log"
|
|
144
|
+
description = "show commit history"
|
|
145
|
+
argv = ["git", "log"]
|
|
146
|
+
|
|
147
|
+
[[command.subcommand.flag]] # boolean flag
|
|
148
|
+
name = "--oneline"
|
|
149
|
+
description = "compact one-line-per-commit history"
|
|
150
|
+
argv_fragment = ["--oneline"]
|
|
151
|
+
question = "Does the user want compact one-line history?" # optional
|
|
152
|
+
|
|
153
|
+
[[command.subcommand.flag]] # valued flag
|
|
154
|
+
name = "--format"
|
|
155
|
+
description = "history output format"
|
|
156
|
+
argv_fragment = ["--format={value}"]
|
|
157
|
+
values = ["json", "plain"]
|
|
158
|
+
[command.subcommand.flag.value_descriptions]
|
|
159
|
+
json = "one JSON object per commit"
|
|
160
|
+
|
|
161
|
+
[[command.subcommand]]
|
|
162
|
+
name = "add"
|
|
163
|
+
description = "stage a file for commit"
|
|
164
|
+
argv = ["git", "add", "{path:src}"] # named slot; legacy "{path}" also works
|
|
165
|
+
risk = "write" # prompts for confirmation
|
|
166
|
+
|
|
167
|
+
[[command.subcommand.path]]
|
|
168
|
+
name = "src"
|
|
169
|
+
kind = "files" # files | dirs | both
|
|
170
|
+
optional = false
|
|
171
|
+
description = "file to stage"
|
|
172
|
+
base = "." # relative root inside --cwd
|
|
173
|
+
depth = 3 # 1 = top level only
|
|
174
|
+
glob = "*.py" # optional fnmatch
|
|
175
|
+
include_dotfiles = false
|
|
176
|
+
max_results = 200
|
|
177
|
+
question = "Which Python file does the request want to stage?"
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
`stated_question` is an optional yes/no gate for **optional** slots: when
|
|
181
|
+
Jev says the request names no specific path, the slot is omitted. A
|
|
182
|
+
missing, malformed, or non-Noul gate answer is fail-closed and also omits
|
|
183
|
+
the slot. It has no effect on required slots.
|
|
184
|
+
|
|
185
|
+
## Usage
|
|
186
|
+
|
|
187
|
+
Run `hsom` with a natural-language request:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
hsom "show git status" --dry-run --show-probs
|
|
191
|
+
hsom "brief git history" # -> git log --oneline
|
|
192
|
+
hsom "stage main.py" # -> git add main.py (asks [y/N], risk write)
|
|
193
|
+
hsom "copy readme into examples" # -> cp README.md examples
|
|
194
|
+
hsom "run tests" --max-steps 3 # dynamic chaining: Jev decides each step
|
|
195
|
+
hsom "run tests" --max-steps 1 # single shot (never asks to continue)
|
|
196
|
+
hsom "run tests" --max-history 2 # send back at most 2 prior steps
|
|
197
|
+
hsom "run tests" --continue-threshold 0.3 # lower the __continue__ chaining bar (CLI wins)
|
|
198
|
+
hsom "run tests" --temperature 0.2 # sampling temperature (extra_body)
|
|
199
|
+
hsom "run tests" --log run.jsonl # opt-in structured JSONL run log
|
|
200
|
+
hsom "run tests" --min-confidence 0.8 # CLI flag wins over all config
|
|
201
|
+
hsom "run tests" --provider openrouter --dry-run # one-shot OpenRouter routing
|
|
202
|
+
hsom --eval eval.toml.example # eval harness: plans only, never runs
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Python library
|
|
206
|
+
|
|
207
|
+
`hsom` is also an importable library built around the `Harness` class
|
|
208
|
+
(sync-only). The CLI shares the same dispatcher/executor machinery.
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
pip install -e .
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
from hsom import Harness
|
|
216
|
+
|
|
217
|
+
# Config: environment.toml path, EnvConfig, or TOML-shaped dict.
|
|
218
|
+
h = Harness(env="environment.toml")
|
|
219
|
+
h = Harness(env={"meta": {"model": "jev-latest"},
|
|
220
|
+
"command": [{"name": "pytest", "description": "run tests",
|
|
221
|
+
"argv": ["pytest", "-q"]}]})
|
|
222
|
+
|
|
223
|
+
# Single-shot plan (max_steps=1) -> PlanOutcome(ok, action, reason, ...).
|
|
224
|
+
outcome = h.plan("brief git history")
|
|
225
|
+
if outcome.ok:
|
|
226
|
+
print(h.resolve(outcome.action)) # argv from the toml template only
|
|
227
|
+
|
|
228
|
+
# Chained run -> RunResult(steps, stop_reason, ok, declined).
|
|
229
|
+
result = h.run("run tests", max_steps=3, dry_run=True)
|
|
230
|
+
print(result.stop_reason, [s.argv for s in result.steps])
|
|
231
|
+
|
|
232
|
+
# Write/destructive steps never prompt on stdin here. Pass on_confirm
|
|
233
|
+
# (default None = fail-closed auto-decline, like the CLI off-tty):
|
|
234
|
+
result = h.run("stage main.py", on_confirm=lambda action, argv: True)
|
|
235
|
+
|
|
236
|
+
# Dynamic working directory: subclass, pass get_cwd=..., assign
|
|
237
|
+
# h.get_cwd = lambda: ..., or h.set_cwd_fn(...) / h.set_cwd(...).
|
|
238
|
+
# A per-call cwd=... always wins over get_cwd().
|
|
239
|
+
h.set_cwd_fn(lambda: "/path/to/project")
|
|
240
|
+
result = h.run("run tests", cwd="/override", dry_run=True)
|
|
241
|
+
|
|
242
|
+
# Eval harness (plans only, never executes) -> EvalSummary.
|
|
243
|
+
summary = h.eval("eval.toml.example")
|
|
244
|
+
print(f"{summary.passed}/{summary.total} passed")
|
|
245
|
+
```
|