nullius-eval 0.1.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 (291) hide show
  1. _nullius_app/.env.example +55 -0
  2. _nullius_app/app.py +96 -0
  3. _nullius_app/requirements.txt +1 -0
  4. _nullius_app/static/brand/README.md +20 -0
  5. _nullius_app/static/brand/docker.svg +1 -0
  6. _nullius_app/static/brand/favicon.svg +1 -0
  7. _nullius_app/static/brand/huggingface.svg +37 -0
  8. _nullius_app/static/brand/mark-dark.svg +1 -0
  9. _nullius_app/static/brand/marks.svg +34 -0
  10. _nullius_app/static/brand/tokens.json +51 -0
  11. _nullius_app/static/brand/typesafe.png +0 -0
  12. _nullius_app/static/brand/wordmark-dark.svg +1 -0
  13. _nullius_app/static/builder/command-builder-core.js +763 -0
  14. _nullius_app/static/builder/command-builder.css +248 -0
  15. _nullius_app/static/builder/command-builder.js +997 -0
  16. _nullius_app/static/builder/model-picker.js +113 -0
  17. _nullius_app/static/catalogue/add.js +46 -0
  18. _nullius_app/static/catalogue/agents/README.md +19 -0
  19. _nullius_app/static/catalogue/agents/goose.svg +1 -0
  20. _nullius_app/static/catalogue/agents/jiuwenswarm.svg +33 -0
  21. _nullius_app/static/catalogue/agents/marks.json +8 -0
  22. _nullius_app/static/catalogue/agents/mini-swe-agent.svg +7 -0
  23. _nullius_app/static/catalogue/agents/opencode.svg +7 -0
  24. _nullius_app/static/catalogue/catalogue.css +436 -0
  25. _nullius_app/static/catalogue/catalogue.js +87 -0
  26. _nullius_app/static/catalogue/marks.svg +29 -0
  27. _nullius_app/static/catalogue/new.js +78 -0
  28. _nullius_app/static/catalogue/versions.js +27 -0
  29. _nullius_app/static/compare/comparison.css +117 -0
  30. _nullius_app/static/controls.js +117 -0
  31. _nullius_app/static/disclosures.js +70 -0
  32. _nullius_app/static/fonts/0569c822cab6c510.ttf +0 -0
  33. _nullius_app/static/fonts/DMSans-Medium.woff2 +0 -0
  34. _nullius_app/static/fonts/DMSans-Regular.woff2 +0 -0
  35. _nullius_app/static/fonts/IBMPlexMono-Medium.woff2 +0 -0
  36. _nullius_app/static/fonts/IBMPlexMono-Regular.woff2 +0 -0
  37. _nullius_app/static/fonts/InstrumentSerif-Italic.woff2 +0 -0
  38. _nullius_app/static/fonts/InstrumentSerif-Regular.woff2 +0 -0
  39. _nullius_app/static/fonts/README.md +11 -0
  40. _nullius_app/static/fonts/c1e7453ea26a1d1e.ttf +0 -0
  41. _nullius_app/static/fonts/dmsans-OFL.txt +93 -0
  42. _nullius_app/static/fonts/ibmplexmono-OFL.txt +93 -0
  43. _nullius_app/static/fonts/instrumentserif-OFL.txt +93 -0
  44. _nullius_app/static/fonts.css +49 -0
  45. _nullius_app/static/notifications.js +49 -0
  46. _nullius_app/static/onboarding.css +78 -0
  47. _nullius_app/static/onboarding.js +158 -0
  48. _nullius_app/static/runs/board.css +358 -0
  49. _nullius_app/static/runs/board.js +127 -0
  50. _nullius_app/static/runs/launches.css +88 -0
  51. _nullius_app/static/runs/live-board.css +186 -0
  52. _nullius_app/static/runs/live-board.js +394 -0
  53. _nullius_app/static/runs/path-suggestions.js +119 -0
  54. _nullius_app/static/runs/start.css +38 -0
  55. _nullius_app/static/settings/autosave.js +162 -0
  56. _nullius_app/static/settings/custom-keys.js +100 -0
  57. _nullius_app/static/settings/data-providers.js +88 -0
  58. _nullius_app/static/settings/judges.js +61 -0
  59. _nullius_app/static/settings/modal.css +32 -0
  60. _nullius_app/static/settings/modal.js +91 -0
  61. _nullius_app/static/settings/navigation.js +55 -0
  62. _nullius_app/static/settings/prices.js +68 -0
  63. _nullius_app/static/settings/providers.js +134 -0
  64. _nullius_app/static/settings/sandbox.js +20 -0
  65. _nullius_app/static/settings/settings.css +288 -0
  66. _nullius_app/static/style.css +1752 -0
  67. _nullius_app/static/traces/conversation.css +49 -0
  68. _nullius_app/static/traces/conversation.js +215 -0
  69. _nullius_app/templates/agents/entry.html +145 -0
  70. _nullius_app/templates/agents/kits.html +55 -0
  71. _nullius_app/templates/agents/standard.html +58 -0
  72. _nullius_app/templates/base.html +479 -0
  73. _nullius_app/templates/builder/new_run.html +55 -0
  74. _nullius_app/templates/catalogue/add_dialog.html +32 -0
  75. _nullius_app/templates/catalogue/benchmark.html +270 -0
  76. _nullius_app/templates/catalogue/benchmarks.html +91 -0
  77. _nullius_app/templates/catalogue/new.html +141 -0
  78. _nullius_app/templates/catalogue/use_bundle.html +11 -0
  79. _nullius_app/templates/compare/_detail.html +37 -0
  80. _nullius_app/templates/compare/compare.html +298 -0
  81. _nullius_app/templates/compare/compare_picker.html +51 -0
  82. _nullius_app/templates/compare/compare_task.html +329 -0
  83. _nullius_app/templates/runs/_execution.html +131 -0
  84. _nullius_app/templates/runs/_runtime.html +5 -0
  85. _nullius_app/templates/runs/ascii-mark.html +485 -0
  86. _nullius_app/templates/runs/feasibility.html +127 -0
  87. _nullius_app/templates/runs/index.html +609 -0
  88. _nullius_app/templates/runs/job.html +460 -0
  89. _nullius_app/templates/runs/preparing.html +14 -0
  90. _nullius_app/templates/runs/reconcile.html +124 -0
  91. _nullius_app/templates/runs/setup.html +272 -0
  92. _nullius_app/templates/runs/start.html +51 -0
  93. _nullius_app/templates/settings/custom_keys.html +82 -0
  94. _nullius_app/templates/settings/data_providers.html +27 -0
  95. _nullius_app/templates/settings/settings.html +564 -0
  96. _nullius_app/templates/traces/_charts.html +165 -0
  97. _nullius_app/templates/traces/_conversation.html +37 -0
  98. _nullius_app/templates/traces/_judgement.html +72 -0
  99. _nullius_app/templates/traces/artifact.html +15 -0
  100. _nullius_app/templates/traces/trial.html +838 -0
  101. _nullius_app/templates/workspaces/workspaces.html +54 -0
  102. _nullius_app/web/__init__.py +1 -0
  103. _nullius_app/web/agents.py +230 -0
  104. _nullius_app/web/builder.py +406 -0
  105. _nullius_app/web/catalogue.py +370 -0
  106. _nullius_app/web/compare.py +489 -0
  107. _nullius_app/web/core.py +17 -0
  108. _nullius_app/web/execute.py +223 -0
  109. _nullius_app/web/feasibility.py +60 -0
  110. _nullius_app/web/filters.py +231 -0
  111. _nullius_app/web/judge.py +623 -0
  112. _nullius_app/web/judge_tasks.py +33 -0
  113. _nullius_app/web/onboarding.py +20 -0
  114. _nullius_app/web/reconcile.py +47 -0
  115. _nullius_app/web/runs.py +464 -0
  116. _nullius_app/web/settings.py +324 -0
  117. _nullius_app/web/shared.py +507 -0
  118. _nullius_app/web/traces.py +306 -0
  119. _nullius_app/web/workspaces.py +84 -0
  120. nullius/__init__.py +32 -0
  121. nullius/__main__.py +5 -0
  122. nullius/catalogue/__init__.py +0 -0
  123. nullius/catalogue/agents/codex/agent.json +222 -0
  124. nullius/catalogue/agents/codex/config.toml +25 -0
  125. nullius/catalogue/agents/goose/agent.json +131 -0
  126. nullius/catalogue/agents/goose/config.yaml +20 -0
  127. nullius/catalogue/agents/jiuwenswarm/agent.json +197 -0
  128. nullius/catalogue/agents/jiuwenswarm/agent.py +355 -0
  129. nullius/catalogue/agents/mini-swe-agent/agent.json +68 -0
  130. nullius/catalogue/agents/mini-swe-agent/run.py +37 -0
  131. nullius/catalogue/agents/opencode/agent.json +135 -0
  132. nullius/catalogue/agents/opencode/opencode.json +32 -0
  133. nullius/catalogue/agents/reference/agent.json +89 -0
  134. nullius/catalogue/agents/reference/agent.py +209 -0
  135. nullius/catalogue/agents/terminus-2/agent.json +64 -0
  136. nullius/catalogue/agents/terminus-2/run.py +139 -0
  137. nullius/catalogue/benchmarks/gaia/benchmark.json +72 -0
  138. nullius/catalogue/benchmarks/gaia/data-source.json +29 -0
  139. nullius/catalogue/benchmarks/gaia/driver.py +188 -0
  140. nullius/catalogue/benchmarks/gaia/env/data.Dockerfile +1 -0
  141. nullius/catalogue/benchmarks/gaia/standard.json +278 -0
  142. nullius/catalogue/benchmarks/gaia/upstream-settings.json +275 -0
  143. nullius/catalogue/benchmarks/gsm8k/benchmark.json +34 -0
  144. nullius/catalogue/benchmarks/gsm8k/driver.py +101 -0
  145. nullius/catalogue/benchmarks/gsm8k/standard.json +124 -0
  146. nullius/catalogue/benchmarks/gsm8k/upstream-settings.json +86 -0
  147. nullius/catalogue/benchmarks/humaneval/benchmark.json +36 -0
  148. nullius/catalogue/benchmarks/humaneval/driver.py +243 -0
  149. nullius/catalogue/benchmarks/humaneval/standard.json +115 -0
  150. nullius/catalogue/benchmarks/humaneval/upstream-settings.json +72 -0
  151. nullius/catalogue/benchmarks/locomo/benchmark.json +43 -0
  152. nullius/catalogue/benchmarks/locomo/driver.py +270 -0
  153. nullius/catalogue/benchmarks/locomo/standard.json +265 -0
  154. nullius/catalogue/benchmarks/locomo/upstream-settings.json +112 -0
  155. nullius/catalogue/benchmarks/longmemeval/benchmark.json +65 -0
  156. nullius/catalogue/benchmarks/longmemeval/driver.py +379 -0
  157. nullius/catalogue/benchmarks/longmemeval/standard.json +733 -0
  158. nullius/catalogue/benchmarks/longmemeval/upstream-settings.json +76 -0
  159. nullius/catalogue/benchmarks/swe-bench-verified/benchmark.json +87 -0
  160. nullius/catalogue/benchmarks/swe-bench-verified/driver.py +116 -0
  161. nullius/catalogue/benchmarks/swe-bench-verified/images.json +502 -0
  162. nullius/catalogue/benchmarks/swe-bench-verified/standard.json +108 -0
  163. nullius/catalogue/benchmarks/swe-bench-verified/upstream-settings.json +32 -0
  164. nullius/catalogue/benchmarks/tau3-bench/benchmark.json +49 -0
  165. nullius/catalogue/benchmarks/tau3-bench/driver.py +608 -0
  166. nullius/catalogue/benchmarks/tau3-bench/mcp_server.py +114 -0
  167. nullius/catalogue/benchmarks/tau3-bench/search_relay.py +19 -0
  168. nullius/catalogue/benchmarks/tau3-bench/standard.json +547 -0
  169. nullius/catalogue/benchmarks/tau3-bench/upstream-settings.json +639 -0
  170. nullius/catalogue/benchmarks/terminal-bench/benchmark.json +69 -0
  171. nullius/catalogue/benchmarks/terminal-bench/driver.py +267 -0
  172. nullius/catalogue/benchmarks/terminal-bench/standard.json +166 -0
  173. nullius/catalogue/benchmarks/terminal-bench/upstream-settings.json +36 -0
  174. nullius/catalogue/capabilities/keyword-memory/capability.json +33 -0
  175. nullius/catalogue/capabilities/keyword-memory/capability.py +55 -0
  176. nullius/catalogue/capabilities/mem0/capability.json +135 -0
  177. nullius/catalogue/capabilities/mem0/capability.py +173 -0
  178. nullius/catalogue/catalog.py +426 -0
  179. nullius/catalogue/citation.py +116 -0
  180. nullius/catalogue/harbor_entry.py +367 -0
  181. nullius/catalogue/sources.py +107 -0
  182. nullius/catalogue/storage.py +125 -0
  183. nullius/cli.py +85 -0
  184. nullius/compare/__init__.py +0 -0
  185. nullius/compare/cli.py +265 -0
  186. nullius/compare/comparison.py +184 -0
  187. nullius/execution.py +1653 -0
  188. nullius/gitrefs.py +128 -0
  189. nullius/harbor/__init__.py +0 -0
  190. nullius/harbor/feed.py +228 -0
  191. nullius/harbor/source.py +582 -0
  192. nullius/hosts.py +368 -0
  193. nullius/importers/__init__.py +140 -0
  194. nullius/importers/atif.py +387 -0
  195. nullius/importers/cli.py +135 -0
  196. nullius/importers/otel.py +274 -0
  197. nullius/judge/__init__.py +14 -0
  198. nullius/judge/batch.py +122 -0
  199. nullius/judge/client.py +433 -0
  200. nullius/judge/floors.json +86 -0
  201. nullius/judge/lanes.py +89 -0
  202. nullius/judge/questions.py +309 -0
  203. nullius/judge/reconcile.py +176 -0
  204. nullius/judge/state.py +224 -0
  205. nullius/judge/store.py +167 -0
  206. nullius/migrate.py +268 -0
  207. nullius/onboarding.py +116 -0
  208. nullius/paths.py +89 -0
  209. nullius/prerequisites.py +129 -0
  210. nullius/prices.py +283 -0
  211. nullius/progress.py +294 -0
  212. nullius/providers.py +335 -0
  213. nullius/recipes/__init__.py +0 -0
  214. nullius/recipes/launch.py +78 -0
  215. nullius/redact.py +72 -0
  216. nullius/runs/__init__.py +0 -0
  217. nullius/runs/artifacts.py +67 -0
  218. nullius/runs/classify.py +216 -0
  219. nullius/runs/cli.py +316 -0
  220. nullius/runs/feasibility.py +442 -0
  221. nullius/runs/launches.py +149 -0
  222. nullius/runs/live.py +715 -0
  223. nullius/runs/parse.py +1016 -0
  224. nullius/runs/verifier.py +241 -0
  225. nullius/sandbox.py +109 -0
  226. nullius/secrets.py +218 -0
  227. nullius/settings.py +544 -0
  228. nullius/standard/__init__.py +15 -0
  229. nullius/standard/acp.py +305 -0
  230. nullius/standard/cancellation.py +19 -0
  231. nullius/standard/cli.py +703 -0
  232. nullius/standard/conform.py +149 -0
  233. nullius/standard/container.py +1870 -0
  234. nullius/standard/definitions.py +1651 -0
  235. nullius/standard/egress.py +192 -0
  236. nullius/standard/fidelity.py +256 -0
  237. nullius/standard/forward.py +139 -0
  238. nullius/standard/hostreq.py +105 -0
  239. nullius/standard/howto.py +220 -0
  240. nullius/standard/install.py +428 -0
  241. nullius/standard/job.py +551 -0
  242. nullius/standard/jsonl.py +129 -0
  243. nullius/standard/kits/agent-conversation-v1/driver.py +27 -0
  244. nullius/standard/kits/agent-conversation-v1/standard.json +26 -0
  245. nullius/standard/kits/agent-search-v1/driver.py +171 -0
  246. nullius/standard/kits/agent-search-v1/standard.json +99 -0
  247. nullius/standard/kits/agent-task-v1/driver.py +25 -0
  248. nullius/standard/kits/agent-task-v1/standard.json +100 -0
  249. nullius/standard/kits/agent-tools-v1/driver.py +206 -0
  250. nullius/standard/kits/agent-tools-v1/mcp_kit.py +209 -0
  251. nullius/standard/kits/agent-tools-v1/standard.json +119 -0
  252. nullius/standard/kits/agent-workspace-v1/driver.py +65 -0
  253. nullius/standard/kits/agent-workspace-v1/standard.json +95 -0
  254. nullius/standard/kits/cap-memory-v1/driver.py +39 -0
  255. nullius/standard/kits/cap-memory-v1/standard.json +91 -0
  256. nullius/standard/ledger.py +326 -0
  257. nullius/standard/match.py +66 -0
  258. nullius/standard/mcp_bridge.py +62 -0
  259. nullius/standard/mcp_machine.py +193 -0
  260. nullius/standard/merge.py +239 -0
  261. nullius/standard/names.py +37 -0
  262. nullius/standard/network_requirements.py +44 -0
  263. nullius/standard/pace.py +53 -0
  264. nullius/standard/payload.py +278 -0
  265. nullius/standard/pins.py +130 -0
  266. nullius/standard/ports.py +70 -0
  267. nullius/standard/prove.py +373 -0
  268. nullius/standard/recipe.py +746 -0
  269. nullius/standard/relay.py +785 -0
  270. nullius/standard/run.py +1781 -0
  271. nullius/standard/setup_container.py +208 -0
  272. nullius/standard/shard.py +71 -0
  273. nullius/standard/web_services.py +30 -0
  274. nullius/traces/__init__.py +0 -0
  275. nullius/traces/behavior.py +131 -0
  276. nullius/traces/charts.py +898 -0
  277. nullius/traces/conversation.py +159 -0
  278. nullius/traces/otel.py +608 -0
  279. nullius/traces/trace.py +1477 -0
  280. nullius/traces/trajectory.py +586 -0
  281. nullius/workspace.py +417 -0
  282. nullius/workspace_cli.py +119 -0
  283. nullius_eval-0.1.0.dist-info/METADATA +93 -0
  284. nullius_eval-0.1.0.dist-info/RECORD +291 -0
  285. nullius_eval-0.1.0.dist-info/WHEEL +5 -0
  286. nullius_eval-0.1.0.dist-info/entry_points.txt +2 -0
  287. nullius_eval-0.1.0.dist-info/licenses/LICENSE +202 -0
  288. nullius_eval-0.1.0.dist-info/licenses/app/static/fonts/dmsans-OFL.txt +93 -0
  289. nullius_eval-0.1.0.dist-info/licenses/app/static/fonts/ibmplexmono-OFL.txt +93 -0
  290. nullius_eval-0.1.0.dist-info/licenses/app/static/fonts/instrumentserif-OFL.txt +93 -0
  291. nullius_eval-0.1.0.dist-info/top_level.txt +2 -0
@@ -0,0 +1,564 @@
1
+ {% extends "base.html" %}
2
+ {% block title %}Settings — Nullius{% endblock %}
3
+ {% block crumb %}/ settings{% endblock %}
4
+ {% block head %}<link rel="stylesheet" href="{{ url_for('static', filename='catalogue/catalogue.css') }}"><link rel="stylesheet" href="{{ url_for('static', filename='settings/settings.css') }}">{% endblock %}
5
+ {% block body %}
6
+ {#- A section per thing a run needs - the model providers, the judge, the run hosts - and the file they
7
+ are kept in, one at a time from the menu beside them; the strip above says what a run can use today.
8
+ The menu's entries are links to the sections, so without a script every section shows. -#}
9
+ {% set by = {} %}{% set held = [] %}
10
+ {% for group, rows in groups %}{% for r in rows %}{% set _ = by.update({r.name: r}) %}{% if r.source != 'unset' %}{% set _ = held.append(r.name) %}{% endif %}{% endfor %}{% endfor %}
11
+ {% set marks = url_for('static', filename='brand/marks.svg') %}
12
+ {% set hosts_row = by.get('HOSTS') %}
13
+ {% set chosen = (hosts_row.shown.split(',') | map('trim') | select | list) if hosts_row else [] %}
14
+ {% set providers = [('typesafe', 'TypeSafe AI', 'https://api.typesafe.ai/v1/systemone', [('TYPESAFE_API_KEY', 'Key')]), ('openrouter', 'OpenRouter', 'https://openrouter.ai/api/v1', [('OPENROUTER_API_KEY', 'Key')]),
15
+ ('openai', 'OpenAI', 'https://api.openai.com/v1', [('OPENAI_API_KEY', 'Key')]),
16
+ ('anthropic', 'Anthropic', 'https://api.anthropic.com/v1', [('ANTHROPIC_API_KEY', 'Key')]),
17
+ ('local', 'OpenAI-compatible', '', [('MODEL_API_URL', 'Endpoint'), ('MODEL_API_KEY', 'Key')])] %}
18
+ {#- each named OpenAI-compatible endpoint is a card of its own, local:<id>, as the LLM judge's picker names it -#}
19
+ {% set cards = providers + [] %}
20
+ {% for i, name in endpoints %}{% set _ = cards.append(('local:' ~ i, name, '', [('MODEL_' ~ i ~ '_NAME', 'Name'), ('MODEL_' ~ i ~ '_API_URL', 'Endpoint'), ('MODEL_' ~ i ~ '_API_KEY', 'Key')])) %}{% endfor %}
21
+
22
+ {#- mode, in a provider's editor: 'plain' is edited in place (a name, an endpoint's URL); 'key' is written,
23
+ never shown, and replaced; 'optional-key' may also be removed. Elsewhere, Replace and Remove. -#}
24
+ {% macro field(r, label, writable, options=none, mode='') %}
25
+ {% set plain = mode == 'plain' %}
26
+ <article class="st-field st-row" id="{{ r.name }}" data-source="{{ r.source }}" data-secret="{{ 'yes' if r.secret else 'no' }}">
27
+ <label class="st-row-label" for="value-{{ r.name }}">{{ label }}</label>
28
+ <div class="st-row-value">
29
+ {% if writable %}
30
+ {% if r.source != 'unset' and not plain %}
31
+ <div class="st-value" data-held>
32
+ <span class="st-shown">{{ r.shown }}</span>
33
+ <button type="button" class="btn sm ghost" data-replace>Replace</button>
34
+ <input type="hidden" name="clear:{{ r.name }}" value="">{% if mode != 'key' %}<button type="button" class="btn sm ghost st-remove" data-unset="{{ r.name }}">{{ 'Remove key' if mode == 'optional-key' else 'Remove' }}</button>{% endif %}
35
+ </div>
36
+ {% endif %}
37
+ <input class="st-input" id="value-{{ r.name }}" type="{{ 'password' if r.secret else 'text' }}" name="value:{{ r.name }}" aria-label="{{ label if plain else ('New value for ' if r.source != 'unset') ~ r.name }}"{% if plain %} value="{{ r.shown }}"{% endif %}{% if r.secret %} autocomplete="off" data-1p-ignore data-lpignore="true"{% endif %} spellcheck="false" {% if not r.secret %}maxlength="4000"{% endif %}{% if r.kind == 'localkey' %} placeholder="(optional)"{% endif %}{% if options is not none %} list="options-{{ r.name }}"{% endif %}{% if r.source != 'unset' and not plain %} hidden{% endif %}{% if r.problem %} aria-invalid="true" aria-describedby="problem-{{ r.name }}"{% endif %}>
38
+ {% if r.problem %}<p class="st-note st-bad" id="problem-{{ r.name }}">{{ r.problem }}</p>{% endif %}
39
+ {% if options is not none %}<datalist id="options-{{ r.name }}">{% for o in options %}<option value="{{ o }}"></option>{% endfor %}</datalist>{% endif %}
40
+ {% if r.source == 'environment' %}<p class="st-note" title="Held by the process the application runs in; the file cannot override it">Also set in the process environment: the running process keeps that value until it is restarted; the file applies then.</p>{% endif %}
41
+ {% if r.shadowed %}<p class="st-note">The file holds a different value, shadowed by the environment.</p>{% endif %}
42
+ {% if r.advice %}<p class="st-note">{{ r.advice }}</p>{% endif %}
43
+ {% else %}
44
+ <span class="st-shown">{{ r.shown or 'not set' }}</span>
45
+ {% endif %}
46
+ </div>
47
+ </article>
48
+ {% endmacro %}
49
+
50
+ <div class="settings-page st-page">
51
+ <header class="st-head">
52
+ <h1>Settings</h1>
53
+ <div class="st-ready" role="group" aria-label="What a run can use">
54
+ <span class="st-ready-t">Ready to run</span>
55
+ {% set ns = namespace(compatible='MODEL_API_URL' in held) %}
56
+ {% for i, _ in endpoints %}{% if ('MODEL_' ~ i ~ '_API_URL') in held %}{% set ns.compatible = true %}{% endif %}{% endfor %}
57
+ {% for label, name in [('OpenRouter', 'OPENROUTER_API_KEY'), ('OpenAI', 'OPENAI_API_KEY'), ('Anthropic', 'ANTHROPIC_API_KEY'), ('OpenAI-compatible', 'MODEL_API_URL')] %}
58
+ {% set on = ns.compatible if name == 'MODEL_API_URL' else name in held %}
59
+ <a href="#{{ 'providers' if name == 'MODEL_API_URL' else name }}" class="st-ready-i{{ ' on' if on }}"><span aria-hidden="true">{{ '✓' if on else '○' }}</span> {{ label }}<span class="sr">{{ ': set' if on else ': not set' }}</span></a>
60
+ {% endfor %}
61
+ {% for jj, name in [(judges[0], 'System One'), (judges[1], 'LLM judge')] %}<a href="#judge" class="st-ready-i{{ ' on' if jj }}"><span aria-hidden="true">{{ '✓' if jj else '○' }}</span> {{ name }}<span class="sr">{{ ': set' if jj else ': not set' }}</span></a>{% endfor %}
62
+ {% for item in chosen %}<a href="#HOSTS" class="st-ready-i on"><span aria-hidden="true">✓</span> <span class="mono">{{ item.split('=', 1)[0] if '=' in item.split('@', 1)[0] else item.split(':/')[0].split(':~')[0] }}</span></a>{% else %}<a href="#HOSTS" class="st-ready-i"><span aria-hidden="true">○</span> no run host</a>{% endfor %}
63
+ </div>
64
+ </header>
65
+ {% if not writable %}
66
+ <div class="harbor-state harbor-state-network"><strong>Read-only from here.</strong> Settings are written from a browser on the application host only.</div>
67
+ {% endif %}
68
+ {% if unread %}
69
+ <div class="harbor-state harbor-state-network" id="settings-unread"><strong>Not read by Nullius.</strong> <span class="mono">{{ env_file }}</span> holds {% for u in unread %}<span class="mono">{{ u.name }}</span>{% if u.startup %} (Nullius reads <span class="mono">{{ u.instead }}</span> at start){% elif u.instead %} (this page reads <a class="mono" href="#{{ u.instead }}">{{ u.instead }}</a>){% endif %}{{ ', ' if not loop.last }}{% endfor %}. No setting reads {{ 'it' if unread|length == 1 else 'them' }}.{% set passed = unread|selectattr('inherited')|map(attribute='name')|list %}{% if passed %} A run Nullius starts still inherits {% for n in passed %}<span class="mono">{{ n }}</span>{{ ', ' if not loop.last }}{% endfor %} in its environment.{% endif %}</div>
70
+ {% endif %}
71
+
72
+ <div class="st-layout">
73
+ <nav class="st-index" aria-label="Settings sections">
74
+ <label class="st-search"><svg class="ic" aria-hidden="true"><use href="#i-search"/></svg><input type="search" id="settings-search" placeholder="Search settings" aria-label="Search settings" autocomplete="off"></label>
75
+ {% macro section_link(id, title, icon, keywords) %}
76
+ <a href="#{{ id }}" data-section="{{ id }}" data-search="{{ keywords }}"><svg class="ic" aria-hidden="true"><use href="#i-{{ icon }}"/></svg><span>{{ title }}</span></a>
77
+ {% endmacro %}
78
+ <div class="st-nav-group">
79
+ {{ section_link('general', 'General', 'gear', 'onboarding tour checklist first steps getting started') }}
80
+ {{ section_link('appearance', 'Appearance', 'sun', 'theme light dark system') }}
81
+ </div>
82
+ <div class="st-nav-group">
83
+ <div class="st-nav-label">Evaluation</div>
84
+ {{ section_link('providers', 'Model providers', 'capability', 'openrouter openai anthropic openai-compatible local endpoint ollama vllm api key model_api_url') }}
85
+ {% set access_search = namespace(words='agent keys agent_keys cursor copilot dataset credentials token licence benchmark access') %}
86
+ {% for b in benchmark_access %}{% set access_search.words = access_search.words ~ ' ' ~ b.title %}{% for s in b.needs %}{% set access_search.words = access_search.words ~ ' ' ~ s.name ~ ' ' ~ s.summary %}{% endfor %}{% endfor %}
87
+ {{ section_link('data-providers', 'Data providers', 'ws', 'hugging face huggingface hf_token docker hub login registry token dataset pull limit') }}
88
+ {{ section_link('custom-keys', 'Custom keys', 'agent', access_search.words) }}
89
+ {{ section_link('judge', 'Judges', 'compare', 'typesafe system one llm model judgement') }}
90
+ {{ section_link('prices', 'Model prices', 'dollar', 'cost price estimate usd tokens list update') }}
91
+ </div>
92
+ <div class="st-nav-group">
93
+ <div class="st-nav-label">Execution</div>
94
+ {{ section_link('hosts', 'Run hosts', 'runs', 'ssh remote machines server hosts') }}
95
+ {{ section_link('sandbox', 'Sandbox', 'kit', 'docker container') }}
96
+ </div>
97
+ <div class="st-nav-group">
98
+ <div class="st-nav-label">Application</div>
99
+ {{ section_link('storage', 'Local data', 'ws', 'settings.json config catalogue workspaces runs cache licences storage paths file') }}
100
+ </div>
101
+ <p class="st-search-empty" role="status" hidden>No settings found.</p>
102
+ </nav>
103
+
104
+ <div class="st-main">
105
+ {% if writable %}<form method="post" action="{{ url_for('settings_save') }}" class="settings-form" autocomplete="off" id="settings-form">
106
+ {% if embedded %}<input type="hidden" name="embedded" value="1">{% endif %}
107
+ <input type="hidden" name="csrf" value="{{ csrf }}">{% endif %}
108
+
109
+ <section class="st-section" id="providers" aria-labelledby="providers-h"{% if writable %} data-test="{{ url_for('settings_provider_test') }}"{% endif %}>
110
+ <div class="st-section-head">
111
+ <div class="st-provider-heading"><h2 id="providers-h">Model providers</h2><div class="st-provider-actions">{% if writable %}<button type="button" class="btn sm ghost" data-provider-test-all hidden><svg class="ic" aria-hidden="true"><use href="#i-refresh"/></svg>Test all</button>{% endif %}<button type="button" class="btn sm ghost st-provider-add" data-provider-add aria-label="Add a provider" hidden><span aria-hidden="true">+</span> Add</button></div></div>
112
+ <p>Manage the providers available for runs and judges.</p>
113
+ </div>
114
+
115
+ {% macro provider_logo(key) %}{% if key == 'typesafe' %}<img class="st-logo" src="{{ url_for('static', filename='brand/typesafe.png') }}" alt="" width="28" height="28">{% elif key.startswith('local') %}<svg class="st-logo st-icon" aria-hidden="true" viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="7" rx="2"/><rect x="3" y="13" width="18" height="7" rx="2"/><path d="M7 7.5h.01M7 16.5h.01"/></svg>{% else %}<svg class="st-logo" aria-hidden="true"><use href="{{ marks }}#{{ key }}"/></svg>{% endif %}{% endmacro %}
116
+ <button type="button" class="btn ghost st-provider-back" data-provider-back hidden>← Model providers</button>
117
+ <p class="st-about" data-provider-empty hidden>No providers added yet.</p>
118
+ <div class="st-provider-catalogue" hidden>
119
+ <h3>Add a provider</h3>
120
+ <label class="st-search"><svg class="ic" aria-hidden="true"><use href="#i-search"/></svg><input type="search" data-provider-search placeholder="Search providers…" aria-label="Search providers" autocomplete="off"></label>
121
+ <div class="st-provider-grid">
122
+ {% for key, title, endpoint, names in providers %}
123
+ <button type="button" class="st-provider-choice" data-provider-select="{{ 'local:new' if key == 'local' else key }}" data-provider-name="{{ title }}">{{ provider_logo(key) }}<span>{{ title }}</span></button>
124
+ {% endfor %}
125
+ </div>
126
+ <p class="st-about" data-provider-no-results hidden>No providers found.</p>
127
+ </div>
128
+ {% for key, title, endpoint, names in cards %}
129
+ {% set any_set = names | map(attribute=0) | select('in', held) | list %}
130
+ {% set need = names[1 if key.startswith('local:') else 0][0] %}
131
+ {% set refused = need in held and by[need].problem %}
132
+ {% set ready = need in held and not refused %}
133
+ <div class="st-card st-provider-card" data-provider-card="{{ key }}" data-configured="{{ 'true' if any_set else 'false' }}" data-ready="{{ 'true' if ready else 'false' }}">
134
+ <div class="st-provider-summary">
135
+ {{ provider_logo(key) }}
136
+ {% set ns_env = namespace(held=false) %}{% for name, _ in names %}{% if by.get(name) and by[name].source == 'environment' %}{% set ns_env.held = true %}{% endif %}{% endfor %}
137
+ {% set removable = writable and any_set %}
138
+ {#- Test asks the saved settings at no cost (providers.test); TypeSafe has no such request -#}
139
+ {% set choice = key.replace('local', 'custom', 1) %}{% set last = tested.get(choice) %}
140
+ {% set testable = writable and key != 'typesafe' %}
141
+ <div><h3>{{ title }}</h3><p class="st-about" data-provider-state>{{ ('Endpoint saved' if key.startswith('local') else 'Key saved') if ready else 'Fix the endpoint URL' if refused else ('Endpoint required' if any_set else 'Not configured') }}</p>
142
+ {% if testable or last %}<p class="st-about st-provider-test" data-provider-test-state{% if last %} data-state="{{ last.mark }}"{% endif %} aria-live="polite">{{ last.said if last }}</p>{% endif %}
143
+ {% if removable and ns_env.held %}<p class="st-note" id="remove-note-{{ loop.index }}">Set in the process environment: remove it there.</p>{% endif %}</div>
144
+ {% if testable %}<button type="button" class="btn sm ghost" data-provider-test="{{ choice }}" aria-label="Test {{ title }}" hidden><svg class="ic" aria-hidden="true"><use href="#i-refresh"/></svg>Test</button>{% endif %}
145
+ <button type="button" class="btn sm ghost" data-provider-edit="{{ key }}" hidden>{{ 'Edit' if writable else 'View' }}</button>
146
+ {#- removing asks first, in place, as a benchmark's Delete does -#}
147
+ {% if removable %}<button type="button" class="btn sm ghost danger" data-provider-remove-ask aria-label="Remove {{ title }}" aria-expanded="false" aria-controls="remove-ask-{{ loop.index }}"{% if ns_env.held %} disabled aria-describedby="remove-note-{{ loop.index }}"{% endif %}>Remove</button>{% endif %}
148
+ </div>
149
+ {% if removable and not ns_env.held %}
150
+ <div class="bench-delete-ask st-provider-ask" id="remove-ask-{{ loop.index }}" role="group" aria-label="Remove {{ title }}" hidden>
151
+ <span>Remove <b>{{ title }}</b> and {{ 'its URL and key' if key.startswith('local') else 'its key' }}?</span>
152
+ <button type="button" class="btn danger" data-provider-remove-yes="{{ key }}">Yes, remove</button>
153
+ <button type="button" class="btn ghost" data-provider-remove-keep>Keep it</button>
154
+ </div>
155
+ {% endif %}
156
+ <div class="st-provider-fields">
157
+ {% if endpoint %}<div class="st-row"><span class="st-row-label">Endpoint</span><span class="st-row-value mono">{{ endpoint }}</span></div>{% endif %}
158
+ {% for name, label in names %}{% if by.get(name) %}{{ field(by[name], label, writable, mode='plain' if label in ('Name', 'Endpoint') else 'optional-key' if key.startswith('local') else 'key') }}{% endif %}{% endfor %}
159
+ </div>
160
+ <button type="button" class="btn ghost st-provider-done" data-provider-done hidden>Done</button>
161
+ </div>
162
+ {% endfor %}
163
+ {% if writable %}<input type="hidden" name="remove_provider" value="">{% endif %}
164
+ {% if writable %}
165
+ <div class="st-card st-provider-card" data-provider-card="local:new" data-configured="false" data-ready="false">
166
+ <div class="st-provider-summary">{{ provider_logo('local') }}<div><h3>OpenAI-compatible</h3></div>
167
+ <button type="button" class="btn sm ghost" data-provider-edit="local:new" hidden>Edit</button></div>
168
+ <div class="st-provider-fields" id="endpoint-new">
169
+ {% for part, label, kind in [('name', 'Name', 'text'), ('url', 'Endpoint', 'text'), ('key', 'Key', 'password')] %}
170
+ <div class="st-row"><label class="st-row-label" for="endpoint-{{ part }}">{{ label }}</label>
171
+ <div class="st-row-value"><input class="st-input" id="endpoint-{{ part }}" name="endpoint_{{ part }}" type="{{ kind }}" spellcheck="false" autocomplete="off"{% if part == 'key' %} placeholder="(optional)" data-1p-ignore data-lpignore="true"{% endif %}></div></div>
172
+ {% endfor %}
173
+ </div>
174
+ <button type="button" class="btn ghost st-provider-done" data-provider-done hidden>Done</button>
175
+ </div>
176
+ {% endif %}
177
+ </section>
178
+
179
+ <section class="st-section" id="judge" aria-labelledby="judge-h">
180
+ <div class="st-section-head">
181
+ <h2 id="judge-h">Judges</h2>
182
+ <p>Choose the judges that evaluate trial evidence.</p>
183
+ </div>
184
+ {% set s1, llm = judges %}
185
+
186
+ {% macro picker(name, providers, judge, label) %}
187
+ <div class="st-judges" role="radiogroup" aria-label="{{ label }}" data-picker>
188
+ {% for key, d in providers.items() %}
189
+ {% set available = (d.get('url_var') or d['key']) in held %}
190
+ <label class="st-judge" data-provider="{{ key }}" data-available="{{ 'true' if available else 'false' }}"{% if not available %} hidden{% endif %}><input type="radio" name="value:{{ name }}" value="{{ key }}"{{ ' checked' if judge.provider == key and available }}{{ ' disabled' if not writable or not available }}
191
+ data-default="{{ d.get('model', '') }}" data-models="{{ d.get('models', [])|join('|') }}">
192
+ <span><b>{{ 'TypeSafe AI' if key == 'typesafe' else d.label }}</b></span></label>
193
+ {% endfor %}
194
+ </div>
195
+ <p class="st-about" data-no-judge-provider>No compatible provider added. <a href="#providers">Add a provider</a></p>
196
+ {% endmacro %}
197
+ {% set srow = by.get('SYSTEM_ONE_PROVIDER') %}
198
+ {% if srow and by.get('SYSTEM_ONE_MODEL') %}
199
+ <fieldset class="st-card{{ ' st-card-unset' if not s1 }}" data-judge-card>
200
+ <legend><svg class="st-logo st-icon" aria-hidden="true" viewBox="0 0 24 24"><path d="M12 3v18M7 21h10M5 7h14M5 7l-3 7a3 3 0 0 0 6 0zM19 7l-3 7a3 3 0 0 0 6 0z"/></svg>System One</legend>
201
+ <article class="st-field" id="SYSTEM_ONE_PROVIDER" data-source="{{ srow.source }}" data-secret="no">{{ picker('SYSTEM_ONE_PROVIDER', s1_providers, s1, 'Where System One is asked') }}</article>
202
+ {{ field(by['SYSTEM_ONE_MODEL'], 'Model', writable, s1_providers[s1.provider].models) }}
203
+ </fieldset>
204
+ {% endif %}
205
+ {% set prow = by.get('LLM_JUDGE_PROVIDER') %}
206
+ {% if prow and by.get('LLM_JUDGE_MODEL') %}
207
+ <fieldset class="st-card{{ ' st-card-unset' if not llm }}" data-judge-card>
208
+ <legend><svg class="st-logo st-icon" aria-hidden="true" viewBox="0 0 24 24"><circle cx="12" cy="12" r="8"/><path d="M9 10h.01M15 10h.01M9 15c1.5 1.2 4.5 1.2 6 0"/></svg>LLM judge</legend>
209
+ <article class="st-field" id="LLM_JUDGE_PROVIDER" data-source="{{ prow.source }}" data-secret="no">{{ picker('LLM_JUDGE_PROVIDER', llm_providers, llm, "The LLM judge's provider") }}</article>
210
+
211
+ {{ field(by['LLM_JUDGE_MODEL'], 'Model', writable, []) }}
212
+
213
+ </fieldset>
214
+ {% endif %}
215
+ </section>
216
+
217
+ {% include "settings/custom_keys.html" %}
218
+
219
+ <section class="st-section" id="hosts" aria-labelledby="hosts-h">
220
+ <div class="st-section-head">
221
+ <h2 id="hosts-h">Run hosts</h2>
222
+ <p>Machines a recipe can run on, over ssh. A host's name tests it.</p>
223
+ </div>
224
+ {% if hosts_row %}
225
+ <article class="st-field st-hosts" id="HOSTS" data-source="{{ hosts_row.source }}" data-secret="no">
226
+ {% if writable %}
227
+ <div class="settings-list" data-list="HOSTS" data-kind="hosts">
228
+ <div class="host-pills">{% for item in chosen %}<span class="chip st-watch host-pill" data-entry="{{ item }}" title="{{ item }}"><button type="button" class="host-name" data-test-host>{{ item.split('=', 1)[0] if '=' in item.split('@', 1)[0] else item.split(':/')[0].split(':~')[0] }}</button><span class="settings-test"></span><button type="button" class="host-remove" data-remove-item aria-label="Remove this host">×</button></span>{% endfor %}</div>
229
+ <div class="host-actions"><button type="button" class="btn sm" data-add-host>+ Add host</button><button type="button" class="btn sm ghost" data-test-all{% if not chosen %} hidden{% endif %}>Test all</button></div>
230
+ <input type="hidden" name="value:HOSTS" value="{{ hosts_row.shown }}">
231
+ </div>
232
+ {% else %}
233
+ <p class="mono">{{ chosen | join(', ') or '—' }}</p>
234
+ {% endif %}
235
+ </article>
236
+ <p class="st-about">HOSTS. An alias from ~/.ssh/config, or user@host[:port]. Only the name is stored; keys stay where they are.</p>
237
+ {% endif %}
238
+ </section>
239
+
240
+ {% if writable %}
241
+ <div class="st-savebar" role="status" aria-live="polite"><span class="st-changes" data-changes></span><button class="btn" type="submit" data-settings-retry hidden>Retry save</button><noscript><button class="btn" type="submit">Save</button></noscript></div>
242
+ </form>
243
+ {% endif %}
244
+ {# Benchmark controls share the Custom keys section, but each submits to its own form.
245
+ Keep these forms outside settings-form so browser form ownership stays unambiguous. #}
246
+ {% if writable %}<div hidden>
247
+ {% for b in benchmark_access %}{% for s in b.needs %}
248
+ {% for action, show in [('set', true), ('delete', s.status.set), ('move', s.movable)] %}{% if show %}
249
+ <form id="access-{{ b.key }}-{{ s.name }}-{{ action }}" method="post" action="{{ url_for('benchmark_licence', key=b.key) }}"{% if s.kind == 'file' and action == 'set' %} enctype="multipart/form-data"{% endif %}>
250
+ <input type="hidden" name="csrf" value="{{ csrf }}"><input type="hidden" name="name" value="{{ s.name }}"><input type="hidden" name="action" value="{{ action }}">
251
+ {% if embedded %}<input type="hidden" name="embedded" value="1">{% endif %}
252
+ </form>
253
+ {% endif %}{% endfor %}
254
+ {% endfor %}{% endfor %}
255
+ </div>{% endif %}
256
+ {% include 'settings/data_providers.html' %}
257
+ {# the container backend's engine on this machine, outside the form: asked when the section opens (sandbox.js) #}
258
+ <section class="st-section" id="sandbox" aria-labelledby="sandbox-h" data-sandbox="{{ url_for('settings_sandbox') }}">
259
+ <div class="st-section-head"><h2 id="sandbox-h">Sandbox</h2><p>Where agents run, apart from this machine.</p></div>
260
+ <div class="st-card">
261
+ <div class="st-row"><span class="st-row-label">Engine</span><span class="st-row-value" data-docker-state>Checking…</span></div>
262
+ </div>
263
+ </section>
264
+
265
+ {# the user's price list (nullius.prices), outside the form: prices.js draws the state and answers the buttons #}
266
+ <section class="st-section" id="prices" aria-labelledby="prices-h" data-state='{{ prices|tojson }}'{% if writable %} data-csrf="{{ csrf }}" data-update="{{ url_for('settings_prices_update') }}" data-set="{{ url_for('settings_prices_set') }}" data-remove="{{ url_for('settings_prices_remove') }}"{% endif %}>
267
+ <div class="st-section-head"><h2 id="prices-h">Model prices</h2><p>What a run's cost is estimated from, in USD per million tokens.</p></div>
268
+ <div class="st-card">
269
+ <div class="st-row"><span class="st-row-label">Price list</span><span class="st-row-value st-value"><span data-prices-state></span>{% if writable %} <button type="button" class="btn sm" data-prices-update><svg class="ic" aria-hidden="true"><use href="#i-refresh"/></svg><span>Update</span></button>{% endif %}</span></div>
270
+ </div>
271
+ <fieldset class="st-card">
272
+ <legend>Your prices</legend>
273
+ <div class="st-sandbox-rows" data-own-rows></div>
274
+ <p class="st-about" data-own-none hidden>None yet.</p>
275
+ {% if writable %}
276
+ <form class="st-sandbox-rows st-prices-add" data-own-add autocomplete="off">
277
+ <div class="st-row"><label class="st-row-label" for="price-model">Model</label>
278
+ <div class="st-row-value"><input class="st-input" id="price-model" name="model" type="text" spellcheck="false" autocomplete="off" maxlength="200" required></div></div>
279
+ <div class="st-row"><label class="st-row-label" for="price-input">Input</label>
280
+ <div class="st-row-value"><input class="st-input" id="price-input" name="input" type="number" min="0" step="any" inputmode="decimal" required></div></div>
281
+ <div class="st-row"><label class="st-row-label" for="price-output">Output</label>
282
+ <div class="st-row-value"><input class="st-input" id="price-output" name="output" type="number" min="0" step="any" inputmode="decimal" required></div></div>
283
+ <div class="st-row"><label class="st-row-label" for="price-cached">Cached input</label>
284
+ <div class="st-row-value"><input class="st-input" id="price-cached" name="cached" type="number" min="0" step="any" inputmode="decimal"></div></div>
285
+ <div class="st-row"><label class="st-row-label" for="price-cache-write">Cache write</label>
286
+ <div class="st-row-value"><input class="st-input" id="price-cache-write" name="cache_write" type="number" min="0" step="any" inputmode="decimal"></div></div>
287
+ <div class="st-row"><label class="st-row-label" for="price-cache-write-1h">Cache write · 1 hour</label>
288
+ <div class="st-row-value"><input class="st-input" id="price-cache-write-1h" name="cache_write_1h" type="number" min="0" step="any" inputmode="decimal"></div></div>
289
+ <div class="st-row"><span class="st-row-label"></span><span class="st-row-value st-value"><button type="submit" class="btn sm">Add</button></span></div>
290
+ </form>
291
+ {% endif %}
292
+ </fieldset>
293
+ </section>
294
+
295
+ {# kept in this browser, not in the file: onboarding.js fills the state and answers the buttons #}
296
+ <section class="st-section" id="general" aria-labelledby="general-h">
297
+ <div class="st-section-head">
298
+ <h2 id="general-h">General</h2>
299
+ <p>First steps and guidance.</p>
300
+ </div>
301
+ <div class="st-card st-guidance">
302
+ <div class="st-row"><span class="st-row-label">Onboarding</span><span class="st-row-value"><button class="btn sm ghost" type="button" data-onb="replay" title="Ask again whether to be guided, then the tour of the main pages">Replay the onboarding</button></span></div>
303
+ <div class="st-row"><span class="st-row-label">First steps</span><span class="st-row-value"><button class="btn sm ghost" type="button" data-onb="restore" id="onb-restore" hidden>Show it again</button>
304
+ <span class="onb-state" id="onb-state"></span></span></div>
305
+ </div>
306
+ </section>
307
+
308
+ <section class="st-section" id="appearance" aria-labelledby="appearance-h">
309
+ <div class="st-section-head"><h2 id="appearance-h">Appearance</h2><p>Choose how Nullius looks on this device.</p></div>
310
+ <div class="st-card">
311
+ <div class="st-row"><span class="st-row-label">Theme</span>
312
+ <div class="st-theme-options" role="group" aria-label="Theme">
313
+ {% for theme, label in [('system', 'System'), ('light', 'Light'), ('charcoal', 'Neutral charcoal'), ('graphite', 'Cool graphite'), ('midnight', 'Midnight blue')] %}<button type="button" class="btn ghost" data-theme-choice="{{ theme }}" aria-pressed="false"><span class="st-theme-swatch" data-swatch="{{ theme }}" aria-hidden="true"><i></i><i></i><i></i></span>{{ label }}</button>{% endfor %}
314
+ </div>
315
+ </div>
316
+ </div>
317
+ </section>
318
+ <section class="st-section" id="storage" aria-labelledby="storage-h">
319
+ <div class="st-section-head"><h2 id="storage-h">Local data</h2><p>Active storage locations on this machine.</p></div>
320
+ {% for label, path in storage_paths %}
321
+ <div class="st-card"><div class="st-row"><span class="st-row-label">{{ label }}</span><span class="st-row-value mono">{{ path }}</span></div></div>
322
+ {% endfor %}
323
+ <p class="st-about">Read-only paths. Personal data stays outside the installation and survives upgrades.</p>
324
+ </section>
325
+ </div>
326
+ </div>
327
+
328
+ <script src="{{ url_for('static', filename='settings/judges.js') }}"></script>
329
+ <script src="{{ url_for('static', filename='settings/navigation.js') }}"></script>
330
+ <script src="{{ url_for('static', filename='settings/providers.js') }}"></script>
331
+ <script src="{{ url_for('static', filename='settings/sandbox.js') }}"></script>
332
+ <script src="{{ url_for('static', filename='settings/prices.js') }}"></script>
333
+ <script src="{{ url_for('static', filename='settings/data-providers.js') }}"></script>
334
+ {% if writable %}
335
+ <dialog id="add-host" class="settings-dialog">
336
+ {# a host: one of the ssh config's, or by hand — who and where, and how ssh gets in without a prompt. Test before Add; no password is ever stored, one is used once to put this machine's key on the host. #}
337
+ <div class="dialog-head"><h3>Add host</h3><p class="faint">Choose a machine for your runs.</p></div>
338
+ {# The tabs and the config panel exist only when the ssh config names a
339
+ host; `dialog-panels` wraps the panels either way, or its closing tag
340
+ below would close an ancestor and take the dialog's own footer — and
341
+ the script's `[data-cancel]` — out of it. #}
342
+ {% if ssh_hosts %}<div class="dialog-tabs" role="tablist">
343
+ <button type="button" class="dialog-tab on" data-tab="config" role="tab" aria-selected="true">From SSH config</button>
344
+ <button type="button" class="dialog-tab" data-tab="manual" role="tab" aria-selected="false">Enter manually</button>
345
+ </div>{% endif %}
346
+ <div class="dialog-panels">
347
+ {% if ssh_hosts %}<div class="dialog-panel" data-panel="config">
348
+ <label class="fl" id="host-picker-label">Host</label>
349
+ <div class="host-picker">
350
+ <button type="button" class="host-picker-trigger" aria-labelledby="host-picker-label host-picked" aria-expanded="false" aria-controls="host-options"><span id="host-picked">Select a host</span><span aria-hidden="true">⌄</span></button>
351
+ <div id="host-options" class="host-options" hidden>
352
+ <input type="search" class="host-search" aria-label="Filter hosts by name, user or address" placeholder="Filter by name, user or address…" autocomplete="off">
353
+ <p class="host-count" aria-live="polite"></p>
354
+ <div class="host-options-list" role="listbox" aria-label="SSH hosts">{% for h in ssh_hosts %}<button type="button" class="pick" role="option" data-host-chip="{{ h.alias }}" aria-selected="false"><span class="pick-name">{{ h.alias }}</span><span class="pick-sub">{{ h.user ~ ' @ ' if h.user }}{{ h.hostname or h.alias }}{{ ' · ' ~ h.port if h.port }}</span></button>{% endfor %}</div>
355
+ <p class="faint small" data-no-matches hidden>No hosts match your search.</p>
356
+ </div>
357
+ </div>
358
+ <p class="faint small" data-all-chosen hidden>Every host in the config is already in the list.</p>
359
+ </div>{% endif %}
360
+ <form autocomplete="off" class="dialog-panel" data-panel="manual"{% if ssh_hosts %} hidden{% endif %}>
361
+ <label class="field host-field"><span class="fl">Host name</span><input type="text" name="display_name" required maxlength="64" placeholder="e.g. GPU lab" autocomplete="off"></label>
362
+ <div class="field-row">
363
+ <label class="field grow"><span class="fl">Address</span><input type="text" name="host" required spellcheck="false" placeholder="IP address or hostname"></label>
364
+ <label class="field port"><span class="fl">Port</span><input type="number" name="port" min="1" max="65535" value="22" required></label>
365
+ </div>
366
+ <label class="field host-field"><span class="fl">User</span><input type="text" name="user" required spellcheck="false" placeholder="e.g. ubuntu" autocomplete="off"></label>
367
+ <span class="fl">SSH key</span>
368
+ <div class="auth-cards">
369
+ <label class="auth-card"><input type="radio" name="auth" value="agent" checked><span class="auth-body"><span class="auth-title">Use SSH agent</span><span class="auth-sub">Use a key already available on this machine.</span></span></label>
370
+ <label class="auth-card"><input type="radio" name="auth" value="path"><span class="auth-body"><span class="auth-title">Path of the key</span><span class="auth-more"><span><input type="text" name="key_path" aria-label="Path of the key" placeholder="~/.ssh/id_ed25519" spellcheck="false"></span></span></span></label>
371
+ <label class="auth-card"><input type="radio" name="auth" value="file"><span class="auth-body"><span class="auth-title">Upload a key</span><span class="auth-more"><span><input type="file" name="key_file" aria-label="Upload a key"></span></span></span></label>
372
+ <details class="host-advanced"><summary>More authentication options</summary><label class="auth-card"><input type="radio" name="auth" value="password"><span class="auth-body"><span class="auth-title">A password, used once</span><span class="auth-sub">puts this machine's key on the host; the password is never stored</span><span class="auth-more"><span><input type="password" name="password" autocomplete="off" data-1p-ignore data-lpignore="true"></span></span></span></label></details>
373
+ </div>
374
+ </form>
375
+ </div>
376
+ <div class="dialog-foot">
377
+ <span class="settings-test dialog-status"></span>
378
+ <button type="button" class="btn sm ghost" data-cancel>Cancel</button>
379
+ <button type="button" class="btn sm ghost" data-dialog-test disabled>Test connection</button>
380
+ <button type="button" class="btn sm" data-dialog-add disabled>Add host</button>
381
+ </div>
382
+ </dialog>
383
+ <script>
384
+ // The hosts list: the chips that are on; the hidden value is their join, kept current.
385
+ const csrf = document.querySelector('#settings-form input[name=csrf]').value;
386
+ document.querySelectorAll('.settings-list').forEach(list => {
387
+ const hidden = list.querySelector('input[type=hidden]');
388
+ const sync = () => {
389
+ const all = list.querySelector('[data-test-all]'); if (all) all.hidden = !list.querySelector('.host-pill');
390
+ hidden.value = [...list.querySelectorAll('.host-pill')].map(i => i.dataset.entry).filter(Boolean).join(', ');
391
+ hidden.dispatchEvent(new Event('change', {bubbles: true}));
392
+ };
393
+ const label = entry => entry.split('@')[0].includes('=') ? entry.split('=')[0] : entry.split(':/')[0].split(':~')[0];
394
+ const paint = (pill, result) => { // grey until tested, green when it answers, red when not
395
+ pill.classList.remove('st-watch', 'st-runs', 'st-blocked'); pill.classList.add(!result ? 'st-watch' : result.ok ? 'st-runs' : 'st-blocked');
396
+ const out = pill.querySelector('.settings-test'); out.textContent = !result ? '' : result.ok ? '✓ ' + result.detail : '✕ ' + result.error;
397
+ pill.title = !result ? pill.dataset.entry : (result.ok ? result.detail : result.error) + ' — ' + pill.dataset.entry; // the detail is a hover away
398
+ };
399
+ const addHost = (entry, result) => {
400
+ const pill = document.createElement('span'); pill.className = 'chip host-pill'; pill.dataset.entry = entry; pill.title = entry;
401
+ pill.innerHTML = '<button type="button" class="host-name" data-test-host></button><span class="settings-test"></span><button type="button" class="host-remove" data-remove-item aria-label="Remove this host">×</button>';
402
+ pill.querySelector('.host-name').textContent = label(entry);
403
+ list.querySelector('.host-pills').appendChild(pill); paint(pill, result); sync();
404
+ };
405
+ const testPill = pill => { pill.querySelector('.settings-test').textContent = '…'; return testHost(pill.dataset.entry).then(r => paint(pill, r)); };
406
+ list.addEventListener('click', e => {
407
+ if (e.target.closest('[data-add-host]')) openAddHost(addHost, () => [...list.querySelectorAll('.host-pill')].map(i => i.dataset.entry));
408
+ if (e.target.closest('[data-remove-item]')) { e.target.closest('.host-pill').remove(); sync(); }
409
+ const name = e.target.closest('[data-test-host]');
410
+ if (name) testPill(name.closest('.host-pill'));
411
+ const all = e.target.closest('[data-test-all]');
412
+ if (all) { all.disabled = true; Promise.all([...list.querySelectorAll('.host-pill')].map(testPill)).then(() => { all.disabled = false; }); }
413
+ });
414
+ });
415
+ // One ssh from the application host, nothing stored: whether the host answers, and what it has.
416
+ const testHost = async entry => {
417
+ try {
418
+ const r = await nulliusFetch({{ url_for('settings_host_test')|tojson }}, {method: 'POST', headers: {'X-CSRF-Token': csrf}, body: new URLSearchParams({entry})});
419
+ const j = await r.json();
420
+ if (!j.ok) return {ok: false, error: j.error || ('HTTP ' + r.status)};
421
+ const has = k => k + (j[k] ? '' : ' missing');
422
+ return {ok: true, detail: [j.hostname, has('uv'), j.engine ? j.engine + (j[j.engine + '_ok'] ? '' : ' (no access)') : 'docker or podman missing', j.harbor ? 'harbor ' + (j.harbor_version || '') : 'harbor missing', j.latency_ms + ' ms'].filter(Boolean).join(' · ')};
423
+ } catch (err) { return {ok: false, error: String(err)}; }
424
+ };
425
+ // The Add host dialog. Either panel names one host; Test tries it and Add puts it in the list with what Test found.
426
+ // Manual: the SSH agent or a key path needs no request; a key file is saved on this machine first; a password is used once to put this machine's key on the host.
427
+ const dialog = document.getElementById('add-host'), dform = dialog.querySelector('form'), dstatus = dialog.querySelector('.dialog-status');
428
+ let onAdded = null, panel = 'manual', resolved = null, tested = null;
429
+ const say = (text, cls) => { dstatus.textContent = text; dstatus.className = 'settings-test dialog-status' + (cls ? ' ' + cls : ''); dstatus.title = ''; };
430
+ const showTab = name => {
431
+ panel = name; say('');
432
+ dialog.querySelectorAll('.dialog-tab').forEach(t => { const on = t.dataset.tab === name; t.classList.toggle('on', on); t.setAttribute('aria-selected', on); });
433
+ dialog.querySelectorAll('.dialog-panel').forEach(p => { const on = p.dataset.panel === name; p.classList.toggle('on', on); p.hidden = !on; p.inert = !on; });
434
+ updateHostButtons();
435
+ };
436
+ const openAddHost = (cb, chosen) => {
437
+ onAdded = cb; dform.reset(); resolved = tested = null; say('');
438
+ const have = chosen(), picks = [...dialog.querySelectorAll('.pick')];
439
+ picks.forEach(c => { c.dataset.chosen = String(have.includes(c.dataset.hostChip)); c.hidden = c.dataset.chosen === 'true'; c.classList.remove('on'); c.setAttribute('aria-selected', 'false'); });
440
+ const left = picks.some(c => !c.hidden), all = dialog.querySelector('[data-all-chosen]');
441
+ if (all) all.hidden = left;
442
+ if (hostSearch) { hostSearch.value = ''; picked.textContent = 'Select a host'; filterHosts(); toggleHostOptions(false); }
443
+ showTab(dialog.querySelector('.dialog-tab') && left ? 'config' : 'manual');
444
+ document.querySelector('[data-add-host]').focus({preventScroll: true});
445
+ dialog.showModal();
446
+ };
447
+ // Some browsers do not focus buttons on pointer clicks. Restore a control,
448
+ // rather than letting the dialog return focus to the surrounding document.
449
+ dialog.addEventListener('close', () => document.querySelector('[data-add-host]').focus({preventScroll: true}));
450
+ dialog.querySelector('[data-cancel]').addEventListener('click', () => dialog.close());
451
+ dialog.addEventListener('click', event => {
452
+ const box = dialog.getBoundingClientRect();
453
+ if (event.target === dialog && (event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom)) dialog.close();
454
+ });
455
+ dialog.querySelectorAll('.dialog-tab').forEach(t => t.addEventListener('click', () => showTab(t.dataset.tab)));
456
+ const hostTrigger = dialog.querySelector('.host-picker-trigger'), hostOptions = dialog.querySelector('#host-options'), hostSearch = dialog.querySelector('.host-search'), picked = dialog.querySelector('#host-picked');
457
+ const toggleHostOptions = open => { if (!hostOptions) return; hostOptions.hidden = !open; hostTrigger.setAttribute('aria-expanded', String(open)); };
458
+ const filterHosts = () => {
459
+ const query = hostSearch.value.trim().toLowerCase(), picks = [...dialog.querySelectorAll('.pick')];
460
+ const available = picks.filter(c => c.dataset.chosen !== 'true');
461
+ picks.forEach(c => { c.hidden = c.dataset.chosen === 'true' || !c.textContent.toLowerCase().includes(query); });
462
+ const count = available.filter(c => !c.hidden).length;
463
+ dialog.querySelector('.host-count').textContent = query ? `${count} of ${available.length} hosts` : `${available.length} hosts`;
464
+ dialog.querySelector('[data-no-matches]').hidden = count > 0;
465
+ };
466
+ const updateHostButtons = () => {
467
+ const f = new FormData(dform), auth = f.get('auth');
468
+ const ready = panel === 'config' ? !!dialog.querySelector('.pick.on') :
469
+ dform.checkValidity() && f.get('display_name').trim() && !/[,=@]/.test(f.get('display_name')) && f.get('user').trim() && f.get('host').trim() &&
470
+ (auth !== 'path' || f.get('key_path').trim()) && (auth !== 'file' || f.get('key_file')?.name) && (auth !== 'password' || f.get('password'));
471
+ dialog.querySelector('[data-dialog-test]').disabled = !ready;
472
+ dialog.querySelector('[data-dialog-add]').disabled = !ready;
473
+ };
474
+ if (hostTrigger) {
475
+ hostTrigger.addEventListener('click', () => { const open = hostOptions.hidden; toggleHostOptions(open); if (open) hostSearch.focus(); });
476
+ hostSearch.addEventListener('input', filterHosts);
477
+ dialog.addEventListener('click', e => { if (!e.target.closest('.host-picker')) toggleHostOptions(false); });
478
+ dialog.addEventListener('cancel', e => { if (!hostOptions.hidden) { e.preventDefault(); toggleHostOptions(false); hostTrigger.focus(); } });
479
+ hostOptions.addEventListener('keydown', e => {
480
+ const options = [...dialog.querySelectorAll('.pick')].filter(c => !c.hidden), index = options.indexOf(document.activeElement);
481
+ if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(e.key)) {
482
+ if (e.target === hostSearch && !['ArrowDown', 'ArrowUp'].includes(e.key)) return;
483
+ e.preventDefault();
484
+ const next = e.key === 'Home' ? 0 : e.key === 'End' ? options.length - 1 : Math.max(0, Math.min(options.length - 1, index + (e.key === 'ArrowDown' ? 1 : -1)));
485
+ options[next]?.focus();
486
+ }
487
+ });
488
+ }
489
+ dialog.querySelectorAll('.pick').forEach(c => c.addEventListener('click', () => {
490
+ dialog.querySelectorAll('.pick').forEach(o => { o.classList.toggle('on', o === c); o.setAttribute('aria-selected', String(o === c)); });
491
+ picked.replaceChildren(...[...c.children].map(el => el.cloneNode(true)));
492
+ resolved = tested = null; say(''); toggleHostOptions(false); updateHostButtons(); hostTrigger.focus();
493
+ }));
494
+ dform.querySelectorAll('.auth-card input:not([type=radio])').forEach(i => i.addEventListener('focus', () => { i.closest('.auth-card').querySelector('[type=radio]').checked = true; }));
495
+ dform.addEventListener('input', () => { resolved = tested = null; updateHostButtons(); });
496
+ dform.addEventListener('change', () => { resolved = tested = null; updateHostButtons(); });
497
+ dform.addEventListener('submit', e => { e.preventDefault(); dialog.querySelector('[data-dialog-add]').click(); });
498
+ // The entry the dialog names right now, or null with the reason said.
499
+ const entry = async () => {
500
+ if (panel === 'config') { const c = dialog.querySelector('.pick.on'); if (!c) { say('pick a host', 'bad'); return null; } return c.dataset.hostChip; }
501
+ if (!dform.reportValidity()) return null;
502
+ const f = new FormData(dform), auth = f.get('auth'), user = f.get('user').trim(), host = f.get('host').trim(), port = f.get('port').trim();
503
+ if (!user || !host) { say('user and host are needed', 'bad'); return null; }
504
+ const name = f.get('display_name').trim();
505
+ if (!name || /[,=@]/.test(name)) { say('Enter a host name without commas, @ or =.', 'bad'); return null; }
506
+ const named = value => name + '=' + value;
507
+ const target = user + '@' + host + (port ? ':' + port : '');
508
+ if (auth === 'agent') return named(target);
509
+ if (auth === 'path') { const k = f.get('key_path').trim(); if (!k) { say('Enter the path of the key.', 'bad'); return null; } return named(target + ':' + k); }
510
+ if (resolved && resolved.target === target && resolved.auth === auth) return named(resolved.entry);
511
+ const body = new FormData(); body.set('user', user); body.set('host', host); body.set('port', port);
512
+ let url;
513
+ if (auth === 'file') { if (!f.get('key_file') || !f.get('key_file').name) { say('choose a key file', 'bad'); return null; } body.set('key', f.get('key_file')); url = {{ url_for('settings_host_key')|tojson }}; }
514
+ else { if (!f.get('password')) { say('type the password', 'bad'); return null; } body.set('password', f.get('password')); url = {{ url_for('settings_host_enrol')|tojson }}; }
515
+ say(auth === 'file' ? 'saving the key…' : 'putting this machine\'s key on the host…');
516
+ try {
517
+ const r = await nulliusFetch(url, {method: 'POST', headers: {'X-CSRF-Token': csrf}, body});
518
+ const j = await r.json();
519
+ if (!j.ok) { say('✕ ' + (j.error || ('HTTP ' + r.status)), 'bad'); return null; }
520
+ resolved = {target, auth, entry: j.entry}; return named(j.entry);
521
+ } catch (err) { say('✕ ' + err, 'bad'); return null; }
522
+ finally { dform.querySelector('[name=password]').value = ''; }
523
+ };
524
+ dialog.querySelector('[data-dialog-test]').addEventListener('click', async () => {
525
+ const e = await entry(); if (!e) return;
526
+ say('testing…'); const r = await testHost(e); tested = {entry: e, result: r};
527
+ say(r.ok ? '✓ Connected' : '✕ ' + r.error, r.ok ? 'ok' : 'bad'); if (r.ok) dstatus.title = r.detail;
528
+ });
529
+ dialog.querySelector('[data-dialog-add]').addEventListener('click', async () => {
530
+ const e = await entry(); if (!e) return;
531
+ dialog.close(); onAdded(e, tested && tested.entry === e ? tested.result : null);
532
+ });
533
+ // Keep pressed with the pointer leaves the focus in the input, so no change fires for what it discards.
534
+ document.getElementById('settings-form').addEventListener('pointerdown', event => {
535
+ const button = event.target.closest('[data-replace]');
536
+ const input = button && button.closest('.st-field').querySelector('input[name^="value:"]:not([type=hidden])');
537
+ if (input && !input.hidden) event.preventDefault();
538
+ });
539
+ // Delegation keeps Replace and Remove working after a field's saved state refreshes.
540
+ document.getElementById('settings-form').addEventListener('click', event => {
541
+ const button = event.target.closest('[data-replace], [data-unset]');
542
+ if (!button) return;
543
+ const field = button.closest('.st-field');
544
+ const input = field.querySelector('input[name^="value:"]:not([type=hidden])');
545
+ const flag = field.querySelector('input[name^="clear:"]');
546
+ if (!input || !flag) return;
547
+ if (button.hasAttribute('data-replace')) {
548
+ input.value = ''; // emptied before it hides, so losing the focus changes nothing
549
+ input.hidden = !input.hidden;
550
+ button.textContent = input.hidden ? 'Replace' : 'Keep';
551
+ if (!input.hidden) input.focus();
552
+ } else {
553
+ flag.value = '1';
554
+ input.value = '';
555
+ input.hidden = true;
556
+ flag.dispatchEvent(new Event('change', {bubbles: true}));
557
+ }
558
+ });
559
+ </script>
560
+ <script src="{{ url_for('static', filename='settings/autosave.js') }}"></script>{% endif %}
561
+ <script src="{{ url_for('static', filename='settings/custom-keys.js') }}"></script>
562
+
563
+ </div>
564
+ {% endblock %}